|
From: | Avi Kivity |
Subject: | Re: [Qemu-devel] Re: [PATCH] Fix display breakage when resizing the screen |
Date: | Sun, 05 Apr 2009 18:28:34 +0300 |
User-agent: | Thunderbird 2.0.0.21 (X11/20090320) |
Anthony Liguori wrote:
Avi Kivity wrote:When the vga resolution changes, a new display surface is not allocated immediately; instead that is deferred until the next update. However, if we're running without a display client attached, that won't happen and the next bitblt is likely to cause a segfault by overflowing the display surface. Fix by reallocating the display immediately when the resolution changes. Tested with (Windows|Linux) x (cirrus|std) x (curses|sdl). Signed-off-by: Avi Kivity <address@hiddenThis patch breaks VC switching with -curses.
Can someone explain what DisplaySurface::width means when using curses? It is initialized to a pixel value:ds->surface = qemu_create_displaysurface_from(640, 400, 0, 0, (uint8_t*) screen);
then read in from the current surface: static void curses_resize(DisplayState *ds) { if (ds_get_width(ds) == gwidth && ds_get_height(ds) == gheight) return; gwidth = ds_get_width(ds); gheight = ds_get_height(ds); curses_calc_pad(); ds->surface->width = width * FONT_WIDTH; ds->surface->height = height * FONT_HEIGHT; } But curses_calc_pad() does static void curses_calc_pad(void) { if (is_fixedsize_console()) { width = gwidth; height = gheight; } else { width = COLS; height = LINES; }If !is_fixedsize_console(), then the global width takes on a character cell count, later multiplied by FONT_WIDTH to become a pixel value again. But if is_fixedsize_console() is true (which happens to be the case here), then the global width is a pixel value (from gwidth), and when multiplied by FONT_WIDTH it becomes nonsense. Repeated calls to curses_resize() will inflate the value to hell.
-- error compiling committee.c: too many arguments to function
[Prev in Thread] | Current Thread | [Next in Thread] |