From 845baeff8443860be03b72ccbab9f44fa2719c32 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Fri, 6 Apr 2012 13:19:46 +0200 Subject: API: backend: rename VADriverContext.dri_state to drm_state. 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 --- va/android/va_android.cpp | 10 +++++----- va/va_backend.h | 17 +++++++++++++++-- va/x11/dri2_util.c | 4 ++-- va/x11/va_dricommon.c | 10 +++++----- va/x11/va_x11.c | 6 +++--- 5 files changed, 30 insertions(+), 17 deletions(-) diff --git a/va/android/va_android.cpp b/va/android/va_android.cpp index 7d7998e..20aaadd 100644 --- a/va/android/va_android.cpp +++ b/va/android/va_android.cpp @@ -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; @@ -148,7 +148,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; @@ -225,7 +225,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 diff --git a/va/va_backend.h b/va/va_backend.h index 9faa570..98fcd3c 100644 --- a/va/va_backend.h +++ b/va/va_backend.h @@ -427,8 +427,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 */ unsigned long reserved[45]; /* reserve for future add-ins, decrease the subscript accordingly */ diff --git a/va/x11/dri2_util.c b/va/x11/dri2_util.c index 47f663a..0a2ac45 100644 --- a/va/x11/dri2_util.c +++ b/va/x11/dri2_util.c @@ -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; diff --git a/va/x11/va_dricommon.c b/va/x11/va_dricommon.c index 6816b0f..c0cbbcc 100644 --- a/va/x11/va_dricommon.c +++ b/va/x11/va_dricommon.c @@ -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); } diff --git a/va/x11/va_x11.c b/va/x11/va_x11.c index 4f65fd0..05aa697 100644 --- a/va/x11/va_x11.c +++ b/va/x11/va_x11.c @@ -62,12 +62,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); } @@ -174,7 +174,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 -- cgit v1.2.1