diff -ur kvm-27.orig/qemu/sdl.c kvm-27/qemu/sdl.c --- kvm-27.orig/qemu/sdl.c 2007-06-03 10:27:40.000000000 +0200 +++ kvm-27/qemu/sdl.c 2007-06-05 22:28:19.000000000 +0200 @@ -43,6 +43,7 @@ static SDL_Cursor *sdl_cursor_normal; static SDL_Cursor *sdl_cursor_hidden; static int absolute_enabled = 0; +static int decimate_counter = 0; static void sdl_update(DisplayState *ds, int x, int y, int w, int h) { @@ -321,7 +322,10 @@ sdl_update_caption(); } - vga_hw_update(); + if (decimate_counter == 0) + vga_hw_update(); + + decimate_counter = (decimate_counter + 1) % sdl_decimate; while (SDL_PollEvent(ev)) { switch (ev->type) { @@ -504,6 +508,7 @@ ds->dpy_update = sdl_update; ds->dpy_resize = sdl_resize; ds->dpy_refresh = sdl_refresh; + ds->refresh_interval = 10; sdl_resize(ds, 640, 400); sdl_update_caption(); diff -ur kvm-27.orig/qemu/vl.c kvm-27/qemu/vl.c --- kvm-27.orig/qemu/vl.c 2007-06-03 10:27:40.000000000 +0200 +++ kvm-27/qemu/vl.c 2007-06-05 22:34:29.000000000 +0200 @@ -110,7 +110,7 @@ #define DEFAULT_RAM_SIZE 128 #endif /* in ms */ -#define GUI_REFRESH_INTERVAL 30 +#define DEFAULT_GUI_REFRESH_INTERVAL 30 /* Max number of USB devices that can be specified on the commandline. */ #define MAX_USB_CMDLINE 8 @@ -133,6 +133,7 @@ static DisplayState display_state; int nographic; const char* keyboard_layout = NULL; +int sdl_decimate = 3; int64_t ticks_per_sec; int boot_device = 'c'; int ram_size; @@ -4137,6 +4138,7 @@ ds->dpy_update = dumb_update; ds->dpy_resize = dumb_resize; ds->dpy_refresh = dumb_refresh; + ds->refresh_interval = DEFAULT_GUI_REFRESH_INTERVAL; } /***********************************************************/ @@ -5989,7 +5991,7 @@ void gui_update(void *opaque) { display_state.dpy_refresh(&display_state); - qemu_mod_timer(gui_timer, GUI_REFRESH_INTERVAL + qemu_get_clock(rt_clock)); + qemu_mod_timer(gui_timer, display_state.refresh_interval + qemu_get_clock(rt_clock)); } struct vm_change_state_entry { @@ -6342,6 +6344,7 @@ "-snapshot write to temporary files instead of disk image files\n" #ifdef CONFIG_SDL "-no-quit disable SDL window close capability\n" + "-sdl-decimate n refresh display every n*10 milliseconds (default n=3)\n" #endif #ifdef TARGET_I386 "-no-fd-bootchk disable boot signature checking for floppy disks\n" @@ -6541,6 +6544,9 @@ QEMU_OPTION_no_rtc, #endif QEMU_OPTION_cpu_vendor, +#ifdef CONFIG_SDL + QEMU_OPTION_sdl_decimate, +#endif }; typedef struct QEMUOption { @@ -6616,6 +6622,7 @@ { "full-screen", 0, QEMU_OPTION_full_screen }, #ifdef CONFIG_SDL { "no-quit", 0, QEMU_OPTION_no_quit }, + { "sdl-decimate", HAS_ARG, QEMU_OPTION_sdl_decimate }, #endif { "pidfile", HAS_ARG, QEMU_OPTION_pidfile }, { "win2k-hack", 0, QEMU_OPTION_win2k_hack }, @@ -7189,6 +7196,11 @@ case QEMU_OPTION_k: keyboard_layout = optarg; break; + case QEMU_OPTION_sdl_decimate: + sdl_decimate = atoi(optarg); + if (sdl_decimate <= 0 || sdl_decimate > 5) + help(); + break; case QEMU_OPTION_localtime: rtc_utc = 0; break; diff -ur kvm-27.orig/qemu/vl.h kvm-27/qemu/vl.h --- kvm-27.orig/qemu/vl.h 2007-06-03 10:27:40.000000000 +0200 +++ kvm-27/qemu/vl.h 2007-06-05 22:20:45.000000000 +0200 @@ -156,6 +156,7 @@ extern int graphic_height; extern int graphic_depth; extern const char *keyboard_layout; +extern int sdl_decimate; extern int kqemu_allowed; extern int kvm_allowed; extern int win2k_install_hack; @@ -901,6 +902,7 @@ int width; int height; void *opaque; + int refresh_interval; void (*dpy_update)(struct DisplayState *s, int x, int y, int w, int h); void (*dpy_resize)(struct DisplayState *s, int w, int h);