Module: Mesa
Branch: master
Commit: 9c0dad0a2bc6fe84d1a30ffaf6a75fd6463f6ab6
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9c0dad0a2bc6fe84d1a30ffaf6a75fd6463f6ab6

Author: Matt Turner <matts...@gmail.com>
Date:   Sat Aug  5 00:25:50 2017 +0100

egl: Clean up native_type vs drawable mess

The next patch is going to stop passing XCB_WINDOW_NONE (of type
xcb_window_enum_t) as an argument where these functions expect a void *,
which clang does not appreciate.

This patch cleans things up to better convince me and reviewers that
it's safe to do that.

v2: Emil Velikov: rebase/integrate with series
Signed-off-by: Emil Velikov <emil.veli...@collabora.com>
Reviewed-by: Tapani Pälli <tapani.pa...@intel.com>

---

 src/egl/drivers/dri2/platform_x11.c      | 7 ++-----
 src/egl/drivers/dri2/platform_x11_dri3.c | 6 +++---
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_x11.c 
b/src/egl/drivers/dri2/platform_x11.c
index 87efa016be..12c7d42c8f 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -222,12 +222,8 @@ dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay 
*disp, EGLint type,
    xcb_get_geometry_cookie_t cookie;
    xcb_get_geometry_reply_t *reply;
    xcb_generic_error_t *error;
-   xcb_drawable_t drawable;
    const __DRIconfig *config;
 
-   STATIC_ASSERT(sizeof(uintptr_t) == sizeof(native_surface));
-   drawable = (uintptr_t) native_surface;
-
    (void) drv;
 
    dri2_surf = malloc(sizeof *dri2_surf);
@@ -246,7 +242,8 @@ dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, 
EGLint type,
                        dri2_surf->drawable, dri2_dpy->screen->root,
                        dri2_surf->base.Width, dri2_surf->base.Height);
    } else {
-      dri2_surf->drawable = drawable;
+      STATIC_ASSERT(sizeof(uintptr_t) == sizeof(native_surface));
+      dri2_surf->drawable = (uintptr_t) native_surface;
    }
 
    config = dri2_get_dri_config(dri2_conf, type,
diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c 
b/src/egl/drivers/dri2/platform_x11_dri3.c
index 3a0efc6ccc..b88374c1cb 100644
--- a/src/egl/drivers/dri2/platform_x11_dri3.c
+++ b/src/egl/drivers/dri2/platform_x11_dri3.c
@@ -141,9 +141,6 @@ dri3_create_surface(_EGLDriver *drv, _EGLDisplay *disp, 
EGLint type,
    const __DRIconfig *dri_config;
    xcb_drawable_t drawable;
 
-   STATIC_ASSERT(sizeof(uintptr_t) == sizeof(native_surface));
-   drawable = (uintptr_t) native_surface;
-
    (void) drv;
 
    dri3_surf = calloc(1, sizeof *dri3_surf);
@@ -160,6 +157,9 @@ dri3_create_surface(_EGLDriver *drv, _EGLDisplay *disp, 
EGLint type,
       xcb_create_pixmap(dri2_dpy->conn, conf->BufferSize,
                         drawable, dri2_dpy->screen->root,
                         dri3_surf->base.Width, dri3_surf->base.Height);
+   } else {
+      STATIC_ASSERT(sizeof(uintptr_t) == sizeof(native_surface));
+      drawable = (uintptr_t) native_surface;
    }
 
    dri_config = dri2_get_dri_config(dri2_conf, type,

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to