Re: [PATCH 27/27] Revert "drm/amd/display: Add helper for blanking all dp displays"

2021-10-18 Thread Paul Menzel

Dear Augustin,


Am 15.10.21 um 20:43 schrieb Agustin Gutierrez:

This reverts commit 50ac5b14c74c5706796cb6378f25a2121dba5b2d.

This patch introduced a couple of dmesg warnings,


Please give one example warning for people searching through the git 
history.



this is not a valid approach anymore.


Nit: Please make it it’s own sentence.


For this reason, we are reverting this patch, and we need to revert
the workaround patch.

What is the workaround patch?


Kind regards,

Paul


Cc: Hanghong Ma 
Cc: Mark Broadworth 
Signed-off-by: Agustin Gutierrez 
---
  drivers/gpu/drm/amd/display/dc/core/dc_link.c | 45 ---
  drivers/gpu/drm/amd/display/dc/dc_link.h  |  1 -
  .../display/dc/dce110/dce110_hw_sequencer.c   | 24 --
  .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 41 +++--
  .../drm/amd/display/dc/dcn30/dcn30_hwseq.c| 39 ++--
  .../drm/amd/display/dc/dcn31/dcn31_hwseq.c| 40 +++--
  6 files changed, 131 insertions(+), 59 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
index c01309a1cbf2..e5d6cbd7ea78 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
@@ -1988,51 +1988,6 @@ static enum dc_status enable_link_dp_mst(
return enable_link_dp(state, pipe_ctx);
  }
  
-void blank_all_dp_displays(struct dc *dc, bool hw_init)

-{
-   unsigned int i, j, fe;
-   uint8_t dpcd_power_state = '\0';
-   enum dc_status status = DC_ERROR_UNEXPECTED;
-
-   for (i = 0; i < dc->link_count; i++) {
-   enum signal_type signal = dc->links[i]->connector_signal;
-
-   if ((signal == SIGNAL_TYPE_EDP) ||
-   (signal == SIGNAL_TYPE_DISPLAY_PORT)) {
-   if (hw_init && signal != SIGNAL_TYPE_EDP) {
-   /* DP 2.0 spec requires that we read LTTPR caps 
first */
-   dp_retrieve_lttpr_cap(dc->links[i]);
-   /* if any of the displays are lit up turn them 
off */
-   status = core_link_read_dpcd(dc->links[i], 
DP_SET_POWER,
-   _power_state, 
sizeof(dpcd_power_state));
-   }
-
-   if ((signal != SIGNAL_TYPE_EDP && status == DC_OK && 
dpcd_power_state == DP_POWER_STATE_D0) ||
-   (!hw_init && dc->links[i]->link_enc &&
-   
dc->links[i]->link_enc->funcs->is_dig_enabled(dc->links[i]->link_enc))) {
-   if 
(dc->links[i]->link_enc->funcs->get_dig_frontend) {
-   fe = 
dc->links[i]->link_enc->funcs->get_dig_frontend(dc->links[i]->link_enc);
-   if (fe == ENGINE_ID_UNKNOWN)
-   continue;
-
-   for (j = 0; j < 
dc->res_pool->stream_enc_count; j++) {
-   if (fe == 
dc->res_pool->stream_enc[j]->id) {
-   
dc->res_pool->stream_enc[j]->funcs->dp_blank(dc->links[i],
-   
dc->res_pool->stream_enc[j]);
-   break;
-   }
-   }
-   }
-
-   if 
(!dc->links[i]->wa_flags.dp_keep_receiver_powered ||
-   (hw_init && signal != SIGNAL_TYPE_EDP))
-   dp_receiver_power_ctrl(dc->links[i], 
false);
-   }
-   }
-   }
-
-}
-
  static bool get_ext_hdmi_settings(struct pipe_ctx *pipe_ctx,
enum engine_id eng_id,
struct ext_hdmi_settings *settings)
diff --git a/drivers/gpu/drm/amd/display/dc/dc_link.h 
b/drivers/gpu/drm/amd/display/dc/dc_link.h
index 69b008bafbbc..a73d64b1fd33 100644
--- a/drivers/gpu/drm/amd/display/dc/dc_link.h
+++ b/drivers/gpu/drm/amd/display/dc/dc_link.h
@@ -277,7 +277,6 @@ bool dc_link_setup_psr(struct dc_link *dc_link,
struct psr_context *psr_context);
  
  void dc_link_get_psr_residency(const struct dc_link *link, uint32_t *residency);

-void blank_all_dp_displays(struct dc *dc, bool hw_init);
  
  /* Request DC to detect if there is a Panel connected.

   * boot - If this call is during initial boot.
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c 
b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
index 8108f9ae2638..af3e68d3e747 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
@@ -1649,13 

[PATCH 27/27] Revert "drm/amd/display: Add helper for blanking all dp displays"

2021-10-15 Thread Agustin Gutierrez
This reverts commit 50ac5b14c74c5706796cb6378f25a2121dba5b2d.

This patch introduced a couple of dmesg warnings, this is not a valid
approach anymore. For this reason, we are reverting this patch, and we
need to revert the workaround patch.

Cc: Hanghong Ma 
Cc: Mark Broadworth 
Signed-off-by: Agustin Gutierrez 
---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c | 45 ---
 drivers/gpu/drm/amd/display/dc/dc_link.h  |  1 -
 .../display/dc/dce110/dce110_hw_sequencer.c   | 24 --
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 41 +++--
 .../drm/amd/display/dc/dcn30/dcn30_hwseq.c| 39 ++--
 .../drm/amd/display/dc/dcn31/dcn31_hwseq.c| 40 +++--
 6 files changed, 131 insertions(+), 59 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
index c01309a1cbf2..e5d6cbd7ea78 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
@@ -1988,51 +1988,6 @@ static enum dc_status enable_link_dp_mst(
return enable_link_dp(state, pipe_ctx);
 }
 
-void blank_all_dp_displays(struct dc *dc, bool hw_init)
-{
-   unsigned int i, j, fe;
-   uint8_t dpcd_power_state = '\0';
-   enum dc_status status = DC_ERROR_UNEXPECTED;
-
-   for (i = 0; i < dc->link_count; i++) {
-   enum signal_type signal = dc->links[i]->connector_signal;
-
-   if ((signal == SIGNAL_TYPE_EDP) ||
-   (signal == SIGNAL_TYPE_DISPLAY_PORT)) {
-   if (hw_init && signal != SIGNAL_TYPE_EDP) {
-   /* DP 2.0 spec requires that we read LTTPR caps 
first */
-   dp_retrieve_lttpr_cap(dc->links[i]);
-   /* if any of the displays are lit up turn them 
off */
-   status = core_link_read_dpcd(dc->links[i], 
DP_SET_POWER,
-   _power_state, 
sizeof(dpcd_power_state));
-   }
-
-   if ((signal != SIGNAL_TYPE_EDP && status == DC_OK && 
dpcd_power_state == DP_POWER_STATE_D0) ||
-   (!hw_init && dc->links[i]->link_enc &&
-   
dc->links[i]->link_enc->funcs->is_dig_enabled(dc->links[i]->link_enc))) {
-   if 
(dc->links[i]->link_enc->funcs->get_dig_frontend) {
-   fe = 
dc->links[i]->link_enc->funcs->get_dig_frontend(dc->links[i]->link_enc);
-   if (fe == ENGINE_ID_UNKNOWN)
-   continue;
-
-   for (j = 0; j < 
dc->res_pool->stream_enc_count; j++) {
-   if (fe == 
dc->res_pool->stream_enc[j]->id) {
-   
dc->res_pool->stream_enc[j]->funcs->dp_blank(dc->links[i],
-   
dc->res_pool->stream_enc[j]);
-   break;
-   }
-   }
-   }
-
-   if 
(!dc->links[i]->wa_flags.dp_keep_receiver_powered ||
-   (hw_init && signal != SIGNAL_TYPE_EDP))
-   dp_receiver_power_ctrl(dc->links[i], 
false);
-   }
-   }
-   }
-
-}
-
 static bool get_ext_hdmi_settings(struct pipe_ctx *pipe_ctx,
enum engine_id eng_id,
struct ext_hdmi_settings *settings)
diff --git a/drivers/gpu/drm/amd/display/dc/dc_link.h 
b/drivers/gpu/drm/amd/display/dc/dc_link.h
index 69b008bafbbc..a73d64b1fd33 100644
--- a/drivers/gpu/drm/amd/display/dc/dc_link.h
+++ b/drivers/gpu/drm/amd/display/dc/dc_link.h
@@ -277,7 +277,6 @@ bool dc_link_setup_psr(struct dc_link *dc_link,
struct psr_context *psr_context);
 
 void dc_link_get_psr_residency(const struct dc_link *link, uint32_t 
*residency);
-void blank_all_dp_displays(struct dc *dc, bool hw_init);
 
 /* Request DC to detect if there is a Panel connected.
  * boot - If this call is during initial boot.
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c 
b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
index 8108f9ae2638..af3e68d3e747 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
@@ -1649,13 +1649,31 @@ static enum dc_status apply_single_controller_ctx_to_hw(
 
 static void power_down_encoders(struct dc *dc)
 {
-   int i;
-
-   blank_all_dp_displays(dc, false);
+   int i, j;
 
for (i = 0; i < dc->link_count; i++) {