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 <p.zabel@pengutronix.de>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
dev
Pekka Paalanen 7 years ago committed by Daniel Stone
parent ea40d6dbfc
commit cb2d8836c0
  1. 10
      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;
}

Loading…
Cancel
Save