aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-12-04 05:12:54 -0500
committerJani Nikula <jani.nikula@intel.com>2014-12-05 08:20:24 -0500
commit7bd0e226e313547add65c7e4b0ecf65cb981a3c6 (patch)
treefe3e62205d3e573637a7098c51f3b47610ba1e8b /drivers/gpu
parentaf15d2ce5d497ba6535dead782cfadbcc83d90fe (diff)
drm/i915: compute wait_ioctl timeout correctly
We've lost the +1 required for correct timeouts in commit 5ed0bdf21a85d78e04f89f15ccf227562177cbd9 Author: Thomas Gleixner <tglx@linutronix.de> Date: Wed Jul 16 21:05:06 2014 +0000 drm: i915: Use nsec based interfaces Use ktime_get_raw_ns() and get rid of the back and forth timespec conversions. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: John Stultz <john.stultz@linaro.org> So fix this up by reinstating our handrolled _timeout function. While at it bother with handling MAX_JIFFIES. v2: Convert to usecs (we don't care about the accuracy anyway) first to avoid overflow issues Dave Gordon spotted. v3: Drop the explicit MAX_JIFFY_OFFSET check, usecs_to_jiffies should take care of that already. It might be a bit too enthusiastic about it though. v4: Chris has a much nicer color, so use his implementation. This requires to export nsec_to_jiffies from time.c. Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Dave Gordon <david.s.gordon@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82749 Cc: Thomas Gleixner <tglx@linutronix.de> Cc: John Stultz <john.stultz@linaro.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Acked-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h5
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c3
2 files changed, 7 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index bb1892d72efe..be910d249ea1 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -3032,6 +3032,11 @@ static inline unsigned long msecs_to_jiffies_timeout(const unsigned int m)
3032 return min_t(unsigned long, MAX_JIFFY_OFFSET, j + 1); 3032 return min_t(unsigned long, MAX_JIFFY_OFFSET, j + 1);
3033} 3033}
3034 3034
3035static inline unsigned long nsecs_to_jiffies_timeout(const u64 n)
3036{
3037 return min_t(u64, MAX_JIFFY_OFFSET, nsecs_to_jiffies64(n) + 1);
3038}
3039
3035static inline unsigned long 3040static inline unsigned long
3036timespec_to_jiffies_timeout(const struct timespec *value) 3041timespec_to_jiffies_timeout(const struct timespec *value)
3037{ 3042{
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index d2ba315f4c92..820bc984082e 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1227,7 +1227,8 @@ int __i915_wait_seqno(struct intel_engine_cs *ring, u32 seqno,
1227 if (i915_seqno_passed(ring->get_seqno(ring, true), seqno)) 1227 if (i915_seqno_passed(ring->get_seqno(ring, true), seqno))
1228 return 0; 1228 return 0;
1229 1229
1230 timeout_expire = timeout ? jiffies + nsecs_to_jiffies((u64)*timeout) : 0; 1230 timeout_expire = timeout ?
1231 jiffies + nsecs_to_jiffies_timeout((u64)*timeout) : 0;
1231 1232
1232 if (INTEL_INFO(dev)->gen >= 6 && ring->id == RCS && can_wait_boost(file_priv)) { 1233 if (INTEL_INFO(dev)->gen >= 6 && ring->id == RCS && can_wait_boost(file_priv)) {
1233 gen6_rps_boost(dev_priv); 1234 gen6_rps_boost(dev_priv);