From 58daa5a8e48921c38949941a9999d5475867e852 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Tue, 20 Jun 2017 18:16:00 -0400 Subject: [PATCH] channel-usbredir: Fix crash on channel-up. Resolves: rhbz#1399838 usbutils no longer ships usb.ids, it is hwdata now, set path manually. Backport fixes for "Couldn't find current GL or GLX context" Resolves: rhbz#1461802 --- ...e_egl_resize_display-if-context-is-n.patch | 56 ++++++++++++++++++ ...dget-call-gl-draw-when-skipping-draw.patch | 38 ++++++++++++ ...nel-usbredir-Fix-crash-on-channel-up.patch | 59 +++++++++++++++++++ spice-gtk.spec | 10 +++- 4 files changed, 162 insertions(+), 1 deletion(-) create mode 100644 0002-widget-skip-spice_egl_resize_display-if-context-is-n.patch create mode 100644 0003-widget-call-gl-draw-when-skipping-draw.patch create mode 100644 0004-channel-usbredir-Fix-crash-on-channel-up.patch diff --git a/0002-widget-skip-spice_egl_resize_display-if-context-is-n.patch b/0002-widget-skip-spice_egl_resize_display-if-context-is-n.patch new file mode 100644 index 0000000..dd7a203 --- /dev/null +++ b/0002-widget-skip-spice_egl_resize_display-if-context-is-n.patch @@ -0,0 +1,56 @@ +From c576359ce356c071e8955c773d0781151d5b199b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= +Date: Thu, 8 Jun 2017 00:38:45 +0400 +Subject: [PATCH spice-gtk 1/2] widget: skip spice_egl_resize_display() if + context is not ready +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +And call spice_egl_resize_display() when initializing the context. + +The display must not call spice_egl_resize_display() if the egl/gl +context isn't ready. set_egl_enabled() is called whenever we get gl +drawing command from spice server. But the egl/gl context may not be +ready at that time. That function must still be run to switch the +display to GL, but has to delay any GL call to after the GL context is +realized. Add spice_egl_resize_display() there, to do the remaining +egl setup. + +This fixes the "Couldn't find current GL or GLX context" error for me +on X11. I thought first it was somehow related to commit a395ac59447de +"spice-widget: init egl only after first gl_scanout", but reverting it +didn't solve the problem, there are other timing changes, probably at +gtk level. + +Signed-off-by: Marc-André Lureau +Acked-by: Victor Toso +--- + src/spice-widget.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/spice-widget.c b/src/spice-widget.c +index 1a1d5a6..1e09389 100644 +--- a/src/spice-widget.c ++++ b/src/spice-widget.c +@@ -1327,7 +1327,7 @@ static void set_egl_enabled(SpiceDisplay *display, bool enabled) + enabled ? "gl-area" : "draw-area"); + } + +- if (enabled) { ++ if (enabled && d->egl.context_ready) { + spice_egl_resize_display(display, d->ww, d->wh); + } + +@@ -2861,6 +2861,8 @@ void spice_display_widget_gl_scanout(SpiceDisplay *display) + g_critical("egl realize failed: %s", err->message); + g_clear_error(&err); + } ++ ++ spice_egl_resize_display(display, d->ww, d->wh); + } + #endif + +-- +2.13.1.395.gf7b71de06 + diff --git a/0003-widget-call-gl-draw-when-skipping-draw.patch b/0003-widget-call-gl-draw-when-skipping-draw.patch new file mode 100644 index 0000000..33a5013 --- /dev/null +++ b/0003-widget-call-gl-draw-when-skipping-draw.patch @@ -0,0 +1,38 @@ +From 214b3396de62ace3e93ba14e5cff015244a52aff Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= +Date: Thu, 8 Jun 2017 00:41:49 +0400 +Subject: [PATCH spice-gtk 2/2] widget: call gl-draw when skipping draw +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It's a bad idea to hold the GL scanout for a long time, especially in +error cases. (fwiw, qemu has 1s tolerance before complaining, and the +guest is most likely going to hang meanwhile, stuck on the GPU) + +Signed-off-by: Marc-André Lureau +Acked-by: Victor Toso +--- + src/spice-widget.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/spice-widget.c b/src/spice-widget.c +index 1e09389..979e5fb 100644 +--- a/src/spice-widget.c ++++ b/src/spice-widget.c +@@ -2891,7 +2891,11 @@ static void gl_draw(SpiceDisplay *display, + + set_egl_enabled(display, true); + +- g_return_if_fail(d->egl.context_ready); ++ if (!d->egl.context_ready) { ++ SPICE_DEBUG("Draw without GL context, skipping"); ++ spice_display_gl_draw_done(SPICE_DISPLAY_CHANNEL(d->display)); ++ return; ++ } + + #if GTK_CHECK_VERSION(3,16,0) + GtkWidget *gl = gtk_stack_get_child_by_name(d->stack, "gl-area"); +-- +2.13.1.395.gf7b71de06 + diff --git a/0004-channel-usbredir-Fix-crash-on-channel-up.patch b/0004-channel-usbredir-Fix-crash-on-channel-up.patch new file mode 100644 index 0000000..4559891 --- /dev/null +++ b/0004-channel-usbredir-Fix-crash-on-channel-up.patch @@ -0,0 +1,59 @@ +From 291f3e4419e6fb4077ae43a5e09eb1c37b9dd729 Mon Sep 17 00:00:00 2001 +From: Victor Toso +Date: Tue, 29 Nov 2016 22:34:04 +0100 +Subject: [PATCH spice-gtk] channel-usbredir: Fix crash on channel-up + +SpiceSession does not initialize its SpiceUsbDeviceManager object on +startup that could lead to a race condition where channel-usbredir is +requested to flush data while it is uninitialized. + +In a few places, spice_usb_device_manager_get() is called as in +usb-device-widget.c and spice-gtk-session.c but not used in +spicy-stats, making the tool to crash on startup if it encounters an +usbredir channel. + + #0 in usbredirhost_write_guest_data (host=0x0) at usbredir/usbredirhost/usbredirhost.c:876 + #1 in spice_usbredir_channel_up (c=0x643830) at channel-usbredir.c:821 + #2 in spice_channel_up (channel=0x643830) at spice-channel.c:1238 + #3 in spice_channel_recv_auth (channel=0x643830) at spice-channel.c:1225 + #4 in spice_channel_coroutine (data=0x643830) at spice-channel.c:2580 + #5 in coroutine_trampoline (cc=0x642ec0) at coroutine_ucontext.c:63 + #6 in continuation_trampoline (i0=6565568, i1=0) at continuation.c:55 + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1399838 + +Signed-off-by: Victor Toso +Reported-by: Michael Cullen +Acked-by: Christophe Fergeau +--- + src/spice-session.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/spice-session.c b/src/spice-session.c +index f900bd1..cc3dbdd 100644 +--- a/src/spice-session.c ++++ b/src/spice-session.c +@@ -281,6 +281,7 @@ static void spice_session_init(SpiceSession *session) + { + SpiceSessionPrivate *s; + gchar *channels; ++ GError *err = NULL; + + SPICE_DEBUG("New session (compiled from package " PACKAGE_STRING ")"); + s = session->priv = SPICE_SESSION_GET_PRIVATE(session); +@@ -293,6 +294,12 @@ static void spice_session_init(SpiceSession *session) + s->images = cache_image_new((GDestroyNotify)pixman_image_unref); + s->glz_window = glz_decoder_window_new(); + update_proxy(session, NULL); ++ ++ s->usb_manager = spice_usb_device_manager_get(session, &err); ++ if (err != NULL) { ++ SPICE_DEBUG("Could not initialize SpiceUsbDeviceManager - %s", err->message); ++ g_clear_error(&err); ++ } + } + + static void +-- +2.13.1.395.gf7b71de06 + diff --git a/spice-gtk.spec b/spice-gtk.spec index 065c906..5d874e6 100644 --- a/spice-gtk.spec +++ b/spice-gtk.spec @@ -2,7 +2,7 @@ Name: spice-gtk Version: 0.33 -Release: 3%{?dist} +Release: 5%{?dist} Summary: A GTK+ widget for SPICE clients Group: System Environment/Libraries @@ -11,6 +11,9 @@ URL: http://spice-space.org/page/Spice-Gtk #VCS: git:git://anongit.freedesktop.org/spice/spice-gtk Source0: http://www.spice-space.org/download/gtk/%{name}-%{version}%{?_version_suffix}.tar.bz2 Patch1: 0001-clipboard-Fix-crash-by-handling-error.patch +Patch2: 0002-widget-skip-spice_egl_resize_display-if-context-is-n.patch +Patch3: 0003-widget-call-gl-draw-when-skipping-draw.patch +Patch4: 0004-channel-usbredir-Fix-crash-on-channel-up.patch BuildRequires: git-core BuildRequires: intltool @@ -192,6 +195,11 @@ rm -f %{buildroot}%{_libdir}/*.la %{_bindir}/spicy-stats %changelog +* Tue Jun 20 2017 Cole Robinson - 0.33-5 +- channel-usbredir: Fix crash on channel-up. Resolves: rhbz#1399838 +- usbutils no longer ships usb.ids, it is hwdata now, set path manually. +- Backport fixes for "Couldn't find current GL or GLX context" Resolves: rhbz#1461802 + * Sat Feb 11 2017 Fedora Release Engineering - 0.33-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild