[Spice-devel] [PATCH 18/18] worker: merge red_draw_qxl_drawable in drawable_draw

Frediano Ziglio fziglio at redhat.com
Wed Nov 18 08:17:37 PST 2015


From: Marc-André Lureau <marcandre.lureau at gmail.com>

---
 server/red_worker.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/server/red_worker.c b/server/red_worker.c
index e31dd08..30dcbce 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -176,8 +176,7 @@ typedef struct BitmapData {
 
 static inline int validate_surface(DisplayChannel *display, uint32_t surface_id);
 
-static void red_draw_qxl_drawable(DisplayChannel *display, Drawable *drawable);
-static void red_draw_drawable(DisplayChannel *display, Drawable *item);
+static void drawable_draw(DisplayChannel *display, Drawable *item);
 static void red_update_area(DisplayChannel *display, const SpiceRect *area, int surface_id);
 static void red_update_area_till(DisplayChannel *display, const SpiceRect *area, int surface_id,
                                  Drawable *last);
@@ -1139,7 +1138,7 @@ static bool free_one_drawable(DisplayChannel *display, int force_glz_free)
             dcc_free_glz_drawable(glz->dcc, glz);
         }
     }
-    red_draw_drawable(display, drawable);
+    drawable_draw(display, drawable);
     container = drawable->tree_item.base.container;
 
     current_remove_drawable(display, drawable);
@@ -1401,14 +1400,17 @@ static void image_surface_init(DisplayChannel *display)
     display->image_surfaces.ops = &image_surfaces_ops;
 }
 
-static void red_draw_qxl_drawable(DisplayChannel *display, Drawable *drawable)
+static void drawable_draw(DisplayChannel *display, Drawable *drawable)
 {
     RedSurface *surface;
     SpiceCanvas *canvas;
     SpiceClip clip = drawable->red_drawable->clip;
 
+    red_flush_source_surfaces(display, drawable);
+
     surface = &display->surfaces[drawable->surface_id];
     canvas = surface->context.canvas;
+    spice_return_if_fail(canvas);
 
     image_cache_aging(&display->image_cache);
 
@@ -1538,12 +1540,6 @@ static void red_draw_qxl_drawable(DisplayChannel *display, Drawable *drawable)
     }
 }
 
-static void red_draw_drawable(DisplayChannel *display, Drawable *drawable)
-{
-    red_flush_source_surfaces(display, drawable);
-    red_draw_qxl_drawable(display, drawable);
-}
-
 static void validate_area(DisplayChannel *display, const SpiceRect *area, uint32_t surface_id)
 {
     RedSurface *surface;
@@ -1637,12 +1633,12 @@ static void red_update_area_till(DisplayChannel *display, const SpiceRect *area,
         container = now->tree_item.base.container;
         current_remove_drawable(display, now);
         container_cleanup(container);
-        /* red_draw_drawable may call red_update_area for the surfaces 'now' depends on. Notice,
+        /* drawable_draw may call red_update_area for the surfaces 'now' depends on. Notice,
            that it is valid to call red_update_area in this case and not red_update_area_till:
            It is impossible that there was newer item then 'last' in one of the surfaces
            that red_update_area is called for, Otherwise, 'now' would have already been rendered.
            See the call for red_handle_depends_on_target_surface in red_process_draw */
-        red_draw_drawable(display, now);
+        drawable_draw(display, now);
         display_channel_drawable_unref(display, now);
     } while (now != surface_last);
     validate_area(display, area, surface_id);
@@ -1695,7 +1691,7 @@ static void red_update_area(DisplayChannel *display, const SpiceRect *area, int
         container = now->tree_item.base.container;
         current_remove_drawable(display, now);
         container_cleanup(container);
-        red_draw_drawable(display, now);
+        drawable_draw(display, now);
         display_channel_drawable_unref(display, now);
     } while (now != last);
     validate_area(display, area, surface_id);
-- 
2.4.3



More information about the Spice-devel mailing list