media: iris: migrate to using global UBWC config
Subsystems (5)
v4 cover media: iris: migrate to using global UBWC config
Having UBWC configuration in the driver is error prone. For example, the driver specifies fixed values for HBB, while the actual value might depend on the DDR type. Stop defining UBWC data in the iris driver and use the global UBWC configuration registry.
Merge strategy: either merge SoC bits directly through the media tree (with Bjorn's ack) or merge to the media tree through the immutable tag. The drm patches will follow depending on the way the SoC patches are merged.
Note: the patches are compile-tested only because of the lack of the Gen2 hardware at hand.
---
Changes in v4:
- Rebased on next/master, fixing the conflicts.
- Link to v3: https://lore.kernel.org/r/[email protected]
Changes in v3:
- Dropped applied and unrelated patches (they will be posted separately)
- Include printk.h, decoupling the series from fix picked up by Bjorn
- Introduced additional helpers to retrieve the data.
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Extended the commit message and added a comment for the min_acc length helper (Konrad)
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Dmitry Baryshkov (9):
soc: qcom: ubwc: add helper to get min_acc length
soc: qcom: ubwc: add helpers to get programmable values
media: iris: retrieve UBWC platform configuration
media: iris: don't specify min_acc_length in the source code
media: iris: don't specify highest_bank_bit in the source code
media: iris: don't specify ubwc_swizzle in the source code
media: iris: don't specify bank_spreading in the source code
media: iris: don't specify max_channels in the source code
media: iris: drop remnants of UBWC configuration
drivers/media/platform/qcom/iris/Kconfig | 1 + drivers/media/platform/qcom/iris/iris_core.h | 4 ++++ .../platform/qcom/iris/iris_hfi_gen2_packet.c | 18 ++++++++++------ .../platform/qcom/iris/iris_platform_common.h | 11 ---------- .../media/platform/qcom/iris/iris_platform_gen2.c | 14 ------------ drivers/media/platform/qcom/iris/iris_probe.c | 5 +++++ include/linux/soc/qcom/ubwc.h | 25 ++++++++++++++++++++++ 7 files changed, 46 insertions(+), 32 deletions(-)
---
base-commit: ca3a02fda4da8e2c1cb6baee5d72352e9e2cfaea
change-id: 20260110-iris-ubwc-06f64cbb31ae
Best regards,
Signature · 2 lines
With best wishes Dmitry
PATCH v4 1/9 soc: qcom: ubwc: add helper to get min_acc length
MDSS and GPU drivers use different approaches to get min_acc length. Add helper function that can be used by all the drivers.
The helper reflects our current best guess, it blindly copies the approach adopted by the MDSS drivers and it matches current values selected by the GPU driver.
--- include/linux/soc/qcom/ubwc.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
include/linux/soc/qcom/ubwc.h +10 -0
@@ -74,4 +74,14 @@ static inline bool qcom_ubwc_get_ubwc_mode(const struct qcom_ubwc_cfg_data *cfg) return ret; } +/* +* This is the best guess, based on the MDSS driver, which worked so far. +*/ +static inline bool qcom_ubwc_min_acc_length_64b (const struct qcom_ubwc_cfg_data *cfg) +{ +return cfg->ubwc_enc_version ==UBWC_1_0 && + (cfg->ubwc_dec_version ==UBWC_2_0 || + cfg->ubwc_dec_version ==UBWC_3_0 ); +} +#endif /* __QCOM_UBWC_H__ */
Signature · 1 line
2.47.3
PATCH v4 2/9 soc: qcom: ubwc: add helpers to get programmable values
In reply to Dmitry BaryshkovCurrently the database stores macrotile_mode in the data. However it can be derived from the rest of the data: it should be used for UBWC encoding >= 3.0 except for several corner cases (SM8150 and SC8180X).
The ubwc_bank_spread field seems to be based on the impreside data we had for the MDSS and DPU programming. In some cases UBWC engine inside the display controller doesn't need to program it, although bank spread is to be enabled.
Bank swizzle is also currently stored as is, but it is almost standard (banks 1-3 for UBWC 1.0 and 2-3 for other versions), the only exception being Lemans (it uses only bank 3).
Add helpers returning values from the config for now. They will be rewritten later, in a separate series, but having the helper now simplifies refacroring the code later.
--- include/linux/soc/qcom/ubwc.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
include/linux/soc/qcom/ubwc.h +15 -0
@@ -84,4 +84,19 @@ static inline bool qcom_ubwc_min_acc_length_64b(const struct qcom_ubwc_cfg_data cfg->ubwc_dec_version == UBWC_3_0); } +static inline bool qcom_ubwc_macrotile_mode (const struct qcom_ubwc_cfg_data *cfg) +{ +return cfg->macrotile_mode; +} + +static inline bool qcom_ubwc_bank_spread (const struct qcom_ubwc_cfg_data *cfg) +{ +return cfg->ubwc_bank_spread; +} + +static inline u32 qcom_ubwc_swizzle (const struct qcom_ubwc_cfg_data *cfg) +{ +return cfg->ubwc_swizzle; +} +#endif /* __QCOM_UBWC_H__ */
Signature · 1 line
2.47.3
Re: [PATCH v4 2/9] soc: qcom: ubwc: add helpers to get programmable values
Quoted 4 lines · Dmitry Baryshkov
Currently the database stores
macrotile_modein the data. However it can be derived from the rest of the data: it should be used for UBWC encoding >= 3.0 except for several corner cases (SM8150 and SC8180X).
FWIW, there is a UBWC version 3.1 not currently reflected in the code which adds the 8-channel macrotile mode. If we just added that and made SM8150 and SC8180X be 3.1 then we could derive it from the version.
Connor
Quoted 48 lines
The
ubwc_bank_spreadfield seems to be based on the impreside data we had for the MDSS and DPU programming. In some cases UBWC engine inside the display controller doesn't need to program it, although bank spread is to be enabled.Bank swizzle is also currently stored as is, but it is almost standard (banks 1-3 for UBWC 1.0 and 2-3 for other versions), the only exception being Lemans (it uses only bank 3).
Add helpers returning values from the config for now. They will be rewritten later, in a separate series, but having the helper now simplifies refacroring the code later.
Tested-by Wangao Wang <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>--- include/linux/soc/qcom/ubwc.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)include/linux/soc/qcom/ubwc.h +15
-1@@ -84,4 +84,19 @@ static inline bool qcom_ubwc_min_acc_length_64b(const struct qcom_ubwc_cfg_data cfg->ubwc_dec_version == UBWC_3_0); } +static inline bool qcom_ubwc_macrotile_mode (const struct qcom_ubwc_cfg_data *cfg) +{ +return cfg->macrotile_mode; +} + +static inline bool qcom_ubwc_bank_spread (const struct qcom_ubwc_cfg_data *cfg) +{ +return cfg->ubwc_bank_spread; +} + +static inline u32 qcom_ubwc_swizzle (const struct qcom_ubwc_cfg_data *cfg) +{ +return cfg->ubwc_swizzle; +} +#endif /* __QCOM_UBWC_H__ */ --2.47.3
Re: [PATCH v4 2/9] soc: qcom: ubwc: add helpers to get programmable values
Quoted 11 lines · Connor Abbott
Quoted 4 lines · Dmitry Baryshkov
Currently the database stores
macrotile_modein the data. However it can be derived from the rest of the data: it should be used for UBWC encoding >= 3.0 except for several corner cases (SM8150 and SC8180X).FWIW, there is a UBWC version 3.1 not currently reflected in the code which adds the 8-channel macrotile mode. If we just added that and made SM8150 and SC8180X be 3.1 then we could derive it from the version.
I see 3.0 in docs for both
Konrad
Re: [PATCH v4 2/9] soc: qcom: ubwc: add helpers to get programmable values
In reply to Dmitry BaryshkovQuoted 28 lines · Dmitry Baryshkov
Currently the database stores
macrotile_modein the data. However it can be derived from the rest of the data: it should be used for UBWC encoding >= 3.0 except for several corner cases (SM8150 and SC8180X).The
ubwc_bank_spreadfield seems to be based on the impreside data we had for the MDSS and DPU programming. In some cases UBWC engine inside the display controller doesn't need to program it, although bank spread is to be enabled.Bank swizzle is also currently stored as is, but it is almost standard (banks 1-3 for UBWC 1.0 and 2-3 for other versions), the only exception being Lemans (it uses only bank 3).
Add helpers returning values from the config for now. They will be rewritten later, in a separate series, but having the helper now simplifies refacroring the code later.
Tested-by Wangao Wang <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>--- include/linux/soc/qcom/ubwc.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)include/linux/soc/qcom/ubwc.h +0
-0
include/linux/soc/qcom/ubwc.h static inline bool qcom_ubwc_min_acc_length_64b(const struct qcom_ubwc_cfg_data · line 87
Quoted 4 lines
include/linux/soc/qcom/ubwc.h +1
-0@@ -84,4 +84,19 @@ static inline bool qcom_ubwc_min_acc_length_64b(const struct qcom_ubwc_cfg_data cfg->ubwc_dec_version == UBWC_3_0); } +static inline bool qcom_ubwc_macrotile_mode (const struct qcom_ubwc_cfg_data *cfg)
Should we rename this to something like "qcom_ubwc_macrotile_mode_8ch()"?
Konrad
Re: [PATCH v4 2/9] soc: qcom: ubwc: add helpers to get programmable values
Quoted 32 lines · Konrad Dybcio
Quoted 31 lines · Dmitry Baryshkov
Currently the database stores
macrotile_modein the data. However it can be derived from the rest of the data: it should be used for UBWC encoding >= 3.0 except for several corner cases (SM8150 and SC8180X).The
ubwc_bank_spreadfield seems to be based on the impreside data we had for the MDSS and DPU programming. In some cases UBWC engine inside the display controller doesn't need to program it, although bank spread is to be enabled.Bank swizzle is also currently stored as is, but it is almost standard (banks 1-3 for UBWC 1.0 and 2-3 for other versions), the only exception being Lemans (it uses only bank 3).
Add helpers returning values from the config for now. They will be rewritten later, in a separate series, but having the helper now simplifies refacroring the code later.
Tested-by Wangao Wang <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>--- include/linux/soc/qcom/ubwc.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)include/linux/soc/qcom/ubwc.h +0
-0@@ -84,4 +84,19 @@ static inline bool qcom_ubwc_min_acc_length_64b(const struct qcom_ubwc_cfg_data cfg->ubwc_dec_version == UBWC_3_0); }
Quoted 3 lines
include/linux/soc/qcom/ubwc.h static inline bool qcom_ubwc_min_acc_length_64b(const struct qcom_ubwc_cfg_data · line 87
Quoted 1 line
include/linux/soc/qcom/ubwc.h +1
-0+static inline bool qcom_ubwc_macrotile_mode (const struct qcom_ubwc_cfg_data *cfg)Should we rename this to something like "
qcom_ubwc_macrotile_mode_8ch()"?
I'd rather land it as is (and maybe add a comment).
Quoted 2 lines
Konrad
Signature · 2 lines
With best wishes Dmitry
Bjorn Andersson
maintainerRe: [PATCH v4 2/9] soc: qcom: ubwc: add helpers to get programmable values
In reply to Dmitry BaryshkovQuoted 13 lines · Dmitry Baryshkov
Currently the database stores
macrotile_modein the data. However it can be derived from the rest of the data: it should be used for UBWC encoding >= 3.0 except for several corner cases (SM8150 and SC8180X).The
ubwc_bank_spreadfield seems to be based on the impreside data we had for the MDSS and DPU programming. In some cases UBWC engine inside the display controller doesn't need to program it, although bank spread is to be enabled.Bank swizzle is also currently stored as is, but it is almost standard (banks 1-3 for UBWC 1.0 and 2-3 for other versions), the only exception being Lemans (it uses only bank 3).
Quoted 6 lines
Add helpers returning values from the config for now. They will be rewritten later, in a separate series, but having the helper now simplifies refacroring the code later.
Tested-by Wangao Wang <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>
Please find patch 1 and 2 in an immutable branch at:
https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux.git [email protected]
Regards,
Bjorn
Quoted 32 lines
--- include/linux/soc/qcom/ubwc.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)include/linux/soc/qcom/ubwc.h +15
-0@@ -84,4 +84,19 @@ static inline bool qcom_ubwc_min_acc_length_64b(const struct qcom_ubwc_cfg_data cfg->ubwc_dec_version == UBWC_3_0); } +static inline bool qcom_ubwc_macrotile_mode (const struct qcom_ubwc_cfg_data *cfg) +{ +return cfg->macrotile_mode; +} + +static inline bool qcom_ubwc_bank_spread (const struct qcom_ubwc_cfg_data *cfg) +{ +return cfg->ubwc_bank_spread; +} + +static inline u32 qcom_ubwc_swizzle (const struct qcom_ubwc_cfg_data *cfg) +{ +return cfg->ubwc_swizzle; +} +#endif /* __QCOM_UBWC_H__ */ Signature · 2 lines
-- 2.47.3
PATCH v4 3/9 media: iris: retrieve UBWC platform configuration
In reply to Dmitry BaryshkovSpecifying UBWC data in each driver doesn't scale and is prone to errors. Request UBWC data from the central database in preparation to using it through the rest of the driver.
--- drivers/media/platform/qcom/iris/Kconfig | 1 + drivers/media/platform/qcom/iris/iris_core.h | 4 ++++ drivers/media/platform/qcom/iris/iris_probe.c | 5 +++++ 3 files changed, 10 insertions(+)
drivers/media/platform/qcom/iris/Kconfig +1 -0
@@ -5,6 +5,7 @@ config VIDEO_QCOM_IRIS select V4L2_MEM2MEM_DEV select QCOM_MDT_LOADER if ARCH_QCOM select QCOM_SCM + select QCOM_UBWC_CONFIG select VIDEOBUF2_DMA_CONTIG help This is a V4L2 driver for Qualcomm iris video accelerator
drivers/media/platform/qcom/iris/iris_core.h +4 -0
@@ -30,6 +30,8 @@ enum domain_type { DECODER = BIT(1), }; +struct qcom_ubwc_cfg_data ; +/** * struct iris_core - holds core parameters valid for all instances *
@@ -52,6 +54,7 @@ enum domain_type {* @resets: table of iris reset clocks * @controller_resets: table of controller reset clocks * @iris_platform_data: a structure for platform data +* @ubwc_cfg: UBWC configuration for the platform * @state: current state of core * @iface_q_table_daddr: device address for interface queue table memory * @sfr_daddr: device address for SFR (Sub System Failure Reason) register memory
@@ -95,6 +98,7 @@ struct iris_core {struct reset_control_bulk_data *resets;struct reset_control_bulk_data *controller_resets;const struct iris_platform_data *iris_platform_data; +const struct qcom_ubwc_cfg_data *ubwc_cfg;enum iris_core_state state;dma_addr_t iface_q_table_daddr;dma_addr_t sfr_daddr;
drivers/media/platform/qcom/iris/iris_probe.c +5 -0
@@ -10,6 +10,7 @@#include <linux/pm_opp.h> #include <linux/pm_runtime.h> #include <linux/reset.h> +#include <linux/soc/qcom/ubwc.h> #include "iris_core.h" #include "iris_ctrls.h"
@@ -244,6 +245,10 @@ static int iris_probe(struct platform_device *pdev) core->iris_platform_data =of_device_get_match_data (core->dev); + core->ubwc_cfg =qcom_ubwc_config_get_data (); +if (IS_ERR (core->ubwc_cfg)) +return PTR_ERR (core->ubwc_cfg); + ret =devm_request_threaded_irq (core->dev, core->irq, iris_hfi_isr, iris_hfi_isr_handler,IRQF_TRIGGER_HIGH ,"iris" , core);if (ret)
Signature · 1 line
2.47.3
Dikshita Agarwal
maintainerRe: [PATCH v4 3/9] media: iris: retrieve UBWC platform configuration
Quoted 69 lines · Dmitry Baryshkov
Specifying UBWC data in each driver doesn't scale and is prone to errors. Request UBWC data from the central database in preparation to using it through the rest of the driver.
Reviewed-by Bryan O'Donoghue <[email protected]>Reviewed-by Konrad Dybcio <[email protected]>Reviewed-by Dikshita Agarwal <[email protected]>Tested-by Wangao Wang <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/media/platform/qcom/iris/Kconfig | 1 + drivers/media/platform/qcom/iris/iris_core.h | 4 ++++ drivers/media/platform/qcom/iris/iris_probe.c | 5 +++++ 3 files changed, 10 insertions(+)drivers/media/platform/qcom/iris/Kconfig +1
-0@@ -5,6 +5,7 @@ config VIDEO_QCOM_IRIS select V4L2_MEM2MEM_DEV select QCOM_MDT_LOADER if ARCH_QCOM select QCOM_SCM + select QCOM_UBWC_CONFIG select VIDEOBUF2_DMA_CONTIG help This is a V4L2 driver for Qualcomm iris video acceleratordrivers/media/platform/qcom/iris/iris_core.h +4
-0@@ -30,6 +30,8 @@ enum domain_type { DECODER = BIT(1), }; +struct qcom_ubwc_cfg_data ; +/** * struct iris_core - holds core parameters valid for all instances * @@ -52,6 +54,7 @@ enum domain_type {* @resets: table of iris reset clocks * @controller_resets: table of controller reset clocks * @iris_platform_data: a structure for platform data +* @ubwc_cfg: UBWC configuration for the platform * @state: current state of core * @iface_q_table_daddr: device address for interface queue table memory * @sfr_daddr: device address for SFR (Sub System Failure Reason) register memory @@ -95,6 +98,7 @@ struct iris_core {struct reset_control_bulk_data *resets;struct reset_control_bulk_data *controller_resets;const struct iris_platform_data *iris_platform_data; +const struct qcom_ubwc_cfg_data *ubwc_cfg;enum iris_core_state state;dma_addr_t iface_q_table_daddr;dma_addr_t sfr_daddr;drivers/media/platform/qcom/iris/iris_probe.c +1
-0@@ -10,6 +10,7 @@#include <linux/pm_opp.h> #include <linux/pm_runtime.h> #include <linux/reset.h> +#include <linux/soc/qcom/ubwc.h> #include "iris_core.h" #include "iris_ctrls.h"
drivers/media/platform/qcom/iris/iris_probe.c static int iris_probe(struct platform_device *pdev) · line 250
Quoted 6 lines
drivers/media/platform/qcom/iris/iris_probe.c +3
-0@@ -244,6 +245,10 @@ static int iris_probe(struct platform_device *pdev) core->iris_platform_data =of_device_get_match_data (core->dev); + core->ubwc_cfg =qcom_ubwc_config_get_data (); +if (IS_ERR (core->ubwc_cfg)) +return PTR_ERR (core->ubwc_cfg);
Afterthought: This change assumes that the presence of a UBWC config implies Iris UBWC support. However, some platforms (e.g. qcm2290) do have UBWC data defined at the SoC level but do not support UBWC in the video firmware, which could potentially surface during SYS_INIT if UBWC is advertised unconditionally, so this might be worth double‑checking.
Thanks,
Dikshita
Quoted 5 lines
drivers/media/platform/qcom/iris/iris_probe.c +1
-0+ ret =devm_request_threaded_irq (core->dev, core->irq, iris_hfi_isr, iris_hfi_isr_handler,IRQF_TRIGGER_HIGH ,"iris" , core);if (ret)
Re: [PATCH v4 3/9] media: iris: retrieve UBWC platform configuration
Quoted 22 lines · Dikshita Agarwal
Quoted 19 lines · Dmitry Baryshkov
Specifying UBWC data in each driver doesn't scale and is prone to errors. Request UBWC data from the central database in preparation to using it through the rest of the driver.
Reviewed-by Bryan O'Donoghue <[email protected]>Reviewed-by Konrad Dybcio <[email protected]>Reviewed-by Dikshita Agarwal <[email protected]>Tested-by Wangao Wang <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/media/platform/qcom/iris/Kconfig | 1 + drivers/media/platform/qcom/iris/iris_core.h | 4 ++++ drivers/media/platform/qcom/iris/iris_probe.c | 5 +++++ 3 files changed, 10 insertions(+)drivers/media/platform/qcom/iris/iris_probe.c +0
-0@@ -244,6 +245,10 @@ static int iris_probe(struct platform_device *pdev) core->iris_platform_data =of_device_get_match_data (core->dev);
Quoted 9 lines
drivers/media/platform/qcom/iris/iris_probe.c static int iris_probe(struct platform_device *pdev) · line 250
Quoted 3 lines
drivers/media/platform/qcom/iris/iris_probe.c +3
-0+ core->ubwc_cfg =qcom_ubwc_config_get_data (); +if (IS_ERR (core->ubwc_cfg)) +return PTR_ERR (core->ubwc_cfg);Afterthought: This change assumes that the presence of a UBWC config implies Iris UBWC support. However, some platforms (e.g. qcm2290) do have UBWC data defined at the SoC level but do not support UBWC in the video firmware, which could potentially surface during
SYS_INITif UBWC is advertised unconditionally, so this might be worth double‑checking.
No, this change implies that the lack of the UBWC config is an error for modern platforms (which it is anyway).
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v4 3/9] media: iris: retrieve UBWC platform configuration
Quoted 33 lines · Dmitry Baryshkov
Quoted 22 lines · Dikshita Agarwal
Quoted 19 lines · Dmitry Baryshkov
Specifying UBWC data in each driver doesn't scale and is prone to errors. Request UBWC data from the central database in preparation to using it through the rest of the driver.
Reviewed-by Bryan O'Donoghue <[email protected]>Reviewed-by Konrad Dybcio <[email protected]>Reviewed-by Dikshita Agarwal <[email protected]>Tested-by Wangao Wang <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/media/platform/qcom/iris/Kconfig | 1 + drivers/media/platform/qcom/iris/iris_core.h | 4 ++++ drivers/media/platform/qcom/iris/iris_probe.c | 5 +++++ 3 files changed, 10 insertions(+)drivers/media/platform/qcom/iris/iris_probe.c +0
-0@@ -244,6 +245,10 @@ static int iris_probe(struct platform_device *pdev) core->iris_platform_data =of_device_get_match_data (core->dev);Quoted 9 lines
drivers/media/platform/qcom/iris/iris_probe.c static int iris_probe(struct platform_device *pdev) · line 250
Quoted 3 lines
drivers/media/platform/qcom/iris/iris_probe.c +3
-0+ core->ubwc_cfg =qcom_ubwc_config_get_data (); +if (IS_ERR (core->ubwc_cfg)) +return PTR_ERR (core->ubwc_cfg);Afterthought: This change assumes that the presence of a UBWC config implies Iris UBWC support. However, some platforms (e.g. qcm2290) do have UBWC data defined at the SoC level but do not support UBWC in the video firmware, which could potentially surface during
SYS_INITif UBWC is advertised unconditionally, so this might be worth double‑checking.
Quoted 2 lines
No, this change implies that the lack of the UBWC config is an error for modern platforms (which it is anyway).
And that's not to mention that Iris doesn't support Agatti / QCM2290, nor any other UBWC-less platform at this point. Those platforms will need additional chagnes anyway, so you might as well include a patch to skip sending UBWC-related packets in iris_hfi_gen2_packet_sys_init().
Signature · 2 lines
With best wishes Dmitry
PATCH v4 4/9 media: iris: don't specify min_acc_length in the source code
In reply to Dmitry BaryshkovThe min_acc length can be calculated from the platform UBWC configuration. Use the freshly introduced helper and calculate min_acc length based on the platform UBWC configuration instead of specifying it directly in the source.
--- drivers/media/platform/qcom/iris/iris_hfi_gen2_packet.c | 6 +++++- drivers/media/platform/qcom/iris/iris_platform_common.h | 1 - drivers/media/platform/qcom/iris/iris_platform_gen2.c | 1 - 3 files changed, 5 insertions(+), 3 deletions(-)
drivers/media/platform/qcom/iris/iris_hfi_gen2_packet.c +5 -1
@@ -3,6 +3,9 @@* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved. */ +#include <linux/printk.h> +#include <linux/soc/qcom/ubwc.h> +#include "iris_hfi_common.h" #include "iris_hfi_gen2.h" #include "iris_hfi_gen2_packet.h"
@@ -120,6 +123,7 @@ static void iris_hfi_gen2_create_packet(struct iris_hfi_header *hdr, u32 pkt_typvoid iris_hfi_gen2_packet_sys_init (struct iris_core *core,struct iris_hfi_header *hdr) { +const struct qcom_ubwc_cfg_data *ubwc = core->ubwc_cfg;u32 payload =0 ;iris_hfi_gen2_create_header (hdr,0 , core->header_id++);
@@ -146,7 +150,7 @@ void iris_hfi_gen2_packet_sys_init(struct iris_core *core, struct iris_hfi_heade &payload, sizeof(u32)); - payload = core->iris_platform_data->ubwc_config->mal_length; + payload =qcom_ubwc_min_acc_length_64b (ubwc) ?64 :32 ; iris_hfi_gen2_create_packet(hdr, HFI_PROP_UBWC_MAL_LENGTH, HFI_HOST_FLAGS_NONE,
drivers/media/platform/qcom/iris/iris_platform_common.h +0 -1
@@ -77,7 +77,6 @@ struct tz_cp_config {struct ubwc_config_data {u32 max_channels; -u32 mal_length;u32 highest_bank_bit;u32 bank_swzl_level;u32 bank_swz2_level;
drivers/media/platform/qcom/iris/iris_platform_gen2.c +0 -1
@@ -792,7 +792,6 @@ static const char * const sm8550_opp_clk_table[] = {static struct ubwc_config_data ubwc_config_sm8550 = { .max_channels =8 , - .mal_length =32 , .highest_bank_bit =16 , .bank_swzl_level =0 , .bank_swz2_level =1 ,
Signature · 1 line
2.47.3
PATCH v4 5/9 media: iris: don't specify highest_bank_bit in the source code
In reply to Dmitry BaryshkovThe highest_bank_bit param is specified both in the Iris driver and in the platform UBWC config. Use the platform UBWC configuration instead of specifying it directly in the source.
--- drivers/media/platform/qcom/iris/iris_hfi_gen2_packet.c | 2 +- drivers/media/platform/qcom/iris/iris_platform_common.h | 1 - drivers/media/platform/qcom/iris/iris_platform_gen2.c | 1 - 3 files changed, 1 insertion(+), 3 deletions(-)
drivers/media/platform/qcom/iris/iris_hfi_gen2_packet.c +1 -1
@@ -160,7 +160,7 @@ void iris_hfi_gen2_packet_sys_init(struct iris_core *core, struct iris_hfi_heade &payload, sizeof(u32)); - payload = core->iris_platform_data->ubwc_config->highest_bank_bit; + payload = ubwc->highest_bank_bit; iris_hfi_gen2_create_packet(hdr, HFI_PROP_UBWC_HBB, HFI_HOST_FLAGS_NONE,
drivers/media/platform/qcom/iris/iris_platform_common.h +0 -1
@@ -77,7 +77,6 @@ struct tz_cp_config {struct ubwc_config_data {u32 max_channels; -u32 highest_bank_bit;u32 bank_swzl_level;u32 bank_swz2_level;u32 bank_swz3_level;
drivers/media/platform/qcom/iris/iris_platform_gen2.c +0 -1
@@ -792,7 +792,6 @@ static const char * const sm8550_opp_clk_table[] = {static struct ubwc_config_data ubwc_config_sm8550 = { .max_channels =8 , - .highest_bank_bit =16 , .bank_swzl_level =0 , .bank_swz2_level =1 , .bank_swz3_level =1 ,
Signature · 1 line
2.47.3
PATCH v4 6/9 media: iris: don't specify ubwc_swizzle in the source code
In reply to Dmitry BaryshkovThe UBWC swizzle is specified both in the Iris driver and in the platform UBWC config. Use the platform UBWC configuration instead of specifying it directly in the source.
--- drivers/media/platform/qcom/iris/iris_hfi_gen2_packet.c | 6 +++--- drivers/media/platform/qcom/iris/iris_platform_common.h | 3 --- drivers/media/platform/qcom/iris/iris_platform_gen2.c | 3 --- 3 files changed, 3 insertions(+), 9 deletions(-)
drivers/media/platform/qcom/iris/iris_hfi_gen2_packet.c +3 -3
@@ -170,7 +170,7 @@ void iris_hfi_gen2_packet_sys_init(struct iris_core *core, struct iris_hfi_heade &payload, sizeof(u32)); - payload = core->iris_platform_data->ubwc_config->bank_swzl_level; + payload = !!(qcom_ubwc_swizzle (ubwc) &UBWC_SWIZZLE_ENABLE_LVL1 ); iris_hfi_gen2_create_packet(hdr, HFI_PROP_UBWC_BANK_SWZL_LEVEL1, HFI_HOST_FLAGS_NONE,
@@ -180,7 +180,7 @@ void iris_hfi_gen2_packet_sys_init(struct iris_core *core, struct iris_hfi_heade &payload, sizeof(u32)); - payload = core->iris_platform_data->ubwc_config->bank_swz2_level; + payload = !!(qcom_ubwc_swizzle (ubwc) &UBWC_SWIZZLE_ENABLE_LVL2 ); iris_hfi_gen2_create_packet(hdr, HFI_PROP_UBWC_BANK_SWZL_LEVEL2, HFI_HOST_FLAGS_NONE,
@@ -190,7 +190,7 @@ void iris_hfi_gen2_packet_sys_init(struct iris_core *core, struct iris_hfi_heade &payload, sizeof(u32)); - payload = core->iris_platform_data->ubwc_config->bank_swz3_level; + payload = !!(qcom_ubwc_swizzle (ubwc) &UBWC_SWIZZLE_ENABLE_LVL3 ); iris_hfi_gen2_create_packet(hdr, HFI_PROP_UBWC_BANK_SWZL_LEVEL3, HFI_HOST_FLAGS_NONE,
drivers/media/platform/qcom/iris/iris_platform_common.h +0 -3
@@ -77,9 +77,6 @@ struct tz_cp_config {struct ubwc_config_data {u32 max_channels; -u32 bank_swzl_level; -u32 bank_swz2_level; -u32 bank_swz3_level;u32 bank_spreading; };
drivers/media/platform/qcom/iris/iris_platform_gen2.c +0 -3
@@ -792,9 +792,6 @@ static const char * const sm8550_opp_clk_table[] = {static struct ubwc_config_data ubwc_config_sm8550 = { .max_channels =8 , - .bank_swzl_level =0 , - .bank_swz2_level =1 , - .bank_swz3_level =1 , .bank_spreading =1 , };
Signature · 1 line
2.47.3
PATCH v4 7/9 media: iris: don't specify bank_spreading in the source code
In reply to Dmitry BaryshkovThe UBWC bank spreading is specified both in the Iris driver and in the platform UBWC config. Use the platform UBWC configuration instead of specifying it directly in the source.
--- drivers/media/platform/qcom/iris/iris_hfi_gen2_packet.c | 2 +- drivers/media/platform/qcom/iris/iris_platform_common.h | 1 - drivers/media/platform/qcom/iris/iris_platform_gen2.c | 1 - 3 files changed, 1 insertion(+), 3 deletions(-)
drivers/media/platform/qcom/iris/iris_hfi_gen2_packet.c +1 -1
@@ -200,7 +200,7 @@ void iris_hfi_gen2_packet_sys_init(struct iris_core *core, struct iris_hfi_heade &payload, sizeof(u32)); - payload = core->iris_platform_data->ubwc_config->bank_spreading; + payload =qcom_ubwc_bank_spread (ubwc); iris_hfi_gen2_create_packet(hdr, HFI_PROP_UBWC_BANK_SPREADING, HFI_HOST_FLAGS_NONE,
drivers/media/platform/qcom/iris/iris_platform_common.h +0 -1
@@ -77,7 +77,6 @@ struct tz_cp_config {struct ubwc_config_data {u32 max_channels; -u32 bank_spreading; };struct platform_inst_caps {
drivers/media/platform/qcom/iris/iris_platform_gen2.c +0 -1
@@ -792,7 +792,6 @@ static const char * const sm8550_opp_clk_table[] = {static struct ubwc_config_data ubwc_config_sm8550 = { .max_channels =8 , - .bank_spreading =1 , };static const struct tz_cp_config tz_cp_config_sm8550[] = {
Signature · 1 line
2.47.3
PATCH v4 8/9 media: iris: don't specify max_channels in the source code
In reply to Dmitry BaryshkovThe UBWC max_channels spreading is specified in the Iris driver, but it also can be calculated from the platform UBWC config. Use the platform UBWC configuration instead of specifying it directly in the source.
--- drivers/media/platform/qcom/iris/iris_hfi_gen2_packet.c | 2 +- drivers/media/platform/qcom/iris/iris_platform_common.h | 1 - drivers/media/platform/qcom/iris/iris_platform_gen2.c | 1 - 3 files changed, 1 insertion(+), 3 deletions(-)
drivers/media/platform/qcom/iris/iris_hfi_gen2_packet.c +1 -1
@@ -140,7 +140,7 @@ void iris_hfi_gen2_packet_sys_init(struct iris_core *core, struct iris_hfi_heade &payload, sizeof(u32)); - payload = core->iris_platform_data->ubwc_config->max_channels; + payload =qcom_ubwc_macrotile_mode (ubwc) ?8 :4 ; iris_hfi_gen2_create_packet(hdr, HFI_PROP_UBWC_MAX_CHANNELS, HFI_HOST_FLAGS_NONE,
drivers/media/platform/qcom/iris/iris_platform_common.h +0 -1
@@ -76,7 +76,6 @@ struct tz_cp_config { };struct ubwc_config_data { -u32 max_channels; };struct platform_inst_caps {
drivers/media/platform/qcom/iris/iris_platform_gen2.c +0 -1
@@ -791,7 +791,6 @@ static const char * const sm8550_opp_clk_table[] = { };static struct ubwc_config_data ubwc_config_sm8550 = { - .max_channels =8 , };static const struct tz_cp_config tz_cp_config_sm8550[] = {
Signature · 1 line
2.47.3
PATCH v4 9/9 media: iris: drop remnants of UBWC configuration
In reply to Dmitry BaryshkovNow as all UBWC configuration bits were migrated to be used or derived from the global UBWC platform-specific data, drop the unused struct and field definitions.
--- drivers/media/platform/qcom/iris/iris_platform_common.h | 4 ---- drivers/media/platform/qcom/iris/iris_platform_gen2.c | 7 ------- 2 files changed, 11 deletions(-)
drivers/media/platform/qcom/iris/iris_platform_common.h +0 -4
@@ -75,9 +75,6 @@ struct tz_cp_config {u32 cp_nonpixel_size; }; -struct ubwc_config_data { -}; -struct platform_inst_caps {u32 min_frame_width;u32 max_frame_width;
@@ -241,7 +238,6 @@ struct iris_platform_data {u32 tz_cp_config_data_size;u32 core_arch;u32 hw_response_timeout; -struct ubwc_config_data *ubwc_config;u32 num_vpp_pipe;bool no_aon;u32 max_session_count;
drivers/media/platform/qcom/iris/iris_platform_gen2.c +0 -7
@@ -790,9 +790,6 @@ static const char * const sm8550_opp_clk_table[] = { NULL, }; -static struct ubwc_config_data ubwc_config_sm8550 = { -}; -static const struct tz_cp_config tz_cp_config_sm8550[] = { { .cp_start =0 ,
@@ -949,7 +946,6 @@ const struct iris_platform_data sm8550_data = { .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_sm8550), .core_arch = VIDEO_ARCH_LX, .hw_response_timeout = HW_RESPONSE_TIMEOUT_VALUE, - .ubwc_config = &ubwc_config_sm8550, .num_vpp_pipe = 4, .max_session_count = 16, .max_core_mbpf = NUM_MBS_8K * 2,
@@ -1054,7 +1050,6 @@ const struct iris_platform_data sm8650_data = { .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_sm8550), .core_arch = VIDEO_ARCH_LX, .hw_response_timeout = HW_RESPONSE_TIMEOUT_VALUE, - .ubwc_config = &ubwc_config_sm8550, .num_vpp_pipe = 4, .max_session_count = 16, .max_core_mbpf = NUM_MBS_8K * 2,
@@ -1150,7 +1145,6 @@ const struct iris_platform_data sm8750_data = { .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_sm8550), .core_arch = VIDEO_ARCH_LX, .hw_response_timeout = HW_RESPONSE_TIMEOUT_VALUE, - .ubwc_config = &ubwc_config_sm8550, .num_vpp_pipe = 4, .max_session_count = 16, .max_core_mbpf = NUM_MBS_8K * 2,
@@ -1250,7 +1244,6 @@ const struct iris_platform_data qcs8300_data = { .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_sm8550), .core_arch = VIDEO_ARCH_LX, .hw_response_timeout = HW_RESPONSE_TIMEOUT_VALUE, - .ubwc_config = &ubwc_config_sm8550, .num_vpp_pipe = 2, .max_session_count = 16, .max_core_mbpf = ((4096 * 2176) / 256) * 4,
Signature · 1 line
2.47.3
Re: (subset) [PATCH v4 0/9] media: iris: migrate to using global UBWC config
In reply to Dmitry BaryshkovQuoted 11 lines · Dmitry Baryshkov
Having UBWC configuration in the driver is error prone. For example, the driver specifies fixed values for HBB, while the actual value might depend on the DDR type. Stop defining UBWC data in the iris driver and use the global UBWC configuration registry.
Merge strategy: either merge SoC bits directly through the media tree (with Bjorn's ack) or merge to the media tree through the immutable tag. The drm patches will follow depending on the way the SoC patches are merged.
[...]
Applied, thanks!
[1/9] soc: qcom: ubwc: add helper to get min_acc length
commit: 68a66a44af6e196ca426d1250104d3018ed9e74b
[2/9] soc: qcom: ubwc: add helpers to get programmable values
commit: b2571ef8d4ec9bb636889a9132090bcc3449792eBest regards,
Signature · 1 line
Bjorn Andersson <[email protected]>
Re: (subset) [PATCH v4 0/9] media: iris: migrate to using global UBWC config
Quoted 12 lines · Bjorn Andersson
Quoted 10 lines · Dmitry Baryshkov
Having UBWC configuration in the driver is error prone. For example, the driver specifies fixed values for HBB, while the actual value might depend on the DDR type. Stop defining UBWC data in the iris driver and use the global UBWC configuration registry.
Merge strategy: either merge SoC bits directly through the media tree (with Bjorn's ack) or merge to the media tree through the immutable tag. The drm patches will follow depending on the way the SoC patches are merged.
Quoted 8 lines
Quoted 1 line
[...]
Applied, thanks!
[1/9] soc: qcom: ubwc: add helper to get
min_acclengthcommit: 68a66a44af6e196ca426d1250104d3018ed9e74b [2/9] soc: qcom: ubwc: add helpers to get programmable values commit: b2571ef8d4ec9bb636889a9132090bcc3449792e
Is there an immutable tag, in case iris maintainers decide to pick the rest of the series?
Quoted 4 lines
Best regards,
Signature · 1 line
Bjorn Andersson <[email protected]>
Signature · 2 lines
With best wishes Dmitry