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:
14 files changed
+309
-41
No files matched your search
@@ -83,6 +83,32 @@ pub fn recvmsg_fd(fd : Int, buf : FixedArray[Byte], max_len : Int) -> (Int, Int)
|
||||
(r.count, r.fd)
|
||||
}
|
||||
|
||||
///| Receive bytes and every SCM_RIGHTS fd that came with them, in order. Returns
|
||||
/// (bytes_read, fds); bytes_read == -1 means EAGAIN, -2 an error, 0 EOF.
|
||||
pub fn recvmsg_fds(fd : Int, buf : FixedArray[Byte], max_len : Int) -> (Int, Array[Int]) {
|
||||
let (n, first) = recvmsg_fd(fd, buf, max_len)
|
||||
let fds : Array[Int] = []
|
||||
if first >= 0 {
|
||||
fds.push(first)
|
||||
while true {
|
||||
let more = @hostsys.take_fd(fd)
|
||||
if more < 0 {
|
||||
break
|
||||
}
|
||||
fds.push(more)
|
||||
}
|
||||
}
|
||||
(n, fds)
|
||||
}
|
||||
|
||||
///| Several fds in one message are a native-only test helper.
|
||||
pub fn sendmsg_fds(fd : Int, buf : Bytes, fds : Array[Int]) -> Int {
|
||||
if fds.length() > 1 {
|
||||
abort("sendmsg_fds: one fd at most on the wasm build")
|
||||
}
|
||||
sendmsg_fd(fd, buf, if fds.length() == 1 { fds[0] } else { -1 })
|
||||
}
|
||||
|
||||
///|
|
||||
pub fn sendmsg_fd(fd : Int, buf : Bytes, send_fd : Int) -> Int {
|
||||
@hostsys.sendmsg(fd, to_fixed(buf), send_fd)
|
||||
|
||||
Reference in new issue
Block a user