From cb2d8836c099e456eedc1f4ef0310d562e3b6fae Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Fri, 9 Feb 2018 12:29:09 +0200 Subject: [PATCH] compositor-drm: let repaint cycle disable crtcs Rather than smashing the state to disable a CRTC immediately, just delegate that to the normal repaint cycle by setting state_invalid = true. drm_pending_state_apply() will pick up the unused_crtcs. A caveat here is that we have no enabled outputs at all, we will never enter repaint, and so CRTCs do not actually get turned off until we get at least one output to drive. However, this should help the problem reported here: https://lists.freedesktop.org/archives/wayland-devel/2018-January/036713.html Arguably it is better to leave an output spuriously on in rare cases rather than fail modeset completely in somewhat more common cases. My personal motivation for this change is that it helps if we later move CRTC allocation to output enable/deinit instead of create/destroy, because then the CRTC will not be available here for initial turn-off as the output has not been enabled to begin with. Cc: Philipp Zabel Signed-off-by: Pekka Paalanen Reviewed-by: Daniel Stone --- libweston/compositor-drm.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c index eb8b8ff..c21b117 100644 --- a/libweston/compositor-drm.c +++ b/libweston/compositor-drm.c @@ -4742,8 +4742,6 @@ drm_output_disable(struct weston_output *base) { struct drm_output *output = to_drm_output(base); struct drm_backend *b = to_drm_backend(base->compositor); - struct drm_pending_state *pending_state; - int ret; if (output->page_flip_pending || output->vblank_pending || output->atomic_complete_pending) { @@ -4752,17 +4750,15 @@ drm_output_disable(struct weston_output *base) } weston_log("Disabling output %s\n", output->base.name); - pending_state = drm_pending_state_alloc(b); - drm_output_get_disable_state(pending_state, output); - ret = drm_pending_state_apply_sync(pending_state); - if (ret) - weston_log("Couldn't disable output %s\n", output->base.name); if (output->base.enabled) drm_output_deinit(&output->base); output->disable_pending = 0; + /* Force resetting unused connectors and crtcs. */ + b->state_invalid = true; + return 0; } -- 2.7.4