[PATCH weston 2/2] compositor-drm: move state_invalid setting to deinit

Pekka Paalanen ppaalanen at gmail.com
Fri Feb 9 10:29:10 UTC 2018


From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

Setting state_invalid to true is moved together with the code adding new
unused CRTCs and connectors in drm_output_deinit(). Logically these two
operations belong together: state_invalid is required for the new unused
item to be turned off.

This does not hinder initial turning off of outputs, because on
compositor start-up, state_invalid is initialized to true, making calls
to drm_output_disable() for non-enabled outputs a no-op.

Previous changes already ensure that if a compositor does not explicitly
enable an output, the CRTC and connector will be turned off even without
an explicit disable (provided there is a at least one enabled output).

Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
 libweston/compositor-drm.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index b1dbacbd..ebf9a4ab 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -4676,6 +4676,9 @@ drm_output_deinit(struct weston_output *base)
 	*unused = output->connector_id;
 	unused = wl_array_add(&b->unused_crtcs, sizeof(*unused));
 	*unused = output->crtc_id;
+
+	/* Force programming unused connectors and crtcs. */
+	b->state_invalid = true;
 }
 
 static void
@@ -4741,7 +4744,6 @@ static int
 drm_output_disable(struct weston_output *base)
 {
 	struct drm_output *output = to_drm_output(base);
-	struct drm_backend *b = to_drm_backend(base->compositor);
 
 	if (output->page_flip_pending || output->vblank_pending ||
 	    output->atomic_complete_pending) {
@@ -4756,9 +4758,6 @@ drm_output_disable(struct weston_output *base)
 
 	output->disable_pending = 0;
 
-	/* Force resetting unused connectors and crtcs. */
-	b->state_invalid = true;
-
 	return 0;
 }
 
-- 
2.13.6



More information about the wayland-devel mailing list