egl/dri2: Rework get_wl_surface_proxy()

Instead, just make it a helper for getting the wl_surface from the
wl_egl_window.  We'll want this in the next commit.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33860>
This commit is contained in:
Faith Ekstrand 2025-03-03 17:48:31 -06:00 committed by Marge Bot
parent 71d949a8c5
commit fddff0d1b8

View file

@ -448,16 +448,16 @@ destroy_window_callback(void *data)
}
static struct wl_surface *
get_wl_surface_proxy(struct wl_egl_window *window)
get_wl_surface(struct wl_egl_window *window)
{
/* Version 3 of wl_egl_window introduced a version field at the same
* location where a pointer to wl_surface was stored. Thus, if
* window->version is dereferenceable, we've been given an older version of
* wl_egl_window, and window->version points to wl_surface */
if (_eglPointerIsDereferenceable((void *)(window->version))) {
return wl_proxy_create_wrapper((void *)(window->version));
return (void *)(window->version);
}
return wl_proxy_create_wrapper(window->surface);
return window->surface;
}
static void
@ -750,7 +750,8 @@ dri2_wl_create_window_surface(_EGLDisplay *disp, _EGLConfig *conf,
wl_proxy_set_queue((struct wl_proxy *)dri2_surf->wl_dpy_wrapper,
dri2_surf->wl_queue);
dri2_surf->wl_surface_wrapper = get_wl_surface_proxy(window);
dri2_surf->wl_surface_wrapper =
wl_proxy_create_wrapper(get_wl_surface(window));
if (!dri2_surf->wl_surface_wrapper) {
_eglError(EGL_BAD_ALLOC, "dri2_create_surface");
goto cleanup_dpy_wrapper;