[Mesa-dev] [PATCH 11/30] egl/android: don't populate dri2_dpy->dri2_loader_extension

Emil Velikov emil.l.velikov at gmail.com
Thu Aug 25 16:18:33 UTC 2016


From: Emil Velikov <emil.velikov at collabora.com>

The extension stored in struct dri2_egl_display isn't used, thus we can
create a static const instance of the extension and point extensions[]
to it.

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 src/egl/drivers/dri2/platform_android.c     | 16 +++++++++-------
 src/egl/drivers/dri2/platform_surfaceless.c |  8 ++++++++
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index c574533..1ddc8e3 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -889,6 +889,14 @@ static struct dri2_egl_display_vtbl droid_display_vtbl = {
    .get_dri_drawable = dri2_surface_get_dri_drawable,
 };
 
+static const __DRIdri2LoaderExtension droid_dri2_loader_extension = {
+   .base = { __DRI_DRI2_LOADER, 3 },
+
+   .getBuffers           = NULL,
+   .flushFrontBuffer     = droid_flush_front_buffer,
+   .getBuffersWithFormat = droid_get_buffers_with_format,
+};
+
 static const __DRIimageLoaderExtension droid_image_loader_extension = {
    .base = { __DRI_IMAGE_LOADER, 1 },
 
@@ -934,13 +942,7 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *dpy)
    /* render nodes cannot use Gem names, and thus do not support
     * the __DRI_DRI2_LOADER extension */
    if (!dri2_dpy->is_render_node) {
-      dri2_dpy->dri2_loader_extension.base.name = __DRI_DRI2_LOADER;
-      dri2_dpy->dri2_loader_extension.base.version = 3;
-      dri2_dpy->dri2_loader_extension.getBuffers = NULL;
-      dri2_dpy->dri2_loader_extension.flushFrontBuffer = droid_flush_front_buffer;
-      dri2_dpy->dri2_loader_extension.getBuffersWithFormat =
-        droid_get_buffers_with_format;
-      dri2_dpy->extensions[0] = &dri2_dpy->dri2_loader_extension.base;
+      dri2_dpy->extensions[0] = &droid_dri2_loader_extension.base;
    } else {
       dri2_dpy->extensions[0] = &droid_image_loader_extension.base;
    }
diff --git a/src/egl/drivers/dri2/platform_surfaceless.c b/src/egl/drivers/dri2/platform_surfaceless.c
index b4653cc..797c013 100644
--- a/src/egl/drivers/dri2/platform_surfaceless.c
+++ b/src/egl/drivers/dri2/platform_surfaceless.c
@@ -265,6 +265,14 @@ surfaceless_get_buffers_with_format(__DRIdrawable * driDrawable,
    return dri2_surf->buffers;
 }
 
+static const __DRIdri2LoaderExtension droid_dri2_loader_extension = {
+   .base = { __DRI_DRI2_LOADER, 3 },
+
+   .getBuffers            = NULL,
+   .flushFrontBuffer      = droid_flush_front_buffer,
+   .getBuffersWithFormat = droid_get_buffers_with_format,
+};
+
 static const __DRIimageLoaderExtension image_loader_extension = {
    .base             = { __DRI_IMAGE_LOADER, 1 },
    .getBuffers       = surfaceless_image_get_buffers,
-- 
2.9.0



More information about the mesa-dev mailing list