wayland: fix SHM buffer format — DRM_FORMAT_ARGB8888 not WL_SHM_FORMAT_ARGB8888

WL_SHM_FORMAT_ARGB8888 == 0, which the DRM/GLES2 renderer interprets as
DRM_FORMAT_INVALID.  This caused:
  - "Unsupported pixel format 0x0" on the first frame upload attempt
  - wlr_texture_from_buffer assertion failure when the scene renderer
    retried the upload lazily during an active render pass

Use DRM_FORMAT_ARGB8888 (0x34325241) from <libdrm/drm_fourcc.h> instead.
Texture creation now succeeds at wlr_scene_buffer_set_buffer time, so
the lazy path is never reached.

Verified: steel-blue test square visible in nested Sway session; smoke
test PASS.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-03-31 13:50:05 +02:00
parent b671f385ac
commit 4f0273e5e6
1 changed files with 2 additions and 1 deletions

View File

@ -130,6 +130,7 @@
#include <wlr/types/wlr_scene.h> /* Phase 18: scene graph compositing */
#include <wlr/render/allocator.h> /* Phase 18: buffer allocator */
#include <wlr/types/wlr_buffer.h> /* Phase 29+: WM-owned SHM surface buffers */
#include <libdrm/drm_fourcc.h> /* Phase 29+: DRM_FORMAT_ARGB8888 */
#include <pixman.h> /* Phase 29+: software pixel rendering */
#include <wlr/types/wlr_cursor.h> /* Phase 23: hardware cursor tracking */
#include <wlr/types/wlr_xcursor_manager.h> /* Phase 23: xcursor theme */
@ -2421,7 +2422,7 @@ shm_buf_begin_data_ptr(struct wlr_buffer *buf, uint32_t flags,
struct wm_shm_surface *s = wl_container_of(buf, s, wlr_buf);
(void)flags;
*out_data = s->data;
*out_fmt = WL_SHM_FORMAT_ARGB8888;
*out_fmt = DRM_FORMAT_ARGB8888;
*out_stride = s->stride;
return true;
}