[4812] Implement resolution switching in common console code.
Revision: 4812
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4812 Author: pbrook Date: 2008-07-01 16:24:38 +0000 (Tue, 01 Jul 2008)
Log Message:
-----------
Implement resolution switching in common console code.
Modified Paths:
--------------
trunk/console.c
trunk/console.h
trunk/hw/blizzard.c
trunk/hw/cirrus_vga.c
trunk/hw/g364fb.c
trunk/hw/jazz_led.c
trunk/hw/musicpal.c
trunk/hw/nseries.c
trunk/hw/omap_lcdc.c
trunk/hw/palm.c
trunk/hw/pl110.c
trunk/hw/pxa2xx_lcd.c
trunk/hw/ssd0303.c
trunk/hw/ssd0323.c
trunk/hw/tcx.c
trunk/hw/vga.c
trunk/hw/vga_int.h
trunk/hw/vmware_vga.c
trunk/qemu-common.h
trunk/vl.cModified: trunk/console.c
===================================================================
console.c +20 -15
@@ -28,6 +28,7 @@//#define DEBUG_CONSOLE #define DEFAULT_BACKSCROLL 512#define MAX_CONSOLES 12 +#define DEFAULT_MONITOR_SIZE "800x600"#define QEMU_RGBA (r, g, b, a) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))#define QEMU_RGB (r, g, b) QEMU_RGBA(r, g, b, 0xff)
@@ -108,8 +109,7 @@typedef enum {GRAPHIC_CONSOLE , -TEXT_CONSOLE , -TEXT_CONSOLE_FIXED_SIZE +TEXT_CONSOLE }console_type_t ;/* ??? This is mis-named.
@@ -1041,6 +1041,9 @@ s = consoles[index];if (s) { active_console = s; +if (s->g_width && s->g_height + && (s->g_width != s->ds->width || s->g_height != s->ds->height)) +dpy_resize (s->ds, s->g_width, s->g_height);vga_hw_invalidate (); } }
@@ -1149,18 +1152,6 @@ {TextConsole *s = (TextConsole *) opaque; -if (s->console_type !=GRAPHIC_CONSOLE ) { -if (s->g_width != s->ds->width || - s->g_height != s->ds->height) { -if (s->console_type ==TEXT_CONSOLE_FIXED_SIZE ) -dpy_resize (s->ds, s->g_width, s->g_height); -else { - s->g_width = s->ds->width; - s->g_height = s->ds->height; -text_console_resize (s); - } - } - }console_refresh (s); }
@@ -1268,11 +1259,14 @@ chr =qemu_mallocz (sizeof (CharDriverState));if (!chr)return NULL ; - s =new_console (ds, (p ==0 ) ?TEXT_CONSOLE :TEXT_CONSOLE_FIXED_SIZE ); + s =new_console (ds,TEXT_CONSOLE );if (!s) {free (chr);return NULL ; } +if (!p) + p =DEFAULT_MONITOR_SIZE ; + chr->opaque = s; chr->chr_write = console_puts; chr->chr_send_event = console_send_event;
@@ -1332,3 +1326,14 @@return chr; } + +void qemu_console_resize (QEMUConsole *console,int width,int height) +{ +if (console->g_width != width || console->g_height != height) { + console->g_width = width; + console->g_height = height; +if (active_console == console) { +dpy_resize (console->ds, width, height); + } + } +}
Modified: trunk/console.h
===================================================================
console.h +1 -0
@@ -135,6 +135,7 @@CharDriverState *text_console_init (DisplayState *ds,const char *p);void console_select (unsigned int index);void console_color_init (DisplayState *ds); +void qemu_console_resize (QEMUConsole *console,int width,int height);/* sdl.c */ void sdl_display_init (DisplayState *ds,int full_screen,int no_frame);
Modified: trunk/hw/blizzard.c
===================================================================
hw/blizzard.c +5 -4
@@ -73,6 +73,7 @@uint8_t iformat;uint8_t source;DisplayState *state; +QEMUConsole *console;blizzard_fn_t *line_fn_tab[2 ];void *fb;
@@ -896,7 +897,7 @@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 @@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; }
Modified: trunk/hw/cirrus_vga.c
===================================================================
hw/cirrus_vga.c +2 -2
@@ -3288,8 +3288,8 @@ 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;
Modified: trunk/hw/g364fb.c
===================================================================
hw/g364fb.c +7 -10
@@ -33,6 +33,7 @@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 @@ {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 @@#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 @@ 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);
Modified: trunk/hw/jazz_led.c
===================================================================
hw/jazz_led.c +7 -4
@@ -37,6 +37,7 @@target_phys_addr_t base;uint8_t segments;DisplayState *ds; +QEMUConsole *console;screen_state_t state; } LedState;
@@ -291,7 +292,7 @@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 @@ 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 ); }
Modified: trunk/hw/musicpal.c
===================================================================
hw/musicpal.c +4 -11
@@ -758,8 +758,8 @@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 @@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_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 @@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 */
Modified: trunk/hw/nseries.c
===================================================================
hw/nseries.c +3 -1
@@ -1307,7 +1307,9 @@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 ); }
Modified: trunk/hw/omap_lcdc.c
===================================================================
hw/omap_lcdc.c +6 -4
@@ -26,6 +26,7 @@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 @@ 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 @@ 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; }
Modified: trunk/hw/palm.c
===================================================================
hw/palm.c +3 -0
@@ -275,6 +275,9 @@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 ); }
Modified: trunk/hw/pl110.c
===================================================================
hw/pl110.c +7 -4
@@ -30,6 +30,8 @@ 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 @@ {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 @@ 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 @@ 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; }
Modified: trunk/hw/pxa2xx_lcd.c
===================================================================
hw/pxa2xx_lcd.c +6 -4
@@ -23,6 +23,7 @@int invalidated;DisplayState *ds; +QEMUConsole *console;drawfn *line_fn[2 ];int dest_width;int xres, yres;
@@ -794,9 +795,9 @@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 @@ 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 :
Modified: trunk/hw/ssd0303.c
===================================================================
hw/ssd0303.c +5 -3
@@ -45,6 +45,7 @@ typedef struct { i2c_slave i2c; DisplayState *ds; + QEMUConsole *console; int row; int col; int start_line;
@@ -269,7 +270,8 @@ 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 ); }
Modified: trunk/hw/ssd0323.c
===================================================================
hw/ssd0323.c +6 -4
@@ -44,6 +44,7 @@ typedef struct { DisplayState *ds; + QEMUConsole *console; int cmd_len; int cmd;
@@ -278,12 +279,13 @@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;
Modified: trunk/hw/tcx.c
===================================================================
hw/tcx.c +8 -10
@@ -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 @@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 @@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 @@ 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 @@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)
Modified: trunk/hw/vga.c
===================================================================
hw/vga.c +10 -10
@@ -1155,7 +1155,7 @@ 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 @@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 @@ 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 @@ 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 @@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 @@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 @@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;
Modified: trunk/hw/vga_int.h
===================================================================
hw/vga_int.h +1 -0
@@ -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; \
Modified: trunk/hw/vmware_vga.c
===================================================================
hw/vmware_vga.c +6 -4
@@ -57,6 +57,7 @@#ifndef EMBED_STDVGA DisplayState *ds; +QEMUConsole *console;int vram_size;ram_addr_t vram_offset;#endif
@@ -869,7 +870,7 @@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 @@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,
Modified: trunk/qemu-common.h
===================================================================
qemu-common.h +1 -0
@@ -119,6 +119,7 @@typedef struct BlockDriverState BlockDriverState ;typedef struct DisplayState DisplayState ;typedef struct TextConsole TextConsole ; +typedef TextConsole QEMUConsole ;typedef struct CharDriverState CharDriverState ;typedef struct VLANState VLANState ;typedef struct QEMUFile QEMUFile ;
Modified: trunk/vl.c
===================================================================
vl.c +1 -1
@@ -7935,7 +7935,7 @@ kernel_cmdline ="" ; cyls = heads = secs =0 ; translation =BIOS_ATA_TRANSLATION_AUTO ; - monitor_device ="vc:800x600" ; + monitor_device ="vc" ; serial_devices[0 ] ="vc:80Cx24C" ;for (i =1 ; i <MAX_SERIAL_PORTS ; i++)