diff options
author | Rob Clark <robdclark@gmail.com> | 2014-01-11 16:11:59 -0500 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2014-03-31 10:27:45 -0400 |
commit | 0963756fe51313a1e2d76885cd21624d3b2cfbf2 (patch) | |
tree | ddb5bdc7770c2a386bfdf78f0463d8e1c228c9f4 /drivers/gpu/drm/msm/adreno/a3xx_gpu.c | |
parent | 5b6ef08e4b4e1bcb6b3ac4172c054e4462e2c767 (diff) | |
download | linux-0963756fe51313a1e2d76885cd21624d3b2cfbf2.tar.gz linux-0963756fe51313a1e2d76885cd21624d3b2cfbf2.tar.bz2 linux-0963756fe51313a1e2d76885cd21624d3b2cfbf2.zip |
drm/msm: spin helper
Helper macro to simplify places where we need to poll with timeout
waiting for gpu.
Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/msm/adreno/a3xx_gpu.c')
-rw-r--r-- | drivers/gpu/drm/msm/adreno/a3xx_gpu.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c index 8b6fb847789e..59ed7620fc1a 100644 --- a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c @@ -326,21 +326,13 @@ static void a3xx_destroy(struct msm_gpu *gpu) static void a3xx_idle(struct msm_gpu *gpu) { - unsigned long t; - /* wait for ringbuffer to drain: */ adreno_idle(gpu); - t = jiffies + ADRENO_IDLE_TIMEOUT; - /* then wait for GPU to finish: */ - do { - uint32_t rbbm_status = gpu_read(gpu, REG_A3XX_RBBM_STATUS); - if (!(rbbm_status & A3XX_RBBM_STATUS_GPU_BUSY)) - return; - } while(time_before(jiffies, t)); - - DRM_ERROR("timeout waiting for %s to idle!\n", gpu->name); + if (spin_until(!(gpu_read(gpu, REG_A3XX_RBBM_STATUS) & + A3XX_RBBM_STATUS_GPU_BUSY))) + DRM_ERROR("%s: timeout waiting for GPU to idle!\n", gpu->name); /* TODO maybe we need to reset GPU here to recover from hang? */ } |