From 56da38a9f40d802cfae6469485dcce22f010a6eb Mon Sep 17 00:00:00 2001 Message-Id: <56da38a9f40d802cfae6469485dcce22f010a6eb.1349887753.git.minovotn@redhat.com> In-Reply-To: <8366ff5a206b0f75edd17a4a78f7c389ebb81d49.1349887753.git.minovotn@redhat.com> References: <8366ff5a206b0f75edd17a4a78f7c389ebb81d49.1349887753.git.minovotn@redhat.com> From: Gerd Hoffmann Date: Fri, 21 Sep 2012 08:26:32 +0200 Subject: [PATCH 02/11] spice: split qemu_spice_create_update RH-Author: Gerd Hoffmann Message-id: <1348215994-27217-3-git-send-email-kraxel@redhat.com> Patchwork-id: 42156 O-Subject: [RHEL-6.4 qemu-kvm PATCH 2/4] spice: split qemu_spice_create_update Bugzilla: 854528 RH-Acked-by: Hans de Goede RH-Acked-by: Paolo Bonzini RH-Acked-by: Alon Levy Creating one function which creates a single update for a given rectangle. And one (for now) pretty simple wrapper around it to queue up screen updates for the dirty region. [ v2: also update bounding box ] Signed-off-by: Gerd Hoffmann Conflicts: ui/spice-display.c upstream: c60319a3aa136769e38ea8b24e91fb4867c4587d --- ui/spice-display.c | 31 ++++++++++++++++++------------- 1 files changed, 18 insertions(+), 13 deletions(-) Signed-off-by: Michal Novotny --- ui/spice-display.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/ui/spice-display.c b/ui/spice-display.c index d227bc7..62904bd 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -157,7 +157,8 @@ int qemu_spice_display_is_running(SimpleSpiceDisplay *ssd) #endif } -static void qemu_spice_create_update(SimpleSpiceDisplay *ssd) +static void qemu_spice_create_one_update(SimpleSpiceDisplay *ssd, + QXLRect *rect) { SimpleSpiceUpdate *update; QXLDrawable *drawable; @@ -166,24 +167,20 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd) uint8_t *src, *dst; int by, bw, bh; - if (qemu_spice_rect_is_empty(&ssd->dirty)) { - return; - }; - dprint(2, "%s: lr %d -> %d, tb -> %d -> %d\n", __FUNCTION__, - ssd->dirty.left, ssd->dirty.right, - ssd->dirty.top, ssd->dirty.bottom); + rect->left, rect->right, + rect->top, rect->bottom); update = qemu_mallocz(sizeof(*update)); drawable = &update->drawable; image = &update->image; cmd = &update->ext.cmd; - bw = ssd->dirty.right - ssd->dirty.left; - bh = ssd->dirty.bottom - ssd->dirty.top; + bw = rect->right - rect->left; + bh = rect->bottom - rect->top; update->bitmap = qemu_malloc(bw * bh * 4); - drawable->bbox = ssd->dirty; + drawable->bbox = *rect; drawable->clip.type = SPICE_CLIP_TYPE_NONE; drawable->effect = QXL_EFFECT_OPAQUE; drawable->release_info.id = (intptr_t)update; @@ -214,8 +211,8 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd) } src = ds_get_data(ssd->ds) + - ssd->dirty.top * ds_get_linesize(ssd->ds) + - ssd->dirty.left * ds_get_bytes_per_pixel(ssd->ds); + rect->top * ds_get_linesize(ssd->ds) + + rect->left * ds_get_bytes_per_pixel(ssd->ds); dst = update->bitmap; for (by = 0; by < bh; by++) { qemu_pf_conv_run(ssd->conv, dst, src, bw); @@ -226,10 +223,18 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd) cmd->type = QXL_CMD_DRAW; cmd->data = (intptr_t)drawable; - memset(&ssd->dirty, 0, sizeof(ssd->dirty)); QTAILQ_INSERT_TAIL(&ssd->updates, update, next); } +static void qemu_spice_create_update(SimpleSpiceDisplay *ssd) +{ + if (qemu_spice_rect_is_empty(&ssd->dirty)) { + return; + }; + qemu_spice_create_one_update(ssd, &ssd->dirty); + memset(&ssd->dirty, 0, sizeof(ssd->dirty)); +} + /* * Called from spice server thread context (via interface_release_ressource) * We do *not* hold the global qemu mutex here, so extra care is needed -- 1.7.11.4