Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/msm: Make the value of RB_CNTL (almost) generic

We use a global ringbuffer size and block size for all targets and
at least for 5XX preemption we need to know the value the RB_CNTL
in several locations so it makes sense to calculate it once and use
it everywhere.

The only monkey wrench is that we need to disable the RPTR shadow
for A430 targets but that only needs to be done once and doesn't
affect A5XX so we can or in the value at init time.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>

authored by

Jordan Crouse and committed by
Rob Clark
4d87fc32 4c7085a5

+12 -5
+7 -5
drivers/gpu/drm/msm/adreno/adreno_gpu.c
··· 21 21 #include "msm_gem.h" 22 22 #include "msm_mmu.h" 23 23 24 - #define RB_BLKSIZE 32 25 24 26 25 int adreno_get_param(struct msm_gpu *gpu, uint32_t param, uint64_t *value) 27 26 { ··· 194 195 ring->memptrs->rptr = 0; 195 196 } 196 197 197 - /* Setup REG_CP_RB_CNTL: */ 198 + /* 199 + * Setup REG_CP_RB_CNTL. The same value is used across targets (with 200 + * the excpetion of A430 that disables the RPTR shadow) - the cacluation 201 + * for the ringbuffer size and block size is moved to msm_gpu.h for the 202 + * pre-processor to deal with and the A430 variant is ORed in here 203 + */ 198 204 adreno_gpu_write(adreno_gpu, REG_ADRENO_CP_RB_CNTL, 199 - /* size is log2(quad-words): */ 200 - AXXX_CP_RB_CNTL_BUFSZ(ilog2(MSM_GPU_RINGBUFFER_SZ / 8)) | 201 - AXXX_CP_RB_CNTL_BLKSZ(ilog2(RB_BLKSIZE / 8)) | 205 + MSM_GPU_RB_CNTL_DEFAULT | 202 206 (adreno_is_a430(adreno_gpu) ? AXXX_CP_RB_CNTL_NO_UPDATE : 0)); 203 207 204 208 /* Setup ringbuffer address - use ringbuffer[0] for GPU init */
+5
drivers/gpu/drm/msm/msm_gpu.h
··· 129 129 130 130 /* It turns out that all targets use the same ringbuffer size */ 131 131 #define MSM_GPU_RINGBUFFER_SZ SZ_32K 132 + #define MSM_GPU_RINGBUFFER_BLKSIZE 32 133 + 134 + #define MSM_GPU_RB_CNTL_DEFAULT \ 135 + (AXXX_CP_RB_CNTL_BUFSZ(ilog2(MSM_GPU_RINGBUFFER_SZ / 8)) | \ 136 + AXXX_CP_RB_CNTL_BLKSZ(ilog2(MSM_GPU_RINGBUFFER_BLKSIZE / 8))) 132 137 133 138 static inline bool msm_gpu_active(struct msm_gpu *gpu) 134 139 {