From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LNu8e-0002Zv-DB for qemu-devel@nongnu.org; Fri, 16 Jan 2009 14:13:52 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LNu8d-0002ZU-Ik for qemu-devel@nongnu.org; Fri, 16 Jan 2009 14:13:51 -0500 Received: from [199.232.76.173] (port=35876 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LNu8d-0002ZO-C3 for qemu-devel@nongnu.org; Fri, 16 Jan 2009 14:13:51 -0500 Received: from hall.aurel32.net ([88.191.82.174]:35976) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LNu8c-00006A-KD for qemu-devel@nongnu.org; Fri, 16 Jan 2009 14:13:51 -0500 Received: from volta.aurel32.net ([2002:52e8:2fb:1:21e:8cff:feb0:693b]) by hall.aurel32.net with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1LNu8X-0001nz-C8 for qemu-devel@nongnu.org; Fri, 16 Jan 2009 20:13:45 +0100 Received: from aurel32 by volta.aurel32.net with local (Exim 4.69) (envelope-from ) id 1LNu8V-00021G-9I for qemu-devel@nongnu.org; Fri, 16 Jan 2009 20:13:43 +0100 Date: Fri, 16 Jan 2009 20:13:43 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] [6336] DisplayState interface change (StefanoStabellini) Message-ID: <20090116191343.GC15397@volta.aurel32.net> References: <20751876.567371232104405516.JavaMail.servlet@kundenserver> <497084BA.6080406@eu.citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <497084BA.6080406@eu.citrix.com> 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 On Fri, Jan 16, 2009 at 12:59:38PM +0000, Stefano Stabellini wrote: > laurent@lvivier.info wrote: > > >> Revision: 6336 > >> http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6336 > >> Author: aliguori > >> Date: 2009-01-15 22:14:11 +0000 (Thu, 15 Jan 2009) > >> > >> Log Message: > >> ----------- > >> DisplayState interface change (Stefano Stabellini) > > > > This patch breaks qemu-system-ppc: > > > > in update_palette256(), s->rgb_to_pixel() is used unitialized. > > > > update_palette256() is called by vga_draw_graphic() whereas s->rgb_to_pixel() is initialized later in the function. > > > > This patch correct the problem. > > > > > > > > Thanks for pointing this out so quickly and for the fix! > Another possible fix is to move update_palette256() after calling > qemu_console_resize/qemu_create_displaysurface_from. > > Even if I couldn't actually reproduce any bug triggered by a color depth change on > i386-softmmu, I think this second option is better because makes more > obvious the fact that a change in DisplayState color depth affects both > rgb_to_pixel and vga_draw_line functions. > > Does it also fix your problem? This patch does not apply. It looks like it is not done against the current SVN. Doing the move by hand (see the patch below) fixes the problem. I don't know which patch is the best one though. diff --git a/hw/vga.c b/hw/vga.c index f2d98b0..21af3ce 100644 --- a/hw/vga.c +++ b/hw/vga.c @@ -1618,6 +1618,41 @@ static void vga_draw_graphic(VGAState *s, int full_update) s->double_scan = double_scan; } + depth = s->get_bpp(s); + if (s->line_offset != s->last_line_offset || + disp_width != s->last_width || + height != s->last_height || + s->last_depth != depth) { + if (depth == 16 || depth == 32) { + if (is_graphic_console()) { + qemu_free_displaysurface(s->ds->surface); + s->ds->surface = qemu_create_displaysurface_from(disp_width, height, depth, + s->line_offset, + s->vram_ptr + (s->start_addr * 4)); + dpy_resize(s->ds); + } else { + qemu_console_resize(s->console, disp_width, height); + } + } else { + qemu_console_resize(s->console, disp_width, height); + } + s->last_scr_width = disp_width; + s->last_scr_height = height; + s->last_width = disp_width; + s->last_height = height; + s->last_line_offset = s->line_offset; + s->last_depth = depth; + full_update = 1; + } else if (is_graphic_console() && is_buffer_shared(s->ds->surface) && + (full_update || s->ds->surface->data != s->vram_ptr + (s->start_addr * 4))) { + s->ds->surface->data = s->vram_ptr + (s->start_addr * 4); + dpy_setdata(s->ds); + } + + s->rgb_to_pixel = + rgb_to_pixel_dup_table[get_depth_index(s->ds)]; + + if (shift_control == 0) { full_update |= update_palette16(s); if (s->sr[0x01] & 8) { @@ -1669,40 +1704,6 @@ static void vga_draw_graphic(VGAState *s, int full_update) } vga_draw_line = vga_draw_line_table[v * NB_DEPTHS + get_depth_index(s->ds)]; - depth = s->get_bpp(s); - if (s->line_offset != s->last_line_offset || - disp_width != s->last_width || - height != s->last_height || - s->last_depth != depth) { - if (depth == 16 || depth == 32) { - if (is_graphic_console()) { - qemu_free_displaysurface(s->ds->surface); - s->ds->surface = qemu_create_displaysurface_from(disp_width, height, depth, - s->line_offset, - s->vram_ptr + (s->start_addr * 4)); - dpy_resize(s->ds); - } else { - qemu_console_resize(s->console, disp_width, height); - } - } else { - qemu_console_resize(s->console, disp_width, height); - } - s->last_scr_width = disp_width; - s->last_scr_height = height; - s->last_width = disp_width; - s->last_height = height; - s->last_line_offset = s->line_offset; - s->last_depth = depth; - full_update = 1; - } else if (is_graphic_console() && is_buffer_shared(s->ds->surface) && - (full_update || s->ds->surface->data != s->vram_ptr + (s->start_addr * 4))) { - s->ds->surface->data = s->vram_ptr + (s->start_addr * 4); - dpy_setdata(s->ds); - } - - s->rgb_to_pixel = - rgb_to_pixel_dup_table[get_depth_index(s->ds)]; - if (!is_buffer_shared(s->ds->surface) && s->cursor_invalidate) s->cursor_invalidate(s); -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net