kms/impl-device: Let process() always take ownership of the update

This allows more freedom how to handle the update in the backends.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2855>
This commit is contained in:
Jonas Ådahl 2022-06-22 00:15:13 +02:00 committed by Robert Mader
parent f9802ca2a4
commit 6d043e6a8f
5 changed files with 7 additions and 12 deletions

View File

@ -1013,7 +1013,10 @@ meta_kms_impl_device_process_update (MetaKmsImplDevice *impl_device,
MetaKmsResourceChanges changes = META_KMS_RESOURCE_CHANGE_NONE;
if (!ensure_device_file (impl_device, &error))
{
meta_kms_update_free (update);
return meta_kms_feedback_new_failed (NULL, g_steal_pointer (&error));
}
meta_kms_impl_device_hold_fd (impl_device);
feedback = klass->process_update (impl_device, update, flags);
@ -1021,6 +1024,8 @@ meta_kms_impl_device_process_update (MetaKmsImplDevice *impl_device,
changes = meta_kms_impl_device_predict_states (impl_device, update);
meta_kms_impl_device_unhold_fd (impl_device);
meta_kms_update_free (update);
if (changes != META_KMS_RESOURCE_CHANGE_NONE)
{
MetaKms *kms = meta_kms_device_get_kms (priv->device);

View File

@ -282,12 +282,8 @@ meta_kms_post_pending_update_sync (MetaKms *kms,
if (!update)
return;
feedback = meta_kms_device_process_update_sync (device, update, flags);
result_listeners = meta_kms_update_take_result_listeners (update);
meta_kms_update_free (update);
feedback = meta_kms_device_process_update_sync (device, update, flags);
meta_kms_feedback_dispatch_result (feedback, kms, result_listeners);
}

View File

@ -1276,7 +1276,6 @@ meta_onscreen_native_is_buffer_scanout_compatible (CoglOnscreen *onscreen,
kms_feedback =
meta_kms_device_process_update_sync (kms_device, test_update,
META_KMS_UPDATE_FLAG_TEST_ONLY);
meta_kms_update_free (test_update);
result = meta_kms_feedback_get_result (kms_feedback);
return result == META_KMS_FEEDBACK_PASSED;

View File

@ -285,7 +285,6 @@ meta_test_kms_device_mode_set (void)
feedback = meta_kms_device_process_update_sync (device, update,
META_KMS_UPDATE_FLAG_NONE);
meta_kms_feedback_unref (feedback);
meta_kms_update_free (update);
g_assert_nonnull (meta_kms_crtc_get_current_state (crtc));
crtc_state = copy_crtc_state (meta_kms_crtc_get_current_state (crtc));
@ -350,7 +349,6 @@ meta_test_kms_device_power_save (void)
feedback = meta_kms_device_process_update_sync (device, update,
META_KMS_UPDATE_FLAG_NONE);
meta_kms_feedback_unref (feedback);
meta_kms_update_free (update);
g_assert_true (meta_kms_crtc_is_active (crtc));
@ -388,7 +386,6 @@ meta_test_kms_device_power_save (void)
feedback = meta_kms_device_process_update_sync (device, update,
META_KMS_UPDATE_FLAG_NONE);
meta_kms_feedback_unref (feedback);
meta_kms_update_free (update);
g_assert_true (meta_kms_crtc_is_active (crtc));
connector_state = meta_kms_connector_get_current_state (connector);

View File

@ -358,7 +358,6 @@ meta_test_kms_update_page_flip (void)
meta_kms_device_process_update_sync (device, update,
META_KMS_UPDATE_FLAG_NONE);
meta_kms_feedback_unref (feedback);
meta_kms_update_free (update);
g_main_loop_run (data.loop);
g_assert_cmpint (data.state, ==, DESTROYED);
@ -383,7 +382,6 @@ meta_test_kms_update_page_flip (void)
meta_kms_device_process_update_sync (device, update,
META_KMS_UPDATE_FLAG_NONE);
meta_kms_feedback_unref (feedback);
meta_kms_update_free (update);
g_main_loop_run (data.loop);
g_assert_cmpint (data.state, ==, DESTROYED);