From 3d7d6ec06ff519e4b28198fd514d511c6d670b0b Mon Sep 17 00:00:00 2001 From: Manuel Stoeckl Date: Wed, 10 Nov 2021 22:59:31 -0500 Subject: [PATCH] output: use XRGB8888 format instead of ARGB8888 Most (and possibly all) compositors using wlroots only ever render fully opaque content. To provide better performance, this change switches the default format used by wlr_output buffers from ARGB8888 to the opaque XRGB8888. Compositors like mutter, kwin, and weston already default to XRGB8888, so this change is unlikely to expose any new bugs in underlying drivers and hardware. This does not affect the hardware cursor's buffer format, which is still ARGB8888 by default. As part of this change, the X11 backend (which does not support changing format at runtime) now picks a true color, 24 bit depth visual (i.e. XRGB8888) instead of a 32 bit depth (ARGB8888) one. --- backend/x11/backend.c | 4 ++-- types/output/render.c | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/backend/x11/backend.c b/backend/x11/backend.c index 9eaf5664..6db9aa6c 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -572,9 +572,9 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display, goto error_event; } - x11->depth = get_depth(x11->screen, 32); + x11->depth = get_depth(x11->screen, 24); if (!x11->depth) { - wlr_log(WLR_ERROR, "Failed to get 32-bit depth for X11 screen"); + wlr_log(WLR_ERROR, "Failed to get 24-bit depth for X11 screen"); goto error_event; } diff --git a/types/output/render.c b/types/output/render.c index 8b35355d..adce1ee3 100644 --- a/types/output/render.c +++ b/types/output/render.c @@ -67,11 +67,7 @@ static bool output_create_swapchain(struct wlr_output *output, } struct wlr_drm_format *format = output_pick_format(output, display_formats, - DRM_FORMAT_ARGB8888); - if (format == NULL) { - format = output_pick_format(output, display_formats, - DRM_FORMAT_XRGB8888); - } + DRM_FORMAT_XRGB8888); if (format == NULL) { wlr_log(WLR_ERROR, "Failed to pick primary buffer format for output '%s'", output->name);