From: Emil Velikov Date: Wed, 12 Feb 2014 17:47:53 +0000 (+0000) Subject: drivers/dri: cleanup dri extension instantiation X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=38f20f79da4212c86d0869951f533d66a5ef907e;p=mesa.git drivers/dri: cleanup dri extension instantiation 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 Reviewed-by: Ian Romanick Reviewed-by: Kristian Høgsberg --- diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 384cb4689b9..9b4e490df07 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 8cb1260433a..3b2e4e9c765 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -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[] = { diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c b/src/mesa/drivers/dri/nouveau/nouveau_driver.c index 809b5ffb336..1a8afa2af12 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 99290561e37..aec2f729d69 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 90251db3e64..dd940382be0 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 071192c6fc4..888138115f0 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[] = {