Fix display refresh unless scaling is forced (rhbz#1382325)

This commit is contained in:
Marc-André Lureau 2016-10-06 15:30:18 +04:00
parent ea849b12d3
commit 8177a839b6
2 changed files with 86 additions and 1 deletions

View File

@ -0,0 +1,81 @@
From a395ac59447dedfb922f997c7c9cff93edd53600 Mon Sep 17 00:00:00 2001
From: Lukas Venhoda <lvenhoda@redhat.com>
Date: Thu, 28 Jul 2016 15:51:30 +0200
Subject: [PATCH spice-gtk] spice-widget: init egl only after first gl_scanout
When using GtkDrawingArea and EGL was not used, it was still initialized.
This produced warning messages on systems where EGL is not supported.
Move spice_egl_init from drawing_area_realize to gl_scanout.
Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=95254
---
src/spice-widget.c | 36 +++++++++++++++++++++++-------------
1 file changed, 23 insertions(+), 13 deletions(-)
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 9020b07..7c1c756 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -568,20 +568,11 @@ drawing_area_realize(GtkWidget *area, gpointer user_data)
{
#ifdef GDK_WINDOWING_X11
SpiceDisplay *display = SPICE_DISPLAY(user_data);
- GError *err = NULL;
- if (!GDK_IS_X11_DISPLAY(gdk_display_get_default()))
- return;
+ if (GDK_IS_X11_DISPLAY(gdk_display_get_default()) &&
+ spice_display_get_gl_scanout(SPICE_DISPLAY_CHANNEL(display->priv->display)) != NULL)
+ spice_display_widget_gl_scanout(display);
- if (!spice_egl_init(display, &err)) {
- g_critical("egl init failed: %s", err->message);
- g_clear_error(&err);
- }
-
- if (!spice_egl_realize_display(display, gtk_widget_get_window(area), &err)) {
- g_critical("egl realize failed: %s", err->message);
- g_clear_error(&err);
- }
#endif
}
@@ -2662,13 +2653,32 @@ G_GNUC_INTERNAL
void spice_display_widget_gl_scanout(SpiceDisplay *display)
{
SpiceDisplayPrivate *d = display->priv;
+ GError *err = NULL;
SPICE_DEBUG("%s: got scanout", __FUNCTION__);
+
+#ifdef GDK_WINDOWING_X11
+ GtkWidget *area = gtk_stack_get_child_by_name(d->stack, "draw-area");
+
+ if (GDK_IS_X11_DISPLAY(gdk_display_get_default()) &&
+ !d->egl.context_ready &&
+ gtk_widget_get_realized(area)) {
+ if (!spice_egl_init(display, &err)) {
+ g_critical("egl init failed: %s", err->message);
+ g_clear_error(&err);
+ }
+
+ if (!spice_egl_realize_display(display, gtk_widget_get_window(area), &err)) {
+ g_critical("egl realize failed: %s", err->message);
+ g_clear_error(&err);
+ }
+ }
+#endif
+
set_egl_enabled(display, true);
if (d->egl.context_ready) {
const SpiceGlScanout *scanout;
- GError *err = NULL;
scanout = spice_display_get_gl_scanout(SPICE_DISPLAY_CHANNEL(d->display));
/* should only be called when the display has a scanout */
--
2.10.0

View File

@ -2,7 +2,7 @@
Name: spice-gtk
Version: 0.32
Release: 2%{?dist}
Release: 3%{?dist}
Summary: A GTK+ widget for SPICE clients
Group: System Environment/Libraries
@ -15,6 +15,7 @@ Patch2: 0002-usbredir-Use-atomic-for-UsbDeviceManager-event_threa.patch
Patch3: 0003-usb-channel-Really-stop-listening-for-USB-events-on-.patch
Patch4: 0004-usb-device-manager-Avoid-USB-event-thread-leak.patch
Patch5: 0005-util-fix-off-by-one-array-access.patch
Patch6: 0006-spice-widget-init-egl-only-after-first-gl_scanout.patch
BuildRequires: intltool
BuildRequires: usbredir-devel >= 0.5.2
@ -189,6 +190,9 @@ rm -f %{buildroot}%{_libdir}/*.la
%{_bindir}/spicy-stats
%changelog
* Thu Oct 06 2016 Marc-André Lureau <marcandre.lureau@redhat.com> - 0.32-3
- Fix display refresh unless scaling is forced (rhbz#1382325)
* Mon Jul 11 2016 Christophe Fergeau <cfergeau@redhat.com> 0.32-2
- Add upstream patches fixing USB event thread leak
Resolves: rhbz#1217202 (virt-manager)