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>
This commit is contained in:
Daniel Stone 2025-07-02 14:06:38 +01:00 committed by Marge Bot
parent b19086ccfa
commit 355b96413d
18 changed files with 143 additions and 34 deletions

View file

@ -193,6 +193,7 @@ debian-build-x86_64:
-D gallium-vdpau=enabled -D gallium-vdpau=enabled
-D gallium-va=enabled -D gallium-va=enabled
-D gallium-rusticl=false -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" 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" VULKAN_DRIVERS: "intel_hasvk,imagination-experimental,microsoft-experimental,nouveau,swrast"
BUILDTYPE: "debugoptimized" BUILDTYPE: "debugoptimized"

View file

@ -66,3 +66,4 @@ VK_ARM_shader_core_properties on panvk/v10+
removed X11 DRI2 support removed X11 DRI2 support
removed EGL_MESA_drm_image removed EGL_MESA_drm_image
removed pre-dmabuf wl_drm support removed pre-dmabuf wl_drm support
deprecated EGL_WL_bind_wayland_display

View file

@ -1977,6 +1977,7 @@ endif
# TODO: symbol mangling # TODO: symbol mangling
with_wayland_bind_display = with_platform_wayland and get_option('legacy-wayland').contains('bind-wayland-display')
if with_platform_wayland if with_platform_wayland
dep_wl_scanner = dependency('wayland-scanner', native: true) dep_wl_scanner = dependency('wayland-scanner', native: true)
prog_wl_scanner = find_program(dep_wl_scanner.get_variable(pkgconfig : 'wayland_scanner')) prog_wl_scanner = find_program(dep_wl_scanner.get_variable(pkgconfig : 'wayland_scanner'))

View file

@ -777,6 +777,16 @@ option(
'Requires expat.' 'Requires expat.'
) )
option(
'legacy-wayland',
type : 'array',
value : [],
description : 'Build legacy Wayland support features.',
choices : [
'bind-wayland-display',
],
)
option( option(
'legacy-x11', 'legacy-x11',
type : 'array', type : 'array',

View file

@ -49,8 +49,10 @@
#ifdef HAVE_WAYLAND_PLATFORM #ifdef HAVE_WAYLAND_PLATFORM
#include "linux-dmabuf-unstable-v1-client-protocol.h" #include "linux-dmabuf-unstable-v1-client-protocol.h"
#if HAVE_BIND_WL_DISPLAY
#include "wayland-drm-client-protocol.h" #include "wayland-drm-client-protocol.h"
#include "wayland-drm.h" #include "wayland-drm.h"
#endif
#include <wayland-client.h> #include <wayland-client.h>
#endif #endif
@ -1892,7 +1894,7 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay *disp, _EGLContext *ctx,
return dri2_create_image_from_dri(disp, dri_image); return dri2_create_image_from_dri(disp, dri_image);
} }
#ifdef HAVE_WAYLAND_PLATFORM #ifdef HAVE_BIND_WL_DISPLAY
static _EGLImage * static _EGLImage *
dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, _EGLContext *ctx, dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, _EGLContext *ctx,
EGLClientBuffer _buffer, EGLClientBuffer _buffer,
@ -2608,7 +2610,7 @@ dri2_create_image_khr(_EGLDisplay *disp, _EGLContext *ctx, EGLenum target,
case EGL_LINUX_DMA_BUF_EXT: case EGL_LINUX_DMA_BUF_EXT:
return dri2_create_image_dma_buf(disp, ctx, buffer, attr_list); return dri2_create_image_dma_buf(disp, ctx, buffer, attr_list);
#endif #endif
#ifdef HAVE_WAYLAND_PLATFORM #ifdef HAVE_BIND_WL_DISPLAY
case EGL_WAYLAND_BUFFER_WL: case EGL_WAYLAND_BUFFER_WL:
return dri2_create_image_wayland_wl_buffer(disp, ctx, buffer, attr_list); return dri2_create_image_wayland_wl_buffer(disp, ctx, buffer, attr_list);
#endif #endif
@ -2632,7 +2634,7 @@ dri2_destroy_image_khr(_EGLDisplay *disp, _EGLImage *image)
return EGL_TRUE; return EGL_TRUE;
} }
#ifdef HAVE_WAYLAND_PLATFORM #ifdef HAVE_BIND_WL_DISPLAY
static void static void
dri2_wl_reference_buffer(void *user_data, int fd, struct wl_drm_buffer *buffer) 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, .QueryBufferAge = dri2_query_buffer_age,
.CreateImageKHR = dri2_create_image, .CreateImageKHR = dri2_create_image,
.DestroyImageKHR = dri2_destroy_image_khr, .DestroyImageKHR = dri2_destroy_image_khr,
.CreateWaylandBufferFromImageWL = dri2_create_wayland_buffer_from_image,
.QuerySurface = dri2_query_surface, .QuerySurface = dri2_query_surface,
.QueryDriverName = dri2_query_driver_name, .QueryDriverName = dri2_query_driver_name,
.QueryDriverConfig = dri2_query_driver_config, .QueryDriverConfig = dri2_query_driver_config,
@ -3158,10 +3159,11 @@ const _EGLDriver _eglDriver = {
.QueryDmaBufFormatsEXT = dri2_query_dma_buf_formats, .QueryDmaBufFormatsEXT = dri2_query_dma_buf_formats,
.QueryDmaBufModifiersEXT = dri2_query_dma_buf_modifiers, .QueryDmaBufModifiersEXT = dri2_query_dma_buf_modifiers,
#endif #endif
#ifdef HAVE_WAYLAND_PLATFORM #ifdef HAVE_BIND_WL_DISPLAY
.BindWaylandDisplayWL = dri2_bind_wayland_display_wl, .BindWaylandDisplayWL = dri2_bind_wayland_display_wl,
.UnbindWaylandDisplayWL = dri2_unbind_wayland_display_wl, .UnbindWaylandDisplayWL = dri2_unbind_wayland_display_wl,
.QueryWaylandBufferWL = dri2_query_wayland_buffer_wl, .QueryWaylandBufferWL = dri2_query_wayland_buffer_wl,
.CreateWaylandBufferFromImageWL = dri2_create_wayland_buffer_from_image,
#endif #endif
.GetSyncValuesCHROMIUM = dri2_get_sync_values_chromium, .GetSyncValuesCHROMIUM = dri2_get_sync_values_chromium,
.GetMscRateANGLE = dri2_get_msc_rate_angle, .GetMscRateANGLE = dri2_get_msc_rate_angle,

View file

@ -271,9 +271,13 @@ struct dri2_egl_display {
struct wl_display *wl_dpy; struct wl_display *wl_dpy;
struct wl_display *wl_dpy_wrapper; struct wl_display *wl_dpy_wrapper;
struct wl_registry *wl_registry; struct wl_registry *wl_registry;
#ifdef HAVE_BIND_WL_DISPLAY
struct wl_drm *wl_server_drm; struct wl_drm *wl_server_drm;
struct wl_drm *wl_drm; struct wl_drm *wl_drm;
uint32_t wl_drm_version, wl_drm_name; uint32_t wl_drm_version, wl_drm_name;
bool authenticated;
uint32_t capabilities;
#endif
struct wl_shm *wl_shm; struct wl_shm *wl_shm;
struct wl_event_queue *wl_queue; struct wl_event_queue *wl_queue;
struct zwp_linux_dmabuf_v1 *wl_dmabuf; struct zwp_linux_dmabuf_v1 *wl_dmabuf;
@ -281,8 +285,6 @@ struct dri2_egl_display {
struct dri2_wl_formats formats; struct dri2_wl_formats formats;
struct zwp_linux_dmabuf_feedback_v1 *wl_dmabuf_feedback; struct zwp_linux_dmabuf_feedback_v1 *wl_dmabuf_feedback;
struct dmabuf_feedback_format_table format_table; struct dmabuf_feedback_format_table format_table;
bool authenticated;
uint32_t capabilities;
char *device_name; char *device_name;
bool is_render_node; bool is_render_node;
clockid_t presentation_clock_id; clockid_t presentation_clock_id;
@ -590,7 +592,7 @@ dri2_get_dri_config(struct dri2_egl_config *conf, EGLint surface_type,
static inline void static inline void
dri2_set_WL_bind_wayland_display(_EGLDisplay *disp) 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); struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
disp->Extensions.WL_bind_wayland_display = disp->Extensions.WL_bind_wayland_display =

View file

@ -57,7 +57,9 @@
#include <loader_wayland_helper.h> #include <loader_wayland_helper.h>
#include "linux-dmabuf-unstable-v1-client-protocol.h" #include "linux-dmabuf-unstable-v1-client-protocol.h"
#ifdef HAVE_BIND_WL_DISPLAY
#include "wayland-drm-client-protocol.h" #include "wayland-drm-client-protocol.h"
#endif
#include <wayland-client.h> #include <wayland-client.h>
#include <wayland-egl-backend.h> #include <wayland-egl-backend.h>
@ -724,7 +726,11 @@ dri2_wl_create_window_surface(_EGLDisplay *disp, _EGLConfig *conf,
assert(visual_idx != -1); assert(visual_idx != -1);
assert(dri2_wl_visuals[visual_idx].pipe_format != PIPE_FORMAT_NONE); 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; dri2_surf->format = dri2_wl_visuals[visual_idx].wl_drm_format;
} else { } else {
assert(dri2_dpy->wl_shm); assert(dri2_dpy->wl_shm);
@ -752,6 +758,7 @@ dri2_wl_create_window_surface(_EGLDisplay *disp, _EGLConfig *conf,
goto cleanup_surf; goto cleanup_surf;
} }
#ifdef HAVE_BIND_WL_DISPLAY
if (dri2_dpy->wl_drm) { if (dri2_dpy->wl_drm) {
dri2_surf->wl_drm_wrapper = wl_proxy_create_wrapper(dri2_dpy->wl_drm); dri2_surf->wl_drm_wrapper = wl_proxy_create_wrapper(dri2_dpy->wl_drm);
if (!dri2_surf->wl_drm_wrapper) { 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, wl_proxy_set_queue((struct wl_proxy *)dri2_surf->wl_drm_wrapper,
dri2_surf->wl_queue); dri2_surf->wl_queue);
} }
#endif
dri2_surf->wl_dpy_wrapper = wl_proxy_create_wrapper(dri2_dpy->wl_dpy); dri2_surf->wl_dpy_wrapper = wl_proxy_create_wrapper(dri2_dpy->wl_dpy);
if (!dri2_surf->wl_dpy_wrapper) { if (!dri2_surf->wl_dpy_wrapper) {
@ -840,9 +848,11 @@ cleanup_surf_wrapper:
cleanup_dpy_wrapper: cleanup_dpy_wrapper:
wl_proxy_wrapper_destroy(dri2_surf->wl_dpy_wrapper); wl_proxy_wrapper_destroy(dri2_surf->wl_dpy_wrapper);
cleanup_drm: cleanup_drm:
#ifdef HAVE_BIND_WL_DISPLAY
if (dri2_surf->wl_drm_wrapper) if (dri2_surf->wl_drm_wrapper)
wl_proxy_wrapper_destroy(dri2_surf->wl_drm_wrapper); wl_proxy_wrapper_destroy(dri2_surf->wl_drm_wrapper);
cleanup_queue: cleanup_queue:
#endif
wl_event_queue_destroy(dri2_surf->wl_queue); wl_event_queue_destroy(dri2_surf->wl_queue);
cleanup_surf: cleanup_surf:
free(dri2_surf); free(dri2_surf);
@ -900,8 +910,10 @@ dri2_wl_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
loader_wayland_surface_destroy(&dri2_surf->wayland_surface); loader_wayland_surface_destroy(&dri2_surf->wayland_surface);
wl_proxy_wrapper_destroy(dri2_surf->wl_dpy_wrapper); wl_proxy_wrapper_destroy(dri2_surf->wl_dpy_wrapper);
#ifdef HAVE_BIND_WL_DISPLAY
if (dri2_surf->wl_drm_wrapper) if (dri2_surf->wl_drm_wrapper)
wl_proxy_wrapper_destroy(dri2_surf->wl_drm_wrapper); wl_proxy_wrapper_destroy(dri2_surf->wl_drm_wrapper);
#endif
if (dri2_surf->wl_dmabuf_feedback) { if (dri2_surf->wl_dmabuf_feedback) {
zwp_linux_dmabuf_feedback_v1_destroy(dri2_surf->wl_dmabuf_feedback); zwp_linux_dmabuf_feedback_v1_destroy(dri2_surf->wl_dmabuf_feedback);
dmabuf_feedback_fini(&dri2_surf->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, ret = zwp_linux_buffer_params_v1_create_immed(params, width, height,
fourcc, 0); fourcc, 0);
zwp_linux_buffer_params_v1_destroy(params); 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 = struct wl_drm *wl_drm =
dri2_surf ? dri2_surf->wl_drm_wrapper : dri2_dpy->wl_drm; dri2_surf ? dri2_surf->wl_drm_wrapper : dri2_dpy->wl_drm;
int fd = -1, stride; int fd = -1, stride;
@ -1684,6 +1698,7 @@ create_wl_buffer(struct dri2_egl_display *dri2_dpy,
stride, 0, 0, 0, 0); stride, 0, 0, 0, 0);
close(fd); close(fd);
} }
#endif
return ret; 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); return dri2_wl_swap_buffers_with_damage(disp, draw, NULL, 0);
} }
#ifdef HAVE_BIND_WL_DISPLAY
static struct wl_buffer * static struct wl_buffer *
dri2_wl_create_wayland_buffer_from_image(_EGLDisplay *disp, _EGLImage *img) 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, .authenticated = drm_handle_authenticated,
.capabilities = drm_handle_capabilities, .capabilities = drm_handle_capabilities,
}; };
#endif
static void static void
dmabuf_ignore_format(void *data, struct zwp_linux_dmabuf_v1 *dmabuf, 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, .modifier = dmabuf_handle_modifier,
}; };
#ifdef HAVE_BIND_WL_DISPLAY
static void static void
wl_drm_bind(struct dri2_egl_display *dri2_dpy) 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_interface, dri2_dpy->wl_drm_version);
wl_drm_add_listener(dri2_dpy->wl_drm, &drm_listener, dri2_dpy); wl_drm_add_listener(dri2_dpy->wl_drm, &drm_listener, dri2_dpy);
} }
#endif
static void static void
default_dmabuf_feedback_format_table( default_dmabuf_feedback_format_table(
@ -2088,7 +2107,9 @@ default_dmabuf_feedback_main_device(
dri2_dpy->device_name = node; dri2_dpy->device_name = node;
dri2_dpy->fd_render_gpu = fd; dri2_dpy->fd_render_gpu = fd;
#ifdef HAVE_BIND_WL_DISPLAY
dri2_dpy->authenticated = true; dri2_dpy->authenticated = true;
#endif
} }
static void static void
@ -2192,10 +2213,13 @@ registry_handle_global_drm(void *data, struct wl_registry *registry,
{ {
struct dri2_egl_display *dri2_dpy = data; struct dri2_egl_display *dri2_dpy = data;
#ifdef HAVE_BIND_WL_DISPLAY
if (strcmp(interface, wl_drm_interface.name) == 0) { if (strcmp(interface, wl_drm_interface.name) == 0) {
dri2_dpy->wl_drm_version = MIN2(version, 2); dri2_dpy->wl_drm_version = MIN2(version, 2);
dri2_dpy->wl_drm_name = name; 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) { version >= 3) {
dri2_dpy->wl_dmabuf = wl_registry_bind( dri2_dpy->wl_dmabuf = wl_registry_bind(
registry, name, &zwp_linux_dmabuf_v1_interface, 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 = { static const struct dri2_egl_display_vtbl dri2_wl_display_vtbl = {
#ifdef HAVE_BIND_WL_DISPLAY
.authenticate = dri2_wl_authenticate, .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_window_surface = dri2_wl_create_window_surface,
.create_pixmap_surface = dri2_wl_create_pixmap_surface, .create_pixmap_surface = dri2_wl_create_pixmap_surface,
.destroy_surface = dri2_wl_destroy_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 = dri2_wl_swap_buffers,
.swap_buffers_with_damage = dri2_wl_swap_buffers_with_damage, .swap_buffers_with_damage = dri2_wl_swap_buffers_with_damage,
.query_buffer_age = dri2_wl_query_buffer_age, .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, .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); 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 /* 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. */ * feedback was not advertised at all), so we must fallback to wl_drm. */
if (dri2_dpy->fd_render_gpu == -1) { 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)) (roundtrip(dri2_dpy) < 0 || !dri2_dpy->authenticated))
return false; return false;
} }
#endif
return true; return true;
} }
@ -2436,6 +2464,7 @@ dri2_initialize_wayland_drm(_EGLDisplay *disp)
dri2_wl_setup_swap_interval(disp); dri2_wl_setup_swap_interval(disp);
#ifdef HAVE_BIND_WL_DISPLAY
if (dri2_dpy->wl_drm) { if (dri2_dpy->wl_drm) {
/* To use Prime, we must have _DRI_IMAGE v7 at least. /* To use Prime, we must have _DRI_IMAGE v7 at least.
* createImageFromDmaBufs support indicates that Prime export/import is * 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); dri2_set_WL_bind_wayland_display(disp);
/* When cannot convert EGLImage to wl_buffer when on a different gpu, /* 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 * 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 */ * the extension */
if (dri2_dpy->fd_render_gpu == dri2_dpy->fd_display_gpu) if (dri2_dpy->fd_render_gpu == dri2_dpy->fd_display_gpu)
disp->Extensions.WL_create_wayland_buffer_from_image = EGL_TRUE; disp->Extensions.WL_create_wayland_buffer_from_image = EGL_TRUE;
#endif
dri2_wl_add_configs_for_visuals(disp);
disp->Extensions.EXT_buffer_age = EGL_TRUE; disp->Extensions.EXT_buffer_age = EGL_TRUE;
disp->Extensions.EXT_swap_buffers_with_damage = EGL_TRUE; disp->Extensions.EXT_swap_buffers_with_damage = EGL_TRUE;
disp->Extensions.EXT_present_opaque = EGL_TRUE; disp->Extensions.EXT_present_opaque = EGL_TRUE;
/* Fill vtbl last to prevent accidentally calling virtual function during /* 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; struct dri2_egl_display *dri2_dpy = data;
if (strcmp(interface, wl_shm_interface.name) == 0) { #ifdef HAVE_BIND_WL_DISPLAY
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);
}
if (strcmp(interface, wl_drm_interface.name) == 0) { if (strcmp(interface, wl_drm_interface.name) == 0) {
dri2_dpy->wl_drm_version = MIN2(version, 2); dri2_dpy->wl_drm_version = MIN2(version, 2);
dri2_dpy->wl_drm_name = name; 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 && } else if (strcmp(interface, zwp_linux_dmabuf_v1_interface.name) == 0 &&
version >= 3) { version >= 3) {
dri2_dpy->wl_dmabuf = wl_registry_bind( dri2_dpy->wl_dmabuf = wl_registry_bind(
@ -3202,9 +3232,11 @@ dri2_initialize_wayland_swrast(_EGLDisplay *disp)
dri2_wl_add_configs_for_visuals(disp); dri2_wl_add_configs_for_visuals(disp);
#ifdef HAVE_BIND_WL_DISPLAY
if (disp->Options.Zink && dri2_dpy->fd_render_gpu >= 0 && if (disp->Options.Zink && dri2_dpy->fd_render_gpu >= 0 &&
(dri2_dpy->wl_dmabuf || dri2_dpy->wl_drm)) (dri2_dpy->wl_dmabuf || dri2_dpy->wl_drm))
dri2_set_WL_bind_wayland_display(disp); dri2_set_WL_bind_wayland_display(disp);
#endif
disp->Extensions.EXT_buffer_age = EGL_TRUE; disp->Extensions.EXT_buffer_age = EGL_TRUE;
disp->Extensions.EXT_swap_buffers_with_damage = EGL_TRUE; disp->Extensions.EXT_swap_buffers_with_damage = EGL_TRUE;
disp->Extensions.EXT_present_opaque = 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); dri2_wl_formats_fini(&dri2_dpy->formats);
if (dri2_dpy->wp_presentation) if (dri2_dpy->wp_presentation)
wp_presentation_destroy(dri2_dpy->wp_presentation); wp_presentation_destroy(dri2_dpy->wp_presentation);
#ifdef HAVE_BIND_WL_DISPLAY
if (dri2_dpy->wl_drm) if (dri2_dpy->wl_drm)
wl_drm_destroy(dri2_dpy->wl_drm); wl_drm_destroy(dri2_dpy->wl_drm);
#endif
if (dri2_dpy->wl_dmabuf) if (dri2_dpy->wl_dmabuf)
zwp_linux_dmabuf_v1_destroy(dri2_dpy->wl_dmabuf); zwp_linux_dmabuf_v1_destroy(dri2_dpy->wl_dmabuf);
if (dri2_dpy->wl_shm) if (dri2_dpy->wl_shm)

View file

@ -45,6 +45,8 @@ import genCommon
def main(): def main():
parser = argparse.ArgumentParser() 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"), parser.add_argument("target", choices=("header", "source"),
help="Whether to build the source or header file.") help="Whether to build the source or header file.")
parser.add_argument("xml_files", nargs="+", parser.add_argument("xml_files", nargs="+",
@ -56,6 +58,8 @@ def main():
xmlByName = dict((f.name, f) for f in xmlFunctions) xmlByName = dict((f.name, f) for f in xmlFunctions)
functions = [] functions = []
for (name, eglFunc) in eglFunctionList.EGL_FUNCTIONS: for (name, eglFunc) in eglFunctionList.EGL_FUNCTIONS:
if not args.bind_wl_display and "Wayland" in name:
continue
func = xmlByName[name] func = xmlByName[name]
eglFunc = fixupEglFunc(func, eglFunc) eglFunc = fixupEglFunc(func, eglFunc)
functions.append((func, eglFunc)) functions.append((func, eglFunc))

View file

@ -2239,6 +2239,7 @@ eglDupNativeFenceFDANDROID(EGLDisplay dpy, EGLSync sync)
RETURN_EGL_SUCCESS(disp, ret); RETURN_EGL_SUCCESS(disp, ret);
} }
#ifdef HAVE_BIND_WL_DISPLAY
struct wl_display; struct wl_display;
static EGLBoolean EGLAPIENTRY static EGLBoolean EGLAPIENTRY
@ -2327,6 +2328,7 @@ eglCreateWaylandBufferFromImageWL(EGLDisplay dpy, EGLImage image)
RETURN_EGL_EVAL(disp, ret); RETURN_EGL_EVAL(disp, ret);
} }
#endif
static EGLBoolean EGLAPIENTRY static EGLBoolean EGLAPIENTRY
eglGetSyncValuesCHROMIUM(EGLDisplay dpy, EGLSurface surface, EGLuint64KHR *ust, eglGetSyncValuesCHROMIUM(EGLDisplay dpy, EGLSurface surface, EGLuint64KHR *ust,

View file

@ -158,6 +158,7 @@ struct _egl_driver {
/* for EGL_ANDROID_native_fence_sync */ /* for EGL_ANDROID_native_fence_sync */
EGLint (*DupNativeFenceFDANDROID)(_EGLDisplay *disp, _EGLSync *sync); EGLint (*DupNativeFenceFDANDROID)(_EGLDisplay *disp, _EGLSync *sync);
#ifdef HAVE_BIND_WL_DISPLAY
/* for EGL_WL_bind_wayland_display */ /* for EGL_WL_bind_wayland_display */
EGLBoolean (*BindWaylandDisplayWL)(_EGLDisplay *disp, EGLBoolean (*BindWaylandDisplayWL)(_EGLDisplay *disp,
struct wl_display *display); struct wl_display *display);
@ -170,6 +171,7 @@ struct _egl_driver {
/* for EGL_WL_create_wayland_buffer_from_image */ /* for EGL_WL_create_wayland_buffer_from_image */
struct wl_buffer *(*CreateWaylandBufferFromImageWL)(_EGLDisplay *disp, struct wl_buffer *(*CreateWaylandBufferFromImageWL)(_EGLDisplay *disp,
_EGLImage *img); _EGLImage *img);
#endif
/* for EGL_EXT_swap_buffers_with_damage */ /* for EGL_EXT_swap_buffers_with_damage */
EGLBoolean (*SwapBuffersWithDamageEXT)(_EGLDisplay *disp, EGLBoolean (*SwapBuffersWithDamageEXT)(_EGLDisplay *disp,

View file

@ -5,7 +5,9 @@
/* alphabetical order */ /* alphabetical order */
EGL_ENTRYPOINT(eglBindAPI) EGL_ENTRYPOINT(eglBindAPI)
EGL_ENTRYPOINT(eglBindTexImage) EGL_ENTRYPOINT(eglBindTexImage)
#ifdef HAVE_BIND_WL_DISPLAY
EGL_ENTRYPOINT(eglBindWaylandDisplayWL) EGL_ENTRYPOINT(eglBindWaylandDisplayWL)
#endif
EGL_ENTRYPOINT(eglChooseConfig) EGL_ENTRYPOINT(eglChooseConfig)
EGL_ENTRYPOINT(eglClientWaitSync) EGL_ENTRYPOINT(eglClientWaitSync)
EGL_ENTRYPOINT(eglClientWaitSyncKHR) EGL_ENTRYPOINT(eglClientWaitSyncKHR)
@ -23,7 +25,9 @@ EGL_ENTRYPOINT(eglCreatePlatformWindowSurfaceEXT)
EGL_ENTRYPOINT(eglCreateSync) EGL_ENTRYPOINT(eglCreateSync)
EGL_ENTRYPOINT(eglCreateSync64KHR) EGL_ENTRYPOINT(eglCreateSync64KHR)
EGL_ENTRYPOINT(eglCreateSyncKHR) EGL_ENTRYPOINT(eglCreateSyncKHR)
#ifdef HAVE_BIND_WL_DISPLAY
EGL_ENTRYPOINT(eglCreateWaylandBufferFromImageWL) EGL_ENTRYPOINT(eglCreateWaylandBufferFromImageWL)
#endif
EGL_ENTRYPOINT(eglCreateWindowSurface) EGL_ENTRYPOINT(eglCreateWindowSurface)
EGL_ENTRYPOINT(eglDebugMessageControlKHR) EGL_ENTRYPOINT(eglDebugMessageControlKHR)
EGL_ENTRYPOINT(eglDestroyContext) EGL_ENTRYPOINT(eglDestroyContext)
@ -70,7 +74,9 @@ EGL_ENTRYPOINT(eglQueryDmaBufModifiersEXT)
EGL_ENTRYPOINT(eglQueryString) EGL_ENTRYPOINT(eglQueryString)
EGL_ENTRYPOINT(eglQuerySupportedCompressionRatesEXT) EGL_ENTRYPOINT(eglQuerySupportedCompressionRatesEXT)
EGL_ENTRYPOINT(eglQuerySurface) EGL_ENTRYPOINT(eglQuerySurface)
#ifdef HAVE_BIND_WL_DISPLAY
EGL_ENTRYPOINT(eglQueryWaylandBufferWL) EGL_ENTRYPOINT(eglQueryWaylandBufferWL)
#endif
EGL_ENTRYPOINT(eglReleaseTexImage) EGL_ENTRYPOINT(eglReleaseTexImage)
EGL_ENTRYPOINT(eglReleaseThread) EGL_ENTRYPOINT(eglReleaseThread)
EGL_ENTRYPOINT(eglSetBlobCacheFuncsANDROID) EGL_ENTRYPOINT(eglSetBlobCacheFuncsANDROID)
@ -82,7 +88,9 @@ EGL_ENTRYPOINT(eglSwapBuffersWithDamageEXT)
EGL_ENTRYPOINT(eglSwapBuffersWithDamageKHR) EGL_ENTRYPOINT(eglSwapBuffersWithDamageKHR)
EGL_ENTRYPOINT(eglSwapInterval) EGL_ENTRYPOINT(eglSwapInterval)
EGL_ENTRYPOINT(eglTerminate) EGL_ENTRYPOINT(eglTerminate)
#ifdef HAVE_BIND_WL_DISPLAY
EGL_ENTRYPOINT(eglUnbindWaylandDisplayWL) EGL_ENTRYPOINT(eglUnbindWaylandDisplayWL)
#endif
EGL_ENTRYPOINT(eglWaitClient) EGL_ENTRYPOINT(eglWaitClient)
EGL_ENTRYPOINT(eglWaitGL) EGL_ENTRYPOINT(eglWaitGL)
EGL_ENTRYPOINT(eglWaitNative) EGL_ENTRYPOINT(eglWaitNative)

View file

@ -71,6 +71,7 @@ _eglParseKHRImageAttribs(_EGLImageAttribs *attrs, _EGLDisplay *disp,
return EGL_SUCCESS; return EGL_SUCCESS;
} }
#ifdef HAVE_BIND_WL_DISPLAY
static EGLint static EGLint
_eglParseWLBindWaylandDisplayAttribs(_EGLImageAttribs *attrs, _EGLDisplay *disp, _eglParseWLBindWaylandDisplayAttribs(_EGLImageAttribs *attrs, _EGLDisplay *disp,
EGLint attr, EGLint val) EGLint attr, EGLint val)
@ -88,6 +89,7 @@ _eglParseWLBindWaylandDisplayAttribs(_EGLImageAttribs *attrs, _EGLDisplay *disp,
return EGL_SUCCESS; return EGL_SUCCESS;
} }
#endif
static EGLint static EGLint
_eglParseEXTImageDmaBufImportAttribs(_EGLImageAttribs *attrs, _EGLDisplay *disp, _eglParseEXTImageDmaBufImportAttribs(_EGLImageAttribs *attrs, _EGLDisplay *disp,
@ -266,9 +268,11 @@ _eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *disp,
if (err == EGL_SUCCESS) if (err == EGL_SUCCESS)
continue; continue;
#ifdef HAVE_BIND_WL_DISPLAY
err = _eglParseWLBindWaylandDisplayAttribs(attrs, disp, attr, val); err = _eglParseWLBindWaylandDisplayAttribs(attrs, disp, attr, val);
if (err == EGL_SUCCESS) if (err == EGL_SUCCESS)
continue; continue;
#endif
err = _eglParseEXTImageDmaBufImportAttribs(attrs, disp, attr, val); err = _eglParseEXTImageDmaBufImportAttribs(attrs, disp, attr, val);
if (err == EGL_SUCCESS) if (err == EGL_SUCCESS)

View file

@ -49,6 +49,13 @@ files_egl = files(
'main/egltypedefs.h', '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 = custom_target(
'g_egldispatchstubs.c', 'g_egldispatchstubs.c',
input : [ input : [
@ -57,7 +64,7 @@ g_egldispatchstubs_c = custom_target(
], ],
output : 'g_egldispatchstubs.c', output : 'g_egldispatchstubs.c',
command : [ command : [
prog_python, '@INPUT0@', 'source', '@INPUT1@', '@INPUT2@', prog_python, '@INPUT0@', gen_args, 'source', '@INPUT1@', '@INPUT2@'
], ],
depend_files : [ 'generate/eglFunctionList.py', glapi_xml_py_deps], depend_files : [ 'generate/eglFunctionList.py', glapi_xml_py_deps],
capture : true, capture : true,
@ -71,7 +78,7 @@ g_egldispatchstubs_h = custom_target(
], ],
output : 'g_egldispatchstubs.h', output : 'g_egldispatchstubs.h',
command : [ command : [
prog_python, '@INPUT0@', 'header', '@INPUT1@', '@INPUT2@', prog_python, '@INPUT0@', gen_args, 'header', '@INPUT1@', '@INPUT2@'
], ],
depend_files : [ 'generate/eglFunctionList.py', glapi_xml_py_deps], depend_files : [ 'generate/eglFunctionList.py', glapi_xml_py_deps],
capture : true, capture : true,
@ -113,11 +120,17 @@ if with_dri
endif endif
if with_platform_wayland if with_platform_wayland
deps_for_egl += [dep_wayland_client, dep_wayland_server, dep_wayland_egl_headers] 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 += files('drivers/dri2/platform_wayland.c')
files_egl += wp_files['linux-dmabuf-unstable-v1'] files_egl += wp_files['linux-dmabuf-unstable-v1']
if with_wayland_bind_display
files_egl += [wayland_drm_client_protocol_h] files_egl += [wayland_drm_client_protocol_h]
link_for_egl += [libwayland_drm]
incs_for_egl += include_directories('wayland/wayland-drm') incs_for_egl += include_directories('wayland/wayland-drm')
c_args_for_egl += [
'-DHAVE_BIND_WL_DISPLAY'
]
endif
endif endif
if with_platform_android if with_platform_android
deps_for_egl += [dep_android, idep_u_gralloc] deps_for_egl += [dep_android, idep_u_gralloc]

View file

@ -56,7 +56,7 @@
#include "gbm_backend_abi.h" #include "gbm_backend_abi.h"
/* For importing wl_buffer */ /* For importing wl_buffer */
#if HAVE_WAYLAND_PLATFORM #if HAVE_BIND_WL_DISPLAY
#include "wayland-drm.h" #include "wayland-drm.h"
#endif #endif
@ -659,7 +659,7 @@ gbm_dri_bo_import(struct gbm_device *gbm,
} }
switch (type) { switch (type) {
#if HAVE_WAYLAND_PLATFORM #if HAVE_BIND_WL_DISPLAY
case GBM_BO_IMPORT_WL_BUFFER: case GBM_BO_IMPORT_WL_BUFFER:
{ {
struct wl_drm_buffer *wb; struct wl_drm_buffer *wb;

View file

@ -1,17 +1,22 @@
deps_gbm_dri = [] deps_gbm_dri = []
flags_gbm_dri = []
# TODO: fix includes to delete this # TODO: fix includes to delete this
incs_gbm_dri = [inc_mesa] incs_gbm_dri = [inc_mesa]
if with_platform_wayland if with_platform_wayland
deps_gbm_dri += dep_wayland_server deps_gbm_dri += dep_wayland_server
if with_wayland_bind_display
flags_gbm_dri += ['-DHAVE_BIND_WL_DISPLAY']
incs_gbm_dri += inc_wayland_drm incs_gbm_dri += inc_wayland_drm
endif
endif endif
shared_library( shared_library(
'dri_gbm', 'dri_gbm',
files('gbm_dri.c', 'gbm_driint.h'), files('gbm_dri.c', 'gbm_driint.h'),
include_directories : [inc_gallium, incs_gbm_dri, inc_loader, inc_st_dri, inc_gallium_aux], 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_args : [ld_args_gc_sections],
link_with : [libloader, libgallium_dri], link_with : [libloader, libgallium_dri],
dependencies : [deps_gbm_dri, dep_dl, dep_gbm, dep_libdrm, idep_mesautil, idep_xmlconfig], dependencies : [deps_gbm_dri, dep_dl, dep_gbm, dep_libdrm, idep_mesautil, idep_xmlconfig],

View file

@ -61,7 +61,7 @@ endif
if with_imgui if with_imgui
subdir('imgui') subdir('imgui')
endif endif
if with_platform_wayland if with_wayland_bind_display
subdir('egl/wayland/wayland-drm') subdir('egl/wayland/wayland-drm')
endif endif
if with_any_vk or with_gallium_zink if with_any_vk or with_gallium_zink

View file

@ -22,7 +22,9 @@
*/ */
#include "util/macros.h" #include "util/macros.h"
#include <wayland-client.h> #include <wayland-client.h>
#ifdef HAVE_BIND_WL_DISPLAY
#include "wayland-drm-client-protocol.h" #include "wayland-drm-client-protocol.h"
#endif
#include "linux-dmabuf-unstable-v1-client-protocol.h" #include "linux-dmabuf-unstable-v1-client-protocol.h"
#include "device_select.h" #include "device_select.h"
#include <string.h> #include <string.h>
@ -32,14 +34,17 @@
#include <xf86drm.h> #include <xf86drm.h>
struct device_select_wayland_info { struct device_select_wayland_info {
#ifdef HAVE_BIND_WL_DISPLAY
struct wl_drm *wl_drm; struct wl_drm *wl_drm;
drmDevicePtr drm_dev_info; drmDevicePtr drm_dev_info;
#endif
struct zwp_linux_dmabuf_v1 *wl_dmabuf; struct zwp_linux_dmabuf_v1 *wl_dmabuf;
struct zwp_linux_dmabuf_feedback_v1 *wl_dmabuf_feedback; struct zwp_linux_dmabuf_feedback_v1 *wl_dmabuf_feedback;
drmDevicePtr dmabuf_dev_info; drmDevicePtr dmabuf_dev_info;
}; };
#ifdef HAVE_BIND_WL_DISPLAY
static void static void
device_select_drm_handle_device(void *data, struct wl_drm *drm, const char *device) 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, .authenticated = device_select_drm_handle_authenticated,
.capabilities = device_select_drm_handle_capabilities .capabilities = device_select_drm_handle_capabilities
}; };
#endif
static void static void
default_dmabuf_feedback_format_table(void *data, 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) const char *interface, uint32_t version)
{ {
struct device_select_wayland_info *info = data; struct device_select_wayland_info *info = data;
#if HAVE_BIND_WL_DISPLAY
if (strcmp(interface, wl_drm_interface.name) == 0) { if (strcmp(interface, wl_drm_interface.name) == 0) {
info->wl_drm = wl_registry_bind(registry, name, &wl_drm_interface, MIN2(version, 2)); 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); 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) { version >= ZWP_LINUX_DMABUF_V1_GET_DEFAULT_FEEDBACK_SINCE_VERSION) {
info->wl_dmabuf = info->wl_dmabuf =
wl_registry_bind(registry, name, &zwp_linux_dmabuf_v1_interface, 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; drmDevicePtr target;
if (info.dmabuf_dev_info != NULL) { if (info.dmabuf_dev_info != NULL) {
target = info.dmabuf_dev_info; 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; target = info.drm_dev_info;
} else { }
#endif
if (target != NULL) {
goto done; goto done;
} }
@ -235,15 +248,19 @@ int device_select_find_wayland_pci_default(struct device_pci_info *devices, uint
done: done:
if (info.dmabuf_dev_info != NULL) if (info.dmabuf_dev_info != NULL)
drmFreeDevice(&info.dmabuf_dev_info); drmFreeDevice(&info.dmabuf_dev_info);
#ifdef HAVE_BIND_WL_DISPLAY
if (info.drm_dev_info != NULL) if (info.drm_dev_info != NULL)
drmFreeDevice(&info.drm_dev_info); drmFreeDevice(&info.drm_dev_info);
#endif
if (info.wl_dmabuf_feedback) if (info.wl_dmabuf_feedback)
zwp_linux_dmabuf_feedback_v1_destroy(info.wl_dmabuf_feedback); zwp_linux_dmabuf_feedback_v1_destroy(info.wl_dmabuf_feedback);
if (info.wl_dmabuf) if (info.wl_dmabuf)
zwp_linux_dmabuf_v1_destroy(info.wl_dmabuf); zwp_linux_dmabuf_v1_destroy(info.wl_dmabuf);
#ifdef HAVE_BIND_WL_DISPLAY
if (info.wl_drm) if (info.wl_drm)
wl_drm_destroy(info.wl_drm); wl_drm_destroy(info.wl_drm);
#endif
wl_registry_destroy(registry); wl_registry_destroy(registry);
wl_display_disconnect(display); wl_display_disconnect(display);

View file

@ -15,7 +15,10 @@ endif
if with_platform_wayland if with_platform_wayland
vklayer_files += files('device_select_wayland.c') vklayer_files += files('device_select_wayland.c')
if with_wayland_bind_display
vklayer_files += [ wayland_drm_client_protocol_h, wayland_drm_protocol_c ] 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_files += wp_files['linux-dmabuf-unstable-v1']
vklayer_deps += dep_wayland_client vklayer_deps += dep_wayland_client
endif endif