From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36707) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VjS5q-0005LH-Gs for qemu-devel@nongnu.org; Thu, 21 Nov 2013 06:06:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VjS5k-0002IU-Gt for qemu-devel@nongnu.org; Thu, 21 Nov 2013 06:06:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51548) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VjS5k-0002Hs-7T for qemu-devel@nongnu.org; Thu, 21 Nov 2013 06:06:36 -0500 Message-ID: <1385031990.26155.14.camel@nilsson.home.kraxel.org> From: Gerd Hoffmann Date: Thu, 21 Nov 2013 12:06:30 +0100 In-Reply-To: References: <1384926761-9962-1-git-send-email-airlied@gmail.com> <1384926761-9962-8-git-send-email-airlied@gmail.com> <1384948961.2005.99.camel@nilsson.home.kraxel.org> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 7/8] virtio-vga: v1 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Dave Airlie Cc: "qemu-devel@nongnu.org" On Do, 2013-11-21 at 13:12 +1000, Dave Airlie wrote: > On Wed, Nov 20, 2013 at 10:02 PM, Gerd Hoffmann wrote: > > On Mi, 2013-11-20 at 15:52 +1000, Dave Airlie wrote: > >> From: Dave Airlie > >> > >> This is a virtio-vga device built on top of the virtio-gpu device. > > > > Ah, I see what you use the wrapping for. Hmm. I think you should use a > > common base class instead, i.e. something like virtio-gpu-base which > > holds all the common stuff. Both virtio-gpu and virtio-vga can use that > > as TypeInfo->parent then. This way virtio-vga doesn't have to muck with > > virtio-gpu internals. virtio-gpu-base can be tagged as abstract class > > (using .abstract = true) so it will not be instantiated directly. > > > > I'm not sure what that buys me here, I need the virtio-vga to attach > the vga ops the first console that the virtio-gpu registers, it can't > be a separate console, and since virtio-gpu initialises before > virtio-vga I can't tell it to not register the console. virtio-gpu-core registers no consoles. It just export the hw_ops functions. virtio-gpu-core inly initializes the stuff which is identical for both virtio-gpu and virtio-vga, everything else is left to the init functions of the subclasses. virtio-gpu uses virtio-gpu-core as parent. Registers the the consoles, using the hw_ops functions exported by virtio-gpu-core. Also sets the pci class to DISPLAY_OTHER. virtio-vga uses virtio-gpu-core as parent too. Registers the consoles, using functions basically doing "if vgamode then call vga hw_ops else call virtio-gpu-core hw_ops". Simliar to what you have today but without the funky wrapping. Sets pci class to DISPLAY_VGA and initializes vga stuff. cheers, Gerd