Add a qxl_screen_t* member to qxl_ring to make generelizing outb to
ioport_write easier in the next patch. This means we do an extra deref
and addition for every outb, but it means the code becomes simpler for
doing outb in qxl_drv.so and a function call for spiceqxl_drv.so
---
 src/qxl.h        |    3 ++-
 src/qxl_driver.c |    6 +++---
 src/qxl_ring.c   |   12 +++++++-----
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/qxl.h b/src/qxl.h
index d086ac7..99dfecf 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -207,7 +207,8 @@ void              qxl_cursor_init        (ScreenPtr         
      pScreen);
 struct qxl_ring * qxl_ring_create      (struct qxl_ring_header *header,
                                        int                     element_size,
                                        int                     n_elements,
-                                       int                     prod_notify);
+                                       int                     prod_notify,
+                                       qxl_screen_t            *qxl);
 void              qxl_ring_push        (struct qxl_ring        *ring,
                                        const void             *element);
 Bool              qxl_ring_pop         (struct qxl_ring        *ring,
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index b8f2812..a712ca0 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -908,13 +908,13 @@ qxl_screen_init(int scrnIndex, ScreenPtr pScreen, int 
argc, char **argv)
     
     qxl->command_ring = qxl_ring_create (&(ram_header->cmd_ring),
                                         sizeof (struct QXLCommand),
-                                        32, qxl->io_base + QXL_IO_NOTIFY_CMD);
+                                        32, QXL_IO_NOTIFY_CMD, qxl);
     qxl->cursor_ring = qxl_ring_create (&(ram_header->cursor_ring),
                                        sizeof (struct QXLCommand),
-                                       32, qxl->io_base + 
QXL_IO_NOTIFY_CURSOR);
+                                       32, QXL_IO_NOTIFY_CURSOR, qxl);
     qxl->release_ring = qxl_ring_create (&(ram_header->release_ring),
                                         sizeof (uint64_t),
-                                        8, 0);
+                                        8, 0, qxl);
 
     qxl->surface_cache = qxl_surface_cache_create (qxl);
     
diff --git a/src/qxl_ring.c b/src/qxl_ring.c
index b9a82e6..22d98ea 100644
--- a/src/qxl_ring.c
+++ b/src/qxl_ring.c
@@ -39,14 +39,16 @@ struct qxl_ring
     volatile struct ring *ring;
     int                        element_size;
     int                        n_elements;
-    int                        prod_notify;
+    int                        io_port_prod_notify;
+    qxl_screen_t    *qxl;
 };
 
 struct qxl_ring *
 qxl_ring_create (struct qxl_ring_header *header,
                 int                     element_size,
                 int                     n_elements,
-                int                     prod_notify)
+                int                     io_port_prod_notify,
+                qxl_screen_t           *qxl)
 {
     struct qxl_ring *ring;
 
@@ -57,8 +59,8 @@ qxl_ring_create (struct qxl_ring_header *header,
     ring->ring = (volatile struct ring *)header;
     ring->element_size = element_size;
     ring->n_elements = n_elements;
-    ring->prod_notify = prod_notify;
-    
+    ring->io_port_prod_notify = io_port_prod_notify;
+    ring->qxl = qxl;
     return ring;
 }
 
@@ -87,7 +89,7 @@ qxl_ring_push (struct qxl_ring *ring,
     mem_barrier();
 
     if (header->prod == header->notify_on_prod)
-       outb (ring->prod_notify, 0);
+       outb (ring->qxl->io_base + ring->io_port_prod_notify, 0);
 }
 
 Bool
-- 
1.7.4.4

_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to