Commit e59bb1a7 authored by Alon Levy's avatar Alon Levy

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
parent 3c6b36fa
......@@ -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,
......
......@@ -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);
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment