dcavalca / rpms / qemu

Forked from rpms/qemu 11 months ago
Clone

Blame 0021-qxl-add-QXL_IO_FLUSH_-SURFACES-RELEASE-for-guest-S3-.patch

Justin M. Forbes fc5c27
>From fed782e33714e6a44bca9a8c3ab8b017393e8089 Mon Sep 17 00:00:00 2001
Justin M. Forbes 13f703
From: Alon Levy <alevy@redhat.com>
Justin M. Forbes 13f703
Date: Sun, 5 Jun 2011 11:01:48 +0300
Justin M. Forbes fc5c27
Subject: [PATCH 21/28] qxl: add QXL_IO_FLUSH_{SURFACES,RELEASE} for guest
Justin M. Forbes 13f703
 S3&S4 support
Justin M. Forbes 13f703
Justin M. Forbes 13f703
Add two new IOs.
Justin M. Forbes 13f703
 QXL_IO_FLUSH_SURFACES - equivalent to update area for all surfaces, used
Justin M. Forbes 13f703
  to reduce vmexits from NumSurfaces to 1 on guest S3, S4 and resolution change (windows
Justin M. Forbes 13f703
  driver implementation is such that this is done on each of those occasions).
Justin M. Forbes 13f703
 QXL_IO_FLUSH_RELEASE - used to ensure anything on last_release is put on the release ring
Justin M. Forbes 13f703
  for the client to free.
Justin M. Forbes 13f703
Justin M. Forbes 13f703
Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Justin M. Forbes 13f703
Signed-off-by: Alon Levy <alevy@redhat.com>
Justin M. Forbes 13f703
---
Justin M. Forbes 13f703
 hw/qxl.c |   30 ++++++++++++++++++++++++++++++
Justin M. Forbes 13f703
 1 files changed, 30 insertions(+), 0 deletions(-)
Justin M. Forbes 13f703
Justin M. Forbes 13f703
diff --git a/hw/qxl.c b/hw/qxl.c
Justin M. Forbes 13f703
index d3109e4..847a9b8 100644
Justin M. Forbes 13f703
--- a/hw/qxl.c
Justin M. Forbes 13f703
+++ b/hw/qxl.c
Justin M. Forbes 13f703
@@ -185,6 +185,13 @@ static void qxl_spice_destroy_surface_wait(PCIQXLDevice *qxl, uint32_t id,
Justin M. Forbes 13f703
     }
Justin M. Forbes 13f703
 }
Justin M. Forbes 13f703
 
Justin M. Forbes 13f703
+#if SPICE_INTERFACE_QXL_MINOR >= 1
Justin M. Forbes 13f703
+static void qxl_spice_flush_surfaces_async(PCIQXLDevice *qxl)
Justin M. Forbes 13f703
+{
Justin M. Forbes 13f703
+    spice_qxl_flush_surfaces_async(&qxl->ssd.qxl, 0);
Justin M. Forbes 13f703
+}
Justin M. Forbes 13f703
+#endif
Justin M. Forbes 13f703
+
Justin M. Forbes 13f703
 void qxl_spice_loadvm_commands(PCIQXLDevice *qxl, struct QXLCommandExt *ext,
Justin M. Forbes 13f703
                                uint32_t count)
Justin M. Forbes 13f703
 {
Justin M. Forbes 13f703
@@ -1184,6 +1191,8 @@ static void ioport_write(void *opaque, uint32_t addr, uint32_t val)
Justin M. Forbes 13f703
         goto async_common;
Justin M. Forbes 13f703
     case QXL_IO_DESTROY_ALL_SURFACES_ASYNC:
Justin M. Forbes 13f703
         io_port = QXL_IO_DESTROY_ALL_SURFACES;
Justin M. Forbes 13f703
+        goto async_common;
Justin M. Forbes 13f703
+    case QXL_IO_FLUSH_SURFACES_ASYNC:
Justin M. Forbes 13f703
 async_common:
Justin M. Forbes 13f703
         async = QXL_ASYNC;
Justin M. Forbes 13f703
         qemu_mutex_lock(&d->async_lock);
Justin M. Forbes 13f703
@@ -1296,6 +1305,27 @@ async_common:
Justin M. Forbes 13f703
         }
Justin M. Forbes 13f703
         qxl_spice_destroy_surface_wait(d, val, async);
Justin M. Forbes 13f703
         break;
Justin M. Forbes 13f703
+#if SPICE_INTERFACE_QXL_MINOR >= 1
Justin M. Forbes 13f703
+    case QXL_IO_FLUSH_RELEASE: {
Justin M. Forbes 13f703
+        QXLReleaseRing *ring = &d->ram->release_ring;
Justin M. Forbes 13f703
+        if (ring->prod - ring->cons + 1 == ring->num_items) {
Justin M. Forbes 13f703
+            fprintf(stderr,
Justin M. Forbes 13f703
+                "ERROR: no flush, full release ring [p%d,%dc]\n",
Justin M. Forbes 13f703
+                ring->prod, ring->cons);
Justin M. Forbes 13f703
+        }
Justin M. Forbes 13f703
+        qxl_push_free_res(d, 1 /* flush */);
Justin M. Forbes 13f703
+        dprint(d, 1, "QXL_IO_FLUSH_RELEASE exit (%s, s#=%d, res#=%d,%p)\n",
Justin M. Forbes 13f703
+            qxl_mode_to_string(d->mode), d->guest_surfaces.count,
Justin M. Forbes 13f703
+            d->num_free_res, d->last_release);
Justin M. Forbes 13f703
+        break;
Justin M. Forbes 13f703
+    }
Justin M. Forbes 13f703
+    case QXL_IO_FLUSH_SURFACES_ASYNC:
Justin M. Forbes 13f703
+        dprint(d, 1, "QXL_IO_FLUSH_SURFACES_ASYNC (%d) (%s, s#=%d, res#=%d)\n",
Justin M. Forbes 13f703
+               val, qxl_mode_to_string(d->mode), d->guest_surfaces.count,
Justin M. Forbes 13f703
+               d->num_free_res);
Justin M. Forbes 13f703
+        qxl_spice_flush_surfaces_async(d);
Justin M. Forbes 13f703
+        break;
Justin M. Forbes 13f703
+#endif
Justin M. Forbes 13f703
     case QXL_IO_DESTROY_ALL_SURFACES:
Justin M. Forbes 13f703
         d->mode = QXL_MODE_UNDEFINED;
Justin M. Forbes 13f703
         qxl_spice_destroy_surfaces(d, async);
Justin M. Forbes 13f703
-- 
Justin M. Forbes 13f703
1.7.5.1
Justin M. Forbes 13f703