From a3418105b9169b8f72745c9901db37cd545ac583 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Mon, 26 Feb 2024 12:32:22 +0000 Subject: [PATCH] egl/wayland: Remove EGL_WL_create_wayland_buffer_from_image This extension was originally intended to complement EGL_WL_bind_wayland_display. The idea behind bind_wayland_display was that libEGL.so on the server side could register Wayland extensions for libEGL.so on the client side to use to create buffers, with eglQueryWaylandBufferWL being used to query the buffer properties, and EGL_WAYLAND_BUFFER_WL added as an EGLImage target for texturing. eglCreateWaylandBufferFromImageWL was then to be used for nested compositors to perform passthrough: it would take an EGLImage created by the magical libEGL secret handshake, and make it usable in the parent compositor by doing the same secret handshake again. Since that original idea, we've just standardised dmabuf across the Wayland ecosystem instead. The last known user of this extension was a sample client in the Weston tree, which was broken quite some years ago and never ported to the Meson build system when we moved. Given it won't affect anyone, let's just remove this extension so no-one thinks it would be a good idea to use it. Signed-off-by: Daniel Stone Part-of: --- .../WL_create_wayland_buffer_from_image.spec | 0 src/egl/drivers/dri2/egl_dri2.c | 15 ------- src/egl/drivers/dri2/egl_dri2.h | 4 -- src/egl/drivers/dri2/platform_wayland.c | 45 ------------------- src/egl/main/eglapi.c | 15 +------ src/egl/main/egldisplay.h | 1 - src/egl/main/egldriver.h | 4 -- 7 files changed, 1 insertion(+), 83 deletions(-) rename docs/_static/specs/{ => OLD}/WL_create_wayland_buffer_from_image.spec (100%) diff --git a/docs/_static/specs/WL_create_wayland_buffer_from_image.spec b/docs/_static/specs/OLD/WL_create_wayland_buffer_from_image.spec similarity index 100% rename from docs/_static/specs/WL_create_wayland_buffer_from_image.spec rename to docs/_static/specs/OLD/WL_create_wayland_buffer_from_image.spec diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 286eacad98a..df410f08714 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -2393,20 +2393,6 @@ dri2_query_surface(_EGLDisplay *disp, _EGLSurface *surf, EGLint attribute, return ret; } -static struct wl_buffer * -dri2_create_wayland_buffer_from_image(_EGLDisplay *disp, _EGLImage *img) -{ - struct dri2_egl_display *dri2_dpy = dri2_egl_display_lock(disp); - struct wl_buffer *ret = NULL; - - if (dri2_dpy->vtbl->create_wayland_buffer_from_image) - ret = dri2_dpy->vtbl->create_wayland_buffer_from_image(disp, img); - - mtx_unlock(&dri2_dpy->lock); - - return ret; -} - #ifdef HAVE_LIBDRM static _EGLImage * dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx, @@ -3657,7 +3643,6 @@ const _EGLDriver _eglDriver = { .QueryBufferAge = dri2_query_buffer_age, .CreateImageKHR = dri2_create_image, .DestroyImageKHR = dri2_destroy_image_khr, - .CreateWaylandBufferFromImageWL = dri2_create_wayland_buffer_from_image, .QuerySurface = dri2_query_surface, .QueryDriverName = dri2_query_driver_name, .QueryDriverConfig = dri2_query_driver_config, diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index 8f57720e2db..d7d87c2047e 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -157,10 +157,6 @@ struct dri2_egl_display_vtbl { EGLBoolean (*query_surface)(_EGLDisplay *disp, _EGLSurface *surf, EGLint attribute, EGLint *value); - /* optional */ - struct wl_buffer *(*create_wayland_buffer_from_image)(_EGLDisplay *disp, - _EGLImage *img); - /* optional */ EGLBoolean (*get_sync_values)(_EGLDisplay *display, _EGLSurface *surface, EGLuint64KHR *ust, EGLuint64KHR *msc, diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index 2be7150ebb1..f04aadbc30e 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -260,12 +260,6 @@ server_supports_pipe_format(struct dri2_wl_formats *formats, dri2_wl_visual_idx_from_pipe_format(format)); } -static bool -server_supports_fourcc(struct dri2_wl_formats *formats, uint32_t fourcc) -{ - return server_supports_format(formats, dri2_wl_visual_idx_from_fourcc(fourcc)); -} - static int roundtrip(struct dri2_egl_display *dri2_dpy) { @@ -1609,38 +1603,6 @@ dri2_wl_swap_buffers(_EGLDisplay *disp, _EGLSurface *draw) return dri2_wl_swap_buffers_with_damage(disp, draw, NULL, 0); } -static struct wl_buffer * -dri2_wl_create_wayland_buffer_from_image(_EGLDisplay *disp, _EGLImage *img) -{ - struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); - struct dri2_egl_image *dri2_img = dri2_egl_image(img); - __DRIimage *image = dri2_img->dri_image; - struct wl_buffer *buffer; - int fourcc; - - /* Check the upstream display supports this buffer's format. */ - dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_FOURCC, &fourcc); - if (!server_supports_fourcc(&dri2_dpy->formats, fourcc)) - goto bad_format; - - buffer = create_wl_buffer(dri2_dpy, NULL, image); - - /* The buffer object will have been created with our internal event queue - * because it is using wl_dmabuf/wl_drm as a proxy factory. We want the - * buffer to be used by the application so we'll reset it to the display's - * default event queue. This isn't actually racy, as the only event the - * buffer can get is a buffer release, which doesn't happen with an explicit - * attach. */ - if (buffer) - wl_proxy_set_queue((struct wl_proxy *)buffer, NULL); - - return buffer; - -bad_format: - _eglError(EGL_BAD_MATCH, "unsupported image format"); - return NULL; -} - static int dri2_wl_authenticate(_EGLDisplay *disp, uint32_t id) { @@ -1957,7 +1919,6 @@ static const struct dri2_egl_display_vtbl dri2_wl_display_vtbl = { .swap_buffers = dri2_wl_swap_buffers, .swap_buffers_with_damage = dri2_wl_swap_buffers_with_damage, .query_buffer_age = dri2_wl_query_buffer_age, - .create_wayland_buffer_from_image = dri2_wl_create_wayland_buffer_from_image, .get_dri_drawable = dri2_surface_get_dri_drawable, }; @@ -2178,12 +2139,6 @@ dri2_initialize_wayland_drm(_EGLDisplay *disp) dri2_wl_add_configs_for_visuals(disp); dri2_set_WL_bind_wayland_display(disp); - /* When cannot convert EGLImage to wl_buffer when on a different gpu, - * because the buffer of the EGLImage has likely a tiling mode the server - * gpu won't support. These is no way to check for now. Thus do not support - * the extension */ - if (dri2_dpy->fd_render_gpu == dri2_dpy->fd_display_gpu) - disp->Extensions.WL_create_wayland_buffer_from_image = EGL_TRUE; disp->Extensions.EXT_buffer_age = EGL_TRUE; diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index b96a152d3be..5620436a1af 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -600,7 +600,6 @@ _eglCreateExtensionsString(_EGLDisplay *disp) _EGL_CHECK_EXTENSION(NV_post_sub_buffer); _EGL_CHECK_EXTENSION(WL_bind_wayland_display); - _EGL_CHECK_EXTENSION(WL_create_wayland_buffer_from_image); #undef _EGL_CHECK_EXTENSION } @@ -2376,23 +2375,11 @@ static struct wl_buffer *EGLAPIENTRY eglCreateWaylandBufferFromImageWL(EGLDisplay dpy, EGLImage image) { _EGLDisplay *disp = _eglLockDisplay(dpy); - _EGLImage *img; - struct wl_buffer *ret; _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL); _EGL_CHECK_DISPLAY(disp, NULL); - if (!disp->Extensions.WL_create_wayland_buffer_from_image) - RETURN_EGL_EVAL(disp, NULL); - - img = _eglLookupImage(image, disp); - - if (!img) - RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, NULL); - - ret = disp->Driver->CreateWaylandBufferFromImageWL(disp, img); - - RETURN_EGL_EVAL(disp, ret); + RETURN_EGL_EVAL(disp, NULL); } static EGLBoolean EGLAPIENTRY diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h index 86a0ef521e7..dc3d5a89309 100644 --- a/src/egl/main/egldisplay.h +++ b/src/egl/main/egldisplay.h @@ -152,7 +152,6 @@ struct _egl_extensions { EGLBoolean NV_post_sub_buffer; EGLBoolean WL_bind_wayland_display; - EGLBoolean WL_create_wayland_buffer_from_image; }; struct _egl_display { diff --git a/src/egl/main/egldriver.h b/src/egl/main/egldriver.h index 89ac2473527..1c931206275 100644 --- a/src/egl/main/egldriver.h +++ b/src/egl/main/egldriver.h @@ -163,10 +163,6 @@ struct _egl_driver { struct wl_resource *buffer, EGLint attribute, EGLint *value); - /* for EGL_WL_create_wayland_buffer_from_image */ - struct wl_buffer *(*CreateWaylandBufferFromImageWL)(_EGLDisplay *disp, - _EGLImage *img); - /* for EGL_EXT_swap_buffers_with_damage */ EGLBoolean (*SwapBuffersWithDamageEXT)(_EGLDisplay *disp, _EGLSurface *surface,