virtio-gpu: fix blob scanout post-load
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.
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 | 61 ++++++++++++++++++++++++---------- 2 files changed, 45 insertions(+), 17 deletions(-)
Signature · 1 line
2.43.0
PATCH 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 | 4 ---- 1 file changed, 4 deletions(-)
hw/display/virtio-gpu.c +0 -4
@@ -679,10 +679,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
Signature · 1 line
2.43.0
PATCH 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 | 57 ++++++++++++++++++++++++++-------- 2 files changed, 45 insertions(+), 13 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 +44 -13
127 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH 2/2] virtio-gpu: fix scanout migration post-load
hw/display/virtio-gpu.c static int virtio_gpu_post_load(void *opaque, int version_id) · line 1449
Quoted 4 lines · On Mon, 15 Jan 2024, [email protected] wrote:
hw/display/virtio-gpu.c +4
-0+ scanout->ds =qemu_create_displaysurface_pixman (res->image); +if (!scanout->ds) { +return -EINVAL ; + }
"qemu_create_displaysurface_pixman() never returns NULL." ;-)
Re: [PATCH 2/2] virtio-gpu: fix scanout migration post-load
Hi
Quoted 8 lines · Sebastian Ott
hw/display/virtio-gpu.c static int virtio_gpu_post_load(void *opaque, int version_id) · line 1449
Quoted 4 lines · On Mon, 15 Jan 2024, [email protected] wrote:
hw/display/virtio-gpu.c +4
-0+ scanout->ds =qemu_create_displaysurface_pixman (res->image); +if (!scanout->ds) { +return -EINVAL ; + }"
qemu_create_displaysurface_pixman()never returns NULL." ;-)
Right, I'll update the first patch.
Other comments about this patch?
thanks
Signature · 1 line
Marc-André Lureau
Sebastian Ott
Reviewed-byRe: [PATCH 2/2] virtio-gpu: fix scanout migration post-load
Quoted 7 lines · Marc-André Lureau
Quoted 6 lines · Sebastian Ott
Quoted 4 lines · On Mon, 15 Jan 2024, [email protected] wrote:
hw/display/virtio-gpu.c +4
-0+ scanout->ds =qemu_create_displaysurface_pixman (res->image); +if (!scanout->ds) { +return -EINVAL ; + }
Quoted 5 lines
Quoted 1 line
"
qemu_create_displaysurface_pixman()never returns NULL." ;-)Right, I'll update the first patch.
Other comments about this patch?
Nope, looks good to me.