From 2984f36c728c5b67ceb36d4fc3311172d2ca0b89 Mon Sep 17 00:00:00 2001 From: Leandro Ribeiro Date: Thu, 21 Jan 2021 14:04:25 -0300 Subject: [PATCH] backend-drm: set plane format to gbm_format at the appropriate time In the absence of universal planes support, drm_output_find_special_plane() sets the plane format to zero as a placeholder. Then in drm_output_init_planes() it sets the format to output->gbm_format. As output->gbm_format is already set by the time we call drm_output_find_special_plane(), simply set the plane format to it directly in this function. This makes the code clearer, as there is no reason to use the placeholder. Signed-off-by: Leandro Ribeiro --- libweston/backend-drm/drm.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c index abfcabd3..82f6ee29 100644 --- a/libweston/backend-drm/drm.c +++ b/libweston/backend-drm/drm.c @@ -887,9 +887,8 @@ drm_output_find_special_plane(struct drm_backend *b, struct drm_output *output, case WDRM_PLANE_TYPE_PRIMARY: /* We don't know what formats the primary plane supports * before universal planes, so we just assume that the - * GBM format works; however, this isn't set until after - * the output is created. */ - format = 0; + * GBM format works. */ + format = output->gbm_format; break; default: assert(!"invalid type in drm_output_find_special_plane"); @@ -1681,12 +1680,6 @@ drm_output_init_planes(struct drm_output *output) &output->scanout_plane->base, &b->compositor->primary_plane); - /* Without universal planes, we can't discover which formats are - * supported by the primary plane; we just hope that the GBM format - * works. */ - if (!b->universal_planes) - output->scanout_plane->formats[0].format = output->gbm_format; - /* Failing to find a cursor plane is not fatal, as we'll fall back * to software cursor. */ output->cursor_plane =