Hi, A while ago, Dave Airlie started implementing a seperate thread for virgl (although it didn't work for me and was very much in wip state). I fixed the code so I could test it, and moved it to use qemu iothread/aio loops, inspired by the dataplane code in the virtio block devices.
The benchmarks are quite encouraging, since I get from +-25% for xonotic up to +-100% for glmark. (fwiw, vhost-user-gpu had similar results too). Finally, I tried to make it acceptable for upstream. Note that I only manage to get the rendering thread working with spice/egl, for some reason the GL context creation fails with other backends (even with gtk/egl, perhaps because having context surfaces brings additional multi-threading limitations to opengl). I added a dpy_gl_ctx_is_mt_safe() check for that reason. Dave Airlie (2): virtio-gpu: start splitting scanout/resource flushing virtio-gpu: start introducing a lock around the display info Marc-André Lureau (16): console: skip same-size resize console: add dpy_gl_ctx_is_mt_safe virtio-gpu: add "iothread" property virtio-gpu: create a thread context gl: allow to keep current context in ctx-create gl: bind GL api before context creation bitmap: add a simple foreach util virtio-blk: use bitmap_foreach virtio-gpu: use a bh for cursor modifications virtio-gpu: save a pointer from virtio_gpu_ctrl_command virtio-gpu: add a virgl data-plane virtio-gpu: batch virtio_notify when using a data-plane virtio-gpu: dispatch to main thread for scanout & flush virtio-gpu: use virgl thread sync with the data-plane virtio-gpu: schedule a bh to unblock the data-plane virtio-gpu: start/stop the data-plane hw/block/dataplane/virtio-blk.c | 29 ++--- hw/display/virtio-gpu-3d.c | 252 ++++++++++++++++++++++++++++++++++---- hw/display/virtio-gpu-pci.c | 2 + hw/display/virtio-gpu.c | 261 ++++++++++++++++++++++++++++++++++++++-- hw/display/virtio-vga.c | 13 ++ ui/console.c | 22 +++- ui/egl-context.c | 27 +++-- ui/gtk-egl.c | 9 +- ui/gtk-gl-area.c | 3 +- ui/sdl2-gl.c | 7 +- ui/spice-display.c | 11 +- include/hw/virtio/virtio-gpu.h | 55 ++++++++- include/qemu/bitmap.h | 23 ++++ include/ui/console.h | 11 +- include/ui/gtk.h | 6 +- include/ui/sdl2.h | 3 +- 16 files changed, 652 insertions(+), 82 deletions(-) -- 2.9.0