Blame 0216-spice-split-qemu_spice_create_update.patch

93b7e3
From a754b60d7602dae18120ab014735927058e89983 Mon Sep 17 00:00:00 2001
93b7e3
From: Gerd Hoffmann <kraxel@redhat.com>
93b7e3
Date: Wed, 5 Sep 2012 08:52:23 +0200
93b7e3
Subject: [PATCH 216/293] spice: split qemu_spice_create_update
93b7e3
93b7e3
Creating one function which creates a single update for a given
93b7e3
rectangle.  And one (for now) pretty simple wrapper around it to
93b7e3
queue up screen updates for the dirty region.
93b7e3
93b7e3
[ v2: also update bounding box ]
93b7e3
93b7e3
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
93b7e3
---
93b7e3
 ui/spice-display.c | 31 ++++++++++++++++++-------------
93b7e3
 1 file changed, 18 insertions(+), 13 deletions(-)
93b7e3
93b7e3
diff --git a/ui/spice-display.c b/ui/spice-display.c
93b7e3
index 59c5fd7..6f68f28 100644
93b7e3
--- a/ui/spice-display.c
93b7e3
+++ b/ui/spice-display.c
93b7e3
@@ -164,7 +164,8 @@ int qemu_spice_display_is_running(SimpleSpiceDisplay *ssd)
93b7e3
 #endif
93b7e3
 }
93b7e3
 
93b7e3
-static void qemu_spice_create_update(SimpleSpiceDisplay *ssd)
93b7e3
+static void qemu_spice_create_one_update(SimpleSpiceDisplay *ssd,
93b7e3
+                                         QXLRect *rect)
93b7e3
 {
93b7e3
     SimpleSpiceUpdate *update;
93b7e3
     QXLDrawable *drawable;
93b7e3
@@ -174,24 +175,20 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd)
93b7e3
     int by, bw, bh;
93b7e3
     struct timespec time_space;
93b7e3
 
93b7e3
-    if (qemu_spice_rect_is_empty(&ssd->dirty)) {
93b7e3
-        return;
93b7e3
-    };
93b7e3
-
93b7e3
     trace_qemu_spice_create_update(
93b7e3
-           ssd->dirty.left, ssd->dirty.right,
93b7e3
-           ssd->dirty.top, ssd->dirty.bottom);
93b7e3
+           rect->left, rect->right,
93b7e3
+           rect->top, rect->bottom);
93b7e3
 
93b7e3
     update   = g_malloc0(sizeof(*update));
93b7e3
     drawable = &update->drawable;
93b7e3
     image    = &update->image;
93b7e3
     cmd      = &update->ext.cmd;
93b7e3
 
93b7e3
-    bw       = ssd->dirty.right - ssd->dirty.left;
93b7e3
-    bh       = ssd->dirty.bottom - ssd->dirty.top;
93b7e3
+    bw       = rect->right - rect->left;
93b7e3
+    bh       = rect->bottom - rect->top;
93b7e3
     update->bitmap = g_malloc(bw * bh * 4);
93b7e3
 
93b7e3
-    drawable->bbox            = ssd->dirty;
93b7e3
+    drawable->bbox            = *rect;
93b7e3
     drawable->clip.type       = SPICE_CLIP_TYPE_NONE;
93b7e3
     drawable->effect          = QXL_EFFECT_OPAQUE;
93b7e3
     drawable->release_info.id = (uintptr_t)update;
93b7e3
@@ -226,8 +223,8 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd)
93b7e3
     }
93b7e3
 
93b7e3
     src = ds_get_data(ssd->ds) +
93b7e3
-        ssd->dirty.top * ds_get_linesize(ssd->ds) +
93b7e3
-        ssd->dirty.left * ds_get_bytes_per_pixel(ssd->ds);
93b7e3
+        rect->top * ds_get_linesize(ssd->ds) +
93b7e3
+        rect->left * ds_get_bytes_per_pixel(ssd->ds);
93b7e3
     dst = update->bitmap;
93b7e3
     for (by = 0; by < bh; by++) {
93b7e3
         qemu_pf_conv_run(ssd->conv, dst, src, bw);
93b7e3
@@ -238,10 +235,18 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd)
93b7e3
     cmd->type = QXL_CMD_DRAW;
93b7e3
     cmd->data = (uintptr_t)drawable;
93b7e3
 
93b7e3
-    memset(&ssd->dirty, 0, sizeof(ssd->dirty));
93b7e3
     QTAILQ_INSERT_TAIL(&ssd->updates, update, next);
93b7e3
 }
93b7e3
 
93b7e3
+static void qemu_spice_create_update(SimpleSpiceDisplay *ssd)
93b7e3
+{
93b7e3
+    if (qemu_spice_rect_is_empty(&ssd->dirty)) {
93b7e3
+        return;
93b7e3
+    };
93b7e3
+    qemu_spice_create_one_update(ssd, &ssd->dirty);
93b7e3
+    memset(&ssd->dirty, 0, sizeof(ssd->dirty));
93b7e3
+}
93b7e3
+
93b7e3
 /*
93b7e3
  * Called from spice server thread context (via interface_release_ressource)
93b7e3
  * We do *not* hold the global qemu mutex here, so extra care is needed
93b7e3
-- 
93b7e3
1.7.12
93b7e3