From 8b6c3fe0ad4bce6c93dad4875a089ba8e7c6ce58 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Wed, 20 Jul 2022 14:52:41 +0300 Subject: [PATCH] backend-headless: choose pixel format by drm_fourcc Pixman image formats are CPU-endianess dependent while drm_fourcc are not. Standardise around drm_fourcc because DRM-backend uses them anyway. This also makes Pixman-renderer use the same format as GL-renderer will prefer on headless. Signed-off-by: Pekka Paalanen --- libweston/backend-headless/headless.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libweston/backend-headless/headless.c b/libweston/backend-headless/headless.c index 7ea869d0..83de39dc 100644 --- a/libweston/backend-headless/headless.c +++ b/libweston/backend-headless/headless.c @@ -37,6 +37,7 @@ #include #include "shared/helpers.h" #include "linux-explicit-synchronization.h" +#include "pixel-formats.h" #include "pixman-renderer.h" #include "renderer-gl/gl-renderer.h" #include "shared/weston-drm-fourcc.h" @@ -74,7 +75,7 @@ struct headless_output { }; static const uint32_t headless_formats[] = { - DRM_FORMAT_XRGB8888, + DRM_FORMAT_XRGB8888, /* default for pixman-renderer */ DRM_FORMAT_ARGB8888, }; @@ -231,12 +232,15 @@ headless_output_enable_gl(struct headless_output *output) static int headless_output_enable_pixman(struct headless_output *output) { + const struct pixel_format_info *pfmt; const struct pixman_renderer_output_options options = { .use_shadow = true, }; + pfmt = pixel_format_get_info(headless_formats[0]); + output->image = - pixman_image_create_bits_no_clear(PIXMAN_x8r8g8b8, + pixman_image_create_bits_no_clear(pfmt->pixman_format, output->base.current_mode->width, output->base.current_mode->height, NULL, 0);