Skip to contentSkip to conversation

drm/amd/display: Remove aconnector condition check for dpcd read

PATCH In review Zhan Liu 2 participants 3 messages Apr 16, 2020 – Apr 20, 2020

Subsystems (3)
lore
Share & tools
lore

Zhan Liu

author
#0 lore raw

PATCH 1/1 drm/amd/display: Remove aconnector condition check for dpcd read

[Why]
Aconnector is not necessary to be NULL in order to read dpcd successfully.

Actually if we rely on checking aconnector here, we won't be able to turn off all displays before doing display detection. That will cause some MST hubs not able to light up.

[How]
Remove aconnector check when turning off all displays at hardware initialization stage.

---
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 36 ++++++++-----------
 1 file changed, 14 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +14 -22
index 9f41efddc9bc..6f33f3f0d023 100644
@@ -1332,31 +1332,23 @@ void dcn10_init_hw(struct dc *dc)
 			if (dc->links[i]->connector_signal != SIGNAL_TYPE_DISPLAY_PORT)
 				continue;
 
-			/*
-			 * core_link_read_dpcd() will invoke dm_helpers_dp_read_dpcd(),
-			 * which needs to read dpcd info with the help of aconnector.
-			 * If aconnector (dc->links[i]->prev) is NULL, then dpcd status
-			 * cannot be read.
-			 */
-			if (dc->links[i]->priv) {
-				/* if any of the displays are lit up turn them off */
-				status = core_link_read_dpcd(dc->links[i], DP_SET_POWER,
-								&dpcd_power_state, sizeof(dpcd_power_state));
-				if (status == DC_OK && dpcd_power_state == DP_POWER_STATE_D0) {
-					/* blank dp stream before power off receiver*/
-					if (dc->links[i]->link_enc->funcs->get_dig_frontend) {
-						unsigned int fe = dc->links[i]->link_enc->funcs->get_dig_frontend(dc->links[i]->link_enc);
-
-						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->res_pool->stream_enc[j]);
-								break;
-							}
+			/* if any of the displays are lit up turn them off */
+			status = core_link_read_dpcd(dc->links[i], DP_SET_POWER,
+							&dpcd_power_state, sizeof(dpcd_power_state));
+			if (status == DC_OK && dpcd_power_state == DP_POWER_STATE_D0) {
+				/* blank dp stream before power off receiver*/
+				if (dc->links[i]->link_enc->funcs->get_dig_frontend) {
+					unsigned int fe = dc->links[i]->link_enc->funcs->get_dig_frontend(dc->links[i]->link_enc);
+
+					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->res_pool->stream_enc[j]);
+							break;
 						}
 					}
-					dp_receiver_power_ctrl(dc->links[i], false);
 				}
+				dp_receiver_power_ctrl(dc->links[i], false);
 			}
 		}
 	}
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#1 lore raw

+ Joseph

Hi Joseph,

Would you like to help me review this change? This was a follow-up on the discussion we had earlier this year.

Thanks,
Zhan

Quoted 102 lines

-----Original Message-----
From: Liu, Zhan <[email protected]>
Sent: 2020/April/16, Thursday 3:24 PM
To: [email protected]; Liu, Zhan <[email protected]>
Subject: [PATCH] drm/amd/display: Remove aconnector condition check for dpcd read

[Why]
Aconnector is not necessary to be NULL in order to read dpcd successfully.

Actually if we rely on checking aconnector here, we won't be able to turn off all displays before doing display detection. That will cause some MST hubs not able to light up.

[How]
Remove aconnector check when turning off all displays at hardware initialization stage.

---
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 36 ++++++++-----------
 1 file changed, 14 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +0 -3
index 9f41efddc9bc..6f33f3f0d023 100644
@@ -1332,31 +1332,23 @@ void dcn10_init_hw(struct dc *dc)
 			if (dc->links[i]->connector_signal !=
 SIGNAL_TYPE_DISPLAY_PORT)
 				continue;
 
-			/*
-			 * core_link_read_dpcd() will invoke
 dm_helpers_dp_read_dpcd(),
-			 * which needs to read dpcd info with the help of

aconnector.

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +0 -1
-			 * If aconnector (dc->links[i]->prev) is NULL, then

dpcd status

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +0 -4
-			 * cannot be read.
-			 */
-			if (dc->links[i]->priv) {
-				/* if any of the displays are lit up turn them

off */

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +0 -1
-				status = core_link_read_dpcd(dc->links[i],

DP_SET_POWER,
-

	&dpcd_power_state, sizeof(dpcd_power_state));
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +0 -1
-				if (status == DC_OK && dpcd_power_state ==

DP_POWER_STATE_D0) {

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +0 -1
-					/* blank dp stream before power off

receiver*/

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +0 -1
-					if (dc->links[i]->link_enc->funcs-
Quoted 1 line

get_dig_frontend) {

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +0 -1
-						unsigned int fe = dc->links[i]-
Quoted 1 line

link_enc->funcs->get_dig_frontend(dc->links[i]->link_enc);

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +0 -2
-
-						for (j = 0; j < dc->res_pool-
Quoted 1 line

stream_enc_count; j++) {

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +0 -1
-							if (fe == dc-
Quoted 1 line

res_pool->stream_enc[j]->id) {

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +0 -1
-								dc-
Quoted 1 line

res_pool->stream_enc[j]->funcs->dp_blank(

-

		dc->res_pool->stream_enc[j]);
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +2 -2
-								break;
-							}
+			/* if any of the displays are lit up turn them off */
+			status = core_link_read_dpcd(dc->links[i],

DP_SET_POWER,

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +1 -0
+							&dpcd_power_state,

sizeof(dpcd_power_state));

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +1 -0
+			if (status == DC_OK && dpcd_power_state ==

DP_POWER_STATE_D0) {

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +1 -0
+				/* blank dp stream before power off

receiver*/

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +1 -0
+				if (dc->links[i]->link_enc->funcs-
Quoted 1 line

get_dig_frontend) {

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +5 -0
+					unsigned int fe =
+dc->links[i]->link_enc->funcs->get_dig_frontend(dc->links[i]->link_enc)
+;
+
+					for (j = 0; j < dc->res_pool-
Quoted 1 line

stream_enc_count; j++) {

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +1 -0
+						if (fe == dc->res_pool-
Quoted 1 line

stream_enc[j]->id) {

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +1 -0
+							dc->res_pool-
Quoted 1 line

stream_enc[j]->funcs->dp_blank(

+

	dc->res_pool->stream_enc[j]);
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +1 -1
+							break;
 						}
 					}
-					dp_receiver_power_ctrl(dc->links[i],

false);

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +1 -1
 				}
+				dp_receiver_power_ctrl(dc->links[i], false);
 			}
 		}
 	}
--
Quoted 1 line

2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by
#2 lore raw

[AMD Official Use Only - Internal Distribution Only]

________________________________
From: Liu, Zhan <[email protected]>
Sent: Friday, April 17, 2020 1:17 PM
To: Liu, Zhan <[email protected]>; [email protected] <[email protected]>; Gravenor, Joseph <[email protected]>
Subject: RE: [PATCH] drm/amd/display: Remove aconnector condition check for dpcd read

+ Joseph

Hi Joseph,

Would you like to help me review this change? This was a follow-up on the discussion we had earlier this year.

Thanks,
Zhan

Quoted 101 lines

-----Original Message-----
From: Liu, Zhan <[email protected]>
Sent: 2020/April/16, Thursday 3:24 PM
To: [email protected]; Liu, Zhan <[email protected]>
Subject: [PATCH] drm/amd/display: Remove aconnector condition check for dpcd read

[Why]
Aconnector is not necessary to be NULL in order to read dpcd successfully.

Actually if we rely on checking aconnector here, we won't be able to turn off all displays before doing display detection. That will cause some MST hubs not able to light up.

[How]
Remove aconnector check when turning off all displays at hardware initialization stage.

---
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 36 ++++++++-----------
 1 file changed, 14 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +0 -3
index 9f41efddc9bc..6f33f3f0d023 100644
@@ -1332,31 +1332,23 @@ void dcn10_init_hw(struct dc *dc)
                       if (dc->links[i]->connector_signal !=
 SIGNAL_TYPE_DISPLAY_PORT)
                               continue;
 
-                     /*
-                      * core_link_read_dpcd() will invoke
 dm_helpers_dp_read_dpcd(),
-                      * which needs to read dpcd info with the help of

aconnector.
- * If aconnector (dc->links[i]->prev) is NULL, then
dpcd status

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +0 -4
-                      * cannot be read.
-                      */
-                     if (dc->links[i]->priv) {
-                             /* if any of the displays are lit up turn them

off */
- status = core_link_read_dpcd(dc->links[i],
DP_SET_POWER,

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +0 -2
-
       &dpcd_power_state, sizeof(dpcd_power_state));
-                             if (status == DC_OK && dpcd_power_state ==

DP_POWER_STATE_D0) {
- /* blank dp stream before power off
receiver*/
- if (dc->links[i]->link_enc->funcs-

Quoted 1 line

get_dig_frontend) {

- unsigned int fe = dc->links[i]-

Quoted 1 line

link_enc->funcs->get_dig_frontend(dc->links[i]->link_enc);

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +0 -2
-
-                                             for (j = 0; j < dc->res_pool-
Quoted 1 line

stream_enc_count; j++) {

- if (fe == dc-

Quoted 1 line

res_pool->stream_enc[j]->id) {

- dc-

Quoted 1 line

res_pool->stream_enc[j]->funcs->dp_blank(

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +2 -3
-
               dc->res_pool->stream_enc[j]);
-                                                             break;
-                                                     }
+                     /* if any of the displays are lit up turn them off */
+                     status = core_link_read_dpcd(dc->links[i],

DP_SET_POWER,
+ &dpcd_power_state,
sizeof(dpcd_power_state));
+ if (status == DC_OK && dpcd_power_state ==
DP_POWER_STATE_D0) {
+ /* blank dp stream before power off
receiver*/
+ if (dc->links[i]->link_enc->funcs-

Quoted 1 line

get_dig_frontend) {

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +5 -0
+                                     unsigned int fe =
+dc->links[i]->link_enc->funcs->get_dig_frontend(dc->links[i]->link_enc)
+;
+
+                                     for (j = 0; j < dc->res_pool-
Quoted 1 line

stream_enc_count; j++) {

+ if (fe == dc->res_pool-

Quoted 1 line

stream_enc[j]->id) {

+ dc->res_pool-

Quoted 1 line

stream_enc[j]->funcs->dp_blank(

drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +2 -1
+
       dc->res_pool->stream_enc[j]);
+                                                     break;
                                               }
                                       }
-                                     dp_receiver_power_ctrl(dc->links[i],
false);
                               }
+                             dp_receiver_power_ctrl(dc->links[i], false);
                       }
               }
       }
Quoted 2 lines

--
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx