git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commit9ac941a8fa84654fde5d73246181e2a1c2d8b20a
parentbcb12b2ed1
authorIsaac Freund <[email protected]>
date2025-04-27 12:53
linux-drm-syncobj: implement protocol

(cherry picked from commit bbb62ac8d8288b19f63d28799157f887c6bf817a)

 river/Server.zig | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/river/Server.zig b/river/Server.zig
index 10b028e..93d43d4 100644
--- a/river/Server.zig
+++ b/river/Server.zig
@@ -61,6 +61,7 @@ security_context_manager: *wlr.SecurityContextManagerV1,
 shm: *wlr.Shm,
 drm: ?*wlr.Drm = null,
 linux_dmabuf: ?*wlr.LinuxDmabufV1 = null,
+linux_drm_syncobj_manager: ?*wlr.LinuxDrmSyncobjManagerV1 = null,
 single_pixel_buffer_manager: *wlr.SinglePixelBufferManagerV1,
 
 viewporter: *wlr.Viewporter,
@@ -166,6 +167,12 @@ pub fn init(server: *Server, runtime_xwayland: bool) !void {
 
         server.linux_dmabuf = try wlr.LinuxDmabufV1.createWithRenderer(wl_server, 4, renderer);
     }
+    if (renderer.features.timeline and backend.features.timeline) {
+        const drm_fd = renderer.getDrmFd();
+        if (drm_fd >= 0) {
+            server.linux_drm_syncobj_manager = wlr.LinuxDrmSyncobjManagerV1.create(wl_server, 1, drm_fd);
+        }
+    }
 
     if (build_options.xwayland and runtime_xwayland) {
         server.xwayland = try wlr.Xwayland.create(wl_server, compositor, false);
@@ -270,7 +277,12 @@ fn globalFilter(client: *const wl.Client, global: *const wl.Global, server: *Ser
 /// Returns true if the global is allowlisted for security contexts
 fn allowlist(server: *Server, global: *const wl.Global) bool {
     if (server.drm) |drm| if (global == drm.global) return true;
-    if (server.linux_dmabuf) |linux_dmabuf| if (global == linux_dmabuf.global) return true;
+    if (server.linux_dmabuf) |linux_dmabuf| {
+        if (global == linux_dmabuf.global) return true;
+    }
+    if (server.linux_drm_syncobj_manager) |linux_drm_syncobj_manager| {
+        if (global == linux_drm_syncobj_manager.global) return true;
+    }
 
     // We must use the getInterface() approach for dynamically created globals
     // such as wl_output and wl_seat since the wl_global_create() function will