aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-04-11 13:32:50 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-04-11 13:32:50 +0100
commit5144fe36056d3a94b0d8da9e10adc555c057baa8 (patch)
tree67d28d4c9b422b89d080ca5bbbf8c10393528675
parent9628af036fade986dcc94f4484bc75c6b1a06d84 (diff)
parentfa49e4656a641af84e4cdf40c8d12dacb25dc0aa (diff)
Merge remote-tracking branch 'remotes/kraxel/tags/pull-vga-20160411-1' into staging
virtio-gpu: pixman surface fix, block live migration # gpg: Signature made Mon 11 Apr 2016 11:45:18 BST using RSA key ID D3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" * remotes/kraxel/tags/pull-vga-20160411-1: virtio-gpu: block live migration ui/virtio-gpu: add and use qemu_create_displaysurface_pixman Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/display/virtio-gpu.c12
-rw-r--r--include/ui/console.h1
-rw-r--r--trace-events1
-rw-r--r--ui/console.c11
4 files changed, 21 insertions, 4 deletions
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index ddf3bfbef4..c181fb364c 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -572,10 +572,7 @@ static void virtio_gpu_set_scanout(VirtIOGPU *g,
scanout->width != ss.r.width ||
scanout->height != ss.r.height) {
/* realloc the surface ptr */
- scanout->ds = qemu_create_displaysurface_from
- (ss.r.width, ss.r.height, format,
- pixman_image_get_stride(res->image),
- (uint8_t *)pixman_image_get_data(res->image) + offset);
+ scanout->ds = qemu_create_displaysurface_pixman(res->image);
if (!scanout->ds) {
cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
return;
@@ -920,6 +917,11 @@ const GraphicHwOps virtio_gpu_ops = {
.gl_block = virtio_gpu_gl_block,
};
+static const VMStateDescription vmstate_virtio_gpu_unmigratable = {
+ .name = "virtio-gpu",
+ .unmigratable = 1,
+};
+
static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
{
VirtIODevice *vdev = VIRTIO_DEVICE(qdev);
@@ -971,6 +973,8 @@ static void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
dpy_gfx_replace_surface(g->scanout[i].con, NULL);
}
}
+
+ vmstate_register(qdev, -1, &vmstate_virtio_gpu_unmigratable, g);
}
static void virtio_gpu_instance_init(Object *obj)
diff --git a/include/ui/console.h b/include/ui/console.h
index eb9419dfd6..d5a88d93e8 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -234,6 +234,7 @@ DisplayState *init_displaystate(void);
DisplaySurface *qemu_create_displaysurface_from(int width, int height,
pixman_format_code_t format,
int linesize, uint8_t *data);
+DisplaySurface *qemu_create_displaysurface_pixman(pixman_image_t *image);
DisplaySurface *qemu_create_displaysurface_guestmem(int width, int height,
pixman_format_code_t format,
int linesize,
diff --git a/trace-events b/trace-events
index 996a77f013..8350743878 100644
--- a/trace-events
+++ b/trace-events
@@ -1161,6 +1161,7 @@ console_select(int nr) "%d"
console_refresh(int interval) "interval %d ms"
displaysurface_create(void *display_surface, int w, int h) "surface=%p, %dx%d"
displaysurface_create_from(void *display_surface, int w, int h, uint32_t format) "surface=%p, %dx%d, format 0x%x"
+displaysurface_create_pixman(void *display_surface) "surface=%p"
displaysurface_free(void *display_surface) "surface=%p"
displaychangelistener_register(void *dcl, const char *name) "%p [ %s ]"
displaychangelistener_unregister(void *dcl, const char *name) "%p [ %s ]"
diff --git a/ui/console.c b/ui/console.c
index 1fd4ea4d2e..bf385790b5 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1292,6 +1292,17 @@ DisplaySurface *qemu_create_displaysurface_from(int width, int height,
return surface;
}
+DisplaySurface *qemu_create_displaysurface_pixman(pixman_image_t *image)
+{
+ DisplaySurface *surface = g_new0(DisplaySurface, 1);
+
+ trace_displaysurface_create_pixman(surface);
+ surface->format = pixman_image_get_format(image);
+ surface->image = pixman_image_ref(image);
+
+ return surface;
+}
+
static void qemu_unmap_displaysurface_guestmem(pixman_image_t *image,
void *unused)
{