[Mesa-dev] [PATCH 02/16] drivers/dri: cleanup dri extension instantiation

Kristian Høgsberg krh at bitplanet.net
Fri Apr 25 10:47:50 PDT 2014


On Sun, Mar 16, 2014 at 6:48 AM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> Uniformly use the typecasted extension name, constify extension instances
> and use designated initialisers. Set the implemented version of the
> extension, over the one defined in dri_infertace.h. Patch covers the
> following extensions:
>
> __DRItexBufferExtension
> __DRIimageExtension
> __DRIrobustnessExtension
> __DRI2rendererQueryExtension
> __DRIdri2LoaderExtension
>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>

Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>

> ---
>  src/mesa/drivers/dri/i915/intel_screen.c      |  6 +++---
>  src/mesa/drivers/dri/i965/intel_screen.c      | 10 ++++-----
>  src/mesa/drivers/dri/nouveau/nouveau_driver.c |  2 +-
>  src/mesa/drivers/dri/nouveau/nouveau_screen.c |  8 ++++---
>  src/mesa/drivers/dri/radeon/radeon_screen.c   | 31 ++++++++++++++++-----------
>  src/mesa/drivers/dri/swrast/swrast.c          |  8 ++++---
>  6 files changed, 37 insertions(+), 28 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c
> index 384cb46..9b4e490 100644
> --- a/src/mesa/drivers/dri/i915/intel_screen.c
> +++ b/src/mesa/drivers/dri/i915/intel_screen.c
> @@ -142,7 +142,7 @@ aub_dump_bmp(struct gl_context *ctx)
>  }
>
>  static const __DRItexBufferExtension intelTexBufferExtension = {
> -   .base = { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
> +   .base = { __DRI_TEX_BUFFER, 3 },
>
>     .setTexBuffer        = intelSetTexBuffer,
>     .setTexBuffer2       = intelSetTexBuffer2,
> @@ -685,7 +685,7 @@ intel_from_planar(__DRIimage *parent, int plane, void *loaderPrivate)
>      return image;
>  }
>
> -static struct __DRIimageExtensionRec intelImageExtension = {
> +static const __DRIimageExtension intelImageExtension = {
>      .base = { __DRI_IMAGE, 7 },
>
>      .createImageFromName                = intel_create_image_from_name,
> @@ -778,7 +778,7 @@ i915_query_renderer_string(__DRIscreen *psp, int param, const char **value)
>     return -1;
>  }
>
> -static struct __DRI2rendererQueryExtensionRec intelRendererQueryExtension = {
> +static const __DRI2rendererQueryExtension intelRendererQueryExtension = {
>     .base = { __DRI2_RENDERER_QUERY, 1 },
>
>     .queryInteger = i915_query_renderer_integer,
> diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
> index 464cebf..7dd8ab3 100644
> --- a/src/mesa/drivers/dri/i965/intel_screen.c
> +++ b/src/mesa/drivers/dri/i965/intel_screen.c
> @@ -153,7 +153,7 @@ aub_dump_bmp(struct gl_context *ctx)
>  }
>
>  static const __DRItexBufferExtension intelTexBufferExtension = {
> -   .base = { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
> +   .base = { __DRI_TEX_BUFFER, 3 },
>
>     .setTexBuffer        = intelSetTexBuffer,
>     .setTexBuffer2       = intelSetTexBuffer2,
> @@ -786,7 +786,7 @@ intel_from_planar(__DRIimage *parent, int plane, void *loaderPrivate)
>      return image;
>  }
>
> -static struct __DRIimageExtensionRec intelImageExtension = {
> +static const __DRIimageExtension intelImageExtension = {
>      .base = { __DRI_IMAGE, 8 },
>
>      .createImageFromName                = intel_create_image_from_name,
> @@ -881,15 +881,15 @@ brw_query_renderer_string(__DRIscreen *psp, int param, const char **value)
>     return -1;
>  }
>
> -static struct __DRI2rendererQueryExtensionRec intelRendererQueryExtension = {
> +static const __DRI2rendererQueryExtension intelRendererQueryExtension = {
>     .base = { __DRI2_RENDERER_QUERY, 1 },
>
>     .queryInteger = brw_query_renderer_integer,
>     .queryString = brw_query_renderer_string
>  };
>
> -static const struct __DRIrobustnessExtensionRec dri2Robustness = {
> -   { __DRI2_ROBUSTNESS, 1 }
> +static const __DRIrobustnessExtension dri2Robustness = {
> +   .base = { __DRI2_ROBUSTNESS, 1 }
>  };
>
>  static const __DRIextension *intelScreenExtensions[] = {
> diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
> index 809b5ff..1a8afa2 100644
> --- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c
> +++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
> @@ -65,7 +65,7 @@ nouveau_flush(struct gl_context *ctx)
>         if (_mesa_is_winsys_fbo(ctx->DrawBuffer) &&
>             ctx->DrawBuffer->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT) {
>                 __DRIscreen *screen = nctx->screen->dri_screen;
> -               __DRIdri2LoaderExtension *dri2 = screen->dri2.loader;
> +               const __DRIdri2LoaderExtension *dri2 = screen->dri2.loader;
>                 __DRIdrawable *drawable = nctx->dri_context->driDrawablePriv;
>
>                 if (drawable && drawable->loaderPrivate)
> diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
> index 9929056..aec2f72 100644
> --- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
> +++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
> @@ -234,9 +234,11 @@ static const struct __DRI2flushExtensionRec nouveau_flush_extension = {
>  };
>
>  static const struct __DRItexBufferExtensionRec nouveau_texbuffer_extension = {
> -    { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
> -    NULL,
> -    nouveau_set_texbuffer,
> +   .base = { __DRI_TEX_BUFFER, 3 },
> +
> +   .setTexBuffer        = NULL,
> +   .setTexBuffer2       = nouveau_set_texbuffer,
> +   .releaseTexBuffer    = NULL,
>  };
>
>  static const __DRIextension *nouveau_screen_extensions[] = {
> diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
> index 90251db..dd94038 100644
> --- a/src/mesa/drivers/dri/radeon/radeon_screen.c
> +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
> @@ -170,15 +170,19 @@ radeonGetParam(__DRIscreen *sPriv, int param, void *value)
>
>  #if defined(RADEON_R100)
>  static const __DRItexBufferExtension radeonTexBufferExtension = {
> -    { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
> -   radeonSetTexBuffer,
> -   radeonSetTexBuffer2,
> +   .base = { __DRI_TEX_BUFFER, 3 },
> +
> +   .setTexBuffer        = radeonSetTexBuffer,
> +   .setTexBuffer2       = radeonSetTexBuffer2,
> +   .releaseTexBuffer    = NULL,
>  };
>  #elif defined(RADEON_R200)
>  static const __DRItexBufferExtension r200TexBufferExtension = {
> -    { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
> -   r200SetTexBuffer,
> -   r200SetTexBuffer2,
> +   .base = { __DRI_TEX_BUFFER, 3 },
> +
> +   .setTexBuffer        = r200SetTexBuffer,
> +   .setTexBuffer2       = r200SetTexBuffer2,
> +   .releaseTexBuffer    = NULL,
>  };
>  #endif
>
> @@ -373,13 +377,14 @@ radeon_query_image(__DRIimage *image, int attrib, int *value)
>     }
>  }
>
> -static struct __DRIimageExtensionRec radeonImageExtension = {
> -    { __DRI_IMAGE, 1 },
> -   radeon_create_image_from_name,
> -   radeon_create_image_from_renderbuffer,
> -   radeon_destroy_image,
> -   radeon_create_image,
> -   radeon_query_image
> +static const __DRIimageExtension radeonImageExtension = {
> +   .base = { __DRI_IMAGE, 1 },
> +
> +   .createImageFromName         = radeon_create_image_from_name,
> +   .createImageFromRenderbuffer = radeon_create_image_from_renderbuffer,
> +   .destroyImage                = radeon_destroy_image,
> +   .createImage                 = radeon_create_image,
> +   .queryImage                  = radeon_query_image
>  };
>
>  static int radeon_set_screen_flags(radeonScreenPtr screen, int device_id)
> diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
> index 071192c..8881381 100644
> --- a/src/mesa/drivers/dri/swrast/swrast.c
> +++ b/src/mesa/drivers/dri/swrast/swrast.c
> @@ -110,9 +110,11 @@ static void swrastSetTexBuffer(__DRIcontext *pDRICtx, GLint target,
>  }
>
>  static const __DRItexBufferExtension swrastTexBufferExtension = {
> -    { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
> -    swrastSetTexBuffer,
> -    swrastSetTexBuffer2,
> +   .base = { __DRI_TEX_BUFFER, 3 },
> +
> +   .setTexBuffer        = swrastSetTexBuffer,
> +   .setTexBuffer2       = swrastSetTexBuffer2,
> +   .releaseTexBuffer    = NULL,
>  };
>
>  static const __DRIextension *dri_screen_extensions[] = {
> --
> 1.9.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list