[Libva] [PATCH v2 3/5] API: backend: rename dri_state to drm_state.

ykzhao yakui.zhao at intel.com
Sun Jul 8 18:44:51 PDT 2012


On Fri, 2012-07-06 at 10:42 -0600, Gwenole Beauchesne wrote:
> Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
> ---
>  va/android/va_android.cpp |   10 +++++-----
>  va/va_backend.h           |    2 +-
>  va/x11/dri1_util.c        |    4 ++--
>  va/x11/dri2_util.c        |    4 ++--
>  va/x11/va_dricommon.c     |   10 +++++-----
>  va/x11/va_x11.c           |    6 +++---
>  6 files changed, 18 insertions(+), 18 deletions(-)
> 

There is no problem when the variable of dri_state is renamed to
drm_state.
But it seems a little confusing as the patch 2 already defines the
structure type of drm_state.
    >/** \brief Base DRM state. */
+struct drm_state {
+    /** \brief DRM connection descriptor. */
+    int         fd;
+    /** \brief DRM authentication type. */
+    int         auth_type;
+};
+

> diff --git a/va/android/va_android.cpp b/va/android/va_android.cpp
> index 92f1e60..b811afc 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;
>      
> @@ -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
> diff --git a/va/va_backend.h b/va/va_backend.h
> index c92be53..522f606 100644
> --- a/va/va_backend.h
> +++ b/va/va_backend.h
> @@ -451,7 +451,7 @@ struct VADriverContext
>  
>      void *handle;			/* dlopen handle */
>      
> -    void *dri_state;
> +    void *drm_state;                    /* base DRM state */
>      void *glx;				/* opaque for GLX code */
>  
>      /**
> diff --git a/va/x11/dri1_util.c b/va/x11/dri1_util.c
> index 0b87e24..d3da81b 100644
> --- a/va/x11/dri1_util.c
> +++ b/va/x11/dri1_util.c
> @@ -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;
> 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 86b040a..f81e30a 100644
> --- a/va/x11/va_x11.c
> +++ b/va/x11/va_x11.c
> @@ -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




More information about the Libva mailing list