- added new parameter 'update_freq' for the 'vga' option that should replace the

'vga_update_interval' option. The screen update frequency is still based on
  the emulated clock unless the realtime sync is enabled with the 'clock' option.
  TODO: rewrite the virt_timer code to support realtime screen updates
  independent from 'clock' setting.
- fixed changing parameter 'update_freq' at runtime (timer object and blink counter)
This commit is contained in:
Volker Ruppert 2011-07-26 22:16:24 +00:00
parent 84636ca141
commit eb0c06f357
5 changed files with 76 additions and 48 deletions

View File

@ -281,12 +281,25 @@ vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest
#=======================================================================
# VGA:
# Here you can specify the display extension to be used. With the value
# 'none' you can use standard VGA with no extension. Other supported
# values are 'vbe' for Bochs VBE and 'cirrus' for Cirrus SVGA support.
# This defines some parameter related to the VGA display
#
# EXTENSION
# Here you can specify the display extension to be used. With the value
# 'none' you can use standard VGA with no extension. Other supported
# values are 'vbe' for Bochs VBE and 'cirrus' for Cirrus SVGA support.
#
# UPDATE_FREQ
# The VGA update frequency is based on the emulated clock and the default
# value is 5. Keep in mind that you must tweak the 'cpu: ips=N' directive
# to be as close to the number of emulated instructions-per-second your
# workstation can do, for this to be accurate. If the realtime sync is
# enabled with the 'clock' option, the value is based on the real time.
# This parameter can be changed at runtime.
#
# Examples:
# vga: extension=cirrus, update_freq: 10
#=======================================================================
#vga: extension=cirrus
vga: extension=vbe
#vga: extension=vbe, update_freq=5
#=======================================================================
# FLOPPYA:
@ -650,20 +663,6 @@ parport1: enabled=1, file="parport.out"
#=======================================================================
#es1370: enabled=1, wavedev=alsa
#=======================================================================
# VGA_UPDATE_INTERVAL:
# Video memory is scanned for updates and screen is updated every so many
# virtual microseconds. The default value is 50000, about 20Hz based on the
# emulated clock. Keep in mind that you must tweak the 'cpu: ips=N' directive
# to be as close to the number of emulated instructions-per-second your
# workstation can do, for this to be accurate. This parameter can be changed
# at runtime.
#
# Examples:
# vga_update_interval: 250000
#=======================================================================
vga_update_interval: 300000
#=======================================================================
# KEYBOARD_SERIAL_DELAY:
# Approximate time in microseconds that it takes one character to

View File

@ -712,13 +712,13 @@ void bx_init_options()
screenmode->set_enabled(0);
#endif
bx_param_num_c *vga_update_interval = new bx_param_num_c(display,
"vga_update_interval",
"VGA Update Interval",
"Number of microseconds between VGA updates",
40000, BX_MAX_BIT32U,
50000);
vga_update_interval->set_ask_format ("Type a new value for VGA update interval: [%d] ");
bx_param_num_c *vga_update_freq = new bx_param_num_c(display,
"vga_update_frequency",
"VGA Update Frequency",
"Number of VGA updates per emulated second",
1, 60,
5);
vga_update_freq->set_ask_format ("Type a new value for VGA update frequency: [%d] ");
bx_param_string_c *vga_extension = new bx_param_string_c(display,
"vga_extension",
@ -1752,7 +1752,7 @@ void bx_init_options()
usb->set_options(usb->SHOW_PARENT | usb->USE_TAB_WINDOW);
// misc runtime options
bx_param_c *rt_misc_init_list[] = {
SIM->get_param_num(BXPN_VGA_UPDATE_INTERVAL),
SIM->get_param_num(BXPN_VGA_UPDATE_FREQUENCY),
SIM->get_param_bool(BXPN_MOUSE_ENABLED),
SIM->get_param_num(BXPN_KBD_PASTE_DELAY),
SIM->get_param_string(BXPN_USER_SHORTCUT),
@ -2824,16 +2824,27 @@ static int parse_line_formatted(const char *context, int num_params, char *param
}
}
} else if (!strcmp(params[0], "vga_update_interval")) {
Bit64u value;
if (num_params != 2) {
PARSE_ERR(("%s: vga_update_interval directive: wrong # args.", context));
}
SIM->get_param_num(BXPN_VGA_UPDATE_INTERVAL)->set(atol(params[1]));
} else if (!strcmp(params[0], "vga")) {
if (num_params != 2) {
PARSE_ERR(("%s: vga directive: wrong # args.", context));
value = atol(params[1]);
if (value > 0) {
SIM->get_param_num(BXPN_VGA_UPDATE_FREQUENCY)->set(1000000 / value);
PARSE_WARN(("%s: 'vga_update_interval' will be replaced by new 'vga: update_freq' option.", context));
} else {
PARSE_ERR(("%s: invalid value for vga_update_interval", context));
}
if (!strncmp(params[1], "extension=", 10)) {
SIM->get_param_string(BXPN_VGA_EXTENSION)->set(&params[1][10]);
} else if (!strcmp(params[0], "vga")) {
if (num_params < 2) {
PARSE_ERR(("%s: vga directive malformed.", context));
}
for (i=1; i<num_params; i++) {
if (!strncmp(params[i], "extension=", 10)) {
SIM->get_param_string(BXPN_VGA_EXTENSION)->set(&params[i][10]);
} else if (!strncmp(params[i], "update_freq=", 12)) {
SIM->get_param_num(BXPN_VGA_UPDATE_FREQUENCY)->set(atol(&params[i][12]));
}
}
} else if (!strcmp(params[0], "keyboard_serial_delay")) {
if (num_params != 2) {
@ -3058,7 +3069,7 @@ static int parse_line_formatted(const char *context, int num_params, char *param
}
} else if ((!strcmp(params[0], "pci")) ||
(!strcmp(params[0], "i440fxsupport"))) {
// new option for future extensions
// new option 'pci' for future extensions
char tmpdev[80];
int enabled = -1;
int chipset = -1;
@ -3936,8 +3947,9 @@ int bx_write_configuration(const char *rc, int overwrite)
SIM->get_param_num(BXPN_PCIDEV_VENDOR)->get(),
SIM->get_param_num(BXPN_PCIDEV_DEVICE)->get());
}
fprintf(fp, "vga_update_interval: %u\n", SIM->get_param_num(BXPN_VGA_UPDATE_INTERVAL)->get());
fprintf(fp, "vga: extension=%s\n", SIM->get_param_string(BXPN_VGA_EXTENSION)->getptr());
fprintf(fp, "vga: extension=%s, update_freq=%u\n",
SIM->get_param_string(BXPN_VGA_EXTENSION)->getptr(),
SIM->get_param_num(BXPN_VGA_UPDATE_FREQUENCY)->get());
#if BX_SUPPORT_SMP
fprintf(fp, "cpu: count=%u:%u:%u, ips=%u, quantum=%d, ",
SIM->get_param_num(BXPN_CPU_NPROCESSORS)->get(), SIM->get_param_num(BXPN_CPU_NCORES)->get(),

View File

@ -39,6 +39,7 @@
#include "iodev.h"
#include "vga.h"
#include "svga_cirrus.h"
#include "virt_timer.h"
#if BX_SUPPORT_CLGD54XX
@ -826,10 +827,18 @@ void bx_svga_cirrus_c::trigger_timer(void *this_ptr)
Bit64s bx_svga_cirrus_c::svga_param_handler(bx_param_c *param, int set, Bit64s val)
{
Bit32u interval;
if (set) {
BX_INFO (("Changing timer interval to %d", (Bit32u)val));
BX_CIRRUS_THIS svga_timer_handler (theSvga);
bx_pc_system.activate_timer (BX_CIRRUS_THIS timer_id, (Bit32u)val, 1);
interval = (Bit32u)(1000000 / val);
BX_INFO(("Changing timer interval to %d", interval));
BX_CIRRUS_THIS svga_timer_handler(theSvga);
bx_virt_timer.activate_timer(BX_CIRRUS_THIS timer_id, interval, 1);
if (interval < 300000) {
BX_CIRRUS_THIS s.blink_counter = 300000 / (unsigned)interval;
} else {
BX_CIRRUS_THIS s.blink_counter = 1;
}
}
return val;
}

View File

@ -113,7 +113,7 @@ bx_vga_c::~bx_vga_c()
delete [] s.memory;
s.memory = NULL;
}
SIM->get_param_num(BXPN_VGA_UPDATE_INTERVAL)->set_handler(NULL);
SIM->get_param_num(BXPN_VGA_UPDATE_FREQUENCY)->set_handler(NULL);
BX_DEBUG(("Exit"));
}
@ -386,14 +386,14 @@ void bx_vga_c::init_iohandlers(bx_read_handler_t f_read, bx_write_handler_t f_wr
void bx_vga_c::init_systemtimer(bx_timer_handler_t f_timer, param_event_handler f_param)
{
bx_param_num_c *vga_update_interval = SIM->get_param_num(BXPN_VGA_UPDATE_INTERVAL);
Bit64u interval = vga_update_interval->get();
bx_param_num_c *vga_update_freq = SIM->get_param_num(BXPN_VGA_UPDATE_FREQUENCY);
Bit64u interval = 1000000 / vga_update_freq->get();
BX_INFO(("interval=" FMT_LL "u", interval));
if (BX_VGA_THIS timer_id == BX_NULL_TIMER_HANDLE) {
BX_VGA_THIS timer_id = bx_virt_timer.register_timer(this, f_timer,
(Bit32u)interval, 1, 1, "vga");
vga_update_interval->set_handler(f_param);
vga_update_interval->set_runtime_param(1);
vga_update_freq->set_handler(f_param);
vga_update_freq->set_runtime_param(1);
}
if (interval < 300000) {
BX_VGA_THIS s.blink_counter = 300000 / (unsigned)interval;
@ -1484,11 +1484,19 @@ void bx_vga_c::write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_l
Bit64s bx_vga_c::vga_param_handler(bx_param_c *param, int set, Bit64s val)
{
// handler for runtime parameter 'vga_update_interval'
Bit32u interval;
// handler for runtime parameter 'vga: update_freq'
if (set) {
BX_INFO(("Changing timer interval to %d", (Bit32u)val));
interval = (Bit32u)(1000000 / val);
BX_INFO(("Changing timer interval to %d", interval));
BX_VGA_THIS timer_handler(theVga);
bx_pc_system.activate_timer(BX_VGA_THIS timer_id, (Bit32u)val, 1);
bx_virt_timer.activate_timer(BX_VGA_THIS timer_id, interval, 1);
if (interval < 300000) {
BX_VGA_THIS s.blink_counter = 300000 / (unsigned)interval;
} else {
BX_VGA_THIS s.blink_counter = 1;
}
}
return val;
}

View File

@ -97,7 +97,7 @@
#define BXPN_FULLSCREEN "display.fullscreen"
#define BXPN_SCREENMODE "display.screenmode"
#define BXPN_VGA_EXTENSION "display.vga_extension"
#define BXPN_VGA_UPDATE_INTERVAL "display.vga_update_interval"
#define BXPN_VGA_UPDATE_FREQUENCY "display.vga_update_frequency"
#define BXPN_KBD_TYPE "keyboard_mouse.keyboard.type"
#define BXPN_KBD_SERIAL_DELAY "keyboard_mouse.keyboard.serial_delay"
#define BXPN_KBD_PASTE_DELAY "keyboard_mouse.keyboard.paste_delay"