[Mesa-dev] [PATCH] egl: Clean up native_type vs drawable mess
Matt Turner
mattst88 at gmail.com
Fri Aug 4 17:18:26 UTC 2017
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.
---
src/egl/drivers/dri2/platform_x11.c | 10 ++++------
src/egl/drivers/dri2/platform_x11_dri3.c | 6 +++---
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index c10cd84fce..063c50bcce 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -210,12 +210,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);
@@ -234,14 +230,16 @@ 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 {
- if (!drawable) {
+ if (!native_surface) {
if (type == EGL_WINDOW_BIT)
_eglError(EGL_BAD_NATIVE_WINDOW, "dri2_create_surface");
else
_eglError(EGL_BAD_NATIVE_PIXMAP, "dri2_create_surface");
goto cleanup_surf;
}
- 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 515be27e20..df17cfa7aa 100644
--- a/src/egl/drivers/dri2/platform_x11_dri3.c
+++ b/src/egl/drivers/dri2/platform_x11_dri3.c
@@ -172,9 +172,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);
@@ -191,6 +188,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,
--
2.13.0
More information about the mesa-dev
mailing list