From patchwork Thu Sep 6 05:39:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 182014 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7B11E2C007E for ; Thu, 6 Sep 2012 15:39:56 +1000 (EST) Received: from localhost ([::1]:46527 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9Uok-000212-IL for incoming@patchwork.ozlabs.org; Thu, 06 Sep 2012 01:39:54 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56159) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9UoS-0001tT-KX for qemu-devel@nongnu.org; Thu, 06 Sep 2012 01:39:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T9UoP-00057L-O8 for qemu-devel@nongnu.org; Thu, 06 Sep 2012 01:39:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34221) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9UoP-00056j-FO for qemu-devel@nongnu.org; Thu, 06 Sep 2012 01:39:33 -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 q865dW0u002411 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 6 Sep 2012 01:39:32 -0400 Received: from rincewind.home.kraxel.org (ovpn-116-25.ams2.redhat.com [10.36.116.25]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q865dVfD020851; Thu, 6 Sep 2012 01:39:31 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id B674F41833; Thu, 6 Sep 2012 07:39:29 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 6 Sep 2012 07:39:25 +0200 Message-Id: <1346909967-10929-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1346909967-10929-1-git-send-email-kraxel@redhat.com> References: <1346909967-10929-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 v2 2/4] spice: split qemu_spice_create_update 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 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 --- 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