drivers/dri: cleanup dri extension instantiation
authorEmil Velikov <emil.l.velikov@gmail.com>
Wed, 12 Feb 2014 17:47:53 +0000 (17:47 +0000)
committerEmil Velikov <emil.l.velikov@gmail.com>
Mon, 28 Apr 2014 18:11:27 +0000 (19:11 +0100)
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@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
src/mesa/drivers/dri/i915/intel_screen.c
src/mesa/drivers/dri/i965/intel_screen.c
src/mesa/drivers/dri/nouveau/nouveau_driver.c
src/mesa/drivers/dri/nouveau/nouveau_screen.c
src/mesa/drivers/dri/radeon/radeon_screen.c
src/mesa/drivers/dri/swrast/swrast.c

index 384cb4689b948e7dc29e4c669daf5bd3f4f16a1c..9b4e490df07f219c7a3f6ed4e35a94ae74e18b6b 100644 (file)
@@ -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,
index 8cb1260433a5b1184732c924666660e4959e9b74..3b2e4e9c7653edf41aa77ad9734daae3f036b25d 100644 (file)
@@ -154,7 +154,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,
@@ -796,7 +796,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,
@@ -891,15 +891,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[] = {
index 809b5ffb3365eda874984d6f8c791f853ea60755..1a8afa2af121488f42e5df5ea1eb2b7cf1239dfc 100644 (file)
@@ -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)
index 99290561e375efb71bde03c022d2bb423812a51a..aec2f729d69336d0d1c728205ae2269658772d20 100644 (file)
@@ -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[] = {
index 90251db3e64184933837dcce0c207653fe62ef6b..dd940382be0a101cc23021c3b7ac226eb574e36b 100644 (file)
@@ -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)
index 071192c6fc4172c9ae08b9cea0d36182d1481d20..888138115f08ef2966c36e26a0bece22b8d067f6 100644 (file)
@@ -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[] = {