From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vim7T-0003AQ-JU for qemu-devel@nongnu.org; Tue, 19 Nov 2013 09:17:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vim7N-0004TR-JH for qemu-devel@nongnu.org; Tue, 19 Nov 2013 09:17:35 -0500 Received: from maverick.spineless.org ([71.174.98.242]:54794 helo=spineless.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vim7N-0004TI-F9 for qemu-devel@nongnu.org; Tue, 19 Nov 2013 09:17:29 -0500 Message-ID: <528B72E8.6070307@spineless.org> Date: Tue, 19 Nov 2013 09:17:12 -0500 From: John Baboval MIME-Version: 1.0 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> In-Reply-To: <1384844223.16718.93.camel@nilsson.home.kraxel.org> Content-Type: text/plain; charset=UTF-8; format=flowed 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: Gerd Hoffmann Cc: qemu-devel@nongnu.org On 11/19/2013 1:57 AM, Gerd Hoffmann wrote: > Hi, > >> I think it would be better if the HwOps calls all took a QemuConsole >> instead of the opaque structure. The hw implementations can dig their >> opaque structure out from there. > QemuConsole is private to ui/console.c though (and I prefer to keep it > this way). So we need either a helper function to query con->hw or we > keep the opaque and pass QemuConsole as additional parameter. > > When going this route. > > Alternative approach: > > struct my_gfx_card_state { > PCIDevice pci; > [ ... ] > struct my_head_state { > QemuConsole *con; > [ ... ] > } heads[MAX_HEADS]; > } > > Then instead of > > graphic_console_init(..., &state); > > call > > 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. A third option would be to use the console index as a parameter to each HwOp. graphic_console_init and QemuConsole could remain unchanged, as could all the graphic_hw_*() helpers. If the HwOp needs the QemuConsole for any given operation, it could then use qemu_console_lookup_by_index(). Many operations would only need the index though. > cheers, > Gerd > > >