From: Jeffrey Knockel Date: Mon, 2 May 2022 01:15:32 +0000 (-0400) Subject: egl: dereference XCB drawable pointers X-Git-Tag: upstream/22.3.5~8518 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d7dc27645efdbc45abd249257b1374078df34b2b;p=platform%2Fupstream%2Fmesa.git 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 Reviewed-by: Eric Engestrom Part-of: --- diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index d0238fe..97f5b6a 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -1031,6 +1031,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; } @@ -1085,6 +1094,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; }