* [PATCH v2 00/30] DC Patches for Nov 30 2026
@ 2026-12-01 20:22 George Zhang
2026-12-01 20:22 ` [PATCH v2 01/30] drm/amd/display: cast clamped rate conversion George Zhang
` (29 more replies)
0 siblings, 30 replies; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, George Zhang
This version brings along the following updates:
- Harden AUX handling: clamp the AUX reply length as unsigned, keep the
DPCD read result signed in the MST ISR, and copy only the status byte
on a DMUB AUX write status retry, with a test for the reply copy
- Cast the clamped rate conversion
- Make BLS sequences compliant: split HWSS_CURSOR_LOCK into flat BLS
operations and make DPP_SET_INPUT_TRANSFER_FUNC BLS compliant
- Account for downspread and DFS in clock validation and read the max
LSDMA bandwidth from DMU
- Precompute EASF lookup thresholds
- Add pipe init to core2
- Fix HDMI FRL no_timeout behavior
- Re-enable driver-controlled HUBP/DPP power gating on DCN42 and DCN42b
- DC2: program DSC on one stream, program YCbCr output, flip every DPP
pipe of the stream, skip streams with no OTG master, and sync OTG
timing in the non-seamless commit
- DC2: add a per-ASIC default for DC2 selection and report BLS step
overflow behind a debug option
- Disable Replay and PSR across GPU reset and correctly block Panel
Replay on MST
- Cover gamma 2.4 and 2.6 on the wide curve
- Improve P-state admissibility logic and revoke alternate channel
P-State before pipe teardown
- Refactor Max VStartup calculations for DCN6
- Add VRR support on direct MST sinks
- Move shared dcn401 builder code to its own file
v2: Fixed the incorrect cover letter and added missing patches from v1
Charlene Liu (1):
drm/amd/display: enable dcn42b hubp/dpp pg control from driver side
Dillon Varone (2):
drm/amd/display: Refactor Max VStartup calculations for DCN6
drm/amd/display: Improve P-state admissability logic
Fangzhi Zuo (1):
drm/amd/display: VRR Support on Direct MST Sinks
Harry Wentland (1):
drm/amd/display: cover gamma 2.4 and 2.6 on the wide curve
Ilya Bakoulin (2):
drm/amd/display: Account for downspread and DFS in clock validation
drm/amd/display: Fix HDMI FRL no_timeout behavior
Ivan Lipski (2):
drm/amd/display: Read max LSDMA BW from DMU
drm/amd/display: Revoke alternate channel P-State before pipe teardown
James Lin (2):
drm/amd/display: cast clamped rate conversion
drm/amd/display: Allow disabling CRC capture when the stream is gone
Leo Chen (1):
drm/amd/display: Re-enable HUBP/DPP Driver PG on DCN42
Peichen Huang (1):
drm/amd/display: block pr in mst right
Piotr Maziarz (1):
drm/amd/display: Split HWSS_CURSOR_LOCK into flat BLS operations
Rafal Ostrowski (1):
drm/amd/display: Make DPP_SET_INPUT_TRANSFER_FUNC BLS compliant
Taimur Hassan (1):
drm/amd/display: Promote DC to 3.2.410
Tom Chung (4):
drm/amd/display: clamp AUX reply length as unsigned
drm/amd/display: keep the DPCD read result signed in the MST ISR
drm/amd/display: copy only the status byte on a DMUB AUX write status
retry
drm/amd/display: test the DMUB AUX write status reply copy
Tomasz Siemek (2):
drm/amd/display: Add pipe init to core2
drm/amd/display: Add a per-ASIC default for the DC2 selection
Tony Cheng (7):
drm/amd/display: Program DSC on one stream in DC2
drm/amd/display: Flip every DPP pipe of the stream in DC2
drm/amd/display: Report a DC2 BLS step overflow behind a debug option
drm/amd/display: Program YCbCr output in DC2
drm/amd/display: Skip a stream with no OTG master in DC2
drm/amd/display: Sync OTG timing in the DC2 non-seamless commit
drm/amd/display: Move shared dcn401 builder code to its own file
deguo (1):
drm/amd/display: Precompute EASF lookup thresholds
.../display/amdgpu_dm/amdgpu_dm_connector.c | 44 +-
.../drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c | 12 +-
.../amd/display/amdgpu_dm/amdgpu_dm_dmub.c | 8 +-
.../display/amdgpu_dm/amdgpu_dm_mst_types.c | 5 +-
.../tests/amdgpu_dm_connector_test.c | 130 ++
.../amdgpu_dm/tests/amdgpu_dm_crc_test.c | 4 +-
.../amdgpu_dm/tests/amdgpu_dm_dmub_test.c | 81 +
.../tests/amdgpu_dm_mst_types_test.c | 2 +
drivers/gpu/drm/amd/display/dc/Makefile | 1 +
.../amd/display/dc/bls_builder/bls_builder.c | 2 +-
.../amd/display/dc/bls_builder/bls_builder.h | 5 +
.../dc/bls_builder/bls_builder_internal.h | 3 +-
.../bls_builder/bls_builder_private_types.h | 9 +-
.../dc/bls_builder/dcn401_builder_internal.c | 1817 +++++++++++++++++
.../dc/bls_builder/dcn401_builder_internal.h | 8 +
.../dc/bls_builder/dcn401_init_builder.c | 16 +-
.../bls_builder/dcn401_init_builder_legacy.c | 2 +-
.../bls_builder/dcn401_non_seamless_builder.c | 125 +-
.../dc/bls_builder/dcn401_seamless_builder.c | 1755 +---------------
.../display/dc/bls_executor/bls_executor.c | 175 +-
.../display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c | 35 +-
.../drm/amd/display/dc/core/dc_hw_sequencer.c | 305 ++-
.../gpu/drm/amd/display/dc/core2/dc_core2.c | 45 +-
.../gpu/drm/amd/display/dc/core2/dc_core2.h | 8 +
.../drm/amd/display/dc/core2/dc_core2_init.c | 71 +-
drivers/gpu/drm/amd/display/dc/dc.h | 4 +-
.../amd/display/dc/dc_api_dispatch/api_shim.c | 30 +-
.../amd/display/dc/dc_api_dispatch/api_shim.h | 1 +
.../amd/display/dc/dcn10/dcn10_cm_common.c | 4 +-
.../amd/display/dc/dcn30/dcn30_cm_common.c | 2 +
.../dml2_0/dml21/src/dml2_cga/dml2_cga_dcn6.c | 43 +-
.../dml2_core_dcn5_funcs_mode_support.c | 11 +-
.../src/dml2_core/dml2_core_dcn6_calcs.h | 6 +-
.../dml2_core/dml2_core_dcn6_calcs_dchub.c | 19 +-
.../dml2_core/dml2_core_dcn6_calcs_dchub.h | 6 +-
.../dml2_core_dcn6_funcs_initialize.c | 3 +
.../dml2_core_dcn6_funcs_mode_support.c | 18 +-
.../src/dml2_core/dml2_core_shared_types.h | 1 +
.../dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c | 20 +-
.../src/inc/dml2_internal_shared_types.h | 2 +
.../display/dc/hubbub/dcn10/dcn10_hubbub.c | 1 +
.../display/dc/hubbub/dcn20/dcn20_hubbub.c | 1 +
.../display/dc/hubbub/dcn201/dcn201_hubbub.c | 1 +
.../display/dc/hubbub/dcn21/dcn21_hubbub.c | 1 +
.../display/dc/hubbub/dcn30/dcn30_hubbub.c | 3 +-
.../display/dc/hubbub/dcn301/dcn301_hubbub.c | 1 +
.../display/dc/hubbub/dcn31/dcn31_hubbub.c | 3 +-
.../display/dc/hubbub/dcn32/dcn32_hubbub.c | 3 +-
.../display/dc/hubbub/dcn35/dcn35_hubbub.c | 3 +-
.../display/dc/hubbub/dcn401/dcn401_hubbub.c | 3 +-
.../display/dc/hubbub/dcn42/dcn42_hubbub.c | 3 +-
.../display/dc/hubbub/dcn60/dcn60_hubbub.c | 1 +
.../amd/display/dc/hwss/dce110/dce110_hwseq.c | 19 +-
.../amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 133 +-
.../amd/display/dc/hwss/dcn10/dcn10_hwseq.h | 2 +
.../amd/display/dc/hwss/dcn10/dcn10_init.c | 1 +
.../amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 45 +-
.../amd/display/dc/hwss/dcn20/dcn20_hwseq.h | 5 +-
.../amd/display/dc/hwss/dcn20/dcn20_init.c | 1 +
.../amd/display/dc/hwss/dcn201/dcn201_init.c | 1 +
.../amd/display/dc/hwss/dcn21/dcn21_init.c | 1 +
.../amd/display/dc/hwss/dcn30/dcn30_hwseq.c | 32 +-
.../amd/display/dc/hwss/dcn30/dcn30_hwseq.h | 2 +-
.../amd/display/dc/hwss/dcn30/dcn30_init.c | 1 +
.../amd/display/dc/hwss/dcn301/dcn301_init.c | 1 +
.../amd/display/dc/hwss/dcn31/dcn31_init.c | 1 +
.../amd/display/dc/hwss/dcn314/dcn314_init.c | 1 +
.../amd/display/dc/hwss/dcn32/dcn32_hwseq.c | 102 +-
.../amd/display/dc/hwss/dcn32/dcn32_hwseq.h | 5 +-
.../amd/display/dc/hwss/dcn32/dcn32_init.c | 1 +
.../amd/display/dc/hwss/dcn35/dcn35_hwseq.c | 3 +-
.../amd/display/dc/hwss/dcn35/dcn35_init.c | 1 +
.../amd/display/dc/hwss/dcn351/dcn351_init.c | 1 +
.../amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 74 +-
.../amd/display/dc/hwss/dcn401/dcn401_hwseq.h | 5 +-
.../amd/display/dc/hwss/dcn401/dcn401_init.c | 3 +-
.../amd/display/dc/hwss/dcn42/dcn42_hwseq.c | 56 +-
.../amd/display/dc/hwss/dcn42/dcn42_hwseq.h | 13 +-
.../amd/display/dc/hwss/dcn42/dcn42_init.c | 1 +
.../amd/display/dc/hwss/dcn60/dcn60_hwseq.c | 33 +-
.../amd/display/dc/hwss/dcn60/dcn60_hwseq.h | 2 +-
.../amd/display/dc/hwss/dcn60/dcn60_init.c | 1 +
.../drm/amd/display/dc/hwss/hw_sequencer.h | 172 +-
.../display/dc/hwss/hw_sequencer_private.h | 22 +-
.../gpu/drm/amd/display/dc/inc/core_types.h | 2 -
.../amd/display/dc/inc/dc_core_interface.h | 14 +-
.../gpu/drm/amd/display/dc/inc/hw/dchubbub.h | 1 +
.../gpu/drm/amd/display/dc/inc/hw/hw_shared.h | 2 +
.../drm/amd/display/dc/link/link_dpms_v1.c | 1 +
.../dc/link/protocols/link_dp_panel_replay.c | 20 +-
.../display/dc/link/protocols/link_hdmi_frl.c | 25 +-
.../display/dc/link/protocols/link_hdmi_frl.h | 1 +
.../dc/resource/dcn42/dcn42_resource.c | 4 +-
.../dc/resource/dcn42b/dcn42b_resource.c | 4 +-
.../dcn60/dcn60_soc_and_ip_translator.c | 2 +
.../display/dc/sspl/dc_spl_scl_easf_filters.c | 478 ++---
.../display/dc/sspl/dc_spl_scl_easf_filters.h | 3 +-
.../workaround_manager/workaround_manager.c | 122 +-
.../amd/display/modules/freesync/freesync.c | 2 +-
99 files changed, 3748 insertions(+), 2536 deletions(-)
create mode 100644 drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_builder_internal.c
--
2.56.1
^ permalink raw reply [flat|nested] 42+ messages in thread
* [PATCH v2 01/30] drm/amd/display: cast clamped rate conversion
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 20:22 ` [PATCH v2 02/30] drm/amd/display: Split HWSS_CURSOR_LOCK into flat BLS operations George Zhang
` (28 subsequent siblings)
29 siblings, 0 replies; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, James Lin, George Zhang
From: James Lin <pinglei.lin@amd.com>
[Why]
vrr_refresh_hz_u8() returns an unsigned char, but the clamped
refresh rate is calculated as an unsigned int. The implicit
narrowing conversion can trigger compiler warnings.
[How]
Cast the result to unsigned char after clamping it to 255.
The cast makes the conversion explicit without changing the
value encoded in the FreeSync infopacket.
Cc: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: James Lin <pinglei.lin@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
index 21165855cb92..e918a186cf67 100644
--- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
+++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
@@ -574,7 +574,7 @@ static bool vrr_settings_require_update(struct core_freesync *core_freesync,
/* v1/v2 packets hold each rate in one byte; saturate instead of wrapping. */
static unsigned char vrr_refresh_hz_u8(unsigned int refresh_in_uhz)
{
- return min((refresh_in_uhz + 500000) / 1000000, 255U);
+ return (unsigned char)min((refresh_in_uhz + 500000) / 1000000, 255U);
}
static void build_vrr_infopacket_data_v1(const struct mod_vrr_params *vrr,
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 02/30] drm/amd/display: Split HWSS_CURSOR_LOCK into flat BLS operations
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
2026-12-01 20:22 ` [PATCH v2 01/30] drm/amd/display: cast clamped rate conversion George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 20:22 ` [PATCH v2 03/30] drm/amd/display: clamp AUX reply length as unsigned George Zhang
` (27 subsequent siblings)
29 siblings, 0 replies; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Piotr Maziarz, Alvin Lee,
George Zhang
From: Piotr Maziarz <piotr.maziarz@amd.com>
[WHY]
HWSS_CURSOR_LOCK carried dc and pipe_ctx, and its executor called
dc->hwss.cursor_lock(), which decided at run time between the VUPDATE
keepout delay, the DMUB inbox1 lock and the MPC cursor lock, against
the BLS contract.
[HOW]
Add hwss.build_cursor_lock_sequence, implemented by
dcn10_build_cursor_lock_sequence() and bound wherever dcn10_cursor_lock
is. It captures the VUPDATE window, stream timing and lock targets when
the sequence is built. hwss_add_cursor_lock() turns that into
TG_DELAY_CURSOR_UNTIL_VUPDATE (lock only), then DMUB_HW_LOCK_MGR_CMD or
MPC_CURSOR_LOCK. Without the builder (DCE), it emits the pipe control
lock that DCE binds as cursor_lock. dcn10_cursor_lock() runs the same
executors, and the fast sequence uses hwss_add_cursor_lock() instead of
hand-built steps. HWSS_CURSOR_LOCK is removed.
Cc: Alvin Lee <alvin.lee2@amd.com>
Signed-off-by: Piotr Maziarz <piotr.maziarz@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
.../drm/amd/display/dc/core/dc_hw_sequencer.c | 180 +++++++++++++-----
.../amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 118 ++++--------
.../amd/display/dc/hwss/dcn10/dcn10_hwseq.h | 2 +
.../amd/display/dc/hwss/dcn10/dcn10_init.c | 1 +
.../amd/display/dc/hwss/dcn20/dcn20_init.c | 1 +
.../amd/display/dc/hwss/dcn201/dcn201_init.c | 1 +
.../amd/display/dc/hwss/dcn21/dcn21_init.c | 1 +
.../amd/display/dc/hwss/dcn30/dcn30_init.c | 1 +
.../amd/display/dc/hwss/dcn301/dcn301_init.c | 1 +
.../amd/display/dc/hwss/dcn31/dcn31_init.c | 1 +
.../amd/display/dc/hwss/dcn314/dcn314_init.c | 1 +
.../amd/display/dc/hwss/dcn32/dcn32_init.c | 1 +
.../amd/display/dc/hwss/dcn35/dcn35_init.c | 1 +
.../amd/display/dc/hwss/dcn351/dcn351_init.c | 1 +
.../amd/display/dc/hwss/dcn401/dcn401_init.c | 1 +
.../amd/display/dc/hwss/dcn42/dcn42_init.c | 1 +
.../amd/display/dc/hwss/dcn60/dcn60_init.c | 1 +
.../drm/amd/display/dc/hwss/hw_sequencer.h | 56 +++++-
18 files changed, 236 insertions(+), 134 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c
index 0cd17e0a4b9f..583dcd8c8e2f 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c
@@ -1387,20 +1387,10 @@ void hwss_build_fast_sequence(struct dc *dc,
if (enable_cursor_offload && dc->hwss.begin_cursor_offload_update) {
hwss_add_begin_cursor_offload_update(&seq_state, dc, current_pipe);
} else {
- block_sequence[*num_steps].params.cursor_lock_params.dc = dc;
- block_sequence[*num_steps].params.cursor_lock_params.pipe_ctx = current_pipe;
- block_sequence[*num_steps].params.cursor_lock_params.lock = true;
- block_sequence[*num_steps].func = HWSS_CURSOR_LOCK;
- (*num_steps)++;
-
- if (current_pipe->next_odm_pipe) {
- block_sequence[*num_steps].params.cursor_lock_params.dc = dc;
- block_sequence[*num_steps].params.cursor_lock_params.pipe_ctx =
- current_pipe->next_odm_pipe;
- block_sequence[*num_steps].params.cursor_lock_params.lock = true;
- block_sequence[*num_steps].func = HWSS_CURSOR_LOCK;
- (*num_steps)++;
- }
+ hwss_add_cursor_lock(&seq_state, dc, current_pipe, true);
+ if (current_pipe->next_odm_pipe)
+ hwss_add_cursor_lock(&seq_state, dc,
+ current_pipe->next_odm_pipe, true);
}
}
@@ -1435,20 +1425,10 @@ void hwss_build_fast_sequence(struct dc *dc,
if (enable_cursor_offload && dc->hwss.commit_cursor_offload_update) {
hwss_add_commit_cursor_offload_update(&seq_state, dc, cursor_pipe_to_program);
} else {
- block_sequence[*num_steps].params.cursor_lock_params.dc = dc;
- block_sequence[*num_steps].params.cursor_lock_params.pipe_ctx = cursor_pipe_to_program;
- block_sequence[*num_steps].params.cursor_lock_params.lock = false;
- block_sequence[*num_steps].func = HWSS_CURSOR_LOCK;
- (*num_steps)++;
-
- if (cursor_pipe_to_program->next_odm_pipe) {
- block_sequence[*num_steps].params.cursor_lock_params.dc = dc;
- block_sequence[*num_steps].params.cursor_lock_params.pipe_ctx =
- cursor_pipe_to_program->next_odm_pipe;
- block_sequence[*num_steps].params.cursor_lock_params.lock = false;
- block_sequence[*num_steps].func = HWSS_CURSOR_LOCK;
- (*num_steps)++;
- }
+ hwss_add_cursor_lock(&seq_state, dc, cursor_pipe_to_program, false);
+ if (cursor_pipe_to_program->next_odm_pipe)
+ hwss_add_cursor_lock(&seq_state, dc,
+ cursor_pipe_to_program->next_odm_pipe, false);
}
}
}
@@ -1477,11 +1457,7 @@ void hwss_build_fast_sequence(struct dc *dc,
if (enable_cursor_offload && dc->hwss.begin_cursor_offload_update) {
hwss_add_begin_cursor_offload_update(&seq_state, dc, current_pipe);
} else {
- block_sequence[*num_steps].params.cursor_lock_params.dc = dc;
- block_sequence[*num_steps].params.cursor_lock_params.pipe_ctx = current_pipe;
- block_sequence[*num_steps].params.cursor_lock_params.lock = true;
- block_sequence[*num_steps].func = HWSS_CURSOR_LOCK;
- (*num_steps)++;
+ hwss_add_cursor_lock(&seq_state, dc, current_pipe, true);
}
}
@@ -1510,11 +1486,7 @@ void hwss_build_fast_sequence(struct dc *dc,
if (enable_cursor_offload && dc->hwss.commit_cursor_offload_update) {
hwss_add_commit_cursor_offload_update(&seq_state, dc, cursor_pipe_to_program);
} else {
- block_sequence[*num_steps].params.cursor_lock_params.dc = dc;
- block_sequence[*num_steps].params.cursor_lock_params.pipe_ctx = cursor_pipe_to_program;
- block_sequence[*num_steps].params.cursor_lock_params.lock = false;
- block_sequence[*num_steps].func = HWSS_CURSOR_LOCK;
- (*num_steps)++;
+ hwss_add_cursor_lock(&seq_state, dc, cursor_pipe_to_program, false);
}
}
}
@@ -2152,9 +2124,6 @@ void hwss_execute_sequence(struct dc *dc,
case HUBP_MEM_PROGRAM_VIEWPORT:
hwss_hubp_mem_program_viewport(params);
break;
- case HWSS_CURSOR_LOCK:
- hwss_cursor_lock(params);
- break;
case HWSS_BEGIN_CURSOR_OFFLOAD_UPDATE:
hwss_begin_cursor_offload_update(dc, params);
break;
@@ -2266,6 +2235,15 @@ void hwss_execute_sequence(struct dc *dc,
case DMUB_FAMS2_UPDATE_CONFIG:
hwss_dmub_fams2_update_config(params);
break;
+ case TG_DELAY_CURSOR_UNTIL_VUPDATE:
+ hwss_tg_delay_cursor_until_vupdate(params);
+ break;
+ case MPC_CURSOR_LOCK:
+ hwss_mpc_cursor_lock(params);
+ break;
+ case DMUB_HW_LOCK_MGR_CMD:
+ hwss_dmub_hw_lock_mgr_cmd(params);
+ break;
default:
ASSERT(false);
break;
@@ -4554,14 +4532,72 @@ void hwss_hubp_mem_program_viewport(union block_sequence_params *params)
hubp->funcs->mem_program_viewport(hubp, viewport, viewport_c);
}
-void hwss_cursor_lock(union block_sequence_params *params)
+/**
+ * hwss_tg_delay_cursor_until_vupdate() - Delay cursor update if too close to VUPDATE.
+ *
+ * Software keepout workaround to prevent cursor update locking from stalling
+ * out cursor updates indefinitely or from old values from being retained in
+ * the case where the viewport changes in the same frame as the cursor.
+ *
+ * The idea is to calculate the remaining time from VPOS to VUPDATE. If it's
+ * too close to VUPDATE, then stall out until VUPDATE finishes.
+ *
+ * TODO: Optimize cursor programming to be once per frame before VUPDATE
+ * to avoid the need for this workaround.
+ *
+ * @params: TG, stream timing and VUPDATE window captured when building
+ */
+void hwss_tg_delay_cursor_until_vupdate(union block_sequence_params *params)
{
- struct dc *dc = params->cursor_lock_params.dc;
- struct pipe_ctx *pipe_ctx = params->cursor_lock_params.pipe_ctx;
- bool lock = params->cursor_lock_params.lock;
+ const struct tg_delay_cursor_until_vupdate_params *p =
+ ¶ms->tg_delay_cursor_until_vupdate_params;
+ struct crtc_position position;
+ uint32_t vupdate_end = p->vupdate_end;
+ unsigned int lines_to_vupdate, us_to_vupdate, vpos;
+ unsigned int us_per_line, us_vupdate;
+
+ p->tg->funcs->get_position(p->tg, &position);
+ vpos = position.vertical_count;
- if (dc && dc->hwss.cursor_lock)
- dc->hwss.cursor_lock(dc, pipe_ctx, lock);
+ if (vpos <= p->vupdate_start) {
+ /* VPOS is in VACTIVE or back porch. */
+ lines_to_vupdate = p->vupdate_start - vpos;
+ } else {
+ lines_to_vupdate = p->v_total - vpos + p->vupdate_start;
+ }
+
+ /* Calculate time until VUPDATE in microseconds. */
+ us_per_line = p->h_total * 10000u / p->pix_clk_100hz;
+ us_to_vupdate = lines_to_vupdate * us_per_line;
+
+ /* Stall out until the cursor update completes. */
+ if (vupdate_end < p->vupdate_start)
+ vupdate_end += p->v_total;
+
+ /* Position is in the range of vupdate start and end*/
+ if (lines_to_vupdate > p->v_total - vupdate_end + p->vupdate_start)
+ us_to_vupdate = 0;
+
+ /* 70 us is a conservative estimate of cursor update time*/
+ if (us_to_vupdate > 70)
+ return;
+
+ us_vupdate = (vupdate_end - p->vupdate_start + 1) * us_per_line;
+ udelay(us_to_vupdate + us_vupdate);
+}
+
+void hwss_mpc_cursor_lock(union block_sequence_params *params)
+{
+ struct mpc_cursor_lock_params *p = ¶ms->mpc_cursor_lock_params;
+
+ p->mpc->funcs->cursor_lock(p->mpc, p->opp_inst, p->lock);
+}
+
+void hwss_dmub_hw_lock_mgr_cmd(union block_sequence_params *params)
+{
+ struct dmub_hw_lock_mgr_cmd_params *p = ¶ms->dmub_hw_lock_mgr_cmd_params;
+
+ dmub_hw_lock_mgr_cmd(p->dmub_srv, p->lock, &p->hw_locks, &p->inst_flags);
}
void hwss_begin_cursor_offload_update(struct dc *dc, union block_sequence_params *params)
@@ -6389,15 +6425,57 @@ void hwss_add_cursor_lock(struct block_sequence_state *seq_state,
struct pipe_ctx *pipe_ctx,
bool lock)
{
+ struct cursor_lock_sequence_params params = { 0 };
+
/* cursor lock is per MPCC tree, so only need to lock one pipe per stream */
if (!pipe_ctx || pipe_ctx->top_pipe)
return;
+ if (!dc->hwss.build_cursor_lock_sequence) {
+ /* DCE binds cursor_lock to hwss_pipe_control_lock. */
+ if (dc->hwss.cursor_lock)
+ hwss_add_optc_pipe_control_lock(seq_state, dc, pipe_ctx, lock);
+ return;
+ }
+
+ if (!dc->hwss.build_cursor_lock_sequence(dc, pipe_ctx, lock, ¶ms))
+ return;
+
+ if (params.delay_until_vupdate)
+ hwss_add_tg_delay_cursor_until_vupdate(seq_state, ¶ms.delay);
+
+ if (params.use_dmub_inbox1)
+ hwss_add_dmub_hw_lock_mgr_cmd(seq_state, ¶ms.dmub_lock);
+ else
+ hwss_add_mpc_cursor_lock(seq_state, ¶ms.mpc_lock);
+}
+
+void hwss_add_tg_delay_cursor_until_vupdate(struct block_sequence_state *seq_state,
+ const struct tg_delay_cursor_until_vupdate_params *params)
+{
+ if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
+ seq_state->steps[*seq_state->num_steps].func = TG_DELAY_CURSOR_UNTIL_VUPDATE;
+ seq_state->steps[*seq_state->num_steps].params.tg_delay_cursor_until_vupdate_params = *params;
+ (*seq_state->num_steps)++;
+ }
+}
+
+void hwss_add_mpc_cursor_lock(struct block_sequence_state *seq_state,
+ const struct mpc_cursor_lock_params *params)
+{
+ if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
+ seq_state->steps[*seq_state->num_steps].func = MPC_CURSOR_LOCK;
+ seq_state->steps[*seq_state->num_steps].params.mpc_cursor_lock_params = *params;
+ (*seq_state->num_steps)++;
+ }
+}
+
+void hwss_add_dmub_hw_lock_mgr_cmd(struct block_sequence_state *seq_state,
+ const struct dmub_hw_lock_mgr_cmd_params *params)
+{
if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
- seq_state->steps[*seq_state->num_steps].func = HWSS_CURSOR_LOCK;
- seq_state->steps[*seq_state->num_steps].params.cursor_lock_params.dc = dc;
- seq_state->steps[*seq_state->num_steps].params.cursor_lock_params.pipe_ctx = pipe_ctx;
- seq_state->steps[*seq_state->num_steps].params.cursor_lock_params.lock = lock;
+ seq_state->steps[*seq_state->num_steps].func = DMUB_HW_LOCK_MGR_CMD;
+ seq_state->steps[*seq_state->num_steps].params.dmub_hw_lock_mgr_cmd_params = *params;
(*seq_state->num_steps)++;
}
}
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c
index 08fff8d42cbd..5ce73286f8f2 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c
@@ -2251,96 +2251,60 @@ void dcn10_tg_lock(struct tg_lock_params *params)
hws->funcs.verify_allow_pstate_change_high(params->dc);
}
-/**
- * delay_cursor_until_vupdate() - Delay cursor update if too close to VUPDATE.
- *
- * Software keepout workaround to prevent cursor update locking from stalling
- * out cursor updates indefinitely or from old values from being retained in
- * the case where the viewport changes in the same frame as the cursor.
- *
- * The idea is to calculate the remaining time from VPOS to VUPDATE. If it's
- * too close to VUPDATE, then stall out until VUPDATE finishes.
- *
- * TODO: Optimize cursor programming to be once per frame before VUPDATE
- * to avoid the need for this workaround.
- *
- * @dc: Current DC state
- * @pipe_ctx: Pipe_ctx pointer for delayed cursor update
- *
- * Return: void
- */
-static void delay_cursor_until_vupdate(struct dc *dc, struct pipe_ctx *pipe_ctx)
+bool dcn10_build_cursor_lock_sequence(struct dc *dc, struct pipe_ctx *pipe, bool lock,
+ struct cursor_lock_sequence_params *params)
{
- struct dc_stream_state *stream = pipe_ctx->stream;
- struct crtc_position position;
- uint32_t vupdate_start, vupdate_end;
- unsigned int lines_to_vupdate, us_to_vupdate, vpos;
- unsigned int us_per_line, us_vupdate;
-
- if (!dc->hwss.calc_vupdate_position || !dc->hwss.get_position)
- return;
-
- if (!pipe_ctx->stream_res.stream_enc || !pipe_ctx->stream_res.tg)
- return;
-
- dc->hwss.calc_vupdate_position(dc, pipe_ctx, &vupdate_start,
- &vupdate_end);
+ /* cursor lock is per MPCC tree, so only need to lock one pipe per stream */
+ if (!pipe || pipe->top_pipe)
+ return false;
- dc->hwss.get_position(&pipe_ctx, 1, &position);
- vpos = position.vertical_count;
+ /* Prevent cursor lock from stalling out cursor updates. */
+ if (lock && dc->hwss.calc_vupdate_position && dc->hwss.get_position &&
+ pipe->stream_res.stream_enc && pipe->stream_res.tg) {
+ params->delay_until_vupdate = true;
+ params->delay.tg = pipe->stream_res.tg;
+ params->delay.h_total = pipe->stream->timing.h_total;
+ params->delay.v_total = pipe->stream->timing.v_total;
+ params->delay.pix_clk_100hz = pipe->stream->timing.pix_clk_100hz;
+ dc->hwss.calc_vupdate_position(dc, pipe, ¶ms->delay.vupdate_start,
+ ¶ms->delay.vupdate_end);
+ }
- if (vpos <= vupdate_start) {
- /* VPOS is in VACTIVE or back porch. */
- lines_to_vupdate = vupdate_start - vpos;
+ if (pipe->stream && should_use_dmub_inbox1_lock(dc, pipe->stream->link)) {
+ params->use_dmub_inbox1 = true;
+ params->dmub_lock.dmub_srv = dc->ctx->dmub_srv;
+ params->dmub_lock.lock = lock;
+ params->dmub_lock.hw_locks.bits.lock_cursor = 1;
+ params->dmub_lock.inst_flags.opp_inst = (uint8_t)pipe->stream_res.opp->inst;
} else {
- lines_to_vupdate = stream->timing.v_total - vpos + vupdate_start;
+ params->mpc_lock.mpc = dc->res_pool->mpc;
+ params->mpc_lock.opp_inst = pipe->stream_res.opp->inst;
+ params->mpc_lock.lock = lock;
}
- /* Calculate time until VUPDATE in microseconds. */
- us_per_line =
- stream->timing.h_total * 10000u / stream->timing.pix_clk_100hz;
- us_to_vupdate = lines_to_vupdate * us_per_line;
-
- /* Stall out until the cursor update completes. */
- if (vupdate_end < vupdate_start)
- vupdate_end += stream->timing.v_total;
-
- /* Position is in the range of vupdate start and end*/
- if (lines_to_vupdate > stream->timing.v_total - vupdate_end + vupdate_start)
- us_to_vupdate = 0;
-
- /* 70 us is a conservative estimate of cursor update time*/
- if (us_to_vupdate > 70)
- return;
-
- us_vupdate = (vupdate_end - vupdate_start + 1) * us_per_line;
- udelay(us_to_vupdate + us_vupdate);
+ return true;
}
void dcn10_cursor_lock(struct dc *dc, struct pipe_ctx *pipe, bool lock)
{
- /* cursor lock is per MPCC tree, so only need to lock one pipe per stream */
- if (!pipe || pipe->top_pipe)
- return;
-
- /* Prevent cursor lock from stalling out cursor updates. */
- if (lock)
- delay_cursor_until_vupdate(dc, pipe);
+ struct cursor_lock_sequence_params sequence = { 0 };
+ union block_sequence_params params;
- if (pipe->stream && should_use_dmub_inbox1_lock(dc, pipe->stream->link)) {
- union dmub_hw_lock_flags hw_locks = { 0 };
- struct dmub_hw_lock_inst_flags inst_flags = { 0 };
+ if (!dcn10_build_cursor_lock_sequence(dc, pipe, lock, &sequence))
+ return;
- hw_locks.bits.lock_cursor = 1;
- inst_flags.opp_inst = (uint8_t)pipe->stream_res.opp->inst;
+ if (sequence.delay_until_vupdate) {
+ params.tg_delay_cursor_until_vupdate_params = sequence.delay;
+ hwss_tg_delay_cursor_until_vupdate(¶ms);
+ }
- dmub_hw_lock_mgr_cmd(dc->ctx->dmub_srv,
- lock,
- &hw_locks,
- &inst_flags);
- } else
- dc->res_pool->mpc->funcs->cursor_lock(dc->res_pool->mpc,
- pipe->stream_res.opp->inst, lock);
+ if (sequence.use_dmub_inbox1) {
+ params.dmub_hw_lock_mgr_cmd_params = sequence.dmub_lock;
+ hwss_dmub_hw_lock_mgr_cmd(¶ms);
+ } else {
+ params.mpc_cursor_lock_params = sequence.mpc_lock;
+ hwss_mpc_cursor_lock(¶ms);
+ }
}
static bool wait_for_reset_trigger_to_occur(
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.h b/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.h
index c62a32115e11..e62d7b38166a 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.h
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.h
@@ -58,6 +58,8 @@ void dcn10_set_wait_for_update_needed_for_pipe(
struct dc *dc,
struct pipe_ctx *pipe_ctx);
void dcn10_tg_lock(struct tg_lock_params *params);
+bool dcn10_build_cursor_lock_sequence(struct dc *dc, struct pipe_ctx *pipe, bool lock,
+ struct cursor_lock_sequence_params *params);
void dcn10_cursor_lock(struct dc *dc, struct pipe_ctx *pipe, bool lock);
void dcn10_blank_pixel_data(
struct dc *dc,
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_init.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_init.c
index bc3ac96de688..58cca5facdec 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_init.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_init.c
@@ -57,6 +57,7 @@ static const struct hw_sequencer_funcs dcn10_funcs = {
.disable_audio_stream = dce110_disable_audio_stream,
.disable_plane = dcn10_disable_plane,
.build_pipe_control_lock_sequence = dce_build_pipe_control_lock_sequence,
+ .build_cursor_lock_sequence = dcn10_build_cursor_lock_sequence,
.tg_lock = dcn10_tg_lock,
.cursor_lock = dcn10_cursor_lock,
.interdependent_update_lock = dcn10_lock_all_pipes,
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_init.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_init.c
index 789bde439192..660ffe71060b 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_init.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_init.c
@@ -58,6 +58,7 @@ static const struct hw_sequencer_funcs dcn20_funcs = {
.disable_audio_stream = dce110_disable_audio_stream,
.disable_plane = dcn20_disable_plane,
.build_pipe_control_lock_sequence = dcn20_build_pipe_control_lock_sequence,
+ .build_cursor_lock_sequence = dcn10_build_cursor_lock_sequence,
.tg_lock = dcn20_tg_lock,
.interdependent_update_lock = dcn10_lock_all_pipes,
.cursor_lock = dcn10_cursor_lock,
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn201/dcn201_init.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn201/dcn201_init.c
index 33c22d9bbd2e..f8bf32dba39e 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn201/dcn201_init.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn201/dcn201_init.c
@@ -58,6 +58,7 @@ static const struct hw_sequencer_funcs dcn201_funcs = {
.disable_audio_stream = dce110_disable_audio_stream,
.disable_plane = dcn10_disable_plane,
.build_pipe_control_lock_sequence = dce_build_pipe_control_lock_sequence,
+ .build_cursor_lock_sequence = dcn10_build_cursor_lock_sequence,
.tg_lock = dcn201_tg_lock,
.interdependent_update_lock = dcn10_lock_all_pipes,
.cursor_lock = dcn10_cursor_lock,
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_init.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_init.c
index 39bf0e51ec7c..85947c59c249 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_init.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_init.c
@@ -58,6 +58,7 @@ static const struct hw_sequencer_funcs dcn21_funcs = {
.disable_audio_stream = dce110_disable_audio_stream,
.disable_plane = dcn20_disable_plane,
.build_pipe_control_lock_sequence = dcn20_build_pipe_control_lock_sequence,
+ .build_cursor_lock_sequence = dcn10_build_cursor_lock_sequence,
.tg_lock = dcn20_tg_lock,
.interdependent_update_lock = dcn10_lock_all_pipes,
.cursor_lock = dcn10_cursor_lock,
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_init.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_init.c
index ce42b8216f3b..2e3937750a29 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_init.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_init.c
@@ -59,6 +59,7 @@ static const struct hw_sequencer_funcs dcn30_funcs = {
.disable_plane = dcn20_disable_plane,
.disable_pixel_data = dcn20_disable_pixel_data,
.build_pipe_control_lock_sequence = dcn20_build_pipe_control_lock_sequence,
+ .build_cursor_lock_sequence = dcn10_build_cursor_lock_sequence,
.tg_lock = dcn20_tg_lock,
.interdependent_update_lock = dcn10_lock_all_pipes,
.cursor_lock = dcn10_cursor_lock,
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn301/dcn301_init.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn301/dcn301_init.c
index 5ed4305e4663..11109c29782f 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn301/dcn301_init.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn301/dcn301_init.c
@@ -60,6 +60,7 @@ static const struct hw_sequencer_funcs dcn301_funcs = {
.disable_audio_stream = dce110_disable_audio_stream,
.disable_plane = dcn20_disable_plane,
.build_pipe_control_lock_sequence = dcn20_build_pipe_control_lock_sequence,
+ .build_cursor_lock_sequence = dcn10_build_cursor_lock_sequence,
.tg_lock = dcn20_tg_lock,
.interdependent_update_lock = dcn10_lock_all_pipes,
.cursor_lock = dcn10_cursor_lock,
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_init.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_init.c
index c7055312cc3d..55c61abc0ef8 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_init.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_init.c
@@ -62,6 +62,7 @@ static const struct hw_sequencer_funcs dcn31_funcs = {
.disable_plane = dcn20_disable_plane,
.disable_pixel_data = dcn20_disable_pixel_data,
.build_pipe_control_lock_sequence = dcn20_build_pipe_control_lock_sequence,
+ .build_cursor_lock_sequence = dcn10_build_cursor_lock_sequence,
.tg_lock = dcn20_tg_lock,
.interdependent_update_lock = dcn10_lock_all_pipes,
.cursor_lock = dcn10_cursor_lock,
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_init.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_init.c
index 69b020e2c4b2..ff2a4c1a6050 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_init.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_init.c
@@ -64,6 +64,7 @@ static const struct hw_sequencer_funcs dcn314_funcs = {
.disable_plane = dcn20_disable_plane,
.disable_pixel_data = dcn20_disable_pixel_data,
.build_pipe_control_lock_sequence = dcn20_build_pipe_control_lock_sequence,
+ .build_cursor_lock_sequence = dcn10_build_cursor_lock_sequence,
.tg_lock = dcn20_tg_lock,
.interdependent_update_lock = dcn10_lock_all_pipes,
.cursor_lock = dcn10_cursor_lock,
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_init.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_init.c
index b755df909871..aea2875d8fb7 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_init.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_init.c
@@ -62,6 +62,7 @@ static const struct hw_sequencer_funcs dcn32_funcs = {
.disable_plane = dcn20_disable_plane,
.disable_pixel_data = dcn20_disable_pixel_data,
.build_pipe_control_lock_sequence = dcn20_build_pipe_control_lock_sequence,
+ .build_cursor_lock_sequence = dcn10_build_cursor_lock_sequence,
.tg_lock = dcn20_tg_lock,
.interdependent_update_lock = dcn32_interdependent_update_lock,
.cursor_lock = dcn10_cursor_lock,
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_init.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_init.c
index 2119a8e000e9..8795b1a3e6c5 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_init.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_init.c
@@ -66,6 +66,7 @@ static const struct hw_sequencer_funcs dcn35_funcs = {
.disable_plane = dcn35_disable_plane,
.disable_pixel_data = dcn20_disable_pixel_data,
.build_pipe_control_lock_sequence = dcn20_build_pipe_control_lock_sequence,
+ .build_cursor_lock_sequence = dcn10_build_cursor_lock_sequence,
.tg_lock = dcn20_tg_lock,
.interdependent_update_lock = dcn10_lock_all_pipes,
.cursor_lock = dcn10_cursor_lock,
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn351/dcn351_init.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn351/dcn351_init.c
index 0e148c6e5c50..29bd9de00d4e 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn351/dcn351_init.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn351/dcn351_init.c
@@ -65,6 +65,7 @@ static const struct hw_sequencer_funcs dcn351_funcs = {
.disable_plane = dcn35_disable_plane,
.disable_pixel_data = dcn20_disable_pixel_data,
.build_pipe_control_lock_sequence = dcn20_build_pipe_control_lock_sequence,
+ .build_cursor_lock_sequence = dcn10_build_cursor_lock_sequence,
.tg_lock = dcn20_tg_lock,
.interdependent_update_lock = dcn10_lock_all_pipes,
.cursor_lock = dcn10_cursor_lock,
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_init.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_init.c
index 09737dddce3e..53d6fab1f400 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_init.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_init.c
@@ -42,6 +42,7 @@ static const struct hw_sequencer_funcs dcn401_funcs = {
.disable_plane = dcn20_disable_plane,
.disable_plane_sequence = dcn401_disable_plane_sequence,
.build_pipe_control_lock_sequence = dcn20_build_pipe_control_lock_sequence,
+ .build_cursor_lock_sequence = dcn10_build_cursor_lock_sequence,
.tg_lock = dcn20_tg_lock,
.interdependent_update_lock = dcn401_interdependent_update_lock,
.cursor_lock = dcn10_cursor_lock,
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_init.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_init.c
index 00fcb2559247..1894a4f57a75 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_init.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_init.c
@@ -44,6 +44,7 @@ static const struct hw_sequencer_funcs dcn42_funcs = {
.disable_audio_stream = dce110_disable_audio_stream,
.disable_plane = dcn35_disable_plane,
.build_pipe_control_lock_sequence = dcn20_build_pipe_control_lock_sequence,
+ .build_cursor_lock_sequence = dcn10_build_cursor_lock_sequence,
.tg_lock = dcn20_tg_lock,
.interdependent_update_lock = dcn401_interdependent_update_lock,
.cursor_lock = dcn10_cursor_lock,
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_init.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_init.c
index d5c8dcc86a9f..649c8ea5150c 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_init.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_init.c
@@ -44,6 +44,7 @@ static const struct hw_sequencer_funcs dcn60_funcs = {
.disable_plane = dcn20_disable_plane,
.disable_plane_sequence = dcn401_disable_plane_sequence,
.build_pipe_control_lock_sequence = dcn20_build_pipe_control_lock_sequence,
+ .build_cursor_lock_sequence = dcn10_build_cursor_lock_sequence,
.tg_lock = dcn20_tg_lock,
.interdependent_update_lock = dcn401_interdependent_update_lock,
.cursor_lock = dcn10_cursor_lock,
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
index da795c6501f5..dac709188891 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
+++ b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
@@ -1154,10 +1154,34 @@ struct hubp_mem_program_viewport_params {
const struct rect *viewport_c;
};
-struct cursor_lock_params {
- struct dc *dc;
- struct pipe_ctx *pipe_ctx;
+struct tg_delay_cursor_until_vupdate_params {
+ struct timing_generator *tg;
+ uint32_t h_total;
+ uint32_t v_total;
+ uint32_t pix_clk_100hz;
+ uint32_t vupdate_start;
+ uint32_t vupdate_end;
+};
+
+struct mpc_cursor_lock_params {
+ struct mpc *mpc;
+ int opp_inst;
+ bool lock;
+};
+
+struct dmub_hw_lock_mgr_cmd_params {
+ struct dc_dmub_srv *dmub_srv;
bool lock;
+ union dmub_hw_lock_flags hw_locks;
+ struct dmub_hw_lock_inst_flags inst_flags;
+};
+
+struct cursor_lock_sequence_params {
+ bool delay_until_vupdate;
+ struct tg_delay_cursor_until_vupdate_params delay;
+ bool use_dmub_inbox1;
+ struct dmub_hw_lock_mgr_cmd_params dmub_lock;
+ struct mpc_cursor_lock_params mpc_lock;
};
struct setup_periodic_interrupt_params {
@@ -1536,7 +1560,9 @@ union block_sequence_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 cursor_lock_params cursor_lock_params;
+ struct tg_delay_cursor_until_vupdate_params tg_delay_cursor_until_vupdate_params;
+ struct mpc_cursor_lock_params mpc_cursor_lock_params;
+ struct dmub_hw_lock_mgr_cmd_params dmub_hw_lock_mgr_cmd_params;
struct setup_periodic_interrupt_params setup_periodic_interrupt_params;
struct send_cursor_info_to_dmu_params send_cursor_info_to_dmu_params;
struct set_cursor_attribute_params set_cursor_attribute_params;
@@ -1774,7 +1800,6 @@ enum block_sequence_func {
DPP_SET_SCALER,
HUBP_MEM_PROGRAM_VIEWPORT,
ABORT_CURSOR_OFFLOAD_UPDATE,
- HWSS_CURSOR_LOCK,
HWSS_BEGIN_CURSOR_OFFLOAD_UPDATE,
HWSS_COMMIT_CURSOR_OFFLOAD_UPDATE,
HWSS_UPDATE_CURSOR_OFFLOAD_PIPE,
@@ -1903,6 +1928,9 @@ enum block_sequence_func {
PMFW_SEND_MESSAGE_AND_WAIT,
DMUB_SEND_DMCUB_CMD2,
PANEL_CNTL_STORE_BACKLIGHT_LEVEL,
+ TG_DELAY_CURSOR_UNTIL_VUPDATE,
+ MPC_CURSOR_LOCK,
+ DMUB_HW_LOCK_MGR_CMD,
/* This must be the last value in this enum, add new ones above */
HWSS_BLOCK_SEQUENCE_FUNC_COUNT
};
@@ -1973,6 +2001,9 @@ struct hw_sequencer_funcs {
bool (*build_pipe_control_lock_sequence)(struct dc *dc,
struct pipe_ctx *pipe, bool lock,
struct pipe_control_lock_params *params);
+ bool (*build_cursor_lock_sequence)(struct dc *dc,
+ struct pipe_ctx *pipe, bool lock,
+ struct cursor_lock_sequence_params *params);
void (*tg_lock)(struct tg_lock_params *params);
void (*interdependent_update_lock)(struct dc *dc,
struct dc_state *context, bool lock);
@@ -2682,7 +2713,11 @@ void hwss_hubp_set_blank(union block_sequence_params *params);
void hwss_phantom_hubp_post_enable(union block_sequence_params *params);
-void hwss_cursor_lock(union block_sequence_params *params);
+void hwss_tg_delay_cursor_until_vupdate(union block_sequence_params *params);
+
+void hwss_mpc_cursor_lock(union block_sequence_params *params);
+
+void hwss_dmub_hw_lock_mgr_cmd(union block_sequence_params *params);
void hwss_begin_cursor_offload_update(struct dc *dc, union block_sequence_params *params);
@@ -3238,6 +3273,15 @@ void hwss_add_cursor_lock(struct block_sequence_state *seq_state,
struct pipe_ctx *pipe_ctx,
bool lock);
+void hwss_add_tg_delay_cursor_until_vupdate(struct block_sequence_state *seq_state,
+ const struct tg_delay_cursor_until_vupdate_params *params);
+
+void hwss_add_mpc_cursor_lock(struct block_sequence_state *seq_state,
+ const struct mpc_cursor_lock_params *params);
+
+void hwss_add_dmub_hw_lock_mgr_cmd(struct block_sequence_state *seq_state,
+ const struct dmub_hw_lock_mgr_cmd_params *params);
+
void hwss_add_send_update_cursor_info_to_dmu(struct block_sequence_state *seq_state,
struct pipe_ctx *pipe_ctx);
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 03/30] drm/amd/display: clamp AUX reply length as unsigned
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
2026-12-01 20:22 ` [PATCH v2 01/30] drm/amd/display: cast clamped rate conversion George Zhang
2026-12-01 20:22 ` [PATCH v2 02/30] drm/amd/display: Split HWSS_CURSOR_LOCK into flat BLS operations George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 20:22 ` [PATCH v2 04/30] drm/amd/display: keep the DPCD read result signed in the MST ISR George Zhang
` (26 subsequent siblings)
29 siblings, 0 replies; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Ray Wu, George Zhang
From: Tom Chung <chiahsuan.chung@amd.com>
[why]
min_t(int, ret, payload->length) casts the uint32_t payload->length to
int, so a length above INT_MAX would turn negative, win the comparison
and reach memcpy() as a huge size_t. No caller can produce such a
length today, so this is a defensive change.
[how]
Compare as uint32_t. ret is already clamped to [1, 16] above, so the
result is unchanged for every real length.
Found by CodeQL (CERT-C INT31-C).
Cc: Ray Wu <ray.wu@amd.com>
Signed-off-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c
index 024c2395d2c2..bc430116f068 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c
@@ -929,7 +929,7 @@ int amdgpu_dm_process_dmub_aux_transfer_sync(
* so only clamp to payload->length for regular transfers.
*/
if (!payload->write_status_update)
- ret = min_t(int, ret, payload->length);
+ ret = min_t(uint32_t, ret, payload->length);
memcpy(payload->data, p_notify->aux_reply.data, ret);
} else {
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 04/30] drm/amd/display: keep the DPCD read result signed in the MST ISR
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (2 preceding siblings ...)
2026-12-01 20:22 ` [PATCH v2 03/30] drm/amd/display: clamp AUX reply length as unsigned George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 20:22 ` [PATCH v2 05/30] drm/amd/display: copy only the status byte on a DMUB AUX write status retry George Zhang
` (25 subsequent siblings)
29 siblings, 0 replies; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Ray Wu, George Zhang
From: Tom Chung <chiahsuan.chung@amd.com>
[why]
dm_handle_mst_sideband_msg_ready_event() stores the ssize_t return of
drm_dp_dpcd_read() in a uint8_t, so -errno becomes 256 - errno. No
errno happens to equal the expected 2 or 4 bytes, so the loop still
breaks on error, but the type is wrong; the matching write result a
few lines below is already ssize_t.
[how]
Declare dret as ssize_t so a negative return compares unequal with
dpcd_bytes_to_read.
Found by CodeQL (CERT-C INT31-C).
Cc: Ray Wu <ray.wu@amd.com>
Signed-off-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index 5697645ef7cc..68b53cd3c15f 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -789,7 +789,7 @@ void dm_handle_mst_sideband_msg_ready_event(
enum mst_msg_ready_type msg_rdy_type)
{
uint8_t esi[DP_PSR_ERROR_STATUS - DP_SINK_COUNT_ESI] = { 0 };
- uint8_t dret;
+ ssize_t dret;
bool new_irq_handled = false;
int dpcd_addr;
uint8_t dpcd_bytes_to_read;
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 05/30] drm/amd/display: copy only the status byte on a DMUB AUX write status retry
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (3 preceding siblings ...)
2026-12-01 20:22 ` [PATCH v2 04/30] drm/amd/display: keep the DPCD read result signed in the MST ISR George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 20:22 ` [PATCH v2 06/30] drm/amd/display: test the DMUB AUX write status reply copy George Zhang
` (24 subsequent siblings)
29 siblings, 0 replies; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Ray Wu, George Zhang
From: Tom Chung <chiahsuan.chung@amd.com>
[why]
On an I2C-over-AUX write status retry, payload->length is 0 and
payload->data still points at the caller's write buffer, which can be
a single byte. amdgpu_dm_process_dmub_aux_transfer_sync() skips the
payload->length clamp on this path, so a reply longer than one byte
writes up to 15 bytes past that buffer. A sink that follows the
DisplayPort specification replies with at most one byte, so this
guards against a non-compliant reply.
[how]
Clamp the write status copy to one byte, and keep the payload->length
clamp for regular transfers.
Found by CodeQL (CERT-C INT31-C).
Fixes: 8cbe3648aa86 ("drm/amd/display: clamp DMUB AUX reply length to payload buffer")
Cc: Ray Wu <ray.wu@amd.com>
Signed-off-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c
index bc430116f068..31dbbedf6c93 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c
@@ -926,9 +926,11 @@ int amdgpu_dm_process_dmub_aux_transfer_sync(
* During a write-status-update retry the caller zeroes
* payload->length while still expecting the partial-write
* status byte in payload->data (see dce_aux_transfer_with_retries),
- * so only clamp to payload->length for regular transfers.
+ * so copy only that byte there.
*/
- if (!payload->write_status_update)
+ if (payload->write_status_update)
+ ret = min_t(uint32_t, ret, 1);
+ else
ret = min_t(uint32_t, ret, payload->length);
memcpy(payload->data, p_notify->aux_reply.data, ret);
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 06/30] drm/amd/display: test the DMUB AUX write status reply copy
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (4 preceding siblings ...)
2026-12-01 20:22 ` [PATCH v2 05/30] drm/amd/display: copy only the status byte on a DMUB AUX write status retry George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 20:22 ` [PATCH v2 07/30] drm/amd/display: Account for downspread and DFS in clock validation George Zhang
` (23 subsequent siblings)
29 siblings, 0 replies; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Ray Wu, George Zhang
From: Tom Chung <chiahsuan.chung@amd.com>
[why]
No test covered the write status retry path fixed in the previous
commit, where a 16 byte reply overwrote the caller's buffer.
[how]
Add a KUnit case that answers a write status retry with a 16 byte
reply and checks that the call returns 1 and copies only the status
byte.
Cc: Ray Wu <ray.wu@amd.com>
Signed-off-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
.../amdgpu_dm/tests/amdgpu_dm_dmub_test.c | 81 +++++++++++++++++++
1 file changed, 81 insertions(+)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_dmub_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_dmub_test.c
index 9c0171b86c67..b2b4bb6df0a0 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_dmub_test.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_dmub_test.c
@@ -1335,6 +1335,86 @@ static void dm_test_process_dmub_aux_transfer_sync_copies_data(struct kunit *tes
KUNIT_EXPECT_EQ(test, data[2], 0x33);
}
+/**
+ * dm_test_process_dmub_aux_transfer_sync_write_status - Test AUX write status reply
+ * @test: The KUnit test context
+ *
+ * A write-status-update retry still points payload->data at the caller's write
+ * buffer, with payload->length zeroed. Only the partial-write status byte may
+ * be copied there, however long a reply the sink sends.
+ */
+static void dm_test_process_dmub_aux_transfer_sync_write_status(struct kunit *test)
+{
+ struct amdgpu_device *adev;
+ struct dc_context *ctx;
+ struct dc_context *dc_ctx;
+ struct dc *dc;
+ struct dc_link *link;
+ struct ddc_service *ddc;
+ struct aux_payload *payload;
+ struct dmub_notification *notify;
+ enum aux_return_code_type result = AUX_RET_ERROR_UNKNOWN;
+ u8 data[16] = { 0 };
+ u8 reply = 0;
+ int ret;
+ int i;
+
+ adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL);
+ KUNIT_ASSERT_NOT_NULL(test, adev);
+
+ ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL);
+ KUNIT_ASSERT_NOT_NULL(test, ctx);
+
+ dc_ctx = kunit_kzalloc(test, sizeof(*dc_ctx), GFP_KERNEL);
+ KUNIT_ASSERT_NOT_NULL(test, dc_ctx);
+
+ dc = kunit_kzalloc(test, sizeof(*dc), GFP_KERNEL);
+ KUNIT_ASSERT_NOT_NULL(test, dc);
+
+ link = kunit_kzalloc(test, sizeof(*link), GFP_KERNEL);
+ KUNIT_ASSERT_NOT_NULL(test, link);
+
+ ddc = kunit_kzalloc(test, sizeof(*ddc), GFP_KERNEL);
+ KUNIT_ASSERT_NOT_NULL(test, ddc);
+
+ payload = kunit_kzalloc(test, sizeof(*payload), GFP_KERNEL);
+ KUNIT_ASSERT_NOT_NULL(test, payload);
+
+ notify = kunit_kzalloc(test, sizeof(*notify), GFP_KERNEL);
+ KUNIT_ASSERT_NOT_NULL(test, notify);
+
+ link->ddc = ddc;
+ dc->ctx = dc_ctx;
+ dc->link_count = 1;
+ dc->links[0] = link;
+ dc_ctx->dc = dc;
+ dc_ctx->driver_context = adev;
+ dc_ctx->dmub_srv = NULL;
+ ctx->dc = dc;
+ ctx->driver_context = adev;
+ spin_lock_init(&adev->dm.dmub_lock);
+ adev->dm.dmub_notify = notify;
+ mutex_init(&adev->dm.dpia_aux_lock);
+ init_completion(&adev->dm.dmub_aux_transfer_done);
+ complete(&adev->dm.dmub_aux_transfer_done);
+ payload->data = data;
+ payload->reply = &reply;
+ payload->length = 0;
+ payload->i2c_over_aux = true;
+ payload->write_status_update = true;
+ notify->result = AUX_RET_SUCCESS;
+ notify->aux_reply.length = sizeof(notify->aux_reply.data);
+ memset(notify->aux_reply.data, 0x5A, sizeof(notify->aux_reply.data));
+
+ ret = amdgpu_dm_process_dmub_aux_transfer_sync(ctx, 0, payload, &result);
+
+ KUNIT_EXPECT_EQ(test, ret, 1);
+ KUNIT_EXPECT_EQ(test, result, AUX_RET_SUCCESS);
+ KUNIT_EXPECT_EQ(test, data[0], 0x5A);
+ for (i = 1; i < ARRAY_SIZE(data); i++)
+ KUNIT_EXPECT_EQ(test, data[i], 0);
+}
+
/**
* dm_test_process_dmub_aux_transfer_sync_zero_length - Test AUX reply with no data
* @test: The KUnit test context
@@ -2253,6 +2333,7 @@ static struct kunit_case amdgpu_dm_dmub_tests[] = {
KUNIT_CASE(dm_test_process_dmub_aux_transfer_sync_engine_acquire),
KUNIT_CASE(dm_test_process_dmub_aux_transfer_sync_protocol_error),
KUNIT_CASE(dm_test_process_dmub_aux_transfer_sync_copies_data),
+ KUNIT_CASE(dm_test_process_dmub_aux_transfer_sync_write_status),
KUNIT_CASE(dm_test_process_dmub_aux_transfer_sync_zero_length),
KUNIT_CASE_SLOW(dm_test_process_dmub_aux_transfer_sync_timeout),
/* amdgpu_dm_process_dmub_set_config_sync() */
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 07/30] drm/amd/display: Account for downspread and DFS in clock validation
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (5 preceding siblings ...)
2026-12-01 20:22 ` [PATCH v2 06/30] drm/amd/display: test the DMUB AUX write status reply copy George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 20:49 ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 08/30] drm/amd/display: Read max LSDMA BW from DMU George Zhang
` (22 subsequent siblings)
29 siblings, 1 reply; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Ilya Bakoulin, Wenjing Liu,
George Zhang
From: Ilya Bakoulin <Ilya.Bakoulin@amd.com>
[Why]
ODM selection can choose a combine factor that fails the final DISPCLK
check when downspread raises the clock requirement above the limit.
Clamping ramp margin to a cap between DFS steps can also round the
request up past the cap even when the mandatory clock fits.
[How]
Use the highest supported DFS step for the DCN6 ramp-margin clamp and
account for downspread when passing that ceiling to ODM selection.
Preserve the final check for mandatory clock requirements. Derive the
DISPCLK ceiling from the highest DFS step at or below the clock
table's maximum DISPCLK, floored to whole kHz.
Account for downspread in the DCN5 DISPCLK, DPPCLK, and DSCCLK limits.
Cc: Wenjing Liu <wenjing.liu@amd.com>
Signed-off-by: Ilya Bakoulin <Ilya.Bakoulin@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
.../dml2_0/dml21/src/dml2_cga/dml2_cga_dcn6.c | 43 +++++++++++++++----
.../dml2_core_dcn5_funcs_mode_support.c | 11 +++--
.../dml2_core_dcn6_funcs_mode_support.c | 5 +--
.../src/inc/dml2_internal_shared_types.h | 1 +
4 files changed, 46 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_cga/dml2_cga_dcn6.c b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_cga/dml2_cga_dcn6.c
index 43ee8a0b21b3..2817340a0586 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_cga/dml2_cga_dcn6.c
+++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_cga/dml2_cga_dcn6.c
@@ -14,6 +14,29 @@ static double cga_dcn6_add_overhead_percent(double clk, double overhead_percent)
return clk * (1 + overhead_percent / 100.0);
}
+static double cga_dcn6_scaled_vco_mhz(const struct dml2_clock_granularity_adjuster *adjuster)
+{
+ return math_floor2(adjuster->dispclk_dppclk_vco_speed_mhz, CLOCK_UNIT_GRANULARITY) *
+ DFS_DIVIDER_RANGE_SCALE_FACTOR;
+}
+
+static unsigned int cga_dcn6_max_dfs_dispclk_khz(const struct dml2_clock_granularity_adjuster *adjuster,
+ unsigned int max_dispclk_khz)
+{
+ unsigned int scaled_vco_khz;
+ unsigned int divider;
+
+ if (adjuster->dispclk_dppclk_vco_speed_mhz == 0.0)
+ return max_dispclk_khz;
+
+ scaled_vco_khz = (unsigned int)(cga_dcn6_scaled_vco_mhz(adjuster) * 1000.0 + 0.5);
+ /* The reported DFS clock is floored to kHz. Find the smallest divider
+ * for which the exact clock is strictly below max_dispclk_khz + 1.
+ */
+ divider = scaled_vco_khz / (max_dispclk_khz + 1) + 1;
+ return scaled_vco_khz / divider;
+}
+
static double cga_dcn6_calculate_refclk_mhz(const struct dml2_clock_granularity_adjuster *adjuster,
const double *clks_mhz, unsigned int count)
{
@@ -40,11 +63,11 @@ static double cga_dcn6_calculate_actual_dispclk_mhz(const struct dml2_clock_gran
dispclk_with_downspread_mhz = cga_dcn6_add_overhead_percent(dispclk_mhz, adjuster->dcn_downspread_percent);
dispclk_with_ramp_margin_mhz = cga_dcn6_add_overhead_percent(
dispclk_with_downspread_mhz, adjuster->dispclk_ramp_margin_percent);
- if (dispclk_with_downspread_mhz <= adjuster->max_dispclk_mhz &&
- dispclk_with_ramp_margin_mhz > adjuster->max_dispclk_mhz)
- /* when dispclk with ramp margin is slightly over max, clamp the ramp margin to the max dispclk */
- return math_floor2(adjuster->max_dispclk_mhz, CLOCK_UNIT_GRANULARITY);
- else if (dispclk_with_downspread_mhz > adjuster->max_dispclk_mhz)
+ if (dispclk_with_downspread_mhz <= adjuster->max_adjusted_dispclk_mhz &&
+ dispclk_with_ramp_margin_mhz > adjuster->max_adjusted_dispclk_mhz)
+ /* Clamp optional ramp margin to the highest reachable DFS clock. */
+ return adjuster->max_adjusted_dispclk_mhz;
+ else if (dispclk_with_downspread_mhz > adjuster->max_adjusted_dispclk_mhz)
return math_floor2(dispclk_with_downspread_mhz, CLOCK_UNIT_GRANULARITY);
else
return math_floor2(dispclk_with_ramp_margin_mhz, CLOCK_UNIT_GRANULARITY);
@@ -63,8 +86,7 @@ static double cga_dcn6_adjust_to_dfs_clock_value_mhz(const struct dml2_clock_gra
/* There are cases when a clock is not needed */
return 0;
- vco_speed_scaled_mhz = math_floor2(adjuster->dispclk_dppclk_vco_speed_mhz, 0.001);
- vco_speed_scaled_mhz *= DFS_DIVIDER_RANGE_SCALE_FACTOR;
+ vco_speed_scaled_mhz = cga_dcn6_scaled_vco_mhz(adjuster);
vco_divider = vco_speed_scaled_mhz / clk_mhz;
vco_divider = math_floor(vco_divider);
adjusted_clock_mhz = vco_speed_scaled_mhz / vco_divider;
@@ -137,11 +159,16 @@ static double cga_dcn6_adjust_dcfclk_deepsleep_mhz(const struct dml2_clock_granu
static void cga_dcn6_initialize(const struct dml2_cga_initialize_in_out *in_out)
{
+ const struct dml2_clk_table *dispclk = &in_out->soc_bb->clk_table.dispclk;
+
in_out->adjuster->dcn_downspread_percent = in_out->soc_bb->dcn_downspread_percent;
in_out->adjuster->dispclk_dppclk_vco_speed_mhz = in_out->soc_bb->dispclk_dppclk_vco_speed_mhz;
in_out->adjuster->dispclk_ramp_margin_percent = in_out->ip->dispclk_ramp_margin_percent;
+ in_out->adjuster->max_adjusted_dispclk_mhz =
+ cga_dcn6_max_dfs_dispclk_khz(in_out->adjuster,
+ dispclk->clk_values_khz[dispclk->num_clk_values - 1]) / 1000.0;
in_out->adjuster->max_dispclk_mhz =
- in_out->soc_bb->clk_table.dispclk.clk_values_khz[in_out->soc_bb->clk_table.dispclk.num_clk_values - 1] / 1000.0;
+ in_out->adjuster->max_adjusted_dispclk_mhz / (1.0 + in_out->soc_bb->dcn_downspread_percent / 100.0);
}
void cga_dcn6_create(struct dml2_clock_granularity_adjuster *adjuster)
diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn5_funcs_mode_support.c b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn5_funcs_mode_support.c
index b9aef66d722d..8cfa0f712ad4 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn5_funcs_mode_support.c
+++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn5_funcs_mode_support.c
@@ -2485,6 +2485,11 @@ static void dcn5_ms_get_stream_support_info(const struct dml2_display_cfg *displ
DML_LOG_VERBOSE("DML::%s: vblank_reserved_time_us = %u\n", __func__, out->vblank_reserved_time_us);
}
+static double dcn5_ms_subtract_dcn_overhead_percent(double clk, const struct dml2_utm_soc_bb *utm_soc_bb)
+{
+ return clk / (1.0 + utm_soc_bb->dcn_downspread_percent / 100.0);
+}
+
static void dcn5_ms_setup_mode_lib_constants(struct dml2_core_calcs_mode_support_ex *in_out_params)
{
struct dml2_core_internal_display_mode_lib *mode_lib = in_out_params->mode_lib;
@@ -2503,9 +2508,9 @@ static void dcn5_ms_setup_mode_lib_constants(struct dml2_core_calcs_mode_support
sizeof(struct dml2_core_internal_mode_support));
mode_lib->ms.use_legacy_dsc_delay_formula = mode_lib->ip.use_legacy_dsc_delay_formula;
mode_lib->ms.num_active_planes = display_cfg->num_planes;
- mode_lib->ms.max_dispclk_freq_mhz = (double) utm_soc_bb->max_dispclk_khz / 1000;
- mode_lib->ms.max_dscclk_freq_mhz = (double) utm_soc_bb->max_dscclk_khz / 1000;
- mode_lib->ms.max_dppclk_freq_mhz = (double) utm_soc_bb->max_dppclk_khz / 1000;
+ mode_lib->ms.max_dispclk_freq_mhz = dcn5_ms_subtract_dcn_overhead_percent((double) utm_soc_bb->max_dispclk_khz / 1000, utm_soc_bb);
+ mode_lib->ms.max_dscclk_freq_mhz = dcn5_ms_subtract_dcn_overhead_percent((double) utm_soc_bb->max_dscclk_khz / 1000, utm_soc_bb);
+ mode_lib->ms.max_dppclk_freq_mhz = dcn5_ms_subtract_dcn_overhead_percent((double) utm_soc_bb->max_dppclk_khz / 1000, utm_soc_bb);
DML_LOG_VERBOSE("DML::%s: --- START --- \n", __func__);
DML_LOG_VERBOSE("DML::%s: num_active_planes = %u\n", __func__,
diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_support.c b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_support.c
index bd81e02e462f..290557d87b0d 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_support.c
+++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_support.c
@@ -860,7 +860,6 @@ void dcn6_ms_calculate_odm_mode(
{
const struct dml2_display_cfg *display_cfg = ctx->display_cfg;
const struct dml2_core_ip_params *ip = ctx->ip;
- const struct dml2_utm_soc_bb *soc_bb = ctx->soc_bb;
struct dml2_core_internal_mode_support *inputs = states;
struct dml2_core_internal_mode_support *outputs = states;
const struct dml2_stream_parameters *stream;
@@ -880,7 +879,7 @@ void dcn6_ms_calculate_odm_mode(
stream->output.output_format,
stream->output.output_encoder,
stream->overrides.odm_mode,
- ((double) soc_bb->max_dispclk_khz / 1000),
+ ctx->clock_adjuster->max_dispclk_mhz,
inputs->RequiresDSC[k], // DSCEnable
totalNumberOfActiveDPP,
ip->max_num_dpp,
@@ -1176,7 +1175,7 @@ bool dcn6_ms_check_dispclk_and_dppclk_support(
struct dml2_core_internal_mode_support *outputs = states;
DML_LOG_FUNC_ENTER();
- outputs->support.DISPCLK_DPPCLK_Support = (inputs->RequiredDISPCLK <= ((double) soc_bb->max_dispclk_khz / 1000))
+ outputs->support.DISPCLK_DPPCLK_Support = (inputs->RequiredDISPCLK <= ctx->clock_adjuster->max_adjusted_dispclk_mhz)
&& (inputs->GlobalDPPCLK <= ((double) soc_bb->max_dppclk_khz / 1000));
DML_LOG_DEBUG_BOOL(outputs->support.DISPCLK_DPPCLK_Support);
diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_internal_shared_types.h b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_internal_shared_types.h
index 3f51c26dc238..d64705b9f976 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_internal_shared_types.h
+++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_internal_shared_types.h
@@ -163,6 +163,7 @@ struct dml2_clock_granularity_adjuster {
double dispclk_dppclk_vco_speed_mhz;
double dispclk_ramp_margin_percent;
double max_dispclk_mhz;
+ double max_adjusted_dispclk_mhz;
void (*initialize)(const struct dml2_cga_initialize_in_out *in_out);
double (*adjust_dispclk_mhz)(const struct dml2_clock_granularity_adjuster *adjuster, double dispclk_mhz);
void (*adjust_dppclks_mhz)(const struct dml2_clock_granularity_adjuster *adjuster, unsigned int count,
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 08/30] drm/amd/display: Read max LSDMA BW from DMU
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (6 preceding siblings ...)
2026-12-01 20:22 ` [PATCH v2 07/30] drm/amd/display: Account for downspread and DFS in clock validation George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 20:22 ` [PATCH v2 09/30] drm/amd/display: Precompute EASF lookup thresholds George Zhang
` (21 subsequent siblings)
29 siblings, 0 replies; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Alvin Lee, George Zhang
From: Ivan Lipski <ivan.lipski@amd.com>
[Why&How]
We parse LSDMA bandwidth info from DMU, so we should set it to the SOC BB.
Cc: Alvin Lee <alvin.lee2@amd.com>
Signed-off-by: Ivan Lipski <ivan.lipski@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
.../soc_and_ip_translator/dcn60/dcn60_soc_and_ip_translator.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/amd/display/dc/soc_and_ip_translator/dcn60/dcn60_soc_and_ip_translator.c b/drivers/gpu/drm/amd/display/dc/soc_and_ip_translator/dcn60/dcn60_soc_and_ip_translator.c
index 9c92c5bf7a0f..a7aad081d750 100644
--- a/drivers/gpu/drm/amd/display/dc/soc_and_ip_translator/dcn60/dcn60_soc_and_ip_translator.c
+++ b/drivers/gpu/drm/amd/display/dc/soc_and_ip_translator/dcn60/dcn60_soc_and_ip_translator.c
@@ -78,6 +78,8 @@ static void dcn60_update_soc_bb_with_values_from_dmub(struct dml2_soc_bb *soc_bb
if (dmub_bb_params->alternate_dram_carveout_size_mb > 0)
soc_bb->power_management_parameters.alternate_dram_carveout_size_mb =
dmub_bb_params->alternate_dram_carveout_size_mb;
+ if (dmub_bb_params->max_lsdma_bandwidth_kbps > 0)
+ soc_bb->max_lsdma_bandwidth_kbps = dmub_bb_params->max_lsdma_bandwidth_kbps;
/* populate alt-channel info */
for (i = 0; i < 2; i++) {
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 09/30] drm/amd/display: Precompute EASF lookup thresholds
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (7 preceding siblings ...)
2026-12-01 20:22 ` [PATCH v2 08/30] drm/amd/display: Read max LSDMA BW from DMU George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 20:22 ` [PATCH v2 10/30] drm/amd/display: Make DPP_SET_INPUT_TRANSFER_FUNC BLS compliant George Zhang
` (20 subsequent siblings)
29 siblings, 0 replies; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, deguo, Samson Tam,
George Zhang
From: deguo <deshui.guo@amd.com>
[WHY]
EASF register lookups and filter selection repeatedly convert
constant scale-ratio thresholds to 31.32 fixed-point values at runtime.
[HOW]
Precompute the thresholds at compile time with the same rounding
as spl_fixpt_from_fraction. Use them for register lookups and
3/4/6-tap coefficient selection in both S1.10 and S1.12 formats.
Mark the lookup tables const. Name the macro parameters num and denom.
Cc: Samson Tam <samson.tam@amd.com>
Signed-off-by: Deshui Guo <deshui.guo@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
.../display/dc/sspl/dc_spl_scl_easf_filters.c | 478 +++++++++---------
.../display/dc/sspl/dc_spl_scl_easf_filters.h | 3 +-
2 files changed, 241 insertions(+), 240 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/sspl/dc_spl_scl_easf_filters.c b/drivers/gpu/drm/amd/display/dc/sspl/dc_spl_scl_easf_filters.c
index ffc35041d901..c2aa2bbe0dc1 100644
--- a/drivers/gpu/drm/amd/display/dc/sspl/dc_spl_scl_easf_filters.c
+++ b/drivers/gpu/drm/amd/display/dc/sspl/dc_spl_scl_easf_filters.c
@@ -2000,213 +2000,217 @@ static const uint16_t easf_filter_6tap_64p_ratio_1_00_s1_12[198] = {
0x0064, 0x3dd4, 0x09c8, 0x09c8, 0x3dd4, 0x0064,
};
-static struct scale_ratio_to_reg_value_lookup easf_v_bf3_mode_lookup[] = {
- {3, 10, 0x0000},
- {4, 10, 0x0000},
- {5, 10, 0x0000},
- {6, 10, 0x0000},
- {7, 10, 0x0000},
- {8, 10, 0x0000},
- {9, 10, 0x0000},
- {1, 1, 0x0000},
- {-1, -1, 0x0002},
-};
-
-static struct scale_ratio_to_reg_value_lookup easf_h_bf3_mode_lookup[] = {
- {3, 10, 0x0000},
- {4, 10, 0x0000},
- {5, 10, 0x0000},
- {6, 10, 0x0000},
- {7, 10, 0x0000},
- {8, 10, 0x0000},
- {9, 10, 0x0000},
- {1, 1, 0x0000},
- {-1, -1, 0x0002},
-};
-
-static struct scale_ratio_to_reg_value_lookup easf_reducer_gain6_6tap_lookup[] = {
- {3, 10, 0x4100},
- {4, 10, 0x4100},
- {5, 10, 0x4100},
- {6, 10, 0x4100},
- {7, 10, 0x4100},
- {8, 10, 0x4100},
- {9, 10, 0x4100},
- {1, 1, 0x4100},
- {-1, -1, 0x4100},
-};
-
-static struct scale_ratio_to_reg_value_lookup easf_reducer_gain4_6tap_lookup[] = {
- {3, 10, 0x4000},
- {4, 10, 0x4000},
- {5, 10, 0x4000},
- {6, 10, 0x4000},
- {7, 10, 0x4000},
- {8, 10, 0x4000},
- {9, 10, 0x4000},
- {1, 1, 0x4000},
- {-1, -1, 0x4000},
-};
-
-static struct scale_ratio_to_reg_value_lookup easf_gain_ring6_6tap_lookup[] = {
- {3, 10, 0x0000},
- {4, 10, 0x251F},
- {5, 10, 0x291F},
- {6, 10, 0xA51F},
- {7, 10, 0xA51F},
- {8, 10, 0xAA66},
- {9, 10, 0xA51F},
- {1, 1, 0xA640},
- {-1, -1, 0xA640},
-};
-
-static struct scale_ratio_to_reg_value_lookup easf_gain_ring4_6tap_lookup[] = {
- {3, 10, 0x0000},
- {4, 10, 0x9600},
- {5, 10, 0xA460},
- {6, 10, 0xA8E0},
- {7, 10, 0xAC00},
- {8, 10, 0xAD20},
- {9, 10, 0xAFC0},
- {1, 1, 0xB058},
- {-1, -1, 0xB058},
-};
-
-static struct scale_ratio_to_reg_value_lookup easf_reducer_gain6_4tap_lookup[] = {
- {3, 10, 0x4100},
- {4, 10, 0x4100},
- {5, 10, 0x4100},
- {6, 10, 0x4100},
- {7, 10, 0x4100},
- {8, 10, 0x4100},
- {9, 10, 0x4100},
- {1, 1, 0x4100},
- {-1, -1, 0x4100},
-};
-
-static struct scale_ratio_to_reg_value_lookup easf_reducer_gain4_4tap_lookup[] = {
- {3, 10, 0x4000},
- {4, 10, 0x4000},
- {5, 10, 0x4000},
- {6, 10, 0x4000},
- {7, 10, 0x4000},
- {8, 10, 0x4000},
- {9, 10, 0x4000},
- {1, 1, 0x4000},
- {-1, -1, 0x4000},
-};
-
-static struct scale_ratio_to_reg_value_lookup easf_gain_ring6_4tap_lookup[] = {
- {3, 10, 0x0000},
- {4, 10, 0x0000},
- {5, 10, 0x0000},
- {6, 10, 0x0000},
- {7, 10, 0x0000},
- {8, 10, 0x0000},
- {9, 10, 0x0000},
- {1, 1, 0x0000},
- {-1, -1, 0x0000},
-};
-
-static struct scale_ratio_to_reg_value_lookup easf_gain_ring4_4tap_lookup[] = {
- {3, 10, 0x0000},
- {4, 10, 0x0000},
- {5, 10, 0x0000},
- {6, 10, 0x9900},
- {7, 10, 0xA100},
- {8, 10, 0xA8C0},
- {9, 10, 0xAB20},
- {1, 1, 0xAC00},
- {-1, -1, 0xAC00},
-};
-
-static struct scale_ratio_to_reg_value_lookup easf_3tap_dntilt_uptilt_offset_lookup[] = {
- {3, 10, 0x0000},
- {4, 10, 0x0000},
- {5, 10, 0x0000},
- {6, 10, 0x0000},
- {7, 10, 0x0000},
- {8, 10, 0x4100},
- {9, 10, 0x9F00},
- {1, 1, 0xA4C0},
- {-1, -1, 0xA8D8},
-};
-
-static struct scale_ratio_to_reg_value_lookup easf_3tap_uptilt_maxval_lookup[] = {
- {3, 10, 0x0000},
- {4, 10, 0x0000},
- {5, 10, 0x0000},
- {6, 10, 0x0000},
- {7, 10, 0x0000},
- {8, 10, 0x4000},
- {9, 10, 0x24FE},
- {1, 1, 0x2D64},
- {-1, -1, 0x3ADB},
-};
-
-static struct scale_ratio_to_reg_value_lookup easf_3tap_dntilt_slope_lookup[] = {
- {3, 10, 0x3800},
- {4, 10, 0x3800},
- {5, 10, 0x3800},
- {6, 10, 0x3800},
- {7, 10, 0x3800},
- {8, 10, 0x3886},
- {9, 10, 0x3940},
- {1, 1, 0x3A4E},
- {-1, -1, 0x3B66},
-};
-
-static struct scale_ratio_to_reg_value_lookup easf_3tap_uptilt1_slope_lookup[] = {
- {3, 10, 0x3800},
- {4, 10, 0x3800},
- {5, 10, 0x3800},
- {6, 10, 0x3800},
- {7, 10, 0x3800},
- {8, 10, 0x36F4},
- {9, 10, 0x359C},
- {1, 1, 0x3360},
- {-1, -1, 0x2F20},
-};
-
-static struct scale_ratio_to_reg_value_lookup easf_3tap_uptilt2_slope_lookup[] = {
- {3, 10, 0x0000},
- {4, 10, 0x0000},
- {5, 10, 0x0000},
- {6, 10, 0x0000},
- {7, 10, 0x0000},
- {8, 10, 0x0000},
- {9, 10, 0x359C},
- {1, 1, 0x31F0},
- {-1, -1, 0x1F00},
-};
-
-static struct scale_ratio_to_reg_value_lookup easf_3tap_uptilt2_offset_lookup[] = {
- {3, 10, 0x0000},
- {4, 10, 0x0000},
- {5, 10, 0x0000},
- {6, 10, 0x0000},
- {7, 10, 0x0000},
- {8, 10, 0x0000},
- {9, 10, 0x9F00},
- {1, 1, 0xA400},
- {-1, -1, 0x9E00},
+#define EASF_SCALE_RATIO(num, denom) \
+ ((((long long)(num) << FIXED31_32_BITS_PER_FRACTIONAL_PART) + \
+ (denom) / 2) / (denom))
+
+static const struct scale_ratio_to_reg_value_lookup easf_v_bf3_mode_lookup[] = {
+ {EASF_SCALE_RATIO(3, 10), 0x0000},
+ {EASF_SCALE_RATIO(4, 10), 0x0000},
+ {EASF_SCALE_RATIO(5, 10), 0x0000},
+ {EASF_SCALE_RATIO(6, 10), 0x0000},
+ {EASF_SCALE_RATIO(7, 10), 0x0000},
+ {EASF_SCALE_RATIO(8, 10), 0x0000},
+ {EASF_SCALE_RATIO(9, 10), 0x0000},
+ {EASF_SCALE_RATIO(1, 1), 0x0000},
+ {-1, 0x0002},
+};
+
+static const struct scale_ratio_to_reg_value_lookup easf_h_bf3_mode_lookup[] = {
+ {EASF_SCALE_RATIO(3, 10), 0x0000},
+ {EASF_SCALE_RATIO(4, 10), 0x0000},
+ {EASF_SCALE_RATIO(5, 10), 0x0000},
+ {EASF_SCALE_RATIO(6, 10), 0x0000},
+ {EASF_SCALE_RATIO(7, 10), 0x0000},
+ {EASF_SCALE_RATIO(8, 10), 0x0000},
+ {EASF_SCALE_RATIO(9, 10), 0x0000},
+ {EASF_SCALE_RATIO(1, 1), 0x0000},
+ {-1, 0x0002},
+};
+
+static const struct scale_ratio_to_reg_value_lookup easf_reducer_gain6_6tap_lookup[] = {
+ {EASF_SCALE_RATIO(3, 10), 0x4100},
+ {EASF_SCALE_RATIO(4, 10), 0x4100},
+ {EASF_SCALE_RATIO(5, 10), 0x4100},
+ {EASF_SCALE_RATIO(6, 10), 0x4100},
+ {EASF_SCALE_RATIO(7, 10), 0x4100},
+ {EASF_SCALE_RATIO(8, 10), 0x4100},
+ {EASF_SCALE_RATIO(9, 10), 0x4100},
+ {EASF_SCALE_RATIO(1, 1), 0x4100},
+ {-1, 0x4100},
+};
+
+static const struct scale_ratio_to_reg_value_lookup easf_reducer_gain4_6tap_lookup[] = {
+ {EASF_SCALE_RATIO(3, 10), 0x4000},
+ {EASF_SCALE_RATIO(4, 10), 0x4000},
+ {EASF_SCALE_RATIO(5, 10), 0x4000},
+ {EASF_SCALE_RATIO(6, 10), 0x4000},
+ {EASF_SCALE_RATIO(7, 10), 0x4000},
+ {EASF_SCALE_RATIO(8, 10), 0x4000},
+ {EASF_SCALE_RATIO(9, 10), 0x4000},
+ {EASF_SCALE_RATIO(1, 1), 0x4000},
+ {-1, 0x4000},
+};
+
+static const struct scale_ratio_to_reg_value_lookup easf_gain_ring6_6tap_lookup[] = {
+ {EASF_SCALE_RATIO(3, 10), 0x0000},
+ {EASF_SCALE_RATIO(4, 10), 0x251F},
+ {EASF_SCALE_RATIO(5, 10), 0x291F},
+ {EASF_SCALE_RATIO(6, 10), 0xA51F},
+ {EASF_SCALE_RATIO(7, 10), 0xA51F},
+ {EASF_SCALE_RATIO(8, 10), 0xAA66},
+ {EASF_SCALE_RATIO(9, 10), 0xA51F},
+ {EASF_SCALE_RATIO(1, 1), 0xA640},
+ {-1, 0xA640},
+};
+
+static const struct scale_ratio_to_reg_value_lookup easf_gain_ring4_6tap_lookup[] = {
+ {EASF_SCALE_RATIO(3, 10), 0x0000},
+ {EASF_SCALE_RATIO(4, 10), 0x9600},
+ {EASF_SCALE_RATIO(5, 10), 0xA460},
+ {EASF_SCALE_RATIO(6, 10), 0xA8E0},
+ {EASF_SCALE_RATIO(7, 10), 0xAC00},
+ {EASF_SCALE_RATIO(8, 10), 0xAD20},
+ {EASF_SCALE_RATIO(9, 10), 0xAFC0},
+ {EASF_SCALE_RATIO(1, 1), 0xB058},
+ {-1, 0xB058},
+};
+
+static const struct scale_ratio_to_reg_value_lookup easf_reducer_gain6_4tap_lookup[] = {
+ {EASF_SCALE_RATIO(3, 10), 0x4100},
+ {EASF_SCALE_RATIO(4, 10), 0x4100},
+ {EASF_SCALE_RATIO(5, 10), 0x4100},
+ {EASF_SCALE_RATIO(6, 10), 0x4100},
+ {EASF_SCALE_RATIO(7, 10), 0x4100},
+ {EASF_SCALE_RATIO(8, 10), 0x4100},
+ {EASF_SCALE_RATIO(9, 10), 0x4100},
+ {EASF_SCALE_RATIO(1, 1), 0x4100},
+ {-1, 0x4100},
+};
+
+static const struct scale_ratio_to_reg_value_lookup easf_reducer_gain4_4tap_lookup[] = {
+ {EASF_SCALE_RATIO(3, 10), 0x4000},
+ {EASF_SCALE_RATIO(4, 10), 0x4000},
+ {EASF_SCALE_RATIO(5, 10), 0x4000},
+ {EASF_SCALE_RATIO(6, 10), 0x4000},
+ {EASF_SCALE_RATIO(7, 10), 0x4000},
+ {EASF_SCALE_RATIO(8, 10), 0x4000},
+ {EASF_SCALE_RATIO(9, 10), 0x4000},
+ {EASF_SCALE_RATIO(1, 1), 0x4000},
+ {-1, 0x4000},
+};
+
+static const struct scale_ratio_to_reg_value_lookup easf_gain_ring6_4tap_lookup[] = {
+ {EASF_SCALE_RATIO(3, 10), 0x0000},
+ {EASF_SCALE_RATIO(4, 10), 0x0000},
+ {EASF_SCALE_RATIO(5, 10), 0x0000},
+ {EASF_SCALE_RATIO(6, 10), 0x0000},
+ {EASF_SCALE_RATIO(7, 10), 0x0000},
+ {EASF_SCALE_RATIO(8, 10), 0x0000},
+ {EASF_SCALE_RATIO(9, 10), 0x0000},
+ {EASF_SCALE_RATIO(1, 1), 0x0000},
+ {-1, 0x0000},
+};
+
+static const struct scale_ratio_to_reg_value_lookup easf_gain_ring4_4tap_lookup[] = {
+ {EASF_SCALE_RATIO(3, 10), 0x0000},
+ {EASF_SCALE_RATIO(4, 10), 0x0000},
+ {EASF_SCALE_RATIO(5, 10), 0x0000},
+ {EASF_SCALE_RATIO(6, 10), 0x9900},
+ {EASF_SCALE_RATIO(7, 10), 0xA100},
+ {EASF_SCALE_RATIO(8, 10), 0xA8C0},
+ {EASF_SCALE_RATIO(9, 10), 0xAB20},
+ {EASF_SCALE_RATIO(1, 1), 0xAC00},
+ {-1, 0xAC00},
+};
+
+static const struct scale_ratio_to_reg_value_lookup easf_3tap_dntilt_uptilt_offset_lookup[] = {
+ {EASF_SCALE_RATIO(3, 10), 0x0000},
+ {EASF_SCALE_RATIO(4, 10), 0x0000},
+ {EASF_SCALE_RATIO(5, 10), 0x0000},
+ {EASF_SCALE_RATIO(6, 10), 0x0000},
+ {EASF_SCALE_RATIO(7, 10), 0x0000},
+ {EASF_SCALE_RATIO(8, 10), 0x4100},
+ {EASF_SCALE_RATIO(9, 10), 0x9F00},
+ {EASF_SCALE_RATIO(1, 1), 0xA4C0},
+ {-1, 0xA8D8},
+};
+
+static const struct scale_ratio_to_reg_value_lookup easf_3tap_uptilt_maxval_lookup[] = {
+ {EASF_SCALE_RATIO(3, 10), 0x0000},
+ {EASF_SCALE_RATIO(4, 10), 0x0000},
+ {EASF_SCALE_RATIO(5, 10), 0x0000},
+ {EASF_SCALE_RATIO(6, 10), 0x0000},
+ {EASF_SCALE_RATIO(7, 10), 0x0000},
+ {EASF_SCALE_RATIO(8, 10), 0x4000},
+ {EASF_SCALE_RATIO(9, 10), 0x24FE},
+ {EASF_SCALE_RATIO(1, 1), 0x2D64},
+ {-1, 0x3ADB},
+};
+
+static const struct scale_ratio_to_reg_value_lookup easf_3tap_dntilt_slope_lookup[] = {
+ {EASF_SCALE_RATIO(3, 10), 0x3800},
+ {EASF_SCALE_RATIO(4, 10), 0x3800},
+ {EASF_SCALE_RATIO(5, 10), 0x3800},
+ {EASF_SCALE_RATIO(6, 10), 0x3800},
+ {EASF_SCALE_RATIO(7, 10), 0x3800},
+ {EASF_SCALE_RATIO(8, 10), 0x3886},
+ {EASF_SCALE_RATIO(9, 10), 0x3940},
+ {EASF_SCALE_RATIO(1, 1), 0x3A4E},
+ {-1, 0x3B66},
+};
+
+static const struct scale_ratio_to_reg_value_lookup easf_3tap_uptilt1_slope_lookup[] = {
+ {EASF_SCALE_RATIO(3, 10), 0x3800},
+ {EASF_SCALE_RATIO(4, 10), 0x3800},
+ {EASF_SCALE_RATIO(5, 10), 0x3800},
+ {EASF_SCALE_RATIO(6, 10), 0x3800},
+ {EASF_SCALE_RATIO(7, 10), 0x3800},
+ {EASF_SCALE_RATIO(8, 10), 0x36F4},
+ {EASF_SCALE_RATIO(9, 10), 0x359C},
+ {EASF_SCALE_RATIO(1, 1), 0x3360},
+ {-1, 0x2F20},
+};
+
+static const struct scale_ratio_to_reg_value_lookup easf_3tap_uptilt2_slope_lookup[] = {
+ {EASF_SCALE_RATIO(3, 10), 0x0000},
+ {EASF_SCALE_RATIO(4, 10), 0x0000},
+ {EASF_SCALE_RATIO(5, 10), 0x0000},
+ {EASF_SCALE_RATIO(6, 10), 0x0000},
+ {EASF_SCALE_RATIO(7, 10), 0x0000},
+ {EASF_SCALE_RATIO(8, 10), 0x0000},
+ {EASF_SCALE_RATIO(9, 10), 0x359C},
+ {EASF_SCALE_RATIO(1, 1), 0x31F0},
+ {-1, 0x1F00},
+};
+
+static const struct scale_ratio_to_reg_value_lookup easf_3tap_uptilt2_offset_lookup[] = {
+ {EASF_SCALE_RATIO(3, 10), 0x0000},
+ {EASF_SCALE_RATIO(4, 10), 0x0000},
+ {EASF_SCALE_RATIO(5, 10), 0x0000},
+ {EASF_SCALE_RATIO(6, 10), 0x0000},
+ {EASF_SCALE_RATIO(7, 10), 0x0000},
+ {EASF_SCALE_RATIO(8, 10), 0x0000},
+ {EASF_SCALE_RATIO(9, 10), 0x9F00},
+ {EASF_SCALE_RATIO(1, 1), 0xA400},
+ {-1, 0x9E00},
};
static const uint16_t *spl_get_easf_filter_3tap_64p(struct spl_fixed31_32 ratio)
{
- if (ratio.value < spl_fixpt_from_fraction(3, 10).value)
+ if (ratio.value < EASF_SCALE_RATIO(3, 10))
return easf_filter_3tap_64p_ratio_0_30_s1_12;
- else if (ratio.value < spl_fixpt_from_fraction(4, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(4, 10))
return easf_filter_3tap_64p_ratio_0_40_s1_12;
- else if (ratio.value < spl_fixpt_from_fraction(5, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(5, 10))
return easf_filter_3tap_64p_ratio_0_50_s1_12;
- else if (ratio.value < spl_fixpt_from_fraction(6, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(6, 10))
return easf_filter_3tap_64p_ratio_0_60_s1_12;
- else if (ratio.value < spl_fixpt_from_fraction(7, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(7, 10))
return easf_filter_3tap_64p_ratio_0_70_s1_12;
- else if (ratio.value < spl_fixpt_from_fraction(8, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(8, 10))
return easf_filter_3tap_64p_ratio_0_80_s1_12;
- else if (ratio.value < spl_fixpt_from_fraction(9, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(9, 10))
return easf_filter_3tap_64p_ratio_0_90_s1_12;
else
return easf_filter_3tap_64p_ratio_1_00_s1_12;
@@ -2214,19 +2218,19 @@ static const uint16_t *spl_get_easf_filter_3tap_64p(struct spl_fixed31_32 ratio)
static const uint16_t *spl_get_easf_filter_4tap_64p(struct spl_fixed31_32 ratio)
{
- if (ratio.value < spl_fixpt_from_fraction(3, 10).value)
+ if (ratio.value < EASF_SCALE_RATIO(3, 10))
return easf_filter_4tap_64p_ratio_0_30_s1_12;
- else if (ratio.value < spl_fixpt_from_fraction(4, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(4, 10))
return easf_filter_4tap_64p_ratio_0_40_s1_12;
- else if (ratio.value < spl_fixpt_from_fraction(5, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(5, 10))
return easf_filter_4tap_64p_ratio_0_50_s1_12;
- else if (ratio.value < spl_fixpt_from_fraction(6, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(6, 10))
return easf_filter_4tap_64p_ratio_0_60_s1_12;
- else if (ratio.value < spl_fixpt_from_fraction(7, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(7, 10))
return easf_filter_4tap_64p_ratio_0_70_s1_12;
- else if (ratio.value < spl_fixpt_from_fraction(8, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(8, 10))
return easf_filter_4tap_64p_ratio_0_80_s1_12;
- else if (ratio.value < spl_fixpt_from_fraction(9, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(9, 10))
return easf_filter_4tap_64p_ratio_0_90_s1_12;
else
return easf_filter_4tap_64p_ratio_1_00_s1_12;
@@ -2234,19 +2238,19 @@ static const uint16_t *spl_get_easf_filter_4tap_64p(struct spl_fixed31_32 ratio)
static const uint16_t *spl_get_easf_filter_6tap_64p(struct spl_fixed31_32 ratio)
{
- if (ratio.value < spl_fixpt_from_fraction(3, 10).value)
+ if (ratio.value < EASF_SCALE_RATIO(3, 10))
return easf_filter_6tap_64p_ratio_0_30_s1_12;
- else if (ratio.value < spl_fixpt_from_fraction(4, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(4, 10))
return easf_filter_6tap_64p_ratio_0_40_s1_12;
- else if (ratio.value < spl_fixpt_from_fraction(5, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(5, 10))
return easf_filter_6tap_64p_ratio_0_50_s1_12;
- else if (ratio.value < spl_fixpt_from_fraction(6, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(6, 10))
return easf_filter_6tap_64p_ratio_0_60_s1_12;
- else if (ratio.value < spl_fixpt_from_fraction(7, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(7, 10))
return easf_filter_6tap_64p_ratio_0_70_s1_12;
- else if (ratio.value < spl_fixpt_from_fraction(8, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(8, 10))
return easf_filter_6tap_64p_ratio_0_80_s1_12;
- else if (ratio.value < spl_fixpt_from_fraction(9, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(9, 10))
return easf_filter_6tap_64p_ratio_0_90_s1_12;
else
return easf_filter_6tap_64p_ratio_1_00_s1_12;
@@ -2270,19 +2274,19 @@ const uint16_t *SPL_NAMESPACE(spl_dscl_get_easf_filter_coeffs_64p(
static const uint16_t *spl_get_easf_filter_3tap_64p_s1_10(struct spl_fixed31_32 ratio)
{
- if (ratio.value < spl_fixpt_from_fraction(3, 10).value)
+ if (ratio.value < EASF_SCALE_RATIO(3, 10))
return easf_filter_3tap_64p_ratio_0_30;
- else if (ratio.value < spl_fixpt_from_fraction(4, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(4, 10))
return easf_filter_3tap_64p_ratio_0_40;
- else if (ratio.value < spl_fixpt_from_fraction(5, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(5, 10))
return easf_filter_3tap_64p_ratio_0_50;
- else if (ratio.value < spl_fixpt_from_fraction(6, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(6, 10))
return easf_filter_3tap_64p_ratio_0_60;
- else if (ratio.value < spl_fixpt_from_fraction(7, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(7, 10))
return easf_filter_3tap_64p_ratio_0_70;
- else if (ratio.value < spl_fixpt_from_fraction(8, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(8, 10))
return easf_filter_3tap_64p_ratio_0_80;
- else if (ratio.value < spl_fixpt_from_fraction(9, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(9, 10))
return easf_filter_3tap_64p_ratio_0_90;
else
return easf_filter_3tap_64p_ratio_1_00;
@@ -2290,19 +2294,19 @@ static const uint16_t *spl_get_easf_filter_3tap_64p_s1_10(struct spl_fixed31_32
static const uint16_t *spl_get_easf_filter_4tap_64p_s1_10(struct spl_fixed31_32 ratio)
{
- if (ratio.value < spl_fixpt_from_fraction(3, 10).value)
+ if (ratio.value < EASF_SCALE_RATIO(3, 10))
return easf_filter_4tap_64p_ratio_0_30;
- else if (ratio.value < spl_fixpt_from_fraction(4, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(4, 10))
return easf_filter_4tap_64p_ratio_0_40;
- else if (ratio.value < spl_fixpt_from_fraction(5, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(5, 10))
return easf_filter_4tap_64p_ratio_0_50;
- else if (ratio.value < spl_fixpt_from_fraction(6, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(6, 10))
return easf_filter_4tap_64p_ratio_0_60;
- else if (ratio.value < spl_fixpt_from_fraction(7, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(7, 10))
return easf_filter_4tap_64p_ratio_0_70;
- else if (ratio.value < spl_fixpt_from_fraction(8, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(8, 10))
return easf_filter_4tap_64p_ratio_0_80;
- else if (ratio.value < spl_fixpt_from_fraction(9, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(9, 10))
return easf_filter_4tap_64p_ratio_0_90;
else
return easf_filter_4tap_64p_ratio_1_00;
@@ -2310,19 +2314,19 @@ static const uint16_t *spl_get_easf_filter_4tap_64p_s1_10(struct spl_fixed31_32
static const uint16_t *spl_get_easf_filter_6tap_64p_s1_10(struct spl_fixed31_32 ratio)
{
- if (ratio.value < spl_fixpt_from_fraction(3, 10).value)
+ if (ratio.value < EASF_SCALE_RATIO(3, 10))
return easf_filter_6tap_64p_ratio_0_30;
- else if (ratio.value < spl_fixpt_from_fraction(4, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(4, 10))
return easf_filter_6tap_64p_ratio_0_40;
- else if (ratio.value < spl_fixpt_from_fraction(5, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(5, 10))
return easf_filter_6tap_64p_ratio_0_50;
- else if (ratio.value < spl_fixpt_from_fraction(6, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(6, 10))
return easf_filter_6tap_64p_ratio_0_60;
- else if (ratio.value < spl_fixpt_from_fraction(7, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(7, 10))
return easf_filter_6tap_64p_ratio_0_70;
- else if (ratio.value < spl_fixpt_from_fraction(8, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(8, 10))
return easf_filter_6tap_64p_ratio_0_80;
- else if (ratio.value < spl_fixpt_from_fraction(9, 10).value)
+ else if (ratio.value < EASF_SCALE_RATIO(9, 10))
return easf_filter_6tap_64p_ratio_0_90;
else
return easf_filter_6tap_64p_ratio_1_00;
@@ -2381,12 +2385,12 @@ void SPL_NAMESPACE(spl_set_filters_data(struct dscl_prog_data *dscl_prog_data,
}
static uint32_t spl_easf_get_scale_ratio_to_reg_value(struct spl_fixed31_32 ratio,
- struct scale_ratio_to_reg_value_lookup *lookup_table_base_ptr,
+ const struct scale_ratio_to_reg_value_lookup *lookup_table_base_ptr,
unsigned int num_entries)
{
unsigned int count = 0;
uint32_t value = 0;
- struct scale_ratio_to_reg_value_lookup *lookup_table_index_ptr;
+ const struct scale_ratio_to_reg_value_lookup *lookup_table_index_ptr;
lookup_table_index_ptr = (lookup_table_base_ptr + num_entries - 1);
value = lookup_table_index_ptr->reg_value;
@@ -2394,12 +2398,10 @@ static uint32_t spl_easf_get_scale_ratio_to_reg_value(struct spl_fixed31_32 rati
while (count < num_entries) {
lookup_table_index_ptr = (lookup_table_base_ptr + count);
- if (lookup_table_index_ptr->numer < 0)
+ if (lookup_table_index_ptr->scale_ratio < 0)
break;
- if (ratio.value < spl_fixpt_from_fraction(
- lookup_table_index_ptr->numer,
- lookup_table_index_ptr->denom).value) {
+ if (ratio.value < lookup_table_index_ptr->scale_ratio) {
value = lookup_table_index_ptr->reg_value;
break;
}
diff --git a/drivers/gpu/drm/amd/display/dc/sspl/dc_spl_scl_easf_filters.h b/drivers/gpu/drm/amd/display/dc/sspl/dc_spl_scl_easf_filters.h
index ba1cdb8be417..49c30d53e1dd 100644
--- a/drivers/gpu/drm/amd/display/dc/sspl/dc_spl_scl_easf_filters.h
+++ b/drivers/gpu/drm/amd/display/dc/sspl/dc_spl_scl_easf_filters.h
@@ -8,8 +8,7 @@
#include "dc_spl_types.h"
struct scale_ratio_to_reg_value_lookup {
- int numer;
- int denom;
+ long long scale_ratio;
const uint32_t reg_value;
};
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 10/30] drm/amd/display: Make DPP_SET_INPUT_TRANSFER_FUNC BLS compliant
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (8 preceding siblings ...)
2026-12-01 20:22 ` [PATCH v2 09/30] drm/amd/display: Precompute EASF lookup thresholds George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 20:22 ` [PATCH v2 11/30] drm/amd/display: Add pipe init to core2 George Zhang
` (19 subsequent siblings)
29 siblings, 0 replies; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Rafal Ostrowski, Alvin Lee,
George Zhang
From: Rafal Ostrowski <rafal.ostrowski@amd.com>
[Why]
- The DPP_SET_INPUT_TRANSFER_FUNC step carried dc, stream and plane_state,
so the hwseq hooks read plane and stream state at execute time.
[How]
- Add hwss_resolve_set_input_transfer_func_params(). It copies the pixel
format, the CM enable flags and the RMCM pool by value, and borrows the
curve and LUT data from the plane state.
- Build the step from the resolved params in
hwss_add_dpp_set_input_transfer_func(), hwss_build_fast_sequence() and
dcn401_program_pipe_sequence(). The adder validates its arguments and
the hook; the executor only dispatches.
- Pass the resolved params to set_blend_lut, set_shaper_3dlut and
disable_rmcm_luts, and drop dc, stream and plane_state from them.
- Give set_mcm_luts and set_rmcm_luts their own argument structs,
set_mcm_luts_params and set_rmcm_luts_params. The dispatcher fills them
from the step params, so each hook sees only the fields it uses.
- set_mcm_luts() still reads dpp->ctx. It passes it to
cm3_helper_translate_curve_to_hw_format(), which uses it only for the
logger, so it cannot be dropped without changing that shared helper.
- Move MAX_RMCM_INST to hw_shared.h.
Cc: Alvin Lee <alvin.lee2@amd.com>
Signed-off-by: Rafal Ostrowski <rafal.ostrowski@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
.../drm/amd/display/dc/core/dc_hw_sequencer.c | 125 ++++++++++--------
.../amd/display/dc/hwss/dce110/dce110_hwseq.c | 19 ++-
.../amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 15 +--
.../amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 45 +++----
.../amd/display/dc/hwss/dcn20/dcn20_hwseq.h | 5 +-
.../amd/display/dc/hwss/dcn30/dcn30_hwseq.c | 32 ++---
.../amd/display/dc/hwss/dcn30/dcn30_hwseq.h | 2 +-
.../amd/display/dc/hwss/dcn32/dcn32_hwseq.c | 102 ++++++++------
.../amd/display/dc/hwss/dcn32/dcn32_hwseq.h | 5 +-
.../amd/display/dc/hwss/dcn35/dcn35_hwseq.c | 3 +-
.../amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 74 ++++++-----
.../amd/display/dc/hwss/dcn401/dcn401_hwseq.h | 5 +-
.../amd/display/dc/hwss/dcn42/dcn42_hwseq.c | 56 ++++----
.../amd/display/dc/hwss/dcn42/dcn42_hwseq.h | 13 +-
.../amd/display/dc/hwss/dcn60/dcn60_hwseq.c | 33 ++---
.../amd/display/dc/hwss/dcn60/dcn60_hwseq.h | 2 +-
.../drm/amd/display/dc/hwss/hw_sequencer.h | 56 +++++++-
.../display/dc/hwss/hw_sequencer_private.h | 17 +--
.../gpu/drm/amd/display/dc/inc/core_types.h | 2 -
.../gpu/drm/amd/display/dc/inc/hw/hw_shared.h | 2 +
20 files changed, 348 insertions(+), 265 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c
index 583dcd8c8e2f..4107648cc88c 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c
@@ -116,6 +116,52 @@ void hwss_dmub_fams2_update_config(union block_sequence_params *params)
dc_dmub_srv_fams2_update_config(p->dmub_srv, &p->data);
}
+/*
+ * Resolve everything DPP_SET_INPUT_TRANSFER_FUNC needs from the pipe and plane,
+ * so the hwseq implementation never reads dc, stream or plane state.
+ */
+void hwss_resolve_set_input_transfer_func_params(struct dc *dc,
+ struct pipe_ctx *pipe_ctx,
+ struct set_input_transfer_func_params *params)
+{
+ struct pipe_ctx *primary_dpp_pipe = resource_get_primary_dpp_pipe(pipe_ctx);
+ const struct dc_plane_state *plane_state = pipe_ctx->plane_state;
+
+ *params = (struct set_input_transfer_func_params) {
+ .hws = dc->hwseq,
+ .dpp = pipe_ctx->plane_res.dpp,
+ .hubp = pipe_ctx->plane_res.hubp,
+ .primary_hubp = primary_dpp_pipe ?
+ primary_dpp_pipe->plane_res.hubp : pipe_ctx->plane_res.hubp,
+ .mpc = dc->res_pool->mpc,
+ .rmcm = pipe_ctx->plane_res.rmcm,
+ .mpcc_id = pipe_ctx->plane_res.mpcc_inst,
+ .ipp = pipe_ctx->plane_res.ipp,
+ .always_use_regamma = dc->debug.always_use_regamma,
+ };
+
+ if (dc->res_pool->res_cap) {
+ int rmcm_count = dc->res_pool->res_cap->num_rmcm;
+
+ params->rmcm_pool = dc->res_pool->rmcm;
+ params->rmcm_count = rmcm_count < MAX_RMCM_INST ? rmcm_count : MAX_RMCM_INST;
+ }
+
+ if (!plane_state)
+ return;
+
+ params->format = plane_state->format;
+ params->scaling_linearity = plane_state->scaling_linearity;
+ params->blend_enable = plane_state->cm.flags.bits.blend_enable != 0;
+ params->shaper_enable = plane_state->cm.flags.bits.shaper_enable != 0;
+ params->lut3d_enable = plane_state->cm.flags.bits.lut3d_enable != 0;
+ params->lut3d_dma_enable = plane_state->cm.flags.bits.lut3d_dma_enable != 0;
+ params->rmcm_enable = plane_state->cm.flags.bits.rmcm_enable != 0;
+ params->in_transfer_func = &plane_state->in_transfer_func;
+ params->gamma_correction = &plane_state->gamma_correction;
+ params->cm = &plane_state->cm;
+}
+
#define MAX_NUM_MCACHE 8
/* used as index in array of black_color_format */
@@ -1541,26 +1587,12 @@ void hwss_build_fast_sequence(struct dc *dc,
block_sequence[*num_steps].func = HUBP_ENABLE_3DLUT_FL;
(*num_steps)++;
}
- if (hws->funcs.set_input_transfer_func && current_mpc_pipe->plane_state->update_bits.gamma_change) {
- struct pipe_ctx *primary_dpp_pipe =
- resource_get_primary_dpp_pipe(current_mpc_pipe);
-
- block_sequence[*num_steps].params.set_input_transfer_func_params =
- (struct set_input_transfer_func_params) {
- .dc = dc,
- .dpp = current_mpc_pipe->plane_res.dpp,
- .hubp = current_mpc_pipe->plane_res.hubp,
- .primary_hubp = primary_dpp_pipe ?
- primary_dpp_pipe->plane_res.hubp : current_mpc_pipe->plane_res.hubp,
- .ipp = current_mpc_pipe->plane_res.ipp,
- .mpc = dc->res_pool->mpc,
- .rmcm = current_mpc_pipe->plane_res.rmcm,
- .mpcc_id = current_mpc_pipe->plane_res.mpcc_inst,
- .stream = current_mpc_pipe->stream,
- .plane_state = current_mpc_pipe->plane_state,
- };
- block_sequence[*num_steps].func = DPP_SET_INPUT_TRANSFER_FUNC;
- (*num_steps)++;
+ if (current_mpc_pipe->plane_state->update_bits.gamma_change) {
+ struct set_input_transfer_func_params itf_params;
+
+ hwss_resolve_set_input_transfer_func_params(dc, current_mpc_pipe,
+ &itf_params);
+ hwss_add_dpp_set_input_transfer_func(&seq_state, &itf_params);
}
if (current_mpc_pipe->plane_state->update_bits.hdr_mult) {
@@ -1737,7 +1769,7 @@ void hwss_execute_sequence(struct dc *dc,
params->update_plane_addr_params.dcc);
break;
case DPP_SET_INPUT_TRANSFER_FUNC:
- hws->funcs.set_input_transfer_func(¶ms->set_input_transfer_func_params);
+ hwss_dpp_set_input_transfer_func(params);
break;
case DPP_PROGRAM_GAMUT_REMAP:
if (dc->hwss.program_gamut_remap)
@@ -2391,27 +2423,18 @@ void hwss_add_hubp_update_plane_addr(struct block_sequence_state *seq_state,
/*
* Helper function to add DPP set input transfer function to block sequence
*/
-void hwss_add_dpp_set_input_transfer_func(struct block_sequence_state *seq_state, struct dc *dc,
- struct pipe_ctx *pipe_ctx)
+void hwss_add_dpp_set_input_transfer_func(struct block_sequence_state *seq_state,
+ const struct set_input_transfer_func_params *params)
{
+ if (!seq_state || !seq_state->steps || !seq_state->num_steps || !params || !params->hws ||
+ !params->hws->funcs.set_input_transfer_func)
+ return;
+
if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
- struct pipe_ctx *primary_dpp_pipe = resource_get_primary_dpp_pipe(pipe_ctx);
+ struct block_sequence *step = &seq_state->steps[*seq_state->num_steps];
- seq_state->steps[*seq_state->num_steps].params.set_input_transfer_func_params =
- (struct set_input_transfer_func_params) {
- .dc = dc,
- .dpp = pipe_ctx->plane_res.dpp,
- .hubp = pipe_ctx->plane_res.hubp,
- .primary_hubp = primary_dpp_pipe ?
- primary_dpp_pipe->plane_res.hubp : pipe_ctx->plane_res.hubp,
- .ipp = pipe_ctx->plane_res.ipp,
- .mpc = dc->res_pool->mpc,
- .rmcm = pipe_ctx->plane_res.rmcm,
- .mpcc_id = pipe_ctx->plane_res.mpcc_inst,
- .plane_state = pipe_ctx->plane_state,
- .stream = pipe_ctx->stream,
- };
- seq_state->steps[*seq_state->num_steps].func = DPP_SET_INPUT_TRANSFER_FUNC;
+ step->params.set_input_transfer_func_params = *params;
+ step->func = DPP_SET_INPUT_TRANSFER_FUNC;
(*seq_state->num_steps)++;
}
}
@@ -4942,24 +4965,20 @@ void hwss_disable_audio_stream(struct dc *dc, union block_sequence_params *param
void hwss_set_input_transfer_func(struct dc *dc, struct pipe_ctx *pipe_ctx)
{
if (dc->hwseq->funcs.set_input_transfer_func) {
- struct pipe_ctx *primary_dpp_pipe = resource_get_primary_dpp_pipe(pipe_ctx);
+ struct set_input_transfer_func_params params;
- dc->hwseq->funcs.set_input_transfer_func(&(struct set_input_transfer_func_params) {
- .dc = dc,
- .dpp = pipe_ctx->plane_res.dpp,
- .hubp = pipe_ctx->plane_res.hubp,
- .primary_hubp = primary_dpp_pipe ?
- primary_dpp_pipe->plane_res.hubp : pipe_ctx->plane_res.hubp,
- .ipp = pipe_ctx->plane_res.ipp,
- .mpc = dc->res_pool->mpc,
- .rmcm = pipe_ctx->plane_res.rmcm,
- .mpcc_id = pipe_ctx->plane_res.mpcc_inst,
- .plane_state = pipe_ctx->plane_state,
- .stream = pipe_ctx->stream,
- });
+ hwss_resolve_set_input_transfer_func_params(dc, pipe_ctx, ¶ms);
+ dc->hwseq->funcs.set_input_transfer_func(¶ms);
}
}
+void hwss_dpp_set_input_transfer_func(union block_sequence_params *params)
+{
+ struct set_input_transfer_func_params *itf_params = ¶ms->set_input_transfer_func_params;
+
+ itf_params->hws->funcs.set_input_transfer_func(itf_params);
+}
+
void hwss_prepare_bandwidth(struct dc *dc, union block_sequence_params *params)
{
if (dc && dc->hwss.prepare_bandwidth)
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c
index 363961f700d9..3db6a408129d 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c
@@ -261,11 +261,11 @@ static bool dce110_enable_display_power_gating(
}
static void dce110_prescale_params(struct ipp_prescale_params *prescale_params,
- const struct dc_plane_state *plane_state)
+ enum surface_pixel_format format)
{
prescale_params->mode = IPP_PRESCALE_MODE_FIXED_UNSIGNED;
- switch (plane_state->format) {
+ switch (format) {
case SURFACE_PIXEL_FORMAT_GRPH_RGB565:
prescale_params->scale = 0x2082;
break;
@@ -293,22 +293,19 @@ static bool
dce110_set_input_transfer_func(struct set_input_transfer_func_params *params)
{
struct input_pixel_processor *ipp = params->ipp;
- struct dc_plane_state *plane_state = params->plane_state;
- const struct dc_transfer_func *tf = NULL;
+ const struct dc_transfer_func *tf = params->in_transfer_func;
struct ipp_prescale_params prescale_params = { 0 };
bool result = true;
- if (ipp == NULL)
+ if (ipp == NULL || tf == NULL)
return false;
- tf = &plane_state->in_transfer_func;
-
- dce110_prescale_params(&prescale_params, plane_state);
+ dce110_prescale_params(&prescale_params, params->format);
ipp->funcs->ipp_program_prescale(ipp, &prescale_params);
- if (!plane_state->gamma_correction.is_identity &&
- dce_use_lut(plane_state->format))
- ipp->funcs->ipp_program_input_lut(ipp, &plane_state->gamma_correction);
+ if (!params->gamma_correction->is_identity &&
+ dce_use_lut(params->format))
+ ipp->funcs->ipp_program_input_lut(ipp, params->gamma_correction);
if (tf->type == TF_TYPE_PREDEFINED) {
switch (tf->tf) {
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c
index 5ce73286f8f2..10f755d7b182 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c
@@ -2119,19 +2119,16 @@ void dcn10_update_plane_addr(const struct dc *dc, struct pipe_ctx *pipe_ctx)
bool dcn10_set_input_transfer_func(struct set_input_transfer_func_params *params)
{
struct dpp *dpp = params->dpp;
- struct dc_plane_state *plane_state = params->plane_state;
- const struct dc_transfer_func *tf = NULL;
+ const struct dc_transfer_func *tf = params->in_transfer_func;
bool result = true;
- if (dpp == NULL)
+ if (dpp == NULL || tf == NULL)
return false;
- tf = &plane_state->in_transfer_func;
-
- if (!dpp->ctx->dc->debug.always_use_regamma
- && !plane_state->gamma_correction.is_identity
- && dce_use_lut(plane_state->format))
- dpp->funcs->dpp_program_input_lut(dpp, &plane_state->gamma_correction);
+ if (!params->always_use_regamma
+ && !params->gamma_correction->is_identity
+ && dce_use_lut(params->format))
+ dpp->funcs->dpp_program_input_lut(dpp, params->gamma_correction);
if (tf->type == TF_TYPE_PREDEFINED) {
switch (tf->tf) {
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c
index 356ca90bf9bb..0f88195a5487 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c
@@ -723,7 +723,8 @@ void dcn20_plane_atomic_disable(struct dc *dc, struct pipe_ctx *pipe_ctx)
/* Clearing 3DLUT fast load writes to HUBP, so it must precede hubp_clk_cntl() below */
if (hws->funcs.disable_rmcm_luts)
- hws->funcs.disable_rmcm_luts(dc, pipe_ctx->plane_res.rmcm, hubp, pipe_ctx->plane_res.mpcc_inst);
+ hws->funcs.disable_rmcm_luts(dc->res_pool->rmcm, dc->res_pool->res_cap->num_rmcm,
+ pipe_ctx->plane_res.rmcm, hubp, pipe_ctx->plane_res.mpcc_inst);
dc->hwss.wait_for_mpcc_disconnect(dc, dc->res_pool, pipe_ctx);
@@ -1088,16 +1089,16 @@ bool dcn20_set_output_transfer_func(struct set_output_transfer_func_params *otf_
}
bool dcn20_set_blend_lut(
- struct dpp *dpp, struct dc_plane_state *plane_state)
+ struct dpp *dpp, const struct dc_transfer_func *blend_func)
{
bool result = true;
const struct pwl_params *blend_lut = NULL;
- if (plane_state->cm.blend_func.type == TF_TYPE_HWPWL)
- blend_lut = &plane_state->cm.blend_func.pwl;
- else if (plane_state->cm.blend_func.type == TF_TYPE_DISTRIBUTED_POINTS) {
- cm_helper_translate_curve_to_hw_format(plane_state->ctx,
- &plane_state->cm.blend_func,
+ if (blend_func->type == TF_TYPE_HWPWL)
+ blend_lut = &blend_func->pwl;
+ else if (blend_func->type == TF_TYPE_DISTRIBUTED_POINTS) {
+ cm_helper_translate_curve_to_hw_format(dpp->ctx,
+ blend_func,
&dpp->regamma_params, false);
blend_lut = &dpp->regamma_params;
}
@@ -1107,24 +1108,25 @@ bool dcn20_set_blend_lut(
}
bool dcn20_set_shaper_3dlut(
- struct dpp *dpp, struct dc_plane_state *plane_state)
+ struct dpp *dpp, const struct dc_transfer_func *shaper_func,
+ const struct dc_3dlut *lut3d_func)
{
bool result = true;
const struct pwl_params *shaper_lut = NULL;
- if (plane_state->cm.shaper_func.type == TF_TYPE_HWPWL)
- shaper_lut = &plane_state->cm.shaper_func.pwl;
- else if (plane_state->cm.shaper_func.type == TF_TYPE_DISTRIBUTED_POINTS) {
- cm_helper_translate_curve_to_hw_format(plane_state->ctx,
- &plane_state->cm.shaper_func,
+ if (shaper_func->type == TF_TYPE_HWPWL)
+ shaper_lut = &shaper_func->pwl;
+ else if (shaper_func->type == TF_TYPE_DISTRIBUTED_POINTS) {
+ cm_helper_translate_curve_to_hw_format(dpp->ctx,
+ shaper_func,
&dpp->shaper_params, true);
shaper_lut = &dpp->shaper_params;
}
dpp->funcs->dpp_program_shaper_lut(dpp, shaper_lut);
- if (plane_state->cm.lut3d_func.state.bits.initialized == 1)
+ if (lut3d_func->state.bits.initialized == 1)
result = dpp->funcs->dpp_program_3dlut(dpp,
- &plane_state->cm.lut3d_func.lut_3d);
+ &lut3d_func->lut_3d);
else
result = dpp->funcs->dpp_program_3dlut(dpp, NULL);
@@ -1134,19 +1136,16 @@ bool dcn20_set_shaper_3dlut(
bool dcn20_set_input_transfer_func(struct set_input_transfer_func_params *params)
{
struct dpp *dpp = params->dpp;
- struct dc_plane_state *plane_state = params->plane_state;
- struct dce_hwseq *hws = params->dc->hwseq;
- const struct dc_transfer_func *tf = NULL;
+ struct dce_hwseq *hws = params->hws;
+ const struct dc_transfer_func *tf = params->in_transfer_func;
bool result = true;
bool use_degamma_ram = false;
- if (dpp == NULL || plane_state == NULL)
+ if (dpp == NULL || tf == NULL)
return false;
- hws->funcs.set_shaper_3dlut(dpp, plane_state);
- hws->funcs.set_blend_lut(dpp, plane_state);
-
- tf = &plane_state->in_transfer_func;
+ hws->funcs.set_shaper_3dlut(dpp, ¶ms->cm->shaper_func, ¶ms->cm->lut3d_func);
+ hws->funcs.set_blend_lut(dpp, ¶ms->cm->blend_func);
if (tf->type == TF_TYPE_HWPWL || tf->type == TF_TYPE_DISTRIBUTED_POINTS)
use_degamma_ram = true;
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.h b/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.h
index e2f65c3748de..30ac1f009531 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.h
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.h
@@ -31,9 +31,10 @@
void dcn20_log_color_state(struct dc *dc,
struct dc_log_buffer_ctx *log_ctx);
bool dcn20_set_blend_lut(
- struct dpp *dpp, struct dc_plane_state *plane_state);
+ struct dpp *dpp, const struct dc_transfer_func *blend_func);
bool dcn20_set_shaper_3dlut(
- struct dpp *dpp, struct dc_plane_state *plane_state);
+ struct dpp *dpp, const struct dc_transfer_func *shaper_func,
+ const struct dc_3dlut *lut3d_func);
void dcn20_program_front_end_for_ctx(
struct dc *dc,
struct dc_state *context);
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c
index c4500617dc85..7c873e5c48fa 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c
@@ -234,16 +234,16 @@ void dcn30_log_color_state(struct dc *dc,
}
bool dcn30_set_blend_lut(
- struct dpp *dpp, struct dc_plane_state *plane_state)
+ struct dpp *dpp, const struct dc_transfer_func *blend_func)
{
bool result = true;
const struct pwl_params *blend_lut = NULL;
- if (plane_state->cm.blend_func.type == TF_TYPE_HWPWL)
- blend_lut = &plane_state->cm.blend_func.pwl;
- else if (plane_state->cm.blend_func.type == TF_TYPE_DISTRIBUTED_POINTS) {
+ if (blend_func->type == TF_TYPE_HWPWL)
+ blend_lut = &blend_func->pwl;
+ else if (blend_func->type == TF_TYPE_DISTRIBUTED_POINTS) {
result = cm3_helper_translate_curve_to_degamma_hw_format(
- &plane_state->cm.blend_func,
+ blend_func,
&dpp->regamma_params);
if (!result)
return result;
@@ -315,36 +315,36 @@ static bool dcn30_set_mpc_shaper_3dlut(struct dpp *dpp, struct mpc *mpc,
bool dcn30_set_input_transfer_func(struct set_input_transfer_func_params *params)
{
struct dpp *dpp = params->dpp;
- struct dce_hwseq *hws = params->dc->hwseq;
- struct dc_plane_state *plane_state = params->plane_state;
+ struct dce_hwseq *hws = params->hws;
+ const struct dc_transfer_func *in_tf = params->in_transfer_func;
enum dc_transfer_func_predefined tf;
bool result = true;
const struct pwl_params *pwl_params = NULL;
- if (dpp == NULL || plane_state == NULL)
+ if (dpp == NULL || in_tf == NULL)
return false;
tf = TRANSFER_FUNCTION_UNITY;
- if (plane_state->in_transfer_func.type == TF_TYPE_PREDEFINED)
- tf = plane_state->in_transfer_func.tf;
+ if (in_tf->type == TF_TYPE_PREDEFINED)
+ tf = in_tf->tf;
dpp->funcs->dpp_set_pre_degam(dpp, tf);
- if (plane_state->in_transfer_func.type == TF_TYPE_HWPWL)
- pwl_params = &plane_state->in_transfer_func.pwl;
- else if (plane_state->in_transfer_func.type == TF_TYPE_DISTRIBUTED_POINTS &&
- cm3_helper_translate_curve_to_degamma_hw_format(&plane_state->in_transfer_func,
+ if (in_tf->type == TF_TYPE_HWPWL)
+ pwl_params = &in_tf->pwl;
+ else if (in_tf->type == TF_TYPE_DISTRIBUTED_POINTS &&
+ cm3_helper_translate_curve_to_degamma_hw_format(in_tf,
&dpp->degamma_params))
pwl_params = &dpp->degamma_params;
result = dpp->funcs->dpp_program_gamcor_lut(dpp, pwl_params);
if (dpp->funcs->dpp_program_blnd_lut)
- hws->funcs.set_blend_lut(dpp, plane_state);
+ hws->funcs.set_blend_lut(dpp, ¶ms->cm->blend_func);
if (dpp->funcs->dpp_program_shaper_lut &&
dpp->funcs->dpp_program_3dlut)
- hws->funcs.set_shaper_3dlut(dpp, plane_state);
+ hws->funcs.set_shaper_3dlut(dpp, ¶ms->cm->shaper_func, ¶ms->cm->lut3d_func);
return result;
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.h b/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.h
index 61470a51da23..70cf1f6fe904 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.h
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.h
@@ -57,7 +57,7 @@ void dcn30_log_color_state(struct dc *dc,
struct dc_log_buffer_ctx *log_ctx);
bool dcn30_set_blend_lut(struct dpp *dpp,
- struct dc_plane_state *plane_state);
+ const struct dc_transfer_func *blend_func);
bool dcn30_set_input_transfer_func(struct set_input_transfer_func_params *params);
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c
index 945052b1808f..cdb80e96cf31 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c
@@ -466,25 +466,21 @@ bool dcn32_set_mpc_shaper_3dlut(struct dpp *dpp, struct mpc *mpc,
return result;
}
-bool dcn32_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp,
- struct hubp *primary_hubp, struct mpc *mpc, int mpcc_id,
- struct dc_stream_state *stream,
- struct dc_plane_state *plane_state)
+bool dcn32_set_mcm_luts(const struct set_mcm_luts_params *params)
{
+ struct dpp *dpp = params->dpp;
+ struct mpc *mpc = params->mpc;
+ int mpcc_id = params->mpcc_id;
bool rval, result;
const struct pwl_params *lut_params = NULL;
-
- (void)dc;
- (void)hubp;
- (void)primary_hubp;
- (void)stream;
+ const struct dc_plane_cm *cm = params->cm;
// 1D LUT
- if (plane_state->cm.blend_func.type == TF_TYPE_HWPWL)
- lut_params = &plane_state->cm.blend_func.pwl;
- else if (plane_state->cm.blend_func.type == TF_TYPE_DISTRIBUTED_POINTS) {
+ if (cm->blend_func.type == TF_TYPE_HWPWL)
+ lut_params = &cm->blend_func.pwl;
+ else if (cm->blend_func.type == TF_TYPE_DISTRIBUTED_POINTS) {
result = cm3_helper_translate_curve_to_degamma_hw_format(
- &plane_state->cm.blend_func,
+ &cm->blend_func,
&dpp->regamma_params);
if (!result)
return result;
@@ -495,12 +491,12 @@ bool dcn32_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp,
lut_params = NULL;
// Shaper
- if (plane_state->cm.shaper_func.type == TF_TYPE_HWPWL)
- lut_params = &plane_state->cm.shaper_func.pwl;
- else if (plane_state->cm.shaper_func.type == TF_TYPE_DISTRIBUTED_POINTS) {
+ if (cm->shaper_func.type == TF_TYPE_HWPWL)
+ lut_params = &cm->shaper_func.pwl;
+ else if (cm->shaper_func.type == TF_TYPE_DISTRIBUTED_POINTS) {
// TODO: dpp replace
- rval = cm3_helper_translate_curve_to_hw_format(plane_state->ctx,
- &plane_state->cm.shaper_func,
+ rval = cm3_helper_translate_curve_to_hw_format(dpp->ctx,
+ &cm->shaper_func,
&dpp->shaper_params,
true);
lut_params = rval ? &dpp->shaper_params : NULL;
@@ -509,8 +505,8 @@ bool dcn32_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp,
mpc->funcs->program_shaper(mpc, lut_params, mpcc_id);
// 3D
- if (plane_state->cm.lut3d_func.state.bits.initialized == 1)
- result = mpc->funcs->program_3dlut(mpc, &plane_state->cm.lut3d_func.lut_3d, mpcc_id);
+ if (cm->lut3d_func.state.bits.initialized == 1)
+ result = mpc->funcs->program_3dlut(mpc, &cm->lut3d_func.lut_3d, mpcc_id);
else
result = mpc->funcs->program_3dlut(mpc, NULL, mpcc_id);
@@ -537,32 +533,32 @@ static bool is_source_pixel_format_linear(enum surface_pixel_format format)
bool dcn32_set_input_transfer_func(struct set_input_transfer_func_params *params)
{
- struct dce_hwseq *hws = params->dc->hwseq;
+ struct dce_hwseq *hws = params->hws;
struct dpp *dpp = params->dpp;
- struct dc_plane_state *plane_state = params->plane_state;
+ const struct dc_transfer_func *in_tf = params->in_transfer_func;
enum dc_transfer_func_predefined tf;
bool result = true;
const struct pwl_params *pwl_params = NULL;
- if (params->mpc == NULL || plane_state == NULL)
+ if (params->mpc == NULL || in_tf == NULL)
return false;
tf = TRANSFER_FUNCTION_UNITY;
- if (plane_state->in_transfer_func.type == TF_TYPE_PREDEFINED)
- tf = plane_state->in_transfer_func.tf;
+ if (in_tf->type == TF_TYPE_PREDEFINED)
+ tf = in_tf->tf;
if (dpp->funcs->dpp_set_pregam_state)
- dpp->funcs->dpp_set_pregam_state(dpp, tf, plane_state->scaling_linearity,
- is_source_pixel_format_linear(plane_state->format));
+ dpp->funcs->dpp_set_pregam_state(dpp, tf, params->scaling_linearity,
+ is_source_pixel_format_linear(params->format));
else
dpp->funcs->dpp_set_pre_degam(dpp, tf);
- if (plane_state->in_transfer_func.type == TF_TYPE_HWPWL)
- pwl_params = &plane_state->in_transfer_func.pwl;
- else if (plane_state->in_transfer_func.type == TF_TYPE_DISTRIBUTED_POINTS &&
- cm3_helper_translate_curve_to_degamma_hw_format(&plane_state->in_transfer_func,
+ if (in_tf->type == TF_TYPE_HWPWL)
+ pwl_params = &in_tf->pwl;
+ else if (in_tf->type == TF_TYPE_DISTRIBUTED_POINTS &&
+ cm3_helper_translate_curve_to_degamma_hw_format(in_tf,
&dpp->degamma_params))
pwl_params = &dpp->degamma_params;
@@ -571,20 +567,46 @@ bool dcn32_set_input_transfer_func(struct set_input_transfer_func_params *params
/* MCM and RMCM are mutually exclusive - tear the inactive one out before programming
* the active one, which then owns the shared HUBP 3DLUT fast load.
*/
- if (plane_state->cm.flags.bits.rmcm_enable && hws->funcs.set_rmcm_luts) {
+ if (params->rmcm_enable && hws->funcs.set_rmcm_luts) {
+ const struct set_rmcm_luts_params rmcm_params = {
+ .dpp = params->dpp,
+ .hubp = params->hubp,
+ .rmcm = params->rmcm,
+ .rmcm_pool = params->rmcm_pool,
+ .rmcm_count = params->rmcm_count,
+ .mpcc_id = params->mpcc_id,
+ .shaper_enable = params->shaper_enable,
+ .lut3d_enable = params->lut3d_enable,
+ .lut3d_dma_enable = params->lut3d_dma_enable,
+ .cm = params->cm,
+ };
+
if (hws->funcs.disable_mcm_luts)
hws->funcs.disable_mcm_luts(params->mpc, params->mpcc_id);
- result = hws->funcs.set_rmcm_luts(params);
+ result = hws->funcs.set_rmcm_luts(&rmcm_params);
} else {
if (hws->funcs.disable_rmcm_luts)
- hws->funcs.disable_rmcm_luts(params->dc, params->rmcm,
- params->hubp, params->mpcc_id);
-
- if (hws->funcs.set_mcm_luts)
- result = hws->funcs.set_mcm_luts(params->dc, dpp, params->hubp,
- params->primary_hubp, params->mpc, params->mpcc_id,
- params->stream, plane_state);
+ hws->funcs.disable_rmcm_luts(params->rmcm_pool, params->rmcm_count,
+ params->rmcm, params->hubp, params->mpcc_id);
+
+ if (hws->funcs.set_mcm_luts) {
+ const struct set_mcm_luts_params mcm_params = {
+ .dpp = params->dpp,
+ .hubp = params->hubp,
+ .primary_hubp = params->primary_hubp,
+ .mpc = params->mpc,
+ .mpcc_id = params->mpcc_id,
+ .blend_enable = params->blend_enable,
+ .shaper_enable = params->shaper_enable,
+ .lut3d_enable = params->lut3d_enable,
+ .lut3d_dma_enable = params->lut3d_dma_enable,
+ .rmcm_enable = params->rmcm_enable,
+ .cm = params->cm,
+ };
+
+ result = hws->funcs.set_mcm_luts(&mcm_params);
+ }
}
return result;
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.h b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.h
index 3db34bff3847..3c6650ef7b53 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.h
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.h
@@ -48,10 +48,7 @@ void dcn32_cab_for_ss_control(struct dc *dc, bool enable);
void dcn32_commit_subvp_config(struct dc *dc, struct dc_state *context);
-bool dcn32_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp,
- struct hubp *primary_hubp, struct mpc *mpc, int mpcc_id,
- struct dc_stream_state *stream,
- struct dc_plane_state *plane_state);
+bool dcn32_set_mcm_luts(const struct set_mcm_luts_params *params);
bool dcn32_set_input_transfer_func(struct set_input_transfer_func_params *params);
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c
index d24569870a2d..8ecd7aac5367 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c
@@ -893,7 +893,8 @@ void dcn35_plane_atomic_disable(struct dc *dc, struct pipe_ctx *pipe_ctx)
/* Clearing 3DLUT fast load writes to HUBP, so it must precede hubp_clk_cntl() below */
if (hws->funcs.disable_rmcm_luts)
- hws->funcs.disable_rmcm_luts(dc, pipe_ctx->plane_res.rmcm, hubp, pipe_ctx->plane_res.mpcc_inst);
+ hws->funcs.disable_rmcm_luts(dc->res_pool->rmcm, dc->res_pool->res_cap->num_rmcm,
+ pipe_ctx->plane_res.rmcm, hubp, pipe_ctx->plane_res.mpcc_inst);
dc->hwss.wait_for_mpcc_disconnect(dc, dc->res_pool, pipe_ctx);
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c
index 26b9137dc017..01ee57c88ca7 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c
@@ -419,12 +419,15 @@ void dcn401_trigger_3dlut_dma_load(struct pipe_ctx *pipe_ctx)
}
}
-bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp,
- struct hubp *primary_hubp, struct mpc *mpc, int mpcc_id,
- struct dc_stream_state *stream,
- struct dc_plane_state *plane_state)
+bool dcn401_set_mcm_luts(const struct set_mcm_luts_params *params)
{
- const struct dc_plane_cm *cm = &plane_state->cm;
+ struct dpp *dpp = params->dpp;
+ struct hubp *hubp = params->hubp;
+ struct hubp *primary_hubp = params->primary_hubp;
+ struct mpc *mpc = params->mpc;
+ int mpcc_id = params->mpcc_id;
+ const struct dc_3dlut_dma *cm_lut3d_dma = ¶ms->cm->lut3d_dma;
+ const struct dc_3dlut *lut3d_func = ¶ms->cm->lut3d_func;
union mcm_lut_params m_lut_params;
struct dc_3dlut_dma lut3d_dma;
bool lut_enable;
@@ -432,9 +435,6 @@ bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp,
bool rval;
bool result = true;
- (void)dc;
- (void)stream;
-
/* decide LUT bank based on current in use */
mpc->funcs->get_lut_mode(mpc, MCM_LUT_1DLUT, mpcc_id, &lut_enable, &lut_bank_a);
if (!lut_enable) {
@@ -453,17 +453,17 @@ bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp,
mpc->funcs->set_movable_cm_location(mpc, MPCC_MOVABLE_CM_LOCATION_BEFORE, mpcc_id);
/* 1D LUT */
- lut_enable = cm->flags.bits.blend_enable != 0u;
- if (cm->flags.bits.rmcm_enable)
+ lut_enable = params->blend_enable;
+ if (params->rmcm_enable)
lut_enable = false;
memset(&m_lut_params, 0, sizeof(m_lut_params));
if (lut_enable) {
- if (cm->blend_func.type == TF_TYPE_HWPWL)
- m_lut_params.pwl = &cm->blend_func.pwl;
- else if (cm->blend_func.type == TF_TYPE_DISTRIBUTED_POINTS) {
- rval = cm3_helper_translate_curve_to_hw_format(plane_state->ctx,
- &cm->blend_func,
+ if (params->cm->blend_func.type == TF_TYPE_HWPWL)
+ m_lut_params.pwl = ¶ms->cm->blend_func.pwl;
+ else if (params->cm->blend_func.type == TF_TYPE_DISTRIBUTED_POINTS) {
+ rval = cm3_helper_translate_curve_to_hw_format(dpp->ctx,
+ ¶ms->cm->blend_func,
&dpp->regamma_params,
false);
m_lut_params.pwl = rval ? &dpp->regamma_params : NULL;
@@ -482,18 +482,18 @@ bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp,
mpc->funcs->populate_lut(mpc, MCM_LUT_1DLUT, &m_lut_params, lut_bank_a, mpcc_id);
/* Shaper */
- lut_enable = cm->flags.bits.shaper_enable != 0u;
- if (cm->flags.bits.rmcm_enable)
+ lut_enable = params->shaper_enable;
+ if (params->rmcm_enable)
lut_enable = false;
if (lut_enable) {
memset(&m_lut_params, 0, sizeof(m_lut_params));
- if (cm->shaper_func.type == TF_TYPE_HWPWL)
- m_lut_params.pwl = &cm->shaper_func.pwl;
- else if (cm->shaper_func.type == TF_TYPE_DISTRIBUTED_POINTS) {
+ if (params->cm->shaper_func.type == TF_TYPE_HWPWL)
+ m_lut_params.pwl = ¶ms->cm->shaper_func.pwl;
+ else if (params->cm->shaper_func.type == TF_TYPE_DISTRIBUTED_POINTS) {
ASSERT(false);
- rval = cm3_helper_translate_curve_to_hw_format(plane_state->ctx,
- &cm->shaper_func,
+ rval = cm3_helper_translate_curve_to_hw_format(dpp->ctx,
+ ¶ms->cm->shaper_func,
&dpp->shaper_params,
true);
m_lut_params.pwl = rval ? &dpp->shaper_params : NULL;
@@ -516,15 +516,16 @@ bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp,
*/
/* 3DLUT */
- lut_enable = cm->flags.bits.lut3d_enable != 0u;
- if (cm->flags.bits.rmcm_enable)
+ lut_enable = params->lut3d_enable;
+ if (params->rmcm_enable)
lut_enable = false;
- if (lut_enable && cm->flags.bits.lut3d_dma_enable) {
+ if (lut_enable && params->lut3d_dma_enable) {
/* Fast (DMA) Load Mode */
/* MPC */
if (mpc->funcs->program_lut_mode)
- mpc->funcs->program_lut_mode(mpc, MCM_LUT_3DLUT, lut_enable, lut_bank_a, cm->lut3d_dma.size, mpcc_id);
+ mpc->funcs->program_lut_mode(mpc, MCM_LUT_3DLUT, lut_enable, lut_bank_a,
+ cm_lut3d_dma->size, mpcc_id);
/* only supports 12 bit */
if (mpc->funcs->program_lut_read_write_control)
@@ -537,13 +538,13 @@ bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp,
if (primary_hubp->inst == hubp->inst) {
/* only program if this is the primary dpp pipe for the given plane */
if (hubp->funcs->hubp_program_3dlut_fl_config)
- hubp->funcs->hubp_program_3dlut_fl_config(hubp, &cm->lut3d_dma);
+ hubp->funcs->hubp_program_3dlut_fl_config(hubp, cm_lut3d_dma);
if (hubp->funcs->hubp_program_3dlut_fl_crossbar)
- hubp->funcs->hubp_program_3dlut_fl_crossbar(hubp, cm->lut3d_dma.format);
+ hubp->funcs->hubp_program_3dlut_fl_crossbar(hubp, cm_lut3d_dma->format);
if (hubp->funcs->hubp_program_3dlut_fl_addr)
- hubp->funcs->hubp_program_3dlut_fl_addr(hubp, &cm->lut3d_dma.addr);
+ hubp->funcs->hubp_program_3dlut_fl_addr(hubp, &cm_lut3d_dma->addr);
if (hubp->funcs->hubp_enable_3dlut_fl) {
hubp->funcs->hubp_enable_3dlut_fl(hubp, true);
@@ -555,9 +556,8 @@ bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp,
}
} else {
/* re-trigger primary HUBP to load 3DLUT */
- if (primary_hubp->funcs->hubp_enable_3dlut_fl) {
+ if (primary_hubp->funcs->hubp_enable_3dlut_fl)
primary_hubp->funcs->hubp_enable_3dlut_fl(primary_hubp, true);
- }
/* clear FL setup on this pipe's HUBP */
memset(&lut3d_dma, 0, sizeof(lut3d_dma));
@@ -571,8 +571,8 @@ bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp,
/* Legacy (Host) Load Mode */
memset(&m_lut_params, 0, sizeof(m_lut_params));
- if (cm->flags.bits.lut3d_enable && cm->lut3d_func.state.bits.initialized) {
- m_lut_params.lut3d = &cm->lut3d_func.lut_3d;
+ if (params->lut3d_enable && lut3d_func->state.bits.initialized) {
+ m_lut_params.lut3d = &lut3d_func->lut_3d;
} else {
lut_enable = false;
}
@@ -583,7 +583,7 @@ bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp,
MCM_LUT_3DLUT,
lut_enable,
lut_bank_a,
- cm->lut3d_func.lut_3d.use_tetrahedral_9 ? CM_LUT_SIZE_999 : CM_LUT_SIZE_171717,
+ lut3d_func->lut_3d.use_tetrahedral_9 ? CM_LUT_SIZE_999 : CM_LUT_SIZE_171717,
mpcc_id);
if (lut_enable) {
@@ -591,7 +591,7 @@ bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp,
mpc->funcs->program_lut_read_write_control(mpc,
MCM_LUT_3DLUT,
lut_bank_a,
- cm->lut3d_func.lut_3d.use_12bits ? 12 : 10,
+ lut3d_func->lut_3d.use_12bits ? 12 : 10,
mpcc_id);
if (mpc->funcs->update_3dlut_fast_load_select)
@@ -2521,8 +2521,10 @@ void dcn401_program_pipe_sequence(
pipe_ctx->plane_state->update_bits.gamma_change ||
pipe_ctx->plane_state->update_bits.lut_3d ||
pipe_ctx->update_flags.bits.enable)) {
+ struct set_input_transfer_func_params itf_params;
- hwss_add_dpp_set_input_transfer_func(seq_state, dc, pipe_ctx);
+ hwss_resolve_set_input_transfer_func_params(dc, pipe_ctx, &itf_params);
+ hwss_add_dpp_set_input_transfer_func(seq_state, &itf_params);
}
/* dcn10_translate_regamma_to_hw_format takes 750us to finish
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.h b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.h
index c95d929b453c..456f997286e3 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.h
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.h
@@ -37,10 +37,7 @@ void dcn401_program_gamut_remap(struct program_gamut_remap_params *params);
void dcn401_init_hw(struct dc *dc);
-bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp,
- struct hubp *primary_hubp, struct mpc *mpc, int mpcc_id,
- struct dc_stream_state *stream,
- struct dc_plane_state *plane_state);
+bool dcn401_set_mcm_luts(const struct set_mcm_luts_params *params);
bool dcn401_set_output_transfer_func(struct set_output_transfer_func_params *params);
void dcn401_trigger_3dlut_dma_load(struct pipe_ctx *pipe_ctx);
void dcn401_calculate_dccg_tmds_div_value(struct pipe_ctx *pipe_ctx,
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.c
index 62876d489b8e..14a9f5240bd2 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.c
@@ -448,12 +448,16 @@ static void dcn42_detach_rmcm(struct rmcm *rmcm)
* instance that could still point at this MPCC. One the driver has not programmed yet counts,
* as its MPC_RMCM_CNTL may still hold a boot value.
*/
-void dcn42_release_rmcm_from_mpcc(struct dc *dc, int mpcc_id, const struct rmcm *keep)
+void dcn42_release_rmcm_from_mpcc(struct rmcm **rmcm_pool, int rmcm_count,
+ int mpcc_id, const struct rmcm *keep)
{
int i;
- for (i = 0; i < dc->res_pool->res_cap->num_rmcm && i < MAX_RMCM_INST; i++) {
- struct rmcm *rmcm = dc->res_pool->rmcm[i];
+ if (!rmcm_pool)
+ return;
+
+ for (i = 0; i < rmcm_count && i < MAX_RMCM_INST; i++) {
+ struct rmcm *rmcm = rmcm_pool[i];
if (!rmcm || !rmcm->funcs)
continue;
@@ -472,7 +476,8 @@ void dcn42_release_rmcm_from_mpcc(struct dc *dc, int mpcc_id, const struct rmcm
/* Leaves mpcc_id with no RMCM in its path. A NULL hubp keeps the shared 3DLUT fast load
* untouched, for when another block already owns that HUBP.
*/
-void dcn42_disable_rmcm_luts(struct dc *dc, struct rmcm *rmcm, struct hubp *hubp, int mpcc_id)
+void dcn42_disable_rmcm_luts(struct rmcm **rmcm_pool, int rmcm_count,
+ struct rmcm *rmcm, struct hubp *hubp, int mpcc_id)
{
if (rmcm && rmcm->funcs) {
/* HW blocks 3DLUT writes until FL mode is cleared from HUBP on VUpdate, so
@@ -485,14 +490,15 @@ void dcn42_disable_rmcm_luts(struct dc *dc, struct rmcm *rmcm, struct hubp *hubp
dcn42_detach_rmcm(rmcm);
}
- dcn42_release_rmcm_from_mpcc(dc, mpcc_id, NULL);
+ dcn42_release_rmcm_from_mpcc(rmcm_pool, rmcm_count, mpcc_id, NULL);
}
-bool dcn42_set_rmcm_luts(struct set_input_transfer_func_params *params)
+bool dcn42_set_rmcm_luts(const struct set_rmcm_luts_params *params)
{
struct dpp *dpp_base = params->dpp;
struct hubp *hubp = params->hubp;
- const struct dc_plane_cm *cm = ¶ms->plane_state->cm;
+ const struct dc_transfer_func *shaper_func = ¶ms->cm->shaper_func;
+ const struct dc_3dlut_dma *cm_lut3d_dma = ¶ms->cm->lut3d_dma;
struct rmcm *rmcm = params->rmcm;
int rmcm_inst;
union rmcm_lut_params m_lut_params = {0};
@@ -526,15 +532,15 @@ bool dcn42_set_rmcm_luts(struct set_input_transfer_func_params *params)
}
/* Shaper */
- lut_enable = cm->flags.bits.shaper_enable != 0;
+ lut_enable = params->shaper_enable;
if (lut_enable) {
memset(&m_lut_params, 0, sizeof(m_lut_params));
- if (cm->shaper_func.type == TF_TYPE_HWPWL)
- m_lut_params.pwl = &cm->shaper_func.pwl;
- else if (cm->shaper_func.type == TF_TYPE_DISTRIBUTED_POINTS) {
+ if (shaper_func->type == TF_TYPE_HWPWL)
+ m_lut_params.pwl = &shaper_func->pwl;
+ else if (shaper_func->type == TF_TYPE_DISTRIBUTED_POINTS) {
ASSERT(false);
- rval = cm_helper_translate_curve_to_hw_format(params->plane_state->ctx,
- &cm->shaper_func,
+ rval = cm_helper_translate_curve_to_hw_format(dpp_base->ctx,
+ shaper_func,
&dpp_base->shaper_params,
true);
m_lut_params.pwl = rval ? &dpp_base->shaper_params : NULL;
@@ -558,13 +564,13 @@ bool dcn42_set_rmcm_luts(struct set_input_transfer_func_params *params)
*/
/* 3DLUT */
- lut_enable = cm->flags.bits.lut3d_enable != 0;
- if (lut_enable && cm->flags.bits.lut3d_dma_enable) {
+ lut_enable = params->lut3d_enable;
+ if (lut_enable && params->lut3d_dma_enable) {
/* Fast (DMA) Load Mode */
if (rmcm->funcs->program_lut_mode)
rmcm->funcs->program_lut_mode(rmcm, MCM_LUT_3DLUT, lut_enable, lut_bank_a,
- cm->lut3d_dma.size,
- cm->lut3d_dma.bias, cm->lut3d_dma.scale,
+ cm_lut3d_dma->size,
+ cm_lut3d_dma->bias, cm_lut3d_dma->scale,
rmcm_inst);
if (rmcm->funcs->program_lut_read_write_control)
@@ -575,13 +581,13 @@ bool dcn42_set_rmcm_luts(struct set_input_transfer_func_params *params)
/* HUBP */
if (hubp->funcs->hubp_program_3dlut_fl_config)
- hubp->funcs->hubp_program_3dlut_fl_config(hubp, &cm->lut3d_dma);
+ hubp->funcs->hubp_program_3dlut_fl_config(hubp, cm_lut3d_dma);
if (hubp->funcs->hubp_program_3dlut_fl_crossbar)
- hubp->funcs->hubp_program_3dlut_fl_crossbar(hubp, cm->lut3d_dma.format);
+ hubp->funcs->hubp_program_3dlut_fl_crossbar(hubp, cm_lut3d_dma->format);
if (hubp->funcs->hubp_program_3dlut_fl_addr)
- hubp->funcs->hubp_program_3dlut_fl_addr(hubp, &cm->lut3d_dma.addr);
+ hubp->funcs->hubp_program_3dlut_fl_addr(hubp, &cm_lut3d_dma->addr);
if (hubp->funcs->hubp_enable_3dlut_fl) {
hubp->funcs->hubp_enable_3dlut_fl(hubp, true);
@@ -618,7 +624,7 @@ bool dcn42_set_rmcm_luts(struct set_input_transfer_func_params *params)
/* Connect to the MPCC only once the LUTs are loaded. Teardown is done by
* disable_rmcm_luts, at plane teardown or when the plane switches back to MCM.
*/
- dcn42_release_rmcm_from_mpcc(params->dc, params->mpcc_id, rmcm);
+ dcn42_release_rmcm_from_mpcc(params->rmcm_pool, params->rmcm_count, params->mpcc_id, rmcm);
if (rmcm->funcs->connect_mpcc)
rmcm->funcs->connect_mpcc(rmcm, rmcm_inst, params->mpcc_id);
@@ -626,16 +632,12 @@ bool dcn42_set_rmcm_luts(struct set_input_transfer_func_params *params)
return result;
}
-bool dcn42_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp,
- struct hubp *primary_hubp, struct mpc *mpc, int mpcc_id,
- struct dc_stream_state *stream,
- struct dc_plane_state *plane_state)
+bool dcn42_set_mcm_luts(const struct set_mcm_luts_params *params)
{
bool result;
/* MCM */
- result = dcn401_set_mcm_luts(dc, dpp, hubp, primary_hubp, mpc, mpcc_id,
- stream, plane_state);
+ result = dcn401_set_mcm_luts(params);
return result;
}
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.h b/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.h
index 2e5523617f29..2121c9f31128 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.h
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.h
@@ -15,17 +15,16 @@ void dcn42_program_cm_hist(
struct pipe_ctx *pipe_ctx,
const struct dc_plane_state *plane_state);
-bool dcn42_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp,
- struct hubp *primary_hubp, struct mpc *mpc, int mpcc_id,
- struct dc_stream_state *stream,
- struct dc_plane_state *plane_state);
+bool dcn42_set_mcm_luts(const struct set_mcm_luts_params *params);
-void dcn42_disable_rmcm_luts(struct dc *dc, struct rmcm *rmcm, struct hubp *hubp, int mpcc_id);
-void dcn42_release_rmcm_from_mpcc(struct dc *dc, int mpcc_id, const struct rmcm *keep);
+void dcn42_disable_rmcm_luts(struct rmcm **rmcm_pool, int rmcm_count,
+ struct rmcm *rmcm, struct hubp *hubp, int mpcc_id);
+void dcn42_release_rmcm_from_mpcc(struct rmcm **rmcm_pool, int rmcm_count,
+ int mpcc_id, const struct rmcm *keep);
void dcn42_disable_mcm_luts(struct mpc *mpc, int mpcc_id);
void dcn42_trigger_3dlut_dma_load(struct pipe_ctx *pipe_ctx);
-bool dcn42_set_rmcm_luts(struct set_input_transfer_func_params *params);
+bool dcn42_set_rmcm_luts(const struct set_rmcm_luts_params *params);
void dcn42_hardware_release(struct dc *dc);
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.c
index 67b778001bce..a0367632d01a 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.c
@@ -52,11 +52,12 @@
#define FN(reg_name, field_name) \
hws->shifts->field_name, hws->masks->field_name
-bool dcn60_set_rmcm_luts(struct set_input_transfer_func_params *params)
+bool dcn60_set_rmcm_luts(const struct set_rmcm_luts_params *params)
{
struct dpp *dpp_base = params->dpp;
struct hubp *hubp = params->hubp;
- const struct dc_plane_cm *cm = ¶ms->plane_state->cm;
+ const struct dc_transfer_func *shaper_func = ¶ms->cm->shaper_func;
+ const struct dc_3dlut_dma *cm_lut3d_dma = ¶ms->cm->lut3d_dma;
struct rmcm *rmcm = params->rmcm;
int rmcm_inst;
union rmcm_lut_params m_lut_params = {0};
@@ -74,15 +75,15 @@ bool dcn60_set_rmcm_luts(struct set_input_transfer_func_params *params)
rmcm_inst = rmcm->inst;
/* Shaper */
- lut_enable = cm->flags.bits.shaper_enable != 0;
+ lut_enable = params->shaper_enable;
if (lut_enable) {
memset(&m_lut_params, 0, sizeof(m_lut_params));
- if (cm->shaper_func.type == TF_TYPE_HWPWL)
- m_lut_params.pwl = &cm->shaper_func.pwl;
- else if (cm->shaper_func.type == TF_TYPE_DISTRIBUTED_POINTS) {
+ if (shaper_func->type == TF_TYPE_HWPWL)
+ m_lut_params.pwl = &shaper_func->pwl;
+ else if (shaper_func->type == TF_TYPE_DISTRIBUTED_POINTS) {
ASSERT(false);
- rval = cm_helper_translate_curve_to_hw_format(params->plane_state->ctx,
- &cm->shaper_func,
+ rval = cm_helper_translate_curve_to_hw_format(dpp_base->ctx,
+ shaper_func,
&dpp_base->shaper_params,
true);
m_lut_params.pwl = rval ? &dpp_base->shaper_params : NULL;
@@ -106,13 +107,13 @@ bool dcn60_set_rmcm_luts(struct set_input_transfer_func_params *params)
*/
/* 3DLUT */
- lut_enable = cm->flags.bits.lut3d_enable != 0;
- if (lut_enable && cm->flags.bits.lut3d_dma_enable) {
+ lut_enable = params->lut3d_enable;
+ if (lut_enable && params->lut3d_dma_enable) {
/* Fast (DMA) Load Mode */
if (rmcm->funcs->program_lut_mode)
rmcm->funcs->program_lut_mode(rmcm, MCM_LUT_3DLUT, lut_enable, true,
- cm->lut3d_dma.size,
- cm->lut3d_dma.bias, cm->lut3d_dma.scale,
+ cm_lut3d_dma->size,
+ cm_lut3d_dma->bias, cm_lut3d_dma->scale,
rmcm_inst);
if (rmcm->funcs->program_lut_read_write_control)
@@ -123,13 +124,13 @@ bool dcn60_set_rmcm_luts(struct set_input_transfer_func_params *params)
/* HUBP */
if (hubp->funcs->hubp_program_3dlut_fl_config)
- hubp->funcs->hubp_program_3dlut_fl_config(hubp, &cm->lut3d_dma);
+ hubp->funcs->hubp_program_3dlut_fl_config(hubp, cm_lut3d_dma);
if (hubp->funcs->hubp_program_3dlut_fl_crossbar)
- hubp->funcs->hubp_program_3dlut_fl_crossbar(hubp, cm->lut3d_dma.format);
+ hubp->funcs->hubp_program_3dlut_fl_crossbar(hubp, cm_lut3d_dma->format);
if (hubp->funcs->hubp_program_3dlut_fl_addr)
- hubp->funcs->hubp_program_3dlut_fl_addr(hubp, &cm->lut3d_dma.addr);
+ hubp->funcs->hubp_program_3dlut_fl_addr(hubp, &cm_lut3d_dma->addr);
if (hubp->funcs->hubp_enable_3dlut_fl) {
hubp->funcs->hubp_enable_3dlut_fl(hubp, true);
@@ -165,7 +166,7 @@ bool dcn60_set_rmcm_luts(struct set_input_transfer_func_params *params)
/* Connect to the MPCC only once the LUTs are loaded. Teardown is done by
* disable_rmcm_luts, at plane teardown or when the plane switches back to MCM.
*/
- dcn42_release_rmcm_from_mpcc(params->dc, params->mpcc_id, rmcm);
+ dcn42_release_rmcm_from_mpcc(params->rmcm_pool, params->rmcm_count, params->mpcc_id, rmcm);
if (rmcm->funcs->connect_mpcc)
rmcm->funcs->connect_mpcc(rmcm, rmcm_inst, params->mpcc_id);
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.h b/drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.h
index b88f4304b1b9..d37d9f47c223 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.h
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.h
@@ -31,6 +31,6 @@ void dcn60_program_perfmon(struct dc *dc, struct dc_state *context);
bool dcn60_apply_idle_power_optimizations(struct dc *dc, bool enable);
bool dcn60_dsc_pg_status(struct dce_hwseq *hws, unsigned int dsc_inst);
-bool dcn60_set_rmcm_luts(struct set_input_transfer_func_params *params);
+bool dcn60_set_rmcm_luts(const struct set_rmcm_luts_params *params);
#endif /* __DC_HWSS_DCN60_H__ */
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
index dac709188891..3bf9a15be3dc 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
+++ b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
@@ -101,16 +101,58 @@ struct update_plane_addr_params {
};
struct set_input_transfer_func_params {
- struct dc *dc;
+ struct dce_hwseq *hws;
struct dpp *dpp;
struct hubp *hubp;
struct hubp *primary_hubp;
struct mpc *mpc;
struct rmcm *rmcm;
+ /* Borrowed res_pool->rmcm array, valid for the driver lifetime */
+ struct rmcm **rmcm_pool;
+ int rmcm_count;
int mpcc_id;
- struct dc_stream_state *stream;
struct input_pixel_processor *ipp;
- struct dc_plane_state *plane_state;
+ enum surface_pixel_format format;
+ enum dc_scaling_linearity scaling_linearity;
+ bool always_use_regamma;
+ bool blend_enable;
+ bool shaper_enable;
+ bool lut3d_enable;
+ bool lut3d_dma_enable;
+ bool rmcm_enable;
+ /* Borrowed from the plane state, must stay valid until the step executes */
+ const struct dc_transfer_func *in_transfer_func;
+ const struct dc_gamma *gamma_correction;
+ const struct dc_plane_cm *cm;
+};
+
+/* Arguments of the set_mcm_luts hook, built from set_input_transfer_func_params. */
+struct set_mcm_luts_params {
+ struct dpp *dpp;
+ struct hubp *hubp;
+ struct hubp *primary_hubp;
+ struct mpc *mpc;
+ int mpcc_id;
+ bool blend_enable;
+ bool shaper_enable;
+ bool lut3d_enable;
+ bool lut3d_dma_enable;
+ bool rmcm_enable;
+ const struct dc_plane_cm *cm;
+};
+
+/* Arguments of the set_rmcm_luts hook, built from set_input_transfer_func_params. */
+struct set_rmcm_luts_params {
+ struct dpp *dpp;
+ struct hubp *hubp;
+ struct rmcm *rmcm;
+ struct rmcm **rmcm_pool;
+ int rmcm_count;
+ int mpcc_id;
+ bool shaper_enable;
+ bool lut3d_enable;
+ bool lut3d_dma_enable;
+ const struct dc_plane_cm *cm;
};
struct program_gamut_remap_params {
@@ -2735,6 +2777,12 @@ void hwss_hubp_wait_for_dcc_meta_prop(struct dc *dc, struct pipe_ctx *top_pipe_t
void hwss_set_input_transfer_func(struct dc *dc, struct pipe_ctx *pipe_ctx);
+void hwss_resolve_set_input_transfer_func_params(struct dc *dc,
+ struct pipe_ctx *pipe_ctx,
+ struct set_input_transfer_func_params *params);
+
+void hwss_dpp_set_input_transfer_func(union block_sequence_params *params);
+
void hwss_add_optc_pipe_control_lock(struct block_sequence_state *seq_state,
struct dc *dc, struct pipe_ctx *pipe_ctx, bool lock);
@@ -2751,7 +2799,7 @@ void hwss_add_hubp_update_plane_addr(struct block_sequence_state *seq_state,
struct dc *dc, struct pipe_ctx *pipe_ctx);
void hwss_add_dpp_set_input_transfer_func(struct block_sequence_state *seq_state,
- struct dc *dc, struct pipe_ctx *pipe_ctx);
+ const struct set_input_transfer_func_params *params);
void hwss_add_dpp_program_gamut_remap(struct block_sequence_state *seq_state,
struct pipe_ctx *pipe_ctx);
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer_private.h b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer_private.h
index e4001656a330..9eabb391397c 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer_private.h
+++ b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer_private.h
@@ -74,6 +74,8 @@ struct tg_color;
struct output_pixel_processor;
struct mpcc_blnd_cfg;
struct rmcm;
+struct dc_transfer_func;
+struct dc_3dlut;
struct hwseq_private_funcs {
@@ -193,16 +195,15 @@ struct hwseq_private_funcs {
bool (*wait_for_blank_complete)(struct output_pixel_processor *opp);
void (*dccg_init)(struct dce_hwseq *hws);
bool (*set_blend_lut)(struct dpp *dpp,
- struct dc_plane_state *plane_state);
+ const struct dc_transfer_func *blend_func);
bool (*set_shaper_3dlut)(struct dpp *dpp,
- struct dc_plane_state *plane_state);
- bool (*set_mcm_luts)(struct dc *dc, struct dpp *dpp, struct hubp *hubp,
- struct hubp *primary_hubp, struct mpc *mpc, int mpcc_id,
- struct dc_stream_state *stream,
- struct dc_plane_state *plane_state);
- bool (*set_rmcm_luts)(struct set_input_transfer_func_params *params);
+ const struct dc_transfer_func *shaper_func,
+ const struct dc_3dlut *lut3d_func);
+ bool (*set_mcm_luts)(const struct set_mcm_luts_params *params);
+ bool (*set_rmcm_luts)(const struct set_rmcm_luts_params *params);
void (*disable_mcm_luts)(struct mpc *mpc, int mpcc_id);
- void (*disable_rmcm_luts)(struct dc *dc, struct rmcm *rmcm, struct hubp *hubp, int mpcc_id);
+ void (*disable_rmcm_luts)(struct rmcm **rmcm_pool, int rmcm_count,
+ struct rmcm *rmcm, struct hubp *hubp, int mpcc_id);
void (*PLAT_58856_wa)(struct dc_state *context,
struct pipe_ctx *pipe_ctx);
void (*setup_hpo_hw_control)(const struct dce_hwseq *hws, bool enable);
diff --git a/drivers/gpu/drm/amd/display/dc/inc/core_types.h b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
index 09395f5d4e13..538b82edbb77 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/core_types.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
@@ -72,8 +72,6 @@ struct resource_context;
struct clk_bw_params;
struct dc_mcache_params;
-#define MAX_RMCM_INST 2
-
struct resource_funcs {
enum engine_id (*get_preferred_eng_id_dpia)(unsigned int dpia_index);
void (*destroy)(struct resource_pool **pool);
diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h b/drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h
index 6109d22e1093..56ed1b18c717 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h
@@ -45,6 +45,8 @@
#define MAX_PIPES 6
#define MAX_PHANTOM_PIPES (MAX_PIPES / 2)
+#define MAX_RMCM_INST 2
+
#define MAX_DPIA 6
#define MAX_CONNECTOR 6
#define MAX_VIRTUAL_LINKS 4
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 11/30] drm/amd/display: Add pipe init to core2
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (9 preceding siblings ...)
2026-12-01 20:22 ` [PATCH v2 10/30] drm/amd/display: Make DPP_SET_INPUT_TRANSFER_FUNC BLS compliant George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 20:54 ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 12/30] drm/amd/display: Fix HDMI FRL no_timeout behavior George Zhang
` (18 subsequent siblings)
29 siblings, 1 reply; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Tomasz Siemek, Jun Lei,
George Zhang
From: Tomasz Siemek <tomasz.siemek@amd.com>
[Why]
Dc1 expects some software pipe state after initialization.
[How]
Add pipe initialization to core2 init, driven by a stage-based
build/run loop: core2_build_and_run() and
core2_run_wrapped_hardware_init() now loop while the builder returns
BLS_BUILD_MORE_STAGES, instead of running a single stage.
Export core2_run_sequence(), replacing core2_run_init_stage(), so the
new loop can run each stage as it is built.
Add HUBBUB_INIT, HUBBUB_GLOBAL_TIMER_ENABLE and MPC_INIT block-sequence
steps, and a global_timer_enable hook on every DCN hubbub, to program
the new pipe-init state.
Rename init_hpo_hw_control() to setup_hpo_hw_control() to match.
Guard the DMUB feature_caps write against a NULL dmub_srv/dmub, since
core init can now run before dmub_srv exists.
Cc: Jun Lei <jun.lei@amd.com>
Signed-off-by: Tomasz Siemek <tomasz.siemek@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
.../amd/display/dc/bls_builder/bls_builder.c | 2 +-
.../amd/display/dc/bls_builder/bls_builder.h | 5 ++
.../dc/bls_builder/bls_builder_internal.h | 3 +-
.../dc/bls_builder/dcn401_init_builder.c | 16 +++--
.../bls_builder/dcn401_init_builder_legacy.c | 2 +-
.../display/dc/bls_executor/bls_executor.c | 42 ++++++++++-
.../gpu/drm/amd/display/dc/core2/dc_core2.c | 43 +++++++----
.../gpu/drm/amd/display/dc/core2/dc_core2.h | 7 ++
.../drm/amd/display/dc/core2/dc_core2_init.c | 71 +++++++++----------
.../display/dc/hubbub/dcn10/dcn10_hubbub.c | 1 +
.../display/dc/hubbub/dcn20/dcn20_hubbub.c | 1 +
.../display/dc/hubbub/dcn201/dcn201_hubbub.c | 1 +
.../display/dc/hubbub/dcn21/dcn21_hubbub.c | 1 +
.../display/dc/hubbub/dcn30/dcn30_hubbub.c | 3 +-
.../display/dc/hubbub/dcn301/dcn301_hubbub.c | 1 +
.../display/dc/hubbub/dcn31/dcn31_hubbub.c | 3 +-
.../display/dc/hubbub/dcn32/dcn32_hubbub.c | 3 +-
.../display/dc/hubbub/dcn35/dcn35_hubbub.c | 3 +-
.../display/dc/hubbub/dcn401/dcn401_hubbub.c | 3 +-
.../display/dc/hubbub/dcn42/dcn42_hubbub.c | 3 +-
.../display/dc/hubbub/dcn60/dcn60_hubbub.c | 1 +
.../amd/display/dc/hwss/dcn401/dcn401_init.c | 2 +-
.../drm/amd/display/dc/hwss/hw_sequencer.h | 29 ++++++++
.../display/dc/hwss/hw_sequencer_private.h | 5 --
.../gpu/drm/amd/display/dc/inc/hw/dchubbub.h | 1 +
25 files changed, 176 insertions(+), 76 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder.c b/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder.c
index 80771e7751bb..9b98570476c1 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder.c
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder.c
@@ -6,7 +6,7 @@
#include "dm_services.h"
#include "bls_builder/bls_builder_internal.h"
-const struct bls_builder *dcn401_bls_builder_create(
+static const struct bls_builder *dcn401_bls_builder_create(
enum bls_builder_name name)
{
switch (name) {
diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder.h b/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder.h
index 99d57e7c0789..dad502422806 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder.h
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder.h
@@ -18,6 +18,7 @@
enum bls_builder_result {
BLS_BUILD_SUCCESS,
+ BLS_BUILD_MORE_STAGES,
BLS_BUILD_ERROR_UNSUPPORTED_STATE_UPDATE,
BLS_BUILD_ERROR_RESOURCE_MAPPING,
};
@@ -36,6 +37,10 @@ enum bls_builder_kind {
BLS_BUILDER_IMPERATIVE,
};
+/*
+ * Core builds and runs a builder at most this many times while it returns
+ * BLS_BUILD_MORE_STAGES; a builder still asking for more after that fails.
+ */
#define BLS_BUILDER_INIT_MAX_STAGE_COUNT 4
struct bls_builder_dpm {
diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_internal.h b/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_internal.h
index 265c4c2b4b9e..6fa9f13ad32f 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_internal.h
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_internal.h
@@ -7,10 +7,9 @@
#include "bls_builder/bls_builder.h"
-const struct bls_builder *dcn401_bls_builder_create(
- enum bls_builder_name name);
const struct bls_builder *dcn401_initialization_builder(void);
const struct bls_builder *dcn401_legacy_initialization_builder(void);
const struct bls_builder *dcn401_accelerated_mode_query_builder(void);
const struct bls_builder *dcn401_non_seamless_commit_builder(void);
const struct bls_builder *dcn401_seamless_update_builder(void);
+
diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_init_builder.c b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_init_builder.c
index cdf5e7ee04fd..84e04750356e 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_init_builder.c
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_init_builder.c
@@ -19,7 +19,6 @@ enum dcn401_init_builder_stages {
DCN401_INIT_BUILDER_STAGE1,
DCN401_INIT_BUILDER_STAGE2,
DCN401_INIT_BUILDER_DONE,
- DCN401_INIT_BUILDER_STAGE_COUNT,
};
static_assert(DCN401_INIT_BUILDER_DONE <= BLS_BUILDER_INIT_MAX_STAGE_COUNT,
@@ -507,11 +506,18 @@ static enum bls_builder_result dcn401_build_initialization(struct bls_builder_de
params->head_num_steps = 0;
params->tail_num_steps = 0;
- if (initialization->stage >= DCN401_INIT_BUILDER_DONE)
+ switch (initialization->stage) {
+ case DCN401_INIT_BUILDER_STAGE1: {
+ enum bls_builder_result result = dcn401_build_stage1(params);
+
+ /* Stage 2 reads the DPM level counts stage 1 returns. */
+ return result == BLS_BUILD_SUCCESS ? BLS_BUILD_MORE_STAGES : result;
+ }
+ case DCN401_INIT_BUILDER_STAGE2:
+ return dcn401_build_stage2(params);
+ default:
return BLS_BUILD_SUCCESS;
- if (initialization->stage == DCN401_INIT_BUILDER_STAGE1)
- return dcn401_build_stage1(params);
- return dcn401_build_stage2(params);
+ }
}
const struct bls_builder *dcn401_initialization_builder(void)
diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_init_builder_legacy.c b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_init_builder_legacy.c
index b47d2deed2a9..bdfdb47834a4 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_init_builder_legacy.c
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_init_builder_legacy.c
@@ -177,7 +177,7 @@ static enum bls_builder_result dcn401_validate_dc1_hwseq(struct dc *dc)
return BLS_BUILD_ERROR_RESOURCE_MAPPING;
if (!dc->debug.disable_clock_gate && !funcs->dcfclk_gating_control)
return BLS_BUILD_ERROR_RESOURCE_MAPPING;
- if (!funcs->init_hpo_hw_control)
+ if (!funcs->setup_hpo_hw_control)
return BLS_BUILD_ERROR_RESOURCE_MAPPING;
return BLS_BUILD_SUCCESS;
diff --git a/drivers/gpu/drm/amd/display/dc/bls_executor/bls_executor.c b/drivers/gpu/drm/amd/display/dc/bls_executor/bls_executor.c
index 47278d7057d5..894e498e1ff4 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_executor/bls_executor.c
+++ b/drivers/gpu/drm/amd/display/dc/bls_executor/bls_executor.c
@@ -23,6 +23,7 @@
#include "link_service.h"
#include "dc_bios_types.h"
#include "gpio_service_interface.h"
+#include "dm_helpers.h"
#include "hwss/hw_sequencer_private.h"
#include "bls_executor/bls_executor.h"
#include "dmub_messenger/dmub_messenger.h"
@@ -117,7 +118,7 @@ static noinline_for_stack bool dc2_bls_step_supported(const struct dc2 *dc2,
case HPO_SET_HW_CONTROL: {
struct dce_hwseq *hws = step->params.hwseq_reg_control_params.hws;
- return hws && hws->funcs.init_hpo_hw_control;
+ return hws && hws->funcs.setup_hpo_hw_control;
}
case PG_SET_PLANE_POWER_GATING: {
struct dce_hwseq *hws = step->params.hwseq_reg_control_params.hws;
@@ -283,6 +284,22 @@ static noinline_for_stack bool dc2_bls_step_supported(const struct dc2 *dc2,
return hubbub && hubbub->funcs && hubbub->funcs->init_crb;
}
+ case HUBBUB_INIT: {
+ struct hubbub *hubbub = step->params.hubbub_init_params.hubbub;
+
+ return hubbub && hubbub->funcs && hubbub->funcs->dchubbub_init;
+ }
+ case HUBBUB_GLOBAL_TIMER_ENABLE: {
+ struct hubbub *hubbub =
+ step->params.hubbub_global_timer_enable_params.hubbub;
+
+ return hubbub && hubbub->funcs && hubbub->funcs->global_timer_enable;
+ }
+ case MPC_INIT: {
+ struct mpc *init_mpc = step->params.mpc_init_params.mpc;
+
+ return init_mpc && init_mpc->funcs && init_mpc->funcs->mpc_init;
+ }
case HUBBUB_SET_REQUEST_LIMIT: {
struct hubbub *hubbub =
step->params.hubbub_set_request_limit_params.hubbub;
@@ -909,7 +926,7 @@ enum dc2_bls_exec_result dc2_bls_execute(
struct dce_hwseq *hws =
entry->params.hwseq_reg_control_params.hws;
- hws->funcs.init_hpo_hw_control(hws,
+ hws->funcs.setup_hpo_hw_control(hws,
entry->params.hwseq_reg_control_params
.enable);
break;
@@ -1150,6 +1167,27 @@ enum dc2_bls_exec_result dc2_bls_execute(
hubbub->funcs->init_crb(hubbub);
break;
}
+ case HUBBUB_INIT: {
+ struct hubbub *hubbub =
+ entry->params.hubbub_init_params.hubbub;
+
+ hubbub->funcs->dchubbub_init(hubbub);
+ break;
+ }
+ case HUBBUB_GLOBAL_TIMER_ENABLE: {
+ const struct hubbub_global_timer_enable_params *p =
+ &entry->params.hubbub_global_timer_enable_params;
+
+ p->hubbub->funcs->global_timer_enable(p->hubbub, p->enable,
+ p->refdiv);
+ break;
+ }
+ case MPC_INIT: {
+ struct mpc *init_mpc = entry->params.mpc_init_params.mpc;
+
+ init_mpc->funcs->mpc_init(init_mpc);
+ break;
+ }
case HUBBUB_SET_REQUEST_LIMIT: {
const struct hubbub_set_request_limit_params *p =
&entry->params.hubbub_set_request_limit_params;
diff --git a/drivers/gpu/drm/amd/display/dc/core2/dc_core2.c b/drivers/gpu/drm/amd/display/dc/core2/dc_core2.c
index 1ab1f0ec2e41..c06735054eea 100644
--- a/drivers/gpu/drm/amd/display/dc/core2/dc_core2.c
+++ b/drivers/gpu/drm/amd/display/dc/core2/dc_core2.c
@@ -55,7 +55,7 @@ void core2_destruct(struct dc *dc)
(void)dc;
}
-static bool core2_run_commit_sequence(struct dc *dc,
+bool core2_run_sequence(struct dc *dc,
const struct bls_builder *builder,
const struct workaround_manager *wam,
struct block_sequence *steps, unsigned int *num_steps)
@@ -109,7 +109,7 @@ static bool core2_query_accelerated_mode(struct dc *dc)
if (builder->build.declarative(params) != BLS_BUILD_SUCCESS ||
params->tail_num_steps ||
- !core2_run_commit_sequence(dc, builder, wam,
+ !core2_run_sequence(dc, builder, wam,
params->head_sequence, ¶ms->head_num_steps))
accelerated_mode = false;
@@ -170,6 +170,8 @@ static enum dc_status core2_build_and_run(struct dc *dc,
struct bls_builder_declarative_params *params;
enum dc_status status = DC_ERROR_UNEXPECTED;
struct dc_state_update_flags update_flags;
+ enum bls_builder_result build_result;
+ unsigned int stage = 0;
/* 256 block-sequence entries; keep them off the kernel stack. */
params = kvzalloc(sizeof(*params), GFP_KERNEL);
@@ -184,19 +186,30 @@ static enum dc_status core2_build_and_run(struct dc *dc,
goto out;
params->update_flags = &update_flags;
- /*
- * A tail runs on the vsync after the head, so Core would have to wait
- * for that vsync on the stream first. Core has no wait-for-vsync
- * imperative yet, so a builder that emits a tail is not supported.
- */
- if (builder->build.declarative(params) != BLS_BUILD_SUCCESS ||
- params->tail_num_steps) {
- status = DC_NOT_SUPPORTED;
- goto out;
- }
- if (!core2_run_commit_sequence(dc, builder, wam,
- params->head_sequence, ¶ms->head_num_steps))
- goto out;
+ do {
+ if (stage++ >= BLS_BUILDER_INIT_MAX_STAGE_COUNT)
+ goto out;
+
+ build_result = builder->build.declarative(params);
+ /*
+ * A tail runs on the vsync after the head, so Core would have to wait
+ * for that vsync on the stream first. Core has no wait-for-vsync
+ * imperative yet, so a builder that emits a tail is not supported.
+ */
+ if ((build_result != BLS_BUILD_SUCCESS &&
+ build_result != BLS_BUILD_MORE_STAGES) ||
+ params->tail_num_steps) {
+ status = DC_NOT_SUPPORTED;
+ goto out;
+ }
+ if (!core2_run_sequence(dc, builder, wam,
+ params->head_sequence, ¶ms->head_num_steps))
+ goto out;
+
+ if (builder->postprocess)
+ builder->postprocess(params);
+ } while (build_result == BLS_BUILD_MORE_STAGES);
+
status = DC_OK;
out:
diff --git a/drivers/gpu/drm/amd/display/dc/core2/dc_core2.h b/drivers/gpu/drm/amd/display/dc/core2/dc_core2.h
index 46fd3a2dfa3c..e97097829c80 100644
--- a/drivers/gpu/drm/amd/display/dc/core2/dc_core2.h
+++ b/drivers/gpu/drm/amd/display/dc/core2/dc_core2.h
@@ -9,6 +9,9 @@
#include "inc/dc_core_interface.h"
struct dc;
+struct bls_builder;
+struct block_sequence;
+struct workaround_manager;
struct dc_core2 {
const struct dc2_funcs *legacy_funcs;
@@ -19,5 +22,9 @@ const struct dc2_funcs *core2_funcs(void);
enum dc_status core2_commit_state_hw(struct dc *dc, struct dc_state *context);
void core2_construct(struct dc *dc);
void core2_destruct(struct dc *dc);
+/* Applies workarounds to a built head sequence and executes it. */
+bool core2_run_sequence(struct dc *dc, const struct bls_builder *builder,
+ const struct workaround_manager *wam,
+ struct block_sequence *steps, unsigned int *num_steps);
#endif /* DC_CORE2_H_ */
diff --git a/drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.c b/drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.c
index 6d5dd6f00b9f..0e8e2d299bd3 100644
--- a/drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.c
+++ b/drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.c
@@ -12,6 +12,7 @@
#include "bls_builder/bls_builder.h"
#include "bls_executor/bls_executor.h"
#include "workaround_manager/workaround_manager.h"
+#include "core2/dc_core2.h"
#include "core2/dc_core2_init.h"
#include "core2/dc_core2_legacy_init.h"
#include "dc_api_dispatch/api_shim.h"
@@ -45,7 +46,8 @@ static void core2_resolve_dmub_abi(struct dc *dc,
dc2->dmub_abi = initialization->dmub_abi;
dc2->dmub_abi_resolved = true;
- dc->ctx->dmub_srv->dmub->feature_caps = initialization->dmub_abi.feature_caps;
+ if (dc->ctx->dmub_srv && dc->ctx->dmub_srv->dmub)
+ dc->ctx->dmub_srv->dmub->feature_caps = initialization->dmub_abi.feature_caps;
dc->caps.dmub_caps.psr = initialization->dmub_abi.feature_caps.psr;
dc->caps.dmub_caps.mclk_sw = initialization->dmub_abi.feature_caps.fw_assisted_mclk_switch_ver > 0;
dc->caps.dmub_caps.fams_ver = initialization->dmub_abi.feature_caps.fw_assisted_mclk_switch_ver;
@@ -235,38 +237,20 @@ static void core2_update_bw_bounding_box(struct dc *dc,
dc->res_pool->funcs->update_bw_bounding_box(dc, dc->clk_mgr->bw_params);
}
-/* Build, apply workarounds, execute, and let the builder read the replies. */
-static bool core2_run_init_stage(struct dc *dc,
- const struct bls_builder *builder,
- const struct workaround_manager *wam,
- struct bls_builder_declarative_params *params)
+static void core2_init_pipe_state(struct dc *dc)
{
- struct workaround_context wa_ctx = {0};
- struct block_sequence_state sequence;
- enum dc2_bls_exec_result exec_result;
-
- if (builder->build.declarative(params) != BLS_BUILD_SUCCESS)
- return false;
-
- sequence.steps = params->head_sequence;
- sequence.num_steps = ¶ms->head_num_steps;
- wa_ctx.current_state = dc->current_state;
- wa_ctx.builder_name = builder->name;
- wa_ctx.dcn_version = dc->ctx->dce_version;
- wa_ctx.bug_wa = &dc->work_arounds;
- wa_ctx.debug = &dc->debug;
- if (workaround_manager_apply(wam, &sequence, &wa_ctx) != WAM_OK ||
- params->head_num_steps > DC2_BLS_MAX_STEPS)
- return false;
-
- exec_result = dc2_bls_execute(TO_DC2(dc), params->head_sequence,
- params->head_num_steps);
- if (exec_result != DC2_BLS_EXEC_OK &&
- exec_result != DC2_BLS_EXEC_CONTINUED_ON_ERROR)
- return false;
-
- builder->postprocess(params);
- return true;
+ const struct resource_pool *pool = dc->res_pool;
+
+ for (unsigned int index = 0; index < pool->pipe_count; index++) {
+ struct hubp *hubp = pool->hubps[index];
+ struct dpp *dpp = pool->dpps[index];
+ struct output_pixel_processor *opp = pool->opps[index];
+
+ hubp->mpcc_id = dpp->inst;
+ hubp->opp_id = OPP_ID_INVALID;
+ hubp->power_gated = true;
+ opp->mpc_tree_params.opp_id = opp->inst;
+ }
}
static void core2_run_wrapped_hardware_init(struct dc *dc)
@@ -277,8 +261,9 @@ static void core2_run_wrapped_hardware_init(struct dc *dc)
struct bls_builder_initialization *initialization;
const struct bls_builder_initialization_output *output;
const struct bls_builder *builder;
+ enum bls_builder_result build_result;
bool dchub_ref_freq_changed;
- unsigned int stage;
+ unsigned int stage = 0;
builder = TO_DC2(dc)->builders[DCN_DECL_INITIALIZATION];
if (!builder || builder->kind != BLS_BUILDER_DECLARATIVE ||
@@ -301,11 +286,19 @@ static void core2_run_wrapped_hardware_init(struct dc *dc)
out_targets.DCN_DECL_INITIALIZATION = initialization;
params->out_targets = &out_targets;
- /* Builders emit empty sequences for stages past their last one. */
- for (stage = 0; stage < BLS_BUILDER_INIT_MAX_STAGE_COUNT; stage++) {
- if (!core2_run_init_stage(dc, builder, wam, params))
+ do {
+ if (stage++ >= BLS_BUILDER_INIT_MAX_STAGE_COUNT)
goto out;
- }
+ build_result = builder->build.declarative(params);
+ if (build_result != BLS_BUILD_SUCCESS &&
+ build_result != BLS_BUILD_MORE_STAGES)
+ goto out;
+ if (!core2_run_sequence(dc, builder, wam,
+ params->head_sequence, ¶ms->head_num_steps))
+ goto out;
+ if (builder->postprocess)
+ builder->postprocess(params);
+ } while (build_result == BLS_BUILD_MORE_STAGES);
dc->current_state->bls_builder_initialization = *initialization;
output = &dc->current_state->bls_builder_initialization.output;
@@ -318,7 +311,7 @@ static void core2_run_wrapped_hardware_init(struct dc *dc)
core2_resolve_dmub_abi(dc, output);
core2_resolve_clocks(dc, output);
core2_update_bw_bounding_box(dc, dchub_ref_freq_changed);
-
+ core2_init_pipe_state(dc);
out:
kvfree(params);
kvfree(initialization);
@@ -330,8 +323,10 @@ void core2_hardware_init(struct dc *dc)
return;
core2_detect_edp_presence(dc);
+
if (TO_DC2(dc)->init_method == DC2_INIT_METHOD_WRAPPED)
core2_run_wrapped_hardware_init(dc);
else
core2_run_legacy_hardware_init(dc, dc2_workaround_manager_get());
+
}
diff --git a/drivers/gpu/drm/amd/display/dc/hubbub/dcn10/dcn10_hubbub.c b/drivers/gpu/drm/amd/display/dc/hubbub/dcn10/dcn10_hubbub.c
index 238824369e00..da1a59ac744b 100644
--- a/drivers/gpu/drm/amd/display/dc/hubbub/dcn10/dcn10_hubbub.c
+++ b/drivers/gpu/drm/amd/display/dc/hubbub/dcn10/dcn10_hubbub.c
@@ -923,6 +923,7 @@ static const struct hubbub_funcs hubbub1_funcs = {
.is_allow_self_refresh_enabled = hubbub1_is_allow_self_refresh_enabled,
.allow_self_refresh_control = hubbub1_allow_self_refresh_control,
.verify_allow_pstate_change_high = hubbub1_verify_allow_pstate_change_high,
+ .global_timer_enable = dcn10_hubbub_global_timer_enable,
};
void hubbub1_construct(struct hubbub *hubbub,
diff --git a/drivers/gpu/drm/amd/display/dc/hubbub/dcn20/dcn20_hubbub.c b/drivers/gpu/drm/amd/display/dc/hubbub/dcn20/dcn20_hubbub.c
index a145c3692f1b..17c1fb0a9d7a 100644
--- a/drivers/gpu/drm/amd/display/dc/hubbub/dcn20/dcn20_hubbub.c
+++ b/drivers/gpu/drm/amd/display/dc/hubbub/dcn20/dcn20_hubbub.c
@@ -677,6 +677,7 @@ static const struct hubbub_funcs hubbub2_funcs = {
.is_allow_self_refresh_enabled = hubbub1_is_allow_self_refresh_enabled,
.allow_self_refresh_control = hubbub1_allow_self_refresh_control,
.hubbub_read_state = hubbub2_read_state,
+ .global_timer_enable = dcn10_hubbub_global_timer_enable,
};
void hubbub2_construct(struct dcn20_hubbub *hubbub,
diff --git a/drivers/gpu/drm/amd/display/dc/hubbub/dcn201/dcn201_hubbub.c b/drivers/gpu/drm/amd/display/dc/hubbub/dcn201/dcn201_hubbub.c
index d626c1de92a7..375cc73861c8 100644
--- a/drivers/gpu/drm/amd/display/dc/hubbub/dcn201/dcn201_hubbub.c
+++ b/drivers/gpu/drm/amd/display/dc/hubbub/dcn201/dcn201_hubbub.c
@@ -87,6 +87,7 @@ static const struct hubbub_funcs hubbub201_funcs = {
.get_dchub_ref_freq = hubbub2_get_dchub_ref_freq,
.program_watermarks = hubbub201_program_watermarks,
.hubbub_read_state = hubbub2_read_state,
+ .global_timer_enable = dcn10_hubbub_global_timer_enable,
};
void hubbub201_construct(struct dcn20_hubbub *hubbub,
diff --git a/drivers/gpu/drm/amd/display/dc/hubbub/dcn21/dcn21_hubbub.c b/drivers/gpu/drm/amd/display/dc/hubbub/dcn21/dcn21_hubbub.c
index 3a92682c9cda..460a75ee67e7 100644
--- a/drivers/gpu/drm/amd/display/dc/hubbub/dcn21/dcn21_hubbub.c
+++ b/drivers/gpu/drm/amd/display/dc/hubbub/dcn21/dcn21_hubbub.c
@@ -703,6 +703,7 @@ static const struct hubbub_funcs hubbub21_funcs = {
.allow_self_refresh_control = hubbub1_allow_self_refresh_control,
.apply_DEDCN21_147_wa = hubbub21_apply_DEDCN21_147_wa,
.hubbub_read_state = hubbub2_read_state,
+ .global_timer_enable = dcn10_hubbub_global_timer_enable,
};
void hubbub21_construct(struct dcn20_hubbub *hubbub,
diff --git a/drivers/gpu/drm/amd/display/dc/hubbub/dcn30/dcn30_hubbub.c b/drivers/gpu/drm/amd/display/dc/hubbub/dcn30/dcn30_hubbub.c
index 71f45e07c10e..d288c8bd0716 100644
--- a/drivers/gpu/drm/amd/display/dc/hubbub/dcn30/dcn30_hubbub.c
+++ b/drivers/gpu/drm/amd/display/dc/hubbub/dcn30/dcn30_hubbub.c
@@ -469,7 +469,8 @@ static const struct hubbub_funcs hubbub30_funcs = {
.force_pstate_change_control = hubbub3_force_pstate_change_control,
.init_watermarks = hubbub3_init_watermarks,
.hubbub_read_state = hubbub2_read_state,
- .hubbub_read_reg_state = hubbub3_read_reg_state
+ .hubbub_read_reg_state = hubbub3_read_reg_state,
+ .global_timer_enable = dcn10_hubbub_global_timer_enable,
};
void hubbub3_construct(struct dcn20_hubbub *hubbub3,
diff --git a/drivers/gpu/drm/amd/display/dc/hubbub/dcn301/dcn301_hubbub.c b/drivers/gpu/drm/amd/display/dc/hubbub/dcn301/dcn301_hubbub.c
index f432874b32dd..efb0ae4eb8fc 100644
--- a/drivers/gpu/drm/amd/display/dc/hubbub/dcn301/dcn301_hubbub.c
+++ b/drivers/gpu/drm/amd/display/dc/hubbub/dcn301/dcn301_hubbub.c
@@ -65,6 +65,7 @@ static const struct hubbub_funcs hubbub301_funcs = {
.force_pstate_change_control = hubbub3_force_pstate_change_control,
.init_watermarks = hubbub3_init_watermarks,
.hubbub_read_state = hubbub2_read_state,
+ .global_timer_enable = dcn10_hubbub_global_timer_enable,
};
void hubbub301_construct(struct dcn20_hubbub *hubbub3,
diff --git a/drivers/gpu/drm/amd/display/dc/hubbub/dcn31/dcn31_hubbub.c b/drivers/gpu/drm/amd/display/dc/hubbub/dcn31/dcn31_hubbub.c
index 2af656c2c529..3761c78b5c63 100644
--- a/drivers/gpu/drm/amd/display/dc/hubbub/dcn31/dcn31_hubbub.c
+++ b/drivers/gpu/drm/amd/display/dc/hubbub/dcn31/dcn31_hubbub.c
@@ -1072,7 +1072,8 @@ static const struct hubbub_funcs hubbub31_funcs = {
.init_crb = dcn31_init_crb,
.hubbub_read_state = hubbub2_read_state,
.hubbub_read_reg_state = hubbub3_read_reg_state,
- .dchvm_init = dcn21_dchvm_init
+ .dchvm_init = dcn21_dchvm_init,
+ .global_timer_enable = dcn10_hubbub_global_timer_enable,
};
void hubbub31_construct(struct dcn20_hubbub *hubbub31,
diff --git a/drivers/gpu/drm/amd/display/dc/hubbub/dcn32/dcn32_hubbub.c b/drivers/gpu/drm/amd/display/dc/hubbub/dcn32/dcn32_hubbub.c
index ee01d52e6944..b3ee3e75ea8d 100644
--- a/drivers/gpu/drm/amd/display/dc/hubbub/dcn32/dcn32_hubbub.c
+++ b/drivers/gpu/drm/amd/display/dc/hubbub/dcn32/dcn32_hubbub.c
@@ -1036,7 +1036,8 @@ static const struct hubbub_funcs hubbub32_funcs = {
.force_usr_retraining_allow = hubbub32_force_usr_retraining_allow,
.set_request_limit = hubbub32_set_request_limit,
.get_mall_en = hubbub32_get_mall_en,
- .hubbub_read_reg_state = hubbub3_read_reg_state
+ .hubbub_read_reg_state = hubbub3_read_reg_state,
+ .global_timer_enable = dcn10_hubbub_global_timer_enable,
};
void hubbub32_construct(struct dcn20_hubbub *hubbub2,
diff --git a/drivers/gpu/drm/amd/display/dc/hubbub/dcn35/dcn35_hubbub.c b/drivers/gpu/drm/amd/display/dc/hubbub/dcn35/dcn35_hubbub.c
index 771e209a0b3f..0431ce8130cb 100644
--- a/drivers/gpu/drm/amd/display/dc/hubbub/dcn35/dcn35_hubbub.c
+++ b/drivers/gpu/drm/amd/display/dc/hubbub/dcn35/dcn35_hubbub.c
@@ -643,7 +643,8 @@ static const struct hubbub_funcs hubbub35_funcs = {
.force_usr_retraining_allow = hubbub32_force_usr_retraining_allow,
.dchubbub_init = hubbub35_init,
.hubbub_read_reg_state = hubbub3_read_reg_state,
- .dchvm_init = dcn35_dchvm_init
+ .dchvm_init = dcn35_dchvm_init,
+ .global_timer_enable = dcn10_hubbub_global_timer_enable,
};
void hubbub35_construct(struct dcn20_hubbub *hubbub2,
diff --git a/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c b/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c
index cc3fda2c470c..621956972a37 100644
--- a/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c
+++ b/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c
@@ -1255,7 +1255,8 @@ static const struct hubbub_funcs hubbub4_01_funcs = {
.wait_for_det_update = dcn401_wait_for_det_update,
.program_arbiter = dcn401_program_arbiter,
.hubbub_read_reg_state = hubbub3_read_reg_state,
- .get_mall_en = hubbub32_get_mall_en
+ .get_mall_en = hubbub32_get_mall_en,
+ .global_timer_enable = dcn10_hubbub_global_timer_enable,
};
void hubbub401_construct(struct dcn20_hubbub *hubbub2,
diff --git a/drivers/gpu/drm/amd/display/dc/hubbub/dcn42/dcn42_hubbub.c b/drivers/gpu/drm/amd/display/dc/hubbub/dcn42/dcn42_hubbub.c
index b8ebe44c69c6..08ec6c09b018 100644
--- a/drivers/gpu/drm/amd/display/dc/hubbub/dcn42/dcn42_hubbub.c
+++ b/drivers/gpu/drm/amd/display/dc/hubbub/dcn42/dcn42_hubbub.c
@@ -554,7 +554,8 @@ static const struct hubbub_funcs hubbub42_funcs = {
.program_compbuf_segments = dcn401_program_compbuf_segments,
.wait_for_det_update = dcn401_wait_for_det_update,
.program_arbiter = dcn42_program_arbiter,
- .hubbub_read_reg_state = hubbub3_read_reg_state
+ .hubbub_read_reg_state = hubbub3_read_reg_state,
+ .global_timer_enable = dcn10_hubbub_global_timer_enable,
};
void hubbub42_construct(struct dcn20_hubbub *hubbub2,
diff --git a/drivers/gpu/drm/amd/display/dc/hubbub/dcn60/dcn60_hubbub.c b/drivers/gpu/drm/amd/display/dc/hubbub/dcn60/dcn60_hubbub.c
index ab3a63cb2042..4feeb8510373 100644
--- a/drivers/gpu/drm/amd/display/dc/hubbub/dcn60/dcn60_hubbub.c
+++ b/drivers/gpu/drm/amd/display/dc/hubbub/dcn60/dcn60_hubbub.c
@@ -2060,6 +2060,7 @@ static const struct hubbub_funcs hubbub60_funcs = {
hubbub60_reset_display_qos_profile,
},
.set_sdpif_port_control = hubbub60_set_sdpif_port_control,
+ .global_timer_enable = dcn10_hubbub_global_timer_enable,
};
void hubbub60_construct(struct dcn20_hubbub *hubbub2,
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_init.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_init.c
index 53d6fab1f400..7da504fc05b0 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_init.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_init.c
@@ -151,7 +151,7 @@ static const struct hwseq_private_funcs dcn401_private_funcs = {
.plane_atomic_power_down = dcn401_plane_atomic_power_down,
.plane_atomic_power_down_sequence = dcn401_plane_atomic_power_down_sequence,
.enable_power_gating_plane = dcn32_enable_power_gating_plane,
- .init_hpo_hw_control = dcn401_setup_hpo_hw_control,
+ .setup_hpo_hw_control = dcn401_setup_hpo_hw_control,
.init_odm_mem_power = dcn401_init_odm_mem_power,
.power_down_vga_mem = dcn401_power_down_vga_mem,
.dcfclk_gating_control = dcn401_dcfclk_gating_control,
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
index 3bf9a15be3dc..68f7bb01bdd3 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
+++ b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
@@ -309,6 +309,25 @@ struct hubbub_init_crb_params {
struct hubbub *hubbub;
};
+struct hubbub_init_params {
+ struct hubbub *hubbub;
+};
+
+struct hubbub_global_timer_enable_params {
+ struct hubbub *hubbub;
+ bool enable;
+ uint32_t refdiv;
+};
+
+struct mpc_init_params {
+ struct mpc *mpc;
+};
+
+struct fpga_set_clk_params {
+ struct dc_context *ctx;
+ int freq_khz;
+};
+
struct hubbub_set_request_limit_params {
struct hubbub *hubbub;
unsigned int num_chans;
@@ -1668,6 +1687,10 @@ union block_sequence_params {
dccg_set_root_clock_gating_params;
struct hubbub_init_watermarks_params hubbub_init_watermarks_params;
struct hubbub_init_crb_params hubbub_init_crb_params;
+ struct hubbub_init_params hubbub_init_params;
+ struct hubbub_global_timer_enable_params hubbub_global_timer_enable_params;
+ struct mpc_init_params mpc_init_params;
+ struct fpga_set_clk_params fpga_set_clk_params;
struct hubbub_set_request_limit_params hubbub_set_request_limit_params;
struct clk_mgr_initialize_min_clocks_params
clk_mgr_initialize_min_clocks_params;
@@ -1973,6 +1996,12 @@ enum block_sequence_func {
TG_DELAY_CURSOR_UNTIL_VUPDATE,
MPC_CURSOR_LOCK,
DMUB_HW_LOCK_MGR_CMD,
+ HUBBUB_INIT,
+ HUBBUB_GLOBAL_TIMER_ENABLE,
+ MPC_INIT,
+ FPGA_SET_DTBCLK,
+ FPGA_SET_DPREFCLK,
+ FPGA_SET_REFCLK,
/* This must be the last value in this enum, add new ones above */
HWSS_BLOCK_SEQUENCE_FUNC_COUNT
};
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer_private.h b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer_private.h
index 9eabb391397c..af29d36ae0cc 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer_private.h
+++ b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer_private.h
@@ -207,11 +207,6 @@ struct hwseq_private_funcs {
void (*PLAT_58856_wa)(struct dc_state *context,
struct pipe_ctx *pipe_ctx);
void (*setup_hpo_hw_control)(const struct dce_hwseq *hws, bool enable);
- /*
- * Init-time only. setup_hpo_hw_control also drives the HPO toggle
- * on every commit, so a DCN that leaves it unset keeps it unset.
- */
- void (*init_hpo_hw_control)(const struct dce_hwseq *hws, bool enable);
void (*init_odm_mem_power)(struct dce_hwseq *hws);
void (*power_down_vga_mem)(struct dce_hwseq *hws);
void (*dcfclk_gating_control)(struct dce_hwseq *hws, bool enable);
diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h b/drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h
index 71658a4c775a..3bb79d76dd20 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h
@@ -272,6 +272,7 @@ struct hubbub_funcs {
void (*force_usr_retraining_allow)(struct hubbub *hubbub, bool allow);
void (*set_request_limit)(struct hubbub *hubbub, int memory_channel_count, int words_per_channel);
void (*dchubbub_init)(struct hubbub *hubbub);
+ void (*global_timer_enable)(struct hubbub *hubbub, bool enable, uint32_t refdiv);
void (*get_mall_en)(struct hubbub *hubbub, unsigned int *mall_in_use);
void (*program_det_segments)(struct hubbub *hubbub, int hubp_inst, unsigned det_buffer_size_seg);
void (*program_compbuf_segments)(struct hubbub *hubbub, unsigned compbuf_size_seg, bool safe_to_increase);
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 12/30] drm/amd/display: Fix HDMI FRL no_timeout behavior
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (10 preceding siblings ...)
2026-12-01 20:22 ` [PATCH v2 11/30] drm/amd/display: Add pipe init to core2 George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 20:42 ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 13/30] drm/amd/display: Re-enable HUBP/DPP Driver PG on DCN42 George Zhang
` (17 subsequent siblings)
29 siblings, 1 reply; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Ilya Bakoulin, Chris Park,
George Zhang
From: Ilya Bakoulin <Ilya.Bakoulin@amd.com>
[Why/How]
Addresses a couple issues encountered while running compliance tests
that assert the no_timeout flag:
- Handle a couple of additional cases where link rate is not updated
properly during a no_timeout test sequence due to the link not being
cycled on/off
- Increase polling rate while no_timeout is asserted to ensure we
respond to updates in a reasonable amount of time (<10ms)
Cc: Chris Park <chris.park@amd.com>
Signed-off-by: Ilya Bakoulin <Ilya.Bakoulin@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
.../drm/amd/display/dc/link/link_dpms_v1.c | 1 +
.../display/dc/link/protocols/link_hdmi_frl.c | 25 +++++++++++++------
.../display/dc/link/protocols/link_hdmi_frl.h | 1 +
3 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/link/link_dpms_v1.c b/drivers/gpu/drm/amd/display/dc/link/link_dpms_v1.c
index 4677ad4a2cd0..09162d56b350 100644
--- a/drivers/gpu/drm/amd/display/dc/link/link_dpms_v1.c
+++ b/drivers/gpu/drm/amd/display/dc/link/link_dpms_v1.c
@@ -2068,6 +2068,7 @@ static enum dc_status enable_link_hdmi_frl(struct pipe_ctx *pipe_ctx)
frl_phy_clock_source_id = hdmi_frl_find_matching_phypll(stream->link);
FRL_INFO("FRL LINK TRAINING: LTS:P Start\n");
+ hdmi_frl_cycle_link_on_no_timeout_rate_change(stream->link);
/* Setup FRL PHY, enable HDMI character clock and HPO link encoder */
core_dc->hwss.setup_hdmi_frl_link(stream->link,
(pipe_ctx->stream_res.hpo_frl_stream_enc->id - ENGINE_ID_HPO_0),
diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_hdmi_frl.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_hdmi_frl.c
index cb201c9ee3c6..235588174940 100644
--- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_hdmi_frl.c
+++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_hdmi_frl.c
@@ -781,6 +781,20 @@ static enum link_result hdmi_frl_perform_link_training(struct ddc_service *ddc_s
return result;
}
+/* disable_link_output is a no-op while in FLT_no_timeout mode, so if the FRL
+ * rate changed since the no_timeout training, cycle the link off here so that
+ * the subsequent PHY setup properly applies the new link rate.
+ */
+void hdmi_frl_cycle_link_on_no_timeout_rate_change(struct dc_link *link)
+{
+ if (!link->frl_flags.no_timeout ||
+ link->frl_flags.no_timeout_frl_link_rate == link->frl_link_settings.frl_link_rate)
+ return;
+
+ link->hpo_frl_link_enc->funcs->disable_link_encoder(link->hpo_frl_link_enc);
+ link->link_enc->funcs->disable_output(link->link_enc, SIGNAL_TYPE_HDMI_FRL);
+}
+
enum link_result hdmi_frl_perform_link_training_with_retries(
struct dc_link *link)
{
@@ -836,14 +850,7 @@ enum link_result hdmi_frl_perform_link_training_with_fallback(
msleep(200);
- /* If we're in a NO_TIMEOUT state and link rate changes, cycle the link on/off
- * so that the new link rate is properly applied */
- if (link->frl_flags.no_timeout) {
- if (link->frl_flags.no_timeout_frl_link_rate != link->frl_link_settings.frl_link_rate) {
- link->hpo_frl_link_enc->funcs->disable_link_encoder(link->hpo_frl_link_enc);
- link->link_enc->funcs->disable_output(link->link_enc, SIGNAL_TYPE_HDMI_FRL);
- }
- }
+ hdmi_frl_cycle_link_on_no_timeout_rate_change(link);
link->ctx->dc->hwss.setup_hdmi_frl_link(link, 0,
frl_phy_clock_source_id);
@@ -1108,6 +1115,8 @@ void hdmi_frl_set_preferred_link_settings(struct dc *dc,
/* Find proper clock source in HDMI FRL mode for phy used for DCCG */
frl_phy_clock_source_id = hdmi_frl_find_matching_phypll(link);
+ hdmi_frl_cycle_link_on_no_timeout_rate_change(link);
+
dc->hwss.setup_hdmi_frl_link(link,
(pipe->stream_res.hpo_frl_stream_enc->id - ENGINE_ID_HPO_0),
frl_phy_clock_source_id);
diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_hdmi_frl.h b/drivers/gpu/drm/amd/display/dc/link/protocols/link_hdmi_frl.h
index abeec56c6528..fd6d401e090e 100644
--- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_hdmi_frl.h
+++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_hdmi_frl.h
@@ -31,6 +31,7 @@ void hdmi_frl_LTS_clear_Update_flag(struct ddc_service *ddc_service);
void hdmi_frl_poll_start(struct ddc_service *ddc_service);
void hdmi_frl_LTS_clear_Link_Setting(struct ddc_service *ddc_service);
void hdmi_frl_retrieve_link_cap(struct dc_link *link, struct dc_sink *sink);
+void hdmi_frl_cycle_link_on_no_timeout_rate_change(struct dc_link *link);
enum link_result hdmi_frl_perform_link_training_with_retries(
struct dc_link *link);
enum link_result hdmi_frl_perform_link_training_with_fallback(
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 13/30] drm/amd/display: Re-enable HUBP/DPP Driver PG on DCN42
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (11 preceding siblings ...)
2026-12-01 20:22 ` [PATCH v2 12/30] drm/amd/display: Fix HDMI FRL no_timeout behavior George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 20:22 ` [PATCH v2 14/30] drm/amd/display: Program DSC on one stream in DC2 George Zhang
` (16 subsequent siblings)
29 siblings, 0 replies; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Leo Chen, Ovidiu (Ovi) Bunea,
George Zhang
From: Leo Chen <leo.chen@amd.com>
[Why & How]
Power regression is resolved, disabling the HUBP/DPP driver PG
is no longer needed as a workaround. Re-enabling HUBP/DPP driver PG on
DCN42.
Cc: Ovidiu (Ovi) Bunea <ovidiu.bunea@amd.com>
Signed-off-by: Leo Chen <leo.chen@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
.../gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c
index a6fd956d12e9..89e40927a0e8 100644
--- a/drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c
@@ -745,8 +745,8 @@ static const struct dc_debug_options debug_defaults_drv = {
.clock_trace = true,
.disable_pplib_clock_request = false,
.ignore_pg = false,
- .disable_dpp_power_gate = true,
- .disable_hubp_power_gate = true,
+ .disable_dpp_power_gate = false,
+ .disable_hubp_power_gate = false,
.disable_optc_power_gate = true,
.disable_dsc_power_gate = false,
.disable_dio_power_gate = true,
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 14/30] drm/amd/display: Program DSC on one stream in DC2
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (12 preceding siblings ...)
2026-12-01 20:22 ` [PATCH v2 13/30] drm/amd/display: Re-enable HUBP/DPP Driver PG on DCN42 George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 20:55 ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 15/30] drm/amd/display: enable dcn42b hubp/dpp pg control from driver side George Zhang
` (15 subsequent siblings)
29 siblings, 1 reply; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Tony Cheng, Jun Lei,
George Zhang
From: Tony Cheng <tony.cheng@amd.com>
[Why]
The DC2 commit on dcn401 rejects every stream with DSC. A DSC display
falls back to the error path.
[How]
Accept a stream with DSC when each OPP head has a DSC and the pixel
clock is above 48 MHz. At 48 MHz or less, DC1 keeps DSCCLK on the
reference clock, and the commit does not emit that path. A stream
without DSC must have no DSC on its OPP heads. Split the timing flag
check into one check for interlace and one check for stereo.
The commit programs DSC as link_set_dsc_on_stream does, after the OTG
output mux and before the link enable. For each OPP head it sets the
DSCCLK DTO, the DSC config and the DSC enable. Then it sets the OPTC
DSC config on the OTG master. The front end programs DSC again after
the OPP format, as dcn32_update_dsc_on_stream does from
dcn401_update_odm. The stream off disables the OPTC DSC config after
the link disable. Then, for each OPP head, it disconnects and
disables the DSC and sets DSCCLK to the reference clock.
The update programs DSC again when it adds a plane, with the same
skip conditions as the OPP ODM steps. A new no_dsc skip condition
removes the DSC steps from a pipe without DSC. The update rejects an
ODM change on a kept DSC stream, because it does not disable the DSC
of a dropped slice.
The builder prepares the DSC config with
hwss_prepare_dsc_config_for_pipe. It does not emit the DSC read
state. The DC2 Executor gets the cases for the seven DSC funcs.
Cc: Jun Lei <jun.lei@amd.com>
Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
.../bls_builder/bls_builder_private_types.h | 4 +
.../bls_builder/dcn401_non_seamless_builder.c | 56 +++++
.../dc/bls_builder/dcn401_seamless_builder.c | 203 ++++++++++++++----
.../display/dc/bls_executor/bls_executor.c | 74 +++++++
4 files changed, 299 insertions(+), 38 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_private_types.h b/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_private_types.h
index 2fdac8415f31..4973ffe65115 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_private_types.h
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_private_types.h
@@ -121,6 +121,9 @@ struct dcn401_commit_step_meta {
struct {
bool connect;
} link_enc_connect_dig_be_to_fe;
+ struct {
+ bool enable;
+ } tg_set_dsc_config;
struct {
bool enable;
} dc_ip_request_cntl;
@@ -136,6 +139,7 @@ struct dcn401_commit_step_meta {
bool no_manual_trigger;
/* The OPP MPC tree has no plane yet. */
bool opp_tree_empty;
+ bool no_dsc;
struct dcn401_pipe_deltas pipe_deltas;
/*
* Skip only when each delta named in pipe_deltas is true. Clear,
diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c
index 2ce37c3aa982..9bf814f70423 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c
@@ -241,7 +241,19 @@ static const struct dcn401_commit_step stream_off[] = {
.meta.link_enc_connect_dig_be_to_fe.connect = false },
{ .func = DCCG_DISABLE_SYMCLK_SE },
{ .func = DIO_LINK_ENC_DISABLE_OUTPUT },
+};
+
+static const struct dcn401_commit_step optc_dsc_off[] = {
+ { .func = TG_SET_DSC_CONFIG, .meta.skip_if.no_dsc = true },
+};
+
+static const struct dcn401_commit_step dsc_off[] = {
+ { .func = DSC_DISCONNECT, .meta.skip_if.no_dsc = true },
+ { .func = DSC_DISABLE, .meta.skip_if.no_dsc = true },
+ { .func = DCCG_SET_REF_DSCCLK, .meta.skip_if.no_dsc = true },
+};
+static const struct dcn401_commit_step otg_off[] = {
{ .func = TG_DISABLE_CRTC },
{ .func = TG_ENABLE_OPTC_CLOCK,
.meta.tg_enable_optc_clock.enable = false },
@@ -302,6 +314,20 @@ static const struct dcn401_commit_step crtc[] = {
{ .func = TG_SET_STATIC_SCREEN_CONTROL },
{ .func = TG_SET_OUT_MUX },
+};
+
+static const struct dcn401_commit_step dsc[] = {
+ { .func = DCCG_SET_DTO_DSCCLK, .meta.skip_if.no_dsc = true },
+ { .func = DSC_SET_CONFIG, .meta.skip_if.no_dsc = true },
+ { .func = DSC_ENABLE, .meta.skip_if.no_dsc = true },
+};
+
+static const struct dcn401_commit_step optc_dsc[] = {
+ { .func = TG_SET_DSC_CONFIG, .meta.tg_set_dsc_config.enable = true,
+ .meta.skip_if.no_dsc = true },
+};
+
+static const struct dcn401_commit_step output[] = {
{ .func = DIO_LINK_ENC_ENABLE_DP_OUTPUT },
{ .func = DCCG_ENABLE_SYMCLK_SE },
/* dcn401_enable_stream divides by one unless the signal is HDMI or DVI. */
@@ -373,6 +399,9 @@ static_assert(ARRAY_SIZE(prepare_bandwidth) +
ARRAY_SIZE(unlock) +
DCN401_MAX_DPP_PIPES * ARRAY_SIZE(dcn401_power_down) +
ARRAY_SIZE(stream_off) +
+ ARRAY_SIZE(optc_dsc_off) +
+ DCN401_MAX_OPP_HEADS * ARRAY_SIZE(dsc_off) +
+ ARRAY_SIZE(otg_off) +
ARRAY_SIZE(postamble) <=
DC2_BLS_MAX_STEPS,
"dcn401 commit stream-off head exceeds DC2_BLS_MAX_STEPS");
@@ -380,11 +409,14 @@ static_assert(ARRAY_SIZE(prepare_bandwidth) +
ARRAY_SIZE(stream_timing) +
ARRAY_SIZE(opp_clock) +
ARRAY_SIZE(crtc) +
+ 2 * ARRAY_SIZE(optc_dsc) +
+ ARRAY_SIZE(output) +
ARRAY_SIZE(front_end_lock) +
ARRAY_SIZE(front_end) +
DCN401_MAX_OPP_HEADS * (
ARRAY_SIZE(odm) +
2 * ARRAY_SIZE(blank) +
+ 2 * ARRAY_SIZE(dsc) +
ARRAY_SIZE(front_end_odm)) +
ARRAY_SIZE(postamble) <=
DC2_BLS_MAX_STEPS,
@@ -412,6 +444,15 @@ static const struct dcn401_sub_sequence bls_head[] = {
{ .flags = DCN401_CURRENT_STATE | DCN401_PER_STREAM_PER_OTG_MASTER,
.steps = stream_off,
.count = ARRAY_SIZE(stream_off) },
+ { .flags = DCN401_CURRENT_STATE | DCN401_PER_STREAM_PER_OTG_MASTER,
+ .steps = optc_dsc_off,
+ .count = ARRAY_SIZE(optc_dsc_off) },
+ { .flags = DCN401_CURRENT_STATE | DCN401_PER_STREAM_PER_OPP_HEAD,
+ .steps = dsc_off,
+ .count = ARRAY_SIZE(dsc_off) },
+ { .flags = DCN401_CURRENT_STATE | DCN401_PER_STREAM_PER_OTG_MASTER,
+ .steps = otg_off,
+ .count = ARRAY_SIZE(otg_off) },
{ .flags = DCN401_NEW_STATE | DCN401_PER_STREAM_PER_OTG_MASTER,
.steps = stream_timing,
.count = ARRAY_SIZE(stream_timing) },
@@ -427,12 +468,27 @@ static const struct dcn401_sub_sequence bls_head[] = {
{ .flags = DCN401_NEW_STATE | DCN401_PER_STREAM_PER_OTG_MASTER,
.steps = crtc,
.count = ARRAY_SIZE(crtc) },
+ { .flags = DCN401_NEW_STATE | DCN401_PER_STREAM_PER_OPP_HEAD,
+ .steps = dsc,
+ .count = ARRAY_SIZE(dsc) },
+ { .flags = DCN401_NEW_STATE | DCN401_PER_STREAM_PER_OTG_MASTER,
+ .steps = optc_dsc,
+ .count = ARRAY_SIZE(optc_dsc) },
+ { .flags = DCN401_NEW_STATE | DCN401_PER_STREAM_PER_OTG_MASTER,
+ .steps = output,
+ .count = ARRAY_SIZE(output) },
{ .flags = DCN401_NEW_STATE | DCN401_PER_STREAM_PER_OTG_MASTER,
.steps = front_end_lock,
.count = ARRAY_SIZE(front_end_lock) },
{ .flags = DCN401_NEW_STATE | DCN401_PER_STREAM_PER_OPP_HEAD,
.steps = front_end_odm,
.count = ARRAY_SIZE(front_end_odm) },
+ { .flags = DCN401_NEW_STATE | DCN401_PER_STREAM_PER_OPP_HEAD,
+ .steps = dsc,
+ .count = ARRAY_SIZE(dsc) },
+ { .flags = DCN401_NEW_STATE | DCN401_PER_STREAM_PER_OTG_MASTER,
+ .steps = optc_dsc,
+ .count = ARRAY_SIZE(optc_dsc) },
{ .flags = DCN401_NEW_STATE | DCN401_PER_STREAM_PER_OPP_HEAD,
.steps = blank,
.count = ARRAY_SIZE(blank) },
diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
index bc7dd933e35e..38b40fe8b02b 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
@@ -189,14 +189,19 @@ static bool check_link_encoder(const struct dc *dc,
return link->ep_type == DISPLAY_ENDPOINT_PHY && link->link_enc;
}
-static bool check_timing_flags(const struct dc *dc,
+static bool check_no_interlace(const struct dc *dc,
const struct dc_state *state, unsigned int i)
{
- const struct dc_crtc_timing *timing = &state->streams[i]->timing;
+ (void)dc;
+ return !state->streams[i]->timing.flags.INTERLACE;
+}
+static bool check_no_stereo(const struct dc *dc,
+ const struct dc_state *state, unsigned int i)
+{
(void)dc;
- return !timing->flags.DSC && !timing->flags.INTERLACE &&
- timing->timing_3d_format == TIMING_3D_FORMAT_NONE;
+ return state->streams[i]->timing.timing_3d_format ==
+ TIMING_3D_FORMAT_NONE;
}
/* The DPG black and the pixel rate divider are fixed for RGB. */
@@ -389,11 +394,26 @@ static bool check_pipe_audio(const struct dc *dc,
static bool check_pipe_dsc(const struct dc *dc,
const struct dc_state *state, unsigned int i)
{
- const struct pipe_ctx *pipe = dcn401_otg_master(state,
- state->streams[i]);
+ const struct dc_stream_state *stream = state->streams[i];
+ struct pipe_ctx *opp_heads[MAX_PIPES];
+ int j, n;
(void)dc;
- return pipe && !pipe->stream_res.dsc;
+ n = resource_get_opp_heads_for_stream(stream,
+ (struct resource_context *)&state->res_ctx, opp_heads);
+ for (j = 0; j < n; j++)
+ if (!opp_heads[j]->stream_res.dsc != !stream->timing.flags.DSC)
+ return false;
+ return true;
+}
+
+static bool check_dsc_pixel_clock(const struct dc *dc,
+ const struct dc_state *state, unsigned int i)
+{
+ const struct dc_crtc_timing *timing = &state->streams[i]->timing;
+
+ (void)dc;
+ return !timing->flags.DSC || timing->pix_clk_100hz > 480000;
}
static bool check_pipe_gsl(const struct dc *dc,
@@ -438,8 +458,10 @@ static enum bls_builder_result dcn401_check_one_stream(const struct dc *dc,
CHECK_STREAM_CONDITION(own_link, "streams share a link");
CHECK_STREAM_CONDITION(virtual_signal, "signal is not virtual");
CHECK_STREAM_RESOURCE(link_encoder, "link encoder is not DIO");
- CHECK_STREAM_CONDITION(timing_flags,
- "timing is DSC, interlace, or stereo");
+ CHECK_STREAM_CONDITION(no_interlace, "timing is interlace");
+ CHECK_STREAM_CONDITION(no_stereo, "timing is stereo");
+ CHECK_STREAM_CONDITION(dsc_pixel_clock,
+ "dsc pixel clock is 48 MHz or less");
CHECK_STREAM_CONDITION(rgb_srgb, "stream is not RGB sRGB");
CHECK_STREAM_CONDITION(no_drr, "DRR is set");
CHECK_STREAM_CONDITION(no_boot_dpms_writeback,
@@ -453,7 +475,8 @@ static enum bls_builder_result dcn401_check_one_stream(const struct dc *dc,
CHECK_STREAM_RESOURCE(otg_master_blocks,
"otg master is missing a stream resource or pixel clock");
CHECK_STREAM_CONDITION(pipe_audio, "audio is set");
- CHECK_STREAM_CONDITION(pipe_dsc, "dsc is set");
+ CHECK_STREAM_RESOURCE(pipe_dsc,
+ "dsc differs from the timing on an opp head");
CHECK_STREAM_CONDITION(pipe_gsl, "gsl is set");
CHECK_STREAM_CONDITION(link_enc_assignment,
"link encoder assignment differs");
@@ -921,6 +944,43 @@ static bool check_no_cursor(const struct dc *dc,
return !new_state->streams[i]->cursor_attributes.address.quad_part;
}
+static bool dcn401_same_opp_heads(const struct dc_state *current_state,
+ const struct dc_state *new_state,
+ const struct dc_stream_state *stream)
+{
+ const struct pipe_ctx *cur = dcn401_otg_master(current_state, stream);
+ const struct pipe_ctx *new = dcn401_otg_master(new_state, stream);
+ struct pipe_ctx *cur_heads[MAX_PIPES], *new_heads[MAX_PIPES];
+ int i, n;
+
+ if (!cur || !new)
+ return false;
+ n = resource_get_opp_heads_for_otg_master(cur,
+ (struct resource_context *)¤t_state->res_ctx,
+ cur_heads);
+ if (n != resource_get_opp_heads_for_otg_master(new,
+ (struct resource_context *)&new_state->res_ctx,
+ new_heads))
+ return false;
+ for (i = 0; i < n; i++)
+ if (!cur_heads[i]->stream_res.opp ||
+ !new_heads[i]->stream_res.opp ||
+ cur_heads[i]->stream_res.opp->inst !=
+ new_heads[i]->stream_res.opp->inst)
+ return false;
+ return true;
+}
+
+static bool check_dsc_odm_kept(const struct dc *dc,
+ const struct dc_state *current_state,
+ const struct dc_state *new_state, unsigned int i)
+{
+ (void)dc;
+ return !new_state->streams[i]->timing.flags.DSC ||
+ dcn401_same_opp_heads(current_state, new_state,
+ new_state->streams[i]);
+}
+
static bool check_no_dsc_change(const struct dc *dc,
const struct dc_state *current_state,
const struct dc_state *new_state, unsigned int i)
@@ -1212,6 +1272,7 @@ enum bls_builder_result dcn401_check_stream_update(const struct dc *dc,
/* Not programmed by this update. */
CHECK_UPDATE(no_cursor, "cursor is set");
CHECK_UPDATE(no_dsc_change, "dsc changes");
+ CHECK_UPDATE(dsc_odm_kept, "odm changes on a dsc stream");
return BLS_BUILD_SUCCESS;
}
@@ -1363,6 +1424,40 @@ static const struct dcn401_commit_step opp_odm[] = {
.meta.skip_if.pipe_deltas_all = true },
};
+static const struct dcn401_commit_step dsc[] = {
+ { .func = DCCG_SET_DTO_DSCCLK,
+ .meta.skip_if.stream_unchanged = true,
+ .meta.skip_if.only_addresses_changed = true,
+ .meta.skip_if.no_dsc = true,
+ .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true,
+ .meta.skip_if.pipe_deltas.odm_kept = true,
+ .meta.skip_if.pipe_deltas_all = true },
+ { .func = DSC_SET_CONFIG,
+ .meta.skip_if.stream_unchanged = true,
+ .meta.skip_if.only_addresses_changed = true,
+ .meta.skip_if.no_dsc = true,
+ .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true,
+ .meta.skip_if.pipe_deltas.odm_kept = true,
+ .meta.skip_if.pipe_deltas_all = true },
+ { .func = DSC_ENABLE,
+ .meta.skip_if.stream_unchanged = true,
+ .meta.skip_if.only_addresses_changed = true,
+ .meta.skip_if.no_dsc = true,
+ .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true,
+ .meta.skip_if.pipe_deltas.odm_kept = true,
+ .meta.skip_if.pipe_deltas_all = true },
+};
+
+static const struct dcn401_commit_step optc_dsc[] = {
+ { .func = TG_SET_DSC_CONFIG, .meta.tg_set_dsc_config.enable = true,
+ .meta.skip_if.stream_unchanged = true,
+ .meta.skip_if.only_addresses_changed = true,
+ .meta.skip_if.no_dsc = true,
+ .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true,
+ .meta.skip_if.pipe_deltas.odm_kept = true,
+ .meta.skip_if.pipe_deltas_all = true },
+};
+
/*
* Under the lock, each current pipe that the update removes leaves its
* MPCC and returns its DET segments, as DC1 disconnects a disabled pipe.
@@ -1751,9 +1846,11 @@ static_assert(
ARRAY_SIZE(lock) +
ARRAY_SIZE(first_hubp) +
ARRAY_SIZE(global_sync) +
+ ARRAY_SIZE(optc_dsc) +
DCN401_MAX_OPP_HEADS * (
ARRAY_SIZE(opp_unblank) +
- ARRAY_SIZE(opp_odm)) +
+ ARRAY_SIZE(opp_odm) +
+ ARRAY_SIZE(dsc)) +
ARRAY_SIZE(unlock) +
ARRAY_SIZE(pstate) +
ARRAY_SIZE(odm_wait) +
@@ -1848,6 +1945,22 @@ static void dcn401_odm_combine_params(struct pipe_ctx *otg_master,
true);
}
+static void dcn401_dsc_config_params(struct pipe_ctx *otg_master,
+ bool enable, struct tg_set_dsc_config_params *p)
+{
+ struct dsc_optc_config optc;
+
+ p->tg = otg_master->stream_res.tg;
+ p->dsc_mode = OPTC_DSC_DISABLED;
+ if (!enable || !hwss_prepare_dsc_config_for_pipe(otg_master,
+ resource_get_odm_slice_count(otg_master), 0, &optc))
+ return;
+ p->dsc_mode = optc.is_pixel_format_444 ? OPTC_DSC_ENABLED_444 :
+ OPTC_DSC_ENABLED_NATIVE_SUBSAMPLED;
+ p->bytes_per_pixel = optc.bytes_per_pixel;
+ p->slice_width = optc.slice_width;
+}
+
static void dcn401_program_timing_params(const struct pipe_ctx *pipe,
struct tg_program_timing_params *p)
{
@@ -2200,6 +2313,39 @@ static void dcn401_add_step(struct block_sequence_state *sequence,
p->opp_program_left_edge_extra_pixel_params.is_otg_master =
!pipe->prev_odm_pipe;
break;
+ case DCCG_SET_DTO_DSCCLK:
+ p->dccg_set_dto_dscclk_params.dccg = dc->res_pool->dccg;
+ p->dccg_set_dto_dscclk_params.inst = pipe->stream_res.dsc->inst;
+ p->dccg_set_dto_dscclk_params.num_slices_h =
+ pipe->stream->timing.dsc_cfg.num_slices_h /
+ resource_get_odm_slice_count(pipe);
+ break;
+ case DSC_SET_CONFIG:
+ if (!hwss_prepare_dsc_config_for_pipe(pipe,
+ resource_get_odm_slice_count(pipe), 0, NULL)) {
+ (*sequence->num_steps)--;
+ return;
+ }
+ p->dsc_set_config_params.dsc = pipe->stream_res.dsc;
+ break;
+ case DSC_ENABLE:
+ p->dsc_enable_params.dsc = pipe->stream_res.dsc;
+ p->dsc_enable_params.opp_inst = pipe->stream_res.opp->inst;
+ break;
+ case TG_SET_DSC_CONFIG:
+ dcn401_dsc_config_params(pipe, m->tg_set_dsc_config.enable,
+ &p->tg_set_dsc_config_params);
+ break;
+ case DSC_DISCONNECT:
+ p->dsc_disconnect_params.dsc = pipe->stream_res.dsc;
+ break;
+ case DSC_DISABLE:
+ p->dsc_disable_params.dsc = pipe->stream_res.dsc;
+ break;
+ case DCCG_SET_REF_DSCCLK:
+ p->dccg_set_ref_dscclk_params.dccg = dc->res_pool->dccg;
+ p->dccg_set_ref_dscclk_params.dsc = pipe->stream_res.dsc;
+ break;
case OPP_PROGRAM_FMT:
p->opp_program_fmt_params.opp = pipe->stream_res.opp;
p->opp_program_fmt_params.fmt_bit_depth =
@@ -2605,33 +2751,6 @@ static void dcn401_add_step(struct block_sequence_state *sequence,
}
}
-static bool dcn401_same_opp_heads(const struct dc_state *current_state,
- const struct dc_state *new_state,
- const struct dc_stream_state *stream)
-{
- const struct pipe_ctx *cur = dcn401_otg_master(current_state, stream);
- const struct pipe_ctx *new = dcn401_otg_master(new_state, stream);
- struct pipe_ctx *cur_heads[MAX_PIPES], *new_heads[MAX_PIPES];
- int i, n;
-
- if (!cur || !new)
- return false;
- n = resource_get_opp_heads_for_otg_master(cur,
- (struct resource_context *)¤t_state->res_ctx,
- cur_heads);
- if (n != resource_get_opp_heads_for_otg_master(new,
- (struct resource_context *)&new_state->res_ctx,
- new_heads))
- return false;
- for (i = 0; i < n; i++)
- if (!cur_heads[i]->stream_res.opp ||
- !new_heads[i]->stream_res.opp ||
- cur_heads[i]->stream_res.opp->inst !=
- new_heads[i]->stream_res.opp->inst)
- return false;
- return true;
-}
-
static void dcn401_eval_pipe_deltas(const struct dcn401_commit_step_args *args,
unsigned int idx, struct dcn401_pipe_deltas *deltas)
{
@@ -2720,6 +2839,8 @@ static bool dcn401_skip_step(const struct dcn401_commit_step_args *args,
(!args->pipe->stream_res.opp ||
!args->pipe->stream_res.opp->mpc_tree_params.opp_list))
return true;
+ if (step->meta.skip_if.no_dsc && !args->pipe->stream_res.dsc)
+ return true;
if (dcn401_pipe_deltas_match(skip, &deltas,
step->meta.skip_if.pipe_deltas_all))
return true;
@@ -2917,6 +3038,12 @@ static const struct dcn401_sub_sequence bls_stream_update[] = {
{ .flags = DCN401_NEW_STATE | DCN401_PER_STREAM_PER_OPP_HEAD,
.steps = opp_odm,
.count = ARRAY_SIZE(opp_odm) },
+ { .flags = DCN401_NEW_STATE | DCN401_PER_STREAM_PER_OPP_HEAD,
+ .steps = dsc,
+ .count = ARRAY_SIZE(dsc) },
+ { .flags = DCN401_NEW_STATE | DCN401_PER_STREAM_PER_OTG_MASTER,
+ .steps = optc_dsc,
+ .count = ARRAY_SIZE(optc_dsc) },
{ .flags = DCN401_NEW_STATE | DCN401_PER_STREAM_PER_DPP_PIPE,
.stages = enable_plane,
.stage_count = ARRAY_SIZE(enable_plane) },
diff --git a/drivers/gpu/drm/amd/display/dc/bls_executor/bls_executor.c b/drivers/gpu/drm/amd/display/dc/bls_executor/bls_executor.c
index 894e498e1ff4..32ff31b17f8d 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_executor/bls_executor.c
+++ b/drivers/gpu/drm/amd/display/dc/bls_executor/bls_executor.c
@@ -45,6 +45,7 @@ static noinline_for_stack bool dc2_bls_step_supported(const struct dc2 *dc2,
struct hubp *hubp;
struct dpp *dpp;
struct mpc *mpc;
+ const struct display_stream_compressor *dsc;
switch (step->func) {
case LEGACY_CLK_MGR_INIT_CLOCKS:
@@ -439,6 +440,28 @@ static noinline_for_stack bool dc2_bls_step_supported(const struct dc2 *dc2,
case DCCG_SET_DTBCLK_P_SRC:
dccg = step->params.dccg_set_dtbclk_p_src_params.dccg;
return dccg && dccg->funcs && dccg->funcs->set_dtbclk_p_src;
+ case DCCG_SET_DTO_DSCCLK:
+ dccg = step->params.dccg_set_dto_dscclk_params.dccg;
+ return dccg && dccg->funcs && dccg->funcs->set_dto_dscclk;
+ case DCCG_SET_REF_DSCCLK:
+ dccg = step->params.dccg_set_ref_dscclk_params.dccg;
+ return dccg && dccg->funcs && dccg->funcs->set_ref_dscclk &&
+ step->params.dccg_set_ref_dscclk_params.dsc;
+ case DSC_SET_CONFIG:
+ dsc = step->params.dsc_set_config_params.dsc;
+ return dsc && dsc->funcs && dsc->funcs->dsc_set_config;
+ case DSC_ENABLE:
+ dsc = step->params.dsc_enable_params.dsc;
+ return dsc && dsc->funcs && dsc->funcs->dsc_enable;
+ case DSC_DISCONNECT:
+ dsc = step->params.dsc_disconnect_params.dsc;
+ return dsc && dsc->funcs && dsc->funcs->dsc_disconnect;
+ case DSC_DISABLE:
+ dsc = step->params.dsc_disable_params.dsc;
+ return dsc && dsc->funcs && dsc->funcs->dsc_disable;
+ case TG_SET_DSC_CONFIG:
+ tg = step->params.tg_set_dsc_config_params.tg;
+ return tg && tg->funcs && tg->funcs->set_dsc_config;
case CLK_SRC_PROGRAM_PIX_CLK: {
const struct clk_src_program_pix_clk_params *p =
&step->params.clk_src_program_pix_clk_params;
@@ -1445,6 +1468,57 @@ enum dc2_bls_exec_result dc2_bls_execute(
p->otg_inst);
break;
}
+ case DCCG_SET_DTO_DSCCLK: {
+ const struct dccg_set_dto_dscclk_params *p =
+ &entry->params.dccg_set_dto_dscclk_params;
+
+ p->dccg->funcs->set_dto_dscclk(p->dccg, p->inst,
+ p->num_slices_h);
+ break;
+ }
+ case DCCG_SET_REF_DSCCLK: {
+ const struct dccg_set_ref_dscclk_params *p =
+ &entry->params.dccg_set_ref_dscclk_params;
+
+ p->dccg->funcs->set_ref_dscclk(p->dccg, p->dsc->inst);
+ break;
+ }
+ case DSC_SET_CONFIG: {
+ struct display_stream_compressor *dsc =
+ entry->params.dsc_set_config_params.dsc;
+
+ dsc->funcs->dsc_set_config(dsc);
+ break;
+ }
+ case DSC_ENABLE: {
+ const struct dsc_enable_params *p =
+ &entry->params.dsc_enable_params;
+
+ p->dsc->funcs->dsc_enable(p->dsc, p->opp_inst);
+ break;
+ }
+ case DSC_DISCONNECT: {
+ struct display_stream_compressor *dsc =
+ entry->params.dsc_disconnect_params.dsc;
+
+ dsc->funcs->dsc_disconnect(dsc);
+ break;
+ }
+ case DSC_DISABLE: {
+ struct display_stream_compressor *dsc =
+ entry->params.dsc_disable_params.dsc;
+
+ dsc->funcs->dsc_disable(dsc);
+ break;
+ }
+ case TG_SET_DSC_CONFIG: {
+ const struct tg_set_dsc_config_params *p =
+ &entry->params.tg_set_dsc_config_params;
+
+ p->tg->funcs->set_dsc_config(p->tg, p->dsc_mode,
+ p->bytes_per_pixel, p->slice_width);
+ break;
+ }
case CLK_SRC_PROGRAM_PIX_CLK: {
const struct clk_src_program_pix_clk_params *p =
&entry->params.clk_src_program_pix_clk_params;
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 15/30] drm/amd/display: enable dcn42b hubp/dpp pg control from driver side
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (13 preceding siblings ...)
2026-12-01 20:22 ` [PATCH v2 14/30] drm/amd/display: Program DSC on one stream in DC2 George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 20:22 ` [PATCH v2 16/30] drm/amd/display: cover gamma 2.4 and 2.6 on the wide curve George Zhang
` (14 subsequent siblings)
29 siblings, 0 replies; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Charlene Liu, Leo Chen,
George Zhang
From: Charlene Liu <Charlene.Liu@amd.com>
[why]
dcn42/dcn42b sharing same dmubfw source from same branch.
driver side needs also in sync:
dcn42 re-enabled hubp/dpp pg, dcn42b needs update as well.
Cc: Leo Chen <leo.chen@amd.com>
Signed-off-by: Charlene Liu <Charlene.Liu@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
.../gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c
index aeecdd2daae2..497df23095c9 100644
--- a/drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c
@@ -803,8 +803,8 @@ static const struct dc_debug_options debug_defaults_drv = {
.clock_trace = true,
.disable_pplib_clock_request = false,
.ignore_pg = false,
- .disable_dpp_power_gate = true,
- .disable_hubp_power_gate = true,
+ .disable_dpp_power_gate = false,
+ .disable_hubp_power_gate = false,
.disable_optc_power_gate = true,
.disable_dsc_power_gate = false,
.disable_dio_power_gate = true,
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 16/30] drm/amd/display: cover gamma 2.4 and 2.6 on the wide curve
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (14 preceding siblings ...)
2026-12-01 20:22 ` [PATCH v2 15/30] drm/amd/display: enable dcn42b hubp/dpp pg control from driver side George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 20:22 ` [PATCH v2 17/30] drm/amd/display: Revoke alternate channel P-State before pipe teardown George Zhang
` (13 subsequent siblings)
29 siblings, 0 replies; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, George Zhang
From: Harry Wentland <harry.wentland@amd.com>
cm3_helper_translate_curve_to_hw_format() puts PQ, gamma 2.2, and HLG
on 32 regions from 2^-25 to 2^7. Gamma 2.4 and 2.6 used the other
layout, 12 regions from 2^-12 to 2^0.
cm_helper_translate_curve_to_hw_format() has the same split, for PQ
and gamma 2.2 only. DCN 2.0, 2.01, 2.1, 3.0, 3.01, 3.1, and 3.14
program the plane shaper through dcn20_set_shaper_3dlut(), which calls
that helper. The same helper also programs stream output regamma on
DCN 1.0, output gamma and the blend LUT on DCN 2.x, the DCN 3.0
writeback (DWB) path, and the stream shaper on DCN 3.0 and 3.2.
The inverse curve is the shaper, and its input is linear light from
degamma. A 10-bit code v becomes (v/1023)^g. That is below 2^-12 for
v = 1..31 at gamma 2.4 and v = 1..41 at gamma 2.6, so those codes come
back as 0. On a gray ramp the round trip then misses the IGT bracket
of 13. Gamma 2.4 needs a bracket of 33 and gamma 2.6 needs 41. Gamma
2.2 already uses the wide curve and its round trip is exact.
Use the 32-region curve for gamma 2.4 and 2.6 in both helpers. Its low
end is 2^-25, which covers those dark codes. On DCN 4.0.1 the gamma
2.4 round trip is exact and gamma 2.6 is off by one 10-bit code, so
the original bracket of 13 passes. Only the DCN 4.0.1 plane shaper
path was tested; the DCN 1.x, 2.x and 3.x paths listed above were not.
Cc: Alex Hung <alex.hung@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c | 4 +++-
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c | 2 ++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c
index 502a2d9b155f..6b3cc0d81e34 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c
@@ -355,7 +355,9 @@ bool cm_helper_translate_curve_to_hw_format(struct dc_context *ctx,
memset(lut_params, 0, sizeof(struct pwl_params));
memset(seg_distr, 0, sizeof(seg_distr));
- if (output_tf->tf == TRANSFER_FUNCTION_PQ || output_tf->tf == TRANSFER_FUNCTION_GAMMA22) {
+ if (output_tf->tf == TRANSFER_FUNCTION_PQ || output_tf->tf == TRANSFER_FUNCTION_GAMMA22 ||
+ output_tf->tf == TRANSFER_FUNCTION_GAMMA24 ||
+ output_tf->tf == TRANSFER_FUNCTION_GAMMA26) {
/* 32 segments
* segments are from 2^-25 to 2^7
*/
diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c
index eb299f7f9c41..8a76e985d359 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c
@@ -133,6 +133,8 @@ bool cm3_helper_translate_curve_to_hw_format(struct dc_context *ctx,
memset(seg_distr, 0, sizeof(seg_distr));
if (output_tf->tf == TRANSFER_FUNCTION_PQ || output_tf->tf == TRANSFER_FUNCTION_GAMMA22 ||
+ output_tf->tf == TRANSFER_FUNCTION_GAMMA24 ||
+ output_tf->tf == TRANSFER_FUNCTION_GAMMA26 ||
output_tf->tf == TRANSFER_FUNCTION_HLG) {
/* 32 segments
* segments are from 2^-25 to 2^7
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 17/30] drm/amd/display: Revoke alternate channel P-State before pipe teardown
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (15 preceding siblings ...)
2026-12-01 20:22 ` [PATCH v2 16/30] drm/amd/display: cover gamma 2.4 and 2.6 on the wide curve George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 21:09 ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 18/30] drm/amd/display: block pr in mst right George Zhang
` (12 subsequent siblings)
29 siblings, 1 reply; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Alvin Lee, George Zhang
From: Ivan Lipski <ivan.lipski@amd.com>
[Why]
A modeset after stress testing can hang PMFW. The hang only happens
when alternate channel P-State switching is in use.
Alternate channel P-State permission was sequenced the opposite way to
UCLK/FCLK P-State: it could be enabled during prepare_bandwidth, before
the new configuration was programmed, and was only disabled during
optimize_bandwidth, after the old configuration had been torn down.
PMFW could therefore start an alternate channel switch that depended on
a display being disabled and never complete it.
The IndicatePstateStatus messages also did not follow the computed
action. With no active planes, prepare_bandwidth decided to revoke
UCLK/FCLK P-State but still told PMFW they were allowed, and the enable
message could briefly re-allow a state the action was revoking.
[How]
Only allow alternate channel P-State when it is safe to lower, and
revoke it as soon as the new state does not support it.
Only treat zero active planes as UCLK/FCLK P-State support when it is
safe to lower, so prepare_bandwidth never grants it for a config that
has not been programmed yet.
Derive allow_uclk, allow_fclk and alt_ch_enable once from the action
and the current clocks. The IndicatePstateStatus messages no longer
recount the active planes to allow UCLK/FCLK P-State on their own; the
zero plane case is decided only by the action.
Cc: Alvin Lee <alvin.lee2@amd.com>
Signed-off-by: Ivan Lipski <ivan.lipski@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
.../display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c | 35 ++++++++++---------
1 file changed, 19 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c
index 9556da79cdce..4b73dd8b5382 100644
--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c
+++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c
@@ -1211,10 +1211,10 @@ static void dcn60_make_bandwidth_clocks_update_action(
bool dcfclk_dpm_enabled = dcn60_is_ppclk_dpm_enabled(clk_mgr_internal,
PPCLK_DCFCLK);
bool uclk_pstate_supported = new_clocks->p_state_change_support
- || (total_plane_count == 0);
+ || (total_plane_count == 0 && safe_to_lower);
bool fclk_pstate_supported = new_clocks->fclk_p_state_change_support
- || (total_plane_count == 0);
+ || (total_plane_count == 0 && safe_to_lower);
memset(action, 0, sizeof(*action));
/* clock actions */
@@ -1282,9 +1282,10 @@ static void dcn60_make_bandwidth_clocks_update_action(
}
if (new_clocks->alt_ch_pstate_switch != clk_mgr_base->clks.alt_ch_pstate_switch) {
- action->alt_ch.enable = new_clocks->alt_ch_pstate_switch;
- action->alt_ch.disable = !new_clocks->alt_ch_pstate_switch
+ /* PMFW hangs if alt-ch is still allowed while pipes are torn down */
+ action->alt_ch.enable = new_clocks->alt_ch_pstate_switch
&& safe_to_lower;
+ action->alt_ch.disable = !new_clocks->alt_ch_pstate_switch;
action->alt_ch.send_message = action->alt_ch.enable
|| action->alt_ch.disable;
}
@@ -1296,7 +1297,6 @@ static void dcn60_make_bandwidth_clocks_update_action(
* @block_sequence: output array of block sequence steps
* @action: action struct populated by dcn60_make_bandwidth_clocks_update_action
* @clk_mgr_base: current clock manager state (read-only, used for original values)
- * @context: dc state with active plane information
* @new_clocks: requested clock values for message parameters
*
* Return: number of steps written to block_sequence
@@ -1305,11 +1305,16 @@ static unsigned int dcn60_build_bandwidth_clocks_block_sequence_with_action(
struct dcn60_clk_mgr_block_sequence *block_sequence,
struct dcn60_bandwidth_clocks_update_action *action,
struct clk_mgr *clk_mgr_base,
- struct dc_state *context,
struct dc_clocks *new_clocks)
{
unsigned int num_steps = 0;
- bool no_active_planes = clk_mgr_helper_get_active_plane_cnt(clk_mgr_base->ctx->dc, context) == 0;
+ const struct dc_clocks *cur = &clk_mgr_base->clks;
+ bool allow_uclk = action->uclk_pstate.enable
+ || (!action->uclk_pstate.disable && cur->p_state_change_support);
+ bool allow_fclk = action->fclk_pstate.enable
+ || (!action->fclk_pstate.disable && cur->fclk_p_state_change_support);
+ bool alt_ch_enable = action->alt_ch.enable
+ || (!action->alt_ch.disable && cur->alt_ch_pstate_switch);
/* CLK_MGR60_INDICATE_PSTATE_STATUS — enable */
if ((action->uclk_pstate.enable && action->uclk_pstate.send_message)
@@ -1317,15 +1322,13 @@ static unsigned int dcn60_build_bandwidth_clocks_block_sequence_with_action(
|| (action->fams.enable && action->fams.send_message)
|| (action->alt_ch.enable && action->alt_ch.send_message)) {
block_sequence[num_steps].params.indicate_pstate_status_params.allow_uclk =
- action->uclk_pstate.enable
- || clk_mgr_base->clks.p_state_change_support;
+ allow_uclk;
block_sequence[num_steps].params.indicate_pstate_status_params.allow_fclk =
- action->fclk_pstate.enable
- || clk_mgr_base->clks.fclk_p_state_change_support;
+ allow_fclk;
block_sequence[num_steps].params.indicate_pstate_status_params.drr_enable =
new_clocks->fw_based_mclk_switching;
block_sequence[num_steps].params.indicate_pstate_status_params.alt_ch_enable =
- new_clocks->alt_ch_pstate_switch;
+ alt_ch_enable;
block_sequence[num_steps].params.indicate_pstate_status_params.wait_resp =
new_clocks->fw_based_mclk_switching;
block_sequence[num_steps].func = CLK_MGR60_INDICATE_PSTATE_STATUS;
@@ -1369,13 +1372,13 @@ static unsigned int dcn60_build_bandwidth_clocks_block_sequence_with_action(
|| (action->fams.disable && action->fams.send_message)
|| (action->alt_ch.disable && action->alt_ch.send_message)) {
block_sequence[num_steps].params.indicate_pstate_status_params.allow_uclk =
- new_clocks->p_state_change_support || no_active_planes;
+ allow_uclk;
block_sequence[num_steps].params.indicate_pstate_status_params.allow_fclk =
- new_clocks->fclk_p_state_change_support || no_active_planes;
+ allow_fclk;
block_sequence[num_steps].params.indicate_pstate_status_params.drr_enable =
new_clocks->fw_based_mclk_switching;
block_sequence[num_steps].params.indicate_pstate_status_params.alt_ch_enable =
- new_clocks->alt_ch_pstate_switch;
+ alt_ch_enable;
block_sequence[num_steps].params.indicate_pstate_status_params.wait_resp =
new_clocks->fw_based_mclk_switching;
block_sequence[num_steps].func = CLK_MGR60_INDICATE_PSTATE_STATUS;
@@ -1469,7 +1472,7 @@ static unsigned int dcn60_build_update_bandwidth_clocks_sequence(
num_steps = dcn60_build_bandwidth_clocks_block_sequence_with_action(
clk_mgr60->block_sequence, &action,
- clk_mgr_base, context, new_clocks);
+ clk_mgr_base, new_clocks);
dcn60_update_bandwidth_clocks_state_with_action(clk_mgr_base, &action, new_clocks);
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 18/30] drm/amd/display: block pr in mst right
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (16 preceding siblings ...)
2026-12-01 20:22 ` [PATCH v2 17/30] drm/amd/display: Revoke alternate channel P-State before pipe teardown George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 20:46 ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 19/30] drm/amd/display: Add a per-ASIC default for the DC2 selection George Zhang
` (11 subsequent siblings)
29 siblings, 1 reply; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Peichen Huang, Robin Chen,
George Zhang
From: Peichen Huang <PeiChen.Huang@amd.com>
[Why]
Should check mst link in stream signal not connector signal
[How]
Use stream signal to check if it is a dp sst link. Also guard against
a NULL link_enc when filling dpphy_inst in dp_pr_copy_settings().
Cc: Robin Chen <robin.chen@amd.com>
Signed-off-by: Peichen Huang <PeiChen.Huang@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
.../dc/link/protocols/link_dp_panel_replay.c | 20 +++++++++----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.c
index 65a791ccf6b2..24cc882eb168 100644
--- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.c
+++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.c
@@ -53,13 +53,11 @@ static void dp_pr_set_static_screen_param(struct dc_link *link)
{
struct dc_static_screen_params params = {0};
struct dc *dc = link->ctx->dc;
- // only support DP sst for now
- if (!dc_is_dp_sst_signal(link->connector_signal))
- return;
for (int i = 0; i < MAX_PIPES; i++) {
if (dc->current_state->res_ctx.pipe_ctx[i].stream &&
- dc->current_state->res_ctx.pipe_ctx[i].stream->link == link) {
+ dc->current_state->res_ctx.pipe_ctx[i].stream->link == link &&
+ dc_is_dp_sst_signal(dc->current_state->res_ctx.pipe_ctx[i].stream->signal)) {
struct dc_stream_state *stream = dc->current_state->res_ctx.pipe_ctx[i].stream;
unsigned int vsync_rate_hz = (unsigned int)div64_u64(div64_u64(
(stream->timing.pix_clk_100hz * (u64)100),
@@ -109,6 +107,9 @@ static bool dp_setup_panel_replay(struct dc_link *link, const struct dc_stream_s
if (!(link->replay_settings.config.replay_supported))
return false;
+ if (!stream || !dc_is_dp_sst_signal(stream->signal))
+ return false;
+
dc = link->ctx->dc;
//not sure should keep or not
@@ -212,12 +213,10 @@ bool dp_pr_get_pr_panel_inst(const struct dc *dc,
if (dc->config.frame_update_cmd_version2 == false)
return dc_get_edp_link_panel_inst(dc, link, inst_out);
- if (!dc_is_dp_sst_signal(link->connector_signal)) /* only supoprt DP sst (eDP included) for now */
- return false;
-
for (unsigned int i = 0; i < MAX_PIPES; i++) {
if (dc->current_state->res_ctx.pipe_ctx[i].stream &&
- dc->current_state->res_ctx.pipe_ctx[i].stream->link == link) {
+ dc->current_state->res_ctx.pipe_ctx[i].stream->link == link &&
+ dc_is_dp_sst_signal(dc->current_state->res_ctx.pipe_ctx[i].stream->signal)) {
/* *inst_out is equal to otg number */
if (dc->current_state->res_ctx.pipe_ctx[i].stream_res.tg)
*inst_out = dc->current_state->res_ctx.pipe_ctx[i].stream_res.tg->inst;
@@ -287,9 +286,8 @@ bool dp_pr_copy_settings(struct dc_link *link, struct replay_context *replay_con
if (dc->current_state->res_ctx.pipe_ctx[i].stream &&
dc->current_state->res_ctx.pipe_ctx[i].stream->link &&
dc->current_state->res_ctx.pipe_ctx[i].stream->link == link &&
- dc_is_dp_sst_signal(dc->current_state->res_ctx.pipe_ctx[i].stream->link->connector_signal)) {
+ dc_is_dp_sst_signal(dc->current_state->res_ctx.pipe_ctx[i].stream->signal)) {
pipe_ctx = &dc->current_state->res_ctx.pipe_ctx[i];
- /* todo: need update for MST */
break;
}
}
@@ -315,7 +313,7 @@ bool dp_pr_copy_settings(struct dc_link *link, struct replay_context *replay_con
else
cmd.pr_copy_settings.data.otg_inst = 0;
- cmd.pr_copy_settings.data.dpphy_inst = link->link_enc->transmitter;
+ cmd.pr_copy_settings.data.dpphy_inst = link->link_enc ? (uint8_t)link->link_enc->transmitter : 0;
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);
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 19/30] drm/amd/display: Add a per-ASIC default for the DC2 selection
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (17 preceding siblings ...)
2026-12-01 20:22 ` [PATCH v2 18/30] drm/amd/display: block pr in mst right George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 20:22 ` [PATCH v2 20/30] drm/amd/display: Refactor Max VStartup calculations for DCN6 George Zhang
` (10 subsequent siblings)
29 siblings, 0 replies; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Tomasz Siemek, Jun Lei,
George Zhang
From: Tomasz Siemek <tomasz.siemek@amd.com>
[Why]
The DC2 selection comes only from dc_init_data, so an ASIC cannot
default to the DC2 path. The DC2 hardware init and the DC2 commit
also cannot be selected separately.
[How]
- Add DC2_SELECTION_DEFAULT as the zero value of enum dc2_selection.
api_shim_construct resolves DEFAULT per ASIC; all ASICs resolve to
LEGACY, so zeroed dc_init_data keeps the current behavior.
- Add enum dc2_commit_method and struct dc2::commit_method. An
explicit CORE2 selection keeps the DM's init method and uses the
CORE2 commit, as before.
- Dispatch api_shim_commit_state_hw and api_shim_update_state_* on
commit_method; hardware init and release stay on the selection.
Cc: Jun Lei <jun.lei@amd.com>
Signed-off-by: Tomasz Siemek <tomasz.siemek@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
.../amd/display/dc/dc_api_dispatch/api_shim.c | 30 +++++++++++++++----
.../amd/display/dc/dc_api_dispatch/api_shim.h | 1 +
.../amd/display/dc/inc/dc_core_interface.h | 14 +++++++--
3 files changed, 36 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.c b/drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.c
index ec3b14ba8509..253722f35c30 100644
--- a/drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.c
+++ b/drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.c
@@ -10,11 +10,29 @@
#include "core2/dc_core2.h"
#include "inc/dc_core_interface.h"
+static void api_shim_construct_per_asic(struct dc *dc)
+{
+ switch (dc->ctx->dce_version) {
+ default:
+ break;
+ }
+}
+
void api_shim_construct(struct dc *dc, const struct dc_init_data *init_params)
{
- /* DM override today; ASIC allow-list later. Owned only by this shim. */
- TO_DC2(dc)->selection = init_params->dc2_selection;
- TO_DC2(dc)->init_method = init_params->dc2_init_method;
+ switch (init_params->dc2_selection) {
+ case DC2_SELECTION_DEFAULT:
+ api_shim_construct_per_asic(dc);
+ break;
+ case DC2_SELECTION_CORE2:
+ TO_DC2(dc)->selection = DC2_SELECTION_CORE2;
+ TO_DC2(dc)->init_method = init_params->dc2_init_method;
+ TO_DC2(dc)->commit_method = DC2_COMMIT_METHOD_CORE2;
+ break;
+ case DC2_SELECTION_LEGACY:
+ default:
+ break;
+ }
}
void dc_hardware_init(struct dc *dc)
@@ -35,7 +53,7 @@ void dc_hardware_release(struct dc *dc)
enum dc_status api_shim_commit_state_hw(struct dc *dc, struct dc_state *context)
{
- if (TO_DC2(dc)->selection == DC2_SELECTION_CORE2)
+ if (TO_DC2(dc)->commit_method == DC2_COMMIT_METHOD_CORE2)
return core2_funcs()->commit_state_hw(dc, context);
return legacy_commit_state_hw(dc, context);
}
@@ -43,7 +61,7 @@ enum dc_status api_shim_commit_state_hw(struct dc *dc, struct dc_state *context)
bool api_shim_update_state_supported(
const struct dc_update_scratch_space *scratch)
{
- if (TO_DC2(scratch->dc)->selection == DC2_SELECTION_CORE2)
+ if (TO_DC2(scratch->dc)->commit_method == DC2_COMMIT_METHOD_CORE2)
return core2_funcs()->update_state_supported(scratch);
return true;
}
@@ -51,7 +69,7 @@ bool api_shim_update_state_supported(
void api_shim_update_state_execute(
const struct dc_update_scratch_space *scratch)
{
- if (TO_DC2(scratch->dc)->selection == DC2_SELECTION_CORE2)
+ if (TO_DC2(scratch->dc)->commit_method == DC2_COMMIT_METHOD_CORE2)
core2_funcs()->update_state_execute(scratch);
else
legacy_update_state_execute(scratch);
diff --git a/drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.h b/drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.h
index 3a3ef5e90b96..1fd8a259dce0 100644
--- a/drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.h
+++ b/drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.h
@@ -16,6 +16,7 @@ struct dc2 {
struct dc dc;
enum dc2_selection selection;
enum dc2_init_method init_method;
+ enum dc2_commit_method commit_method;
/* Resolved by hardware init; later builds take it as dmub_abi. */
struct dmub_abi dmub_abi;
bool dmub_abi_resolved;
diff --git a/drivers/gpu/drm/amd/display/dc/inc/dc_core_interface.h b/drivers/gpu/drm/amd/display/dc/inc/dc_core_interface.h
index 0a4094121058..105d69af0496 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/dc_core_interface.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/dc_core_interface.h
@@ -13,11 +13,13 @@ struct dc_state;
struct dc_update_scratch_space;
/*
- * Construction-time Core implementation selection. Zero is LEGACY so existing
- * callers that leave dc uninitialized keep production behavior.
+ * Construction-time Core implementation selection. Zero is DEFAULT, which lets
+ * the ASIC choose; ASICs without a Core2 default resolve to LEGACY, so callers
+ * that leave dc_init_data zeroed keep production behavior.
*/
enum dc2_selection {
- DC2_SELECTION_LEGACY = 0,
+ DC2_SELECTION_DEFAULT = 0,
+ DC2_SELECTION_LEGACY,
DC2_SELECTION_CORE2,
};
@@ -27,6 +29,12 @@ enum dc2_init_method {
DC2_INIT_METHOD_WRAPPED,
};
+/* Temporary: picks the commit_state_hw flow for bring-up testing. */
+enum dc2_commit_method {
+ DC2_COMMIT_METHOD_LEGACY = 0,
+ DC2_COMMIT_METHOD_CORE2,
+};
+
enum dc2_hw_ownership {
DC2_HW_OWNERSHIP_RELEASED = 0,
DC2_HW_OWNERSHIP_OWNED,
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 20/30] drm/amd/display: Refactor Max VStartup calculations for DCN6
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (18 preceding siblings ...)
2026-12-01 20:22 ` [PATCH v2 19/30] drm/amd/display: Add a per-ASIC default for the DC2 selection George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 20:22 ` [PATCH v2 21/30] drm/amd/display: Improve P-state admissability logic George Zhang
` (9 subsequent siblings)
29 siblings, 0 replies; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Dillon Varone, Austin Zheng,
George Zhang
From: Dillon Varone <Dillon.Varone@amd.com>
[WHY&HOW]
The limitation for alt-channel p-state was being applied incorrectly,
such that VStartup could become "dynamic" based on the variable SVP0 and
SVP1 sizes. This is not allowed, as VStartup should only depend on
constants and the display timing.
This refactor pins the VStartup to depend on 2x the UCLK P-State
latency, and only if alt-channel P-state is supported for the IP.
Cc: Austin Zheng <austin.zheng@amd.com>
Signed-off-by: Dillon Varone <Dillon.Varone@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
.../dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs.h | 4 ++--
.../dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.c | 11 +++++++----
.../dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.h | 4 ++--
.../src/dml2_core/dml2_core_dcn6_funcs_initialize.c | 3 +++
.../src/dml2_core/dml2_core_dcn6_funcs_mode_support.c | 5 +++--
.../dml21/src/dml2_core/dml2_core_shared_types.h | 1 +
6 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs.h b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs.h
index 87252b658c16..f0d98bff5674 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs.h
+++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs.h
@@ -14,11 +14,11 @@
struct dml2_core_dcn6_calcs {
unsigned int (*calculate_max_vstartup)(
bool ptoi_supported,
+ bool alt_channel_supported,
unsigned int vblank_nom_default_us,
const struct dml2_timing_cfg *timing,
- enum dml2_uclk_pstate_change_strategy pstate_strategy,
double write_back_delay_us,
- unsigned int svp_lines);
+ double uclk_pstate_latency_us);
void (*calculate_alternate_params)(struct dml2_core_calcs_calculate_alternate_params *p);
void (*calculate_alternate_svp_lines)(struct dml2_core_calcs_calculate_alternate_svp_lines *p);
void (*calculate_flip_schedule)(
diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.c b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.c
index 2ee50f8cf2f5..69439ec644e0 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.c
+++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.c
@@ -10,11 +10,11 @@
unsigned int dcn6_calculate_max_vstartup(
bool ptoi_supported,
+ bool alt_channel_supported,
unsigned int vblank_nom_default_us,
const struct dml2_timing_cfg *timing,
- enum dml2_uclk_pstate_change_strategy pstate_strategy,
double write_back_delay_us,
- unsigned int svp_lines)
+ double uclk_pstate_latency_us)
{
unsigned int vblank_size = 0;
unsigned int max_vstartup_lines = 0;
@@ -31,8 +31,11 @@ unsigned int dcn6_calculate_max_vstartup(
else
max_vstartup_lines = vblank_size - (unsigned int)math_max2(1.0, math_ceil2(write_back_delay_us / line_time_us, 1.0));
- if (pstate_strategy == dml2_uclk_pstate_change_strategy_force_alternate)
- max_vstartup_lines = (unsigned int)math_min2(max_vstartup_lines, svp_lines);
+ // alt-channel p-state requires limiting max_vstartup_lines to p-state x2
+ if (alt_channel_supported) {
+ max_vstartup_lines = (unsigned int)math_min2(max_vstartup_lines,
+ math_floor2(uclk_pstate_latency_us * 2.0 / line_time_us, 1.0));
+ }
max_vstartup_lines = (unsigned int)math_min2(max_vstartup_lines, __DML2_CALCS_MAX_VSTARTUP__);
diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.h b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.h
index 41be61907e1a..fe4474c9eac7 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.h
+++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.h
@@ -8,11 +8,11 @@
unsigned int dcn6_calculate_max_vstartup(
bool ptoi_supported,
+ bool alt_channel_supported,
unsigned int vblank_nom_default_us,
const struct dml2_timing_cfg *timing,
- enum dml2_uclk_pstate_change_strategy pstate_strategy,
double write_back_delay_us,
- unsigned int svp_lines);
+ double uclk_pstate_latency_us);
void dcn6_calculate_alternate_params(struct dml2_core_calcs_calculate_alternate_params *p);
void dcn6_calculate_alternate_svp_lines(struct dml2_core_calcs_calculate_alternate_svp_lines *p);
void dcn6_calculate_alternate_lead_lines(struct dml2_core_calcs_calculate_alternate_lead_lines *p);
diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_initialize.c b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_initialize.c
index f20cee3c46fa..ddef5266785b 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_initialize.c
+++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_initialize.c
@@ -156,6 +156,9 @@ bool dml2_core_dcn6_funcs_initialize(struct dml2_core_initialize_in_out *in_out)
patch_ip_params_with_ip_caps(&core->clean_me_up.mode_lib.ip, in_out->ip_caps);
core->clean_me_up.mode_lib.ip.imall_supported = false;
+
+ if (in_out->project_id == dml2_project_dcn6x_soc_var_a)
+ core->clean_me_up.mode_lib.ip.alt_channel_supported = true;
}
memcpy(&core->clean_me_up.mode_lib.ip_caps, in_out->ip_caps, sizeof(struct dml2_ip_capabilities));
diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_support.c b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_support.c
index 290557d87b0d..d9b710baf66a 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_support.c
+++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_support.c
@@ -2397,6 +2397,7 @@ void dcn6_ms_calculate_max_vstartup(
struct dml2_core_internal_mode_support *outputs = states;
const struct dml2_display_cfg *display_cfg = ctx->display_cfg;
const struct dml2_core_ip_params *ip = ctx->ip;
+ const struct dml2_utm_soc_bb *soc_bb = ctx->soc_bb;
unsigned int k, stream_index;
const struct dml2_stream_parameters *stream;
@@ -2407,11 +2408,11 @@ void dcn6_ms_calculate_max_vstartup(
stream = &display_cfg->stream_descriptors[stream_index];
outputs->MaximumVStartup[k] = get_calcs(ctx)->calculate_max_vstartup(
ip->ptoi_supported,
+ ip->alt_channel_supported,
ip->vblank_nom_default_us,
&stream->timing,
- display_cfg->plane_descriptors[k].overrides.uclk_pstate_change_strategy,
inputs->WritebackDelayTime[k],
- inputs->svp0_dst_lines[stream_index] + inputs->svp1_dst_lines[stream_index]);
+ soc_bb->power_management_parameters.dram_clk_change_blackout_us);
outputs->MaxVStartupLines[k] = outputs->MaximumVStartup[k];
}
DML_LOG_VERBOSE("DML::%s: k=%u, MaximumVStartup = %u\n", __func__, k, outputs->MaximumVStartup[k]);
diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_shared_types.h b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_shared_types.h
index dbc59c308762..567849453e3a 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_shared_types.h
+++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_shared_types.h
@@ -73,6 +73,7 @@ struct dml2_core_ip_params {
unsigned int max_num_dp2p0_streams;
bool dcc_supported;
bool ptoi_supported;
+ bool alt_channel_supported;
double writeback_max_hscl_ratio;
double writeback_max_vscl_ratio;
double writeback_min_hscl_ratio;
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 21/30] drm/amd/display: Improve P-state admissability logic
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (19 preceding siblings ...)
2026-12-01 20:22 ` [PATCH v2 20/30] drm/amd/display: Refactor Max VStartup calculations for DCN6 George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 20:50 ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 22/30] drm/amd/display: Flip every DPP pipe of the stream in DC2 George Zhang
` (8 subsequent siblings)
29 siblings, 1 reply; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Dillon Varone, Austin Zheng,
George Zhang
From: Dillon Varone <Dillon.Varone@amd.com>
[WHY&HOW]
P-State admissability logic failed to account for time leftover by a
VStartup constrained to be smaller than VBlank. In this case,
the difference between VBlank and VStartup should be considered as
usable for latency hiding. Also clamp the ideal P-state disallow time
per stream to the P-state allow delay divided by the number of
streams when updating the worksheet for admissibility.
Cc: Austin Zheng <austin.zheng@amd.com>
Signed-off-by: Dillon Varone <Dillon.Varone@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
.../src/dml2_core/dml2_core_dcn6_calcs.h | 2 ++
.../dml2_core/dml2_core_dcn6_calcs_dchub.c | 8 +++++++-
.../dml2_core/dml2_core_dcn6_calcs_dchub.h | 2 ++
.../dml2_core_dcn6_funcs_mode_support.c | 8 ++++++++
.../dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c | 20 ++++++++++++++++---
.../src/inc/dml2_internal_shared_types.h | 1 +
6 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs.h b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs.h
index f0d98bff5674..f903b88de6dc 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs.h
+++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs.h
@@ -73,6 +73,8 @@ struct dml2_core_dcn6_calcs {
int num_active_planes,
const unsigned int v_blank_start[DML2_MAX_PLANES],
const unsigned int v_blank_end[DML2_MAX_PLANES],
+ const unsigned int v_startup[DML2_MAX_PLANES],
+ const unsigned int v_total[DML2_MAX_PLANES],
const double otg_vline_time_us[DML2_MAX_PLANES],
const double det_fill_delay_us[DML2_MAX_PLANES],
const double reserved_vblank_us[DML2_MAX_PLANES],
diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.c b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.c
index 69439ec644e0..7b7fa428958e 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.c
+++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.c
@@ -1715,6 +1715,8 @@ void dcn6_calculate_pstate_schedule_windows(
int num_active_planes,
const unsigned int v_blank_start[DML2_MAX_PLANES],
const unsigned int v_blank_end[DML2_MAX_PLANES],
+ const unsigned int v_startup[DML2_MAX_PLANES],
+ const unsigned int v_total[DML2_MAX_PLANES],
const double otg_vline_time_us[DML2_MAX_PLANES],
const double det_fill_delay_us[DML2_MAX_PLANES],
const double reserved_vblank_us[DML2_MAX_PLANES],
@@ -1728,6 +1730,7 @@ void dcn6_calculate_pstate_schedule_windows(
int det_fill_delay_otg_vlines;
int blackout_otg_vlines;
int reserved_vblank_otg_vlines;
+ int unallocated_vblank_otg_vlines;
/**
* Calculate allow start and end for pstate in vactive:
@@ -1742,10 +1745,13 @@ void dcn6_calculate_pstate_schedule_windows(
blackout_otg_vlines = (int)(math_ceil(blackout_us / otg_vline_time_us[k]));
det_fill_delay_otg_vlines = (int)(math_ceil(det_fill_delay_us[k] / otg_vline_time_us[k]));
reserved_vblank_otg_vlines = (int)(math_ceil(reserved_vblank_us[k] / otg_vline_time_us[k]));
+ unallocated_vblank_otg_vlines = v_total[k] - v_blank_start[k] + v_blank_end[k] - v_startup[k];
/* for vactive only, make relative to vblank end */
allow_start_otg_vlines = det_fill_delay_otg_vlines;
- allow_end_otg_vlines = v_blank_start[k] - v_blank_end[k] - (blackout_otg_vlines - reserved_vblank_otg_vlines);
+ allow_end_otg_vlines = v_blank_start[k] - v_blank_end[k] +
+ unallocated_vblank_otg_vlines -
+ (blackout_otg_vlines - reserved_vblank_otg_vlines);
/* Convert them back to time since the start of a frame */
allow_start_us[k] = allow_start_otg_vlines * otg_vline_time_us[k];
diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.h b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.h
index fe4474c9eac7..f23ee0e5ee9f 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.h
+++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.h
@@ -74,6 +74,8 @@ void dcn6_calculate_pstate_schedule_windows(
int num_active_planes,
const unsigned int v_blank_start[DML2_MAX_PLANES],
const unsigned int v_blank_end[DML2_MAX_PLANES],
+ const unsigned int v_startup[DML2_MAX_PLANES],
+ const unsigned int v_total[DML2_MAX_PLANES],
const double otg_vline_time_us[DML2_MAX_PLANES],
const double det_fill_delay_us[DML2_MAX_PLANES],
const double reserved_vblank_us[DML2_MAX_PLANES],
diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_support.c b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_support.c
index d9b710baf66a..c9adba53fbbf 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_support.c
+++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_support.c
@@ -3846,6 +3846,7 @@ void dcn6_ms_calculate_pstate_schedule_windows(
struct dml2_core_calcs_mode_support_locals *dummies = ctx->dummies;
unsigned int *v_blank_start = dummies->dummy_integer_array[0];
unsigned int *v_blank_end = dummies->dummy_integer_array[1];
+ unsigned int *v_total = dummies->dummy_integer_array[2];
double *otg_vline_time_us = dummies->dummy_double_array[0];
double *reserved_vblank_us = dummies->dummy_double_array[1];
const struct dml2_plane_parameters *plane = NULL;
@@ -3858,6 +3859,7 @@ void dcn6_ms_calculate_pstate_schedule_windows(
stream = &display_cfg->stream_descriptors[plane->stream_index];
v_blank_start[k] = stream->timing.v_blank_end + stream->timing.v_active;
v_blank_end[k] = stream->timing.v_blank_end;
+ v_total[k] = stream->timing.v_total;
otg_vline_time_us[k] = (double)stream->timing.h_total / stream->timing.pixel_clock_khz * 1000.0;
reserved_vblank_us[k] = plane->overrides.reserved_vblank_time_ns / 1000.0;
}
@@ -3868,6 +3870,8 @@ void dcn6_ms_calculate_pstate_schedule_windows(
display_cfg->num_planes,
v_blank_start,
v_blank_end,
+ inputs->MaxVStartupLines,
+ v_total,
otg_vline_time_us,
inputs->pstate_vactive_det_fill_delay_us[dml2_pstate_type_fclk],
reserved_vblank_us,
@@ -3883,6 +3887,8 @@ void dcn6_ms_calculate_pstate_schedule_windows(
display_cfg->num_planes,
v_blank_start,
v_blank_end,
+ inputs->MaxVStartupLines,
+ v_total,
otg_vline_time_us,
inputs->pstate_vactive_det_fill_delay_us[dml2_pstate_type_ppt],
reserved_vblank_us,
@@ -3900,6 +3906,8 @@ void dcn6_ms_calculate_pstate_schedule_windows(
display_cfg->num_planes,
v_blank_start,
v_blank_end,
+ inputs->MaxVStartupLines,
+ v_total,
otg_vline_time_us,
inputs->pstate_vactive_det_fill_delay_us[dml2_pstate_type_temp_read],
reserved_vblank_us,
diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c
index 71407eec2d83..44cc7de4d8dc 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c
+++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c
@@ -403,7 +403,7 @@ static bool dcn6_is_pstate_schedulable(
}
static bool dcn6_update_worksheet_for_pstate_admissibility(struct dml2_optimization_worksheet *worksheet,
- struct dml2_pstate_meta *per_stream_pstate_meta,
+ struct dml2_stage_optimizer_fclk_ppt_temp_read_pstate_optimize_locals *l,
enum dml2_pstate_type pstate_type)
{
const double vblank_ratio = 0.8;
@@ -426,6 +426,8 @@ static bool dcn6_update_worksheet_for_pstate_admissibility(struct dml2_optimizat
long reserved_vblank_time_ns;
bool unvalidated_changes = false;
+ struct dml2_pstate_meta *per_stream_pstate_meta = l->per_stream_pstate_meta;
+
const struct dml2_display_cfg *display_config = worksheet->orig_dispcfg;
/* Two possible locations to obtain the extra time required to pass admissibility
* 1. Allocate some time from the reserved vblank
@@ -456,6 +458,8 @@ static bool dcn6_update_worksheet_for_pstate_admissibility(struct dml2_optimizat
(1.0 / (2.0 - math_pow(2.0, (float)(2 - display_config->num_streams))));
}
+ ideal_disallow_time_us = math_min2(ideal_disallow_time_us, l->pstate_allow_delay_us / (double)display_config->num_streams);
+
extra_time_required_us = 0.0;
delta_max_det_fill_delay_us = 0.0;
delta_reserved_vblank_time_us = 0.0;
@@ -599,6 +603,13 @@ static int dcn6_get_required_vactive_det_fill_delay_us(
return max_vactive_det_fill_delay_us;
}
+static int dcn6_get_vstartup_lines(
+ const struct dml2_validation_result *validation_res,
+ int stream_idx)
+{
+ return validation_res->mode_support.cfg_support_info.stream_support_info[stream_idx].max_vstartup_lines;
+}
+
static bool dcn6_all_timings_support_vactive(struct dml2_pmo_stage_optimizer *stage,
const struct dml2_display_cfg *display_config,
unsigned int mask)
@@ -769,6 +780,7 @@ static void dcn6_build_pstate_meta_per_stream(const struct dml2_display_cfg *dis
/* scheduling params should be built based on the worst case for allow_time:disallow_time */
/* vactive */
+ stream_pstate_meta->method_vactive.vstartup_lines = dcn6_get_vstartup_lines(&worksheet->validation_result, stream_index);
stream_pstate_meta->method_vactive.vactive_latency_hiding_us =
(double)dcn6_get_vactive_latency_hiding(&worksheet->validation_result, stream_plane_mask);
if (stream_pstate_meta->method_vactive.vactive_latency_hiding_us < watermark_us) {
@@ -836,11 +848,12 @@ static void dcn6_build_pstate_meta_per_stream(const struct dml2_display_cfg *dis
if (stream_pstate_meta->method_vactive.max_vactive_det_fill_delay_us > 0.0) {
stream_pstate_meta->method_vactive.common.allow_start_otg_vline =
timing->v_blank_end + stream_pstate_meta->method_vactive.max_vactive_det_fill_delay_otg_vlines;
+
stream_pstate_meta->method_vactive.common.allow_end_otg_vline =
stream_pstate_meta->vblank_start +
stream_pstate_meta->nom_vtotal -
stream_descriptor->timing.v_active -
- stream_descriptor->timing.vblank_nom -
+ stream_pstate_meta->method_vactive.vstartup_lines -
stream_pstate_meta->blackout_otg_vlines +
stream_pstate_meta->method_vactive.reserved_blank_required_vlines;
} else {
@@ -1782,7 +1795,8 @@ static bool dml2_pmo_dcn6_stage_optimizer_fclk_ppt_temp_read_pstate_optimize_nex
/* always update the worksheet with latest requirements */
if (dcn6_update_worksheet_for_pstate_admissibility(worksheet,
- l->per_stream_pstate_meta, worksheet->fclk_ppt_temp_read_pstate.pstate_type_list[i])) {
+ l,
+ worksheet->fclk_ppt_temp_read_pstate.pstate_type_list[i])) {
modified = true;
DML_LOG_VERBOSE("fclk_ppt_temp_read pstate not admissible with current worksheet, adjusting the reserved vblank time\n");
}
diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_internal_shared_types.h b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_internal_shared_types.h
index d64705b9f976..0e250610c4c7 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_internal_shared_types.h
+++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_internal_shared_types.h
@@ -462,6 +462,7 @@ struct dml2_pstate_meta {
double reserved_vblank_required_us;
int max_vactive_det_fill_delay_otg_vlines;
int reserved_blank_required_vlines;
+ int vstartup_lines;
struct dml2_pstate_per_method_common_meta common;
} method_vactive;
struct {
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 22/30] drm/amd/display: Flip every DPP pipe of the stream in DC2
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (20 preceding siblings ...)
2026-12-01 20:22 ` [PATCH v2 21/30] drm/amd/display: Improve P-state admissability logic George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 21:00 ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 23/30] drm/amd/display: Report a DC2 BLS step overflow behind a debug option George Zhang
` (7 subsequent siblings)
29 siblings, 1 reply; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Tony Cheng, Jun Lei,
George Zhang
From: Tony Cheng <tony.cheng@amd.com>
dcn401_check_flip accepted one plane on one OPP head and one DPP pipe,
so MPO and ODM flips on Core2 failed. The flip steps already run per
DPP pipe in DC1's order, so the check now accepts any pipe layout whose
planes all carry an address-only update. A plane without an address
update stays rejected, because the address step does not skip it as
DC1 does.
Cc: Jun Lei <jun.lei@amd.com>
Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
.../dc/bls_builder/dcn401_seamless_builder.c | 39 +++++++++++--------
1 file changed, 22 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
index 38b40fe8b02b..69d6c55e78e8 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
@@ -1055,32 +1055,37 @@ static bool check_no_stream_update_flags(const struct dc *dc,
}
/*
- * Any other plane update bit adds a step to the flip. DC1 hands an
- * offloaded flip to HWFQ. With triple-buffer flips, the pipe lock is not
- * a TG_LOCK leaf.
+ * Any other plane update bit adds a step to the flip. A plane without an
+ * address update would still get HUBP_UPDATE_PLANE_ADDR, which DC1 skips,
+ * so every plane of the stream flips. DC1 hands an offloaded flip to HWFQ.
+ * With triple-buffer flips, the pipe lock is not a TG_LOCK leaf.
*/
-static bool check_one_address_only_plane(const struct dc *dc,
+static bool check_address_only_planes(const struct dc *dc,
const struct dc_state *current_state,
const struct dc_state *new_state, unsigned int i)
{
struct pipe_ctx *dpp_pipes[MAX_PIPES];
const struct dc_plane_state *plane;
+ int j, n;
(void)dc;
(void)current_state;
- if (new_state->stream_status[i].plane_count != 1 ||
- resource_get_opp_heads_for_stream(new_state->streams[i],
- (struct resource_context *)&new_state->res_ctx,
- dpp_pipes) != 1 ||
- resource_get_dpp_pipes_for_stream(new_state->streams[i],
+ if (!new_state->stream_status[i].plane_count)
+ return false;
+ n = resource_get_dpp_pipes_for_stream(new_state->streams[i],
(struct resource_context *)&new_state->res_ctx,
- dpp_pipes) != 1 ||
- !dpp_pipes[0]->plane_state ||
- !dpp_pipes[0]->plane_res.hubp)
+ dpp_pipes);
+ if (n <= 0)
return false;
- plane = dpp_pipes[0]->plane_state;
- return dc_check_address_only_update(plane->update_bits) &&
- !plane->triplebuffer_flips;
+ for (j = 0; j < n; j++) {
+ plane = dpp_pipes[j]->plane_state;
+ if (!plane || !dpp_pipes[j]->plane_res.hubp)
+ return false;
+ if (!dc_check_address_only_update(plane->update_bits) ||
+ plane->triplebuffer_flips)
+ return false;
+ }
+ return true;
}
static bool dcn401_pipe_on_either(const struct dc_state *current_state,
@@ -1156,8 +1161,8 @@ static enum bls_builder_result dcn401_check_flip(const struct dc *dc,
CHECK_UPDATE(no_subvp, "subvp is set");
CHECK_UPDATE(no_dmub_work, "psr, replay, abm or hwfq needs dmub");
CHECK_UPDATE(no_stream_update_flags, "stream update flags are set");
- CHECK_UPDATE(one_address_only_plane,
- "stream has odm, or not one plane with an address-only update");
+ CHECK_UPDATE(address_only_planes,
+ "a plane of the stream has no address-only update");
CHECK_CONDITION(triple_buffer, "triple buffer is disabled");
CHECK_UPDATE(no_immediate_dcc_flip, "immediate flip of a dcc surface");
CHECK_UPDATE(no_mcm_luts, "an mcm lut is enabled");
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 23/30] drm/amd/display: Report a DC2 BLS step overflow behind a debug option
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (21 preceding siblings ...)
2026-12-01 20:22 ` [PATCH v2 22/30] drm/amd/display: Flip every DPP pipe of the stream in DC2 George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 20:22 ` [PATCH v2 24/30] drm/amd/display: VRR Support on Direct MST Sinks George Zhang
` (6 subsequent siblings)
29 siblings, 0 replies; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Tony Cheng, Jun Lei,
George Zhang
From: Tony Cheng <tony.cheng@amd.com>
[Why]
The dcn401 DC2 builders bound each sequence with a hand-counted
static_assert that every table change must update. The builder already
stops writing at the bound, and the commit rejects the longer sequence.
[How]
Drop the static_asserts. With dc->debug.dc2_bls_report_step_overflow
set, the builder logs an error and breaks to the debugger at the first
step past the bound.
Cc: Jun Lei <jun.lei@amd.com>
Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
.../bls_builder/dcn401_non_seamless_builder.c | 31 -------------
.../dc/bls_builder/dcn401_seamless_builder.c | 45 +++----------------
drivers/gpu/drm/amd/display/dc/dc.h | 2 +
3 files changed, 9 insertions(+), 69 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c
index 9bf814f70423..8400c3ad6e81 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c
@@ -391,37 +391,6 @@ static const struct dcn401_commit_step postamble[] = {
.meta.clk_mgr_update_clocks_for_state.safe_to_lower = true },
};
-/* Bounds on what build adds for one stream in either state. */
-static_assert(ARRAY_SIZE(prepare_bandwidth) +
- ARRAY_SIZE(lock) +
- DCN401_MAX_OPP_HEADS * ARRAY_SIZE(blank) +
- DCN401_MAX_DPP_PIPES * ARRAY_SIZE(dcn401_disconnect) +
- ARRAY_SIZE(unlock) +
- DCN401_MAX_DPP_PIPES * ARRAY_SIZE(dcn401_power_down) +
- ARRAY_SIZE(stream_off) +
- ARRAY_SIZE(optc_dsc_off) +
- DCN401_MAX_OPP_HEADS * ARRAY_SIZE(dsc_off) +
- ARRAY_SIZE(otg_off) +
- ARRAY_SIZE(postamble) <=
- DC2_BLS_MAX_STEPS,
- "dcn401 commit stream-off head exceeds DC2_BLS_MAX_STEPS");
-static_assert(ARRAY_SIZE(prepare_bandwidth) +
- ARRAY_SIZE(stream_timing) +
- ARRAY_SIZE(opp_clock) +
- ARRAY_SIZE(crtc) +
- 2 * ARRAY_SIZE(optc_dsc) +
- ARRAY_SIZE(output) +
- ARRAY_SIZE(front_end_lock) +
- ARRAY_SIZE(front_end) +
- DCN401_MAX_OPP_HEADS * (
- ARRAY_SIZE(odm) +
- 2 * ARRAY_SIZE(blank) +
- 2 * ARRAY_SIZE(dsc) +
- ARRAY_SIZE(front_end_odm)) +
- ARRAY_SIZE(postamble) <=
- DC2_BLS_MAX_STEPS,
- "dcn401 commit enable head exceeds DC2_BLS_MAX_STEPS");
-
static const struct dcn401_sub_sequence bls_head[] = {
{ .flags = DCN401_NEW_STATE,
.steps = prepare_bandwidth,
diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
index 69d6c55e78e8..402217cec1b5 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
@@ -1786,11 +1786,6 @@ static const struct dcn401_stage enable_plane[] = {
{ setup_pipe_3, ARRAY_SIZE(setup_pipe_3) },
};
-#define DCN401_ENABLE_PLANE_STEPS (ARRAY_SIZE(ungate_hw) + \
- ARRAY_SIZE(setup_pipe_1) + ARRAY_SIZE(reconfigure_mpc) + \
- ARRAY_SIZE(setup_pipe_2) + ARRAY_SIZE(program_flip) + \
- ARRAY_SIZE(setup_pipe_3))
-
/*
* The pipe unlock, then dcn401_post_unlock_program_front_end: the
* flip-pending wait, the p-state release and the MALL selection. Last,
@@ -1834,39 +1829,6 @@ static const struct dcn401_commit_step trigger[] = {
.meta.skip_if.no_manual_trigger = true },
};
-/*
- * The update programs one stream. A pipe that leaves the stream emits
- * fewer steps than a pipe the update programs, so the bound counts every
- * pipe as programmed. dcn401_add_step catches a longer sequence.
- */
-static_assert(ARRAY_SIZE(dcn401_disconnect) + ARRAY_SIZE(dcn401_power_down) <=
- ARRAY_SIZE(dpp_lock) + DCN401_ENABLE_PLANE_STEPS +
- ARRAY_SIZE(dpp_flip) + ARRAY_SIZE(dpp_mall),
- "a removed pipe emits more than a programmed pipe");
-static_assert(
- ARRAY_SIZE(preamble) +
- ARRAY_SIZE(global_preamble) +
- ARRAY_SIZE(prepare_bandwidth) +
- ARRAY_SIZE(pending) +
- ARRAY_SIZE(lock) +
- ARRAY_SIZE(first_hubp) +
- ARRAY_SIZE(global_sync) +
- ARRAY_SIZE(optc_dsc) +
- DCN401_MAX_OPP_HEADS * (
- ARRAY_SIZE(opp_unblank) +
- ARRAY_SIZE(opp_odm) +
- ARRAY_SIZE(dsc)) +
- ARRAY_SIZE(unlock) +
- ARRAY_SIZE(pstate) +
- ARRAY_SIZE(odm_wait) +
- ARRAY_SIZE(trigger) +
- DCN401_MAX_DPP_PIPES * (
- ARRAY_SIZE(dpp_lock) +
- DCN401_ENABLE_PLANE_STEPS +
- ARRAY_SIZE(dpp_flip) +
- ARRAY_SIZE(dpp_mall)) <= DC2_BLS_MAX_STEPS,
- "dcn401 seamless update head exceeds DC2_BLS_MAX_STEPS");
-
/* enable_stream_timing_calc: manual mode unless every span is even. */
static bool dcn401_h_timing_div_manual_mode(
const struct dc_crtc_timing *timing)
@@ -2127,6 +2089,13 @@ static void dcn401_add_step(struct block_sequence_state *sequence,
const struct dcn401_commit_step_meta *m = &step->meta;
if (*sequence->num_steps >= DC2_BLS_MAX_STEPS) {
+ if (*sequence->num_steps == DC2_BLS_MAX_STEPS &&
+ dc->debug.dc2_bls_report_step_overflow &&
+ dc->ctx && dc->ctx->logger) {
+ DC_LOG_ERROR("%s: more than %u BLS steps\n", __func__,
+ DC2_BLS_MAX_STEPS);
+ BREAK_TO_DEBUGGER();
+ }
(*sequence->num_steps)++;
return;
}
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index 14703c0e0224..134204f4b051 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -1349,6 +1349,8 @@ struct dc_debug_options {
bool disable_dynamic_expansion_for_test_pattern;
bool psr_phy_force_phy_power_down_up_level_2;
bool dmub_send_az_pme_restore;
+ /* Log and break when a DC2 builder emits more than DC2_BLS_MAX_STEPS. */
+ bool dc2_bls_report_step_overflow;
uint32_t dml21_custom_derate_num_dpms;
uint32_t dml21_custom_derate_at_dpm[DML2_MAX_NUM_DPM_LVL];
bool override_utm_client_qc_profile;
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 24/30] drm/amd/display: VRR Support on Direct MST Sinks
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (22 preceding siblings ...)
2026-12-01 20:22 ` [PATCH v2 23/30] drm/amd/display: Report a DC2 BLS step overflow behind a debug option George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 20:22 ` [PATCH v2 25/30] drm/amd/display: Program YCbCr output in DC2 George Zhang
` (5 subsequent siblings)
29 siblings, 0 replies; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, George Zhang
From: Fangzhi Zuo <jerry.zuo@amd.com>
[Why]
MST leaf connectors need their own downstream VRR capability check.
Inferring support from root-link capabilities can expose VRR on unsupported
leaves and miss valid HDMI VRR capability behind an MST branch.
Direct MST sink connections are supported when the downstream leaf reports
the required capability. MST paths through a hub or dock also depend on the
branch device's VRR rendering capability.
[How]
Read the leaf AUX downstream port data and combine IGNORE_MSA with the leaf
refresh range when determining VRR capability. Attach the inherited VRR
property to MST connectors and add leaf-AUX and non-MST isolation KUnit
coverage.
Cc: IVAN LIPSKI <ivan.lipski@amd.com>
Signed-off-by: Fangzhi Zuo <jerry.zuo@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
.../display/amdgpu_dm/amdgpu_dm_connector.c | 44 +++++-
.../display/amdgpu_dm/amdgpu_dm_mst_types.c | 3 +-
.../tests/amdgpu_dm_connector_test.c | 130 ++++++++++++++++++
.../tests/amdgpu_dm_mst_types_test.c | 2 +
4 files changed, 176 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
index 1acc2b44c968..6d04d7de5d0c 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
@@ -3872,6 +3872,7 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,
const struct edid *edid;
bool force_hdmi_vrr = false;
bool freesync_capable = false;
+ bool mst_ignore_msa = false;
enum adaptive_sync_type as_type = ADAPTIVE_SYNC_TYPE_NONE;
if (!connector->state) {
@@ -3883,6 +3884,11 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,
amdgpu_dm_connector->dc_sink :
amdgpu_dm_connector->dc_em_sink;
+ if (sink && sink->sink_signal == SIGNAL_TYPE_DISPLAY_PORT_MST) {
+ amdgpu_dm_connector->as_type = ADAPTIVE_SYNC_TYPE_NONE;
+ amdgpu_dm_connector->pack_sdp_v1_3 = false;
+ }
+
drm_edid_connector_update(connector, drm_edid);
if (!drm_edid || !sink) {
@@ -3917,7 +3923,40 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,
connector->display_info.monitor_range.max_vfreq == 0))
parse_edid_displayid_vrr(connector, edid);
- if (edid && (sink->sink_signal == SIGNAL_TYPE_DISPLAY_PORT ||
+ if (edid && sink->sink_signal == SIGNAL_TYPE_DISPLAY_PORT_MST &&
+ amdgpu_dm_connector->mst_output_port) {
+ struct drm_dp_aux *aux = &amdgpu_dm_connector->mst_output_port->aux;
+ u8 port_count = 0;
+ int msa_ret;
+
+ has_vsdb = get_amd_vsdb(amdgpu_dm_connector, &vsdb_info) != 0;
+ amdgpu_dm_connector->vsdb_info = vsdb_info;
+ if (has_vsdb && vsdb_info.freesync_supported) {
+ amdgpu_dm_connector->min_vfreq = vsdb_info.min_refresh_rate_hz;
+ amdgpu_dm_connector->max_vfreq = vsdb_info.max_refresh_rate_hz;
+ } else {
+ amdgpu_dm_connector->min_vfreq =
+ connector->display_info.monitor_range.min_vfreq;
+ amdgpu_dm_connector->max_vfreq =
+ connector->display_info.monitor_range.max_vfreq;
+ }
+
+ /* Read IGNORE_MSA from the downstream MST receiver. */
+ msa_ret = drm_dp_dpcd_readb(aux, DP_DOWN_STREAM_PORT_COUNT, &port_count);
+ mst_ignore_msa = msa_ret == 1 &&
+ (port_count & DP_MSA_TIMING_PAR_IGNORED);
+ freesync_capable = mst_ignore_msa &&
+ amdgpu_dm_connector->min_vfreq > 0 &&
+ amdgpu_dm_connector->max_vfreq > amdgpu_dm_connector->min_vfreq &&
+ amdgpu_dm_connector->max_vfreq - amdgpu_dm_connector->min_vfreq > 10;
+
+ drm_info(connector->dev,
+ "VRR: MST leaf %s port=%u msa_ret=%d ignore_msa=%d range=%d-%dHz capable=%d\n",
+ connector->name, amdgpu_dm_connector->mst_output_port->port_num,
+ msa_ret, mst_ignore_msa,
+ amdgpu_dm_connector->min_vfreq, amdgpu_dm_connector->max_vfreq,
+ freesync_capable);
+ } else if (edid && (sink->sink_signal == SIGNAL_TYPE_DISPLAY_PORT ||
sink->sink_signal == SIGNAL_TYPE_EDP)) {
if (amdgpu_dm_connector->dc_link &&
amdgpu_dm_connector->dc_link->dpcd_caps.allow_invalid_MSA_timing_param) {
@@ -4019,7 +4058,8 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,
}
}
- if (amdgpu_dm_connector->dc_link)
+ if (amdgpu_dm_connector->dc_link &&
+ sink->sink_signal != SIGNAL_TYPE_DISPLAY_PORT_MST)
as_type = dm_get_adaptive_sync_support_type(amdgpu_dm_connector->dc_link);
if (as_type == FREESYNC_TYPE_PCON_IN_WHITELIST) {
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index 68b53cd3c15f..c2073375f166 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -715,7 +715,8 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
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,
+ connector->vrr_capable_property, 0);
drm_object_attach_property(
&connector->base,
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c
index 33082a674d9e..59cfd555e352 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c
@@ -18,6 +18,7 @@
#include <drm/drm_modes.h>
#include <drm/drm_modeset_helper_vtables.h>
#include <drm/drm_property.h>
+#include <drm/display/drm_dp_mst_helper.h>
#include <linux/hdmi.h>
#include <linux/i2c.h>
@@ -9707,6 +9708,7 @@ dm_test_fs_edid_displayid(struct kunit *test, u8 min_vfreq, u8 max_vfreq)
ext[1] = 0x25;
ext[2] = 0x00;
ext[3] = 9;
+ ext[5] = -(ext[1] + ext[2] + ext[3] + ext[4]);
ext[10] = min_vfreq;
ext[11] = max_vfreq;
@@ -9884,6 +9886,131 @@ static void dm_test_fs_caps_dp_msa_not_allowed(struct kunit *test)
KUNIT_EXPECT_FALSE(test, dm_test_fs_caps_capable(ctx));
}
+struct dm_test_mst_vrr_aux {
+ struct drm_dp_mst_port port;
+ u8 port_count;
+ bool fail;
+ unsigned int calls;
+};
+
+static ssize_t dm_test_mst_vrr_transfer(struct drm_dp_aux *aux,
+ struct drm_dp_aux_msg *msg)
+{
+ struct drm_dp_mst_port *port = container_of(aux, struct drm_dp_mst_port, aux);
+ struct dm_test_mst_vrr_aux *mock =
+ container_of(port, struct dm_test_mst_vrr_aux, port);
+
+ mock->calls++;
+ if (mock->fail)
+ return -EIO;
+ if (msg->request != DP_AUX_NATIVE_READ)
+ return -EINVAL;
+ memset(msg->buffer, 0, msg->size);
+ if (msg->address == DP_DOWN_STREAM_PORT_COUNT && msg->size)
+ ((u8 *)msg->buffer)[0] = mock->port_count;
+ msg->reply = DP_AUX_NATIVE_REPLY_ACK;
+ return msg->size;
+}
+
+static void dm_test_fs_caps_mst_leaf(struct kunit *test)
+{
+ struct dm_test_fs_caps_ctx *ctx =
+ dm_test_fs_caps_ctx_alloc(test, SIGNAL_TYPE_DISPLAY_PORT_MST);
+ const struct drm_edid *drm_edid = dm_test_fs_edid_displayid(test, 96, 240);
+ struct dm_test_mst_vrr_aux *mock;
+
+ mock = kunit_kzalloc(test, sizeof(*mock), GFP_KERNEL);
+ KUNIT_ASSERT_NOT_NULL(test, mock);
+ mock->port.aux.drm_dev = ctx->drm;
+ mock->port.aux.dev = ctx->drm->dev;
+ mock->port.aux.transfer = dm_test_mst_vrr_transfer;
+ drm_dp_aux_init(&mock->port.aux);
+ ctx->aconnector->mst_output_port = &mock->port;
+
+ mock->port_count = DP_MSA_TIMING_PAR_IGNORED;
+ amdgpu_dm_update_freesync_caps(&ctx->aconnector->base, drm_edid, false);
+ KUNIT_EXPECT_TRUE(test, dm_test_fs_caps_capable(ctx));
+ KUNIT_EXPECT_EQ(test, ctx->aconnector->min_vfreq, 96);
+ KUNIT_EXPECT_EQ(test, ctx->aconnector->max_vfreq, 240);
+ KUNIT_EXPECT_EQ(test, (int)ctx->aconnector->as_type,
+ (int)ADAPTIVE_SYNC_TYPE_NONE);
+
+ /* Root-link caps must not make an unsupported MST leaf capable. */
+ ctx->link->dpcd_caps.allow_invalid_MSA_timing_param = true;
+ mock->port_count = 0;
+ amdgpu_dm_update_freesync_caps(&ctx->aconnector->base, drm_edid, false);
+ KUNIT_EXPECT_FALSE(test, dm_test_fs_caps_capable(ctx));
+
+ mock->fail = true;
+ amdgpu_dm_update_freesync_caps(&ctx->aconnector->base, drm_edid, false);
+ KUNIT_EXPECT_FALSE(test, dm_test_fs_caps_capable(ctx));
+}
+
+struct dm_test_fs_caps_non_mst_param {
+ const char *name;
+ enum signal_type signal;
+ bool pcon;
+ bool displayid_range;
+};
+
+static const struct dm_test_fs_caps_non_mst_param
+dm_test_fs_caps_non_mst_params[] = {
+ { "dp_displayid_range", SIGNAL_TYPE_DISPLAY_PORT, false, true },
+ { "dp_pcon", SIGNAL_TYPE_DISPLAY_PORT, true, false },
+ { "hdmi_type_a", SIGNAL_TYPE_HDMI_TYPE_A, false, false },
+ { "hdmi_frl", SIGNAL_TYPE_HDMI_FRL, false, false },
+};
+
+KUNIT_ARRAY_PARAM_DESC(dm_test_fs_caps_non_mst,
+ dm_test_fs_caps_non_mst_params, name);
+
+/**
+ * dm_test_fs_caps_non_mst_unchanged - Ensure non-MST sinks do not query MST AUX
+ * @test: The KUnit test context
+ *
+ * Non-MST FreeSync detection uses its usual EDID and PCON inputs without
+ * issuing the MST-leaf downstream-port AUX query.
+ */
+static void dm_test_fs_caps_non_mst_unchanged(struct kunit *test)
+{
+ const struct dm_test_fs_caps_non_mst_param *param = test->param_value;
+ struct dm_test_fs_caps_ctx *ctx =
+ dm_test_fs_caps_ctx_alloc(test, param->signal);
+ const struct drm_edid *drm_edid = param->displayid_range ?
+ dm_test_fs_edid_displayid(test, 48, 144) :
+ dm_test_fs_edid_amd_vsdb(test, 1, 48, 144);
+ struct dm_test_mst_vrr_aux *mock;
+ struct dpcd_caps *caps = &ctx->link->dpcd_caps;
+ struct adaptive_sync_caps *adaptive_sync_caps =
+ &caps->adaptive_sync_caps;
+ enum adaptive_sync_type expected_type = ADAPTIVE_SYNC_TYPE_NONE;
+
+ mock = kunit_kzalloc(test, sizeof(*mock), GFP_KERNEL);
+ KUNIT_ASSERT_NOT_NULL(test, mock);
+ mock->port.aux.drm_dev = ctx->drm;
+ mock->port.aux.dev = ctx->drm->dev;
+ mock->port.aux.transfer = dm_test_mst_vrr_transfer;
+ mock->fail = true;
+ drm_dp_aux_init(&mock->port.aux);
+ ctx->aconnector->mst_output_port = &mock->port;
+
+ caps->allow_invalid_MSA_timing_param = true;
+ if (param->pcon) {
+ adaptive_sync_caps->dp_adap_sync_caps.bits.ADAPTIVE_SYNC_SDP_SUPPORT = 1;
+ caps->dongle_type = DISPLAY_DONGLE_DP_HDMI_CONVERTER;
+ caps->branch_dev_id = DP_BRANCH_DEVICE_ID_0060AD;
+ expected_type = FREESYNC_TYPE_PCON_IN_WHITELIST;
+ }
+
+ amdgpu_dm_update_freesync_caps(&ctx->aconnector->base, drm_edid, false);
+
+ KUNIT_EXPECT_TRUE(test, dm_test_fs_caps_capable(ctx));
+ KUNIT_EXPECT_EQ(test, (int)ctx->aconnector->as_type,
+ (int)expected_type);
+ KUNIT_EXPECT_EQ(test, ctx->aconnector->pack_sdp_v1_3, param->pcon);
+ KUNIT_EXPECT_EQ(test, mock->calls, 0U);
+}
+
/**
* dm_test_fs_caps_edp_replay_mode - Test an eDP panel advertising replay
* @test: The KUnit test context
@@ -10699,6 +10826,9 @@ static struct kunit_case amdgpu_dm_connector_tests[] = {
KUNIT_CASE(dm_test_prune_removes_per_tile),
/* dm_validate_stream_and_context */
KUNIT_CASE(dm_test_validate_stream_null_stream),
+ KUNIT_CASE(dm_test_fs_caps_mst_leaf),
+ KUNIT_CASE_PARAM(dm_test_fs_caps_non_mst_unchanged,
+ dm_test_fs_caps_non_mst_gen_params),
KUNIT_CASE(dm_test_validate_stream_dc_ok_no_pipe),
/* amdgpu_dm_connector_to_encoder */
KUNIT_CASE(dm_test_to_encoder_no_encoder),
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c
index e624eb55cae1..05decad30510 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c
@@ -1476,6 +1476,8 @@ static void dm_mst_test_add_mst_connector_inherits_props(struct kunit *test)
KUNIT_EXPECT_PTR_EQ(test, connector->colorspace_property,
ctx.master->base.colorspace_property);
KUNIT_EXPECT_TRUE(test, dm_mst_test_has_prop(connector, connector->max_bpc_property));
+ KUNIT_EXPECT_TRUE(test,
+ dm_mst_test_has_prop(connector, connector->vrr_capable_property));
KUNIT_EXPECT_TRUE(test, dm_mst_test_has_prop(connector, connector->colorspace_property));
dm_dp_mst_connector_destroy(connector);
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 25/30] drm/amd/display: Program YCbCr output in DC2
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (23 preceding siblings ...)
2026-12-01 20:22 ` [PATCH v2 24/30] drm/amd/display: VRR Support on Direct MST Sinks George Zhang
@ 2026-12-01 20:22 ` George Zhang
2026-12-01 20:23 ` [PATCH v2 26/30] drm/amd/display: Skip a stream with no OTG master " George Zhang
` (4 subsequent siblings)
29 siblings, 0 replies; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:22 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Tony Cheng, Jun Lei,
George Zhang
From: Tony Cheng <tony.cheng@amd.com>
[Why]
The DC2 commit on dcn401 rejects every stream that is not RGB in sRGB.
A YCbCr display falls back to the error path.
[How]
Remove the RGB sRGB stream check. Two steps had fixed RGB sRGB values.
Make them follow the stream, as DC1 does:
- The DPG blank takes the black of the output color space from
color_space_to_black_color, as dcn20_blank_pixel_data does.
- Every pixel rate divider step takes its divider from the timing.
The divider is 2 for 4:2:0 and 4 for other encodings. This is the
value that dcn401_enable_stream_timing sets for the virtual signal.
dccg401_set_pixel_rate_div accepts only 2 and 4. Thus the divide by
one from dcn401_enable_stream does not change the register.
Remove the step meta that held a fixed divider.
- The builder calculates the divider itself. The build includes the
dcn401 hwseq only with DC_FP, and it includes the builder without
DC_FP.
The FMT, the dynamic expansion, the left edge extra pixel and the
output CSC already follow the stream, as in DC1.
Cc: Jun Lei <jun.lei@amd.com>
Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
.../bls_builder/bls_builder_private_types.h | 3 --
.../bls_builder/dcn401_non_seamless_builder.c | 7 ++--
.../dc/bls_builder/dcn401_seamless_builder.c | 33 ++++++++++---------
3 files changed, 20 insertions(+), 23 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_private_types.h b/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_private_types.h
index 4973ffe65115..e410cb35d0e8 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_private_types.h
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_private_types.h
@@ -115,9 +115,6 @@ struct dcn401_commit_step_meta {
struct {
enum streamclk_source src;
} dccg_set_dtbclk_p_src;
- struct {
- enum pixel_rate_div k1;
- } dccg_set_pixel_rate_div;
struct {
bool connect;
} link_enc_connect_dig_be_to_fe;
diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c
index 8400c3ad6e81..6eeec90d4298 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c
@@ -282,8 +282,7 @@ static const struct dcn401_commit_step stream_timing[] = {
{ .func = OPP_PROGRAM_FMT },
{ .func = OPP_SET_DYN_EXPANSION },
- { .func = DCCG_SET_PIXEL_RATE_DIV,
- .meta.dccg_set_pixel_rate_div.k1 = PIXEL_RATE_DIV_BY_4 },
+ { .func = DCCG_SET_PIXEL_RATE_DIV },
{ .func = OPTC_SET_ODM_COMBINE },
{ .func = DCCG_SET_DTBCLK_P_SRC,
.meta.dccg_set_dtbclk_p_src.src = DPREFCLK },
@@ -330,9 +329,7 @@ static const struct dcn401_commit_step optc_dsc[] = {
static const struct dcn401_commit_step output[] = {
{ .func = DIO_LINK_ENC_ENABLE_DP_OUTPUT },
{ .func = DCCG_ENABLE_SYMCLK_SE },
- /* dcn401_enable_stream divides by one unless the signal is HDMI or DVI. */
- { .func = DCCG_SET_PIXEL_RATE_DIV,
- .meta.dccg_set_pixel_rate_div.k1 = PIXEL_RATE_DIV_BY_1 },
+ { .func = DCCG_SET_PIXEL_RATE_DIV },
{ .func = DIO_LINK_ENC_CONNECT_DIG_BE_TO_FE,
.meta.link_enc_connect_dig_be_to_fe.connect = true },
{ .func = TG_SET_EARLY_CONTROL },
diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
index 402217cec1b5..401062ec3a0c 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
@@ -204,17 +204,6 @@ static bool check_no_stereo(const struct dc *dc,
TIMING_3D_FORMAT_NONE;
}
-/* The DPG black and the pixel rate divider are fixed for RGB. */
-static bool check_rgb_srgb(const struct dc *dc,
- const struct dc_state *state, unsigned int i)
-{
- const struct dc_stream_state *stream = state->streams[i];
-
- (void)dc;
- return stream->timing.pixel_encoding == PIXEL_ENCODING_RGB &&
- stream->output_color_space == COLOR_SPACE_SRGB;
-}
-
static bool check_no_drr(const struct dc *dc,
const struct dc_state *state, unsigned int i)
{
@@ -462,7 +451,6 @@ static enum bls_builder_result dcn401_check_one_stream(const struct dc *dc,
CHECK_STREAM_CONDITION(no_stereo, "timing is stereo");
CHECK_STREAM_CONDITION(dsc_pixel_clock,
"dsc pixel clock is 48 MHz or less");
- CHECK_STREAM_CONDITION(rgb_srgb, "stream is not RGB sRGB");
CHECK_STREAM_CONDITION(no_drr, "DRR is set");
CHECK_STREAM_CONDITION(no_boot_dpms_writeback,
"seamless boot, dpms, or writeback is set");
@@ -1870,8 +1858,8 @@ static uint32_t dcn401_early_cntl(const struct pipe_ctx *pipe)
}
/*
- * dcn20_blank_pixel_data: sRGB black over the ODM slice of this OPP head,
- * or the video on unblank.
+ * dcn20_blank_pixel_data: the black of the output color space over the ODM
+ * slice of this OPP head, or the video on unblank.
*/
static void dcn401_opp_blank_params(const struct dc *dc,
struct pipe_ctx *pipe, bool unblank,
@@ -1885,6 +1873,8 @@ static void dcn401_opp_blank_params(const struct dc *dc,
CONTROLLER_DP_TEST_PATTERN_SOLID_COLOR;
p->color_space = CONTROLLER_DP_COLOR_SPACE_UDEFINED;
p->color_depth = timing->display_color_depth;
+ color_space_to_black_color(dc, pipe->stream->output_color_space,
+ &p->solid_color);
p->use_solid_color = true;
p->width = slice.width;
p->height = slice.height;
@@ -2074,6 +2064,19 @@ static enum dc_cm_lut_size dcn401_lut_mode_size(
CM_LUT_SIZE_999 : CM_LUT_SIZE_171717;
}
+/*
+ * The divider dcn401_enable_stream_timing sets for the virtual signal. The
+ * divide by one dcn401_enable_stream passes later is a no-op, because
+ * dccg401_set_pixel_rate_div accepts only 2 and 4. The hwseq is built only
+ * with DC_FP; the builder is built without it.
+ */
+static enum pixel_rate_div dcn401_pixel_rate_div(
+ const struct pipe_ctx *pipe)
+{
+ return pipe->stream->timing.pixel_encoding == PIXEL_ENCODING_YCBCR420 ?
+ PIXEL_RATE_DIV_BY_2 : PIXEL_RATE_DIV_BY_4;
+}
+
/* Writes one entry; build sized every sequence before adding to it. */
static void dcn401_add_step(struct block_sequence_state *sequence,
const struct dcn401_commit_step_args *args,
@@ -2365,7 +2368,7 @@ static void dcn401_add_step(struct block_sequence_state *sequence,
p->dccg_set_pixel_rate_div_params.otg_inst =
pipe->stream_res.tg->inst;
p->dccg_set_pixel_rate_div_params.k1 =
- m->dccg_set_pixel_rate_div.k1;
+ dcn401_pixel_rate_div(pipe);
p->dccg_set_pixel_rate_div_params.k2 = PIXEL_RATE_DIV_NA;
break;
case CLK_SRC_PROGRAM_PIX_CLK:
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 26/30] drm/amd/display: Skip a stream with no OTG master in DC2
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (24 preceding siblings ...)
2026-12-01 20:22 ` [PATCH v2 25/30] drm/amd/display: Program YCbCr output in DC2 George Zhang
@ 2026-12-01 20:23 ` George Zhang
2026-12-01 20:23 ` [PATCH v2 27/30] drm/amd/display: Sync OTG timing in the DC2 non-seamless commit George Zhang
` (3 subsequent siblings)
29 siblings, 0 replies; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:23 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Tony Cheng, Jun Lei,
Dillon Varone, George Zhang
From: Tony Cheng <tony.cheng@amd.com>
[Why]
resource_get_otg_master_for_stream can return NULL, and the dcn401 OTG
master walker passes the result on.
[How]
Skip the stream when it has no OTG master.
Cc: Jun Lei <jun.lei@amd.com>
Cc: Dillon Varone <dillon.varone@amd.com>
Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
.../drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
index 401062ec3a0c..6ee61bea0c0b 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
@@ -2866,6 +2866,8 @@ static void dcn401_add_per_otg_master(struct block_sequence_state *sequence,
continue;
args.pipe = resource_get_otg_master_for_stream(
&state->res_ctx, state->streams[i]);
+ if (!args.pipe)
+ continue;
dcn401_add_steps(sequence, &args, steps, count);
}
}
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 27/30] drm/amd/display: Sync OTG timing in the DC2 non-seamless commit
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (25 preceding siblings ...)
2026-12-01 20:23 ` [PATCH v2 26/30] drm/amd/display: Skip a stream with no OTG master " George Zhang
@ 2026-12-01 20:23 ` George Zhang
2026-12-01 20:57 ` sashiko-bot
2026-12-01 20:23 ` [PATCH v2 28/30] drm/amd/display: Move shared dcn401 builder code to its own file George Zhang
` (2 subsequent siblings)
29 siblings, 1 reply; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:23 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Tony Cheng, Jun Lei,
Dillon Varone, George Zhang
From: Tony Cheng <tony.cheng@amd.com>
[Why]
When a commit enables a second stream with the same timing, DC calls
dc_trigger_sync. The new OTG resets to the OTG that shows a plane, so
the two OTGs start at the same position. DC runs the sync again after
optimize_bandwidth, because the clock update can move the OTGs. The
dcn401 DC2 non-seamless builder does neither, so the second OTG starts
without a reset.
[How]
Add the BLS functions that DC uses for the sync: enable the reset
trigger, wait for the reset and disable the reset trigger. The executor
wait polls for a limited number of frames and returns whether the reset
occurred. The builder lets the sequence continue on a missed reset.
The walker finds the OTG to reset to for each OTG master: the first OTG
master with the same timing that shows a plane, else the first one.
The builder adds the sync for each new OTG master that has an OTG to
reset to, after the stream enable and again after the postamble.
DC raises the DPG height while the OTGs reset only as a workaround, so
the workaround manager adds the DPG height steps around each run of
reset trigger steps from the target state.
Cc: Jun Lei <jun.lei@amd.com>
Cc: Dillon Varone <dillon.varone@amd.com>
Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
.../bls_builder/bls_builder_private_types.h | 2 +
.../dc/bls_builder/dcn401_builder_internal.h | 2 +
.../bls_builder/dcn401_non_seamless_builder.c | 43 ++++++
.../dc/bls_builder/dcn401_seamless_builder.c | 57 ++++++++
.../display/dc/bls_executor/bls_executor.c | 59 +++++++++
.../gpu/drm/amd/display/dc/core2/dc_core2.c | 6 +-
.../gpu/drm/amd/display/dc/core2/dc_core2.h | 1 +
.../drm/amd/display/dc/core2/dc_core2_init.c | 2 +-
.../drm/amd/display/dc/hwss/hw_sequencer.h | 31 +++++
.../workaround_manager/workaround_manager.c | 122 +++++++++++++++++-
10 files changed, 316 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_private_types.h b/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_private_types.h
index e410cb35d0e8..d7879c9d034e 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_private_types.h
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_private_types.h
@@ -137,6 +137,8 @@ struct dcn401_commit_step_meta {
/* The OPP MPC tree has no plane yet. */
bool opp_tree_empty;
bool no_dsc;
+ /* The OTG master of the pipe has no OTG to reset to. */
+ bool no_timing_sync_source;
struct dcn401_pipe_deltas pipe_deltas;
/*
* Skip only when each delta named in pipe_deltas is true. Clear,
diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_builder_internal.h b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_builder_internal.h
index ee829acb3c78..d48330fcc64d 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_builder_internal.h
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_builder_internal.h
@@ -129,6 +129,8 @@ struct dcn401_commit_step_args {
bool hardware_remapped;
/* update_flags: a stream change or a non-address plane change. */
bool pipe_configs_changed;
+ /* The new state OTG master that pipe resets its timing to, or NULL. */
+ const struct pipe_ctx *timing_sync_source;
};
/*
diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c
index 6eeec90d4298..a222e48cb381 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_non_seamless_builder.c
@@ -338,6 +338,31 @@ static const struct dcn401_commit_step output[] = {
.meta.bios_set_scratch_critical_state.state = false },
};
+/*
+ * Net effect: dc_trigger_sync after apply_ctx_to_hw and again after
+ * optimize_bandwidth, which is dcn10_enable_timing_synchronization for
+ * each new OTG master that resets to another OTG master with the same
+ * timing. Each table runs for every such OTG master before the next
+ * table, as DC1 runs each loop for every pipe of the group. The wait
+ * returns at once on an OTG that has already reset, so each OTG master
+ * can wait. The DPG height that DC1 raises around the reset is a
+ * workaround, which the workaround manager adds.
+ */
+static const struct dcn401_commit_step sync_trigger_on[] = {
+ { .func = TG_ENABLE_RESET_TRIGGER,
+ .meta.skip_if.no_timing_sync_source = true },
+};
+
+static const struct dcn401_commit_step sync_wait[] = {
+ { .func = TG_WAIT_FOR_RESET_TRIGGER,
+ .meta.skip_if.no_timing_sync_source = true },
+};
+
+static const struct dcn401_commit_step sync_trigger_off[] = {
+ { .func = TG_DISABLE_RESET_TRIGGER,
+ .meta.skip_if.no_timing_sync_source = true },
+};
+
/*
* Net effect: finish the head for the new OTG master. program_front_end
* for a master with no plane: update_odm, which programs each plane-less
@@ -443,6 +468,21 @@ static const struct dcn401_sub_sequence bls_head[] = {
{ .flags = DCN401_NEW_STATE | DCN401_PER_STREAM_PER_OTG_MASTER,
.steps = output,
.count = ARRAY_SIZE(output) },
+};
+
+static const struct dcn401_sub_sequence bls_sync[] = {
+ { .flags = DCN401_NEW_STATE | DCN401_PER_STREAM_PER_OTG_MASTER,
+ .steps = sync_trigger_on,
+ .count = ARRAY_SIZE(sync_trigger_on) },
+ { .flags = DCN401_NEW_STATE | DCN401_PER_STREAM_PER_OTG_MASTER,
+ .steps = sync_wait,
+ .count = ARRAY_SIZE(sync_wait) },
+ { .flags = DCN401_NEW_STATE | DCN401_PER_STREAM_PER_OTG_MASTER,
+ .steps = sync_trigger_off,
+ .count = ARRAY_SIZE(sync_trigger_off) },
+};
+
+static const struct dcn401_sub_sequence bls_front_end[] = {
{ .flags = DCN401_NEW_STATE | DCN401_PER_STREAM_PER_OTG_MASTER,
.steps = front_end_lock,
.count = ARRAY_SIZE(front_end_lock) },
@@ -487,6 +527,8 @@ static enum bls_builder_result dcn401_build_non_seamless_commit(
dcn401_init_and_unpack_params(params, &state_args, &head);
DCN401_ADD_SUB_SEQUENCES(&head, &state_args, bls_head);
+ DCN401_ADD_SUB_SEQUENCES(&head, &state_args, bls_sync);
+ DCN401_ADD_SUB_SEQUENCES(&head, &state_args, bls_front_end);
for (i = 0; i < state_args.new_state->stream_count; i++) {
state_args.stream = state_args.new_state->streams[i];
if (!dcn401_stream_kept(params->dc, params->current_state,
@@ -500,6 +542,7 @@ static enum bls_builder_result dcn401_build_non_seamless_commit(
state_args.stream = NULL;
state_args.stream_unchanged = false;
DCN401_ADD_SUB_SEQUENCES(&head, &state_args, bls_postamble);
+ DCN401_ADD_SUB_SEQUENCES(&head, &state_args, bls_sync);
return BLS_BUILD_SUCCESS;
}
diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
index 6ee61bea0c0b..9ad9081b1b9a 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
@@ -55,6 +55,7 @@
#define DCN401_STATIC_SCREEN_NUM_FRAMES 2
#define DCN401_PENDING_UPDATE_POLL_INTERVAL_US 1
#define DCN401_PENDING_UPDATE_TIMEOUT_US 100000
+#define DCN401_RESET_TRIGGER_WAIT_FRAMES 10
#define DCN401_FLIP_PENDING_POLL_INTERVAL_US 100
#define DCN401_PLANE_ENABLE_DELAY_US 500
/* 1.0 in the HDR multiplier and MPCC gain format. */
@@ -2218,6 +2219,20 @@ static void dcn401_add_step(struct block_sequence_state *sequence,
p->tg_wait_odm_doublebuffer_pending_clear_params.tg =
pipe->stream_res.tg;
break;
+ case TG_ENABLE_RESET_TRIGGER:
+ p->tg_enable_reset_trigger_params.tg = pipe->stream_res.tg;
+ p->tg_enable_reset_trigger_params.source_tg_inst =
+ args->timing_sync_source->stream_res.tg->inst;
+ break;
+ case TG_WAIT_FOR_RESET_TRIGGER:
+ p->tg_wait_for_reset_trigger_params.tg = pipe->stream_res.tg;
+ p->tg_wait_for_reset_trigger_params.frames =
+ DCN401_RESET_TRIGGER_WAIT_FRAMES;
+ p->tg_wait_for_reset_trigger_params.continue_on_error = true;
+ break;
+ case TG_DISABLE_RESET_TRIGGER:
+ p->tg_disable_reset_trigger_params.tg = pipe->stream_res.tg;
+ break;
case TG_ENABLE_OPTC_CLOCK:
p->tg_enable_optc_clock_params.tg = pipe->stream_res.tg;
p->tg_enable_optc_clock_params.enable =
@@ -2818,6 +2833,9 @@ static bool dcn401_skip_step(const struct dcn401_commit_step_args *args,
return true;
if (step->meta.skip_if.no_dsc && !args->pipe->stream_res.dsc)
return true;
+ if (step->meta.skip_if.no_timing_sync_source &&
+ !args->timing_sync_source)
+ return true;
if (dcn401_pipe_deltas_match(skip, &deltas,
step->meta.skip_if.pipe_deltas_all))
return true;
@@ -2853,6 +2871,42 @@ static bool dcn401_walks_stream(const struct dcn401_commit_step_args *args,
args->new_state, stream);
}
+/*
+ * The OTG master that pipe resets to, chosen as program_timing_sync does:
+ * the first OTG master with the same timing that shows a plane, else the
+ * first one. NULL when that is pipe.
+ */
+static const struct pipe_ctx *dcn401_timing_sync_source(
+ const struct dcn401_commit_step_args *args,
+ const struct pipe_ctx *pipe)
+{
+ const struct dc_state_update_flags *flags = args->update_flags;
+ const struct pipe_ctx *source = NULL;
+ const struct pipe_ctx *member;
+ unsigned int i;
+
+ if (args->dc->debug.disable_timing_sync)
+ return NULL;
+ for (i = 0; i < args->dc->res_pool->pipe_count; i++) {
+ member = &args->new_state->res_ctx.pipe_ctx[i];
+ if (!member->stream || member->top_pipe ||
+ member->prev_odm_pipe ||
+ !resource_are_streams_timing_synchronizable(
+ member->stream, pipe->stream))
+ continue;
+ if (flags->cur_pipes[i].has_plane &&
+ flags->new_pipes[i].has_plane) {
+ source = member;
+ break;
+ }
+ if (!source)
+ source = member;
+ }
+ if (!source || source->pipe_idx == pipe->pipe_idx)
+ return NULL;
+ return source;
+}
+
static void dcn401_add_per_otg_master(struct block_sequence_state *sequence,
const struct dcn401_commit_step_args *state_args,
struct dc_state *state,
@@ -2868,6 +2922,8 @@ static void dcn401_add_per_otg_master(struct block_sequence_state *sequence,
&state->res_ctx, state->streams[i]);
if (!args.pipe)
continue;
+ args.timing_sync_source = dcn401_timing_sync_source(&args,
+ args.pipe);
dcn401_add_steps(sequence, &args, steps, count);
}
}
@@ -2964,6 +3020,7 @@ void dcn401_init_and_unpack_params(
state_args->stream_unchanged = false;
state_args->hardware_remapped = true;
state_args->pipe_configs_changed = true;
+ state_args->timing_sync_source = NULL;
params->head_num_steps = 0;
params->tail_num_steps = 0;
diff --git a/drivers/gpu/drm/amd/display/dc/bls_executor/bls_executor.c b/drivers/gpu/drm/amd/display/dc/bls_executor/bls_executor.c
index 32ff31b17f8d..f5f1aea3ab82 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_executor/bls_executor.c
+++ b/drivers/gpu/drm/amd/display/dc/bls_executor/bls_executor.c
@@ -358,6 +358,21 @@ static noinline_for_stack bool dc2_bls_step_supported(const struct dc2 *dc2,
tg = step->params.tg_wait_odm_doublebuffer_pending_clear_params.tg;
return tg && tg->funcs &&
tg->funcs->wait_odm_doublebuffer_pending_clear;
+ case TG_ENABLE_RESET_TRIGGER:
+ tg = step->params.tg_enable_reset_trigger_params.tg;
+ return tg && tg->funcs && tg->funcs->enable_reset_trigger;
+ case TG_WAIT_FOR_RESET_TRIGGER:
+ tg = step->params.tg_wait_for_reset_trigger_params.tg;
+ return tg && tg->funcs && tg->funcs->is_counter_moving &&
+ tg->funcs->did_triggered_reset_occur &&
+ tg->funcs->wait_for_state;
+ case TG_DISABLE_RESET_TRIGGER:
+ tg = step->params.tg_disable_reset_trigger_params.tg;
+ return tg && tg->funcs && tg->funcs->disable_reset_trigger;
+ case OPP_PROGRAM_DPG_DIMENSIONS:
+ opp = step->params.opp_program_dpg_dimensions_params.opp;
+ return opp && opp->funcs &&
+ opp->funcs->opp_program_dpg_dimensions;
case TG_PROGRAM_STEREO:
tg = step->params.tg_program_stereo_params.tg;
return tg && tg->funcs && tg->funcs->program_stereo &&
@@ -789,6 +804,24 @@ static noinline_for_stack bool dc2_bls_wait_for_blank_complete(
return w->opp->funcs->dpg_is_blanked(w->opp);
}
+static noinline_for_stack bool dc2_bls_wait_for_reset_trigger(
+ const struct tg_wait_for_reset_trigger_params *w)
+{
+ struct timing_generator *tg = w->tg;
+ unsigned int i;
+
+ for (i = 0; i < w->frames; i++) {
+ if (!tg->funcs->is_counter_moving(tg))
+ return false;
+ if (tg->funcs->did_triggered_reset_occur(tg))
+ return true;
+ tg->funcs->wait_for_state(tg, CRTC_STATE_VACTIVE);
+ tg->funcs->wait_for_state(tg, CRTC_STATE_VBLANK);
+ }
+
+ return false;
+}
+
static noinline_for_stack void dc2_bls_wait_for_all_pending_updates(
const struct tg_wait_for_all_pending_updates_params *w)
{
@@ -1299,6 +1332,32 @@ enum dc2_bls_exec_result dc2_bls_execute(
.tg_wait_odm_doublebuffer_pending_clear_params.tg;
tg->funcs->wait_odm_doublebuffer_pending_clear(tg);
break;
+ case TG_ENABLE_RESET_TRIGGER:
+ tg = entry->params.tg_enable_reset_trigger_params.tg;
+ tg->funcs->enable_reset_trigger(tg, entry->params
+ .tg_enable_reset_trigger_params.source_tg_inst);
+ break;
+ case TG_WAIT_FOR_RESET_TRIGGER:
+ if (dc2_bls_wait_for_reset_trigger(&entry->params
+ .tg_wait_for_reset_trigger_params))
+ break;
+ if (!entry->params.tg_wait_for_reset_trigger_params
+ .continue_on_error)
+ return DC2_BLS_EXEC_ERROR;
+ result = DC2_BLS_EXEC_CONTINUED_ON_ERROR;
+ break;
+ case TG_DISABLE_RESET_TRIGGER:
+ tg = entry->params.tg_disable_reset_trigger_params.tg;
+ tg->funcs->disable_reset_trigger(tg);
+ break;
+ case OPP_PROGRAM_DPG_DIMENSIONS: {
+ const struct opp_program_dpg_dimensions_params *p =
+ &entry->params.opp_program_dpg_dimensions_params;
+
+ p->opp->funcs->opp_program_dpg_dimensions(p->opp,
+ p->width, p->height);
+ break;
+ }
case TG_PROGRAM_STEREO: {
const struct tg_program_stereo_params *p =
&entry->params.tg_program_stereo_params;
diff --git a/drivers/gpu/drm/amd/display/dc/core2/dc_core2.c b/drivers/gpu/drm/amd/display/dc/core2/dc_core2.c
index c06735054eea..8c155298d822 100644
--- a/drivers/gpu/drm/amd/display/dc/core2/dc_core2.c
+++ b/drivers/gpu/drm/amd/display/dc/core2/dc_core2.c
@@ -58,6 +58,7 @@ void core2_destruct(struct dc *dc)
bool core2_run_sequence(struct dc *dc,
const struct bls_builder *builder,
const struct workaround_manager *wam,
+ const struct dc_state *target,
struct block_sequence *steps, unsigned int *num_steps)
{
struct workaround_context wa_ctx = {0};
@@ -67,6 +68,7 @@ bool core2_run_sequence(struct dc *dc,
sequence.steps = steps;
sequence.num_steps = num_steps;
wa_ctx.current_state = dc->current_state;
+ wa_ctx.target = target;
wa_ctx.builder_name = builder->name;
wa_ctx.dcn_version = dc->ctx->dce_version;
wa_ctx.bug_wa = &dc->work_arounds;
@@ -109,7 +111,7 @@ static bool core2_query_accelerated_mode(struct dc *dc)
if (builder->build.declarative(params) != BLS_BUILD_SUCCESS ||
params->tail_num_steps ||
- !core2_run_sequence(dc, builder, wam,
+ !core2_run_sequence(dc, builder, wam, NULL,
params->head_sequence, ¶ms->head_num_steps))
accelerated_mode = false;
@@ -202,7 +204,7 @@ static enum dc_status core2_build_and_run(struct dc *dc,
status = DC_NOT_SUPPORTED;
goto out;
}
- if (!core2_run_sequence(dc, builder, wam,
+ if (!core2_run_sequence(dc, builder, wam, new_state,
params->head_sequence, ¶ms->head_num_steps))
goto out;
diff --git a/drivers/gpu/drm/amd/display/dc/core2/dc_core2.h b/drivers/gpu/drm/amd/display/dc/core2/dc_core2.h
index e97097829c80..594ba0438b48 100644
--- a/drivers/gpu/drm/amd/display/dc/core2/dc_core2.h
+++ b/drivers/gpu/drm/amd/display/dc/core2/dc_core2.h
@@ -25,6 +25,7 @@ void core2_destruct(struct dc *dc);
/* Applies workarounds to a built head sequence and executes it. */
bool core2_run_sequence(struct dc *dc, const struct bls_builder *builder,
const struct workaround_manager *wam,
+ const struct dc_state *target,
struct block_sequence *steps, unsigned int *num_steps);
#endif /* DC_CORE2_H_ */
diff --git a/drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.c b/drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.c
index 0e8e2d299bd3..f5fa46ef5160 100644
--- a/drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.c
+++ b/drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.c
@@ -293,7 +293,7 @@ static void core2_run_wrapped_hardware_init(struct dc *dc)
if (build_result != BLS_BUILD_SUCCESS &&
build_result != BLS_BUILD_MORE_STAGES)
goto out;
- if (!core2_run_sequence(dc, builder, wam,
+ if (!core2_run_sequence(dc, builder, wam, NULL,
params->head_sequence, ¶ms->head_num_steps))
goto out;
if (builder->postprocess)
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
index 68f7bb01bdd3..c348b461caf8 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
+++ b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
@@ -416,6 +416,27 @@ struct tg_wait_odm_doublebuffer_pending_clear_params {
struct timing_generator *tg;
};
+struct tg_enable_reset_trigger_params {
+ struct timing_generator *tg;
+ int source_tg_inst;
+};
+
+struct tg_wait_for_reset_trigger_params {
+ struct timing_generator *tg;
+ unsigned int frames;
+ bool continue_on_error;
+};
+
+struct tg_disable_reset_trigger_params {
+ struct timing_generator *tg;
+};
+
+struct opp_program_dpg_dimensions_params {
+ struct output_pixel_processor *opp;
+ uint32_t width;
+ uint32_t height;
+};
+
struct tg_program_stereo_params {
struct timing_generator *tg;
const struct dc_crtc_timing *timing;
@@ -1710,6 +1731,12 @@ union block_sequence_params {
struct tg_disable_crtc_params tg_disable_crtc_params;
struct tg_wait_odm_doublebuffer_pending_clear_params
tg_wait_odm_doublebuffer_pending_clear_params;
+ struct tg_enable_reset_trigger_params tg_enable_reset_trigger_params;
+ struct tg_wait_for_reset_trigger_params
+ tg_wait_for_reset_trigger_params;
+ struct tg_disable_reset_trigger_params tg_disable_reset_trigger_params;
+ struct opp_program_dpg_dimensions_params
+ opp_program_dpg_dimensions_params;
struct tg_program_stereo_params tg_program_stereo_params;
struct opp_program_stereo_params opp_program_stereo_params;
struct opp_wait_for_blank_complete_params
@@ -2002,6 +2029,10 @@ enum block_sequence_func {
FPGA_SET_DTBCLK,
FPGA_SET_DPREFCLK,
FPGA_SET_REFCLK,
+ TG_ENABLE_RESET_TRIGGER,
+ TG_WAIT_FOR_RESET_TRIGGER,
+ TG_DISABLE_RESET_TRIGGER,
+ OPP_PROGRAM_DPG_DIMENSIONS,
/* This must be the last value in this enum, add new ones above */
HWSS_BLOCK_SEQUENCE_FUNC_COUNT
};
diff --git a/drivers/gpu/drm/amd/display/dc/workaround_manager/workaround_manager.c b/drivers/gpu/drm/amd/display/dc/workaround_manager/workaround_manager.c
index 067a7069186b..7e7e29d2530a 100644
--- a/drivers/gpu/drm/amd/display/dc/workaround_manager/workaround_manager.c
+++ b/drivers/gpu/drm/amd/display/dc/workaround_manager/workaround_manager.c
@@ -4,19 +4,129 @@
*/
#include "dm_services.h"
+#include "core_types.h"
#include "workaround_manager/workaround_manager.h"
-static const struct workaround_manager dc2_wam_empty = {
- .registry = NULL,
- .count = 0,
-};
-
/* BSS, not the stack: 64 block_sequence entries exceed the kernel frame limit. */
static struct block_sequence dc2_wam_saved_steps[DC2_BLS_MAX_STEPS];
+static struct block_sequence dc2_wam_input_steps[DC2_BLS_MAX_STEPS];
+
+static bool wa_dpg_height_is_applicable(const struct block_sequence_state *bls,
+ const struct workaround_context *ctx)
+{
+ unsigned int i = 0;
+
+ if (!ctx->target)
+ return false;
+ for (i = 0; i < *bls->num_steps; i++)
+ if (bls->steps[i].func == TG_ENABLE_RESET_TRIGGER)
+ return true;
+ return false;
+}
+
+static struct timing_generator *wa_reset_trigger_tg(
+ const struct block_sequence *step)
+{
+ if (step->func == TG_ENABLE_RESET_TRIGGER)
+ return step->params.tg_enable_reset_trigger_params.tg;
+ return step->params.tg_disable_reset_trigger_params.tg;
+}
+
+static const struct pipe_ctx *wa_otg_master(const struct dc_state *state,
+ const struct timing_generator *tg)
+{
+ const struct pipe_ctx *pipe = NULL;
+ unsigned int i = 0;
+
+ for (i = 0; i < MAX_PIPES; i++) {
+ pipe = &state->res_ctx.pipe_ctx[i];
+ if (pipe->stream && !pipe->top_pipe && !pipe->prev_odm_pipe &&
+ pipe->stream_res.tg == tg)
+ return pipe;
+ }
+ return NULL;
+}
+
+/*
+ * The DPG spans twice the active height plus one while the OTGs reset, so
+ * the reset does not trip the underflow counter.
+ */
+static bool wa_dpg_height_add(struct block_sequence *steps, unsigned int *n,
+ const struct dc_state *target, const struct block_sequence *run,
+ unsigned int count, bool raise)
+{
+ const struct pipe_ctx *pipe = NULL;
+ const struct dc_crtc_timing *t = NULL;
+ struct opp_program_dpg_dimensions_params *p = NULL;
+ unsigned int i = 0;
+ uint32_t height = 0;
+
+ for (i = 0; i < count; i++) {
+ pipe = wa_otg_master(target, wa_reset_trigger_tg(&run[i]));
+ if (!pipe || !pipe->stream_res.opp ||
+ !pipe->stream_res.opp->funcs ||
+ !pipe->stream_res.opp->funcs->opp_program_dpg_dimensions)
+ continue;
+ if (*n >= DC2_BLS_MAX_STEPS)
+ return false;
+ t = &pipe->stream->timing;
+ height = t->v_addressable + t->v_border_top + t->v_border_bottom;
+ p = &steps[*n].params.opp_program_dpg_dimensions_params;
+ p->opp = pipe->stream_res.opp;
+ p->width = t->h_addressable + t->h_border_left +
+ t->h_border_right;
+ p->height = raise ? 2 * height + 1 : height;
+ steps[(*n)++].func = OPP_PROGRAM_DPG_DIMENSIONS;
+ }
+ return true;
+}
+
+static enum workaround_manager_result wa_dpg_height_apply(
+ struct block_sequence_state *bls,
+ const struct workaround_context *ctx)
+{
+ struct block_sequence *in = dc2_wam_input_steps;
+ unsigned int num = *bls->num_steps;
+ unsigned int n = 0;
+ unsigned int i = 0;
+ unsigned int j = 0;
+
+ memmove(in, bls->steps, num * sizeof(in[0]));
+ for (i = 0; i < num; i = j) {
+ for (j = i + 1; j < num && in[j].func == in[i].func; j++)
+ ;
+ if (in[i].func == TG_ENABLE_RESET_TRIGGER &&
+ !wa_dpg_height_add(bls->steps, &n, ctx->target,
+ &in[i], j - i, true))
+ return WAM_SIZE_EXCEEDED;
+ if (n + j - i > DC2_BLS_MAX_STEPS)
+ return WAM_SIZE_EXCEEDED;
+ memmove(&bls->steps[n], &in[i], (j - i) * sizeof(in[0]));
+ n += j - i;
+ if (in[i].func == TG_DISABLE_RESET_TRIGGER &&
+ !wa_dpg_height_add(bls->steps, &n, ctx->target,
+ &in[i], j - i, false))
+ return WAM_SIZE_EXCEEDED;
+ }
+ *bls->num_steps = n;
+ return WAM_OK;
+}
+
+static const struct workaround dc2_wam_registry[] = {
+ { .name = "dpg_height_otg_reset",
+ .enabled = true,
+ .is_applicable = wa_dpg_height_is_applicable,
+ .apply = wa_dpg_height_apply },
+};
+
+static const struct workaround_manager dc2_wam = {
+ .registry = dc2_wam_registry,
+ .count = ARRAY_SIZE(dc2_wam_registry),
+};
const struct workaround_manager *dc2_workaround_manager_get(void)
{
- return &dc2_wam_empty;
+ return &dc2_wam;
}
enum workaround_manager_result workaround_manager_apply(
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 28/30] drm/amd/display: Move shared dcn401 builder code to its own file
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (26 preceding siblings ...)
2026-12-01 20:23 ` [PATCH v2 27/30] drm/amd/display: Sync OTG timing in the DC2 non-seamless commit George Zhang
@ 2026-12-01 20:23 ` George Zhang
2026-12-01 20:23 ` [PATCH v2 29/30] drm/amd/display: Allow disabling CRC capture when the stream is gone George Zhang
2026-12-01 20:23 ` [PATCH v2 30/30] drm/amd/display: Promote DC to 3.2.410 George Zhang
29 siblings, 0 replies; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:23 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Tony Cheng, Jun Lei,
Dillon Varone, George Zhang
From: Tony Cheng <tony.cheng@amd.com>
[Why]
The dcn401 DC2 seamless builder file also holds the code that the
non-seamless builder uses, so a change to that code reads as a change
to the seamless update.
[How]
Move the support checks, the pipe removal tables and the step walkers
to dcn401_builder_internal.c, unchanged. Export the two helpers both
files call. Add the file to the build lists.
Cc: Jun Lei <jun.lei@amd.com>
Cc: Dillon Varone <dillon.varone@amd.com>
Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
drivers/gpu/drm/amd/display/dc/Makefile | 1 +
.../dc/bls_builder/dcn401_builder_internal.c | 1817 +++++++++++++++++
.../dc/bls_builder/dcn401_builder_internal.h | 6 +
.../dc/bls_builder/dcn401_seamless_builder.c | 1792 ----------------
4 files changed, 1824 insertions(+), 1792 deletions(-)
create mode 100644 drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_builder_internal.c
diff --git a/drivers/gpu/drm/amd/display/dc/Makefile b/drivers/gpu/drm/amd/display/dc/Makefile
index e6ffca083dbb..ec4b873b835f 100644
--- a/drivers/gpu/drm/amd/display/dc/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/Makefile
@@ -85,6 +85,7 @@ FILES += core2/dc_core2.o
FILES += core2/dc_core2_init.o
FILES += core2/dc_core2_legacy_init.o
FILES += bls_builder/bls_builder.o
+FILES += bls_builder/dcn401_builder_internal.o
FILES += bls_builder/dcn401_seamless_builder.o
FILES += bls_builder/dcn401_init_builder.o
FILES += bls_builder/dcn401_init_builder_legacy.o
diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_builder_internal.c b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_builder_internal.c
new file mode 100644
index 000000000000..25cacb1138f1
--- /dev/null
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_builder_internal.c
@@ -0,0 +1,1817 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright 2026 Advanced Micro Devices, Inc.
+ */
+
+#include "dm_services.h"
+#include "core_types.h"
+#include "resource.h"
+#include "link_encoder.h"
+#include "stream_encoder.h"
+#include "clk_mgr.h"
+#include "dccg.h"
+#include "dc_bios_types.h"
+#include "dc_dmub_srv.h"
+#include "custom_float.h"
+#include "dcn32/dcn32_resource.h"
+#include "dce/dce_hwseq.h"
+#include "bls_builder/bls_builder_internal.h"
+#include "bls_builder/dcn401_init_builder.h"
+#include "bls_builder/bls_builder_private_types.h"
+#include "bls_builder/dcn401_builder_internal.h"
+#include "state_facts/state_facts.h"
+
+#undef DC_LOGGER
+#define DC_LOGGER \
+ dc->ctx->logger
+
+/*
+ * What every dcn401 declarative builder shares: the dc and stream support
+ * checks, the pipe removal tables, and the step walkers that turn a table
+ * into BLS entries.
+ */
+
+#define DCN401_DPG_POLL_INTERVAL_US 100
+#define DCN401_DPG_POLL_TIMEOUT_US 100000
+#define DCN401_STATIC_SCREEN_NUM_FRAMES 2
+#define DCN401_PENDING_UPDATE_POLL_INTERVAL_US 1
+#define DCN401_PENDING_UPDATE_TIMEOUT_US 100000
+#define DCN401_RESET_TRIGGER_WAIT_FRAMES 10
+#define DCN401_FLIP_PENDING_POLL_INTERVAL_US 100
+#define DCN401_PLANE_ENABLE_DELAY_US 500
+/* 1.0 in the HDR multiplier and MPCC gain format. */
+#define DCN401_UNITY_GAIN 0x1f000
+#define DCN401_MALL_SEL_SS 2
+#define DCN401_CACHE_CURSOR_BYTES 16384
+
+void dcn401_commit_check_failed(const struct dc *dc, const char *msg)
+{
+ if (dc && dc->ctx && dc->ctx->logger)
+ DC_LOG_DEBUG("%s\n", msg);
+}
+
+static bool check_dc_resources(const struct dc *dc,
+ const struct dc_state *current_state,
+ const struct dc_state *new_state)
+{
+ (void)current_state;
+ (void)new_state;
+ return dc->res_pool && dc->res_pool->hubbub && dc->res_pool->dccg &&
+ dc->res_pool->mpc && dc->hwseq && dc->clk_mgr &&
+ dc->ctx && dc->ctx->dc_bios;
+}
+
+static bool check_fams2_debug(const struct dc *dc,
+ const struct dc_state *current_state,
+ const struct dc_state *new_state)
+{
+ (void)current_state;
+ (void)new_state;
+ return !dc->debug.fams2_config.bits.enable;
+}
+
+static bool check_cursor_offload(const struct dc *dc,
+ const struct dc_state *current_state,
+ const struct dc_state *new_state)
+{
+ (void)current_state;
+ (void)new_state;
+ return !dc->ctx->dmub_srv || !dc->ctx->dmub_srv->cursor_offload_enabled;
+}
+
+static bool check_dc_mode_softmax(const struct dc *dc,
+ const struct dc_state *current_state,
+ const struct dc_state *new_state)
+{
+ (void)current_state;
+ (void)new_state;
+ return !dc->clk_mgr->dc_mode_softmax_enabled;
+}
+
+static bool check_visual_confirm(const struct dc *dc,
+ const struct dc_state *current_state,
+ const struct dc_state *new_state)
+{
+ (void)current_state;
+ (void)new_state;
+ return dc->debug.visual_confirm == VISUAL_CONFIRM_DISABLE &&
+ !dc->debug.force_dpg_on_flip &&
+ !dc->debug.enable_hblank_borrow &&
+ !dc->debug.enable_otg_frame_sync_pwa;
+}
+
+/* With the DSC power gate disabled, update_dsc_pg only reads. */
+static bool check_dsc_power_gate(const struct dc *dc,
+ const struct dc_state *current_state,
+ const struct dc_state *new_state)
+{
+ (void)current_state;
+ (void)new_state;
+ return dc->debug.disable_dsc_power_gate;
+}
+
+enum bls_builder_result dcn401_check_dc_support(const struct dc *dc)
+{
+ const struct dc_state *current_state = NULL;
+ const struct dc_state *new_state = NULL;
+
+ CHECK_RESOURCE(dc_resources, "dc resources are missing");
+ CHECK_CONDITION(fams2_debug, "FAMS2 debug is enabled");
+ CHECK_CONDITION(cursor_offload, "cursor offload is enabled");
+ CHECK_CONDITION(dc_mode_softmax, "dc mode softmax is enabled");
+ CHECK_CONDITION(visual_confirm,
+ "visual confirm, dpg, hblank borrow, or frame sync is set");
+ CHECK_CONDITION(dsc_power_gate, "DSC power gate is enabled");
+ return BLS_BUILD_SUCCESS;
+}
+
+static bool check_no_phantom(const struct dc *dc,
+ const struct dc_state *current_state,
+ const struct dc_state *new_state)
+{
+ (void)dc;
+ return !dcn401_checked_state(current_state,
+ new_state)->phantom_stream_count;
+}
+
+static bool check_fams2_state(const struct dc *dc,
+ const struct dc_state *current_state,
+ const struct dc_state *new_state)
+{
+ const struct dc_state *state = dcn401_checked_state(current_state,
+ new_state);
+
+ (void)dc;
+ return !state->bw_ctx.bw.dcn.fams2_global_config.features.bits.enable;
+}
+
+static bool check_stream_link(const struct dc *dc,
+ const struct dc_state *state, unsigned int i)
+{
+ (void)dc;
+ return state->streams[i] && state->streams[i]->link;
+}
+
+/* link_set_dpms_on and _off program nothing for a virtual signal. */
+static bool check_virtual_signal(const struct dc *dc,
+ const struct dc_state *state, unsigned int i)
+{
+ (void)dc;
+ (void)state;
+ (void)i;
+ return false;
+}
+
+static bool check_link_encoder(const struct dc *dc,
+ const struct dc_state *state, unsigned int i)
+{
+ const struct dc_link *link = state->streams[i]->link;
+
+ (void)dc;
+ return link->ep_type == DISPLAY_ENDPOINT_PHY && link->link_enc;
+}
+
+static bool check_no_interlace(const struct dc *dc,
+ const struct dc_state *state, unsigned int i)
+{
+ (void)dc;
+ return !state->streams[i]->timing.flags.INTERLACE;
+}
+
+static bool check_no_stereo(const struct dc *dc,
+ const struct dc_state *state, unsigned int i)
+{
+ (void)dc;
+ return state->streams[i]->timing.timing_3d_format ==
+ TIMING_3D_FORMAT_NONE;
+}
+
+static bool check_no_drr(const struct dc *dc,
+ const struct dc_state *state, unsigned int i)
+{
+ const struct dc_stream_state *stream = state->streams[i];
+
+ (void)dc;
+ return !stream->ignore_msa_timing_param &&
+ !stream->adjust.v_total_min &&
+ !stream->adjust.v_total_max;
+}
+
+static bool check_no_boot_dpms_writeback(const struct dc *dc,
+ const struct dc_state *state, unsigned int i)
+{
+ const struct dc_stream_state *stream = state->streams[i];
+
+ (void)dc;
+ return !stream->apply_seamless_boot_optimization && !stream->dpms_off &&
+ !stream->num_wb_info;
+}
+
+static bool check_abm(const struct dc *dc,
+ const struct dc_state *state, unsigned int i)
+{
+ const struct dc_stream_state *stream = state->streams[i];
+
+ (void)dc;
+ return !stream->abm_level ||
+ stream->abm_level == ABM_LEVEL_IMMEDIATE_DISABLE;
+}
+
+/*
+ * An MPC bottom pipe or an ODM slice of the stream is not an OTG master;
+ * check_mpc_blend and check_odm_combine bound them.
+ */
+const struct pipe_ctx *dcn401_otg_master(const struct dc_state *state,
+ const struct dc_stream_state *stream)
+{
+ const struct pipe_ctx *otg_master = NULL;
+ unsigned int i;
+
+ for (i = 0; i < MAX_PIPES; i++) {
+ const struct pipe_ctx *pipe = &state->res_ctx.pipe_ctx[i];
+
+ if (!stream || !pipe->stream ||
+ pipe->stream->stream_id != stream->stream_id ||
+ pipe->top_pipe || pipe->prev_odm_pipe)
+ continue;
+ if (otg_master)
+ return NULL;
+ otg_master = pipe;
+ }
+ return otg_master;
+}
+
+int dcn401_stream_index(const struct dc_state *state,
+ const struct dc_stream_state *stream)
+{
+ int i;
+
+ if (!stream)
+ return -1;
+ for (i = 0; i < state->stream_count; i++)
+ if (state->streams[i]->stream_id == stream->stream_id)
+ return i;
+ return -1;
+}
+
+#define DCN401_SAME_INST(a, b) \
+ ((!(a) && !(b)) || ((a) && (b) && (a)->inst == (b)->inst))
+
+bool dcn401_pipe_on_stream(const struct pipe_ctx *pipe,
+ const struct dc_stream_state *stream)
+{
+ return pipe->stream && pipe->stream->stream_id == stream->stream_id;
+}
+
+/* The plane is compared as an object: planes have no DC-assigned id yet. */
+static bool dcn401_pipe_layout_unchanged(const struct pipe_ctx *cur,
+ const struct pipe_ctx *new)
+{
+ return cur->plane_state == new->plane_state &&
+ DCN401_SAME_INST(cur->plane_res.hubp, new->plane_res.hubp) &&
+ DCN401_SAME_INST(cur->plane_res.dpp, new->plane_res.dpp) &&
+ DCN401_SAME_INST(cur->stream_res.tg, new->stream_res.tg) &&
+ DCN401_SAME_INST(cur->stream_res.opp, new->stream_res.opp) &&
+ !cur->top_pipe == !new->top_pipe &&
+ !cur->bottom_pipe == !new->bottom_pipe &&
+ !cur->prev_odm_pipe == !new->prev_odm_pipe &&
+ !cur->next_odm_pipe == !new->next_odm_pipe;
+}
+
+bool dcn401_stream_unchanged(const struct dc_state *current_state,
+ const struct dc_state *new_state,
+ const struct dc_stream_state *stream)
+{
+ const struct pipe_ctx *cur, *new;
+ unsigned int i;
+
+ if (dcn401_stream_index(current_state, stream) < 0 ||
+ dcn401_stream_index(new_state, stream) < 0)
+ return false;
+ for (i = 0; i < MAX_PIPES; i++) {
+ cur = ¤t_state->res_ctx.pipe_ctx[i];
+ new = &new_state->res_ctx.pipe_ctx[i];
+ if (dcn401_pipe_on_stream(cur, stream) !=
+ dcn401_pipe_on_stream(new, stream))
+ return false;
+ if (dcn401_pipe_on_stream(new, stream) &&
+ !dcn401_pipe_layout_unchanged(cur, new))
+ return false;
+ }
+ return true;
+}
+
+static bool check_otg_master_present(const struct dc *dc,
+ const struct dc_state *state, unsigned int i)
+{
+ (void)dc;
+ return dcn401_otg_master(state, state->streams[i]) != NULL;
+}
+
+/* At most DCN401_MAX_OPP_HEADS ODM slices, each with an OPP. */
+static bool check_odm_combine(const struct dc *dc,
+ const struct dc_state *state, unsigned int i)
+{
+ const struct pipe_ctx *odm = dcn401_otg_master(state,
+ state->streams[i]);
+ unsigned int count = 0;
+
+ (void)dc;
+ for (; odm; odm = odm->next_odm_pipe)
+ if (!odm->stream_res.opp || ++count > DCN401_MAX_OPP_HEADS)
+ return false;
+ return count;
+}
+
+static bool check_mpc_blend(const struct dc *dc,
+ const struct dc_state *state, unsigned int i)
+{
+ struct dc_state_facts facts;
+
+ (void)dc;
+ dc_state_facts_derive(state, &facts);
+ /*
+ * At most one bottom pipe, on the master's OTG and OPP. A bottom pipe
+ * and ODM do not go together.
+ */
+ return facts.global.blend_tree[i].dpp_pipe_count <= 2 &&
+ facts.global.blend_tree[i].on_otg_master_blocks &&
+ (facts.global.blend_tree[i].dpp_pipe_count == 1 ||
+ !dc_state_facts_any_pipe(&facts, (uint8_t)i,
+ DC_TRAIT_MATCH(DC_PIPE_TRAIT_ODM, 0)));
+}
+
+static bool check_otg_master_blocks(const struct dc *dc,
+ const struct dc_state *state, unsigned int i)
+{
+ const struct pipe_ctx *pipe = dcn401_otg_master(state,
+ state->streams[i]);
+
+ (void)dc;
+ return pipe && pipe->stream_res.tg && pipe->stream_res.opp &&
+ pipe->stream_res.stream_enc && pipe->clock_source;
+}
+
+static bool check_pipe_audio(const struct dc *dc,
+ const struct dc_state *state, unsigned int i)
+{
+ const struct pipe_ctx *pipe = dcn401_otg_master(state,
+ state->streams[i]);
+
+ (void)dc;
+ return pipe && !pipe->stream_res.audio;
+}
+
+static bool check_pipe_dsc(const struct dc *dc,
+ const struct dc_state *state, unsigned int i)
+{
+ const struct dc_stream_state *stream = state->streams[i];
+ struct pipe_ctx *opp_heads[MAX_PIPES];
+ int j, n;
+
+ (void)dc;
+ n = resource_get_opp_heads_for_stream(stream,
+ (struct resource_context *)&state->res_ctx, opp_heads);
+ for (j = 0; j < n; j++)
+ if (!opp_heads[j]->stream_res.dsc != !stream->timing.flags.DSC)
+ return false;
+ return true;
+}
+
+static bool check_dsc_pixel_clock(const struct dc *dc,
+ const struct dc_state *state, unsigned int i)
+{
+ const struct dc_crtc_timing *timing = &state->streams[i]->timing;
+
+ (void)dc;
+ return !timing->flags.DSC || timing->pix_clk_100hz > 480000;
+}
+
+static bool check_pipe_gsl(const struct dc *dc,
+ const struct dc_state *state, unsigned int i)
+{
+ const struct pipe_ctx *pipe = dcn401_otg_master(state,
+ state->streams[i]);
+
+ (void)dc;
+ return pipe && !pipe->stream_res.gsl_group;
+}
+
+static bool check_link_enc_assignment(const struct dc *dc,
+ const struct dc_state *state, unsigned int i)
+{
+ const struct pipe_ctx *pipe = dcn401_otg_master(state,
+ state->streams[i]);
+
+ if (!dc->config.unify_link_enc_assignment)
+ return true;
+ return pipe && pipe->link_res.dio_link_enc ==
+ pipe->stream->link->link_enc;
+}
+
+/* Each stream on its own link. */
+static bool check_own_link(const struct dc *dc,
+ const struct dc_state *state, unsigned int i)
+{
+ unsigned int j;
+
+ (void)dc;
+ for (j = 0; j < i; j++)
+ if (state->streams[j]->link == state->streams[i]->link)
+ return false;
+ return true;
+}
+
+static enum bls_builder_result dcn401_check_one_stream(const struct dc *dc,
+ const struct dc_state *state, unsigned int i)
+{
+ CHECK_STREAM_RESOURCE(stream_link, "stream has no link");
+ CHECK_STREAM_CONDITION(own_link, "streams share a link");
+ CHECK_STREAM_CONDITION(virtual_signal, "signal is not virtual");
+ CHECK_STREAM_RESOURCE(link_encoder, "link encoder is not DIO");
+ CHECK_STREAM_CONDITION(no_interlace, "timing is interlace");
+ CHECK_STREAM_CONDITION(no_stereo, "timing is stereo");
+ CHECK_STREAM_CONDITION(dsc_pixel_clock,
+ "dsc pixel clock is 48 MHz or less");
+ CHECK_STREAM_CONDITION(no_drr, "DRR is set");
+ CHECK_STREAM_CONDITION(no_boot_dpms_writeback,
+ "seamless boot, dpms, or writeback is set");
+ CHECK_STREAM_CONDITION(abm, "ABM level is set");
+ CHECK_STREAM_RESOURCE(otg_master_present,
+ "stream has no otg master, or more than one");
+ CHECK_STREAM_CONDITION(odm_combine, "odm is not bypass, 2:1 or 3:1");
+ CHECK_STREAM_CONDITION(mpc_blend,
+ "more than one bottom pipe, off the otg or opp, or with odm");
+ CHECK_STREAM_RESOURCE(otg_master_blocks,
+ "otg master is missing a stream resource or pixel clock");
+ CHECK_STREAM_CONDITION(pipe_audio, "audio is set");
+ CHECK_STREAM_RESOURCE(pipe_dsc,
+ "dsc differs from the timing on an opp head");
+ CHECK_STREAM_CONDITION(pipe_gsl, "gsl is set");
+ CHECK_STREAM_CONDITION(link_enc_assignment,
+ "link encoder assignment differs");
+ return BLS_BUILD_SUCCESS;
+}
+
+/* Every pipe with a stream belongs to a stream of the state. */
+static bool check_pipe_streams(const struct dc *dc,
+ const struct dc_state *current_state,
+ const struct dc_state *new_state)
+{
+ const struct dc_state *state = dcn401_checked_state(current_state,
+ new_state);
+ unsigned int i;
+
+ (void)dc;
+ for (i = 0; i < MAX_PIPES; i++)
+ if (state->res_ctx.pipe_ctx[i].stream &&
+ dcn401_stream_index(state,
+ state->res_ctx.pipe_ctx[i].stream) < 0)
+ return false;
+ return true;
+}
+
+enum bls_builder_result dcn401_check_stream_support(const struct dc *dc,
+ const struct dc_state *current_state,
+ const struct dc_state *new_state)
+{
+ const struct dc_state *state = dcn401_checked_state(current_state,
+ new_state);
+ enum bls_builder_result result;
+ unsigned int i;
+
+ if (!state)
+ return BLS_BUILD_ERROR_UNSUPPORTED_STATE_UPDATE;
+ CHECK_CONDITION(no_phantom, "a phantom stream is set");
+ CHECK_CONDITION(fams2_state, "fams2 is enabled");
+ CHECK_CONDITION(pipe_streams, "a pipe has a stream the state lacks");
+ for (i = 0; i < state->stream_count; i++) {
+ result = dcn401_check_one_stream(dc, state, i);
+ if (result != BLS_BUILD_SUCCESS)
+ return result;
+ }
+ return BLS_BUILD_SUCCESS;
+}
+
+bool dcn401_same_opp_heads(const struct dc_state *current_state,
+ const struct dc_state *new_state,
+ const struct dc_stream_state *stream)
+{
+ const struct pipe_ctx *cur = dcn401_otg_master(current_state, stream);
+ const struct pipe_ctx *new = dcn401_otg_master(new_state, stream);
+ struct pipe_ctx *cur_heads[MAX_PIPES], *new_heads[MAX_PIPES];
+ int i, n;
+
+ if (!cur || !new)
+ return false;
+ n = resource_get_opp_heads_for_otg_master(cur,
+ (struct resource_context *)¤t_state->res_ctx,
+ cur_heads);
+ if (n != resource_get_opp_heads_for_otg_master(new,
+ (struct resource_context *)&new_state->res_ctx,
+ new_heads))
+ return false;
+ for (i = 0; i < n; i++)
+ if (!cur_heads[i]->stream_res.opp ||
+ !new_heads[i]->stream_res.opp ||
+ cur_heads[i]->stream_res.opp->inst !=
+ new_heads[i]->stream_res.opp->inst)
+ return false;
+ return true;
+}
+
+/*
+ * Under the lock, each current pipe that the update removes leaves its
+ * MPCC and returns its DET segments, as DC1 disconnects a disabled pipe.
+ */
+const struct dcn401_commit_step dcn401_disconnect[DCN401_DISCONNECT_STEPS] = {
+ { .func = HUBP_PROGRAM_DET_SEGMENTS,
+ .meta.skip_if.stream_unchanged = true,
+ .meta.skip_if.only_addresses_changed = true,
+ .meta.skip_if.pipe_deltas.current_has_no_plane = true,
+ .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
+ { .func = MPC_REMOVE_MPCC,
+ .meta.skip_if.stream_unchanged = true,
+ .meta.skip_if.only_addresses_changed = true,
+ .meta.skip_if.pipe_deltas.current_has_no_plane = true,
+ .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
+};
+
+/* After the unlock, disable_plane on each removed pipe. */
+const struct dcn401_commit_step dcn401_power_down[DCN401_POWER_DOWN_STEPS] = {
+ { .func = MPC_ASSERT_IDLE_MPCC,
+ .meta.skip_if.stream_unchanged = true,
+ .meta.skip_if.only_addresses_changed = true,
+ .meta.skip_if.pipe_deltas.current_has_no_plane = true,
+ .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
+ { .func = HUBP_SET_BLANK,
+ .meta.skip_if.stream_unchanged = true,
+ .meta.skip_if.only_addresses_changed = true,
+ .meta.skip_if.pipe_deltas.current_has_no_plane = true,
+ .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
+ { .func = HUBP_UPDATE_MALL_SEL,
+ .meta.skip_if.stream_unchanged = true,
+ .meta.skip_if.only_addresses_changed = true,
+ .meta.skip_if.pipe_deltas.current_has_no_plane = true,
+ .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
+ { .func = HUBP_SET_FLIP_CONTROL_GSL,
+ .meta.skip_if.stream_unchanged = true,
+ .meta.skip_if.only_addresses_changed = true,
+ .meta.skip_if.pipe_deltas.current_has_no_plane = true,
+ .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
+ { .func = HUBP_CLK_CNTL,
+ .meta.skip_if.stream_unchanged = true,
+ .meta.skip_if.only_addresses_changed = true,
+ .meta.skip_if.pipe_deltas.current_has_no_plane = true,
+ .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
+ { .func = DPP_DPPCLK_CONTROL,
+ .meta.skip_if.stream_unchanged = true,
+ .meta.skip_if.only_addresses_changed = true,
+ .meta.skip_if.pipe_deltas.current_has_no_plane = true,
+ .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
+ { .func = DC_IP_REQUEST_STATUS,
+ .meta.skip_if.stream_unchanged = true,
+ .meta.skip_if.only_addresses_changed = true,
+ .meta.skip_if.no_ip_request = true,
+ .meta.skip_if.pipe_deltas.current_has_no_plane = true,
+ .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
+ { .func = DC_IP_REQUEST_CNTL,
+ .meta.skip_if.stream_unchanged = true,
+ .meta.skip_if.only_addresses_changed = true,
+ .meta.dc_ip_request_cntl.enable = true,
+ .meta.skip_if.no_ip_request = true,
+ .meta.skip_if.pipe_deltas.current_has_no_plane = true,
+ .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
+ { .func = HUBP_PG_CONTROL,
+ .meta.skip_if.stream_unchanged = true,
+ .meta.skip_if.only_addresses_changed = true,
+ .meta.skip_if.pipe_deltas.current_has_no_plane = true,
+ .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
+ { .func = HUBP_RESET,
+ .meta.skip_if.stream_unchanged = true,
+ .meta.skip_if.only_addresses_changed = true,
+ .meta.skip_if.pipe_deltas.current_has_no_plane = true,
+ .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
+ { .func = DPP_RESET,
+ .meta.skip_if.stream_unchanged = true,
+ .meta.skip_if.only_addresses_changed = true,
+ .meta.skip_if.pipe_deltas.current_has_no_plane = true,
+ .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
+ { .func = DC_IP_REQUEST_CNTL,
+ .meta.skip_if.stream_unchanged = true,
+ .meta.skip_if.only_addresses_changed = true,
+ .meta.dc_ip_request_cntl.enable = false,
+ .meta.skip_if.no_ip_request = true,
+ .meta.skip_if.pipe_deltas.current_has_no_plane = true,
+ .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
+};
+
+/* enable_stream_timing_calc: manual mode unless every span is even. */
+static bool dcn401_h_timing_div_manual_mode(
+ const struct dc_crtc_timing *timing)
+{
+ unsigned int h_blank_start = timing->h_total - timing->h_front_porch;
+ unsigned int h_blank_end = h_blank_start - timing->h_addressable;
+
+ return (timing->h_total % 2) || (h_blank_start % 2) ||
+ (h_blank_end % 2) || (timing->h_sync_width % 2);
+}
+
+/* dcn10_get_vupdate_offset_from_vsync for progressive timing. */
+static int dcn401_vupdate_start_line(const struct pipe_ctx *pipe)
+{
+ const struct dc_crtc_timing *timing = &pipe->stream->timing;
+ int front_porch = timing->v_front_porch ? timing->v_front_porch : 1;
+ int vesa_sync_start = timing->v_addressable + timing->v_border_bottom +
+ front_porch;
+ int asic_blank_end = timing->v_total - vesa_sync_start -
+ timing->v_border_top;
+ int start_line = asic_blank_end -
+ (int)pipe->pipe_dlg_param.vstartup_start + 1;
+
+ return start_line < 0 ? 0 : start_line;
+}
+
+/* dcn401_enable_stream_calc's early control for this lane count. */
+static uint32_t dcn401_early_cntl(const struct pipe_ctx *pipe)
+{
+ const struct dc_crtc_timing *timing = &pipe->stream->timing;
+ unsigned int lane_count =
+ pipe->stream->link->cur_link_settings.lane_count;
+ uint32_t early_cntl = 0;
+
+ if (lane_count)
+ early_cntl = (timing->h_addressable + timing->h_border_left +
+ timing->h_border_right) % lane_count;
+ return early_cntl ? early_cntl : lane_count;
+}
+
+/*
+ * dcn20_blank_pixel_data: the black of the output color space over the ODM
+ * slice of this OPP head, or the video on unblank.
+ */
+static void dcn401_opp_blank_params(const struct dc *dc,
+ struct pipe_ctx *pipe, bool unblank,
+ struct opp_set_disp_pattern_generator_params *p)
+{
+ const struct dc_crtc_timing *timing = &pipe->stream->timing;
+ struct rect slice = resource_get_odm_slice_src_rect(pipe);
+
+ p->opp = pipe->stream_res.opp;
+ p->test_pattern = unblank ? CONTROLLER_DP_TEST_PATTERN_VIDEOMODE :
+ CONTROLLER_DP_TEST_PATTERN_SOLID_COLOR;
+ p->color_space = CONTROLLER_DP_COLOR_SPACE_UDEFINED;
+ p->color_depth = timing->display_color_depth;
+ color_space_to_black_color(dc, pipe->stream->output_color_space,
+ &p->solid_color);
+ p->use_solid_color = true;
+ p->width = slice.width;
+ p->height = slice.height;
+ p->offset = slice.x;
+ p->disable_dyn_exp_for_test_pattern =
+ dc->debug.disable_dynamic_expansion_for_test_pattern;
+}
+
+/*
+ * dcn401_update_odm: one OPP per ODM slice, in slice order. A table's
+ * OPTC_SET_ODM_COMBINE programs the ODM unconditionally: N:1 combine for
+ * N > 1 slices, else bypass.
+ */
+static void dcn401_odm_combine_params(struct pipe_ctx *otg_master,
+ struct set_odm_combine_params *p)
+{
+ struct pipe_ctx *odm;
+
+ p->tg = otg_master->stream_res.tg;
+ for (odm = otg_master; odm; odm = odm->next_odm_pipe)
+ p->opp_inst[p->opp_head_count++] = odm->stream_res.opp->inst;
+ p->odm_slice_width = resource_get_odm_slice_dst_width(otg_master,
+ false);
+ p->last_odm_slice_width = resource_get_odm_slice_dst_width(otg_master,
+ true);
+}
+
+static void dcn401_dsc_config_params(struct pipe_ctx *otg_master,
+ bool enable, struct tg_set_dsc_config_params *p)
+{
+ struct dsc_optc_config optc;
+
+ p->tg = otg_master->stream_res.tg;
+ p->dsc_mode = OPTC_DSC_DISABLED;
+ if (!enable || !hwss_prepare_dsc_config_for_pipe(otg_master,
+ resource_get_odm_slice_count(otg_master), 0, &optc))
+ return;
+ p->dsc_mode = optc.is_pixel_format_444 ? OPTC_DSC_ENABLED_444 :
+ OPTC_DSC_ENABLED_NATIVE_SUBSAMPLED;
+ p->bytes_per_pixel = optc.bytes_per_pixel;
+ p->slice_width = optc.slice_width;
+}
+
+static void dcn401_program_timing_params(const struct pipe_ctx *pipe,
+ struct tg_program_timing_params *p)
+{
+ const union dml2_global_sync_programming *sync = &pipe->global_sync;
+
+ p->tg = pipe->stream_res.tg;
+ p->timing = &pipe->stream->timing;
+ p->vready_offset = sync->dcn4x.vready_offset_pixels;
+ p->vstartup_start = sync->dcn4x.vstartup_lines;
+ p->vupdate_offset = sync->dcn4x.vupdate_offset_pixels;
+ p->vupdate_width = sync->dcn4x.vupdate_vupdate_width_pixels;
+ p->pstate_keepout = sync->dcn4x.pstate_keepout_start_lines;
+ p->signal = pipe->stream->signal;
+ p->use_vbios = true;
+}
+
+static void dcn401_drr_params(const struct pipe_ctx *pipe, bool with_mid,
+ struct drr_params *drr)
+{
+ const struct dc_crtc_timing_adjust *adjust = &pipe->stream->adjust;
+
+ drr->vertical_total_min = adjust->v_total_min;
+ drr->vertical_total_max = adjust->v_total_max;
+ if (with_mid) {
+ drr->vertical_total_mid = adjust->v_total_mid;
+ drr->vertical_total_mid_frame_num =
+ adjust->v_total_mid_frame_num;
+ }
+}
+
+static void dcn401_update_clocks_params(const struct dc *dc,
+ struct dc_state *context, bool safe_to_lower,
+ struct clk_mgr_update_clocks_for_state_params *p)
+{
+ p->clk_mgr = dc->clk_mgr;
+ p->context = context;
+ p->safe_to_lower = safe_to_lower;
+ p->disallow_p_state_change = !safe_to_lower &&
+ context->bw_ctx.bw.dcn.clk.p_state_change_support;
+}
+
+/* dcn401_update_mpcc_sequence's blending for the plane. */
+static void dcn401_blnd_cfg(const struct dc_plane_state *plane,
+ struct mpcc_blnd_cfg *cfg)
+{
+ cfg->overlap_only = false;
+ cfg->global_gain = 0xff;
+ if (plane->per_pixel_alpha) {
+ cfg->pre_multiplied_alpha = plane->pre_multiplied_alpha;
+ if (plane->global_alpha) {
+ cfg->alpha_mode =
+ MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA_COMBINED_GLOBAL_GAIN;
+ cfg->global_gain = plane->global_alpha_value;
+ } else {
+ cfg->alpha_mode = MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA;
+ }
+ } else {
+ cfg->pre_multiplied_alpha = false;
+ cfg->alpha_mode = MPCC_ALPHA_BLEND_MODE_GLOBAL_ALPHA;
+ }
+ cfg->global_alpha = plane->global_alpha ?
+ plane->global_alpha_value : 0xff;
+ cfg->background_color_bpc = 4;
+ cfg->bottom_gain_mode = 0;
+ cfg->top_gain = DCN401_UNITY_GAIN;
+ cfg->bottom_inside_gain = DCN401_UNITY_GAIN;
+ cfg->bottom_outside_gain = DCN401_UNITY_GAIN;
+ if (plane->format == SURFACE_PIXEL_FORMAT_GRPH_RGBE_ALPHA)
+ cfg->pre_multiplied_alpha = false;
+}
+
+/* dcn401_set_hdr_multiplier_sequence: 1.0 unless the plane sets one. */
+static uint32_t dcn401_hdr_mult(const struct dc_plane_state *plane)
+{
+ struct custom_float_format fmt = {
+ .exponenta_bits = 6,
+ .mantissa_bits = 12,
+ .sign = true,
+ };
+ uint32_t hw_mult = DCN401_UNITY_GAIN;
+
+ if (!dc_fixpt_eq(plane->hdr_mult, dc_fixpt_from_int(0)) &&
+ !convert_to_custom_float_format(plane->hdr_mult, &fmt,
+ &hw_mult))
+ hw_mult = DCN401_UNITY_GAIN;
+ return hw_mult;
+}
+
+/* dcn401_program_mall_pipe_config_sequence for one non-phantom pipe. */
+static void dcn401_mall_sel_params(struct dc *dc, struct dc_state *state,
+ struct pipe_ctx *pipe, struct hubp_update_mall_sel_params *p)
+{
+ const struct hubp *hubp = pipe->plane_res.hubp;
+ const struct dc_plane_address *address = &pipe->plane_state->address;
+ int cursor_size = hubp->curs_attr.pitch * hubp->curs_attr.height;
+ uint32_t mall_ss_size_bytes;
+ uint32_t num_ways = 0;
+
+ switch (hubp->curs_attr.color_format) {
+ case CURSOR_MODE_MONO:
+ cursor_size /= 2;
+ break;
+ case CURSOR_MODE_COLOR_1BIT_AND:
+ case CURSOR_MODE_COLOR_PRE_MULTIPLIED_ALPHA:
+ case CURSOR_MODE_COLOR_UN_PRE_MULTIPLIED_ALPHA:
+ cursor_size *= 4;
+ break;
+ default:
+ cursor_size *= 8;
+ break;
+ }
+
+ /*
+ * dcn401_calculate_cab_allocation also adds the cursor mall bytes.
+ * This builder rejects a cursor, so those bytes are zero. The helper
+ * that computes them is built only with CONFIG_DRM_AMD_DC_FP.
+ */
+ mall_ss_size_bytes = state->bw_ctx.bw.dcn.mall_ss_size_bytes;
+ if (dc->debug.force_mall_ss_num_ways > 0)
+ num_ways = dc->debug.force_mall_ss_num_ways;
+ else if (dc->res_pool->funcs->calculate_mall_ways_from_bytes)
+ num_ways = dc->res_pool->funcs->calculate_mall_ways_from_bytes(
+ dc, mall_ss_size_bytes);
+
+ p->hubp = pipe->plane_res.hubp;
+ p->cache_cursor = cursor_size > DCN401_CACHE_CURSOR_BYTES;
+ p->mall_sel = num_ways <= dc->caps.cache_num_ways &&
+ pipe->stream->link->psr_settings.psr_version ==
+ DC_PSR_VERSION_UNSUPPORTED &&
+ address->type != PLN_ADDR_TYPE_GRPH_STEREO &&
+ !address->tmz_surface ? DCN401_MALL_SEL_SS : 0;
+}
+
+/* dcn401_set_mcm_luts clears the HUBP 3DLUT fast load with this. */
+static const struct dc_3dlut_dma dcn401_3dlut_dma_off = {0};
+
+/* dcn401_set_mcm_luts sizes the off 3DLUT by the plane's LUT. */
+static enum dc_cm_lut_size dcn401_lut_mode_size(
+ const struct dc_plane_state *plane, enum MCM_LUT_ID id)
+{
+ if (id != MCM_LUT_3DLUT)
+ return CM_LUT_SIZE_NONE;
+ return plane->cm.lut3d_func.lut_3d.use_tetrahedral_9 ?
+ CM_LUT_SIZE_999 : CM_LUT_SIZE_171717;
+}
+
+/*
+ * The divider dcn401_enable_stream_timing sets for the virtual signal. The
+ * divide by one dcn401_enable_stream passes later is a no-op, because
+ * dccg401_set_pixel_rate_div accepts only 2 and 4. The hwseq is built only
+ * with DC_FP; the builder is built without it.
+ */
+static enum pixel_rate_div dcn401_pixel_rate_div(
+ const struct pipe_ctx *pipe)
+{
+ return pipe->stream->timing.pixel_encoding == PIXEL_ENCODING_YCBCR420 ?
+ PIXEL_RATE_DIV_BY_2 : PIXEL_RATE_DIV_BY_4;
+}
+
+/* Writes one entry; build sized every sequence before adding to it. */
+static void dcn401_add_step(struct block_sequence_state *sequence,
+ const struct dcn401_commit_step_args *args,
+ const struct dcn401_commit_step *step)
+{
+ struct block_sequence *entry;
+ union block_sequence_params *p;
+ struct dc *dc = args->dc;
+ struct dcn_bw_output *bw = &args->new_state->bw_ctx.bw.dcn;
+ struct pipe_ctx *pipe;
+ struct dpp *dpp;
+ struct dc_plane_state *plane;
+ const struct dcn401_commit_step_meta *m = &step->meta;
+
+ if (*sequence->num_steps >= DC2_BLS_MAX_STEPS) {
+ if (*sequence->num_steps == DC2_BLS_MAX_STEPS &&
+ dc->debug.dc2_bls_report_step_overflow &&
+ dc->ctx && dc->ctx->logger) {
+ DC_LOG_ERROR("%s: more than %u BLS steps\n", __func__,
+ DC2_BLS_MAX_STEPS);
+ BREAK_TO_DEBUGGER();
+ }
+ (*sequence->num_steps)++;
+ return;
+ }
+ entry = &sequence->steps[(*sequence->num_steps)++];
+ p = &entry->params;
+ memset(entry, 0, sizeof(*entry));
+ entry->func = step->func;
+ /*
+ * Bandwidth and p-state steps have no pipe. Handle them before the
+ * pipe is used, then every later case can use the pipe directly.
+ */
+ if (!args->pipe) {
+ switch (step->func) {
+ case CLK_MGR_UPDATE_CLOCKS_FOR_STATE:
+ dcn401_update_clocks_params(dc, args->new_state,
+ m->clk_mgr_update_clocks_for_state
+ .safe_to_lower,
+ &p->clk_mgr_update_clocks_for_state_params);
+ return;
+ case HUBBUB_PROGRAM_WATERMARKS:
+ p->hubbub_program_watermarks_params =
+ hwss_prepare_hubbub_program_watermarks(dc,
+ dc->res_pool->hubbub, &bw->watermarks,
+ dc->res_pool->ref_clocks.dchub_ref_clock_inKhz /
+ 1000,
+ m->hubbub_program_watermarks.safe_to_lower);
+ return;
+ case HUBBUB_PROGRAM_ARBITER:
+ p->hubbub_program_arbiter_params =
+ hwss_prepare_hubbub_program_arbiter(
+ dc->res_pool->hubbub, &bw->arb_regs,
+ m->hubbub_program_arbiter.safe_to_lower);
+ return;
+ case HUBBUB_PROGRAM_COMPBUF_SEGMENTS:
+ p->hubbub_program_compbuf_segments_params.hubbub =
+ dc->res_pool->hubbub;
+ p->hubbub_program_compbuf_segments_params.compbuf_size =
+ m->hubbub_program_compbuf_segments
+ .use_current_state_size ?
+ args->current_state->bw_ctx.bw.dcn.arb_regs
+ .compbuf_size : bw->arb_regs.compbuf_size;
+ p->hubbub_program_compbuf_segments_params.safe_to_lower =
+ m->hubbub_program_compbuf_segments
+ .safe_to_lower;
+ return;
+ case HUBBUB_FORCE_PSTATE_CHANGE_CONTROL:
+ p->hubbub_force_pstate_change_control_params.hubbub =
+ dc->res_pool->hubbub;
+ p->hubbub_force_pstate_change_control_params.enable =
+ m->hubbub_force_pstate_change_control.enable;
+ return;
+ default:
+ (*sequence->num_steps)--;
+ return;
+ }
+ }
+ pipe = args->pipe;
+ dpp = pipe->plane_res.dpp;
+ plane = pipe->plane_state;
+ switch (step->func) {
+ case CLK_MGR_UPDATE_CLOCKS_FOR_STATE:
+ dcn401_update_clocks_params(dc, args->new_state,
+ m->clk_mgr_update_clocks_for_state
+ .safe_to_lower,
+ &p->clk_mgr_update_clocks_for_state_params);
+ break;
+ case HUBBUB_PROGRAM_WATERMARKS:
+ p->hubbub_program_watermarks_params =
+ hwss_prepare_hubbub_program_watermarks(dc,
+ dc->res_pool->hubbub, &bw->watermarks,
+ dc->res_pool->ref_clocks.dchub_ref_clock_inKhz /
+ 1000,
+ m->hubbub_program_watermarks.safe_to_lower);
+ break;
+ case HUBBUB_PROGRAM_ARBITER:
+ p->hubbub_program_arbiter_params =
+ hwss_prepare_hubbub_program_arbiter(
+ dc->res_pool->hubbub, &bw->arb_regs,
+ m->hubbub_program_arbiter.safe_to_lower);
+ break;
+ case HUBBUB_PROGRAM_COMPBUF_SEGMENTS:
+ p->hubbub_program_compbuf_segments_params.hubbub =
+ dc->res_pool->hubbub;
+ p->hubbub_program_compbuf_segments_params.compbuf_size =
+ m->hubbub_program_compbuf_segments
+ .use_current_state_size ?
+ args->current_state->bw_ctx.bw.dcn.arb_regs
+ .compbuf_size : bw->arb_regs.compbuf_size;
+ p->hubbub_program_compbuf_segments_params.safe_to_lower =
+ m->hubbub_program_compbuf_segments
+ .safe_to_lower;
+ break;
+ case HUBBUB_FORCE_PSTATE_CHANGE_CONTROL:
+ p->hubbub_force_pstate_change_control_params.hubbub =
+ dc->res_pool->hubbub;
+ p->hubbub_force_pstate_change_control_params.enable =
+ m->hubbub_force_pstate_change_control.enable;
+ break;
+ case BIOS_SET_SCRATCH_CRITICAL_STATE:
+ p->bios_set_scratch_critical_state_params.dcb =
+ dc->ctx->dc_bios;
+ p->bios_set_scratch_critical_state_params.state =
+ m->bios_set_scratch_critical_state.state;
+ break;
+ case TG_LOCK:
+ p->tg_lock_params.dc = dc;
+ p->tg_lock_params.tg = pipe->stream_res.tg;
+ p->tg_lock_params.lock = m->tg_lock.lock;
+ break;
+ case TG_ENABLE_CRTC:
+ p->tg_enable_crtc_params.tg = pipe->stream_res.tg;
+ break;
+ case TG_DISABLE_CRTC:
+ p->tg_disable_crtc_params.tg = pipe->stream_res.tg;
+ break;
+ case TG_WAIT_ODM_DOUBLEBUFFER_PENDING_CLEAR:
+ p->tg_wait_odm_doublebuffer_pending_clear_params.tg =
+ pipe->stream_res.tg;
+ break;
+ case TG_ENABLE_RESET_TRIGGER:
+ p->tg_enable_reset_trigger_params.tg = pipe->stream_res.tg;
+ p->tg_enable_reset_trigger_params.source_tg_inst =
+ args->timing_sync_source->stream_res.tg->inst;
+ break;
+ case TG_WAIT_FOR_RESET_TRIGGER:
+ p->tg_wait_for_reset_trigger_params.tg = pipe->stream_res.tg;
+ p->tg_wait_for_reset_trigger_params.frames =
+ DCN401_RESET_TRIGGER_WAIT_FRAMES;
+ p->tg_wait_for_reset_trigger_params.continue_on_error = true;
+ break;
+ case TG_DISABLE_RESET_TRIGGER:
+ p->tg_disable_reset_trigger_params.tg = pipe->stream_res.tg;
+ break;
+ case TG_ENABLE_OPTC_CLOCK:
+ p->tg_enable_optc_clock_params.tg = pipe->stream_res.tg;
+ p->tg_enable_optc_clock_params.enable =
+ m->tg_enable_optc_clock.enable;
+ break;
+ case TG_SET_DRR:
+ p->tg_set_drr_params.tg = pipe->stream_res.tg;
+ if (m->tg_set_drr.from_adjust)
+ dcn401_drr_params(pipe, m->tg_set_drr.with_mid,
+ &p->tg_set_drr_params.drr);
+ break;
+ case TG_SET_STATIC_SCREEN_CONTROL:
+ /* DRR is off, so no static-screen event triggers the OTG. */
+ p->tg_set_static_screen_control_params.tg = pipe->stream_res.tg;
+ p->tg_set_static_screen_control_params.num_frames =
+ DCN401_STATIC_SCREEN_NUM_FRAMES;
+ break;
+ case TG_PROGRAM_TIMING:
+ dcn401_program_timing_params(pipe,
+ &p->tg_program_timing_params);
+ break;
+ case TG_SET_H_TIMING_DIV_MANUAL_MODE:
+ p->tg_set_h_timing_div_manual_mode_params.tg =
+ pipe->stream_res.tg;
+ p->tg_set_h_timing_div_manual_mode_params.manual_mode =
+ dcn401_h_timing_div_manual_mode(
+ &pipe->stream->timing);
+ break;
+ case TG_SETUP_VERTICAL_INTERRUPT2:
+ p->tg_setup_vertical_interrupt2_params.tg = pipe->stream_res.tg;
+ p->tg_setup_vertical_interrupt2_params.start_line =
+ dcn401_vupdate_start_line(pipe);
+ break;
+ case TG_SET_OUT_MUX:
+ p->tg_set_out_mux_params.tg = pipe->stream_res.tg;
+ p->tg_set_out_mux_params.dest = OUT_MUX_DIO;
+ break;
+ case TG_SET_EARLY_CONTROL:
+ p->tg_set_early_control_params.tg = pipe->stream_res.tg;
+ p->tg_set_early_control_params.early_cntl =
+ dcn401_early_cntl(pipe);
+ break;
+ case TG_PROGRAM_STEREO:
+ p->tg_program_stereo_params.tg = pipe->stream_res.tg;
+ p->tg_program_stereo_params.timing = &pipe->stream->timing;
+ break;
+ case OPTC_SET_ODM_COMBINE:
+ if (pipe->next_odm_pipe) {
+ dcn401_odm_combine_params(pipe,
+ &p->set_odm_combine_params);
+ break;
+ }
+ entry->func = OPTC_SET_ODM_BYPASS;
+ p->set_odm_bypass_params.tg = pipe->stream_res.tg;
+ p->set_odm_bypass_params.timing = &pipe->stream->timing;
+ break;
+ case OPTC_SET_ODM_BYPASS:
+ p->set_odm_bypass_params.tg = pipe->stream_res.tg;
+ p->set_odm_bypass_params.timing = &pipe->stream->timing;
+ break;
+ case OPP_PIPE_CLOCK_CONTROL:
+ p->opp_pipe_clock_control_params.opp = pipe->stream_res.opp;
+ p->opp_pipe_clock_control_params.enable = true;
+ break;
+ case OPP_PROGRAM_LEFT_EDGE_EXTRA_PIXEL:
+ p->opp_program_left_edge_extra_pixel_params.opp =
+ pipe->stream_res.opp;
+ p->opp_program_left_edge_extra_pixel_params.pixel_encoding =
+ pipe->stream->timing.pixel_encoding;
+ p->opp_program_left_edge_extra_pixel_params.is_otg_master =
+ !pipe->prev_odm_pipe;
+ break;
+ case DCCG_SET_DTO_DSCCLK:
+ p->dccg_set_dto_dscclk_params.dccg = dc->res_pool->dccg;
+ p->dccg_set_dto_dscclk_params.inst = pipe->stream_res.dsc->inst;
+ p->dccg_set_dto_dscclk_params.num_slices_h =
+ pipe->stream->timing.dsc_cfg.num_slices_h /
+ resource_get_odm_slice_count(pipe);
+ break;
+ case DSC_SET_CONFIG:
+ if (!hwss_prepare_dsc_config_for_pipe(pipe,
+ resource_get_odm_slice_count(pipe), 0, NULL)) {
+ (*sequence->num_steps)--;
+ return;
+ }
+ p->dsc_set_config_params.dsc = pipe->stream_res.dsc;
+ break;
+ case DSC_ENABLE:
+ p->dsc_enable_params.dsc = pipe->stream_res.dsc;
+ p->dsc_enable_params.opp_inst = pipe->stream_res.opp->inst;
+ break;
+ case TG_SET_DSC_CONFIG:
+ dcn401_dsc_config_params(pipe, m->tg_set_dsc_config.enable,
+ &p->tg_set_dsc_config_params);
+ break;
+ case DSC_DISCONNECT:
+ p->dsc_disconnect_params.dsc = pipe->stream_res.dsc;
+ break;
+ case DSC_DISABLE:
+ p->dsc_disable_params.dsc = pipe->stream_res.dsc;
+ break;
+ case DCCG_SET_REF_DSCCLK:
+ p->dccg_set_ref_dscclk_params.dccg = dc->res_pool->dccg;
+ p->dccg_set_ref_dscclk_params.dsc = pipe->stream_res.dsc;
+ break;
+ case OPP_PROGRAM_FMT:
+ p->opp_program_fmt_params.opp = pipe->stream_res.opp;
+ p->opp_program_fmt_params.fmt_bit_depth =
+ &pipe->stream->bit_depth_params;
+ p->opp_program_fmt_params.clamping = &pipe->stream->clamping;
+ break;
+ case OPP_SET_DYN_EXPANSION:
+ p->opp_set_dyn_expansion_params.opp = pipe->stream_res.opp;
+ p->opp_set_dyn_expansion_params.color_space =
+ COLOR_SPACE_YCBCR601;
+ p->opp_set_dyn_expansion_params.color_depth =
+ pipe->stream->timing.display_color_depth;
+ p->opp_set_dyn_expansion_params.signal = pipe->stream->signal;
+ break;
+ case OPP_SET_DISP_PATTERN_GENERATOR:
+ dcn401_opp_blank_params(dc, pipe,
+ m->opp_set_disp_pattern_generator.unblank,
+ &p->opp_set_disp_pattern_generator_params);
+ break;
+ case OPP_WAIT_FOR_BLANK_COMPLETE:
+ p->opp_wait_for_blank_complete_params.opp =
+ pipe->stream_res.opp;
+ p->opp_wait_for_blank_complete_params.polling_interval_us =
+ DCN401_DPG_POLL_INTERVAL_US;
+ p->opp_wait_for_blank_complete_params.timeout_us =
+ DCN401_DPG_POLL_TIMEOUT_US;
+ /* DC1 ignores the result of dcn20_wait_for_blank_complete. */
+ p->opp_wait_for_blank_complete_params.continue_on_error = true;
+ break;
+ case OPP_PROGRAM_STEREO:
+ p->opp_program_stereo_params.opp = pipe->stream_res.opp;
+ p->opp_program_stereo_params.timing = &pipe->stream->timing;
+ break;
+ case DCCG_SET_DTBCLK_P_SRC:
+ p->dccg_set_dtbclk_p_src_params.dccg = dc->res_pool->dccg;
+ p->dccg_set_dtbclk_p_src_params.src =
+ m->dccg_set_dtbclk_p_src.src;
+ p->dccg_set_dtbclk_p_src_params.otg_inst =
+ pipe->stream_res.tg->inst;
+ break;
+ case DCCG_SET_PIXEL_RATE_DIV:
+ p->dccg_set_pixel_rate_div_params.dccg = dc->res_pool->dccg;
+ p->dccg_set_pixel_rate_div_params.otg_inst =
+ pipe->stream_res.tg->inst;
+ p->dccg_set_pixel_rate_div_params.k1 =
+ dcn401_pixel_rate_div(pipe);
+ p->dccg_set_pixel_rate_div_params.k2 = PIXEL_RATE_DIV_NA;
+ break;
+ case CLK_SRC_PROGRAM_PIX_CLK:
+ p->clk_src_program_pix_clk_params.clock_source =
+ pipe->clock_source;
+ p->clk_src_program_pix_clk_params.pix_clk_params =
+ &pipe->stream_res.pix_clk_params;
+ /* DC1 gives virtual a dummy 8b/10b DP link setting. */
+ p->clk_src_program_pix_clk_params.encoding = DP_8b_10b_ENCODING;
+ p->clk_src_program_pix_clk_params.pll_settings =
+ &pipe->pll_settings;
+ break;
+ case CLK_SRC_POWER_DOWN:
+ p->clk_src_power_down_params.clock_source = pipe->clock_source;
+ /* dcn401_reset_hw_ctx_wrap ignores a failed power-down. */
+ p->clk_src_power_down_params.continue_on_error = true;
+ break;
+ case DIO_LINK_ENC_CONNECT_DIG_BE_TO_FE:
+ p->link_enc_connect_dig_be_to_fe_params.link_enc =
+ pipe->stream->link->link_enc;
+ p->link_enc_connect_dig_be_to_fe_params.engine =
+ pipe->stream_res.stream_enc->id;
+ p->link_enc_connect_dig_be_to_fe_params.connect =
+ m->link_enc_connect_dig_be_to_fe.connect;
+ break;
+ case DIO_LINK_ENC_ENABLE_DP_OUTPUT:
+ p->link_enc_enable_dp_output_params.link_enc =
+ pipe->stream->link->link_enc;
+ p->link_enc_enable_dp_output_params.link_settings =
+ &pipe->link_config.dp_link_settings;
+ p->link_enc_enable_dp_output_params.clock_source =
+ pipe->clock_source->id;
+ break;
+ case DIO_LINK_ENC_DISABLE_OUTPUT:
+ p->link_enc_disable_output_params.link_enc =
+ pipe->stream->link->link_enc;
+ p->link_enc_disable_output_params.signal =
+ SIGNAL_TYPE_DISPLAY_PORT;
+ break;
+ case DCCG_ENABLE_SYMCLK_SE:
+ p->dccg_enable_symclk_se_params.dccg = dc->res_pool->dccg;
+ p->dccg_enable_symclk_se_params.stream_enc_inst =
+ pipe->stream_res.stream_enc->stream_enc_inst;
+ p->dccg_enable_symclk_se_params.link_enc_inst =
+ pipe->stream->link->link_enc->transmitter -
+ TRANSMITTER_UNIPHY_A;
+ break;
+ case DCCG_DISABLE_SYMCLK_SE:
+ p->dccg_disable_symclk_se_params.dccg = dc->res_pool->dccg;
+ p->dccg_disable_symclk_se_params.stream_enc_inst =
+ pipe->stream_res.stream_enc->stream_enc_inst;
+ p->dccg_disable_symclk_se_params.link_enc_inst =
+ pipe->stream->link->link_enc->transmitter -
+ TRANSMITTER_UNIPHY_A;
+ break;
+ case HUBP_PROGRAM_DET_SEGMENTS:
+ p->program_det_segments_params.hubbub = dc->res_pool->hubbub;
+ p->program_det_segments_params.hubp_inst =
+ pipe->plane_res.hubp->inst;
+ if (m->hubp_program_det_segments.allocate)
+ p->program_det_segments_params.det_size =
+ pipe->hubp_regs.det_size;
+ break;
+ case MPC_REMOVE_MPCC:
+ p->mpc_remove_mpcc_params.mpc = dc->res_pool->mpc;
+ p->mpc_remove_mpcc_params.mpc_tree_params =
+ &pipe->stream_res.opp->mpc_tree_params;
+ p->mpc_remove_mpcc_params.mpcc_to_remove =
+ &dc->res_pool->mpc->mpcc_array[
+ pipe->plane_res.mpcc_inst];
+ break;
+ case MPC_ASSERT_IDLE_MPCC:
+ p->mpc_assert_idle_mpcc_params.mpc = dc->res_pool->mpc;
+ p->mpc_assert_idle_mpcc_params.mpcc_id =
+ pipe->plane_res.mpcc_inst;
+ break;
+ case HUBP_SET_BLANK:
+ p->hubp_set_blank_params.hubp = pipe->plane_res.hubp;
+ p->hubp_set_blank_params.blank = !m->hubp_set_blank.unblank;
+ break;
+ case HUBP_UPDATE_MALL_SEL:
+ if (m->hubp_update_mall_sel.from_new_state)
+ dcn401_mall_sel_params(dc, args->new_state, pipe,
+ &p->hubp_update_mall_sel_params);
+ else
+ p->hubp_update_mall_sel_params.hubp =
+ pipe->plane_res.hubp;
+ break;
+ case HUBP_SET_FLIP_CONTROL_GSL:
+ p->set_flip_control_gsl_params.hubp = pipe->plane_res.hubp;
+ p->set_flip_control_gsl_params.flip_immediate =
+ plane->flip_immediate;
+ break;
+ case HUBP_CLK_CNTL:
+ p->hubp_clk_cntl_params.hubp = pipe->plane_res.hubp;
+ p->hubp_clk_cntl_params.enable = m->hubp_clk_cntl.enable;
+ break;
+ case DPP_DPPCLK_CONTROL:
+ p->dpp_dppclk_control_params.dpp = dpp;
+ p->dpp_dppclk_control_params.enable =
+ m->dpp_dppclk_control.enable;
+ break;
+ case DC_IP_REQUEST_STATUS:
+ p->dc_ip_request_status_params.hws = dc->hwseq;
+ break;
+ case DC_IP_REQUEST_CNTL:
+ p->dc_ip_request_cntl_params.hws = dc->hwseq;
+ p->dc_ip_request_cntl_params.enable =
+ m->dc_ip_request_cntl.enable;
+ break;
+ case HUBP_PG_CONTROL:
+ p->hubp_pg_control_params.hws = dc->hwseq;
+ p->hubp_pg_control_params.hubp_inst =
+ pipe->plane_res.hubp->inst;
+ p->hubp_pg_control_params.power_on =
+ m->hubp_pg_control.power_on;
+ p->hubp_pg_control_params.disable_power_gate =
+ dc->debug.disable_hubp_power_gate;
+ p->hubp_pg_control_params.ignore_pg = dc->debug.ignore_pg;
+ break;
+ case HUBP_RESET:
+ p->hubp_reset_params.hubp = pipe->plane_res.hubp;
+ break;
+ case DPP_RESET:
+ p->dpp_reset_params.dpp = dpp;
+ break;
+ case TG_WAIT_FOR_ALL_PENDING_UPDATES:
+ p->tg_wait_for_all_pending_updates_params.tg =
+ pipe->stream_res.tg;
+ p->tg_wait_for_all_pending_updates_params.include_pipe_update =
+ plane != NULL;
+ p->tg_wait_for_all_pending_updates_params.polling_interval_us =
+ DCN401_PENDING_UPDATE_POLL_INTERVAL_US;
+ p->tg_wait_for_all_pending_updates_params.timeout_us =
+ DCN401_PENDING_UPDATE_TIMEOUT_US;
+ break;
+ case HUBP_PROGRAM_TRIPLEBUFFER:
+ p->program_triplebuffer_params.hubp = pipe->plane_res.hubp;
+ p->program_triplebuffer_params.enableTripleBuffer =
+ plane->triplebuffer_flips;
+ break;
+ case DC_UDELAY:
+ p->dc_udelay_params.us = DCN401_PLANE_ENABLE_DELAY_US;
+ break;
+ case TG_PROGRAM_GLOBAL_SYNC:
+ p->tg_program_global_sync_params.tg = pipe->stream_res.tg;
+ p->tg_program_global_sync_params.vready_offset =
+ pipe->global_sync.dcn4x.vready_offset_pixels;
+ p->tg_program_global_sync_params.vstartup_lines =
+ pipe->global_sync.dcn4x.vstartup_lines;
+ p->tg_program_global_sync_params.vupdate_offset_pixels =
+ pipe->global_sync.dcn4x.vupdate_offset_pixels;
+ p->tg_program_global_sync_params.vupdate_vupdate_width_pixels =
+ pipe->global_sync.dcn4x
+ .vupdate_vupdate_width_pixels;
+ p->tg_program_global_sync_params.pstate_keepout_start_lines =
+ pipe->global_sync.dcn4x.pstate_keepout_start_lines;
+ break;
+ case TG_WAIT_FOR_STATE:
+ p->tg_wait_for_state_params.tg = pipe->stream_res.tg;
+ p->tg_wait_for_state_params.state = CRTC_STATE_VACTIVE;
+ break;
+ case TG_SET_VTG_PARAMS:
+ p->tg_set_vtg_params_params.tg = pipe->stream_res.tg;
+ p->tg_set_vtg_params_params.timing = &pipe->stream->timing;
+ p->tg_set_vtg_params_params.program_fp2 = true;
+ break;
+ case HUBP_INIT:
+ p->hubp_init_params.hubp = pipe->plane_res.hubp;
+ break;
+ case HUBBUB_FORCE_WM_PROPAGATE_TO_PIPES:
+ p->hubbub_force_wm_propagate_to_pipes_params.hubbub =
+ dc->res_pool->hubbub;
+ break;
+ case DCCG_UPDATE_DPP_DTO:
+ p->dccg_update_dpp_dto_params.dccg = dc->res_pool->dccg;
+ p->dccg_update_dpp_dto_params.dpp_inst = dpp->inst;
+ p->dccg_update_dpp_dto_params.dppclk_khz =
+ pipe->plane_res.bw.dppclk_khz;
+ break;
+ case HUBP_VTG_SEL:
+ p->hubp_vtg_sel_params.hubp = pipe->plane_res.hubp;
+ p->hubp_vtg_sel_params.otg_inst = pipe->stream_res.tg->inst;
+ break;
+ case HUBP_SETUP2:
+ p->hubp_setup2_params.hubp = pipe->plane_res.hubp;
+ p->hubp_setup2_params.hubp_regs = &pipe->hubp_regs;
+ p->hubp_setup2_params.global_sync = &pipe->global_sync;
+ p->hubp_setup2_params.timing = &pipe->stream->timing;
+ break;
+ case HUBP_SET_UNBOUNDED_REQUESTING:
+ p->hubp_set_unbounded_requesting_params.hubp = pipe->plane_res.hubp;
+ p->hubp_set_unbounded_requesting_params.unbounded_req =
+ pipe->unbounded_req;
+ break;
+ case HUBP_SETUP_INTERDEPENDENT2:
+ p->hubp_setup_interdependent2_params.hubp = pipe->plane_res.hubp;
+ p->hubp_setup_interdependent2_params.hubp_regs =
+ &pipe->hubp_regs;
+ break;
+ case DPP_SETUP_DPP:
+ p->setup_dpp_params.dpp = dpp;
+ p->setup_dpp_params.format = plane->format;
+ p->setup_dpp_params.input_csc_color_matrix =
+ plane->input_csc_color_matrix;
+ p->setup_dpp_params.color_space = plane->color_space;
+ p->setup_dpp_params.upsp_mode = resource_is_upsp_required(
+ (bool) plane->ctx->dc->caps.color.dpp.upsp_pre_scaler, plane->format, plane->scaling_linearity);
+ break;
+ case DPP_SET_CURSOR_MATRIX:
+ p->dpp_set_cursor_matrix_params.dpp = dpp;
+ p->dpp_set_cursor_matrix_params.color_space =
+ plane->color_space;
+ p->dpp_set_cursor_matrix_params.cursor_csc_color_matrix =
+ &plane->cursor_csc_color_matrix;
+ break;
+ case DPP_PROGRAM_BIAS_AND_SCALE:
+ p->program_bias_and_scale_params.dpp = dpp;
+ p->program_bias_and_scale_params.bias_and_scale =
+ plane->bias_and_scale;
+ break;
+ case MPC_INSERT_PLANE:
+ p->mpc_insert_plane_params.mpc = dc->res_pool->mpc;
+ p->mpc_insert_plane_params.mpc_tree_params =
+ &pipe->stream_res.opp->mpc_tree_params;
+ dcn401_blnd_cfg(plane, &p->mpc_insert_plane_params.blnd_cfg);
+ p->mpc_insert_plane_params.dpp_id = pipe->plane_res.hubp->inst;
+ p->mpc_insert_plane_params.mpcc_id = pipe->plane_res.hubp->inst;
+ break;
+ case MPC_UPDATE_VISUAL_CONFIRM:
+ p->update_visual_confirm_params.mpc = dc->res_pool->mpc;
+ p->update_visual_confirm_params.color =
+ &pipe->visual_confirm_color;
+ p->update_visual_confirm_params.mpcc_id = pipe->plane_res.hubp->inst;
+ break;
+ case DPP_SET_SCALER:
+ p->dpp_set_scaler_params.dpp = dpp;
+ p->dpp_set_scaler_params.scl_data = &pipe->plane_res.scl_data;
+ break;
+ case HUBP_MEM_PROGRAM_VIEWPORT:
+ p->hubp_mem_program_viewport_params.hubp = pipe->plane_res.hubp;
+ p->hubp_mem_program_viewport_params.viewport =
+ &pipe->plane_res.scl_data.viewport;
+ p->hubp_mem_program_viewport_params.viewport_c =
+ &pipe->plane_res.scl_data.viewport_c;
+ break;
+ case HUBP_PROGRAM_MCACHE_ID:
+ p->program_mcache_id_and_split_coordinate.hubp = pipe->plane_res.hubp;
+ p->program_mcache_id_and_split_coordinate.mcache_regs =
+ &pipe->mcache_regs;
+ break;
+ case MPC_SET_GAMUT_REMAP_BYPASS:
+ p->mpc_set_gamut_remap_bypass_params.mpc = dc->res_pool->mpc;
+ p->mpc_set_gamut_remap_bypass_params.mpcc_id =
+ pipe->plane_res.mpcc_inst;
+ p->mpc_set_gamut_remap_bypass_params.block_id =
+ m->mpc_set_gamut_remap_bypass.block_id;
+ break;
+ case MPC_POWER_ON_MPC_MEM_PWR:
+ p->power_on_mpc_mem_pwr_params.mpc = dc->res_pool->mpc;
+ p->power_on_mpc_mem_pwr_params.mpcc_id = pipe->plane_res.hubp->inst;
+ p->power_on_mpc_mem_pwr_params.power_on = true;
+ break;
+ case MPC_SET_OCSC_DEFAULT:
+ p->set_ocsc_default_params.mpc = dc->res_pool->mpc;
+ p->set_ocsc_default_params.opp_id = pipe->stream_res.opp->inst;
+ p->set_ocsc_default_params.color_space =
+ pipe->stream->output_color_space;
+ p->set_ocsc_default_params.ocsc_mode = MPC_OUTPUT_CSC_COEF_A;
+ break;
+ case HUBP_PROGRAM_SURFACE_CONFIG:
+ p->program_surface_config_params.hubp = pipe->plane_res.hubp;
+ p->program_surface_config_params.format = plane->format;
+ p->program_surface_config_params.tiling_info =
+ &plane->tiling_info;
+ p->program_surface_config_params.plane_size =
+ plane->plane_size;
+ p->program_surface_config_params.plane_size.surface_size =
+ pipe->plane_res.scl_data.viewport;
+ p->program_surface_config_params.rotation = plane->rotation;
+ p->program_surface_config_params.dcc = &plane->dcc;
+ p->program_surface_config_params.horizontal_mirror =
+ plane->horizontal_mirror;
+ break;
+ case HUBP_UPDATE_PLANE_ADDR:
+ p->update_plane_addr_params.hubp = pipe->plane_res.hubp;
+ p->update_plane_addr_params.address = plane->address;
+ p->update_plane_addr_params.flip_immediate =
+ plane->flip_immediate;
+ p->update_plane_addr_params.dcc = plane->dcc.enable;
+ break;
+ case DPP_SET_HDR_MULTIPLIER:
+ p->dpp_set_hdr_multiplier_params.dpp = dpp;
+ p->dpp_set_hdr_multiplier_params.hw_mult =
+ dcn401_hdr_mult(plane);
+ break;
+ case DPP_SET_PRE_DEGAM:
+ p->dpp_set_pre_degam_params.dpp = dpp;
+ p->dpp_set_pre_degam_params.in_transfer_func =
+ &plane->in_transfer_func;
+ break;
+ case DPP_PROGRAM_GAMCOR_LUT:
+ p->dpp_program_gamcor_lut_params.dpp = dpp;
+ if (plane->in_transfer_func.type == TF_TYPE_HWPWL)
+ p->dpp_program_gamcor_lut_params.params =
+ &plane->in_transfer_func.pwl;
+ break;
+ case MPC_SET_MOVABLE_CM_LOCATION:
+ p->mpc_set_movable_cm_location_params.mpc = dc->res_pool->mpc;
+ p->mpc_set_movable_cm_location_params.location =
+ MPCC_MOVABLE_CM_LOCATION_BEFORE;
+ p->mpc_set_movable_cm_location_params.mpcc_id =
+ pipe->plane_res.mpcc_inst;
+ break;
+ case MPC_PROGRAM_LUT_MODE:
+ /*
+ * Every LUT is off. DC1 reads the bank back with get_lut_mode;
+ * the build reads no hardware, so it assumes bank A for an
+ * MPCC that held no plane.
+ */
+ p->mpc_program_lut_mode_params.mpc = dc->res_pool->mpc;
+ p->mpc_program_lut_mode_params.id = m->mpc_program_lut_mode.id;
+ p->mpc_program_lut_mode_params.lut_bank_a = true;
+ p->mpc_program_lut_mode_params.size = dcn401_lut_mode_size(
+ plane, m->mpc_program_lut_mode.id);
+ p->mpc_program_lut_mode_params.mpcc_id =
+ pipe->plane_res.mpcc_inst;
+ break;
+ case HUBP_PROGRAM_3DLUT_FL_CONFIG:
+ p->hubp_program_3dlut_fl_config_params.hubp = pipe->plane_res.hubp;
+ p->hubp_program_3dlut_fl_config_params.config =
+ &dcn401_3dlut_dma_off;
+ break;
+ case HUBP_SET_3DLUT_FL:
+ p->hubp_set_3dlut_fl_params.hubp = pipe->plane_res.hubp;
+ break;
+ case MPC_SET_OUTPUT_GAMMA:
+ p->mpc_set_output_gamma_params.mpc = dc->res_pool->mpc;
+ p->mpc_set_output_gamma_params.mpcc_id =
+ pipe->plane_res.mpcc_inst;
+ if (pipe->stream->out_transfer_func.type == TF_TYPE_HWPWL)
+ p->mpc_set_output_gamma_params.params =
+ &pipe->stream->out_transfer_func.pwl;
+ break;
+ case HUBP_WAIT_FLIP_PENDING:
+ p->hubp_wait_flip_pending_params.hubp = pipe->plane_res.hubp;
+ p->hubp_wait_flip_pending_params.polling_interval_us =
+ DCN401_FLIP_PENDING_POLL_INTERVAL_US;
+ break;
+ case OPTC_PROGRAM_MANUAL_TRIGGER:
+ p->program_manual_trigger_params.tg = pipe->stream_res.tg;
+ break;
+ default:
+ /* The step tables use only the funcs above. */
+ ASSERT(false);
+ break;
+ }
+}
+
+static void dcn401_eval_pipe_deltas(const struct dcn401_commit_step_args *args,
+ unsigned int idx, struct dcn401_pipe_deltas *deltas)
+{
+ const struct dc_state_pipe_flags *cur_f =
+ &args->update_flags->cur_pipes[idx];
+ const struct dc_state_pipe_flags *new_f =
+ &args->update_flags->new_pipes[idx];
+ const struct pipe_ctx *cur = &args->current_state->res_ctx.pipe_ctx[idx];
+ const struct pipe_ctx *new = &args->new_state->res_ctx.pipe_ctx[idx];
+
+ deltas->hubp_dpp_already_enabled = cur_f->enabled && new_f->enabled &&
+ cur->stream->stream_id == new->stream->stream_id &&
+ cur->plane_res.hubp->inst == new->plane_res.hubp->inst &&
+ cur->plane_res.dpp->inst == new->plane_res.dpp->inst &&
+ cur->stream_res.opp->inst == new->stream_res.opp->inst;
+ deltas->det_unchanged = cur_f->det_size == new_f->det_size;
+ deltas->current_has_no_plane = !cur_f->has_plane;
+ deltas->odm_kept = new->stream && dcn401_same_opp_heads(
+ args->current_state, args->new_state, new->stream);
+}
+
+static bool dcn401_pipe_deltas_match(const struct dcn401_pipe_deltas *skip,
+ const struct dcn401_pipe_deltas *deltas, bool all)
+{
+ const bool named[] = { skip->hubp_dpp_already_enabled,
+ skip->det_unchanged, skip->current_has_no_plane,
+ skip->odm_kept };
+ const bool set[] = { deltas->hubp_dpp_already_enabled,
+ deltas->det_unchanged, deltas->current_has_no_plane,
+ deltas->odm_kept };
+ bool any = false;
+ unsigned int i;
+
+ for (i = 0; i < ARRAY_SIZE(named); i++) {
+ if (!named[i])
+ continue;
+ if (all && !set[i])
+ return false;
+ any |= set[i];
+ }
+ return any;
+}
+
+static bool dcn401_skip_step(const struct dcn401_commit_step_args *args,
+ const struct dcn401_commit_step *step)
+{
+ const struct dcn401_pipe_deltas *skip = &step->meta.skip_if.pipe_deltas;
+ struct dcn401_pipe_deltas deltas;
+ const struct pipe_ctx *cur, *new;
+
+ if (step->meta.skip_if.only_addresses_changed &&
+ !args->hardware_remapped && !args->pipe_configs_changed)
+ return true;
+ if (step->meta.only_if.hardware_not_remapped && args->hardware_remapped)
+ return true;
+ if (step->meta.only_if.pipe_configs_not_changed &&
+ args->pipe_configs_changed)
+ return true;
+ if (step->meta.skip_if.new_state_has_stream &&
+ args->new_state->stream_count)
+ return true;
+ if (step->meta.skip_if.stream_unchanged && args->stream_unchanged)
+ return true;
+ if (step->meta.skip_if.optimized_not_required &&
+ !args->dc->optimized_required)
+ return true;
+ if (step->meta.skip_if.no_ip_request &&
+ (!args->dc->hwseq->funcs.pg_needs_ip_request ||
+ !args->dc->hwseq->funcs.pg_needs_ip_request(args->dc)))
+ return true;
+ /* The remaining conditions are for per-pipe steps. */
+ if (!args->pipe)
+ return false;
+ cur = &args->current_state->res_ctx.pipe_ctx[args->pipe->pipe_idx];
+ new = &args->new_state->res_ctx.pipe_ctx[args->pipe->pipe_idx];
+ dcn401_eval_pipe_deltas(args, args->pipe->pipe_idx, &deltas);
+ if (step->meta.skip_if.no_addr_update &&
+ !args->update_flags->new_pipes[args->pipe->pipe_idx]
+ .plane.addr_update)
+ return true;
+ if (step->meta.skip_if.no_manual_trigger &&
+ (!args->pipe->plane_state->update_bits.addr_update ||
+ args->pipe->plane_state->skip_manual_trigger))
+ return true;
+ if (step->meta.skip_if.opp_tree_empty &&
+ (!args->pipe->stream_res.opp ||
+ !args->pipe->stream_res.opp->mpc_tree_params.opp_list))
+ return true;
+ if (step->meta.skip_if.no_dsc && !args->pipe->stream_res.dsc)
+ return true;
+ if (step->meta.skip_if.no_timing_sync_source &&
+ !args->timing_sync_source)
+ return true;
+ if (dcn401_pipe_deltas_match(skip, &deltas,
+ step->meta.skip_if.pipe_deltas_all))
+ return true;
+ if (step->meta.skip_if.scaling_unchanged &&
+ !args->pipe->plane_state->update_bits.scaling_change &&
+ !args->pipe->plane_state->update_bits.position_change &&
+ !args->pipe->stream->update_flags.bits.scaling &&
+ (!deltas.hubp_dpp_already_enabled ||
+ !memcmp(&cur->plane_res.scl_data, &new->plane_res.scl_data,
+ sizeof(cur->plane_res.scl_data))))
+ return true;
+ return false;
+}
+
+static void dcn401_add_steps(struct block_sequence_state *sequence,
+ const struct dcn401_commit_step_args *args,
+ const struct dcn401_commit_step *steps, unsigned int count)
+{
+ unsigned int i;
+
+ for (i = 0; i < count; i++) {
+ if (!dcn401_skip_step(args, &steps[i]))
+ dcn401_add_step(sequence, args, &steps[i]);
+ }
+}
+
+static bool dcn401_walks_stream(const struct dcn401_commit_step_args *args,
+ const struct dc_stream_state *stream)
+{
+ if (args->stream)
+ return stream->stream_id == args->stream->stream_id;
+ return !dcn401_stream_kept(args->dc, args->current_state,
+ args->new_state, stream);
+}
+
+/*
+ * The OTG master that pipe resets to, chosen as program_timing_sync does:
+ * the first OTG master with the same timing that shows a plane, else the
+ * first one. NULL when that is pipe.
+ */
+static const struct pipe_ctx *dcn401_timing_sync_source(
+ const struct dcn401_commit_step_args *args,
+ const struct pipe_ctx *pipe)
+{
+ const struct dc_state_update_flags *flags = args->update_flags;
+ const struct pipe_ctx *source = NULL;
+ const struct pipe_ctx *member;
+ unsigned int i;
+
+ if (args->dc->debug.disable_timing_sync)
+ return NULL;
+ for (i = 0; i < args->dc->res_pool->pipe_count; i++) {
+ member = &args->new_state->res_ctx.pipe_ctx[i];
+ if (!member->stream || member->top_pipe ||
+ member->prev_odm_pipe ||
+ !resource_are_streams_timing_synchronizable(
+ member->stream, pipe->stream))
+ continue;
+ if (flags->cur_pipes[i].has_plane &&
+ flags->new_pipes[i].has_plane) {
+ source = member;
+ break;
+ }
+ if (!source)
+ source = member;
+ }
+ if (!source || source->pipe_idx == pipe->pipe_idx)
+ return NULL;
+ return source;
+}
+
+static void dcn401_add_per_otg_master(struct block_sequence_state *sequence,
+ const struct dcn401_commit_step_args *state_args,
+ struct dc_state *state,
+ const struct dcn401_commit_step *steps, unsigned int count)
+{
+ struct dcn401_commit_step_args args = *state_args;
+ unsigned int i;
+
+ for (i = 0; i < state->stream_count; i++) {
+ if (!dcn401_walks_stream(&args, state->streams[i]))
+ continue;
+ args.pipe = resource_get_otg_master_for_stream(
+ &state->res_ctx, state->streams[i]);
+ if (!args.pipe)
+ continue;
+ args.timing_sync_source = dcn401_timing_sync_source(&args,
+ args.pipe);
+ dcn401_add_steps(sequence, &args, steps, count);
+ }
+}
+
+static void dcn401_add_per_opp_head(struct block_sequence_state *sequence,
+ const struct dcn401_commit_step_args *state_args,
+ struct dc_state *state,
+ const struct dcn401_commit_step *steps, unsigned int count)
+{
+ struct dcn401_commit_step_args args = *state_args;
+ struct pipe_ctx *opp_heads[MAX_PIPES];
+ unsigned int i;
+ int j, n;
+
+ for (i = 0; i < state->stream_count; i++) {
+ if (!dcn401_walks_stream(&args, state->streams[i]))
+ continue;
+ n = resource_get_opp_heads_for_stream(state->streams[i],
+ &state->res_ctx, opp_heads);
+ for (j = 0; j < n; j++) {
+ args.pipe = opp_heads[j];
+ dcn401_add_steps(sequence, &args, steps, count);
+ }
+ }
+}
+
+static void dcn401_add_per_dpp_pipe(struct block_sequence_state *sequence,
+ const struct dcn401_commit_step_args *state_args,
+ struct dc_state *state, const struct dcn401_sub_sequence *sub)
+{
+ struct dcn401_commit_step_args args = *state_args;
+ struct pipe_ctx *dpp_pipes[MAX_PIPES];
+ unsigned int i, k;
+ int j, n;
+
+ for (i = 0; i < state->stream_count; i++) {
+ if (!dcn401_walks_stream(&args, state->streams[i]))
+ continue;
+ n = resource_get_dpp_pipes_for_stream(state->streams[i],
+ &state->res_ctx, dpp_pipes);
+ for (j = 0; j < n; j++) {
+ args.pipe = dpp_pipes[j];
+ if (!sub->stages) {
+ dcn401_add_steps(sequence, &args, sub->steps,
+ sub->count);
+ continue;
+ }
+ for (k = 0; k < sub->stage_count; k++)
+ dcn401_add_steps(sequence, &args,
+ sub->stages[k].steps,
+ sub->stages[k].count);
+ }
+ }
+}
+
+void dcn401_add_sub_sequences(struct block_sequence_state *sequence,
+ const struct dcn401_commit_step_args *state_args,
+ const struct dcn401_sub_sequence *subs, unsigned int count)
+{
+ const struct dcn401_sub_sequence *sub;
+ struct dc_state *state;
+ unsigned int i;
+
+ for (i = 0; i < count; i++) {
+ sub = &subs[i];
+ state = sub->flags & DCN401_CURRENT_STATE ?
+ state_args->current_state :
+ state_args->new_state;
+ if (sub->flags & DCN401_PER_STREAM_PER_OTG_MASTER)
+ dcn401_add_per_otg_master(sequence, state_args, state,
+ sub->steps, sub->count);
+ else if (sub->flags & DCN401_PER_STREAM_PER_OPP_HEAD)
+ dcn401_add_per_opp_head(sequence, state_args, state,
+ sub->steps, sub->count);
+ else if (sub->flags & DCN401_PER_STREAM_PER_DPP_PIPE)
+ dcn401_add_per_dpp_pipe(sequence, state_args, state, sub);
+ else
+ dcn401_add_steps(sequence, state_args, sub->steps,
+ sub->count);
+ }
+}
+
+void dcn401_init_and_unpack_params(
+ struct bls_builder_declarative_params *params,
+ struct dcn401_commit_step_args *state_args,
+ struct block_sequence_state *head)
+{
+ state_args->dc = params->dc;
+ state_args->current_state = (struct dc_state *)params->current_state;
+ state_args->new_state = (struct dc_state *)params->new_state;
+ state_args->stream = NULL;
+ state_args->pipe = NULL;
+ state_args->update_flags = params->update_flags;
+ state_args->stream_unchanged = false;
+ state_args->hardware_remapped = true;
+ state_args->pipe_configs_changed = true;
+ state_args->timing_sync_source = NULL;
+
+ params->head_num_steps = 0;
+ params->tail_num_steps = 0;
+ head->steps = params->head_sequence;
+ head->num_steps = ¶ms->head_num_steps;
+}
diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_builder_internal.h b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_builder_internal.h
index d48330fcc64d..7231fb3ad3fb 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_builder_internal.h
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_builder_internal.h
@@ -83,6 +83,12 @@ const struct pipe_ctx *dcn401_otg_master(const struct dc_state *state,
/* The index of stream in state, or -1. */
int dcn401_stream_index(const struct dc_state *state,
const struct dc_stream_state *stream);
+bool dcn401_pipe_on_stream(const struct pipe_ctx *pipe,
+ const struct dc_stream_state *stream);
+/* stream has the same OPP heads in both states. */
+bool dcn401_same_opp_heads(const struct dc_state *current_state,
+ const struct dc_state *new_state,
+ const struct dc_stream_state *stream);
/*
diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
index 9ad9081b1b9a..00b25ec4f57a 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
@@ -21,10 +21,6 @@
#include "bls_builder/dcn401_builder_internal.h"
#include "state_facts/state_facts.h"
-#undef DC_LOGGER
-#define DC_LOGGER \
- dc->ctx->logger
-
/*
* DCN_DECL_SEAMLESS_UPDATE for one of the virtual streams that
* DCN_DECL_NON_SEAMLESS_COMMIT (dcn401_non_seamless_builder.c) enabled.
@@ -43,475 +39,10 @@
* stream changes, the update is a flip: it locks the pipe, programs the
* address and unlocks, with no DMUB command and no DMUB lock.
*
- * This file also holds what both builders share: the dc and stream
- * support checks, and the step walkers that turn a table into BLS entries.
- *
* Neither builder emits a tail_sequence. A tail runs only after a vsync,
* and Core has no wait-for-vsync imperative yet, so Core rejects a tail.
*/
-#define DCN401_DPG_POLL_INTERVAL_US 100
-#define DCN401_DPG_POLL_TIMEOUT_US 100000
-#define DCN401_STATIC_SCREEN_NUM_FRAMES 2
-#define DCN401_PENDING_UPDATE_POLL_INTERVAL_US 1
-#define DCN401_PENDING_UPDATE_TIMEOUT_US 100000
-#define DCN401_RESET_TRIGGER_WAIT_FRAMES 10
-#define DCN401_FLIP_PENDING_POLL_INTERVAL_US 100
-#define DCN401_PLANE_ENABLE_DELAY_US 500
-/* 1.0 in the HDR multiplier and MPCC gain format. */
-#define DCN401_UNITY_GAIN 0x1f000
-#define DCN401_MALL_SEL_SS 2
-#define DCN401_CACHE_CURSOR_BYTES 16384
-
-void dcn401_commit_check_failed(const struct dc *dc, const char *msg)
-{
- if (dc && dc->ctx && dc->ctx->logger)
- DC_LOG_DEBUG("%s\n", msg);
-}
-
-static bool check_dc_resources(const struct dc *dc,
- const struct dc_state *current_state,
- const struct dc_state *new_state)
-{
- (void)current_state;
- (void)new_state;
- return dc->res_pool && dc->res_pool->hubbub && dc->res_pool->dccg &&
- dc->res_pool->mpc && dc->hwseq && dc->clk_mgr &&
- dc->ctx && dc->ctx->dc_bios;
-}
-
-static bool check_fams2_debug(const struct dc *dc,
- const struct dc_state *current_state,
- const struct dc_state *new_state)
-{
- (void)current_state;
- (void)new_state;
- return !dc->debug.fams2_config.bits.enable;
-}
-
-static bool check_cursor_offload(const struct dc *dc,
- const struct dc_state *current_state,
- const struct dc_state *new_state)
-{
- (void)current_state;
- (void)new_state;
- return !dc->ctx->dmub_srv || !dc->ctx->dmub_srv->cursor_offload_enabled;
-}
-
-static bool check_dc_mode_softmax(const struct dc *dc,
- const struct dc_state *current_state,
- const struct dc_state *new_state)
-{
- (void)current_state;
- (void)new_state;
- return !dc->clk_mgr->dc_mode_softmax_enabled;
-}
-
-static bool check_visual_confirm(const struct dc *dc,
- const struct dc_state *current_state,
- const struct dc_state *new_state)
-{
- (void)current_state;
- (void)new_state;
- return dc->debug.visual_confirm == VISUAL_CONFIRM_DISABLE &&
- !dc->debug.force_dpg_on_flip &&
- !dc->debug.enable_hblank_borrow &&
- !dc->debug.enable_otg_frame_sync_pwa;
-}
-
-/* With the DSC power gate disabled, update_dsc_pg only reads. */
-static bool check_dsc_power_gate(const struct dc *dc,
- const struct dc_state *current_state,
- const struct dc_state *new_state)
-{
- (void)current_state;
- (void)new_state;
- return dc->debug.disable_dsc_power_gate;
-}
-
-enum bls_builder_result dcn401_check_dc_support(const struct dc *dc)
-{
- const struct dc_state *current_state = NULL;
- const struct dc_state *new_state = NULL;
-
- CHECK_RESOURCE(dc_resources, "dc resources are missing");
- CHECK_CONDITION(fams2_debug, "FAMS2 debug is enabled");
- CHECK_CONDITION(cursor_offload, "cursor offload is enabled");
- CHECK_CONDITION(dc_mode_softmax, "dc mode softmax is enabled");
- CHECK_CONDITION(visual_confirm,
- "visual confirm, dpg, hblank borrow, or frame sync is set");
- CHECK_CONDITION(dsc_power_gate, "DSC power gate is enabled");
- return BLS_BUILD_SUCCESS;
-}
-
-static bool check_no_phantom(const struct dc *dc,
- const struct dc_state *current_state,
- const struct dc_state *new_state)
-{
- (void)dc;
- return !dcn401_checked_state(current_state,
- new_state)->phantom_stream_count;
-}
-
-static bool check_fams2_state(const struct dc *dc,
- const struct dc_state *current_state,
- const struct dc_state *new_state)
-{
- const struct dc_state *state = dcn401_checked_state(current_state,
- new_state);
-
- (void)dc;
- return !state->bw_ctx.bw.dcn.fams2_global_config.features.bits.enable;
-}
-
-static bool check_stream_link(const struct dc *dc,
- const struct dc_state *state, unsigned int i)
-{
- (void)dc;
- return state->streams[i] && state->streams[i]->link;
-}
-
-/* link_set_dpms_on and _off program nothing for a virtual signal. */
-static bool check_virtual_signal(const struct dc *dc,
- const struct dc_state *state, unsigned int i)
-{
- (void)dc;
- (void)state;
- (void)i;
- return false;
-}
-
-static bool check_link_encoder(const struct dc *dc,
- const struct dc_state *state, unsigned int i)
-{
- const struct dc_link *link = state->streams[i]->link;
-
- (void)dc;
- return link->ep_type == DISPLAY_ENDPOINT_PHY && link->link_enc;
-}
-
-static bool check_no_interlace(const struct dc *dc,
- const struct dc_state *state, unsigned int i)
-{
- (void)dc;
- return !state->streams[i]->timing.flags.INTERLACE;
-}
-
-static bool check_no_stereo(const struct dc *dc,
- const struct dc_state *state, unsigned int i)
-{
- (void)dc;
- return state->streams[i]->timing.timing_3d_format ==
- TIMING_3D_FORMAT_NONE;
-}
-
-static bool check_no_drr(const struct dc *dc,
- const struct dc_state *state, unsigned int i)
-{
- const struct dc_stream_state *stream = state->streams[i];
-
- (void)dc;
- return !stream->ignore_msa_timing_param &&
- !stream->adjust.v_total_min &&
- !stream->adjust.v_total_max;
-}
-
-static bool check_no_boot_dpms_writeback(const struct dc *dc,
- const struct dc_state *state, unsigned int i)
-{
- const struct dc_stream_state *stream = state->streams[i];
-
- (void)dc;
- return !stream->apply_seamless_boot_optimization && !stream->dpms_off &&
- !stream->num_wb_info;
-}
-
-static bool check_abm(const struct dc *dc,
- const struct dc_state *state, unsigned int i)
-{
- const struct dc_stream_state *stream = state->streams[i];
-
- (void)dc;
- return !stream->abm_level ||
- stream->abm_level == ABM_LEVEL_IMMEDIATE_DISABLE;
-}
-
-/*
- * An MPC bottom pipe or an ODM slice of the stream is not an OTG master;
- * check_mpc_blend and check_odm_combine bound them.
- */
-const struct pipe_ctx *dcn401_otg_master(const struct dc_state *state,
- const struct dc_stream_state *stream)
-{
- const struct pipe_ctx *otg_master = NULL;
- unsigned int i;
-
- for (i = 0; i < MAX_PIPES; i++) {
- const struct pipe_ctx *pipe = &state->res_ctx.pipe_ctx[i];
-
- if (!stream || !pipe->stream ||
- pipe->stream->stream_id != stream->stream_id ||
- pipe->top_pipe || pipe->prev_odm_pipe)
- continue;
- if (otg_master)
- return NULL;
- otg_master = pipe;
- }
- return otg_master;
-}
-
-int dcn401_stream_index(const struct dc_state *state,
- const struct dc_stream_state *stream)
-{
- int i;
-
- if (!stream)
- return -1;
- for (i = 0; i < state->stream_count; i++)
- if (state->streams[i]->stream_id == stream->stream_id)
- return i;
- return -1;
-}
-
-#define DCN401_SAME_INST(a, b) \
- ((!(a) && !(b)) || ((a) && (b) && (a)->inst == (b)->inst))
-
-static bool dcn401_pipe_on_stream(const struct pipe_ctx *pipe,
- const struct dc_stream_state *stream)
-{
- return pipe->stream && pipe->stream->stream_id == stream->stream_id;
-}
-
-/* The plane is compared as an object: planes have no DC-assigned id yet. */
-static bool dcn401_pipe_layout_unchanged(const struct pipe_ctx *cur,
- const struct pipe_ctx *new)
-{
- return cur->plane_state == new->plane_state &&
- DCN401_SAME_INST(cur->plane_res.hubp, new->plane_res.hubp) &&
- DCN401_SAME_INST(cur->plane_res.dpp, new->plane_res.dpp) &&
- DCN401_SAME_INST(cur->stream_res.tg, new->stream_res.tg) &&
- DCN401_SAME_INST(cur->stream_res.opp, new->stream_res.opp) &&
- !cur->top_pipe == !new->top_pipe &&
- !cur->bottom_pipe == !new->bottom_pipe &&
- !cur->prev_odm_pipe == !new->prev_odm_pipe &&
- !cur->next_odm_pipe == !new->next_odm_pipe;
-}
-
-bool dcn401_stream_unchanged(const struct dc_state *current_state,
- const struct dc_state *new_state,
- const struct dc_stream_state *stream)
-{
- const struct pipe_ctx *cur, *new;
- unsigned int i;
-
- if (dcn401_stream_index(current_state, stream) < 0 ||
- dcn401_stream_index(new_state, stream) < 0)
- return false;
- for (i = 0; i < MAX_PIPES; i++) {
- cur = ¤t_state->res_ctx.pipe_ctx[i];
- new = &new_state->res_ctx.pipe_ctx[i];
- if (dcn401_pipe_on_stream(cur, stream) !=
- dcn401_pipe_on_stream(new, stream))
- return false;
- if (dcn401_pipe_on_stream(new, stream) &&
- !dcn401_pipe_layout_unchanged(cur, new))
- return false;
- }
- return true;
-}
-
-static bool check_otg_master_present(const struct dc *dc,
- const struct dc_state *state, unsigned int i)
-{
- (void)dc;
- return dcn401_otg_master(state, state->streams[i]) != NULL;
-}
-
-/* At most DCN401_MAX_OPP_HEADS ODM slices, each with an OPP. */
-static bool check_odm_combine(const struct dc *dc,
- const struct dc_state *state, unsigned int i)
-{
- const struct pipe_ctx *odm = dcn401_otg_master(state,
- state->streams[i]);
- unsigned int count = 0;
-
- (void)dc;
- for (; odm; odm = odm->next_odm_pipe)
- if (!odm->stream_res.opp || ++count > DCN401_MAX_OPP_HEADS)
- return false;
- return count;
-}
-
-static bool check_mpc_blend(const struct dc *dc,
- const struct dc_state *state, unsigned int i)
-{
- struct dc_state_facts facts;
-
- (void)dc;
- dc_state_facts_derive(state, &facts);
- /*
- * At most one bottom pipe, on the master's OTG and OPP. A bottom pipe
- * and ODM do not go together.
- */
- return facts.global.blend_tree[i].dpp_pipe_count <= 2 &&
- facts.global.blend_tree[i].on_otg_master_blocks &&
- (facts.global.blend_tree[i].dpp_pipe_count == 1 ||
- !dc_state_facts_any_pipe(&facts, (uint8_t)i,
- DC_TRAIT_MATCH(DC_PIPE_TRAIT_ODM, 0)));
-}
-
-static bool check_otg_master_blocks(const struct dc *dc,
- const struct dc_state *state, unsigned int i)
-{
- const struct pipe_ctx *pipe = dcn401_otg_master(state,
- state->streams[i]);
-
- (void)dc;
- return pipe && pipe->stream_res.tg && pipe->stream_res.opp &&
- pipe->stream_res.stream_enc && pipe->clock_source;
-}
-
-static bool check_pipe_audio(const struct dc *dc,
- const struct dc_state *state, unsigned int i)
-{
- const struct pipe_ctx *pipe = dcn401_otg_master(state,
- state->streams[i]);
-
- (void)dc;
- return pipe && !pipe->stream_res.audio;
-}
-
-static bool check_pipe_dsc(const struct dc *dc,
- const struct dc_state *state, unsigned int i)
-{
- const struct dc_stream_state *stream = state->streams[i];
- struct pipe_ctx *opp_heads[MAX_PIPES];
- int j, n;
-
- (void)dc;
- n = resource_get_opp_heads_for_stream(stream,
- (struct resource_context *)&state->res_ctx, opp_heads);
- for (j = 0; j < n; j++)
- if (!opp_heads[j]->stream_res.dsc != !stream->timing.flags.DSC)
- return false;
- return true;
-}
-
-static bool check_dsc_pixel_clock(const struct dc *dc,
- const struct dc_state *state, unsigned int i)
-{
- const struct dc_crtc_timing *timing = &state->streams[i]->timing;
-
- (void)dc;
- return !timing->flags.DSC || timing->pix_clk_100hz > 480000;
-}
-
-static bool check_pipe_gsl(const struct dc *dc,
- const struct dc_state *state, unsigned int i)
-{
- const struct pipe_ctx *pipe = dcn401_otg_master(state,
- state->streams[i]);
-
- (void)dc;
- return pipe && !pipe->stream_res.gsl_group;
-}
-
-static bool check_link_enc_assignment(const struct dc *dc,
- const struct dc_state *state, unsigned int i)
-{
- const struct pipe_ctx *pipe = dcn401_otg_master(state,
- state->streams[i]);
-
- if (!dc->config.unify_link_enc_assignment)
- return true;
- return pipe && pipe->link_res.dio_link_enc ==
- pipe->stream->link->link_enc;
-}
-
-/* Each stream on its own link. */
-static bool check_own_link(const struct dc *dc,
- const struct dc_state *state, unsigned int i)
-{
- unsigned int j;
-
- (void)dc;
- for (j = 0; j < i; j++)
- if (state->streams[j]->link == state->streams[i]->link)
- return false;
- return true;
-}
-
-static enum bls_builder_result dcn401_check_one_stream(const struct dc *dc,
- const struct dc_state *state, unsigned int i)
-{
- CHECK_STREAM_RESOURCE(stream_link, "stream has no link");
- CHECK_STREAM_CONDITION(own_link, "streams share a link");
- CHECK_STREAM_CONDITION(virtual_signal, "signal is not virtual");
- CHECK_STREAM_RESOURCE(link_encoder, "link encoder is not DIO");
- CHECK_STREAM_CONDITION(no_interlace, "timing is interlace");
- CHECK_STREAM_CONDITION(no_stereo, "timing is stereo");
- CHECK_STREAM_CONDITION(dsc_pixel_clock,
- "dsc pixel clock is 48 MHz or less");
- CHECK_STREAM_CONDITION(no_drr, "DRR is set");
- CHECK_STREAM_CONDITION(no_boot_dpms_writeback,
- "seamless boot, dpms, or writeback is set");
- CHECK_STREAM_CONDITION(abm, "ABM level is set");
- CHECK_STREAM_RESOURCE(otg_master_present,
- "stream has no otg master, or more than one");
- CHECK_STREAM_CONDITION(odm_combine, "odm is not bypass, 2:1 or 3:1");
- CHECK_STREAM_CONDITION(mpc_blend,
- "more than one bottom pipe, off the otg or opp, or with odm");
- CHECK_STREAM_RESOURCE(otg_master_blocks,
- "otg master is missing a stream resource or pixel clock");
- CHECK_STREAM_CONDITION(pipe_audio, "audio is set");
- CHECK_STREAM_RESOURCE(pipe_dsc,
- "dsc differs from the timing on an opp head");
- CHECK_STREAM_CONDITION(pipe_gsl, "gsl is set");
- CHECK_STREAM_CONDITION(link_enc_assignment,
- "link encoder assignment differs");
- return BLS_BUILD_SUCCESS;
-}
-
-/* Every pipe with a stream belongs to a stream of the state. */
-static bool check_pipe_streams(const struct dc *dc,
- const struct dc_state *current_state,
- const struct dc_state *new_state)
-{
- const struct dc_state *state = dcn401_checked_state(current_state,
- new_state);
- unsigned int i;
-
- (void)dc;
- for (i = 0; i < MAX_PIPES; i++)
- if (state->res_ctx.pipe_ctx[i].stream &&
- dcn401_stream_index(state,
- state->res_ctx.pipe_ctx[i].stream) < 0)
- return false;
- return true;
-}
-
-enum bls_builder_result dcn401_check_stream_support(const struct dc *dc,
- const struct dc_state *current_state,
- const struct dc_state *new_state)
-{
- const struct dc_state *state = dcn401_checked_state(current_state,
- new_state);
- enum bls_builder_result result;
- unsigned int i;
-
- if (!state)
- return BLS_BUILD_ERROR_UNSUPPORTED_STATE_UPDATE;
- CHECK_CONDITION(no_phantom, "a phantom stream is set");
- CHECK_CONDITION(fams2_state, "fams2 is enabled");
- CHECK_CONDITION(pipe_streams, "a pipe has a stream the state lacks");
- for (i = 0; i < state->stream_count; i++) {
- result = dcn401_check_one_stream(dc, state, i);
- if (result != BLS_BUILD_SUCCESS)
- return result;
- }
- return BLS_BUILD_SUCCESS;
-}
-
/*
* The update keeps every stream. A stream other than the updated one keeps
* its pipes, planes and blocks.
@@ -933,33 +464,6 @@ static bool check_no_cursor(const struct dc *dc,
return !new_state->streams[i]->cursor_attributes.address.quad_part;
}
-static bool dcn401_same_opp_heads(const struct dc_state *current_state,
- const struct dc_state *new_state,
- const struct dc_stream_state *stream)
-{
- const struct pipe_ctx *cur = dcn401_otg_master(current_state, stream);
- const struct pipe_ctx *new = dcn401_otg_master(new_state, stream);
- struct pipe_ctx *cur_heads[MAX_PIPES], *new_heads[MAX_PIPES];
- int i, n;
-
- if (!cur || !new)
- return false;
- n = resource_get_opp_heads_for_otg_master(cur,
- (struct resource_context *)¤t_state->res_ctx,
- cur_heads);
- if (n != resource_get_opp_heads_for_otg_master(new,
- (struct resource_context *)&new_state->res_ctx,
- new_heads))
- return false;
- for (i = 0; i < n; i++)
- if (!cur_heads[i]->stream_res.opp ||
- !new_heads[i]->stream_res.opp ||
- cur_heads[i]->stream_res.opp->inst !=
- new_heads[i]->stream_res.opp->inst)
- return false;
- return true;
-}
-
static bool check_dsc_odm_kept(const struct dc *dc,
const struct dc_state *current_state,
const struct dc_state *new_state, unsigned int i)
@@ -1452,92 +956,6 @@ static const struct dcn401_commit_step optc_dsc[] = {
.meta.skip_if.pipe_deltas_all = true },
};
-/*
- * Under the lock, each current pipe that the update removes leaves its
- * MPCC and returns its DET segments, as DC1 disconnects a disabled pipe.
- */
-const struct dcn401_commit_step dcn401_disconnect[DCN401_DISCONNECT_STEPS] = {
- { .func = HUBP_PROGRAM_DET_SEGMENTS,
- .meta.skip_if.stream_unchanged = true,
- .meta.skip_if.only_addresses_changed = true,
- .meta.skip_if.pipe_deltas.current_has_no_plane = true,
- .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
- { .func = MPC_REMOVE_MPCC,
- .meta.skip_if.stream_unchanged = true,
- .meta.skip_if.only_addresses_changed = true,
- .meta.skip_if.pipe_deltas.current_has_no_plane = true,
- .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
-};
-
-/* After the unlock, disable_plane on each removed pipe. */
-const struct dcn401_commit_step dcn401_power_down[DCN401_POWER_DOWN_STEPS] = {
- { .func = MPC_ASSERT_IDLE_MPCC,
- .meta.skip_if.stream_unchanged = true,
- .meta.skip_if.only_addresses_changed = true,
- .meta.skip_if.pipe_deltas.current_has_no_plane = true,
- .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
- { .func = HUBP_SET_BLANK,
- .meta.skip_if.stream_unchanged = true,
- .meta.skip_if.only_addresses_changed = true,
- .meta.skip_if.pipe_deltas.current_has_no_plane = true,
- .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
- { .func = HUBP_UPDATE_MALL_SEL,
- .meta.skip_if.stream_unchanged = true,
- .meta.skip_if.only_addresses_changed = true,
- .meta.skip_if.pipe_deltas.current_has_no_plane = true,
- .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
- { .func = HUBP_SET_FLIP_CONTROL_GSL,
- .meta.skip_if.stream_unchanged = true,
- .meta.skip_if.only_addresses_changed = true,
- .meta.skip_if.pipe_deltas.current_has_no_plane = true,
- .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
- { .func = HUBP_CLK_CNTL,
- .meta.skip_if.stream_unchanged = true,
- .meta.skip_if.only_addresses_changed = true,
- .meta.skip_if.pipe_deltas.current_has_no_plane = true,
- .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
- { .func = DPP_DPPCLK_CONTROL,
- .meta.skip_if.stream_unchanged = true,
- .meta.skip_if.only_addresses_changed = true,
- .meta.skip_if.pipe_deltas.current_has_no_plane = true,
- .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
- { .func = DC_IP_REQUEST_STATUS,
- .meta.skip_if.stream_unchanged = true,
- .meta.skip_if.only_addresses_changed = true,
- .meta.skip_if.no_ip_request = true,
- .meta.skip_if.pipe_deltas.current_has_no_plane = true,
- .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
- { .func = DC_IP_REQUEST_CNTL,
- .meta.skip_if.stream_unchanged = true,
- .meta.skip_if.only_addresses_changed = true,
- .meta.dc_ip_request_cntl.enable = true,
- .meta.skip_if.no_ip_request = true,
- .meta.skip_if.pipe_deltas.current_has_no_plane = true,
- .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
- { .func = HUBP_PG_CONTROL,
- .meta.skip_if.stream_unchanged = true,
- .meta.skip_if.only_addresses_changed = true,
- .meta.skip_if.pipe_deltas.current_has_no_plane = true,
- .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
- { .func = HUBP_RESET,
- .meta.skip_if.stream_unchanged = true,
- .meta.skip_if.only_addresses_changed = true,
- .meta.skip_if.pipe_deltas.current_has_no_plane = true,
- .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
- { .func = DPP_RESET,
- .meta.skip_if.stream_unchanged = true,
- .meta.skip_if.only_addresses_changed = true,
- .meta.skip_if.pipe_deltas.current_has_no_plane = true,
- .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
- { .func = DC_IP_REQUEST_CNTL,
- .meta.skip_if.stream_unchanged = true,
- .meta.skip_if.only_addresses_changed = true,
- .meta.dc_ip_request_cntl.enable = false,
- .meta.skip_if.no_ip_request = true,
- .meta.skip_if.pipe_deltas.current_has_no_plane = true,
- .meta.skip_if.pipe_deltas.hubp_dpp_already_enabled = true },
-};
-
/* enable_plane, then the watermark propagate and the DET segments. */
/* Ungate and clock the HUBP and DPP of a pipe brought up. */
static const struct dcn401_commit_step ungate_hw[] = {
@@ -1818,1216 +1236,6 @@ static const struct dcn401_commit_step trigger[] = {
.meta.skip_if.no_manual_trigger = true },
};
-/* enable_stream_timing_calc: manual mode unless every span is even. */
-static bool dcn401_h_timing_div_manual_mode(
- const struct dc_crtc_timing *timing)
-{
- unsigned int h_blank_start = timing->h_total - timing->h_front_porch;
- unsigned int h_blank_end = h_blank_start - timing->h_addressable;
-
- return (timing->h_total % 2) || (h_blank_start % 2) ||
- (h_blank_end % 2) || (timing->h_sync_width % 2);
-}
-
-/* dcn10_get_vupdate_offset_from_vsync for progressive timing. */
-static int dcn401_vupdate_start_line(const struct pipe_ctx *pipe)
-{
- const struct dc_crtc_timing *timing = &pipe->stream->timing;
- int front_porch = timing->v_front_porch ? timing->v_front_porch : 1;
- int vesa_sync_start = timing->v_addressable + timing->v_border_bottom +
- front_porch;
- int asic_blank_end = timing->v_total - vesa_sync_start -
- timing->v_border_top;
- int start_line = asic_blank_end -
- (int)pipe->pipe_dlg_param.vstartup_start + 1;
-
- return start_line < 0 ? 0 : start_line;
-}
-
-/* dcn401_enable_stream_calc's early control for this lane count. */
-static uint32_t dcn401_early_cntl(const struct pipe_ctx *pipe)
-{
- const struct dc_crtc_timing *timing = &pipe->stream->timing;
- unsigned int lane_count =
- pipe->stream->link->cur_link_settings.lane_count;
- uint32_t early_cntl = 0;
-
- if (lane_count)
- early_cntl = (timing->h_addressable + timing->h_border_left +
- timing->h_border_right) % lane_count;
- return early_cntl ? early_cntl : lane_count;
-}
-
-/*
- * dcn20_blank_pixel_data: the black of the output color space over the ODM
- * slice of this OPP head, or the video on unblank.
- */
-static void dcn401_opp_blank_params(const struct dc *dc,
- struct pipe_ctx *pipe, bool unblank,
- struct opp_set_disp_pattern_generator_params *p)
-{
- const struct dc_crtc_timing *timing = &pipe->stream->timing;
- struct rect slice = resource_get_odm_slice_src_rect(pipe);
-
- p->opp = pipe->stream_res.opp;
- p->test_pattern = unblank ? CONTROLLER_DP_TEST_PATTERN_VIDEOMODE :
- CONTROLLER_DP_TEST_PATTERN_SOLID_COLOR;
- p->color_space = CONTROLLER_DP_COLOR_SPACE_UDEFINED;
- p->color_depth = timing->display_color_depth;
- color_space_to_black_color(dc, pipe->stream->output_color_space,
- &p->solid_color);
- p->use_solid_color = true;
- p->width = slice.width;
- p->height = slice.height;
- p->offset = slice.x;
- p->disable_dyn_exp_for_test_pattern =
- dc->debug.disable_dynamic_expansion_for_test_pattern;
-}
-
-/*
- * dcn401_update_odm: one OPP per ODM slice, in slice order. A table's
- * OPTC_SET_ODM_COMBINE programs the ODM unconditionally: N:1 combine for
- * N > 1 slices, else bypass.
- */
-static void dcn401_odm_combine_params(struct pipe_ctx *otg_master,
- struct set_odm_combine_params *p)
-{
- struct pipe_ctx *odm;
-
- p->tg = otg_master->stream_res.tg;
- for (odm = otg_master; odm; odm = odm->next_odm_pipe)
- p->opp_inst[p->opp_head_count++] = odm->stream_res.opp->inst;
- p->odm_slice_width = resource_get_odm_slice_dst_width(otg_master,
- false);
- p->last_odm_slice_width = resource_get_odm_slice_dst_width(otg_master,
- true);
-}
-
-static void dcn401_dsc_config_params(struct pipe_ctx *otg_master,
- bool enable, struct tg_set_dsc_config_params *p)
-{
- struct dsc_optc_config optc;
-
- p->tg = otg_master->stream_res.tg;
- p->dsc_mode = OPTC_DSC_DISABLED;
- if (!enable || !hwss_prepare_dsc_config_for_pipe(otg_master,
- resource_get_odm_slice_count(otg_master), 0, &optc))
- return;
- p->dsc_mode = optc.is_pixel_format_444 ? OPTC_DSC_ENABLED_444 :
- OPTC_DSC_ENABLED_NATIVE_SUBSAMPLED;
- p->bytes_per_pixel = optc.bytes_per_pixel;
- p->slice_width = optc.slice_width;
-}
-
-static void dcn401_program_timing_params(const struct pipe_ctx *pipe,
- struct tg_program_timing_params *p)
-{
- const union dml2_global_sync_programming *sync = &pipe->global_sync;
-
- p->tg = pipe->stream_res.tg;
- p->timing = &pipe->stream->timing;
- p->vready_offset = sync->dcn4x.vready_offset_pixels;
- p->vstartup_start = sync->dcn4x.vstartup_lines;
- p->vupdate_offset = sync->dcn4x.vupdate_offset_pixels;
- p->vupdate_width = sync->dcn4x.vupdate_vupdate_width_pixels;
- p->pstate_keepout = sync->dcn4x.pstate_keepout_start_lines;
- p->signal = pipe->stream->signal;
- p->use_vbios = true;
-}
-
-static void dcn401_drr_params(const struct pipe_ctx *pipe, bool with_mid,
- struct drr_params *drr)
-{
- const struct dc_crtc_timing_adjust *adjust = &pipe->stream->adjust;
-
- drr->vertical_total_min = adjust->v_total_min;
- drr->vertical_total_max = adjust->v_total_max;
- if (with_mid) {
- drr->vertical_total_mid = adjust->v_total_mid;
- drr->vertical_total_mid_frame_num =
- adjust->v_total_mid_frame_num;
- }
-}
-
-static void dcn401_update_clocks_params(const struct dc *dc,
- struct dc_state *context, bool safe_to_lower,
- struct clk_mgr_update_clocks_for_state_params *p)
-{
- p->clk_mgr = dc->clk_mgr;
- p->context = context;
- p->safe_to_lower = safe_to_lower;
- p->disallow_p_state_change = !safe_to_lower &&
- context->bw_ctx.bw.dcn.clk.p_state_change_support;
-}
-
-/* dcn401_update_mpcc_sequence's blending for the plane. */
-static void dcn401_blnd_cfg(const struct dc_plane_state *plane,
- struct mpcc_blnd_cfg *cfg)
-{
- cfg->overlap_only = false;
- cfg->global_gain = 0xff;
- if (plane->per_pixel_alpha) {
- cfg->pre_multiplied_alpha = plane->pre_multiplied_alpha;
- if (plane->global_alpha) {
- cfg->alpha_mode =
- MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA_COMBINED_GLOBAL_GAIN;
- cfg->global_gain = plane->global_alpha_value;
- } else {
- cfg->alpha_mode = MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA;
- }
- } else {
- cfg->pre_multiplied_alpha = false;
- cfg->alpha_mode = MPCC_ALPHA_BLEND_MODE_GLOBAL_ALPHA;
- }
- cfg->global_alpha = plane->global_alpha ?
- plane->global_alpha_value : 0xff;
- cfg->background_color_bpc = 4;
- cfg->bottom_gain_mode = 0;
- cfg->top_gain = DCN401_UNITY_GAIN;
- cfg->bottom_inside_gain = DCN401_UNITY_GAIN;
- cfg->bottom_outside_gain = DCN401_UNITY_GAIN;
- if (plane->format == SURFACE_PIXEL_FORMAT_GRPH_RGBE_ALPHA)
- cfg->pre_multiplied_alpha = false;
-}
-
-/* dcn401_set_hdr_multiplier_sequence: 1.0 unless the plane sets one. */
-static uint32_t dcn401_hdr_mult(const struct dc_plane_state *plane)
-{
- struct custom_float_format fmt = {
- .exponenta_bits = 6,
- .mantissa_bits = 12,
- .sign = true,
- };
- uint32_t hw_mult = DCN401_UNITY_GAIN;
-
- if (!dc_fixpt_eq(plane->hdr_mult, dc_fixpt_from_int(0)) &&
- !convert_to_custom_float_format(plane->hdr_mult, &fmt,
- &hw_mult))
- hw_mult = DCN401_UNITY_GAIN;
- return hw_mult;
-}
-
-/* dcn401_program_mall_pipe_config_sequence for one non-phantom pipe. */
-static void dcn401_mall_sel_params(struct dc *dc, struct dc_state *state,
- struct pipe_ctx *pipe, struct hubp_update_mall_sel_params *p)
-{
- const struct hubp *hubp = pipe->plane_res.hubp;
- const struct dc_plane_address *address = &pipe->plane_state->address;
- int cursor_size = hubp->curs_attr.pitch * hubp->curs_attr.height;
- uint32_t mall_ss_size_bytes;
- uint32_t num_ways = 0;
-
- switch (hubp->curs_attr.color_format) {
- case CURSOR_MODE_MONO:
- cursor_size /= 2;
- break;
- case CURSOR_MODE_COLOR_1BIT_AND:
- case CURSOR_MODE_COLOR_PRE_MULTIPLIED_ALPHA:
- case CURSOR_MODE_COLOR_UN_PRE_MULTIPLIED_ALPHA:
- cursor_size *= 4;
- break;
- default:
- cursor_size *= 8;
- break;
- }
-
- /*
- * dcn401_calculate_cab_allocation also adds the cursor mall bytes.
- * This builder rejects a cursor, so those bytes are zero. The helper
- * that computes them is built only with CONFIG_DRM_AMD_DC_FP.
- */
- mall_ss_size_bytes = state->bw_ctx.bw.dcn.mall_ss_size_bytes;
- if (dc->debug.force_mall_ss_num_ways > 0)
- num_ways = dc->debug.force_mall_ss_num_ways;
- else if (dc->res_pool->funcs->calculate_mall_ways_from_bytes)
- num_ways = dc->res_pool->funcs->calculate_mall_ways_from_bytes(
- dc, mall_ss_size_bytes);
-
- p->hubp = pipe->plane_res.hubp;
- p->cache_cursor = cursor_size > DCN401_CACHE_CURSOR_BYTES;
- p->mall_sel = num_ways <= dc->caps.cache_num_ways &&
- pipe->stream->link->psr_settings.psr_version ==
- DC_PSR_VERSION_UNSUPPORTED &&
- address->type != PLN_ADDR_TYPE_GRPH_STEREO &&
- !address->tmz_surface ? DCN401_MALL_SEL_SS : 0;
-}
-
-/* dcn401_set_mcm_luts clears the HUBP 3DLUT fast load with this. */
-static const struct dc_3dlut_dma dcn401_3dlut_dma_off = {0};
-
-/* dcn401_set_mcm_luts sizes the off 3DLUT by the plane's LUT. */
-static enum dc_cm_lut_size dcn401_lut_mode_size(
- const struct dc_plane_state *plane, enum MCM_LUT_ID id)
-{
- if (id != MCM_LUT_3DLUT)
- return CM_LUT_SIZE_NONE;
- return plane->cm.lut3d_func.lut_3d.use_tetrahedral_9 ?
- CM_LUT_SIZE_999 : CM_LUT_SIZE_171717;
-}
-
-/*
- * The divider dcn401_enable_stream_timing sets for the virtual signal. The
- * divide by one dcn401_enable_stream passes later is a no-op, because
- * dccg401_set_pixel_rate_div accepts only 2 and 4. The hwseq is built only
- * with DC_FP; the builder is built without it.
- */
-static enum pixel_rate_div dcn401_pixel_rate_div(
- const struct pipe_ctx *pipe)
-{
- return pipe->stream->timing.pixel_encoding == PIXEL_ENCODING_YCBCR420 ?
- PIXEL_RATE_DIV_BY_2 : PIXEL_RATE_DIV_BY_4;
-}
-
-/* Writes one entry; build sized every sequence before adding to it. */
-static void dcn401_add_step(struct block_sequence_state *sequence,
- const struct dcn401_commit_step_args *args,
- const struct dcn401_commit_step *step)
-{
- struct block_sequence *entry;
- union block_sequence_params *p;
- struct dc *dc = args->dc;
- struct dcn_bw_output *bw = &args->new_state->bw_ctx.bw.dcn;
- struct pipe_ctx *pipe;
- struct dpp *dpp;
- struct dc_plane_state *plane;
- const struct dcn401_commit_step_meta *m = &step->meta;
-
- if (*sequence->num_steps >= DC2_BLS_MAX_STEPS) {
- if (*sequence->num_steps == DC2_BLS_MAX_STEPS &&
- dc->debug.dc2_bls_report_step_overflow &&
- dc->ctx && dc->ctx->logger) {
- DC_LOG_ERROR("%s: more than %u BLS steps\n", __func__,
- DC2_BLS_MAX_STEPS);
- BREAK_TO_DEBUGGER();
- }
- (*sequence->num_steps)++;
- return;
- }
- entry = &sequence->steps[(*sequence->num_steps)++];
- p = &entry->params;
- memset(entry, 0, sizeof(*entry));
- entry->func = step->func;
- /*
- * Bandwidth and p-state steps have no pipe. Handle them before the
- * pipe is used, then every later case can use the pipe directly.
- */
- if (!args->pipe) {
- switch (step->func) {
- case CLK_MGR_UPDATE_CLOCKS_FOR_STATE:
- dcn401_update_clocks_params(dc, args->new_state,
- m->clk_mgr_update_clocks_for_state
- .safe_to_lower,
- &p->clk_mgr_update_clocks_for_state_params);
- return;
- case HUBBUB_PROGRAM_WATERMARKS:
- p->hubbub_program_watermarks_params =
- hwss_prepare_hubbub_program_watermarks(dc,
- dc->res_pool->hubbub, &bw->watermarks,
- dc->res_pool->ref_clocks.dchub_ref_clock_inKhz /
- 1000,
- m->hubbub_program_watermarks.safe_to_lower);
- return;
- case HUBBUB_PROGRAM_ARBITER:
- p->hubbub_program_arbiter_params =
- hwss_prepare_hubbub_program_arbiter(
- dc->res_pool->hubbub, &bw->arb_regs,
- m->hubbub_program_arbiter.safe_to_lower);
- return;
- case HUBBUB_PROGRAM_COMPBUF_SEGMENTS:
- p->hubbub_program_compbuf_segments_params.hubbub =
- dc->res_pool->hubbub;
- p->hubbub_program_compbuf_segments_params.compbuf_size =
- m->hubbub_program_compbuf_segments
- .use_current_state_size ?
- args->current_state->bw_ctx.bw.dcn.arb_regs
- .compbuf_size : bw->arb_regs.compbuf_size;
- p->hubbub_program_compbuf_segments_params.safe_to_lower =
- m->hubbub_program_compbuf_segments
- .safe_to_lower;
- return;
- case HUBBUB_FORCE_PSTATE_CHANGE_CONTROL:
- p->hubbub_force_pstate_change_control_params.hubbub =
- dc->res_pool->hubbub;
- p->hubbub_force_pstate_change_control_params.enable =
- m->hubbub_force_pstate_change_control.enable;
- return;
- default:
- (*sequence->num_steps)--;
- return;
- }
- }
- pipe = args->pipe;
- dpp = pipe->plane_res.dpp;
- plane = pipe->plane_state;
- switch (step->func) {
- case CLK_MGR_UPDATE_CLOCKS_FOR_STATE:
- dcn401_update_clocks_params(dc, args->new_state,
- m->clk_mgr_update_clocks_for_state
- .safe_to_lower,
- &p->clk_mgr_update_clocks_for_state_params);
- break;
- case HUBBUB_PROGRAM_WATERMARKS:
- p->hubbub_program_watermarks_params =
- hwss_prepare_hubbub_program_watermarks(dc,
- dc->res_pool->hubbub, &bw->watermarks,
- dc->res_pool->ref_clocks.dchub_ref_clock_inKhz /
- 1000,
- m->hubbub_program_watermarks.safe_to_lower);
- break;
- case HUBBUB_PROGRAM_ARBITER:
- p->hubbub_program_arbiter_params =
- hwss_prepare_hubbub_program_arbiter(
- dc->res_pool->hubbub, &bw->arb_regs,
- m->hubbub_program_arbiter.safe_to_lower);
- break;
- case HUBBUB_PROGRAM_COMPBUF_SEGMENTS:
- p->hubbub_program_compbuf_segments_params.hubbub =
- dc->res_pool->hubbub;
- p->hubbub_program_compbuf_segments_params.compbuf_size =
- m->hubbub_program_compbuf_segments
- .use_current_state_size ?
- args->current_state->bw_ctx.bw.dcn.arb_regs
- .compbuf_size : bw->arb_regs.compbuf_size;
- p->hubbub_program_compbuf_segments_params.safe_to_lower =
- m->hubbub_program_compbuf_segments
- .safe_to_lower;
- break;
- case HUBBUB_FORCE_PSTATE_CHANGE_CONTROL:
- p->hubbub_force_pstate_change_control_params.hubbub =
- dc->res_pool->hubbub;
- p->hubbub_force_pstate_change_control_params.enable =
- m->hubbub_force_pstate_change_control.enable;
- break;
- case BIOS_SET_SCRATCH_CRITICAL_STATE:
- p->bios_set_scratch_critical_state_params.dcb =
- dc->ctx->dc_bios;
- p->bios_set_scratch_critical_state_params.state =
- m->bios_set_scratch_critical_state.state;
- break;
- case TG_LOCK:
- p->tg_lock_params.dc = dc;
- p->tg_lock_params.tg = pipe->stream_res.tg;
- p->tg_lock_params.lock = m->tg_lock.lock;
- break;
- case TG_ENABLE_CRTC:
- p->tg_enable_crtc_params.tg = pipe->stream_res.tg;
- break;
- case TG_DISABLE_CRTC:
- p->tg_disable_crtc_params.tg = pipe->stream_res.tg;
- break;
- case TG_WAIT_ODM_DOUBLEBUFFER_PENDING_CLEAR:
- p->tg_wait_odm_doublebuffer_pending_clear_params.tg =
- pipe->stream_res.tg;
- break;
- case TG_ENABLE_RESET_TRIGGER:
- p->tg_enable_reset_trigger_params.tg = pipe->stream_res.tg;
- p->tg_enable_reset_trigger_params.source_tg_inst =
- args->timing_sync_source->stream_res.tg->inst;
- break;
- case TG_WAIT_FOR_RESET_TRIGGER:
- p->tg_wait_for_reset_trigger_params.tg = pipe->stream_res.tg;
- p->tg_wait_for_reset_trigger_params.frames =
- DCN401_RESET_TRIGGER_WAIT_FRAMES;
- p->tg_wait_for_reset_trigger_params.continue_on_error = true;
- break;
- case TG_DISABLE_RESET_TRIGGER:
- p->tg_disable_reset_trigger_params.tg = pipe->stream_res.tg;
- break;
- case TG_ENABLE_OPTC_CLOCK:
- p->tg_enable_optc_clock_params.tg = pipe->stream_res.tg;
- p->tg_enable_optc_clock_params.enable =
- m->tg_enable_optc_clock.enable;
- break;
- case TG_SET_DRR:
- p->tg_set_drr_params.tg = pipe->stream_res.tg;
- if (m->tg_set_drr.from_adjust)
- dcn401_drr_params(pipe, m->tg_set_drr.with_mid,
- &p->tg_set_drr_params.drr);
- break;
- case TG_SET_STATIC_SCREEN_CONTROL:
- /* DRR is off, so no static-screen event triggers the OTG. */
- p->tg_set_static_screen_control_params.tg = pipe->stream_res.tg;
- p->tg_set_static_screen_control_params.num_frames =
- DCN401_STATIC_SCREEN_NUM_FRAMES;
- break;
- case TG_PROGRAM_TIMING:
- dcn401_program_timing_params(pipe,
- &p->tg_program_timing_params);
- break;
- case TG_SET_H_TIMING_DIV_MANUAL_MODE:
- p->tg_set_h_timing_div_manual_mode_params.tg =
- pipe->stream_res.tg;
- p->tg_set_h_timing_div_manual_mode_params.manual_mode =
- dcn401_h_timing_div_manual_mode(
- &pipe->stream->timing);
- break;
- case TG_SETUP_VERTICAL_INTERRUPT2:
- p->tg_setup_vertical_interrupt2_params.tg = pipe->stream_res.tg;
- p->tg_setup_vertical_interrupt2_params.start_line =
- dcn401_vupdate_start_line(pipe);
- break;
- case TG_SET_OUT_MUX:
- p->tg_set_out_mux_params.tg = pipe->stream_res.tg;
- p->tg_set_out_mux_params.dest = OUT_MUX_DIO;
- break;
- case TG_SET_EARLY_CONTROL:
- p->tg_set_early_control_params.tg = pipe->stream_res.tg;
- p->tg_set_early_control_params.early_cntl =
- dcn401_early_cntl(pipe);
- break;
- case TG_PROGRAM_STEREO:
- p->tg_program_stereo_params.tg = pipe->stream_res.tg;
- p->tg_program_stereo_params.timing = &pipe->stream->timing;
- break;
- case OPTC_SET_ODM_COMBINE:
- if (pipe->next_odm_pipe) {
- dcn401_odm_combine_params(pipe,
- &p->set_odm_combine_params);
- break;
- }
- entry->func = OPTC_SET_ODM_BYPASS;
- p->set_odm_bypass_params.tg = pipe->stream_res.tg;
- p->set_odm_bypass_params.timing = &pipe->stream->timing;
- break;
- case OPTC_SET_ODM_BYPASS:
- p->set_odm_bypass_params.tg = pipe->stream_res.tg;
- p->set_odm_bypass_params.timing = &pipe->stream->timing;
- break;
- case OPP_PIPE_CLOCK_CONTROL:
- p->opp_pipe_clock_control_params.opp = pipe->stream_res.opp;
- p->opp_pipe_clock_control_params.enable = true;
- break;
- case OPP_PROGRAM_LEFT_EDGE_EXTRA_PIXEL:
- p->opp_program_left_edge_extra_pixel_params.opp =
- pipe->stream_res.opp;
- p->opp_program_left_edge_extra_pixel_params.pixel_encoding =
- pipe->stream->timing.pixel_encoding;
- p->opp_program_left_edge_extra_pixel_params.is_otg_master =
- !pipe->prev_odm_pipe;
- break;
- case DCCG_SET_DTO_DSCCLK:
- p->dccg_set_dto_dscclk_params.dccg = dc->res_pool->dccg;
- p->dccg_set_dto_dscclk_params.inst = pipe->stream_res.dsc->inst;
- p->dccg_set_dto_dscclk_params.num_slices_h =
- pipe->stream->timing.dsc_cfg.num_slices_h /
- resource_get_odm_slice_count(pipe);
- break;
- case DSC_SET_CONFIG:
- if (!hwss_prepare_dsc_config_for_pipe(pipe,
- resource_get_odm_slice_count(pipe), 0, NULL)) {
- (*sequence->num_steps)--;
- return;
- }
- p->dsc_set_config_params.dsc = pipe->stream_res.dsc;
- break;
- case DSC_ENABLE:
- p->dsc_enable_params.dsc = pipe->stream_res.dsc;
- p->dsc_enable_params.opp_inst = pipe->stream_res.opp->inst;
- break;
- case TG_SET_DSC_CONFIG:
- dcn401_dsc_config_params(pipe, m->tg_set_dsc_config.enable,
- &p->tg_set_dsc_config_params);
- break;
- case DSC_DISCONNECT:
- p->dsc_disconnect_params.dsc = pipe->stream_res.dsc;
- break;
- case DSC_DISABLE:
- p->dsc_disable_params.dsc = pipe->stream_res.dsc;
- break;
- case DCCG_SET_REF_DSCCLK:
- p->dccg_set_ref_dscclk_params.dccg = dc->res_pool->dccg;
- p->dccg_set_ref_dscclk_params.dsc = pipe->stream_res.dsc;
- break;
- case OPP_PROGRAM_FMT:
- p->opp_program_fmt_params.opp = pipe->stream_res.opp;
- p->opp_program_fmt_params.fmt_bit_depth =
- &pipe->stream->bit_depth_params;
- p->opp_program_fmt_params.clamping = &pipe->stream->clamping;
- break;
- case OPP_SET_DYN_EXPANSION:
- p->opp_set_dyn_expansion_params.opp = pipe->stream_res.opp;
- p->opp_set_dyn_expansion_params.color_space =
- COLOR_SPACE_YCBCR601;
- p->opp_set_dyn_expansion_params.color_depth =
- pipe->stream->timing.display_color_depth;
- p->opp_set_dyn_expansion_params.signal = pipe->stream->signal;
- break;
- case OPP_SET_DISP_PATTERN_GENERATOR:
- dcn401_opp_blank_params(dc, pipe,
- m->opp_set_disp_pattern_generator.unblank,
- &p->opp_set_disp_pattern_generator_params);
- break;
- case OPP_WAIT_FOR_BLANK_COMPLETE:
- p->opp_wait_for_blank_complete_params.opp =
- pipe->stream_res.opp;
- p->opp_wait_for_blank_complete_params.polling_interval_us =
- DCN401_DPG_POLL_INTERVAL_US;
- p->opp_wait_for_blank_complete_params.timeout_us =
- DCN401_DPG_POLL_TIMEOUT_US;
- /* DC1 ignores the result of dcn20_wait_for_blank_complete. */
- p->opp_wait_for_blank_complete_params.continue_on_error = true;
- break;
- case OPP_PROGRAM_STEREO:
- p->opp_program_stereo_params.opp = pipe->stream_res.opp;
- p->opp_program_stereo_params.timing = &pipe->stream->timing;
- break;
- case DCCG_SET_DTBCLK_P_SRC:
- p->dccg_set_dtbclk_p_src_params.dccg = dc->res_pool->dccg;
- p->dccg_set_dtbclk_p_src_params.src =
- m->dccg_set_dtbclk_p_src.src;
- p->dccg_set_dtbclk_p_src_params.otg_inst =
- pipe->stream_res.tg->inst;
- break;
- case DCCG_SET_PIXEL_RATE_DIV:
- p->dccg_set_pixel_rate_div_params.dccg = dc->res_pool->dccg;
- p->dccg_set_pixel_rate_div_params.otg_inst =
- pipe->stream_res.tg->inst;
- p->dccg_set_pixel_rate_div_params.k1 =
- dcn401_pixel_rate_div(pipe);
- p->dccg_set_pixel_rate_div_params.k2 = PIXEL_RATE_DIV_NA;
- break;
- case CLK_SRC_PROGRAM_PIX_CLK:
- p->clk_src_program_pix_clk_params.clock_source =
- pipe->clock_source;
- p->clk_src_program_pix_clk_params.pix_clk_params =
- &pipe->stream_res.pix_clk_params;
- /* DC1 gives virtual a dummy 8b/10b DP link setting. */
- p->clk_src_program_pix_clk_params.encoding = DP_8b_10b_ENCODING;
- p->clk_src_program_pix_clk_params.pll_settings =
- &pipe->pll_settings;
- break;
- case CLK_SRC_POWER_DOWN:
- p->clk_src_power_down_params.clock_source = pipe->clock_source;
- /* dcn401_reset_hw_ctx_wrap ignores a failed power-down. */
- p->clk_src_power_down_params.continue_on_error = true;
- break;
- case DIO_LINK_ENC_CONNECT_DIG_BE_TO_FE:
- p->link_enc_connect_dig_be_to_fe_params.link_enc =
- pipe->stream->link->link_enc;
- p->link_enc_connect_dig_be_to_fe_params.engine =
- pipe->stream_res.stream_enc->id;
- p->link_enc_connect_dig_be_to_fe_params.connect =
- m->link_enc_connect_dig_be_to_fe.connect;
- break;
- case DIO_LINK_ENC_ENABLE_DP_OUTPUT:
- p->link_enc_enable_dp_output_params.link_enc =
- pipe->stream->link->link_enc;
- p->link_enc_enable_dp_output_params.link_settings =
- &pipe->link_config.dp_link_settings;
- p->link_enc_enable_dp_output_params.clock_source =
- pipe->clock_source->id;
- break;
- case DIO_LINK_ENC_DISABLE_OUTPUT:
- p->link_enc_disable_output_params.link_enc =
- pipe->stream->link->link_enc;
- p->link_enc_disable_output_params.signal =
- SIGNAL_TYPE_DISPLAY_PORT;
- break;
- case DCCG_ENABLE_SYMCLK_SE:
- p->dccg_enable_symclk_se_params.dccg = dc->res_pool->dccg;
- p->dccg_enable_symclk_se_params.stream_enc_inst =
- pipe->stream_res.stream_enc->stream_enc_inst;
- p->dccg_enable_symclk_se_params.link_enc_inst =
- pipe->stream->link->link_enc->transmitter -
- TRANSMITTER_UNIPHY_A;
- break;
- case DCCG_DISABLE_SYMCLK_SE:
- p->dccg_disable_symclk_se_params.dccg = dc->res_pool->dccg;
- p->dccg_disable_symclk_se_params.stream_enc_inst =
- pipe->stream_res.stream_enc->stream_enc_inst;
- p->dccg_disable_symclk_se_params.link_enc_inst =
- pipe->stream->link->link_enc->transmitter -
- TRANSMITTER_UNIPHY_A;
- break;
- case HUBP_PROGRAM_DET_SEGMENTS:
- p->program_det_segments_params.hubbub = dc->res_pool->hubbub;
- p->program_det_segments_params.hubp_inst =
- pipe->plane_res.hubp->inst;
- if (m->hubp_program_det_segments.allocate)
- p->program_det_segments_params.det_size =
- pipe->hubp_regs.det_size;
- break;
- case MPC_REMOVE_MPCC:
- p->mpc_remove_mpcc_params.mpc = dc->res_pool->mpc;
- p->mpc_remove_mpcc_params.mpc_tree_params =
- &pipe->stream_res.opp->mpc_tree_params;
- p->mpc_remove_mpcc_params.mpcc_to_remove =
- &dc->res_pool->mpc->mpcc_array[
- pipe->plane_res.mpcc_inst];
- break;
- case MPC_ASSERT_IDLE_MPCC:
- p->mpc_assert_idle_mpcc_params.mpc = dc->res_pool->mpc;
- p->mpc_assert_idle_mpcc_params.mpcc_id =
- pipe->plane_res.mpcc_inst;
- break;
- case HUBP_SET_BLANK:
- p->hubp_set_blank_params.hubp = pipe->plane_res.hubp;
- p->hubp_set_blank_params.blank = !m->hubp_set_blank.unblank;
- break;
- case HUBP_UPDATE_MALL_SEL:
- if (m->hubp_update_mall_sel.from_new_state)
- dcn401_mall_sel_params(dc, args->new_state, pipe,
- &p->hubp_update_mall_sel_params);
- else
- p->hubp_update_mall_sel_params.hubp =
- pipe->plane_res.hubp;
- break;
- case HUBP_SET_FLIP_CONTROL_GSL:
- p->set_flip_control_gsl_params.hubp = pipe->plane_res.hubp;
- p->set_flip_control_gsl_params.flip_immediate =
- plane->flip_immediate;
- break;
- case HUBP_CLK_CNTL:
- p->hubp_clk_cntl_params.hubp = pipe->plane_res.hubp;
- p->hubp_clk_cntl_params.enable = m->hubp_clk_cntl.enable;
- break;
- case DPP_DPPCLK_CONTROL:
- p->dpp_dppclk_control_params.dpp = dpp;
- p->dpp_dppclk_control_params.enable =
- m->dpp_dppclk_control.enable;
- break;
- case DC_IP_REQUEST_STATUS:
- p->dc_ip_request_status_params.hws = dc->hwseq;
- break;
- case DC_IP_REQUEST_CNTL:
- p->dc_ip_request_cntl_params.hws = dc->hwseq;
- p->dc_ip_request_cntl_params.enable =
- m->dc_ip_request_cntl.enable;
- break;
- case HUBP_PG_CONTROL:
- p->hubp_pg_control_params.hws = dc->hwseq;
- p->hubp_pg_control_params.hubp_inst =
- pipe->plane_res.hubp->inst;
- p->hubp_pg_control_params.power_on =
- m->hubp_pg_control.power_on;
- p->hubp_pg_control_params.disable_power_gate =
- dc->debug.disable_hubp_power_gate;
- p->hubp_pg_control_params.ignore_pg = dc->debug.ignore_pg;
- break;
- case HUBP_RESET:
- p->hubp_reset_params.hubp = pipe->plane_res.hubp;
- break;
- case DPP_RESET:
- p->dpp_reset_params.dpp = dpp;
- break;
- case TG_WAIT_FOR_ALL_PENDING_UPDATES:
- p->tg_wait_for_all_pending_updates_params.tg =
- pipe->stream_res.tg;
- p->tg_wait_for_all_pending_updates_params.include_pipe_update =
- plane != NULL;
- p->tg_wait_for_all_pending_updates_params.polling_interval_us =
- DCN401_PENDING_UPDATE_POLL_INTERVAL_US;
- p->tg_wait_for_all_pending_updates_params.timeout_us =
- DCN401_PENDING_UPDATE_TIMEOUT_US;
- break;
- case HUBP_PROGRAM_TRIPLEBUFFER:
- p->program_triplebuffer_params.hubp = pipe->plane_res.hubp;
- p->program_triplebuffer_params.enableTripleBuffer =
- plane->triplebuffer_flips;
- break;
- case DC_UDELAY:
- p->dc_udelay_params.us = DCN401_PLANE_ENABLE_DELAY_US;
- break;
- case TG_PROGRAM_GLOBAL_SYNC:
- p->tg_program_global_sync_params.tg = pipe->stream_res.tg;
- p->tg_program_global_sync_params.vready_offset =
- pipe->global_sync.dcn4x.vready_offset_pixels;
- p->tg_program_global_sync_params.vstartup_lines =
- pipe->global_sync.dcn4x.vstartup_lines;
- p->tg_program_global_sync_params.vupdate_offset_pixels =
- pipe->global_sync.dcn4x.vupdate_offset_pixels;
- p->tg_program_global_sync_params.vupdate_vupdate_width_pixels =
- pipe->global_sync.dcn4x
- .vupdate_vupdate_width_pixels;
- p->tg_program_global_sync_params.pstate_keepout_start_lines =
- pipe->global_sync.dcn4x.pstate_keepout_start_lines;
- break;
- case TG_WAIT_FOR_STATE:
- p->tg_wait_for_state_params.tg = pipe->stream_res.tg;
- p->tg_wait_for_state_params.state = CRTC_STATE_VACTIVE;
- break;
- case TG_SET_VTG_PARAMS:
- p->tg_set_vtg_params_params.tg = pipe->stream_res.tg;
- p->tg_set_vtg_params_params.timing = &pipe->stream->timing;
- p->tg_set_vtg_params_params.program_fp2 = true;
- break;
- case HUBP_INIT:
- p->hubp_init_params.hubp = pipe->plane_res.hubp;
- break;
- case HUBBUB_FORCE_WM_PROPAGATE_TO_PIPES:
- p->hubbub_force_wm_propagate_to_pipes_params.hubbub =
- dc->res_pool->hubbub;
- break;
- case DCCG_UPDATE_DPP_DTO:
- p->dccg_update_dpp_dto_params.dccg = dc->res_pool->dccg;
- p->dccg_update_dpp_dto_params.dpp_inst = dpp->inst;
- p->dccg_update_dpp_dto_params.dppclk_khz =
- pipe->plane_res.bw.dppclk_khz;
- break;
- case HUBP_VTG_SEL:
- p->hubp_vtg_sel_params.hubp = pipe->plane_res.hubp;
- p->hubp_vtg_sel_params.otg_inst = pipe->stream_res.tg->inst;
- break;
- case HUBP_SETUP2:
- p->hubp_setup2_params.hubp = pipe->plane_res.hubp;
- p->hubp_setup2_params.hubp_regs = &pipe->hubp_regs;
- p->hubp_setup2_params.global_sync = &pipe->global_sync;
- p->hubp_setup2_params.timing = &pipe->stream->timing;
- break;
- case HUBP_SET_UNBOUNDED_REQUESTING:
- p->hubp_set_unbounded_requesting_params.hubp = pipe->plane_res.hubp;
- p->hubp_set_unbounded_requesting_params.unbounded_req =
- pipe->unbounded_req;
- break;
- case HUBP_SETUP_INTERDEPENDENT2:
- p->hubp_setup_interdependent2_params.hubp = pipe->plane_res.hubp;
- p->hubp_setup_interdependent2_params.hubp_regs =
- &pipe->hubp_regs;
- break;
- case DPP_SETUP_DPP:
- p->setup_dpp_params.dpp = dpp;
- p->setup_dpp_params.format = plane->format;
- p->setup_dpp_params.input_csc_color_matrix =
- plane->input_csc_color_matrix;
- p->setup_dpp_params.color_space = plane->color_space;
- p->setup_dpp_params.upsp_mode = resource_is_upsp_required(
- (bool) plane->ctx->dc->caps.color.dpp.upsp_pre_scaler, plane->format, plane->scaling_linearity);
- break;
- case DPP_SET_CURSOR_MATRIX:
- p->dpp_set_cursor_matrix_params.dpp = dpp;
- p->dpp_set_cursor_matrix_params.color_space =
- plane->color_space;
- p->dpp_set_cursor_matrix_params.cursor_csc_color_matrix =
- &plane->cursor_csc_color_matrix;
- break;
- case DPP_PROGRAM_BIAS_AND_SCALE:
- p->program_bias_and_scale_params.dpp = dpp;
- p->program_bias_and_scale_params.bias_and_scale =
- plane->bias_and_scale;
- break;
- case MPC_INSERT_PLANE:
- p->mpc_insert_plane_params.mpc = dc->res_pool->mpc;
- p->mpc_insert_plane_params.mpc_tree_params =
- &pipe->stream_res.opp->mpc_tree_params;
- dcn401_blnd_cfg(plane, &p->mpc_insert_plane_params.blnd_cfg);
- p->mpc_insert_plane_params.dpp_id = pipe->plane_res.hubp->inst;
- p->mpc_insert_plane_params.mpcc_id = pipe->plane_res.hubp->inst;
- break;
- case MPC_UPDATE_VISUAL_CONFIRM:
- p->update_visual_confirm_params.mpc = dc->res_pool->mpc;
- p->update_visual_confirm_params.color =
- &pipe->visual_confirm_color;
- p->update_visual_confirm_params.mpcc_id = pipe->plane_res.hubp->inst;
- break;
- case DPP_SET_SCALER:
- p->dpp_set_scaler_params.dpp = dpp;
- p->dpp_set_scaler_params.scl_data = &pipe->plane_res.scl_data;
- break;
- case HUBP_MEM_PROGRAM_VIEWPORT:
- p->hubp_mem_program_viewport_params.hubp = pipe->plane_res.hubp;
- p->hubp_mem_program_viewport_params.viewport =
- &pipe->plane_res.scl_data.viewport;
- p->hubp_mem_program_viewport_params.viewport_c =
- &pipe->plane_res.scl_data.viewport_c;
- break;
- case HUBP_PROGRAM_MCACHE_ID:
- p->program_mcache_id_and_split_coordinate.hubp = pipe->plane_res.hubp;
- p->program_mcache_id_and_split_coordinate.mcache_regs =
- &pipe->mcache_regs;
- break;
- case MPC_SET_GAMUT_REMAP_BYPASS:
- p->mpc_set_gamut_remap_bypass_params.mpc = dc->res_pool->mpc;
- p->mpc_set_gamut_remap_bypass_params.mpcc_id =
- pipe->plane_res.mpcc_inst;
- p->mpc_set_gamut_remap_bypass_params.block_id =
- m->mpc_set_gamut_remap_bypass.block_id;
- break;
- case MPC_POWER_ON_MPC_MEM_PWR:
- p->power_on_mpc_mem_pwr_params.mpc = dc->res_pool->mpc;
- p->power_on_mpc_mem_pwr_params.mpcc_id = pipe->plane_res.hubp->inst;
- p->power_on_mpc_mem_pwr_params.power_on = true;
- break;
- case MPC_SET_OCSC_DEFAULT:
- p->set_ocsc_default_params.mpc = dc->res_pool->mpc;
- p->set_ocsc_default_params.opp_id = pipe->stream_res.opp->inst;
- p->set_ocsc_default_params.color_space =
- pipe->stream->output_color_space;
- p->set_ocsc_default_params.ocsc_mode = MPC_OUTPUT_CSC_COEF_A;
- break;
- case HUBP_PROGRAM_SURFACE_CONFIG:
- p->program_surface_config_params.hubp = pipe->plane_res.hubp;
- p->program_surface_config_params.format = plane->format;
- p->program_surface_config_params.tiling_info =
- &plane->tiling_info;
- p->program_surface_config_params.plane_size =
- plane->plane_size;
- p->program_surface_config_params.plane_size.surface_size =
- pipe->plane_res.scl_data.viewport;
- p->program_surface_config_params.rotation = plane->rotation;
- p->program_surface_config_params.dcc = &plane->dcc;
- p->program_surface_config_params.horizontal_mirror =
- plane->horizontal_mirror;
- break;
- case HUBP_UPDATE_PLANE_ADDR:
- p->update_plane_addr_params.hubp = pipe->plane_res.hubp;
- p->update_plane_addr_params.address = plane->address;
- p->update_plane_addr_params.flip_immediate =
- plane->flip_immediate;
- p->update_plane_addr_params.dcc = plane->dcc.enable;
- break;
- case DPP_SET_HDR_MULTIPLIER:
- p->dpp_set_hdr_multiplier_params.dpp = dpp;
- p->dpp_set_hdr_multiplier_params.hw_mult =
- dcn401_hdr_mult(plane);
- break;
- case DPP_SET_PRE_DEGAM:
- p->dpp_set_pre_degam_params.dpp = dpp;
- p->dpp_set_pre_degam_params.in_transfer_func =
- &plane->in_transfer_func;
- break;
- case DPP_PROGRAM_GAMCOR_LUT:
- p->dpp_program_gamcor_lut_params.dpp = dpp;
- if (plane->in_transfer_func.type == TF_TYPE_HWPWL)
- p->dpp_program_gamcor_lut_params.params =
- &plane->in_transfer_func.pwl;
- break;
- case MPC_SET_MOVABLE_CM_LOCATION:
- p->mpc_set_movable_cm_location_params.mpc = dc->res_pool->mpc;
- p->mpc_set_movable_cm_location_params.location =
- MPCC_MOVABLE_CM_LOCATION_BEFORE;
- p->mpc_set_movable_cm_location_params.mpcc_id =
- pipe->plane_res.mpcc_inst;
- break;
- case MPC_PROGRAM_LUT_MODE:
- /*
- * Every LUT is off. DC1 reads the bank back with get_lut_mode;
- * the build reads no hardware, so it assumes bank A for an
- * MPCC that held no plane.
- */
- p->mpc_program_lut_mode_params.mpc = dc->res_pool->mpc;
- p->mpc_program_lut_mode_params.id = m->mpc_program_lut_mode.id;
- p->mpc_program_lut_mode_params.lut_bank_a = true;
- p->mpc_program_lut_mode_params.size = dcn401_lut_mode_size(
- plane, m->mpc_program_lut_mode.id);
- p->mpc_program_lut_mode_params.mpcc_id =
- pipe->plane_res.mpcc_inst;
- break;
- case HUBP_PROGRAM_3DLUT_FL_CONFIG:
- p->hubp_program_3dlut_fl_config_params.hubp = pipe->plane_res.hubp;
- p->hubp_program_3dlut_fl_config_params.config =
- &dcn401_3dlut_dma_off;
- break;
- case HUBP_SET_3DLUT_FL:
- p->hubp_set_3dlut_fl_params.hubp = pipe->plane_res.hubp;
- break;
- case MPC_SET_OUTPUT_GAMMA:
- p->mpc_set_output_gamma_params.mpc = dc->res_pool->mpc;
- p->mpc_set_output_gamma_params.mpcc_id =
- pipe->plane_res.mpcc_inst;
- if (pipe->stream->out_transfer_func.type == TF_TYPE_HWPWL)
- p->mpc_set_output_gamma_params.params =
- &pipe->stream->out_transfer_func.pwl;
- break;
- case HUBP_WAIT_FLIP_PENDING:
- p->hubp_wait_flip_pending_params.hubp = pipe->plane_res.hubp;
- p->hubp_wait_flip_pending_params.polling_interval_us =
- DCN401_FLIP_PENDING_POLL_INTERVAL_US;
- break;
- case OPTC_PROGRAM_MANUAL_TRIGGER:
- p->program_manual_trigger_params.tg = pipe->stream_res.tg;
- break;
- default:
- /* The step tables use only the funcs above. */
- ASSERT(false);
- break;
- }
-}
-
-static void dcn401_eval_pipe_deltas(const struct dcn401_commit_step_args *args,
- unsigned int idx, struct dcn401_pipe_deltas *deltas)
-{
- const struct dc_state_pipe_flags *cur_f =
- &args->update_flags->cur_pipes[idx];
- const struct dc_state_pipe_flags *new_f =
- &args->update_flags->new_pipes[idx];
- const struct pipe_ctx *cur = &args->current_state->res_ctx.pipe_ctx[idx];
- const struct pipe_ctx *new = &args->new_state->res_ctx.pipe_ctx[idx];
-
- deltas->hubp_dpp_already_enabled = cur_f->enabled && new_f->enabled &&
- cur->stream->stream_id == new->stream->stream_id &&
- cur->plane_res.hubp->inst == new->plane_res.hubp->inst &&
- cur->plane_res.dpp->inst == new->plane_res.dpp->inst &&
- cur->stream_res.opp->inst == new->stream_res.opp->inst;
- deltas->det_unchanged = cur_f->det_size == new_f->det_size;
- deltas->current_has_no_plane = !cur_f->has_plane;
- deltas->odm_kept = new->stream && dcn401_same_opp_heads(
- args->current_state, args->new_state, new->stream);
-}
-
-static bool dcn401_pipe_deltas_match(const struct dcn401_pipe_deltas *skip,
- const struct dcn401_pipe_deltas *deltas, bool all)
-{
- const bool named[] = { skip->hubp_dpp_already_enabled,
- skip->det_unchanged, skip->current_has_no_plane,
- skip->odm_kept };
- const bool set[] = { deltas->hubp_dpp_already_enabled,
- deltas->det_unchanged, deltas->current_has_no_plane,
- deltas->odm_kept };
- bool any = false;
- unsigned int i;
-
- for (i = 0; i < ARRAY_SIZE(named); i++) {
- if (!named[i])
- continue;
- if (all && !set[i])
- return false;
- any |= set[i];
- }
- return any;
-}
-
-static bool dcn401_skip_step(const struct dcn401_commit_step_args *args,
- const struct dcn401_commit_step *step)
-{
- const struct dcn401_pipe_deltas *skip = &step->meta.skip_if.pipe_deltas;
- struct dcn401_pipe_deltas deltas;
- const struct pipe_ctx *cur, *new;
-
- if (step->meta.skip_if.only_addresses_changed &&
- !args->hardware_remapped && !args->pipe_configs_changed)
- return true;
- if (step->meta.only_if.hardware_not_remapped && args->hardware_remapped)
- return true;
- if (step->meta.only_if.pipe_configs_not_changed &&
- args->pipe_configs_changed)
- return true;
- if (step->meta.skip_if.new_state_has_stream &&
- args->new_state->stream_count)
- return true;
- if (step->meta.skip_if.stream_unchanged && args->stream_unchanged)
- return true;
- if (step->meta.skip_if.optimized_not_required &&
- !args->dc->optimized_required)
- return true;
- if (step->meta.skip_if.no_ip_request &&
- (!args->dc->hwseq->funcs.pg_needs_ip_request ||
- !args->dc->hwseq->funcs.pg_needs_ip_request(args->dc)))
- return true;
- /* The remaining conditions are for per-pipe steps. */
- if (!args->pipe)
- return false;
- cur = &args->current_state->res_ctx.pipe_ctx[args->pipe->pipe_idx];
- new = &args->new_state->res_ctx.pipe_ctx[args->pipe->pipe_idx];
- dcn401_eval_pipe_deltas(args, args->pipe->pipe_idx, &deltas);
- if (step->meta.skip_if.no_addr_update &&
- !args->update_flags->new_pipes[args->pipe->pipe_idx]
- .plane.addr_update)
- return true;
- if (step->meta.skip_if.no_manual_trigger &&
- (!args->pipe->plane_state->update_bits.addr_update ||
- args->pipe->plane_state->skip_manual_trigger))
- return true;
- if (step->meta.skip_if.opp_tree_empty &&
- (!args->pipe->stream_res.opp ||
- !args->pipe->stream_res.opp->mpc_tree_params.opp_list))
- return true;
- if (step->meta.skip_if.no_dsc && !args->pipe->stream_res.dsc)
- return true;
- if (step->meta.skip_if.no_timing_sync_source &&
- !args->timing_sync_source)
- return true;
- if (dcn401_pipe_deltas_match(skip, &deltas,
- step->meta.skip_if.pipe_deltas_all))
- return true;
- if (step->meta.skip_if.scaling_unchanged &&
- !args->pipe->plane_state->update_bits.scaling_change &&
- !args->pipe->plane_state->update_bits.position_change &&
- !args->pipe->stream->update_flags.bits.scaling &&
- (!deltas.hubp_dpp_already_enabled ||
- !memcmp(&cur->plane_res.scl_data, &new->plane_res.scl_data,
- sizeof(cur->plane_res.scl_data))))
- return true;
- return false;
-}
-
-static void dcn401_add_steps(struct block_sequence_state *sequence,
- const struct dcn401_commit_step_args *args,
- const struct dcn401_commit_step *steps, unsigned int count)
-{
- unsigned int i;
-
- for (i = 0; i < count; i++) {
- if (!dcn401_skip_step(args, &steps[i]))
- dcn401_add_step(sequence, args, &steps[i]);
- }
-}
-
-static bool dcn401_walks_stream(const struct dcn401_commit_step_args *args,
- const struct dc_stream_state *stream)
-{
- if (args->stream)
- return stream->stream_id == args->stream->stream_id;
- return !dcn401_stream_kept(args->dc, args->current_state,
- args->new_state, stream);
-}
-
-/*
- * The OTG master that pipe resets to, chosen as program_timing_sync does:
- * the first OTG master with the same timing that shows a plane, else the
- * first one. NULL when that is pipe.
- */
-static const struct pipe_ctx *dcn401_timing_sync_source(
- const struct dcn401_commit_step_args *args,
- const struct pipe_ctx *pipe)
-{
- const struct dc_state_update_flags *flags = args->update_flags;
- const struct pipe_ctx *source = NULL;
- const struct pipe_ctx *member;
- unsigned int i;
-
- if (args->dc->debug.disable_timing_sync)
- return NULL;
- for (i = 0; i < args->dc->res_pool->pipe_count; i++) {
- member = &args->new_state->res_ctx.pipe_ctx[i];
- if (!member->stream || member->top_pipe ||
- member->prev_odm_pipe ||
- !resource_are_streams_timing_synchronizable(
- member->stream, pipe->stream))
- continue;
- if (flags->cur_pipes[i].has_plane &&
- flags->new_pipes[i].has_plane) {
- source = member;
- break;
- }
- if (!source)
- source = member;
- }
- if (!source || source->pipe_idx == pipe->pipe_idx)
- return NULL;
- return source;
-}
-
-static void dcn401_add_per_otg_master(struct block_sequence_state *sequence,
- const struct dcn401_commit_step_args *state_args,
- struct dc_state *state,
- const struct dcn401_commit_step *steps, unsigned int count)
-{
- struct dcn401_commit_step_args args = *state_args;
- unsigned int i;
-
- for (i = 0; i < state->stream_count; i++) {
- if (!dcn401_walks_stream(&args, state->streams[i]))
- continue;
- args.pipe = resource_get_otg_master_for_stream(
- &state->res_ctx, state->streams[i]);
- if (!args.pipe)
- continue;
- args.timing_sync_source = dcn401_timing_sync_source(&args,
- args.pipe);
- dcn401_add_steps(sequence, &args, steps, count);
- }
-}
-
-static void dcn401_add_per_opp_head(struct block_sequence_state *sequence,
- const struct dcn401_commit_step_args *state_args,
- struct dc_state *state,
- const struct dcn401_commit_step *steps, unsigned int count)
-{
- struct dcn401_commit_step_args args = *state_args;
- struct pipe_ctx *opp_heads[MAX_PIPES];
- unsigned int i;
- int j, n;
-
- for (i = 0; i < state->stream_count; i++) {
- if (!dcn401_walks_stream(&args, state->streams[i]))
- continue;
- n = resource_get_opp_heads_for_stream(state->streams[i],
- &state->res_ctx, opp_heads);
- for (j = 0; j < n; j++) {
- args.pipe = opp_heads[j];
- dcn401_add_steps(sequence, &args, steps, count);
- }
- }
-}
-
-static void dcn401_add_per_dpp_pipe(struct block_sequence_state *sequence,
- const struct dcn401_commit_step_args *state_args,
- struct dc_state *state, const struct dcn401_sub_sequence *sub)
-{
- struct dcn401_commit_step_args args = *state_args;
- struct pipe_ctx *dpp_pipes[MAX_PIPES];
- unsigned int i, k;
- int j, n;
-
- for (i = 0; i < state->stream_count; i++) {
- if (!dcn401_walks_stream(&args, state->streams[i]))
- continue;
- n = resource_get_dpp_pipes_for_stream(state->streams[i],
- &state->res_ctx, dpp_pipes);
- for (j = 0; j < n; j++) {
- args.pipe = dpp_pipes[j];
- if (!sub->stages) {
- dcn401_add_steps(sequence, &args, sub->steps,
- sub->count);
- continue;
- }
- for (k = 0; k < sub->stage_count; k++)
- dcn401_add_steps(sequence, &args,
- sub->stages[k].steps,
- sub->stages[k].count);
- }
- }
-}
-
-void dcn401_add_sub_sequences(struct block_sequence_state *sequence,
- const struct dcn401_commit_step_args *state_args,
- const struct dcn401_sub_sequence *subs, unsigned int count)
-{
- const struct dcn401_sub_sequence *sub;
- struct dc_state *state;
- unsigned int i;
-
- for (i = 0; i < count; i++) {
- sub = &subs[i];
- state = sub->flags & DCN401_CURRENT_STATE ?
- state_args->current_state :
- state_args->new_state;
- if (sub->flags & DCN401_PER_STREAM_PER_OTG_MASTER)
- dcn401_add_per_otg_master(sequence, state_args, state,
- sub->steps, sub->count);
- else if (sub->flags & DCN401_PER_STREAM_PER_OPP_HEAD)
- dcn401_add_per_opp_head(sequence, state_args, state,
- sub->steps, sub->count);
- else if (sub->flags & DCN401_PER_STREAM_PER_DPP_PIPE)
- dcn401_add_per_dpp_pipe(sequence, state_args, state, sub);
- else
- dcn401_add_steps(sequence, state_args, sub->steps,
- sub->count);
- }
-}
-
-void dcn401_init_and_unpack_params(
- struct bls_builder_declarative_params *params,
- struct dcn401_commit_step_args *state_args,
- struct block_sequence_state *head)
-{
- state_args->dc = params->dc;
- state_args->current_state = (struct dc_state *)params->current_state;
- state_args->new_state = (struct dc_state *)params->new_state;
- state_args->stream = NULL;
- state_args->pipe = NULL;
- state_args->update_flags = params->update_flags;
- state_args->stream_unchanged = false;
- state_args->hardware_remapped = true;
- state_args->pipe_configs_changed = true;
- state_args->timing_sync_source = NULL;
-
- params->head_num_steps = 0;
- params->tail_num_steps = 0;
- head->steps = params->head_sequence;
- head->num_steps = ¶ms->head_num_steps;
-}
-
/*
* The waits and the bandwidth raise, then the updated stream only.
* skip_if drops the steps a kept pipe or ODM layout does not need, so
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 29/30] drm/amd/display: Allow disabling CRC capture when the stream is gone
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (27 preceding siblings ...)
2026-12-01 20:23 ` [PATCH v2 28/30] drm/amd/display: Move shared dcn401 builder code to its own file George Zhang
@ 2026-12-01 20:23 ` George Zhang
2026-12-01 20:52 ` sashiko-bot
2026-12-01 20:23 ` [PATCH v2 30/30] drm/amd/display: Promote DC to 3.2.410 George Zhang
29 siblings, 1 reply; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:23 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, James Lin, George Zhang
From: James Lin <pinglei.lin@amd.com>
[Why]
Stopping CRC capture while the CRTC has no stream (e.g. after DPMS off)
makes amdgpu_dm_crtc_configure_crc_source() return -EINVAL. That aborts
amdgpu_dm_crtc_set_crc_source() before it clears crc_src and resets
crc_skip_count. The stale crc_src makes the CRC handler capture again as
soon as the next stream is enabled, and with crc_skip_count still >= 2 the
first (all-zero) CRC of the fresh CRC engine is reported to userspace.
This shows up as intermittent failures of
igt@kms_pipe_crc_basic@disable-crc-after-crtc
(CRC mismatch, 0x59b7 != 0x0).
[How]
Only return -EINVAL for a missing stream when enabling, where programming
is deferred to stream enable. When disabling there is nothing to program,
so return success and let the caller drop its vblank reference, clear
crc_src and reset the skip count. Also clear the positive
remaining-jiffies value returned by
wait_for_completion_interruptible_timeout() so a successful wait for a
pending commit isn't returned to the caller as a non-zero result.
Signed-off-by: James Lin <pinglei.lin@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c | 12 ++++++++++--
.../amd/display/amdgpu_dm/tests/amdgpu_dm_crc_test.c | 4 ++--
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c
index db546dd44b91..07b3bc45ac86 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c
@@ -577,9 +577,13 @@ int amdgpu_dm_crtc_configure_crc_source(struct drm_crtc *crtc,
int ret = 0;
enum crc_poly_mode crc_poly_mode = CRC_POLY_MODE_16;
- /* Configuration will be deferred to stream enable. */
+ /*
+ * Enabling is deferred to stream enable. Disabling with no stream (e.g.
+ * DPMS off) has nothing to program, but must still succeed so the caller
+ * clears crc_src and the skip count.
+ */
if (!stream_state)
- return -EINVAL;
+ return enable ? -EINVAL : 0;
mutex_lock(&adev->dm.dc_lock);
@@ -696,6 +700,10 @@ int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name)
ret = -ETIMEDOUT;
goto cleanup;
}
+
+ /* Wait succeeded; don't leak the remaining jiffies. */
+ if (ret > 0)
+ ret = 0;
}
enable = amdgpu_dm_is_valid_crc_source(source);
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crc_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crc_test.c
index 7f6340702502..b9c0e5a87bf8 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crc_test.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crc_test.c
@@ -581,7 +581,7 @@ static void dm_test_crtc_set_crc_source_none_no_stream(struct kunit *test)
ret = amdgpu_dm_crtc_set_crc_source(&acrtc->base, "none");
- KUNIT_EXPECT_EQ(test, ret, -EINVAL);
+ KUNIT_EXPECT_EQ(test, ret, 0);
KUNIT_EXPECT_EQ(test, acrtc->dm_irq_params.crc_src,
AMDGPU_DM_PIPE_CRC_SOURCE_NONE);
KUNIT_EXPECT_EQ(test, dm_state->crc_skip_count, 0);
@@ -618,7 +618,7 @@ static void dm_test_crtc_set_crc_source_none_commit(struct kunit *test)
ret = amdgpu_dm_crtc_set_crc_source(&acrtc->base, "none");
- KUNIT_EXPECT_EQ(test, ret, -EINVAL);
+ KUNIT_EXPECT_EQ(test, ret, 0);
KUNIT_EXPECT_EQ(test, dm_state->crc_skip_count, 0);
}
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* [PATCH v2 30/30] drm/amd/display: Promote DC to 3.2.410
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
` (28 preceding siblings ...)
2026-12-01 20:23 ` [PATCH v2 29/30] drm/amd/display: Allow disabling CRC capture when the stream is gone George Zhang
@ 2026-12-01 20:23 ` George Zhang
2026-12-01 20:45 ` sashiko-bot
29 siblings, 1 reply; 42+ messages in thread
From: George Zhang @ 2026-12-01 20:23 UTC (permalink / raw)
To: amd-gfx
Cc: Harry Wentland, Leo Li, Aurabindo Pillai, Roman Li, Wayne Lin,
Tom Chung, Fangzhi Zuo, Dan Wheeler, Ray Wu, Ivan Lipski,
Alex Hung, James Lin, Chenyu Chen, Taimur Hassan, George Zhang
From: Taimur Hassan <Syed.Hassan@amd.com>
This version brings along the following updates:
- Harden AUX handling: clamp the AUX reply length as unsigned, keep the
DPCD read result signed in the MST ISR, and copy only the status byte
on a DMUB AUX write status retry, with a test for the reply copy
- Cast the clamped rate conversion
- Make BLS sequences compliant: split HWSS_CURSOR_LOCK into flat BLS
operations and make DPP_SET_INPUT_TRANSFER_FUNC BLS compliant
- Account for downspread and DFS in clock validation and read the max
LSDMA bandwidth from DMU
- Precompute EASF lookup thresholds
- Add pipe init to core2
- Fix HDMI FRL no_timeout behavior
- Re-enable driver-controlled HUBP/DPP power gating on DCN42 and DCN42b
- DC2: program DSC on one stream, program YCbCr output, flip every DPP
pipe of the stream, skip streams with no OTG master, and sync OTG
timing in the non-seamless commit
- DC2: add a per-ASIC default for DC2 selection and report BLS step
overflow behind a debug option
- Disable Replay and PSR across GPU reset and correctly block Panel
Replay on MST
- Cover gamma 2.4 and 2.6 on the wide curve
- Improve P-state admissibility logic and revoke alternate channel
P-State before pipe teardown
- Refactor Max VStartup calculations for DCN6
- Add VRR support on direct MST sinks
- Move shared dcn401 builder code to its own file
Signed-off-by: Taimur Hassan <Syed.Hassan@amd.com>
Signed-off-by: George Zhang <george.zhang@amd.com>
---
drivers/gpu/drm/amd/display/dc/dc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index 134204f4b051..f25e75b44c93 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -69,7 +69,7 @@ struct dcn_dsc_reg_state;
struct dcn_optc_reg_state;
struct dcn_dccg_reg_state;
-#define DC_VER "3.2.409"
+#define DC_VER "3.2.410"
/**
* MAX_SURFACES - representative of the upper bound of surfaces that can be piped to a single CRTC
--
2.56.1
^ permalink raw reply related [flat|nested] 42+ messages in thread
* Re: [PATCH v2 12/30] drm/amd/display: Fix HDMI FRL no_timeout behavior
2026-12-01 20:22 ` [PATCH v2 12/30] drm/amd/display: Fix HDMI FRL no_timeout behavior George Zhang
@ 2026-12-01 20:42 ` sashiko-bot
0 siblings, 0 replies; 42+ messages in thread
From: sashiko-bot @ 2026-12-01 20:42 UTC (permalink / raw)
To: George Zhang, amd-gfx
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/amd/display: missing no_timeout polling rate increase
claimed in changelog
- [Low] drm/amd/display: missing Fixes trailer for commit c8d099259904
--
commit c6127408b449b7b1a69c9edf832e893b8033ab7e
Author: Ilya Bakoulin <Ilya.Bakoulin@amd.com>
> drm/amd/display: Fix HDMI FRL no_timeout behavior
>
> [Why/How]
> Addresses a couple issues encountered while running compliance tests
> that assert the no_timeout flag:
> - Handle a couple of additional cases where link rate is not updated
> properly during a no_timeout test sequence due to the link not being
> cycled on/off
> - Increase polling rate while no_timeout is asserted to ensure we
> respond to updates in a reasonable amount of time (<10ms)
>
> Cc: Chris Park <chris.park@amd.com>
> Signed-off-by: Ilya Bakoulin <Ilya.Bakoulin@amd.com>
> Signed-off-by: George Zhang <george.zhang@amd.com>
[Severity: Low]
Commit c8d099259904 ("drm/amd/display: Fix FFE test automation link rate
change") added the no_timeout link-cycling logic in
hdmi_frl_perform_link_training_with_fallback() but missed
enable_link_hdmi_frl() and hdmi_frl_set_preferred_link_settings(). Should
this include a Fixes: tag?
Fixes: c8d099259904 ("drm/amd/display: Fix FFE test automation link rate change")
> diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_hdmi_frl.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_hdmi_frl.c
> index cb201c9ee3c63..2355881749408 100644
> --- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_hdmi_frl.c
> +++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_hdmi_frl.c
> @@ -781,6 +781,20 @@ static enum link_result hdmi_frl_perform_link_training(struct ddc_service *ddc_s
> return result;
> }
>
> +/* disable_link_output is a no-op while in FLT_no_timeout mode, so if the FRL
> + * rate changed since the no_timeout training, cycle the link off here so that
> + * the subsequent PHY setup properly applies the new link rate.
> + */
> +void hdmi_frl_cycle_link_on_no_timeout_rate_change(struct dc_link *link)
> +{
> + if (!link->frl_flags.no_timeout ||
> + link->frl_flags.no_timeout_frl_link_rate == link->frl_link_settings.frl_link_rate)
> + return;
> +
> + link->hpo_frl_link_enc->funcs->disable_link_encoder(link->hpo_frl_link_enc);
> + link->link_enc->funcs->disable_output(link->link_enc, SIGNAL_TYPE_HDMI_FRL);
> +}
[Severity: Medium]
Was the polling rate change mentioned in the commit message omitted from
this patch?
The commit message says this patch increases the polling rate while
no_timeout is asserted to respond in under 10ms, but the diff only extracts
and calls hdmi_frl_cycle_link_on_no_timeout_rate_change().
hdmi_frl_status_polling_work() in amdgpu_dm_connector.c still schedules
dm->hdmi_frl_status_polling_work with the fixed 200ms
dm->hdmi_frl_status_polling_delay_ms interval when
link->frl_flags.no_timeout is true.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201202451.463794-2-george.zhang@amd.com?part=12
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 30/30] drm/amd/display: Promote DC to 3.2.410
2026-12-01 20:23 ` [PATCH v2 30/30] drm/amd/display: Promote DC to 3.2.410 George Zhang
@ 2026-12-01 20:45 ` sashiko-bot
0 siblings, 0 replies; 42+ messages in thread
From: sashiko-bot @ 2026-12-01 20:45 UTC (permalink / raw)
To: George Zhang, amd-gfx
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/amd/display: DC 3.2.410 promotion changelog mismatch with
series commits
--
commit d44c142751175f69f49e5d3c3e1947c837955596
Author: Taimur Hassan <Syed.Hassan@amd.com>
drm/amd/display: Promote DC to 3.2.410
This commit bumps the Display Core version macro DC_VER to 3.2.410 and
summarizes the changes included in the promotion series.
> - Disable Replay and PSR across GPU reset and correctly block Panel
> Replay on MST
[Severity: Low]
Does this changelog summary match the commits in the 3.2.410 promotion
series? The series includes commit "drm/amd/display: block pr in mst
right", but has no commit disabling Replay and PSR across GPU reset, and
the summary omits commit "drm/amd/display: Allow disabling CRC capture
when the stream is gone".
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201202451.463794-2-george.zhang@amd.com?part=30
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 18/30] drm/amd/display: block pr in mst right
2026-12-01 20:22 ` [PATCH v2 18/30] drm/amd/display: block pr in mst right George Zhang
@ 2026-12-01 20:46 ` sashiko-bot
0 siblings, 0 replies; 42+ messages in thread
From: sashiko-bot @ 2026-12-01 20:46 UTC (permalink / raw)
To: George Zhang, amd-gfx
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/amd/display: unguarded link_enc dereference in
dp_setup_panel_replay()
--
commit e59fe77bf19f365a90e441cbffda3fd425f69a9b
Author: Peichen Huang <PeiChen.Huang@amd.com>
drm/amd/display: block pr in mst right
This commit checks the stream signal rather than the connector signal to
verify that a link is DP SST for Panel Replay, and guards against a NULL
link->link_enc in dp_pr_copy_settings().
> diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.c
> index 65a791ccf6b2d..24cc882eb1680 100644
> --- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.c
> +++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.c
[ ... ]
> @@ -315,7 +313,7 @@ bool dp_pr_copy_settings(struct dc_link *link, struct replay_context *replay_con
> else
> cmd.pr_copy_settings.data.otg_inst = 0;
>
> - cmd.pr_copy_settings.data.dpphy_inst = link->link_enc->transmitter;
> + cmd.pr_copy_settings.data.dpphy_inst = link->link_enc ? (uint8_t)link->link_enc->transmitter : 0;
>
> 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);
[Severity: Medium]
Can dp_setup_panel_replay() still dereference a NULL link->link_enc before
calling dp_pr_copy_settings()?
When link->link_enc is NULL (for example on a USB4 DPIA link), the sole
caller dp_setup_panel_replay() unconditionally dereferences link->link_enc
before reaching this new check:
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.c:dp_setup_panel_replay() {
...
replay_context.aux_inst = (enum channel_id) link_get_ddc_aux_inst(link);
replay_context.digbe_inst = link->link_enc->transmitter;
replay_context.digfe_inst = link->link_enc->preferred_engine;
...
link->replay_settings.replay_feature_enabled = dp_pr_copy_settings(link, &replay_context);
...
}
Setting up Panel Replay on a link with a NULL link->link_enc will trigger a
NULL pointer dereference in dp_setup_panel_replay().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201202451.463794-2-george.zhang@amd.com?part=18
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 07/30] drm/amd/display: Account for downspread and DFS in clock validation
2026-12-01 20:22 ` [PATCH v2 07/30] drm/amd/display: Account for downspread and DFS in clock validation George Zhang
@ 2026-12-01 20:49 ` sashiko-bot
0 siblings, 0 replies; 42+ messages in thread
From: sashiko-bot @ 2026-12-01 20:49 UTC (permalink / raw)
To: George Zhang, amd-gfx
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/amd/display: precision mismatch in cga_dcn6_initialize()
DFS ceiling
- [Low] drm/amd/display: missing Fixes: trailer for commit 7f7d7ea1fa51
--
commit 89c9a06cc3d1454a268be85d4e1c884dc45f81fd
Author: Ilya Bakoulin <Ilya.Bakoulin@amd.com>
> drm/amd/display: Account for downspread and DFS in clock validation
>
> [Why]
> ODM selection can choose a combine factor that fails the final DISPCLK
> check when downspread raises the clock requirement above the limit.
> Clamping ramp margin to a cap between DFS steps can also round the
> request up past the cap even when the mandatory clock fits.
>
> [How]
> Use the highest supported DFS step for the DCN6 ramp-margin clamp and
> account for downspread when passing that ceiling to ODM selection.
> Preserve the final check for mandatory clock requirements. Derive the
> DISPCLK ceiling from the highest DFS step at or below the clock
> table's maximum DISPCLK, floored to whole kHz.
>
> Account for downspread in the DCN5 DISPCLK, DPPCLK, and DSCCLK limits.
>
> Cc: Wenjing Liu <wenjing.liu@amd.com>
> Signed-off-by: Ilya Bakoulin <Ilya.Bakoulin@amd.com>
> Signed-off-by: George Zhang <george.zhang@amd.com>
[Severity: Low]
This fixes clock validation in DCN5 and DCN6. Should it include a Fixes:
tag for 7f7d7ea1fa51 ("drm/amd/display: Add new sources for DCN6")?
> diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_cga/dml2_cga_dcn6.c b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_cga/dml2_cga_dcn6.c
> index 43ee8a0b21b3c..2817340a0586b 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_cga/dml2_cga_dcn6.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_cga/dml2_cga_dcn6.c
[ ... ]
> @@ -40,11 +63,11 @@ static double cga_dcn6_calculate_actual_dispclk_mhz(const struct dml2_clock_gran
> dispclk_with_downspread_mhz = cga_dcn6_add_overhead_percent(dispclk_mhz, adjuster->dcn_downspread_percent);
> dispclk_with_ramp_margin_mhz = cga_dcn6_add_overhead_percent(
> dispclk_with_downspread_mhz, adjuster->dispclk_ramp_margin_percent);
> - if (dispclk_with_downspread_mhz <= adjuster->max_dispclk_mhz &&
> - dispclk_with_ramp_margin_mhz > adjuster->max_dispclk_mhz)
> - /* when dispclk with ramp margin is slightly over max, clamp the ramp margin to the max dispclk */
> - return math_floor2(adjuster->max_dispclk_mhz, CLOCK_UNIT_GRANULARITY);
> - else if (dispclk_with_downspread_mhz > adjuster->max_dispclk_mhz)
> + if (dispclk_with_downspread_mhz <= adjuster->max_adjusted_dispclk_mhz &&
> + dispclk_with_ramp_margin_mhz > adjuster->max_adjusted_dispclk_mhz)
> + /* Clamp optional ramp margin to the highest reachable DFS clock. */
> + return adjuster->max_adjusted_dispclk_mhz;
> + else if (dispclk_with_downspread_mhz > adjuster->max_adjusted_dispclk_mhz)
> return math_floor2(dispclk_with_downspread_mhz, CLOCK_UNIT_GRANULARITY);
> else
> return math_floor2(dispclk_with_ramp_margin_mhz, CLOCK_UNIT_GRANULARITY);
> @@ -63,8 +86,7 @@ static double cga_dcn6_adjust_to_dfs_clock_value_mhz(const struct dml2_clock_gra
> /* There are cases when a clock is not needed */
> return 0;
>
> - vco_speed_scaled_mhz = math_floor2(adjuster->dispclk_dppclk_vco_speed_mhz, 0.001);
> - vco_speed_scaled_mhz *= DFS_DIVIDER_RANGE_SCALE_FACTOR;
> + vco_speed_scaled_mhz = cga_dcn6_scaled_vco_mhz(adjuster);
> vco_divider = vco_speed_scaled_mhz / clk_mhz;
> vco_divider = math_floor(vco_divider);
> adjusted_clock_mhz = vco_speed_scaled_mhz / vco_divider;
> @@ -137,11 +159,16 @@ static double cga_dcn6_adjust_dcfclk_deepsleep_mhz(const struct dml2_clock_granu
>
> static void cga_dcn6_initialize(const struct dml2_cga_initialize_in_out *in_out)
> {
> + const struct dml2_clk_table *dispclk = &in_out->soc_bb->clk_table.dispclk;
> +
> in_out->adjuster->dcn_downspread_percent = in_out->soc_bb->dcn_downspread_percent;
> in_out->adjuster->dispclk_dppclk_vco_speed_mhz = in_out->soc_bb->dispclk_dppclk_vco_speed_mhz;
> in_out->adjuster->dispclk_ramp_margin_percent = in_out->ip->dispclk_ramp_margin_percent;
> + in_out->adjuster->max_adjusted_dispclk_mhz =
> + cga_dcn6_max_dfs_dispclk_khz(in_out->adjuster,
> + dispclk->clk_values_khz[dispclk->num_clk_values - 1]) / 1000.0;
> in_out->adjuster->max_dispclk_mhz =
> - in_out->soc_bb->clk_table.dispclk.clk_values_khz[in_out->soc_bb->clk_table.dispclk.num_clk_values - 1] / 1000.0;
> + in_out->adjuster->max_adjusted_dispclk_mhz / (1.0 + in_out->soc_bb->dcn_downspread_percent / 100.0);
> }
[Severity: Medium]
Can computing max_adjusted_dispclk_mhz via `/ 1000.0` cause
dcn6_ms_check_dispclk_and_dppclk_support() to reject valid modes at the
top DFS step?
cga_dcn6_adjust_to_dfs_clock_value_mhz() quantizes RequiredDISPCLK with
math_floor2(..., CLOCK_UNIT_GRANULARITY), which multiplies the integer kHz
value K by 0.001 (`((int)(arg / 0.001)) * 0.001`). In IEEE 754 binary64,
0.001 is strictly greater than 1.0 / 1000.0, so for many integer kHz
values (e.g. K = 1309090 kHz at 3600 MHz VCO / divider 11), `K * 0.001`
is 1 ULP larger than `K / 1000.0`. Moreover, when scaled_vco_khz is an
exact multiple of the divider and `K / 1000.0` rounds up, passing a
clamped `clk_mhz = adjuster->max_adjusted_dispclk_mhz` into
cga_dcn6_adjust_to_dfs_clock_value_mhz() yields `vco_speed_scaled_mhz /
clk_mhz < divider`, so math_floor(vco_divider) steps down to `divider - 1`
and bumps RequiredDISPCLK to the next higher DFS step. In both cases,
`inputs->RequiredDISPCLK <= ctx->clock_adjuster->max_adjusted_dispclk_mhz`
fails.
Multiplying the kHz value by CLOCK_UNIT_GRANULARITY (or passing the
unfloored DFS clock for the top divider through
cga_dcn6_adjust_to_dfs_clock_value_mhz()) would keep both sides on the
same floating-point representation.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201202451.463794-2-george.zhang@amd.com?part=7
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 21/30] drm/amd/display: Improve P-state admissability logic
2026-12-01 20:22 ` [PATCH v2 21/30] drm/amd/display: Improve P-state admissability logic George Zhang
@ 2026-12-01 20:50 ` sashiko-bot
0 siblings, 0 replies; 42+ messages in thread
From: sashiko-bot @ 2026-12-01 20:50 UTC (permalink / raw)
To: George Zhang, amd-gfx
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/amd/display: vblank_nom not replaced in
dcn6_build_pstate_meta_per_stream()
- [Medium] drm/amd/display: v_total vs vblank_nom mismatch in DCN6
pstate admissibility
--
commit 0206c2992e2de04f212b5f64a6b0b9d2d0262f39
Author: Dillon Varone <Dillon.Varone@amd.com>
drm/amd/display: Improve P-state admissability logic
This commit updates DCN6 P-state schedule window and admissibility
calculations to include unallocated VBlank lines when VStartup is smaller
than VBlank, and clamps the per-stream ideal P-state disallow time to the
allow delay divided by the number of streams.
> diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.c b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.c
> index 69439ec644e01..7b7fa428958eb 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.c
> @@ -1715,6 +1715,8 @@ void dcn6_calculate_pstate_schedule_windows(
> int num_active_planes,
> const unsigned int v_blank_start[DML2_MAX_PLANES],
> const unsigned int v_blank_end[DML2_MAX_PLANES],
> + const unsigned int v_startup[DML2_MAX_PLANES],
> + const unsigned int v_total[DML2_MAX_PLANES],
> const double otg_vline_time_us[DML2_MAX_PLANES],
> const double det_fill_delay_us[DML2_MAX_PLANES],
> const double reserved_vblank_us[DML2_MAX_PLANES],
> @@ -1728,6 +1730,7 @@ void dcn6_calculate_pstate_schedule_windows(
> int det_fill_delay_otg_vlines;
> int blackout_otg_vlines;
> int reserved_vblank_otg_vlines;
> + int unallocated_vblank_otg_vlines;
>
> /**
> * Calculate allow start and end for pstate in vactive:
> @@ -1742,10 +1745,13 @@ void dcn6_calculate_pstate_schedule_windows(
> blackout_otg_vlines = (int)(math_ceil(blackout_us / otg_vline_time_us[k]));
> det_fill_delay_otg_vlines = (int)(math_ceil(det_fill_delay_us[k] / otg_vline_time_us[k]));
> reserved_vblank_otg_vlines = (int)(math_ceil(reserved_vblank_us[k] / otg_vline_time_us[k]));
> + unallocated_vblank_otg_vlines = v_total[k] - v_blank_start[k] + v_blank_end[k] - v_startup[k];
>
> /* for vactive only, make relative to vblank end */
> allow_start_otg_vlines = det_fill_delay_otg_vlines;
> - allow_end_otg_vlines = v_blank_start[k] - v_blank_end[k] - (blackout_otg_vlines - reserved_vblank_otg_vlines);
> + allow_end_otg_vlines = v_blank_start[k] - v_blank_end[k] +
> + unallocated_vblank_otg_vlines -
> + (blackout_otg_vlines - reserved_vblank_otg_vlines);
>
> /* Convert them back to time since the start of a frame */
> allow_start_us[k] = allow_start_otg_vlines * otg_vline_time_us[k];
[Severity: Medium]
Does adding unallocated_vblank_otg_vlines (computed from v_total) to
allow_end_otg_vlines cause dcn6_calculate_pstate_schedule_admissibility()
to under-calculate disallow_window_us when v_total - v_active exceeds
vblank_nom?
dcn6_ms_check_pstate_schedule_admissibility() computes frame_time_us[k] via
dml2_core_utils_get_frame_time_us(), which uses vblank_nom + v_active
rather than v_total:
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_utils.c:dml2_core_utils_get_frame_time_us() {
double otg_vline_time_us = (double)stream->timing.h_total / (double)stream->timing.pixel_clock_khz * 1000.0;
double non_vtotal = stream->timing.vblank_nom + stream->timing.v_active;
double frame_time_us = non_vtotal * otg_vline_time_us;
When dcn6_calculate_pstate_schedule_admissibility() computes
disallow_window_us[cur_id] = group_frame_time_us - allow_window_us[cur_id],
subtracting a v_total-based allow_window_us from a (vblank_nom + v_active)
frame time double-subtracts (v_total - v_active - vblank_nom) lines. On
timings whose VBlank exceeds vblank_nom, this reduces or zeroes
disallow_window_us and lets non-admissible P-state schedules pass mode
support validation.
[ ... ]
> diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c
> index 71407eec2d836..44cc7de4d8dc7 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c
[ ... ]
> @@ -836,11 +848,12 @@ static void dcn6_build_pstate_meta_per_stream(const struct dml2_display_cfg *dis
> if (stream_pstate_meta->method_vactive.max_vactive_det_fill_delay_us > 0.0) {
> stream_pstate_meta->method_vactive.common.allow_start_otg_vline =
> timing->v_blank_end + stream_pstate_meta->method_vactive.max_vactive_det_fill_delay_otg_vlines;
> +
> stream_pstate_meta->method_vactive.common.allow_end_otg_vline =
> stream_pstate_meta->vblank_start +
> stream_pstate_meta->nom_vtotal -
> stream_descriptor->timing.v_active -
> - stream_descriptor->timing.vblank_nom -
> + stream_pstate_meta->method_vactive.vstartup_lines -
> stream_pstate_meta->blackout_otg_vlines +
> stream_pstate_meta->method_vactive.reserved_blank_required_vlines;
> } else {
[Severity: Medium]
Should the max allow delay enforcement immediately above in
dcn6_build_pstate_meta_per_stream() also subtract
stream_pstate_meta->method_vactive.vstartup_lines instead of
stream_descriptor->timing.vblank_nom?
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c:dcn6_build_pstate_meta_per_stream() {
...
/* consider max allow delay enforcement */
if (stream_pstate_meta->method_vactive.max_vactive_det_fill_delay_otg_vlines > 0) {
stream_pstate_meta->method_vactive.max_vactive_det_fill_delay_otg_vlines = (int)math_min2(
(double)stream_pstate_meta->method_vactive.max_vactive_det_fill_delay_otg_vlines,
math_max2(0.0,
stream_pstate_meta->max_allow_delay_otg_vlines +
stream_pstate_meta->method_vactive.reserved_blank_required_vlines -
(int)stream_descriptor->timing.vblank_nom -
stream_pstate_meta->blackout_otg_vlines));
} else {
stream_pstate_meta->method_vactive.max_vactive_det_fill_delay_otg_vlines = (int)math_max2(0.0,
stream_pstate_meta->max_allow_delay_otg_vlines +
stream_pstate_meta->method_vactive.reserved_blank_required_vlines -
(int)stream_descriptor->timing.vblank_nom -
stream_pstate_meta->blackout_otg_vlines);
}
...
}
When vstartup_lines < vblank_nom, subtracting vblank_nom underestimates
max_vactive_det_fill_delay_otg_vlines by (vblank_nom - vstartup_lines) and
can clamp max_vactive_det_fill_delay_us to 0.0, which skips the allow
window calculation above and leaves allow_start_otg_vline and
allow_end_otg_vline at 0. Similarly,
dcn6_update_worksheet_for_pstate_admissibility() still computes
vblank_time_us from timing.vblank_nom rather than vstartup_lines when
bounding delta_reserved_vblank_time_us, which can reserve more VBlank time
than fits in VStartup.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201202451.463794-2-george.zhang@amd.com?part=21
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 29/30] drm/amd/display: Allow disabling CRC capture when the stream is gone
2026-12-01 20:23 ` [PATCH v2 29/30] drm/amd/display: Allow disabling CRC capture when the stream is gone George Zhang
@ 2026-12-01 20:52 ` sashiko-bot
0 siblings, 0 replies; 42+ messages in thread
From: sashiko-bot @ 2026-12-01 20:52 UTC (permalink / raw)
To: George Zhang, amd-gfx
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/amd/display: -ERESTARTSYS leak in
amdgpu_dm_crtc_set_crc_source()
- [Low] drm/amd/display: missing Fixes trailers for CRC disable and wait
fixes
--
commit 2f86e15468fe1d63c83a78c1c2e170de1de07582
Author: James Lin <pinglei.lin@amd.com>
> drm/amd/display: Allow disabling CRC capture when the stream is gone
>
> [Why]
> Stopping CRC capture while the CRTC has no stream (e.g. after DPMS off)
> makes amdgpu_dm_crtc_configure_crc_source() return -EINVAL. That aborts
> amdgpu_dm_crtc_set_crc_source() before it clears crc_src and resets
> crc_skip_count. The stale crc_src makes the CRC handler capture again as
> soon as the next stream is enabled, and with crc_skip_count still >= 2 the
> first (all-zero) CRC of the fresh CRC engine is reported to userspace.
> This shows up as intermittent failures of
> igt@kms_pipe_crc_basic@disable-crc-after-crtc
> (CRC mismatch, 0x59b7 != 0x0).
>
> [How]
> Only return -EINVAL for a missing stream when enabling, where programming
> is deferred to stream enable. When disabling there is nothing to program,
> so return success and let the caller drop its vblank reference, clear
> crc_src and reset the skip count. Also clear the positive
> remaining-jiffies value returned by
> wait_for_completion_interruptible_timeout() so a successful wait for a
> pending commit isn't returned to the caller as a non-zero result.
>
> Signed-off-by: James Lin <pinglei.lin@amd.com>
> Signed-off-by: George Zhang <george.zhang@amd.com>
[Severity: Low]
Should this bug fix include Fixes tags for the commits that introduced the
-EINVAL return on disable without a stream and the unreset wait return value?
Fixes: bbc49fc0326b ("drm/amd/display: Avoid get/put vblank when stream disabled")
Fixes: 5eb2fdafeb6f ("drm/amd/display: Fix CRC open failure during active rendering")
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c
> index db546dd44b913..07b3bc45ac86e 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c
[ ... ]
> @@ -696,6 +700,10 @@ int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name)
> ret = -ETIMEDOUT;
> goto cleanup;
> }
> +
> + /* Wait succeeded; don't leak the remaining jiffies. */
> + if (ret > 0)
> + ret = 0;
> }
>
> enable = amdgpu_dm_is_valid_crc_source(source);
[Severity: Medium]
Does amdgpu_dm_crtc_set_crc_source() still leak -ERESTARTSYS in ret when
wait_for_completion_interruptible_timeout() is interrupted by a signal?
Because the check above only jumps to cleanup when ret < 0 && ret !=
-ERESTARTSYS, a signal interruption falls through with ret == -ERESTARTSYS.
Any path that does not overwrite ret via drm_crtc_vblank_get() (such as
disabling CRC capture or switching between active sources) completes the state
update and then returns -ERESTARTSYS. Falling through before commit->hw_done
completes also races with amdgpu_dm_atomic_commit_tail() reading
acrtc->dm_irq_params.crc_src and calling
amdgpu_dm_crtc_configure_crc_source().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201202451.463794-2-george.zhang@amd.com?part=29
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 11/30] drm/amd/display: Add pipe init to core2
2026-12-01 20:22 ` [PATCH v2 11/30] drm/amd/display: Add pipe init to core2 George Zhang
@ 2026-12-01 20:54 ` sashiko-bot
0 siblings, 0 replies; 42+ messages in thread
From: sashiko-bot @ 2026-12-01 20:54 UTC (permalink / raw)
To: George Zhang, amd-gfx
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] drm/amd/display: dcn401_private_funcs re-enables commit HPO
toggle
- [Medium] drm/amd/display: incomplete NULL dmub_srv handling in core2
wrapped init
- [Low] drm/amd/display: unimplemented FPGA_SET_* block sequence opcodes
--
commit 1b7331c47125a1ce9d6e5eaf45bf45e4636568b5
Author: Tomasz Siemek <tomasz.siemek@amd.com>
drm/amd/display: Add pipe init to core2
This commit adds pipe state initialization and a stage-based build-and-run
loop to core2 hardware initialization, adds HUBBUB and MPC init block
sequence steps, and renames init_hpo_hw_control to setup_hpo_hw_control.
[ ... ]
> diff --git a/drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.c b/drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.c
> index 6d5dd6f00b9fe..0e8e2d299bd31 100644
> --- a/drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.c
> +++ b/drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.c
> @@ -45,7 +46,8 @@ static void core2_resolve_dmub_abi(struct dc *dc,
>
> dc2->dmub_abi = initialization->dmub_abi;
> dc2->dmub_abi_resolved = true;
> - dc->ctx->dmub_srv->dmub->feature_caps = initialization->dmub_abi.feature_caps;
> + if (dc->ctx->dmub_srv && dc->ctx->dmub_srv->dmub)
> + dc->ctx->dmub_srv->dmub->feature_caps = initialization->dmub_abi.feature_caps;
> dc->caps.dmub_caps.psr = initialization->dmub_abi.feature_caps.psr;
> dc->caps.dmub_caps.mclk_sw = initialization->dmub_abi.feature_caps.fw_assisted_mclk_switch_ver > 0;
> dc->caps.dmub_caps.fams_ver = initialization->dmub_abi.feature_caps.fw_assisted_mclk_switch_ver;
[Severity: Medium]
Can core2_run_wrapped_hardware_init() reach core2_resolve_dmub_abi() or
core2_init_pipe_state() when dc->ctx->dmub_srv or dc->ctx->dmub_srv->dmub
is NULL?
Earlier in core2_run_wrapped_hardware_init(), dcn401_build_stage1()
unconditionally emits DMUB_SEND_DMCUB_CMD2 steps that
dc2_bls_step_supported() rejects when ctx->dmub_srv or ctx->dmub_srv->dmub
is NULL, causing core2_run_sequence() to fail and abort initialization on
stage 1. In addition, stage 2 postprocessing in
dcn401_fill_initialization_output() unconditionally dereferences
params->dc->ctx->dmub_srv->dmub->fw_version before
core2_resolve_dmub_abi() is called.
[ ... ]
> diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_init.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_init.c
> index 53d6fab1f4005..7da504fc05b0d 100644
> --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_init.c
> +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_init.c
> @@ -151,7 +151,7 @@ static const struct hwseq_private_funcs dcn401_private_funcs = {
> .plane_atomic_power_down = dcn401_plane_atomic_power_down,
> .plane_atomic_power_down_sequence = dcn401_plane_atomic_power_down_sequence,
> .enable_power_gating_plane = dcn32_enable_power_gating_plane,
> - .init_hpo_hw_control = dcn401_setup_hpo_hw_control,
> + .setup_hpo_hw_control = dcn401_setup_hpo_hw_control,
> .init_odm_mem_power = dcn401_init_odm_mem_power,
> .power_down_vga_mem = dcn401_power_down_vga_mem,
> .dcfclk_gating_control = dcn401_dcfclk_gating_control,
[Severity: Medium]
Does wiring dcn401_setup_hpo_hw_control into setup_hpo_hw_control instead
of the init-only init_hpo_hw_control hook cause dce110_apply_ctx_to_hw()
to disable HPO_IO_EN on DCN 4.01 commits?
On DCN 4.01, apply_ctx_to_hw uses dce110_apply_ctx_to_hw(), which calls
dc->hwseq->funcs.setup_hpo_hw_control(dc->hwseq, is_hpo_acquired) whenever
a commit transitions between HPO and non-HPO streams:
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c:dce110_apply_ctx_to_hw() {
...
if (dc->hwseq->funcs.setup_hpo_hw_control && was_hpo_acquired != is_hpo_acquired) {
dc->hwseq->funcs.setup_hpo_hw_control(dc->hwseq, is_hpo_acquired);
}
...
}
Commit a4758aa3d1d9 ("drm/amd/display: Always enable HPO for DCN4 dGPU")
removed setup_hpo_hw_control from dcn401_private_funcs because disabling
HPO on DCN4 dGPUs breaks DP EDID CTS tests. Once HPO_IO_EN is cleared by
a DC1 commit, neither dp_retrain_link_dp_test() (which checks
dc->hwss.setup_hpo_hw_control, left NULL in dcn401_funcs) nor DC2 commits
via dcn401_non_seamless_builder re-enable it.
> diff --git a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
> index 3bf9a15be3dc2..68f7bb01bdd32 100644
> --- a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
> +++ b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
[ ... ]
> @@ -1973,6 +1996,12 @@ enum block_sequence_func {
> TG_DELAY_CURSOR_UNTIL_VUPDATE,
> MPC_CURSOR_LOCK,
> DMUB_HW_LOCK_MGR_CMD,
> + HUBBUB_INIT,
> + HUBBUB_GLOBAL_TIMER_ENABLE,
> + MPC_INIT,
> + FPGA_SET_DTBCLK,
> + FPGA_SET_DPREFCLK,
> + FPGA_SET_REFCLK,
> /* This must be the last value in this enum, add new ones above */
> HWSS_BLOCK_SEQUENCE_FUNC_COUNT
> };
[Severity: Low]
Are FPGA_SET_DTBCLK, FPGA_SET_DPREFCLK, FPGA_SET_REFCLK, struct
fpga_set_clk_params, and the dm_helpers.h include in bls_executor.c left
over from another change? None of these opcodes are handled in
dc2_bls_step_supported() or dc2_bls_execute(), and adding them to enum
block_sequence_func increases MAX_HWSS_BLOCK_SEQUENCE_SIZE.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201202451.463794-2-george.zhang@amd.com?part=11
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 14/30] drm/amd/display: Program DSC on one stream in DC2
2026-12-01 20:22 ` [PATCH v2 14/30] drm/amd/display: Program DSC on one stream in DC2 George Zhang
@ 2026-12-01 20:55 ` sashiko-bot
0 siblings, 0 replies; 42+ messages in thread
From: sashiko-bot @ 2026-12-01 20:55 UTC (permalink / raw)
To: George Zhang, amd-gfx
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/amd/display: partial DSC sequence on config failure in
dcn401_add_step()
- [Medium] drm/amd/display: missing DSC resource check on kept streams
in DC2 builder
--
commit b1940a96d693c6dd5b7ea3ce521afe04d2fe9fac
Author: Tony Cheng <tony.cheng@amd.com>
drm/amd/display: Program DSC on one stream in DC2
This commit adds DSC programming and state checks to the DCN401 DC2
non-seamless and seamless block sequence builders and executor.
> diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
> index bc7dd933e35ee..38b40fe8b02b9 100644
> --- a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
> +++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
[ ... ]
> @@ -921,6 +944,43 @@ static bool check_no_cursor(const struct dc *dc,
> return !new_state->streams[i]->cursor_attributes.address.quad_part;
> }
>
> +static bool dcn401_same_opp_heads(const struct dc_state *current_state,
> + const struct dc_state *new_state,
> + const struct dc_stream_state *stream)
> +{
> + const struct pipe_ctx *cur = dcn401_otg_master(current_state, stream);
> + const struct pipe_ctx *new = dcn401_otg_master(new_state, stream);
> + struct pipe_ctx *cur_heads[MAX_PIPES], *new_heads[MAX_PIPES];
> + int i, n;
> +
> + if (!cur || !new)
> + return false;
> + n = resource_get_opp_heads_for_otg_master(cur,
> + (struct resource_context *)¤t_state->res_ctx,
> + cur_heads);
> + if (n != resource_get_opp_heads_for_otg_master(new,
> + (struct resource_context *)&new_state->res_ctx,
> + new_heads))
> + return false;
> + for (i = 0; i < n; i++)
> + if (!cur_heads[i]->stream_res.opp ||
> + !new_heads[i]->stream_res.opp ||
> + cur_heads[i]->stream_res.opp->inst !=
> + new_heads[i]->stream_res.opp->inst)
> + return false;
> + return true;
> +}
> +
> +static bool check_dsc_odm_kept(const struct dc *dc,
> + const struct dc_state *current_state,
> + const struct dc_state *new_state, unsigned int i)
> +{
> + (void)dc;
> + return !new_state->streams[i]->timing.flags.DSC ||
> + dcn401_same_opp_heads(current_state, new_state,
> + new_state->streams[i]);
> +}
[Severity: Medium]
Can a kept stream change its DSC instance or drop DSC without the update
programming the new DSC block or disabling the old one?
dcn401_same_opp_heads(), dcn401_pipe_layout_unchanged(), and
dcn401_eval_pipe_deltas() compare stream_res.opp->inst without checking
DCN401_SAME_INST(cur->stream_res.dsc, new->stream_res.dsc), and
check_dsc_odm_kept() only inspects new_state->streams[i]->timing.flags.DSC.
For example, if the top plane of a two-plane MPC-blended DSC stream is
removed so the bottom pipe becomes the OTG master on the same OTG and OPP
with a different stream_res.dsc instance, deltas.hubp_dpp_already_enabled
and deltas.odm_kept are both true, so bls_stream_update skips dsc[] and
optc_dsc[] and never disconnects the old DSC or enables the new one.
[ ... ]
> @@ -1848,6 +1945,22 @@ static void dcn401_odm_combine_params(struct pipe_ctx *otg_master,
> true);
> }
>
> +static void dcn401_dsc_config_params(struct pipe_ctx *otg_master,
> + bool enable, struct tg_set_dsc_config_params *p)
> +{
> + struct dsc_optc_config optc;
> +
> + p->tg = otg_master->stream_res.tg;
> + p->dsc_mode = OPTC_DSC_DISABLED;
> + if (!enable || !hwss_prepare_dsc_config_for_pipe(otg_master,
> + resource_get_odm_slice_count(otg_master), 0, &optc))
> + return;
> + p->dsc_mode = optc.is_pixel_format_444 ? OPTC_DSC_ENABLED_444 :
> + OPTC_DSC_ENABLED_NATIVE_SUBSAMPLED;
> + p->bytes_per_pixel = optc.bytes_per_pixel;
> + p->slice_width = optc.slice_width;
> +}
[ ... ]
> @@ -2200,6 +2313,39 @@ static void dcn401_add_step(struct block_sequence_state *sequence,
> p->opp_program_left_edge_extra_pixel_params.is_otg_master =
> !pipe->prev_odm_pipe;
> break;
> + case DCCG_SET_DTO_DSCCLK:
> + p->dccg_set_dto_dscclk_params.dccg = dc->res_pool->dccg;
> + p->dccg_set_dto_dscclk_params.inst = pipe->stream_res.dsc->inst;
> + p->dccg_set_dto_dscclk_params.num_slices_h =
> + pipe->stream->timing.dsc_cfg.num_slices_h /
> + resource_get_odm_slice_count(pipe);
> + break;
> + case DSC_SET_CONFIG:
> + if (!hwss_prepare_dsc_config_for_pipe(pipe,
> + resource_get_odm_slice_count(pipe), 0, NULL)) {
> + (*sequence->num_steps)--;
> + return;
> + }
> + p->dsc_set_config_params.dsc = pipe->stream_res.dsc;
> + break;
> + case DSC_ENABLE:
> + p->dsc_enable_params.dsc = pipe->stream_res.dsc;
> + p->dsc_enable_params.opp_inst = pipe->stream_res.opp->inst;
> + break;
> + case TG_SET_DSC_CONFIG:
> + dcn401_dsc_config_params(pipe, m->tg_set_dsc_config.enable,
> + &p->tg_set_dsc_config_params);
> + break;
[Severity: Medium]
Does a failure in hwss_prepare_dsc_config_for_pipe() emit a partial DSC
sequence instead of aborting execution?
When hwss_prepare_dsc_config_for_pipe() fails in the DSC_SET_CONFIG case,
decrementing *sequence->num_steps removes DSC_SET_CONFIG from the sequence
(bypassing dc2_bls_step_supported()), while DCCG_SET_DTO_DSCCLK and
DSC_ENABLE are still emitted and dcn401_dsc_config_params() populates
p->tg with p->dsc_mode = OPTC_DSC_DISABLED. Executing that sequence
enables DSC forwarding on the OPP head into an unconfigured DSC block
while disabling DSC in OPTC, corrupting or hanging display output.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201202451.463794-2-george.zhang@amd.com?part=14
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 27/30] drm/amd/display: Sync OTG timing in the DC2 non-seamless commit
2026-12-01 20:23 ` [PATCH v2 27/30] drm/amd/display: Sync OTG timing in the DC2 non-seamless commit George Zhang
@ 2026-12-01 20:57 ` sashiko-bot
0 siblings, 0 replies; 42+ messages in thread
From: sashiko-bot @ 2026-12-01 20:57 UTC (permalink / raw)
To: George Zhang, amd-gfx
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/amd/display: missed OTG sync in
dcn401_timing_sync_source()
- [Medium] drm/amd/display: data race on static buffers in
wa_dpg_height_apply()
--
commit 38a0b1198247f1d2010554b1b7b6370ab3f8b13a
Author: Tony Cheng <tony.cheng@amd.com>
drm/amd/display: Sync OTG timing in the DC2 non-seamless commit
This commit adds OTG timing synchronization steps to the DCN401 DC2
non-seamless commit builder and registers a workaround to raise the DPG
height around the OTG reset trigger steps.
> diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
> index 6ee61bea0c0bc..9ad9081b1b9ae 100644
> --- a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
> +++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
[ ... ]
> @@ -2853,6 +2871,42 @@ static bool dcn401_walks_stream(const struct dcn401_commit_step_args *args,
> args->new_state, stream);
> }
>
> +/*
> + * The OTG master that pipe resets to, chosen as program_timing_sync does:
> + * the first OTG master with the same timing that shows a plane, else the
> + * first one. NULL when that is pipe.
> + */
> +static const struct pipe_ctx *dcn401_timing_sync_source(
> + const struct dcn401_commit_step_args *args,
> + const struct pipe_ctx *pipe)
> +{
> + const struct dc_state_update_flags *flags = args->update_flags;
> + const struct pipe_ctx *source = NULL;
> + const struct pipe_ctx *member;
> + unsigned int i;
> +
> + if (args->dc->debug.disable_timing_sync)
> + return NULL;
> + for (i = 0; i < args->dc->res_pool->pipe_count; i++) {
> + member = &args->new_state->res_ctx.pipe_ctx[i];
> + if (!member->stream || member->top_pipe ||
> + member->prev_odm_pipe ||
> + !resource_are_streams_timing_synchronizable(
> + member->stream, pipe->stream))
> + continue;
> + if (flags->cur_pipes[i].has_plane &&
> + flags->new_pipes[i].has_plane) {
> + source = member;
> + break;
> + }
> + if (!source)
> + source = member;
> + }
> + if (!source || source->pipe_idx == pipe->pipe_idx)
> + return NULL;
> + return source;
> +}
[Severity: Medium]
Can dcn401_timing_sync_source() skip OTG timing synchronization when a kept
stream had no plane in current_state?
Because dcn401_timing_sync_source() only prioritizes an OTG master when
both flags->cur_pipes[i].has_plane and flags->new_pipes[i].has_plane are
set, it falls back to the lowest matching pipe_idx when a kept stream had
no plane in current_state. If a newly enabled stream with the same timing
is allocated on a lower pipe_idx (e.g. pipe 0) than the kept stream (e.g.
pipe 1), dcn401_timing_sync_source() picks pipe 0 as source and returns
NULL for pipe 0 because source->pipe_idx == pipe->pipe_idx. Meanwhile,
when bls_sync is expanded, dcn401_walks_stream() skips all kept streams
(!dcn401_stream_kept()), so neither stream emits TG_ENABLE_RESET_TRIGGER
and the two OTGs remain out of phase.
In addition, if that kept stream gains a plane during the commit,
dcn401_add_stream_update() enables its plane and unblanks its OPP before
bls_postamble, yet the second bls_sync pass still checks
flags->cur_pipes[i].has_plane && flags->new_pipes[i].has_plane and fails to
select the newly unblanked kept stream as the timing sync source.
> diff --git a/drivers/gpu/drm/amd/display/dc/workaround_manager/workaround_manager.c b/drivers/gpu/drm/amd/display/dc/workaround_manager/workaround_manager.c
> index 067a7069186bb..7e7e29d2530ad 100644
> --- a/drivers/gpu/drm/amd/display/dc/workaround_manager/workaround_manager.c
> +++ b/drivers/gpu/drm/amd/display/dc/workaround_manager/workaround_manager.c
> @@ -4,19 +4,129 @@
> */
>
> #include "dm_services.h"
> +#include "core_types.h"
> #include "workaround_manager/workaround_manager.h"
>
> -static const struct workaround_manager dc2_wam_empty = {
> - .registry = NULL,
> - .count = 0,
> -};
> -
> /* BSS, not the stack: 64 block_sequence entries exceed the kernel frame limit. */
> static struct block_sequence dc2_wam_saved_steps[DC2_BLS_MAX_STEPS];
> +static struct block_sequence dc2_wam_input_steps[DC2_BLS_MAX_STEPS];
[ ... ]
> +static enum workaround_manager_result wa_dpg_height_apply(
> + struct block_sequence_state *bls,
> + const struct workaround_context *ctx)
> +{
> + struct block_sequence *in = dc2_wam_input_steps;
> + unsigned int num = *bls->num_steps;
> + unsigned int n = 0;
> + unsigned int i = 0;
> + unsigned int j = 0;
> +
> + memmove(in, bls->steps, num * sizeof(in[0]));
> + for (i = 0; i < num; i = j) {
> + for (j = i + 1; j < num && in[j].func == in[i].func; j++)
> + ;
> + if (in[i].func == TG_ENABLE_RESET_TRIGGER &&
> + !wa_dpg_height_add(bls->steps, &n, ctx->target,
> + &in[i], j - i, true))
> + return WAM_SIZE_EXCEEDED;
> + if (n + j - i > DC2_BLS_MAX_STEPS)
> + return WAM_SIZE_EXCEEDED;
> + memmove(&bls->steps[n], &in[i], (j - i) * sizeof(in[0]));
> + n += j - i;
> + if (in[i].func == TG_DISABLE_RESET_TRIGGER &&
> + !wa_dpg_height_add(bls->steps, &n, ctx->target,
> + &in[i], j - i, false))
> + return WAM_SIZE_EXCEEDED;
> + }
> + *bls->num_steps = n;
> + return WAM_OK;
> +}
[Severity: Medium]
Can concurrent calls to workaround_manager_apply() race on the static
dc2_wam_input_steps and dc2_wam_saved_steps arrays?
dc2_wam_input_steps and dc2_wam_saved_steps are file-scope static buffers
shared across all struct dc instances without a lock. If two threads run
core2_run_sequence() concurrently (for example, modesets on two AMD GPUs,
each serialized only by its own per-device adev->dm.dc_lock), they will
overwrite dc2_wam_input_steps and dc2_wam_saved_steps while rebuilding or
restoring bls->steps, corrupting the block_sequence array passed to
dc2_bls_execute().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201202451.463794-2-george.zhang@amd.com?part=27
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 22/30] drm/amd/display: Flip every DPP pipe of the stream in DC2
2026-12-01 20:22 ` [PATCH v2 22/30] drm/amd/display: Flip every DPP pipe of the stream in DC2 George Zhang
@ 2026-12-01 21:00 ` sashiko-bot
0 siblings, 0 replies; 42+ messages in thread
From: sashiko-bot @ 2026-12-01 21:00 UTC (permalink / raw)
To: George Zhang, amd-gfx
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/amd/display: missing OTG GSL lock on MPO immediate flips
in dcn401_check_flip()
--
commit ab01c877e59048c17db59a44352ba247bd2d538f
Author: Tony Cheng <tony.cheng@amd.com>
drm/amd/display: Flip every DPP pipe of the stream in DC2
This commit widens dcn401_check_flip() to accept address-only flips on
streams with multiple planes or ODM slices by checking every DPP pipe of
the stream instead of requiring a single plane on a single OPP head and
DPP pipe.
> diff --git a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
> index 38b40fe8b02b9..69d6c55e78e80 100644
> --- a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
> +++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
> @@ -1055,32 +1055,37 @@ static bool check_no_stream_update_flags(const struct dc *dc,
> }
>
> /*
> - * Any other plane update bit adds a step to the flip. DC1 hands an
> - * offloaded flip to HWFQ. With triple-buffer flips, the pipe lock is not
> - * a TG_LOCK leaf.
> + * Any other plane update bit adds a step to the flip. A plane without an
> + * address update would still get HUBP_UPDATE_PLANE_ADDR, which DC1 skips,
> + * so every plane of the stream flips. DC1 hands an offloaded flip to HWFQ.
> + * With triple-buffer flips, the pipe lock is not a TG_LOCK leaf.
> */
> -static bool check_one_address_only_plane(const struct dc *dc,
> +static bool check_address_only_planes(const struct dc *dc,
> const struct dc_state *current_state,
> const struct dc_state *new_state, unsigned int i)
> {
> struct pipe_ctx *dpp_pipes[MAX_PIPES];
> const struct dc_plane_state *plane;
> + int j, n;
>
> (void)dc;
> (void)current_state;
> - if (new_state->stream_status[i].plane_count != 1 ||
> - resource_get_opp_heads_for_stream(new_state->streams[i],
> - (struct resource_context *)&new_state->res_ctx,
> - dpp_pipes) != 1 ||
> - resource_get_dpp_pipes_for_stream(new_state->streams[i],
> + if (!new_state->stream_status[i].plane_count)
> + return false;
> + n = resource_get_dpp_pipes_for_stream(new_state->streams[i],
> (struct resource_context *)&new_state->res_ctx,
> - dpp_pipes) != 1 ||
> - !dpp_pipes[0]->plane_state ||
> - !dpp_pipes[0]->plane_res.hubp)
> + dpp_pipes);
> + if (n <= 0)
> return false;
> - plane = dpp_pipes[0]->plane_state;
> - return dc_check_address_only_update(plane->update_bits) &&
> - !plane->triplebuffer_flips;
> + for (j = 0; j < n; j++) {
> + plane = dpp_pipes[j]->plane_state;
> + if (!plane || !dpp_pipes[j]->plane_res.hubp)
> + return false;
> + if (!dc_check_address_only_update(plane->update_bits) ||
> + plane->triplebuffer_flips)
> + return false;
> + }
> + return true;
> }
>
> static bool dcn401_pipe_on_either(const struct dc_state *current_state,
> @@ -1156,8 +1161,8 @@ static enum bls_builder_result dcn401_check_flip(const struct dc *dc,
> CHECK_UPDATE(no_subvp, "subvp is set");
> CHECK_UPDATE(no_dmub_work, "psr, replay, abm or hwfq needs dmub");
> CHECK_UPDATE(no_stream_update_flags, "stream update flags are set");
> - CHECK_UPDATE(one_address_only_plane,
> - "stream has odm, or not one plane with an address-only update");
> + CHECK_UPDATE(address_only_planes,
> + "a plane of the stream has no address-only update");
> CHECK_CONDITION(triple_buffer, "triple buffer is disabled");
> CHECK_UPDATE(no_immediate_dcc_flip, "immediate flip of a dcc surface");
> CHECK_UPDATE(no_mcm_luts, "an mcm lut is enabled");
[Severity: Medium]
Does dcn401_check_flip() allow immediate flips on multi-plane (MPO)
streams without programming the OTG GSL lock?
When an OTG master has pipe->bottom_pipe != NULL and flip_immediate is
true, DC1 sets up a GSL group as a lock and waits for pending flips
before TG_LOCK:
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c:dcn20_build_pipe_control_lock_sequence() {
if (flip_immediate && lock) {
temp_pipe = pipe;
while (temp_pipe) {
if (temp_pipe->plane_state && temp_pipe->plane_state->flip_immediate)
params->hubps_to_wait_for_flip[hubp_count++] = temp_pipe->plane_res.hubp;
temp_pipe = temp_pipe->bottom_pipe;
}
}
...
if (lock && (pipe->bottom_pipe != NULL || !flip_immediate))
if ((flip_immediate && pipe->stream_res.gsl_group == 0) ||
(!flip_immediate && pipe->stream_res.gsl_group > 0)) {
params->gsl_lock = true;
dcn20_build_gsl_group_as_lock(dc, pipe, flip_immediate,
¶ms->gsl, ¶ms->gsl_source_select);
}
}
In DC2, program_flip still emits HUBP_SET_FLIP_CONTROL_GSL with
flip_immediate = true on each HUBP, while the lock table only emits
TG_LOCK and omits HUBP_WAIT_FLIP_PENDING, TG_SET_GSL, and
TG_SET_GSL_SOURCE_SELECT, leaving immediate flips across MPO pipes
without OTG GSL synchronization.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201202451.463794-2-george.zhang@amd.com?part=22
^ permalink raw reply [flat|nested] 42+ messages in thread
* Re: [PATCH v2 17/30] drm/amd/display: Revoke alternate channel P-State before pipe teardown
2026-12-01 20:22 ` [PATCH v2 17/30] drm/amd/display: Revoke alternate channel P-State before pipe teardown George Zhang
@ 2026-12-01 21:09 ` sashiko-bot
0 siblings, 0 replies; 42+ messages in thread
From: sashiko-bot @ 2026-12-01 21:09 UTC (permalink / raw)
To: George Zhang, amd-gfx
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] drm/amd/display: alt_ch_pstate_switch not revoked in
prepare_bandwidth()
- [Medium] drm/amd/display: UCLK/FCLK P-State left disabled in
dcn60_update_clocks()
- [Low] drm/amd/display: missing Fixes: trailers for DCN6 P-State
sequencing fix
--
commit 68003479a603655940aa4cfb42034d78591d357d
Author: Ivan Lipski <ivan.lipski@amd.com>
> drm/amd/display: Revoke alternate channel P-State before pipe teardown
>
> [Why]
> A modeset after stress testing can hang PMFW. The hang only happens
> when alternate channel P-State switching is in use.
>
> Alternate channel P-State permission was sequenced the opposite way to
> UCLK/FCLK P-State: it could be enabled during prepare_bandwidth, before
> the new configuration was programmed, and was only disabled during
> optimize_bandwidth, after the old configuration had been torn down.
> PMFW could therefore start an alternate channel switch that depended on
> a display being disabled and never complete it.
>
> The IndicatePstateStatus messages also did not follow the computed
> action. With no active planes, prepare_bandwidth decided to revoke
> UCLK/FCLK P-State but still told PMFW they were allowed, and the enable
> message could briefly re-allow a state the action was revoking.
>
> [How]
> Only allow alternate channel P-State when it is safe to lower, and
> revoke it as soon as the new state does not support it.
>
> Only treat zero active planes as UCLK/FCLK P-State support when it is
> safe to lower, so prepare_bandwidth never grants it for a config that
> has not been programmed yet.
>
> Derive allow_uclk, allow_fclk and alt_ch_enable once from the action
> and the current clocks. The IndicatePstateStatus messages no longer
> recount the active planes to allow UCLK/FCLK P-State on their own; the
> zero plane case is decided only by the action.
>
> Cc: Alvin Lee <alvin.lee2@amd.com>
> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com>
> Signed-off-by: George Zhang <george.zhang@amd.com>
[Severity: Low]
Should this bug fix include Fixes: tags for the commits that introduced
the DCN6 P-State sequencing and IndicatePstateStatus handling?
Fixes: 7f7d7ea1fa51 ("drm/amd/display: Add new sources for DCN6")
Fixes: fb48cc34206c ("drm/amd/display: Update indicate pstate enable sequence")
> diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c
> index 9556da79cdce1..4b73dd8b5382b 100644
> --- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c
> +++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c
> @@ -1211,10 +1211,10 @@ static void dcn60_make_bandwidth_clocks_update_action(
> bool dcfclk_dpm_enabled = dcn60_is_ppclk_dpm_enabled(clk_mgr_internal,
> PPCLK_DCFCLK);
> bool uclk_pstate_supported = new_clocks->p_state_change_support
> - || (total_plane_count == 0);
> + || (total_plane_count == 0 && safe_to_lower);
>
> bool fclk_pstate_supported = new_clocks->fclk_p_state_change_support
> - || (total_plane_count == 0);
> + || (total_plane_count == 0 && safe_to_lower);
[Severity: Medium]
Can gating total_plane_count == 0 on safe_to_lower leave UCLK and FCLK
P-State permanently disabled after a stream update on a stream that
already has zero active planes?
When stream_count > 0 and total_plane_count == 0, DML21 sets
all_streams_blanked = true and leaves new_clocks->p_state_change_support
and fclk_p_state_change_support as false. During prepare_bandwidth
(safe_to_lower == false), uclk_pstate_supported and fclk_pstate_supported
now evaluate to false, so should_update_pstate_support() actively revokes
UCLK and FCLK P-State in PMFW.
However, in dcn401_prepare_bandwidth(), dc->optimized_required is only
set when context->bw_ctx.bw.dcn.clk.p_state_change_support is true or
when watermarks, arbiter, or compbuf_size change:
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c:dcn401_prepare_bandwidth() {
...
if (p_state_change_support) {
dc->optimized_required = true;
context->bw_ctx.bw.dcn.clk.p_state_change_support = false;
}
...
}
When updating a stream that already had zero planes in dc->current_state,
none of those change and dc->optimized_required stays false.
dc_post_update_surfaces_to_stream() then skips optimize_bandwidth(), so
update_clocks() never runs with safe_to_lower == true to re-enable UCLK
and FCLK P-State, leaving memory and fabric clocks pinned at high DPM
levels.
[ ... ]
> @@ -1282,9 +1282,10 @@ static void dcn60_make_bandwidth_clocks_update_action(
> }
>
> if (new_clocks->alt_ch_pstate_switch != clk_mgr_base->clks.alt_ch_pstate_switch) {
> - action->alt_ch.enable = new_clocks->alt_ch_pstate_switch;
> - action->alt_ch.disable = !new_clocks->alt_ch_pstate_switch
> + /* PMFW hangs if alt-ch is still allowed while pipes are torn down */
> + action->alt_ch.enable = new_clocks->alt_ch_pstate_switch
> && safe_to_lower;
> + action->alt_ch.disable = !new_clocks->alt_ch_pstate_switch;
> action->alt_ch.send_message = action->alt_ch.enable
> || action->alt_ch.disable;
> }
[Severity: Medium]
Does alt_ch_pstate_switch remain enabled in PMFW during prepare_bandwidth
when transitioning between two configurations that both use alternate
channel P-State switching?
dcn401_prepare_bandwidth() temporarily forces
context->bw_ctx.bw.dcn.clk.p_state_change_support = false before calling
update_clocks() and disabling FAMS2 in DMUB, but it does not clear
context->bw_ctx.bw.dcn.clk.alt_ch_pstate_switch. If a modeset or full
plane update tears down or reconfigures pipes while at least one plane in
the new context still uses P_STATE_ALT, both
clk_mgr_base->clks.alt_ch_pstate_switch and
new_clocks->alt_ch_pstate_switch are true during prepare_bandwidth.
action->alt_ch.disable is then not set, and alt_ch_enable remains true in
the CLK_MGR60_INDICATE_PSTATE_STATUS message sent before FAMS2 is disabled
and pipes are torn down.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201202451.463794-2-george.zhang@amd.com?part=17
^ permalink raw reply [flat|nested] 42+ messages in thread
end of thread, other threads:[~2026-12-01 21:09 UTC | newest]
Thread overview: 42+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 20:22 [PATCH v2 00/30] DC Patches for Nov 30 2026 George Zhang
2026-12-01 20:22 ` [PATCH v2 01/30] drm/amd/display: cast clamped rate conversion George Zhang
2026-12-01 20:22 ` [PATCH v2 02/30] drm/amd/display: Split HWSS_CURSOR_LOCK into flat BLS operations George Zhang
2026-12-01 20:22 ` [PATCH v2 03/30] drm/amd/display: clamp AUX reply length as unsigned George Zhang
2026-12-01 20:22 ` [PATCH v2 04/30] drm/amd/display: keep the DPCD read result signed in the MST ISR George Zhang
2026-12-01 20:22 ` [PATCH v2 05/30] drm/amd/display: copy only the status byte on a DMUB AUX write status retry George Zhang
2026-12-01 20:22 ` [PATCH v2 06/30] drm/amd/display: test the DMUB AUX write status reply copy George Zhang
2026-12-01 20:22 ` [PATCH v2 07/30] drm/amd/display: Account for downspread and DFS in clock validation George Zhang
2026-12-01 20:49 ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 08/30] drm/amd/display: Read max LSDMA BW from DMU George Zhang
2026-12-01 20:22 ` [PATCH v2 09/30] drm/amd/display: Precompute EASF lookup thresholds George Zhang
2026-12-01 20:22 ` [PATCH v2 10/30] drm/amd/display: Make DPP_SET_INPUT_TRANSFER_FUNC BLS compliant George Zhang
2026-12-01 20:22 ` [PATCH v2 11/30] drm/amd/display: Add pipe init to core2 George Zhang
2026-12-01 20:54 ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 12/30] drm/amd/display: Fix HDMI FRL no_timeout behavior George Zhang
2026-12-01 20:42 ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 13/30] drm/amd/display: Re-enable HUBP/DPP Driver PG on DCN42 George Zhang
2026-12-01 20:22 ` [PATCH v2 14/30] drm/amd/display: Program DSC on one stream in DC2 George Zhang
2026-12-01 20:55 ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 15/30] drm/amd/display: enable dcn42b hubp/dpp pg control from driver side George Zhang
2026-12-01 20:22 ` [PATCH v2 16/30] drm/amd/display: cover gamma 2.4 and 2.6 on the wide curve George Zhang
2026-12-01 20:22 ` [PATCH v2 17/30] drm/amd/display: Revoke alternate channel P-State before pipe teardown George Zhang
2026-12-01 21:09 ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 18/30] drm/amd/display: block pr in mst right George Zhang
2026-12-01 20:46 ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 19/30] drm/amd/display: Add a per-ASIC default for the DC2 selection George Zhang
2026-12-01 20:22 ` [PATCH v2 20/30] drm/amd/display: Refactor Max VStartup calculations for DCN6 George Zhang
2026-12-01 20:22 ` [PATCH v2 21/30] drm/amd/display: Improve P-state admissability logic George Zhang
2026-12-01 20:50 ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 22/30] drm/amd/display: Flip every DPP pipe of the stream in DC2 George Zhang
2026-12-01 21:00 ` sashiko-bot
2026-12-01 20:22 ` [PATCH v2 23/30] drm/amd/display: Report a DC2 BLS step overflow behind a debug option George Zhang
2026-12-01 20:22 ` [PATCH v2 24/30] drm/amd/display: VRR Support on Direct MST Sinks George Zhang
2026-12-01 20:22 ` [PATCH v2 25/30] drm/amd/display: Program YCbCr output in DC2 George Zhang
2026-12-01 20:23 ` [PATCH v2 26/30] drm/amd/display: Skip a stream with no OTG master " George Zhang
2026-12-01 20:23 ` [PATCH v2 27/30] drm/amd/display: Sync OTG timing in the DC2 non-seamless commit George Zhang
2026-12-01 20:57 ` sashiko-bot
2026-12-01 20:23 ` [PATCH v2 28/30] drm/amd/display: Move shared dcn401 builder code to its own file George Zhang
2026-12-01 20:23 ` [PATCH v2 29/30] drm/amd/display: Allow disabling CRC capture when the stream is gone George Zhang
2026-12-01 20:52 ` sashiko-bot
2026-12-01 20:23 ` [PATCH v2 30/30] drm/amd/display: Promote DC to 3.2.410 George Zhang
2026-12-01 20:45 ` sashiko-bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.