diff options
author | Daniel Landau | 2019-05-03 12:02:51 +0300 |
---|---|---|
committer | Daniel Landau | 2019-05-03 12:02:51 +0300 |
commit | 39146b6038fd8f18fa3b3a6ac8384ee547a82261 (patch) | |
tree | e78e13ac69ada72493701f9af2257013eb363567 | |
download | aur-mutter-topicons-cpu-use-fix.tar.gz |
Add base mutter package with added fix for topicons cpu issue
-rw-r--r-- | .SRCINFO | 42 | ||||
-rw-r--r-- | 0001-wayland-output-Report-unscaled-size-even-in-logical-.patch | 147 | ||||
-rw-r--r-- | 216.patch | 128 | ||||
-rw-r--r-- | 270.patch | 109 | ||||
-rw-r--r-- | PKGBUILD | 67 |
5 files changed, 493 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..274039328caf --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,42 @@ +pkgbase = mutter-topicons-cpu-use-fix + pkgdesc = A window manager for GNOME, with fix for TopIcons CPU issue + pkgver = 3.32.1 + pkgrel = 2 + url = https://gitlab.gnome.org/GNOME/mutter + arch = x86_64 + groups = gnome + license = GPL + checkdepends = xorg-server-xvfb + makedepends = gobject-introspection + makedepends = git + makedepends = egl-wayland + makedepends = meson + makedepends = xorg-server + depends = dconf + depends = gobject-introspection-runtime + depends = gsettings-desktop-schemas + depends = libcanberra + depends = startup-notification + depends = zenity + depends = libsm + depends = gnome-desktop + depends = upower + depends = libxkbcommon-x11 + depends = gnome-settings-daemon + depends = libgudev + depends = libinput + depends = pipewire + depends = xorg-server-xwayland + provides = mutter + conflicts = mutter + source = git+https://gitlab.gnome.org/GNOME/mutter.git#commit=e3f3274bbf631c57f9a01b7bead6ebf6374f5be4 + source = 0001-wayland-output-Report-unscaled-size-even-in-logical-.patch + source = 216.patch + source = 270.patch + sha256sums = SKIP + sha256sums = 842162bf8cec5d69fdb80c85fd152ddd3db6a9179d11d6f81d486f79814838c0 + sha256sums = ed4f3cf738a3cffdf8a6e1a352bf24d74078c3b26fb9262c5746e0d95b9df756 + sha256sums = 5141a007bd0dd99c6727bad843f9c800a7c30c1017923f5e16364e7914429a5f + +pkgname = mutter-topicons-cpu-use-fix + diff --git a/0001-wayland-output-Report-unscaled-size-even-in-logical-.patch b/0001-wayland-output-Report-unscaled-size-even-in-logical-.patch new file mode 100644 index 000000000000..be86633bd2a2 --- /dev/null +++ b/0001-wayland-output-Report-unscaled-size-even-in-logical-.patch @@ -0,0 +1,147 @@ +From 761000ec8f4b53d0fa06f235be2ed30b80ec5bcb Mon Sep 17 00:00:00 2001 +Message-Id: <761000ec8f4b53d0fa06f235be2ed30b80ec5bcb.1553890447.git.jan.steffens@gmail.com> +From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com> +Date: Wed, 27 Mar 2019 00:38:02 +0100 +Subject: [PATCH] wayland/output: Report unscaled size even in logical layout + mode +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +In physical layout mode, the size and scale of the `wl_output` matches +the actual monitor: + +| Monitor | `wl_output` | `GdkMonitor` | +| ------------ | ------------ | ------------ | +| 3840×2160 @1 | 3840×2160 @1 | 3840×2160 @1 | +| 3840×2160 @2 | 3840×2160 @2 | 1920×1080 @2 | + +GTK currently does not support `xdg_output`. To estimate the logical +output size for `GdkMonitor`, it divides the output's size by its scale +factor. There might be other legacy clients making the same assumption. + +In logical layout mode, mutter currently reports logical geometry for +the `wl_output`s, but this no longer matches the monitors: + +| Monitor | `wl_output` | `GdkMonitor` | +| -------------- | ------------ | ------------ | +| 3840×2160 @1 | 3840×2160 @1 | 3840×2160 @1 | +| 3840×2160 @2 | 1920×1080 @2 | 960×540 @2 | +| 3840×2160 @1.5 | 2560×1440 @2 | 1280×720 @2 | + +This patch changes logical layout mode to multiply the sizes by the +`wl_output`'s scale factor before sending them to the client. Now the +sizes match the physical layout mode again: + +| Monitor | `wl_output` | `GdkMonitor` | +| -------------- | ------------ | ------------ | +| 3840×2160 @1 | 3840×2160 @1 | 3840×2160 @1 | +| 3840×2160 @2 | 3840×2160 @2 | 1920×1080 @2 | +| 3840×2160 @1.5 | 5120×2880 @2 | 2560×1440 @2 | + +Unfortunately, non-integer output scales are not representable in +`wl_output`. Still, I believe these values are better than before, and +the best we can do for clients that do not know about `xdg_output`: The +size of the output will match the size that a buffer for a fullscreen +surface should have at the indicated scale. + +Fixes part of https://bugzilla.mozilla.org/show_bug.cgi?id=1534089 +https://gitlab.gnome.org/GNOME/mutter/merge_requests/510 +--- + src/wayland/meta-wayland-outputs.c | 33 +++++++++++++++++++----------- + 1 file changed, 21 insertions(+), 12 deletions(-) + +diff --git a/src/wayland/meta-wayland-outputs.c b/src/wayland/meta-wayland-outputs.c +index 7695d86af..712a143a8 100644 +--- a/src/wayland/meta-wayland-outputs.c ++++ b/src/wayland/meta-wayland-outputs.c +@@ -181,24 +181,36 @@ send_output_events (struct wl_resource *resource, + MetaLogicalMonitor *old_logical_monitor; + guint old_mode_flags; + gint old_scale; ++ gint scale; ++ MetaRectangle old_rect; ++ MetaRectangle rect; + float old_refresh_rate; + float refresh_rate; + + old_logical_monitor = wayland_output->logical_monitor; + old_mode_flags = wayland_output->mode_flags; + old_scale = wayland_output->scale; ++ old_rect = old_logical_monitor->rect; + old_refresh_rate = wayland_output->refresh_rate; + ++ scale = calculate_wayland_output_scale (logical_monitor); ++ rect = logical_monitor->rect; + monitor = pick_main_monitor (logical_monitor); +- + current_mode = meta_monitor_get_current_mode (monitor); + refresh_rate = meta_monitor_mode_get_refresh_rate (current_mode); + ++ if (meta_is_stage_views_scaled ()) { ++ old_rect.width *= old_scale; ++ old_rect.height *= old_scale; ++ rect.width *= scale; ++ rect.height *= scale; ++ } ++ + gboolean need_done = FALSE; + + if (need_all_events || +- old_logical_monitor->rect.x != logical_monitor->rect.x || +- old_logical_monitor->rect.y != logical_monitor->rect.y || ++ old_rect.x != rect.x || ++ old_rect.y != rect.y || + is_different_rotation (old_logical_monitor, logical_monitor)) + { + int width_mm, height_mm; +@@ -229,40 +241,37 @@ send_output_events (struct wl_resource *resource, + transform = WL_OUTPUT_TRANSFORM_NORMAL; + + wl_output_send_geometry (resource, +- logical_monitor->rect.x, +- logical_monitor->rect.y, ++ rect.x, ++ rect.y, + width_mm, + height_mm, + subpixel_order, + vendor, + product, + transform); + need_done = TRUE; + } + + preferred_mode = meta_monitor_get_preferred_mode (monitor); + if (current_mode == preferred_mode) + mode_flags |= WL_OUTPUT_MODE_PREFERRED; + + if (need_all_events || +- old_logical_monitor->rect.width != logical_monitor->rect.width || +- old_logical_monitor->rect.height != logical_monitor->rect.height || ++ old_rect.width != rect.width || ++ old_rect.height != rect.height || + old_refresh_rate != refresh_rate || + old_mode_flags != mode_flags) + { + wl_output_send_mode (resource, + mode_flags, +- logical_monitor->rect.width, +- logical_monitor->rect.height, ++ rect.width, ++ rect.height, + (int32_t) (refresh_rate * 1000)); + need_done = TRUE; + } + + if (version >= WL_OUTPUT_SCALE_SINCE_VERSION) + { +- int scale; +- +- scale = calculate_wayland_output_scale (logical_monitor); + if (need_all_events || + old_scale != scale) + { +-- +2.21.0 + diff --git a/216.patch b/216.patch new file mode 100644 index 000000000000..ee92895446d8 --- /dev/null +++ b/216.patch @@ -0,0 +1,128 @@ +From 6d8d73beeef3a618c553e89b0b3e532ec3654a30 Mon Sep 17 00:00:00 2001 +From: Daniel van Vugt <daniel.van.vugt@canonical.com> +Date: Mon, 23 Jul 2018 16:28:56 +0800 +Subject: [PATCH] cogl-winsys-glx: Fix frame notification race/leak + +If a second `set_{sync,complete}_pending` was queued before the idle +handler had flushed the first then one of them would be forgotten. +It would stay queued forever and never emitted as a notification. + +This could happen repeatedly causing a slow leak. But worse still, +`clutter-stage-cogl` would then have `pending_swaps` permanently stuck +above zero preventing the presentation timing logic from being used. + +The problem is that a boolean can only count to one, but in some cases +(triple buffering, whether intentional or accidental #334) we need it to +count to two. So just change booleans to integers and count properly. + +https://gitlab.gnome.org/GNOME/mutter/merge_requests/216 +--- + cogl/cogl/winsys/cogl-winsys-glx.c | 58 +++++++++++++++--------------- + 1 file changed, 29 insertions(+), 29 deletions(-) + +diff --git a/cogl/cogl/winsys/cogl-winsys-glx.c b/cogl/cogl/winsys/cogl-winsys-glx.c +index 2623d02c6..235cfe81f 100644 +--- a/cogl/cogl/winsys/cogl-winsys-glx.c ++++ b/cogl/cogl/winsys/cogl-winsys-glx.c +@@ -99,9 +99,9 @@ typedef struct _CoglOnscreenGLX + CoglOnscreenXlib _parent; + GLXDrawable glxwin; + uint32_t last_swap_vsync_counter; +- gboolean pending_sync_notify; +- gboolean pending_complete_notify; +- gboolean pending_resize_notify; ++ uint32_t pending_sync_notify; ++ uint32_t pending_complete_notify; ++ uint32_t pending_resize_notify; + + GThread *swap_wait_thread; + GQueue *swap_wait_queue; +@@ -347,35 +347,35 @@ flush_pending_notifications_cb (void *data, + { + CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer); + CoglOnscreenGLX *glx_onscreen = onscreen->winsys; +- gboolean pending_sync_notify = glx_onscreen->pending_sync_notify; +- gboolean pending_complete_notify = glx_onscreen->pending_complete_notify; + +- /* If swap_region is called then notifying the sync event could +- * potentially immediately queue a subsequent pending notify so +- * we need to clear the flag before invoking the callback */ +- glx_onscreen->pending_sync_notify = FALSE; +- glx_onscreen->pending_complete_notify = FALSE; +- +- if (pending_sync_notify) ++ while (glx_onscreen->pending_sync_notify > 0 || ++ glx_onscreen->pending_complete_notify > 0 || ++ glx_onscreen->pending_resize_notify > 0) + { +- CoglFrameInfo *info = g_queue_peek_head (&onscreen->pending_frame_infos); +- +- _cogl_onscreen_notify_frame_sync (onscreen, info); +- } ++ if (glx_onscreen->pending_sync_notify > 0) ++ { ++ CoglFrameInfo *info = ++ g_queue_peek_head (&onscreen->pending_frame_infos); + +- if (pending_complete_notify) +- { +- CoglFrameInfo *info = g_queue_pop_head (&onscreen->pending_frame_infos); ++ _cogl_onscreen_notify_frame_sync (onscreen, info); ++ glx_onscreen->pending_sync_notify--; ++ } + +- _cogl_onscreen_notify_complete (onscreen, info); ++ if (glx_onscreen->pending_complete_notify > 0) ++ { ++ CoglFrameInfo *info = ++ g_queue_pop_head (&onscreen->pending_frame_infos); + +- cogl_object_unref (info); +- } ++ _cogl_onscreen_notify_complete (onscreen, info); ++ cogl_object_unref (info); ++ glx_onscreen->pending_complete_notify--; ++ } + +- if (glx_onscreen->pending_resize_notify) +- { +- _cogl_onscreen_notify_resize (onscreen); +- glx_onscreen->pending_resize_notify = FALSE; ++ if (glx_onscreen->pending_resize_notify > 0) ++ { ++ _cogl_onscreen_notify_resize (onscreen); ++ glx_onscreen->pending_resize_notify--; ++ } + } + } + } +@@ -417,7 +417,7 @@ set_sync_pending (CoglOnscreen *onscreen) + NULL); + } + +- glx_onscreen->pending_sync_notify = TRUE; ++ glx_onscreen->pending_sync_notify++; + } + + static void +@@ -440,7 +440,7 @@ set_complete_pending (CoglOnscreen *onscreen) + NULL); + } + +- glx_onscreen->pending_complete_notify = TRUE; ++ glx_onscreen->pending_complete_notify++; + } + + static void +@@ -533,7 +533,7 @@ notify_resize (CoglContext *context, + NULL); + } + +- glx_onscreen->pending_resize_notify = TRUE; ++ glx_onscreen->pending_resize_notify++; + + if (!xlib_onscreen->is_foreign_xwin) + { +-- +2.18.1 + diff --git a/270.patch b/270.patch new file mode 100644 index 000000000000..c691333c467b --- /dev/null +++ b/270.patch @@ -0,0 +1,109 @@ +From eb2b7ff6130f60551521e2fdf5a9ed7d7a9cf986 Mon Sep 17 00:00:00 2001 +From: Daniel van Vugt <daniel.van.vugt@canonical.com> +Date: Thu, 20 Sep 2018 11:35:26 +0200 +Subject: [PATCH 1/2] clutter: Avoid queue_relayout when under NO_LAYOUT + +Optimize `clutter_actor_set_{x,y,position}_internal` to avoid doing +a `clutter_actor_queue_relayout` when the parent has set +CLUTTER_ACTOR_NO_LAYOUT (like gnome-shell's uiGroup). + +It's unclear if the flag means we should do nothing at all in theory, +but in practice a lot of logic already exists assuming and expecting +`clutter_actor_queue_relayout` to incur `allocate`, and defers +important work till the `allocate`. So we can't do "nothing", but a +shallower `allocate` is enough to satisfy the expected allocation +call, while avoiding an expensive full-stage reallocation. + +In gnome-shell this helps performance of animated children of uiGroup, +such as the flying icons in the spring animation. +--- + clutter/clutter/clutter-actor.c | 23 ++++++++++++++++++++--- + 1 file changed, 20 insertions(+), 3 deletions(-) + +diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c +index e70892308..fc8a06339 100644 +--- a/clutter/clutter/clutter-actor.c ++++ b/clutter/clutter/clutter-actor.c +@@ -11186,6 +11186,23 @@ clutter_actor_set_height (ClutterActor *self, + height); + } + ++static void ++_clutter_actor_maybe_queue_relayout (ClutterActor *self) ++{ ++ ClutterActorPrivate *priv = self->priv; ++ ++ if (priv->parent && ++ (priv->parent->flags & CLUTTER_ACTOR_NO_LAYOUT)) ++ { ++ clutter_actor_allocate_preferred_size (self, CLUTTER_ALLOCATION_NONE); ++ clutter_actor_queue_redraw (self); ++ } ++ else ++ { ++ clutter_actor_queue_relayout (self); ++ } ++} ++ + static inline void + clutter_actor_set_x_internal (ClutterActor *self, + float x) +@@ -11206,7 +11223,7 @@ clutter_actor_set_x_internal (ClutterActor *self, + + clutter_actor_notify_if_geometry_changed (self, &old); + +- clutter_actor_queue_relayout (self); ++ _clutter_actor_maybe_queue_relayout (self); + } + + static inline void +@@ -11229,7 +11246,7 @@ clutter_actor_set_y_internal (ClutterActor *self, + + clutter_actor_notify_if_geometry_changed (self, &old); + +- clutter_actor_queue_relayout (self); ++ _clutter_actor_maybe_queue_relayout (self); + } + + static void +@@ -11258,7 +11275,7 @@ clutter_actor_set_position_internal (ClutterActor *self, + + clutter_actor_notify_if_geometry_changed (self, &old); + +- clutter_actor_queue_relayout (self); ++ _clutter_actor_maybe_queue_relayout (self); + } + + /** +-- +2.18.1 + + +From b1bfc49f38aa870749470fffe8acb8ae17fc8f8c Mon Sep 17 00:00:00 2001 +From: Daniel van Vugt <daniel.van.vugt@canonical.com> +Date: Mon, 22 Oct 2018 17:07:12 +0800 +Subject: [PATCH 2/2] meta-window-group: Set flag CLUTTER_ACTOR_NO_LAYOUT + +So that moving a window does not trickle up and become a full stage +relayout on every frame. +--- + src/compositor/meta-window-group.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/compositor/meta-window-group.c b/src/compositor/meta-window-group.c +index 767850ecf..411c8a065 100644 +--- a/src/compositor/meta-window-group.c ++++ b/src/compositor/meta-window-group.c +@@ -197,6 +197,9 @@ meta_window_group_class_init (MetaWindowGroupClass *klass) + static void + meta_window_group_init (MetaWindowGroup *window_group) + { ++ ClutterActor *actor = CLUTTER_ACTOR (window_group); ++ ++ clutter_actor_set_flags (actor, CLUTTER_ACTOR_NO_LAYOUT); + } + + ClutterActor * +-- +2.18.1 + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..36622bed3fc5 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,67 @@ +# Maintainer: Daniel Landau <daniel@landau.fi> +# Contributor: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com> +# Contributor: Ionut Biru <ibiru@archlinux.org> +# Contributor: Michael Kanis <mkanis_at_gmx_dot_de> + +_pkgname=mutter +pkgname=mutter-topicons-cpu-use-fix +pkgver=3.32.1 +pkgrel=2 +pkgdesc="A window manager for GNOME, with fix for TopIcons CPU issue" +url="https://gitlab.gnome.org/GNOME/mutter" +arch=(x86_64) +license=(GPL) +depends=(dconf gobject-introspection-runtime gsettings-desktop-schemas libcanberra + startup-notification zenity libsm gnome-desktop upower libxkbcommon-x11 + gnome-settings-daemon libgudev libinput pipewire xorg-server-xwayland) +makedepends=(gobject-introspection git egl-wayland meson xorg-server) +checkdepends=(xorg-server-xvfb) +groups=(gnome) +provides=(mutter) +conflicts=(mutter) +_commit=e3f3274bbf631c57f9a01b7bead6ebf6374f5be4 # tags/3.32.1^0 +source=("git+https://gitlab.gnome.org/GNOME/mutter.git#commit=$_commit" + 0001-wayland-output-Report-unscaled-size-even-in-logical-.patch + 216.patch + 270.patch) +sha256sums=('SKIP' + '842162bf8cec5d69fdb80c85fd152ddd3db6a9179d11d6f81d486f79814838c0' + 'ed4f3cf738a3cffdf8a6e1a352bf24d74078c3b26fb9262c5746e0d95b9df756' + '5141a007bd0dd99c6727bad843f9c800a7c30c1017923f5e16364e7914429a5f') + +pkgver() { + cd $_pkgname + git describe --tags | sed 's/-/+/g' +} + +prepare() { + cd $_pkgname + + # https://bugzilla.mozilla.org/show_bug.cgi?id=1534089 + patch -Np1 -i ../0001-wayland-output-Report-unscaled-size-even-in-logical-.patch + + # https://gitlab.gnome.org/GNOME/mutter/merge_requests/216 + git apply -3 ../216.patch + # https://gitlab.gnome.org/GNOME/mutter/merge_requests/270 + git apply -3 ../270.patch +} + +build() { + arch-meson $_pkgname build \ + -D egl_device=true \ + -D wayland_eglstream=true \ + -D installed_tests=false + ninja -C build +} + +check() ( + mkdir -p -m 700 "${XDG_RUNTIME_DIR:=$PWD/runtime-dir}" + glib-compile-schemas "${GSETTINGS_SCHEMA_DIR:=$PWD/build/data}" + export XDG_RUNTIME_DIR GSETTINGS_SCHEMA_DIR + + #dbus-run-session xvfb-run -s '+iglx -noreset' meson test -C build +) + +package() { + DESTDIR="$pkgdir" meson install -C build +} |