[Intel-gfx] [PATCH 01/12] drm/i915: Add wait_for_us

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Tue Feb 2 14:04:55 UTC 2016



On 02/02/16 11:57, Chris Wilson wrote:
> On Tue, Feb 02, 2016 at 11:06:19AM +0000, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>>
>> This is for callers who want micro-second precision but are not
>> waiting from the atomic context.
>
> linux/time.h provides us with USEC_PER_MSEC that would help to break up
> these large numbers better for human consumption.
>
> 2000 -> 2*USEC_PER_SEC
> 10 -> 10*USEC_PER_MSEC
>
> Maybe:
>
> #define wait_for_seconds(x) ((x)*USEC_PER_SEC)
> #define wait_for_milliseconds(x) ((x)*USEC_PER_MSEC)
>
> if (_wait_for((I915_READ(pp_stat_reg) & mask) == value,
> 	      wait_for_seconds(5) /* timeout */,
> 	      wait_for_millseconds(10) /* interval */))

There are only two callers where it would be a bit interesting so it 
just feels like needless change to me at the moment. Better to keep the 
established conventions for these two macros.

>> @@ -55,7 +55,7 @@
>>   			break;						\
>>   		}							\
>>   		if ((W) && drm_can_sleep()) {				\
>
> Note after the atomic conversion, we can also do the !atomic assert here
> and kill the drm_can_sleep() check

Noted. Maybe I'll put a comment somewhere.

Regards,

Tvrtko


More information about the Intel-gfx mailing list