]> git.proxmox.com Git - mirror_qemu.git/commit
virtio-gpu: reset gfx resources in main thread
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Wed, 26 Jul 2023 17:39:29 +0000 (21:39 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Mon, 7 Aug 2023 11:45:45 +0000 (15:45 +0400)
commita41e2d97f92b48552988b3cc62dce79d62f60dcc
tree1a9b54c79abad481060447a51c5a2f8d9bf2eddd
parent957d77863e4564454eb97f8f371096843daf4678
virtio-gpu: reset gfx resources in main thread

Calling OpenGL from different threads can have bad consequences if not
carefully reviewed. It's not generally supported. In my case, I was
debugging a crash in glDeleteTextures from OPENGL32.DLL, where I asked
qemu for gl=es, and thus ANGLE implementation was expected. libepoxy did
resolution of the global pointer for glGenTexture to the GLES version
from the main thread. But it resolved glDeleteTextures to the GL
version, because it was done from a different thread without correct
context. Oops.

Let's stick to the main thread for GL calls by using a BH.

Note: I didn't use atomics for reset_finished check, assuming the BQL
will provide enough of sync, but I might be wrong.

Acked-by: Dongwon Kim <dongwon.kim@intel.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20230726173929.690601-3-marcandre.lureau@redhat.com>
hw/display/virtio-gpu.c
include/hw/virtio/virtio-gpu.h