//#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)
typedef enum {
GRAPHIC_CONSOLE,
- TEXT_CONSOLE,
- TEXT_CONSOLE_FIXED_SIZE
+ TEXT_CONSOLE
} console_type_t;
/* ??? This is mis-named.
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();
}
}
{
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);
}
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;
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);
+ }
+ }
+}
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);
uint8_t iformat;
uint8_t source;
DisplayState *state;
+ QEMUConsole *console;
blizzard_fn_t *line_fn_tab[2];
void *fb;
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) {
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;
}
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;
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 */
{
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:
#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)
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);
target_phys_addr_t base;
uint8_t segments;
DisplayState *ds;
+ QEMUConsole *console;
screen_state_t state;
} LedState;
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);
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);
}
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;
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;
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)
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 */
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);
}
target_phys_addr_t base;
qemu_irq irq;
DisplayState *state;
+ QEMUConsole *console;
ram_addr_t imif_base;
ram_addr_t emiff_base;
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;
}
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;
}
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);
}
typedef struct {
uint32_t base;
DisplayState *ds;
+ QEMUConsole *console;
+
/* The Versatile/PB uses a slightly modified PL110 controller. */
int versatile;
uint32_t timing[4];
{
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;
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 */
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;
}
int invalidated;
DisplayState *ds;
+ QEMUConsole *console;
drawfn *line_fn[2];
int dest_width;
int xres, yres;
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;
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:
typedef struct {
i2c_slave i2c;
DisplayState *ds;
+ QEMUConsole *console;
int row;
int col;
int start_line;
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);
}
typedef struct {
DisplayState *ds;
+ QEMUConsole *console;
int cmd_len;
int cmd;
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;
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;
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;
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;
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,
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)
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;
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;
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;
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 ++, ' ');
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 */
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 */
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;
VGA_STATE_COMMON_BOCHS_VBE \
/* display refresh support */ \
DisplayState *ds; \
+ QEMUConsole *console; \
uint32_t font_offsets[2]; \
int graphic_mode; \
uint8_t shift_control; \
#ifndef EMBED_STDVGA
DisplayState *ds;
+ QEMUConsole *console;
int vram_size;
ram_addr_t vram_offset;
#endif
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;
}
}
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,
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;
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++)