[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 0 of 7] [UPDATE] DisplayState interface change
From: |
Stefano Stabellini |
Subject: |
Re: [Qemu-devel] [PATCH 0 of 7] [UPDATE] DisplayState interface change |
Date: |
Thu, 11 Dec 2008 15:22:12 +0000 |
User-agent: |
Thunderbird 2.0.0.14 (X11/20080505) |
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.