From 1f15dd093d8986c783877bdfb25221f67979cad2 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 18 Nov 2020 15:01:13 +0100 Subject: render: assert {X,A}RGB8888 are supported The Wayland protocol requires those to be supported. --- render/wlr_renderer.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'render') diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c index 62ae9474..3703f419 100644 --- a/render/wlr_renderer.c +++ b/render/wlr_renderer.c @@ -217,13 +217,22 @@ bool wlr_renderer_init_wl_display(struct wlr_renderer *r, return false; } + bool argb8888 = false, xrgb8888 = false; for (size_t i = 0; i < len; ++i) { - // These formats are already added by default - if (formats[i] != WL_SHM_FORMAT_ARGB8888 && - formats[i] != WL_SHM_FORMAT_XRGB8888) { + // ARGB8888 and XRGB8888 must be supported and are implicitly + // advertised by wl_display_init_shm + switch (formats[i]) { + case WL_SHM_FORMAT_ARGB8888: + argb8888 = true; + break; + case WL_SHM_FORMAT_XRGB8888: + xrgb8888 = true; + break; + default: wl_display_add_shm_format(wl_display, formats[i]); } } + assert(argb8888 && xrgb8888); if (r->impl->init_wl_display) { if (!r->impl->init_wl_display(r, wl_display)) { -- cgit v1.2.3