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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]