From patchwork Thu Feb 16 23:11:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 141710 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 D19DAB6FA9 for ; Fri, 17 Feb 2012 10:11:47 +1100 (EST) Received: from localhost ([::1]:45203 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RyAUK-0008Gi-Dc for incoming@patchwork.ozlabs.org; Thu, 16 Feb 2012 18:11:44 -0500 Received: from eggs.gnu.org ([140.186.70.92]:56578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RyAUE-0008Gc-Et for qemu-devel@nongnu.org; Thu, 16 Feb 2012 18:11:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RyAUD-0005sB-1C for qemu-devel@nongnu.org; Thu, 16 Feb 2012 18:11:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:27990) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RyAUC-0005s7-Qk for qemu-devel@nongnu.org; Thu, 16 Feb 2012 18:11:36 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1GNBa2I000726 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 16 Feb 2012 18:11:36 -0500 Received: from garlic.redhat.com (vpn-203-216.tlv.redhat.com [10.35.203.216]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q1GNBTAm011470; Thu, 16 Feb 2012 18:11:34 -0500 From: Alon Levy To: qemu-devel@nongnu.org Date: Fri, 17 Feb 2012 01:11:28 +0200 Message-Id: <1329433888-17678-2-git-send-email-alevy@redhat.com> In-Reply-To: <1329433888-17678-1-git-send-email-alevy@redhat.com> References: <1329433888-17678-1-git-send-email-alevy@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kraxel@redhat.com, elmarco@redhat.com Subject: [Qemu-devel] [PATCH 2/2] qxl: make qxl_render_update async 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 Removes the last user of QXL_SYNC when using update drivers that use the _ASYNC io ports. The last user is qxl_render_update, it is called both by qxl_hw_update which is the vga_hw_update_ptr passed to graphic_console_init, and by qxl_hw_screen_dump. Signed-off-by: Alon Levy --- hw/qxl-render.c | 44 +++++++++++++++++++++++++++++++++----------- hw/qxl.c | 19 ++++++++++++++++++- hw/qxl.h | 2 ++ ui/spice-display.h | 1 + 4 files changed, 54 insertions(+), 12 deletions(-) diff --git a/hw/qxl-render.c b/hw/qxl-render.c index b238b96..980f8e4 100644 --- a/hw/qxl-render.c +++ b/hw/qxl-render.c @@ -71,12 +71,20 @@ void qxl_render_resize(PCIQXLDevice *qxl) } } +typedef struct QXLRenderUpdateData { + int redraw; + QXLRect dirty[32]; + QXLRect area; +} QXLRenderUpdateData; + void qxl_render_update(PCIQXLDevice *qxl) { VGACommonState *vga = &qxl->vga; - QXLRect dirty[32], update; + QXLRect dirty[32]; void *ptr; - int i, redraw = 0; + int redraw = 0; + QXLCookie *cookie; + QXLRenderUpdateData *data; if (!is_buffer_shared(vga->ds->surface)) { dprint(qxl, 1, "%s: restoring shared displaysurface\n", __func__); @@ -126,20 +134,33 @@ void qxl_render_update(PCIQXLDevice *qxl) } qxl->guest_primary.commands = 0; - update.left = 0; - update.right = qxl->guest_primary.surface.width; - update.top = 0; - update.bottom = qxl->guest_primary.surface.height; + cookie = g_malloc0(sizeof(*cookie)); + cookie->type = QXL_COOKIE_TYPE_RENDER_UPDATE_AREA; + data = g_malloc0(sizeof(*data)); + cookie->data = (uint64_t)data; + data->redraw = redraw; + data->area.left = 0; + data->area.right = qxl->guest_primary.surface.width; + data->area.top = 0; + data->area.bottom = qxl->guest_primary.surface.height; + qxl_spice_update_area(qxl, 0, &data->area, + data->dirty, ARRAY_SIZE(dirty), 1, QXL_ASYNC, cookie); +} + +void qxl_render_update_area_done(PCIQXLDevice *qxl, QXLCookie *cookie) +{ + QXLRenderUpdateData *data = (QXLRenderUpdateData *)cookie->data; + QXLRect update = data->area; + QXLRect *dirty = data->dirty; + VGACommonState *vga = &qxl->vga; + int i; - memset(dirty, 0, sizeof(dirty)); - qxl_spice_update_area(qxl, 0, &update, - dirty, ARRAY_SIZE(dirty), 1, QXL_SYNC, NULL); - if (redraw) { + if (data->redraw) { memset(dirty, 0, sizeof(dirty)); dirty[0] = update; } - for (i = 0; i < ARRAY_SIZE(dirty); i++) { + for (i = 0; i < ARRAY_SIZE(data->dirty); i++) { if (qemu_spice_rect_is_empty(dirty+i)) { break; } @@ -151,6 +172,7 @@ void qxl_render_update(PCIQXLDevice *qxl) dirty[i].right - dirty[i].left, dirty[i].bottom - dirty[i].top); } + g_free(data); } static QEMUCursor *qxl_cursor(PCIQXLDevice *qxl, QXLCursor *cursor) diff --git a/hw/qxl.c b/hw/qxl.c index 59d2b13..4c28fea 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -145,6 +145,7 @@ void qxl_spice_update_area(PCIQXLDevice *qxl, uint32_t surface_id, uint32_t clear_dirty_region, qxl_async_io async, QXLCookie *cookie) { + struct QXLRect *area_copy; if (async == QXL_SYNC) { qxl->ssd.worker->update_area(qxl->ssd.worker, surface_id, area, dirty_rects, num_dirty_rects, clear_dirty_region); @@ -154,7 +155,10 @@ void qxl_spice_update_area(PCIQXLDevice *qxl, uint32_t surface_id, cookie = g_malloc0(sizeof(*cookie)); cookie->type = QXL_COOKIE_TYPE_IO; cookie->io = QXL_IO_UPDATE_AREA_ASYNC; - cookie->data = 0; + area_copy = g_malloc0(sizeof(*area_copy)); + memcpy(area_copy, area, sizeof(*area)); + cookie->data = (uint64_t)area_copy; + area = area_copy; } spice_qxl_update_area_async(&qxl->ssd.qxl, surface_id, area, clear_dirty_region, (uint64_t)cookie); @@ -769,6 +773,10 @@ static void interface_async_complete_io(PCIQXLDevice *qxl, QXLCookie *cookie) } switch (current_async) { + case QXL_IO_MEMSLOT_ADD_ASYNC: + case QXL_IO_DESTROY_PRIMARY_ASYNC: + case QXL_IO_FLUSH_SURFACES_ASYNC: + break; case QXL_IO_CREATE_PRIMARY_ASYNC: qxl_create_guest_primary_complete(qxl); break; @@ -778,6 +786,12 @@ static void interface_async_complete_io(PCIQXLDevice *qxl, QXLCookie *cookie) case QXL_IO_DESTROY_SURFACE_ASYNC: qxl_spice_destroy_surface_wait_complete(qxl, (uint32_t)cookie->data); break; + case QXL_IO_UPDATE_AREA_ASYNC: + g_free((void *)cookie->data); + break; + default: + fprintf(stderr, "qxl: %s: unexpected current_async %d\n", __func__, + current_async); } qxl_send_events(qxl, QXL_INTERRUPT_IO_CMD); } @@ -792,6 +806,9 @@ static void interface_async_complete(QXLInstance *sin, uint64_t cookie_token) case QXL_COOKIE_TYPE_IO: interface_async_complete_io(qxl, cookie); break; + case QXL_COOKIE_TYPE_RENDER_UPDATE_AREA: + qxl_render_update_area_done(qxl, cookie); + break; default: fprintf(stderr, "qxl: %s: unexpected cookie type %d\n", __func__, cookie->type); } diff --git a/hw/qxl.h b/hw/qxl.h index 666dd78..1977ff3 100644 --- a/hw/qxl.h +++ b/hw/qxl.h @@ -140,3 +140,5 @@ void qxl_spice_update_area_async(PCIQXLDevice *qxl, uint32_t surface_id, uint32_t clear_dirty_region, int is_vga); #endif + +void qxl_render_update_area_done(PCIQXLDevice *qxl, QXLCookie *cookie); diff --git a/ui/spice-display.h b/ui/spice-display.h index 63cb009..263c3e4 100644 --- a/ui/spice-display.h +++ b/ui/spice-display.h @@ -50,6 +50,7 @@ typedef enum qxl_async_io { enum { QXL_COOKIE_TYPE_IO, + QXL_COOKIE_TYPE_RENDER_UPDATE_AREA, }; typedef struct QXLCookie {