spice-gtk/0002-widget-skip-spice_egl_resize_display-if-context-is-n.patch

57 lines
2.0 KiB
Diff
Raw Normal View History

From c576359ce356c071e8955c773d0781151d5b199b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
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 <marcandre.lureau@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
---
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