kms/update: Change lock() to seal()

At first it was called seal(), but then updates could be amended after
being posted, given a flag. That flag has been removed, so we can go
back to sealing, since it's once again acts more as a seal.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2854>
This commit is contained in:
Jonas Ådahl 2022-06-13 22:43:57 +02:00 committed by Marge Bot
parent 02b1cfe08f
commit b1b9a9aac1
5 changed files with 20 additions and 28 deletions

View File

@ -309,6 +309,8 @@ meta_kms_device_process_update_sync (MetaKmsDevice *device,
MetaKms *kms = META_KMS (meta_kms_device_get_kms (device)); MetaKms *kms = META_KMS (meta_kms_device_get_kms (device));
PostUpdateData data; PostUpdateData data;
meta_kms_update_seal (update);
data = (PostUpdateData) { data = (PostUpdateData) {
.update = update, .update = update,
.flags = flags, .flags = flags,

View File

@ -140,12 +140,10 @@ MetaKmsFeedback * meta_kms_feedback_new_passed (GList *failed_planes);
MetaKmsFeedback * meta_kms_feedback_new_failed (GList *failed_planes, MetaKmsFeedback * meta_kms_feedback_new_failed (GList *failed_planes,
GError *error); GError *error);
void meta_kms_update_lock (MetaKmsUpdate *update); void meta_kms_update_seal (MetaKmsUpdate *update);
void meta_kms_update_unlock (MetaKmsUpdate *update);
META_EXPORT_TEST META_EXPORT_TEST
gboolean meta_kms_update_is_locked (MetaKmsUpdate *update); gboolean meta_kms_update_is_sealed (MetaKmsUpdate *update);
META_EXPORT_TEST META_EXPORT_TEST
MetaKmsDevice * meta_kms_update_get_device (MetaKmsUpdate *update); MetaKmsDevice * meta_kms_update_get_device (MetaKmsUpdate *update);

View File

@ -32,7 +32,7 @@ struct _MetaKmsUpdate
{ {
MetaKmsDevice *device; MetaKmsDevice *device;
gboolean is_locked; gboolean is_sealed;
GList *mode_sets; GList *mode_sets;
GList *plane_assignments; GList *plane_assignments;
@ -224,7 +224,7 @@ meta_kms_update_assign_plane (MetaKmsUpdate *update,
MetaKmsPlaneAssignment *plane_assignment; MetaKmsPlaneAssignment *plane_assignment;
MetaKmsAssignPlaneFlag old_flags; MetaKmsAssignPlaneFlag old_flags;
g_assert (!meta_kms_update_is_locked (update)); g_assert (!meta_kms_update_is_sealed (update));
g_assert (meta_kms_crtc_get_device (crtc) == update->device); g_assert (meta_kms_crtc_get_device (crtc) == update->device);
g_assert (meta_kms_plane_get_device (plane) == update->device); g_assert (meta_kms_plane_get_device (plane) == update->device);
g_assert (meta_kms_plane_get_plane_type (plane) != g_assert (meta_kms_plane_get_plane_type (plane) !=
@ -261,7 +261,7 @@ meta_kms_update_unassign_plane (MetaKmsUpdate *update,
{ {
MetaKmsPlaneAssignment *plane_assignment; MetaKmsPlaneAssignment *plane_assignment;
g_assert (!meta_kms_update_is_locked (update)); g_assert (!meta_kms_update_is_sealed (update));
g_assert (meta_kms_crtc_get_device (crtc) == update->device); g_assert (meta_kms_crtc_get_device (crtc) == update->device);
g_assert (meta_kms_plane_get_device (plane) == update->device); g_assert (meta_kms_plane_get_device (plane) == update->device);
@ -287,7 +287,7 @@ meta_kms_update_mode_set (MetaKmsUpdate *update,
{ {
MetaKmsModeSet *mode_set; MetaKmsModeSet *mode_set;
g_assert (!meta_kms_update_is_locked (update)); g_assert (!meta_kms_update_is_sealed (update));
g_assert (meta_kms_crtc_get_device (crtc) == update->device); g_assert (meta_kms_crtc_get_device (crtc) == update->device);
mode_set = g_new0 (MetaKmsModeSet, 1); mode_set = g_new0 (MetaKmsModeSet, 1);
@ -332,7 +332,7 @@ meta_kms_update_set_underscanning (MetaKmsUpdate *update,
{ {
MetaKmsConnectorUpdate *connector_update; MetaKmsConnectorUpdate *connector_update;
g_assert (!meta_kms_update_is_locked (update)); g_assert (!meta_kms_update_is_sealed (update));
g_assert (meta_kms_connector_get_device (connector) == update->device); g_assert (meta_kms_connector_get_device (connector) == update->device);
connector_update = ensure_connector_update (update, connector); connector_update = ensure_connector_update (update, connector);
@ -348,7 +348,7 @@ meta_kms_update_unset_underscanning (MetaKmsUpdate *update,
{ {
MetaKmsConnectorUpdate *connector_update; MetaKmsConnectorUpdate *connector_update;
g_assert (!meta_kms_update_is_locked (update)); g_assert (!meta_kms_update_is_sealed (update));
g_assert (meta_kms_connector_get_device (connector) == update->device); g_assert (meta_kms_connector_get_device (connector) == update->device);
connector_update = ensure_connector_update (update, connector); connector_update = ensure_connector_update (update, connector);
@ -417,7 +417,7 @@ meta_kms_update_set_crtc_gamma (MetaKmsUpdate *update,
MetaGammaLut *gamma_update = NULL; MetaGammaLut *gamma_update = NULL;
const MetaKmsCrtcState *crtc_state = meta_kms_crtc_get_current_state (crtc); const MetaKmsCrtcState *crtc_state = meta_kms_crtc_get_current_state (crtc);
g_assert (!meta_kms_update_is_locked (update)); g_assert (!meta_kms_update_is_sealed (update));
g_assert (meta_kms_crtc_get_device (crtc) == update->device); g_assert (meta_kms_crtc_get_device (crtc) == update->device);
if (gamma) if (gamma)
@ -445,7 +445,7 @@ meta_kms_update_add_page_flip_listener (MetaKmsUpdate *upd
{ {
MetaKmsPageFlipListener *listener; MetaKmsPageFlipListener *listener;
g_assert (!meta_kms_update_is_locked (update)); g_assert (!meta_kms_update_is_sealed (update));
g_assert (meta_kms_crtc_get_device (crtc) == update->device); g_assert (meta_kms_crtc_get_device (crtc) == update->device);
listener = g_new0 (MetaKmsPageFlipListener, 1); listener = g_new0 (MetaKmsPageFlipListener, 1);
@ -469,7 +469,7 @@ meta_kms_update_set_custom_page_flip (MetaKmsUpdate *update,
{ {
MetaKmsCustomPageFlip *custom_page_flip; MetaKmsCustomPageFlip *custom_page_flip;
g_assert (!meta_kms_update_is_locked (update)); g_assert (!meta_kms_update_is_sealed (update));
custom_page_flip = g_new0 (MetaKmsCustomPageFlip, 1); custom_page_flip = g_new0 (MetaKmsCustomPageFlip, 1);
custom_page_flip->func = func; custom_page_flip->func = func;
@ -509,7 +509,7 @@ void
meta_kms_plane_assignment_set_rotation (MetaKmsPlaneAssignment *plane_assignment, meta_kms_plane_assignment_set_rotation (MetaKmsPlaneAssignment *plane_assignment,
MetaKmsPlaneRotation rotation) MetaKmsPlaneRotation rotation)
{ {
g_assert (!meta_kms_update_is_locked (plane_assignment->update)); g_assert (!meta_kms_update_is_sealed (plane_assignment->update));
g_warn_if_fail (rotation); g_warn_if_fail (rotation);
plane_assignment->rotation = rotation; plane_assignment->rotation = rotation;
@ -630,21 +630,17 @@ meta_kms_update_get_crtc_color_updates (MetaKmsUpdate *update)
} }
void void
meta_kms_update_lock (MetaKmsUpdate *update) meta_kms_update_seal (MetaKmsUpdate *update)
{ {
update->is_locked = TRUE; g_warn_if_fail (!update->is_sealed);
}
void update->is_sealed = TRUE;
meta_kms_update_unlock (MetaKmsUpdate *update)
{
update->is_locked = FALSE;
} }
gboolean gboolean
meta_kms_update_is_locked (MetaKmsUpdate *update) meta_kms_update_is_sealed (MetaKmsUpdate *update)
{ {
return update->is_locked; return update->is_sealed;
} }
MetaKmsDevice * MetaKmsDevice *

View File

@ -264,8 +264,6 @@ meta_kms_post_pending_update_sync (MetaKms *kms,
if (!update) if (!update)
return NULL; return NULL;
meta_kms_update_lock (update);
feedback = meta_kms_device_process_update_sync (device, update, flags); feedback = meta_kms_device_process_update_sync (device, update, flags);
result_listeners = meta_kms_update_take_result_listeners (update); result_listeners = meta_kms_update_take_result_listeners (update);
@ -295,8 +293,6 @@ meta_kms_post_test_update_sync (MetaKms *kms,
g_assert (!meta_kms_update_get_mode_sets (update)); g_assert (!meta_kms_update_get_mode_sets (update));
g_assert (!meta_kms_update_get_connector_updates (update)); g_assert (!meta_kms_update_get_connector_updates (update));
meta_kms_update_lock (update);
flags = META_KMS_UPDATE_FLAG_TEST_ONLY; flags = META_KMS_UPDATE_FLAG_TEST_ONLY;
return meta_kms_device_process_update_sync (device, update, flags); return meta_kms_device_process_update_sync (device, update, flags);
} }

View File

@ -66,7 +66,7 @@ meta_test_kms_update_sanity (void)
update = meta_kms_update_new (device); update = meta_kms_update_new (device);
g_assert (meta_kms_update_get_device (update) == device); g_assert (meta_kms_update_get_device (update) == device);
g_assert_false (meta_kms_update_is_locked (update)); g_assert_false (meta_kms_update_is_sealed (update));
g_assert_null (meta_kms_update_get_primary_plane_assignment (update, crtc)); g_assert_null (meta_kms_update_get_primary_plane_assignment (update, crtc));
g_assert_null (meta_kms_update_get_plane_assignments (update)); g_assert_null (meta_kms_update_get_plane_assignments (update));
g_assert_null (meta_kms_update_get_mode_sets (update)); g_assert_null (meta_kms_update_get_mode_sets (update));