diff options
author | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-01-16 19:04:14 +0000 |
---|---|---|
committer | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-01-16 19:04:14 +0000 |
commit | 3023f3329d87a6203d03a0e9ccb948772940da96 (patch) | |
tree | 2e1bea1fcce30aa15940275277f52022d7325341 /vl.c | |
parent | 9f8df9c10f5112014cffef0bf546bf344eeefc32 (diff) |
graphical_console_init change (Stefano Stabellini)
Patch 5/7
This patch changes the graphical_console_init function to return an
allocated DisplayState instead of a QEMUConsole.
This patch contains just the graphical_console_init change and few other
modifications mainly in console.c and vl.c.
It was necessary to move the display frontends (e.g. sdl and vnc)
initialization after machine->init in vl.c.
This patch does *not* include any required changes to any device, these
changes come with the following patches.
Patch 6/7
This patch changes the QEMUMachine init functions not to take a
DisplayState as an argument because is not needed any more;
In few places the graphic hardware initialization function was called
only if DisplayState was not NULL, now they are always called.
Apart from these cases, the rest are all mechanical substitutions.
Patch 7/7
This patch updates the graphic device code to use the new
graphical_console_init function.
As for the previous patch, in few places graphical_console_init was called
only if DisplayState was not NULL, now it is always called.
Apart from these cases, the rest are all mechanical substitutions.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6344 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 144 |
1 files changed, 82 insertions, 62 deletions
@@ -187,7 +187,7 @@ DriveInfo drives_table[MAX_DRIVES+1]; int nb_drives; static int vga_ram_size; enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB; -DisplayState display_state; +static DisplayState *display_state; int nographic; static int curses; static int sdl; @@ -2756,6 +2756,23 @@ void pcmcia_info(void) } /***********************************************************/ +/* register display */ + +void register_displaystate(DisplayState *ds) +{ + DisplayState **s; + s = &display_state; + while (*s != NULL) + s = &(*s)->next; + ds->next = NULL; + *s = ds; +} + +DisplayState *get_displaystate(void) +{ + return display_state; +} + /* dumb display */ static void dumb_update(DisplayState *ds, int x, int y, int w, int h) @@ -4502,7 +4519,7 @@ int main(int argc, char **argv, char **envp) const char *initrd_filename; const char *kernel_filename, *kernel_cmdline; const char *boot_devices = ""; - DisplayState *ds = &display_state; + DisplayState *ds; DisplayChangeListener *dcl; int cyls, heads, secs, translation; const char *net_clients[MAX_NET_CLIENTS]; @@ -5414,9 +5431,63 @@ int main(int argc, char **argv, char **envp) register_savevm("timer", 0, 2, timer_save, timer_load, NULL); register_savevm_live("ram", 0, 3, ram_save_live, NULL, ram_load, NULL); +#ifndef _WIN32 + /* must be after terminal init, SDL library changes signal handlers */ + termsig_setup(); +#endif + + /* Maintain compatibility with multiple stdio monitors */ + if (!strcmp(monitor_device,"stdio")) { + for (i = 0; i < MAX_SERIAL_PORTS; i++) { + const char *devname = serial_devices[i]; + if (devname && !strcmp(devname,"mon:stdio")) { + monitor_device = NULL; + break; + } else if (devname && !strcmp(devname,"stdio")) { + monitor_device = NULL; + serial_devices[i] = "mon:stdio"; + break; + } + } + } + + if (kvm_enabled()) { + int ret; + + ret = kvm_init(smp_cpus); + if (ret < 0) { + fprintf(stderr, "failed to initialize KVM\n"); + exit(1); + } + } + + machine->init(ram_size, vga_ram_size, boot_devices, + kernel_filename, kernel_cmdline, initrd_filename, cpu_model); + + /* Set KVM's vcpu state to qemu's initial CPUState. */ + if (kvm_enabled()) { + int ret; + + ret = kvm_sync_vcpus(); + if (ret < 0) { + fprintf(stderr, "failed to initialize vcpus\n"); + exit(1); + } + } + + /* init USB devices */ + if (usb_enabled) { + for(i = 0; i < usb_devices_index; i++) { + if (usb_device_add(usb_devices[i]) < 0) { + fprintf(stderr, "Warning: could not add USB device %s\n", + usb_devices[i]); + } + } + } + + /* just use the first displaystate for the moment */ + ds = display_state; /* terminal init */ - memset(&display_state, 0, sizeof(display_state)); - ds->surface = qemu_create_displaysurface(640, 480, 32, 640 * 4); if (nographic) { if (curses) { fprintf(stderr, "fatal: -nographic can't be used with -curses\n"); @@ -5448,25 +5519,16 @@ int main(int argc, char **argv, char **envp) } } dpy_resize(ds); -#ifndef _WIN32 - /* must be after terminal init, SDL library changes signal handlers */ - termsig_setup(); -#endif - /* Maintain compatibility with multiple stdio monitors */ - if (!strcmp(monitor_device,"stdio")) { - for (i = 0; i < MAX_SERIAL_PORTS; i++) { - const char *devname = serial_devices[i]; - if (devname && !strcmp(devname,"mon:stdio")) { - monitor_device = NULL; - break; - } else if (devname && !strcmp(devname,"stdio")) { - monitor_device = NULL; - serial_devices[i] = "mon:stdio"; - break; - } + dcl = ds->listeners; + while (dcl != NULL) { + if (dcl->dpy_refresh != NULL) { + ds->gui_timer = qemu_new_timer(rt_clock, gui_update, ds); + qemu_mod_timer(ds->gui_timer, qemu_get_clock(rt_clock)); } + dcl = dcl->next; } + if (monitor_device) { monitor_hd = qemu_chr_open("monitor", monitor_device); if (!monitor_hd) { @@ -5524,48 +5586,6 @@ int main(int argc, char **argv, char **envp) } } - if (kvm_enabled()) { - int ret; - - ret = kvm_init(smp_cpus); - if (ret < 0) { - fprintf(stderr, "failed to initialize KVM\n"); - exit(1); - } - } - - machine->init(ram_size, vga_ram_size, boot_devices, ds, - kernel_filename, kernel_cmdline, initrd_filename, cpu_model); - - /* Set KVM's vcpu state to qemu's initial CPUState. */ - if (kvm_enabled()) { - int ret; - - ret = kvm_sync_vcpus(); - if (ret < 0) { - fprintf(stderr, "failed to initialize vcpus\n"); - exit(1); - } - } - - /* init USB devices */ - if (usb_enabled) { - for(i = 0; i < usb_devices_index; i++) { - if (usb_device_add(usb_devices[i]) < 0) { - fprintf(stderr, "Warning: could not add USB device %s\n", - usb_devices[i]); - } - } - } - - dcl = ds->listeners; - while (dcl != NULL) { - if (dcl->dpy_refresh != NULL) { - display_state.gui_timer = qemu_new_timer(rt_clock, gui_update, &display_state); - qemu_mod_timer(display_state.gui_timer, qemu_get_clock(rt_clock)); - } - dcl = dcl->next; - } #ifdef CONFIG_GDBSTUB if (use_gdbstub) { /* XXX: use standard host:port notation and modify options |