kms/update: Merge connector updates too

This includes privacy screen updates, underscanning etc; this is needed
when merging mode set updates that happen to change these too, which is
rather likely.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2881>
This commit is contained in:
Jonas Ådahl
2023-03-02 22:09:16 +01:00
parent 907e17ac25
commit ffd1e8106c
3 changed files with 93 additions and 2 deletions

View File

@ -844,6 +844,69 @@ merge_crtc_color_updates_from (MetaKmsUpdate *update,
}
}
static GList *
find_connector_update_link_for (MetaKmsUpdate *update,
MetaKmsConnector *connector)
{
GList *l;
for (l = update->connector_updates; l; l = l->next)
{
MetaKmsConnectorUpdate *connector_update = l->data;
if (connector_update->connector == connector)
return l;
}
return NULL;
}
static void
merge_connector_updates_from (MetaKmsUpdate *update,
MetaKmsUpdate *other_update)
{
while (other_update->connector_updates)
{
GList *l = other_update->connector_updates;
MetaKmsConnectorUpdate *other_connector_update = l->data;
MetaKmsConnector *connector = other_connector_update->connector;
GList *el;
other_update->connector_updates =
g_list_remove_link (other_update->connector_updates, l);
el = find_connector_update_link_for (update, connector);
if (el)
{
MetaKmsConnectorUpdate *connector_update = el->data;
if (other_connector_update->underscanning.has_update)
{
connector_update->underscanning =
other_connector_update->underscanning;
}
if (other_connector_update->privacy_screen.has_update)
{
connector_update->privacy_screen =
other_connector_update->privacy_screen;
}
if (other_connector_update->max_bpc.has_update)
{
connector_update->max_bpc =
other_connector_update->max_bpc;
}
}
else
{
update->connector_updates =
g_list_insert_before_link (update->connector_updates,
update->connector_updates,
l);
}
}
}
static void
merge_custom_page_flip_from (MetaKmsUpdate *update,
MetaKmsUpdate *other_update)
@ -880,12 +943,11 @@ meta_kms_update_merge_from (MetaKmsUpdate *update,
MetaKmsUpdate *other_update)
{
g_return_if_fail (update->device == other_update->device);
g_return_if_fail (!update->connector_updates &&
!other_update->connector_updates);
merge_mode_sets (update, other_update);
merge_plane_assignments_from (update, other_update);
merge_crtc_color_updates_from (update, other_update);
merge_connector_updates_from (update, other_update);
merge_custom_page_flip_from (update, other_update);
merge_page_flip_listeners_from (update, other_update);
merge_result_listeners_from (update, other_update);

View File

@ -104,6 +104,7 @@ void meta_kms_update_free (MetaKmsUpdate *update);
META_EXPORT_TEST
MetaKmsDevice * meta_kms_update_get_device (MetaKmsUpdate *update);
META_EXPORT_TEST
void meta_kms_update_set_underscanning (MetaKmsUpdate *update,
MetaKmsConnector *connector,
uint64_t hborder,
@ -112,10 +113,12 @@ void meta_kms_update_set_underscanning (MetaKmsUpdate *update,
void meta_kms_update_unset_underscanning (MetaKmsUpdate *update,
MetaKmsConnector *connector);
META_EXPORT_TEST
void meta_kms_update_set_privacy_screen (MetaKmsUpdate *update,
MetaKmsConnector *connector,
gboolean enabled);
META_EXPORT_TEST
void meta_kms_update_set_max_bpc (MetaKmsUpdate *update,
MetaKmsConnector *connector,
uint64_t max_bpc);