From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L25E7-00008y-2r for qemu-devel@nongnu.org; Mon, 17 Nov 2008 09:37:19 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L25E3-00008m-KH for qemu-devel@nongnu.org; Mon, 17 Nov 2008 09:37:18 -0500 Received: from [199.232.76.173] (port=52525 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L25E3-00008j-Fn for qemu-devel@nongnu.org; Mon, 17 Nov 2008 09:37:15 -0500 Received: from yw-out-1718.google.com ([74.125.46.153]:59243) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L25E3-0007Se-3c for qemu-devel@nongnu.org; Mon, 17 Nov 2008 09:37:15 -0500 Received: by yw-out-1718.google.com with SMTP id 6so978535ywa.82 for ; Mon, 17 Nov 2008 06:37:13 -0800 (PST) Message-ID: <49218195.8080005@codemonkey.ws> Date: Mon, 17 Nov 2008 08:37:09 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] DisplayState interface change References: <49216748.2000109@eu.citrix.com> In-Reply-To: <49216748.2000109@eu.citrix.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Stefano Stabellini wrote: > diff -r 5c78dd111aae console.h > --- a/console.h Tue Nov 04 09:04:41 2008 +0000 > +++ b/console.h Mon Nov 17 12:15:40 2008 +0000 > @@ -73,45 +73,111 @@ > > /* consoles */ > > -struct DisplayState { > - uint8_t *data; > - int linesize; > - int depth; > - int bgr; /* BGR color order instead of RGB. Only valid for depth == 32 */ > - int width; > - int height; > - void *opaque; > - struct QEMUTimer *gui_timer; > +struct DisplayChangeListener { > + int idle; > uint64_t gui_timer_interval; > - int idle; /* there is nothing to update (window invisible), set by vnc/sdl */ > > void (*dpy_update)(struct DisplayState *s, int x, int y, int w, int h); > - void (*dpy_resize)(struct DisplayState *s, int w, int h); > + void (*dpy_resize)(struct DisplayState *s); > + void (*dpy_setdata)(struct DisplayState *s); > void (*dpy_refresh)(struct DisplayState *s); > void (*dpy_copy)(struct DisplayState *s, int src_x, int src_y, > int dst_x, int dst_y, int w, int h); > void (*dpy_fill)(struct DisplayState *s, int x, int y, > int w, int h, uint32_t c); > void (*dpy_text_cursor)(struct DisplayState *s, int x, int y); > + > + struct DisplayChangeListener *next; > +}; > + > +struct DisplayState { > + uint8_t *data; > + int shared_buf; > + int linesize; > + int depth; > + int width; > + int height; > + void *opaque; > + struct QEMUTimer *gui_timer; > + > + struct DisplayChangeListener* listeners; > + > void (*mouse_set)(int x, int y, int on); > void (*cursor_define)(int width, int height, int bpp, int hot_x, int hot_y, > uint8_t *image, uint8_t *mask); > + > + void (*data_resize)(struct DisplayState *s); > } If we're going to change DisplayState, and I think it's long over due that we do, then I think we should try to make sure we get it right. What I would like to see is the buffer information extracted into a separate structure. That buffer should also describe the pixel format in a much more thorough way. There should be, in the very least, an endianness flag, information about the per-color shift and per-color mask, the bits per pixel, the bytes per pixel, the width and the height. We should also have generic conversion functions to convert from one buffer to another. This would allow us to simplify a lot of things (like screen shot). It also ties in better to other display tool kits. Right now we have too many assumptions about what the pixel layout is from the depth. The other thing to consider is that we do need some level of bidirectional communication. vmware VGA supports the ability to tell the guest what resolution/depth it ought to be using. You really want to get that information from SDL (at least the depth bits) so that we can avoid blitting. With KVM, we can pretty trivially directly map the SDL buffer directly into the guest's physical memory provided it uses the right format. Regards, Anthony Liguori