virtio-gpu: pixman surface fix, block live migration

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJXC4A+AAoJEEy22O7T6HE46NsP/Rrs1u0e9ALf/JJ1pzZnyNYn
 Z6AUVtSS3fs9FVPHAGdrAu1ZMkFi4160BrJkBZIMm3PdfmsZBaCaXQaEn8e2XN7V
 exvb7L1t9l2zNbLqxTq9Z/Zp4frkPpQplRrMaqFYXosgVLJ/xhg5NgO1LYUA1UtR
 Z7TJIwMb+FmtOz0moj08O7ed5nN6fvApuLA/MZYZ9PSnixrqn+Hk2wOPC+knjKIw
 T+B9eb0+eZZQH3rokxRsxXIiGkwvUsOBzJuBJilhqRhNlc+xbHX+78ckbM8SBGVE
 0VI2POrBtHUpPn3HImPNancS1Ux6Wa7qXniOhbrLDQzf+p/faPYjKoIHQ3MBWh+7
 VBh/If3rutUp7otEtIErgjP35dbx8ObLlWtUoHcm727UESiUCCmstUfDPi6MGakV
 8MikfVDJLGQy+bw6xgFWVVlbjoPQ7O4MYDnC+ck7c4ej0r7nISaG1p2a61TH2J3h
 jGHfS1QZX3H5f6/yJP8N95WLSpBTL7CxjGX/SH5/RH05z0FQlO4U80uirC1Aj/+9
 jhKO6DEf9Gt4jxPzz8N7QPqYkqJ4DITPkMG6QAKixVUD+7h4UwoRfBNqPwSdeUOr
 hjBWYXiLX/5O3iS/Wug3UGEjkvzV+H/HxtF/7ZM4B9bcOkJX9EK8rAmpk/f+psz3
 9ythLAayh/4Sdjqbk8MX
 =4gXu
 -----END PGP SIGNATURE-----

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>
This commit is contained in:
Peter Maydell 2016-04-11 13:32:50 +01:00
commit 5144fe3605
4 changed files with 21 additions and 4 deletions

View File

@ -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)

View File

@ -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,

View File

@ -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 ]"

View File

@ -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)
{