[vlc-commits] direct3d11: remove the local d3d11_handle_t instances

Steve Lhomme git at videolan.org
Thu Feb 13 09:31:43 CET 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Feb 12 15:17:48 2020 +0100| [9e19c1acaf1d089cf4e11f096ab4f70a58e2dfb6] | committer: Steve Lhomme

direct3d11: remove the local d3d11_handle_t instances

As long as the decoder device/d3d11_decoder_device_t is alive we hold the DLLs.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9e19c1acaf1d089cf4e11f096ab4f70a58e2dfb6
---

 modules/codec/avcodec/d3d11va.c         |  7 -------
 modules/hw/d3d11/d3d11_deinterlace.c    |  9 ---------
 modules/video_output/win32/direct3d11.c | 17 +----------------
 3 files changed, 1 insertion(+), 32 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 320864d0a8..9dc2e4bea3 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -96,7 +96,6 @@ DEFINE_GUID(DXVA2_NoEncrypt,                        0x1b81bed0, 0xa0c7, 0x11d3,
 
 struct vlc_va_sys_t
 {
-    d3d11_handle_t               hd3d;
     d3d11_device_t               *d3d_dev;
 
     vlc_video_context            *vctx;
@@ -264,10 +263,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat hwfmt, const
     if (unlikely(sys == NULL))
         return VLC_ENOMEM;
 
-    err = D3D11_Create( va, &sys->hd3d );
-    if (err != VLC_SUCCESS)
-        goto error;
-
     va->sys = sys;
 
     sys->render_fmt = NULL;
@@ -693,7 +688,5 @@ static void DxDestroySurfaces(void *opaque)
     if (sys->hw.video_context)
         ID3D11VideoContext_Release(sys->hw.video_context);
 
-    D3D11_Destroy( &sys->hd3d );
-
     free(sys);
 }
diff --git a/modules/hw/d3d11/d3d11_deinterlace.c b/modules/hw/d3d11/d3d11_deinterlace.c
index 48031bf464..3ad3224daa 100644
--- a/modules/hw/d3d11/d3d11_deinterlace.c
+++ b/modules/hw/d3d11/d3d11_deinterlace.c
@@ -41,7 +41,6 @@
 
 typedef struct
 {
-    d3d11_handle_t                 hd3d;
     d3d11_device_t                 *d3d_dev;
     d3d11_processor_t              d3d_proc;
 
@@ -256,12 +255,6 @@ int D3D11OpenDeinterlace(vlc_object_t *obj)
         return VLC_ENOMEM;
     memset(sys, 0, sizeof (*sys));
 
-    if ( unlikely(D3D11_Create(filter, &sys->hd3d) != VLC_SUCCESS ))
-    {
-       msg_Err(filter, "Could not access the d3d11.");
-       goto error;
-    }
-
     d3d11_decoder_device_t *dev_sys = GetD3D11OpaqueContext( filter->vctx_in );
     sys->d3d_dev = &dev_sys->d3d_dev;
     if (D3D11_CreateProcessor(filter, sys->d3d_dev, D3D11_VIDEO_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST,
@@ -403,7 +396,6 @@ error:
     if (sys->outTexture)
         ID3D11Texture2D_Release(sys->outTexture);
     D3D11_ReleaseProcessor(&sys->d3d_proc);
-    D3D11_Destroy(&sys->hd3d);
     free(sys);
 
     return VLC_EGENERIC;
@@ -419,7 +411,6 @@ void D3D11CloseDeinterlace(vlc_object_t *obj)
     ID3D11Texture2D_Release(sys->outTexture);
     D3D11_ReleaseProcessor( &sys->d3d_proc );
     vlc_video_context_Release(filter->vctx_out);
-    D3D11_Destroy(&sys->hd3d);
 
     free(sys);
 }
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 18e353813c..d6558e21e3 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -95,7 +95,6 @@ struct vout_display_sys_t
 
     display_info_t           display;
 
-    d3d11_handle_t           hd3d;
     d3d11_device_t           *d3d_dev;
     d3d11_decoder_device_t   *local_d3d_dev; // when opened without a video context
     d3d11_shaders_t          shaders;
@@ -131,8 +130,6 @@ struct vout_display_sys_t
 static void Prepare(vout_display_t *, picture_t *, subpicture_t *subpicture, vlc_tick_t);
 static void Display(vout_display_t *, picture_t *);
 
-static void Direct3D11Destroy(vout_display_t *);
-
 static int  Direct3D11Open (vout_display_t *, video_format_t *, vlc_video_context *);
 static void Direct3D11Close(vout_display_t *);
 
@@ -295,11 +292,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     if (!sys)
         return VLC_ENOMEM;
 
-    int ret = D3D11_Create(vd, &sys->hd3d);
-    if (ret != VLC_SUCCESS)
-        return ret;
-
-    ret = D3D11_InitShaders(VLC_OBJECT(vd), &sys->shaders);
+    int ret = D3D11_InitShaders(VLC_OBJECT(vd), &sys->shaders);
     if (ret != VLC_SUCCESS)
         goto error;
 
@@ -389,7 +382,6 @@ static void Close(vout_display_t *vd)
 #if !VLC_WINSTORE_APP
     CommonWindowClean(VLC_OBJECT(vd), &vd->sys->sys);
 #endif
-    Direct3D11Destroy(vd);
 }
 
 static void getZoomMatrix(float zoom, FLOAT matrix[static 16]) {
@@ -718,13 +710,6 @@ static void Display(vout_display_t *vd, picture_t *picture)
     d3d11_device_unlock( sys->d3d_dev );
 }
 
-static void Direct3D11Destroy(vout_display_t *vd)
-{
-#if !VLC_WINSTORE_APP
-    D3D11_Destroy( &vd->sys->hd3d );
-#endif
-}
-
 static const d3d_format_t *GetDirectRenderingFormat(vout_display_t *vd, vlc_fourcc_t i_src_chroma)
 {
     UINT supportFlags = D3D11_FORMAT_SUPPORT_SHADER_LOAD;



More information about the vlc-commits mailing list