From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LAnMm-0008Ln-8M for qemu-devel@nongnu.org; Thu, 11 Dec 2008 10:22:16 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LAnMk-0008Jl-Mg for qemu-devel@nongnu.org; Thu, 11 Dec 2008 10:22:15 -0500 Received: from [199.232.76.173] (port=36691 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LAnMk-0008Jf-E0 for qemu-devel@nongnu.org; Thu, 11 Dec 2008 10:22:14 -0500 Received: from smtp.eu.citrix.com ([62.200.22.115]:55511) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LAnMk-0000S1-2p for qemu-devel@nongnu.org; Thu, 11 Dec 2008 10:22:14 -0500 Message-ID: <49413024.5020106@eu.citrix.com> Date: Thu, 11 Dec 2008 15:22:12 +0000 From: Stefano Stabellini MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 0 of 7] [UPDATE] DisplayState interface change References: <492D8B94.4000805@eu.citrix.com> <49358E1A.9000001@codemonkey.ws> <4940FFBF.1060308@eu.citrix.com> <200812111239.41509.paul@codesourcery.com> In-Reply-To: <200812111239.41509.paul@codesourcery.com> Content-Type: text/plain; charset=UTF-8 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: Paul Brook Cc: qemu-devel@nongnu.org Paul Brook wrote: >> void qemu_console_resize(DisplayState *ds, int width, int height, int bpp, >> int linesize, uint8_t *data) >> { >> TextConsole *s = get_graphic_console(); >> s->g_width = width; >> s->g_height = height; >> if (is_graphic_console()) { >> if (data && (bpp == 16 || bpp == 32)) { >> qemu_freeDisplaySurface(ds->surface); >> ds->surface = qemu_createDisplaySurfaceFrom(width, height, bpp, >> linesize, data); } else { >> ds->surface = qemu_resizeDisplaySurface(ds->surface, width, >> height, 32, 4 * width); } >> dpy_resize(ds); >> } >> } > > It feels wrong to be modifying the surface here. We already have to recreate > the surface when we switch consoles, so why can't we use the same code for a > resize? We use mostly the same code already. The following are the implementations of console_select and qemu_console_resize in the last patch series I sent: void console_select(unsigned int index) { TextConsole *s; if (index >= MAX_CONSOLES) return; active_console->g_width = ds_get_width(active_console->ds); active_console->g_height = ds_get_height(active_console->ds); s = consoles[index]; if (s) { DisplayState *ds = s->ds; active_console = s; ds->surface = qemu_resizeDisplaySurface(ds->surface, s->g_width, s->g_height, 32, 4 * s->g_width); dpy_resize(s->ds); vga_hw_invalidate(); } } void qemu_console_resize(QEMUConsole *console, int width, int height) { console->g_width = width; console->g_height = height; if (active_console == console) { DisplayState *ds = console->ds; ds->surface = qemu_resizeDisplaySurface(ds->surface, width, height, 32, 4 * width); dpy_resize(console->ds); } } as you can see they both call qemu_resizeDisplaySurface and dpy_resize. I was just saying that we could change qemu_console_resize to: void qemu_console_resize(DisplayState *ds, int width, int height, int bpp, int linesize, uint8_t *data) in order to move the "artifact" away from vga.c, I am not sure if this is desiderable.