drm/msm/adreno: reset ringbuffer in hw_init
authorRob Clark <robdclark@gmail.com>
Sun, 12 Feb 2017 16:42:14 +0000 (11:42 -0500)
committerRob Clark <robdclark@gmail.com>
Sat, 8 Apr 2017 10:59:31 +0000 (06:59 -0400)
We need to do this also in resume path when we need to re-hw_init().

Signed-off-by: Rob Clark <robdclark@gmail.com>
drivers/gpu/drm/msm/adreno/adreno_gpu.c

index 823f9dfe6db95f418191d31714cfd1ede1515c25..05a3d1fd6d302d644427ac98a852b2be2529f5fd 100644 (file)
@@ -68,6 +68,14 @@ int adreno_hw_init(struct msm_gpu *gpu)
                return ret;
        }
 
+       /* reset ringbuffer: */
+       gpu->rb->cur = gpu->rb->start;
+
+       /* reset completed fence seqno: */
+       adreno_gpu->memptrs->fence = gpu->fctx->completed_fence;
+       adreno_gpu->memptrs->rptr  = 0;
+       adreno_gpu->memptrs->wptr  = 0;
+
        /* Setup REG_CP_RB_CNTL: */
        adreno_gpu_write(adreno_gpu, REG_ADRENO_CP_RB_CNTL,
                        /* size is log2(quad-words): */
@@ -111,7 +119,6 @@ uint32_t adreno_last_fence(struct msm_gpu *gpu)
 
 void adreno_recover(struct msm_gpu *gpu)
 {
-       struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
        struct drm_device *dev = gpu->dev;
        int ret;
 
@@ -119,15 +126,6 @@ void adreno_recover(struct msm_gpu *gpu)
        // so maybe continuing to call ->pm_suspend/resume() is better?
 
        gpu->funcs->pm_suspend(gpu);
-
-       /* reset ringbuffer: */
-       gpu->rb->cur = gpu->rb->start;
-
-       /* reset completed fence seqno: */
-       adreno_gpu->memptrs->fence = gpu->fctx->completed_fence;
-       adreno_gpu->memptrs->rptr  = 0;
-       adreno_gpu->memptrs->wptr  = 0;
-
        gpu->funcs->pm_resume(gpu);
 
        ret = msm_gpu_hw_init(gpu);