From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KcjGJ-0008K1-89 for qemu-devel@nongnu.org; Mon, 08 Sep 2008 12:06:47 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KcjGI-0008J2-HS for qemu-devel@nongnu.org; Mon, 08 Sep 2008 12:06:46 -0400 Received: from [199.232.76.173] (port=58102 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KcjGI-0008If-0U for qemu-devel@nongnu.org; Mon, 08 Sep 2008 12:06:46 -0400 Received: from an-out-0708.google.com ([209.85.132.245]:8799) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KcjGH-00064w-KK for qemu-devel@nongnu.org; Mon, 08 Sep 2008 12:06:45 -0400 Received: by an-out-0708.google.com with SMTP id d18so261145and.130 for ; Mon, 08 Sep 2008 09:06:44 -0700 (PDT) Message-ID: <48C54D62.5060509@codemonkey.ws> Date: Mon, 08 Sep 2008 11:05:54 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] opengl rendering in the sdl window References: <48BFB318.206@eu.citrix.com> <20080905120214.GD1373@shareable.org> <48C16207.5090808@eu.citrix.com> <20080905165536.GA12606@redhat.com> <48C168CE.5040700@eu.citrix.com> <48C348D3.6070702@codemonkey.ws> <20080908134140.GF4947@shareable.org> <20080908134833.GQ2315@redhat.com> <48C53D24.8030803@redhat.com> <20080908150759.GB8465@shareable.org> <20080908154700.GT2315@redhat.com> In-Reply-To: <20080908154700.GT2315@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , qemu-devel@nongnu.org Daniel P. Berrange wrote: > On Mon, Sep 08, 2008 at 04:08:01PM +0100, Jamie Lokier wrote: > >> Gerd Hoffmann wrote: >> >>> Beside that I still think it would be a good idea to separate qemu and >>> the gui into two separate processes, so you can close the GUI window and >>> keep the VM running. It also solves the dependency issue for distros as >>> the gtk frontend with all the dependencies can just go into a separate >>> sub-package. >>> >> Extending VNC with a "shared memory" extension, similar to Xlib's >> MIT-SHM extension, and implementing it in QEMU and Gtk-VNC would be a >> nice way to do this. >> > > Funny you should mention that. Anthony had code todo exactly that against > for both QEMU and GTK-VNC a while back. We had it in the GTK-VNC for a > short while but removed it due to some race conditions in its impl, and > it interracted badly with our OpenGL impl. We could easily revisit this > idea if it were thought to be important / useful. > The difficulty is deleting the shared memory segment reliably. Normally, what you want to do is: shmget() shmat() shmctl(IPC_RMID) ... shmdt() And the first sequence has to be as reliable and quick as possible because if you exit before the shmctl(), you'll leak the shared memory. Unfortunately, you have to shmget() in the client and shmat() in the server and client, so that means: shmget() shmat() ... notify server of key wait for server to confirm shmat() ... shmctl(IPC_RMID) .. shmdt() Which leaves a huge window open where bad things can happen. The client can exit, the client can crash. This is particularly troublesome in a library because it's really not nice to try and register an atexit() handler or something like that from a library. It would be nice to come up with a solution to this. Regards, Anthony Liguori > Daniel >