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
@@ -47,7 +47,7 @@ test "span-based rounded fills match the per-pixel reference" {
|
||||
}
|
||||
|
||||
///|
|
||||
test "blitting a client buffer matches per-pixel blending, even partly off screen" {
|
||||
test "blitting a client buffer blends premultiplied alpha per pixel, even partly off screen" {
|
||||
let w = 20
|
||||
let h = 12
|
||||
let bytes = FixedArray::make(w * h * 4, b'\x00')
|
||||
@@ -69,7 +69,19 @@ test "blitting a client buffer matches per-pixel blending, even partly off scree
|
||||
for col = 0; col < w; col = col + 1 {
|
||||
let o = row * w * 4 + col * 4
|
||||
let al = if format == 1 { 255 } else { raw[o + 3].to_int() }
|
||||
blend_pixel(b, pos.0 + col, pos.1 + row, raw[o + 2].to_int(), raw[o + 1].to_int(), raw[o].to_int(), al, None)
|
||||
let x = pos.0 + col
|
||||
let y = pos.1 + row
|
||||
if x < 0 || y < 0 || x >= 64 || y >= 48 || al == 0 {
|
||||
continue
|
||||
}
|
||||
let d = (y * 64 + x) * 4
|
||||
let inv = 255 - al
|
||||
for k in [0, 1, 2] {
|
||||
let s = raw[o + 2 - k].to_int()
|
||||
let v = if al >= 255 { s } else { s + (b.data[d + k].to_int() * inv + 127) / 255 }
|
||||
b.data[d + k] = v.clamp(min=0, max=255).to_byte()
|
||||
}
|
||||
b.data[d + 3] = if al >= 255 { b'\xff' } else { (al + (b.data[d + 3].to_int() * inv + 127) / 255).clamp(min=0, max=255).to_byte() }
|
||||
}
|
||||
}
|
||||
assert_eq(a.data, b.data)
|
||||
|
||||
Reference in new issue
Block a user