From 4a6f42dda00ba3b5616f8a86f0d4c9a652c7d9d4 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Mon, 23 Jul 2012 16:34:28 -0400 Subject: [PATCH] sync: Fix logic error from b55bf248581dc66321b24b29f199f6dc8d02db1b 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 Reviewed-by: Peter Hutterer Signed-off-by: Keith Packard --- Xext/sync.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Xext/sync.c b/Xext/sync.c index b8f094db5..4d11992bb 100644 --- a/Xext/sync.c +++ b/Xext/sync.c @@ -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 */