egl/android: don't populate dri2_dpy->dri2_loader_extension
authorEmil Velikov <emil.velikov@collabora.com>
Tue, 16 Aug 2016 16:23:23 +0000 (17:23 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Fri, 14 Oct 2016 11:17:18 +0000 (12:17 +0100)
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@collabora.com>
src/egl/drivers/dri2/platform_android.c
src/egl/drivers/dri2/platform_surfaceless.c

index 9581c9617d670b572c7b3c2d98cb1ae7b954f647..4f09b26e130b855df23b22649f2d0b700f7d6cbb 100644 (file)
@@ -883,6 +883,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 },
 
@@ -928,13 +936,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;
    }
index b4653cc807be78cdcc9907f4f9084063cbcb3641..797c013133aa0b45ba84e2a10f1a0b2e0effda69 100644 (file)
@@ -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,