RediWM is a Wayland compositor written in Zig (OpenGL ES) that includes everything in one process
linux-dmabuf: advertise the global once
oxydizercf6aceb2cc1c
diff --git a/src/server/setup.zig b/src/server/setup.zigindex 6a25139..a93cb3a 100644--- a/src/server/setup.zig+++ b/src/server/setup.zig@@ -358,12 +358,9 @@ fn initProtocols(server: *Server) CompositorError!void {_ = wlr.Viewporter.create(server.wl_server) catch return error.ViewporterCreateFailed;_ = wlr.FractionalScaleManagerV1.create(server.wl_server, 1) catch return error.FractionalScaleManagerCreateFailed;_ = wlr.SinglePixelBufferManagerV1.create(server.wl_server) catch return error.SinglePixelBufferManagerCreateFailed;- // Soft-fail, not a CompositorError: a software renderer (pixman, used by- // most headless tests) may not support dmabuf import at all, in which- // case this simply advertises zero formats rather than blocking startup.- _ = wlr.LinuxDmabufV1.createWithRenderer(server.wl_server, 4, server.renderer) catch |err| {- log.warn("init: could not create linux-dmabuf manager, dmabuf clients disabled: {}", .{err});- };+ // linux-dmabuf v4 comes from `initServer` above (wlr_renderer_init_wl_display),+ // only when the renderer imports dmabufs (not pixman). Creating it here too+ // advertised a second global, and Mesa's WSI bound both and leaked one.// Explicit sync: the proprietary NVIDIA driver has no implicit sync, so// without it Xwayland and Vulkan clients flicker or show torn frames.// wlr_scene waits on acquire points and signals release points; thediff --git a/tests/wlr_protocols.py b/tests/wlr_protocols.pyindex 955cef7..892bfce 100644--- a/tests/wlr_protocols.py+++ b/tests/wlr_protocols.py@@ -2,6 +2,7 @@"""wlr-output-management, wlr-foreign-toplevel, wlr-screencopy, virtual-pointerand ext-session-lock with real clients (wlr-randr, wlrctl, swaylock) where theyare installed, and tests/wlr_protocols_client.c for the rest."""+from collections import Counterimport osimport selectfrom pathlib import Path@@ -256,6 +257,14 @@ def extra_protocols(tmp):"xdg_activation_v1"):assert interface in registry, interfaceassert "wp_drm_lease_device_v1" not in registry, "headless backend must not offer DRM leases"+ # Every global is advertised once. linux-dmabuf used to be created both+ # by wlr_renderer_init_wl_display and by setup.zig, and Mesa's WSI bound+ # both and leaked one. Only per-device globals repeat: one wl_output+ # per output (two here), and a seat per seat.+ counts = Counter(line for line in registry.splitlines() if line and line != "done")+ repeated = {name: n for name, n in counts.items() if n > 1 and name not in ("wl_output", "wl_seat")}+ assert not repeated, f"globals advertised more than once: {repeated}"+ assert counts["wl_output"] == 2, countswith open(tmp / "extras-client.log", "w") as client_log:child = s.spawn(fixture, "extras", stdin=subprocess.PIPE, stderr=client_log)try: