Skip to contentSkip to conversation

DC Patches Nov 20, 2025

PATCH In review Alex Hung 4 participants 31 messages Nov 20, 2025 – Nov 24, 2025

Subsystems (5)
lore
Share & tools
lore

Alex Hung

author
#0 lore raw

cover DC Patches Nov 20, 2025

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

* Fixes on mouse cursor and some panels
* Improvement on brightness
* FPU and DML refactor
* Code cleanups and readability

Cc Dan Wheeler <[email protected]>

Alex Hung (1):
drm/amd/display: Check NULL before accessing

Ard Biesheuvel (1):
drm/amd/display: Permit DC_FP_START/END only in non-FP compilation
units

Derek Lai (1):
drm/amd/display: Write default Vesa Aux backlight control in dmub

Harry Wentland (4):
drm/amd/display: Rename dml2_wrapper.c to dml2_wrapper_fpu.c drm/amd/display: Move dml2_validate to the non-FPU dml2_wrapper drm/amd/display: Move dml2_create and init to the non-FPU dml2_wrapper drm/amd/display: Drop FPU flags from dml21_wrapper.c

Ivan Lipski (2):
drm/amd/display: Improve HDMI info retrieval drm/amd/display: Check ATOM_DEVICE_CRT2_SUPPORT in dc_load_detection

Jack Chang (6):
drm/amd/display: Refactor panel replay set dmub cmd flow drm/amd/display: Add AS-SDP v2 support for eDP feature drm/amd/display: Parse debug flag to PR FW drm/amd/display: Fix sending redundant enable command to dmub drm/amd/display: Revise VSC SDP header for Panel Replay drm/amd/display: Refactor panel replay dc libs

Mario Limonciello (AMD) (6):
drm/amd/display: Don't change brightness for disabled connectors drm/amd/display: Improve readability of link_detect_sink_signal_type drm/amd/display: Drop needless check for link->link_id.id drm/amd/display: Move CONNECTOR_ID_PCIE into switch/case drm/amd/display: Correct comment style
drm/amd/display: Increase EDID read retries

Nicholas Kazlauskas (1):
drm/amd/display: Add cursor offload abort to the new HWSS path

Ovidiu Bunea (1):
drm/amd/display: Add additional checks for PSP footer size

Relja Vojvodic (1):
drm/amd/display: Correct DSC padding accounting

Taimur Hassan (2):
drm/amd/display: [FW Promotion] Release 0.1.37.0 drm/amd/display: Promote DC to 3.2.360

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  66 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |  10 +
 .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c |  16 +-
 .../gpu/drm/amd/display/amdgpu_dm/dc_fpu.h    |   8 +
 .../gpu/drm/amd/display/dc/bios/bios_parser.c |   2 +-
 .../drm/amd/display/dc/core/dc_hw_sequencer.c |  24 +
 .../drm/amd/display/dc/core/dc_link_exports.c |  22 +
 .../gpu/drm/amd/display/dc/core/dc_stream.c   |  11 +-
 drivers/gpu/drm/amd/display/dc/dc.h           |  45 +-
 .../gpu/drm/amd/display/dc/dml2_0/Makefile    |   8 +-
 .../drm/amd/display/dc/dml2_0/dml2_wrapper.c  | 599 +----------------
 .../drm/amd/display/dc/dml2_0/dml2_wrapper.h  |   9 +
 .../amd/display/dc/dml2_0/dml2_wrapper_fpu.c  | 604 ++++++++++++++++++
 .../amd/display/dc/dml2_0/dml2_wrapper_fpu.h  |  25 +
 .../amd/display/dc/hwss/dcn314/dcn314_hwseq.c |   2 +-
 .../amd/display/dc/hwss/dcn32/dcn32_hwseq.c   |   2 +-
 .../amd/display/dc/hwss/dcn35/dcn35_hwseq.c   |   2 +-
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c |   2 +
 .../drm/amd/display/dc/hwss/hw_sequencer.h    |  13 +
 .../gpu/drm/amd/display/dc/inc/link_service.h |   4 +
 .../drm/amd/display/dc/link/link_detection.c  |  45 +-
 .../gpu/drm/amd/display/dc/link/link_dpms.c   |   7 +-
 .../drm/amd/display/dc/link/link_factory.c    |   4 +
 .../dc/link/protocols/link_dp_capability.c    |   2 +-
 .../link/protocols/link_edp_panel_control.c   | 177 ++++-
 .../link/protocols/link_edp_panel_control.h   |   7 +-
 drivers/gpu/drm/amd/display/dc/os_types.h     |   2 -
 .../dc/resource/dcn20/dcn20_resource.c        |   6 +-
 drivers/gpu/drm/amd/display/dmub/dmub_srv.h   |  33 +
 .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h   |   4 +-
 .../gpu/drm/amd/display/dmub/src/dmub_srv.c   |  57 +-
 .../amd/display/modules/inc/mod_info_packet.h |   6 +
 .../display/modules/info_packet/info_packet.c | 369 ++++++-----
 33 files changed, 1357 insertions(+), 836 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper_fpu.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper_fpu.h
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 1/26 drm/amd/display: Check NULL before accessing

[WHAT]
IGT kms_cursor_legacy's long-nonblocking-modeset-vs-cursor-atomic fails with NULL pointer dereference. This can be reproduced with both an eDP panel and a DP monitors connected.

 BUG: kernel NULL pointer dereference, address: 0000000000000000
 #PF: supervisor read access in kernel mode
 #PF: error_code(0x0000) - not-present page
 PGD 0 P4D 0
 Oops: Oops: 0000 [#1] SMP NOPTI
 CPU: 13 UID: 0 PID: 2960 Comm: kms_cursor_lega Not tainted
6.16.0-99-custom #8 PREEMPT(voluntary)
 Hardware name: AMD ........
 RIP: 0010:dc_stream_get_scanoutpos+0x34/0x130 [amdgpu]
 Code: 57 4d 89 c7 41 56 49 89 ce 41 55 49 89 d5 41 54 49
 89 fc 53 48 83 ec 18 48 8b 87 a0 64 00 00 48 89 75 d0 48 c7 c6 e0 41 30
 c2 <48> 8b 38 48 8b 9f 68 06 00 00 e8 8d d7 fd ff 31 c0 48 81 c3 e0 02
 RSP: 0018:ffffd0f3c2bd7608 EFLAGS: 00010292
 RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffd0f3c2bd7668
 RDX: ffffd0f3c2bd7664 RSI: ffffffffc23041e0 RDI: ffff8b32494b8000
 RBP: ffffd0f3c2bd7648 R08: ffffd0f3c2bd766c R09: ffffd0f3c2bd7760
 R10: ffffd0f3c2bd7820 R11: 0000000000000000 R12: ffff8b32494b8000
 R13: ffffd0f3c2bd7664 R14: ffffd0f3c2bd7668 R15: ffffd0f3c2bd766c
 FS:  000071f631b68700(0000) GS:ffff8b399f114000(0000)

knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 00000001b8105000 CR4: 0000000000f50ef0
PKRU: 55555554

 Call Trace:
 <TASK>
 dm_crtc_get_scanoutpos+0xd7/0x180 [amdgpu]
 amdgpu_display_get_crtc_scanoutpos+0x86/0x1c0 [amdgpu]
 ? __pfx_amdgpu_crtc_get_scanout_position+0x10/0x10[amdgpu]
 amdgpu_crtc_get_scanout_position+0x27/0x50 [amdgpu]
 drm_crtc_vblank_helper_get_vblank_timestamp_internal+0xf7/0x400
 drm_crtc_vblank_helper_get_vblank_timestamp+0x1c/0x30
 drm_crtc_get_last_vbltimestamp+0x55/0x90
 drm_crtc_next_vblank_start+0x45/0xa0
 drm_atomic_helper_wait_for_fences+0x81/0x1f0
 ...
---
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +8 -3
index 6d309c320253..129cd5f84983 100644
@@ -737,9 +737,14 @@ bool dc_stream_get_scanoutpos(const struct dc_stream_state *stream,
 {
 	uint8_t i;
 	bool ret = false;
-	struct dc  *dc = stream->ctx->dc;
-	struct resource_context *res_ctx =
-		&dc->current_state->res_ctx;
+	struct dc  *dc;
+	struct resource_context *res_ctx;
+
+	if (!stream->ctx)
+		return false;
+
+	dc = stream->ctx->dc;
+	res_ctx = &dc->current_state->res_ctx;
 
 	dc_exit_ips_for_hw_access(dc);
 
Signature · 1 line
2.43.0
author
#2 lore raw

PATCH 2/26 drm/amd/display: Improve HDMI info retrieval

In reply to Alex Hung

From: Ivan Lipski <[email protected]>

[WHY & HOW]
Make a dedicated function to read HDMI-related monitor info, including monitor's SCDC support.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h         | 3 +++
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 8 ++++++++
 2 files changed, 11 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +3 -0
index 20ac784f0ee9..d683b710181b 100644
@@ -1058,6 +1058,9 @@ int amdgpu_dm_update_plane_color_mgmt(struct dm_crtc_state *crtc,
 void amdgpu_dm_update_connector_after_detect(
 		struct amdgpu_dm_connector *aconnector);
 
+void populate_hdmi_info_from_connector(struct drm_hdmi_info *info,
+				      struct dc_edid_caps *edid_caps);
+
 extern const struct drm_encoder_helper_funcs amdgpu_dm_encoder_helper_funcs;
 
 int amdgpu_dm_process_dmub_aux_transfer_sync(struct dc_context *ctx, unsigned int link_index,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +8 -0
index eb2c587b0b9b..582a1c04f035 100644
@@ -139,6 +139,9 @@ enum dc_edid_status dm_helpers_parse_edid_caps(
 
 	edid_caps->edid_hdmi = connector->display_info.is_hdmi;
 
+	if (edid_caps->edid_hdmi)
+		populate_hdmi_info_from_connector(&connector->display_info.hdmi, edid_caps);
+
 	apply_edid_quirks(dev, edid_buf, edid_caps);
 
 	sad_count = drm_edid_to_sad((struct edid *) edid->raw_edid, &sads);
@@ -990,6 +993,11 @@ dm_helpers_read_acpi_edid(struct amdgpu_dm_connector *aconnector)
 	return drm_edid_read_custom(connector, dm_helpers_probe_acpi_edid, connector);
 }
 
+void populate_hdmi_info_from_connector(struct drm_hdmi_info *hdmi, struct dc_edid_caps *edid_caps)
+{
+	edid_caps->scdc_present = hdmi->scdc.supported;
+}
+
 enum dc_edid_status dm_helpers_read_local_edid(
 		struct dc_context *ctx,
 		struct dc_link *link,
Signature · 1 line
2.43.0
author
#3 lore raw

PATCH 3/26 drm/amd/display: Refactor panel replay set dmub cmd flow

In reply to Alex Hung

From: Jack Chang <[email protected]>

[WHY]
Add link service interface for setting PR dmub command

---
 .../gpu/drm/amd/display/dc/inc/link_service.h |   4 +
 .../drm/amd/display/dc/link/link_factory.c    |   4 +
 .../link/protocols/link_edp_panel_control.c   | 146 +++++++++++++++++-
 .../link/protocols/link_edp_panel_control.h   |   5 +
 4 files changed, 157 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/inc/link_service.h +4 -0
index 6f94e48a24d1..2f805ba19a52 100644
@@ -307,6 +307,10 @@ struct link_service {
 	bool (*edp_receiver_ready_T9)(struct dc_link *link);
 	bool (*edp_receiver_ready_T7)(struct dc_link *link);
 	bool (*edp_power_alpm_dpcd_enable)(struct dc_link *link, bool enable);
+	bool (*edp_pr_enable)(struct dc_link *link, bool enable);
+	bool (*edp_pr_update_state)(struct dc_link *link, struct dmub_cmd_pr_update_state_data *update_state_data);
+	bool (*edp_pr_set_general_cmd)(struct dc_link *link, struct dmub_cmd_pr_general_cmd_data *general_cmd_data);
+	bool (*edp_pr_get_state)(const struct dc_link *link, uint64_t *state);
 	void (*edp_set_panel_power)(struct dc_link *link, bool powerOn);
 
 
drivers/gpu/drm/amd/display/dc/link/link_factory.c +4 -0
index a6e2b0821969..e9af184dbe5d 100644
@@ -229,6 +229,10 @@ static void construct_link_service_edp_panel_control(struct link_service *link_s
 	link_srv->edp_receiver_ready_T9 = edp_receiver_ready_T9;
 	link_srv->edp_receiver_ready_T7 = edp_receiver_ready_T7;
 	link_srv->edp_power_alpm_dpcd_enable = edp_power_alpm_dpcd_enable;
+	link_srv->edp_pr_enable = edp_pr_enable;
+	link_srv->edp_pr_update_state = edp_pr_update_state;
+	link_srv->edp_pr_set_general_cmd = edp_pr_set_general_cmd;
+	link_srv->edp_pr_get_state = edp_pr_get_state;
 	link_srv->edp_set_panel_power = edp_set_panel_power;
 }
 
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +144 -2

158 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.h +5 -0
index dd79c7cd2828..360129732109 100644
@@ -75,6 +75,11 @@ void edp_add_delay_for_T9(struct dc_link *link);
 bool edp_receiver_ready_T9(struct dc_link *link);
 bool edp_receiver_ready_T7(struct dc_link *link);
 bool edp_power_alpm_dpcd_enable(struct dc_link *link, bool enable);
+bool edp_pr_enable(struct dc_link *link, bool enable);
+bool edp_pr_copy_settings(struct dc_link *link, struct replay_context *replay_context);
+bool edp_pr_update_state(struct dc_link *link, struct dmub_cmd_pr_update_state_data *update_state_data);
+bool edp_pr_set_general_cmd(struct dc_link *link, struct dmub_cmd_pr_general_cmd_data *general_cmd_data);
+bool edp_pr_get_state(const struct dc_link *link, uint64_t *state);
 void edp_set_panel_power(struct dc_link *link, bool powerOn);
 void edp_set_panel_assr(struct dc_link *link, struct pipe_ctx *pipe_ctx,
 		enum dp_panel_mode *panel_mode, bool enable);
Signature · 1 line
2.43.0
author
#4 lore raw

PATCH 4/26 drm/amd/display: Add AS-SDP v2 support for eDP feature

In reply to Alex Hung

From: Jack Chang <[email protected]>

[WHY & HOW]
VESA Panel Replay requires AS-SDP v2 support.
Need to add checking flow to enable AS-SDP v2 in this case.

---
 .../display/modules/info_packet/info_packet.c | 24 ++++++++++++-------
 1 file changed, 15 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c +15 -9
index b3d55cac3569..251b7b6f45af 100644
@@ -537,7 +537,11 @@ void mod_build_adaptive_sync_infopacket(const struct dc_stream_state *stream,
 		break;
 	case FREESYNC_TYPE_PCON_IN_WHITELIST:
 	case ADAPTIVE_SYNC_TYPE_EDP:
-		mod_build_adaptive_sync_infopacket_v1(info_packet);
+		if (stream && stream->link->replay_settings.config.replay_supported &&
+			stream->link->replay_settings.config.replay_version == DC_VESA_PANEL_REPLAY)
+			mod_build_adaptive_sync_infopacket_v2(stream, param, info_packet);
+		else
+			mod_build_adaptive_sync_infopacket_v1(info_packet);
 		break;
 	case ADAPTIVE_SYNC_TYPE_NONE:
 	case FREESYNC_TYPE_PCON_NOT_IN_WHITELIST:
@@ -567,13 +571,15 @@ void mod_build_adaptive_sync_infopacket_v2(const struct dc_stream_state *stream,
 	info_packet->hb2 = AS_SDP_VER_2;
 	info_packet->hb3 = AS_DP_SDP_LENGTH;
 
-	//Payload
-	info_packet->sb[0] = param->supportMode; //1: AVT; 0: FAVT
-	info_packet->sb[1] = (stream->timing.v_total & 0x00FF);
-	info_packet->sb[2] = (stream->timing.v_total & 0xFF00) >> 8;
-	//info_packet->sb[3] = 0x00; Target RR, not use fot AVT
-	info_packet->sb[4] = (param->increase.support << 6 | param->decrease.support << 7);
-	info_packet->sb[5] = param->increase.frame_duration_hex;
-	info_packet->sb[6] = param->decrease.frame_duration_hex;
+	if (param) {
+		//Payload
+		info_packet->sb[0] = param->supportMode; //1: AVT; 0: FAVT
+		info_packet->sb[1] = (stream->timing.v_total & 0x00FF);
+		info_packet->sb[2] = (stream->timing.v_total & 0xFF00) >> 8;
+		//info_packet->sb[3] = 0x00; Target RR, not use fot AVT
+		info_packet->sb[4] = (param->increase.support << 6 | param->decrease.support << 7);
+		info_packet->sb[5] = param->increase.frame_duration_hex;
+		info_packet->sb[6] = param->decrease.frame_duration_hex;
+	}
 }
 
Signature · 1 line
2.43.0
author
#5 lore raw

PATCH 5/26 drm/amd/display: Parse debug flag to PR FW

In reply to Alex Hung

From: Jack Chang <[email protected]>

[HOW & WHY]
Parse debug flag to PR FW.

---
 .../drm/amd/display/dc/link/protocols/link_edp_panel_control.c   | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +1 -0
index 80ee6efe91e2..07f4f15851fc 100644
@@ -1373,6 +1373,7 @@ bool edp_pr_copy_settings(struct dc_link *link, struct replay_context *replay_co
 	cmd.pr_copy_settings.data.line_time_in_ns = replay_context->line_time_in_ns;
 	cmd.pr_copy_settings.data.flags.bitfields.fec_enable_status = (link->fec_state == dc_link_fec_enabled);
 	cmd.pr_copy_settings.data.flags.bitfields.dsc_enable_status = (pipe_ctx->stream->timing.flags.DSC == 1);
+	cmd.pr_copy_settings.data.debug.u32All = link->replay_settings.config.debug_flags;
 
 	dc_wake_and_execute_dmub_cmd(dc->ctx, &cmd, DM_DMUB_WAIT_TYPE_WAIT);
 	return true;
Signature · 1 line
2.43.0
author
#6 lore raw

PATCH 6/26 drm/amd/display: Fix sending redundant enable command to dmub

In reply to Alex Hung

From: Jack Chang <[email protected]>

[WHY & HOW]
Fix sending repeating PR enable/disable command to dmub which causing performance problem

---
 .../link/protocols/link_edp_panel_control.c   | 20 +++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +12 -8
index 07f4f15851fc..99741c1334ca 100644
@@ -1313,16 +1313,20 @@ bool edp_pr_enable(struct dc_link *link, bool enable)
 	if (!dc_get_edp_link_panel_inst(dc, link, &panel_inst))
 		return false;
 
-	//for sending PR enable commands to DMUB
-	memset(&cmd, 0, sizeof(cmd));
+	if (link->replay_settings.replay_allow_active != enable) {
+		//for sending PR enable commands to DMUB
+		memset(&cmd, 0, sizeof(cmd));
 
-	cmd.pr_enable.header.type = DMUB_CMD__PR;
-	cmd.pr_enable.header.sub_type = DMUB_CMD__PR_ENABLE;
-	cmd.pr_enable.header.payload_bytes = sizeof(struct dmub_cmd_pr_enable_data);
-	cmd.pr_enable.data.panel_inst = panel_inst;
-	cmd.pr_enable.data.enable = enable ? 1 : 0;
+		cmd.pr_enable.header.type = DMUB_CMD__PR;
+		cmd.pr_enable.header.sub_type = DMUB_CMD__PR_ENABLE;
+		cmd.pr_enable.header.payload_bytes = sizeof(struct dmub_cmd_pr_enable_data);
+		cmd.pr_enable.data.panel_inst = panel_inst;
+		cmd.pr_enable.data.enable = enable ? 1 : 0;
 
-	dc_wake_and_execute_dmub_cmd(dc->ctx, &cmd, DM_DMUB_WAIT_TYPE_WAIT);
+		dc_wake_and_execute_dmub_cmd(dc->ctx, &cmd, DM_DMUB_WAIT_TYPE_WAIT);
+
+		link->replay_settings.replay_allow_active = enable;
+	}
 	return true;
 }
 
Signature · 1 line
2.43.0
author
#7 lore raw

PATCH 7/26 drm/amd/display: Revise VSC SDP header for Panel Replay

In reply to Alex Hung

From: Jack Chang <[email protected]>

[WAHT]
Add vsc sdp header setting for Panel Replay.

---
 .../amd/display/modules/inc/mod_info_packet.h |   6 +
 .../display/modules/info_packet/info_packet.c | 345 ++++++++++--------
 2 files changed, 206 insertions(+), 145 deletions(-)
drivers/gpu/drm/amd/display/modules/inc/mod_info_packet.h +6 -0
index 66dc9a19aebe..ddd64b7e4c04 100644
@@ -33,6 +33,12 @@ struct dc_stream_state;
 struct dc_info_packet;
 struct mod_vrr_params;
 
+void set_vsc_packet_colorimetry_data(
+		const struct dc_stream_state *stream,
+		struct dc_info_packet *info_packet,
+		enum dc_color_space cs,
+		enum color_transfer_func tf);
+
 void mod_build_vsc_infopacket(const struct dc_stream_state *stream,
 		struct dc_info_packet *info_packet,
 		enum dc_color_space cs,
drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c +200 -145

384 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#8 lore raw

PATCH 8/26 drm/amd/display: Refactor panel replay dc libs

In reply to Alex Hung

From: Jack Chang <[email protected]>

[WHY]
Add dc interface to export link service libs for setting PR dmub command.

---
 .../drm/amd/display/dc/core/dc_link_exports.c | 22 ++++++++++
 drivers/gpu/drm/amd/display/dc/dc.h           | 42 +++++++++++++++++++
 2 files changed, 64 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_link_exports.c +22 -0
index 9acd30019717..a8d7228907c2 100644
@@ -491,6 +491,28 @@ bool dc_link_get_replay_state(const struct dc_link *link, uint64_t *state)
 	return link->dc->link_srv->edp_get_replay_state(link, state);
 }
 
+bool dc_link_set_pr_enable(struct dc_link *link, bool enable)
+{
+	return link->dc->link_srv->edp_pr_enable(link, enable);
+}
+
+bool dc_link_update_pr_state(struct dc_link *link,
+		struct dmub_cmd_pr_update_state_data *update_state_data)
+{
+	return link->dc->link_srv->edp_pr_update_state(link, update_state_data);
+}
+
+bool dc_link_set_pr_general_cmd(struct dc_link *link,
+		struct dmub_cmd_pr_general_cmd_data *general_cmd_data)
+{
+	return link->dc->link_srv->edp_pr_set_general_cmd(link, general_cmd_data);
+}
+
+bool dc_link_get_pr_state(const struct dc_link *link, uint64_t *state)
+{
+	return link->dc->link_srv->edp_pr_get_state(link, state);
+}
+
 bool dc_link_wait_for_t12(struct dc_link *link)
 {
 	return link->dc->link_srv->edp_wait_for_t12(link);
drivers/gpu/drm/amd/display/dc/dc.h +42 -0

48 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#9 lore raw

PATCH 9/26 drm/amd/display: Write default Vesa Aux backlight control in dmub

In reply to Alex Hung

From: Derek Lai <[email protected]>

[WHY]
Some OLED panels require driver to write Aux BL before link training or turning on backlight; otherwise monitor brightness will change.

[HOW]
Write the default Vesa Aux backlight control in dmub.

---
 .../drm/amd/display/dc/link/link_detection.c  |  2 +-
 .../gpu/drm/amd/display/dc/link/link_dpms.c   |  4 +--
 .../dc/link/protocols/link_dp_capability.c    |  2 +-
 .../link/protocols/link_edp_panel_control.c   | 26 ++++++++++++++++---
 .../link/protocols/link_edp_panel_control.h   |  2 +-
 5 files changed, 28 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/display/dc/link/link_detection.c +1 -1
index 6d31f4967f1a..9746bb2f6c3b 100644
@@ -989,7 +989,7 @@ static bool detect_link_and_local_sink(struct dc_link *link,
 			(link->dpcd_sink_ext_caps.bits.oled == 1)) {
 			dpcd_set_source_specific_data(link);
 			msleep(post_oui_delay);
-			set_default_brightness_aux(link);
+			set_default_brightness(link);
 		}
 
 		return true;
drivers/gpu/drm/amd/display/dc/link/link_dpms.c +2 -2
index 475f71bb48ff..1b1ce3839922 100644
@@ -2115,7 +2115,7 @@ static enum dc_status enable_link_dp(struct dc_state *state,
 		skip_video_pattern = false;
 
 	if (stream->sink_patches.oled_optimize_display_on)
-		set_default_brightness_aux(link);
+		set_default_brightness(link);
 
 	if (perform_link_training_with_retries(link_settings,
 					       skip_video_pattern,
@@ -2141,7 +2141,7 @@ static enum dc_status enable_link_dp(struct dc_state *state,
 		link->dpcd_sink_ext_caps.bits.sdr_aux_backlight_control == 1 ||
 		link->dpcd_sink_ext_caps.bits.hdr_aux_backlight_control == 1) {
 		if (!stream->sink_patches.oled_optimize_display_on) {
-			set_default_brightness_aux(link);
+			set_default_brightness(link);
 			if (link->dpcd_sink_ext_caps.bits.oled == 1)
 				msleep(bl_oled_enable_delay);
 			edp_backlight_enable_aux(link, true);
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c +1 -1
index ad90a0106938..3884851e2a9e 100644
@@ -2167,7 +2167,7 @@ void detect_edp_sink_caps(struct dc_link *link)
 	link->dpcd_caps.set_power_state_capable_edp =
 				(general_edp_cap & DP_EDP_SET_POWER_CAP) ? true : false;
 
-	set_default_brightness_aux(link);
+	set_default_brightness(link);
 
 	core_link_read_dpcd(link, DP_EDP_DPCD_REV,
 		&link->dpcd_caps.edp_rev,
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +23 -3
index 99741c1334ca..0b05ee9f6ea1 100644
@@ -50,6 +50,11 @@ static const uint8_t DP_VGA_LVDS_CONVERTER_ID_2[] = "sivarT";
 /* Nutmeg */
 static const uint8_t DP_VGA_LVDS_CONVERTER_ID_3[] = "dnomlA";
 
+static const unsigned int pwr_default_min_brightness_millinits = 1000;
+static const unsigned int pwr_default_sdr_brightness_millinits = 270000;
+static const unsigned int pwr_default_min_backlight_pwm = 0xC0C;
+static const unsigned int pwr_default_max_backlight_pwm = 0xFFFF;
+
 void dp_set_panel_mode(struct dc_link *link, enum dp_panel_mode panel_mode)
 {
 	union dpcd_edp_config edp_config_set;
@@ -309,7 +314,7 @@ static bool read_default_bl_aux(struct dc_link *link, uint32_t *backlight_millin
 	return true;
 }
 
-bool set_default_brightness_aux(struct dc_link *link)
+bool set_default_brightness(struct dc_link *link)
 {
 	uint32_t default_backlight;
 
@@ -320,8 +325,23 @@ bool set_default_brightness_aux(struct dc_link *link)
 		if (default_backlight < 1000 || default_backlight > 5000000)
 			default_backlight = 150000;
 
-		return edp_set_backlight_level_nits(link, true,
-				default_backlight, 0);
+		if (link->backlight_control_type == BACKLIGHT_CONTROL_VESA_AUX &&
+			link->dc->caps.dmub_caps.aux_backlight_support) {
+			struct set_backlight_level_params backlight_level_params = { 0 };
+
+			backlight_level_params.aux_inst =  link->ddc->ddc_pin->hw_info.ddc_channel;
+			backlight_level_params.control_type = BACKLIGHT_CONTROL_VESA_AUX;
+			backlight_level_params.backlight_pwm_u16_16 = default_backlight;
+			backlight_level_params.transition_time_in_ms = 0;
+			// filled in the driver BL default values
+			backlight_level_params.min_luminance = pwr_default_min_brightness_millinits;
+			backlight_level_params.max_luminance = pwr_default_sdr_brightness_millinits;
+			backlight_level_params.min_backlight_pwm = pwr_default_min_backlight_pwm;
+			backlight_level_params.max_backlight_pwm = pwr_default_max_backlight_pwm;
+			return edp_set_backlight_level(link, &backlight_level_params);
+		} else
+			return edp_set_backlight_level_nits(link, true,
+					default_backlight, 0);
 	}
 	return false;
 }
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.h +1 -1
index 360129732109..fd63b5d0f948 100644
@@ -29,7 +29,7 @@
 
 enum dp_panel_mode dp_get_panel_mode(struct dc_link *link);
 void dp_set_panel_mode(struct dc_link *link, enum dp_panel_mode panel_mode);
-bool set_default_brightness_aux(struct dc_link *link);
+bool set_default_brightness(struct dc_link *link);
 bool is_smartmux_suported(struct dc_link *link);
 void edp_panel_backlight_power_on(struct dc_link *link, bool wait_for_hpd);
 int edp_get_backlight_level(const struct dc_link *link);
Signature · 1 line
2.43.0
author
#10 lore raw

PATCH 10/26 drm/amd/display: Don't change brightness for disabled connectors

In reply to Alex Hung

From: "Mario Limonciello (AMD)" <[email protected]>

[WHY]
When a laptop lid is closed the connector is disabled but userspace can still try to change brightness. This doesn't work because the panel is turned off. It will eventually time out, but there is a lot of stutter along the way.

[How]
Iterate all connectors to check whether the matching one for the backlight index is enabled.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +15 -0
index 8a0555365719..424020c0756d 100644
@@ -5108,6 +5108,21 @@ static void amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm,
 	struct dc_link *link;
 	u32 brightness;
 	bool rc, reallow_idle = false;
+	struct drm_connector *connector;
+
+	list_for_each_entry(connector, &dm->ddev->mode_config.connector_list, head) {
+		struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
+
+		if (aconnector->bl_idx != bl_idx)
+			continue;
+
+		/* if connector is off, save the brightness for next time it's on */
+		if (!aconnector->base.encoder) {
+			dm->brightness[bl_idx] = user_brightness;
+			dm->actual_brightness[bl_idx] = 0;
+			return;
+		}
+	}
 
 	amdgpu_dm_update_backlight_caps(dm, bl_idx);
 	caps = &dm->backlight_caps[bl_idx];
Signature · 1 line
2.43.0
author
#11 lore raw

PATCH 11/26 drm/amd/display: Improve readability of link_detect_sink_signal_type

In reply to Alex Hung

From: "Mario Limonciello (AMD)" <[email protected]>

[WHAT]
Move the break statements indentation in for the switch/case block.

---
 .../gpu/drm/amd/display/dc/link/link_detection.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/dc/link/link_detection.c +7 -9
index 9746bb2f6c3b..7084b1909445 100644
@@ -171,6 +171,7 @@ static enum signal_type link_detect_sink_signal_type(struct dc_link *link,
 					 enum dc_detect_reason reason)
 {
 	enum signal_type result;
+	struct audio_support *aud_support;
 	struct graphics_object_id enc_id;
 
 	if (link->is_dig_mapping_flexible)
@@ -201,20 +202,18 @@ static enum signal_type link_detect_sink_signal_type(struct dc_link *link,
 	}
 
 	switch (link->link_id.id) {
-	case CONNECTOR_ID_HDMI_TYPE_A: {
+	case CONNECTOR_ID_HDMI_TYPE_A:
 		/* check audio support:
 		 * if native HDMI is not supported, switch to DVI
 		 */
-		struct audio_support *aud_support =
-					&link->dc->res_pool->audio_support;
+		aud_support = &link->dc->res_pool->audio_support;
 
 		if (!aud_support->hdmi_audio_native)
 			if (link->link_id.id == CONNECTOR_ID_HDMI_TYPE_A)
 				result = SIGNAL_TYPE_DVI_SINGLE_LINK;
-	}
-	break;
+		break;
 	case CONNECTOR_ID_DISPLAY_PORT:
-	case CONNECTOR_ID_USBC: {
+	case CONNECTOR_ID_USBC:
 		/* DP HPD short pulse. Passive DP dongle will not
 		 * have short pulse
 		 */
@@ -226,10 +225,9 @@ static enum signal_type link_detect_sink_signal_type(struct dc_link *link,
 			if (!dm_helpers_is_dp_sink_present(link))
 				result = SIGNAL_TYPE_DVI_SINGLE_LINK;
 		}
-	}
-	break;
+		break;
 	default:
-	break;
+		break;
 	}
 
 	return result;
Signature · 1 line
2.43.0
author
#12 lore raw

PATCH 12/26 drm/amd/display: Drop needless check for link->link_id.id

In reply to Alex Hung

From: "Mario Limonciello (AMD)" <[email protected]>

[WHY]
The switch/case in link_detect_sink_signal_type already detects the link ID of CONNECTOR_ID_HDMI_TYPE_A.

[How]
Drop the extra match.

---
 drivers/gpu/drm/amd/display/dc/link/link_detection.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/link/link_detection.c +1 -2
index 7084b1909445..e0402a04f25f 100644
@@ -209,8 +209,7 @@ static enum signal_type link_detect_sink_signal_type(struct dc_link *link,
 		aud_support = &link->dc->res_pool->audio_support;
 
 		if (!aud_support->hdmi_audio_native)
-			if (link->link_id.id == CONNECTOR_ID_HDMI_TYPE_A)
-				result = SIGNAL_TYPE_DVI_SINGLE_LINK;
+			result = SIGNAL_TYPE_DVI_SINGLE_LINK;
 		break;
 	case CONNECTOR_ID_DISPLAY_PORT:
 	case CONNECTOR_ID_USBC:
Signature · 1 line
2.43.0
author
#13 lore raw

PATCH 13/26 drm/amd/display: Move CONNECTOR_ID_PCIE into switch/case

In reply to Alex Hung

From: "Mario Limonciello (AMD)" <[email protected]>

[WHY]
There is already a switch/case looking at link->link_id.id.

[How]
Move the case of CONNECTOR_ID_PCIE into switch case.

---
 drivers/gpu/drm/amd/display/dc/link/link_detection.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/link/link_detection.c +3 -6
index e0402a04f25f..778049b45c8f 100644
@@ -195,12 +195,6 @@ static enum signal_type link_detect_sink_signal_type(struct dc_link *link,
 	 * eDP connector supports only eDP signal;
 	 * HDMI should check straps for audio
 	 */
-
-	/* PCIE detects the actual connector on add-on board */
-	if (link->link_id.id == CONNECTOR_ID_PCIE) {
-		/* ZAZTODO implement PCIE add-on card detection */
-	}
-
 	switch (link->link_id.id) {
 	case CONNECTOR_ID_HDMI_TYPE_A:
 		/* check audio support:
@@ -225,6 +219,9 @@ static enum signal_type link_detect_sink_signal_type(struct dc_link *link,
 				result = SIGNAL_TYPE_DVI_SINGLE_LINK;
 		}
 		break;
+	case CONNECTOR_ID_PCIE:
+		/* ZAZTODO implement PCIE add-on card detection */
+		break;
 	default:
 		break;
 	}
Signature · 1 line
2.43.0
author
#14 lore raw

PATCH 14/26 drm/amd/display: Correct comment style

In reply to Alex Hung

From: "Mario Limonciello (AMD)" <[email protected]>

[WHAT]
Comments should have /* and */ on their own lines.

---
 .../gpu/drm/amd/display/dc/link/link_detection.c  | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/link/link_detection.c +10 -5
index 778049b45c8f..f9258d71b68e 100644
@@ -184,11 +184,13 @@ static enum signal_type link_detect_sink_signal_type(struct dc_link *link,
 	if (link->ep_type != DISPLAY_ENDPOINT_PHY)
 		return result;
 
-	/* Internal digital encoder will detect only dongles
+	/*
+	 * Internal digital encoder will detect only dongles
 	 * that require digital signal
 	 */
 
-	/* Detection mechanism is different
+	/*
+	 * Detection mechanism is different
 	 * for different native connectors.
 	 * LVDS connector supports only LVDS signal;
 	 * PCIE is a bus slot, the actual connector needs to be detected first;
@@ -197,7 +199,8 @@ static enum signal_type link_detect_sink_signal_type(struct dc_link *link,
 	 */
 	switch (link->link_id.id) {
 	case CONNECTOR_ID_HDMI_TYPE_A:
-		/* check audio support:
+		/*
+		 * check audio support:
 		 * if native HDMI is not supported, switch to DVI
 		 */
 		aud_support = &link->dc->res_pool->audio_support;
@@ -207,11 +210,13 @@ static enum signal_type link_detect_sink_signal_type(struct dc_link *link,
 		break;
 	case CONNECTOR_ID_DISPLAY_PORT:
 	case CONNECTOR_ID_USBC:
-		/* DP HPD short pulse. Passive DP dongle will not
+		/*
+		 * DP HPD short pulse. Passive DP dongle will not
 		 * have short pulse
 		 */
 		if (reason != DETECT_REASON_HPDRX) {
-			/* Check whether DP signal detected: if not -
+			/*
+			 * Check whether DP signal detected: if not -
 			 * we assume signal is DVI; it could be corrected
 			 * to HDMI after dongle detection
 			 */
Signature · 1 line
2.43.0
author
#15 lore raw

PATCH 15/26 drm/amd/display: Increase EDID read retries

In reply to Alex Hung

From: "Mario Limonciello (AMD)" <[email protected]>

[WHY]
When monitor is still booting EDID read can fail while DPCD read is successful. In this case no EDID data will be returned, and this could happen for a while.

[HOW]
Increase number of attempts to read EDID in dm_helpers_read_local_edid() to 25.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +4 -4
index 582a1c04f035..e5e993d3ef74 100644
@@ -1006,8 +1006,8 @@ enum dc_edid_status dm_helpers_read_local_edid(
 	struct amdgpu_dm_connector *aconnector = link->priv;
 	struct drm_connector *connector = &aconnector->base;
 	struct i2c_adapter *ddc;
-	int retry = 3;
-	enum dc_edid_status edid_status;
+	int retry = 25;
+	enum dc_edid_status edid_status = EDID_NO_RESPONSE;
 	const struct drm_edid *drm_edid;
 	const struct edid *edid;
 
@@ -1037,7 +1037,7 @@ enum dc_edid_status dm_helpers_read_local_edid(
 		}
 
 		if (!drm_edid)
-			return EDID_NO_RESPONSE;
+			continue;
 
 		edid = drm_edid_raw(drm_edid); // FIXME: Get rid of drm_edid_raw()
 		if (!edid ||
@@ -1055,7 +1055,7 @@ enum dc_edid_status dm_helpers_read_local_edid(
 						&sink->dc_edid,
 						&sink->edid_caps);
 
-	} while (edid_status == EDID_BAD_CHECKSUM && --retry > 0);
+	} while ((edid_status == EDID_BAD_CHECKSUM || edid_status == EDID_NO_RESPONSE) && --retry > 0);
 
 	if (edid_status != EDID_OK)
 		DRM_ERROR("EDID err: %d, on connector: %s",
Signature · 1 line
2.43.0
author
#16 lore raw

PATCH 16/26 drm/amd/display: Rename dml2_wrapper.c to dml2_wrapper_fpu.c

In reply to Alex Hung

From: Harry Wentland <[email protected]>

[WHAT]
This function is an FPU compilation unit. Therefore it's not allowed to call DC_FP_START/END functions. It currently does so and we'll need to move those functions out. Therefore rename the existing compilation unit so we can introduce a non-FPU dml2_wrapper.c.

---
 drivers/gpu/drm/amd/display/dc/dml2_0/Makefile              | 6 +++---
 .../dc/dml2_0/{dml2_wrapper.c => dml2_wrapper_fpu.c}        | 0
 2 files changed, 3 insertions(+), 3 deletions(-)
 rename drivers/gpu/drm/amd/display/dc/dml2_0/{dml2_wrapper.c => dml2_wrapper_fpu.c} (100%)
drivers/gpu/drm/amd/display/dc/dml2_0/Makefile +3 -3
index 97e068b6bf6b..a112931007b1 100644
@@ -55,7 +55,7 @@ subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/dml2_0/dml21/
 
 CFLAGS_$(AMDDALPATH)/dc/dml2_0/display_mode_core.o := $(dml2_ccflags) $(frame_warn_flag)
 CFLAGS_$(AMDDALPATH)/dc/dml2_0/display_mode_util.o := $(dml2_ccflags)
-CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml2_wrapper.o := $(dml2_ccflags)
+CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml2_wrapper_fpu.o := $(dml2_ccflags)
 CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml2_utils.o := $(dml2_ccflags)
 CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml2_policy.o := $(dml2_ccflags)
 CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml2_translation_helper.o := $(dml2_ccflags)
@@ -65,7 +65,7 @@ CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml2_dc_resource_mgmt.o := $(dml2_ccflags)
 
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/display_mode_core.o := $(dml2_rcflags)
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/display_mode_util.o := $(dml2_rcflags)
-CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml2_wrapper.o := $(dml2_rcflags)
+CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml2_wrapper_fpu.o := $(dml2_rcflags)
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml2_utils.o := $(dml2_rcflags)
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml2_policy.o := $(dml2_rcflags)
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml2_translation_helper.o := $(dml2_rcflags)
@@ -73,7 +73,7 @@ CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml2_mall_phantom.o := $(dml2_rcflags)
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml_display_rq_dlg_calc.o := $(dml2_rcflags)
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml2_dc_resource_mgmt.o := $(dml2_rcflags)
 
-DML2 = display_mode_core.o display_mode_util.o dml2_wrapper.o \
+DML2 = display_mode_core.o display_mode_util.o dml2_wrapper_fpu.o \
 		dml2_utils.o dml2_policy.o dml2_translation_helper.o dml2_dc_resource_mgmt.o dml2_mall_phantom.o \
 		dml_display_rq_dlg_calc.o
 
drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper_fpu.c renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper.c +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper.c
rename to drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper_fpu.c
Signature · 1 line
2.43.0
author
#17 lore raw

PATCH 17/26 drm/amd/display: Move dml2_validate to the non-FPU dml2_wrapper

In reply to Alex Hung

From: Harry Wentland <[email protected]>

[WHAT]
It calls DC_FP_START/END and shouldn't be living inside an FPU compilation unit.

---
 .../gpu/drm/amd/display/dc/dml2_0/Makefile    |  2 +-
 .../drm/amd/display/dc/dml2_0/dml2_wrapper.c  | 36 +++++++++++++++++++
 .../drm/amd/display/dc/dml2_0/dml2_wrapper.h  |  7 ++++
 .../amd/display/dc/dml2_0/dml2_wrapper_fpu.c  | 34 ++----------------
 4 files changed, 47 insertions(+), 32 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper.c
drivers/gpu/drm/amd/display/dc/dml2_0/Makefile +1 -1
index a112931007b1..631ea04059a8 100644
@@ -73,7 +73,7 @@ CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml2_mall_phantom.o := $(dml2_rcflags)
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml_display_rq_dlg_calc.o := $(dml2_rcflags)
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml2_dc_resource_mgmt.o := $(dml2_rcflags)
 
-DML2 = display_mode_core.o display_mode_util.o dml2_wrapper_fpu.o \
+DML2 = display_mode_core.o display_mode_util.o dml2_wrapper_fpu.o dml2_wrapper.o \
 		dml2_utils.o dml2_policy.o dml2_translation_helper.o dml2_dc_resource_mgmt.o dml2_mall_phantom.o \
 		dml_display_rq_dlg_calc.o
 
drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper.c new file +36 -0
new file mode 100644
index 000000000000..b665bd4569a5
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright 2025 Advanced Micro Devices, Inc.
+ *
+ * Authors: AMD
+ */
+
+#include "dml2_internal_types.h"
+
+bool dml2_validate(const struct dc *in_dc, struct dc_state *context, struct dml2_context *dml2,
+	enum dc_validate_mode validate_mode)
+{
+	bool out = false;
+
+	if (!dml2)
+		return false;
+	dml2_apply_debug_options(in_dc, dml2);
+
+	/* DML2.1 validation path */
+	if (dml2->architecture == dml2_architecture_21) {
+		out = dml21_validate(in_dc, context, dml2, validate_mode);
+		return out;
+	}
+
+	DC_FP_START();
+
+	/* Use dml_validate_only for DC_VALIDATE_MODE_ONLY and DC_VALIDATE_MODE_AND_STATE_INDEX path */
+	if (validate_mode != DC_VALIDATE_MODE_AND_PROGRAMMING)
+		out = dml2_validate_only(context, validate_mode);
+	else
+		out = dml2_validate_and_build_resource(in_dc, context, validate_mode);
+
+	DC_FP_END();
+
+	return out;
+}
drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper.h +7 -0
index c384e141cebc..ee6051737204 100644
@@ -306,4 +306,11 @@ bool dml2_validate(const struct dc *in_dc,
 void dml2_extract_dram_and_fclk_change_support(struct dml2_context *dml2,
 	unsigned int *fclk_change_support, unsigned int *dram_clk_change_support);
 void dml2_prepare_mcache_programming(struct dc *in_dc, struct dc_state *context, struct dml2_context *dml2);
+
+void dml2_apply_debug_options(const struct dc *dc, struct dml2_context *dml2);
+bool dml2_validate_only(struct dc_state *context, enum dc_validate_mode validate_mode);
+bool dml2_validate_and_build_resource(const struct dc *in_dc, struct dc_state *context,
+		enum dc_validate_mode validate_mode);
+
 #endif //_DML2_WRAPPER_H_
+
drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper_fpu.c +3 -31
index 9deb03a18ccc..e1a41bf5e546 100644
@@ -395,7 +395,7 @@ static bool call_dml_mode_support_and_programming(struct dc_state *context, enum
 	return result;
 }
 
-static bool dml2_validate_and_build_resource(const struct dc *in_dc, struct dc_state *context,
+bool dml2_validate_and_build_resource(const struct dc *in_dc, struct dc_state *context,
 		enum dc_validate_mode validate_mode)
 {
 	struct dml2_context *dml2 = context->bw_ctx.dml2;
@@ -505,7 +505,7 @@ static bool dml2_validate_and_build_resource(const struct dc *in_dc, struct dc_s
 	return result;
 }
 
-static bool dml2_validate_only(struct dc_state *context, enum dc_validate_mode validate_mode)
+bool dml2_validate_only(struct dc_state *context, enum dc_validate_mode validate_mode)
 {
 	struct dml2_context *dml2;
 	unsigned int result = 0;
@@ -538,41 +538,13 @@ static bool dml2_validate_only(struct dc_state *context, enum dc_validate_mode v
 	return result == 1;
 }
 
-static void dml2_apply_debug_options(const struct dc *dc, struct dml2_context *dml2)
+void dml2_apply_debug_options(const struct dc *dc, struct dml2_context *dml2)
 {
 	if (dc->debug.override_odm_optimization) {
 		dml2->config.minimize_dispclk_using_odm = dc->debug.minimize_dispclk_using_odm;
 	}
 }
 
-bool dml2_validate(const struct dc *in_dc, struct dc_state *context, struct dml2_context *dml2,
-	enum dc_validate_mode validate_mode)
-{
-	bool out = false;
-
-	if (!dml2)
-		return false;
-	dml2_apply_debug_options(in_dc, dml2);
-
-	/* DML2.1 validation path */
-	if (dml2->architecture == dml2_architecture_21) {
-		out = dml21_validate(in_dc, context, dml2, validate_mode);
-		return out;
-	}
-
-	DC_FP_START();
-
-	/* Use dml_validate_only for DC_VALIDATE_MODE_ONLY and DC_VALIDATE_MODE_AND_STATE_INDEX path */
-	if (validate_mode != DC_VALIDATE_MODE_AND_PROGRAMMING)
-		out = dml2_validate_only(context, validate_mode);
-	else
-		out = dml2_validate_and_build_resource(in_dc, context, validate_mode);
-
-	DC_FP_END();
-
-	return out;
-}
-
 static inline struct dml2_context *dml2_allocate_memory(void)
 {
 	return (struct dml2_context *) vzalloc(sizeof(struct dml2_context));
Signature · 1 line
2.43.0
author
#18 lore raw

PATCH 18/26 drm/amd/display: Move dml2_create and init to the non-FPU dml2_wrapper

In reply to Alex Hung

From: Harry Wentland <[email protected]>

[WHAT]
dml2_init calls DC_FP_START/END and needs to be moved out of the FPU compilation unit.

---
 .../drm/amd/display/dc/dml2_0/dml2_wrapper.c  | 75 +++++++++++++++++
 .../drm/amd/display/dc/dml2_0/dml2_wrapper.h  |  2 +
 .../amd/display/dc/dml2_0/dml2_wrapper_fpu.c  | 82 ++-----------------
 .../amd/display/dc/dml2_0/dml2_wrapper_fpu.h  | 25 ++++++
 4 files changed, 107 insertions(+), 77 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper_fpu.h
drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper.c +75 -0
index b665bd4569a5..307186eb6af0 100644
@@ -6,6 +6,7 @@
  */
 
 #include "dml2_internal_types.h"
+#include "dml2_wrapper_fpu.h"
 
 bool dml2_validate(const struct dc *in_dc, struct dc_state *context, struct dml2_context *dml2,
 	enum dc_validate_mode validate_mode)
@@ -34,3 +35,77 @@ bool dml2_validate(const struct dc *in_dc, struct dc_state *context, struct dml2
 
 	return out;
 }
+
+static void dml2_init(const struct dc *in_dc, const struct dml2_configuration_options *config, struct dml2_context **dml2)
+{
+	if ((in_dc->debug.using_dml21) && (in_dc->ctx->dce_version >= DCN_VERSION_4_01)) {
+		dml21_reinit(in_dc, *dml2, config);
+		return;
+	}
+
+	// Store config options
+	(*dml2)->config = *config;
+
+	switch (in_dc->ctx->dce_version) {
+	case DCN_VERSION_3_5:
+		(*dml2)->v20.dml_core_ctx.project = dml_project_dcn35;
+		break;
+	case DCN_VERSION_3_51:
+		(*dml2)->v20.dml_core_ctx.project = dml_project_dcn351;
+		break;
+	case DCN_VERSION_3_6:
+		(*dml2)->v20.dml_core_ctx.project = dml_project_dcn36;
+		break;
+	case DCN_VERSION_3_2:
+		(*dml2)->v20.dml_core_ctx.project = dml_project_dcn32;
+		break;
+	case DCN_VERSION_3_21:
+		(*dml2)->v20.dml_core_ctx.project = dml_project_dcn321;
+		break;
+	case DCN_VERSION_4_01:
+		(*dml2)->v20.dml_core_ctx.project = dml_project_dcn401;
+		break;
+	default:
+		(*dml2)->v20.dml_core_ctx.project = dml_project_default;
+		break;
+	}
+
+	DC_FP_START();
+
+	initialize_dml2_ip_params(*dml2, in_dc, &(*dml2)->v20.dml_core_ctx.ip);
+
+	initialize_dml2_soc_bbox(*dml2, in_dc, &(*dml2)->v20.dml_core_ctx.soc);
+
+	initialize_dml2_soc_states(*dml2, in_dc, &(*dml2)->v20.dml_core_ctx.soc, &(*dml2)->v20.dml_core_ctx.states);
+
+	DC_FP_END();
+}
+
+bool dml2_create(const struct dc *in_dc, const struct dml2_configuration_options *config, struct dml2_context **dml2)
+{
+	// TODO : Temporarily add DCN_VERSION_3_2 for N-1 validation. Remove DCN_VERSION_3_2 after N-1 validation phase is complete.
+	if ((in_dc->debug.using_dml21) && (in_dc->ctx->dce_version >= DCN_VERSION_4_01))
+		return dml21_create(in_dc, dml2, config);
+
+	// Allocate Mode Lib Ctx
+	*dml2 = dml2_allocate_memory();
+
+	if (!(*dml2))
+		return false;
+
+	dml2_init(in_dc, config, dml2);
+
+	return true;
+}
+
+void dml2_reinit(const struct dc *in_dc,
+				 const struct dml2_configuration_options *config,
+				 struct dml2_context **dml2)
+{
+	if ((in_dc->debug.using_dml21) && (in_dc->ctx->dce_version >= DCN_VERSION_4_01)) {
+		dml21_reinit(in_dc, *dml2, config);
+		return;
+	}
+
+	dml2_init(in_dc, config, dml2);
+}
drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper.h +2 -0
index ee6051737204..9a9c27962f68 100644
@@ -312,5 +312,7 @@ bool dml2_validate_only(struct dc_state *context, enum dc_validate_mode validate
 bool dml2_validate_and_build_resource(const struct dc *in_dc, struct dc_state *context,
 		enum dc_validate_mode validate_mode);
 
+struct dml2_context *dml2_allocate_memory(void);
+
 #endif //_DML2_WRAPPER_H_
 
drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper_fpu.c +5 -77

114 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper_fpu.h new file +25 -0
new file mode 100644
index 000000000000..573df874b901
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright 2025 Advanced Micro Devices, Inc.
+ *
+ * Authors: AMD
+ */
+
+#ifndef _DML2_WRAPPER_FPU_H_
+#define _DML2_WRAPPER_FPU_H_
+
+#include "os_types.h"
+
+struct dml2_context;
+struct dc;
+struct ip_params_st;
+struct soc_bounding_box_st;
+struct soc_states_st;
+
+void initialize_dml2_ip_params(struct dml2_context *dml2, const struct dc *in_dc, struct ip_params_st *out);
+void initialize_dml2_soc_bbox(struct dml2_context *dml2, const struct dc *in_dc, struct soc_bounding_box_st *out);
+void initialize_dml2_soc_states(struct dml2_context *dml2,
+	const struct dc *in_dc, const struct soc_bounding_box_st *in_bbox, struct soc_states_st *out);
+
+#endif //_DML2_WRAPPER_FPU_H_
+
Signature · 1 line
2.43.0
author
#19 lore raw

PATCH 19/26 drm/amd/display: Add cursor offload abort to the new HWSS path

In reply to Alex Hung

From: Nicholas Kazlauskas <[email protected]>

[HOW]
If cursor attributes or position are passed into DC via a stream update and we take the newer HWSS paths then it's possible that the update races with cursor offloading if it's enabled.

This can cause the cursor to remain on the screen if no further updates come in if it results in HW cursor support being disabled.

[HOW]
Add the abort into the HWSS path so that cursor offloading doesn't attempt to reprogram the cursor with outdated params.

---
 .../drm/amd/display/dc/core/dc_hw_sequencer.c | 24 +++++++++++++++++++
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c |  2 ++
 .../drm/amd/display/dc/hwss/hw_sequencer.h    | 13 ++++++++++
 3 files changed, 39 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +24 -0
index a01cb2897aab..e2763b60482a 100644
@@ -1293,6 +1293,9 @@ void hwss_execute_sequence(struct dc *dc,
 		case HUBP_MEM_PROGRAM_VIEWPORT:
 			hwss_hubp_mem_program_viewport(params);
 			break;
+		case ABORT_CURSOR_OFFLOAD_UPDATE:
+			hwss_abort_cursor_offload_update(params);
+			break;
 		case SET_CURSOR_ATTRIBUTE:
 			hwss_set_cursor_attribute(params);
 			break;
@@ -3076,6 +3079,15 @@ void hwss_hubp_mem_program_viewport(union block_sequence_params *params)
 		hubp->funcs->mem_program_viewport(hubp, viewport, viewport_c);
 }
 
+void hwss_abort_cursor_offload_update(union block_sequence_params *params)
+{
+	struct dc *dc = params->abort_cursor_offload_update_params.dc;
+	struct pipe_ctx *pipe_ctx = params->abort_cursor_offload_update_params.pipe_ctx;
+
+	if (dc && dc->hwss.abort_cursor_offload_update)
+		dc->hwss.abort_cursor_offload_update(dc, pipe_ctx);
+}
+
 void hwss_set_cursor_attribute(union block_sequence_params *params)
 {
 	struct dc *dc = params->set_cursor_attribute_params.dc;
@@ -3934,6 +3946,18 @@ void hwss_add_hubp_mem_program_viewport(struct block_sequence_state *seq_state,
 	}
 }
 
+void hwss_add_abort_cursor_offload_update(struct block_sequence_state *seq_state,
+		struct dc *dc,
+		struct pipe_ctx *pipe_ctx)
+{
+	if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
+		seq_state->steps[*seq_state->num_steps].func = ABORT_CURSOR_OFFLOAD_UPDATE;
+		seq_state->steps[*seq_state->num_steps].params.abort_cursor_offload_update_params.dc = dc;
+		seq_state->steps[*seq_state->num_steps].params.abort_cursor_offload_update_params.pipe_ctx = pipe_ctx;
+		(*seq_state->num_steps)++;
+	}
+}
+
 void hwss_add_set_cursor_attribute(struct block_sequence_state *seq_state,
 		struct dc *dc,
 		struct pipe_ctx *pipe_ctx)
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +2 -0
index f02edc9371b0..01b0f72b6623 100644
@@ -3675,6 +3675,8 @@ void dcn401_update_dchubp_dpp_sequence(struct dc *dc,
 	     pipe_ctx->update_flags.bits.scaler || viewport_changed == true) &&
 	    pipe_ctx->stream->cursor_attributes.address.quad_part != 0) {
 
+		hwss_add_abort_cursor_offload_update(seq_state, dc, pipe_ctx);
+
 		hwss_add_set_cursor_attribute(seq_state, dc, pipe_ctx);
 
 		/* Step 15: Cursor position setup */
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +13 -0
index 3772b4aa11cc..8ed9eea40c56 100644
@@ -696,6 +696,11 @@ struct hubp_program_mcache_id_and_split_coordinate_params {
 	struct mcache_regs_struct *mcache_regs;
 };
 
+struct abort_cursor_offload_update_params {
+	struct dc *dc;
+	struct pipe_ctx *pipe_ctx;
+};
+
 struct set_cursor_attribute_params {
 	struct dc *dc;
 	struct pipe_ctx *pipe_ctx;
@@ -842,6 +847,7 @@ union block_sequence_params {
 	struct mpc_insert_plane_params mpc_insert_plane_params;
 	struct dpp_set_scaler_params dpp_set_scaler_params;
 	struct hubp_mem_program_viewport_params hubp_mem_program_viewport_params;
+	struct abort_cursor_offload_update_params abort_cursor_offload_update_params;
 	struct set_cursor_attribute_params set_cursor_attribute_params;
 	struct set_cursor_position_params set_cursor_position_params;
 	struct set_cursor_sdr_white_level_params set_cursor_sdr_white_level_params;
@@ -960,6 +966,7 @@ enum block_sequence_func {
 	MPC_INSERT_PLANE,
 	DPP_SET_SCALER,
 	HUBP_MEM_PROGRAM_VIEWPORT,
+	ABORT_CURSOR_OFFLOAD_UPDATE,
 	SET_CURSOR_ATTRIBUTE,
 	SET_CURSOR_POSITION,
 	SET_CURSOR_SDR_WHITE_LEVEL,
@@ -1565,6 +1572,8 @@ void hwss_dpp_set_scaler(union block_sequence_params *params);
 
 void hwss_hubp_mem_program_viewport(union block_sequence_params *params);
 
+void hwss_abort_cursor_offload_update(union block_sequence_params *params);
+
 void hwss_set_cursor_attribute(union block_sequence_params *params);
 
 void hwss_set_cursor_position(union block_sequence_params *params);
@@ -1961,6 +1970,10 @@ void hwss_add_hubp_mem_program_viewport(struct block_sequence_state *seq_state,
 		const struct rect *viewport,
 		const struct rect *viewport_c);
 
+void hwss_add_abort_cursor_offload_update(struct block_sequence_state *seq_state,
+		struct dc *dc,
+		struct pipe_ctx *pipe_ctx);
+
 void hwss_add_set_cursor_attribute(struct block_sequence_state *seq_state,
 		struct dc *dc,
 		struct pipe_ctx *pipe_ctx);
Signature · 1 line
2.43.0
author
#20 lore raw

PATCH 20/26 drm/amd/display: Permit DC_FP_START/END only in non-FP compilation units

In reply to Alex Hung

From: Ard Biesheuvel <[email protected]>

[WHAT]
Test the existing CPP macro _LINUX_FPU_COMPILATION_UNIT, which is set when building source files that are permitted to use floating point, in the implementation of DC_FP_START/END so that those are only usable in non-FP code. This is a requirement of the generic kernel mode FPU API, as some architectures (i.e., arm64) cannot safely enable FP codegen in arbitrary code.

Cc Austin Zheng <[email protected]>
Cc Jun Lei <[email protected]>
Cc Harry Wentland <[email protected]>
Cc Leo Li <[email protected]>
Cc Rodrigo Siqueira <[email protected]>
Cc Alex Deucher <[email protected]>
Cc "Christian König" <[email protected]>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h | 8 ++++++++
 drivers/gpu/drm/amd/display/dc/os_types.h      | 2 --
 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h +8 -0
index b8275b397920..4e921632bc4e 100644
@@ -31,4 +31,12 @@ void dc_assert_fp_enabled(void);
 void dc_fpu_begin(const char *function_name, const int line);
 void dc_fpu_end(const char *function_name, const int line);
 
+#ifndef _LINUX_FPU_COMPILATION_UNIT
+#define DC_FP_START()	dc_fpu_begin(__func__, __LINE__)
+#define DC_FP_END()	dc_fpu_end(__func__, __LINE__)
+#else
+#define DC_FP_START()	BUILD_BUG()
+#define DC_FP_END()	BUILD_BUG()
+#endif
+
 #endif /* __DC_FPU_H__ */
drivers/gpu/drm/amd/display/dc/os_types.h +0 -2
index 782316348941..6af831710489 100644
@@ -55,8 +55,6 @@
 
 #if defined(CONFIG_DRM_AMD_DC_FP)
 #include "amdgpu_dm/dc_fpu.h"
-#define DC_FP_START() dc_fpu_begin(__func__, __LINE__)
-#define DC_FP_END() dc_fpu_end(__func__, __LINE__)
 #endif /* CONFIG_DRM_AMD_DC_FP */
 
 /*
Signature · 1 line
2.43.0
maintainer Acked-by on v1 20/26
#21 lore raw

Re: [PATCH 20/26] drm/amd/display: Permit DC_FP_START/END only in non-FP compilation units

Quoted 20 lines · Alex Hung

From: Ard Biesheuvel <[email protected]>

[WHAT]
Test the existing CPP macro _LINUX_FPU_COMPILATION_UNIT, which is set when building source files that are permitted to use floating point, in the implementation of DC_FP_START/END so that those are only usable in non-FP code. This is a requirement of the generic kernel mode FPU API, as some architectures (i.e., arm64) cannot safely enable FP codegen in arbitrary code.

Cc Austin Zheng <[email protected]>
Cc Jun Lei <[email protected]>
Cc Harry Wentland <[email protected]>
Cc Leo Li <[email protected]>
Cc Rodrigo Siqueira <[email protected]>
Cc Alex Deucher <[email protected]>
Cc "Christian König" <[email protected]>
Quoted 3 lines
Quoted 35 lines
---
 drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h | 8 ++++++++
 drivers/gpu/drm/amd/display/dc/os_types.h      | 2 --
 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h +8 -0
index b8275b397920..4e921632bc4e 100644
@@ -31,4 +31,12 @@ void dc_assert_fp_enabled(void);
 void dc_fpu_begin(const char *function_name, const int line);
 void dc_fpu_end(const char *function_name, const int line);
 
+#ifndef _LINUX_FPU_COMPILATION_UNIT
+#define DC_FP_START()	dc_fpu_begin(__func__, __LINE__)
+#define DC_FP_END()	dc_fpu_end(__func__, __LINE__)
+#else
+#define DC_FP_START()	BUILD_BUG()
+#define DC_FP_END()	BUILD_BUG()
+#endif
+
 #endif /* __DC_FPU_H__ */
drivers/gpu/drm/amd/display/dc/os_types.h +0 -2
index 782316348941..6af831710489 100644
@@ -55,8 +55,6 @@
 
 #if defined(CONFIG_DRM_AMD_DC_FP)
 #include "amdgpu_dm/dc_fpu.h"
-#define DC_FP_START() dc_fpu_begin(__func__, __LINE__)
-#define DC_FP_END() dc_fpu_end(__func__, __LINE__)
 #endif /* CONFIG_DRM_AMD_DC_FP */
 
 /*
author
#22 lore raw

PATCH 21/26 drm/amd/display: Drop FPU flags from dml21_wrapper.c

In reply to Alex Hung

From: Harry Wentland <[email protected]>

[WHAT]
The existing CFLAGS_ lines were pointing to a wrong location for dml21_wrapper.c and were thereby ineffective. This means dml21_wrapper.c is not an FPU compilation unit. Remove the (erroneous) CFLAGS_ entries.

---
 drivers/gpu/drm/amd/display/dc/dml2_0/Makefile | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2_0/Makefile +0 -2
index 631ea04059a8..30cfc0848792 100644
@@ -95,7 +95,6 @@ CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn3.o := $(dml2_ccfl
 CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.o := $(dml2_ccflags)
 CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_factory.o := $(dml2_ccflags)
 CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_standalone_libraries/lib_float_math.o := $(dml2_ccflags)
-CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml21_wrapper.o := $(dml2_ccflags)
 CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/dml21_translation_helper.o := $(dml2_ccflags)
 CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/dml21_utils.o := $(dml2_ccflags)
 
@@ -113,7 +112,6 @@ CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn3.o := $(dm
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.o := $(dml2_rcflags)
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_factory.o := $(dml2_rcflags)
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_standalone_libraries/lib_float_math.o := $(dml2_rcflags)
-CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml21_wrapper.o := $(dml2_rcflags)
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/dml21_translation_helper.o := $(dml2_rcflags)
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/dml21_utils.o := $(dml2_rcflags)
 
Signature · 1 line
2.43.0
author
#23 lore raw

PATCH 22/26 drm/amd/display: Check ATOM_DEVICE_CRT2_SUPPORT in dc_load_detection

In reply to Alex Hung

From: Ivan Lipski <[email protected]>

[WHY & HOW]
Fix the typo of the else-if condition from ATOM_DEVICE_CRT1_SUPPORT to ATOM_DEVICE_CRT2_SUPPORT.

---
 drivers/gpu/drm/amd/display/dc/bios/bios_parser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/bios/bios_parser.c +1 -1
index 4120d6c4c5e4..d1471f34e419 100644
@@ -805,7 +805,7 @@ static enum bp_result bios_parser_dac_load_detection(
 
 	if (bp_params.device_id == ATOM_DEVICE_CRT1_SUPPORT)
 		device_id_mask = ATOM_S0_CRT1_MASK;
-	else if (bp_params.device_id == ATOM_DEVICE_CRT1_SUPPORT)
+	else if (bp_params.device_id == ATOM_DEVICE_CRT2_SUPPORT)
 		device_id_mask = ATOM_S0_CRT2_MASK;
 	else
 		return BP_RESULT_UNSUPPORTED;
Signature · 1 line
2.43.0
author
#24 lore raw

PATCH 23/26 drm/amd/display: Correct DSC padding accounting

In reply to Alex Hung

From: Relja Vojvodic <[email protected]>

[WHY]
- After the addition of all OVT patches, DSC padding was being accounted for multiple times, effectively doubling the padding
- This caused compliance failures or corruption

[HOW]
- Add padding to DSC pic width when required by HW, and do not re-add when calculating reg values
- Do not add padding when computing PPS values, and instead track padding separately to add when calculating slice width values

---
 drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.c   | 2 +-
 drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c     | 2 +-
 drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c     | 2 +-
 drivers/gpu/drm/amd/display/dc/link/link_dpms.c             | 3 ++-
 .../gpu/drm/amd/display/dc/resource/dcn20/dcn20_resource.c  | 6 +++---
 5 files changed, 8 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.c +1 -1
index 4ee6ed610de0..3e239124c17d 100644
@@ -108,7 +108,7 @@ static void update_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable)
 		dsc_cfg.dc_dsc_cfg = stream->timing.dsc_cfg;
 		ASSERT(dsc_cfg.dc_dsc_cfg.num_slices_h % opp_cnt == 0);
 		dsc_cfg.dc_dsc_cfg.num_slices_h /= opp_cnt;
-		dsc_cfg.dsc_padding = pipe_ctx->dsc_padding_params.dsc_hactive_padding;
+		dsc_cfg.dsc_padding = 0;
 
 		dsc->funcs->dsc_set_config(dsc, &dsc_cfg, &dsc_optc_cfg);
 		dsc->funcs->dsc_enable(dsc, pipe_ctx->stream_res.opp->inst);
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +1 -1
index bf19ba65d09a..b213a2ac827a 100644
@@ -1061,7 +1061,7 @@ void dcn32_update_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable)
 		dsc_cfg.dc_dsc_cfg = stream->timing.dsc_cfg;
 		ASSERT(dsc_cfg.dc_dsc_cfg.num_slices_h % opp_cnt == 0);
 		dsc_cfg.dc_dsc_cfg.num_slices_h /= opp_cnt;
-		dsc_cfg.dsc_padding = pipe_ctx->dsc_padding_params.dsc_hactive_padding;
+		dsc_cfg.dsc_padding = 0;
 
 		if (should_use_dto_dscclk)
 			dccg->funcs->set_dto_dscclk(dccg, dsc->inst, dsc_cfg.dc_dsc_cfg.num_slices_h);
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c +1 -1
index 7aa0f452e8f7..cb2dfd34b5e2 100644
@@ -364,7 +364,7 @@ static void update_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable)
 		dsc_cfg.dc_dsc_cfg = stream->timing.dsc_cfg;
 		ASSERT(dsc_cfg.dc_dsc_cfg.num_slices_h % opp_cnt == 0);
 		dsc_cfg.dc_dsc_cfg.num_slices_h /= opp_cnt;
-		dsc_cfg.dsc_padding = pipe_ctx->dsc_padding_params.dsc_hactive_padding;
+		dsc_cfg.dsc_padding = 0;
 
 		dsc->funcs->dsc_set_config(dsc, &dsc_cfg, &dsc_optc_cfg);
 		dsc->funcs->dsc_enable(dsc, pipe_ctx->stream_res.opp->inst);
drivers/gpu/drm/amd/display/dc/link/link_dpms.c +2 -1
index 1b1ce3839922..77e049917c4d 100644
@@ -841,7 +841,7 @@ void link_set_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable)
 		dsc_cfg.dc_dsc_cfg = stream->timing.dsc_cfg;
 		ASSERT(dsc_cfg.dc_dsc_cfg.num_slices_h % opp_cnt == 0);
 		dsc_cfg.dc_dsc_cfg.num_slices_h /= opp_cnt;
-		dsc_cfg.dsc_padding = pipe_ctx->dsc_padding_params.dsc_hactive_padding;
+		dsc_cfg.dsc_padding = 0;
 
 		if (should_use_dto_dscclk)
 			dccg->funcs->set_dto_dscclk(dccg, dsc->inst, dsc_cfg.dc_dsc_cfg.num_slices_h);
@@ -857,6 +857,7 @@ void link_set_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable)
 		}
 		dsc_cfg.dc_dsc_cfg.num_slices_h *= opp_cnt;
 		dsc_cfg.pic_width *= opp_cnt;
+		dsc_cfg.dsc_padding = pipe_ctx->dsc_padding_params.dsc_hactive_padding;
 
 		optc_dsc_mode = dsc_optc_cfg.is_pixel_format_444 ? OPTC_DSC_ENABLED_444 : OPTC_DSC_ENABLED_NATIVE_SUBSAMPLED;
 
drivers/gpu/drm/amd/display/dc/resource/dcn20/dcn20_resource.c +3 -3
index 6679c1a14f2f..8d10aac9c510 100644
@@ -1660,8 +1660,8 @@ bool dcn20_validate_dsc(struct dc *dc, struct dc_state *new_ctx)
 		if (pipe_ctx->top_pipe || pipe_ctx->prev_odm_pipe || !stream || !stream->timing.flags.DSC)
 			continue;
 
-		dsc_cfg.pic_width = (stream->timing.h_addressable + stream->timing.h_border_left
-				+ stream->timing.h_border_right) / opp_cnt;
+		dsc_cfg.pic_width = (stream->timing.h_addressable + pipe_ctx->dsc_padding_params.dsc_hactive_padding
+				+ stream->timing.h_border_left + stream->timing.h_border_right) / opp_cnt;
 		dsc_cfg.pic_height = stream->timing.v_addressable + stream->timing.v_border_top
 				+ stream->timing.v_border_bottom;
 		dsc_cfg.pixel_encoding = stream->timing.pixel_encoding;
@@ -1669,7 +1669,7 @@ bool dcn20_validate_dsc(struct dc *dc, struct dc_state *new_ctx)
 		dsc_cfg.is_odm = pipe_ctx->next_odm_pipe ? true : false;
 		dsc_cfg.dc_dsc_cfg = stream->timing.dsc_cfg;
 		dsc_cfg.dc_dsc_cfg.num_slices_h /= opp_cnt;
-		dsc_cfg.dsc_padding = pipe_ctx->dsc_padding_params.dsc_hactive_padding;
+		dsc_cfg.dsc_padding = 0;
 
 		if (!pipe_ctx->stream_res.dsc->funcs->dsc_validate_stream(pipe_ctx->stream_res.dsc, &dsc_cfg))
 			return false;
Signature · 1 line
2.43.0
#25 lore raw

Re: [PATCH 23/26] drm/amd/display: Correct DSC padding accounting

Quoted 5 lines · Alex Hung

From: Relja Vojvodic <[email protected]>

[WHY]
- After the addition of all OVT patches, DSC padding was being accounted for multiple times, effectively doubling the padding

Can you double check when the OVT patches were submitted and if they were CC @stable? If not; I think the stable tag should be dropped on this patch.

Quoted 107 lines

- This caused compliance failures or corruption

[HOW]
- Add padding to DSC pic width when required by HW, and do not re-add when calculating reg values
- Do not add padding when computing PPS values, and instead track padding separately to add when calculating slice width values

---
  drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.c   | 2 +-
  drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c     | 2 +-
  drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c     | 2 +-
  drivers/gpu/drm/amd/display/dc/link/link_dpms.c             | 3 ++-
  .../gpu/drm/amd/display/dc/resource/dcn20/dcn20_resource.c  | 6 +++---
  5 files changed, 8 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.c +1 -1
index 4ee6ed610de0..3e239124c17d 100644
@@ -108,7 +108,7 @@ static void update_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable)
  		dsc_cfg.dc_dsc_cfg = stream->timing.dsc_cfg;
  		ASSERT(dsc_cfg.dc_dsc_cfg.num_slices_h % opp_cnt == 0);
  		dsc_cfg.dc_dsc_cfg.num_slices_h /= opp_cnt;
-		dsc_cfg.dsc_padding = pipe_ctx->dsc_padding_params.dsc_hactive_padding;
+		dsc_cfg.dsc_padding = 0;
 
  		dsc->funcs->dsc_set_config(dsc, &dsc_cfg, &dsc_optc_cfg);
  		dsc->funcs->dsc_enable(dsc, pipe_ctx->stream_res.opp->inst);
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +1 -1
index bf19ba65d09a..b213a2ac827a 100644
@@ -1061,7 +1061,7 @@ void dcn32_update_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable)
  		dsc_cfg.dc_dsc_cfg = stream->timing.dsc_cfg;
  		ASSERT(dsc_cfg.dc_dsc_cfg.num_slices_h % opp_cnt == 0);
  		dsc_cfg.dc_dsc_cfg.num_slices_h /= opp_cnt;
-		dsc_cfg.dsc_padding = pipe_ctx->dsc_padding_params.dsc_hactive_padding;
+		dsc_cfg.dsc_padding = 0;
 
  		if (should_use_dto_dscclk)
  			dccg->funcs->set_dto_dscclk(dccg, dsc->inst, dsc_cfg.dc_dsc_cfg.num_slices_h);
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c +1 -1
index 7aa0f452e8f7..cb2dfd34b5e2 100644
@@ -364,7 +364,7 @@ static void update_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable)
  		dsc_cfg.dc_dsc_cfg = stream->timing.dsc_cfg;
  		ASSERT(dsc_cfg.dc_dsc_cfg.num_slices_h % opp_cnt == 0);
  		dsc_cfg.dc_dsc_cfg.num_slices_h /= opp_cnt;
-		dsc_cfg.dsc_padding = pipe_ctx->dsc_padding_params.dsc_hactive_padding;
+		dsc_cfg.dsc_padding = 0;
 
  		dsc->funcs->dsc_set_config(dsc, &dsc_cfg, &dsc_optc_cfg);
  		dsc->funcs->dsc_enable(dsc, pipe_ctx->stream_res.opp->inst);
drivers/gpu/drm/amd/display/dc/link/link_dpms.c +2 -1
index 1b1ce3839922..77e049917c4d 100644
@@ -841,7 +841,7 @@ void link_set_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable)
  		dsc_cfg.dc_dsc_cfg = stream->timing.dsc_cfg;
  		ASSERT(dsc_cfg.dc_dsc_cfg.num_slices_h % opp_cnt == 0);
  		dsc_cfg.dc_dsc_cfg.num_slices_h /= opp_cnt;
-		dsc_cfg.dsc_padding = pipe_ctx->dsc_padding_params.dsc_hactive_padding;
+		dsc_cfg.dsc_padding = 0;
 
  		if (should_use_dto_dscclk)
  			dccg->funcs->set_dto_dscclk(dccg, dsc->inst, dsc_cfg.dc_dsc_cfg.num_slices_h);
@@ -857,6 +857,7 @@ void link_set_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable)
  		}
  		dsc_cfg.dc_dsc_cfg.num_slices_h *= opp_cnt;
  		dsc_cfg.pic_width *= opp_cnt;
+		dsc_cfg.dsc_padding = pipe_ctx->dsc_padding_params.dsc_hactive_padding;
 
  		optc_dsc_mode = dsc_optc_cfg.is_pixel_format_444 ? OPTC_DSC_ENABLED_444 : OPTC_DSC_ENABLED_NATIVE_SUBSAMPLED;
 
drivers/gpu/drm/amd/display/dc/resource/dcn20/dcn20_resource.c +3 -3
index 6679c1a14f2f..8d10aac9c510 100644
@@ -1660,8 +1660,8 @@ bool dcn20_validate_dsc(struct dc *dc, struct dc_state *new_ctx)
  		if (pipe_ctx->top_pipe || pipe_ctx->prev_odm_pipe || !stream || !stream->timing.flags.DSC)
  			continue;
 
-		dsc_cfg.pic_width = (stream->timing.h_addressable + stream->timing.h_border_left
-				+ stream->timing.h_border_right) / opp_cnt;
+		dsc_cfg.pic_width = (stream->timing.h_addressable + pipe_ctx->dsc_padding_params.dsc_hactive_padding
+				+ stream->timing.h_border_left + stream->timing.h_border_right) / opp_cnt;
  		dsc_cfg.pic_height = stream->timing.v_addressable + stream->timing.v_border_top
  				+ stream->timing.v_border_bottom;
  		dsc_cfg.pixel_encoding = stream->timing.pixel_encoding;
@@ -1669,7 +1669,7 @@ bool dcn20_validate_dsc(struct dc *dc, struct dc_state *new_ctx)
  		dsc_cfg.is_odm = pipe_ctx->next_odm_pipe ? true : false;
  		dsc_cfg.dc_dsc_cfg = stream->timing.dsc_cfg;
  		dsc_cfg.dc_dsc_cfg.num_slices_h /= opp_cnt;
-		dsc_cfg.dsc_padding = pipe_ctx->dsc_padding_params.dsc_hactive_padding;
+		dsc_cfg.dsc_padding = 0;
 
  		if (!pipe_ctx->stream_res.dsc->funcs->dsc_validate_stream(pipe_ctx->stream_res.dsc, &dsc_cfg))
  			return false;
author
#26 lore raw

Re: [PATCH 23/26] drm/amd/display: Correct DSC padding accounting

Quoted 10 lines · Mario Limonciello
Quoted 5 lines · Alex Hung

From: Relja Vojvodic <[email protected]>

[WHY]
- After the addition of all OVT patches, DSC padding was being accounted for multiple times, effectively doubling the padding

Can you double check when the OVT patches were submitted and if they were CC @stable?  If not; I think the stable tag should be dropped on this patch.

Thanks. I will remove the Cc stable.

Quoted 119 lines
Quoted 118 lines

- This caused compliance failures or corruption

[HOW]
- Add padding to DSC pic width when required by HW, and do not re-add when calculating reg values
- Do not add padding when computing PPS values, and instead track padding separately to add when calculating slice width values

---
  drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.c   | 2 +- drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c     | 2 +- drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c     | 2 +- drivers/gpu/drm/amd/display/dc/link/link_dpms.c             | 3 ++- .../gpu/drm/amd/display/dc/resource/dcn20/dcn20_resource.c  | 6 +++---

  5 files changed, 8 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.c +1 -1
index 4ee6ed610de0..3e239124c17d 100644
@@ -108,7 +108,7 @@ static void update_dsc_on_stream(struct pipe_ctx 
 *pipe_ctx, bool enable)
           dsc_cfg.dc_dsc_cfg = stream->timing.dsc_cfg;
           ASSERT(dsc_cfg.dc_dsc_cfg.num_slices_h % opp_cnt == 0);
           dsc_cfg.dc_dsc_cfg.num_slices_h /= opp_cnt;
-        dsc_cfg.dsc_padding = pipe_ctx- 
 >dsc_padding_params.dsc_hactive_padding;
+        dsc_cfg.dsc_padding = 0;
           dsc->funcs->dsc_set_config(dsc, &dsc_cfg, &dsc_optc_cfg);

          dsc->funcs->dsc_enable(dsc, pipe_ctx->stream_res.opp->inst);

drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +1 -1
index bf19ba65d09a..b213a2ac827a 100644
@@ -1061,7 +1061,7 @@ void dcn32_update_dsc_on_stream(struct pipe_ctx 
 *pipe_ctx, bool enable)
           dsc_cfg.dc_dsc_cfg = stream->timing.dsc_cfg;
           ASSERT(dsc_cfg.dc_dsc_cfg.num_slices_h % opp_cnt == 0);
           dsc_cfg.dc_dsc_cfg.num_slices_h /= opp_cnt;
-        dsc_cfg.dsc_padding = pipe_ctx- 
 >dsc_padding_params.dsc_hactive_padding;
+        dsc_cfg.dsc_padding = 0;
           if (should_use_dto_dscclk)

              dccg->funcs->set_dto_dscclk(dccg, dsc->inst, dsc_cfg.dc_dsc_cfg.num_slices_h);

drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c +1 -1
index 7aa0f452e8f7..cb2dfd34b5e2 100644
@@ -364,7 +364,7 @@ static void update_dsc_on_stream(struct pipe_ctx 
 *pipe_ctx, bool enable)
           dsc_cfg.dc_dsc_cfg = stream->timing.dsc_cfg;
           ASSERT(dsc_cfg.dc_dsc_cfg.num_slices_h % opp_cnt == 0);
           dsc_cfg.dc_dsc_cfg.num_slices_h /= opp_cnt;
-        dsc_cfg.dsc_padding = pipe_ctx- 
 >dsc_padding_params.dsc_hactive_padding;
+        dsc_cfg.dsc_padding = 0;
           dsc->funcs->dsc_set_config(dsc, &dsc_cfg, &dsc_optc_cfg);

          dsc->funcs->dsc_enable(dsc, pipe_ctx->stream_res.opp->inst);

drivers/gpu/drm/amd/display/dc/link/link_dpms.c +1 -1
index 1b1ce3839922..77e049917c4d 100644
@@ -841,7 +841,7 @@ void link_set_dsc_on_stream(struct pipe_ctx 
 *pipe_ctx, bool enable)
           dsc_cfg.dc_dsc_cfg = stream->timing.dsc_cfg;
           ASSERT(dsc_cfg.dc_dsc_cfg.num_slices_h % opp_cnt == 0);
           dsc_cfg.dc_dsc_cfg.num_slices_h /= opp_cnt;
-        dsc_cfg.dsc_padding = pipe_ctx- 
 >dsc_padding_params.dsc_hactive_padding;
+        dsc_cfg.dsc_padding = 0;
           if (should_use_dto_dscclk)

              dccg->funcs->set_dto_dscclk(dccg, dsc->inst, dsc_cfg.dc_dsc_cfg.num_slices_h);

drivers/gpu/drm/amd/display/dc/link/link_dpms.c +1 -0
@@ -857,6 +857,7 @@ void link_set_dsc_on_stream(struct pipe_ctx 
 *pipe_ctx, bool enable)
           }
           dsc_cfg.dc_dsc_cfg.num_slices_h *= opp_cnt;
           dsc_cfg.pic_width *= opp_cnt;
+        dsc_cfg.dsc_padding = pipe_ctx- 
 >dsc_padding_params.dsc_hactive_padding;
           optc_dsc_mode = dsc_optc_cfg.is_pixel_format_444 ? OPTC_DSC_ENABLED_444 : OPTC_DSC_ENABLED_NATIVE_SUBSAMPLED;
drivers/gpu/drm/amd/display/dc/resource/dcn20/dcn20_resource.c +0 -1
index 6679c1a14f2f..8d10aac9c510 100644
@@ -1660,8 +1660,8 @@ bool dcn20_validate_dsc(struct dc *dc, struct 
 dc_state *new_ctx)
           if (pipe_ctx->top_pipe || pipe_ctx->prev_odm_pipe || !stream || !stream->timing.flags.DSC)
               continue;
-        dsc_cfg.pic_width = (stream->timing.h_addressable + stream- 
Quoted 1 line

timing.h_border_left

-                + stream->timing.h_border_right) / opp_cnt; +        dsc_cfg.pic_width = (stream->timing.h_addressable + pipe_ctx-

Quoted 1 line

dsc_padding_params.dsc_hactive_padding

+                + stream->timing.h_border_left + stream-

Quoted 1 line

timing.h_border_right) / opp_cnt;

          dsc_cfg.pic_height = stream->timing.v_addressable + stream-

Quoted 1 line

timing.v_border_top

                  + stream->timing.v_border_bottom; dsc_cfg.pixel_encoding = stream->timing.pixel_encoding;

drivers/gpu/drm/amd/display/dc/resource/dcn20/dcn20_resource.c +1 -1
@@ -1669,7 +1669,7 @@ bool dcn20_validate_dsc(struct dc *dc, struct 
 dc_state *new_ctx)
           dsc_cfg.is_odm = pipe_ctx->next_odm_pipe ? true : false;
           dsc_cfg.dc_dsc_cfg = stream->timing.dsc_cfg;
           dsc_cfg.dc_dsc_cfg.num_slices_h /= opp_cnt;
-        dsc_cfg.dsc_padding = pipe_ctx- 
 >dsc_padding_params.dsc_hactive_padding;
+        dsc_cfg.dsc_padding = 0;

          if (!pipe_ctx->stream_res.dsc->funcs-

Quoted 1 line

dsc_validate_stream(pipe_ctx->stream_res.dsc, &dsc_cfg))

              return false;

author
#27 lore raw

PATCH 24/26 drm/amd/display: Add additional checks for PSP footer size

In reply to Alex Hung

From: Ovidiu Bunea <[email protected]>

[WHY & HOW]
Newer ASICs have different PSP footer sizes which lead to driver failing to locate the DMCUB FW meta info, which in turn causes improper DMCUB FW loading and causes DMCUB to crash.

Add support for custom PSP footer sizes and check 512B by default as well.

---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 51 ++++++++++-------
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |  7 +++
 drivers/gpu/drm/amd/display/dc/dc.h           |  1 +
 drivers/gpu/drm/amd/display/dmub/dmub_srv.h   | 33 +++++++++++
 .../gpu/drm/amd/display/dmub/src/dmub_srv.c   | 57 +++++++++++++++----
 5 files changed, 119 insertions(+), 30 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +31 -20
index 424020c0756d..580a5e1e37f7 100644
@@ -152,12 +152,6 @@ MODULE_FIRMWARE(FIRMWARE_DCN_36_DMUB);
 #define FIRMWARE_DCN_401_DMUB "amdgpu/dcn_4_0_1_dmcub.bin"
 MODULE_FIRMWARE(FIRMWARE_DCN_401_DMUB);
 
-/* Number of bytes in PSP header for firmware. */
-#define PSP_HEADER_BYTES 0x100
-
-/* Number of bytes in PSP footer for firmware. */
-#define PSP_FOOTER_BYTES 0x100
-
 /**
  * DOC: overview
  *
@@ -1298,15 +1292,14 @@ static int dm_dmub_hw_init(struct amdgpu_device *adev)
 
 	fw_inst_const = dmub_fw->data +
 			le32_to_cpu(hdr->header.ucode_array_offset_bytes) +
-			PSP_HEADER_BYTES;
+			PSP_HEADER_BYTES_256;
 
 	fw_bss_data = dmub_fw->data +
 		      le32_to_cpu(hdr->header.ucode_array_offset_bytes) +
 		      le32_to_cpu(hdr->inst_const_bytes);
 
 	/* Copy firmware and bios info into FB memory. */
-	fw_inst_const_size = le32_to_cpu(hdr->inst_const_bytes) -
-			     PSP_HEADER_BYTES - PSP_FOOTER_BYTES;
+	fw_inst_const_size = adev->dm.fw_inst_size;
 
 	fw_bss_data_size = le32_to_cpu(hdr->bss_data_bytes);
 
@@ -2437,9 +2430,11 @@ static void amdgpu_dm_dmub_reg_write(void *ctx, uint32_t address,
 static int dm_dmub_sw_init(struct amdgpu_device *adev)
 {
 	struct dmub_srv_create_params create_params;
+	struct dmub_srv_fw_meta_info_params fw_meta_info_params;
 	struct dmub_srv_region_params region_params;
 	struct dmub_srv_region_info region_info;
 	struct dmub_srv_memory_params memory_params;
+	struct dmub_fw_meta_info fw_info;
 	struct dmub_srv_fb_info *fb_info;
 	struct dmub_srv *dmub_srv;
 	const struct dmcub_firmware_header_v1_0 *hdr;
@@ -2547,22 +2542,37 @@ static int dm_dmub_sw_init(struct amdgpu_device *adev)
 		return -EINVAL;
 	}
 
+	/* Extract the FW meta info. */
+	memset(&fw_meta_info_params, 0, sizeof(fw_meta_info_params));
+
+	fw_meta_info_params.inst_const_size = le32_to_cpu(hdr->inst_const_bytes) -
+					      PSP_HEADER_BYTES_256;
+	fw_meta_info_params.bss_data_size = le32_to_cpu(hdr->bss_data_bytes);
+	fw_meta_info_params.fw_inst_const = adev->dm.dmub_fw->data +
+					    le32_to_cpu(hdr->header.ucode_array_offset_bytes) +
+					    PSP_HEADER_BYTES_256;
+	fw_meta_info_params.fw_bss_data = region_params.bss_data_size ? adev->dm.dmub_fw->data +
+					  le32_to_cpu(hdr->header.ucode_array_offset_bytes) +
+					  le32_to_cpu(hdr->inst_const_bytes) : NULL;
+	fw_meta_info_params.custom_psp_footer_size = 0;
+
+	status = dmub_srv_get_fw_meta_info_from_raw_fw(&fw_meta_info_params, &fw_info);
+	if (status != DMUB_STATUS_OK) {
+		/* Skip returning early, just log the error. */
+		drm_err(adev_to_drm(adev), "Error getting DMUB FW meta info: %d\n", status);
+		// return -EINVAL;
+	}
+
 	/* Calculate the size of all the regions for the DMUB service. */
 	memset(&region_params, 0, sizeof(region_params));
 
-	region_params.inst_const_size = le32_to_cpu(hdr->inst_const_bytes) -
-					PSP_HEADER_BYTES - PSP_FOOTER_BYTES;
-	region_params.bss_data_size = le32_to_cpu(hdr->bss_data_bytes);
+	region_params.inst_const_size = fw_meta_info_params.inst_const_size;
+	region_params.bss_data_size = fw_meta_info_params.bss_data_size;
 	region_params.vbios_size = adev->bios_size;
-	region_params.fw_bss_data = region_params.bss_data_size ?
-		adev->dm.dmub_fw->data +
-		le32_to_cpu(hdr->header.ucode_array_offset_bytes) +
-		le32_to_cpu(hdr->inst_const_bytes) : NULL;
-	region_params.fw_inst_const =
-		adev->dm.dmub_fw->data +
-		le32_to_cpu(hdr->header.ucode_array_offset_bytes) +
-		PSP_HEADER_BYTES;
+	region_params.fw_bss_data = fw_meta_info_params.fw_bss_data;
+	region_params.fw_inst_const = fw_meta_info_params.fw_inst_const;
 	region_params.window_memory_type = window_memory_type;
+	region_params.fw_info = (status == DMUB_STATUS_OK) ? &fw_info : NULL;
 
 	status = dmub_srv_calc_region_info(dmub_srv, &region_params,
 					   &region_info);
@@ -2609,6 +2619,7 @@ static int dm_dmub_sw_init(struct amdgpu_device *adev)
 	}
 
 	adev->dm.bb_from_dmub = dm_dmub_get_vbios_bounding_box(adev);
+	adev->dm.fw_inst_size = fw_meta_info_params.inst_const_size;
 
 	return 0;
 }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +7 -0
index d683b710181b..7065b20aa2e6 100644
@@ -408,6 +408,13 @@ struct amdgpu_display_manager {
 	 */
 	uint32_t dmcub_fw_version;
 
+	/**
+	 * @fw_inst_size:
+	 *
+	 * Size of the firmware instruction buffer.
+	 */
+	uint32_t fw_inst_size;
+
 	/**
 	 * @cgs_device:
 	 *
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
index a1fb5ed653a9..531d4a4c9326 100644
@@ -1188,6 +1188,7 @@ struct dc_debug_options {
 	bool enable_pg_cntl_debug_logs;
 	bool disable_stutter_for_wm_program;
 	bool enable_block_sequence_programming;
+	uint32_t custom_psp_footer_size;
 };
 
 
drivers/gpu/drm/amd/display/dmub/dmub_srv.h +33 -0
index 9d0168986fe7..12c1f9f7115a 100644
@@ -72,6 +72,9 @@
 /* Default tracebuffer size if meta is absent. */
 #define DMUB_TRACE_BUFFER_SIZE (64 * 1024)
 
+#define PSP_HEADER_BYTES_256 0x100 // 256 bytes
+#define PSP_FOOTER_BYTES_256 0x100 // 256 bytes
+
 /* Forward declarations */
 struct dmub_srv;
 struct dmub_srv_common_regs;
@@ -227,6 +230,23 @@ struct dmub_srv_region_params {
 	const uint8_t *fw_inst_const;
 	const uint8_t *fw_bss_data;
 	const enum dmub_window_memory_type *window_memory_type;
+	const struct dmub_fw_meta_info *fw_info;
+};
+
+/**
+ * struct dmub_srv_fw_meta_info_params - params used for fetching fw meta info from fw_image
+ * @inst_const_size: size of the fw inst const section
+ * @bss_data_size: size of the fw bss data section
+ * @fw_inst_const: raw firmware inst const section
+ * @fw_bss_data: raw firmware bss data section
+ * @custom_psp_footer_size: custom psp footer size to use when indexing for fw meta info
+ */
+struct dmub_srv_fw_meta_info_params {
+	uint32_t inst_const_size;
+	uint32_t bss_data_size;
+	const uint8_t *fw_inst_const;
+	const uint8_t *fw_bss_data;
+	uint32_t custom_psp_footer_size;
 };
 
 /**
@@ -249,6 +269,7 @@ struct dmub_srv_region_info {
 	uint32_t gart_size;
 	uint8_t num_regions;
 	struct dmub_region regions[DMUB_WINDOW_TOTAL];
+	uint32_t verified_psp_footer_size;
 };
 
 /**
@@ -1098,4 +1119,16 @@ enum dmub_status dmub_srv_update_inbox_status(struct dmub_srv *dmub);
  */
 bool dmub_srv_get_preos_info(struct dmub_srv *dmub);
 
+/**
+ * dmub_srv_get_fw_meta_info_from_raw_fw() - Fetch firmware metadata info from raw firmware image
+ * @params: parameters for fetching firmware metadata info
+ * @fw_info_out: output buffer for firmware metadata info
+ *
+ * Return:
+ *   DMUB_STATUS_OK - success
+ *   DMUB_STATUS_INVALID - no FW meta info found
+ */
+enum dmub_status dmub_srv_get_fw_meta_info_from_raw_fw(struct dmub_srv_fw_meta_info_params *params,
+						       struct dmub_fw_meta_info *fw_info_out);
+
 #endif /* _DMUB_SRV_H_ */
drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c +47 -10

88 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#28 lore raw

PATCH 25/26 drm/amd/display: [FW Promotion] Release 0.1.37.0

In reply to Alex Hung

From: Taimur Hassan <[email protected]>

Add a new disallow_time_us state and a new legacy_method_no_fams2 flag to fam2.

---
 drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +3 -1
index 173bc2bdf50f..9c2d687eb7fd 100644
@@ -2496,6 +2496,7 @@ struct dmub_fams2_drr_stream_static_state {
 struct dmub_fams2_cmd_legacy_stream_static_state {
 	uint16_t vactive_det_fill_delay_otg_vlines;
 	uint16_t programming_delay_otg_vlines;
+	uint32_t disallow_time_us;
 }; //v1
 
 struct dmub_fams2_cmd_subvp_stream_static_state {
@@ -2630,7 +2631,8 @@ union dmub_fams2_global_feature_config {
 		uint32_t enable_offload_flip: 1;
 		uint32_t enable_visual_confirm: 1;
 		uint32_t allow_delay_check_mode: 2;
-		uint32_t reserved: 24;
+		uint32_t legacy_method_no_fams2 : 1;
+		uint32_t reserved: 23;
 	} bits;
 	uint32_t all;
 };
Signature · 1 line
2.43.0
author
#29 lore raw

PATCH 26/26 drm/amd/display: Promote DC to 3.2.360

In reply to Alex Hung

From: Taimur Hassan <[email protected]>

This version brings along the following updates:
- Add additional checks for PSP footer size
- Correct DSC padding accounting
- Check ATOM_DEVICE_CRT2_SUPPORT in dc_load_detection
- Drop FPU flags from dml21_wrapper.c
- Permit DC_FP_START/END only in non-FP compilation units
- Add cursor offload abort to the new HWSS path
- Move dml2_create and init to the non-FPU dml2_wrapper
- Move dml2_validate to the non-FPU dml2_wrapper
- Rename dml2_wrapper.c to dml2_wrapper_fpu.c
- Increase EDID read retries
- Correct comment style
- Move CONNECTOR_ID_PCIE into switch/case
- Drop needless check for link->link_id.id
- Improve readability of link_detect_sink_signal_type
- Don't change brightness for disabled connectors
- Write default Vesa Aux backlight control in dmub
- Refactor panel replay dc libs
- Revise VSC SDP header for Panel Replay
- Fix sending redundant enable command to dmub
- Parse debug flag to PR FW
- Add AS-SDP v2 support for eDP feature
- Refactor panel replay set dmub cmd flow
- Improve HDMI info retrieval
- Check NULL before accessing

---
 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 531d4a4c9326..60c5d8627bc7 100644
@@ -63,7 +63,7 @@ struct dcn_dsc_reg_state;
 struct dcn_optc_reg_state;
 struct dcn_dccg_reg_state;
 
-#define DC_VER "3.2.359"
+#define DC_VER "3.2.360"
 
 /**
  * MAX_SURFACES - representative of the upper bound of surfaces that can be piped to a single CRTC
Signature · 1 line
2.43.0
Tested-by on the v1 series
#30 lore raw
In reply to Alex Hung

[Public]

Hi all,

This week this patchset was tested on 4 systems, two dGPU and two APU based, and tested across multiple display and connection types.

APU
• Single Display eDP -> 1080p 60hz, 1920x1200 165hz, 3840x2400 60hz
• Single Display DP (SST DSC) -> 4k144hz, 4k240hz
• Multi display -> eDP + DP/HDMI/USB-C -> 1080p 60hz eDP + 4k 144hz, 4k 240hz (Includes USB-C to DP/HDMI adapters)
• Thunderbolt -> LG Ultrafine 5k
• MST DSC -> Cable Matters 101075 (DP to 3x DP) with 3x 4k60hz displays, HP Hook G2 with 2x 4k60hz displays
• USB 4 -> HP Hook G4, Lenovo Thunderbolt Dock, both with 2x 4k60hz DP and 1x 4k60hz HDMI displays
• SST PCON -> Club3D CAC-1085 + 1x 4k 144hz, FRL3, at a max resolution supported by the dongle of 4k 120hz YUV420 12bpc.
• MST PCON -> 1x 4k 144hz, FRL3, at a max resolution supported by the adapter of 4k 120hz RGB 8bpc.

DGPU
• Single Display DP (SST DSC) -> 4k144hz, 4k240hz
• Multiple Display DP -> 4k240hz + 4k144hz
• MST (Startech MST14DP123DP [DP to 3x DP] and 2x 4k 60hz displays)
• MST DSC (with Cable Matters 101075 [DP to 3x DP] with 3x 4k60hz displays)

The testing is a mix of automated and manual tests. Manual testing includes (but is not limited to)
• Changing display configurations and settings
• Video/Audio playback
• Benchmark testing
• Suspend/Resume testing
• Feature testing (Freesync, HDCP, etc.)

Automated testing includes (but is not limited to)
• Script testing (scripts to automate some of the manual checks)
• IGT testing

The testing is mainly tested on the following displays, but occasionally there are tests with other displays
• Samsung G8 Neo 4k240hz
• Samsung QN55QN95B 4k 120hz
• Acer XV322QKKV 4k144hz
• HP U27 4k Wireless 4k60hz
• LG 27UD58B 4k60hz
• LG 32UN650WA 4k60hz
• LG Ultrafine 5k 5k60hz
• AU Optronics B140HAN01.1 1080p 60hz eDP
• AU Optronics B160UAN01.J 1920x1200 165hz eDP
• Samsung ATNA60YV02-0 3840x2400 60Hz OLED eDP

The patchset consists of the amd-staging-drm-next branch (Head commit - ec8bc3248afb799c62988ac3843c1505f452d043 -> drm/amd/display: Move analog check to dce110_hwseq) with new patches added on top of it.

Tested on Ubuntu 24.04.3, on Wayland and X11, using Gnome.

Thank you,

Dan Wheeler
Sr. Technologist | AMD
SW Display
------------------------------------------------------------------------------------------------------------------
1 Commerce Valley Dr E, Thornhill, ON L3T 7X6
amd.com

-----Original Message-----
From: Hung, Alex <[email protected]>
Sent: Thursday, November 20, 2025 1:03 PM
To: [email protected]
Cc: Wentland, Harry <[email protected]>; Li, Sun peng (Leo) <[email protected]>; Pillai, Aurabindo <[email protected]>; Li, Roman <[email protected]>; Lin, Wayne <[email protected]>; Chung, ChiaHsuan (Tom) <[email protected]>; Zuo, Jerry <[email protected]>; Wheeler, Daniel <[email protected]>; Wu, Ray <[email protected]>; LIPSKI, IVAN <[email protected]>; Hung, Alex <[email protected]>
Subject: [PATCH 00/26] DC Patches Nov 20, 2025

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

* Fixes on mouse cursor and some panels
* Improvement on brightness
* FPU and DML refactor
* Code cleanups and readability

Cc Dan Wheeler <[email protected]>

Alex Hung (1):
drm/amd/display: Check NULL before accessing

Ard Biesheuvel (1):
drm/amd/display: Permit DC_FP_START/END only in non-FP compilation
units

Derek Lai (1):
drm/amd/display: Write default Vesa Aux backlight control in dmub

Harry Wentland (4):
drm/amd/display: Rename dml2_wrapper.c to dml2_wrapper_fpu.c drm/amd/display: Move dml2_validate to the non-FPU dml2_wrapper drm/amd/display: Move dml2_create and init to the non-FPU dml2_wrapper drm/amd/display: Drop FPU flags from dml21_wrapper.c

Ivan Lipski (2):
drm/amd/display: Improve HDMI info retrieval drm/amd/display: Check ATOM_DEVICE_CRT2_SUPPORT in dc_load_detection

Jack Chang (6):
drm/amd/display: Refactor panel replay set dmub cmd flow drm/amd/display: Add AS-SDP v2 support for eDP feature drm/amd/display: Parse debug flag to PR FW drm/amd/display: Fix sending redundant enable command to dmub drm/amd/display: Revise VSC SDP header for Panel Replay drm/amd/display: Refactor panel replay dc libs

Mario Limonciello (AMD) (6):
drm/amd/display: Don't change brightness for disabled connectors drm/amd/display: Improve readability of link_detect_sink_signal_type drm/amd/display: Drop needless check for link->link_id.id drm/amd/display: Move CONNECTOR_ID_PCIE into switch/case drm/amd/display: Correct comment style
drm/amd/display: Increase EDID read retries

Nicholas Kazlauskas (1):
drm/amd/display: Add cursor offload abort to the new HWSS path

Ovidiu Bunea (1):
drm/amd/display: Add additional checks for PSP footer size

Relja Vojvodic (1):
drm/amd/display: Correct DSC padding accounting

Taimur Hassan (2):
drm/amd/display: [FW Promotion] Release 0.1.37.0 drm/amd/display: Promote DC to 3.2.360

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  66 +-  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |  10 +  .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c |  16 +-
 .../gpu/drm/amd/display/amdgpu_dm/dc_fpu.h    |   8 +
 .../gpu/drm/amd/display/dc/bios/bios_parser.c |   2 +-
 .../drm/amd/display/dc/core/dc_hw_sequencer.c |  24 +  .../drm/amd/display/dc/core/dc_link_exports.c |  22 +
 .../gpu/drm/amd/display/dc/core/dc_stream.c   |  11 +-
 drivers/gpu/drm/amd/display/dc/dc.h           |  45 +-
 .../gpu/drm/amd/display/dc/dml2_0/Makefile    |   8 +-
 .../drm/amd/display/dc/dml2_0/dml2_wrapper.c  | 599 +----------------
 .../drm/amd/display/dc/dml2_0/dml2_wrapper.h  |   9 +
 .../amd/display/dc/dml2_0/dml2_wrapper_fpu.c  | 604 ++++++++++++++++++  .../amd/display/dc/dml2_0/dml2_wrapper_fpu.h  |  25 +
 .../amd/display/dc/hwss/dcn314/dcn314_hwseq.c |   2 +-
 .../amd/display/dc/hwss/dcn32/dcn32_hwseq.c   |   2 +-
 .../amd/display/dc/hwss/dcn35/dcn35_hwseq.c   |   2 +-
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c |   2 +
 .../drm/amd/display/dc/hwss/hw_sequencer.h    |  13 +
 .../gpu/drm/amd/display/dc/inc/link_service.h |   4 +
 .../drm/amd/display/dc/link/link_detection.c  |  45 +-
 .../gpu/drm/amd/display/dc/link/link_dpms.c   |   7 +-
 .../drm/amd/display/dc/link/link_factory.c    |   4 +
 .../dc/link/protocols/link_dp_capability.c    |   2 +-
 .../link/protocols/link_edp_panel_control.c   | 177 ++++-
 .../link/protocols/link_edp_panel_control.h   |   7 +-
 drivers/gpu/drm/amd/display/dc/os_types.h     |   2 -
 .../dc/resource/dcn20/dcn20_resource.c        |   6 +-
 drivers/gpu/drm/amd/display/dmub/dmub_srv.h   |  33 +
 .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h   |   4 +-
 .../gpu/drm/amd/display/dmub/src/dmub_srv.c   |  57 +-
 .../amd/display/modules/inc/mod_info_packet.h |   6 +
 .../display/modules/info_packet/info_packet.c | 369 ++++++-----
 33 files changed, 1357 insertions(+), 836 deletions(-)  create mode 100644 drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper_fpu.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper_fpu.h

--
2.43.0