virtio-gpu: fix blob scanout post-load
v2 cover virtio-gpu: fix blob scanout post-load
From: Marc-André Lureau <[email protected]>
Hi,
The current post-loading code for scanout has a FIXME: it doesn't take the resource region/rect into account. But there is more, when adding blob migration support in commit f66767f75c9, I didn't realize that blob resources could be used for scanouts. This situationn leads to a crash during post-load, as they don't have an associated res->image.
virtio_gpu_do_set_scanout() handle all cases, but requires the associated virtio_gpu_framebuffer, which is currently not saved during migration.
Add a v2 of "virtio-gpu-one-scanout" with the framebuffer fields, so we can restore blob scanouts, as well as fixing the existing FIXME.
v2:
- modify first patch to get rid of another needless check (Sebastian Ott)
Marc-André Lureau (2):
virtio-gpu: remove needless condition
virtio-gpu: fix scanout migration post-load
include/hw/virtio/virtio-gpu.h | 1 + hw/display/virtio-gpu.c | 58 ++++++++++++++++++++++++---------- 2 files changed, 42 insertions(+), 17 deletions(-)
Signature · 1 line
2.43.2
PATCH v2 1/2 virtio-gpu: remove needless condition
From: Marc-André Lureau <[email protected]>
qemu_create_displaysurface_pixman() never returns NULL.
--- hw/display/virtio-gpu.c | 7 ------- 1 file changed, 7 deletions(-)
hw/display/virtio-gpu.c +0 -7
@@ -684,10 +684,6 @@ static void virtio_gpu_do_set_scanout(VirtIOGPU *g,/* realloc the surface ptr */ scanout->ds =qemu_create_displaysurface_pixman (rect); -if (!scanout->ds) { - *error =VIRTIO_GPU_RESP_ERR_UNSPEC ; -return ; - }#ifdef WIN32 qemu_displaysurface_win32_set_handle (scanout->ds, res->handle, fb->offset);#endif
@@ -1423,9 +1419,6 @@ static int virtio_gpu_post_load(void *opaque, int version_id)return -EINVAL ; } scanout->ds =qemu_create_displaysurface_pixman (res->image); -if (!scanout->ds) { -return -EINVAL ; - }#ifdef WIN32 qemu_displaysurface_win32_set_handle (scanout->ds, res->handle,0 );#endif
Signature · 1 line
2.43.2
PATCH v2 2/2 virtio-gpu: fix scanout migration post-load
In reply to [email protected]From: Marc-André Lureau <[email protected]>
The current post-loading code for scanout has a FIXME: it doesn't take the resource region/rect into account. But there is more, when adding blob migration support in commit f66767f75c9, I didn't realize that blob resources could be used for scanouts. This situationn leads to a crash during post-load, as they don't have an associated res->image.
virtio_gpu_do_set_scanout() handle all cases, but requires the associated virtio_gpu_framebuffer, which is currently not saved during migration.
Add a v2 of "virtio-gpu-one-scanout" with the framebuffer fields, so we can restore blob scanouts, as well as fixing the existing FIXME.
--- include/hw/virtio/virtio-gpu.h | 1 + hw/display/virtio-gpu.c | 51 +++++++++++++++++++++++++++------- 2 files changed, 42 insertions(+), 10 deletions(-)
include/hw/virtio/virtio-gpu.h +1 -0
@@ -81,6 +81,7 @@ struct virtio_gpu_scanout {uint32_t resource_id;struct virtio_gpu_update_cursor cursor;QEMUCursor *current_cursor; +struct virtio_gpu_framebuffer fb; };struct virtio_gpu_requested_state {
hw/display/virtio-gpu.c +41 -10
121 lines not on this page · raw message
Signature · 1 line
2.43.2