Skip to contentSkip to conversation

drm/msm/dpu: simplity RM code

PATCH Superseded Dmitry Baryshkov 2 participants 13 messages Apr 30, 2023 – May 1, 2023

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover drm/msm/dpu: simplity RM code

Implement several small simplifications for the DPU resource manager. First two patches were suggested by Marijn.

Dmitry Baryshkov (4):
drm/msm/dpu: replace IS_ERR_OR_NULL with IS_ERR during DSC init drm/msm/dpu: remove futile checks from dpu_rm_init() drm/msm/dpu: use PINGPONG_NONE for LMs with no PP attached drm/msm/dpu: move PINGPONG_NONE check to dpu_lm_init()

 .../msm/disp/dpu1/catalog/dpu_3_0_msm8998.h   |  4 +-
 .../msm/disp/dpu1/catalog/dpu_4_0_sdm845.h    |  4 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c     |  5 +++
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h   |  3 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c        | 41 +------------------
 5 files changed, 12 insertions(+), 45 deletions(-)
Signature · 1 line
2.39.2
#1 lore raw

PATCH 1/4 drm/msm/dpu: replace IS_ERR_OR_NULL with IS_ERR during DSC init

Using IS_ERR_OR_NULL() together with PTR_ERR() is a typical mistake. If the value is NULL, then the function will return 0 instead of a proper return code. Moreover dpu_hw_dsc_init() can not return NULL. Replace all dpu_rm_init()'s IS_ERR_OR_NULL() calls with IS_ERR().

This follows the commit 740828c73a36 ("drm/msm/dpu: fix error handling in dpu_rm_init"), which removed IS_ERR_OR_NULL() from RM init code, but then the commit f2803ee91a41 ("drm/msm/disp/dpu1: Add DSC support in RM") added it back for DSC init.

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +1 -1
index f0fc70422e56..dffd3dd0a877 100644
@@ -247,7 +247,7 @@ int dpu_rm_init(struct dpu_rm *rm,
 		const struct dpu_dsc_cfg *dsc = &cat->dsc[i];
 
 		hw = dpu_hw_dsc_init(dsc, mmio);
-		if (IS_ERR_OR_NULL(hw)) {
+		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
 			DPU_ERROR("failed dsc object creation: err %d\n", rc);
 			goto fail;
Signature · 1 line
2.39.2
reviewer Reviewed-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] drm/msm/dpu: replace IS_ERR_OR_NULL with IS_ERR during DSC init

Quoted 3 lines · Dmitry Baryshkov

Using IS_ERR_OR_NULL() together with PTR_ERR() is a typical mistake. If the value is NULL, then the function will return 0 instead of a proper return code. Moreover dpu_hw_dsc_init() can not return NULL.

More specifically, it allows the init functions to return NULL when they do their own filtering and return NULL (as I do in [1] inside dpu_hw_intf_init for INTF_NONE so that rm->hw_intf for that index is assigned NULL, rather than failing the entire dpu_rm_init).

[1]: https://lore.kernel.org/linux-arm-msm/20230418-dpu-drop-useless-for-lookup-v3-3-e8d869eea455@somainline.org/

Quoted 1 line

Replace all dpu_rm_init()'s IS_ERR_OR_NULL() calls with IS_ERR().

It's just one, but that technically counts as "all".

Quoted 4 lines

This follows the commit 740828c73a36 ("drm/msm/dpu: fix error handling in dpu_rm_init"), which removed IS_ERR_OR_NULL() from RM init code, but then the commit f2803ee91a41 ("drm/msm/disp/dpu1: Add DSC support in RM") added it back for DSC init.

Nit: it did not technically add it "back"; there was no DSC code to begin with but I'm not sure how to concisely word that by explaining that init was copied from downstream following downstream patterns (I think) rather than observing local upstream context. And not worth it if there's no resend.

Quoted 2 lines

Regardless of the wording nits, the change is:

Quoted 20 lines
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +1 -1
index f0fc70422e56..dffd3dd0a877 100644
@@ -247,7 +247,7 @@ int dpu_rm_init(struct dpu_rm *rm,
 		const struct dpu_dsc_cfg *dsc = &cat->dsc[i];
 
 		hw = dpu_hw_dsc_init(dsc, mmio);
-		if (IS_ERR_OR_NULL(hw)) {
+		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
 			DPU_ERROR("failed dsc object creation: err %d\n", rc);
 			goto fail;
Signature · 1 line
2.39.2
#3 lore raw

PATCH 2/4 drm/msm/dpu: remove futile checks from dpu_rm_init()

In reply to Dmitry Baryshkov

dpu_rm_init() contains checks for block->id values. These were logical in the vendor driver, when one can not be sure which values were passed from DT. In the upstream driver this is not necessary: the catalog is a part of the driver, we control specified IDs.

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 34 --------------------------
 1 file changed, 34 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +0 -34
index dffd3dd0a877..d5a06628885e 100644
@@ -122,10 +122,6 @@ int dpu_rm_init(struct dpu_rm *rm,
 			continue;
 		}
 
-		if (lm->id < LM_0 || lm->id >= LM_MAX) {
-			DPU_ERROR("skip mixer %d with invalid id\n", lm->id);
-			continue;
-		}
 		hw = dpu_hw_lm_init(lm, mmio);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
@@ -139,10 +135,6 @@ int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_merge_3d *hw;
 		const struct dpu_merge_3d_cfg *merge_3d = &cat->merge_3d[i];
 
-		if (merge_3d->id < MERGE_3D_0 || merge_3d->id >= MERGE_3D_MAX) {
-			DPU_ERROR("skip merge_3d %d with invalid id\n", merge_3d->id);
-			continue;
-		}
 		hw = dpu_hw_merge_3d_init(merge_3d, mmio);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
@@ -157,10 +149,6 @@ int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_pingpong *hw;
 		const struct dpu_pingpong_cfg *pp = &cat->pingpong[i];
 
-		if (pp->id < PINGPONG_0 || pp->id >= PINGPONG_MAX) {
-			DPU_ERROR("skip pingpong %d with invalid id\n", pp->id);
-			continue;
-		}
 		hw = dpu_hw_pingpong_init(pp, mmio);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
@@ -177,10 +165,6 @@ int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_intf *hw;
 		const struct dpu_intf_cfg *intf = &cat->intf[i];
 
-		if (intf->id < INTF_0 || intf->id >= INTF_MAX) {
-			DPU_ERROR("skip intf %d with invalid id\n", intf->id);
-			continue;
-		}
 		hw = dpu_hw_intf_init(intf, mmio);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
@@ -194,11 +178,6 @@ int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_wb *hw;
 		const struct dpu_wb_cfg *wb = &cat->wb[i];
 
-		if (wb->id < WB_0 || wb->id >= WB_MAX) {
-			DPU_ERROR("skip intf %d with invalid id\n", wb->id);
-			continue;
-		}
-
 		hw = dpu_hw_wb_init(wb, mmio);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
@@ -212,10 +191,6 @@ int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_ctl *hw;
 		const struct dpu_ctl_cfg *ctl = &cat->ctl[i];
 
-		if (ctl->id < CTL_0 || ctl->id >= CTL_MAX) {
-			DPU_ERROR("skip ctl %d with invalid id\n", ctl->id);
-			continue;
-		}
 		hw = dpu_hw_ctl_init(ctl, mmio, cat->mixer_count, cat->mixer);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
@@ -229,10 +204,6 @@ int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_dspp *hw;
 		const struct dpu_dspp_cfg *dspp = &cat->dspp[i];
 
-		if (dspp->id < DSPP_0 || dspp->id >= DSPP_MAX) {
-			DPU_ERROR("skip dspp %d with invalid id\n", dspp->id);
-			continue;
-		}
 		hw = dpu_hw_dspp_init(dspp, mmio);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
@@ -259,11 +230,6 @@ int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_sspp *hw;
 		const struct dpu_sspp_cfg *sspp = &cat->sspp[i];
 
-		if (sspp->id < SSPP_NONE || sspp->id >= SSPP_MAX) {
-			DPU_ERROR("skip intf %d with invalid id\n", sspp->id);
-			continue;
-		}
-
 		hw = dpu_hw_sspp_init(sspp, mmio, cat->ubwc);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
Signature · 1 line
2.39.2
reviewer Reviewed-by on v1 2/4
#4 lore raw

Re: [PATCH 2/4] drm/msm/dpu: remove futile checks from dpu_rm_init()

Quoted 7 lines · Dmitry Baryshkov

dpu_rm_init() contains checks for block->id values. These were logical in the vendor driver, when one can not be sure which values were passed from DT. In the upstream driver this is not necessary: the catalog is a part of the driver, we control specified IDs.

I was going to send this on top of [1] to prevent conflicts, but it seems you beat me to it and also based it on top of that series, though without mentioning the dependency in the cover letter.

[1]: https://lore.kernel.org/linux-arm-msm/20230418-dpu-drop-useless-for-lookup-v3-3-e8d869eea455@somainline.org/

Quoted 101 lines
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 34 --------------------------
 1 file changed, 34 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +0 -34
index dffd3dd0a877..d5a06628885e 100644
@@ -122,10 +122,6 @@ int dpu_rm_init(struct dpu_rm *rm,
 			continue;
 		}
 
-		if (lm->id < LM_0 || lm->id >= LM_MAX) {
-			DPU_ERROR("skip mixer %d with invalid id\n", lm->id);
-			continue;
-		}
 		hw = dpu_hw_lm_init(lm, mmio);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
@@ -139,10 +135,6 @@ int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_merge_3d *hw;
 		const struct dpu_merge_3d_cfg *merge_3d = &cat->merge_3d[i];
 
-		if (merge_3d->id < MERGE_3D_0 || merge_3d->id >= MERGE_3D_MAX) {
-			DPU_ERROR("skip merge_3d %d with invalid id\n", merge_3d->id);
-			continue;
-		}
 		hw = dpu_hw_merge_3d_init(merge_3d, mmio);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
@@ -157,10 +149,6 @@ int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_pingpong *hw;
 		const struct dpu_pingpong_cfg *pp = &cat->pingpong[i];
 
-		if (pp->id < PINGPONG_0 || pp->id >= PINGPONG_MAX) {
-			DPU_ERROR("skip pingpong %d with invalid id\n", pp->id);
-			continue;
-		}
 		hw = dpu_hw_pingpong_init(pp, mmio);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
@@ -177,10 +165,6 @@ int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_intf *hw;
 		const struct dpu_intf_cfg *intf = &cat->intf[i];
 
-		if (intf->id < INTF_0 || intf->id >= INTF_MAX) {
-			DPU_ERROR("skip intf %d with invalid id\n", intf->id);
-			continue;
-		}
 		hw = dpu_hw_intf_init(intf, mmio);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
@@ -194,11 +178,6 @@ int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_wb *hw;
 		const struct dpu_wb_cfg *wb = &cat->wb[i];
 
-		if (wb->id < WB_0 || wb->id >= WB_MAX) {
-			DPU_ERROR("skip intf %d with invalid id\n", wb->id);
-			continue;
-		}
-
 		hw = dpu_hw_wb_init(wb, mmio);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
@@ -212,10 +191,6 @@ int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_ctl *hw;
 		const struct dpu_ctl_cfg *ctl = &cat->ctl[i];
 
-		if (ctl->id < CTL_0 || ctl->id >= CTL_MAX) {
-			DPU_ERROR("skip ctl %d with invalid id\n", ctl->id);
-			continue;
-		}
 		hw = dpu_hw_ctl_init(ctl, mmio, cat->mixer_count, cat->mixer);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
@@ -229,10 +204,6 @@ int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_dspp *hw;
 		const struct dpu_dspp_cfg *dspp = &cat->dspp[i];
 
-		if (dspp->id < DSPP_0 || dspp->id >= DSPP_MAX) {
-			DPU_ERROR("skip dspp %d with invalid id\n", dspp->id);
-			continue;
-		}
 		hw = dpu_hw_dspp_init(dspp, mmio);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
@@ -259,11 +230,6 @@ int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_sspp *hw;
 		const struct dpu_sspp_cfg *sspp = &cat->sspp[i];
 
-		if (sspp->id < SSPP_NONE || sspp->id >= SSPP_MAX) {
-			DPU_ERROR("skip intf %d with invalid id\n", sspp->id);
-			continue;
-		}
-
 		hw = dpu_hw_sspp_init(sspp, mmio, cat->ubwc);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
Signature · 1 line
2.39.2
#5 lore raw

Re: [PATCH 2/4] drm/msm/dpu: remove futile checks from dpu_rm_init()

Quoted 6 lines · Marijn Suijten
Quoted 5 lines · Dmitry Baryshkov

dpu_rm_init() contains checks for block->id values. These were logical in the vendor driver, when one can not be sure which values were passed from DT. In the upstream driver this is not necessary: the catalog is a part of the driver, we control specified IDs.

Quoted 6 lines
Quoted 2 lines

I was going to send this on top of [1] to prevent conflicts, but it seems you beat me to it and also based it on top of that series, though without mentioning the dependency in the cover letter.

I hoped that you'd include such a change into the mentioned series. But after waiting for some time I went and sent this out, as I was not sure about your intentions and time budget.

Quoted 106 lines

[1]: https://lore.kernel.org/linux-arm-msm/20230418-dpu-drop-useless-for-lookup-v3-3-e8d869eea455@somainline.org/

Quoted 101 lines
---
  drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 34 --------------------------
  1 file changed, 34 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +0 -34
index dffd3dd0a877..d5a06628885e 100644
@@ -122,10 +122,6 @@ int dpu_rm_init(struct dpu_rm *rm,
  			continue;
  		}
 
-		if (lm->id < LM_0 || lm->id >= LM_MAX) {
-			DPU_ERROR("skip mixer %d with invalid id\n", lm->id);
-			continue;
-		}
  		hw = dpu_hw_lm_init(lm, mmio);
  		if (IS_ERR(hw)) {
  			rc = PTR_ERR(hw);
@@ -139,10 +135,6 @@ int dpu_rm_init(struct dpu_rm *rm,
  		struct dpu_hw_merge_3d *hw;
  		const struct dpu_merge_3d_cfg *merge_3d = &cat->merge_3d[i];
 
-		if (merge_3d->id < MERGE_3D_0 || merge_3d->id >= MERGE_3D_MAX) {
-			DPU_ERROR("skip merge_3d %d with invalid id\n", merge_3d->id);
-			continue;
-		}
  		hw = dpu_hw_merge_3d_init(merge_3d, mmio);
  		if (IS_ERR(hw)) {
  			rc = PTR_ERR(hw);
@@ -157,10 +149,6 @@ int dpu_rm_init(struct dpu_rm *rm,
  		struct dpu_hw_pingpong *hw;
  		const struct dpu_pingpong_cfg *pp = &cat->pingpong[i];
 
-		if (pp->id < PINGPONG_0 || pp->id >= PINGPONG_MAX) {
-			DPU_ERROR("skip pingpong %d with invalid id\n", pp->id);
-			continue;
-		}
  		hw = dpu_hw_pingpong_init(pp, mmio);
  		if (IS_ERR(hw)) {
  			rc = PTR_ERR(hw);
@@ -177,10 +165,6 @@ int dpu_rm_init(struct dpu_rm *rm,
  		struct dpu_hw_intf *hw;
  		const struct dpu_intf_cfg *intf = &cat->intf[i];
 
-		if (intf->id < INTF_0 || intf->id >= INTF_MAX) {
-			DPU_ERROR("skip intf %d with invalid id\n", intf->id);
-			continue;
-		}
  		hw = dpu_hw_intf_init(intf, mmio);
  		if (IS_ERR(hw)) {
  			rc = PTR_ERR(hw);
@@ -194,11 +178,6 @@ int dpu_rm_init(struct dpu_rm *rm,
  		struct dpu_hw_wb *hw;
  		const struct dpu_wb_cfg *wb = &cat->wb[i];
 
-		if (wb->id < WB_0 || wb->id >= WB_MAX) {
-			DPU_ERROR("skip intf %d with invalid id\n", wb->id);
-			continue;
-		}
-
  		hw = dpu_hw_wb_init(wb, mmio);
  		if (IS_ERR(hw)) {
  			rc = PTR_ERR(hw);
@@ -212,10 +191,6 @@ int dpu_rm_init(struct dpu_rm *rm,
  		struct dpu_hw_ctl *hw;
  		const struct dpu_ctl_cfg *ctl = &cat->ctl[i];
 
-		if (ctl->id < CTL_0 || ctl->id >= CTL_MAX) {
-			DPU_ERROR("skip ctl %d with invalid id\n", ctl->id);
-			continue;
-		}
  		hw = dpu_hw_ctl_init(ctl, mmio, cat->mixer_count, cat->mixer);
  		if (IS_ERR(hw)) {
  			rc = PTR_ERR(hw);
@@ -229,10 +204,6 @@ int dpu_rm_init(struct dpu_rm *rm,
  		struct dpu_hw_dspp *hw;
  		const struct dpu_dspp_cfg *dspp = &cat->dspp[i];
 
-		if (dspp->id < DSPP_0 || dspp->id >= DSPP_MAX) {
-			DPU_ERROR("skip dspp %d with invalid id\n", dspp->id);
-			continue;
-		}
  		hw = dpu_hw_dspp_init(dspp, mmio);
  		if (IS_ERR(hw)) {
  			rc = PTR_ERR(hw);
@@ -259,11 +230,6 @@ int dpu_rm_init(struct dpu_rm *rm,
  		struct dpu_hw_sspp *hw;
  		const struct dpu_sspp_cfg *sspp = &cat->sspp[i];
 
-		if (sspp->id < SSPP_NONE || sspp->id >= SSPP_MAX) {
-			DPU_ERROR("skip intf %d with invalid id\n", sspp->id);
-			continue;
-		}
-
  		hw = dpu_hw_sspp_init(sspp, mmio, cat->ubwc);
  		if (IS_ERR(hw)) {
  			rc = PTR_ERR(hw);
Signature · 1 line
2.39.2
Signature · 2 lines
With best wishes
Dmitry
#6 lore raw

Re: [PATCH 2/4] drm/msm/dpu: remove futile checks from dpu_rm_init()

Quoted 10 lines · Dmitry Baryshkov
Quoted 9 lines · Marijn Suijten
Quoted 7 lines · Dmitry Baryshkov

dpu_rm_init() contains checks for block->id values. These were logical in the vendor driver, when one can not be sure which values were passed from DT. In the upstream driver this is not necessary: the catalog is a part of the driver, we control specified IDs.

Quoted 7 lines
Quoted 3 lines

I was going to send this on top of [1] to prevent conflicts, but it seems you beat me to it and also based it on top of that series, though without mentioning the dependency in the cover letter.

I hoped that you'd include such a change into the mentioned series. But after waiting for some time I went and sent this out, as I was not sure about your intentions and time budget.

I intended to send it as a separate series to not clobber the others, but it does result in yet another dependency that becomes harder and harder to keep track of as all those series get amended and resent repeatedly. The linked series' v3 wasn't a week old yet :)

- Marijn

Quoted 5 lines
Quoted 5 lines

[1]: https://lore.kernel.org/linux-arm-msm/20230418-dpu-drop-useless-for-lookup-v3-3-e8d869eea455@somainline.org/

#7 lore raw

PATCH 3/4 drm/msm/dpu: use PINGPONG_NONE for LMs with no PP attached

In reply to Dmitry Baryshkov

On msm8998/sdm845 some LM blocks do not have corresponding PINGPONG block. Currently the driver uses PINGPONG_MAX for such cases. Switch that to use PINGPONG_NONE instead, which is more logical.

---
 drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_3_0_msm8998.h | 4 ++--
 drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_0_sdm845.h  | 4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h             | 3 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c                  | 2 +-
 4 files changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_3_0_msm8998.h +2 -2
index bdcd554fc8a8..6ae30f806ebc 100644
@@ -104,9 +104,9 @@ static const struct dpu_lm_cfg msm8998_lm[] = {
 	LM_BLK("lm_2", LM_2, 0x46000, MIXER_MSM8998_MASK,
 		&msm8998_lm_sblk, PINGPONG_2, LM_5, 0),
 	LM_BLK("lm_3", LM_3, 0x47000, MIXER_MSM8998_MASK,
-		&msm8998_lm_sblk, PINGPONG_MAX, 0, 0),
+		&msm8998_lm_sblk, PINGPONG_NONE, 0, 0),
 	LM_BLK("lm_4", LM_4, 0x48000, MIXER_MSM8998_MASK,
-		&msm8998_lm_sblk, PINGPONG_MAX, 0, 0),
+		&msm8998_lm_sblk, PINGPONG_NONE, 0, 0),
 	LM_BLK("lm_5", LM_5, 0x49000, MIXER_MSM8998_MASK,
 		&msm8998_lm_sblk, PINGPONG_3, LM_2, 0),
 };
drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_0_sdm845.h +2 -2
index ceca741e93c9..4a94fd9b64a9 100644
@@ -102,9 +102,9 @@ static const struct dpu_lm_cfg sdm845_lm[] = {
 	LM_BLK("lm_2", LM_2, 0x46000, MIXER_SDM845_MASK,
 		&sdm845_lm_sblk, PINGPONG_2, LM_5, 0),
 	LM_BLK("lm_3", LM_3, 0x0, MIXER_SDM845_MASK,
-		&sdm845_lm_sblk, PINGPONG_MAX, 0, 0),
+		&sdm845_lm_sblk, PINGPONG_NONE, 0, 0),
 	LM_BLK("lm_4", LM_4, 0x0, MIXER_SDM845_MASK,
-		&sdm845_lm_sblk, PINGPONG_MAX, 0, 0),
+		&sdm845_lm_sblk, PINGPONG_NONE, 0, 0),
 	LM_BLK("lm_5", LM_5, 0x49000, MIXER_SDM845_MASK,
 		&sdm845_lm_sblk, PINGPONG_3, LM_2, 0),
 };
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h +2 -1
index 2d9192a6ce00..56826a92c155 100644
@@ -191,7 +191,8 @@ enum dpu_dsc {
 };
 
 enum dpu_pingpong {
-	PINGPONG_0 = 1,
+	PINGPONG_NONE,
+	PINGPONG_0,
 	PINGPONG_1,
 	PINGPONG_2,
 	PINGPONG_3,
drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +1 -1
index d5a06628885e..bf7b8e7c45b1 100644
@@ -117,7 +117,7 @@ int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_mixer *hw;
 		const struct dpu_lm_cfg *lm = &cat->mixer[i];
 
-		if (lm->pingpong == PINGPONG_MAX) {
+		if (lm->pingpong == PINGPONG_NONE) {
 			DPU_DEBUG("skip mixer %d without pingpong\n", lm->id);
 			continue;
 		}
Signature · 1 line
2.39.2
reviewer Reviewed-by on v1 3/4
#8 lore raw

Re: [PATCH 3/4] drm/msm/dpu: use PINGPONG_NONE for LMs with no PP attached

Quoted 3 lines · Dmitry Baryshkov

On msm8998/sdm845 some LM blocks do not have corresponding PINGPONG block. Currently the driver uses PINGPONG_MAX for such cases. Switch that to use PINGPONG_NONE instead, which is more logical.

dpu_lm_cfg::pingpong still has a doc-comment stating that PINGPONG_MAX is to be used if this is unsupported, that should be updated to read PINGPONG_NONE as well.

Quoted 1 line

Good cleanup otherwise:

Quoted 69 lines
---
 drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_3_0_msm8998.h | 4 ++--
 drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_0_sdm845.h  | 4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h             | 3 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c                  | 2 +-
 4 files changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_3_0_msm8998.h +2 -2
index bdcd554fc8a8..6ae30f806ebc 100644
@@ -104,9 +104,9 @@ static const struct dpu_lm_cfg msm8998_lm[] = {
 	LM_BLK("lm_2", LM_2, 0x46000, MIXER_MSM8998_MASK,
 		&msm8998_lm_sblk, PINGPONG_2, LM_5, 0),
 	LM_BLK("lm_3", LM_3, 0x47000, MIXER_MSM8998_MASK,
-		&msm8998_lm_sblk, PINGPONG_MAX, 0, 0),
+		&msm8998_lm_sblk, PINGPONG_NONE, 0, 0),
 	LM_BLK("lm_4", LM_4, 0x48000, MIXER_MSM8998_MASK,
-		&msm8998_lm_sblk, PINGPONG_MAX, 0, 0),
+		&msm8998_lm_sblk, PINGPONG_NONE, 0, 0),
 	LM_BLK("lm_5", LM_5, 0x49000, MIXER_MSM8998_MASK,
 		&msm8998_lm_sblk, PINGPONG_3, LM_2, 0),
 };
drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_0_sdm845.h +2 -2
index ceca741e93c9..4a94fd9b64a9 100644
@@ -102,9 +102,9 @@ static const struct dpu_lm_cfg sdm845_lm[] = {
 	LM_BLK("lm_2", LM_2, 0x46000, MIXER_SDM845_MASK,
 		&sdm845_lm_sblk, PINGPONG_2, LM_5, 0),
 	LM_BLK("lm_3", LM_3, 0x0, MIXER_SDM845_MASK,
-		&sdm845_lm_sblk, PINGPONG_MAX, 0, 0),
+		&sdm845_lm_sblk, PINGPONG_NONE, 0, 0),
 	LM_BLK("lm_4", LM_4, 0x0, MIXER_SDM845_MASK,
-		&sdm845_lm_sblk, PINGPONG_MAX, 0, 0),
+		&sdm845_lm_sblk, PINGPONG_NONE, 0, 0),
 	LM_BLK("lm_5", LM_5, 0x49000, MIXER_SDM845_MASK,
 		&sdm845_lm_sblk, PINGPONG_3, LM_2, 0),
 };
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h +2 -1
index 2d9192a6ce00..56826a92c155 100644
@@ -191,7 +191,8 @@ enum dpu_dsc {
 };
 
 enum dpu_pingpong {
-	PINGPONG_0 = 1,
+	PINGPONG_NONE,
+	PINGPONG_0,
 	PINGPONG_1,
 	PINGPONG_2,
 	PINGPONG_3,
drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +1 -1
index d5a06628885e..bf7b8e7c45b1 100644
@@ -117,7 +117,7 @@ int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_mixer *hw;
 		const struct dpu_lm_cfg *lm = &cat->mixer[i];
 
-		if (lm->pingpong == PINGPONG_MAX) {
+		if (lm->pingpong == PINGPONG_NONE) {
 			DPU_DEBUG("skip mixer %d without pingpong\n", lm->id);
 			continue;
 		}
Signature · 1 line
2.39.2
#9 lore raw

Re: [PATCH 3/4] drm/msm/dpu: use PINGPONG_NONE for LMs with no PP attached

Quoted 8 lines · Marijn Suijten
Quoted 3 lines · Dmitry Baryshkov

On msm8998/sdm845 some LM blocks do not have corresponding PINGPONG block. Currently the driver uses PINGPONG_MAX for such cases. Switch that to use PINGPONG_NONE instead, which is more logical.

dpu_lm_cfg::pingpong still has a doc-comment stating that PINGPONG_MAX is to be used if this is unsupported, that should be updated to read PINGPONG_NONE as well.

Ack, missed that. Thanks for the note.

Quoted 76 lines
Quoted 2 lines

Good cleanup otherwise:

Quoted 69 lines
---
  drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_3_0_msm8998.h | 4 ++--
  drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_0_sdm845.h  | 4 ++--
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h             | 3 ++-
  drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c                  | 2 +-
  4 files changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_3_0_msm8998.h +2 -2
index bdcd554fc8a8..6ae30f806ebc 100644
@@ -104,9 +104,9 @@ static const struct dpu_lm_cfg msm8998_lm[] = {
  	LM_BLK("lm_2", LM_2, 0x46000, MIXER_MSM8998_MASK,
  		&msm8998_lm_sblk, PINGPONG_2, LM_5, 0),
  	LM_BLK("lm_3", LM_3, 0x47000, MIXER_MSM8998_MASK,
-		&msm8998_lm_sblk, PINGPONG_MAX, 0, 0),
+		&msm8998_lm_sblk, PINGPONG_NONE, 0, 0),
  	LM_BLK("lm_4", LM_4, 0x48000, MIXER_MSM8998_MASK,
-		&msm8998_lm_sblk, PINGPONG_MAX, 0, 0),
+		&msm8998_lm_sblk, PINGPONG_NONE, 0, 0),
  	LM_BLK("lm_5", LM_5, 0x49000, MIXER_MSM8998_MASK,
  		&msm8998_lm_sblk, PINGPONG_3, LM_2, 0),
  };
drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_0_sdm845.h +2 -2
index ceca741e93c9..4a94fd9b64a9 100644
@@ -102,9 +102,9 @@ static const struct dpu_lm_cfg sdm845_lm[] = {
  	LM_BLK("lm_2", LM_2, 0x46000, MIXER_SDM845_MASK,
  		&sdm845_lm_sblk, PINGPONG_2, LM_5, 0),
  	LM_BLK("lm_3", LM_3, 0x0, MIXER_SDM845_MASK,
-		&sdm845_lm_sblk, PINGPONG_MAX, 0, 0),
+		&sdm845_lm_sblk, PINGPONG_NONE, 0, 0),
  	LM_BLK("lm_4", LM_4, 0x0, MIXER_SDM845_MASK,
-		&sdm845_lm_sblk, PINGPONG_MAX, 0, 0),
+		&sdm845_lm_sblk, PINGPONG_NONE, 0, 0),
  	LM_BLK("lm_5", LM_5, 0x49000, MIXER_SDM845_MASK,
  		&sdm845_lm_sblk, PINGPONG_3, LM_2, 0),
  };
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h +2 -1
index 2d9192a6ce00..56826a92c155 100644
@@ -191,7 +191,8 @@ enum dpu_dsc {
  };
 
  enum dpu_pingpong {
-	PINGPONG_0 = 1,
+	PINGPONG_NONE,
+	PINGPONG_0,
  	PINGPONG_1,
  	PINGPONG_2,
  	PINGPONG_3,
drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +1 -1
index d5a06628885e..bf7b8e7c45b1 100644
@@ -117,7 +117,7 @@ int dpu_rm_init(struct dpu_rm *rm,
  		struct dpu_hw_mixer *hw;
  		const struct dpu_lm_cfg *lm = &cat->mixer[i];
 
-		if (lm->pingpong == PINGPONG_MAX) {
+		if (lm->pingpong == PINGPONG_NONE) {
  			DPU_DEBUG("skip mixer %d without pingpong\n", lm->id);
  			continue;
  		}
Signature · 1 line
2.39.2
Signature · 2 lines
With best wishes
Dmitry
#10 lore raw

PATCH 4/4 drm/msm/dpu: move PINGPONG_NONE check to dpu_lm_init()

In reply to Dmitry Baryshkov

Move the check for lm->pingpong being not NONE from dpu_rm_init() to dpu_lm_init(), following the change to dpu_hw_intf_init().

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c | 5 +++++
 drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c    | 5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c +5 -0
index 214f207ddf8a..d1c3bd8379ea 100644
@@ -161,6 +161,11 @@ struct dpu_hw_mixer *dpu_hw_lm_init(const struct dpu_lm_cfg *cfg,
 {
 	struct dpu_hw_mixer *c;
 
+	if (cfg->pingpong == PINGPONG_NONE) {
+		DPU_DEBUG("skip mixer %d without pingpong\n", cfg->id);
+		return NULL;
+	}
+
 	c = kzalloc(sizeof(*c), GFP_KERNEL);
 	if (!c)
 		return ERR_PTR(-ENOMEM);
drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +0 -5
index bf7b8e7c45b1..2ca3c666e22f 100644
@@ -117,11 +117,6 @@ int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_mixer *hw;
 		const struct dpu_lm_cfg *lm = &cat->mixer[i];
 
-		if (lm->pingpong == PINGPONG_NONE) {
-			DPU_DEBUG("skip mixer %d without pingpong\n", lm->id);
-			continue;
-		}
-
 		hw = dpu_hw_lm_init(lm, mmio);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
Signature · 1 line
2.39.2
reviewer Reviewed-by on v1 4/4
#11 lore raw

Re: [PATCH 4/4] drm/msm/dpu: move PINGPONG_NONE check to dpu_lm_init()

Quoted 4 lines · Dmitry Baryshkov

Move the check for lm->pingpong being not NONE from dpu_rm_init() to dpu_lm_init(), following the change to dpu_hw_intf_init().

In some way I also suggested this change in [1], but did not receive a (N)ACK.

[1]: https://lore.kernel.org/linux-arm-msm/ecopixnagol7yd5znvmjanknqbv7vi4ayy36vchaeyyhuavu4w@rkdfllrd4uzb/

Quoted 40 lines
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c | 5 +++++
 drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c    | 5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c +5 -0
index 214f207ddf8a..d1c3bd8379ea 100644
@@ -161,6 +161,11 @@ struct dpu_hw_mixer *dpu_hw_lm_init(const struct dpu_lm_cfg *cfg,
 {
 	struct dpu_hw_mixer *c;
 
+	if (cfg->pingpong == PINGPONG_NONE) {
+		DPU_DEBUG("skip mixer %d without pingpong\n", cfg->id);
+		return NULL;
+	}
+
 	c = kzalloc(sizeof(*c), GFP_KERNEL);
 	if (!c)
 		return ERR_PTR(-ENOMEM);
drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +0 -5
index bf7b8e7c45b1..2ca3c666e22f 100644
@@ -117,11 +117,6 @@ int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_mixer *hw;
 		const struct dpu_lm_cfg *lm = &cat->mixer[i];
 
-		if (lm->pingpong == PINGPONG_NONE) {
-			DPU_DEBUG("skip mixer %d without pingpong\n", lm->id);
-			continue;
-		}
-
 		hw = dpu_hw_lm_init(lm, mmio);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
Signature · 1 line
2.39.2
#12 lore raw

Re: [PATCH 4/4] drm/msm/dpu: move PINGPONG_NONE check to dpu_lm_init()

Quoted 8 lines · Marijn Suijten
Quoted 4 lines · Dmitry Baryshkov

Move the check for lm->pingpong being not NONE from dpu_rm_init() to dpu_lm_init(), following the change to dpu_hw_intf_init().

In some way I also suggested this change in [1], but did not receive a (N)ACK.

It seems we went on arguing on other topics and didn't respond to that phrase. Please excuse me.

Quoted 45 lines

[1]: https://lore.kernel.org/linux-arm-msm/ecopixnagol7yd5znvmjanknqbv7vi4ayy36vchaeyyhuavu4w@rkdfllrd4uzb/

Quoted 40 lines
---
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c | 5 +++++
  drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c    | 5 -----
  2 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c +5 -0
index 214f207ddf8a..d1c3bd8379ea 100644
@@ -161,6 +161,11 @@ struct dpu_hw_mixer *dpu_hw_lm_init(const struct dpu_lm_cfg *cfg,
  {
  	struct dpu_hw_mixer *c;
 
+	if (cfg->pingpong == PINGPONG_NONE) {
+		DPU_DEBUG("skip mixer %d without pingpong\n", cfg->id);
+		return NULL;
+	}
+
  	c = kzalloc(sizeof(*c), GFP_KERNEL);
  	if (!c)
  		return ERR_PTR(-ENOMEM);
drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +0 -5
index bf7b8e7c45b1..2ca3c666e22f 100644
@@ -117,11 +117,6 @@ int dpu_rm_init(struct dpu_rm *rm,
  		struct dpu_hw_mixer *hw;
  		const struct dpu_lm_cfg *lm = &cat->mixer[i];
 
-		if (lm->pingpong == PINGPONG_NONE) {
-			DPU_DEBUG("skip mixer %d without pingpong\n", lm->id);
-			continue;
-		}
-
  		hw = dpu_hw_lm_init(lm, mmio);
  		if (IS_ERR(hw)) {
  			rc = PTR_ERR(hw);
Signature · 1 line
2.39.2
Signature · 2 lines
With best wishes
Dmitry