1
0
Fork 0

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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3210>
This commit is contained in:
Daniel van Vugt 2023-08-24 17:49:26 +08:00 committed by Marge Bot
parent fac0d05762
commit 444e241ab4

View file

@ -1547,29 +1547,30 @@ meta_kms_impl_device_schedule_process (MetaKmsImplDevice *impl_device,
MetaKmsCrtc *crtc) MetaKmsCrtc *crtc)
{ {
CrtcFrame *crtc_frame; CrtcFrame *crtc_frame;
g_autoptr (GError) error = NULL;
MetaKmsImplDevicePrivate *priv;
crtc_frame = ensure_crtc_frame (impl_device, crtc); crtc_frame = ensure_crtc_frame (impl_device, crtc);
if (crtc_frame->pending_page_flip)
return;
if (crtc_frame->await_flush) if (crtc_frame->await_flush)
return; return;
if (is_using_deadline_timer (impl_device)) if (!is_using_deadline_timer (impl_device))
{ goto needs_flush;
g_autoptr (GError) error = NULL;
MetaKmsImplDevicePrivate *priv =
meta_kms_impl_device_get_instance_private (impl_device);
if (ensure_deadline_timer_armed (impl_device, crtc_frame, &error)) if (crtc_frame->pending_page_flip)
return; return;
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) if (ensure_deadline_timer_armed (impl_device, crtc_frame, &error))
g_warning ("Failed to determine deadline: %s", error->message); 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); meta_kms_device_set_needs_flush (meta_kms_crtc_get_device (crtc), crtc);
} }