From patchwork Mon Oct 24 12:02:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 121335 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 860F61007D1 for ; Mon, 24 Oct 2011 23:20:58 +1100 (EST) Received: from localhost ([::1]:57330 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RIJHe-0000f6-Cw for incoming@patchwork.ozlabs.org; Mon, 24 Oct 2011 08:05:38 -0400 Received: from eggs.gnu.org ([140.186.70.92]:53794) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RIJHL-0000Wo-Vr for qemu-devel@nongnu.org; Mon, 24 Oct 2011 08:05:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RIJHH-00029K-2q for qemu-devel@nongnu.org; Mon, 24 Oct 2011 08:05:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:28508) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RIJHG-00029B-Ok for qemu-devel@nongnu.org; Mon, 24 Oct 2011 08:05:15 -0400 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 p9OC5EvC018038 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 24 Oct 2011 08:05:14 -0400 Received: from bow.tlv.redhat.com (dhcp-3-73.tlv.redhat.com [10.35.3.73]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p9OC52vh027291; Mon, 24 Oct 2011 08:05:12 -0400 From: Alon Levy To: lcapitulino@redhat.com, armbru@redhat.com, kraxel@redhat.com Date: Mon, 24 Oct 2011 14:02:18 +0200 Message-Id: <1319457739-14562-5-git-send-email-alevy@redhat.com> In-Reply-To: <1319457739-14562-1-git-send-email-alevy@redhat.com> References: <1319457739-14562-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: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Cc: mlureau@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 4/5] qxl: split qxl_render_display_resized 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 Signed-off-by: Alon Levy --- hw/qxl-render.c | 75 ++++++++++++++++++++++++++++++------------------------- 1 files changed, 41 insertions(+), 34 deletions(-) diff --git a/hw/qxl-render.c b/hw/qxl-render.c index 23a4289..fd3c016 100644 --- a/hw/qxl-render.c +++ b/hw/qxl-render.c @@ -70,47 +70,54 @@ void qxl_render_resize(PCIQXLDevice *qxl) } } +static void qxl_render_display_resized(PCIQXLDevice *qxl) +{ + VGACommonState *vga = &qxl->vga; + void *ptr; + + qxl->guest_primary.resized = 0; + + if (qxl->guest_primary.flipped) { + g_free(qxl->guest_primary.flipped); + qxl->guest_primary.flipped = NULL; + } + qemu_free_displaysurface(vga->ds); + + qxl->guest_primary.data = memory_region_get_ram_ptr(&qxl->vga.vram); + if (qxl->guest_primary.stride < 0) { + /* spice surface is upside down -> need extra buffer to flip */ + qxl->guest_primary.stride = -qxl->guest_primary.stride; + qxl->guest_primary.flipped = g_malloc(qxl->guest_primary.surface.width * + qxl->guest_primary.stride); + ptr = qxl->guest_primary.flipped; + } else { + ptr = qxl->guest_primary.data; + } + dprint(qxl, 1, "%s: %dx%d, stride %d, bpp %d, depth %d, flip %s\n", + __func__, + qxl->guest_primary.surface.width, + qxl->guest_primary.surface.height, + qxl->guest_primary.stride, + qxl->guest_primary.bytes_pp, + qxl->guest_primary.bits_pp, + qxl->guest_primary.flipped ? "yes" : "no"); + vga->ds->surface = + qemu_create_displaysurface_from(qxl->guest_primary.surface.width, + qxl->guest_primary.surface.height, + qxl->guest_primary.bits_pp, + qxl->guest_primary.stride, + ptr); + dpy_resize(vga->ds); +} + 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; - - if (qxl->guest_primary.flipped) { - g_free(qxl->guest_primary.flipped); - qxl->guest_primary.flipped = NULL; - } - qemu_free_displaysurface(vga->ds); - - qxl->guest_primary.data = memory_region_get_ram_ptr(&qxl->vga.vram); - if (qxl->guest_primary.stride < 0) { - /* spice surface is upside down -> need extra buffer to flip */ - qxl->guest_primary.stride = -qxl->guest_primary.stride; - qxl->guest_primary.flipped = g_malloc(qxl->guest_primary.surface.width * - qxl->guest_primary.stride); - ptr = qxl->guest_primary.flipped; - } else { - ptr = qxl->guest_primary.data; - } - dprint(qxl, 1, "%s: %dx%d, stride %d, bpp %d, depth %d, flip %s\n", - __FUNCTION__, - qxl->guest_primary.surface.width, - qxl->guest_primary.surface.height, - qxl->guest_primary.stride, - qxl->guest_primary.bytes_pp, - qxl->guest_primary.bits_pp, - qxl->guest_primary.flipped ? "yes" : "no"); - vga->ds->surface = - qemu_create_displaysurface_from(qxl->guest_primary.surface.width, - qxl->guest_primary.surface.height, - qxl->guest_primary.bits_pp, - qxl->guest_primary.stride, - ptr); - dpy_resize(vga->ds); + qxl_render_display_resized(qxl); } if (!qxl->guest_primary.commands) {