From 00b74293e8b20b3ea19a5f8fa7b89ee00ed0422f Mon Sep 17 00:00:00 2001 From: Michael Tretter Date: Mon, 22 Nov 2021 16:50:35 +0100 Subject: [PATCH] backend-drm: use pixel format to print gbm format The gbm_format is the same as the drm format used by the pixel format. Print the format name using the pixel format in the error message to make the error message easier to understand for humans. Signed-off-by: Michael Tretter --- libweston/backend-drm/drm-gbm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libweston/backend-drm/drm-gbm.c b/libweston/backend-drm/drm-gbm.c index d0a4c6ca..3ed96091 100644 --- a/libweston/backend-drm/drm-gbm.c +++ b/libweston/backend-drm/drm-gbm.c @@ -183,6 +183,7 @@ create_gbm_surface(struct gbm_device *gbm, struct drm_output *output) { struct weston_mode *mode = output->base.current_mode; struct drm_plane *plane = output->scanout_plane; + const struct pixel_format_info *pixel_format; struct weston_drm_format *fmt; const uint64_t *modifiers; unsigned int num_modifiers; @@ -190,8 +191,15 @@ create_gbm_surface(struct gbm_device *gbm, struct drm_output *output) fmt = weston_drm_format_array_find_format(&plane->formats, output->gbm_format); if (!fmt) { - weston_log("format 0x%x not supported by output %s\n", - output->gbm_format, output->base.name); + pixel_format = pixel_format_get_info(output->gbm_format); + if (pixel_format) + weston_log("format %s not supported by output %s\n", + pixel_format->drm_format_name, + output->base.name); + else + weston_log("format 0x%x not supported by output %s\n", + output->gbm_format, + output->base.name); return; }