[Spice-devel,16/19] io: add qxl_io_destroy_primary

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

Details

Message ID 1338459893-1980-17-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        |    1 +
 src/qxl_driver.c |   15 +++++++++++++++
 2 files changed, 16 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/qxl.h b/src/qxl.h
index 819c98d..aa6645c 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -435,6 +435,7 @@  inline void qxl_mem_unverifiable(struct qxl_mem *mem) {}
 void qxl_update_area(qxl_screen_t *qxl);
 void qxl_io_memslot_add(qxl_screen_t *qxl, uint8_t id);
 void qxl_io_create_primary(qxl_screen_t *qxl);
+void qxl_io_destroy_primary(qxl_screen_t *qxl);
 void qxl_io_notify_oom(qxl_screen_t *qxl);
 void qxl_io_flush_surfaces(qxl_screen_t *qxl);
 void qxl_io_destroy_all_surfaces (qxl_screen_t *qxl);
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index 852cae2..809be5e 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -182,6 +182,21 @@  void qxl_io_create_primary(qxl_screen_t *qxl)
     qxl->device_primary = QXL_DEVICE_PRIMARY_CREATED;
 }
 
+void qxl_io_destroy_primary(qxl_screen_t *qxl)
+{
+#ifndef XSPICE
+    if (qxl->pci->revision >= 3) {
+        ioport_write(qxl, QXL_IO_DESTROY_PRIMARY_ASYNC, 0);
+        qxl_wait_for_io_command(qxl);
+    } else {
+        ioport_write(qxl, QXL_IO_DESTROY_PRIMARY, 0);
+    }
+#else
+    ioport_write(qxl, QXL_IO_DESTROY_PRIMARY, 0);
+#endif
+    qxl->device_primary = QXL_DEVICE_PRIMARY_NONE;
+}
+
 void qxl_io_notify_oom(qxl_screen_t *qxl)
 {
     ioport_write(qxl, QXL_IO_NOTIFY_OOM, 0);