From: Avi Kivity <avi@redhat.com>
To: qemu-devel@nongnu.org
Cc: kvm@vger.kernel.org
Subject: Re: [Qemu-devel] Re: [PATCH] Fix display breakage when resizing the screen
Date: Sun, 05 Apr 2009 18:28:34 +0300 [thread overview]
Message-ID: <49D8CE22.4080209@redhat.com> (raw)
In-Reply-To: <49D8B5C2.4090901@codemonkey.ws>
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@redhat.com
>
> 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
next prev parent reply other threads:[~2009-04-05 15:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-04 10:48 [PATCH] Fix display breakage when resizing the screen Avi Kivity
2009-04-04 10:48 ` [Qemu-devel] " Avi Kivity
2009-04-05 13:44 ` Anthony Liguori
2009-04-05 13:44 ` [Qemu-devel] " Anthony Liguori
2009-04-05 15:28 ` Avi Kivity [this message]
2009-04-05 15:35 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49D8CE22.4080209@redhat.com \
--to=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.