mutter/0001-wayland-Fix-refresh-interval-reporting-in-presentati.patch
Jonas Ådahl d6c812eb3b Upgrade to 47.5
This also contains two additional patches backported from the gnome-47
branch.

Related: RHEL-74562
2025-02-12 16:27:14 +08:00

82 lines
3.0 KiB
Diff

From cadb4cdbb15a58cc38cc15cfe1ad457ffda7d7a0 Mon Sep 17 00:00:00 2001
From: Dudemanguy <random342@airmail.cc>
Date: Thu, 6 Feb 2025 08:21:16 -0600
Subject: [PATCH 1/2] wayland: Fix refresh interval reporting in
presentation-time version 1
Version 1 of the presentation protocol requires that 0 be sent for the
refresh rate for variable refresh rate. Fix this by checking the mode
during the presentation event.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4227>
---
src/wayland/meta-wayland-outputs.c | 6 ++++++
src/wayland/meta-wayland-outputs.h | 2 ++
src/wayland/meta-wayland-presentation-time.c | 13 ++++++++++++-
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/src/wayland/meta-wayland-outputs.c b/src/wayland/meta-wayland-outputs.c
index d860ac91f7..1c09f6f101 100644
--- a/src/wayland/meta-wayland-outputs.c
+++ b/src/wayland/meta-wayland-outputs.c
@@ -92,6 +92,12 @@ meta_wayland_output_get_monitor (MetaWaylandOutput *wayland_output)
return wayland_output->monitor;
}
+MetaMonitorMode *
+meta_wayland_output_get_monitor_mode (MetaWaylandOutput *wayland_output)
+{
+ return wayland_output->mode;
+}
+
static void
output_resource_destroy (struct wl_resource *res)
{
diff --git a/src/wayland/meta-wayland-outputs.h b/src/wayland/meta-wayland-outputs.h
index f28b591220..d27948d153 100644
--- a/src/wayland/meta-wayland-outputs.h
+++ b/src/wayland/meta-wayland-outputs.h
@@ -33,6 +33,8 @@ const GList * meta_wayland_output_get_resources (MetaWaylandOutput *wayland_outp
MetaMonitor * meta_wayland_output_get_monitor (MetaWaylandOutput *wayland_output);
+MetaMonitorMode * meta_wayland_output_get_monitor_mode (MetaWaylandOutput *wayland_output);
+
void meta_wayland_outputs_finalize (MetaWaylandCompositor *compositor);
void meta_wayland_outputs_init (MetaWaylandCompositor *compositor);
diff --git a/src/wayland/meta-wayland-presentation-time.c b/src/wayland/meta-wayland-presentation-time.c
index abddb63b12..13a98a984b 100644
--- a/src/wayland/meta-wayland-presentation-time.c
+++ b/src/wayland/meta-wayland-presentation-time.c
@@ -323,6 +323,8 @@ meta_wayland_presentation_feedback_present (MetaWaylandPresentationFeedback *fee
uint32_t seq_hi, seq_lo;
uint32_t flags;
const GList *l;
+ MetaMonitorMode *mode;
+ gboolean is_vrr;
if (output == NULL)
{
@@ -337,7 +339,16 @@ meta_wayland_presentation_feedback_present (MetaWaylandPresentationFeedback *fee
tv_sec_lo = time_s;
tv_nsec = (uint32_t) us2ns (time_us - s2us (time_s));
- refresh_interval_ns = (uint32_t) (0.5 + s2ns (1) / frame_info->refresh_rate);
+ mode = meta_wayland_output_get_monitor_mode (output);
+
+ is_vrr = meta_monitor_mode_get_refresh_rate_mode (mode) ==
+ META_CRTC_REFRESH_RATE_MODE_VARIABLE;
+
+ /* The refresh rate interval is required to be 0 for vrr. */
+ if (is_vrr)
+ refresh_interval_ns = 0;
+ else
+ refresh_interval_ns = (uint32_t) (0.5 + s2ns (1) / frame_info->refresh_rate);
maybe_update_presentation_sequence (surface, frame_info, output);
--
2.44.0.501.g19981daefd.dirty