onscreen/native: Don't swap the buffer if page flip failed

If a page flip failed, it means the current active framebuffer didn't
change, meaning we shouldn't swap it in mutter either.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2854>
This commit is contained in:
Jonas Ådahl 2022-06-10 18:25:25 +02:00 committed by Marge Bot
parent f6b75eef19
commit 51ff3fa194

View File

@ -145,6 +145,14 @@ meta_onscreen_native_swap_drm_fb (CoglOnscreen *onscreen)
g_clear_object (&onscreen_native->gbm.next_fb); g_clear_object (&onscreen_native->gbm.next_fb);
} }
static void
meta_onscreen_native_clear_next_fb (CoglOnscreen *onscreen)
{
MetaOnscreenNative *onscreen_native = META_ONSCREEN_NATIVE (onscreen);
g_clear_object (&onscreen_native->gbm.next_fb);
}
static void static void
maybe_update_frame_info (MetaCrtc *crtc, maybe_update_frame_info (MetaCrtc *crtc,
CoglFrameInfo *frame_info, CoglFrameInfo *frame_info,
@ -327,7 +335,7 @@ page_flip_feedback_discarded (MetaKmsCrtc *kms_crtc,
frame_info->flags |= COGL_FRAME_INFO_FLAG_SYMBOLIC; frame_info->flags |= COGL_FRAME_INFO_FLAG_SYMBOLIC;
meta_onscreen_native_notify_frame_complete (onscreen); meta_onscreen_native_notify_frame_complete (onscreen);
meta_onscreen_native_swap_drm_fb (onscreen); meta_onscreen_native_clear_next_fb (onscreen);
} }
static const MetaKmsPageFlipListenerVtable page_flip_listener_vtable = { static const MetaKmsPageFlipListenerVtable page_flip_listener_vtable = {