qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] virtio-gpu: Call Virgl only in the main thread
@ 2021-06-17 11:35 Akihiko Odaki
  2021-06-23 12:47 ` Gerd Hoffmann
  0 siblings, 1 reply; 2+ messages in thread
From: Akihiko Odaki @ 2021-06-17 11:35 UTC (permalink / raw)
  Cc: Michael S . Tsirkin, qemu-devel, Akihiko Odaki, Gerd Hoffmann

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(-)

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;
     }
 }
 
-- 
2.30.1 (Apple Git-130)



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] virtio-gpu: Call Virgl only in the main thread
  2021-06-17 11:35 [PATCH] virtio-gpu: Call Virgl only in the main thread Akihiko Odaki
@ 2021-06-23 12:47 ` Gerd Hoffmann
  0 siblings, 0 replies; 2+ messages in thread
From: Gerd Hoffmann @ 2021-06-23 12:47 UTC (permalink / raw)
  To: Akihiko Odaki; +Cc: qemu-devel, Michael S . Tsirkin

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-23 12:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-17 11:35 [PATCH] virtio-gpu: Call Virgl only in the main thread Akihiko Odaki
2021-06-23 12:47 ` Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).