Commit 84ae5467 authored by Drew DeVault's avatar Drew DeVault

Xwayland: add DRM leasing support

This is based on the unstable DRM leasing protocol currently under
review on wayland-devel. One unfortunate problem with this approach is
that we have to open the DRM node ourselves and enumerate the modes of
the connectors available for lease. We'll be able to refactor this
somewhat once the kernel supports zero-object DRM leases, which I intend
to implement in the near future.

This takes the approach suggested by Pekka in which no attempt is made
to correlate leasable connectors with a wl_output/xdg_output.
Accordingly, this also assumes that all leasable connectors are
non-desktop outputs.

Successfully tested with xrgears -w direct and SteamVR on an HTC Vive.
parent a0269727
Pipeline #52532 passed with stages
in 6 minutes and 48 seconds
......@@ -68,6 +68,8 @@ Xwayland_DEPENDENCIES = $(glamor_lib) $(XWAYLAND_LIBS)
endif
Xwayland_built_sources += \
drm-lease-unstable-v1-client-protocol.h \
drm-lease-unstable-v1-protocol.c \
relative-pointer-unstable-v1-client-protocol.h \
relative-pointer-unstable-v1-protocol.c \
pointer-constraints-unstable-v1-client-protocol.h \
......@@ -99,6 +101,11 @@ $(Xwayland_SOURCES): $(Xwayland_built_sources)
relink:
$(AM_V_at)rm -f Xwayland$(EXEEXT) && $(MAKE) Xwayland$(EXEEXT)
drm-lease-unstable-v1-protocol.c : $(srcdir)/drm-lease-unstable-v1.xml
$(AM_V_GEN)$(WAYLAND_SCANNER) @SCANNER_ARG@ < $< > $@
drm-lease-unstable-v1-client-protocol.h : $(srcdir)/drm-lease-unstable-v1.xml
$(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
relative-pointer-unstable-v1-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/relative-pointer/relative-pointer-unstable-v1.xml
$(AM_V_GEN)$(WAYLAND_SCANNER) @SCANNER_ARG@ < $< > $@
relative-pointer-unstable-v1-client-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/unstable/relative-pointer/relative-pointer-unstable-v1.xml
......
This diff is collapsed.
......@@ -83,6 +83,9 @@ if build_glamor
xwayland_glamor += glamor
endif
srcs += client_header.process('drm-lease-unstable-v1.xml')
srcs += code.process('drm-lease-unstable-v1.xml')
wayland_inc = [ inc, ]
if build_glx
wayland_inc += glx_inc
......
This diff is collapsed.
......@@ -810,6 +810,10 @@ registry_global(void *data, struct wl_registry *registry, uint32_t id,
xwl_screen->xdg_output_manager =
wl_registry_bind(registry, id, &zxdg_output_manager_v1_interface, 1);
xwl_screen_init_xdg_output(xwl_screen);
} else if (strcmp(interface, "zwp_drm_lease_manager_v1") == 0) {
xwl_screen->drm_lease_manager = wl_registry_bind(
registry, id, &zwp_drm_lease_manager_v1_interface, 1);
xwl_screen_init_drm_lease_manager(xwl_screen);
}
#ifdef XWL_HAS_GLAMOR
else if (xwl_screen->glamor) {
......
......@@ -48,6 +48,7 @@
#include "xwayland-keyboard-grab-unstable-v1-client-protocol.h"
#include "xdg-output-unstable-v1-client-protocol.h"
#include "linux-dmabuf-unstable-v1-client-protocol.h"
#include "drm-lease-unstable-v1-client-protocol.h"
struct xwl_format {
uint32_t format;
......@@ -58,6 +59,7 @@ struct xwl_format {
struct xwl_pixmap;
struct xwl_window;
struct xwl_screen;
struct xwl_drm_lease;
struct xwl_egl_backend {
/* Set by the backend if available */
......@@ -147,6 +149,7 @@ struct xwl_screen {
struct zwp_pointer_constraints_v1 *pointer_constraints;
struct zwp_xwayland_keyboard_grab_manager_v1 *wp_grab;
struct zxdg_output_manager_v1 *xdg_output_manager;
struct zwp_drm_lease_manager_v1 *drm_lease_manager;
uint32_t serial;
#define XWL_FORMAT_ARGB8888 (1 << 0)
......@@ -373,6 +376,15 @@ struct xwl_output {
Rotation rotation;
Bool wl_output_done;
Bool xdg_output_done;
struct zwp_drm_lease_connector_v1 *lease_connector;
struct xwl_drm_lease *lease;
};
struct xwl_drm_lease {
struct zwp_drm_lease_v1 *lease;
RRLeasePtr rrLease;
Bool answered;
int fd;
};
void xwl_sync_events (struct xwl_screen *xwl_screen);
......@@ -465,6 +477,8 @@ void xwl_screen_release_tablet_manager(struct xwl_screen *xwl_screen);
void xwl_screen_init_xdg_output(struct xwl_screen *xwl_screen);
void xwl_screen_init_drm_lease_manager(struct xwl_screen *xwl_screen);
#ifdef XF86VIDMODE
void xwlVidModeExtensionInit(void);
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment