From patchwork Tue Jul 12 13:55:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 104398 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 07A48B6F62 for ; Wed, 13 Jul 2011 01:12:12 +1000 (EST) Received: from localhost ([::1]:35701 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qged4-0005rs-Hz for incoming@patchwork.ozlabs.org; Tue, 12 Jul 2011 11:12:06 -0400 Received: from eggs.gnu.org ([140.186.70.92]:33477) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QgdRg-0004tp-CH for qemu-devel@nongnu.org; Tue, 12 Jul 2011 09:56:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QgdRe-0008MH-OP for qemu-devel@nongnu.org; Tue, 12 Jul 2011 09:56:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35960) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QgdRe-0008Lq-6g for qemu-devel@nongnu.org; Tue, 12 Jul 2011 09:56:14 -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 p6CDuD1Q009166 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 12 Jul 2011 09:56:13 -0400 Received: from bow.tlv.redhat.com (dhcp-3-110.tlv.redhat.com [10.35.3.110]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p6CDtpFK017856; Tue, 12 Jul 2011 09:56:12 -0400 From: Alon Levy To: qemu-devel@nongnu.org Date: Tue, 12 Jul 2011 16:55:27 +0300 Message-Id: <1310478932-25370-15-git-send-email-alevy@redhat.com> In-Reply-To: <1310478932-25370-1-git-send-email-alevy@redhat.com> References: <1310478932-25370-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: kraxel@redhat.com Subject: [Qemu-devel] [PATCHv3] qxl-render: split out qxl_render_update_dirty_rectangles 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 will later be reused from surface_updated callback when compiling against a newer spice-server. --- hw/qxl-render.c | 37 ++++++++++++++++++++++--------------- 1 files changed, 22 insertions(+), 15 deletions(-) diff --git a/hw/qxl-render.c b/hw/qxl-render.c index e64b646..d70373d 100644 --- a/hw/qxl-render.c +++ b/hw/qxl-render.c @@ -79,12 +79,32 @@ static void qxl_save_ppm(PCIQXLDevice *qxl) } } +static void qxl_render_update_dirty_rectangles(PCIQXLDevice *qxl, QXLRect *dirty, uint32_t num_dirty) +{ + VGACommonState *vga = &qxl->vga; + int i; + + dprint(qxl, 3, "%s: %d\n", __FUNCTION__, num_dirty); + for (i = 0; i < num_dirty; i++) { + if (qemu_spice_rect_is_empty(dirty + i)) { + break; + } + if (qxl->guest_primary.flipped) { + qxl_flip(qxl, dirty + i); + } + dpy_update(vga->ds, + dirty[i].left, dirty[i].top, + dirty[i].right - dirty[i].left, + dirty[i].bottom - dirty[i].top); + } + qxl_save_ppm(qxl); +} + void qxl_render_update(PCIQXLDevice *qxl) { VGACommonState *vga = &qxl->vga; QXLRect dirty[32], update; void *ptr; - int i; if (qxl->guest_primary.resized) { qxl->guest_primary.resized = 0; @@ -135,20 +155,7 @@ void qxl_render_update(PCIQXLDevice *qxl) memset(dirty, 0, sizeof(dirty)); 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)) { - break; - } - if (qxl->guest_primary.flipped) { - qxl_flip(qxl, dirty+i); - } - dpy_update(vga->ds, - dirty[i].left, dirty[i].top, - dirty[i].right - dirty[i].left, - dirty[i].bottom - dirty[i].top); - } - qxl_save_ppm(qxl); + qxl_render_update_dirty_rectangles(qxl, dirty, ARRAY_SIZE(dirty)); } static QEMUCursor *qxl_cursor(PCIQXLDevice *qxl, QXLCursor *cursor)