MusicPal: Restore display size after invalidation (Jan Kiszka).

Make sure that the MusicPal display is set to the correct size again
after some other console may have used a different size.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4646 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
balrog 2008-06-02 02:04:56 +00:00
parent ab7d91318b
commit 167bc3d2fa

View File

@ -759,6 +759,7 @@ typedef struct musicpal_lcd_state {
int page_off; int page_off;
DisplayState *ds; DisplayState *ds;
uint8_t video_ram[128*64/8]; uint8_t video_ram[128*64/8];
int invalidate;
} musicpal_lcd_state; } musicpal_lcd_state;
static uint32_t lcd_brightness; static uint32_t lcd_brightness;
@ -817,6 +818,11 @@ static void lcd_refresh(void *opaque)
musicpal_lcd_state *s = opaque; musicpal_lcd_state *s = opaque;
int x, y, col; int x, y, col;
if (s->invalidate && (s->ds->width != 128*3 || s->ds->height != 64*3)) {
dpy_resize(s->ds, 128*3, 64*3);
s->invalidate = 0;
}
switch (s->ds->depth) { switch (s->ds->depth) {
case 0: case 0:
return; return;
@ -843,6 +849,13 @@ static void lcd_refresh(void *opaque)
dpy_update(s->ds, 0, 0, 128*3, 64*3); dpy_update(s->ds, 0, 0, 128*3, 64*3);
} }
static void lcd_invalidate(void *opaque)
{
musicpal_lcd_state *s = opaque;
s->invalidate = 1;
}
static uint32_t musicpal_lcd_read(void *opaque, target_phys_addr_t offset) static uint32_t musicpal_lcd_read(void *opaque, target_phys_addr_t offset)
{ {
musicpal_lcd_state *s = opaque; musicpal_lcd_state *s = opaque;
@ -919,12 +932,12 @@ static void musicpal_lcd_init(DisplayState *ds, uint32_t base)
return; return;
s->base = base; s->base = base;
s->ds = ds; s->ds = ds;
s->invalidate = 1;
iomemtype = cpu_register_io_memory(0, musicpal_lcd_readfn, iomemtype = cpu_register_io_memory(0, musicpal_lcd_readfn,
musicpal_lcd_writefn, s); musicpal_lcd_writefn, s);
cpu_register_physical_memory(base, MP_LCD_SIZE, iomemtype); cpu_register_physical_memory(base, MP_LCD_SIZE, iomemtype);
graphic_console_init(ds, lcd_refresh, NULL, NULL, NULL, s); graphic_console_init(ds, lcd_refresh, lcd_invalidate, NULL, NULL, s);
dpy_resize(ds, 128*3, 64*3);
} }
/* PIC register offsets */ /* PIC register offsets */