From bbb5f6ad30b75222712b2504ec27e85bf7f53fa5 Mon Sep 17 00:00:00 2001 From: Till Wegmueller Date: Sun, 18 Oct 2026 18:52:56 +0200 Subject: [PATCH 1/3] mate-desktop: retain every cached RandR state update --- components/desktop/mate/mate-desktop/Makefile | 4 +- .../patches/02-xrandr-probing.patch | 60 ------------------- 2 files changed, 3 insertions(+), 61 deletions(-) delete mode 100644 components/desktop/mate/mate-desktop/patches/02-xrandr-probing.patch diff --git a/components/desktop/mate/mate-desktop/Makefile b/components/desktop/mate/mate-desktop/Makefile index a0c1e286a5..fb215ca3aa 100644 --- a/components/desktop/mate/mate-desktop/Makefile +++ b/components/desktop/mate/mate-desktop/Makefile @@ -24,9 +24,11 @@ include $(WS_MAKE_RULES)/mate.mk COMPONENT_NAME= mate-desktop COMPONENT_MJR_VERSION= 1.28 COMPONENT_MNR_VERSION= 2 -COMPONENT_REVISION= 1 +COMPONENT_REVISION= 2 COMPONENT_SUMMARY= Additional UI API for MATE Desktop COMPONENT_ARCHIVE_HASH= sha256:32bb4b792014b391c1e1b8ae9c18a82b4d447650984b4cba7d28e95564964aa2 +# RandR event updates use cached X server state. Do not drop those updates: +# desktop policy debounces decisions without keeping stale CRTC/monitor data. COMPONENT_LICENSE= GPLv2, LGPLv2, FDLv1.1 include $(WS_MAKE_RULES)/common.mk diff --git a/components/desktop/mate/mate-desktop/patches/02-xrandr-probing.patch b/components/desktop/mate/mate-desktop/patches/02-xrandr-probing.patch deleted file mode 100644 index 540e11f8ee..0000000000 --- a/components/desktop/mate/mate-desktop/patches/02-xrandr-probing.patch +++ /dev/null @@ -1,60 +0,0 @@ ---- mate-desktop-1.12.1/libmate-desktop/mate-rr.c.~1~ 2015-11-30 10:10:03.000000000 +0300 -+++ mate-desktop-1.12.1/libmate-desktop/mate-rr.c 2015-12-05 17:39:12.583263260 +0300 -@@ -515,10 +515,35 @@ - static ScreenInfo * - screen_info_new (MateRRScreen *screen, gboolean needs_reprobe, GError **error) - { -+ GTimeVal cur_time_val; -+ gint64 cur, prev; -+ -+ g_assert (screen != NULL); -+ -+ if ( screen->priv->info != NULL ) { -+ g_get_current_time(&cur_time_val); -+ cur = (gint64) cur_time_val.tv_sec * G_USEC_PER_SEC + cur_time_val.tv_usec; -+ prev =(gint64) screen->priv->last_update_time.tv_sec * G_USEC_PER_SEC + screen->priv->last_update_time.tv_usec; -+ -+ /* Only referesh the info after 2 seconds have elapsed since last -+ * update, otherwise it will cause a lot of extra probing on the X -+ * server. -+ */ -+ if (((cur - prev) < 0) || ((cur - prev) > 2000000)) { -+ screen->priv->last_update_time = cur_time_val; -+ } -+ else { -+ /* Don't return any update, which should result in caller using -+ * existing data -+ */ -+ g_warning("Call to screen_info_new is too frequent, skipping..."); -+ return( NULL ); -+ } -+ } -+ - ScreenInfo *info = g_new0 (ScreenInfo, 1); - MateRRScreenPrivate *priv; - -- g_assert (screen != NULL); - - priv = screen->priv; - -@@ -688,6 +713,9 @@ - - priv->info = screen_info_new (self, TRUE, error); - -+ /* Initialize the last udpate time */ -+ g_get_current_time (&(priv->last_update_time)); -+ - if (!priv->info) { - return FALSE; - } - ---- mate-desktop-1.24.0/libmate-desktop/mate-rr-private.h 2020-02-10 11:33:51.000000000 +0000 -+++ mate-desktop-1.24.0/libmate-desktop/mate-rr-private.h.new 2020-02-15 21:23:48.202041412 +0000 -@@ -46,6 +46,7 @@ struct MateRRScreenPrivate - int rr_major_version; - int rr_minor_version; - -+ GTimeVal last_update_time; - Atom connector_type_atom; - }; - -- 2.56.0 From 9fd19c44a61e9b5eac698176d4964e6055542e90 Mon Sep 17 00:00:00 2001 From: Till Wegmueller Date: Sun, 18 Oct 2026 18:59:38 +0200 Subject: [PATCH 2/3] test: cover rapid cached RandR notifications in MATE --- .../desktop/mate/mate-desktop/test/README.md | 17 +++++ .../mate-desktop/test/rapid-randr-events.c | 73 +++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 components/desktop/mate/mate-desktop/test/README.md create mode 100644 components/desktop/mate/mate-desktop/test/rapid-randr-events.c diff --git a/components/desktop/mate/mate-desktop/test/README.md b/components/desktop/mate/mate-desktop/test/README.md new file mode 100644 index 0000000000..007799fb47 --- /dev/null +++ b/components/desktop/mate/mate-desktop/test/README.md @@ -0,0 +1,17 @@ +# Cached RandR update regression + +This native test sends three real RandR notifications 150ms apart by changing +only the physical dimensions of a **private Xvfb** screen. It counts the +MateRRScreen changed callbacks, which use cached X server state rather than +forcing hardware detection. It does not test a physical cable or desktop policy. + +Build with the native compiler and pkg-config flags for gtk+-3.0, +mate-desktop-2.0, xrandr and x11. Run with DISPLAY pointing to a task-owned Xvfb +with RandR enabled. Never point it at a user's desktop. Stop only that Xvfb +when finished. + +Run once against the previous OI library, then with LD_LIBRARY_PATH_64 pointing +to the corrected prototype usr/lib/amd64. The old two-second throttle delivers +zero of three notifications (exit1); the corrected library delivers all three +(exit0). An initial failed XSendEvent-based harness is not this test: extension +event dispatch must be exercised with real server notifications. diff --git a/components/desktop/mate/mate-desktop/test/rapid-randr-events.c b/components/desktop/mate/mate-desktop/test/rapid-randr-events.c new file mode 100644 index 0000000000..e5e5ad6adf --- /dev/null +++ b/components/desktop/mate/mate-desktop/test/rapid-randr-events.c @@ -0,0 +1,73 @@ +/* Cached RandR event delivery regression; run only on a private Xvfb. */ +#include +#include +#include +#include +#define MATE_DESKTOP_USE_UNSTABLE_API +#include + +static unsigned sent, received; +static GMainLoop *loop; + +static void changed (MateRRScreen *screen, gpointer data) +{ + received++; +} + +static gboolean finish (gpointer data) +{ + g_main_loop_quit (loop); + return G_SOURCE_REMOVE; +} + +static gboolean send_event (gpointer data) +{ + Display *dpy = gdk_x11_get_default_xdisplay (); + int base, error; + XRRScreenChangeNotifyEvent ev; + memset (&ev, 0, sizeof ev); + XRRQueryExtension (dpy, &base, &error); + ev.type = base + RRScreenChangeNotify; + ev.display = dpy; + ev.window = ev.root = DefaultRootWindow (dpy); + ev.rotation = RR_Rotate_0; + ev.width = DisplayWidth (dpy, DefaultScreen (dpy)); + ev.height = DisplayHeight (dpy, DefaultScreen (dpy)); + ev.mwidth = DisplayWidthMM (dpy, DefaultScreen (dpy)); + ev.mheight = DisplayHeightMM (dpy, DefaultScreen (dpy)); + /* Real RandR notifications from a private virtual server. Changing only + * millimetres avoids requiring extra scanout modes in Xvfb. */ + XRRSetScreenSize (dpy, ev.root, ev.width, ev.height, + ev.mwidth + sent + 1, ev.mheight); + XFlush (dpy); + if (++sent == 3) { + g_timeout_add (200, finish, NULL); + return G_SOURCE_REMOVE; + } + return G_SOURCE_CONTINUE; +} + +int main (int argc, char **argv) +{ + GError *error = NULL; + MateRRScreen *screen; + gtk_init (&argc, &argv); + /* XSendEvent uses the core event selection, independently of RandR's + * extension mask selected by MateRRScreen. */ + XSelectInput (gdk_x11_get_default_xdisplay (), + gdk_x11_get_default_root_xwindow (), StructureNotifyMask); + screen = mate_rr_screen_new (gdk_screen_get_default (), &error); + if (!screen) { + g_printerr ("screen initialization: %s\n", error->message); + return 2; + } + g_signal_connect (screen, "changed", G_CALLBACK (changed), NULL); + loop = g_main_loop_new (NULL, FALSE); + g_timeout_add (150, send_event, NULL); + g_main_loop_run (loop); + g_print ("synthetic cached RandR notifications sent=%u delivered=%u\n", + sent, received); + g_main_loop_unref (loop); + g_object_unref (screen); + return received == sent ? 0 : 1; +} -- 2.56.0 From ba8b24d7e24b454437b32e7020d0c27f8fa9c32b Mon Sep 17 00:00:00 2001 From: Till Wegmueller Date: Sun, 18 Oct 2026 19:01:47 +0200 Subject: [PATCH 3/3] docs: distinguish planned desktop policy from cached-state fix --- components/desktop/mate/mate-desktop/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/desktop/mate/mate-desktop/Makefile b/components/desktop/mate/mate-desktop/Makefile index fb215ca3aa..8ca7d7dfd9 100644 --- a/components/desktop/mate/mate-desktop/Makefile +++ b/components/desktop/mate/mate-desktop/Makefile @@ -28,7 +28,7 @@ COMPONENT_REVISION= 2 COMPONENT_SUMMARY= Additional UI API for MATE Desktop COMPONENT_ARCHIVE_HASH= sha256:32bb4b792014b391c1e1b8ae9c18a82b4d447650984b4cba7d28e95564964aa2 # RandR event updates use cached X server state. Do not drop those updates: -# desktop policy debounces decisions without keeping stale CRTC/monitor data. +# desktop policy should debounce decisions without keeping stale CRTC data. COMPONENT_LICENSE= GPLv2, LGPLv2, FDLv1.1 include $(WS_MAKE_RULES)/common.mk -- 2.56.0