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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3138>
This commit is contained in:
Daniel van Vugt 2023-07-28 15:41:49 +08:00
parent b516b009fa
commit bafea13e95

View File

@ -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))