|
From: | John Baboval |
Subject: | Re: [Qemu-devel] Multi-head support RFC |
Date: | Tue, 19 Nov 2013 09:17:12 -0500 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |