From patchwork Tue Jul 12 13:55:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 104379 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 95C24B6F7C for ; Wed, 13 Jul 2011 00:29:16 +1000 (EST) Received: from localhost ([::1]:47901 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QgdxY-0003pj-Bm for incoming@patchwork.ozlabs.org; Tue, 12 Jul 2011 10:29:12 -0400 Received: from eggs.gnu.org ([140.186.70.92]:54243) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QgdRV-0004qI-0l for qemu-devel@nongnu.org; Tue, 12 Jul 2011 09:56:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QgdRP-0008HE-7X for qemu-devel@nongnu.org; Tue, 12 Jul 2011 09:56:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46401) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QgdRO-0008Gs-O5 for qemu-devel@nongnu.org; Tue, 12 Jul 2011 09:55:59 -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 p6CDtvcw028395 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 12 Jul 2011 09:55:57 -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 p6CDtpF9017856; Tue, 12 Jul 2011 09:55:56 -0400 From: Alon Levy To: qemu-devel@nongnu.org Date: Tue, 12 Jul 2011 16:55:16 +0300 Message-Id: <1310478932-25370-4-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: remove qxl_destroy_primary() 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 We'll have to move qemu_spice_destroy_primary_surface() out of qxl_destroy_primary(). That makes the function pretty pointless, so zap it and open code the two lines instead. Signed-off-by: Gerd Hoffmann --- hw/qxl.c | 28 ++++++++++++---------------- 1 files changed, 12 insertions(+), 16 deletions(-) diff --git a/hw/qxl.c b/hw/qxl.c index 2d46814..0c5ed65 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -120,7 +120,6 @@ static QXLMode qxl_modes[] = { static PCIQXLDevice *qxl0; static void qxl_send_events(PCIQXLDevice *d, uint32_t events); -static void qxl_destroy_primary(PCIQXLDevice *d); static void qxl_reset_memslots(PCIQXLDevice *d); static void qxl_reset_surfaces(PCIQXLDevice *d); static void qxl_ring_set_dirty(PCIQXLDevice *qxl); @@ -617,7 +616,10 @@ static void qxl_exit_vga_mode(PCIQXLDevice *d) return; } dprint(d, 1, "%s\n", __FUNCTION__); - qxl_destroy_primary(d); + if (d->mode != QXL_MODE_UNDEFINED) { + d->mode = QXL_MODE_UNDEFINED; + qemu_spice_destroy_primary_surface(&d->ssd, 0); + } } static void qxl_set_irq(PCIQXLDevice *d) @@ -720,7 +722,10 @@ static void qxl_vga_ioport_write(void *opaque, uint32_t addr, uint32_t val) if (qxl->mode != QXL_MODE_VGA) { dprint(qxl, 1, "%s\n", __FUNCTION__); - qxl_destroy_primary(qxl); + if (qxl->mode != QXL_MODE_UNDEFINED) { + qxl->mode = QXL_MODE_UNDEFINED; + qemu_spice_destroy_primary_surface(&qxl->ssd, 0); + } qxl_soft_reset(qxl); } vga_ioport_write(opaque, addr, val); @@ -881,18 +886,6 @@ static void qxl_create_guest_primary(PCIQXLDevice *qxl, int loadvm) qxl_render_resize(qxl); } -static void qxl_destroy_primary(PCIQXLDevice *d) -{ - if (d->mode == QXL_MODE_UNDEFINED) { - return; - } - - dprint(d, 1, "%s\n", __FUNCTION__); - - d->mode = QXL_MODE_UNDEFINED; - qemu_spice_destroy_primary_surface(&d->ssd, 0); -} - static void qxl_set_mode(PCIQXLDevice *d, int modenr, int loadvm) { pcibus_t start = d->pci.io_regions[QXL_RAM_RANGE_INDEX].addr; @@ -1019,7 +1012,10 @@ static void ioport_write(void *opaque, uint32_t addr, uint32_t val) case QXL_IO_DESTROY_PRIMARY: PANIC_ON(val != 0); dprint(d, 1, "QXL_IO_DESTROY_PRIMARY (%s)\n", qxl_mode_to_string(d->mode)); - qxl_destroy_primary(d); + if (d->mode != QXL_MODE_UNDEFINED) { + d->mode = QXL_MODE_UNDEFINED; + qemu_spice_destroy_primary_surface(&d->ssd, 0); + } break; case QXL_IO_DESTROY_SURFACE_WAIT: qemu_spice_destroy_surface_wait(&d->ssd, val);