[Spice-devel] [PATCH spice-gtk v2 7/8] widget: update d->ready based on scanout image available

Marc-André Lureau marcandre.lureau at gmail.com
Tue Mar 22 12:57:14 UTC 2016


d->ready is updated based on monitor area & canvas. In case of GL
rendering, update it based on monitor area & scanout and add check
before drawing update.

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

diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
index d6f436d..5fcdcaa 100644
--- a/src/spice-widget-egl.c
+++ b/src/spice-widget-egl.c
@@ -396,7 +396,7 @@ void spice_egl_resize_display(SpiceDisplay *display, int w, int h)
     apply_ortho(d->egl.mproj, 0, w, 0, h, -1, 1);
     glViewport(0, 0, w, h);
 
-    if (d->egl.image)
+    if (d->ready)
         spice_egl_update_display(display);
 
     glUseProgram(prog);
@@ -506,9 +506,7 @@ void spice_egl_update_display(SpiceDisplay *display)
     gdouble tx, ty, tw, th;
     int prog;
 
-    g_return_if_fail(d->egl.image != NULL);
-    if (d->egl.surface == EGL_NO_SURFACE)
-        return;
+    g_return_if_fail(d->ready);
 
     spice_display_get_scaling(display, &s, &x, &y, &w, &h);
 
diff --git a/src/spice-widget.c b/src/spice-widget.c
index f0f065c..e16126a 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -234,7 +234,11 @@ static void update_ready(SpiceDisplay *display)
     SpiceDisplayPrivate *d = display->priv;
     gboolean ready;
 
-    ready = d->mark != 0 && d->monitor_ready;
+    ready = d->monitor_ready &&
+#ifndef G_OS_WIN32
+        d->egl.enabled ? d->egl.image != NULL :
+#endif
+        d->mark;
 
     /* If the 'resize-guest' property is set, the application expects spice-gtk
      * to manage the size and state of the displays, so update the 'enabled'
-- 
2.5.0



More information about the Spice-devel mailing list