sync: Fix logic error from b55bf24858

That commit adds two hunks, and I _think_ they're backwards.  It adds
code to modify bracket_greater on NegativeTransition triggers, and
bracket_less on PositiveTransition triggers.  That breaks symmetry with
the surrounding code; the code as of this commit could probably be
simplified further.

I can't keep the sync trigger rules in my head for more than about five
minutes at a time, so I'm sending this on for more eyes.  RHEL 6.3's
xserver is shipping with b55bf248 reverted:

    https://bugzilla.redhat.com/show_bug.cgi?id=748704#c33

And there appear to be some upstream reports of the same issue:

    https://bugzilla.gnome.org/show_bug.cgi?id=658955

So I'd like to get this sorted out.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Adam Jackson 2012-07-23 16:34:28 -04:00 committed by Keith Packard
parent 454d0e3a1b
commit 4a6f42dda0

View File

@ -1038,15 +1038,15 @@ SyncComputeBracketValues(SyncCounter * pCounter)
pnewltval = &psci->bracket_less;
}
else if (XSyncValueEqual(pCounter->value, pTrigger->test_value) &&
XSyncValueLessThan(pTrigger->test_value,
psci->bracket_greater)) {
XSyncValueGreaterThan(pTrigger->test_value,
psci->bracket_less)) {
/*
* The value is exactly equal to our threshold. We want one
* more event in the positive direction to ensure we pick up
* when the value *exceeds* this threshold.
* more event in the negative direction to ensure we pick up
* when the value is less than this threshold.
*/
psci->bracket_greater = pTrigger->test_value;
pnewgtval = &psci->bracket_greater;
psci->bracket_less = pTrigger->test_value;
pnewltval = &psci->bracket_less;
}
}
else if (pTrigger->test_type == XSyncPositiveTransition &&
@ -1058,15 +1058,15 @@ SyncComputeBracketValues(SyncCounter * pCounter)
pnewgtval = &psci->bracket_greater;
}
else if (XSyncValueEqual(pCounter->value, pTrigger->test_value) &&
XSyncValueGreaterThan(pTrigger->test_value,
psci->bracket_less)) {
XSyncValueLessThan(pTrigger->test_value,
psci->bracket_greater)) {
/*
* The value is exactly equal to our threshold. We want one
* more event in the negative direction to ensure we pick up
* when the value is less than this threshold.
* more event in the positive direction to ensure we pick up
* when the value *exceeds* this threshold.
*/
psci->bracket_less = pTrigger->test_value;
pnewltval = &psci->bracket_less;
psci->bracket_greater = pTrigger->test_value;
pnewgtval = &psci->bracket_greater;
}
}
} /* end for each trigger */