[Mesa-dev] [PATCH 09/16] gbm: cleanup __DRI*extension handling
Emil Velikov
emil.l.velikov at gmail.com
Sun Mar 16 06:48:29 PDT 2014
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 <emil.l.velikov at gmail.com>
---
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 acf6b24..a9f8d00 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -124,12 +124,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 = {
@@ -147,6 +148,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;
@@ -284,11 +292,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 fdf694d..9c4392d 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);
--
1.9.0
More information about the mesa-dev
mailing list