About Social Code
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniels@collabora.com>2025-07-02 14:06:38 +0100
committerMarge Bot <marge-bot@fdo.invalid>2025-07-10 14:51:20 +0000
commit355b96413d63b9be09814961f073ee2d6f8eccc7 (patch)
tree5ee438c842dcfdda8e978cc7e3afd939445da9e9
parentb19086ccfa696692721aff8cf0516088b60ca87b (diff)
egl/wayland: Move bind_wayland_display to legacy build option
Similar to how support for X11's DRI2 protocol was deprecated in 24.2, begin deprecating EGL_WL_bind_wayland_display (including eglBindWaylandDisplayWL et al) by moving it behind a legacy-wayland build option. This extension was originally created in a pre-dmabuf world, where we didn't have a universally-accepted way of exchanging buffers between client and compositor, or even really the ability to describe formats and modifiers universally. Since then, the world has settled on dmabuf with DRM FourCC and modifiers. We've had the zwp_linux_dmabuf_v1 protocol for 10 years now: both clients and compositors implement this protocol to handle buffer sharing. Compositors either use EGL_EXT_image_dma_buf_import or the Vulkan dmabuf extensions to import these into GPU world. Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36026>
-rw-r--r--.gitlab-ci/build/gitlab-ci.yml1
-rw-r--r--docs/relnotes/new_features.txt1
-rw-r--r--meson.build1
-rw-r--r--meson.options10
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c12
-rw-r--r--src/egl/drivers/dri2/egl_dri2.h8
-rw-r--r--src/egl/drivers/dri2/platform_wayland.c58
-rw-r--r--src/egl/generate/gen_egl_dispatch.py6
-rw-r--r--src/egl/main/eglapi.c2
-rw-r--r--src/egl/main/egldriver.h2
-rw-r--r--src/egl/main/eglentrypoint.h8
-rw-r--r--src/egl/main/eglimage.c4
-rw-r--r--src/egl/meson.build23
-rw-r--r--src/gbm/backends/dri/gbm_dri.c4
-rw-r--r--src/gbm/backends/dri/meson.build7
-rw-r--r--src/meson.build2
-rw-r--r--src/vulkan/device-select-layer/device_select_wayland.c23
-rw-r--r--src/vulkan/device-select-layer/meson.build5
18 files changed, 143 insertions, 34 deletions
diff --git a/.gitlab-ci/build/gitlab-ci.yml b/.gitlab-ci/build/gitlab-ci.yml
index a5b3a9e8813..f4007031138 100644
--- a/.gitlab-ci/build/gitlab-ci.yml
+++ b/.gitlab-ci/build/gitlab-ci.yml
@@ -193,6 +193,7 @@ debian-build-x86_64:
-D gallium-vdpau=enabled
-D gallium-va=enabled
-D gallium-rusticl=false
+ -D legacy-wayland=bind-wayland-display
GALLIUM_DRIVERS: "i915,iris,nouveau,r300,r600,freedreno,llvmpipe,softpipe,svga,v3d,vc4,virgl,etnaviv,panfrost,lima,zink,d3d12,asahi,crocus"
VULKAN_DRIVERS: "intel_hasvk,imagination-experimental,microsoft-experimental,nouveau,swrast"
BUILDTYPE: "debugoptimized"
diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt
index f9b76496a08..7fc7306d628 100644
--- a/docs/relnotes/new_features.txt
+++ b/docs/relnotes/new_features.txt
@@ -66,3 +66,4 @@ VK_ARM_shader_core_properties on panvk/v10+
removed X11 DRI2 support
removed EGL_MESA_drm_image
removed pre-dmabuf wl_drm support
+deprecated EGL_WL_bind_wayland_display
diff --git a/meson.build b/meson.build
index d187e18968e..d7407a6d067 100644
--- a/meson.build
+++ b/meson.build
@@ -1977,6 +1977,7 @@ endif
# TODO: symbol mangling
+with_wayland_bind_display = with_platform_wayland and get_option('legacy-wayland').contains('bind-wayland-display')
if with_platform_wayland
dep_wl_scanner = dependency('wayland-scanner', native: true)
prog_wl_scanner = find_program(dep_wl_scanner.get_variable(pkgconfig : 'wayland_scanner'))
diff --git a/meson.options b/meson.options
index 6f2a0a5035a..b1cdb06fcc9 100644
--- a/meson.options
+++ b/meson.options
@@ -778,6 +778,16 @@ option(
)
option(
+ 'legacy-wayland',
+ type : 'array',
+ value : [],
+ description : 'Build legacy Wayland support features.',
+ choices : [
+ 'bind-wayland-display',
+ ],
+)
+
+option(
'legacy-x11',
type : 'array',
value : [],
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index e38e4067a8f..da39ce2ef0f 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -49,8 +49,10 @@
#ifdef HAVE_WAYLAND_PLATFORM
#include "linux-dmabuf-unstable-v1-client-protocol.h"
+#if HAVE_BIND_WL_DISPLAY
#include "wayland-drm-client-protocol.h"
#include "wayland-drm.h"
+#endif
#include <wayland-client.h>
#endif
@@ -1892,7 +1894,7 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay *disp, _EGLContext *ctx,
return dri2_create_image_from_dri(disp, dri_image);
}
-#ifdef HAVE_WAYLAND_PLATFORM
+#ifdef HAVE_BIND_WL_DISPLAY
static _EGLImage *
dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, _EGLContext *ctx,
EGLClientBuffer _buffer,
@@ -2608,7 +2610,7 @@ dri2_create_image_khr(_EGLDisplay *disp, _EGLContext *ctx, EGLenum target,
case EGL_LINUX_DMA_BUF_EXT:
return dri2_create_image_dma_buf(disp, ctx, buffer, attr_list);
#endif
-#ifdef HAVE_WAYLAND_PLATFORM
+#ifdef HAVE_BIND_WL_DISPLAY
case EGL_WAYLAND_BUFFER_WL:
return dri2_create_image_wayland_wl_buffer(disp, ctx, buffer, attr_list);
#endif
@@ -2632,7 +2634,7 @@ dri2_destroy_image_khr(_EGLDisplay *disp, _EGLImage *image)
return EGL_TRUE;
}
-#ifdef HAVE_WAYLAND_PLATFORM
+#ifdef HAVE_BIND_WL_DISPLAY
static void
dri2_wl_reference_buffer(void *user_data, int fd, struct wl_drm_buffer *buffer)
@@ -3147,7 +3149,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,
@@ -3158,10 +3159,11 @@ const _EGLDriver _eglDriver = {
.QueryDmaBufFormatsEXT = dri2_query_dma_buf_formats,
.QueryDmaBufModifiersEXT = dri2_query_dma_buf_modifiers,
#endif
-#ifdef HAVE_WAYLAND_PLATFORM
+#ifdef HAVE_BIND_WL_DISPLAY
.BindWaylandDisplayWL = dri2_bind_wayland_display_wl,
.UnbindWaylandDisplayWL = dri2_unbind_wayland_display_wl,
.QueryWaylandBufferWL = dri2_query_wayland_buffer_wl,
+ .CreateWaylandBufferFromImageWL = dri2_create_wayland_buffer_from_image,
#endif
.GetSyncValuesCHROMIUM = dri2_get_sync_values_chromium,
.GetMscRateANGLE = dri2_get_msc_rate_angle,
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index c1045774853..1682a9c6eb5 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -271,9 +271,13 @@ struct dri2_egl_display {
struct wl_display *wl_dpy;
struct wl_display *wl_dpy_wrapper;
struct wl_registry *wl_registry;
+#ifdef HAVE_BIND_WL_DISPLAY
struct wl_drm *wl_server_drm;
struct wl_drm *wl_drm;
uint32_t wl_drm_version, wl_drm_name;
+ bool authenticated;
+ uint32_t capabilities;
+#endif
struct wl_shm *wl_shm;
struct wl_event_queue *wl_queue;
struct zwp_linux_dmabuf_v1 *wl_dmabuf;
@@ -281,8 +285,6 @@ struct dri2_egl_display {
struct dri2_wl_formats formats;
struct zwp_linux_dmabuf_feedback_v1 *wl_dmabuf_feedback;
struct dmabuf_feedback_format_table format_table;
- bool authenticated;
- uint32_t capabilities;
char *device_name;
bool is_render_node;
clockid_t presentation_clock_id;
@@ -590,7 +592,7 @@ dri2_get_dri_config(struct dri2_egl_config *conf, EGLint surface_type,
static inline void
dri2_set_WL_bind_wayland_display(_EGLDisplay *disp)
{
-#ifdef HAVE_WAYLAND_PLATFORM
+#ifdef HAVE_BIND_WL_DISPLAY
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
disp->Extensions.WL_bind_wayland_display =
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 6937e84d942..ab5bc16b30f 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -57,7 +57,9 @@
#include <loader_wayland_helper.h>
#include "linux-dmabuf-unstable-v1-client-protocol.h"
+#ifdef HAVE_BIND_WL_DISPLAY
#include "wayland-drm-client-protocol.h"
+#endif
#include <wayland-client.h>
#include <wayland-egl-backend.h>
@@ -724,7 +726,11 @@ dri2_wl_create_window_surface(_EGLDisplay *disp, _EGLConfig *conf,
assert(visual_idx != -1);
assert(dri2_wl_visuals[visual_idx].pipe_format != PIPE_FORMAT_NONE);
- if (dri2_dpy->wl_dmabuf || dri2_dpy->wl_drm) {
+ if (dri2_dpy->wl_dmabuf
+#ifdef HAVE_BIND_WL_DISPLAY
+ || dri2_dpy->wl_drm
+#endif
+ ) {
dri2_surf->format = dri2_wl_visuals[visual_idx].wl_drm_format;
} else {
assert(dri2_dpy->wl_shm);
@@ -752,6 +758,7 @@ dri2_wl_create_window_surface(_EGLDisplay *disp, _EGLConfig *conf,
goto cleanup_surf;
}
+#ifdef HAVE_BIND_WL_DISPLAY
if (dri2_dpy->wl_drm) {
dri2_surf->wl_drm_wrapper = wl_proxy_create_wrapper(dri2_dpy->wl_drm);
if (!dri2_surf->wl_drm_wrapper) {
@@ -761,6 +768,7 @@ dri2_wl_create_window_surface(_EGLDisplay *disp, _EGLConfig *conf,
wl_proxy_set_queue((struct wl_proxy *)dri2_surf->wl_drm_wrapper,
dri2_surf->wl_queue);
}
+#endif
dri2_surf->wl_dpy_wrapper = wl_proxy_create_wrapper(dri2_dpy->wl_dpy);
if (!dri2_surf->wl_dpy_wrapper) {
@@ -840,9 +848,11 @@ cleanup_surf_wrapper:
cleanup_dpy_wrapper:
wl_proxy_wrapper_destroy(dri2_surf->wl_dpy_wrapper);
cleanup_drm:
+#ifdef HAVE_BIND_WL_DISPLAY
if (dri2_surf->wl_drm_wrapper)
wl_proxy_wrapper_destroy(dri2_surf->wl_drm_wrapper);
cleanup_queue:
+#endif
wl_event_queue_destroy(dri2_surf->wl_queue);
cleanup_surf:
free(dri2_surf);
@@ -900,8 +910,10 @@ dri2_wl_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
loader_wayland_surface_destroy(&dri2_surf->wayland_surface);
wl_proxy_wrapper_destroy(dri2_surf->wl_dpy_wrapper);
+#ifdef HAVE_BIND_WL_DISPLAY
if (dri2_surf->wl_drm_wrapper)
wl_proxy_wrapper_destroy(dri2_surf->wl_drm_wrapper);
+#endif
if (dri2_surf->wl_dmabuf_feedback) {
zwp_linux_dmabuf_feedback_v1_destroy(dri2_surf->wl_dmabuf_feedback);
dmabuf_feedback_fini(&dri2_surf->dmabuf_feedback);
@@ -1657,7 +1669,9 @@ create_wl_buffer(struct dri2_egl_display *dri2_dpy,
ret = zwp_linux_buffer_params_v1_create_immed(params, width, height,
fourcc, 0);
zwp_linux_buffer_params_v1_destroy(params);
- } else if (dri2_dpy->wl_drm) {
+ }
+#ifdef HAVE_BIND_WL_DISPLAY
+ else if (dri2_dpy->wl_drm) {
struct wl_drm *wl_drm =
dri2_surf ? dri2_surf->wl_drm_wrapper : dri2_dpy->wl_drm;
int fd = -1, stride;
@@ -1684,6 +1698,7 @@ create_wl_buffer(struct dri2_egl_display *dri2_dpy,
stride, 0, 0, 0, 0);
close(fd);
}
+#endif
return ret;
}
@@ -1877,6 +1892,7 @@ dri2_wl_swap_buffers(_EGLDisplay *disp, _EGLSurface *draw)
return dri2_wl_swap_buffers_with_damage(disp, draw, NULL, 0);
}
+#ifdef HAVE_BIND_WL_DISPLAY
static struct wl_buffer *
dri2_wl_create_wayland_buffer_from_image(_EGLDisplay *disp, _EGLImage *img)
{
@@ -2003,6 +2019,7 @@ static const struct wl_drm_listener drm_listener = {
.authenticated = drm_handle_authenticated,
.capabilities = drm_handle_capabilities,
};
+#endif
static void
dmabuf_ignore_format(void *data, struct zwp_linux_dmabuf_v1 *dmabuf,
@@ -2041,6 +2058,7 @@ static const struct zwp_linux_dmabuf_v1_listener dmabuf_listener = {
.modifier = dmabuf_handle_modifier,
};
+#ifdef HAVE_BIND_WL_DISPLAY
static void
wl_drm_bind(struct dri2_egl_display *dri2_dpy)
{
@@ -2049,6 +2067,7 @@ wl_drm_bind(struct dri2_egl_display *dri2_dpy)
&wl_drm_interface, dri2_dpy->wl_drm_version);
wl_drm_add_listener(dri2_dpy->wl_drm, &drm_listener, dri2_dpy);
}
+#endif
static void
default_dmabuf_feedback_format_table(
@@ -2088,7 +2107,9 @@ default_dmabuf_feedback_main_device(
dri2_dpy->device_name = node;
dri2_dpy->fd_render_gpu = fd;
+#ifdef HAVE_BIND_WL_DISPLAY
dri2_dpy->authenticated = true;
+#endif
}
static void
@@ -2192,10 +2213,13 @@ registry_handle_global_drm(void *data, struct wl_registry *registry,
{
struct dri2_egl_display *dri2_dpy = data;
+#ifdef HAVE_BIND_WL_DISPLAY
if (strcmp(interface, wl_drm_interface.name) == 0) {
dri2_dpy->wl_drm_version = MIN2(version, 2);
dri2_dpy->wl_drm_name = name;
- } else if (strcmp(interface, zwp_linux_dmabuf_v1_interface.name) == 0 &&
+ } else
+#endif
+ if (strcmp(interface, zwp_linux_dmabuf_v1_interface.name) == 0 &&
version >= 3) {
dri2_dpy->wl_dmabuf = wl_registry_bind(
registry, name, &zwp_linux_dmabuf_v1_interface,
@@ -2233,7 +2257,10 @@ dri2_wl_setup_swap_interval(_EGLDisplay *disp)
}
static const struct dri2_egl_display_vtbl dri2_wl_display_vtbl = {
+#ifdef HAVE_BIND_WL_DISPLAY
.authenticate = dri2_wl_authenticate,
+ .create_wayland_buffer_from_image = dri2_wl_create_wayland_buffer_from_image,
+#endif
.create_window_surface = dri2_wl_create_window_surface,
.create_pixmap_surface = dri2_wl_create_pixmap_surface,
.destroy_surface = dri2_wl_destroy_surface,
@@ -2242,7 +2269,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,
};
@@ -2334,6 +2360,7 @@ dri2_initialize_wayland_drm_extensions(struct dri2_egl_display *dri2_dpy)
dmabuf_feedback_format_table_fini(&dri2_dpy->format_table);
}
+#ifdef HAVE_BIND_WL_DISPLAY
/* We couldn't retrieve a render node from the dma-buf feedback (or the
* feedback was not advertised at all), so we must fallback to wl_drm. */
if (dri2_dpy->fd_render_gpu == -1) {
@@ -2351,6 +2378,7 @@ dri2_initialize_wayland_drm_extensions(struct dri2_egl_display *dri2_dpy)
(roundtrip(dri2_dpy) < 0 || !dri2_dpy->authenticated))
return false;
}
+#endif
return true;
}
@@ -2436,6 +2464,7 @@ dri2_initialize_wayland_drm(_EGLDisplay *disp)
dri2_wl_setup_swap_interval(disp);
+#ifdef HAVE_BIND_WL_DISPLAY
if (dri2_dpy->wl_drm) {
/* To use Prime, we must have _DRI_IMAGE v7 at least.
* createImageFromDmaBufs support indicates that Prime export/import is
@@ -2448,8 +2477,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
@@ -2457,11 +2484,12 @@ dri2_initialize_wayland_drm(_EGLDisplay *disp)
* the extension */
if (dri2_dpy->fd_render_gpu == dri2_dpy->fd_display_gpu)
disp->Extensions.WL_create_wayland_buffer_from_image = EGL_TRUE;
+#endif
- disp->Extensions.EXT_buffer_age = EGL_TRUE;
+ dri2_wl_add_configs_for_visuals(disp);
+ disp->Extensions.EXT_buffer_age = EGL_TRUE;
disp->Extensions.EXT_swap_buffers_with_damage = EGL_TRUE;
-
disp->Extensions.EXT_present_opaque = EGL_TRUE;
/* Fill vtbl last to prevent accidentally calling virtual function during
@@ -2941,13 +2969,15 @@ registry_handle_global_kopper(void *data, struct wl_registry *registry,
{
struct dri2_egl_display *dri2_dpy = data;
- if (strcmp(interface, wl_shm_interface.name) == 0) {
- dri2_dpy->wl_shm = wl_registry_bind(registry, name, &wl_shm_interface, 1);
- wl_shm_add_listener(dri2_dpy->wl_shm, &shm_listener, dri2_dpy);
- }
+#ifdef HAVE_BIND_WL_DISPLAY
if (strcmp(interface, wl_drm_interface.name) == 0) {
dri2_dpy->wl_drm_version = MIN2(version, 2);
dri2_dpy->wl_drm_name = name;
+ } else
+#endif
+ if (strcmp(interface, wl_shm_interface.name) == 0) {
+ dri2_dpy->wl_shm = wl_registry_bind(registry, name, &wl_shm_interface, 1);
+ wl_shm_add_listener(dri2_dpy->wl_shm, &shm_listener, dri2_dpy);
} else if (strcmp(interface, zwp_linux_dmabuf_v1_interface.name) == 0 &&
version >= 3) {
dri2_dpy->wl_dmabuf = wl_registry_bind(
@@ -3202,9 +3232,11 @@ dri2_initialize_wayland_swrast(_EGLDisplay *disp)
dri2_wl_add_configs_for_visuals(disp);
+#ifdef HAVE_BIND_WL_DISPLAY
if (disp->Options.Zink && dri2_dpy->fd_render_gpu >= 0 &&
(dri2_dpy->wl_dmabuf || dri2_dpy->wl_drm))
dri2_set_WL_bind_wayland_display(disp);
+#endif
disp->Extensions.EXT_buffer_age = EGL_TRUE;
disp->Extensions.EXT_swap_buffers_with_damage = EGL_TRUE;
disp->Extensions.EXT_present_opaque = EGL_TRUE;
@@ -3235,8 +3267,10 @@ dri2_teardown_wayland(struct dri2_egl_display *dri2_dpy)
dri2_wl_formats_fini(&dri2_dpy->formats);
if (dri2_dpy->wp_presentation)
wp_presentation_destroy(dri2_dpy->wp_presentation);
+#ifdef HAVE_BIND_WL_DISPLAY
if (dri2_dpy->wl_drm)
wl_drm_destroy(dri2_dpy->wl_drm);
+#endif
if (dri2_dpy->wl_dmabuf)
zwp_linux_dmabuf_v1_destroy(dri2_dpy->wl_dmabuf);
if (dri2_dpy->wl_shm)
diff --git a/src/egl/generate/gen_egl_dispatch.py b/src/egl/generate/gen_egl_dispatch.py
index 950ef01d8a0..af14ddfe94c 100644
--- a/src/egl/generate/gen_egl_dispatch.py
+++ b/src/egl/generate/gen_egl_dispatch.py
@@ -45,6 +45,8 @@ import genCommon
def main():
parser = argparse.ArgumentParser()
+ parser.add_argument("--bind-wl-display", action="store_true",
+ help="Include EGL_WL_bind_wayland_display")
parser.add_argument("target", choices=("header", "source"),
help="Whether to build the source or header file.")
parser.add_argument("xml_files", nargs="+",
@@ -56,9 +58,11 @@ def main():
xmlByName = dict((f.name, f) for f in xmlFunctions)
functions = []
for (name, eglFunc) in eglFunctionList.EGL_FUNCTIONS:
+ if not args.bind_wl_display and "Wayland" in name:
+ continue
func = xmlByName[name]
eglFunc = fixupEglFunc(func, eglFunc)
- functions.append((func, eglFunc))
+ functions.append((func, eglFunc))
# Sort the function list by name.
functions = sorted(functions, key=lambda f: f[0].name)
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index d687c0cc842..76f6e4cd2df 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -2239,6 +2239,7 @@ eglDupNativeFenceFDANDROID(EGLDisplay dpy, EGLSync sync)
RETURN_EGL_SUCCESS(disp, ret);
}
+#ifdef HAVE_BIND_WL_DISPLAY
struct wl_display;
static EGLBoolean EGLAPIENTRY
@@ -2327,6 +2328,7 @@ eglCreateWaylandBufferFromImageWL(EGLDisplay dpy, EGLImage image)
RETURN_EGL_EVAL(disp, ret);
}
+#endif
static EGLBoolean EGLAPIENTRY
eglGetSyncValuesCHROMIUM(EGLDisplay dpy, EGLSurface surface, EGLuint64KHR *ust,
diff --git a/src/egl/main/egldriver.h b/src/egl/main/egldriver.h
index 32c7cc29372..0cdeb90fac4 100644
--- a/src/egl/main/egldriver.h
+++ b/src/egl/main/egldriver.h
@@ -158,6 +158,7 @@ struct _egl_driver {
/* for EGL_ANDROID_native_fence_sync */
EGLint (*DupNativeFenceFDANDROID)(_EGLDisplay *disp, _EGLSync *sync);
+#ifdef HAVE_BIND_WL_DISPLAY
/* for EGL_WL_bind_wayland_display */
EGLBoolean (*BindWaylandDisplayWL)(_EGLDisplay *disp,
struct wl_display *display);
@@ -170,6 +171,7 @@ struct _egl_driver {
/* for EGL_WL_create_wayland_buffer_from_image */
struct wl_buffer *(*CreateWaylandBufferFromImageWL)(_EGLDisplay *disp,
_EGLImage *img);
+#endif
/* for EGL_EXT_swap_buffers_with_damage */
EGLBoolean (*SwapBuffersWithDamageEXT)(_EGLDisplay *disp,
diff --git a/src/egl/main/eglentrypoint.h b/src/egl/main/eglentrypoint.h
index 52efc370308..a6def87dead 100644
--- a/src/egl/main/eglentrypoint.h
+++ b/src/egl/main/eglentrypoint.h
@@ -5,7 +5,9 @@
/* alphabetical order */
EGL_ENTRYPOINT(eglBindAPI)
EGL_ENTRYPOINT(eglBindTexImage)
+#ifdef HAVE_BIND_WL_DISPLAY
EGL_ENTRYPOINT(eglBindWaylandDisplayWL)
+#endif
EGL_ENTRYPOINT(eglChooseConfig)
EGL_ENTRYPOINT(eglClientWaitSync)
EGL_ENTRYPOINT(eglClientWaitSyncKHR)
@@ -23,7 +25,9 @@ EGL_ENTRYPOINT(eglCreatePlatformWindowSurfaceEXT)
EGL_ENTRYPOINT(eglCreateSync)
EGL_ENTRYPOINT(eglCreateSync64KHR)
EGL_ENTRYPOINT(eglCreateSyncKHR)
+#ifdef HAVE_BIND_WL_DISPLAY
EGL_ENTRYPOINT(eglCreateWaylandBufferFromImageWL)
+#endif
EGL_ENTRYPOINT(eglCreateWindowSurface)
EGL_ENTRYPOINT(eglDebugMessageControlKHR)
EGL_ENTRYPOINT(eglDestroyContext)
@@ -70,7 +74,9 @@ EGL_ENTRYPOINT(eglQueryDmaBufModifiersEXT)
EGL_ENTRYPOINT(eglQueryString)
EGL_ENTRYPOINT(eglQuerySupportedCompressionRatesEXT)
EGL_ENTRYPOINT(eglQuerySurface)
+#ifdef HAVE_BIND_WL_DISPLAY
EGL_ENTRYPOINT(eglQueryWaylandBufferWL)
+#endif
EGL_ENTRYPOINT(eglReleaseTexImage)
EGL_ENTRYPOINT(eglReleaseThread)
EGL_ENTRYPOINT(eglSetBlobCacheFuncsANDROID)
@@ -82,7 +88,9 @@ EGL_ENTRYPOINT(eglSwapBuffersWithDamageEXT)
EGL_ENTRYPOINT(eglSwapBuffersWithDamageKHR)
EGL_ENTRYPOINT(eglSwapInterval)
EGL_ENTRYPOINT(eglTerminate)
+#ifdef HAVE_BIND_WL_DISPLAY
EGL_ENTRYPOINT(eglUnbindWaylandDisplayWL)
+#endif
EGL_ENTRYPOINT(eglWaitClient)
EGL_ENTRYPOINT(eglWaitGL)
EGL_ENTRYPOINT(eglWaitNative)
diff --git a/src/egl/main/eglimage.c b/src/egl/main/eglimage.c
index 27ec3b755ae..4ff1f96478f 100644
--- a/src/egl/main/eglimage.c
+++ b/src/egl/main/eglimage.c
@@ -71,6 +71,7 @@ _eglParseKHRImageAttribs(_EGLImageAttribs *attrs, _EGLDisplay *disp,
return EGL_SUCCESS;
}
+#ifdef HAVE_BIND_WL_DISPLAY
static EGLint
_eglParseWLBindWaylandDisplayAttribs(_EGLImageAttribs *attrs, _EGLDisplay *disp,
EGLint attr, EGLint val)
@@ -88,6 +89,7 @@ _eglParseWLBindWaylandDisplayAttribs(_EGLImageAttribs *attrs, _EGLDisplay *disp,
return EGL_SUCCESS;
}
+#endif
static EGLint
_eglParseEXTImageDmaBufImportAttribs(_EGLImageAttribs *attrs, _EGLDisplay *disp,
@@ -266,9 +268,11 @@ _eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *disp,
if (err == EGL_SUCCESS)
continue;
+#ifdef HAVE_BIND_WL_DISPLAY
err = _eglParseWLBindWaylandDisplayAttribs(attrs, disp, attr, val);
if (err == EGL_SUCCESS)
continue;
+#endif
err = _eglParseEXTImageDmaBufImportAttribs(attrs, disp, attr, val);
if (err == EGL_SUCCESS)
diff --git a/src/egl/meson.build b/src/egl/meson.build
index b49c5ece3a0..746e935c3f4 100644
--- a/src/egl/meson.build
+++ b/src/egl/meson.build
@@ -49,6 +49,13 @@ files_egl = files(
'main/egltypedefs.h',
)
+# Remove the argument parsing from gen_egl_dispatch.py when removing this
+# option
+gen_args = []
+if with_wayland_bind_display
+ gen_args += [ '--bind-wl-display' ]
+endif
+
g_egldispatchstubs_c = custom_target(
'g_egldispatchstubs.c',
input : [
@@ -57,7 +64,7 @@ g_egldispatchstubs_c = custom_target(
],
output : 'g_egldispatchstubs.c',
command : [
- prog_python, '@INPUT0@', 'source', '@INPUT1@', '@INPUT2@',
+ prog_python, '@INPUT0@', gen_args, 'source', '@INPUT1@', '@INPUT2@'
],
depend_files : [ 'generate/eglFunctionList.py', glapi_xml_py_deps],
capture : true,
@@ -71,7 +78,7 @@ g_egldispatchstubs_h = custom_target(
],
output : 'g_egldispatchstubs.h',
command : [
- prog_python, '@INPUT0@', 'header', '@INPUT1@', '@INPUT2@',
+ prog_python, '@INPUT0@', gen_args, 'header', '@INPUT1@', '@INPUT2@'
],
depend_files : [ 'generate/eglFunctionList.py', glapi_xml_py_deps],
capture : true,
@@ -113,11 +120,17 @@ if with_dri
endif
if with_platform_wayland
deps_for_egl += [dep_wayland_client, dep_wayland_server, dep_wayland_egl_headers]
- link_for_egl += [libwayland_drm, libloader_wayland_helper]
+ link_for_egl += libloader_wayland_helper
files_egl += files('drivers/dri2/platform_wayland.c')
files_egl += wp_files['linux-dmabuf-unstable-v1']
- files_egl += [wayland_drm_client_protocol_h]
- incs_for_egl += include_directories('wayland/wayland-drm')
+ if with_wayland_bind_display
+ files_egl += [wayland_drm_client_protocol_h]
+ link_for_egl += [libwayland_drm]
+ incs_for_egl += include_directories('wayland/wayland-drm')
+ c_args_for_egl += [
+ '-DHAVE_BIND_WL_DISPLAY'
+ ]
+ endif
endif
if with_platform_android
deps_for_egl += [dep_android, idep_u_gralloc]
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 3887d81be9d..5c19f166abc 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -56,7 +56,7 @@
#include "gbm_backend_abi.h"
/* For importing wl_buffer */
-#if HAVE_WAYLAND_PLATFORM
+#if HAVE_BIND_WL_DISPLAY
#include "wayland-drm.h"
#endif
@@ -659,7 +659,7 @@ gbm_dri_bo_import(struct gbm_device *gbm,
}
switch (type) {
-#if HAVE_WAYLAND_PLATFORM
+#if HAVE_BIND_WL_DISPLAY
case GBM_BO_IMPORT_WL_BUFFER:
{
struct wl_drm_buffer *wb;
diff --git a/src/gbm/backends/dri/meson.build b/src/gbm/backends/dri/meson.build
index 84a40656980..5c33a3a907e 100644
--- a/src/gbm/backends/dri/meson.build
+++ b/src/gbm/backends/dri/meson.build
@@ -1,17 +1,22 @@
deps_gbm_dri = []
+flags_gbm_dri = []
# TODO: fix includes to delete this
incs_gbm_dri = [inc_mesa]
if with_platform_wayland
deps_gbm_dri += dep_wayland_server
- incs_gbm_dri += inc_wayland_drm
+ if with_wayland_bind_display
+ flags_gbm_dri += ['-DHAVE_BIND_WL_DISPLAY']
+ incs_gbm_dri += inc_wayland_drm
+ endif
endif
shared_library(
'dri_gbm',
files('gbm_dri.c', 'gbm_driint.h'),
include_directories : [inc_gallium, incs_gbm_dri, inc_loader, inc_st_dri, inc_gallium_aux],
+ c_args : [flags_gbm_dri],
link_args : [ld_args_gc_sections],
link_with : [libloader, libgallium_dri],
dependencies : [deps_gbm_dri, dep_dl, dep_gbm, dep_libdrm, idep_mesautil, idep_xmlconfig],
diff --git a/src/meson.build b/src/meson.build
index 31a10f7d41f..e4cbcc89fc0 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -61,7 +61,7 @@ endif
if with_imgui
subdir('imgui')
endif
-if with_platform_wayland
+if with_wayland_bind_display
subdir('egl/wayland/wayland-drm')
endif
if with_any_vk or with_gallium_zink
diff --git a/src/vulkan/device-select-layer/device_select_wayland.c b/src/vulkan/device-select-layer/device_select_wayland.c
index 6bfcbaccf41..5826803473f 100644
--- a/src/vulkan/device-select-layer/device_select_wayland.c
+++ b/src/vulkan/device-select-layer/device_select_wayland.c
@@ -22,7 +22,9 @@
*/
#include "util/macros.h"
#include <wayland-client.h>
+#ifdef HAVE_BIND_WL_DISPLAY
#include "wayland-drm-client-protocol.h"
+#endif
#include "linux-dmabuf-unstable-v1-client-protocol.h"
#include "device_select.h"
#include <string.h>
@@ -32,14 +34,17 @@
#include <xf86drm.h>
struct device_select_wayland_info {
+#ifdef HAVE_BIND_WL_DISPLAY
struct wl_drm *wl_drm;
drmDevicePtr drm_dev_info;
+#endif
struct zwp_linux_dmabuf_v1 *wl_dmabuf;
struct zwp_linux_dmabuf_feedback_v1 *wl_dmabuf_feedback;
drmDevicePtr dmabuf_dev_info;
};
+#ifdef HAVE_BIND_WL_DISPLAY
static void
device_select_drm_handle_device(void *data, struct wl_drm *drm, const char *device)
{
@@ -79,6 +84,7 @@ static const struct wl_drm_listener ds_drm_listener = {
.authenticated = device_select_drm_handle_authenticated,
.capabilities = device_select_drm_handle_capabilities
};
+#endif
static void
default_dmabuf_feedback_format_table(void *data,
@@ -159,10 +165,13 @@ device_select_registry_global(void *data, struct wl_registry *registry, uint32_t
const char *interface, uint32_t version)
{
struct device_select_wayland_info *info = data;
+#if HAVE_BIND_WL_DISPLAY
if (strcmp(interface, wl_drm_interface.name) == 0) {
info->wl_drm = wl_registry_bind(registry, name, &wl_drm_interface, MIN2(version, 2));
wl_drm_add_listener(info->wl_drm, &ds_drm_listener, data);
- } else if (strcmp(interface, zwp_linux_dmabuf_v1_interface.name) == 0 &&
+ } else
+#endif
+ if (strcmp(interface, zwp_linux_dmabuf_v1_interface.name) == 0 &&
version >= ZWP_LINUX_DMABUF_V1_GET_DEFAULT_FEEDBACK_SINCE_VERSION) {
info->wl_dmabuf =
wl_registry_bind(registry, name, &zwp_linux_dmabuf_v1_interface,
@@ -208,9 +217,13 @@ int device_select_find_wayland_pci_default(struct device_pci_info *devices, uint
drmDevicePtr target;
if (info.dmabuf_dev_info != NULL) {
target = info.dmabuf_dev_info;
- } else if (info.drm_dev_info != NULL) {
+ }
+#ifdef HAVE_BIND_WL_DISPLAY
+ if (target == NULL && info.drm_dev_info != NULL) {
target = info.drm_dev_info;
- } else {
+ }
+#endif
+ if (target != NULL) {
goto done;
}
@@ -235,15 +248,19 @@ int device_select_find_wayland_pci_default(struct device_pci_info *devices, uint
done:
if (info.dmabuf_dev_info != NULL)
drmFreeDevice(&info.dmabuf_dev_info);
+#ifdef HAVE_BIND_WL_DISPLAY
if (info.drm_dev_info != NULL)
drmFreeDevice(&info.drm_dev_info);
+#endif
if (info.wl_dmabuf_feedback)
zwp_linux_dmabuf_feedback_v1_destroy(info.wl_dmabuf_feedback);
if (info.wl_dmabuf)
zwp_linux_dmabuf_v1_destroy(info.wl_dmabuf);
+#ifdef HAVE_BIND_WL_DISPLAY
if (info.wl_drm)
wl_drm_destroy(info.wl_drm);
+#endif
wl_registry_destroy(registry);
wl_display_disconnect(display);
diff --git a/src/vulkan/device-select-layer/meson.build b/src/vulkan/device-select-layer/meson.build
index bdf9de592c6..c7aaa20495b 100644
--- a/src/vulkan/device-select-layer/meson.build
+++ b/src/vulkan/device-select-layer/meson.build
@@ -15,7 +15,10 @@ endif
if with_platform_wayland
vklayer_files += files('device_select_wayland.c')
- vklayer_files += [ wayland_drm_client_protocol_h, wayland_drm_protocol_c ]
+ if with_wayland_bind_display
+ vklayer_files += [ wayland_drm_client_protocol_h, wayland_drm_protocol_c ]
+ vklayer_flags += [ '-DHAVE_BIND_WL_DISPLAY' ]
+ endif
vklayer_files += wp_files['linux-dmabuf-unstable-v1']
vklayer_deps += dep_wayland_client
endif