From 6794164bd9bb23c98ce6c65c524b0c1cb7bfd838 Mon Sep 17 00:00:00 2001 From: Leandro Ribeiro Date: Tue, 15 Sep 2020 00:11:02 -0300 Subject: [PATCH] drm-backend: move drm_head management from drm_connector_assign_connector_info() to drm_head_update_info() The function drm_connector_assign_connector_info() should not be calling functions to handle drm_head, as connectors and heads are not the same thing after patch "drm-backend: move connector data from struct drm_head to struct drm_connector". Move drm_head specific calls to drm_head_update_info(). This is more in line with the hierarchy of the objects and also allow us to drop drm_head pointer from drm_connector. Signed-off-by: Leandro Ribeiro --- libweston/backend-drm/drm-internal.h | 1 - libweston/backend-drm/drm.c | 21 +++++++-------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h index bc2ffca8..dd216368 100644 --- a/libweston/backend-drm/drm-internal.h +++ b/libweston/backend-drm/drm-internal.h @@ -468,7 +468,6 @@ struct drm_plane { struct drm_connector { struct drm_backend *backend; - struct drm_head *head; drmModeConnector *conn; uint32_t connector_id; diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c index 3630229a..ff1f78f4 100644 --- a/libweston/backend-drm/drm.c +++ b/libweston/backend-drm/drm.c @@ -2018,8 +2018,6 @@ drm_connector_update_properties(struct drm_connector *connector) * @return 0 on success, -1 on failure. * * Takes ownership of @c connector on success, not on failure. - * - * May schedule a heads changed call if this connector is owned by a head */ static int drm_connector_assign_connector_info(struct drm_connector *connector, @@ -2039,13 +2037,6 @@ drm_connector_assign_connector_info(struct drm_connector *connector, drm_property_info_populate(connector->backend, connector_props, connector->props, WDRM_CONNECTOR__COUNT, connector->props_drm); - - if (connector->head != NULL) { - update_head_from_connector(connector->head); - weston_head_set_content_protection_status(&connector->head->base, - drm_head_get_current_protection(connector->head)); - } - return 0; } @@ -2056,7 +2047,6 @@ drm_connector_init(struct drm_backend *b, struct drm_connector *connector, connector->backend = b; connector->connector_id = connector_id; connector->conn = NULL; - connector->head = NULL; connector->props_drm = NULL; } @@ -2099,6 +2089,10 @@ drm_head_update_info(struct drm_head *head, drmModeConnector *conn) ret = drm_connector_assign_connector_info(&head->connector, conn); + update_head_from_connector(head); + weston_head_set_content_protection_status(&head->base, + drm_head_get_current_protection(head)); + if (head->base.device_changed) drm_head_log_info(head, "updated"); @@ -2131,7 +2125,6 @@ drm_head_create(struct drm_backend *backend, drmModeConnector *conn, head->backend = backend; drm_connector_init(backend, &head->connector, conn->connector_id); - head->connector.head = head; name = make_connector_name(conn); if (!name) @@ -2140,9 +2133,9 @@ drm_head_create(struct drm_backend *backend, drmModeConnector *conn, weston_head_init(&head->base, name); free(name); - ret = drm_connector_assign_connector_info(&head->connector, conn); + ret = drm_head_update_info(head, conn); if (ret < 0) - goto err_assign; + goto err_update; head->backlight = backlight_init(drm_device, conn->connector_type); @@ -2161,7 +2154,7 @@ drm_head_create(struct drm_backend *backend, drmModeConnector *conn, return 0; -err_assign: +err_update: weston_head_release(&head->base); err: drm_connector_fini(&head->connector);