Xext: Fix edge case with {Positive, Negative}Transition triggers.
The {Positive,Negative}Transition triggers only fire when the counter goes from strictly {below,above} the threshold. If SyncComputeBracketValues gets called exactly at this threshold we may update the bracket values so that the counter is not updated past the threshold. Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
f1542f1d71
commit
b55bf24858
22
Xext/sync.c
22
Xext/sync.c
|
@ -1059,6 +1059,17 @@ SyncComputeBracketValues(SyncCounter *pCounter)
|
||||||
{
|
{
|
||||||
psci->bracket_less = pTrigger->test_value;
|
psci->bracket_less = pTrigger->test_value;
|
||||||
pnewltval = &psci->bracket_less;
|
pnewltval = &psci->bracket_less;
|
||||||
|
} else if (XSyncValueEqual(pCounter->value, pTrigger->test_value) &&
|
||||||
|
XSyncValueLessThan(pTrigger->test_value,
|
||||||
|
psci->bracket_greater))
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
psci->bracket_greater = pTrigger->test_value;
|
||||||
|
pnewgtval = &psci->bracket_greater;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (pTrigger->test_type == XSyncPositiveTransition &&
|
else if (pTrigger->test_type == XSyncPositiveTransition &&
|
||||||
|
@ -1069,6 +1080,17 @@ SyncComputeBracketValues(SyncCounter *pCounter)
|
||||||
{
|
{
|
||||||
psci->bracket_greater = pTrigger->test_value;
|
psci->bracket_greater = pTrigger->test_value;
|
||||||
pnewgtval = &psci->bracket_greater;
|
pnewgtval = &psci->bracket_greater;
|
||||||
|
} else if (XSyncValueEqual(pCounter->value, pTrigger->test_value) &&
|
||||||
|
XSyncValueGreaterThan(pTrigger->test_value,
|
||||||
|
psci->bracket_less))
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
psci->bracket_less = pTrigger->test_value;
|
||||||
|
pnewltval = &psci->bracket_less;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} /* end for each trigger */
|
} /* end for each trigger */
|
||||||
|
|
Loading…
Reference in New Issue