Skip to content

Commit df5bb40

Browse files
konradybciorobclark
authored andcommitted
drm/msm/a6xx: Extend and explain UBWC config
Rename lower_bit to hbb_lo and explain what it signifies. Add explanations (wherever possible to other tunables). Port setting min_access_length, ubwc_mode and hbb_hi from downstream. Reviewed-by: Rob Clark <[email protected]> Reviewed-by: Akhil P Oommen <[email protected]> Signed-off-by: Konrad Dybcio <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/542764/ Signed-off-by: Rob Clark <[email protected]>
1 parent 05a23a7 commit df5bb40

File tree

1 file changed

+31
-10
lines changed

1 file changed

+31
-10
lines changed

drivers/gpu/drm/msm/adreno/a6xx_gpu.c

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -887,10 +887,25 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu)
887887
static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
888888
{
889889
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
890-
u32 lower_bit = 2;
891-
u32 amsbc = 0;
890+
/* Unknown, introduced with A650 family, related to UBWC mode/ver 4 */
892891
u32 rgb565_predicator = 0;
892+
/* Unknown, introduced with A650 family */
893893
u32 uavflagprd_inv = 0;
894+
/* Whether the minimum access length is 64 bits */
895+
u32 min_acc_len = 0;
896+
/* Entirely magic, per-GPU-gen value */
897+
u32 ubwc_mode = 0;
898+
/*
899+
* The Highest Bank Bit value represents the bit of the highest DDR bank.
900+
* We then subtract 13 from it (13 is the minimum value allowed by hw) and
901+
* write the lowest two bits of the remaining value as hbb_lo and the
902+
* one above it as hbb_hi to the hardware. This should ideally use DRAM
903+
* type detection.
904+
*/
905+
u32 hbb_hi = 0;
906+
u32 hbb_lo = 2;
907+
/* Unknown, introduced with A640/680 */
908+
u32 amsbc = 0;
894909

895910
/* a618 is using the hw default values */
896911
if (adreno_is_a618(adreno_gpu))
@@ -901,32 +916,38 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
901916

902917
if (adreno_is_a650(adreno_gpu) || adreno_is_a660(adreno_gpu)) {
903918
/* TODO: get ddr type from bootloader and use 2 for LPDDR4 */
904-
lower_bit = 3;
919+
hbb_lo = 3;
905920
amsbc = 1;
906921
rgb565_predicator = 1;
907922
uavflagprd_inv = 2;
908923
}
909924

910925
if (adreno_is_a690(adreno_gpu)) {
911-
lower_bit = 2;
926+
hbb_lo = 2;
912927
amsbc = 1;
913928
rgb565_predicator = 1;
914929
uavflagprd_inv = 2;
915930
}
916931

917932
if (adreno_is_7c3(adreno_gpu)) {
918-
lower_bit = 1;
933+
hbb_lo = 1;
919934
amsbc = 1;
920935
rgb565_predicator = 1;
921936
uavflagprd_inv = 2;
922937
}
923938

924939
gpu_write(gpu, REG_A6XX_RB_NC_MODE_CNTL,
925-
rgb565_predicator << 11 | amsbc << 4 | lower_bit << 1);
926-
gpu_write(gpu, REG_A6XX_TPL1_NC_MODE_CNTL, lower_bit << 1);
927-
gpu_write(gpu, REG_A6XX_SP_NC_MODE_CNTL,
928-
uavflagprd_inv << 4 | lower_bit << 1);
929-
gpu_write(gpu, REG_A6XX_UCHE_MODE_CNTL, lower_bit << 21);
940+
rgb565_predicator << 11 | hbb_hi << 10 | amsbc << 4 |
941+
min_acc_len << 3 | hbb_lo << 1 | ubwc_mode);
942+
943+
gpu_write(gpu, REG_A6XX_TPL1_NC_MODE_CNTL, hbb_hi << 4 |
944+
min_acc_len << 3 | hbb_lo << 1 | ubwc_mode);
945+
946+
gpu_write(gpu, REG_A6XX_SP_NC_MODE_CNTL, hbb_hi << 10 |
947+
uavflagprd_inv << 4 | min_acc_len << 3 |
948+
hbb_lo << 1 | ubwc_mode);
949+
950+
gpu_write(gpu, REG_A6XX_UCHE_MODE_CNTL, min_acc_len << 23 | hbb_lo << 21);
930951
}
931952

932953
static int a6xx_cp_init(struct msm_gpu *gpu)

0 commit comments

Comments
 (0)