public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH v4] drm/i915: use hrtimer in wait for vblank
@ 2014-03-25  8:58 Arun R Murthy
  2014-03-25  9:07 ` Chris Wilson
  0 siblings, 1 reply; 8+ messages in thread
From: Arun R Murthy @ 2014-03-25  8:58 UTC (permalink / raw)
  To: daniel.vetter, jani.nikula, intel-gfx, airlied, chris; +Cc: Arun R Murthy

In wait for vblank use usleep_range, which will use hrtimers instead of
msleep. Using msleep(1~20) there are more chances of sleeping for 20ms.
Using usleep_range uses hrtimers and hence are precise, worst case will
trigger an interrupt at the higher/max timeout.

As per kernel document "Documentation/timers/timers-howto.txt" sleeping
for 10us to 20ms its recomended to use usleep_range.

Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
---
 drivers/gpu/drm/i915/intel_drv.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 44067bc..29a8664 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -52,7 +52,10 @@
 			break;						\
 		}							\
 		if (W && drm_can_sleep())  {				\
-			msleep(W);					\
+			if (W > 20)					\
+				msleep(W);				\
+			else						\
+				usleep_range(W * 1000, W * 2 * 1000);	\
 		} else {						\
 			cpu_relax();					\
 		}							\
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-04-01  7:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-25  8:58 [PATCH v4] drm/i915: use hrtimer in wait for vblank Arun R Murthy
2014-03-25  9:07 ` Chris Wilson
2014-03-25  9:32   ` Jani Nikula
2014-03-25  9:46     ` Murthy, Arun R
2014-03-27  4:48       ` Murthy, Arun R
2014-04-01  4:44         ` Murthy, Arun R
2014-04-01  7:29           ` Daniel Vetter
2014-03-25 10:00     ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox