From 2e9773ed5586e93a739d52393a24880f706470d3 Mon Sep 17 00:00:00 2001 From: Zhao Yakui Date: Mon, 18 Apr 2022 10:28:26 +0800 Subject: [PATCH] ACRN:DM: Avoid calling surface_set in course of virtio_gpu_reset This is not needed as it is reconfigured in course of vga_thread_loop. At the same time it is not thread-safe as the 3D api is involved in vdpy_surface_set. v2->v3: move the initialization of vga_surface width/height into vga_thread. Tracked-On: #7296 Acked-by: Wang Yu1 Signed-off-by: Zhao Yakui --- devicemodel/hw/pci/virtio/virtio_gpu.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/devicemodel/hw/pci/virtio/virtio_gpu.c b/devicemodel/hw/pci/virtio/virtio_gpu.c index 8a9c98bec..aa3dd5ee6 100644 --- a/devicemodel/hw/pci/virtio/virtio_gpu.c +++ b/devicemodel/hw/pci/virtio/virtio_gpu.c @@ -463,9 +463,6 @@ virtio_gpu_reset(void *vdev) } LIST_INIT(&gpu->r2d_list); gpu->vga.enable = true; - vdpy_surface_set(gpu->vdpy_handle, &gpu->vga.surf); - gpu->vga.surf.width = 0; - gpu->vga.surf.stride = 0; pthread_mutex_lock(&gpu->vga_thread_mtx); if (atomic_load(&gpu->vga_thread_status) == VGA_THREAD_EOL) { atomic_store(&gpu->vga_thread_status, VGA_THREAD_RUNNING); @@ -1409,6 +1406,8 @@ virtio_gpu_vga_render(void *param) struct virtio_gpu *gpu; gpu = (struct virtio_gpu*)param; + gpu->vga.surf.width = 0; + gpu->vga.surf.stride = 0; /* The below logic needs to be refined */ while(gpu->vga.enable) { if(gpu->vga.gc->gc_image->vgamode) {