From patchwork Wed Jul 6 12:19:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 103466 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 D0F24B6F83 for ; Wed, 6 Jul 2011 22:45:50 +1000 (EST) Received: from localhost ([::1]:49856 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QeRUA-0007hk-2c for incoming@patchwork.ozlabs.org; Wed, 06 Jul 2011 08:45:46 -0400 Received: from eggs.gnu.org ([140.186.70.92]:34007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QeR51-0001eR-E3 for qemu-devel@nongnu.org; Wed, 06 Jul 2011 08:19:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QeR4y-0005Cv-PK for qemu-devel@nongnu.org; Wed, 06 Jul 2011 08:19:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51519) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QeR4x-0005Cb-R7 for qemu-devel@nongnu.org; Wed, 06 Jul 2011 08:19:44 -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 p66CJgdo022785 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 6 Jul 2011 08:19:43 -0400 Received: from bow.redhat.com (vpn-10-220.rdu.redhat.com [10.11.10.220]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p66CJR0o022836; Wed, 6 Jul 2011 08:19:41 -0400 From: Alon Levy To: qemu-devel@nongnu.org Date: Wed, 6 Jul 2011 14:19:17 +0200 Message-Id: <1309954766-9728-9-git-send-email-alevy@redhat.com> In-Reply-To: <1309954766-9728-1-git-send-email-alevy@redhat.com> References: <1309954766-9728-1-git-send-email-alevy@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: yhalperi@redhat.com, kraxel@redhat.com Subject: [Qemu-devel] [PATCH] spice/qxl: move worker wrappers 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 From: Gerd Hoffmann Move the wrapper functions which are used by qxl only to qxl.c. Rename them from qemu_spice_* to qxl_spice_*. Also pass in a qxl state pointer instead of a SimpleSpiceDisplay pointer. Signed-off-by: Gerd Hoffmann --- hw/qxl-render.c | 4 +- hw/qxl.c | 82 +++++++++++++++++++++++++++++++++++++++++++++------ hw/qxl.h | 12 +++++++ ui/spice-display.c | 60 -------------------------------------- ui/spice-display.h | 11 ------- 5 files changed, 86 insertions(+), 83 deletions(-) diff --git a/hw/qxl-render.c b/hw/qxl-render.c index bef5f14..60b822d 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)); - qemu_spice_update_area(&qxl->ssd, 0, &update, - dirty, ARRAY_SIZE(dirty), 1); + qxl_spice_update_area(qxl, 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 018ed54..830ddae 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -139,6 +139,68 @@ static void qxl_reset_memslots(PCIQXLDevice *d); static void qxl_reset_surfaces(PCIQXLDevice *d); static void qxl_ring_set_dirty(PCIQXLDevice *qxl); + +void qxl_spice_update_area(PCIQXLDevice *qxl, uint32_t surface_id, + struct QXLRect *area, struct QXLRect *dirty_rects, + uint32_t num_dirty_rects, uint32_t clear_dirty_region) +{ + qemu_mutex_lock(&qxl->ssd.wlock); + qxl->ssd.worker->update_area(qxl->ssd.worker, surface_id, area, dirty_rects, + num_dirty_rects, clear_dirty_region); + qemu_mutex_unlock(&qxl->ssd.wlock); +} + +void qxl_spice_destroy_surface_wait(PCIQXLDevice *qxl, uint32_t id) +{ + qemu_mutex_lock(&qxl->ssd.wlock); + qxl->ssd.worker->destroy_surface_wait(qxl->ssd.worker, id); + qemu_mutex_unlock(&qxl->ssd.wlock); +} + +void qxl_spice_loadvm_commands(PCIQXLDevice *qxl, struct QXLCommandExt *ext, + uint32_t count) +{ + qemu_mutex_lock(&qxl->ssd.wlock); + qxl->ssd.worker->loadvm_commands(qxl->ssd.worker, ext, count); + qemu_mutex_unlock(&qxl->ssd.wlock); +} + +void qxl_spice_oom(PCIQXLDevice *qxl) +{ + qemu_mutex_lock(&qxl->ssd.wlock); + qxl->ssd.worker->oom(qxl->ssd.worker); + qemu_mutex_unlock(&qxl->ssd.wlock); +} + +void qxl_spice_reset_memslots(PCIQXLDevice *qxl) +{ + qemu_mutex_lock(&qxl->ssd.wlock); + qxl->ssd.worker->reset_memslots(qxl->ssd.worker); + qemu_mutex_unlock(&qxl->ssd.wlock); +} + +void qxl_spice_destroy_surfaces(PCIQXLDevice *qxl) +{ + qemu_mutex_lock(&qxl->ssd.wlock); + qxl->ssd.worker->destroy_surfaces(qxl->ssd.worker); + qemu_mutex_unlock(&qxl->ssd.wlock); +} + +void qxl_spice_reset_image_cache(PCIQXLDevice *qxl) +{ + qemu_mutex_lock(&qxl->ssd.wlock); + qxl->ssd.worker->reset_image_cache(qxl->ssd.worker); + qemu_mutex_unlock(&qxl->ssd.wlock); +} + +void qxl_spice_reset_cursor(PCIQXLDevice *qxl) +{ + qemu_mutex_lock(&qxl->ssd.wlock); + qxl->ssd.worker->reset_cursor(qxl->ssd.worker); + qemu_mutex_unlock(&qxl->ssd.wlock); +} + + static inline uint32_t msb_mask(uint32_t val) { uint32_t mask; @@ -701,8 +763,8 @@ static void qxl_hard_reset(PCIQXLDevice *d, int loadvm) dprint(d, 1, "%s: start%s\n", __FUNCTION__, loadvm ? " (loadvm)" : ""); - qemu_spice_reset_cursor(&d->ssd); - qemu_spice_reset_image_cache(&d->ssd); + qxl_spice_reset_cursor(d); + qxl_spice_reset_image_cache(d); qxl_reset_surfaces(d); qxl_reset_memslots(d); @@ -826,7 +888,7 @@ static void qxl_del_memslot(PCIQXLDevice *d, uint32_t slot_id) static void qxl_reset_memslots(PCIQXLDevice *d) { dprint(d, 1, "%s:\n", __FUNCTION__); - qemu_spice_reset_memslots(&d->ssd); + qxl_spice_reset_memslots(d); memset(&d->guest_slots, 0, sizeof(d->guest_slots)); } @@ -834,7 +896,7 @@ static void qxl_reset_surfaces(PCIQXLDevice *d) { dprint(d, 1, "%s:\n", __FUNCTION__); d->mode = QXL_MODE_UNDEFINED; - qemu_spice_destroy_surfaces(&d->ssd); + qxl_spice_destroy_surfaces(d); memset(&d->guest_surfaces.cmds, 0, sizeof(d->guest_surfaces.cmds)); } @@ -966,8 +1028,8 @@ static void ioport_write(void *opaque, uint32_t addr, uint32_t val) case QXL_IO_UPDATE_AREA: { QXLRect update = d->ram->update_area; - qemu_spice_update_area(&d->ssd, d->ram->update_surface, - &update, NULL, 0, 0); + qxl_spice_update_area(d, d->ram->update_surface, + &update, NULL, 0, 0); break; } case QXL_IO_NOTIFY_CMD: @@ -988,7 +1050,7 @@ static void ioport_write(void *opaque, uint32_t addr, uint32_t val) break; } d->oom_running = 1; - qemu_spice_oom(&d->ssd); + qxl_spice_oom(d); d->oom_running = 0; break; case QXL_IO_SET_MODE: @@ -1039,10 +1101,10 @@ static void ioport_write(void *opaque, uint32_t addr, uint32_t val) } break; case QXL_IO_DESTROY_SURFACE_WAIT: - qemu_spice_destroy_surface_wait(&d->ssd, val); + qxl_spice_destroy_surface_wait(d, val); break; case QXL_IO_DESTROY_ALL_SURFACES: - qemu_spice_destroy_surfaces(&d->ssd); + qxl_spice_destroy_surfaces(d); break; default: fprintf(stderr, "%s: ioport=0x%x, abort()\n", __FUNCTION__, io_port); @@ -1446,7 +1508,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++; - qemu_spice_loadvm_commands(&d->ssd, cmds, out); + qxl_spice_loadvm_commands(d, cmds, out); qemu_free(cmds); break; diff --git a/hw/qxl.h b/hw/qxl.h index f6c450d..489d518 100644 --- a/hw/qxl.h +++ b/hw/qxl.h @@ -98,6 +98,18 @@ typedef struct PCIQXLDevice { /* qxl.c */ void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL phys, int group_id); +void qxl_spice_update_area(PCIQXLDevice *qxl, uint32_t surface_id, + struct QXLRect *area, struct QXLRect *dirty_rects, + uint32_t num_dirty_rects, uint32_t clear_dirty_region); +void qxl_spice_destroy_surface_wait(PCIQXLDevice *qxl, uint32_t id); +void qxl_spice_loadvm_commands(PCIQXLDevice *qxl, struct QXLCommandExt *ext, + uint32_t count); +void qxl_spice_oom(PCIQXLDevice *qxl); +void qxl_spice_reset_memslots(PCIQXLDevice *qxl); +void qxl_spice_destroy_surfaces(PCIQXLDevice *qxl); +void qxl_spice_reset_image_cache(PCIQXLDevice *qxl); +void qxl_spice_reset_cursor(PCIQXLDevice *qxl); + /* qxl-logger.c */ void qxl_log_cmd_cursor(PCIQXLDevice *qxl, QXLCursorCmd *cmd, int group_id); void qxl_log_command(PCIQXLDevice *qxl, const char *ring, QXLCommandExt *ext); diff --git a/ui/spice-display.c b/ui/spice-display.c index 93ebc19..5bd7460 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -63,16 +63,6 @@ void qemu_spice_rect_union(QXLRect *dest, const QXLRect *r) } -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) -{ - qemu_mutex_lock(&ssd->wlock); - ssd->worker->update_area(ssd->worker, surface_id, area, dirty_rects, - num_dirty_rects, clear_dirty_region); - qemu_mutex_unlock(&ssd->wlock); -} - void qemu_spice_add_memslot(SimpleSpiceDisplay *ssd, QXLDevMemSlot *memslot) { qemu_mutex_lock(&ssd->wlock); @@ -102,21 +92,6 @@ void qemu_spice_destroy_primary_surface(SimpleSpiceDisplay *ssd, uint32_t id) qemu_mutex_unlock(&ssd->wlock); } -void qemu_spice_destroy_surface_wait(SimpleSpiceDisplay *ssd, uint32_t id) -{ - qemu_mutex_lock(&ssd->wlock); - ssd->worker->destroy_surface_wait(ssd->worker, id); - qemu_mutex_unlock(&ssd->wlock); -} - -void qemu_spice_loadvm_commands(SimpleSpiceDisplay *ssd, struct QXLCommandExt *ext, - uint32_t count) -{ - qemu_mutex_lock(&ssd->wlock); - ssd->worker->loadvm_commands(ssd->worker, ext, count); - qemu_mutex_unlock(&ssd->wlock); -} - void qemu_spice_wakeup(SimpleSpiceDisplay *ssd) { qemu_mutex_lock(&ssd->wlock); @@ -124,13 +99,6 @@ void qemu_spice_wakeup(SimpleSpiceDisplay *ssd) qemu_mutex_unlock(&ssd->wlock); } -void qemu_spice_oom(SimpleSpiceDisplay *ssd) -{ - qemu_mutex_lock(&ssd->wlock); - ssd->worker->oom(ssd->worker); - qemu_mutex_unlock(&ssd->wlock); -} - void qemu_spice_start(SimpleSpiceDisplay *ssd) { qemu_mutex_lock(&ssd->wlock); @@ -145,34 +113,6 @@ void qemu_spice_stop(SimpleSpiceDisplay *ssd) qemu_mutex_unlock(&ssd->wlock); } -void qemu_spice_reset_memslots(SimpleSpiceDisplay *ssd) -{ - qemu_mutex_lock(&ssd->wlock); - ssd->worker->reset_memslots(ssd->worker); - qemu_mutex_unlock(&ssd->wlock); -} - -void qemu_spice_destroy_surfaces(SimpleSpiceDisplay *ssd) -{ - qemu_mutex_lock(&ssd->wlock); - ssd->worker->destroy_surfaces(ssd->worker); - qemu_mutex_unlock(&ssd->wlock); -} - -void qemu_spice_reset_image_cache(SimpleSpiceDisplay *ssd) -{ - qemu_mutex_lock(&ssd->wlock); - ssd->worker->reset_image_cache(ssd->worker); - qemu_mutex_unlock(&ssd->wlock); -} - -void qemu_spice_reset_cursor(SimpleSpiceDisplay *ssd) -{ - qemu_mutex_lock(&ssd->wlock); - ssd->worker->reset_cursor(ssd->worker); - qemu_mutex_unlock(&ssd->wlock); -} - static SimpleSpiceUpdate *qemu_spice_create_update(SimpleSpiceDisplay *ssd) { diff --git a/ui/spice-display.h b/ui/spice-display.h index 3968d75..e84847f 100644 --- a/ui/spice-display.h +++ b/ui/spice-display.h @@ -83,22 +83,11 @@ void qemu_spice_display_update(SimpleSpiceDisplay *ssd, 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);