The VSYNC timing is now based on the PIT clock sync mode instead of the VGA

screen update timing mode.
This commit is contained in:
Volker Ruppert 2018-05-21 07:31:18 +00:00
parent bc8ac37c63
commit e88f14558d
4 changed files with 14 additions and 9 deletions

View File

@ -2391,7 +2391,8 @@ void bx_voodoo_vga_c::banshee_set_vclk3(Bit32u value)
Bit32u bx_voodoo_vga_c::get_retrace()
{
Bit32u retval = 1;
Bit64u display_usec = bx_virt_timer.time_usec(0) % BX_VVGA_THIS s.vtotal_usec;
Bit64u display_usec =
bx_virt_timer.time_usec(BX_VVGA_THIS vsync_realtime) % BX_VVGA_THIS s.vtotal_usec;
if ((display_usec >= BX_VVGA_THIS s.vrstart_usec) &&
(display_usec <= BX_VVGA_THIS s.vrend_usec)) {
retval = 0;

View File

@ -323,7 +323,7 @@ void bx_vga_c::update(void)
/* skip screen update if the vertical retrace is in progress
(using 72 Hz vertical frequency) */
if ((bx_virt_timer.time_usec(BX_VGA_THIS realtime) % 13888) < 70)
if ((bx_virt_timer.time_usec(BX_VGA_THIS vsync_realtime) % 13888) < 70)
return;
if (BX_VGA_THIS vbe.bpp != VBE_DISPI_BPP_4) {

View File

@ -240,16 +240,19 @@ void bx_vgacore_c::init_iohandlers(bx_read_handler_t f_read, bx_write_handler_t
void bx_vgacore_c::init_systemtimer(void)
{
BX_VGA_THIS realtime = SIM->get_param_bool(BXPN_VGA_REALTIME)->get();
BX_VGA_THIS update_realtime = SIM->get_param_bool(BXPN_VGA_REALTIME)->get();
bx_param_num_c *vga_update_freq = SIM->get_param_num(BXPN_VGA_UPDATE_FREQUENCY);
Bit32u update_interval = (Bit32u)(1000000 / vga_update_freq->get());
BX_INFO(("interval=%u, mode=%s", update_interval, BX_VGA_THIS realtime ? "realtime":"standard"));
BX_INFO(("interval=%u, mode=%s", update_interval, BX_VGA_THIS update_realtime ? "realtime":"standard"));
if (BX_VGA_THIS timer_id == BX_NULL_TIMER_HANDLE) {
BX_VGA_THIS timer_id = bx_virt_timer.register_timer(this, vga_timer_handler,
update_interval, 1, 1, BX_VGA_THIS realtime, "vga");
update_interval, 1, 1, BX_VGA_THIS update_realtime, "vga");
vga_update_freq->set_handler(vga_param_handler);
vga_update_freq->set_device_param(this);
}
BX_VGA_THIS vsync_realtime =
(SIM->get_param_enum(BXPN_CLOCK_SYNC)->get() & BX_CLOCK_SYNC_REALTIME) > 0;
BX_INFO(("VSYNC using %s mode", BX_VGA_THIS vsync_realtime ? "realtime":"standard"));
// VGA text mode cursor blink frequency 1.875 Hz
if (update_interval < 266666) {
BX_VGA_THIS s.blink_counter = 266666 / (unsigned)update_interval;
@ -507,7 +510,7 @@ Bit32u bx_vgacore_c::read(Bit32u address, unsigned io_len)
// horizontal or vertical blanking period is active
retval = 0;
display_usec = bx_virt_timer.time_usec(BX_VGA_THIS realtime) % BX_VGA_THIS s.vtotal_usec;
display_usec = bx_virt_timer.time_usec(BX_VGA_THIS vsync_realtime) % BX_VGA_THIS s.vtotal_usec;
if ((display_usec >= BX_VGA_THIS s.vrstart_usec) &&
(display_usec <= BX_VGA_THIS s.vrend_usec)) {
retval |= 0x08;
@ -1377,7 +1380,7 @@ bx_bool bx_vgacore_c::skip_update(void)
return 1;
/* skip screen update if the vertical retrace is in progress */
display_usec = bx_virt_timer.time_usec(BX_VGA_THIS realtime) % BX_VGA_THIS s.vtotal_usec;
display_usec = bx_virt_timer.time_usec(BX_VGA_THIS vsync_realtime) % BX_VGA_THIS s.vtotal_usec;
if ((display_usec > BX_VGA_THIS s.vrstart_usec) &&
(display_usec < BX_VGA_THIS s.vrend_usec)) {
return 1;

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2017 The Bochs Project
// Copyright (C) 2001-2018 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -264,7 +264,8 @@ protected:
} s; // state information
int timer_id;
bx_bool realtime;
bx_bool update_realtime;
bx_bool vsync_realtime;
bx_param_string_c *vgaext;
bx_bool pci_enabled;
};