onscreen/native: Avoid freezing the frame clock on failed cursor commits

Since 73fb64cbb6 we have preferred to handle failed updates via callback
but the cursor-only update path was forgotten and so wasn't getting frame
notifications. And so the frame clock would freeze.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2691
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2933>
This commit is contained in:
Daniel van Vugt 2023-03-24 17:01:10 +08:00 committed by Marge Bot
parent b215a65776
commit 61801a713a

View File

@ -1525,6 +1525,29 @@ meta_onscreen_native_prepare_frame (CoglOnscreen *onscreen,
}
}
static void
on_finish_frame_update_result (const MetaKmsFeedback *kms_feedback,
gpointer user_data)
{
CoglOnscreen *onscreen = COGL_ONSCREEN (user_data);
const GError *error;
CoglFrameInfo *frame_info;
error = meta_kms_feedback_get_error (kms_feedback);
if (!error)
return;
if (!g_error_matches (error,
G_IO_ERROR,
G_IO_ERROR_PERMISSION_DENIED))
g_warning ("Cursor update failed: %s", error->message);
frame_info = cogl_onscreen_peek_head_frame_info (onscreen);
frame_info->flags |= COGL_FRAME_INFO_FLAG_SYMBOLIC;
meta_onscreen_native_notify_frame_complete (onscreen);
}
void
meta_onscreen_native_finish_frame (CoglOnscreen *onscreen,
ClutterFrame *frame)
@ -1544,6 +1567,10 @@ meta_onscreen_native_finish_frame (CoglOnscreen *onscreen,
return;
}
meta_kms_update_add_result_listener (kms_update,
on_finish_frame_update_result,
onscreen_native);
meta_kms_update_add_page_flip_listener (kms_update,
kms_crtc,
&page_flip_listener_vtable,