[vlc-commits] d3d11: store the whole d3d11_device_t in the d3d11_video_context_t

Steve Lhomme git at videolan.org
Fri Feb 7 15:58:50 CET 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Feb  5 09:53:34 2020 +0100| [5a85a9fdb9d11b9cda789b88750283b6566d7518] | committer: Steve Lhomme

d3d11: store the whole d3d11_device_t in the d3d11_video_context_t

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

 modules/codec/avcodec/d3d11va.c      |  4 ++--
 modules/hw/d3d11/d3d11_deinterlace.c |  4 ++--
 modules/hw/d3d11/d3d11_filters.c     |  6 +++---
 modules/hw/d3d11/d3d11_surface.c     | 22 +++++++++++-----------
 modules/video_chroma/d3d11_fmt.c     |  2 +-
 modules/video_chroma/d3d11_fmt.h     |  2 +-
 6 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 0295bcf71b..2823240487 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -327,8 +327,8 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat hwfmt, const
 
     d3d11_video_context_t *priv = GetD3D11ContextPrivate(sys->vctx);
     priv->format = sys->render_fmt->formatTexture;
-    priv->device = sys->d3d_dev.d3dcontext;
-    ID3D11DeviceContext_AddRef(priv->device);
+    priv->d3d_dev = sys->d3d_dev;
+    ID3D11DeviceContext_AddRef(priv->d3d_dev.d3dcontext);
 
     va->ops = &ops;
     *fmt_out = final_fmt;
diff --git a/modules/hw/d3d11/d3d11_deinterlace.c b/modules/hw/d3d11/d3d11_deinterlace.c
index 621c5e4b5b..f1af9d8fce 100644
--- a/modules/hw/d3d11/d3d11_deinterlace.c
+++ b/modules/hw/d3d11/d3d11_deinterlace.c
@@ -170,7 +170,7 @@ static int RenderPic( filter_t *p_filter, picture_t *p_outpic, picture_t *p_pic,
 
     d3d11_video_context_t *vctx_sys = GetD3D11ContextPrivate(p_filter->vctx_out);
 
-    ID3D11DeviceContext_CopySubresourceRegion(vctx_sys->device,
+    ID3D11DeviceContext_CopySubresourceRegion(vctx_sys->d3d_dev.d3dcontext,
                                               p_out_sys->resource[KNOWN_DXGI_INDEX],
                                               p_out_sys->slice_index,
                                               0, 0, 0,
@@ -264,7 +264,7 @@ int D3D11OpenDeinterlace(vlc_object_t *obj)
        goto error;
     }
 
-    hr = D3D11_CreateDeviceExternal( filter, vtcx_sys->device, true, &sys->d3d_dev );
+    hr = D3D11_CreateDeviceExternal( filter, vtcx_sys->d3d_dev.d3dcontext, true, &sys->d3d_dev );
     if (FAILED(hr))
     {
         msg_Dbg(filter, "Failed to use the given video context");
diff --git a/modules/hw/d3d11/d3d11_filters.c b/modules/hw/d3d11/d3d11_filters.c
index 7f10ff988d..a109f7aa5f 100644
--- a/modules/hw/d3d11/d3d11_filters.c
+++ b/modules/hw/d3d11/d3d11_filters.c
@@ -301,7 +301,7 @@ static picture_t *Filter(filter_t *p_filter, picture_t *p_pic)
 
     if (count == 0)
     {
-        ID3D11DeviceContext_CopySubresourceRegion(vctx_sys->device,
+        ID3D11DeviceContext_CopySubresourceRegion(vctx_sys->d3d_dev.d3dcontext,
                                                   p_out_sys->resource[KNOWN_DXGI_INDEX],
                                                   p_out_sys->slice_index,
                                                   0, 0, 0,
@@ -311,7 +311,7 @@ static picture_t *Filter(filter_t *p_filter, picture_t *p_pic)
     }
     else
     {
-        ID3D11DeviceContext_CopySubresourceRegion(vctx_sys->device,
+        ID3D11DeviceContext_CopySubresourceRegion(vctx_sys->d3d_dev.d3dcontext,
                                                   p_out_sys->resource[KNOWN_DXGI_INDEX],
                                                   p_out_sys->slice_index,
                                                   0, 0, 0,
@@ -363,7 +363,7 @@ static int D3D11OpenAdjust(vlc_object_t *obj)
     memset(sys, 0, sizeof (*sys));
 
     d3d11_video_context_t *vtcx_sys = GetD3D11ContextPrivate( filter->vctx_in );
-    hr = D3D11_CreateDeviceExternal( filter, vtcx_sys->device, true, &sys->d3d_dev );
+    hr = D3D11_CreateDeviceExternal( filter, vtcx_sys->d3d_dev.d3dcontext, true, &sys->d3d_dev );
     if (FAILED(hr))
     {
         msg_Dbg(filter, "Failed to use the given video context");
diff --git a/modules/hw/d3d11/d3d11_surface.c b/modules/hw/d3d11/d3d11_surface.c
index 2e876e325b..102bd02d73 100644
--- a/modules/hw/d3d11/d3d11_surface.c
+++ b/modules/hw/d3d11/d3d11_surface.c
@@ -267,13 +267,13 @@ static void D3D11_YUY2(filter_t *p_filter, picture_t *src, picture_t *dst)
     }
 #endif
     d3d11_video_context_t *vctx_sys = GetD3D11ContextPrivate(picture_GetVideoContext(src));
-    ID3D11DeviceContext_CopySubresourceRegion(vctx_sys->device, sys->staging_resource,
+    ID3D11DeviceContext_CopySubresourceRegion(vctx_sys->d3d_dev.d3dcontext, sys->staging_resource,
                                               0, 0, 0, 0,
                                               srcResource,
                                               srcSlice,
                                               NULL);
 
-    HRESULT hr = ID3D11DeviceContext_Map(vctx_sys->device, sys->staging_resource,
+    HRESULT hr = ID3D11DeviceContext_Map(vctx_sys->d3d_dev.d3dcontext, sys->staging_resource,
                                          0, D3D11_MAP_READ, 0, &lock);
     if (FAILED(hr)) {
         msg_Err(p_filter, "Failed to map source surface. (hr=0x%lX)", hr);
@@ -332,7 +332,7 @@ static void D3D11_YUY2(filter_t *p_filter, picture_t *src, picture_t *dst)
         picture_SwapUV( dst );
 
     /* */
-    ID3D11DeviceContext_Unmap(vctx_sys->device, sys->staging_resource, 0);
+    ID3D11DeviceContext_Unmap(vctx_sys->d3d_dev.d3dcontext, sys->staging_resource, 0);
     vlc_mutex_unlock(&sys->staging_lock);
 }
 
@@ -382,13 +382,13 @@ static void D3D11_NV12(filter_t *p_filter, picture_t *src, picture_t *dst)
     }
 #endif
     d3d11_video_context_t *vctx_sys = GetD3D11ContextPrivate(picture_GetVideoContext(src));
-    ID3D11DeviceContext_CopySubresourceRegion(vctx_sys->device, sys->staging_resource,
+    ID3D11DeviceContext_CopySubresourceRegion(vctx_sys->d3d_dev.d3dcontext, sys->staging_resource,
                                               0, 0, 0, 0,
                                               srcResource,
                                               srcSlice,
                                               NULL);
 
-    HRESULT hr = ID3D11DeviceContext_Map(vctx_sys->device, sys->staging_resource,
+    HRESULT hr = ID3D11DeviceContext_Map(vctx_sys->d3d_dev.d3dcontext, sys->staging_resource,
                                          0, D3D11_MAP_READ, 0, &lock);
     if (FAILED(hr)) {
         msg_Err(p_filter, "Failed to map source surface. (hr=0x%lX)", hr);
@@ -415,7 +415,7 @@ static void D3D11_NV12(filter_t *p_filter, picture_t *src, picture_t *dst)
     }
 
     /* */
-    ID3D11DeviceContext_Unmap(vctx_sys->device, sys->staging_resource, 0);
+    ID3D11DeviceContext_Unmap(vctx_sys->d3d_dev.d3dcontext, sys->staging_resource, 0);
     vlc_mutex_unlock(&sys->staging_lock);
 }
 
@@ -430,13 +430,13 @@ static void D3D11_RGBA(filter_t *p_filter, picture_t *src, picture_t *dst)
 
     vlc_mutex_lock(&sys->staging_lock);
     d3d11_video_context_t *vctx_sys = GetD3D11ContextPrivate(picture_GetVideoContext(src));
-    ID3D11DeviceContext_CopySubresourceRegion(vctx_sys->device, sys->staging_resource,
+    ID3D11DeviceContext_CopySubresourceRegion(vctx_sys->d3d_dev.d3dcontext, sys->staging_resource,
                                               0, 0, 0, 0,
                                               p_sys->resource[KNOWN_DXGI_INDEX],
                                               p_sys->slice_index,
                                               NULL);
 
-    HRESULT hr = ID3D11DeviceContext_Map(vctx_sys->device, sys->staging_resource,
+    HRESULT hr = ID3D11DeviceContext_Map(vctx_sys->d3d_dev.d3dcontext, sys->staging_resource,
                                          0, D3D11_MAP_READ, 0, &lock);
     if (FAILED(hr)) {
         msg_Err(p_filter, "Failed to map source surface. (hr=0x%lX)", hr);
@@ -453,7 +453,7 @@ static void D3D11_RGBA(filter_t *p_filter, picture_t *src, picture_t *dst)
     plane_CopyPixels( dst->p, &src_planes );
 
     /* */
-    ID3D11DeviceContext_Unmap(vctx_sys->device,
+    ID3D11DeviceContext_Unmap(vctx_sys->d3d_dev.d3dcontext,
                               p_sys->resource[KNOWN_DXGI_INDEX], p_sys->slice_index);
     vlc_mutex_unlock(&sys->staging_lock);
 }
@@ -716,7 +716,7 @@ int D3D11OpenConverter( vlc_object_t *obj )
         return VLC_ENOMEM;
 
     d3d11_video_context_t *vctx_sys = GetD3D11ContextPrivate(p_filter->vctx_in);
-    D3D11_CreateDeviceExternal(obj, vctx_sys->device, false, &p_sys->d3d_dev);
+    D3D11_CreateDeviceExternal(obj, vctx_sys->d3d_dev.d3dcontext, false, &p_sys->d3d_dev);
 
     if (assert_staging(p_filter, p_sys, vctx_sys->format) != VLC_SUCCESS)
     {
@@ -810,7 +810,7 @@ int D3D11OpenCPUConverter( vlc_object_t *obj )
     default:
         vlc_assert_unreachable();
     }
-    vctx_sys->device = p_sys->d3d_dev.d3dcontext;
+    vctx_sys->d3d_dev.d3dcontext = p_sys->d3d_dev.d3dcontext;
     p_filter->p_sys = p_sys;
 
     vlc_fourcc_t d3d_fourcc = DxgiFormatFourcc(vctx_sys->format);
diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index 805382977b..ee9312b3a5 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -775,7 +775,7 @@ void D3D11_Destroy(d3d11_handle_t *hd3d)
 static void ReleaseD3D11ContextPrivate(void *private)
 {
     d3d11_video_context_t *octx = private;
-    ID3D11DeviceContext_Release(octx->device);
+    ID3D11DeviceContext_Release(octx->d3d_dev.d3dcontext);
 }
 
 const struct vlc_video_context_operations d3d11_vctx_ops = {
diff --git a/modules/video_chroma/d3d11_fmt.h b/modules/video_chroma/d3d11_fmt.h
index 287bc4eb3a..0c6bb518b7 100644
--- a/modules/video_chroma/d3d11_fmt.h
+++ b/modules/video_chroma/d3d11_fmt.h
@@ -93,7 +93,7 @@ typedef struct
 
 typedef struct
 {
-    ID3D11DeviceContext *device;
+    d3d11_device_t      d3d_dev;
     DXGI_FORMAT         format;
 } d3d11_video_context_t;
 



More information about the vlc-commits mailing list