Skip to contentSkip to conversation

DC Patches June 1 2026

PATCH In review Ray Wu 2 participants 42 messages May 26 – Jun 1

Subsystems (5)
lore
Share & tools
lore

Ray Wu

author
#0 lore raw

cover DC Patches June 1 2026

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

- Enable DCN 4.2.1:
* Add register header files for DCN42B
* Add DCN42B DC resource files
* Add DCN42B DMUB support
* Add DCN42B code to DC and dcn42b_soc_bb to DML2
* Add DCN42 PMO init_for_pstate_support
* Enable DCN42 PMO policy and pstate pmo
* Enable DCN 4.2.1 in amdgpu_dm
* Enable DM for DCN 4.2.1
- Add no_native_i2c codepath
- Add amdgpu_dm KUnit tests for:
* amdgpu_dm_psr_set_event
* dm_ism_dispatch_next_event and additional ISM functions
* amdgpu_dm_colorop
* color LUT functions and transfer function helpers
- Enable gcov coverage for amdgpu_dm KUnit builds
- Extract dm_ism_dispatch_next_event and transfer function helpers
- Refactor amdgpu_dm_initialize_default_pipeline
- Clean up PSR helper functions
- Fix gamma 2.2 colorop TF direction in tests
- Handle aux_inst for connectors without DDC pin
- Fix DP_PIXEL_FORMAT fields & update clk_src for DCN4x
- Avoid DPMS-on for phantom stream
- Change default driver setting for "Force ODM2:1 for eDP" policy
- Add DC_VALIDATE_MODE_AND_PROGRAMMING condition check for force odm2:1
- Check for sharpening case when calculating max vtaps for scaler
- Add DRAM table fields to clk_mgr_internal
- Enable frame skipping in 0x37B
- Bound VBIOS record-chain walk loops
- Clamp HDMI HDCP2 rx_id_list read to buffer size
- Clamp VBIOS HDMI retimer register count to array size
- Reject gpio_bitshift >= 32 in bios_parser_get_gpio_pin_info()
- Use krealloc_array() in dal_vector_reserve()
- Fix NULL deref and buffer over-read in SDP debugfs
- Fix out-of-bounds read in dp_get_eq_aux_rd_interval()
- FW Release 0.1.61.0

Cc Daniel Wheeler <[email protected]>

Alex Hung (12):
drm/amd/display: Enable gcov coverage for amdgpu_dm KUnit builds drm/amd/display: Add KUnit tests for color LUT functions drm/amd/display: Extract transfer function helpers drm/amd/display: Add more color KUnit tests drm/amd/display: Refactor amdgpu_dm_initialize_default_pipeline drm/amd/display: Fix gamma 2.2 colorop TF direction in tests drm/amd/display: Add KUnit tests for amdgpu_dm_colorop drm/amd/display: Add more KUnit tests for amdgpu_dm_ism drm/amd/display: Extract dm_ism_dispatch_next_event drm/amd/display: Add KUnit tests for dm_ism_dispatch_next_event drm/amd/display: Add KUnit tests for amdgpu_dm_psr_set_event drm/amd/display: Clean up PSR helper functions

Charlene Liu (1):
drm/amd/display: Add DC_VALIDATE_MODE_AND_PROGRAMMING condition check
for force odm2:1

Chuntao Tso (1):
drm/amd/display: Enable frame skipping in 0x37B

Dmytro Laktyushkin (2):
drm/amd/display: Enable dcn42 pstate pmo drm/amd/display: Add DCN42 PMO init_for_pstate_support

Gabe Teeger (1):
drm/amd/display: Handle aux_inst for connectors without DDC pin

Harry Wentland (7):
drm/amd/display: Fix out-of-bounds read in dp_get_eq_aux_rd_interval() drm/amd/display: Clamp VBIOS HDMI retimer register count to array size drm/amd/display: Fix NULL deref and buffer over-read in SDP debugfs drm/amd/display: Use krealloc_array() in dal_vector_reserve() drm/amd/display: Reject gpio_bitshift >= 32 in
bios_parser_get_gpio_pin_info()
drm/amd/display: Clamp HDMI HDCP2 rx_id_list read to buffer size drm/amd/display: Bound VBIOS record-chain walk loops

Ilya Bakoulin (1):
drm/amd/display: Avoid DPMS-on for phantom stream

Matthew Stewart (8):
drm/amd/display: Add no_native_i2c codepath
drm/amd: Add register header files for DCN42B
drm/amd/display: Add DCN42B DC resource files
drm/amd/display: Add dcn42b_soc_bb to DML2
drm/amd/display: Add DCN42B code to DC
drm/amd/display: Add DCN42B DMUB support
drm/amd/display: Enable DCN 4.2.1 in amdgpu_dm
drm/amd/display: Enable DM for DCN 4.2.1

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

Ovidiu Bunea (3):
drm/amd/display: Update get_pixel_clk_frequency() for DCN4x DCCG DP
DTO
drm/amd/display: Change default driver setting for "Force ODM2:1 for
eDP" policy
drm/amd/display: Fix DP_PIXEL_FORMAT fields & update clk_src for DCN4x

Samson Tam (1):
drm/amd/display: Check for sharpening case when calculating max vtaps
for scaler

Taimur Hassan (2):
ddrm/amd/display: [FW Promotion] Release 0.1.61.0 drm/amd/display: Promote DC to 3.2.384

Wenjing Liu (1):
drm/amd/display: Add DRAM table fields to clk_mgr_internal

 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c |     1 +
 drivers/gpu/drm/amd/display/Kconfig           |     2 +-
 .../gpu/drm/amd/display/amdgpu_dm/Makefile    |     3 +
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |    29 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_color.c   |    69 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_color.h   |    29 +
 .../amd/display/amdgpu_dm/amdgpu_dm_colorop.c |    22 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_colorop.h |     5 +
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c |     5 +
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c |    83 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.h |     7 +
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c |    20 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_psr.h |     4 +-
 .../amd/display/amdgpu_dm/tests/.kunitconfig  |     8 +
 .../amdgpu_dm/tests/amdgpu_dm_color_test.c    |   568 +
 .../amdgpu_dm/tests/amdgpu_dm_colorop_test.c  |   102 +-
 .../amdgpu_dm/tests/amdgpu_dm_ism_test.c      |   302 +
 .../amdgpu_dm/tests/amdgpu_dm_psr_test.c      |    46 +-
 .../gpu/drm/amd/display/dc/basics/vector.c    |     4 +-
 .../gpu/drm/amd/display/dc/bios/bios_parser.c |    15 +-
 .../drm/amd/display/dc/bios/bios_parser2.c    |   148 +-
 .../amd/display/dc/bios/bios_parser_helper.h  |     5 +
 .../display/dc/bios/command_table_helper2.c   |     1 +
 .../gpu/drm/amd/display/dc/clk_mgr/Makefile   |    10 +
 .../gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c  |    15 +
 .../dc/clk_mgr/dcn42b/dcn42b_clk_mgr.c        |   483 +
 .../dc/clk_mgr/dcn42b/dcn42b_clk_mgr.h        |    48 +
 drivers/gpu/drm/amd/display/dc/core/dc.c      |     4 +-
 .../gpu/drm/amd/display/dc/core/dc_resource.c |     6 +
 drivers/gpu/drm/amd/display/dc/dc.h           |    10 +-
 .../gpu/drm/amd/display/dc/dc_bios_types.h    |     4 +
 drivers/gpu/drm/amd/display/dc/dc_dp_types.h  |     7 +-
 drivers/gpu/drm/amd/display/dc/dc_fused_io.c  |     4 +-
 drivers/gpu/drm/amd/display/dc/dc_helper.c    |     2 +
 .../gpu/drm/amd/display/dc/dc_spl_translate.c |     1 +
 drivers/gpu/drm/amd/display/dc/dce/dce_aux.c  |   181 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_aux.h  |     4 +
 .../drm/amd/display/dc/dce/dce_clock_source.c |    83 +-
 .../drm/amd/display/dc/dce/dce_clock_source.h |    26 +-
 .../gpu/drm/amd/display/dc/dcn31/dcn31_apg.h  |    13 +
 .../dc/dio/dcn42/dcn42_dio_link_encoder.h     |    95 +
 .../dc/dio/dcn42/dcn42_dio_stream_encoder.c   |    64 +-
 .../dc/dio/dcn42/dcn42_dio_stream_encoder.h   |     6 +
 .../dml2_0/dml21/dml21_translation_helper.c   |     5 +-
 .../dml21/inc/bounding_boxes/dcn42b_soc_bb.h  |   227 +
 .../dc/dml2_0/dml21/inc/dml_top_types.h       |     1 +
 .../dml21/src/dml2_pmo/dml2_pmo_dcn42.c       |   223 +-
 .../dml21/src/dml2_pmo/dml2_pmo_dcn42.h       |     2 +
 .../dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c  |    30 +-
 .../dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.h  |    46 +-
 .../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 +
 .../amd/display/dc/dpp/dcn401/dcn401_dpp.c    |     8 +-
 drivers/gpu/drm/amd/display/dc/gpio/Makefile  |     8 +
 .../dc/gpio/dcn42b/hw_factory_dcn42b.c        |   313 +
 .../dc/gpio/dcn42b/hw_factory_dcn42b.h        |    11 +
 .../dc/gpio/dcn42b/hw_translate_dcn42b.c      |   192 +
 .../dc/gpio/dcn42b/hw_translate_dcn42b.h      |    13 +
 .../gpu/drm/amd/display/dc/gpio/hw_factory.c  |     4 +
 .../drm/amd/display/dc/gpio/hw_translate.c    |     4 +
 .../hpo/dcn31/dcn31_hpo_dp_stream_encoder.h   |    47 +
 .../display/dc/hubbub/dcn35/dcn35_hubbub.h    |   198 +
 .../amd/display/dc/hubp/dcn42/dcn42_hubp.h    |    19 +
 drivers/gpu/drm/amd/display/dc/hwss/Makefile  |     8 +
 .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c   |     4 +-
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c |    27 +
 .../amd/display/dc/hwss/dcn42b/dcn42b_hwseq.c |   238 +
 .../amd/display/dc/hwss/dcn42b/dcn42b_hwseq.h |    15 +
 .../amd/display/dc/hwss/dcn42b/dcn42b_init.c  |    20 +
 .../amd/display/dc/hwss/dcn42b/dcn42b_init.h  |    14 +
 .../gpu/drm/amd/display/dc/inc/clock_source.h |     4 +-
 .../gpu/drm/amd/display/dc/inc/hw/clk_mgr.h   |    21 +
 .../amd/display/dc/inc/hw/clk_mgr_internal.h  |    44 +-
 drivers/gpu/drm/amd/display/dc/inc/resource.h |     2 +
 .../display/dc/link/accessories/link_dp_cts.c |     2 +
 .../drm/amd/display/dc/link/link_factory.c    |    86 +-
 .../amd/display/dc/link/protocols/link_ddc.c  |    60 +-
 .../dc/link/protocols/link_dp_capability.c    |     6 +
 .../link/protocols/link_edp_panel_control.c   |     7 +-
 .../amd/display/dc/optc/dcn42/dcn42_optc.h    |   179 +
 .../amd/display/dc/pg/dcn42/dcn42_pg_cntl.h   |    86 +
 .../gpu/drm/amd/display/dc/resource/Makefile  |     7 +
 .../dc/resource/dcn401/dcn401_resource.c      |     4 +-
 .../dc/resource/dcn42/dcn42_resource.c        |    17 +-
 .../dc/resource/dcn42/dcn42_resource.h        |     3 +-
 .../dc/resource/dcn42b/dcn42b_resource.c      |  2404 +
 .../dc/resource/dcn42b/dcn42b_resource.h      |   672 +
 .../dcn42/dcn42_soc_and_ip_translator.c       |     6 +-
 .../soc_and_ip_translator.c                   |     1 +
 drivers/gpu/drm/amd/display/dmub/dmub_srv.h   |     1 +
 .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h   |   606 +-
 drivers/gpu/drm/amd/display/dmub/src/Makefile |     1 +
 .../drm/amd/display/dmub/src/dmub_dcn42b.c    |    34 +
 .../drm/amd/display/dmub/src/dmub_dcn42b.h    |    13 +
 .../gpu/drm/amd/display/dmub/src/dmub_srv.c   |     4 +
 .../amd/display/include/bios_parser_types.h   |     1 +
 .../gpu/drm/amd/display/include/dal_asic_id.h |     3 +
 .../gpu/drm/amd/display/include/dal_types.h   |     1 +
 .../drm/amd/display/modules/hdcp/hdcp_ddc.c   |     3 +-
 .../gpu/drm/amd/display/modules/power/power.c |     9 +-
 .../drm/amd/display/modules/power/power_abm.c |    16 +-
 .../include/asic_reg/clk/clk_15_0_5_offset.h  |    41 +
 .../include/asic_reg/clk/clk_15_0_5_sh_mask.h |    44 +
 .../include/asic_reg/dcn/dcn_4_2_1_offset.h   | 16304 +++++
 .../include/asic_reg/dcn/dcn_4_2_1_sh_mask.h  | 60622 ++++++++++++++++
 .../include/asic_reg/dpcs/dpcs_4_0_1_offset.h |   108 +
 .../asic_reg/dpcs/dpcs_4_0_1_sh_mask.h        |   412 +
 108 files changed, 85760 insertions(+), 342 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn42b/dcn42b_clk_mgr.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn42b/dcn42b_clk_mgr.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/dml2_0/dml21/inc/bounding_boxes/dcn42b_soc_bb.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/gpio/dcn42b/hw_factory_dcn42b.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/gpio/dcn42b/hw_factory_dcn42b.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/gpio/dcn42b/hw_translate_dcn42b.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/gpio/dcn42b/hw_translate_dcn42b.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/hwss/dcn42b/dcn42b_hwseq.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/hwss/dcn42b/dcn42b_hwseq.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/hwss/dcn42b/dcn42b_init.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/hwss/dcn42b/dcn42b_init.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.h
 create mode 100644 drivers/gpu/drm/amd/display/dmub/src/dmub_dcn42b.c
 create mode 100644 drivers/gpu/drm/amd/display/dmub/src/dmub_dcn42b.h
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/clk/clk_15_0_5_offset.h
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/clk/clk_15_0_5_sh_mask.h
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_4_2_1_offset.h
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_4_2_1_sh_mask.h
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/dpcs/dpcs_4_0_1_offset.h
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/dpcs/dpcs_4_0_1_sh_mask.h
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 1/41 drm/amd/display: Update get_pixel_clk_frequency() for DCN4x DCCG DP DTO

From: Ovidiu Bunea <[email protected]>

[Why & How]
DCN4x ASICs have different DCCG logic for programming DP DTO. The current get_pixel_clk_frequency_100hz() function does not account for this.

Rename the function to "get_dp_dto_frequency" to more accurately reflect its intended behaviour. Create a new function that correctly calculates the target pixel rate for DCN4.x DCCG design and use it.

---
 drivers/gpu/drm/amd/display/dc/core/dc.c      |  4 +-
 .../drm/amd/display/dc/dce/dce_clock_source.c | 85 ++++++++++++++++---
 .../drm/amd/display/dc/dce/dce_clock_source.h |  7 +-
 .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c   |  4 +-
 .../gpu/drm/amd/display/dc/inc/clock_source.h |  4 +-
 5 files changed, 83 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -2
index 0f37209c8330..62e48d2ba513 100644
@@ -1487,7 +1487,7 @@ static void disable_vbios_mode_if_required(
 					}
 				}
 
-				dc->res_pool->dp_clock_source->funcs->get_pixel_clk_frequency_100hz(
+				dc->res_pool->dp_clock_source->funcs->get_dp_dto_frequency_100hz(
 					dc->res_pool->dp_clock_source,
 					tg_inst, &pix_clk_100hz);
 
@@ -2004,7 +2004,7 @@ bool dc_validate_boot_timing(const struct dc *dc,
 		uint32_t numOdmPipes = 1;
 		uint32_t id_src[4] = {0};
 
-		dc->res_pool->dp_clock_source->funcs->get_pixel_clk_frequency_100hz(
+		dc->res_pool->dp_clock_source->funcs->get_dp_dto_frequency_100hz(
 			dc->res_pool->dp_clock_source,
 			tg_inst, &pix_clk_100hz);
 
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c +71 -14

150 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.h +6 -1
index 94128f7a18b1..9441aa6a897f 100644
@@ -202,7 +202,11 @@
 	type PLL_REF_DIV; \
 	type DP_DTO0_PHASE; \
 	type DP_DTO0_MODULO; \
-	type DP_DTO0_ENABLE;
+	type DP_DTO0_ENABLE; \
+	type DPDTO0_INT; \
+	type DPDTO1_INT; \
+	type DPDTO2_INT; \
+	type DPDTO3_INT;
 
 #define CS_REG_FIELD_LIST_DCN32(type) \
 	type PIPE0_DTO_SRC_SEL;
@@ -221,6 +225,7 @@ struct dce110_clk_src_regs {
 	uint32_t RESYNC_CNTL;
 	uint32_t PIXCLK_RESYNC_CNTL;
 	uint32_t PLL_CNTL;
+	uint32_t OTG_PIXEL_RATE_DIV;
 
 	/* below are for DTO.
 	 * todo: should probably use different struct to not waste space
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +2 -2
index a1c3c4454397..7ddc68cc7184 100644
@@ -2423,7 +2423,7 @@ static int dcn10_align_pixel_clocks(struct dc *dc, int group_size,
 			grouped_pipes[i]->stream_res.tg->funcs->get_hw_timing(
 					grouped_pipes[i]->stream_res.tg,
 					&hw_crtc_timing[i]);
-			dc->res_pool->dp_clock_source->funcs->get_pixel_clk_frequency_100hz(
+			dc->res_pool->dp_clock_source->funcs->get_dp_dto_frequency_100hz(
 				dc->res_pool->dp_clock_source,
 				grouped_pipes[i]->stream_res.tg->inst,
 				&pclk);
@@ -2462,7 +2462,7 @@ static int dcn10_align_pixel_clocks(struct dc *dc, int group_size,
 					dc->res_pool->dp_clock_source,
 					grouped_pipes[i]->stream_res.tg->inst,
 					(unsigned int)phase[i], (unsigned int)modulo[i]);
-				dc->res_pool->dp_clock_source->funcs->get_pixel_clk_frequency_100hz(
+				dc->res_pool->dp_clock_source->funcs->get_dp_dto_frequency_100hz(
 					dc->res_pool->dp_clock_source,
 					grouped_pipes[i]->stream_res.tg->inst, &pclk);
 				grouped_pipes[i]->stream->timing.pix_clk_100hz =
drivers/gpu/drm/amd/display/dc/inc/clock_source.h +2 -2
index ed2f8005d85e..6bbbb8ea7dad 100644
@@ -170,10 +170,10 @@ struct clock_source_funcs {
 			struct clock_source *,
 			struct pixel_clk_params *,
 			struct pll_settings *);
-	bool (*get_pixel_clk_frequency_100hz)(
+	bool (*get_dp_dto_frequency_100hz)(
 			const struct clock_source *clock_source,
 			unsigned int inst,
-			unsigned int *pixel_clk_khz);
+			unsigned int *pixel_clk_100hz);
 	bool (*override_dp_pix_clk)(
 			struct clock_source *clock_source,
 			unsigned int inst,
Signature · 1 line
2.43.0
author
#2 lore raw

PATCH 2/41 drm/amd/display: Enable DCN42 PMO policy

In reply to Ray Wu

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
author
#3 lore raw

PATCH 3/41 drm/amd/display: Enable dcn42 pstate pmo

In reply to Ray Wu

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
author
#4 lore raw

PATCH 4/41 drm/amd/display: Enable frame skipping in 0x37B

In reply to Ray Wu

From: Chuntao Tso <[email protected]>

[Why & How]
Enable frame skipping in 0x37B

---
 drivers/gpu/drm/amd/display/dc/dc_dp_types.h                 | 5 ++++-
 .../amd/display/dc/link/protocols/link_edp_panel_control.c   | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc_dp_types.h +4 -1
index 7fa336bf1115..7e5c118b2f20 100644
@@ -1363,7 +1363,10 @@ union replay_enable_and_configuration {
 		unsigned char FREESYNC_PANEL_REPLAY_MODE              :1;
 		unsigned char TIMING_DESYNC_ERROR_VERIFICATION        :1;
 		unsigned char STATE_TRANSITION_ERROR_DETECTION        :1;
-		unsigned char RESERVED                                :5;
+		unsigned char FSFT_ENABLED                            :1;
+		unsigned char FRAME_SKIPPING_ERROR_DETECTION          :1;
+		unsigned char FRAME_SKIPPING_ENABLE                   :1;
+		unsigned char RESERVED                                :2;
 	} bits;
 	unsigned char raw;
 };
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +2 -0
index e06a9ac65286..3db4f10d1654 100644
@@ -1052,6 +1052,8 @@ bool edp_setup_freesync_replay(struct dc_link *link, const struct dc_stream_stat
 		replay_config.bits.FREESYNC_PANEL_REPLAY_MODE = 1;
 		replay_config.bits.TIMING_DESYNC_ERROR_VERIFICATION = 0;
 		replay_config.bits.STATE_TRANSITION_ERROR_DETECTION = 1;
+		replay_config.bits.FRAME_SKIPPING_ERROR_DETECTION = 1;
+		replay_config.bits.FRAME_SKIPPING_ENABLE = 1;
 		dm_helpers_dp_write_dpcd(link->ctx, link,
 			DP_SINK_PR_ENABLE_AND_CONFIGURATION,
 			(uint8_t *)&(replay_config.raw), sizeof(uint8_t));
Signature · 1 line
2.43.0
author
#5 lore raw

PATCH 5/41 drm/amd/display: Enable gcov coverage for amdgpu_dm KUnit builds

In reply to Ray Wu

From: Alex Hung <[email protected]>

[Why & How]
Add GCOV_PROFILE := y to amdgpu_dm/Makefile under the CONFIG_DRM_AMD_DC_KUNIT_TEST guard so coverage instrumentation is only applied during KUnit builds, not all amdgpu_dm builds.

Add coverage config options (CONFIG_GCOV, CONFIG_DEBUG_INFO, CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT, CONFIG_DEBUG_KERNEL) to tests/.kunitconfig so the kunit.py runner enables the kernel coverage configuration automatically.

Assisted-by Copilot:Claude-Sonnet-4.6
---
 drivers/gpu/drm/amd/display/amdgpu_dm/Makefile           | 3 +++
 drivers/gpu/drm/amd/display/amdgpu_dm/tests/.kunitconfig | 6 ++++++
 2 files changed, 9 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/Makefile +3 -0
index 914f89af047c..54a93e4255b3 100644
@@ -63,4 +63,7 @@ endif
 # KUnit tests as separate module
 ifneq ($(CONFIG_DRM_AMD_DC_KUNIT_TEST),)
 obj-y += $(AMDDALPATH)/amdgpu_dm/tests/
+
+# Enable gcov for amdgpu_dm KUnit builds
+GCOV_PROFILE := y
 endif
drivers/gpu/drm/amd/display/amdgpu_dm/tests/.kunitconfig +6 -0
index 36676326ade4..a0949d3c4e6f 100644
@@ -12,3 +12,9 @@ CONFIG_HWMON=y
 CONFIG_I2C=y
 CONFIG_POWER_SUPPLY=y
 CONFIG_CRC16=y
+
+# GCOV Coverage - see tools/testing/kunit/configs/coverage_uml.config
+CONFIG_DEBUG_KERNEL=y
+CONFIG_DEBUG_INFO=y
+CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
+CONFIG_GCOV=y
Signature · 1 line
2.43.0
author
#6 lore raw

PATCH 6/41 drm/amd/display: Add DCN42 PMO init_for_pstate_support

In reply to Ray Wu

From: Dmytro Laktyushkin <[email protected]>

[Why & How]
Add pmo_dcn42_init_for_pstate_support mirroring the DCN4 FAMS2 version, but dropping the meta build for scheduling check that is unnecessary and skipping the cofunctionality check.

This solves vrr validation issues in multidisplay configs.

---
 .../dml21/src/dml2_pmo/dml2_pmo_dcn42.c       | 107 +++++++++++++++---
 .../dml21/src/dml2_pmo/dml2_pmo_dcn42.h       |   1 +
 .../dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c  |  34 +++---
 .../dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.h  |  46 ++++++--
 .../dml21/src/dml2_pmo/dml2_pmo_factory.c     |   2 +-
 5 files changed, 152 insertions(+), 38 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn42.c +93 -14
index 4e0d757388ca..790aef95caa6 100644
@@ -63,25 +63,24 @@ static bool is_bit_set_in_bitfield(unsigned int bit_field, unsigned int bit_offs
 	return false;
 }
 
+static void dcn42_set_bit_in_bitfield(unsigned int *bit_field, unsigned int bit_offset)
+{
+	*bit_field = *bit_field | (0x1 << bit_offset);
+}
+
 static void setup_planes_for_vactive_by_mask(struct display_configuation_with_meta *display_config,
 	struct dml2_pmo_instance *pmo,
 	int plane_mask)
 {
 	unsigned int plane_index;
-	unsigned int stream_index;
 	struct dml2_plane_parameters *plane;
 
 	for (plane_index = 0; plane_index < display_config->display_config.num_planes; plane_index++) {
 		if (is_bit_set_in_bitfield(plane_mask, plane_index)) {
 			plane = &display_config->display_config.plane_descriptors[plane_index];
-			stream_index = display_config->display_config.plane_descriptors[plane_index].stream_index;
 
 			plane->overrides.reserved_vblank_time_ns = (long)math_max2(pmo->soc_bb->power_management_parameters.dram_clk_change_blackout_us * 1000.0,
 					plane->overrides.reserved_vblank_time_ns);
-			if (!pmo->options->disable_vactive_det_fill_bw_pad) {
-				display_config->display_config.plane_descriptors[plane_index].overrides.max_vactive_det_fill_delay_us[dml2_pstate_type_uclk] =
-					(unsigned int)math_floor(pmo->scratch.pmo_dcn4.stream_pstate_meta[stream_index].method_vactive.max_vactive_det_fill_delay_us);
-			}
 
 			display_config->stage3.pstate_switch_modes[plane_index] = dml2_pstate_method_vactive;
 		}
@@ -118,7 +117,6 @@ static bool setup_display_config(struct display_configuation_with_meta *display_
 {
 	struct dml2_pmo_scratch *scratch = &pmo->scratch;
 
-	bool fams2_required = false;
 	bool success = true;
 	unsigned int stream_index;
 
@@ -134,15 +132,96 @@ static bool setup_display_config(struct display_configuation_with_meta *display_
 		}
 	}
 
-	/* copy FAMS2 meta */
-	if (success) {
-		display_config->stage3.fams2_required = fams2_required;
-		memcpy(&display_config->stage3.stream_pstate_meta,
-			&scratch->pmo_dcn4.stream_pstate_meta,
-			sizeof(struct dml2_pstate_meta) * DML2_MAX_PLANES);
+	return success;
+}
+
+bool pmo_dcn42_init_for_pstate_support(struct dml2_pmo_init_for_pstate_support_in_out *in_out)
+{
+	struct dml2_pmo_instance *pmo = in_out->instance;
+	struct dml2_optimization_stage3_state *state = &in_out->base_display_config->stage3;
+	struct dml2_pmo_scratch *s = &pmo->scratch;
+
+	struct display_configuation_with_meta *display_config;
+	const struct dml2_plane_parameters *plane_descriptor;
+	const struct dml2_pmo_pstate_strategy *strategy_list = NULL;
+	struct dml2_pmo_pstate_strategy override_base_strategy = { 0 };
+	unsigned int strategy_list_size = 0;
+	unsigned int plane_index, stream_index, i;
+	bool build_override_strategy = true;
+
+	state->performed = true;
+	in_out->base_display_config->stage3.min_clk_index_for_latency = in_out->base_display_config->stage1.min_clk_index_for_latency;
+
+	display_config = in_out->base_display_config;
+	display_config->display_config.overrides.enable_subvp_implicit_pmo = true;
+
+	memset(s, 0, sizeof(struct dml2_pmo_scratch));
+
+	if (display_config->display_config.num_streams == 0)
+		return false;
+
+	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;
+
+	// First build the stream plane mask (array of bitfields indexed by stream, indicating plane mapping)
+	for (plane_index = 0; plane_index < display_config->display_config.num_planes; plane_index++) {
+		plane_descriptor = &display_config->display_config.plane_descriptors[plane_index];
+
+		dcn42_set_bit_in_bitfield(&s->pmo_dcn4.stream_plane_mask[plane_descriptor->stream_index], plane_index);
+
+		state->pstate_switch_modes[plane_index] = dml2_pstate_method_vactive;
+
+		build_override_strategy &= plane_descriptor->overrides.uclk_pstate_change_strategy != dml2_uclk_pstate_change_strategy_auto;
+		override_base_strategy.per_stream_pstate_method[plane_descriptor->stream_index] =
+				dcn4_uclk_pstate_strategy_override_to_pstate_method(plane_descriptor->overrides.uclk_pstate_change_strategy);
 	}
 
-	return success;
+	// Figure out which streams can do vactive, and also build up implicit SVP and FAMS2 meta
+	for (stream_index = 0; stream_index < display_config->display_config.num_streams; stream_index++) {
+		if (dcn4_get_vactive_pstate_margin(display_config, s->pmo_dcn4.stream_plane_mask[stream_index]) >= (int)(MIN_VACTIVE_MARGIN_PCT * pmo->soc_bb->power_management_parameters.dram_clk_change_blackout_us))
+			dcn42_set_bit_in_bitfield(&s->pmo_dcn4.stream_vactive_capability_mask, stream_index);
+	}
+
+	if (build_override_strategy) {
+		/* build expanded override strategy list (no permutations) */
+		override_base_strategy.allow_state_increase = true;
+		s->pmo_dcn4.num_expanded_override_strategies = 0;
+		dcn4_insert_strategy_into_expanded_list(&override_base_strategy,
+				display_config->display_config.num_streams,
+				s->pmo_dcn4.expanded_override_strategy_list,
+				&s->pmo_dcn4.num_expanded_override_strategies);
+		dcn4_expand_variant_strategy(&override_base_strategy,
+				display_config->display_config.num_streams,
+				false,
+				s->pmo_dcn4.expanded_override_strategy_list,
+				&s->pmo_dcn4.num_expanded_override_strategies);
+
+		/* use override strategy list */
+		strategy_list = s->pmo_dcn4.expanded_override_strategy_list;
+		strategy_list_size = s->pmo_dcn4.num_expanded_override_strategies;
+	} else {
+		/* use predefined strategy list */
+		strategy_list = dcn4_get_expanded_strategy_list(&pmo->init_data, display_config->display_config.num_streams);
+		strategy_list_size = dcn4_get_num_expanded_strategies(&pmo->init_data, display_config->display_config.num_streams);
+	}
+
+	if (!strategy_list || strategy_list_size == 0)
+		return false;
+
+	s->pmo_dcn4.num_pstate_candidates = 0;
+
+	for (i = 0; i < strategy_list_size && s->pmo_dcn4.num_pstate_candidates < DML2_PMO_PSTATE_CANDIDATE_LIST_SIZE; i++) {
+		dcn4_insert_into_candidate_list(&strategy_list[i], display_config->display_config.num_streams, s);
+	}
+
+	if (s->pmo_dcn4.num_pstate_candidates > 0) {
+		s->pmo_dcn4.pstate_strategy_candidates[s->pmo_dcn4.num_pstate_candidates-1].allow_state_increase = true;
+		s->pmo_dcn4.cur_pstate_candidate = -1;
+		return true;
+	} else {
+		return false;
+	}
 }
 
 bool pmo_dcn42_fams2_optimize_for_pstate_support(struct dml2_pmo_optimize_for_pstate_support_in_out *in_out)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn42.h +1 -0
index 5db7877bb8ca..5b11c47874bb 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_init_for_pstate_support(struct dml2_pmo_init_for_pstate_support_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);
 
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c +19 -15
index 8301e23ab89f..d5f20c85006e 100644
@@ -391,7 +391,7 @@ static enum dml2_pstate_method convert_strategy_to_drr_variant(const enum dml2_p
 	return variant_strategy;
 }
 
-static struct dml2_pmo_pstate_strategy *get_expanded_strategy_list(struct dml2_pmo_init_data *init_data, int stream_count)
+struct dml2_pmo_pstate_strategy *dcn4_get_expanded_strategy_list(struct dml2_pmo_init_data *init_data, int stream_count)
 {
 	struct dml2_pmo_pstate_strategy *expanded_strategy_list = NULL;
 
@@ -415,14 +415,14 @@ static struct dml2_pmo_pstate_strategy *get_expanded_strategy_list(struct dml2_p
 	return expanded_strategy_list;
 }
 
-static unsigned int get_num_expanded_strategies(
+unsigned int dcn4_get_num_expanded_strategies(
 	struct dml2_pmo_init_data *init_data,
 	int stream_count)
 {
 	return init_data->pmo_dcn4.num_expanded_strategies_per_list[stream_count - 1];
 }
 
-static void insert_strategy_into_expanded_list(
+void dcn4_insert_strategy_into_expanded_list(
 	const struct dml2_pmo_pstate_strategy *per_stream_pstate_strategy,
 	const int stream_count,
 	struct dml2_pmo_pstate_strategy *expanded_strategy_list,
@@ -478,7 +478,7 @@ static void expand_base_strategy(
 
 			if (i >= stream_count - 1) {
 				/* insert into strategy list */
-				insert_strategy_into_expanded_list(&cur_strategy_list, stream_count, expanded_strategy_list, num_expanded_strategies);
+				dcn4_insert_strategy_into_expanded_list(&cur_strategy_list, stream_count, expanded_strategy_list, num_expanded_strategies);
 				expanded_strategy_added = true;
 			} else {
 				/* skip to next stream */
@@ -539,7 +539,7 @@ static bool is_variant_method_valid(const struct dml2_pmo_pstate_strategy *base_
 	return valid;
 }
 
-static void expand_variant_strategy(
+void dcn4_expand_variant_strategy(
 		const struct dml2_pmo_pstate_strategy *base_strategy,
 		const unsigned int stream_count,
 		const bool should_permute,
@@ -599,7 +599,7 @@ static void expand_variant_strategy(
 					expand_base_strategy(&variant_strategy, stream_count, expanded_strategy_list, num_expanded_strategies);
 				} else {
 					/* no permutations allowed, so add to list now */
-					insert_strategy_into_expanded_list(&variant_strategy, stream_count, expanded_strategy_list, num_expanded_strategies);
+					dcn4_insert_strategy_into_expanded_list(&variant_strategy, stream_count, expanded_strategy_list, num_expanded_strategies);
 				}
 			}
 
@@ -639,7 +639,7 @@ void pmo_dcn4_fams2_expand_base_pstate_strategies(
 	/* expand every explicit base strategy (except all DRR) */
 	for (i = 0; i < num_base_strategies; i++) {
 		expand_base_strategy(&base_strategies_list[i], stream_count, expanded_strategy_list, num_expanded_strategies);
-		expand_variant_strategy(&base_strategies_list[i], stream_count, true, expanded_strategy_list, num_expanded_strategies);
+		dcn4_expand_variant_strategy(&base_strategies_list[i], stream_count, true, expanded_strategy_list, num_expanded_strategies);
 	}
 }
 
@@ -1180,14 +1180,14 @@ static bool all_timings_support_svp(const struct dml2_pmo_instance *pmo,
 	return true;
 }
 
-static void insert_into_candidate_list(const struct dml2_pmo_pstate_strategy *pstate_strategy, int stream_count, struct dml2_pmo_scratch *scratch)
+void dcn4_insert_into_candidate_list(const struct dml2_pmo_pstate_strategy *pstate_strategy, int stream_count, struct dml2_pmo_scratch *scratch)
 {
 	(void)stream_count;
 	scratch->pmo_dcn4.pstate_strategy_candidates[scratch->pmo_dcn4.num_pstate_candidates] = *pstate_strategy;
 	scratch->pmo_dcn4.num_pstate_candidates++;
 }
 
-static enum dml2_pstate_method uclk_pstate_strategy_override_to_pstate_method(const enum dml2_uclk_pstate_change_strategy override_strategy)
+enum dml2_pstate_method dcn4_uclk_pstate_strategy_override_to_pstate_method(const enum dml2_uclk_pstate_change_strategy override_strategy)
 {
 	enum dml2_pstate_method method = dml2_pstate_method_na;
 
@@ -1884,6 +1884,10 @@ 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;
@@ -1898,7 +1902,7 @@ bool pmo_dcn4_fams2_init_for_pstate_support(struct dml2_pmo_init_for_pstate_supp
 
 		build_override_strategy &= plane_descriptor->overrides.uclk_pstate_change_strategy != dml2_uclk_pstate_change_strategy_auto;
 		override_base_strategy.per_stream_pstate_method[plane_descriptor->stream_index] =
-				uclk_pstate_strategy_override_to_pstate_method(plane_descriptor->overrides.uclk_pstate_change_strategy);
+				dcn4_uclk_pstate_strategy_override_to_pstate_method(plane_descriptor->overrides.uclk_pstate_change_strategy);
 	}
 
 	// Figure out which streams can do vactive, and also build up implicit SVP and FAMS2 meta
@@ -1920,11 +1924,11 @@ bool pmo_dcn4_fams2_init_for_pstate_support(struct dml2_pmo_init_for_pstate_supp
 		/* build expanded override strategy list (no permutations) */
 		override_base_strategy.allow_state_increase = true;
 		s->pmo_dcn4.num_expanded_override_strategies = 0;
-		insert_strategy_into_expanded_list(&override_base_strategy,
+		dcn4_insert_strategy_into_expanded_list(&override_base_strategy,
 				display_config->display_config.num_streams,
 				s->pmo_dcn4.expanded_override_strategy_list,
 				&s->pmo_dcn4.num_expanded_override_strategies);
-		expand_variant_strategy(&override_base_strategy,
+		dcn4_expand_variant_strategy(&override_base_strategy,
 				display_config->display_config.num_streams,
 				false,
 				s->pmo_dcn4.expanded_override_strategy_list,
@@ -1935,8 +1939,8 @@ bool pmo_dcn4_fams2_init_for_pstate_support(struct dml2_pmo_init_for_pstate_supp
 		strategy_list_size = s->pmo_dcn4.num_expanded_override_strategies;
 	} else {
 		/* use predefined strategy list */
-		strategy_list = get_expanded_strategy_list(&pmo->init_data, display_config->display_config.num_streams);
-		strategy_list_size = get_num_expanded_strategies(&pmo->init_data, display_config->display_config.num_streams);
+		strategy_list = dcn4_get_expanded_strategy_list(&pmo->init_data, display_config->display_config.num_streams);
+		strategy_list_size = dcn4_get_num_expanded_strategies(&pmo->init_data, display_config->display_config.num_streams);
 	}
 
 	if (!strategy_list || strategy_list_size == 0)
@@ -1946,7 +1950,7 @@ bool pmo_dcn4_fams2_init_for_pstate_support(struct dml2_pmo_init_for_pstate_supp
 
 	for (i = 0; i < strategy_list_size && s->pmo_dcn4.num_pstate_candidates < DML2_PMO_PSTATE_CANDIDATE_LIST_SIZE; i++) {
 		if (validate_pstate_support_strategy_cofunctionality(pmo, display_config, &strategy_list[i])) {
-			insert_into_candidate_list(&strategy_list[i], display_config->display_config.num_streams, s);
+			dcn4_insert_into_candidate_list(&strategy_list[i], display_config->display_config.num_streams, s);
 		}
 	}
 
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.h +38 -8

56 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_factory.c +1 -1
index a1164de13a05..21109a19f177 100644
@@ -67,7 +67,7 @@ bool dml2_pmo_create(enum dml2_project_id project_id, struct dml2_pmo_instance *
 		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->init_for_uclk_pstate = pmo_dcn42_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;
 
Signature · 1 line
2.43.0
author
#7 lore raw

PATCH 7/41 drm/amd/display: Add DRAM table fields to clk_mgr_internal

In reply to Ray Wu

From: Wenjing Liu <[email protected]>

[Why]
Add GPU-accessible DRAM buffer fields for bulk data transfer from PMFW during clock manager initialization.

[How]
Add dal_init_table and dal_init_table_addr fields to struct clk_mgr_internal for TABLE_DAL_INIT DRAM transfer.

---
 .../gpu/drm/amd/display/dc/inc/hw/clk_mgr_internal.h  | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr_internal.h +11 -0
index 450bce3d8e02..6ed1011457de 100644
@@ -477,6 +477,17 @@ struct clk_mgr_internal {
 	void *wm_range_table;
 	long long wm_range_table_addr;
 
+	/**
+	 * @dal_init_table:
+	 *
+	 * GPU-accessible DRAM buffer for the DAL init table transferred
+	 * from PMFW via DALSMC_MSG_TransferTableSmu2Dram(TABLE_DAL_INIT).
+	 * Contains all static PMFW data needed at init: DPM clock tables,
+	 * UTM QoS parameters, and memory configuration.
+	 */
+	const void *dal_init_table;
+	long long dal_init_table_addr;
+
 	bool dpm_present;
 	bool pme_trigger_pending;
 };
Signature · 1 line
2.43.0
author
#8 lore raw

PATCH 8/41 drm/amd/display: Check for sharpening case when calculating max vtaps for scaler

In reply to Ray Wu

From: Samson Tam <[email protected]>

[Why & How]
- calc_lb_num_partitions has check when scaler is not enabled to use larger LB in calculations for max vtaps based on viewport being 1:1
- however, scaler is forced on when sharpening is enabled, so need to consider this in check
- taps is predetermined in spl_get_optimal_number_of_taps prior to calc_lb_num_partitions. Add check for taps not 1 to handle sharpening case

---
 drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp.c +6 -2
index 2d6a646462e2..8e0fa7be34ee 100644
@@ -390,9 +390,11 @@ void dscl401_spl_calc_lb_num_partitions(
 		lb_memory_size_a = 1290;
 	} else if (lb_config == LB_MEMORY_CONFIG_3) {
 		if (scl_data->viewport.width  == scl_data->h_active &&
-			scl_data->viewport.height == scl_data->v_active) {
+			scl_data->viewport.height == scl_data->v_active &&
+			scl_data->taps.h_taps == 1 && scl_data->taps.v_taps == 1) {
 			/* 420 mode: luma using all 3 mem from Y, plus 3rd mem from Cr and Cb */
 			/* use increased LB size for calculation only if Scaler not enabled */
+			/* Scaler is forced on when sharpening is on. Add check for taps = 1 */
 			lb_memory_size = 970 + 1290 + 1170 + 1170 + 1170;
 			lb_memory_size_c = 970 + 1290;
 			lb_memory_size_a = 970 + 1290 + 1170;
@@ -404,8 +406,10 @@ void dscl401_spl_calc_lb_num_partitions(
 		}
 	} else {
 		if (scl_data->viewport.width  == scl_data->h_active &&
-			scl_data->viewport.height == scl_data->v_active) {
+			scl_data->viewport.height == scl_data->v_active &&
+			scl_data->taps.h_taps == 1 && scl_data->taps.v_taps == 1) {
 			/* use increased LB size for calculation only if Scaler not enabled */
+			/* Scaler is forced on when sharpening is on. Add check for taps = 1 */
 			lb_memory_size = 970 + 1290 + 1170;
 			lb_memory_size_c = 970 + 1290 + 1170;
 			lb_memory_size_a = 970 + 1290 + 1170;
Signature · 1 line
2.43.0
author
#9 lore raw

PATCH 9/41 drm/amd/display: Add DC_VALIDATE_MODE_AND_PROGRAMMING condition check for force odm2:1

In reply to Ray Wu

From: Charlene Liu <[email protected]>

[Why & How]
Need to limit force ODM 2:1 to DC_VALIDATE_MODE_AND_PROGRAMMING only, i.e. not block isCofunc check for topology mapping allowed.

---
 .../gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c  | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c +4 -2
index efe025ca4ed3..b9f998ea2d0f 100644
@@ -1725,8 +1725,10 @@ enum dc_status dcn42_validate_bandwidth(struct dc *dc,
 	bool out = false;
 
 	DC_FP_START();
-
-	dcn42_decide_odm_override(dc, context);
+	if (validate_mode == DC_VALIDATE_MODE_AND_PROGRAMMING) {
+		/*only do this when programing HW*/
+		dcn42_decide_odm_override(dc, context);
+	}
 
 	out = dml2_validate(dc, context, context->bw_ctx.dml2,
 						validate_mode);
Signature · 1 line
2.43.0
author
#10 lore raw

PATCH 10/41 drm/amd/display: Fix out-of-bounds read in dp_get_eq_aux_rd_interval()

In reply to Ray Wu

From: Harry Wentland <[email protected]>

[Why & How]
The aux_rd_interval array in struct dc_lttpr_caps is declared with MAX_REPEATER_CNT - 1 (7) elements, indexed 0..6. However, the offset parameter passed to dp_get_eq_aux_rd_interval() can be as large as MAX_REPEATER_CNT (8) when a sink reports 8 LTTPR repeaters via DPCD. This leads to an out-of-bounds read of aux_rd_interval[7] when offset is 8.

Fix this by growing aux_rd_interval to MAX_REPEATER_CNT elements to accommodate the full range of valid repeater counts defined by the DP spec.

Assisted-by GitHub Copilot:Claude claude-4-opus
---
 drivers/gpu/drm/amd/display/dc/dc_dp_types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc_dp_types.h +1 -1
index 7e5c118b2f20..fbef0dc743ff 100644
@@ -1217,7 +1217,7 @@ struct dc_lttpr_caps {
 	union dp_main_link_channel_coding_lttpr_cap main_link_channel_coding;
 	union dp_128b_132b_supported_lttpr_link_rates supported_128b_132b_rates;
 	union dp_alpm_lttpr_cap alpm;
-	uint8_t aux_rd_interval[MAX_REPEATER_CNT - 1];
+	uint8_t aux_rd_interval[MAX_REPEATER_CNT];
 	uint8_t lttpr_ieee_oui[3]; // Always read from closest LTTPR to host
 	uint8_t lttpr_device_id[6]; // Always read from closest LTTPR to host
 };
Signature · 1 line
2.43.0
author
#11 lore raw

PATCH 11/41 drm/amd/display: Change default driver setting for "Force ODM2:1 for eDP" policy

In reply to Ray Wu

From: Ovidiu Bunea <[email protected]>

[Why & How]
Change the driver setting: force single eDP ODM2:1 disable as default. Still allow user to enable it via debug option.

Revert to unblock testing.

---
 drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c +1 -1
index b9f998ea2d0f..0feb4872412f 100644
@@ -765,7 +765,7 @@ static const struct dc_debug_options debug_defaults_drv = {
 	.min_deep_sleep_dcfclk_khz = 8000,
 	.replay_skip_crtc_disabled = true,
 	.psr_skip_crtc_disable = true,
-	.force_odm2to1_for_edp_pixclk_mhz = 550, // Force ODM 2to1 for eDP when pixel clock is above 550MHz
+	.force_odm2to1_for_edp_pixclk_mhz = 0, // disable the policy for now
 };
 
 static const struct dc_check_config config_defaults = {
Signature · 1 line
2.43.0
author
#12 lore raw

PATCH 12/41 drm/amd/display: Clamp VBIOS HDMI retimer register count to array size

In reply to Ray Wu

From: Harry Wentland <[email protected]>

[Why & How]
The VBIOS integrated info tables (v1_11 and v2_1) contain HdmiRegNum and Hdmi6GRegNum fields that are used as loop bounds when copying retimer I2C register settings into fixed-size arrays (dp*_ext_hdmi_reg_settings[9] and dp*_ext_hdmi_6g_reg_settings[3]). These u8 fields are not validated before use, so a malformed VBIOS can specify values up to 255, causing an out-of-bounds heap write during driver probe.

Clamp each register count to the destination array size using min_t() before the copy loops, in both get_integrated_info_v11() and get_integrated_info_v2_1().

Assisted-by GitHub Copilot:claude-opus-4.6
---
 .../drm/amd/display/dc/bios/bios_parser2.c    | 48 ++++++++++++-------
 1 file changed, 32 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +32 -16
index d19ae67ebfac..6cbdf356b1cd 100644
@@ -2600,14 +2600,16 @@ static enum bp_result get_integrated_info_v11(
 	info_v11->extdispconninfo.checksum;
 
 	info->dp0_ext_hdmi_slv_addr = info_v11->dp0_retimer_set.HdmiSlvAddr;
-	info->dp0_ext_hdmi_reg_num = info_v11->dp0_retimer_set.HdmiRegNum;
+	info->dp0_ext_hdmi_reg_num = min_t(u8, info_v11->dp0_retimer_set.HdmiRegNum,
+					    ARRAY_SIZE(info->dp0_ext_hdmi_reg_settings));
 	for (i = 0; i < info->dp0_ext_hdmi_reg_num; i++) {
 		info->dp0_ext_hdmi_reg_settings[i].i2c_reg_index =
 				info_v11->dp0_retimer_set.HdmiRegSetting[i].ucI2cRegIndex;
 		info->dp0_ext_hdmi_reg_settings[i].i2c_reg_val =
 				info_v11->dp0_retimer_set.HdmiRegSetting[i].ucI2cRegVal;
 	}
-	info->dp0_ext_hdmi_6g_reg_num = info_v11->dp0_retimer_set.Hdmi6GRegNum;
+	info->dp0_ext_hdmi_6g_reg_num = min_t(u8, info_v11->dp0_retimer_set.Hdmi6GRegNum,
+					       ARRAY_SIZE(info->dp0_ext_hdmi_6g_reg_settings));
 	for (i = 0; i < info->dp0_ext_hdmi_6g_reg_num; i++) {
 		info->dp0_ext_hdmi_6g_reg_settings[i].i2c_reg_index =
 				info_v11->dp0_retimer_set.Hdmi6GhzRegSetting[i].ucI2cRegIndex;
@@ -2616,14 +2618,16 @@ static enum bp_result get_integrated_info_v11(
 	}
 
 	info->dp1_ext_hdmi_slv_addr = info_v11->dp1_retimer_set.HdmiSlvAddr;
-	info->dp1_ext_hdmi_reg_num = info_v11->dp1_retimer_set.HdmiRegNum;
+	info->dp1_ext_hdmi_reg_num = min_t(u8, info_v11->dp1_retimer_set.HdmiRegNum,
+					    ARRAY_SIZE(info->dp1_ext_hdmi_reg_settings));
 	for (i = 0; i < info->dp1_ext_hdmi_reg_num; i++) {
 		info->dp1_ext_hdmi_reg_settings[i].i2c_reg_index =
 				info_v11->dp1_retimer_set.HdmiRegSetting[i].ucI2cRegIndex;
 		info->dp1_ext_hdmi_reg_settings[i].i2c_reg_val =
 				info_v11->dp1_retimer_set.HdmiRegSetting[i].ucI2cRegVal;
 	}
-	info->dp1_ext_hdmi_6g_reg_num = info_v11->dp1_retimer_set.Hdmi6GRegNum;
+	info->dp1_ext_hdmi_6g_reg_num = min_t(u8, info_v11->dp1_retimer_set.Hdmi6GRegNum,
+					       ARRAY_SIZE(info->dp1_ext_hdmi_6g_reg_settings));
 	for (i = 0; i < info->dp1_ext_hdmi_6g_reg_num; i++) {
 		info->dp1_ext_hdmi_6g_reg_settings[i].i2c_reg_index =
 				info_v11->dp1_retimer_set.Hdmi6GhzRegSetting[i].ucI2cRegIndex;
@@ -2632,14 +2636,16 @@ static enum bp_result get_integrated_info_v11(
 	}
 
 	info->dp2_ext_hdmi_slv_addr = info_v11->dp2_retimer_set.HdmiSlvAddr;
-	info->dp2_ext_hdmi_reg_num = info_v11->dp2_retimer_set.HdmiRegNum;
+	info->dp2_ext_hdmi_reg_num = min_t(u8, info_v11->dp2_retimer_set.HdmiRegNum,
+					    ARRAY_SIZE(info->dp2_ext_hdmi_reg_settings));
 	for (i = 0; i < info->dp2_ext_hdmi_reg_num; i++) {
 		info->dp2_ext_hdmi_reg_settings[i].i2c_reg_index =
 				info_v11->dp2_retimer_set.HdmiRegSetting[i].ucI2cRegIndex;
 		info->dp2_ext_hdmi_reg_settings[i].i2c_reg_val =
 				info_v11->dp2_retimer_set.HdmiRegSetting[i].ucI2cRegVal;
 	}
-	info->dp2_ext_hdmi_6g_reg_num = info_v11->dp2_retimer_set.Hdmi6GRegNum;
+	info->dp2_ext_hdmi_6g_reg_num = min_t(u8, info_v11->dp2_retimer_set.Hdmi6GRegNum,
+					       ARRAY_SIZE(info->dp2_ext_hdmi_6g_reg_settings));
 	for (i = 0; i < info->dp2_ext_hdmi_6g_reg_num; i++) {
 		info->dp2_ext_hdmi_6g_reg_settings[i].i2c_reg_index =
 				info_v11->dp2_retimer_set.Hdmi6GhzRegSetting[i].ucI2cRegIndex;
@@ -2648,14 +2654,16 @@ static enum bp_result get_integrated_info_v11(
 	}
 
 	info->dp3_ext_hdmi_slv_addr = info_v11->dp3_retimer_set.HdmiSlvAddr;
-	info->dp3_ext_hdmi_reg_num = info_v11->dp3_retimer_set.HdmiRegNum;
+	info->dp3_ext_hdmi_reg_num = min_t(u8, info_v11->dp3_retimer_set.HdmiRegNum,
+					    ARRAY_SIZE(info->dp3_ext_hdmi_reg_settings));
 	for (i = 0; i < info->dp3_ext_hdmi_reg_num; i++) {
 		info->dp3_ext_hdmi_reg_settings[i].i2c_reg_index =
 				info_v11->dp3_retimer_set.HdmiRegSetting[i].ucI2cRegIndex;
 		info->dp3_ext_hdmi_reg_settings[i].i2c_reg_val =
 				info_v11->dp3_retimer_set.HdmiRegSetting[i].ucI2cRegVal;
 	}
-	info->dp3_ext_hdmi_6g_reg_num = info_v11->dp3_retimer_set.Hdmi6GRegNum;
+	info->dp3_ext_hdmi_6g_reg_num = min_t(u8, info_v11->dp3_retimer_set.Hdmi6GRegNum,
+					       ARRAY_SIZE(info->dp3_ext_hdmi_6g_reg_settings));
 	for (i = 0; i < info->dp3_ext_hdmi_6g_reg_num; i++) {
 		info->dp3_ext_hdmi_6g_reg_settings[i].i2c_reg_index =
 				info_v11->dp3_retimer_set.Hdmi6GhzRegSetting[i].ucI2cRegIndex;
@@ -2796,14 +2804,16 @@ static enum bp_result get_integrated_info_v2_1(
 	info->ext_disp_conn_info.checksum =
 		info_v2_1->extdispconninfo.checksum;
 	info->dp0_ext_hdmi_slv_addr = info_v2_1->dp0_retimer_set.HdmiSlvAddr;
-	info->dp0_ext_hdmi_reg_num = info_v2_1->dp0_retimer_set.HdmiRegNum;
+	info->dp0_ext_hdmi_reg_num = min_t(u8, info_v2_1->dp0_retimer_set.HdmiRegNum,
+					    ARRAY_SIZE(info->dp0_ext_hdmi_reg_settings));
 	for (i = 0; i < info->dp0_ext_hdmi_reg_num; i++) {
 		info->dp0_ext_hdmi_reg_settings[i].i2c_reg_index =
 				info_v2_1->dp0_retimer_set.HdmiRegSetting[i].ucI2cRegIndex;
 		info->dp0_ext_hdmi_reg_settings[i].i2c_reg_val =
 				info_v2_1->dp0_retimer_set.HdmiRegSetting[i].ucI2cRegVal;
 	}
-	info->dp0_ext_hdmi_6g_reg_num = info_v2_1->dp0_retimer_set.Hdmi6GRegNum;
+	info->dp0_ext_hdmi_6g_reg_num = min_t(u8, info_v2_1->dp0_retimer_set.Hdmi6GRegNum,
+					       ARRAY_SIZE(info->dp0_ext_hdmi_6g_reg_settings));
 	for (i = 0; i < info->dp0_ext_hdmi_6g_reg_num; i++) {
 		info->dp0_ext_hdmi_6g_reg_settings[i].i2c_reg_index =
 				info_v2_1->dp0_retimer_set.Hdmi6GhzRegSetting[i].ucI2cRegIndex;
@@ -2811,14 +2821,16 @@ static enum bp_result get_integrated_info_v2_1(
 				info_v2_1->dp0_retimer_set.Hdmi6GhzRegSetting[i].ucI2cRegVal;
 	}
 	info->dp1_ext_hdmi_slv_addr = info_v2_1->dp1_retimer_set.HdmiSlvAddr;
-	info->dp1_ext_hdmi_reg_num = info_v2_1->dp1_retimer_set.HdmiRegNum;
+	info->dp1_ext_hdmi_reg_num = min_t(u8, info_v2_1->dp1_retimer_set.HdmiRegNum,
+					    ARRAY_SIZE(info->dp1_ext_hdmi_reg_settings));
 	for (i = 0; i < info->dp1_ext_hdmi_reg_num; i++) {
 		info->dp1_ext_hdmi_reg_settings[i].i2c_reg_index =
 				info_v2_1->dp1_retimer_set.HdmiRegSetting[i].ucI2cRegIndex;
 		info->dp1_ext_hdmi_reg_settings[i].i2c_reg_val =
 				info_v2_1->dp1_retimer_set.HdmiRegSetting[i].ucI2cRegVal;
 	}
-	info->dp1_ext_hdmi_6g_reg_num = info_v2_1->dp1_retimer_set.Hdmi6GRegNum;
+	info->dp1_ext_hdmi_6g_reg_num = min_t(u8, info_v2_1->dp1_retimer_set.Hdmi6GRegNum,
+					       ARRAY_SIZE(info->dp1_ext_hdmi_6g_reg_settings));
 	for (i = 0; i < info->dp1_ext_hdmi_6g_reg_num; i++) {
 		info->dp1_ext_hdmi_6g_reg_settings[i].i2c_reg_index =
 				info_v2_1->dp1_retimer_set.Hdmi6GhzRegSetting[i].ucI2cRegIndex;
@@ -2826,14 +2838,16 @@ static enum bp_result get_integrated_info_v2_1(
 				info_v2_1->dp1_retimer_set.Hdmi6GhzRegSetting[i].ucI2cRegVal;
 	}
 	info->dp2_ext_hdmi_slv_addr = info_v2_1->dp2_retimer_set.HdmiSlvAddr;
-	info->dp2_ext_hdmi_reg_num = info_v2_1->dp2_retimer_set.HdmiRegNum;
+	info->dp2_ext_hdmi_reg_num = min_t(u8, info_v2_1->dp2_retimer_set.HdmiRegNum,
+					    ARRAY_SIZE(info->dp2_ext_hdmi_reg_settings));
 	for (i = 0; i < info->dp2_ext_hdmi_reg_num; i++) {
 		info->dp2_ext_hdmi_reg_settings[i].i2c_reg_index =
 				info_v2_1->dp2_retimer_set.HdmiRegSetting[i].ucI2cRegIndex;
 		info->dp2_ext_hdmi_reg_settings[i].i2c_reg_val =
 				info_v2_1->dp2_retimer_set.HdmiRegSetting[i].ucI2cRegVal;
 	}
-	info->dp2_ext_hdmi_6g_reg_num = info_v2_1->dp2_retimer_set.Hdmi6GRegNum;
+	info->dp2_ext_hdmi_6g_reg_num = min_t(u8, info_v2_1->dp2_retimer_set.Hdmi6GRegNum,
+					       ARRAY_SIZE(info->dp2_ext_hdmi_6g_reg_settings));
 	for (i = 0; i < info->dp2_ext_hdmi_6g_reg_num; i++) {
 		info->dp2_ext_hdmi_6g_reg_settings[i].i2c_reg_index =
 				info_v2_1->dp2_retimer_set.Hdmi6GhzRegSetting[i].ucI2cRegIndex;
@@ -2841,14 +2855,16 @@ static enum bp_result get_integrated_info_v2_1(
 				info_v2_1->dp2_retimer_set.Hdmi6GhzRegSetting[i].ucI2cRegVal;
 	}
 	info->dp3_ext_hdmi_slv_addr = info_v2_1->dp3_retimer_set.HdmiSlvAddr;
-	info->dp3_ext_hdmi_reg_num = info_v2_1->dp3_retimer_set.HdmiRegNum;
+	info->dp3_ext_hdmi_reg_num = min_t(u8, info_v2_1->dp3_retimer_set.HdmiRegNum,
+					    ARRAY_SIZE(info->dp3_ext_hdmi_reg_settings));
 	for (i = 0; i < info->dp3_ext_hdmi_reg_num; i++) {
 		info->dp3_ext_hdmi_reg_settings[i].i2c_reg_index =
 				info_v2_1->dp3_retimer_set.HdmiRegSetting[i].ucI2cRegIndex;
 		info->dp3_ext_hdmi_reg_settings[i].i2c_reg_val =
 				info_v2_1->dp3_retimer_set.HdmiRegSetting[i].ucI2cRegVal;
 	}
-	info->dp3_ext_hdmi_6g_reg_num = info_v2_1->dp3_retimer_set.Hdmi6GRegNum;
+	info->dp3_ext_hdmi_6g_reg_num = min_t(u8, info_v2_1->dp3_retimer_set.Hdmi6GRegNum,
+					       ARRAY_SIZE(info->dp3_ext_hdmi_6g_reg_settings));
 	for (i = 0; i < info->dp3_ext_hdmi_6g_reg_num; i++) {
 		info->dp3_ext_hdmi_6g_reg_settings[i].i2c_reg_index =
 				info_v2_1->dp3_retimer_set.Hdmi6GhzRegSetting[i].ucI2cRegIndex;
Signature · 1 line
2.43.0
author
#13 lore raw

PATCH 13/41 drm/amd/display: Avoid DPMS-on for phantom stream

In reply to Ray Wu

From: Ilya Bakoulin <[email protected]>

[Why & How]
Calling dc_update_planes_and_stream separately for stream and its phantom stream causes a NULL pointer dereference, since the phantom is destroyed on the first call.

Skip the call for phantom streams.

---
 drivers/gpu/drm/amd/display/dc/link/accessories/link_dp_cts.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/link/accessories/link_dp_cts.c +2 -0
index ae6ed3a52d53..d3172dbdcdf0 100644
@@ -145,6 +145,8 @@ static void dp_retrain_link_dp_test(struct dc_link *link,
 	// Set DPMS on with stream update
 	// Cache all streams on current link since dc_update_planes_and_stream might kill current_state
 	for (i = 0; i < MAX_PIPES; i++) {
+		if (state->streams[i] && state->streams[i]->is_phantom)
+			continue;
 		if (state->streams[i] && state->streams[i]->link && state->streams[i]->link == link)
 			streams_on_link[num_streams_on_link++] = state->streams[i];
 	}
Signature · 1 line
2.43.0
author
#14 lore raw

PATCH 14/41 drm/amd/display: Fix NULL deref and buffer over-read in SDP debugfs

In reply to Ray Wu

From: Harry Wentland <[email protected]>

[Why & How]
dp_sdp_message_debugfs_write() dereferences connector->base.state->crtc without checking for NULL. A connector can be connected but not bound to any CRTC (e.g. after hot-plug before the next atomic commit), causing a kernel crash when writing to the sdp_message debugfs node.

The function also ignores the user-provided size argument and always passes 36 bytes to copy_from_user(), reading past the user buffer when size < 36.

Fix both issues by:
- Returning -ENODEV when connector->base.state or state->crtc is NULL
- Clamping write_size to min(size, sizeof(data))

Fixes c7ba3653e977 ("drm/amd/display: Generic SDP message access in amdgpu")
Assisted-by Copilot:claude-opus-4.6
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +5 -0
index 4e68a3541639..3ceeb322be12 100644
@@ -1345,8 +1345,13 @@ static ssize_t dp_sdp_message_debugfs_write(struct file *f, const char __user *b
 	if (size == 0)
 		return 0;
 
+	if (!connector->base.state || !connector->base.state->crtc)
+		return -ENODEV;
+
 	acrtc_state = to_dm_crtc_state(connector->base.state->crtc->state);
 
+	write_size = min_t(size_t, size, sizeof(data));
+
 	r = copy_from_user(data, buf, write_size);
 
 	write_size -= r;
Signature · 1 line
2.43.0
author
#15 lore raw

PATCH 15/41 drm/amd/display: Use krealloc_array() in dal_vector_reserve()

In reply to Ray Wu

From: Harry Wentland <[email protected]>

[Why & How]
dal_vector_reserve() computes the allocation size as "capacity * vector->struct_size" using uint32_t arithmetic, which can silently wrap to a small value on overflow. This would cause krealloc to return a smaller buffer than expected, leading to heap overflows on subsequent vector appends.

Replace krealloc() with krealloc_array() which performs an internal overflow check and returns NULL on wrap, preventing the issue.

Fixes 2004f45ef83f ("drm/amd/display: Use kernel alloc/free")
Assisted-by Copilot:claude-opus-4.6
---
 drivers/gpu/drm/amd/display/dc/basics/vector.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/basics/vector.c +2 -2
index d4dcc077854d..4162f1f0383b 100644
@@ -289,8 +289,8 @@ bool dal_vector_reserve(struct vector *vector, uint32_t capacity)
 	if (capacity <= vector->capacity)
 		return true;
 
-	new_container = krealloc(vector->container,
-				 capacity * vector->struct_size, GFP_KERNEL);
+	new_container = krealloc_array(vector->container,
+				       capacity, vector->struct_size, GFP_KERNEL);
 
 	if (new_container) {
 		vector->container = new_container;
Signature · 1 line
2.43.0
author
#16 lore raw

PATCH 16/41 drm/amd/display: Reject gpio_bitshift >= 32 in bios_parser_get_gpio_pin_info()

In reply to Ray Wu

From: Harry Wentland <[email protected]>

[Why & How]
gpio_bitshift is a uint8_t read directly from the VBIOS GPIO pin table. If the value is >= 32, the expression "1 << gpio_bitshift" triggers undefined behaviour in C (shift count exceeds type width). On x86 the shift is silently masked to 5 bits, producing an incorrect GPIO mask that may cause wrong MMIO register bits to be toggled.

Validate gpio_bitshift before use and return BP_RESULT_BADBIOSTABLE for out-of-range values.

Fixes ae79c310b1a6 ("drm/amd/display: Add DCE12 bios parser support")
Assisted-by Copilot:claude-opus-4.6
---
 drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +4 -2
index 6cbdf356b1cd..9fb19f75e934 100644
@@ -701,8 +701,10 @@ static enum bp_result bios_parser_get_gpio_pin_info(
 		info->offset_en = info->offset + 1;
 		info->offset_mask = info->offset - 1;
 
-		info->mask = (uint32_t) (1 <<
-			header->gpio_pin[i].gpio_bitshift);
+		if (header->gpio_pin[i].gpio_bitshift >= 32)
+			return BP_RESULT_BADBIOSTABLE;
+
+		info->mask = 1u << header->gpio_pin[i].gpio_bitshift;
 		info->mask_y = info->mask + 2;
 		info->mask_en = info->mask + 1;
 		info->mask_mask = info->mask - 1;
Signature · 1 line
2.43.0
author
#17 lore raw

PATCH 17/41 drm/amd/display: Clamp HDMI HDCP2 rx_id_list read to buffer size

In reply to Ray Wu

From: Harry Wentland <[email protected]>

[Why & How]
During HDCP 2.x repeater authentication over HDMI, the driver reads the sink's RxStatus register and extracts a 10-bit message size field (max value 1023). This value is used as the read length for the ReceiverID list without being clamped to the size of the destination buffer rx_id_list[177]. A malicious HDMI repeater could advertise a message size larger than the buffer, causing an out-of-bounds write during the I2C read.

Clamp the read length in mod_hdcp_read_rx_id_list() to the size of the rx_id_list buffer, matching the approach already used in the DP branch.

Fixes eff682f83c9c ("drm/amd/display: Add DDC handles for HDCP2.2")
Assisted-by Copilot:claude-opus-4.6
---
 drivers/gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c +2 -1
index 0ca39873f807..324413a090bf 100644
@@ -529,7 +529,8 @@ enum mod_hdcp_status mod_hdcp_read_rx_id_list(struct mod_hdcp *hdcp)
 	} else {
 		status = read(hdcp, MOD_HDCP_MESSAGE_ID_READ_REPEATER_AUTH_SEND_RECEIVERID_LIST,
 				hdcp->auth.msg.hdcp2.rx_id_list,
-				hdcp->auth.msg.hdcp2.rx_id_list_size);
+				MIN(hdcp->auth.msg.hdcp2.rx_id_list_size,
+				    sizeof(hdcp->auth.msg.hdcp2.rx_id_list)));
 	}
 	return status;
 }
Signature · 1 line
2.43.0
author
#18 lore raw

PATCH 18/41 drm/amd/display: Bound VBIOS record-chain walk loops

In reply to Ray Wu

From: Harry Wentland <[email protected]>

[Why & How]
All record-chain walk loops in bios_parser.c and bios_parser2.c use for(;;) and only terminate on a 0xFF record_type sentinel or zero record_size. A malformed VBIOS image missing the terminator record causes unbounded iteration at probe time, potentially hundreds of thousands of iterations with record_size=1. In the final iterations near the BIOS image boundary, struct casts beyond the 2-byte header validated by GET_IMAGE can also read out of bounds.

Cap all 14 record-chain walk loops to BIOS_MAX_NUM_RECORD (256) iterations. The atombios.h defines up to 22 distinct record types and atomfirmware.h has 13. Assuming an average of less than 10 records per type (which is reasonable since most are connector- based) 256 is a generous upper bound.

Fixes 4562236b3bc0 ("drm/amd/dc: Add dc display driver (v2)")
Assisted-by Copilot:claude-opus-4.6 Mythos
---
 .../gpu/drm/amd/display/dc/bios/bios_parser.c | 15 +++++++----
 .../drm/amd/display/dc/bios/bios_parser2.c    | 27 ++++++++++++-------
 .../amd/display/dc/bios/bios_parser_helper.h  |  5 ++++
 3 files changed, 33 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/display/dc/bios/bios_parser.c +10 -5
index 2c7cca697f5f..2a9d0dfdf595 100644
@@ -222,6 +222,7 @@ static enum bp_result bios_parser_get_i2c_info(struct dc_bios *dcb,
 	ATOM_COMMON_RECORD_HEADER *header;
 	ATOM_I2C_RECORD *record;
 	struct bios_parser *bp = BP_FROM_DCB(dcb);
+	int i;
 
 	if (!info)
 		return BP_RESULT_BADINPUT;
@@ -234,7 +235,7 @@ static enum bp_result bios_parser_get_i2c_info(struct dc_bios *dcb,
 	offset = le16_to_cpu(object->usRecordOffset)
 			+ bp->object_info_tbl_offset;
 
-	for (;;) {
+	for (i = 0; i < BIOS_MAX_NUM_RECORD; i++) {
 		header = GET_IMAGE(ATOM_COMMON_RECORD_HEADER, offset);
 
 		if (!header)
@@ -293,11 +294,12 @@ static enum bp_result bios_parser_get_device_tag_record(
 {
 	ATOM_COMMON_RECORD_HEADER *header;
 	uint32_t offset;
+	int i;
 
 	offset = le16_to_cpu(object->usRecordOffset)
 			+ bp->object_info_tbl_offset;
 
-	for (;;) {
+	for (i = 0; i < BIOS_MAX_NUM_RECORD; i++) {
 		header = GET_IMAGE(ATOM_COMMON_RECORD_HEADER, offset);
 
 		if (!header)
@@ -966,6 +968,7 @@ static ATOM_HPD_INT_RECORD *get_hpd_record(struct bios_parser *bp,
 {
 	ATOM_COMMON_RECORD_HEADER *header;
 	uint32_t offset;
+	int i;
 
 	if (!object) {
 		BREAK_TO_DEBUGGER(); /* Invalid object */
@@ -975,7 +978,7 @@ static ATOM_HPD_INT_RECORD *get_hpd_record(struct bios_parser *bp,
 	offset = le16_to_cpu(object->usRecordOffset)
 			+ bp->object_info_tbl_offset;
 
-	for (;;) {
+	for (i = 0; i < BIOS_MAX_NUM_RECORD; i++) {
 		header = GET_IMAGE(ATOM_COMMON_RECORD_HEADER, offset);
 
 		if (!header)
@@ -1670,6 +1673,7 @@ static ATOM_ENCODER_CAP_RECORD_V2 *get_encoder_cap_record(
 {
 	ATOM_COMMON_RECORD_HEADER *header;
 	uint32_t offset;
+	int i;
 
 	if (!object) {
 		BREAK_TO_DEBUGGER(); /* Invalid object */
@@ -1679,7 +1683,7 @@ static ATOM_ENCODER_CAP_RECORD_V2 *get_encoder_cap_record(
 	offset = le16_to_cpu(object->usRecordOffset)
 					+ bp->object_info_tbl_offset;
 
-	for (;;) {
+	for (i = 0; i < BIOS_MAX_NUM_RECORD; i++) {
 		header = GET_IMAGE(ATOM_COMMON_RECORD_HEADER, offset);
 
 		if (!header)
@@ -2733,6 +2737,7 @@ static enum bp_result update_slot_layout_info(struct dc_bios *dcb,
 {
 	(void)i;
 	unsigned int j;
+	unsigned int n;
 	struct bios_parser *bp;
 	ATOM_BRACKET_LAYOUT_RECORD *record;
 	ATOM_COMMON_RECORD_HEADER *record_header;
@@ -2742,7 +2747,7 @@ static enum bp_result update_slot_layout_info(struct dc_bios *dcb,
 	record = NULL;
 	record_header = NULL;
 
-	for (;;) {
+	for (n = 0; n < BIOS_MAX_NUM_RECORD; n++) {
 
 		record_header = GET_IMAGE(ATOM_COMMON_RECORD_HEADER, record_offset);
 		if (record_header == NULL) {
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +18 -9
index 9fb19f75e934..c02fb2ca0317 100644
@@ -396,6 +396,7 @@ static enum bp_result bios_parser_get_i2c_info(struct dc_bios *dcb,
 	struct atom_i2c_record *record;
 	struct atom_i2c_record dummy_record = {0};
 	struct bios_parser *bp = BP_FROM_DCB(dcb);
+	int i;
 
 	if (!info)
 		return BP_RESULT_BADINPUT;
@@ -429,7 +430,7 @@ static enum bp_result bios_parser_get_i2c_info(struct dc_bios *dcb,
 		break;
 	}
 
-	for (;;) {
+	for (i = 0; i < BIOS_MAX_NUM_RECORD; i++) {
 		header = GET_IMAGE(struct atom_common_record_header, offset);
 
 		if (!header)
@@ -534,6 +535,7 @@ static struct atom_hpd_int_record *get_hpd_record_for_path_v3(struct bios_parser
 {
 	struct atom_common_record_header *header;
 	uint32_t offset;
+	int i;
 
 	if (!object) {
 		BREAK_TO_DEBUGGER(); /* Invalid object */
@@ -542,7 +544,7 @@ static struct atom_hpd_int_record *get_hpd_record_for_path_v3(struct bios_parser
 
 	offset = object->disp_recordoffset + bp->object_info_tbl_offset;
 
-	for (;;) {
+	for (i = 0; i < BIOS_MAX_NUM_RECORD; i++) {
 		header = GET_IMAGE(struct atom_common_record_header, offset);
 
 		if (!header)
@@ -611,6 +613,7 @@ static struct atom_hpd_int_record *get_hpd_record(
 {
 	struct atom_common_record_header *header;
 	uint32_t offset;
+	int i;
 
 	if (!object) {
 		BREAK_TO_DEBUGGER(); /* Invalid object */
@@ -620,7 +623,7 @@ static struct atom_hpd_int_record *get_hpd_record(
 	offset = le16_to_cpu(object->disp_recordoffset)
 			+ bp->object_info_tbl_offset;
 
-	for (;;) {
+	for (i = 0; i < BIOS_MAX_NUM_RECORD; i++) {
 		header = GET_IMAGE(struct atom_common_record_header, offset);
 
 		if (!header)
@@ -2195,6 +2198,7 @@ static struct atom_encoder_caps_record *get_encoder_cap_record(
 {
 	struct atom_common_record_header *header;
 	uint32_t offset;
+	int i;
 
 	if (!object) {
 		BREAK_TO_DEBUGGER(); /* Invalid object */
@@ -2203,7 +2207,7 @@ static struct atom_encoder_caps_record *get_encoder_cap_record(
 
 	offset = object->encoder_recordoffset + bp->object_info_tbl_offset;
 
-	for (;;) {
+	for (i = 0; i < BIOS_MAX_NUM_RECORD; i++) {
 		header = GET_IMAGE(struct atom_common_record_header, offset);
 
 		if (!header)
@@ -2232,6 +2236,7 @@ static struct atom_disp_connector_caps_record *get_disp_connector_caps_record(
 {
 	struct atom_common_record_header *header;
 	uint32_t offset;
+	int i;
 
 	if (!object) {
 		BREAK_TO_DEBUGGER(); /* Invalid object */
@@ -2240,7 +2245,7 @@ static struct atom_disp_connector_caps_record *get_disp_connector_caps_record(
 
 	offset = object->disp_recordoffset + bp->object_info_tbl_offset;
 
-	for (;;) {
+	for (i = 0; i < BIOS_MAX_NUM_RECORD; i++) {
 		header = GET_IMAGE(struct atom_common_record_header, offset);
 
 		if (!header)
@@ -2268,6 +2273,7 @@ static struct atom_connector_caps_record *get_connector_caps_record(struct bios_
 {
 	struct atom_common_record_header *header;
 	uint32_t offset;
+	int i;
 
 	if (!object) {
 		BREAK_TO_DEBUGGER(); /* Invalid object */
@@ -2276,7 +2282,7 @@ static struct atom_connector_caps_record *get_connector_caps_record(struct bios_
 
 	offset = object->disp_recordoffset + bp->object_info_tbl_offset;
 
-	for (;;) {
+	for (i = 0; i < BIOS_MAX_NUM_RECORD; i++) {
 		header = GET_IMAGE(struct atom_common_record_header, offset);
 
 		if (!header)
@@ -2354,6 +2360,7 @@ static struct atom_connector_speed_record *get_connector_speed_cap_record(struct
 {
 	struct atom_common_record_header *header;
 	uint32_t offset;
+	int i;
 
 	if (!object) {
 		BREAK_TO_DEBUGGER(); /* Invalid object */
@@ -2362,7 +2369,7 @@ static struct atom_connector_speed_record *get_connector_speed_cap_record(struct
 
 	offset = object->disp_recordoffset + bp->object_info_tbl_offset;
 
-	for (;;) {
+	for (i = 0; i < BIOS_MAX_NUM_RECORD; i++) {
 		header = GET_IMAGE(struct atom_common_record_header, offset);
 
 		if (!header)
@@ -3246,6 +3253,7 @@ static enum bp_result update_slot_layout_info(
 {
 	unsigned int record_offset;
 	unsigned int j;
+	unsigned int n;
 	struct atom_display_object_path_v2 *object;
 	struct atom_bracket_layout_record *record;
 	struct atom_common_record_header *record_header;
@@ -3267,7 +3275,7 @@ static enum bp_result update_slot_layout_info(
 		(object->disp_recordoffset) +
 		(unsigned int)(bp->object_info_tbl_offset);
 
-	for (;;) {
+	for (n = 0; n < BIOS_MAX_NUM_RECORD; n++) {
 
 		record_header = (struct atom_common_record_header *)
 			GET_IMAGE(struct atom_common_record_header,
@@ -3361,6 +3369,7 @@ static enum bp_result update_slot_layout_info_v2(
 	struct slot_layout_info *slot_layout_info)
 {
 	unsigned int record_offset;
+	unsigned int n;
 	struct atom_display_object_path_v3 *object;
 	struct atom_bracket_layout_record_v2 *record;
 	struct atom_common_record_header *record_header;
@@ -3383,7 +3392,7 @@ static enum bp_result update_slot_layout_info_v2(
 		(object->disp_recordoffset) +
 		(unsigned int)(bp->object_info_tbl_offset);
 
-	for (;;) {
+	for (n = 0; n < BIOS_MAX_NUM_RECORD; n++) {
 
 		record_header = (struct atom_common_record_header *)
 			GET_IMAGE(struct atom_common_record_header,
drivers/gpu/drm/amd/display/dc/bios/bios_parser_helper.h +5 -0
index ab162f2fe577..19fd7aea18f1 100644
@@ -37,4 +37,9 @@ void bios_set_scratch_critical_state(struct dc_bios *bios, bool state);
 
 #define GET_IMAGE(type, offset) ((type *) bios_get_image(&bp->base, offset, sizeof(type)))
 
+/* Upper bound on the number of records in a VBIOS record chain. Prevents
+ * unbounded looping if the VBIOS image is malformed and lacks a terminator.
+ */
+#define BIOS_MAX_NUM_RECORD 256
+
 #endif
Signature · 1 line
2.43.0
author
#19 lore raw

PATCH 19/41 drm/amd/display: Fix DP_PIXEL_FORMAT fields & update clk_src for DCN4x

In reply to Ray Wu

From: Ovidiu Bunea <[email protected]>

[Why & How]
The enc1_stream_encoder_dp_get_pixel_format() function reads fields of the DP_PIXEL_FORMAT register that are deprecated on DCN4x. This breaks seamless boot because driver cannot properly determine the pixel format programmed by VBIOS. The previous changed submitted for this issue incorrectly calculated the DP DTO frequency because register access to DCN4x DP DTO registers was not working.

Create a new function that reads the correct fields.
Update clk_src structs to support register access for new DCN4x registers & fields.

---
 .../drm/amd/display/dc/dce/dce_clock_source.c |  2 -
 .../drm/amd/display/dc/dce/dce_clock_source.h | 31 +++++++--
 .../dc/dio/dcn42/dcn42_dio_stream_encoder.c   | 64 ++++++++++++++++++-
 .../dc/dio/dcn42/dcn42_dio_stream_encoder.h   |  6 ++
 .../dc/resource/dcn401/dcn401_resource.c      |  4 +-
 .../dc/resource/dcn42/dcn42_resource.c        |  7 +-
 .../dc/resource/dcn42/dcn42_resource.h        |  3 +-
 7 files changed, 101 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c +0 -2
index f454eb812c21..50ff52867393 100644
@@ -1264,8 +1264,6 @@ static bool dcn401_get_dp_dto_frequency_100hz(const struct clock_source *clock_s
 		 *     - DPDTO MODULO = DTBCLK_P rate
 		 *     - target pix_clk_hz = (DPDTO INTEGER * DPDTO MODULO + DPDTO PHASE)
 		 */
-
-		dp_dto_integer += 1; // integer=0 represents 1x multiplier, etc.
 		temp = (unsigned long long)dp_dto_integer * modulo_hz + phase_hz;
 
 		if (temp / 100 > 0xFFFFFFFFUL) {
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.h +25 -6
index 9441aa6a897f..55c96b4b7765 100644
@@ -171,6 +171,17 @@
 	CS_COMMON_MASK_SH_LIST_DCN2_0(mask_sh),\
 	CS_SF(OTG0_PIXEL_RATE_CNTL, PIPE0_DTO_SRC_SEL, mask_sh)
 
+#define CS_COMMON_MASK_SH_LIST_DCN4_0_1(mask_sh)\
+	CS_COMMON_MASK_SH_LIST_DCN3_2(mask_sh),\
+	CS_SF(OTG_PIXEL_RATE_DIV, OTG0_TMDS_PIXEL_RATE_DIV, mask_sh),\
+	CS_SF(OTG_PIXEL_RATE_DIV, DPDTO0_INT, mask_sh),\
+	CS_SF(OTG_PIXEL_RATE_DIV, OTG1_TMDS_PIXEL_RATE_DIV, mask_sh),\
+	CS_SF(OTG_PIXEL_RATE_DIV, DPDTO1_INT, mask_sh),\
+	CS_SF(OTG_PIXEL_RATE_DIV, OTG2_TMDS_PIXEL_RATE_DIV, mask_sh),\
+	CS_SF(OTG_PIXEL_RATE_DIV, DPDTO2_INT, mask_sh),\
+	CS_SF(OTG_PIXEL_RATE_DIV, OTG3_TMDS_PIXEL_RATE_DIV, mask_sh),\
+	CS_SF(OTG_PIXEL_RATE_DIV, DPDTO3_INT, mask_sh)
+
 #define CS_COMMON_REG_LIST_DCN1_0(index, pllid) \
 		SRI(PIXCLK_RESYNC_CNTL, PHYPLL, pllid),\
 		SRII(PHASE, DP_DTO, 0),\
@@ -202,23 +213,31 @@
 	type PLL_REF_DIV; \
 	type DP_DTO0_PHASE; \
 	type DP_DTO0_MODULO; \
-	type DP_DTO0_ENABLE; \
-	type DPDTO0_INT; \
-	type DPDTO1_INT; \
-	type DPDTO2_INT; \
-	type DPDTO3_INT;
+	type DP_DTO0_ENABLE;
 
 #define CS_REG_FIELD_LIST_DCN32(type) \
 	type PIPE0_DTO_SRC_SEL;
 
+#define CS_REG_FIELD_LIST_DCN401(type) \
+	type DPDTO0_INT; \
+	type DPDTO1_INT; \
+	type DPDTO2_INT; \
+	type DPDTO3_INT; \
+	type OTG0_TMDS_PIXEL_RATE_DIV; \
+	type OTG1_TMDS_PIXEL_RATE_DIV; \
+	type OTG2_TMDS_PIXEL_RATE_DIV; \
+	type OTG3_TMDS_PIXEL_RATE_DIV;
+
 struct dce110_clk_src_shift {
 	CS_REG_FIELD_LIST(uint8_t)
 	CS_REG_FIELD_LIST_DCN32(uint8_t)
+	CS_REG_FIELD_LIST_DCN401(uint8_t)
 };
 
-struct dce110_clk_src_mask{
+struct dce110_clk_src_mask {
 	CS_REG_FIELD_LIST(uint32_t)
 	CS_REG_FIELD_LIST_DCN32(uint32_t)
+	CS_REG_FIELD_LIST_DCN401(uint32_t)
 };
 
 struct dce110_clk_src_regs {
drivers/gpu/drm/amd/display/dc/dio/dcn42/dcn42_dio_stream_encoder.c +63 -1

76 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dio/dcn42/dcn42_dio_stream_encoder.h +6 -0
index 7a98fee46081..5c2d81cb040f 100644
@@ -203,4 +203,10 @@ void enc42_se_enable_audio_clock(
 
 void enc42_reset_hdmi_stream_attribute(
 	struct stream_encoder *enc);
+
+bool enc42_dio_get_uncompressed_dp_pixel_format(
+	struct stream_encoder *enc,
+	enum dc_pixel_encoding *encoding,
+	enum dc_color_depth *depth);
+
 #endif /* __DC_DIO_STREAM_ENCODER_DCN42_H__ */
drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c +2 -2
index 9498cbff2449..bb1dd27f567b 100644
@@ -197,11 +197,11 @@ static struct bios_registers bios_regs;
 static struct dce110_clk_src_regs clk_src_regs[5];
 
 static const struct dce110_clk_src_shift cs_shift = {
-		CS_COMMON_MASK_SH_LIST_DCN3_2(__SHIFT)
+	CS_COMMON_MASK_SH_LIST_DCN4_0_1(__SHIFT)
 };
 
 static const struct dce110_clk_src_mask cs_mask = {
-		CS_COMMON_MASK_SH_LIST_DCN3_2(_MASK)
+	CS_COMMON_MASK_SH_LIST_DCN4_0_1(_MASK)
 };
 
 #define abm_regs_init(id)\
drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c +3 -4
index 0feb4872412f..f2b7c820a3d2 100644
@@ -214,10 +214,10 @@ static struct bios_registers bios_regs;
 static struct dce110_clk_src_regs clk_src_regs[5];
 
 static const struct dce110_clk_src_shift cs_shift = {
-	CS_COMMON_MASK_SH_LIST_DCN3_1_4(__SHIFT)
+	CS_COMMON_MASK_SH_LIST_DCN4_0_1(__SHIFT)
 };
 static const struct dce110_clk_src_mask cs_mask = {
-	CS_COMMON_MASK_SH_LIST_DCN3_1_4(_MASK)
+	CS_COMMON_MASK_SH_LIST_DCN4_0_1(_MASK)
 };
 #define abm_regs_init(id) \
 	ABM_DCN42_REG_LIST_RI(id)
@@ -874,8 +874,7 @@ static struct clock_source *dcn42_clock_source_create(
 	if (!clk_src)
 		return NULL;
 
-	if (dcn401_clk_src_construct(clk_src, ctx, bios, id,
-								 regs, &cs_shift, &cs_mask)) {
+	if (dcn401_clk_src_construct(clk_src, ctx, bios, id, regs, &cs_shift, &cs_mask)) {
 		clk_src->base.dp_clk_src = dp_clk_src;
 		return &clk_src->base;
 	}
drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.h +2 -1
index fe960542d7bd..3e4d9b188b26 100644
@@ -550,7 +550,8 @@
 		SRII_ARR_2(PIXEL_RATE_CNTL, OTG, 0, index),             \
 		SRII_ARR_2(PIXEL_RATE_CNTL, OTG, 1, index),             \
 		SRII_ARR_2(PIXEL_RATE_CNTL, OTG, 2, index),             \
-		SRII_ARR_2(PIXEL_RATE_CNTL, OTG, 3, index)
+		SRII_ARR_2(PIXEL_RATE_CNTL, OTG, 3, index),             \
+		SR_ARR(OTG_PIXEL_RATE_DIV, index)
 
 /* ABM */
 #define ABM_DCN42_REG_LIST_RI(id)                               \
Signature · 1 line
2.43.0
author
#20 lore raw

PATCH 20/41 drm/amd/display: Add KUnit tests for color LUT functions

In reply to Ray Wu

From: Alex Hung <[email protected]>

[Why]
Add KUnit tests for three color management functions in amdgpu_dm_color.c: amdgpu_dm_verify_lut_sizes, amdgpu_dm_atomic_lut3d, and __set_colorop_3dlut.

[How]
Export amdgpu_dm_verify_lut_sizes with EXPORT_IF_KUNIT. Change amdgpu_dm_atomic_lut3d and __set_colorop_3dlut from static to STATIC_IFN_KUNIT and export them with EXPORT_IF_KUNIT. Add their prototypes to amdgpu_dm_color.h inside the KUnit guard block.

Implement 14 test cases in amdgpu_dm_color_test.c:
- 8 tests for amdgpu_dm_verify_lut_sizes covering null LUTs, valid and invalid degamma/gamma sizes, both valid, and priority
- 3 tests for amdgpu_dm_atomic_lut3d covering zero size clearing initialized state, nonzero setting state bits and mode flags, and LUT data forwarding to tetrahedral_17
- 3 tests for __set_colorop_3dlut covering zero size returning -EINVAL and clearing initialized state, nonzero returning 0 and setting state bits, and 32-bit LUT data forwarding to tetrahedral_17

Assisted-by Copilot:Claude-Sonnet-4.6
---
 .../amd/display/amdgpu_dm/amdgpu_dm_color.c   |  15 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_color.h   |   7 +
 .../amdgpu_dm/tests/amdgpu_dm_color_test.c    | 342 ++++++++++++++++++
 3 files changed, 358 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +9 -6
index a47790f7cf5e..bb4f85c7033e 100644
@@ -1044,9 +1044,9 @@ EXPORT_IF_KUNIT(__drm_3dlut32_to_dc_3dlut);
  * Map user 3D LUT data to DC 3D LUT and all necessary bits to program it
  * on DCN accordingly.
  */
-static void amdgpu_dm_atomic_lut3d(const struct drm_color_lut *drm_lut3d,
-				   uint32_t drm_lut3d_size,
-				   struct dc_3dlut *lut)
+STATIC_IFN_KUNIT void amdgpu_dm_atomic_lut3d(const struct drm_color_lut *drm_lut3d,
+				     uint32_t drm_lut3d_size,
+				     struct dc_3dlut *lut)
 {
 	if (!drm_lut3d_size) {
 		lut->state.bits.initialized = 0;
@@ -1062,6 +1062,7 @@ static void amdgpu_dm_atomic_lut3d(const struct drm_color_lut *drm_lut3d,
 					MAX_COLOR_3DLUT_BITDEPTH);
 	}
 }
+EXPORT_IF_KUNIT(amdgpu_dm_atomic_lut3d);
 
 static int amdgpu_dm_atomic_shaper_lut(const struct drm_color_lut *shaper_lut,
 				       bool has_rom,
@@ -1198,6 +1199,7 @@ int amdgpu_dm_verify_lut_sizes(const struct drm_crtc_state *crtc_state)
 
 	return 0;
 }
+EXPORT_IF_KUNIT(amdgpu_dm_verify_lut_sizes);
 
 /**
  * amdgpu_dm_check_crtc_color_mgmt: Check if DRM color props are programmable by DC.
@@ -1705,9 +1707,9 @@ __set_dm_plane_colorop_shaper(struct drm_plane_state *plane_state,
  * Returns:
  * 0 on success. -EINVAL if drm_lut3d_size is zero.
  */
-static int __set_colorop_3dlut(const struct drm_color_lut32 *drm_lut3d,
-				uint32_t drm_lut3d_size,
-				struct dc_3dlut *lut)
+STATIC_IFN_KUNIT int __set_colorop_3dlut(const struct drm_color_lut32 *drm_lut3d,
+					 uint32_t drm_lut3d_size,
+					 struct dc_3dlut *lut)
 {
 	if (!drm_lut3d_size) {
 		lut->state.bits.initialized = 0;
@@ -1724,6 +1726,7 @@ static int __set_colorop_3dlut(const struct drm_color_lut32 *drm_lut3d,
 
 	return 0;
 }
+EXPORT_IF_KUNIT(__set_colorop_3dlut);
 
 static int
 __set_dm_plane_colorop_3dlut(struct drm_plane_state *plane_state,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.h +7 -0
index 19d3a13572f5..6f4e97fe6694 100644
@@ -84,6 +84,13 @@ void __drm_3dlut32_to_dc_3dlut(const struct drm_color_lut32 *lut,
 				struct tetrahedral_params *params,
 				bool use_tetrahedral_9,
 				int bit_depth);
+struct dc_3dlut;
+void amdgpu_dm_atomic_lut3d(const struct drm_color_lut *drm_lut3d,
+			     uint32_t drm_lut3d_size,
+			     struct dc_3dlut *lut);
+int __set_colorop_3dlut(const struct drm_color_lut32 *drm_lut3d,
+			uint32_t drm_lut3d_size,
+			struct dc_3dlut *lut);
 #endif
 
 #endif /* __AMDGPU_DM_COLOR_H__ */
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_color_test.c +342 -0

354 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#21 lore raw

PATCH 21/41 drm/amd/display: Extract transfer function helpers

In reply to Ray Wu

From: Alex Hung <[email protected]>

[Why]
Extract repeated inline dc_transfer_func setup patterns into two small helper functions in amdgpu_dm_color.c.

Three functions (amdgpu_dm_set_atomic_regamma, amdgpu_dm_atomic_shaper_lut, amdgpu_dm_atomic_blend_lut) each contained identical two-line bypass setup and identical three-line distributed-points setup. __set_colorop_in_tf_1d_curve contained the same two-line bypass pattern as well.

[How]
Extract to __set_tf_bypass() and __set_tf_distributed_points(). Replace all four bypass sites with __set_tf_bypass(), and all three distributed-points sites with __set_tf_distributed_points().

Assisted-by Copilot:Claude-Sonnet-4.6
---
 .../amd/display/amdgpu_dm/amdgpu_dm_color.c   | 40 +++++++++----------
 1 file changed, 20 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +20 -20
index bb4f85c7033e..ab0ed80c0e0e 100644
@@ -759,6 +759,19 @@ static int __set_output_tf_32(struct dc_transfer_func *func,
 	return res ? 0 : -ENOMEM;
 }
 
+static void __set_tf_bypass(struct dc_transfer_func *tf)
+{
+	tf->type = TF_TYPE_BYPASS;
+	tf->tf = TRANSFER_FUNCTION_LINEAR;
+}
+
+static void __set_tf_distributed_points(struct dc_transfer_func *tf,
+					enum dc_transfer_func_predefined predefined_tf)
+{
+	tf->type = TF_TYPE_DISTRIBUTED_POINTS;
+	tf->tf = predefined_tf;
+	tf->sdr_ref_white_level = SDR_WHITE_LEVEL_INIT_VALUE;
+}
 
 static int amdgpu_dm_set_atomic_regamma(struct dc_transfer_func *out_tf,
 					const struct drm_color_lut *regamma_lut,
@@ -779,18 +792,14 @@ static int amdgpu_dm_set_atomic_regamma(struct dc_transfer_func *out_tf,
 		 * pre-defined TF and the custom LUT values into the LUT that's
 		 * actually programmed.
 		 */
-		out_tf->type = TF_TYPE_DISTRIBUTED_POINTS;
-		out_tf->tf = tf;
-		out_tf->sdr_ref_white_level = SDR_WHITE_LEVEL_INIT_VALUE;
-
+		__set_tf_distributed_points(out_tf, tf);
 		ret = __set_output_tf(out_tf, regamma_lut, regamma_size, has_rom);
 	} else {
 		/*
 		 * No CRTC RGM means we can just put the block into bypass
 		 * since we don't have any plane level adjustments using it.
 		 */
-		out_tf->type = TF_TYPE_BYPASS;
-		out_tf->tf = TRANSFER_FUNCTION_LINEAR;
+		__set_tf_bypass(out_tf);
 	}
 
 	return ret;
@@ -1077,14 +1086,10 @@ static int amdgpu_dm_atomic_shaper_lut(const struct drm_color_lut *shaper_lut,
 		 * If user shaper LUT is set, we assume a linear color space
 		 * (linearized by degamma 1D LUT or not).
 		 */
-		func_shaper->type = TF_TYPE_DISTRIBUTED_POINTS;
-		func_shaper->tf = tf;
-		func_shaper->sdr_ref_white_level = SDR_WHITE_LEVEL_INIT_VALUE;
-
+		__set_tf_distributed_points(func_shaper, tf);
 		ret = __set_output_tf(func_shaper, shaper_lut, shaper_size, has_rom);
 	} else {
-		func_shaper->type = TF_TYPE_BYPASS;
-		func_shaper->tf = TRANSFER_FUNCTION_LINEAR;
+		__set_tf_bypass(func_shaper);
 	}
 
 	return ret;
@@ -1106,14 +1111,10 @@ static int amdgpu_dm_atomic_blend_lut(const struct drm_color_lut *blend_lut,
 		 * module to fill the parameters that will be translated to HW
 		 * points.
 		 */
-		func_blend->type = TF_TYPE_DISTRIBUTED_POINTS;
-		func_blend->tf = tf;
-		func_blend->sdr_ref_white_level = SDR_WHITE_LEVEL_INIT_VALUE;
-
+		__set_tf_distributed_points(func_blend, tf);
 		ret = __set_input_tf(NULL, func_blend, blend_lut, blend_size);
 	} else {
-		func_blend->type = TF_TYPE_BYPASS;
-		func_blend->tf = TRANSFER_FUNCTION_LINEAR;
+		__set_tf_bypass(func_blend);
 	}
 
 	return ret;
@@ -1510,8 +1511,7 @@ __set_colorop_in_tf_1d_curve(struct dc_plane_state *dc_plane_state,
 		return -EINVAL;
 
 	if (colorop_state->bypass) {
-		tf->type = TF_TYPE_BYPASS;
-		tf->tf = TRANSFER_FUNCTION_LINEAR;
+		__set_tf_bypass(tf);
 		return 0;
 	}
 
Signature · 1 line
2.43.0
author
#22 lore raw

PATCH 22/41 drm/amd/display: Add more color KUnit tests

In reply to Ray Wu

From: Alex Hung <[email protected]>

[Why & How]
Add KUnit tests for __set_tf_bypass(), __set_tf_distributed_points(), the bypass paths of amdgpu_dm_set_atomic_regamma(), amdgpu_dm_atomic_shaper_lut(), and amdgpu_dm_atomic_blend_lut(), and all three input branches of __set_colorop_in_tf_1d_curve().

Export the three shaper/blend/regamma helpers and __set_colorop_in_tf_1d_curve with STATIC_IFN_KUNIT and EXPORT_IF_KUNIT to make their branches reachable from tests.
Add the following test cases in amdgpu_dm_color_test.c:
- dm_test_set_tf_bypass: verify bypass TF setup
- dm_test_set_tf_distributed_points_srgb: validate sRGB gamma
- dm_test_set_tf_distributed_points_pq: validate PQ gamma
- dm_test_set_atomic_regamma_bypass: verify regamma bypass path
- dm_test_atomic_shaper_lut_bypass: verify shaper LUT bypass path
- dm_test_atomic_blend_lut_bypass: verify blend LUT bypass path
- dm_test_set_colorop_in_tf_1d_curve_invalid_type: verify invalid colorop type returns -EINVAL
- dm_test_set_colorop_in_tf_1d_curve_unsupported_curve: verify unsupported curve type returns -EINVAL
- dm_test_set_colorop_in_tf_1d_curve_bypass: verify bypass path sets TF_TYPE_BYPASS and TRANSFER_FUNCTION_LINEAR

Assisted-by Copilot:Claude-Sonnet-4.6
---
 .../amd/display/amdgpu_dm/amdgpu_dm_color.c   |  18 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_color.h   |  22 ++
 .../amdgpu_dm/tests/amdgpu_dm_color_test.c    | 226 ++++++++++++++++++
 3 files changed, 260 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +12 -6
index ab0ed80c0e0e..cc03e9adf7a1 100644
@@ -759,21 +759,23 @@ static int __set_output_tf_32(struct dc_transfer_func *func,
 	return res ? 0 : -ENOMEM;
 }
 
-static void __set_tf_bypass(struct dc_transfer_func *tf)
+STATIC_IFN_KUNIT void __set_tf_bypass(struct dc_transfer_func *tf)
 {
 	tf->type = TF_TYPE_BYPASS;
 	tf->tf = TRANSFER_FUNCTION_LINEAR;
 }
+EXPORT_IF_KUNIT(__set_tf_bypass);
 
-static void __set_tf_distributed_points(struct dc_transfer_func *tf,
+STATIC_IFN_KUNIT void __set_tf_distributed_points(struct dc_transfer_func *tf,
 					enum dc_transfer_func_predefined predefined_tf)
 {
 	tf->type = TF_TYPE_DISTRIBUTED_POINTS;
 	tf->tf = predefined_tf;
 	tf->sdr_ref_white_level = SDR_WHITE_LEVEL_INIT_VALUE;
 }
+EXPORT_IF_KUNIT(__set_tf_distributed_points);
 
-static int amdgpu_dm_set_atomic_regamma(struct dc_transfer_func *out_tf,
+STATIC_IFN_KUNIT int amdgpu_dm_set_atomic_regamma(struct dc_transfer_func *out_tf,
 					const struct drm_color_lut *regamma_lut,
 					uint32_t regamma_size, bool has_rom,
 					enum dc_transfer_func_predefined tf)
@@ -804,6 +806,7 @@ static int amdgpu_dm_set_atomic_regamma(struct dc_transfer_func *out_tf,
 
 	return ret;
 }
+EXPORT_IF_KUNIT(amdgpu_dm_set_atomic_regamma);
 
 /**
  * __set_input_tf - calculates the input transfer function based on expected
@@ -1073,7 +1076,7 @@ STATIC_IFN_KUNIT void amdgpu_dm_atomic_lut3d(const struct drm_color_lut *drm_lut
 }
 EXPORT_IF_KUNIT(amdgpu_dm_atomic_lut3d);
 
-static int amdgpu_dm_atomic_shaper_lut(const struct drm_color_lut *shaper_lut,
+STATIC_IFN_KUNIT int amdgpu_dm_atomic_shaper_lut(const struct drm_color_lut *shaper_lut,
 				       bool has_rom,
 				       enum dc_transfer_func_predefined tf,
 				       uint32_t shaper_size,
@@ -1094,8 +1097,9 @@ static int amdgpu_dm_atomic_shaper_lut(const struct drm_color_lut *shaper_lut,
 
 	return ret;
 }
+EXPORT_IF_KUNIT(amdgpu_dm_atomic_shaper_lut);
 
-static int amdgpu_dm_atomic_blend_lut(const struct drm_color_lut *blend_lut,
+STATIC_IFN_KUNIT int amdgpu_dm_atomic_blend_lut(const struct drm_color_lut *blend_lut,
 				       bool has_rom,
 				       enum dc_transfer_func_predefined tf,
 				       uint32_t blend_size,
@@ -1119,6 +1123,7 @@ static int amdgpu_dm_atomic_blend_lut(const struct drm_color_lut *blend_lut,
 
 	return ret;
 }
+EXPORT_IF_KUNIT(amdgpu_dm_atomic_blend_lut);
 
 /**
  * amdgpu_dm_verify_lut3d_size - verifies if 3D LUT is supported and if user
@@ -1496,7 +1501,7 @@ __set_dm_plane_degamma(struct drm_plane_state *plane_state,
 	return 0;
 }
 
-static int
+STATIC_IFN_KUNIT int
 __set_colorop_in_tf_1d_curve(struct dc_plane_state *dc_plane_state,
 			     struct drm_colorop_state *colorop_state)
 {
@@ -1522,6 +1527,7 @@ __set_colorop_in_tf_1d_curve(struct dc_plane_state *dc_plane_state,
 
 	return 0;
 }
+EXPORT_IF_KUNIT(__set_colorop_in_tf_1d_curve);
 
 static int
 __set_dm_plane_colorop_degamma(struct drm_plane_state *plane_state,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.h +22 -0
index 6f4e97fe6694..e4f53b7bc753 100644
@@ -36,11 +36,14 @@ struct drm_color_lut;
 struct drm_color_lut32;
 struct drm_color_ctm;
 struct drm_color_ctm_3x4;
+struct drm_colorop_state;
 struct drm_property_blob;
 struct dc_gamma;
 struct dc_rgb;
+struct dc_plane_state;
 struct fixed31_32;
 struct tetrahedral_params;
+struct dc_transfer_func;
 
 #if IS_ENABLED(CONFIG_DRM_AMD_DC_KUNIT_TEST)
 /*
@@ -91,6 +94,25 @@ void amdgpu_dm_atomic_lut3d(const struct drm_color_lut *drm_lut3d,
 int __set_colorop_3dlut(const struct drm_color_lut32 *drm_lut3d,
 			uint32_t drm_lut3d_size,
 			struct dc_3dlut *lut);
+void __set_tf_bypass(struct dc_transfer_func *tf);
+void __set_tf_distributed_points(struct dc_transfer_func *tf,
+				 enum dc_transfer_func_predefined predefined_tf);
+int amdgpu_dm_set_atomic_regamma(struct dc_transfer_func *out_tf,
+				 const struct drm_color_lut *regamma_lut,
+				 uint32_t regamma_size, bool has_rom,
+				 enum dc_transfer_func_predefined tf);
+int amdgpu_dm_atomic_shaper_lut(const struct drm_color_lut *shaper_lut,
+				bool has_rom,
+				enum dc_transfer_func_predefined tf,
+				uint32_t shaper_size,
+				struct dc_transfer_func *func_shaper);
+int amdgpu_dm_atomic_blend_lut(const struct drm_color_lut *blend_lut,
+			       bool has_rom,
+			       enum dc_transfer_func_predefined tf,
+			       uint32_t blend_size,
+			       struct dc_transfer_func *func_blend);
+int __set_colorop_in_tf_1d_curve(struct dc_plane_state *dc_plane_state,
+				 struct drm_colorop_state *colorop_state);
 #endif
 
 #endif /* __AMDGPU_DM_COLOR_H__ */
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_color_test.c +226 -0

238 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#23 lore raw

PATCH 23/41 drm/amd/display: Refactor amdgpu_dm_initialize_default_pipeline

In reply to Ray Wu

From: Alex Hung <[email protected]>

[Why & How]
Extract amdgpu_dm_initialize_default_pipeline() into a new STATIC_IFN_KUNIT helper amdgpu_dm_build_default_pipeline().

This separation makes the pipeline-building logic testable via KUnit without pulling in amdgpu_device and its dependencies that are unavailable in the UML KUnit build environment.

Assisted-by Copilot:Claude-Sonnet-4.6
---
 .../amd/display/amdgpu_dm/amdgpu_dm_colorop.c | 22 ++++++++++++++-----
 .../amd/display/amdgpu_dm/amdgpu_dm_colorop.h |  5 +++++
 2 files changed, 21 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c +16 -6
index 7c83fe6df395..d3ae9b58024b 100644
@@ -59,12 +59,11 @@ EXPORT_IF_KUNIT(amdgpu_dm_supported_blnd_tfs);
 
 #define LUT3D_SIZE		17
 
-int amdgpu_dm_initialize_default_pipeline(struct drm_plane *plane, struct drm_prop_enum_list *list)
+STATIC_IFN_KUNIT int
+amdgpu_dm_build_default_pipeline(struct drm_device *dev, struct drm_plane *plane,
+				  bool hw_3d_lut, struct drm_prop_enum_list *list)
 {
 	struct drm_colorop *ops[MAX_COLOR_PIPELINE_OPS];
-	struct drm_device *dev = plane->dev;
-	struct amdgpu_device *adev = drm_to_adev(dev);
-	bool has_3dlut = adev->dm.dc->caps.color.dpp.hw_3d_lut || adev->dm.dc->caps.color.mpc.preblend;
 	int ret;
 	int i = 0;
 
@@ -117,7 +116,7 @@ int amdgpu_dm_initialize_default_pipeline(struct drm_plane *plane, struct drm_pr
 
 	i++;
 
-	if (has_3dlut) {
+	if (hw_3d_lut) {
 		/* 1D curve - SHAPER TF */
 		ops[i] = kzalloc(sizeof(*ops[0]), GFP_KERNEL);
 		if (!ops[i]) {
@@ -208,9 +207,20 @@ int amdgpu_dm_initialize_default_pipeline(struct drm_plane *plane, struct drm_pr
 
 cleanup:
 	if (ret == -ENOMEM)
-		drm_err(plane->dev, "KMS: Failed to allocate colorop\n");
+		drm_err(dev, "KMS: Failed to allocate colorop\n");
 
 	drm_colorop_pipeline_destroy(dev);
 
 	return ret;
 }
+EXPORT_IF_KUNIT(amdgpu_dm_build_default_pipeline);
+
+int amdgpu_dm_initialize_default_pipeline(struct drm_plane *plane, struct drm_prop_enum_list *list)
+{
+	struct drm_device *dev = plane->dev;
+	struct amdgpu_device *adev = drm_to_adev(dev);
+	bool hw_3d_lut = adev->dm.dc->caps.color.dpp.hw_3d_lut ||
+			 adev->dm.dc->caps.color.mpc.preblend;
+
+	return amdgpu_dm_build_default_pipeline(dev, plane, hw_3d_lut, list);
+}
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.h +5 -0
index 2e1617ffc8ee..77364d954d3b 100644
@@ -33,4 +33,9 @@ extern const u64 amdgpu_dm_supported_blnd_tfs;
 
 int amdgpu_dm_initialize_default_pipeline(struct drm_plane *plane, struct drm_prop_enum_list *list);
 
+#if IS_ENABLED(CONFIG_DRM_AMD_DC_KUNIT_TEST)
+int amdgpu_dm_build_default_pipeline(struct drm_device *dev, struct drm_plane *plane,
+				      bool hw_3d_lut, struct drm_prop_enum_list *list);
+#endif
+
 #endif /* __AMDGPU_DM_COLOROP_H__*/
Signature · 1 line
2.43.0
author
#24 lore raw

PATCH 24/41 drm/amd/display: Fix gamma 2.2 colorop TF direction in tests

In reply to Ray Wu

From: Alex Hung <[email protected]>

[Why & How]
Correct the gamma 2.2 TF direction used in the supported-TF bitmask tests. Degam and blnd use DRM_COLOROP_1D_CURVE_GAMMA22 (EOTF direction); shaper uses DRM_COLOROP_1D_CURVE_GAMMA22_INV (inverse EOTF direction).

This aligns the tests with commit b49814033cb5
("drm/amd/display: Fix gamma 2.2 colorop TFs").

Assisted-by Copilot:Claude-Sonnet-4.6
---
 .../amdgpu_dm/tests/amdgpu_dm_colorop_test.c  | 24 +++++++++----------
 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_colorop_test.c +12 -12
index 6c77a7159188..4245ebd3725b 100644
@@ -30,10 +30,10 @@ static void dm_test_supported_degam_tfs_has_bt2020_inv_oetf(struct kunit *test)
 			  BIT(DRM_COLOROP_1D_CURVE_BT2020_INV_OETF));
 }
 
-static void dm_test_supported_degam_tfs_has_gamma22_inv(struct kunit *test)
+static void dm_test_supported_degam_tfs_has_gamma22(struct kunit *test)
 {
 	KUNIT_EXPECT_TRUE(test, amdgpu_dm_supported_degam_tfs &
-			  BIT(DRM_COLOROP_1D_CURVE_GAMMA22_INV));
+			  BIT(DRM_COLOROP_1D_CURVE_GAMMA22));
 }
 
 static void dm_test_supported_degam_tfs_no_extra_bits(struct kunit *test)
@@ -41,7 +41,7 @@ static void dm_test_supported_degam_tfs_no_extra_bits(struct kunit *test)
 	u64 expected = BIT(DRM_COLOROP_1D_CURVE_SRGB_EOTF) |
 		       BIT(DRM_COLOROP_1D_CURVE_PQ_125_EOTF) |
 		       BIT(DRM_COLOROP_1D_CURVE_BT2020_INV_OETF) |
-		       BIT(DRM_COLOROP_1D_CURVE_GAMMA22_INV);
+		       BIT(DRM_COLOROP_1D_CURVE_GAMMA22);
 
 	KUNIT_EXPECT_EQ(test, amdgpu_dm_supported_degam_tfs, expected);
 }
@@ -66,10 +66,10 @@ static void dm_test_supported_shaper_tfs_has_bt2020_oetf(struct kunit *test)
 			  BIT(DRM_COLOROP_1D_CURVE_BT2020_OETF));
 }
 
-static void dm_test_supported_shaper_tfs_has_gamma22(struct kunit *test)
+static void dm_test_supported_shaper_tfs_has_gamma22_inv(struct kunit *test)
 {
 	KUNIT_EXPECT_TRUE(test, amdgpu_dm_supported_shaper_tfs &
-			  BIT(DRM_COLOROP_1D_CURVE_GAMMA22));
+			  BIT(DRM_COLOROP_1D_CURVE_GAMMA22_INV));
 }
 
 static void dm_test_supported_shaper_tfs_no_extra_bits(struct kunit *test)
@@ -77,7 +77,7 @@ static void dm_test_supported_shaper_tfs_no_extra_bits(struct kunit *test)
 	u64 expected = BIT(DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF) |
 		       BIT(DRM_COLOROP_1D_CURVE_PQ_125_INV_EOTF) |
 		       BIT(DRM_COLOROP_1D_CURVE_BT2020_OETF) |
-		       BIT(DRM_COLOROP_1D_CURVE_GAMMA22);
+		       BIT(DRM_COLOROP_1D_CURVE_GAMMA22_INV);
 
 	KUNIT_EXPECT_EQ(test, amdgpu_dm_supported_shaper_tfs, expected);
 }
@@ -102,10 +102,10 @@ static void dm_test_supported_blnd_tfs_has_bt2020_inv_oetf(struct kunit *test)
 			  BIT(DRM_COLOROP_1D_CURVE_BT2020_INV_OETF));
 }
 
-static void dm_test_supported_blnd_tfs_has_gamma22_inv(struct kunit *test)
+static void dm_test_supported_blnd_tfs_has_gamma22(struct kunit *test)
 {
 	KUNIT_EXPECT_TRUE(test, amdgpu_dm_supported_blnd_tfs &
-			  BIT(DRM_COLOROP_1D_CURVE_GAMMA22_INV));
+			  BIT(DRM_COLOROP_1D_CURVE_GAMMA22));
 }
 
 static void dm_test_supported_blnd_tfs_no_extra_bits(struct kunit *test)
@@ -113,7 +113,7 @@ static void dm_test_supported_blnd_tfs_no_extra_bits(struct kunit *test)
 	u64 expected = BIT(DRM_COLOROP_1D_CURVE_SRGB_EOTF) |
 		       BIT(DRM_COLOROP_1D_CURVE_PQ_125_EOTF) |
 		       BIT(DRM_COLOROP_1D_CURVE_BT2020_INV_OETF) |
-		       BIT(DRM_COLOROP_1D_CURVE_GAMMA22_INV);
+		       BIT(DRM_COLOROP_1D_CURVE_GAMMA22);
 
 	KUNIT_EXPECT_EQ(test, amdgpu_dm_supported_blnd_tfs, expected);
 }
@@ -130,19 +130,19 @@ static struct kunit_case dm_colorop_test_cases[] = {
 	KUNIT_CASE(dm_test_supported_degam_tfs_has_srgb_eotf),
 	KUNIT_CASE(dm_test_supported_degam_tfs_has_pq125_eotf),
 	KUNIT_CASE(dm_test_supported_degam_tfs_has_bt2020_inv_oetf),
-	KUNIT_CASE(dm_test_supported_degam_tfs_has_gamma22_inv),
+	KUNIT_CASE(dm_test_supported_degam_tfs_has_gamma22),
 	KUNIT_CASE(dm_test_supported_degam_tfs_no_extra_bits),
 	/* shaper TFs */
 	KUNIT_CASE(dm_test_supported_shaper_tfs_has_srgb_inv_eotf),
 	KUNIT_CASE(dm_test_supported_shaper_tfs_has_pq125_inv_eotf),
 	KUNIT_CASE(dm_test_supported_shaper_tfs_has_bt2020_oetf),
-	KUNIT_CASE(dm_test_supported_shaper_tfs_has_gamma22),
+	KUNIT_CASE(dm_test_supported_shaper_tfs_has_gamma22_inv),
 	KUNIT_CASE(dm_test_supported_shaper_tfs_no_extra_bits),
 	/* blnd TFs */
 	KUNIT_CASE(dm_test_supported_blnd_tfs_has_srgb_eotf),
 	KUNIT_CASE(dm_test_supported_blnd_tfs_has_pq125_eotf),
 	KUNIT_CASE(dm_test_supported_blnd_tfs_has_bt2020_inv_oetf),
-	KUNIT_CASE(dm_test_supported_blnd_tfs_has_gamma22_inv),
+	KUNIT_CASE(dm_test_supported_blnd_tfs_has_gamma22),
 	KUNIT_CASE(dm_test_supported_blnd_tfs_no_extra_bits),
 	/* cross-check */
 	KUNIT_CASE(dm_test_degam_and_blnd_tfs_match),
Signature · 1 line
2.43.0
author
#25 lore raw

PATCH 25/41 drm/amd/display: Add KUnit tests for amdgpu_dm_colorop

In reply to Ray Wu

From: Alex Hung <[email protected]>

[Why & How]
Add a KUnit pipeline test for amdgpu_dm_build_default_pipeline().

The pipeline test uses a mock drm_device (via DRM KUnit helpers), calls amdgpu_dm_build_default_pipeline() with hw_3d_lut=true, then walks the returned colorop chain asserting the correct type sequence (degam_tf, mult, ctm, shaper_tf, shaper_lut, 3dlut, blnd_tf, blnd_lut), that every op carries bypass_property, and that the chain length is exactly eight. A kunit cleanup action calls drm_colorop_pipeline_destroy() before the device is torn down.

Assisted-by Copilot:Claude-Sonnet-4.6
---
 drivers/gpu/drm/amd/display/Kconfig           |  2 +-
 .../amd/display/amdgpu_dm/tests/.kunitconfig  |  2 +
 .../amdgpu_dm/tests/amdgpu_dm_colorop_test.c  | 78 +++++++++++++++++++
 3 files changed, 81 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/Kconfig +1 -1
index 38323e574c6b..1727d25646cc 100644
@@ -58,7 +58,7 @@ config DRM_AMD_SECURE_DISPLAY
 
 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
+	depends on DRM_AMD_DC && KUNIT && DEBUG_FS && DRM_KUNIT_TEST_HELPERS
 	default KUNIT_ALL_TESTS
 	help
 	  This option enables KUnit tests for the AMD Display Core driver.
drivers/gpu/drm/amd/display/amdgpu_dm/tests/.kunitconfig +2 -0
index a0949d3c4e6f..bd1bf8d959f9 100644
@@ -6,6 +6,8 @@ CONFIG_DRM_AMD_DC=y
 CONFIG_DEBUG_FS=y
 CONFIG_DRM_AMD_DC_KUNIT_TEST=y
 CONFIG_FW_LOADER=y
+CONFIG_DRM_KUNIT_TEST=y
+CONFIG_DRM_KUNIT_TEST_HELPERS=y
 CONFIG_DRM_KMS_HELPER=y
 CONFIG_DRM_TTM=y
 CONFIG_HWMON=y
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_colorop_test.c +78 -0

96 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#26 lore raw

PATCH 26/41 drm/amd/display: Add more KUnit tests for amdgpu_dm_ism

In reply to Ray Wu

From: Alex Hung <[email protected]>

[Why & How]
Add 8 more KUnit tests:

- dm_ism_get_idle_allow_delay: add a case where filter_entry_count exceeds filter_history_size, exercising the max() branch in the history_size calculation.
- amdgpu_dm_ism_init: verify all fields are initialised to expected values after construction.
- amdgpu_dm_ism_fini: smoke-test cancellation of never-scheduled delayed work items paired with a preceding init.
- dm_ism_set_last_idle_ts: verify last_idle_timestamp_ns is updated to at least the value captured before the call.
- dm_ism_insert_record: verify index increment and duration calculation; verify out-of-bounds index wraps to slot 0.
- dm_ism_trigger_event: verify current_state and previous_state are updated on a valid transition and left unchanged on an invalid one.

Assisted-by Copilot:Claude-Sonnet-4.6
---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c |  12 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.h |   4 +
 .../amdgpu_dm/tests/amdgpu_dm_ism_test.c      | 215 ++++++++++++++++++
 3 files changed, 228 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c +9 -3
index 06594fbfceee..0a010802540d 100644
@@ -230,7 +230,8 @@ EXPORT_IF_KUNIT(dm_ism_get_idle_allow_delay);
  * dm_ism_insert_record - Insert a record into the circular history buffer
  * @ism: ISM instance
  */
-static void dm_ism_insert_record(struct amdgpu_dm_ism *ism)
+STATIC_IFN_KUNIT
+void dm_ism_insert_record(struct amdgpu_dm_ism *ism)
 {
 	struct amdgpu_dm_ism_record *record;
 
@@ -245,15 +246,19 @@ static void dm_ism_insert_record(struct amdgpu_dm_ism *ism)
 	record->duration_ns =
 		record->timestamp_ns - ism->last_idle_timestamp_ns;
 }
+EXPORT_IF_KUNIT(dm_ism_insert_record);
 
 
-static void dm_ism_set_last_idle_ts(struct amdgpu_dm_ism *ism)
+STATIC_IFN_KUNIT
+void dm_ism_set_last_idle_ts(struct amdgpu_dm_ism *ism)
 {
 	ism->last_idle_timestamp_ns = ktime_get_ns();
 }
+EXPORT_IF_KUNIT(dm_ism_set_last_idle_ts);
 
 
-static bool dm_ism_trigger_event(struct amdgpu_dm_ism *ism,
+STATIC_IFN_KUNIT
+bool dm_ism_trigger_event(struct amdgpu_dm_ism *ism,
 				 enum amdgpu_dm_ism_event event)
 {
 	enum amdgpu_dm_ism_state next_state;
@@ -268,6 +273,7 @@ static bool dm_ism_trigger_event(struct amdgpu_dm_ism *ism,
 
 	return gotNextState;
 }
+EXPORT_IF_KUNIT(dm_ism_trigger_event);
 
 
 static void dm_ism_commit_idle_optimization_state(struct amdgpu_dm_ism *ism,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.h +4 -0
index 72e2dac49e55..da3e192e8d25 100644
@@ -157,6 +157,10 @@ 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);
+void dm_ism_insert_record(struct amdgpu_dm_ism *ism);
+void dm_ism_set_last_idle_ts(struct amdgpu_dm_ism *ism);
+bool dm_ism_trigger_event(struct amdgpu_dm_ism *ism,
+			  enum amdgpu_dm_ism_event event);
 #endif
 
 #endif
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_ism_test.c +215 -0

227 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#27 lore raw

PATCH 27/41 drm/amd/display: Extract dm_ism_dispatch_next_event

In reply to Ray Wu

From: Alex Hung <[email protected]>

[Why & How]
Separate the "should we emit IMMEDIATE?" decision into a pure, side-effect-free helper so it can be tested in isolation without a full DRM context.

- dm_ism_dispatch_next_event(current_state, delay_ns, sso_delay_ns) returns DM_ISM_EVENT_IMMEDIATE when the state requires an immediate follow-up (HYSTERESIS_WAITING with zero delay, OPTIMIZED_IDLE with zero SSO delay, or TIMER_ABORTED), and DM_ISM_NUM_EVENTS otherwise.

- Removes the passthrough event parameter that was always DM_ISM_NUM_EVENTS at the call site, making the sentinel explicit.

- Drops the now-unused event parameter from dm_ism_dispatch_power_state.

Assisted-by Copilot:Claude-Sonnet-4.6
---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c | 71 ++++++++++---------
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.h |  3 +
 2 files changed, 39 insertions(+), 35 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c +36 -35
index 0a010802540d..5c0841728671 100644
@@ -332,15 +332,36 @@ static void dm_ism_commit_idle_optimization_state(struct amdgpu_dm_ism *ism,
 	}
 }
 
+STATIC_IFN_KUNIT
+enum amdgpu_dm_ism_event dm_ism_dispatch_next_event(
+	enum amdgpu_dm_ism_state current_state,
+	uint64_t delay_ns,
+	uint64_t sso_delay_ns)
+{
+	switch (current_state) {
+	case DM_ISM_STATE_HYSTERESIS_WAITING:
+		if (delay_ns == 0)
+			return DM_ISM_EVENT_IMMEDIATE;
+		break;
+	case DM_ISM_STATE_OPTIMIZED_IDLE:
+		if (sso_delay_ns == 0)
+			return DM_ISM_EVENT_IMMEDIATE;
+		break;
+	case DM_ISM_STATE_TIMER_ABORTED:
+		return DM_ISM_EVENT_IMMEDIATE;
+	default:
+		break;
+	}
+	return DM_ISM_NUM_EVENTS;
+}
+EXPORT_IF_KUNIT(dm_ism_dispatch_next_event);
 
 static enum amdgpu_dm_ism_event dm_ism_dispatch_power_state(
 	struct amdgpu_dm_ism *ism,
-	struct dm_crtc_state *acrtc_state,
-	enum amdgpu_dm_ism_event event)
+	struct dm_crtc_state *acrtc_state)
 {
-	enum amdgpu_dm_ism_event ret = event;
 	const struct amdgpu_dm_ism_config *config = &ism->config;
-	uint64_t delay_ns, sso_delay_ns;
+	uint64_t delay_ns = 0, sso_delay_ns = 0;
 
 	switch (ism->previous_state) {
 	case DM_ISM_STATE_HYSTERESIS_WAITING:
@@ -374,30 +395,15 @@ static enum amdgpu_dm_ism_event dm_ism_dispatch_power_state(
 	switch (ism->current_state) {
 	case DM_ISM_STATE_HYSTERESIS_WAITING:
 		dm_ism_set_last_idle_ts(ism);
-
-		/* CRTC can be disabled; allow immediate idle */
-		if (!acrtc_state->stream) {
-			ret = DM_ISM_EVENT_IMMEDIATE;
-			break;
-		}
-
-		delay_ns = dm_ism_get_idle_allow_delay(ism,
-						       acrtc_state->stream);
-		if (delay_ns == 0) {
-			ret = DM_ISM_EVENT_IMMEDIATE;
-			break;
-		}
-
+		delay_ns = dm_ism_get_idle_allow_delay(ism, acrtc_state->stream);
 		/* Schedule worker */
-		mod_delayed_work(system_dfl_wq, &ism->delayed_work,
-				 nsecs_to_jiffies(delay_ns));
-
+		if (delay_ns > 0)
+			mod_delayed_work(system_dfl_wq, &ism->delayed_work,
+					 nsecs_to_jiffies(delay_ns));
 		break;
 	case DM_ISM_STATE_OPTIMIZED_IDLE:
 		sso_delay_ns = dm_ism_get_sso_delay(ism, acrtc_state->stream);
-		if (sso_delay_ns == 0)
-			ret = DM_ISM_EVENT_IMMEDIATE;
-		else if (config->sso_num_frames < config->filter_num_frames) {
+		if (sso_delay_ns > 0) {
 			/*
 			 * If sso_num_frames is less than hysteresis frames, it
 			 * indicates that allowing idle here, then disallowing
@@ -405,13 +411,10 @@ static enum amdgpu_dm_ism_event dm_ism_dispatch_power_state(
 			 * have a negative power impact. Skip idle allow here,
 			 * and let the sso_delayed_work handle it.
 			 */
-			mod_delayed_work(system_dfl_wq,
-					 &ism->sso_delayed_work,
-					 nsecs_to_jiffies(sso_delay_ns));
-		} else {
-			/* Enable idle optimization without SSO */
-			dm_ism_commit_idle_optimization_state(
-				ism, acrtc_state->stream, false, false);
+			if (config->sso_num_frames >= config->filter_num_frames)
+				dm_ism_commit_idle_optimization_state(ism, acrtc_state->stream,
+								      false, false);
+
 			mod_delayed_work(system_dfl_wq,
 					 &ism->sso_delayed_work,
 					 nsecs_to_jiffies(sso_delay_ns));
@@ -426,13 +429,12 @@ static enum amdgpu_dm_ism_event dm_ism_dispatch_power_state(
 		dm_ism_insert_record(ism);
 		dm_ism_commit_idle_optimization_state(ism, acrtc_state->stream,
 						      true, false);
-		ret = DM_ISM_EVENT_IMMEDIATE;
 		break;
 	default:
 		break;
 	}
 
-	return ret;
+	return dm_ism_dispatch_next_event(ism->current_state, delay_ns, sso_delay_ns);
 }
 
 static char *dm_ism_events_str[DM_ISM_NUM_EVENTS] = {
@@ -487,8 +489,7 @@ void amdgpu_dm_ism_commit_event(struct amdgpu_dm_ism *ism,
 				dm_ism_states_str[ism->previous_state],
 				dm_ism_states_str[ism->current_state],
 				dm_ism_events_str[event]);
-			next_event = dm_ism_dispatch_power_state(
-				ism, acrtc_state, next_event);
+			next_event = dm_ism_dispatch_power_state(ism, acrtc_state);
 		} else {
 			trace_amdgpu_dm_ism_event(
 				acrtc->crtc_id,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.h +3 -0
index da3e192e8d25..afce16f7085a 100644
@@ -161,6 +161,9 @@ void dm_ism_insert_record(struct amdgpu_dm_ism *ism);
 void dm_ism_set_last_idle_ts(struct amdgpu_dm_ism *ism);
 bool dm_ism_trigger_event(struct amdgpu_dm_ism *ism,
 			  enum amdgpu_dm_ism_event event);
+enum amdgpu_dm_ism_event dm_ism_dispatch_next_event(enum amdgpu_dm_ism_state current_state,
+						    uint64_t delay_ns,
+						    uint64_t sso_delay_ns);
 #endif
 
 #endif
Signature · 1 line
2.43.0
author
#28 lore raw

PATCH 28/41 drm/amd/display: Add KUnit tests for dm_ism_dispatch_next_event

In reply to Ray Wu

From: Alex Hung <[email protected]>

[Why & How]
Add 6 KUnit test cases exercising the new helper:

- hyst_wait_no_delay: HYSTERESIS_WAITING + delay_ns==0 returns IMMEDIATE (covers null stream / no hysteresis config).
- hyst_wait_with_delay: HYSTERESIS_WAITING + delay_ns>0 returns DM_ISM_NUM_EVENTS (timer scheduled, no immediate event).
- opt_idle_no_sso_delay: OPTIMIZED_IDLE + sso_delay_ns==0 returns IMMEDIATE (skip SSO, transition immediately).
- opt_idle_with_sso_delay: OPTIMIZED_IDLE + sso_delay_ns>0 returns DM_ISM_NUM_EVENTS (SSO timer scheduled).
- timer_aborted: TIMER_ABORTED always returns IMMEDIATE regardless of delay values.
- no_action_state: all other states return DM_ISM_NUM_EVENTS.

Assisted-by Copilot:Claude-Sonnet-4.6
---
 .../amdgpu_dm/tests/amdgpu_dm_ism_test.c      | 87 +++++++++++++++++++
 1 file changed, 87 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_ism_test.c +87 -0
index c333dab40959..f3b3f77aafd5 100644
@@ -781,6 +781,86 @@ static void dm_test_ism_trigger_event_invalid_transition(struct kunit *test)
 			(int)DM_ISM_STATE_FULL_POWER_RUNNING);
 }
 
+/* ===== Tests for dm_ism_dispatch_next_event ===== */
+
+/**
+ * dm_test_dispatch_next_event_hyst_wait_no_delay - zero delay_ns: IMMEDIATE in HYSTERESIS_WAITING
+ * @test: KUnit test context
+ */
+static void dm_test_dispatch_next_event_hyst_wait_no_delay(struct kunit *test)
+{
+	enum amdgpu_dm_ism_event result;
+
+	result = dm_ism_dispatch_next_event(DM_ISM_STATE_HYSTERESIS_WAITING,
+					    0, 0);
+	KUNIT_EXPECT_EQ(test, (int)result, (int)DM_ISM_EVENT_IMMEDIATE);
+}
+
+/**
+ * dm_test_dispatch_next_event_hyst_wait_with_delay - delay_ns > 0, no IMMEDIATE event returned
+ * @test: KUnit test context
+ */
+static void dm_test_dispatch_next_event_hyst_wait_with_delay(struct kunit *test)
+{
+	enum amdgpu_dm_ism_event result;
+
+	result = dm_ism_dispatch_next_event(DM_ISM_STATE_HYSTERESIS_WAITING,
+					    1000000, 0);
+	KUNIT_EXPECT_EQ(test, (int)result, (int)DM_ISM_NUM_EVENTS);
+}
+
+/**
+ * dm_test_dispatch_next_event_opt_idle_no_sso_delay - sso_delay_ns == 0 triggers IMMEDIATE event
+ * @test: KUnit test context
+ */
+static void dm_test_dispatch_next_event_opt_idle_no_sso_delay(struct kunit *test)
+{
+	enum amdgpu_dm_ism_event result;
+
+	result = dm_ism_dispatch_next_event(DM_ISM_STATE_OPTIMIZED_IDLE,
+					    0, 0);
+	KUNIT_EXPECT_EQ(test, (int)result, (int)DM_ISM_EVENT_IMMEDIATE);
+}
+
+/**
+ * dm_test_dispatch_next_event_opt_idle_with_sso_delay - sso_delay_ns > 0, SSO timer, no IMMEDIATE
+ * @test: KUnit test context
+ */
+static void dm_test_dispatch_next_event_opt_idle_with_sso_delay(struct kunit *test)
+{
+	enum amdgpu_dm_ism_event result;
+
+	result = dm_ism_dispatch_next_event(DM_ISM_STATE_OPTIMIZED_IDLE,
+					    0, 1000000);
+	KUNIT_EXPECT_EQ(test, (int)result, (int)DM_ISM_NUM_EVENTS);
+}
+
+/**
+ * dm_test_dispatch_next_event_timer_aborted - TIMER_ABORTED always returns IMMEDIATE
+ * @test: KUnit test context
+ */
+static void dm_test_dispatch_next_event_timer_aborted(struct kunit *test)
+{
+	enum amdgpu_dm_ism_event result;
+
+	result = dm_ism_dispatch_next_event(DM_ISM_STATE_TIMER_ABORTED,
+					    0, 0);
+	KUNIT_EXPECT_EQ(test, (int)result, (int)DM_ISM_EVENT_IMMEDIATE);
+}
+
+/**
+ * dm_test_dispatch_next_event_no_action_state - other states return DM_ISM_NUM_EVENTS
+ * @test: KUnit test context
+ */
+static void dm_test_dispatch_next_event_no_action_state(struct kunit *test)
+{
+	enum amdgpu_dm_ism_event result;
+
+	result = dm_ism_dispatch_next_event(DM_ISM_STATE_FULL_POWER_RUNNING,
+					    0, 0);
+	KUNIT_EXPECT_EQ(test, (int)result, (int)DM_ISM_NUM_EVENTS);
+}
+
 static struct kunit_case dm_ism_test_cases[] = {
 	/* dm_ism_next_state — FULL_POWER_RUNNING */
 	KUNIT_CASE(dm_test_ism_next_state_running_enter_idle),
@@ -836,6 +916,13 @@ static struct kunit_case dm_ism_test_cases[] = {
 	/* dm_ism_trigger_event */
 	KUNIT_CASE(dm_test_ism_trigger_event_valid_transition),
 	KUNIT_CASE(dm_test_ism_trigger_event_invalid_transition),
+	/* dm_ism_dispatch_next_event */
+	KUNIT_CASE(dm_test_dispatch_next_event_hyst_wait_no_delay),
+	KUNIT_CASE(dm_test_dispatch_next_event_hyst_wait_with_delay),
+	KUNIT_CASE(dm_test_dispatch_next_event_opt_idle_no_sso_delay),
+	KUNIT_CASE(dm_test_dispatch_next_event_opt_idle_with_sso_delay),
+	KUNIT_CASE(dm_test_dispatch_next_event_timer_aborted),
+	KUNIT_CASE(dm_test_dispatch_next_event_no_action_state),
 	{}
 };
 
Signature · 1 line
2.43.0
author
#29 lore raw

PATCH 29/41 drm/amd/display: Add KUnit tests for amdgpu_dm_psr_set_event

In reply to Ray Wu

From: Alex Hung <[email protected]>

[Why & How]
Add three KUnit tests covering the early-exit validation guard in amdgpu_dm_psr_set_event():

- NULL stream argument returns false immediately
- Valid stream with NULL link returns false
- Valid stream/link with psr_feature_enabled == false returns false

Assisted-by Copilot:Claude-Sonnet-4.6
---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c |  1 +
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_psr.h |  4 +-
 .../amdgpu_dm/tests/amdgpu_dm_psr_test.c      | 46 +++++++++++++++++--
 3 files changed, 45 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c +1 -0
index 4b823bba4392..dd26de9a57e5 100644
@@ -25,6 +25,7 @@
  */
 
 #include "amdgpu_dm_psr.h"
+#include "amdgpu.h"
 #include "dc_dmub_srv.h"
 #include "dc.h"
 #include "amdgpu_dm.h"
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.h +3 -1
index 9f3e22520ca0..40a09b5dc606 100644
@@ -27,10 +27,12 @@
 #ifndef AMDGPU_DM_AMDGPU_DM_PSR_H_
 #define AMDGPU_DM_AMDGPU_DM_PSR_H_
 
-#include "amdgpu.h"
 #include "dc.h"
 #include "modules/inc/mod_power.h"
 
+struct amdgpu_display_manager;
+struct amdgpu_dm_connector;
+
 /* the number of pageflips before enabling psr */
 #define AMDGPU_DM_PSR_ENTRY_DELAY 5
 
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_psr_test.c +41 -5

64 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#30 lore raw

PATCH 30/41 drm/amd/display: Clean up PSR helper functions

In reply to Ray Wu

From: Alex Hung <[email protected]>

[Why & How]
Use the existing local dc variable in amdgpu_dm_set_psr_caps() instead of redundantly dereferencing link->ctx->dc.

Simplify amdgpu_dm_psr_is_active_allowed() by replacing with early return and inlining the intermediate stream variable.

No functional changes.

Assisted-by Copilot:Claude-Sonnet-4.6
---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c +7 -12
index dd26de9a57e5..85caa8534184 100644
@@ -123,7 +123,7 @@ bool amdgpu_dm_set_psr_caps(struct dc_link *link, struct amdgpu_dm_connector *ac
 		return false;
 
 	/*disable allow psr/psrsu/replay on eDP1*/
-	if (dc_get_edp_link_panel_inst(link->ctx->dc, link, &panel_inst) && panel_inst == 1)
+	if (dc_get_edp_link_panel_inst(dc, link, &panel_inst) && panel_inst == 1)
 		return false;
 
 	if (link_supports_psrsu(link))
@@ -145,22 +145,17 @@ bool amdgpu_dm_set_psr_caps(struct dc_link *link, struct amdgpu_dm_connector *ac
 bool amdgpu_dm_psr_is_active_allowed(struct amdgpu_display_manager *dm)
 {
 	unsigned int i;
-	bool allow_active = false;
 
-	for (i = 0; i < dm->dc->current_state->stream_count ; i++) {
-		struct dc_link *link;
-		struct dc_stream_state *stream = dm->dc->current_state->streams[i];
+	for (i = 0; i < dm->dc->current_state->stream_count; i++) {
+		const struct dc_link *link = dm->dc->current_state->streams[i]->link;
 
-		link = stream->link;
 		if (!link)
 			continue;
-		if (link->psr_settings.psr_feature_enabled &&
-		    link->psr_settings.psr_allow_active) {
-			allow_active = true;
-			break;
-		}
+
+		if (link->psr_settings.psr_feature_enabled && link->psr_settings.psr_allow_active)
+			return true;
 	}
-	return allow_active;
+	return false;
 }
 
 /*
Signature · 1 line
2.43.0
author
#31 lore raw

PATCH 31/41 drm/amd/display: Add no_native_i2c codepath

In reply to Ray Wu

From: Matthew Stewart <[email protected]>

[Why]
ASICs which do not have native DDC capability must use a different codepath to access the AUX channel.

[How]
- BIOS cap NO_DDC_PIN is set to 1 for links which do not have the DDC pin.
- dp_connector_no_native_i2c in dc_config must also be set to true to use this codepath.

---
 .../drm/amd/display/dc/bios/bios_parser2.c    |  67 +++++++
 drivers/gpu/drm/amd/display/dc/dc.h           |   8 +
 .../gpu/drm/amd/display/dc/dc_bios_types.h    |   4 +
 drivers/gpu/drm/amd/display/dc/dc_fused_io.c  |   4 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_aux.c  | 181 +++++++++++++++++-
 drivers/gpu/drm/amd/display/dc/dce/dce_aux.h  |   4 +
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c |  27 +++
 .../drm/amd/display/dc/link/link_factory.c    |  86 +++++----
 .../amd/display/dc/link/protocols/link_ddc.c  |  60 +++---
 .../dc/link/protocols/link_dp_capability.c    |   6 +
 .../link/protocols/link_edp_panel_control.c   |   5 +-
 .../amd/display/include/bios_parser_types.h   |   1 +
 12 files changed, 382 insertions(+), 71 deletions(-)
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +67 -0
index c02fb2ca0317..9244a4397022 100644
@@ -718,6 +718,69 @@ static enum bp_result bios_parser_get_gpio_pin_info(
 	return BP_RESULT_NORECORD;
 }
 
+static enum bp_result bios_parser_get_connector_aux_info(struct dc_bios *dcb,
+	struct graphics_object_id id,
+	struct graphics_object_i2c_info *info)
+{
+	uint32_t offset;
+	struct atom_display_object_path_v2 *object;
+	struct atom_display_object_path_v3 *object_path_v3;
+	struct atom_common_record_header *header;
+	struct atom_i2c_record *record;
+	struct bios_parser *bp = BP_FROM_DCB(dcb);
+
+	if (!info)
+		return BP_RESULT_BADINPUT;
+
+	switch (bp->object_info_tbl.revision.minor) {
+	case 4:
+	default:
+		object = get_bios_object(bp, id);
+
+		if (!object)
+			return BP_RESULT_BADINPUT;
+
+		offset = object->disp_recordoffset + bp->object_info_tbl_offset;
+		break;
+	case 5:
+		object_path_v3 = get_bios_object_from_path_v3(bp, id);
+
+		if (!object_path_v3)
+			return BP_RESULT_BADINPUT;
+
+		offset = object_path_v3->disp_recordoffset + bp->object_info_tbl_offset;
+		break;
+	}
+
+	for (;;) {
+		header = GET_IMAGE(struct atom_common_record_header, offset);
+
+		if (!header)
+			return BP_RESULT_BADBIOSTABLE;
+
+		if (header->record_type == LAST_RECORD_TYPE ||
+			!header->record_size)
+			break;
+
+		if (header->record_type == ATOM_I2C_RECORD_TYPE
+			&& sizeof(struct atom_i2c_record) <=
+			header->record_size) {
+			/* get_connector_aux_info - which aux instance is used it is based
+			 * on record->i2c_id field only, does not need GPIO DDC
+			 */
+			record = (struct atom_i2c_record *)header;
+
+			info->i2c_line = record->i2c_id & I2C_HW_LANE_MUX;
+
+			return BP_RESULT_OK;
+		}
+
+		offset += header->record_size;
+	}
+
+	return BP_RESULT_NORECORD;
+}
+
 static struct device_id device_type_from_device_id(uint16_t device_id)
 {
 
@@ -2349,6 +2412,9 @@ static enum bp_result bios_parser_get_disp_connector_caps_info(
 									? 1 : 0;
 		info->INTERNAL_DISPLAY_BL = (record_path_v3->connector_caps & ATOM_CONNECTOR_CAP_INTERNAL_DISPLAY_BL)
 										? 1 : 0;
+		// All aux transactions for this connector should rely only on aux instance, not on ddc instance
+		info->NO_DDC_PIN = (record_path_v3->connector_caps & ATOM_CONNECTOR_CAP_DP_PLUS_PLUS_TYPE2_ONLY) ? 1 : 0;
+
 		break;
 	}
 
@@ -3717,6 +3783,7 @@ static const struct dc_vbios_funcs vbios_funcs = {
 	.get_lttpr_interop = bios_parser_get_lttpr_interop,
 
 	.get_connector_speed_cap_info = bios_parser_get_connector_speed_cap_info,
+	.get_connector_aux_info = bios_parser_get_connector_aux_info,
 };
 
 static bool bios_parser2_construct(
drivers/gpu/drm/amd/display/dc/dc.h +8 -0
index 75f59ca927ff..3ffcb74552c4 100644
@@ -559,6 +559,7 @@ struct dc_config {
 	bool enable_dpia_pre_training;
 	bool unify_link_enc_assignment;
 	bool enable_cursor_offload;
+	bool dp_connector_no_native_i2c;
 	bool frame_update_cmd_version2;
 	struct spl_sharpness_range dcn_sharpness_range;
 	struct spl_sharpness_range dcn_override_sharpness_range;
@@ -1652,6 +1653,13 @@ struct dc_scratch_space {
 	struct dc_link_training_overrides preferred_training_settings;
 	struct dp_audio_test_data audio_test_data;
 
+	/* On ASICs with dp_connector_no_native_i2c cap set and no_ddc_pin cap
+	 * set by IFWI, link aux_hw_inst is used in aux layer functions instead
+	 * of ddc_pin to know which aux instance is associated with link.
+	 */
+	bool no_ddc_pin;
+	enum gpio_ddc_line aux_hw_inst;
+
 	enum gpio_ddc_line ddc_hw_inst;
 
 	uint8_t hpd_src;
drivers/gpu/drm/amd/display/dc/dc_bios_types.h +4 -0
index 526f71616f94..5f9560147939 100644
@@ -172,6 +172,10 @@ struct dc_vbios_funcs {
 		struct dc_bios *bios,
 		struct graphics_object_id object_id,
 		struct bp_connector_speed_cap_info *info);
+	enum bp_result(*get_connector_aux_info)(
+		struct dc_bios *dcb,
+		struct graphics_object_id id,
+		struct graphics_object_i2c_info *info);
 };
 
 struct bios_registers {
drivers/gpu/drm/amd/display/dc/dc_fused_io.c +2 -2
index 664cb4abf623..923f70724419 100644
@@ -102,8 +102,8 @@ bool dm_atomic_write_poll_read_i2c(
 	if (!link)
 		return false;
 
-	const bool over_aux = false;
-	const uint32_t ddc_line = link->ddc->ddc_pin->pin_data->en;
+	const bool over_aux = link->no_ddc_pin;
+	const uint32_t ddc_line = over_aux ? link->aux_hw_inst : link->ddc->ddc_pin->pin_data->en;
 
 	union dmub_rb_cmd commands[3] = { 0 };
 	const bool converted = op_i2c_convert(&commands[0], write, FUSED_REQUEST_WRITE, ddc_line, over_aux)
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c +175 -6

230 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce/dce_aux.h +4 -0
index 8f4745694016..b2153cb03b51 100644
@@ -308,6 +308,10 @@ int dce_aux_transfer_raw_with_ddc_pin(struct ddc_service *ddc,
 		struct aux_payload *cmd,
 		enum aux_return_code_type *operation_result);
 
+int dce_aux_transfer_raw_without_ddc_pin(struct ddc_service *ddc,
+	struct aux_payload *cmd,
+	enum aux_return_code_type *operation_result);
+
 int dce_aux_transfer_dmub_raw(struct ddc_service *ddc,
 		struct aux_payload *payload,
 		enum aux_return_code_type *operation_result);
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +27 -0
index 124a1ccec741..d88dc668c7ca 100644
@@ -40,6 +40,7 @@
 #include "link_enc_cfg.h"
 #include "../hw_sequencer.h"
 #include "dio/dcn10/dcn10_dio.h"
+#include "gpio_service_interface.h"
 
 #define DC_LOGGER_INIT(logger)
 
@@ -319,6 +320,32 @@ void dcn401_init_hw(struct dc *dc)
 			backlight = link->panel_cntl->funcs->hw_init(link->panel_cntl);
 			user_level = link->panel_cntl->stored_backlight_registers.USER_LEVEL;
 		}
+
+		if (link->ctx->dc->config.dp_connector_no_native_i2c && link->no_ddc_pin) {
+			struct graphics_object_i2c_info i2c_info;
+			struct ddc *ddc_pin;
+			struct gpio_ddc_hw_info hw_info;
+
+			if (link->ctx->dc_bios->funcs->get_i2c_info(dcb, link->link_id, &i2c_info) == BP_RESULT_OK) {
+				hw_info.ddc_channel = i2c_info.i2c_line;
+				hw_info.hw_supported = i2c_info.i2c_hw_assist;
+
+				ddc_pin = dal_gpio_create_ddc(
+					link->ctx->gpio_service,
+					i2c_info.gpio_info.clk_a_register_index,
+					1 << i2c_info.gpio_info.clk_a_shift,
+					&hw_info);
+
+				if (ddc_pin) {
+					// need to switch pad to aux mode, one time only
+					// TODO: Handle result
+					dal_ddc_open(ddc_pin, GPIO_MODE_HARDWARE,
+						GPIO_DDC_CONFIG_TYPE_MODE_AUX);
+
+					dal_gpio_destroy_ddc(&ddc_pin);
+				}
+			}
+		}
 	}
 
 	for (i = 0; i < dc->res_pool->pipe_count; i++) {
drivers/gpu/drm/amd/display/dc/link/link_factory.c +47 -39

108 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.c +37 -23

73 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c +6 -0
index 817b4010edcb..47abb4066709 100644
@@ -2570,6 +2570,12 @@ bool dp_is_sink_present(struct dc_link *link)
 		(connector_id == CONNECTOR_ID_EDP) ||
 		(connector_id == CONNECTOR_ID_USBC));
 
+	/* We can't perform the step below for ASICs with no Native
+	 * I2C signaling support on DP connectors, so skip it.
+	 */
+	if (link->ctx->dc->config.dp_connector_no_native_i2c && link->no_ddc_pin)
+		return present;
+
 	ddc = get_ddc_pin(link->ddc);
 
 	if (!ddc) {
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +4 -1
index 3db4f10d1654..80a372ceaa51 100644
@@ -788,7 +788,10 @@ bool edp_setup_psr(struct dc_link *link,
 		}
 	}
 
-	psr_context->channel = link->ddc->ddc_pin->hw_info.ddc_channel;
+	if (dc->config.dp_connector_no_native_i2c && link->no_ddc_pin)
+		psr_context->channel = (enum channel_id)link->aux_hw_inst;
+	else
+		psr_context->channel = link->ddc->ddc_pin->hw_info.ddc_channel;
 	psr_context->transmitterId = link->link_enc->transmitter;
 	psr_context->engineId = link->link_enc->preferred_engine;
 
drivers/gpu/drm/amd/display/include/bios_parser_types.h +1 -0
index b5d97b394131..13da300fd4b7 100644
@@ -317,6 +317,7 @@ struct bp_spread_spectrum_parameters {
 struct bp_disp_connector_caps_info {
 	uint32_t INTERNAL_DISPLAY    : 1;
 	uint32_t INTERNAL_DISPLAY_BL : 1;
+	uint32_t NO_DDC_PIN : 1;
 };
 
 struct bp_encoder_cap_info {
Signature · 1 line
2.43.0
author
#32 lore raw

PATCH 32/41 drm/amd/display: Handle aux_inst for connectors without DDC pin

In reply to Ray Wu

From: Gabe Teeger <[email protected]>

[Why & How]
Must use an alternative codepath to access AUX channel when link->no_ddc_pin is set.

---
 .../gpu/drm/amd/display/modules/power/power.c    |  9 +++++++--
 .../drm/amd/display/modules/power/power_abm.c    | 16 ++++++++++++----
 2 files changed, 19 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/modules/power/power.c +7 -2
index 1dd65bdf8cc9..5659a38b3366 100644
@@ -464,6 +464,7 @@ bool mod_power_notify_mode_change(struct mod_power *mod_power,
 	struct dc_link *link = NULL;
 	struct dc *dc = NULL;
 	unsigned int panel_inst = 0;
+	uint8_t aux_inst = 0;
 
 	if ((mod_power == NULL) || (stream == NULL))
 		return false;
@@ -482,8 +483,12 @@ bool mod_power_notify_mode_change(struct mod_power *mod_power,
 	link = dc_stream_get_link(stream);
 
 	if (link != NULL && dc_get_edp_link_panel_inst(dc, link, &panel_inst)) {
-		ASSERT(link->ddc->ddc_pin->hw_info.ddc_channel <= 0xFF);
-		uint8_t aux_inst = (uint8_t)link->ddc->ddc_pin->hw_info.ddc_channel;
+		if (link->ctx->dc->config.dp_connector_no_native_i2c && link->no_ddc_pin) {
+			aux_inst = (uint8_t)link->aux_hw_inst;
+		} else {
+			ASSERT(link->ddc->ddc_pin->hw_info.ddc_channel <= 0xFF);
+			aux_inst = (uint8_t)link->ddc->ddc_pin->hw_info.ddc_channel;
+		}
 
 		mod_power_update_backlight_on_mode_change(core_power, link, panel_inst, aux_inst, is_hdr);
 
drivers/gpu/drm/amd/display/modules/power/power_abm.c +12 -4
index b94dbb9e64a7..a1a0563598b5 100644
@@ -849,8 +849,12 @@ bool mod_power_set_backlight_nits(struct mod_power *mod_power,
 	core_power = MOD_POWER_TO_CORE(mod_power);
 	link = dc_stream_get_link(stream);
 
-	ASSERT(link->ddc->ddc_pin->hw_info.ddc_channel <= 0xFF);
-	aux_inst = (uint8_t)link->ddc->ddc_pin->hw_info.ddc_channel;
+	if (link->ctx->dc->config.dp_connector_no_native_i2c && link->no_ddc_pin) {
+		aux_inst = (uint8_t)link->aux_hw_inst;
+	} else {
+		ASSERT(link->ddc->ddc_pin->hw_info.ddc_channel <= 0xFF);
+		aux_inst = (uint8_t)link->ddc->ddc_pin->hw_info.ddc_channel;
+	}
 
 	if (!dc_get_edp_link_panel_inst(core_power->dc, stream->link, &panel_inst))
 		return false;
@@ -937,8 +941,12 @@ bool mod_power_set_backlight_percent(struct mod_power *mod_power,
 
 	core_power = MOD_POWER_TO_CORE(mod_power);
 	link = dc_stream_get_link(stream);
-	ASSERT(link->ddc->ddc_pin->hw_info.ddc_channel <= 0xFF);
-	aux_inst = (uint8_t)link->ddc->ddc_pin->hw_info.ddc_channel;
+	if (link->ctx->dc->config.dp_connector_no_native_i2c && link->no_ddc_pin) {
+		aux_inst = (uint8_t)link->aux_hw_inst;
+	} else {
+		ASSERT(link->ddc->ddc_pin->hw_info.ddc_channel <= 0xFF);
+		aux_inst = (uint8_t)link->ddc->ddc_pin->hw_info.ddc_channel;
+	}
 
 	if (!dc_get_edp_link_panel_inst(core_power->dc, stream->link, &panel_inst))
 		return false;
Signature · 1 line
2.43.0
author
#33 lore raw

PATCH 34/41 drm/amd/display: Add DCN42B DC resource files

In reply to Ray Wu

From: Matthew Stewart <[email protected]>

[Why & How]
Add DC resource files for DCN42B.

---
 .../dc/clk_mgr/dcn42b/dcn42b_clk_mgr.c        |  483 ++++
 .../dc/clk_mgr/dcn42b/dcn42b_clk_mgr.h        |   48 +
 .../dc/gpio/dcn42b/hw_factory_dcn42b.c        |  313 +++
 .../dc/gpio/dcn42b/hw_factory_dcn42b.h        |   11 +
 .../dc/gpio/dcn42b/hw_translate_dcn42b.c      |  192 ++
 .../dc/gpio/dcn42b/hw_translate_dcn42b.h      |   13 +
 .../amd/display/dc/hwss/dcn42b/dcn42b_hwseq.c |  238 ++
 .../amd/display/dc/hwss/dcn42b/dcn42b_hwseq.h |   15 +
 .../amd/display/dc/hwss/dcn42b/dcn42b_init.c  |   20 +
 .../amd/display/dc/hwss/dcn42b/dcn42b_init.h  |   14 +
 .../dc/resource/dcn42b/dcn42b_resource.c      | 2404 +++++++++++++++++
 .../dc/resource/dcn42b/dcn42b_resource.h      |  672 +++++
 12 files changed, 4423 insertions(+)
 create mode 100644 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn42b/dcn42b_clk_mgr.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn42b/dcn42b_clk_mgr.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/gpio/dcn42b/hw_factory_dcn42b.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/gpio/dcn42b/hw_factory_dcn42b.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/gpio/dcn42b/hw_translate_dcn42b.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/gpio/dcn42b/hw_translate_dcn42b.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/hwss/dcn42b/dcn42b_hwseq.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/hwss/dcn42b/dcn42b_hwseq.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/hwss/dcn42b/dcn42b_init.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/hwss/dcn42b/dcn42b_init.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.h
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn42b/dcn42b_clk_mgr.c new file +483 -0
new file mode 100644
index 000000000000..4be5abdc60ea
@@ -0,0 +1,483 @@
+/*
+ * SPDX-License-Identifier: MIT
+ *
+ * Copyright 2026 Advanced Micro Devices, Inc.
+ */
+
+#include "dcn42b_clk_mgr.h"
+
+#include "dccg.h"
+#include "clk_mgr_internal.h"
+
+// For dce12_get_dp_ref_freq_khz
+#include "dce100/dce_clk_mgr.h"
+
+// For dcn20_update_clocks_update_dpp_dto
+#include "dcn20/dcn20_clk_mgr.h"
+
+#include "reg_helper.h"
+#include "core_types.h"
+#include "dcn42/dcn42_smu.h"
+#include "dcn42/dcn42_clk_mgr.h"
+#include "dm_helpers.h"
+
+/* TODO: remove this include once we ported over remaining clk mgr functions*/
+#include "dcn30/dcn30_clk_mgr.h"
+#include "dcn31/dcn31_clk_mgr.h"
+#include "dcn35/dcn35_clk_mgr.h"
+
+#include "dc_dmub_srv.h"
+#include "link_service.h"
+#include "logger_types.h"
+
+#include "clk/clk_15_0_5_offset.h"
+#include "clk/clk_15_0_5_sh_mask.h"
+#include "dcn/dcn_4_2_1_offset.h"
+#include "dcn/dcn_4_2_1_sh_mask.h"
+
+#define DCN_BASE__INST0_SEG0                       0x00000012
+#define DCN_BASE__INST0_SEG1                       0x000000C0
+
+
+#undef DC_LOGGER
+#define DC_LOGGER \
+	dc_logger
+#define DC_LOGGER_INIT(logger) \
+	struct dal_logger *dc_logger = logger
+
+
+#define mmCLK5_CLK_TICK_CNT_CONFIG_REG                  0x1B229
+#define mmCLK5_CLK0_CURRENT_CNT                         0x1B22B //DISPCLK
+#define mmCLK5_CLK1_CURRENT_CNT                         0x1B22C //DPPCLK
+#define mmCLK5_CLK2_CURRENT_CNT                         0x1B22D //DPREFCLK
+#define mmCLK5_CLK3_CURRENT_CNT                         0x1B22E //DCFCLK
+
+#define mmCLK5_CLK0_DS_CNTL                             0x1B204
+#define mmCLK5_CLK1_DS_CNTL                             0x1B20C
+#define mmCLK5_CLK2_DS_CNTL                             0x1B214
+#define mmCLK5_CLK3_DS_CNTL                             0x1B21C
+
+#define mmCLK5_CLK0_BYPASS_CNTL                         0x1B20A
+#define mmCLK5_CLK1_BYPASS_CNTL                         0x1B212
+#define mmCLK5_CLK2_BYPASS_CNTL                         0x1B21A
+#define mmCLK5_CLK3_BYPASS_CNTL                         0x1B222
+
+#undef FN
+#define FN(reg_name, field_name) \
+	clk_mgr->clk_mgr_shift->field_name, clk_mgr->clk_mgr_mask->field_name
+
+#define REG(reg) \
+	(clk_mgr->regs->reg)
+
+#define BASE_INNER(seg) DCN_BASE__INST0_SEG ## seg
+
+#define BASE(seg) BASE_INNER(seg)
+
+#define SR(reg_name)\
+		.reg_name = BASE(reg ## reg_name ## _BASE_IDX) +  \
+					reg ## reg_name
+
+#define CLK_SR_DCN42B(reg_name)\
+	.reg_name = mm ## reg_name
+
+static const struct clk_mgr_registers clk_mgr_regs_dcn42b = {
+	CLK_REG_LIST_DCN42B()
+};
+
+static const struct clk_mgr_shift clk_mgr_shift_dcn42b = {
+	CLK_COMMON_MASK_SH_LIST_DCN42B(__SHIFT)
+};
+
+static const struct clk_mgr_mask clk_mgr_mask_dcn42b = {
+	CLK_COMMON_MASK_SH_LIST_DCN42B(_MASK)
+};
+
+
+
+#define TO_CLK_MGR_DCN42B(clk_mgr_int)\
+	container_of(clk_mgr_int, struct clk_mgr_dcn42, base)
+
+static void dcn42b_dump_clk_registers_internal(struct dcn42b_clk_internal *internal, struct clk_mgr *clk_mgr_base)
+{
+	struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base);
+
+	REG_GET(CLK5_CLK_TICK_CNT_CONFIG_REG, TIMER_THRESHOLD, &internal->CLK5_CLK_TICK_CNT__TIMER_THRESHOLD);
+
+	// read dcf deep sleep divider
+	internal->CLK5_CLK0_DS_CNTL = REG_READ(CLK5_CLK0_DS_CNTL);
+	internal->CLK5_CLK3_DS_CNTL = REG_READ(CLK5_CLK3_DS_CNTL);
+	// read dispclk
+	internal->CLK5_CLK0_CURRENT_CNT = dcn42b_get_clock_freq_from_clkip(clk_mgr_base, clock_type_dispclk);
+	internal->CLK5_CLK0_BYPASS_CNTL = REG_READ(CLK5_CLK0_BYPASS_CNTL);
+	// read dppclk
+	internal->CLK5_CLK1_CURRENT_CNT = dcn42b_get_clock_freq_from_clkip(clk_mgr_base, clock_type_dppclk);
+	internal->CLK5_CLK1_BYPASS_CNTL = REG_READ(CLK5_CLK1_BYPASS_CNTL);
+	// read dprefclk
+	internal->CLK5_CLK2_CURRENT_CNT = dcn42b_get_clock_freq_from_clkip(clk_mgr_base, clock_type_dprefclk);
+	internal->CLK5_CLK2_BYPASS_CNTL = REG_READ(CLK5_CLK2_BYPASS_CNTL);
+	// read dcfclk
+	internal->CLK5_CLK3_CURRENT_CNT = dcn42b_get_clock_freq_from_clkip(clk_mgr_base, clock_type_dcfclk);
+	internal->CLK5_CLK3_BYPASS_CNTL = REG_READ(CLK5_CLK3_BYPASS_CNTL);
+	/* read dtbclk - DTBCLK tied off in DCN42B
+	* internal->CLK5_CLK4_CURRENT_CNT = REG_READ(CLK5_CLK4_CURRENT_CNT) / ratio;
+	* internal->CLK5_CLK4_BYPASS_CNTL = REG_READ(CLK5_CLK4_BYPASS_CNTL);
+	*/
+}
+
+static void dcn42b_dump_clk_registers(struct clk_state_registers_and_bypass *regs_and_bypass,
+		struct clk_mgr_dcn42 *clk_mgr)
+{
+	struct dcn42b_clk_internal internal = {0};
+	char *bypass_clks[5] = {"0x0 DFS", "0x1 REFCLK", "0x2 ERROR", "0x3 400 FCH", "0x4 600 FCH"};
+
+	DC_LOGGER_INIT(clk_mgr->base.base.ctx->logger);
+	(void)dc_logger;
+
+	dcn42b_dump_clk_registers_internal(&internal, &clk_mgr->base.base);
+	regs_and_bypass->timer_threshold = internal.CLK5_CLK_TICK_CNT__TIMER_THRESHOLD;
+	regs_and_bypass->dcfclk = internal.CLK5_CLK3_CURRENT_CNT / 10;
+	regs_and_bypass->dcf_deep_sleep_divider = internal.CLK5_CLK3_DS_CNTL / 10;
+	regs_and_bypass->dcf_deep_sleep_allow = internal.CLK5_CLK3_DS_CNTL & 0x10; /*bit 4: CLK0_ALLOW_DS*/
+	regs_and_bypass->dprefclk = internal.CLK5_CLK2_CURRENT_CNT / 10;
+	regs_and_bypass->dispclk = internal.CLK5_CLK0_CURRENT_CNT / 10;
+	regs_and_bypass->dppclk = internal.CLK5_CLK1_CURRENT_CNT / 10;
+	/* regs_and_bypass->dtbclk = internal.CLK5_CLK4_CURRENT_CNT / 10; */ /* DTBCLK tied off in DCN42B */
+
+	regs_and_bypass->dispclk_bypass = get_reg_field_value(internal.CLK5_CLK0_BYPASS_CNTL, CLK5_CLK0_BYPASS_CNTL, CLK0_BYPASS_SEL);
+	regs_and_bypass->dppclk_bypass = get_reg_field_value(internal.CLK5_CLK1_BYPASS_CNTL, CLK5_CLK1_BYPASS_CNTL, CLK1_BYPASS_SEL);
+	regs_and_bypass->dprefclk_bypass = get_reg_field_value(internal.CLK5_CLK2_BYPASS_CNTL, CLK5_CLK2_BYPASS_CNTL, CLK2_BYPASS_SEL);
+	regs_and_bypass->dcfclk_bypass = get_reg_field_value(internal.CLK5_CLK3_BYPASS_CNTL, CLK5_CLK3_BYPASS_CNTL, CLK3_BYPASS_SEL);
+
+	if (clk_mgr->base.base.ctx->dc->debug.pstate_enabled) {
+		DC_LOG_SMU("clk_type,clk_value,deepsleep_cntl,deepsleep_allow,bypass\n");
+
+		DC_LOG_SMU("dcfclk,%d,%d,%d,%s\n",
+				   regs_and_bypass->dcfclk,
+				   regs_and_bypass->dcf_deep_sleep_divider,
+				   regs_and_bypass->dcf_deep_sleep_allow,
+				   bypass_clks[(int) regs_and_bypass->dcfclk_bypass]);
+
+		DC_LOG_SMU("dprefclk,%d,N/A,N/A,%s\n",
+			regs_and_bypass->dprefclk,
+			bypass_clks[(int) regs_and_bypass->dprefclk_bypass]);
+
+		DC_LOG_SMU("dispclk,%d,N/A,N/A,%s\n",
+			regs_and_bypass->dispclk,
+			bypass_clks[(int) regs_and_bypass->dispclk_bypass]);
+
+		//split
+		DC_LOG_SMU("SPLIT\n");
+
+		// REGISTER VALUES
+		DC_LOG_SMU("reg_name,value,clk_type\n");
+
+		DC_LOG_SMU("CLK5_CLK3_CURRENT_CNT,%d,dcfclk\n",
+				internal.CLK5_CLK3_CURRENT_CNT);
+
+		DC_LOG_SMU("CLK5_CLK3_DS_CNTL,%d,dcf_deep_sleep_divider\n",
+					internal.CLK5_CLK3_DS_CNTL);
+
+		DC_LOG_SMU("CLK5_CLK3_ALLOW_DS,%d,dcf_deep_sleep_allow\n",
+					(internal.CLK5_CLK3_DS_CNTL & 0x10));
+
+		DC_LOG_SMU("CLK5_CLK2_CURRENT_CNT,%d,dprefclk\n",
+					internal.CLK5_CLK2_CURRENT_CNT);
+
+		DC_LOG_SMU("CLK5_CLK0_CURRENT_CNT,%d,dispclk\n",
+					internal.CLK5_CLK0_CURRENT_CNT);
+
+		DC_LOG_SMU("CLK5_CLK1_CURRENT_CNT,%d,dppclk\n",
+					internal.CLK5_CLK1_CURRENT_CNT);
+
+		DC_LOG_SMU("CLK5_CLK3_BYPASS_CNTL,%d,dcfclk_bypass\n",
+					internal.CLK5_CLK3_BYPASS_CNTL);
+
+		DC_LOG_SMU("CLK5_CLK2_BYPASS_CNTL,%d,dprefclk_bypass\n",
+					internal.CLK5_CLK2_BYPASS_CNTL);
+
+		DC_LOG_SMU("CLK5_CLK0_BYPASS_CNTL,%d,dispclk_bypass\n",
+					internal.CLK5_CLK0_BYPASS_CNTL);
+
+		DC_LOG_SMU("CLK5_CLK1_BYPASS_CNTL,%d,dppclk_bypass\n",
+					internal.CLK5_CLK1_BYPASS_CNTL);
+	}
+}
+
+static void init_clk_states(struct clk_mgr *clk_mgr)
+{
+	/*
+	 * DTBCLK is tied off in DCN42B - no save/restore needed
+	 * uint32_t ref_dtbclk = clk_mgr->clks.ref_dtbclk_khz;
+	 */
+
+	memset(&(clk_mgr->clks), 0, sizeof(struct dc_clocks));
+	clk_mgr->clks.dtbclk_en = false; /* DTBCLK tied off in DCN42B */
+
+
+	clk_mgr->clks.ref_dtbclk_khz = 0;
+	clk_mgr->clks.p_state_change_support = true;
+	clk_mgr->clks.prev_p_state_change_support = true;
+	clk_mgr->clks.pwr_state = DCN_PWR_STATE_UNKNOWN;
+	clk_mgr->clks.zstate_support = DCN_ZSTATE_SUPPORT_UNKNOWN;
+}
+
+/* dcn42b_get_dpm_table_from_smu removed: reuse dcn42_get_dpm_table_from_smu.
+ * Function is identical - only uses SMU calls, no hardware register differences.
+ */
+
+void dcn42b_init_clocks(struct clk_mgr *clk_mgr_base)
+{
+	struct clk_mgr_internal *clk_mgr_int = TO_CLK_MGR_INTERNAL(clk_mgr_base);
+	struct clk_mgr_dcn42 *clk_mgr = TO_CLK_MGR_DCN42B(clk_mgr_int);
+
+	DC_LOGGER_INIT(clk_mgr_base->ctx->logger);
+	(void)dc_logger;
+
+	init_clk_states(clk_mgr_base);
+
+	// to adjust dp_dto reference clock if ssc is enable otherwise to apply dprefclk
+	if (dcn42_is_spll_ssc_enabled(clk_mgr_base))
+		clk_mgr_base->dp_dto_source_clock_in_khz =
+			dce_adjust_dp_ref_freq_for_ss(clk_mgr_int, clk_mgr_base->dprefclk_khz);
+	else
+		clk_mgr_base->dp_dto_source_clock_in_khz = clk_mgr_base->dprefclk_khz;
+
+	DC_LOG_SMU("dp_dto_source_clock %d, dprefclk %d\n", clk_mgr_base->dp_dto_source_clock_in_khz, clk_mgr_base->dprefclk_khz);
+	dcn42b_dump_clk_registers(&clk_mgr_base->boot_snapshot, clk_mgr);
+}
+
+static struct clk_bw_params dcn42b_bw_params = {
+	.vram_type = Ddr4MemType,
+	.num_channels = 1,
+	.clk_table = {
+		.num_entries = 4,
+	},
+
+};
+
+static struct wm_table ddr5_wm_table = {
+	.entries = {
+		{
+			.wm_inst = WM_A,
+			.wm_type = WM_TYPE_PSTATE_CHG,
+			.pstate_latency_us = 11.72,
+			.sr_exit_time_us = 28.0,
+			.sr_enter_plus_exit_time_us = 30.0,
+			.valid = true,
+		},
+		{
+			.wm_inst = WM_B,
+			.wm_type = WM_TYPE_PSTATE_CHG,
+			.pstate_latency_us = 11.72,
+			.sr_exit_time_us = 28.0,
+			.sr_enter_plus_exit_time_us = 30.0,
+			.valid = true,
+		},
+		{
+			.wm_inst = WM_C,
+			.wm_type = WM_TYPE_PSTATE_CHG,
+			.pstate_latency_us = 11.72,
+			.sr_exit_time_us = 28.0,
+			.sr_enter_plus_exit_time_us = 30.0,
+			.valid = true,
+		},
+		{
+			.wm_inst = WM_D,
+			.wm_type = WM_TYPE_PSTATE_CHG,
+			.pstate_latency_us = 11.72,
+			.sr_exit_time_us = 28.0,
+			.sr_enter_plus_exit_time_us = 30.0,
+			.valid = true,
+		},
+	}
+};
+
+static struct wm_table lpddr5_wm_table = {
+	.entries = {
+		{
+			.wm_inst = WM_A,
+			.wm_type = WM_TYPE_PSTATE_CHG,
+			.pstate_latency_us = 11.65333,
+			.sr_exit_time_us = 28.0,
+			.sr_enter_plus_exit_time_us = 30.0,
+			.valid = true,
+		},
+		{
+			.wm_inst = WM_B,
+			.wm_type = WM_TYPE_PSTATE_CHG,
+			.pstate_latency_us = 11.65333,
+			.sr_exit_time_us = 28.0,
+			.sr_enter_plus_exit_time_us = 30.0,
+			.valid = true,
+		},
+		{
+			.wm_inst = WM_C,
+			.wm_type = WM_TYPE_PSTATE_CHG,
+			.pstate_latency_us = 11.65333,
+			.sr_exit_time_us = 28.0,
+			.sr_enter_plus_exit_time_us = 30.0,
+			.valid = true,
+		},
+		{
+			.wm_inst = WM_D,
+			.wm_type = WM_TYPE_PSTATE_CHG,
+			.pstate_latency_us = 11.65333,
+			.sr_exit_time_us = 28.0,
+			.sr_enter_plus_exit_time_us = 30.0,
+			.valid = true,
+		},
+	}
+};
+
+
+static void dcn42b_read_ss_info_from_lut(struct clk_mgr_internal *clk_mgr)
+{
+	uint32_t clock_source;
+
+	clock_source = (REG_READ(CLK5_CLK2_BYPASS_CNTL) & CLK5_CLK2_BYPASS_CNTL__CLK2_BYPASS_SEL_MASK);
+	// If it's DFS mode, clock_source is 0.
+	if (dcn42_is_spll_ssc_enabled(&clk_mgr->base) && (clock_source < ARRAY_SIZE(dcn42_ss_info_table.ss_percentage))) {
+		clk_mgr->dprefclk_ss_percentage = dcn42_ss_info_table.ss_percentage[clock_source];
+
+		if (clk_mgr->dprefclk_ss_percentage != 0) {
+			clk_mgr->ss_on_dprefclk = true;
+			clk_mgr->dprefclk_ss_divider = dcn42_ss_info_table.ss_divider;
+		}
+	}
+}
+
+uint32_t dcn42b_get_clock_freq_from_clkip(struct clk_mgr *clk_mgr_base, enum clock_type clock)
+{
+	struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base);
+	uint64_t clock_freq_mhz = 0;
+	uint32_t timer_threshold = 0;
+
+	// always safer to read the timer threshold instead of using cached value
+	REG_GET(CLK5_CLK_TICK_CNT_CONFIG_REG, TIMER_THRESHOLD, &timer_threshold);
+
+	if (timer_threshold == 0) {
+		BREAK_TO_DEBUGGER();
+		return 0;
+	}
+
+	switch (clock) {
+	case clock_type_dispclk:
+		clock_freq_mhz = REG_READ(CLK5_CLK0_CURRENT_CNT);
+		break;
+	case clock_type_dppclk:
+		clock_freq_mhz = REG_READ(CLK5_CLK1_CURRENT_CNT);
+		break;
+	case clock_type_dprefclk:
+		clock_freq_mhz = REG_READ(CLK5_CLK2_CURRENT_CNT);
+		break;
+	case clock_type_dcfclk:
+		clock_freq_mhz = REG_READ(CLK5_CLK3_CURRENT_CNT);
+		break;
+	case clock_type_dtbclk:
+		/* DTBCLK tied off in DCN42B - CLK5_CLK4 register doesn't exist.
+		 * Should never be called since dtbclk_en is always false.
+		 */
+		ASSERT(false);
+		clock_freq_mhz = 0;
+		break;
+	default:
+		break;
+	}
+
+	clock_freq_mhz *= DCN42_CLKIP_REFCLK;
+	clock_freq_mhz = div_u64(clock_freq_mhz, timer_threshold);
+
+	// there are no DCN clocks over 0xFFFFFFFF MHz
+	ASSERT(clock_freq_mhz <= 0xFFFFFFFF);
+
+	return (uint32_t)clock_freq_mhz;
+}
+
+/* dcn42b_get_dispclk_from_dentist removed: reuse dcn42_get_dispclk_from_dentist.
+ * DENTIST_DISPCLK_CNTL is a DCN register with the same offset on both dcn42 and dcn42b.
+ */
+
+static struct clk_mgr_funcs dcn42b_funcs = {
+	.get_dp_ref_clk_frequency = dce12_get_dp_ref_freq_khz,
+	.get_dtb_ref_clk_frequency = dcn31_get_dtb_ref_freq_khz,
+	.update_clocks = dcn42_update_clocks,
+	.init_clocks = dcn42b_init_clocks,
+	.enable_pme_wa = dcn42_enable_pme_wa,
+	.are_clock_states_equal = dcn42_are_clock_states_equal,
+	.notify_wm_ranges = NULL,
+	.set_low_power_state = dcn42_set_low_power_state,
+	.exit_low_power_state = dcn42_exit_low_power_state,
+	.get_max_clock_khz = dcn42_get_max_clock_khz,
+	.get_dispclk_from_dentist = dcn42_get_dispclk_from_dentist,
+	.is_smu_present = dcn42_is_smu_present,
+};
+
+void dcn42b_clk_mgr_construct(
+		struct dc_context *ctx,
+		struct clk_mgr_dcn42 *clk_mgr,
+		struct pp_smu_funcs *pp_smu,
+		struct dccg *dccg)
+{
+	clk_mgr->base.base.ctx = ctx;
+	clk_mgr->base.base.funcs = &dcn42b_funcs;
+	clk_mgr->base.regs = &clk_mgr_regs_dcn42b;
+	clk_mgr->base.clk_mgr_shift = &clk_mgr_shift_dcn42b;
+	clk_mgr->base.clk_mgr_mask = &clk_mgr_mask_dcn42b;
+
+	clk_mgr->base.pp_smu = pp_smu;
+
+	clk_mgr->base.dccg = dccg;
+	clk_mgr->base.dfs_bypass_disp_clk = 0;
+
+	clk_mgr->base.dprefclk_ss_percentage = 0;
+	clk_mgr->base.dprefclk_ss_divider = 1000;
+	clk_mgr->base.ss_on_dprefclk = false;
+	clk_mgr->base.dfs_ref_freq_khz = 48000; /*sync with pmfw*/
+	clk_mgr->base.base.clks.ref_dtbclk_khz = 0;
+
+	/* Changed from DCN3.2_clock_frequency doc to match
+	 * dcn32_dump_clk_registers from 4 * dentist_vco_freq_khz /
+	 * dprefclk DID divider
+	 */
+	clk_mgr->base.base.dprefclk_khz = 600000;
+
+		clk_mgr->base.smu_present = false;
+		clk_mgr->base.smu_ver = dcn42_smu_get_pmfw_version(&clk_mgr->base);
+		if (clk_mgr->base.smu_ver && clk_mgr->base.smu_ver != -1)
+			clk_mgr->base.smu_present = true;
+
+		if (ctx->dc_bios->integrated_info) {
+			clk_mgr->base.base.dentist_vco_freq_khz = ctx->dc_bios->integrated_info->dentist_vco_freq;
+
+			if (ctx->dc_bios->integrated_info->memory_type == LpDdr5MemType)
+				dcn42b_bw_params.wm_table = lpddr5_wm_table;
+			else
+				dcn42b_bw_params.wm_table = ddr5_wm_table;
+			dcn42b_bw_params.vram_type = ctx->dc_bios->integrated_info->memory_type;
+			dcn42b_bw_params.dram_channel_width_bytes = ctx->dc_bios->integrated_info->memory_type == 0x22 ? 8 : 4;
+			dcn42b_bw_params.num_channels = ctx->dc_bios->integrated_info->ma_channel_number ? ctx->dc_bios->integrated_info->ma_channel_number : 2;
+			if (clk_mgr->base.smu_present)
+				clk_mgr->base.base.dprefclk_khz = dcn42_smu_get_dprefclk(&clk_mgr->base);
+
+		}
+		/* in case we don't get a value from the BIOS, use default */
+		if (clk_mgr->base.base.dentist_vco_freq_khz == 0)
+			clk_mgr->base.base.dentist_vco_freq_khz = 3000000; /* 3000MHz */
+
+		/* Saved clocks configured at boot for debug purposes */
+		dcn42b_dump_clk_registers(&clk_mgr->base.base.boot_snapshot, clk_mgr);
+
+	dce_clock_read_ss_info(&clk_mgr->base);
+	/*when clk src is from FCH, it could have ss, same clock src as DPREF clk*/
+
+	dcn42b_read_ss_info_from_lut(&clk_mgr->base);
+
+	clk_mgr->base.base.bw_params = &dcn42b_bw_params;
+	if (clk_mgr->base.smu_present) {
+		dcn42_get_smu_clocks(&clk_mgr->base);
+		//overwrite values from dcn42_get_smu_clocks since dtbclk is tied off in DCN42B
+		clk_mgr->base.base.bw_params->clk_table.entries[0].dtbclk_mhz = 0;
+		clk_mgr->base.base.bw_params->clk_table.num_entries_per_clk.num_dtbclk_levels = 0;
+		clk_mgr->base.base.clks.ref_dtbclk_khz = 0;
+	}
+}
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn42b/dcn42b_clk_mgr.h new file +48 -0

48 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/gpio/dcn42b/hw_factory_dcn42b.c new file +313 -0

313 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/gpio/dcn42b/hw_factory_dcn42b.h new file +11 -0
new file mode 100644
index 000000000000..088798ac95a3
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: MIT
+//
+// Copyright 2026 Advanced Micro Devices, Inc.
+
+#ifndef __DAL_HW_FACTORY_DCN42B_H__
+#define __DAL_HW_FACTORY_DCN42B_H__
+
+/* Initialize HW factory function pointers and pin info */
+void dal_hw_factory_dcn42b_init(struct hw_factory *factory);
+
+#endif /* __DAL_HW_FACTORY_DCN42B_H__ */
drivers/gpu/drm/amd/display/dc/gpio/dcn42b/hw_translate_dcn42b.c new file +192 -0

192 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/gpio/dcn42b/hw_translate_dcn42b.h new file +13 -0
new file mode 100644
index 000000000000..7a782f353eae
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: MIT
+//
+// Copyright 2026 Advanced Micro Devices, Inc.
+
+#ifndef __DAL_HW_TRANSLATE_DCN42B_H__
+#define __DAL_HW_TRANSLATE_DCN42B_H__
+
+struct hw_translate;
+
+/* Initialize Hw translate function pointers */
+void dal_hw_translate_dcn42b_init(struct hw_translate *tr);
+
+#endif /* __DAL_HW_TRANSLATE_DCN42B_H__ */
drivers/gpu/drm/amd/display/dc/hwss/dcn42b/dcn42b_hwseq.c new file +238 -0

238 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/hwss/dcn42b/dcn42b_hwseq.h new file +15 -0
new file mode 100644
index 000000000000..ab1ac6fc720a
@@ -0,0 +1,15 @@
+/*
+ * SPDX-License-Identifier: MIT
+ *
+ * Copyright 2026 Advanced Micro Devices, Inc.
+ */
+
+#ifndef __DC_HWSS_DCN42B_H__
+#define __DC_HWSS_DCN42B_H__
+
+#include "dc.h"
+#include "hw_sequencer_private.h"
+
+void dcn42b_init_pipes(struct dc *dc, struct dc_state *context);
+
+#endif /* __DC_HWSS_DCN42B_H__ */
drivers/gpu/drm/amd/display/dc/hwss/dcn42b/dcn42b_init.c new file +20 -0
new file mode 100644
index 000000000000..4210dc7a8eb4
@@ -0,0 +1,20 @@
+/*
+ * SPDX-License-Identifier: MIT
+ *
+ * Copyright 2026 Advanced Micro Devices, Inc.
+ */
+
+#include "dcn20/dcn20_hwseq.h"
+#include "dcn42/dcn42_init.h"
+#include "dcn42b_hwseq.h"
+#include "dcn42b_init.h"
+
+void dcn42b_hw_sequencer_init_functions(struct dc *dc)
+{
+	/* Initialize with dcn42 functions first */
+	dcn42_hw_sequencer_init_functions(dc);
+
+	/* Override only init_pipes with dcn42b version */
+	dc->hwseq->funcs.init_pipes = dcn42b_init_pipes;
+
+}
drivers/gpu/drm/amd/display/dc/hwss/dcn42b/dcn42b_init.h new file +14 -0
new file mode 100644
index 000000000000..af1d6ff953f5
@@ -0,0 +1,14 @@
+/*
+ * SPDX-License-Identifier: MIT
+ *
+ * Copyright 2026 Advanced Micro Devices, Inc.
+ */
+
+#ifndef __DC_DCN42B_INIT_H__
+#define __DC_DCN42B_INIT_H__
+
+struct dc;
+
+void dcn42b_hw_sequencer_init_functions(struct dc *dc);
+
+#endif /* __DC_DCN42B_INIT_H__ */
drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c new file +2404 -0

1,653 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.h new file +672 -0

672 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.43.0

Part of the diff is not shown here. View the raw message.

author
#34 lore raw

PATCH 35/41 drm/amd/display: Add dcn42b_soc_bb to DML2

In reply to Ray Wu

From: Matthew Stewart <[email protected]>

[Why & How]
Add bounding box for dcn42b

---
 .../dml21/inc/bounding_boxes/dcn42b_soc_bb.h  | 227 ++++++++++++++++++
 1 file changed, 227 insertions(+)
 create mode 100644 drivers/gpu/drm/amd/display/dc/dml2_0/dml21/inc/bounding_boxes/dcn42b_soc_bb.h
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/inc/bounding_boxes/dcn42b_soc_bb.h new file +227 -0
new file mode 100644
index 000000000000..ce4025591b87
@@ -0,0 +1,227 @@
+// SPDX-License-Identifier: MIT
+//
+// Copyright 2026 Advanced Micro Devices, Inc.
+
+#ifndef __DML_DML_DCN42B_SOC_BB__
+#define __DML_DML_DCN42B_SOC_BB__
+
+#include "dml_top_soc_parameter_types.h"
+
+/* DCN42B Bounding Box values */
+static const struct dml2_soc_qos_parameters dml_dcn42b_variant_a_soc_qos_params = {
+	.derate_table = {
+		.system_active_urgent = {
+			.dram_derate_percent_pixel = 65,
+			.dram_derate_percent_vm = 30,
+			.dram_derate_percent_pixel_and_vm = 60,
+			.fclk_derate_percent = 80,
+			.dcfclk_derate_percent = 80,
+		},
+		.system_active_average = {
+			.dram_derate_percent_pixel = 30,
+			.dram_derate_percent_vm = 30,
+			.dram_derate_percent_pixel_and_vm = 30,
+			.fclk_derate_percent = 60,
+			.dcfclk_derate_percent = 60,
+		},
+		.dcn_mall_prefetch_urgent = {
+			.dram_derate_percent_pixel = 65,
+			.dram_derate_percent_vm = 30,
+			.dram_derate_percent_pixel_and_vm = 60,
+			.fclk_derate_percent = 80,
+			.dcfclk_derate_percent = 80,
+		},
+		.dcn_mall_prefetch_average = {
+			.dram_derate_percent_pixel = 30,
+			.dram_derate_percent_vm = 30,
+			.dram_derate_percent_pixel_and_vm = 30,
+			.fclk_derate_percent = 60,
+			.dcfclk_derate_percent = 60,
+		},
+		.system_idle_average = {
+			.dram_derate_percent_pixel = 30,
+			.dram_derate_percent_vm = 30,
+			.dram_derate_percent_pixel_and_vm = 30,
+			.fclk_derate_percent = 60,
+			.dcfclk_derate_percent = 60,
+		},
+	},
+	.writeback = {
+		.base_latency_us = 12,
+		.scaling_factor_us = 0,
+		.scaling_factor_mhz = 0,
+	},
+	.qos_params = {
+		.dcn32x = {
+			.loaded_round_trip_latency_fclk_cycles = 106,
+			.urgent_latency_us = {
+				.base_latency_us = 4,
+				.base_latency_pixel_vm_us = 4,
+				.base_latency_vm_us = 4,
+				.scaling_factor_fclk_us = 0,
+				.scaling_factor_mhz = 0,
+			},
+			.urgent_out_of_order_return_per_channel_pixel_and_vm_bytes = 4096,
+			.urgent_out_of_order_return_per_channel_pixel_only_bytes = 4096,
+			.urgent_out_of_order_return_per_channel_vm_only_bytes = 4096,
+		},
+	},
+	.qos_type = dml2_qos_param_type_dcn3,
+};
+
+static const struct dml2_soc_bb dml2_socbb_dcn42b = {
+	.clk_table = {
+		.wck_ratio = {
+				.clk_values_khz = {2},
+		},
+		.uclk = {
+				.clk_values_khz = {400000},
+				.num_clk_values = 1,
+		},
+		.fclk = {
+				.clk_values_khz = {1600000},
+				.num_clk_values = 1,
+		},
+		.dcfclk = {
+				.clk_values_khz = {800000},
+				.num_clk_values = 1,
+		},
+		.dispclk = {
+				.clk_values_khz = {1200000},
+				.num_clk_values = 1,
+		},
+		.dppclk = {
+				.clk_values_khz = {1200000},
+				.num_clk_values = 1,
+		},
+		.dtbclk = {
+				.clk_values_khz = {0},
+				.num_clk_values = 0,
+		},
+		.phyclk = {
+				.clk_values_khz = {810000},
+				.num_clk_values = 1,
+		},
+		.socclk = {
+				.clk_values_khz = {1600000},
+				.num_clk_values = 1,
+		},
+		.dscclk = {
+				.clk_values_khz = {400000},
+				.num_clk_values = 1,
+		},
+		.phyclk_d18 = {
+				.clk_values_khz = {667000},
+				.num_clk_values = 1,
+		},
+		.phyclk_d32 = {
+				.clk_values_khz = {625000},
+				.num_clk_values = 1,
+		},
+		.dram_config = {
+			.channel_width_bytes = 4,
+			.channel_count = 4,
+			.alt_clock_bw_conversion = true,
+		},
+	},
+
+	.qos_parameters = {
+		.derate_table = {
+			.system_active_urgent = {
+				.dram_derate_percent_pixel = 65,
+				.dram_derate_percent_vm = 30,
+				.dram_derate_percent_pixel_and_vm = 60,
+				.fclk_derate_percent = 80,
+				.dcfclk_derate_percent = 80,
+			},
+			.system_active_average = {
+				.dram_derate_percent_pixel = 30,
+				.dram_derate_percent_vm = 30,
+				.dram_derate_percent_pixel_and_vm = 30,
+				.fclk_derate_percent = 60,
+				.dcfclk_derate_percent = 60,
+			},
+			.dcn_mall_prefetch_urgent = {
+				.dram_derate_percent_pixel = 65,
+				.dram_derate_percent_vm = 30,
+				.dram_derate_percent_pixel_and_vm = 60,
+				.fclk_derate_percent = 80,
+				.dcfclk_derate_percent = 80,
+			},
+			.dcn_mall_prefetch_average = {
+				.dram_derate_percent_pixel = 30,
+				.dram_derate_percent_vm = 30,
+				.dram_derate_percent_pixel_and_vm = 30,
+				.fclk_derate_percent = 60,
+				.dcfclk_derate_percent = 60,
+			},
+			.system_idle_average = {
+				.dram_derate_percent_pixel = 30,
+				.dram_derate_percent_vm = 30,
+				.dram_derate_percent_pixel_and_vm = 30,
+				.fclk_derate_percent = 60,
+				.dcfclk_derate_percent = 60,
+			},
+		},
+		.writeback = {
+			.base_latency_us = 12,
+			.scaling_factor_us = 0,
+			.scaling_factor_mhz = 0,
+		},
+		.qos_params = {
+			.dcn32x = {
+				.loaded_round_trip_latency_fclk_cycles = 106,
+				.urgent_latency_us = {
+					.base_latency_us = 4,
+					.base_latency_pixel_vm_us = 4,
+					.base_latency_vm_us = 4,
+					.scaling_factor_fclk_us = 0,
+					.scaling_factor_mhz = 0,
+				},
+				.urgent_out_of_order_return_per_channel_pixel_and_vm_bytes = 4096,
+				.urgent_out_of_order_return_per_channel_pixel_only_bytes = 4096,
+				.urgent_out_of_order_return_per_channel_vm_only_bytes = 4096,
+			},
+		},
+		.qos_type = dml2_qos_param_type_dcn3,
+	},
+
+	/* Reuse of DCN42 params for LPDDR5/LPCAMM2 */
+	.power_management_parameters = {
+		.dram_clk_change_blackout_us = 36,
+		.fclk_change_blackout_us = 0,
+		.g7_ppt_blackout_us = 0,
+		.stutter_enter_plus_exit_latency_us = 14,
+		.stutter_exit_latency_us = 12,
+		.z8_stutter_enter_plus_exit_latency_us = 300,
+		.z8_stutter_exit_latency_us = 200,
+	},
+
+	.vmin_limit = {
+		.dispclk_khz = 632 * 1000,
+	},
+
+	.dprefclk_mhz = 600,
+	.xtalclk_mhz = 24,
+	.pcie_refclk_mhz = 100,
+	.dchub_refclk_mhz = 50,
+	.mall_allocated_for_dcn_mbytes = 64,
+	.max_outstanding_reqs = 256,
+	.fabric_datapath_to_dcn_data_return_bytes = 32,
+	.return_bus_width_bytes = 64,
+	.hostvm_min_page_size_kbytes = 4,
+	.gpuvm_min_page_size_kbytes = 256,
+	.gpuvm_max_page_table_levels = 1,
+	.hostvm_max_non_cached_page_table_levels = 2,
+	.phy_downspread_percent = 0.38,
+	.dcn_downspread_percent = 0.38,
+	.dispclk_dppclk_vco_speed_mhz = 3000,
+	.do_urgent_latency_adjustment = 0,
+	.mem_word_bytes = 0,
+	.num_dcc_mcaches = 0,
+	.mcache_size_bytes = 0,
+	.mcache_line_size_bytes = 0,
+	.max_fclk_for_uclk_dpm_khz = 2200 * 1000,
+};
+
+#endif
Signature · 1 line
2.43.0
author
#35 lore raw

PATCH 36/41 drm/amd/display: Add DCN42B code to DC

In reply to Ray Wu

From: Matthew Stewart <[email protected]>

[Why & How]
Add DCN42B code to DC

---
 .../display/dc/bios/command_table_helper2.c   |   1 +
 .../gpu/drm/amd/display/dc/clk_mgr/Makefile   |  10 +
 .../gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c  |  15 ++
 .../gpu/drm/amd/display/dc/core/dc_resource.c |   6 +
 drivers/gpu/drm/amd/display/dc/dc_helper.c    |   2 +
 .../gpu/drm/amd/display/dc/dc_spl_translate.c |   1 +
 .../gpu/drm/amd/display/dc/dcn31/dcn31_apg.h  |  13 ++
 .../dc/dio/dcn42/dcn42_dio_link_encoder.h     |  95 +++++++++
 drivers/gpu/drm/amd/display/dc/gpio/Makefile  |   8 +
 .../gpu/drm/amd/display/dc/gpio/hw_factory.c  |   4 +
 .../drm/amd/display/dc/gpio/hw_translate.c    |   4 +
 .../hpo/dcn31/dcn31_hpo_dp_stream_encoder.h   |  47 +++++
 .../display/dc/hubbub/dcn35/dcn35_hubbub.h    | 198 ++++++++++++++++++
 .../amd/display/dc/hubp/dcn42/dcn42_hubp.h    |  19 ++
 drivers/gpu/drm/amd/display/dc/hwss/Makefile  |   8 +
 .../gpu/drm/amd/display/dc/inc/hw/clk_mgr.h   |  21 ++
 .../amd/display/dc/inc/hw/clk_mgr_internal.h  |  33 ++-
 drivers/gpu/drm/amd/display/dc/inc/resource.h |   2 +
 .../amd/display/dc/optc/dcn42/dcn42_optc.h    | 179 ++++++++++++++++
 .../amd/display/dc/pg/dcn42/dcn42_pg_cntl.h   |  86 ++++++++
 .../gpu/drm/amd/display/dc/resource/Makefile  |   7 +
 .../dcn42/dcn42_soc_and_ip_translator.c       |   6 +-
 .../soc_and_ip_translator.c                   |   1 +
 .../gpu/drm/amd/display/include/dal_asic_id.h |   3 +
 .../gpu/drm/amd/display/include/dal_types.h   |   1 +
 25 files changed, 768 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/bios/command_table_helper2.c +1 -0
index a93a8860535a..902f06ac43c6 100644
@@ -85,6 +85,7 @@ bool dal_bios_parser_init_cmd_tbl_helper2(
 	case DCN_VERSION_3_6:
 	case DCN_VERSION_4_01:
 	case DCN_VERSION_4_2:
+	case DCN_VERSION_4_2B:
 		*h = dal_cmd_tbl_helper_dce112_get_table2();
 		return true;
 
drivers/gpu/drm/amd/display/dc/clk_mgr/Makefile +10 -0
index 98911ef56c2e..fb234a729bdc 100644
@@ -185,4 +185,14 @@ CLK_MGR_DCN42 = dcn42_smu.o dcn42_clk_mgr.o
 AMD_DAL_CLK_MGR_DCN42 = $(addprefix $(AMDDALPATH)/dc/clk_mgr/dcn42/,$(CLK_MGR_DCN42))
 
 AMD_DISPLAY_FILES += $(AMD_DAL_CLK_MGR_DCN42)
+
+###############################################################################
+# DCN42B
+###############################################################################
+CLK_MGR_DCN42B = dcn42b_clk_mgr.o
+
+AMD_DAL_CLK_MGR_DCN42B = $(addprefix $(AMDDALPATH)/dc/clk_mgr/dcn42b/,$(CLK_MGR_DCN42B))
+
+AMD_DISPLAY_FILES += $(AMD_DAL_CLK_MGR_DCN42B)
+
 endif
drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c +15 -0
index 0340f6b9f157..5f9a6bb84324 100644
@@ -49,6 +49,7 @@
 #include "dcn35/dcn35_clk_mgr.h"
 #include "dcn401/dcn401_clk_mgr.h"
 #include "dcn42/dcn42_clk_mgr.h"
+#include "dcn42b/dcn42b_clk_mgr.h"
 
 int clk_mgr_helper_get_active_display_cnt(
 		struct dc *dc,
@@ -338,6 +339,16 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p
 	break;
 
 	case AMDGPU_FAMILY_GC_11_5_0: {
+		if (ctx->dce_version == DCN_VERSION_4_2B) {
+			struct clk_mgr_dcn42 *clk_mgr = kzalloc(sizeof(*clk_mgr), GFP_KERNEL);
+
+			if (clk_mgr == NULL) {
+				BREAK_TO_DEBUGGER();
+				return NULL;
+			}
+			dcn42b_clk_mgr_construct(ctx, clk_mgr, pp_smu, dccg);
+			return &clk_mgr->base.base;
+		}
 		struct clk_mgr_dcn35 *clk_mgr = kzalloc(sizeof(*clk_mgr), GFP_KERNEL);
 
 		if (clk_mgr == NULL) {
@@ -428,6 +439,10 @@ void dc_destroy_clk_mgr(struct clk_mgr *clk_mgr_base)
 		break;
 
 	case AMDGPU_FAMILY_GC_11_5_0:
+		if (clk_mgr_base->ctx->dce_version == DCN_VERSION_4_2B) {
+			dcn42_clk_mgr_destroy(clk_mgr);
+			break;
+		}
 		dcn35_clk_mgr_destroy(clk_mgr);
 		break;
 	case AMDGPU_FAMILY_GC_12_0_0:
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +6 -0
index f57e9d85563e..e727f8c7a549 100644
@@ -79,6 +79,7 @@
 #include "dcn36/dcn36_resource.h"
 #include "dcn401/dcn401_resource.h"
 #include "dcn42/dcn42_resource.h"
+#include "dcn42b/dcn42b_resource.h"
 #if defined(CONFIG_DRM_AMD_DC_FP)
 #include "dc_spl_translate.h"
 #endif
@@ -243,6 +244,8 @@ enum dce_version resource_parse_asic_id(struct hw_asic_id asic_id)
 		break;
 	case AMDGPU_FAMILY_GC_11_5_0:
 		dc_version = DCN_VERSION_3_5;
+		if (ASICREV_IS_DCN4A_SOC_VAR_B(asic_id.hw_internal_rev))
+			dc_version = DCN_VERSION_4_2B;
 		if (ASICREV_IS_GC_11_0_4(asic_id.hw_internal_rev))
 			dc_version = DCN_VERSION_3_51;
 		if (ASICREV_IS_DCN36(asic_id.hw_internal_rev))
@@ -375,6 +378,9 @@ struct resource_pool *dc_create_resource_pool(struct dc  *dc,
 	case DCN_VERSION_4_2:
 		res_pool = dcn42_create_resource_pool(init_data, dc);
 		break;
+	case DCN_VERSION_4_2B:
+		res_pool = dcn42b_create_resource_pool(init_data, dc);
+		break;
 #endif /* CONFIG_DRM_AMD_DC_FP */
 	default:
 		break;
drivers/gpu/drm/amd/display/dc/dc_helper.c +2 -0
index 9650cccf1b8d..0e0165764a57 100644
@@ -754,6 +754,8 @@ char *dce_version_to_string(const int version)
 		return "DCN 4.0.1";
 	case DCN_VERSION_4_2:
 		return "DCN 4.2";
+	case DCN_VERSION_4_2B:
+		return "DCN 4.2B";
 	default:
 		return "Unknown";
 	}
drivers/gpu/drm/amd/display/dc/dc_spl_translate.c +1 -0
index 52ed8deebf63..bc55f10fba7c 100644
@@ -91,6 +91,7 @@ void translate_SPL_in_params_from_pipe_ctx(struct pipe_ctx *pipe_ctx, struct spl
 		break;
 	case DCN_VERSION_4_01:
 	case DCN_VERSION_4_2:
+	case DCN_VERSION_4_2B:
 		spl_in->callbacks = dcn401_spl_callbacks;
 		break;
 	default:
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_apg.h +13 -0
index 1b81f6773c53..fbcaad4334dd 100644
@@ -60,6 +60,19 @@ struct dcn31_apg_registers {
 		type APG_DBG_AUDIO_CHANNEL_ENABLE;\
 		type APG_MEM_PWR_FORCE
 
+//APG0_APG_DBG_GEN_CONTROL
+#define APG0_APG_DBG_GEN_CONTROL__APG_DBG_AUDIO_CHANNEL_ENABLE__SHIFT                                         0x8
+#define APG0_APG_DBG_GEN_CONTROL__APG_DBG_AUDIO_CHANNEL_ENABLE_MASK                                           0x0000FF00L
+
+/* Not in DCN42B: APG_DBG_GEN_CONTROL, APG0_APG_DBG_60958 */
+#define DCN42B_APG_MASK_SH_LIST(mask_sh)\
+	SE_SF(APG0_APG_CONTROL, APG_RESET, mask_sh),\
+	SE_SF(APG0_APG_CONTROL, APG_RESET_DONE, mask_sh),\
+	SE_SF(APG0_APG_CONTROL2, APG_ENABLE, mask_sh),\
+	SE_SF(APG0_APG_CONTROL2, APG_DP_AUDIO_STREAM_ID, mask_sh),\
+	SE_SF(APG0_APG_MEM_PWR, APG_MEM_PWR_FORCE, mask_sh),\
+	SE_SF(APG0_APG_DBG_GEN_CONTROL, APG_DBG_AUDIO_CHANNEL_ENABLE, mask_sh)
+
 struct dcn31_apg_shift {
 	APG_DCN31_REG_FIELD_LIST(uint8_t);
 };
drivers/gpu/drm/amd/display/dc/dio/dcn42/dcn42_dio_link_encoder.h +95 -0

101 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/gpio/Makefile +8 -0
index f8142ebf363f..3a860b016b7a 100644
@@ -142,4 +142,12 @@ AMD_DAL_GPIO_DCN42 = $(addprefix $(AMDDALPATH)/dc/gpio/dcn42/,$(GPIO_DCN42))
 
 AMD_DISPLAY_FILES += $(AMD_DAL_GPIO_DCN42)
 
+###############################################################################
+# DCN 4.2B
+###############################################################################
+
+GPIO_DCN42B = hw_translate_dcn42b.o hw_factory_dcn42b.o
+
+AMD_DAL_GPIO_DCN42B = $(addprefix $(AMDDALPATH)/dc/gpio/dcn42b/,$(GPIO_DCN42B))
 
+AMD_DISPLAY_FILES += $(AMD_DAL_GPIO_DCN42B)
drivers/gpu/drm/amd/display/dc/gpio/hw_factory.c +4 -0
index d81a71ac00d2..a907f7d0628b 100644
@@ -54,6 +54,7 @@
 #include "dcn32/hw_factory_dcn32.h"
 #include "dcn401/hw_factory_dcn401.h"
 #include "dcn42/hw_factory_dcn42.h"
+#include "dcn42b/hw_factory_dcn42b.h"
 
 bool dal_hw_factory_init(
 	struct hw_factory *factory,
@@ -123,6 +124,9 @@ bool dal_hw_factory_init(
 	case DCN_VERSION_4_2:
 		dal_hw_factory_dcn42_init(factory);
 		return true;
+	case DCN_VERSION_4_2B:
+		dal_hw_factory_dcn42b_init(factory);
+		return true;
 	default:
 		ASSERT_CRITICAL(false);
 		return false;
drivers/gpu/drm/amd/display/dc/gpio/hw_translate.c +4 -0
index e6e36a912b13..64a5e11fce5c 100644
@@ -54,6 +54,7 @@
 #include "dcn32/hw_translate_dcn32.h"
 #include "dcn401/hw_translate_dcn401.h"
 #include "dcn42/hw_translate_dcn42.h"
+#include "dcn42b/hw_translate_dcn42b.h"
 
 /*
  * This unit
@@ -124,6 +125,9 @@ bool dal_hw_translate_init(
 	case DCN_VERSION_4_2:
 		dal_hw_translate_dcn42_init(translate);
 		return true;
+	case DCN_VERSION_4_2B:
+		dal_hw_translate_dcn42b_init(translate);
+		return true;
 	default:
 		BREAK_TO_DEBUGGER();
 		return false;
drivers/gpu/drm/amd/display/dc/hpo/dcn31/dcn31_hpo_dp_stream_encoder.h +47 -0

53 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/hubbub/dcn35/dcn35_hubbub.h +198 -0

210 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/hubp/dcn42/dcn42_hubp.h +19 -0
index f0e614136228..fc30afd4c912 100644
@@ -48,6 +48,25 @@
 	HUBP_SF(CURSOR0_0_HUBP_3DLUT_ADDRESS_LOW, HUBP_3DLUT_ADDRESS_LOW, mask_sh),\
 	HUBP_SF(CURSOR0_0_HUBP_3DLUT_DLG_PARAM, REFCYC_PER_3DLUT_GROUP, mask_sh)
 
+#define HUBP_MASK_SH_LIST_DCN42B(mask_sh)\
+	HUBP_MASK_SH_LIST_DCN35(mask_sh),\
+	HUBP_SF(HUBP0_3DLUT_FL_CONFIG, HUBP0_3DLUT_FL_MODE, mask_sh),\
+	HUBP_SF(HUBP0_3DLUT_FL_CONFIG, HUBP0_3DLUT_FL_FORMAT, mask_sh),\
+	HUBP_SF(HUBP0_3DLUT_FL_BIAS_SCALE, HUBP0_3DLUT_FL_BIAS, mask_sh),\
+	HUBP_SF(HUBP0_3DLUT_FL_BIAS_SCALE, HUBP0_3DLUT_FL_SCALE, mask_sh),\
+	HUBP_SF(CURSOR0_0_HUBP_3DLUT_CONTROL, HUBP_3DLUT_ENABLE, mask_sh),\
+	HUBP_SF(CURSOR0_0_HUBP_3DLUT_CONTROL, HUBP_3DLUT_DONE, mask_sh),\
+	HUBP_SF(CURSOR0_0_HUBP_3DLUT_CONTROL, HUBP_3DLUT_ADDRESSING_MODE, mask_sh),\
+	HUBP_SF(CURSOR0_0_HUBP_3DLUT_CONTROL, HUBP_3DLUT_WIDTH, mask_sh),\
+	HUBP_SF(CURSOR0_0_HUBP_3DLUT_CONTROL, HUBP_3DLUT_MPC_WIDTH, mask_sh),\
+	HUBP_SF(CURSOR0_0_HUBP_3DLUT_CONTROL, HUBP_3DLUT_TMZ, mask_sh),\
+	HUBP_SF(CURSOR0_0_HUBP_3DLUT_CONTROL, HUBP_3DLUT_CROSSBAR_SEL_B, mask_sh),\
+	HUBP_SF(CURSOR0_0_HUBP_3DLUT_CONTROL, HUBP_3DLUT_CROSSBAR_SEL_G, mask_sh),\
+	HUBP_SF(CURSOR0_0_HUBP_3DLUT_CONTROL, HUBP_3DLUT_CROSSBAR_SEL_R, mask_sh),\
+	HUBP_SF(CURSOR0_0_HUBP_3DLUT_ADDRESS_HIGH, HUBP_3DLUT_ADDRESS_HIGH, mask_sh),\
+	HUBP_SF(CURSOR0_0_HUBP_3DLUT_ADDRESS_LOW, HUBP_3DLUT_ADDRESS_LOW, mask_sh),\
+	HUBP_SF(CURSOR0_0_HUBP_3DLUT_DLG_PARAM, REFCYC_PER_3DLUT_GROUP, mask_sh)
+
 struct dml2_display_rq_regs;
 
 bool hubp42_construct(
drivers/gpu/drm/amd/display/dc/hwss/Makefile +8 -0
index 08cbbf87a19f..df3101ce1784 100644
@@ -207,4 +207,12 @@ AMD_DAL_HWSS_DCN42 = $(addprefix $(AMDDALPATH)/dc/hwss/dcn42/,$(HWSS_DCN42))
 
 AMD_DISPLAY_FILES += $(AMD_DAL_HWSS_DCN42)
 
+###############################################################################
+
+HWSS_DCN42B = dcn42b_hwseq.o dcn42b_init.o
+
+AMD_DAL_HWSS_DCN42B = $(addprefix $(AMDDALPATH)/dc/hwss/dcn42b/,$(HWSS_DCN42B))
+
+AMD_DISPLAY_FILES += $(AMD_DAL_HWSS_DCN42B)
+
 endif
drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr.h +21 -0
index dcce81e3d97c..f829ce3f70e5 100644
@@ -117,6 +117,27 @@ struct dcn42_clk_internal {
 	uint32_t CLK8_CLK_TICK_CNT__TIMER_THRESHOLD;
 };
 
+struct dcn42b_clk_internal {
+	int dummy;
+	uint32_t CLK5_CLK0_CURRENT_CNT; //dispclk
+	uint32_t CLK5_CLK1_CURRENT_CNT; //dppclk
+	uint32_t CLK5_CLK2_CURRENT_CNT; //dprefclk
+	uint32_t CLK5_CLK3_CURRENT_CNT; //dcfclk
+	//uint32_t CLK5_CLK4_CURRENT_CNT; //dtbclk
+	uint32_t CLK5_CLK0_DS_CNTL;	    //dispclk deep_sleep_divider
+	uint32_t CLK5_CLK1_DS_CNTL;	    //dppclk deep_sleep_divider
+	uint32_t CLK5_CLK2_DS_CNTL;	    //dprefclk deep_sleep_divider
+	uint32_t CLK5_CLK3_DS_CNTL;	    //dcfclk deep_sleep_divider
+	uint32_t CLK5_CLK3_ALLOW_DS;	//dcf_deep_sleep_allow
+	//uint32_t CLK8_CLK4_DS_CNTL;	    //dtbclk deep_sleep_divider
+	uint32_t CLK5_CLK0_BYPASS_CNTL; //dispclk bypass
+	uint32_t CLK5_CLK1_BYPASS_CNTL; //dppclk bypass
+	uint32_t CLK5_CLK2_BYPASS_CNTL; //dprefclk bypass
+	uint32_t CLK5_CLK3_BYPASS_CNTL; //dcfclk bypass
+	//uint32_t CLK5_CLK4_BYPASS_CNTL; //dtbclk bypass
+	uint32_t CLK5_CLK_TICK_CNT__TIMER_THRESHOLD;
+};
+
 /* Will these bw structures be ASIC specific? */
 
 #define MAX_NUM_DPM_LVL		8
drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr_internal.h +32 -1
index 6ed1011457de..23c9798936c2 100644
@@ -261,7 +261,37 @@ enum dentist_divider_range {
 	CLK_SF(CLK8_CLK3_DS_CNTL, CLK3_ALLOW_DS, mask_sh), \
 	CLK_SF(CLK8_CLK4_DS_CNTL, CLK4_ALLOW_DS, mask_sh), \
 
-
+#define CLK_REG_LIST_DCN42B()	  \
+	SR(DENTIST_DISPCLK_CNTL), \
+	CLK_SR_DCN42B(CLK5_CLK_TICK_CNT_CONFIG_REG), \
+	CLK_SR_DCN42B(CLK5_CLK0_CURRENT_CNT), \
+	CLK_SR_DCN42B(CLK5_CLK1_CURRENT_CNT), \
+	CLK_SR_DCN42B(CLK5_CLK2_CURRENT_CNT), \
+	CLK_SR_DCN42B(CLK5_CLK3_CURRENT_CNT), \
+	CLK_SR_DCN42B(CLK5_CLK0_DS_CNTL), \
+	CLK_SR_DCN42B(CLK5_CLK1_DS_CNTL), \
+	CLK_SR_DCN42B(CLK5_CLK2_DS_CNTL), \
+	CLK_SR_DCN42B(CLK5_CLK3_DS_CNTL), \
+	CLK_SR_DCN42B(CLK5_CLK0_BYPASS_CNTL), \
+	CLK_SR_DCN42B(CLK5_CLK1_BYPASS_CNTL), \
+	CLK_SR_DCN42B(CLK5_CLK2_BYPASS_CNTL), \
+	CLK_SR_DCN42B(CLK5_CLK3_BYPASS_CNTL)
+
+#define CLK_COMMON_MASK_SH_LIST_DCN42B(mask_sh) \
+	CLK_COMMON_MASK_SH_LIST_DCN20_BASE(mask_sh),\
+	CLK_SF(CLK5_CLK_TICK_CNT_CONFIG_REG, TIMER_THRESHOLD, mask_sh), \
+	CLK_SF(CLK5_CLK0_BYPASS_CNTL, CLK0_BYPASS_SEL, mask_sh), \
+	CLK_SF(CLK5_CLK1_BYPASS_CNTL, CLK1_BYPASS_SEL, mask_sh), \
+	CLK_SF(CLK5_CLK2_BYPASS_CNTL, CLK2_BYPASS_SEL, mask_sh), \
+	CLK_SF(CLK5_CLK3_BYPASS_CNTL, CLK3_BYPASS_SEL, mask_sh), \
+	CLK_SF(CLK5_CLK0_DS_CNTL, CLK0_DS_DIV_ID, mask_sh), \
+	CLK_SF(CLK5_CLK1_DS_CNTL, CLK1_DS_DIV_ID, mask_sh), \
+	CLK_SF(CLK5_CLK2_DS_CNTL, CLK2_DS_DIV_ID, mask_sh), \
+	CLK_SF(CLK5_CLK3_DS_CNTL, CLK3_DS_DIV_ID, mask_sh), \
+	CLK_SF(CLK5_CLK0_DS_CNTL, CLK0_ALLOW_DS, mask_sh), \
+	CLK_SF(CLK5_CLK1_DS_CNTL, CLK1_ALLOW_DS, mask_sh), \
+	CLK_SF(CLK5_CLK2_DS_CNTL, CLK2_ALLOW_DS, mask_sh), \
+	CLK_SF(CLK5_CLK3_DS_CNTL, CLK3_ALLOW_DS, mask_sh)
 
 #define CLK_REG_FIELD_LIST(type) \
 	type DPREFCLK_SRC_SEL; \
@@ -375,6 +405,7 @@ struct clk_mgr_registers {
 	uint32_t CLK5_spll_field_8;
 	uint32_t CLK6_spll_field_8;
 	CLK42_REG_LIST(8, uint32_t)
+	CLK42_REG_LIST(5, uint32_t)
 };
 
 struct clk_mgr_shift {
drivers/gpu/drm/amd/display/dc/inc/resource.h +2 -0
index cecd3282a29f..d51fa22ce472 100644
@@ -60,7 +60,9 @@ struct resource_caps {
 	int num_hpo_dp_stream_encoder;
 	int num_hpo_dp_link_encoder;
 	int num_mpc_3dlut;
+	int num_mpc;
 	int num_rmcm;
+	int num_aux;
 };
 
 struct resource_straps {
drivers/gpu/drm/amd/display/dc/optc/dcn42/dcn42_optc.h +179 -0

185 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/pg/dcn42/dcn42_pg_cntl.h +86 -0

98 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/resource/Makefile +7 -0
index 1a17a885fe84..fe02ed39a3e9 100644
@@ -239,5 +239,12 @@ CFLAGS_$(AMDDALPATH)/dc/resource/dcn42/dcn42_resource_fpu.o := $(resource_ccflag
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/resource/dcn42/dcn42_resource_fpu.o := $(resource_rcflags)
 
 ###############################################################################
+# DCN42B
+###############################################################################
+RESOURCE_DCN42B = dcn42b_resource.o
+
+AMD_DAL_RESOURCE_DCN42B = $(addprefix $(AMDDALPATH)/dc/resource/dcn42b/,$(RESOURCE_DCN42B))
+
+AMD_DISPLAY_FILES += $(AMD_DAL_RESOURCE_DCN42B)
 endif
 
drivers/gpu/drm/amd/display/dc/soc_and_ip_translator/dcn42/dcn42_soc_and_ip_translator.c +5 -1
index e0802359829e..ae2c6a2f3f75 100644
@@ -5,6 +5,7 @@
 #include "dcn42_soc_and_ip_translator.h"
 #include "../dcn401/dcn401_soc_and_ip_translator.h"
 #include "bounding_boxes/dcn42_soc_bb.h"
+#include "bounding_boxes/dcn42b_soc_bb.h"
 
 /* soc_and_ip_translator component used to get up-to-date values for bounding box.
  * Bounding box values are stored in several locations and locations can vary with DCN revision.
@@ -13,7 +14,10 @@
 
 static void get_default_soc_bb(struct dml2_soc_bb *soc_bb, const struct dc *dc)
 {
-	{
+	if (dc->ctx->dce_version == DCN_VERSION_4_2B) {
+		memcpy(soc_bb, &dml2_socbb_dcn42b, sizeof(struct dml2_soc_bb));
+		memcpy(&soc_bb->qos_parameters, &dml_dcn42b_variant_a_soc_qos_params, sizeof(struct dml2_soc_qos_parameters));
+	} else {
 		memcpy(soc_bb, &dml2_socbb_dcn42, sizeof(struct dml2_soc_bb));
 		memcpy(&soc_bb->qos_parameters, &dml_dcn42_variant_a_soc_qos_params, sizeof(struct dml2_soc_qos_parameters));
 	}
drivers/gpu/drm/amd/display/dc/soc_and_ip_translator/soc_and_ip_translator.c +1 -0
index bc1487d4ebda..e6887cac5884 100644
@@ -14,6 +14,7 @@ static void dc_construct_soc_and_ip_translator(struct soc_and_ip_translator *soc
 		dcn401_construct_soc_and_ip_translator(soc_and_ip_translator);
 		break;
 	case DCN_VERSION_4_2:
+	case DCN_VERSION_4_2B:
 		dcn42_construct_soc_and_ip_translator(soc_and_ip_translator);
 		break;
 	default:
drivers/gpu/drm/amd/display/include/dal_asic_id.h +3 -0
index 92510af1bd65..7d8944d27d92 100644
@@ -279,6 +279,9 @@ enum {
 #define ASICREV_IS_DCN4(eChipRev)	(eChipRev >= GC_12_0_1_A0 && eChipRev < GC_12_0_0_A0)
 #define ASICREV_IS_DCN401(eChipRev)	(eChipRev >= GC_12_0_0_A0 && eChipRev < GC_12_UNKNOWN)
 
+#define DCN4A_SOC_VAR_B_A0 0xD0
+#define ASICREV_IS_DCN4A_SOC_VAR_B(eChipRev) ((eChipRev >= DCN4A_SOC_VAR_B_A0) && (eChipRev < 0xE0))
+
 /*
  * ASIC chip ID
  */
drivers/gpu/drm/amd/display/include/dal_types.h +1 -0
index d30eb24cf11e..f77fc367eab1 100644
@@ -66,6 +66,7 @@ enum dce_version {
 	DCN_VERSION_3_6,
 	DCN_VERSION_4_01,
 	DCN_VERSION_4_2,
+	DCN_VERSION_4_2B,
 	DCN_VERSION_MAX
 };
 
Signature · 1 line
2.43.0
author
#36 lore raw

PATCH 37/41 drm/amd/display: Add DCN42B DMUB support

In reply to Ray Wu

From: Matthew Stewart <[email protected]>

[Why & How]
Add DMUB support for DCN42B

---
 drivers/gpu/drm/amd/display/dmub/dmub_srv.h   |  1 +
 drivers/gpu/drm/amd/display/dmub/src/Makefile |  1 +
 .../drm/amd/display/dmub/src/dmub_dcn42b.c    | 34 +++++++++++++++++++
 .../drm/amd/display/dmub/src/dmub_dcn42b.h    | 13 +++++++
 .../gpu/drm/amd/display/dmub/src/dmub_srv.c   |  4 +++
 5 files changed, 53 insertions(+)
 create mode 100644 drivers/gpu/drm/amd/display/dmub/src/dmub_dcn42b.c
 create mode 100644 drivers/gpu/drm/amd/display/dmub/src/dmub_dcn42b.h
drivers/gpu/drm/amd/display/dmub/dmub_srv.h +1 -0
index c18ff8f00bb8..f4d05dcfef29 100644
@@ -121,6 +121,7 @@ enum dmub_asic {
 	DMUB_ASIC_DCN36,
 	DMUB_ASIC_DCN401,
 	DMUB_ASIC_DCN42,
+	DMUB_ASIC_DCN42B,
 	DMUB_ASIC_MAX,
 };
 
drivers/gpu/drm/amd/display/dmub/src/Makefile +1 -0
index ac7b17d8fb0f..b6f7477ada22 100644
@@ -29,6 +29,7 @@ DMUB += dmub_dcn351.o
 DMUB += dmub_dcn36.o
 DMUB += dmub_dcn401.o
 DMUB += dmub_dcn42.o
+DMUB += dmub_dcn42b.o
 
 AMD_DAL_DMUB = $(addprefix $(AMDDALPATH)/dmub/src/,$(DMUB))
 
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn42b.c new file +34 -0
new file mode 100644
index 000000000000..97eb022b837b
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: MIT */
+/* Copyright 2026 Advanced Micro Devices, Inc. */
+
+#include "../dmub_srv.h"
+#include "dmub_reg.h"
+#include "dmub_dcn42b.h"
+
+#include "dcn/dcn_4_2_1_offset.h"
+#include "dcn/dcn_4_2_1_sh_mask.h"
+
+#define BASE_INNER(seg) ctx->dcn_reg_offsets[seg]
+#define CTX dmub
+#define REGS dmub->regs_dcn42
+#define REG_OFFSET_EXP(reg_name) BASE(reg##reg_name##_BASE_IDX) + reg##reg_name
+
+void dmub_srv_dcn42b_regs_init(struct dmub_srv *dmub, struct dc_context *ctx)
+{
+	struct dmub_srv_dcn42_regs *regs = dmub->regs_dcn42;
+#define REG_STRUCT regs
+
+#define DMUB_SR(reg) REG_STRUCT->offset.reg = REG_OFFSET_EXP(reg);
+	DMUB_DCN42_REGS()
+	DMCUB_INTERNAL_REGS()
+#undef DMUB_SR
+
+#define DMUB_SF(reg, field) REG_STRUCT->mask.reg##__##field = FD_MASK(reg, field);
+	DMUB_DCN42_FIELDS()
+#undef DMUB_SF
+
+#define DMUB_SF(reg, field) REG_STRUCT->shift.reg##__##field = FD_SHIFT(reg, field);
+	DMUB_DCN42_FIELDS()
+#undef DMUB_SF
+#undef REG_STRUCT
+}
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn42b.h new file +13 -0
new file mode 100644
index 000000000000..cc89f177bf09
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: MIT */
+/* Copyright 2026 Advanced Micro Devices, Inc. */
+
+#ifndef _DMUB_DCN42B_H_
+#define _DMUB_DCN42B_H_
+
+#include "dmub_dcn42.h"
+
+struct dmub_srv;
+
+void dmub_srv_dcn42b_regs_init(struct dmub_srv *dmub, struct dc_context *ctx);
+
+#endif /* _DMUB_DCN42B_H_ */
drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c +4 -0
index 10d23f5f5d94..7463d2ae5055 100644
@@ -41,6 +41,7 @@
 #include "dmub_dcn36.h"
 #include "dmub_dcn401.h"
 #include "dmub_dcn42.h"
+#include "dmub_dcn42b.h"
 #include "os_types.h"
 /*
  * Note: the DMUB service is standalone. No additional headers should be
@@ -413,6 +414,7 @@ static bool dmub_srv_hw_setup(struct dmub_srv *dmub, enum dmub_asic asic)
 			funcs->should_detect = dmub_dcn35_should_detect;
 			break;
 	case DMUB_ASIC_DCN42:
+	case DMUB_ASIC_DCN42B:
 			dmub->regs_dcn42 = &dmub_srv_dcn42_regs;
 			funcs->configure_dmub_in_system_memory = dmub_dcn42_configure_dmub_in_system_memory;
 			funcs->send_inbox0_cmd = dmub_dcn42_send_inbox0_cmd;
@@ -466,6 +468,8 @@ static bool dmub_srv_hw_setup(struct dmub_srv *dmub, enum dmub_asic asic)
 			funcs->enable_reg_inbox0_rsp_int = dmub_dcn42_enable_reg_inbox0_rsp_int;
 			funcs->enable_reg_outbox0_rdy_int = dmub_dcn42_enable_reg_outbox0_rdy_int;
 			funcs->init_reg_offsets = dmub_srv_dcn42_regs_init;
+			if (asic == DMUB_ASIC_DCN42B)
+				funcs->init_reg_offsets = dmub_srv_dcn42b_regs_init;
 
 			funcs->is_hw_powered_up = dmub_dcn42_is_hw_powered_up;
 			funcs->should_detect = dmub_dcn42_should_detect;
Signature · 1 line
2.43.0
author
#37 lore raw

PATCH 38/41 drm/amd/display: Enable DCN 4.2.1 in amdgpu_dm

In reply to Ray Wu

From: Matthew Stewart <[email protected]>

[Why & How]
Add checks for IP version 4.2.1.

---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 29 ++++++++++++++++---
 1 file changed, 25 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +25 -4
index d6eba4c37647..92d0eabc5881 100644
@@ -158,6 +158,9 @@ MODULE_FIRMWARE(FIRMWARE_DCN_401_DMUB);
 #define FIRMWARE_DCN_42_DMUB "amdgpu/dcn_4_2_dmcub.bin"
 MODULE_FIRMWARE(FIRMWARE_DCN_42_DMUB);
 
+#define FIRMWARE_DCN_42B_DMUB "amdgpu/dcn_4_2_1_dmcub.bin"
+MODULE_FIRMWARE(FIRMWARE_DCN_42B_DMUB);
+
 /**
  * DOC: overview
  *
@@ -1372,6 +1375,7 @@ static int dm_dmub_hw_init(struct amdgpu_device *adev)
 	case IP_VERSION(3, 5, 1):
 	case IP_VERSION(3, 6, 0):
 	case IP_VERSION(4, 2, 0):
+	case IP_VERSION(4, 2, 1):
 		hw_params.ips_sequential_ono = adev->external_rev_id > 0x10;
 		hw_params.lower_hbr3_phy_ssc = true;
 		break;
@@ -1820,6 +1824,7 @@ static void *dm_dmub_get_vbios_bounding_box(struct amdgpu_device *adev)
 		bb_size = sizeof(struct dml2_soc_bb);
 		break;
 	case IP_VERSION(4, 2, 0):
+	case IP_VERSION(4, 2, 1):
 		bb_size = sizeof(struct dml2_soc_bb);
 		break;
 	default:
@@ -1867,6 +1872,7 @@ static enum dmub_ips_disable_type dm_get_default_ips_mode(
 		ret =  DMUB_IPS_RCG_IN_ACTIVE_IPS2_IN_OFF;
 		break;
 	case IP_VERSION(4, 2, 0):
+	case IP_VERSION(4, 2, 1):
 		ret =  DMUB_IPS_ENABLE;
 		break;
 	default:
@@ -2480,6 +2486,7 @@ static int load_dmcu_fw(struct amdgpu_device *adev)
 		case IP_VERSION(3, 6, 0):
 		case IP_VERSION(4, 0, 1):
 		case IP_VERSION(4, 2, 0):
+		case IP_VERSION(4, 2, 1):
 			return 0;
 		default:
 			break;
@@ -2618,6 +2625,9 @@ static int dm_dmub_sw_init(struct amdgpu_device *adev)
 	case IP_VERSION(4, 2, 0):
 		dmub_asic = DMUB_ASIC_DCN42;
 		break;
+	case IP_VERSION(4, 2, 1):
+		dmub_asic = DMUB_ASIC_DCN42B;
+		break;
 	default:
 		/* ASIC doesn't support DMUB. */
 		return 0;
@@ -5737,6 +5747,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
 	case IP_VERSION(3, 6, 0):
 	case IP_VERSION(4, 0, 1):
 	case IP_VERSION(4, 2, 0):
+	case IP_VERSION(4, 2, 1):
 		if (register_outbox_irq_handlers(dm->adev)) {
 			drm_err(adev_to_drm(adev), "DM: Failed to initialize IRQ\n");
 			goto fail;
@@ -5762,6 +5773,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
 		case IP_VERSION(3, 6, 0):
 		case IP_VERSION(4, 0, 1):
 		case IP_VERSION(4, 2, 0):
+		case IP_VERSION(4, 2, 1):
 			psr_feature_enabled = true;
 			break;
 		default:
@@ -5780,6 +5792,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
 		case IP_VERSION(3, 5, 1):
 		case IP_VERSION(3, 6, 0):
 		case IP_VERSION(4, 2, 0):
+		case IP_VERSION(4, 2, 1):
 			replay_feature_enabled = true;
 			break;
 
@@ -5941,6 +5954,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
 		case IP_VERSION(3, 6, 0):
 		case IP_VERSION(4, 0, 1):
 		case IP_VERSION(4, 2, 0):
+		case IP_VERSION(4, 2, 1):
 			if (dcn10_register_irq_handlers(dm->adev)) {
 				drm_err(adev_to_drm(adev), "DM: Failed to initialize IRQ\n");
 				goto fail;
@@ -6092,6 +6106,9 @@ static int dm_init_microcode(struct amdgpu_device *adev)
 	case IP_VERSION(4, 2, 0):
 		fw_name_dmub = FIRMWARE_DCN_42_DMUB;
 		break;
+	case IP_VERSION(4, 2, 1):
+		fw_name_dmub = FIRMWARE_DCN_42B_DMUB;
+		break;
 	default:
 		/* ASIC doesn't support DMUB. */
 		return 0;
@@ -6220,6 +6237,7 @@ static int dm_early_init(struct amdgpu_ip_block *ip_block)
 		case IP_VERSION(3, 6, 0):
 		case IP_VERSION(4, 0, 1):
 		case IP_VERSION(4, 2, 0):
+		case IP_VERSION(4, 2, 1):
 			adev->mode_info.num_crtc = 4;
 			adev->mode_info.num_hpd = 4;
 			adev->mode_info.num_dig = 4;
@@ -12651,7 +12669,8 @@ static int dm_crtc_get_cursor_mode(struct amdgpu_device *adev,
 	 * as previous DCN generations, so enable native mode on DCN401/420
 	 */
 	if (amdgpu_ip_version(adev, DCE_HWIP, 0) == IP_VERSION(4, 0, 1) ||
-	    amdgpu_ip_version(adev, DCE_HWIP, 0) == IP_VERSION(4, 2, 0)) {
+	    amdgpu_ip_version(adev, DCE_HWIP, 0) == IP_VERSION(4, 2, 0) ||
+	    amdgpu_ip_version(adev, DCE_HWIP, 0) == IP_VERSION(4, 2, 1)) {
 		*cursor_mode = DM_CURSOR_NATIVE_MODE;
 		return 0;
 	}
@@ -13087,9 +13106,11 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
 			continue;
 
 		/* Check if rotation or scaling is enabled on DCN401 */
-		if ((drm_plane_mask(crtc->cursor) & new_crtc_state->plane_mask) &&
-		    (amdgpu_ip_version(adev, DCE_HWIP, 0) == IP_VERSION(4, 2, 0) ||
-		    amdgpu_ip_version(adev, DCE_HWIP, 0) == IP_VERSION(4, 0, 1))) {
+		if ((drm_plane_mask(crtc->cursor) &
+		     new_crtc_state->plane_mask) &&
+		    (amdgpu_ip_version(adev, DCE_HWIP, 0) == IP_VERSION(4, 2, 1) ||
+		     amdgpu_ip_version(adev, DCE_HWIP, 0) == IP_VERSION(4, 2, 0) ||
+		     amdgpu_ip_version(adev, DCE_HWIP, 0) == IP_VERSION(4, 0, 1))) {
 			new_cursor_state = drm_atomic_get_new_plane_state(state, crtc->cursor);
 
 			is_rotated = new_cursor_state &&
Signature · 1 line
2.43.0
author
#38 lore raw

PATCH 39/41 drm/amd/display: Enable DM for DCN 4.2.1

In reply to Ray Wu

From: Matthew Stewart <[email protected]>

[Why & How]
Add DM IP block to amdgpu_discovery

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +1 -0
index 8e3b6a4050e9..7c2212985273 100644
@@ -2400,6 +2400,7 @@ static int amdgpu_discovery_set_display_ip_blocks(struct amdgpu_device *adev)
 		case IP_VERSION(3, 6, 0):
 		case IP_VERSION(4, 1, 0):
 		case IP_VERSION(4, 2, 0):
+		case IP_VERSION(4, 2, 1):
 			/* TODO: Fix IP version. DC code expects version 4.0.1 */
 			if (adev->ip_versions[DCE_HWIP][0] == IP_VERSION(4, 1, 0))
 				adev->ip_versions[DCE_HWIP][0] = IP_VERSION(4, 0, 1);
Signature · 1 line
2.43.0
author
#39 lore raw

PATCH 40/41 ddrm/amd/display: [FW Promotion] Release 0.1.61.0

In reply to Ray Wu

From: Taimur Hassan <[email protected]>

[Why & How]
Update DMUB related command structure.

---
 .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h   | 606 ++++++++++++++++--
 1 file changed, 561 insertions(+), 45 deletions(-)
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +561 -45
index 2f68438000ea..6f0c4b602f89 100644
@@ -1,3 +1,12 @@
+/*
+ * Note: This header is the authoritative source for the DMUB firmware
+ * command interface. In the Linux kernel, it is maintained as an
+ * auto-generated copy from an AMD internal repository.
+ *
+ * This file follows Doxygen formatting for firmware standards and
+ * is NOT intended to be kernel-doc compliant.
+ */
+
 /*
  * Copyright 2019 Advanced Micro Devices, Inc.
  *
@@ -94,6 +103,35 @@
  */
 #define ABM_MAX_NUM_OF_HG_BINS              64
 
+/**
+ * Flag from driver to indicate that CACP should be disabled gradually
+ * by slowly reversing all programming and pixel compensation.
+ */
+#define SET_CACP_PIPE_GRADUALLY_DISABLE           0
+
+/**
+ * Flag from driver to indicate that CACP should be disabled immediately
+ * and undo all programming and pixel compensation.
+ */
+#define SET_CACP_PIPE_IMMEDIATELY_DISABLE         255
+
+/**
+ * Flag from driver to indicate that CACP should be disabled immediately
+ * and keep the current programming and pixel compensation.
+ */
+#define SET_CACP_PIPE_IMMEDIATE_KEEP_GAIN_DISABLE 254
+
+/**
+ * Flag from driver to indicate that CACP should be disabled immediately
+ * on the next abm vertical interrupt
+ */
+#define SET_CACP_PIPE_IMMEDIATE_ON_NEXT_DISABLE 253
+
+/**
+ * Flag from driver to set the current CACP pipe index or CACP operating level.
+ */
+#define SET_CACP_PIPE_NORMAL                      1
+
 /* Maximum number of SubVP streams */
 #define DMUB_MAX_SUBVP_STREAMS 2
 
@@ -177,6 +215,26 @@
  */
 #define DMUB_CMD_ABM_CONTROL_VERSION_1 0x1
 
+/**
+ * CACP control version legacy
+ */
+#define DMUB_CMD_CACP_CONTROL_VERSION_UNKNOWN 0x0
+
+/**
+ * CACP control version with multi edp support
+ */
+#define DMUB_CMD_CACP_CONTROL_VERSION_1 0x1
+
+/**
+ * CACP control mode with dynamic switch between v1 and v2
+ */
+#define DMUB_CMD_CACP_CONTROL_MODE_0 0x0
+
+/**
+ * CACP control version with forced configure to v1 on new ABM HW
+ */
+#define DMUB_CMD_CACP_CONTROL_MODE_1 0x1
+
 /**
  * Physical framebuffer address location, 64-bit.
  */
@@ -329,7 +387,7 @@ union dmub_addr {
 
 /* Flattened structure containing SOC BB parameters stored in the VBIOS
  * It is not practical to store the entire bounding box in VBIOS since the bounding box struct can gain new parameters.
- * This also prevents alignment issues when new parameters are added to the SoC BB.
+ * This also prevents alighment issues when new parameters are added to the SoC BB.
  * The following parameters should be added since these values can't be obtained elsewhere:
  * -dml2_soc_power_management_parameters
  * -dml2_soc_vmin_clock_limits
@@ -958,7 +1016,7 @@ union dmub_fw_meta {
 //==============================================================================
 #if !defined(TENSILICA) && !defined(DMUB_TRACE_ENTRY_DEFINED)
 /**
- * typedef dmub_trace_code_t - firmware trace code, 32-bits
+ * dmub_trace_code_t - firmware trace code, 32-bits
  */
 typedef uint32_t dmub_trace_code_t;
 
@@ -1170,7 +1228,7 @@ enum dmub_shared_state_feature_id {
 };
 
 /**
- * struct dmub_shared_state_ips_fw_signals - Firmware signals for IPS.
+ * struct dmub_shared_state_ips_fw - Firmware signals for IPS.
  */
 union dmub_shared_state_ips_fw_signals {
 	struct {
@@ -1185,7 +1243,7 @@ union dmub_shared_state_ips_fw_signals {
 };
 
 /**
- * struct dmub_shared_state_ips_driver_signals - Firmware signals for IPS.
+ * struct dmub_shared_state_ips_signals - Firmware signals for IPS.
  */
 union dmub_shared_state_ips_driver_signals {
 	struct {
@@ -1247,7 +1305,7 @@ struct dmub_shared_state_ips_driver {
 }; /* 248-bytes, fixed */
 
 /**
- * struct dmub_shared_state_cursor_offload_stream_v1 - Header metadata for cursor offload.
+ * struct dmub_shared_state_cursor_offload_v1 - Header metadata for cursor offload.
  */
 struct dmub_shared_state_cursor_offload_stream_v1 {
 	uint32_t last_write_idx; /**< Last write index */
@@ -1263,14 +1321,14 @@ struct dmub_shared_state_cursor_offload_v1 {
 }; /* 248-bytes, fixed */
 
 /**
- * struct dmub_shared_state_feature_common - Generic payload.
+ * enum dmub_shared_state_feature_common - Generic payload.
  */
 struct dmub_shared_state_feature_common {
 	uint32_t padding[62];
 }; /* 248-bytes, fixed */
 
 /**
- * struct dmub_shared_state_feature_header - Feature description.
+ * enum dmub_shared_state_feature_header - Feature description.
  */
 struct dmub_shared_state_feature_header {
 	uint16_t id; /**< Feature ID */
@@ -1444,6 +1502,11 @@ enum dmub_gpint_command {
 	 */
 	DMUB_GPINT__REPLAY_RESIDENCY = 14,
 
+	/**
+	 * DESC: Set CACP internal core configuration
+	 */
+	DMUB_GPINT__TRIGGER_CACP = 18,
+
 	/**
 	 * DESC: Copy bounding box to the host.
 	 * ARGS: Version of bounding box to copy
@@ -1858,6 +1921,11 @@ enum dmub_cmd_type {
 	 */
 	DMUB_CMD__DPIA_HPD_INT_ENABLE = 86,
 
+	/**
+	 * Command type used for all CACP commands.
+	 */
+	DMUB_CMD__CACP = 87,
+
 	/**
 	 * Command type used for all PSP commands.
 	 */
@@ -1996,7 +2064,7 @@ struct dmub_cmd_read_modify_write_sequence {
 #define DMUB_READ_MODIFY_WRITE_SEQ__MAX 5
 
 /**
- * struct dmub_rb_cmd_read_modify_write - Read modify write command.
+ * struct dmub_cmd_read_modify_write_sequence - Read modify write command.
  */
 struct dmub_rb_cmd_read_modify_write {
 	struct dmub_cmd_header header;  /**< command header */
@@ -2007,7 +2075,7 @@ struct dmub_rb_cmd_read_modify_write {
 };
 
 /*
- * Update a register with specified masks and values sequence
+ * Update a register with specified masks and values sequeunce
  *
  * 60 payload bytes can hold address + up to 7 sets of mask/value combo, each take 2 dword
  *
@@ -2382,8 +2450,13 @@ struct dmub_cmd_lsdma_data {
 			uint32_t tmz              : 4;
 			uint32_t cache_policy_src : 3;
 			uint32_t cache_policy_dst : 3;
-			uint32_t pad1             : 22;
-			// DCC fields not included because linear mode on display does not support DCC
+			uint32_t data_format      : 6;
+			uint32_t num_type         : 3;
+			uint32_t read_compress    : 2;
+			uint32_t write_compress   : 2;
+			uint32_t max_com          : 2;
+			uint32_t max_uncom        : 1;
+			uint32_t pad1             : 6;
 		} linear_copy_data;
 		struct lsdma_linear_sub_window_copy_data {
 			uint32_t src_lo;
@@ -2411,9 +2484,13 @@ struct dmub_cmd_lsdma_data {
 			uint32_t element_size     : 3;
 			uint32_t src_cache_policy : 3;
 			uint32_t dst_cache_policy : 3;
-			uint32_t reserved0        : 19;
-			// Linear mode on display does not support compression so DCC related fields are not included.
-			// The DCC fields in the command packet will be zero'd at the time of constructing the packet.
+			uint32_t data_format      : 6;
+			uint32_t num_type         : 3;
+			uint32_t read_compress    : 2;
+			uint32_t write_compress   : 2;
+			uint32_t max_com          : 2;
+			uint32_t max_uncom        : 1;
+			uint32_t reserved0        : 3;
 		} linear_sub_window_copy_data;
 		struct lsdma_reg_write_data {
 			uint32_t reg_addr;
@@ -2877,7 +2954,7 @@ struct dmub_cmd_set_pixel_clock_data {
 };
 
 /**
- * struct dmub_rb_cmd_set_pixel_clock - Set pixel clock command.
+ * struct dmub_cmd_set_pixel_clock_data - Set pixel clock command.
  */
 struct dmub_rb_cmd_set_pixel_clock {
 	struct dmub_cmd_header header; /**< header */
@@ -3393,7 +3470,7 @@ struct dpia_bw_allocation_notify_data {
 };
 
 /**
- * union dpia_notification_data - DPIA Notification in Outbox command
+ * union dpia_notify_data_type - DPIA Notification in Outbox command
  */
 union dpia_notification_data {
 	/**
@@ -3449,7 +3526,7 @@ struct dmub_rb_cmd_query_hpd_state {
 };
 
 /**
- * struct dmub_rb_cmd_hpd_sense_notify_data - HPD sense notification data.
+ * struct dmub_rb_cmd_hpd_sense_notify - HPD sense notification data.
  */
 struct dmub_rb_cmd_hpd_sense_notify_data {
 	uint32_t old_hpd_sense_mask; /**< Old HPD sense mask */
@@ -3493,7 +3570,7 @@ enum dmub_cmd_psr_type {
 
 	/**
 	 * Set PSR level.
-	 * PSR level is a 16-bit value dictated by driver that
+	 * PSR level is a 16-bit value dicated by driver that
 	 * will enable/disable different functionality.
 	 */
 	DMUB_CMD__PSR_SET_LEVEL			= 4,
@@ -3538,6 +3615,7 @@ enum dmub_cmd_fams_type {
 	DMUB_CMD__FAMS2_DRR_UPDATE = 5,
 	DMUB_CMD__FAMS2_FLIP = 6,
 	DMUB_CMD__FAMS2_IB_CONFIG = 7,
+	DMUB_CMD__FAMS2_IB_DEBUG_META = 8,
 };
 
 /**
@@ -3650,7 +3728,7 @@ struct dmub_cmd_psr_copy_settings_data {
 	 */
 	union dmub_psr_debug_flags debug;
 	/**
-	 * 16-bit value dictated by driver that will enable/disable different functionality.
+	 * 16-bit value dicated by driver that will enable/disable different functionality.
 	 */
 	uint16_t psr_level;
 	/**
@@ -3690,7 +3768,7 @@ struct dmub_cmd_psr_copy_settings_data {
 	 */
 	uint8_t aux_inst;
 	/**
-	 * Determines if SMU optimizations are enabled/disabled.
+	 * Determines if SMU optimzations are enabled/disabled.
 	 */
 	uint8_t smu_optimizations_en;
 	/**
@@ -3807,7 +3885,7 @@ struct dmub_rb_cmd_psr_copy_settings {
  */
 struct dmub_cmd_psr_set_level_data {
 	/**
-	 * 16-bit value dictated by driver that will enable/disable different functionality.
+	 * 16-bit value dicated by driver that will enable/disable different functionality.
 	 */
 	uint16_t psr_level;
 	/**
@@ -4185,7 +4263,7 @@ struct dmub_rb_cmd_update_cursor_info {
  */
 struct dmub_cmd_psr_set_vtotal_data {
 	/**
-	 * 16-bit value dictated by driver that indicates the vtotal in PSR active requirement when screen idle..
+	 * 16-bit value dicated by driver that indicates the vtotal in PSR active requirement when screen idle..
 	 */
 	uint16_t psr_vtotal_idle;
 	/**
@@ -4199,7 +4277,7 @@ struct dmub_cmd_psr_set_vtotal_data {
 	 */
 	uint8_t panel_inst;
 	/*
-	 * 16-bit value dictated by driver that indicates the vtotal in PSR active requirement when doing SU/FFU.
+	 * 16-bit value dicated by driver that indicates the vtotal in PSR active requirement when doing SU/FFU.
 	 */
 	uint16_t psr_vtotal_su;
 	/**
@@ -4423,6 +4501,7 @@ enum dmub_cmd_panel_replay_state_update_subtype {
 	PR_STATE_UPDATE_COASTING_VTOTAL = 0x1,
 	PR_STATE_UPDATE_SYNC_MODE = 0x2,
 	PR_STATE_UPDATE_RUNTIME_FLAGS = 0x3,
+	PR_STATE_UPDATE_PSEUDO_VTOTAL = 0x4,
 };
 
 enum dmub_cmd_panel_replay_general_subtype {
@@ -4499,7 +4578,7 @@ struct dmub_cmd_replay_copy_settings_data {
 	uint8_t aux_inst;
 	/**
 	 * Panel Instance.
-	 * Panel instance to identify which psr_state to use
+	 * Panel isntance to identify which psr_state to use
 	 * Currently the support is only for 0 or 1
 	 */
 	uint8_t panel_inst;
@@ -4522,7 +4601,7 @@ struct dmub_cmd_replay_copy_settings_data {
 	 */
 	uint8_t dpphy_inst;
 	/**
-	 * Determines if SMU optimizations are enabled/disabled.
+	 * Determines if SMU optimzations are enabled/disabled.
 	 */
 	uint8_t smu_optimizations_en;
 	/**
@@ -4612,7 +4691,7 @@ struct dmub_rb_cmd_smart_power_oled_enable_data {
 	uint8_t enable;
 	/**
 	 * Panel Instance.
-	 * Panel instance to identify which replay_state to use
+	 * Panel isntance to identify which replay_state to use
 	 * Currently the support is only for 0 or 1
 	 */
 	uint8_t panel_inst;
@@ -4651,7 +4730,7 @@ struct dmub_rb_cmd_replay_enable_data {
 	uint8_t enable;
 	/**
 	 * Panel Instance.
-	 * Panel instance to identify which replay_state to use
+	 * Panel isntance to identify which replay_state to use
 	 * Currently the support is only for 0 or 1
 	 */
 	uint8_t panel_inst;
@@ -4699,7 +4778,7 @@ struct dmub_rb_cmd_replay_enable {
 struct dmub_cmd_replay_set_power_opt_data {
 	/**
 	 * Panel Instance.
-	 * Panel instance to identify which replay_state to use
+	 * Panel isntance to identify which replay_state to use
 	 * Currently the support is only for 0 or 1
 	 */
 	uint8_t panel_inst;
@@ -4719,7 +4798,7 @@ struct dmub_cmd_replay_set_power_opt_data {
 struct dmub_cmd_replay_set_timing_sync_data {
 	/**
 	 * Panel Instance.
-	 * Panel instance to identify which replay_state to use
+	 * Panel isntance to identify which replay_state to use
 	 * Currently the support is only for 0 or 1
 	 */
 	uint8_t panel_inst;
@@ -4739,7 +4818,7 @@ struct dmub_cmd_replay_set_timing_sync_data {
 struct dmub_cmd_replay_set_pseudo_vtotal {
 	/**
 	 * Panel Instance.
-	 * Panel instance to identify which replay_state to use
+	 * Panel isntance to identify which replay_state to use
 	 * Currently the support is only for 0 or 1
 	 */
 	uint8_t panel_inst;
@@ -4755,7 +4834,7 @@ struct dmub_cmd_replay_set_pseudo_vtotal {
 struct dmub_cmd_replay_disabled_adaptive_sync_sdp_data {
 	/**
 	 * Panel Instance.
-	 * Panel instance to identify which replay_state to use
+	 * Panel isntance to identify which replay_state to use
 	 * Currently the support is only for 0 or 1
 	 */
 	uint8_t panel_inst;
@@ -4769,7 +4848,7 @@ struct dmub_cmd_replay_disabled_adaptive_sync_sdp_data {
 struct dmub_cmd_replay_set_general_cmd_data {
 	/**
 	 * Panel Instance.
-	 * Panel instance to identify which replay_state to use
+	 * Panel isntance to identify which replay_state to use
 	 * Currently the support is only for 0 or 1
 	 */
 	uint8_t panel_inst;
@@ -4806,7 +4885,7 @@ struct dmub_rb_cmd_replay_set_power_opt {
  */
 struct dmub_cmd_replay_set_coasting_vtotal_data {
 	/**
-	 * 16-bit value dictated by driver that indicates the coasting vtotal.
+	 * 16-bit value dicated by driver that indicates the coasting vtotal.
 	 */
 	uint16_t coasting_vtotal;
 	/**
@@ -4815,12 +4894,12 @@ struct dmub_cmd_replay_set_coasting_vtotal_data {
 	uint8_t cmd_version;
 	/**
 	 * Panel Instance.
-	 * Panel instance to identify which replay_state to use
+	 * Panel isntance to identify which replay_state to use
 	 * Currently the support is only for 0 or 1
 	 */
 	uint8_t panel_inst;
 	/**
-	 * 16-bit value dictated by driver that indicates the coasting vtotal high byte part.
+	 * 16-bit value dicated by driver that indicates the coasting vtotal high byte part.
 	 */
 	uint16_t coasting_vtotal_high;
 	/**
@@ -4923,7 +5002,7 @@ struct dmub_rb_cmd_replay_set_general_cmd {
 struct dmub_cmd_replay_frameupdate_timer_data {
 	/**
 	 * Panel Instance.
-	 * Panel instance to identify which replay_state to use
+	 * Panel isntance to identify which replay_state to use
 	 * Currently the support is only for 0 or 1
 	 */
 	uint8_t panel_inst;
@@ -4956,7 +5035,7 @@ struct dmub_rb_cmd_replay_set_frameupdate_timer {
 union dmub_replay_cmd_set {
 	/**
 	 * Panel Instance.
-	 * Panel instance to identify which replay_state to use
+	 * Panel isntance to identify which replay_state to use
 	 * Currently the support is only for 0 or 1
 	 */
 	uint8_t panel_inst;
@@ -5132,7 +5211,7 @@ struct dmub_hw_lock_inst_flags {
 	uint8_t opp_inst;
 	/**
 	 * OTG HW instance for global update lock.
-	 * TODO: Remove, and reuse otg_inst.
+	 * TODO: Remove, and re-use otg_inst.
 	 */
 	uint8_t dig_inst;
 	/**
@@ -6063,6 +6142,399 @@ struct dmub_rb_cmd_abm_set_event {
 	struct dmub_cmd_abm_set_event_data abm_set_event_data;
 };
 
+/**
+ * CACP command sub-types.
+ */
+enum dmub_cmd_cacp_type {
+	/**
+	 * Initialize parameters for CACP algorithm.
+	 * Data is passed through an indirect buffer.
+	 */
+	DMUB_CMD__CACP_INIT_CONFIG	= 0,
+	/**
+	 * Set OTG and panel HW instance.
+	 */
+	DMUB_CMD__CACP_SET_PIPE		= 1,
+	/**
+	 * Set CACP operating/aggression level.
+	 */
+	DMUB_CMD__CACP_SET_LEVEL	= 2,
+	/**
+	 * Set event: full-screen/video mode/Hdr mode
+	 */
+	DMUB_CMD__CACP_SET_EVENT	= 3,
+
+	/**
+	 * unregister vertical interrupt after steady state is reached
+	 */
+	DMUB_CMD__CACP_PAUSE	= 4,
+	/**
+	 * Set backlight: only for miniLED
+	 */
+	DMUB_CMD__CACP_SET_BACKLIGHT	= 5,
+	/**
+	 * Enable/disable fractional duty cycle for backlight PWM.
+	 */
+	DMUB_CMD__CACP_SET_PWM_FRAC	= 6,
+	/**
+	 * Get CACP Histogram
+	 */
+	DMUB_CMD__CACP_GET_HISTOGRAM = 7,
+};
+
+/**
+ * Data passed from driver to FW in a DMUB_CMD__CACP_SET_PIPE command.
+ */
+struct dmub_cmd_cacp_set_pipe_data {
+	/**
+	 * OTG HW instance.
+	 */
+	uint8_t otg_inst;
+
+	/**
+	 * Panel Control HW instance.
+	 */
+	uint8_t panel_inst;
+
+	/**
+	 * Controls how CACP will interpret a set pipe or set level command.
+	 */
+	uint8_t set_pipe_option;
+
+	/**
+	 * PwrSeq HW Instance.
+	 */
+	uint8_t pwrseq_inst;
+};
+
+/**
+ * Definition of a DMUB_CMD__CACP_SET_PIPE command.
+ */
+struct dmub_rb_cmd_cacp_set_pipe {
+	/**
+	 * Command header.
+	 */
+	struct dmub_cmd_header header;
+
+	/**
+	 * Data passed from driver to FW in a DMUB_CMD__CACP_PIPE command.
+	 */
+	struct dmub_cmd_cacp_set_pipe_data cacp_set_pipe_data;
+};
+
+/**
+ * Data passed from driver to FW in a DMUB_CMD__CACP_SET_LEVEL command.
+ */
+struct dmub_cmd_cacp_set_level_data {
+	/**
+	 * Set current cacp operating/aggression level.
+	 */
+	uint32_t level;
+
+	/**
+	 * CACP control version.
+	 */
+	uint8_t version;
+
+	/**
+	 * Panel Control HW instance mask.
+	 * Bit 0 is Panel Control HW instance 0.
+	 * Bit 1 is Panel Control HW instance 1.
+	 */
+	uint8_t panel_mask;
+
+	/**
+	 * Explicit padding to 4 byte boundary.
+	 */
+	uint8_t pad[2];
+};
+
+/**
+ * Definition of a DMUB_CMD__CACP_SET_LEVEL command.
+ */
+struct dmub_rb_cmd_cacp_set_level {
+	/**
+	 * Command header.
+	 */
+	struct dmub_cmd_header header;
+
+	/**
+	 * Data passed from driver to FW in a DMUB_CMD__CACP_SET_LEVEL command.
+	 */
+	struct dmub_cmd_cacp_set_level_data cacp_set_level_data;
+};
+
+/**
+ * Data passed from driver to FW in a DMUB_CMD__CACP_SET_EVENT command.
+ */
+struct dmub_cmd_cacp_set_event_data {
+	/**
+	 * Full screen mode
+	 */
+	uint8_t full_screen_mode;
+
+	/**
+	 * VariBright Scaling Enable
+	 */
+	uint8_t vb_scaling_enable;
+
+	/**
+	 * HDR mode
+	 */
+	uint8_t hdr_mode;
+
+	/**
+	 * Panel Control HW instance mask.
+	 * Bit 0 is Panel Control HW instance 0.
+	 * Bit 1 is Panel Control HW instance 1.
+	 */
+	uint8_t panel_mask;
+
+	/**
+	 * Transition time info
+	 */
+	uint32_t trans_info;
+};
+
+/**
+ * Definition of a DMUB_CMD__CACP_SET_EVENT command.
+ */
+struct dmub_rb_cmd_cacp_set_event {
+	/**
+	 * Command header.
+	 */
+	struct dmub_cmd_header header;
+
+	/**
+	 * Data passed from driver to FW in a DMUB_CMD__CACP_SET_EVENT command.
+	 */
+	struct dmub_cmd_cacp_set_event_data cacp_set_event_data;
+};
+
+/**
+ * Data passed from driver to FW in a DMUB_CMD__CACP_INIT_CONFIG command.
+ */
+struct dmub_cmd_cacp_init_config_data {
+	/**
+	 * Location of indirect buffer used to pass init data to CACP.
+	 */
+	union dmub_addr src;
+
+	/**
+	 * Indirect buffer length.
+	 */
+	uint16_t bytes;
+
+	/**
+	 * CACP control version.
+	 */
+	uint8_t mode;
+
+	/**
+	 * Panel Control HW instance mask.
+	 * Bit 0 is Panel Control HW instance 0.
+	 * Bit 1 is Panel Control HW instance 1.
+	 */
+	uint8_t panel_mask;
+
+	/**
+	 * CACP visual_confirm debug
+	 */
+	uint32_t visual_confirm;
+
+	/**
+	 * CACP customized str_scl params
+	 */
+	uint8_t strscl_valid;
+	uint8_t pad[3];
+	uint8_t strscl_sdr[4];
+	uint8_t strscl_hdr[4];
+};
+
+/**
+ * Definition of a DMUB_CMD__CACP_INIT_CONFIG command.
+ */
+struct dmub_rb_cmd_cacp_init_config {
+	/**
+	 * Command header.
+	 */
+	struct dmub_cmd_header header;
+
+	/**
+	 * Data passed from driver to FW in a DMUB_CMD__CACP_INIT_CONFIG command.
+	 */
+	struct dmub_cmd_cacp_init_config_data cacp_init_config_data;
+};
+
+/**
+ * Data passed from driver to FW in a DMUB_CMD__CACP_PAUSE command.
+ */
+
+struct dmub_cmd_cacp_pause_data {
+
+	/**
+	 * Panel Control HW instance mask.
+	 * Bit 0 is Panel Control HW instance 0.
+	 * Bit 1 is Panel Control HW instance 1.
+	 */
+	uint8_t panel_mask;
+
+	/**
+	 * OTG hw instance
+	 */
+	uint8_t otg_inst;
+
+	/**
+	 * Enable or disable CACP pause
+	 */
+	uint8_t enable;
+
+	/**
+	 * Explicit padding to 4 byte boundary.
+	 */
+	uint8_t pad;
+};
+
+/**
+ * Definition of a DMUB_CMD__CACP_PAUSE command.
+ */
+struct dmub_rb_cmd_cacp_pause {
+	/**
+	 * Command header.
+	 */
+	struct dmub_cmd_header header;
+
+	/**
+	 * Data passed from driver to FW in a DMUB_CMD__CACP_PAUSE command.
+	 */
+	struct dmub_cmd_cacp_pause_data cacp_pause_data;
+};
+
+/**
+ * Data passed from driver to FW in a DMUB_CMD__CACP_SET_BACKLIGHT command.
+ */
+struct dmub_cmd_cacp_set_backlight_data {
+	/**
+	 * Number of frames to ramp to backlight user level.
+	 */
+	uint32_t frame_ramp;
+
+	/**
+	 * Requested backlight level from user.
+	 */
+	uint32_t backlight_user_level;
+
+	/**
+	 * ABM control version.
+	 */
+	uint8_t version;
+
+	/**
+	 * Panel Control HW instance mask.
+	 * Bit 0 is Panel Control HW instance 0.
+	 * Bit 1 is Panel Control HW instance 1.
+	 */
+	uint8_t panel_mask;
+
+	/**
+	 * Explicit padding to 4 byte boundary.
+	 */
+	uint8_t pad[2];
+};
+
+/**
+ * Definition of a DMUB_CMD__CACP_SET_BACKLIGHT command.
+ */
+struct dmub_rb_cmd_cacp_set_backlight {
+	/**
+	 * Command header.
+	 */
+	struct dmub_cmd_header header;
+
+	/**
+	 * Data passed from driver to FW in a DMUB_CMD__CACP_SET_BACKLIGHT command.
+	 */
+	struct dmub_cmd_cacp_set_backlight_data cacp_set_backlight_data;
+};
+
+/**
+ * Data passed from driver to FW in a DMUB_CMD__CACP_SET_PWM_FRAC command.
+ */
+struct dmub_cmd_cacp_set_pwm_frac_data {
+	/**
+	 * Enable/disable fractional duty cycle for backlight PWM.
+	 * TODO: Convert to uint8_t.
+	 */
+	uint32_t fractional_pwm;
+
+	/**
+	 * CACP control version.
+	 */
+	uint8_t version;
+
+	/**
+	 * Panel Control HW instance mask.
+	 * Bit 0 is Panel Control HW instance 0.
+	 * Bit 1 is Panel Control HW instance 1.
+	 */
+	uint8_t panel_mask;
+
+	/**
+	 * Explicit padding to 4 byte boundary.
+	 */
+	uint8_t pad[2];
+};
+
+/**
+ * Definition of a DMUB_CMD__CACP_SET_PWM_FRAC command.
+ */
+struct dmub_rb_cmd_cacp_set_pwm_frac {
+	/**
+	 * Command header.
+	 */
+	struct dmub_cmd_header header;
+
+	/**
+	 * Data passed from driver to FW in a DMUB_CMD__CACP_SET_PWM_FRAC command.
+	 */
+	struct dmub_cmd_cacp_set_pwm_frac_data cacp_set_pwm_frac_data;
+};
+
+/**
+ * Definition of a DMUB_CMD__CACP_GET_HISTOGRAM command.
+ */
+struct dmub_rb_cmd_cacp_get_histogram {
+	/**
+	 * Command header.
+	 */
+	struct dmub_cmd_header header;
+
+	/**
+	 * Address where Histogram should be copied.
+	 */
+	union dmub_addr dest;
+
+	/**
+	 * Type of Histogram being queried.
+	 */
+	enum dmub_abm_histogram_type histogram_type;
+
+	/**
+	 * Indirect buffer length.
+	 */
+	uint16_t bytes;
+
+	/**
+	 * eDP panel instance.
+	 */
+	uint8_t panel_inst;
+
+	/**
+	 * Explicit padding to 4 byte boundary.
+	 */
+	uint8_t pad;
+};
+
 /**
  * Data passed from driver to FW in a DMUB_CMD__QUERY_FEATURE_CAPS command.
  */
@@ -6328,7 +6800,7 @@ struct dmub_cmd_cable_id_input {
 };
 
 /**
- * struct dmub_cmd_cable_id_output - Defines the output of DMUB_CMD_GET_USBC_CABLE_ID command.
+ * struct dmub_cmd_cable_id_input - Defines the output of DMUB_CMD_GET_USBC_CABLE_ID command.
  */
 struct dmub_cmd_cable_id_output {
 	uint8_t UHBR10_20_CAPABILITY	:2; /**< b'01 for UHBR10 support, b'10 for both UHBR10 and UHBR20 support */
@@ -6619,7 +7091,7 @@ struct dmub_cmd_pr_enable_data {
 	uint8_t enable;
 	/**
 	 * Panel Instance.
-	 * Panel instance to identify which replay_state to use
+	 * Panel isntance to identify which replay_state to use
 	 * Currently the support is only for 0 or 1
 	 */
 	uint8_t panel_inst;
@@ -6697,7 +7169,7 @@ struct dmub_cmd_pr_copy_settings_data {
 	uint8_t aux_inst;
 	/**
 	 * Panel Instance.
-	 * Panel instance to identify which psr_state to use
+	 * Panel isntance to identify which psr_state to use
 	 * Currently the support is only for 0 or 1
 	 */
 	uint8_t panel_inst;
@@ -6706,7 +7178,7 @@ struct dmub_cmd_pr_copy_settings_data {
 	 */
 	uint8_t dpphy_inst;
 	/**
-	 * Determines if SMU optimizations are enabled/disabled.
+	 * Determines if SMU optimzations are enabled/disabled.
 	 */
 	uint8_t smu_optimizations_en;
 	/**
@@ -6714,7 +7186,7 @@ struct dmub_cmd_pr_copy_settings_data {
 	 */
 	uint32_t line_time_in_ns;
 	/*
-	 * Use FSFT after pixel clk
+	 * Use FSFT afftet pixel clk
 	 */
 	uint32_t pix_clk_100hz;
 	/*
@@ -6787,7 +7259,7 @@ union dmub_pr_runtime_flags {
 struct dmub_cmd_pr_update_state_data {
 	/**
 	 * Panel Instance.
-	 * Panel instance to identify which psr_state to use
+	 * Panel isntance to identify which psr_state to use
 	 * Currently the support is only for 0 or 1
 	 */
 	uint8_t panel_inst;
@@ -6802,6 +7274,7 @@ struct dmub_cmd_pr_update_state_data {
 	 */
 	uint32_t coasting_vtotal;
 	uint32_t sync_mode;
+	uint32_t pseudo_vtotal;
 
 	union dmub_pr_runtime_flags pr_runtime_flags;
 };
@@ -6809,7 +7282,7 @@ struct dmub_cmd_pr_update_state_data {
 struct dmub_cmd_pr_general_cmd_data {
 	/**
 	 * Panel Instance.
-	 * Panel instance to identify which psr_state to use
+	 * Panel isntance to identify which psr_state to use
 	 * Currently the support is only for 0 or 1
 	 */
 	uint8_t panel_inst;
@@ -7134,6 +7607,47 @@ union dmub_rb_cmd {
 	 * Definition of a DMUB_CMD__DPIA_HPD_INT_ENABLE command.
 	 */
 	struct dmub_rb_cmd_dpia_hpd_int_enable dpia_hpd_int_enable;
+
+	/**
+	 * Definition of a DMUB_CMD__CACP_SET_PIPE command.
+	 */
+	struct dmub_rb_cmd_cacp_set_pipe cacp_set_pipe;
+
+	/**
+	 * Definition of a DMUB_CMD__CACP_SET_LEVEL command.
+	 */
+	struct dmub_rb_cmd_cacp_set_level cacp_set_level;
+
+	/**
+	 * Definition of a DMUB_CMD__CACP_SET_EVENT command.
+	 */
+	struct dmub_rb_cmd_cacp_set_event cacp_set_event;
+
+	/**
+	 * Definition of a DMUB_CMD__CACP_INIT_CONFIG command.
+	 */
+	struct dmub_rb_cmd_cacp_init_config cacp_init_config;
+
+	/**
+	 * Definition of a DMUB_CMD__CACP_PAUSE command.
+	 */
+	struct dmub_rb_cmd_cacp_pause cacp_pause;
+
+	/**
+	 * Definition of a DMUB_CMD__CACP_SET_BACKLIGHT command.
+	 */
+	struct dmub_rb_cmd_cacp_set_backlight cacp_set_backlight;
+
+	/**
+	 * Definition of a DMUB_CMD__CACP_SET_PWM_FRAC command.
+	 */
+	struct dmub_rb_cmd_cacp_set_pwm_frac cacp_set_pwm_frac;
+
+	/**
+	 * Definition of a DMUB_CMD__CACP_GET_HISTOGRAM command.
+	 */
+	struct dmub_rb_cmd_cacp_get_histogram cacp_get_histogram;
+
 	/**
 	 * Definition of a DMUB_CMD__IDLE_OPT_DCN_NOTIFY_IDLE command.
 	 */
@@ -7189,6 +7703,8 @@ union dmub_rb_cmd {
 
 	struct dmub_rb_cmd_ib ib_fams2_config;
 
+	struct dmub_rb_cmd_ib ib_fams2_debug_meta;
+
 	struct dmub_rb_cmd_fams2_drr_update fams2_drr_update;
 
 	struct dmub_rb_cmd_fams2_flip fams2_flip;
Signature · 1 line
2.43.0
author
#40 lore raw

PATCH 41/41 drm/amd/display: Promote DC to 3.2.384

In reply to Ray Wu

From: Taimur Hassan <[email protected]>

This version brings along the following updates:

- Enable DCN 4.2.1:
* Add register header files for DCN42B
* Add DCN42B DC resource files
* Add DCN42B DMUB support
* Add DCN42B code to DC and dcn42b_soc_bb to DML2
* Add DCN42 PMO init_for_pstate_support
* Enable DCN42 PMO policy and pstate pmo
* Enable DCN 4.2.1 in amdgpu_dm
* Enable DM for DCN 4.2.1
- Add no_native_i2c codepath
- Add amdgpu_dm KUnit tests for:
* amdgpu_dm_psr_set_event
* dm_ism_dispatch_next_event and additional ISM functions
* amdgpu_dm_colorop
* color LUT functions and transfer function helpers
- Enable gcov coverage for amdgpu_dm KUnit builds
- Extract dm_ism_dispatch_next_event and transfer function helpers
- Refactor amdgpu_dm_initialize_default_pipeline
- Clean up PSR helper functions
- Fix gamma 2.2 colorop TF direction in tests
- Handle aux_inst for connectors without DDC pin
- Fix DP_PIXEL_FORMAT fields & update clk_src for DCN4x
- Avoid DPMS-on for phantom stream
- Change default driver setting for "Force ODM2:1 for eDP" policy
- Add DC_VALIDATE_MODE_AND_PROGRAMMING condition check for force odm2:1
- Check for sharpening case when calculating max vtaps for scaler
- Add DRAM table fields to clk_mgr_internal
- Enable frame skipping in 0x37B
- Bound VBIOS record-chain walk loops
- Clamp HDMI HDCP2 rx_id_list read to buffer size
- Clamp VBIOS HDMI retimer register count to array size
- Reject gpio_bitshift >= 32 in bios_parser_get_gpio_pin_info()
- Use krealloc_array() in dal_vector_reserve()
- Fix NULL deref and buffer over-read in SDP debugfs
- Fix out-of-bounds read in dp_get_eq_aux_rd_interval()
- FW Release 0.1.61.0

---
 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 3ffcb74552c4..7b356bf95a67 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.383"
+#define DC_VER "3.2.384"
 
 /**
  * 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
#41 lore raw
In reply to Ray Wu

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 -> 2f689def76af155a850fa9b2693b12973953c062 -> drm/amdgpu: fix calling VM invalidation in amdgpu_hmm_invalidate_gfx) 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

-----Original Message-----
From: Ray Wu <[email protected]>
Sent: Tuesday, May 26, 2026 3:01 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]>; Wu, Ray <[email protected]>
Subject: [PATCH 00/41] DC Patches June 1 2026

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

- Enable DCN 4.2.1:
* Add register header files for DCN42B
* Add DCN42B DC resource files
* Add DCN42B DMUB support
* Add DCN42B code to DC and dcn42b_soc_bb to DML2
* Add DCN42 PMO init_for_pstate_support
* Enable DCN42 PMO policy and pstate pmo
* Enable DCN 4.2.1 in amdgpu_dm
* Enable DM for DCN 4.2.1
- Add no_native_i2c codepath
- Add amdgpu_dm KUnit tests for:
* amdgpu_dm_psr_set_event
* dm_ism_dispatch_next_event and additional ISM functions
* amdgpu_dm_colorop
* color LUT functions and transfer function helpers
- Enable gcov coverage for amdgpu_dm KUnit builds
- Extract dm_ism_dispatch_next_event and transfer function helpers
- Refactor amdgpu_dm_initialize_default_pipeline
- Clean up PSR helper functions
- Fix gamma 2.2 colorop TF direction in tests
- Handle aux_inst for connectors without DDC pin
- Fix DP_PIXEL_FORMAT fields & update clk_src for DCN4x
- Avoid DPMS-on for phantom stream
- Change default driver setting for "Force ODM2:1 for eDP" policy
- Add DC_VALIDATE_MODE_AND_PROGRAMMING condition check for force odm2:1
- Check for sharpening case when calculating max vtaps for scaler
- Add DRAM table fields to clk_mgr_internal
- Enable frame skipping in 0x37B
- Bound VBIOS record-chain walk loops
- Clamp HDMI HDCP2 rx_id_list read to buffer size
- Clamp VBIOS HDMI retimer register count to array size
- Reject gpio_bitshift >= 32 in bios_parser_get_gpio_pin_info()
- Use krealloc_array() in dal_vector_reserve()
- Fix NULL deref and buffer over-read in SDP debugfs
- Fix out-of-bounds read in dp_get_eq_aux_rd_interval()
- FW Release 0.1.61.0

Cc Daniel Wheeler <[email protected]>

Alex Hung (12):
drm/amd/display: Enable gcov coverage for amdgpu_dm KUnit builds drm/amd/display: Add KUnit tests for color LUT functions drm/amd/display: Extract transfer function helpers drm/amd/display: Add more color KUnit tests drm/amd/display: Refactor amdgpu_dm_initialize_default_pipeline drm/amd/display: Fix gamma 2.2 colorop TF direction in tests drm/amd/display: Add KUnit tests for amdgpu_dm_colorop drm/amd/display: Add more KUnit tests for amdgpu_dm_ism drm/amd/display: Extract dm_ism_dispatch_next_event drm/amd/display: Add KUnit tests for dm_ism_dispatch_next_event drm/amd/display: Add KUnit tests for amdgpu_dm_psr_set_event drm/amd/display: Clean up PSR helper functions

Charlene Liu (1):
drm/amd/display: Add DC_VALIDATE_MODE_AND_PROGRAMMING condition check
for force odm2:1

Chuntao Tso (1):
drm/amd/display: Enable frame skipping in 0x37B

Dmytro Laktyushkin (2):
drm/amd/display: Enable dcn42 pstate pmo drm/amd/display: Add DCN42 PMO init_for_pstate_support

Gabe Teeger (1):
drm/amd/display: Handle aux_inst for connectors without DDC pin

Harry Wentland (7):
drm/amd/display: Fix out-of-bounds read in dp_get_eq_aux_rd_interval() drm/amd/display: Clamp VBIOS HDMI retimer register count to array size drm/amd/display: Fix NULL deref and buffer over-read in SDP debugfs drm/amd/display: Use krealloc_array() in dal_vector_reserve() drm/amd/display: Reject gpio_bitshift >= 32 in
bios_parser_get_gpio_pin_info()
drm/amd/display: Clamp HDMI HDCP2 rx_id_list read to buffer size drm/amd/display: Bound VBIOS record-chain walk loops

Ilya Bakoulin (1):
drm/amd/display: Avoid DPMS-on for phantom stream

Matthew Stewart (8):
drm/amd/display: Add no_native_i2c codepath
drm/amd: Add register header files for DCN42B
drm/amd/display: Add DCN42B DC resource files
drm/amd/display: Add dcn42b_soc_bb to DML2
drm/amd/display: Add DCN42B code to DC
drm/amd/display: Add DCN42B DMUB support
drm/amd/display: Enable DCN 4.2.1 in amdgpu_dm
drm/amd/display: Enable DM for DCN 4.2.1

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

Ovidiu Bunea (3):
drm/amd/display: Update get_pixel_clk_frequency() for DCN4x DCCG DP
DTO
drm/amd/display: Change default driver setting for "Force ODM2:1 for
eDP" policy
drm/amd/display: Fix DP_PIXEL_FORMAT fields & update clk_src for DCN4x

Samson Tam (1):
drm/amd/display: Check for sharpening case when calculating max vtaps
for scaler

Taimur Hassan (2):
ddrm/amd/display: [FW Promotion] Release 0.1.61.0 drm/amd/display: Promote DC to 3.2.384

Wenjing Liu (1):
drm/amd/display: Add DRAM table fields to clk_mgr_internal

 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c |     1 +
 drivers/gpu/drm/amd/display/Kconfig           |     2 +-
 .../gpu/drm/amd/display/amdgpu_dm/Makefile    |     3 +
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |    29 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_color.c   |    69 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_color.h   |    29 +
 .../amd/display/amdgpu_dm/amdgpu_dm_colorop.c |    22 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_colorop.h |     5 +
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c |     5 +
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c |    83 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.h |     7 +
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c |    20 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_psr.h |     4 +-
 .../amd/display/amdgpu_dm/tests/.kunitconfig  |     8 +
 .../amdgpu_dm/tests/amdgpu_dm_color_test.c    |   568 +
 .../amdgpu_dm/tests/amdgpu_dm_colorop_test.c  |   102 +-
 .../amdgpu_dm/tests/amdgpu_dm_ism_test.c      |   302 +
 .../amdgpu_dm/tests/amdgpu_dm_psr_test.c      |    46 +-
 .../gpu/drm/amd/display/dc/basics/vector.c    |     4 +-
 .../gpu/drm/amd/display/dc/bios/bios_parser.c |    15 +-
 .../drm/amd/display/dc/bios/bios_parser2.c    |   148 +-
 .../amd/display/dc/bios/bios_parser_helper.h  |     5 +
 .../display/dc/bios/command_table_helper2.c   |     1 +
 .../gpu/drm/amd/display/dc/clk_mgr/Makefile   |    10 +
 .../gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c  |    15 +
 .../dc/clk_mgr/dcn42b/dcn42b_clk_mgr.c        |   483 +
 .../dc/clk_mgr/dcn42b/dcn42b_clk_mgr.h        |    48 +
 drivers/gpu/drm/amd/display/dc/core/dc.c      |     4 +-
 .../gpu/drm/amd/display/dc/core/dc_resource.c |     6 +
 drivers/gpu/drm/amd/display/dc/dc.h           |    10 +-
 .../gpu/drm/amd/display/dc/dc_bios_types.h    |     4 +
 drivers/gpu/drm/amd/display/dc/dc_dp_types.h  |     7 +-
 drivers/gpu/drm/amd/display/dc/dc_fused_io.c  |     4 +-
 drivers/gpu/drm/amd/display/dc/dc_helper.c    |     2 +
 .../gpu/drm/amd/display/dc/dc_spl_translate.c |     1 +
 drivers/gpu/drm/amd/display/dc/dce/dce_aux.c  |   181 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_aux.h  |     4 +
 .../drm/amd/display/dc/dce/dce_clock_source.c |    83 +-
 .../drm/amd/display/dc/dce/dce_clock_source.h |    26 +-
 .../gpu/drm/amd/display/dc/dcn31/dcn31_apg.h  |    13 +
 .../dc/dio/dcn42/dcn42_dio_link_encoder.h     |    95 +
 .../dc/dio/dcn42/dcn42_dio_stream_encoder.c   |    64 +-
 .../dc/dio/dcn42/dcn42_dio_stream_encoder.h   |     6 +
 .../dml2_0/dml21/dml21_translation_helper.c   |     5 +-
 .../dml21/inc/bounding_boxes/dcn42b_soc_bb.h  |   227 +
 .../dc/dml2_0/dml21/inc/dml_top_types.h       |     1 +
 .../dml21/src/dml2_pmo/dml2_pmo_dcn42.c       |   223 +-
 .../dml21/src/dml2_pmo/dml2_pmo_dcn42.h       |     2 +
 .../dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c  |    30 +-
 .../dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.h  |    46 +-
 .../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 +
 .../amd/display/dc/dpp/dcn401/dcn401_dpp.c    |     8 +-
 drivers/gpu/drm/amd/display/dc/gpio/Makefile  |     8 +
 .../dc/gpio/dcn42b/hw_factory_dcn42b.c        |   313 +
 .../dc/gpio/dcn42b/hw_factory_dcn42b.h        |    11 +
 .../dc/gpio/dcn42b/hw_translate_dcn42b.c      |   192 +
 .../dc/gpio/dcn42b/hw_translate_dcn42b.h      |    13 +
 .../gpu/drm/amd/display/dc/gpio/hw_factory.c  |     4 +
 .../drm/amd/display/dc/gpio/hw_translate.c    |     4 +
 .../hpo/dcn31/dcn31_hpo_dp_stream_encoder.h   |    47 +
 .../display/dc/hubbub/dcn35/dcn35_hubbub.h    |   198 +
 .../amd/display/dc/hubp/dcn42/dcn42_hubp.h    |    19 +
 drivers/gpu/drm/amd/display/dc/hwss/Makefile  |     8 +
 .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c   |     4 +-
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c |    27 +
 .../amd/display/dc/hwss/dcn42b/dcn42b_hwseq.c |   238 +
 .../amd/display/dc/hwss/dcn42b/dcn42b_hwseq.h |    15 +
 .../amd/display/dc/hwss/dcn42b/dcn42b_init.c  |    20 +
 .../amd/display/dc/hwss/dcn42b/dcn42b_init.h  |    14 +
 .../gpu/drm/amd/display/dc/inc/clock_source.h |     4 +-
 .../gpu/drm/amd/display/dc/inc/hw/clk_mgr.h   |    21 +
 .../amd/display/dc/inc/hw/clk_mgr_internal.h  |    44 +-
 drivers/gpu/drm/amd/display/dc/inc/resource.h |     2 +
 .../display/dc/link/accessories/link_dp_cts.c |     2 +
 .../drm/amd/display/dc/link/link_factory.c    |    86 +-
 .../amd/display/dc/link/protocols/link_ddc.c  |    60 +-
 .../dc/link/protocols/link_dp_capability.c    |     6 +
 .../link/protocols/link_edp_panel_control.c   |     7 +-
 .../amd/display/dc/optc/dcn42/dcn42_optc.h    |   179 +
 .../amd/display/dc/pg/dcn42/dcn42_pg_cntl.h   |    86 +
 .../gpu/drm/amd/display/dc/resource/Makefile  |     7 +
 .../dc/resource/dcn401/dcn401_resource.c      |     4 +-
 .../dc/resource/dcn42/dcn42_resource.c        |    17 +-
 .../dc/resource/dcn42/dcn42_resource.h        |     3 +-
 .../dc/resource/dcn42b/dcn42b_resource.c      |  2404 +
 .../dc/resource/dcn42b/dcn42b_resource.h      |   672 +
 .../dcn42/dcn42_soc_and_ip_translator.c       |     6 +-
 .../soc_and_ip_translator.c                   |     1 +
 drivers/gpu/drm/amd/display/dmub/dmub_srv.h   |     1 +
 .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h   |   606 +-
 drivers/gpu/drm/amd/display/dmub/src/Makefile |     1 +
 .../drm/amd/display/dmub/src/dmub_dcn42b.c    |    34 +
 .../drm/amd/display/dmub/src/dmub_dcn42b.h    |    13 +
 .../gpu/drm/amd/display/dmub/src/dmub_srv.c   |     4 +
 .../amd/display/include/bios_parser_types.h   |     1 +
 .../gpu/drm/amd/display/include/dal_asic_id.h |     3 +
 .../gpu/drm/amd/display/include/dal_types.h   |     1 +
 .../drm/amd/display/modules/hdcp/hdcp_ddc.c   |     3 +-
 .../gpu/drm/amd/display/modules/power/power.c |     9 +-
 .../drm/amd/display/modules/power/power_abm.c |    16 +-
 .../include/asic_reg/clk/clk_15_0_5_offset.h  |    41 +
 .../include/asic_reg/clk/clk_15_0_5_sh_mask.h |    44 +
 .../include/asic_reg/dcn/dcn_4_2_1_offset.h   | 16304 +++++
 .../include/asic_reg/dcn/dcn_4_2_1_sh_mask.h  | 60622 ++++++++++++++++
 .../include/asic_reg/dpcs/dpcs_4_0_1_offset.h |   108 +
 .../asic_reg/dpcs/dpcs_4_0_1_sh_mask.h        |   412 +
 108 files changed, 85760 insertions(+), 342 deletions(-)  create mode 100644 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn42b/dcn42b_clk_mgr.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn42b/dcn42b_clk_mgr.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/dml2_0/dml21/inc/bounding_boxes/dcn42b_soc_bb.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/gpio/dcn42b/hw_factory_dcn42b.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/gpio/dcn42b/hw_factory_dcn42b.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/gpio/dcn42b/hw_translate_dcn42b.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/gpio/dcn42b/hw_translate_dcn42b.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/hwss/dcn42b/dcn42b_hwseq.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/hwss/dcn42b/dcn42b_hwseq.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/hwss/dcn42b/dcn42b_init.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/hwss/dcn42b/dcn42b_init.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.h
 create mode 100644 drivers/gpu/drm/amd/display/dmub/src/dmub_dcn42b.c
 create mode 100644 drivers/gpu/drm/amd/display/dmub/src/dmub_dcn42b.h
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/clk/clk_15_0_5_offset.h
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/clk/clk_15_0_5_sh_mask.h
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_4_2_1_offset.h
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_4_2_1_sh_mask.h
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/dpcs/dpcs_4_0_1_offset.h
 create mode 100644 drivers/gpu/drm/amd/include/asic_reg/dpcs/dpcs_4_0_1_sh_mask.h

--
2.43.0