From 5905fcdf30828f19744d8fa8ac72ccba0e0237c4 Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Tue, 1 Jul 2025 14:17:00 +0200 Subject: [PATCH] Backport fix for screen not refreshing properly Resolves: RHEL-89352 --- ...ync-again-at-the-end-of-before_paint.patch | 85 +++++++++++++++++++ mutter.spec | 9 +- 2 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 0001-compositor-x11-sync-again-at-the-end-of-before_paint.patch diff --git a/0001-compositor-x11-sync-again-at-the-end-of-before_paint.patch b/0001-compositor-x11-sync-again-at-the-end-of-before_paint.patch new file mode 100644 index 0000000..b864479 --- /dev/null +++ b/0001-compositor-x11-sync-again-at-the-end-of-before_paint.patch @@ -0,0 +1,85 @@ +From f606a4424a5afc71672566b15f56971bfb7fa4db Mon Sep 17 00:00:00 2001 +From: Daniel van Vugt +Date: Fri, 16 Feb 2024 16:57:55 +0800 +Subject: [PATCH] compositor/x11: Sync again at the end of before_paint + +The existing comment tells us this is necessary: + +> there may be drawing between the last damage event and the +> XDamageSubtract() that needs to be flushed as well. + +But the commit message for 551101c65cda also tells us that +synchronization is necessary before-update. Assuming both are correct +then it needs to be done in both places. + +I did try optimizing out the second sync to only do it if damage +arrived during the update, but that doesn't seem to be the issue. +The damage event is arriving before the update starts and it's some +secondary changes within the damage region running late that need +flushing. So this means the client is reporting damage more frequently +than the frame rate and we're ignoring the secondary damage reports +for efficiency (XDamageReportBoundingBox), which is still a good thing. + +Fixes: 551101c65cda ("compositor-x11: Move synchronization to before-update") +Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2880 +Part-of: +--- + src/compositor/meta-compositor-x11.c | 30 ++++++++++++++++++++++++---- + 1 file changed, 26 insertions(+), 4 deletions(-) + +diff --git a/src/compositor/meta-compositor-x11.c b/src/compositor/meta-compositor-x11.c +index 1d0ba4c..8bfd4c1 100644 +--- a/src/compositor/meta-compositor-x11.c ++++ b/src/compositor/meta-compositor-x11.c +@@ -326,9 +326,7 @@ out: + } + + static void +-on_before_update (ClutterStage *stage, +- ClutterStageView *stage_view, +- MetaCompositor *compositor) ++maybe_do_sync (MetaCompositor *compositor) + { + MetaCompositorX11 *compositor_x11 = META_COMPOSITOR_X11 (compositor); + +@@ -363,6 +361,14 @@ on_before_update (ClutterStage *stage, + } + } + ++static void ++on_before_update (ClutterStage *stage, ++ ClutterStageView *stage_view, ++ MetaCompositor *compositor) ++{ ++ maybe_do_sync (compositor); ++} ++ + static void + on_after_update (ClutterStage *stage, + ClutterStageView *stage_view, +@@ -390,6 +396,22 @@ meta_compositor_x11_before_paint (MetaCompositor *compositor, + + parent_class = META_COMPOSITOR_CLASS (meta_compositor_x11_parent_class); + parent_class->before_paint (compositor, stage_view); ++ ++ /* We must sync after MetaCompositor's before_paint because that's the final ++ * time XDamageSubtract may happen before painting (when it calls ++ * meta_window_actor_x11_before_paint -> handle_updates -> ++ * meta_surface_actor_x11_handle_updates). If a client was to redraw between ++ * the last damage event and XDamageSubtract, and the bounding box of the ++ * region didn't grow, then we will not receive a new damage report for it ++ * (because XDamageReportBoundingBox). Then if we haven't synchronized again ++ * and the same region doesn't change on subsequent frames, we have lost some ++ * part of the update from the client. So to ensure the correct pixels get ++ * composited we must sync at least once between XDamageSubtract and ++ * compositing, which is here. More related documentation can be found in ++ * maybe_do_sync. ++ */ ++ ++ maybe_do_sync (compositor); + } + + static void +-- +GitLab + diff --git a/mutter.spec b/mutter.spec index 27d721d..e56bc27 100644 --- a/mutter.spec +++ b/mutter.spec @@ -10,7 +10,7 @@ Name: mutter Version: 40.9 -Release: 27%{?dist} +Release: 28%{?dist} Summary: Window and compositing manager based on Clutter License: GPLv2+ @@ -165,6 +165,9 @@ Patch71: 0003-Use-access-instead-of-checking-permission-modes-for-.patch # RHEL-4521 Patch72: fix-cogl-framebuffer-get-bits-test.patch +# RHEL-89352 +Patch73: 0001-compositor-x11-sync-again-at-the-end-of-before_paint.patch + BuildRequires: chrpath BuildRequires: pango-devel BuildRequires: startup-notification-devel @@ -312,6 +315,10 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop %{_datadir}/mutter-%{mutter_api_version}/tests %changelog +* Tue Jul 01 2025 Jan Grulich - 40.9-28 +- Backport fix for screen not refreshing properly + Resolves: RHEL-89352 + * Fri Jun 27 2025 Jonas Ã…dahl - 40.9-27 - Backport fixes for cogl OpenGL conformance Resolves: RHEL-4521