backend-drm: skip EDID parsing if no change

Performance-wise this is moot, but since we are detecting if the raw
EDID data changed, might as well use it.

Now we have a path where the head's device_changed is almost guaranteed
since EDID changed, and that's useful for the next patch.

We can only do this, because the core initializes a head with values
that we would be setting anyway when EDID is missing, e.g. disconnected
head on compositor start-up.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2023-08-31 15:23:25 +03:00
parent 2c0a9c064a
commit fc0a74a4c9
1 changed files with 15 additions and 11 deletions

View File

@ -613,18 +613,7 @@ update_head_from_connector(struct drm_head *head)
struct drm_connector *connector = &head->connector;
drmModeObjectProperties *props = connector->props_drm;
drmModeConnector *conn = connector->conn;
struct drm_head_info dhi = { .eotf_mask = WESTON_EOTF_MODE_SDR };
drm_head_maybe_update_display_data(head, props);
drm_head_info_from_edid(&dhi, head->display_data, head->display_data_len);
weston_head_set_monitor_strings(&head->base, dhi.make,
dhi.model,
dhi.serial_number);
prune_eotf_modes_by_kms_support(head, &dhi.eotf_mask);
weston_head_set_supported_eotf_mask(&head->base, dhi.eotf_mask);
weston_head_set_non_desktop(&head->base,
check_non_desktop(connector, props));
weston_head_set_subpixel(&head->base,
@ -639,6 +628,21 @@ update_head_from_connector(struct drm_head *head)
weston_head_set_connection_status(&head->base,
conn->connection == DRM_MODE_CONNECTED);
/* If EDID did not change, skip everything about it */
if (!drm_head_maybe_update_display_data(head, props))
return;
struct drm_head_info dhi = { .eotf_mask = WESTON_EOTF_MODE_SDR };
drm_head_info_from_edid(&dhi, head->display_data, head->display_data_len);
weston_head_set_monitor_strings(&head->base, dhi.make,
dhi.model,
dhi.serial_number);
prune_eotf_modes_by_kms_support(head, &dhi.eotf_mask);
weston_head_set_supported_eotf_mask(&head->base, dhi.eotf_mask);
drm_head_info_fini(&dhi);
}