[vlc-commits] d3d9: clean accesses to the picture_sys_d3d9_t

Steve Lhomme git at videolan.org
Fri Dec 13 10:13:00 CET 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Dec 11 11:31:58 2019 +0100| [30f1b6534689805ebbf18558db321eb2a913cf9b] | committer: Steve Lhomme

d3d9: clean accesses to the picture_sys_d3d9_t

We should not have to store the "p_sys" of the picture, it's always part of the
video context.

Don't use picture_NewFromResource() since we don't provide pixel resources.

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

 modules/hw/d3d9/d3d9_filters.c      | 5 ++---
 modules/hw/d3d9/dxa9.c              | 9 +++------
 modules/hw/d3d9/dxva2_deinterlace.c | 5 ++---
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/modules/hw/d3d9/d3d9_filters.c b/modules/hw/d3d9/d3d9_filters.c
index a9ea9b40e0..9db93e0e44 100644
--- a/modules/hw/d3d9/d3d9_filters.c
+++ b/modules/hw/d3d9/d3d9_filters.c
@@ -104,8 +104,7 @@ static picture_t *AllocPicture( filter_t *p_filter )
     if (unlikely(pic_ctx == NULL))
         return NULL;
 
-    picture_resource_t res = {};
-    picture_t *pic = picture_NewFromResource( &p_filter->fmt_out.video, &res );
+    picture_t *pic = picture_NewFromFormat( &p_filter->fmt_out.video );
     if (unlikely(pic == NULL))
     {
         free(pic_ctx);
@@ -149,7 +148,7 @@ static picture_t *Filter(filter_t *p_filter, picture_t *p_pic)
     if( !p_outpic )
         goto failed;
 
-    picture_sys_d3d9_t *p_out_sys = p_outpic->p_sys;
+    picture_sys_d3d9_t *p_out_sys = ActiveD3D9PictureSys(p_outpic);
     if( !p_out_sys || !p_out_sys->surface )
         goto failed;
 
diff --git a/modules/hw/d3d9/dxa9.c b/modules/hw/d3d9/dxa9.c
index af02141c7c..40c4909409 100644
--- a/modules/hw/d3d9/dxa9.c
+++ b/modules/hw/d3d9/dxa9.c
@@ -344,20 +344,17 @@ static picture_t *AllocateCPUtoGPUTexture(filter_t *p_filter)
         vlc_video_context_Hold(p_filter->vctx_out),
     };
 
-    picture_resource_t res = {};
-    picture_sys_d3d9_t *res_sys = &pic_ctx->picsys;
-    res.p_sys = res_sys;
-    res_sys->surface = texture;
-
     video_format_Copy(&fmt_staging, &p_filter->fmt_out.video);
     fmt_staging.i_chroma = format;
 
-    picture_t *p_dst = picture_NewFromResource(&fmt_staging, &res);
+    picture_t *p_dst = picture_NewFromFormat(&fmt_staging);
     if (p_dst == NULL) {
         msg_Err(p_filter, "Failed to map create the temporary picture.");
         goto done;
     }
     picture_Setup(p_dst, &p_dst->format);
+    pic_ctx->picsys.surface = texture;
+    p_dst->p_sys = &pic_ctx->picsys;
     p_dst->context = &pic_ctx->s;
     return p_dst;
 
diff --git a/modules/hw/d3d9/dxva2_deinterlace.c b/modules/hw/d3d9/dxva2_deinterlace.c
index e8a3f48ba4..3a506933be 100644
--- a/modules/hw/d3d9/dxva2_deinterlace.c
+++ b/modules/hw/d3d9/dxva2_deinterlace.c
@@ -183,7 +183,7 @@ static int RenderPic( filter_t *filter, picture_t *p_outpic, picture_t *src,
                       int order, int i_field )
 {
     filter_sys_t *sys = filter->p_sys;
-    picture_sys_d3d9_t *p_out_sys = p_outpic->p_sys;
+    picture_sys_d3d9_t *p_out_sys = ActiveD3D9PictureSys(p_outpic);
     const int i_samples = sys->decoder_caps.NumBackwardRefSamples + 1 +
                           sys->decoder_caps.NumForwardRefSamples;
     HRESULT hr;
@@ -288,8 +288,7 @@ picture_t *AllocPicture( filter_t *p_filter )
     if (unlikely(pic_ctx == NULL))
         return NULL;
 
-    picture_resource_t res = {};
-    picture_t *pic = picture_NewFromResource( &p_filter->fmt_out.video, &res );
+    picture_t *pic = picture_NewFromFormat( &p_filter->fmt_out.video );
     if (unlikely(pic == NULL))
     {
         free(pic_ctx);



More information about the vlc-commits mailing list