From d462e52a9d0a167857f565fa73561b19d6dd4ae8 Mon Sep 17 00:00:00 2001 From: Volker Ruppert Date: Sun, 30 Apr 2017 09:07:25 +0000 Subject: [PATCH] Implemented 'realtime' option for the Voodoo update timer similar to the VGA realtime option (enabled by default). --- bochs/.bochsrc | 22 ++++++++++++---------- bochs/PARAM_TREE.txt | 1 + bochs/doc/man/bochsrc.5 | 25 ++++++++++++++----------- bochs/iodev/display/voodoo.cc | 14 ++++++++++---- bochs/iodev/display/voodoo.h | 1 + 5 files changed, 38 insertions(+), 25 deletions(-) diff --git a/bochs/.bochsrc b/bochs/.bochsrc index 6102c0efb..3434444bc 100644 --- a/bochs/.bochsrc +++ b/bochs/.bochsrc @@ -411,15 +411,15 @@ vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest # # UPDATE_FREQ # This parameter specifies the number of display updates per second. -# The VGA update timer now uses the realtime engine and the default -# value is 5. This parameter can be changed at runtime. +# The VGA update timer by default uses the realtime engine with a value +# of 5. This parameter can be changed at runtime. # # REALTIME -# If set to 1, the VGA timer is based on realtime, otherwise it is based -# on the ips setting. If the host is slow (low ips, update_freq) and the -# guest uses HLT appropriately, setting this to 0 and "clock: sync=none" -# may improve the responsiveness of the guest GUI when the guest is -# otherwise idle. The default value is 1. +# If set to 1 (default), the VGA timer is based on realtime, otherwise it +# is driven by the cpu and depends on the ips setting. If the host is slow +# (low ips, update_freq) and the guest uses HLT appropriately, setting this +# to 0 and "clock: sync=none" may improve the responsiveness of the guest +# GUI when the guest is otherwise idle. # # Examples: # vga: extension=cirrus, update_freq=10 @@ -429,11 +429,13 @@ vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest #======================================================================= # VOODOO: # This defines the Voodoo Graphics emulation (experimental). Currently -# supported models are 'voodoo1' and 'voodoo2'. The Voodoo2 support is -# not yet complete. +# supported models are 'voodoo1' and 'voodoo2'. The Voodoo2 support is not +# yet complete. The 'realtime' option is very similar to the vga realtime +# option. If set to 1 (default), the Voodoo timer is based on realtime, +# otherwise it is driven by the cpu and depends on the ips setting. # # Examples: -# voodoo: enabled=1, model=voodoo1 +# voodoo: enabled=1, model=voodoo1, realtime=1 #======================================================================= #voodoo: enabled=1, model=voodoo1 diff --git a/bochs/PARAM_TREE.txt b/bochs/PARAM_TREE.txt index 44512d82f..3a67fc892 100644 --- a/bochs/PARAM_TREE.txt +++ b/bochs/PARAM_TREE.txt @@ -133,6 +133,7 @@ display voodoo enabled model + realtime keyboard_mouse keyboard diff --git a/bochs/doc/man/bochsrc.5 b/bochs/doc/man/bochsrc.5 index 93057aaa6..b715f6876 100644 --- a/bochs/doc/man/bochsrc.5 +++ b/bochs/doc/man/bochsrc.5 @@ -1,5 +1,5 @@ .\"Document Author: Timothy R. Butler - tbutler@uninetsolutions.com" -.TH bochsrc 5 "28 Mar 2017" "bochsrc" "The Bochs Project" +.TH bochsrc 5 "30 Apr 2017" "bochsrc" "The Bochs Project" .\"SKIP_SECTION" .SH NAME bochsrc \- Configuration file for Bochs. @@ -462,16 +462,17 @@ values are 'vbe' for Bochs VBE and 'cirrus' for Cirrus SVGA support. update_freq: -Specifies the number of display updates per second. -This parameter can be changed at runtime. The default value is 5. +This parameter specifies the number of display updates per second. +The VGA update timer by default uses the realtime engine with a value +of 5. This parameter can be changed at runtime. realtime: -If set to 1, the VGA timer is based on realtime, otherwise it is based on the -ips setting. If the host is slow (low ips, update_freq) and the guest uses HLT -appropriately, setting this to 0 and "clock: sync=none" may improve the -responsiveness of the guest GUI when the guest is otherwise idle. The default -value is 1. +If set to 1 (default), the VGA timer is based on realtime, otherwise it +is driven by the cpu and depends on the ips setting. If the host is slow +(low ips, update_freq) and the guest uses HLT appropriately, setting this +to 0 and "clock: sync=none" may improve the responsiveness of the guest +GUI when the guest is otherwise idle. Examples: vga: extension=none, update_freq=10, realtime=0 @@ -481,11 +482,13 @@ Examples: .TP .I "voodoo:" This defines the Voodoo Graphics emulation (experimental). Currently -supported models are 'voodoo1' and 'voodoo2'. The Voodoo2 support is -not yet complete. +supported models are 'voodoo1' and 'voodoo2'. The Voodoo2 support is not +yet complete. The 'realtime' option is very similar to the vga realtime +option. If set to 1 (default), the Voodoo timer is based on realtime, +otherwise it is driven by the cpu and depends on the ips setting. Example: - voodoo: enabled=1, model=voodoo1 + voodoo: enabled=1, model=voodoo1, realtime=1 .TP .I "keyboard:" diff --git a/bochs/iodev/display/voodoo.cc b/bochs/iodev/display/voodoo.cc index ffb9d8e3e..6a611fb61 100644 --- a/bochs/iodev/display/voodoo.cc +++ b/bochs/iodev/display/voodoo.cc @@ -105,6 +105,11 @@ void voodoo_init_options(void) "Selects the Voodoo model to emulate.", voodoo_model_list, VOODOO_1, VOODOO_1); + new bx_param_bool_c(menu, + "realtime", + "Voodoo timer realtime", + "If enabled, the Voodoo timer is based on realtime", + 1); enabled->set_dependent_list(menu->clone()); } @@ -186,13 +191,14 @@ void bx_voodoo_c::init(void) DEV_register_pci_handlers(this, &BX_VOODOO_THIS s.devfunc, BX_PLUGIN_VOODOO, "Experimental 3dfx Voodoo Graphics (SST-1/2)"); + BX_VOODOO_THIS s.vdraw.realtime = SIM->get_param_bool("realtime", base)->get(); if (BX_VOODOO_THIS s.mode_change_timer_id == BX_NULL_TIMER_HANDLE) { BX_VOODOO_THIS s.mode_change_timer_id = bx_virt_timer.register_timer(this, mode_change_timer_handler, 1000, 0, 0, 0, "voodoo_mode_change"); } if (BX_VOODOO_THIS s.update_timer_id == BX_NULL_TIMER_HANDLE) { BX_VOODOO_THIS s.update_timer_id = bx_virt_timer.register_timer(this, update_timer_handler, - 50000, 1, 0, 1, "voodoo_update"); + 50000, 1, 0, BX_VOODOO_THIS s.vdraw.realtime, "voodoo_update"); } BX_VOODOO_THIS s.vdraw.clock_enabled = 1; BX_VOODOO_THIS s.vdraw.output_on = 0; @@ -409,7 +415,7 @@ void bx_voodoo_c::after_restore_state(void) // force update v->fbi.video_changed = 1; BX_VOODOO_THIS s.vdraw.override_on = !BX_VOODOO_THIS s.vdraw.override_on; - BX_VOODOO_THIS s.vdraw.frame_start = bx_pc_system.time_usec(); + BX_VOODOO_THIS s.vdraw.frame_start = bx_virt_timer.time_usec(BX_VOODOO_THIS s.vdraw.realtime); mode_change_timer_handler(NULL); } @@ -526,7 +532,7 @@ void bx_voodoo_c::update(void) Bit8u * tile_ptr, * tile_ptr2; bx_svga_tileinfo_t info; - BX_VOODOO_THIS s.vdraw.frame_start = bx_virt_timer.time_usec(1); + BX_VOODOO_THIS s.vdraw.frame_start = bx_virt_timer.time_usec(BX_VOODOO_THIS s.vdraw.realtime); if (v->fbi.vblank_swap_pending) { swap_buffers(v); @@ -601,7 +607,7 @@ void bx_voodoo_c::redraw_area(unsigned x0, unsigned y0, unsigned width, Bit32u bx_voodoo_c::get_retrace(void) { - Bit64u time_in_frame = bx_virt_timer.time_usec(1) - BX_VOODOO_THIS s.vdraw.frame_start; + Bit64u time_in_frame = bx_virt_timer.time_usec(BX_VOODOO_THIS s.vdraw.realtime) - BX_VOODOO_THIS s.vdraw.frame_start; if (time_in_frame >= BX_VOODOO_THIS s.vdraw.vsync_usec) { return 0; } else { diff --git a/bochs/iodev/display/voodoo.h b/bochs/iodev/display/voodoo.h index 92329cc90..7914d4114 100644 --- a/bochs/iodev/display/voodoo.h +++ b/bochs/iodev/display/voodoo.h @@ -37,6 +37,7 @@ typedef struct { bx_bool output_on; bx_bool override_on; bx_bool screen_update_pending; + bx_bool realtime; } vdraw; int mode_change_timer_id; int update_timer_id;