Merge main: one linux-dmabuf, imported on the GPU or mapped without one

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
nandiandClaude Opus 5.5 committed 2026-11-30 16:47:03 -08:00
commit d478f58d9b
54 files changed
+1110 -376

No files matched your search

+14 -17
View File
@@ -137,7 +137,9 @@ struct SurfaceState {
/// without a new attach (a client changing only its regions or geometry) neither shows the
/// old buffer again nor releases it a second time: the client may already be drawing into it.
mut attached_buffer : UInt?
mut pending_frame_cb : UInt?
/// Every wl_surface.frame callback since the last commit; a client may queue several (Zed
/// and Mesa's EGL each do) and waits on all of them.
pending_frame_cbs : Array[UInt]
mut xdg_surface_id : UInt?
mut window_id : UInt64?
/// wl_surface.set_buffer_scale: the buffer is this many times the window's size.
@@ -485,7 +487,7 @@ fn WaylandServer::next_serial(self : WaylandServer) -> UInt {
}
///|
fn emit_registry_globals(c : ClientConn, reg_id : UInt, dmabuf : Bool) -> Unit {
fn emit_registry_globals(c : ClientConn, reg_id : UInt) -> Unit {
let globals : Array[(UInt, String, UInt)] = [
(1U, "wl_compositor", 5U),
(2U, "wl_shm", 1U),
@@ -499,10 +501,8 @@ fn emit_registry_globals(c : ClientConn, reg_id : UInt, dmabuf : Bool) -> Unit {
(10U, "org_kde_kwin_server_decoration_manager", 1U),
(11U, "zwp_primary_selection_device_manager_v1", 1U),
(12U, "zwp_text_input_manager_v3", 1U),
(13U, "zwp_linux_dmabuf_v1", 4U),
]
if dmabuf {
globals.push((13U, "zwp_linux_dmabuf_v1", 4U))
}
for g in globals {
let w = WireWriter::new()
w.u32(g.0)
@@ -698,7 +698,7 @@ fn WaylandServer::dispatch_msg(
// get_registry(registry: new_id)
let reg_id = reader.u32()
c.objects.set(reg_id, ObjRegistry)
emit_registry_globals(c, reg_id, self.dmabuf_formats().1.length() > 0)
emit_registry_globals(c, reg_id)
}
ObjRegistry =>
if opcode == 0U {
@@ -752,7 +752,7 @@ fn WaylandServer::dispatch_msg(
c.objects.set(sid, ObjSurface(sid))
c.surfaces.set(sid, {
attached_buffer: None,
pending_frame_cb: None,
pending_frame_cbs: [],
xdg_surface_id: None,
window_id: None,
buffer_scale: 1,
@@ -801,7 +801,7 @@ fn WaylandServer::dispatch_msg(
} else if opcode == 3U {
// frame(callback)
let cb_id = reader.u32()
surf.pending_frame_cb = Some(cb_id)
surf.pending_frame_cbs.push(cb_id)
} else if opcode == 10U {
// offset(x, y) (version 5): moves the surface; for a drag icon, its hotspot.
surf.pend_dx = surf.pend_dx + reader.i32()
@@ -898,17 +898,14 @@ fn WaylandServer::dispatch_msg(
None => ()
}
surf.attached_buffer = None
match surf.pending_frame_cb {
Some(cb_id) => {
surf.pending_frame_cb = None
if self.hold_frames {
self.held_frames.push((c.client_id, cb_id))
} else {
self.frame_done(c, cb_id)
}
for cb_id in surf.pending_frame_cbs {
if self.hold_frames {
self.held_frames.push((c.client_id, cb_id))
} else {
self.frame_done(c, cb_id)
}
None => ()
}
surf.pending_frame_cbs.clear()
}
}
ObjSubcompositor =>