Commit 5c8eef14 authored by Philipp Zabel's avatar Philipp Zabel

compositor-drm: clear gbm_surface pointer after destroying the GBM surface

Since commit ee1d968e ("compositor-drm: Fall back if GBM surface fails with
modifiers"), drm_output_init_egl requires output->gbm_surface to be NULL, or
gbm_surface_create will not be called if HAVE_GBM_MODIFIERS is enabled but no
modifiers are supported by the plane. This could happen if _init_egl is called
after drm_ouptut_fini_egl drom drm_output_switch_mode.

Add an assert to guarantee the requirement and clears the gbm_surface pointer
after the surface is destroyed.
Signed-off-by: default avatarPhilipp Zabel <>
parent 2293cb42
......@@ -5045,6 +5045,8 @@ drm_output_init_egl(struct drm_output *output, struct drm_backend *b)
struct drm_plane *plane = output->scanout_plane;
unsigned int i;
assert(output->gbm_surface == NULL);
for (i = 0; i < plane->count_formats; i++) {
if (plane->formats[i].format == output->gbm_format)
......@@ -5094,6 +5096,7 @@ drm_output_init_egl(struct drm_output *output, struct drm_backend *b)
n_formats) < 0) {
weston_log("failed to create gl renderer output state\n");
output->gbm_surface = NULL;
return -1;
......@@ -5120,6 +5123,7 @@ drm_output_fini_egl(struct drm_output *output)
output->gbm_surface = NULL;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment