[vlc-devel] [RFC PATCH 1/8] WIP: vlc_va: hack

Thomas Guillem thomas at gllm.fr
Fri Feb 10 11:35:55 CET 2017


Temporary hack since vaCreateContext need a pointer to all va surfaces.
---
 modules/hw/va/vlc_va.c | 10 +++++++---
 modules/hw/va/vlc_va.h |  6 ++++++
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/modules/hw/va/vlc_va.c b/modules/hw/va/vlc_va.c
index d634024a04..4aa3067226 100644
--- a/modules/hw/va/vlc_va.c
+++ b/modules/hw/va/vlc_va.c
@@ -192,7 +192,8 @@ static void PictureDestroyVAAPI(picture_t *pic)
 
 static int PictureNew(VADisplay va_dpy,
                       const video_format_t *fmt,
-                      picture_t **picp, VASurfaceID id)
+                      picture_t **picp, VASurfaceID id, VASurfaceID *ids,
+                      int ids_count)
 {
     picture_sys_t *sys = malloc(sizeof (*sys));
     if (unlikely(sys == NULL))
@@ -200,6 +201,8 @@ static int PictureNew(VADisplay va_dpy,
 
     sys->va_dpy        = va_dpy;
     sys->va_surface_id = id;
+    sys->render_targets = ids;
+    sys->num_render_targets = ids_count;
 
     picture_resource_t res = {
         .p_sys = sys,
@@ -220,7 +223,7 @@ picture_pool_t *vlc_va_PoolAlloc(vlc_object_t *o, VADisplay va_dpy, unsigned req
                                  const video_format_t *restrict fmt, unsigned int va_rt_format)
 {
     picture_t   *pics[requested_count];
-    VASurfaceID  va_surface_ids[requested_count];
+    static VASurfaceID  va_surface_ids[64];
     VAStatus     status;
     unsigned     count;
 
@@ -240,7 +243,8 @@ picture_pool_t *vlc_va_PoolAlloc(vlc_object_t *o, VADisplay va_dpy, unsigned req
 #endif
 
     for (count = 0; count < requested_count; count++) {
-        int err = PictureNew(va_dpy, fmt, pics + count, va_surface_ids[count]);
+        int err = PictureNew(va_dpy, fmt, pics + count, va_surface_ids[count],
+                             va_surface_ids, requested_count);
         if (err != VLC_SUCCESS) {
             break;
         }
diff --git a/modules/hw/va/vlc_va.h b/modules/hw/va/vlc_va.h
index 5088dfc122..431b5a70d0 100644
--- a/modules/hw/va/vlc_va.h
+++ b/modules/hw/va/vlc_va.h
@@ -93,6 +93,10 @@ int vlc_va_VaFourcc(vlc_fourcc_t fourcc,
             *va_fourcc    = VA_FOURCC_444P;
             *va_rt_format = VA_RT_FORMAT_YUV444;
             break;
+        case VLC_CODEC_VAAPI_OPAQUE:
+            *va_fourcc    = VA_FOURCC_YV12;
+            *va_rt_format = VA_RT_FORMAT_YUV420;
+            break;
         default:
             return VA_STATUS_ERROR_UNIMPLEMENTED;
     }
@@ -106,6 +110,8 @@ int vlc_va_VaFourcc(vlc_fourcc_t fourcc,
 struct picture_sys_t {
     VADisplay     va_dpy;
     VASurfaceID   va_surface_id;
+    void *render_targets;
+    int num_render_targets;
 };
 
 picture_pool_t *vlc_va_PoolAlloc(vlc_object_t *o, VADisplay va_dpy, unsigned requested_count,
-- 
2.11.0



More information about the vlc-devel mailing list