API: backend: rename VADriverContext.dri_state to drm_state.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Fri, 6 Apr 2012 11:19:46 +0000 (13:19 +0200)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Fri, 27 Jul 2012 13:21:54 +0000 (15:21 +0200)
VADriverContext.drm_state holds data structures derived from struct
drm_state, thus also including struct dri_state for VA/X11 drivers.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
va/android/va_android.cpp
va/va_backend.h
va/x11/dri1_util.c
va/x11/dri2_util.c
va/x11/va_dricommon.c
va/x11/va_x11.c

index 92f1e60..b811afc 100644 (file)
@@ -95,10 +95,10 @@ static void va_DisplayContextDestroy (
         return;
 
     /* close the open-ed DRM fd */
-    dri_state = (struct dri_state *)pDisplayContext->pDriverContext->dri_state;
+    dri_state = (struct dri_state *)pDisplayContext->pDriverContext->drm_state;
     close(dri_state->base.fd);
 
-    free(pDisplayContext->pDriverContext->dri_state);
+    free(pDisplayContext->pDriverContext->drm_state);
     free(pDisplayContext->pDriverContext);
     free(pDisplayContext);
 }
@@ -110,7 +110,7 @@ static VAStatus va_DisplayContextGetDriverName (
 )
 {
     VADriverContextP ctx = pDisplayContext->pDriverContext;
-    struct dri_state *dri_state = (struct dri_state *)ctx->dri_state;
+    struct dri_state *dri_state = (struct dri_state *)ctx->drm_state;
     char *driver_name_env;
     int vendor_id, device_id;
     
@@ -149,7 +149,7 @@ static VAStatus va_DisplayContextGetDriverName (
 )
 {
     VADriverContextP ctx = pDisplayContext->pDriverContext;
-    struct dri_state *dri_state = (struct dri_state *)ctx->dri_state;
+    struct dri_state *dri_state = (struct dri_state *)ctx->drm_state;
     char *driver_name_env;
     int vendor_id, device_id;
     int i = 0;
@@ -227,7 +227,7 @@ VADisplay vaGetDisplay (
             pDisplayContext->vaIsValid       = va_DisplayContextIsValid;
             pDisplayContext->vaDestroy       = va_DisplayContextDestroy;
             pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName;
-            pDriverContext->dri_state       = dri_state;
+            pDriverContext->drm_state       = dri_state;
             dpy                              = (VADisplay)pDisplayContext;
         }
         else
index c92be53..1e04a9c 100644 (file)
@@ -450,8 +450,21 @@ struct VADriverContext
     const char *str_vendor;
 
     void *handle;                      /* dlopen handle */
-    
-    void *dri_state;
+
+    /**
+     * \brief DRM state.
+     *
+     * This field holds driver specific data for DRM-based
+     * drivers. This structure is allocated from libva with
+     * calloc(). Do not deallocate from within VA driver
+     * implementations.
+     *
+     * All structures shall be derived from struct drm_state. So, for
+     * instance, this field holds a dri_state structure for VA/X11
+     * drivers that use the DRM protocol.
+     */
+    void *drm_state;
+
     void *glx;                         /* opaque for GLX code */
 
     /**
index 0b87e24..d3da81b 100644 (file)
@@ -59,7 +59,7 @@ dri1GetRenderingBuffer(VADriverContextP ctx, struct dri_drawable *dri_drawable)
 static void
 dri1Close(VADriverContextP ctx)
 {
-    struct dri_state *dri_state = (struct dri_state *)ctx->dri_state;
+    struct dri_state *dri_state = (struct dri_state *)ctx->drm_state;
 
     free_drawable_hashtable(ctx);
     VA_DRIDestroyContext(ctx->native_dpy, ctx->x11_screen, dri_state->hwContextID);
@@ -73,7 +73,7 @@ dri1Close(VADriverContextP ctx)
 Bool 
 isDRI1Connected(VADriverContextP ctx, char **driver_name)
 {
-    struct dri_state *dri_state = (struct dri_state *)ctx->dri_state;
+    struct dri_state *dri_state = (struct dri_state *)ctx->drm_state;
     int direct_capable;
     int driver_major;
     int driver_minor;
index 47f663a..0a2ac45 100644 (file)
@@ -164,7 +164,7 @@ dri2GetRenderingBuffer(VADriverContextP ctx, struct dri_drawable *dri_drawable)
 void
 dri2Close(VADriverContextP ctx)
 {
-    struct dri_state *dri_state = (struct dri_state *)ctx->dri_state;
+    struct dri_state *dri_state = (struct dri_state *)ctx->drm_state;
 
     free_drawable_hashtable(ctx);
 
@@ -175,7 +175,7 @@ dri2Close(VADriverContextP ctx)
 Bool 
 isDRI2Connected(VADriverContextP ctx, char **driver_name)
 {
-    struct dri_state *dri_state = (struct dri_state *)ctx->dri_state;
+    struct dri_state *dri_state = (struct dri_state *)ctx->drm_state;
     int major, minor;
     int error_base;
     int event_base;
index 6816b0f..c0cbbcc 100644 (file)
@@ -61,7 +61,7 @@ is_window(Display *dpy, Drawable drawable)
 static struct dri_drawable *
 do_drawable_hash(VADriverContextP ctx, XID drawable)
 {
-    struct dri_state *dri_state = (struct dri_state *)ctx->dri_state;
+    struct dri_state *dri_state = (struct dri_state *)ctx->drm_state;
     int index = drawable % DRAWABLE_HASH_SZ;
     struct dri_drawable *dri_drawable = dri_state->drawable_hash[index];
 
@@ -83,7 +83,7 @@ do_drawable_hash(VADriverContextP ctx, XID drawable)
 void
 free_drawable(VADriverContextP ctx, struct dri_drawable* dri_drawable)
 {
-    struct dri_state *dri_state = (struct dri_state *)ctx->dri_state;
+    struct dri_state *dri_state = (struct dri_state *)ctx->drm_state;
     int i = 0;
 
     while (i++ < DRAWABLE_HASH_SZ) {
@@ -97,7 +97,7 @@ free_drawable(VADriverContextP ctx, struct dri_drawable* dri_drawable)
 void
 free_drawable_hashtable(VADriverContextP ctx)
 {
-    struct dri_state *dri_state = (struct dri_state *)ctx->dri_state;
+    struct dri_state *dri_state = (struct dri_state *)ctx->drm_state;
     int i;
     struct dri_drawable *dri_drawable, *prev;
 
@@ -123,7 +123,7 @@ dri_get_drawable(VADriverContextP ctx, XID drawable)
 void 
 dri_swap_buffer(VADriverContextP ctx, struct dri_drawable *dri_drawable)
 {
-    struct dri_state *dri_state = (struct dri_state *)ctx->dri_state;
+    struct dri_state *dri_state = (struct dri_state *)ctx->drm_state;
 
     dri_state->swapBuffer(ctx, dri_drawable);
 }
@@ -131,7 +131,7 @@ dri_swap_buffer(VADriverContextP ctx, struct dri_drawable *dri_drawable)
 union dri_buffer *
 dri_get_rendering_buffer(VADriverContextP ctx, struct dri_drawable *dri_drawable)
 {
-    struct dri_state *dri_state = (struct dri_state *)ctx->dri_state;
+    struct dri_state *dri_state = (struct dri_state *)ctx->drm_state;
     
     return dri_state->getRenderingBuffer(ctx, dri_drawable);
 }
index 86b040a..f81e30a 100644 (file)
@@ -63,12 +63,12 @@ static void va_DisplayContextDestroy (
         return;
 
     ctx = pDisplayContext->pDriverContext;
-    dri_state = ctx->dri_state;
+    dri_state = ctx->drm_state;
 
     if (dri_state && dri_state->close)
         dri_state->close(ctx);
 
-    free(pDisplayContext->pDriverContext->dri_state);
+    free(pDisplayContext->pDriverContext->drm_state);
     free(pDisplayContext->pDriverContext);
     free(pDisplayContext);
 }
@@ -190,7 +190,7 @@ VADisplay vaGetDisplay (
          pDisplayContext->vaDestroy       = va_DisplayContextDestroy;
          pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName;
           pDisplayContext->opaque          = NULL;
-         pDriverContext->dri_state        = dri_state;
+         pDriverContext->drm_state        = dri_state;
          dpy                              = (VADisplay)pDisplayContext;
       }
       else