Backport MR #498 for spinner bug, plus two crasher fixes

Resolves: #1692135
This commit is contained in:
Adam Williamson 2019-04-17 09:06:33 -07:00
parent 10980c1402
commit 2e1cec2052
4 changed files with 233 additions and 0 deletions

View File

@ -0,0 +1,28 @@
From 639be849cd80b38567f6abb0279bef59f17ac5ca Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Mon, 18 Mar 2019 11:59:26 +0100
Subject: [PATCH 1/3] core: Remove startup sequences after timeout
The complete/remove semantics were split to cater for presenting windows,
so we must now separately do both here.
Related: https://gitlab.gnome.org/GNOME/mutter/issues/501
---
src/core/startup-notification.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/core/startup-notification.c b/src/core/startup-notification.c
index 8bcb0f385..d2d0d1362 100644
--- a/src/core/startup-notification.c
+++ b/src/core/startup-notification.c
@@ -454,6 +454,7 @@ startup_sequence_timeout (void *data)
meta_startup_sequence_get_id (sequence));
meta_startup_sequence_complete (sequence);
+ meta_startup_notification_remove_sequence (sn, sequence);
}
g_slist_free (ctod.list);
--
2.21.0

View File

@ -0,0 +1,130 @@
From 1074040be3b89ffa7d6fb15a3c1ef35e141e15d1 Mon Sep 17 00:00:00 2001
From: Pekka Paalanen <pekka.paalanen@collabora.com>
Date: Wed, 3 Apr 2019 13:11:45 +0300
Subject: [PATCH 2/3] renderer/native: Make EGL initialization failure not
fatal
The failure to initialize EGL does not necessarily mean the KMS device cannot
be used. The device could still be used as a "secondary GPU" with the CPU copy
mode.
If meta_renderer_native_create_renderer_gpu_data () fails,
meta_renderer_native_get_gpu_data () will return NULL, which may cause crashes.
This patch removes most of the failures, but does not fix the NULL dereferences
that will still happen if creating gpu data fails.
This patch reorders create_renderer_gpu_data_gbm () so that it fails hard only
if GBM device cannot be created, and otherwise always returns an initialized
gpu data structure. Users of the gpu data structure are responsible for
checking egl_display validity.
The GBM device creation failure is a hard failure because presumably GBM is
necessary for cursors.
Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/542
https://gitlab.gnome.org/GNOME/mutter/merge_requests/521
---
src/backends/native/meta-renderer-native.c | 62 ++++++++++++++--------
1 file changed, 40 insertions(+), 22 deletions(-)
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index 771ca0872..c7483f3cd 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -3698,16 +3698,13 @@ gpu_kms_is_hardware_rendering (MetaRendererNative *renderer_native,
return data->secondary.is_hardware_rendering;
}
-static MetaRendererNativeGpuData *
-create_renderer_gpu_data_gbm (MetaRendererNative *renderer_native,
- MetaGpuKms *gpu_kms,
- GError **error)
+static EGLDisplay
+init_gbm_egl_display (MetaRendererNative *renderer_native,
+ struct gbm_device *gbm_device,
+ GError **error)
{
MetaEgl *egl = meta_renderer_native_get_egl (renderer_native);
- struct gbm_device *gbm_device;
EGLDisplay egl_display;
- int kms_fd;
- MetaRendererNativeGpuData *renderer_gpu_data;
if (!meta_egl_has_extensions (egl, EGL_NO_DISPLAY, NULL,
"EGL_MESA_platform_gbm",
@@ -3719,9 +3716,31 @@ create_renderer_gpu_data_gbm (MetaRendererNative *renderer_native,
g_set_error (error, G_IO_ERROR,
G_IO_ERROR_FAILED,
"Missing extension for GBM renderer: EGL_KHR_platform_gbm");
- return NULL;
+ return EGL_NO_DISPLAY;
}
+ egl_display = meta_egl_get_platform_display (egl,
+ EGL_PLATFORM_GBM_KHR,
+ gbm_device, NULL, error);
+ if (egl_display == EGL_NO_DISPLAY)
+ return EGL_NO_DISPLAY;
+
+ if (!meta_egl_initialize (egl, egl_display, error))
+ return EGL_NO_DISPLAY;
+
+ return egl_display;
+}
+
+static MetaRendererNativeGpuData *
+create_renderer_gpu_data_gbm (MetaRendererNative *renderer_native,
+ MetaGpuKms *gpu_kms,
+ GError **error)
+{
+ struct gbm_device *gbm_device;
+ int kms_fd;
+ MetaRendererNativeGpuData *renderer_gpu_data;
+ g_autoptr (GError) local_error = NULL;
+
kms_fd = meta_gpu_kms_get_fd (gpu_kms);
gbm_device = gbm_create_device (kms_fd);
@@ -3733,26 +3752,25 @@ create_renderer_gpu_data_gbm (MetaRendererNative *renderer_native,
return NULL;
}
- egl_display = meta_egl_get_platform_display (egl,
- EGL_PLATFORM_GBM_KHR,
- gbm_device, NULL, error);
- if (egl_display == EGL_NO_DISPLAY)
- {
- gbm_device_destroy (gbm_device);
- return NULL;
- }
-
- if (!meta_egl_initialize (egl, egl_display, error))
- return NULL;
-
renderer_gpu_data = meta_create_renderer_native_gpu_data (gpu_kms);
renderer_gpu_data->renderer_native = renderer_native;
renderer_gpu_data->gbm.device = gbm_device;
renderer_gpu_data->mode = META_RENDERER_NATIVE_MODE_GBM;
- renderer_gpu_data->egl_display = egl_display;
- init_secondary_gpu_data (renderer_gpu_data);
+ renderer_gpu_data->egl_display = init_gbm_egl_display (renderer_native,
+ gbm_device,
+ &local_error);
+ if (renderer_gpu_data->egl_display == EGL_NO_DISPLAY)
+ {
+ g_debug ("GBM EGL init for %s failed: %s",
+ meta_gpu_kms_get_file_path (gpu_kms),
+ local_error->message);
+ init_secondary_gpu_data_cpu (renderer_gpu_data);
+ return renderer_gpu_data;
+ }
+
+ init_secondary_gpu_data (renderer_gpu_data);
return renderer_gpu_data;
}
--
2.21.0

View File

@ -0,0 +1,59 @@
From b09318fd75e1d4644381e7080105da18726bbdb9 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Mon, 15 Apr 2019 14:55:45 +0200
Subject: [PATCH 3/3] wayland/output: Set user data of xdg_output resource
mutter would randomly crash in `send_xdg_output_events()` when changing
the fractional scaling:
wl_resource_post_event ()
zxdg_output_v1_send_logical_size ()
send_xdg_output_events ()
wayland_output_update_for_output ()
meta_wayland_compositor_update_outputs ()
on_monitors_changed ()
g_closure_invoke ()
signal_emit_unlocked_R ()
g_signal_emit_valist ()
_signal_emit ()
meta_monitor_manager_notify_monitors_changed ()
meta_monitor_manager_rebuild ()
This is because the xdg-output resource got freed but wasn't removed
from the list of resources.
Fix this by setting the user data of the xdg-output resource to the
corresponding `MetaWaylandOutput` so that the xdg-output resource
destructor can remove it from the list of resources.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/538
---
src/wayland/meta-wayland-outputs.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/wayland/meta-wayland-outputs.c b/src/wayland/meta-wayland-outputs.c
index 7695d86af..099e87ab9 100644
--- a/src/wayland/meta-wayland-outputs.c
+++ b/src/wayland/meta-wayland-outputs.c
@@ -624,14 +624,14 @@ meta_xdg_output_manager_get_xdg_output (struct wl_client *client,
wl_resource_get_version (resource),
id);
- wl_resource_set_implementation (xdg_output_resource,
- &meta_xdg_output_interface,
- NULL, meta_xdg_output_destructor);
-
wayland_output = wl_resource_get_user_data (output);
if (!wayland_output)
return;
+ wl_resource_set_implementation (xdg_output_resource,
+ &meta_xdg_output_interface,
+ wayland_output, meta_xdg_output_destructor);
+
wayland_output->xdg_output_resources =
g_list_prepend (wayland_output->xdg_output_resources, xdg_output_resource);
--
2.21.0

View File

@ -25,6 +25,18 @@ Patch1: 0001-build-Don-t-use-absolute-paths-with-subdir-keyword.patch
# Backport work-around for hangul text input bug (rhbz#1632981) # Backport work-around for hangul text input bug (rhbz#1632981)
Patch2: 0001-wayland-Defer-text_input.done-on-an-idle.patch Patch2: 0001-wayland-Defer-text_input.done-on-an-idle.patch
# https://gitlab.gnome.org/GNOME/mutter/merge_requests/498 fixes
# https://gitlab.gnome.org/GNOME/mutter/issues/501 /
# https://bugzilla.redhat.com/show_bug.cgi?id=1692135
Patch3: 0001-core-Remove-startup-sequences-after-timeout.patch
# https://gitlab.gnome.org/GNOME/mutter/merge_requests/521 fixes
# https://gitlab.gnome.org/GNOME/mutter/issues/542 (crasher)
Patch4: 0002-renderer-native-Make-EGL-initialization-failure-not-.patch
# https://gitlab.gnome.org/GNOME/mutter/merge_requests/538 (crash fix)
Patch5: 0003-wayland-output-Set-user-data-of-xdg_output-resource.patch
BuildRequires: chrpath BuildRequires: chrpath
BuildRequires: pango-devel BuildRequires: pango-devel
BuildRequires: startup-notification-devel BuildRequires: startup-notification-devel
@ -166,6 +178,10 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop
%{_datadir}/mutter-%{mutter_api_version}/tests %{_datadir}/mutter-%{mutter_api_version}/tests
%changelog %changelog
* Wed Apr 17 2019 Adam Williamson <awilliam@redhat.com> - 3.32.0-4
- Backport MR #498 for spinner bug, plus two crasher fixes
Resolves: #1692135
* Tue Apr 16 2019 Adam Williamson <awilliam@redhat.com> - 3.32.0-3 * Tue Apr 16 2019 Adam Williamson <awilliam@redhat.com> - 3.32.0-3
- Rebuild with Meson fix for #1699099 - Rebuild with Meson fix for #1699099