On 21/01/2016 09:44, Dave Airlie wrote: > I've hacked on this before, but only with SDL and it was pretty dirty, > and it gave a fairly decent > speed up. > > My thoughts are to use dataplane like design to process the queue in a > separate thread, > and then have some sort of channel between the UI and virtio-gpu > thread to handle things like > screen resize etc. > > http://cgit.freedesktop.org/~airlied/qemu/commit/?h=dave3d&id=fe22a0955255afef12b947c4a91efa57e7a7c429 > is my previous horror patch.
Instead of having a full-blown thread, are there things (such as the TGSI->GLSL conversion) that could be simply offloaded to a userspace thread pool, either in QEMU or in virglrenderer? If you can do this in QEMU, as an alternative to writing code with callbacks we have coroutines based on a setjmp-longjmp and also a simple thread pool (thread-pool.c). If you want to allocate your own thread-pool, you can create an additional AioContext (aio_context_new) and add the AioContext to the glib main loop using aio_get_g_source. Paolo