egl: dereference XCB drawable pointers

eglCreatePlatformWindowSurface[EXT] and
eglCreatePlatformPixmapSurface[EXT] should be passed (xcb_window_t *)
and (xcb_pixmap_t *), so we must dereference these types before using
them as drawables.  We already do something similar with X11 drawable
pointers.

Signed-off-by: Jeffrey Knockel <jeff@jeffreyknockel.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16269>
This commit is contained in:
Jeffrey Knockel
2022-05-01 21:15:32 -04:00
committed by Marge Bot
parent cd8c083ab5
commit d7dc27645e

View File

@@ -1030,6 +1030,15 @@ _fixupNativeWindow(_EGLDisplay *disp, void *native_window)
*/
return (void *)(* (Window*) native_window);
}
#endif
#ifdef HAVE_XCB_PLATFORM
if (disp && disp->Platform == _EGL_PLATFORM_XCB && native_window != NULL) {
/* Similar to with X11, we need to convert (xcb_window_t *)
* (i.e., uint32_t *) to xcb_window_t. We have to do an intermediate cast
* to uintptr_t, since uint32_t may be smaller than a pointer.
*/
return (void *)(uintptr_t) (* (uint32_t*) native_window);
}
#endif
return native_window;
}
@@ -1084,6 +1093,15 @@ _fixupNativePixmap(_EGLDisplay *disp, void *native_pixmap)
*/
if (disp && disp->Platform == _EGL_PLATFORM_X11 && native_pixmap != NULL)
return (void *)(* (Pixmap*) native_pixmap);
#endif
#ifdef HAVE_XCB_PLATFORM
if (disp && disp->Platform == _EGL_PLATFORM_XCB && native_pixmap != NULL) {
/* Similar to with X11, we need to convert (xcb_pixmap_t *)
* (i.e., uint32_t *) to xcb_pixmap_t. We have to do an intermediate cast
* to uintptr_t, since uint32_t may be smaller than a pointer.
*/
return (void *)(uintptr_t) (* (uint32_t*) native_pixmap);
}
#endif
return native_pixmap;
}