On Tue, Nov 19, 2013 at 6:11 PM, Gerd Hoffmann <kra...@redhat.com> wrote: > Hi, > >> So I felt I had a choice here for sharing a single output surface >> amongst outputs: >> >> a) have multiple QemuConsole reference multiple DisplaySurface wihch >> reference a single pixman image, > > This one. > >> In either case we need to store, width/height of the console and x/y >> offset into the output surface somewhere, as the output dimensions >> will not correspond to surface dimensions or the surface dimensions >> won't correspond to the pixman image dimensions > > Not needed (well, internal to virtio-gpu probably).
I think you are only considering output here, for input we definitely need some idea of screen layout, and this needs to be stored somewhere. e.g. SDL2 gets an input event in the right hand window it needs to translate that into an input event on the whole output surface. Have a look the virtio-gpu branch in my repo (don't look at the history, its ugly, just the final state), you'll see code in sdl2.c to do input translation from window coordinates to the overall screen space. So we need at least the x,y offset in the ui code, and I think we need to communicate that via the console. Otherwise I think I've done things the way you've said and it seems to be working for me on a dual-head setup. (oh and yes this all sw rendering only, to do 3D rendering we need to put a thread in to do the GL stuff, but it interacts with the console layer quite a bit, since SDL and the virtio-gpu need to be in the same thread, so things like resize can work). Dave.