Skip to contentSkip to conversation

virtio-gpu: Call Virgl only in the main thread

PATCH In review Akihiko Odaki 2 participants 2 messages Jun 17, 2021 – Jun 23, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-gpu: Call Virgl only in the main thread

Virgl relies on callbacks provided by the OpenGL display, and such a display may rely on eglMakeCurrent. eglMakeCurrent will fail if the given context is current to some other thread. The easiest way to avoid such a failure is to call the OpenGL display in a single thread. As all operations except virtio_gpu_virgl_reset happens in the main thread, this change makes virtio_gpu_virgl_reset happen only in the main thread.

---
 hw/display/virtio-gpu-gl.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
hw/display/virtio-gpu-gl.c +1 -6
index d971b480806..57d6537120f 100644
@@ -90,17 +90,12 @@ static void virtio_gpu_gl_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
 
 static void virtio_gpu_gl_reset(VirtIODevice *vdev)
 {
-    VirtIOGPU *g = VIRTIO_GPU(vdev);
     VirtIOGPUGL *gl = VIRTIO_GPU_GL(vdev);
 
     virtio_gpu_reset(vdev);
 
     if (gl->renderer_inited) {
-        if (g->parent_obj.renderer_blocked) {
-            gl->renderer_reset = true;
-        } else {
-            virtio_gpu_virgl_reset(g);
-        }
+        gl->renderer_reset = true;
     }
 }
 
Signature · 1 line
2.30.1 (Apple Git-130)
#1 lore raw
Quoted 8 lines · Akihiko Odaki

Virgl relies on callbacks provided by the OpenGL display, and such a display may rely on eglMakeCurrent. eglMakeCurrent will fail if the given context is current to some other thread. The easiest way to avoid such a failure is to call the OpenGL display in a single thread. As all operations except virtio_gpu_virgl_reset happens in the main thread, this change makes virtio_gpu_virgl_reset happen only in the main thread.

Added to vga patch queue.

thanks,
Gerd