Re: [Qemu-devel] Re: [PATCH] Fix display breakage when resizing the screen

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <avi@xxxxxxxxxx

This 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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux