Around 15 o'clock on Sep 24, Juliusz Chroboczek wrote:

> KP>  a)       The original A/UX server had checkForInput marked from the SIGIO 
> KP>   handler and read device events in ProcessInputEvents.
> 
> Why?

There are two goals when dealing with input in the X server:

1)      Notice available input quickly, process it as soon as possible
2)      Timestamp events accurately

Without asynchronous notification (SIGIO), the X server will poll file
descriptors for input devices when it polls for input from clients.  With
the time-based scheduler, this happens every 20ms+ while the server is 
busy.  Any kind of asynchronous notification that can make the 
checkForInput values change will cause the server to suspend request 
processing after the current request and call ProcessInputEvents.  That 
reduces the latency to no more than one request time, generally much less 
than 20ms+.

So, the simple SIGIO-variable method was sufficient to eliminate as much
event processing latency as is practical in the X server -- checkForInput
would change, and the server would call ProcessInputEvents immediately.  No
extra event queue was needed as events could be dumped straight into DIX.

However, if the kernel events don't include a timestamp, you end up
timestamping them when they're read, which will introduce significant
errors.  I fixed this in R5 by writing the mi event queue code which could 
read input at SIGIO time, timestamp events correctly and then process them 
at ProcessInputEvents time.  This was mostly done so that the sprite would 
track the mouse more accurately.

An additional benefit of reading at SIGIO time is that event streams are 
more likely to be interleaved correctly.  Delaying the read until 
ProcessInputEvents may let events from multiple devices queue up in the 
kernel; the X server then has no idea what order they originally occured 
in; older code would simply read all events from one device before looking 
at another.

Better yet would be to have the kernel timestamp events with a 
high-precision timer so that the X server could insert them into the event 
queue in proper order; that would improve event handling even if events 
were read at SIGIO time.

-keith


_______________________________________________
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel

Reply via email to