[PATCH] sync: fix corner-case in triggering idle alarms

Matt Dew marcoz at osource.org
Sat Nov 16 14:19:57 PST 2013


Picked.

339af2a..6cc5efa  server-1.14-branch -> server-1.14-branch


On 11/13/2013 12:52 AM, Peter Hutterer wrote:
> 
> On Wed, Oct 30, 2013 at 04:26:05PM +1000, Peter Hutterer wrote:
>> ProcessInputEvent() resets the device idle times. If idle time was higher than
>> the lower bracket, this should trigger an event in the idle time wakeup
>> handler.
>>
>> If processing is slow, the idle time may advance past the lower bracket
>> between the reset and the time the BlockHandler is called. In that case, we'd
>> never schedule a wakeup to handle the event, causing us to randomly miss
>> events.
>>
>> Ran tests with a neg transition trigger on 5ms with 200 repeats of the test
>> and it succeeded. Anything below that gets a bit tricky to make sure the
>> server sees the same idle time as the client usleeps for.
>>
>> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> 
> Matt, please pull this into 1.14. Thanks.
> 
> git cherry-pick -x f36f5a65f639b6524191d888d5bf89e73027156c
> 
> Cheers,
>    Peter
> 
> 
>> ---
>>  Xext/sync.c | 11 ++++++++++-
>>  1 file changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/Xext/sync.c b/Xext/sync.c
>> index b2ee92e..53f769d 100644
>> --- a/Xext/sync.c
>> +++ b/Xext/sync.c
>> @@ -2654,7 +2654,16 @@ IdleTimeBlockHandler(pointer pCounter, struct timeval **wt, pointer LastSelectMa
>>      IdleTimeQueryValue(counter, &idle);
>>      counter->value = idle;      /* push, so CheckTrigger works */
>>  
>> -    if (less && XSyncValueLessOrEqual(idle, *less)) {
>> +    /**
>> +     * There's an indefinite amount of time between ProcessInputEvents()
>> +     * where the idle time is reset and the time we actually get here. idle
>> +     * may be past the lower bracket if we dawdled with the events, so
>> +     * check for whether we did reset and bomb out of select immediately.
>> +     */
>> +    if (less && XSyncValueGreaterThan(idle, *less) &&
>> +        LastEventTimeWasReset(priv->deviceid)) {
>> +        AdjustWaitForDelay(wt, 0);
>> +    } else if (less && XSyncValueLessOrEqual(idle, *less)) {
>>          /*
>>           * 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
>> -- 
>> 1.8.3.1
>>
>> _______________________________________________
>> xorg-devel at lists.x.org: X.Org development
>> Archives: http://lists.x.org/archives/xorg-devel
>> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>>


-- 
Matt Dew <marcoz at osource.org>       Key signature: 0xF7C3 BEC3
Fingerprint: FDB1 9D94 C573 DC29 BCCB 2F9F A6BF 3771 F7C3 BEC3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 555 bytes
Desc: OpenPGP digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20131116/13b925d3/attachment.pgp>


More information about the xorg-devel mailing list