[Spice-devel,14/19] qxl.h: add device_primary tri state UNDEFINED/NONE/CREATED

Submitted by Alon Levy on May 31, 2012, 10:24 a.m.

Details

Message ID 1338459893-1980-15-git-send-email-alevy@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Alon Levy May 31, 2012, 10:24 a.m.
---
 src/qxl.h        |    8 ++++++++
 src/qxl_driver.c |    4 ++++
 2 files changed, 12 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/qxl.h b/src/qxl.h
index c6d3793..56e03a3 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -126,6 +126,12 @@  enum {
     OPTION_COUNT,
 };
 
+enum {
+    QXL_DEVICE_PRIMARY_UNDEFINED,
+    QXL_DEVICE_PRIMARY_NONE,
+    QXL_DEVICE_PRIMARY_CREATED,
+};
+
 struct _qxl_screen_t
 {
     /* These are the names QXL uses */
@@ -138,6 +144,8 @@  struct _qxl_screen_t
     struct qxl_ring *		command_ring;
     struct qxl_ring *		cursor_ring;
     struct qxl_ring *		release_ring;
+
+    int                         device_primary;
     
     int				num_modes;
     struct QXLMode *		modes;
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index 1dbde5b..d78ea23 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -179,6 +179,7 @@  void qxl_create_primary(qxl_screen_t *qxl)
 #else
     ioport_write(qxl, QXL_IO_CREATE_PRIMARY, 0);
 #endif
+    qxl->device_primary = QXL_DEVICE_PRIMARY_CREATED;
 }
 
 void qxl_notify_oom(qxl_screen_t *qxl)
@@ -547,6 +548,7 @@  static void
 qxl_reset_and_create_mem_slots (qxl_screen_t *qxl)
 {
     ioport_write(qxl, QXL_IO_RESET, 0);
+    qxl->device_primary = QXL_DEVICE_PRIMARY_NONE;
     /* Mem slots */
     ErrorF ("slots start: %d, slots end: %d\n",
 	    qxl->rom->slots_start,
@@ -1236,6 +1238,7 @@  qxl_leave_vt(int scrnIndex, int flags)
     ioport_write(qxl, QXL_IO_RESET, 0);
 
     qxl_restore_state(pScrn);
+    qxl->device_primary = QXL_DEVICE_PRIMARY_NONE;
 }
 
 static Bool
@@ -1449,6 +1452,7 @@  qxl_pre_init(ScrnInfoPtr pScrn, int flags)
 	pScrn->driverPrivate = xnfcalloc(sizeof(qxl_screen_t), 1);
     qxl = pScrn->driverPrivate;
     memset(qxl, 0, sizeof(qxl));
+    qxl->device_primary = QXL_DEVICE_PRIMARY_UNDEFINED;
 
     qxl->entity = xf86GetEntityInfo(pScrn->entityList[0]);