> Part of the problem is that the hardware doesnt provide any locking to
> this value. I kindof cant really belive this. Is the VGA hardware so
> broken?? A workaround (suggested by the original author) would be to wait
> for the next sync to be safe. This is an overkill if done with polling.
The world isn't just VGA; there are more types of cards out there ... What
we're facing here is a wonderfull example where compatibility (in that case
with the 6845) sometimes leads to.
> if it's possible to have the VGA card interupt us at the beginning of
> every refresh cycle (ugh), then we could timestamp it with the pentium
> counter, and for each scrolling we could compare the current timestamp
> (costs 13 cycles) with the last refresh timestamp. To avoid interrupt
> latency effects shifing the timestamp, an average timestamp value could be
> maintained. If the current time is dangerously close to the next refresh
> cycle, then we could signal the interrupt handler to update the origin.
> Otherwise the origin can be updated in __set_origin() (this would be the
> ususal case).
Not every system has superfluous timers to spend on such updating procedures;
not every graphics board can generate interrupts and sometimes the kernel
runs relativly long with interrupts disabled which can ruin your approach
that requires a exact timing.
Ralf