[Mesa-dev] [PATCH 18/30] egl/x11: don't populate dri2_dpy->swrast_loader_extension

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


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

Analogous to earlier commits.

Note: the actual version of the extension is 1, since it does not
implement .putImage2.

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
We're safe since when 2 was used the actual struct defined in
dri_interface.h was greater thus the calloc was explicitly zeroing the
function pointer, which our drivers check (iirc) prior to calling the
function.
---
 src/egl/drivers/dri2/platform_x11.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index 1c9cf1d..e96ea52 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -1160,6 +1160,14 @@ static struct dri2_egl_display_vtbl dri2_x11_display_vtbl = {
    .get_dri_drawable = dri2_surface_get_dri_drawable,
 };
 
+static const __DRIswrastLoaderExtension swrast_loader_extension = {
+   .base = { __DRI_SWRAST_LOADER, 1 },
+
+   .getDrawableInfo = swrastGetDrawableInfo,
+   .putImage        = swrastPutImage,
+   .getImage        = swrastGetImage,
+};
+
 static EGLBoolean
 dri2_initialize_x11_swrast(_EGLDriver *drv, _EGLDisplay *disp)
 {
@@ -1194,15 +1202,8 @@ dri2_initialize_x11_swrast(_EGLDriver *drv, _EGLDisplay *disp)
    if (!dri2_load_driver_swrast(disp))
       goto cleanup_conn;
 
-   dri2_dpy->swrast_loader_extension.base.name = __DRI_SWRAST_LOADER;
-   dri2_dpy->swrast_loader_extension.base.version = 2;
-   dri2_dpy->swrast_loader_extension.getDrawableInfo = swrastGetDrawableInfo;
-   dri2_dpy->swrast_loader_extension.putImage = swrastPutImage;
-   dri2_dpy->swrast_loader_extension.getImage = swrastGetImage;
-
-   dri2_dpy->extensions[0] = &dri2_dpy->swrast_loader_extension.base;
+   dri2_dpy->extensions[0] = &swrast_loader_extension.base;
    dri2_dpy->extensions[1] = NULL;
-   dri2_dpy->extensions[2] = NULL;
 
    if (!dri2_create_screen(disp))
       goto cleanup_driver;
-- 
2.9.0



More information about the mesa-dev mailing list