Skip to contentSkip to conversation

drm/msm/dpu: drop DPU_INTF_TE and DPU_PINGPONG_TE

PATCH Superseded Dmitry Baryshkov 2 participants 31 messages Jul 27, 2023 – Jul 30, 2023

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover drm/msm/dpu: drop DPU_INTF_TE and DPU_PINGPONG_TE

Drop two feature flags, DPU_INTF_TE and DPU_PINGPONG_TE, in favour of performing the MDSS revision checks instead.

Dependencies: [1], [2]

[1] https://patchwork.freedesktop.org/series/118088/
[2] https://patchwork.freedesktop.org/series/118836/

Dmitry Baryshkov (7):
drm/msm/dpu: enable PINGPONG TE operations only when supported by HW drm/msm/dpu: drop the DPU_PINGPONG_TE flag
drm/msm/dpu: inline _setup_intf_ops()
drm/msm/dpu: enable INTF TE operations only when supported by HW drm/msm/dpu: drop DPU_INTF_TE feature flag
drm/msm/dpu: drop useless check from
dpu_encoder_phys_cmd_te_rd_ptr_irq()
drm/msm/dpu: move INTF tearing checks to dpu_encoder_phys_cmd_init

 .../drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c  | 49 +++++++++----------
 .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c    |  3 +-
 .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h    |  6 +--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c   | 47 ++++++++----------
 .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c   |  2 +-
 5 files changed, 47 insertions(+), 60 deletions(-)

base-commit: be4dacf4eee1c4e2e91586e75e95b2852274dc58
prerequisite-patch-id: be3f3e5df89f9f2cc6b6289a83422d65e29d4900
prerequisite-patch-id: 59cd61ccd3cde7218fe3db6a8c672faafb7167f5
prerequisite-patch-id: d493b9bd85d518c15ca94f22174cb5ab2e2443d9
prerequisite-patch-id: 6a5bf3083c3da70ca110c17d54027e96c0335636
prerequisite-patch-id: 670883101f3b5dca122501f2828d8e45a6843b38
prerequisite-patch-id: 5dacdaf8ba4b369b966ca341db6691b208476fa1
prerequisite-patch-id: 5d8ff96e0fbea3358931d9d1fcb1bf114ae172df
prerequisite-patch-id: 9d7a4964337aee22c325fa04424f1e20946e1bb4
prerequisite-patch-id: 7310e0a9f3aa611cb080930a4c8247ced69ed5d5
prerequisite-patch-id: ec7e1b84ef2780c43cf59e2c2bf638d7eff188fd

Signature · 1 line
2.39.2
#1 lore raw

PATCH 1/7 drm/msm/dpu: enable PINGPONG TE operations only when supported by HW

The DPU_PINGPONG_TE bit is set for all PINGPONG blocks on DPU < 5.0. Rather than checking for the flag, check for the presense of the corresponding interrupt line.

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c +1 -1
index 9298c166b213..912a3bdf8ad4 100644
@@ -296,7 +296,7 @@ struct dpu_hw_pingpong *dpu_hw_pingpong_init(const struct dpu_pingpong_cfg *cfg,
 	c->idx = cfg->id;
 	c->caps = cfg;
 
-	if (test_bit(DPU_PINGPONG_TE, &cfg->features)) {
+	if (cfg->intr_rdptr) {
 		c->ops.enable_tearcheck = dpu_hw_pp_enable_te;
 		c->ops.disable_tearcheck = dpu_hw_pp_disable_te;
 		c->ops.connect_external_te = dpu_hw_pp_connect_external_te;
Signature · 1 line
2.39.2
reviewer Reviewed-by on v1 1/7
#2 lore raw

Re: [PATCH 1/7] drm/msm/dpu: enable PINGPONG TE operations only when supported by HW

Quoted 5 lines · Dmitry Baryshkov

The DPU_PINGPONG_TE bit is set for all PINGPONG blocks on DPU < 5.0. Rather than checking for the flag, check for the presense of the corresponding interrupt line.

That's a smart use of the interrupt field. I both like it, and I do not. While we didn't do any validation for consistency previously, this means we now have multiple ways of controlling available "features":

- Feature flags on hardware blocks;
- Presence of certain IRQs;
- DPU core revision.

Maybe that is more confusing to follow? Regardless of that I'm convinced that this patch does what it's supposed to and gets rid of some ambiguity. Maybe a comment above the IF explaining the "PP TE" feature could alleviate the above concerns thoo. Hence:

Quoted 20 lines
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c +1 -1
index 9298c166b213..912a3bdf8ad4 100644
@@ -296,7 +296,7 @@ struct dpu_hw_pingpong *dpu_hw_pingpong_init(const struct dpu_pingpong_cfg *cfg,
 	c->idx = cfg->id;
 	c->caps = cfg;
 
-	if (test_bit(DPU_PINGPONG_TE, &cfg->features)) {
+	if (cfg->intr_rdptr) {
 		c->ops.enable_tearcheck = dpu_hw_pp_enable_te;
 		c->ops.disable_tearcheck = dpu_hw_pp_disable_te;
 		c->ops.connect_external_te = dpu_hw_pp_connect_external_te;
Signature · 1 line
2.39.2
#3 lore raw

Re: [PATCH 1/7] drm/msm/dpu: enable PINGPONG TE operations only when supported by HW

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

The DPU_PINGPONG_TE bit is set for all PINGPONG blocks on DPU < 5.0. Rather than checking for the flag, check for the presense of the corresponding interrupt line.

Quoted 7 lines

That's a smart use of the interrupt field. I both like it, and I do not. While we didn't do any validation for consistency previously, this means we now have multiple ways of controlling available "features":

- Feature flags on hardware blocks;
- Presence of certain IRQs;
- DPU core revision.

I hesitated here too. For INTF it is clear that there is no other good way to check for the TE feature. For PP we can just check for the DPU revision.

Quoted 28 lines

Maybe that is more confusing to follow? Regardless of that I'm convinced that this patch does what it's supposed to and gets rid of some ambiguity. Maybe a comment above the IF explaining the "PP TE" feature could alleviate the above concerns thoo. Hence:

Quoted 20 lines
---
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c +1 -1
index 9298c166b213..912a3bdf8ad4 100644
@@ -296,7 +296,7 @@ struct dpu_hw_pingpong *dpu_hw_pingpong_init(const struct dpu_pingpong_cfg *cfg,
  	c->idx = cfg->id;
  	c->caps = cfg;
 
-	if (test_bit(DPU_PINGPONG_TE, &cfg->features)) {
+	if (cfg->intr_rdptr) {
  		c->ops.enable_tearcheck = dpu_hw_pp_enable_te;
  		c->ops.disable_tearcheck = dpu_hw_pp_disable_te;
  		c->ops.connect_external_te = dpu_hw_pp_connect_external_te;
Signature · 1 line
2.39.2
Signature · 2 lines
With best wishes
Dmitry
#4 lore raw

Re: [PATCH 1/7] drm/msm/dpu: enable PINGPONG TE operations only when supported by HW

Quoted 12 lines · Dmitry Baryshkov
Quoted 11 lines · Marijn Suijten
Quoted 5 lines · Dmitry Baryshkov

The DPU_PINGPONG_TE bit is set for all PINGPONG blocks on DPU < 5.0. Rather than checking for the flag, check for the presense of the corresponding interrupt line.

That's a smart use of the interrupt field. I both like it, and I do not. While we didn't do any validation for consistency previously, this means we now have multiple ways of controlling available "features":

Quoted 7 lines
Quoted 3 lines

- Feature flags on hardware blocks;
- Presence of certain IRQs;
- DPU core revision.

I hesitated here too. For INTF it is clear that there is no other good way to check for the TE feature. For PP we can just check for the DPU revision.

For both we could additionally check the DPU revision, and for INTF we could check for TYPE_DSI. Both would aid in extra validation, if we require the IRQ to be present or absent under these conditions.

It might also help to document this, either here and on the respective struct fields so that catalog implementers know when they should supply or leave out an IRQ?

- Marijn

Quoted 32 lines
Quoted 27 lines

Maybe that is more confusing to follow? Regardless of that I'm convinced that this patch does what it's supposed to and gets rid of some ambiguity. Maybe a comment above the IF explaining the "PP TE" feature could alleviate the above concerns thoo. Hence:

Quoted 20 lines
---
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c +1 -1
index 9298c166b213..912a3bdf8ad4 100644
@@ -296,7 +296,7 @@ struct dpu_hw_pingpong *dpu_hw_pingpong_init(const struct dpu_pingpong_cfg *cfg,
  	c->idx = cfg->id;
  	c->caps = cfg;
 
-	if (test_bit(DPU_PINGPONG_TE, &cfg->features)) {
+	if (cfg->intr_rdptr) {
  		c->ops.enable_tearcheck = dpu_hw_pp_enable_te;
  		c->ops.disable_tearcheck = dpu_hw_pp_disable_te;
  		c->ops.connect_external_te = dpu_hw_pp_connect_external_te;
Signature · 1 line
2.39.2
Signature · 2 lines
With best wishes
Dmitry
#5 lore raw

Re: [PATCH 1/7] drm/msm/dpu: enable PINGPONG TE operations only when supported by HW

Quoted 17 lines · Marijn Suijten
Quoted 16 lines · Dmitry Baryshkov
Quoted 14 lines · Marijn Suijten
Quoted 5 lines · Dmitry Baryshkov

The DPU_PINGPONG_TE bit is set for all PINGPONG blocks on DPU < 5.0. Rather than checking for the flag, check for the presense of the corresponding interrupt line.

That's a smart use of the interrupt field. I both like it, and I do not. While we didn't do any validation for consistency previously, this means we now have multiple ways of controlling available "features":

- Feature flags on hardware blocks;
- Presence of certain IRQs;
- DPU core revision.

Quoted 7 lines
Quoted 3 lines

I hesitated here too. For INTF it is clear that there is no other good way to check for the TE feature. For PP we can just check for the DPU revision.

For both we could additionally check the DPU revision, and for INTF we could check for TYPE_DSI. Both would aid in extra validation, if we require the IRQ to be present or absent under these conditions.

Yep, maybe that's better.

Quoted 4 lines

It might also help to document this, either here and on the respective struct fields so that catalog implementers know when they should supply or leave out an IRQ?

Probably a WARN_ON would be enough.

Quoted 35 lines

- Marijn

Quoted 32 lines
Quoted 27 lines

Maybe that is more confusing to follow? Regardless of that I'm convinced that this patch does what it's supposed to and gets rid of some ambiguity. Maybe a comment above the IF explaining the "PP TE" feature could alleviate the above concerns thoo. Hence:

Quoted 20 lines
---
   drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c +1 -1
index 9298c166b213..912a3bdf8ad4 100644
@@ -296,7 +296,7 @@ struct dpu_hw_pingpong *dpu_hw_pingpong_init(const struct dpu_pingpong_cfg *cfg,
   	c->idx = cfg->id;
   	c->caps = cfg;
 
-	if (test_bit(DPU_PINGPONG_TE, &cfg->features)) {
+	if (cfg->intr_rdptr) {
   		c->ops.enable_tearcheck = dpu_hw_pp_enable_te;
   		c->ops.disable_tearcheck = dpu_hw_pp_disable_te;
   		c->ops.connect_external_te = dpu_hw_pp_connect_external_te;
Signature · 1 line
2.39.2
Signature · 2 lines
With best wishes
Dmitry
Signature · 2 lines
With best wishes
Dmitry
#6 lore raw

Re: [PATCH 1/7] drm/msm/dpu: enable PINGPONG TE operations only when supported by HW

Quoted 26 lines · Dmitry Baryshkov
Quoted 17 lines · Marijn Suijten
Quoted 16 lines · Dmitry Baryshkov
Quoted 14 lines · Marijn Suijten
Quoted 5 lines · Dmitry Baryshkov

The DPU_PINGPONG_TE bit is set for all PINGPONG blocks on DPU < 5.0. Rather than checking for the flag, check for the presense of the corresponding interrupt line.

That's a smart use of the interrupt field. I both like it, and I do not. While we didn't do any validation for consistency previously, this means we now have multiple ways of controlling available "features":

- Feature flags on hardware blocks;
- Presence of certain IRQs;
- DPU core revision.

Quoted 7 lines
Quoted 3 lines

I hesitated here too. For INTF it is clear that there is no other good way to check for the TE feature. For PP we can just check for the DPU revision.

For both we could additionally check the DPU revision, and for INTF we could check for TYPE_DSI. Both would aid in extra validation, if we require the IRQ to be present or absent under these conditions.

Quoted 8 lines

Yep, maybe that's better.

Quoted 4 lines

It might also help to document this, either here and on the respective struct fields so that catalog implementers know when they should supply or leave out an IRQ?

Probably a WARN_ON would be enough.

SGTM, it is after all only for bring-up as after that (additions have been validated, reviewed and merged) we "trust the kernel" including our catalog, so errors like this should pretty much be unreachable.

- Marijn

#7 lore raw

Re: [PATCH 1/7] drm/msm/dpu: enable PINGPONG TE operations only when supported by HW

In reply to Dmitry Baryshkov
Quoted 14 lines · Dmitry Baryshkov

The DPU_PINGPONG_TE bit is set for all PINGPONG blocks on DPU < 5.0. Rather than checking for the flag, check for the presense of the corresponding interrupt line.

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c +0 -0
index 9298c166b213..912a3bdf8ad4 100644

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c struct dpu_hw_pingpong *dpu_hw_pingpong_init(const struct dpu_pingpong_cfg *cfg, · line 297

Quoted 2 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c +0 -0
@@ -296,7 +296,7 @@ struct dpu_hw_pingpong *dpu_hw_pingpong_init(const struct dpu_pingpong_cfg *cfg,
 	c->idx = cfg->id;
 	c->caps = cfg;

In hindsight, maybe there's one patch missing from this series. You inlined _setup_intf_ops() later, but there's no patch inlining _setup_pingpong_ops() which looks to be required for applying this patch.

- Marijn

Quoted 9 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c +1 -1
-	if (test_bit(DPU_PINGPONG_TE, &cfg->features)) {
+	if (cfg->intr_rdptr) {
 		c->ops.enable_tearcheck = dpu_hw_pp_enable_te;
 		c->ops.disable_tearcheck = dpu_hw_pp_disable_te;
 		c->ops.connect_external_te = dpu_hw_pp_connect_external_te;
Signature · 1 line
2.39.2
#8 lore raw

Re: [PATCH 1/7] drm/msm/dpu: enable PINGPONG TE operations only when supported by HW

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

The DPU_PINGPONG_TE bit is set for all PINGPONG blocks on DPU < 5.0. Rather than checking for the flag, check for the presense of the corresponding interrupt line.

---
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c struct dpu_hw_pingpong *dpu_hw_pingpong_init(const struct dpu_pingpong_cfg *cfg, · line 297

Quoted 7 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c +0 -0
index 9298c166b213..912a3bdf8ad4 100644
@@ -296,7 +296,7 @@ struct dpu_hw_pingpong *dpu_hw_pingpong_init(const struct dpu_pingpong_cfg *cfg,
  	c->idx = cfg->id;
  	c->caps = cfg;

In hindsight, maybe there's one patch missing from this series. You inlined _setup_intf_ops() later, but there's no patch inlining _setup_pingpong_ops() which looks to be required for applying this patch.

Yes, I missed it somehow.

Quoted 12 lines

- Marijn

Quoted 9 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c +1 -1
-	if (test_bit(DPU_PINGPONG_TE, &cfg->features)) {
+	if (cfg->intr_rdptr) {
  		c->ops.enable_tearcheck = dpu_hw_pp_enable_te;
  		c->ops.disable_tearcheck = dpu_hw_pp_disable_te;
  		c->ops.connect_external_te = dpu_hw_pp_connect_external_te;
Signature · 1 line
2.39.2
Signature · 2 lines
With best wishes
Dmitry
#9 lore raw

PATCH 2/7 drm/msm/dpu: drop the DPU_PINGPONG_TE flag

In reply to Dmitry Baryshkov

The DPU_PINGPONG_TE flag became unused, we can drop it now.

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c +1 -1
index 3ff07d7cbf4b..c19dc70d4456 100644
@@ -79,7 +79,7 @@
 	(BIT(DPU_DIM_LAYER) | BIT(DPU_MIXER_COMBINED_ALPHA))
 
 #define PINGPONG_SDM845_MASK \
-	(BIT(DPU_PINGPONG_DITHER) | BIT(DPU_PINGPONG_TE) | BIT(DPU_PINGPONG_DSC))
+	(BIT(DPU_PINGPONG_DITHER) | BIT(DPU_PINGPONG_DSC))
 
 #define PINGPONG_SDM845_TE2_MASK \
 	(PINGPONG_SDM845_MASK | BIT(DPU_PINGPONG_TE2))
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h +1 -3
index 945b88c5ab58..a6f8eee58b92 100644
@@ -136,7 +136,6 @@ enum {
 
 /**
  * PINGPONG sub-blocks
- * @DPU_PINGPONG_TE         Tear check block
  * @DPU_PINGPONG_TE2        Additional tear check block for split pipes
  * @DPU_PINGPONG_SPLIT      PP block supports split fifo
  * @DPU_PINGPONG_SLAVE      PP block is a suitable slave for split fifo
@@ -145,8 +144,7 @@ enum {
  * @DPU_PINGPONG_MAX
  */
 enum {
-	DPU_PINGPONG_TE = 0x1,
-	DPU_PINGPONG_TE2,
+	DPU_PINGPONG_TE2 = 0x1,
 	DPU_PINGPONG_SPLIT,
 	DPU_PINGPONG_SLAVE,
 	DPU_PINGPONG_DITHER,
Signature · 1 line
2.39.2
reviewer Reviewed-by on v1 2/7
#10 lore raw

Re: [PATCH 2/7] drm/msm/dpu: drop the DPU_PINGPONG_TE flag

Quoted 3 lines · Dmitry Baryshkov

The DPU_PINGPONG_TE flag became unused, we can drop it now.

Quoted 43 lines
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c +1 -1
index 3ff07d7cbf4b..c19dc70d4456 100644
@@ -79,7 +79,7 @@
 	(BIT(DPU_DIM_LAYER) | BIT(DPU_MIXER_COMBINED_ALPHA))
 
 #define PINGPONG_SDM845_MASK \
-	(BIT(DPU_PINGPONG_DITHER) | BIT(DPU_PINGPONG_TE) | BIT(DPU_PINGPONG_DSC))
+	(BIT(DPU_PINGPONG_DITHER) | BIT(DPU_PINGPONG_DSC))
 
 #define PINGPONG_SDM845_TE2_MASK \
 	(PINGPONG_SDM845_MASK | BIT(DPU_PINGPONG_TE2))
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h +1 -3
index 945b88c5ab58..a6f8eee58b92 100644
@@ -136,7 +136,6 @@ enum {
 
 /**
  * PINGPONG sub-blocks
- * @DPU_PINGPONG_TE         Tear check block
  * @DPU_PINGPONG_TE2        Additional tear check block for split pipes
  * @DPU_PINGPONG_SPLIT      PP block supports split fifo
  * @DPU_PINGPONG_SLAVE      PP block is a suitable slave for split fifo
@@ -145,8 +144,7 @@ enum {
  * @DPU_PINGPONG_MAX
  */
 enum {
-	DPU_PINGPONG_TE = 0x1,
-	DPU_PINGPONG_TE2,
+	DPU_PINGPONG_TE2 = 0x1,
 	DPU_PINGPONG_SPLIT,
 	DPU_PINGPONG_SLAVE,
 	DPU_PINGPONG_DITHER,
Signature · 1 line
2.39.2
#11 lore raw

PATCH 3/7 drm/msm/dpu: inline _setup_intf_ops()

In reply to Dmitry Baryshkov

Inline the _setup_intf_ops() function, it makes it easier to handle different conditions involving INTF configuration.

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 47 +++++++++------------
 1 file changed, 21 insertions(+), 26 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +21 -26
index 8ec6505d9e78..7ca772791a73 100644
@@ -524,31 +524,6 @@ static void dpu_hw_intf_program_intf_cmd_cfg(struct dpu_hw_intf *ctx,
 	DPU_REG_WRITE(&ctx->hw, INTF_CONFIG2, intf_cfg2);
 }
 
-static void _setup_intf_ops(struct dpu_hw_intf_ops *ops,
-		unsigned long cap, const struct dpu_mdss_version *mdss_rev)
-{
-	ops->setup_timing_gen = dpu_hw_intf_setup_timing_engine;
-	ops->setup_prg_fetch  = dpu_hw_intf_setup_prg_fetch;
-	ops->get_status = dpu_hw_intf_get_status;
-	ops->enable_timing = dpu_hw_intf_enable_timing_engine;
-	ops->get_line_count = dpu_hw_intf_get_line_count;
-	if (cap & BIT(DPU_INTF_INPUT_CTRL))
-		ops->bind_pingpong_blk = dpu_hw_intf_bind_pingpong_blk;
-	ops->setup_misr = dpu_hw_intf_setup_misr;
-	ops->collect_misr = dpu_hw_intf_collect_misr;
-
-	if (cap & BIT(DPU_INTF_TE)) {
-		ops->enable_tearcheck = dpu_hw_intf_enable_te;
-		ops->disable_tearcheck = dpu_hw_intf_disable_te;
-		ops->connect_external_te = dpu_hw_intf_connect_external_te;
-		ops->vsync_sel = dpu_hw_intf_vsync_sel;
-		ops->disable_autorefresh = dpu_hw_intf_disable_autorefresh;
-	}
-
-	if (mdss_rev->core_major_ver >= 7)
-		ops->program_intf_cmd_cfg = dpu_hw_intf_program_intf_cmd_cfg;
-}
-
 struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg,
 		void __iomem *addr, const struct dpu_mdss_version *mdss_rev)
 {
@@ -571,7 +546,27 @@ struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg,
 	 */
 	c->idx = cfg->id;
 	c->cap = cfg;
-	_setup_intf_ops(&c->ops, c->cap->features, mdss_rev);
+
+	c->ops.setup_timing_gen = dpu_hw_intf_setup_timing_engine;
+	c->ops.setup_prg_fetch  = dpu_hw_intf_setup_prg_fetch;
+	c->ops.get_status = dpu_hw_intf_get_status;
+	c->ops.enable_timing = dpu_hw_intf_enable_timing_engine;
+	c->ops.get_line_count = dpu_hw_intf_get_line_count;
+	if (cfg->features & BIT(DPU_INTF_INPUT_CTRL))
+		c->ops.bind_pingpong_blk = dpu_hw_intf_bind_pingpong_blk;
+	c->ops.setup_misr = dpu_hw_intf_setup_misr;
+	c->ops.collect_misr = dpu_hw_intf_collect_misr;
+
+	if (cfg->features & BIT(DPU_INTF_TE)) {
+		c->ops.enable_tearcheck = dpu_hw_intf_enable_te;
+		c->ops.disable_tearcheck = dpu_hw_intf_disable_te;
+		c->ops.connect_external_te = dpu_hw_intf_connect_external_te;
+		c->ops.vsync_sel = dpu_hw_intf_vsync_sel;
+		c->ops.disable_autorefresh = dpu_hw_intf_disable_autorefresh;
+	}
+
+	if (mdss_rev->core_major_ver >= 7)
+		c->ops.program_intf_cmd_cfg = dpu_hw_intf_program_intf_cmd_cfg;
 
 	return c;
 }
Signature · 1 line
2.39.2
reviewer Reviewed-by on v1 3/7
#12 lore raw

Re: [PATCH 3/7] drm/msm/dpu: inline _setup_intf_ops()

Quoted 4 lines · Dmitry Baryshkov

Inline the _setup_intf_ops() function, it makes it easier to handle different conditions involving INTF configuration.

Quoted 43 lines
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 47 +++++++++------------
 1 file changed, 21 insertions(+), 26 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +0 -25
index 8ec6505d9e78..7ca772791a73 100644
@@ -524,31 +524,6 @@ static void dpu_hw_intf_program_intf_cmd_cfg(struct dpu_hw_intf *ctx,
 	DPU_REG_WRITE(&ctx->hw, INTF_CONFIG2, intf_cfg2);
 }
 
-static void _setup_intf_ops(struct dpu_hw_intf_ops *ops,
-		unsigned long cap, const struct dpu_mdss_version *mdss_rev)
-{
-	ops->setup_timing_gen = dpu_hw_intf_setup_timing_engine;
-	ops->setup_prg_fetch  = dpu_hw_intf_setup_prg_fetch;
-	ops->get_status = dpu_hw_intf_get_status;
-	ops->enable_timing = dpu_hw_intf_enable_timing_engine;
-	ops->get_line_count = dpu_hw_intf_get_line_count;
-	if (cap & BIT(DPU_INTF_INPUT_CTRL))
-		ops->bind_pingpong_blk = dpu_hw_intf_bind_pingpong_blk;
-	ops->setup_misr = dpu_hw_intf_setup_misr;
-	ops->collect_misr = dpu_hw_intf_collect_misr;
-
-	if (cap & BIT(DPU_INTF_TE)) {
-		ops->enable_tearcheck = dpu_hw_intf_enable_te;
-		ops->disable_tearcheck = dpu_hw_intf_disable_te;
-		ops->connect_external_te = dpu_hw_intf_connect_external_te;
-		ops->vsync_sel = dpu_hw_intf_vsync_sel;
-		ops->disable_autorefresh = dpu_hw_intf_disable_autorefresh;
-	}
-
-	if (mdss_rev->core_major_ver >= 7)
-		ops->program_intf_cmd_cfg = dpu_hw_intf_program_intf_cmd_cfg;
-}
-
 struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg,
 		void __iomem *addr, const struct dpu_mdss_version *mdss_rev)
 {
@@ -571,7 +546,27 @@ struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg,
 	 */
 	c->idx = cfg->id;

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg, · line 556

Quoted 10 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +8 -1
 	c->cap = cfg;
-	_setup_intf_ops(&c->ops, c->cap->features, mdss_rev);
+
+	c->ops.setup_timing_gen = dpu_hw_intf_setup_timing_engine;
+	c->ops.setup_prg_fetch  = dpu_hw_intf_setup_prg_fetch;
+	c->ops.get_status = dpu_hw_intf_get_status;
+	c->ops.enable_timing = dpu_hw_intf_enable_timing_engine;
+	c->ops.get_line_count = dpu_hw_intf_get_line_count;
+	if (cfg->features & BIT(DPU_INTF_INPUT_CTRL))
+		c->ops.bind_pingpong_blk = dpu_hw_intf_bind_pingpong_blk;

While at it, could we sort these down with the other conditional callbacks?

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg, · line 560

Quoted 4 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +4 -0
+	c->ops.setup_misr = dpu_hw_intf_setup_misr;
+	c->ops.collect_misr = dpu_hw_intf_collect_misr;
+
+	if (cfg->features & BIT(DPU_INTF_TE)) {

Any clue why we're not using test_bit()? Feels a bit inconsistent.

Quoted 15 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +9 -0
+		c->ops.enable_tearcheck = dpu_hw_intf_enable_te;
+		c->ops.disable_tearcheck = dpu_hw_intf_disable_te;
+		c->ops.connect_external_te = dpu_hw_intf_connect_external_te;
+		c->ops.vsync_sel = dpu_hw_intf_vsync_sel;
+		c->ops.disable_autorefresh = dpu_hw_intf_disable_autorefresh;
+	}
+
+	if (mdss_rev->core_major_ver >= 7)
+		c->ops.program_intf_cmd_cfg = dpu_hw_intf_program_intf_cmd_cfg;
 
 	return c;
 }
Signature · 1 line
2.39.2
#13 lore raw

Re: [PATCH 3/7] drm/msm/dpu: inline _setup_intf_ops()

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

Inline the _setup_intf_ops() function, it makes it easier to handle different conditions involving INTF configuration.

Quoted 48 lines
---
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 47 +++++++++------------
  1 file changed, 21 insertions(+), 26 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +3 -26
index 8ec6505d9e78..7ca772791a73 100644
@@ -524,31 +524,6 @@ static void dpu_hw_intf_program_intf_cmd_cfg(struct dpu_hw_intf *ctx,
  	DPU_REG_WRITE(&ctx->hw, INTF_CONFIG2, intf_cfg2);
  }
 
-static void _setup_intf_ops(struct dpu_hw_intf_ops *ops,
-		unsigned long cap, const struct dpu_mdss_version *mdss_rev)
-{
-	ops->setup_timing_gen = dpu_hw_intf_setup_timing_engine;
-	ops->setup_prg_fetch  = dpu_hw_intf_setup_prg_fetch;
-	ops->get_status = dpu_hw_intf_get_status;
-	ops->enable_timing = dpu_hw_intf_enable_timing_engine;
-	ops->get_line_count = dpu_hw_intf_get_line_count;
-	if (cap & BIT(DPU_INTF_INPUT_CTRL))
-		ops->bind_pingpong_blk = dpu_hw_intf_bind_pingpong_blk;
-	ops->setup_misr = dpu_hw_intf_setup_misr;
-	ops->collect_misr = dpu_hw_intf_collect_misr;
-
-	if (cap & BIT(DPU_INTF_TE)) {
-		ops->enable_tearcheck = dpu_hw_intf_enable_te;
-		ops->disable_tearcheck = dpu_hw_intf_disable_te;
-		ops->connect_external_te = dpu_hw_intf_connect_external_te;
-		ops->vsync_sel = dpu_hw_intf_vsync_sel;
-		ops->disable_autorefresh = dpu_hw_intf_disable_autorefresh;
-	}
-
-	if (mdss_rev->core_major_ver >= 7)
-		ops->program_intf_cmd_cfg = dpu_hw_intf_program_intf_cmd_cfg;
-}
-
  struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg,
  		void __iomem *addr, const struct dpu_mdss_version *mdss_rev)
  {
@@ -571,7 +546,27 @@ struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg,
  	 */
  	c->idx = cfg->id;
  	c->cap = cfg;
-	_setup_intf_ops(&c->ops, c->cap->features, mdss_rev);
+
+	c->ops.setup_timing_gen = dpu_hw_intf_setup_timing_engine;
+	c->ops.setup_prg_fetch  = dpu_hw_intf_setup_prg_fetch;
Quoted 8 lines

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg, · line 556

Quoted 5 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +5 -0
+	c->ops.get_status = dpu_hw_intf_get_status;
+	c->ops.enable_timing = dpu_hw_intf_enable_timing_engine;
+	c->ops.get_line_count = dpu_hw_intf_get_line_count;
+	if (cfg->features & BIT(DPU_INTF_INPUT_CTRL))
+		c->ops.bind_pingpong_blk = dpu_hw_intf_bind_pingpong_blk;

While at it, could we sort these down with the other conditional callbacks?

What kind of sorting do you have in mind?

Quoted 6 lines

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg, · line 560

Quoted 4 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +4 -0
+	c->ops.setup_misr = dpu_hw_intf_setup_misr;
+	c->ops.collect_misr = dpu_hw_intf_collect_misr;
+
+	if (cfg->features & BIT(DPU_INTF_TE)) {

Any clue why we're not using test_bit()? Feels a bit inconsistent.

Yes, some files use test_bit(), others just check the bit directly. Maybe after moving some/most of conditionals to core_major_ver we can clean that too.

Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +9 -0
+		c->ops.enable_tearcheck = dpu_hw_intf_enable_te;
+		c->ops.disable_tearcheck = dpu_hw_intf_disable_te;
+		c->ops.connect_external_te = dpu_hw_intf_connect_external_te;
+		c->ops.vsync_sel = dpu_hw_intf_vsync_sel;
+		c->ops.disable_autorefresh = dpu_hw_intf_disable_autorefresh;
+	}
+
+	if (mdss_rev->core_major_ver >= 7)
+		c->ops.program_intf_cmd_cfg = dpu_hw_intf_program_intf_cmd_cfg;
 
  	return c;
  }
Signature · 1 line
2.39.2
Signature · 2 lines
With best wishes
Dmitry
#14 lore raw

Re: [PATCH 3/7] drm/msm/dpu: inline _setup_intf_ops()

Quoted 66 lines · Dmitry Baryshkov
Quoted 56 lines · Marijn Suijten
Quoted 4 lines · Dmitry Baryshkov

Inline the _setup_intf_ops() function, it makes it easier to handle different conditions involving INTF configuration.

Quoted 48 lines
---
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 47 +++++++++------------
  1 file changed, 21 insertions(+), 26 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +3 -26
index 8ec6505d9e78..7ca772791a73 100644
@@ -524,31 +524,6 @@ static void dpu_hw_intf_program_intf_cmd_cfg(struct dpu_hw_intf *ctx,
  	DPU_REG_WRITE(&ctx->hw, INTF_CONFIG2, intf_cfg2);
  }
 
-static void _setup_intf_ops(struct dpu_hw_intf_ops *ops,
-		unsigned long cap, const struct dpu_mdss_version *mdss_rev)
-{
-	ops->setup_timing_gen = dpu_hw_intf_setup_timing_engine;
-	ops->setup_prg_fetch  = dpu_hw_intf_setup_prg_fetch;
-	ops->get_status = dpu_hw_intf_get_status;
-	ops->enable_timing = dpu_hw_intf_enable_timing_engine;
-	ops->get_line_count = dpu_hw_intf_get_line_count;
-	if (cap & BIT(DPU_INTF_INPUT_CTRL))
-		ops->bind_pingpong_blk = dpu_hw_intf_bind_pingpong_blk;
-	ops->setup_misr = dpu_hw_intf_setup_misr;
-	ops->collect_misr = dpu_hw_intf_collect_misr;
-
-	if (cap & BIT(DPU_INTF_TE)) {
-		ops->enable_tearcheck = dpu_hw_intf_enable_te;
-		ops->disable_tearcheck = dpu_hw_intf_disable_te;
-		ops->connect_external_te = dpu_hw_intf_connect_external_te;
-		ops->vsync_sel = dpu_hw_intf_vsync_sel;
-		ops->disable_autorefresh = dpu_hw_intf_disable_autorefresh;
-	}
-
-	if (mdss_rev->core_major_ver >= 7)
-		ops->program_intf_cmd_cfg = dpu_hw_intf_program_intf_cmd_cfg;
-}
-
  struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg,
  		void __iomem *addr, const struct dpu_mdss_version *mdss_rev)
  {
@@ -571,7 +546,27 @@ struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg,
  	 */
  	c->idx = cfg->id;
  	c->cap = cfg;
-	_setup_intf_ops(&c->ops, c->cap->features, mdss_rev);
+
+	c->ops.setup_timing_gen = dpu_hw_intf_setup_timing_engine;
+	c->ops.setup_prg_fetch  = dpu_hw_intf_setup_prg_fetch;
Quoted 8 lines

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg, · line 556

Quoted 5 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +5 -0
+	c->ops.get_status = dpu_hw_intf_get_status;
+	c->ops.enable_timing = dpu_hw_intf_enable_timing_engine;
+	c->ops.get_line_count = dpu_hw_intf_get_line_count;
+	if (cfg->features & BIT(DPU_INTF_INPUT_CTRL))
+		c->ops.bind_pingpong_blk = dpu_hw_intf_bind_pingpong_blk;

While at it, could we sort these down with the other conditional callbacks?

Quoted 1 line

What kind of sorting do you have in mind?

Moving this conditional ( if (...) ) down with the other conditional assignment below, instead of being right in the middle of get_line_count and setup_misr, both which are not conditional and make it harder to read, especially considering the lack of newlines and/or curly braces.

Quoted 10 lines
Quoted 6 lines

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg, · line 560

Quoted 4 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +4 -0
+	c->ops.setup_misr = dpu_hw_intf_setup_misr;
+	c->ops.collect_misr = dpu_hw_intf_collect_misr;
+
+	if (cfg->features & BIT(DPU_INTF_TE)) {

Any clue why we're not using test_bit()? Feels a bit inconsistent.

Yes, some files use test_bit(), others just check the bit directly. Maybe after moving some/most of conditionals to core_major_ver we can clean that too.

Sounds good.

- Marijn

Quoted 20 lines
Quoted 15 lines
Quoted 15 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +9 -0
+		c->ops.enable_tearcheck = dpu_hw_intf_enable_te;
+		c->ops.disable_tearcheck = dpu_hw_intf_disable_te;
+		c->ops.connect_external_te = dpu_hw_intf_connect_external_te;
+		c->ops.vsync_sel = dpu_hw_intf_vsync_sel;
+		c->ops.disable_autorefresh = dpu_hw_intf_disable_autorefresh;
+	}
+
+	if (mdss_rev->core_major_ver >= 7)
+		c->ops.program_intf_cmd_cfg = dpu_hw_intf_program_intf_cmd_cfg;
 
  	return c;
  }
Signature · 1 line
2.39.2
Signature · 2 lines
With best wishes
Dmitry
#15 lore raw

Re: [PATCH 3/7] drm/msm/dpu: inline _setup_intf_ops()

Quoted 68 lines · Marijn Suijten
Quoted 66 lines · Dmitry Baryshkov
Quoted 64 lines · Marijn Suijten
Quoted 4 lines · Dmitry Baryshkov

Inline the _setup_intf_ops() function, it makes it easier to handle different conditions involving INTF configuration.

Quoted 43 lines
---
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 47 +++++++++------------
  1 file changed, 21 insertions(+), 26 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +0 -25
index 8ec6505d9e78..7ca772791a73 100644
@@ -524,31 +524,6 @@ static void dpu_hw_intf_program_intf_cmd_cfg(struct dpu_hw_intf *ctx,
   DPU_REG_WRITE(&ctx->hw, INTF_CONFIG2, intf_cfg2);
  }
 
-static void _setup_intf_ops(struct dpu_hw_intf_ops *ops,
-          unsigned long cap, const struct dpu_mdss_version *mdss_rev)
-{
-  ops->setup_timing_gen = dpu_hw_intf_setup_timing_engine;
-  ops->setup_prg_fetch  = dpu_hw_intf_setup_prg_fetch;
-  ops->get_status = dpu_hw_intf_get_status;
-  ops->enable_timing = dpu_hw_intf_enable_timing_engine;
-  ops->get_line_count = dpu_hw_intf_get_line_count;
-  if (cap & BIT(DPU_INTF_INPUT_CTRL))
-          ops->bind_pingpong_blk = dpu_hw_intf_bind_pingpong_blk;
-  ops->setup_misr = dpu_hw_intf_setup_misr;
-  ops->collect_misr = dpu_hw_intf_collect_misr;
-
-  if (cap & BIT(DPU_INTF_TE)) {
-          ops->enable_tearcheck = dpu_hw_intf_enable_te;
-          ops->disable_tearcheck = dpu_hw_intf_disable_te;
-          ops->connect_external_te = dpu_hw_intf_connect_external_te;
-          ops->vsync_sel = dpu_hw_intf_vsync_sel;
-          ops->disable_autorefresh = dpu_hw_intf_disable_autorefresh;
-  }
-
-  if (mdss_rev->core_major_ver >= 7)
-          ops->program_intf_cmd_cfg = dpu_hw_intf_program_intf_cmd_cfg;
-}
-
  struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg,
           void __iomem *addr, const struct dpu_mdss_version *mdss_rev)
  {
@@ -571,7 +546,27 @@ struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg,
    */
   c->idx = cfg->id;

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg, · line 556

Quoted 10 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +8 -1
   c->cap = cfg;
-  _setup_intf_ops(&c->ops, c->cap->features, mdss_rev);
+
+  c->ops.setup_timing_gen = dpu_hw_intf_setup_timing_engine;
+  c->ops.setup_prg_fetch  = dpu_hw_intf_setup_prg_fetch;
+  c->ops.get_status = dpu_hw_intf_get_status;
+  c->ops.enable_timing = dpu_hw_intf_enable_timing_engine;
+  c->ops.get_line_count = dpu_hw_intf_get_line_count;
+  if (cfg->features & BIT(DPU_INTF_INPUT_CTRL))
+          c->ops.bind_pingpong_blk = dpu_hw_intf_bind_pingpong_blk;

While at it, could we sort these down with the other conditional callbacks?

Quoted 6 lines
Quoted 1 line

What kind of sorting do you have in mind?

Moving this conditional ( if (...) ) down with the other conditional assignment below, instead of being right in the middle of get_line_count and setup_misr, both which are not conditional and make it harder to read, especially considering the lack of newlines and/or curly braces.

Ack, sounds good.

Quoted 36 lines
Quoted 11 lines
Quoted 7 lines

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg, · line 560

Quoted 5 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +4 -0
+  c->ops.setup_misr = dpu_hw_intf_setup_misr;
+  c->ops.collect_misr = dpu_hw_intf_collect_misr;
+
+  if (cfg->features & BIT(DPU_INTF_TE)) {

Any clue why we're not using test_bit()? Feels a bit inconsistent.

Yes, some files use test_bit(), others just check the bit directly. Maybe after moving some/most of conditionals to core_major_ver we can clean that too.

Sounds good.

- Marijn

Quoted 20 lines
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +9 -0
+          c->ops.enable_tearcheck = dpu_hw_intf_enable_te;
+          c->ops.disable_tearcheck = dpu_hw_intf_disable_te;
+          c->ops.connect_external_te = dpu_hw_intf_connect_external_te;
+          c->ops.vsync_sel = dpu_hw_intf_vsync_sel;
+          c->ops.disable_autorefresh = dpu_hw_intf_disable_autorefresh;
+  }
+
+  if (mdss_rev->core_major_ver >= 7)
+          c->ops.program_intf_cmd_cfg = dpu_hw_intf_program_intf_cmd_cfg;
 
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +0 -1
   return c;
  }
--

2.39.2

--
With best wishes
Dmitry

Signature · 2 lines
With best wishes
Dmitry
#16 lore raw

PATCH 4/7 drm/msm/dpu: enable INTF TE operations only when supported by HW

In reply to Dmitry Baryshkov

The DPU_INTF_TE bit is set for all INTF blocks on DPU >= 5.0, however only INTF_1 and INTF_2 actually support tearing control. Rather than trying to fix the DPU_INTF_TE, check for the presense of the corresponding interrupt line.

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +1 -1
index 7ca772791a73..8abdf9553f3b 100644
@@ -557,7 +557,7 @@ struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg,
 	c->ops.setup_misr = dpu_hw_intf_setup_misr;
 	c->ops.collect_misr = dpu_hw_intf_collect_misr;
 
-	if (cfg->features & BIT(DPU_INTF_TE)) {
+	if (cfg->intr_tear_rd_ptr) {
 		c->ops.enable_tearcheck = dpu_hw_intf_enable_te;
 		c->ops.disable_tearcheck = dpu_hw_intf_disable_te;
 		c->ops.connect_external_te = dpu_hw_intf_connect_external_te;
Signature · 1 line
2.39.2
reviewer Reviewed-by on v1 4/7
#17 lore raw

Re: [PATCH 4/7] drm/msm/dpu: enable INTF TE operations only when supported by HW

Quoted 3 lines · Dmitry Baryshkov

The DPU_INTF_TE bit is set for all INTF blocks on DPU >= 5.0, however only INTF_1 and INTF_2 actually support tearing control. Rather than trying to fix the DPU_INTF_TE, check for the presense of the

I would more exactly expand "fix" to "Rather than specifying that feature bit on DSI INTF_1 and INTF_2 exclusively..."

Quoted 1 line

corresponding interrupt line.

... which the catalog will only provide on DPU >= 5.0.

Quoted 2 lines
Quoted 20 lines
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +1 -1
index 7ca772791a73..8abdf9553f3b 100644
@@ -557,7 +557,7 @@ struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg,
 	c->ops.setup_misr = dpu_hw_intf_setup_misr;
 	c->ops.collect_misr = dpu_hw_intf_collect_misr;
 
-	if (cfg->features & BIT(DPU_INTF_TE)) {
+	if (cfg->intr_tear_rd_ptr) {
 		c->ops.enable_tearcheck = dpu_hw_intf_enable_te;
 		c->ops.disable_tearcheck = dpu_hw_intf_disable_te;
 		c->ops.connect_external_te = dpu_hw_intf_connect_external_te;
Signature · 1 line
2.39.2
#18 lore raw

Re: [PATCH 4/7] drm/msm/dpu: enable INTF TE operations only when supported by HW

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

The DPU_INTF_TE bit is set for all INTF blocks on DPU >= 5.0, however only INTF_1 and INTF_2 actually support tearing control. Rather than trying to fix the DPU_INTF_TE, check for the presense of the

I would more exactly expand "fix" to "Rather than specifying that feature bit on DSI INTF_1 and INTF_2 exclusively..."

Quoted 1 line

corresponding interrupt line.

... which the catalog will only provide on DPU >= 5.0.

I'm going to rephrase this in a slightly different way to follow the irq presence -> major & type change.

Quoted 26 lines
Quoted 3 lines
Quoted 20 lines
---
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +1 -1
index 7ca772791a73..8abdf9553f3b 100644
@@ -557,7 +557,7 @@ struct dpu_hw_intf *dpu_hw_intf_init(const struct dpu_intf_cfg *cfg,
  	c->ops.setup_misr = dpu_hw_intf_setup_misr;
  	c->ops.collect_misr = dpu_hw_intf_collect_misr;
 
-	if (cfg->features & BIT(DPU_INTF_TE)) {
+	if (cfg->intr_tear_rd_ptr) {
  		c->ops.enable_tearcheck = dpu_hw_intf_enable_te;
  		c->ops.disable_tearcheck = dpu_hw_intf_disable_te;
  		c->ops.connect_external_te = dpu_hw_intf_connect_external_te;
Signature · 1 line
2.39.2
Signature · 2 lines
With best wishes
Dmitry
#19 lore raw

Re: [PATCH 4/7] drm/msm/dpu: enable INTF TE operations only when supported by HW

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

The DPU_INTF_TE bit is set for all INTF blocks on DPU >= 5.0, however only INTF_1 and INTF_2 actually support tearing control. Rather than trying to fix the DPU_INTF_TE, check for the presense of the

I would more exactly expand "fix" to "Rather than specifying that feature bit on DSI INTF_1 and INTF_2 exclusively..."

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

corresponding interrupt line.

... which the catalog will only provide on DPU >= 5.0.

I'm going to rephrase this in a slightly different way to follow the irq presence -> major & type change.

Sure, looks good, including the validation (that doesn't really need to be mentioned in the commit message anymore).

- Marijn

#20 lore raw

PATCH 5/7 drm/msm/dpu: drop DPU_INTF_TE feature flag

In reply to Dmitry Baryshkov

Replace the only user of the DPU_INTF_TE feature flag with the direct DPU version comparison.

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c       | 1 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h       | 2 --
 3 files changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +2 -2
index 9589fe719452..60d4dd88725e 100644
@@ -776,8 +776,8 @@ struct dpu_encoder_phys *dpu_encoder_phys_cmd_init(
 	phys_enc->intf_mode = INTF_MODE_CMD;
 	cmd_enc->stream_sel = 0;
 
-	phys_enc->has_intf_te = test_bit(DPU_INTF_TE,
-					 &phys_enc->hw_intf->cap->features);
+	if (phys_enc->dpu_kms->catalog->mdss_ver->core_major_ver >= 5)
+		phys_enc->has_intf_te = true;
 
 	atomic_set(&cmd_enc->pending_vblank_cnt, 0);
 	init_waitqueue_head(&cmd_enc->pending_vblank_wq);
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c +0 -1
index c19dc70d4456..17426f0f981e 100644
@@ -100,7 +100,6 @@
 
 #define INTF_SC7180_MASK \
 	(BIT(DPU_INTF_INPUT_CTRL) | \
-	 BIT(DPU_INTF_TE) | \
 	 BIT(DPU_INTF_STATUS_SUPPORTED) | \
 	 BIT(DPU_DATA_HCTL_EN))
 
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h +0 -2
index a6f8eee58b92..69c9099cf5a6 100644
@@ -175,7 +175,6 @@ enum {
  * INTF sub-blocks
  * @DPU_INTF_INPUT_CTRL             Supports the setting of pp block from which
  *                                  pixel data arrives to this INTF
- * @DPU_INTF_TE                     INTF block has TE configuration support
  * @DPU_DATA_HCTL_EN                Allows data to be transferred at different rate
  *                                  than video timing
  * @DPU_INTF_STATUS_SUPPORTED       INTF block has INTF_STATUS register
@@ -183,7 +182,6 @@ enum {
  */
 enum {
 	DPU_INTF_INPUT_CTRL = 0x1,
-	DPU_INTF_TE,
 	DPU_DATA_HCTL_EN,
 	DPU_INTF_STATUS_SUPPORTED,
 	DPU_INTF_MAX
Signature · 1 line
2.39.2
reviewer Reviewed-by on v1 5/7
#21 lore raw

Re: [PATCH 5/7] drm/msm/dpu: drop DPU_INTF_TE feature flag

Quoted 4 lines · Dmitry Baryshkov

Replace the only user of the DPU_INTF_TE feature flag with the direct DPU version comparison.

Quoted 11 lines
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 4 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c       | 1 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h       | 2 --
 3 files changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0 -0
index 9589fe719452..60d4dd88725e 100644

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c struct dpu_encoder_phys *dpu_encoder_phys_cmd_init( · line 780

Quoted 7 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +2 -2
@@ -776,8 +776,8 @@ struct dpu_encoder_phys *dpu_encoder_phys_cmd_init(
 	phys_enc->intf_mode = INTF_MODE_CMD;
 	cmd_enc->stream_sel = 0;
 
-	phys_enc->has_intf_te = test_bit(DPU_INTF_TE,
-					 &phys_enc->hw_intf->cap->features);
+	if (phys_enc->dpu_kms->catalog->mdss_ver->core_major_ver >= 5)
+		phys_enc->has_intf_te = true;

We could also check if the INTF block has the callbacks (which it based on the presence of the interrupt line in the catalog instead), but then I think we might loose some extra validation which you tidied up in a later patch in this series?

Quoted 38 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0 -0
 	atomic_set(&cmd_enc->pending_vblank_cnt, 0);
 	init_waitqueue_head(&cmd_enc->pending_vblank_wq);
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c +0 -1
index c19dc70d4456..17426f0f981e 100644
@@ -100,7 +100,6 @@
 
 #define INTF_SC7180_MASK \
 	(BIT(DPU_INTF_INPUT_CTRL) | \
-	 BIT(DPU_INTF_TE) | \
 	 BIT(DPU_INTF_STATUS_SUPPORTED) | \
 	 BIT(DPU_DATA_HCTL_EN))
 
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h +0 -2
index a6f8eee58b92..69c9099cf5a6 100644
@@ -175,7 +175,6 @@ enum {
  * INTF sub-blocks
  * @DPU_INTF_INPUT_CTRL             Supports the setting of pp block from which
  *                                  pixel data arrives to this INTF
- * @DPU_INTF_TE                     INTF block has TE configuration support
  * @DPU_DATA_HCTL_EN                Allows data to be transferred at different rate
  *                                  than video timing
  * @DPU_INTF_STATUS_SUPPORTED       INTF block has INTF_STATUS register
@@ -183,7 +182,6 @@ enum {
  */
 enum {
 	DPU_INTF_INPUT_CTRL = 0x1,
-	DPU_INTF_TE,
 	DPU_DATA_HCTL_EN,
 	DPU_INTF_STATUS_SUPPORTED,
 	DPU_INTF_MAX
Signature · 1 line
2.39.2
#22 lore raw

Re: [PATCH 5/7] drm/msm/dpu: drop DPU_INTF_TE feature flag

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

Replace the only user of the DPU_INTF_TE feature flag with the direct DPU version comparison.

Quoted 14 lines
---
  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 4 ++--
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c       | 1 -
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h       | 2 --
  3 files changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0 -0
index 9589fe719452..60d4dd88725e 100644
@@ -776,8 +776,8 @@ struct dpu_encoder_phys *dpu_encoder_phys_cmd_init(
  	phys_enc->intf_mode = INTF_MODE_CMD;
  	cmd_enc->stream_sel = 0;
 
Quoted 9 lines

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c struct dpu_encoder_phys *dpu_encoder_phys_cmd_init( · line 780

Quoted 4 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +2 -2
-	phys_enc->has_intf_te = test_bit(DPU_INTF_TE,
-					 &phys_enc->hw_intf->cap->features);
+	if (phys_enc->dpu_kms->catalog->mdss_ver->core_major_ver >= 5)
+		phys_enc->has_intf_te = true;

We could also check if the INTF block has the callbacks (which it based on the presence of the interrupt line in the catalog instead), but then I think we might loose some extra validation which you tidied up in a later patch in this series?

Almost. The logic was the following: we should be using INTF for DPU >= 5.0. And if we have DPU >= 5.0 and no callbacks, it's an error.

Quoted 39 lines
Quoted 39 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0 -0
  	atomic_set(&cmd_enc->pending_vblank_cnt, 0);
  	init_waitqueue_head(&cmd_enc->pending_vblank_wq);
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c +0 -1
index c19dc70d4456..17426f0f981e 100644
@@ -100,7 +100,6 @@
 
  #define INTF_SC7180_MASK \
  	(BIT(DPU_INTF_INPUT_CTRL) | \
-	 BIT(DPU_INTF_TE) | \
  	 BIT(DPU_INTF_STATUS_SUPPORTED) | \
  	 BIT(DPU_DATA_HCTL_EN))
 
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h +0 -2
index a6f8eee58b92..69c9099cf5a6 100644
@@ -175,7 +175,6 @@ enum {
   * INTF sub-blocks
   * @DPU_INTF_INPUT_CTRL             Supports the setting of pp block from which
   *                                  pixel data arrives to this INTF
- * @DPU_INTF_TE                     INTF block has TE configuration support
   * @DPU_DATA_HCTL_EN                Allows data to be transferred at different rate
   *                                  than video timing
   * @DPU_INTF_STATUS_SUPPORTED       INTF block has INTF_STATUS register
@@ -183,7 +182,6 @@ enum {
   */
  enum {
  	DPU_INTF_INPUT_CTRL = 0x1,
-	DPU_INTF_TE,
  	DPU_DATA_HCTL_EN,
  	DPU_INTF_STATUS_SUPPORTED,
  	DPU_INTF_MAX
Signature · 1 line
2.39.2
Signature · 2 lines
With best wishes
Dmitry
#23 lore raw

Re: [PATCH 5/7] drm/msm/dpu: drop DPU_INTF_TE feature flag

Quoted 33 lines · Dmitry Baryshkov
Quoted 22 lines · Marijn Suijten
Quoted 4 lines · Dmitry Baryshkov

Replace the only user of the DPU_INTF_TE feature flag with the direct DPU version comparison.

Quoted 14 lines
---
  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 4 ++--
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c       | 1 -
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h       | 2 --
  3 files changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0 -0
index 9589fe719452..60d4dd88725e 100644
@@ -776,8 +776,8 @@ struct dpu_encoder_phys *dpu_encoder_phys_cmd_init(
  	phys_enc->intf_mode = INTF_MODE_CMD;
  	cmd_enc->stream_sel = 0;
 
Quoted 9 lines

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c struct dpu_encoder_phys *dpu_encoder_phys_cmd_init( · line 780

Quoted 4 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +2 -2
-	phys_enc->has_intf_te = test_bit(DPU_INTF_TE,
-					 &phys_enc->hw_intf->cap->features);
+	if (phys_enc->dpu_kms->catalog->mdss_ver->core_major_ver >= 5)
+		phys_enc->has_intf_te = true;

We could also check if the INTF block has the callbacks (which it based on the presence of the interrupt line in the catalog instead), but then I think we might loose some extra validation which you tidied up in a later patch in this series?

Quoted 2 lines

Almost. The logic was the following: we should be using INTF for DPU >= 5.0. And if we have DPU >= 5.0 and no callbacks, it's an error.

Indeed. Let's keep that validation just in case.

- Marijn

#24 lore raw

PATCH 6/7 drm/msm/dpu: drop useless check from dpu_encoder_phys_cmd_te_rd_ptr_irq()

In reply to Dmitry Baryshkov

The dpu_encoder_phys_cmd_te_rd_ptr_irq() function uses neither hw_intf nor hw_pp data, so we can drop the corresponding check.

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0 -8
index 60d4dd88725e..04a1106101a7 100644
@@ -108,14 +108,6 @@ static void dpu_encoder_phys_cmd_te_rd_ptr_irq(void *arg)
 	struct dpu_encoder_phys *phys_enc = arg;
 	struct dpu_encoder_phys_cmd *cmd_enc;
 
-	if (phys_enc->has_intf_te) {
-		if (!phys_enc->hw_intf)
-			return;
-	} else {
-		if (!phys_enc->hw_pp)
-			return;
-	}
-
 	DPU_ATRACE_BEGIN("rd_ptr_irq");
 	cmd_enc = to_dpu_encoder_phys_cmd(phys_enc);
 
Signature · 1 line
2.39.2
reviewer Reviewed-by on v1 6/7
#25 lore raw

Re: [PATCH 6/7] drm/msm/dpu: drop useless check from dpu_encoder_phys_cmd_te_rd_ptr_irq()

Quoted 2 lines · Dmitry Baryshkov

The dpu_encoder_phys_cmd_te_rd_ptr_irq() function uses neither hw_intf nor hw_pp data, so we can drop the corresponding check.

Maybe because it would catch "bogus" interrupts, or these blocks are accessed somewhere down the line in the vblank callback chain? I have no clue :)

Quoted 2 lines
Quoted 26 lines
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0 -8
index 60d4dd88725e..04a1106101a7 100644
@@ -108,14 +108,6 @@ static void dpu_encoder_phys_cmd_te_rd_ptr_irq(void *arg)
 	struct dpu_encoder_phys *phys_enc = arg;
 	struct dpu_encoder_phys_cmd *cmd_enc;
 
-	if (phys_enc->has_intf_te) {
-		if (!phys_enc->hw_intf)
-			return;
-	} else {
-		if (!phys_enc->hw_pp)
-			return;
-	}
-
 	DPU_ATRACE_BEGIN("rd_ptr_irq");
 	cmd_enc = to_dpu_encoder_phys_cmd(phys_enc);
 
Signature · 1 line
2.39.2
#26 lore raw

PATCH 7/7 drm/msm/dpu: move INTF tearing checks to dpu_encoder_phys_cmd_init

In reply to Dmitry Baryshkov

As the INTF is fixed at the encoder creation time, we can move the check whether INTF supports tearchck to dpu_encoder_phys_cmd_init(). This function can return an error if INTF doesn't have required feature. Performing this check in dpu_encoder_phys_cmd_tearcheck_config() is less useful, as this function returns void.

---
 .../drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c  | 37 +++++++++++--------
 1 file changed, 21 insertions(+), 16 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +21 -16
index 04a1106101a7..e1dd0e1b4793 100644
@@ -325,24 +325,17 @@ static void dpu_encoder_phys_cmd_tearcheck_config(
 	unsigned long vsync_hz;
 	struct dpu_kms *dpu_kms;
 
-	if (phys_enc->has_intf_te) {
-		if (!phys_enc->hw_intf ||
-		    !phys_enc->hw_intf->ops.enable_tearcheck) {
-			DPU_DEBUG_CMDENC(cmd_enc, "tearcheck not supported\n");
-			return;
-		}
-
-		DPU_DEBUG_CMDENC(cmd_enc, "");
-	} else {
-		if (!phys_enc->hw_pp ||
-		    !phys_enc->hw_pp->ops.enable_tearcheck) {
-			DPU_DEBUG_CMDENC(cmd_enc, "tearcheck not supported\n");
-			return;
-		}
-
-		DPU_DEBUG_CMDENC(cmd_enc, "pp %d\n", phys_enc->hw_pp->idx - PINGPONG_0);
+	if (!phys_enc->has_intf_te &&
+	    (!phys_enc->hw_pp ||
+	     !phys_enc->hw_pp->ops.enable_tearcheck)) {
+		DPU_DEBUG_CMDENC(cmd_enc, "tearcheck not supported\n");
+		return;
 	}
 
+	DPU_DEBUG_CMDENC(cmd_enc, "intf %d pp %d\n",
+			 phys_enc->hw_intf->idx - INTF_0,
+			 phys_enc->hw_pp->idx - PINGPONG_0);
+
 	mode = &phys_enc->cached_mode;
 
 	dpu_kms = phys_enc->dpu_kms;
@@ -768,9 +761,21 @@ struct dpu_encoder_phys *dpu_encoder_phys_cmd_init(
 	phys_enc->intf_mode = INTF_MODE_CMD;
 	cmd_enc->stream_sel = 0;
 
+	if (!phys_enc->hw_intf) {
+		DPU_ERROR_CMDENC(cmd_enc, "no INTF provided\n");
+
+		return ERR_PTR(-EINVAL);
+	}
+
 	if (phys_enc->dpu_kms->catalog->mdss_ver->core_major_ver >= 5)
 		phys_enc->has_intf_te = true;
 
+	if (phys_enc->has_intf_te && !phys_enc->hw_intf->ops.enable_tearcheck) {
+		DPU_ERROR_CMDENC(cmd_enc, "tearcheck not supported\n");
+
+		return ERR_PTR(-EINVAL);
+	}
+
 	atomic_set(&cmd_enc->pending_vblank_cnt, 0);
 	init_waitqueue_head(&cmd_enc->pending_vblank_wq);
 
Signature · 1 line
2.39.2
#27 lore raw

Re: [PATCH 7/7] drm/msm/dpu: move INTF tearing checks to dpu_encoder_phys_cmd_init

Quoted 28 lines · Dmitry Baryshkov

As the INTF is fixed at the encoder creation time, we can move the check whether INTF supports tearchck to dpu_encoder_phys_cmd_init(). This function can return an error if INTF doesn't have required feature. Performing this check in dpu_encoder_phys_cmd_tearcheck_config() is less useful, as this function returns void.

---
 .../drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c  | 37 +++++++++++--------
 1 file changed, 21 insertions(+), 16 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0 -9
index 04a1106101a7..e1dd0e1b4793 100644
@@ -325,24 +325,17 @@ static void dpu_encoder_phys_cmd_tearcheck_config(
 	unsigned long vsync_hz;
 	struct dpu_kms *dpu_kms;
 
-	if (phys_enc->has_intf_te) {
-		if (!phys_enc->hw_intf ||
-		    !phys_enc->hw_intf->ops.enable_tearcheck) {
-			DPU_DEBUG_CMDENC(cmd_enc, "tearcheck not supported\n");
-			return;
-		}
-
-		DPU_DEBUG_CMDENC(cmd_enc, "");
-	} else {

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c static void dpu_encoder_phys_cmd_tearcheck_config( · line 330

Quoted 10 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +3 -7
-		if (!phys_enc->hw_pp ||
-		    !phys_enc->hw_pp->ops.enable_tearcheck) {
-			DPU_DEBUG_CMDENC(cmd_enc, "tearcheck not supported\n");
-			return;
-		}
-
-		DPU_DEBUG_CMDENC(cmd_enc, "pp %d\n", phys_enc->hw_pp->idx - PINGPONG_0);
+	if (!phys_enc->has_intf_te &&
+	    (!phys_enc->hw_pp ||
+	     !phys_enc->hw_pp->ops.enable_tearcheck)) {

when is hw_pp assigned? Can't we also check that somewhere in an init phase?

Also, you won't go over 100 chars (not even 80) by having the (!... || !...) on a single line.

Quoted 15 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +6 -0
+		DPU_DEBUG_CMDENC(cmd_enc, "tearcheck not supported\n");
+		return;
 	}
 
+	DPU_DEBUG_CMDENC(cmd_enc, "intf %d pp %d\n",
+			 phys_enc->hw_intf->idx - INTF_0,
+			 phys_enc->hw_pp->idx - PINGPONG_0);
+
 	mode = &phys_enc->cached_mode;
 
 	dpu_kms = phys_enc->dpu_kms;
@@ -768,9 +761,21 @@ struct dpu_encoder_phys *dpu_encoder_phys_cmd_init(
 	phys_enc->intf_mode = INTF_MODE_CMD;
 	cmd_enc->stream_sel = 0;
 

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c struct dpu_encoder_phys *dpu_encoder_phys_cmd_init( · line 773

Quoted 10 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +7 -0
+	if (!phys_enc->hw_intf) {
+		DPU_ERROR_CMDENC(cmd_enc, "no INTF provided\n");
+
+		return ERR_PTR(-EINVAL);
+	}
+
 	if (phys_enc->dpu_kms->catalog->mdss_ver->core_major_ver >= 5)
 		phys_enc->has_intf_te = true;
 
+	if (phys_enc->has_intf_te && !phys_enc->hw_intf->ops.enable_tearcheck) {

Any other callbacks we could check here, and remove the checks elsewhere?

As with enable_tearcheck() though, it does make the code less consistent with its PP counterpart, which is checked ad-hoc everywhere (but maybe that is fixable too).

- Marijn

Quoted 11 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +5 -0
+		DPU_ERROR_CMDENC(cmd_enc, "tearcheck not supported\n");
+
+		return ERR_PTR(-EINVAL);
+	}
+
 	atomic_set(&cmd_enc->pending_vblank_cnt, 0);
 	init_waitqueue_head(&cmd_enc->pending_vblank_wq);
 
Signature · 1 line
2.39.2
#28 lore raw

Re: [PATCH 7/7] drm/msm/dpu: move INTF tearing checks to dpu_encoder_phys_cmd_init

Quoted 34 lines · Marijn Suijten
Quoted 33 lines · Dmitry Baryshkov

As the INTF is fixed at the encoder creation time, we can move the check whether INTF supports tearchck to dpu_encoder_phys_cmd_init(). This function can return an error if INTF doesn't have required feature. Performing this check in dpu_encoder_phys_cmd_tearcheck_config() is less useful, as this function returns void.

---
 .../drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c  | 37 +++++++++++--------
 1 file changed, 21 insertions(+), 16 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0 -14
index 04a1106101a7..e1dd0e1b4793 100644
@@ -325,24 +325,17 @@ static void dpu_encoder_phys_cmd_tearcheck_config(
 	unsigned long vsync_hz;
 	struct dpu_kms *dpu_kms;
 
-	if (phys_enc->has_intf_te) {
-		if (!phys_enc->hw_intf ||
-		    !phys_enc->hw_intf->ops.enable_tearcheck) {
-			DPU_DEBUG_CMDENC(cmd_enc, "tearcheck not supported\n");
-			return;
-		}
-
-		DPU_DEBUG_CMDENC(cmd_enc, "");
-	} else {
-		if (!phys_enc->hw_pp ||
-		    !phys_enc->hw_pp->ops.enable_tearcheck) {
-			DPU_DEBUG_CMDENC(cmd_enc, "tearcheck not supported\n");
-			return;
-		}
Quoted 8 lines

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c static void dpu_encoder_phys_cmd_tearcheck_config( · line 330

Quoted 5 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +3 -2
-
-		DPU_DEBUG_CMDENC(cmd_enc, "pp %d\n", phys_enc->hw_pp->idx - PINGPONG_0);
+	if (!phys_enc->has_intf_te &&
+	    (!phys_enc->hw_pp ||
+	     !phys_enc->hw_pp->ops.enable_tearcheck)) {

when is hw_pp assigned? Can't we also check that somewhere in an init phase?

It would happen right before dpu_encoder_phys_cmd_atomic_mode_set() where we already happen to check has_intf_te to switch on PP intr_readptr vs INTF intr_tear_rd_ptr. Might be the perfect place for the pingpong callback checks?

- Marijn

Quoted 50 lines

Also, you won't go over 100 chars (not even 80) by having the (!... || !...) on a single line.

Quoted 15 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +6 -0
+		DPU_DEBUG_CMDENC(cmd_enc, "tearcheck not supported\n");
+		return;
 	}
 
+	DPU_DEBUG_CMDENC(cmd_enc, "intf %d pp %d\n",
+			 phys_enc->hw_intf->idx - INTF_0,
+			 phys_enc->hw_pp->idx - PINGPONG_0);
+
 	mode = &phys_enc->cached_mode;
 
 	dpu_kms = phys_enc->dpu_kms;
@@ -768,9 +761,21 @@ struct dpu_encoder_phys *dpu_encoder_phys_cmd_init(
 	phys_enc->intf_mode = INTF_MODE_CMD;
 	cmd_enc->stream_sel = 0;
 

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c struct dpu_encoder_phys *dpu_encoder_phys_cmd_init( · line 773

Quoted 10 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +7 -0
+	if (!phys_enc->hw_intf) {
+		DPU_ERROR_CMDENC(cmd_enc, "no INTF provided\n");
+
+		return ERR_PTR(-EINVAL);
+	}
+
 	if (phys_enc->dpu_kms->catalog->mdss_ver->core_major_ver >= 5)
 		phys_enc->has_intf_te = true;
 
+	if (phys_enc->has_intf_te && !phys_enc->hw_intf->ops.enable_tearcheck) {

Any other callbacks we could check here, and remove the checks elsewhere?

As with enable_tearcheck() though, it does make the code less consistent with its PP counterpart, which is checked ad-hoc everywhere (but maybe that is fixable too).

- Marijn

Quoted 11 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +5 -0
+		DPU_ERROR_CMDENC(cmd_enc, "tearcheck not supported\n");
+
+		return ERR_PTR(-EINVAL);
+	}
+
 	atomic_set(&cmd_enc->pending_vblank_cnt, 0);
 	init_waitqueue_head(&cmd_enc->pending_vblank_wq);
 
Signature · 1 line
2.39.2
#29 lore raw

Re: [PATCH 7/7] drm/msm/dpu: move INTF tearing checks to dpu_encoder_phys_cmd_init

Quoted 44 lines · Marijn Suijten
Quoted 34 lines · Marijn Suijten
Quoted 33 lines · Dmitry Baryshkov

As the INTF is fixed at the encoder creation time, we can move the check whether INTF supports tearchck to dpu_encoder_phys_cmd_init(). This function can return an error if INTF doesn't have required feature. Performing this check in dpu_encoder_phys_cmd_tearcheck_config() is less useful, as this function returns void.

---
  .../drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c  | 37 +++++++++++--------
  1 file changed, 21 insertions(+), 16 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0 -14
index 04a1106101a7..e1dd0e1b4793 100644
@@ -325,24 +325,17 @@ static void dpu_encoder_phys_cmd_tearcheck_config(
  	unsigned long vsync_hz;
  	struct dpu_kms *dpu_kms;
 
-	if (phys_enc->has_intf_te) {
-		if (!phys_enc->hw_intf ||
-		    !phys_enc->hw_intf->ops.enable_tearcheck) {
-			DPU_DEBUG_CMDENC(cmd_enc, "tearcheck not supported\n");
-			return;
-		}
-
-		DPU_DEBUG_CMDENC(cmd_enc, "");
-	} else {
-		if (!phys_enc->hw_pp ||
-		    !phys_enc->hw_pp->ops.enable_tearcheck) {
-			DPU_DEBUG_CMDENC(cmd_enc, "tearcheck not supported\n");
-			return;
-		}
Quoted 8 lines

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c static void dpu_encoder_phys_cmd_tearcheck_config( · line 330

Quoted 5 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +3 -2
-
-		DPU_DEBUG_CMDENC(cmd_enc, "pp %d\n", phys_enc->hw_pp->idx - PINGPONG_0);
+	if (!phys_enc->has_intf_te &&
+	    (!phys_enc->hw_pp ||
+	     !phys_enc->hw_pp->ops.enable_tearcheck)) {

when is hw_pp assigned? Can't we also check that somewhere in an init phase?

Quoted 4 lines

It would happen right before dpu_encoder_phys_cmd_atomic_mode_set() where we already happen to check has_intf_te to switch on PP intr_readptr vs INTF intr_tear_rd_ptr. Might be the perfect place for the pingpong callback checks?

The problem is that mode_set doesn't return an error (by design). I'd put a TODO here, so that if we ever move/change resource allocation, this check can be done next to it (atomic_check isn't a good place, since phys_enc.atomic_check happens before resource reallocation).

Quoted 53 lines

- Marijn

Quoted 50 lines

Also, you won't go over 100 chars (not even 80) by having the (!... || !...) on a single line.

Quoted 15 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +6 -0
+		DPU_DEBUG_CMDENC(cmd_enc, "tearcheck not supported\n");
+		return;
  	}
 
+	DPU_DEBUG_CMDENC(cmd_enc, "intf %d pp %d\n",
+			 phys_enc->hw_intf->idx - INTF_0,
+			 phys_enc->hw_pp->idx - PINGPONG_0);
+
  	mode = &phys_enc->cached_mode;
 
  	dpu_kms = phys_enc->dpu_kms;
@@ -768,9 +761,21 @@ struct dpu_encoder_phys *dpu_encoder_phys_cmd_init(
  	phys_enc->intf_mode = INTF_MODE_CMD;
  	cmd_enc->stream_sel = 0;
 

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c struct dpu_encoder_phys *dpu_encoder_phys_cmd_init( · line 773

Quoted 10 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +7 -0
+	if (!phys_enc->hw_intf) {
+		DPU_ERROR_CMDENC(cmd_enc, "no INTF provided\n");
+
+		return ERR_PTR(-EINVAL);
+	}
+
  	if (phys_enc->dpu_kms->catalog->mdss_ver->core_major_ver >= 5)
  		phys_enc->has_intf_te = true;
 
+	if (phys_enc->has_intf_te && !phys_enc->hw_intf->ops.enable_tearcheck) {

Any other callbacks we could check here, and remove the checks elsewhere?

As with enable_tearcheck() though, it does make the code less consistent with its PP counterpart, which is checked ad-hoc everywhere (but maybe that is fixable too).

- Marijn

Quoted 11 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +5 -0
+		DPU_ERROR_CMDENC(cmd_enc, "tearcheck not supported\n");
+
+		return ERR_PTR(-EINVAL);
+	}
+
  	atomic_set(&cmd_enc->pending_vblank_cnt, 0);
  	init_waitqueue_head(&cmd_enc->pending_vblank_wq);
 
Signature · 1 line
2.39.2
Signature · 2 lines
With best wishes
Dmitry
#30 lore raw

Re: [PATCH 7/7] drm/msm/dpu: move INTF tearing checks to dpu_encoder_phys_cmd_init

On 2023-07-30 03:16:59, Dmitry Baryshkov wrote:
<snip>

Quoted 12 lines
Quoted 11 lines
Quoted 6 lines

drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c static void dpu_encoder_phys_cmd_tearcheck_config( · line 330

Quoted 3 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +3 -0
+	if (!phys_enc->has_intf_te &&
+	    (!phys_enc->hw_pp ||
+	     !phys_enc->hw_pp->ops.enable_tearcheck)) {

when is hw_pp assigned? Can't we also check that somewhere in an init phase?

It would happen right before dpu_encoder_phys_cmd_atomic_mode_set() where we already happen to check has_intf_te to switch on PP intr_readptr vs INTF intr_tear_rd_ptr. Might be the perfect place for the pingpong callback checks?

Quoted 4 lines

The problem is that mode_set doesn't return an error (by design). I'd put a TODO here, so that if we ever move/change resource allocation, this check can be done next to it (atomic_check isn't a good place, since phys_enc.atomic_check happens before resource reallocation).

As thought of in another patch, perhaps it could just be a WARN_ON() as these almost always relate directly to constant information provided by the catalog, which we trust to be sound (and these error cases to hardly be reachable) after it has been validated, reviewed and merged.

- Marijn