Skip to content

Commit

Permalink
Xext: Fix edge case with {Positive, Negative}Transition triggers.
Browse files Browse the repository at this point in the history
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>
(cherry picked from commit b55bf24)
  • Loading branch information
RAOF authored and jeremyhu committed Dec 21, 2010
1 parent a2c674b commit 625cb4c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Xext/sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,17 @@ SyncComputeBracketValues(SyncCounter *pCounter)
{
psci->bracket_less = pTrigger->test_value;
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 &&
Expand All @@ -969,6 +980,17 @@ SyncComputeBracketValues(SyncCounter *pCounter)
{
psci->bracket_greater = pTrigger->test_value;
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 */
Expand Down

0 comments on commit 625cb4c

Please sign in to comment.