* [Qemu-devel] [PATCH] spice: rework mirror allocation, add no-resize fast path
@ 2014-11-10 11:23 Gerd Hoffmann
2014-11-10 16:10 ` Eric Blake
0 siblings, 1 reply; 3+ messages in thread
From: Gerd Hoffmann @ 2014-11-10 11:23 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, Anthony Liguori
Add fast path to qemu_spice_display_switch in case old and new
displaysurface have identical size (happens with display panning
and page flipping). We just swap the backing store then and don't
go through the whole process of deleting and creating the primary
surface.
To simplify the code a mit move mirror surface allocation to
qemu_spice_display_switch().
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/spice-display.c | 33 ++++++++++++++++++++++++++-------
1 file changed, 26 insertions(+), 7 deletions(-)
diff --git a/ui/spice-display.c b/ui/spice-display.c
index 5d03340..d2e3793 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -207,12 +207,6 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd)
return;
};
- if (ssd->surface == NULL) {
- ssd->surface = pixman_image_ref(ssd->ds->image);
- ssd->mirror = qemu_pixman_mirror_create(ssd->ds->format,
- ssd->ds->image);
- }
-
for (blk = 0; blk < blocks; blk++) {
dirty_top[blk] = -1;
}
@@ -409,7 +403,29 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd,
SimpleSpiceUpdate *update;
bool need_destroy;
- dprint(1, "%s/%d:\n", __func__, ssd->qxl.id);
+ if (surface && ssd->surface &&
+ surface_width(surface) == pixman_image_get_width(ssd->surface) &&
+ surface_height(surface) == pixman_image_get_height(ssd->surface)) {
+ /* no-resize fast path: just swap backing store */
+ dprint(1, "%s/%d: fast (%dx%d)\n", __func__, ssd->qxl.id,
+ surface_width(surface), surface_height(surface));
+ qemu_mutex_lock(&ssd->lock);
+ ssd->ds = surface;
+ pixman_image_unref(ssd->surface);
+ ssd->surface = pixman_image_ref(ssd->ds->image);
+ qemu_mutex_unlock(&ssd->lock);
+ qemu_spice_display_update(ssd, 0, 0,
+ surface_width(surface),
+ surface_height(surface));
+ return;
+ }
+
+ /* full mode switch */
+ dprint(1, "%s/%d: full (%dx%d -> %dx%d)\n", __func__, ssd->qxl.id,
+ ssd->surface ? pixman_image_get_width(ssd->surface) : 0,
+ ssd->surface ? pixman_image_get_height(ssd->surface) : 0,
+ surface ? surface_width(surface) : 0,
+ surface ? surface_height(surface) : 0);
memset(&ssd->dirty, 0, sizeof(ssd->dirty));
if (ssd->surface) {
@@ -422,6 +438,9 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd,
qemu_mutex_lock(&ssd->lock);
need_destroy = (ssd->ds != NULL);
ssd->ds = surface;
+ ssd->surface = pixman_image_ref(ssd->ds->image);
+ ssd->mirror = qemu_pixman_mirror_create(ssd->ds->format,
+ ssd->ds->image);
while ((update = QTAILQ_FIRST(&ssd->updates)) != NULL) {
QTAILQ_REMOVE(&ssd->updates, update, next);
qemu_spice_destroy_update(ssd, update);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] spice: rework mirror allocation, add no-resize fast path
2014-11-10 11:23 [Qemu-devel] [PATCH] spice: rework mirror allocation, add no-resize fast path Gerd Hoffmann
@ 2014-11-10 16:10 ` Eric Blake
2014-11-11 7:33 ` Gerd Hoffmann
0 siblings, 1 reply; 3+ messages in thread
From: Eric Blake @ 2014-11-10 16:10 UTC (permalink / raw)
To: Gerd Hoffmann, qemu-devel; +Cc: Anthony Liguori
[-- Attachment #1: Type: text/plain, Size: 742 bytes --]
On 11/10/2014 04:23 AM, Gerd Hoffmann wrote:
> Add fast path to qemu_spice_display_switch in case old and new
> displaysurface have identical size (happens with display panning
> and page flipping). We just swap the backing store then and don't
> go through the whole process of deleting and creating the primary
> surface.
>
> To simplify the code a mit move mirror surface allocation to
s/mit/bit/ ?
> qemu_spice_display_switch().
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> ui/spice-display.c | 33 ++++++++++++++++++++++++++-------
> 1 file changed, 26 insertions(+), 7 deletions(-)
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] spice: rework mirror allocation, add no-resize fast path
2014-11-10 16:10 ` Eric Blake
@ 2014-11-11 7:33 ` Gerd Hoffmann
0 siblings, 0 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2014-11-11 7:33 UTC (permalink / raw)
To: Eric Blake; +Cc: qemu-devel, Anthony Liguori
> >
> > To simplify the code a mit move mirror surface allocation to
>
> s/mit/bit/ ?
Yes. Fixed.
thanks,
Gerd
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-11-11 7:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-10 11:23 [Qemu-devel] [PATCH] spice: rework mirror allocation, add no-resize fast path Gerd Hoffmann
2014-11-10 16:10 ` Eric Blake
2014-11-11 7:33 ` Gerd Hoffmann
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).