diff options
author | pbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-07-01 16:24:38 +0000 |
---|---|---|
committer | pbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-07-01 16:24:38 +0000 |
commit | c60e08d9c6bbace33c04dab2b5cacbc42e2e3d47 (patch) | |
tree | be6d94159b698760acaec329da228a44c2ce415f /hw | |
parent | ea334207a3152e5e4fee4cb82a76233fd43fa14d (diff) |
Implement resolution switching in common console code.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4812 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw')
-rw-r--r-- | hw/blizzard.c | 9 | ||||
-rw-r--r-- | hw/cirrus_vga.c | 4 | ||||
-rw-r--r-- | hw/g364fb.c | 17 | ||||
-rw-r--r-- | hw/jazz_led.c | 11 | ||||
-rw-r--r-- | hw/musicpal.c | 15 | ||||
-rw-r--r-- | hw/nseries.c | 4 | ||||
-rw-r--r-- | hw/omap_lcdc.c | 10 | ||||
-rw-r--r-- | hw/palm.c | 3 | ||||
-rw-r--r-- | hw/pl110.c | 11 | ||||
-rw-r--r-- | hw/pxa2xx_lcd.c | 10 | ||||
-rw-r--r-- | hw/ssd0303.c | 8 | ||||
-rw-r--r-- | hw/ssd0323.c | 10 | ||||
-rw-r--r-- | hw/tcx.c | 18 | ||||
-rw-r--r-- | hw/vga.c | 20 | ||||
-rw-r--r-- | hw/vga_int.h | 1 | ||||
-rw-r--r-- | hw/vmware_vga.c | 10 |
16 files changed, 86 insertions, 75 deletions
diff --git a/hw/blizzard.c b/hw/blizzard.c index 9ad7e6a154..37330e7f2e 100644 --- a/hw/blizzard.c +++ b/hw/blizzard.c @@ -73,6 +73,7 @@ struct blizzard_s { uint8_t iformat; uint8_t source; DisplayState *state; + QEMUConsole *console; blizzard_fn_t *line_fn_tab[2]; void *fb; @@ -896,7 +897,7 @@ static void blizzard_update_display(void *opaque) if (s->x != s->state->width || s->y != s->state->height) { s->invalidate = 1; - dpy_resize(s->state, s->x, s->y); + qemu_console_resize(s->console, s->x, s->y); } if (s->invalidate) { @@ -993,9 +994,9 @@ void *s1d13745_init(qemu_irq gpio_int, DisplayState *ds) blizzard_reset(s); - graphic_console_init(s->state, blizzard_update_display, - blizzard_invalidate_display, blizzard_screen_dump, - NULL, s); + s->console = graphic_console_init(s->state, blizzard_update_display, + blizzard_invalidate_display, + blizzard_screen_dump, NULL, s); return s; } diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c index 4e9f98d371..2d0f66ab05 100644 --- a/hw/cirrus_vga.c +++ b/hw/cirrus_vga.c @@ -3288,8 +3288,8 @@ void pci_cirrus_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base, ds, vga_ram_base, vga_ram_offset, vga_ram_size); cirrus_init_common(s, device_id, 1); - graphic_console_init(s->ds, s->update, s->invalidate, s->screen_dump, - s->text_update, s); + s->console = graphic_console_init(s->ds, s->update, s->invalidate, + s->screen_dump, s->text_update, s); s->pci_dev = (PCIDevice *)d; diff --git a/hw/g364fb.c b/hw/g364fb.c index 0dd4ee766c..3dfc8e1cdc 100644 --- a/hw/g364fb.c +++ b/hw/g364fb.c @@ -33,6 +33,7 @@ typedef struct G364State { uint8_t palette[256][3]; /* display refresh support */ DisplayState *ds; + QEMUConsole *console; int graphic_mode; uint32_t scr_width, scr_height; /* in pixels */ uint32_t last_scr_width, last_scr_height; /* in pixels */ @@ -74,13 +75,6 @@ static void g364fb_draw_graphic(G364State *s, int full_update) { if (s->scr_width == 0 || s->scr_height == 0) return; - if (s->scr_width != s->last_scr_width - || s->scr_height != s->last_scr_height) { - s->last_scr_width = s->scr_width; - s->last_scr_height = s->scr_height; - dpy_resize(s->ds, s->last_scr_width, s->last_scr_height); - full_update = 1; - } switch (s->ds->depth) { case 8: @@ -272,7 +266,10 @@ static void g364fb_ctrl_writeb(void *opaque, target_phys_addr_t addr, uint32_t v #endif break; } + if (s->scr_width && s->scr_height) + qemu_console_resize(s->console, s->scr_width, s->scr_height); } + s->graphic_mode = -1; /* force full update */ } static void g364fb_ctrl_writew(void *opaque, target_phys_addr_t addr, uint32_t val) @@ -382,9 +379,9 @@ int g364fb_mm_init(DisplayState *ds, s->ds = ds; s->vram_base = vram_base; - graphic_console_init(ds, g364fb_update_display, - g364fb_invalidate_display, g364fb_screen_dump, - NULL, s); + s->console = graphic_console_init(ds, g364fb_update_display, + g364fb_invalidate_display, + g364fb_screen_dump, NULL, s); io_vram = cpu_register_io_memory(0, g364fb_mem_read, g364fb_mem_write, s); cpu_register_physical_memory(s->vram_base, vram_size, io_vram); diff --git a/hw/jazz_led.c b/hw/jazz_led.c index d547138b94..8460bfcd59 100644 --- a/hw/jazz_led.c +++ b/hw/jazz_led.c @@ -37,6 +37,7 @@ typedef struct LedState { target_phys_addr_t base; uint8_t segments; DisplayState *ds; + QEMUConsole *console; screen_state_t state; } LedState; @@ -291,7 +292,7 @@ static void jazz_led_text_update(void *opaque, console_ch_t *chardata) char buf[2]; dpy_cursor(s->ds, -1, -1); - dpy_resize(s->ds, 2, 1); + qemu_console_resize(s->console, 2, 1); /* TODO: draw the segments */ snprintf(buf, 2, "%02hhx\n", s->segments); @@ -317,7 +318,9 @@ void jazz_led_init(DisplayState *ds, target_phys_addr_t base) io = cpu_register_io_memory(0, led_read, led_write, s); cpu_register_physical_memory(s->base, 1, io); - graphic_console_init(ds, jazz_led_update_display, - jazz_led_invalidate_display, jazz_led_screen_dump, - jazz_led_text_update, s); + s->console = graphic_console_init(ds, jazz_led_update_display, + jazz_led_invalidate_display, + jazz_led_screen_dump, + jazz_led_text_update, s); + qemu_console_resize(s->console, 60, 80); } diff --git a/hw/musicpal.c b/hw/musicpal.c index b0fcee25be..e4d8c89bef 100644 --- a/hw/musicpal.c +++ b/hw/musicpal.c @@ -758,8 +758,8 @@ typedef struct musicpal_lcd_state { int page; int page_off; DisplayState *ds; + QEMUConsole *console; uint8_t video_ram[128*64/8]; - int invalidate; } musicpal_lcd_state; static uint32_t lcd_brightness; @@ -818,11 +818,6 @@ static void lcd_refresh(void *opaque) musicpal_lcd_state *s = opaque; 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) { case 0: return; @@ -851,9 +846,6 @@ static void lcd_refresh(void *opaque) 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) @@ -932,12 +924,13 @@ static void musicpal_lcd_init(DisplayState *ds, uint32_t base) return; s->base = base; s->ds = ds; - s->invalidate = 1; iomemtype = cpu_register_io_memory(0, musicpal_lcd_readfn, musicpal_lcd_writefn, s); cpu_register_physical_memory(base, MP_LCD_SIZE, iomemtype); - graphic_console_init(ds, lcd_refresh, lcd_invalidate, NULL, NULL, s); + s->console = graphic_console_init(ds, lcd_refresh, lcd_invalidate, + NULL, NULL, s); + qemu_console_resize(s->console, 128*3, 64*3); } /* PIC register offsets */ diff --git a/hw/nseries.c b/hw/nseries.c index 5620897b19..725554d44a 100644 --- a/hw/nseries.c +++ b/hw/nseries.c @@ -1307,7 +1307,9 @@ static void n8x0_init(ram_addr_t ram_size, const char *boot_device, n800_setup_nolo_tags(phys_ram_base + sdram_size); } - + /* FIXME: We shouldn't really be doing this here. The LCD controller + will set the size once configured, so this just sets an initial + size until the guest activates the display. */ dpy_resize(ds, 800, 480); } diff --git a/hw/omap_lcdc.c b/hw/omap_lcdc.c index 42174f7e0a..99e8b4fa44 100644 --- a/hw/omap_lcdc.c +++ b/hw/omap_lcdc.c @@ -26,6 +26,7 @@ struct omap_lcd_panel_s { target_phys_addr_t base; qemu_irq irq; DisplayState *state; + QEMUConsole *console; ram_addr_t imif_base; ram_addr_t emiff_base; @@ -175,8 +176,8 @@ static void omap_update_display(void *opaque) width = omap_lcd->width; if (width != omap_lcd->state->width || omap_lcd->height != omap_lcd->state->height) { - dpy_resize(omap_lcd->state, - omap_lcd->width, omap_lcd->height); + qemu_console_resize(omap_lcd->console, + omap_lcd->width, omap_lcd->height); omap_lcd->invalidate = 1; } @@ -494,8 +495,9 @@ struct omap_lcd_panel_s *omap_lcdc_init(target_phys_addr_t base, qemu_irq irq, omap_lcdc_writefn, s); cpu_register_physical_memory(s->base, 0x100, iomemtype); - graphic_console_init(ds, omap_update_display, - omap_invalidate_display, omap_screen_dump, NULL, s); + s->console = graphic_console_init(ds, omap_update_display, + omap_invalidate_display, + omap_screen_dump, NULL, s); return s; } @@ -275,6 +275,9 @@ static void palmte_init(ram_addr_t ram_size, int vga_ram_size, arm_load_kernel(cpu->env, &palmte_binfo); } + /* FIXME: We shouldn't really be doing this here. The LCD controller + will set the size once configured, so this just sets an initial + size until the guest activates the display. */ dpy_resize(ds, 320, 320); } diff --git a/hw/pl110.c b/hw/pl110.c index 7f450851a1..2437185f63 100644 --- a/hw/pl110.c +++ b/hw/pl110.c @@ -30,6 +30,8 @@ enum pl110_bppmode typedef struct { uint32_t base; DisplayState *ds; + QEMUConsole *console; + /* The Versatile/PB uses a slightly modified PL110 controller. */ int versatile; uint32_t timing[4]; @@ -270,7 +272,7 @@ static void pl110_resize(pl110_state *s, int width, int height) { if (width != s->cols || height != s->rows) { if (pl110_enabled(s)) { - dpy_resize(s->ds, width, height); + qemu_console_resize(s->console, width, height); } } s->cols = width; @@ -387,7 +389,7 @@ static void pl110_write(void *opaque, target_phys_addr_t offset, s->cr = val; s->bpp = (val >> 1) & 7; if (pl110_enabled(s)) { - dpy_resize(s->ds, s->cols, s->rows); + qemu_console_resize(s->console, s->cols, s->rows); } break; case 10: /* LCDICR */ @@ -425,8 +427,9 @@ void *pl110_init(DisplayState *ds, uint32_t base, qemu_irq irq, s->ds = ds; s->versatile = versatile; s->irq = irq; - graphic_console_init(ds, pl110_update_display, pl110_invalidate_display, - NULL, NULL, s); + s->console = graphic_console_init(ds, pl110_update_display, + pl110_invalidate_display, + NULL, NULL, s); /* ??? Save/restore. */ return s; } diff --git a/hw/pxa2xx_lcd.c b/hw/pxa2xx_lcd.c index 7203a3fb68..5e834fe76e 100644 --- a/hw/pxa2xx_lcd.c +++ b/hw/pxa2xx_lcd.c @@ -23,6 +23,7 @@ struct pxa2xx_lcdc_s { int invalidated; DisplayState *ds; + QEMUConsole *console; drawfn *line_fn[2]; int dest_width; int xres, yres; @@ -794,9 +795,9 @@ static void pxa2xx_lcdc_resize(struct pxa2xx_lcdc_s *s) if (width != s->xres || height != s->yres) { if (s->orientation) - dpy_resize(s->ds, height, width); + qemu_console_resize(s->console, height, width); else - dpy_resize(s->ds, width, height); + qemu_console_resize(s->console, width, height); s->invalidated = 1; s->xres = width; s->yres = height; @@ -1001,8 +1002,9 @@ struct pxa2xx_lcdc_s *pxa2xx_lcdc_init(target_phys_addr_t base, qemu_irq irq, pxa2xx_lcdc_writefn, s); cpu_register_physical_memory(base, 0x00100000, iomemtype); - graphic_console_init(ds, pxa2xx_update_display, - pxa2xx_invalidate_display, pxa2xx_screen_dump, NULL, s); + s->console = graphic_console_init(ds, pxa2xx_update_display, + pxa2xx_invalidate_display, + pxa2xx_screen_dump, NULL, s); switch (s->ds->depth) { case 0: diff --git a/hw/ssd0303.c b/hw/ssd0303.c index daa92924a6..1b178f2621 100644 --- a/hw/ssd0303.c +++ b/hw/ssd0303.c @@ -45,6 +45,7 @@ enum ssd0303_cmd { typedef struct { i2c_slave i2c; DisplayState *ds; + QEMUConsole *console; int row; int col; int start_line; @@ -269,7 +270,8 @@ void ssd0303_init(DisplayState *ds, i2c_bus *bus, int address) s->i2c.event = ssd0303_event; s->i2c.recv = ssd0303_recv; s->i2c.send = ssd0303_send; - graphic_console_init(ds, ssd0303_update_display, ssd0303_invalidate_display, - NULL, NULL, s); - dpy_resize(s->ds, 96 * MAGNIFY, 16 * MAGNIFY); + s->console = graphic_console_init(ds, ssd0303_update_display, + ssd0303_invalidate_display, + NULL, NULL, s); + qemu_console_resize(s->console, 96 * MAGNIFY, 16 * MAGNIFY); } diff --git a/hw/ssd0323.c b/hw/ssd0323.c index e2e619f076..3071596f0b 100644 --- a/hw/ssd0323.c +++ b/hw/ssd0323.c @@ -44,6 +44,7 @@ enum ssd0323_mode typedef struct { DisplayState *ds; + QEMUConsole *console; int cmd_len; int cmd; @@ -278,12 +279,13 @@ void *ssd0323_init(DisplayState *ds, qemu_irq *cmd_p) qemu_irq *cmd; s = (ssd0323_state *)qemu_mallocz(sizeof(ssd0323_state)); - s->ds = ds; - graphic_console_init(ds, ssd0323_update_display, ssd0323_invalidate_display, - NULL, NULL, s); - dpy_resize(s->ds, 128 * MAGNIFY, 64 * MAGNIFY); s->col_end = 63; s->row_end = 79; + s->ds = ds; + s->console = graphic_console_init(ds, ssd0323_update_display, + ssd0323_invalidate_display, + NULL, NULL, s); + qemu_console_resize(s->console, 128 * MAGNIFY, 64 * MAGNIFY); cmd = qemu_allocate_irqs(ssd0323_cd, s, 1); *cmd_p = *cmd; @@ -36,6 +36,7 @@ typedef struct TCXState { target_phys_addr_t addr; DisplayState *ds; + QEMUConsole *console; uint8_t *vram; uint32_t *vram24, *cplane; ram_addr_t vram_offset, vram24_offset, cplane_offset; @@ -186,8 +187,6 @@ static void tcx_update_display(void *opaque) if (ts->ds->depth == 0) return; - if (ts->ds->width != ts->width || ts->ds->height != ts->height) - dpy_resize(ts->ds, ts->width, ts->height); page = ts->vram_offset; y_start = -1; page_min = 0xffffffff; @@ -266,8 +265,6 @@ static void tcx24_update_display(void *opaque) if (ts->ds->depth != 32) return; - if (ts->ds->width != ts->width || ts->ds->height != ts->height) - dpy_resize(ts->ds, ts->width, ts->height); page = ts->vram_offset; page24 = ts->vram24_offset; cpage = ts->cplane_offset; @@ -541,14 +538,15 @@ void tcx_init(DisplayState *ds, target_phys_addr_t addr, uint8_t *vram_base, s->cplane = (uint32_t *)vram_base; s->cplane_offset = vram_offset; cpu_register_physical_memory(addr + 0x0a000000ULL, size, vram_offset); - graphic_console_init(s->ds, tcx24_update_display, - tcx24_invalidate_display, - tcx24_screen_dump, NULL, s); + s->console = graphic_console_init(s->ds, tcx24_update_display, + tcx24_invalidate_display, + tcx24_screen_dump, NULL, s); } else { cpu_register_physical_memory(addr + 0x00300000ULL, TCX_THC_NREGS_8, dummy_memory); - graphic_console_init(s->ds, tcx_update_display, tcx_invalidate_display, - tcx_screen_dump, NULL, s); + s->console = graphic_console_init(s->ds, tcx_update_display, + tcx_invalidate_display, + tcx_screen_dump, NULL, s); } // NetBSD writes here even with 8-bit display cpu_register_physical_memory(addr + 0x00301000ULL, TCX_THC_NREGS_24, @@ -557,7 +555,7 @@ void tcx_init(DisplayState *ds, target_phys_addr_t addr, uint8_t *vram_base, register_savevm("tcx", addr, 4, tcx_save, tcx_load, s); qemu_register_reset(tcx_reset, s); tcx_reset(s); - dpy_resize(s->ds, width, height); + qemu_console_resize(s->console, width, height); } static void tcx_screen_dump(void *opaque, const char *filename) @@ -1155,7 +1155,7 @@ static void vga_draw_text(VGAState *s, int full_update) cw != s->last_cw || cheight != s->last_ch) { s->last_scr_width = width * cw; s->last_scr_height = height * cheight; - dpy_resize(s->ds, s->last_scr_width, s->last_scr_height); + qemu_console_resize(s->console, s->last_scr_width, s->last_scr_height); s->last_width = width; s->last_height = height; s->last_ch = cheight; @@ -1499,7 +1499,7 @@ static void vga_draw_graphic(VGAState *s, int full_update) if (disp_width != s->last_width || height != s->last_height) { - dpy_resize(s->ds, disp_width, height); + qemu_console_resize(s->console, disp_width, height); s->last_scr_width = disp_width; s->last_scr_height = height; s->last_width = disp_width; @@ -1734,7 +1734,7 @@ static void vga_update_text(void *opaque, console_ch_t *chardata) cw != s->last_cw || cheight != s->last_ch) { s->last_scr_width = width * cw; s->last_scr_height = height * cheight; - dpy_resize(s->ds, width, height); + qemu_console_resize(s->console, width, height); s->last_width = width; s->last_height = height; s->last_ch = cheight; @@ -1814,7 +1814,7 @@ static void vga_update_text(void *opaque, console_ch_t *chardata) s->last_width = 60; s->last_height = height = 3; dpy_cursor(s->ds, -1, -1); - dpy_resize(s->ds, s->last_width, height); + qemu_console_resize(s->console, s->last_width, height); for (dst = chardata, i = 0; i < s->last_width * height; i ++) console_write_ch(dst ++, ' '); @@ -2140,8 +2140,8 @@ int isa_vga_init(DisplayState *ds, uint8_t *vga_ram_base, vga_common_init(s, ds, vga_ram_base, vga_ram_offset, vga_ram_size); vga_init(s); - graphic_console_init(s->ds, s->update, s->invalidate, s->screen_dump, - s->text_update, s); + s->console = graphic_console_init(s->ds, s->update, s->invalidate, + s->screen_dump, s->text_update, s); #ifdef CONFIG_BOCHS_VBE /* XXX: use optimized standard vga accesses */ @@ -2165,8 +2165,8 @@ int isa_vga_mm_init(DisplayState *ds, uint8_t *vga_ram_base, vga_common_init(s, ds, vga_ram_base, vga_ram_offset, vga_ram_size); vga_mm_init(s, vram_base, ctrl_base, it_shift); - graphic_console_init(s->ds, s->update, s->invalidate, s->screen_dump, - s->text_update, s); + s->console = graphic_console_init(s->ds, s->update, s->invalidate, + s->screen_dump, s->text_update, s); #ifdef CONFIG_BOCHS_VBE /* XXX: use optimized standard vga accesses */ @@ -2194,8 +2194,8 @@ int pci_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base, vga_common_init(s, ds, vga_ram_base, vga_ram_offset, vga_ram_size); vga_init(s); - graphic_console_init(s->ds, s->update, s->invalidate, s->screen_dump, - s->text_update, s); + s->console = graphic_console_init(s->ds, s->update, s->invalidate, + s->screen_dump, s->text_update, s); s->pci_dev = &d->dev; diff --git a/hw/vga_int.h b/hw/vga_int.h index 5d11a7ac46..343da34574 100644 --- a/hw/vga_int.h +++ b/hw/vga_int.h @@ -121,6 +121,7 @@ VGA_STATE_COMMON_BOCHS_VBE \ /* display refresh support */ \ DisplayState *ds; \ + QEMUConsole *console; \ uint32_t font_offsets[2]; \ int graphic_mode; \ uint8_t shift_control; \ diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c index 2f9b15ccd5..25c7915b4d 100644 --- a/hw/vmware_vga.c +++ b/hw/vmware_vga.c @@ -57,6 +57,7 @@ struct vmsvga_state_s { #ifndef EMBED_STDVGA DisplayState *ds; + QEMUConsole *console; int vram_size; ram_addr_t vram_offset; #endif @@ -869,7 +870,7 @@ static inline void vmsvga_size(struct vmsvga_state_s *s) if (s->new_width != s->width || s->new_height != s->height) { s->width = s->new_width; s->height = s->new_height; - dpy_resize(s->ds, s->width, s->height); + qemu_console_resize(s->console, s->width, s->height); s->invalidated = 1; } } @@ -1122,9 +1123,10 @@ static void vmsvga_init(struct vmsvga_state_s *s, DisplayState *ds, vmsvga_reset(s); - graphic_console_init(ds, vmsvga_update_display, - vmsvga_invalidate_display, vmsvga_screen_dump, - vmsvga_text_update, s); + s->console = graphic_console_init(ds, vmsvga_update_display, + vmsvga_invalidate_display, + vmsvga_screen_dump, + vmsvga_text_update, s); #ifdef EMBED_STDVGA vga_common_init((VGAState *) s, ds, |