[PATCH v2 9/9] Xext: Add per-device SyncCounters

James Jones jajones at nvidia.com
Tue Mar 20 09:03:49 PDT 2012


On 3/20/12 12:04 AM, Peter Hutterer wrote:
> On Fri, Mar 16, 2012 at 06:15:30PM -0700, James Jones wrote:
>> Below:
>>> +SyncCounter*
>>> +SyncInitDeviceIdleTime(DeviceIntPtr dev)
>>> +{
>>> +    char timer_name[64];
>>> +    sprintf(timer_name, "DEVICEIDLETIME %d", dev->id);
>>> +
>>> +    return init_system_idle_counter(timer_name, dev->id);
>>> +}
>>> +
>>> +void SyncRemoveDeviceIdleTime(SyncCounter *counter)
>>> +{
>>> +    /* ResetProc frees the list before devices are shutdown and try to
>>> +     * delete their counters again */
>>
>> Is this comment true?  I didn't see code to do so in 1/9.  Did you forget
>> to add it there, or forget to clean up this comment?  Or is it just too
>> late in Friday for me to be reading code correctly :-)
>
> not 100% correct anymore, but the condition is still needed. Now the problem
> is "FreeAllResources() frees all system counters before the devices are shut
> down, check if there are any left before freeing the device's counter"
> I'll change the comment to the above.
>
> Cheers,
>    Peter

Ah, OK, thanks.  Given that change,

Reviewed-by: James Jones <jajones at nvidia.com>

For the series.

-James

>>> +    if (!xorg_list_is_empty(&SysCounterList))
>>> +        xorg_list_del(&counter->pSysCounterInfo->entry);
>>> +}
>>> +
>>> diff --git a/Xext/syncsrv.h b/Xext/syncsrv.h
>>> index 27b533c..84c7aee 100644
>>> --- a/Xext/syncsrv.h
>>> +++ b/Xext/syncsrv.h
>>> @@ -139,4 +139,7 @@ extern void SyncDestroySystemCounter(
>>>    );
>>>
>>>    extern void SyncExtensionInit(void);
>>> +
>>> +extern SyncCounter *SyncInitDeviceIdleTime(DeviceIntPtr dev);
>>> +extern void SyncRemoveDeviceIdleTime(SyncCounter *counter);
>>>    #endif /* _SYNCSRV_H_ */
>>> diff --git a/dix/devices.c b/dix/devices.c
>>> index 7478ad6..a488d41 100644
>>> --- a/dix/devices.c
>>> +++ b/dix/devices.c
>>> @@ -87,6 +87,7 @@ SOFTWARE.
>>>    #include "enterleave.h" /* for EnterWindow() */
>>>    #include "xserver-properties.h"
>>>    #include "xichangehierarchy.h" /* For XISendDeviceHierarchyEvent */
>>> +#include "syncsrv.h"
>>>
>>>    /** @file
>>>     * This file handles input device-related stuff.
>>> @@ -419,9 +420,13 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent)
>>>
>>>        RecalculateMasterButtons(dev);
>>>
>>> +    /* initialise an idle timer for this device*/
>>> +    dev->idle_counter = SyncInitDeviceIdleTime(dev);
>>> +
>>>        return TRUE;
>>>    }
>>>
>>> +
>>>    /**
>>>     * Switch a device off through the driver and push it onto the off_devices
>>>     * list. A device will not send events while disabled. All clients are
>>> @@ -447,6 +452,9 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
>>>        if (*prev != dev)
>>>    	return FALSE;
>>>
>>> +    SyncRemoveDeviceIdleTime(dev->idle_counter);
>>> +    dev->idle_counter = NULL;
>>> +
>>>        /* float attached devices */
>>>        if (IsMaster(dev))
>>>        {
>>> diff --git a/include/inputstr.h b/include/inputstr.h
>>> index 86db811..7517b8e 100644
>>> --- a/include/inputstr.h
>>> +++ b/include/inputstr.h
>>> @@ -606,6 +606,8 @@ typedef struct _DeviceIntRec {
>>>
>>>        /* XTest related master device id */
>>>        int xtest_master_id;
>>> +
>>> +    struct _SyncCounter *idle_counter;
>>>    } DeviceIntRec;
>>>
>>>    typedef struct {
>>

nvpublic


More information about the xorg-devel mailing list