From bafea13e950d70e93dfd89e49975292b3fcbc780 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Fri, 28 Jul 2023 15:41:49 +0800 Subject: [PATCH] kms/impl-device: Handle empty updates properly This fixes freezes on cursor movement when: 1. meta_onscreen_native_finish_frame would create an empty update. 2. maybe_update_cursor_plane would leave it empty (!cursor_invalidated). 3. do_process would fail to recognise a non-null empty update as an error. 4. meta_kms_impl_device_handle_update would fail to send feedback on errors from do_process, because do_process is meant to do it. 5. Page flip listeners would wait forever for feedback that never comes. Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2923, https://gitlab.gnome.org/GNOME/mutter/-/issues/2924, https://gitlab.gnome.org/GNOME/mutter/-/issues/2926, https://gitlab.gnome.org/GNOME/mutter/-/issues/2933 Part-of: --- src/backends/native/meta-kms-impl-device.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/backends/native/meta-kms-impl-device.c b/src/backends/native/meta-kms-impl-device.c index b48dc705e..0f0dd271b 100644 --- a/src/backends/native/meta-kms-impl-device.c +++ b/src/backends/native/meta-kms-impl-device.c @@ -1214,14 +1214,22 @@ do_process (MetaKmsImplDevice *impl_device, update = meta_kms_impl_filter_update (impl, latch_crtc, update, flags); - if (!update) + if (!update || meta_kms_update_is_empty (update)) { GError *error; error = g_error_new (META_KMS_ERROR, META_KMS_ERROR_EMPTY_UPDATE, "Empty update"); - return meta_kms_feedback_new_failed (NULL, error); + feedback = meta_kms_feedback_new_failed (NULL, error); + + if (update) + { + queue_result_feedback (impl_device, update, feedback); + meta_kms_update_free (update); + } + + return feedback; } if (!(flags & META_KMS_UPDATE_FLAG_TEST_ONLY))