[Spice-devel] [PATCH spice-gtk 5/7] egl: fix multiple gl display flickering

Marc-André Lureau marcandre.lureau at gmail.com
Fri May 20 15:16:41 UTC 2016


For some unclear reason, when multiple display use gl in the same
process (with virt-manager for ex), the texture content can be
overwritten by another display on update.

Although the gl contexts are differents when using multiple widgets,
even when sharing a texture ID, it shouldn't overwrite the other context
texture, there is something fishy.

Set the image texture target before drawing to solve this for now.

Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
---
 src/spice-widget-egl.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
index 210b834..5c24524 100644
--- a/src/spice-widget-egl.c
+++ b/src/spice-widget-egl.c
@@ -548,8 +548,12 @@ void spice_egl_update_display(SpiceDisplay *display)
     }
     SPICE_DEBUG("update %f +%d+%d %dx%d +%f+%f %fx%f", s, x, y, w, h,
                 tx, ty, tw, th);
-
     glBindTexture(GL_TEXTURE_2D, d->egl.tex_id);
+    /* FIXME: this should be only necessary on scanout update */
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+    glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES)d->egl.image);
+
     glDisable(GL_BLEND);
     glGetIntegerv(GL_CURRENT_PROGRAM, &prog);
     glUseProgram(d->egl.prog);
@@ -627,10 +631,6 @@ gboolean spice_egl_update_scanout(SpiceDisplay *display,
                                        (EGLClientBuffer)NULL,
                                        attrs);
 
-    glBindTexture(GL_TEXTURE_2D, d->egl.tex_id);
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-    glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES)d->egl.image);
     d->egl.scanout = *scanout;
 
     return TRUE;
-- 
2.7.4



More information about the Spice-devel mailing list