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 <leandro.ribeiro@collabora.com>
dev
Leandro Ribeiro 4 years ago committed by Pekka Paalanen
parent 7086396f75
commit 6794164bd9
  1. 1
      libweston/backend-drm/drm-internal.h
  2. 21
      libweston/backend-drm/drm.c

@ -468,7 +468,6 @@ struct drm_plane {
struct drm_connector { struct drm_connector {
struct drm_backend *backend; struct drm_backend *backend;
struct drm_head *head;
drmModeConnector *conn; drmModeConnector *conn;
uint32_t connector_id; uint32_t connector_id;

@ -2018,8 +2018,6 @@ drm_connector_update_properties(struct drm_connector *connector)
* @return 0 on success, -1 on failure. * @return 0 on success, -1 on failure.
* *
* Takes ownership of @c connector on success, not 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 static int
drm_connector_assign_connector_info(struct drm_connector *connector, 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, drm_property_info_populate(connector->backend, connector_props,
connector->props, connector->props,
WDRM_CONNECTOR__COUNT, connector->props_drm); 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; return 0;
} }
@ -2056,7 +2047,6 @@ drm_connector_init(struct drm_backend *b, struct drm_connector *connector,
connector->backend = b; connector->backend = b;
connector->connector_id = connector_id; connector->connector_id = connector_id;
connector->conn = NULL; connector->conn = NULL;
connector->head = NULL;
connector->props_drm = 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); 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) if (head->base.device_changed)
drm_head_log_info(head, "updated"); drm_head_log_info(head, "updated");
@ -2131,7 +2125,6 @@ drm_head_create(struct drm_backend *backend, drmModeConnector *conn,
head->backend = backend; head->backend = backend;
drm_connector_init(backend, &head->connector, conn->connector_id); drm_connector_init(backend, &head->connector, conn->connector_id);
head->connector.head = head;
name = make_connector_name(conn); name = make_connector_name(conn);
if (!name) if (!name)
@ -2140,9 +2133,9 @@ drm_head_create(struct drm_backend *backend, drmModeConnector *conn,
weston_head_init(&head->base, name); weston_head_init(&head->base, name);
free(name); free(name);
ret = drm_connector_assign_connector_info(&head->connector, conn); ret = drm_head_update_info(head, conn);
if (ret < 0) if (ret < 0)
goto err_assign; goto err_update;
head->backlight = backlight_init(drm_device, conn->connector_type); head->backlight = backlight_init(drm_device, conn->connector_type);
@ -2161,7 +2154,7 @@ drm_head_create(struct drm_backend *backend, drmModeConnector *conn,
return 0; return 0;
err_assign: err_update:
weston_head_release(&head->base); weston_head_release(&head->base);
err: err:
drm_connector_fini(&head->connector); drm_connector_fini(&head->connector);

Loading…
Cancel
Save