diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h index 3b0b5e2c..a944eb5b 100644 --- a/libweston/backend-drm/drm-internal.h +++ b/libweston/backend-drm/drm-internal.h @@ -536,6 +536,7 @@ struct drm_plane { uint32_t possible_crtcs; uint32_t plane_id; uint32_t plane_idx; + uint32_t crtc_id; struct drm_property_info props[WDRM_PLANE__COUNT]; diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c index d9311fb7..9873ea2f 100644 --- a/libweston/backend-drm/drm.c +++ b/libweston/backend-drm/drm.c @@ -1001,6 +1001,7 @@ drm_plane_create(struct drm_device *device, const drmModePlane *kplane) plane->state_cur->complete = true; plane->possible_crtcs = kplane->possible_crtcs; plane->plane_id = kplane->plane_id; + plane->crtc_id = kplane->crtc_id; weston_drm_format_array_init(&plane->formats); @@ -1117,6 +1118,14 @@ drm_output_find_special_plane(struct drm_device *device, if (found_elsewhere) continue; + /* If a plane already has a CRTC selected and it is not our + * output's CRTC, then do not select this plane. We cannot + * switch away a plane from a CTRC when active. */ + if ((type == WDRM_PLANE_TYPE_PRIMARY) && + (plane->crtc_id != 0) && + (plane->crtc_id != output->crtc->crtc_id)) + continue; + plane->possible_crtcs = (1 << output->crtc->pipe); return plane; }