Accepting request 535494 from GNOME:Factory

- Add mutter-handle-no-to-no-monitor.patch: fix possible crash when
  turning monitor off and on while logged in (bgo#788607).
- Add mutter-preferred-mode.patch: fix a crash on some ATI (radeon)
  configurations (bgo#789153).

Possibly fixes boo#1063871, along with the gnome-shell patch for bgo#788607 (forwarded request 535472 from mgorse)

OBS-URL: https://build.opensuse.org/request/show/535494
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/mutter?expand=0&rev=118
This commit is contained in:
Dominique Leuenberger 2017-10-21 18:16:54 +00:00 committed by Git OBS Bridge
commit 66402e1e7c
4 changed files with 164 additions and 0 deletions

View File

@ -0,0 +1,31 @@
From 8886e1bbdcb712d1e70873b2cccb7ab62e6a3eec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Sat, 7 Oct 2017 00:33:39 -0400
Subject: [PATCH] window: Handle updating from no to no monitor
When we received two hot plug events that both resulted in headless
configuration, we tried to find a new window monitor given the old.
That resulted in a null pointer dereference; avoid that by only trying
to find the same monitor if there was an old one.
https://bugzilla.gnome.org/show_bug.cgi?id=788607
---
src/core/window.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/window.c b/src/core/window.c
index dc60a667c..c2d9869d2 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -3793,7 +3793,7 @@ meta_window_update_for_monitors_changed (MetaWindow *window)
new = find_monitor_by_winsys_id (window, window->preferred_output_winsys_id);
/* Otherwise, try to find the old output on a new monitor */
- if (!new)
+ if (old && !new)
new = find_monitor_by_winsys_id (window, old->winsys_id);
/* Fall back to primary if everything else failed */
--
2.14.2

119
mutter-preferred-mode.patch Normal file
View File

@ -0,0 +1,119 @@
From c0dc66e8c0dfc6ab02506343dc8418891159657c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Wed, 18 Oct 2017 23:22:01 +0800
Subject: [PATCH] monitor/normal: Prefer modes with same flags as preferred
mode
When generating MetaMonitorMode's, prefer CRTC modes that has the same
set of flags as the preferred mode. This not only is probably a better
set of configurable modes, but it'll guarantee that the preferred mode
is added.
This fixes a crash when the preferred mode was not the first mode with
the same resolution, refresh rate and set of handled modes.
https://bugzilla.gnome.org/show_bug.cgi?id=789153
---
src/backends/meta-monitor.c | 41 ++++++++++++++++++++++++++++++++---------
1 file changed, 32 insertions(+), 9 deletions(-)
diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c
index 8ca6ea859..2d06a1e36 100644
--- a/src/backends/meta-monitor.c
+++ b/src/backends/meta-monitor.c
@@ -394,16 +394,22 @@ generate_mode_id (MetaMonitorModeSpec *monitor_mode_spec)
static gboolean
meta_monitor_add_mode (MetaMonitor *monitor,
- MetaMonitorMode *monitor_mode)
+ MetaMonitorMode *monitor_mode,
+ gboolean replace)
{
MetaMonitorPrivate *priv = meta_monitor_get_instance_private (monitor);
+ MetaMonitorMode *existing_mode;
- if (g_hash_table_lookup (priv->mode_ids,
- meta_monitor_mode_get_id (monitor_mode)))
+ existing_mode = g_hash_table_lookup (priv->mode_ids,
+ meta_monitor_mode_get_id (monitor_mode));
+ if (existing_mode && !replace)
return FALSE;
+ if (existing_mode)
+ priv->modes = g_list_remove (priv->modes, existing_mode);
+
priv->modes = g_list_append (priv->modes, monitor_mode);
- g_hash_table_insert (priv->mode_ids, monitor_mode->id, monitor_mode);
+ g_hash_table_replace (priv->mode_ids, monitor_mode->id, monitor_mode);
return TRUE;
}
@@ -415,13 +421,17 @@ meta_monitor_normal_generate_modes (MetaMonitorNormal *monitor_normal)
MetaMonitorPrivate *monitor_priv =
meta_monitor_get_instance_private (monitor);
MetaOutput *output;
+ MetaCrtcModeFlag preferred_mode_flags;
unsigned int i;
output = meta_monitor_get_main_output (monitor);
+ preferred_mode_flags = output->preferred_mode->flags;
+
for (i = 0; i < output->n_modes; i++)
{
MetaCrtcMode *crtc_mode = output->modes[i];
MetaMonitorMode *mode;
+ gboolean replace;
mode = g_new0 (MetaMonitorMode, 1);
mode->spec = (MetaMonitorModeSpec) {
@@ -437,13 +447,26 @@ meta_monitor_normal_generate_modes (MetaMonitorNormal *monitor_normal)
.crtc_mode = crtc_mode
};
+ /*
+ * We don't distinguish between all available mode flags, just the ones
+ * that are configurable. We still need to pick some mode though, so
+ * prefer ones that has the same set of flags as the preferred mode;
+ * otherwise take the first one in the list. This guarantees that the
+ * preferred mode is always added.
+ */
+ replace = crtc_mode->flags == preferred_mode_flags;
+
+ if (!meta_monitor_add_mode (monitor, mode, replace))
+ {
+ g_assert (crtc_mode != output->preferred_mode);
+ meta_monitor_mode_free (mode);
+ continue;
+ }
+
if (crtc_mode == output->preferred_mode)
monitor_priv->preferred_mode = mode;
if (output->crtc && crtc_mode == output->crtc->current_mode)
monitor_priv->current_mode = mode;
-
- if (!meta_monitor_add_mode (monitor, mode))
- meta_monitor_mode_free (mode);
}
}
@@ -825,7 +848,7 @@ generate_tiled_monitor_modes (MetaMonitorTiled *monitor_tiled)
tiled_modes = g_list_remove_link (tiled_modes, l);
- if (!meta_monitor_add_mode (monitor, mode))
+ if (!meta_monitor_add_mode (monitor, mode, FALSE))
{
meta_monitor_mode_free (mode);
continue;
@@ -967,7 +990,7 @@ generate_untiled_monitor_modes (MetaMonitorTiled *monitor_tiled)
if (!mode)
continue;
- if (!meta_monitor_add_mode (monitor, mode))
+ if (!meta_monitor_add_mode (monitor, mode, FALSE))
{
meta_monitor_mode_free (mode);
continue;
--
2.14.2

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Thu Oct 19 21:47:53 UTC 2017 - mgorse@suse.com
- Add mutter-handle-no-to-no-monitor.patch: fix possible crash when
turning monitor off and on while logged in (bgo#788607).
- Add mutter-preferred-mode.patch: fix a crash on some ATI (radeon)
configurations (bgo#789153).
-------------------------------------------------------------------
Tue Oct 10 13:03:00 UTC 2017 - zaitor@opensuse.org

View File

@ -32,6 +32,10 @@ Patch1: mutter-iconcache-Support-RGB16_565-format-for-16-bit-color-.patc
Patch2: mutter-wayland-dma-buf-modifiers-fix.patch
# PATCH-FIX-UPSTREAM mutter-x11-Protect-XChangeProperty-call.patch bgo#788666 zaitor@opensuse.org -- Protect XChangeProperty call with error traps
Patch3: mutter-x11-Protect-XChangeProperty-call.patch
# PATCH-FIX-UPSTREAM mutter-handle-no-to-no-monitor.patch bgo#788607 mgorse@suse.com -- handle updating from no to no monitor.
Patch4: mutter-handle-no-to-no-monitor.patch
# PATCH-FIX-UPSTREAM mutter-preferred-mode.patch bgo#789153 mgorse@suse.com -- monitor/normal: prefer modes with same flags as preferred mode.
Patch5: mutter-preferred-mode.patch
# SLE only patches start at 1000
# PATCH-FEATURE-SLE mutter-SLE-bell.patch FATE#316042 bnc#889218 idonmez@suse.com -- make audible bell work out of the box.
@ -144,6 +148,8 @@ applications that want to make use of the mutter library.
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
# SLE only patches and translations.
%if !0%{?is_opensuse}