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 <leandro.ribeiro@collabora.com>
dev
Leandro Ribeiro 4 years ago committed by Daniel Stone
parent 61f2e0273f
commit 2984f36c72
  1. 11
      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 =

Loading…
Cancel
Save