From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47230) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMBBj-0002Wx-KL for qemu-devel@nongnu.org; Thu, 21 Jan 2016 04:05:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMBBd-0004Fq-Vo for qemu-devel@nongnu.org; Thu, 21 Jan 2016 04:05:55 -0500 Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]:37509) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMBBd-0004Fk-PM for qemu-devel@nongnu.org; Thu, 21 Jan 2016 04:05:49 -0500 Received: by mail-wm0-x22f.google.com with SMTP id n5so69310982wmn.0 for ; Thu, 21 Jan 2016 01:05:49 -0800 (PST) Sender: Paolo Bonzini References: <1453110880.23289.7.camel@redhat.com> From: Paolo Bonzini Message-ID: <56A09F6A.2030609@redhat.com> Date: Thu, 21 Jan 2016 10:05:46 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] RFC: running the user interface in a thread ... List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Dave Airlie , Gerd Hoffmann Cc: David Airlie , =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , qemu-devel 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