summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2011-02-01 18:21:05 +0200
committerAlon Levy <alevy@redhat.com>2011-02-10 21:14:48 +0200
commitad23670f5ba7302eed2b2fe5ef1b59771c2fb4e0 (patch)
tree41425518fb294de9d8a22af49a2d287a40257633
parentc3e8ab24d0f65da1380bd6422160c1543c15b115 (diff)
xspice: qxl_driver: update header to include worker, update ring to use callback and not io
-rw-r--r--src/Makefile.am2
-rw-r--r--src/qxl.h25
-rw-r--r--src/qxl_ring.c30
3 files changed, 33 insertions, 24 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index e014089..fa168a2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -30,7 +30,7 @@ SUBDIRS=uxa
AM_CFLAGS = $(SPICE_PROTOCOL_CFLAGS) $(SPICE_CFLAGS) $(XORG_CFLAGS) $(PCIACCESS_CFLAGS) $(CWARNFLAGS)
qxl_drv_la_LTLIBRARIES = qxl_drv.la
-qxl_drv_la_LDFLAGS = -module -avoid-version
+qxl_drv_la_LDFLAGS = -module -avoid-version $(SPICE_LIBS)
qxl_drv_ladir = @moduledir@/drivers
qxl_drv_la_LIBADD = uxa/libuxa.la
diff --git a/src/qxl.h b/src/qxl.h
index ed4f725..d004f94 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -119,16 +119,6 @@ struct _qxl_screen_t
EntityInfoPtr entity;
- void * io_pages;
- void * io_pages_physical;
-
-#ifdef XSERVER_LIBPCIACCESS
- struct pci_device * pci;
-#else
- pciVideoPtr pci;
- PCITAG pci_tag;
-#endif
-
uxa_driver_t * uxa;
CreateScreenResourcesProcPtr create_screen_resources;
@@ -159,7 +149,10 @@ struct _qxl_screen_t
struct QXLRom shadow_rom; /* Parameter RAM */
// NEXT: add spice server and worker thread here.
SpiceServer * spice_server;
- QXLWorker * qxl_worker;
+ QXLWorker * worker;
+ int debug;
+ QXLInstance display_sin;
+ int num_free_res;
};
static inline uint64_t
@@ -206,16 +199,20 @@ void qxl_cursor_init (ScreenPtr pScreen);
/*
* Rings
*/
+typedef void (*notify_cb)(void *opaque);
+
struct qxl_ring * qxl_ring_create (struct qxl_ring_header *header,
- int element_size,
- int n_elements,
- int prod_notify);
+ int element_size,
+ int n_elements,
+ notify_cb notify,
+ void *opaque);
void qxl_ring_push (struct qxl_ring *ring,
const void *element);
Bool qxl_ring_pop (struct qxl_ring *ring,
void *element);
void qxl_ring_wait_idle (struct qxl_ring *ring);
+Bool qxl_ring_is_empty (struct qxl_ring *ring);
/*
* Surface
diff --git a/src/qxl_ring.c b/src/qxl_ring.c
index b9a82e6..9b913bb 100644
--- a/src/qxl_ring.c
+++ b/src/qxl_ring.c
@@ -37,16 +37,18 @@ struct ring
struct qxl_ring
{
volatile struct ring *ring;
- int element_size;
- int n_elements;
- int prod_notify;
+ int element_size;
+ int n_elements;
+ notify_cb notify;
+ void *opaque;
};
struct qxl_ring *
qxl_ring_create (struct qxl_ring_header *header,
- int element_size,
- int n_elements,
- int prod_notify)
+ int element_size,
+ int n_elements,
+ notify_cb notify,
+ void *opaque)
{
struct qxl_ring *ring;
@@ -57,7 +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->notify = notify;
+ ring->opaque = opaque;
return ring;
}
@@ -86,8 +89,17 @@ qxl_ring_push (struct qxl_ring *ring,
mem_barrier();
- if (header->prod == header->notify_on_prod)
- outb (ring->prod_notify, 0);
+ if (header->prod == header->notify_on_prod && ring->notify) {
+ ring->notify(ring->opaque);
+ }
+}
+
+Bool
+qxl_ring_is_empty (struct qxl_ring *ring)
+{
+ volatile struct qxl_ring_header *header = &(ring->ring->header);
+
+ return (header->cons == header->prod);
}
Bool