[Spice-commits] Branch 'spice.v4' - 3 commits - Makefile.target hw/qxl-logger.c hw/qxl.c hw/qxl.h spice-display.c spice-display.h
Gerd Hoffmann
kraxel at kemper.freedesktop.org
Wed Apr 28 04:11:25 PDT 2010
Makefile.target | 2
hw/qxl-logger.c | 184 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
hw/qxl.c | 140 ++++++++++++++++--------------------------
hw/qxl.h | 85 +++++++++++++++++++++++++
spice-display.c | 2
spice-display.h | 2
6 files changed, 327 insertions(+), 88 deletions(-)
New commits:
commit 9f72f436f01fd985da2a8af9f31c35ba6f338007
Author: Gerd Hoffmann <kraxel at redhat.com>
Date: Wed Apr 28 13:09:00 2010 +0200
qxl: add qxl.h, qxl-logger.c
command logging and migration bits.
diff --git a/Makefile.target b/Makefile.target
index 00ec171..d962d95 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -195,7 +195,7 @@ obj-i386-y += vmmouse.o vmport.o hpet.o
obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o
obj-i386-y += debugcon.o multiboot.o
obj-i386-$(CONFIG_SPICE) += spice.o spice-input.o spice-display.o
-obj-i386-$(CONFIG_SPICE) += qxl.o spice-vmc.o spice-vdi.o
+obj-i386-$(CONFIG_SPICE) += qxl.o qxl-logger.o spice-vmc.o spice-vdi.o
# shared objects
obj-ppc-y = ppc.o
diff --git a/hw/qxl-logger.c b/hw/qxl-logger.c
new file mode 100644
index 0000000..e2e8e2e
--- /dev/null
+++ b/hw/qxl-logger.c
@@ -0,0 +1,184 @@
+#include <stdio.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "qxl.h"
+
+static const char *qxl_type[] = {
+ [ QXL_CMD_NOP ] = "nop",
+ [ QXL_CMD_DRAW ] = "draw",
+ [ QXL_CMD_UPDATE ] = "update",
+ [ QXL_CMD_CURSOR ] = "cursor",
+ [ QXL_CMD_MESSAGE ] = "message",
+ [ QXL_CMD_SURFACE ] = "surface",
+};
+
+static const char *qxl_draw_type[] = {
+ [ QXL_DRAW_NOP ] = "nop",
+ [ QXL_DRAW_FILL ] = "fill",
+ [ QXL_DRAW_OPAQUE ] = "opaque",
+ [ QXL_DRAW_COPY ] = "copy",
+ [ QXL_COPY_BITS ] = "copy-bits",
+ [ QXL_DRAW_BLEND ] = "blend",
+ [ QXL_DRAW_BLACKNESS ] = "blackness",
+ [ QXL_DRAW_WHITENESS ] = "whitemess",
+ [ QXL_DRAW_INVERS ] = "invers",
+ [ QXL_DRAW_ROP3 ] = "rop3",
+ [ QXL_DRAW_STROKE ] = "stroke",
+ [ QXL_DRAW_TEXT ] = "text",
+ [ QXL_DRAW_TRANSPARENT ] = "transparent",
+ [ QXL_DRAW_ALPHA_BLEND ] = "alpha-blend",
+};
+
+static const char *qxl_draw_effect[] = {
+ [ QXL_EFFECT_BLEND ] = "blend",
+ [ QXL_EFFECT_OPAQUE ] = "opaque",
+ [ QXL_EFFECT_REVERT_ON_DUP ] = "revert-on-dup",
+ [ QXL_EFFECT_BLACKNESS_ON_DUP ] = "blackness-on-dup",
+ [ QXL_EFFECT_WHITENESS_ON_DUP ] = "whiteness-on-dup",
+ [ QXL_EFFECT_NOP_ON_DUP ] = "nop-on-dup",
+ [ QXL_EFFECT_NOP ] = "nop",
+ [ QXL_EFFECT_OPAQUE_BRUSH ] = "opaque-brush",
+};
+
+static const char *qxl_surface_cmd[] = {
+ [ QXL_SURFACE_CMD_CREATE ] = "create",
+ [ QXL_SURFACE_CMD_DESTROY ] = "destroy",
+};
+
+static const char *spice_surface_fmt[] = {
+ [ SPICE_SURFACE_FMT_INVALID ] = "invalid",
+ [ SPICE_SURFACE_FMT_1_A ] = "alpha/1",
+ [ SPICE_SURFACE_FMT_8_A ] = "alpha/8",
+ [ SPICE_SURFACE_FMT_16_555 ] = "555/16",
+ [ SPICE_SURFACE_FMT_16_565 ] = "565/16",
+ [ SPICE_SURFACE_FMT_32_xRGB ] = "xRGB/32",
+ [ SPICE_SURFACE_FMT_32_ARGB ] = "ARGB/32",
+};
+
+static const char *qxl_cursor_cmd[] = {
+ [ QXL_CURSOR_SET ] = "set",
+ [ QXL_CURSOR_MOVE ] = "move",
+ [ QXL_CURSOR_HIDE ] = "hide",
+ [ QXL_CURSOR_TRAIL ] = "trail",
+};
+
+static const char *spice_cursor_type[] = {
+ [ SPICE_CURSOR_TYPE_ALPHA ] = "alpha",
+ [ SPICE_CURSOR_TYPE_MONO ] = "mono",
+ [ SPICE_CURSOR_TYPE_COLOR4 ] = "color4",
+ [ SPICE_CURSOR_TYPE_COLOR8 ] = "color8",
+ [ SPICE_CURSOR_TYPE_COLOR16 ] = "color16",
+ [ SPICE_CURSOR_TYPE_COLOR24 ] = "color24",
+ [ SPICE_CURSOR_TYPE_COLOR32 ] = "color32",
+};
+
+static const char *qxl_v2n(const char *n[], size_t l, int v)
+{
+ if (v >= l || !n[v])
+ return "???";
+ return n[v];
+}
+#define qxl_name(_list, _value) qxl_v2n(_list, ARRAY_SIZE(_list), _value)
+
+static void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL phys, int group_id)
+{
+ uint32_t slot = (phys >> (64 - 8)) & 0xff;
+ uint64_t off = phys & 0xffffffffffff;
+
+ switch (group_id) {
+ case MEMSLOT_GROUP_HOST:
+ return (void*)off;
+ case MEMSLOT_GROUP_GUEST:
+ PANIC_ON(slot > NUM_MEMSLOTS);
+ PANIC_ON(!qxl->guest_slots[slot].active);
+ PANIC_ON(off > qxl->guest_slots[slot].size)
+ return qxl->guest_slots[slot].ptr + off;
+ default:
+ PANIC_ON(1);
+ }
+}
+
+static void qxl_log_cmd_draw(PCIQXLDevice *qxl, QXLDrawable *draw)
+{
+ fprintf(stderr, ": surface_id %d type %s effect %s",
+ draw->surface_id,
+ qxl_name(qxl_draw_type, draw->type),
+ qxl_name(qxl_draw_effect, draw->effect));
+}
+
+static void qxl_log_cmd_surface(PCIQXLDevice *qxl, QXLSurfaceCmd *cmd)
+{
+ fprintf(stderr, ": %s id %d",
+ qxl_name(qxl_surface_cmd, cmd->type),
+ cmd->surface_id);
+ if (cmd->type == QXL_SURFACE_CMD_CREATE) {
+ qxl->surface_count++;
+ fprintf(stderr, " size %dx%d stride %d format %s (count %d)",
+ cmd->u.surface_create.width,
+ cmd->u.surface_create.height,
+ cmd->u.surface_create.stride,
+ qxl_name(spice_surface_fmt, cmd->u.surface_create.format),
+ qxl->surface_count);
+ }
+ if (cmd->type == QXL_SURFACE_CMD_DESTROY) {
+ qxl->surface_count--;
+ fprintf(stderr, " (count %d)", qxl->surface_count);
+ }
+}
+
+static void qxl_log_cmd_cursor(PCIQXLDevice *qxl, QXLCursorCmd *cmd, int group_id)
+{
+ QXLCursor *cursor;
+
+ fprintf(stderr, ": %s",
+ qxl_name(qxl_cursor_cmd, cmd->type));
+ switch (cmd->type) {
+ case QXL_CURSOR_SET:
+ fprintf(stderr, " +%d+%d visible %s, shape @ 0x%" PRIx64,
+ cmd->u.set.position.x,
+ cmd->u.set.position.y,
+ cmd->u.set.visible ? "yes" : "no",
+ cmd->u.set.shape);
+ cursor = qxl_phys2virt(qxl, cmd->u.set.shape, group_id);
+ fprintf(stderr, " type %s size %dx%d hot-spot +%d+%d"
+ " unique 0x%" PRIx64 " data-size %d",
+ qxl_name(spice_cursor_type, cursor->header.type),
+ cursor->header.width, cursor->header.height,
+ cursor->header.hot_spot_x, cursor->header.hot_spot_y,
+ cursor->header.unique, cursor->data_size);
+ break;
+ case QXL_CURSOR_MOVE:
+ fprintf(stderr, " +%d+%d", cmd->u.position.x, cmd->u.position.y);
+ break;
+ }
+}
+
+void qxl_log_command(PCIQXLDevice *qxl, const char *ring, QXLCommandExt *ext)
+{
+ bool compat = ext->flags & QXL_COMMAND_FLAG_COMPAT;
+ void *data;
+
+ if (!qxl->log) {
+ return;
+ }
+ fprintf(stderr, "qxl-%d/%s:", qxl->id, ring);
+ fprintf(stderr, " cmd @ 0x%" PRIx64 " %s%s", ext->cmd.data,
+ qxl_name(qxl_type, ext->cmd.type),
+ compat ? "(compat)" : "");
+
+ data = qxl_phys2virt(qxl, ext->cmd.data, ext->group_id);
+ switch (ext->cmd.type) {
+ case QXL_CMD_DRAW:
+ qxl_log_cmd_draw(qxl, data);
+ break;
+ case QXL_CMD_SURFACE:
+ qxl_log_cmd_surface(qxl, data);
+ break;
+ case QXL_CMD_CURSOR:
+ qxl_log_cmd_cursor(qxl, data, ext->group_id);
+ break;
+ }
+ fprintf(stderr, "\n");
+}
diff --git a/hw/qxl.c b/hw/qxl.c
index ac00d6d..fd4e4fd 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -6,16 +6,12 @@
#include <pthread.h>
#include "qemu-common.h"
-#include "qemu-spice.h"
#include "qemu-timer.h"
#include "qemu-queue.h"
#include "monitor.h"
-#include "console.h"
#include "sysemu.h"
-#include "pci.h"
-#include "vga_int.h"
-#include "spice-display.h"
+#include "qxl.h"
#undef SPICE_RING_PROD_ITEM
#define SPICE_RING_PROD_ITEM(r, ret) { \
@@ -41,68 +37,6 @@
ret = &m_item->el; \
}
-
-#define PANIC_ON(x) if ((x)) { \
- printf("%s: PANIC %s failed\n", __FUNCTION__, #x); \
- exit(-1); \
-}
-
-enum qxl_mode {
- QXL_MODE_UNDEFINED,
- QXL_MODE_VGA,
- QXL_MODE_COMPAT, /* spice 0.4.x */
- QXL_MODE_NATIVE,
-};
-
-typedef struct PCIQXLDevice {
- PCIDevice pci;
- SimpleSpiceDisplay ssd;
- int id;
- uint32_t debug;
- enum qxl_mode mode;
- int generation;
-
- /* temporary for development */
- uint32_t device_id;
-
- struct guest_slots {
- QXLMemSlot slot;
- uint32_t active;
- } guest_slots[NUM_MEMSLOTS];
-
- struct guest_primary {
- QXLSurfaceCreate surface;
- uint32_t resized, stride;
- uint32_t commands;
- uint8_t *data, *flipped;
- } guest_primary;
-
- /* thread signaling */
- pthread_t main;
- int pipe[2];
-
- /* ram pci bar */
- QXLRam *ram;
- VGACommonState vga;
- int num_free_res;
- QXLReleaseInfo *last_release;
-
- /* rom pci bar */
- QXLRom shadow_rom;
- QXLRom *rom;
- QXLModes *modes;
- uint32_t rom_size;
- uint64_t rom_offset;
-
- /* vram pci bar */
- uint32_t vram_size;
- uint64_t vram_offset;
-
- /* io bar */
- uint32_t io_base;
-
-} PCIQXLDevice;
-
#undef ALIGN
#define ALIGN(a, b) (((a) + ((b) - 1)) & ~((b) - 1))
@@ -159,14 +93,6 @@ static QXLMode qxl_modes[] = {
#endif
};
-#define dprintf(_qxl, _level, _fmt, ...) \
- do { \
- if (_qxl->debug >= _level) { \
- fprintf(stderr, "qxl-%d: ", _qxl->id); \
- fprintf(stderr, _fmt, ## __VA_ARGS__); \
- } \
- } while (0)
-
static int device_id = 0;
static PCIQXLDevice *qxl0;
@@ -212,7 +138,7 @@ static void init_qxl_rom(PCIQXLDevice *d)
rom->slot_id_bits = MEMSLOT_SLOT_BITS;
rom->slots_start = 1;
rom->slots_end = NUM_MEMSLOTS - 1;
- rom->n_surfaces = 10000;
+ rom->n_surfaces = NUM_SURFACES;
modes->n_modes = ARRAY_SIZE(qxl_modes);
for (i = 0; i < modes->n_modes; i++) {
@@ -308,7 +234,7 @@ static void interface_get_init_info(QXLInstance *sin, QXLDevInitInfo *info)
info->num_memslots_groups = NUM_MEMSLOTS_GROUPS;
info->internal_groupslot_id = 0;
info->qxl_ram_size = qxl->shadow_rom.num_pages << TARGET_PAGE_BITS;
- info->n_surfaces = 10000;
+ info->n_surfaces = NUM_SURFACES;
}
static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext)
@@ -317,6 +243,7 @@ static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext)
SimpleSpiceUpdate *update;
QXLCommandRing *ring;
QXLCommand *cmd;
+ uint32_t flags = 0;
int notify;
switch (qxl->mode) {
@@ -327,21 +254,27 @@ static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext)
return false;
}
*ext = update->ext;
+ qxl_log_command(qxl, "vga", ext);
return true;
+ case QXL_MODE_COMPAT:
+ flags = QXL_COMMAND_FLAG_COMPAT;
+ /* fall through */
case QXL_MODE_NATIVE:
- dprintf(qxl, 2, "%s: native\n", __FUNCTION__);
+ dprintf(qxl, 2, "%s: %s\n", __FUNCTION__, flags ? "compat" : "native");
ring = &qxl->ram->cmd_ring;
if (SPICE_RING_IS_EMPTY(ring)) {
return false;
}
SPICE_RING_CONS_ITEM(ring, cmd);
- ext->cmd = *cmd;
+ ext->cmd = *cmd;
ext->group_id = MEMSLOT_GROUP_GUEST;
+ ext->flags = flags;
SPICE_RING_POP(ring, notify);
if (notify) {
qxl_send_events(qxl, QXL_INTERRUPT_DISPLAY);
}
qxl->guest_primary.commands++;
+ qxl_log_command(qxl, "cmd", ext);
return true;
case QXL_MODE_UNDEFINED:
default:
@@ -354,8 +287,14 @@ static int interface_req_cmd_notification(QXLInstance *sin)
PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl);
int wait = 1;
- if (qxl->mode == QXL_MODE_NATIVE) {
+ switch (qxl->mode) {
+ case QXL_MODE_COMPAT:
+ case QXL_MODE_NATIVE:
SPICE_RING_CONS_WAIT(&qxl->ram->cmd_ring, wait);
+ break;
+ default:
+ /* nothing */
+ break;
}
return wait;
}
@@ -367,6 +306,7 @@ static int interface_has_command(QXLInstance *sin)
switch (qxl->mode) {
case QXL_MODE_VGA:
return qemu_spice_rect_is_empty(&qxl->ssd.dirty) ? false : true;
+ case QXL_MODE_COMPAT:
case QXL_MODE_NATIVE:
return SPICE_RING_IS_EMPTY(&qxl->ram->cmd_ring) ? false : true;
case QXL_MODE_UNDEFINED:
@@ -436,23 +376,30 @@ static int interface_get_cursor_command(QXLInstance *sin, struct QXLCommandExt *
PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl);
QXLCursorRing *ring;
QXLCommand *cmd;
+ uint32_t flags = 0;
int notify;
- if (qxl->mode == QXL_MODE_NATIVE) {
+ switch (qxl->mode) {
+ case QXL_MODE_COMPAT:
+ flags = QXL_COMMAND_FLAG_COMPAT;
+ /* fall through */
+ case QXL_MODE_NATIVE:
ring = &qxl->ram->cursor_ring;
if (SPICE_RING_IS_EMPTY(ring)) {
return false;
}
SPICE_RING_CONS_ITEM(ring, cmd);
- ext->cmd = *cmd;
+ ext->cmd = *cmd;
ext->group_id = MEMSLOT_GROUP_GUEST;
+ ext->flags = flags;
SPICE_RING_POP(ring, notify);
if (notify) {
qxl_send_events(qxl, QXL_INTERRUPT_CURSOR);
}
qxl->guest_primary.commands++;
+ qxl_log_command(qxl, "csr", ext);
return true;
- } else {
+ default:
return false;
}
}
@@ -462,8 +409,14 @@ static int interface_req_cursor_notification(QXLInstance *sin)
PCIQXLDevice *qxl = container_of(sin, PCIQXLDevice, ssd.qxl);
int wait = 1;
- if (qxl->mode == QXL_MODE_NATIVE) {
+ switch (qxl->mode) {
+ case QXL_MODE_COMPAT:
+ case QXL_MODE_NATIVE:
SPICE_RING_CONS_WAIT(&qxl->ram->cursor_ring, wait);
+ break;
+ default:
+ /* nothing */
+ break;
}
return wait;
}
@@ -711,6 +664,8 @@ static void qxl_add_memslot(PCIQXLDevice *d, uint32_t slot_id)
memslot.virt_start, memslot.virt_end);
d->ssd.worker->add_memslot(d->ssd.worker, &memslot);
+ d->guest_slots[slot_id].ptr = (void*)memslot.virt_start;
+ d->guest_slots[slot_id].size = memslot.virt_end - memslot.virt_start;
d->guest_slots[slot_id].active = 1;
}
@@ -718,6 +673,8 @@ static void qxl_del_memslot(PCIQXLDevice *d, uint32_t slot_id)
{
dprintf(d, 1, "%s: slot %d\n", __FUNCTION__, slot_id);
d->ssd.worker->del_memslot(d->ssd.worker, MEMSLOT_GROUP_HOST, slot_id);
+ d->guest_slots[slot_id].active = 0
+ ;
}
static void qxl_reset_memslots(PCIQXLDevice *d)
@@ -1028,6 +985,11 @@ static void qxl_native_update(PCIQXLDevice *qxl)
} else {
ptr = qxl->guest_primary.data;
}
+ fprintf(stderr, "%s: %dx%d, stride %d, flip %s\n", __FUNCTION__,
+ qxl->guest_primary.surface.width,
+ qxl->guest_primary.surface.height,
+ qxl->guest_primary.stride,
+ qxl->guest_primary.flipped ? "yes" : "no");
vga->ds->surface =
qemu_create_displaysurface_from(qxl->guest_primary.surface.width,
qxl->guest_primary.surface.height,
@@ -1416,6 +1378,7 @@ static PCIDeviceInfo qxl_info = {
DEFINE_PROP_UINT32("vram_size", PCIQXLDevice, vram_size, 64 * 1024 * 1024),
DEFINE_PROP_UINT32("device_id", PCIQXLDevice, device_id, 0),
DEFINE_PROP_UINT32("debug", PCIQXLDevice, debug, 1),
+ DEFINE_PROP_UINT32("log", PCIQXLDevice, log, 1),
DEFINE_PROP_END_OF_LIST(),
}
};
diff --git a/hw/qxl.h b/hw/qxl.h
new file mode 100644
index 0000000..3d9d0c1
--- /dev/null
+++ b/hw/qxl.h
@@ -0,0 +1,85 @@
+#include "console.h"
+#include "hw.h"
+#include "pci.h"
+#include "vga_int.h"
+
+#include "qemu-spice.h"
+#include "spice-display.h"
+
+enum qxl_mode {
+ QXL_MODE_UNDEFINED,
+ QXL_MODE_VGA,
+ QXL_MODE_COMPAT, /* spice 0.4.x */
+ QXL_MODE_NATIVE,
+};
+
+typedef struct PCIQXLDevice {
+ PCIDevice pci;
+ SimpleSpiceDisplay ssd;
+ int id;
+ uint32_t debug;
+ uint32_t log;
+ enum qxl_mode mode;
+ int generation;
+
+ /* temporary for development */
+ uint32_t device_id;
+
+ struct guest_slots {
+ QXLMemSlot slot;
+ void *ptr;
+ size_t size;
+ uint32_t active;
+ } guest_slots[NUM_MEMSLOTS];
+
+ struct guest_primary {
+ QXLSurfaceCreate surface;
+ uint32_t commands;
+ uint32_t resized;
+ int32_t stride;
+ uint8_t *data, *flipped;
+ } guest_primary;
+
+ uint32_t surface_count;
+
+ /* thread signaling */
+ pthread_t main;
+ int pipe[2];
+
+ /* ram pci bar */
+ QXLRam *ram;
+ VGACommonState vga;
+ int num_free_res;
+ QXLReleaseInfo *last_release;
+
+ /* rom pci bar */
+ QXLRom shadow_rom;
+ QXLRom *rom;
+ QXLModes *modes;
+ uint32_t rom_size;
+ uint64_t rom_offset;
+
+ /* vram pci bar */
+ uint32_t vram_size;
+ uint64_t vram_offset;
+
+ /* io bar */
+ uint32_t io_base;
+
+} PCIQXLDevice;
+
+#define PANIC_ON(x) if ((x)) { \
+ printf("%s: PANIC %s failed\n", __FUNCTION__, #x); \
+ exit(-1); \
+}
+
+#define dprintf(_qxl, _level, _fmt, ...) \
+ do { \
+ if (_qxl->debug >= _level) { \
+ fprintf(stderr, "qxl-%d: ", _qxl->id); \
+ fprintf(stderr, _fmt, ## __VA_ARGS__); \
+ } \
+ } while (0)
+
+/* qxl-logger.c */
+void qxl_log_command(PCIQXLDevice *qxl, const char *ring, QXLCommandExt *ext);
commit 392278e3e2a797c9b68a49483bde509f23daa295
Author: Gerd Hoffmann <kraxel at redhat.com>
Date: Wed Apr 28 13:06:09 2010 +0200
simple display: add NUM_SURFACES
diff --git a/spice-display.c b/spice-display.c
index fa1be11..3ec5801 100644
--- a/spice-display.c
+++ b/spice-display.c
@@ -268,7 +268,7 @@ static void interface_get_init_info(QXLInstance *sin, QXLDevInitInfo *info)
info->num_memslots_groups = NUM_MEMSLOTS_GROUPS;
info->internal_groupslot_id = 0;
info->qxl_ram_size = ssd->bufsize;
- info->n_surfaces = 10000;
+ info->n_surfaces = NUM_SURFACES;
}
static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext)
diff --git a/spice-display.h b/spice-display.h
index b76a4ab..a98f89f 100644
--- a/spice-display.h
+++ b/spice-display.h
@@ -10,6 +10,8 @@
#define MEMSLOT_GROUP_GUEST 1
#define NUM_MEMSLOTS_GROUPS 2
+#define NUM_SURFACES 256
+
typedef struct SimpleSpiceDisplay {
DisplayState *ds;
void *buf;
commit 63335100f35046565d906e64b3f1101085c1c206
Author: Gerd Hoffmann <kraxel at redhat.com>
Date: Wed Apr 28 00:09:06 2010 +0200
qxl: save/restore bits
diff --git a/hw/qxl.c b/hw/qxl.c
index 8d391f2..ac00d6d 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1265,6 +1265,7 @@ static int qxl_pre_load(void *opaque)
dprintf(d, 1, "%s: start\n", __FUNCTION__);
qxl_hard_reset(d);
+ qxl_exit_vga_mode(d);
dprintf(d, 1, "%s: done\n", __FUNCTION__);
#if 0
free_worker_data(d);
@@ -1284,12 +1285,16 @@ static int qxl_pre_load(void *opaque)
static int qxl_post_load(void *opaque, int version)
{
PCIQXLDevice* d = opaque;
- int i;
+ int i, newmode;
dprintf(d, 1, "%s: start\n", __FUNCTION__);
- switch (d->mode) {
+ newmode = d->mode;
+ d->mode = QXL_MODE_UNDEFINED;
+ switch (newmode) {
case QXL_MODE_UNDEFINED:
+ break;
case QXL_MODE_VGA:
+ qxl_enter_vga_mode(d);
break;
case QXL_MODE_NATIVE:
for (i = 0; i < NUM_MEMSLOTS; i++) {
More information about the Spice-commits
mailing list