[vlc-devel] [PATCH 15/36] d3d11: set the video context in the picture context

Steve Lhomme robux4 at ycbcr.xyz
Thu Nov 21 15:14:06 CET 2019


---
 modules/codec/avcodec/d3d11va.c      | 8 +++++---
 modules/hw/d3d11/d3d11_deinterlace.c | 2 +-
 modules/hw/d3d11/d3d11_surface.c     | 2 +-
 modules/video_chroma/d3d11_fmt.c     | 1 +
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 7f2c8e88ade..974033600f8 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -156,6 +156,7 @@ static picture_context_t *d3d11va_pic_context_copy(picture_context_t *ctx)
     if (unlikely(pic_ctx==NULL))
         return NULL;
     *pic_ctx = *src_ctx;
+    vlc_video_context_Hold(pic_ctx->ctx.s.vctx);
     va_surface_AddRef(pic_ctx->va_surface);
     for (int i=0;i<D3D11_MAX_SHADER_VIEW; i++)
     {
@@ -170,14 +171,15 @@ static struct d3d11va_pic_context *CreatePicContext(
                                                   ID3D11Resource *p_resource,
                                                   ID3D11DeviceContext *context,
                                                   UINT slice,
-                                                  ID3D11ShaderResourceView *renderSrc[D3D11_MAX_SHADER_VIEW])
+                                                  ID3D11ShaderResourceView *renderSrc[D3D11_MAX_SHADER_VIEW],
+                                                  vlc_video_context *vctx)
 {
     struct d3d11va_pic_context *pic_ctx = calloc(1, sizeof(*pic_ctx));
     if (unlikely(pic_ctx==NULL))
         return NULL;
     pic_ctx->ctx.s = (picture_context_t) {
         d3d11va_pic_context_destroy, d3d11va_pic_context_copy,
-        NULL /*TODO*/
+        vlc_video_context_Hold(vctx),
     };
 
     D3D11_TEXTURE2D_DESC txDesc;
@@ -213,7 +215,7 @@ static picture_context_t* NewSurfacePicContext(vlc_va_t *va, vlc_va_surface_t *v
                                                   p_resource,
                                                   sys->d3d_dev.d3dcontext,
                                                   viewDesc.Texture2D.ArraySlice,
-                                                  resourceView);
+                                                  resourceView, sys->vctx);
     ID3D11Resource_Release(p_resource);
     if (unlikely(pic_ctx==NULL))
         return NULL;
diff --git a/modules/hw/d3d11/d3d11_deinterlace.c b/modules/hw/d3d11/d3d11_deinterlace.c
index 5c58632e59e..606b4a3fdfc 100644
--- a/modules/hw/d3d11/d3d11_deinterlace.c
+++ b/modules/hw/d3d11/d3d11_deinterlace.c
@@ -266,7 +266,7 @@ picture_t *AllocPicture( filter_t *p_filter )
         {
             pic_ctx->s = (picture_context_t) {
                 d3d11_pic_context_destroy, d3d11_pic_context_copy,
-                NULL /*TODO*/
+                vlc_video_context_Hold(p_filter->vctx_in),
             };
             pic_ctx->picsys = *pic_sys;
             AcquireD3D11PictureSys( &pic_ctx->picsys );
diff --git a/modules/hw/d3d11/d3d11_surface.c b/modules/hw/d3d11/d3d11_surface.c
index da33473ef91..b7c485a7749 100644
--- a/modules/hw/d3d11/d3d11_surface.c
+++ b/modules/hw/d3d11/d3d11_surface.c
@@ -585,7 +585,7 @@ static void NV12_D3D11(filter_t *p_filter, picture_t *src, picture_t *dst)
         {
             pic_ctx->s = (picture_context_t) {
                 d3d11_pic_context_destroy, d3d11_pic_context_copy,
-                NULL /*TODO*/
+                vlc_video_context_Hold(p_filter->vctx_out),
             };
             pic_ctx->picsys = *p_sys;
             AcquireD3D11PictureSys(&pic_ctx->picsys);
diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index 77156f509bb..59da5383f23 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -787,6 +787,7 @@ picture_context_t *d3d11_pic_context_copy(picture_context_t *ctx)
     if (unlikely(pic_ctx==NULL))
         return NULL;
     *pic_ctx = *D3D11_PICCONTEXT_FROM_PICCTX(ctx);
+    vlc_video_context_Hold(pic_ctx->s.vctx);
     AcquireD3D11PictureSys(&pic_ctx->picsys);
     return &pic_ctx->s;
 }
-- 
2.17.1



More information about the vlc-devel mailing list