From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35200) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vj2O2-0002Rh-Ej for qemu-devel@nongnu.org; Wed, 20 Nov 2013 02:39:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vj2Nw-0005FI-Ep for qemu-devel@nongnu.org; Wed, 20 Nov 2013 02:39:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:14344) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vj2Nw-0005FB-6p for qemu-devel@nongnu.org; Wed, 20 Nov 2013 02:39:40 -0500 Message-ID: <1384933175.2005.15.camel@nilsson.home.kraxel.org> From: Gerd Hoffmann Date: Wed, 20 Nov 2013 08:39:35 +0100 In-Reply-To: <528B72E8.6070307@spineless.org> References: <52795824.3090105@citrix.com> <1383735351.1739.57.camel@nilsson.home.kraxel.org> <527A62BD.2010401@spineless.org> <1383831984.3511.78.camel@nilsson.home.kraxel.org> <527BB7D2.6070503@spineless.org> <5286809B.1090000@spineless.org> <1384844223.16718.93.camel@nilsson.home.kraxel.org> <528B72E8.6070307@spineless.org> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Multi-head support RFC List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Baboval Cc: qemu-devel@nongnu.org > > graphic_console_init(..., &state->heads[i]); > > > > so you can figure the head in the callbacks. > > What I had prototyped (I got impatient) was to add a helper: > qemu_console_hw_opaque() to console.c so the HwOps could query the > opaque pointer. I don't like it because it requires an additional > function call at the top of frequently called operations... However I'm > not a huge fan of the head state array either, since it will require > either pointer duplication, or pointer acrobatics, or the same helper > function to get the card state. Yes, easiest way to get the device state struct from the head state struct is a pointer in each the head state (this is what you mean with pointer duplication, right?). I still think it is the best way. You get a direct pointer to your head state. Device state is only one pointer dereference away. Anything else requires extra effort to lookup the head state from whatever information (QemuConsole, index, ...) we pass to the hwops function. cheers, Gerd