diff mbox series

virtio-gpu: Call Virgl only in the main thread

Message ID 20210617113520.25973-1-akihiko.odaki@gmail.com (mailing list archive)
State New, archived
Headers show
Series virtio-gpu: Call Virgl only in the main thread | expand

Commit Message

Akihiko Odaki June 17, 2021, 11:35 a.m. UTC
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.

Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
---
 hw/display/virtio-gpu-gl.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Gerd Hoffmann June 23, 2021, 12:47 p.m. UTC | #1
On Thu, Jun 17, 2021 at 08:35:20PM +0900, Akihiko Odaki wrote:
> 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.
> 
> Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>

Added to vga patch queue.

thanks,
  Gerd
diff mbox series

Patch

diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c
index d971b480806..57d6537120f 100644
--- a/hw/display/virtio-gpu-gl.c
+++ b/hw/display/virtio-gpu-gl.c
@@ -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;
     }
 }