qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [RfC PATCH 04/12] qxl: zap qxl0 global
Date: Fri,  1 Mar 2013 10:00:35 +0100	[thread overview]
Message-ID: <1362128443-15687-5-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1362128443-15687-1-git-send-email-kraxel@redhat.com>

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 <kraxel@redhat.com>
---
 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;
-- 
1.7.9.7

  parent reply	other threads:[~2013-03-01  9:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-01  9:00 [Qemu-devel] [RfC PATCH 00/12] console/display: cleanup & untangle data structures Gerd Hoffmann
2013-03-01  9:00 ` [Qemu-devel] [RfC PATCH 01/12] console: fix displaychangelisteners interface Gerd Hoffmann
2013-03-01  9:00 ` [Qemu-devel] [RfC PATCH 02/12] console: kill DisplayState->opaque Gerd Hoffmann
2013-03-01  9:00 ` [Qemu-devel] [RfC PATCH 03/12] spice: zap sdpy global Gerd Hoffmann
2013-03-01  9:00 ` Gerd Hoffmann [this message]
2013-03-01  9:00 ` [Qemu-devel] [RfC PATCH 05/12] qxl: better vga init in enter_vga_mode Gerd Hoffmann
2013-03-01  9:00 ` [Qemu-devel] [RfC PATCH 06/12] sdl: drop dead code Gerd Hoffmann
2013-03-01  9:00 ` [Qemu-devel] [RfC PATCH 07/12] console: rework DisplaySurface handling [vga emu side] Gerd Hoffmann
2013-03-01  9:00 ` [Qemu-devel] [RfC PATCH 08/12] console: rework DisplaySurface handling [dcl/ui side] Gerd Hoffmann
2013-03-01  9:00 ` [Qemu-devel] [RfC PATCH 09/12] console: add surface_*() getters Gerd Hoffmann
2013-03-01  9:00 ` [Qemu-devel] [RfC PATCH 10/12] gtk: stop using DisplayState Gerd Hoffmann
2013-03-01  9:00 ` [Qemu-devel] [RfC PATCH 11/12] vnc: " Gerd Hoffmann
2013-03-01  9:00 ` [Qemu-devel] [RfC PATCH 12/12] sdl: " Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1362128443-15687-5-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).