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

Marc-André Lureau marcandre.lureau at gmail.com
Mon Mar 21 18:14:48 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 | 4 +++-
 src/spice-widget.c     | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
index 05fce85..271f5b3 100644
--- a/src/spice-widget-egl.c
+++ b/src/spice-widget-egl.c
@@ -395,7 +395,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->egl.image && d->ready)
         spice_egl_update_display(display);
 
     glUseProgram(prog);
@@ -506,6 +506,8 @@ void spice_egl_update_display(SpiceDisplay *display)
     int prog;
 
     g_return_if_fail(d->egl.image != NULL);
+    g_return_if_fail(d->ready);
+
     if (d->egl.surface == EGL_NO_SURFACE)
         return;
 
diff --git a/src/spice-widget.c b/src/spice-widget.c
index f3b8c3f..9c8f965 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -234,7 +234,8 @@ static void update_ready(SpiceDisplay *display)
     SpiceDisplayPrivate *d = display->priv;
     gboolean ready;
 
-    ready = d->mark != 0 && d->monitor_ready;
+    ready = d->monitor_ready &&
+        d->egl.enabled ? d->egl.image != NULL : 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