summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2011-04-27 14:13:30 +0300
committerAlon Levy <alevy@redhat.com>2011-07-22 03:47:27 +0300
commite59bb1a7ea16751c185a9ab33d93f7242118cb4c (patch)
tree93f3eccf92ba21004d6e63b3e2b9d8f31af47f25
parent3c6b36fab37e3d5ab66d0080bd086eaff9778ec6 (diff)
qxl_ring: keep qxl pointer
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
-rw-r--r--src/qxl.h3
-rw-r--r--src/qxl_driver.c6
-rw-r--r--src/qxl_ring.c12
3 files changed, 12 insertions, 9 deletions
diff --git a/src/qxl.h b/src/qxl.h
index a2daa8b..594dd5b 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -208,7 +208,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 ac36aa4..6099923 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 ((struct qxl_ring_header *)&(ram_header->cmd_ring),
sizeof (struct QXLCommand),
- 32, qxl->io_base + QXL_IO_NOTIFY_CMD);
+ QXL_COMMAND_RING_SIZE, QXL_IO_NOTIFY_CMD, qxl);
qxl->cursor_ring = qxl_ring_create ((struct qxl_ring_header *)&(ram_header->cursor_ring),
sizeof (struct QXLCommand),
- 32, qxl->io_base + QXL_IO_NOTIFY_CURSOR);
+ QXL_CURSOR_RING_SIZE, QXL_IO_NOTIFY_CURSOR, qxl);
qxl->release_ring = qxl_ring_create ((struct qxl_ring_header *)&(ram_header->release_ring),
sizeof (uint64_t),
- 8, 0);
+ QXL_RELEASE_RING_SIZE, 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