[Spice-devel] [spice-protocol PATCH 02/46] qxl_ring.h: introduce

Alon Levy alevy at redhat.com
Tue Apr 10 04:49:58 PDT 2012


split qxl ring definitions to separate header file from qxl.h.
---
 src/qxl.h         |   29 +----------------------------
 src/qxl_cursor.c  |    1 +
 src/qxl_driver.c  |    1 +
 src/qxl_ring.c    |    1 +
 src/qxl_ring.h    |   35 +++++++++++++++++++++++++++++++++++
 src/qxl_surface.c |    1 +
 6 files changed, 40 insertions(+), 28 deletions(-)
 create mode 100644 src/qxl_ring.h

diff --git a/src/qxl.h b/src/qxl.h
index df2d368..85256fa 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -65,17 +65,8 @@
 #define PCI_CHIP_QXL_0100	0x0100
 #define PCI_CHIP_QXL_01FF	0x01ff
 
-#pragma pack(push,1)
-
-struct qxl_ring_header {
-    uint32_t num_items;
-    uint32_t prod;
-    uint32_t notify_on_prod;
-    uint32_t cons;
-    uint32_t notify_on_cons;
-};
+struct qxl_ring;
 
-#pragma pack(pop)
 typedef struct surface_cache_t surface_cache_t;
 
 typedef struct _qxl_screen_t qxl_screen_t;
@@ -272,30 +263,12 @@ pointer_to_u64 (void *p)
     return (uint64_t)(unsigned long)p;
 }
 
-struct qxl_ring;
-
 /*
  * HW cursor
  */
 void              qxl_cursor_init        (ScreenPtr               pScreen);
 
 
-
-/*
- * Rings
- */
-struct qxl_ring * qxl_ring_create      (struct qxl_ring_header *header,
-					int                     element_size,
-					int                     n_elements,
-					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,
-					void                   *element);
-void              qxl_ring_wait_idle   (struct qxl_ring        *ring);
-
-
 /*
  * Surface
  */
diff --git a/src/qxl_cursor.c b/src/qxl_cursor.c
index 3094a96..68ea3ce 100644
--- a/src/qxl_cursor.c
+++ b/src/qxl_cursor.c
@@ -30,6 +30,7 @@
 
 #include <string.h>
 #include "qxl.h"
+#include "qxl_ring.h"
 #include <cursorstr.h>
 
 static void
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index 77fc40b..88d01e4 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -40,6 +40,7 @@
 #include <time.h>
 #include <stdlib.h>
 #include "qxl.h"
+#include "qxl_ring.h"
 #include "assert.h"
 #include "qxl_option_helpers.h"
 
diff --git a/src/qxl_ring.c b/src/qxl_ring.c
index d701791..7aea083 100644
--- a/src/qxl_ring.c
+++ b/src/qxl_ring.c
@@ -33,6 +33,7 @@
 #include <stdlib.h>
 #include <sched.h>
 #include "qxl.h"
+#include "qxl_ring.h"
 
 struct ring
 {
diff --git a/src/qxl_ring.h b/src/qxl_ring.h
new file mode 100644
index 0000000..bcf1e6f
--- /dev/null
+++ b/src/qxl_ring.h
@@ -0,0 +1,35 @@
+/* vim: set ts=8 : */
+#ifndef QXL_RING
+#define QXL_RING
+
+#include "qxl.h"
+
+#pragma pack(push,1)
+
+struct qxl_ring_header {
+    uint32_t num_items;
+    uint32_t prod;
+    uint32_t notify_on_prod;
+    uint32_t cons;
+    uint32_t notify_on_cons;
+};
+
+#pragma pack(pop)
+
+struct qxl_ring;
+
+/*
+ * Rings
+ */
+struct qxl_ring * qxl_ring_create      (struct qxl_ring_header *header,
+					int                     element_size,
+					int                     n_elements,
+					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,
+					void                   *element);
+void              qxl_ring_wait_idle   (struct qxl_ring        *ring);
+
+#endif
diff --git a/src/qxl_surface.c b/src/qxl_surface.c
index 26c2bb8..88e38c7 100644
--- a/src/qxl_surface.c
+++ b/src/qxl_surface.c
@@ -49,6 +49,7 @@
 #endif
 
 #include "qxl.h"
+#include "qxl_ring.h"
 
 typedef struct evacuated_surface_t evacuated_surface_t;
 
-- 
1.7.9.3



More information about the Spice-devel mailing list