* [RFT PATCH v2 00/15] Add a single source of truth for UBWC configuration data
@ 2025-05-14 15:10 Konrad Dybcio
2025-05-14 15:10 ` [PATCH RFT v2 01/15] soc: qcom: Add UBWC config provider Konrad Dybcio
` (14 more replies)
0 siblings, 15 replies; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-14 15:10 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Clark, Abhinav Kumar,
Dmitry Baryshkov, Akhil P Oommen, Sean Paul, David Airlie,
Simona Vetter
Cc: Marijn Suijten, linux-kernel, linux-arm-msm, dri-devel, freedreno,
Konrad Dybcio
As discussed a lot in the past, the UBWC config must be coherent across
a number of IP blocks (currently display and GPU, but it also may/will
concern camera/video as the drivers evolve).
So far, we've been trying to keep the values reasonable in each of the
two drivers separately, but it really make sense to do so, especially
given certain fields (see [1]) may need to be gathered dynamically.
This series introduces a Single Source of Truth (SSOT) database to be
consumed by multimedia drivers as needed.
[1] https://lore.kernel.org/linux-arm-msm/20250410-topic-smem_dramc-v2-0-dead15264714@oss.qualcomm.com/
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
Changes in v2:
- Rearrange some patches
- Don't zeroalloc a copy of ubwc_config, store a full struct inside
adreno_gpu instead (temporary solution until we trust the central db
on the HBB value)
- Improve some commit messages
- Fix up SM6125's config
- Don't break userspace abi (hbb value)
- Don't keep mdss_reg_bus_bw in ubwc_config
- Add the last patch warning if there are inconsistencies (I don't
insist on it getting merged, but I think it's a good idea for the
time being)
- Link to v1: https://lore.kernel.org/r/20250508-topic-ubwc_central-v1-0-035c4c5cbe50@oss.qualcomm.com
---
Konrad Dybcio (15):
soc: qcom: Add UBWC config provider
drm/msm: Offset MDSS HBB value by 13
drm/msm: Use the central UBWC config database
drm/msm/a6xx: Get a handle to the common UBWC config
drm/msm/a6xx: Resolve the meaning of AMSBC
drm/msm/a6xx: Simplify uavflagprd_inv detection
drm/msm/a6xx: Resolve the meaning of UBWC_MODE
drm/msm/a6xx: Replace '2' with BIT(1) in level2_swizzling_dis calc
drm/msm/a6xx: Resolve the meaning of rgb565_predicator
drm/msm/a6xx: Simplify min_acc_len calculation
drm/msm/adreno: Switch to the common UBWC config struct
drm/msm/a6xx: Drop cfg->ubwc_swizzle override
soc: qcom: ubwc: Fix SM6125's ubwc_swizzle value
soc: qcom: ubwc: Add #defines for UBWC swizzle bits
[RFC] drm/msm/a6xx: Warn if the highest_bank_bit value is overwritten
drivers/gpu/drm/msm/Kconfig | 1 +
drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 20 +-
drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 131 +++++------
drivers/gpu/drm/msm/adreno/adreno_gpu.c | 6 +-
drivers/gpu/drm/msm/adreno/adreno_gpu.h | 46 +---
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 6 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 4 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 7 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 2 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 3 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 2 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h | 2 +-
drivers/gpu/drm/msm/msm_mdss.c | 333 +++++-----------------------
drivers/gpu/drm/msm/msm_mdss.h | 28 ---
drivers/soc/qcom/Kconfig | 8 +
drivers/soc/qcom/Makefile | 1 +
drivers/soc/qcom/ubwc_config.c | 244 ++++++++++++++++++++
include/linux/soc/qcom/ubwc.h | 69 ++++++
18 files changed, 480 insertions(+), 433 deletions(-)
---
base-commit: edef457004774e598fc4c1b7d1d4f0bcd9d0bb30
change-id: 20250430-topic-ubwc_central-53c540f019e5
Best regards,
--
Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 47+ messages in thread
* [PATCH RFT v2 01/15] soc: qcom: Add UBWC config provider
2025-05-14 15:10 [RFT PATCH v2 00/15] Add a single source of truth for UBWC configuration data Konrad Dybcio
@ 2025-05-14 15:10 ` Konrad Dybcio
2025-05-14 15:29 ` Konrad Dybcio
2025-05-14 19:03 ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFT v2 02/15] drm/msm: Offset MDSS HBB value by 13 Konrad Dybcio
` (13 subsequent siblings)
14 siblings, 2 replies; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-14 15:10 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Clark, Abhinav Kumar,
Dmitry Baryshkov, Akhil P Oommen, Sean Paul, David Airlie,
Simona Vetter
Cc: Marijn Suijten, linux-kernel, linux-arm-msm, dri-devel, freedreno,
Konrad Dybcio
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Add a file that will serve as a single source of truth for UBWC
configuration data for various multimedia blocks.
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
drivers/soc/qcom/Kconfig | 8 ++
drivers/soc/qcom/Makefile | 1 +
drivers/soc/qcom/ubwc_config.c | 235 +++++++++++++++++++++++++++++++++++++++++
include/linux/soc/qcom/ubwc.h | 67 ++++++++++++
4 files changed, 311 insertions(+)
diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
index 58e63cf0036ba8554e4082da5184a620ca807a9e..2caadbbcf8307ff94f5afbdd1481e5e5e291749f 100644
--- a/drivers/soc/qcom/Kconfig
+++ b/drivers/soc/qcom/Kconfig
@@ -296,3 +296,11 @@ config QCOM_PBS
PBS trigger event to the PBS RAM.
endmenu
+
+config QCOM_UBWC_CONFIG
+ tristate
+ help
+ Most Qualcomm SoCs feature a number of Universal Bandwidth Compression
+ (UBWC) engines across various IP blocks, which need to be initialized
+ with coherent configuration data. This module functions as a single
+ source of truth for that information.
diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile
index acbca2ab5cc2a9ab3dce1ff38efd048ba2fab31e..b7f1d2a5736748b8772c090fd24462fa91f321c6 100644
--- a/drivers/soc/qcom/Makefile
+++ b/drivers/soc/qcom/Makefile
@@ -39,3 +39,4 @@ obj-$(CONFIG_QCOM_ICC_BWMON) += icc-bwmon.o
qcom_ice-objs += ice.o
obj-$(CONFIG_QCOM_INLINE_CRYPTO_ENGINE) += qcom_ice.o
obj-$(CONFIG_QCOM_PBS) += qcom-pbs.o
+obj-$(CONFIG_QCOM_UBWC_CONFIG) += ubwc_config.o
diff --git a/drivers/soc/qcom/ubwc_config.c b/drivers/soc/qcom/ubwc_config.c
new file mode 100644
index 0000000000000000000000000000000000000000..9caecd071035ccb03f14464e9b7129ba34a7f862
--- /dev/null
+++ b/drivers/soc/qcom/ubwc_config.c
@@ -0,0 +1,235 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+
+#include <linux/debugfs.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+
+#include <linux/soc/qcom/ubwc.h>
+
+static const struct qcom_ubwc_cfg_data msm8937_data = {
+ .ubwc_enc_version = UBWC_1_0,
+ .ubwc_dec_version = UBWC_1_0,
+ .highest_bank_bit = 14,
+};
+
+static const struct qcom_ubwc_cfg_data msm8998_data = {
+ .ubwc_enc_version = UBWC_1_0,
+ .ubwc_dec_version = UBWC_1_0,
+ .highest_bank_bit = 15,
+};
+
+static const struct qcom_ubwc_cfg_data qcm2290_data = {
+ /* no UBWC */
+ .highest_bank_bit = 15,
+};
+
+static const struct qcom_ubwc_cfg_data sa8775p_data = {
+ .ubwc_enc_version = UBWC_4_0,
+ .ubwc_dec_version = UBWC_4_0,
+ .ubwc_swizzle = 4,
+ .ubwc_bank_spread = true,
+ .highest_bank_bit = 13,
+ .macrotile_mode = true,
+};
+
+static const struct qcom_ubwc_cfg_data sar2130p_data = {
+ .ubwc_enc_version = UBWC_3_0, /* 4.0.2 in hw */
+ .ubwc_dec_version = UBWC_4_3,
+ .ubwc_swizzle = 6,
+ .ubwc_bank_spread = true,
+ .highest_bank_bit = 13,
+ .macrotile_mode = true,
+};
+
+static const struct qcom_ubwc_cfg_data sc7180_data = {
+ .ubwc_enc_version = UBWC_2_0,
+ .ubwc_dec_version = UBWC_2_0,
+ .ubwc_swizzle = 6,
+ .ubwc_bank_spread = true,
+ .highest_bank_bit = 14,
+};
+
+static const struct qcom_ubwc_cfg_data sc7280_data = {
+ .ubwc_enc_version = UBWC_3_0,
+ .ubwc_dec_version = UBWC_4_0,
+ .ubwc_swizzle = 6,
+ .ubwc_bank_spread = true,
+ .highest_bank_bit = 14,
+ .macrotile_mode = true,
+};
+
+static const struct qcom_ubwc_cfg_data sc8180x_data = {
+ .ubwc_enc_version = UBWC_3_0,
+ .ubwc_dec_version = UBWC_3_0,
+ .highest_bank_bit = 16,
+ .macrotile_mode = true,
+};
+
+static const struct qcom_ubwc_cfg_data sc8280xp_data = {
+ .ubwc_enc_version = UBWC_4_0,
+ .ubwc_dec_version = UBWC_4_0,
+ .ubwc_swizzle = 6,
+ .ubwc_bank_spread = true,
+ .highest_bank_bit = 16,
+ .macrotile_mode = true,
+};
+
+static const struct qcom_ubwc_cfg_data sdm670_data = {
+ .ubwc_enc_version = UBWC_2_0,
+ .ubwc_dec_version = UBWC_2_0,
+ .highest_bank_bit = 14,
+};
+
+static const struct qcom_ubwc_cfg_data sdm845_data = {
+ .ubwc_enc_version = UBWC_2_0,
+ .ubwc_dec_version = UBWC_2_0,
+ .highest_bank_bit = 15,
+};
+
+static const struct qcom_ubwc_cfg_data sm6115_data = {
+ .ubwc_enc_version = UBWC_1_0,
+ .ubwc_dec_version = UBWC_2_0,
+ .ubwc_swizzle = 7,
+ .ubwc_bank_spread = true,
+ .highest_bank_bit = 14,
+};
+
+static const struct qcom_ubwc_cfg_data sm6125_data = {
+ .ubwc_enc_version = UBWC_1_0,
+ .ubwc_dec_version = UBWC_3_0,
+ .ubwc_swizzle = 1,
+ .highest_bank_bit = 14,
+};
+
+static const struct qcom_ubwc_cfg_data sm6150_data = {
+ .ubwc_enc_version = UBWC_2_0,
+ .ubwc_dec_version = UBWC_2_0,
+ .highest_bank_bit = 14,
+};
+
+static const struct qcom_ubwc_cfg_data sm6350_data = {
+ .ubwc_enc_version = UBWC_2_0,
+ .ubwc_dec_version = UBWC_2_0,
+ .ubwc_swizzle = 6,
+ .ubwc_bank_spread = true,
+ .highest_bank_bit = 14,
+};
+
+static const struct qcom_ubwc_cfg_data sm7150_data = {
+ .ubwc_enc_version = UBWC_2_0,
+ .ubwc_dec_version = UBWC_2_0,
+ .highest_bank_bit = 14,
+};
+
+static const struct qcom_ubwc_cfg_data sm8150_data = {
+ .ubwc_enc_version = UBWC_3_0,
+ .ubwc_dec_version = UBWC_3_0,
+ .highest_bank_bit = 15,
+};
+
+static const struct qcom_ubwc_cfg_data sm8250_data = {
+ .ubwc_enc_version = UBWC_4_0,
+ .ubwc_dec_version = UBWC_4_0,
+ .ubwc_swizzle = 6,
+ .ubwc_bank_spread = true,
+ /* TODO: highest_bank_bit = 15 for LP_DDR4 */
+ .highest_bank_bit = 16,
+ .macrotile_mode = true,
+};
+
+static const struct qcom_ubwc_cfg_data sm8350_data = {
+ .ubwc_enc_version = UBWC_4_0,
+ .ubwc_dec_version = UBWC_4_0,
+ .ubwc_swizzle = 6,
+ .ubwc_bank_spread = true,
+ /* TODO: highest_bank_bit = 15 for LP_DDR4 */
+ .highest_bank_bit = 16,
+ .macrotile_mode = true,
+};
+
+static const struct qcom_ubwc_cfg_data sm8550_data = {
+ .ubwc_enc_version = UBWC_4_0,
+ .ubwc_dec_version = UBWC_4_3,
+ .ubwc_swizzle = 6,
+ .ubwc_bank_spread = true,
+ /* TODO: highest_bank_bit = 15 for LP_DDR4 */
+ .highest_bank_bit = 16,
+ .macrotile_mode = true,
+};
+
+static const struct qcom_ubwc_cfg_data x1e80100_data = {
+ .ubwc_enc_version = UBWC_4_0,
+ .ubwc_dec_version = UBWC_4_3,
+ .ubwc_swizzle = 6,
+ .ubwc_bank_spread = true,
+ /* TODO: highest_bank_bit = 15 for LP_DDR4 */
+ .highest_bank_bit = 16,
+ .macrotile_mode = true,
+};
+
+static const struct of_device_id qcom_ubwc_configs[] __maybe_unused = {
+ { .compatible = "qcom,apq8096", .data = &msm8998_data },
+ { .compatible = "qcom,msm8917", .data = &msm8937_data },
+ { .compatible = "qcom,msm8937", .data = &msm8937_data },
+ { .compatible = "qcom,msm8953", .data = &msm8937_data },
+ { .compatible = "qcom,msm8956", .data = &msm8937_data },
+ { .compatible = "qcom,msm8976", .data = &msm8937_data },
+ { .compatible = "qcom,msm8996", .data = &msm8998_data },
+ { .compatible = "qcom,msm8998", .data = &msm8998_data },
+ { .compatible = "qcom,qcm2290", .data = &qcm2290_data, },
+ { .compatible = "qcom,qcm6490", .data = &sc7280_data, },
+ { .compatible = "qcom,sa8155p", .data = &sm8150_data, },
+ { .compatible = "qcom,sa8540p", .data = &sc8280xp_data, },
+ { .compatible = "qcom,sa8775p", .data = &sa8775p_data, },
+ { .compatible = "qcom,sc7180", .data = &sc7180_data },
+ { .compatible = "qcom,sc7280", .data = &sc7280_data, },
+ { .compatible = "qcom,sc8180x", .data = &sc8180x_data, },
+ { .compatible = "qcom,sc8280xp", .data = &sc8280xp_data, },
+ { .compatible = "qcom,sdm630", .data = &msm8937_data },
+ { .compatible = "qcom,sdm636", .data = &msm8937_data },
+ { .compatible = "qcom,sdm660", .data = &msm8937_data },
+ { .compatible = "qcom,sdm670", .data = &sdm670_data, },
+ { .compatible = "qcom,sdm845", .data = &sdm845_data, },
+ { .compatible = "qcom,sm4250", .data = &sm6115_data, },
+ { .compatible = "qcom,sm6115", .data = &sm6115_data, },
+ { .compatible = "qcom,sm6125", .data = &sm6125_data, },
+ { .compatible = "qcom,sm6150", .data = &sm6150_data, },
+ { .compatible = "qcom,sm6350", .data = &sm6350_data, },
+ { .compatible = "qcom,sm6375", .data = &sm6350_data, },
+ { .compatible = "qcom,sm7125", .data = &sc7180_data },
+ { .compatible = "qcom,sm7150", .data = &sm7150_data, },
+ { .compatible = "qcom,sm8150", .data = &sm8150_data, },
+ { .compatible = "qcom,sm8250", .data = &sm8250_data, },
+ { .compatible = "qcom,sm8350", .data = &sm8350_data, },
+ { .compatible = "qcom,sm8450", .data = &sm8350_data, },
+ { .compatible = "qcom,sm8550", .data = &sm8550_data, },
+ { .compatible = "qcom,sm8650", .data = &sm8550_data, },
+ { .compatible = "qcom,x1e80100", .data = &x1e80100_data, },
+ { .compatible = "qcom,x1p42100", .data = &x1e80100_data, },
+ { }
+};
+
+const struct qcom_ubwc_cfg_data *qcom_ubwc_config_get_data(void)
+{
+ const struct of_device_id *match;
+ struct device_node *root;
+
+ root = of_find_node_by_path("/");
+ if (!root)
+ return ERR_PTR(-ENODEV);
+
+ match = of_match_node(qcom_ubwc_configs, root);
+ of_node_put(root);
+ if (!match) {
+ pr_err("Couldn't find UBWC config data for this platform!\n");
+ return ERR_PTR(-EINVAL);
+ }
+
+ return match->data;
+}
diff --git a/include/linux/soc/qcom/ubwc.h b/include/linux/soc/qcom/ubwc.h
new file mode 100644
index 0000000000000000000000000000000000000000..30d9744c5d2e06d4aa93b64f7d2bc0e855c7a10b
--- /dev/null
+++ b/include/linux/soc/qcom/ubwc.h
@@ -0,0 +1,67 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (c) 2018, The Linux Foundation
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+
+#ifndef __QCOM_UBWC_H__
+#define __QCOM_UBWC_H__
+
+#include <linux/bits.h>
+#include <linux/types.h>
+
+struct qcom_ubwc_cfg_data {
+ u32 ubwc_enc_version;
+ /* Can be read from MDSS_BASE + 0x58 */
+ u32 ubwc_dec_version;
+
+ /**
+ * @ubwc_swizzle: Whether to enable level 1, 2 & 3 bank swizzling.
+ *
+ * UBWC 1.0 always enables all three levels.
+ * UBWC 2.0 removes level 1 bank swizzling, leaving levels 2 & 3.
+ * UBWC 4.0 adds the optional ability to disable levels 2 & 3.
+ *
+ * This is a bitmask where BIT(0) enables level 1, BIT(1)
+ * controls level 2, and BIT(2) enables level 3.
+ */
+ u32 ubwc_swizzle;
+
+ /**
+ * @highest_bank_bit: Highest Bank Bit
+ *
+ * The Highest Bank Bit value represents the bit of the highest
+ * DDR bank. This should ideally use DRAM type detection.
+ */
+ int highest_bank_bit;
+ bool ubwc_bank_spread;
+
+ /**
+ * @macrotile_mode: Macrotile Mode
+ *
+ * Whether to use 4-channel macrotiling mode or the newer
+ * 8-channel macrotiling mode introduced in UBWC 3.1. 0 is
+ * 4-channel and 1 is 8-channel.
+ */
+ bool macrotile_mode;
+};
+
+#define UBWC_1_0 0x10000000
+#define UBWC_2_0 0x20000000
+#define UBWC_3_0 0x30000000
+#define UBWC_4_0 0x40000000
+#define UBWC_4_3 0x40030000
+
+const struct qcom_ubwc_cfg_data *qcom_ubwc_config_get_data(void);
+
+static inline bool qcom_ubwc_get_ubwc_mode(const struct qcom_ubwc_cfg_data *cfg)
+{
+ bool ret = cfg->ubwc_enc_version == UBWC_1_0;
+
+ if (ret && !(cfg->ubwc_swizzle & BIT(0)))
+ pr_err("UBWC config discrepancy - level 1 swizzling enabled on UBWC 1.0\n");
+
+ return ret;
+}
+
+#endif /* __QCOM_UBWC_H__ */
--
2.49.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH RFT v2 02/15] drm/msm: Offset MDSS HBB value by 13
2025-05-14 15:10 [RFT PATCH v2 00/15] Add a single source of truth for UBWC configuration data Konrad Dybcio
2025-05-14 15:10 ` [PATCH RFT v2 01/15] soc: qcom: Add UBWC config provider Konrad Dybcio
@ 2025-05-14 15:10 ` Konrad Dybcio
2025-05-14 19:04 ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFT v2 03/15] drm/msm: Use the central UBWC config database Konrad Dybcio
` (12 subsequent siblings)
14 siblings, 1 reply; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-14 15:10 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Clark, Abhinav Kumar,
Dmitry Baryshkov, Akhil P Oommen, Sean Paul, David Airlie,
Simona Vetter
Cc: Marijn Suijten, linux-kernel, linux-arm-msm, dri-devel, freedreno,
Konrad Dybcio
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
The Adreno part of the driver exposes this value to userspace, and the
SMEM data source also presents a x+13 value. Keep things coherent and
make the value uniform across them.
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
drivers/gpu/drm/msm/msm_mdss.c | 50 +++++++++++++++++++++---------------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c
index 709979fcfab6062c0f316f7655823e888638bfea..2c9531217eca7ac2308c6d1fa78287363ca652f9 100644
--- a/drivers/gpu/drm/msm/msm_mdss.c
+++ b/drivers/gpu/drm/msm/msm_mdss.c
@@ -167,7 +167,7 @@ static void msm_mdss_setup_ubwc_dec_20(struct msm_mdss *msm_mdss)
{
const struct msm_mdss_data *data = msm_mdss->mdss_data;
u32 value = MDSS_UBWC_STATIC_UBWC_SWIZZLE(data->ubwc_swizzle) |
- MDSS_UBWC_STATIC_HIGHEST_BANK_BIT(data->highest_bank_bit);
+ MDSS_UBWC_STATIC_HIGHEST_BANK_BIT(data->highest_bank_bit - 13);
if (data->ubwc_bank_spread)
value |= MDSS_UBWC_STATIC_UBWC_BANK_SPREAD;
@@ -182,7 +182,7 @@ static void msm_mdss_setup_ubwc_dec_30(struct msm_mdss *msm_mdss)
{
const struct msm_mdss_data *data = msm_mdss->mdss_data;
u32 value = MDSS_UBWC_STATIC_UBWC_SWIZZLE(data->ubwc_swizzle & 0x1) |
- MDSS_UBWC_STATIC_HIGHEST_BANK_BIT(data->highest_bank_bit);
+ MDSS_UBWC_STATIC_HIGHEST_BANK_BIT(data->highest_bank_bit - 13);
if (data->macrotile_mode)
value |= MDSS_UBWC_STATIC_MACROTILE_MODE;
@@ -200,7 +200,7 @@ static void msm_mdss_setup_ubwc_dec_40(struct msm_mdss *msm_mdss)
{
const struct msm_mdss_data *data = msm_mdss->mdss_data;
u32 value = MDSS_UBWC_STATIC_UBWC_SWIZZLE(data->ubwc_swizzle) |
- MDSS_UBWC_STATIC_HIGHEST_BANK_BIT(data->highest_bank_bit);
+ MDSS_UBWC_STATIC_HIGHEST_BANK_BIT(data->highest_bank_bit - 13);
if (data->ubwc_bank_spread)
value |= MDSS_UBWC_STATIC_UBWC_BANK_SPREAD;
@@ -259,9 +259,9 @@ static const struct msm_mdss_data *msm_mdss_generate_mdp5_mdss_data(struct msm_m
if (hw_rev == MDSS_HW_MSM8996 ||
hw_rev == MDSS_HW_MSM8998)
- data->highest_bank_bit = 2;
+ data->highest_bank_bit = 15;
else
- data->highest_bank_bit = 1;
+ data->highest_bank_bit = 14;
return data;
}
@@ -572,13 +572,13 @@ static void mdss_remove(struct platform_device *pdev)
static const struct msm_mdss_data msm8998_data = {
.ubwc_enc_version = UBWC_1_0,
.ubwc_dec_version = UBWC_1_0,
- .highest_bank_bit = 2,
+ .highest_bank_bit = 15,
.reg_bus_bw = 76800,
};
static const struct msm_mdss_data qcm2290_data = {
/* no UBWC */
- .highest_bank_bit = 0x2,
+ .highest_bank_bit = 15,
.reg_bus_bw = 76800,
};
@@ -587,7 +587,7 @@ static const struct msm_mdss_data sa8775p_data = {
.ubwc_dec_version = UBWC_4_0,
.ubwc_swizzle = 4,
.ubwc_bank_spread = true,
- .highest_bank_bit = 0,
+ .highest_bank_bit = 13,
.macrotile_mode = true,
.reg_bus_bw = 74000,
};
@@ -597,7 +597,7 @@ static const struct msm_mdss_data sar2130p_data = {
.ubwc_dec_version = UBWC_4_3,
.ubwc_swizzle = 6,
.ubwc_bank_spread = true,
- .highest_bank_bit = 0,
+ .highest_bank_bit = 13,
.macrotile_mode = 1,
.reg_bus_bw = 74000,
};
@@ -607,7 +607,7 @@ static const struct msm_mdss_data sc7180_data = {
.ubwc_dec_version = UBWC_2_0,
.ubwc_swizzle = 6,
.ubwc_bank_spread = true,
- .highest_bank_bit = 0x1,
+ .highest_bank_bit = 14,
.reg_bus_bw = 76800,
};
@@ -616,7 +616,7 @@ static const struct msm_mdss_data sc7280_data = {
.ubwc_dec_version = UBWC_4_0,
.ubwc_swizzle = 6,
.ubwc_bank_spread = true,
- .highest_bank_bit = 1,
+ .highest_bank_bit = 14,
.macrotile_mode = true,
.reg_bus_bw = 74000,
};
@@ -624,7 +624,7 @@ static const struct msm_mdss_data sc7280_data = {
static const struct msm_mdss_data sc8180x_data = {
.ubwc_enc_version = UBWC_3_0,
.ubwc_dec_version = UBWC_3_0,
- .highest_bank_bit = 3,
+ .highest_bank_bit = 16,
.macrotile_mode = true,
.reg_bus_bw = 76800,
};
@@ -634,7 +634,7 @@ static const struct msm_mdss_data sc8280xp_data = {
.ubwc_dec_version = UBWC_4_0,
.ubwc_swizzle = 6,
.ubwc_bank_spread = true,
- .highest_bank_bit = 3,
+ .highest_bank_bit = 16,
.macrotile_mode = true,
.reg_bus_bw = 76800,
};
@@ -642,14 +642,14 @@ static const struct msm_mdss_data sc8280xp_data = {
static const struct msm_mdss_data sdm670_data = {
.ubwc_enc_version = UBWC_2_0,
.ubwc_dec_version = UBWC_2_0,
- .highest_bank_bit = 1,
+ .highest_bank_bit = 14,
.reg_bus_bw = 76800,
};
static const struct msm_mdss_data sdm845_data = {
.ubwc_enc_version = UBWC_2_0,
.ubwc_dec_version = UBWC_2_0,
- .highest_bank_bit = 2,
+ .highest_bank_bit = 15,
.reg_bus_bw = 76800,
};
@@ -658,21 +658,21 @@ static const struct msm_mdss_data sm6350_data = {
.ubwc_dec_version = UBWC_2_0,
.ubwc_swizzle = 6,
.ubwc_bank_spread = true,
- .highest_bank_bit = 1,
+ .highest_bank_bit = 14,
.reg_bus_bw = 76800,
};
static const struct msm_mdss_data sm7150_data = {
.ubwc_enc_version = UBWC_2_0,
.ubwc_dec_version = UBWC_2_0,
- .highest_bank_bit = 1,
+ .highest_bank_bit = 14,
.reg_bus_bw = 76800,
};
static const struct msm_mdss_data sm8150_data = {
.ubwc_enc_version = UBWC_3_0,
.ubwc_dec_version = UBWC_3_0,
- .highest_bank_bit = 2,
+ .highest_bank_bit = 15,
.reg_bus_bw = 76800,
};
@@ -681,7 +681,7 @@ static const struct msm_mdss_data sm6115_data = {
.ubwc_dec_version = UBWC_2_0,
.ubwc_swizzle = 7,
.ubwc_bank_spread = true,
- .highest_bank_bit = 0x1,
+ .highest_bank_bit = 14,
.reg_bus_bw = 76800,
};
@@ -689,13 +689,13 @@ static const struct msm_mdss_data sm6125_data = {
.ubwc_enc_version = UBWC_1_0,
.ubwc_dec_version = UBWC_3_0,
.ubwc_swizzle = 1,
- .highest_bank_bit = 1,
+ .highest_bank_bit = 14,
};
static const struct msm_mdss_data sm6150_data = {
.ubwc_enc_version = UBWC_2_0,
.ubwc_dec_version = UBWC_2_0,
- .highest_bank_bit = 1,
+ .highest_bank_bit = 14,
.reg_bus_bw = 76800,
};
@@ -705,7 +705,7 @@ static const struct msm_mdss_data sm8250_data = {
.ubwc_swizzle = 6,
.ubwc_bank_spread = true,
/* TODO: highest_bank_bit = 2 for LP_DDR4 */
- .highest_bank_bit = 3,
+ .highest_bank_bit = 16,
.macrotile_mode = true,
.reg_bus_bw = 76800,
};
@@ -716,7 +716,7 @@ static const struct msm_mdss_data sm8350_data = {
.ubwc_swizzle = 6,
.ubwc_bank_spread = true,
/* TODO: highest_bank_bit = 2 for LP_DDR4 */
- .highest_bank_bit = 3,
+ .highest_bank_bit = 16,
.macrotile_mode = true,
.reg_bus_bw = 74000,
};
@@ -727,7 +727,7 @@ static const struct msm_mdss_data sm8550_data = {
.ubwc_swizzle = 6,
.ubwc_bank_spread = true,
/* TODO: highest_bank_bit = 2 for LP_DDR4 */
- .highest_bank_bit = 3,
+ .highest_bank_bit = 16,
.macrotile_mode = true,
.reg_bus_bw = 57000,
};
@@ -738,7 +738,7 @@ static const struct msm_mdss_data x1e80100_data = {
.ubwc_swizzle = 6,
.ubwc_bank_spread = true,
/* TODO: highest_bank_bit = 2 for LP_DDR4 */
- .highest_bank_bit = 3,
+ .highest_bank_bit = 16,
.macrotile_mode = true,
/* TODO: Add reg_bus_bw with real value */
};
--
2.49.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH RFT v2 03/15] drm/msm: Use the central UBWC config database
2025-05-14 15:10 [RFT PATCH v2 00/15] Add a single source of truth for UBWC configuration data Konrad Dybcio
2025-05-14 15:10 ` [PATCH RFT v2 01/15] soc: qcom: Add UBWC config provider Konrad Dybcio
2025-05-14 15:10 ` [PATCH RFT v2 02/15] drm/msm: Offset MDSS HBB value by 13 Konrad Dybcio
@ 2025-05-14 15:10 ` Konrad Dybcio
2025-05-14 19:05 ` Dmitry Baryshkov
2025-05-15 10:32 ` kernel test robot
2025-05-14 15:10 ` [PATCH RFT v2 04/15] drm/msm/a6xx: Get a handle to the common UBWC config Konrad Dybcio
` (11 subsequent siblings)
14 siblings, 2 replies; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-14 15:10 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Clark, Abhinav Kumar,
Dmitry Baryshkov, Akhil P Oommen, Sean Paul, David Airlie,
Simona Vetter
Cc: Marijn Suijten, linux-kernel, linux-arm-msm, dri-devel, freedreno,
Konrad Dybcio
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
As discussed a lot in the past, the UBWC config must be coherent across
a number of IP blocks (currently display and GPU, but it also may/will
concern camera/video as the drivers evolve).
So far, we've been trying to keep the values reasonable in each of the
two drivers separately, but it really make sense to do so centrally,
especially given certain fields (e.g. HBB) may need to be gathered
dynamically.
To reduce room for error, move to fetching the config from a central
source, so that the data programmed into the hardware is consistent
across all multimedia blocks that request it.
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
drivers/gpu/drm/msm/Kconfig | 1 +
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 6 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 4 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 7 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 2 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 3 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 2 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h | 2 +-
drivers/gpu/drm/msm/msm_mdss.c | 327 +++++-----------------------
drivers/gpu/drm/msm/msm_mdss.h | 28 ---
10 files changed, 73 insertions(+), 309 deletions(-)
diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index 7f127e2ae44292f8f5c7ff6a9251c3d7ec8c9f58..6579ac907b83bc8042388e4efbaa250ebe771ac5 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -95,6 +95,7 @@ config DRM_MSM_DPU
depends on DRM_MSM
select DRM_MSM_MDSS
select DRM_DISPLAY_DSC_HELPER
+ select QCOM_UBWC_CONFIG
default y
help
Compile in support for the Display Processing Unit in
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
index 32c7c80845533d720683dbcde3978d98f4972cce..54ccb1e5a89c75452ac6d53d201999d1124be8cd 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
@@ -10,11 +10,11 @@
#include "dpu_hw_sspp.h"
#include "dpu_kms.h"
-#include "msm_mdss.h"
-
#include <drm/drm_file.h>
#include <drm/drm_managed.h>
+#include <linux/soc/qcom/ubwc.h>
+
#define DPU_FETCH_CONFIG_RESET_VALUE 0x00000087
/* SSPP registers */
@@ -684,7 +684,7 @@ int _dpu_hw_sspp_init_debugfs(struct dpu_hw_sspp *hw_pipe, struct dpu_kms *kms,
struct dpu_hw_sspp *dpu_hw_sspp_init(struct drm_device *dev,
const struct dpu_sspp_cfg *cfg,
void __iomem *addr,
- const struct msm_mdss_data *mdss_data,
+ const struct qcom_ubwc_cfg_data *mdss_data,
const struct dpu_mdss_version *mdss_rev)
{
struct dpu_hw_sspp *hw_pipe;
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
index 56a0edf2a57c6dcef7cddf4a1bcd6f6df5ad60f6..7957a3ab6b68cbbd2fd9e1f48673b42d1c8a225a 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
@@ -308,7 +308,7 @@ struct dpu_hw_sspp_ops {
struct dpu_hw_sspp {
struct dpu_hw_blk base;
struct dpu_hw_blk_reg_map hw;
- const struct msm_mdss_data *ubwc;
+ const struct qcom_ubwc_cfg_data *ubwc;
/* Pipe */
enum dpu_sspp idx;
@@ -323,7 +323,7 @@ struct dpu_kms;
struct dpu_hw_sspp *dpu_hw_sspp_init(struct drm_device *dev,
const struct dpu_sspp_cfg *cfg,
void __iomem *addr,
- const struct msm_mdss_data *mdss_data,
+ const struct qcom_ubwc_cfg_data *mdss_data,
const struct dpu_mdss_version *mdss_rev);
int _dpu_hw_sspp_init_debugfs(struct dpu_hw_sspp *hw_pipe, struct dpu_kms *kms,
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 1fd82b6747e9058ce11dc2620729921492d5ebdd..6667de3154e078b74f797ce1b92d4625c1503f9e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -20,9 +20,10 @@
#include <drm/drm_vblank.h>
#include <drm/drm_writeback.h>
+#include <linux/soc/qcom/ubwc.h>
+
#include "msm_drv.h"
#include "msm_mmu.h"
-#include "msm_mdss.h"
#include "msm_gem.h"
#include "disp/msm_disp_snapshot.h"
@@ -1189,10 +1190,10 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
goto err_pm_put;
}
- dpu_kms->mdss = msm_mdss_get_mdss_data(dpu_kms->pdev->dev.parent);
+ dpu_kms->mdss = qcom_ubwc_config_get_data();
if (IS_ERR(dpu_kms->mdss)) {
rc = PTR_ERR(dpu_kms->mdss);
- DPU_ERROR("failed to get MDSS data: %d\n", rc);
+ DPU_ERROR("failed to get UBWC config data: %d\n", rc);
goto err_pm_put;
}
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
index a57ec2ec106083e8f93578e4307e8b13ae549c08..993cf512f8c509ac4e28a60a1a31b262f4a54f98 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
@@ -60,7 +60,7 @@ struct dpu_kms {
struct msm_kms base;
struct drm_device *dev;
const struct dpu_mdss_cfg *catalog;
- const struct msm_mdss_data *mdss;
+ const struct qcom_ubwc_cfg_data *mdss;
/* io/register spaces: */
void __iomem *mmio, *vbif[VBIF_MAX];
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
index 421138bc3cb779c45fcfd5319056f0d31c862452..ba5a46c5c1b501d22c6b28dd82ac761c26d08541 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
@@ -17,8 +17,9 @@
#include <drm/drm_framebuffer.h>
#include <drm/drm_gem_atomic_helper.h>
+#include <linux/soc/qcom/ubwc.h>
+
#include "msm_drv.h"
-#include "msm_mdss.h"
#include "dpu_kms.h"
#include "dpu_hw_sspp.h"
#include "dpu_hw_util.h"
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
index 2e296f79cba1437470eeb30900a650f6f4e334b6..cae85812fe273ba12ef9215e1881f59986bbf969 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
@@ -40,7 +40,7 @@ static inline bool reserved_by_other(uint32_t *res_map, int idx,
int dpu_rm_init(struct drm_device *dev,
struct dpu_rm *rm,
const struct dpu_mdss_cfg *cat,
- const struct msm_mdss_data *mdss_data,
+ const struct qcom_ubwc_cfg_data *mdss_data,
void __iomem *mmio)
{
int rc, i;
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h
index aa62966056d489d9c94c61f24051a2f3e7b7ed89..ccd64404f12d3ca3956c8e6df7d1ffddd4f20642 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h
@@ -69,7 +69,7 @@ struct msm_display_topology {
int dpu_rm_init(struct drm_device *dev,
struct dpu_rm *rm,
const struct dpu_mdss_cfg *cat,
- const struct msm_mdss_data *mdss_data,
+ const struct qcom_ubwc_cfg_data *mdss_data,
void __iomem *mmio);
int dpu_rm_reserve(struct dpu_rm *rm,
diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c
index 2c9531217eca7ac2308c6d1fa78287363ca652f9..41b4d3708a77523c27cdd8b17e5ffa44bc8ca0b4 100644
--- a/drivers/gpu/drm/msm/msm_mdss.c
+++ b/drivers/gpu/drm/msm/msm_mdss.c
@@ -16,14 +16,17 @@
#include <linux/pm_runtime.h>
#include <linux/reset.h>
-#include "msm_mdss.h"
+#include <linux/soc/qcom/ubwc.h>
+
#include "msm_kms.h"
#include <generated/mdss.xml.h>
#define MIN_IB_BW 400000000UL /* Min ib vote 400MB */
-#define DEFAULT_REG_BW 153600 /* Used in mdss fbdev driver */
+struct msm_mdss_data {
+ u32 reg_bus_bw;
+};
struct msm_mdss {
struct device *dev;
@@ -36,7 +39,8 @@ struct msm_mdss {
unsigned long enabled_mask;
struct irq_domain *domain;
} irq_controller;
- const struct msm_mdss_data *mdss_data;
+ const struct qcom_ubwc_cfg_data *mdss_data;
+ u32 reg_bus_bw;
struct icc_path *mdp_path[2];
u32 num_mdp_paths;
struct icc_path *reg_bus_path;
@@ -165,7 +169,7 @@ static int _msm_mdss_irq_domain_add(struct msm_mdss *msm_mdss)
static void msm_mdss_setup_ubwc_dec_20(struct msm_mdss *msm_mdss)
{
- const struct msm_mdss_data *data = msm_mdss->mdss_data;
+ const struct qcom_ubwc_cfg_data *data = msm_mdss->mdss_data;
u32 value = MDSS_UBWC_STATIC_UBWC_SWIZZLE(data->ubwc_swizzle) |
MDSS_UBWC_STATIC_HIGHEST_BANK_BIT(data->highest_bank_bit - 13);
@@ -180,7 +184,7 @@ static void msm_mdss_setup_ubwc_dec_20(struct msm_mdss *msm_mdss)
static void msm_mdss_setup_ubwc_dec_30(struct msm_mdss *msm_mdss)
{
- const struct msm_mdss_data *data = msm_mdss->mdss_data;
+ const struct qcom_ubwc_cfg_data *data = msm_mdss->mdss_data;
u32 value = MDSS_UBWC_STATIC_UBWC_SWIZZLE(data->ubwc_swizzle & 0x1) |
MDSS_UBWC_STATIC_HIGHEST_BANK_BIT(data->highest_bank_bit - 13);
@@ -198,7 +202,7 @@ static void msm_mdss_setup_ubwc_dec_30(struct msm_mdss *msm_mdss)
static void msm_mdss_setup_ubwc_dec_40(struct msm_mdss *msm_mdss)
{
- const struct msm_mdss_data *data = msm_mdss->mdss_data;
+ const struct qcom_ubwc_cfg_data *data = msm_mdss->mdss_data;
u32 value = MDSS_UBWC_STATIC_UBWC_SWIZZLE(data->ubwc_swizzle) |
MDSS_UBWC_STATIC_HIGHEST_BANK_BIT(data->highest_bank_bit - 13);
@@ -222,69 +226,6 @@ static void msm_mdss_setup_ubwc_dec_40(struct msm_mdss *msm_mdss)
}
}
-#define MDSS_HW_MAJ_MIN \
- (MDSS_HW_VERSION_MAJOR__MASK | MDSS_HW_VERSION_MINOR__MASK)
-
-#define MDSS_HW_MSM8996 0x1007
-#define MDSS_HW_MSM8937 0x100e
-#define MDSS_HW_MSM8953 0x1010
-#define MDSS_HW_MSM8998 0x3000
-#define MDSS_HW_SDM660 0x3002
-#define MDSS_HW_SDM630 0x3003
-
-/*
- * MDP5 platforms use generic qcom,mdp5 compat string, so we have to generate this data
- */
-static const struct msm_mdss_data *msm_mdss_generate_mdp5_mdss_data(struct msm_mdss *mdss)
-{
- struct msm_mdss_data *data;
- u32 hw_rev;
-
- data = devm_kzalloc(mdss->dev, sizeof(*data), GFP_KERNEL);
- if (!data)
- return NULL;
-
- hw_rev = readl_relaxed(mdss->mmio + REG_MDSS_HW_VERSION);
- hw_rev = FIELD_GET(MDSS_HW_MAJ_MIN, hw_rev);
-
- if (hw_rev == MDSS_HW_MSM8996 ||
- hw_rev == MDSS_HW_MSM8937 ||
- hw_rev == MDSS_HW_MSM8953 ||
- hw_rev == MDSS_HW_MSM8998 ||
- hw_rev == MDSS_HW_SDM660 ||
- hw_rev == MDSS_HW_SDM630) {
- data->ubwc_dec_version = UBWC_1_0;
- data->ubwc_enc_version = UBWC_1_0;
- }
-
- if (hw_rev == MDSS_HW_MSM8996 ||
- hw_rev == MDSS_HW_MSM8998)
- data->highest_bank_bit = 15;
- else
- data->highest_bank_bit = 14;
-
- return data;
-}
-
-const struct msm_mdss_data *msm_mdss_get_mdss_data(struct device *dev)
-{
- struct msm_mdss *mdss;
-
- if (!dev)
- return ERR_PTR(-EINVAL);
-
- mdss = dev_get_drvdata(dev);
-
- /*
- * We could not do it at the probe time, since hw revision register was
- * not readable. Fill data structure now for the MDP5 platforms.
- */
- if (!mdss->mdss_data && mdss->is_mdp5)
- mdss->mdss_data = msm_mdss_generate_mdp5_mdss_data(mdss);
-
- return mdss->mdss_data;
-}
-
static int msm_mdss_enable(struct msm_mdss *msm_mdss)
{
int ret, i;
@@ -297,12 +238,8 @@ static int msm_mdss_enable(struct msm_mdss *msm_mdss)
for (i = 0; i < msm_mdss->num_mdp_paths; i++)
icc_set_bw(msm_mdss->mdp_path[i], 0, Bps_to_icc(MIN_IB_BW));
- if (msm_mdss->mdss_data && msm_mdss->mdss_data->reg_bus_bw)
- icc_set_bw(msm_mdss->reg_bus_path, 0,
- msm_mdss->mdss_data->reg_bus_bw);
- else
- icc_set_bw(msm_mdss->reg_bus_path, 0,
- DEFAULT_REG_BW);
+ icc_set_bw(msm_mdss->reg_bus_path, 0,
+ msm_mdss->reg_bus_bw);
ret = clk_bulk_prepare_enable(msm_mdss->num_clocks, msm_mdss->clocks);
if (ret) {
@@ -438,6 +375,7 @@ static int mdp5_mdss_parse_clock(struct platform_device *pdev, struct clk_bulk_d
static struct msm_mdss *msm_mdss_init(struct platform_device *pdev, bool is_mdp5)
{
+ const struct msm_mdss_data *mdss_data;
struct msm_mdss *msm_mdss;
int ret;
int irq;
@@ -450,7 +388,15 @@ static struct msm_mdss *msm_mdss_init(struct platform_device *pdev, bool is_mdp5
if (!msm_mdss)
return ERR_PTR(-ENOMEM);
- msm_mdss->mdss_data = of_device_get_match_data(&pdev->dev);
+ msm_mdss->mdss_data = qcom_ubwc_config_get_data();
+ if (IS_ERR(msm_mdss->mdss_data))
+ return ERR_CAST(msm_mdss->mdss_data);
+
+ mdss_data = of_device_get_match_data(&pdev->dev);
+ if (!mdss_data)
+ return ERR_PTR(-EINVAL);
+
+ msm_mdss->reg_bus_bw = mdss_data->reg_bus_bw;
msm_mdss->mmio = devm_platform_ioremap_resource_byname(pdev, is_mdp5 ? "mdss_phys" : "mdss");
if (IS_ERR(msm_mdss->mmio))
@@ -569,205 +515,48 @@ static void mdss_remove(struct platform_device *pdev)
msm_mdss_destroy(mdss);
}
-static const struct msm_mdss_data msm8998_data = {
- .ubwc_enc_version = UBWC_1_0,
- .ubwc_dec_version = UBWC_1_0,
- .highest_bank_bit = 15,
- .reg_bus_bw = 76800,
-};
-
-static const struct msm_mdss_data qcm2290_data = {
- /* no UBWC */
- .highest_bank_bit = 15,
- .reg_bus_bw = 76800,
-};
-
-static const struct msm_mdss_data sa8775p_data = {
- .ubwc_enc_version = UBWC_4_0,
- .ubwc_dec_version = UBWC_4_0,
- .ubwc_swizzle = 4,
- .ubwc_bank_spread = true,
- .highest_bank_bit = 13,
- .macrotile_mode = true,
- .reg_bus_bw = 74000,
-};
-
-static const struct msm_mdss_data sar2130p_data = {
- .ubwc_enc_version = UBWC_3_0, /* 4.0.2 in hw */
- .ubwc_dec_version = UBWC_4_3,
- .ubwc_swizzle = 6,
- .ubwc_bank_spread = true,
- .highest_bank_bit = 13,
- .macrotile_mode = 1,
- .reg_bus_bw = 74000,
-};
-
-static const struct msm_mdss_data sc7180_data = {
- .ubwc_enc_version = UBWC_2_0,
- .ubwc_dec_version = UBWC_2_0,
- .ubwc_swizzle = 6,
- .ubwc_bank_spread = true,
- .highest_bank_bit = 14,
- .reg_bus_bw = 76800,
-};
-
-static const struct msm_mdss_data sc7280_data = {
- .ubwc_enc_version = UBWC_3_0,
- .ubwc_dec_version = UBWC_4_0,
- .ubwc_swizzle = 6,
- .ubwc_bank_spread = true,
- .highest_bank_bit = 14,
- .macrotile_mode = true,
- .reg_bus_bw = 74000,
-};
-
-static const struct msm_mdss_data sc8180x_data = {
- .ubwc_enc_version = UBWC_3_0,
- .ubwc_dec_version = UBWC_3_0,
- .highest_bank_bit = 16,
- .macrotile_mode = true,
- .reg_bus_bw = 76800,
-};
-
-static const struct msm_mdss_data sc8280xp_data = {
- .ubwc_enc_version = UBWC_4_0,
- .ubwc_dec_version = UBWC_4_0,
- .ubwc_swizzle = 6,
- .ubwc_bank_spread = true,
- .highest_bank_bit = 16,
- .macrotile_mode = true,
- .reg_bus_bw = 76800,
-};
-
-static const struct msm_mdss_data sdm670_data = {
- .ubwc_enc_version = UBWC_2_0,
- .ubwc_dec_version = UBWC_2_0,
- .highest_bank_bit = 14,
- .reg_bus_bw = 76800,
-};
-
-static const struct msm_mdss_data sdm845_data = {
- .ubwc_enc_version = UBWC_2_0,
- .ubwc_dec_version = UBWC_2_0,
- .highest_bank_bit = 15,
- .reg_bus_bw = 76800,
-};
-
-static const struct msm_mdss_data sm6350_data = {
- .ubwc_enc_version = UBWC_2_0,
- .ubwc_dec_version = UBWC_2_0,
- .ubwc_swizzle = 6,
- .ubwc_bank_spread = true,
- .highest_bank_bit = 14,
- .reg_bus_bw = 76800,
-};
-
-static const struct msm_mdss_data sm7150_data = {
- .ubwc_enc_version = UBWC_2_0,
- .ubwc_dec_version = UBWC_2_0,
- .highest_bank_bit = 14,
- .reg_bus_bw = 76800,
-};
-
-static const struct msm_mdss_data sm8150_data = {
- .ubwc_enc_version = UBWC_3_0,
- .ubwc_dec_version = UBWC_3_0,
- .highest_bank_bit = 15,
- .reg_bus_bw = 76800,
-};
-
-static const struct msm_mdss_data sm6115_data = {
- .ubwc_enc_version = UBWC_1_0,
- .ubwc_dec_version = UBWC_2_0,
- .ubwc_swizzle = 7,
- .ubwc_bank_spread = true,
- .highest_bank_bit = 14,
- .reg_bus_bw = 76800,
-};
-
-static const struct msm_mdss_data sm6125_data = {
- .ubwc_enc_version = UBWC_1_0,
- .ubwc_dec_version = UBWC_3_0,
- .ubwc_swizzle = 1,
- .highest_bank_bit = 14,
-};
-
-static const struct msm_mdss_data sm6150_data = {
- .ubwc_enc_version = UBWC_2_0,
- .ubwc_dec_version = UBWC_2_0,
- .highest_bank_bit = 14,
- .reg_bus_bw = 76800,
-};
-
-static const struct msm_mdss_data sm8250_data = {
- .ubwc_enc_version = UBWC_4_0,
- .ubwc_dec_version = UBWC_4_0,
- .ubwc_swizzle = 6,
- .ubwc_bank_spread = true,
- /* TODO: highest_bank_bit = 2 for LP_DDR4 */
- .highest_bank_bit = 16,
- .macrotile_mode = true,
- .reg_bus_bw = 76800,
-};
-
-static const struct msm_mdss_data sm8350_data = {
- .ubwc_enc_version = UBWC_4_0,
- .ubwc_dec_version = UBWC_4_0,
- .ubwc_swizzle = 6,
- .ubwc_bank_spread = true,
- /* TODO: highest_bank_bit = 2 for LP_DDR4 */
- .highest_bank_bit = 16,
- .macrotile_mode = true,
- .reg_bus_bw = 74000,
-};
-
-static const struct msm_mdss_data sm8550_data = {
- .ubwc_enc_version = UBWC_4_0,
- .ubwc_dec_version = UBWC_4_3,
- .ubwc_swizzle = 6,
- .ubwc_bank_spread = true,
- /* TODO: highest_bank_bit = 2 for LP_DDR4 */
- .highest_bank_bit = 16,
- .macrotile_mode = true,
+static const struct msm_mdss_data data_57k = {
.reg_bus_bw = 57000,
};
-static const struct msm_mdss_data x1e80100_data = {
- .ubwc_enc_version = UBWC_4_0,
- .ubwc_dec_version = UBWC_4_3,
- .ubwc_swizzle = 6,
- .ubwc_bank_spread = true,
- /* TODO: highest_bank_bit = 2 for LP_DDR4 */
- .highest_bank_bit = 16,
- .macrotile_mode = true,
- /* TODO: Add reg_bus_bw with real value */
+static const struct msm_mdss_data data_74k = {
+ .reg_bus_bw = 74000,
+};
+
+static const struct msm_mdss_data data_76k8 = {
+ .reg_bus_bw = 76800,
+};
+
+static const struct msm_mdss_data data_153k6 = {
+ .reg_bus_bw = 153600,
};
static const struct of_device_id mdss_dt_match[] = {
- { .compatible = "qcom,mdss" },
- { .compatible = "qcom,msm8998-mdss", .data = &msm8998_data },
- { .compatible = "qcom,qcm2290-mdss", .data = &qcm2290_data },
- { .compatible = "qcom,sa8775p-mdss", .data = &sa8775p_data },
- { .compatible = "qcom,sar2130p-mdss", .data = &sar2130p_data },
- { .compatible = "qcom,sdm670-mdss", .data = &sdm670_data },
- { .compatible = "qcom,sdm845-mdss", .data = &sdm845_data },
- { .compatible = "qcom,sc7180-mdss", .data = &sc7180_data },
- { .compatible = "qcom,sc7280-mdss", .data = &sc7280_data },
- { .compatible = "qcom,sc8180x-mdss", .data = &sc8180x_data },
- { .compatible = "qcom,sc8280xp-mdss", .data = &sc8280xp_data },
- { .compatible = "qcom,sm6115-mdss", .data = &sm6115_data },
- { .compatible = "qcom,sm6125-mdss", .data = &sm6125_data },
- { .compatible = "qcom,sm6150-mdss", .data = &sm6150_data },
- { .compatible = "qcom,sm6350-mdss", .data = &sm6350_data },
- { .compatible = "qcom,sm6375-mdss", .data = &sm6350_data },
- { .compatible = "qcom,sm7150-mdss", .data = &sm7150_data },
- { .compatible = "qcom,sm8150-mdss", .data = &sm8150_data },
- { .compatible = "qcom,sm8250-mdss", .data = &sm8250_data },
- { .compatible = "qcom,sm8350-mdss", .data = &sm8350_data },
- { .compatible = "qcom,sm8450-mdss", .data = &sm8350_data },
- { .compatible = "qcom,sm8550-mdss", .data = &sm8550_data },
- { .compatible = "qcom,sm8650-mdss", .data = &sm8550_data},
- { .compatible = "qcom,x1e80100-mdss", .data = &x1e80100_data},
+ { .compatible = "qcom,mdss", .data = &data_153k6 },
+ { .compatible = "qcom,msm8998-mdss", .data = &data_76k8 },
+ { .compatible = "qcom,qcm2290-mdss", .data = &data_76k8 },
+ { .compatible = "qcom,sa8775p-mdss", .data = &data_74k },
+ { .compatible = "qcom,sar2130p-mdss", .data = &data_74k },
+ { .compatible = "qcom,sdm670-mdss", .data = &data_76k8 },
+ { .compatible = "qcom,sdm845-mdss", .data = &data_76k8 },
+ { .compatible = "qcom,sc7180-mdss", .data = &data_76k8 },
+ { .compatible = "qcom,sc7280-mdss", .data = &data_74k },
+ { .compatible = "qcom,sc8180x-mdss", .data = &data_76k8 },
+ { .compatible = "qcom,sc8280xp-mdss", .data = &data_76k8 },
+ { .compatible = "qcom,sm6115-mdss", .data = &data_76k8 },
+ { .compatible = "qcom,sm6125-mdss", .data = &data_76k8 },
+ { .compatible = "qcom,sm6150-mdss", .data = &data_76k8 },
+ { .compatible = "qcom,sm6350-mdss", .data = &data_76k8 },
+ { .compatible = "qcom,sm6375-mdss", .data = &data_76k8 },
+ { .compatible = "qcom,sm7150-mdss", .data = &data_76k8 },
+ { .compatible = "qcom,sm8150-mdss", .data = &data_76k8 },
+ { .compatible = "qcom,sm8250-mdss", .data = &data_76k8 },
+ { .compatible = "qcom,sm8350-mdss", .data = &data_74k },
+ { .compatible = "qcom,sm8450-mdss", .data = &data_74k },
+ { .compatible = "qcom,sm8550-mdss", .data = &data_57k },
+ { .compatible = "qcom,sm8650-mdss", .data = &data_57k },
+ /* TODO: x1e8: Add reg_bus_bw with real value */
+ { .compatible = "qcom,x1e80100-mdss", .data = &data_153k6 },
{}
};
MODULE_DEVICE_TABLE(of, mdss_dt_match);
diff --git a/drivers/gpu/drm/msm/msm_mdss.h b/drivers/gpu/drm/msm/msm_mdss.h
deleted file mode 100644
index 14dc53704314558841ee1fe08d93309fd2233812..0000000000000000000000000000000000000000
--- a/drivers/gpu/drm/msm/msm_mdss.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Copyright (c) 2018, The Linux Foundation
- */
-
-#ifndef __MSM_MDSS_H__
-#define __MSM_MDSS_H__
-
-struct msm_mdss_data {
- u32 ubwc_enc_version;
- /* can be read from register 0x58 */
- u32 ubwc_dec_version;
- u32 ubwc_swizzle;
- u32 highest_bank_bit;
- bool ubwc_bank_spread;
- bool macrotile_mode;
- u32 reg_bus_bw;
-};
-
-#define UBWC_1_0 0x10000000
-#define UBWC_2_0 0x20000000
-#define UBWC_3_0 0x30000000
-#define UBWC_4_0 0x40000000
-#define UBWC_4_3 0x40030000
-
-const struct msm_mdss_data *msm_mdss_get_mdss_data(struct device *dev);
-
-#endif /* __MSM_MDSS_H__ */
--
2.49.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH RFT v2 04/15] drm/msm/a6xx: Get a handle to the common UBWC config
2025-05-14 15:10 [RFT PATCH v2 00/15] Add a single source of truth for UBWC configuration data Konrad Dybcio
` (2 preceding siblings ...)
2025-05-14 15:10 ` [PATCH RFT v2 03/15] drm/msm: Use the central UBWC config database Konrad Dybcio
@ 2025-05-14 15:10 ` Konrad Dybcio
2025-05-14 15:10 ` [PATCH RFT v2 05/15] drm/msm/a6xx: Resolve the meaning of AMSBC Konrad Dybcio
` (10 subsequent siblings)
14 siblings, 0 replies; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-14 15:10 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Clark, Abhinav Kumar,
Dmitry Baryshkov, Akhil P Oommen, Sean Paul, David Airlie,
Simona Vetter
Cc: Marijn Suijten, linux-kernel, linux-arm-msm, dri-devel, freedreno,
Konrad Dybcio
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
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.
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 16 ++++++++++++++--
drivers/gpu/drm/msm/adreno/adreno_gpu.h | 3 +++
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index bf3758f010f4079aa86f9c658b52a70acf10b488..ba20ff92780dbd565374f8113ea99f615b80d105 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -585,8 +585,13 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu)
gpu_write(gpu, REG_A6XX_CP_PROTECT(protect->count_max - 1), protect->regs[i]);
}
-static void a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
+static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
{
+ /* Inherit the common config and make some necessary fixups */
+ gpu->common_ubwc_cfg = qcom_ubwc_config_get_data();
+ if (IS_ERR(gpu->common_ubwc_cfg))
+ return -EINVAL;
+
gpu->ubwc_config.rgb565_predicator = 0;
gpu->ubwc_config.uavflagprd_inv = 0;
gpu->ubwc_config.min_acc_len = 0;
@@ -663,6 +668,8 @@ static void a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
gpu->ubwc_config.highest_bank_bit = 14;
gpu->ubwc_config.min_acc_len = 1;
}
+
+ return 0;
}
static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
@@ -2546,7 +2553,12 @@ struct msm_gpu *a6xx_gpu_init(struct drm_device *dev)
msm_mmu_set_fault_handler(gpu->aspace->mmu, gpu,
a6xx_fault_handler);
- a6xx_calc_ubwc_config(adreno_gpu);
+ ret = a6xx_calc_ubwc_config(adreno_gpu);
+ if (ret) {
+ a6xx_destroy(&(a6xx_gpu->base.base));
+ return ERR_PTR(ret);
+ }
+
/* Set up the preemption specific bits and pieces for each ringbuffer */
a6xx_preempt_init(gpu);
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.h b/drivers/gpu/drm/msm/adreno/adreno_gpu.h
index a8f4bf416e64fadbd1c61c991db13d539581e324..06be95d3efaee94e4107a484ad3132e0a6a9ea46 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.h
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.h
@@ -12,6 +12,8 @@
#include <linux/firmware.h>
#include <linux/iopoll.h>
+#include <linux/soc/qcom/ubwc.h>
+
#include "msm_gpu.h"
#include "adreno_common.xml.h"
@@ -243,6 +245,7 @@ struct adreno_gpu {
*/
u32 macrotile_mode;
} ubwc_config;
+ const struct qcom_ubwc_cfg_data *common_ubwc_cfg;
/*
* Register offsets are different between some GPUs.
--
2.49.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH RFT v2 05/15] drm/msm/a6xx: Resolve the meaning of AMSBC
2025-05-14 15:10 [RFT PATCH v2 00/15] Add a single source of truth for UBWC configuration data Konrad Dybcio
` (3 preceding siblings ...)
2025-05-14 15:10 ` [PATCH RFT v2 04/15] drm/msm/a6xx: Get a handle to the common UBWC config Konrad Dybcio
@ 2025-05-14 15:10 ` Konrad Dybcio
2025-05-14 19:16 ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFT v2 06/15] drm/msm/a6xx: Simplify uavflagprd_inv detection Konrad Dybcio
` (9 subsequent siblings)
14 siblings, 1 reply; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-14 15:10 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Clark, Abhinav Kumar,
Dmitry Baryshkov, Akhil P Oommen, Sean Paul, David Airlie,
Simona Vetter
Cc: Marijn Suijten, linux-kernel, linux-arm-msm, dri-devel, freedreno,
Konrad Dybcio
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
The bit must be set to 1 if the UBWC encoder version is >= 3.0, drop it
as a separate field.
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index ba20ff92780dbd565374f8113ea99f615b80d105..334a4c4627ffb562a83f51e6e2c95e31af950c08 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -617,21 +617,16 @@ static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
if (adreno_is_a621(gpu)) {
gpu->ubwc_config.highest_bank_bit = 13;
- gpu->ubwc_config.amsbc = 1;
gpu->ubwc_config.uavflagprd_inv = 2;
}
if (adreno_is_a623(gpu)) {
gpu->ubwc_config.highest_bank_bit = 16;
- gpu->ubwc_config.amsbc = 1;
gpu->ubwc_config.rgb565_predicator = 1;
gpu->ubwc_config.uavflagprd_inv = 2;
gpu->ubwc_config.macrotile_mode = 1;
}
- if (adreno_is_a640_family(gpu))
- gpu->ubwc_config.amsbc = 1;
-
if (adreno_is_a680(gpu))
gpu->ubwc_config.macrotile_mode = 1;
@@ -642,7 +637,6 @@ static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
adreno_is_a740_family(gpu)) {
/* TODO: get ddr type from bootloader and use 2 for LPDDR4 */
gpu->ubwc_config.highest_bank_bit = 16;
- gpu->ubwc_config.amsbc = 1;
gpu->ubwc_config.rgb565_predicator = 1;
gpu->ubwc_config.uavflagprd_inv = 2;
gpu->ubwc_config.macrotile_mode = 1;
@@ -650,7 +644,6 @@ static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
if (adreno_is_a663(gpu)) {
gpu->ubwc_config.highest_bank_bit = 13;
- gpu->ubwc_config.amsbc = 1;
gpu->ubwc_config.rgb565_predicator = 1;
gpu->ubwc_config.uavflagprd_inv = 2;
gpu->ubwc_config.macrotile_mode = 1;
@@ -659,7 +652,6 @@ static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
if (adreno_is_7c3(gpu)) {
gpu->ubwc_config.highest_bank_bit = 14;
- gpu->ubwc_config.amsbc = 1;
gpu->ubwc_config.uavflagprd_inv = 2;
gpu->ubwc_config.macrotile_mode = 1;
}
@@ -675,6 +667,7 @@ static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
{
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
+ const struct qcom_ubwc_cfg_data *cfg = adreno_gpu->common_ubwc_cfg;
/*
* We subtract 13 from the highest bank bit (13 is the minimum value
* allowed by hw) and write the lowest two bits of the remaining value
@@ -682,6 +675,7 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
*/
BUG_ON(adreno_gpu->ubwc_config.highest_bank_bit < 13);
u32 hbb = adreno_gpu->ubwc_config.highest_bank_bit - 13;
+ bool amsbc = cfg->ubwc_enc_version >= UBWC_3_0;
u32 hbb_hi = hbb >> 2;
u32 hbb_lo = hbb & 3;
u32 ubwc_mode = adreno_gpu->ubwc_config.ubwc_swizzle & 1;
@@ -690,7 +684,7 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
gpu_write(gpu, REG_A6XX_RB_NC_MODE_CNTL,
level2_swizzling_dis << 12 |
adreno_gpu->ubwc_config.rgb565_predicator << 11 |
- hbb_hi << 10 | adreno_gpu->ubwc_config.amsbc << 4 |
+ hbb_hi << 10 | amsbc << 4 |
adreno_gpu->ubwc_config.min_acc_len << 3 |
hbb_lo << 1 | ubwc_mode);
--
2.49.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH RFT v2 06/15] drm/msm/a6xx: Simplify uavflagprd_inv detection
2025-05-14 15:10 [RFT PATCH v2 00/15] Add a single source of truth for UBWC configuration data Konrad Dybcio
` (4 preceding siblings ...)
2025-05-14 15:10 ` [PATCH RFT v2 05/15] drm/msm/a6xx: Resolve the meaning of AMSBC Konrad Dybcio
@ 2025-05-14 15:10 ` Konrad Dybcio
2025-05-14 19:14 ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFT v2 07/15] drm/msm/a6xx: Resolve the meaning of UBWC_MODE Konrad Dybcio
` (8 subsequent siblings)
14 siblings, 1 reply; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-14 15:10 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Clark, Abhinav Kumar,
Dmitry Baryshkov, Akhil P Oommen, Sean Paul, David Airlie,
Simona Vetter
Cc: Marijn Suijten, linux-kernel, linux-arm-msm, dri-devel, freedreno,
Konrad Dybcio
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Instead of setting it on a gpu-per-gpu basis, converge it to the
intended "is A650 family or A7xx".
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index 334a4c4627ffb562a83f51e6e2c95e31af950c08..e7c89f9c7d89798699848743843eed6a58b94bd3 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -593,7 +593,6 @@ static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
return -EINVAL;
gpu->ubwc_config.rgb565_predicator = 0;
- gpu->ubwc_config.uavflagprd_inv = 0;
gpu->ubwc_config.min_acc_len = 0;
gpu->ubwc_config.ubwc_swizzle = 0x6;
gpu->ubwc_config.macrotile_mode = 0;
@@ -615,15 +614,12 @@ static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
if (adreno_is_a619_holi(gpu))
gpu->ubwc_config.highest_bank_bit = 13;
- if (adreno_is_a621(gpu)) {
+ if (adreno_is_a621(gpu))
gpu->ubwc_config.highest_bank_bit = 13;
- gpu->ubwc_config.uavflagprd_inv = 2;
- }
if (adreno_is_a623(gpu)) {
gpu->ubwc_config.highest_bank_bit = 16;
gpu->ubwc_config.rgb565_predicator = 1;
- gpu->ubwc_config.uavflagprd_inv = 2;
gpu->ubwc_config.macrotile_mode = 1;
}
@@ -638,21 +634,18 @@ static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
/* TODO: get ddr type from bootloader and use 2 for LPDDR4 */
gpu->ubwc_config.highest_bank_bit = 16;
gpu->ubwc_config.rgb565_predicator = 1;
- gpu->ubwc_config.uavflagprd_inv = 2;
gpu->ubwc_config.macrotile_mode = 1;
}
if (adreno_is_a663(gpu)) {
gpu->ubwc_config.highest_bank_bit = 13;
gpu->ubwc_config.rgb565_predicator = 1;
- gpu->ubwc_config.uavflagprd_inv = 2;
gpu->ubwc_config.macrotile_mode = 1;
gpu->ubwc_config.ubwc_swizzle = 0x4;
}
if (adreno_is_7c3(gpu)) {
gpu->ubwc_config.highest_bank_bit = 14;
- gpu->ubwc_config.uavflagprd_inv = 2;
gpu->ubwc_config.macrotile_mode = 1;
}
@@ -667,6 +660,7 @@ static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
{
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
+ u8 uavflagprd_inv = adreno_is_a650_family(adreno_gpu) || adreno_is_a7xx(adreno_gpu) ? 2 : 0;
const struct qcom_ubwc_cfg_data *cfg = adreno_gpu->common_ubwc_cfg;
/*
* We subtract 13 from the highest bank bit (13 is the minimum value
@@ -695,7 +689,7 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
gpu_write(gpu, REG_A6XX_SP_NC_MODE_CNTL,
level2_swizzling_dis << 12 | hbb_hi << 10 |
- adreno_gpu->ubwc_config.uavflagprd_inv << 4 |
+ uavflagprd_inv << 4 |
adreno_gpu->ubwc_config.min_acc_len << 3 |
hbb_lo << 1 | ubwc_mode);
--
2.49.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH RFT v2 07/15] drm/msm/a6xx: Resolve the meaning of UBWC_MODE
2025-05-14 15:10 [RFT PATCH v2 00/15] Add a single source of truth for UBWC configuration data Konrad Dybcio
` (5 preceding siblings ...)
2025-05-14 15:10 ` [PATCH RFT v2 06/15] drm/msm/a6xx: Simplify uavflagprd_inv detection Konrad Dybcio
@ 2025-05-14 15:10 ` Konrad Dybcio
2025-05-14 19:14 ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFT v2 08/15] drm/msm/a6xx: Replace '2' with BIT(1) in level2_swizzling_dis calc Konrad Dybcio
` (7 subsequent siblings)
14 siblings, 1 reply; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-14 15:10 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Clark, Abhinav Kumar,
Dmitry Baryshkov, Akhil P Oommen, Sean Paul, David Airlie,
Simona Vetter
Cc: Marijn Suijten, linux-kernel, linux-arm-msm, dri-devel, freedreno,
Konrad Dybcio
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
This bit is set iff the UBWC version is 1.0. That notably does not
include QCM2290's "no UBWC".
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index e7c89f9c7d89798699848743843eed6a58b94bd3..6af4e70c1b936a30c1934dd49f2889be13c9780d 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -669,10 +669,10 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
*/
BUG_ON(adreno_gpu->ubwc_config.highest_bank_bit < 13);
u32 hbb = adreno_gpu->ubwc_config.highest_bank_bit - 13;
+ bool ubwc_mode = qcom_ubwc_get_ubwc_mode(cfg);
bool amsbc = cfg->ubwc_enc_version >= UBWC_3_0;
u32 hbb_hi = hbb >> 2;
u32 hbb_lo = hbb & 3;
- u32 ubwc_mode = adreno_gpu->ubwc_config.ubwc_swizzle & 1;
u32 level2_swizzling_dis = !(adreno_gpu->ubwc_config.ubwc_swizzle & 2);
gpu_write(gpu, REG_A6XX_RB_NC_MODE_CNTL,
--
2.49.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH RFT v2 08/15] drm/msm/a6xx: Replace '2' with BIT(1) in level2_swizzling_dis calc
2025-05-14 15:10 [RFT PATCH v2 00/15] Add a single source of truth for UBWC configuration data Konrad Dybcio
` (6 preceding siblings ...)
2025-05-14 15:10 ` [PATCH RFT v2 07/15] drm/msm/a6xx: Resolve the meaning of UBWC_MODE Konrad Dybcio
@ 2025-05-14 15:10 ` Konrad Dybcio
2025-05-14 19:15 ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFT v2 09/15] drm/msm/a6xx: Resolve the meaning of rgb565_predicator Konrad Dybcio
` (6 subsequent siblings)
14 siblings, 1 reply; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-14 15:10 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Clark, Abhinav Kumar,
Dmitry Baryshkov, Akhil P Oommen, Sean Paul, David Airlie,
Simona Vetter
Cc: Marijn Suijten, linux-kernel, linux-arm-msm, dri-devel, freedreno,
Konrad Dybcio
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
ubwc_swizzle is a bitmask. Check for a bit to make it more obvious.
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index 6af4e70c1b936a30c1934dd49f2889be13c9780d..0a08837ab01b724489baeb217cc49779ddcdf146 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -669,11 +669,11 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
*/
BUG_ON(adreno_gpu->ubwc_config.highest_bank_bit < 13);
u32 hbb = adreno_gpu->ubwc_config.highest_bank_bit - 13;
+ u32 level2_swizzling_dis = !(cfg->ubwc_swizzle & BIT(1));
bool ubwc_mode = qcom_ubwc_get_ubwc_mode(cfg);
bool amsbc = cfg->ubwc_enc_version >= UBWC_3_0;
u32 hbb_hi = hbb >> 2;
u32 hbb_lo = hbb & 3;
- u32 level2_swizzling_dis = !(adreno_gpu->ubwc_config.ubwc_swizzle & 2);
gpu_write(gpu, REG_A6XX_RB_NC_MODE_CNTL,
level2_swizzling_dis << 12 |
--
2.49.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH RFT v2 09/15] drm/msm/a6xx: Resolve the meaning of rgb565_predicator
2025-05-14 15:10 [RFT PATCH v2 00/15] Add a single source of truth for UBWC configuration data Konrad Dybcio
` (7 preceding siblings ...)
2025-05-14 15:10 ` [PATCH RFT v2 08/15] drm/msm/a6xx: Replace '2' with BIT(1) in level2_swizzling_dis calc Konrad Dybcio
@ 2025-05-14 15:10 ` Konrad Dybcio
2025-05-14 19:15 ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFT v2 10/15] drm/msm/a6xx: Simplify min_acc_len calculation Konrad Dybcio
` (5 subsequent siblings)
14 siblings, 1 reply; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-14 15:10 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Clark, Abhinav Kumar,
Dmitry Baryshkov, Akhil P Oommen, Sean Paul, David Airlie,
Simona Vetter
Cc: Marijn Suijten, linux-kernel, linux-arm-msm, dri-devel, freedreno,
Konrad Dybcio
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
It's supposed to be on when the UBWC encoder version is >= 4.0.
Drop the per-GPU assignments.
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index 0a08837ab01b724489baeb217cc49779ddcdf146..5ee5f8dc90fe0d1647ce07b7dbcadc6ca2ecd416 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -592,7 +592,6 @@ static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
if (IS_ERR(gpu->common_ubwc_cfg))
return -EINVAL;
- gpu->ubwc_config.rgb565_predicator = 0;
gpu->ubwc_config.min_acc_len = 0;
gpu->ubwc_config.ubwc_swizzle = 0x6;
gpu->ubwc_config.macrotile_mode = 0;
@@ -619,7 +618,6 @@ static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
if (adreno_is_a623(gpu)) {
gpu->ubwc_config.highest_bank_bit = 16;
- gpu->ubwc_config.rgb565_predicator = 1;
gpu->ubwc_config.macrotile_mode = 1;
}
@@ -633,13 +631,11 @@ static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
adreno_is_a740_family(gpu)) {
/* TODO: get ddr type from bootloader and use 2 for LPDDR4 */
gpu->ubwc_config.highest_bank_bit = 16;
- gpu->ubwc_config.rgb565_predicator = 1;
gpu->ubwc_config.macrotile_mode = 1;
}
if (adreno_is_a663(gpu)) {
gpu->ubwc_config.highest_bank_bit = 13;
- gpu->ubwc_config.rgb565_predicator = 1;
gpu->ubwc_config.macrotile_mode = 1;
gpu->ubwc_config.ubwc_swizzle = 0x4;
}
@@ -669,6 +665,7 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
*/
BUG_ON(adreno_gpu->ubwc_config.highest_bank_bit < 13);
u32 hbb = adreno_gpu->ubwc_config.highest_bank_bit - 13;
+ bool rgb565_predicator = cfg->ubwc_enc_version >= UBWC_4_0;
u32 level2_swizzling_dis = !(cfg->ubwc_swizzle & BIT(1));
bool ubwc_mode = qcom_ubwc_get_ubwc_mode(cfg);
bool amsbc = cfg->ubwc_enc_version >= UBWC_3_0;
@@ -677,7 +674,7 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
gpu_write(gpu, REG_A6XX_RB_NC_MODE_CNTL,
level2_swizzling_dis << 12 |
- adreno_gpu->ubwc_config.rgb565_predicator << 11 |
+ rgb565_predicator << 11 |
hbb_hi << 10 | amsbc << 4 |
adreno_gpu->ubwc_config.min_acc_len << 3 |
hbb_lo << 1 | ubwc_mode);
--
2.49.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH RFT v2 10/15] drm/msm/a6xx: Simplify min_acc_len calculation
2025-05-14 15:10 [RFT PATCH v2 00/15] Add a single source of truth for UBWC configuration data Konrad Dybcio
` (8 preceding siblings ...)
2025-05-14 15:10 ` [PATCH RFT v2 09/15] drm/msm/a6xx: Resolve the meaning of rgb565_predicator Konrad Dybcio
@ 2025-05-14 15:10 ` Konrad Dybcio
2025-05-14 19:19 ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFT v2 11/15] drm/msm/adreno: Switch to the common UBWC config struct Konrad Dybcio
` (4 subsequent siblings)
14 siblings, 1 reply; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-14 15:10 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Clark, Abhinav Kumar,
Dmitry Baryshkov, Akhil P Oommen, Sean Paul, David Airlie,
Simona Vetter
Cc: Marijn Suijten, linux-kernel, linux-arm-msm, dri-devel, freedreno,
Konrad Dybcio
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
It's only necessary for some lower end parts.
Also rename it to min_acc_len_64b to denote that if set, the minimum
access length is 64 bits, 32b otherwise.
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index 5ee5f8dc90fe0d1647ce07b7dbcadc6ca2ecd416..fdc843c47c075a92ec8305217c355e4ccee876dc 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -592,14 +592,12 @@ static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
if (IS_ERR(gpu->common_ubwc_cfg))
return -EINVAL;
- gpu->ubwc_config.min_acc_len = 0;
gpu->ubwc_config.ubwc_swizzle = 0x6;
gpu->ubwc_config.macrotile_mode = 0;
gpu->ubwc_config.highest_bank_bit = 15;
if (adreno_is_a610(gpu)) {
gpu->ubwc_config.highest_bank_bit = 13;
- gpu->ubwc_config.min_acc_len = 1;
gpu->ubwc_config.ubwc_swizzle = 0x7;
}
@@ -645,10 +643,8 @@ static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
gpu->ubwc_config.macrotile_mode = 1;
}
- if (adreno_is_a702(gpu)) {
+ if (adreno_is_a702(gpu))
gpu->ubwc_config.highest_bank_bit = 14;
- gpu->ubwc_config.min_acc_len = 1;
- }
return 0;
}
@@ -657,6 +653,7 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
{
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
u8 uavflagprd_inv = adreno_is_a650_family(adreno_gpu) || adreno_is_a7xx(adreno_gpu) ? 2 : 0;
+ bool min_acc_len_64b = adreno_is_a610(adreno_gpu) || adreno_is_a702(adreno_gpu);
const struct qcom_ubwc_cfg_data *cfg = adreno_gpu->common_ubwc_cfg;
/*
* We subtract 13 from the highest bank bit (13 is the minimum value
@@ -676,18 +673,18 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
level2_swizzling_dis << 12 |
rgb565_predicator << 11 |
hbb_hi << 10 | amsbc << 4 |
- adreno_gpu->ubwc_config.min_acc_len << 3 |
+ min_acc_len_64b << 3 |
hbb_lo << 1 | ubwc_mode);
gpu_write(gpu, REG_A6XX_TPL1_NC_MODE_CNTL,
level2_swizzling_dis << 6 | hbb_hi << 4 |
- adreno_gpu->ubwc_config.min_acc_len << 3 |
+ min_acc_len_64b << 3 |
hbb_lo << 1 | ubwc_mode);
gpu_write(gpu, REG_A6XX_SP_NC_MODE_CNTL,
level2_swizzling_dis << 12 | hbb_hi << 10 |
uavflagprd_inv << 4 |
- adreno_gpu->ubwc_config.min_acc_len << 3 |
+ min_acc_len_64b << 3 |
hbb_lo << 1 | ubwc_mode);
if (adreno_is_a7xx(adreno_gpu))
@@ -695,7 +692,7 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
FIELD_PREP(GENMASK(8, 5), hbb_lo));
gpu_write(gpu, REG_A6XX_UCHE_MODE_CNTL,
- adreno_gpu->ubwc_config.min_acc_len << 23 | hbb_lo << 21);
+ min_acc_len_64b << 23 | hbb_lo << 21);
gpu_write(gpu, REG_A6XX_RBBM_NC_MODE_CNTL,
adreno_gpu->ubwc_config.macrotile_mode);
--
2.49.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH RFT v2 11/15] drm/msm/adreno: Switch to the common UBWC config struct
2025-05-14 15:10 [RFT PATCH v2 00/15] Add a single source of truth for UBWC configuration data Konrad Dybcio
` (9 preceding siblings ...)
2025-05-14 15:10 ` [PATCH RFT v2 10/15] drm/msm/a6xx: Simplify min_acc_len calculation Konrad Dybcio
@ 2025-05-14 15:10 ` Konrad Dybcio
2025-05-14 19:22 ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFT v2 12/15] drm/msm/a6xx: Drop cfg->ubwc_swizzle override Konrad Dybcio
` (3 subsequent siblings)
14 siblings, 1 reply; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-14 15:10 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Clark, Abhinav Kumar,
Dmitry Baryshkov, Akhil P Oommen, Sean Paul, David Airlie,
Simona Vetter
Cc: Marijn Suijten, linux-kernel, linux-arm-msm, dri-devel, freedreno,
Konrad Dybcio
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Now that Adreno specifics are out of the way, use the common config
(but leave the HBB hardcoding in place until that is wired up on the
other side).
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 20 +++++------
drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 64 ++++++++++++++++-----------------
drivers/gpu/drm/msm/adreno/adreno_gpu.c | 6 ++--
drivers/gpu/drm/msm/adreno/adreno_gpu.h | 45 ++++-------------------
4 files changed, 50 insertions(+), 85 deletions(-)
diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index 650e5bac225f372e819130b891f1d020b464f17f..611e0eb26d0e19d431673d08e042162375fd400f 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -833,8 +833,8 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
gpu_write(gpu, REG_A5XX_RBBM_AHB_CNTL2, 0x0000003F);
- BUG_ON(adreno_gpu->ubwc_config.highest_bank_bit < 13);
- hbb = adreno_gpu->ubwc_config.highest_bank_bit - 13;
+ BUG_ON(adreno_gpu->ubwc_config->highest_bank_bit < 13);
+ hbb = adreno_gpu->ubwc_config->highest_bank_bit - 13;
gpu_write(gpu, REG_A5XX_TPL1_MODE_CNTL, hbb << 7);
gpu_write(gpu, REG_A5XX_RB_MODE_CNTL, hbb << 1);
@@ -1754,6 +1754,7 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev)
struct msm_drm_private *priv = dev->dev_private;
struct platform_device *pdev = priv->gpu_pdev;
struct adreno_platform_config *config = pdev->dev.platform_data;
+ const struct qcom_ubwc_cfg_data *common_cfg;
struct a5xx_gpu *a5xx_gpu = NULL;
struct adreno_gpu *adreno_gpu;
struct msm_gpu *gpu;
@@ -1790,15 +1791,14 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev)
/* Set up the preemption specific bits and pieces for each ringbuffer */
a5xx_preempt_init(gpu);
- /* Set the highest bank bit */
- if (adreno_is_a540(adreno_gpu) || adreno_is_a530(adreno_gpu))
- adreno_gpu->ubwc_config.highest_bank_bit = 15;
- else
- adreno_gpu->ubwc_config.highest_bank_bit = 14;
+ /* Inherit the common config and make some necessary fixups */
+ common_cfg = qcom_ubwc_config_get_data();
+ if (IS_ERR(common_cfg))
+ return ERR_PTR(-EINVAL);
- /* a5xx only supports UBWC 1.0, these are not configurable */
- adreno_gpu->ubwc_config.macrotile_mode = 0;
- adreno_gpu->ubwc_config.ubwc_swizzle = 0x7;
+ /* Copy the data into the internal struct to drop the const qualifier (temporarily) */
+ adreno_gpu->_ubwc_config = *common_cfg;
+ adreno_gpu->ubwc_config = &adreno_gpu->_ubwc_config;
adreno_gpu->uche_trap_base = 0x0001ffffffff0000ull;
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index fdc843c47c075a92ec8305217c355e4ccee876dc..ae0bb7934e7ed203aa3b81e28767de204f0a4d60 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -587,64 +587,62 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu)
static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
{
+ const struct qcom_ubwc_cfg_data *common_cfg;
+ struct qcom_ubwc_cfg_data *cfg = &gpu->_ubwc_config;
+
/* Inherit the common config and make some necessary fixups */
- gpu->common_ubwc_cfg = qcom_ubwc_config_get_data();
- if (IS_ERR(gpu->common_ubwc_cfg))
+ common_cfg = qcom_ubwc_config_get_data();
+ if (IS_ERR(common_cfg))
return -EINVAL;
- gpu->ubwc_config.ubwc_swizzle = 0x6;
- gpu->ubwc_config.macrotile_mode = 0;
- gpu->ubwc_config.highest_bank_bit = 15;
+ /* Copy the data into the internal struct to drop the const qualifier (temporarily) */
+ *cfg = *common_cfg;
+
+ cfg->ubwc_swizzle = 0x6;
+ cfg->highest_bank_bit = 15;
if (adreno_is_a610(gpu)) {
- gpu->ubwc_config.highest_bank_bit = 13;
- gpu->ubwc_config.ubwc_swizzle = 0x7;
+ cfg->highest_bank_bit = 13;
+ cfg->ubwc_swizzle = 0x7;
}
if (adreno_is_a618(gpu))
- gpu->ubwc_config.highest_bank_bit = 14;
+ cfg->highest_bank_bit = 14;
if (adreno_is_a619(gpu))
/* TODO: Should be 14 but causes corruption at e.g. 1920x1200 on DP */
- gpu->ubwc_config.highest_bank_bit = 13;
+ cfg->highest_bank_bit = 13;
if (adreno_is_a619_holi(gpu))
- gpu->ubwc_config.highest_bank_bit = 13;
+ cfg->highest_bank_bit = 13;
if (adreno_is_a621(gpu))
- gpu->ubwc_config.highest_bank_bit = 13;
+ cfg->highest_bank_bit = 13;
- if (adreno_is_a623(gpu)) {
- gpu->ubwc_config.highest_bank_bit = 16;
- gpu->ubwc_config.macrotile_mode = 1;
- }
-
- if (adreno_is_a680(gpu))
- gpu->ubwc_config.macrotile_mode = 1;
+ if (adreno_is_a623(gpu))
+ cfg->highest_bank_bit = 16;
if (adreno_is_a650(gpu) ||
adreno_is_a660(gpu) ||
adreno_is_a690(gpu) ||
adreno_is_a730(gpu) ||
adreno_is_a740_family(gpu)) {
- /* TODO: get ddr type from bootloader and use 2 for LPDDR4 */
- gpu->ubwc_config.highest_bank_bit = 16;
- gpu->ubwc_config.macrotile_mode = 1;
+ /* TODO: get ddr type from bootloader and use 15 for LPDDR4 */
+ cfg->highest_bank_bit = 16;
}
if (adreno_is_a663(gpu)) {
- gpu->ubwc_config.highest_bank_bit = 13;
- gpu->ubwc_config.macrotile_mode = 1;
- gpu->ubwc_config.ubwc_swizzle = 0x4;
+ cfg->highest_bank_bit = 13;
+ cfg->ubwc_swizzle = 0x4;
}
- if (adreno_is_7c3(gpu)) {
- gpu->ubwc_config.highest_bank_bit = 14;
- gpu->ubwc_config.macrotile_mode = 1;
- }
+ if (adreno_is_7c3(gpu))
+ cfg->highest_bank_bit = 14;
if (adreno_is_a702(gpu))
- gpu->ubwc_config.highest_bank_bit = 14;
+ cfg->highest_bank_bit = 14;
+
+ gpu->ubwc_config = &gpu->_ubwc_config;
return 0;
}
@@ -654,14 +652,14 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
u8 uavflagprd_inv = adreno_is_a650_family(adreno_gpu) || adreno_is_a7xx(adreno_gpu) ? 2 : 0;
bool min_acc_len_64b = adreno_is_a610(adreno_gpu) || adreno_is_a702(adreno_gpu);
- const struct qcom_ubwc_cfg_data *cfg = adreno_gpu->common_ubwc_cfg;
+ const struct qcom_ubwc_cfg_data *cfg = adreno_gpu->ubwc_config;
/*
* We subtract 13 from the highest bank bit (13 is the minimum value
* allowed by hw) and write the lowest two bits of the remaining value
* as hbb_lo and the one above it as hbb_hi to the hardware.
*/
- BUG_ON(adreno_gpu->ubwc_config.highest_bank_bit < 13);
- u32 hbb = adreno_gpu->ubwc_config.highest_bank_bit - 13;
+ BUG_ON(cfg->highest_bank_bit < 13);
+ u32 hbb = cfg->highest_bank_bit - 13;
bool rgb565_predicator = cfg->ubwc_enc_version >= UBWC_4_0;
u32 level2_swizzling_dis = !(cfg->ubwc_swizzle & BIT(1));
bool ubwc_mode = qcom_ubwc_get_ubwc_mode(cfg);
@@ -695,7 +693,7 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
min_acc_len_64b << 23 | hbb_lo << 21);
gpu_write(gpu, REG_A6XX_RBBM_NC_MODE_CNTL,
- adreno_gpu->ubwc_config.macrotile_mode);
+ cfg->macrotile_mode);
}
static void a7xx_patch_pwrup_reglist(struct msm_gpu *gpu)
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index 2348ffb35f7eb73a26da47881901d9111dca1ad9..f072c2156e94dfba8273e33e752167d919dc4db5 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -388,16 +388,16 @@ int adreno_get_param(struct msm_gpu *gpu, struct msm_file_private *ctx,
*value = ctx->aspace->va_size;
return 0;
case MSM_PARAM_HIGHEST_BANK_BIT:
- *value = adreno_gpu->ubwc_config.highest_bank_bit;
+ *value = adreno_gpu->ubwc_config->highest_bank_bit;
return 0;
case MSM_PARAM_RAYTRACING:
*value = adreno_gpu->has_ray_tracing;
return 0;
case MSM_PARAM_UBWC_SWIZZLE:
- *value = adreno_gpu->ubwc_config.ubwc_swizzle;
+ *value = adreno_gpu->ubwc_config->ubwc_swizzle;
return 0;
case MSM_PARAM_MACROTILE_MODE:
- *value = adreno_gpu->ubwc_config.macrotile_mode;
+ *value = adreno_gpu->ubwc_config->macrotile_mode;
return 0;
case MSM_PARAM_UCHE_TRAP_BASE:
*value = adreno_gpu->uche_trap_base;
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.h b/drivers/gpu/drm/msm/adreno/adreno_gpu.h
index 06be95d3efaee94e4107a484ad3132e0a6a9ea46..ebbca9672f25861bbbfa3ff28878c581fae6402c 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.h
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.h
@@ -207,45 +207,12 @@ struct adreno_gpu {
/* firmware: */
const struct firmware *fw[ADRENO_FW_MAX];
- struct {
- /**
- * @rgb565_predicator: Unknown, introduced with A650 family,
- * related to UBWC mode/ver 4
- */
- u32 rgb565_predicator;
- /** @uavflagprd_inv: Unknown, introduced with A650 family */
- u32 uavflagprd_inv;
- /** @min_acc_len: Whether the minimum access length is 64 bits */
- u32 min_acc_len;
- /**
- * @ubwc_swizzle: Whether to enable level 1, 2 & 3 bank swizzling.
- *
- * UBWC 1.0 always enables all three levels.
- * UBWC 2.0 removes level 1 bank swizzling, leaving levels 2 & 3.
- * UBWC 4.0 adds the optional ability to disable levels 2 & 3.
- *
- * This is a bitmask where BIT(0) enables level 1, BIT(1)
- * controls level 2, and BIT(2) enables level 3.
- */
- u32 ubwc_swizzle;
- /**
- * @highest_bank_bit: Highest Bank Bit
- *
- * The Highest Bank Bit value represents the bit of the highest
- * DDR bank. This should ideally use DRAM type detection.
- */
- u32 highest_bank_bit;
- u32 amsbc;
- /**
- * @macrotile_mode: Macrotile Mode
- *
- * Whether to use 4-channel macrotiling mode or the newer
- * 8-channel macrotiling mode introduced in UBWC 3.1. 0 is
- * 4-channel and 1 is 8-channel.
- */
- u32 macrotile_mode;
- } ubwc_config;
- const struct qcom_ubwc_cfg_data *common_ubwc_cfg;
+ /*
+ * The migration to the central UBWC config db is still in flight - keep
+ * a copy containing some local fixups until that's done.
+ */
+ const struct qcom_ubwc_cfg_data *ubwc_config;
+ struct qcom_ubwc_cfg_data _ubwc_config;
/*
* Register offsets are different between some GPUs.
--
2.49.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH RFT v2 12/15] drm/msm/a6xx: Drop cfg->ubwc_swizzle override
2025-05-14 15:10 [RFT PATCH v2 00/15] Add a single source of truth for UBWC configuration data Konrad Dybcio
` (10 preceding siblings ...)
2025-05-14 15:10 ` [PATCH RFT v2 11/15] drm/msm/adreno: Switch to the common UBWC config struct Konrad Dybcio
@ 2025-05-14 15:10 ` Konrad Dybcio
2025-05-14 20:32 ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFT v2 13/15] soc: qcom: ubwc: Fix SM6125's ubwc_swizzle value Konrad Dybcio
` (2 subsequent siblings)
14 siblings, 1 reply; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-14 15:10 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Clark, Abhinav Kumar,
Dmitry Baryshkov, Akhil P Oommen, Sean Paul, David Airlie,
Simona Vetter
Cc: Marijn Suijten, linux-kernel, linux-arm-msm, dri-devel, freedreno,
Konrad Dybcio
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
On A663 (SA8775P) the value matches exactly.
On A610, the value matches on SM6115, but is different on SM6125. That
turns out not to be a problem, as the bits that differ aren't even
interpreted.
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index ae0bb7934e7ed203aa3b81e28767de204f0a4d60..eaf468b67f97ff153e92a73a45581228fcf75e46 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -598,13 +598,10 @@ static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
/* Copy the data into the internal struct to drop the const qualifier (temporarily) */
*cfg = *common_cfg;
- cfg->ubwc_swizzle = 0x6;
cfg->highest_bank_bit = 15;
- if (adreno_is_a610(gpu)) {
+ if (adreno_is_a610(gpu))
cfg->highest_bank_bit = 13;
- cfg->ubwc_swizzle = 0x7;
- }
if (adreno_is_a618(gpu))
cfg->highest_bank_bit = 14;
@@ -631,10 +628,8 @@ static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
cfg->highest_bank_bit = 16;
}
- if (adreno_is_a663(gpu)) {
+ if (adreno_is_a663(gpu))
cfg->highest_bank_bit = 13;
- cfg->ubwc_swizzle = 0x4;
- }
if (adreno_is_7c3(gpu))
cfg->highest_bank_bit = 14;
--
2.49.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH RFT v2 13/15] soc: qcom: ubwc: Fix SM6125's ubwc_swizzle value
2025-05-14 15:10 [RFT PATCH v2 00/15] Add a single source of truth for UBWC configuration data Konrad Dybcio
` (11 preceding siblings ...)
2025-05-14 15:10 ` [PATCH RFT v2 12/15] drm/msm/a6xx: Drop cfg->ubwc_swizzle override Konrad Dybcio
@ 2025-05-14 15:10 ` Konrad Dybcio
2025-05-14 19:23 ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFT v2 14/15] soc: qcom: ubwc: Add #defines for UBWC swizzle bits Konrad Dybcio
2025-05-14 15:10 ` [PATCH RFC RFT v2 15/15] drm/msm/a6xx: Warn if the highest_bank_bit value is overwritten Konrad Dybcio
14 siblings, 1 reply; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-14 15:10 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Clark, Abhinav Kumar,
Dmitry Baryshkov, Akhil P Oommen, Sean Paul, David Airlie,
Simona Vetter
Cc: Marijn Suijten, linux-kernel, linux-arm-msm, dri-devel, freedreno,
Konrad Dybcio
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
The value of 7 (a.k.a. GENMASK(2, 0), a.k.a. disabling levels 1-3 of
swizzling) is what we want on this platform (and others with a UBWC
1.0 encoder).
Fix it to make mesa happy (the hardware doesn't care about the 2 higher
bits, as they weren't consumed on this platform).
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
drivers/soc/qcom/ubwc_config.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/soc/qcom/ubwc_config.c b/drivers/soc/qcom/ubwc_config.c
index 9caecd071035ccb03f14464e9b7129ba34a7f862..96b94cf01218cce2dacdba22c7573ba6148fcdd1 100644
--- a/drivers/soc/qcom/ubwc_config.c
+++ b/drivers/soc/qcom/ubwc_config.c
@@ -103,7 +103,7 @@ static const struct qcom_ubwc_cfg_data sm6115_data = {
static const struct qcom_ubwc_cfg_data sm6125_data = {
.ubwc_enc_version = UBWC_1_0,
.ubwc_dec_version = UBWC_3_0,
- .ubwc_swizzle = 1,
+ .ubwc_swizzle = 7,
.highest_bank_bit = 14,
};
--
2.49.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH RFT v2 14/15] soc: qcom: ubwc: Add #defines for UBWC swizzle bits
2025-05-14 15:10 [RFT PATCH v2 00/15] Add a single source of truth for UBWC configuration data Konrad Dybcio
` (12 preceding siblings ...)
2025-05-14 15:10 ` [PATCH RFT v2 13/15] soc: qcom: ubwc: Fix SM6125's ubwc_swizzle value Konrad Dybcio
@ 2025-05-14 15:10 ` Konrad Dybcio
2025-05-14 19:24 ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFC RFT v2 15/15] drm/msm/a6xx: Warn if the highest_bank_bit value is overwritten Konrad Dybcio
14 siblings, 1 reply; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-14 15:10 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Clark, Abhinav Kumar,
Dmitry Baryshkov, Akhil P Oommen, Sean Paul, David Airlie,
Simona Vetter
Cc: Marijn Suijten, linux-kernel, linux-arm-msm, dri-devel, freedreno,
Konrad Dybcio
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Make the values a bit more meaningful.
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
drivers/soc/qcom/ubwc_config.c | 33 +++++++++++++++++++++------------
include/linux/soc/qcom/ubwc.h | 2 ++
2 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/drivers/soc/qcom/ubwc_config.c b/drivers/soc/qcom/ubwc_config.c
index 96b94cf01218cce2dacdba22c7573ba6148fcdd1..06ddf78eb08d31bcdd11f23dcf9ff32e390d2eff 100644
--- a/drivers/soc/qcom/ubwc_config.c
+++ b/drivers/soc/qcom/ubwc_config.c
@@ -32,7 +32,7 @@ static const struct qcom_ubwc_cfg_data qcm2290_data = {
static const struct qcom_ubwc_cfg_data sa8775p_data = {
.ubwc_enc_version = UBWC_4_0,
.ubwc_dec_version = UBWC_4_0,
- .ubwc_swizzle = 4,
+ .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_LVL(3),
.ubwc_bank_spread = true,
.highest_bank_bit = 13,
.macrotile_mode = true,
@@ -41,7 +41,8 @@ static const struct qcom_ubwc_cfg_data sa8775p_data = {
static const struct qcom_ubwc_cfg_data sar2130p_data = {
.ubwc_enc_version = UBWC_3_0, /* 4.0.2 in hw */
.ubwc_dec_version = UBWC_4_3,
- .ubwc_swizzle = 6,
+ .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_LVL(2) |
+ UBWC_SWIZZLE_ENABLE_LVL(3),
.ubwc_bank_spread = true,
.highest_bank_bit = 13,
.macrotile_mode = true,
@@ -50,7 +51,8 @@ static const struct qcom_ubwc_cfg_data sar2130p_data = {
static const struct qcom_ubwc_cfg_data sc7180_data = {
.ubwc_enc_version = UBWC_2_0,
.ubwc_dec_version = UBWC_2_0,
- .ubwc_swizzle = 6,
+ .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_LVL(2) |
+ UBWC_SWIZZLE_ENABLE_LVL(3),
.ubwc_bank_spread = true,
.highest_bank_bit = 14,
};
@@ -58,7 +60,8 @@ static const struct qcom_ubwc_cfg_data sc7180_data = {
static const struct qcom_ubwc_cfg_data sc7280_data = {
.ubwc_enc_version = UBWC_3_0,
.ubwc_dec_version = UBWC_4_0,
- .ubwc_swizzle = 6,
+ .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_LVL(2) |
+ UBWC_SWIZZLE_ENABLE_LVL(3),
.ubwc_bank_spread = true,
.highest_bank_bit = 14,
.macrotile_mode = true,
@@ -74,7 +77,8 @@ static const struct qcom_ubwc_cfg_data sc8180x_data = {
static const struct qcom_ubwc_cfg_data sc8280xp_data = {
.ubwc_enc_version = UBWC_4_0,
.ubwc_dec_version = UBWC_4_0,
- .ubwc_swizzle = 6,
+ .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_LVL(2) |
+ UBWC_SWIZZLE_ENABLE_LVL(3),
.ubwc_bank_spread = true,
.highest_bank_bit = 16,
.macrotile_mode = true,
@@ -95,7 +99,7 @@ static const struct qcom_ubwc_cfg_data sdm845_data = {
static const struct qcom_ubwc_cfg_data sm6115_data = {
.ubwc_enc_version = UBWC_1_0,
.ubwc_dec_version = UBWC_2_0,
- .ubwc_swizzle = 7,
+ .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_ALL,
.ubwc_bank_spread = true,
.highest_bank_bit = 14,
};
@@ -103,7 +107,7 @@ static const struct qcom_ubwc_cfg_data sm6115_data = {
static const struct qcom_ubwc_cfg_data sm6125_data = {
.ubwc_enc_version = UBWC_1_0,
.ubwc_dec_version = UBWC_3_0,
- .ubwc_swizzle = 7,
+ .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_ALL,
.highest_bank_bit = 14,
};
@@ -116,7 +120,8 @@ static const struct qcom_ubwc_cfg_data sm6150_data = {
static const struct qcom_ubwc_cfg_data sm6350_data = {
.ubwc_enc_version = UBWC_2_0,
.ubwc_dec_version = UBWC_2_0,
- .ubwc_swizzle = 6,
+ .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_LVL(2) |
+ UBWC_SWIZZLE_ENABLE_LVL(3),
.ubwc_bank_spread = true,
.highest_bank_bit = 14,
};
@@ -136,7 +141,8 @@ static const struct qcom_ubwc_cfg_data sm8150_data = {
static const struct qcom_ubwc_cfg_data sm8250_data = {
.ubwc_enc_version = UBWC_4_0,
.ubwc_dec_version = UBWC_4_0,
- .ubwc_swizzle = 6,
+ .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_LVL(2) |
+ UBWC_SWIZZLE_ENABLE_LVL(3),
.ubwc_bank_spread = true,
/* TODO: highest_bank_bit = 15 for LP_DDR4 */
.highest_bank_bit = 16,
@@ -146,7 +152,8 @@ static const struct qcom_ubwc_cfg_data sm8250_data = {
static const struct qcom_ubwc_cfg_data sm8350_data = {
.ubwc_enc_version = UBWC_4_0,
.ubwc_dec_version = UBWC_4_0,
- .ubwc_swizzle = 6,
+ .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_LVL(2) |
+ UBWC_SWIZZLE_ENABLE_LVL(3),
.ubwc_bank_spread = true,
/* TODO: highest_bank_bit = 15 for LP_DDR4 */
.highest_bank_bit = 16,
@@ -156,7 +163,8 @@ static const struct qcom_ubwc_cfg_data sm8350_data = {
static const struct qcom_ubwc_cfg_data sm8550_data = {
.ubwc_enc_version = UBWC_4_0,
.ubwc_dec_version = UBWC_4_3,
- .ubwc_swizzle = 6,
+ .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_LVL(2) |
+ UBWC_SWIZZLE_ENABLE_LVL(3),
.ubwc_bank_spread = true,
/* TODO: highest_bank_bit = 15 for LP_DDR4 */
.highest_bank_bit = 16,
@@ -166,7 +174,8 @@ static const struct qcom_ubwc_cfg_data sm8550_data = {
static const struct qcom_ubwc_cfg_data x1e80100_data = {
.ubwc_enc_version = UBWC_4_0,
.ubwc_dec_version = UBWC_4_3,
- .ubwc_swizzle = 6,
+ .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_LVL(2) |
+ UBWC_SWIZZLE_ENABLE_LVL(3),
.ubwc_bank_spread = true,
/* TODO: highest_bank_bit = 15 for LP_DDR4 */
.highest_bank_bit = 16,
diff --git a/include/linux/soc/qcom/ubwc.h b/include/linux/soc/qcom/ubwc.h
index 30d9744c5d2e06d4aa93b64f7d2bc0e855c7a10b..2a12e054ec62ae7e76c3f3291d6963da726eee4f 100644
--- a/include/linux/soc/qcom/ubwc.h
+++ b/include/linux/soc/qcom/ubwc.h
@@ -26,6 +26,8 @@ struct qcom_ubwc_cfg_data {
* controls level 2, and BIT(2) enables level 3.
*/
u32 ubwc_swizzle;
+#define UBWC_SWIZZLE_ENABLE_ALL GENMASK(2, 0)
+#define UBWC_SWIZZLE_ENABLE_LVL(n) BIT(((n) - 1))
/**
* @highest_bank_bit: Highest Bank Bit
--
2.49.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* [PATCH RFC RFT v2 15/15] drm/msm/a6xx: Warn if the highest_bank_bit value is overwritten
2025-05-14 15:10 [RFT PATCH v2 00/15] Add a single source of truth for UBWC configuration data Konrad Dybcio
` (13 preceding siblings ...)
2025-05-14 15:10 ` [PATCH RFT v2 14/15] soc: qcom: ubwc: Add #defines for UBWC swizzle bits Konrad Dybcio
@ 2025-05-14 15:10 ` Konrad Dybcio
2025-05-14 19:25 ` Dmitry Baryshkov
14 siblings, 1 reply; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-14 15:10 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Clark, Abhinav Kumar,
Dmitry Baryshkov, Akhil P Oommen, Sean Paul, David Airlie,
Simona Vetter
Cc: Marijn Suijten, linux-kernel, linux-arm-msm, dri-devel, freedreno,
Konrad Dybcio
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
In preparation to resolve the issue of hardcoding HBB, throw a warning
if the value is being overwritten in the GPU driver.
The HBB value is directly correlated with the memory configuration.
On platforms where more than one is supported, the value must differ
for proper functioning of the hardware, but it also must be consistent
across all UBWC producers/consumers.
On platforms supporting only a single DRAM setup, the value may still
be wrong, or at least inconsistent.
Print a warning to help catch such cases, until we declare full trust
to the central database.
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index eaf468b67f97ff153e92a73a45581228fcf75e46..ab812338739568d5908ca439e5c53e230a02de5d 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -637,6 +637,10 @@ static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
if (adreno_is_a702(gpu))
cfg->highest_bank_bit = 14;
+ if (cfg->highest_bank_bit != common_cfg->highest_bank_bit)
+ DRM_WARN_ONCE("Inconclusive highest_bank_bit value: %u (GPU) vs %u (UBWC_CFG)\n",
+ cfg->highest_bank_bit, common_cfg->highest_bank_bit);
+
gpu->ubwc_config = &gpu->_ubwc_config;
return 0;
--
2.49.0
^ permalink raw reply related [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 01/15] soc: qcom: Add UBWC config provider
2025-05-14 15:10 ` [PATCH RFT v2 01/15] soc: qcom: Add UBWC config provider Konrad Dybcio
@ 2025-05-14 15:29 ` Konrad Dybcio
2025-05-14 19:03 ` Dmitry Baryshkov
1 sibling, 0 replies; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-14 15:29 UTC (permalink / raw)
To: Konrad Dybcio, Bjorn Andersson, Rob Clark, Abhinav Kumar,
Dmitry Baryshkov, Akhil P Oommen, Sean Paul, David Airlie,
Simona Vetter
Cc: Marijn Suijten, linux-kernel, linux-arm-msm, dri-devel, freedreno,
Konrad Dybcio
On 5/14/25 5:10 PM, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
> Add a file that will serve as a single source of truth for UBWC
> configuration data for various multimedia blocks.
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> ---
> +static const struct qcom_ubwc_cfg_data sar2130p_data = {
So I failed to add a user for this below..
---
{ .compatible = "qcom,sar2130p", .data = &sar2130p_data },
---
Konrad
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 01/15] soc: qcom: Add UBWC config provider
2025-05-14 15:10 ` [PATCH RFT v2 01/15] soc: qcom: Add UBWC config provider Konrad Dybcio
2025-05-14 15:29 ` Konrad Dybcio
@ 2025-05-14 19:03 ` Dmitry Baryshkov
2025-05-15 15:50 ` Konrad Dybcio
1 sibling, 1 reply; 47+ messages in thread
From: Dmitry Baryshkov @ 2025-05-14 19:03 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno, Konrad Dybcio
On Wed, May 14, 2025 at 05:10:21PM +0200, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
> Add a file that will serve as a single source of truth for UBWC
> configuration data for various multimedia blocks.
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> ---
> drivers/soc/qcom/Kconfig | 8 ++
> drivers/soc/qcom/Makefile | 1 +
> drivers/soc/qcom/ubwc_config.c | 235 +++++++++++++++++++++++++++++++++++++++++
> include/linux/soc/qcom/ubwc.h | 67 ++++++++++++
> 4 files changed, 311 insertions(+)
>
With the SAR2130P fixed
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> +
> + /**
> + * @highest_bank_bit: Highest Bank Bit
> + *
> + * The Highest Bank Bit value represents the bit of the highest
> + * DDR bank. This should ideally use DRAM type detection.
> + */
> + int highest_bank_bit;
> + bool ubwc_bank_spread;
Nit: any documentation for this one?
> +
> + /**
> + * @macrotile_mode: Macrotile Mode
> + *
> + * Whether to use 4-channel macrotiling mode or the newer
> + * 8-channel macrotiling mode introduced in UBWC 3.1. 0 is
> + * 4-channel and 1 is 8-channel.
> + */
> + bool macrotile_mode;
> +};
> +
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 02/15] drm/msm: Offset MDSS HBB value by 13
2025-05-14 15:10 ` [PATCH RFT v2 02/15] drm/msm: Offset MDSS HBB value by 13 Konrad Dybcio
@ 2025-05-14 19:04 ` Dmitry Baryshkov
0 siblings, 0 replies; 47+ messages in thread
From: Dmitry Baryshkov @ 2025-05-14 19:04 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno, Konrad Dybcio
On Wed, May 14, 2025 at 05:10:22PM +0200, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
> The Adreno part of the driver exposes this value to userspace, and the
> SMEM data source also presents a x+13 value. Keep things coherent and
> make the value uniform across them.
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/msm_mdss.c | 50 +++++++++++++++++++++---------------------
> 1 file changed, 25 insertions(+), 25 deletions(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 03/15] drm/msm: Use the central UBWC config database
2025-05-14 15:10 ` [PATCH RFT v2 03/15] drm/msm: Use the central UBWC config database Konrad Dybcio
@ 2025-05-14 19:05 ` Dmitry Baryshkov
2025-05-15 10:32 ` kernel test robot
1 sibling, 0 replies; 47+ messages in thread
From: Dmitry Baryshkov @ 2025-05-14 19:05 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno, Konrad Dybcio
On Wed, May 14, 2025 at 05:10:23PM +0200, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
> As discussed a lot in the past, the UBWC config must be coherent across
> a number of IP blocks (currently display and GPU, but it also may/will
> concern camera/video as the drivers evolve).
>
> So far, we've been trying to keep the values reasonable in each of the
> two drivers separately, but it really make sense to do so centrally,
> especially given certain fields (e.g. HBB) may need to be gathered
> dynamically.
>
> To reduce room for error, move to fetching the config from a central
> source, so that the data programmed into the hardware is consistent
> across all multimedia blocks that request it.
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/Kconfig | 1 +
> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 6 +-
> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 4 +-
> drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 7 +-
> drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 2 +-
> drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 3 +-
> drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 2 +-
> drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h | 2 +-
> drivers/gpu/drm/msm/msm_mdss.c | 327 +++++-----------------------
> drivers/gpu/drm/msm/msm_mdss.h | 28 ---
> 10 files changed, 73 insertions(+), 309 deletions(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 06/15] drm/msm/a6xx: Simplify uavflagprd_inv detection
2025-05-14 15:10 ` [PATCH RFT v2 06/15] drm/msm/a6xx: Simplify uavflagprd_inv detection Konrad Dybcio
@ 2025-05-14 19:14 ` Dmitry Baryshkov
0 siblings, 0 replies; 47+ messages in thread
From: Dmitry Baryshkov @ 2025-05-14 19:14 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno, Konrad Dybcio
On Wed, May 14, 2025 at 05:10:26PM +0200, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
> Instead of setting it on a gpu-per-gpu basis, converge it to the
> intended "is A650 family or A7xx".
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
>
> @@ -667,6 +660,7 @@ static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
> static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
> {
> struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
> + u8 uavflagprd_inv = adreno_is_a650_family(adreno_gpu) || adreno_is_a7xx(adreno_gpu) ? 2 : 0;
Nit: could you please move the assignment after the variable section? It
will be more readable this way. Or set it to 0 here and override later.
> const struct qcom_ubwc_cfg_data *cfg = adreno_gpu->common_ubwc_cfg;
> /*
> * We subtract 13 from the highest bank bit (13 is the minimum value
> @@ -695,7 +689,7 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
>
> gpu_write(gpu, REG_A6XX_SP_NC_MODE_CNTL,
> level2_swizzling_dis << 12 | hbb_hi << 10 |
> - adreno_gpu->ubwc_config.uavflagprd_inv << 4 |
> + uavflagprd_inv << 4 |
> adreno_gpu->ubwc_config.min_acc_len << 3 |
> hbb_lo << 1 | ubwc_mode);
>
>
> --
> 2.49.0
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 07/15] drm/msm/a6xx: Resolve the meaning of UBWC_MODE
2025-05-14 15:10 ` [PATCH RFT v2 07/15] drm/msm/a6xx: Resolve the meaning of UBWC_MODE Konrad Dybcio
@ 2025-05-14 19:14 ` Dmitry Baryshkov
2025-05-14 20:02 ` Rob Clark
0 siblings, 1 reply; 47+ messages in thread
From: Dmitry Baryshkov @ 2025-05-14 19:14 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno, Konrad Dybcio
On Wed, May 14, 2025 at 05:10:27PM +0200, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
> This bit is set iff the UBWC version is 1.0. That notably does not
> include QCM2290's "no UBWC".
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> index e7c89f9c7d89798699848743843eed6a58b94bd3..6af4e70c1b936a30c1934dd49f2889be13c9780d 100644
> --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> @@ -669,10 +669,10 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
> */
> BUG_ON(adreno_gpu->ubwc_config.highest_bank_bit < 13);
> u32 hbb = adreno_gpu->ubwc_config.highest_bank_bit - 13;
> + bool ubwc_mode = qcom_ubwc_get_ubwc_mode(cfg);
I'd really prefer if the function came in this patch rather than being
added at some earlier point. I understand that you want to simplify
cross-tree merging, but I think we should also simplify reviewing.
> bool amsbc = cfg->ubwc_enc_version >= UBWC_3_0;
> u32 hbb_hi = hbb >> 2;
> u32 hbb_lo = hbb & 3;
> - u32 ubwc_mode = adreno_gpu->ubwc_config.ubwc_swizzle & 1;
> u32 level2_swizzling_dis = !(adreno_gpu->ubwc_config.ubwc_swizzle & 2);
>
> gpu_write(gpu, REG_A6XX_RB_NC_MODE_CNTL,
>
> --
> 2.49.0
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 08/15] drm/msm/a6xx: Replace '2' with BIT(1) in level2_swizzling_dis calc
2025-05-14 15:10 ` [PATCH RFT v2 08/15] drm/msm/a6xx: Replace '2' with BIT(1) in level2_swizzling_dis calc Konrad Dybcio
@ 2025-05-14 19:15 ` Dmitry Baryshkov
0 siblings, 0 replies; 47+ messages in thread
From: Dmitry Baryshkov @ 2025-05-14 19:15 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno, Konrad Dybcio
On Wed, May 14, 2025 at 05:10:28PM +0200, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
> ubwc_swizzle is a bitmask. Check for a bit to make it more obvious.
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 09/15] drm/msm/a6xx: Resolve the meaning of rgb565_predicator
2025-05-14 15:10 ` [PATCH RFT v2 09/15] drm/msm/a6xx: Resolve the meaning of rgb565_predicator Konrad Dybcio
@ 2025-05-14 19:15 ` Dmitry Baryshkov
0 siblings, 0 replies; 47+ messages in thread
From: Dmitry Baryshkov @ 2025-05-14 19:15 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno, Konrad Dybcio
On Wed, May 14, 2025 at 05:10:29PM +0200, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
> It's supposed to be on when the UBWC encoder version is >= 4.0.
> Drop the per-GPU assignments.
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 05/15] drm/msm/a6xx: Resolve the meaning of AMSBC
2025-05-14 15:10 ` [PATCH RFT v2 05/15] drm/msm/a6xx: Resolve the meaning of AMSBC Konrad Dybcio
@ 2025-05-14 19:16 ` Dmitry Baryshkov
0 siblings, 0 replies; 47+ messages in thread
From: Dmitry Baryshkov @ 2025-05-14 19:16 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno, Konrad Dybcio
On Wed, May 14, 2025 at 05:10:25PM +0200, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
> The bit must be set to 1 if the UBWC encoder version is >= 3.0, drop it
> as a separate field.
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 10/15] drm/msm/a6xx: Simplify min_acc_len calculation
2025-05-14 15:10 ` [PATCH RFT v2 10/15] drm/msm/a6xx: Simplify min_acc_len calculation Konrad Dybcio
@ 2025-05-14 19:19 ` Dmitry Baryshkov
2025-05-15 15:51 ` Konrad Dybcio
0 siblings, 1 reply; 47+ messages in thread
From: Dmitry Baryshkov @ 2025-05-14 19:19 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno, Konrad Dybcio
On Wed, May 14, 2025 at 05:10:30PM +0200, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
> It's only necessary for some lower end parts.
> Also rename it to min_acc_len_64b to denote that if set, the minimum
> access length is 64 bits, 32b otherwise.
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> index 5ee5f8dc90fe0d1647ce07b7dbcadc6ca2ecd416..fdc843c47c075a92ec8305217c355e4ccee876dc 100644
> --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> @@ -592,14 +592,12 @@ static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
> if (IS_ERR(gpu->common_ubwc_cfg))
> return -EINVAL;
>
> - gpu->ubwc_config.min_acc_len = 0;
> gpu->ubwc_config.ubwc_swizzle = 0x6;
> gpu->ubwc_config.macrotile_mode = 0;
> gpu->ubwc_config.highest_bank_bit = 15;
It occurred to me that here (and in some previous patches) you stopped
setting the field, but you didn't drop it from adreno_gpu.ubwc_config.
Would you mind updating the patches in this way?
With that fixed:
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>
> if (adreno_is_a610(gpu)) {
> gpu->ubwc_config.highest_bank_bit = 13;
> - gpu->ubwc_config.min_acc_len = 1;
> gpu->ubwc_config.ubwc_swizzle = 0x7;
> }
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 11/15] drm/msm/adreno: Switch to the common UBWC config struct
2025-05-14 15:10 ` [PATCH RFT v2 11/15] drm/msm/adreno: Switch to the common UBWC config struct Konrad Dybcio
@ 2025-05-14 19:22 ` Dmitry Baryshkov
2025-05-15 15:51 ` Konrad Dybcio
0 siblings, 1 reply; 47+ messages in thread
From: Dmitry Baryshkov @ 2025-05-14 19:22 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno, Konrad Dybcio
On Wed, May 14, 2025 at 05:10:31PM +0200, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
> Now that Adreno specifics are out of the way, use the common config
> (but leave the HBB hardcoding in place until that is wired up on the
> other side).
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 20 +++++------
> drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 64 ++++++++++++++++-----------------
> drivers/gpu/drm/msm/adreno/adreno_gpu.c | 6 ++--
> drivers/gpu/drm/msm/adreno/adreno_gpu.h | 45 ++++-------------------
> 4 files changed, 50 insertions(+), 85 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> index 650e5bac225f372e819130b891f1d020b464f17f..611e0eb26d0e19d431673d08e042162375fd400f 100644
> --- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> @@ -833,8 +833,8 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
>
> gpu_write(gpu, REG_A5XX_RBBM_AHB_CNTL2, 0x0000003F);
>
> - BUG_ON(adreno_gpu->ubwc_config.highest_bank_bit < 13);
> - hbb = adreno_gpu->ubwc_config.highest_bank_bit - 13;
> + BUG_ON(adreno_gpu->ubwc_config->highest_bank_bit < 13);
> + hbb = adreno_gpu->ubwc_config->highest_bank_bit - 13;
>
> gpu_write(gpu, REG_A5XX_TPL1_MODE_CNTL, hbb << 7);
> gpu_write(gpu, REG_A5XX_RB_MODE_CNTL, hbb << 1);
> @@ -1754,6 +1754,7 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev)
> struct msm_drm_private *priv = dev->dev_private;
> struct platform_device *pdev = priv->gpu_pdev;
> struct adreno_platform_config *config = pdev->dev.platform_data;
> + const struct qcom_ubwc_cfg_data *common_cfg;
> struct a5xx_gpu *a5xx_gpu = NULL;
> struct adreno_gpu *adreno_gpu;
> struct msm_gpu *gpu;
> @@ -1790,15 +1791,14 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev)
> /* Set up the preemption specific bits and pieces for each ringbuffer */
> a5xx_preempt_init(gpu);
>
> - /* Set the highest bank bit */
> - if (adreno_is_a540(adreno_gpu) || adreno_is_a530(adreno_gpu))
> - adreno_gpu->ubwc_config.highest_bank_bit = 15;
> - else
> - adreno_gpu->ubwc_config.highest_bank_bit = 14;
> + /* Inherit the common config and make some necessary fixups */
> + common_cfg = qcom_ubwc_config_get_data();
> + if (IS_ERR(common_cfg))
> + return ERR_PTR(-EINVAL);
>
> - /* a5xx only supports UBWC 1.0, these are not configurable */
> - adreno_gpu->ubwc_config.macrotile_mode = 0;
> - adreno_gpu->ubwc_config.ubwc_swizzle = 0x7;
> + /* Copy the data into the internal struct to drop the const qualifier (temporarily) */
> + adreno_gpu->_ubwc_config = *common_cfg;
> + adreno_gpu->ubwc_config = &adreno_gpu->_ubwc_config;
Ugh. I'd rather keep the ubwc config r/o.
>
> adreno_gpu->uche_trap_base = 0x0001ffffffff0000ull;
>
> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> index fdc843c47c075a92ec8305217c355e4ccee876dc..ae0bb7934e7ed203aa3b81e28767de204f0a4d60 100644
> --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> @@ -587,64 +587,62 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu)
>
> static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
> {
> + const struct qcom_ubwc_cfg_data *common_cfg;
> + struct qcom_ubwc_cfg_data *cfg = &gpu->_ubwc_config;
> +
> /* Inherit the common config and make some necessary fixups */
> - gpu->common_ubwc_cfg = qcom_ubwc_config_get_data();
> - if (IS_ERR(gpu->common_ubwc_cfg))
> + common_cfg = qcom_ubwc_config_get_data();
> + if (IS_ERR(common_cfg))
> return -EINVAL;
>
> - gpu->ubwc_config.ubwc_swizzle = 0x6;
> - gpu->ubwc_config.macrotile_mode = 0;
> - gpu->ubwc_config.highest_bank_bit = 15;
> + /* Copy the data into the internal struct to drop the const qualifier (temporarily) */
> + *cfg = *common_cfg;
> +
> + cfg->ubwc_swizzle = 0x6;
> + cfg->highest_bank_bit = 15;
>
This begs for WARN_ON(cfg->ubwc_swizzle !=
gpu->common_ubwc_cfg->ubwc_swizzle) and similar change for HBB. Then
after testing we should be able to drop r/w part of the config.
> if (adreno_is_a610(gpu)) {
> - gpu->ubwc_config.highest_bank_bit = 13;
> - gpu->ubwc_config.ubwc_swizzle = 0x7;
> + cfg->highest_bank_bit = 13;
> + cfg->ubwc_swizzle = 0x7;
> }
>
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 13/15] soc: qcom: ubwc: Fix SM6125's ubwc_swizzle value
2025-05-14 15:10 ` [PATCH RFT v2 13/15] soc: qcom: ubwc: Fix SM6125's ubwc_swizzle value Konrad Dybcio
@ 2025-05-14 19:23 ` Dmitry Baryshkov
2025-05-14 20:05 ` Konrad Dybcio
0 siblings, 1 reply; 47+ messages in thread
From: Dmitry Baryshkov @ 2025-05-14 19:23 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno, Konrad Dybcio
On Wed, May 14, 2025 at 05:10:33PM +0200, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
> The value of 7 (a.k.a. GENMASK(2, 0), a.k.a. disabling levels 1-3 of
> swizzling) is what we want on this platform (and others with a UBWC
> 1.0 encoder).
>
> Fix it to make mesa happy (the hardware doesn't care about the 2 higher
> bits, as they weren't consumed on this platform).
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> ---
> drivers/soc/qcom/ubwc_config.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/soc/qcom/ubwc_config.c b/drivers/soc/qcom/ubwc_config.c
> index 9caecd071035ccb03f14464e9b7129ba34a7f862..96b94cf01218cce2dacdba22c7573ba6148fcdd1 100644
> --- a/drivers/soc/qcom/ubwc_config.c
> +++ b/drivers/soc/qcom/ubwc_config.c
> @@ -103,7 +103,7 @@ static const struct qcom_ubwc_cfg_data sm6115_data = {
> static const struct qcom_ubwc_cfg_data sm6125_data = {
> .ubwc_enc_version = UBWC_1_0,
> .ubwc_dec_version = UBWC_3_0,
> - .ubwc_swizzle = 1,
> + .ubwc_swizzle = 7,
> .highest_bank_bit = 14,
> };
Add a comment and squash into the patch 1.
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 14/15] soc: qcom: ubwc: Add #defines for UBWC swizzle bits
2025-05-14 15:10 ` [PATCH RFT v2 14/15] soc: qcom: ubwc: Add #defines for UBWC swizzle bits Konrad Dybcio
@ 2025-05-14 19:24 ` Dmitry Baryshkov
2025-05-14 20:09 ` Konrad Dybcio
0 siblings, 1 reply; 47+ messages in thread
From: Dmitry Baryshkov @ 2025-05-14 19:24 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno, Konrad Dybcio
On Wed, May 14, 2025 at 05:10:34PM +0200, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
> Make the values a bit more meaningful.
Not sure if it's more meaningful or not. In the end, we all can read hex
masks.
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> ---
> drivers/soc/qcom/ubwc_config.c | 33 +++++++++++++++++++++------------
> include/linux/soc/qcom/ubwc.h | 2 ++
> 2 files changed, 23 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/soc/qcom/ubwc_config.c b/drivers/soc/qcom/ubwc_config.c
> index 96b94cf01218cce2dacdba22c7573ba6148fcdd1..06ddf78eb08d31bcdd11f23dcf9ff32e390d2eff 100644
> --- a/drivers/soc/qcom/ubwc_config.c
> +++ b/drivers/soc/qcom/ubwc_config.c
> @@ -32,7 +32,7 @@ static const struct qcom_ubwc_cfg_data qcm2290_data = {
> static const struct qcom_ubwc_cfg_data sa8775p_data = {
> .ubwc_enc_version = UBWC_4_0,
> .ubwc_dec_version = UBWC_4_0,
> - .ubwc_swizzle = 4,
> + .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_LVL(3),
> .ubwc_bank_spread = true,
> .highest_bank_bit = 13,
> .macrotile_mode = true,
> @@ -41,7 +41,8 @@ static const struct qcom_ubwc_cfg_data sa8775p_data = {
> static const struct qcom_ubwc_cfg_data sar2130p_data = {
> .ubwc_enc_version = UBWC_3_0, /* 4.0.2 in hw */
> .ubwc_dec_version = UBWC_4_3,
> - .ubwc_swizzle = 6,
> + .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_LVL(2) |
> + UBWC_SWIZZLE_ENABLE_LVL(3),
> .ubwc_bank_spread = true,
> .highest_bank_bit = 13,
> .macrotile_mode = true,
> @@ -50,7 +51,8 @@ static const struct qcom_ubwc_cfg_data sar2130p_data = {
> static const struct qcom_ubwc_cfg_data sc7180_data = {
> .ubwc_enc_version = UBWC_2_0,
> .ubwc_dec_version = UBWC_2_0,
> - .ubwc_swizzle = 6,
> + .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_LVL(2) |
> + UBWC_SWIZZLE_ENABLE_LVL(3),
> .ubwc_bank_spread = true,
> .highest_bank_bit = 14,
> };
> @@ -58,7 +60,8 @@ static const struct qcom_ubwc_cfg_data sc7180_data = {
> static const struct qcom_ubwc_cfg_data sc7280_data = {
> .ubwc_enc_version = UBWC_3_0,
> .ubwc_dec_version = UBWC_4_0,
> - .ubwc_swizzle = 6,
> + .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_LVL(2) |
> + UBWC_SWIZZLE_ENABLE_LVL(3),
> .ubwc_bank_spread = true,
> .highest_bank_bit = 14,
> .macrotile_mode = true,
> @@ -74,7 +77,8 @@ static const struct qcom_ubwc_cfg_data sc8180x_data = {
> static const struct qcom_ubwc_cfg_data sc8280xp_data = {
> .ubwc_enc_version = UBWC_4_0,
> .ubwc_dec_version = UBWC_4_0,
> - .ubwc_swizzle = 6,
> + .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_LVL(2) |
> + UBWC_SWIZZLE_ENABLE_LVL(3),
> .ubwc_bank_spread = true,
> .highest_bank_bit = 16,
> .macrotile_mode = true,
> @@ -95,7 +99,7 @@ static const struct qcom_ubwc_cfg_data sdm845_data = {
> static const struct qcom_ubwc_cfg_data sm6115_data = {
> .ubwc_enc_version = UBWC_1_0,
> .ubwc_dec_version = UBWC_2_0,
> - .ubwc_swizzle = 7,
> + .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_ALL,
> .ubwc_bank_spread = true,
> .highest_bank_bit = 14,
> };
> @@ -103,7 +107,7 @@ static const struct qcom_ubwc_cfg_data sm6115_data = {
> static const struct qcom_ubwc_cfg_data sm6125_data = {
> .ubwc_enc_version = UBWC_1_0,
> .ubwc_dec_version = UBWC_3_0,
> - .ubwc_swizzle = 7,
> + .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_ALL,
> .highest_bank_bit = 14,
> };
>
> @@ -116,7 +120,8 @@ static const struct qcom_ubwc_cfg_data sm6150_data = {
> static const struct qcom_ubwc_cfg_data sm6350_data = {
> .ubwc_enc_version = UBWC_2_0,
> .ubwc_dec_version = UBWC_2_0,
> - .ubwc_swizzle = 6,
> + .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_LVL(2) |
> + UBWC_SWIZZLE_ENABLE_LVL(3),
> .ubwc_bank_spread = true,
> .highest_bank_bit = 14,
> };
> @@ -136,7 +141,8 @@ static const struct qcom_ubwc_cfg_data sm8150_data = {
> static const struct qcom_ubwc_cfg_data sm8250_data = {
> .ubwc_enc_version = UBWC_4_0,
> .ubwc_dec_version = UBWC_4_0,
> - .ubwc_swizzle = 6,
> + .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_LVL(2) |
> + UBWC_SWIZZLE_ENABLE_LVL(3),
> .ubwc_bank_spread = true,
> /* TODO: highest_bank_bit = 15 for LP_DDR4 */
> .highest_bank_bit = 16,
> @@ -146,7 +152,8 @@ static const struct qcom_ubwc_cfg_data sm8250_data = {
> static const struct qcom_ubwc_cfg_data sm8350_data = {
> .ubwc_enc_version = UBWC_4_0,
> .ubwc_dec_version = UBWC_4_0,
> - .ubwc_swizzle = 6,
> + .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_LVL(2) |
> + UBWC_SWIZZLE_ENABLE_LVL(3),
> .ubwc_bank_spread = true,
> /* TODO: highest_bank_bit = 15 for LP_DDR4 */
> .highest_bank_bit = 16,
> @@ -156,7 +163,8 @@ static const struct qcom_ubwc_cfg_data sm8350_data = {
> static const struct qcom_ubwc_cfg_data sm8550_data = {
> .ubwc_enc_version = UBWC_4_0,
> .ubwc_dec_version = UBWC_4_3,
> - .ubwc_swizzle = 6,
> + .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_LVL(2) |
> + UBWC_SWIZZLE_ENABLE_LVL(3),
> .ubwc_bank_spread = true,
> /* TODO: highest_bank_bit = 15 for LP_DDR4 */
> .highest_bank_bit = 16,
> @@ -166,7 +174,8 @@ static const struct qcom_ubwc_cfg_data sm8550_data = {
> static const struct qcom_ubwc_cfg_data x1e80100_data = {
> .ubwc_enc_version = UBWC_4_0,
> .ubwc_dec_version = UBWC_4_3,
> - .ubwc_swizzle = 6,
> + .ubwc_swizzle = UBWC_SWIZZLE_ENABLE_LVL(2) |
> + UBWC_SWIZZLE_ENABLE_LVL(3),
> .ubwc_bank_spread = true,
> /* TODO: highest_bank_bit = 15 for LP_DDR4 */
> .highest_bank_bit = 16,
> diff --git a/include/linux/soc/qcom/ubwc.h b/include/linux/soc/qcom/ubwc.h
> index 30d9744c5d2e06d4aa93b64f7d2bc0e855c7a10b..2a12e054ec62ae7e76c3f3291d6963da726eee4f 100644
> --- a/include/linux/soc/qcom/ubwc.h
> +++ b/include/linux/soc/qcom/ubwc.h
> @@ -26,6 +26,8 @@ struct qcom_ubwc_cfg_data {
> * controls level 2, and BIT(2) enables level 3.
> */
> u32 ubwc_swizzle;
> +#define UBWC_SWIZZLE_ENABLE_ALL GENMASK(2, 0)
> +#define UBWC_SWIZZLE_ENABLE_LVL(n) BIT(((n) - 1))
>
> /**
> * @highest_bank_bit: Highest Bank Bit
>
> --
> 2.49.0
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFC RFT v2 15/15] drm/msm/a6xx: Warn if the highest_bank_bit value is overwritten
2025-05-14 15:10 ` [PATCH RFC RFT v2 15/15] drm/msm/a6xx: Warn if the highest_bank_bit value is overwritten Konrad Dybcio
@ 2025-05-14 19:25 ` Dmitry Baryshkov
0 siblings, 0 replies; 47+ messages in thread
From: Dmitry Baryshkov @ 2025-05-14 19:25 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno, Konrad Dybcio
On Wed, May 14, 2025 at 05:10:35PM +0200, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
> In preparation to resolve the issue of hardcoding HBB, throw a warning
> if the value is being overwritten in the GPU driver.
>
> The HBB value is directly correlated with the memory configuration.
> On platforms where more than one is supported, the value must differ
> for proper functioning of the hardware, but it also must be consistent
> across all UBWC producers/consumers.
>
> On platforms supporting only a single DRAM setup, the value may still
> be wrong, or at least inconsistent.
>
> Print a warning to help catch such cases, until we declare full trust
> to the central database.
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> index eaf468b67f97ff153e92a73a45581228fcf75e46..ab812338739568d5908ca439e5c53e230a02de5d 100644
> --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> @@ -637,6 +637,10 @@ static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
> if (adreno_is_a702(gpu))
> cfg->highest_bank_bit = 14;
>
> + if (cfg->highest_bank_bit != common_cfg->highest_bank_bit)
> + DRM_WARN_ONCE("Inconclusive highest_bank_bit value: %u (GPU) vs %u (UBWC_CFG)\n",
> + cfg->highest_bank_bit, common_cfg->highest_bank_bit);
> +
This really should come in an earlier patch...
> gpu->ubwc_config = &gpu->_ubwc_config;
>
> return 0;
>
> --
> 2.49.0
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 07/15] drm/msm/a6xx: Resolve the meaning of UBWC_MODE
2025-05-14 19:14 ` Dmitry Baryshkov
@ 2025-05-14 20:02 ` Rob Clark
0 siblings, 0 replies; 47+ messages in thread
From: Rob Clark @ 2025-05-14 20:02 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Konrad Dybcio, Bjorn Andersson, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno, Konrad Dybcio
On Wed, May 14, 2025 at 12:15 PM Dmitry Baryshkov
<dmitry.baryshkov@oss.qualcomm.com> wrote:
>
> On Wed, May 14, 2025 at 05:10:27PM +0200, Konrad Dybcio wrote:
> > From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> >
> > This bit is set iff the UBWC version is 1.0. That notably does not
> > include QCM2290's "no UBWC".
> >
> > Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> > ---
> > drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> > index e7c89f9c7d89798699848743843eed6a58b94bd3..6af4e70c1b936a30c1934dd49f2889be13c9780d 100644
> > --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> > +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
> > @@ -669,10 +669,10 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
> > */
> > BUG_ON(adreno_gpu->ubwc_config.highest_bank_bit < 13);
> > u32 hbb = adreno_gpu->ubwc_config.highest_bank_bit - 13;
> > + bool ubwc_mode = qcom_ubwc_get_ubwc_mode(cfg);
>
> I'd really prefer if the function came in this patch rather than being
> added at some earlier point. I understand that you want to simplify
> cross-tree merging, but I think we should also simplify reviewing.
Also, since it is so far just used by display and gpu, we probably
don't need to care about cross tree too much... we could just land via
drm
BR,
-R
> > bool amsbc = cfg->ubwc_enc_version >= UBWC_3_0;
> > u32 hbb_hi = hbb >> 2;
> > u32 hbb_lo = hbb & 3;
> > - u32 ubwc_mode = adreno_gpu->ubwc_config.ubwc_swizzle & 1;
> > u32 level2_swizzling_dis = !(adreno_gpu->ubwc_config.ubwc_swizzle & 2);
> >
> > gpu_write(gpu, REG_A6XX_RB_NC_MODE_CNTL,
> >
> > --
> > 2.49.0
> >
>
> --
> With best wishes
> Dmitry
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 13/15] soc: qcom: ubwc: Fix SM6125's ubwc_swizzle value
2025-05-14 19:23 ` Dmitry Baryshkov
@ 2025-05-14 20:05 ` Konrad Dybcio
2025-05-14 20:33 ` Dmitry Baryshkov
0 siblings, 1 reply; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-14 20:05 UTC (permalink / raw)
To: Dmitry Baryshkov, Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno, Konrad Dybcio
On 5/14/25 9:23 PM, Dmitry Baryshkov wrote:
> On Wed, May 14, 2025 at 05:10:33PM +0200, Konrad Dybcio wrote:
>> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>
>> The value of 7 (a.k.a. GENMASK(2, 0), a.k.a. disabling levels 1-3 of
>> swizzling) is what we want on this platform (and others with a UBWC
>> 1.0 encoder).
>>
>> Fix it to make mesa happy (the hardware doesn't care about the 2 higher
>> bits, as they weren't consumed on this platform).
>>
>> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>> ---
>> drivers/soc/qcom/ubwc_config.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/soc/qcom/ubwc_config.c b/drivers/soc/qcom/ubwc_config.c
>> index 9caecd071035ccb03f14464e9b7129ba34a7f862..96b94cf01218cce2dacdba22c7573ba6148fcdd1 100644
>> --- a/drivers/soc/qcom/ubwc_config.c
>> +++ b/drivers/soc/qcom/ubwc_config.c
>> @@ -103,7 +103,7 @@ static const struct qcom_ubwc_cfg_data sm6115_data = {
>> static const struct qcom_ubwc_cfg_data sm6125_data = {
>> .ubwc_enc_version = UBWC_1_0,
>> .ubwc_dec_version = UBWC_3_0,
>> - .ubwc_swizzle = 1,
>> + .ubwc_swizzle = 7,
>> .highest_bank_bit = 14,
>> };
>
> Add a comment and squash into the patch 1.
I don't think that's a good idea, plus this series should be merged
together anyway
Konrad
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 14/15] soc: qcom: ubwc: Add #defines for UBWC swizzle bits
2025-05-14 19:24 ` Dmitry Baryshkov
@ 2025-05-14 20:09 ` Konrad Dybcio
2025-05-14 20:33 ` Dmitry Baryshkov
0 siblings, 1 reply; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-14 20:09 UTC (permalink / raw)
To: Dmitry Baryshkov, Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno, Konrad Dybcio
On 5/14/25 9:24 PM, Dmitry Baryshkov wrote:
> On Wed, May 14, 2025 at 05:10:34PM +0200, Konrad Dybcio wrote:
>> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>
>> Make the values a bit more meaningful.
>
> Not sure if it's more meaningful or not. In the end, we all can read hex
> masks.
0x1d7efc35
magic constants are no bueno
Konrad
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 12/15] drm/msm/a6xx: Drop cfg->ubwc_swizzle override
2025-05-14 15:10 ` [PATCH RFT v2 12/15] drm/msm/a6xx: Drop cfg->ubwc_swizzle override Konrad Dybcio
@ 2025-05-14 20:32 ` Dmitry Baryshkov
2025-05-15 15:52 ` Konrad Dybcio
0 siblings, 1 reply; 47+ messages in thread
From: Dmitry Baryshkov @ 2025-05-14 20:32 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno, Konrad Dybcio
On Wed, May 14, 2025 at 05:10:32PM +0200, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
> On A663 (SA8775P) the value matches exactly.
>
> On A610, the value matches on SM6115, but is different on SM6125. That
> turns out not to be a problem, as the bits that differ aren't even
> interpreted.
We also don't set swizzle for a lot of UBWC 1.0 targets (as MDSS wasn't
programming those). Should we fix all of them to use 6 by default? Or 7?
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 14/15] soc: qcom: ubwc: Add #defines for UBWC swizzle bits
2025-05-14 20:09 ` Konrad Dybcio
@ 2025-05-14 20:33 ` Dmitry Baryshkov
0 siblings, 0 replies; 47+ messages in thread
From: Dmitry Baryshkov @ 2025-05-14 20:33 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Konrad Dybcio, Bjorn Andersson, Rob Clark, Abhinav Kumar,
Akhil P Oommen, Sean Paul, David Airlie, Simona Vetter,
Marijn Suijten, linux-kernel, linux-arm-msm, dri-devel, freedreno
On Wed, May 14, 2025 at 10:09:35PM +0200, Konrad Dybcio wrote:
> On 5/14/25 9:24 PM, Dmitry Baryshkov wrote:
> > On Wed, May 14, 2025 at 05:10:34PM +0200, Konrad Dybcio wrote:
> >> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> >>
> >> Make the values a bit more meaningful.
> >
> > Not sure if it's more meaningful or not. In the end, we all can read hex
> > masks.
>
> 0x1d7efc35
>
> magic constants are no bueno
Ack. Then please drop UBWC_SWIZZLE_ENABLE_ALL and list all 1-3.
>
> Konrad
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 13/15] soc: qcom: ubwc: Fix SM6125's ubwc_swizzle value
2025-05-14 20:05 ` Konrad Dybcio
@ 2025-05-14 20:33 ` Dmitry Baryshkov
2025-05-15 16:18 ` Konrad Dybcio
0 siblings, 1 reply; 47+ messages in thread
From: Dmitry Baryshkov @ 2025-05-14 20:33 UTC (permalink / raw)
To: Konrad Dybcio, Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno
On 14/05/2025 23:05, Konrad Dybcio wrote:
> On 5/14/25 9:23 PM, Dmitry Baryshkov wrote:
>> On Wed, May 14, 2025 at 05:10:33PM +0200, Konrad Dybcio wrote:
>>> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>>
>>> The value of 7 (a.k.a. GENMASK(2, 0), a.k.a. disabling levels 1-3 of
>>> swizzling) is what we want on this platform (and others with a UBWC
>>> 1.0 encoder).
>>>
>>> Fix it to make mesa happy (the hardware doesn't care about the 2 higher
>>> bits, as they weren't consumed on this platform).
>>>
>>> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>> ---
>>> drivers/soc/qcom/ubwc_config.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/soc/qcom/ubwc_config.c b/drivers/soc/qcom/ubwc_config.c
>>> index 9caecd071035ccb03f14464e9b7129ba34a7f862..96b94cf01218cce2dacdba22c7573ba6148fcdd1 100644
>>> --- a/drivers/soc/qcom/ubwc_config.c
>>> +++ b/drivers/soc/qcom/ubwc_config.c
>>> @@ -103,7 +103,7 @@ static const struct qcom_ubwc_cfg_data sm6115_data = {
>>> static const struct qcom_ubwc_cfg_data sm6125_data = {
>>> .ubwc_enc_version = UBWC_1_0,
>>> .ubwc_dec_version = UBWC_3_0,
>>> - .ubwc_swizzle = 1,
>>> + .ubwc_swizzle = 7,
>>> .highest_bank_bit = 14,
>>> };
>>
>> Add a comment and squash into the patch 1.
>
> I don't think that's a good idea, plus this series should be merged
> together anyway
Well... Granted Rob's comment, I really think the patches should be
reordered a bit:
- MDSS: offset HBB by 13 (patch 2)
- switch drm/msm/mdss and display to common DB (patches 1+3 squashed)
- get a handle (patch 4)
- resolve / simplify (patches 5-10, not squashed)
- fix sm6125 (patch 13)
- WARN_ON (swizzle != swizzle) or (HBB != HBB)
- switch to common R/O config, keeping WARN_ON for the calculated values
(with the hope to drop them after testing)
WDYT?
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 03/15] drm/msm: Use the central UBWC config database
2025-05-14 15:10 ` [PATCH RFT v2 03/15] drm/msm: Use the central UBWC config database Konrad Dybcio
2025-05-14 19:05 ` Dmitry Baryshkov
@ 2025-05-15 10:32 ` kernel test robot
1 sibling, 0 replies; 47+ messages in thread
From: kernel test robot @ 2025-05-15 10:32 UTC (permalink / raw)
To: Konrad Dybcio, Bjorn Andersson, Rob Clark, Abhinav Kumar,
Dmitry Baryshkov, Akhil P Oommen, Sean Paul, David Airlie,
Simona Vetter
Cc: llvm, oe-kbuild-all, Marijn Suijten, linux-kernel, linux-arm-msm,
dri-devel, freedreno
Hi Konrad,
kernel test robot noticed the following build errors:
[auto build test ERROR on edef457004774e598fc4c1b7d1d4f0bcd9d0bb30]
url: https://github.com/intel-lab-lkp/linux/commits/Konrad-Dybcio/soc-qcom-Add-UBWC-config-provider/20250514-231354
base: edef457004774e598fc4c1b7d1d4f0bcd9d0bb30
patch link: https://lore.kernel.org/r/20250514-topic-ubwc_central-v2-3-09ecbc0a05ce%40oss.qualcomm.com
patch subject: [PATCH RFT v2 03/15] drm/msm: Use the central UBWC config database
config: arm64-randconfig-002-20250515 (https://download.01.org/0day-ci/archive/20250515/202505151822.QNn0FQXs-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250515/202505151822.QNn0FQXs-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505151822.QNn0FQXs-lkp@intel.com/
All error/warnings (new ones prefixed by >>, old ones prefixed by <<):
>> drivers/soc/qcom/ubwc_config.c:41:40: warning: unused variable 'sar2130p_data' [-Wunused-const-variable]
41 | static const struct qcom_ubwc_cfg_data sar2130p_data = {
| ^~~~~~~~~~~~~
1 warning generated.
--
ERROR: modpost: missing MODULE_LICENSE() in drivers/soc/qcom/ubwc_config.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/soc/qcom/ubwc_config.o
>> ERROR: modpost: "qcom_ubwc_config_get_data" [drivers/gpu/drm/msm/msm.ko] undefined!
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 01/15] soc: qcom: Add UBWC config provider
2025-05-14 19:03 ` Dmitry Baryshkov
@ 2025-05-15 15:50 ` Konrad Dybcio
0 siblings, 0 replies; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-15 15:50 UTC (permalink / raw)
To: Dmitry Baryshkov, Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno, Konrad Dybcio
On 5/14/25 9:03 PM, Dmitry Baryshkov wrote:
> On Wed, May 14, 2025 at 05:10:21PM +0200, Konrad Dybcio wrote:
>> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>
>> Add a file that will serve as a single source of truth for UBWC
>> configuration data for various multimedia blocks.
>>
>> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>> ---
>> drivers/soc/qcom/Kconfig | 8 ++
>> drivers/soc/qcom/Makefile | 1 +
>> drivers/soc/qcom/ubwc_config.c | 235 +++++++++++++++++++++++++++++++++++++++++
>> include/linux/soc/qcom/ubwc.h | 67 ++++++++++++
>> 4 files changed, 311 insertions(+)
>>
>
> With the SAR2130P fixed
>
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>
>
>> +
>> + /**
>> + * @highest_bank_bit: Highest Bank Bit
>> + *
>> + * The Highest Bank Bit value represents the bit of the highest
>> + * DDR bank. This should ideally use DRAM type detection.
>> + */
>> + int highest_bank_bit;
>> + bool ubwc_bank_spread;
>
> Nit: any documentation for this one?
Not even documentation seems to acknowledge that bit's existence
Konrad
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 10/15] drm/msm/a6xx: Simplify min_acc_len calculation
2025-05-14 19:19 ` Dmitry Baryshkov
@ 2025-05-15 15:51 ` Konrad Dybcio
0 siblings, 0 replies; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-15 15:51 UTC (permalink / raw)
To: Dmitry Baryshkov, Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno, Konrad Dybcio
On 5/14/25 9:19 PM, Dmitry Baryshkov wrote:
> On Wed, May 14, 2025 at 05:10:30PM +0200, Konrad Dybcio wrote:
>> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>
>> It's only necessary for some lower end parts.
>> Also rename it to min_acc_len_64b to denote that if set, the minimum
>> access length is 64 bits, 32b otherwise.
>>
>> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>> ---
>> drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 15 ++++++---------
>> 1 file changed, 6 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
>> index 5ee5f8dc90fe0d1647ce07b7dbcadc6ca2ecd416..fdc843c47c075a92ec8305217c355e4ccee876dc 100644
>> --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
>> +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
>> @@ -592,14 +592,12 @@ static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
>> if (IS_ERR(gpu->common_ubwc_cfg))
>> return -EINVAL;
>>
>> - gpu->ubwc_config.min_acc_len = 0;
>> gpu->ubwc_config.ubwc_swizzle = 0x6;
>> gpu->ubwc_config.macrotile_mode = 0;
>> gpu->ubwc_config.highest_bank_bit = 15;
>
> It occurred to me that here (and in some previous patches) you stopped
> setting the field, but you didn't drop it from adreno_gpu.ubwc_config.
> Would you mind updating the patches in this way?
>
> With that fixed:
>
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
I mean.. I could.. but I delete the whole thing couple patches later
Konrad
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 11/15] drm/msm/adreno: Switch to the common UBWC config struct
2025-05-14 19:22 ` Dmitry Baryshkov
@ 2025-05-15 15:51 ` Konrad Dybcio
0 siblings, 0 replies; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-15 15:51 UTC (permalink / raw)
To: Dmitry Baryshkov, Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno, Konrad Dybcio
On 5/14/25 9:22 PM, Dmitry Baryshkov wrote:
> On Wed, May 14, 2025 at 05:10:31PM +0200, Konrad Dybcio wrote:
>> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>
>> Now that Adreno specifics are out of the way, use the common config
>> (but leave the HBB hardcoding in place until that is wired up on the
>> other side).
>>
>> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>> ---
>> drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 20 +++++------
>> drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 64 ++++++++++++++++-----------------
>> drivers/gpu/drm/msm/adreno/adreno_gpu.c | 6 ++--
>> drivers/gpu/drm/msm/adreno/adreno_gpu.h | 45 ++++-------------------
>> 4 files changed, 50 insertions(+), 85 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
>> index 650e5bac225f372e819130b891f1d020b464f17f..611e0eb26d0e19d431673d08e042162375fd400f 100644
>> --- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
>> +++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
>> @@ -833,8 +833,8 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
>>
>> gpu_write(gpu, REG_A5XX_RBBM_AHB_CNTL2, 0x0000003F);
>>
>> - BUG_ON(adreno_gpu->ubwc_config.highest_bank_bit < 13);
>> - hbb = adreno_gpu->ubwc_config.highest_bank_bit - 13;
>> + BUG_ON(adreno_gpu->ubwc_config->highest_bank_bit < 13);
>> + hbb = adreno_gpu->ubwc_config->highest_bank_bit - 13;
>>
>> gpu_write(gpu, REG_A5XX_TPL1_MODE_CNTL, hbb << 7);
>> gpu_write(gpu, REG_A5XX_RB_MODE_CNTL, hbb << 1);
>> @@ -1754,6 +1754,7 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev)
>> struct msm_drm_private *priv = dev->dev_private;
>> struct platform_device *pdev = priv->gpu_pdev;
>> struct adreno_platform_config *config = pdev->dev.platform_data;
>> + const struct qcom_ubwc_cfg_data *common_cfg;
>> struct a5xx_gpu *a5xx_gpu = NULL;
>> struct adreno_gpu *adreno_gpu;
>> struct msm_gpu *gpu;
>> @@ -1790,15 +1791,14 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev)
>> /* Set up the preemption specific bits and pieces for each ringbuffer */
>> a5xx_preempt_init(gpu);
>>
>> - /* Set the highest bank bit */
>> - if (adreno_is_a540(adreno_gpu) || adreno_is_a530(adreno_gpu))
>> - adreno_gpu->ubwc_config.highest_bank_bit = 15;
>> - else
>> - adreno_gpu->ubwc_config.highest_bank_bit = 14;
>> + /* Inherit the common config and make some necessary fixups */
>> + common_cfg = qcom_ubwc_config_get_data();
>> + if (IS_ERR(common_cfg))
>> + return ERR_PTR(-EINVAL);
>>
>> - /* a5xx only supports UBWC 1.0, these are not configurable */
>> - adreno_gpu->ubwc_config.macrotile_mode = 0;
>> - adreno_gpu->ubwc_config.ubwc_swizzle = 0x7;
>> + /* Copy the data into the internal struct to drop the const qualifier (temporarily) */
>> + adreno_gpu->_ubwc_config = *common_cfg;
>> + adreno_gpu->ubwc_config = &adreno_gpu->_ubwc_config;
>
> Ugh. I'd rather keep the ubwc config r/o.
>
>>
>> adreno_gpu->uche_trap_base = 0x0001ffffffff0000ull;
>>
>> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
>> index fdc843c47c075a92ec8305217c355e4ccee876dc..ae0bb7934e7ed203aa3b81e28767de204f0a4d60 100644
>> --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
>> +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
>> @@ -587,64 +587,62 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu)
>>
>> static int a6xx_calc_ubwc_config(struct adreno_gpu *gpu)
>> {
>> + const struct qcom_ubwc_cfg_data *common_cfg;
>> + struct qcom_ubwc_cfg_data *cfg = &gpu->_ubwc_config;
>> +
>> /* Inherit the common config and make some necessary fixups */
>> - gpu->common_ubwc_cfg = qcom_ubwc_config_get_data();
>> - if (IS_ERR(gpu->common_ubwc_cfg))
>> + common_cfg = qcom_ubwc_config_get_data();
>> + if (IS_ERR(common_cfg))
>> return -EINVAL;
>>
>> - gpu->ubwc_config.ubwc_swizzle = 0x6;
>> - gpu->ubwc_config.macrotile_mode = 0;
>> - gpu->ubwc_config.highest_bank_bit = 15;
>> + /* Copy the data into the internal struct to drop the const qualifier (temporarily) */
>> + *cfg = *common_cfg;
>> +
>> + cfg->ubwc_swizzle = 0x6;
>> + cfg->highest_bank_bit = 15;
>>
>
> This begs for WARN_ON(cfg->ubwc_swizzle !=
> gpu->common_ubwc_cfg->ubwc_swizzle) and similar change for HBB. Then
> after testing we should be able to drop r/w part of the config.
I'd rather put the warn in ubwc_config.c
Konrad
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 12/15] drm/msm/a6xx: Drop cfg->ubwc_swizzle override
2025-05-14 20:32 ` Dmitry Baryshkov
@ 2025-05-15 15:52 ` Konrad Dybcio
0 siblings, 0 replies; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-15 15:52 UTC (permalink / raw)
To: Dmitry Baryshkov, Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno, Konrad Dybcio
On 5/14/25 10:32 PM, Dmitry Baryshkov wrote:
> On Wed, May 14, 2025 at 05:10:32PM +0200, Konrad Dybcio wrote:
>> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>
>> On A663 (SA8775P) the value matches exactly.
>>
>> On A610, the value matches on SM6115, but is different on SM6125. That
>> turns out not to be a problem, as the bits that differ aren't even
>> interpreted.
>
> We also don't set swizzle for a lot of UBWC 1.0 targets (as MDSS wasn't
> programming those). Should we fix all of them to use 6 by default? Or 7?
I don't think any default value is a good idea - this is the sort of
programming error you track down 4 years after you go bald looking
for it
Konrad
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 13/15] soc: qcom: ubwc: Fix SM6125's ubwc_swizzle value
2025-05-14 20:33 ` Dmitry Baryshkov
@ 2025-05-15 16:18 ` Konrad Dybcio
2025-05-15 16:21 ` Dmitry Baryshkov
0 siblings, 1 reply; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-15 16:18 UTC (permalink / raw)
To: Dmitry Baryshkov, Konrad Dybcio, Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno
On 5/14/25 10:33 PM, Dmitry Baryshkov wrote:
> On 14/05/2025 23:05, Konrad Dybcio wrote:
>> On 5/14/25 9:23 PM, Dmitry Baryshkov wrote:
>>> On Wed, May 14, 2025 at 05:10:33PM +0200, Konrad Dybcio wrote:
>>>> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>>>
>>>> The value of 7 (a.k.a. GENMASK(2, 0), a.k.a. disabling levels 1-3 of
>>>> swizzling) is what we want on this platform (and others with a UBWC
>>>> 1.0 encoder).
>>>>
>>>> Fix it to make mesa happy (the hardware doesn't care about the 2 higher
>>>> bits, as they weren't consumed on this platform).
>>>>
>>>> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>>> ---
>>>> drivers/soc/qcom/ubwc_config.c | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/soc/qcom/ubwc_config.c b/drivers/soc/qcom/ubwc_config.c
>>>> index 9caecd071035ccb03f14464e9b7129ba34a7f862..96b94cf01218cce2dacdba22c7573ba6148fcdd1 100644
>>>> --- a/drivers/soc/qcom/ubwc_config.c
>>>> +++ b/drivers/soc/qcom/ubwc_config.c
>>>> @@ -103,7 +103,7 @@ static const struct qcom_ubwc_cfg_data sm6115_data = {
>>>> static const struct qcom_ubwc_cfg_data sm6125_data = {
>>>> .ubwc_enc_version = UBWC_1_0,
>>>> .ubwc_dec_version = UBWC_3_0,
>>>> - .ubwc_swizzle = 1,
>>>> + .ubwc_swizzle = 7,
>>>> .highest_bank_bit = 14,
>>>> };
>>>
>>> Add a comment and squash into the patch 1.
>>
>> I don't think that's a good idea, plus this series should be merged
>> together anyway
>
> Well... Granted Rob's comment, I really think the patches should be reordered a bit:
>
> - MDSS: offset HBB by 13 (patch 2)
> - switch drm/msm/mdss and display to common DB (patches 1+3 squashed)
> - get a handle (patch 4)
> - resolve / simplify (patches 5-10, not squashed)
> - fix sm6125 (patch 13)
> - WARN_ON (swizzle != swizzle) or (HBB != HBB)
> - switch to common R/O config, keeping WARN_ON for the calculated values (with the hope to drop them after testing)
Does this bring any functional benefit? This series is unfun to remix
Konrad
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 13/15] soc: qcom: ubwc: Fix SM6125's ubwc_swizzle value
2025-05-15 16:18 ` Konrad Dybcio
@ 2025-05-15 16:21 ` Dmitry Baryshkov
2025-05-15 16:35 ` Konrad Dybcio
0 siblings, 1 reply; 47+ messages in thread
From: Dmitry Baryshkov @ 2025-05-15 16:21 UTC (permalink / raw)
To: Konrad Dybcio, Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno
On 15/05/2025 19:18, Konrad Dybcio wrote:
> On 5/14/25 10:33 PM, Dmitry Baryshkov wrote:
>> On 14/05/2025 23:05, Konrad Dybcio wrote:
>>> On 5/14/25 9:23 PM, Dmitry Baryshkov wrote:
>>>> On Wed, May 14, 2025 at 05:10:33PM +0200, Konrad Dybcio wrote:
>>>>> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>>>>
>>>>> The value of 7 (a.k.a. GENMASK(2, 0), a.k.a. disabling levels 1-3 of
>>>>> swizzling) is what we want on this platform (and others with a UBWC
>>>>> 1.0 encoder).
>>>>>
>>>>> Fix it to make mesa happy (the hardware doesn't care about the 2 higher
>>>>> bits, as they weren't consumed on this platform).
>>>>>
>>>>> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>>>> ---
>>>>> drivers/soc/qcom/ubwc_config.c | 2 +-
>>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/soc/qcom/ubwc_config.c b/drivers/soc/qcom/ubwc_config.c
>>>>> index 9caecd071035ccb03f14464e9b7129ba34a7f862..96b94cf01218cce2dacdba22c7573ba6148fcdd1 100644
>>>>> --- a/drivers/soc/qcom/ubwc_config.c
>>>>> +++ b/drivers/soc/qcom/ubwc_config.c
>>>>> @@ -103,7 +103,7 @@ static const struct qcom_ubwc_cfg_data sm6115_data = {
>>>>> static const struct qcom_ubwc_cfg_data sm6125_data = {
>>>>> .ubwc_enc_version = UBWC_1_0,
>>>>> .ubwc_dec_version = UBWC_3_0,
>>>>> - .ubwc_swizzle = 1,
>>>>> + .ubwc_swizzle = 7,
>>>>> .highest_bank_bit = 14,
>>>>> };
>>>>
>>>> Add a comment and squash into the patch 1.
>>>
>>> I don't think that's a good idea, plus this series should be merged
>>> together anyway
>>
>> Well... Granted Rob's comment, I really think the patches should be reordered a bit:
>>
>> - MDSS: offset HBB by 13 (patch 2)
>> - switch drm/msm/mdss and display to common DB (patches 1+3 squashed)
>> - get a handle (patch 4)
>> - resolve / simplify (patches 5-10, not squashed)
>> - fix sm6125 (patch 13)
>> - WARN_ON (swizzle != swizzle) or (HBB != HBB)
>> - switch to common R/O config, keeping WARN_ON for the calculated values (with the hope to drop them after testing)
>
> Does this bring any functional benefit? This series is unfun to remix
I know the pain.
The functional benefit is to have the WARN_ON and side-by-side
comparison of common_ubwc_config vs computed ubwc_config for HBB and
swizzle.
You can say that I dislike the idea of copying & modifying config as
this is the code that we will drop later (hopefully).
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 13/15] soc: qcom: ubwc: Fix SM6125's ubwc_swizzle value
2025-05-15 16:21 ` Dmitry Baryshkov
@ 2025-05-15 16:35 ` Konrad Dybcio
2025-05-15 17:15 ` Dmitry Baryshkov
0 siblings, 1 reply; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-15 16:35 UTC (permalink / raw)
To: Dmitry Baryshkov, Konrad Dybcio, Konrad Dybcio
Cc: Bjorn Andersson, Rob Clark, Abhinav Kumar, Akhil P Oommen,
Sean Paul, David Airlie, Simona Vetter, Marijn Suijten,
linux-kernel, linux-arm-msm, dri-devel, freedreno
On 5/15/25 6:21 PM, Dmitry Baryshkov wrote:
> On 15/05/2025 19:18, Konrad Dybcio wrote:
>> On 5/14/25 10:33 PM, Dmitry Baryshkov wrote:
>>> On 14/05/2025 23:05, Konrad Dybcio wrote:
>>>> On 5/14/25 9:23 PM, Dmitry Baryshkov wrote:
>>>>> On Wed, May 14, 2025 at 05:10:33PM +0200, Konrad Dybcio wrote:
>>>>>> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>>>>>
>>>>>> The value of 7 (a.k.a. GENMASK(2, 0), a.k.a. disabling levels 1-3 of
>>>>>> swizzling) is what we want on this platform (and others with a UBWC
>>>>>> 1.0 encoder).
>>>>>>
>>>>>> Fix it to make mesa happy (the hardware doesn't care about the 2 higher
>>>>>> bits, as they weren't consumed on this platform).
>>>>>>
>>>>>> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>>>>> ---
>>>>>> drivers/soc/qcom/ubwc_config.c | 2 +-
>>>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>>
>>>>>> diff --git a/drivers/soc/qcom/ubwc_config.c b/drivers/soc/qcom/ubwc_config.c
>>>>>> index 9caecd071035ccb03f14464e9b7129ba34a7f862..96b94cf01218cce2dacdba22c7573ba6148fcdd1 100644
>>>>>> --- a/drivers/soc/qcom/ubwc_config.c
>>>>>> +++ b/drivers/soc/qcom/ubwc_config.c
>>>>>> @@ -103,7 +103,7 @@ static const struct qcom_ubwc_cfg_data sm6115_data = {
>>>>>> static const struct qcom_ubwc_cfg_data sm6125_data = {
>>>>>> .ubwc_enc_version = UBWC_1_0,
>>>>>> .ubwc_dec_version = UBWC_3_0,
>>>>>> - .ubwc_swizzle = 1,
>>>>>> + .ubwc_swizzle = 7,
>>>>>> .highest_bank_bit = 14,
>>>>>> };
>>>>>
>>>>> Add a comment and squash into the patch 1.
>>>>
>>>> I don't think that's a good idea, plus this series should be merged
>>>> together anyway
>>>
>>> Well... Granted Rob's comment, I really think the patches should be reordered a bit:
>>>
>>> - MDSS: offset HBB by 13 (patch 2)
>>> - switch drm/msm/mdss and display to common DB (patches 1+3 squashed)
>>> - get a handle (patch 4)
>>> - resolve / simplify (patches 5-10, not squashed)
>>> - fix sm6125 (patch 13)
>>> - WARN_ON (swizzle != swizzle) or (HBB != HBB)
>>> - switch to common R/O config, keeping WARN_ON for the calculated values (with the hope to drop them after testing)
>>
>> Does this bring any functional benefit? This series is unfun to remix
>
> I know the pain.
>
> The functional benefit is to have the WARN_ON and side-by-side comparison of common_ubwc_config vs computed ubwc_config for HBB and swizzle.
HBB I agree, since we'll be outsourcing it to yet another driver, swizzle
should be good enough (tm) - I scanned through the values in the driver
and couldn't find anything wrong just by eye
I realize this sounds funny, but all in all I don't think it's worth the
effort just for that one
Konrad
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 13/15] soc: qcom: ubwc: Fix SM6125's ubwc_swizzle value
2025-05-15 16:35 ` Konrad Dybcio
@ 2025-05-15 17:15 ` Dmitry Baryshkov
2025-05-15 17:56 ` Konrad Dybcio
0 siblings, 1 reply; 47+ messages in thread
From: Dmitry Baryshkov @ 2025-05-15 17:15 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Konrad Dybcio, Bjorn Andersson, Rob Clark, Abhinav Kumar,
Akhil P Oommen, Sean Paul, David Airlie, Simona Vetter,
Marijn Suijten, linux-kernel, linux-arm-msm, dri-devel, freedreno
On Thu, 15 May 2025 at 19:36, Konrad Dybcio
<konrad.dybcio@oss.qualcomm.com> wrote:
>
> On 5/15/25 6:21 PM, Dmitry Baryshkov wrote:
> > On 15/05/2025 19:18, Konrad Dybcio wrote:
> >> On 5/14/25 10:33 PM, Dmitry Baryshkov wrote:
> >>> On 14/05/2025 23:05, Konrad Dybcio wrote:
> >>>> On 5/14/25 9:23 PM, Dmitry Baryshkov wrote:
> >>>>> On Wed, May 14, 2025 at 05:10:33PM +0200, Konrad Dybcio wrote:
> >>>>>> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> >>>>>>
> >>>>>> The value of 7 (a.k.a. GENMASK(2, 0), a.k.a. disabling levels 1-3 of
> >>>>>> swizzling) is what we want on this platform (and others with a UBWC
> >>>>>> 1.0 encoder).
> >>>>>>
> >>>>>> Fix it to make mesa happy (the hardware doesn't care about the 2 higher
> >>>>>> bits, as they weren't consumed on this platform).
> >>>>>>
> >>>>>> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> >>>>>> ---
> >>>>>> drivers/soc/qcom/ubwc_config.c | 2 +-
> >>>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>>>>>
> >>>>>> diff --git a/drivers/soc/qcom/ubwc_config.c b/drivers/soc/qcom/ubwc_config.c
> >>>>>> index 9caecd071035ccb03f14464e9b7129ba34a7f862..96b94cf01218cce2dacdba22c7573ba6148fcdd1 100644
> >>>>>> --- a/drivers/soc/qcom/ubwc_config.c
> >>>>>> +++ b/drivers/soc/qcom/ubwc_config.c
> >>>>>> @@ -103,7 +103,7 @@ static const struct qcom_ubwc_cfg_data sm6115_data = {
> >>>>>> static const struct qcom_ubwc_cfg_data sm6125_data = {
> >>>>>> .ubwc_enc_version = UBWC_1_0,
> >>>>>> .ubwc_dec_version = UBWC_3_0,
> >>>>>> - .ubwc_swizzle = 1,
> >>>>>> + .ubwc_swizzle = 7,
> >>>>>> .highest_bank_bit = 14,
> >>>>>> };
> >>>>>
> >>>>> Add a comment and squash into the patch 1.
> >>>>
> >>>> I don't think that's a good idea, plus this series should be merged
> >>>> together anyway
> >>>
> >>> Well... Granted Rob's comment, I really think the patches should be reordered a bit:
> >>>
> >>> - MDSS: offset HBB by 13 (patch 2)
> >>> - switch drm/msm/mdss and display to common DB (patches 1+3 squashed)
> >>> - get a handle (patch 4)
> >>> - resolve / simplify (patches 5-10, not squashed)
> >>> - fix sm6125 (patch 13)
> >>> - WARN_ON (swizzle != swizzle) or (HBB != HBB)
> >>> - switch to common R/O config, keeping WARN_ON for the calculated values (with the hope to drop them after testing)
> >>
> >> Does this bring any functional benefit? This series is unfun to remix
> >
> > I know the pain.
> >
> > The functional benefit is to have the WARN_ON and side-by-side comparison of common_ubwc_config vs computed ubwc_config for HBB and swizzle.
>
> HBB I agree, since we'll be outsourcing it to yet another driver, swizzle
> should be good enough (tm) - I scanned through the values in the driver
> and couldn't find anything wrong just by eye
Well. What is the ubwc_swizzle value used for SDM845? I think it
should be 6 according to a6xx_gpu.c and 0 according to msm_mdss.c.
Yes, higher bits are most likely ignored. Still, we'd better have one
correct value.
>
> I realize this sounds funny, but all in all I don't think it's worth the
> effort just for that one
>
> Konrad
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 13/15] soc: qcom: ubwc: Fix SM6125's ubwc_swizzle value
2025-05-15 17:15 ` Dmitry Baryshkov
@ 2025-05-15 17:56 ` Konrad Dybcio
2025-05-15 17:58 ` Dmitry Baryshkov
0 siblings, 1 reply; 47+ messages in thread
From: Konrad Dybcio @ 2025-05-15 17:56 UTC (permalink / raw)
To: Dmitry Baryshkov, Konrad Dybcio
Cc: Konrad Dybcio, Bjorn Andersson, Rob Clark, Abhinav Kumar,
Akhil P Oommen, Sean Paul, David Airlie, Simona Vetter,
Marijn Suijten, linux-kernel, linux-arm-msm, dri-devel, freedreno
On 5/15/25 7:15 PM, Dmitry Baryshkov wrote:
> On Thu, 15 May 2025 at 19:36, Konrad Dybcio
> <konrad.dybcio@oss.qualcomm.com> wrote:
>>
>> On 5/15/25 6:21 PM, Dmitry Baryshkov wrote:
>>> On 15/05/2025 19:18, Konrad Dybcio wrote:
>>>> On 5/14/25 10:33 PM, Dmitry Baryshkov wrote:
>>>>> On 14/05/2025 23:05, Konrad Dybcio wrote:
>>>>>> On 5/14/25 9:23 PM, Dmitry Baryshkov wrote:
>>>>>>> On Wed, May 14, 2025 at 05:10:33PM +0200, Konrad Dybcio wrote:
>>>>>>>> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>>>>>>>
>>>>>>>> The value of 7 (a.k.a. GENMASK(2, 0), a.k.a. disabling levels 1-3 of
>>>>>>>> swizzling) is what we want on this platform (and others with a UBWC
>>>>>>>> 1.0 encoder).
>>>>>>>>
>>>>>>>> Fix it to make mesa happy (the hardware doesn't care about the 2 higher
>>>>>>>> bits, as they weren't consumed on this platform).
>>>>>>>>
>>>>>>>> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>>>>>>> ---
>>>>>>>> drivers/soc/qcom/ubwc_config.c | 2 +-
>>>>>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>>>>
>>>>>>>> diff --git a/drivers/soc/qcom/ubwc_config.c b/drivers/soc/qcom/ubwc_config.c
>>>>>>>> index 9caecd071035ccb03f14464e9b7129ba34a7f862..96b94cf01218cce2dacdba22c7573ba6148fcdd1 100644
>>>>>>>> --- a/drivers/soc/qcom/ubwc_config.c
>>>>>>>> +++ b/drivers/soc/qcom/ubwc_config.c
>>>>>>>> @@ -103,7 +103,7 @@ static const struct qcom_ubwc_cfg_data sm6115_data = {
>>>>>>>> static const struct qcom_ubwc_cfg_data sm6125_data = {
>>>>>>>> .ubwc_enc_version = UBWC_1_0,
>>>>>>>> .ubwc_dec_version = UBWC_3_0,
>>>>>>>> - .ubwc_swizzle = 1,
>>>>>>>> + .ubwc_swizzle = 7,
>>>>>>>> .highest_bank_bit = 14,
>>>>>>>> };
>>>>>>>
>>>>>>> Add a comment and squash into the patch 1.
>>>>>>
>>>>>> I don't think that's a good idea, plus this series should be merged
>>>>>> together anyway
>>>>>
>>>>> Well... Granted Rob's comment, I really think the patches should be reordered a bit:
>>>>>
>>>>> - MDSS: offset HBB by 13 (patch 2)
>>>>> - switch drm/msm/mdss and display to common DB (patches 1+3 squashed)
>>>>> - get a handle (patch 4)
>>>>> - resolve / simplify (patches 5-10, not squashed)
>>>>> - fix sm6125 (patch 13)
>>>>> - WARN_ON (swizzle != swizzle) or (HBB != HBB)
>>>>> - switch to common R/O config, keeping WARN_ON for the calculated values (with the hope to drop them after testing)
>>>>
>>>> Does this bring any functional benefit? This series is unfun to remix
>>>
>>> I know the pain.
>>>
>>> The functional benefit is to have the WARN_ON and side-by-side comparison of common_ubwc_config vs computed ubwc_config for HBB and swizzle.
>>
>> HBB I agree, since we'll be outsourcing it to yet another driver, swizzle
>> should be good enough (tm) - I scanned through the values in the driver
>> and couldn't find anything wrong just by eye
>
> Well. What is the ubwc_swizzle value used for SDM845? I think it
> should be 6 according to a6xx_gpu.c and 0 according to msm_mdss.c.
> Yes, higher bits are most likely ignored. Still, we'd better have one
> correct value.
Ehh, so laziness bites after all..
Unfortunately it seems like I don't have a good answer for you
- although I can infer a technically valid config for these
at the very least:
msm8937
msm8998
sc8180x
sdm670
sdm845
sm6150
sm7150
sm8150
with the ubwc1.0 platforms receiving all 3 levels and ubwc 2.0/
3.0 enabling 2/3
this however I'm not sure matches what downstream does..
Konrad
^ permalink raw reply [flat|nested] 47+ messages in thread
* Re: [PATCH RFT v2 13/15] soc: qcom: ubwc: Fix SM6125's ubwc_swizzle value
2025-05-15 17:56 ` Konrad Dybcio
@ 2025-05-15 17:58 ` Dmitry Baryshkov
0 siblings, 0 replies; 47+ messages in thread
From: Dmitry Baryshkov @ 2025-05-15 17:58 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Konrad Dybcio, Bjorn Andersson, Rob Clark, Abhinav Kumar,
Akhil P Oommen, Sean Paul, David Airlie, Simona Vetter,
Marijn Suijten, linux-kernel, linux-arm-msm, dri-devel, freedreno
On 15/05/2025 20:56, Konrad Dybcio wrote:
> On 5/15/25 7:15 PM, Dmitry Baryshkov wrote:
>> On Thu, 15 May 2025 at 19:36, Konrad Dybcio
>> <konrad.dybcio@oss.qualcomm.com> wrote:
>>>
>>> On 5/15/25 6:21 PM, Dmitry Baryshkov wrote:
>>>> On 15/05/2025 19:18, Konrad Dybcio wrote:
>>>>> On 5/14/25 10:33 PM, Dmitry Baryshkov wrote:
>>>>>> On 14/05/2025 23:05, Konrad Dybcio wrote:
>>>>>>> On 5/14/25 9:23 PM, Dmitry Baryshkov wrote:
>>>>>>>> On Wed, May 14, 2025 at 05:10:33PM +0200, Konrad Dybcio wrote:
>>>>>>>>> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>>>>>>>>
>>>>>>>>> The value of 7 (a.k.a. GENMASK(2, 0), a.k.a. disabling levels 1-3 of
>>>>>>>>> swizzling) is what we want on this platform (and others with a UBWC
>>>>>>>>> 1.0 encoder).
>>>>>>>>>
>>>>>>>>> Fix it to make mesa happy (the hardware doesn't care about the 2 higher
>>>>>>>>> bits, as they weren't consumed on this platform).
>>>>>>>>>
>>>>>>>>> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>>>>>>>>> ---
>>>>>>>>> drivers/soc/qcom/ubwc_config.c | 2 +-
>>>>>>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>>>>>
>>>>>>>>> diff --git a/drivers/soc/qcom/ubwc_config.c b/drivers/soc/qcom/ubwc_config.c
>>>>>>>>> index 9caecd071035ccb03f14464e9b7129ba34a7f862..96b94cf01218cce2dacdba22c7573ba6148fcdd1 100644
>>>>>>>>> --- a/drivers/soc/qcom/ubwc_config.c
>>>>>>>>> +++ b/drivers/soc/qcom/ubwc_config.c
>>>>>>>>> @@ -103,7 +103,7 @@ static const struct qcom_ubwc_cfg_data sm6115_data = {
>>>>>>>>> static const struct qcom_ubwc_cfg_data sm6125_data = {
>>>>>>>>> .ubwc_enc_version = UBWC_1_0,
>>>>>>>>> .ubwc_dec_version = UBWC_3_0,
>>>>>>>>> - .ubwc_swizzle = 1,
>>>>>>>>> + .ubwc_swizzle = 7,
>>>>>>>>> .highest_bank_bit = 14,
>>>>>>>>> };
>>>>>>>>
>>>>>>>> Add a comment and squash into the patch 1.
>>>>>>>
>>>>>>> I don't think that's a good idea, plus this series should be merged
>>>>>>> together anyway
>>>>>>
>>>>>> Well... Granted Rob's comment, I really think the patches should be reordered a bit:
>>>>>>
>>>>>> - MDSS: offset HBB by 13 (patch 2)
>>>>>> - switch drm/msm/mdss and display to common DB (patches 1+3 squashed)
>>>>>> - get a handle (patch 4)
>>>>>> - resolve / simplify (patches 5-10, not squashed)
>>>>>> - fix sm6125 (patch 13)
>>>>>> - WARN_ON (swizzle != swizzle) or (HBB != HBB)
>>>>>> - switch to common R/O config, keeping WARN_ON for the calculated values (with the hope to drop them after testing)
>>>>>
>>>>> Does this bring any functional benefit? This series is unfun to remix
>>>>
>>>> I know the pain.
>>>>
>>>> The functional benefit is to have the WARN_ON and side-by-side comparison of common_ubwc_config vs computed ubwc_config for HBB and swizzle.
>>>
>>> HBB I agree, since we'll be outsourcing it to yet another driver, swizzle
>>> should be good enough (tm) - I scanned through the values in the driver
>>> and couldn't find anything wrong just by eye
>>
>> Well. What is the ubwc_swizzle value used for SDM845? I think it
>> should be 6 according to a6xx_gpu.c and 0 according to msm_mdss.c.
>> Yes, higher bits are most likely ignored. Still, we'd better have one
>> correct value.
>
> Ehh, so laziness bites after all..
>
> Unfortunately it seems like I don't have a good answer for you
> - although I can infer a technically valid config for these
> at the very least:
>
> msm8937
> msm8998
> sc8180x
> sdm670
> sdm845
> sm6150
> sm7150
> sm8150
WARN_ON would be a good thing in the end
>
> with the ubwc1.0 platforms receiving all 3 levels and ubwc 2.0/
> 3.0 enabling 2/3
>
> this however I'm not sure matches what downstream does..
Well, let's match previous GPU config, so 6 whenever we don't define
anything special.
>
> Konrad
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 47+ messages in thread
end of thread, other threads:[~2025-05-15 17:58 UTC | newest]
Thread overview: 47+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-14 15:10 [RFT PATCH v2 00/15] Add a single source of truth for UBWC configuration data Konrad Dybcio
2025-05-14 15:10 ` [PATCH RFT v2 01/15] soc: qcom: Add UBWC config provider Konrad Dybcio
2025-05-14 15:29 ` Konrad Dybcio
2025-05-14 19:03 ` Dmitry Baryshkov
2025-05-15 15:50 ` Konrad Dybcio
2025-05-14 15:10 ` [PATCH RFT v2 02/15] drm/msm: Offset MDSS HBB value by 13 Konrad Dybcio
2025-05-14 19:04 ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFT v2 03/15] drm/msm: Use the central UBWC config database Konrad Dybcio
2025-05-14 19:05 ` Dmitry Baryshkov
2025-05-15 10:32 ` kernel test robot
2025-05-14 15:10 ` [PATCH RFT v2 04/15] drm/msm/a6xx: Get a handle to the common UBWC config Konrad Dybcio
2025-05-14 15:10 ` [PATCH RFT v2 05/15] drm/msm/a6xx: Resolve the meaning of AMSBC Konrad Dybcio
2025-05-14 19:16 ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFT v2 06/15] drm/msm/a6xx: Simplify uavflagprd_inv detection Konrad Dybcio
2025-05-14 19:14 ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFT v2 07/15] drm/msm/a6xx: Resolve the meaning of UBWC_MODE Konrad Dybcio
2025-05-14 19:14 ` Dmitry Baryshkov
2025-05-14 20:02 ` Rob Clark
2025-05-14 15:10 ` [PATCH RFT v2 08/15] drm/msm/a6xx: Replace '2' with BIT(1) in level2_swizzling_dis calc Konrad Dybcio
2025-05-14 19:15 ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFT v2 09/15] drm/msm/a6xx: Resolve the meaning of rgb565_predicator Konrad Dybcio
2025-05-14 19:15 ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFT v2 10/15] drm/msm/a6xx: Simplify min_acc_len calculation Konrad Dybcio
2025-05-14 19:19 ` Dmitry Baryshkov
2025-05-15 15:51 ` Konrad Dybcio
2025-05-14 15:10 ` [PATCH RFT v2 11/15] drm/msm/adreno: Switch to the common UBWC config struct Konrad Dybcio
2025-05-14 19:22 ` Dmitry Baryshkov
2025-05-15 15:51 ` Konrad Dybcio
2025-05-14 15:10 ` [PATCH RFT v2 12/15] drm/msm/a6xx: Drop cfg->ubwc_swizzle override Konrad Dybcio
2025-05-14 20:32 ` Dmitry Baryshkov
2025-05-15 15:52 ` Konrad Dybcio
2025-05-14 15:10 ` [PATCH RFT v2 13/15] soc: qcom: ubwc: Fix SM6125's ubwc_swizzle value Konrad Dybcio
2025-05-14 19:23 ` Dmitry Baryshkov
2025-05-14 20:05 ` Konrad Dybcio
2025-05-14 20:33 ` Dmitry Baryshkov
2025-05-15 16:18 ` Konrad Dybcio
2025-05-15 16:21 ` Dmitry Baryshkov
2025-05-15 16:35 ` Konrad Dybcio
2025-05-15 17:15 ` Dmitry Baryshkov
2025-05-15 17:56 ` Konrad Dybcio
2025-05-15 17:58 ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFT v2 14/15] soc: qcom: ubwc: Add #defines for UBWC swizzle bits Konrad Dybcio
2025-05-14 19:24 ` Dmitry Baryshkov
2025-05-14 20:09 ` Konrad Dybcio
2025-05-14 20:33 ` Dmitry Baryshkov
2025-05-14 15:10 ` [PATCH RFC RFT v2 15/15] drm/msm/a6xx: Warn if the highest_bank_bit value is overwritten Konrad Dybcio
2025-05-14 19:25 ` Dmitry Baryshkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).