rjones / rpms / qemu

Forked from rpms/qemu 5 months ago
Clone
Blob Blame History Raw
From 2b63fc61e815ba6ab09d30381712158599810b28 Mon Sep 17 00:00:00 2001
From: Alon Levy <alevy@redhat.com>
Date: Wed, 18 Apr 2012 14:00:06 +0300
Subject: [PATCH] qxl: don't assert on guest create_guest_primary

initiate the implicit destroy ourselves.

Signed-off-by: Alon Levy <alevy@redhat.com>
---
 hw/qxl.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/hw/qxl.c b/hw/qxl.c
index 2135fde..29c8873 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1123,7 +1123,15 @@ static void qxl_create_guest_primary(PCIQXLDevice *qxl, int loadvm,
     QXLDevSurfaceCreate surface;
     QXLSurfaceCreate *sc = &qxl->guest_primary.surface;
 
-    assert(qxl->mode != QXL_MODE_NATIVE);
+    if (qxl->mode == QXL_MODE_NATIVE) {
+        /*
+         * allow a create without a destroy. This could be used
+         * later for an atomic "change primary" but right now just
+         * destroy the primary for the guest. Note that this uses
+         * the ability to have multiple concurrent async commands.
+         */
+        qxl_destroy_primary(qxl, async);
+    }
     qxl_exit_vga_mode(qxl);
 
     surface.format     = le32_to_cpu(sc->format);