[Spice-devel] [PATCH spice-gtk 7/7] egl: set current context, fix multiple display
Marc-André Lureau
marcandre.lureau at gmail.com
Fri May 20 15:16:43 UTC 2016
On X11, each widget has its own context. Make sure we are using the
widget associated context when using gl.
Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1337721
Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
---
src/spice-widget-egl.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
index 754fc20..5612959 100644
--- a/src/spice-widget-egl.c
+++ b/src/spice-widget-egl.c
@@ -349,6 +349,14 @@ void spice_egl_unrealize_display(SpiceDisplay *display)
SPICE_DEBUG("egl unrealize %p", d->egl.surface);
+ if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
+ EGLBoolean b = eglMakeCurrent(d->egl.display,
+ d->egl.surface,
+ d->egl.surface,
+ d->egl.ctx);
+ g_return_if_fail(b == EGL_TRUE);
+ }
+
if (d->egl.image != NULL) {
eglDestroyImageKHR(d->egl.display, d->egl.image);
d->egl.image = NULL;
@@ -516,6 +524,13 @@ void spice_egl_update_display(SpiceDisplay *display)
g_return_if_fail(d->ready);
+ if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
+ EGLBoolean b = eglMakeCurrent(d->egl.display,
+ d->egl.surface,
+ d->egl.surface,
+ d->egl.ctx);
+ g_return_if_fail(b == EGL_TRUE);
+ }
spice_display_get_scaling(display, &s, &x, &y, &w, &h);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
--
2.7.4
More information about the Spice-devel
mailing list