drm/i915: s/mdelay/msleep/
Subsystems (2)
PATCH 1/1 drm/i915: s/mdelay/msleep/
The first in wait_pipe_off is really just a delay loop to wait for the scanline counter to settle (which takes about a frame worth of time). So also shrink it a bit.
The other is in the ilk dprs code. If we need _exactly_ an 1ms wait in there, that's already not guaranteed with the current code (since especially at start-up we're likely to get scheduled away in between). So replace those, too.
Noticed while trying to understand why we've again broken the panel fitter.
--- drivers/gpu/drm/i915/intel_display.c | 2 +- drivers/gpu/drm/i915/intel_pm.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -990,7 +990,7 @@ void intel_wait_for_pipe_off(struct drm_device *dev, int pipe)/* Wait for the display line to settle */ do { last_line =I915_READ (reg) & line_mask; -mdelay (5 ); +msleep (1 ); }while (((I915_READ (reg) & line_mask) != last_line) &&time_after (timeout, jiffies));if (time_after (jiffies, timeout))
drivers/gpu/drm/i915/intel_pm.c +3 -3
@@ -2380,7 +2380,7 @@ static void ironlake_enable_drps(struct drm_device *dev)if (wait_for_atomic ((I915_READ (MEMSWCTL ) &MEMCTL_CMD_STS ) ==0 ,10 ))DRM_ERROR ("stuck trying to change perf mode\n" ); -mdelay (1 ); +msleep (1 );ironlake_set_drps (dev, fstart);
@@ -2411,10 +2411,10 @@ static void ironlake_disable_drps(struct drm_device *dev)/* Go back to the starting frequency */ ironlake_set_drps (dev, dev_priv->ips.fstart); -mdelay (1 ); +msleep (1 ); rgvswctl |=MEMCTL_CMD_STS ;I915_WRITE (MEMSWCTL , rgvswctl); -mdelay (1 ); +msleep (1 );spin_unlock_irq (&mchdev_lock); }
Signature · 1 line
1.7.10.4
Quoted 9 lines · Daniel Vetter
The first in
wait_pipe_offis really just a delay loop to wait for the scanline counter to settle (which takes about a frame worth of time). So also shrink it a bit.The other is in the ilk dprs code. If we need _exactly_ an 1ms wait in there, that's already not guaranteed with the current code (since especially at start-up we're likely to get scheduled away in between). So replace those, too.
Quoted 4 lines
Noticed while trying to understand why we've again broken the panel fitter.
Signed-off-by Daniel Vetter <[email protected]>
The only reason the mdelay(5) persisted for so long was that we were being lazy and not verifying that path could not be called from atomic context.
The others I just credit Jesse for.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Hi
2013/4/8 Chris Wilson <[email protected]>:
Quoted 13 lines · Daniel Vetter
Quoted 12 lines
The first in
wait_pipe_offis really just a delay loop to wait for the scanline counter to settle (which takes about a frame worth of time). So also shrink it a bit.The other is in the ilk dprs code. If we need _exactly_ an 1ms wait in there, that's already not guaranteed with the current code (since especially at start-up we're likely to get scheduled away in between). So replace those, too.
Noticed while trying to understand why we've again broken the panel fitter.
Quoted 7 lines
Quoted 1 line
Signed-off-by Daniel Vetter <[email protected]>The only reason the mdelay(5) persisted for so long was that we were being lazy and not verifying that path could not be called from atomic context.
The others I just credit Jesse for.
Documentation/timers/timers-howto.txt says that "msleep(1~20) may not do what the caller intends, and will often sleep longer (~20 ms actual sleep for any value given in the 1~20ms range). In many cases this is not the desired behavior.". It suggests us to use usleep_range().
So it seems we may significantly increase those delays we're changing. Is this a problem for this patch?
Quoted 10 lines
Reviewed-by Chris Wilson <[email protected]>-Chris
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Paulo Zanoni
Quoted 22 lines · Paulo Zanoni
2013/4/8 Chris Wilson <[email protected]>:
Quoted 13 lines · Daniel Vetter
Quoted 12 lines
The first in
wait_pipe_offis really just a delay loop to wait for the scanline counter to settle (which takes about a frame worth of time). So also shrink it a bit.The other is in the ilk dprs code. If we need _exactly_ an 1ms wait in there, that's already not guaranteed with the current code (since especially at start-up we're likely to get scheduled away in between). So replace those, too.
Noticed while trying to understand why we've again broken the panel fitter.
Quoted 7 lines
Quoted 1 line
Signed-off-by Daniel Vetter <[email protected]>The only reason the mdelay(5) persisted for so long was that we were being lazy and not verifying that path could not be called from atomic context.
The others I just credit Jesse for.
Quoted 7 lines
Documentation/timers/timers-howto.txtsays that "msleep(1~20) may not do what the caller intends, and will often sleep longer (~20 ms actual sleep for any value given in the 1~20ms range). In many cases this is not the desired behavior.". It suggests us to useusleep_range().So it seems we may significantly increase those delays we're changing. Is this a problem for this patch?
The hand-waving in the commit message is supposed to specifically address this concern. For the wait_pipe_off case we certainly don't care, and the mdelays in the ilk code run at boot-up when there's a pretty big chance that the scheduler will take away our cpu anyway (and so extend the wait).
If the hw really needs an exact wait, we're screwed and would need to use tricks like stop_machine to make sure no one else can interrupt us.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 47 lines · On Sun, 7 Apr 2013 11:13:03 +0200 Daniel Vetter <[email protected]> wrote:
The first in
wait_pipe_offis really just a delay loop to wait for the scanline counter to settle (which takes about a frame worth of time). So also shrink it a bit.The other is in the ilk dprs code. If we need _exactly_ an 1ms wait in there, that's already not guaranteed with the current code (since especially at start-up we're likely to get scheduled away in between). So replace those, too.
Noticed while trying to understand why we've again broken the panel fitter.
Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 2 +- drivers/gpu/drm/i915/intel_pm.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/intel_display.c +1
-1@@ -990,7 +990,7 @@ void intel_wait_for_pipe_off(struct drm_device *dev, int pipe)/* Wait for the display line to settle */ do { last_line =I915_READ (reg) & line_mask; -mdelay (5 ); +msleep (1 ); }while (((I915_READ (reg) & line_mask) != last_line) &&time_after (timeout, jiffies));if (time_after (jiffies, timeout))drivers/gpu/drm/i915/intel_pm.c +1
-1@@ -2380,7 +2380,7 @@ static void ironlake_enable_drps(struct drm_device *dev)if (wait_for_atomic ((I915_READ (MEMSWCTL ) &MEMCTL_CMD_STS ) ==0 ,10 ))DRM_ERROR ("stuck trying to change perf mode\n" ); -mdelay (1 ); +msleep (1 );ironlake_set_drps (dev, fstart);@@ -2411,10 +2411,10 @@ static void ironlake_disable_drps(struct drm_device *dev)/* Go back to the starting frequency */
drivers/gpu/drm/i915/intel_pm.c static void ironlake_disable_drps(struct drm_device *dev) · line 2420
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +2
-2ironlake_set_drps (dev, dev_priv->ips.fstart); -mdelay (1 ); +msleep (1 ); rgvswctl |=MEMCTL_CMD_STS ;I915_WRITE (MEMSWCTL , rgvswctl); -mdelay (1 ); +msleep (1 );spin_unlock_irq (&mchdev_lock); }
Fine with me. Chris is right that I probably added these, back when I thought a few ms at startup or mode set time wasn't so long. Now of course it's an eternity.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center