From 444e241ab48e1da6b49498e69075ea917c312657 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Thu, 24 Aug 2023 17:49:26 +0800 Subject: [PATCH] kms/impl-device: Don't skip set_needs_flush during a page flip If the deadline timer is disabled (like on nvidia-drm or when `MUTTER_DEBUG_KMS_THREAD_TYPE=user`), then we need to call `meta_kms_device_set_needs_flush` on every cursor movement. But some were getting skipped if they coincided with page flips, which resulted in some cursor movements failing to schedule the frame clock. This resulted in unnecessary levels of frame skips when using lower frequency input devices which are less likely to provide another event within the same frame period. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3002 Part-of: --- src/backends/native/meta-kms-impl-device.c | 27 +++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/backends/native/meta-kms-impl-device.c b/src/backends/native/meta-kms-impl-device.c index 9b804f673..bd146e28a 100644 --- a/src/backends/native/meta-kms-impl-device.c +++ b/src/backends/native/meta-kms-impl-device.c @@ -1547,29 +1547,30 @@ meta_kms_impl_device_schedule_process (MetaKmsImplDevice *impl_device, MetaKmsCrtc *crtc) { CrtcFrame *crtc_frame; + g_autoptr (GError) error = NULL; + MetaKmsImplDevicePrivate *priv; crtc_frame = ensure_crtc_frame (impl_device, crtc); - if (crtc_frame->pending_page_flip) - return; if (crtc_frame->await_flush) return; - if (is_using_deadline_timer (impl_device)) - { - g_autoptr (GError) error = NULL; - MetaKmsImplDevicePrivate *priv = - meta_kms_impl_device_get_instance_private (impl_device); + if (!is_using_deadline_timer (impl_device)) + goto needs_flush; - if (ensure_deadline_timer_armed (impl_device, crtc_frame, &error)) - return; + if (crtc_frame->pending_page_flip) + return; - if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) - g_warning ("Failed to determine deadline: %s", error->message); + if (ensure_deadline_timer_armed (impl_device, crtc_frame, &error)) + return; - priv->deadline_timer_failed = TRUE; - } + if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) + g_warning ("Failed to determine deadline: %s", error->message); + priv = meta_kms_impl_device_get_instance_private (impl_device); + priv->deadline_timer_failed = TRUE; + +needs_flush: meta_kms_device_set_needs_flush (meta_kms_crtc_get_device (crtc), crtc); }