From patchwork Wed Aug 3 10:37:36 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 108126 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AED5AB7199 for ; Wed, 3 Aug 2011 21:28:26 +1000 (EST) Received: from localhost ([::1]:39150 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoYqg-0002nY-DG for incoming@patchwork.ozlabs.org; Wed, 03 Aug 2011 06:38:50 -0400 Received: from eggs.gnu.org ([140.186.70.92]:48557) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoYpn-0008Ih-Uk for qemu-devel@nongnu.org; Wed, 03 Aug 2011 06:37:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QoYpm-0004dU-Cl for qemu-devel@nongnu.org; Wed, 03 Aug 2011 06:37:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47509) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoYpl-0004dA-W5 for qemu-devel@nongnu.org; Wed, 03 Aug 2011 06:37:54 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p73AbrNN004480 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 3 Aug 2011 06:37:53 -0400 Received: from rincewind.home.kraxel.org (ovpn-116-20.ams2.redhat.com [10.36.116.20]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p73Abmsa030833; Wed, 3 Aug 2011 06:37:49 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 789AD40F6C; Wed, 3 Aug 2011 12:37:47 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 3 Aug 2011 12:37:36 +0200 Message-Id: <1312367866-27508-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1312367866-27508-1-git-send-email-kraxel@redhat.com> References: <1312367866-27508-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 01/11] spice: add worker wrapper functions. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add wrapper functions for all spice worker calls. Signed-off-by: Gerd Hoffmann --- hw/qxl-render.c | 4 +- hw/qxl.c | 32 +++++++++--------- ui/spice-display.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++++--- ui/spice-display.h | 22 ++++++++++++ 4 files changed, 129 insertions(+), 24 deletions(-) diff --git a/hw/qxl-render.c b/hw/qxl-render.c index 1316066..bef5f14 100644 --- a/hw/qxl-render.c +++ b/hw/qxl-render.c @@ -124,8 +124,8 @@ void qxl_render_update(PCIQXLDevice *qxl) update.bottom = qxl->guest_primary.surface.height; memset(dirty, 0, sizeof(dirty)); - qxl->ssd.worker->update_area(qxl->ssd.worker, 0, &update, - dirty, ARRAY_SIZE(dirty), 1); + qemu_spice_update_area(&qxl->ssd, 0, &update, + dirty, ARRAY_SIZE(dirty), 1); for (i = 0; i < ARRAY_SIZE(dirty); i++) { if (qemu_spice_rect_is_empty(dirty+i)) { diff --git a/hw/qxl.c b/hw/qxl.c index a6fb7f0..5deb776 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -684,8 +684,8 @@ static void qxl_hard_reset(PCIQXLDevice *d, int loadvm) dprint(d, 1, "%s: start%s\n", __FUNCTION__, loadvm ? " (loadvm)" : ""); - d->ssd.worker->reset_cursor(d->ssd.worker); - d->ssd.worker->reset_image_cache(d->ssd.worker); + qemu_spice_reset_cursor(&d->ssd); + qemu_spice_reset_image_cache(&d->ssd); qxl_reset_surfaces(d); qxl_reset_memslots(d); @@ -790,7 +790,7 @@ static void qxl_add_memslot(PCIQXLDevice *d, uint32_t slot_id, uint64_t delta) __FUNCTION__, memslot.slot_id, memslot.virt_start, memslot.virt_end); - d->ssd.worker->add_memslot(d->ssd.worker, &memslot); + qemu_spice_add_memslot(&d->ssd, &memslot); d->guest_slots[slot_id].ptr = (void*)memslot.virt_start; d->guest_slots[slot_id].size = memslot.virt_end - memslot.virt_start; d->guest_slots[slot_id].delta = delta; @@ -800,14 +800,14 @@ static void qxl_add_memslot(PCIQXLDevice *d, uint32_t slot_id, uint64_t delta) static void qxl_del_memslot(PCIQXLDevice *d, uint32_t slot_id) { dprint(d, 1, "%s: slot %d\n", __FUNCTION__, slot_id); - d->ssd.worker->del_memslot(d->ssd.worker, MEMSLOT_GROUP_HOST, slot_id); + qemu_spice_del_memslot(&d->ssd, MEMSLOT_GROUP_HOST, slot_id); d->guest_slots[slot_id].active = 0; } static void qxl_reset_memslots(PCIQXLDevice *d) { dprint(d, 1, "%s:\n", __FUNCTION__); - d->ssd.worker->reset_memslots(d->ssd.worker); + qemu_spice_reset_memslots(&d->ssd); memset(&d->guest_slots, 0, sizeof(d->guest_slots)); } @@ -815,7 +815,7 @@ static void qxl_reset_surfaces(PCIQXLDevice *d) { dprint(d, 1, "%s:\n", __FUNCTION__); d->mode = QXL_MODE_UNDEFINED; - d->ssd.worker->destroy_surfaces(d->ssd.worker); + qemu_spice_destroy_surfaces(&d->ssd); memset(&d->guest_surfaces.cmds, 0, sizeof(d->guest_surfaces.cmds)); } @@ -869,7 +869,7 @@ static void qxl_create_guest_primary(PCIQXLDevice *qxl, int loadvm) qxl->mode = QXL_MODE_NATIVE; qxl->cmdflags = 0; - qxl->ssd.worker->create_primary_surface(qxl->ssd.worker, 0, &surface); + qemu_spice_create_primary_surface(&qxl->ssd, 0, &surface); /* for local rendering */ qxl_render_resize(qxl); @@ -884,7 +884,7 @@ static void qxl_destroy_primary(PCIQXLDevice *d) dprint(d, 1, "%s\n", __FUNCTION__); d->mode = QXL_MODE_UNDEFINED; - d->ssd.worker->destroy_primary_surface(d->ssd.worker, 0); + qemu_spice_destroy_primary_surface(&d->ssd, 0); } static void qxl_set_mode(PCIQXLDevice *d, int modenr, int loadvm) @@ -956,15 +956,15 @@ static void ioport_write(void *opaque, uint32_t addr, uint32_t val) case QXL_IO_UPDATE_AREA: { QXLRect update = d->ram->update_area; - d->ssd.worker->update_area(d->ssd.worker, d->ram->update_surface, - &update, NULL, 0, 0); + qemu_spice_update_area(&d->ssd, d->ram->update_surface, + &update, NULL, 0, 0); break; } case QXL_IO_NOTIFY_CMD: - d->ssd.worker->wakeup(d->ssd.worker); + qemu_spice_wakeup(&d->ssd); break; case QXL_IO_NOTIFY_CURSOR: - d->ssd.worker->wakeup(d->ssd.worker); + qemu_spice_wakeup(&d->ssd); break; case QXL_IO_UPDATE_IRQ: qxl_set_irq(d); @@ -978,7 +978,7 @@ static void ioport_write(void *opaque, uint32_t addr, uint32_t val) break; } d->oom_running = 1; - d->ssd.worker->oom(d->ssd.worker); + qemu_spice_oom(&d->ssd); d->oom_running = 0; break; case QXL_IO_SET_MODE: @@ -1016,10 +1016,10 @@ static void ioport_write(void *opaque, uint32_t addr, uint32_t val) qxl_destroy_primary(d); break; case QXL_IO_DESTROY_SURFACE_WAIT: - d->ssd.worker->destroy_surface_wait(d->ssd.worker, val); + qemu_spice_destroy_surface_wait(&d->ssd, val); break; case QXL_IO_DESTROY_ALL_SURFACES: - d->ssd.worker->destroy_surfaces(d->ssd.worker); + qemu_spice_destroy_surfaces(&d->ssd); break; default: fprintf(stderr, "%s: ioport=0x%x, abort()\n", __FUNCTION__, io_port); @@ -1424,7 +1424,7 @@ static int qxl_post_load(void *opaque, int version) cmds[out].cmd.type = QXL_CMD_CURSOR; cmds[out].group_id = MEMSLOT_GROUP_GUEST; out++; - d->ssd.worker->loadvm_commands(d->ssd.worker, cmds, out); + qemu_spice_loadvm_commands(&d->ssd, cmds, out); qemu_free(cmds); break; diff --git a/ui/spice-display.c b/ui/spice-display.c index feeee73..1e6a38f 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -62,6 +62,89 @@ void qemu_spice_rect_union(QXLRect *dest, const QXLRect *r) dest->right = MAX(dest->right, r->right); } + +void qemu_spice_update_area(SimpleSpiceDisplay *ssd, uint32_t surface_id, + struct QXLRect *area, struct QXLRect *dirty_rects, + uint32_t num_dirty_rects, + uint32_t clear_dirty_region) +{ + ssd->worker->update_area(ssd->worker, surface_id, area, dirty_rects, + num_dirty_rects, clear_dirty_region); +} + +void qemu_spice_add_memslot(SimpleSpiceDisplay *ssd, QXLDevMemSlot *memslot) +{ + ssd->worker->add_memslot(ssd->worker, memslot); +} + +void qemu_spice_del_memslot(SimpleSpiceDisplay *ssd, uint32_t gid, uint32_t sid) +{ + ssd->worker->del_memslot(ssd->worker, gid, sid); +} + +void qemu_spice_create_primary_surface(SimpleSpiceDisplay *ssd, uint32_t id, + QXLDevSurfaceCreate *surface) +{ + ssd->worker->create_primary_surface(ssd->worker, id, surface); +} + +void qemu_spice_destroy_primary_surface(SimpleSpiceDisplay *ssd, uint32_t id) +{ + ssd->worker->destroy_primary_surface(ssd->worker, id); +} + +void qemu_spice_destroy_surface_wait(SimpleSpiceDisplay *ssd, uint32_t id) +{ + ssd->worker->destroy_surface_wait(ssd->worker, id); +} + +void qemu_spice_loadvm_commands(SimpleSpiceDisplay *ssd, + struct QXLCommandExt *ext, uint32_t count) +{ + ssd->worker->loadvm_commands(ssd->worker, ext, count); +} + +void qemu_spice_wakeup(SimpleSpiceDisplay *ssd) +{ + ssd->worker->wakeup(ssd->worker); +} + +void qemu_spice_oom(SimpleSpiceDisplay *ssd) +{ + ssd->worker->oom(ssd->worker); +} + +void qemu_spice_start(SimpleSpiceDisplay *ssd) +{ + ssd->worker->start(ssd->worker); +} + +void qemu_spice_stop(SimpleSpiceDisplay *ssd) +{ + ssd->worker->stop(ssd->worker); +} + +void qemu_spice_reset_memslots(SimpleSpiceDisplay *ssd) +{ + ssd->worker->reset_memslots(ssd->worker); +} + +void qemu_spice_destroy_surfaces(SimpleSpiceDisplay *ssd) +{ + ssd->worker->destroy_surfaces(ssd->worker); +} + +void qemu_spice_reset_image_cache(SimpleSpiceDisplay *ssd) +{ + ssd->worker->reset_image_cache(ssd->worker); +} + +void qemu_spice_reset_cursor(SimpleSpiceDisplay *ssd) +{ + ssd->worker->reset_cursor(ssd->worker); +} + + static SimpleSpiceUpdate *qemu_spice_create_update(SimpleSpiceDisplay *ssd) { SimpleSpiceUpdate *update; @@ -161,7 +244,7 @@ void qemu_spice_create_host_memslot(SimpleSpiceDisplay *ssd) memset(&memslot, 0, sizeof(memslot)); memslot.slot_group_id = MEMSLOT_GROUP_HOST; memslot.virt_end = ~0; - ssd->worker->add_memslot(ssd->worker, &memslot); + qemu_spice_add_memslot(ssd, &memslot); } void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd) @@ -181,14 +264,14 @@ void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd) surface.mem = (intptr_t)ssd->buf; surface.group_id = MEMSLOT_GROUP_HOST; - ssd->worker->create_primary_surface(ssd->worker, 0, &surface); + qemu_spice_create_primary_surface(ssd, 0, &surface); } void qemu_spice_destroy_host_primary(SimpleSpiceDisplay *ssd) { dprint(1, "%s:\n", __FUNCTION__); - ssd->worker->destroy_primary_surface(ssd->worker, 0); + qemu_spice_destroy_primary_surface(ssd, 0); } void qemu_spice_vm_change_state_handler(void *opaque, int running, int reason) @@ -196,9 +279,9 @@ void qemu_spice_vm_change_state_handler(void *opaque, int running, int reason) SimpleSpiceDisplay *ssd = opaque; if (running) { - ssd->worker->start(ssd->worker); + qemu_spice_start(ssd); } else { - ssd->worker->stop(ssd->worker); + qemu_spice_stop(ssd); } ssd->running = running; } @@ -267,7 +350,7 @@ void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd) if (ssd->notify) { ssd->notify = 0; - ssd->worker->wakeup(ssd->worker); + qemu_spice_wakeup(ssd); dprint(2, "%s: notify\n", __FUNCTION__); } } diff --git a/ui/spice-display.h b/ui/spice-display.h index 2f95f68..5b06b11 100644 --- a/ui/spice-display.h +++ b/ui/spice-display.h @@ -80,3 +80,25 @@ void qemu_spice_display_update(SimpleSpiceDisplay *ssd, int x, int y, int w, int h); void qemu_spice_display_resize(SimpleSpiceDisplay *ssd); void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd); + +void qemu_spice_update_area(SimpleSpiceDisplay *ssd, uint32_t surface_id, + struct QXLRect *area, struct QXLRect *dirty_rects, + uint32_t num_dirty_rects, + uint32_t clear_dirty_region); +void qemu_spice_add_memslot(SimpleSpiceDisplay *ssd, QXLDevMemSlot *memslot); +void qemu_spice_del_memslot(SimpleSpiceDisplay *ssd, uint32_t gid, + uint32_t sid); +void qemu_spice_create_primary_surface(SimpleSpiceDisplay *ssd, uint32_t id, + QXLDevSurfaceCreate *surface); +void qemu_spice_destroy_primary_surface(SimpleSpiceDisplay *ssd, uint32_t id); +void qemu_spice_destroy_surface_wait(SimpleSpiceDisplay *ssd, uint32_t id); +void qemu_spice_loadvm_commands(SimpleSpiceDisplay *ssd, + struct QXLCommandExt *ext, uint32_t count); +void qemu_spice_wakeup(SimpleSpiceDisplay *ssd); +void qemu_spice_oom(SimpleSpiceDisplay *ssd); +void qemu_spice_start(SimpleSpiceDisplay *ssd); +void qemu_spice_stop(SimpleSpiceDisplay *ssd); +void qemu_spice_reset_memslots(SimpleSpiceDisplay *ssd); +void qemu_spice_destroy_surfaces(SimpleSpiceDisplay *ssd); +void qemu_spice_reset_image_cache(SimpleSpiceDisplay *ssd); +void qemu_spice_reset_cursor(SimpleSpiceDisplay *ssd);