xserver-multidpi/Xext
Peter Hutterer e57ec99b03 sync: always set the brackets (#59644)
The current code sets bracket_greater to the first trigger after the current
value, and bracket_less to the last trigger before the current value.

For example, the idle timer with three negative and three positive transitions
would set this:

         nt1       nt2                 nt3
|--------|------|--|------- idle --|---|--|-----> t
               pt1                pt2    pt3
bracket_less == nt2
bracket_greater == pt2

This is an optimization so we can skip code paths in the block/wakeup handlers
if the current value doesn't meet any of the trigger requirements. Those
handlers largely do a
   if (bracket_less is less than current value &&
       bracket_greater is greater than current value)
        return, nothing to do

However, unless the bracket values are updated at the correct time, the
following may happen:

                                      nt
|--------------|---------- idle ------|--------> t
               pt

In this case, neither bracket is set, we're past the pos transition and not
yet at the neg transition. idle may now go past nt, but the brackets are not
updated. If idle is then reset to 0, no alarm is triggered for nt. Likewise,
idle may now go past pt and no alarm is triggered.

Changing an alarm or triggering an alarm will re-calculate the brackets, so
this bug is somewhat random. If any other client triggers an alarm when the
brackets are wrongly NULL, the recalculation will set them this bug may not
appear.

This patch changes the behavior, so that the brackets are always the nearest
positive or negative transitions to the current counter value. In the example
above, nt will trigger a wakeup and a re-calculation of the brackets, so that
going past it in the negative direction will then cause the proper alarm
triggers.

Or, in Keith's words:

  Timer currently past a positive trigger
      No bracket values, because no trigger in range

  Timer moves backwards before the positive trigger
      Brackets not reset, even though there is now a trigger in range

  Timer moves forward past the positive trigger
      Trigger doesn't fire because brackets not set

Setting the LT bracket in this case will cause everything to get
re-evaluated when the sync value moves backwards before the trigger
value.

X.Org Bug 59644 <http://bugs.freedesktop.org/show_bug.cgi?id=59644>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-10-18 16:46:33 +10:00
..
bigreq.c Move extension initialisation prototypes into extinit.h 2012-07-09 23:06:41 -07:00
dpms.c Move extension initialisation prototypes into extinit.h 2012-07-09 23:06:41 -07:00
dpmsproc.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
dpmsstubs.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
geext.c GE: Remove unused RT_GECLIENT 2012-07-10 00:42:10 -07:00
geext.h Move extension initialisation prototypes into extinit.h 2012-07-09 23:06:41 -07:00
geint.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
hashtable.c Xext: include dix-config.h 2012-05-24 15:52:38 +10:00
hashtable.h Xext: add a generic hashtable implementation 2012-04-18 12:49:06 +03:00
Makefile.am Xext: Only build one library 2012-07-10 00:01:49 -07:00
panoramiX.c dix: FIXES is not optional 2013-09-10 13:28:24 -04:00
panoramiX.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
panoramiXh.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
panoramiXprocs.c Use C99 designated initializers in Xext Replies 2012-07-09 19:58:30 -07:00
panoramiXsrv.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
panoramiXSwap.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
saver.c dix: provide accessor methods for the last device event time 2013-10-18 16:44:32 +10:00
security.c security: Don't count RetainPermanent clients twice 2013-09-10 13:26:25 -04:00
securitysrv.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
shape.c Move extension initialisation prototypes into extinit.h 2012-07-09 23:06:41 -07:00
shm.c Xext: fix shadow warnings 2012-11-05 13:25:08 -06:00
shmint.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
sleepuntil.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
sleepuntil.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
sync.c sync: always set the brackets (#59644) 2013-10-18 16:46:33 +10:00
syncsdk.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
syncsrv.h Move extension initialisation prototypes into extinit.h 2012-07-09 23:06:41 -07:00
xace.c Xext: fix shadow warnings 2012-11-05 13:25:08 -06:00
xace.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xacestr.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xcmisc.c Move extension initialisation prototypes into extinit.h 2012-07-09 23:06:41 -07:00
xf86bigfont.c Xext: fix unused variable warnings in xf86bigfont.c 2012-11-05 13:25:06 -06:00
xf86bigfontsrv.h Move extension initialisation prototypes into extinit.h 2012-07-09 23:06:41 -07:00
xres.c Xext: fix redundant redeclaration warnings 2012-11-05 13:25:07 -06:00
xselinux_ext.c Move extension initialisation prototypes into extinit.h 2012-07-09 23:06:41 -07:00
xselinux_hooks.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xselinux_label.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xselinux.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xselinuxint.h Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
xtest.c Xext: if a root window is given in XTestFakeInput, move to that 2013-02-08 13:49:49 +10:00
xvdisp.c Xext: renaming shadowing variable 2013-02-15 11:58:27 +10:00
xvdisp.h Fix swapped Xv dispatch under Xinerama. 2007-12-02 14:15:36 -05:00
xvdix.h Xv: Remove excessive module-induced indirection 2012-07-09 23:28:37 -07:00
xvmain.c Stop the shouting 2013-04-16 13:54:59 +10:00
xvmc.c Fix two more C99 initialization mistakes using members of same struct 2012-07-16 21:24:49 -07:00
xvmcext.h Move Xv and XvMC from extmod to built-in 2012-07-09 23:28:37 -07:00