* [PATCH 0/3] drm/msm/dpu: Initialize SSPP scaler version (from register read)
@ 2023-02-15 23:02 Marijn Suijten
2023-02-15 23:02 ` [PATCH 1/3] drm/msm/dpu: Read previously-uninitialized SSPP scaler version from hw Marijn Suijten
` (3 more replies)
0 siblings, 4 replies; 13+ messages in thread
From: Marijn Suijten @ 2023-02-15 23:02 UTC (permalink / raw)
To: Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul,
David Airlie, Daniel Vetter, Archit Taneja, Chandan Uddaraju,
Sravanthi Kollukuduru
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel,
~postmarketos/upstreaming, AngeloGioacchino Del Regno,
Konrad Dybcio, Martin Botka, Jami Kettunen, phone-devel,
Marijn Suijten
Random inspection of the SSPP code surfaced that the version field of
dpu_scaler_blk was never assigned in the catalog, resulting in wrong
codepaths to be taken within dpu_hw_setup_scaler3 based on a 0 version.
Rectify this by reading an accurate value from a register (that is not
equal to the values represented by DPU_SSPP_SCALER_QSEEDx enum
variants) and deleting dead code around QSEED versioning.
Future changes should likely get rid of the distinction between QSEED3
and up, as these are now purely determined from the register value.
Furthermore implementations could look at the scaler subblk .id field
rather than the SSPP feature bits, which currently hold redundant
information.
---
Marijn Suijten (3):
drm/msm/dpu: Read previously-uninitialized SSPP scaler version from hw
drm/msm/dpu: Drop unused get_scaler_ver callback from SSPP
drm/msm/dpu: Drop unused qseed_type from catalog dpu_caps
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 12 ------------
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 4 ----
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 12 ++++++++----
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 9 +++------
4 files changed, 11 insertions(+), 26 deletions(-)
---
base-commit: 9d9019bcea1aac7eed64a1a4966282b6b7b141c8
change-id: 20230215-sspp-scaler-version-19f221585c5e
Best regards,
--
Marijn Suijten <marijn.suijten@somainline.org>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/3] drm/msm/dpu: Read previously-uninitialized SSPP scaler version from hw
2023-02-15 23:02 [PATCH 0/3] drm/msm/dpu: Initialize SSPP scaler version (from register read) Marijn Suijten
@ 2023-02-15 23:02 ` Marijn Suijten
2023-02-16 2:22 ` Dmitry Baryshkov
2023-02-15 23:02 ` [PATCH 2/3] drm/msm/dpu: Drop unused get_scaler_ver callback from SSPP Marijn Suijten
` (2 subsequent siblings)
3 siblings, 1 reply; 13+ messages in thread
From: Marijn Suijten @ 2023-02-15 23:02 UTC (permalink / raw)
To: Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul,
David Airlie, Daniel Vetter, Archit Taneja, Chandan Uddaraju,
Sravanthi Kollukuduru
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel,
~postmarketos/upstreaming, AngeloGioacchino Del Regno,
Konrad Dybcio, Martin Botka, Jami Kettunen, phone-devel,
Marijn Suijten
DPU's catalog never assigned dpu_scaler_blk::version leading to
initialization code in dpu_hw_setup_scaler3 to wander the wrong
codepaths. Instead of hardcoding the correct QSEED algorithm version,
read it back from a hardware register.
Note that this register is only available starting with QSEED3, where
0x1002 corresponds to QSEED3, 0x2004 to QSEED3LITE and 0x3000 to QSEED4.
Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 2 --
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 8 +++++++-
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 3 +++
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
index ddab9caebb18..96ce1766f4a1 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
@@ -324,11 +324,9 @@ struct dpu_src_blk {
/**
* struct dpu_scaler_blk: Scaler information
* @info: HW register and features supported by this sub-blk
- * @version: qseed block revision
*/
struct dpu_scaler_blk {
DPU_HW_SUBBLK_INFO;
- u32 version;
};
struct dpu_csc_blk {
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 4246ab0b3bee..d4e181e1378c 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
@@ -430,7 +430,7 @@ static void _dpu_hw_sspp_setup_scaler3(struct dpu_hw_pipe *ctx,
return;
dpu_hw_setup_scaler3(&ctx->hw, scaler3_cfg, idx,
- ctx->cap->sblk->scaler_blk.version,
+ ctx->version,
sspp->layout.format);
}
@@ -807,6 +807,12 @@ struct dpu_hw_pipe *dpu_hw_sspp_init(enum dpu_sspp idx,
hw_pipe->mdp = &catalog->mdp[0];
hw_pipe->idx = idx;
hw_pipe->cap = cfg;
+
+ if (test_bit(DPU_SSPP_SCALER_QSEED3, &cfg->features) ||
+ test_bit(DPU_SSPP_SCALER_QSEED3LITE, &cfg->features) ||
+ test_bit(DPU_SSPP_SCALER_QSEED4, &cfg->features))
+ hw_pipe->version = _dpu_hw_sspp_get_scaler3_ver(hw_pipe);
+
_setup_layer_ops(hw_pipe, hw_pipe->cap->features);
return 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 0c95b7e64f6c..eeaf16c6af15 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
@@ -352,6 +352,7 @@ struct dpu_hw_sspp_ops {
* @hw: block hardware details
* @catalog: back pointer to catalog
* @mdp: pointer to associated mdp portion of the catalog
+ * @version: qseed block revision
* @idx: pipe index
* @cap: pointer to layer_cfg
* @ops: pointer to operations possible for this pipe
@@ -362,6 +363,8 @@ struct dpu_hw_pipe {
const struct dpu_mdss_cfg *catalog;
const struct dpu_mdp_cfg *mdp;
+ u32 version;
+
/* Pipe */
enum dpu_sspp idx;
const struct dpu_sspp_cfg *cap;
--
2.39.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/3] drm/msm/dpu: Drop unused get_scaler_ver callback from SSPP
2023-02-15 23:02 [PATCH 0/3] drm/msm/dpu: Initialize SSPP scaler version (from register read) Marijn Suijten
2023-02-15 23:02 ` [PATCH 1/3] drm/msm/dpu: Read previously-uninitialized SSPP scaler version from hw Marijn Suijten
@ 2023-02-15 23:02 ` Marijn Suijten
2023-02-16 2:23 ` Dmitry Baryshkov
2023-02-15 23:02 ` [PATCH 3/3] drm/msm/dpu: Drop unused qseed_type from catalog dpu_caps Marijn Suijten
2023-02-16 3:02 ` [PATCH 0/3] drm/msm/dpu: Initialize SSPP scaler version (from register read) Dmitry Baryshkov
3 siblings, 1 reply; 13+ messages in thread
From: Marijn Suijten @ 2023-02-15 23:02 UTC (permalink / raw)
To: Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul,
David Airlie, Daniel Vetter, Archit Taneja, Chandan Uddaraju,
Sravanthi Kollukuduru
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel,
~postmarketos/upstreaming, AngeloGioacchino Del Regno,
Konrad Dybcio, Martin Botka, Jami Kettunen, phone-devel,
Marijn Suijten
This pointer callback is never used and should be removed. The helper
_dpu_hw_sspp_get_scaler3_ver function is retained as it is being used by
dpu_hw_sspp_init which didn't itself compute _sspp_subblk_offset yet.
Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 4 +---
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 6 ------
2 files changed, 1 insertion(+), 9 deletions(-)
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 d4e181e1378c..00e5dc2318db 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
@@ -689,10 +689,8 @@ static void _setup_layer_ops(struct dpu_hw_pipe *c,
if (test_bit(DPU_SSPP_SCALER_QSEED3, &features) ||
test_bit(DPU_SSPP_SCALER_QSEED3LITE, &features) ||
- test_bit(DPU_SSPP_SCALER_QSEED4, &features)) {
+ test_bit(DPU_SSPP_SCALER_QSEED4, &features))
c->ops.setup_scaler = _dpu_hw_sspp_setup_scaler3;
- c->ops.get_scaler_ver = _dpu_hw_sspp_get_scaler3_ver;
- }
if (test_bit(DPU_SSPP_CDP, &features))
c->ops.setup_cdp = dpu_hw_sspp_setup_cdp;
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 eeaf16c6af15..bebb62c09dd8 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
@@ -329,12 +329,6 @@ struct dpu_hw_sspp_ops {
struct dpu_hw_pipe_cfg *pipe_cfg,
void *scaler_cfg);
- /**
- * get_scaler_ver - get scaler h/w version
- * @ctx: Pointer to pipe context
- */
- u32 (*get_scaler_ver)(struct dpu_hw_pipe *ctx);
-
/**
* setup_cdp - setup client driven prefetch
* @ctx: Pointer to pipe context
--
2.39.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 3/3] drm/msm/dpu: Drop unused qseed_type from catalog dpu_caps
2023-02-15 23:02 [PATCH 0/3] drm/msm/dpu: Initialize SSPP scaler version (from register read) Marijn Suijten
2023-02-15 23:02 ` [PATCH 1/3] drm/msm/dpu: Read previously-uninitialized SSPP scaler version from hw Marijn Suijten
2023-02-15 23:02 ` [PATCH 2/3] drm/msm/dpu: Drop unused get_scaler_ver callback from SSPP Marijn Suijten
@ 2023-02-15 23:02 ` Marijn Suijten
2023-02-16 2:57 ` Dmitry Baryshkov
2023-02-16 3:02 ` [PATCH 0/3] drm/msm/dpu: Initialize SSPP scaler version (from register read) Dmitry Baryshkov
3 siblings, 1 reply; 13+ messages in thread
From: Marijn Suijten @ 2023-02-15 23:02 UTC (permalink / raw)
To: Rob Clark, Abhinav Kumar, Dmitry Baryshkov, Sean Paul,
David Airlie, Daniel Vetter, Archit Taneja, Chandan Uddaraju,
Sravanthi Kollukuduru
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel,
~postmarketos/upstreaming, AngeloGioacchino Del Regno,
Konrad Dybcio, Martin Botka, Jami Kettunen, phone-devel,
Marijn Suijten
The SSPP scaler subblk is responsible for reporting its version (via the
.id field, feature bits on the parent SSPP block, and since recently
also from reading a register to supersede a read-but-unset version field
in the catalog), leaving this global qseed_type field logically unused.
Remove this dead code to lighten the catalog and bringup-overhead.
Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 12 ------------
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 2 --
2 files changed, 14 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
index cf053e8f081e..bd57a4cce4a9 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
@@ -300,7 +300,6 @@ static const uint32_t wb2_formats[] = {
static const struct dpu_caps msm8998_dpu_caps = {
.max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
.max_mixer_blendstages = 0x7,
- .qseed_type = DPU_SSPP_SCALER_QSEED3,
.smart_dma_rev = DPU_SSPP_SMART_DMA_V1,
.ubwc_version = DPU_HW_UBWC_VER_10,
.has_src_split = true,
@@ -327,7 +326,6 @@ static const struct dpu_caps qcm2290_dpu_caps = {
static const struct dpu_caps sdm845_dpu_caps = {
.max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
.max_mixer_blendstages = 0xb,
- .qseed_type = DPU_SSPP_SCALER_QSEED3,
.smart_dma_rev = DPU_SSPP_SMART_DMA_V2,
.ubwc_version = DPU_HW_UBWC_VER_20,
.has_src_split = true,
@@ -343,7 +341,6 @@ static const struct dpu_caps sdm845_dpu_caps = {
static const struct dpu_caps sc7180_dpu_caps = {
.max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
.max_mixer_blendstages = 0x9,
- .qseed_type = DPU_SSPP_SCALER_QSEED4,
.smart_dma_rev = DPU_SSPP_SMART_DMA_V2,
.ubwc_version = DPU_HW_UBWC_VER_20,
.has_dim_layer = true,
@@ -355,7 +352,6 @@ static const struct dpu_caps sc7180_dpu_caps = {
static const struct dpu_caps sm6115_dpu_caps = {
.max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
.max_mixer_blendstages = 0x4,
- .qseed_type = DPU_SSPP_SCALER_QSEED3LITE,
.smart_dma_rev = DPU_SSPP_SMART_DMA_V2, /* TODO: v2.5 */
.ubwc_version = DPU_HW_UBWC_VER_10,
.has_dim_layer = true,
@@ -367,7 +363,6 @@ static const struct dpu_caps sm6115_dpu_caps = {
static const struct dpu_caps sm8150_dpu_caps = {
.max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
.max_mixer_blendstages = 0xb,
- .qseed_type = DPU_SSPP_SCALER_QSEED3,
.smart_dma_rev = DPU_SSPP_SMART_DMA_V2, /* TODO: v2.5 */
.ubwc_version = DPU_HW_UBWC_VER_30,
.has_src_split = true,
@@ -383,7 +378,6 @@ static const struct dpu_caps sm8150_dpu_caps = {
static const struct dpu_caps sc8180x_dpu_caps = {
.max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
.max_mixer_blendstages = 0xb,
- .qseed_type = DPU_SSPP_SCALER_QSEED3,
.smart_dma_rev = DPU_SSPP_SMART_DMA_V2, /* TODO: v2.5 */
.ubwc_version = DPU_HW_UBWC_VER_30,
.has_src_split = true,
@@ -399,7 +393,6 @@ static const struct dpu_caps sc8180x_dpu_caps = {
static const struct dpu_caps sc8280xp_dpu_caps = {
.max_mixer_width = 2560,
.max_mixer_blendstages = 11,
- .qseed_type = DPU_SSPP_SCALER_QSEED3LITE,
.smart_dma_rev = DPU_SSPP_SMART_DMA_V2, /* TODO: v2.5 */
.ubwc_version = DPU_HW_UBWC_VER_40,
.has_src_split = true,
@@ -413,7 +406,6 @@ static const struct dpu_caps sc8280xp_dpu_caps = {
static const struct dpu_caps sm8250_dpu_caps = {
.max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
.max_mixer_blendstages = 0xb,
- .qseed_type = DPU_SSPP_SCALER_QSEED3LITE,
.smart_dma_rev = DPU_SSPP_SMART_DMA_V2, /* TODO: v2.5 */
.ubwc_version = DPU_HW_UBWC_VER_40,
.has_src_split = true,
@@ -427,7 +419,6 @@ static const struct dpu_caps sm8250_dpu_caps = {
static const struct dpu_caps sm8350_dpu_caps = {
.max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
.max_mixer_blendstages = 0xb,
- .qseed_type = DPU_SSPP_SCALER_QSEED3LITE,
.smart_dma_rev = DPU_SSPP_SMART_DMA_V2, /* TODO: v2.5 */
.ubwc_version = DPU_HW_UBWC_VER_40,
.has_src_split = true,
@@ -441,7 +432,6 @@ static const struct dpu_caps sm8350_dpu_caps = {
static const struct dpu_caps sm8450_dpu_caps = {
.max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
.max_mixer_blendstages = 0xb,
- .qseed_type = DPU_SSPP_SCALER_QSEED4,
.smart_dma_rev = DPU_SSPP_SMART_DMA_V2, /* TODO: v2.5 */
.ubwc_version = DPU_HW_UBWC_VER_40,
.has_src_split = true,
@@ -455,7 +445,6 @@ static const struct dpu_caps sm8450_dpu_caps = {
static const struct dpu_caps sm8550_dpu_caps = {
.max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
.max_mixer_blendstages = 0xb,
- .qseed_type = DPU_SSPP_SCALER_QSEED3LITE,
.smart_dma_rev = DPU_SSPP_SMART_DMA_V2, /* TODO: v2.5 */
.ubwc_version = DPU_HW_UBWC_VER_40,
.has_src_split = true,
@@ -469,7 +458,6 @@ static const struct dpu_caps sm8550_dpu_caps = {
static const struct dpu_caps sc7280_dpu_caps = {
.max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
.max_mixer_blendstages = 0x7,
- .qseed_type = DPU_SSPP_SCALER_QSEED4,
.smart_dma_rev = DPU_SSPP_SMART_DMA_V2,
.ubwc_version = DPU_HW_UBWC_VER_30,
.has_dim_layer = true,
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
index 96ce1766f4a1..0f0332d4c5e3 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
@@ -390,7 +390,6 @@ struct dpu_rotation_cfg {
* @max_mixer_width max layer mixer line width support.
* @max_mixer_blendstages max layer mixer blend stages or
* supported z order
- * @qseed_type qseed2 or qseed3 support.
* @smart_dma_rev Supported version of SmartDMA feature.
* @ubwc_version UBWC feature version (0x0 for not supported)
* @has_src_split source split feature status
@@ -405,7 +404,6 @@ struct dpu_rotation_cfg {
struct dpu_caps {
u32 max_mixer_width;
u32 max_mixer_blendstages;
- u32 qseed_type;
u32 smart_dma_rev;
u32 ubwc_version;
bool has_src_split;
--
2.39.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] drm/msm/dpu: Read previously-uninitialized SSPP scaler version from hw
2023-02-15 23:02 ` [PATCH 1/3] drm/msm/dpu: Read previously-uninitialized SSPP scaler version from hw Marijn Suijten
@ 2023-02-16 2:22 ` Dmitry Baryshkov
2023-02-16 8:31 ` Marijn Suijten
0 siblings, 1 reply; 13+ messages in thread
From: Dmitry Baryshkov @ 2023-02-16 2:22 UTC (permalink / raw)
To: Marijn Suijten
Cc: Rob Clark, Abhinav Kumar, Sean Paul, David Airlie, Daniel Vetter,
Archit Taneja, Chandan Uddaraju, Sravanthi Kollukuduru,
linux-arm-msm, dri-devel, freedreno, linux-kernel,
~postmarketos/upstreaming, AngeloGioacchino Del Regno,
Konrad Dybcio, Martin Botka, Jami Kettunen, phone-devel
On Thu, 16 Feb 2023 at 01:02, Marijn Suijten
<marijn.suijten@somainline.org> wrote:
>
> DPU's catalog never assigned dpu_scaler_blk::version leading to
> initialization code in dpu_hw_setup_scaler3 to wander the wrong
> codepaths. Instead of hardcoding the correct QSEED algorithm version,
> read it back from a hardware register.
>
> Note that this register is only available starting with QSEED3, where
> 0x1002 corresponds to QSEED3, 0x2004 to QSEED3LITE and 0x3000 to QSEED4.
This is not purely accurate. 0x1003 (sdm845) also corresponds to QSEED3.
I'd say instead that there are several variations of QSEED3 scalers,
where starting from 0x2004 it is called QSEED3LITE and starting from
0x3000 it is called QSEED4.
>
> Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 2 --
> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 8 +++++++-
> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 3 +++
> 3 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
> index ddab9caebb18..96ce1766f4a1 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
> @@ -324,11 +324,9 @@ struct dpu_src_blk {
> /**
> * struct dpu_scaler_blk: Scaler information
> * @info: HW register and features supported by this sub-blk
> - * @version: qseed block revision
> */
> struct dpu_scaler_blk {
> DPU_HW_SUBBLK_INFO;
> - u32 version;
No. Please keep the version in the scaler subblk. It is a version of
the QSEED (scaler block), not the SSPP's version.
There is a block called DS (destination scaler), which can be used to
scale the resulting image after the LM. This block also uses the
QSEED3(,LITE,4) scaler block.
> };
>
> struct dpu_csc_blk {
> 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 4246ab0b3bee..d4e181e1378c 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
> @@ -430,7 +430,7 @@ static void _dpu_hw_sspp_setup_scaler3(struct dpu_hw_pipe *ctx,
> return;
>
> dpu_hw_setup_scaler3(&ctx->hw, scaler3_cfg, idx,
> - ctx->cap->sblk->scaler_blk.version,
> + ctx->version,
> sspp->layout.format);
> }
>
> @@ -807,6 +807,12 @@ struct dpu_hw_pipe *dpu_hw_sspp_init(enum dpu_sspp idx,
> hw_pipe->mdp = &catalog->mdp[0];
> hw_pipe->idx = idx;
> hw_pipe->cap = cfg;
> +
> + if (test_bit(DPU_SSPP_SCALER_QSEED3, &cfg->features) ||
> + test_bit(DPU_SSPP_SCALER_QSEED3LITE, &cfg->features) ||
> + test_bit(DPU_SSPP_SCALER_QSEED4, &cfg->features))
> + hw_pipe->version = _dpu_hw_sspp_get_scaler3_ver(hw_pipe);
> +
> _setup_layer_ops(hw_pipe, hw_pipe->cap->features);
>
> return 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 0c95b7e64f6c..eeaf16c6af15 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
> @@ -352,6 +352,7 @@ struct dpu_hw_sspp_ops {
> * @hw: block hardware details
> * @catalog: back pointer to catalog
> * @mdp: pointer to associated mdp portion of the catalog
> + * @version: qseed block revision
> * @idx: pipe index
> * @cap: pointer to layer_cfg
> * @ops: pointer to operations possible for this pipe
> @@ -362,6 +363,8 @@ struct dpu_hw_pipe {
> const struct dpu_mdss_cfg *catalog;
> const struct dpu_mdp_cfg *mdp;
>
> + u32 version;
> +
> /* Pipe */
> enum dpu_sspp idx;
> const struct dpu_sspp_cfg *cap;
>
> --
> 2.39.2
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/3] drm/msm/dpu: Drop unused get_scaler_ver callback from SSPP
2023-02-15 23:02 ` [PATCH 2/3] drm/msm/dpu: Drop unused get_scaler_ver callback from SSPP Marijn Suijten
@ 2023-02-16 2:23 ` Dmitry Baryshkov
0 siblings, 0 replies; 13+ messages in thread
From: Dmitry Baryshkov @ 2023-02-16 2:23 UTC (permalink / raw)
To: Marijn Suijten
Cc: Rob Clark, Abhinav Kumar, Sean Paul, David Airlie, Daniel Vetter,
Archit Taneja, Chandan Uddaraju, Sravanthi Kollukuduru,
linux-arm-msm, dri-devel, freedreno, linux-kernel,
~postmarketos/upstreaming, AngeloGioacchino Del Regno,
Konrad Dybcio, Martin Botka, Jami Kettunen, phone-devel
On Thu, 16 Feb 2023 at 01:02, Marijn Suijten
<marijn.suijten@somainline.org> wrote:
>
> This pointer callback is never used and should be removed. The helper
> _dpu_hw_sspp_get_scaler3_ver function is retained as it is being used by
> dpu_hw_sspp_init which didn't itself compute _sspp_subblk_offset yet.
>
> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 4 +---
> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 6 ------
> 2 files changed, 1 insertion(+), 9 deletions(-)
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/3] drm/msm/dpu: Drop unused qseed_type from catalog dpu_caps
2023-02-15 23:02 ` [PATCH 3/3] drm/msm/dpu: Drop unused qseed_type from catalog dpu_caps Marijn Suijten
@ 2023-02-16 2:57 ` Dmitry Baryshkov
0 siblings, 0 replies; 13+ messages in thread
From: Dmitry Baryshkov @ 2023-02-16 2:57 UTC (permalink / raw)
To: Marijn Suijten
Cc: Rob Clark, Abhinav Kumar, Sean Paul, David Airlie, Daniel Vetter,
Archit Taneja, Chandan Uddaraju, Sravanthi Kollukuduru,
linux-arm-msm, dri-devel, freedreno, linux-kernel,
~postmarketos/upstreaming, AngeloGioacchino Del Regno,
Konrad Dybcio, Martin Botka, Jami Kettunen, phone-devel
On Thu, 16 Feb 2023 at 01:02, Marijn Suijten
<marijn.suijten@somainline.org> wrote:
>
> The SSPP scaler subblk is responsible for reporting its version (via the
> .id field, feature bits on the parent SSPP block, and since recently
> also from reading a register to supersede a read-but-unset version field
> in the catalog), leaving this global qseed_type field logically unused.
> Remove this dead code to lighten the catalog and bringup-overhead.
>
> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 12 ------------
> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 2 --
> 2 files changed, 14 deletions(-)
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/3] drm/msm/dpu: Initialize SSPP scaler version (from register read)
2023-02-15 23:02 [PATCH 0/3] drm/msm/dpu: Initialize SSPP scaler version (from register read) Marijn Suijten
` (2 preceding siblings ...)
2023-02-15 23:02 ` [PATCH 3/3] drm/msm/dpu: Drop unused qseed_type from catalog dpu_caps Marijn Suijten
@ 2023-02-16 3:02 ` Dmitry Baryshkov
2023-02-16 9:04 ` Marijn Suijten
3 siblings, 1 reply; 13+ messages in thread
From: Dmitry Baryshkov @ 2023-02-16 3:02 UTC (permalink / raw)
To: Marijn Suijten
Cc: Rob Clark, Abhinav Kumar, Sean Paul, David Airlie, Daniel Vetter,
Archit Taneja, Chandan Uddaraju, Sravanthi Kollukuduru,
linux-arm-msm, dri-devel, freedreno, linux-kernel,
~postmarketos/upstreaming, AngeloGioacchino Del Regno,
Konrad Dybcio, Martin Botka, Jami Kettunen, phone-devel
On Thu, 16 Feb 2023 at 01:02, Marijn Suijten
<marijn.suijten@somainline.org> wrote:
>
> Random inspection of the SSPP code surfaced that the version field of
> dpu_scaler_blk was never assigned in the catalog, resulting in wrong
> codepaths to be taken within dpu_hw_setup_scaler3 based on a 0 version.
> Rectify this by reading an accurate value from a register (that is not
> equal to the values represented by DPU_SSPP_SCALER_QSEEDx enum
> variants) and deleting dead code around QSEED versioning.
>
> Future changes should likely get rid of the distinction between QSEED3
> and up, as these are now purely determined from the register value.
> Furthermore implementations could look at the scaler subblk .id field
> rather than the SSPP feature bits, which currently hold redundant
> information.
>
> ---
> Marijn Suijten (3):
> drm/msm/dpu: Read previously-uninitialized SSPP scaler version from hw
> drm/msm/dpu: Drop unused get_scaler_ver callback from SSPP
> drm/msm/dpu: Drop unused qseed_type from catalog dpu_caps
The cleanup looks good. However as you are on it, maybe you can also
add patch 4, dropping DPU_SSPP_SCALER_QSEED3LITE and
DPU_SSPP_SCALER_QSEED4 in favour of using QSEED3 for all these
scalers? As we are going to use scaler_version to distinguish between
them, it would be logical not to duplicate that bit of information
(not to mention all the possible troubles if scaler_version disagrees
with the sblk->scaler_blk.id).
>
> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 12 ------------
> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 4 ----
> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 12 ++++++++----
> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 9 +++------
> 4 files changed, 11 insertions(+), 26 deletions(-)
> ---
> base-commit: 9d9019bcea1aac7eed64a1a4966282b6b7b141c8
> change-id: 20230215-sspp-scaler-version-19f221585c5e
>
> Best regards,
> --
> Marijn Suijten <marijn.suijten@somainline.org>
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] drm/msm/dpu: Read previously-uninitialized SSPP scaler version from hw
2023-02-16 2:22 ` Dmitry Baryshkov
@ 2023-02-16 8:31 ` Marijn Suijten
2023-02-16 16:34 ` Dmitry Baryshkov
0 siblings, 1 reply; 13+ messages in thread
From: Marijn Suijten @ 2023-02-16 8:31 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Rob Clark, Abhinav Kumar, Sean Paul, David Airlie, Daniel Vetter,
Archit Taneja, Chandan Uddaraju, Sravanthi Kollukuduru,
linux-arm-msm, dri-devel, freedreno, linux-kernel,
~postmarketos/upstreaming, AngeloGioacchino Del Regno,
Konrad Dybcio, Martin Botka, Jami Kettunen, phone-devel
On 2023-02-16 04:22:13, Dmitry Baryshkov wrote:
> On Thu, 16 Feb 2023 at 01:02, Marijn Suijten
> <marijn.suijten@somainline.org> wrote:
> >
> > DPU's catalog never assigned dpu_scaler_blk::version leading to
> > initialization code in dpu_hw_setup_scaler3 to wander the wrong
> > codepaths. Instead of hardcoding the correct QSEED algorithm version,
> > read it back from a hardware register.
> >
> > Note that this register is only available starting with QSEED3, where
> > 0x1002 corresponds to QSEED3, 0x2004 to QSEED3LITE and 0x3000 to QSEED4.
>
> This is not purely accurate. 0x1003 (sdm845) also corresponds to QSEED3.
> I'd say instead that there are several variations of QSEED3 scalers,
> where starting from 0x2004 it is called QSEED3LITE and starting from
> 0x3000 it is called QSEED4.
Good catch, I'll update that.
> > Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
> > Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
> > ---
> > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 2 --
> > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 8 +++++++-
> > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 3 +++
> > 3 files changed, 10 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
> > index ddab9caebb18..96ce1766f4a1 100644
> > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
> > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
> > @@ -324,11 +324,9 @@ struct dpu_src_blk {
> > /**
> > * struct dpu_scaler_blk: Scaler information
> > * @info: HW register and features supported by this sub-blk
> > - * @version: qseed block revision
> > */
> > struct dpu_scaler_blk {
> > DPU_HW_SUBBLK_INFO;
> > - u32 version;
>
> No. Please keep the version in the scaler subblk. It is a version of
> the QSEED (scaler block), not the SSPP's version.
You are right that the new variable in the parent (SSPP) block is
nondescriptive and should have been named scaler_version.
However.
dpu_scaler_blk is only used as a const static struct in the catalog,
meaning we cannot (should not!) store a runtime-read register value
here. Instead I followed your IRC suggestion to read the register in
dpu_hw_sspp_init, but my original implementation called
dpu_hw_get_scaler3_ver in _dpu_hw_sspp_setup_scaler3 where we already
have access to the subblk_offset, allowing us to delete
_dpu_hw_sspp_get_scaler3_ver. Would you rather have that? We don't
need the register value anywhere else.
> There is a block called DS (destination scaler), which can be used to
> scale the resulting image after the LM. This block also uses the
> QSEED3(,LITE,4) scaler block.
Is this already supported in mainline, and is it the reason for
previously having qseed_type globally available? Is my understanding
correct that this scaler subblk in the SSPP is merely an interface to
it, allowing the same hardware to be used from the SSPP for intputs and
after the LM for outputs?
<snip>
- Marijn
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/3] drm/msm/dpu: Initialize SSPP scaler version (from register read)
2023-02-16 3:02 ` [PATCH 0/3] drm/msm/dpu: Initialize SSPP scaler version (from register read) Dmitry Baryshkov
@ 2023-02-16 9:04 ` Marijn Suijten
0 siblings, 0 replies; 13+ messages in thread
From: Marijn Suijten @ 2023-02-16 9:04 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Rob Clark, Abhinav Kumar, Sean Paul, David Airlie, Daniel Vetter,
Archit Taneja, Chandan Uddaraju, Sravanthi Kollukuduru,
linux-arm-msm, dri-devel, freedreno, linux-kernel,
~postmarketos/upstreaming, AngeloGioacchino Del Regno,
Konrad Dybcio, Martin Botka, Jami Kettunen, phone-devel
On 2023-02-16 05:02:32, Dmitry Baryshkov wrote:
> On Thu, 16 Feb 2023 at 01:02, Marijn Suijten
> <marijn.suijten@somainline.org> wrote:
> >
> > Random inspection of the SSPP code surfaced that the version field of
> > dpu_scaler_blk was never assigned in the catalog, resulting in wrong
> > codepaths to be taken within dpu_hw_setup_scaler3 based on a 0 version.
> > Rectify this by reading an accurate value from a register (that is not
> > equal to the values represented by DPU_SSPP_SCALER_QSEEDx enum
> > variants) and deleting dead code around QSEED versioning.
> >
> > Future changes should likely get rid of the distinction between QSEED3
> > and up, as these are now purely determined from the register value.
> > Furthermore implementations could look at the scaler subblk .id field
> > rather than the SSPP feature bits, which currently hold redundant
> > information.
> >
> > ---
> > Marijn Suijten (3):
> > drm/msm/dpu: Read previously-uninitialized SSPP scaler version from hw
> > drm/msm/dpu: Drop unused get_scaler_ver callback from SSPP
> > drm/msm/dpu: Drop unused qseed_type from catalog dpu_caps
>
> The cleanup looks good. However as you are on it, maybe you can also
> add patch 4, dropping DPU_SSPP_SCALER_QSEED3LITE and
> DPU_SSPP_SCALER_QSEED4 in favour of using QSEED3 for all these
> scalers?
I surely can! Do you mind if I rename it to QSEED3_AND_UP for clarity?
How about the second question, dropping this redundant information from
the SSPP feature flags and only looking at the scaler_blk.id?
> As we are going to use scaler_version to distinguish between
> them, it would be logical not to duplicate that bit of information
> (not to mention all the possible troubles if scaler_version disagrees
> with the sblk->scaler_blk.id).
Note that we had a similar discussion for UBWC HW decoder version and it
was decided to go the opposite route [1]. That may have been for
technical reasons (unclocked register access), but it's an inconsistent
approach to say the least.
[1]: https://lore.kernel.org/linux-arm-msm/71f96910-e7b1-92f9-ae15-79bd1da40a0d@quicinc.com/
- Marijn
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] drm/msm/dpu: Read previously-uninitialized SSPP scaler version from hw
2023-02-16 8:31 ` Marijn Suijten
@ 2023-02-16 16:34 ` Dmitry Baryshkov
2023-02-16 21:46 ` Marijn Suijten
0 siblings, 1 reply; 13+ messages in thread
From: Dmitry Baryshkov @ 2023-02-16 16:34 UTC (permalink / raw)
To: Marijn Suijten
Cc: Rob Clark, Abhinav Kumar, Sean Paul, David Airlie, Daniel Vetter,
Archit Taneja, Chandan Uddaraju, Sravanthi Kollukuduru,
linux-arm-msm, dri-devel, freedreno, linux-kernel,
~postmarketos/upstreaming, AngeloGioacchino Del Regno,
Konrad Dybcio, Martin Botka, Jami Kettunen, phone-devel
On 16/02/2023 10:31, Marijn Suijten wrote:
> On 2023-02-16 04:22:13, Dmitry Baryshkov wrote:
>> On Thu, 16 Feb 2023 at 01:02, Marijn Suijten
>> <marijn.suijten@somainline.org> wrote:
>>>
>>> DPU's catalog never assigned dpu_scaler_blk::version leading to
>>> initialization code in dpu_hw_setup_scaler3 to wander the wrong
>>> codepaths. Instead of hardcoding the correct QSEED algorithm version,
>>> read it back from a hardware register.
>>>
>>> Note that this register is only available starting with QSEED3, where
>>> 0x1002 corresponds to QSEED3, 0x2004 to QSEED3LITE and 0x3000 to QSEED4.
>>
>> This is not purely accurate. 0x1003 (sdm845) also corresponds to QSEED3.
>> I'd say instead that there are several variations of QSEED3 scalers,
>> where starting from 0x2004 it is called QSEED3LITE and starting from
>> 0x3000 it is called QSEED4.
>
> Good catch, I'll update that.
>
>>> Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
>>> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
>>> ---
>>> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 2 --
>>> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 8 +++++++-
>>> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 3 +++
>>> 3 files changed, 10 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
>>> index ddab9caebb18..96ce1766f4a1 100644
>>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
>>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
>>> @@ -324,11 +324,9 @@ struct dpu_src_blk {
>>> /**
>>> * struct dpu_scaler_blk: Scaler information
>>> * @info: HW register and features supported by this sub-blk
>>> - * @version: qseed block revision
>>> */
>>> struct dpu_scaler_blk {
>>> DPU_HW_SUBBLK_INFO;
>>> - u32 version;
>>
>> No. Please keep the version in the scaler subblk. It is a version of
>> the QSEED (scaler block), not the SSPP's version.
>
> You are right that the new variable in the parent (SSPP) block is
> nondescriptive and should have been named scaler_version.
>
> However.
>
> dpu_scaler_blk is only used as a const static struct in the catalog,
> meaning we cannot (should not!) store a runtime-read register value
> here. Instead I followed your IRC suggestion to read the register in
> dpu_hw_sspp_init, but my original implementation called
> dpu_hw_get_scaler3_ver in _dpu_hw_sspp_setup_scaler3 where we already
> have access to the subblk_offset, allowing us to delete
> _dpu_hw_sspp_get_scaler3_ver. Would you rather have that? We don't
> need the register value anywhere else.
After giving it another thought, let's follow the vendor's approach and
store the predefined scaler_version in hw catalog (in dpu_scaler_blk, as
it currently is). This way we can still drop all QSEED3/3LITE/4
crazyness, while keeping the data sane.
Then _dpu_hw_sspp_get_scaler3_ver() can also be dropped (or you can use
it as a safety guard while doing dpu_hw_sspp init).
>
>> There is a block called DS (destination scaler), which can be used to
>> scale the resulting image after the LM. This block also uses the
>> QSEED3(,LITE,4) scaler block.
>
> Is this already supported in mainline, and is it the reason for
> previously having qseed_type globally available? Is my understanding
> correct that this scaler subblk in the SSPP is merely an interface to
> it, allowing the same hardware to be used from the SSPP for intputs and
> after the LM for outputs?
No, I think qseed_type is a leftover from having the same thing
implemented in three different ways. Maybe because of NIH syndrome?
DS is not supported, it was removed in the commit
b033def8741aab3fb58e4bf6c1d5cd73b3beb357. I do not have a clear usecase
for this block and of course we don't have uABI for it.
It would still be nice to keep it in the picture though. It was the main
reason for moving scaler code from dpu_hw_sspp to dpu_hw_util.
>
> <snip>
>
> - Marijn
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] drm/msm/dpu: Read previously-uninitialized SSPP scaler version from hw
2023-02-16 16:34 ` Dmitry Baryshkov
@ 2023-02-16 21:46 ` Marijn Suijten
2023-02-17 15:00 ` Dmitry Baryshkov
0 siblings, 1 reply; 13+ messages in thread
From: Marijn Suijten @ 2023-02-16 21:46 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Rob Clark, Abhinav Kumar, Sean Paul, David Airlie, Daniel Vetter,
Archit Taneja, Chandan Uddaraju, Sravanthi Kollukuduru,
linux-arm-msm, dri-devel, freedreno, linux-kernel,
~postmarketos/upstreaming, AngeloGioacchino Del Regno,
Konrad Dybcio, Martin Botka, Jami Kettunen, phone-devel
On 2023-02-16 18:34:43, Dmitry Baryshkov wrote:
> On 16/02/2023 10:31, Marijn Suijten wrote:
> > On 2023-02-16 04:22:13, Dmitry Baryshkov wrote:
> >> On Thu, 16 Feb 2023 at 01:02, Marijn Suijten
> >> <marijn.suijten@somainline.org> wrote:
> >>>
> >>> DPU's catalog never assigned dpu_scaler_blk::version leading to
> >>> initialization code in dpu_hw_setup_scaler3 to wander the wrong
> >>> codepaths. Instead of hardcoding the correct QSEED algorithm version,
> >>> read it back from a hardware register.
> >>>
> >>> Note that this register is only available starting with QSEED3, where
> >>> 0x1002 corresponds to QSEED3, 0x2004 to QSEED3LITE and 0x3000 to QSEED4.
> >>
> >> This is not purely accurate. 0x1003 (sdm845) also corresponds to QSEED3.
> >> I'd say instead that there are several variations of QSEED3 scalers,
> >> where starting from 0x2004 it is called QSEED3LITE and starting from
> >> 0x3000 it is called QSEED4.
> >
> > Good catch, I'll update that.
> >
> >>> Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
> >>> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
> >>> ---
> >>> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 2 --
> >>> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 8 +++++++-
> >>> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 3 +++
> >>> 3 files changed, 10 insertions(+), 3 deletions(-)
> >>>
> >>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
> >>> index ddab9caebb18..96ce1766f4a1 100644
> >>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
> >>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
> >>> @@ -324,11 +324,9 @@ struct dpu_src_blk {
> >>> /**
> >>> * struct dpu_scaler_blk: Scaler information
> >>> * @info: HW register and features supported by this sub-blk
> >>> - * @version: qseed block revision
> >>> */
> >>> struct dpu_scaler_blk {
> >>> DPU_HW_SUBBLK_INFO;
> >>> - u32 version;
> >>
> >> No. Please keep the version in the scaler subblk. It is a version of
> >> the QSEED (scaler block), not the SSPP's version.
> >
> > You are right that the new variable in the parent (SSPP) block is
> > nondescriptive and should have been named scaler_version.
> >
> > However.
> >
> > dpu_scaler_blk is only used as a const static struct in the catalog,
> > meaning we cannot (should not!) store a runtime-read register value
> > here. Instead I followed your IRC suggestion to read the register in
> > dpu_hw_sspp_init, but my original implementation called
> > dpu_hw_get_scaler3_ver in _dpu_hw_sspp_setup_scaler3 where we already
> > have access to the subblk_offset, allowing us to delete
> > _dpu_hw_sspp_get_scaler3_ver. Would you rather have that? We don't
> > need the register value anywhere else.
>
> After giving it another thought, let's follow the vendor's approach and
> store the predefined scaler_version in hw catalog (in dpu_scaler_blk, as
> it currently is). This way we can still drop all QSEED3/3LITE/4
> crazyness, while keeping the data sane.
You want to drop the descriptive #define's, and replace them with magic
0x1002/0x2004/0x3000 and whatever other values we know? That seems
impossible to port without reading back the register value, which we've
only done for a handful of SoCs. I hope I'm misunderstanding you?
After all the vendor approach (in a random 4.14 kernel I have open now)
is to read the register value at runtime but their catalog is also
dynamic and built at runtime based on version ranges and register reads,
which sometimes is more sensible. Ours is const.
> Then _dpu_hw_sspp_get_scaler3_ver() can also be dropped (or you can use
> it as a safety guard while doing dpu_hw_sspp init).
That (safety guard) is exactly what Abhinav requested against, since the
kernel (and our catalog) should be trustworthy. I'll let you two fight
this out and come to a consensus before sending v2.
> >> There is a block called DS (destination scaler), which can be used to
> >> scale the resulting image after the LM. This block also uses the
> >> QSEED3(,LITE,4) scaler block.
> >
> > Is this already supported in mainline, and is it the reason for
> > previously having qseed_type globally available? Is my understanding
> > correct that this scaler subblk in the SSPP is merely an interface to
> > it, allowing the same hardware to be used from the SSPP for intputs and
> > after the LM for outputs?
>
> No, I think qseed_type is a leftover from having the same thing
> implemented in three different ways. Maybe because of NIH syndrome?
Could be, downstream uses it to steer its catalog logic for example
(which happens before later reading the version register).
> DS is not supported, it was removed in the commit
> b033def8741aab3fb58e4bf6c1d5cd73b3beb357. I do not have a clear usecase
> for this block and of course we don't have uABI for it.
Is there no common DRM property to composite at a lower resolution and
upscale the final displayed image to match a CRTC/encoder? I wish I
understood the commit message better :)
> It would still be nice to keep it in the picture though. It was the main
> reason for moving scaler code from dpu_hw_sspp to dpu_hw_util.
Downstream SDE already has this code moved to sde_hw_util as far as I
can see (and SSPP and DS call into it). But I fully agree as a
mostly-oblivious-outsider: it seems like there are a lot of features,
hardware blocks and optimizations not implemented, things which I still
have no knowledge/experience/understanding of/about. Let's first focus
on making it work _on all relevant SoCs and boards_ though :)
- Marijn
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] drm/msm/dpu: Read previously-uninitialized SSPP scaler version from hw
2023-02-16 21:46 ` Marijn Suijten
@ 2023-02-17 15:00 ` Dmitry Baryshkov
0 siblings, 0 replies; 13+ messages in thread
From: Dmitry Baryshkov @ 2023-02-17 15:00 UTC (permalink / raw)
To: Marijn Suijten, Dmitry Baryshkov, Rob Clark, Abhinav Kumar,
Sean Paul, David Airlie, Daniel Vetter, Archit Taneja,
Chandan Uddaraju, Sravanthi Kollukuduru, linux-arm-msm,
dri-devel, freedreno, linux-kernel, ~postmarketos/upstreaming,
AngeloGioacchino Del Regno, Konrad Dybcio, Martin Botka,
Jami Kettunen, phone-devel
On Thu, 16 Feb 2023 at 23:46, Marijn Suijten
<marijn.suijten@somainline.org> wrote:
>
> On 2023-02-16 18:34:43, Dmitry Baryshkov wrote:
> > On 16/02/2023 10:31, Marijn Suijten wrote:
> > > On 2023-02-16 04:22:13, Dmitry Baryshkov wrote:
> > >> On Thu, 16 Feb 2023 at 01:02, Marijn Suijten
> > >> <marijn.suijten@somainline.org> wrote:
> > >>>
> > >>> DPU's catalog never assigned dpu_scaler_blk::version leading to
> > >>> initialization code in dpu_hw_setup_scaler3 to wander the wrong
> > >>> codepaths. Instead of hardcoding the correct QSEED algorithm version,
> > >>> read it back from a hardware register.
> > >>>
> > >>> Note that this register is only available starting with QSEED3, where
> > >>> 0x1002 corresponds to QSEED3, 0x2004 to QSEED3LITE and 0x3000 to QSEED4.
> > >>
> > >> This is not purely accurate. 0x1003 (sdm845) also corresponds to QSEED3.
> > >> I'd say instead that there are several variations of QSEED3 scalers,
> > >> where starting from 0x2004 it is called QSEED3LITE and starting from
> > >> 0x3000 it is called QSEED4.
> > >
> > > Good catch, I'll update that.
> > >
> > >>> Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
> > >>> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
> > >>> ---
> > >>> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 2 --
> > >>> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 8 +++++++-
> > >>> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 3 +++
> > >>> 3 files changed, 10 insertions(+), 3 deletions(-)
> > >>>
> > >>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
> > >>> index ddab9caebb18..96ce1766f4a1 100644
> > >>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
> > >>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
> > >>> @@ -324,11 +324,9 @@ struct dpu_src_blk {
> > >>> /**
> > >>> * struct dpu_scaler_blk: Scaler information
> > >>> * @info: HW register and features supported by this sub-blk
> > >>> - * @version: qseed block revision
> > >>> */
> > >>> struct dpu_scaler_blk {
> > >>> DPU_HW_SUBBLK_INFO;
> > >>> - u32 version;
> > >>
> > >> No. Please keep the version in the scaler subblk. It is a version of
> > >> the QSEED (scaler block), not the SSPP's version.
> > >
> > > You are right that the new variable in the parent (SSPP) block is
> > > nondescriptive and should have been named scaler_version.
> > >
> > > However.
> > >
> > > dpu_scaler_blk is only used as a const static struct in the catalog,
> > > meaning we cannot (should not!) store a runtime-read register value
> > > here. Instead I followed your IRC suggestion to read the register in
> > > dpu_hw_sspp_init, but my original implementation called
> > > dpu_hw_get_scaler3_ver in _dpu_hw_sspp_setup_scaler3 where we already
> > > have access to the subblk_offset, allowing us to delete
> > > _dpu_hw_sspp_get_scaler3_ver. Would you rather have that? We don't
> > > need the register value anywhere else.
> >
> > After giving it another thought, let's follow the vendor's approach and
> > store the predefined scaler_version in hw catalog (in dpu_scaler_blk, as
> > it currently is). This way we can still drop all QSEED3/3LITE/4
> > crazyness, while keeping the data sane.
>
> You want to drop the descriptive #define's, and replace them with magic
> 0x1002/0x2004/0x3000 and whatever other values we know?
And nothing stops us from adding defines for 0x2004
(SCALER_VERSION_QSEED3LITE) and 0x3000 (SCALER_VERSION_QSEED4). I'm
not sure regarding 0x1002: whether it is used on msm8998 and/or sdm630
too or not.
What I want to remove is the duplication of the information. It was
too easy to miss that vig_mask has version1, while the dpu_caps has
version 2. We are going to replace dpu_caps with scaler_version, but
the problem of having the duplicate still exists. I might have
suggested settling on the dpu_caps.qseed_type or on the bit in
dpu_sspp_cfg.features, but it seems that 0x1002 is not represented
this way. Unless we define something like
DPU_SSPP_SCALER_QSEED3_SDM660.
> That seems
> impossible to port without reading back the register value, which we've
> only done for a handful of SoCs. I hope I'm misunderstanding you?
Newer vendor dts files provide this value, see the
"qcom,sde-qseed-scalar-version" property.
For older platforms we'd have to read the register. See below
> After all the vendor approach (in a random 4.14 kernel I have open now)
> is to read the register value at runtime but their catalog is also
> dynamic and built at runtime based on version ranges and register reads,
> which sometimes is more sensible. Ours is const.
In later techpacks (since 5.4) they have switched to the property in the DTS.
>
> > Then _dpu_hw_sspp_get_scaler3_ver() can also be dropped (or you can use
> > it as a safety guard while doing dpu_hw_sspp init).
>
> That (safety guard) is exactly what Abhinav requested against, since the
> kernel (and our catalog) should be trustworthy. I'll let you two fight
> this out and come to a consensus before sending v2.
I'm fine without a fight. Whoever adds a platform is responsible for
setting a register.
For the reference, as far as I know:
msm8998 - ??
(sdm660 - 0x1002)
sdm845 - 0x1003
sm8150 - ?
sc8180x - ?
sm8250 - 0x3000
sc7180 - 0x3000
sm6115 - 0x3000
qcm2290 - no scaler
sm8350 - 0x3000
sc7280 - 0x3000
sc8280xp - ?, supposedly 0x3001
sm8450 - 0x3001
sm8550 - ?, supposedly 0x3002
>
> > >> There is a block called DS (destination scaler), which can be used to
> > >> scale the resulting image after the LM. This block also uses the
> > >> QSEED3(,LITE,4) scaler block.
> > >
> > > Is this already supported in mainline, and is it the reason for
> > > previously having qseed_type globally available? Is my understanding
> > > correct that this scaler subblk in the SSPP is merely an interface to
> > > it, allowing the same hardware to be used from the SSPP for intputs and
> > > after the LM for outputs?
> >
> > No, I think qseed_type is a leftover from having the same thing
> > implemented in three different ways. Maybe because of NIH syndrome?
>
> Could be, downstream uses it to steer its catalog logic for example
> (which happens before later reading the version register).
>
> > DS is not supported, it was removed in the commit
> > b033def8741aab3fb58e4bf6c1d5cd73b3beb357. I do not have a clear usecase
> > for this block and of course we don't have uABI for it.
>
> Is there no common DRM property to composite at a lower resolution and
> upscale the final displayed image to match a CRTC/encoder? I wish I
> understood the commit message better :)
Yes, I don't think there is one.
>
> > It would still be nice to keep it in the picture though. It was the main
> > reason for moving scaler code from dpu_hw_sspp to dpu_hw_util.
>
> Downstream SDE already has this code moved to sde_hw_util as far as I
> can see (and SSPP and DS call into it). But I fully agree as a
> mostly-oblivious-outsider: it seems like there are a lot of features,
> hardware blocks and optimizations not implemented, things which I still
> have no knowledge/experience/understanding of/about. Let's first focus
> on making it work _on all relevant SoCs and boards_ though :)
For sure. I pointed to the DS as a reason to have the scaler version
in the sblk rather than in the sspp instance.
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2023-02-17 15:02 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-15 23:02 [PATCH 0/3] drm/msm/dpu: Initialize SSPP scaler version (from register read) Marijn Suijten
2023-02-15 23:02 ` [PATCH 1/3] drm/msm/dpu: Read previously-uninitialized SSPP scaler version from hw Marijn Suijten
2023-02-16 2:22 ` Dmitry Baryshkov
2023-02-16 8:31 ` Marijn Suijten
2023-02-16 16:34 ` Dmitry Baryshkov
2023-02-16 21:46 ` Marijn Suijten
2023-02-17 15:00 ` Dmitry Baryshkov
2023-02-15 23:02 ` [PATCH 2/3] drm/msm/dpu: Drop unused get_scaler_ver callback from SSPP Marijn Suijten
2023-02-16 2:23 ` Dmitry Baryshkov
2023-02-15 23:02 ` [PATCH 3/3] drm/msm/dpu: Drop unused qseed_type from catalog dpu_caps Marijn Suijten
2023-02-16 2:57 ` Dmitry Baryshkov
2023-02-16 3:02 ` [PATCH 0/3] drm/msm/dpu: Initialize SSPP scaler version (from register read) Dmitry Baryshkov
2023-02-16 9:04 ` Marijn Suijten
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®