[vlc-devel] [PATCH 09/10] vdpau/chroma: pass a vdpau_decoder_device_t internally

Steve Lhomme robux4 at ycbcr.xyz
Fri Nov 22 14:12:37 CET 2019


---
 modules/hw/vdpau/chroma.c                     | 22 +++++++++++--------
 modules/hw/vdpau/picture.c                    |  5 +++--
 modules/hw/vdpau/vlc_vdpau.h                  |  3 ++-
 modules/video_output/opengl/converter_vdpau.c |  2 +-
 4 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/modules/hw/vdpau/chroma.c b/modules/hw/vdpau/chroma.c
index e2791eced4d..db3edddeec2 100644
--- a/modules/hw/vdpau/chroma.c
+++ b/modules/hw/vdpau/chroma.c
@@ -710,7 +710,7 @@ static picture_t *YCbCrRender(filter_t *filter, picture_t *src)
     return (src != NULL) ? Render(filter, src, true) : NULL;
 }
 
-static int OutputCheckFormat(vlc_object_t *obj, vdp_t *vdp, VdpDevice dev,
+static int OutputCheckFormat(vlc_object_t *obj, vdpau_decoder_device_t *vdpau_dev,
                              const video_format_t *fmt,
                              VdpRGBAFormat *restrict rgb_fmt)
 {
@@ -724,12 +724,13 @@ static int OutputCheckFormat(vlc_object_t *obj, vdp_t *vdp, VdpDevice dev,
         uint32_t w, h;
         VdpBool ok;
 
-        VdpStatus err = vdp_output_surface_query_capabilities(vdp, dev,
+        VdpStatus err = vdp_output_surface_query_capabilities(vdpau_dev->vdp,
+                                                              vdpau_dev->device,
                                                      rgb_fmts[i], &ok, &w, &h);
         if (err != VDP_STATUS_OK)
         {
             msg_Err(obj, "%s capabilities query failure: %s", "output surface",
-                    vdp_get_error_string(vdp, err));
+                    vdp_get_error_string(vdpau_dev->vdp, err));
             continue;
         }
 
@@ -745,17 +746,17 @@ static int OutputCheckFormat(vlc_object_t *obj, vdp_t *vdp, VdpDevice dev,
     return VLC_EGENERIC;
 }
 
-static picture_pool_t *OutputPoolAlloc(vlc_object_t *obj, vdp_t *vdp,
-    VdpDevice dev, const video_format_t *restrict fmt)
+static picture_pool_t *OutputPoolAlloc(vlc_object_t *obj,
+    vdpau_decoder_device_t *vdpau_dev, const video_format_t *restrict fmt)
 {
     /* Check output surface format */
     VdpRGBAFormat rgb_fmt;
 
-    if (OutputCheckFormat(obj, vdp, dev, fmt, &rgb_fmt))
+    if (OutputCheckFormat(obj, vdpau_dev, fmt, &rgb_fmt))
         return NULL;
 
     /* Allocate the pool */
-    return vlc_vdp_output_pool_create(vdp, rgb_fmt, fmt, 3);
+    return vlc_vdp_output_pool_create(vdpau_dev, rgb_fmt, fmt, 3);
 }
 
 static int OutputOpen(vlc_object_t *obj)
@@ -806,8 +807,11 @@ static int OutputOpen(vlc_object_t *obj)
         return VLC_EGENERIC;
 
     /* Allocate the output surface picture pool */
-    sys->pool = OutputPoolAlloc(obj, sys->vdp, sys->device,
-                                &filter->fmt_out.video);
+    vdpau_decoder_device_t vdpau_dev = {
+        .vdp = sys->vdp,
+        .device = sys->device,
+    };
+    sys->pool = OutputPoolAlloc(obj, &vdpau_dev, &filter->fmt_out.video);
     if (sys->pool == NULL)
     {
         vdp_release_x11(sys->vdp);
diff --git a/modules/hw/vdpau/picture.c b/modules/hw/vdpau/picture.c
index 8e6b545106c..d834d0303ad 100644
--- a/modules/hw/vdpau/picture.c
+++ b/modules/hw/vdpau/picture.c
@@ -167,7 +167,8 @@ error:
     return pic;
 }
 
-picture_pool_t *vlc_vdp_output_pool_create(vdp_t *vdp, VdpRGBAFormat rgb_fmt,
+picture_pool_t *vlc_vdp_output_pool_create(vdpau_decoder_device_t *vdpau_dev,
+                                           VdpRGBAFormat rgb_fmt,
                                            const video_format_t *restrict fmt,
                                            unsigned requested_count)
 {
@@ -176,7 +177,7 @@ picture_pool_t *vlc_vdp_output_pool_create(vdp_t *vdp, VdpRGBAFormat rgb_fmt,
 
     while (count < requested_count)
     {
-        pics[count] = vlc_vdp_output_surface_create(vdp, rgb_fmt, fmt);
+        pics[count] = vlc_vdp_output_surface_create(vdpau_dev->vdp, rgb_fmt, fmt);
         if (pics[count] == NULL)
             break;
         count++;
diff --git a/modules/hw/vdpau/vlc_vdpau.h b/modules/hw/vdpau/vlc_vdpau.h
index 07253537462..682a9ec138e 100644
--- a/modules/hw/vdpau/vlc_vdpau.h
+++ b/modules/hw/vdpau/vlc_vdpau.h
@@ -340,7 +340,8 @@ typedef struct vlc_vdp_output_surface
 
 struct picture_pool_t;
 
-struct picture_pool_t *vlc_vdp_output_pool_create(vdp_t *, VdpRGBAFormat,
+struct picture_pool_t *vlc_vdp_output_pool_create(vdpau_decoder_device_t *,
+                                                  VdpRGBAFormat,
                                                   const video_format_t *,
                                                   unsigned count);
 
diff --git a/modules/video_output/opengl/converter_vdpau.c b/modules/video_output/opengl/converter_vdpau.c
index 951b505cc65..8c6d1c0b41a 100644
--- a/modules/video_output/opengl/converter_vdpau.c
+++ b/modules/video_output/opengl/converter_vdpau.c
@@ -69,7 +69,7 @@ tc_vdpau_gl_get_pool(opengl_tex_converter_t const *tc,
 {
     converter_sys_t *sys = tc->priv;
     vlc_decoder_device *dec_device = sys->dec_device;
-    return vlc_vdp_output_pool_create(GetVDPAUOpaqueDevice(dec_device)->vdp,
+    return vlc_vdp_output_pool_create(GetVDPAUOpaqueDevice(dec_device),
                                       VDP_RGBA_FORMAT_B8G8R8A8,
                                       &tc->fmt, requested_count);
 }
-- 
2.17.1



More information about the vlc-devel mailing list