[Spice-devel] [PATCH v3 7/9] widget: update d->ready based on scanout image available

Marc-André Lureau marcandre.lureau at gmail.com
Thu Mar 24 11:32:41 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>
Acked-by: Pavel Grunt <pgrunt at redhat.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 b9bec68..126269f 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 b75bcd7..fdac085 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -232,7 +232,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.5



More information about the Spice-devel mailing list