From 112cca75e2416a5ad9dd82d4b698666738c6ef85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 4 Aug 2023 14:50:22 +0200 Subject: [PATCH] kms/impl-device: Remove deadline timer arming from queue_update() queue_update() in a previous iteration was called in two situations: * A page flip was already pending, meaning if we would commit an update, it'd fail with EBUSY. * A update was marked as "always-defer" meaning it should only be processed from the deadline callback (would there be one). These were used for cursor-only updates. In the latter, we had to arm the deadline timer when queuing a new update, if it wasn't armed already, while in the former, we would currently idle, waiting for the page flip callback. At that callback would the deadline timer be re-armed again. Since we're only handling the former now, we'll never need to arm the timer again, so remove code doing so. The code removed were never actually executed anymore, after the "always-defer" flag on updates was removed. Fixes: 27ed069766 ("kms/impl-device: Add deadline based KMS commit scheduling") Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2940 Part-of: --- src/backends/native/meta-kms-impl-device.c | 41 ++-------------------- 1 file changed, 3 insertions(+), 38 deletions(-) diff --git a/src/backends/native/meta-kms-impl-device.c b/src/backends/native/meta-kms-impl-device.c index 0f0dd271b..d4ed82a6d 100644 --- a/src/backends/native/meta-kms-impl-device.c +++ b/src/backends/native/meta-kms-impl-device.c @@ -1411,36 +1411,13 @@ ensure_crtc_frame (MetaKmsImplDevice *impl_device, return crtc_frame; } -static gboolean +static void queue_update (MetaKmsImplDevice *impl_device, CrtcFrame *crtc_frame, MetaKmsUpdate *update) { - int64_t next_presentation_us = 0; - int64_t next_deadline_us = 0; - g_autoptr (GError) error = NULL; - g_assert (update); - if (is_using_deadline_timer (impl_device) && - !crtc_frame->deadline.armed) - { - if (!meta_kms_crtc_determine_deadline (crtc_frame->crtc, - &next_deadline_us, - &next_presentation_us, - &error)) - { - MetaKmsImplDevicePrivate *priv = - meta_kms_impl_device_get_instance_private (impl_device); - - if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) - g_warning ("Failed to determine deadline: %s", error->message); - - priv->deadline_timer_failed = TRUE; - return FALSE; - } - } - if (crtc_frame->pending_update) { meta_kms_update_merge_from (crtc_frame->pending_update, update); @@ -1450,18 +1427,6 @@ queue_update (MetaKmsImplDevice *impl_device, { crtc_frame->pending_update = update; } - - if (is_using_deadline_timer (impl_device) && - !crtc_frame->pending_page_flip && - !crtc_frame->await_flush && - next_deadline_us) - { - arm_crtc_frame_deadline_timer (crtc_frame, - next_deadline_us, - next_presentation_us); - } - - return TRUE; } void @@ -1511,8 +1476,8 @@ meta_kms_impl_device_handle_update (MetaKmsImplDevice *impl_device, meta_kms_crtc_get_id (latch_crtc), priv->path); - if (queue_update (impl_device, crtc_frame, update)) - return; + queue_update (impl_device, crtc_frame, update); + return; } if (crtc_frame->pending_update)