Skip to content

Commit 560c98b

Browse files
quic-kdybcioRob Clark
authored andcommitted
drm/msm/a6xx: Get a handle to the common UBWC config
Start the great despaghettification by getting a pointer to the common UBWC configuration, which houses e.g. UBWC versions that we need to make decisions. Reviewed-by: Dmitry Baryshkov <[email protected]> Signed-off-by: Konrad Dybcio <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/660965/ Signed-off-by: Rob Clark <[email protected]>
1 parent 45a2974 commit 560c98b

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,8 +604,13 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu)
604604
gpu_write(gpu, REG_A6XX_CP_PROTECT(protect->count_max - 1), protect->regs[i]);
605605
}
606606

607-
static void a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
607+
static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
608608
{
609+
/* Inherit the common config and make some necessary fixups */
610+
gpu->common_ubwc_cfg = qcom_ubwc_config_get_data();
611+
if (IS_ERR(gpu->common_ubwc_cfg))
612+
return PTR_ERR(gpu->common_ubwc_cfg);
613+
609614
gpu->ubwc_config.rgb565_predicator = 0;
610615
gpu->ubwc_config.uavflagprd_inv = 0;
611616
gpu->ubwc_config.min_acc_len = 0;
@@ -682,6 +687,8 @@ static void a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
682687
gpu->ubwc_config.highest_bank_bit = 14;
683688
gpu->ubwc_config.min_acc_len = 1;
684689
}
690+
691+
return 0;
685692
}
686693

687694
static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
@@ -2563,7 +2570,12 @@ struct msm_gpu *a6xx_gpu_init(struct drm_device *dev)
25632570
msm_mmu_set_fault_handler(to_msm_vm(gpu->vm)->mmu, gpu,
25642571
a6xx_fault_handler);
25652572

2566-
a6xx_calc_ubwc_config(adreno_gpu);
2573+
ret = a6xx_calc_ubwc_config(adreno_gpu);
2574+
if (ret) {
2575+
a6xx_destroy(&(a6xx_gpu->base.base));
2576+
return ERR_PTR(ret);
2577+
}
2578+
25672579
/* Set up the preemption specific bits and pieces for each ringbuffer */
25682580
a6xx_preempt_init(gpu);
25692581

drivers/gpu/drm/msm/adreno/adreno_gpu.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include <linux/firmware.h>
1313
#include <linux/iopoll.h>
1414

15+
#include <linux/soc/qcom/ubwc.h>
16+
1517
#include "msm_gpu.h"
1618

1719
#include "adreno_common.xml.h"
@@ -242,6 +244,7 @@ struct adreno_gpu {
242244
*/
243245
u32 macrotile_mode;
244246
} ubwc_config;
247+
const struct qcom_ubwc_cfg_data *common_ubwc_cfg;
245248

246249
/*
247250
* Register offsets are different between some GPUs.

0 commit comments

Comments
 (0)