fix: pixman stride bug with bgr888 formats#71
fix: pixman stride bug with bgr888 formats#71cashmeredev wants to merge 1 commit intomoverest:mainfrom
Conversation
fixes moverest#47 the screencopy protocol can return buffers with non-aligned strides, especially with bgr888 (24-bit) formats. this breaks pixman since it expects stride in uint32_t units and aligned to 4 bytes. for non-32bit formats or misaligned strides, we now convert directly to argb8888 by writing into pixman's buffer instead of passing the raw buffer. tested on nixos + swayfx + nvidia rtx 3070 ti where it was failing consistently before.
|
Thank you for your changes and your interest in the project. I'm not really sure how to reproduce this on my machine. Does this happen with |
|
the crash is caused by how wl-kbptr passes the screencopy buffer to pixman. the compositor can return 24‑bit bgr888 buffers where the row stride in bytes is not a multiple of 4. pixman expects any external buffer to have a 4‑byte‑aligned row stride (it stores the stride internally in previously, wl-kbptr just handed the screencopy buffer directly to pixman, so on setups where the compositor used bgr888 with a “weird” stride, pixman would immediately crash. with grim i don’t see this issue, presumably because it only ever gets formats/strides that already match pixman’s expectations. on my side i can reliably reproduce and compare the behavior:
this matches the idea that certain compositor/gpu combinations (in my case nvidia + swayfx + |
fixes #47
the screencopy protocol can return buffers with non-aligned strides, especially with bgr888 (24-bit) formats. this breaks pixman since it expects stride in uint32_t units and aligned to 4 bytes.
for non-32bit formats or misaligned strides, we now convert directly to argb8888 by writing into pixman's buffer instead of passing the raw buffer.
tested on nixos + swayfx + nvidia rtx 3070 ti where it was failing consistently before.