Hi,

In order to avoid future breakage to drivers built against a specific version of libva, I suggest we make the vtable a pointer. That structure will be maintained (allocated/deallocated) by libva. Besides, this structure can only grow in order to provide backwards compatibility.

e.g. the vaQuerySurfaceError() hook should have been placed at the end of the VTable. Anyway, now that we bumped the VA-API version and new libva versions will check for __vaDriverInit_0_32, we don't have to move it.

With simple changes similar to patches 302 & 303, the drivers I maintain (vdpau-driver, xvba-driver) can expose both __vaDriverInit_0_31 and __vaDriverInit_0_32, thus making it possible to remain compatible with any libva version around.

Thanks,
Gwenole.
From 21117425da2e77b62df96f2eb3d9876a5cff238c Mon Sep 17 00:00:00 2001
From: Gwenole Beauchesne <[email protected]>
Date: Thu, 27 Jan 2011 10:36:37 +0100
Subject: [PATCH] Make VADriverContext.vtable a pointer.

---
 va/glx/va_glx_impl.c |    8 ++--
 va/va.c              |  103 ++++++++++++++++++++++++++++----------------------
 va/va_backend.h      |   21 ++++++++--
 va/x11/va_x11.c      |    2 +-
 4 files changed, 80 insertions(+), 54 deletions(-)

diff --git a/va/glx/va_glx_impl.c b/va/glx/va_glx_impl.c
index 9d38930..884f9a9 100644
--- a/va/glx/va_glx_impl.c
+++ b/va/glx/va_glx_impl.c
@@ -803,7 +803,7 @@ end:
 /* ========================================================================= */
 
 #define INVOKE(ctx, func, args) do {                    \
-        VADriverVTableGLXP vtable = (ctx)->vtable.glx;  \
+        VADriverVTableGLXP vtable = (ctx)->vtable_glx;  \
         if (!vtable->va##func##GLX)                     \
             return VA_STATUS_ERROR_UNIMPLEMENTED;       \
                                                         \
@@ -937,7 +937,7 @@ associate_surface(
         return status;
 
     x11_trap_errors();
-    status = ctx->vtable.vaPutSurface(
+    status = ctx->vtable->vaPutSurface(
         ctx,
         surface,
         (void *)pSurfaceGLX->pixmap,
@@ -962,7 +962,7 @@ sync_surface(VADriverContextP ctx, VASurfaceGLXP pSurfaceGLX)
     if (pSurfaceGLX->surface == VA_INVALID_SURFACE)
         return VA_STATUS_ERROR_INVALID_SURFACE;
 
-    return ctx->vtable.vaSyncSurface(ctx, pSurfaceGLX->surface);
+    return ctx->vtable->vaSyncSurface(ctx, pSurfaceGLX->surface);
 }
 
 static inline VAStatus
@@ -1058,7 +1058,7 @@ VAStatus va_glx_init_context(VADriverContextP ctx)
     if (glx_ctx->is_initialized)
         return VA_STATUS_SUCCESS;
 
-    if (ctx->vtable.glx && ctx->vtable.glx->vaCopySurfaceGLX) {
+    if (ctx->vtable_glx && ctx->vtable_glx->vaCopySurfaceGLX) {
         vtable->vaCreateSurfaceGLX      = vaCreateSurfaceGLX_impl_driver;
         vtable->vaDestroySurfaceGLX     = vaDestroySurfaceGLX_impl_driver;
         vtable->vaCopySurfaceGLX        = vaCopySurfaceGLX_impl_driver;
diff --git a/va/va.c b/va/va.c
index 3f09c99..2eea02b 100644
--- a/va/va.c
+++ b/va/va.c
@@ -43,7 +43,7 @@
 #define CHECK_DISPLAY(dpy) if( !vaDisplayIsValid(dpy) ) { return VA_STATUS_ERROR_INVALID_DISPLAY; }
 
 #define ASSERT		assert
-#define CHECK_VTABLE(s, ctx, func) if (!va_checkVtable(ctx->vtable.va##func, #func)) s = VA_STATUS_ERROR_UNKNOWN;
+#define CHECK_VTABLE(s, ctx, func) if (!va_checkVtable(ctx->vtable->va##func, #func)) s = VA_STATUS_ERROR_UNKNOWN;
 #define CHECK_MAXIMUM(s, ctx, var) if (!va_checkMaximum(ctx->max_##var, #var)) s = VA_STATUS_ERROR_UNKNOWN;
 #define CHECK_STRING(s, ctx, var) if (!va_checkString(ctx->str_##var, #var)) s = VA_STATUS_ERROR_UNKNOWN;
 
@@ -228,7 +228,18 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name)
             }
             else
             {
-                vaStatus = (*init_func)(ctx);
+                struct VADriverVTable *vtable = ctx->vtable;
+
+                vaStatus = VA_STATUS_SUCCESS;
+                if (!vtable) {
+                    vtable = calloc(1, sizeof(*vtable));
+                    if (!vtable)
+                        vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
+                }
+                ctx->vtable = vtable;
+
+                if (VA_STATUS_SUCCESS == vaStatus)
+                    vaStatus = (*init_func)(ctx);
 
                 if (VA_STATUS_SUCCESS == vaStatus)
                 {
@@ -438,10 +449,12 @@ VAStatus vaTerminate (
   old_ctx = CTX(dpy);
 
   if (old_ctx->handle) {
-      vaStatus = old_ctx->vtable.vaTerminate(old_ctx);
+      vaStatus = old_ctx->vtable->vaTerminate(old_ctx);
       dlclose(old_ctx->handle);
       old_ctx->handle = NULL;
   }
+  free(old_ctx->vtable);
+  old_ctx->vtable = NULL;
 
   if (VA_STATUS_SUCCESS == vaStatus)
       pDisplayContext->vaDestroy(pDisplayContext);
@@ -517,7 +530,7 @@ VAStatus vaQueryConfigEntrypoints (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaQueryConfigEntrypoints ( ctx, profile, entrypoints, num_entrypoints);
+  return ctx->vtable->vaQueryConfigEntrypoints ( ctx, profile, entrypoints, num_entrypoints);
 }
 
 VAStatus vaGetConfigAttributes (
@@ -532,7 +545,7 @@ VAStatus vaGetConfigAttributes (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaGetConfigAttributes ( ctx, profile, entrypoint, attrib_list, num_attribs );
+  return ctx->vtable->vaGetConfigAttributes ( ctx, profile, entrypoint, attrib_list, num_attribs );
 }
 
 VAStatus vaQueryConfigProfiles (
@@ -545,7 +558,7 @@ VAStatus vaQueryConfigProfiles (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaQueryConfigProfiles ( ctx, profile_list, num_profiles );
+  return ctx->vtable->vaQueryConfigProfiles ( ctx, profile_list, num_profiles );
 }
 
 VAStatus vaCreateConfig (
@@ -566,7 +579,7 @@ VAStatus vaCreateConfig (
 
   VA_FOOL(va_FoolCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id);
   
-  vaStatus =  ctx->vtable.vaCreateConfig ( ctx, profile, entrypoint, attrib_list, num_attribs, config_id );
+  vaStatus =  ctx->vtable->vaCreateConfig ( ctx, profile, entrypoint, attrib_list, num_attribs, config_id );
 
   VA_TRACE(va_TraceCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id);
   
@@ -582,7 +595,7 @@ VAStatus vaDestroyConfig (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaDestroyConfig ( ctx, config_id );
+  return ctx->vtable->vaDestroyConfig ( ctx, config_id );
 }
 
 VAStatus vaQueryConfigAttributes (
@@ -598,7 +611,7 @@ VAStatus vaQueryConfigAttributes (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaQueryConfigAttributes( ctx, config_id, profile, entrypoint, attrib_list, num_attribs);
+  return ctx->vtable->vaQueryConfigAttributes( ctx, config_id, profile, entrypoint, attrib_list, num_attribs);
 }
 
 VAStatus vaCreateSurfaces (
@@ -617,7 +630,7 @@ VAStatus vaCreateSurfaces (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  vaStatus = ctx->vtable.vaCreateSurfaces( ctx, width, height, format, num_surfaces, surfaces );
+  vaStatus = ctx->vtable->vaCreateSurfaces( ctx, width, height, format, num_surfaces, surfaces );
 
   VA_TRACE(va_TraceCreateSurface, dpy, width, height, format, num_surfaces, surfaces);
 
@@ -637,7 +650,7 @@ VAStatus vaDestroySurfaces (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaDestroySurfaces( ctx, surface_list, num_surfaces );
+  return ctx->vtable->vaDestroySurfaces( ctx, surface_list, num_surfaces );
 }
 
 VAStatus vaCreateContext (
@@ -657,7 +670,7 @@ VAStatus vaCreateContext (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  vaStatus = ctx->vtable.vaCreateContext( ctx, config_id, picture_width, picture_height,
+  vaStatus = ctx->vtable->vaCreateContext( ctx, config_id, picture_width, picture_height,
                                       flag, render_targets, num_render_targets, context );
 
   VA_TRACE(va_TraceCreateContext, dpy, config_id, picture_width, picture_height, flag, render_targets, num_render_targets, context);
@@ -674,7 +687,7 @@ VAStatus vaDestroyContext (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaDestroyContext( ctx, context );
+  return ctx->vtable->vaDestroyContext( ctx, context );
 }
 
 VAStatus vaCreateBuffer (
@@ -696,7 +709,7 @@ VAStatus vaCreateBuffer (
   if (ret)
       return VA_STATUS_SUCCESS;
   
-  return ctx->vtable.vaCreateBuffer( ctx, context, type, size, num_elements, data, buf_id);
+  return ctx->vtable->vaCreateBuffer( ctx, context, type, size, num_elements, data, buf_id);
 }
 
 VAStatus vaBufferSetNumElements (
@@ -709,7 +722,7 @@ VAStatus vaBufferSetNumElements (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaBufferSetNumElements( ctx, buf_id, num_elements );
+  return ctx->vtable->vaBufferSetNumElements( ctx, buf_id, num_elements );
 }
 
 
@@ -730,7 +743,7 @@ VAStatus vaMapBuffer (
   if (ret)
       return VA_STATUS_SUCCESS;
   
-  va_status = ctx->vtable.vaMapBuffer( ctx, buf_id, pbuf );
+  va_status = ctx->vtable->vaMapBuffer( ctx, buf_id, pbuf );
 
   if (va_status == VA_STATUS_SUCCESS)
       VA_TRACE(va_TraceMapBuffer, dpy, buf_id, pbuf);
@@ -752,7 +765,7 @@ VAStatus vaUnmapBuffer (
   if (ret)
       return VA_STATUS_SUCCESS;
   
-  return ctx->vtable.vaUnmapBuffer( ctx, buf_id );
+  return ctx->vtable->vaUnmapBuffer( ctx, buf_id );
 }
 
 VAStatus vaDestroyBuffer (
@@ -764,7 +777,7 @@ VAStatus vaDestroyBuffer (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaDestroyBuffer( ctx, buffer_id );
+  return ctx->vtable->vaDestroyBuffer( ctx, buffer_id );
 }
 
 VAStatus vaBufferInfo (
@@ -780,7 +793,7 @@ VAStatus vaBufferInfo (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaBufferInfo( ctx, context, buf_id, type, size, num_elements );
+  return ctx->vtable->vaBufferInfo( ctx, context, buf_id, type, size, num_elements );
 }
 
 VAStatus vaBeginPicture (
@@ -801,7 +814,7 @@ VAStatus vaBeginPicture (
   if (ret)
       return VA_STATUS_SUCCESS;
 
-  return ctx->vtable.vaBeginPicture( ctx, context, render_target );
+  return ctx->vtable->vaBeginPicture( ctx, context, render_target );
 }
 
 VAStatus vaRenderPicture (
@@ -823,7 +836,7 @@ VAStatus vaRenderPicture (
 
   VA_TRACE(va_TraceRenderPicture, dpy, context, buffers, num_buffers);
 
-  return ctx->vtable.vaRenderPicture( ctx, context, buffers, num_buffers );
+  return ctx->vtable->vaRenderPicture( ctx, context, buffers, num_buffers );
 }
 
 VAStatus vaEndPicture (
@@ -844,7 +857,7 @@ VAStatus vaEndPicture (
       return VA_STATUS_SUCCESS;
   }
   
-  va_status = ctx->vtable.vaEndPicture( ctx, context );
+  va_status = ctx->vtable->vaEndPicture( ctx, context );
   
   VA_TRACE(va_TraceEndPicture, dpy, context);
 
@@ -867,7 +880,7 @@ VAStatus vaSyncSurface (
   if (ret)
       return VA_STATUS_SUCCESS;
   
-  va_status = ctx->vtable.vaSyncSurface( ctx, render_target );
+  va_status = ctx->vtable->vaSyncSurface( ctx, render_target );
   VA_TRACE(va_TraceSyncSurface, dpy, render_target);
 
   return va_status;
@@ -884,7 +897,7 @@ VAStatus vaQuerySurfaceStatus (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  va_status = ctx->vtable.vaQuerySurfaceStatus( ctx, render_target, status );
+  va_status = ctx->vtable->vaQuerySurfaceStatus( ctx, render_target, status );
 
   VA_TRACE(va_TraceQuerySurfaceStatus, dpy, render_target, status);
 
@@ -903,7 +916,7 @@ VAStatus vaQuerySurfaceError (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  va_status = ctx->vtable.vaQuerySurfaceError( ctx, surface, error_status, error_info );
+  va_status = ctx->vtable->vaQuerySurfaceError( ctx, surface, error_status, error_info );
 
   VA_TRACE(va_TraceQuerySurfaceError, dpy, surface, error_status, error_info);
 
@@ -931,7 +944,7 @@ VAStatus vaQueryImageFormats (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaQueryImageFormats ( ctx, format_list, num_formats);
+  return ctx->vtable->vaQueryImageFormats ( ctx, format_list, num_formats);
 }
 
 /* 
@@ -954,7 +967,7 @@ VAStatus vaCreateImage (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaCreateImage ( ctx, format, width, height, image);
+  return ctx->vtable->vaCreateImage ( ctx, format, width, height, image);
 }
 
 /*
@@ -969,7 +982,7 @@ VAStatus vaDestroyImage (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaDestroyImage ( ctx, image);
+  return ctx->vtable->vaDestroyImage ( ctx, image);
 }
 
 VAStatus vaSetImagePalette (
@@ -982,7 +995,7 @@ VAStatus vaSetImagePalette (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaSetImagePalette ( ctx, image, palette);
+  return ctx->vtable->vaSetImagePalette ( ctx, image, palette);
 }
 
 /*
@@ -1003,7 +1016,7 @@ VAStatus vaGetImage (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaGetImage ( ctx, surface, x, y, width, height, image);
+  return ctx->vtable->vaGetImage ( ctx, surface, x, y, width, height, image);
 }
 
 /*
@@ -1028,7 +1041,7 @@ VAStatus vaPutImage (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaPutImage ( ctx, surface, image, src_x, src_y, src_width, src_height, dest_x, dest_y, dest_width, dest_height );
+  return ctx->vtable->vaPutImage ( ctx, surface, image, src_x, src_y, src_width, src_height, dest_x, dest_y, dest_width, dest_height );
 }
 
 /*
@@ -1072,7 +1085,7 @@ VAStatus vaDeriveImage (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaDeriveImage ( ctx, surface, image );
+  return ctx->vtable->vaDeriveImage ( ctx, surface, image );
 }
 
 
@@ -1111,7 +1124,7 @@ VAStatus vaQuerySubpictureFormats (
   if (ret)
       return VA_STATUS_SUCCESS;
   
-  return ctx->vtable.vaQuerySubpictureFormats ( ctx, format_list, flags, num_formats);
+  return ctx->vtable->vaQuerySubpictureFormats ( ctx, format_list, flags, num_formats);
 }
 
 /* 
@@ -1127,7 +1140,7 @@ VAStatus vaCreateSubpicture (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaCreateSubpicture ( ctx, image, subpicture );
+  return ctx->vtable->vaCreateSubpicture ( ctx, image, subpicture );
 }
 
 /*
@@ -1142,7 +1155,7 @@ VAStatus vaDestroySubpicture (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaDestroySubpicture ( ctx, subpicture);
+  return ctx->vtable->vaDestroySubpicture ( ctx, subpicture);
 }
 
 VAStatus vaSetSubpictureImage (
@@ -1155,7 +1168,7 @@ VAStatus vaSetSubpictureImage (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaSetSubpictureImage ( ctx, subpicture, image);
+  return ctx->vtable->vaSetSubpictureImage ( ctx, subpicture, image);
 }
 
 
@@ -1175,7 +1188,7 @@ VAStatus vaSetSubpictureChromakey (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaSetSubpictureChromakey ( ctx, subpicture, chromakey_min, chromakey_max, chromakey_mask );
+  return ctx->vtable->vaSetSubpictureChromakey ( ctx, subpicture, chromakey_min, chromakey_max, chromakey_mask );
 }
 
 
@@ -1194,7 +1207,7 @@ VAStatus vaSetSubpictureGlobalAlpha (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaSetSubpictureGlobalAlpha ( ctx, subpicture, global_alpha );
+  return ctx->vtable->vaSetSubpictureGlobalAlpha ( ctx, subpicture, global_alpha );
 }
 
 /*
@@ -1228,7 +1241,7 @@ VAStatus vaAssociateSubpicture (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaAssociateSubpicture ( ctx, subpicture, target_surfaces, num_surfaces, src_x, src_y, src_width, src_height, dest_x, dest_y, dest_width, dest_height, flags );
+  return ctx->vtable->vaAssociateSubpicture ( ctx, subpicture, target_surfaces, num_surfaces, src_x, src_y, src_width, src_height, dest_x, dest_y, dest_width, dest_height, flags );
 }
 
 /*
@@ -1245,7 +1258,7 @@ VAStatus vaDeassociateSubpicture (
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaDeassociateSubpicture ( ctx, subpicture, target_surfaces, num_surfaces );
+  return ctx->vtable->vaDeassociateSubpicture ( ctx, subpicture, target_surfaces, num_surfaces );
 }
 
 
@@ -1284,7 +1297,7 @@ VAStatus vaQueryDisplayAttributes (
 
   VAStatus va_status;
   
-  va_status = ctx->vtable.vaQueryDisplayAttributes ( ctx, attr_list, num_attributes );
+  va_status = ctx->vtable->vaQueryDisplayAttributes ( ctx, attr_list, num_attributes );
 
   VA_TRACE(va_TraceQueryDisplayAttributes, dpy, attr_list, num_attributes);
 
@@ -1310,7 +1323,7 @@ VAStatus vaGetDisplayAttributes (
 
   VAStatus va_status;
   
-  va_status = ctx->vtable.vaGetDisplayAttributes ( ctx, attr_list, num_attributes );
+  va_status = ctx->vtable->vaGetDisplayAttributes ( ctx, attr_list, num_attributes );
 
   VA_TRACE(va_TraceGetDisplayAttributes, dpy, attr_list, num_attributes);
   
@@ -1336,7 +1349,7 @@ VAStatus vaSetDisplayAttributes (
   VA_TRACE(va_TraceSetDisplayAttributes, dpy, attr_list, num_attributes);
 
   
-  return ctx->vtable.vaSetDisplayAttributes ( ctx, attr_list, num_attributes );
+  return ctx->vtable->vaSetDisplayAttributes ( ctx, attr_list, num_attributes );
 }
 
 VAStatus vaLockSurface(VADisplay dpy,
@@ -1356,7 +1369,7 @@ VAStatus vaLockSurface(VADisplay dpy,
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaLockSurface( ctx, surface, fourcc, luma_stride, chroma_u_stride, chroma_v_stride, luma_offset, chroma_u_offset, chroma_v_offset, buffer_name, buffer);
+  return ctx->vtable->vaLockSurface( ctx, surface, fourcc, luma_stride, chroma_u_stride, chroma_v_stride, luma_offset, chroma_u_offset, chroma_v_offset, buffer_name, buffer);
 }
 
 
@@ -1368,5 +1381,5 @@ VAStatus vaUnlockSurface(VADisplay dpy,
   CHECK_DISPLAY(dpy);
   ctx = CTX(dpy);
 
-  return ctx->vtable.vaUnlockSurface( ctx, surface );
+  return ctx->vtable->vaUnlockSurface( ctx, surface );
 }
diff --git a/va/va_backend.h b/va/va_backend.h
index d1e5570..a588462 100644
--- a/va/va_backend.h
+++ b/va/va_backend.h
@@ -378,15 +378,28 @@ struct VADriverVTable
 		VADriverContextP ctx,
                 VASurfaceID surface
         );
-
-        /* Optional: GLX support hooks */
-        struct VADriverVTableGLX *glx;
 };
 
 struct VADriverContext
 {
     void *pDriverData;
-    struct VADriverVTable vtable;
+
+    /**
+     * The core VA implementation hooks.
+     *
+     * This structure is allocated from libva with calloc().
+     */
+    struct VADriverVTable *vtable;
+
+    /**
+     * The VA/GLX implementation hooks.
+     *
+     * This structure is intended for drivers that implement the
+     * VA/GLX API. The driver implementation is responsible for the
+     * allocation and deallocation of this structure.
+     */
+    struct VADriverVTableGLX *vtable_glx;
+
     void *vtable_tpi; /* the structure is malloc-ed */
 
     void *native_dpy;
diff --git a/va/x11/va_x11.c b/va/x11/va_x11.c
index 93eb243..7a917f3 100644
--- a/va/x11/va_x11.c
+++ b/va/x11/va_x11.c
@@ -285,7 +285,7 @@ VAStatus vaPutSurface (
            destx, desty, destw, desth,
            cliprects, number_cliprects, flags );
   
-  return ctx->vtable.vaPutSurface( ctx, surface, (void *)draw, srcx, srcy, srcw, srch,
+  return ctx->vtable->vaPutSurface( ctx, surface, (void *)draw, srcx, srcy, srcw, srch,
                                    destx, desty, destw, desth,
                                    cliprects, number_cliprects, flags );
 }
-- 
1.5.4.3

From 33b65d5e11096887a96fedeb870329be8d36f45b Mon Sep 17 00:00:00 2001
From: Gwenole Beauchesne <[email protected]>
Date: Thu, 27 Jan 2011 10:40:36 +0100
Subject: [PATCH] dummy_drv_video: make VADriverContext.vtable a pointer.

---
 dummy_drv_video/dummy_drv_video.c |   89 +++++++++++++++++++------------------
 1 files changed, 45 insertions(+), 44 deletions(-)

diff --git a/dummy_drv_video/dummy_drv_video.c b/dummy_drv_video/dummy_drv_video.c
index 4637147..f06cc0a 100644
--- a/dummy_drv_video/dummy_drv_video.c
+++ b/dummy_drv_video/dummy_drv_video.c
@@ -1196,6 +1196,7 @@ VAStatus dummy_Terminate( VADriverContextP ctx )
 
 VAStatus VA_DRIVER_INIT_FUNC(  VADriverContextP ctx )
 {
+    struct VADriverVTable * const vtable = ctx->vtable;
     object_base_p obj;
     int result;
     struct dummy_driver_data *driver_data;
@@ -1211,50 +1212,50 @@ VAStatus VA_DRIVER_INIT_FUNC(  VADriverContextP ctx )
     ctx->max_display_attributes = DUMMY_MAX_DISPLAY_ATTRIBUTES;
     ctx->str_vendor = DUMMY_STR_VENDOR;
 
-    ctx->vtable.vaTerminate = dummy_Terminate;
-    ctx->vtable.vaQueryConfigEntrypoints = dummy_QueryConfigEntrypoints;
-    ctx->vtable.vaQueryConfigProfiles = dummy_QueryConfigProfiles;
-    ctx->vtable.vaQueryConfigEntrypoints = dummy_QueryConfigEntrypoints;
-    ctx->vtable.vaQueryConfigAttributes = dummy_QueryConfigAttributes;
-    ctx->vtable.vaCreateConfig = dummy_CreateConfig;
-    ctx->vtable.vaDestroyConfig = dummy_DestroyConfig;
-    ctx->vtable.vaGetConfigAttributes = dummy_GetConfigAttributes;
-    ctx->vtable.vaCreateSurfaces = dummy_CreateSurfaces;
-    ctx->vtable.vaDestroySurfaces = dummy_DestroySurfaces;
-    ctx->vtable.vaCreateContext = dummy_CreateContext;
-    ctx->vtable.vaDestroyContext = dummy_DestroyContext;
-    ctx->vtable.vaCreateBuffer = dummy_CreateBuffer;
-    ctx->vtable.vaBufferSetNumElements = dummy_BufferSetNumElements;
-    ctx->vtable.vaMapBuffer = dummy_MapBuffer;
-    ctx->vtable.vaUnmapBuffer = dummy_UnmapBuffer;
-    ctx->vtable.vaDestroyBuffer = dummy_DestroyBuffer;
-    ctx->vtable.vaBeginPicture = dummy_BeginPicture;
-    ctx->vtable.vaRenderPicture = dummy_RenderPicture;
-    ctx->vtable.vaEndPicture = dummy_EndPicture;
-    ctx->vtable.vaSyncSurface = dummy_SyncSurface;
-    ctx->vtable.vaQuerySurfaceStatus = dummy_QuerySurfaceStatus;
-    ctx->vtable.vaPutSurface = dummy_PutSurface;
-    ctx->vtable.vaQueryImageFormats = dummy_QueryImageFormats;
-    ctx->vtable.vaCreateImage = dummy_CreateImage;
-    ctx->vtable.vaDeriveImage = dummy_DeriveImage;
-    ctx->vtable.vaDestroyImage = dummy_DestroyImage;
-    ctx->vtable.vaSetImagePalette = dummy_SetImagePalette;
-    ctx->vtable.vaGetImage = dummy_GetImage;
-    ctx->vtable.vaPutImage = dummy_PutImage;
-    ctx->vtable.vaQuerySubpictureFormats = dummy_QuerySubpictureFormats;
-    ctx->vtable.vaCreateSubpicture = dummy_CreateSubpicture;
-    ctx->vtable.vaDestroySubpicture = dummy_DestroySubpicture;
-    ctx->vtable.vaSetSubpictureImage = dummy_SetSubpictureImage;
-    ctx->vtable.vaSetSubpictureChromakey = dummy_SetSubpictureChromakey;
-    ctx->vtable.vaSetSubpictureGlobalAlpha = dummy_SetSubpictureGlobalAlpha;
-    ctx->vtable.vaAssociateSubpicture = dummy_AssociateSubpicture;
-    ctx->vtable.vaDeassociateSubpicture = dummy_DeassociateSubpicture;
-    ctx->vtable.vaQueryDisplayAttributes = dummy_QueryDisplayAttributes;
-    ctx->vtable.vaGetDisplayAttributes = dummy_GetDisplayAttributes;
-    ctx->vtable.vaSetDisplayAttributes = dummy_SetDisplayAttributes;
-    ctx->vtable.vaLockSurface = dummy_LockSurface;
-    ctx->vtable.vaUnlockSurface = dummy_UnlockSurface;
-    ctx->vtable.vaBufferInfo = dummy_BufferInfo;
+    vtable->vaTerminate = dummy_Terminate;
+    vtable->vaQueryConfigEntrypoints = dummy_QueryConfigEntrypoints;
+    vtable->vaQueryConfigProfiles = dummy_QueryConfigProfiles;
+    vtable->vaQueryConfigEntrypoints = dummy_QueryConfigEntrypoints;
+    vtable->vaQueryConfigAttributes = dummy_QueryConfigAttributes;
+    vtable->vaCreateConfig = dummy_CreateConfig;
+    vtable->vaDestroyConfig = dummy_DestroyConfig;
+    vtable->vaGetConfigAttributes = dummy_GetConfigAttributes;
+    vtable->vaCreateSurfaces = dummy_CreateSurfaces;
+    vtable->vaDestroySurfaces = dummy_DestroySurfaces;
+    vtable->vaCreateContext = dummy_CreateContext;
+    vtable->vaDestroyContext = dummy_DestroyContext;
+    vtable->vaCreateBuffer = dummy_CreateBuffer;
+    vtable->vaBufferSetNumElements = dummy_BufferSetNumElements;
+    vtable->vaMapBuffer = dummy_MapBuffer;
+    vtable->vaUnmapBuffer = dummy_UnmapBuffer;
+    vtable->vaDestroyBuffer = dummy_DestroyBuffer;
+    vtable->vaBeginPicture = dummy_BeginPicture;
+    vtable->vaRenderPicture = dummy_RenderPicture;
+    vtable->vaEndPicture = dummy_EndPicture;
+    vtable->vaSyncSurface = dummy_SyncSurface;
+    vtable->vaQuerySurfaceStatus = dummy_QuerySurfaceStatus;
+    vtable->vaPutSurface = dummy_PutSurface;
+    vtable->vaQueryImageFormats = dummy_QueryImageFormats;
+    vtable->vaCreateImage = dummy_CreateImage;
+    vtable->vaDeriveImage = dummy_DeriveImage;
+    vtable->vaDestroyImage = dummy_DestroyImage;
+    vtable->vaSetImagePalette = dummy_SetImagePalette;
+    vtable->vaGetImage = dummy_GetImage;
+    vtable->vaPutImage = dummy_PutImage;
+    vtable->vaQuerySubpictureFormats = dummy_QuerySubpictureFormats;
+    vtable->vaCreateSubpicture = dummy_CreateSubpicture;
+    vtable->vaDestroySubpicture = dummy_DestroySubpicture;
+    vtable->vaSetSubpictureImage = dummy_SetSubpictureImage;
+    vtable->vaSetSubpictureChromakey = dummy_SetSubpictureChromakey;
+    vtable->vaSetSubpictureGlobalAlpha = dummy_SetSubpictureGlobalAlpha;
+    vtable->vaAssociateSubpicture = dummy_AssociateSubpicture;
+    vtable->vaDeassociateSubpicture = dummy_DeassociateSubpicture;
+    vtable->vaQueryDisplayAttributes = dummy_QueryDisplayAttributes;
+    vtable->vaGetDisplayAttributes = dummy_GetDisplayAttributes;
+    vtable->vaSetDisplayAttributes = dummy_SetDisplayAttributes;
+    vtable->vaLockSurface = dummy_LockSurface;
+    vtable->vaUnlockSurface = dummy_UnlockSurface;
+    vtable->vaBufferInfo = dummy_BufferInfo;
 
     driver_data = (struct dummy_driver_data *) malloc( sizeof(*driver_data) );
     ctx->pDriverData = (void *) driver_data;
-- 
1.5.4.3

From 26eba9868996f94fbe708f6bfdc078365572c2a0 Mon Sep 17 00:00:00 2001
From: Gwenole Beauchesne <[email protected]>
Date: Thu, 27 Jan 2011 10:41:24 +0100
Subject: [PATCH] i965_drv_video: make VADriverContext.vtable a pointer.

---
 i965_drv_video/i965_drv_video.c |   85 ++++++++++++++++++++-------------------
 1 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/i965_drv_video/i965_drv_video.c b/i965_drv_video/i965_drv_video.c
index ea5be1f..88dbdd8 100644
--- a/i965_drv_video/i965_drv_video.c
+++ b/i965_drv_video/i965_drv_video.c
@@ -1836,6 +1836,7 @@ i965_Terminate(VADriverContextP ctx)
 VAStatus 
 VA_DRIVER_INIT_FUNC(  VADriverContextP ctx )
 {
+    struct VADriverVTable * const vtable = ctx->vtable;
     struct i965_driver_data *i965;
     int result;
 
@@ -1849,48 +1850,48 @@ VA_DRIVER_INIT_FUNC(  VADriverContextP ctx )
     ctx->max_display_attributes = I965_MAX_DISPLAY_ATTRIBUTES;
     ctx->str_vendor = I965_STR_VENDOR;
 
-    ctx->vtable.vaTerminate = i965_Terminate;
-    ctx->vtable.vaQueryConfigEntrypoints = i965_QueryConfigEntrypoints;
-    ctx->vtable.vaQueryConfigProfiles = i965_QueryConfigProfiles;
-    ctx->vtable.vaQueryConfigEntrypoints = i965_QueryConfigEntrypoints;
-    ctx->vtable.vaQueryConfigAttributes = i965_QueryConfigAttributes;
-    ctx->vtable.vaCreateConfig = i965_CreateConfig;
-    ctx->vtable.vaDestroyConfig = i965_DestroyConfig;
-    ctx->vtable.vaGetConfigAttributes = i965_GetConfigAttributes;
-    ctx->vtable.vaCreateSurfaces = i965_CreateSurfaces;
-    ctx->vtable.vaDestroySurfaces = i965_DestroySurfaces;
-    ctx->vtable.vaCreateContext = i965_CreateContext;
-    ctx->vtable.vaDestroyContext = i965_DestroyContext;
-    ctx->vtable.vaCreateBuffer = i965_CreateBuffer;
-    ctx->vtable.vaBufferSetNumElements = i965_BufferSetNumElements;
-    ctx->vtable.vaMapBuffer = i965_MapBuffer;
-    ctx->vtable.vaUnmapBuffer = i965_UnmapBuffer;
-    ctx->vtable.vaDestroyBuffer = i965_DestroyBuffer;
-    ctx->vtable.vaBeginPicture = i965_BeginPicture;
-    ctx->vtable.vaRenderPicture = i965_RenderPicture;
-    ctx->vtable.vaEndPicture = i965_EndPicture;
-    ctx->vtable.vaSyncSurface = i965_SyncSurface;
-    ctx->vtable.vaQuerySurfaceStatus = i965_QuerySurfaceStatus;
-    ctx->vtable.vaPutSurface = i965_PutSurface;
-    ctx->vtable.vaQueryImageFormats = i965_QueryImageFormats;
-    ctx->vtable.vaCreateImage = i965_CreateImage;
-    ctx->vtable.vaDeriveImage = i965_DeriveImage;
-    ctx->vtable.vaDestroyImage = i965_DestroyImage;
-    ctx->vtable.vaSetImagePalette = i965_SetImagePalette;
-    ctx->vtable.vaGetImage = i965_GetImage;
-    ctx->vtable.vaPutImage = i965_PutImage;
-    ctx->vtable.vaQuerySubpictureFormats = i965_QuerySubpictureFormats;
-    ctx->vtable.vaCreateSubpicture = i965_CreateSubpicture;
-    ctx->vtable.vaDestroySubpicture = i965_DestroySubpicture;
-    ctx->vtable.vaSetSubpictureImage = i965_SetSubpictureImage;
-    ctx->vtable.vaSetSubpictureChromakey = i965_SetSubpictureChromakey;
-    ctx->vtable.vaSetSubpictureGlobalAlpha = i965_SetSubpictureGlobalAlpha;
-    ctx->vtable.vaAssociateSubpicture = i965_AssociateSubpicture;
-    ctx->vtable.vaDeassociateSubpicture = i965_DeassociateSubpicture;
-    ctx->vtable.vaQueryDisplayAttributes = i965_QueryDisplayAttributes;
-    ctx->vtable.vaGetDisplayAttributes = i965_GetDisplayAttributes;
-    ctx->vtable.vaSetDisplayAttributes = i965_SetDisplayAttributes;
-//    ctx->vtable.vaDbgCopySurfaceToBuffer = i965_DbgCopySurfaceToBuffer;
+    vtable->vaTerminate = i965_Terminate;
+    vtable->vaQueryConfigEntrypoints = i965_QueryConfigEntrypoints;
+    vtable->vaQueryConfigProfiles = i965_QueryConfigProfiles;
+    vtable->vaQueryConfigEntrypoints = i965_QueryConfigEntrypoints;
+    vtable->vaQueryConfigAttributes = i965_QueryConfigAttributes;
+    vtable->vaCreateConfig = i965_CreateConfig;
+    vtable->vaDestroyConfig = i965_DestroyConfig;
+    vtable->vaGetConfigAttributes = i965_GetConfigAttributes;
+    vtable->vaCreateSurfaces = i965_CreateSurfaces;
+    vtable->vaDestroySurfaces = i965_DestroySurfaces;
+    vtable->vaCreateContext = i965_CreateContext;
+    vtable->vaDestroyContext = i965_DestroyContext;
+    vtable->vaCreateBuffer = i965_CreateBuffer;
+    vtable->vaBufferSetNumElements = i965_BufferSetNumElements;
+    vtable->vaMapBuffer = i965_MapBuffer;
+    vtable->vaUnmapBuffer = i965_UnmapBuffer;
+    vtable->vaDestroyBuffer = i965_DestroyBuffer;
+    vtable->vaBeginPicture = i965_BeginPicture;
+    vtable->vaRenderPicture = i965_RenderPicture;
+    vtable->vaEndPicture = i965_EndPicture;
+    vtable->vaSyncSurface = i965_SyncSurface;
+    vtable->vaQuerySurfaceStatus = i965_QuerySurfaceStatus;
+    vtable->vaPutSurface = i965_PutSurface;
+    vtable->vaQueryImageFormats = i965_QueryImageFormats;
+    vtable->vaCreateImage = i965_CreateImage;
+    vtable->vaDeriveImage = i965_DeriveImage;
+    vtable->vaDestroyImage = i965_DestroyImage;
+    vtable->vaSetImagePalette = i965_SetImagePalette;
+    vtable->vaGetImage = i965_GetImage;
+    vtable->vaPutImage = i965_PutImage;
+    vtable->vaQuerySubpictureFormats = i965_QuerySubpictureFormats;
+    vtable->vaCreateSubpicture = i965_CreateSubpicture;
+    vtable->vaDestroySubpicture = i965_DestroySubpicture;
+    vtable->vaSetSubpictureImage = i965_SetSubpictureImage;
+    vtable->vaSetSubpictureChromakey = i965_SetSubpictureChromakey;
+    vtable->vaSetSubpictureGlobalAlpha = i965_SetSubpictureGlobalAlpha;
+    vtable->vaAssociateSubpicture = i965_AssociateSubpicture;
+    vtable->vaDeassociateSubpicture = i965_DeassociateSubpicture;
+    vtable->vaQueryDisplayAttributes = i965_QueryDisplayAttributes;
+    vtable->vaGetDisplayAttributes = i965_GetDisplayAttributes;
+    vtable->vaSetDisplayAttributes = i965_SetDisplayAttributes;
+//    vtable->vaDbgCopySurfaceToBuffer = i965_DbgCopySurfaceToBuffer;
 
     i965 = (struct i965_driver_data *)calloc(1, sizeof(*i965));
     assert(i965);
-- 
1.5.4.3

_______________________________________________
Libva mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libva

Reply via email to