From patchwork Fri Mar 1 09:00:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 224250 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 E0B2A2C0296 for ; Fri, 1 Mar 2013 20:01:24 +1100 (EST) Received: from localhost ([::1]:44081 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBLqF-0003oI-2X for incoming@patchwork.ozlabs.org; Fri, 01 Mar 2013 04:01:23 -0500 Received: from eggs.gnu.org ([208.118.235.92]:43519) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBLpg-0003ny-CM for qemu-devel@nongnu.org; Fri, 01 Mar 2013 04:00:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UBLpe-00030P-Pk for qemu-devel@nongnu.org; Fri, 01 Mar 2013 04:00:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:26433) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBLpe-00030F-G0 for qemu-devel@nongnu.org; Fri, 01 Mar 2013 04:00:46 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2190jHD020641 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 1 Mar 2013 04:00:45 -0500 Received: from rincewind.home.kraxel.org (ovpn-116-72.ams2.redhat.com [10.36.116.72]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2190ixi029254; Fri, 1 Mar 2013 04:00:44 -0500 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id BB5C640B77; Fri, 1 Mar 2013 10:00:43 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 1 Mar 2013 10:00:35 +0100 Message-Id: <1362128443-15687-5-git-send-email-kraxel@redhat.com> In-Reply-To: <1362128443-15687-1-git-send-email-kraxel@redhat.com> References: <1362128443-15687-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [RfC PATCH 04/12] qxl: zap qxl0 global 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 DisplayChangeListener is passed now to all DisplayChangeListenerOps callbacks, so we can use that to access the qxl state and kill the qxl0 global variable. Signed-off-by: Gerd Hoffmann --- hw/qxl.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/hw/qxl.c b/hw/qxl.c index cb3d317..cc0ba40 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -118,8 +118,6 @@ static QXLMode qxl_modes[] = { QXL_MODE_EX(3200, 2400), }; -static PCIQXLDevice *qxl0; - static void qxl_send_events(PCIQXLDevice *d, uint32_t events); static int qxl_destroy_primary(PCIQXLDevice *d, qxl_async_io async); static void qxl_reset_memslots(PCIQXLDevice *d); @@ -1870,28 +1868,34 @@ static void display_update(DisplayChangeListener *dcl, struct DisplayState *ds, int x, int y, int w, int h) { - if (qxl0->mode == QXL_MODE_VGA) { - qemu_spice_display_update(&qxl0->ssd, x, y, w, h); + PCIQXLDevice *qxl = container_of(dcl, PCIQXLDevice, ssd.dcl); + + if (qxl->mode == QXL_MODE_VGA) { + qemu_spice_display_update(&qxl->ssd, x, y, w, h); } } static void display_resize(DisplayChangeListener *dcl, struct DisplayState *ds) { - if (qxl0->mode == QXL_MODE_VGA) { - qemu_spice_display_resize(&qxl0->ssd); + PCIQXLDevice *qxl = container_of(dcl, PCIQXLDevice, ssd.dcl); + + if (qxl->mode == QXL_MODE_VGA) { + qemu_spice_display_resize(&qxl->ssd); } } static void display_refresh(DisplayChangeListener *dcl, struct DisplayState *ds) { - if (qxl0->mode == QXL_MODE_VGA) { - qemu_spice_display_refresh(&qxl0->ssd); + PCIQXLDevice *qxl = container_of(dcl, PCIQXLDevice, ssd.dcl); + + if (qxl->mode == QXL_MODE_VGA) { + qemu_spice_display_refresh(&qxl->ssd); } else { - qemu_mutex_lock(&qxl0->ssd.lock); - qemu_spice_cursor_refresh_unlocked(&qxl0->ssd); - qemu_mutex_unlock(&qxl0->ssd.lock); + qemu_mutex_lock(&qxl->ssd.lock); + qemu_spice_cursor_refresh_unlocked(&qxl->ssd); + qemu_mutex_unlock(&qxl->ssd.lock); } } @@ -2074,8 +2078,6 @@ static int qxl_init_primary(PCIDevice *dev) qxl_hw_screen_dump, qxl_hw_text_update, qxl); qemu_spice_display_init_common(&qxl->ssd, vga->ds); - qxl0 = qxl; - rc = qxl_init_common(qxl); if (rc != 0) { return rc;