From 51ff3fa1940c69390d2f3a6d16f85f0daa15b6ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 10 Jun 2022 18:25:25 +0200 Subject: [PATCH] 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: --- src/backends/native/meta-onscreen-native.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/backends/native/meta-onscreen-native.c b/src/backends/native/meta-onscreen-native.c index c55de436f..06f0cb427 100644 --- a/src/backends/native/meta-onscreen-native.c +++ b/src/backends/native/meta-onscreen-native.c @@ -145,6 +145,14 @@ meta_onscreen_native_swap_drm_fb (CoglOnscreen *onscreen) 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 maybe_update_frame_info (MetaCrtc *crtc, CoglFrameInfo *frame_info, @@ -327,7 +335,7 @@ page_flip_feedback_discarded (MetaKmsCrtc *kms_crtc, frame_info->flags |= COGL_FRAME_INFO_FLAG_SYMBOLIC; 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 = {