From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46383) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMB6b-00079Y-DV for qemu-devel@nongnu.org; Thu, 21 Jan 2016 04:00:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMB6W-0003FG-41 for qemu-devel@nongnu.org; Thu, 21 Jan 2016 04:00:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45505) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMB6V-0003ES-M9 for qemu-devel@nongnu.org; Thu, 21 Jan 2016 04:00:32 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 2E727A2A12 for ; Thu, 21 Jan 2016 09:00:31 +0000 (UTC) Date: Thu, 21 Jan 2016 17:00:25 +0800 From: Fam Zheng Message-ID: <20160121090025.GA31470@ad.usersys.redhat.com> References: <1453110880.23289.7.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1453110880.23289.7.camel@redhat.com> 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: Gerd Hoffmann Cc: David Airlie , =?iso-8859-1?Q?Marc-Andr=E9?= Lureau , qemu-devel On Mon, 01/18 10:54, Gerd Hoffmann wrote: > Hi folks, > > I'm starting to investigate if and how we can move the user interface > code into its own thread instead of running it in the iothread and > therefore avoid blocking the guest in case some UI actions take a little > longer. > > opengl and toolkits tend to be bad at multithreading. So my idea is to > have a single thread dedicated to all the UI + rendering stuff, possibly > let even the virglrenderer run in ui thread context. > > I think we have to make that opt-in per user interface, so we can go > forward step by step. > > The ui thread will need quite some stuff provided by the mainloop. Wait > for all kinds of events (from vnc socket, x11 connection, ...). > Probably timers too. Wait for events from other threads (guest screen > updates). > > Suggestions how to tackle that? > Can I reuse the qemu mainloop code outside of the iothread? > Maybe it'll be better to go straight for a glib main loop? > Is it possible to wait for file handle events and posix condition > variables at the same time? > > Other notes / hints / suggestions / ideas? What are taking long time? Can you give a few examples? Fam