aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/display/qxl.c35
-rw-r--r--hw/display/qxl.h1
-rw-r--r--hw/display/virtio-gpu-gl.c27
-rw-r--r--hw/display/virtio-gpu-virgl.c8
-rw-r--r--hw/display/virtio-gpu.c26
-rw-r--r--include/hw/virtio/virtio-gpu.h1
-rw-r--r--softmmu/vl.c1
7 files changed, 37 insertions, 62 deletions
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 84f9908..43482d4 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -30,7 +30,6 @@
#include "qemu/module.h"
#include "hw/qdev-properties.h"
#include "sysemu/runstate.h"
-#include "migration/blocker.h"
#include "migration/vmstate.h"
#include "trace.h"
@@ -666,30 +665,6 @@ static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext)
qxl->guest_primary.commands++;
qxl_track_command(qxl, ext);
qxl_log_command(qxl, "cmd", ext);
- {
- /*
- * Windows 8 drivers place qxl commands in the vram
- * (instead of the ram) bar. We can't live migrate such a
- * guest, so add a migration blocker in case we detect
- * this, to avoid triggering the assert in pre_save().
- *
- * https://cgit.freedesktop.org/spice/win32/qxl-wddm-dod/commit/?id=f6e099db39e7d0787f294d5fd0dce328b5210faa
- */
- void *msg = qxl_phys2virt(qxl, ext->cmd.data, ext->group_id);
- if (msg != NULL && (
- msg < (void *)qxl->vga.vram_ptr ||
- msg > ((void *)qxl->vga.vram_ptr + qxl->vga.vram_size))) {
- if (!qxl->migration_blocker) {
- Error *local_err = NULL;
- error_setg(&qxl->migration_blocker,
- "qxl: guest bug: command not in ram bar");
- migrate_add_blocker(qxl->migration_blocker, &local_err);
- if (local_err) {
- error_report_err(local_err);
- }
- }
- }
- }
trace_qxl_ring_command_get(qxl->id, qxl_mode_to_string(qxl->mode));
return true;
default:
@@ -1283,12 +1258,6 @@ static void qxl_hard_reset(PCIQXLDevice *d, int loadvm)
qemu_spice_create_host_memslot(&d->ssd);
qxl_soft_reset(d);
- if (d->migration_blocker) {
- migrate_del_blocker(d->migration_blocker);
- error_free(d->migration_blocker);
- d->migration_blocker = NULL;
- }
-
if (startstop) {
qemu_spice_display_start();
}
@@ -2283,7 +2252,9 @@ static int qxl_pre_save(void *opaque)
} else {
d->last_release_offset = (uint8_t *)d->last_release - ram_start;
}
- assert(d->last_release_offset < d->vga.vram_size);
+ if (d->last_release_offset < d->vga.vram_size) {
+ return 1;
+ }
return 0;
}
diff --git a/hw/display/qxl.h b/hw/display/qxl.h
index 379d330..30d21f4 100644
--- a/hw/display/qxl.h
+++ b/hw/display/qxl.h
@@ -39,7 +39,6 @@ struct PCIQXLDevice {
uint32_t cmdlog;
uint32_t guest_bug;
- Error *migration_blocker;
enum qxl_mode mode;
uint32_t cmdflags;
diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c
index 7ab93bf..6cc4313 100644
--- a/hw/display/virtio-gpu-gl.c
+++ b/hw/display/virtio-gpu-gl.c
@@ -51,12 +51,7 @@ static void virtio_gpu_gl_update_cursor_data(VirtIOGPU *g,
static void virtio_gpu_gl_flushed(VirtIOGPUBase *b)
{
VirtIOGPU *g = VIRTIO_GPU(b);
- VirtIOGPUGL *gl = VIRTIO_GPU_GL(b);
- if (gl->renderer_reset) {
- gl->renderer_reset = false;
- virtio_gpu_virgl_reset(g);
- }
virtio_gpu_process_cmdq(g);
}
@@ -74,6 +69,10 @@ static void virtio_gpu_gl_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
virtio_gpu_virgl_init(g);
gl->renderer_inited = true;
}
+ if (gl->renderer_reset) {
+ gl->renderer_reset = false;
+ virtio_gpu_virgl_reset(g);
+ }
cmd = virtqueue_pop(vq, sizeof(struct virtio_gpu_ctrl_command));
while (cmd) {
@@ -95,12 +94,13 @@ static void virtio_gpu_gl_reset(VirtIODevice *vdev)
virtio_gpu_reset(vdev);
- if (gl->renderer_inited) {
- if (g->parent_obj.renderer_blocked) {
- gl->renderer_reset = true;
- } else {
- virtio_gpu_virgl_reset(g);
- }
+ /*
+ * GL functions must be called with the associated GL context in main
+ * thread, and when the renderer is unblocked.
+ */
+ if (gl->renderer_inited && !gl->renderer_reset) {
+ virtio_gpu_virgl_reset_scanout(g);
+ gl->renderer_reset = true;
}
}
@@ -113,6 +113,11 @@ static void virtio_gpu_gl_device_realize(DeviceState *qdev, Error **errp)
return;
#endif
+ if (!object_resolve_path_type("", TYPE_VIRTIO_GPU_GL, NULL)) {
+ error_setg(errp, "at most one %s device is permitted", TYPE_VIRTIO_GPU_GL);
+ return;
+ }
+
if (!display_opengl) {
error_setg(errp, "opengl is not available");
return;
diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c
index 092c6dc..18d0549 100644
--- a/hw/display/virtio-gpu-virgl.c
+++ b/hw/display/virtio-gpu-virgl.c
@@ -588,17 +588,21 @@ void virtio_gpu_virgl_fence_poll(VirtIOGPU *g)
virtio_gpu_fence_poll(g);
}
-void virtio_gpu_virgl_reset(VirtIOGPU *g)
+void virtio_gpu_virgl_reset_scanout(VirtIOGPU *g)
{
int i;
- virgl_renderer_reset();
for (i = 0; i < g->parent_obj.conf.max_outputs; i++) {
dpy_gfx_replace_surface(g->parent_obj.scanout[i].con, NULL);
dpy_gl_scanout_disable(g->parent_obj.scanout[i].con);
}
}
+void virtio_gpu_virgl_reset(VirtIOGPU *g)
+{
+ virgl_renderer_reset();
+}
+
int virtio_gpu_virgl_init(VirtIOGPU *g)
{
int ret;
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 6b7f643..990e71f 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -340,37 +340,31 @@ static void virtio_gpu_resource_create_blob(VirtIOGPU *g,
return;
}
- res = virtio_gpu_find_resource(g, cblob.resource_id);
- if (res) {
- qemu_log_mask(LOG_GUEST_ERROR, "%s: resource already exists %d\n",
- __func__, cblob.resource_id);
- cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID;
- return;
- }
-
- res = g_new0(struct virtio_gpu_simple_resource, 1);
- res->resource_id = cblob.resource_id;
- res->blob_size = cblob.size;
-
if (cblob.blob_mem != VIRTIO_GPU_BLOB_MEM_GUEST &&
cblob.blob_flags != VIRTIO_GPU_BLOB_FLAG_USE_SHAREABLE) {
qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid memory type\n",
__func__);
cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER;
- g_free(res);
return;
}
- if (res->iov) {
- cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
+ if (virtio_gpu_find_resource(g, cblob.resource_id)) {
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: resource already exists %d\n",
+ __func__, cblob.resource_id);
+ cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID;
return;
}
+ res = g_new0(struct virtio_gpu_simple_resource, 1);
+ res->resource_id = cblob.resource_id;
+ res->blob_size = cblob.size;
+
ret = virtio_gpu_create_mapping_iov(g, cblob.nr_entries, sizeof(cblob),
cmd, &res->addrs, &res->iov,
&res->iov_cnt);
- if (ret != 0) {
+ if (ret != 0 || res->iov) {
cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
+ g_free(res);
return;
}
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index bcf54d9..24c6628 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -279,6 +279,7 @@ int virtio_gpu_update_dmabuf(VirtIOGPU *g,
void virtio_gpu_virgl_process_cmd(VirtIOGPU *g,
struct virtio_gpu_ctrl_command *cmd);
void virtio_gpu_virgl_fence_poll(VirtIOGPU *g);
+void virtio_gpu_virgl_reset_scanout(VirtIOGPU *g);
void virtio_gpu_virgl_reset(VirtIOGPU *g);
int virtio_gpu_virgl_init(VirtIOGPU *g);
int virtio_gpu_virgl_get_num_capsets(VirtIOGPU *g);
diff --git a/softmmu/vl.c b/softmmu/vl.c
index f4d8630..f815acc 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -202,6 +202,7 @@ static struct {
{ .driver = "virtio-vga", .flag = &default_vga },
{ .driver = "ati-vga", .flag = &default_vga },
{ .driver = "vhost-user-vga", .flag = &default_vga },
+ { .driver = "virtio-vga-gl", .flag = &default_vga },
};
static QemuOptsList qemu_rtc_opts = {