From 5457caa58c048e2df71c7ebc036d5ca010d576b6 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Sun, 16 Mar 2014 00:26:53 +0000 Subject: [PATCH] gbm: cleanup __DRI*extension handling Use designated initialisers, store all extension pointers as const and use a const __DRIextensions array over assigning each element individually. Signed-off-by: Emil Velikov Reviewed-by: Ian Romanick --- src/gbm/backends/dri/gbm_dri.c | 20 ++++++++++++-------- src/gbm/backends/dri/gbm_driint.h | 12 ++++++------ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index 9d08a97e648..cec12d1f477 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -125,12 +125,13 @@ image_get_buffers(__DRIdrawable *driDrawable, } static const __DRIuseInvalidateExtension use_invalidate = { - { __DRI_USE_INVALIDATE, 1 } + .base = { __DRI_USE_INVALIDATE, 1 } }; static const __DRIimageLookupExtension image_lookup_extension = { - { __DRI_IMAGE_LOOKUP, 1 }, - dri_lookup_egl_image + .base = { __DRI_IMAGE_LOOKUP, 1 }, + + .lookupEGLImage = dri_lookup_egl_image }; static const __DRIdri2LoaderExtension dri2_loader_extension = { @@ -148,6 +149,13 @@ static const __DRIimageLoaderExtension image_loader_extension = { .flushFrontBuffer = dri_flush_front_buffer, }; +static const __DRIextension *gbm_dri_screen_extensions[] = { + &image_lookup_extension.base, + &use_invalidate.base, + &dri2_loader_extension.base, + &image_loader_extension.base, + NULL, +}; struct dri_extension_match { const char *name; @@ -285,11 +293,7 @@ dri_screen_create(struct gbm_dri_device *dri) return ret; }; - dri->extensions[0] = &image_lookup_extension.base; - dri->extensions[1] = &use_invalidate.base; - dri->extensions[2] = &dri2_loader_extension.base; - dri->extensions[3] = &image_loader_extension.base; - dri->extensions[4] = NULL; + dri->extensions = gbm_dri_screen_extensions; if (dri->dri2 == NULL) return -1; diff --git a/src/gbm/backends/dri/gbm_driint.h b/src/gbm/backends/dri/gbm_driint.h index fdf694dce06..9c4392de05f 100644 --- a/src/gbm/backends/dri/gbm_driint.h +++ b/src/gbm/backends/dri/gbm_driint.h @@ -44,14 +44,14 @@ struct gbm_dri_device { __DRIscreen *screen; - __DRIcoreExtension *core; - __DRIdri2Extension *dri2; - __DRIimageExtension *image; - __DRI2flushExtension *flush; - __DRIdri2LoaderExtension *loader; + const __DRIcoreExtension *core; + const __DRIdri2Extension *dri2; + const __DRIimageExtension *image; + const __DRI2flushExtension *flush; + const __DRIdri2LoaderExtension *loader; const __DRIconfig **driver_configs; - const __DRIextension *extensions[5]; + const __DRIextension **extensions; const __DRIextension **driver_extensions; __DRIimage *(*lookup_image)(__DRIscreen *screen, void *image, void *data); -- 2.30.2