Xext: localise pIdleTimeValueLess/Greater
Cleanup for future features, no functional changes. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: James Jones <jajones@nvidia.com>
This commit is contained in:
parent
43eb2f2758
commit
3ddae647c3
28
Xext/sync.c
28
Xext/sync.c
|
@ -2596,18 +2596,20 @@ static void
|
||||||
IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask)
|
IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask)
|
||||||
{
|
{
|
||||||
SyncCounter *counter = IdleTimeCounter;
|
SyncCounter *counter = IdleTimeCounter;
|
||||||
|
XSyncValue *less = pIdleTimeValueLess,
|
||||||
|
*greater = pIdleTimeValueGreater;
|
||||||
XSyncValue idle, old_idle;
|
XSyncValue idle, old_idle;
|
||||||
SyncTriggerList *list = counter->sync.pTriglist;
|
SyncTriggerList *list = counter->sync.pTriglist;
|
||||||
SyncTrigger *trig;
|
SyncTrigger *trig;
|
||||||
|
|
||||||
if (!pIdleTimeValueLess && !pIdleTimeValueGreater)
|
if (!less && !greater)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
old_idle = counter->value;
|
old_idle = counter->value;
|
||||||
IdleTimeQueryValue(NULL, &idle);
|
IdleTimeQueryValue(NULL, &idle);
|
||||||
counter->value = idle; /* push, so CheckTrigger works */
|
counter->value = idle; /* push, so CheckTrigger works */
|
||||||
|
|
||||||
if (pIdleTimeValueLess && XSyncValueLessOrEqual(idle, *pIdleTimeValueLess)) {
|
if (less && XSyncValueLessOrEqual(idle, *less)) {
|
||||||
/*
|
/*
|
||||||
* We've been idle for less than the threshold value, and someone
|
* We've been idle for less than the threshold value, and someone
|
||||||
* wants to know about that, but now we need to know whether they
|
* wants to know about that, but now we need to know whether they
|
||||||
|
@ -2629,10 +2631,10 @@ IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask)
|
||||||
* idle time greater than this. Schedule a wakeup for the next
|
* idle time greater than this. Schedule a wakeup for the next
|
||||||
* millisecond so we won't miss a transition.
|
* millisecond so we won't miss a transition.
|
||||||
*/
|
*/
|
||||||
if (XSyncValueEqual(idle, *pIdleTimeValueLess))
|
if (XSyncValueEqual(idle, *less))
|
||||||
AdjustWaitForDelay(wt, 1);
|
AdjustWaitForDelay(wt, 1);
|
||||||
}
|
}
|
||||||
else if (pIdleTimeValueGreater) {
|
else if (greater) {
|
||||||
/*
|
/*
|
||||||
* There's a threshold in the positive direction. If we've been
|
* There's a threshold in the positive direction. If we've been
|
||||||
* idle less than it, schedule a wakeup for sometime in the future.
|
* idle less than it, schedule a wakeup for sometime in the future.
|
||||||
|
@ -2641,11 +2643,11 @@ IdleTimeBlockHandler(pointer env, struct timeval **wt, pointer LastSelectMask)
|
||||||
*/
|
*/
|
||||||
unsigned long timeout = -1;
|
unsigned long timeout = -1;
|
||||||
|
|
||||||
if (XSyncValueLessThan(idle, *pIdleTimeValueGreater)) {
|
if (XSyncValueLessThan(idle, *greater)) {
|
||||||
XSyncValue value;
|
XSyncValue value;
|
||||||
Bool overflow;
|
Bool overflow;
|
||||||
|
|
||||||
XSyncValueSubtract(&value, *pIdleTimeValueGreater, idle, &overflow);
|
XSyncValueSubtract(&value, *greater, idle, &overflow);
|
||||||
timeout = min(timeout, XSyncValueLow32(value));
|
timeout = min(timeout, XSyncValueLow32(value));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -2670,16 +2672,16 @@ IdleTimeWakeupHandler(pointer env, int rc, pointer LastSelectMask)
|
||||||
{
|
{
|
||||||
SyncCounter *counter = IdleTimeCounter;
|
SyncCounter *counter = IdleTimeCounter;
|
||||||
XSyncValue idle;
|
XSyncValue idle;
|
||||||
|
XSyncValue *less = pIdleTimeValueLess,
|
||||||
|
*greater = pIdleTimeValueGreater;
|
||||||
|
|
||||||
if (!pIdleTimeValueLess && !pIdleTimeValueGreater)
|
if (!less && !greater)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IdleTimeQueryValue(NULL, &idle);
|
IdleTimeQueryValue(NULL, &idle);
|
||||||
|
|
||||||
if ((pIdleTimeValueGreater &&
|
if ((greater && XSyncValueGreaterOrEqual(idle, *greater)) ||
|
||||||
XSyncValueGreaterOrEqual(idle, *pIdleTimeValueGreater)) ||
|
(less && XSyncValueLessOrEqual(idle, *less))) {
|
||||||
(pIdleTimeValueLess &&
|
|
||||||
XSyncValueLessOrEqual(idle, *pIdleTimeValueLess))) {
|
|
||||||
SyncChangeCounter(counter, idle);
|
SyncChangeCounter(counter, idle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2688,7 +2690,9 @@ static void
|
||||||
IdleTimeBracketValues(pointer pCounter, CARD64 * pbracket_less,
|
IdleTimeBracketValues(pointer pCounter, CARD64 * pbracket_less,
|
||||||
CARD64 * pbracket_greater)
|
CARD64 * pbracket_greater)
|
||||||
{
|
{
|
||||||
Bool registered = (pIdleTimeValueLess || pIdleTimeValueGreater);
|
XSyncValue *less = pIdleTimeValueLess,
|
||||||
|
*greater = pIdleTimeValueGreater;
|
||||||
|
Bool registered = (less || greater);
|
||||||
|
|
||||||
if (registered && !pbracket_less && !pbracket_greater) {
|
if (registered && !pbracket_less && !pbracket_greater) {
|
||||||
RemoveBlockAndWakeupHandlers(IdleTimeBlockHandler,
|
RemoveBlockAndWakeupHandlers(IdleTimeBlockHandler,
|
||||||
|
|
Loading…
Reference in New Issue