Skip to contentSkip to conversation

DC Patches Aug 26, 2026

PATCH In review Alex Hung 2 participants 61 messages Aug 26 – Aug 31

Subsystems (5)
lore
Share & tools
lore

Alex Hung

author
#0 lore raw

cover DC Patches Aug 26, 2026

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

* Move the DML wrapper into its own component.
* Fix DCN5/6 DML2 compilation warnings.
* Fix DCN60 DPP PRE_GAM offset, HDMI link rate and DSC handling.
* Fix backlight control for luminance-capable OLED.
* Restore native cursor mode early return for disabled CRTCs.
* Fix NULL hubp deref and CalculateFlipSchedule ordering.
* Remove duplicated fixpt and custom float code.
* Drop pipe_ctx param from MPC_VISUAL_CONFIRM.
* Move cursor SDR white level calc out of the hwss executor.
* Set gpuvm min page size to 4K on DCN35/36.
* Update RBBMIF timeout control conditions.
* Guard DAL port idle optimizations by ASIC rev.
* Re-enable multi-dwb support and clean up per-DPM struct.
* Add max_downscale_src_width debugfs for IGT validation.
* Expand amdgpu_dm KUnit coverage.

Cc Dan Wheeler <[email protected]>

Alex Hung (34):
drm/amd/display: Test ISM idle commit drm/amd/display: Test ISM idle exit arms drm/amd/display: Test ISM delayed workers drm/amd/display: Test colorop error paths drm/amd/display: Model ASSERT as path terminator drm/amd/display: Test backlight caps validation drm/amd/display: Skip ACPI backlight caps test drm/amd/display: Test vblank counter and scanout position drm/amd/display: Test DM atomic private state helpers drm/amd/display: Test affected MST DSC CRTC selection drm/amd/display: Test cursor commit drm/amd/display: Test vblank event arming drm/amd/display: Test page flip interrupt state update drm/amd/display: Test CRTC memory domain change detection drm/amd/display: Test PSR dirty rectangle filling drm/amd/display: Test plane reset decision drm/amd/display: Test link and sink dump drm/amd/display: Test HDCP update drm/amd/display: Test global modeset lock acquisition drm/amd/display: Test timing sync trigger drm/amd/display: Test IP block teardown and link emulation drm/amd/display: Test mod_power stream updates on modeset drm/amd/display: Test atomic commit setup drm/amd/display: Test MMHUB config read drm/amd/display: Test power module init drm/amd/display: Test vline0 irq control drm/amd/display: Test DMCU firmware load drm/amd/display: Test SW init and fini drm/amd/display: Test DM late init drm/amd/display: Test mode and plane init drm/amd/display: Test DM early init drm/amd/display: Test DC plane info fill drm/amd/display: Test DC plane attributes drm/amd/display: Test MST VCPI slot calc

Alvin Lee (1):
drm/amd/display: Fix DPP PRE_GAM register offset on DCN60

Austin Zheng (5):
drm/amd/display: Preparations To Move DML Wrapper Out Of DML drm/amd/display: Clean up Per-DPM Struct drm/amd/display: Fix Order Of Operation In Calculate Flip Schedule drm/amd/display: Remove const Qualifier From Non-Pointer Fields drm/amd/display: Move DML Wrapper into its own Component

Dillon Varone (3):
drm/amd/display: Guard DAL port idle optimizations by ASIC rev drm/amd/display: Re-enable multi-dwb support drm/amd/display: Change RBBMIF timeout control conditions

Hansen Dsouza (1):
drm/amd/display: Add debug bit for force p2cpm

Ivan Lipski (1):
drm/amd/display: Fix DCN5/6 DML2 compilation warnings

James Lin (1):
drm/amd/display: Avoid NULL hubp deref for remaining mpcc_id
assignment

Peichen Huang (1):
drm/amd/display: Do not use panel_inst in pr

Relja Vojvodic (1):
drm/amd/display: Update HDMI link rate and DSC handling for DCN60

Roman Li (3):
drm/amd/display: Set gpuvm min page size to 4K on dcn35/36 drm/amd/display: Fix backlight control for luminance-capable OLED drm/amd/display: Apply debug bit for force p2cpm

Samson Tam (3):
drm/amd/display: Move custom float structures from opp.h to
custom_float.h
drm/amd/display: Remove fixpt and custom float duplicated code drm/amd/display: Remove internal references

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

Tom Chung (1):
drm/amd/display: Restore the native cursor mode early return for
disabled CRTCs

Tomasz Siemek (2):
drm/amd/display: Move cursor SDR white level calculation out of hwss
executor
drm/amd/display: Remove pipe_ctx param from MPC_VISUAL_CONFIRM

Tony Qi (1):
drm/amd/display: Add max_downscale_src_width debugfs for IGT
validation

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  187 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   77 +
 .../display/amdgpu_dm/amdgpu_dm_backlight.c   |   41 +-
 .../display/amdgpu_dm/amdgpu_dm_backlight.h   |    1 +
 .../amd/display/amdgpu_dm/amdgpu_dm_colorop.c |  110 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_colorop.h |   28 +
 .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c    |   40 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_crtc.h    |    1 +
 .../amd/display/amdgpu_dm/amdgpu_dm_cursor.c  |   17 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c |   20 +
 .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c |    8 +
 .../tests/amdgpu_dm_backlight_test.c          |   53 +-
 .../amdgpu_dm/tests/amdgpu_dm_colorop_test.c  |  232 +-
 .../amdgpu_dm/tests/amdgpu_dm_crtc_test.c     |  101 +
 .../amdgpu_dm/tests/amdgpu_dm_ism_test.c      |  367 +-
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 3552 +++++++++++++++++
 drivers/gpu/drm/amd/display/dc/Makefile       |    1 +
 .../display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c  |    3 +
 drivers/gpu/drm/amd/display/dc/core/dc.c      |    5 +-
 .../drm/amd/display/dc/core/dc_hw_sequencer.c |   75 +-
 .../drm/amd/display/dc/core/dc_link_exports.c |    3 +-
 .../gpu/drm/amd/display/dc/core/dc_resource.c |    2 +-
 .../gpu/drm/amd/display/dc/core/dc_state.c    |    4 +-
 drivers/gpu/drm/amd/display/dc/dc.h           |    5 +-
 drivers/gpu/drm/amd/display/dc/dc_types.h     |    3 +-
 .../drm/amd/display/dc/dml/dcn30/dcn30_fpu.c  |   18 +-
 .../drm/amd/display/dc/dml/dml1_frl_cap_chk.c |    8 +-
 .../gpu/drm/amd/display/dc/dml2_0/Makefile    |   13 +-
 .../display/dc/dml2_0/dml21/dml21_wrapper.h   |  106 -
 .../dml21/inc/dml_top_soc_parameter_types.h   |   32 +-
 .../dml2_core/dml2_core_dcn5_calcs_dchub.c    |    8 +-
 .../dml2_core_dcn5_funcs_mode_programming.c   |    4 +-
 .../dml2_core_dcn5_funcs_mode_support.c       |    5 -
 .../dml2_core/dml2_core_dcn6_calcs_dchub.c    |    4 +-
 .../dml2_core_dcn6_funcs_mode_support.c       |    4 -
 .../src/dml2_core/dml2_core_shared_types.h    |    4 +-
 .../dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c |    2 +-
 .../drm/amd/display/dc/dml2_wrapper/Makefile  |   61 +
 .../dml21_wrapper}/dml21_translation_helper.c |   15 +-
 .../dml21_wrapper}/dml21_translation_helper.h |    7 +-
 .../dml21_wrapper}/dml21_utils.c              |   11 +-
 .../dml21_wrapper}/dml21_utils.h              |    7 +-
 .../dml21_wrapper}/dml21_wrapper.c            |    2 +-
 .../dml21_wrapper/dml21_wrapper.h             |  107 +
 .../dml21_wrapper}/dml21_wrapper_fpu.c        |   19 +-
 .../dml21_wrapper}/dml21_wrapper_fpu.h        |    7 +-
 .../dml2_dc_resource_mgmt.c                   |   60 +-
 .../dml2_dc_resource_mgmt.h                   |    0
 .../{dml2_0 => dml2_wrapper}/dml2_dc_types.h  |    0
 .../dml2_internal_types.h                     |    2 +-
 .../dml2_mall_phantom.c                       |   70 +-
 .../dml2_mall_phantom.h                       |    0
 .../dc/{dml2_0 => dml2_wrapper}/dml2_policy.c |    2 +-
 .../dc/{dml2_0 => dml2_wrapper}/dml2_policy.h |    0
 .../dml2_translation_helper.c                 |   21 +-
 .../dml2_translation_helper.h                 |    0
 .../dc/{dml2_0 => dml2_wrapper}/dml2_utils.c  |   28 +-
 .../dc/{dml2_0 => dml2_wrapper}/dml2_utils.h  |    0
 .../{dml2_0 => dml2_wrapper}/dml2_wrapper.c   |    6 +-
 .../{dml2_0 => dml2_wrapper}/dml2_wrapper.h   |    0
 .../dml2_wrapper_fpu.c                        |   45 +-
 .../dml2_wrapper_fpu.h                        |    0
 .../drm/amd/display/dc/dpp/dcn50/dcn50_dpp.h  |   11 +-
 .../drm/amd/display/dc/dpp/dcn60/dcn60_dpp.h  |    7 +-
 drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c   |    8 +
 .../drm/amd/display/dc/dsc/dcn60/dcn60_dsc.c  |    4 +-
 .../hpo/dcn60/dcn60_hpo_frl_stream_encoder.c  |  131 +-
 .../amd/display/dc/hubp/dcn21/dcn21_hubp.c    |    6 +-
 .../amd/display/dc/hubp/dcn21/dcn21_hubp.h    |    2 +-
 .../amd/display/dc/hubp/dcn30/dcn30_hubp.c    |    2 +-
 .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c   |   26 +-
 .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c   |    4 -
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c |    3 +-
 .../amd/display/dc/hwss/dcn50/dcn50_hwseq.c   |    3 +-
 .../drm/amd/display/dc/hwss/hw_sequencer.h    |   11 +-
 .../gpu/drm/amd/display/dc/inc/custom_float.h |   21 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/opp.h   |   14 +-
 .../gpu/drm/amd/display/dc/inc/link_service.h |    2 +-
 .../drm/amd/display/dc/link/link_detection.c  |    2 +
 .../drm/amd/display/dc/link/link_factory.c    |    2 +-
 .../dc/link/protocols/link_dp_panel_replay.c  |   36 +-
 .../dc/link/protocols/link_dp_panel_replay.h  |    2 +-
 .../link/protocols/link_edp_panel_control.c   |   47 +-
 drivers/gpu/drm/amd/display/dc/os_types.h     |   18 +
 .../dc/resource/dcn32/dcn32_resource.c        |    2 +-
 .../dc/resource/dcn35/dcn35_resource.c        |    2 +-
 .../dc/resource/dcn351/dcn351_resource.c      |    2 +-
 .../dc/resource/dcn36/dcn36_resource.c        |    2 +-
 .../dc/resource/dcn401/dcn401_resource.c      |    2 +-
 .../dc/resource/dcn42/dcn42_resource.c        |    2 +-
 .../dc/resource/dcn42b/dcn42b_resource.c      |    2 +-
 .../dc/resource/dcn60/dcn60_resource.c        |    4 +-
 drivers/gpu/drm/amd/display/dc/sspl/Makefile  |    5 +-
 drivers/gpu/drm/amd/display/dc/sspl/dc_spl.c  |  130 +-
 .../display/dc/sspl/dc_spl_isharp_filters.c   |   10 +-
 .../display/dc/sspl/dc_spl_scl_easf_filters.c |   88 +-
 .../amd/display/dc/sspl/dc_spl_scl_filters.c  |   24 +-
 .../drm/amd/display/dc/sspl/dc_spl_types.h    |   60 +-
 .../amd/display/dc/sspl/spl_custom_float.c    |  152 -
 .../amd/display/dc/sspl/spl_custom_float.h    |   29 -
 .../drm/amd/display/dc/sspl/spl_fixpt31_32.c  |  495 ---
 .../drm/amd/display/dc/sspl/spl_fixpt31_32.h  |  526 ---
 .../drm/amd/display/dc/sspl/spl_namespace.h   |   17 +
 .../drm/amd/display/dc/sspl/spl_os_types.h    |   43 +-
 104 files changed, 5459 insertions(+), 2114 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_wrapper.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/dml2_wrapper/Makefile
 rename drivers/gpu/drm/amd/display/dc/{dml2_0/dml21 => dml2_wrapper/dml21_wrapper}/dml21_translation_helper.c (99%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0/dml21 => dml2_wrapper/dml21_wrapper}/dml21_translation_helper.h (94%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0/dml21 => dml2_wrapper/dml21_wrapper}/dml21_utils.c (99%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0/dml21 => dml2_wrapper/dml21_wrapper}/dml21_utils.h (96%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0/dml21 => dml2_wrapper/dml21_wrapper}/dml21_wrapper.c (100%)
 create mode 100644 drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml21_wrapper/dml21_wrapper.h
 rename drivers/gpu/drm/amd/display/dc/{dml2_0/dml21 => dml2_wrapper/dml21_wrapper}/dml21_wrapper_fpu.c (96%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0/dml21 => dml2_wrapper/dml21_wrapper}/dml21_wrapper_fpu.h (95%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_dc_resource_mgmt.c (96%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_dc_resource_mgmt.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_dc_types.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_internal_types.h (99%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_mall_phantom.c (97%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_mall_phantom.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_policy.c (99%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_policy.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_translation_helper.c (99%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_translation_helper.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_utils.c (98%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_utils.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_wrapper.c (97%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_wrapper.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_wrapper_fpu.c (93%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_wrapper_fpu.h (100%)
 delete mode 100644 drivers/gpu/drm/amd/display/dc/sspl/spl_custom_float.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/sspl/spl_custom_float.h
 delete mode 100644 drivers/gpu/drm/amd/display/dc/sspl/spl_fixpt31_32.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/sspl/spl_fixpt31_32.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/sspl/spl_namespace.h
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 1/59 drm/amd/display: Add debug bit for force p2cpm

From: Hansen Dsouza <[email protected]>

[WHY]
To allow per panel control of PHY settings.

[HOW]
Extend panel workaround bits and fields.

---
 drivers/gpu/drm/amd/display/dc/dc.h                            | 1 +
 drivers/gpu/drm/amd/display/dc/dc_types.h                      | 3 ++-
 .../drm/amd/display/dc/link/protocols/link_edp_panel_control.c | 3 +++
 3 files changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
index a5a9791ee100..1ccd10533e0b 100644
@@ -1321,6 +1321,7 @@ struct dc_debug_options {
 	bool enable_replay_esd_recovery;
 	uint8_t iommu_mismatch_temp_wka;
 	bool disable_dynamic_expansion_for_test_pattern;
+	bool psr_phy_force_phy_power_down_up_level_2;
 	uint32_t dml21_custom_derate_num_dpms;
 	uint32_t dml21_custom_derate_at_dpm[DML2_MAX_NUM_DPM_LVL];
 	bool override_utm_client_qc_profile;
drivers/gpu/drm/amd/display/dc/dc_types.h +2 -1
index 64b4adee36c4..01f7c9addc6c 100644
@@ -689,7 +689,8 @@ union dmcu_psr_level {
 		unsigned int SKIP_SINGLE_OTG_DISABLE:1;
 		unsigned int DISABLE_ALPM:1;
 		unsigned int ALPM_DEFAULT_PD_MODE:1;
-		unsigned int RESERVED:20;
+		unsigned int FORCE_P2CPM:1;
+		unsigned int RESERVED:19;
 	} bits;
 	unsigned int u32all;
 };
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +3 -0
index e3527b14686b..5a8b480bb9dc 100644
@@ -883,6 +883,9 @@ bool edp_setup_psr(struct dc_link *link,
 
 	psr_context->os_request_force_ffu = psr_config->os_request_force_ffu;
 
+	if (dc->debug.psr_phy_force_phy_power_down_up_level_2)
+		psr_context->psr_level.bits.FORCE_P2CPM = 1;
+
 	if (psr) {
 		link->psr_settings.psr_feature_enabled = psr->funcs->psr_copy_settings(psr,
 			link, psr_context, (uint8_t)panel_inst);
Signature · 1 line
2.43.0
author
#2 lore raw

PATCH 2/59 drm/amd/display: Test ISM idle commit

In reply to Alex Hung

[WHAT]
Add KUnit tests for the three idle-optimization commit arms of the ISM
FSM: OPTIMIZED_IDLE, OPTIMIZED_IDLE_SSO and TIMER_ABORTED.

[HOW]
Record idle changes with a stub on dc->hwss.apply_idle_power_optimizations() and read the outcome from dc->idle_optimizations_allowed.

DC already owns that callback, so it is the natural injection point. dc_allow_idle_optimizations() returns early when the requested state already matches, so the stub runs only on a real transition and its call count is the number of idle changes the FSM asked for. That count is what separates the three arms, which otherwise all leave idle in the same state.

The remaining two commit calls need no double:
dc_post_update_surfaces_to_stream() returns on !dc->optimized_required and amdgpu_dm_crtc_set_static_screen_optimze() stops in the replay and PSR event helpers when the link has neither feature enabled. Both are already no-ops on a test dc, so a double would only add upkeep.

Assisted-by Copilot:Claude-Opus-5
---
 .../amdgpu_dm/tests/amdgpu_dm_ism_test.c      | 198 +++++++++++++++++-
 1 file changed, 193 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_ism_test.c +193 -5
index 6394b967ac3a..5b348ded482f 100644
@@ -865,18 +865,14 @@ static struct amdgpu_crtc *alloc_test_acrtc(struct kunit *test,
 {
 	struct amdgpu_device *adev;
 	struct amdgpu_crtc *acrtc;
-	struct dc *dc;
 
 	adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL);
 	KUNIT_ASSERT_NOT_NULL(test, adev);
 
-	dc = kunit_kzalloc(test, sizeof(*dc), GFP_KERNEL);
-	KUNIT_ASSERT_NOT_NULL(test, dc);
-
 	acrtc = kunit_kzalloc(test, sizeof(*acrtc), GFP_KERNEL);
 	KUNIT_ASSERT_NOT_NULL(test, acrtc);
 
-	adev->dm.dc = dc;
+	adev->dm.dc = dm_kunit_alloc_dc_with_ctx(test);
 	adev->dm.ddev = &adev->ddev;
 	mutex_init(&adev->dm.dc_lock);
 
@@ -1190,6 +1186,194 @@ static void dm_test_ism_dispatch_optimized_idle_defers_sso(struct kunit *test)
 	amdgpu_dm_ism_fini(&acrtc->ism);
 }
 
+/*
+ * ===== Behavioural tests for dm_ism_commit_idle_optimization_state =====
+ *
+ * The commit path runs the real DC calls. dc_allow_idle_optimizations() only
+ * reaches hardware through dc->hwss.apply_idle_power_optimizations(), so the
+ * spy is installed there — DC's own seam — and the outcome is read back from
+ * dc->idle_optimizations_allowed. The callback fires only on an actual
+ * transition, so the call count is the number of idle state changes requested.
+ */
+
+static struct {
+	int calls;
+	bool last_allow;
+} dm_ism_test_idle;
+
+static bool dm_ism_test_apply_idle(struct dc *dc, bool allow)
+{
+	dm_ism_test_idle.calls++;
+	dm_ism_test_idle.last_allow = allow;
+
+	return true;
+}
+
+/*
+ * Initialise @acrtc's ISM against a stream with a non-NULL link (required by
+ * the static-screen arm) and make dc_allow_idle_optimizations() observable.
+ */
+static struct dc_stream_state *setup_commit_test(struct kunit *test,
+						 struct amdgpu_crtc *acrtc,
+						 struct amdgpu_dm_ism_config *config)
+{
+	struct amdgpu_device *adev = drm_to_adev(acrtc->base.dev);
+	struct dc_stream_state *stream;
+	struct dm_crtc_state *dm_state;
+	struct dal_logger *logger;
+	struct dc *dc = adev->dm.dc;
+
+	stream = dm_kunit_alloc_stream(test, dm_kunit_alloc_link(test));
+	stream->timing.v_total = 1125;
+	stream->timing.h_total = 2200;
+	stream->timing.pix_clk_100hz = 1485000;
+
+	dm_state = kunit_kzalloc(test, sizeof(*dm_state), GFP_KERNEL);
+	KUNIT_ASSERT_NOT_NULL(test, dm_state);
+	dm_state->stream = stream;
+
+	logger = kunit_kzalloc(test, sizeof(*logger), GFP_KERNEL);
+	KUNIT_ASSERT_NOT_NULL(test, logger);
+	logger->dev = &adev->ddev;
+	dc->ctx->logger = logger;
+	/* is_apu path avoids DC_LOG_DC()'s NULL-logger dereference. */
+	dc->caps.is_apu = true;
+	/* dc_allow() only calls apply() when clk_mgr is present. */
+	dc->clk_mgr = dm_kunit_alloc_clk_mgr(test);
+	dc->hwss.apply_idle_power_optimizations = dm_ism_test_apply_idle;
+	dm_ism_test_idle = (typeof(dm_ism_test_idle)){ };
+
+	amdgpu_dm_ism_init(&acrtc->ism, config);
+	acrtc->base.state = &dm_state->base;
+
+	return stream;
+}
+
+/**
+ * dm_test_ism_commit_allows_idle_on_optimized_idle - OPTIMIZED_IDLE commits idle-allow
+ * @test: KUnit test context
+ *
+ * With idle-allow filtering disabled (delay 0) ENTER_IDLE_REQUESTED cascades
+ * FULL_POWER_RUNNING -> HYSTERESIS_WAITING -> OPTIMIZED_IDLE. Because
+ * sso_num_frames >= filter_num_frames the OPTIMIZED_IDLE arm commits the idle
+ * state. With no active vblank and no SSO the commit must request allow-idle
+ * exactly once, without a preceding disallow.
+ */
+static void dm_test_ism_commit_allows_idle_on_optimized_idle(struct kunit *test)
+{
+	struct amdgpu_device *adev;
+	struct amdgpu_crtc *acrtc = alloc_test_acrtc(test, &adev);
+	struct amdgpu_dm_ism_config config = {
+		.filter_num_frames = 0,
+		.sso_num_frames = 2,
+	};
+
+	setup_commit_test(test, acrtc, &config);
+
+	scoped_guard(mutex, &adev->dm.dc_lock) {
+		amdgpu_dm_ism_commit_event(&acrtc->ism,
+					   DM_ISM_EVENT_ENTER_IDLE_REQUESTED);
+
+		KUNIT_EXPECT_EQ(test, (int)acrtc->ism.current_state,
+				(int)DM_ISM_STATE_OPTIMIZED_IDLE);
+
+		/* vblank disabled + no SSO -> a single allow-idle transition. */
+		KUNIT_EXPECT_EQ(test, dm_ism_test_idle.calls, 1);
+		KUNIT_EXPECT_TRUE(test, dm_ism_test_idle.last_allow);
+		KUNIT_EXPECT_TRUE(test, adev->dm.dc->idle_optimizations_allowed);
+
+		cancel_delayed_work(&acrtc->ism.sso_delayed_work);
+	}
+
+	amdgpu_dm_ism_fini(&acrtc->ism);
+}
+
+/**
+ * dm_test_ism_commit_enables_sso_on_optimized_idle_sso - SSO arm re-arms idle
+ * @test: KUnit test context
+ *
+ * With both idle-allow and SSO delays disabled the FSM cascades through
+ * OPTIMIZED_IDLE into OPTIMIZED_IDLE_SSO, whose arm commits with
+ * allow_panel_sso = true. Engaging SSO must first disallow idle and then
+ * re-allow it, so starting from an idle-allowed DC yields two transitions.
+ */
+static void dm_test_ism_commit_enables_sso_on_optimized_idle_sso(struct kunit *test)
+{
+	struct amdgpu_device *adev;
+	struct amdgpu_crtc *acrtc = alloc_test_acrtc(test, &adev);
+	struct amdgpu_dm_ism_config config = {
+		.filter_num_frames = 0,
+		.sso_num_frames = 0,
+	};
+
+	setup_commit_test(test, acrtc, &config);
+	adev->dm.dc->idle_optimizations_allowed = true;
+
+	scoped_guard(mutex, &adev->dm.dc_lock) {
+		amdgpu_dm_ism_commit_event(&acrtc->ism,
+					   DM_ISM_EVENT_ENTER_IDLE_REQUESTED);
+
+		KUNIT_EXPECT_EQ(test, (int)acrtc->ism.current_state,
+				(int)DM_ISM_STATE_OPTIMIZED_IDLE_SSO);
+
+		/* SSO engagement disallows idle, then re-allows it. */
+		KUNIT_EXPECT_EQ(test, dm_ism_test_idle.calls, 2);
+		KUNIT_EXPECT_TRUE(test, dm_ism_test_idle.last_allow);
+		KUNIT_EXPECT_TRUE(test, adev->dm.dc->idle_optimizations_allowed);
+	}
+
+	amdgpu_dm_ism_fini(&acrtc->ism);
+}
+
+/**
+ * dm_test_ism_commit_disallows_idle_on_timer_aborted - aborted timer disallows idle
+ * @test: KUnit test context
+ *
+ * A non-zero idle-allow delay parks the FSM in HYSTERESIS_WAITING.
+ * EXIT_IDLE_REQUESTED then drives HYSTERESIS_WAITING -> TIMER_ABORTED, whose
+ * arm commits with vblank_enabled = true: idle must be disallowed and, because
+ * vblank is active, never re-allowed. The FSM returns to FULL_POWER_RUNNING.
+ */
+static void dm_test_ism_commit_disallows_idle_on_timer_aborted(struct kunit *test)
+{
+	struct amdgpu_device *adev;
+	struct amdgpu_crtc *acrtc = alloc_test_acrtc(test, &adev);
+	struct dc_stream_state *stream;
+	struct amdgpu_dm_ism_config config = {
+		.filter_num_frames = 5,
+		.filter_entry_count = 3,
+		.activation_num_delay_frames = 10,
+		.filter_history_size = 8,
+		.filter_old_history_threshold = 0,
+		.sso_num_frames = 0,
+	};
+
+	stream = setup_commit_test(test, acrtc, &config);
+	setup_idle_delay_history(&acrtc->ism, stream);
+	adev->dm.dc->idle_optimizations_allowed = true;
+
+	scoped_guard(mutex, &adev->dm.dc_lock) {
+		/* Non-zero delay parks the FSM in HYSTERESIS_WAITING. */
+		amdgpu_dm_ism_commit_event(&acrtc->ism,
+					   DM_ISM_EVENT_ENTER_IDLE_REQUESTED);
+		KUNIT_EXPECT_EQ(test, (int)acrtc->ism.current_state,
+				(int)DM_ISM_STATE_HYSTERESIS_WAITING);
+
+		/* Abort: HYSTERESIS_WAITING -> TIMER_ABORTED -> FULL_POWER_RUNNING. */
+		amdgpu_dm_ism_commit_event(&acrtc->ism,
+					   DM_ISM_EVENT_EXIT_IDLE_REQUESTED);
+		KUNIT_EXPECT_EQ(test, (int)acrtc->ism.current_state,
+				(int)DM_ISM_STATE_FULL_POWER_RUNNING);
+
+		/* TIMER_ABORTED commit runs with vblank_enabled=true. */
+		KUNIT_EXPECT_EQ(test, dm_ism_test_idle.calls, 1);
+		KUNIT_EXPECT_FALSE(test, dm_ism_test_idle.last_allow);
+		KUNIT_EXPECT_FALSE(test, adev->dm.dc->idle_optimizations_allowed);
+	}
+
+	amdgpu_dm_ism_fini(&acrtc->ism);
+}
+
 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),
@@ -1263,6 +1447,10 @@ static struct kunit_case dm_ism_test_cases[] = {
 	/* dm_ism_dispatch_power_state (via commit_event) */
 	KUNIT_CASE(dm_test_ism_dispatch_hysteresis_schedule_and_cancel),
 	KUNIT_CASE(dm_test_ism_dispatch_optimized_idle_defers_sso),
+	/* dm_ism_commit_idle_optimization_state (behavioural, via dc->hwss) */
+	KUNIT_CASE(dm_test_ism_commit_allows_idle_on_optimized_idle),
+	KUNIT_CASE(dm_test_ism_commit_enables_sso_on_optimized_idle_sso),
+	KUNIT_CASE(dm_test_ism_commit_disallows_idle_on_timer_aborted),
 	{}
 };
 
Signature · 1 line
2.43.0
author
#3 lore raw

PATCH 3/59 drm/amd/display: Test ISM idle exit arms

In reply to Alex Hung

[WHAT]
Add KUnit tests for the OPTIMIZED_IDLE and OPTIMIZED_IDLE_SSO previous-state arms of dm_ism_dispatch_power_state().

[HOW]
Cascade into each idle state, post EXIT_IDLE_REQUESTED, then check that idle is disallowed and the idle period recorded.

These arms run on a state departure rather than on entry, so a single event cannot reach them; the FSM has to occupy the idle state first. Driving both steps through amdgpu_dm_ism_commit_event() keeps the test on the real path instead of calling the dispatcher directly.

Both arms end in FULL_POWER_RUNNING and both disallow idle, so the state alone does not tell them apart. Asserting ism->next_record_idx pins the side effect that matters: the idle period is added to the hysteresis history on the way out.

Assisted-by Copilot:Claude-Opus-5
---
 .../amdgpu_dm/tests/amdgpu_dm_ism_test.c      | 84 +++++++++++++++++++
 1 file changed, 84 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_ism_test.c +84 -0
index 5b348ded482f..76c2004224b8 100644
@@ -1374,6 +1374,87 @@ static void dm_test_ism_commit_disallows_idle_on_timer_aborted(struct kunit *tes
 	amdgpu_dm_ism_fini(&acrtc->ism);
 }
 
+/**
+ * dm_test_ism_exit_from_optimized_idle_disallows_idle - leaving OPTIMIZED_IDLE
+ * @test: KUnit test context
+ *
+ * EXIT_IDLE_REQUESTED from OPTIMIZED_IDLE runs the previous-state arm of
+ * dm_ism_dispatch_power_state(): the pending SSO worker is cancelled, the idle
+ * period is recorded and the commit runs with vblank_enabled = true, which
+ * disallows idle again.
+ */
+static void dm_test_ism_exit_from_optimized_idle_disallows_idle(struct kunit *test)
+{
+	struct amdgpu_device *adev;
+	struct amdgpu_crtc *acrtc = alloc_test_acrtc(test, &adev);
+	struct amdgpu_dm_ism_config config = {
+		.filter_num_frames = 0,
+		.sso_num_frames = 2,
+	};
+
+	setup_commit_test(test, acrtc, &config);
+
+	scoped_guard(mutex, &adev->dm.dc_lock) {
+		amdgpu_dm_ism_commit_event(&acrtc->ism,
+					   DM_ISM_EVENT_ENTER_IDLE_REQUESTED);
+		KUNIT_EXPECT_EQ(test, (int)acrtc->ism.current_state,
+				(int)DM_ISM_STATE_OPTIMIZED_IDLE);
+
+		amdgpu_dm_ism_commit_event(&acrtc->ism,
+					   DM_ISM_EVENT_EXIT_IDLE_REQUESTED);
+		KUNIT_EXPECT_EQ(test, (int)acrtc->ism.current_state,
+				(int)DM_ISM_STATE_FULL_POWER_RUNNING);
+
+		/* Allow on entry, disallow on exit. */
+		KUNIT_EXPECT_EQ(test, dm_ism_test_idle.calls, 2);
+		KUNIT_EXPECT_FALSE(test, dm_ism_test_idle.last_allow);
+		KUNIT_EXPECT_FALSE(test, adev->dm.dc->idle_optimizations_allowed);
+		/* The idle period was recorded on the way out. */
+		KUNIT_EXPECT_EQ(test, acrtc->ism.next_record_idx, 1);
+	}
+
+	amdgpu_dm_ism_fini(&acrtc->ism);
+}
+
+/**
+ * dm_test_ism_exit_from_sso_disallows_idle - leaving OPTIMIZED_IDLE_SSO
+ * @test: KUnit test context
+ *
+ * EXIT_IDLE_REQUESTED from OPTIMIZED_IDLE_SSO runs the SSO previous-state arm:
+ * the idle period is recorded and the commit disallows idle. Unlike the
+ * OPTIMIZED_IDLE arm there is no pending SSO worker left to cancel.
+ */
+static void dm_test_ism_exit_from_sso_disallows_idle(struct kunit *test)
+{
+	struct amdgpu_device *adev;
+	struct amdgpu_crtc *acrtc = alloc_test_acrtc(test, &adev);
+	struct amdgpu_dm_ism_config config = {
+		.filter_num_frames = 0,
+		.sso_num_frames = 0,
+	};
+
+	setup_commit_test(test, acrtc, &config);
+
+	scoped_guard(mutex, &adev->dm.dc_lock) {
+		amdgpu_dm_ism_commit_event(&acrtc->ism,
+					   DM_ISM_EVENT_ENTER_IDLE_REQUESTED);
+		KUNIT_EXPECT_EQ(test, (int)acrtc->ism.current_state,
+				(int)DM_ISM_STATE_OPTIMIZED_IDLE_SSO);
+
+		amdgpu_dm_ism_commit_event(&acrtc->ism,
+					   DM_ISM_EVENT_EXIT_IDLE_REQUESTED);
+		KUNIT_EXPECT_EQ(test, (int)acrtc->ism.current_state,
+				(int)DM_ISM_STATE_FULL_POWER_RUNNING);
+
+		KUNIT_EXPECT_EQ(test, dm_ism_test_idle.calls, 2);
+		KUNIT_EXPECT_FALSE(test, dm_ism_test_idle.last_allow);
+		KUNIT_EXPECT_FALSE(test, adev->dm.dc->idle_optimizations_allowed);
+		KUNIT_EXPECT_EQ(test, acrtc->ism.next_record_idx, 1);
+	}
+
+	amdgpu_dm_ism_fini(&acrtc->ism);
+}
+
 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),
@@ -1451,6 +1532,9 @@ static struct kunit_case dm_ism_test_cases[] = {
 	KUNIT_CASE(dm_test_ism_commit_allows_idle_on_optimized_idle),
 	KUNIT_CASE(dm_test_ism_commit_enables_sso_on_optimized_idle_sso),
 	KUNIT_CASE(dm_test_ism_commit_disallows_idle_on_timer_aborted),
+	/* dm_ism_dispatch_power_state previous-state arms */
+	KUNIT_CASE(dm_test_ism_exit_from_optimized_idle_disallows_idle),
+	KUNIT_CASE(dm_test_ism_exit_from_sso_disallows_idle),
 	{}
 };
 
Signature · 1 line
2.43.0
author
#4 lore raw

PATCH 4/59 drm/amd/display: Test ISM delayed workers

In reply to Alex Hung

[WHAT]
Add KUnit tests for dm_ism_delayed_work_func() and dm_ism_sso_delayed_work_func().

[HOW]
Arm each worker through the FSM, drop dc_lock, then run the handler with flush_delayed_work().

Assisted-by Copilot:Claude-Opus-5
---
 .../amdgpu_dm/tests/amdgpu_dm_ism_test.c      | 85 +++++++++++++++++++
 1 file changed, 85 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_ism_test.c +85 -0
index 76c2004224b8..b77df47d3095 100644
@@ -1455,6 +1455,88 @@ static void dm_test_ism_exit_from_sso_disallows_idle(struct kunit *test)
 	amdgpu_dm_ism_fini(&acrtc->ism);
 }
 
+/**
+ * dm_test_ism_delayed_work_runs_timer_elapsed - hysteresis worker fires
+ * @test: KUnit test context
+ *
+ * A non-zero idle-allow delay parks the FSM in HYSTERESIS_WAITING and arms the
+ * hysteresis worker. Flushing it runs dm_ism_delayed_work_func(), which takes
+ * dc_lock itself and posts TIMER_ELAPSED, cascading to OPTIMIZED_IDLE_SSO
+ * because the SSO delay is zero. The flush must happen without dc_lock held.
+ */
+static void dm_test_ism_delayed_work_runs_timer_elapsed(struct kunit *test)
+{
+	struct amdgpu_device *adev;
+	struct amdgpu_crtc *acrtc = alloc_test_acrtc(test, &adev);
+	struct dc_stream_state *stream;
+	struct amdgpu_dm_ism_config config = {
+		.filter_num_frames = 5,
+		.filter_entry_count = 3,
+		.activation_num_delay_frames = 10,
+		.filter_history_size = 8,
+		.filter_old_history_threshold = 0,
+		.sso_num_frames = 0,
+	};
+
+	stream = setup_commit_test(test, acrtc, &config);
+	setup_idle_delay_history(&acrtc->ism, stream);
+
+	scoped_guard(mutex, &adev->dm.dc_lock) {
+		amdgpu_dm_ism_commit_event(&acrtc->ism,
+					   DM_ISM_EVENT_ENTER_IDLE_REQUESTED);
+		KUNIT_EXPECT_EQ(test, (int)acrtc->ism.current_state,
+				(int)DM_ISM_STATE_HYSTERESIS_WAITING);
+		KUNIT_EXPECT_EQ(test, dm_ism_test_idle.calls, 0);
+	}
+
+	flush_delayed_work(&acrtc->ism.delayed_work);
+
+	KUNIT_EXPECT_EQ(test, (int)acrtc->ism.current_state,
+			(int)DM_ISM_STATE_OPTIMIZED_IDLE_SSO);
+	KUNIT_EXPECT_EQ(test, dm_ism_test_idle.calls, 1);
+	KUNIT_EXPECT_TRUE(test, adev->dm.dc->idle_optimizations_allowed);
+
+	amdgpu_dm_ism_fini(&acrtc->ism);
+}
+
+/**
+ * dm_test_ism_sso_delayed_work_runs_sso_elapsed - SSO worker fires
+ * @test: KUnit test context
+ *
+ * With sso_num_frames >= filter_num_frames the OPTIMIZED_IDLE arm allows idle
+ * and arms the SSO worker. Flushing it runs dm_ism_sso_delayed_work_func(),
+ * which posts SSO_TIMER_ELAPSED; engaging SSO disallows and re-allows idle, so
+ * two further transitions follow the initial allow.
+ */
+static void dm_test_ism_sso_delayed_work_runs_sso_elapsed(struct kunit *test)
+{
+	struct amdgpu_device *adev;
+	struct amdgpu_crtc *acrtc = alloc_test_acrtc(test, &adev);
+	struct amdgpu_dm_ism_config config = {
+		.filter_num_frames = 0,
+		.sso_num_frames = 2,
+	};
+
+	setup_commit_test(test, acrtc, &config);
+
+	scoped_guard(mutex, &adev->dm.dc_lock) {
+		amdgpu_dm_ism_commit_event(&acrtc->ism,
+					   DM_ISM_EVENT_ENTER_IDLE_REQUESTED);
+		KUNIT_EXPECT_EQ(test, (int)acrtc->ism.current_state,
+				(int)DM_ISM_STATE_OPTIMIZED_IDLE);
+		KUNIT_EXPECT_EQ(test, dm_ism_test_idle.calls, 1);
+	}
+
+	flush_delayed_work(&acrtc->ism.sso_delayed_work);
+
+	KUNIT_EXPECT_EQ(test, (int)acrtc->ism.current_state,
+			(int)DM_ISM_STATE_OPTIMIZED_IDLE_SSO);
+	KUNIT_EXPECT_EQ(test, dm_ism_test_idle.calls, 3);
+	KUNIT_EXPECT_TRUE(test, adev->dm.dc->idle_optimizations_allowed);
+
+	amdgpu_dm_ism_fini(&acrtc->ism);
+}
+
 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),
@@ -1535,6 +1617,9 @@ static struct kunit_case dm_ism_test_cases[] = {
 	/* dm_ism_dispatch_power_state previous-state arms */
 	KUNIT_CASE(dm_test_ism_exit_from_optimized_idle_disallows_idle),
 	KUNIT_CASE(dm_test_ism_exit_from_sso_disallows_idle),
+	/* dm_ism_delayed_work_func / dm_ism_sso_delayed_work_func */
+	KUNIT_CASE(dm_test_ism_delayed_work_runs_timer_elapsed),
+	KUNIT_CASE(dm_test_ism_sso_delayed_work_runs_sso_elapsed),
 	{}
 };
 
Signature · 1 line
2.43.0
author
#5 lore raw

PATCH 5/59 drm/amd/display: Test colorop error paths

In reply to Alex Hung

[WHAT]
Add KUnit tests for the failure paths of amdgpu_dm_build_default_pipeline(): a failed allocation and a failed initialization at each of the eight pipeline steps.

[HOW]
Add struct amdgpu_dm_colorop_kunit_ops, a KUnit-only indirection table for the colorop allocation and the five DRM colorop constructors. The constructors cannot be made to fail through their arguments, so tests install a fake allocator and spies that delegate to the real constructors and override the return value of one selected call. Non-KUnit builds call the same functions directly.

Assisted-by Copilot:Claude-Opus-5
---
 .../amd/display/amdgpu_dm/amdgpu_dm_colorop.c | 110 ++++++---
 .../amd/display/amdgpu_dm/amdgpu_dm_colorop.h |  28 +++
 .../amdgpu_dm/tests/amdgpu_dm_colorop_test.c  | 232 ++++++++++++++++--
 3 files changed, 312 insertions(+), 58 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c +75 -35
index fae9007b9998..d7260518a23e 100644
@@ -63,6 +63,48 @@ static const struct drm_colorop_funcs dm_colorop_funcs = {
 	.destroy = drm_colorop_destroy,
 };
 
+#if IS_ENABLED(CONFIG_DRM_AMD_DC_KUNIT_TEST)
+static struct drm_colorop *amdgpu_dm_colorop_kzalloc(void)
+{
+	return kzalloc_obj(struct drm_colorop);
+}
+
+static const struct amdgpu_dm_colorop_kunit_ops amdgpu_dm_colorop_default_ops = {
+	.colorop_kzalloc_obj = amdgpu_dm_colorop_kzalloc,
+	.curve_1d_init = drm_plane_colorop_curve_1d_init,
+	.curve_1d_lut_init = drm_plane_colorop_curve_1d_lut_init,
+	.ctm_3x4_init = drm_plane_colorop_ctm_3x4_init,
+	.mult_init = drm_plane_colorop_mult_init,
+	.lut3d_init = drm_plane_colorop_3dlut_init,
+};
+
+static const struct amdgpu_dm_colorop_kunit_ops *amdgpu_dm_colorop_ops =
+	&amdgpu_dm_colorop_default_ops;
+
+void amdgpu_dm_colorop_kunit_set_ops(const struct amdgpu_dm_colorop_kunit_ops *ops)
+{
+	amdgpu_dm_colorop_ops = ops ? ops : &amdgpu_dm_colorop_default_ops;
+}
+EXPORT_IF_KUNIT(amdgpu_dm_colorop_kunit_set_ops);
+
+#define colorop_kzalloc_obj		amdgpu_dm_colorop_ops->colorop_kzalloc_obj
+#define colorop_curve_1d_init		amdgpu_dm_colorop_ops->curve_1d_init
+#define colorop_curve_1d_lut_init	amdgpu_dm_colorop_ops->curve_1d_lut_init
+#define colorop_ctm_3x4_init		amdgpu_dm_colorop_ops->ctm_3x4_init
+#define colorop_mult_init		amdgpu_dm_colorop_ops->mult_init
+#define colorop_3dlut_init		amdgpu_dm_colorop_ops->lut3d_init
+
+#else
+
+#define colorop_kzalloc_obj()		kzalloc_obj(struct drm_colorop)
+#define colorop_curve_1d_init		drm_plane_colorop_curve_1d_init
+#define colorop_curve_1d_lut_init	drm_plane_colorop_curve_1d_lut_init
+#define colorop_ctm_3x4_init		drm_plane_colorop_ctm_3x4_init
+#define colorop_mult_init		drm_plane_colorop_mult_init
+#define colorop_3dlut_init		drm_plane_colorop_3dlut_init
+
+#endif
+
 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)
@@ -74,15 +116,15 @@ amdgpu_dm_build_default_pipeline(struct drm_device *dev, struct drm_plane *plane
 	memset(ops, 0, sizeof(ops));
 
 	/* 1D curve - DEGAM TF */
-	ops[i] = kzalloc_obj(*ops[0]);
+	ops[i] = colorop_kzalloc_obj();
 	if (!ops[i]) {
 		ret = -ENOMEM;
 		goto cleanup;
 	}
 
-	ret = drm_plane_colorop_curve_1d_init(dev, ops[i], plane, &dm_colorop_funcs,
-					      amdgpu_dm_supported_degam_tfs,
-					      DRM_COLOROP_FLAG_ALLOW_BYPASS);
+	ret = colorop_curve_1d_init(dev, ops[i], plane, &dm_colorop_funcs,
+				    amdgpu_dm_supported_degam_tfs,
+				    DRM_COLOROP_FLAG_ALLOW_BYPASS);
 	if (ret)
 		goto cleanup;
 
@@ -91,14 +133,14 @@ amdgpu_dm_build_default_pipeline(struct drm_device *dev, struct drm_plane *plane
 	i++;
 
 	/* Multiplier */
-	ops[i] = kzalloc_obj(struct drm_colorop);
+	ops[i] = colorop_kzalloc_obj();
 	if (!ops[i]) {
 		ret = -ENOMEM;
 		goto cleanup;
 	}
 
-	ret = drm_plane_colorop_mult_init(dev, ops[i], plane, &dm_colorop_funcs,
-					  DRM_COLOROP_FLAG_ALLOW_BYPASS);
+	ret = colorop_mult_init(dev, ops[i], plane, &dm_colorop_funcs,
+				DRM_COLOROP_FLAG_ALLOW_BYPASS);
 	if (ret)
 		goto cleanup;
 
@@ -107,15 +149,14 @@ amdgpu_dm_build_default_pipeline(struct drm_device *dev, struct drm_plane *plane
 	i++;
 
 	/* 3x4 matrix */
-	ops[i] = kzalloc_obj(struct drm_colorop);
+	ops[i] = colorop_kzalloc_obj();
 	if (!ops[i]) {
 		ret = -ENOMEM;
 		goto cleanup;
 	}
 
-	ret = drm_plane_colorop_ctm_3x4_init(dev, ops[i], plane,
-					     &dm_colorop_funcs,
-					     DRM_COLOROP_FLAG_ALLOW_BYPASS);
+	ret = colorop_ctm_3x4_init(dev, ops[i], plane, &dm_colorop_funcs,
+				   DRM_COLOROP_FLAG_ALLOW_BYPASS);
 	if (ret)
 		goto cleanup;
 
@@ -125,15 +166,15 @@ amdgpu_dm_build_default_pipeline(struct drm_device *dev, struct drm_plane *plane
 
 	if (hw_3d_lut) {
 		/* 1D curve - SHAPER TF */
-		ops[i] = kzalloc_obj(*ops[0]);
+		ops[i] = colorop_kzalloc_obj();
 		if (!ops[i]) {
 			ret = -ENOMEM;
 			goto cleanup;
 		}
 
-		ret = drm_plane_colorop_curve_1d_init(dev, ops[i], plane, &dm_colorop_funcs,
-						amdgpu_dm_supported_shaper_tfs,
-						DRM_COLOROP_FLAG_ALLOW_BYPASS);
+		ret = colorop_curve_1d_init(dev, ops[i], plane, &dm_colorop_funcs,
+					    amdgpu_dm_supported_shaper_tfs,
+					    DRM_COLOROP_FLAG_ALLOW_BYPASS);
 		if (ret)
 			goto cleanup;
 
@@ -142,17 +183,16 @@ amdgpu_dm_build_default_pipeline(struct drm_device *dev, struct drm_plane *plane
 		i++;
 
 		/* 1D LUT - SHAPER LUT */
-		ops[i] = kzalloc_obj(*ops[0]);
+		ops[i] = colorop_kzalloc_obj();
 		if (!ops[i]) {
 			ret = -ENOMEM;
 			goto cleanup;
 		}
 
-		ret = drm_plane_colorop_curve_1d_lut_init(dev, ops[i], plane,
-							&dm_colorop_funcs,
-							MAX_COLOR_LUT_ENTRIES,
-							DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR,
-							DRM_COLOROP_FLAG_ALLOW_BYPASS);
+		ret = colorop_curve_1d_lut_init(dev, ops[i], plane, &dm_colorop_funcs,
+						MAX_COLOR_LUT_ENTRIES,
+						DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR,
+						DRM_COLOROP_FLAG_ALLOW_BYPASS);
 		if (ret)
 			goto cleanup;
 
@@ -161,16 +201,16 @@ amdgpu_dm_build_default_pipeline(struct drm_device *dev, struct drm_plane *plane
 		i++;
 
 		/* 3D LUT */
-		ops[i] = kzalloc_obj(*ops[0]);
+		ops[i] = colorop_kzalloc_obj();
 		if (!ops[i]) {
 			ret = -ENOMEM;
 			goto cleanup;
 		}
 
-		ret = drm_plane_colorop_3dlut_init(dev, ops[i], plane,
-					&dm_colorop_funcs, LUT3D_SIZE,
-					DRM_COLOROP_LUT3D_INTERPOLATION_TETRAHEDRAL,
-					DRM_COLOROP_FLAG_ALLOW_BYPASS);
+		ret = colorop_3dlut_init(dev, ops[i], plane, &dm_colorop_funcs,
+					 LUT3D_SIZE,
+					 DRM_COLOROP_LUT3D_INTERPOLATION_TETRAHEDRAL,
+					 DRM_COLOROP_FLAG_ALLOW_BYPASS);
 		if (ret)
 			goto cleanup;
 
@@ -180,15 +220,15 @@ amdgpu_dm_build_default_pipeline(struct drm_device *dev, struct drm_plane *plane
 	}
 
 	/* 1D curve - BLND TF */
-	ops[i] = kzalloc_obj(*ops[0]);
+	ops[i] = colorop_kzalloc_obj();
 	if (!ops[i]) {
 		ret = -ENOMEM;
 		goto cleanup;
 	}
 
-	ret = drm_plane_colorop_curve_1d_init(dev, ops[i], plane, &dm_colorop_funcs,
-					      amdgpu_dm_supported_blnd_tfs,
-					      DRM_COLOROP_FLAG_ALLOW_BYPASS);
+	ret = colorop_curve_1d_init(dev, ops[i], plane, &dm_colorop_funcs,
+				    amdgpu_dm_supported_blnd_tfs,
+				    DRM_COLOROP_FLAG_ALLOW_BYPASS);
 	if (ret)
 		goto cleanup;
 
@@ -197,16 +237,16 @@ amdgpu_dm_build_default_pipeline(struct drm_device *dev, struct drm_plane *plane
 	i++;
 
 	/* 1D LUT - BLND LUT */
-	ops[i] = kzalloc_obj(struct drm_colorop);
+	ops[i] = colorop_kzalloc_obj();
 	if (!ops[i]) {
 		ret = -ENOMEM;
 		goto cleanup;
 	}
 
-	ret = drm_plane_colorop_curve_1d_lut_init(dev, ops[i], plane, &dm_colorop_funcs,
-						  MAX_COLOR_LUT_ENTRIES,
-						  DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR,
-						  DRM_COLOROP_FLAG_ALLOW_BYPASS);
+	ret = colorop_curve_1d_lut_init(dev, ops[i], plane, &dm_colorop_funcs,
+					MAX_COLOR_LUT_ENTRIES,
+					DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR,
+					DRM_COLOROP_FLAG_ALLOW_BYPASS);
 	if (ret)
 		goto cleanup;
 
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.h +28 -0
index 77364d954d3b..ff46c4f7b126 100644
@@ -34,8 +34,36 @@ 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)
+#include <drm/drm_colorop.h>
+
+struct amdgpu_dm_colorop_kunit_ops {
+	struct drm_colorop *(*colorop_kzalloc_obj)(void);
+	int (*curve_1d_init)(struct drm_device *dev, struct drm_colorop *colorop,
+			     struct drm_plane *plane, const struct drm_colorop_funcs *funcs,
+			     u64 supported_tfs, uint32_t flags);
+	int (*curve_1d_lut_init)(struct drm_device *dev, struct drm_colorop *colorop,
+				 struct drm_plane *plane,
+				 const struct drm_colorop_funcs *funcs,
+				 uint32_t lut_size,
+				 enum drm_colorop_lut1d_interpolation_type interpolation,
+				 uint32_t flags);
+	int (*ctm_3x4_init)(struct drm_device *dev, struct drm_colorop *colorop,
+			    struct drm_plane *plane, const struct drm_colorop_funcs *funcs,
+			    uint32_t flags);
+	int (*mult_init)(struct drm_device *dev, struct drm_colorop *colorop,
+			 struct drm_plane *plane, const struct drm_colorop_funcs *funcs,
+			 uint32_t flags);
+	int (*lut3d_init)(struct drm_device *dev, struct drm_colorop *colorop,
+			  struct drm_plane *plane,
+			  const struct drm_colorop_funcs *funcs,
+			  uint32_t lut_size,
+			  enum drm_colorop_lut3d_interpolation_type interpolation,
+			  uint32_t flags);
+};
+
 int amdgpu_dm_build_default_pipeline(struct drm_device *dev, struct drm_plane *plane,
 				      bool hw_3d_lut, struct drm_prop_enum_list *list);
+void amdgpu_dm_colorop_kunit_set_ops(const struct amdgpu_dm_colorop_kunit_ops *ops);
 #endif
 
 #endif /* __AMDGPU_DM_COLOROP_H__*/
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_colorop_test.c +209 -23

261 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#6 lore raw

PATCH 6/59 drm/amd/display: Fix DCN5/6 DML2 compilation warnings

In reply to Alex Hung

From: Ivan Lipski <[email protected]>

[WHY]
A kernel compilation warning was reported caused by upstream of DCN5/6.

[HOW]
Using plain integer as NULL pointer. Assign NULL to the VActiveLatencyHidingMargin/VActiveLatencyHidingUs pointer members in dml2_core_dcn5_funcs_mode_programming.c, and pass NULL for the pointer arguments to calculate_first_second_splitting() in dml2_pmo_dcn6_stage_optimizers.c.

Fixes 7f7d7ea1fa51 ("drm/amd/display: Add new sources for DCN6")
---
 .../src/dml2_core/dml2_core_dcn5_funcs_mode_programming.c     | 4 ++--
 .../dml21/src/dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c       | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn5_funcs_mode_programming.c +2 -2
index 8497eaea012e..297e21e7c68d 100644
@@ -1128,8 +1128,8 @@ static bool dcn5_mode_programming(struct dml2_core_calcs_mode_programming_ex *in
 		CalculateWatermarks_params->USRRetrainingSupport = &mode_lib->mp.USRRetrainingSupport;
 		CalculateWatermarks_params->temp_read_or_ppt_support = mode_lib->mp.temp_read_or_ppt_support;
 		CalculateWatermarks_params->global_temp_read_or_ppt_supported = &mode_lib->mp.global_temp_read_or_ppt_supported;
-		CalculateWatermarks_params->VActiveLatencyHidingMargin = 0;
-		CalculateWatermarks_params->VActiveLatencyHidingUs = 0;
+		CalculateWatermarks_params->VActiveLatencyHidingMargin = NULL;
+		CalculateWatermarks_params->VActiveLatencyHidingUs = NULL;
 
 		dcn5_calculate_watermarks_and_dram_speed_change_support(&mode_lib->scratch, CalculateWatermarks_params);
 
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c +1 -1
index 0b884a8661c8..6d6611a6b5a6 100644
@@ -1414,7 +1414,7 @@ static bool find_shift_for_valid_cache_id_assignment(const int *mcache_boundarie
 		success = true;
 		for (pipe_index = 0; pipe_index < pipe_count; pipe_index++) {
 			if (!calculate_first_second_splitting(mcache_boundaries, num_boundaries, *shift,
-				pipe_vp_startx[pipe_index], pipe_vp_endx[pipe_index], 0, 0)) {
+				pipe_vp_startx[pipe_index], pipe_vp_endx[pipe_index], NULL, NULL)) {
 				success = false;
 				break;
 			}
Signature · 1 line
2.43.0
author
#7 lore raw

PATCH 7/59 drm/amd/display: Set gpuvm min page size to 4K on dcn35/36

In reply to Alex Hung

From: Roman Li <[email protected]>

[WHY]
Splash screen corruption on some 8K monitors.

[HOW]
Set GPUVM min page size to 4K for DCN35/36 to use the correct DML2 calculations, avoiding the corruption path observed during splash.

Fixes 115009d11ccf ("drm/amd/display: Add DCN35 DML2 support")
Cc Mario Limonciello <[email protected]>
Cc Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/display/dc/dml2_0/dml2_translation_helper.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/dc/dml2_0/dml2_translation_helper.c +1 -0
index 166f10b8862f..c82886323a51 100644
@@ -301,6 +301,7 @@ void dml2_init_socbb_params(struct dml2_context *dml2, const struct dc *in_dc, s
 		out->smn_latency_us = 2;
 		out->dispclk_dppclk_vco_speed_mhz = 3600;
 		out->pct_ideal_dram_bw_after_urgent_pixel_only = 65.0;
+		out->gpuvm_min_page_size_kbytes = 4;
 		break;
 
 
Signature · 1 line
2.43.0
author
#8 lore raw

PATCH 8/59 drm/amd/display: Move custom float structures from opp.h to custom_float.h

In reply to Alex Hung

From: Samson Tam <[email protected]>

[WHY]
Currently it needs to include opp.h to access custom_float structures, which pulls in additional include files that are not necessary.

[HOW]
Move custom_float structures to custom_float.h, and include this header in opp.h. Add only os_types.h and fixed31_32.h in custom_float.h

---
 .../gpu/drm/amd/display/dc/inc/custom_float.h | 21 ++++++++++++++++---
 drivers/gpu/drm/amd/display/dc/inc/hw/opp.h   | 14 +------------
 2 files changed, 19 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/display/dc/inc/custom_float.h +18 -3
index f57239672216..897759a041e4 100644
@@ -26,10 +26,25 @@
 #ifndef CUSTOM_FLOAT_H_
 #define CUSTOM_FLOAT_H_
 
-#include "bw_fixed.h"
-#include "hw_shared.h"
-#include "opp.h"
+#include "os_types.h"    /* uint32_t, bool */
+#include "fixed31_32.h"  /* struct fixed31_32 (used by value) */
 
+/*
+ * Moved here from opp.h so consumers of custom-float do not have to pull in the
+ * heavy opp.h
+ */
+struct custom_float_format {
+	uint32_t mantissa_bits;
+	uint32_t exponenta_bits;
+	bool sign;
+};
+
+struct custom_float_value {
+	uint32_t mantissa;
+	uint32_t exponenta;
+	uint32_t value;
+	bool negative;
+};
 
 bool convert_to_custom_float_format(
 	struct fixed31_32 value,
drivers/gpu/drm/amd/display/dc/inc/hw/opp.h +1 -13
index 73cc34ea7726..f2d16d88b0bc 100644
@@ -43,6 +43,7 @@
 #define __DAL_OPP_H__
 
 #include "hw_shared.h"
+#include "../custom_float.h"
 #include "dc_hw_types.h"
 #include "transform.h"
 #include "mpc.h"
@@ -142,19 +143,6 @@ enum channel_name {
 	CHANNEL_NAME_BLUE
 };
 
-struct custom_float_format {
-	uint32_t mantissa_bits;
-	uint32_t exponenta_bits;
-	bool sign;
-};
-
-struct custom_float_value {
-	uint32_t mantissa;
-	uint32_t exponenta;
-	uint32_t value;
-	bool negative;
-};
-
 struct hw_x_point {
 	uint32_t custom_float_x;
 	struct fixed31_32 x;
Signature · 1 line
2.43.0
author
#9 lore raw

PATCH 9/59 drm/amd/display: Avoid NULL hubp deref for remaining mpcc_id assignment

In reply to Alex Hung

From: James Lin <[email protected]>

Previous fix converted most mpcc_id assignments in dc_hw_sequencer.c from pipe_ctx->plane_res.hubp->inst to plane_res.mpcc_inst, but missed the update_visual_confirm and power_on_mpc_mem_pwr paths in hwss_build_fast_sequence(). On DCE ASICs the pipe owns no HUBP, so those two remaining hubp->inst reads can NULL-deref.

Use mpcc_inst for the remaining two assignments, matching the rest of the function and avoiding the NULL pointer dereference (same issue addressed upstream by "avoid NULL hubp deref when filling mpcc_id on DCE").

Fixes f0b207067bb3 ("drm/amd/display: Use mpcc_id instead of hubp instance")
---
 drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +2 -2
index 8b723c3ca933..47320ac01711 100644
@@ -1610,13 +1610,13 @@ void hwss_build_fast_sequence(struct dc *dc,
 				dc->hwss.update_visual_confirm_color) {
 				block_sequence[*num_steps].params.update_visual_confirm_params.dc = dc;
 				block_sequence[*num_steps].params.update_visual_confirm_params.pipe_ctx = current_mpc_pipe;
-				block_sequence[*num_steps].params.update_visual_confirm_params.mpcc_id = current_mpc_pipe->plane_res.hubp->inst;
+				block_sequence[*num_steps].params.update_visual_confirm_params.mpcc_id = current_mpc_pipe->plane_res.mpcc_inst;
 				block_sequence[*num_steps].func = MPC_UPDATE_VISUAL_CONFIRM;
 				(*num_steps)++;
 			}
 			if (current_mpc_pipe->stream->update_flags.bits.out_csc) {
 				block_sequence[*num_steps].params.power_on_mpc_mem_pwr_params.mpc = dc->res_pool->mpc;
-				block_sequence[*num_steps].params.power_on_mpc_mem_pwr_params.mpcc_id = current_mpc_pipe->plane_res.hubp->inst;
+				block_sequence[*num_steps].params.power_on_mpc_mem_pwr_params.mpcc_id = current_mpc_pipe->plane_res.mpcc_inst;
 				block_sequence[*num_steps].params.power_on_mpc_mem_pwr_params.power_on = true;
 				block_sequence[*num_steps].func = MPC_POWER_ON_MPC_MEM_PWR;
 				(*num_steps)++;
Signature · 1 line
2.43.0
author
#10 lore raw

PATCH 10/59 drm/amd/display: Remove fixpt and custom float duplicated code

In reply to Alex Hung

From: Samson Tam <[email protected]>

[WHY/HOW]
fixpt31_32 and custom_float code is duplicated in SPL Remove duplicated code and refer back to dc Cleaned up swap, div64_s64
Move namespace defines to spl_namespace.h

---
 drivers/gpu/drm/amd/display/dc/sspl/Makefile  |   5 +-
 drivers/gpu/drm/amd/display/dc/sspl/dc_spl.c  | 130 +++--
 .../display/dc/sspl/dc_spl_isharp_filters.c   |  10 +-
 .../display/dc/sspl/dc_spl_scl_easf_filters.c |  88 +--
 .../amd/display/dc/sspl/dc_spl_scl_filters.c  |  24 +-
 .../drm/amd/display/dc/sspl/dc_spl_types.h    |  60 +-
 .../amd/display/dc/sspl/spl_custom_float.c    | 152 -----
 .../amd/display/dc/sspl/spl_custom_float.h    |  29 -
 .../drm/amd/display/dc/sspl/spl_fixpt31_32.c  | 495 ----------------
 .../drm/amd/display/dc/sspl/spl_fixpt31_32.h  | 526 ------------------
 .../drm/amd/display/dc/sspl/spl_namespace.h   |  17 +
 .../drm/amd/display/dc/sspl/spl_os_types.h    |  43 +-
 12 files changed, 213 insertions(+), 1366 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/display/dc/sspl/spl_custom_float.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/sspl/spl_custom_float.h
 delete mode 100644 drivers/gpu/drm/amd/display/dc/sspl/spl_fixpt31_32.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/sspl/spl_fixpt31_32.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/sspl/spl_namespace.h
drivers/gpu/drm/amd/display/dc/sspl/Makefile +4 -1
index 5e3e4aa13820..fdf37a2408be 100644
@@ -23,7 +23,10 @@
 # Makefile for the 'spl' sub-component of DAL.
 # It provides the scaling library interface.
 
-SPL = dc_spl.o dc_spl_scl_filters.o dc_spl_scl_easf_filters.o dc_spl_isharp_filters.o dc_spl_filters.o spl_fixpt31_32.o spl_custom_float.o
+# spl_fixpt31_32 and spl_custom_float are now provided by the host driver
+# (dc_fixpt_* / convert_to_custom_float_format) via the shim headers
+# spl_fixpt31_32.h / spl_custom_float.h.
+SPL = dc_spl.o dc_spl_scl_filters.o dc_spl_scl_easf_filters.o dc_spl_isharp_filters.o dc_spl_filters.o
 
 AMD_DAL_SPL = $(addprefix $(AMDDALPATH)/dc/sspl/,$(SPL))
 
drivers/gpu/drm/amd/display/dc/sspl/dc_spl.c +72 -58

227 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/sspl/dc_spl_isharp_filters.c +5 -5
index a75ab23b0726..66f0e9d971be 100644
@@ -367,8 +367,8 @@ static unsigned int spl_calculate_sharpness_level_adj(struct spl_fixed31_32 rati
 	sharpness_level_down_adj = 0;
 	lookup_ptr = sharpness_level_adj;
 	while (j < NUM_SHARPNESS_ADJ_LEVELS) {
-		ratio_level = SPL_NAMESPACE(spl_fixpt_from_fraction(lookup_ptr->ratio_numer,
-			lookup_ptr->ratio_denom));
+		ratio_level = spl_fixpt_from_fraction(lookup_ptr->ratio_numer,
+			lookup_ptr->ratio_denom);
 		if (ratio.value >= ratio_level.value) {
 			sharpness_level_down_adj = lookup_ptr->level_down_adj;
 			break;
@@ -462,7 +462,7 @@ void SPL_NAMESPACE(spl_build_isharp_1dlut_from_reference_curve(
 	unsigned int sharpnessX1000 = spl_calculate_sharpness_level(ratio,
 			sharpness.sharpness_level, setup,
 			sharpness.sharpness_range, scale_to_sharpness_policy);
-	sharp_level = SPL_NAMESPACE(spl_fixpt_from_fraction(sharpnessX1000, 1000));
+	sharp_level = spl_fixpt_from_fraction(sharpnessX1000, 1000);
 
 	/*
 	 * Check if pregen 1dlut table is already precalculated
@@ -487,11 +487,11 @@ void SPL_NAMESPACE(spl_build_isharp_1dlut_from_reference_curve(
 	memset(byte_ptr_1dlut_dst, 0, size_1dlut);
 	for (j = 0; j < size_1dlut; j++) {
 		sharp_base = spl_fixpt_from_int((int)*byte_ptr_1dlut_src);
-		sharp_calc = SPL_NAMESPACE(spl_fixpt_mul(sharp_base, sharp_level));
+		sharp_calc = spl_fixpt_mul(sharp_base, sharp_level);
 		sharp_calc = spl_fixpt_div(sharp_calc, spl_fixpt_from_int(3));
 		sharp_calc = spl_fixpt_min(spl_fixpt_from_int(255), sharp_calc);
 		sharp_calc = spl_fixpt_add(sharp_calc,
-			SPL_NAMESPACE(spl_fixpt_from_fraction(1, 2)));
+			spl_fixpt_from_fraction(1, 2));
 		sharp_calc_int = spl_fixpt_floor(sharp_calc);
 		/* Clamp it at 0x7F so it doesn't wrap */
 		if (sharp_calc_int > 127)
drivers/gpu/drm/amd/display/dc/sspl/dc_spl_scl_easf_filters.c +44 -44

167 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/sspl/dc_spl_scl_filters.c +12 -12
index 2d73d0dce5ff..b6306c33378a 100644
@@ -1134,9 +1134,9 @@ static const uint16_t *spl_get_filter_3tap_64p(struct spl_fixed31_32 ratio)
 {
 	if (ratio.value < spl_fixpt_one.value)
 		return filter_3tap_64p_upscale;
-	else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(4, 3)).value)
+	else if (ratio.value < spl_fixpt_from_fraction(4, 3).value)
 		return filter_3tap_64p_116;
-	else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(5, 3)).value)
+	else if (ratio.value < spl_fixpt_from_fraction(5, 3).value)
 		return filter_3tap_64p_149;
 	else
 		return filter_3tap_64p_183;
@@ -1146,9 +1146,9 @@ static const uint16_t *spl_get_filter_4tap_64p(struct spl_fixed31_32 ratio)
 {
 	if (ratio.value < spl_fixpt_one.value)
 		return filter_4tap_64p_upscale;
-	else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(4, 3)).value)
+	else if (ratio.value < spl_fixpt_from_fraction(4, 3).value)
 		return filter_4tap_64p_116;
-	else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(5, 3)).value)
+	else if (ratio.value < spl_fixpt_from_fraction(5, 3).value)
 		return filter_4tap_64p_149;
 	else
 		return filter_4tap_64p_183;
@@ -1158,9 +1158,9 @@ static const uint16_t *spl_get_filter_5tap_64p(struct spl_fixed31_32 ratio)
 {
 	if (ratio.value < spl_fixpt_one.value)
 		return filter_5tap_64p_upscale;
-	else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(4, 3)).value)
+	else if (ratio.value < spl_fixpt_from_fraction(4, 3).value)
 		return filter_5tap_64p_116;
-	else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(5, 3)).value)
+	else if (ratio.value < spl_fixpt_from_fraction(5, 3).value)
 		return filter_5tap_64p_149;
 	else
 		return filter_5tap_64p_183;
@@ -1170,9 +1170,9 @@ static const uint16_t *spl_get_filter_6tap_64p(struct spl_fixed31_32 ratio)
 {
 	if (ratio.value < spl_fixpt_one.value)
 		return filter_6tap_64p_upscale;
-	else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(4, 3)).value)
+	else if (ratio.value < spl_fixpt_from_fraction(4, 3).value)
 		return filter_6tap_64p_116;
-	else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(5, 3)).value)
+	else if (ratio.value < spl_fixpt_from_fraction(5, 3).value)
 		return filter_6tap_64p_149;
 	else
 		return filter_6tap_64p_183;
@@ -1182,9 +1182,9 @@ static const uint16_t *spl_get_filter_7tap_64p(struct spl_fixed31_32 ratio)
 {
 	if (ratio.value < spl_fixpt_one.value)
 		return filter_7tap_64p_upscale;
-	else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(4, 3)).value)
+	else if (ratio.value < spl_fixpt_from_fraction(4, 3).value)
 		return filter_7tap_64p_116;
-	else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(5, 3)).value)
+	else if (ratio.value < spl_fixpt_from_fraction(5, 3).value)
 		return filter_7tap_64p_149;
 	else
 		return filter_7tap_64p_183;
@@ -1194,9 +1194,9 @@ static const uint16_t *spl_get_filter_8tap_64p(struct spl_fixed31_32 ratio)
 {
 	if (ratio.value < spl_fixpt_one.value)
 		return filter_8tap_64p_upscale;
-	else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(4, 3)).value)
+	else if (ratio.value < spl_fixpt_from_fraction(4, 3).value)
 		return filter_8tap_64p_116;
-	else if (ratio.value < SPL_NAMESPACE(spl_fixpt_from_fraction(5, 3)).value)
+	else if (ratio.value < spl_fixpt_from_fraction(5, 3).value)
 		return filter_8tap_64p_149;
 	else
 		return filter_8tap_64p_183;
drivers/gpu/drm/amd/display/dc/sspl/dc_spl_types.h +58 -2

66 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/sspl/spl_custom_float.c deleted +0 -152

152 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/sspl/spl_custom_float.h deleted +0 -29
deleted file mode 100644
index f3fd8d30e638..000000000000
@@ -1,29 +0,0 @@
-/* SPDX-License-Identifier: MIT */
-
-/* Copyright 2024 Advanced Micro Devices, Inc. */
-
-#ifndef SPL_CUSTOM_FLOAT_H_
-#define SPL_CUSTOM_FLOAT_H_
-
-#include "spl_os_types.h"
-#include "spl_fixpt31_32.h"
-
-struct spl_custom_float_format {
-	uint32_t mantissa_bits;
-	uint32_t exponenta_bits;
-	bool sign;
-};
-
-struct spl_custom_float_value {
-	uint32_t mantissa;
-	uint32_t exponenta;
-	uint32_t value;
-	bool negative;
-};
-
-bool SPL_NAMESPACE(spl_convert_to_custom_float_format(
-	struct spl_fixed31_32 value,
-	const struct spl_custom_float_format *format,
-	uint32_t *result));
-
-#endif //SPL_CUSTOM_FLOAT_H_
drivers/gpu/drm/amd/display/dc/sspl/spl_fixpt31_32.c deleted +0 -495

495 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/sspl/spl_fixpt31_32.h deleted +0 -526

526 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/sspl/spl_namespace.h new file +17 -0
new file mode 100644
index 000000000000..5bea362f960e
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: MIT */
+
+/* Copyright 2024 Advanced Micro Devices, Inc. */
+
+#ifndef _SPL_NAMESPACE_H_
+#define _SPL_NAMESPACE_H_
+
+/* SPL namespace macros */
+#ifndef SPL_PFX_
+#define SPL_PFX_
+#endif
+
+#define SPL_EXPAND2(a, b)         a##b
+#define SPL_EXPAND(a, b)          SPL_EXPAND2(a, b)
+#define SPL_NAMESPACE(symbol)     SPL_EXPAND(SPL_PFX_, symbol)
+
+#endif /* _SPL_NAMESPACE_H_ */
drivers/gpu/drm/amd/display/dc/sspl/spl_os_types.h +1 -42

52 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#11 lore raw

PATCH 11/59 drm/amd/display: Fix DPP PRE_GAM register offset on DCN60

In reply to Alex Hung

From: Alvin Lee <[email protected]>

[WHY]
dcn60 uses dpp50_set_pregam_state, which reads PRE_GAM through the dcn50_dpp_registers layout. PRE_GAM sat at a different offset in dcn50 (based on DCN401) vs dcn60 (based on DCN42), so the cast landed on the wrong register which causes the wrong address to be used

[HOW]
Rebase the DPP macro inheritance so PRE_GAM shares a common offset:
DCN50 lists now inherit from DCN42, and DCN60 lists inherit from DCN50. The dcn60 struct layout is unchanged, so PRE_GAM aligns between the two and dpp50_set_pregam_state programs the correct address.

---
 drivers/gpu/drm/amd/display/dc/dpp/dcn50/dcn50_dpp.h | 11 ++++++-----
 drivers/gpu/drm/amd/display/dc/dpp/dcn60/dcn60_dpp.h |  7 ++-----
 2 files changed, 8 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/dc/dpp/dcn50/dcn50_dpp.h +6 -5
index efa76579dc9b..7f5d3fa6bbef 100644
@@ -11,28 +11,29 @@
 #include "dcn30/dcn30_dpp.h"
 #include "dcn32/dcn32_dpp.h"
 #include "dcn401/dcn401_dpp.h"
+#include "dcn42/dcn42_dpp.h"
 
 
 #define TO_DCN50_DPP(dpp)\
 	container_of(dpp, struct dcn50_dpp, base)
 
 #define DPP_REG_LIST_SH_MASK_DCN50_COMMON(mask_sh)\
-	DPP_REG_LIST_SH_MASK_DCN401_COMMON(mask_sh), \
+	DPP_REG_LIST_SH_MASK_DCN42_COMMON(mask_sh), \
 	TF_SF(CNVC_CFG0_PRE_GAM, PRE_GAM_MODE, mask_sh), \
 	TF_SF(CNVC_CFG0_PRE_GAM, PRE_DEGAM_SELECT, mask_sh), \
 	TF_SF(CNVC_CFG0_PRE_GAM, PRE_REGAM_SELECT, mask_sh)
 
 #define DPP_REG_FIELD_LIST_DCN50(type) \
-	DPP_REG_FIELD_LIST_DCN401(type); \
+	DPP_REG_FIELD_LIST_DCN42(type); \
 	type PRE_GAM_MODE; \
 	type PRE_REGAM_SELECT
 
 #define DPP_REG_VARIABLE_LIST_DCN50 \
-	DPP_REG_VARIABLE_LIST_DCN401; \
-	uint32_t PRE_GAM;
+	DPP_REG_VARIABLE_LIST_DCN42; \
+	uint32_t PRE_GAM
 
 struct dcn50_dpp_registers {
-	DPP_REG_VARIABLE_LIST_DCN50
+	DPP_REG_VARIABLE_LIST_DCN50;
 };
 
 struct dcn50_dpp_shift {
drivers/gpu/drm/amd/display/dc/dpp/dcn60/dcn60_dpp.h +2 -5
index 96ff26a5ed65..a0cc57e79ff7 100644
@@ -414,9 +414,7 @@
 	TF_SF(CNVC_CFG0_CNVC_UPSP_CLAMP, UPSP_CLAMP_MIN, mask_sh)
 
 #define DPP_REG_FIELD_LIST_DCN60(type) \
-	DPP_REG_FIELD_LIST_DCN42(type); \
-	type PRE_GAM_MODE; \
-	type PRE_REGAM_SELECT; \
+	DPP_REG_FIELD_LIST_DCN50(type); \
 	type AUTOCAL_FRAC_MODE; \
 	type SCL_BLACK_COLOR_RGB_Y; \
 	type SCL_BLACK_COLOR_CBCR; \
@@ -448,8 +446,7 @@
 	type UPSP_CLAMP_MIN
 
 #define DPP_REG_VARIABLE_LIST_DCN60 \
-	DPP_REG_VARIABLE_LIST_DCN42; \
-	uint32_t PRE_GAM; \
+	DPP_REG_VARIABLE_LIST_DCN50; \
 	uint32_t SCL_BLACK_COLOR; \
 	uint32_t UPSP_MODE; \
 	uint32_t UPSP_V_COEF_P0; \
Signature · 1 line
2.43.0
author
#12 lore raw

PATCH 12/59 drm/amd/display: Move cursor SDR white level calculation out of hwss executor

In reply to Alex Hung

From: Tomasz Siemek <[email protected]>

[WHY]
Cursor SDR white level calculation is common across DCN generations and does not require an ASIC-specific HWSS implementation. Keeping it in the DCN10 HWSS extension duplicated generic policy in generation-specific code and made block sequence execution depend on mutable pipe context.

[HOW]
Move cursor SDR white level calculation into dc_hw_sequencer. Store the calculated DPP cursor attributes in the block sequence so execution only invokes set_optional_cursor_attributes.

---
 drivers/gpu/drm/amd/display/dc/core/dc.c      |  3 +-
 .../drm/amd/display/dc/core/dc_hw_sequencer.c | 55 +++++++++++++------
 .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c   | 26 ++-------
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c |  3 +-
 .../amd/display/dc/hwss/dcn50/dcn50_hwseq.c   |  3 +-
 .../drm/amd/display/dc/hwss/hw_sequencer.h    |  7 ++-
 6 files changed, 51 insertions(+), 46 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +1 -2
index 1b9bcc3f0d2b..e40bad702f0f 100644
@@ -3957,8 +3957,7 @@ static void program_cursor_attributes_sequence(
 		hwss_add_set_cursor_attribute(seq_state, dc, tmp_pipe);
 		if (dc->ctx->dmub_srv)
 			hwss_add_send_update_cursor_info_to_dmu(seq_state, tmp_pipe, k);
-		if (dc->hwss.set_cursor_sdr_white_level)
-			hwss_add_set_cursor_sdr_white_level(seq_state, dc, tmp_pipe);
+		hwss_add_set_cursor_sdr_white_level(seq_state, tmp_pipe);
 		if (enable_cursor_offload && dc->hwss.update_cursor_offload_pipe)
 			hwss_add_update_cursor_offload_pipe(seq_state, dc, tmp_pipe);
 	}
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +39 -16

88 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +5 -21
index b1679791f903..1b0fc0853045 100644
@@ -3938,29 +3938,13 @@ void dcn10_set_cursor_attribute(struct pipe_ctx *pipe_ctx)
 
 void dcn10_set_cursor_sdr_white_level(struct pipe_ctx *pipe_ctx)
 {
-	uint32_t sdr_white_level = pipe_ctx->stream->cursor_attributes.sdr_white_level;
-	struct fixed31_32 multiplier;
-	struct dpp_cursor_attributes opt_attr = { 0 };
-	uint32_t hw_scale = 0x3c00; // 1.0 default multiplier
-	struct custom_float_format fmt;
-
-	if (!pipe_ctx->plane_res.dpp->funcs->set_optional_cursor_attributes)
-		return;
-
-	fmt.exponenta_bits = 5;
-	fmt.mantissa_bits = 10;
-	fmt.sign = true;
+	struct dpp *dpp = pipe_ctx->plane_res.dpp;
+	struct dpp_cursor_attributes attr;
 
-	if (sdr_white_level > 80) {
-		multiplier = dc_fixpt_from_fraction(sdr_white_level, 80);
-		convert_to_custom_float_format(multiplier, &fmt, &hw_scale);
+	if (dpp && dpp->funcs->set_optional_cursor_attributes) {
+		attr = calc_sdr_cursor_attributes(pipe_ctx);
+		dpp->funcs->set_optional_cursor_attributes(dpp, &attr);
 	}
-
-	opt_attr.scale = hw_scale;
-	opt_attr.bias = 0;
-
-	pipe_ctx->plane_res.dpp->funcs->set_optional_cursor_attributes(
-			pipe_ctx->plane_res.dpp, &opt_attr);
 }
 
 /*
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +1 -2
index 8e0ccc9d5819..7b089ae5c9c3 100644
@@ -3743,8 +3743,7 @@ void dcn401_update_dchubp_dpp_sequence(struct dc *dc,
 		hwss_add_set_cursor_position(seq_state, dc, pipe_ctx);
 
 		/* Step 16: Cursor SDR white level */
-		if (dc->hwss.set_cursor_sdr_white_level)
-			hwss_add_set_cursor_sdr_white_level(seq_state, dc, pipe_ctx);
+		hwss_add_set_cursor_sdr_white_level(seq_state, pipe_ctx);
 	}
 
 	/* Step 17: Gamut remap and output CSC */
drivers/gpu/drm/amd/display/dc/hwss/dcn50/dcn50_hwseq.c +1 -2
index a7f8fd03faea..c13d1ad8d000 100644
@@ -366,8 +366,7 @@ void dcn50_update_dchubp_dpp_sequence(struct dc *dc,
 		hwss_add_set_cursor_position(seq_state, dc, pipe_ctx);
 
 		/* Step 15: Cursor SDR white level */
-		if (dc->hwss.set_cursor_sdr_white_level)
-			hwss_add_set_cursor_sdr_white_level(seq_state, dc, pipe_ctx);
+		hwss_add_set_cursor_sdr_white_level(seq_state, pipe_ctx);
 	}
 
 	/* Step 16: Gamut remap and output CSC */
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +4 -3
index 4f0d000eab94..83d9d699e929 100644
@@ -872,8 +872,8 @@ struct set_cursor_position_params {
 };
 
 struct set_cursor_sdr_white_level_params {
-	struct dc *dc;
-	struct pipe_ctx *pipe_ctx;
+	struct dpp *dpp;
+	struct dpp_cursor_attributes attr;
 };
 
 struct program_output_csc_params {
@@ -1802,6 +1802,8 @@ void set_drr_and_clear_adjust_pending(
 		struct dc_stream_state *stream,
 		struct drr_params *params);
 
+struct dpp_cursor_attributes calc_sdr_cursor_attributes(struct pipe_ctx *pipe_ctx);
+
 void hwss_execute_sequence(struct dc *dc,
 		struct block_sequence block_sequence[MAX_HWSS_BLOCK_SEQUENCE_SIZE],
 		int num_steps);
@@ -2610,7 +2612,6 @@ void hwss_add_set_cursor_position(struct block_sequence_state *seq_state,
 		struct pipe_ctx *pipe_ctx);
 
 void hwss_add_set_cursor_sdr_white_level(struct block_sequence_state *seq_state,
-		struct dc *dc,
 		struct pipe_ctx *pipe_ctx);
 
 void hwss_add_program_output_csc(struct block_sequence_state *seq_state,
Signature · 1 line
2.43.0
author
#13 lore raw

PATCH 13/59 drm/amd/display: Preparations To Move DML Wrapper Out Of DML

In reply to Alex Hung

From: Austin Zheng <[email protected]>

[WHY/HOW]
DML wrapper has dependencies on both DC and DML. Therefore it should be in its own component instead of under the DML2 folder.

A series of changes are required to move the files without breaking compilation

---
 .../gpu/drm/amd/display/dc/dml2_0/Makefile    | 23 +++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2_0/Makefile +19 -4
index b3e23dbf2ebf..f3427e83126e 100644
@@ -80,8 +80,15 @@ CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn5_funcs_mode_pro
 CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn5_funcs_mode_support.o := $(dml2_ccflags) $(frame_warn_flag)
 CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_programming.o := $(dml2_ccflags) $(frame_warn_flag)
 CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_support.o := $(dml2_ccflags) $(frame_warn_flag)
+
+#Wrapper files are being moved to their own component. Use a flag to transition once files are moved.
+ifndef DML2_WRAPPER_STANDALONE
 CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml2_wrapper.o := $(dml2_rcflags)
 CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/dml21_wrapper.o := $(dml2_rcflags)
+CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml2_wrapper.o := $(dml2_ccflags)
+CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/dml21_wrapper.o := $(dml2_ccflags)
+endif
+
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/display_mode_core.o := $(dml2_rcflags)
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn4_calcs.o := $(dml2_rcflags)
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_utils.o := $(dml2_rcflags)
@@ -89,14 +96,18 @@ CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn5_funcs_m
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn5_funcs_mode_support.o := $(dml2_rcflags)
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_programming.o := $(dml2_rcflags)
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_support.o := $(dml2_rcflags)
-CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml2_wrapper.o := $(dml2_ccflags)
-CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/dml21_wrapper.o := $(dml2_ccflags)
 
-DML2 = display_mode_core.o display_mode_util.o dml2_wrapper_fpu.o dml2_wrapper.o \
-		dml2_utils.o dml2_policy.o dml2_translation_helper.o dml2_dc_resource_mgmt.o dml2_mall_phantom.o \
+# DML2 library core files
+DML2 = display_mode_core.o display_mode_util.o \
 		dml_display_rq_dlg_calc.o
 DML2 += dml_frl_cap_chk.o
 
+#Wrapper files are being moved to their own component. Use a flag to transition once files are moved.
+ifndef DML2_WRAPPER_STANDALONE
+DML2 += dml2_wrapper_fpu.o dml2_wrapper.o \
+		dml2_utils.o dml2_policy.o dml2_translation_helper.o dml2_dc_resource_mgmt.o dml2_mall_phantom.o
+endif
+
 AMD_DAL_DML2 = $(addprefix $(AMDDALPATH)/dc/dml2_0/,$(DML2))
 
 AMD_DISPLAY_FILES += $(AMD_DAL_DML2)
@@ -141,10 +152,14 @@ DML21 += src/dml2_pmo/dml2_pmo_dcn6.o
 DML21 += src/dml2_pmo/dml2_pmo_dcn6_stage_optimizers.o
 DML21 += src/dml2_standalone_libraries/alternate_pstate_shared_lib.o
 DML21 += src/dml2_utm_soc_bb/dml2_utm_soc_bb_dcn6.o
+
+#Wrapper files are being moved to their own component. Use a flag to transition once files are moved.
+ifndef DML2_WRAPPER_STANDALONE
 DML21 += dml21_translation_helper.o
 DML21 += dml21_wrapper.o
 DML21 += dml21_wrapper_fpu.o
 DML21 += dml21_utils.o
+endif
 
 AMD_DAL_DML21 = $(addprefix $(AMDDALPATH)/dc/dml2_0/dml21/,$(DML21))
 
Signature · 1 line
2.43.0
author
#14 lore raw

PATCH 14/59 drm/amd/display: Guard DAL port idle optimizations by ASIC rev

In reply to Alex Hung

From: Dillon Varone <[email protected]>

[WHY&HOW]
Not all ASIC revisions support the DAL port idle optimizations. Guard the code with a check for ASIC rev.

---
 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c +3 -0
index 218856c5fe09..c6f90b90c10b 100644
@@ -1539,6 +1539,9 @@ static void dcn60_set_idle_power_optimizations(struct clk_mgr *clk_mgr_base, boo
 	if (!clk_mgr->smu_present)
 		return;
 
+	if (!ASICREV_IS_DCN6_VARIANT_LITE3(clk_mgr_base->ctx->asic_id.hw_internal_rev))
+		return;
+
 	dcn60_smu_set_display_idle_optimization(clk_mgr, enable);
 }
 
Signature · 1 line
2.43.0
author
#15 lore raw

PATCH 15/59 drm/amd/display: Do not use panel_inst in pr

In reply to Alex Hung

From: Peichen Huang <[email protected]>

[WHY]
Panel Replay has different index definition from other eDP features. So we should avoid using panel_index in pr.

[HOW]
Rename the it to pr_panel_inst

---
 .../gpu/drm/amd/display/dc/inc/link_service.h |  2 +-
 .../drm/amd/display/dc/link/link_factory.c    |  2 +-
 .../dc/link/protocols/link_dp_panel_replay.c  | 36 +++++++--------
 .../dc/link/protocols/link_dp_panel_replay.h  |  2 +-
 .../link/protocols/link_edp_panel_control.c   | 44 +++++++++----------
 5 files changed, 43 insertions(+), 43 deletions(-)
drivers/gpu/drm/amd/display/dc/inc/link_service.h +1 -1
index f87dfe63227d..eaf20ca14bcc 100644
@@ -309,7 +309,7 @@ struct link_service {
 	bool (*edp_receiver_ready_T7)(struct dc_link *link);
 	bool (*edp_power_alpm_dpcd_enable)(struct dc_link *link, bool enable);
 	bool (*dp_setup_replay)(struct dc_link *link, const struct dc_stream_state *stream);
-	bool (*dp_pr_get_panel_inst)(const struct dc *dc, const struct dc_link *link, unsigned int *inst_out);
+	bool (*dp_pr_get_pr_panel_inst)(const struct dc *dc, const struct dc_link *link, unsigned int *inst_out);
 	bool (*dp_pr_enable)(struct dc_link *link, bool enable);
 	bool (*dp_pr_update_state)(struct dc_link *link, struct dmub_cmd_pr_update_state_data *update_state_data);
 	bool (*dp_pr_set_general_cmd)(struct dc_link *link, struct dmub_cmd_pr_general_cmd_data *general_cmd_data);
drivers/gpu/drm/amd/display/dc/link/link_factory.c +1 -1
index a83693ea43c0..fa281de1d566 100644
@@ -245,7 +245,7 @@ static void construct_link_service_edp_panel_control(struct link_service *link_s
 static void construct_link_service_dp_panel_replay(struct link_service *link_srv)
 {
 	link_srv->dp_setup_replay = dp_setup_replay;
-	link_srv->dp_pr_get_panel_inst = dp_pr_get_panel_inst;
+	link_srv->dp_pr_get_pr_panel_inst = dp_pr_get_pr_panel_inst;
 	link_srv->dp_pr_enable = dp_pr_enable;
 	link_srv->dp_pr_update_state = dp_pr_update_state;
 	link_srv->dp_pr_set_general_cmd = dp_pr_set_general_cmd;
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.c +18 -18
index 0d4f88ff844d..65a791ccf6b2 100644
@@ -82,7 +82,7 @@ static bool dp_setup_panel_replay(struct dc_link *link, const struct dc_stream_s
 	struct dc *dc;
 	struct dmub_replay *replay;
 	int i;
-	unsigned int panel_inst;
+	unsigned int pr_panel_inst;
 	struct replay_context replay_context = { 0 };
 	unsigned int lineTimeInNs = 0;
 
@@ -117,7 +117,7 @@ static bool dp_setup_panel_replay(struct dc_link *link, const struct dc_stream_s
 	if (!replay)
 		return false;
 
-	if (!dp_pr_get_panel_inst(dc, link, &panel_inst))
+	if (!dp_pr_get_pr_panel_inst(dc, link, &pr_panel_inst))
 		return false;
 
 	replay_context.aux_inst = (enum channel_id) link_get_ddc_aux_inst(link);
@@ -202,7 +202,7 @@ static bool dp_setup_panel_replay(struct dc_link *link, const struct dc_stream_s
 }
 
 
-bool dp_pr_get_panel_inst(const struct dc *dc,
+bool dp_pr_get_pr_panel_inst(const struct dc *dc,
 		const struct dc_link *link,
 		unsigned int *inst_out)
 {
@@ -246,10 +246,10 @@ bool dp_setup_replay(struct dc_link *link, const struct dc_stream_state *stream)
 bool dp_pr_enable(struct dc_link *link, bool enable)
 {
 	struct dc *dc = link->ctx->dc;
-	unsigned int panel_inst = 0;
+	unsigned int pr_panel_inst = 0;
 	union dmub_rb_cmd cmd;
 
-	if (!dp_pr_get_panel_inst(dc, link, &panel_inst))
+	if (!dp_pr_get_pr_panel_inst(dc, link, &pr_panel_inst))
 		return false;
 
 	if (link->replay_settings.replay_allow_active == enable)
@@ -264,7 +264,7 @@ bool dp_pr_enable(struct dc_link *link, bool enable)
 	cmd.pr_enable.header.type = DMUB_CMD__PR;
 	cmd.pr_enable.header.sub_type = DMUB_CMD__PR_ENABLE;
 	cmd.pr_enable.header.payload_bytes = sizeof(struct dmub_cmd_pr_enable_data);
-	cmd.pr_enable.data.panel_inst = (uint8_t)panel_inst;
+	cmd.pr_enable.data.panel_inst = (uint8_t)pr_panel_inst;
 	cmd.pr_enable.data.enable = enable ? 1 : 0;
 	dc_wake_and_execute_dmub_cmd(dc->ctx, &cmd, DM_DMUB_WAIT_TYPE_WAIT);
 
@@ -276,11 +276,11 @@ bool dp_pr_enable(struct dc_link *link, bool enable)
 bool dp_pr_copy_settings(struct dc_link *link, struct replay_context *replay_context)
 {
 	struct dc *dc = link->ctx->dc;
-	unsigned int panel_inst = 0;
+	unsigned int pr_panel_inst = 0;
 	union dmub_rb_cmd cmd;
 	struct pipe_ctx *pipe_ctx = NULL;
 
-	if (!dp_pr_get_panel_inst(dc, link, &panel_inst))
+	if (!dp_pr_get_pr_panel_inst(dc, link, &pr_panel_inst))
 		return false;
 
 	for (unsigned int i = 0; i < MAX_PIPES; i++) {
@@ -301,7 +301,7 @@ bool dp_pr_copy_settings(struct dc_link *link, struct replay_context *replay_con
 	cmd.pr_copy_settings.header.type = DMUB_CMD__PR;
 	cmd.pr_copy_settings.header.sub_type = DMUB_CMD__PR_COPY_SETTINGS;
 	cmd.pr_copy_settings.header.payload_bytes = sizeof(struct dmub_cmd_pr_copy_settings_data);
-	cmd.pr_copy_settings.data.panel_inst = (uint8_t)panel_inst;
+	cmd.pr_copy_settings.data.panel_inst = (uint8_t)pr_panel_inst;
 	// HW inst
 	cmd.pr_copy_settings.data.aux_inst = replay_context->aux_inst;
 	cmd.pr_copy_settings.data.digbe_inst = replay_context->digbe_inst;
@@ -359,10 +359,10 @@ bool dp_pr_copy_settings(struct dc_link *link, struct replay_context *replay_con
 bool dp_pr_update_state(struct dc_link *link, struct dmub_cmd_pr_update_state_data *update_state_data)
 {
 	struct dc *dc = link->ctx->dc;
-	unsigned int panel_inst = 0;
+	unsigned int pr_panel_inst = 0;
 	union dmub_rb_cmd cmd;
 
-	if (!dp_pr_get_panel_inst(dc, link, &panel_inst))
+	if (!dp_pr_get_pr_panel_inst(dc, link, &pr_panel_inst))
 		return false;
 
 	memset(&cmd, 0, sizeof(cmd));
@@ -371,7 +371,7 @@ bool dp_pr_update_state(struct dc_link *link, struct dmub_cmd_pr_update_state_da
 	cmd.pr_update_state.header.type = DMUB_CMD__PR;
 	cmd.pr_update_state.header.sub_type = DMUB_CMD__PR_UPDATE_STATE;
 	cmd.pr_update_state.header.payload_bytes = sizeof(struct dmub_cmd_pr_update_state_data);
-	cmd.pr_update_state.data.panel_inst = (uint8_t)panel_inst;
+	cmd.pr_update_state.data.panel_inst = (uint8_t)pr_panel_inst;
 
 	dc_wake_and_execute_dmub_cmd(dc->ctx, &cmd, DM_DMUB_WAIT_TYPE_WAIT);
 	return true;
@@ -380,10 +380,10 @@ bool dp_pr_update_state(struct dc_link *link, struct dmub_cmd_pr_update_state_da
 bool dp_pr_set_general_cmd(struct dc_link *link, struct dmub_cmd_pr_general_cmd_data *general_cmd_data)
 {
 	struct dc *dc = link->ctx->dc;
-	unsigned int panel_inst = 0;
+	unsigned int pr_panel_inst = 0;
 	union dmub_rb_cmd cmd;
 
-	if (!dp_pr_get_panel_inst(dc, link, &panel_inst))
+	if (!dp_pr_get_pr_panel_inst(dc, link, &pr_panel_inst))
 		return false;
 
 	memset(&cmd, 0, sizeof(cmd));
@@ -392,7 +392,7 @@ bool dp_pr_set_general_cmd(struct dc_link *link, struct dmub_cmd_pr_general_cmd_
 	cmd.pr_general_cmd.header.type = DMUB_CMD__PR;
 	cmd.pr_general_cmd.header.sub_type = DMUB_CMD__PR_GENERAL_CMD;
 	cmd.pr_general_cmd.header.payload_bytes = sizeof(struct dmub_cmd_pr_general_cmd_data);
-	cmd.pr_general_cmd.data.panel_inst = (uint8_t)panel_inst;
+	cmd.pr_general_cmd.data.panel_inst = (uint8_t)pr_panel_inst;
 
 	dc_wake_and_execute_dmub_cmd(dc->ctx, &cmd, DM_DMUB_WAIT_TYPE_WAIT);
 	return true;
@@ -401,16 +401,16 @@ bool dp_pr_set_general_cmd(struct dc_link *link, struct dmub_cmd_pr_general_cmd_
 bool dp_pr_get_state(const struct dc_link *link, uint64_t *state)
 {
 	const struct dc *dc = link->ctx->dc;
-	unsigned int panel_inst = 0;
+	unsigned int pr_panel_inst = 0;
 	uint32_t retry_count = 0;
 	uint32_t replay_state = PR_STATE_INVALID;
 
-	if (!dp_pr_get_panel_inst(dc, link, &panel_inst))
+	if (!dp_pr_get_pr_panel_inst(dc, link, &pr_panel_inst))
 		return false;
 
 	do {
 		// Send gpint command and wait for ack
-		if (!dc_wake_and_execute_gpint(dc->ctx, DMUB_GPINT__GET_REPLAY_STATE, (uint16_t)panel_inst,
+		if (!dc_wake_and_execute_gpint(dc->ctx, DMUB_GPINT__GET_REPLAY_STATE, (uint16_t)pr_panel_inst,
 					       &replay_state, DM_DMUB_WAIT_TYPE_WAIT_WITH_REPLY)) {
 			// Return invalid state when GPINT times out
 			replay_state = PR_STATE_INVALID;
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.h +1 -1
index 5522d5911fd1..e669053e1a8f 100644
@@ -28,7 +28,7 @@
 #include "link_service.h"
 
 bool dp_setup_replay(struct dc_link *link, const struct dc_stream_state *stream);
-bool dp_pr_get_panel_inst(const struct dc *dc, const struct dc_link *link, unsigned int *inst_out);
+bool dp_pr_get_pr_panel_inst(const struct dc *dc, const struct dc_link *link, unsigned int *inst_out);
 bool dp_pr_enable(struct dc_link *link, bool enable);
 bool dp_pr_copy_settings(struct dc_link *link, struct replay_context *replay_context);
 bool dp_pr_update_state(struct dc_link *link, struct dmub_cmd_pr_update_state_data *update_state_data);
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +22 -22

145 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#16 lore raw

PATCH 16/59 drm/amd/display: Add max_downscale_src_width debugfs for IGT validation

In reply to Alex Hung

From: Tony Qi <[email protected]>

[WHY]
The maximum source viewport width the ASIC can downscale from is held in dc->debug.max_downscale_src_width and is not visible to userspace. Tests (e.g. IGT amd_cursor_overlay scaling subtests) that downscale a plane cannot tell whether a given source width is a genuine hardware limitation or a driver defect, so they cannot correctly distinguish a SKIP from a FAIL.

[HOW]
Add a read-only per-connector max_downscale_src_width debugfs file that reports dc->debug.max_downscale_src_width, following the existing internal_display debugfs entry. A value of 0 means no limit.

Assisted-by Claude:opus-4.8
---
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +20 -0
index 1a574f508b8d..e4c92b1fa22e 100644
@@ -1286,6 +1286,24 @@ static int internal_display_show(struct seq_file *m, void *data)
 	return 0;
 }
 
+/*
+ * Returns the maximum source viewport width (in pixels) this ASIC can
+ * downscale from. A value of 0 means there is no such limit.
+ * Example usage: cat /sys/kernel/debug/dri/0/eDP-1/max_downscale_src_width
+ */
+static int max_downscale_src_width_show(struct seq_file *m, void *unused)
+{
+	struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(m->private);
+	struct dc_link *link = aconnector->dc_link;
+
+	if (!link)
+		return -ENODEV;
+
+	seq_printf(m, "%d\n", link->dc->debug.max_downscale_src_width);
+
+	return 0;
+}
+
 /*
  * Returns the number of segments used if ODM Combine mode is enabled.
  * Example usage: cat /sys/kernel/debug/dri/0/DP-1/odm_combine_segments
@@ -3045,6 +3063,7 @@ DEFINE_SHOW_ATTRIBUTE(dmub_tracebuffer);
 DEFINE_SHOW_ATTRIBUTE(dp_lttpr_status);
 DEFINE_SHOW_ATTRIBUTE(hdcp_sink_capability);
 DEFINE_SHOW_ATTRIBUTE(internal_display);
+DEFINE_SHOW_ATTRIBUTE(max_downscale_src_width);
 DEFINE_SHOW_ATTRIBUTE(odm_combine_segments);
 DEFINE_SHOW_ATTRIBUTE(replay_capability);
 DEFINE_SHOW_ATTRIBUTE(psr_capability);
@@ -3753,6 +3772,7 @@ static const struct {
 		{"force_yuv_pixel_format", &force_yuv_pixel_format_fops},
 		{"trigger_hotplug", &trigger_hotplug_debugfs_fops},
 		{"internal_display", &internal_display_fops},
+		{"max_downscale_src_width", &max_downscale_src_width_fops},
 		{"odm_combine_segments", &odm_combine_segments_fops}
 };
 
Signature · 1 line
2.43.0
author
#17 lore raw

PATCH 17/59 drm/amd/display: Re-enable multi-dwb support

In reply to Alex Hung

From: Dillon Varone <[email protected]>

[WHY&HOW]
DCN5+ supports multi-dwb per stream.

---
 .../dml2_0/dml21/src/dml2_core/dml2_core_dcn5_calcs_dchub.c  | 4 ++--
 .../dml21/src/dml2_core/dml2_core_dcn5_funcs_mode_support.c  | 5 -----
 .../dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_support.c  | 4 ----
 3 files changed, 2 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn5_calcs_dchub.c +2 -2
index bd2494c976ac..ab778fac34b2 100644
@@ -4225,9 +4225,9 @@ static double dcn5_calculate_writeback_latency_hiding_us(
 		unsigned int dwb_index)
 {
 	double byte_per_pixel_luma_in_buffer = 1.0;
-	double buffer_for_luma_bytes = (double)writeback_buffer_size_bytes * 1024.0;
+	double buffer_for_luma_bytes = (double)writeback_buffer_size_bytes;
 	double line_time_us = (double)display_cfg->stream_descriptors[stream_index].timing.h_total /
-			(double)display_cfg->stream_descriptors[stream_index].timing.pixel_clock_khz / 1000.0;
+			((double)display_cfg->stream_descriptors[stream_index].timing.pixel_clock_khz / 1000.0);
 
 	if (display_cfg->stream_descriptors[stream_index].writeback.writeback_stream[dwb_index].pixel_format == dml2_444_64) {
 		byte_per_pixel_luma_in_buffer = 8.0;
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn5_funcs_mode_support.c +0 -5
index 2e86a134e074..fde2e0ad2529 100644
@@ -992,11 +992,6 @@ static bool dcn5_ms_check_writeback_count_support(
 	for (stream_idx = 0; stream_idx < display_cfg->num_streams; stream_idx++) {
 		totalNumberOfActiveWriteback +=
 				display_cfg->stream_descriptors[stream_idx].writeback.active_writebacks_per_stream;
-
-		/* >1 writeback per stream is currently not supported */
-		if (display_cfg->stream_descriptors[stream_idx].writeback.active_writebacks_per_stream > 1) {
-			writeback_per_stream_supported = false;
-		}
 	}
 
 	return writeback_per_stream_supported &&
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_support.c +0 -4
index ca3b8b82ec04..5de84d6c73c0 100644
@@ -1292,10 +1292,6 @@ static bool dcn6_ms_check_writeback_count_support(
 
 		totalNumberOfActiveWriteback +=
 				display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].writeback.active_writebacks_per_stream;
-
-		/* >1 writeback per stream is currently not supported */
-		if (display_cfg->stream_descriptors[display_cfg->plane_descriptors[k].stream_index].writeback.active_writebacks_per_stream > 1)
-			writeback_per_stream_supported = false;
 	}
 	outputs->support.EnoughWritebackUnits = writeback_per_stream_supported &&
 			totalNumberOfActiveWriteback <= ip->max_num_wb;
Signature · 1 line
2.43.0
author
#18 lore raw

PATCH 18/59 drm/amd/display: Clean up Per-DPM Struct

In reply to Alex Hung

From: Austin Zheng <[email protected]>

[WHY/HOW]
Deprecate original organization in favor for the organization used by v2. External usages no longer used so it can be removed entirely.

---
 .../dml21/inc/dml_top_soc_parameter_types.h   | 32 +++----------------
 1 file changed, 4 insertions(+), 28 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/inc/dml_top_soc_parameter_types.h +4 -28
index 45208f804d2b..422833548aa6 100644
@@ -78,41 +78,17 @@ enum dml2_qos_param_type {
 // - If a non-zero DPM index has derate_percent = 0, fall back to index 0
 // Unpopulated derates should fallback to the global derate value.
 // Each element pairs a derate percentage with its threshold
-struct dml2_soc_derate_values_per_dpm_v2 {
+struct dml2_soc_derate_values_per_dpm {
 	unsigned int derate_percent;
 	unsigned int clk_upperbound_threshold_khz;
 };
 
-// Legacy structure - for backward compatibility as driver debug values can override the values. (will temporarily break driver overrides)
 // Per-DPM derate arrays for system_active_average (the only power state that varies by DPM)
 // Urgent derates are constant across DPMs and come from derate_table.system_active_urgent
-struct dml2_soc_derate_values_per_dpm {
-	unsigned int dram_derate_percent_pixel[DML_MAX_CLK_TABLE_SIZE];
-	unsigned int fclk_derate_percent[DML_MAX_CLK_TABLE_SIZE];
-	unsigned int dcfclk_derate_percent[DML_MAX_CLK_TABLE_SIZE];
-};
-
 struct dml2_soc_derates_per_dpm {
-	// Union allows both layouts to coexist without increasing struct size
-	// Anonymous structs allow direct member access without .v1 or .v2 prefix
-	union {
-		// Legacy layout - used by soc_and_ip_translator (unchanged access pattern)
-		// TODO: Remove after soc_and_ip_translator migration is complete
-		struct {
-			struct dml2_soc_derate_values_per_dpm system_active_derates_per_dpm;
-			unsigned int min_uclk_khz_threshold[DML_MAX_CLK_TABLE_SIZE];
-			unsigned int min_fclk_khz_threshold[DML_MAX_CLK_TABLE_SIZE];
-			unsigned int min_dcfclk_khz_threshold[DML_MAX_CLK_TABLE_SIZE];
-		};
-
-		// New layout - used by DML internally
-		// Arrays of derate/threshold pairs, one per DPM level
-		struct {
-			struct dml2_soc_derate_values_per_dpm_v2 dram_per_dpm_derate_pixel[DML_MAX_CLK_TABLE_SIZE];
-			struct dml2_soc_derate_values_per_dpm_v2 fclk_per_dpm_derate[DML_MAX_CLK_TABLE_SIZE];
-			struct dml2_soc_derate_values_per_dpm_v2 dcfclk_per_dpm_derate[DML_MAX_CLK_TABLE_SIZE];
-		};
-	};
+	struct dml2_soc_derate_values_per_dpm dram_per_dpm_derate_pixel[DML_MAX_CLK_TABLE_SIZE];
+	struct dml2_soc_derate_values_per_dpm fclk_per_dpm_derate[DML_MAX_CLK_TABLE_SIZE];
+	struct dml2_soc_derate_values_per_dpm dcfclk_per_dpm_derate[DML_MAX_CLK_TABLE_SIZE];
 };
 
 struct dml2_soc_qos_parameters {
Signature · 1 line
2.43.0
author
#19 lore raw

PATCH 19/59 drm/amd/display: Fix Order Of Operation In Calculate Flip Schedule

In reply to Alex Hung

From: Austin Zheng <[email protected]>

[WHY/HOW]
Tno_bw_flip is a time so it should be a part of the denominator in the bandwidth calculation.
Fix order of operation so Tno_bw_flip is properly accounted for when calculating the lower bandwidth bound.

---
 .../dml2_0/dml21/src/dml2_core/dml2_core_dcn5_calcs_dchub.c   | 4 ++--
 .../dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.c   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn5_calcs_dchub.c +2 -2
index ab778fac34b2..09047661a411 100644
@@ -4102,10 +4102,10 @@ void dcn5_calculate_flip_schedule(
 					DML_LOG_VERBOSE("DML::%s: Tvm_trips_flip_rounded + 2*Tr0_trips_flip_rounded = %f\n", __func__, (Tvm_trips_flip_rounded + 2 * Tr0_trips_flip_rounded));
 				}
 				l->lb_flip_bw = math_max3(l->lb_flip_bw,
-						l->hvm_scaled_vm_bytes / (31 * LineTime) - Tno_bw_flip,
+						l->hvm_scaled_vm_bytes / ((31 * LineTime) - Tno_bw_flip),
 						(l->dpte_row_bytes * HostVMInefficiencyFactor + meta_row_bytes) / (15 * LineTime));
 
-				DML_LOG_VERBOSE("DML::%s: lb_flip_bw for vm reg limit = %f\n", __func__, l->hvm_scaled_vm_bytes / (31 * LineTime) - Tno_bw_flip);
+				DML_LOG_VERBOSE("DML::%s: lb_flip_bw for vm reg limit = %f\n", __func__, l->hvm_scaled_vm_bytes / ((31 * LineTime) - Tno_bw_flip));
 				DML_LOG_VERBOSE("DML::%s: lb_flip_bw for row reg limit = %f\n", __func__, (l->dpte_row_bytes * HostVMInefficiencyFactor + meta_row_bytes) / (15 * LineTime));
 			}
 
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.c +2 -2
index bbc1121fd85a..ba0082e216d5 100644
@@ -631,10 +631,10 @@ void dcn6_calculate_flip_schedule(
 				DML_LOG_VERBOSE("DML::%s: Tvm_trips_flip_rounded + 2*Tr0_trips_flip_rounded = %f\n", __func__, (Tvm_trips_flip_rounded + 2 * Tr0_trips_flip_rounded));
 			}
 			l->lb_flip_bw = math_max3(l->lb_flip_bw,
-				l->hvm_scaled_vm_bytes / (31 * LineTime) - Tno_bw_flip,
+				l->hvm_scaled_vm_bytes / ((31 * LineTime) - Tno_bw_flip),
 				l->dpte_row_bytes * HostVMInefficiencyFactor / (15 * LineTime));
 
-			DML_LOG_VERBOSE("DML::%s: lb_flip_bw for vm reg limit = %f\n", __func__, l->hvm_scaled_vm_bytes / (31 * LineTime) - Tno_bw_flip);
+			DML_LOG_VERBOSE("DML::%s: lb_flip_bw for vm reg limit = %f\n", __func__, l->hvm_scaled_vm_bytes / ((31 * LineTime) - Tno_bw_flip));
 		}
 
 		*final_flip_bw = l->lb_flip_bw;
Signature · 1 line
2.43.0
author
#20 lore raw

PATCH 20/59 drm/amd/display: Remove const Qualifier From Non-Pointer Fields

In reply to Alex Hung

From: Austin Zheng <[email protected]>

[WHY/HOW]
Integer values for dml2_core_calcs_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport_params should not have the const qualifier.
This prevents using different values of the inputs when the function is called again.

---
 .../dc/dml2_0/dml21/src/dml2_core/dml2_core_shared_types.h    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_shared_types.h +2 -2
index 36250f3d83aa..df552eac0006 100644
@@ -1823,8 +1823,8 @@ struct dml2_core_calcs_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport_param
 	bool UnboundedRequestEnabled;
 	unsigned int CompressedBufferSizeInkByte;
 	bool max_outstanding_when_urgent_expected;
-	const unsigned int max_outstanding_requests;
-	const unsigned int max_request_size_bytes;
+	unsigned int max_outstanding_requests;
+	unsigned int max_request_size_bytes;
 	const unsigned int *meta_row_height_l;
 	const unsigned int *meta_row_height_c;
 	const enum dml2_pstate_method *uclk_pstate_switch_modes;
Signature · 1 line
2.43.0
author
#21 lore raw

PATCH 21/59 drm/amd/display: Model ASSERT as path terminator

In reply to Alex Hung

[WHAT]
ASSERT() and ASSERT_CRITICAL() expand to a WARN_ON() test that falls through, because dc_breakpoint() is a no-op unless CONFIG_DEBUG_KERNEL_DC is set.

Static analysers read that test as proof the asserted condition can fail, then keep walking the failing path because nothing stops it. The assert therefore manufactures the very defect it guards against, and Coverity reports DIVIDE_BY_ZERO defects whose entire path is the assert itself.

[HOW]
Redefine both macros to call a declaration-only __coverity_panic__() when the asserted condition fails, which marks the failing path as unreachable and leaves only genuinely reachable defects.

The override is guarded by __COVERITY__, which is defined only while the analyser captures the build, so the code emitted by a normal build is unchanged.

Assisted-by Copilot:Claude-Opus-5
---
 drivers/gpu/drm/amd/display/dc/os_types.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/gpu/drm/amd/display/dc/os_types.h +18 -0
index 538d00105738..339372293a98 100644
@@ -78,6 +78,23 @@
 #define dc_breakpoint()		do {} while (0)
 #endif
 
+#ifdef __COVERITY__
+/*
+ * Static analysers see the WARN_ON() test as proof that the asserted condition
+ * can fail, then keep walking the failing path because nothing stops it. Model
+ * the assert as a path terminator so only genuinely reachable defects survive.
+ * __COVERITY__ is defined during analysis capture only, so the code emitted by
+ * a real build is unchanged.
+ */
+void __coverity_panic__(void);
+
+#define ASSERT_CRITICAL(expr) do {		\
+		if (!(expr))			\
+			__coverity_panic__();	\
+	} while (0)
+
+#define ASSERT(expr) ASSERT_CRITICAL(expr)
+#else
 #define ASSERT_CRITICAL(expr) do {		\
 		if (WARN_ON(!(expr)))		\
 			dc_breakpoint();	\
@@ -87,6 +104,7 @@
 		if (WARN_ON_ONCE(!(expr)))	\
 			dc_breakpoint();	\
 	} while (0)
+#endif
 
 #define BREAK_TO_DEBUGGER() \
 	do { \
Signature · 1 line
2.43.0
author
#22 lore raw

PATCH 22/59 drm/amd/display: Update HDMI link rate and DSC handling for DCN60

In reply to Alex Hung

From: Relja Vojvodic <[email protected]>

[WHAT]
- Updated switch cases to handle new link rates
- Reverted set stream attribute behaviour to DCN401 version to unblock DSC on DCN 60

---
 .../drm/amd/display/dc/core/dc_link_exports.c |   3 +-
 .../drm/amd/display/dc/dml/dcn30/dcn30_fpu.c  |  18 ++-
 .../drm/amd/display/dc/dml/dml1_frl_cap_chk.c |   8 +-
 drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c   |   8 ++
 .../drm/amd/display/dc/dsc/dcn60/dcn60_dsc.c  |   4 +-
 .../hpo/dcn60/dcn60_hpo_frl_stream_encoder.c  | 131 +-----------------
 .../drm/amd/display/dc/link/link_detection.c  |   2 +
 7 files changed, 37 insertions(+), 137 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_exports.c +1 -2
index ba1b46d3a13e..fef857c7336b 100644
@@ -368,8 +368,7 @@ enum dc_link_encoding_format dc_link_get_highest_encoding_format(const struct dc
 
 		if (frl_link_settings->frl_link_rate == HDMI_FRL_LINK_RATE_DISABLE)
 			return DC_LINK_ENCODING_HDMI_TMDS;
-		else if (frl_link_settings->frl_link_rate >= HDMI_FRL_LINK_RATE_3GBPS &&
-				frl_link_settings->frl_link_rate <= HDMI_FRL_LINK_RATE_12GBPS)
+		else if (frl_link_settings->frl_link_rate >= HDMI_FRL_LINK_RATE_3GBPS)
 			return DC_LINK_ENCODING_HDMI_FRL;
 	}
 
drivers/gpu/drm/amd/display/dc/dml/dcn30/dcn30_fpu.c +16 -2
index 6f5a11d37899..b8e5985f9307 100644
@@ -774,12 +774,19 @@ void hpo_fpu_enc3_validate_hdmi_frl_output_link(struct hpo_frl_stream_encoder *e
 		frl_params->r_bit_nominal = 8.0e9;
 		break;
 	case HDMI_FRL_LINK_RATE_10GBPS:
-	default:
 		frl_params->r_bit_nominal = 10.0e9;
 		break;
 	case HDMI_FRL_LINK_RATE_12GBPS:
 		frl_params->r_bit_nominal = 12.0e9;
 		break;
+	case HDMI_FRL_LINK_RATE_16GBPS:
+		frl_params->r_bit_nominal = 16.0e9;
+		break;
+	case HDMI_FRL_LINK_RATE_20GBPS:
+		frl_params->r_bit_nominal = 20.0e9;
+		break;
+	default:
+		break;
 	}
 
 	if (timing->flags.DSC &&
@@ -802,12 +809,19 @@ void hpo_fpu_enc3_validate_hdmi_frl_output_link(struct hpo_frl_stream_encoder *e
 			frl_params->r_bit_nominal = 8.0e9;
 			break;
 		case HDMI_FRL_LINK_RATE_10GBPS:
-		default:
 			frl_params->r_bit_nominal = 10.0e9;
 			break;
 		case HDMI_FRL_LINK_RATE_12GBPS:
 			frl_params->r_bit_nominal = 12.0e9;
 			break;
+		case HDMI_FRL_LINK_RATE_16GBPS:
+			frl_params->r_bit_nominal = 16.0e9;
+			break;
+		case HDMI_FRL_LINK_RATE_20GBPS:
+			frl_params->r_bit_nominal = 20.0e9;
+			break;
+		default:
+			break;
 		}
 	}
 
drivers/gpu/drm/amd/display/dc/dml/dml1_frl_cap_chk.c +7 -1
index da2c92e5c02f..bfbc64163d01 100644
@@ -680,12 +680,18 @@ static double calculate_compressed_active_time(uint32_t h_active,
 		r_bit_nominal = 8.0e9;
 		break;
 	case FRL_LINK_RATE_10GBPS:
-	default:
 		r_bit_nominal = 10.0e9;
 		break;
 	case FRL_LINK_RATE_12GBPS:
 		r_bit_nominal = 12.0e9;
 		break;
+	case FRL_LINK_RATE_16GBPS:
+		r_bit_nominal = 16.0e9;
+		break;
+	case FRL_LINK_RATE_20GBPS:
+	default:
+		r_bit_nominal = 20.0e9;
+		break;
 	}
 
 	f_tb_average = pix_clk / (h_active + h_blank)
drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c +8 -0
index ba4988118c68..febb6af43827 100644
@@ -1290,6 +1290,14 @@ static bool convert_bandwidth_to_frl_params(
 		*num_lanes = 4;
 		*frl_rate = 12000;
 		break;
+	case 64000000:
+		*num_lanes = 4;
+		*frl_rate = 16000;
+		break;
+	case 80000000:
+		*num_lanes = 4;
+		*frl_rate = 20000;
+		break;
 	default:
 		return false;
 	}
drivers/gpu/drm/amd/display/dc/dsc/dcn60/dcn60_dsc.c +2 -2
index 0cfedd4268c6..5bb4ed1d1ba7 100644
@@ -60,7 +60,7 @@ void dsc60_construct(struct dcn60_dsc *dsc,
 	dsc->dsc_shift = dsc_shift;
 	dsc->dsc_mask = dsc_mask;
 
-	dsc->max_image_width = 5184;
+	dsc->max_image_width = 5760;
 }
 
 static void dsc60_init_reg_values(struct dsc60_reg_values *reg_vals)
@@ -181,7 +181,7 @@ static bool dsc60_prepare_config(const struct dsc_config *dsc_cfg, struct dsc60_
 
 	// TODO: in addition to validating slice height (pic height must be divisible by slice height),
 	// see what happens when the same condition doesn't apply for slice_width/pic_width.
-	dsc_reg_vals->pps.slice_width = (u16)(dsc_cfg->pic_width / dsc_cfg->dc_dsc_cfg.num_slices_h);
+	dsc_reg_vals->pps.slice_width = (u16)((dsc_cfg->pic_width + dsc_cfg->dsc_padding + dsc_cfg->dc_dsc_cfg.num_slices_h - 1) / dsc_cfg->dc_dsc_cfg.num_slices_h);
 	dsc_reg_vals->pps.slice_height = (u16)(dsc_cfg->pic_height / dsc_cfg->dc_dsc_cfg.num_slices_v);
 
 	ASSERT(dsc_reg_vals->pps.slice_height * dsc_cfg->dc_dsc_cfg.num_slices_v == dsc_cfg->pic_height);
drivers/gpu/drm/amd/display/dc/hpo/dcn60/dcn60_hpo_frl_stream_encoder.c +1 -130

143 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/link/link_detection.c +2 -0
index 1384197578ec..12fd4fd24a90 100644
@@ -995,6 +995,8 @@ static bool should_verify_link_capability_destructively(struct dc_link *link,
 					}
 				}
 			}
+		} else if (link->dc->debug.skip_detection_link_training) {
+			destrictive = false;
 		}
 	}
 
Signature · 1 line
2.43.0
author
#23 lore raw

PATCH 23/59 drm/amd/display: Remove pipe_ctx param from MPC_VISUAL_CONFIRM

In reply to Alex Hung

From: Tomasz Siemek <[email protected]>

[WHY]
Hwss executors shouldn't be coupled to complex dc structs such as pipe_ctx.

[HOW]
- Use mpc function instead of hwseq extension.
- Swap pipe_ctx for tg_color struct as BLS param.

---
 .../drm/amd/display/dc/core/dc_hw_sequencer.c    | 16 +++++++++-------
 .../gpu/drm/amd/display/dc/hwss/hw_sequencer.h   |  4 ++--
 2 files changed, 11 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +9 -7
index 7ad30a1f2978..0e2c85b28e7c 100644
@@ -1628,8 +1628,8 @@ void hwss_build_fast_sequence(struct dc *dc,
 			}
 			if (dc->debug.visual_confirm != VISUAL_CONFIRM_DISABLE &&
 				dc->hwss.update_visual_confirm_color) {
-				block_sequence[*num_steps].params.update_visual_confirm_params.dc = dc;
-				block_sequence[*num_steps].params.update_visual_confirm_params.pipe_ctx = current_mpc_pipe;
+				block_sequence[*num_steps].params.update_visual_confirm_params.mpc = dc->res_pool->mpc;
+				block_sequence[*num_steps].params.update_visual_confirm_params.color = &current_mpc_pipe->visual_confirm_color;
 				block_sequence[*num_steps].params.update_visual_confirm_params.mpcc_id = current_mpc_pipe->plane_res.mpcc_inst;
 				block_sequence[*num_steps].func = MPC_UPDATE_VISUAL_CONFIRM;
 				(*num_steps)++;
@@ -1787,9 +1787,11 @@ void hwss_execute_sequence(struct dc *dc,
 			hwss_program_upsp(params);
 			break;
 		case MPC_UPDATE_VISUAL_CONFIRM:
-			dc->hwss.update_visual_confirm_color(params->update_visual_confirm_params.dc,
-					params->update_visual_confirm_params.pipe_ctx,
-					params->update_visual_confirm_params.mpcc_id);
+			if (params->update_visual_confirm_params.mpc->funcs->set_bg_color)
+				params->update_visual_confirm_params.mpc->funcs->set_bg_color(
+						params->update_visual_confirm_params.mpc,
+						params->update_visual_confirm_params.color,
+						params->update_visual_confirm_params.mpcc_id);
 			break;
 		case MPC_POWER_ON_MPC_MEM_PWR:
 			hwss_power_on_mpc_mem_pwr(params);
@@ -2495,8 +2497,8 @@ void hwss_add_mpc_update_visual_confirm(struct block_sequence_state *seq_state,
 		int mpcc_id)
 {
 	if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
-		seq_state->steps[*seq_state->num_steps].params.update_visual_confirm_params.dc = dc;
-		seq_state->steps[*seq_state->num_steps].params.update_visual_confirm_params.pipe_ctx = pipe_ctx;
+		seq_state->steps[*seq_state->num_steps].params.update_visual_confirm_params.mpc = dc->res_pool->mpc;
+		seq_state->steps[*seq_state->num_steps].params.update_visual_confirm_params.color = &pipe_ctx->visual_confirm_color;
 		seq_state->steps[*seq_state->num_steps].params.update_visual_confirm_params.mpcc_id = mpcc_id;
 		seq_state->steps[*seq_state->num_steps].func = MPC_UPDATE_VISUAL_CONFIRM;
 		(*seq_state->num_steps)++;
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +2 -2
index 83d9d699e929..e7ab30e041d5 100644
@@ -163,8 +163,8 @@ struct program_upsp_params {
 };
 
 struct update_visual_confirm_params {
-	struct dc *dc;
-	struct pipe_ctx *pipe_ctx;
+	struct mpc *mpc;
+	struct tg_color *color;
 	int mpcc_id;
 };
 
Signature · 1 line
2.43.0
author
#24 lore raw

PATCH 24/59 drm/amd/display: Remove internal references

In reply to Alex Hung

From: Samson Tam <[email protected]>

[WHY/HOW]
Rename function and updated comments to remove internal references.

---
 drivers/gpu/drm/amd/display/dc/hubp/dcn21/dcn21_hubp.c | 6 +++---
 drivers/gpu/drm/amd/display/dc/hubp/dcn21/dcn21_hubp.h | 2 +-
 drivers/gpu/drm/amd/display/dc/hubp/dcn30/dcn30_hubp.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/hubp/dcn21/dcn21_hubp.c +3 -3
index 67828505939a..0dba8ff8a19d 100644
@@ -74,7 +74,7 @@
  * then update the regs with the new values.
  *
  */
-void apply_DEDCN21_142_wa_for_hostvm_deadline(
+void apply_hubp21_wa_for_hostvm_deadline(
 		struct hubp *hubp,
 		struct _vcs_dpi_display_dlg_regs_st *dlg_attr)
 {
@@ -131,7 +131,7 @@ void hubp21_program_deadline(
 {
 	hubp2_program_deadline(hubp, dlg_attr, ttu_attr);
 
-	apply_DEDCN21_142_wa_for_hostvm_deadline(hubp, dlg_attr);
+	apply_hubp21_wa_for_hostvm_deadline(hubp, dlg_attr);
 }
 
 void hubp21_program_requestor(
@@ -803,7 +803,7 @@ static bool hubp21_program_surface_flip_and_addr(
 
 static void hubp21_init(struct hubp *hubp)
 {
-	// DEDCN21-133: Inconsistent row starting line for flip between DPTE and Meta
+	// Inconsistent row starting line for flip between DPTE and Meta
 	// This is a chicken bit to enable the ECO fix.
 
 	struct dcn21_hubp *hubp21 = TO_DCN21_HUBP(hubp);
drivers/gpu/drm/amd/display/dc/hubp/dcn21/dcn21_hubp.h +1 -1
index 9873b6cbc5ba..418a981b8c9b 100644
@@ -119,7 +119,7 @@ bool hubp21_construct(
 	const struct dcn_hubp2_shift *hubp_shift,
 	const struct dcn_hubp2_mask *hubp_mask);
 
-void apply_DEDCN21_142_wa_for_hostvm_deadline(
+void apply_hubp21_wa_for_hostvm_deadline(
 		struct hubp *hubp,
 		struct _vcs_dpi_display_dlg_regs_st *dlg_attr);
 
drivers/gpu/drm/amd/display/dc/hubp/dcn30/dcn30_hubp.c +1 -1
index 3e5ae0eae39f..4f5f10f6d1cc 100644
@@ -615,7 +615,7 @@ void hubp3_setup(
 
 void hubp3_init(struct hubp *hubp)
 {
-	// DEDCN21-133: Inconsistent row starting line for flip between DPTE and Meta
+	// Inconsistent row starting line for flip between DPTE and Meta
 	// This is a chicken bit to enable the ECO fix.
 
 	struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
Signature · 1 line
2.43.0
author
#25 lore raw

PATCH 25/59 drm/amd/display: Change RBBMIF timeout control conditions

In reply to Alex Hung

From: Dillon Varone <[email protected]>

[WHY&HOW]
RBBMIF timeout should not be disabled to prevent register access hang.

---
 drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +0 -4
index 38d587af9dd8..1e60b852e61f 100644
@@ -3208,10 +3208,6 @@ void dcn20_fpga_init_hw(struct dc *dc)
 	if (hws->funcs.enable_power_gating_plane)
 		hws->funcs.enable_power_gating_plane(hws, true);
 
-	// Specific to FPGA dccg and registers
-	REG_WRITE(RBBMIF_TIMEOUT_DIS, 0xFFFFFFFF);
-	REG_WRITE(RBBMIF_TIMEOUT_DIS_2, 0xFFFFFFFF);
-
 	dcn10_hubbub_global_timer_enable(dc->res_pool->hubbub, true, 2);
 
 	if (hws->funcs.dccg_init)
Signature · 1 line
2.43.0
author
#26 lore raw

PATCH 26/59 drm/amd/display: Test backlight caps validation

In reply to Alex Hung

[WHAT]
The sanity check applied to the backlight caps reported by the firmware sits inside a CONFIG_ACPI block. The UML KUnit build cannot enable CONFIG_ACPI, so that logic is never built and stays uncovered.

[HOW]
Move the check into amdgpu_dm_validate_backlight_caps() and build it whenever CONFIG_ACPI or the KUnit tests are enabled. Behaviour of amdgpu_dm_update_backlight_caps() is unchanged.

Add a parameterized test for amdgpu_dm_validate_backlight_caps() covering sane caps, a max above the 8-bit range, a negative min and a spread narrower than AMDGPU_DM_MIN_SPREAD.

Assisted-by Copilot:Claude-Opus-5
---
 .../display/amdgpu_dm/amdgpu_dm_backlight.c   | 33 +++++++++-----
 .../display/amdgpu_dm/amdgpu_dm_backlight.h   |  1 +
 .../tests/amdgpu_dm_backlight_test.c          | 44 +++++++++++++++++++
 3 files changed, 66 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c +21 -12
index e61bbc310f33..a5ad59ec3e81 100644
@@ -49,6 +49,25 @@
 #include "amd_shared.h"
 #include "dm_helpers.h"
 
+#if defined(CONFIG_ACPI) || IS_ENABLED(CONFIG_DRM_AMD_DC_KUNIT_TEST)
+STATIC_IFN_KUNIT
+void amdgpu_dm_validate_backlight_caps(struct amdgpu_display_manager *dm, int bl_idx)
+{
+	struct amdgpu_dm_backlight_caps *caps = &dm->backlight_caps[bl_idx];
+	int spread = caps->max_input_signal - caps->min_input_signal;
+
+	if (caps->max_input_signal > AMDGPU_DM_DEFAULT_MAX_BACKLIGHT ||
+	    caps->min_input_signal < 0 ||
+	    spread > AMDGPU_DM_DEFAULT_MAX_BACKLIGHT ||
+	    spread < AMDGPU_DM_MIN_SPREAD) {
+		drm_dbg_kms(adev_to_drm(dm->adev), "DM: Invalid backlight caps: min=%d, max=%d\n",
+			    caps->min_input_signal, caps->max_input_signal);
+		caps->caps_valid = false;
+	}
+}
+EXPORT_IF_KUNIT(amdgpu_dm_validate_backlight_caps);
+#endif
+
 void amdgpu_dm_update_backlight_caps(struct amdgpu_display_manager *dm,
 				     int bl_idx)
 {
@@ -61,18 +80,8 @@ void amdgpu_dm_update_backlight_caps(struct amdgpu_display_manager *dm,
 	amdgpu_acpi_get_backlight_caps(caps);
 
 	/* validate the firmware value is sane */
-	if (caps->caps_valid) {
-		int spread = caps->max_input_signal - caps->min_input_signal;
-
-		if (caps->max_input_signal > AMDGPU_DM_DEFAULT_MAX_BACKLIGHT ||
-		    caps->min_input_signal < 0 ||
-		    spread > AMDGPU_DM_DEFAULT_MAX_BACKLIGHT ||
-		    spread < AMDGPU_DM_MIN_SPREAD) {
-			drm_dbg_kms(adev_to_drm(dm->adev), "DM: Invalid backlight caps: min=%d, max=%d\n",
-				      caps->min_input_signal, caps->max_input_signal);
-			caps->caps_valid = false;
-		}
-	}
+	if (caps->caps_valid)
+		amdgpu_dm_validate_backlight_caps(dm, bl_idx);
 #else
 	if (caps->aux_support)
 		return;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.h +1 -0
index 07b75064847c..9ad888d3ae7b 100644
@@ -53,6 +53,7 @@ bool amdgpu_dm_should_create_sysfs(struct amdgpu_dm_connector *aconnector);
 extern const struct attribute_group amdgpu_group;
 
 #if IS_ENABLED(CONFIG_DRM_AMD_DC_KUNIT_TEST)
+void amdgpu_dm_validate_backlight_caps(struct amdgpu_display_manager *dm, int bl_idx);
 struct dc_stream_state *dm_find_stream_with_link(struct amdgpu_display_manager *dm,
 						 struct dc_link *link);
 int amdgpu_dm_backlight_update_status(struct backlight_device *bd);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_backlight_test.c +44 -0

56 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#27 lore raw

PATCH 27/59 drm/amd/display: Skip ACPI backlight caps test

In reply to Alex Hung

[WHAT]
dm_test_backlight_caps_aux_support_noop() covers the !CONFIG_ACPI branch of amdgpu_dm_update_backlight_caps() and is wrapped in #if !defined(CONFIG_ACPI). An ACPI build silently drops it from the suite and never compiles it.

dm_test_backlight_caps_non_aux_sets_defaults() adds nothing: the defaults block it asserts is already exercised by dm_test_register_backlight_device_success().

[HOW]
Compile dm_test_backlight_caps_aux_support_noop() unconditionally and call kunit_skip() when CONFIG_ACPI is enabled, so it is reported as skipped instead of disappearing. Drop the redundant test and group the remaining KUNIT_CASE entries under amdgpu_dm_update_backlight_caps().

Assisted-by Copilot:Claude-Opus-5
---
 .../tests/amdgpu_dm_backlight_test.c          | 31 +++----------------
 1 file changed, 4 insertions(+), 27 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_backlight_test.c +4 -27
index 5a8eb9e54b6c..5221050dec2f 100644
@@ -747,8 +747,6 @@ static void dm_test_backlight_caps_valid_short_circuit(struct kunit *test)
 	KUNIT_EXPECT_EQ(test, caps->max_input_signal, 199);
 }
 
-#if !defined(CONFIG_ACPI)
-
 /**
  * dm_test_backlight_caps_aux_support_noop - Test Backlight caps aux support noop
  * @test: The KUnit test context
@@ -758,6 +756,9 @@ static void dm_test_backlight_caps_aux_support_noop(struct kunit *test)
 	struct amdgpu_display_manager *dm = dm_kunit_alloc_dm(test);
 	struct amdgpu_dm_backlight_caps *caps = &dm->backlight_caps[0];
 
+	if (IS_ENABLED(CONFIG_ACPI))
+		kunit_skip(test, "caps are queried from ACPI firmware in this build");
+
 	caps->caps_valid = false;
 	caps->aux_support = true;
 	caps->min_input_signal = 11;
@@ -770,28 +771,6 @@ static void dm_test_backlight_caps_aux_support_noop(struct kunit *test)
 	KUNIT_EXPECT_EQ(test, caps->max_input_signal, 222);
 }
 
-/**
- * dm_test_backlight_caps_non_aux_sets_defaults - Test Backlight caps non aux sets defaults
- * @test: The KUnit test context
- */
-static void dm_test_backlight_caps_non_aux_sets_defaults(struct kunit *test)
-{
-	struct amdgpu_display_manager *dm = dm_kunit_alloc_dm(test);
-	struct amdgpu_dm_backlight_caps *caps = &dm->backlight_caps[0];
-
-	caps->caps_valid = false;
-	caps->aux_support = false;
-	caps->min_input_signal = 0;
-	caps->max_input_signal = 0;
-
-	amdgpu_dm_update_backlight_caps(dm, 0);
-
-	KUNIT_EXPECT_TRUE(test, caps->caps_valid);
-	KUNIT_EXPECT_EQ(test, caps->min_input_signal, AMDGPU_DM_DEFAULT_MIN_BACKLIGHT);
-	KUNIT_EXPECT_EQ(test, caps->max_input_signal, AMDGPU_DM_DEFAULT_MAX_BACKLIGHT);
-}
-#endif
-
 /* Tests for amdgpu_dm_validate_backlight_caps() */
 
 struct dm_validate_caps_param {
@@ -1965,11 +1944,9 @@ static struct kunit_case dm_backlight_test_cases[] = {
 	/* amdgpu_dm_backlight_get_device_index */
 	KUNIT_CASE(dm_test_backlight_device_index_matches_second),
 	KUNIT_CASE(dm_test_backlight_device_index_missing_fallback),
+	/* amdgpu_dm_update_backlight_caps */
 	KUNIT_CASE(dm_test_backlight_caps_valid_short_circuit),
-#if !defined(CONFIG_ACPI)
 	KUNIT_CASE(dm_test_backlight_caps_aux_support_noop),
-	KUNIT_CASE(dm_test_backlight_caps_non_aux_sets_defaults),
-#endif
 	/* amdgpu_dm_validate_backlight_caps */
 	KUNIT_CASE_PARAM(dm_test_validate_backlight_caps, dm_validate_caps_gen_params),
 	/* get_brightness_range */
Signature · 1 line
2.43.0
author
#28 lore raw

PATCH 28/59 drm/amd/display: Move DML Wrapper into its own Component

In reply to Alex Hung

From: Austin Zheng <[email protected]>

[WHY/HOW]
DML wrapper is used to bridge between DC and DML.
Put DML wrapper files in their own folder to help
distinguish the boundary between DC and DML.

Assisted-by Copilot:Claude-Opus-5
---
 drivers/gpu/drm/amd/display/dc/Makefile       |   1 +
 drivers/gpu/drm/amd/display/dc/core/dc.c      |   2 +-
 .../gpu/drm/amd/display/dc/core/dc_resource.c |   2 +-
 .../gpu/drm/amd/display/dc/core/dc_state.c    |   4 +-
 drivers/gpu/drm/amd/display/dc/dc.h           |   2 +-
 .../gpu/drm/amd/display/dc/dml2_0/Makefile    |  22 ----
 .../display/dc/dml2_0/dml21/dml21_wrapper.h   | 106 -----------------
 .../drm/amd/display/dc/dml2_wrapper/Makefile  |  61 ++++++++++
 .../dml21_wrapper}/dml21_translation_helper.c |  15 ++-
 .../dml21_wrapper}/dml21_translation_helper.h |   7 +-
 .../dml21_wrapper}/dml21_utils.c              |  11 +-
 .../dml21_wrapper}/dml21_utils.h              |   7 +-
 .../dml21_wrapper}/dml21_wrapper.c            |   2 +-
 .../dml21_wrapper/dml21_wrapper.h             | 107 ++++++++++++++++++
 .../dml21_wrapper}/dml21_wrapper_fpu.c        |  19 +++-
 .../dml21_wrapper}/dml21_wrapper_fpu.h        |   7 +-
 .../dml2_dc_resource_mgmt.c                   |  60 ++++++----
 .../dml2_dc_resource_mgmt.h                   |   0
 .../{dml2_0 => dml2_wrapper}/dml2_dc_types.h  |   0
 .../dml2_internal_types.h                     |   2 +-
 .../dml2_mall_phantom.c                       |  70 +++++++-----
 .../dml2_mall_phantom.h                       |   0
 .../dc/{dml2_0 => dml2_wrapper}/dml2_policy.c |   2 +-
 .../dc/{dml2_0 => dml2_wrapper}/dml2_policy.h |   0
 .../dml2_translation_helper.c                 |  20 ++--
 .../dml2_translation_helper.h                 |   0
 .../dc/{dml2_0 => dml2_wrapper}/dml2_utils.c  |  28 +++--
 .../dc/{dml2_0 => dml2_wrapper}/dml2_utils.h  |   0
 .../{dml2_0 => dml2_wrapper}/dml2_wrapper.c   |   6 +-
 .../{dml2_0 => dml2_wrapper}/dml2_wrapper.h   |   0
 .../dml2_wrapper_fpu.c                        |  45 ++++----
 .../dml2_wrapper_fpu.h                        |   0
 .../dc/resource/dcn32/dcn32_resource.c        |   2 +-
 .../dc/resource/dcn35/dcn35_resource.c        |   2 +-
 .../dc/resource/dcn351/dcn351_resource.c      |   2 +-
 .../dc/resource/dcn36/dcn36_resource.c        |   2 +-
 .../dc/resource/dcn401/dcn401_resource.c      |   2 +-
 .../dc/resource/dcn42/dcn42_resource.c        |   2 +-
 .../dc/resource/dcn42b/dcn42b_resource.c      |   2 +-
 .../dc/resource/dcn60/dcn60_resource.c        |   4 +-
 40 files changed, 366 insertions(+), 260 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_wrapper.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/dml2_wrapper/Makefile
 rename drivers/gpu/drm/amd/display/dc/{dml2_0/dml21 => dml2_wrapper/dml21_wrapper}/dml21_translation_helper.c (99%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0/dml21 => dml2_wrapper/dml21_wrapper}/dml21_translation_helper.h (94%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0/dml21 => dml2_wrapper/dml21_wrapper}/dml21_utils.c (99%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0/dml21 => dml2_wrapper/dml21_wrapper}/dml21_utils.h (96%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0/dml21 => dml2_wrapper/dml21_wrapper}/dml21_wrapper.c (100%)
 create mode 100644 drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml21_wrapper/dml21_wrapper.h
 rename drivers/gpu/drm/amd/display/dc/{dml2_0/dml21 => dml2_wrapper/dml21_wrapper}/dml21_wrapper_fpu.c (96%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0/dml21 => dml2_wrapper/dml21_wrapper}/dml21_wrapper_fpu.h (95%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_dc_resource_mgmt.c (96%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_dc_resource_mgmt.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_dc_types.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_internal_types.h (99%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_mall_phantom.c (97%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_mall_phantom.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_policy.c (99%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_policy.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_translation_helper.c (99%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_translation_helper.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_utils.c (98%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_utils.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_wrapper.c (97%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_wrapper.h (100%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_wrapper_fpu.c (93%)
 rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_wrapper_fpu.h (100%)
drivers/gpu/drm/amd/display/dc/Makefile +1 -0
index 93d02956c5eb..6ddf4cbda714 100644
@@ -37,6 +37,7 @@ DC_LIBS += dcn301
 DC_LIBS += dcn31
 DC_LIBS += dml
 DC_LIBS += dml2_0
+DC_LIBS += dml2_wrapper
 DC_LIBS += soc_and_ip_translator
 endif
 
drivers/gpu/drm/amd/display/dc/core/dc.c +1 -1
index e40bad702f0f..ebbd81995c38 100644
@@ -85,7 +85,7 @@
 #include "hw_sequencer_private.h"
 
 #if defined(CONFIG_DRM_AMD_DC_FP)
-#include "dml2_0/dml2_internal_types.h"
+#include "dml2_wrapper/dml2_internal_types.h"
 #include "soc_and_ip_translator.h"
 #endif
 
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +1 -1
index 837af136464b..ac558e715b72 100644
@@ -102,7 +102,7 @@
 #define DC_LOGGER_INIT(logger)
 #include "link/hwss/link_hwss_hpo_frl.h"
 #include "dml/dml1_frl_cap_chk.h"
-#include "dml2_0/dml2_wrapper.h"
+#include "dml2_wrapper/dml2_wrapper.h"
 
 #define UNABLE_TO_SPLIT -1
 
drivers/gpu/drm/amd/display/dc/core/dc_state.c +2 -2
index 666212cac105..1e4fe2f941ca 100644
@@ -36,8 +36,8 @@
 #include "link_enc_cfg.h"
 
 #if defined(CONFIG_DRM_AMD_DC_FP)
-#include "dml2_0/dml2_wrapper.h"
-#include "dml2_0/dml2_internal_types.h"
+#include "dml2_wrapper/dml2_wrapper.h"
+#include "dml2_wrapper/dml2_internal_types.h"
 #endif
 
 #define DC_LOGGER \
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
index 1ccd10533e0b..c7d5d60ff4c6 100644
@@ -43,7 +43,7 @@
 #include "inc/hw/dmcu.h"
 #include "dml/display_mode_lib.h"
 
-#include "dml2_0/dml2_wrapper.h"
+#include "dml2_wrapper/dml2_wrapper.h"
 
 #include "dmub/inc/dmub_cmd.h"
 
drivers/gpu/drm/amd/display/dc/dml2_0/Makefile +0 -22
index f3427e83126e..5ea79e8d84db 100644
@@ -81,14 +81,6 @@ CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn5_funcs_mode_sup
 CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_programming.o := $(dml2_ccflags) $(frame_warn_flag)
 CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_funcs_mode_support.o := $(dml2_ccflags) $(frame_warn_flag)
 
-#Wrapper files are being moved to their own component. Use a flag to transition once files are moved.
-ifndef DML2_WRAPPER_STANDALONE
-CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml2_wrapper.o := $(dml2_rcflags)
-CFLAGS_$(AMDDALPATH)/dc/dml2_0/dml21/dml21_wrapper.o := $(dml2_rcflags)
-CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml2_wrapper.o := $(dml2_ccflags)
-CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/dml21_wrapper.o := $(dml2_ccflags)
-endif
-
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/display_mode_core.o := $(dml2_rcflags)
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn4_calcs.o := $(dml2_rcflags)
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml21/src/dml2_core/dml2_core_utils.o := $(dml2_rcflags)
@@ -102,12 +94,6 @@ DML2 = display_mode_core.o display_mode_util.o \
 		dml_display_rq_dlg_calc.o
 DML2 += dml_frl_cap_chk.o
 
-#Wrapper files are being moved to their own component. Use a flag to transition once files are moved.
-ifndef DML2_WRAPPER_STANDALONE
-DML2 += dml2_wrapper_fpu.o dml2_wrapper.o \
-		dml2_utils.o dml2_policy.o dml2_translation_helper.o dml2_dc_resource_mgmt.o dml2_mall_phantom.o
-endif
-
 AMD_DAL_DML2 = $(addprefix $(AMDDALPATH)/dc/dml2_0/,$(DML2))
 
 AMD_DISPLAY_FILES += $(AMD_DAL_DML2)
@@ -153,14 +139,6 @@ DML21 += src/dml2_pmo/dml2_pmo_dcn6_stage_optimizers.o
 DML21 += src/dml2_standalone_libraries/alternate_pstate_shared_lib.o
 DML21 += src/dml2_utm_soc_bb/dml2_utm_soc_bb_dcn6.o
 
-#Wrapper files are being moved to their own component. Use a flag to transition once files are moved.
-ifndef DML2_WRAPPER_STANDALONE
-DML21 += dml21_translation_helper.o
-DML21 += dml21_wrapper.o
-DML21 += dml21_wrapper_fpu.o
-DML21 += dml21_utils.o
-endif
-
 AMD_DAL_DML21 = $(addprefix $(AMDDALPATH)/dc/dml2_0/dml21/,$(DML21))
 
 AMD_DISPLAY_FILES += $(AMD_DAL_DML21)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_wrapper.h deleted +0 -106

106 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dml2_wrapper/Makefile new file +61 -0

61 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml21_wrapper/dml21_translation_helper.c renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_translation_helper.c +11 -4
similarity index 99%
rename from drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_translation_helper.c
rename to drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml21_wrapper/dml21_translation_helper.c
index 79da467ddb5d..3c25de54d55b 100644
@@ -44,6 +44,7 @@ static void dml21_populate_pmo_options(struct dml2_pmo_options *pmo_options,
 static enum dml2_project_id dml21_dcn_revision_to_dml2_project_id(const struct dc *in_dc)
 {
 	enum dml2_project_id project_id;
+
 	switch (in_dc->ctx->dce_version) {
 	case DCN_VERSION_4_01:
 		project_id = dml2_project_dcn4x_stage2_auto_drr_svp;
@@ -54,6 +55,8 @@ static enum dml2_project_id dml21_dcn_revision_to_dml2_project_id(const struct d
 		break;
 	case DCN_VERSION_6_0:
 		project_id = dml2_project_dcn6x_soc_var_a;
+		if (ASICREV_IS_DCN6_VARIANT_LITE3(in_dc->ctx->asic_id.hw_internal_rev))
+			project_id = dml2_project_dcn6x_soc_var_b;
 		break;
 	default:
 		project_id = dml2_project_invalid;
@@ -179,6 +182,7 @@ static void populate_dml21_timing_config_from_stream_state(struct dml2_timing_cf
 
 	{
 		uint64_t min_refresh = max((uint64_t)stream->timing.min_refresh_in_uhz, min_hardware_refresh_in_uhz);
+
 		ASSERT(min_refresh <= ULONG_MAX);
 		timing->drr_config.min_refresh_uhz = (unsigned long)min_refresh;
 	}
@@ -307,7 +311,7 @@ static void populate_dml21_writeback_config_from_stream_state(struct dml2_writeb
 		writeback->active_writebacks_per_stream = stream->num_wb_info <= DML2_MAX_WRITEBACK ?
 				stream->num_wb_info : DML2_MAX_WRITEBACK;
 
-		ASSERT(stream->num_wb_info <= DML2_MAX_WRITEBACK);
+		ASSERT(stream->num_wb_info <= MAX_DWB_PIPES);
 
 		for (unsigned int wb_index = 0; wb_index < stream->num_wb_info; wb_index++) {
 			const struct dc_writeback_info *dc_wb_info = &stream->writeback_info[wb_index];
@@ -705,7 +709,8 @@ static void populate_dml21_plane_config_from_plane_state(struct dml2_context *dm
 	plane->composition.scaler_info.upsp_enabled = (scaler_data->upsp != UPSP_BYPASS);
 
 	/* always_scale is only used for debug purposes not used in production but has to be
-	 * maintained for certain complainces. */
+	 * maintained for certain complainces.
+	 */
 	if (plane_state->ctx->dc->debug.always_scale == true) {
 		plane->composition.scaler_info.enabled = true;
 	}
@@ -821,7 +826,7 @@ static void populate_dml21_plane_config_from_plane_state(struct dml2_context *dm
 
 	plane->composition.rect_out_height_spans_vactive =
 		plane_state->dst_rect.height >= stream->src.height &&
-		stream->dst.height >= stream->timing.v_addressable;
+		stream->dst.height >= (int)stream->timing.v_addressable;
 }
 
 //TODO : Could be possibly moved to a common helper layer.
@@ -946,6 +951,7 @@ bool dml21_map_dc_state_into_dml_display_cfg(const struct dc *in_dc, struct dc_s
 		ASSERT(otg_master_pipe);
 
 		ASSERT(disp_cfg_stream_location >= 0 && disp_cfg_stream_location < __DML2_WRAPPER_MAX_STREAMS_PLANES__);
+
 		populate_dml21_timing_config_from_stream_state(&dml_dispcfg->stream_descriptors[disp_cfg_stream_location].timing, context->streams[stream_index], otg_master_pipe, dml_ctx);
 		populate_dml21_output_config_from_stream_state(&dml_dispcfg->stream_descriptors[disp_cfg_stream_location].output, context->streams[stream_index], otg_master_pipe);
 		populate_dml21_writeback_config_from_stream_state(&dml_dispcfg->stream_descriptors[disp_cfg_stream_location].writeback, context->streams[stream_index]);
@@ -1004,7 +1010,7 @@ bool dml21_map_dc_state_into_dml_display_cfg(const struct dc *in_dc, struct dc_s
 
 void dml21_copy_clocks_to_dc_state(struct dml2_context *in_ctx, struct dc_state *context)
 {
-	/* TODO these should be the max of active, svp prefetch and idle should be tracked seperately */
+	/* TODO these should be the max of active, svp prefetch and idle should be tracked separately */
 	context->bw_ctx.bw.dcn.clk.dispclk_khz = in_ctx->v21.mode_programming.programming->min_clocks.dcn4x.dispclk_khz;
 	context->bw_ctx.bw.dcn.clk.dcfclk_khz = in_ctx->v21.mode_programming.programming->min_clocks.dcn4x.active.dcfclk_khz;
 	context->bw_ctx.bw.dcn.clk.dramclk_khz = in_ctx->v21.mode_programming.programming->min_clocks.dcn4x.active.uclk_khz;
@@ -1169,3 +1175,4 @@ void dml21_init_min_clocks_for_dc_state(struct dml2_context *in_ctx, struct dc_s
 	min_clocks->stutter_efficiency.z8_stutter_period = 100000;
 	min_clocks->zstate_support = DCN_ZSTATE_SUPPORT_ALLOW;
 }
+
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml21_wrapper/dml21_translation_helper.h renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_translation_helper.h +4 -3
similarity index 94%
rename from drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_translation_helper.h
rename to drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml21_wrapper/dml21_translation_helper.h
index f51d3d8a52c3..ceb50a94f7a0 100644
@@ -1,6 +1,7 @@
-// SPDX-License-Identifier: MIT
-//
-// Copyright 2024 Advanced Micro Devices, Inc.
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright 2024 Advanced Micro Devices, Inc.
+ */
 
 
 #ifndef _DML21_TRANSLATION_HELPER_H_
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml21_wrapper/dml21_utils.c renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_utils.c +8 -3
similarity index 99%
rename from drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_utils.c
rename to drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml21_wrapper/dml21_utils.c
index 125ca619c8ab..0aecfa8b909f 100644
@@ -14,6 +14,7 @@
 int dml21_helper_find_dml_pipe_idx_by_stream_id(struct dml2_context *ctx, unsigned int stream_id)
 {
 	int i;
+
 	for (i = 0; i < __DML2_WRAPPER_MAX_STREAMS_PLANES__; i++) {
 		if (ctx->v21.dml_to_dc_pipe_mapping.dml_pipe_idx_to_stream_id_valid[i] && ctx->v21.dml_to_dc_pipe_mapping.dml_pipe_idx_to_stream_id[i] == stream_id)
 			return  i;
@@ -25,6 +26,7 @@ int dml21_helper_find_dml_pipe_idx_by_stream_id(struct dml2_context *ctx, unsign
 int dml21_find_dml_pipe_idx_by_plane_id(struct dml2_context *ctx, unsigned int plane_id)
 {
 	int i;
+
 	for (i = 0; i < __DML2_WRAPPER_MAX_STREAMS_PLANES__; i++) {
 		if (ctx->v21.dml_to_dc_pipe_mapping.dml_pipe_idx_to_plane_id_valid[i] && ctx->v21.dml_to_dc_pipe_mapping.dml_pipe_idx_to_plane_id[i] == plane_id)
 			return  i;
@@ -120,6 +122,7 @@ int dml21_find_dc_pipes_for_plane(const struct dc *in_dc,
 	} else {
 		/* stream was configured with dummy plane, so get pipes from opp head */
 		struct pipe_ctx *otg_master_pipe = dml_ctx->config.callbacks.get_otg_master_for_stream(&context->res_ctx, dc_main_stream);
+
 		if (otg_master_pipe != NULL)
 			num_pipes = dml_ctx->config.callbacks.get_opp_heads_for_otg_master(otg_master_pipe, &context->res_ctx, dc_main_pipes);
 	}
@@ -196,7 +199,7 @@ bool check_dp2p0_output_encoder(const struct pipe_ctx *pipe_ctx)
 
 static bool is_sub_vp_enabled(struct dc *dc, struct dc_state *context)
 {
-	int i;
+	unsigned int i;
 
 	for (i = 0; i < dc->res_pool->pipe_count; i++) {
 		struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
@@ -377,7 +380,8 @@ void dml21_handle_phantom_streams_planes(const struct dc *dc, struct dc_state *c
 
 static uint32_t calc_svp_size_256kb(uint64_t addr_bytes)
 {
-    return (uint32_t)(((addr_bytes + 0x3FFFFull) >> 18) << 2); // ceil to 256KB, then return bits [47:16]
+	/* ceil to 256KB, then return bits [47:16] */
+	return (uint32_t)(((addr_bytes + 0x3FFFFull) >> 18) << 2);
 }
 
 
@@ -505,7 +509,8 @@ static unsigned int dml21_build_fams2_stream_programming_v2(const struct dc *dc,
 		struct dc_state *context,
 		struct dml2_context *dml_ctx)
 {
-	int dc_stream_idx, dc_plane_idx, dc_pipe_idx;
+	int dc_stream_idx, dc_plane_idx;
+	unsigned int dc_pipe_idx;
 	unsigned int num_fams2_streams = 0;
 
 	for (dc_stream_idx = 0; dc_stream_idx < context->stream_count; dc_stream_idx++) {
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml21_wrapper/dml21_utils.h renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_utils.h +4 -3
similarity index 96%
rename from drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_utils.h
rename to drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml21_wrapper/dml21_utils.h
index 7312c33143c6..c30a5b2a99a6 100644
@@ -1,6 +1,7 @@
-// SPDX-License-Identifier: MIT
-//
-// Copyright 2024 Advanced Micro Devices, Inc.
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright 2024 Advanced Micro Devices, Inc.
+ */
 
 
 #ifndef _DML21_UTILS_H_
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml21_wrapper/dml21_wrapper.c renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_wrapper.c +1 -1
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_wrapper.c
rename to drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml21_wrapper/dml21_wrapper.c
index 8bed59e976d1..fb7c1759dc09 100644
@@ -13,6 +13,7 @@
 #include "dml2_wrapper_fpu.h"
 #include "dml21_wrapper.h"
 #include "dml21_wrapper_fpu.h"
+
 #include "dc_fpu.h"
 
 #if !defined(DC_RUN_WITH_PREEMPTION_ENABLED)
@@ -38,7 +39,6 @@ static bool dml21_allocate_memory(struct dml2_context **dml_ctx)
 	(*dml_ctx)->v21.mode_programming.display_config = (*dml_ctx)->v21.mode_support.display_config;
 
 	DC_RUN_WITH_PREEMPTION_ENABLED((*dml_ctx)->v21.mode_programming.programming = vzalloc(sizeof(struct dml2_display_cfg_programming)));
-
 	if (!((*dml_ctx)->v21.mode_programming.programming))
 		return false;
 
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml21_wrapper/dml21_wrapper.h new file +107 -0

107 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml21_wrapper/dml21_wrapper_fpu.c renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_wrapper_fpu.c +13 -6
similarity index 96%
rename from drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_wrapper_fpu.c
rename to drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml21_wrapper/dml21_wrapper_fpu.c
index aba7dd65c539..a1525f7e0e61 100644
@@ -69,6 +69,7 @@ static void dml21_calculate_rq_and_dlg_params(const struct dc *dc, struct dc_sta
 	(void)out_new_hw_state;
 	(void)pipe_cnt;
 	unsigned int dml_prog_idx = 0, dc_pipe_index = 0, num_dpps_required = 0;
+	unsigned int pipe_count = 0;
 	struct dml2_per_plane_programming *pln_prog = NULL;
 	struct dml2_per_stream_programming *stream_prog = NULL;
 	struct pipe_ctx *dc_main_pipes[__DML2_WRAPPER_MAX_STREAMS_PLANES__];
@@ -109,8 +110,10 @@ static void dml21_calculate_rq_and_dlg_params(const struct dc *dc, struct dc_sta
 		if (num_pipes <= 0)
 			continue;
 
+		pipe_count = (unsigned int)num_pipes;
+
 		/* program each pipe */
-		for (dc_pipe_index = 0; dc_pipe_index < num_pipes; dc_pipe_index++) {
+		for (dc_pipe_index = 0; dc_pipe_index < pipe_count; dc_pipe_index++) {
 			dml21_program_dc_pipe(in_ctx, context, dc_main_pipes[dc_pipe_index], pln_prog, stream_prog);
 
 			if (pln_prog->phantom_plane.valid && dc_phantom_pipes[dc_pipe_index]) {
@@ -302,7 +305,7 @@ bool dml21_validate(const struct dc *in_dc, struct dc_state *context, struct dml
 
 void dml21_prepare_mcache_programming(struct dc *in_dc, struct dc_state *context, struct dml2_context *dml_ctx)
 {
-	unsigned int dml_prog_idx, dml_phantom_prog_idx, dc_pipe_index;
+	unsigned int dml_prog_idx, dml_phantom_prog_idx, dc_pipe_index, pipe_count;
 	int num_pipes;
 	struct pipe_ctx *dc_main_pipes[__DML2_WRAPPER_MAX_STREAMS_PLANES__];
 	struct pipe_ctx *dc_phantom_pipes[__DML2_WRAPPER_MAX_STREAMS_PLANES__] = {0};
@@ -342,8 +345,10 @@ void dml21_prepare_mcache_programming(struct dc *in_dc, struct dc_state *context
 		    dc_main_pipes[0]->plane_state == NULL)
 			continue;
 
+		pipe_count = (unsigned int)num_pipes;
+
 		/* get config for each pipe */
-		for (dc_pipe_index = 0; dc_pipe_index < num_pipes; dc_pipe_index++) {
+		for (dc_pipe_index = 0; dc_pipe_index < pipe_count; dc_pipe_index++) {
 			ASSERT(dc_main_pipes[dc_pipe_index]);
 			dml21_get_pipe_mcache_config(context, dc_main_pipes[dc_pipe_index], pln_prog, &mcache_config->pipe_configurations[dc_pipe_index]);
 		}
@@ -361,7 +366,7 @@ void dml21_prepare_mcache_programming(struct dc *in_dc, struct dc_state *context
 			mcache_config->num_pipes = (char)pln_prog->num_dpps_required;
 			l->build_mcache_programming_params.num_configurations++;
 
-			for (dc_pipe_index = 0; dc_pipe_index < num_pipes; dc_pipe_index++) {
+			for (dc_pipe_index = 0; dc_pipe_index < pipe_count; dc_pipe_index++) {
 				ASSERT(dc_phantom_pipes[dc_pipe_index]);
 				dml21_get_pipe_mcache_config(context, dc_phantom_pipes[dc_pipe_index], pln_prog, &mcache_config->pipe_configurations[dc_pipe_index]);
 			}
@@ -383,8 +388,10 @@ void dml21_prepare_mcache_programming(struct dc *in_dc, struct dc_state *context
 		    dc_main_pipes[0]->plane_state == NULL)
 			continue;
 
+		pipe_count = (unsigned int)num_pipes;
+
 		/* get config for each pipe */
-		for (dc_pipe_index = 0; dc_pipe_index < num_pipes; dc_pipe_index++) {
+		for (dc_pipe_index = 0; dc_pipe_index < pipe_count; dc_pipe_index++) {
 			ASSERT(dc_main_pipes[dc_pipe_index]);
 			if (l->build_mcache_programming_params.per_plane_pipe_mcache_regs[dml_prog_idx][dc_pipe_index]) {
 				memcpy(&dc_main_pipes[dc_pipe_index]->mcache_regs,
@@ -398,7 +405,7 @@ void dml21_prepare_mcache_programming(struct dc *in_dc, struct dc_state *context
 				dc_phantom_pipes[0] &&
 				dc_main_pipes[0]->stream &&
 				dc_phantom_pipes[0]->plane_state) {
-			for (dc_pipe_index = 0; dc_pipe_index < num_pipes; dc_pipe_index++) {
+			for (dc_pipe_index = 0; dc_pipe_index < pipe_count; dc_pipe_index++) {
 				ASSERT(dc_phantom_pipes[dc_pipe_index]);
 				if (l->build_mcache_programming_params.per_plane_pipe_mcache_regs[dml_phantom_prog_idx][dc_pipe_index]) {
 					memcpy(&dc_phantom_pipes[dc_pipe_index]->mcache_regs,
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml21_wrapper/dml21_wrapper_fpu.h renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_wrapper_fpu.h +4 -3
similarity index 95%
rename from drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_wrapper_fpu.h
rename to drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml21_wrapper/dml21_wrapper_fpu.h
index e5d9a456645f..570129229ae2 100644
@@ -1,6 +1,7 @@
-// SPDX-License-Identifier: MIT
-//
-// Copyright 2026 Advanced Micro Devices, Inc.
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright 2026 Advanced Micro Devices, Inc.
+ */
 
 #ifndef _DML21_WRAPPER_FPU_H_
 #define _DML21_WRAPPER_FPU_H_
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_dc_resource_mgmt.c renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_dc_resource_mgmt.c +37 -23

165 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_dc_resource_mgmt.h renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_dc_resource_mgmt.h +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_dc_resource_mgmt.h
rename to drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_dc_resource_mgmt.h
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_dc_types.h renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_dc_types.h +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_dc_types.h
rename to drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_dc_types.h
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_internal_types.h renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_internal_types.h +1 -1
similarity index 99%
rename from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_internal_types.h
rename to drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_internal_types.h
index 55b3e3ca54f7..cb301c116615 100644
@@ -33,7 +33,7 @@
 #include "dml2_policy.h"
 
 #include "dml_top.h"
-#include "dml21_wrapper.h"
+#include "dml21_wrapper/dml21_wrapper.h"
 
 struct dml2_wrapper_optimize_configuration_params {
 	struct display_mode_lib_st *dml_core_ctx;
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_mall_phantom.c renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_mall_phantom.c +44 -26

187 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_mall_phantom.h renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_mall_phantom.h +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_mall_phantom.h
rename to drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_mall_phantom.h
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_policy.c renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_policy.c +1 -1
similarity index 99%
rename from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_policy.c
rename to drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_policy.c
index ab2964811c5b..7b043ef3f2ce 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: MIT */
+// SPDX-License-Identifier: MIT
 /*
  * Copyright 2023 Advanced Micro Devices, Inc.
  *
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_policy.h renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_policy.h +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_policy.h
rename to drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_policy.h
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_translation_helper.c renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_translation_helper.c +11 -9
similarity index 99%
rename from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_translation_helper.c
rename to drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_translation_helper.c
index c82886323a51..a0130bbfc12a 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: MIT */
+// SPDX-License-Identifier: MIT
 /*
  * Copyright 2023 Advanced Micro Devices, Inc.
  *
@@ -720,6 +720,7 @@ void dml2_translate_socbb_params(const struct dc *in, struct soc_bounding_box_st
 void dml2_translate_soc_states(const struct dc *dc, struct soc_states_st *out, int num_states)
 {
 	unsigned int i = 0;
+
 	out->num_states = num_states;
 
 	for (i = 0; i < out->num_states; i++) {
@@ -1096,7 +1097,7 @@ static void populate_dml_plane_cfg_from_plane_state(struct dml_plane_cfg_st *out
 
 	/* Current driver code base uses LBBitPerPixel as 57. There is a discrepancy
 	 * from the HW/DML teams about this value. Initialize LBBitPerPixel with the
-	 * value current used in Navi3x .
+	 * value current used in DCN32.
 	 */
 
 	out->LBBitPerPixel[location] = 57;
@@ -1292,12 +1293,12 @@ static void dml2_map_hpo_stream_encoder_to_hpo_link_encoder_index(struct dml2_co
 	for (i = 0; i < MAX_PIPES; i++) {
 		current_pipe_context = &context->res_ctx.pipe_ctx[i];
 		if (current_pipe_context->stream &&
-			current_pipe_context->stream_res.hpo_dp_stream_enc &&
-			current_pipe_context->link_res.hpo_dp_link_enc &&
-			dc_is_dp_signal(current_pipe_context->stream->signal)) {
-				dml2->v20.scratch.hpo_stream_to_link_encoder_mapping[current_pipe_context->stream_res.hpo_dp_stream_enc->inst] =
-					current_pipe_context->link_res.hpo_dp_link_enc->inst;
-			}
+		    current_pipe_context->stream_res.hpo_dp_stream_enc &&
+		    current_pipe_context->link_res.hpo_dp_link_enc &&
+		    dc_is_dp_signal(current_pipe_context->stream->signal)) {
+			dml2->v20.scratch.hpo_stream_to_link_encoder_mapping[current_pipe_context->stream_res.hpo_dp_stream_enc->inst] =
+				current_pipe_context->link_res.hpo_dp_link_enc->inst;
+		}
 	}
 }
 
@@ -1330,7 +1331,8 @@ void map_dc_state_into_dml_display_cfg(struct dml2_context *dml2, struct dc_stat
 		current_pipe_context = NULL;
 		for (k = 0; k < MAX_PIPES; k++) {
 			/* find one pipe allocated to this stream for the purpose of getting
-			info about the link later */
+			 * info about the link later
+			 */
 			if (context->streams[i] == context->res_ctx.pipe_ctx[k].stream) {
 				current_pipe_context = &context->res_ctx.pipe_ctx[k];
 				break;
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_translation_helper.h renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_translation_helper.h +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_translation_helper.h
rename to drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_translation_helper.h
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_utils.c renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_utils.c +16 -12
similarity index 98%
rename from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_utils.c
rename to drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_utils.c
index a3ce011612f7..8688792aa956 100644
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: MIT */
+// SPDX-License-Identifier: MIT
 /*
  * Copyright 2023 Advanced Micro Devices, Inc.
  *
@@ -168,7 +168,7 @@ bool is_dp2p0_output_encoder(const struct pipe_ctx *pipe_ctx)
 
 bool is_dtbclk_required(const struct dc *dc, struct dc_state *context)
 {
-	int i;
+	unsigned int i;
 
 	for (i = 0; i < dc->res_pool->pipe_count; i++) {
 		if (!context->res_ctx.pipe_ctx[i].stream)
@@ -196,6 +196,7 @@ void dml2_copy_clocks_to_dc_state(struct dml2_dcn_clocks *out_clks, struct dc_st
 int dml2_helper_find_dml_pipe_idx_by_stream_id(struct dml2_context *ctx, unsigned int stream_id)
 {
 	int i;
+
 	for (i = 0; i < __DML2_WRAPPER_MAX_STREAMS_PLANES__; i++) {
 		if (ctx->v20.scratch.dml_to_dc_pipe_mapping.dml_pipe_idx_to_stream_id_valid[i] && ctx->v20.scratch.dml_to_dc_pipe_mapping.dml_pipe_idx_to_stream_id[i] == stream_id)
 			return  i;
@@ -207,6 +208,7 @@ int dml2_helper_find_dml_pipe_idx_by_stream_id(struct dml2_context *ctx, unsigne
 static int find_dml_pipe_idx_by_plane_id(struct dml2_context *ctx, unsigned int plane_id)
 {
 	int i;
+
 	for (i = 0; i < __DML2_WRAPPER_MAX_STREAMS_PLANES__; i++) {
 		if (ctx->v20.scratch.dml_to_dc_pipe_mapping.dml_pipe_idx_to_plane_id_valid[i] && ctx->v20.scratch.dml_to_dc_pipe_mapping.dml_pipe_idx_to_plane_id[i] == plane_id)
 			return  i;
@@ -218,7 +220,8 @@ static int find_dml_pipe_idx_by_plane_id(struct dml2_context *ctx, unsigned int
 static bool get_plane_id(struct dml2_context *dml2, const struct dc_state *state, const struct dc_plane_state *plane,
 	unsigned int stream_id, unsigned int plane_index, unsigned int *plane_id)
 {
-	unsigned int i, j;
+	unsigned int i;
+	int j;
 	bool is_plane_duplicate = dml2->v20.scratch.plane_duplicate_exists;
 
 	if (!plane_id)
@@ -228,8 +231,8 @@ static bool get_plane_id(struct dml2_context *dml2, const struct dc_state *state
 		if (state->streams[i]->stream_id == stream_id) {
 			for (j = 0; j < state->stream_status[i].plane_count; j++) {
 				if (state->stream_status[i].plane_states[j] == plane &&
-					(!is_plane_duplicate || (j == plane_index))) {
-					*plane_id = (i << 16) | j;
+					(!is_plane_duplicate || ((unsigned int)j == plane_index))) {
+					*plane_id = ((unsigned int)i << 16) | (unsigned int)j;
 					return true;
 				}
 			}
@@ -293,8 +296,8 @@ void dml2_calculate_rq_and_dlg_params(const struct dc *dc, struct dc_state *cont
 	else
 		context->bw_ctx.bw.dcn.clk.fclk_p_state_change_support = true;
 
-	if (context->bw_ctx.bw.dcn.clk.dispclk_khz < dc->debug.min_disp_clk_khz)
-		context->bw_ctx.bw.dcn.clk.dispclk_khz = dc->debug.min_disp_clk_khz;
+	if (context->bw_ctx.bw.dcn.clk.dispclk_khz < (int)dc->debug.min_disp_clk_khz)
+		context->bw_ctx.bw.dcn.clk.dispclk_khz = (int)dc->debug.min_disp_clk_khz;
 
 	context->bw_ctx.bw.dcn.compbuf_size_kb = in_ctx->v20.dml_core_ctx.ip.config_return_buffer_size_in_kbytes;
 
@@ -304,7 +307,8 @@ void dml2_calculate_rq_and_dlg_params(const struct dc *dc, struct dc_state *cont
 		/* The DML2 and the DC logic of determining pipe indices are different from each other so
 		 * there is a need to know which DML pipe index maps to which DC pipe. The code below
 		 * finds a dml_pipe_index from the plane id if a plane is valid. If a plane is not valid then
-		 * it finds a dml_pipe_index from the stream id. */
+		 * it finds a dml_pipe_index from the stream id.
+		 */
 		if (get_plane_id(in_ctx, context, context->res_ctx.pipe_ctx[dc_pipe_ctx_index].plane_state,
 			context->res_ctx.pipe_ctx[dc_pipe_ctx_index].stream->stream_id,
 			in_ctx->v20.scratch.dml_to_dc_pipe_mapping.dml_pipe_idx_to_plane_index[context->res_ctx.pipe_ctx[dc_pipe_ctx_index].pipe_idx], &plane_id)) {
@@ -371,7 +375,7 @@ void dml2_calculate_rq_and_dlg_params(const struct dc *dc, struct dc_state *cont
 
 	if (dc->config.forced_clocks || dc->debug.max_disp_clk) {
 		context->bw_ctx.bw.dcn.clk.bw_dispclk_khz = context->bw_ctx.bw.dcn.clk.max_supported_dispclk_khz;
-		context->bw_ctx.bw.dcn.clk.bw_dppclk_khz = context->bw_ctx.bw.dcn.clk.max_supported_dppclk_khz ;
+		context->bw_ctx.bw.dcn.clk.bw_dppclk_khz = context->bw_ctx.bw.dcn.clk.max_supported_dppclk_khz;
 	}
 }
 
@@ -449,7 +453,7 @@ void dml2_extract_writeback_wm(struct dc_state *context, struct display_mode_lib
 		bw_writeback->mcif_wb_arb[i].arbitration_slice = 2;
 		bw_writeback->mcif_wb_arb[i].max_scaled_time =
 			dml2_calc_max_scaled_time(wb_arb_params->time_per_pixel,
-					wbif_mode, 	wb_arb_params->cli_watermark[0]);
+					wbif_mode, wb_arb_params->cli_watermark[0]);
 		/*not required any more*/
 		bw_writeback->mcif_wb_arb[i].dram_speed_change_duration =
 			(unsigned int)(dml_get_wm_writeback_dram_clock_change(dml_core_ctx) * 1000);
@@ -500,8 +504,8 @@ void dml2_apply_det_buffer_allocation_policy(struct dml2_context *in_ctx, struct
 			dml_dispcfg->plane.DETSizeOverride[plane_index] = ((max_det_size / num_of_streams) / num_of_planes_per_stream[stream_index] / in_ctx->det_helper_scratch.dpps_per_surface[plane_index]);
 
 			/* If the override size is not divisible by det_segment_size then round off to nearest number divisible by det_segment_size as
-				* this is a requirement.
-				*/
+			 * this is a requirement.
+			 */
 			if (dml_dispcfg->plane.DETSizeOverride[plane_index] % in_ctx->config.det_segment_size != 0) {
 				dml_dispcfg->plane.DETSizeOverride[plane_index] = dml_dispcfg->plane.DETSizeOverride[plane_index] & ~0x3F;
 			}
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_utils.h renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_utils.h +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_utils.h
rename to drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_utils.h
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_wrapper.c renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper.c +3 -3
similarity index 97%
rename from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper.c
rename to drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_wrapper.c
index 1772e74349c7..2fe3c4643f58 100644
@@ -8,8 +8,8 @@
 #include "dml2_internal_types.h"
 #include "dml2_wrapper.h"
 #include "dml2_wrapper_fpu.h"
-#include "dml21_wrapper.h"
-#include "dml21_wrapper_fpu.h"
+#include "dml21_wrapper/dml21_wrapper.h"
+#include "dml21_wrapper/dml21_wrapper_fpu.h"
 
 #include "dc_fpu.h"
 
@@ -24,6 +24,7 @@ struct dml2_context *dml2_allocate_memory(void)
 	DC_RUN_WITH_PREEMPTION_ENABLED(dml2 = vzalloc(sizeof(struct dml2_context)));
 	return dml2;
 }
+
 bool dml2_validate(const struct dc *in_dc, struct dc_state *context, struct dml2_context *dml2,
 	enum dc_validate_mode validate_mode)
 {
@@ -87,7 +88,6 @@ static void dml2_init(const struct dc *in_dc, const struct dml2_configuration_op
 	initialize_dml2_soc_bbox(*dml2, in_dc, &(*dml2)->v20.dml_core_ctx.soc);
 
 	initialize_dml2_soc_states(*dml2, in_dc, &(*dml2)->v20.dml_core_ctx.soc, &(*dml2)->v20.dml_core_ctx.states);
-
 }
 
 bool dml2_create(const struct dc *in_dc, const struct dml2_configuration_options *config, struct dml2_context **dml2)
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_wrapper.h renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper.h +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper.h
rename to drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_wrapper.h
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_wrapper_fpu.c renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper_fpu.c +25 -20

129 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_wrapper_fpu.h renamed from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper_fpu.h +0 -0
similarity index 100%
rename from drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper_fpu.h
rename to drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_wrapper_fpu.h
drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c +1 -1
index 7c2a79015f4e..c9eba16ef359 100644
@@ -97,7 +97,7 @@
 #include "dc_state_priv.h"
 #include "dc_fpu.h"
 
-#include "dml2_0/dml2_wrapper.h"
+#include "dml2_wrapper/dml2_wrapper.h"
 
 #if !defined(DC_RUN_WITH_PREEMPTION_ENABLED)
 #define DC_RUN_WITH_PREEMPTION_ENABLED(code) code
drivers/gpu/drm/amd/display/dc/resource/dcn35/dcn35_resource.c +1 -1
index 52826e96c184..6f095500afd3 100644
@@ -34,7 +34,7 @@
 #include "include/irq_service_interface.h"
 #include "basics/conversion.h"
 #include "dcn35_resource.h"
-#include "dml2_0/dml2_wrapper.h"
+#include "dml2_wrapper/dml2_wrapper.h"
 
 #include "dcn20/dcn20_resource.h"
 #include "dcn30/dcn30_resource.h"
drivers/gpu/drm/amd/display/dc/resource/dcn351/dcn351_resource.c +1 -1
index e3fc71307c91..c40d4800194f 100644
@@ -87,7 +87,7 @@
 #include "vm_helper.h"
 #include "dcn20/dcn20_vmid.h"
 
-#include "dml2_0/dml2_wrapper.h"
+#include "dml2_wrapper/dml2_wrapper.h"
 
 #include "link_enc_cfg.h"
 #define DC_LOGGER_INIT(logger)
drivers/gpu/drm/amd/display/dc/resource/dcn36/dcn36_resource.c +1 -1
index c019a657005d..593eb1d2dffe 100644
@@ -12,7 +12,7 @@
 #include "include/irq_service_interface.h"
 #include "basics/conversion.h"
 #include "dcn36_resource.h"
-#include "dml2_0/dml2_wrapper.h"
+#include "dml2_wrapper/dml2_wrapper.h"
 
 #include "dcn20/dcn20_resource.h"
 #include "dcn30/dcn30_resource.h"
drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c +1 -1
index aced8ff657bf..34e218bff078 100644
@@ -78,7 +78,7 @@
 
 #include "dc_state_priv.h"
 
-#include "dml2_0/dml2_wrapper.h"
+#include "dml2_wrapper/dml2_wrapper.h"
 
 #define DC_LOGGER_INIT(logger)
 
drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c +1 -1
index 3c7cd3ecc687..bcfde21b6d79 100644
@@ -87,7 +87,7 @@
 #include "dc_state_priv.h"
 #include "link_enc_cfg.h"
 
-#include "dml2_0/dml2_wrapper.h"
+#include "dml2_wrapper/dml2_wrapper.h"
 
 #define regBIF_BX0_BIOS_SCRATCH_3                            0x003b
 #define regBIF_BX0_BIOS_SCRATCH_3_BASE_IDX                   1
drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c +1 -1
index 8b1ee45d9c13..b7bc24136f79 100644
@@ -88,7 +88,7 @@
 #include "dc_state_priv.h"
 #include "link_enc_cfg.h"
 
-#include "dml2_0/dml2_wrapper.h"
+#include "dml2_wrapper/dml2_wrapper.h"
 
 #define DC_LOGGER_INIT(logger)
 
drivers/gpu/drm/amd/display/dc/resource/dcn60/dcn60_resource.c +2 -2
index d7947105af22..8228fb62a350 100644
@@ -81,8 +81,8 @@
 
 #include "dc_state_priv.h"
 
-#include "dml2_0/dml2_wrapper.h"
-#include "dml2_0/dml21/dml21_wrapper.h"
+#include "dml2_wrapper/dml2_wrapper.h"
+#include "dml2_wrapper/dml21_wrapper/dml21_wrapper.h"
 
 #define DC_LOGGER_INIT(logger)
 
Signature · 1 line
2.43.0
author
#29 lore raw

PATCH 29/59 drm/amd/display: Test vblank counter and scanout position

In reply to Alex Hung

[WHAT]
Add KUnit tests for dm_vblank_get_counter() and dm_crtc_get_scanoutpos() covering a CRTC whose stream is not owned by any pipe in the resource context, and the branch that disables idle optimizations before reading the scanout position.

[HOW]
Wire a DC context, a current DC state and a logger to the device so both callbacks walk the resource context instead of returning early.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 95 +++++++++++++++++++
 1 file changed, 95 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +95 -0
index a0f90b0bd74a..33cca3f01b5b 100644
@@ -8,13 +8,23 @@
 #include <kunit/test.h>
 #include <linux/pci.h>
 #include <drm/drm_atomic.h>
+#include <drm/drm_blend.h>
 #include <drm/drm_connector.h>
 #include <drm/drm_crtc.h>
+#include <drm/drm_framebuffer.h>
+#include <drm/drm_kunit_helpers.h>
 #include <drm/drm_modes.h>
+#include <drm/drm_modeset_lock.h>
+#include <drm/drm_plane.h>
+#include <drm/drm_property.h>
+#include <drm/drm_vblank.h>
 #include <drm/drm_writeback.h>
 
 #include "dc.h"
+#include "dm_services_types.h"
+#include "dmub/dmub_srv.h"
 #include "inc/core_types.h"
+#include "logger_types.h"
 #include "amd_shared.h"
 #include "amdgpu.h"
 #include "amdgpu_mode.h"
@@ -1141,6 +1151,87 @@ static void dm_test_apply_delay_nonzero_wait(struct kunit *test)
 	amdgpu_dm_apply_delay_after_dpcd_poweroff(adev, sink);
 }
 
+/*
+ * Attach a DC stream to CRTC 0 of @adev so the scanout helpers walk the DC
+ * resource context instead of bailing out early.
+ */
+static void dm_test_crtc_with_stream(struct kunit *test,
+				     struct amdgpu_device *adev, struct dc *dc)
+{
+	struct dc_stream_state *stream;
+	struct amdgpu_crtc *acrtc;
+	struct dal_logger *logger;
+
+	acrtc = kunit_kzalloc(test, sizeof(*acrtc), GFP_KERNEL);
+	KUNIT_ASSERT_NOT_NULL(test, acrtc);
+
+	logger = kunit_kzalloc(test, sizeof(*logger), GFP_KERNEL);
+	KUNIT_ASSERT_NOT_NULL(test, logger);
+	logger->dev = &adev->ddev;
+	dc->ctx->logger = logger;
+
+	dc->current_state = dm_kunit_alloc_dc_state(test);
+	KUNIT_ASSERT_NOT_NULL(test, dc->current_state);
+
+	stream = dm_kunit_alloc_stream(test, NULL);
+	stream->ctx = dc->ctx;
+
+	adev->dm.dc = dc;
+	adev->mode_info.num_crtc = 1;
+	adev->mode_info.crtcs[0] = acrtc;
+	acrtc->dm_irq_params.stream = stream;
+}
+
+/**
+ * dm_test_vblank_get_counter_unmapped_stream - Test a stream without a pipe returns zero
+ * @test: The KUnit test context
+ */
+static void dm_test_vblank_get_counter_unmapped_stream(struct kunit *test)
+{
+	struct amdgpu_device *adev = dm_kunit_alloc_adev(test);
+	struct dc *dc = dm_kunit_alloc_dc_with_ctx(test);
+
+	dm_test_crtc_with_stream(test, adev, dc);
+
+	KUNIT_EXPECT_EQ(test, dm_vblank_get_counter(adev, 0), 0U);
+}
+
+/**
+ * dm_test_crtc_get_scanoutpos_unmapped_stream - Test scanout position for an unmapped stream
+ * @test: The KUnit test context
+ */
+static void dm_test_crtc_get_scanoutpos_unmapped_stream(struct kunit *test)
+{
+	struct amdgpu_device *adev = dm_kunit_alloc_adev(test);
+	struct dc *dc = dm_kunit_alloc_dc_with_ctx(test);
+	u32 vbl = 0xdeadbeef;
+	u32 position = 0xdeadbeef;
+
+	dm_test_crtc_with_stream(test, adev, dc);
+
+	KUNIT_EXPECT_EQ(test, dm_crtc_get_scanoutpos(adev, 0, &vbl, &position), 0);
+	KUNIT_EXPECT_EQ(test, vbl, 0U);
+	KUNIT_EXPECT_EQ(test, position, 0U);
+}
+
+/**
+ * dm_test_crtc_get_scanoutpos_exits_idle - Test idle optimizations are disabled first
+ * @test: The KUnit test context
+ */
+static void dm_test_crtc_get_scanoutpos_exits_idle(struct kunit *test)
+{
+	struct amdgpu_device *adev = dm_kunit_alloc_adev(test);
+	struct dc *dc = dm_kunit_alloc_dc_with_ctx(test);
+	u32 vbl = 0;
+	u32 position = 0;
+
+	dm_test_crtc_with_stream(test, adev, dc);
+	dc->caps.ips_support = true;
+	dc->idle_optimizations_allowed = true;
+
+	KUNIT_EXPECT_EQ(test, dm_crtc_get_scanoutpos(adev, 0, &vbl, &position), 0);
+}
+
 static struct kunit_case amdgpu_dm_tests[] = {
 	/* Simple DM callbacks */
 	KUNIT_CASE(dm_test_wait_for_idle),
@@ -1207,6 +1298,10 @@ static struct kunit_case amdgpu_dm_tests[] = {
 	KUNIT_CASE(dm_test_apply_delay_null_sink),
 	KUNIT_CASE(dm_test_apply_delay_zero_wait),
 	KUNIT_CASE(dm_test_apply_delay_nonzero_wait),
+	/* dm_vblank_get_counter / dm_crtc_get_scanoutpos with a stream */
+	KUNIT_CASE(dm_test_vblank_get_counter_unmapped_stream),
+	KUNIT_CASE(dm_test_crtc_get_scanoutpos_unmapped_stream),
+	KUNIT_CASE(dm_test_crtc_get_scanoutpos_exits_idle),
 	{}
 };
 
Signature · 1 line
2.43.0
author
#30 lore raw

PATCH 30/59 drm/amd/display: Test DM atomic private state helpers

In reply to Alex Hung

[WHAT]
Add KUnit tests for dm_atomic_get_state() covering the return taken when the caller already holds the DM state, and for dm_atomic_duplicate_state() covering the failure path when the old private state has no DC context.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  4 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |  1 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 53 +++++++++++++++++++
 3 files changed, 57 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -1
index eb00c62c6f72..5c4aac207e8f 100644
@@ -2136,6 +2136,7 @@ int dm_atomic_get_state(struct drm_atomic_commit *state,
 
 	return 0;
 }
+EXPORT_IF_KUNIT(dm_atomic_get_state);
 
 STATIC_IFN_KUNIT struct dm_atomic_state *
 dm_atomic_get_new_state(struct drm_atomic_commit *state)
@@ -2156,7 +2157,7 @@ dm_atomic_get_new_state(struct drm_atomic_commit *state)
 }
 EXPORT_IF_KUNIT(dm_atomic_get_new_state);
 
-static struct drm_private_state *
+STATIC_IFN_KUNIT struct drm_private_state *
 dm_atomic_duplicate_state(struct drm_private_obj *obj)
 {
 	struct dm_atomic_state *old_state, *new_state;
@@ -2179,6 +2180,7 @@ dm_atomic_duplicate_state(struct drm_private_obj *obj)
 
 	return &new_state->base;
 }
+EXPORT_IF_KUNIT(dm_atomic_duplicate_state);
 
 STATIC_IFN_KUNIT void dm_atomic_destroy_state(struct drm_private_obj *obj,
 					      struct drm_private_state *state)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +1 -0
index a25942b5565f..6e078be5bc5e 100644
@@ -1168,6 +1168,7 @@ u32 dm_vblank_get_counter(struct amdgpu_device *adev, int crtc);
 int dm_crtc_get_scanoutpos(struct amdgpu_device *adev, int crtc,
 			   u32 *vbl, u32 *position);
 struct dm_atomic_state *dm_atomic_get_new_state(struct drm_atomic_commit *state);
+struct drm_private_state *dm_atomic_duplicate_state(struct drm_private_obj *obj);
 void dm_atomic_destroy_state(struct drm_private_obj *obj,
 			     struct drm_private_state *state);
 int dm_plane_layer_index_cmp(const void *a, const void *b);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +53 -0

65 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#31 lore raw

PATCH 31/59 drm/amd/display: Test affected MST DSC CRTC selection

In reply to Alex Hung

[WHAT]
Add KUnit tests for add_affected_mst_dsc_crtcs() covering an empty commit, a writeback connector, a connector that is not behind an MST branch, a connector bound to a different CRTC, and a disabled connector whose old state decides which CRTC is affected.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |   4 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   2 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 142 ++++++++++++++++++
 3 files changed, 147 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -1
index 5c4aac207e8f..9d233b18f2df 100644
@@ -6007,7 +6007,8 @@ struct __drm_planes_state *amdgpu_dm_get_next_zpos(
 	return &state->planes[highest_i];
 }
 
-static int add_affected_mst_dsc_crtcs(struct drm_atomic_commit *state, struct drm_crtc *crtc)
+STATIC_IFN_KUNIT int add_affected_mst_dsc_crtcs(struct drm_atomic_commit *state,
+						struct drm_crtc *crtc)
 {
 	struct drm_connector *connector;
 	struct drm_connector_state *conn_state, *old_conn_state;
@@ -6036,6 +6037,7 @@ static int add_affected_mst_dsc_crtcs(struct drm_atomic_commit *state, struct dr
 
 	return drm_dp_mst_add_affected_dsc_crtcs(state, &aconnector->mst_root->mst_mgr);
 }
+EXPORT_IF_KUNIT(add_affected_mst_dsc_crtcs);
 
 static bool amdgpu_dm_crtc_mem_type_changed(struct drm_device *dev,
 					    struct drm_atomic_commit *state,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +2 -0
index 6e078be5bc5e..a48154ea62ae 100644
@@ -1171,6 +1171,8 @@ struct dm_atomic_state *dm_atomic_get_new_state(struct drm_atomic_commit *state)
 struct drm_private_state *dm_atomic_duplicate_state(struct drm_private_obj *obj);
 void dm_atomic_destroy_state(struct drm_private_obj *obj,
 			     struct drm_private_state *state);
+int add_affected_mst_dsc_crtcs(struct drm_atomic_commit *state,
+			       struct drm_crtc *crtc);
 int dm_plane_layer_index_cmp(const void *a, const void *b);
 int fill_plane_color_attributes(const struct drm_plane_state *plane_state,
 				const enum surface_pixel_format format,
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +142 -0

154 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#32 lore raw

PATCH 32/59 drm/amd/display: Test cursor commit

In reply to Alex Hung

[WHAT]
Add KUnit tests for amdgpu_dm_commit_cursors() covering an empty commit, a non-cursor plane, and a cursor update, and for amdgpu_dm_update_cursor() covering missing framebuffers and removal of an active stream cursor.

[HOW]
Reuse the single-plane commit fixture. The disable path uses the real state-only DC cursor position setter without hardware programming.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  10 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   5 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 140 ++++++++++++++++++
 3 files changed, 151 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +6 -4
index 9d233b18f2df..08f2cc7fec68 100644
@@ -3587,7 +3587,7 @@ static void remove_stream(struct amdgpu_device *adev,
 	acrtc->enabled = false;
 }
 
-static void amdgpu_dm_commit_cursors(struct drm_atomic_commit *state)
+STATIC_IFN_KUNIT void amdgpu_dm_commit_cursors(struct drm_atomic_commit *state)
 {
 	struct drm_plane *plane;
 	struct drm_plane_state *old_plane_state;
@@ -3601,6 +3601,7 @@ static void amdgpu_dm_commit_cursors(struct drm_atomic_commit *state)
 		if (plane->type == DRM_PLANE_TYPE_CURSOR)
 			amdgpu_dm_plane_handle_cursor_update(plane, old_plane_state);
 }
+EXPORT_IF_KUNIT(amdgpu_dm_commit_cursors);
 
 static inline uint32_t get_mem_type(struct drm_framebuffer *fb)
 {
@@ -3609,9 +3610,9 @@ static inline uint32_t get_mem_type(struct drm_framebuffer *fb)
 	return abo->tbo.resource ? abo->tbo.resource->mem_type : 0;
 }
 
-static void amdgpu_dm_update_cursor(struct drm_plane *plane,
-				    struct drm_plane_state *old_plane_state,
-				    struct dc_stream_update *update)
+STATIC_IFN_KUNIT void amdgpu_dm_update_cursor(struct drm_plane *plane,
+					      struct drm_plane_state *old_plane_state,
+					      struct dc_stream_update *update)
 {
 	struct amdgpu_device *adev = drm_to_adev(plane->dev);
 	struct amdgpu_framebuffer *afb = to_amdgpu_framebuffer(plane->state->fb);
@@ -3680,6 +3681,7 @@ static void amdgpu_dm_update_cursor(struct drm_plane *plane,
 		update->cursor_position = &crtc_state->stream->cursor_position;
 	}
 }
+EXPORT_IF_KUNIT(amdgpu_dm_update_cursor);
 
 static void amdgpu_dm_enable_self_refresh(struct amdgpu_display_manager *dm,
 					  struct amdgpu_crtc *acrtc_attach,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +5 -0
index a48154ea62ae..ed2341b387d9 100644
@@ -86,6 +86,7 @@ struct dc;
 struct amdgpu_bo;
 struct dmub_srv;
 struct dc_plane_state;
+struct dc_stream_update;
 struct dmub_notification;
 struct dmub_cmd_fused_request;
 
@@ -1171,6 +1172,10 @@ struct dm_atomic_state *dm_atomic_get_new_state(struct drm_atomic_commit *state)
 struct drm_private_state *dm_atomic_duplicate_state(struct drm_private_obj *obj);
 void dm_atomic_destroy_state(struct drm_private_obj *obj,
 			     struct drm_private_state *state);
+void amdgpu_dm_commit_cursors(struct drm_atomic_commit *state);
+void amdgpu_dm_update_cursor(struct drm_plane *plane,
+			     struct drm_plane_state *old_plane_state,
+			     struct dc_stream_update *update);
 int add_affected_mst_dsc_crtcs(struct drm_atomic_commit *state,
 			       struct drm_crtc *crtc);
 int dm_plane_layer_index_cmp(const void *a, const void *b);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +140 -0

152 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#33 lore raw

PATCH 33/59 drm/amd/display: Test vblank event arming

In reply to Alex Hung

[WHAT]
Add KUnit tests for dm_arm_vblank_event() and dm_arm_vblank_event_pre_programming() covering missing events, inactive CRTCs, page-flip and cursor updates, and vblank reference acquisition.

[HOW]
Use one pending-event fixture. Initialize DRM vblank state only for the pre-programming tests and release every acquired reference.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  18 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   6 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 185 ++++++++++++++++++
 3 files changed, 201 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +10 -8
index 08f2cc7fec68..1eb2f0973aac 100644
@@ -3723,10 +3723,10 @@ static void amdgpu_dm_enable_self_refresh(struct amdgpu_display_manager *dm,
 	}
 }
 
-static void dm_arm_vblank_event(struct amdgpu_crtc *acrtc,
-				struct dm_crtc_state *acrtc_state,
-				bool pflip_update,
-				bool cursor_update)
+STATIC_IFN_KUNIT void dm_arm_vblank_event(struct amdgpu_crtc *acrtc,
+					  struct dm_crtc_state *acrtc_state,
+					  bool pflip_update,
+					  bool cursor_update)
 {
 	assert_spin_locked(&acrtc->base.dev->event_lock);
 
@@ -3749,6 +3749,7 @@ static void dm_arm_vblank_event(struct amdgpu_crtc *acrtc,
 		acrtc->base.state->event = NULL;
 	}
 }
+EXPORT_IF_KUNIT(dm_arm_vblank_event);
 
 /**
  * dm_arm_vblank_event_pre_programming - Prepare for programming
@@ -3761,10 +3762,10 @@ static void dm_arm_vblank_event(struct amdgpu_crtc *acrtc,
  * be programmed. Do this before programming so the HW is not in any
  * idle-optimized state (such as PSR).
  */
-static void dm_arm_vblank_event_pre_programming(struct amdgpu_crtc *acrtc,
-						struct dm_crtc_state *acrtc_state,
-						bool pflip_update,
-						bool cursor_update)
+STATIC_IFN_KUNIT void dm_arm_vblank_event_pre_programming(struct amdgpu_crtc *acrtc,
+							  struct dm_crtc_state *acrtc_state,
+							  bool pflip_update,
+							  bool cursor_update)
 {
 	assert_spin_locked(&acrtc->base.dev->event_lock);
 
@@ -3774,6 +3775,7 @@ static void dm_arm_vblank_event_pre_programming(struct amdgpu_crtc *acrtc,
 	if (pflip_update || cursor_update)
 		drm_crtc_vblank_get(&acrtc->base);
 }
+EXPORT_IF_KUNIT(dm_arm_vblank_event_pre_programming);
 
 static void amdgpu_dm_commit_planes(struct drm_atomic_commit *state,
 				    struct drm_device *dev,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +6 -0
index ed2341b387d9..e4b67a0b98c3 100644
@@ -1176,6 +1176,12 @@ void amdgpu_dm_commit_cursors(struct drm_atomic_commit *state);
 void amdgpu_dm_update_cursor(struct drm_plane *plane,
 			     struct drm_plane_state *old_plane_state,
 			     struct dc_stream_update *update);
+void dm_arm_vblank_event(struct amdgpu_crtc *acrtc,
+			 struct dm_crtc_state *acrtc_state,
+			 bool pflip_update, bool cursor_update);
+void dm_arm_vblank_event_pre_programming(struct amdgpu_crtc *acrtc,
+					 struct dm_crtc_state *acrtc_state,
+					 bool pflip_update, bool cursor_update);
 int add_affected_mst_dsc_crtcs(struct drm_atomic_commit *state,
 			       struct drm_crtc *crtc);
 int dm_plane_layer_index_cmp(const void *a, const void *b);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +185 -0

197 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#34 lore raw

PATCH 34/59 drm/amd/display: Test page flip interrupt state update

In reply to Alex Hung

[WHAT]
Add KUnit tests for dm_update_pflip_irq_state() covering DCN, where there is nothing to reapply, and DCE, where the current interrupt state is reapplied to the pageflip source.

[HOW]
Add a spy for the pageflip IRQ source. amdgpu_irq_update() always dispatches through src->funcs->set(), which needs a registered IH ring on real hardware, so the spy records the requested type and state instead.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  5 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |  2 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 78 +++++++++++++++++++
 3 files changed, 83 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -2
index 1eb2f0973aac..4650b5f09c08 100644
@@ -3419,8 +3419,8 @@ static void manage_dm_interrupts(struct amdgpu_device *adev,
 	}
 }
 
-static void dm_update_pflip_irq_state(struct amdgpu_device *adev,
-				      struct amdgpu_crtc *acrtc)
+STATIC_IFN_KUNIT void dm_update_pflip_irq_state(struct amdgpu_device *adev,
+						struct amdgpu_crtc *acrtc)
 {
 	int irq_type =
 		amdgpu_display_crtc_idx_to_irq_type(adev, acrtc->crtc_id);
@@ -3435,6 +3435,7 @@ static void dm_update_pflip_irq_state(struct amdgpu_device *adev,
 	 */
 	amdgpu_irq_update(adev, &adev->pageflip_irq, irq_type);
 }
+EXPORT_IF_KUNIT(dm_update_pflip_irq_state);
 
 STATIC_IFN_KUNIT bool
 is_scaling_state_different(const struct dm_connector_state *dm_state,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +2 -0
index e4b67a0b98c3..c22266f534e3 100644
@@ -1172,6 +1172,8 @@ struct dm_atomic_state *dm_atomic_get_new_state(struct drm_atomic_commit *state)
 struct drm_private_state *dm_atomic_duplicate_state(struct drm_private_obj *obj);
 void dm_atomic_destroy_state(struct drm_private_obj *obj,
 			     struct drm_private_state *state);
+void dm_update_pflip_irq_state(struct amdgpu_device *adev,
+			       struct amdgpu_crtc *acrtc);
 void amdgpu_dm_commit_cursors(struct drm_atomic_commit *state);
 void amdgpu_dm_update_cursor(struct drm_plane *plane,
 			     struct drm_plane_state *old_plane_state,
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +78 -0

90 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#35 lore raw

PATCH 35/59 drm/amd/display: Test CRTC memory domain change detection

In reply to Alex Hung

[WHAT]
Add KUnit tests for amdgpu_dm_crtc_mem_type_changed() covering an empty plane mask, a plane missing one of its states, framebuffers in the same memory domain, and a framebuffer migrated between domains.

[HOW]
Back the framebuffers with fake buffer objects carrying a TTM resource, so get_mem_type() resolves a memory domain without a live TTM device.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |   7 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   3 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 138 ++++++++++++++++++
 3 files changed, 145 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -3
index 4650b5f09c08..70f50fa17366 100644
@@ -6044,9 +6044,9 @@ STATIC_IFN_KUNIT int add_affected_mst_dsc_crtcs(struct drm_atomic_commit *state,
 }
 EXPORT_IF_KUNIT(add_affected_mst_dsc_crtcs);
 
-static bool amdgpu_dm_crtc_mem_type_changed(struct drm_device *dev,
-					    struct drm_atomic_commit *state,
-					    struct drm_crtc_state *crtc_state)
+STATIC_IFN_KUNIT bool amdgpu_dm_crtc_mem_type_changed(struct drm_device *dev,
+						      struct drm_atomic_commit *state,
+						      struct drm_crtc_state *crtc_state)
 {
 	struct drm_plane *plane;
 	struct drm_plane_state *new_plane_state, *old_plane_state;
@@ -6065,6 +6065,7 @@ static bool amdgpu_dm_crtc_mem_type_changed(struct drm_device *dev,
 
 	return false;
 }
+EXPORT_IF_KUNIT(amdgpu_dm_crtc_mem_type_changed);
 
 /**
  * amdgpu_dm_atomic_check() - Atomic check implementation for AMDgpu DM.
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +3 -0
index c22266f534e3..ca19977cf788 100644
@@ -1186,6 +1186,9 @@ void dm_arm_vblank_event_pre_programming(struct amdgpu_crtc *acrtc,
 					 bool pflip_update, bool cursor_update);
 int add_affected_mst_dsc_crtcs(struct drm_atomic_commit *state,
 			       struct drm_crtc *crtc);
+bool amdgpu_dm_crtc_mem_type_changed(struct drm_device *dev,
+				     struct drm_atomic_commit *state,
+				     struct drm_crtc_state *crtc_state);
 int dm_plane_layer_index_cmp(const void *a, const void *b);
 int fill_plane_color_attributes(const struct drm_plane_state *plane_state,
 				const enum surface_pixel_format format,
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +138 -0

150 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#36 lore raw

PATCH 36/59 drm/amd/display: Test PSR dirty rectangle filling

In reply to Alex Hung

[WHAT]
Add KUnit tests for fill_dc_dirty_rects() covering the cursor plane bypass, the full frame update fallbacks taken on rotation, on a damage-unaware client, on ignored damage clips, on exceeding DC_MAX_DIRTY_RECTS and on PSR SU in auto damage mode, the verbatim copy of damage clips, and the MPO paths for a moved plane, a flipped plane, stable clips and clips that overflow together with the bounding boxes.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  15 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   8 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 349 ++++++++++++++++++
 3 files changed, 365 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +8 -7
index 70f50fa17366..17425791e0ee 100644
@@ -3147,13 +3147,13 @@ static inline void fill_dc_dirty_rect(struct drm_plane *plane,
  * implicitly provide damage clips without any client support via the plane
  * bounds.
  */
-static void fill_dc_dirty_rects(struct drm_plane *plane,
-				struct drm_plane_state *old_plane_state,
-				struct drm_plane_state *new_plane_state,
-				struct drm_crtc_state *crtc_state,
-				struct dc_flip_addrs *flip_addrs,
-				bool is_psr_su,
-				bool *dirty_regions_changed)
+STATIC_IFN_KUNIT void fill_dc_dirty_rects(struct drm_plane *plane,
+					  struct drm_plane_state *old_plane_state,
+					  struct drm_plane_state *new_plane_state,
+					  struct drm_crtc_state *crtc_state,
+					  struct dc_flip_addrs *flip_addrs,
+					  bool is_psr_su,
+					  bool *dirty_regions_changed)
 {
 	struct dm_crtc_state *dm_crtc_state = to_dm_crtc_state(crtc_state);
 	struct rect *dirty_rects = flip_addrs->dirty_rects;
@@ -3259,6 +3259,7 @@ static void fill_dc_dirty_rects(struct drm_plane *plane,
 			   dm_crtc_state->base.mode.crtc_vdisplay,
 			   &flip_addrs->dirty_rect_count, true);
 }
+EXPORT_IF_KUNIT(fill_dc_dirty_rects);
 
 static int dm_update_mst_vcpi_slots_for_dsc(struct drm_atomic_commit *state,
 					    struct dc_state *dc_state,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +8 -0
index ca19977cf788..2e3ad13b773a 100644
@@ -1172,6 +1172,14 @@ struct dm_atomic_state *dm_atomic_get_new_state(struct drm_atomic_commit *state)
 struct drm_private_state *dm_atomic_duplicate_state(struct drm_private_obj *obj);
 void dm_atomic_destroy_state(struct drm_private_obj *obj,
 			     struct drm_private_state *state);
+struct dc_flip_addrs;
+void fill_dc_dirty_rects(struct drm_plane *plane,
+			 struct drm_plane_state *old_plane_state,
+			 struct drm_plane_state *new_plane_state,
+			 struct drm_crtc_state *crtc_state,
+			 struct dc_flip_addrs *flip_addrs,
+			 bool is_psr_su,
+			 bool *dirty_regions_changed);
 void dm_update_pflip_irq_state(struct amdgpu_device *adev,
 			       struct amdgpu_crtc *acrtc);
 void amdgpu_dm_commit_cursors(struct drm_atomic_commit *state);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +349 -0

361 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#37 lore raw

PATCH 37/59 drm/amd/display: Test plane reset decision

In reply to Alex Hung

[WHAT]
Add KUnit tests for should_reset_plane() covering the pre-DCN3.2 modeset hack, a writeback commit, a plane moved between CRTCs, a plane outside the context, a missing new CRTC state, a cursor mode switch, color management, z-order, modeset, and the fast update baseline.

Also cover the cross-plane loop: cursor planes and planes on other CRTCs are skipped, while a moved plane, source or destination size, rotation, blend mode, alpha, colorspace, transfer function, pixel format and modifier changes each force a reset, and a plane missing one framebuffer is skipped.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |   9 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   4 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 509 ++++++++++++++++++
 3 files changed, 518 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5 -4
index 17425791e0ee..8db18d7cf49f 100644
@@ -5632,10 +5632,10 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
 	return ret;
 }
 
-static bool should_reset_plane(struct drm_atomic_commit *state,
-			       struct drm_plane *plane,
-			       struct drm_plane_state *old_plane_state,
-			       struct drm_plane_state *new_plane_state)
+STATIC_IFN_KUNIT bool should_reset_plane(struct drm_atomic_commit *state,
+					 struct drm_plane *plane,
+					 struct drm_plane_state *old_plane_state,
+					 struct drm_plane_state *new_plane_state)
 {
 	struct drm_plane *other;
 	struct drm_plane_state *old_other_state, *new_other_state;
@@ -5795,6 +5795,7 @@ static bool should_reset_plane(struct drm_atomic_commit *state,
 
 	return false;
 }
+EXPORT_IF_KUNIT(should_reset_plane);
 
 static int dm_update_plane_state(struct dc *dc,
 				 struct drm_atomic_commit *state,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +4 -0
index 2e3ad13b773a..0151913336b7 100644
@@ -1192,6 +1192,10 @@ void dm_arm_vblank_event(struct amdgpu_crtc *acrtc,
 void dm_arm_vblank_event_pre_programming(struct amdgpu_crtc *acrtc,
 					 struct dm_crtc_state *acrtc_state,
 					 bool pflip_update, bool cursor_update);
+bool should_reset_plane(struct drm_atomic_commit *state,
+			struct drm_plane *plane,
+			struct drm_plane_state *old_plane_state,
+			struct drm_plane_state *new_plane_state);
 int add_affected_mst_dsc_crtcs(struct drm_atomic_commit *state,
 			       struct drm_crtc *crtc);
 bool amdgpu_dm_crtc_mem_type_changed(struct drm_device *dev,
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +509 -0

521 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#38 lore raw

PATCH 38/59 drm/amd/display: Test link and sink dump

In reply to Alex Hung

[WHAT]
Add KUnit tests for amdgpu_dm_dump_links_and_sinks() covering a device without DC, a DC without links, named local and remote sinks, and missing or unnamed sinks.

[HOW]
Build lightweight DC link and sink objects so the dump walks each naming and skip path without display hardware.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |  1 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 92 +++++++++++++++++++
 3 files changed, 95 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
index 8db18d7cf49f..fc03fcca4c6a 100644
@@ -1776,7 +1776,7 @@ EXPORT_IF_KUNIT(amdgpu_dm_apply_delay_after_dpcd_poweroff);
  * (MST) sinks. Should be called after connector detection is complete to see
  * the final state of all links.
  */
-static void amdgpu_dm_dump_links_and_sinks(struct amdgpu_device *adev)
+STATIC_IFN_KUNIT void amdgpu_dm_dump_links_and_sinks(struct amdgpu_device *adev)
 {
 	struct dc *dc = adev->dm.dc;
 	struct drm_device *dev = adev_to_drm(adev);
@@ -1828,6 +1828,7 @@ static void amdgpu_dm_dump_links_and_sinks(struct amdgpu_device *adev)
 		}
 	}
 }
+EXPORT_IF_KUNIT(amdgpu_dm_dump_links_and_sinks);
 
 static int dm_resume(struct amdgpu_ip_block *ip_block)
 {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +1 -0
index 0151913336b7..7cb22915d18b 100644
@@ -1201,6 +1201,7 @@ int add_affected_mst_dsc_crtcs(struct drm_atomic_commit *state,
 bool amdgpu_dm_crtc_mem_type_changed(struct drm_device *dev,
 				     struct drm_atomic_commit *state,
 				     struct drm_crtc_state *crtc_state);
+void amdgpu_dm_dump_links_and_sinks(struct amdgpu_device *adev);
 int dm_plane_layer_index_cmp(const void *a, const void *b);
 int fill_plane_color_attributes(const struct drm_plane_state *plane_state,
 				const enum surface_pixel_format format,
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +92 -0

104 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#39 lore raw

PATCH 39/59 drm/amd/display: Test HDCP update

In reply to Alex Hung

[WHAT]
Add KUnit tests for amdgpu_dm_update_hdcp() covering a missing workqueue, a skipped writeback connector, and an unchanged DisplayPort connector.

[HOW]
Keep content protection unchanged and provide only the sink, connector, and CRTC state needed for the connector walk, avoiding HDCP operations.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |   3 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   1 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 100 ++++++++++++++++++
 3 files changed, 103 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
index fc03fcca4c6a..5b69794acc58 100644
@@ -4778,7 +4778,7 @@ static void dm_set_writeback(struct amdgpu_display_manager *dm,
 	kfree(wb_info);
 }
 
-static void amdgpu_dm_update_hdcp(struct drm_atomic_commit *state)
+STATIC_IFN_KUNIT void amdgpu_dm_update_hdcp(struct drm_atomic_commit *state)
 {
 	struct drm_connector_state *old_con_state, *new_con_state;
 	struct drm_device *dev = state->dev;
@@ -4892,6 +4892,7 @@ static void amdgpu_dm_update_hdcp(struct drm_atomic_commit *state)
 		}
 	}
 }
+EXPORT_IF_KUNIT(amdgpu_dm_update_hdcp);
 
 static int amdgpu_dm_atomic_setup_commit(struct drm_atomic_commit *state)
 {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +1 -0
index 7cb22915d18b..ed3210be7ab8 100644
@@ -1202,6 +1202,7 @@ bool amdgpu_dm_crtc_mem_type_changed(struct drm_device *dev,
 				     struct drm_atomic_commit *state,
 				     struct drm_crtc_state *crtc_state);
 void amdgpu_dm_dump_links_and_sinks(struct amdgpu_device *adev);
+void amdgpu_dm_update_hdcp(struct drm_atomic_commit *state);
 int dm_plane_layer_index_cmp(const void *a, const void *b);
 int fill_plane_color_attributes(const struct drm_plane_state *plane_state,
 				const enum surface_pixel_format format,
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +100 -0

118 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#40 lore raw

PATCH 40/59 drm/amd/display: Test global modeset lock acquisition

In reply to Alex Hung

[WHAT]
Add KUnit tests for do_aquire_global_lock() covering a device without CRTCs, a CRTC with no pending commit, and a CRTC whose commit has already completed.

[HOW]
Pre-signal the commit completions so the waits return immediately. The extra reference the loop takes is released again, so the commit never reaches zero and stays test-managed.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |   5 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   2 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 101 ++++++++++++++++++
 3 files changed, 106 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -2
index 5b69794acc58..72962c1c63e3 100644
@@ -5311,8 +5311,8 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_commit *state)
  * Grabs all modesetting locks to serialize against any blocking commits,
  * Waits for completion of all non blocking commits.
  */
-static int do_aquire_global_lock(struct drm_device *dev,
-				 struct drm_atomic_commit *state)
+STATIC_IFN_KUNIT int do_aquire_global_lock(struct drm_device *dev,
+					   struct drm_atomic_commit *state)
 {
 	struct drm_crtc *crtc;
 	struct drm_crtc_commit *commit;
@@ -5357,6 +5357,7 @@ static int do_aquire_global_lock(struct drm_device *dev,
 
 	return ret < 0 ? ret : 0;
 }
+EXPORT_IF_KUNIT(do_aquire_global_lock);
 
 static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
 			 struct drm_atomic_commit *state,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +2 -0
index ed3210be7ab8..cec86779b959 100644
@@ -1203,6 +1203,8 @@ bool amdgpu_dm_crtc_mem_type_changed(struct drm_device *dev,
 				     struct drm_crtc_state *crtc_state);
 void amdgpu_dm_dump_links_and_sinks(struct amdgpu_device *adev);
 void amdgpu_dm_update_hdcp(struct drm_atomic_commit *state);
+int do_aquire_global_lock(struct drm_device *dev,
+			  struct drm_atomic_commit *state);
 int dm_plane_layer_index_cmp(const void *a, const void *b);
 int fill_plane_color_attributes(const struct drm_plane_state *plane_state,
 				const enum surface_pixel_format format,
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +101 -0

113 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#41 lore raw

PATCH 41/59 drm/amd/display: Test timing sync trigger

In reply to Alex Hung

[WHAT]
Add KUnit tests for amdgpu_dm_trigger_timing_sync() covering a DC without a current state and the propagation of the force flag to every stream, and for dm_acpi_process_phy_transition_interlock().

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  2 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 59 +++++++++++++++++++
 2 files changed, 61 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -0
index 72962c1c63e3..13afd787c1b4 100644
@@ -6628,6 +6628,7 @@ void amdgpu_dm_trigger_timing_sync(struct drm_device *dev)
 	}
 	mutex_unlock(&adev->dm.dc_lock);
 }
+EXPORT_IF_KUNIT(amdgpu_dm_trigger_timing_sync);
 
 void dm_write_reg_func(const struct dc_context *ctx, uint32_t address,
 		       u32 value, const char *func_name)
@@ -6672,3 +6673,4 @@ void dm_acpi_process_phy_transition_interlock(
 {
 	// Not yet implemented
 }
+EXPORT_IF_KUNIT(dm_acpi_process_phy_transition_interlock);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +59 -0

71 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#42 lore raw

PATCH 42/59 drm/amd/display: Test IP block teardown and link emulation

In reply to Alex Hung

[WHAT]
Add KUnit tests for amdgpu_dm_early_fini() with audio never enabled, for dm_sw_fini() releasing the DMUB software state, for dm_oem_i2c_hw_init() when the resource pool has no OEM device, for dm_gpureset_commit_state() with an empty DC state, and for amdgpu_dm_emulated_link_detect() rejecting an unknown connector signal.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 15 ++--
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |  4 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 86 +++++++++++++++++++
 3 files changed, 100 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +10 -5
index 13afd787c1b4..2085625f8509 100644
@@ -830,7 +830,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
 	return -EINVAL;
 }
 
-static int amdgpu_dm_early_fini(struct amdgpu_ip_block *ip_block)
+STATIC_IFN_KUNIT int amdgpu_dm_early_fini(struct amdgpu_ip_block *ip_block)
 {
 	struct amdgpu_device *adev = ip_block->adev;
 
@@ -838,6 +838,7 @@ static int amdgpu_dm_early_fini(struct amdgpu_ip_block *ip_block)
 
 	return 0;
 }
+EXPORT_IF_KUNIT(amdgpu_dm_early_fini);
 
 static void amdgpu_dm_fini(struct amdgpu_device *adev)
 {
@@ -1078,7 +1079,7 @@ static int dm_sw_init(struct amdgpu_ip_block *ip_block)
 	return load_dmcu_fw(adev);
 }
 
-static int dm_sw_fini(struct amdgpu_ip_block *ip_block)
+STATIC_IFN_KUNIT int dm_sw_fini(struct amdgpu_ip_block *ip_block)
 {
 	struct amdgpu_device *adev = ip_block->adev;
 	struct dal_allocation *da;
@@ -1108,6 +1109,7 @@ static int dm_sw_fini(struct amdgpu_ip_block *ip_block)
 
 	return 0;
 }
+EXPORT_IF_KUNIT(dm_sw_fini);
 
 
 static void amdgpu_dm_boot_time_crc_init(struct amdgpu_device *adev)
@@ -1302,7 +1304,7 @@ static void s3_handle_mst(struct drm_device *dev, bool suspend)
 	drm_connector_list_iter_end(&iter);
 }
 
-static int dm_oem_i2c_hw_init(struct amdgpu_device *adev)
+STATIC_IFN_KUNIT int dm_oem_i2c_hw_init(struct amdgpu_device *adev)
 {
 	struct amdgpu_display_manager *dm = &adev->dm;
 	struct amdgpu_i2c_adapter *oem_i2c;
@@ -1328,6 +1330,7 @@ static int dm_oem_i2c_hw_init(struct amdgpu_device *adev)
 
 	return 0;
 }
+EXPORT_IF_KUNIT(dm_oem_i2c_hw_init);
 
 /**
  * dm_hw_init() - Initialize DC device
@@ -1710,9 +1713,10 @@ void amdgpu_dm_emulated_link_detect(struct dc_link *link)
 		drm_err(dev, "Failed to read EDID\n");
 
 }
+EXPORT_IF_KUNIT(amdgpu_dm_emulated_link_detect);
 
-static void dm_gpureset_commit_state(struct dc_state *dc_state,
-				     struct amdgpu_display_manager *dm)
+STATIC_IFN_KUNIT void dm_gpureset_commit_state(struct dc_state *dc_state,
+					       struct amdgpu_display_manager *dm)
 {
 	struct {
 		struct dc_surface_update surface_updates[MAX_SURFACES];
@@ -1748,6 +1752,7 @@ static void dm_gpureset_commit_state(struct dc_state *dc_state,
 					 bundle->surface_updates);
 	}
 }
+EXPORT_IF_KUNIT(dm_gpureset_commit_state);
 
 void amdgpu_dm_apply_delay_after_dpcd_poweroff(struct amdgpu_device *adev,
 											   struct dc_sink *sink)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +4 -0
index cec86779b959..35b8725a63af 100644
@@ -1205,6 +1205,10 @@ void amdgpu_dm_dump_links_and_sinks(struct amdgpu_device *adev);
 void amdgpu_dm_update_hdcp(struct drm_atomic_commit *state);
 int do_aquire_global_lock(struct drm_device *dev,
 			  struct drm_atomic_commit *state);
+int amdgpu_dm_early_fini(struct amdgpu_ip_block *ip_block);
+int dm_sw_fini(struct amdgpu_ip_block *ip_block);
+int dm_oem_i2c_hw_init(struct amdgpu_device *adev);
+void dm_gpureset_commit_state(struct dc_state *dc_state, struct amdgpu_display_manager *dm);
 int dm_plane_layer_index_cmp(const void *a, const void *b);
 int fill_plane_color_attributes(const struct drm_plane_state *plane_state,
 				const enum surface_pixel_format format,
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +86 -0

98 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#43 lore raw

PATCH 43/59 drm/amd/display: Test mod_power stream updates on modeset

In reply to Alex Hung

[WHAT]
Add KUnit tests for amdgpu_dm_mod_power_update_streams() covering empty and fast commits plus CRTC enable, replacement, and disable, and for amdgpu_dm_mod_power_setup_streams() covering empty, modeset, and fast updates.

[HOW]
Leave dm->power_module NULL and PSR/Replay feature bits clear so the DM stream transition logic runs without a live power module.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  10 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   4 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 170 ++++++++++++++++++
 3 files changed, 180 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +6 -4
index 2085625f8509..8e62d451e0b1 100644
@@ -4341,8 +4341,8 @@ static void dm_clear_writeback(struct amdgpu_display_manager *dm,
  * in preparation for hardware programming. See also
  * amdgpu_dm_mod_power_setup_streams() for post-modeset mod_power setup.
  */
-static void amdgpu_dm_mod_power_update_streams(struct drm_atomic_commit *state,
-					       struct amdgpu_display_manager *dm)
+STATIC_IFN_KUNIT void amdgpu_dm_mod_power_update_streams(struct drm_atomic_commit *state,
+							struct amdgpu_display_manager *dm)
 {
 	struct dm_crtc_state *dm_old_crtc_state, *dm_new_crtc_state;
 	struct drm_crtc_state *old_crtc_state, *new_crtc_state;
@@ -4395,6 +4395,7 @@ static void amdgpu_dm_mod_power_update_streams(struct drm_atomic_commit *state,
 		}
 	}
 }
+EXPORT_IF_KUNIT(amdgpu_dm_mod_power_update_streams);
 
 /**
  * amdgpu_dm_mod_power_setup_streams - setup mod_power stream state post modeset
@@ -4404,8 +4405,8 @@ static void amdgpu_dm_mod_power_update_streams(struct drm_atomic_commit *state,
  * Notify mod_power of mode_change. This needs to be done after dc_stream
  * updates have been committed, and VRR parameters have been updated.
  */
-static void amdgpu_dm_mod_power_setup_streams(struct drm_atomic_commit *state,
-					      struct amdgpu_display_manager *dm)
+STATIC_IFN_KUNIT void amdgpu_dm_mod_power_setup_streams(struct drm_atomic_commit *state,
+						       struct amdgpu_display_manager *dm)
 {
 	struct dm_crtc_state *dm_new_crtc_state;
 	struct drm_crtc_state *new_crtc_state;
@@ -4442,6 +4443,7 @@ static void amdgpu_dm_mod_power_setup_streams(struct drm_atomic_commit *state,
 	}
 
 }
+EXPORT_IF_KUNIT(amdgpu_dm_mod_power_setup_streams);
 
 static void amdgpu_dm_commit_streams(struct drm_atomic_commit *state,
 					struct dc_state *dc_state)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +4 -0
index 35b8725a63af..7308067b4d13 100644
@@ -1205,6 +1205,10 @@ void amdgpu_dm_dump_links_and_sinks(struct amdgpu_device *adev);
 void amdgpu_dm_update_hdcp(struct drm_atomic_commit *state);
 int do_aquire_global_lock(struct drm_device *dev,
 			  struct drm_atomic_commit *state);
+void amdgpu_dm_mod_power_update_streams(struct drm_atomic_commit *state,
+					struct amdgpu_display_manager *dm);
+void amdgpu_dm_mod_power_setup_streams(struct drm_atomic_commit *state,
+				       struct amdgpu_display_manager *dm);
 int amdgpu_dm_early_fini(struct amdgpu_ip_block *ip_block);
 int dm_sw_fini(struct amdgpu_ip_block *ip_block);
 int dm_oem_i2c_hw_init(struct amdgpu_device *adev);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +170 -0

188 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#44 lore raw

PATCH 44/59 drm/amd/display: Test atomic commit setup

In reply to Alex Hung

[WHAT]
Add KUnit tests for amdgpu_dm_atomic_setup_commit() covering an empty commit, changed color management, a modeset-only color update, and an invalid degamma LUT.

[HOW]
Reuse the modeset fixture for active CRTC paths and attach a one-entry LUT to exercise size validation without hardware programming.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  5 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |  1 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 67 +++++++++++++++++++
 3 files changed, 71 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -2
index 8e62d451e0b1..71fe85498766 100644
@@ -141,7 +141,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev);
 /* removes and deallocates the drm structures, created by the above function */
 static void amdgpu_dm_destroy_drm_device(struct amdgpu_display_manager *dm);
 
-static int amdgpu_dm_atomic_setup_commit(struct drm_atomic_commit *state);
+STATIC_IFN_KUNIT int amdgpu_dm_atomic_setup_commit(struct drm_atomic_commit *state);
 static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_commit *state);
 STATIC_IFN_KUNIT void dm_enable_per_frame_crtc_master_sync(struct dc_state *context);
 
@@ -4901,7 +4901,7 @@ STATIC_IFN_KUNIT void amdgpu_dm_update_hdcp(struct drm_atomic_commit *state)
 }
 EXPORT_IF_KUNIT(amdgpu_dm_update_hdcp);
 
-static int amdgpu_dm_atomic_setup_commit(struct drm_atomic_commit *state)
+STATIC_IFN_KUNIT int amdgpu_dm_atomic_setup_commit(struct drm_atomic_commit *state)
 {
 	struct drm_crtc *crtc;
 	struct drm_crtc_state *old_crtc_state, *new_crtc_state;
@@ -4933,6 +4933,7 @@ static int amdgpu_dm_atomic_setup_commit(struct drm_atomic_commit *state)
 
 	return 0;
 }
+EXPORT_IF_KUNIT(amdgpu_dm_atomic_setup_commit);
 
 STATIC_IFN_KUNIT void set_multisync_trigger_params(
 		struct dc_stream_state *stream)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +1 -0
index 7308067b4d13..5ffaca8a6efe 100644
@@ -1203,6 +1203,7 @@ bool amdgpu_dm_crtc_mem_type_changed(struct drm_device *dev,
 				     struct drm_crtc_state *crtc_state);
 void amdgpu_dm_dump_links_and_sinks(struct amdgpu_device *adev);
 void amdgpu_dm_update_hdcp(struct drm_atomic_commit *state);
+int amdgpu_dm_atomic_setup_commit(struct drm_atomic_commit *state);
 int do_aquire_global_lock(struct drm_device *dev,
 			  struct drm_atomic_commit *state);
 void amdgpu_dm_mod_power_update_streams(struct drm_atomic_commit *state,
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +67 -0

85 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#45 lore raw

PATCH 45/59 drm/amd/display: Test MMHUB config read

In reply to Alex Hung

[WHAT]
Add KUnit tests for the system aperture and GART configuration built by mmhub_read_system_context(), covering the enabled and disabled AGP aperture branches, the Raven2 and Renoir aperture workarounds, and the GPUVM support flag.

[HOW]
Add struct amdgpu_dm_kunit_ops, a KUnit-only indirection table for amdgpu_gmc_pd_addr(), which walks a live TTM buffer object back to its device. Tests install a stub returning a fixed page directory address, which makes the arithmetic reachable in the UML test environment. The default table points at the existing AMDGPU function, so no test-only wrapper is introduced.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  24 +++-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |  11 ++
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 128 ++++++++++++++++++
 3 files changed, 161 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +22 -2
index 71fe85498766..ffc5cea6b6df 100644
@@ -309,8 +309,27 @@ EXPORT_IF_KUNIT(dm_set_powergating_state);
 /* Prototypes of private functions */
 static int dm_early_init(struct amdgpu_ip_block *ip_block);
 
+#if IS_ENABLED(CONFIG_DRM_AMD_DC_KUNIT_TEST)
+static const struct amdgpu_dm_kunit_ops amdgpu_dm_default_ops = {
+	.gmc_pd_addr = amdgpu_gmc_pd_addr,
+};
+
+static const struct amdgpu_dm_kunit_ops *amdgpu_dm_ops = &amdgpu_dm_default_ops;
+
+void amdgpu_dm_kunit_set_ops(const struct amdgpu_dm_kunit_ops *ops)
+{
+	amdgpu_dm_ops = ops ? ops : &amdgpu_dm_default_ops;
+}
+EXPORT_IF_KUNIT(amdgpu_dm_kunit_set_ops);
+
+#define dm_gmc_pd_addr		amdgpu_dm_ops->gmc_pd_addr
+#else
+#define dm_gmc_pd_addr		amdgpu_gmc_pd_addr
+#endif
+
 /* Allocate memory for FBC compressed data  */
-static void mmhub_read_system_context(struct amdgpu_device *adev, struct dc_phy_addr_space_config *pa_config)
+STATIC_IFN_KUNIT void mmhub_read_system_context(struct amdgpu_device *adev,
+						struct dc_phy_addr_space_config *pa_config)
 {
 	u64 pt_base;
 	u32 logical_addr_low;
@@ -355,7 +374,7 @@ static void mmhub_read_system_context(struct amdgpu_device *adev, struct dc_phy_
 			logical_addr_high = max(adev->gmc.fb_end, adev->gmc.agp_end) >> 18;
 	}
 
-	pt_base = amdgpu_gmc_pd_addr(adev->gart.bo);
+	pt_base = dm_gmc_pd_addr(adev->gart.bo);
 
 	page_table_start.high_part = upper_32_bits(adev->gmc.gart_start >>
 						   AMDGPU_GPU_PAGE_SHIFT);
@@ -386,6 +405,7 @@ static void mmhub_read_system_context(struct amdgpu_device *adev, struct dc_phy_
 	pa_config->is_hvm_enabled = adev->mode_info.gpu_vm_support;
 
 }
+EXPORT_IF_KUNIT(mmhub_read_system_context);
 
 static int amdgpu_dm_init_power_module(struct amdgpu_display_manager *dm)
 {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +11 -0
index 5ffaca8a6efe..a53246040948 100644
@@ -1241,6 +1241,17 @@ struct amdgpu_dm_services_kunit_ops {
 };
 
 void amdgpu_dm_services_kunit_set_ops(const struct amdgpu_dm_services_kunit_ops *ops);
+
+struct amdgpu_dm_kunit_ops {
+	uint64_t (*gmc_pd_addr)(struct amdgpu_bo *bo);
+};
+
+void amdgpu_dm_kunit_set_ops(const struct amdgpu_dm_kunit_ops *ops);
+
+struct dc_phy_addr_space_config;
+
+void mmhub_read_system_context(struct amdgpu_device *adev,
+			       struct dc_phy_addr_space_config *pa_config);
 #endif
 
 #endif /* __AMDGPU_DM_H__ */
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +128 -0

140 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#46 lore raw

PATCH 46/59 drm/amd/display: Test power module init

In reply to Alex Hung

[WHAT]
Add KUnit tests for amdgpu_dm_init_power_module(), covering the skip when no eDP is detected and the backlight parameter setup loop followed by the allocation failure report.

[HOW]
mod_power_create() rejects a NULL DC, which walks the full parameter setup loop without needing a live display core.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |  1 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 40 +++++++++++++++++++
 3 files changed, 43 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
index ffc5cea6b6df..3d2a9e014797 100644
@@ -407,7 +407,7 @@ STATIC_IFN_KUNIT void mmhub_read_system_context(struct amdgpu_device *adev,
 }
 EXPORT_IF_KUNIT(mmhub_read_system_context);
 
-static int amdgpu_dm_init_power_module(struct amdgpu_display_manager *dm)
+STATIC_IFN_KUNIT int amdgpu_dm_init_power_module(struct amdgpu_display_manager *dm)
 {
 	struct mod_power_init_params init_data[MAX_NUM_EDP];
 
@@ -470,6 +470,7 @@ static int amdgpu_dm_init_power_module(struct amdgpu_display_manager *dm)
 
 	return 0;
 }
+EXPORT_IF_KUNIT(amdgpu_dm_init_power_module);
 
 static int amdgpu_dm_init(struct amdgpu_device *adev)
 {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +1 -0
index a53246040948..5e9d0b203a0f 100644
@@ -1252,6 +1252,7 @@ struct dc_phy_addr_space_config;
 
 void mmhub_read_system_context(struct amdgpu_device *adev,
 			       struct dc_phy_addr_space_config *pa_config);
+int amdgpu_dm_init_power_module(struct amdgpu_display_manager *dm);
 #endif
 
 #endif /* __AMDGPU_DM_H__ */
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +40 -0
index bb52da037e69..d1a25b3e68c5 100644
@@ -3522,6 +3522,43 @@ static void dm_test_mmhub_agp_enabled_renoir(struct kunit *test)
 	KUNIT_EXPECT_EQ(test, pa_config.system_aperture.end_addr, 0x80000000ULL);
 }
 
+/* Tests for amdgpu_dm_init_power_module() */
+
+/**
+ * dm_test_init_power_module_no_edp - Test no eDP skips the power module
+ * @test: The KUnit test context
+ */
+static void dm_test_init_power_module_no_edp(struct kunit *test)
+{
+	struct amdgpu_device *adev = dm_kunit_alloc_adev(test);
+
+	adev->dm.ddev = &adev->ddev;
+	adev->dm.num_of_edps = 0;
+
+	KUNIT_EXPECT_EQ(test, amdgpu_dm_init_power_module(&adev->dm), 0);
+	KUNIT_EXPECT_NULL(test, adev->dm.power_module);
+}
+
+/**
+ * dm_test_init_power_module_alloc_failure - Test a failed power module create
+ * @test: The KUnit test context
+ *
+ * mod_power_create() rejects a NULL DC, which walks the full parameter setup
+ * loop and then reports the allocation failure.
+ */
+static void dm_test_init_power_module_alloc_failure(struct kunit *test)
+{
+	struct amdgpu_device *adev = dm_kunit_alloc_adev(test);
+
+	adev->dm.ddev = &adev->ddev;
+	adev->dm.num_of_edps = 1;
+	adev->dm.backlight_caps[0].min_input_signal = 0x10;
+	adev->dm.backlight_caps[0].max_input_signal = 0xff;
+
+	KUNIT_EXPECT_EQ(test, amdgpu_dm_init_power_module(&adev->dm), -ENOMEM);
+	KUNIT_EXPECT_NULL(test, adev->dm.power_module);
+}
+
 static struct kunit_case amdgpu_dm_tests[] = {
 	/* Simple DM callbacks */
 	KUNIT_CASE(dm_test_wait_for_idle),
@@ -3699,6 +3736,9 @@ static struct kunit_case amdgpu_dm_tests[] = {
 	KUNIT_CASE(dm_test_mmhub_agp_disabled_raven2),
 	KUNIT_CASE(dm_test_mmhub_agp_enabled),
 	KUNIT_CASE(dm_test_mmhub_agp_enabled_renoir),
+	/* amdgpu_dm_init_power_module */
+	KUNIT_CASE(dm_test_init_power_module_no_edp),
+	KUNIT_CASE(dm_test_init_power_module_alloc_failure),
 	{}
 };
 
Signature · 1 line
2.43.0
author
#47 lore raw

PATCH 47/59 drm/amd/display: Test vline0 irq control

In reply to Alex Hung

[WHAT]
The vline0 interrupt handling in amdgpu_dm_crtc_set_vblank() sits inside a CONFIG_DRM_AMD_SECURE_DISPLAY block. That symbol depends on CONFIG_DRM_AMD_DC_FP, which cannot be enabled on UML because UML does not select ARCH_HAS_KERNEL_FPU_SUPPORT, so the logic is never built by the KUnit tests and stays uncovered.

[HOW]
Move the block into amdgpu_dm_crtc_set_vline0_irq() and build it whenever CONFIG_DRM_AMD_SECURE_DISPLAY or the KUnit tests are enabled. The DCN-only check becomes an early return. Behaviour of amdgpu_dm_crtc_set_vblank() is unchanged.

Add tests for amdgpu_dm_crtc_set_vline0_irq() covering the DCE no-op path, error propagation from amdgpu_irq_get() and the enable/disable refcount round-trip.

Assisted-by Copilot:Claude-Opus-5
---
 .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c    |  40 ++++---
 .../amd/display/amdgpu_dm/amdgpu_dm_crtc.h    |   1 +
 .../amdgpu_dm/tests/amdgpu_dm_crtc_test.c     | 101 ++++++++++++++++++
 3 files changed, 129 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +27 -13
index 2de758aceda5..4b8530d734e5 100644
@@ -249,6 +249,30 @@ STATIC_IFN_KUNIT void amdgpu_dm_crtc_vblank_control_worker(struct work_struct *w
 }
 EXPORT_IF_KUNIT(amdgpu_dm_crtc_vblank_control_worker);
 
+#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) || IS_ENABLED(CONFIG_DRM_AMD_DC_KUNIT_TEST)
+STATIC_IFN_KUNIT int amdgpu_dm_crtc_set_vline0_irq(struct drm_crtc *crtc, int irq_type,
+						   bool enable)
+{
+	struct amdgpu_device *adev = drm_to_adev(crtc->dev);
+	int rc;
+
+	/* crtc vline0 interrupt, only available on DCN+ */
+	if (amdgpu_ip_version(adev, DCE_HWIP, 0) == 0)
+		return 0;
+
+	if (enable) {
+		rc = amdgpu_irq_get(adev, &adev->vline0_irq, irq_type);
+		drm_dbg_vbl(crtc->dev, "Get vline0_irq ret=%d\n", rc);
+	} else {
+		rc = amdgpu_irq_put(adev, &adev->vline0_irq, irq_type);
+		drm_dbg_vbl(crtc->dev, "Put vline0_irq ret=%d\n", rc);
+	}
+
+	return rc;
+}
+EXPORT_IF_KUNIT(amdgpu_dm_crtc_set_vline0_irq);
+#endif
+
 static inline int amdgpu_dm_crtc_set_vblank(struct drm_crtc *crtc, bool enable)
 {
 	struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
@@ -358,19 +382,9 @@ static inline int amdgpu_dm_crtc_set_vblank(struct drm_crtc *crtc, bool enable)
 	}
 
 #if defined(CONFIG_DRM_AMD_SECURE_DISPLAY)
-	/* crtc vline0 interrupt, only available on DCN+ */
-	if (amdgpu_ip_version(adev, DCE_HWIP, 0) != 0) {
-		if (enable) {
-			rc = amdgpu_irq_get(adev, &adev->vline0_irq, irq_type);
-			drm_dbg_vbl(crtc->dev, "Get vline0_irq ret=%d\n", rc);
-		} else {
-			rc = amdgpu_irq_put(adev, &adev->vline0_irq, irq_type);
-			drm_dbg_vbl(crtc->dev, "Put vline0_irq ret=%d\n", rc);
-		}
-
-		if (rc)
-			return rc;
-	}
+	rc = amdgpu_dm_crtc_set_vline0_irq(crtc, irq_type, enable);
+	if (rc)
+		return rc;
 #endif
 
 	if (amdgpu_in_reset(adev))
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.h +1 -0
index 7de79796a56d..91fdd262c2d2 100644
@@ -56,6 +56,7 @@ void amdgpu_dm_crtc_update_crtc_active_planes(struct drm_crtc *crtc,
 					      struct drm_crtc_state *new_crtc_state);
 void amdgpu_dm_crtc_vblank_control_worker(struct work_struct *work);
 void amdgpu_dm_idle_worker(struct work_struct *work);
+int amdgpu_dm_crtc_set_vline0_irq(struct drm_crtc *crtc, int irq_type, bool enable);
 int amdgpu_dm_crtc_helper_atomic_check(struct drm_crtc *crtc,
 				       struct drm_atomic_commit *state);
 #ifdef CONFIG_DEBUG_FS
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c +101 -0

113 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#48 lore raw

PATCH 48/59 drm/amd/display: Test DMCU firmware load

In reply to Alex Hung

[WHAT]
Add KUnit tests for load_dmcu_fw(), covering the ASICs and DCN IP versions without a DMCU, an unsupported IP version, the three Raven revisions, and a missing firmware image.

[HOW]
No firmware is installed in the test environment, so amdgpu_ucode_request() reports -ENODEV and the missing image is treated as non-fatal.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |   3 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   1 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 101 ++++++++++++++++++
 3 files changed, 104 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
index 3d2a9e014797..128b12a945fc 100644
@@ -967,7 +967,7 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev)
 	mutex_destroy(&adev->dm.dpia_aux_lock);
 }
 
-static int load_dmcu_fw(struct amdgpu_device *adev)
+STATIC_IFN_KUNIT int load_dmcu_fw(struct amdgpu_device *adev)
 {
 	const char *fw_name_dmcu = NULL;
 	int r;
@@ -1077,6 +1077,7 @@ static int load_dmcu_fw(struct amdgpu_device *adev)
 
 	return 0;
 }
+EXPORT_IF_KUNIT(load_dmcu_fw);
 
 static int dm_sw_init(struct amdgpu_ip_block *ip_block)
 {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +1 -0
index 5e9d0b203a0f..858fe967046b 100644
@@ -1253,6 +1253,7 @@ struct dc_phy_addr_space_config;
 void mmhub_read_system_context(struct amdgpu_device *adev,
 			       struct dc_phy_addr_space_config *pa_config);
 int amdgpu_dm_init_power_module(struct amdgpu_display_manager *dm);
+int load_dmcu_fw(struct amdgpu_device *adev);
 #endif
 
 #endif /* __AMDGPU_DM_H__ */
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +101 -0

119 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#49 lore raw

PATCH 49/59 drm/amd/display: Test SW init and fini

In reply to Alex Hung

[WHAT]
Add KUnit tests for dm_sw_init() on an ASIC without a DMUB, and for the DMUB bounding box release in dm_sw_fini().

[HOW]
An ASIC without DMUB support makes dm_dmub_sw_init() return early. The bounding box allocation is left without a buffer object, which amdgpu_bo_free_kernel() short-circuits.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |  1 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 51 +++++++++++++++++++
 3 files changed, 54 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
index 128b12a945fc..8b4d01d97ea4 100644
@@ -1079,7 +1079,7 @@ STATIC_IFN_KUNIT int load_dmcu_fw(struct amdgpu_device *adev)
 }
 EXPORT_IF_KUNIT(load_dmcu_fw);
 
-static int dm_sw_init(struct amdgpu_ip_block *ip_block)
+STATIC_IFN_KUNIT int dm_sw_init(struct amdgpu_ip_block *ip_block)
 {
 	struct amdgpu_device *adev = ip_block->adev;
 	int r;
@@ -1100,6 +1100,7 @@ static int dm_sw_init(struct amdgpu_ip_block *ip_block)
 
 	return load_dmcu_fw(adev);
 }
+EXPORT_IF_KUNIT(dm_sw_init);
 
 STATIC_IFN_KUNIT int dm_sw_fini(struct amdgpu_ip_block *ip_block)
 {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +1 -0
index 858fe967046b..80da5a378d73 100644
@@ -1254,6 +1254,7 @@ void mmhub_read_system_context(struct amdgpu_device *adev,
 			       struct dc_phy_addr_space_config *pa_config);
 int amdgpu_dm_init_power_module(struct amdgpu_display_manager *dm);
 int load_dmcu_fw(struct amdgpu_device *adev);
+int dm_sw_init(struct amdgpu_ip_block *ip_block);
 #endif
 
 #endif /* __AMDGPU_DM_H__ */
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +51 -0

63 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#50 lore raw

PATCH 50/59 drm/amd/display: Test DM late init

In reply to Alex Hung

[WHAT]
Add KUnit tests for dm_late_init(), covering a DC without a DMCU, and the boot time CRC init with and without a DMUB service.

[HOW]
An empty resource pool leaves the DMCU NULL and an empty link list leaves no eDP, so the ABM configuration is skipped and only the MST detection sweep runs. A stub reports the boot time CRC as disabled.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  3 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |  1 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 87 +++++++++++++++++++
 3 files changed, 90 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
index 8b4d01d97ea4..0393ec122f26 100644
@@ -1183,7 +1183,7 @@ static void amdgpu_dm_boot_time_crc_init(struct amdgpu_device *adev)
 	}
 }
 
-static int dm_late_init(struct amdgpu_ip_block *ip_block)
+STATIC_IFN_KUNIT int dm_late_init(struct amdgpu_ip_block *ip_block)
 {
 	struct amdgpu_device *adev = ip_block->adev;
 
@@ -1233,6 +1233,7 @@ static int dm_late_init(struct amdgpu_ip_block *ip_block)
 
 	return amdgpu_dm_detect_mst_link_for_all_connectors(adev_to_drm(adev));
 }
+EXPORT_IF_KUNIT(dm_late_init);
 
 static void resume_mst_branch_status(struct drm_dp_mst_topology_mgr *mgr)
 {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +1 -0
index 80da5a378d73..c662c39416d8 100644
@@ -1255,6 +1255,7 @@ void mmhub_read_system_context(struct amdgpu_device *adev,
 int amdgpu_dm_init_power_module(struct amdgpu_display_manager *dm);
 int load_dmcu_fw(struct amdgpu_device *adev);
 int dm_sw_init(struct amdgpu_ip_block *ip_block);
+int dm_late_init(struct amdgpu_ip_block *ip_block);
 #endif
 
 #endif /* __AMDGPU_DM_H__ */
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +87 -0

105 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#51 lore raw

PATCH 51/59 drm/amd/display: Test mode and plane init

In reply to Alex Hung

[WHAT]
Add KUnit tests for amdgpu_dm_mode_config_init() and initialize_plane(), covering the mode config defaults, the Hawaii preferred shadow quirk, the DM private object state, and primary and overlay plane creation.

[HOW]
drm_atomic_private_obj_init() builds the private state through dm_atomic_create_state(), so a current DC state is enough to exercise it. Audio is disabled for the duration of the test so no audio component is left registered on the mock device.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  12 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   5 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 132 ++++++++++++++++++
 3 files changed, 144 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +7 -5
index 0393ec122f26..cd9f44326ae3 100644
@@ -2253,7 +2253,7 @@ static struct drm_private_state_funcs dm_atomic_state_funcs = {
 	.atomic_destroy_state = dm_atomic_destroy_state,
 };
 
-static int amdgpu_dm_mode_config_init(struct amdgpu_device *adev)
+STATIC_IFN_KUNIT int amdgpu_dm_mode_config_init(struct amdgpu_device *adev)
 {
 	int r;
 
@@ -2293,11 +2293,12 @@ static int amdgpu_dm_mode_config_init(struct amdgpu_device *adev)
 
 	return 0;
 }
+EXPORT_IF_KUNIT(amdgpu_dm_mode_config_init);
 
-static int initialize_plane(struct amdgpu_display_manager *dm,
-			    struct amdgpu_mode_info *mode_info, int plane_id,
-			    enum drm_plane_type plane_type,
-			    const struct dc_plane_cap *plane_cap)
+STATIC_IFN_KUNIT int initialize_plane(struct amdgpu_display_manager *dm,
+				      struct amdgpu_mode_info *mode_info, int plane_id,
+				      enum drm_plane_type plane_type,
+				      const struct dc_plane_cap *plane_cap)
 {
 	struct drm_plane *plane;
 	unsigned long possible_crtcs;
@@ -2333,6 +2334,7 @@ static int initialize_plane(struct amdgpu_display_manager *dm,
 
 	return ret;
 }
+EXPORT_IF_KUNIT(initialize_plane);
 
 
 /*
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +5 -0
index c662c39416d8..19c6b29947f6 100644
@@ -1249,6 +1249,7 @@ struct amdgpu_dm_kunit_ops {
 void amdgpu_dm_kunit_set_ops(const struct amdgpu_dm_kunit_ops *ops);
 
 struct dc_phy_addr_space_config;
+struct dc_plane_cap;
 
 void mmhub_read_system_context(struct amdgpu_device *adev,
 			       struct dc_phy_addr_space_config *pa_config);
@@ -1256,6 +1257,10 @@ int amdgpu_dm_init_power_module(struct amdgpu_display_manager *dm);
 int load_dmcu_fw(struct amdgpu_device *adev);
 int dm_sw_init(struct amdgpu_ip_block *ip_block);
 int dm_late_init(struct amdgpu_ip_block *ip_block);
+int amdgpu_dm_mode_config_init(struct amdgpu_device *adev);
+int initialize_plane(struct amdgpu_display_manager *dm, struct amdgpu_mode_info *mode_info,
+		     int plane_id, enum drm_plane_type plane_type,
+		     const struct dc_plane_cap *plane_cap);
 #endif
 
 #endif /* __AMDGPU_DM_H__ */
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +132 -0

150 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#52 lore raw

PATCH 52/59 drm/amd/display: Test DM early init

In reply to Alex Hung

[WHAT]
Add KUnit tests for dm_early_init(), covering the display counts of the legacy ASICs and the DCN IP versions, a BIOS without an object header, and an unsupported IP version.

[HOW]
Add a fake ATOM BIOS image whose master data table reports a present entry, which is all amdgpu_atom_parse_data_header() checks here. Only IP versions without DMUB firmware are used, so dm_init_microcode() does not reach a firmware request.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |   5 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   1 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 168 ++++++++++++++++++
 3 files changed, 172 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -2
index cd9f44326ae3..0ac4711b62e7 100644
@@ -307,7 +307,7 @@ STATIC_IFN_KUNIT int dm_set_powergating_state(struct amdgpu_ip_block *ip_block,
 EXPORT_IF_KUNIT(dm_set_powergating_state);
 
 /* Prototypes of private functions */
-static int dm_early_init(struct amdgpu_ip_block *ip_block);
+STATIC_IFN_KUNIT int dm_early_init(struct amdgpu_ip_block *ip_block);
 
 #if IS_ENABLED(CONFIG_DRM_AMD_DC_KUNIT_TEST)
 static const struct amdgpu_dm_kunit_ops amdgpu_dm_default_ops = {
@@ -2751,7 +2751,7 @@ DEVICE_ATTR_WO(s3_debug);
 
 #endif
 
-static int dm_early_init(struct amdgpu_ip_block *ip_block)
+STATIC_IFN_KUNIT int dm_early_init(struct amdgpu_ip_block *ip_block)
 {
 	struct amdgpu_device *adev = ip_block->adev;
 	struct amdgpu_mode_info *mode_info = &adev->mode_info;
@@ -2901,6 +2901,7 @@ static int dm_early_init(struct amdgpu_ip_block *ip_block)
 
 	return dm_init_microcode(adev);
 }
+EXPORT_IF_KUNIT(dm_early_init);
 
 STATIC_IFN_KUNIT bool modereset_required(struct drm_crtc_state *crtc_state)
 {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +1 -0
index 19c6b29947f6..88fa4292c5cf 100644
@@ -1254,6 +1254,7 @@ struct dc_plane_cap;
 void mmhub_read_system_context(struct amdgpu_device *adev,
 			       struct dc_phy_addr_space_config *pa_config);
 int amdgpu_dm_init_power_module(struct amdgpu_display_manager *dm);
+int dm_early_init(struct amdgpu_ip_block *ip_block);
 int load_dmcu_fw(struct amdgpu_device *adev);
 int dm_sw_init(struct amdgpu_ip_block *ip_block);
 int dm_late_init(struct amdgpu_ip_block *ip_block);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +168 -0

186 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#53 lore raw

PATCH 53/59 drm/amd/display: Test DC plane info fill

In reply to Alex Hung

[WHAT]
Add KUnit tests for fill_dc_plane_info_and_addr(), covering every graphics and video pixel format mapping, all rotations, the unsupported format and invalid colour encoding rejections, and the z-order and blending forwarding.

[HOW]
A linear GFX9 framebuffer is the simplest input that lets the buffer attribute helper succeed, so the format switch can be walked without a live display core.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |   3 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   6 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 246 ++++++++++++++++++
 3 files changed, 254 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
index 0ac4711b62e7..8a87677b46b8 100644
@@ -2958,7 +2958,7 @@ fill_plane_color_attributes(const struct drm_plane_state *plane_state,
 }
 EXPORT_IF_KUNIT(fill_plane_color_attributes);
 
-static int
+STATIC_IFN_KUNIT int
 fill_dc_plane_info_and_addr(struct amdgpu_device *adev,
 			    const struct drm_plane_state *plane_state,
 			    struct dc_plane_info *plane_info,
@@ -3072,6 +3072,7 @@ fill_dc_plane_info_and_addr(struct amdgpu_device *adev,
 
 	return 0;
 }
+EXPORT_IF_KUNIT(fill_dc_plane_info_and_addr);
 
 static int fill_dc_plane_attributes(struct amdgpu_device *adev,
 				    struct dc_plane_state *dc_plane_state,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +6 -0
index 88fa4292c5cf..09ecca519b3b 100644
@@ -1249,12 +1249,18 @@ struct amdgpu_dm_kunit_ops {
 void amdgpu_dm_kunit_set_ops(const struct amdgpu_dm_kunit_ops *ops);
 
 struct dc_phy_addr_space_config;
+struct dc_plane_address;
 struct dc_plane_cap;
+struct dc_plane_info;
 
 void mmhub_read_system_context(struct amdgpu_device *adev,
 			       struct dc_phy_addr_space_config *pa_config);
 int amdgpu_dm_init_power_module(struct amdgpu_display_manager *dm);
 int dm_early_init(struct amdgpu_ip_block *ip_block);
+int fill_dc_plane_info_and_addr(struct amdgpu_device *adev,
+				const struct drm_plane_state *plane_state,
+				struct dc_plane_info *plane_info,
+				struct dc_plane_address *address, bool tmz_surface);
 int load_dmcu_fw(struct amdgpu_device *adev);
 int dm_sw_init(struct amdgpu_ip_block *ip_block);
 int dm_late_init(struct amdgpu_ip_block *ip_block);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +246 -0

264 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#54 lore raw

PATCH 54/59 drm/amd/display: Test DC plane attributes

In reply to Alex Hung

[WHAT]
Add KUnit tests for fill_dc_plane_attributes(), covering the copy of the plane info into the DC plane state and the scaling, pixel format and 3D LUT rejection paths.

[HOW]
Reuse the plane info fixture and add a CRTC state complete enough for the colour management update. A scaling factor of 1 in the plane caps means no scaling, which matches the 1:1 geometry of the fixture.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |   9 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   3 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 126 ++++++++++++++++++
 3 files changed, 134 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5 -4
index 8a87677b46b8..a97caf7e1d33 100644
@@ -3074,10 +3074,10 @@ fill_dc_plane_info_and_addr(struct amdgpu_device *adev,
 }
 EXPORT_IF_KUNIT(fill_dc_plane_info_and_addr);
 
-static int fill_dc_plane_attributes(struct amdgpu_device *adev,
-				    struct dc_plane_state *dc_plane_state,
-				    struct drm_plane_state *plane_state,
-				    struct drm_crtc_state *crtc_state)
+STATIC_IFN_KUNIT int fill_dc_plane_attributes(struct amdgpu_device *adev,
+					      struct dc_plane_state *dc_plane_state,
+					      struct drm_plane_state *plane_state,
+					      struct drm_crtc_state *crtc_state)
 {
 	struct dm_crtc_state *dm_crtc_state = to_dm_crtc_state(crtc_state);
 	struct amdgpu_framebuffer *afb = (struct amdgpu_framebuffer *)plane_state->fb;
@@ -3130,6 +3130,7 @@ static int fill_dc_plane_attributes(struct amdgpu_device *adev,
 
 	return 0;
 }
+EXPORT_IF_KUNIT(fill_dc_plane_attributes);
 
 static inline void fill_dc_dirty_rect(struct drm_plane *plane,
 				      struct rect *dirty_rect, int32_t x,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +3 -0
index 09ecca519b3b..b1db78e79015 100644
@@ -1268,6 +1268,9 @@ int amdgpu_dm_mode_config_init(struct amdgpu_device *adev);
 int initialize_plane(struct amdgpu_display_manager *dm, struct amdgpu_mode_info *mode_info,
 		     int plane_id, enum drm_plane_type plane_type,
 		     const struct dc_plane_cap *plane_cap);
+int fill_dc_plane_attributes(struct amdgpu_device *adev, struct dc_plane_state *dc_plane_state,
+			     struct drm_plane_state *plane_state,
+			     struct drm_crtc_state *crtc_state);
 #endif
 
 #endif /* __AMDGPU_DM_H__ */
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +126 -0

138 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#55 lore raw

PATCH 55/59 drm/amd/display: Test MST VCPI slot calc

In reply to Alex Hung

[WHAT]
Add KUnit tests for dm_update_mst_vcpi_slots_for_dsc(), covering an empty commit and the writeback, non-MST and unmatched stream skips.

[HOW]
The tests build a commit holding a single connector and vary its type and MST output port so every early-skip branch is reached without an MST topology or a matching DC stream.

Assisted-by Copilot:Claude-Opus-5 GPT-5.6-Sol
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |   7 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   3 +
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 109 ++++++++++++++++++
 3 files changed, 116 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -3
index a97caf7e1d33..e5c8f8a2ea3e 100644
@@ -3296,9 +3296,9 @@ STATIC_IFN_KUNIT void fill_dc_dirty_rects(struct drm_plane *plane,
 }
 EXPORT_IF_KUNIT(fill_dc_dirty_rects);
 
-static int dm_update_mst_vcpi_slots_for_dsc(struct drm_atomic_commit *state,
-					    struct dc_state *dc_state,
-					    struct dsc_mst_fairness_vars *vars)
+STATIC_IFN_KUNIT int dm_update_mst_vcpi_slots_for_dsc(struct drm_atomic_commit *state,
+						      struct dc_state *dc_state,
+						      struct dsc_mst_fairness_vars *vars)
 {
 	struct dc_stream_state *stream = NULL;
 	struct drm_connector *connector;
@@ -3372,6 +3372,7 @@ static int dm_update_mst_vcpi_slots_for_dsc(struct drm_atomic_commit *state,
 	}
 	return 0;
 }
+EXPORT_IF_KUNIT(dm_update_mst_vcpi_slots_for_dsc);
 
 static void manage_dm_interrupts(struct amdgpu_device *adev,
 				 struct amdgpu_crtc *acrtc,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +3 -0
index b1db78e79015..089741ba0619 100644
@@ -1252,6 +1252,7 @@ struct dc_phy_addr_space_config;
 struct dc_plane_address;
 struct dc_plane_cap;
 struct dc_plane_info;
+struct dsc_mst_fairness_vars;
 
 void mmhub_read_system_context(struct amdgpu_device *adev,
 			       struct dc_phy_addr_space_config *pa_config);
@@ -1261,6 +1262,8 @@ int fill_dc_plane_info_and_addr(struct amdgpu_device *adev,
 				const struct drm_plane_state *plane_state,
 				struct dc_plane_info *plane_info,
 				struct dc_plane_address *address, bool tmz_surface);
+int dm_update_mst_vcpi_slots_for_dsc(struct drm_atomic_commit *state, struct dc_state *dc_state,
+				     struct dsc_mst_fairness_vars *vars);
 int load_dmcu_fw(struct amdgpu_device *adev);
 int dm_sw_init(struct amdgpu_ip_block *ip_block);
 int dm_late_init(struct amdgpu_ip_block *ip_block);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +109 -0

127 lines not on this page · raw message

Signature · 1 line
2.43.0
author
#56 lore raw

PATCH 56/59 drm/amd/display: Fix backlight control for luminance-capable OLED

In reply to Alex Hung

From: Roman Li <[email protected]>

[WHY]
For some eDP panels VESA aux backlight control is necessary, otherwise they stay black.

[HOW]
When AUX backlight control is used, select BACKLIGHT_CONTROL_VESA_AUX for panels that advertise panel_luminance_control.

---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c   | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c +6 -2
index a5ad59ec3e81..45e1732a5b04 100644
@@ -543,8 +543,12 @@ void amdgpu_dm_update_connector_ext_caps(struct amdgpu_dm_connector *aconnector)
 	else if (!IS_ERR_OR_NULL(panel_backlight_quirk) &&
 		 panel_backlight_quirk->force_pwm)
 		caps->aux_support = false;
-	if (caps->aux_support)
-		aconnector->dc_link->backlight_control_type = BACKLIGHT_CONTROL_AMD_AUX;
+	if (caps->aux_support) {
+		if (aconnector->dc_link->dpcd_caps.panel_luminance_control)
+			aconnector->dc_link->backlight_control_type = BACKLIGHT_CONTROL_VESA_AUX;
+		else
+			aconnector->dc_link->backlight_control_type = BACKLIGHT_CONTROL_AMD_AUX;
+	}
 
 	luminance_range = &conn_base->display_info.luminance_range;
 
Signature · 1 line
2.43.0
author
#57 lore raw

PATCH 57/59 drm/amd/display: Apply debug bit for force p2cpm

In reply to Alex Hung

From: Roman Li <[email protected]>

[WHY]
To allow per panel control of PHY settings.

[HOW]
Add the quirk for specific panels.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +8 -0
index ab15ceec4daa..93fd5f251a6c 100644
@@ -131,6 +131,14 @@ STATIC_IFN_KUNIT void apply_edid_quirks(struct dc_link *link, struct edid *edid,
 		drm_dbg_driver(dev, "Disabling VSC on monitor with panel id %X\n", panel_id);
 		edid_caps->panel_patch.disable_colorimetry = true;
 		break;
+	case drm_edid_encode_panel_id('S', 'D', 'C', 0x4203):
+	case drm_edid_encode_panel_id('S', 'D', 'C', 0x4197):
+		if (dc_is_embedded_signal(link->connector_signal)) {
+			drm_dbg_driver(dev, "Force PHY power down/up level 2 on panel id %X\n",
+				       panel_id);
+			link->ctx->dc->debug.psr_phy_force_phy_power_down_up_level_2 = true;
+		}
+		break;
 	/* Workaround for monitors that get corrupted by the PHY SSC reduction */
 	case drm_edid_encode_panel_id('D', 'E', 'L', 0x4147):
 		drm_dbg_driver(dev, "Skip PHY SSC reduction on panel id %X\n", panel_id);
Signature · 1 line
2.43.0
author
#58 lore raw

PATCH 58/59 drm/amd/display: Restore the native cursor mode early return for disabled CRTCs

In reply to Alex Hung

From: Tom Chung <[email protected]>

[WHY]
commit c6417b87e7c3 ("drm/amd/display: Set native cursor mode for disabled CRTCs again") made amdgpu_dm_crtc_get_cursor_mode() report native mode for a disabled CRTC, by adding !dm_crtc_state->base.enable to the DCN4x IP version check that returned early.

commit b7d7e714de44 ("drm/amd/display: Fall back to overlay cursor on dcn4x when top plane doesn't fill CRTC") then replaced that early return with a skip_fmt_scale_restrictions flag, so dcn4x falls through to the coverage check instead. The disabled CRTC condition shared the same if statement and lost its early return as well. A disabled CRTC now reaches the coverage check and is given overlay mode whenever the top plane does not fill the CRTC, which can make an atomic commit that disables the CRTC fail.

[HOW]
Move the disabled CRTC check into its own early return ahead of the DCN4x IP version check, so it reports native mode on every ASIC.

Fixes b7d7e714de44 ("drm/amd/display: Fall back to overlay cursor on dcn4x when top plane doesn't fill CRTC")
---
 .../amd/display/amdgpu_dm/amdgpu_dm_cursor.c    | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_cursor.c +11 -6
index c41fce07b8fa..8204ad4018e6 100644
@@ -287,19 +287,24 @@ int amdgpu_dm_crtc_get_cursor_mode(struct amdgpu_device *adev,
 	int i;
 	bool skip_fmt_scale_restrictions = false;
 
-	/* Overlay cursor not supported on HW before DCN
-	 * DCN401/420 does not have the cursor-on-scaled-plane or cursor-on-yuv-plane restrictions
-	 * as previous DCN generations, so enable native mode on DCN401/420
-	 *
+	/*
 	 * Always set native cursor mode when the CRTC is disabled,
 	 * to make sure it doesn't cause atomic commits to fail when
 	 * they are trying to disable the CRTC.
 	 */
+	if (!crtc_state->enable) {
+		*cursor_mode = DM_CURSOR_NATIVE_MODE;
+		return 0;
+	}
+
+	/* Overlay cursor not supported on HW before DCN
+	 * DCN401/420 does not have the cursor-on-scaled-plane or cursor-on-yuv-plane restrictions
+	 * 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, 1) ||
-	    amdgpu_ip_version(adev, DCE_HWIP, 0) == IP_VERSION(6, 0, 0) ||
-	    !dm_crtc_state->base.enable) {
+	    amdgpu_ip_version(adev, DCE_HWIP, 0) == IP_VERSION(6, 0, 0)) {
 		/*
 		 * Newer DCN has no cursor-on-scaled/yuv-plane restriction, so
 		 * skip those overlay triggers below. A plane that does not fill
Signature · 1 line
2.43.0
author
#59 lore raw

PATCH 59/59 drm/amd/display: Promote DC to 3.2.396

In reply to Alex Hung

From: Taimur Hassan <[email protected]>

This version brings along the following updates:

- Move the DML wrapper out of DML2 into its own component.
- Expand amdgpu_dm KUnit coverage across DM init, teardown and IRQs.
- Add KUnit tests to cover amdgpu_dm_* modules
- Remove fixpt and custom float duplicated code.
- Move custom float structures from opp.h to custom_float.h.
- Fix the DPP PRE_GAM register offset on DCN60.
- Update HDMI link rate and DSC handling for DCN60.
- Fix DCN5/6 DML2 compilation warnings.
- Fix order of operation in CalculateFlipSchedule.
- Clean up the per-DPM struct.
- Remove the const qualifier from non-pointer fields.
- Model ASSERT as a path terminator.
- Set the gpuvm min page size to 4K on dcn35/36.
- Fix backlight control for luminance-capable OLED panels.
- Restore the native cursor mode early return for disabled CRTCs.
- Move cursor SDR white level calculation out of the hwss executor.
- Avoid a NULL hubp deref for the remaining mpcc_id assignment.
- Guard DAL port idle optimizations by ASIC revision.
- Change RBBMIF timeout control conditions.
- Re-enable multi-dwb support.
- Remove the pipe_ctx param from MPC_VISUAL_CONFIRM.
- Add a debug bit for force p2cpm.
- Add a max_downscale_src_width debugfs for IGT validation.

---
 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 c7d5d60ff4c6..e1f1b0602b6d 100644
@@ -66,7 +66,7 @@ struct dcn_dsc_reg_state;
 struct dcn_optc_reg_state;
 struct dcn_dccg_reg_state;
 
-#define DC_VER "3.2.395"
+#define DC_VER "3.2.396"
 
 /**
  * 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
#60 lore raw
In reply to Alex Hung

Public

Hi all,

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

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

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

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

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

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

The patchset consists of the amd-staging-drm-next branch (Head commit - 75a5e1b6b3661c3f946885d01eebeb6b031035ef drm/amdkfd: guard against NULL restore_mqd in CRIU queue restore) with new patches added on top of it.

Tested on Ubuntu 26.04, on Gnome Wayland.

Thank you,

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

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

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

* Move the DML wrapper into its own component.
* Fix DCN5/6 DML2 compilation warnings.
* Fix DCN60 DPP PRE_GAM offset, HDMI link rate and DSC handling.
* Fix backlight control for luminance-capable OLED.
* Restore native cursor mode early return for disabled CRTCs.
* Fix NULL hubp deref and CalculateFlipSchedule ordering.
* Remove duplicated fixpt and custom float code.
* Drop pipe_ctx param from MPC_VISUAL_CONFIRM.
* Move cursor SDR white level calc out of the hwss executor.
* Set gpuvm min page size to 4K on DCN35/36.
* Update RBBMIF timeout control conditions.
* Guard DAL port idle optimizations by ASIC rev.
* Re-enable multi-dwb support and clean up per-DPM struct.
* Add max_downscale_src_width debugfs for IGT validation.
* Expand amdgpu_dm KUnit coverage.

Cc Dan Wheeler <[email protected]>

Alex Hung (34):
drm/amd/display: Test ISM idle commit drm/amd/display: Test ISM idle exit arms drm/amd/display: Test ISM delayed workers drm/amd/display: Test colorop error paths drm/amd/display: Model ASSERT as path terminator drm/amd/display: Test backlight caps validation drm/amd/display: Skip ACPI backlight caps test drm/amd/display: Test vblank counter and scanout position drm/amd/display: Test DM atomic private state helpers drm/amd/display: Test affected MST DSC CRTC selection drm/amd/display: Test cursor commit drm/amd/display: Test vblank event arming drm/amd/display: Test page flip interrupt state update drm/amd/display: Test CRTC memory domain change detection drm/amd/display: Test PSR dirty rectangle filling drm/amd/display: Test plane reset decision drm/amd/display: Test link and sink dump drm/amd/display: Test HDCP update drm/amd/display: Test global modeset lock acquisition drm/amd/display: Test timing sync trigger drm/amd/display: Test IP block teardown and link emulation drm/amd/display: Test mod_power stream updates on modeset drm/amd/display: Test atomic commit setup drm/amd/display: Test MMHUB config read drm/amd/display: Test power module init drm/amd/display: Test vline0 irq control drm/amd/display: Test DMCU firmware load drm/amd/display: Test SW init and fini drm/amd/display: Test DM late init drm/amd/display: Test mode and plane init drm/amd/display: Test DM early init drm/amd/display: Test DC plane info fill drm/amd/display: Test DC plane attributes drm/amd/display: Test MST VCPI slot calc

Alvin Lee (1):
drm/amd/display: Fix DPP PRE_GAM register offset on DCN60

Austin Zheng (5):
drm/amd/display: Preparations To Move DML Wrapper Out Of DML drm/amd/display: Clean up Per-DPM Struct drm/amd/display: Fix Order Of Operation In Calculate Flip Schedule drm/amd/display: Remove const Qualifier From Non-Pointer Fields drm/amd/display: Move DML Wrapper into its own Component

Dillon Varone (3):
drm/amd/display: Guard DAL port idle optimizations by ASIC rev drm/amd/display: Re-enable multi-dwb support drm/amd/display: Change RBBMIF timeout control conditions

Hansen Dsouza (1):
drm/amd/display: Add debug bit for force p2cpm

Ivan Lipski (1):
drm/amd/display: Fix DCN5/6 DML2 compilation warnings

James Lin (1):
drm/amd/display: Avoid NULL hubp deref for remaining mpcc_id
assignment

Peichen Huang (1):
drm/amd/display: Do not use panel_inst in pr

Relja Vojvodic (1):
drm/amd/display: Update HDMI link rate and DSC handling for DCN60

Roman Li (3):
drm/amd/display: Set gpuvm min page size to 4K on dcn35/36 drm/amd/display: Fix backlight control for luminance-capable OLED drm/amd/display: Apply debug bit for force p2cpm

Samson Tam (3):
drm/amd/display: Move custom float structures from opp.h to
custom_float.h
drm/amd/display: Remove fixpt and custom float duplicated code drm/amd/display: Remove internal references

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

Tom Chung (1):
drm/amd/display: Restore the native cursor mode early return for
disabled CRTCs

Tomasz Siemek (2):
drm/amd/display: Move cursor SDR white level calculation out of hwss
executor
drm/amd/display: Remove pipe_ctx param from MPC_VISUAL_CONFIRM

Tony Qi (1):
drm/amd/display: Add max_downscale_src_width debugfs for IGT
validation

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  187 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   77 +
 .../display/amdgpu_dm/amdgpu_dm_backlight.c   |   41 +-
 .../display/amdgpu_dm/amdgpu_dm_backlight.h   |    1 +
 .../amd/display/amdgpu_dm/amdgpu_dm_colorop.c |  110 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_colorop.h |   28 +
 .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c    |   40 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_crtc.h    |    1 +
 .../amd/display/amdgpu_dm/amdgpu_dm_cursor.c  |   17 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c |   20 +
 .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c |    8 +
 .../tests/amdgpu_dm_backlight_test.c          |   53 +-
 .../amdgpu_dm/tests/amdgpu_dm_colorop_test.c  |  232 +-
 .../amdgpu_dm/tests/amdgpu_dm_crtc_test.c     |  101 +
 .../amdgpu_dm/tests/amdgpu_dm_ism_test.c      |  367 +-
 .../display/amdgpu_dm/tests/amdgpu_dm_test.c  | 3552 +++++++++++++++++
 drivers/gpu/drm/amd/display/dc/Makefile       |    1 +
 .../display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c  |    3 +
 drivers/gpu/drm/amd/display/dc/core/dc.c      |    5 +-
 .../drm/amd/display/dc/core/dc_hw_sequencer.c |   75 +-
 .../drm/amd/display/dc/core/dc_link_exports.c |    3 +-
 .../gpu/drm/amd/display/dc/core/dc_resource.c |    2 +-
 .../gpu/drm/amd/display/dc/core/dc_state.c    |    4 +-
 drivers/gpu/drm/amd/display/dc/dc.h           |    5 +-
 drivers/gpu/drm/amd/display/dc/dc_types.h     |    3 +-
 .../drm/amd/display/dc/dml/dcn30/dcn30_fpu.c  |   18 +-
 .../drm/amd/display/dc/dml/dml1_frl_cap_chk.c |    8 +-
 .../gpu/drm/amd/display/dc/dml2_0/Makefile    |   13 +-
 .../display/dc/dml2_0/dml21/dml21_wrapper.h   |  106 -
 .../dml21/inc/dml_top_soc_parameter_types.h   |   32 +-
 .../dml2_core/dml2_core_dcn5_calcs_dchub.c    |    8 +-
 .../dml2_core_dcn5_funcs_mode_programming.c   |    4 +-
 .../dml2_core_dcn5_funcs_mode_support.c       |    5 -
 .../dml2_core/dml2_core_dcn6_calcs_dchub.c    |    4 +-
 .../dml2_core_dcn6_funcs_mode_support.c       |    4 -
 .../src/dml2_core/dml2_core_shared_types.h    |    4 +-
 .../dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c |    2 +-
 .../drm/amd/display/dc/dml2_wrapper/Makefile  |   61 +
 .../dml21_wrapper}/dml21_translation_helper.c |   15 +-
 .../dml21_wrapper}/dml21_translation_helper.h |    7 +-
 .../dml21_wrapper}/dml21_utils.c              |   11 +-
 .../dml21_wrapper}/dml21_utils.h              |    7 +-
 .../dml21_wrapper}/dml21_wrapper.c            |    2 +-
 .../dml21_wrapper/dml21_wrapper.h             |  107 +
 .../dml21_wrapper}/dml21_wrapper_fpu.c        |   19 +-
 .../dml21_wrapper}/dml21_wrapper_fpu.h        |    7 +-
 .../dml2_dc_resource_mgmt.c                   |   60 +-
 .../dml2_dc_resource_mgmt.h                   |    0
 .../{dml2_0 => dml2_wrapper}/dml2_dc_types.h  |    0
 .../dml2_internal_types.h                     |    2 +-
 .../dml2_mall_phantom.c                       |   70 +-
 .../dml2_mall_phantom.h                       |    0
 .../dc/{dml2_0 => dml2_wrapper}/dml2_policy.c |    2 +-
 .../dc/{dml2_0 => dml2_wrapper}/dml2_policy.h |    0
 .../dml2_translation_helper.c                 |   21 +-
 .../dml2_translation_helper.h                 |    0
 .../dc/{dml2_0 => dml2_wrapper}/dml2_utils.c  |   28 +-
 .../dc/{dml2_0 => dml2_wrapper}/dml2_utils.h  |    0
 .../{dml2_0 => dml2_wrapper}/dml2_wrapper.c   |    6 +-
 .../{dml2_0 => dml2_wrapper}/dml2_wrapper.h   |    0
 .../dml2_wrapper_fpu.c                        |   45 +-
 .../dml2_wrapper_fpu.h                        |    0
 .../drm/amd/display/dc/dpp/dcn50/dcn50_dpp.h  |   11 +-
 .../drm/amd/display/dc/dpp/dcn60/dcn60_dpp.h  |    7 +-
 drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c   |    8 +
 .../drm/amd/display/dc/dsc/dcn60/dcn60_dsc.c  |    4 +-
 .../hpo/dcn60/dcn60_hpo_frl_stream_encoder.c  |  131 +-
 .../amd/display/dc/hubp/dcn21/dcn21_hubp.c    |    6 +-
 .../amd/display/dc/hubp/dcn21/dcn21_hubp.h    |    2 +-
 .../amd/display/dc/hubp/dcn30/dcn30_hubp.c    |    2 +-
 .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c   |   26 +-
 .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c   |    4 -
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c |    3 +-
 .../amd/display/dc/hwss/dcn50/dcn50_hwseq.c   |    3 +-
 .../drm/amd/display/dc/hwss/hw_sequencer.h    |   11 +-
 .../gpu/drm/amd/display/dc/inc/custom_float.h |   21 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/opp.h   |   14 +-
 .../gpu/drm/amd/display/dc/inc/link_service.h |    2 +-
 .../drm/amd/display/dc/link/link_detection.c  |    2 +
 .../drm/amd/display/dc/link/link_factory.c    |    2 +-
 .../dc/link/protocols/link_dp_panel_replay.c  |   36 +-
 .../dc/link/protocols/link_dp_panel_replay.h  |    2 +-
 .../link/protocols/link_edp_panel_control.c   |   47 +-
 drivers/gpu/drm/amd/display/dc/os_types.h     |   18 +
 .../dc/resource/dcn32/dcn32_resource.c        |    2 +-
 .../dc/resource/dcn35/dcn35_resource.c        |    2 +-
 .../dc/resource/dcn351/dcn351_resource.c      |    2 +-
 .../dc/resource/dcn36/dcn36_resource.c        |    2 +-
 .../dc/resource/dcn401/dcn401_resource.c      |    2 +-
 .../dc/resource/dcn42/dcn42_resource.c        |    2 +-
 .../dc/resource/dcn42b/dcn42b_resource.c      |    2 +-
 .../dc/resource/dcn60/dcn60_resource.c        |    4 +-
 drivers/gpu/drm/amd/display/dc/sspl/Makefile  |    5 +-
 drivers/gpu/drm/amd/display/dc/sspl/dc_spl.c  |  130 +-
 .../display/dc/sspl/dc_spl_isharp_filters.c   |   10 +-
 .../display/dc/sspl/dc_spl_scl_easf_filters.c |   88 +-
 .../amd/display/dc/sspl/dc_spl_scl_filters.c  |   24 +-
 .../drm/amd/display/dc/sspl/dc_spl_types.h    |   60 +-
 .../amd/display/dc/sspl/spl_custom_float.c    |  152 -
 .../amd/display/dc/sspl/spl_custom_float.h    |   29 -
 .../drm/amd/display/dc/sspl/spl_fixpt31_32.c  |  495 ---  .../drm/amd/display/dc/sspl/spl_fixpt31_32.h  |  526 ---
 .../drm/amd/display/dc/sspl/spl_namespace.h   |   17 +
 .../drm/amd/display/dc/sspl/spl_os_types.h    |   43 +-
 104 files changed, 5459 insertions(+), 2114 deletions(-)  delete mode 100644 drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_wrapper.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/dml2_wrapper/Makefile
 rename drivers/gpu/drm/amd/display/dc/{dml2_0/dml21 => dml2_wrapper/dml21_wrapper}/dml21_translation_helper.c (99%)  rename drivers/gpu/drm/amd/display/dc/{dml2_0/dml21 => dml2_wrapper/dml21_wrapper}/dml21_translation_helper.h (94%)  rename drivers/gpu/drm/amd/display/dc/{dml2_0/dml21 => dml2_wrapper/dml21_wrapper}/dml21_utils.c (99%)  rename drivers/gpu/drm/amd/display/dc/{dml2_0/dml21 => dml2_wrapper/dml21_wrapper}/dml21_utils.h (96%)  rename drivers/gpu/drm/amd/display/dc/{dml2_0/dml21 => dml2_wrapper/dml21_wrapper}/dml21_wrapper.c (100%)  create mode 100644 drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml21_wrapper/dml21_wrapper.h
 rename drivers/gpu/drm/amd/display/dc/{dml2_0/dml21 => dml2_wrapper/dml21_wrapper}/dml21_wrapper_fpu.c (96%)  rename drivers/gpu/drm/amd/display/dc/{dml2_0/dml21 => dml2_wrapper/dml21_wrapper}/dml21_wrapper_fpu.h (95%)  rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_dc_resource_mgmt.c (96%)  rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_dc_resource_mgmt.h (100%)  rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_dc_types.h (100%)  rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_internal_types.h (99%)  rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_mall_phantom.c (97%)  rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_mall_phantom.h (100%)  rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_policy.c (99%)  rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_policy.h (100%)  rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_translation_helper.c (99%)  rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_translation_helper.h (100%)  rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_utils.c (98%)  rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_utils.h (100%)  rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_wrapper.c (97%)  rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_wrapper.h (100%)  rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_wrapper_fpu.c (93%)  rename drivers/gpu/drm/amd/display/dc/{dml2_0 => dml2_wrapper}/dml2_wrapper_fpu.h (100%)  delete mode 100644 drivers/gpu/drm/amd/display/dc/sspl/spl_custom_float.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/sspl/spl_custom_float.h
 delete mode 100644 drivers/gpu/drm/amd/display/dc/sspl/spl_fixpt31_32.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/sspl/spl_fixpt31_32.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/sspl/spl_namespace.h

--
2.43.0