[vlc-commits] d3d11: set the video context in the picture context

Steve Lhomme git at videolan.org
Mon Dec 2 13:42:48 CET 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Nov 13 16:31:59 2019 +0100| [1566b3655fb129e24af6834f41c8833cf9fedbc6] | committer: Steve Lhomme

d3d11: set the video context in the picture context

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

 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 7f2c8e88ad..974033600f 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 5c58632e59..606b4a3fdf 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 81fd0f2fdf..8f132b45fc 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 77156f509b..59da5383f2 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;
 }



More information about the vlc-commits mailing list