Apps drawing with Vulkan on wl_shm (Delta, Zed) show every frame
CI / test (push) Failing after 16s

Delta is a GPUI app: it draws with Vulkan, and without linux-dmabuf Mesa's WSI
presents through wl_shm, making one wl_shm_pool per swapchain image. libwayland
flushes those create_pool requests with all their fds in one sendmsg (vkcube on
lavapipe sends 4), but both hosts kept only the first SCM_RIGHTS fd and closed
the rest. Every pool but the first had no memory, so only one swapchain image
ever reached the screen: stale, frozen or flickering windows.

- recvmsg keeps every fd (up to 32), in order: natively through recvmsg_fds,
  and in the wasm host through a new chandra:host/sys take-fd import.
- A commit consumes the attached buffer. A bare commit (GPUI commits after
  ack_configure) used to re-show and re-release the old buffer, which the
  client may already be drawing its next frame into.
- ARGB8888 client buffers are blended as premultiplied alpha, as wl_shm
  defines, in both rasterisers (translucent edges were darkened).
- wl_seat.name and wl_output.scale/done are only sent to clients that bound
  version 2 or later (vkcube binds v1 and aborted on them).

Regression test: a client flushes three pools with their fds in one message,
then commits a bare frame; it fails on the old code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hm8wb1UKxQxf8o6gpz
This commit is contained in:
Claude committed 2026-11-25 19:09:18 +00:00
1 parent 85f6ff42f4
commit 8f88d93d9f
14 files changed
+309 -41

No files matched your search

+3
View File
@@ -18,6 +18,9 @@ fn wasmImportUnlink(p0 : Int, p1 : Int) = "chandra:host/sys@0.1.0" "unlink"
///|
fn wasmImportPollRead(p0 : Int, p1 : Int) -> Int = "chandra:host/sys@0.1.0" "poll-read"
///|
fn wasmImportTakeFd(p0 : Int) -> Int = "chandra:host/sys@0.1.0" "take-fd"
///|
fn wasmImportRecvmsg(p0 : Int, p1 : Int, p2 : Int) = "chandra:host/sys@0.1.0" "recvmsg"
@@ -25,6 +25,11 @@ fn wasmImportUnlink(p0 : Int, p1 : Int) -> Unit {
abort("wasm-only host import")
}
///|
fn wasmImportTakeFd(p0 : Int) -> Int {
abort("wasm-only host import")
}
///|
fn wasmImportPollRead(p0 : Int, p1 : Int) -> Int {
abort("wasm-only host import")
@@ -40,6 +40,8 @@ pub fn sleep_ms(Int32) -> Unit
pub fn spawn(String, String) -> Bool
pub fn take_fd(Int32) -> Int32
pub fn unix_accept(Int32) -> Int32
pub fn unix_connect(String) -> Int32
+10
View File
@@ -69,6 +69,16 @@ pub fn recvmsg(fd : Int, max_len : UInt) -> Received {
mbt_ffi_free(return_area)
return ret
}
///|
/// The next further fd that arrived with the last `recvmsg` on `sock` (a client can send
/// several in one message), -1 when none is left.
pub fn take_fd(sock : Int) -> Int {
let result : Int = wasmImportTakeFd(sock);
let ret = result
return ret
}
///|
/// Send `data`, with `send-fd` (or -1) as SCM_RIGHTS; bytes sent or <0.