From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH v2 2/4] spice: split qemu_spice_create_update
Date: Thu, 6 Sep 2012 07:39:25 +0200 [thread overview]
Message-ID: <1346909967-10929-3-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1346909967-10929-1-git-send-email-kraxel@redhat.com>
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 <kraxel@redhat.com>
---
ui/spice-display.c | 31 ++++++++++++++++++-------------
1 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/ui/spice-display.c b/ui/spice-display.c
index 59c5fd7..6f68f28 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -164,7 +164,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;
@@ -174,24 +175,20 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd)
int by, bw, bh;
struct timespec time_space;
- if (qemu_spice_rect_is_empty(&ssd->dirty)) {
- return;
- };
-
trace_qemu_spice_create_update(
- ssd->dirty.left, ssd->dirty.right,
- ssd->dirty.top, ssd->dirty.bottom);
+ rect->left, rect->right,
+ rect->top, rect->bottom);
update = g_malloc0(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 = g_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 = (uintptr_t)update;
@@ -226,8 +223,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);
@@ -238,10 +235,18 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd)
cmd->type = QXL_CMD_DRAW;
cmd->data = (uintptr_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.1
next prev parent reply other threads:[~2012-09-06 5:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-06 5:39 [Qemu-devel] [PATCH v2 0/4] spice: improve vga mode performance Gerd Hoffmann
2012-09-06 5:39 ` [Qemu-devel] [PATCH v2 1/4] spice: switch to queue for vga mode updates Gerd Hoffmann
2012-09-06 12:07 ` Kevin Wolf
2012-09-06 12:53 ` Gerd Hoffmann
2012-09-06 5:39 ` Gerd Hoffmann [this message]
2012-09-06 5:39 ` [Qemu-devel] [PATCH v2 3/4] spice: add screen mirror Gerd Hoffmann
2012-09-06 5:39 ` [Qemu-devel] [PATCH v2 4/4] spice: send updates only for changed screen content Gerd Hoffmann
2012-09-06 13:38 ` [Qemu-devel] [PATCH v2 0/4] spice: improve vga mode performance Alon Levy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1346909967-10929-3-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).