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

Chris Wilson chris at chris-wilson.co.uk
Tue Feb 2 11:57:43 UTC 2016


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 */))

> @@ -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
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list