Skip to contentSkip to conversation

DC Patches May 13, 2026

PATCH In review [email protected] 2 participants 30 messages May 13 – May 19

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

cover DC Patches May 13, 2026

From: Ivan Lipski <[email protected]>

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

- Add amdgpu_dm KUnit test for:
* CRC function
* HDCP process_output
* colorop TF bitmasks
* color helpers
* PSR and Replay functions
* ISM functions
- Fix eDP receiver ready status check in T7 sequence
- Enable dcn42 pstate pmo
- Refactor PSR. Replay and ABM functionality into dedicated power modules
- Fix assertion due to disable/enable CM blocks
- Enable additional wait for pipe pending checks
- Fix ISM dc_lock deadlock during suspend
- Use lockdep_assert_held() for dc_lock check
- Fix clear PSR config flow
- Exclude the MST overhead from BW deallocation
- Allow power up even w/ powergating disabled on DCN42
- Fix integer overflow in bios_get_image()
- Validate GPIO pin LUT table size before iterating
- Add Auxless-ALPM support in VESA Panel Replay
- Add debug option for replay ESD recovery
- Validate payload length and link_index in dc_process_dmub_aux_transfer_async
- Add ADDR3 swizzle modes

Cc Dan Wheeler <[email protected]>

Alex Hung (6):
drm/amd/display: Add KUnit test for HDCP process_output drm/amd/display: Add KUnit test for colorop TF bitmasks drm/amd/display: Add KUnit test for color helpers drm/amd/display: Add KUnit test for PSR function drm/amd/display: Add KUnit test for replay drm/amd/display: Add KUnit test for ISM functions

Aric Cyr (2):
drm/amd/display: Fix assertion due to disable/enable CM blocks drm/amd/display: Enable additional wait for pipe pending checks

Aurabindo Pillai (1):
drm/amd/display: Add KUnit test for CRC function

Charlene Liu (1):
drm/amd/display: Allow power up when PG disallowed in driver

Cruise Hung (1):
drm/amd/display: Exclude the MST overhead from BW deallocation

Dmytro Laktyushkin (1):
drm/amd/display: Enable dcn42 pstate pmo

Harry Wentland (3):
drm/amd/display: Fix integer overflow in bios_get_image() drm/amd/display: Validate GPIO pin LUT table size before iterating drm/amd/display: Validate payload length and link_index in
dc_process_dmub_aux_transfer_async

James Lin (2):
drm/amd/display: Add some missing code for dcn42
Revert "drm/amd/display: dmub_cmd.h: add missing kernel-doc for enums"

Leon Huang (2):
drm/amd/display: Fix clear PSR config flow drm/amd/display: Add Auxless-ALPM support in VESA Panel Replay

Lohita Mudimela (2):
drm/amd/display: Refactor PSR functionality into dedicated power_psr
module
drm/amd/display: Refactor Replay functionality into dedicated
power_replay module

Nicholas Kazlauskas (1):
drm/amd/display: Enable DCN42 PMO policy

Ray Wu (2):
drm/amd/display: Fix ISM dc_lock deadlock during suspend drm/amd/display: Use lockdep_assert_held() for dc_lock check

Sung-huai Wang (1):
drm/amd/display: Fix eDP receiver ready status check in T7 sequence

Taimur Hassan (1):
drm/amd/display: Promote DC to 3.2.383

Wei-Guang Li (1):
drm/amd/display: Add debug option for replay ESD recovery

Wenxian Wang (1):
drm/amd/display: Add ADDR3 swizzle modes

 drivers/gpu/drm/amd/display/Kconfig           |   12 +
 .../gpu/drm/amd/display/amdgpu_dm/Makefile    |    5 +
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |   25 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |    2 -
 .../amd/display/amdgpu_dm/amdgpu_dm_color.c   |   65 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_color.h   |   89 ++
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c |   17 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_crc.h |    7 +
 .../amd/display/amdgpu_dm/amdgpu_dm_hdcp.c    |    5 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_hdcp.h    |   13 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c |   80 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.h |   11 +
 .../amdgpu_dm/amdgpu_dm_kunit_helpers.h       |   19 +
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c |    6 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_psr.h |    5 +
 .../amd/display/amdgpu_dm/amdgpu_dm_replay.c  |    3 +
 .../amd/display/amdgpu_dm/tests/.kunitconfig  |   14 +
 .../drm/amd/display/amdgpu_dm/tests/Makefile  |   18 +
 .../amdgpu_dm/tests/amdgpu_dm_color_test.c    | 1071 +++++++++++++
 .../amdgpu_dm/tests/amdgpu_dm_colorop_test.c  |  161 ++
 .../amdgpu_dm/tests/amdgpu_dm_crc_test.c      |  121 ++
 .../amdgpu_dm/tests/amdgpu_dm_hdcp_test.c     |  175 +++
 .../amdgpu_dm/tests/amdgpu_dm_ism_test.c      |  636 ++++++++
 .../amdgpu_dm/tests/amdgpu_dm_psr_test.c      |  255 ++++
 .../amdgpu_dm/tests/amdgpu_dm_replay_test.c   |  206 +++
 .../drm/amd/display/dc/bios/bios_parser2.c    |    9 +
 .../amd/display/dc/bios/bios_parser_helper.c  |    9 +-
 .../display/dc/clk_mgr/dcn42/dcn42_clk_mgr.c  |    2 +
 drivers/gpu/drm/amd/display/dc/core/dc.c      |    6 +-
 drivers/gpu/drm/amd/display/dc/dc.h           |    3 +-
 drivers/gpu/drm/amd/display/dc/dc_hw_types.h  |    4 +-
 .../dml2_0/dml21/dml21_translation_helper.c   |    5 +-
 .../dc/dml2_0/dml21/inc/dml_top_types.h       |    1 +
 .../dml21/src/dml2_pmo/dml2_pmo_dcn42.c       |  144 +-
 .../dml21/src/dml2_pmo/dml2_pmo_dcn42.h       |    1 +
 .../dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c  |    4 -
 .../dml21/src/dml2_pmo/dml2_pmo_factory.c     |   16 +
 .../dml21/src/dml2_top/dml2_top_soc15.c       |   30 +-
 .../drm/amd/display/dc/dml2_0/dml2_wrapper.h  |    1 +
 .../drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c  |    3 +
 .../amd/display/dc/dpp/dcn30/dcn30_dpp_cm.c   |    1 +
 .../display/dc/dpp/dcn401/dcn401_dpp_dscl.c   |    1 +
 .../display/dc/hubbub/dcn401/dcn401_hubbub.c  |    2 +
 .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c   |    8 +-
 .../amd/display/dc/hwss/dcn10/dcn10_init.c    |    2 +
 .../amd/display/dc/hwss/dcn20/dcn20_init.c    |    2 +
 .../amd/display/dc/hwss/dcn30/dcn30_init.c    |    2 +
 .../amd/display/dc/hwss/dcn301/dcn301_init.c  |    2 +
 .../amd/display/dc/hwss/dcn31/dcn31_init.c    |    2 +
 .../amd/display/dc/hwss/dcn314/dcn314_init.c  |    2 +
 .../amd/display/dc/hwss/dcn32/dcn32_init.c    |    2 +
 .../amd/display/dc/hwss/dcn401/dcn401_init.c  |    2 +
 .../amd/display/dc/hwss/dcn42/dcn42_hwseq.c   |    5 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/optc.h  |    1 -
 .../gpu/drm/amd/display/dc/link/link_dpms.c   |   41 +-
 .../dc/link/protocols/link_dp_irq_handler.c   |   14 +-
 .../dc/link/protocols/link_dp_panel_replay.c  |   13 +
 .../link/protocols/link_edp_panel_control.c   |   26 +-
 .../amd/display/dc/optc/dcn35/dcn35_optc.c    |    1 -
 .../amd/display/dc/optc/dcn42/dcn42_optc.c    |    2 -
 .../amd/display/dc/pg/dcn42/dcn42_pg_cntl.c   |   43 +-
 .../dc/resource/dcn42/dcn42_resource.c        |   12 +-
 .../dc/resource/dcn42/dcn42_resource.h        |    7 +
 .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h   |  156 +-
 .../drm/amd/display/modules/inc/mod_power.h   |   23 -
 .../drm/amd/display/modules/power/Makefile    |    4 +-
 .../gpu/drm/amd/display/modules/power/power.c | 1343 +----------------
 .../drm/amd/display/modules/power/power_abm.c |   98 --
 .../amd/display/modules/power/power_helpers.c |  250 ---
 .../amd/display/modules/power/power_helpers.h |  121 ++
 .../drm/amd/display/modules/power/power_psr.c |  665 ++++++++
 .../amd/display/modules/power/power_replay.c  |  911 +++++++++++
 72 files changed, 5060 insertions(+), 1963 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.h
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_kunit_helpers.h
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/.kunitconfig
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/Makefile
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_color_test.c
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_colorop_test.c
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crc_test.c
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_hdcp_test.c
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_ism_test.c
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_psr_test.c
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_replay_test.c
 create mode 100644 drivers/gpu/drm/amd/display/modules/power/power_psr.c
 create mode 100644 drivers/gpu/drm/amd/display/modules/power/power_replay.c
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/28 drm/amd/display: Add some missing code for dcn42

From: James Lin <[email protected]>

[why & how]
Some DCN4.2 related code is missing from upstream

Fixes 66715fc0ecfd ("drm/amd/display: Sync dcn42 with DC 3.2.373")
---
 .../drm/amd/display/dc/clk_mgr/dcn42/dcn42_clk_mgr.c   |  2 ++
 .../gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.c    |  5 +++--
 .../drm/amd/display/dc/resource/dcn42/dcn42_resource.c | 10 ++++------
 .../drm/amd/display/dc/resource/dcn42/dcn42_resource.h |  7 +++++++
 4 files changed, 16 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn42/dcn42_clk_mgr.c +2 -0
index d856a7a807b1..d01e5969a670 100644
@@ -309,6 +309,8 @@ void dcn42_update_clocks(struct clk_mgr *clk_mgr_base,
 	}
 
 	// workaround: Limit dppclk to 100Mhz to avoid lower eDP panel switch to plus 4K monitor underflow.
+	if (new_clocks->dppclk_khz < 100000)
+		new_clocks->dppclk_khz = 100000;
 
 	if (should_set_clock(safe_to_lower, new_clocks->dppclk_khz, clk_mgr->base.clks.dppclk_khz)) {
 		if (clk_mgr->base.clks.dppclk_khz > new_clocks->dppclk_khz)
drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.c +3 -2
index cbc20f214f9e..cabfac151940 100644
@@ -470,9 +470,9 @@ static bool is_rmcm_3dlut_fl_supported(struct dc *dc, enum dc_cm2_gpu_mem_size s
 	if (!dc->caps.color.mpc.rmcm_3d_lut_caps.dma_3d_lut)
 		return false;
 	if (size == DC_CM2_GPU_MEM_SIZE_171717)
-		return (dc->caps.color.mpc.rmcm_3d_lut_caps.lut_dim_caps.dim_17);
+		return dc->caps.color.mpc.rmcm_3d_lut_caps.lut_dim_caps.dim_17 != 0u;
 	else if (size == DC_CM2_GPU_MEM_SIZE_333333)
-		return (dc->caps.color.mpc.rmcm_3d_lut_caps.lut_dim_caps.dim_33);
+		return dc->caps.color.mpc.rmcm_3d_lut_caps.lut_dim_caps.dim_33 != 0u;
 	return false;
 }
 
@@ -945,6 +945,7 @@ bool dcn42_set_mcm_luts(struct pipe_ctx *pipe_ctx,
 void dcn42_hardware_release(struct dc *dc)
 {
 	dcn35_hardware_release(dc);
+	dc_dmub_srv_release_hw(dc);
 
 }
 static int count_active_streams(const struct dc *dc)
drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c +4 -6
index 52a1996a654f..1fc457cec293 100644
@@ -1520,6 +1520,10 @@ static void dcn42_resource_destruct(struct dcn42_resource_pool *pool)
 
 	if (pool->base.pg_cntl != NULL)
 		dcn_pg_cntl_destroy(&pool->base.pg_cntl);
+
+	if (pool->base.replay != NULL)
+		dmub_replay_destroy(&pool->base.replay);
+
 	if (pool->base.dccg != NULL)
 		dcn_dccg_destroy(&pool->base.dccg);
 
@@ -1921,12 +1925,6 @@ static bool dcn42_resource_construct(
 	dc->caps.max_v_total = (1 << 15) - 1;
 	dc->caps.vtotal_limited_by_fp2 = true;
 
-	dc->caps.seamless_odm = true;
-	dc->caps.zstate_support = true;
-	dc->caps.ips_support = true;
-	dc->caps.max_v_total = (1 << 15) - 1;
-	dc->caps.vtotal_limited_by_fp2 = true;
-
 	/* Color pipeline capabilities */
 	dc->caps.color.dpp.dcn_arch = 1;
 	dc->caps.color.dpp.input_lut_shared = 0;
drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.h +7 -0
index 60acf0e423d9..fe960542d7bd 100644
@@ -456,6 +456,8 @@
 		SRI_ARR(OTG_V_SYNC_A, OTG, inst), \
 		SRI_ARR(OTG_V_SYNC_A_CNTL, OTG, inst), \
 		SRI_ARR(OTG_CONTROL, OTG, inst), \
+		SRI_ARR(OTG_MASTER_EN, OTG, inst), \
+		SRI_ARR(OTG_LONG_VBLANK_STATUS, OTG, inst), \
 		SRI_ARR(OTG_STEREO_CONTROL, OTG, inst), \
 		SRI_ARR(OTG_3D_STRUCTURE_CONTROL, OTG, inst),                            \
 		SRI_ARR(OTG_STEREO_STATUS, OTG, inst),                                   \
@@ -472,6 +474,11 @@
 		SRI_ARR(OTG_M_CONST_DTO0, OTG, inst),                                    \
 		SRI_ARR(OTG_M_CONST_DTO1, OTG, inst),                                    \
 		SRI_ARR(OTG_CLOCK_CONTROL, OTG, inst),                                   \
+		SRI_ARR(OTG_COUNT_CONTROL, OTG, inst),                                   \
+		SRI_ARR(OTG_COUNT_RESET, OTG, inst),                                   \
+		SRI_ARR(OTG_CRC_SIG_BLUE_CONTROL_MASK, OTG, inst),                      \
+		SRI_ARR(OTG_CRC_SIG_RED_GREEN_MASK, OTG, inst),                      \
+		SRI_ARR(OTG_DRR_TIMING_INT_STATUS, OTG, inst),                      \
 		SRI_ARR(OTG_VERTICAL_INTERRUPT0_CONTROL, OTG, inst),                     \
 		SRI_ARR(OTG_VERTICAL_INTERRUPT0_POSITION, OTG, inst),                    \
 		SRI_ARR(OTG_VERTICAL_INTERRUPT1_CONTROL, OTG, inst),                     \
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/28 Revert "drm/amd/display: dmub_cmd.h: add missing kernel-doc for enums"

In reply to [email protected]

From: James Lin <[email protected]>

[Why & How]
This reverts commit 7d9d8fc1db837bdf39a8947b2928ec562dab83f1.

1. Auto-generated Header: The file 'dmub_cmd.h' is an auto-generated header managed in an external repository (dmu_stg). Manual changes made directly in this repository will be overwritten and lost during the next automated weekly synchronization.

2. Tooling Compatibility: This header is governed by internal AMD firmware standards which require Doxygen formatting for cross-team documentation. Moving to kernel-doc syntax may break internal documentation pipelines.

3. Suppressing Warnings: Current 'make htmldocs' and 'make W=1' builds do not actively scan 'dmub_cmd.h' for kernel-doc compliance, thus no warnings are triggered during standard compilation. To address warnings generated when manually running './scripts/kernel-doc', we have added a notice at the file header indicating that this is an auto-generated file that does not strictly follow kernel-doc formatting. This ensures that any future linting tools or manual checks recognize the formatting as intentional.

---
 .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h   | 156 ++++++------------
 1 file changed, 48 insertions(+), 108 deletions(-)
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +48 -108
index c1becd664cb9..2f68438000ea 100644
@@ -1008,30 +1008,15 @@ union dmub_fw_boot_status {
  * enum dmub_fw_boot_status_bit - Enum bit definitions for SCRATCH0.
  */
 enum dmub_fw_boot_status_bit {
-	/** @DMUB_FW_BOOT_STATUS_BIT_DAL_FIRMWARE: 1 if DAL FW */
-	DMUB_FW_BOOT_STATUS_BIT_DAL_FIRMWARE = (1 << 0),
-	/** @DMUB_FW_BOOT_STATUS_BIT_MAILBOX_READY: 1 if mailbox ready */
-	DMUB_FW_BOOT_STATUS_BIT_MAILBOX_READY = (1 << 1),
-	/** @DMUB_FW_BOOT_STATUS_BIT_OPTIMIZED_INIT_DONE: 1 if init done */
-	DMUB_FW_BOOT_STATUS_BIT_OPTIMIZED_INIT_DONE = (1 << 2),
-	/** @DMUB_FW_BOOT_STATUS_BIT_RESTORE_REQUIRED: 1 if driver should call restore */
-	DMUB_FW_BOOT_STATUS_BIT_RESTORE_REQUIRED = (1 << 3),
-	/**
-	 * @DMUB_FW_BOOT_STATUS_BIT_DEFERRED_LOADED: 1 if VBIOS data is
-	 * deferred programmed
-	 */
-	DMUB_FW_BOOT_STATUS_BIT_DEFERRED_LOADED = (1 << 4),
-	/** @DMUB_FW_BOOT_STATUS_BIT_FAMS_ENABLED: 1 if FAMS is enabled */
-	DMUB_FW_BOOT_STATUS_BIT_FAMS_ENABLED = (1 << 5),
-	/**
-	 * @DMUB_FW_BOOT_STATUS_BIT_DETECTION_REQUIRED: 1 if detection needs
-	 * to be triggered by driver
-	 */
-	DMUB_FW_BOOT_STATUS_BIT_DETECTION_REQUIRED = (1 << 6),
-	/** @DMUB_FW_BOOT_STATUS_BIT_HW_POWER_INIT_DONE: 1 if hw power init is completed */
-	DMUB_FW_BOOT_STATUS_BIT_HW_POWER_INIT_DONE = (1 << 7),
-	/** @DMUB_FW_BOOT_STATUS_BIT_ONO_REGIONS_ENABLED: if ONO regions are enabled */
-	DMUB_FW_BOOT_STATUS_BIT_ONO_REGIONS_ENABLED = (1 << 8),
+	DMUB_FW_BOOT_STATUS_BIT_DAL_FIRMWARE = (1 << 0), /**< 1 if DAL FW */
+	DMUB_FW_BOOT_STATUS_BIT_MAILBOX_READY = (1 << 1), /**< 1 if mailbox ready */
+	DMUB_FW_BOOT_STATUS_BIT_OPTIMIZED_INIT_DONE = (1 << 2), /**< 1 if init done */
+	DMUB_FW_BOOT_STATUS_BIT_RESTORE_REQUIRED = (1 << 3), /**< 1 if driver should call restore */
+	DMUB_FW_BOOT_STATUS_BIT_DEFERRED_LOADED = (1 << 4), /**< 1 if VBIOS data is deferred programmed */
+	DMUB_FW_BOOT_STATUS_BIT_FAMS_ENABLED = (1 << 5), /**< 1 if FAMS is enabled*/
+	DMUB_FW_BOOT_STATUS_BIT_DETECTION_REQUIRED = (1 << 6), /**< 1 if detection need to be triggered by driver*/
+	DMUB_FW_BOOT_STATUS_BIT_HW_POWER_INIT_DONE = (1 << 7), /**< 1 if hw power init is completed */
+	DMUB_FW_BOOT_STATUS_BIT_ONO_REGIONS_ENABLED = (1 << 8), /**< 1 if ONO regions are enabled */
 };
 
 /* Register bit definition for SCRATCH5 */
@@ -1095,22 +1080,18 @@ enum dmub_ips_comand_type {
  */
 enum dmub_cursor_offload_comand_type {
 	/**
-	 * @DMUB_CMD__CURSOR_OFFLOAD_INIT:
 	 * Initializes the cursor offload feature.
 	 */
 	DMUB_CMD__CURSOR_OFFLOAD_INIT = 0,
 	/**
-	 * @DMUB_CMD__CURSOR_OFFLOAD_STREAM_ENABLE: Enables cursor offloading
-	 * for a stream and updates the timing parameters.
+	 * Enables cursor offloading for a stream and updates the timing parameters.
 	 */
 	DMUB_CMD__CURSOR_OFFLOAD_STREAM_ENABLE = 1,
 	/**
-	 * @DMUB_CMD__CURSOR_OFFLOAD_STREAM_DISABLE:
 	 * Disables cursor offloading for a given stream.
 	 */
 	DMUB_CMD__CURSOR_OFFLOAD_STREAM_DISABLE = 2,
 	/**
-	 * @DMUB_CMD__CURSOR_OFFLOAD_STREAM_PROGRAM:
 	 * Programs the latest data for a given stream.
 	 */
 	DMUB_CMD__CURSOR_OFFLOAD_STREAM_PROGRAM = 3,
@@ -1176,7 +1157,7 @@ enum dmub_fw_boot_options_bit {
  * [Header (256 Bytes)][Feature 1 (256 Bytes)][Feature 2 (256 Bytes)]...
  */
 
-/*
+/**
  * enum dmub_shared_state_feature_id - List of shared state features.
  */
 enum dmub_shared_state_feature_id {
@@ -1933,36 +1914,30 @@ enum dmub_cmd_type {
  */
 enum dmub_out_cmd_type {
 	/**
-	 * @DMUB_OUT_CMD__NULL: Invalid outbox command, ignored.
+	 * Invalid outbox command, ignored.
 	 */
 	DMUB_OUT_CMD__NULL = 0,
 	/**
-	 * @DMUB_OUT_CMD__DP_AUX_REPLY:
 	 * Command type used for DP AUX Reply data notification
 	 */
 	DMUB_OUT_CMD__DP_AUX_REPLY = 1,
 	/**
-	 * @DMUB_OUT_CMD__DP_HPD_NOTIFY:
 	 * Command type used for DP HPD event notification
 	 */
 	DMUB_OUT_CMD__DP_HPD_NOTIFY = 2,
 	/**
-	 * @DMUB_OUT_CMD__SET_CONFIG_REPLY:
 	 * Command type used for SET_CONFIG Reply notification
 	 */
 	DMUB_OUT_CMD__SET_CONFIG_REPLY = 3,
 	/**
-	 * @DMUB_OUT_CMD__DPIA_NOTIFICATION:
 	 * Command type used for USB4 DPIA notification
 	 */
 	DMUB_OUT_CMD__DPIA_NOTIFICATION = 5,
 	/**
-	 * @DMUB_OUT_CMD__HPD_SENSE_NOTIFY:
 	 * Command type used for HPD redetect notification
 	 */
 	DMUB_OUT_CMD__HPD_SENSE_NOTIFY = 6,
 	/**
-	 * @DMUB_OUT_CMD__FUSED_IO:
 	 * Command type used for Fused IO notification
 	 */
 	DMUB_OUT_CMD__FUSED_IO = 7,
@@ -2154,19 +2129,19 @@ struct dmub_rb_cmd_PLAT_54186_wa {
  */
 enum dmub_cmd_mall_type {
 	/**
-	 * @DMUB_CMD__MALL_ACTION_ALLOW: Allows display refresh from MALL.
+	 * Allows display refresh from MALL.
 	 */
 	DMUB_CMD__MALL_ACTION_ALLOW = 0,
 	/**
-	 * @DMUB_CMD__MALL_ACTION_DISALLOW: Disallows display refresh from MALL.
+	 * Disallows display refresh from MALL.
 	 */
 	DMUB_CMD__MALL_ACTION_DISALLOW = 1,
 	/**
-	 * @DMUB_CMD__MALL_ACTION_COPY_CURSOR: Cursor copy for MALL.
+	 * Cursor copy for MALL.
 	 */
 	DMUB_CMD__MALL_ACTION_COPY_CURSOR = 2,
 	/**
-	 * @DMUB_CMD__MALL_ACTION_NO_DF_REQ: Controls DF requests.
+	 * Controls DF requests.
 	 */
 	DMUB_CMD__MALL_ACTION_NO_DF_REQ = 3,
 };
@@ -2195,21 +2170,18 @@ struct dmub_rb_cmd_mall {
  */
 enum dmub_cmd_cab_type {
 	/**
-	 * @DMUB_CMD__CAB_NO_IDLE_OPTIMIZATION:
 	 * No idle optimizations (i.e. no CAB)
 	 */
 	DMUB_CMD__CAB_NO_IDLE_OPTIMIZATION = 0,
 	/**
-	 * @DMUB_CMD__CAB_NO_DCN_REQ: No DCN requests for memory
+	 * No DCN requests for memory
 	 */
 	DMUB_CMD__CAB_NO_DCN_REQ = 1,
 	/**
-	 * @DMUB_CMD__CAB_DCN_SS_FIT_IN_CAB:
 	 * Fit surfaces in CAB (i.e. CAB enable)
 	 */
 	DMUB_CMD__CAB_DCN_SS_FIT_IN_CAB = 2,
 	/**
-	 * @DMUB_CMD__CAB_DCN_SS_NOT_FIT_IN_CAB:
 	 * Do not fit surfaces in CAB (i.e. no CAB)
 	 */
 	DMUB_CMD__CAB_DCN_SS_NOT_FIT_IN_CAB = 3,
@@ -2224,7 +2196,7 @@ struct dmub_rb_cmd_cab_for_ss {
 	uint8_t debug_bits;     /* debug bits */
 };
 
-/*
+/**
  * Enum for indicating which MCLK switch mode per pipe
  */
 enum mclk_switch_mode {
@@ -2702,18 +2674,11 @@ struct dmub_fams2_stream_static_state_v1 {
  * p-state request to allow latency
  */
 enum dmub_fams2_allow_delay_check_mode {
-	/**
-	 * @FAMS2_ALLOW_DELAY_CHECK_NONE: No check for request to allow delay
-	 */
+	/* No check for request to allow delay */
 	FAMS2_ALLOW_DELAY_CHECK_NONE = 0,
-	/**
-	 * @FAMS2_ALLOW_DELAY_CHECK_FROM_START: Check for request to allow delay
-	 */
+	/* Check for request to allow delay */
 	FAMS2_ALLOW_DELAY_CHECK_FROM_START = 1,
-	/**
-	 * @FAMS2_ALLOW_DELAY_CHECK_FROM_PREPARE:
-	 * Check for prepare to allow delay
-	 */
+	/* Check for prepare to allow delay */
 	FAMS2_ALLOW_DELAY_CHECK_FROM_PREPARE = 2,
 };
 
@@ -2785,28 +2750,27 @@ struct dmub_rb_cmd_ib {
  */
 enum dmub_cmd_idle_opt_type {
 	/**
-	 * @DMUB_CMD__IDLE_OPT_DCN_RESTORE: DCN hardware restore.
+	 * DCN hardware restore.
 	 */
 	DMUB_CMD__IDLE_OPT_DCN_RESTORE = 0,
 
 	/**
-	 * @DMUB_CMD__IDLE_OPT_DCN_SAVE_INIT: DCN hardware save.
+	 * DCN hardware save.
 	 */
 	DMUB_CMD__IDLE_OPT_DCN_SAVE_INIT = 1,
 
 	/**
-	 * @DMUB_CMD__IDLE_OPT_DCN_NOTIFY_IDLE: DCN hardware notify idle.
+	 * DCN hardware notify idle.
 	 */
 	DMUB_CMD__IDLE_OPT_DCN_NOTIFY_IDLE = 2,
 
 	/**
-	 * @DMUB_CMD__IDLE_OPT_SET_DC_POWER_STATE:
 	 * DCN hardware notify power state.
 	 */
 	DMUB_CMD__IDLE_OPT_SET_DC_POWER_STATE = 3,
 
 	/**
-	 * @DMUB_CMD__IDLE_OPT_RELEASE_HW: DCN notify to release HW.
+	 * DCN notify to release HW.
 	 */
 	 DMUB_CMD__IDLE_OPT_RELEASE_HW = 4,
 };
@@ -2835,7 +2799,7 @@ struct dmub_rb_cmd_idle_opt_dcn_notify_idle {
 	struct dmub_dcn_notify_idle_cntl_data cntl_data;
 };
 
-/*
+/**
  * enum dmub_idle_opt_dc_power_state - DC power states.
  */
 enum dmub_idle_opt_dc_power_state {
@@ -2877,7 +2841,7 @@ struct dmub_clocks {
  */
 enum dmub_cmd_clk_mgr_type {
 	/**
-	 * @DMUB_CMD__CLK_MGR_NOTIFY_CLOCKS: Notify DMCUB of clock update.
+	 * Notify DMCUB of clock update.
 	 */
 	DMUB_CMD__CLK_MGR_NOTIFY_CLOCKS = 0,
 };
@@ -3122,40 +3086,21 @@ struct dmub_rb_cmd_dpphy_init {
  * 4 AUX request command bits are shifted to high nibble.
  */
 enum dp_aux_request_action {
-	/**
-	 * @DP_AUX_REQ_ACTION_I2C_WRITE: I2C-over-AUX write request
-	 */
+	/** I2C-over-AUX write request */
 	DP_AUX_REQ_ACTION_I2C_WRITE		= 0x00,
-	/**
-	 * @DP_AUX_REQ_ACTION_I2C_READ: I2C-over-AUX read request
-	 */
+	/** I2C-over-AUX read request */
 	DP_AUX_REQ_ACTION_I2C_READ		= 0x10,
-	/**
-	 * @DP_AUX_REQ_ACTION_I2C_STATUS_REQ: I2C-over-AUX write status request
-	 */
+	/** I2C-over-AUX write status request */
 	DP_AUX_REQ_ACTION_I2C_STATUS_REQ	= 0x20,
-	/**
-	 * @DP_AUX_REQ_ACTION_I2C_WRITE_MOT:
-	 * I2C-over-AUX write request with MOT=1
-	 */
+	/** I2C-over-AUX write request with MOT=1 */
 	DP_AUX_REQ_ACTION_I2C_WRITE_MOT		= 0x40,
-	/**
-	 * @DP_AUX_REQ_ACTION_I2C_READ_MOT:
-	 * I2C-over-AUX read request with MOT=1
-	 */
+	/** I2C-over-AUX read request with MOT=1 */
 	DP_AUX_REQ_ACTION_I2C_READ_MOT		= 0x50,
-	/**
-	 * @DP_AUX_REQ_ACTION_I2C_STATUS_REQ_MOT:
-	 * I2C-over-AUX write status request with MOT=1
-	 */
+	/** I2C-over-AUX write status request with MOT=1 */
 	DP_AUX_REQ_ACTION_I2C_STATUS_REQ_MOT	= 0x60,
-	/**
-	 * @DP_AUX_REQ_ACTION_DPCD_WRITE: Native AUX write request
-	 */
+	/** Native AUX write request */
 	DP_AUX_REQ_ACTION_DPCD_WRITE		= 0x80,
-	/**
-	 * @DP_AUX_REQ_ACTION_DPCD_READ: Native AUX read request
-	 */
+	/** Native AUX read request */
 	DP_AUX_REQ_ACTION_DPCD_READ		= 0x90
 };
 
@@ -3163,21 +3108,21 @@ enum dp_aux_request_action {
  * enum aux_return_code_type - DP AUX process return code listing.
  */
 enum aux_return_code_type {
-	/** @AUX_RET_SUCCESS: AUX process succeeded */
+	/** AUX process succeeded */
 	AUX_RET_SUCCESS = 0,
-	/** @AUX_RET_ERROR_UNKNOWN: AUX process failed with unknown reason */
+	/** AUX process failed with unknown reason */
 	AUX_RET_ERROR_UNKNOWN,
-	/** @AUX_RET_ERROR_INVALID_REPLY: AUX process completed with invalid reply */
+	/** AUX process completed with invalid reply */
 	AUX_RET_ERROR_INVALID_REPLY,
-	/** @AUX_RET_ERROR_TIMEOUT: AUX process timed out */
+	/** AUX process timed out */
 	AUX_RET_ERROR_TIMEOUT,
-	/** @AUX_RET_ERROR_HPD_DISCON: HPD was low during AUX process */
+	/** HPD was low during AUX process */
 	AUX_RET_ERROR_HPD_DISCON,
-	/** @AUX_RET_ERROR_ENGINE_ACQUIRE: Failed to acquire AUX engine */
+	/** Failed to acquire AUX engine */
 	AUX_RET_ERROR_ENGINE_ACQUIRE,
-	/** @AUX_RET_ERROR_INVALID_OPERATION: AUX request not supported */
+	/** AUX request not supported */
 	AUX_RET_ERROR_INVALID_OPERATION,
-	/** @AUX_RET_ERROR_PROTOCOL_ERROR: AUX process not available */
+	/** AUX process not available */
 	AUX_RET_ERROR_PROTOCOL_ERROR,
 };
 
@@ -3185,9 +3130,9 @@ enum aux_return_code_type {
  * enum aux_channel_type - DP AUX channel type listing.
  */
 enum aux_channel_type {
-	/** @AUX_CHANNEL_LEGACY_DDC: AUX thru Legacy DP AUX */
+	/** AUX thru Legacy DP AUX */
 	AUX_CHANNEL_LEGACY_DDC,
-	/** @AUX_CHANNEL_DPIA: AUX thru DPIA DP tunneling */
+	/** AUX thru DPIA DP tunneling */
 	AUX_CHANNEL_DPIA
 };
 
@@ -3672,7 +3617,7 @@ enum phy_link_rate {
 	 */
 };
 
-/*
+/**
  * enum dmub_phy_fsm_state - PHY FSM states.
  * PHY FSM state to transit to during PSR enable/disable.
  */
@@ -5949,11 +5894,10 @@ struct dmub_rb_cmd_abm_query_caps {
  */
 enum dmub_abm_ace_curve_type {
 	/**
-	 * @ABM_ACE_CURVE_TYPE__SW: ACE curve as defined by the SW layer.
+	 * ACE curve as defined by the SW layer.
 	 */
 	ABM_ACE_CURVE_TYPE__SW = 0,
 	/**
-	 * @ABM_ACE_CURVE_TYPE__SW_IF:
 	 * ACE curve as defined by the SW to HW translation interface layer.
 	 */
 	ABM_ACE_CURVE_TYPE__SW_IF = 1,
@@ -5964,11 +5908,10 @@ enum dmub_abm_ace_curve_type {
  */
 enum dmub_abm_histogram_type {
 	/**
-	 * @ABM_HISTOGRAM_TYPE__SW: ACE curve as defined by the SW layer.
+	 * ACE curve as defined by the SW layer.
 	 */
 	ABM_HISTOGRAM_TYPE__SW = 0,
 	/**
-	 * @ABM_HISTOGRAM_TYPE__SW_IF:
 	 * ACE curve as defined by the SW to HW translation interface layer.
 	 */
 	ABM_HISTOGRAM_TYPE__SW_IF = 1,
@@ -6174,17 +6117,14 @@ struct dmub_rb_cmd_get_visual_confirm_color {
  */
 enum dmub_cmd_panel_cntl_type {
 	/**
-	 * @DMUB_CMD__PANEL_CNTL_HW_INIT:
 	 * Initializes embedded panel hardware blocks.
 	 */
 	DMUB_CMD__PANEL_CNTL_HW_INIT = 0,
 	/**
-	 * @DMUB_CMD__PANEL_CNTL_QUERY_BACKLIGHT_INFO:
 	 * Queries backlight info for the embedded panel.
 	 */
 	DMUB_CMD__PANEL_CNTL_QUERY_BACKLIGHT_INFO = 1,
 	/**
-	 * @DMUB_CMD__PANEL_DEBUG_PWM_FREQ:
 	 * Sets the PWM Freq as per user's requirement.
 	 */
 	DMUB_CMD__PANEL_DEBUG_PWM_FREQ = 2,
Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/28 drm/amd/display: Enable DCN42 PMO policy

In reply to [email protected]

From: Nicholas Kazlauskas <[email protected]>

[Why]
The MinTTU policy in DML2.1 does not guarantee that we support p-state in blank. This is a delta vs dml2 and earlier revisions as the prefetch mode override has been removed in favor of a more configurable pstate optimizer.

[How]
The policy has been added in a prior patch, this patch enables it based on pmo flag.

---
 .../dml2_0/dml21/dml21_translation_helper.c   |   5 +-
 .../dc/dml2_0/dml21/inc/dml_top_types.h       |   1 +
 .../dml21/src/dml2_pmo/dml2_pmo_dcn42.c       | 144 ++++++++++++++++--
 .../dml21/src/dml2_pmo/dml2_pmo_dcn42.h       |   1 +
 .../dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c  |   4 -
 .../dml21/src/dml2_pmo/dml2_pmo_factory.c     |  16 ++
 .../dml21/src/dml2_top/dml2_top_soc15.c       |  30 +++-
 .../drm/amd/display/dc/dml2_0/dml2_wrapper.h  |   1 +
 8 files changed, 184 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_translation_helper.c +4 -1
index 25557c99a28e..f849fb882b2a 100644
@@ -36,6 +36,8 @@ static void dml21_populate_pmo_options(struct dml2_pmo_options *pmo_options,
 	pmo_options->disable_drr_var_when_var_active = in_dc->debug.disable_fams_gaming == INGAME_FAMS_DISABLE ||
 			in_dc->debug.disable_fams_gaming == INGAME_FAMS_MULTI_DISP_CLAMPED_ONLY;
 	pmo_options->disable_drr_clamped_when_var_active = in_dc->debug.disable_fams_gaming == INGAME_FAMS_DISABLE;
+
+	pmo_options->force_mandatory_uclk_pstate_support = config->pmo.force_mandatory_uclk_pstate_support;
 }
 
 static enum dml2_project_id dml21_dcn_revision_to_dml2_project_id(enum dce_version dcn_version)
@@ -690,7 +692,8 @@ static void populate_dml21_plane_config_from_plane_state(struct dml2_context *dm
 	plane->overrides.gpuvm_min_page_size_kbytes = soc_bb->gpuvm_min_page_size_kbytes;
 	plane->overrides.hostvm_min_page_size_kbytes = soc_bb->hostvm_min_page_size_kbytes;
 
-	plane->immediate_flip = plane_state->flip_immediate;
+	//Always true for DAL, we want to validate the worst case scenario as we have to switch b/w the two without possibility of failure.
+	plane->immediate_flip = true;
 
 	plane->composition.rect_out_height_spans_vactive =
 		plane_state->dst_rect.height >= stream->src.height &&
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/inc/dml_top_types.h +1 -0
index dff903a103db..8d7960a340c2 100644
@@ -71,6 +71,7 @@ struct dml2_pmo_options {
 	bool disable_dyn_odm;
 	bool disable_dyn_odm_for_multi_stream;
 	bool disable_dyn_odm_for_stream_with_svp;
+	bool force_mandatory_uclk_pstate_support;
 	struct dml2_pmo_pstate_strategy *override_strategy_lists[DML2_MAX_PLANES];
 	unsigned int num_override_strategies_per_list[DML2_MAX_PLANES];
 };
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn42.c +132 -12

187 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn42.h +1 -0
index 31ba8575351d..5db7877bb8ca 100644
@@ -12,6 +12,7 @@ struct dml2_pmo_initialize_in_out;
 struct dml2_pmo_test_for_pstate_support_in_out;
 
 bool pmo_dcn42_initialize(struct dml2_pmo_initialize_in_out *in_out);
+bool pmo_dcn42_fams2_optimize_for_pstate_support(struct dml2_pmo_optimize_for_pstate_support_in_out *in_out);
 bool pmo_dcn42_test_for_pstate_support(struct dml2_pmo_test_for_pstate_support_in_out *in_out);
 
 #endif /* __DML2_PMO_DCN42_H__ */
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c +0 -4
index b348c65a0f75..8301e23ab89f 100644
@@ -1884,10 +1884,6 @@ bool pmo_dcn4_fams2_init_for_pstate_support(struct dml2_pmo_init_for_pstate_supp
 
 	memset(s, 0, sizeof(struct dml2_pmo_scratch));
 
-	if (display_config->display_config.overrides.all_streams_blanked) {
-		return true;
-	}
-
 	pmo->scratch.pmo_dcn4.min_latency_index = in_out->base_display_config->stage1.min_clk_index_for_latency;
 	pmo->scratch.pmo_dcn4.max_latency_index = pmo->mcg_clock_table_size;
 	pmo->scratch.pmo_dcn4.cur_latency_index = in_out->base_display_config->stage1.min_clk_index_for_latency;
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_factory.c +16 -0
index af2ba7d08a61..a1164de13a05 100644
@@ -5,6 +5,7 @@
 #include "dml2_pmo_factory.h"
 #include "dml2_pmo_dcn4_fams2.h"
 #include "dml2_pmo_dcn3.h"
+#include "dml2_pmo_dcn42.h"
 #include "dml2_external_lib_deps.h"
 
 static bool dummy_init_for_stutter(struct dml2_pmo_init_for_stutter_in_out *in_out)
@@ -60,6 +61,21 @@ bool dml2_pmo_create(enum dml2_project_id project_id, struct dml2_pmo_instance *
 		result = true;
 		break;
 	case dml2_project_dcn42:
+		out->initialize = pmo_dcn42_initialize;
+
+		out->init_for_vmin = pmo_dcn4_fams2_init_for_vmin;
+		out->test_for_vmin = pmo_dcn4_fams2_test_for_vmin;
+		out->optimize_for_vmin = pmo_dcn4_fams2_optimize_for_vmin;
+
+		out->init_for_uclk_pstate = pmo_dcn4_fams2_init_for_pstate_support;
+		out->test_for_uclk_pstate = pmo_dcn42_test_for_pstate_support;
+		out->optimize_for_uclk_pstate = pmo_dcn42_fams2_optimize_for_pstate_support;
+
+		out->init_for_stutter = pmo_dcn4_fams2_init_for_stutter;
+		out->test_for_stutter = pmo_dcn4_fams2_test_for_stutter;
+		out->optimize_for_stutter = pmo_dcn4_fams2_optimize_for_stutter;
+		result = true;
+		break;
 	case dml2_project_dcn4x_stage2_auto_drr_svp:
 		out->initialize = pmo_dcn4_fams2_initialize;
 
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_top/dml2_top_soc15.c +29 -1
index fa20a91c6e16..e6c49c27035c 100644
@@ -782,6 +782,7 @@ static bool dml2_top_soc15_check_mode_supported(struct dml2_check_mode_supported
 
 	bool result = false;
 	bool mcache_success = false;
+	bool uclk_pstate_success = false;
 	memset(dpmm_programming, 0, sizeof(struct dml2_display_cfg_programming));
 
 	setup_unoptimized_display_config_with_meta(dml, &l->base_display_config_with_meta, in_out->display_config);
@@ -805,6 +806,24 @@ static bool dml2_top_soc15_check_mode_supported(struct dml2_check_mode_supported
 		mcache_success = dml2_top_optimization_perform_optimization_phase(&l->optimization_phase_locals, &mcache_phase);
 	}
 
+	if (result) {
+		if (dml->pmo_options.force_mandatory_uclk_pstate_support) {
+			struct optimization_phase_params uclk_phase =	{
+			.dml = dml,
+			.display_config = &l->base_display_config_with_meta,
+			.init_function = dml2_top_optimization_init_function_uclk_pstate,
+			.test_function = dml2_top_optimization_test_function_uclk_pstate,
+			.optimize_function = dml2_top_optimization_optimize_function_uclk_pstate,
+			.optimized_display_config = &l->optimized_display_config_with_meta,
+			.all_or_nothing = false,
+			};
+
+			uclk_pstate_success = dml2_top_optimization_perform_optimization_phase(&l->optimization_phase_locals, &uclk_phase);
+		} else {
+			uclk_pstate_success = true;
+		}
+	}
+
 	/*
 	* Call DPMM to map all requirements to minimum clock state
 	*/
@@ -817,7 +836,7 @@ static bool dml2_top_soc15_check_mode_supported(struct dml2_check_mode_supported
 		result = dml->dpmm_instance.map_mode_to_soc_dpm(&l->dppm_map_mode_params);
 	}
 
-	in_out->is_supported = mcache_success;
+	in_out->is_supported = mcache_success & uclk_pstate_success;
 	result = result && in_out->is_supported;
 
 	return result;
@@ -928,6 +947,15 @@ static bool dml2_top_soc15_build_mode_programming(struct dml2_build_mode_program
 	if (uclk_pstate_success) {
 		memcpy(&l->base_display_config_with_meta, &l->optimized_display_config_with_meta, sizeof(struct display_configuation_with_meta));
 		l->base_display_config_with_meta.stage3.success = true;
+	} else if (dml->pmo_options.force_mandatory_uclk_pstate_support) {
+		l->informative_params.instance = &dml->core_instance;
+		l->informative_params.programming = in_out->programming;
+		l->informative_params.mode_is_supported = false;
+
+		dml->core_instance.populate_informative(&l->informative_params);
+
+		in_out->programming->informative.failed_mcache_validation = true;
+		return false;
 	}
 
 	/*
drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper.h +1 -0
index 5ee489682f2e..2f2ae05dd59c 100644
@@ -232,6 +232,7 @@ struct dml2_configuration_options {
 	/* Only for debugging purposes when initializing SOCBB params via tool for DML21. */
 	struct socbb_ip_params_external *external_socbb_ip_params;
 	struct {
+		bool force_mandatory_uclk_pstate_support;
 		bool force_pstate_method_enable;
 		enum dml2_force_pstate_methods force_pstate_method_values[MAX_PIPES];
 	} pmo;
Signature · 1 line
2.43.0
#4 lore raw

PATCH 4/28 drm/amd/display: Fix eDP receiver ready status check in T7 sequence

In reply to [email protected]

From: Sung-huai Wang <[email protected]>

[Why]
Some eDP panels return sinkstatus as 0x5, causing the original sinkstatus == 1 check to never match and resulting in unnecessary polling delay. The equality check is too restrictive and doesn't properly validate the specific status bit that indicates receiver readiness.

[How]
Replace direct value comparison with proper bitmask check using DP_RECEIVE_PORT_0_STATUS constant.

---
 .../amd/display/dc/link/protocols/link_edp_panel_control.c    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +2 -2
index 72b5921227d2..e06a9ac65286 100644
@@ -462,7 +462,7 @@ bool edp_receiver_ready_T9(struct dc_link *link)
 		do {
 			sinkstatus = 1;
 			result = core_link_read_dpcd(link, DP_SINK_STATUS, &sinkstatus, sizeof(sinkstatus));
-			if (sinkstatus == 0)
+			if (!(sinkstatus & DP_RECEIVE_PORT_0_STATUS))
 				break;
 			if (result != DC_OK)
 				break;
@@ -492,7 +492,7 @@ bool edp_receiver_ready_T7(struct dc_link *link)
 		do {
 			sinkstatus = 0;
 			result = core_link_read_dpcd(link, DP_SINK_STATUS, &sinkstatus, sizeof(sinkstatus));
-			if (sinkstatus == 1)
+			if (sinkstatus & DP_RECEIVE_PORT_0_STATUS)
 				break;
 			if (result != DC_OK)
 				break;
Signature · 1 line
2.43.0
#5 lore raw

PATCH 5/28 drm/amd/display: Add KUnit test for CRC function

In reply to [email protected]

From: Aurabindo Pillai <[email protected]>

DM CRC parsing functions are an easy candidate for exploring the use of KUnit unit-testing frameworks. Add a few tests for the same.

The test file and .kunitconfig are placed under amdgpu_dm/tests/ to follow the convention of keeping test code separate from production sources.

Assisted-by Copilot:Claude-Opus-4.6
---
 drivers/gpu/drm/amd/display/Kconfig           |  12 ++
 .../gpu/drm/amd/display/amdgpu_dm/Makefile    |   5 +
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c |  17 ++-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_crc.h |   7 +
 .../amdgpu_dm/amdgpu_dm_kunit_helpers.h       |  19 +++
 .../amd/display/amdgpu_dm/tests/.kunitconfig  |  14 ++
 .../drm/amd/display/amdgpu_dm/tests/Makefile  |   7 +
 .../amdgpu_dm/tests/amdgpu_dm_crc_test.c      | 121 ++++++++++++++++++
 8 files changed, 198 insertions(+), 4 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_kunit_helpers.h
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/.kunitconfig
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/Makefile
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crc_test.c
drivers/gpu/drm/amd/display/Kconfig +12 -0
index abd3b6564373..38323e574c6b 100644
@@ -56,4 +56,16 @@ config DRM_AMD_SECURE_DISPLAY
 	  This option enables the calculation of crc of specific region via
 	  debugfs. Cooperate with specific DMCU FW.
 
+config DRM_AMD_DC_KUNIT_TEST
+	tristate "KUnit tests for the AMD DC display driver" if !KUNIT_ALL_TESTS
+	depends on DRM_AMD_DC && KUNIT && DEBUG_FS
+	default KUNIT_ALL_TESTS
+	help
+	  This option enables KUnit tests for the AMD Display Core driver.
+	  These tests validate core functionality like CRC source parsing,
+	  color management, and other utility functions.
+
+	  For more information on KUnit and unit tests in general, please
+	  refer to the KUnit documentation in Documentation/dev-tools/kunit/.
+
 endmenu
drivers/gpu/drm/amd/display/amdgpu_dm/Makefile +5 -0
index 89350aa9ca7e..914f89af047c 100644
@@ -59,3 +59,8 @@ AMDGPU_DM = $(addprefix $(AMDDALPATH)/amdgpu_dm/,$(AMDGPUDM))
 
 AMD_DISPLAY_FILES += $(AMDGPU_DM)
 endif
+
+# KUnit tests as separate module
+ifneq ($(CONFIG_DRM_AMD_DC_KUNIT_TEST),)
+obj-y += $(AMDDALPATH)/amdgpu_dm/tests/
+endif
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c +13 -4
index e9834d7b6534..3613e67d1085 100644
@@ -33,6 +33,7 @@
 #include "amdgpu_securedisplay.h"
 #include "amdgpu_dm_psr.h"
 #include "amdgpu_dm_replay.h"
+#include "amdgpu_dm_kunit_helpers.h"
 
 static const char *const pipe_crc_sources[] = {
 	"none",
@@ -43,7 +44,8 @@ static const char *const pipe_crc_sources[] = {
 	"auto",
 };
 
-static enum amdgpu_dm_pipe_crc_source dm_parse_crc_source(const char *source)
+STATIC_IFN_KUNIT
+enum amdgpu_dm_pipe_crc_source dm_parse_crc_source(const char *source)
 {
 	if (!source || !strcmp(source, "none"))
 		return AMDGPU_DM_PIPE_CRC_SOURCE_NONE;
@@ -58,25 +60,32 @@ static enum amdgpu_dm_pipe_crc_source dm_parse_crc_source(const char *source)
 
 	return AMDGPU_DM_PIPE_CRC_SOURCE_INVALID;
 }
+EXPORT_IF_KUNIT(dm_parse_crc_source);
 
-static bool dm_is_crc_source_crtc(enum amdgpu_dm_pipe_crc_source src)
+STATIC_IFN_KUNIT
+bool dm_is_crc_source_crtc(enum amdgpu_dm_pipe_crc_source src)
 {
 	return (src == AMDGPU_DM_PIPE_CRC_SOURCE_CRTC) ||
 	       (src == AMDGPU_DM_PIPE_CRC_SOURCE_CRTC_DITHER);
 }
+EXPORT_IF_KUNIT(dm_is_crc_source_crtc);
 
-static bool dm_is_crc_source_dprx(enum amdgpu_dm_pipe_crc_source src)
+STATIC_IFN_KUNIT
+bool dm_is_crc_source_dprx(enum amdgpu_dm_pipe_crc_source src)
 {
 	return (src == AMDGPU_DM_PIPE_CRC_SOURCE_DPRX) ||
 	       (src == AMDGPU_DM_PIPE_CRC_SOURCE_DPRX_DITHER);
 }
+EXPORT_IF_KUNIT(dm_is_crc_source_dprx);
 
-static bool dm_need_crc_dither(enum amdgpu_dm_pipe_crc_source src)
+STATIC_IFN_KUNIT
+bool dm_need_crc_dither(enum amdgpu_dm_pipe_crc_source src)
 {
 	return (src == AMDGPU_DM_PIPE_CRC_SOURCE_CRTC_DITHER) ||
 	       (src == AMDGPU_DM_PIPE_CRC_SOURCE_DPRX_DITHER) ||
 	       (src == AMDGPU_DM_PIPE_CRC_SOURCE_NONE);
 }
+EXPORT_IF_KUNIT(dm_need_crc_dither);
 
 const char *const *amdgpu_dm_crtc_get_crc_sources(struct drm_crtc *crtc,
 						  size_t *count)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.h +7 -0
index 8538513ea879..76731ee44e13 100644
@@ -148,4 +148,11 @@ void amdgpu_dm_crtc_secure_display_create_contexts(struct amdgpu_device *adev);
 #define amdgpu_dm_crtc_secure_display_create_contexts(x)
 #endif
 
+#ifdef CONFIG_DRM_AMD_DC_KUNIT_TEST
+enum amdgpu_dm_pipe_crc_source dm_parse_crc_source(const char *source);
+bool dm_is_crc_source_crtc(enum amdgpu_dm_pipe_crc_source src);
+bool dm_is_crc_source_dprx(enum amdgpu_dm_pipe_crc_source src);
+bool dm_need_crc_dither(enum amdgpu_dm_pipe_crc_source src);
+#endif
+
 #endif /* AMD_DAL_DEV_AMDGPU_DM_AMDGPU_DM_CRC_H_ */
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_kunit_helpers.h new file +19 -0
new file mode 100644
index 000000000000..4b2864375105
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright 2026 Advanced Micro Devices, Inc.
+ */
+
+#ifndef AMDGPU_DM_KUNIT_HELPERS_H
+#define AMDGPU_DM_KUNIT_HELPERS_H
+
+#if IS_ENABLED(CONFIG_DRM_AMD_DC_KUNIT_TEST)
+#define STATIC_IFN_KUNIT
+#define INLINE_IFN_KUNIT inline
+#define EXPORT_IF_KUNIT(symbol) EXPORT_SYMBOL(symbol)
+#else
+#define STATIC_IFN_KUNIT static
+#define INLINE_IFN_KUNIT
+#define EXPORT_IF_KUNIT(symbol)
+#endif
+
+#endif /* AMDGPU_DM_KUNIT_HELPERS_H */
drivers/gpu/drm/amd/display/amdgpu_dm/tests/.kunitconfig new file +14 -0
new file mode 100644
index 000000000000..36676326ade4
@@ -0,0 +1,14 @@
+CONFIG_KUNIT=y
+CONFIG_PCI=y
+CONFIG_DRM=y
+CONFIG_DRM_AMDGPU=y
+CONFIG_DRM_AMD_DC=y
+CONFIG_DEBUG_FS=y
+CONFIG_DRM_AMD_DC_KUNIT_TEST=y
+CONFIG_FW_LOADER=y
+CONFIG_DRM_KMS_HELPER=y
+CONFIG_DRM_TTM=y
+CONFIG_HWMON=y
+CONFIG_I2C=y
+CONFIG_POWER_SUPPLY=y
+CONFIG_CRC16=y
drivers/gpu/drm/amd/display/amdgpu_dm/tests/Makefile new file +7 -0
new file mode 100644
index 000000000000..1238d8832fa3
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for amdgpu_dm KUnit tests.
+
+ccflags-y += -I$(src)/..
+
+obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_crc_test.o
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crc_test.c new file +121 -0

121 lines not on this page · raw message

Signature · 1 line
2.43.0
#6 lore raw

PATCH 6/28 drm/amd/display: Add KUnit test for HDCP process_output

In reply to [email protected]

From: Alex Hung <[email protected]>

Expose process_output() as non-static when CONFIG_DRM_AMD_DC_KUNIT_TEST is enabled and add KUnit tests exercising its full branch logic:

- property_validate_dwork is always enqueued (delay=0)
- callback_dwork is scheduled when callback_needed is set
- callback_dwork is cancelled when callback_stop is set
- watchdog_timer_dwork is scheduled when watchdog_timer_needed is set
- watchdog_timer_dwork is cancelled when watchdog_timer_stop is set
- Both dworks are scheduled independently when both flags are set

Assisted-by Copilot:Claude-Sonnet-4.6
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   2 -
 .../amd/display/amdgpu_dm/amdgpu_dm_hdcp.c    |   5 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_hdcp.h    |  13 +-
 .../drm/amd/display/amdgpu_dm/tests/Makefile  |   5 +
 .../amdgpu_dm/tests/amdgpu_dm_hdcp_test.c     | 175 ++++++++++++++++++
 5 files changed, 196 insertions(+), 4 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_hdcp_test.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +0 -2
index 1e0ccf58cdb8..43056392a1f0 100644
@@ -45,8 +45,6 @@
  * in amdgpu_dm_kms.h file
  */
 
-#define AMDGPU_DM_MAX_DISPLAY_INDEX 31
-
 #define AMDGPU_DM_MAX_CRTC 6
 
 #define AMDGPU_DM_MAX_NUM_EDP 2
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c +4 -1
index a10401675f53..29e5bdb16b89 100644
@@ -31,6 +31,7 @@
 #include "dm_helpers.h"
 #include <drm/display/drm_hdcp_helper.h>
 #include "hdcp_psp.h"
+#include "amdgpu_dm_kunit_helpers.h"
 
 /*
  * If the SRM version being loaded is less than or equal to the
@@ -158,7 +159,8 @@ static int psp_set_srm(struct psp_context *psp,
 	return 0;
 }
 
-static void process_output(struct hdcp_workqueue *hdcp_work)
+STATIC_IFN_KUNIT
+void process_output(struct hdcp_workqueue *hdcp_work)
 {
 	struct mod_hdcp_output output = hdcp_work->output;
 
@@ -178,6 +180,7 @@ static void process_output(struct hdcp_workqueue *hdcp_work)
 
 	schedule_delayed_work(&hdcp_work->property_validate_dwork, msecs_to_jiffies(0));
 }
+EXPORT_IF_KUNIT(process_output);
 
 static void link_lock(struct hdcp_workqueue *work, bool lock)
 {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.h +12 -1
index 4faa344f196e..4bb072cfac1e 100644
@@ -31,12 +31,19 @@
 #include "hdcp.h"
 #include "dc.h"
 #include "dm_cp_psp.h"
-#include "amdgpu.h"
+
+/*
+ * Minimal declarations needed by this header.
+ * Full amdgpu/DM definitions come from amdgpu_dm.h included by each .c file.
+ */
+#define AMDGPU_DM_MAX_DISPLAY_INDEX 31
+struct amdgpu_dm_connector;
 
 struct mod_hdcp;
 struct mod_hdcp_link;
 struct mod_hdcp_display;
 struct cp_psp;
+struct amdgpu_device;
 
 struct hdcp_workqueue {
 	struct work_struct cpirq_work;
@@ -87,4 +94,8 @@ void hdcp_destroy(struct kobject *kobj, struct hdcp_workqueue *work);
 
 struct hdcp_workqueue *hdcp_create_workqueue(struct amdgpu_device *adev, struct cp_psp *cp_psp, struct dc *dc);
 
+#ifdef CONFIG_DRM_AMD_DC_KUNIT_TEST
+void process_output(struct hdcp_workqueue *hdcp_work);
+#endif
+
 #endif /* AMDGPU_DM_AMDGPU_DM_HDCP_H_ */
drivers/gpu/drm/amd/display/amdgpu_dm/tests/Makefile +5 -0
index 1238d8832fa3..9669ea79a666 100644
@@ -3,5 +3,10 @@
 # Makefile for amdgpu_dm KUnit tests.
 
 ccflags-y += -I$(src)/..
+ccflags-y += -I$(src)/../..
+ccflags-y += -I$(src)/../../include
+ccflags-y += -I$(src)/../../modules/inc
+ccflags-y += -I$(src)/../../dc
 
 obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_crc_test.o
+obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_hdcp_test.o
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_hdcp_test.c new file +175 -0

175 lines not on this page · raw message

Signature · 1 line
2.43.0
#7 lore raw

PATCH 7/28 drm/amd/display: Add KUnit test for colorop TF bitmasks

In reply to [email protected]

From: Alex Hung <[email protected]>

Add KUnit tests that verify the three supported transfer function bitmask constants exported by amdgpu_dm_colorop.c:
amdgpu_dm_supported_degam_tfs, amdgpu_dm_supported_shaper_tfs, and amdgpu_dm_supported_blnd_tfs.

Each bitmask is tested for presence of each expected curve flag and absence of any unexpected bits. A cross-check confirms that degam and blnd bitmasks are identical.

amdgpu_dm_initialize_default_pipeline() is not tested because it needs a fully initialised drm_plane backed by an amdgpu_device with DC color caps.

Assisted-by Copilot:Claude-Opus-4.6
---
 .../drm/amd/display/amdgpu_dm/tests/Makefile  |   1 +
 .../amdgpu_dm/tests/amdgpu_dm_colorop_test.c  | 161 ++++++++++++++++++
 2 files changed, 162 insertions(+)
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_colorop_test.c
drivers/gpu/drm/amd/display/amdgpu_dm/tests/Makefile +1 -0
index 9669ea79a666..e300bcf39835 100644
@@ -10,3 +10,4 @@ ccflags-y += -I$(src)/../../dc
 
 obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_crc_test.o
 obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_hdcp_test.o
+obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_colorop_test.o
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_colorop_test.c new file +161 -0

161 lines not on this page · raw message

Signature · 1 line
2.43.0
#8 lore raw

PATCH 8/28 drm/amd/display: Add KUnit test for color helpers

In reply to [email protected]

From: Alex Hung <[email protected]>

Add KUnit tests for six pure-logic functions in
amdgpu_dm_color.c: amdgpu_dm_fixpt_from_s3132,
__is_lut_linear, __drm_ctm_to_dc_matrix,
__drm_ctm_3x4_to_dc_matrix, amdgpu_tf_to_dc_tf,
and amdgpu_colorop_tf_to_dc_tf.

Expose these static functions under CONFIG_DRM_AMD_DC_KUNIT_TEST and add a new amdgpu_dm_color.h header with the KUnit-only prototypes. The test file re-declares the dc and amdgpu transfer function enums locally to avoid pulling in the full DC/amdgpu include chain that fails under UML.

26 test cases cover signed-magnitude to two's complement conversion, LUT linearity detection, CTM-to-DC matrix conversion, and transfer function enum mapping.

Assisted-by Copilot:Claude-Opus-4.6
---
 .../amd/display/amdgpu_dm/amdgpu_dm_color.c   |   65 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_color.h   |   89 ++
 .../drm/amd/display/amdgpu_dm/tests/Makefile  |    2 +
 .../amdgpu_dm/tests/amdgpu_dm_color_test.c    | 1071 +++++++++++++++++
 4 files changed, 1209 insertions(+), 18 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.h
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_color_test.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +47 -18
index 20a76d81d532..59a7d563451e 100644
@@ -29,9 +29,12 @@
 #include "amdgpu.h"
 #include "amdgpu_mode.h"
 #include "amdgpu_dm.h"
+#include "amdgpu_dm_color.h"
 #include "amdgpu_dm_colorop.h"
 #include "dc.h"
 #include "modules/color/color_gamma.h"
+#include "amdgpu_dm_kunit_helpers.h"
+
 
 /**
  * DOC: overview
@@ -157,8 +160,6 @@
  *
  */
 
-#define MAX_DRM_LUT_VALUE 0xFFFF
-#define MAX_DRM_LUT32_VALUE 0xFFFFFFFF
 #define SDR_WHITE_LEVEL_INIT_VALUE 80
 
 /**
@@ -172,7 +173,8 @@ void amdgpu_dm_init_color_mod(void)
 	setup_x_points_distribution();
 }
 
-static inline struct fixed31_32 amdgpu_dm_fixpt_from_s3132(__u64 x)
+STATIC_IFN_KUNIT INLINE_IFN_KUNIT
+struct fixed31_32 amdgpu_dm_fixpt_from_s3132(__u64 x)
 {
 	struct fixed31_32 val;
 
@@ -183,6 +185,7 @@ static inline struct fixed31_32 amdgpu_dm_fixpt_from_s3132(__u64 x)
 	val.value = x;
 	return val;
 }
+EXPORT_IF_KUNIT(amdgpu_dm_fixpt_from_s3132);
 
 #ifdef AMD_PRIVATE_COLOR
 /* Pre-defined Transfer Functions (TF)
@@ -421,12 +424,14 @@ amdgpu_dm_create_color_properties(struct amdgpu_device *adev)
  * Returns:
  * DRM LUT or NULL
  */
-static const struct drm_color_lut *
+STATIC_IFN_KUNIT
+const struct drm_color_lut *
 __extract_blob_lut(const struct drm_property_blob *blob, uint32_t *size)
 {
 	*size = blob ? drm_color_lut_size(blob) : 0;
 	return blob ? (struct drm_color_lut *)blob->data : NULL;
 }
+EXPORT_IF_KUNIT(__extract_blob_lut);
 
 /**
  * __extract_blob_lut32 - Extracts the DRM lut and lut size from a blob.
@@ -436,12 +441,14 @@ __extract_blob_lut(const struct drm_property_blob *blob, uint32_t *size)
  * Returns:
  * DRM LUT or NULL
  */
-static const struct drm_color_lut32 *
+STATIC_IFN_KUNIT
+const struct drm_color_lut32 *
 __extract_blob_lut32(const struct drm_property_blob *blob, uint32_t *size)
 {
 	*size = blob ? drm_color_lut32_size(blob) : 0;
 	return blob ? (struct drm_color_lut32 *)blob->data : NULL;
 }
+EXPORT_IF_KUNIT(__extract_blob_lut32);
 
 /**
  * __is_lut_linear - check if the given lut is a linear mapping of values
@@ -456,7 +463,8 @@ __extract_blob_lut32(const struct drm_property_blob *blob, uint32_t *size)
  * True if the given lut is a linear mapping of values, i.e. it acts like a
  * bypass LUT. Otherwise, false.
  */
-static bool __is_lut_linear(const struct drm_color_lut *lut, uint32_t size)
+STATIC_IFN_KUNIT
+bool __is_lut_linear(const struct drm_color_lut *lut, uint32_t size)
 {
 	int i;
 	uint32_t expected;
@@ -476,6 +484,7 @@ static bool __is_lut_linear(const struct drm_color_lut *lut, uint32_t size)
 	}
 	return true;
 }
+EXPORT_IF_KUNIT(__is_lut_linear);
 
 /**
  * __drm_lut_to_dc_gamma - convert the drm_color_lut to dc_gamma.
@@ -485,7 +494,8 @@ static bool __is_lut_linear(const struct drm_color_lut *lut, uint32_t size)
  *
  * The conversion depends on the size of the lut - whether or not it's legacy.
  */
-static void __drm_lut_to_dc_gamma(const struct drm_color_lut *lut,
+STATIC_IFN_KUNIT
+void __drm_lut_to_dc_gamma(const struct drm_color_lut *lut,
 				  struct dc_gamma *gamma, bool is_legacy)
 {
 	uint32_t r, g, b;
@@ -515,6 +525,7 @@ static void __drm_lut_to_dc_gamma(const struct drm_color_lut *lut,
 		gamma->entries.blue[i] = dc_fixpt_from_fraction(b, MAX_DRM_LUT_VALUE);
 	}
 }
+EXPORT_IF_KUNIT(__drm_lut_to_dc_gamma);
 
 /**
  * __drm_lut32_to_dc_gamma - convert the drm_color_lut to dc_gamma.
@@ -523,7 +534,8 @@ static void __drm_lut_to_dc_gamma(const struct drm_color_lut *lut,
  *
  * The conversion depends on the size of the lut - whether or not it's legacy.
  */
-static void __drm_lut32_to_dc_gamma(const struct drm_color_lut32 *lut, struct dc_gamma *gamma)
+STATIC_IFN_KUNIT
+void __drm_lut32_to_dc_gamma(const struct drm_color_lut32 *lut, struct dc_gamma *gamma)
 {
 	int i;
 
@@ -533,6 +545,7 @@ static void __drm_lut32_to_dc_gamma(const struct drm_color_lut32 *lut, struct dc
 		gamma->entries.blue[i] = dc_fixpt_from_fraction(lut[i].blue, MAX_DRM_LUT32_VALUE);
 	}
 }
+EXPORT_IF_KUNIT(__drm_lut32_to_dc_gamma);
 
 /**
  * __drm_ctm_to_dc_matrix - converts a DRM CTM to a DC CSC float matrix
@@ -541,8 +554,9 @@ static void __drm_lut32_to_dc_gamma(const struct drm_color_lut32 *lut, struct dc
  *
  * The matrix needs to be a 3x4 (12 entry) matrix.
  */
-static void __drm_ctm_to_dc_matrix(const struct drm_color_ctm *ctm,
-				   struct fixed31_32 *matrix)
+STATIC_IFN_KUNIT
+void __drm_ctm_to_dc_matrix(const struct drm_color_ctm *ctm,
+			   struct fixed31_32 *matrix)
 {
 	int i;
 
@@ -565,6 +579,7 @@ static void __drm_ctm_to_dc_matrix(const struct drm_color_ctm *ctm,
 		matrix[i] = amdgpu_dm_fixpt_from_s3132(ctm->matrix[i - (i / 4)]);
 	}
 }
+EXPORT_IF_KUNIT(__drm_ctm_to_dc_matrix);
 
 /**
  * __drm_ctm_3x4_to_dc_matrix - converts a DRM CTM 3x4 to a DC CSC float matrix
@@ -573,8 +588,9 @@ static void __drm_ctm_to_dc_matrix(const struct drm_color_ctm *ctm,
  *
  * The matrix needs to be a 3x4 (12 entry) matrix.
  */
-static void __drm_ctm_3x4_to_dc_matrix(const struct drm_color_ctm_3x4 *ctm,
-				       struct fixed31_32 *matrix)
+STATIC_IFN_KUNIT
+void __drm_ctm_3x4_to_dc_matrix(const struct drm_color_ctm_3x4 *ctm,
+				struct fixed31_32 *matrix)
 {
 	int i;
 
@@ -587,6 +603,7 @@ static void __drm_ctm_3x4_to_dc_matrix(const struct drm_color_ctm_3x4 *ctm,
 		matrix[i] = amdgpu_dm_fixpt_from_s3132(ctm->matrix[i]);
 	}
 }
+EXPORT_IF_KUNIT(__drm_ctm_3x4_to_dc_matrix);
 
 /**
  * __set_legacy_tf - Calculates the legacy transfer function
@@ -851,7 +868,8 @@ static int __set_input_tf_32(struct dc_color_caps *caps, struct dc_transfer_func
 	return res ? 0 : -ENOMEM;
 }
 
-static enum dc_transfer_func_predefined
+STATIC_IFN_KUNIT
+enum dc_transfer_func_predefined
 amdgpu_tf_to_dc_tf(enum amdgpu_transfer_function tf)
 {
 	switch (tf) {
@@ -879,8 +897,10 @@ amdgpu_tf_to_dc_tf(enum amdgpu_transfer_function tf)
 		return TRANSFER_FUNCTION_GAMMA26;
 	}
 }
+EXPORT_IF_KUNIT(amdgpu_tf_to_dc_tf);
 
-static enum dc_transfer_func_predefined
+STATIC_IFN_KUNIT
+enum dc_transfer_func_predefined
 amdgpu_colorop_tf_to_dc_tf(enum drm_colorop_curve_1d_type tf)
 {
 	switch (tf) {
@@ -900,8 +920,10 @@ amdgpu_colorop_tf_to_dc_tf(enum drm_colorop_curve_1d_type tf)
 		return TRANSFER_FUNCTION_LINEAR;
 	}
 }
+EXPORT_IF_KUNIT(amdgpu_colorop_tf_to_dc_tf);
 
-static void __to_dc_lut3d_color(struct dc_rgb *rgb,
+STATIC_IFN_KUNIT
+void __to_dc_lut3d_color(struct dc_rgb *rgb,
 				const struct drm_color_lut lut,
 				int bit_precision)
 {
@@ -909,8 +931,10 @@ static void __to_dc_lut3d_color(struct dc_rgb *rgb,
 	rgb->green = drm_color_lut_extract(lut.green, bit_precision);
 	rgb->blue  = drm_color_lut_extract(lut.blue, bit_precision);
 }
+EXPORT_IF_KUNIT(__to_dc_lut3d_color);
 
-static void __drm_3dlut_to_dc_3dlut(const struct drm_color_lut *lut,
+STATIC_IFN_KUNIT
+void __drm_3dlut_to_dc_3dlut(const struct drm_color_lut *lut,
 				    uint32_t lut3d_size,
 				    struct tetrahedral_params *params,
 				    bool use_tetrahedral_9,
@@ -953,8 +977,10 @@ static void __drm_3dlut_to_dc_3dlut(const struct drm_color_lut *lut,
 	/* lut0 has 1229 points (lut_size/4 + 1) */
 	__to_dc_lut3d_color(&lut0[lut_i], lut[i], bit_depth);
 }
+EXPORT_IF_KUNIT(__drm_3dlut_to_dc_3dlut);
 
-static void __to_dc_lut3d_32_color(struct dc_rgb *rgb,
+STATIC_IFN_KUNIT
+void __to_dc_lut3d_32_color(struct dc_rgb *rgb,
 				   const struct drm_color_lut32 lut,
 				   int bit_precision)
 {
@@ -962,8 +988,10 @@ static void __to_dc_lut3d_32_color(struct dc_rgb *rgb,
 	rgb->green = drm_color_lut32_extract(lut.green, bit_precision);
 	rgb->blue  = drm_color_lut32_extract(lut.blue, bit_precision);
 }
+EXPORT_IF_KUNIT(__to_dc_lut3d_32_color);
 
-static void __drm_3dlut32_to_dc_3dlut(const struct drm_color_lut32 *lut,
+STATIC_IFN_KUNIT
+void __drm_3dlut32_to_dc_3dlut(const struct drm_color_lut32 *lut,
 				       uint32_t lut3d_size,
 				       struct tetrahedral_params *params,
 				       bool use_tetrahedral_9,
@@ -1006,6 +1034,7 @@ static void __drm_3dlut32_to_dc_3dlut(const struct drm_color_lut32 *lut,
 	/* lut0 has 1229 points (lut_size/4 + 1) */
 	__to_dc_lut3d_32_color(&lut0[lut_i], lut[i], bit_depth);
 }
+EXPORT_IF_KUNIT(__drm_3dlut32_to_dc_3dlut);
 
 /* amdgpu_dm_atomic_lut3d - set DRM 3D LUT to DC stream
  * @drm_lut3d: user 3D LUT
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.h new file +89 -0

89 lines not on this page · raw message

drivers/gpu/drm/amd/display/amdgpu_dm/tests/Makefile +2 -0
index e300bcf39835..2b442353beae 100644
@@ -7,7 +7,9 @@ ccflags-y += -I$(src)/../..
 ccflags-y += -I$(src)/../../include
 ccflags-y += -I$(src)/../../modules/inc
 ccflags-y += -I$(src)/../../dc
+ccflags-y += -I$(src)/../../../amdgpu
 
 obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_crc_test.o
 obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_hdcp_test.o
+obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_color_test.o
 obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_colorop_test.o
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_color_test.c new file +1071 -0

1,071 lines not on this page · raw message

Signature · 1 line
2.43.0
#9 lore raw

PATCH 9/28 drm/amd/display: Add KUnit test for PSR function

In reply to [email protected]

From: Alex Hung <[email protected]>

Add KUnit tests for amdgpu_dm_psr_fill_caps() which validates PSR capability population from DPCD data.

Export amdgpu_dm_psr_fill_caps() conditionally when CONFIG_DRM_AMD_DC_KUNIT_TEST is enabled, following the existing pattern used by CRC and HDCP test files.

The test covers PSR version mapping, RFB setup time calculation, link training flag, DPCD field passthrough, rate control caps, and power optimization flags.

Assisted-by Copilot:Claude-Opus-4.6
---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c |   6 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_psr.h |   5 +
 .../drm/amd/display/amdgpu_dm/tests/Makefile  |   1 +
 .../amdgpu_dm/tests/amdgpu_dm_psr_test.c      | 255 ++++++++++++++++++
 4 files changed, 266 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_psr_test.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c +5 -1
index dc5913a6456e..4b823bba4392 100644
@@ -29,6 +29,8 @@
 #include "dc.h"
 #include "amdgpu_dm.h"
 #include "modules/power/power_helpers.h"
+#include "amdgpu_dm_kunit_helpers.h"
+
 
 static bool link_supports_psrsu(struct dc_link *link)
 {
@@ -58,7 +60,8 @@ static bool link_supports_psrsu(struct dc_link *link)
 	return false;
 }
 
-static void amdgpu_dm_psr_fill_caps(struct dc_link *link, struct psr_caps *caps)
+STATIC_IFN_KUNIT
+void amdgpu_dm_psr_fill_caps(struct dc_link *link, struct psr_caps *caps)
 {
 	struct dpcd_caps *dpcd_caps = &link->dpcd_caps;
 	unsigned int power_opts = 0;
@@ -86,6 +89,7 @@ static void amdgpu_dm_psr_fill_caps(struct dc_link *link, struct psr_caps *caps)
 	caps->rate_control_caps = 0; /* TODO: read in rc caps from aux */
 	caps->psr_power_opt_flag = power_opts;
 }
+EXPORT_IF_KUNIT(amdgpu_dm_psr_fill_caps);
 
 /*
  * amdgpu_dm_set_psr_caps() - set link psr capabilities
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.h +5 -0
index 16d535806ad6..1a41d9b99eb4 100644
@@ -39,4 +39,9 @@ bool amdgpu_dm_psr_is_active_allowed(struct amdgpu_display_manager *dm);
 bool amdgpu_dm_psr_set_event(struct amdgpu_display_manager *dm,
 		struct dc_stream_state *stream, bool set_event,	enum psr_event event,
 		bool wait_for_disable);
+
+#ifdef CONFIG_DRM_AMD_DC_KUNIT_TEST
+void amdgpu_dm_psr_fill_caps(struct dc_link *link, struct psr_caps *caps);
+#endif
+
 #endif /* AMDGPU_DM_AMDGPU_DM_PSR_H_ */
drivers/gpu/drm/amd/display/amdgpu_dm/tests/Makefile +1 -0
index 2b442353beae..f29b5c0dac8e 100644
@@ -13,3 +13,4 @@ obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_crc_test.o
 obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_hdcp_test.o
 obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_color_test.o
 obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_colorop_test.o
+obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_psr_test.o
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_psr_test.c new file +255 -0

255 lines not on this page · raw message

Signature · 1 line
2.43.0
#10 lore raw

PATCH 10/28 drm/amd/display: Add KUnit test for replay

In reply to [email protected]

From: Alex Hung <[email protected]>

Add KUnit tests for amdgpu_dm_link_supports_replay() which validates panel replay capability based on link DPCD caps, freesync state, and VSDB info. Nine test cases cover the positive path and each individual failure condition.

Export the function under CONFIG_DRM_AMD_DC_KUNIT_TEST and add the amdgpu include path to the tests Makefile so that amdgpu_dm.h can resolve amdgpu_mode.h types under UML.

Assisted-by Copilot:Claude-Opus-4.6
---
 .../amd/display/amdgpu_dm/amdgpu_dm_replay.c  |   3 +
 .../drm/amd/display/amdgpu_dm/tests/Makefile  |   1 +
 .../amdgpu_dm/tests/amdgpu_dm_replay_test.c   | 206 ++++++++++++++++++
 3 files changed, 210 insertions(+)
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_replay_test.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c +3 -0
index 297125d1db70..22aa4305d2af 100644
@@ -31,6 +31,8 @@
 #include "modules/power/power_helpers.h"
 #include "dmub/inc/dmub_cmd.h"
 #include "dc/inc/link_service.h"
+#include "amdgpu_dm_kunit_helpers.h"
+
 
 /*
  * amdgpu_dm_link_supports_replay() - check if the link supports replay
@@ -68,6 +70,7 @@ bool amdgpu_dm_link_supports_replay(struct dc_link *link, struct amdgpu_dm_conne
 
 	return true;
 }
+EXPORT_IF_KUNIT(amdgpu_dm_link_supports_replay);
 
 /*
  * amdgpu_dm_set_replay_caps() - setup Replay capabilities
drivers/gpu/drm/amd/display/amdgpu_dm/tests/Makefile +1 -0
index f29b5c0dac8e..7d9c983f4995 100644
@@ -14,3 +14,4 @@ obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_hdcp_test.o
 obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_color_test.o
 obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_colorop_test.o
 obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_psr_test.o
+obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_replay_test.o
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_replay_test.c new file +206 -0

206 lines not on this page · raw message

Signature · 1 line
2.43.0
#11 lore raw

PATCH 11/28 drm/amd/display: Add KUnit test for ISM functions

In reply to [email protected]

From: Alex Hung <[email protected]>

Add KUnit tests for three static functions in amdgpu_dm_ism.c:
dm_ism_next_state, dm_ism_get_sso_delay, and dm_ism_get_idle_allow_delay.

The 32 test cases cover the full FSM transition table, SSO delay calculation with various timings, and hysteresis-based idle allow delay including circular buffer wraparound and old history cutoff logic.

Conditionally remove static linkage and export the three functions under CONFIG_DRM_AMD_DC_KUNIT_TEST so the test module can call them.

Assisted-by Copilot:Claude-Opus-4.6
---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c |  20 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.h |  10 +
 .../drm/amd/display/amdgpu_dm/tests/Makefile  |   1 +
 .../amdgpu_dm/tests/amdgpu_dm_ism_test.c      | 636 ++++++++++++++++++
 4 files changed, 661 insertions(+), 6 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_ism_test.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c +14 -6
index d03ea3bafd46..bc7db5e759d1 100644
@@ -32,6 +32,8 @@
 #include "amdgpu_dm_ism.h"
 #include "amdgpu_dm_crtc.h"
 #include "amdgpu_dm_trace.h"
+#include "amdgpu_dm_kunit_helpers.h"
+
 
 /**
  * dm_ism_next_state - Get next state based on current state and event
@@ -42,9 +44,10 @@
  * This function defines the idle state management FSM. Invalid transitions
  * are ignored and will not progress the FSM.
  */
-static bool dm_ism_next_state(enum amdgpu_dm_ism_state current_state,
-			      enum amdgpu_dm_ism_event event,
-			      enum amdgpu_dm_ism_state *next_state)
+STATIC_IFN_KUNIT
+bool dm_ism_next_state(enum amdgpu_dm_ism_state current_state,
+		       enum amdgpu_dm_ism_event event,
+		       enum amdgpu_dm_ism_state *next_state)
 {
 	switch (STATE_EVENT(current_state, event)) {
 	case STATE_EVENT(DM_ISM_STATE_FULL_POWER_RUNNING,
@@ -125,8 +128,10 @@ static bool dm_ism_next_state(enum amdgpu_dm_ism_state current_state,
 	}
 	return true;
 }
+EXPORT_IF_KUNIT(dm_ism_next_state);
 
-static uint64_t dm_ism_get_sso_delay(const struct amdgpu_dm_ism *ism,
+STATIC_IFN_KUNIT
+uint64_t dm_ism_get_sso_delay(const struct amdgpu_dm_ism *ism,
 				     const struct dc_stream_state *stream)
 {
 	const struct amdgpu_dm_ism_config *config = &ism->config;
@@ -148,6 +153,7 @@ static uint64_t dm_ism_get_sso_delay(const struct amdgpu_dm_ism *ism,
 
 	return sso_delay_ns;
 }
+EXPORT_IF_KUNIT(dm_ism_get_sso_delay);
 
 /**
  * dm_ism_get_idle_allow_delay - Calculate hysteresis-based idle allow delay
@@ -157,8 +163,9 @@ static uint64_t dm_ism_get_sso_delay(const struct amdgpu_dm_ism *ism,
  * Calculates the delay before allowing idle optimizations based on recent
  * idle history and the current stream timing.
  */
-static uint64_t dm_ism_get_idle_allow_delay(const struct amdgpu_dm_ism *ism,
-					    const struct dc_stream_state *stream)
+STATIC_IFN_KUNIT
+uint64_t dm_ism_get_idle_allow_delay(const struct amdgpu_dm_ism *ism,
+				     const struct dc_stream_state *stream)
 {
 	const struct amdgpu_dm_ism_config *config = &ism->config;
 	uint32_t v_total, h_total;
@@ -217,6 +224,7 @@ static uint64_t dm_ism_get_idle_allow_delay(const struct amdgpu_dm_ism *ism,
 
 	return ret_ns;
 }
+EXPORT_IF_KUNIT(dm_ism_get_idle_allow_delay);
 
 /**
  * dm_ism_insert_record - Insert a record into the circular history buffer
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.h +10 -0
index fde0ddc8d4e4..4df6a82972a8 100644
@@ -148,4 +148,14 @@ void amdgpu_dm_ism_commit_event(struct amdgpu_dm_ism *ism,
 void amdgpu_dm_ism_disable(struct amdgpu_display_manager *dm);
 void amdgpu_dm_ism_enable(struct amdgpu_display_manager *dm);
 
+#if IS_ENABLED(CONFIG_DRM_AMD_DC_KUNIT_TEST)
+bool dm_ism_next_state(enum amdgpu_dm_ism_state current_state,
+		       enum amdgpu_dm_ism_event event,
+		       enum amdgpu_dm_ism_state *next_state);
+uint64_t dm_ism_get_sso_delay(const struct amdgpu_dm_ism *ism,
+			      const struct dc_stream_state *stream);
+uint64_t dm_ism_get_idle_allow_delay(const struct amdgpu_dm_ism *ism,
+				     const struct dc_stream_state *stream);
+#endif
+
 #endif
drivers/gpu/drm/amd/display/amdgpu_dm/tests/Makefile +1 -0
index 7d9c983f4995..768f9bbc50e1 100644
@@ -15,3 +15,4 @@ obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_color_test.o
 obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_colorop_test.o
 obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_psr_test.o
 obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_replay_test.o
+obj-$(CONFIG_DRM_AMD_DC_KUNIT_TEST) += amdgpu_dm_ism_test.o
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_ism_test.c new file +636 -0

636 lines not on this page · raw message

Signature · 1 line
2.43.0
#12 lore raw

PATCH 12/28 drm/amd/display: Enable dcn42 pstate pmo

In reply to [email protected]

From: Dmytro Laktyushkin <[email protected]>

[Why&How]
Set a flag to enable pstate pmo, we want to always allow pstate support on dcn42

---
 drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c +2 -0
index 1fc457cec293..efe025ca4ed3 100644
@@ -2290,6 +2290,8 @@ static bool dcn42_resource_construct(
 	dc->dml2_options.gpuvm_enable = true;
 	dc->dml2_options.hostvm_enable = true;
 
+	dc->dml2_options.pmo.force_mandatory_uclk_pstate_support = true;
+
 	/* SPL */
 	dc->caps.scl_caps.sharpener_support = true;
 
Signature · 1 line
2.43.0
#13 lore raw

PATCH 13/28 drm/amd/display: Refactor PSR functionality into dedicated power_psr module

In reply to [email protected]

From: Lohita Mudimela <[email protected]>

[Why]
Extract all PSR (Panel Self Refresh) related functions from power.c into a new power_psr.c module for better code organization and maintainability.

[How]
Create new power_psr.c file containing all PSR-related functions moved from power.c. Remove static qualifier from shared functions to enable cross-file access:
- psr_context_to_mod_power_psr_context: Convert PSR context to module power PSR context
- map_index_from_stream: Map stream to power entity index
- delay_two_frames: Wait for two frame periods

Add function declarations to header. Maintain forward declaration of struct core_power for type compatibility.

---
 .../drm/amd/display/modules/inc/mod_power.h   |  23 -
 .../drm/amd/display/modules/power/Makefile    |   2 +-
 .../gpu/drm/amd/display/modules/power/power.c | 562 +--------------
 .../drm/amd/display/modules/power/power_abm.c |  96 ---
 .../amd/display/modules/power/power_helpers.c | 158 -----
 .../amd/display/modules/power/power_helpers.h | 116 +++
 .../drm/amd/display/modules/power/power_psr.c | 665 ++++++++++++++++++
 7 files changed, 785 insertions(+), 837 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/modules/power/power_psr.c
drivers/gpu/drm/amd/display/modules/inc/mod_power.h +0 -23
index 440e4284b6f0..f9814cf7bbdb 100644
@@ -414,27 +414,4 @@ bool mod_power_backlight_nits_to_percent(struct mod_power *mod_power,
 		unsigned int backlight_millinit,
 		unsigned int *backlight_millipercent);
 
-void initialize_backlight_caps(struct core_power *core_power, unsigned int inst);
-
-unsigned int backlight_millipercent_to_pwm(
-		struct core_power *core_power, unsigned int millipercent, unsigned int inst);
-
-unsigned int backlight_millipercent_to_millinit(
-		struct core_power *core_power, unsigned int millipercent, unsigned int inst);
-
-void fill_backlight_level_params(struct core_power *core_power,
-	struct set_backlight_level_params *backlight_level_params,
-	int panel_inst, uint8_t aux_inst, unsigned int backlight_pwm,
-	enum backlight_control_type backlight_control_type,
-	unsigned int backlight_millinit, unsigned int transition_time_millisec,
-	bool is_hdr);
-
-bool mod_power_hw_init_backlight(struct mod_power *mod_power);
-
-void mod_power_update_backlight_on_mode_change(
-    struct core_power *core_power,
-    struct dc_link *link,
-    unsigned int panel_inst,
-    uint8_t aux_inst,
-    bool is_hdr);
 #endif /* MODULES_INC_MOD_POWER_H_ */
drivers/gpu/drm/amd/display/modules/power/Makefile +1 -1
index dd11f7d5617d..fc4ba5873fad 100644
@@ -23,7 +23,7 @@
 # Makefile for the 'power' sub-module of DAL.
 #
 
-MOD_POWER = power_helpers.o power.o power_abm.o
+MOD_POWER = power_helpers.o power.o power_abm.o power_psr.o
 
 AMD_DAL_MOD_POWER = $(addprefix $(AMDDALPATH)/modules/power/,$(MOD_POWER))
 #$(info ************  DAL POWER MODULE MAKEFILE ************)
drivers/gpu/drm/amd/display/modules/power/power.c +3 -559

603 lines not on this page · raw message

drivers/gpu/drm/amd/display/modules/power/power_abm.c +0 -96

102 lines not on this page · raw message

drivers/gpu/drm/amd/display/modules/power/power_helpers.c +0 -158

170 lines not on this page · raw message

drivers/gpu/drm/amd/display/modules/power/power_helpers.h +116 -0

127 lines not on this page · raw message

drivers/gpu/drm/amd/display/modules/power/power_psr.c new file +665 -0

665 lines not on this page · raw message

Signature · 1 line
2.43.0
#14 lore raw

PATCH 14/28 drm/amd/display: Fix assertion due to disable/enable CM blocks

In reply to [email protected]

From: Aric Cyr <[email protected]>

[why]
Some dc state transitions can result in CM blocks being disabled, then re-enabled. The disable will set a defer bit, but re-enable will not clear it. When optimizing later, an assert will be hit due to incorrect expected HW state.

[how]
Clear defer bits if the block is re-enabled before optimization is executed.

---
 drivers/gpu/drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c        | 3 +++
 drivers/gpu/drm/amd/display/dc/dpp/dcn30/dcn30_dpp_cm.c     | 1 +
 drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp_dscl.c | 1 +
 3 files changed, 5 insertions(+)
drivers/gpu/drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c +3 -0
index 8faffc2993b4..2ebc738c37f2 100644
@@ -603,6 +603,7 @@ static void dpp3_power_on_blnd_lut(
 		if (power_on) {
 			REG_UPDATE(CM_MEM_PWR_CTRL, BLNDGAM_MEM_PWR_FORCE, 0);
 			REG_WAIT(CM_MEM_PWR_STATUS, BLNDGAM_MEM_PWR_STATE, 0, 1, 5);
+			dpp_base->deferred_reg_writes.bits.disable_blnd_lut = false;
 		} else {
 			dpp_base->ctx->dc->optimized_required = true;
 			dpp_base->deferred_reg_writes.bits.disable_blnd_lut = true;
@@ -620,6 +621,7 @@ static void dpp3_power_on_hdr3dlut(
 		if (power_on) {
 			REG_UPDATE(CM_MEM_PWR_CTRL2, HDR3DLUT_MEM_PWR_FORCE, 0);
 			REG_WAIT(CM_MEM_PWR_STATUS2, HDR3DLUT_MEM_PWR_STATE, 0, 1, 5);
+			dpp_base->deferred_reg_writes.bits.disable_3dlut = false;
 		} else {
 			dpp_base->ctx->dc->optimized_required = true;
 			dpp_base->deferred_reg_writes.bits.disable_3dlut = true;
@@ -637,6 +639,7 @@ static void dpp3_power_on_shaper(
 		if (power_on) {
 			REG_UPDATE(CM_MEM_PWR_CTRL2, SHAPER_MEM_PWR_FORCE, 0);
 			REG_WAIT(CM_MEM_PWR_STATUS2, SHAPER_MEM_PWR_STATE, 0, 1, 5);
+			dpp_base->deferred_reg_writes.bits.disable_shaper = false;
 		} else {
 			dpp_base->ctx->dc->optimized_required = true;
 			dpp_base->deferred_reg_writes.bits.disable_shaper = true;
drivers/gpu/drm/amd/display/dc/dpp/dcn30/dcn30_dpp_cm.c +1 -0
index 99581f35e54b..e01d8e9672fc 100644
@@ -136,6 +136,7 @@ static void dpp3_power_on_gamcor_lut(
 			if (dpp_base->ctx->dc->caps.ips_v2_support)
 				REG_UPDATE(CM_MEM_PWR_CTRL, GAMCOR_MEM_PWR_DIS, 1);
 			REG_WAIT(CM_MEM_PWR_STATUS, GAMCOR_MEM_PWR_STATE, 0, 1, 5);
+			dpp_base->deferred_reg_writes.bits.disable_gamcor = false;
 		} else {
 			dpp_base->ctx->dc->optimized_required = true;
 			dpp_base->deferred_reg_writes.bits.disable_gamcor = true;
drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp_dscl.c +1 -0
index df3c21ef57a1..62994aecf499 100644
@@ -161,6 +161,7 @@ static void dpp401_power_on_dscl(
 				REG_WAIT(DSCL_MEM_PWR_STATUS, LUT_MEM_PWR_STATE, 0, 1, 100);
 			} else
 				REG_WAIT(DSCL_MEM_PWR_STATUS, LUT_MEM_PWR_STATE, 0, 1, 5);
+			dpp->base.deferred_reg_writes.bits.disable_dscl = false;
 		} else {
 			if (dpp->base.ctx->dc->debug.enable_mem_low_power.bits.dscl) {
 				dpp->base.ctx->dc->optimized_required = true;
Signature · 1 line
2.43.0
#15 lore raw

PATCH 15/28 drm/amd/display: Enable additional wait for pipe pending checks

In reply to [email protected]

From: Aric Cyr <[email protected]>

[why]
In cases where there are two FULL updates within the same display frame, it's possible for some blocks to be programmed a second time without having been latched completely from the first programming.

DCN 3.5 and up already work around this with additional validation checks for frame count and defer as needed via fsleep.

[how]
Enabled existing pipe checks generically for all DCN versions to avoid HW programming hazards.

Also removed redundant max_frame_count which can be determined by the register mask and shift.

---
 drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c  | 8 +++++---
 drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_init.c   | 2 ++
 drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_init.c   | 2 ++
 drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_init.c   | 2 ++
 drivers/gpu/drm/amd/display/dc/hwss/dcn301/dcn301_init.c | 2 ++
 drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_init.c   | 2 ++
 drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_init.c | 2 ++
 drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_init.c   | 2 ++
 drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_init.c | 2 ++
 drivers/gpu/drm/amd/display/dc/inc/hw/optc.h             | 1 -
 drivers/gpu/drm/amd/display/dc/optc/dcn35/dcn35_optc.c   | 1 -
 drivers/gpu/drm/amd/display/dc/optc/dcn42/dcn42_optc.c   | 2 --
 12 files changed, 21 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +5 -3
index fc2587ca56ec..a1c3c4454397 100644
@@ -181,6 +181,7 @@ void dcn10_set_wait_for_update_needed_for_pipe(struct dc *dc, struct pipe_ctx *p
 	uint32_t vupdate_start, vupdate_end;
 	struct crtc_position position;
 	unsigned int vpos, cur_frame;
+	uint32_t max_frame_count;
 
 	if (!pipe_ctx->stream ||
 		!pipe_ctx->stream_res.tg ||
@@ -197,7 +198,8 @@ void dcn10_set_wait_for_update_needed_for_pipe(struct dc *dc, struct pipe_ctx *p
 
 	struct optc *optc1 = DCN10TG_FROM_TG(tg);
 
-	ASSERT(optc1->max_frame_count != 0);
+	max_frame_count = optc1->tg_mask->OTG_FRAME_COUNT >> optc1->tg_shift->OTG_FRAME_COUNT;
+	ASSERT(max_frame_count != 0);
 
 	if (tg->funcs->is_tg_enabled && !tg->funcs->is_tg_enabled(tg))
 		return;
@@ -209,8 +211,8 @@ void dcn10_set_wait_for_update_needed_for_pipe(struct dc *dc, struct pipe_ctx *p
 	if (vpos < vupdate_start) {
 		pipe_ctx->wait_frame_count = cur_frame;
 	} else {
-		if (cur_frame + 1 > optc1->max_frame_count)
-			pipe_ctx->wait_frame_count = cur_frame + 1 - optc1->max_frame_count;
+		if (cur_frame + 1 > max_frame_count)
+			pipe_ctx->wait_frame_count = cur_frame + 1 - max_frame_count;
 		else
 			pipe_ctx->wait_frame_count = cur_frame + 1;
 	}
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_init.c +2 -0
index 079c226c1097..b5e82e190124 100644
@@ -118,6 +118,8 @@ static const struct hwseq_private_funcs dcn10_private_funcs = {
 	.dsc_pg_control = NULL,
 	.set_hdr_multiplier = dcn10_set_hdr_multiplier,
 	.verify_allow_pstate_change_high = dcn10_verify_allow_pstate_change_high,
+	.wait_for_pipe_update_if_needed = dcn10_wait_for_pipe_update_if_needed,
+	.set_wait_for_update_needed_for_pipe = dcn10_set_wait_for_update_needed_for_pipe,
 };
 
 void dcn10_hw_sequencer_construct(struct dc *dc)
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_init.c +2 -0
index ad253c586ea1..1797a91b0186 100644
@@ -136,6 +136,8 @@ static const struct hwseq_private_funcs dcn20_private_funcs = {
 	.dccg_init = dcn20_dccg_init,
 	.set_blend_lut = dcn20_set_blend_lut,
 	.set_shaper_3dlut = dcn20_set_shaper_3dlut,
+	.wait_for_pipe_update_if_needed = dcn10_wait_for_pipe_update_if_needed,
+	.set_wait_for_update_needed_for_pipe = dcn10_set_wait_for_update_needed_for_pipe,
 };
 
 void dcn20_hw_sequencer_construct(struct dc *dc)
drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_init.c +2 -0
index 5cbae0cdda96..9834d3075487 100644
@@ -145,6 +145,8 @@ static const struct hwseq_private_funcs dcn30_private_funcs = {
 	.wait_for_blank_complete = dcn20_wait_for_blank_complete,
 	.set_blend_lut = dcn30_set_blend_lut,
 	.set_shaper_3dlut = dcn20_set_shaper_3dlut,
+	.wait_for_pipe_update_if_needed = dcn10_wait_for_pipe_update_if_needed,
+	.set_wait_for_update_needed_for_pipe = dcn10_set_wait_for_update_needed_for_pipe,
 };
 
 void dcn30_hw_sequencer_construct(struct dc *dc)
drivers/gpu/drm/amd/display/dc/hwss/dcn301/dcn301_init.c +2 -0
index 33cc48cd0196..a570333aeac1 100644
@@ -142,6 +142,8 @@ static const struct hwseq_private_funcs dcn301_private_funcs = {
 	.wait_for_blank_complete = dcn20_wait_for_blank_complete,
 	.set_blend_lut = dcn30_set_blend_lut,
 	.set_shaper_3dlut = dcn20_set_shaper_3dlut,
+	.wait_for_pipe_update_if_needed = dcn10_wait_for_pipe_update_if_needed,
+	.set_wait_for_update_needed_for_pipe = dcn10_set_wait_for_update_needed_for_pipe,
 };
 
 void dcn301_hw_sequencer_construct(struct dc *dc)
drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_init.c +2 -0
index e56b9a46aecf..b14e6e60b878 100644
@@ -147,6 +147,8 @@ static const struct hwseq_private_funcs dcn31_private_funcs = {
 	.set_blend_lut = dcn30_set_blend_lut,
 	.set_shaper_3dlut = dcn20_set_shaper_3dlut,
 	.setup_hpo_hw_control = dcn31_setup_hpo_hw_control,
+	.wait_for_pipe_update_if_needed = dcn10_wait_for_pipe_update_if_needed,
+	.set_wait_for_update_needed_for_pipe = dcn10_set_wait_for_update_needed_for_pipe,
 };
 
 void dcn31_hw_sequencer_construct(struct dc *dc)
drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_init.c +2 -0
index 9900c87b4567..d782080883ab 100644
@@ -154,6 +154,8 @@ static const struct hwseq_private_funcs dcn314_private_funcs = {
 	.setup_hpo_hw_control = dcn31_setup_hpo_hw_control,
 	.calculate_dccg_k1_k2_values = dcn314_calculate_dccg_k1_k2_values,
 	.resync_fifo_dccg_dio = dcn314_resync_fifo_dccg_dio,
+	.wait_for_pipe_update_if_needed = dcn10_wait_for_pipe_update_if_needed,
+	.set_wait_for_update_needed_for_pipe = dcn10_set_wait_for_update_needed_for_pipe,
 };
 
 void dcn314_hw_sequencer_construct(struct dc *dc)
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_init.c +2 -0
index 849dae18b738..c68b20104773 100644
@@ -163,6 +163,8 @@ static const struct hwseq_private_funcs dcn32_private_funcs = {
 	.is_dp_dig_pixel_rate_div_policy = dcn32_is_dp_dig_pixel_rate_div_policy,
 	.apply_single_controller_ctx_to_hw = dce110_apply_single_controller_ctx_to_hw,
 	.reset_back_end_for_pipe = dcn20_reset_back_end_for_pipe,
+	.wait_for_pipe_update_if_needed = dcn10_wait_for_pipe_update_if_needed,
+	.set_wait_for_update_needed_for_pipe = dcn10_set_wait_for_update_needed_for_pipe,
 };
 
 void dcn32_hw_sequencer_init_functions(struct dc *dc)
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_init.c +2 -0
index 5d0dfb36f3e1..0908a791832b 100644
@@ -167,6 +167,8 @@ static const struct hwseq_private_funcs dcn401_private_funcs = {
 	.perform_3dlut_wa_unlock = dcn401_perform_3dlut_wa_unlock,
 	.program_pipe_sequence = dcn401_program_pipe_sequence,
 	.dc_ip_request_cntl = dcn401_dc_ip_request_cntl,
+	.wait_for_pipe_update_if_needed = dcn10_wait_for_pipe_update_if_needed,
+	.set_wait_for_update_needed_for_pipe = dcn10_set_wait_for_update_needed_for_pipe,
 };
 
 void dcn401_hw_sequencer_init_functions(struct dc *dc)
drivers/gpu/drm/amd/display/dc/inc/hw/optc.h +0 -1
index 0d5a8358a778..7f371cbb35cd 100644
@@ -68,7 +68,6 @@ struct optc {
 	int pstate_keepout;
 	struct dc_crtc_timing orginal_patched_timing;
 	enum signal_type signal;
-	uint32_t max_frame_count;
 };
 
 void optc1_read_otg_state(struct timing_generator *optc, struct dcn_otg_state *s);
drivers/gpu/drm/amd/display/dc/optc/dcn35/dcn35_optc.c +0 -1
index a880e4a6d165..62f45c156c32 100644
@@ -621,7 +621,6 @@ void dcn35_timing_generator_init(struct optc *optc1)
 	optc1->min_v_blank_interlace = 5;
 	optc1->min_h_sync_width = 4;
 	optc1->min_v_sync_width = 1;
-	optc1->max_frame_count = 0xFFFFFF;
 
 	dcn35_timing_generator_set_fgcg(
 		optc1, CTX->dc->debug.enable_fine_grain_clock_gating.bits.optc);
drivers/gpu/drm/amd/display/dc/optc/dcn42/dcn42_optc.c +0 -2
index ed66a2bbb8ae..a3431ec2f058 100644
@@ -283,9 +283,7 @@ void dcn42_timing_generator_init(struct optc *optc1)
 	optc1->min_v_blank_interlace = 5;
 	optc1->min_h_sync_width = 4;
 	optc1->min_v_sync_width = 1;
-	optc1->max_frame_count = 0xFFFFFF;
 
 	dcn35_timing_generator_set_fgcg(
 		optc1, CTX->dc->debug.enable_fine_grain_clock_gating.bits.optc);
 }
-
Signature · 1 line
2.43.0
#16 lore raw

PATCH 16/28 drm/amd/display: Fix ISM dc_lock deadlock during suspend

In reply to [email protected]

From: Ray Wu <[email protected]>

[Why]
System hang observed during suspend/resume while video is playing. amdgpu_dm_ism_disable() is called under dc_lock and waits for ISM delayed work via disable_delayed_work_sync(). The work handlers themselves take dc_lock, producing an ABBA deadlock when a worker is in flight at suspend time.

[How]
Split the disable path into two phases with opposite locking contracts:
1. amdgpu_dm_ism_disable() -- quiesces workers, must NOT hold dc_lock.
2. amdgpu_dm_ism_force_full_power() (new) -- drives the ISM FSM back to FULL_POWER_RUNNING, must hold dc_lock.

---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 25 +++++++--
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c | 56 ++++++++++++++++---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.h |  1 +
 3 files changed, 70 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +21 -4
index c41f017fe8f2..af0af7519517 100644
@@ -2327,9 +2327,16 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev)
 		adev->dm.idle_workqueue = NULL;
 	}
 
-	/* Disable ISM before dc_destroy() invalidates dm->dc */
+	/*
+	 * Disable ISM before dc_destroy() invalidates dm->dc.
+	 *
+	 * Quiesce workers first without dc_lock (they take dc_lock
+	 * themselves, so syncing under it would deadlock), then drive the
+	 * FSM back to FULL_POWER_RUNNING under dc_lock.
+	 */
+	amdgpu_dm_ism_disable(&adev->dm);
 	scoped_guard(mutex, &adev->dm.dc_lock)
-		amdgpu_dm_ism_disable(&adev->dm);
+		amdgpu_dm_ism_force_full_power(&adev->dm);
 
 	amdgpu_dm_destroy_drm_device(&adev->dm);
 
@@ -3362,9 +3369,14 @@ static int dm_suspend(struct amdgpu_ip_block *ip_block)
 	if (amdgpu_in_reset(adev)) {
 		enum dc_status res;
 
+		/* Quiesce ISM workers before taking dc_lock (workers take
+		 * dc_lock themselves; syncing under it would deadlock).
+		 */
+		amdgpu_dm_ism_disable(dm);
+
 		mutex_lock(&dm->dc_lock);
 
-		amdgpu_dm_ism_disable(dm);
+		amdgpu_dm_ism_force_full_power(dm);
 		dc_allow_idle_optimizations(adev->dm.dc, false);
 
 		dm->cached_dc_state = dc_state_create_copy(dm->dc->current_state);
@@ -3398,8 +3410,13 @@ static int dm_suspend(struct amdgpu_ip_block *ip_block)
 
 	amdgpu_dm_irq_suspend(adev);
 
+	/*
+	 * Quiesce ISM workers before taking dc_lock (workers take dc_lock
+	 * themselves; syncing under it would deadlock).
+	 */
+	amdgpu_dm_ism_disable(dm);
 	scoped_guard(mutex, &dm->dc_lock)
-		amdgpu_dm_ism_disable(dm);
+		amdgpu_dm_ism_force_full_power(dm);
 
 	hpd_rx_irq_work_suspend(dm);
 
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c +48 -8

82 lines not on this page · raw message

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.h +1 -0
index 4df6a82972a8..72e2dac49e55 100644
@@ -146,6 +146,7 @@ void amdgpu_dm_ism_fini(struct amdgpu_dm_ism *ism);
 void amdgpu_dm_ism_commit_event(struct amdgpu_dm_ism *ism,
 				enum amdgpu_dm_ism_event event);
 void amdgpu_dm_ism_disable(struct amdgpu_display_manager *dm);
+void amdgpu_dm_ism_force_full_power(struct amdgpu_display_manager *dm);
 void amdgpu_dm_ism_enable(struct amdgpu_display_manager *dm);
 
 #if IS_ENABLED(CONFIG_DRM_AMD_DC_KUNIT_TEST)
Signature · 1 line
2.43.0
#17 lore raw

PATCH 17/28 drm/amd/display: Use lockdep_assert_held() for dc_lock check

In reply to [email protected]

From: Ray Wu <[email protected]>

[Why]
mutex_is_locked() only tells whether *some* task holds the mutex, not the current one, so the existing ASSERT can silently pass when the caller violates the contract.

[How]
Use the kernel's lockdep debugging utility (include/linux/lockdep.h) and replace ASSERT(mutex_is_locked(&dm->dc_lock)) with lockdep_assert_held(&dm->dc_lock), which checks the current task's held-lock stack.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c +2 -2
index 857c22007743..1324b55c403c 100644
@@ -459,8 +459,8 @@ void amdgpu_dm_ism_commit_event(struct amdgpu_dm_ism *ism,
 	struct amdgpu_display_manager *dm = &adev->dm;
 	struct dm_crtc_state *acrtc_state = to_dm_crtc_state(acrtc->base.state);
 
-	/* ISM transitions must be called with mutex acquired */
-	ASSERT(mutex_is_locked(&dm->dc_lock));
+	/* ISM transitions must be called with dc_lock held */
+	lockdep_assert_held(&dm->dc_lock);
 
 	/* ISM should not run after dc is destroyed */
 	ASSERT(dm->dc);
Signature · 1 line
2.43.0
#18 lore raw

PATCH 18/28 drm/amd/display: Fix clear PSR config flow

In reply to [email protected]

From: Leon Huang <[email protected]>

[Why]
PSR config was being cleared unconditionally during setup, even when PSR was going to be enabled. A magic number was also used instead of a macro for DPCD access.

[How]
In PSR setup, clear PSR config when PSR is not enabled. And use macro definition instead of magic number to access specific DPCD.

---
 .../link/protocols/link_edp_panel_control.c   | 22 +++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +11 -11
index e06a9ac65286..dd21a4c45561 100644
@@ -713,17 +713,17 @@ bool edp_setup_psr(struct dc_link *link,
 			sizeof(link->dpcd_caps.psr_info.psr_version));
 	}
 
-	//Clear PSR cfg
-	memset(&psr_configuration, 0, sizeof(psr_configuration));
-	dm_helpers_dp_write_dpcd(
-		link->ctx,
-		link,
-		DP_PSR_EN_CFG,
-		&psr_configuration.raw,
-		sizeof(psr_configuration.raw));
-
-	if (link->psr_settings.psr_version == DC_PSR_VERSION_UNSUPPORTED)
+	if (link->psr_settings.psr_version == DC_PSR_VERSION_UNSUPPORTED) {
+		//Clear PSR cfg
+		memset(&psr_configuration, 0, sizeof(psr_configuration));
+		dm_helpers_dp_write_dpcd(
+			link->ctx,
+			link,
+			DP_PSR_EN_CFG,
+			&psr_configuration.raw,
+			sizeof(psr_configuration.raw));
 		return false;
+	}
 
 	dc = link->ctx->dc;
 	dmcu = dc->res_pool->dmcu;
@@ -765,7 +765,7 @@ bool edp_setup_psr(struct dc_link *link,
 	dm_helpers_dp_write_dpcd(
 		link->ctx,
 		link,
-		368,
+		DP_PSR_EN_CFG,
 		&psr_configuration.raw,
 		sizeof(psr_configuration.raw));
 
Signature · 1 line
2.43.0
#19 lore raw

PATCH 19/28 drm/amd/display: Exclude the MST overhead from BW deallocation

In reply to [email protected]

From: Cruise Hung <[email protected]>

[Why]
The MST overhead was incorrectly included
in the requested BW during BW deallocation.

[How]
Exclude the MST overhead from BW deallocation.

---
 .../gpu/drm/amd/display/dc/link/link_dpms.c   | 41 +++++++++----------
 1 file changed, 20 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/display/dc/link/link_dpms.c +20 -21
index d52155e86f0f..21f64946b993 100644
@@ -2097,10 +2097,10 @@ static enum dc_status enable_link(
 	return status;
 }
 
-static bool allocate_usb4_bandwidth_for_stream(struct dc_stream_state *stream, int bw)
+static bool allocate_usb4_bandwidth_for_stream(struct dc_stream_state *stream, int stream_bw)
 {
 	struct dc_link *link = stream->sink->link;
-	int req_bw = bw;
+	int req_bw = stream_bw;
 
 	DC_LOGGER_INIT(link->ctx->logger);
 
@@ -2108,39 +2108,38 @@ static bool allocate_usb4_bandwidth_for_stream(struct dc_stream_state *stream, i
 		return false;
 
 	if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST) {
-		int sink_index = 0;
+		int sink_index = -1;
 		unsigned int i = 0;
 
 		for (i = 0; i < link->sink_count; i++) {
 			if (link->remote_sinks[i] == NULL)
 				continue;
 
-			if (stream->sink->sink_id != link->remote_sinks[i]->sink_id)
+			if (stream->sink->sink_id != link->remote_sinks[i]->sink_id) {
+				DC_LOG_DEBUG("%s: add remote_sink=%s, request_bw=%d\n", __func__,
+					(const char *)(&link->remote_sinks[i]->edid_caps.display_name[0]),
+					link->dpia_bw_alloc_config.remote_sink_req_bw[i]);
+
 				req_bw += link->dpia_bw_alloc_config.remote_sink_req_bw[i];
-			else
+			} else
 				sink_index = i;
 		}
 
-		link->dpia_bw_alloc_config.remote_sink_req_bw[sink_index] = bw;
-	}
+		if (sink_index >= 0)
+			link->dpia_bw_alloc_config.remote_sink_req_bw[sink_index] = stream_bw;
+		else
+			DC_LOG_WARNING("%s: stream sink_id=%u not found in remote_sinks[]\n",
+				__func__, stream->sink->sink_id);
 
-	link->dpia_bw_alloc_config.dp_overhead = link_dpia_get_dp_overhead(link);
-	req_bw += link->dpia_bw_alloc_config.dp_overhead;
+		if (req_bw) {
+			link->dpia_bw_alloc_config.dp_overhead = link_dpia_get_dp_overhead(link);
+			req_bw += link->dpia_bw_alloc_config.dp_overhead;
+		} else
+			link->dpia_bw_alloc_config.dp_overhead = 0;
+	}
 
 	link_dp_dpia_allocate_usb4_bandwidth_for_stream(link, req_bw);
 
-	if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST) {
-		unsigned int i = 0;
-
-		for (i = 0; i < link->sink_count; i++) {
-			if (link->remote_sinks[i] == NULL)
-				continue;
-			DC_LOG_DEBUG("%s, remote_sink=%s, request_bw=%d\n", __func__,
-					(const char *)(&link->remote_sinks[i]->edid_caps.display_name[0]),
-					link->dpia_bw_alloc_config.remote_sink_req_bw[i]);
-		}
-	}
-
 	return true;
 }
 
Signature · 1 line
2.43.0
#20 lore raw

PATCH 20/28 drm/amd/display: Allow power up when PG disallowed in driver

In reply to [email protected]

From: Charlene Liu <[email protected]>

[Why]
Do not exit early dcn42 pg control functions on power up for pipe PG failsafe.

---
 .../amd/display/dc/pg/dcn42/dcn42_pg_cntl.c   | 43 +++++++++++--------
 1 file changed, 24 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/display/dc/pg/dcn42/dcn42_pg_cntl.c +24 -19
index 4a096fa3fc10..729c2b653161 100644
@@ -27,9 +27,6 @@ static bool pg_cntl42_dsc_pg_status(struct pg_cntl *pg_cntl, unsigned int dsc_in
 	struct dcn_pg_cntl *pg_cntl_dcn = TO_DCN_PG_CNTL(pg_cntl);
 	uint32_t pwr_status = 0;
 
-	if (pg_cntl->ctx->dc->debug.ignore_pg)
-		return true;
-
 	switch (dsc_inst) {
 	case 0: /* DSC0 */
 		REG_GET(DOMAIN16_PG_STATUS, DOMAIN_PGFSM_PWR_STATUS, &pwr_status);
@@ -64,9 +61,11 @@ void pg_cntl42_dsc_pg_control(struct pg_cntl *pg_cntl, unsigned int dsc_inst, bo
 		pg_cntl->ctx->dc->res_pool->dccg->funcs->enable_dsc(
 				pg_cntl->ctx->dc->res_pool->dccg, dsc_inst);
 
-	if (pg_cntl->ctx->dc->debug.ignore_pg ||
-		pg_cntl->ctx->dc->debug.disable_dsc_power_gate ||
-		pg_cntl->ctx->dc->idle_optimizations_allowed)
+    bool skip_pg = pg_cntl->ctx->dc->debug.ignore_pg ||
+			pg_cntl->ctx->dc->debug.disable_dsc_power_gate ||
+			pg_cntl->ctx->dc->idle_optimizations_allowed;
+
+	if (skip_pg && !power_on)
 		return;
 
 	block_enabled = pg_cntl42_dsc_pg_status(pg_cntl, dsc_inst);
@@ -261,11 +260,12 @@ void pg_cntl42_hpo_pg_control(struct pg_cntl *pg_cntl, bool power_on)
 	uint32_t power_forceon;
 	bool block_enabled;
 
-	if (pg_cntl->ctx->dc->debug.ignore_pg ||
-		pg_cntl->ctx->dc->debug.disable_hpo_power_gate ||
-		pg_cntl->ctx->dc->idle_optimizations_allowed)
-		return;
+	bool skip_pg = pg_cntl->ctx->dc->debug.ignore_pg ||
+			pg_cntl->ctx->dc->debug.disable_hpo_power_gate ||
+			pg_cntl->ctx->dc->idle_optimizations_allowed;
 
+	if (skip_pg && !power_on)
+		return;
 	block_enabled = pg_cntl42_hpo_pg_status(pg_cntl);
 	if (power_on) {
 		if (block_enabled)
@@ -316,9 +316,11 @@ void pg_cntl42_io_clk_pg_control(struct pg_cntl *pg_cntl, bool power_on)
 	uint32_t power_forceon;
 	bool block_enabled;
 
-	if (pg_cntl->ctx->dc->debug.ignore_pg ||
-		pg_cntl->ctx->dc->idle_optimizations_allowed ||
-		pg_cntl->ctx->dc->debug.disable_io_clk_power_gate)
+	bool skip_pg = pg_cntl->ctx->dc->debug.ignore_pg ||
+			pg_cntl->ctx->dc->idle_optimizations_allowed ||
+			pg_cntl->ctx->dc->debug.disable_io_clk_power_gate;
+
+	if (skip_pg && !power_on)
 		return;
 
 	block_enabled = pg_cntl42_io_clk_status(pg_cntl);
@@ -412,9 +414,11 @@ void pg_cntl42_mem_pg_control(struct pg_cntl *pg_cntl, bool power_on)
 	uint32_t power_forceon;
 	bool block_enabled;
 
-	if (pg_cntl->ctx->dc->debug.ignore_pg ||
-		pg_cntl->ctx->dc->idle_optimizations_allowed ||
-		pg_cntl->ctx->dc->debug.disable_mem_power_gate)
+	bool skip_pg = pg_cntl->ctx->dc->debug.ignore_pg ||
+			pg_cntl->ctx->dc->idle_optimizations_allowed ||
+			pg_cntl->ctx->dc->debug.disable_mem_power_gate;
+
+	if (skip_pg && !power_on)
 		return;
 
 	block_enabled = pg_cntl42_mem_status(pg_cntl);
@@ -464,9 +468,10 @@ void pg_cntl42_dio_pg_control(struct pg_cntl *pg_cntl, bool power_on)
 	uint32_t org_ip_request_cntl;
 	bool block_enabled;
 
-	if (pg_cntl->ctx->dc->debug.ignore_pg ||
-		pg_cntl->ctx->dc->idle_optimizations_allowed ||
-		pg_cntl->ctx->dc->debug.disable_dio_power_gate)
+	bool skip_pg = pg_cntl->ctx->dc->debug.ignore_pg ||
+			pg_cntl->ctx->dc->idle_optimizations_allowed ||
+			pg_cntl->ctx->dc->debug.disable_dio_power_gate;
+	if (skip_pg && !power_on)
 		return;
 
 	block_enabled = pg_cntl42_dio_pg_status(pg_cntl);
Signature · 1 line
2.43.0
#21 lore raw

PATCH 21/28 drm/amd/display: Refactor Replay functionality into dedicated power_replay module

In reply to [email protected]

From: Lohita Mudimela <[email protected]>

[Why]
Extract all Replay related functions from power.c and power_helpers.c into a new power_replay.c module for better code organization and maintainability.

[How]
Create new power_replay.c file containing
Replay-related functions moved from power.c
and power_helpers.c . Update mod_power.h with
function declarations. Maintain forward
declaration for type compatibility.

---
 .../drm/amd/display/modules/power/Makefile    |   4 +-
 .../gpu/drm/amd/display/modules/power/power.c | 781 +--------------
 .../drm/amd/display/modules/power/power_abm.c |   2 -
 .../amd/display/modules/power/power_helpers.c |  92 --
 .../amd/display/modules/power/power_helpers.h |   5 +
 .../amd/display/modules/power/power_replay.c  | 911 ++++++++++++++++++
 6 files changed, 921 insertions(+), 874 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/modules/power/power_replay.c
drivers/gpu/drm/amd/display/modules/power/Makefile +2 -2
index fc4ba5873fad..3000f392bdbc 100644
@@ -23,9 +23,9 @@
 # Makefile for the 'power' sub-module of DAL.
 #
 
-MOD_POWER = power_helpers.o power.o power_abm.o power_psr.o
+MOD_POWER = power_helpers.o power.o power_abm.o power_psr.o power_replay.o
 
 AMD_DAL_MOD_POWER = $(addprefix $(AMDDALPATH)/modules/power/,$(MOD_POWER))
 #$(info ************  DAL POWER MODULE MAKEFILE ************)
 
-AMD_DISPLAY_FILES += $(AMD_DAL_MOD_POWER)
+AMD_DISPLAY_FILES += $(AMD_DAL_MOD_POWER)
\ No newline at end of file
drivers/gpu/drm/amd/display/modules/power/power.c +3 -778

806 lines not on this page · raw message

drivers/gpu/drm/amd/display/modules/power/power_abm.c +0 -2
index 8ed7ce26476e..b94dbb9e64a7 100644
@@ -245,8 +245,6 @@ struct iram_table_v_2_2 {
 #define MOD_POWER_TO_CORE(mod_power)\
 		container_of(mod_power, struct core_power, mod_public)
 
-
-
 static uint16_t backlight_8_to_16(unsigned int backlight_8bit)
 {
 	return (uint16_t)(backlight_8bit * 0x101);
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +0 -92

99 lines not on this page · raw message

drivers/gpu/drm/amd/display/modules/power/power_helpers.h +5 -0
index 3a2ba87be706..600da3e33126 100644
@@ -203,4 +203,9 @@ bool mod_power_psr_notify_mode_change(struct mod_power *mod_power,
 	const struct dc_stream_state *stream,
 	struct dc_link *link,
 	unsigned int stream_index);
+void mod_power_replay_notify_mode_change(struct mod_power *mod_power,
+	struct dc *dc,
+	struct dc_link *link,
+	const struct dc_stream_state *stream,
+	unsigned int stream_index);
 #endif /* MODULES_POWER_POWER_HELPERS_H_ */
drivers/gpu/drm/amd/display/modules/power/power_replay.c new file +911 -0

911 lines not on this page · raw message

Signature · 1 line
2.43.0
#22 lore raw

PATCH 22/28 drm/amd/display: Fix integer overflow in bios_get_image()

In reply to [email protected]

From: Harry Wentland <[email protected]>

[Why&How]
The bounds check in bios_get_image() computes 'offset + size' using unsigned 32-bit arithmetic before comparing against bios_size. If a VBIOS image contains a near-UINT32_MAX offset the addition wraps to a small value, the comparison passes, and the function returns a wild pointer past the VBIOS mapping.

Additionally, the comparison uses '<' (strict), which incorrectly rejects the valid exact-fit case where offset + size == bios_size.

Fix both issues by restructuring the check to avoid the addition
entirely: first reject if offset alone exceeds bios_size, then check size against the remaining space (bios_size - offset). This eliminates the overflow and correctly permits exact-fit accesses.

Assisted-by GitHub Copilot:claude-opus-4.6
---
 drivers/gpu/drm/amd/display/dc/bios/bios_parser_helper.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/bios/bios_parser_helper.c +6 -3
index 8d2cf95ae739..e00dc05c2d9d 100644
@@ -37,10 +37,13 @@ uint8_t *bios_get_image(struct dc_bios *bp,
 	uint32_t offset,
 	uint32_t size)
 {
-	if (bp->bios && offset + size < bp->bios_size)
-		return bp->bios + offset;
-	else
+	if (!bp->bios)
 		return NULL;
+
+	if (offset > bp->bios_size || size > bp->bios_size - offset)
+		return NULL;
+
+	return bp->bios + offset;
 }
 
 #include "reg_helper.h"
Signature · 1 line
2.43.0
#23 lore raw

PATCH 23/28 drm/amd/display: Validate GPIO pin LUT table size before iterating

In reply to [email protected]

From: Harry Wentland <[email protected]>

[Why&How]
The GPIO pin table parsers in get_gpio_i2c_info() and bios_parser_get_gpio_pin_info() derive an element count from the VBIOS table_header.structuresize field, then iterate over gpio_pin[] entries. However, GET_IMAGE() only validates that the table header itself fits within the BIOS image. If the VBIOS reports a structuresize larger than the actual mapped data, the loop reads past the end of the BIOS image, causing an out-of-bounds read.

Fix this by calling bios_get_image() to validate that the full claimed structuresize is accessible within the BIOS image before entering the loop in both functions.

Assisted-by GitHub Copilot:claude-opus-4-6 Mythos
---
 drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +9 -0
index b4dd8219b8f0..39668db6d472 100644
@@ -493,6 +493,10 @@ static enum bp_result get_gpio_i2c_info(
 			- sizeof(struct atom_common_table_header))
 				/ sizeof(struct atom_gpio_pin_assignment);
 
+	if (!bios_get_image(&bp->base, DATA_TABLES(gpio_pin_lut),
+			    le16_to_cpu(header->table_header.structuresize)))
+		return BP_RESULT_BADBIOSTABLE;
+
 	pin = (struct atom_gpio_pin_assignment *) header->gpio_pin;
 
 	for (table_index = 0; table_index < count; table_index++) {
@@ -681,6 +685,11 @@ static enum bp_result bios_parser_get_gpio_pin_info(
 	count = (le16_to_cpu(header->table_header.structuresize)
 			- sizeof(struct atom_common_table_header))
 				/ sizeof(struct atom_gpio_pin_assignment);
+
+	if (!bios_get_image(&bp->base, DATA_TABLES(gpio_pin_lut),
+			    le16_to_cpu(header->table_header.structuresize)))
+		return BP_RESULT_BADBIOSTABLE;
+
 	for (i = 0; i < count; ++i) {
 		if (header->gpio_pin[i].gpio_id != gpio_id)
 			continue;
Signature · 1 line
2.43.0
#24 lore raw

PATCH 24/28 drm/amd/display: Add Auxless-ALPM support in VESA Panel Replay

In reply to [email protected]

From: Leon Huang <[email protected]>

[How]
Add Auxless-ALPM data in VESA PR initialization

---
 .../dc/link/protocols/link_dp_panel_replay.c        | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.c +13 -0
index 72d6e6011a09..d87f87a02d63 100644
@@ -321,6 +321,19 @@ bool dp_pr_copy_settings(struct dc_link *link, struct replay_context *replay_con
 	cmd.pr_copy_settings.data.flags.bitfields.dsc_enable_status = (pipe_ctx->stream->timing.flags.DSC == 1);
 	cmd.pr_copy_settings.data.debug.u32All = link->replay_settings.config.debug_flags;
 
+	// ALPM settings
+	cmd.pr_copy_settings.data.flags.bitfields.alpm_mode = (enum dmub_alpm_mode)link->replay_settings.config.alpm_mode;
+	if (link->replay_settings.config.alpm_mode == DC_ALPM_AUXLESS) {
+		cmd.pr_copy_settings.data.auxless_alpm_data.lfps_setup_ns = (uint16_t)dc->debug.auxless_alpm_lfps_setup_ns;
+		cmd.pr_copy_settings.data.auxless_alpm_data.lfps_period_ns = (uint16_t)dc->debug.auxless_alpm_lfps_period_ns;
+		cmd.pr_copy_settings.data.auxless_alpm_data.lfps_silence_ns = (uint16_t)dc->debug.auxless_alpm_lfps_silence_ns;
+		cmd.pr_copy_settings.data.auxless_alpm_data.lfps_t1_t2_override_us =
+			(uint16_t)dc->debug.auxless_alpm_lfps_t1t2_us;
+		cmd.pr_copy_settings.data.auxless_alpm_data.lfps_t1_t2_offset_us =
+			(uint16_t)dc->debug.auxless_alpm_lfps_t1t2_offset_us;
+		cmd.pr_copy_settings.data.auxless_alpm_data.lttpr_count = link->dc->link_srv->dp_get_lttpr_count(link);
+	}
+
 	cmd.pr_copy_settings.data.su_granularity_needed = link->dpcd_caps.vesa_replay_caps.bits.PR_SU_GRANULARITY_NEEDED;
 	cmd.pr_copy_settings.data.su_x_granularity = link->dpcd_caps.vesa_replay_su_info.pr_su_x_granularity;
 	cmd.pr_copy_settings.data.su_y_granularity = link->dpcd_caps.vesa_replay_su_info.pr_su_y_granularity;
Signature · 1 line
2.43.0
#25 lore raw

PATCH 25/28 drm/amd/display: Add debug option for replay ESD recovery

In reply to [email protected]

From: Wei-Guang Li <[email protected]>

[Why&How]
Add a new debug option "enable_replay_esd_recovery" to control whether to enable the replay ESD recovery feature.

---
 drivers/gpu/drm/amd/display/dc/dc.h                |  1 +
 .../dc/link/protocols/link_dp_irq_handler.c        | 14 ++++++++------
 2 files changed, 9 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
index d0b6fad65bc0..a356cf4faa1d 100644
@@ -1220,6 +1220,7 @@ struct dc_debug_options {
 	bool enable_otg_frame_sync_pwa;
 	unsigned int min_deep_sleep_dcfclk_khz;
 	unsigned int force_odm2to1_for_edp_pixclk_mhz;
+	bool enable_replay_esd_recovery;
 };
 
 
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_irq_handler.c +8 -6
index f9e0ba24d401..54ce768ae6ad 100644
@@ -312,12 +312,14 @@ static void handle_hpd_irq_replay_sink(struct dc_link *link, bool *need_re_enabl
 		}
 	}
 
-	if (!link->replay_settings.replay_allow_active &&
-	    replay_sink_status.bits.SINK_DEVICE_REPLAY_STATUS == 0x7) {
-	    /* If sink device replay status is 0x7 and replay is disabled,
-	     * it means sink is in a bad state and link retraining is needed to recover
-	     */
-	    *replay_esd_detection_needed = true;
+	if (link->ctx->dc->debug.enable_replay_esd_recovery) {
+		if (!link->replay_settings.replay_allow_active &&
+		    replay_sink_status.bits.SINK_DEVICE_REPLAY_STATUS == 0x7) {
+		    /* If sink device replay status is 0x7 and replay is disabled,
+		     * it means sink is in a bad state and link retraining is needed to recover
+		     */
+		    *replay_esd_detection_needed = true;
+		}
 	}
 }
 
Signature · 1 line
2.43.0
#26 lore raw

PATCH 26/28 drm/amd/display: Validate payload length and link_index in dc_process_dmub_aux_transfer_async

In reply to [email protected]

From: Harry Wentland <[email protected]>

[Why&How]
dc_process_dmub_aux_transfer_async() copies payload->length bytes into a 16-byte stack buffer (dpaux.data[16]) guarded only by an ASSERT(), which is a no-op in release builds. If a caller ever passes length > 16 this results in a stack buffer overflow via memcpy.

Additionally, link_index is used to dereference dc->links[] without bounds checking against dc->link_count, risking an out-of-bounds access.

Replace the ASSERT with a hard runtime check that returns false when payload->length exceeds the destination buffer size, and add a bounds check for link_index before it is used.

Assisted-by GitHub Copilot:Claude claude-4-opus
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +5 -1
index 48d32adb9eb3..0f37209c8330 100644
@@ -6615,7 +6615,11 @@ bool dc_process_dmub_aux_transfer_async(struct dc *dc,
 	uint8_t action;
 	union dmub_rb_cmd cmd = {0};
 
-	ASSERT(payload->length <= 16);
+	if (link_index >= dc->link_count || !dc->links[link_index])
+		return false;
+
+	if (payload->length > sizeof(cmd.dp_aux_access.aux_control.dpaux.data))
+		return false;
 
 	cmd.dp_aux_access.header.type = DMUB_CMD__DP_AUX_ACCESS;
 	cmd.dp_aux_access.header.payload_bytes = 0;
Signature · 1 line
2.43.0
#27 lore raw

PATCH 27/28 drm/amd/display: Add ADDR3 swizzle modes

In reply to [email protected]

From: Wenxian Wang <[email protected]>

[Why]
New swizzle modes are needed for ADDR3 block support.

[How]
Add DC_ADDR3_SW_64KB_2D_Z and DC_ADDR3_SW_256KB_2D_Z enum values to dc_hw_types.h.

---
 drivers/gpu/drm/amd/display/dc/dc_hw_types.h                 | 4 +++-
 drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc_hw_types.h +3 -1
index c2ca08d26e37..fa64bf6e711c 100644
@@ -346,7 +346,9 @@ enum swizzle_mode_addr3_values {
 	DC_ADDR3_SW_4KB_3D = 5,
 	DC_ADDR3_SW_64KB_3D = 6,
 	DC_ADDR3_SW_256KB_3D = 7,
-	DC_ADDR3_SW_MAX = 8,
+	DC_ADDR3_SW_64KB_2D_Z = 8,
+	DC_ADDR3_SW_256KB_2D_Z = 9,
+	DC_ADDR3_SW_MAX = 10,
 	DC_ADDR3_SW_UNKNOWN = DC_ADDR3_SW_MAX
 };
 
drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c +2 -0
index e12ed7591848..bf30a1bb61b7 100644
@@ -617,7 +617,9 @@ bool hubbub401_dcc_support_swizzle(
 			swizzle_supported = true;
 		break;
 	case DC_ADDR3_SW_64KB_2D:
+	case DC_ADDR3_SW_64KB_2D_Z:
 	case DC_ADDR3_SW_256KB_2D:
+	case DC_ADDR3_SW_256KB_2D_Z:
 		swizzle_supported = true;
 		break;
 	default:
Signature · 1 line
2.43.0
#28 lore raw

PATCH 28/28 drm/amd/display: Promote DC to 3.2.383

In reply to [email protected]

From: Taimur Hassan <[email protected]>

This version brings along the following updates:

- Add amdgpu_dm KUnit test for:
* CRC function
* HDCP process_output
* colorop TF bitmasks
* color helpers
* PSR and Replay functions
* ISM functions
- Fix eDP receiver ready status check in T7 sequence
- Enable dcn42 pstate pmo
- Refactor PSR. Replay and ABM functionality into dedicated power modules
- Fix assertion due to disable/enable CM blocks
- Enable additional wait for pipe pending checks
- Fix ISM dc_lock deadlock during suspend
- Use lockdep_assert_held() for dc_lock check
- Fix clear PSR config flow
- Exclude the MST overhead from BW deallocation
- Allow power up even w/ powergating disabled on DCN42
- Fix integer overflow in bios_get_image()
- Validate GPIO pin LUT table size before iterating
- Add Auxless-ALPM support in VESA Panel Replay
- Add debug option for replay ESD recovery.
- Validate payload length and link_index in dc_process_dmub_aux_transfer_async.
- Add ADDR3 swizzle modes.

---
 drivers/gpu/drm/amd/display/dc/dc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
index a356cf4faa1d..75f59ca927ff 100644
@@ -63,7 +63,7 @@ struct dcn_dsc_reg_state;
 struct dcn_optc_reg_state;
 struct dcn_dccg_reg_state;
 
-#define DC_VER "3.2.382"
+#define DC_VER "3.2.383"
 
 /**
  * MAX_SURFACES - representative of the upper bound of surfaces that can be piped to a single CRTC
Signature · 1 line
2.43.0
Tested-by on the v1 series
#29 lore raw
In reply to [email protected]

Public

Hi all,

This week this patchset was tested on 4 systems, two dGPU and two APU based, and tested across multiple display and connection types. This week was also the last promotion test ran on Ubuntu 24.04. There won't be any testing this week as we had a holiday this past Monday, so the first test on Ubuntu 26.04 will begin next week.

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

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

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

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

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

The patchset consists of the amd-staging-drm-next branch (Head commit -> 22055267cc98e8b94ac506d5c9dc5589e4cb09ea -> drm/amd/display: Enable DCN42 PMO policy) with new patches added on top of it.

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

Thank you,

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

Thank you,

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

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Wednesday, May 13, 2026 10:29 AM
To: [email protected]
Cc: Wentland, Harry <[email protected]>; Li, Sun peng (Leo) <[email protected]>; Pillai, Aurabindo <[email protected]>; Li, Roman <[email protected]>; Lin, Wayne <[email protected]>; Chung, ChiaHsuan (Tom) <[email protected]>; Zuo, Jerry <[email protected]>; Wheeler, Daniel <[email protected]>; Wu, Ray <[email protected]>; LIPSKI, IVAN <[email protected]>; Hung, Alex <[email protected]>; Lin, Ping Lei <[email protected]>; Chen, Chen-Yu <[email protected]>
Subject: [PATCH 00/28] DC Patches May 13, 2026

From: Ivan Lipski <[email protected]>

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

- Add amdgpu_dm KUnit test for:
* CRC function
* HDCP process_output
* colorop TF bitmasks
* color helpers
* PSR and Replay functions
* ISM functions
- Fix eDP receiver ready status check in T7 sequence
- Enable dcn42 pstate pmo
- Refactor PSR. Replay and ABM functionality into dedicated power modules
- Fix assertion due to disable/enable CM blocks
- Enable additional wait for pipe pending checks
- Fix ISM dc_lock deadlock during suspend
- Use lockdep_assert_held() for dc_lock check
- Fix clear PSR config flow
- Exclude the MST overhead from BW deallocation
- Allow power up even w/ powergating disabled on DCN42
- Fix integer overflow in bios_get_image()
- Validate GPIO pin LUT table size before iterating
- Add Auxless-ALPM support in VESA Panel Replay
- Add debug option for replay ESD recovery
- Validate payload length and link_index in dc_process_dmub_aux_transfer_async
- Add ADDR3 swizzle modes

Cc Dan Wheeler <[email protected]>

Alex Hung (6):
drm/amd/display: Add KUnit test for HDCP process_output drm/amd/display: Add KUnit test for colorop TF bitmasks drm/amd/display: Add KUnit test for color helpers drm/amd/display: Add KUnit test for PSR function drm/amd/display: Add KUnit test for replay drm/amd/display: Add KUnit test for ISM functions

Aric Cyr (2):
drm/amd/display: Fix assertion due to disable/enable CM blocks drm/amd/display: Enable additional wait for pipe pending checks

Aurabindo Pillai (1):
drm/amd/display: Add KUnit test for CRC function

Charlene Liu (1):
drm/amd/display: Allow power up when PG disallowed in driver

Cruise Hung (1):
drm/amd/display: Exclude the MST overhead from BW deallocation

Dmytro Laktyushkin (1):
drm/amd/display: Enable dcn42 pstate pmo

Harry Wentland (3):
drm/amd/display: Fix integer overflow in bios_get_image() drm/amd/display: Validate GPIO pin LUT table size before iterating drm/amd/display: Validate payload length and link_index in
dc_process_dmub_aux_transfer_async

James Lin (2):
drm/amd/display: Add some missing code for dcn42
Revert "drm/amd/display: dmub_cmd.h: add missing kernel-doc for enums"

Leon Huang (2):
drm/amd/display: Fix clear PSR config flow drm/amd/display: Add Auxless-ALPM support in VESA Panel Replay

Lohita Mudimela (2):
drm/amd/display: Refactor PSR functionality into dedicated power_psr
module
drm/amd/display: Refactor Replay functionality into dedicated
power_replay module

Nicholas Kazlauskas (1):
drm/amd/display: Enable DCN42 PMO policy

Ray Wu (2):
drm/amd/display: Fix ISM dc_lock deadlock during suspend drm/amd/display: Use lockdep_assert_held() for dc_lock check

Sung-huai Wang (1):
drm/amd/display: Fix eDP receiver ready status check in T7 sequence

Taimur Hassan (1):
drm/amd/display: Promote DC to 3.2.383

Wei-Guang Li (1):
drm/amd/display: Add debug option for replay ESD recovery

Wenxian Wang (1):
drm/amd/display: Add ADDR3 swizzle modes

 drivers/gpu/drm/amd/display/Kconfig           |   12 +
 .../gpu/drm/amd/display/amdgpu_dm/Makefile    |    5 +
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |   25 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |    2 -
 .../amd/display/amdgpu_dm/amdgpu_dm_color.c   |   65 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_color.h   |   89 ++
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c |   17 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_crc.h |    7 +
 .../amd/display/amdgpu_dm/amdgpu_dm_hdcp.c    |    5 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_hdcp.h    |   13 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c |   80 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.h |   11 +
 .../amdgpu_dm/amdgpu_dm_kunit_helpers.h       |   19 +
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c |    6 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_psr.h |    5 +
 .../amd/display/amdgpu_dm/amdgpu_dm_replay.c  |    3 +
 .../amd/display/amdgpu_dm/tests/.kunitconfig  |   14 +
 .../drm/amd/display/amdgpu_dm/tests/Makefile  |   18 +
 .../amdgpu_dm/tests/amdgpu_dm_color_test.c    | 1071 +++++++++++++
 .../amdgpu_dm/tests/amdgpu_dm_colorop_test.c  |  161 ++
 .../amdgpu_dm/tests/amdgpu_dm_crc_test.c      |  121 ++
 .../amdgpu_dm/tests/amdgpu_dm_hdcp_test.c     |  175 +++
 .../amdgpu_dm/tests/amdgpu_dm_ism_test.c      |  636 ++++++++
 .../amdgpu_dm/tests/amdgpu_dm_psr_test.c      |  255 ++++
 .../amdgpu_dm/tests/amdgpu_dm_replay_test.c   |  206 +++
 .../drm/amd/display/dc/bios/bios_parser2.c    |    9 +
 .../amd/display/dc/bios/bios_parser_helper.c  |    9 +-
 .../display/dc/clk_mgr/dcn42/dcn42_clk_mgr.c  |    2 +
 drivers/gpu/drm/amd/display/dc/core/dc.c      |    6 +-
 drivers/gpu/drm/amd/display/dc/dc.h           |    3 +-
 drivers/gpu/drm/amd/display/dc/dc_hw_types.h  |    4 +-
 .../dml2_0/dml21/dml21_translation_helper.c   |    5 +-
 .../dc/dml2_0/dml21/inc/dml_top_types.h       |    1 +
 .../dml21/src/dml2_pmo/dml2_pmo_dcn42.c       |  144 +-
 .../dml21/src/dml2_pmo/dml2_pmo_dcn42.h       |    1 +
 .../dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c  |    4 -
 .../dml21/src/dml2_pmo/dml2_pmo_factory.c     |   16 +
 .../dml21/src/dml2_top/dml2_top_soc15.c       |   30 +-
 .../drm/amd/display/dc/dml2_0/dml2_wrapper.h  |    1 +
 .../drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c  |    3 +
 .../amd/display/dc/dpp/dcn30/dcn30_dpp_cm.c   |    1 +
 .../display/dc/dpp/dcn401/dcn401_dpp_dscl.c   |    1 +
 .../display/dc/hubbub/dcn401/dcn401_hubbub.c  |    2 +
 .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c   |    8 +-
 .../amd/display/dc/hwss/dcn10/dcn10_init.c    |    2 +
 .../amd/display/dc/hwss/dcn20/dcn20_init.c    |    2 +
 .../amd/display/dc/hwss/dcn30/dcn30_init.c    |    2 +
 .../amd/display/dc/hwss/dcn301/dcn301_init.c  |    2 +
 .../amd/display/dc/hwss/dcn31/dcn31_init.c    |    2 +
 .../amd/display/dc/hwss/dcn314/dcn314_init.c  |    2 +
 .../amd/display/dc/hwss/dcn32/dcn32_init.c    |    2 +
 .../amd/display/dc/hwss/dcn401/dcn401_init.c  |    2 +
 .../amd/display/dc/hwss/dcn42/dcn42_hwseq.c   |    5 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/optc.h  |    1 -
 .../gpu/drm/amd/display/dc/link/link_dpms.c   |   41 +-
 .../dc/link/protocols/link_dp_irq_handler.c   |   14 +-
 .../dc/link/protocols/link_dp_panel_replay.c  |   13 +
 .../link/protocols/link_edp_panel_control.c   |   26 +-
 .../amd/display/dc/optc/dcn35/dcn35_optc.c    |    1 -
 .../amd/display/dc/optc/dcn42/dcn42_optc.c    |    2 -
 .../amd/display/dc/pg/dcn42/dcn42_pg_cntl.c   |   43 +-
 .../dc/resource/dcn42/dcn42_resource.c        |   12 +-
 .../dc/resource/dcn42/dcn42_resource.h        |    7 +
 .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h   |  156 +-
 .../drm/amd/display/modules/inc/mod_power.h   |   23 -
 .../drm/amd/display/modules/power/Makefile    |    4 +-
 .../gpu/drm/amd/display/modules/power/power.c | 1343 +----------------
 .../drm/amd/display/modules/power/power_abm.c |   98 --
 .../amd/display/modules/power/power_helpers.c |  250 ---  .../amd/display/modules/power/power_helpers.h |  121 ++  .../drm/amd/display/modules/power/power_psr.c |  665 ++++++++  .../amd/display/modules/power/power_replay.c  |  911 +++++++++++
 72 files changed, 5060 insertions(+), 1963 deletions(-)  create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.h
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_kunit_helpers.h
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/.kunitconfig
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/Makefile
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_color_test.c
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_colorop_test.c
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crc_test.c
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_hdcp_test.c
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_ism_test.c
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_psr_test.c
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_replay_test.c
 create mode 100644 drivers/gpu/drm/amd/display/modules/power/power_psr.c
 create mode 100644 drivers/gpu/drm/amd/display/modules/power/power_replay.c

--
2.43.0