Skip to contentSkip to conversation

DC Patches April 5, 2020

PATCH In review Rodrigo Siqueira 3 participants 43 messages Apr 5, 2020 – Apr 7, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover DC Patches April 5, 2020

This DC patchset brings improvements in multiple areas. In summary, we highlight:

* Properly map audio to engine on NV14
* Improvements on DMCUB and DML
* Fixes on MST and DP

Alvin Lee (1):
drm/amd/display: Revert to old formula in set_vtg_params

Aric Cyr (3):
drm/amd/display: 3.2.78
drm/amd/display: 3.2.79
drm/amd/display: 3.2.80

Charlene Liu (2):
drm/amd/display: initialize get_max_link_cap drm/amd/display: Properly map audio to engine on NV14

Dale Zhao (1):
drm/amd/display: Don't verify DP caps again

Dmytro Laktyushkin (1):
drm/amd/display: fix dml pipe merge logic

Eric Yang (1):
drm/amd/display: change default pipe_split policy for DCN1

Isabel Zhang (2):
drm/amd/display: Remove hdcp display state with mst fix drm/amd/display: Update stream adjust in dc_stream_adjust_vmin_vmax

Jaehyun Chung (1):
drm/amd/display: Update DRAM watermark before checking to update TTU

Jerry (Fangzhi) Zuo (1):
drm/amd/display: Avoid create MST prop after registration

Joseph Gravenor (1):
drm/amd/display: fix typo

Joshua Aberback (1):
drm/amd/display: Acknowledge wm_optimized_required

Josip Pavic (1):
drm/amd/display: prevent loop from occuring in pipe list

Martin Leung (1):
drm/amd/display: Properly map audio to engine on NV14

Michael Strauss (1):
drm/amd/display: Check for null fclk voltage when parsing clock table

Nicholas Kazlauskas (7):
drm/amd/display: Don't change mpcc tree for medium updates on DCN20
hwseq
drm/amd/display: Translate cursor position by source rect drm/amd/display: Fix incorrect cursor pos on scaled primary plane drm/amd/display: Program viewport when source pos changes for DCN20 hw
seq
drm/amd/display: Calculate scaling ratios on every medium/full update drm/amd/display: Make cursor source translation adjustment optional drm/amd/display: Make DMCUB bss/data firmware blob optional

Nikola Cornij (1):
drm/amd/display: Program DSC before enabling link

Stylon Wang (1):
drm/amd/display: Refactor color management to take dm plane state

Sung Lee (2):
drm/amd/display: Power down hw blocks on boot drm/amd/display: Check power_down functions exist before calling

Wenjing Liu (1):
drm/amd/display: determine USB C DP2 mode only when USB DP Alt is
enabled

Wyatt Wood (4):
drm/amd/display: Implement abm config table copy to dmcub drm/amd/display: Use config flag to disable dmcu obj creation drm/amd/display: Fix ABM config copy for dmcub drm/amd/display: Remove unused defines

Xiaodong Yan (2):
drm/amd/display: blank dp stream before power off receiver drm/amd/display: only blank dp stream which will be powered off

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 47 +++++-----
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |  2 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_color.c   |  3 +-
 .../display/amdgpu_dm/amdgpu_dm_mst_types.c   |  8 ++
 .../amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c |  2 +-
 drivers/gpu/drm/amd/display/dc/core/dc.c      | 20 ++++-
 drivers/gpu/drm/amd/display/dc/core/dc_link.c | 35 +++++---
 .../gpu/drm/amd/display/dc/core/dc_link_dp.c  | 15 +---
 .../gpu/drm/amd/display/dc/core/dc_resource.c |  8 +-
 drivers/gpu/drm/amd/display/dc/dc.h           |  4 +-
 drivers/gpu/drm/amd/display/dc/dc_hw_types.h  |  2 +
 drivers/gpu/drm/amd/display/dc/dce/dce_abm.c  |  2 +-
 .../drm/amd/display/dc/dce/dce_link_encoder.c | 20 ++++-
 .../drm/amd/display/dc/dce/dce_link_encoder.h |  3 +
 drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c | 25 +++++-
 drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c |  3 -
 .../display/dc/dce110/dce110_hw_sequencer.c   | 17 ++++
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 89 ++++++++++++++++++-
 .../amd/display/dc/dcn10/dcn10_link_encoder.c | 20 ++++-
 .../amd/display/dc/dcn10/dcn10_link_encoder.h |  3 +
 .../gpu/drm/amd/display/dc/dcn10/dcn10_optc.c |  6 +-
 .../drm/amd/display/dc/dcn10/dcn10_resource.c |  2 +-
 .../drm/amd/display/dc/dcn20/dcn20_hwseq.c    |  7 ++
 .../amd/display/dc/dcn20/dcn20_link_encoder.c | 40 +++++++++
 .../amd/display/dc/dcn20/dcn20_link_encoder.h |  4 +
 .../drm/amd/display/dc/dcn20/dcn20_resource.c | 12 +--
 .../gpu/drm/amd/display/dc/dcn21/dcn21_init.c |  1 +
 .../amd/display/dc/dcn21/dcn21_link_encoder.c | 27 +-----
 .../drm/amd/display/dc/dcn21/dcn21_resource.c |  8 +-
 .../dc/dml/dcn20/display_mode_vba_20v2.c      |  3 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/abm.h   |  3 +-
 .../gpu/drm/amd/display/dc/inc/hw/transform.h |  2 +
 .../gpu/drm/amd/display/dc/inc/hw_sequencer.h |  4 +
 .../display/dc/virtual/virtual_link_encoder.c |  9 ++
 .../drm/amd/display/dmub/inc/dmub_cmd_dal.h   | 14 ++-
 .../gpu/drm/amd/display/dmub/inc/dmub_srv.h   | 11 +++
 .../gpu/drm/amd/display/dmub/src/dmub_dcn20.c | 24 +++--
 .../gpu/drm/amd/display/dmub/src/dmub_srv.c   | 25 ++++--
 .../gpu/drm/amd/display/modules/hdcp/hdcp.c   |  5 +-
 .../gpu/drm/amd/display/modules/hdcp/hdcp.h   | 28 ++----
 .../display/modules/hdcp/hdcp1_execution.c    |  2 +-
 .../display/modules/hdcp/hdcp2_execution.c    |  2 +-
 .../drm/amd/display/modules/hdcp/hdcp_log.c   |  8 +-
 .../drm/amd/display/modules/hdcp/hdcp_psp.c   | 44 +++++----
 .../drm/amd/display/modules/inc/mod_hdcp.h    |  5 +-
 .../amd/display/modules/power/power_helpers.c | 30 ++++---
 .../amd/display/modules/power/power_helpers.h |  3 +
 47 files changed, 455 insertions(+), 202 deletions(-)
Signature · 6 lines
2.26.0

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

PATCH 1/36 drm/amd/display: 3.2.78

From: Aric Cyr <[email protected]>

---
 drivers/gpu/drm/amd/display/dc/dc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
index 92123b0d1196..9ff239d35519 100644
@@ -39,7 +39,7 @@
 #include "inc/hw/dmcu.h"
 #include "dml/display_mode_lib.h"
 
-#define DC_VER "3.2.77"
+#define DC_VER "3.2.78"
 
 #define MAX_SURFACES 3
 #define MAX_PLANES 6
Signature · 6 lines
2.26.0

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

PATCH 2/36 drm/amd/display: prevent loop from occuring in pipe list

In reply to Rodrigo Siqueira

From: Josip Pavic <[email protected]>

[Why]
If no free pipes are available, acquire_first_split_pipe is called to get a pipe to use. This call may alter the ordering of the pipes in the list so that, for example, the tail pipe changes.

If acquire_first_split_pipe returns the tail pipe, we'll have free_pipe == tail_pipe. What tail_pipe refers to is not the current tail_pipe, but what was previously the tail pipe - i.e. prior to the call to acquire_first_split_pipe

The logic that follows will link free_pipe to the tail pipe, referring to the current tail pipe. However, since tail_pipe is cached from before the call to acquire_first_split_pipe, the wrong tail pipe will be used, and it will end up being linked to itself, creating a loop that, if traversed, will result in a soft hang.

[How]
Do not cache the tail pipe. Instead, check the tail pipe after the call to acquire_first_split_pipe is made.

---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +2 -3
index f4bcc71b2920..7b32a34908c8 100644
@@ -1358,9 +1358,6 @@ bool dc_add_plane_to_context(
 	dc_plane_state_retain(plane_state);
 
 	while (head_pipe) {
-		tail_pipe = resource_get_tail_pipe(&context->res_ctx, head_pipe);
-		ASSERT(tail_pipe);
-
 		free_pipe = acquire_free_pipe_for_head(context, pool, head_pipe);
 
 	#if defined(CONFIG_DRM_AMD_DC_DCN)
@@ -1378,6 +1375,8 @@ bool dc_add_plane_to_context(
 		free_pipe->plane_state = plane_state;
 
 		if (head_pipe != free_pipe) {
+			tail_pipe = resource_get_tail_pipe(&context->res_ctx, head_pipe);
+			ASSERT(tail_pipe);
 			free_pipe->stream_res.tg = tail_pipe->stream_res.tg;
 			free_pipe->stream_res.abm = tail_pipe->stream_res.abm;
 			free_pipe->stream_res.opp = tail_pipe->stream_res.opp;
Signature · 6 lines
2.26.0

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

PATCH 3/36 drm/amd/display: Program DSC before enabling link

In reply to Rodrigo Siqueira

From: Nikola Cornij <[email protected]>

[why]
Link or DIG BE can't be exposed to a higher stream bandwidth than they can handle. When DSC is required to fit the stream into the link bandwidth, DSC has to be programmed before the link is enabled to ensure this. Without it, intermittent issues such as black screen after S3 or a hot-plug can be seen with DSC timings like 4k144Hz or 8k60Hz.

[how]
Move DSC programming from before enabling stream to before enabling link

---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +12 -5
index 67cfff1586e9..ecbf165b5775 100644
@@ -3040,6 +3040,18 @@ void core_link_enable_stream(
 		if (pipe_ctx->stream->dpms_off)
 			return;
 
+		/* Have to setup DSC before DIG FE and BE are connected (which happens before the
+		 * link training). This is to make sure the bandwidth sent to DIG BE won't be
+		 * bigger than what the link and/or DIG BE can handle. VBID[6]/CompressedStream_flag
+		 * will be automatically set at a later time when the video is enabled
+		 * (DP_VID_STREAM_EN = 1).
+		 */
+		if (pipe_ctx->stream->timing.flags.DSC) {
+			if (dc_is_dp_signal(pipe_ctx->stream->signal) ||
+					dc_is_virtual_signal(pipe_ctx->stream->signal))
+				dp_set_dsc_enable(pipe_ctx, true);
+		}
+
 		status = enable_link(state, pipe_ctx);
 
 		if (status != DC_OK) {
@@ -3067,11 +3079,6 @@ void core_link_enable_stream(
 					CONTROLLER_DP_TEST_PATTERN_VIDEOMODE,
 					COLOR_DEPTH_UNDEFINED);
 
-		if (pipe_ctx->stream->timing.flags.DSC) {
-			if (dc_is_dp_signal(pipe_ctx->stream->signal) ||
-					dc_is_virtual_signal(pipe_ctx->stream->signal))
-				dp_set_dsc_enable(pipe_ctx, true);
-		}
 		dc->hwss.enable_stream(pipe_ctx);
 
 		/* Set DPS PPS SDP (AKA "info frames") */
Signature · 6 lines
2.26.0

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

PATCH 4/36 drm/amd/display: Implement abm config table copy to dmcub

In reply to Rodrigo Siqueira

From: Wyatt Wood <[email protected]>

[Why]
Driver must pass abm config table to dmub fw. This provides various parameters for abm functionality.

[How]
There is too much data to be passed in an inbox message, so we must pass this data using an indirect buffer. Copy the table to cw7 via x86, driver copies to fw_state structure.

---
 drivers/gpu/drm/amd/display/dc/dce/dce_abm.c  |  2 +-
 drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c | 25 ++++++++++++++++---
 drivers/gpu/drm/amd/display/dc/inc/hw/abm.h   |  3 +--
 .../gpu/drm/amd/display/dmub/inc/dmub_srv.h   | 10 ++++++++
 .../gpu/drm/amd/display/dmub/src/dmub_srv.c   |  2 +-
 .../amd/display/modules/power/power_helpers.c |  4 +--
 6 files changed, 37 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_abm.c +1 -1
index a4dae31400fa..e345df621a6a 100644
@@ -447,7 +447,7 @@ static const struct abm_funcs dce_funcs = {
 	.set_backlight_level_pwm = dce_abm_set_backlight_level_pwm,
 	.get_current_backlight = dce_abm_get_current_backlight,
 	.get_target_backlight = dce_abm_get_target_backlight,
-	.load_abm_config = NULL,
+	.init_abm_config = NULL,
 	.set_abm_immediate_disable = dce_abm_immediate_disable
 };
 
drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c +22 -3
index 81c967917c5b..06435ecaf6a3 100644
@@ -348,11 +348,30 @@ static bool dmub_abm_set_backlight_level_pwm(
 	return true;
 }
 
-static bool dmub_abm_load_config(struct abm *abm,
-	unsigned int start_offset,
+static bool dmub_abm_init_config(struct abm *abm,
 	const char *src,
 	unsigned int bytes)
 {
+	union dmub_rb_cmd cmd;
+	struct dc_context *dc = abm->ctx;
+
+	// TODO: Optimize by only reading back final 4 bytes
+	dmub_flush_buffer_mem(&dc->dmub_srv->dmub->scratch_mem_fb);
+
+	// Copy iramtable into cw7
+	memcpy(dc->dmub_srv->dmub->scratch_mem_fb.cpu_addr, (void *)src, bytes);
+
+	// Fw will copy from cw7 to fw_state
+	cmd.abm_init_config.header.type = DMUB_CMD__ABM;
+	cmd.abm_init_config.header.sub_type = DMUB_CMD__ABM_INIT_CONFIG;
+	cmd.abm_init_config.abm_init_config_data.src.quad_part = dc->dmub_srv->dmub->scratch_mem_fb.gpu_addr;
+	cmd.abm_init_config.abm_init_config_data.bytes = bytes;
+	cmd.abm_init_config.header.payload_bytes = sizeof(struct dmub_cmd_abm_init_config_data);
+
+	dc_dmub_srv_cmd_queue(dc->dmub_srv, &cmd.abm_init_config.header);
+	dc_dmub_srv_cmd_execute(dc->dmub_srv);
+	dc_dmub_srv_wait_idle(dc->dmub_srv);
+
 	return true;
 }
 
@@ -365,7 +384,7 @@ static const struct abm_funcs abm_funcs = {
 	.get_current_backlight = dmub_abm_get_current_backlight,
 	.get_target_backlight = dmub_abm_get_target_backlight,
 	.set_abm_immediate_disable = dmub_abm_immediate_disable,
-	.load_abm_config = dmub_abm_load_config,
+	.init_abm_config = dmub_abm_init_config,
 };
 
 static void dmub_abm_construct(
drivers/gpu/drm/amd/display/dc/inc/hw/abm.h +1 -2
index 9cca0ca30fee..0cae258a903e 100644
@@ -60,8 +60,7 @@ struct abm_funcs {
 
 	unsigned int (*get_current_backlight)(struct abm *abm);
 	unsigned int (*get_target_backlight)(struct abm *abm);
-	bool (*load_abm_config)(struct abm *abm,
-			unsigned int start_offset,
+	bool (*init_abm_config)(struct abm *abm,
 			const char *src,
 			unsigned int bytes);
 };
drivers/gpu/drm/amd/display/dmub/inc/dmub_srv.h +10 -0
index c2671f2616c8..af678462f0e6 100644
@@ -565,6 +565,16 @@ dmub_srv_send_gpint_command(struct dmub_srv *dmub,
 enum dmub_status dmub_srv_get_gpint_response(struct dmub_srv *dmub,
 					     uint32_t *response);
 
+/**
+ * dmub_flush_buffer_mem() - Read back entire frame buffer region.
+ * This ensures that the write from x86 has been flushed and will not
+ * hang the DMCUB.
+ * @fb: frame buffer to flush
+ *
+ * Can be called after software initialization.
+ */
+void dmub_flush_buffer_mem(const struct dmub_fb *fb);
+
 #if defined(__cplusplus)
 }
 #endif
drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c +1 -1
index ce32cc7933c4..0be8a54cc475 100644
@@ -70,7 +70,7 @@ static inline uint32_t dmub_align(uint32_t val, uint32_t factor)
 	return (val + factor - 1) / factor * factor;
 }
 
-static void dmub_flush_buffer_mem(const struct dmub_fb *fb)
+void dmub_flush_buffer_mem(const struct dmub_fb *fb)
 {
 	const uint8_t *base = (const uint8_t *)fb->cpu_addr;
 	uint8_t buf[64];
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +2 -2
index 8bf1bdd0f457..c1a95da6706f 100644
@@ -671,8 +671,8 @@ bool dmcu_load_iram(struct dmcu *dmcu,
 	// ABM 2.4 and up are implemented on dmcub
 	if (dmcu == NULL) {
 		fill_iram_v_2_3((struct iram_table_v_2_2 *)ram_table, params);
-		result = abm->funcs->load_abm_config(
-			abm, 0, (char *)(&ram_table), IRAM_RESERVE_AREA_START_V2_2);
+		result = abm->funcs->init_abm_config(
+			abm, (char *)(&ram_table), IRAM_RESERVE_AREA_START_V2_2);
 	} else if (dmcu->dmcu_version.abm_version == 0x24) {
 		fill_iram_v_2_3((struct iram_table_v_2_2 *)ram_table, params);
 			result = dmcu->funcs->load_iram(
Signature · 6 lines
2.26.0

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

PATCH 5/36 drm/amd/display: Remove hdcp display state with mst fix

In reply to Rodrigo Siqueira

From: Isabel Zhang <[email protected]>

[Why]
Due to previous code changes, displays transition from active to active and added state immediately, making it redundant to have both display states. Previous change to fix this caused HDCP to get into a bad state when monitor is connected to MST hub, this change fixes that issue.

[How]
Change code behavior so when a device is added successfully the state remains as active and when addition is unsuccessful change state to inactive. This removes need for added and active state.

---
 .../gpu/drm/amd/display/modules/hdcp/hdcp.c   |  5 ++-
 .../gpu/drm/amd/display/modules/hdcp/hdcp.h   | 28 +++----------
 .../display/modules/hdcp/hdcp1_execution.c    |  2 +-
 .../display/modules/hdcp/hdcp2_execution.c    |  2 +-
 .../drm/amd/display/modules/hdcp/hdcp_psp.c   | 40 +++++++++----------
 .../drm/amd/display/modules/inc/mod_hdcp.h    |  1 -
 6 files changed, 29 insertions(+), 49 deletions(-)
drivers/gpu/drm/amd/display/modules/hdcp/hdcp.c +3 -2
index cc1d3f470b99..e9fbd94f8635 100644
@@ -328,7 +328,8 @@ enum mod_hdcp_status mod_hdcp_add_display(struct mod_hdcp *hdcp,
 	/* add display to connection */
 	hdcp->connection.link = *link;
 	*display_container = *display;
-	status = mod_hdcp_add_display_to_topology(hdcp, display->index);
+	status = mod_hdcp_add_display_to_topology(hdcp, display_container);
+
 	if (status != MOD_HDCP_STATUS_SUCCESS)
 		goto out;
 
@@ -374,7 +375,7 @@ enum mod_hdcp_status mod_hdcp_remove_display(struct mod_hdcp *hdcp,
 	status = mod_hdcp_remove_display_from_topology(hdcp, index);
 	if (status != MOD_HDCP_STATUS_SUCCESS)
 		goto out;
-	display->state = MOD_HDCP_DISPLAY_INACTIVE;
+	memset(display, 0, sizeof(struct mod_hdcp_display));
 
 	/* request authentication when connection is not reset */
 	if (current_state(hdcp) != HDCP_UNINITIALIZED)
drivers/gpu/drm/amd/display/modules/hdcp/hdcp.h +6 -22
index 5cb4546be0ef..60ff1a0028ac 100644
@@ -328,7 +328,7 @@ void mod_hdcp_dump_binary_message(uint8_t *msg, uint32_t msg_size,
 
 /* psp functions */
 enum mod_hdcp_status mod_hdcp_add_display_to_topology(
-		struct mod_hdcp *hdcp, uint8_t index);
+		struct mod_hdcp *hdcp, struct mod_hdcp_display *display);
 enum mod_hdcp_status mod_hdcp_remove_display_from_topology(
 		struct mod_hdcp *hdcp, uint8_t index);
 enum mod_hdcp_status mod_hdcp_hdcp1_create_session(struct mod_hdcp *hdcp);
@@ -503,11 +503,6 @@ static inline uint8_t is_display_active(struct mod_hdcp_display *display)
 	return display->state >= MOD_HDCP_DISPLAY_ACTIVE;
 }
 
-static inline uint8_t is_display_added(struct mod_hdcp_display *display)
-{
-	return display->state >= MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED;
-}
-
 static inline uint8_t is_display_encryption_enabled(struct mod_hdcp_display *display)
 {
 	return display->state >= MOD_HDCP_DISPLAY_ENCRYPTION_ENABLED;
@@ -515,34 +510,23 @@ static inline uint8_t is_display_encryption_enabled(struct mod_hdcp_display *dis
 
 static inline uint8_t get_active_display_count(struct mod_hdcp *hdcp)
 {
-	uint8_t added_count = 0;
+	uint8_t active_count = 0;
 	uint8_t i;
 
 	for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++)
 		if (is_display_active(&hdcp->displays[i]))
-			added_count++;
-	return added_count;
-}
-
-static inline uint8_t get_added_display_count(struct mod_hdcp *hdcp)
-{
-	uint8_t added_count = 0;
-	uint8_t i;
-
-	for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++)
-		if (is_display_added(&hdcp->displays[i]))
-			added_count++;
-	return added_count;
+			active_count++;
+	return active_count;
 }
 
-static inline struct mod_hdcp_display *get_first_added_display(
+static inline struct mod_hdcp_display *get_first_active_display(
 		struct mod_hdcp *hdcp)
 {
 	uint8_t i;
 	struct mod_hdcp_display *display = NULL;
 
 	for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++)
-		if (is_display_added(&hdcp->displays[i])) {
+		if (is_display_active(&hdcp->displays[i])) {
 			display = &hdcp->displays[i];
 			break;
 		}
drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c +1 -1
index 37c8c05497d6..f244b72e74e0 100644
@@ -129,7 +129,7 @@ static inline uint8_t get_device_count(struct mod_hdcp *hdcp)
 static inline enum mod_hdcp_status check_device_count(struct mod_hdcp *hdcp)
 {
 	/* device count must be greater than or equal to tracked hdcp displays */
-	return (get_device_count(hdcp) < get_added_display_count(hdcp)) ?
+	return (get_device_count(hdcp) < get_active_display_count(hdcp)) ?
 			MOD_HDCP_STATUS_HDCP1_DEVICE_COUNT_MISMATCH_FAILURE :
 			MOD_HDCP_STATUS_SUCCESS;
 }
drivers/gpu/drm/amd/display/modules/hdcp/hdcp2_execution.c +1 -1
index 491c00f48026..549c113abcf7 100644
@@ -208,7 +208,7 @@ static inline uint8_t get_device_count(struct mod_hdcp *hdcp)
 static enum mod_hdcp_status check_device_count(struct mod_hdcp *hdcp)
 {
 	/* device count must be greater than or equal to tracked hdcp displays */
-	return (get_device_count(hdcp) < get_added_display_count(hdcp)) ?
+	return (get_device_count(hdcp) < get_active_display_count(hdcp)) ?
 			MOD_HDCP_STATUS_HDCP2_DEVICE_COUNT_MISMATCH_FAILURE :
 			MOD_HDCP_STATUS_SUCCESS;
 }
drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c +18 -22
index c2929815c3ee..1b54f169392a 100644
@@ -54,7 +54,7 @@ enum mod_hdcp_status mod_hdcp_remove_display_from_topology(
 
 	dtm_cmd = (struct ta_dtm_shared_memory *)psp->dtm_context.dtm_shared_buf;
 
-	if (!display || !is_display_added(display))
+	if (!display || !is_display_active(display))
 		return MOD_HDCP_STATUS_DISPLAY_NOT_FOUND;
 
 	memset(dtm_cmd, 0, sizeof(struct ta_dtm_shared_memory));
@@ -75,23 +75,19 @@ enum mod_hdcp_status mod_hdcp_remove_display_from_topology(
  	return MOD_HDCP_STATUS_SUCCESS;
  
 }
-enum mod_hdcp_status mod_hdcp_add_display_to_topology(struct mod_hdcp *hdcp,
-						      uint8_t index)
+enum mod_hdcp_status mod_hdcp_add_display_to_topology(
+			struct mod_hdcp *hdcp, struct mod_hdcp_display *display)
 {
 	struct psp_context *psp = hdcp->config.psp.handle;
 	struct ta_dtm_shared_memory *dtm_cmd;
-	struct mod_hdcp_display *display =
-			get_active_display_at_index(hdcp, index);
 	struct mod_hdcp_link *link = &hdcp->connection.link;
 
 	if (!psp->dtm_context.dtm_initialized) {
 		DRM_ERROR("Failed to add display topology, DTM TA is not initialized.");
+		display->state = MOD_HDCP_DISPLAY_INACTIVE;
 		return MOD_HDCP_STATUS_FAILURE;
 	}
 
-	if (!display || is_display_added(display))
-		return MOD_HDCP_STATUS_UPDATE_TOPOLOGY_FAILURE;
-
 	dtm_cmd = (struct ta_dtm_shared_memory *)psp->dtm_context.dtm_shared_buf;
 
 	memset(dtm_cmd, 0, sizeof(struct ta_dtm_shared_memory));
@@ -113,10 +109,11 @@ enum mod_hdcp_status mod_hdcp_add_display_to_topology(struct mod_hdcp *hdcp,
 
 	psp_dtm_invoke(psp, dtm_cmd->cmd_id);
 
-	if (dtm_cmd->dtm_status != TA_DTM_STATUS__SUCCESS)
+	if (dtm_cmd->dtm_status != TA_DTM_STATUS__SUCCESS) {
+		display->state = MOD_HDCP_DISPLAY_INACTIVE;
 		return MOD_HDCP_STATUS_UPDATE_TOPOLOGY_FAILURE;
+	}
 
-	display->state = MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED;
 	HDCP_TOP_ADD_DISPLAY_TRACE(hdcp, display->index);
 
 	return MOD_HDCP_STATUS_SUCCESS;
@@ -126,7 +123,7 @@ enum mod_hdcp_status mod_hdcp_hdcp1_create_session(struct mod_hdcp *hdcp)
 {
 
 	struct psp_context *psp = hdcp->config.psp.handle;
-	struct mod_hdcp_display *display = get_first_added_display(hdcp);
+	struct mod_hdcp_display *display = get_first_active_display(hdcp);
 	struct ta_hdcp_shared_memory *hdcp_cmd;
 
 	if (!psp->hdcp_context.hdcp_initialized) {
@@ -179,7 +176,7 @@ enum mod_hdcp_status mod_hdcp_hdcp1_destroy_session(struct mod_hdcp *hdcp)
 		if (is_display_encryption_enabled(
 				&hdcp->displays[i])) {
 			hdcp->displays[i].state =
-					MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED;
+								MOD_HDCP_DISPLAY_ACTIVE;
 			HDCP_HDCP1_DISABLED_TRACE(hdcp,
 					hdcp->displays[i].index);
 		}
@@ -231,7 +228,7 @@ enum mod_hdcp_status mod_hdcp_hdcp1_enable_encryption(struct mod_hdcp *hdcp)
 {
 	struct psp_context *psp = hdcp->config.psp.handle;
 	struct ta_hdcp_shared_memory *hdcp_cmd;
-	struct mod_hdcp_display *display = get_first_added_display(hdcp);
+	struct mod_hdcp_display *display = get_first_active_display(hdcp);
 
 	hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
 	memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
@@ -301,9 +298,8 @@ enum mod_hdcp_status mod_hdcp_hdcp1_enable_dp_stream_encryption(struct mod_hdcp
 
 	for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++) {
 
-		if (hdcp->displays[i].state != MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED ||
-		    hdcp->displays[i].adjust.disable)
-			continue;
+		if (hdcp->displays[i].adjust.disable || hdcp->displays[i].state != MOD_HDCP_DISPLAY_ACTIVE)
+				continue;
 
 		memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
 
@@ -364,7 +360,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_create_session(struct mod_hdcp *hdcp)
 {
 	struct psp_context *psp = hdcp->config.psp.handle;
 	struct ta_hdcp_shared_memory *hdcp_cmd;
-	struct mod_hdcp_display *display = get_first_added_display(hdcp);
+	struct mod_hdcp_display *display = get_first_active_display(hdcp);
 
 	if (!psp->hdcp_context.hdcp_initialized) {
 		DRM_ERROR("Failed to create hdcp session, HDCP TA is not initialized");
@@ -423,7 +419,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_destroy_session(struct mod_hdcp *hdcp)
 		if (is_display_encryption_enabled(
 				&hdcp->displays[i])) {
 			hdcp->displays[i].state =
-					MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED;
+								MOD_HDCP_DISPLAY_ACTIVE;
 			HDCP_HDCP2_DISABLED_TRACE(hdcp,
 					hdcp->displays[i].index);
 		}
@@ -662,7 +658,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_enable_encryption(struct mod_hdcp *hdcp)
 {
 	struct psp_context *psp = hdcp->config.psp.handle;
 	struct ta_hdcp_shared_memory *hdcp_cmd;
-	struct mod_hdcp_display *display = get_first_added_display(hdcp);
+	struct mod_hdcp_display *display = get_first_active_display(hdcp);
 
 	hdcp_cmd = (struct ta_hdcp_shared_memory *)psp->hdcp_context.hdcp_shared_buf;
 	memset(hdcp_cmd, 0, sizeof(struct ta_hdcp_shared_memory));
@@ -747,9 +743,9 @@ enum mod_hdcp_status mod_hdcp_hdcp2_enable_dp_stream_encryption(struct mod_hdcp
 
 
 	for (i = 0; i < MAX_NUM_OF_DISPLAYS; i++) {
-		if (hdcp->displays[i].state != MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED ||
-		    hdcp->displays[i].adjust.disable)
-			continue;
+		if (hdcp->displays[i].adjust.disable || hdcp->displays[i].state != MOD_HDCP_DISPLAY_ACTIVE)
+				continue;
+
 		hdcp_cmd->in_msg.hdcp2_enable_dp_stream_encryption.display_handle = hdcp->displays[i].index;
 		hdcp_cmd->in_msg.hdcp2_enable_dp_stream_encryption.session_handle = hdcp->auth.id;
 
drivers/gpu/drm/amd/display/modules/inc/mod_hdcp.h +0 -1
index c088602bc1a0..eae9309cfb24 100644
@@ -117,7 +117,6 @@ enum mod_hdcp_operation_mode {
 enum mod_hdcp_display_state {
 	MOD_HDCP_DISPLAY_INACTIVE = 0,
 	MOD_HDCP_DISPLAY_ACTIVE,
-	MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED,
 	MOD_HDCP_DISPLAY_ENCRYPTION_ENABLED
 };
 
Signature · 6 lines
2.26.0

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

PATCH 6/36 drm/amd/display: Power down hw blocks on boot

In reply to Rodrigo Siqueira

From: Sung Lee <[email protected]>

[WHY]
On headless boot a DIG may be turned on by VBIOS on RN. This leads to display_count being non-zero in hybrid graphics cases leading to SMU DISPLAY_OFF message not being sent.

[HOW]
Power down hardware on boot
if seamless boot is not occurring
(power_down_display_on_boot == 1)

---
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 29 +++++++++++++++++++
 .../gpu/drm/amd/display/dc/dcn21/dcn21_init.c |  1 +
 .../gpu/drm/amd/display/dc/inc/hw_sequencer.h |  4 +++
 3 files changed, 34 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +29 -0
index 0be010085575..dad95f1a7041 100644
@@ -1361,6 +1361,35 @@ void dcn10_init_hw(struct dc *dc)
 					!dc->res_pool->hubbub->ctx->dc->debug.disable_stutter);
 	}
 
+	/* In headless boot cases, DIG may be turned
+	 * on which causes HW/SW discrepancies.
+	 * To avoid this, power down hardware on boot
+	 * if DIG is turned on and seamless boot not enabled
+	 */
+	if (dc->config.power_down_display_on_boot) {
+		struct dc_link *edp_link = get_edp_link(dc);
+
+		if (edp_link &&
+			edp_link->link_enc->funcs->is_dig_enabled &&
+			edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc)) {
+			dc->hwss.edp_backlight_control(edp_link, false);
+			dc->hwss.power_down(dc);
+			dc->hwss.edp_power_control(edp_link, false);
+		} else {
+			for (i = 0; i < dc->link_count; i++) {
+				struct dc_link *link = dc->links[i];
+
+				if (link->link_enc->funcs->is_dig_enabled &&
+						link->link_enc->funcs->is_dig_enabled(link->link_enc) &&
+						dc->hwss.power_down) {
+					dc->hwss.power_down(dc);
+					break;
+				}
+
+			}
+		}
+	}
+
 	for (i = 0; i < res_pool->audio_count; i++) {
 		struct audio *audio = res_pool->audios[i];
 
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_init.c +1 -0
index b9ff9767e08f..a6ed70fcbc19 100644
@@ -90,6 +90,7 @@ static const struct hw_sequencer_funcs dcn21_funcs = {
 	.set_cursor_sdr_white_level = dcn10_set_cursor_sdr_white_level,
 	.optimize_pwr_state = dcn21_optimize_pwr_state,
 	.exit_optimized_pwr_state = dcn21_exit_optimized_pwr_state,
+	.power_down = dce110_power_down,
 };
 
 static const struct hwseq_private_funcs dcn21_private_funcs = {
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +4 -0
index d4c1fb242c63..9380721f28b8 100644
@@ -75,9 +75,13 @@ struct hw_sequencer_funcs {
 	void (*wait_for_mpcc_disconnect)(struct dc *dc,
 			struct resource_pool *res_pool,
 			struct pipe_ctx *pipe_ctx);
+	void (*edp_backlight_control)(
+			struct dc_link *link,
+			bool enable);
 	void (*program_triplebuffer)(const struct dc *dc,
 		struct pipe_ctx *pipe_ctx, bool enableTripleBuffer);
 	void (*update_pending_status)(struct pipe_ctx *pipe_ctx);
+	void (*power_down)(struct dc *dc);
 
 	/* Pipe Lock Related */
 	void (*pipe_control_lock)(struct dc *dc,
Signature · 6 lines
2.26.0

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

PATCH 7/36 drm/amd/display: blank dp stream before power off receiver

In reply to Rodrigo Siqueira

From: Xiaodong Yan <[email protected]>

[why]
power off dp receiver directly cause garbage during hw init

[how]
blank dp stream and then power off receiver

---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +8 -0
index dad95f1a7041..079a33a96f90 100644
@@ -1328,6 +1328,14 @@ void dcn10_init_hw(struct dc *dc)
 		uint8_t dpcd_power_state = '\0';
 		enum dc_status status = DC_ERROR_UNEXPECTED;
 
+		/* blank all dp streams before power off receiver,
+		 * this should only impact DP
+		 */
+		for (i = 0; i < dc->res_pool->stream_enc_count; i++) {
+			dc->res_pool->stream_enc[i]->funcs->dp_blank(
+						dc->res_pool->stream_enc[i]);
+		}
+
 		for (i = 0; i < dc->link_count; i++) {
 			if (dc->links[i]->connector_signal != SIGNAL_TYPE_DISPLAY_PORT)
 				continue;
Signature · 6 lines
2.26.0

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

PATCH 8/36 drm/amd/display: Don't change mpcc tree for medium updates on DCN20 hwseq

In reply to Rodrigo Siqueira

From: Nicholas Kazlauskas <[email protected]>

[Why]
Overlay planes disappear when the plane's alpha blending mode or global opacity is modified.

These are considered UPDATE_TYPE_MEDIUM and trigger the update_mpcc path in the DCN hardware sequencer.

On DCN10 we have an "optimization" to avoid touching the blending tree on these updates, but this is actually required behavior based on how update_mpcc is structured.

For full updates we acquire a MPCC for the plane, remove it if it already exists then reinsert it after with insert_plane.

The call to insert_plane can take an optional mpcc to insert the new one above to preserve the current blending order. The update_mpcc hwseq function doesn't do this so the overlay gets sent to the very bottom of the tree.

[How]
Copy the check over from DCN10 to DCN20. The only time we need to actually touch the tree really is the full update, so this is also an optimization on top of the fix.

Fixing the logic for insert_plane is rather simple (cache the bot_mpcc and pass it to insert_plane) but is a change that impacts most display usecases.

For now stick with the optimization.

---
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +6 -0
index 233318260da4..674e4b8abdfb 100644
@@ -2170,6 +2170,12 @@ void dcn20_update_mpcc(struct dc *dc, struct pipe_ctx *pipe_ctx)
 	 */
 	mpcc_id = hubp->inst;
 
+	/* If there is no full update, don't need to touch MPC tree*/
+	if (!pipe_ctx->plane_state->update_flags.bits.full_update) {
+		mpc->funcs->update_blending(mpc, &blnd_cfg, mpcc_id);
+		return;
+	}
+
 	/* check if this MPCC is already being used */
 	new_mpcc = mpc->funcs->get_mpcc_for_dpp(mpc_tree_params, mpcc_id);
 	/* remove MPCC if being used */
Signature · 6 lines
2.26.0

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

PATCH 9/36 drm/amd/display: Check power_down functions exist before calling

In reply to Rodrigo Siqueira

From: Sung Lee <[email protected]>

[WHY]
The power_down() function was only defined for specific asics and will crash the system if it is called by an asic with eDP connected that does not have it defined.

[HOW]
Add a check for the function's existence before calling it.

---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +5 -2
index 079a33a96f90..6086bbec94fe 100644
@@ -1378,8 +1378,11 @@ void dcn10_init_hw(struct dc *dc)
 		struct dc_link *edp_link = get_edp_link(dc);
 
 		if (edp_link &&
-			edp_link->link_enc->funcs->is_dig_enabled &&
-			edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc)) {
+				edp_link->link_enc->funcs->is_dig_enabled &&
+				edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc) &&
+				dc->hwss.edp_backlight_control &&
+				dc->hwss.power_down &&
+				dc->hwss.edp_power_control) {
 			dc->hwss.edp_backlight_control(edp_link, false);
 			dc->hwss.power_down(dc);
 			dc->hwss.edp_power_control(edp_link, false);
Signature · 6 lines
2.26.0

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

PATCH 10/36 drm/amd/display: Use config flag to disable dmcu obj creation

In reply to Rodrigo Siqueira

From: Wyatt Wood <[email protected]>

[Why]
When dmcub is the default we no longer wish to create the psr and dmcu objects. Currently a dc debug flag is used to implement this, but these flags aren't populated until after dcn21_resource_construct is called. This means the dmcub objects will never be created. Therefore we must use a dc config flag, which is populated before dc resource construct.

[How]
Add a dc config flag.

---
 drivers/gpu/drm/amd/display/dc/dc.h                   | 2 +-
 drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
index 9ff239d35519..fa0724435a3e 100644
@@ -230,7 +230,7 @@ struct dc_config {
 	bool forced_clocks;
 	bool disable_extended_timeout_support; // Used to disable extended timeout and lttpr feature as well
 	bool multi_mon_pp_mclk_switch;
-	bool psr_on_dmub;
+	bool disable_dmcu;
 };
 
 enum visual_confirm {
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +4 -4
index 17cef02f7327..0e638a77b5ee 100644
@@ -993,7 +993,7 @@ static void dcn21_resource_destruct(struct dcn21_resource_pool *pool)
 	}
 
 	if (pool->base.abm != NULL) {
-		if (pool->base.abm->ctx->dc->debug.disable_dmcu)
+		if (pool->base.abm->ctx->dc->config.disable_dmcu)
 			dmub_abm_destroy(&pool->base.abm);
 		else
 			dce_abm_destroy(&pool->base.abm);
@@ -1846,7 +1846,7 @@ static bool dcn21_resource_construct(
 		goto create_fail;
 	}
 
-	if (!dc->debug.disable_dmcu) {
+	if (!dc->config.disable_dmcu) {
 		pool->base.dmcu = dcn21_dmcu_create(ctx,
 				&dmcu_regs,
 				&dmcu_shift,
@@ -1858,7 +1858,7 @@ static bool dcn21_resource_construct(
 		}
 	}
 
-	if (dc->debug.disable_dmcu) {
+	if (dc->config.disable_dmcu) {
 		pool->base.psr = dmub_psr_create(ctx);
 
 		if (pool->base.psr == NULL) {
@@ -1868,7 +1868,7 @@ static bool dcn21_resource_construct(
 		}
 	}
 
-	if (dc->debug.disable_dmcu)
+	if (dc->config.disable_dmcu)
 		pool->base.abm = dmub_abm_create(ctx,
 			&abm_regs,
 			&abm_shift,
Signature · 6 lines
2.26.0

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

PATCH 11/36 drm/amd/display: fix typo

In reply to Rodrigo Siqueira

From: Joseph Gravenor <[email protected]>

[why]
MOD_HDCP_STATUS_HDCP1_ENABLE_ENCRYPTION and MOD_HDCP_STATUS_HDCP2_ENABLE_ENCRYPTION were supposed to be MOD_HDCP_STATUS_HDCP1_ENABLE_ENCRYPTION_FAILURE and MOD_HDCP_STATUS_HDCP2_ENABLE_ENCRYPTION_FAILURE. Because of this it always seems like mod_hdcp_hdcp1_enable_encryption and mod_hdcp_hdcp2_enable_encryption are always passing

[how]
rename the elements to what they were supposed to be called

---
 drivers/gpu/drm/amd/display/modules/hdcp/hdcp_log.c | 8 ++++----
 drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c | 4 ++--
 drivers/gpu/drm/amd/display/modules/inc/mod_hdcp.h  | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/display/modules/hdcp/hdcp_log.c +4 -4
index 44956f9ba178..fb6a19d020f9 100644
@@ -98,8 +98,8 @@ char *mod_hdcp_status_to_str(int32_t status)
 		return "MOD_HDCP_STATUS_HDCP1_VALIDATE_KSV_LIST_FAILURE";
 	case MOD_HDCP_STATUS_HDCP1_KSV_LIST_REVOKED:
 		return "MOD_HDCP_STATUS_HDCP1_KSV_LIST_REVOKED";
-	case MOD_HDCP_STATUS_HDCP1_ENABLE_ENCRYPTION:
-		return "MOD_HDCP_STATUS_HDCP1_ENABLE_ENCRYPTION";
+	case MOD_HDCP_STATUS_HDCP1_ENABLE_ENCRYPTION_FAILURE:
+		return "MOD_HDCP_STATUS_HDCP1_ENABLE_ENCRYPTION_FAILURE";
 	case MOD_HDCP_STATUS_HDCP1_ENABLE_STREAM_ENCRYPTION_FAILURE:
 		return "MOD_HDCP_STATUS_HDCP1_ENABLE_STREAM_ENCRYPTION_FAILURE";
 	case MOD_HDCP_STATUS_HDCP1_MAX_CASCADE_EXCEEDED_FAILURE:
@@ -158,8 +158,8 @@ char *mod_hdcp_status_to_str(int32_t status)
 		return "MOD_HDCP_STATUS_HDCP2_RX_ID_LIST_REVOKED";
 	case MOD_HDCP_STATUS_HDCP2_RX_ID_LIST_NOT_READY:
 		return "MOD_HDCP_STATUS_HDCP2_RX_ID_LIST_NOT_READY";
-	case MOD_HDCP_STATUS_HDCP2_ENABLE_STREAM_ENCRYPTION:
-		return "MOD_HDCP_STATUS_HDCP2_ENABLE_STREAM_ENCRYPTION";
+	case MOD_HDCP_STATUS_HDCP2_ENABLE_STREAM_ENCRYPTION_FAILURE:
+		return "MOD_HDCP_STATUS_HDCP2_ENABLE_STREAM_ENCRYPTION_FAILURE";
 	case MOD_HDCP_STATUS_HDCP2_STREAM_READY_PENDING:
 		return "MOD_HDCP_STATUS_HDCP2_STREAM_READY_PENDING";
 	case MOD_HDCP_STATUS_HDCP2_VALIDATE_STREAM_READY_FAILURE:
drivers/gpu/drm/amd/display/modules/hdcp/hdcp_psp.c +2 -2
index 1b54f169392a..39834c8e9993 100644
@@ -239,7 +239,7 @@ enum mod_hdcp_status mod_hdcp_hdcp1_enable_encryption(struct mod_hdcp *hdcp)
 	psp_hdcp_invoke(psp, hdcp_cmd->cmd_id);
 
 	if (hdcp_cmd->hdcp_status != TA_HDCP_STATUS__SUCCESS)
-		return MOD_HDCP_STATUS_HDCP1_ENABLE_ENCRYPTION;
+		return MOD_HDCP_STATUS_HDCP1_ENABLE_ENCRYPTION_FAILURE;
 
 	if (!is_dp_mst_hdcp(hdcp)) {
 		display->state = MOD_HDCP_DISPLAY_ENCRYPTION_ENABLED;
@@ -760,7 +760,7 @@ enum mod_hdcp_status mod_hdcp_hdcp2_enable_dp_stream_encryption(struct mod_hdcp
 	}
 
 	return (hdcp_cmd->hdcp_status == TA_HDCP_STATUS__SUCCESS) ? MOD_HDCP_STATUS_SUCCESS
-								  : MOD_HDCP_STATUS_HDCP2_ENABLE_STREAM_ENCRYPTION;
+								  : MOD_HDCP_STATUS_HDCP2_ENABLE_STREAM_ENCRYPTION_FAILURE;
 }
 
 enum mod_hdcp_status mod_hdcp_hdcp2_prepare_stream_management(struct mod_hdcp *hdcp)
drivers/gpu/drm/amd/display/modules/inc/mod_hdcp.h +2 -2
index eae9309cfb24..eed560eecbab 100644
@@ -60,7 +60,7 @@ enum mod_hdcp_status {
 	MOD_HDCP_STATUS_HDCP1_KSV_LIST_NOT_READY,
 	MOD_HDCP_STATUS_HDCP1_VALIDATE_KSV_LIST_FAILURE,
 	MOD_HDCP_STATUS_HDCP1_KSV_LIST_REVOKED,
-	MOD_HDCP_STATUS_HDCP1_ENABLE_ENCRYPTION,
+	MOD_HDCP_STATUS_HDCP1_ENABLE_ENCRYPTION_FAILURE,
 	MOD_HDCP_STATUS_HDCP1_ENABLE_STREAM_ENCRYPTION_FAILURE,
 	MOD_HDCP_STATUS_HDCP1_MAX_CASCADE_EXCEEDED_FAILURE,
 	MOD_HDCP_STATUS_HDCP1_MAX_DEVS_EXCEEDED_FAILURE,
@@ -90,7 +90,7 @@ enum mod_hdcp_status {
 	MOD_HDCP_STATUS_HDCP2_RX_ID_LIST_NOT_READY,
 	MOD_HDCP_STATUS_HDCP2_VALIDATE_RX_ID_LIST_FAILURE,
 	MOD_HDCP_STATUS_HDCP2_RX_ID_LIST_REVOKED,
-	MOD_HDCP_STATUS_HDCP2_ENABLE_STREAM_ENCRYPTION,
+	MOD_HDCP_STATUS_HDCP2_ENABLE_STREAM_ENCRYPTION_FAILURE,
 	MOD_HDCP_STATUS_HDCP2_STREAM_READY_PENDING,
 	MOD_HDCP_STATUS_HDCP2_VALIDATE_STREAM_READY_FAILURE,
 	MOD_HDCP_STATUS_HDCP2_PREPARE_STREAM_MANAGEMENT_FAILURE,
Signature · 6 lines
2.26.0

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

PATCH 12/36 drm/amd/display: only blank dp stream which will be powered off

In reply to Rodrigo Siqueira

From: Xiaodong Yan <[email protected]>

[why]
blank all dp stream would impact edp

[how]
only blank the one which will be powered off

---
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 25 +++++++++++--------
 1 file changed, 15 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +15 -10
index 6086bbec94fe..ac133fac4dfc 100644
@@ -1238,7 +1238,7 @@ void dcn10_init_pipes(struct dc *dc, struct dc_state *context)
 
 void dcn10_init_hw(struct dc *dc)
 {
-	int i;
+	int i, j;
 	struct abm *abm = dc->res_pool->abm;
 	struct dmcu *dmcu = dc->res_pool->dmcu;
 	struct dce_hwseq *hws = dc->hwseq;
@@ -1328,14 +1328,6 @@ void dcn10_init_hw(struct dc *dc)
 		uint8_t dpcd_power_state = '\0';
 		enum dc_status status = DC_ERROR_UNEXPECTED;
 
-		/* blank all dp streams before power off receiver,
-		 * this should only impact DP
-		 */
-		for (i = 0; i < dc->res_pool->stream_enc_count; i++) {
-			dc->res_pool->stream_enc[i]->funcs->dp_blank(
-						dc->res_pool->stream_enc[i]);
-		}
-
 		for (i = 0; i < dc->link_count; i++) {
 			if (dc->links[i]->connector_signal != SIGNAL_TYPE_DISPLAY_PORT)
 				continue;
@@ -1350,8 +1342,21 @@ void dcn10_init_hw(struct dc *dc)
 				/* 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)
+				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);
+				}
 			}
 		}
 	}
Signature · 6 lines
2.26.0

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

PATCH 13/36 drm/amd/display: Fix ABM config copy for dmcub

In reply to Rodrigo Siqueira

From: Wyatt Wood <[email protected]>

Decouple dmcub config copy from dmcu iram copy.

---
 .../amd/display/modules/power/power_helpers.c | 30 ++++++++++++-------
 .../amd/display/modules/power/power_helpers.h |  3 ++
 2 files changed, 23 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +20 -10
index c1a95da6706f..dd1517684c90 100644
@@ -651,14 +651,31 @@ void fill_iram_v_2_3(struct iram_table_v_2_2 *ram_table, struct dmcu_iram_parame
 			params, ram_table);
 }
 
+bool dmub_init_abm_config(struct abm *abm,
+	struct dmcu_iram_parameters params)
+{
+	unsigned char ram_table[IRAM_SIZE];
+	bool result = false;
+
+	if (abm == NULL)
+		return false;
+
+	memset(&ram_table, 0, sizeof(ram_table));
+
+	fill_iram_v_2_3((struct iram_table_v_2_2 *)ram_table, params);
+	result = abm->funcs->init_abm_config(
+		abm, (char *)(&ram_table), IRAM_RESERVE_AREA_START_V2_2);
+
+	return result;
+}
+
 bool dmcu_load_iram(struct dmcu *dmcu,
 	struct dmcu_iram_parameters params)
 {
 	unsigned char ram_table[IRAM_SIZE];
 	bool result = false;
-	struct abm *abm = dmcu->ctx->dc->res_pool->abm;
 
-	if (dmcu == NULL && abm == NULL)
+	if (dmcu == NULL)
 		return false;
 
 	if (dmcu && !dmcu->funcs->is_dmcu_initialized(dmcu))
@@ -666,14 +683,7 @@ bool dmcu_load_iram(struct dmcu *dmcu,
 
 	memset(&ram_table, 0, sizeof(ram_table));
 
-	// In the case where abm is implemented on dmcub,
-	// dmcu object will be null.
-	// ABM 2.4 and up are implemented on dmcub
-	if (dmcu == NULL) {
-		fill_iram_v_2_3((struct iram_table_v_2_2 *)ram_table, params);
-		result = abm->funcs->init_abm_config(
-			abm, (char *)(&ram_table), IRAM_RESERVE_AREA_START_V2_2);
-	} else if (dmcu->dmcu_version.abm_version == 0x24) {
+	if (dmcu->dmcu_version.abm_version == 0x24) {
 		fill_iram_v_2_3((struct iram_table_v_2_2 *)ram_table, params);
 			result = dmcu->funcs->load_iram(
 					dmcu, 0, (char *)(&ram_table), IRAM_RESERVE_AREA_START_V2_2);
drivers/gpu/drm/amd/display/modules/power/power_helpers.h +3 -0
index e54157026330..46fbca2e2cd1 100644
@@ -26,6 +26,7 @@
 #define MODULES_POWER_POWER_HELPERS_H_
 
 #include "dc/inc/hw/dmcu.h"
+#include "dc/inc/hw/abm.h"
 
 
 enum abm_defines {
@@ -44,5 +45,7 @@ struct dmcu_iram_parameters {
 
 bool dmcu_load_iram(struct dmcu *dmcu,
 		struct dmcu_iram_parameters params);
+bool dmub_init_abm_config(struct abm *abm,
+		struct dmcu_iram_parameters params);
 
 #endif /* MODULES_POWER_POWER_HELPERS_H_ */
Signature · 6 lines
2.26.0

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

PATCH 14/36 drm/amd/display: Translate cursor position by source rect

In reply to Rodrigo Siqueira

From: Nicholas Kazlauskas <[email protected]>

[Why]
Cursor is drawn as part of the framebuffer for a plane on AMD hardware. The cursor position on the framebuffer does not change even if the source rect viewport for the cursor does. This causes the cursor to be clipped.

The following IGT tests fail as a result of this issue:

- kms_plane_cursor@pipe-*-viewport-size-*

[How]
Offset cursor position by plane source rect viewport. If the viewport is unscaled then the cursor is now correctly positioned on any plane - primary or overlay.

There is still a hardware limitation for dealing with the cursor size being incorrectly scaled but that's not something we can address.

Add some documentation explaining some of this in the code while we're at it.

---
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 34 ++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +33 -1
index ac133fac4dfc..9ef5747e5077 100644
@@ -3066,12 +3066,44 @@ void dcn10_set_cursor_position(struct pipe_ctx *pipe_ctx)
 	int x_pos = pos_cpy.x;
 	int y_pos = pos_cpy.y;
 
-	// translate cursor from stream space to plane space
+	/**
+	 * DC cursor is stream space, HW cursor is plane space and drawn
+	 * as part of the framebuffer.
+	 *
+	 * Cursor position can't be negative, but hotspot can be used to
+	 * shift cursor out of the plane bounds. Hotspot must be smaller
+	 * than the cursor size.
+	 */
+
+	/**
+	 * Translate cursor from stream space to plane space.
+	 *
+	 * If the cursor is scaled then we need to scale the position
+	 * to be in the approximately correct place. We can't do anything
+	 * about the actual size being incorrect, that's a limitation of
+	 * the hardware.
+	 */
 	x_pos = (x_pos - x_plane) * pipe_ctx->plane_state->src_rect.width /
 			pipe_ctx->plane_state->dst_rect.width;
 	y_pos = (y_pos - y_plane) * pipe_ctx->plane_state->src_rect.height /
 			pipe_ctx->plane_state->dst_rect.height;
 
+	/**
+	 * If the cursor's source viewport is clipped then we need to
+	 * translate the cursor to appear in the correct position on
+	 * the screen.
+	 *
+	 * This translation isn't affected by scaling so it needs to be
+	 * done *after* we adjust the position for the scale factor.
+	 */
+	x_pos += pipe_ctx->plane_state->src_rect.x;
+	y_pos += pipe_ctx->plane_state->src_rect.y;
+
+	/**
+	 * If the position is negative then we need to add to the hotspot
+	 * to shift the cursor outside the plane.
+	 */
+
 	if (x_pos < 0) {
 		pos_cpy.x_hotspot -= x_pos;
 		x_pos = 0;
Signature · 6 lines
2.26.0

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

PATCH 15/36 drm/amd/display: change default pipe_split policy for DCN1

In reply to Rodrigo Siqueira

From: Eric Yang <[email protected]>

[Why]
Changing policy to dynamic will allow 4k multi display configs to be supported at DPM0

---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +1 -1
index 8b7122249ddc..07265ca7d28c 100644
@@ -585,7 +585,7 @@ static const struct dc_debug_options debug_defaults_drv = {
 		.disable_pplib_clock_request = false,
 		.disable_pplib_wm_range = false,
 		.pplib_wm_report_mode = WM_REPORT_DEFAULT,
-		.pipe_split_policy = MPC_SPLIT_AVOID_MULT_DISP,
+		.pipe_split_policy = MPC_SPLIT_DYNAMIC,
 		.force_single_disp_pipe_split = true,
 		.disable_dcc = DCC_ENABLE,
 		.voltage_align_fclk = true,
Signature · 6 lines
2.26.0

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

PATCH 16/36 drm/amd/display: Fix incorrect cursor pos on scaled primary plane

In reply to Rodrigo Siqueira

From: Nicholas Kazlauskas <[email protected]>

[Why]
Cursor pos is correctly adjusted from DC side for source rect offset on DCN ASIC, but only on the overlay.

This is because DM places offsets the cursor for primary planes only to workaround missing code in DCE for the adjustment we're now correctly doing in DC for DCN ASIC.

[How]
Drop the adjustment for source rect from the DM side of things and put the code where it actually belongs - in DC on the pipe level.

This matches what we do for DCN now.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c     |  6 ------
 .../drm/amd/display/dc/dce110/dce110_hw_sequencer.c   | 11 +++++++++++
 2 files changed, 11 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -6
index 355686178b1a..3dcd4de0b2b3 100644
@@ -6370,12 +6370,6 @@ static int get_cursor_position(struct drm_plane *plane, struct drm_crtc *crtc,
 	    y <= -amdgpu_crtc->max_cursor_height)
 		return 0;
 
-	if (crtc->primary->state) {
-		/* avivo cursor are offset into the total surface */
-		x += crtc->primary->state->src_x >> 16;
-		y += crtc->primary->state->src_y >> 16;
-	}
-
 	if (x < 0) {
 		xorigin = min(-x, amdgpu_crtc->max_cursor_width - 1);
 		x = 0;
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +11 -0
index 0976e378659f..67f7ca346696 100644
@@ -2685,6 +2685,17 @@ void dce110_set_cursor_position(struct pipe_ctx *pipe_ctx)
 		.mirror = pipe_ctx->plane_state->horizontal_mirror
 	};
 
+	/**
+	 * If the cursor's source viewport is clipped then we need to
+	 * translate the cursor to appear in the correct position on
+	 * the screen.
+	 *
+	 * This translation isn't affected by scaling so it needs to be
+	 * done *after* we adjust the position for the scale factor.
+	 */
+	pos_cpy.x += pipe_ctx->plane_state->src_rect.x;
+	pos_cpy.y += pipe_ctx->plane_state->src_rect.y;
+
 	if (pipe_ctx->plane_state->address.type
 			== PLN_ADDR_TYPE_VIDEO_PROGRESSIVE)
 		pos_cpy.enable = false;
Signature · 6 lines
2.26.0

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

PATCH 17/36 drm/amd/display: Program viewport when source pos changes for DCN20 hw seq

In reply to Rodrigo Siqueira

From: Nicholas Kazlauskas <[email protected]>

[Why]
For medium updates that change nothing but the source rect position the viewport doesn't change on DCN20.

We're missing the check for the position update bit that was there in the DCN10 hardware sequencer.

[How]
Check the position bit along with the scaling bit like we were doing with DCN20.

We shouldn't actually hit a case where context != current_state in our programming/commit model but guard against it anyway since it was guarded for the other bits.

---
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +1 -0
index 674e4b8abdfb..7e65c774c800 100644
@@ -1373,6 +1373,7 @@ static void dcn20_update_dchubp_dpp(
 	}
 
 	if (pipe_ctx->update_flags.bits.viewport ||
+			(context == dc->current_state && plane_state->update_flags.bits.position_change) ||
 			(context == dc->current_state && plane_state->update_flags.bits.scaling_change) ||
 			(context == dc->current_state && pipe_ctx->stream->update_flags.bits.scaling)) {
 
Signature · 6 lines
2.26.0

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

PATCH 18/36 drm/amd/display: Calculate scaling ratios on every medium/full update

In reply to Rodrigo Siqueira

From: Nicholas Kazlauskas <[email protected]>

[Why]
If a plane isn't being actively enabled or disabled then DC won't always recalculate scaling rects and ratios for the primary plane.

This results in only a partial or corrupted rect being displayed on the screen instead of scaling to fit the screen.

[How]
Add back the logic to recalculate the scaling rects into dc_commit_updates_for_stream since this is the expected place to do it in DC.

This was previously removed a few years ago to fix an underscan issue but underscan is still functional now with this change - and it should be, since this is only updating to the latest plane state getting passed in.

---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +12 -1
index f21bbb295ad3..6379cf71d9d5 100644
@@ -2462,7 +2462,7 @@ void dc_commit_updates_for_stream(struct dc *dc,
 	enum surface_update_type update_type;
 	struct dc_state *context;
 	struct dc_context *dc_ctx = dc->ctx;
-	int i;
+	int i, j;
 
 	stream_status = dc_stream_get_status(stream);
 	context = dc->current_state;
@@ -2500,6 +2500,17 @@ void dc_commit_updates_for_stream(struct dc *dc,
 
 		copy_surface_update_to_plane(surface, &srf_updates[i]);
 
+		if (update_type >= UPDATE_TYPE_MED) {
+			for (j = 0; j < dc->res_pool->pipe_count; j++) {
+				struct pipe_ctx *pipe_ctx =
+					&context->res_ctx.pipe_ctx[j];
+
+				if (pipe_ctx->plane_state != surface)
+					continue;
+
+				resource_build_scaling_params(pipe_ctx);
+			}
+		}
 	}
 
 	copy_stream_update_to_stream(dc, context, stream, stream_update);
Signature · 6 lines
2.26.0

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

PATCH 19/36 drm/amd/display: Properly map audio to engine on NV14

In reply to Rodrigo Siqueira

From: Martin Leung <[email protected]>

[why]
nv14 has no DIG_D, so when audio mapped to DIG_D is assigned, it doesn't work (audio missing on a port)

[how]
offset audio inst by 1 when greater than DIG_D, like is done in stream_encoder_create

---
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +7 -0
index 5cdbba0cd873..44f056fae3ea 100644
@@ -1324,6 +1324,13 @@ static void read_dce_straps(
 static struct audio *dcn20_create_audio(
 		struct dc_context *ctx, unsigned int inst)
 {
+	/* Navi 14 has no DIGD */
+	if (ASICREV_IS_NAVI14_M(ctx->asic_id.hw_internal_rev)) {
+		if (inst >= ENGINE_ID_DIGD) {
+			inst++;
+		}
+	}
+
 	return dce_audio_create(ctx, inst,
 			&audio_regs[inst], &audio_shift, &audio_mask);
 }
Signature · 6 lines
2.26.0

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

PATCH 20/36 drm/amd/display: Remove unused defines

In reply to Rodrigo Siqueira

From: Wyatt Wood <[email protected]>

[Why]
Defines aren't used. Remove them.

---
 drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c      |  3 ---
 .../gpu/drm/amd/display/dmub/inc/dmub_cmd_dal.h    | 14 ++++++--------
 2 files changed, 6 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c +0 -3
index bc109d4fc6e6..31a9b12ff880 100644
@@ -60,9 +60,6 @@ static bool dmub_psr_set_version(struct dmub_psr *dmub, struct dc_stream_state *
 		return false;
 	else if (stream->psr_version == 0x1)
 		cmd.psr_set_version.psr_set_version_data.version = PSR_VERSION_1;
-	else if (stream->psr_version == 0x2)
-		cmd.psr_set_version.psr_set_version_data.version = PSR_VERSION_2;
-
 	cmd.psr_enable.header.payload_bytes = sizeof(struct dmub_cmd_psr_set_version_data);
 
 	dc_dmub_srv_cmd_queue(dc->dmub_srv, &cmd.psr_enable.header);
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd_dal.h +6 -8
index d37535d21928..cb52ebad0ef9 100644
@@ -32,17 +32,15 @@
  */
 
 enum dmub_cmd_psr_type {
-	DMUB_CMD__PSR_SET_VERSION	= 0,
-	DMUB_CMD__PSR_COPY_SETTINGS	= 1,
-	DMUB_CMD__PSR_ENABLE		= 2,
-	DMUB_CMD__PSR_DISABLE		= 3,
-	DMUB_CMD__PSR_SET_LEVEL		= 4,
+	DMUB_CMD__PSR_SET_VERSION		= 0,
+	DMUB_CMD__PSR_COPY_SETTINGS		= 1,
+	DMUB_CMD__PSR_ENABLE			= 2,
+	DMUB_CMD__PSR_DISABLE			= 3,
+	DMUB_CMD__PSR_SET_LEVEL			= 4,
 };
 
 enum psr_version {
-	PSR_VERSION_1			= 0x10, // PSR Version 1
-	PSR_VERSION_2			= 0x20, // PSR Version 2, includes selective update
-	PSR_VERSION_2_1			= 0x21, // PSR Version 2, includes Y-coordinate support for SU
+	PSR_VERSION_1				= 0,
 };
 
 enum dmub_cmd_abm_type {
Signature · 6 lines
2.26.0

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

PATCH 21/36 drm/amd/display: 3.2.79

In reply to Rodrigo Siqueira

From: Aric Cyr <[email protected]>

---
 drivers/gpu/drm/amd/display/dc/dc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
index fa0724435a3e..e20b09ca8894 100644
@@ -39,7 +39,7 @@
 #include "inc/hw/dmcu.h"
 #include "dml/display_mode_lib.h"
 
-#define DC_VER "3.2.78"
+#define DC_VER "3.2.79"
 
 #define MAX_SURFACES 3
 #define MAX_PLANES 6
Signature · 6 lines
2.26.0

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

PATCH 22/36 drm/amd/display: Update stream adjust in dc_stream_adjust_vmin_vmax

In reply to Rodrigo Siqueira

From: Isabel Zhang <[email protected]>

[Why]
After v_total_min and max are updated in vrr structure, the changes are not reflected in stream adjust. When these values are read from stream adjust it does not reflect the actual state of the system.

[How]
Set stream adjust values equal to vrr adjust values after vrr adjust values are updated.

---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -0
index 6379cf71d9d5..512703eeaf82 100644
@@ -283,6 +283,8 @@ bool dc_stream_adjust_vmin_vmax(struct dc *dc,
 	int i = 0;
 	bool ret = false;
 
+	stream->adjust = *adjust;
+
 	for (i = 0; i < MAX_PIPES; i++) {
 		struct pipe_ctx *pipe = &dc->current_state->res_ctx.pipe_ctx[i];
 
Signature · 6 lines
2.26.0

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

PATCH 23/36 drm/amd/display: fix dml pipe merge logic

In reply to Rodrigo Siqueira

From: Dmytro Laktyushkin <[email protected]>

Dml merges mpc/odm combine pipes to do calculations. This merge is imperfect if there is a viewport overlap. This change saves pre overlap viewport for dml use.

---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c    |  3 +++
 .../gpu/drm/amd/display/dc/dcn20/dcn20_resource.c    | 12 ++++++------
 drivers/gpu/drm/amd/display/dc/inc/hw/transform.h    |  2 ++
 3 files changed, 11 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +3 -0
index 7b32a34908c8..12f5c6881cd0 100644
@@ -692,6 +692,9 @@ static void calculate_viewport(struct pipe_ctx *pipe_ctx)
 	/* Round up, assume original video size always even dimensions */
 	data->viewport_c.width = (data->viewport.width + vpc_div - 1) / vpc_div;
 	data->viewport_c.height = (data->viewport.height + vpc_div - 1) / vpc_div;
+
+	data->viewport_unadjusted = data->viewport;
+	data->viewport_c_unadjusted = data->viewport_c;
 }
 
 static void calculate_recout(struct pipe_ctx *pipe_ctx)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +6 -6
index 44f056fae3ea..ede0723e667d 100644
@@ -2219,12 +2219,12 @@ int dcn20_populate_dml_pipes_from_context(
 					|| pipes[pipe_cnt].pipe.dest.odm_combine != dm_odm_combine_mode_disabled;
 			pipes[pipe_cnt].pipe.src.source_scan = pln->rotation == ROTATION_ANGLE_90
 					|| pln->rotation == ROTATION_ANGLE_270 ? dm_vert : dm_horz;
-			pipes[pipe_cnt].pipe.src.viewport_y_y = scl->viewport.y;
-			pipes[pipe_cnt].pipe.src.viewport_y_c = scl->viewport_c.y;
-			pipes[pipe_cnt].pipe.src.viewport_width = scl->viewport.width;
-			pipes[pipe_cnt].pipe.src.viewport_width_c = scl->viewport_c.width;
-			pipes[pipe_cnt].pipe.src.viewport_height = scl->viewport.height;
-			pipes[pipe_cnt].pipe.src.viewport_height_c = scl->viewport_c.height;
+			pipes[pipe_cnt].pipe.src.viewport_y_y = scl->viewport_unadjusted.y;
+			pipes[pipe_cnt].pipe.src.viewport_y_c = scl->viewport_c_unadjusted.y;
+			pipes[pipe_cnt].pipe.src.viewport_width = scl->viewport_unadjusted.width;
+			pipes[pipe_cnt].pipe.src.viewport_width_c = scl->viewport_c_unadjusted.width;
+			pipes[pipe_cnt].pipe.src.viewport_height = scl->viewport_unadjusted.height;
+			pipes[pipe_cnt].pipe.src.viewport_height_c = scl->viewport_c_unadjusted.height;
 			pipes[pipe_cnt].pipe.src.surface_width_y = pln->plane_size.surface_size.width;
 			pipes[pipe_cnt].pipe.src.surface_height_y = pln->plane_size.surface_size.height;
 			pipes[pipe_cnt].pipe.src.surface_width_c = pln->plane_size.chroma_size.width;
drivers/gpu/drm/amd/display/dc/inc/hw/transform.h +2 -0
index fecc80c47c26..2947d1b15512 100644
@@ -173,6 +173,8 @@ struct scaler_data {
 	struct scaling_taps taps;
 	struct rect viewport;
 	struct rect viewport_c;
+	struct rect viewport_unadjusted;
+	struct rect viewport_c_unadjusted;
 	struct rect recout;
 	struct scaling_ratios ratios;
 	struct scl_inits inits;
Signature · 6 lines
2.26.0

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

PATCH 24/36 drm/amd/display: initialize get_max_link_cap

In reply to Rodrigo Siqueira

From: Charlene Liu <[email protected]>

[why]
usb3->usb2 switch system hang.
driver needs to limit the max sink cap based on DP4 mode.

[how]
based on s_dpalt check and DP4 check:
limit the USB-C DPALT DP maximum supported lane count.

---
 .../amd/display/dc/dcn20/dcn20_link_encoder.c | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_link_encoder.c +24 -0
index e4ac73035c84..15d513b79667 100644
@@ -311,6 +311,28 @@ void enc2_hw_init(struct link_encoder *enc)
 	dcn10_aux_initialize(enc10);
 }
 
+void dcn20_link_encoder_get_max_link_cap(struct link_encoder *enc,
+	struct dc_link_settings *link_settings)
+{
+	struct dcn10_link_encoder *enc10 = TO_DCN10_LINK_ENC(enc);
+	uint32_t value;
+
+	REG_GET(RDPCSTX_PHY_CNTL6, RDPCS_PHY_DPALT_DP4, &value);
+
+	if (!value && link_settings->lane_count > LANE_COUNT_TWO)
+		link_settings->lane_count = LANE_COUNT_TWO;
+}
+bool dcn20_link_encoder_is_in_alt_mode(struct link_encoder *enc)
+{
+	struct dcn10_link_encoder *enc10 = TO_DCN10_LINK_ENC(enc);
+	uint32_t value;
+
+	REG_GET(RDPCSTX_PHY_CNTL6, RDPCS_PHY_DPALT_DISABLE, &value);
+
+	// if value == 1 alt mode is disabled, otherwise it is enabled
+	return !value;
+}
+
 static const struct link_encoder_funcs dcn20_link_enc_funcs = {
 	.read_state = link_enc2_read_state,
 	.validate_output_with_stream =
@@ -338,6 +360,8 @@ static const struct link_encoder_funcs dcn20_link_enc_funcs = {
 	.fec_is_active = enc2_fec_is_active,
 	.get_dig_mode = dcn10_get_dig_mode,
 	.get_dig_frontend = dcn10_get_dig_frontend,
+	.is_in_alt_mode = dcn20_link_encoder_is_in_alt_mode,
+	.get_max_link_cap = dcn20_link_encoder_get_max_link_cap,
 };
 
 void dcn20_link_encoder_construct(
Signature · 6 lines
2.26.0

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

PATCH 25/36 drm/amd/display: Refactor color management to take dm plane state

In reply to Rodrigo Siqueira

From: Stylon Wang <[email protected]>

[Why]
- In amdgpu_dm_update_plane_color_mgmt() it is inconsistent in taking in dm_crtc_state and dc_plane_state.
- Makes supporting plane-level color management with proper guard more complicated than necessary.

[How]
Pass in dm_plane_state in place of dc_plane_state in amdgpu_dm_update_plane_color_mgmt().

---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 23 +++++++++----------
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |  2 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_color.c   |  3 ++-
 3 files changed, 14 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +11 -12
index 3dcd4de0b2b3..47af6e9a31bc 100644
@@ -3772,11 +3772,12 @@ fill_dc_plane_info_and_addr(struct amdgpu_device *adev,
 }
 
 static int fill_dc_plane_attributes(struct amdgpu_device *adev,
-				    struct dc_plane_state *dc_plane_state,
+				    struct dm_plane_state *dm_plane_state,
 				    struct drm_plane_state *plane_state,
 				    struct drm_crtc_state *crtc_state)
 {
 	struct dm_crtc_state *dm_crtc_state = to_dm_crtc_state(crtc_state);
+	struct dc_plane_state *dc_plane_state = dm_plane_state->dc_state;
 	const struct amdgpu_framebuffer *amdgpu_fb =
 		to_amdgpu_framebuffer(plane_state->fb);
 	struct dc_scaling_info scaling_info;
@@ -3824,7 +3825,7 @@ static int fill_dc_plane_attributes(struct amdgpu_device *adev,
 	 * Always set input transfer function, since plane state is refreshed
 	 * every time.
 	 */
-	ret = amdgpu_dm_update_plane_color_mgmt(dm_crtc_state, dc_plane_state);
+	ret = amdgpu_dm_update_plane_color_mgmt(dm_crtc_state, dm_plane_state);
 	if (ret)
 		return ret;
 
@@ -8027,16 +8028,6 @@ static int dm_update_plane_state(struct dc *dc,
 		DRM_DEBUG_DRIVER("Enabling DRM plane: %d on DRM crtc %d\n",
 				plane->base.id, new_plane_crtc->base.id);
 
-		ret = fill_dc_plane_attributes(
-			new_plane_crtc->dev->dev_private,
-			dc_new_plane_state,
-			new_plane_state,
-			new_crtc_state);
-		if (ret) {
-			dc_plane_state_release(dc_new_plane_state);
-			return ret;
-		}
-
 		ret = dm_atomic_get_state(state, &dm_state);
 		if (ret) {
 			dc_plane_state_release(dc_new_plane_state);
@@ -8062,6 +8053,14 @@ static int dm_update_plane_state(struct dc *dc,
 
 		dm_new_plane_state->dc_state = dc_new_plane_state;
 
+		ret = fill_dc_plane_attributes(
+			new_plane_crtc->dev->dev_private,
+			dm_new_plane_state,
+			new_plane_state,
+			new_crtc_state);
+		if (ret)
+			return ret;
+
 		/* Tell DC to do a full surface update every time there
 		 * is a plane change. Inefficient, but works for now.
 		 */
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +1 -1
index 3f0c6298b588..f30dc004bf2b 100644
@@ -482,7 +482,7 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,
 void amdgpu_dm_init_color_mod(void);
 int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc);
 int amdgpu_dm_update_plane_color_mgmt(struct dm_crtc_state *crtc,
-				      struct dc_plane_state *dc_plane_state);
+				      struct dm_plane_state *plane);
 
 void amdgpu_dm_update_connector_after_detect(
 		struct amdgpu_dm_connector *aconnector);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +2 -1
index 2233d293a707..6b58761e4b04 100644
@@ -416,9 +416,10 @@ int amdgpu_dm_update_crtc_color_mgmt(struct dm_crtc_state *crtc)
  * Returns 0 on success.
  */
 int amdgpu_dm_update_plane_color_mgmt(struct dm_crtc_state *crtc,
-				      struct dc_plane_state *dc_plane_state)
+				      struct dm_plane_state *plane)
 {
 	const struct drm_color_lut *degamma_lut;
+	struct dc_plane_state *dc_plane_state = plane->dc_state;
 	uint32_t degamma_size;
 	int r;
 
Signature · 6 lines
2.26.0

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

PATCH 26/36 drm/amd/display: Revert to old formula in set_vtg_params

In reply to Rodrigo Siqueira

From: Alvin Lee <[email protected]>

[Why]
New formula + cursor change causing underflow
on certain configs

[How]
Rever to old formula

---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c +4 -2
index 17d96ec6acd8..ec0ab42becba 100644
@@ -299,6 +299,7 @@ void optc1_set_vtg_params(struct timing_generator *optc,
 	uint32_t asic_blank_end;
 	uint32_t v_init;
 	uint32_t v_fp2 = 0;
+	int32_t vertical_line_start;
 
 	struct optc *optc1 = DCN10TG_FROM_TG(optc);
 
@@ -315,8 +316,9 @@ void optc1_set_vtg_params(struct timing_generator *optc,
 			patched_crtc_timing.v_border_top;
 
 	/* if VSTARTUP is before VSYNC, FP2 is the offset, otherwise 0 */
-	if (optc1->vstartup_start > asic_blank_end)
-		v_fp2 = optc1->vstartup_start - asic_blank_end;
+	vertical_line_start = asic_blank_end - optc1->vstartup_start + 1;
+	if (vertical_line_start < 0)
+		v_fp2 = -vertical_line_start;
 
 	/* Interlace */
 	if (REG(OTG_INTERLACE_CONTROL)) {
Signature · 6 lines
2.26.0

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

PATCH 27/36 drm/amd/display: Properly map audio to engine on NV14

In reply to Rodrigo Siqueira

From: Charlene Liu <[email protected]>

[why]
This reverts commit c30259abddf924533e9452f71ee03819fd6e949d.

---
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +0 -7
index ede0723e667d..9e1d2b2e58f9 100644
@@ -1324,13 +1324,6 @@ static void read_dce_straps(
 static struct audio *dcn20_create_audio(
 		struct dc_context *ctx, unsigned int inst)
 {
-	/* Navi 14 has no DIGD */
-	if (ASICREV_IS_NAVI14_M(ctx->asic_id.hw_internal_rev)) {
-		if (inst >= ENGINE_ID_DIGD) {
-			inst++;
-		}
-	}
-
 	return dce_audio_create(ctx, inst,
 			&audio_regs[inst], &audio_shift, &audio_mask);
 }
Signature · 6 lines
2.26.0

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

PATCH 28/36 drm/amd/display: Don't verify DP caps again

In reply to Rodrigo Siqueira

From: Dale Zhao <[email protected]>

[Why]:
We will do deffer call back for display detection now. For S4/PM resuming case, if SST DP monitor has been lighted up, verify DP caps again and reenable stream during detection will black screen and light again. Which is a flash problem.

[How]:
Shoudn't do verify SST DP caps if link has been active, and skip reenable stream.

Change-Id I5267db502e5fab0102a0db4d520bfa9282aa050e
---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +9 -5
index ecbf165b5775..574612ddd5d2 100644
@@ -987,11 +987,15 @@ static bool dc_link_detect_helper(struct dc_link *link,
 			 *  two link trainings
 			 */
 
-			// verify link cap for SST non-seamless boot
-			if (!perform_dp_seamless_boot)
-				dp_verify_link_cap_with_retries(link,
-						&link->reported_link_cap,
-						LINK_TRAINING_MAX_VERIFY_RETRY);
+			// verify link cap for SST non-seamless boot, skip re-verify if link is active
+			if (!perform_dp_seamless_boot) {
+				if (!link->link_status.link_active ||
+					link->verified_link_cap.link_rate == LINK_RATE_UNKNOWN ||
+					link->verified_link_cap.lane_count == LANE_COUNT_UNKNOWN)
+					dp_verify_link_cap_with_retries(link,
+									&link->reported_link_cap,
+									LINK_TRAINING_MAX_VERIFY_RETRY);
+			}
 		} else {
 			// If edid is the same, then discard new sink and revert back to original sink
 			if (same_edid) {
Signature · 6 lines
2.26.0

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

PATCH 29/36 drm/amd/display: Make cursor source translation adjustment optional

In reply to Rodrigo Siqueira

From: Nicholas Kazlauskas <[email protected]>

[Why]
In some usecases, like tiled display, the stream and plane configuration can be setup in a way where the caller expects DAL to perform the clipping, eg:

P0:
src_rect(0, 0, w, h)
dst_rect(0, 0, w, h)

P1:
src_rect(w, 0, w, h)
dst_rect(0, 0, w, h)

Cursor is enabled on both streams with the same position.

This can result in double cursor on tiled display, even though this behavior is technically correct from the DC interface point of view.

We need a mechanism to control this dynamically.

[How]
This is something that should live in the DM layer based on detection of the specified configuration but it's not something that we really have enough information to deal with today.

Add a flag to the cursor position state that specifies whether we want DC to do the translation or not and make it opt-in and let the DM decide when to do it.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c      |  1 +
 drivers/gpu/drm/amd/display/dc/dc_hw_types.h           |  2 ++
 .../drm/amd/display/dc/dce110/dce110_hw_sequencer.c    | 10 ++++++++--
 .../gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c  | 10 ++++++++--
 4 files changed, 19 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -0
index 47af6e9a31bc..4b791e6909c4 100644
@@ -6380,6 +6380,7 @@ static int get_cursor_position(struct drm_plane *plane, struct drm_crtc *crtc,
 		y = 0;
 	}
 	position->enable = true;
+	position->translate_by_source = true;
 	position->x = x;
 	position->y = y;
 	position->x_hotspot = xorigin;
drivers/gpu/drm/amd/display/dc/dc_hw_types.h +2 -0
index 25c50bcab9e9..a8dc3082e3e1 100644
@@ -385,6 +385,8 @@ struct dc_cursor_position {
 	 */
 	bool enable;
 
+	/* Translate cursor x/y by the source rectangle for each plane. */
+	bool translate_by_source;
 };
 
 struct dc_cursor_mi_param {
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +8 -2
index 67f7ca346696..c279982947e1 100644
@@ -2692,9 +2692,15 @@ void dce110_set_cursor_position(struct pipe_ctx *pipe_ctx)
 	 *
 	 * This translation isn't affected by scaling so it needs to be
 	 * done *after* we adjust the position for the scale factor.
+	 *
+	 * This is only done by opt-in for now since there are still
+	 * some usecases like tiled display that might enable the
+	 * cursor on both streams while expecting dc to clip it.
 	 */
-	pos_cpy.x += pipe_ctx->plane_state->src_rect.x;
-	pos_cpy.y += pipe_ctx->plane_state->src_rect.y;
+	if (pos_cpy.translate_by_source) {
+		pos_cpy.x += pipe_ctx->plane_state->src_rect.x;
+		pos_cpy.y += pipe_ctx->plane_state->src_rect.y;
+	}
 
 	if (pipe_ctx->plane_state->address.type
 			== PLN_ADDR_TYPE_VIDEO_PROGRESSIVE)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +8 -2
index 9ef5747e5077..9f41efddc9bc 100644
@@ -3095,9 +3095,15 @@ void dcn10_set_cursor_position(struct pipe_ctx *pipe_ctx)
 	 *
 	 * This translation isn't affected by scaling so it needs to be
 	 * done *after* we adjust the position for the scale factor.
+	 *
+	 * This is only done by opt-in for now since there are still
+	 * some usecases like tiled display that might enable the
+	 * cursor on both streams while expecting dc to clip it.
 	 */
-	x_pos += pipe_ctx->plane_state->src_rect.x;
-	y_pos += pipe_ctx->plane_state->src_rect.y;
+	if (pos_cpy.translate_by_source) {
+		x_pos += pipe_ctx->plane_state->src_rect.x;
+		y_pos += pipe_ctx->plane_state->src_rect.y;
+	}
 
 	/**
 	 * If the position is negative then we need to add to the hotspot
Signature · 6 lines
2.26.0

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

PATCH 30/36 drm/amd/display: Avoid create MST prop after registration

In reply to Rodrigo Siqueira

From: "Jerry (Fangzhi) Zuo" <[email protected]>

[Why]
Prop are created at boot stage, and not allowed to create new prop after device registration.

[How]
Reuse the connector property from SST if exist.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c         | 8 +++++---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c   | 8 ++++++++
 2 files changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5 -3
index 4b791e6909c4..ca7489cbba94 100644
@@ -6024,7 +6024,8 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm,
 				adev->mode_info.underscan_vborder_property,
 				0);
 
-	drm_connector_attach_max_bpc_property(&aconnector->base, 8, 16);
+	if (!aconnector->mst_port)
+		drm_connector_attach_max_bpc_property(&aconnector->base, 8, 16);
 
 	/* This defaults to the max in the range, but we want 8bpc for non-edp. */
 	aconnector->base.state->max_bpc = (connector_type == DRM_MODE_CONNECTOR_eDP) ? 16 : 8;
@@ -6043,8 +6044,9 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm,
 			&aconnector->base.base,
 			dm->ddev->mode_config.hdr_output_metadata_property, 0);
 
-		drm_connector_attach_vrr_capable_property(
-			&aconnector->base);
+		if (!aconnector->mst_port)
+			drm_connector_attach_vrr_capable_property(&aconnector->base);
+
 #ifdef CONFIG_DRM_AMD_DC_HDCP
 		if (adev->dm.hdcp_workqueue)
 			drm_connector_attach_content_protection_property(&aconnector->base, true);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +8 -0
index cc1b52b72c0b..b401dc44ff1d 100644
@@ -410,6 +410,14 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
 	drm_connector_attach_encoder(&aconnector->base,
 				     &aconnector->mst_encoder->base);
 
+	connector->max_bpc_property = master->base.max_bpc_property;
+	if (connector->max_bpc_property)
+		drm_connector_attach_max_bpc_property(connector, 8, 16);
+
+	connector->vrr_capable_property = master->base.vrr_capable_property;
+	if (connector->vrr_capable_property)
+		drm_connector_attach_vrr_capable_property(connector);
+
 	drm_object_attach_property(
 		&connector->base,
 		dev->mode_config.path_property,
Signature · 6 lines
2.26.0

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

Re: [PATCH 30/36] drm/amd/display: Avoid create MST prop after registration

Quoted 6 lines · Rodrigo Siqueira

From: "Jerry (Fangzhi) Zuo" <[email protected]>

[Why]
Prop are created at boot stage, and not allowed to create new prop after device registration.

Quoted 6 lines

[How]
Reuse the connector property from SST if exist.

This patch is needed in 5.7, or one gets the WARNINGs I reported in
https://lists.freedesktop.org/archives/amd-gfx/2020-April/048017.html
when an MST display is connected.

Note that this patch doesn't fix all of those, there's also one triggered by dm_dp_add_mst_connector => drm_encoder_init.

git grep mst_encoders drivers/gpu/drm/i915/

shows how the i915 driver deals with this.

Can you guys take care of that for 5.7 as well?

Signature · 6 lines
Earthling Michel Dänzer               |               https://redhat.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#32 lore raw

Re: [PATCH 30/36] drm/amd/display: Avoid create MST prop after registration

Hi Michel,

I'm going to apply the patchset by the end of the day at AMD repository. Is that ok for you? Or do you need this patch on drm-misc-next?

Best Regards

Quoted 30 lines · Michel Dänzer
Quoted 6 lines · Rodrigo Siqueira

From: "Jerry (Fangzhi) Zuo" <[email protected]>

[Why]
Prop are created at boot stage, and not allowed to create new prop after device registration.

Quoted 6 lines

[How]
Reuse the connector property from SST if exist.

This patch is needed in 5.7, or one gets the WARNINGs I reported in
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Farchives%2Famd-gfx%2F2020-April%2F048017.html&amp;data=02%7C01%7CRodrigo.Siqueira%40amd.com%7C82562d6efc6a4c85afd108d7da3c7490%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637217825519023312&amp;sdata=h7ZVldKMgP%2FWkMVpjn%2BX6fytKoNZi24lFjOdS3QMUts%3D&amp;reserved=0
when an MST display is connected.

Note that this patch doesn't fix all of those, there's also one triggered by dm_dp_add_mst_connector => drm_encoder_init.

git grep mst_encoders drivers/gpu/drm/i915/

shows how the i915 driver deals with this.

Can you guys take care of that for 5.7 as well?

Signature · 2 lines
Earthling Michel Dänzer               |               https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fredhat.com%2F&amp;data=02%7C01%7CRodrigo.Siqueira%40amd.com%7C82562d6efc6a4c85afd108d7da3c7490%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637217825519028304&amp;sdata=h9fm4x4B3Kn1U4bloZbLeZTbjygZCHIgoyroaEW9%2B3s%3D&amp;reserved=0
Libre software enthusiast             |             Mesa and X developer
Signature · 2 lines
Rodrigo Siqueira
https://siqueira.tech

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

#33 lore raw

Re: [PATCH 30/36] drm/amd/display: Avoid create MST prop after registration

Quoted 5 lines · Rodrigo Siqueira

Hi Michel,

I'm going to apply the patchset by the end of the day at AMD repository. Is that ok for you? Or do you need this patch on drm-misc-next?

I can cherry-pick the changes over to 5.7 fixes once we've addressed all the issues.

Alex

Quoted 35 lines

Best Regards

Quoted 22 lines · Michel Dänzer
Quoted 6 lines · Rodrigo Siqueira

From: "Jerry (Fangzhi) Zuo" <[email protected]>

[Why]
Prop are created at boot stage, and not allowed to create new prop after device registration.

Quoted 6 lines

[How]
Reuse the connector property from SST if exist.

This patch is needed in 5.7, or one gets the WARNINGs I reported in
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Farchives%2Famd-gfx%2F2020-April%2F048017.html&amp;data=02%7C01%7CRodrigo.Siqueira%40amd.com%7C82562d6efc6a4c85afd108d7da3c7490%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637217825519023312&amp;sdata=h7ZVldKMgP%2FWkMVpjn%2BX6fytKoNZi24lFjOdS3QMUts%3D&amp;reserved=0
when an MST display is connected.

Note that this patch doesn't fix all of those, there's also one triggered by dm_dp_add_mst_connector => drm_encoder_init.

git grep mst_encoders drivers/gpu/drm/i915/

Quoted 8 lines

shows how the i915 driver deals with this.

Can you guys take care of that for 5.7 as well?

--
Earthling Michel Dänzer | https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fredhat.com%2F&amp;data=02%7C01%7CRodrigo.Siqueira%40amd.com%7C82562d6efc6a4c85afd108d7da3c7490%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637217825519028304&amp;sdata=h9fm4x4B3Kn1U4bloZbLeZTbjygZCHIgoyroaEW9%2B3s%3D&amp;reserved=0
Libre software enthusiast | Mesa and X developer

Quoted 7 lines

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

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

#34 lore raw

Re: [PATCH 30/36] drm/amd/display: Avoid create MST prop after registration

Ok, I'll just push the patch to our repository.

Thanks

Quoted 55 lines · Alex Deucher
Quoted 5 lines · Rodrigo Siqueira

Hi Michel,

I'm going to apply the patchset by the end of the day at AMD repository. Is that ok for you? Or do you need this patch on drm-misc-next?

I can cherry-pick the changes over to 5.7 fixes once we've addressed all the issues.

Alex

Quoted 42 lines

Best Regards

Quoted 22 lines · Michel Dänzer
Quoted 6 lines · Rodrigo Siqueira

From: "Jerry (Fangzhi) Zuo" <[email protected]>

[Why]
Prop are created at boot stage, and not allowed to create new prop after device registration.

Quoted 6 lines

[How]
Reuse the connector property from SST if exist.

This patch is needed in 5.7, or one gets the WARNINGs I reported in
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Farchives%2Famd-gfx%2F2020-April%2F048017.html&amp;data=02%7C01%7CRodrigo.Siqueira%40amd.com%7Cc277a51490f94ed99a2508d7da5af6f0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637217956540368991&amp;sdata=%2FGtnTlXrRSzZM7M4KApZO1FFVCJjuJ8cur74s2ZNz0E%3D&amp;reserved=0
when an MST display is connected.

Note that this patch doesn't fix all of those, there's also one triggered by dm_dp_add_mst_connector => drm_encoder_init.

git grep mst_encoders drivers/gpu/drm/i915/

Quoted 8 lines

shows how the i915 driver deals with this.

Can you guys take care of that for 5.7 as well?

--
Earthling Michel Dänzer | https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fredhat.com%2F&amp;data=02%7C01%7CRodrigo.Siqueira%40amd.com%7Cc277a51490f94ed99a2508d7da5af6f0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637217956540373986&amp;sdata=ckUT0WFeLWopbqY6SG%2Bg69i%2F3O6cTkSTWqBAyFHg3iw%3D&amp;reserved=0
Libre software enthusiast | Mesa and X developer

--
Rodrigo Siqueira
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsiqueira.tech%2F&amp;data=02%7C01%7CRodrigo.Siqueira%40amd.com%7Cc277a51490f94ed99a2508d7da5af6f0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637217956540373986&amp;sdata=%2BkwwR38PUel4j21WGo%2FxPMoXS%2BLnEQ4ax1yGxI%2F5xHc%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7CRodrigo.Siqueira%40amd.com%7Cc277a51490f94ed99a2508d7da5af6f0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637217956540373986&amp;sdata=VlEy9R5us1VevQmtUJjen%2FrVoi0F8bjIAh%2FwffiCP2k%3D&amp;reserved=0

Signature · 2 lines
Rodrigo Siqueira
https://siqueira.tech

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

#35 lore raw

Re: [PATCH 30/36] drm/amd/display: Avoid create MST prop after registration

Quoted 2 lines · Rodrigo Siqueira

Ok, I'll just push the patch to our repository.

Sounds good. Please note the other issue Michel mentioned below. We need a fix for that as well for 5.7.

Thanks,

Alex

Quoted 60 lines

Thanks

Quoted 5 lines · Alex Deucher
Quoted 3 lines · Rodrigo Siqueira

Hi Michel,

Quoted 50 lines
Quoted 2 lines

I'm going to apply the patchset by the end of the day at AMD repository. Is that ok for you? Or do you need this patch on drm-misc-next?

I can cherry-pick the changes over to 5.7 fixes once we've addressed all the issues.

Alex

Quoted 42 lines

Best Regards

Quoted 22 lines · Michel Dänzer
Quoted 6 lines · Rodrigo Siqueira

From: "Jerry (Fangzhi) Zuo" <[email protected]>

[Why]
Prop are created at boot stage, and not allowed to create new prop after device registration.

Quoted 6 lines

[How]
Reuse the connector property from SST if exist.

This patch is needed in 5.7, or one gets the WARNINGs I reported in
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Farchives%2Famd-gfx%2F2020-April%2F048017.html&amp;data=02%7C01%7CRodrigo.Siqueira%40amd.com%7Cc277a51490f94ed99a2508d7da5af6f0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637217956540368991&amp;sdata=%2FGtnTlXrRSzZM7M4KApZO1FFVCJjuJ8cur74s2ZNz0E%3D&amp;reserved=0
when an MST display is connected.

Note that this patch doesn't fix all of those, there's also one triggered by dm_dp_add_mst_connector => drm_encoder_init.

git grep mst_encoders drivers/gpu/drm/i915/

Quoted 8 lines

shows how the i915 driver deals with this.

Can you guys take care of that for 5.7 as well?

--
Earthling Michel Dänzer | https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fredhat.com%2F&amp;data=02%7C01%7CRodrigo.Siqueira%40amd.com%7Cc277a51490f94ed99a2508d7da5af6f0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637217956540373986&amp;sdata=ckUT0WFeLWopbqY6SG%2Bg69i%2F3O6cTkSTWqBAyFHg3iw%3D&amp;reserved=0
Libre software enthusiast | Mesa and X developer

--
Rodrigo Siqueira
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsiqueira.tech%2F&amp;data=02%7C01%7CRodrigo.Siqueira%40amd.com%7Cc277a51490f94ed99a2508d7da5af6f0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637217956540373986&amp;sdata=%2BkwwR38PUel4j21WGo%2FxPMoXS%2BLnEQ4ax1yGxI%2F5xHc%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7CRodrigo.Siqueira%40amd.com%7Cc277a51490f94ed99a2508d7da5af6f0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637217956540373986&amp;sdata=VlEy9R5us1VevQmtUJjen%2FrVoi0F8bjIAh%2FwffiCP2k%3D&amp;reserved=0

Quoted 3 lines

--
Rodrigo Siqueira
https://siqueira.tech

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

#36 lore raw

Re: [PATCH 30/36] drm/amd/display: Avoid create MST prop after registration

Quoted 7 lines · Alex Deucher
Quoted 2 lines · Rodrigo Siqueira

Ok, I'll just push the patch to our repository.

Sounds good. Please note the other issue Michel mentioned below. We need a fix for that as well for 5.7.

That'll be great, thanks!

Signature · 6 lines
Earthling Michel Dänzer               |               https://redhat.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#37 lore raw

PATCH 31/36 drm/amd/display: Update DRAM watermark before checking to update TTU

In reply to Rodrigo Siqueira

From: Jaehyun Chung <[email protected]>

[Why]
In most cases, DRAM watermark is large enough that the result of the condition to increase TTU doesn't change after DRAM watermark is increased. However, there is are cases where the condition fails and becomes true after DRAM watermark is increased. This results in minTTU < DRAM watermarks which leads to PSR hang since p-state is requested but not allowed.

[How]
Check whether to update TTU after DRAM watermark is updated.

---
 .../gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_mode_vba_20v2.c +2 -1
index 5bbbafacc720..922ab7169e52 100644
@@ -2614,6 +2614,7 @@ static void dml20v2_DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndP
 
 	if (mode_lib->vba.DRAMClockChangeSupportsVActive &&
 			mode_lib->vba.MinActiveDRAMClockChangeMargin > 60) {
+		mode_lib->vba.DRAMClockChangeWatermark += 25;
 
 		for (k = 0; k < mode_lib->vba.NumberOfActivePlanes; ++k) {
 			if (mode_lib->vba.PrefetchMode[mode_lib->vba.VoltageLevel][mode_lib->vba.maxMpcComb] == 0) {
@@ -2622,7 +2623,7 @@ static void dml20v2_DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndP
 					mode_lib->vba.MinTTUVBlank[k] += 25;
 			}
 		}
-		mode_lib->vba.DRAMClockChangeWatermark += 25;
+
 		mode_lib->vba.DRAMClockChangeSupport[0][0] = dm_dram_clock_change_vactive;
 	} else if (mode_lib->vba.DummyPStateCheck &&
 			mode_lib->vba.MinActiveDRAMClockChangeMargin > 0) {
Signature · 6 lines
2.26.0

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

PATCH 32/36 drm/amd/display: Acknowledge wm_optimized_required

In reply to Rodrigo Siqueira

From: Joshua Aberback <[email protected]>

[Why]
If dc->clk_mgr->funcs->are_clock_states_equal is set, then wm_optimized_required is never checked. In that case, when going from a higher mode to a lower mode, wm_optimized_required remains true until the next mode change.

[How]
- move from else-if to unconditional or

---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +3 -2
index 512703eeaf82..8489f1e56892 100644
@@ -1861,8 +1861,9 @@ enum surface_update_type dc_check_update_surfaces_for_stream(
 		// Else we fallback to mem compare.
 		} else if (memcmp(&dc->current_state->bw_ctx.bw.dcn.clk, &dc->clk_mgr->clks, offsetof(struct dc_clocks, prev_p_state_change_support)) != 0) {
 			dc->optimized_required = true;
-		} else if (dc->wm_optimized_required)
-			dc->optimized_required = true;
+		}
+
+		dc->optimized_required |= dc->wm_optimized_required;
 	}
 
 	return type;
Signature · 6 lines
2.26.0

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

PATCH 33/36 drm/amd/display: Check for null fclk voltage when parsing clock table

In reply to Rodrigo Siqueira

From: Michael Strauss <[email protected]>

[WHY]
In cases where a clock table is malformed such that fclk entries have frequencies but not voltages listed, we don't catch the error and set clocks to 0 instead of using hardcoded values as we should.

[HOW]
Add check for clock tables fclk entry's voltage as well

---
 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +1 -1
index ab267ddd4abe..24c5765890fa 100644
@@ -643,7 +643,7 @@ static void rn_clk_mgr_helper_populate_bw_params(struct clk_bw_params *bw_params
 	/* Find lowest DPM, FCLK is filled in reverse order*/
 
 	for (i = PP_SMU_NUM_FCLK_DPM_LEVELS - 1; i >= 0; i--) {
-		if (clock_table->FClocks[i].Freq != 0) {
+		if (clock_table->FClocks[i].Freq != 0 && clock_table->FClocks[i].Vol != 0) {
 			j = i;
 			break;
 		}
Signature · 6 lines
2.26.0

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

PATCH 34/36 drm/amd/display: determine USB C DP2 mode only when USB DP Alt is enabled

In reply to Rodrigo Siqueira

From: Wenjing Liu <[email protected]>

[why]
When display is connected with a native DP port, DP2 mode register value is a don't care. Driver mistakenly reduce max supported lane count to 2 lane based on the don't care value.

[how]
Add additional check only if USB C DP alt mode is enabled, we will determine max lane count supported based on current mode.

---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c |  4 +-
 .../gpu/drm/amd/display/dc/core/dc_link_dp.c  | 15 +----
 .../drm/amd/display/dc/dce/dce_link_encoder.c | 20 ++++++-
 .../drm/amd/display/dc/dce/dce_link_encoder.h |  3 +
 .../amd/display/dc/dcn10/dcn10_link_encoder.c | 20 ++++++-
 .../amd/display/dc/dcn10/dcn10_link_encoder.h |  3 +
 .../amd/display/dc/dcn20/dcn20_link_encoder.c | 60 ++++++++++++-------
 .../amd/display/dc/dcn20/dcn20_link_encoder.h |  4 ++
 .../amd/display/dc/dcn21/dcn21_link_encoder.c | 27 +--------
 .../display/dc/virtual/virtual_link_encoder.c |  9 +++
 10 files changed, 101 insertions(+), 64 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +2 -2
index 574612ddd5d2..fb25475101cc 100644
@@ -686,7 +686,7 @@ static bool is_same_edid(struct dc_edid *old_edid, struct dc_edid *new_edid)
 	return (memcmp(old_edid->raw_edid, new_edid->raw_edid, new_edid->length) == 0);
 }
 
-static bool wait_for_alt_mode(struct dc_link *link)
+static bool wait_for_entering_dp_alt_mode(struct dc_link *link)
 {
 
 	/**
@@ -843,7 +843,7 @@ static bool dc_link_detect_helper(struct dc_link *link,
 			if (link->link_enc->features.flags.bits.DP_IS_USB_C == 1) {
 
 				/* if alt mode times out, return false */
-				if (wait_for_alt_mode(link) == false) {
+				if (wait_for_entering_dp_alt_mode(link) == false) {
 					return false;
 				}
 			}
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +3 -12
index 7cbb1efb4f68..74cf06aacd6c 100644
@@ -1710,19 +1710,10 @@ bool dc_link_dp_sync_lt_end(struct dc_link *link, bool link_down)
 
 static struct dc_link_settings get_max_link_cap(struct dc_link *link)
 {
-	/* Set Default link settings */
-	struct dc_link_settings max_link_cap = {LANE_COUNT_FOUR, LINK_RATE_HIGH,
-			LINK_SPREAD_05_DOWNSPREAD_30KHZ, false, 0};
-
-	/* Higher link settings based on feature supported */
-	if (link->link_enc->features.flags.bits.IS_HBR2_CAPABLE)
-		max_link_cap.link_rate = LINK_RATE_HIGH2;
-
-	if (link->link_enc->features.flags.bits.IS_HBR3_CAPABLE)
-		max_link_cap.link_rate = LINK_RATE_HIGH3;
+	struct dc_link_settings max_link_cap = {0};
 
-	if (link->link_enc->funcs->get_max_link_cap)
-		link->link_enc->funcs->get_max_link_cap(link->link_enc, &max_link_cap);
+	/* get max link encoder capability */
+	link->link_enc->funcs->get_max_link_cap(link->link_enc, &max_link_cap);
 
 	/* Lower link settings based on sink's link cap */
 	if (link->reported_link_cap.lane_count < max_link_cap.lane_count)
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c +19 -1
index 8527cce81c6f..8d8c84c81b34 100644
@@ -118,7 +118,8 @@ static const struct link_encoder_funcs dce110_lnk_enc_funcs = {
 	.enable_hpd = dce110_link_encoder_enable_hpd,
 	.disable_hpd = dce110_link_encoder_disable_hpd,
 	.is_dig_enabled = dce110_is_dig_enabled,
-	.destroy = dce110_link_encoder_destroy
+	.destroy = dce110_link_encoder_destroy,
+	.get_max_link_cap = dce110_link_encoder_get_max_link_cap
 };
 
 static enum bp_result link_transmitter_control(
@@ -1389,3 +1390,20 @@ void dce110_link_encoder_disable_hpd(struct link_encoder *enc)
 
 	set_reg_field_value(value, 0, DC_HPD_CONTROL, DC_HPD_EN);
 }
+
+void dce110_link_encoder_get_max_link_cap(struct link_encoder *enc,
+	struct dc_link_settings *link_settings)
+{
+	/* Set Default link settings */
+	struct dc_link_settings max_link_cap = {LANE_COUNT_FOUR, LINK_RATE_HIGH,
+			LINK_SPREAD_05_DOWNSPREAD_30KHZ, false, 0};
+
+	/* Higher link settings based on feature supported */
+	if (enc->features.flags.bits.IS_HBR2_CAPABLE)
+		max_link_cap.link_rate = LINK_RATE_HIGH2;
+
+	if (enc->features.flags.bits.IS_HBR3_CAPABLE)
+		max_link_cap.link_rate = LINK_RATE_HIGH3;
+
+	*link_settings = max_link_cap;
+}
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.h +3 -0
index 3c9368df4093..384389f0e2c3 100644
@@ -271,4 +271,7 @@ void dce110_psr_program_secondary_packet(struct link_encoder *enc,
 
 bool dce110_is_dig_enabled(struct link_encoder *enc);
 
+void dce110_link_encoder_get_max_link_cap(struct link_encoder *enc,
+	struct dc_link_settings *link_settings);
+
 #endif /* __DC_LINK_ENCODER__DCE110_H__ */
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.c +18 -2
index d3617d6785a7..7fd385be3f3d 100644
@@ -90,7 +90,8 @@ static const struct link_encoder_funcs dcn10_lnk_enc_funcs = {
 	.is_dig_enabled = dcn10_is_dig_enabled,
 	.get_dig_frontend = dcn10_get_dig_frontend,
 	.get_dig_mode = dcn10_get_dig_mode,
-	.destroy = dcn10_link_encoder_destroy
+	.destroy = dcn10_link_encoder_destroy,
+	.get_max_link_cap = dcn10_link_encoder_get_max_link_cap,
 };
 
 static enum bp_result link_transmitter_control(
@@ -1370,7 +1371,6 @@ void dcn10_link_encoder_disable_hpd(struct link_encoder *enc)
 			DC_HPD_EN, 0);
 }
 
-
 #define AUX_REG(reg)\
 	(enc10->aux_regs->reg)
 
@@ -1425,3 +1425,19 @@ enum signal_type dcn10_get_dig_mode(
 	return SIGNAL_TYPE_NONE;
 }
 
+void dcn10_link_encoder_get_max_link_cap(struct link_encoder *enc,
+	struct dc_link_settings *link_settings)
+{
+	/* Set Default link settings */
+	struct dc_link_settings max_link_cap = {LANE_COUNT_FOUR, LINK_RATE_HIGH,
+			LINK_SPREAD_05_DOWNSPREAD_30KHZ, false, 0};
+
+	/* Higher link settings based on feature supported */
+	if (enc->features.flags.bits.IS_HBR2_CAPABLE)
+		max_link_cap.link_rate = LINK_RATE_HIGH2;
+
+	if (enc->features.flags.bits.IS_HBR3_CAPABLE)
+		max_link_cap.link_rate = LINK_RATE_HIGH3;
+
+	*link_settings = max_link_cap;
+}
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.h +3 -0
index 762109174fb8..68395bcc24fd 100644
@@ -575,4 +575,7 @@ void dcn10_aux_initialize(struct dcn10_link_encoder *enc10);
 
 enum signal_type dcn10_get_dig_mode(
 	struct link_encoder *enc);
+
+void dcn10_link_encoder_get_max_link_cap(struct link_encoder *enc,
+	struct dc_link_settings *link_settings);
 #endif /* __DC_LINK_ENCODER__DCN10_H__ */
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_link_encoder.c +38 -22

78 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dcn20/dcn20_link_encoder.h +4 -0
index 8cab8107fd94..284a1ee4d249 100644
@@ -343,6 +343,10 @@ void dcn20_link_encoder_enable_dp_output(
 	const struct dc_link_settings *link_settings,
 	enum clock_source_id clock_source);
 
+bool dcn20_link_encoder_is_in_alt_mode(struct link_encoder *enc);
+void dcn20_link_encoder_get_max_link_cap(struct link_encoder *enc,
+	struct dc_link_settings *link_settings);
+
 void dcn20_link_encoder_construct(
 	struct dcn20_link_encoder *enc20,
 	const struct encoder_init_data *init_data,
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_link_encoder.c +2 -25
index e45683ac871a..aa46c35b05a2 100644
@@ -203,29 +203,6 @@ static bool update_cfg_data(
 	return true;
 }
 
-void dcn21_link_encoder_get_max_link_cap(struct link_encoder *enc,
-	struct dc_link_settings *link_settings)
-{
-	struct dcn10_link_encoder *enc10 = TO_DCN10_LINK_ENC(enc);
-	uint32_t value;
-
-	REG_GET(RDPCSTX_PHY_CNTL6, RDPCS_PHY_DPALT_DP4, &value);
-
-	if (!value && link_settings->lane_count > LANE_COUNT_TWO)
-		link_settings->lane_count = LANE_COUNT_TWO;
-}
-
-bool dcn21_link_encoder_is_in_alt_mode(struct link_encoder *enc)
-{
-	struct dcn10_link_encoder *enc10 = TO_DCN10_LINK_ENC(enc);
-	uint32_t value;
-
-	REG_GET(RDPCSTX_PHY_CNTL6, RDPCS_PHY_DPALT_DISABLE, &value);
-
-	// if value == 1 alt mode is disabled, otherwise it is enabled
-	return !value;
-}
-
 bool dcn21_link_encoder_acquire_phy(struct link_encoder *enc)
 {
 	struct dcn10_link_encoder *enc10 = TO_DCN10_LINK_ENC(enc);
@@ -348,8 +325,8 @@ static const struct link_encoder_funcs dcn21_link_enc_funcs = {
 	.fec_set_ready = enc2_fec_set_ready,
 	.fec_is_active = enc2_fec_is_active,
 	.get_dig_frontend = dcn10_get_dig_frontend,
-	.is_in_alt_mode = dcn21_link_encoder_is_in_alt_mode,
-	.get_max_link_cap = dcn21_link_encoder_get_max_link_cap,
+	.is_in_alt_mode = dcn20_link_encoder_is_in_alt_mode,
+	.get_max_link_cap = dcn20_link_encoder_get_max_link_cap,
 };
 
 void dcn21_link_encoder_construct(
drivers/gpu/drm/amd/display/dc/virtual/virtual_link_encoder.c +9 -0
index 3464b2d5b89a..348e9a600a72 100644
@@ -84,6 +84,14 @@ static void virtual_link_encoder_destroy(struct link_encoder **enc)
 	*enc = NULL;
 }
 
+static void virtual_link_encoder_get_max_link_cap(struct link_encoder *enc,
+		struct dc_link_settings *link_settings)
+{
+	/* Set Default link settings */
+	struct dc_link_settings max_link_cap = {LANE_COUNT_FOUR, LINK_RATE_HIGH,
+				LINK_SPREAD_05_DOWNSPREAD_30KHZ, false, 0};
+	*link_settings = max_link_cap;
+}
 
 static const struct link_encoder_funcs virtual_lnk_enc_funcs = {
 	.validate_output_with_stream =
@@ -94,6 +102,7 @@ static const struct link_encoder_funcs virtual_lnk_enc_funcs = {
 	.enable_dp_output = virtual_link_encoder_enable_dp_output,
 	.enable_dp_mst_output = virtual_link_encoder_enable_dp_mst_output,
 	.disable_output = virtual_link_encoder_disable_output,
+	.get_max_link_cap = virtual_link_encoder_get_max_link_cap,
 	.dp_set_lane_settings = virtual_link_encoder_dp_set_lane_settings,
 	.dp_set_phy_pattern = virtual_link_encoder_dp_set_phy_pattern,
 	.update_mst_stream_allocation_table =
Signature · 6 lines
2.26.0

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

PATCH 35/36 drm/amd/display: Make DMCUB bss/data firmware blob optional

In reply to Rodrigo Siqueira

From: Nicholas Kazlauskas <[email protected]>

[Why]
By moving everything out of .data into the other regions we can drop the requirement for the second blob and unify it all into the inst/const blob.

[How]
We need to still support the blob being there and not being there for backwards compatibility.

Look for the DMCUB metadata section in the end of the inst/const blob instead of bss/data is missing.

Clear CW2 if we don't have the data blob so we don't hang when transitioning between data blob/blobless firmwares.

Don't memcpy the blob into CW2 region if it doesn't exist.

---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  9 +++++--
 .../gpu/drm/amd/display/dmub/inc/dmub_srv.h   |  1 +
 .../gpu/drm/amd/display/dmub/src/dmub_dcn20.c | 24 ++++++++++++-------
 .../gpu/drm/amd/display/dmub/src/dmub_srv.c   | 23 +++++++++++++-----
 4 files changed, 41 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +7 -2
index ca7489cbba94..05d9f46c33b5 100644
@@ -825,8 +825,9 @@ static int dm_dmub_hw_init(struct amdgpu_device *adev)
 				fw_inst_const_size);
 	}
 
-	memcpy(fb_info->fb[DMUB_WINDOW_2_BSS_DATA].cpu_addr, fw_bss_data,
-	       fw_bss_data_size);
+	if (fw_bss_data_size)
+		memcpy(fb_info->fb[DMUB_WINDOW_2_BSS_DATA].cpu_addr,
+		       fw_bss_data, fw_bss_data_size);
 
 	/* Copy firmware bios info into FB memory. */
 	memcpy(fb_info->fb[DMUB_WINDOW_3_VBIOS].cpu_addr, adev->bios,
@@ -1265,6 +1266,10 @@ static int dm_dmub_sw_init(struct amdgpu_device *adev)
 		adev->dm.dmub_fw->data +
 		le32_to_cpu(hdr->header.ucode_array_offset_bytes) +
 		le32_to_cpu(hdr->inst_const_bytes);
+	region_params.fw_inst_const =
+		adev->dm.dmub_fw->data +
+		le32_to_cpu(hdr->header.ucode_array_offset_bytes) +
+		PSP_HEADER_BYTES;
 
 	status = dmub_srv_calc_region_info(dmub_srv, &region_params,
 					   &region_info);
drivers/gpu/drm/amd/display/dmub/inc/dmub_srv.h +1 -0
index af678462f0e6..e40d1cdbcfaa 100644
@@ -151,6 +151,7 @@ struct dmub_srv_region_params {
 	uint32_t inst_const_size;
 	uint32_t bss_data_size;
 	uint32_t vbios_size;
+	const uint8_t *fw_inst_const;
 	const uint8_t *fw_bss_data;
 };
 
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn20.c +16 -8
index 63bb9e2c81de..45638d61b73d 100644
@@ -186,14 +186,22 @@ void dmub_dcn20_setup_windows(struct dmub_srv *dmub,
 
 	dmub_dcn20_get_fb_base_offset(dmub, &fb_base, &fb_offset);
 
-	dmub_dcn20_translate_addr(&cw2->offset, fb_base, fb_offset, &offset);
-
-	REG_WRITE(DMCUB_REGION3_CW2_OFFSET, offset.u.low_part);
-	REG_WRITE(DMCUB_REGION3_CW2_OFFSET_HIGH, offset.u.high_part);
-	REG_WRITE(DMCUB_REGION3_CW2_BASE_ADDRESS, cw2->region.base);
-	REG_SET_2(DMCUB_REGION3_CW2_TOP_ADDRESS, 0,
-		  DMCUB_REGION3_CW2_TOP_ADDRESS, cw2->region.top,
-		  DMCUB_REGION3_CW2_ENABLE, 1);
+	if (cw2->region.base != cw2->region.top) {
+		dmub_dcn20_translate_addr(&cw2->offset, fb_base, fb_offset,
+					  &offset);
+
+		REG_WRITE(DMCUB_REGION3_CW2_OFFSET, offset.u.low_part);
+		REG_WRITE(DMCUB_REGION3_CW2_OFFSET_HIGH, offset.u.high_part);
+		REG_WRITE(DMCUB_REGION3_CW2_BASE_ADDRESS, cw2->region.base);
+		REG_SET_2(DMCUB_REGION3_CW2_TOP_ADDRESS, 0,
+			  DMCUB_REGION3_CW2_TOP_ADDRESS, cw2->region.top,
+			  DMCUB_REGION3_CW2_ENABLE, 1);
+	} else {
+		REG_WRITE(DMCUB_REGION3_CW2_OFFSET, 0);
+		REG_WRITE(DMCUB_REGION3_CW2_OFFSET_HIGH, 0);
+		REG_WRITE(DMCUB_REGION3_CW2_BASE_ADDRESS, 0);
+		REG_WRITE(DMCUB_REGION3_CW2_TOP_ADDRESS, 0);
+	}
 
 	dmub_dcn20_translate_addr(&cw3->offset, fb_base, fb_offset, &offset);
 
drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c +17 -6
index 0be8a54cc475..0a1a851741c5 100644
@@ -91,17 +91,29 @@ void dmub_flush_buffer_mem(const struct dmub_fb *fb)
 }
 
 static const struct dmub_fw_meta_info *
-dmub_get_fw_meta_info(const uint8_t *fw_bss_data, uint32_t fw_bss_data_size)
+dmub_get_fw_meta_info(const struct dmub_srv_region_params *params)
 {
 	const union dmub_fw_meta *meta;
+	const uint8_t *blob = NULL;
+	uint32_t blob_size = 0;
+
+	if (params->fw_bss_data) {
+		/* Legacy metadata region. */
+		blob = params->fw_bss_data;
+		blob_size = params->bss_data_size;
+	} else if (params->fw_inst_const) {
+		/* Combined metadata region. */
+		blob = params->fw_inst_const;
+		blob_size = params->inst_const_size;
+	}
 
-	if (fw_bss_data == NULL)
+	if (!blob || !blob_size)
 		return NULL;
 
-	if (fw_bss_data_size < sizeof(union dmub_fw_meta) + DMUB_FW_META_OFFSET)
+	if (blob_size < sizeof(union dmub_fw_meta) + DMUB_FW_META_OFFSET)
 		return NULL;
 
-	meta = (const union dmub_fw_meta *)(fw_bss_data + fw_bss_data_size -
+	meta = (const union dmub_fw_meta *)(blob + blob_size -
 					    DMUB_FW_META_OFFSET -
 					    sizeof(union dmub_fw_meta));
 
@@ -247,8 +259,7 @@ dmub_srv_calc_region_info(struct dmub_srv *dmub,
 	mail->base = dmub_align(bios->top, 256);
 	mail->top = mail->base + DMUB_MAILBOX_SIZE;
 
-	fw_info = dmub_get_fw_meta_info(params->fw_bss_data,
-					params->bss_data_size);
+	fw_info = dmub_get_fw_meta_info(params);
 
 	if (fw_info) {
 		fw_state_size = fw_info->fw_region_size;
Signature · 6 lines
2.26.0

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

PATCH 36/36 drm/amd/display: 3.2.80

In reply to Rodrigo Siqueira

From: Aric Cyr <[email protected]>

---
 drivers/gpu/drm/amd/display/dc/dc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
index e20b09ca8894..2c70d40f1ece 100644
@@ -39,7 +39,7 @@
 #include "inc/hw/dmcu.h"
 #include "dml/display_mode_lib.h"
 
-#define DC_VER "3.2.79"
+#define DC_VER "3.2.80"
 
 #define MAX_SURFACES 3
 #define MAX_PLANES 6
Signature · 6 lines
2.26.0

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