Rewrote timer code.

The new code is based on timestamps, rather than delays. This eliminates the
need to update every timer in timer_process(), which cost a non-trivial amount
of CPU time on low-end machines.

This involved changes to every user of the timer code, so this change almost
certainly introduces bugs.
This commit is contained in:
SarahW 2018-08-02 22:06:10 +01:00
commit a7d006b637
79 changed files with 1050 additions and 1033 deletions

View file

@ -119,7 +119,7 @@ void colorplus_poll(void *p)
if (!colorplus->cga.linepos)
{
colorplus->cga.vidtime += colorplus->cga.dispofftime;
timer_advance_u64(&colorplus->cga.timer, colorplus->cga.dispofftime);
colorplus->cga.cgastat |= 1;
colorplus->cga.linepos = 1;
oldsc = colorplus->cga.sc;
@ -215,7 +215,7 @@ void colorplus_poll(void *p)
}
else
{
colorplus->cga.vidtime += colorplus->cga.dispontime;
timer_advance_u64(&colorplus->cga.timer, colorplus->cga.dispontime);
colorplus->cga.linepos = 0;
if (colorplus->cga.vsynctime)
{
@ -346,7 +346,7 @@ void *colorplus_init()
display_type = device_get_config_int("display_type");
contrast = device_get_config_int("contrast");
timer_add(colorplus_poll, &colorplus->cga.vidtime, TIMER_ALWAYS_ENABLED, colorplus);
timer_add(&colorplus->cga.timer, colorplus_poll, colorplus, 1);
mem_mapping_add(&colorplus->cga.mapping, 0xb8000, 0x08000, colorplus_read, NULL, NULL, colorplus_write, NULL, NULL, NULL, 0, colorplus);
io_sethandler(0x03d0, 0x0010, colorplus_in, NULL, NULL, colorplus_out, NULL, NULL, colorplus);