compositor-drm: let repaint cycle disable crtcs
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Fri, 9 Feb 2018 10:29:09 +0000 (12:29 +0200)
committerDaniel Stone <daniels@collabora.com>
Fri, 9 Feb 2018 15:45:46 +0000 (15:45 +0000)
commitcb2d8836c099e456eedc1f4ef0310d562e3b6fae
treed7393932fe89e87f9aedd1d677372fc7c21327e9
parentea40d6dbfc96c48046adb793e73ded80613ef944
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>
libweston/compositor-drm.c