[PATCH weston v6 46/73] compositor-drm: use head_find_by_connector in update_unused_outputs

Pekka Paalanen ppaalanen at gmail.com
Fri Feb 16 14:57:31 UTC 2018


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

Making this function not depend on drm_head::output field through
drm_output_find_by_connector() will later allow to remove the
drm_head::output field before removing the unused_connectors array. This
helps keeping the commit more fine-grained.

drm_backend_update_unused_outputs() was only interested in enabled
outputs. The new code is 100% equivalent to the old code. The
difference is that weston_head::output is only set for attached heads. A
connector cannot be in use if it is not attached to an output.

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

diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 78fce5d6..67fda913 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -4959,11 +4959,11 @@ drm_backend_update_unused_outputs(struct drm_backend *b, drmModeRes *resources)
 	wl_array_init(&b->unused_connectors);
 
 	for (i = 0; i < resources->count_connectors; i++) {
-		struct drm_output *output;
+		struct drm_head *head;
 		uint32_t *connector_id;
 
-		output = drm_output_find_by_connector(b, resources->connectors[i]);
-		if (output && output->base.enabled)
+		head = drm_head_find_by_connector(b, resources->connectors[i]);
+		if (head && weston_head_is_enabled(&head->base))
 			continue;
 
 		connector_id = wl_array_add(&b->unused_connectors,
-- 
2.13.6



More information about the wayland-devel mailing list