DC Patches for September 16, 2026
cover DC Patches for September 16, 2026
This DC patchset brings improvements in multiple areas. In summary, we have:
- Increased KUnit coverage
- Reverts a patch causing regression on DCN42
- Fixes for cursor
- Imporvements for ABM
Alex Hung (33):
drm/amd/display: Select KUnit helpers drm/amd/display: Fold blending tests into two cases drm/amd/display: Fold universal overlay format test drm/amd/display: Fold plane modifier list tests drm/amd/display: Fold modifier append tests drm/amd/display: Fold GFX9 tiling info tests drm/amd/display: Fold GFX6-8 tiling and modifier tests drm/amd/display: Fold DCC validation tests drm/amd/display: Fold DCC block mode tests drm/amd/display: Fold plane scaling and cursor tests drm/amd/display: Fold plane state check tests drm/amd/display: Fix amdgpu_dm's kernel-doc warnings drm/amd/display: Test EDID helper paths drm/amd/display: Test AUX transfer paths drm/amd/display: Test MST topology start drm/amd/display: Test unassigned OTG CRTC lookup drm/amd/display: Test VRR pageflip completion drm/amd/display: Test HPD RX offload work branches drm/amd/display: Test HDMI HPD debounce re-detect drm/amd/display: Test HPD handler HDCP and detect drm/amd/display: Test HPD RX downstream handling drm/amd/display: Drop redundant amdgpu_dm_irq tests drm/amd/display: Fix KUnit connector warnings drm/amd/display: Fix KUnit CRTC warnings drm/amd/display: Fix KUnit cursor warning drm/amd/display: Fix KUnit VRR warnings drm/amd/display: Fix KUnit helper warnings drm/amd/display: Fix KUnit IRQ warnings drm/amd/display: Fix KUnit MST warnings drm/amd/display: Fix KUnit DM warnings drm/amd/display: Fix KUnit writeback warnings drm/amd/display: Fix KUnit checkpatch warnings drm/amd/display: Fix LSDMA divide by zero
Alvin Lee (3):
drm/amd/display: Enable double buffering for DSCCLK updates drm/amd/display: Wait response should be based on fw_based_mclk_switch drm/amd/display: Re-enable P-State message to SMU
Austin Zheng (1):
drm/amd/display: Add Back Unified CalculateFlipSchedule
Dillon Varone (1):
drm/amd/display: Add more diagnostic logs for DMU
Fangzhi Zuo (1):
drm/amd/display: Restore FreeSync VCP code check for HDMI/PCON sinks
Huang, Leon (1):
drm/amd/display: Forward periodic ABM keep-alive scenario to DMU
Ivan Lipski (3):
drm/amd/display: Expose 3 overlay planes on DCN6 drm/amd/display: Remove DCN6 DCFCLK num assert drm/amd/display: Resync cursor cache after offload abort on DCN60
Matthew Stewart (1):
drm/amd/display: Fix DCN42B plane alpha
Nicholas Kazlauskas (1):
drm/amd/display: Fix missing gaps for link lock with inbox0
Piotr Maziarz (5):
drm/amd/display: Refactor DPP_PROGRAM_UPSP to drop pipe_ctx drm/amd/display: Remove phantom SW state ops from block sequence drm/amd/display: fix cursor refactor fallout and sync UT headers drm/amd/display: clamp cursor hotspot at the register write drm/amd/display: Rename build_cursor_position to
dcn10_build_cursor_pos_update_params
Rafal Ostrowski (2):
drm/amd/display: Drop pipe_ctx from hwss block sequence operations drm/amd/display: refactor hwss SET_CURSOR_POSITION block sequence
Taimur Hassan (2):
drm/amd/display: [FW Promotion] Release 0.1.76.0 drm/amd/display: Promote DC to 3.2.399
Tony Cheng (9):
drm/amd/display: add SPDX-License-Identifier drm/amd/display: Add inst field to struct hubbub drm/amd/display: Add inst field to struct clk_mgr drm/amd/display: Add inst field to struct abm drm/amd/display: Add inst field to struct dmub_psr drm/amd/display: Add inst field to struct dmub_replay drm/amd/display: Add inst field to struct pg_cntl drm/amd/display: Add inst field to encoder structs drm/amd/display: Add inst field to clock_source and dio
Tony Qi (1):
drm/amd/display: Revert "request DMUB HW cursor offload"
drivers/gpu/drm/amd/display/Kconfig | 3 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 - .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 7 +- .../display/amdgpu_dm/amdgpu_dm_connector.c | 6 + .../drm/amd/display/amdgpu_dm/amdgpu_dm_irq.h | 9 + .../display/amdgpu_dm/amdgpu_dm_mst_types.h | 2 +- .../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 1 + .../amd/display/amdgpu_dm/tests/.kunitconfig | 1 - .../tests/amdgpu_dm_connector_test.c | 64 +- .../amdgpu_dm/tests/amdgpu_dm_crtc_test.c | 50 +- .../amdgpu_dm/tests/amdgpu_dm_cursor_test.c | 4 + .../amdgpu_dm/tests/amdgpu_dm_freesync_test.c | 22 + .../amdgpu_dm/tests/amdgpu_dm_helpers_test.c | 250 ++ .../amdgpu_dm/tests/amdgpu_dm_irq_test.c | 1066 +++++---- .../tests/amdgpu_dm_mst_types_test.c | 9 + .../amdgpu_dm/tests/amdgpu_dm_plane_test.c | 2036 +++++------------ .../amdgpu_dm/tests/amdgpu_dm_services_test.c | 2 +- .../display/amdgpu_dm/tests/amdgpu_dm_test.c | 43 +- .../amdgpu_dm/tests/amdgpu_dm_wb_test.c | 4 + .../dc/clk_mgr/dcn401/dcn401_clk_mgr.c | 1 + .../display/dc/clk_mgr/dcn42/dcn42_clk_mgr.c | 7 +- .../dc/clk_mgr/dcn42b/dcn42b_clk_mgr.c | 3 +- .../drm/amd/display/dc/clk_mgr/dcn60/dalsmc.h | 3 +- .../display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c | 4 +- .../dc/clk_mgr/dcn60/dcn60_clk_mgr_smu_msg.c | 36 +- drivers/gpu/drm/amd/display/dc/core/dc.c | 4 +- .../drm/amd/display/dc/core/dc_hw_sequencer.c | 301 +-- .../gpu/drm/amd/display/dc/core/dc_resource.c | 6 +- .../gpu/drm/amd/display/dc/core/dc_stream.c | 23 +- drivers/gpu/drm/amd/display/dc/dc.h | 2 +- drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 134 +- drivers/gpu/drm/amd/display/dc/dc_hw_types.h | 3 + drivers/gpu/drm/amd/display/dc/dc_types.h | 2 + .../amd/display/dc/dccg/dcn20/dcn20_dccg.h | 4 + .../amd/display/dc/dccg/dcn60/dcn60_dccg.c | 4 + .../amd/display/dc/dccg/dcn60/dcn60_dccg.h | 4 + drivers/gpu/drm/amd/display/dc/dce/dce_abm.c | 2 + .../drm/amd/display/dc/dce/dce_clock_source.c | 5 +- drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c | 1 + .../drm/amd/display/dc/dce/dmub_hw_lock_mgr.c | 10 +- drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c | 1 + drivers/gpu/drm/amd/display/dc/dce/dmub_psr.h | 1 + .../gpu/drm/amd/display/dc/dce/dmub_replay.c | 3 +- .../gpu/drm/amd/display/dc/dce/dmub_replay.h | 1 + .../amd/display/dc/dcn301/dcn301_panel_cntl.c | 1 + .../amd/display/dc/dcn31/dcn31_panel_cntl.c | 1 + .../drm/amd/display/dc/dio/dcn10/dcn10_dio.c | 1 + .../display/dc/dio/dcn10/dcn10_link_encoder.c | 2 + .../dc/dio/dcn10/dcn10_stream_encoder.c | 2 + .../display/dc/dio/dcn20/dcn20_link_encoder.c | 2 + .../dc/dio/dcn20/dcn20_stream_encoder.c | 2 + .../dc/dio/dcn30/dcn30_dio_link_encoder.c | 2 + .../dc/dio/dcn30/dcn30_dio_stream_encoder.c | 2 + .../dc/dio/dcn301/dcn301_dio_link_encoder.c | 2 + .../dc/dio/dcn31/dcn31_dio_link_encoder.c | 2 + .../dc/dio/dcn314/dcn314_dio_stream_encoder.c | 2 + .../dc/dio/dcn32/dcn32_dio_link_encoder.c | 2 + .../dc/dio/dcn32/dcn32_dio_stream_encoder.c | 2 + .../dc/dio/dcn321/dcn321_dio_link_encoder.c | 2 + .../dc/dio/dcn35/dcn35_dio_link_encoder.c | 2 + .../dc/dio/dcn35/dcn35_dio_stream_encoder.c | 2 + .../dc/dio/dcn401/dcn401_dio_link_encoder.c | 2 + .../dc/dio/dcn401/dcn401_dio_stream_encoder.c | 1 + .../dc/dio/dcn42/dcn42_dio_link_encoder.c | 2 + .../dc/dio/dcn42/dcn42_dio_stream_encoder.c | 2 + .../dc/dio/dcn60/dcn60_dio_link_encoder.c | 2 + .../dc/dio/dcn60/dcn60_dio_stream_encoder.c | 2 + .../dc/dio/virtual/virtual_link_encoder.c | 3 + .../dc/dio/virtual/virtual_stream_encoder.c | 1 + .../dml21/inc/bounding_boxes/dcn4_soc_bb.h | 2 +- .../src/dml2_core/dml2_core_dcn4_calcs.c | 164 +- .../src/dml2_core/dml2_core_shared_types.h | 3 + .../alternate_pstate_shared_lib.c | 22 +- .../dml2_utm_soc_bb/dml2_utm_soc_bb_dcn6.c | 2 - .../amd/display/dc/dpp/dcn401/dcn401_dpp.h | 2 + .../amd/display/dc/dpp/dcn401/dcn401_dpp_cm.c | 19 + .../drm/amd/display/dc/dpp/dcn60/dcn60_dpp.c | 1 + .../hpo/dcn30/dcn30_hpo_frl_stream_encoder.c | 2 + .../dcn401/dcn401_hpo_frl_stream_encoder.c | 2 + .../hpo/dcn42/dcn42_hpo_frl_stream_encoder.c | 2 + .../hpo/dcn60/dcn60_hpo_frl_stream_encoder.c | 2 + .../display/dc/hubbub/dcn10/dcn10_hubbub.c | 2 + .../display/dc/hubbub/dcn20/dcn20_hubbub.c | 2 + .../display/dc/hubbub/dcn201/dcn201_hubbub.c | 2 + .../display/dc/hubbub/dcn21/dcn21_hubbub.c | 2 + .../display/dc/hubbub/dcn30/dcn30_hubbub.c | 2 + .../display/dc/hubbub/dcn301/dcn301_hubbub.c | 2 + .../display/dc/hubbub/dcn31/dcn31_hubbub.c | 1 + .../display/dc/hubbub/dcn32/dcn32_hubbub.c | 2 + .../display/dc/hubbub/dcn35/dcn35_hubbub.c | 2 + .../display/dc/hubbub/dcn401/dcn401_hubbub.c | 2 + .../display/dc/hubbub/dcn42/dcn42_hubbub.c | 2 + .../display/dc/hubbub/dcn60/dcn60_hubbub.c | 2 + .../amd/display/dc/hubp/dcn31/dcn31_hubp.c | 1 + .../amd/display/dc/hubp/dcn401/dcn401_hubp.c | 105 +- .../amd/display/dc/hubp/dcn401/dcn401_hubp.h | 2 + .../amd/display/dc/hubp/dcn60/dcn60_hubp.c | 1 + .../amd/display/dc/hwss/dce110/dce110_hwseq.c | 2 +- .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 20 +- .../amd/display/dc/hwss/dcn10/dcn10_hwseq.h | 7 +- .../amd/display/dc/hwss/dcn10/dcn10_init.c | 1 + .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 14 +- .../amd/display/dc/hwss/dcn20/dcn20_hwseq.h | 3 +- .../amd/display/dc/hwss/dcn20/dcn20_init.c | 1 + .../amd/display/dc/hwss/dcn201/dcn201_init.c | 1 + .../amd/display/dc/hwss/dcn21/dcn21_init.c | 1 + .../amd/display/dc/hwss/dcn30/dcn30_init.c | 1 + .../amd/display/dc/hwss/dcn301/dcn301_init.c | 1 + .../amd/display/dc/hwss/dcn31/dcn31_init.c | 1 + .../amd/display/dc/hwss/dcn314/dcn314_init.c | 1 + .../amd/display/dc/hwss/dcn32/dcn32_init.c | 1 + .../amd/display/dc/hwss/dcn35/dcn35_hwseq.c | 11 + .../amd/display/dc/hwss/dcn35/dcn35_init.c | 1 + .../amd/display/dc/hwss/dcn351/dcn351_init.c | 1 + .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 71 +- .../amd/display/dc/hwss/dcn401/dcn401_hwseq.h | 7 +- .../amd/display/dc/hwss/dcn401/dcn401_init.c | 1 + .../amd/display/dc/hwss/dcn42/dcn42_init.c | 1 + .../amd/display/dc/hwss/dcn50/dcn50_hwseq.c | 6 +- .../amd/display/dc/hwss/dcn60/dcn60_init.c | 1 + .../drm/amd/display/dc/hwss/hw_sequencer.h | 75 +- .../display/dc/hwss/hw_sequencer_private.h | 3 + .../gpu/drm/amd/display/dc/inc/clock_source.h | 2 + drivers/gpu/drm/amd/display/dc/inc/hw/abm.h | 1 + .../gpu/drm/amd/display/dc/inc/hw/clk_mgr.h | 1 + .../gpu/drm/amd/display/dc/inc/hw/dchubbub.h | 1 + drivers/gpu/drm/amd/display/dc/inc/hw/dio.h | 1 + drivers/gpu/drm/amd/display/dc/inc/hw/dpp.h | 2 + drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h | 2 + .../drm/amd/display/dc/inc/hw/link_encoder.h | 1 + .../gpu/drm/amd/display/dc/inc/hw/pg_cntl.h | 1 + .../amd/display/dc/inc/hw/stream_encoder.h | 2 + drivers/gpu/drm/amd/display/dc/inc/resource.h | 2 +- .../amd/display/dc/pg/dcn35/dcn35_pg_cntl.c | 1 + .../amd/display/dc/pg/dcn42/dcn42_pg_cntl.c | 1 + .../dc/resource/dcn60/dcn60_resource.c | 6 +- drivers/gpu/drm/amd/display/dmub/dmub_srv.h | 58 +- .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 53 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn20.c | 84 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn20.h | 2 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn31.c | 94 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn31.h | 2 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn32.c | 94 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn32.h | 2 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn35.c | 94 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn35.h | 2 +- .../drm/amd/display/dmub/src/dmub_dcn401.c | 98 +- .../drm/amd/display/dmub/src/dmub_dcn401.h | 2 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn42.c | 98 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn42.h | 2 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn60.c | 98 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn60.h | 2 +- .../gpu/drm/amd/display/dmub/src/dmub_srv.c | 54 +- 153 files changed, 2963 insertions(+), 2688 deletions(-)
--
2.55.0
PATCH 1/64 drm/amd/display: Forward periodic ABM keep-alive scenario to DMU
From: "Huang, Leon" <[email protected]>
[Why & How]
1. The periodic ABM full-frame update for VESA PR is now owned by the DMU timer.
2. In PR_update_state, compute whether the current scenario allows the periodic keep-alive (not CTS, not front-buffer rendering, not force-full-frame, content actively updating) and forward it via the abm_periodic_ffu_allowed runtime flag only when it changes.
--- drivers/gpu/drm/amd/display/dc/dc_types.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/dc_types.h +2 -0
@@ -1309,6 +1309,8 @@ struct replay_settings {uint16_t frame_skip_number;/* Current Panel Replay events */ uint32_t replay_events; +/* Last ABM periodic keep-alive FFU allowed bit sent to DMUB (VESA PR) */ +bool last_abm_periodic_ffu_allowed; };/* To split out "global" and "per-panel" config settings.
Signature · 1 line
2.55.0
PATCH 2/64 drm/amd/display: Expose 3 overlay planes on DCN6
In reply to George ZhangFrom: Ivan Lipski <[email protected]>
[Why&How]
DCN6 has 4 pipes, so we should be able to use 3 overlay + 1 primary plane.
--- .../gpu/drm/amd/display/dc/resource/dcn60/dcn60_resource.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/resource/dcn60/dcn60_resource.c +3 -3
@@ -2038,9 +2038,9 @@ static bool dcn60_resource_construct( dc->caps.cache_line_size =64 ; dc->caps.cache_num_ways =16 ; - dc->caps.max_slave_planes =2 ; - dc->caps.max_slave_yuv_planes =2 ; - dc->caps.max_slave_rgb_planes =2 ; + dc->caps.max_slave_planes =3 ; + dc->caps.max_slave_yuv_planes =3 ; + dc->caps.max_slave_rgb_planes =3 ; dc->caps.post_blend_color_processing = true; dc->caps.force_dp_tps4_for_cp2520 = true; dc->caps.hdmi_hpo = true;
Signature · 1 line
2.55.0
PATCH 3/64 drm/amd/display: add SPDX-License-Identifier
In reply to George ZhangFrom: Tony Cheng <[email protected]>
Add the AMD Open-Source SPDX line to dc files.
--- drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c | 1 + drivers/gpu/drm/amd/display/dc/dcn301/dcn301_panel_cntl.c | 1 + drivers/gpu/drm/amd/display/dc/dcn31/dcn31_panel_cntl.c | 1 + drivers/gpu/drm/amd/display/dc/hubp/dcn31/dcn31_hubp.c | 1 + drivers/gpu/drm/amd/display/dc/inc/clock_source.h | 1 + 5 files changed, 5 insertions(+)
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c +1 -0
@@ -1,3 +1,4 @@ +// SPDX-License-Identifier: MIT /* * Copyright 2012-15 Advanced Micro Devices, Inc. *
drivers/gpu/drm/amd/display/dc/dcn301/dcn301_panel_cntl.c +1 -0
@@ -1,3 +1,4 @@ +// SPDX-License-Identifier: MIT /* * Copyright 2020 Advanced Micro Devices, Inc. *
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_panel_cntl.c +1 -0
@@ -1,3 +1,4 @@ +// SPDX-License-Identifier: MIT /* * Copyright 2021 Advanced Micro Devices, Inc. *
drivers/gpu/drm/amd/display/dc/hubp/dcn31/dcn31_hubp.c +1 -0
@@ -1,3 +1,4 @@ +// SPDX-License-Identifier: MIT /* * Copyright 2012-20 Advanced Micro Devices, Inc. *
drivers/gpu/drm/amd/display/dc/inc/clock_source.h +1 -0
@@ -1,3 +1,4 @@ +// SPDX-License-Identifier: MIT /* * Copyright 2012-15 Advanced Micro Devices, Inc. *
Signature · 1 line
2.55.0
PATCH 4/64 drm/amd/display: Add inst field to struct hubbub
In reply to George ZhangFrom: Tony Cheng <[email protected]>
Add an inst member and initialize it to 0 in every hubbub*_construct() from DCN10 through DCN60.
No functional change.
--- drivers/gpu/drm/amd/display/dc/hubbub/dcn10/dcn10_hubbub.c | 2 ++ drivers/gpu/drm/amd/display/dc/hubbub/dcn20/dcn20_hubbub.c | 2 ++ drivers/gpu/drm/amd/display/dc/hubbub/dcn201/dcn201_hubbub.c | 2 ++ drivers/gpu/drm/amd/display/dc/hubbub/dcn21/dcn21_hubbub.c | 2 ++ drivers/gpu/drm/amd/display/dc/hubbub/dcn30/dcn30_hubbub.c | 2 ++ drivers/gpu/drm/amd/display/dc/hubbub/dcn301/dcn301_hubbub.c | 2 ++ drivers/gpu/drm/amd/display/dc/hubbub/dcn31/dcn31_hubbub.c | 1 + drivers/gpu/drm/amd/display/dc/hubbub/dcn32/dcn32_hubbub.c | 2 ++ drivers/gpu/drm/amd/display/dc/hubbub/dcn35/dcn35_hubbub.c | 2 ++ drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c | 2 ++ drivers/gpu/drm/amd/display/dc/hubbub/dcn42/dcn42_hubbub.c | 2 ++ drivers/gpu/drm/amd/display/dc/hubbub/dcn60/dcn60_hubbub.c | 2 ++ drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h | 1 + 13 files changed, 24 insertions(+)
drivers/gpu/drm/amd/display/dc/hubbub/dcn10/dcn10_hubbub.c +2 -0
@@ -933,6 +933,8 @@ void hubbub1_construct(struct hubbub *hubbub, hubbub1->base.ctx = ctx; + hubbub1->base.inst =0 ; + hubbub1->base.funcs = &hubbub1_funcs; hubbub1->regs = hubbub_regs;
drivers/gpu/drm/amd/display/dc/hubbub/dcn20/dcn20_hubbub.c +2 -0
@@ -680,6 +680,8 @@ void hubbub2_construct(struct dcn20_hubbub *hubbub, { hubbub->base.ctx = ctx; + hubbub->base.inst =0 ; + hubbub->base.funcs = &hubbub2_funcs; hubbub->regs = hubbub_regs;
drivers/gpu/drm/amd/display/dc/hubbub/dcn201/dcn201_hubbub.c +2 -0
@@ -96,6 +96,8 @@ void hubbub201_construct(struct dcn20_hubbub *hubbub, { hubbub->base.ctx = ctx; + hubbub->base.inst =0 ; + hubbub->base.funcs = &hubbub201_funcs; hubbub->regs = hubbub_regs;
drivers/gpu/drm/amd/display/dc/hubbub/dcn21/dcn21_hubbub.c +2 -0
@@ -712,6 +712,8 @@ void hubbub21_construct(struct dcn20_hubbub *hubbub, { hubbub->base.ctx = ctx; + hubbub->base.inst =0 ; + hubbub->base.funcs = &hubbub21_funcs; hubbub->regs = hubbub_regs;
drivers/gpu/drm/amd/display/dc/hubbub/dcn30/dcn30_hubbub.c +2 -0
@@ -478,6 +478,8 @@ void hubbub3_construct(struct dcn20_hubbub *hubbub3, const struct dcn_hubbub_mask *hubbub_mask) { hubbub3->base.ctx = ctx; + + hubbub3->base.inst =0 ; hubbub3->base.funcs = &hubbub30_funcs; hubbub3->regs = hubbub_regs; hubbub3->shifts = hubbub_shift;
drivers/gpu/drm/amd/display/dc/hubbub/dcn301/dcn301_hubbub.c +2 -0
@@ -74,6 +74,8 @@ void hubbub301_construct(struct dcn20_hubbub *hubbub3, const struct dcn_hubbub_mask *hubbub_mask) { hubbub3->base.ctx = ctx; + + hubbub3->base.inst =0 ; hubbub3->base.funcs = &hubbub301_funcs; hubbub3->regs = hubbub_regs; hubbub3->shifts = hubbub_shift;
drivers/gpu/drm/amd/display/dc/hubbub/dcn31/dcn31_hubbub.c +1 -0
@@ -1080,6 +1080,7 @@ void hubbub31_construct(struct dcn20_hubbub *hubbub31, int pixel_chunk_size_kb, int config_return_buffer_size_kb) { + hubbub31->base.inst =0 ;hubbub3_construct (hubbub31, ctx, hubbub_regs, hubbub_shift, hubbub_mask); hubbub31->base.funcs = &hubbub31_funcs;
drivers/gpu/drm/amd/display/dc/hubbub/dcn32/dcn32_hubbub.c +2 -0
@@ -1050,6 +1050,8 @@ void hubbub32_construct(struct dcn20_hubbub *hubbub2, int config_return_buffer_size_kb) { hubbub2->base.ctx = ctx; + + hubbub2->base.inst =0 ; hubbub2->base.funcs = &hubbub32_funcs; hubbub2->regs = hubbub_regs; hubbub2->shifts = hubbub_shift;
drivers/gpu/drm/amd/display/dc/hubbub/dcn35/dcn35_hubbub.c +2 -0
@@ -655,6 +655,8 @@ void hubbub35_construct(struct dcn20_hubbub *hubbub2, int config_return_buffer_size_kb) { hubbub2->base.ctx = ctx; + + hubbub2->base.inst =0 ; hubbub2->base.funcs = &hubbub35_funcs; hubbub2->regs = hubbub_regs; hubbub2->shifts = hubbub_shift;
drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c +2 -0
@@ -1264,6 +1264,8 @@ void hubbub401_construct(struct dcn20_hubbub *hubbub2, int config_return_buffer_size_kb) { hubbub2->base.ctx = ctx; + + hubbub2->base.inst =0 ; hubbub2->base.funcs = &hubbub4_01_funcs; hubbub2->regs = hubbub_regs; hubbub2->shifts = hubbub_shift;
drivers/gpu/drm/amd/display/dc/hubbub/dcn42/dcn42_hubbub.c +2 -0
@@ -555,6 +555,8 @@ void hubbub42_construct(struct dcn20_hubbub *hubbub2, int config_return_buffer_size_kb) { hubbub2->base.ctx = ctx; + + hubbub2->base.inst =0 ; hubbub2->base.funcs = &hubbub42_funcs; hubbub2->regs = hubbub_regs; hubbub2->shifts = hubbub_shift;
drivers/gpu/drm/amd/display/dc/hubbub/dcn60/dcn60_hubbub.c +2 -0
@@ -1982,6 +1982,8 @@ void hubbub60_construct(struct dcn20_hubbub *hubbub2, int config_return_buffer_size_kb) { hubbub2->base.ctx = ctx; + + hubbub2->base.inst =0 ; hubbub2->base.funcs = &hubbub60_funcs; hubbub2->regs = hubbub_regs; hubbub2->shifts = hubbub_shift;
drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h +1 -0
@@ -301,6 +301,7 @@ struct hubbub_funcs {struct hubbub {const struct hubbub_funcs *funcs;struct dc_context *ctx; +int inst;bool riommu_active; };
Signature · 1 line
2.55.0
PATCH 5/64 drm/amd/display: Enable double buffering for DSCCLK updates
In reply to George ZhangFrom: Alvin Lee <[email protected]>
[Description]
Double buffering needs to be enabled for DSCCLK updates otherwise a frame of underflow could occur when updating the DSC pipe config or DSC clock.
--- drivers/gpu/drm/amd/display/dc/dccg/dcn20/dcn20_dccg.h | 4 ++++ drivers/gpu/drm/amd/display/dc/dccg/dcn60/dcn60_dccg.c | 4 ++++ drivers/gpu/drm/amd/display/dc/dccg/dcn60/dcn60_dccg.h | 4 ++++ 3 files changed, 12 insertions(+)
drivers/gpu/drm/amd/display/dc/dccg/dcn20/dcn20_dccg.h +4 -0
@@ -256,6 +256,10 @@type DSCCLK1_EN ;\type DSCCLK2_EN ;\type DSCCLK3_EN ;\ +type DSCCLK0_DTO_DB_EN ;\ +type DSCCLK1_DTO_DB_EN ;\ +type DSCCLK2_DTO_DB_EN ;\ +type DSCCLK3_DTO_DB_EN ;\type DISPCLK_DCCG_GATE_DISABLE ;\type DCCG_GLOBAL_FGCG_REP_DIS ; \type PHYASYMCLK_EN ;\
drivers/gpu/drm/amd/display/dc/dccg/dcn60/dcn60_dccg.c +4 -0
@@ -76,6 +76,7 @@ static void dccg60_set_dto_dscclk(struct dccg *dccg, uint32_t inst,switch (inst) {case 0 : +REG_UPDATE (DSCCLK_DTO_CTRL ,DSCCLK0_DTO_DB_EN ,1 );REG_UPDATE_2 (DSCCLK0_DTO_PARAM ,DSCCLK0_DTO_PHASE ,1 ,DSCCLK0_DTO_MODULO ,1 );REG_UPDATE (DSCCLK_DTO_CTRL ,DSCCLK0_EN ,1 );
@@ -92,6 +93,7 @@ static void dccg60_set_dto_dscclk(struct dccg *dccg, uint32_t inst,break ;case 1 : +REG_UPDATE (DSCCLK_DTO_CTRL ,DSCCLK1_DTO_DB_EN ,1 );REG_UPDATE_2 (DSCCLK1_DTO_PARAM ,DSCCLK1_DTO_PHASE ,1 ,DSCCLK1_DTO_MODULO ,1 );REG_UPDATE (DSCCLK_DTO_CTRL ,DSCCLK1_EN ,1 );
@@ -103,6 +105,7 @@ static void dccg60_set_dto_dscclk(struct dccg *dccg, uint32_t inst,break ;case 2 : +REG_UPDATE (DSCCLK_DTO_CTRL ,DSCCLK2_DTO_DB_EN ,1 );REG_UPDATE_2 (DSCCLK2_DTO_PARAM ,DSCCLK2_DTO_PHASE ,1 ,DSCCLK2_DTO_MODULO ,1 );REG_UPDATE (DSCCLK_DTO_CTRL ,DSCCLK2_EN ,1 );
@@ -114,6 +117,7 @@ static void dccg60_set_dto_dscclk(struct dccg *dccg, uint32_t inst,break ;case 3 : +REG_UPDATE (DSCCLK_DTO_CTRL ,DSCCLK3_DTO_DB_EN ,1 );REG_UPDATE_2 (DSCCLK3_DTO_PARAM ,DSCCLK3_DTO_PHASE ,1 ,DSCCLK3_DTO_MODULO ,1 );REG_UPDATE (DSCCLK_DTO_CTRL ,DSCCLK3_EN ,1 );
drivers/gpu/drm/amd/display/dc/dccg/dcn60/dcn60_dccg.h +4 -0
@@ -96,6 +96,10 @@DCCG_SF (DSCCLK_DTO_CTRL ,DSCCLK1_EN , mask_sh),\DCCG_SF (DSCCLK_DTO_CTRL ,DSCCLK2_EN , mask_sh),\DCCG_SF (DSCCLK_DTO_CTRL ,DSCCLK3_EN , mask_sh),\ +DCCG_SF (DSCCLK_DTO_CTRL ,DSCCLK0_DTO_DB_EN , mask_sh),\ +DCCG_SF (DSCCLK_DTO_CTRL ,DSCCLK1_DTO_DB_EN , mask_sh),\ +DCCG_SF (DSCCLK_DTO_CTRL ,DSCCLK2_DTO_DB_EN , mask_sh),\ +DCCG_SF (DSCCLK_DTO_CTRL ,DSCCLK3_DTO_DB_EN , mask_sh),\DCCG_SF (DSCCLK0_DTO_PARAM ,DSCCLK0_DTO_PHASE , mask_sh),\DCCG_SF (DSCCLK0_DTO_PARAM ,DSCCLK0_DTO_MODULO , mask_sh),\ DCCG_SF(DSCCLK1_DTO_PARAM, DSCCLK1_DTO_PHASE, mask_sh),\
Signature · 1 line
2.55.0
PATCH 6/64 drm/amd/display: Add inst field to struct clk_mgr
In reply to George ZhangFrom: Tony Cheng <[email protected]>
Add an inst member to struct clk_mgr and set it to 0 in the DCN401, DCN42, DCN42B and DCN60 construct paths, since clk_mgr is a singleton on all of them.
No functional change; the field has no readers yet.
--- .../gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c | 1 + .../gpu/drm/amd/display/dc/clk_mgr/dcn42/dcn42_clk_mgr.c | 7 ++++--- .../gpu/drm/amd/display/dc/clk_mgr/dcn42b/dcn42b_clk_mgr.c | 3 ++- .../gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c | 1 + drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr.h | 1 + 5 files changed, 9 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c +1 -0
@@ -1632,6 +1632,7 @@ struct clk_mgr_internal *dcn401_clk_mgr_construct( clk_mgr = &clk_mgr401->base; clk_mgr->base.ctx = ctx; + clk_mgr->base.inst =0 ; clk_mgr->base.funcs = &dcn401_funcs; clk_mgr->regs = &clk_mgr_regs_dcn401; clk_mgr->clk_mgr_shift = &clk_mgr_shift_dcn401;
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn42/dcn42_clk_mgr.c +4 -3
@@ -392,7 +392,7 @@ void dcn42_notify_cstate_disable(struct clk_mgr *clk_mgr_base, bool disable)struct clk_mgr_internal *clk_mgr =TO_CLK_MGR_INTERNAL (clk_mgr_base);bool target_allow = !disable; -DC_LOGGER_INIT (clk_mgr_base->ctx->logger); +DC_LOGGER_INIT (clk_mgr_base->ctx->logger);/* Idempotent: only send when the cached vote actually changes. */ if (clk_mgr_base->clks.cstate_allow == target_allow)
@@ -619,7 +619,7 @@ void dcn42_init_clocks(struct clk_mgr *clk_mgr_base)struct clk_mgr_internal *clk_mgr_int =TO_CLK_MGR_INTERNAL (clk_mgr_base);struct clk_mgr_dcn42 *clk_mgr =TO_CLK_MGR_DCN42 (clk_mgr_int); -DC_LOGGER_INIT (clk_mgr_base->ctx->logger); +DC_LOGGER_INIT (clk_mgr_base->ctx->logger); (void )dc_logger;init_clk_states (clk_mgr_base);
@@ -814,7 +814,7 @@ void dcn42_set_low_power_state(struct clk_mgr *clk_mgr_base)void dcn42_exit_low_power_state (struct clk_mgr *clk_mgr_base) { - (void )clk_mgr_base; +(void )clk_mgr_base; }
@@ -1115,6 +1115,7 @@ void dcn42_clk_mgr_construct( struct dccg *dccg) { clk_mgr->base.base.ctx = ctx; + clk_mgr->base.base.inst =0 ; clk_mgr->base.base.funcs = &dcn42_funcs; clk_mgr->base.regs = &clk_mgr_regs_dcn42; clk_mgr->base.clk_mgr_shift = &clk_mgr_shift_dcn42;
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn42b/dcn42b_clk_mgr.c +2 -1
@@ -228,7 +228,7 @@ void dcn42b_init_clocks(struct clk_mgr *clk_mgr_base)struct clk_mgr_internal *clk_mgr_int =TO_CLK_MGR_INTERNAL (clk_mgr_base);struct clk_mgr_dcn42 *clk_mgr =TO_CLK_MGR_DCN42B (clk_mgr_int); -DC_LOGGER_INIT (clk_mgr_base->ctx->logger); +DC_LOGGER_INIT (clk_mgr_base->ctx->logger); (void )dc_logger;init_clk_states (clk_mgr_base);
@@ -619,6 +619,7 @@ void dcn42b_clk_mgr_construct( struct dccg *dccg) { clk_mgr->base.base.ctx = ctx; + clk_mgr->base.base.inst =0 ; clk_mgr->base.base.funcs = &dcn42b_funcs; clk_mgr->base.regs = &clk_mgr_regs_dcn42b; clk_mgr->base.clk_mgr_shift = &clk_mgr_shift_dcn42b;
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c +1 -0
@@ -1709,6 +1709,7 @@ struct clk_mgr_internal *dcn60_clk_mgr_construct( clk_mgr = &clk_mgr60->base; clk_mgr->base.ctx = ctx; + clk_mgr->base.inst =0 ; clk_mgr->base.funcs = &dcn60_funcs; clk_mgr->regs = &clk_mgr_regs_dcn60; clk_mgr->clk_mgr_shift = &clk_mgr_shift_dcn60;
drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr.h +1 -0
@@ -433,6 +433,7 @@ struct clk_mgr_funcs {struct clk_mgr {struct dc_context *ctx;struct clk_mgr_funcs *funcs; +int inst;struct dc_clocks clks;bool psr_allow_active_cache;bool force_smu_not_present;
Signature · 1 line
2.55.0
PATCH 7/64 drm/amd/display: Add Back Unified CalculateFlipSchedule
In reply to George ZhangFrom: Austin Zheng <[email protected]>
[Why]
CalculateFlipSchedule has slightly different calculations depending on if it was called by mode support or mode programming.
Mode support calculates the lower bound of the required bandwidth for immediate flips. This takes into the account of the register limits to ensure it is still programmable.
Mode programming uses the required bandwidth for immediate flips on a per-plane basis to calculate the number of dst_y lines needed to achieve this bandwidth.
Usually the immediate flip bandwidth per plane determined by mode programming is above the lower bound calculated by mode support. However, mode programming can fail if that isn't the case since a bandwidth lower than the lower bound will end up exceeding the register limit used by hardware. e.g. The proportion of a single plane's flip bandwidth w.r.t to the total bandwidth available for all planes can result in one of the planes having a lower BW than the lower bound calculated in mode support
[How]
Update function to always use the use_lb_flip_bw path. Add calculations for dst_y_per_vm/row_flip lines. Consolidate calculation of lb_flip_bw by having it consider register limits: Instead of doing two steps of: 1. Taking the max of the bandwidths without considering register limits. 2. Taking the max of itself with the bandwidths with register limits accounted for. Do it in one step as it is easy to miss either step 1 or 2.
Also add some local variables for intermediate values and remove no longer referenced inputs to improve readability.
Also increase DCN401 max_flip_time_lines by 2 lines to ensure previously supported configs remain supported as worst-case bandwidth can increase compared to before.
--- .../dml21/inc/bounding_boxes/dcn4_soc_bb.h | 2 +- .../src/dml2_core/dml2_core_dcn4_calcs.c | 164 +++++++----------- .../src/dml2_core/dml2_core_shared_types.h | 3 + 3 files changed, 66 insertions(+), 103 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/inc/bounding_boxes/dcn4_soc_bb.h +1 -1
@@ -342,7 +342,7 @@ static const struct dml2_ip_capabilities dml2_dcn401_max_ip_caps = { .compressed_buffer_segment_size_in_kbytes = 64, .cursor_buffer_size = 24, .max_flip_time_us = 80, - .max_flip_time_lines = 32, + .max_flip_time_lines = 34, .hostvm_mode = 0, .subvp_drr_scheduling_margin_us = 100, .subvp_prefetch_end_to_mall_start_us = 15,
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn4_calcs.c +62 -102
215 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_shared_types.h +3 -0
@@ -1659,6 +1659,9 @@ struct dml2_core_shared_CalculateFlipSchedule_locals {double num_rows;double hvm_scaled_row_bytes;double hvm_scaled_vm_row_bytes; +double vm_time_budget; +double row_time_budget; +double vm_and_row_time_budget;bool dual_plane; };
Signature · 1 line
2.55.0
PATCH 8/64 drm/amd/display: Add inst field to struct abm
In reply to George ZhangFrom: Tony Cheng <[email protected]>
Add an inst member to struct abm and set it to 0 in dce_abm_construct() and dmub_abm_construct(), since ABM is a singleton.
No functional change; the field has no readers yet.
--- drivers/gpu/drm/amd/display/dc/dce/dce_abm.c | 2 ++ drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c | 1 + drivers/gpu/drm/amd/display/dc/inc/hw/abm.h | 1 + 3 files changed, 4 insertions(+)
drivers/gpu/drm/amd/display/dc/dce/dce_abm.c +2 -0
@@ -220,6 +220,7 @@ static bool dce_abm_set_level(struct abm *abm, uint32_t level)static bool dce_abm_immediate_disable (struct abm *abm,uint32_t panel_inst) { +if (abm->dmcu_is_running == false)return true;
@@ -272,6 +273,7 @@ static void dce_abm_construct( base->ctx = ctx; base->funcs = &dce_funcs; base->dmcu_is_running = false; + base->inst =0 ; abm_dce->regs = regs; abm_dce->abm_shift = abm_shift;
drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c +1 -0
@@ -280,6 +280,7 @@ static void dmub_abm_construct( base->ctx = ctx; base->funcs = &abm_funcs; base->dmcu_is_running = false; + base->inst =0 ; abm_dce->regs = regs; abm_dce->abm_shift = abm_shift;
drivers/gpu/drm/amd/display/dc/inc/hw/abm.h +1 -0
@@ -33,6 +33,7 @@ struct abm {struct dc_context *ctx;const struct abm_funcs *funcs;bool dmcu_is_running; +unsigned int inst; };struct abm_funcs {
Signature · 1 line
2.55.0
PATCH 9/64 drm/amd/display: Add inst field to struct dmub_psr
In reply to George ZhangFrom: Tony Cheng <[email protected]>
Add an inst member to struct dmub_psr and set it to 0 in dmub_psr_construct(), since the PSR object is a pool singleton.
No functional change; the field has no readers yet.
--- drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c | 1 + drivers/gpu/drm/amd/display/dc/dce/dmub_psr.h | 1 + 2 files changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c +1 -0
@@ -481,6 +481,7 @@ static void dmub_psr_construct(struct dmub_psr *psr, struct dc_context *ctx) { psr->ctx = ctx; psr->funcs = &psr_funcs; + psr->inst =0 ; }/*
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.h +1 -0
@@ -34,6 +34,7 @@ struct dmub_psr_funcs;struct dmub_psr {struct dc_context *ctx;const struct dmub_psr_funcs *funcs; +uint32_t inst; };struct dmub_psr_funcs {
Signature · 1 line
2.55.0
PATCH 10/64 drm/amd/display: Add inst field to struct dmub_replay
In reply to George ZhangFrom: Tony Cheng <[email protected]>
Add an inst member to struct dmub_replay and set it to 0 in dmub_replay_construct(), since the replay object is a pool singleton.
Also move the (void)panel_inst cast in dmub_replay_set_coasting_vtotal() below the local declarations, where it belongs.
No functional change; the inst field has no readers yet.
--- drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c | 3 ++- drivers/gpu/drm/amd/display/dc/dce/dmub_replay.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c +2 -1
@@ -217,13 +217,13 @@ static void dmub_replay_set_coasting_vtotal(struct dmub_replay *dmub, uint8_t panel_inst, uint16_t frame_skip_number) { - (void)panel_inst;union dmub_rb_cmd cmd;struct dc_context *dc = dmub->ctx;struct dmub_rb_cmd_replay_set_coasting_vtotal *pCmd =NULL ; pCmd = &(cmd.replay_set_coasting_vtotal); + (void )panel_inst;memset (&cmd,0 ,sizeof (cmd)); pCmd->header.type =DMUB_CMD__REPLAY ; pCmd->header.sub_type =DMUB_CMD__REPLAY_SET_COASTING_VTOTAL ;
@@ -458,6 +458,7 @@ static void dmub_replay_construct(struct dmub_replay *replay, struct dc_context { replay->ctx = ctx; replay->funcs = &replay_funcs; + replay->inst =0 ; }/*
drivers/gpu/drm/amd/display/dc/dce/dmub_replay.h +1 -0
@@ -13,6 +13,7 @@ struct dmub_replay_funcs;struct dmub_replay {struct dc_context *ctx;const struct dmub_replay_funcs *funcs; +uint32_t inst; };struct dmub_replay_funcs {
Signature · 1 line
2.55.0
PATCH 11/64 drm/amd/display: Select KUnit helpers
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHAT]DRM_KUNIT_TEST_HELPERS has no prompt, so it can only be turned on by a select. DRM_AMD_DC_KUNIT_TEST merely depended on it, which forced the amdgpu_dm KUnit config to enable CONFIG_DRM_KUNIT_TEST as well and drag in the entire core DRM test suite.
[HOW]
Select DRM_KUNIT_TEST_HELPERS from DRM_AMD_DC_KUNIT_TEST, matching what DRM_KUNIT_TEST and DRM_TTM_KUNIT_TEST already do, and drop CONFIG_DRM_KUNIT_TEST from the amdgpu_dm kunitconfig. The amdgpu_dm tests now build standalone and a run executes only the amdgpu_dm suites.
--- drivers/gpu/drm/amd/display/Kconfig | 3 ++- drivers/gpu/drm/amd/display/amdgpu_dm/tests/.kunitconfig | 1 - 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/Kconfig +2 -1
@@ -67,7 +67,8 @@ config DRM_AMD_SECURE_DISPLAY config DRM_AMD_DC_KUNIT_TEST tristate "KUnit tests for the AMD DC display driver" if !KUNIT_ALL_TESTS - depends on DRM_AMD_DC && KUNIT && DEBUG_FS && DRM_KUNIT_TEST_HELPERS + depends on DRM_AMD_DC && KUNIT && DEBUG_FS + select DRM_KUNIT_TEST_HELPERS default KUNIT_ALL_TESTS help This option enables KUnit tests for the AMD Display Core driver.
drivers/gpu/drm/amd/display/amdgpu_dm/tests/.kunitconfig +0 -1
@@ -6,7 +6,6 @@ CONFIG_DRM_AMD_DC=y CONFIG_DEBUG_FS=y CONFIG_DRM_AMD_DC_KUNIT_TEST=y CONFIG_FW_LOADER=y -CONFIG_DRM_KUNIT_TEST=y CONFIG_DRM_KUNIT_TEST_HELPERS=y CONFIG_DRM_KMS_HELPER=y CONFIG_DRM_TTM=y
Signature · 1 line
2.55.0
PATCH 12/64 drm/amd/display: Fold blending tests into two cases
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHAT]
Reduce the five KUnit tests for amdgpu_dm_plane_fill_blending_from_plane_state() to two, keeping every covered path.
[HOW]
Turn the opaque, premultiplied and coverage cases into one table-driven test over the pixel blend mode, and fold the DCN 4.2 case into the global alpha test as a second table row selecting the DCE IP version.
--- .../amdgpu_dm/tests/amdgpu_dm_plane_test.c | 251 +++++++----------- 1 file changed, 89 insertions(+), 162 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +89 -162
@@ -117,142 +117,111 @@ static void dm_test_plane_is_video_format_known_video(struct kunit *test) }/** -* dm_test_fill_blending_defaults() - Verify default blending output values. +* dm_test_fill_blending_pixel_blend_modes() - Verify per-pixel blending modes. * @test: KUnit test context. * -* Verify if default blending output values are used for opaque alpha and no -* per-pixel blending. +* Verify if opaque alpha keeps the default outputs, and if the premultiplied +* and coverage modes enable per-pixel alpha for an alpha-capable format. */ -static void dm_test_fill_blending_defaults (struct kunit *test) -{ -struct drm_plane_state state = {0 }; -bool per_pixel_alpha; -bool pre_multiplied_alpha; -bool global_alpha; -int global_alpha_value; - - state.pixel_blend_mode =DRM_MODE_BLEND_PIXEL_NONE ; - state.alpha =0xffff ; - -amdgpu_dm_plane_fill_blending_from_plane_state (&state, - &per_pixel_alpha, - &pre_multiplied_alpha, - &global_alpha, - &global_alpha_value); - -KUNIT_EXPECT_FALSE (test, per_pixel_alpha); -KUNIT_EXPECT_TRUE (test, pre_multiplied_alpha); -KUNIT_EXPECT_FALSE (test, global_alpha); -KUNIT_EXPECT_EQ (test, global_alpha_value,0xff ); -} - -/** -* dm_test_fill_blending_premulti_alpha_format() - Verify premultiplied alpha path. -* @test: KUnit test context. -* -* Verify if premultiplied mode enables per-pixel alpha for ARGB8888. -*/ -static void dm_test_fill_blending_premulti_alpha_format (struct kunit *test) -{ -struct drm_plane_state state = {0 }; -struct drm_framebuffer fb = {0 }; -bool per_pixel_alpha; -bool pre_multiplied_alpha; -bool global_alpha; -int global_alpha_value; - - fb.format =drm_format_info (DRM_FORMAT_ARGB8888 ); -KUNIT_ASSERT_NOT_NULL (test, fb.format); - - state.fb = &fb; - state.pixel_blend_mode =DRM_MODE_BLEND_PREMULTI ; - state.alpha =0xffff ; - -amdgpu_dm_plane_fill_blending_from_plane_state (&state, - &per_pixel_alpha, - &pre_multiplied_alpha, - &global_alpha, - &global_alpha_value); - -KUNIT_EXPECT_TRUE (test, per_pixel_alpha); -KUNIT_EXPECT_TRUE (test, pre_multiplied_alpha); -KUNIT_EXPECT_FALSE (test, global_alpha); -KUNIT_EXPECT_EQ (test, global_alpha_value,0xff ); -} - -/** -* dm_test_fill_blending_coverage_alpha_format() - Verify coverage mode behavior. -* @test: KUnit test context. -* -* Verify if coverage mode sets per-pixel alpha and disables -* pre_multiplied_alpha for ARGB8888. -*/ -static void dm_test_fill_blending_coverage_alpha_format (struct kunit *test) -{ -struct drm_plane_state state = {0 }; +static void dm_test_fill_blending_pixel_blend_modes (struct kunit *test) +{ +static const struct { +const char *name; +unsigned int blend_mode; +bool with_fb; +bool per_pixel_alpha; +bool pre_multiplied_alpha; + } cases[] = { + {"defaults" ,DRM_MODE_BLEND_PIXEL_NONE , false, false, true }, + {"premultiplied" ,DRM_MODE_BLEND_PREMULTI , true, true, true }, + {"coverage" ,DRM_MODE_BLEND_COVERAGE , true, true, false }, + };struct drm_framebuffer fb = {0 }; -bool per_pixel_alpha; -bool pre_multiplied_alpha; -bool global_alpha; -int global_alpha_value; +unsigned int i; fb.format =drm_format_info (DRM_FORMAT_ARGB8888 );KUNIT_ASSERT_NOT_NULL (test, fb.format); - state.fb = &fb; - state.pixel_blend_mode =DRM_MODE_BLEND_COVERAGE ; - state.alpha =0xffff ; - -amdgpu_dm_plane_fill_blending_from_plane_state (&state, - &per_pixel_alpha, - &pre_multiplied_alpha, - &global_alpha, - &global_alpha_value); - -KUNIT_EXPECT_TRUE (test, per_pixel_alpha); -KUNIT_EXPECT_FALSE (test, pre_multiplied_alpha); -KUNIT_EXPECT_FALSE (test, global_alpha); -KUNIT_EXPECT_EQ (test, global_alpha_value,0xff ); +for (i =0 ; i <ARRAY_SIZE (cases); i++) { +struct drm_plane_state state = {0 }; +bool per_pixel_alpha; +bool pre_multiplied_alpha; +bool global_alpha; +int global_alpha_value; + +if (cases[i].with_fb) + state.fb = &fb; + state.pixel_blend_mode = cases[i].blend_mode; + state.alpha =0xffff ; + +amdgpu_dm_plane_fill_blending_from_plane_state (&state, + &per_pixel_alpha, + &pre_multiplied_alpha, + &global_alpha, + &global_alpha_value); + +KUNIT_EXPECT_EQ_MSG (test, per_pixel_alpha, cases[i].per_pixel_alpha, +"%s" , cases[i].name); +KUNIT_EXPECT_EQ_MSG (test, pre_multiplied_alpha, cases[i].pre_multiplied_alpha, +"%s" , cases[i].name); +KUNIT_EXPECT_FALSE_MSG (test, global_alpha,"%s" , cases[i].name); +KUNIT_EXPECT_EQ_MSG (test, global_alpha_value,0xff ,"%s" , cases[i].name); + } }/** -* dm_test_fill_blending_global_alpha() - Verify global alpha conversion to 8 bits. +* dm_test_fill_blending_global_alpha() - Verify global alpha down-scaling. * @test: KUnit test context. * -* Verify if global alpha is enabled and converted from 16-bit to 8-bit. +* Verify if global alpha is enabled and the 16-bit DRM alpha is scaled down to +* the 8-bit hardware field, or to the 12-bit field used by DCN 4.2. */ static void dm_test_fill_blending_global_alpha (struct kunit *test) { -struct amdgpu_device *adev; -struct drm_plane *plane; -struct drm_plane_state *state; -bool per_pixel_alpha; -bool pre_multiplied_alpha; -bool global_alpha; -int global_alpha_value; - - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); - plane =kunit_kzalloc (test,sizeof (*plane),GFP_KERNEL ); - state =kunit_kzalloc (test,sizeof (*state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, adev); -KUNIT_ASSERT_NOT_NULL (test, plane); -KUNIT_ASSERT_NOT_NULL (test, state); +static const struct { +const char *name; +u32 dce_version; +int expected; + } cases[] = { + {"8-bit field" ,IP_VERSION (4 ,0 ,0 ),0x80 }, + {"DCN 4.2 12-bit field" ,IP_VERSION (4 ,2 ,0 ),0x800 }, + }; +unsigned int i; - plane->dev = &adev->ddev; - state->plane = plane; - state->pixel_blend_mode =DRM_MODE_BLEND_PIXEL_NONE ; - state->alpha =0x8000 ; - -amdgpu_dm_plane_fill_blending_from_plane_state (state, - &per_pixel_alpha, - &pre_multiplied_alpha, - &global_alpha, - &global_alpha_value); - -KUNIT_EXPECT_FALSE (test, per_pixel_alpha); -KUNIT_EXPECT_TRUE (test, pre_multiplied_alpha); -KUNIT_EXPECT_TRUE (test, global_alpha); -KUNIT_EXPECT_EQ (test, global_alpha_value,0x80 ); +for (i =0 ; i <ARRAY_SIZE (cases); i++) { +struct amdgpu_device *adev; +struct drm_plane *plane; +struct drm_plane_state *state; +bool per_pixel_alpha; +bool pre_multiplied_alpha; +bool global_alpha; +int global_alpha_value; + + adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); + plane =kunit_kzalloc (test,sizeof (*plane),GFP_KERNEL ); + state =kunit_kzalloc (test,sizeof (*state),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, adev); +KUNIT_ASSERT_NOT_NULL (test, plane); +KUNIT_ASSERT_NOT_NULL (test, state); + + adev->ip_versions[DCE_HWIP ][0 ] = cases[i].dce_version; + plane->dev = &adev->ddev; + state->plane = plane; + state->pixel_blend_mode =DRM_MODE_BLEND_PIXEL_NONE ; + state->alpha =0x8000 ; + +amdgpu_dm_plane_fill_blending_from_plane_state (state, + &per_pixel_alpha, + &pre_multiplied_alpha, + &global_alpha, + &global_alpha_value); + +KUNIT_EXPECT_FALSE_MSG (test, per_pixel_alpha,"%s" , cases[i].name); +KUNIT_EXPECT_TRUE_MSG (test, pre_multiplied_alpha,"%s" , cases[i].name); +KUNIT_EXPECT_TRUE_MSG (test, global_alpha,"%s" , cases[i].name); +KUNIT_EXPECT_EQ_MSG (test, global_alpha_value, cases[i].expected, +"%s" , cases[i].name); + } }/**
@@ -1157,45 +1126,6 @@ static void dm_test_get_format_info(struct kunit *test)KUNIT_EXPECT_NOT_NULL (test, format_info); } -/** -* dm_test_fill_blending_global_alpha_dcn42() - Verify DCN 4.2 alpha scaling. -* @test: KUnit test context. -* -* Verify if DCN 4.2 scales the 16-bit DRM alpha down by 4 bits instead of 8. -*/ -static void dm_test_fill_blending_global_alpha_dcn42 (struct kunit *test) -{ -struct amdgpu_device *adev; -struct drm_plane *plane; -struct drm_plane_state *state; -bool per_pixel_alpha; -bool pre_multiplied_alpha; -bool global_alpha; -int global_alpha_value; - - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); - plane =kunit_kzalloc (test,sizeof (*plane),GFP_KERNEL ); - state =kunit_kzalloc (test,sizeof (*state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, adev); -KUNIT_ASSERT_NOT_NULL (test, plane); -KUNIT_ASSERT_NOT_NULL (test, state); - - adev->ip_versions[DCE_HWIP ][0 ] =IP_VERSION (4 ,2 ,0 ); - plane->dev = &adev->ddev; - state->plane = plane; - state->pixel_blend_mode =DRM_MODE_BLEND_PIXEL_NONE ; - state->alpha =0x8000 ; - -amdgpu_dm_plane_fill_blending_from_plane_state (state, - &per_pixel_alpha, - &pre_multiplied_alpha, - &global_alpha, - &global_alpha_value); - -KUNIT_EXPECT_TRUE (test, global_alpha); -KUNIT_EXPECT_EQ (test, global_alpha_value,0x800 ); -} -/* Modifier lists are terminated by DRM_FORMAT_MOD_INVALID, which is not counted. */ static int dm_test_mods_count (const u64 *mods) {
@@ -4031,11 +3961,8 @@ static struct kunit_case amdgpu_dm_plane_test_cases[] = {/* amdgpu_dm_plane_get_format_info() */ KUNIT_CASE (dm_test_get_format_info),/* amdgpu_dm_plane_fill_blending_from_plane_state() */ -KUNIT_CASE (dm_test_fill_blending_defaults), -KUNIT_CASE (dm_test_fill_blending_premulti_alpha_format), -KUNIT_CASE (dm_test_fill_blending_coverage_alpha_format), +KUNIT_CASE (dm_test_fill_blending_pixel_blend_modes),KUNIT_CASE (dm_test_fill_blending_global_alpha), -KUNIT_CASE (dm_test_fill_blending_global_alpha_dcn42),/* amdgpu_dm_plane_modifier_* helpers() */ KUNIT_CASE (dm_test_modifier_has_dcc), KUNIT_CASE(dm_test_modifier_gfx9_swizzle_mode),
Signature · 1 line
2.55.0
PATCH 13/64 drm/amd/display: Fold universal overlay format test
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHAT]
Reduce the two KUnit tests for amdgpu_dm_plane_get_plane_formats() to one.
[HOW]
Allocate a second plane cap with the DCN universal type in the existing test and check the overlay format count against it, then drop the standalone test.
--- .../amdgpu_dm/tests/amdgpu_dm_plane_test.c | 39 ++++++------------- 1 file changed, 11 insertions(+), 28 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +11 -28
@@ -258,18 +258,23 @@ static void dm_test_modifier_gfx9_swizzle_mode(struct kunit *test)* dm_test_get_plane_formats() - Verify plane format counts for key plane types. * @test: KUnit test context. * -* Verify if returned format counts match primary, overlay, and cursor planes. +* Verify if returned format counts match primary, overlay, and cursor planes, +* and if an overlay with a DCN universal plane cap reports the RGB list +* instead of the overlay-only list. */ static void dm_test_get_plane_formats (struct kunit *test) {struct drm_plane *plane;struct dc_plane_cap *cap; +struct dc_plane_cap *universal_cap;uint32_t formats[32 ] = {0 }; plane =kunit_kzalloc (test,sizeof (*plane),GFP_KERNEL ); cap =kunit_kzalloc (test,sizeof (*cap),GFP_KERNEL ); + universal_cap =kunit_kzalloc (test,sizeof (*universal_cap),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, plane);KUNIT_ASSERT_NOT_NULL (test, cap); +KUNIT_ASSERT_NOT_NULL (test, universal_cap); plane->type =DRM_PLANE_TYPE_PRIMARY ;KUNIT_EXPECT_EQ (test,amdgpu_dm_plane_get_plane_formats (plane,NULL , formats,32 ),14 );
@@ -282,6 +287,11 @@ static void dm_test_get_plane_formats(struct kunit *test) plane->type =DRM_PLANE_TYPE_OVERLAY ;KUNIT_EXPECT_EQ (test,amdgpu_dm_plane_get_plane_formats (plane,NULL , formats,32 ),9 ); + universal_cap->type =DC_PLANE_TYPE_DCN_UNIVERSAL ; +KUNIT_EXPECT_EQ (test, +amdgpu_dm_plane_get_plane_formats (plane, universal_cap, formats,32 ), +14 ); + plane->type =DRM_PLANE_TYPE_CURSOR ;KUNIT_EXPECT_EQ (test,amdgpu_dm_plane_get_plane_formats (plane,NULL , formats,32 ),1 ); }
@@ -1307,32 +1317,6 @@ static u64 dm_test_gfx11_dcc_4k_modifier(u32 pipe_xor_bits, u32 pkrs, u32 tile)AMD_FMT_MOD_SET (DCC_MAX_COMPRESSED_BLOCK ,AMD_FMT_MOD_DCC_BLOCK_64B ); } -/** -* dm_test_get_plane_formats_overlay_universal_cap() - Verify universal overlay. -* @test: KUnit test context. -* -* Verify if an overlay plane with a DCN universal plane cap reports the RGB -* format list instead of the overlay-only list. -*/ -static void dm_test_get_plane_formats_overlay_universal_cap (struct kunit *test) -{ -struct drm_plane *plane; -struct dc_plane_cap *cap; -u32 formats[32 ] = {0 }; - - plane =kunit_kzalloc (test,sizeof (*plane),GFP_KERNEL ); - cap =kunit_kzalloc (test,sizeof (*cap),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, plane); -KUNIT_ASSERT_NOT_NULL (test, cap); - - plane->type =DRM_PLANE_TYPE_OVERLAY ; - cap->type =DC_PLANE_TYPE_DCN_UNIVERSAL ; - -KUNIT_EXPECT_EQ (test, -amdgpu_dm_plane_get_plane_formats (plane, cap, formats,32 ), -14 ); -} -/** * dm_test_get_plane_modifiers_gfx9() - Verify GFX9 modifier list generation. * @test: KUnit test context.
@@ -3968,7 +3952,6 @@ static struct kunit_case amdgpu_dm_plane_test_cases[] = {KUNIT_CASE (dm_test_modifier_gfx9_swizzle_mode),/* amdgpu_dm_plane_get_plane_formats() */ KUNIT_CASE (dm_test_get_plane_formats), -KUNIT_CASE (dm_test_get_plane_formats_overlay_universal_cap),/* amdgpu_dm_plane_get_plane_modifiers() */ KUNIT_CASE (dm_test_get_plane_modifiers), KUNIT_CASE(dm_test_get_plane_modifiers_gfx6),
Signature · 1 line
2.55.0
PATCH 14/64 drm/amd/display: Fold plane modifier list tests
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHAT]
Reduce the six KUnit tests for amdgpu_dm_plane_get_plane_modifiers() to three, keeping every family dispatch covered.
[HOW]
Merge the GFX10.1, GFX10.3 and GFX12 cases into one table-driven test over the family and GC IP version, and merge the two RV cases into a table over the external revision id that selects the constant-encode modifier variants.
--- .../amdgpu_dm/tests/amdgpu_dm_plane_test.c | 231 +++++++----------- 1 file changed, 87 insertions(+), 144 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +87 -144
@@ -1341,152 +1341,117 @@ static void dm_test_get_plane_modifiers_gfx9(struct kunit *test) }/** -* dm_test_get_plane_modifiers_rv() - Verify RV modifier list generation. +* dm_test_get_plane_modifiers_gfx10_and_gfx12() - Verify newer family dispatch. * @test: KUnit test context. * -* Verify if pre-Raven2 RV devices add RV-specific S-swizzle modifiers and -* non-constant-encode DCC modifiers. +* Verify if the GFX10.1, GFX10.3 and GFX12 configurations each dispatch to +* their modifier builder and produce a terminated list. */ -static void dm_test_get_plane_modifiers_rv (struct kunit *test) +static void dm_test_get_plane_modifiers_gfx10_and_gfx12 (struct kunit *test) { -struct amdgpu_device *adev; -u64 *mods; -u64 dcc_mod; -u64 s_x_mod; -u64 s_mod; -int pipes =2 ; -int pipe_xor_bits =3 ; -int bank_xor_bits =2 ; - - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, adev); +static const struct { +u32 family; +u32 gc_ip_version; +u32 num_pipes; +u32 num_pkrs; + } cases[] = { + {AMDGPU_FAMILY_NV ,IP_VERSION (10 ,1 ,0 ),4 ,0 }, + {AMDGPU_FAMILY_NV ,IP_VERSION (10 ,3 ,0 ),4 ,2 }, + {AMDGPU_FAMILY_GC_12_0_0 ,0 ,0 ,0 }, + }; +unsigned int i; - adev->family =AMDGPU_FAMILY_RV ; - adev->asic_type =CHIP_RAVEN ; - adev->external_rev_id =0x80 ; - adev->gfx.config.gb_addr_config_fields.num_pipes =4 ; - adev->gfx.config.gb_addr_config_fields.num_banks =4 ; - adev->gfx.config.gb_addr_config_fields.num_se =2 ; - adev->gfx.config.gb_addr_config_fields.num_rb_per_se =2 ; +for (i =0 ; i <ARRAY_SIZE (cases); i++) { +struct amdgpu_device *adev; - mods =dm_test_get_primary_mods (test, adev); - dcc_mod =AMD_FMT_MOD | -AMD_FMT_MOD_SET (TILE ,AMD_FMT_MOD_TILE_GFX9_64K_S_X ) | -AMD_FMT_MOD_SET (TILE_VERSION ,AMD_FMT_MOD_TILE_VER_GFX9 ) | -AMD_FMT_MOD_SET (PIPE_XOR_BITS , pipe_xor_bits) | -AMD_FMT_MOD_SET (BANK_XOR_BITS , bank_xor_bits) | -AMD_FMT_MOD_SET (DCC ,1 ) | -AMD_FMT_MOD_SET (DCC_INDEPENDENT_64B ,1 ) | -AMD_FMT_MOD_SET (DCC_MAX_COMPRESSED_BLOCK ,AMD_FMT_MOD_DCC_BLOCK_64B ) | -AMD_FMT_MOD_SET (DCC_CONSTANT_ENCODE ,0 ); - s_x_mod =AMD_FMT_MOD | -AMD_FMT_MOD_SET (TILE ,AMD_FMT_MOD_TILE_GFX9_64K_S_X ) | -AMD_FMT_MOD_SET (TILE_VERSION ,AMD_FMT_MOD_TILE_VER_GFX9 ) | -AMD_FMT_MOD_SET (PIPE_XOR_BITS , pipe_xor_bits) | -AMD_FMT_MOD_SET (BANK_XOR_BITS , bank_xor_bits); - s_mod =AMD_FMT_MOD | -AMD_FMT_MOD_SET (TILE ,AMD_FMT_MOD_TILE_GFX9_64K_S ) | -AMD_FMT_MOD_SET (TILE_VERSION ,AMD_FMT_MOD_TILE_VER_GFX9 ); + adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, adev); -KUNIT_EXPECT_TRUE (test,dm_test_mods_contain (mods, dcc_mod)); -KUNIT_EXPECT_TRUE (test,dm_test_mods_contain (mods, dcc_mod | -AMD_FMT_MOD_SET (DCC_RETILE ,1 ) | -AMD_FMT_MOD_SET (RB ,2 ) | -AMD_FMT_MOD_SET (PIPE , pipes))); -KUNIT_EXPECT_TRUE (test,dm_test_mods_contain (mods, s_x_mod)); -KUNIT_EXPECT_TRUE (test,dm_test_mods_contain (mods, s_mod)); + adev->family = cases[i].family; + adev->ip_versions[GC_HWIP ][0 ] = cases[i].gc_ip_version; + adev->gfx.config.gb_addr_config_fields.num_pipes = cases[i].num_pipes; + adev->gfx.config.gb_addr_config_fields.num_pkrs = cases[i].num_pkrs; -kfree (mods); +dm_test_expect_mods_terminated (test, adev); + } }/** -* dm_test_get_plane_modifiers_rv_constant_encode() - Verify Raven2+ modifiers. +* dm_test_get_plane_modifiers_rv() - Verify RV modifier list generation. * @test: KUnit test context. * -* Verify if Raven2 and later RV devices add the constant-encode modifier -* variants. +* Verify if RV devices add the RV-specific S-swizzle modifiers, and if the +* constant-encode DCC variants only appear from Raven2 onwards. */ -static void dm_test_get_plane_modifiers_rv_constant_encode (struct kunit *test) +static void dm_test_get_plane_modifiers_rv (struct kunit *test) { -struct amdgpu_device *adev; -u64 *mods; -u64 dcc_mod; +static const struct { +const char *name; +u32 external_rev_id; +u32 constant_encode; + } cases[] = { + {"raven" ,0x80 ,0 }, + {"raven2" ,0x81 ,1 }, + };int pipes =2 ;int pipe_xor_bits =3 ;int bank_xor_bits =2 ; +u64 s_x_mod; +u64 s_mod; +unsigned int i; - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, adev); - - adev->family =AMDGPU_FAMILY_RV ; - adev->asic_type =CHIP_RAVEN ; - adev->external_rev_id =0x81 ; - adev->gfx.config.gb_addr_config_fields.num_pipes =4 ; - adev->gfx.config.gb_addr_config_fields.num_banks =4 ; - adev->gfx.config.gb_addr_config_fields.num_se =2 ; - adev->gfx.config.gb_addr_config_fields.num_rb_per_se =2 ; - - mods =dm_test_get_primary_mods (test, adev); - dcc_mod =AMD_FMT_MOD | + s_x_mod =AMD_FMT_MOD |AMD_FMT_MOD_SET (TILE ,AMD_FMT_MOD_TILE_GFX9_64K_S_X ) |AMD_FMT_MOD_SET (TILE_VERSION ,AMD_FMT_MOD_TILE_VER_GFX9 ) |AMD_FMT_MOD_SET (PIPE_XOR_BITS , pipe_xor_bits) | -AMD_FMT_MOD_SET (BANK_XOR_BITS , bank_xor_bits) | -AMD_FMT_MOD_SET (DCC ,1 ) | -AMD_FMT_MOD_SET (DCC_INDEPENDENT_64B ,1 ) | -AMD_FMT_MOD_SET (DCC_MAX_COMPRESSED_BLOCK ,AMD_FMT_MOD_DCC_BLOCK_64B ) | -AMD_FMT_MOD_SET (DCC_CONSTANT_ENCODE ,1 ); - -KUNIT_EXPECT_TRUE (test,dm_test_mods_contain (mods, dcc_mod)); -KUNIT_EXPECT_TRUE (test,dm_test_mods_contain (mods, dcc_mod | -AMD_FMT_MOD_SET (DCC_RETILE ,1 ) | -AMD_FMT_MOD_SET (RB ,2 ) | -AMD_FMT_MOD_SET (PIPE , pipes))); - -kfree (mods); -} - -/** -* dm_test_get_plane_modifiers_gfx10_1() - Verify GFX10.1 modifier list generation. -* @test: KUnit test context. -* -* Verify if a pre-10.3 NV family device dispatches to the GFX10.1 modifier -* builder and produces a terminated list. -*/ -static void dm_test_get_plane_modifiers_gfx10_1 (struct kunit *test) -{ -struct amdgpu_device *adev; - - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, adev); - - adev->family =AMDGPU_FAMILY_NV ; - adev->gfx.config.gb_addr_config_fields.num_pipes =4 ; - adev->ip_versions[GC_HWIP ][0 ] =IP_VERSION (10 ,1 ,0 ); - -dm_test_expect_mods_terminated (test, adev); -} - -/** -* dm_test_get_plane_modifiers_gfx10_3() - Verify GFX10.3 modifier list generation. -* @test: KUnit test context. -* -* Verify if a 10.3+ NV family device dispatches to the GFX10.3 modifier -* builder and produces a terminated list. -*/ -static void dm_test_get_plane_modifiers_gfx10_3 (struct kunit *test) -{ -struct amdgpu_device *adev; +AMD_FMT_MOD_SET (BANK_XOR_BITS , bank_xor_bits); + s_mod =AMD_FMT_MOD | +AMD_FMT_MOD_SET (TILE ,AMD_FMT_MOD_TILE_GFX9_64K_S ) | +AMD_FMT_MOD_SET (TILE_VERSION ,AMD_FMT_MOD_TILE_VER_GFX9 ); - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, adev); +for (i =0 ; i <ARRAY_SIZE (cases); i++) { +struct amdgpu_device *adev; +u64 *mods; +u64 dcc_mod; +u64 retile_mod; - adev->family =AMDGPU_FAMILY_NV ; - adev->gfx.config.gb_addr_config_fields.num_pipes =4 ; - adev->gfx.config.gb_addr_config_fields.num_pkrs =2 ; - adev->ip_versions[GC_HWIP ][0 ] =IP_VERSION (10 ,3 ,0 ); + adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, adev); -dm_test_expect_mods_terminated (test, adev); + adev->family =AMDGPU_FAMILY_RV ; + adev->asic_type =CHIP_RAVEN ; + adev->external_rev_id = cases[i].external_rev_id; + adev->gfx.config.gb_addr_config_fields.num_pipes =4 ; + adev->gfx.config.gb_addr_config_fields.num_banks =4 ; + adev->gfx.config.gb_addr_config_fields.num_se =2 ; + adev->gfx.config.gb_addr_config_fields.num_rb_per_se =2 ; + + mods =dm_test_get_primary_mods (test, adev); + dcc_mod =AMD_FMT_MOD | +AMD_FMT_MOD_SET (TILE ,AMD_FMT_MOD_TILE_GFX9_64K_S_X ) | +AMD_FMT_MOD_SET (TILE_VERSION ,AMD_FMT_MOD_TILE_VER_GFX9 ) | +AMD_FMT_MOD_SET (PIPE_XOR_BITS , pipe_xor_bits) | +AMD_FMT_MOD_SET (BANK_XOR_BITS , bank_xor_bits) | +AMD_FMT_MOD_SET (DCC ,1 ) | +AMD_FMT_MOD_SET (DCC_INDEPENDENT_64B ,1 ) | +AMD_FMT_MOD_SET (DCC_MAX_COMPRESSED_BLOCK ,AMD_FMT_MOD_DCC_BLOCK_64B ) | +AMD_FMT_MOD_SET (DCC_CONSTANT_ENCODE , cases[i].constant_encode); + retile_mod = dcc_mod | +AMD_FMT_MOD_SET (DCC_RETILE ,1 ) | +AMD_FMT_MOD_SET (RB ,2 ) | +AMD_FMT_MOD_SET (PIPE , pipes); + +KUNIT_EXPECT_TRUE_MSG (test,dm_test_mods_contain (mods, dcc_mod), +"%s" , cases[i].name); +KUNIT_EXPECT_TRUE_MSG (test,dm_test_mods_contain (mods, retile_mod), +"%s" , cases[i].name); +KUNIT_EXPECT_TRUE_MSG (test,dm_test_mods_contain (mods, s_x_mod), +"%s" , cases[i].name); +KUNIT_EXPECT_TRUE_MSG (test,dm_test_mods_contain (mods, s_mod), +"%s" , cases[i].name); + +kfree (mods); + } }/**
@@ -1571,25 +1536,6 @@ static void dm_test_get_plane_modifiers_gfx11_256k_first(struct kunit *test)kfree (mods); } -/** -* dm_test_get_plane_modifiers_gfx12() - Verify GFX12 modifier list generation. -* @test: KUnit test context. -* -* Verify if the GFX12 family dispatches to the GFX12 modifier builder and -* produces a terminated list. -*/ -static void dm_test_get_plane_modifiers_gfx12 (struct kunit *test) -{ -struct amdgpu_device *adev; - - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, adev); - - adev->family =AMDGPU_FAMILY_GC_12_0_0 ; - -dm_test_expect_mods_terminated (test, adev); -} -/** * dm_test_fill_gfx9_plane_attributes_dcc() - Verify GFX9 DCC modifier path. * @test: KUnit test context.
@@ -3957,12 +3903,9 @@ static struct kunit_case amdgpu_dm_plane_test_cases[] = {KUNIT_CASE (dm_test_get_plane_modifiers_gfx6),KUNIT_CASE (dm_test_get_plane_modifiers_gfx9),KUNIT_CASE (dm_test_get_plane_modifiers_rv), -KUNIT_CASE (dm_test_get_plane_modifiers_rv_constant_encode), -KUNIT_CASE (dm_test_get_plane_modifiers_gfx10_1), -KUNIT_CASE (dm_test_get_plane_modifiers_gfx10_3), +KUNIT_CASE (dm_test_get_plane_modifiers_gfx10_and_gfx12),KUNIT_CASE (dm_test_get_plane_modifiers_gfx11_64k_first),KUNIT_CASE (dm_test_get_plane_modifiers_gfx11_256k_first), -KUNIT_CASE (dm_test_get_plane_modifiers_gfx12),/* amdgpu_dm_plane_fill_dc_scaling_info() */ KUNIT_CASE (dm_test_fill_dc_scaling_info), KUNIT_CASE(dm_test_fill_dc_scaling_info_nv12_dcn1x),
Signature · 1 line
2.55.0
PATCH 15/64 drm/amd/display: Fold modifier append tests
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHAT]
Reduce the four KUnit tests for amdgpu_dm_plane_add_modifier() to two, and the two tests for amdgpu_dm_plane_add_modifier_dedup() to one.
[HOW]
Group the append and capacity-growth cases into one test and the NULL-list and allocation-failure cases into another, and run the duplicate-skip and NULL-list dedup cases in sequence within a single test.
--- .../amdgpu_dm/tests/amdgpu_dm_plane_test.c | 96 +++++++------------ 1 file changed, 33 insertions(+), 63 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +33 -63
@@ -855,12 +855,13 @@ static void dm_test_validate_dcc_independent_64b_mismatch_fails(struct kunit *te }/** -* dm_test_add_modifier_appends_value() - Verify one modifier append. +* dm_test_add_modifier_appends_and_grows() - Verify append and capacity growth. * @test: KUnit test context. * -* Verify if a modifier is appended and size is updated. +* Verify if a modifier is appended within the existing capacity, and if a full +* list is grown while preserving the modifiers already stored. */ -static void dm_test_add_modifier_appends_value (struct kunit *test) +static void dm_test_add_modifier_appends_and_grows (struct kunit *test) {uint64_t size =0 ;uint64_t cap =2 ;
@@ -876,20 +877,10 @@ static void dm_test_add_modifier_appends_value(struct kunit *test)KUNIT_EXPECT_EQ (test, mods[0 ],0x1234ULL );kfree (mods); -} - -/** -* dm_test_add_modifier_grows_capacity() - Verify add triggers growth and preserves old data. -* @test: KUnit test context. -* -* Verify if modifier array growth keeps old data and appends new data. -*/ -static void dm_test_add_modifier_grows_capacity (struct kunit *test) -{ -uint64_t size =1 ; -uint64_t cap =1 ; -uint64_t *mods =kmalloc_array (cap,sizeof (*mods),GFP_KERNEL ); + size =1 ; + cap =1 ; + mods =kmalloc_array (cap,sizeof (*mods),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, mods); mods[0 ] =0xAAULL ;
@@ -905,12 +896,14 @@ static void dm_test_add_modifier_grows_capacity(struct kunit *test) }/** -* dm_test_add_modifier_noop_when_mods_null() - Verify helper is a no-op on NULL mods list. +* dm_test_add_modifier_failure_paths() - Verify the two failure paths. * @test: KUnit test context. * -* Verify if add_modifier does nothing when the modifier list is NULL. +* Verify if the append is a no-op once the modifier list is NULL, and if a +* failed capacity growth releases and clears the list so the caller can detect +* the allocation failure. */ -static void dm_test_add_modifier_noop_when_mods_null (struct kunit *test) +static void dm_test_add_modifier_failure_paths (struct kunit *test) {uint64_t size =3 ;uint64_t cap =7 ;
@@ -921,6 +914,17 @@ static void dm_test_add_modifier_noop_when_mods_null(struct kunit *test)KUNIT_EXPECT_PTR_EQ (test, mods,NULL );KUNIT_EXPECT_EQ (test, size,3ULL );KUNIT_EXPECT_EQ (test, cap,7ULL ); + +/* Doubling this capacity overflows the kmalloc_array() size product. */ + cap =1ULL <<62 ; + size = cap; + mods =kmalloc_array (1 ,sizeof (*mods),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, mods); + +amdgpu_dm_plane_add_modifier (&mods, &size, &cap,0x1234ULL ); + +KUNIT_EXPECT_PTR_EQ (test, mods,NULL ); +KUNIT_EXPECT_EQ (test, size,1ULL <<62 ); }/**
@@ -3028,13 +3032,14 @@ static void dm_test_plane_destroy_state_releases_resources(struct kunit *test) }/** -* dm_test_add_modifier_dedup_skips_duplicate() - Verify duplicates are not appended. +* dm_test_add_modifier_dedup() - Verify the de-duplicating append. * @test: KUnit test context. * * Verify if a modifier already present in the list is not appended a second -* time. +* time, and if the append is a no-op once the list is NULL after an earlier +* allocation failure. */ -static void dm_test_add_modifier_dedup_skips_duplicate (struct kunit *test) +static void dm_test_add_modifier_dedup (struct kunit *test) {u64 size =2 ;u64 cap =4 ;
@@ -3055,20 +3060,10 @@ static void dm_test_add_modifier_dedup_skips_duplicate(struct kunit *test)KUNIT_EXPECT_EQ (test, mods[2 ],0xCCULL );kfree (mods); -} -/** -* dm_test_add_modifier_dedup_noop_when_mods_null() - Verify NULL list is a no-op. -* @test: KUnit test context. -* -* Verify if the de-duplicating append does nothing when the modifier list is -* NULL after an earlier allocation failure. -*/ -static void dm_test_add_modifier_dedup_noop_when_mods_null (struct kunit *test) -{ -u64 size =3 ; -u64 cap =7 ; -u64 *mods =NULL ; + size =3 ; + cap =7 ; + mods =NULL ;amdgpu_dm_plane_add_modifier_dedup (&mods, &size, &cap,0x55ULL );
@@ -3563,28 +3558,6 @@ static void dm_test_atomic_async_update_copies_state(struct kunit *test)KUNIT_EXPECT_EQ (test, cur_state->crtc_h,64U ); } -/** -* dm_test_add_modifier_alloc_failure() - Verify the growth allocation failure. -* @test: KUnit test context. -* -* Verify if a failed capacity growth releases and clears the modifier list so -* the caller can detect the allocation failure. -*/ -static void dm_test_add_modifier_alloc_failure (struct kunit *test) -{ -/* Doubling this capacity overflows the kmalloc_array() size product. */ -u64 cap =1ULL <<62 ; -u64 size = cap; -u64 *mods =kmalloc_array (1 ,sizeof (*mods),GFP_KERNEL ); - -KUNIT_ASSERT_NOT_NULL (test, mods); - -amdgpu_dm_plane_add_modifier (&mods, &size, &cap,0x1234ULL ); - -KUNIT_EXPECT_PTR_EQ (test, mods,NULL ); -KUNIT_EXPECT_EQ (test, size,1ULL <<62 ); -} -/** * dm_test_fill_plane_buffer_attributes_gfx6() - Verify the pre-GFX9 dispatch. * @test: KUnit test context.
@@ -3976,13 +3949,10 @@ static struct kunit_case amdgpu_dm_plane_test_cases[] = {KUNIT_CASE (dm_test_plane_destroy_state_minimal),KUNIT_CASE (dm_test_plane_destroy_state_releases_resources),/* amdgpu_dm_plane_add_modifier() */ -KUNIT_CASE (dm_test_add_modifier_appends_value), -KUNIT_CASE (dm_test_add_modifier_grows_capacity), -KUNIT_CASE (dm_test_add_modifier_noop_when_mods_null), -KUNIT_CASE (dm_test_add_modifier_alloc_failure), +KUNIT_CASE (dm_test_add_modifier_appends_and_grows), +KUNIT_CASE (dm_test_add_modifier_failure_paths),/* amdgpu_dm_plane_add_modifier_dedup() */ -KUNIT_CASE (dm_test_add_modifier_dedup_skips_duplicate), -KUNIT_CASE (dm_test_add_modifier_dedup_noop_when_mods_null), +KUNIT_CASE (dm_test_add_modifier_dedup),/* amdgpu_dm_plane_fill_gfx6_tiling_info_from_modifier() */ KUNIT_CASE (dm_test_fill_gfx6_tiling_info_linear), KUNIT_CASE(dm_test_fill_gfx6_tiling_info_rejects),
Signature · 1 line
2.55.0
PATCH 16/64 drm/amd/display: Fold GFX9 tiling info tests
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHAT]
Reduce the two KUnit tests for amdgpu_dm_plane_fill_gfx9_tiling_info_from_device() to one, and the three for amdgpu_dm_plane_fill_gfx9_tiling_info_from_modifier() to one.
[HOW]
Reprogram the device configuration and re-run the helper in sequence inside a single test per function, so the pre-10.3, 10.3-and-later, linear, pre-NV and NV-and-later cases all stay covered.
--- .../amdgpu_dm/tests/amdgpu_dm_plane_test.c | 80 ++++--------------- 1 file changed, 17 insertions(+), 63 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +17 -63
@@ -928,12 +928,13 @@ static void dm_test_add_modifier_failure_paths(struct kunit *test) }/** -* dm_test_fill_gfx9_tiling_info_from_device_pre_10_3() - Verify GFX9 field copy before 10.3. +* dm_test_fill_gfx9_tiling_info_from_device() - Verify GFX9 device field copy. * @test: KUnit test context. * -* Verify if pre-10.3 device fields are copied and existing num_pkrs is kept. +* Verify if the device tiling fields are copied, and if num_pkrs is left +* untouched before GFX 10.3 but taken from the device from GFX 10.3 onwards. */ -static void dm_test_fill_gfx9_tiling_info_from_device_pre_10_3 (struct kunit *test) +static void dm_test_fill_gfx9_tiling_info_from_device (struct kunit *test) {struct amdgpu_device *adev;struct dc_tiling_info tiling_info = {0 };
@@ -962,21 +963,6 @@ static void dm_test_fill_gfx9_tiling_info_from_device_pre_10_3(struct kunit *tesKUNIT_EXPECT_EQ (test, tiling_info.gfx9.num_rb_per_se,2U );KUNIT_EXPECT_EQ (test, tiling_info.gfx9.shaderEnable,1U );KUNIT_EXPECT_EQ (test, tiling_info.gfx9.num_pkrs,0x5aU ); -} - -/** -* dm_test_fill_gfx9_tiling_info_from_device_10_3_plus() - Verify num_pkrs update on 10.3+. -* @test: KUnit test context. -* -* Verify if 10.3+ device fields are copied and num_pkrs is updated. -*/ -static void dm_test_fill_gfx9_tiling_info_from_device_10_3_plus (struct kunit *test) -{ -struct amdgpu_device *adev; -struct dc_tiling_info tiling_info = {0 }; - - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, adev); adev->gfx.config.gb_addr_config_fields.num_pipes =2 ; adev->gfx.config.gb_addr_config_fields.num_banks =4 ;
@@ -987,6 +973,8 @@ static void dm_test_fill_gfx9_tiling_info_from_device_10_3_plus(struct kunit *te adev->gfx.config.gb_addr_config_fields.num_pkrs =6 ; adev->ip_versions[GC_HWIP ][0 ] =IP_VERSION (10 ,3 ,0 ); +memset (&tiling_info,0 ,sizeof (tiling_info)); +amdgpu_dm_plane_fill_gfx9_tiling_info_from_device (adev, &tiling_info);KUNIT_EXPECT_EQ (test, tiling_info.gfx9.num_pipes,2U );
@@ -1000,15 +988,18 @@ static void dm_test_fill_gfx9_tiling_info_from_device_10_3_plus(struct kunit *te }/** -* dm_test_fill_gfx9_tiling_info_from_modifier_linear() - Verify non-AMD modifier keeps device values. +* dm_test_fill_gfx9_tiling_info_from_modifier() - Verify GFX9 modifier decoding. * @test: KUnit test context. * -* Verify if linear modifier path keeps values from device configuration. +* Verify if a non-AMD modifier keeps the device values, if an AMD modifier +* updates the bank count on pre-NV families, and if it updates the packer +* count on NV and later. */ -static void dm_test_fill_gfx9_tiling_info_from_modifier_linear (struct kunit *test) +static void dm_test_fill_gfx9_tiling_info_from_modifier (struct kunit *test) {struct amdgpu_device *adev;struct dc_tiling_info tiling_info = {0 }; +uint64_t modifier; adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, adev);
@@ -1034,33 +1025,13 @@ static void dm_test_fill_gfx9_tiling_info_from_modifier_linear(struct kunit *tesKUNIT_EXPECT_EQ (test, tiling_info.gfx9.num_rb_per_se,2U );KUNIT_EXPECT_EQ (test, tiling_info.gfx9.shaderEnable,1U );KUNIT_EXPECT_EQ (test, tiling_info.gfx9.num_pkrs,3U ); -} - -/** -* dm_test_fill_gfx9_tiling_info_from_modifier_pre_nv() - Verify AMD modifier updates banks on pre-NV. -* @test: KUnit test context. -* -* Verify if AMD modifier updates pre-NV pipe, engine, and bank fields. -*/ -static void dm_test_fill_gfx9_tiling_info_from_modifier_pre_nv (struct kunit *test) -{ -struct amdgpu_device *adev; -struct dc_tiling_info tiling_info = {0 }; -uint64_t modifier; - - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, adev); adev->family =AMDGPU_FAMILY_RV ; - adev->gfx.config.gb_addr_config_fields.num_pipes =4 ; adev->gfx.config.gb_addr_config_fields.num_banks =16 ; - adev->gfx.config.gb_addr_config_fields.pipe_interleave_size =256 ; - adev->gfx.config.gb_addr_config_fields.num_se =2 ; - adev->gfx.config.gb_addr_config_fields.max_compress_frags =1 ; - adev->gfx.config.gb_addr_config_fields.num_rb_per_se =2 ; adev->gfx.config.gb_addr_config_fields.num_pkrs =7 ; adev->ip_versions[GC_HWIP ][0 ] =IP_VERSION (10 ,2 ,9 ); +memset (&tiling_info,0 ,sizeof (tiling_info)); tiling_info.gfx9.num_pkrs =0x5a ; modifier = AMD_FMT_MOD |
@@ -1076,22 +1047,6 @@ static void dm_test_fill_gfx9_tiling_info_from_modifier_pre_nv(struct kunit *tesKUNIT_EXPECT_EQ (test, tiling_info.gfx9.num_banks,8U );KUNIT_EXPECT_EQ (test, tiling_info.gfx9.num_pkrs,0x5aU );KUNIT_EXPECT_EQ (test, tiling_info.gfx9.shaderEnable,1U ); -} - -/** -* dm_test_fill_gfx9_tiling_info_from_modifier_nv() - Verify AMD modifier updates packers on NV+. -* @test: KUnit test context. -* -* Verify if AMD modifier updates NV+ pipe, engine, and packer fields. -*/ -static void dm_test_fill_gfx9_tiling_info_from_modifier_nv (struct kunit *test) -{ -struct amdgpu_device *adev; -struct dc_tiling_info tiling_info = {0 }; -uint64_t modifier; - - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, adev); adev->family =AMDGPU_FAMILY_NV ; adev->gfx.config.gb_addr_config_fields.num_pipes =2 ;
@@ -1103,6 +1058,8 @@ static void dm_test_fill_gfx9_tiling_info_from_modifier_nv(struct kunit *test) adev->gfx.config.gb_addr_config_fields.num_pkrs =2 ; adev->ip_versions[GC_HWIP ][0 ] =IP_VERSION (10 ,3 ,0 ); +memset (&tiling_info,0 ,sizeof (tiling_info)); + modifier =AMD_FMT_MOD |AMD_FMT_MOD_SET (TILE ,AMD_FMT_MOD_TILE_GFX9_64K_S_X ) | AMD_FMT_MOD_SET(PIPE_XOR_BITS, 6) |
@@ -3971,12 +3928,9 @@ static struct kunit_case amdgpu_dm_plane_test_cases[] = {/* amdgpu_dm_plane_gfx6_format_mod_supported() */ KUNIT_CASE (dm_test_gfx6_format_mod_supported),/* amdgpu_dm_plane_fill_gfx9_tiling_info_from_device() */ -KUNIT_CASE (dm_test_fill_gfx9_tiling_info_from_device_pre_10_3), -KUNIT_CASE (dm_test_fill_gfx9_tiling_info_from_device_10_3_plus), +KUNIT_CASE (dm_test_fill_gfx9_tiling_info_from_device),/* amdgpu_dm_plane_fill_gfx9_tiling_info_from_modifier() */ -KUNIT_CASE (dm_test_fill_gfx9_tiling_info_from_modifier_linear), -KUNIT_CASE (dm_test_fill_gfx9_tiling_info_from_modifier_pre_nv), -KUNIT_CASE (dm_test_fill_gfx9_tiling_info_from_modifier_nv), +KUNIT_CASE (dm_test_fill_gfx9_tiling_info_from_modifier),/* amdgpu_dm_plane_validate_dcc() */ KUNIT_CASE (dm_test_validate_dcc_disabled_returns_success), KUNIT_CASE(dm_test_validate_dcc_video_non_gfx12_fails),
Signature · 1 line
2.55.0
PATCH 17/64 drm/amd/display: Fold GFX6-8 tiling and modifier tests
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHAT]
Reduce the four KUnit tests for amdgpu_dm_plane_fill_gfx6_tiling_info_from_modifier() to one, and the three for amdgpu_dm_plane_calc_gfx6_mod() to one.
[HOW]
Build the linear, rejected, 1D tiled and 2D tiled modifiers as locals and decode them in sequence, and drive the micro tiled, GFX7-8 and GFX6 modifier calculations from two devices inside a single test.
--- .../amdgpu_dm/tests/amdgpu_dm_plane_test.c | 148 ++++++------------ 1 file changed, 46 insertions(+), 102 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +46 -102
@@ -3035,80 +3035,50 @@ static int dm_test_gfx6_tiling(struct dc_tiling_info *tiling_info, u64 modifier) }/** -* dm_test_fill_gfx6_tiling_info_linear() - Verify linear modifier decoding. +* dm_test_fill_gfx6_tiling_info_from_modifier() - Verify GFX6-8 modifier decoding. * @test: KUnit test context. * -* Verify if a linear modifier maps to the generic linear array mode. +* Verify if a linear modifier maps to the generic linear array mode, if non-AMD +* modifiers and newer tile versions are rejected, if a 1D tiled modifier stops +* before the macro tiling fields, and if a 2D tiled modifier decodes them all. */ -static void dm_test_fill_gfx6_tiling_info_linear (struct kunit *test) +static void dm_test_fill_gfx6_tiling_info_from_modifier (struct kunit *test) {struct dc_tiling_info tiling_info = {0 }; +u64 not_amd_mod =DRM_FORMAT_MOD_VENDOR_AMD ; +u64 gfx9_mod =AMD_FMT_MOD |AMD_FMT_MOD_SET (TILE_VERSION ,AMD_FMT_MOD_TILE_VER_GFX9 ); +u64 mod_1d =AMD_FMT_MOD | +AMD_FMT_MOD_SET (TILE_VERSION ,AMD_FMT_MOD_TILE_VER_GFX6 ) | +AMD_FMT_MOD_SET (TILE ,AMD_FMT_MOD_TILE_GFX6_1D_TILED_THIN1 ) | +AMD_FMT_MOD_SET (MICROTILE ,AMD_FMT_MOD_MICROTILE_DISPLAY ) | +AMD_FMT_MOD_SET (NUM_BANKS ,3 ); +u64 mod_2d =AMD_FMT_MOD | +AMD_FMT_MOD_SET (TILE_VERSION ,AMD_FMT_MOD_TILE_VER_GFX6 ) | +AMD_FMT_MOD_SET (TILE ,AMD_FMT_MOD_TILE_GFX6_2D_TILED_THIN1 ) | +AMD_FMT_MOD_SET (MICROTILE ,AMD_FMT_MOD_MICROTILE_DISPLAY ) | +AMD_FMT_MOD_SET (PIPE_CONFIG ,5 ) | +AMD_FMT_MOD_SET (TILE_SPLIT ,4 ) | +AMD_FMT_MOD_SET (BANK_WIDTH ,1 ) | +AMD_FMT_MOD_SET (BANK_HEIGHT ,2 ) | +AMD_FMT_MOD_SET (MACRO_TILE_ASPECT ,3 ) | +AMD_FMT_MOD_SET (NUM_BANKS ,2 );KUNIT_EXPECT_EQ (test,dm_test_gfx6_tiling (&tiling_info,DRM_FORMAT_MOD_LINEAR ),0 );KUNIT_EXPECT_EQ (test, (int )tiling_info.gfx8.array_mode, (int )DC_ARRAY_LINEAR_GENERAL );KUNIT_EXPECT_EQ (test, (int )tiling_info.gfxversion, (int )DcGfxVersion8); -} - -/** -* dm_test_fill_gfx6_tiling_info_rejects() - Verify unsupported modifiers fail. -* @test: KUnit test context. -* -* Verify if non-AMD modifiers and AMD modifiers from a newer tile version are -* rejected. -*/ -static void dm_test_fill_gfx6_tiling_info_rejects (struct kunit *test) -{ -struct dc_tiling_info tiling_info = {0 }; -u64 not_amd_mod =DRM_FORMAT_MOD_VENDOR_AMD ; -u64 gfx9_mod =AMD_FMT_MOD |AMD_FMT_MOD_SET (TILE_VERSION ,AMD_FMT_MOD_TILE_VER_GFX9 );KUNIT_EXPECT_EQ (test,dm_test_gfx6_tiling (&tiling_info, not_amd_mod), -EINVAL );KUNIT_EXPECT_EQ (test,dm_test_gfx6_tiling (&tiling_info, gfx9_mod), -EINVAL ); -} -/** -* dm_test_fill_gfx6_tiling_info_1d() - Verify micro tiled modifier decoding. -* @test: KUnit test context. -* -* Verify if a 1D tiled modifier stops before decoding the macro tiling fields. -*/ -static void dm_test_fill_gfx6_tiling_info_1d (struct kunit *test) -{ -struct dc_tiling_info tiling_info = {0 }; -u64 modifier =AMD_FMT_MOD | -AMD_FMT_MOD_SET (TILE_VERSION ,AMD_FMT_MOD_TILE_VER_GFX6 ) | -AMD_FMT_MOD_SET (TILE ,AMD_FMT_MOD_TILE_GFX6_1D_TILED_THIN1 ) | -AMD_FMT_MOD_SET (MICROTILE ,AMD_FMT_MOD_MICROTILE_DISPLAY ) | -AMD_FMT_MOD_SET (NUM_BANKS ,3 ); - -KUNIT_EXPECT_EQ (test,dm_test_gfx6_tiling (&tiling_info, modifier),0 ); +memset (&tiling_info,0 ,sizeof (tiling_info)); +KUNIT_EXPECT_EQ (test,dm_test_gfx6_tiling (&tiling_info, mod_1d),0 );KUNIT_EXPECT_EQ (test, (int )tiling_info.gfx8.array_mode, (int )AMD_FMT_MOD_TILE_GFX6_1D_TILED_THIN1 );KUNIT_EXPECT_EQ (test, (int )tiling_info.gfxversion, (int )DcGfxVersion8);KUNIT_EXPECT_EQ (test, tiling_info.gfx8.num_banks,0U ); -} -/** -* dm_test_fill_gfx6_tiling_info_2d() - Verify macro tiled modifier decoding. -* @test: KUnit test context. -* -* Verify if a 2D tiled modifier decodes the full set of macro tiling fields. -*/ -static void dm_test_fill_gfx6_tiling_info_2d (struct kunit *test) -{ -struct dc_tiling_info tiling_info = {0 }; -u64 modifier =AMD_FMT_MOD | -AMD_FMT_MOD_SET (TILE_VERSION ,AMD_FMT_MOD_TILE_VER_GFX6 ) | -AMD_FMT_MOD_SET (TILE ,AMD_FMT_MOD_TILE_GFX6_2D_TILED_THIN1 ) | -AMD_FMT_MOD_SET (MICROTILE ,AMD_FMT_MOD_MICROTILE_DISPLAY ) | -AMD_FMT_MOD_SET (PIPE_CONFIG ,5 ) | -AMD_FMT_MOD_SET (TILE_SPLIT ,4 ) | -AMD_FMT_MOD_SET (BANK_WIDTH ,1 ) | -AMD_FMT_MOD_SET (BANK_HEIGHT ,2 ) | -AMD_FMT_MOD_SET (MACRO_TILE_ASPECT ,3 ) | -AMD_FMT_MOD_SET (NUM_BANKS ,2 ); - -KUNIT_EXPECT_EQ (test,dm_test_gfx6_tiling (&tiling_info, modifier),0 ); +memset (&tiling_info,0 ,sizeof (tiling_info)); +KUNIT_EXPECT_EQ (test,dm_test_gfx6_tiling (&tiling_info, mod_2d),0 );KUNIT_EXPECT_EQ (test, (int )tiling_info.gfx8.array_mode, (int )AMD_FMT_MOD_TILE_GFX6_2D_TILED_THIN1 ); KUNIT_EXPECT_EQ(test, (int)tiling_info.gfx8.tile_mode,
@@ -3235,35 +3205,26 @@ static void dm_test_get_gfx7_macro_tile_idx(struct kunit *test) }/** -* dm_test_calc_gfx6_mod_1d() - Verify the micro tiled GFX6-8 modifier. +* dm_test_calc_gfx6_mod() - Verify the GFX6-8 modifier calculation. * @test: KUnit test context. * * Verify if a micro tiled array mode returns early with only the base modifier -* fields set. +* fields set, if GFX7-8 combines the tile mode pipe config and computed tile +* split with the bank fields from the macro tile mode table, and if GFX6 takes +* the tile split and bank fields directly from the tile mode register. */ -static void dm_test_calc_gfx6_mod_1d (struct kunit *test) +static void dm_test_calc_gfx6_mod (struct kunit *test) {struct amdgpu_device *adev =dm_test_alloc_gfx7_device (test); -u64 expected =AMD_FMT_MOD | -AMD_FMT_MOD_SET (TILE_VERSION ,AMD_FMT_MOD_TILE_VER_GFX6 ) | -AMD_FMT_MOD_SET (TILE ,AMD_FMT_MOD_TILE_GFX6_1D_TILED_THIN1 ) | -AMD_FMT_MOD_SET (MICROTILE ,AMD_FMT_MOD_MICROTILE_DISPLAY ); +struct amdgpu_device *si_adev; +u64 expected_1d =AMD_FMT_MOD | +AMD_FMT_MOD_SET (TILE_VERSION ,AMD_FMT_MOD_TILE_VER_GFX6 ) | +AMD_FMT_MOD_SET (TILE ,AMD_FMT_MOD_TILE_GFX6_1D_TILED_THIN1 ) | +AMD_FMT_MOD_SET (MICROTILE ,AMD_FMT_MOD_MICROTILE_DISPLAY );KUNIT_EXPECT_EQ (test,amdgpu_dm_plane_calc_gfx6_mod (adev,0 ,DC_ARRAY_1D_TILED_THIN1 ), - expected); -} - -/** -* dm_test_calc_gfx6_mod_gfx7() - Verify the macro tiled GFX7-8 modifier. -* @test: KUnit test context. -* -* Verify if the modifier combines the tile mode pipe config and computed tile -* split with the bank fields taken from the macro tile mode table. -*/ -static void dm_test_calc_gfx6_mod_gfx7 (struct kunit *test) -{ -struct amdgpu_device *adev =dm_test_alloc_gfx7_device (test); + expected_1d);/* 32 bpp: 256 byte tile split (log2 of 4 units), macro tile mode 2. */ KUNIT_EXPECT_EQ(test,
@@ -3274,30 +3235,18 @@ static void dm_test_calc_gfx6_mod_gfx7(struct kunit *test)KUNIT_EXPECT_EQ (test,amdgpu_dm_plane_calc_gfx6_mod (adev,64 ,DC_ARRAY_2D_TILED_THIN1 ),dm_test_gfx6_mod (AMD_FMT_MOD_TILE_GFX6_2D_TILED_THIN1 ,2 ,3 ,2 ,2 ,2 ,0 )); -} -/** -* dm_test_calc_gfx6_mod_si() - Verify the macro tiled GFX6 modifier. -* @test: KUnit test context. -* -* Verify if GFX6 takes the tile split and bank fields directly from the tile -* mode register instead of the macro tile mode table. -*/ -static void dm_test_calc_gfx6_mod_si (struct kunit *test) -{ -struct amdgpu_device *adev; - - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, adev); + si_adev =kunit_kzalloc (test,sizeof (*si_adev),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, si_adev); - adev->family =AMDGPU_FAMILY_SI ; + si_adev->family =AMDGPU_FAMILY_SI ;/* 2D_TILED_THIN1, pipe config 3, 256 byte tile split, banks 1/2/3/1. */ - adev->gfx.config.tile_mode_array[12 ] = (4u <<2 ) | (3u <<6 ) | (2u <<11 ) | - (1u <<14 ) | (2u <<16 ) | (3u <<18 ) | - (1u <<20 ); + si_adev->gfx.config.tile_mode_array[12 ] = (4u <<2 ) | (3u <<6 ) | (2u <<11 ) | + (1u <<14 ) | (2u <<16 ) | (3u <<18 ) | + (1u <<20 );KUNIT_EXPECT_EQ (test, -amdgpu_dm_plane_calc_gfx6_mod (adev,32 ,DC_ARRAY_2D_TILED_THIN1 ), +amdgpu_dm_plane_calc_gfx6_mod (si_adev,32 ,DC_ARRAY_2D_TILED_THIN1 ),dm_test_gfx6_mod (AMD_FMT_MOD_TILE_GFX6_2D_TILED_THIN1 ,3 ,2 ,1 ,2 ,3 ,1 )); }
@@ -3911,10 +3860,7 @@ static struct kunit_case amdgpu_dm_plane_test_cases[] = {/* amdgpu_dm_plane_add_modifier_dedup() */ KUNIT_CASE (dm_test_add_modifier_dedup),/* amdgpu_dm_plane_fill_gfx6_tiling_info_from_modifier() */ -KUNIT_CASE (dm_test_fill_gfx6_tiling_info_linear), -KUNIT_CASE (dm_test_fill_gfx6_tiling_info_rejects), -KUNIT_CASE (dm_test_fill_gfx6_tiling_info_1d), -KUNIT_CASE (dm_test_fill_gfx6_tiling_info_2d), +KUNIT_CASE (dm_test_fill_gfx6_tiling_info_from_modifier),/* amdgpu_dm_plane_get_gfx6_tile_idx() */ KUNIT_CASE(dm_test_get_gfx6_tile_idx),/* amdgpu_dm_plane_calc_gfx7_tile_split() */
@@ -3922,9 +3868,7 @@ static struct kunit_case amdgpu_dm_plane_test_cases[] = {/* amdgpu_dm_plane_get_gfx7_macro_tile_idx() */ KUNIT_CASE (dm_test_get_gfx7_macro_tile_idx),/* amdgpu_dm_plane_calc_gfx6_mod() */ -KUNIT_CASE (dm_test_calc_gfx6_mod_1d), -KUNIT_CASE (dm_test_calc_gfx6_mod_gfx7), -KUNIT_CASE (dm_test_calc_gfx6_mod_si), +KUNIT_CASE (dm_test_calc_gfx6_mod),/* amdgpu_dm_plane_gfx6_format_mod_supported() */ KUNIT_CASE(dm_test_gfx6_format_mod_supported),/* amdgpu_dm_plane_fill_gfx9_tiling_info_from_device() */
Signature · 1 line
2.55.0
PATCH 18/64 drm/amd/display: Fold DCC validation tests
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHAT]
Reduce the seven KUnit tests for amdgpu_dm_plane_validate_dcc() to three.
[HOW]
Split them into a table-driven test for the checks that run before the DC capability query and a table-driven test for the rejections that come out of it, leaving the success and scan-mapping test unchanged.
--- .../amdgpu_dm/tests/amdgpu_dm_plane_test.c | 248 ++++++------------ 1 file changed, 76 insertions(+), 172 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +76 -172
@@ -633,152 +633,95 @@ static void dm_test_helper_check_state_viewport_reject(struct kunit *test) }/** -* dm_test_validate_dcc_disabled_returns_success() - Verify disabled DCC is accepted. +* dm_test_validate_dcc_early_exits() - Verify the checks before the DC query. * @test: KUnit test context. * -* Verify if DCC validation succeeds when DCC is disabled. +* Verify if disabled DCC is accepted without consulting DC, and if a video +* format on a pre-GFX12 device and a missing capability callback are rejected. */ -static void dm_test_validate_dcc_disabled_returns_success (struct kunit *test) +static void dm_test_validate_dcc_early_exits (struct kunit *test) { -struct amdgpu_device *adev; -struct dc *dc; -struct dc_tiling_info tiling_info = {0 }; -struct dc_plane_dcc_param dcc = {0 }; -struct dc_plane_address address = {0 }; -struct plane_size plane_size = {0 }; - -dm_test_init_validate_dcc_inputs (&adev, &dc, &tiling_info, &dcc, &address, - &plane_size, test); - dcc.enable =0 ; - -KUNIT_EXPECT_EQ (test, -amdgpu_dm_plane_validate_dcc (adev,SURFACE_PIXEL_FORMAT_GRPH_ARGB8888 , -ROTATION_ANGLE_0 , &tiling_info, &dcc, - &address, &plane_size), -0 ); -} - -/** -* dm_test_validate_dcc_video_non_gfx12_fails() - Verify video format restriction on pre-GFX12. -* @test: KUnit test context. -* -* Verify if video format DCC validation fails on non-GFX12 devices. -*/ -static void dm_test_validate_dcc_video_non_gfx12_fails (struct kunit *test) -{ -struct amdgpu_device *adev; -struct dc *dc; -struct dc_tiling_info tiling_info = {0 }; -struct dc_plane_dcc_param dcc = {0 }; -struct dc_plane_address address = {0 }; -struct plane_size plane_size = {0 }; - -dm_test_init_validate_dcc_inputs (&adev, &dc, &tiling_info, &dcc, &address, - &plane_size, test); - adev->family =AMDGPU_FAMILY_NV ; - -KUNIT_EXPECT_EQ (test, -amdgpu_dm_plane_validate_dcc (adev, SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr, -ROTATION_ANGLE_0 , &tiling_info, &dcc, - &address, &plane_size), - -EINVAL ); -} - -/** -* dm_test_validate_dcc_missing_cap_func_fails() - Verify missing capability callback fails. -* @test: KUnit test context. -* -* Verify if validation fails when DCC capability callback is not provided. -*/ -static void dm_test_validate_dcc_missing_cap_func_fails (struct kunit *test) -{ -struct amdgpu_device *adev; -struct dc *dc; -struct dc_tiling_info tiling_info = {0 }; -struct dc_plane_dcc_param dcc = {0 }; -struct dc_plane_address address = {0 }; -struct plane_size plane_size = {0 }; - -dm_test_init_validate_dcc_inputs (&adev, &dc, &tiling_info, &dcc, &address, - &plane_size, test); - dc->cap_funcs.get_dcc_compression_cap =NULL ; - -KUNIT_EXPECT_EQ (test, -amdgpu_dm_plane_validate_dcc (adev,SURFACE_PIXEL_FORMAT_GRPH_ARGB8888 , -ROTATION_ANGLE_0 , &tiling_info, &dcc, - &address, &plane_size), - -EINVAL ); -} - -/** -* dm_test_validate_dcc_cap_callback_fails() - Verify callback failure path. -* @test: KUnit test context. -* -* Verify if validation fails when the DCC capability callback returns false. -*/ -static void dm_test_validate_dcc_cap_callback_fails (struct kunit *test) -{ -struct amdgpu_device *adev; -struct dc *dc; -struct dc_tiling_info tiling_info = {0 }; -struct dc_plane_dcc_param dcc = {0 }; -struct dc_plane_address address = {0 }; -struct plane_size plane_size = {0 }; -enum surface_pixel_format format =SURFACE_PIXEL_FORMAT_GRPH_ARGB8888 ; -enum dc_rotation_angle rotation =ROTATION_ANGLE_0 ; -struct dm_test_dcc_cap_ctx ctx = { - .callback_ret = false, - .capable = true, +static const struct { +const char *name; +bool dcc_enable; +enum surface_pixel_format format; +int expected; + } cases[] = { + {"dcc disabled" , false,SURFACE_PIXEL_FORMAT_GRPH_ARGB8888 ,0 }, + {"video before gfx12" , true, SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr, -EINVAL }, + {"no capability callback" , true,SURFACE_PIXEL_FORMAT_GRPH_ARGB8888 , -EINVAL }, }; -int ret; - -dm_test_init_validate_dcc_inputs (&adev, &dc, &tiling_info, &dcc, &address, - &plane_size, test); - dc->cap_funcs.get_dcc_compression_cap = dm_test_get_dcc_compression_cap; - dm_test_dcc_ctx = &ctx; - - ret =amdgpu_dm_plane_validate_dcc (adev, format, rotation, &tiling_info, - &dcc, &address, &plane_size); -KUNIT_EXPECT_EQ (test, ret, -EINVAL ); -KUNIT_EXPECT_TRUE (test, ctx.called); +unsigned int i; - dm_test_dcc_ctx =NULL ; +for (i =0 ; i <ARRAY_SIZE (cases); i++) { +struct amdgpu_device *adev; +struct dc *dc; +struct dc_tiling_info tiling_info = {0 }; +struct dc_plane_dcc_param dcc = {0 }; +struct dc_plane_address address = {0 }; +struct plane_size plane_size = {0 }; +int ret; + +dm_test_init_validate_dcc_inputs (&adev, &dc, &tiling_info, &dcc, &address, + &plane_size, test); + dcc.enable = cases[i].dcc_enable; + + ret =amdgpu_dm_plane_validate_dcc (adev, cases[i].format,ROTATION_ANGLE_0 , + &tiling_info, &dcc, &address, &plane_size); +KUNIT_EXPECT_EQ_MSG (test, ret, cases[i].expected,"%s" , cases[i].name); + } }/** -* dm_test_validate_dcc_not_capable_fails() - Verify not-capable callback output. +* dm_test_validate_dcc_rejects_from_cap() - Verify rejections from the DC query. * @test: KUnit test context. * -* Verify if validation fails when the DCC capability callback reports that the -* surface is not DCC capable. +* Verify if a failing capability callback, a surface reported as not DCC +* capable, and an independent_64b_blks mismatch are all rejected. */ -static void dm_test_validate_dcc_not_capable_fails (struct kunit *test) +static void dm_test_validate_dcc_rejects_from_cap (struct kunit *test) { -struct amdgpu_device *adev; -struct dc *dc; -struct dc_tiling_info tiling_info = {0 }; -struct dc_plane_dcc_param dcc = {0 }; -struct dc_plane_address address = {0 }; -struct plane_size plane_size = {0 }; -enum surface_pixel_format format =SURFACE_PIXEL_FORMAT_GRPH_ARGB8888 ; -enum dc_rotation_angle rotation =ROTATION_ANGLE_0 ; -struct dm_test_dcc_cap_ctx ctx = { - .callback_ret = true, - .capable = false, +static const struct { +const char *name; +bool callback_ret; +bool capable; +bool output_independent_64b_blks; +u32 independent_64b_blks; + } cases[] = { + {"callback fails" , false, true, false,1 }, + {"not capable" , true, false, false,1 }, + {"independent 64B mismatch" , true, true, true,0 }, }; -int ret; - -dm_test_init_validate_dcc_inputs (&adev, &dc, &tiling_info, &dcc, &address, - &plane_size, test); - dc->cap_funcs.get_dcc_compression_cap = dm_test_get_dcc_compression_cap; - dm_test_dcc_ctx = &ctx; - - ret =amdgpu_dm_plane_validate_dcc (adev, format, rotation, &tiling_info, - &dcc, &address, &plane_size); -KUNIT_EXPECT_EQ (test, ret, -EINVAL ); -KUNIT_EXPECT_TRUE (test, ctx.called); +unsigned int i; - dm_test_dcc_ctx =NULL ; +for (i =0 ; i <ARRAY_SIZE (cases); i++) { +struct amdgpu_device *adev; +struct dc *dc; +struct dc_tiling_info tiling_info = {0 }; +struct dc_plane_dcc_param dcc = {0 }; +struct dc_plane_address address = {0 }; +struct plane_size plane_size = {0 }; +struct dm_test_dcc_cap_ctx ctx = { + .callback_ret = cases[i].callback_ret, + .capable = cases[i].capable, + .output_independent_64b_blks = cases[i].output_independent_64b_blks, + }; +int ret; + +dm_test_init_validate_dcc_inputs (&adev, &dc, &tiling_info, &dcc, &address, + &plane_size, test); + dcc.independent_64b_blks = cases[i].independent_64b_blks; + dc->cap_funcs.get_dcc_compression_cap = dm_test_get_dcc_compression_cap; + dm_test_dcc_ctx = &ctx; + + ret =amdgpu_dm_plane_validate_dcc (adev,SURFACE_PIXEL_FORMAT_GRPH_ARGB8888 , +ROTATION_ANGLE_0 , &tiling_info, &dcc, + &address, &plane_size); + dm_test_dcc_ctx =NULL ; + +KUNIT_EXPECT_EQ_MSG (test, ret, -EINVAL ,"%s" , cases[i].name); +KUNIT_EXPECT_TRUE_MSG (test, ctx.called,"%s" , cases[i].name); + } }/**
@@ -819,41 +762,6 @@ static void dm_test_validate_dcc_success_and_scan_mapping(struct kunit *test) dm_test_dcc_ctx =NULL ; } -/** -* dm_test_validate_dcc_independent_64b_mismatch_fails() - Verify 64B compatibility check. -* @test: KUnit test context. -* -* Verify if validation fails when independent_64b_blks values do not match. -*/ -static void dm_test_validate_dcc_independent_64b_mismatch_fails (struct kunit *test) -{ -struct amdgpu_device *adev; -struct dc *dc; -struct dc_tiling_info tiling_info = {0 }; -struct dc_plane_dcc_param dcc = {0 }; -struct dc_plane_address address = {0 }; -struct plane_size plane_size = {0 }; -struct dm_test_dcc_cap_ctx ctx = { - .callback_ret = true, - .capable = true, - .output_independent_64b_blks = true, - }; - -dm_test_init_validate_dcc_inputs (&adev, &dc, &tiling_info, &dcc, &address, - &plane_size, test); - dcc.independent_64b_blks =0 ; - dc->cap_funcs.get_dcc_compression_cap = dm_test_get_dcc_compression_cap; - dm_test_dcc_ctx = &ctx; - -KUNIT_EXPECT_EQ (test, -amdgpu_dm_plane_validate_dcc (adev,SURFACE_PIXEL_FORMAT_GRPH_ARGB8888 , -ROTATION_ANGLE_0 , &tiling_info, &dcc, - &address, &plane_size), - -EINVAL ); - - dm_test_dcc_ctx =NULL ; -} -/** * dm_test_add_modifier_appends_and_grows() - Verify append and capacity growth. * @test: KUnit test context.
@@ -3876,13 +3784,9 @@ static struct kunit_case amdgpu_dm_plane_test_cases[] = {/* amdgpu_dm_plane_fill_gfx9_tiling_info_from_modifier() */ KUNIT_CASE (dm_test_fill_gfx9_tiling_info_from_modifier),/* amdgpu_dm_plane_validate_dcc() */ -KUNIT_CASE (dm_test_validate_dcc_disabled_returns_success), -KUNIT_CASE (dm_test_validate_dcc_video_non_gfx12_fails), -KUNIT_CASE (dm_test_validate_dcc_missing_cap_func_fails), -KUNIT_CASE (dm_test_validate_dcc_cap_callback_fails), -KUNIT_CASE (dm_test_validate_dcc_not_capable_fails), +KUNIT_CASE (dm_test_validate_dcc_early_exits), +KUNIT_CASE (dm_test_validate_dcc_rejects_from_cap),KUNIT_CASE (dm_test_validate_dcc_success_and_scan_mapping), -KUNIT_CASE (dm_test_validate_dcc_independent_64b_mismatch_fails),/* amdgpu_dm_plane_init() */ KUNIT_CASE (dm_test_plane_init_creates_optional_properties), KUNIT_CASE(dm_test_plane_init_creates_color_pipeline),
Signature · 1 line
2.55.0
PATCH 19/64 drm/amd/display: Fold DCC block mode tests
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHAT]
Reduce the five KUnit tests for the GFX9 DCC block modes of amdgpu_dm_plane_fill_gfx9_attrs_from_modifiers() to one, and the three for amdgpu_dm_plane_fill_gfx12_attrs_from_modifiers() to one.
[HOW]
Drive both from a table of modifier bits and the expected HUBP independent block mode, allocating the device, DC and framebuffer once and resetting the tiling, DCC and address outputs per row.
--- .../amdgpu_dm/tests/amdgpu_dm_plane_test.c | 414 ++++-------------- 1 file changed, 86 insertions(+), 328 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +86 -328
@@ -492,65 +492,6 @@ static void dm_test_format_mod_supported(struct kunit *test) listed_mod)); } -/** -* dm_test_fill_gfx12_plane_attributes_from_modifiers() - Verify GFX12 DCC mapping path. -* @test: KUnit test context. -* -* Verify if GFX12 modifier parsing enables DCC and sets expected DCC block mode. -*/ -static void dm_test_fill_gfx12_plane_attributes_from_modifiers (struct kunit *test) -{ -struct amdgpu_device *adev; -struct dc *dc; -struct amdgpu_framebuffer *afb; -struct plane_size plane_size = {0 }; -struct dc_tiling_info tiling_info = {0 }; -struct dc_plane_dcc_param dcc = {0 }; -struct dc_plane_address address = {0 }; -struct dm_test_dcc_cap_ctx ctx = { - .callback_ret = true, - .capable = true, - .output_independent_64b_blks = false, - }; - - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); - dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); - afb =kunit_kzalloc (test,sizeof (*afb),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, adev); -KUNIT_ASSERT_NOT_NULL (test, dc); -KUNIT_ASSERT_NOT_NULL (test, afb); - - adev->family =AMDGPU_FAMILY_GC_12_0_0 ; - adev->dm.dc = dc; - adev->gfx.config.gb_addr_config_fields.num_pipes =2 ; - adev->gfx.config.gb_addr_config_fields.num_banks =4 ; - adev->gfx.config.gb_addr_config_fields.pipe_interleave_size =256 ; - adev->gfx.config.gb_addr_config_fields.num_se =1 ; - adev->gfx.config.gb_addr_config_fields.max_compress_frags =2 ; - adev->gfx.config.gb_addr_config_fields.num_rb_per_se =1 ; - dc->cap_funcs.get_dcc_compression_cap = dm_test_get_dcc_compression_cap; - dm_test_dcc_ctx = &ctx; - - afb->base.modifier =AMD_FMT_MOD | -AMD_FMT_MOD_SET (TILE ,AMD_FMT_MOD_TILE_GFX12_64K_2D ) | -AMD_FMT_MOD_SET (TILE_VERSION ,AMD_FMT_MOD_TILE_VER_GFX12 ) | -AMD_FMT_MOD_SET (DCC ,1 ) | -AMD_FMT_MOD_SET (DCC_MAX_COMPRESSED_BLOCK ,1 ); - plane_size.surface_size.width =1920 ; - plane_size.surface_size.height =1080 ; - -KUNIT_EXPECT_EQ (test, -amdgpu_dm_plane_fill_gfx12_attrs_from_modifiers ( - adev, afb,SURFACE_PIXEL_FORMAT_GRPH_ARGB8888 , -ROTATION_ANGLE_0 , &plane_size, &tiling_info, &dcc, &address), -0 ); -KUNIT_EXPECT_EQ (test, (int )tiling_info.gfxversion, (int )DcGfxAddr3); -KUNIT_EXPECT_TRUE (test, dcc.enable); -KUNIT_EXPECT_EQ (test, (int )dcc.dcc_ind_blk, (int )hubp_ind_block_128b); - - dm_test_dcc_ctx =NULL ; -} -/** * dm_test_fill_gfx9_plane_attributes_from_modifiers() - Verify basic GFX9 linear modifier path. * @test: KUnit test context.
@@ -1502,148 +1443,36 @@ static void dm_test_fill_gfx9_plane_attributes_validate_fails(struct kunit *test }/** -* dm_test_fill_gfx9_plane_attributes_dcc_rbplus_64b_no_128bcl() - Verify block mode. +* dm_test_fill_gfx9_plane_attributes_dcc_ind_blk() - Verify DCC block modes. * @test: KUnit test context. * -* Verify if a GFX10-RBPLUS modifier with both 64B and 128B independent block -* bits selects the 64B-no-128BCL block mode. +* Verify if the independent 64B and 128B block bits of a GFX9 or GFX10-RBPLUS +* DCC modifier select the matching HUBP independent block mode. */ -static void dm_test_fill_gfx9_plane_attributes_dcc_rbplus_64b_no_128bcl (struct kunit *test) +static void dm_test_fill_gfx9_plane_attributes_dcc_ind_blk (struct kunit *test) { -struct amdgpu_device *adev; -struct dc *dc; -struct amdgpu_framebuffer *afb; +static const struct { +const char *name; +u64 tile_version; +bool independent_64b_blks; +bool independent_128b_blks; +int expected_ind_blk; + } cases[] = { + {"rbplus 64B no 128BCL" ,AMD_FMT_MOD_TILE_VER_GFX10_RBPLUS , true, true, + hubp_ind_block_64b_no_128bcl }, + {"rbplus 128B" ,AMD_FMT_MOD_TILE_VER_GFX10_RBPLUS , false, true, + hubp_ind_block_128b }, + {"rbplus unconstrained" ,AMD_FMT_MOD_TILE_VER_GFX10_RBPLUS , false, false, + hubp_ind_block_unconstrained }, + {"gfx9 64B" ,AMD_FMT_MOD_TILE_VER_GFX9 , true, false, hubp_ind_block_64b }, + {"gfx9 unconstrained" ,AMD_FMT_MOD_TILE_VER_GFX9 , false, false, + hubp_ind_block_unconstrained }, + };struct plane_size plane_size = {0 }; -struct dc_tiling_info tiling_info = {0 }; -struct dc_plane_dcc_param dcc = {0 }; -struct dc_plane_address address = {0 }; -struct dm_test_dcc_cap_ctx ctx = {0 }; -u64 tile_version =AMD_FMT_MOD_TILE_VER_GFX10_RBPLUS ; -int ret; - - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); - dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); - afb =kunit_kzalloc (test,sizeof (*afb),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, adev); -KUNIT_ASSERT_NOT_NULL (test, dc); -KUNIT_ASSERT_NOT_NULL (test, afb); - -dm_test_setup_gfx9_dcc_device (adev, dc, &ctx, true); - afb->base.modifier =dm_test_gfx9_dcc_modifier (tile_version, true, true); - plane_size.surface_size.width =1920 ; - plane_size.surface_size.height =1080 ; - - ret =dm_test_gfx9_attrs (adev, afb, &plane_size, &tiling_info, &dcc, - &address); -KUNIT_EXPECT_EQ (test, ret,0 ); -KUNIT_EXPECT_TRUE (test, dcc.enable); -KUNIT_EXPECT_EQ (test, (int )dcc.dcc_ind_blk, - (int )hubp_ind_block_64b_no_128bcl); - - dm_test_dcc_ctx =NULL ; -} - -/** -* dm_test_fill_gfx9_plane_attributes_dcc_rbplus_128b() - Verify 128B block mode. -* @test: KUnit test context. -* -* Verify if a GFX10-RBPLUS modifier with only the 128B independent block bit -* selects the 128B block mode. -*/ -static void dm_test_fill_gfx9_plane_attributes_dcc_rbplus_128b (struct kunit *test) -{struct amdgpu_device *adev; -struct dc *dc;struct amdgpu_framebuffer *afb; -struct plane_size plane_size = {0 }; -struct dc_tiling_info tiling_info = {0 }; -struct dc_plane_dcc_param dcc = {0 }; -struct dc_plane_address address = {0 }; -struct dm_test_dcc_cap_ctx ctx = {0 }; -u64 tile_version =AMD_FMT_MOD_TILE_VER_GFX10_RBPLUS ; -int ret; - - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); - dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); - afb =kunit_kzalloc (test,sizeof (*afb),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, adev); -KUNIT_ASSERT_NOT_NULL (test, dc); -KUNIT_ASSERT_NOT_NULL (test, afb); - -dm_test_setup_gfx9_dcc_device (adev, dc, &ctx, false); - afb->base.modifier =dm_test_gfx9_dcc_modifier (tile_version, false, true); - plane_size.surface_size.width =1920 ; - plane_size.surface_size.height =1080 ; - - ret =dm_test_gfx9_attrs (adev, afb, &plane_size, &tiling_info, &dcc, - &address); -KUNIT_EXPECT_EQ (test, ret,0 ); -KUNIT_EXPECT_TRUE (test, dcc.enable); -KUNIT_EXPECT_EQ (test, (int )dcc.dcc_ind_blk, (int )hubp_ind_block_128b); - - dm_test_dcc_ctx =NULL ; -} - -/** -* dm_test_fill_gfx9_plane_attributes_dcc_rbplus_unconstrained() - Verify block mode. -* @test: KUnit test context. -* -* Verify if a GFX10-RBPLUS modifier without independent block bits selects the -* unconstrained block mode. -*/ -static void dm_test_fill_gfx9_plane_attributes_dcc_rbplus_unconstrained (struct kunit *test) -{ -struct amdgpu_device *adev;struct dc *dc; -struct amdgpu_framebuffer *afb; -struct plane_size plane_size = {0 }; -struct dc_tiling_info tiling_info = {0 }; -struct dc_plane_dcc_param dcc = {0 }; -struct dc_plane_address address = {0 }; -struct dm_test_dcc_cap_ctx ctx = {0 }; -u64 tile_version =AMD_FMT_MOD_TILE_VER_GFX10_RBPLUS ; -int ret; - - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); - dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); - afb =kunit_kzalloc (test,sizeof (*afb),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, adev); -KUNIT_ASSERT_NOT_NULL (test, dc); -KUNIT_ASSERT_NOT_NULL (test, afb); - -dm_test_setup_gfx9_dcc_device (adev, dc, &ctx, false); - afb->base.modifier =dm_test_gfx9_dcc_modifier (tile_version, false, false); - plane_size.surface_size.width =1920 ; - plane_size.surface_size.height =1080 ; - - ret =dm_test_gfx9_attrs (adev, afb, &plane_size, &tiling_info, &dcc, - &address); -KUNIT_EXPECT_EQ (test, ret,0 ); -KUNIT_EXPECT_TRUE (test, dcc.enable); -KUNIT_EXPECT_EQ (test, (int )dcc.dcc_ind_blk, - (int )hubp_ind_block_unconstrained); - - dm_test_dcc_ctx =NULL ; -} - -/** -* dm_test_fill_gfx9_plane_attributes_dcc_gfx9_64b() - Verify legacy 64B mode. -* @test: KUnit test context. -* -* Verify if a pre-RBPLUS GFX9 modifier with the 64B independent block bit -* selects the 64B block mode. -*/ -static void dm_test_fill_gfx9_plane_attributes_dcc_gfx9_64b (struct kunit *test) -{ -struct amdgpu_device *adev; -struct dc *dc; -struct amdgpu_framebuffer *afb; -struct plane_size plane_size = {0 }; -struct dc_tiling_info tiling_info = {0 }; -struct dc_plane_dcc_param dcc = {0 }; -struct dc_plane_address address = {0 }; -struct dm_test_dcc_cap_ctx ctx = {0 }; -int ret; +unsigned int i; adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL );
@@ -1652,138 +1481,62 @@ static void dm_test_fill_gfx9_plane_attributes_dcc_gfx9_64b(struct kunit *test)KUNIT_ASSERT_NOT_NULL (test, dc);KUNIT_ASSERT_NOT_NULL (test, afb); -dm_test_setup_gfx9_dcc_device (adev, dc, &ctx, true); - afb->base.modifier =dm_test_gfx9_dcc_modifier (AMD_FMT_MOD_TILE_VER_GFX9 , - true, false); plane_size.surface_size.width =1920 ; plane_size.surface_size.height =1080 ; - ret =dm_test_gfx9_attrs (adev, afb, &plane_size, &tiling_info, &dcc, - &address); -KUNIT_EXPECT_EQ (test, ret,0 ); -KUNIT_EXPECT_TRUE (test, dcc.enable); -KUNIT_EXPECT_EQ (test, (int )dcc.dcc_ind_blk, (int )hubp_ind_block_64b); - - dm_test_dcc_ctx =NULL ; -} - -/** -* dm_test_fill_gfx9_plane_attributes_dcc_gfx9_unconstrained() - Verify legacy mode. -* @test: KUnit test context. -* -* Verify if a pre-RBPLUS GFX9 modifier without the 64B independent block bit -* selects the unconstrained block mode. -*/ -static void dm_test_fill_gfx9_plane_attributes_dcc_gfx9_unconstrained (struct kunit *test) -{ -struct amdgpu_device *adev; -struct dc *dc; -struct amdgpu_framebuffer *afb; -struct plane_size plane_size = {0 }; -struct dc_tiling_info tiling_info = {0 }; -struct dc_plane_dcc_param dcc = {0 }; -struct dc_plane_address address = {0 }; -struct dm_test_dcc_cap_ctx ctx = {0 }; -int ret; - - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); - dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); - afb =kunit_kzalloc (test,sizeof (*afb),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, adev); -KUNIT_ASSERT_NOT_NULL (test, dc); -KUNIT_ASSERT_NOT_NULL (test, afb); +for (i =0 ; i <ARRAY_SIZE (cases); i++) { +struct dc_tiling_info tiling_info = {0 }; +struct dc_plane_dcc_param dcc = {0 }; +struct dc_plane_address address = {0 }; +struct dm_test_dcc_cap_ctx ctx = {0 }; +int ret; -dm_test_setup_gfx9_dcc_device (adev, dc, &ctx, false); - afb->base.modifier =dm_test_gfx9_dcc_modifier (AMD_FMT_MOD_TILE_VER_GFX9 , - false, false); - plane_size.surface_size.width =1920 ; - plane_size.surface_size.height =1080 ; +dm_test_setup_gfx9_dcc_device (adev, dc, &ctx, cases[i].independent_64b_blks); + afb->base.modifier =dm_test_gfx9_dcc_modifier (cases[i].tile_version, + cases[i].independent_64b_blks, + cases[i].independent_128b_blks); - ret =dm_test_gfx9_attrs (adev, afb, &plane_size, &tiling_info, &dcc, - &address); -KUNIT_EXPECT_EQ (test, ret,0 ); -KUNIT_EXPECT_TRUE (test, dcc.enable); -KUNIT_EXPECT_EQ (test, (int )dcc.dcc_ind_blk, - (int )hubp_ind_block_unconstrained); + ret =dm_test_gfx9_attrs (adev, afb, &plane_size, &tiling_info, &dcc, + &address); + dm_test_dcc_ctx =NULL ; - dm_test_dcc_ctx =NULL ; +KUNIT_EXPECT_EQ_MSG (test, ret,0 ,"%s" , cases[i].name); +KUNIT_EXPECT_TRUE_MSG (test, dcc.enable,"%s" , cases[i].name); +KUNIT_EXPECT_EQ_MSG (test, (int )dcc.dcc_ind_blk, cases[i].expected_ind_blk, +"%s" , cases[i].name); + } }/** -* dm_test_fill_gfx12_plane_attributes_block0() - Verify GFX12 64B max-compressed-block path. +* dm_test_fill_gfx12_plane_attributes_dcc_blocks() - Verify GFX12 DCC blocks. * @test: KUnit test context. * -* Verify if a zero max-compressed-block modifier selects the 64B independent -* block mode on GFX12. +* Verify if the max-compressed-block field of a GFX12 DCC modifier selects the +* matching HUBP independent block mode and independent 64B flag, and if the +* GFX addr3 tiling version is reported. */ -static void dm_test_fill_gfx12_plane_attributes_block0 (struct kunit *test) +static void dm_test_fill_gfx12_plane_attributes_dcc_blocks (struct kunit *test) { -struct amdgpu_device *adev; -struct dc *dc; -struct amdgpu_framebuffer *afb; -struct plane_size plane_size = {0 }; -struct dc_tiling_info tiling_info = {0 }; -struct dc_plane_dcc_param dcc = {0 }; -struct dc_plane_address address = {0 }; +static const struct { +const char *name; +u64 max_compressed_block; +bool independent_64b_blks; +int expected_ind_blk; + } cases[] = { + {"64B" ,0 , true, hubp_ind_block_64b }, + {"128B" ,1 , false, hubp_ind_block_128b }, + {"unconstrained" ,2 , false, hubp_ind_block_unconstrained }, + };struct dm_test_dcc_cap_ctx ctx = { .callback_ret = true, .capable = true, .output_independent_64b_blks = false, }; -int ret; - - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); - dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); - afb =kunit_kzalloc (test,sizeof (*afb),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, adev); -KUNIT_ASSERT_NOT_NULL (test, dc); -KUNIT_ASSERT_NOT_NULL (test, afb); - - adev->family =AMDGPU_FAMILY_GC_12_0_0 ; - adev->dm.dc = dc; - dc->cap_funcs.get_dcc_compression_cap = dm_test_get_dcc_compression_cap; - dm_test_dcc_ctx = &ctx; - - afb->base.modifier =AMD_FMT_MOD | -AMD_FMT_MOD_SET (TILE ,AMD_FMT_MOD_TILE_GFX12_64K_2D ) | -AMD_FMT_MOD_SET (TILE_VERSION ,AMD_FMT_MOD_TILE_VER_GFX12 ) | -AMD_FMT_MOD_SET (DCC ,1 ) | -AMD_FMT_MOD_SET (DCC_MAX_COMPRESSED_BLOCK ,0 ); - plane_size.surface_size.width =1920 ; - plane_size.surface_size.height =1080 ; - - ret =dm_test_gfx12_attrs (adev, afb, &plane_size, &tiling_info, &dcc, - &address); -KUNIT_EXPECT_EQ (test, ret,0 ); -KUNIT_EXPECT_TRUE (test, dcc.enable); -KUNIT_EXPECT_TRUE (test, dcc.independent_64b_blks); -KUNIT_EXPECT_EQ (test, (int )dcc.dcc_ind_blk, (int )hubp_ind_block_64b); - - dm_test_dcc_ctx =NULL ; -} - -/** -* dm_test_fill_gfx12_plane_attributes_block_unconstrained() - Verify block path. -* @test: KUnit test context. -* -* Verify if a max-compressed-block value above one selects the unconstrained -* independent block mode on GFX12. -*/ -static void dm_test_fill_gfx12_plane_attributes_block_unconstrained (struct kunit *test) -{ +struct plane_size plane_size = {0 };struct amdgpu_device *adev; -struct dc *dc;struct amdgpu_framebuffer *afb; -struct plane_size plane_size = {0 }; -struct dc_tiling_info tiling_info = {0 }; -struct dc_plane_dcc_param dcc = {0 }; -struct dc_plane_address address = {0 }; -struct dm_test_dcc_cap_ctx ctx = { - .callback_ret = true, - .capable = true, - .output_independent_64b_blks = false, - }; -int ret; +struct dc *dc; +unsigned int i; adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL );
@@ -1795,25 +1548,36 @@ static void dm_test_fill_gfx12_plane_attributes_block_unconstrained(struct kunit adev->family =AMDGPU_FAMILY_GC_12_0_0 ; adev->dm.dc = dc; dc->cap_funcs.get_dcc_compression_cap = dm_test_get_dcc_compression_cap; - dm_test_dcc_ctx = &ctx; - - afb->base.modifier =AMD_FMT_MOD | -AMD_FMT_MOD_SET (TILE ,AMD_FMT_MOD_TILE_GFX12_64K_2D ) | -AMD_FMT_MOD_SET (TILE_VERSION ,AMD_FMT_MOD_TILE_VER_GFX12 ) | -AMD_FMT_MOD_SET (DCC ,1 ) | -AMD_FMT_MOD_SET (DCC_MAX_COMPRESSED_BLOCK ,2 ); plane_size.surface_size.width =1920 ; plane_size.surface_size.height =1080 ; - ret =dm_test_gfx12_attrs (adev, afb, &plane_size, &tiling_info, &dcc, - &address); -KUNIT_EXPECT_EQ (test, ret,0 ); -KUNIT_EXPECT_TRUE (test, dcc.enable); -KUNIT_EXPECT_FALSE (test, dcc.independent_64b_blks); -KUNIT_EXPECT_EQ (test, (int )dcc.dcc_ind_blk, - (int )hubp_ind_block_unconstrained); +for (i =0 ; i <ARRAY_SIZE (cases); i++) { +struct dc_tiling_info tiling_info = {0 }; +struct dc_plane_dcc_param dcc = {0 }; +struct dc_plane_address address = {0 }; +int ret; - dm_test_dcc_ctx =NULL ; + afb->base.modifier =AMD_FMT_MOD | +AMD_FMT_MOD_SET (TILE ,AMD_FMT_MOD_TILE_GFX12_64K_2D ) | +AMD_FMT_MOD_SET (TILE_VERSION ,AMD_FMT_MOD_TILE_VER_GFX12 ) | +AMD_FMT_MOD_SET (DCC ,1 ) | +AMD_FMT_MOD_SET (DCC_MAX_COMPRESSED_BLOCK , + cases[i].max_compressed_block); + dm_test_dcc_ctx = &ctx; + + ret =dm_test_gfx12_attrs (adev, afb, &plane_size, &tiling_info, &dcc, + &address); + dm_test_dcc_ctx =NULL ; + +KUNIT_EXPECT_EQ_MSG (test, ret,0 ,"%s" , cases[i].name); +KUNIT_EXPECT_EQ_MSG (test, (int )tiling_info.gfxversion, (int )DcGfxAddr3, +"%s" , cases[i].name); +KUNIT_EXPECT_TRUE_MSG (test, dcc.enable,"%s" , cases[i].name); +KUNIT_EXPECT_EQ_MSG (test, (bool )dcc.independent_64b_blks, + cases[i].independent_64b_blks,"%s" , cases[i].name); +KUNIT_EXPECT_EQ_MSG (test, (int )dcc.dcc_ind_blk, cases[i].expected_ind_blk, +"%s" , cases[i].name); + } }/**
@@ -3712,19 +3476,13 @@ static struct kunit_case amdgpu_dm_plane_test_cases[] = {KUNIT_CASE (dm_test_format_mod_supported_d_swizzle_reject),KUNIT_CASE (dm_test_format_mod_supported_gfx6),/* amdgpu_dm_plane_fill_gfx12_attrs_from_modifiers() */ -KUNIT_CASE (dm_test_fill_gfx12_plane_attributes_from_modifiers), -KUNIT_CASE (dm_test_fill_gfx12_plane_attributes_block0), -KUNIT_CASE (dm_test_fill_gfx12_plane_attributes_block_unconstrained), +KUNIT_CASE (dm_test_fill_gfx12_plane_attributes_dcc_blocks),KUNIT_CASE (dm_test_fill_gfx12_plane_attributes_validate_fails),/* amdgpu_dm_plane_fill_gfx9_attrs_from_modifiers() */ KUNIT_CASE (dm_test_fill_gfx9_plane_attributes_from_modifiers),KUNIT_CASE (dm_test_fill_gfx9_plane_attributes_dcc),KUNIT_CASE (dm_test_fill_gfx9_plane_attributes_validate_fails), -KUNIT_CASE (dm_test_fill_gfx9_plane_attributes_dcc_rbplus_64b_no_128bcl), -KUNIT_CASE (dm_test_fill_gfx9_plane_attributes_dcc_rbplus_128b), -KUNIT_CASE (dm_test_fill_gfx9_plane_attributes_dcc_rbplus_unconstrained), -KUNIT_CASE (dm_test_fill_gfx9_plane_attributes_dcc_gfx9_64b), -KUNIT_CASE (dm_test_fill_gfx9_plane_attributes_dcc_gfx9_unconstrained), +KUNIT_CASE (dm_test_fill_gfx9_plane_attributes_dcc_ind_blk),/* amdgpu_dm_plane_helper_check_state() */ KUNIT_CASE (dm_test_helper_check_state_viewport_reject), KUNIT_CASE(dm_test_helper_check_state_small_viewport_width),
Signature · 1 line
2.55.0
PATCH 20/64 drm/amd/display: Fold plane scaling and cursor tests
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHAT]
Reduce the two KUnit tests for amdgpu_dm_plane_get_min_max_dc_plane_scaling() to one, and the two for amdgpu_dm_plane_get_cursor_position() to one.
[HOW]
Populate the fp16 scaling caps alongside the NV12 and ARGB8888 ones and query all three formats from one device, and append the oversized cursor rejection to the existing clipping test.
--- .../amdgpu_dm/tests/amdgpu_dm_plane_test.c | 93 ++++--------------- 1 file changed, 17 insertions(+), 76 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +17 -76
@@ -352,7 +352,8 @@ static void dm_test_fill_dc_scaling_info(struct kunit *test)* dm_test_get_min_max_dc_plane_scaling() - Verify format-specific cap selection and 1->1000 conversion. * @test: KUnit test context. * -* Verify if min/max scaling values are correct for NV12 and XRGB8888 formats. +* Verify if min/max scaling values are correct for the NV12, XRGB8888 and fp16 +* caps. */ static void dm_test_get_min_max_dc_plane_scaling (struct kunit *test) {
@@ -374,6 +375,8 @@ static void dm_test_get_min_max_dc_plane_scaling(struct kunit *test) dc->caps.planes[0 ].max_downscale_factor.nv12 =1 ; dc->caps.planes[0 ].max_upscale_factor.argb8888 =1600 ; dc->caps.planes[0 ].max_downscale_factor.argb8888 =250 ; + dc->caps.planes[0 ].max_upscale_factor.fp16 =2000 ; + dc->caps.planes[0 ].max_downscale_factor.fp16 =500 ; fb->format =drm_format_info (DRM_FORMAT_NV12 );KUNIT_ASSERT_NOT_NULL (test, fb->format);
@@ -386,13 +389,20 @@ static void dm_test_get_min_max_dc_plane_scaling(struct kunit *test)amdgpu_dm_plane_get_min_max_dc_plane_scaling (&adev->ddev, fb, &min_downscale, &max_upscale);KUNIT_EXPECT_EQ (test, min_downscale,250 );KUNIT_EXPECT_EQ (test, max_upscale,1600 ); + + fb->format =drm_format_info (DRM_FORMAT_ARGB16161616F ); +KUNIT_ASSERT_NOT_NULL (test, fb->format); +amdgpu_dm_plane_get_min_max_dc_plane_scaling (&adev->ddev, fb, &min_downscale, &max_upscale); +KUNIT_EXPECT_EQ (test, min_downscale,500 ); +KUNIT_EXPECT_EQ (test, max_upscale,2000 ); }/** * dm_test_get_cursor_position() - Verify cursor clipping and off-screen handling. * @test: KUnit test context. * -* Verify if cursor clipping, hotspot adjustment, and off-screen disable behavior work. +* Verify if cursor clipping, hotspot adjustment, off-screen disable behavior +* and the oversized-cursor rejection work. */ static void dm_test_get_cursor_position (struct kunit *test) {
@@ -443,6 +453,11 @@ static void dm_test_get_cursor_position(struct kunit *test)amdgpu_dm_plane_get_cursor_position (plane, &amdgpu_crtc->base, &position), 0);KUNIT_EXPECT_FALSE (test, position.enable); + + state->crtc_w =128 ; +KUNIT_EXPECT_EQ (test, +amdgpu_dm_plane_get_cursor_position (plane, &amdgpu_crtc->base, &position), + -EINVAL ); }/**
@@ -1718,39 +1733,6 @@ static void dm_test_fill_plane_buffer_attributes_gfx12(struct kunit *test)KUNIT_EXPECT_EQ (test, (int )tiling_info.gfxversion, (int )DcGfxAddr3); } -/** -* dm_test_get_min_max_dc_plane_scaling_fp16() - Verify fp16 cap selection. -* @test: KUnit test context. -* -* Verify if 64bpp fp16 formats use the fp16 scaling caps. -*/ -static void dm_test_get_min_max_dc_plane_scaling_fp16 (struct kunit *test) -{ -struct amdgpu_device *adev; -struct dc *dc; -struct drm_framebuffer *fb; -int min_downscale =0 ; -int max_upscale =0 ; - - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); - dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); - fb =kunit_kzalloc (test,sizeof (*fb),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, adev); -KUNIT_ASSERT_NOT_NULL (test, dc); -KUNIT_ASSERT_NOT_NULL (test, fb); - - adev->dm.dc = dc; - dc->caps.planes[0 ].max_upscale_factor.fp16 =2000 ; - dc->caps.planes[0 ].max_downscale_factor.fp16 =500 ; - - fb->format =drm_format_info (DRM_FORMAT_ARGB16161616F ); -KUNIT_ASSERT_NOT_NULL (test, fb->format); -amdgpu_dm_plane_get_min_max_dc_plane_scaling (&adev->ddev, fb, - &min_downscale, &max_upscale); -KUNIT_EXPECT_EQ (test, min_downscale,500 ); -KUNIT_EXPECT_EQ (test, max_upscale,2000 ); -} -/** * dm_test_helper_check_state_small_viewport_width() - Verify width rejection. * @test: KUnit test context.
@@ -2024,45 +2006,6 @@ static void dm_test_fill_dc_scaling_info_plane_caps(struct kunit *test) 0); } -/** -* dm_test_get_cursor_position_bad_size() - Verify oversized cursor rejection. -* @test: KUnit test context. -* -* Verify if a cursor larger than the CRTC maximum is rejected. -*/ -static void dm_test_get_cursor_position_bad_size (struct kunit *test) -{ -struct amdgpu_device *adev; -struct amdgpu_crtc *amdgpu_crtc; -struct drm_plane *plane; -struct drm_plane_state *state; -struct drm_framebuffer *fb; -struct dc_cursor_position position = {0 }; - - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); - amdgpu_crtc =kunit_kzalloc (test,sizeof (*amdgpu_crtc),GFP_KERNEL ); - plane =kunit_kzalloc (test,sizeof (*plane),GFP_KERNEL ); - state =kunit_kzalloc (test,sizeof (*state),GFP_KERNEL ); - fb =kunit_kzalloc (test,sizeof (*fb),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, adev); -KUNIT_ASSERT_NOT_NULL (test, amdgpu_crtc); -KUNIT_ASSERT_NOT_NULL (test, plane); -KUNIT_ASSERT_NOT_NULL (test, state); -KUNIT_ASSERT_NOT_NULL (test, fb); - - amdgpu_crtc->max_cursor_width =64 ; - amdgpu_crtc->max_cursor_height =64 ; - plane->dev = &adev->ddev; - plane->state = state; - state->fb = fb; - state->crtc_w =128 ; - state->crtc_h =32 ; - -KUNIT_EXPECT_EQ (test, -amdgpu_dm_plane_get_cursor_position (plane, &amdgpu_crtc->base, &position), - -EINVAL ); -} -/** * dm_test_format_mod_supported_d_swizzle_reject() - Verify D swizzle rejection. * @test: KUnit test context.
@@ -3463,14 +3406,12 @@ static struct kunit_case amdgpu_dm_plane_test_cases[] = {KUNIT_CASE (dm_test_fill_dc_scaling_info_plane_caps),/* amdgpu_dm_plane_get_min_max_dc_plane_scaling() */ KUNIT_CASE (dm_test_get_min_max_dc_plane_scaling), -KUNIT_CASE (dm_test_get_min_max_dc_plane_scaling_fp16),/* amdgpu_dm_plane_fill_plane_buffer_attributes() */ KUNIT_CASE (dm_test_fill_plane_buffer_attributes_video),KUNIT_CASE (dm_test_fill_plane_buffer_attributes_gfx12),KUNIT_CASE (dm_test_fill_plane_buffer_attributes_gfx6),/* amdgpu_dm_plane_get_cursor_position() */ KUNIT_CASE (dm_test_get_cursor_position), -KUNIT_CASE (dm_test_get_cursor_position_bad_size),/* amdgpu_dm_plane_format_mod_supported() */ KUNIT_CASE (dm_test_format_mod_supported), KUNIT_CASE(dm_test_format_mod_supported_d_swizzle_reject),
Signature · 1 line
2.55.0
PATCH 21/64 drm/amd/display: Fold plane state check tests
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHAT]
Reduce the four viewport KUnit tests for amdgpu_dm_plane_helper_check_state() to one, and the three rejection tests for amdgpu_dm_plane_atomic_check() to one.
[HOW]
Drive the viewport cases from a table of CRTC rectangles and display sizes, and rebuild the atomic state between the helper-check, color pipeline conflict and scaling-info sub-cases of the atomic check test.
--- .../amdgpu_dm/tests/amdgpu_dm_plane_test.c | 256 ++++-------------- 1 file changed, 59 insertions(+), 197 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +59 -197
@@ -550,42 +550,63 @@ static void dm_test_fill_gfx9_plane_attributes_from_modifiers(struct kunit *test }/** -* dm_test_helper_check_state_viewport_reject() - Verify viewport outside screen rejects state. +* dm_test_helper_check_state_viewport_rejects() - Verify viewport rejections. * @test: KUnit test context. * -* Verify if plane state is rejected when the viewport is outside display bounds. +* Verify if a viewport outside the display bounds, or one clipped by an edge +* to below the minimum pipe-split width or height, is rejected. */ -static void dm_test_helper_check_state_viewport_reject (struct kunit *test) +static void dm_test_helper_check_state_viewport_rejects (struct kunit *test) { -struct drm_plane *plane; -struct drm_plane_state *state; -struct drm_crtc *crtc; -struct drm_crtc_state *new_crtc_state; -struct drm_framebuffer *fb; +static const struct { +const char *name; +int crtc_x; +int crtc_y; +int crtc_w; +int crtc_h; +int hdisplay; +int vdisplay; + } cases[] = { + {"outside the display" ,200 ,0 ,100 ,100 ,100 ,100 }, + {"width below minimum" ,0 ,0 ,10 ,100 ,1920 ,1080 }, + {"top-clipped height" ,-2 ,-95 ,100 ,100 ,1920 ,1080 }, + {"bottom-clipped height" ,0 ,95 ,100 ,100 ,1920 ,100 }, + }; +unsigned int i; - plane =kunit_kzalloc (test,sizeof (*plane),GFP_KERNEL ); - state =kunit_kzalloc (test,sizeof (*state),GFP_KERNEL ); - crtc =kunit_kzalloc (test,sizeof (*crtc),GFP_KERNEL ); - new_crtc_state =kunit_kzalloc (test,sizeof (*new_crtc_state),GFP_KERNEL ); - fb =kunit_kzalloc (test,sizeof (*fb),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, plane); -KUNIT_ASSERT_NOT_NULL (test, state); -KUNIT_ASSERT_NOT_NULL (test, crtc); -KUNIT_ASSERT_NOT_NULL (test, new_crtc_state); -KUNIT_ASSERT_NOT_NULL (test, fb); +for (i =0 ; i <ARRAY_SIZE (cases); i++) { +struct drm_plane *plane; +struct drm_plane_state *state; +struct drm_crtc *crtc; +struct drm_crtc_state *new_crtc_state; +struct drm_framebuffer *fb; +int ret; - plane->type =DRM_PLANE_TYPE_OVERLAY ; - state->plane = plane; - state->fb = fb; - state->crtc = crtc; - state->crtc_x =200 ; - state->crtc_y =0 ; - state->crtc_w =100 ; - state->crtc_h =100 ; - new_crtc_state->mode.crtc_hdisplay =100 ; - new_crtc_state->mode.crtc_vdisplay =100 ; + plane =kunit_kzalloc (test,sizeof (*plane),GFP_KERNEL ); + state =kunit_kzalloc (test,sizeof (*state),GFP_KERNEL ); + crtc =kunit_kzalloc (test,sizeof (*crtc),GFP_KERNEL ); + new_crtc_state =kunit_kzalloc (test,sizeof (*new_crtc_state),GFP_KERNEL ); + fb =kunit_kzalloc (test,sizeof (*fb),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, plane); +KUNIT_ASSERT_NOT_NULL (test, state); +KUNIT_ASSERT_NOT_NULL (test, crtc); +KUNIT_ASSERT_NOT_NULL (test, new_crtc_state); +KUNIT_ASSERT_NOT_NULL (test, fb); -KUNIT_EXPECT_EQ (test,amdgpu_dm_plane_helper_check_state (state, new_crtc_state), -EINVAL ); + plane->type =DRM_PLANE_TYPE_OVERLAY ; + state->plane = plane; + state->fb = fb; + state->crtc = crtc; + state->crtc_x = cases[i].crtc_x; + state->crtc_y = cases[i].crtc_y; + state->crtc_w = cases[i].crtc_w; + state->crtc_h = cases[i].crtc_h; + new_crtc_state->mode.crtc_hdisplay = cases[i].hdisplay; + new_crtc_state->mode.crtc_vdisplay = cases[i].vdisplay; + + ret =amdgpu_dm_plane_helper_check_state (state, new_crtc_state); +KUNIT_EXPECT_EQ_MSG (test, ret, -EINVAL ,"%s" , cases[i].name); + } }/**
@@ -1733,130 +1754,6 @@ static void dm_test_fill_plane_buffer_attributes_gfx12(struct kunit *test)KUNIT_EXPECT_EQ (test, (int )tiling_info.gfxversion, (int )DcGfxAddr3); } -/** -* dm_test_helper_check_state_small_viewport_width() - Verify width rejection. -* @test: KUnit test context. -* -* Verify if a viewport width below the minimum pipe-split width is rejected. -*/ -static void dm_test_helper_check_state_small_viewport_width (struct kunit *test) -{ -struct drm_plane *plane; -struct drm_plane_state *state; -struct drm_crtc *crtc; -struct drm_crtc_state *new_crtc_state; -struct drm_framebuffer *fb; - - plane =kunit_kzalloc (test,sizeof (*plane),GFP_KERNEL ); - state =kunit_kzalloc (test,sizeof (*state),GFP_KERNEL ); - crtc =kunit_kzalloc (test,sizeof (*crtc),GFP_KERNEL ); - new_crtc_state =kunit_kzalloc (test,sizeof (*new_crtc_state),GFP_KERNEL ); - fb =kunit_kzalloc (test,sizeof (*fb),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, plane); -KUNIT_ASSERT_NOT_NULL (test, state); -KUNIT_ASSERT_NOT_NULL (test, crtc); -KUNIT_ASSERT_NOT_NULL (test, new_crtc_state); -KUNIT_ASSERT_NOT_NULL (test, fb); - - plane->type =DRM_PLANE_TYPE_OVERLAY ; - state->plane = plane; - state->fb = fb; - state->crtc = crtc; - state->crtc_x =0 ; - state->crtc_y =0 ; - state->crtc_w =10 ; - state->crtc_h =100 ; - new_crtc_state->mode.crtc_hdisplay =1920 ; - new_crtc_state->mode.crtc_vdisplay =1080 ; - -KUNIT_EXPECT_EQ (test, -amdgpu_dm_plane_helper_check_state (state, new_crtc_state), - -EINVAL ); -} - -/** -* dm_test_helper_check_state_small_viewport_height() - Verify height rejection. -* @test: KUnit test context. -* -* Verify if a negative-offset viewport with a too-small height is rejected. -*/ -static void dm_test_helper_check_state_small_viewport_height (struct kunit *test) -{ -struct drm_plane *plane; -struct drm_plane_state *state; -struct drm_crtc *crtc; -struct drm_crtc_state *new_crtc_state; -struct drm_framebuffer *fb; - - plane =kunit_kzalloc (test,sizeof (*plane),GFP_KERNEL ); - state =kunit_kzalloc (test,sizeof (*state),GFP_KERNEL ); - crtc =kunit_kzalloc (test,sizeof (*crtc),GFP_KERNEL ); - new_crtc_state =kunit_kzalloc (test,sizeof (*new_crtc_state),GFP_KERNEL ); - fb =kunit_kzalloc (test,sizeof (*fb),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, plane); -KUNIT_ASSERT_NOT_NULL (test, state); -KUNIT_ASSERT_NOT_NULL (test, crtc); -KUNIT_ASSERT_NOT_NULL (test, new_crtc_state); -KUNIT_ASSERT_NOT_NULL (test, fb); - - plane->type =DRM_PLANE_TYPE_OVERLAY ; - state->plane = plane; - state->fb = fb; - state->crtc = crtc; - state->crtc_x =-2 ; - state->crtc_y =-95 ; - state->crtc_w =100 ; - state->crtc_h =100 ; - new_crtc_state->mode.crtc_hdisplay =1920 ; - new_crtc_state->mode.crtc_vdisplay =1080 ; - -KUNIT_EXPECT_EQ (test, -amdgpu_dm_plane_helper_check_state (state, new_crtc_state), - -EINVAL ); -} - -/** -* dm_test_helper_check_state_bottom_clipped_height() - Verify bottom clipping. -* @test: KUnit test context. -* -* Verify if a viewport clipped by the bottom edge to below the minimum height -* is rejected. -*/ -static void dm_test_helper_check_state_bottom_clipped_height (struct kunit *test) -{ -struct drm_plane *plane; -struct drm_plane_state *state; -struct drm_crtc *crtc; -struct drm_crtc_state *new_crtc_state; -struct drm_framebuffer *fb; - - plane =kunit_kzalloc (test,sizeof (*plane),GFP_KERNEL ); - state =kunit_kzalloc (test,sizeof (*state),GFP_KERNEL ); - crtc =kunit_kzalloc (test,sizeof (*crtc),GFP_KERNEL ); - new_crtc_state =kunit_kzalloc (test,sizeof (*new_crtc_state),GFP_KERNEL ); - fb =kunit_kzalloc (test,sizeof (*fb),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, plane); -KUNIT_ASSERT_NOT_NULL (test, state); -KUNIT_ASSERT_NOT_NULL (test, crtc); -KUNIT_ASSERT_NOT_NULL (test, new_crtc_state); -KUNIT_ASSERT_NOT_NULL (test, fb); - - plane->type =DRM_PLANE_TYPE_OVERLAY ; - state->plane = plane; - state->fb = fb; - state->crtc = crtc; - state->crtc_x =0 ; - state->crtc_y =95 ; - state->crtc_w =100 ; - state->crtc_h =100 ; - new_crtc_state->mode.crtc_hdisplay =1920 ; - new_crtc_state->mode.crtc_vdisplay =100 ; - -KUNIT_EXPECT_EQ (test, -amdgpu_dm_plane_helper_check_state (state, new_crtc_state), - -EINVAL ); -} -/** * dm_test_helper_check_state_scaling_caps() - Verify DC scaling caps are applied. * @test: KUnit test context.
@@ -2274,43 +2171,29 @@ static void dm_test_atomic_check_missing_crtc_state(struct kunit *test) }/** -* dm_test_atomic_check_helper_failure() - Verify helper-check failures return. +* dm_test_atomic_check_rejects() - Verify the checks before DC validation. * @test: KUnit test context. * * Verify if atomic_check returns before DC validation when the DRM helper state -* validation rejects the plane. +* validation rejects the plane, when both the plane COLOR_PIPELINE and the CRTC +* DEGAMMA_LUT are in use, and when filling the scaling info fails. */ -static void dm_test_atomic_check_helper_failure (struct kunit *test) +static void dm_test_atomic_check_rejects (struct kunit *test) {struct drm_atomic_commit *state;struct drm_plane *plane;struct dm_plane_state *dm_plane_state;struct drm_crtc_state *new_crtc_state;struct drm_framebuffer *fb; +struct amdgpu_device *adev; +void *color_pipeline; +void *degamma_lut;dm_test_init_atomic_check_state (test, &state, &plane, &dm_plane_state, &new_crtc_state, &fb); dm_plane_state->base.crtc_w =10 ;KUNIT_EXPECT_EQ (test,amdgpu_dm_plane_atomic_check (plane, state), -EINVAL ); -} - -/** -* dm_test_atomic_check_color_pipeline_conflict() - Verify color conflict rejection. -* @test: KUnit test context. -* -* Verify if atomic_check rejects use of both plane COLOR_PIPELINE and CRTC -* DEGAMMA_LUT before DC validation. -*/ -static void dm_test_atomic_check_color_pipeline_conflict (struct kunit *test) -{ -struct drm_atomic_commit *state; -struct drm_plane *plane; -struct dm_plane_state *dm_plane_state; -struct drm_crtc_state *new_crtc_state; -struct drm_framebuffer *fb; -void *color_pipeline; -void *degamma_lut;dm_test_init_atomic_check_state (test, &state, &plane, &dm_plane_state, &new_crtc_state, &fb);
@@ -2323,22 +2206,6 @@ static void dm_test_atomic_check_color_pipeline_conflict(struct kunit *test) new_crtc_state->degamma_lut = degamma_lut;KUNIT_EXPECT_EQ (test,amdgpu_dm_plane_atomic_check (plane, state), -EINVAL ); -} - -/** -* dm_test_atomic_check_scaling_failure() - Verify scaling-info failures return. -* @test: KUnit test context. -* -* Verify if atomic_check returns the scaling-info error before DC validation. -*/ -static void dm_test_atomic_check_scaling_failure (struct kunit *test) -{ -struct amdgpu_device *adev; -struct drm_atomic_commit *state; -struct drm_plane *plane; -struct dm_plane_state *dm_plane_state; -struct drm_crtc_state *new_crtc_state; -struct drm_framebuffer *fb; adev =dm_test_init_atomic_check_state (test, &state, &plane, &dm_plane_state, &new_crtc_state, &fb);
@@ -3425,10 +3292,7 @@ static struct kunit_case amdgpu_dm_plane_test_cases[] = {KUNIT_CASE (dm_test_fill_gfx9_plane_attributes_validate_fails),KUNIT_CASE (dm_test_fill_gfx9_plane_attributes_dcc_ind_blk),/* amdgpu_dm_plane_helper_check_state() */ -KUNIT_CASE (dm_test_helper_check_state_viewport_reject), -KUNIT_CASE (dm_test_helper_check_state_small_viewport_width), -KUNIT_CASE (dm_test_helper_check_state_small_viewport_height), -KUNIT_CASE (dm_test_helper_check_state_bottom_clipped_height), +KUNIT_CASE (dm_test_helper_check_state_viewport_rejects),KUNIT_CASE (dm_test_helper_check_state_scaling_caps),/* amdgpu_dm_plane_helper_prepare_fb() */ KUNIT_CASE(dm_test_helper_prepare_fb_no_fb),
@@ -3446,9 +3310,7 @@ static struct kunit_case amdgpu_dm_plane_test_cases[] = {/* amdgpu_dm_plane_atomic_check() */ KUNIT_CASE (dm_test_atomic_check_no_dc_state),KUNIT_CASE (dm_test_atomic_check_missing_crtc_state), -KUNIT_CASE (dm_test_atomic_check_helper_failure), -KUNIT_CASE (dm_test_atomic_check_color_pipeline_conflict), -KUNIT_CASE (dm_test_atomic_check_scaling_failure), +KUNIT_CASE (dm_test_atomic_check_rejects),KUNIT_CASE (dm_test_atomic_check_success),/* amdgpu_dm_plane_panic_flush() */ KUNIT_CASE(dm_test_panic_flush_no_dc_state),
Signature · 1 line
2.55.0
PATCH 22/64 drm/amd/display: Refactor DPP_PROGRAM_UPSP to drop pipe_ctx
In reply to George ZhangFrom: Piotr Maziarz <[email protected]>
[Why]
Hwss executors shouldn't be coupled to complex dc structs such as pipe_ctx. The DPP_PROGRAM_UPSP executor took a whole pipe_ctx only to reach two fields.
[How]
Change program_upsp_params to hold the dpp and the dscl_prog_data that dpp_program_upsp() actually needs, and extract them in the generic HWSS layer. Add hwss_add_dpp_program_upsp() so the build site uses a helper with the standard bounds check instead of assigning the step inline. Update the BLS specs.
--- .../drm/amd/display/dc/core/dc_hw_sequencer.c | 35 ++++++++++--------- .../drm/amd/display/dc/hwss/hw_sequencer.h | 8 ++++- 2 files changed, 26 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +19 -16
@@ -1023,11 +1023,9 @@ void hwss_build_full_sequence(struct dc *dc,if (current_pipe->plane_res.hubp->funcs->hubp_program_mcache_id_and_split_coordinate)hwss_add_hubp_program_mcache_id (&seq_state, current_pipe->plane_res.hubp, ¤t_pipe->mcache_regs); -if (current_pipe->plane_res.dpp->funcs->dpp_program_upsp) { - block_sequence[*num_steps].params.program_upsp_params.pipe_ctx = current_pipe; - block_sequence[*num_steps].func =DPP_PROGRAM_UPSP ; - (*num_steps)++; - } +if (current_pipe->plane_res.dpp->funcs->dpp_program_upsp) +hwss_add_dpp_program_upsp (&seq_state, current_pipe->plane_res.dpp, + ¤t_pipe->plane_res.scl_data.dscl_prog_data); } } current_pipe = current_pipe->bottom_pipe;
@@ -3009,18 +3007,11 @@ void hwss_program_bias_and_scale(union block_sequence_params *params)void hwss_program_upsp (union block_sequence_params *params) { -struct pipe_ctx *pipe_ctx = params->program_upsp_params.pipe_ctx; -struct dpp *dpp = pipe_ctx->plane_res.dpp; -struct dscl_prog_data *dscl_prog_data = &pipe_ctx->plane_res.scl_data.dscl_prog_data; +struct dpp *dpp = params->program_upsp_params.dpp; +const struct dscl_prog_data *dscl_prog_data = params->program_upsp_params.dscl_prog_data; -if (!dpp || !dscl_prog_data) -return ; - -if (dpp && dpp->funcs->dpp_program_upsp) { -// program upsampler - dpp->funcs->dpp_program_upsp (dpp, - dscl_prog_data); - } +if (dpp && dscl_prog_data && dpp->funcs->dpp_program_upsp) + dpp->funcs->dpp_program_upsp (dpp, dscl_prog_data); }void hwss_power_on_mpc_mem_pwr (union block_sequence_params *params)
@@ -5737,6 +5728,18 @@ void hwss_add_dpp_set_scaler(struct block_sequence_state *seq_state, } } +void hwss_add_dpp_program_upsp (struct block_sequence_state *seq_state, +struct dpp *dpp, +const struct dscl_prog_data *dscl_prog_data) +{ +if (*seq_state->num_steps <MAX_HWSS_BLOCK_SEQUENCE_SIZE ) { + seq_state->steps[*seq_state->num_steps].func =DPP_PROGRAM_UPSP ; + seq_state->steps[*seq_state->num_steps].params.program_upsp_params.dpp = dpp; + seq_state->steps[*seq_state->num_steps].params.program_upsp_params.dscl_prog_data = dscl_prog_data; + (*seq_state->num_steps)++; + } +} + void hwss_add_hubp_mem_program_viewport(struct block_sequence_state *seq_state, struct hubp *hubp, const struct rect *viewport,
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +7 -1
@@ -54,6 +54,7 @@ struct pg_block_update;struct drr_params ;struct dc_underflow_debug_data ;struct dsc_optc_config ; +struct dscl_prog_data ;struct vm_system_aperture_param ;struct stream_encoder ;struct hpo_dp_stream_encoder ;
@@ -171,7 +172,8 @@ struct set_output_transfer_func_params {const struct dc_stream_state *stream; };struct program_upsp_params { -struct pipe_ctx *pipe_ctx; +struct dpp *dpp; +const struct dscl_prog_data *dscl_prog_data; };struct update_visual_confirm_params {
@@ -2628,6 +2630,10 @@ void hwss_add_dpp_set_scaler(struct block_sequence_state *seq_state,struct dpp *dpp, const struct scaler_data *scl_data); +void hwss_add_dpp_program_upsp (struct block_sequence_state *seq_state, +struct dpp *dpp, +const struct dscl_prog_data *dscl_prog_data); + void hwss_add_hubp_mem_program_viewport(struct block_sequence_state *seq_state, struct hubp *hubp, const struct rect *viewport,
Signature · 1 line
2.55.0
PATCH 23/64 drm/amd/display: Remove phantom SW state ops from block sequence
In reply to George ZhangFrom: Piotr Maziarz <[email protected]>
[Why]HWS_APPLY_UPDATE_FLAGS_FOR_PHANTOM and HWS_UPDATE_PHANTOM_VP_POSITION program no hardware. They only mutate driver state: pipe update flags, the phantom plane viewport and the phantom scaling params.
A block sequence is built first and executed later, so both ops ran only after the builder had already inspected pipe_ctx->update_flags to decide which steps to emit. The phantom pipe was therefore built from stale flags.
[How]
Call apply_update_flags_for_phantom() and update_phantom_vp_position() directly from hwss_build_post_unlock_full_sequence(), before program_pipe_sequence(), matching the legacy dcn401_post_unlock_program_front_end() ordering.
--- .../drm/amd/display/dc/core/dc_hw_sequencer.c | 46 ++----------------- .../drm/amd/display/dc/hwss/hw_sequencer.h | 20 -------- 2 files changed, 5 insertions(+), 61 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +5 -41
@@ -1102,11 +1102,13 @@ void hwss_build_post_unlock_full_sequence(struct dc *dc,if (pipe->plane_state && !pipe->top_pipe) {while (pipe) {if (pipe->stream &&dc_state_get_pipe_subvp_type (context, pipe) ==SUBVP_PHANTOM ) { -/* Apply update flags for phantom pipes using existing HWS functions */ +/* Phantom SW state must be updated before the pipe sequence is built, +* since the build reads the update flags and scaling params. +*/ if (dc->hwss.apply_update_flags_for_phantom) -hwss_add_hws_apply_update_flags_for_phantom (&seq_state, pipe); + dc->hwss.apply_update_flags_for_phantom (pipe);if (dc->hwss.update_phantom_vp_position) -hwss_add_hws_update_phantom_vp_position (&seq_state, dc, context, pipe); + dc->hwss.update_phantom_vp_position (dc, context, pipe);/* Program the phantom pipe - use program_pipe_sequence if available */ if (dc->hwseq && dc->hwseq->funcs.program_pipe_sequence)
@@ -1804,14 +1806,6 @@ void hwss_execute_sequence(struct dc *dc, params->hubp_wait_pipe_read_start_params.hubp->funcs->hubp_wait_pipe_read_start ( params->hubp_wait_pipe_read_start_params.hubp);break ; -case HWS_APPLY_UPDATE_FLAGS_FOR_PHANTOM : - dc->hwss.apply_update_flags_for_phantom (params->apply_update_flags_for_phantom_params.pipe_ctx); -break ; -case HWS_UPDATE_PHANTOM_VP_POSITION : - dc->hwss.update_phantom_vp_position (params->update_phantom_vp_position_params.dc, - params->update_phantom_vp_position_params.context, - params->update_phantom_vp_position_params.pipe_ctx); -break ;case OPTC_SET_ODM_COMBINE :hwss_set_odm_combine (params);break ;
@@ -2590,36 +2584,6 @@ void hwss_add_hubp_wait_pipe_read_start(struct block_sequence_state *seq_state, } } -/* -* Helper function to add HWS apply update flags for phantom to block sequence -*/ -void hwss_add_hws_apply_update_flags_for_phantom (struct block_sequence_state *seq_state, -struct pipe_ctx *pipe_ctx) -{ -if (*seq_state->num_steps <MAX_HWSS_BLOCK_SEQUENCE_SIZE ) { - seq_state->steps[*seq_state->num_steps].params.apply_update_flags_for_phantom_params.pipe_ctx = pipe_ctx; - seq_state->steps[*seq_state->num_steps].func =HWS_APPLY_UPDATE_FLAGS_FOR_PHANTOM ; - (*seq_state->num_steps)++; - } -} - -/* -* Helper function to add HWS update phantom VP position to block sequence -*/ -void hwss_add_hws_update_phantom_vp_position (struct block_sequence_state *seq_state, -struct dc *dc, -struct dc_state *context, -struct pipe_ctx *pipe_ctx) -{ -if (*seq_state->num_steps <MAX_HWSS_BLOCK_SEQUENCE_SIZE ) { - seq_state->steps[*seq_state->num_steps].params.update_phantom_vp_position_params.dc = dc; - seq_state->steps[*seq_state->num_steps].params.update_phantom_vp_position_params.context = context; - seq_state->steps[*seq_state->num_steps].params.update_phantom_vp_position_params.pipe_ctx = pipe_ctx; - seq_state->steps[*seq_state->num_steps].func =HWS_UPDATE_PHANTOM_VP_POSITION ; - (*seq_state->num_steps)++; - } -} -/* * Helper function to add OPTC set ODM combine to block sequence */
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +0 -20
@@ -249,16 +249,6 @@ struct hubp_wait_pipe_read_start_params {struct hubp *hubp; }; -struct apply_update_flags_for_phantom_params { -struct pipe_ctx *pipe_ctx; -}; - -struct update_phantom_vp_position_params { -struct dc *dc; -struct pipe_ctx *pipe_ctx; -struct dc_state *context; -}; -struct set_odm_combine_params {struct timing_generator *tg;int opp_inst[MAX_PIPES ];
@@ -1098,8 +1088,6 @@ union block_sequence_params {struct control_cm_hist_params control_cm_hist_params;struct program_cursor_update_now_params program_cursor_update_now_params;struct hubp_wait_pipe_read_start_params hubp_wait_pipe_read_start_params; -struct apply_update_flags_for_phantom_params apply_update_flags_for_phantom_params; -struct update_phantom_vp_position_params update_phantom_vp_position_params;struct set_odm_combine_params set_odm_combine_params;struct set_odm_bypass_params set_odm_bypass_params;struct opp_pipe_clock_control_params opp_pipe_clock_control_params;
@@ -1278,8 +1266,6 @@ enum block_sequence_func {DPP_PROGRAM_CM_HIST ,PROGRAM_CURSOR_UPDATE_NOW ,HUBP_WAIT_PIPE_READ_START , -HWS_APPLY_UPDATE_FLAGS_FOR_PHANTOM , -HWS_UPDATE_PHANTOM_VP_POSITION ,OPTC_SET_ODM_COMBINE ,OPTC_SET_ODM_BYPASS , OPP_PIPE_CLOCK_CONTROL,
@@ -2248,12 +2234,6 @@ void hwss_add_lsdma_send_pio_copy(struct block_sequence_state *seq_state,void hwss_add_hubp_wait_pipe_read_start (struct block_sequence_state *seq_state,struct hubp *hubp); -void hwss_add_hws_apply_update_flags_for_phantom (struct block_sequence_state *seq_state, -struct pipe_ctx *pipe_ctx); - -void hwss_add_hws_update_phantom_vp_position (struct block_sequence_state *seq_state, -struct dc *dc,struct dc_state *context,struct pipe_ctx *pipe_ctx); -void hwss_add_optc_set_odm_combine (struct block_sequence_state *seq_state,struct timing_generator *tg,int opp_inst[MAX_PIPES ],int opp_head_count,int odm_slice_width,int last_odm_slice_width);
Signature · 1 line
2.55.0
PATCH 24/64 drm/amd/display: Add inst field to struct pg_cntl
In reply to George ZhangFrom: Tony Cheng <[email protected]>
Add an inst member to struct pg_cntl and set it to 0 in pg_cntl35_create() and pg_cntl42_create(), since PG cntl is a singleton.
No functional change; the field has no readers yet.
--- drivers/gpu/drm/amd/display/dc/inc/hw/pg_cntl.h | 1 + drivers/gpu/drm/amd/display/dc/pg/dcn35/dcn35_pg_cntl.c | 1 + drivers/gpu/drm/amd/display/dc/pg/dcn42/dcn42_pg_cntl.c | 1 + 3 files changed, 3 insertions(+)
drivers/gpu/drm/amd/display/dc/inc/hw/pg_cntl.h +1 -0
@@ -34,6 +34,7 @@ struct pg_cntl {const struct pg_cntl_funcs *funcs;bool pg_pipe_res_enable[PG_HW_PIPE_RESOURCES_NUM_ELEMENT ][MAX_PIPES ];bool pg_res_enable[PG_HW_RESOURCES_NUM_ELEMENT ]; +unsigned int inst; };struct pg_cntl_funcs {
drivers/gpu/drm/amd/display/dc/pg/dcn35/dcn35_pg_cntl.c +1 -0
@@ -553,6 +553,7 @@ struct pg_cntl *pg_cntl35_create( base = &pg_cntl_dcn->base; base->ctx = ctx; base->funcs = &pg_cntl35_funcs; + base->inst =0 ; pg_cntl_dcn->regs = regs; pg_cntl_dcn->pg_cntl_shift = pg_cntl_shift;
drivers/gpu/drm/amd/display/dc/pg/dcn42/dcn42_pg_cntl.c +1 -0
@@ -630,6 +630,7 @@ struct pg_cntl *pg_cntl42_create( base = &pg_cntl_dcn->base; base->ctx = ctx; base->funcs = &pg_cntl42_funcs; + base->inst =0 ; pg_cntl_dcn->regs = regs; pg_cntl_dcn->pg_cntl_shift = pg_cntl_shift;
Signature · 1 line
2.55.0
PATCH 25/64 drm/amd/display: Fix amdgpu_dm's kernel-doc warnings
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHAT]
Document the amdgpu_dm struct members and function parameters reported by kernel-doc. Convert non-kernel-doc prose comments to regular comments and clarify the HDMI FRL polling fields.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 7 ++++++- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.h | 9 +++++++++ .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +6 -1
@@ -593,6 +593,11 @@ struct amdgpu_display_manager {struct amdgpu_dm_backlight_caps backlight_caps[AMDGPU_DM_MAX_NUM_EDP ];struct mod_freesync *freesync_module; +/** +* @power_module: +* +* Power management module. +*/ struct mod_power *power_module;struct hdcp_workqueue *hdcp_workqueue;
@@ -734,7 +739,7 @@ struct amdgpu_display_manager {/** * @hdmi_frl_status_polling_wq: * -* workqueue for 200ms frl status polling +* Workqueue for HDMI FRL status polling. */ struct workqueue_struct *hdmi_frl_status_polling_wq;/**
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.h +9 -0
@@ -44,6 +44,8 @@ enum dmub_notification_type;* * This function should be called exactly once - during DM initialization. * +* @adev: AMDGPU device. +* * Returns: * 0 - success * non-zero - error
@@ -55,6 +57,8 @@ int amdgpu_dm_irq_init(struct amdgpu_device *adev);* * This function should be called exactly once - during DM destruction. * +* @adev: AMDGPU device. +* */ void amdgpu_dm_irq_fini (struct amdgpu_device *adev);
@@ -82,6 +86,7 @@ void *amdgpu_dm_irq_register_interrupt(struct amdgpu_device *adev,* by amdgpu_dm_irq_register_interrupt(). * * @adev: AMD DRM device. +* @irq_source: IRQ source to unregister. * @ih_index: irq handler index which was returned by * amdgpu_dm_irq_register_interrupt */
@@ -126,6 +131,8 @@ void amdgpu_dm_hpd_fini(struct amdgpu_device *adev);/** * amdgpu_dm_irq_suspend - disable ASIC interrupt during suspend. * +* @adev: AMDGPU device. +* */ void amdgpu_dm_irq_suspend (struct amdgpu_device *adev);
@@ -133,6 +140,8 @@ void amdgpu_dm_irq_suspend(struct amdgpu_device *adev);* amdgpu_dm_irq_resume_early - enable HPDRX ASIC interrupts during resume. * amdgpu_dm_irq_resume - enable ASIC interrupt during resume. * +* @adev: AMDGPU device. +* */ void amdgpu_dm_irq_resume_early (struct amdgpu_device *adev);void amdgpu_dm_irq_resume_late (struct amdgpu_device *adev);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h +1 -1
@@ -37,7 +37,7 @@#define DP_BRANCH_VENDOR_SPECIFIC_START 0x50C -/** +/* * Panamera MST Hub detection * Offset DPCD 050Eh == 0x5A indicates cascaded MST hub case * Check from beginning of branch device vendor specific field (050Ch)
Signature · 1 line
2.55.0
PATCH 26/64 drm/amd/display: Wait response should be based on fw_based_mclk_switch
In reply to George ZhangFrom: Alvin Lee <[email protected]>
[Description]
When sending the indicate P-Stat message to PMFW, the wait_resp flag should be set based on fw_based_mclk_switching in order to maintain the logic from previous product.
--- drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c +2 -1
@@ -1297,7 +1297,8 @@ static unsigned int dcn60_build_bandwidth_clocks_block_sequence_with_action( action->fams.enable || clk_mgr_base->clks.fw_based_mclk_switching; block_sequence[num_steps].params.indicate_pstate_status_params.wait_resp = - action->fams.enable; + action->fams.enable + || clk_mgr_base->clks.fw_based_mclk_switching; block_sequence[num_steps].params.indicate_pstate_status_params.alt_ch_enable = action->alt_ch.enable || clk_mgr_base->clks.alt_ch_pstate_switch;
Signature · 1 line
2.55.0
PATCH 27/64 drm/amd/display: Re-enable P-State message to SMU
In reply to George ZhangFrom: Alvin Lee <[email protected]>
[Description]
Re-enable P-State message to SMU now that support has been added on SMU side
--- .../drm/amd/display/dc/clk_mgr/dcn60/dalsmc.h | 3 +- .../dc/clk_mgr/dcn60/dcn60_clk_mgr_smu_msg.c | 36 +++++++------------ 2 files changed, 15 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dalsmc.h +2 -1
@@ -170,7 +170,8 @@ typedef struct {#define DALSMC_MSG_ReturnHardMinStatus 0x19 ///< Return hard min status#define DALSMC_MSG_GetDispclkFreq 0x1A ///< Get display clock frequency. Return in MHZ#define DALSMC_MSG_GetDppclkFreq 0x1B ///< Get DPP clock frequency. Return in MHZ -#define DALSMC_Message_Count 0x1C ///< Total number of VBIS and DAL messages +#define DALSMC_MSG_IndicatePstateStatus 0x1C ///< Set UCLK/FCLK related actions +#define DALSMC_Message_Count 0x1D ///< Total number of VBIS and DAL messages/** @}*/
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr_smu_msg.c +13 -23
@@ -398,29 +398,19 @@ void dcn60_smu_indicate_pstate_status(struct clk_mgr_internal *clk_mgr, bool allow_fclk, bool allow_uclk, bool wait_resp, bool drr_enable, bool alt_ch_enable) { - //TODO: Re-enable this function once PMFW has support for this message - // Temporary until message is implemented on PMFW side - (void)clk_mgr; - (void)allow_fclk; - (void)allow_uclk; - (void)wait_resp; - (void)drr_enable; - (void)alt_ch_enable; - -//DALSMC_IndicatePstateStatus_arg_t arg = {}; - -//smu_print("SMU Indicate pstate status: allow_fclk=%d allow_uclk=%d wait_resp=%d drr_enable=%d alt_ch_enable=%d\n", -// allow_fclk, allow_uclk, wait_resp, drr_enable, alt_ch_enable); - -//arg.AllowFclk = allow_fclk ? 1 : 0; -//arg.AllowUclk = allow_uclk ? 1 : 0; -//arg.WaitResp = wait_resp ? 1 : 0; -//arg.DrrEnable = drr_enable ? 1 : 0; -//arg.AltCh = alt_ch_enable ? 1 : 0; - -// DALSMC_MSG_IndicatePstateStatus not defined in latest dalsmc.h header. Comment out for now. -//dcn60_smu_send_msg_with_args(clk_mgr, -// DALSMC_MSG_IndicatePstateStatus, arg.Args, NULL, NULL); + DALSMC_IndicatePstateStatus_arg_t arg = {}; + +smu_print ("SMU Indicate pstate status: allow_fclk=%d allow_uclk=%d wait_resp=%d drr_enable=%d alt_ch_enable=%d\n" , + allow_fclk, allow_uclk, wait_resp, drr_enable, alt_ch_enable); + + arg.AllowFclk = allow_fclk ?1 :0 ; + arg.AllowUclk = allow_uclk ?1 :0 ; + arg.WaitResp = wait_resp ?1 :0 ; + arg.DrrEnable = drr_enable ?1 :0 ; + arg.AltCh = alt_ch_enable ?1 :0 ; + +dcn60_smu_send_msg_with_args (clk_mgr, + DALSMC_MSG_IndicatePstateStatus, arg.Args,NULL ,NULL ); } static bool dcn60_smu_transfer_table_smu_2_dram(struct clk_mgr_internal *clk_mgr,
Signature · 1 line
2.55.0
PATCH 28/64 drm/amd/display: Test EDID helper paths
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHAT]
Add KUnit tests for three EDID paths in amdgpu_dm_helpers.c the SDC panel PSR PHY power-down quirk in apply_edid_quirks(), the HDMI compliance-auto branch of dm_helpers_parse_edid_caps(), and the VBIOS fallback and corrupt-EDID paths of dm_helpers_read_local_edid().
[HOW]apply_edid_quirks() is driven twice with the SDC panel ids, once on a DisplayPort signal and once on eDP, showing the quirk is embedded-only.
dm_helpers_parse_edid_caps() runs against an HDMI connector whose hdmi_comp_auto flag is set, so the FRL and FRL DSC debug options are forced on and the quirk is recorded in the panel patch.
dm_helpers_read_local_edid() is given an embedded link with no DDC line, so it falls back to the EDID hardcoded in the VBIOS embedded panel info that the existing fake dc_bios supplies. A second test corrupts the base block checksum served by the fake AUX DDC, so the read fails, the real checksum is written back and EDID_BAD_CHECKSUM is reported.
--- .../amdgpu_dm/tests/amdgpu_dm_helpers_test.c | 120 ++++++++++++++++++ 1 file changed, 120 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_helpers_test.c +120 -0
@@ -176,6 +176,34 @@ static void dm_test_apply_edid_quirks_disable_colorimetry(struct kunit *test)KUNIT_EXPECT_TRUE (test, edid_caps.panel_patch.disable_colorimetry); } +/** +* dm_test_apply_edid_quirks_psr_phy_power_down - Test SDC PSR PHY power-down quirk +* @test: The KUnit test context +* +* The quirk is embedded-only, so an external signal leaves the debug option +* alone and an embedded one forces PHY power down/up level 2. +*/ +static void dm_test_apply_edid_quirks_psr_phy_power_down (struct kunit *test) +{ +struct dc_edid_caps edid_caps = {0 }; +struct dc_link *link =dm_test_quirk_link (test); +struct dc *dc =dm_kunit_alloc_dc_with_ctx (test); +struct edid *external =dm_test_edid_with_panel_id (test, +drm_edid_encode_panel_id ('S' ,'D' ,'C' ,0x4197 )); +struct edid *embedded =dm_test_edid_with_panel_id (test, +drm_edid_encode_panel_id ('S' ,'D' ,'C' ,0x4203 )); + + link->ctx = dc->ctx; + + link->connector_signal =SIGNAL_TYPE_DISPLAY_PORT ; +apply_edid_quirks (link, external, &edid_caps); +KUNIT_EXPECT_FALSE (test, dc->debug.psr_phy_force_phy_power_down_up_level_2); + + link->connector_signal =SIGNAL_TYPE_EDP ; +apply_edid_quirks (link, embedded, &edid_caps); +KUNIT_EXPECT_TRUE (test, dc->debug.psr_phy_force_phy_power_down_up_level_2); +} +/** * dm_test_apply_edid_quirks_skip_phy_ssc - Test DEL 0x4147 PHY SSC quirk * @test: The KUnit test context
@@ -463,6 +491,40 @@ static void dm_test_parse_edid_caps_hdmi_frl_dsc(struct kunit *test)KUNIT_EXPECT_TRUE (test, edid_caps->frl_dsc_10bpc); } +/** +* dm_test_parse_edid_caps_hdmi_comp_auto - Test the HDMI compliance-auto branch +* @test: The KUnit test context +* +* A connector flagged for automated HDMI compliance forces the FRL and FRL DSC +* debug options on and records the quirk in the panel patch. +*/ +static void dm_test_parse_edid_caps_hdmi_comp_auto (struct kunit *test) +{ +struct dc_link *link =dm_test_quirk_link (test); +struct amdgpu_dm_connector *aconnector = link->priv; +struct dc *dc =dm_kunit_alloc_dc_with_ctx (test); +struct dc_edid_caps *edid_caps; +struct dc_edid *dc_edid; + + dc_edid =kunit_kzalloc (test,sizeof (*dc_edid),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, dc_edid); + edid_caps =kunit_kzalloc (test,sizeof (*edid_caps),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, edid_caps); + + link->dc = dc; + link->ctx = dc->ctx; + +dm_test_fill_base_edid (dc_edid, true); + + aconnector->base.display_info.is_hdmi = true; + aconnector->hdmi_comp_auto = true; + +KUNIT_EXPECT_EQ (test,dm_helpers_parse_edid_caps (link, dc_edid, edid_caps),EDID_OK ); +KUNIT_EXPECT_TRUE (test, edid_caps->panel_patch.hdmi_comp_auto); +KUNIT_EXPECT_TRUE (test, dc->debug.force_frl_max); +KUNIT_EXPECT_TRUE (test, dc->debug.force_frl_dsc); +} +/* * Build a 2-block EDID: a valid base block plus a CTA-861 extension block * carrying one LPCM Short Audio Descriptor and, when @with_speaker is set, a
@@ -4570,6 +4632,60 @@ static void dm_test_read_local_edid_i2c_no_response(struct kunit *test)KUNIT_EXPECT_EQ (test, dm_test_prepare_ddc_calls,1U ); } +/** +* dm_test_read_local_edid_vbios_embedded - Test the VBIOS hardcoded EDID path +* @test: The KUnit test context +* +* An embedded panel with no DDC line has no I2C adapter to read from, so the +* helper falls back to the EDID hardcoded in the VBIOS embedded panel info. +*/ +static void dm_test_read_local_edid_vbios_embedded (struct kunit *test) +{ +struct dm_test_local_edid fixture =dm_test_setup_local_edid (test); +struct dm_test_vbios_edid *vbios; + + vbios =kunit_kzalloc (test,sizeof (*vbios),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, vbios); + + vbios->bios.funcs = &dm_test_vbios_edid_funcs; + vbios->result =BP_RESULT_OK ; +/* the fixture already holds a valid base EDID */ + vbios->fake_edid = fixture.aux->edid; + vbios->fake_edid_size =EDID_LENGTH ; + + fixture.ctx->dc_bios = &vbios->bios; + fixture.link->ctx = fixture.ctx; + fixture.link->aux_mode = false; + fixture.link->ddc_hw_inst =GPIO_DDC_LINE_UNKNOWN ; + fixture.link->connector_signal =SIGNAL_TYPE_EDP ; + +KUNIT_EXPECT_EQ (test, +dm_helpers_read_local_edid (fixture.ctx, fixture.link, fixture.sink), +EDID_OK ); +KUNIT_EXPECT_EQ (test, fixture.sink->dc_edid.length, (uint32_t )EDID_LENGTH ); +KUNIT_EXPECT_EQ (test, fixture.sink->edid_caps.manufacturer_id,0xAC10 ); +} + +/** +* dm_test_read_local_edid_corrupt_checksum - Test the corrupt-EDID compliance path +* @test: The KUnit test context +* +* The sink serves an EDID with a bad checksum, so the DDC read fails and marks +* the connector's EDID corrupt. The helper writes the real checksum back over +* AUX, clears the corrupt flag and reports EDID_BAD_CHECKSUM. +*/ +static void dm_test_read_local_edid_corrupt_checksum (struct kunit *test) +{ +struct dm_test_local_edid fixture =dm_test_setup_local_edid (test); + + fixture.aux->edid[EDID_LENGTH -1 ] ^=0xFF ; + +KUNIT_EXPECT_EQ (test, +dm_helpers_read_local_edid (fixture.ctx, fixture.link, fixture.sink), +EDID_BAD_CHECKSUM ); +KUNIT_EXPECT_FALSE (test, fixture.aconnector->base.edid_corrupt); +} +static struct kunit_case amdgpu_dm_helpers_test_cases[] = {/* edid_extract_panel_id */ KUNIT_CASE (dm_test_edid_extract_panel_id_basic),
@@ -4579,6 +4695,7 @@ static struct kunit_case amdgpu_dm_helpers_test_cases[] = {KUNIT_CASE (dm_test_apply_edid_quirks_disable_fams),KUNIT_CASE (dm_test_apply_edid_quirks_remove_sink_ext_caps),KUNIT_CASE (dm_test_apply_edid_quirks_disable_colorimetry), +KUNIT_CASE (dm_test_apply_edid_quirks_psr_phy_power_down),KUNIT_CASE (dm_test_apply_edid_quirks_skip_phy_ssc),KUNIT_CASE (dm_test_apply_edid_quirks_force_freesync_min), KUNIT_CASE(dm_test_apply_edid_quirks_unknown_noop),
@@ -4591,6 +4708,7 @@ static struct kunit_case amdgpu_dm_helpers_test_cases[] = {KUNIT_CASE (dm_test_parse_edid_caps_bad_checksum),KUNIT_CASE (dm_test_parse_edid_caps_hdmi_frl),KUNIT_CASE (dm_test_parse_edid_caps_hdmi_frl_dsc), +KUNIT_CASE (dm_test_parse_edid_caps_hdmi_comp_auto),KUNIT_CASE (dm_test_parse_edid_caps_cea_audio), KUNIT_CASE(dm_test_parse_edid_caps_cea_no_speaker),/* ACPI / VBIOS / local EDID readers */
@@ -4774,6 +4892,8 @@ static struct kunit_case amdgpu_dm_helpers_test_cases[] = {KUNIT_CASE (dm_test_read_local_edid_aux_mode),KUNIT_CASE (dm_test_read_local_edid_test_request),KUNIT_CASE (dm_test_read_local_edid_i2c_no_response), +KUNIT_CASE (dm_test_read_local_edid_vbios_embedded), + KUNIT_CASE(dm_test_read_local_edid_corrupt_checksum), {} };
Signature · 1 line
2.55.0
PATCH 29/64 drm/amd/display: Test AUX transfer paths
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHAT]
Add KUnit tests for the AUX paths of dm_helper_dmub_aux_transfer_sync(), dm_helpers_read_mccs_caps() and dm_helpers_mccs_vcp_set(). Only their early returns and the plain I2C branch were covered before.
[HOW]dm_helper_dmub_aux_transfer_sync() is called with HPD connected so it forwards the payload to the DMUB transfer. dc->link_count is zero, so the async transfer is rejected and the engine-acquire error is reported.
Both MCCS helpers pick their DDC adapter from link->aux_mode. Add a fake AUX channel that ACKs every I2C-over-AUX transaction and counts the sized writes, then route the shared MCCS fixture through it. The VCP set completes on the first write. The VCP request gets an empty reply, so every attempt is retried and the request finally fails.
--- .../amdgpu_dm/tests/amdgpu_dm_helpers_test.c | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_helpers_test.c +103 -0
@@ -2488,6 +2488,39 @@ static void dm_test_dmub_aux_transfer_sync_hpd_discon(struct kunit *test)KUNIT_EXPECT_EQ (test, (int )result, (int )AUX_RET_ERROR_HPD_DISCON ); } +/** +* dm_test_dmub_aux_transfer_sync_hpd_connected - Test the transfer is forwarded to DMUB +* @test: The KUnit test context +* +* With HPD connected the helper forwards the payload to +* amdgpu_dm_process_dmub_aux_transfer_sync(). dc->link_count is zero, so the +* async transfer is rejected and the engine-acquire error is reported. +*/ +static void dm_test_dmub_aux_transfer_sync_hpd_connected (struct kunit *test) +{ +struct aux_payload payload = {0 }; +enum aux_return_code_type result =AUX_RET_SUCCESS ; +struct amdgpu_device *adev; +struct dc_context *ctx; +struct dc_link *link; +int ret; + + adev =dm_kunit_alloc_adev (test); +KUNIT_ASSERT_NOT_NULL (test, adev); + ctx =dm_kunit_alloc_dc_with_ctx (test)->ctx; + link =dm_kunit_alloc_link (test); + + ctx->driver_context = adev; +mutex_init (&adev->dm.dpia_aux_lock); +init_completion (&adev->dm.dmub_aux_transfer_done); + link->hpd_status = true; + + ret =dm_helper_dmub_aux_transfer_sync (ctx, link, &payload, &result); + +KUNIT_EXPECT_EQ (test, ret,-1 ); +KUNIT_EXPECT_EQ (test, (int )result, (int )AUX_RET_ERROR_ENGINE_ACQUIRE ); +} +/* Tests for empty stub functions (must not crash) */ /**
@@ -3075,6 +3108,56 @@ static void dm_test_read_mccs_caps_i2c_failure(struct kunit *test)KUNIT_EXPECT_EQ (test, fake->reads,0U ); } +/* Counts sized I2C-over-AUX writes; the bracketing bare-address ones have size 0. */ +static unsigned int dm_test_mccs_aux_writes; + +static ssize_t dm_test_mccs_aux_transfer (struct drm_dp_aux *aux,struct drm_dp_aux_msg *msg) +{ +if ((msg->request & ~DP_AUX_I2C_MOT ) ==DP_AUX_I2C_WRITE && msg->size) + dm_test_mccs_aux_writes++; + + msg->reply =DP_AUX_I2C_REPLY_ACK ; +return msg->size; +} + +/* +* Route the fixture's link through an AUX DDC instead of the fake I2C adapter, +* so the MCCS helpers take their link->aux_mode branch. +*/ +static void dm_test_mccs_use_aux (struct dm_test_mccs_fixture *fixture) +{ +struct drm_dp_aux *aux = &fixture->aconnector->dm_dp_aux.aux; + + aux->drm_dev = &fixture->adev->ddev; + aux->transfer = dm_test_mccs_aux_transfer; +drm_dp_aux_init (aux); + + fixture->aconnector->base.dev = &fixture->adev->ddev; + fixture->link->aux_mode = true; + dm_test_mccs_aux_writes =0 ; +} + +/** +* dm_test_read_mccs_caps_aux_mode - Test the MCCS VCP request over I2C-over-AUX +* @test: The KUnit test context +* +* The AUX DDC ACKs both transactions but answers with an empty VCP reply, so +* every attempt is retried and the request finally fails. +*/ +static void dm_test_read_mccs_caps_aux_mode (struct kunit *test) +{ +struct dm_test_mccs_fixture fixture =dm_test_alloc_mccs_fixture (test); + +dm_test_mccs_use_aux (&fixture); + fixture.link->connector_signal =SIGNAL_TYPE_HDMI_TYPE_A ; + fixture.sink->edid_caps.freesync_vcp_code =0xe3 ; + +dm_helpers_read_mccs_caps (fixture.ctx, fixture.link, fixture.sink); + +KUNIT_EXPECT_FALSE (test, fixture.sink->mccs_caps.freesync_supported); +KUNIT_EXPECT_EQ (test, dm_test_mccs_aux_writes,5U ); +} +/* Tests for dm_helpers_mccs_vcp_set() */ /**
@@ -3188,6 +3271,23 @@ static void dm_test_mccs_vcp_set_i2c_failure(struct kunit *test)KUNIT_EXPECT_EQ (test, fake->reads,0U ); } +/** +* dm_test_mccs_vcp_set_aux_mode - Test the MCCS VCP set over I2C-over-AUX +* @test: The KUnit test context +*/ +static void dm_test_mccs_vcp_set_aux_mode (struct kunit *test) +{ +struct dm_test_mccs_fixture fixture =dm_test_alloc_mccs_fixture (test); + +dm_test_mccs_use_aux (&fixture); + fixture.sink->mccs_caps.freesync_supported = true; + fixture.sink->edid_caps.freesync_vcp_code =0xe3 ; + +dm_helpers_mccs_vcp_set (fixture.ctx, fixture.link, fixture.sink); + +KUNIT_EXPECT_EQ (test, dm_test_mccs_aux_writes,1U ); +} +/* Tests for dm_helpers_construct_old_payload() */ /**
@@ -4809,6 +4909,7 @@ static struct kunit_case amdgpu_dm_helpers_test_cases[] = {KUNIT_CASE (dm_test_submit_i2c_partial_transfer),/* dm_helper_dmub_aux_transfer_sync */ KUNIT_CASE (dm_test_dmub_aux_transfer_sync_hpd_discon), +KUNIT_CASE (dm_test_dmub_aux_transfer_sync_hpd_connected),/* Empty stub functions */ KUNIT_CASE (dm_test_dp_update_branch_info_no_crash), KUNIT_CASE(dm_test_mst_poll_pending_down_reply_no_crash),
@@ -4854,12 +4955,14 @@ static struct kunit_case amdgpu_dm_helpers_test_cases[] = {KUNIT_CASE (dm_test_read_mccs_caps_hdmi_vcp_request),KUNIT_CASE (dm_test_read_mccs_caps_legacy_pcon_vcp_request),KUNIT_CASE (dm_test_read_mccs_caps_i2c_failure), +KUNIT_CASE (dm_test_read_mccs_caps_aux_mode),/* dm_helpers_mccs_vcp_set */ KUNIT_CASE (dm_test_mccs_vcp_set_null_ctx),KUNIT_CASE (dm_test_mccs_vcp_set_not_supported),KUNIT_CASE (dm_test_mccs_vcp_set_null_link),KUNIT_CASE (dm_test_mccs_vcp_set_i2c_packet),KUNIT_CASE (dm_test_mccs_vcp_set_i2c_failure), +KUNIT_CASE (dm_test_mccs_vcp_set_aux_mode),/* dm_helpers_construct_old_payload */ KUNIT_CASE (dm_test_construct_old_payload_empty_list), KUNIT_CASE(dm_test_construct_old_payload_intervening),
Signature · 1 line
2.55.0
PATCH 30/64 drm/amd/display: Test MST topology start
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHAT]
Add a KUnit test to cover dm_helpers_dp_mst_start_top_mgr() its success path.
[HOW]
Mark the topology manager as already in MST mode, so drm_dp_mst_topology_mgr_set_mst() returns success without touching the AUX channel or queueing the link probe work, and the helper reports that MST was started.
--- .../amdgpu_dm/tests/amdgpu_dm_helpers_test.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_helpers_test.c +25 -0
@@ -3535,6 +3535,30 @@ static void dm_test_mst_start_top_mgr_set_mst_fail(struct kunit *test)KUNIT_EXPECT_FALSE (test,dm_helpers_dp_mst_start_top_mgr (NULL , link, false)); } +/** +* dm_test_mst_start_top_mgr_already_started - Test MST start on an active manager +* @test: The KUnit test context +* +* With the topology manager already in MST mode, +* drm_dp_mst_topology_mgr_set_mst(true) is a no-op that returns success, so the +* helper logs the cached DPCD caps and returns true. +*/ +static void dm_test_mst_start_top_mgr_already_started (struct kunit *test) +{ +struct amdgpu_dm_connector *aconnector; +struct dc_link *link; + + aconnector =kunit_kzalloc (test,sizeof (*aconnector),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, aconnector); + link =dm_kunit_alloc_link (test); + +mutex_init (&aconnector->mst_mgr.lock); + aconnector->mst_mgr.mst_state = true; + link->priv = aconnector; + +KUNIT_EXPECT_TRUE (test,dm_helpers_dp_mst_start_top_mgr (NULL , link, false)); +} +/** * dm_test_mst_stop_top_mgr_active - Test MST stop on an active topology manager * @test: The KUnit test context
@@ -4881,6 +4905,7 @@ static struct kunit_case amdgpu_dm_helpers_test_cases[] = {KUNIT_CASE (dm_test_mst_stop_top_mgr_null_priv),KUNIT_CASE (dm_test_mst_start_top_mgr_boot),KUNIT_CASE (dm_test_mst_start_top_mgr_set_mst_fail), +KUNIT_CASE (dm_test_mst_start_top_mgr_already_started),KUNIT_CASE (dm_test_mst_stop_top_mgr_active),/* dm_helpers_dp_write_hblank_reduction */ KUNIT_CASE(dm_test_dp_write_hblank_reduction_false),
Signature · 1 line
2.55.0
PATCH 31/64 drm/amd/display: Test unassigned OTG CRTC lookup
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHAT]amdgpu_dm_get_crtc_by_otg_inst() had no test for an OTG instance of -1, so its WARN_ON guard and the fallback to the first CRTC were never executed.
[HOW]
Add dm_test_get_crtc_by_otg_inst_unassigned_otg(), which installs a CRTC as mode_info.crtcs[0] and asserts the lookup returns it rather than walking the CRTC list.
--- .../amdgpu_dm/tests/amdgpu_dm_irq_test.c | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c +23 -0
@@ -1301,6 +1301,28 @@ static void dm_test_get_crtc_by_otg_inst_empty_list(struct kunit *test)KUNIT_EXPECT_NULL (test,amdgpu_dm_get_crtc_by_otg_inst (adev,0 )); } +/** +* dm_test_get_crtc_by_otg_inst_unassigned_otg - Test CRTC lookup for a disabled OTG +* @test: The KUnit test context +* +* An IRQ that names an OTG instance of -1 cannot be matched, so the lookup +* trips its WARN_ON and falls back to the first CRTC rather than walking the +* list. +*/ +static void dm_test_get_crtc_by_otg_inst_unassigned_otg (struct kunit *test) +{ +struct amdgpu_device *adev; +struct amdgpu_crtc *acrtc; + + adev =dm_kunit_alloc_adev (test); + + acrtc =kunit_kzalloc (test,sizeof (*acrtc),GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, acrtc); + adev->mode_info.crtcs[0 ] = acrtc; + +KUNIT_EXPECT_PTR_EQ (test,amdgpu_dm_get_crtc_by_otg_inst (adev,-1 ), acrtc); +} +/* Tests for amdgpu_dm_set_irq_funcs() */ /**
@@ -4865,6 +4887,7 @@ static struct kunit_case amdgpu_dm_irq_tests[] = {KUNIT_CASE (dm_test_get_crtc_by_otg_inst_returns_match),KUNIT_CASE (dm_test_get_crtc_by_otg_inst_returns_null),KUNIT_CASE (dm_test_get_crtc_by_otg_inst_empty_list), +KUNIT_CASE (dm_test_get_crtc_by_otg_inst_unassigned_otg),/* amdgpu_dm_set_irq_funcs */ KUNIT_CASE(dm_test_set_irq_funcs),/* amdgpu_dm_irq_suspend/resume_early/resume_late */
Signature · 1 line
2.55.0
PATCH 32/64 drm/amd/display: Test VRR pageflip completion
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHAT]dm_pflip_high_irq() only ever ran with VRR inactive, so the scanout position query and the front-porch path that queues the pageflip event on the vblank event list were never reached.
[HOW]
Add a fake timing generator reporting a scanout position past the start of the front porch, plus a fixture that puts a submitted flip on an active-VRR stream.
--- .../amdgpu_dm/tests/amdgpu_dm_irq_test.c | 138 ++++++++++++++++++ 1 file changed, 138 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c +138 -0
@@ -14,6 +14,7 @@#include "dc.h" #include "inc/core_types.h" +#include "inc/hw/timing_generator.h" #include "irq/irq_service.h" #include "amdgpu.h" #include "amdgpu_mode.h"
@@ -214,6 +215,23 @@ static bool dm_test_allow_hpd_rx_irq_true(const struct dc_link *link)return true; } +/* Report a scanout position past the start of the front porch. */ +static void dm_test_tg_get_scanoutpos (struct timing_generator *tg, +uint32_t *v_blank_start, +uint32_t *v_blank_end, +uint32_t *h_position, +uint32_t *v_position) +{ + *v_blank_start =100 ; + *v_blank_end =110 ; + *h_position =0 ; + *v_position =200 ; +} + +static const struct timing_generator_funcs dm_test_tg_funcs = { + .get_scanoutpos = dm_test_tg_get_scanoutpos, +}; +static uint32_t dm_test_dmub_get_outbox0_wptr (struct dmub_srv *dmub) {
@@ -3658,6 +3676,124 @@ static void dm_test_pflip_high_irq_completes_flip(struct kunit *test)KUNIT_EXPECT_EQ (test, acrtc->pflip_status,AMDGPU_FLIP_NONE ); } +/* +* Build a CRTC with a submitted flip on an active-VRR stream whose scanout +* position comes from the given fake timing generator (NULL for a stream that +* is not on any pipe, so the position is unavailable). +*/ +static struct amdgpu_crtc *dm_test_setup_vrr_pflip_crtc (struct kunit *test, +struct timing_generator *tg) +{ +struct dc_stream_state *stream; +struct amdgpu_device *adev; +struct amdgpu_crtc *acrtc; +struct dc_link *link; +struct dc *dc; + + adev =dm_kunit_alloc_adev (test); +KUNIT_ASSERT_EQ (test,drm_vblank_init (&adev->ddev,1 ),0 ); + + dc =dm_kunit_alloc_dc_with_ctx (test); + dc->current_state =kunit_kzalloc (test,sizeof (*dc->current_state), +GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc->current_state); + adev->dm.dc = dc; + + link =dm_kunit_alloc_link (test); + stream =dm_kunit_alloc_stream (test, link); + stream->ctx = dc->ctx; + +if (tg) { + dc->current_state->res_ctx.pipe_ctx[0 ].stream = stream; + dc->current_state->res_ctx.pipe_ctx[0 ].stream_res.tg = tg; + } + + acrtc =dm_test_add_crtc (test, adev); + acrtc->pflip_status =AMDGPU_FLIP_SUBMITTED ; + acrtc->dm_irq_params.stream = stream; + acrtc->dm_irq_params.freesync_config.state =VRR_STATE_ACTIVE_VARIABLE ; + +return acrtc; +} + +/** +* dm_test_pflip_high_irq_vrr_no_scanoutpos - Test VRR flip with no scanout data +* @test: The KUnit test context +* +* When the stream is not on any pipe the scanout position is unavailable, so +* the handler cannot tell it is inside the front porch and completes the flip +* immediately. +*/ +static void dm_test_pflip_high_irq_vrr_no_scanoutpos (struct kunit *test) +{ +struct drm_pending_vblank_event *event; +struct common_irq_params params = {0 }; +struct amdgpu_device *adev; +struct amdgpu_crtc *acrtc; + + acrtc =dm_test_setup_vrr_pflip_crtc (test,NULL ); + adev =drm_to_adev (acrtc->base.dev); + +/* drm_crtc_send_vblank_event() consumes (kfree()s) the event. */ + event =kzalloc_obj (*event,GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, event); + acrtc->event = event; + +/* Balance the handler's drm_crtc_vblank_put(). */ + adev->ddev.vblank[0 ].enabled = true; +KUNIT_ASSERT_EQ (test,drm_crtc_vblank_get (&acrtc->base),0 ); + + params.adev = adev; + params.irq_src = (enum dc_irq_source )IRQ_TYPE_PFLIP ; + +dm_pflip_high_irq (¶ms); + +KUNIT_EXPECT_NULL (test, acrtc->event); +KUNIT_EXPECT_EQ (test, acrtc->pflip_status,AMDGPU_FLIP_NONE ); +} + +/** +* dm_test_pflip_high_irq_vrr_front_porch - Test VRR flip inside the front porch +* @test: The KUnit test context +* +* A VRR flip that completes while scanout is still in the front porch has no +* valid vblank count yet, so the event is queued on the device's vblank event +* list for the late vblank handler to send out instead. +*/ +static void dm_test_pflip_high_irq_vrr_front_porch (struct kunit *test) +{ +struct drm_pending_vblank_event *event; +struct common_irq_params params = {0 }; +struct timing_generator *tg; +struct amdgpu_device *adev; +struct amdgpu_crtc *acrtc; + + tg =kunit_kzalloc (test,sizeof (*tg),GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, tg); + tg->funcs = &dm_test_tg_funcs; + + acrtc =dm_test_setup_vrr_pflip_crtc (test, tg); + adev =drm_to_adev (acrtc->base.dev); + + event =kzalloc_obj (*event,GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, event); + acrtc->event = event; + + params.adev = adev; + params.irq_src = (enum dc_irq_source )IRQ_TYPE_PFLIP ; + +dm_pflip_high_irq (¶ms); + +KUNIT_EXPECT_NULL (test, acrtc->event); +KUNIT_EXPECT_EQ (test, acrtc->pflip_status,AMDGPU_FLIP_NONE ); +KUNIT_ASSERT_PTR_EQ (test, adev->ddev.vblank_event_list.next, + &event->base.link); + +/* The event was queued rather than sent, so the test owns it. */ +list_del (&event->base.link); +kfree (event); +} +/** * dm_test_vupdate_high_irq_no_crtc - Test vupdate high IRQ with no CRTC * @test: The KUnit test context
@@ -4981,6 +5117,8 @@ static struct kunit_case amdgpu_dm_irq_tests[] = {KUNIT_CASE (dm_test_pflip_high_irq_no_crtc),KUNIT_CASE (dm_test_pflip_high_irq_not_submitted),KUNIT_CASE (dm_test_pflip_high_irq_completes_flip), +KUNIT_CASE (dm_test_pflip_high_irq_vrr_no_scanoutpos), +KUNIT_CASE (dm_test_pflip_high_irq_vrr_front_porch),KUNIT_CASE (dm_test_vupdate_high_irq_no_crtc),KUNIT_CASE (dm_test_vupdate_high_irq_dcn_completes_flip), KUNIT_CASE(dm_test_vupdate_high_irq_dcn_no_active_planes),
Signature · 1 line
2.55.0
PATCH 33/64 drm/amd/display: Test HPD RX offload work branches
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHAT]dm_handle_hpd_rx_offload_work() was covered only for its automated-test and link-loss branches. The connection-type failure, the GPU-reset drop, the MST message-ready drain and the forced reconnect were never entered.
[HOW]
Add a fixture that builds a queued offload work item on a DisplayPort link and four tests: a failing connection-type probe, a device already in reset, a deferred UP_REQ_MSG_RDY drained through an AUX that fails every transfer, and an automated test whose timing changed, which forces the connector off and back on. The last one registers the DRM device so the hotplug uevent helpers find a sysfs minor on the primary node.
--- .../amdgpu_dm/tests/amdgpu_dm_irq_test.c | 214 ++++++++++++++++++ 1 file changed, 214 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c +214 -0
@@ -6,11 +6,13 @@*/ #include <kunit/test.h> +#include <drm/drm_drv.h> #include <drm/drm_kunit_helpers.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_probe_helper.h> #include <drm/drm_vblank.h> #include <drm/drm_writeback.h> +#include <drm/display/drm_dp_helper.h> #include "dc.h" #include "inc/core_types.h"
@@ -115,6 +117,18 @@ static enum dc_status dm_test_dp_read_hpd_rx_irq_data_ok(struct dc_link *link,return DC_OK ; } +static const struct dc_link_status *dm_test_get_link_status (const struct dc_link *link) +{ +return &link->link_status; +} + +/* Fail every AUX transaction so the MST ESI read loop bails out immediately. */ +static ssize_t dm_test_aux_transfer_fail (struct drm_dp_aux *aux, +struct drm_dp_aux_msg *msg) +{ +return -EIO ; +} +/* * Allocate a refcounted dc_sink for tests without pulling in the DC-core * dc_sink_create()/dc_sink_release() symbols. Production code under test still
@@ -511,6 +525,22 @@ static void dm_test_connector_cleanup(void *data)drm_connector_cleanup (data); } +static void dm_test_drm_dev_unregister (void *data) +{ +drm_dev_unregister (data); +} + +/* +* Registering the DRM device gives its primary minor a sysfs device, which the +* DRM hotplug uevent helpers dereference unconditionally. +*/ +static void dm_test_register_drm_dev (struct kunit *test,struct amdgpu_device *adev) +{ +KUNIT_ASSERT_EQ (test,drm_dev_register (&adev->ddev,0 ),0 ); +KUNIT_ASSERT_EQ (test,kunit_add_action_or_reset (test, dm_test_drm_dev_unregister, + &adev->ddev),0 ); +} +/* Tests for amdgpu_dm_hpd_to_dal_irq_source() */ /**
@@ -2412,6 +2442,155 @@ static void dm_test_hpd_rx_offload_work_no_connection(struct kunit *test)dm_handle_hpd_rx_offload_work (&offload_work->work); } +/* +* Build a queued hpd_rx_irq_offload_work for dm_handle_hpd_rx_offload_work(): +* an adev that is not in reset, an offload queue owning a connector with an +* HPD lock, and a DisplayPort dc/link pair that reports a present sink. +* Caller sets the link_srv stubs and the service-IRQ bits its branch needs. +* +* The work item is kzalloc'd because the worker frees it. +*/ +static struct hpd_rx_irq_offload_work * +dm_test_setup_hpd_rx_offload_work (struct kunit *test, +struct link_service **link_srv_out) +{ +struct hpd_rx_irq_offload_work_queue *offload_wq; +struct hpd_rx_irq_offload_work *offload_work; +struct amdgpu_dm_connector *aconn; +struct link_service *link_srv; +struct amdgpu_device *adev; +struct dc_context *ctx; +struct dc_link *link; +struct dc *dc; + + adev =dm_kunit_alloc_adev (test); +mutex_init (&adev->dm.dc_lock); + adev->reset_domain =kunit_kzalloc (test,sizeof (*adev->reset_domain), +GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev->reset_domain); + + offload_wq =kunit_kzalloc (test,sizeof (*offload_wq),GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, offload_wq); +spin_lock_init (&offload_wq->offload_lock); + + aconn =dm_kunit_alloc_connector (test, adev,NULL ); +mutex_init (&aconn->hpd_lock); + offload_wq->aconnector = aconn; + + dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc); + ctx =kunit_kzalloc (test,sizeof (*ctx),GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); + link_srv =kunit_kzalloc (test,sizeof (*link_srv),GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link_srv); + link =kunit_kzalloc (test,sizeof (*link),GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link); + + link_srv->detect_connection_type = dm_test_detect_connection_single; + dc->link_srv = link_srv; + dc->ctx = ctx; + ctx->dc = dc; + link->dc = dc; + link->ctx = ctx; + link->connector_signal =SIGNAL_TYPE_DISPLAY_PORT ; + aconn->dc_link = link; + + offload_work =kzalloc_obj (*offload_work,GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, offload_work); + offload_work->offload_wq = offload_wq; + offload_work->adev = adev; +INIT_WORK (&offload_work->work, dm_handle_hpd_rx_offload_work); + + *link_srv_out = link_srv; + +return offload_work; +} + +/** +* dm_test_hpd_rx_offload_work_detect_type_fails - Test detect failure logging +* @test: The KUnit test context +* +* When dc_link_detect_connection_type() fails the worker logs an error and +* carries on with the connection type left as none, so it still skips out +* before any DP IRQ handling. +*/ +static void dm_test_hpd_rx_offload_work_detect_type_fails (struct kunit *test) +{ +struct hpd_rx_irq_offload_work *offload_work; +struct link_service *link_srv; + + dm_test_automated_test_count =0 ; + + offload_work =dm_test_setup_hpd_rx_offload_work (test, &link_srv); + link_srv->detect_connection_type = dm_test_detect_connection_fail; + link_srv->dp_handle_automated_test = dm_test_dp_handle_automated_test; + offload_work->data.bytes.device_service_irq.bits.AUTOMATED_TEST =1 ; + +dm_handle_hpd_rx_offload_work (&offload_work->work); + +KUNIT_EXPECT_EQ (test, dm_test_automated_test_count,0 ); +} + +/** +* dm_test_hpd_rx_offload_work_in_reset - Test the GPU-reset early exit +* @test: The KUnit test context +* +* A GPU reset owns the link, so a deferred HPD RX IRQ must be dropped before +* any DP IRQ handling runs. +*/ +static void dm_test_hpd_rx_offload_work_in_reset (struct kunit *test) +{ +struct hpd_rx_irq_offload_work *offload_work; +struct link_service *link_srv; + + dm_test_automated_test_count =0 ; + + offload_work =dm_test_setup_hpd_rx_offload_work (test, &link_srv); + link_srv->dp_handle_automated_test = dm_test_dp_handle_automated_test; + offload_work->data.bytes.device_service_irq.bits.AUTOMATED_TEST =1 ; +atomic_set (&offload_work->adev->reset_domain->in_gpu_reset,1 ); + +dm_handle_hpd_rx_offload_work (&offload_work->work); + +KUNIT_EXPECT_EQ (test, dm_test_automated_test_count,0 ); +} + +/** +* dm_test_hpd_rx_offload_work_msg_rdy - Test the MST message-ready branch +* @test: The KUnit test context +* +* A deferred UP_REQ_MSG_RDY drains the sideband messages and then re-opens the +* queue for the next MST message-ready event. The AUX transfers all fail, so +* the ESI read loop bails out on its first iteration. +*/ +static void dm_test_hpd_rx_offload_work_msg_rdy (struct kunit *test) +{ +struct hpd_rx_irq_offload_work *offload_work; +struct amdgpu_dm_connector *aconn; +struct link_service *link_srv; +struct dc_link *link; + + offload_work =dm_test_setup_hpd_rx_offload_work (test, &link_srv); + aconn = offload_work->offload_wq->aconnector; + link = aconn->dc_link; + + link_srv->get_status = dm_test_get_link_status; + link->link_status.dpcd_caps = &link->dpcd_caps; + +mutex_init (&aconn->handle_mst_msg_ready); + aconn->dm_dp_aux.aux.name ="dm_irq_test_msg_rdy_aux" ; + aconn->dm_dp_aux.aux.transfer = dm_test_aux_transfer_fail; +drm_dp_aux_init (&aconn->dm_dp_aux.aux); +drm_dp_dpcd_set_probe (&aconn->dm_dp_aux.aux, false); + + offload_work->offload_wq->is_handling_mst_msg_rdy_event = true; + offload_work->data.bytes.device_service_irq.bits.UP_REQ_MSG_RDY =1 ; + +dm_handle_hpd_rx_offload_work (&offload_work->work); + +KUNIT_EXPECT_FALSE (test, offload_work->offload_wq->is_handling_mst_msg_rdy_event); +} +/** * dm_test_hpd_rx_offload_work_automated_test - Test AUTOMATED_TEST branch * @test: The KUnit test context
@@ -2482,6 +2661,37 @@ static void dm_test_hpd_rx_offload_work_automated_test(struct kunit *test)KUNIT_EXPECT_EQ (test, dm_test_automated_test_count,1 ); } +/** +* dm_test_hpd_rx_offload_work_timing_changed - Test the forced reconnect path +* @test: The KUnit test context +* +* An automated test that changed the timing must force the connector off and +* back on again through force_connector_state(), which sends a hotplug uevent +* and therefore needs a registered DRM device. +*/ +static void dm_test_hpd_rx_offload_work_timing_changed (struct kunit *test) +{ +struct hpd_rx_irq_offload_work *offload_work; +struct amdgpu_dm_connector *aconn; +struct link_service *link_srv; + + offload_work =dm_test_setup_hpd_rx_offload_work (test, &link_srv); + aconn = offload_work->offload_wq->aconnector; +dm_test_register_drm_dev (test, offload_work->adev); + + link_srv->dp_handle_automated_test = dm_test_dp_handle_automated_test; + aconn->timing_changed = true; + aconn->dc_link->aux_access_disabled = true; + offload_work->data.bytes.device_service_irq.bits.AUTOMATED_TEST =1 ; + +/* The forced off/on cycle must leave the connector back at its default. */ + aconn->base.force =DRM_FORCE_ON ; + +dm_handle_hpd_rx_offload_work (&offload_work->work); + +KUNIT_EXPECT_EQ (test, aconn->base.force,DRM_FORCE_UNSPECIFIED ); +} +/** * dm_test_hpd_rx_offload_work_link_loss - Test link-loss branch * @test: The KUnit test context
@@ -5079,7 +5289,11 @@ static struct kunit_case amdgpu_dm_irq_tests[] = {/* dm_handle_hpd_rx_offload_work */ KUNIT_CASE (dm_test_hpd_rx_offload_work_no_connector),KUNIT_CASE (dm_test_hpd_rx_offload_work_no_connection), +KUNIT_CASE (dm_test_hpd_rx_offload_work_detect_type_fails), +KUNIT_CASE (dm_test_hpd_rx_offload_work_in_reset), +KUNIT_CASE (dm_test_hpd_rx_offload_work_msg_rdy),KUNIT_CASE (dm_test_hpd_rx_offload_work_automated_test), +KUNIT_CASE (dm_test_hpd_rx_offload_work_timing_changed),KUNIT_CASE (dm_test_hpd_rx_offload_work_link_loss),/* amdgpu_dm_hdmi_hpd_debounce_work */ KUNIT_CASE(dm_test_hdmi_hpd_debounce_detect_false),
Signature · 1 line
2.55.0
PATCH 34/64 drm/amd/display: Test HDMI HPD debounce re-detect
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHAT]amdgpu_dm_hdmi_hpd_debounce_work() only ran with detection failing, so neither outcome of the sink comparison that decides whether an HPD toggle was spurious was covered.
[HOW]
Add a fixture for the debounce work item and two tests: a re-detect finding the same sink, which re-enables internally without notifying userspace, and one finding a different sink, which sends the hotplug event.
--- .../amdgpu_dm/tests/amdgpu_dm_irq_test.c | 114 ++++++++++++++++++ 1 file changed, 114 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c +114 -0
@@ -61,6 +61,12 @@ static bool dm_test_detect_link_false(struct dc_link *link,return false; } +static bool dm_test_detect_link_true (struct dc_link *link, +enum dc_detect_reason reason) +{ +return true; +} +/* Spy on dc_link_detect() to prove the debounce early-return skipped it. */ static int dm_test_detect_link_count;
@@ -2764,6 +2770,51 @@ static void dm_test_hpd_rx_offload_work_link_loss(struct kunit *test)/* Tests for amdgpu_dm_hdmi_hpd_debounce_work() */ +/* +* Build an aconnector wired for amdgpu_dm_hdmi_hpd_debounce_work(): an HPD +* lock, the debounce work item and a dc/link pair whose re-detect fails. +* Caller sets the link_srv stubs and any sinks the branch under test needs. +*/ +static struct amdgpu_dm_connector *dm_test_setup_hdmi_debounce (struct kunit *test, +struct link_service **link_srv_out) +{ +struct amdgpu_dm_connector *aconn; +struct link_service *link_srv; +struct amdgpu_device *adev; +struct dc_context *ctx; +struct dc_link *link; +struct dc *dc; + + adev =dm_kunit_alloc_adev (test); +mutex_init (&adev->dm.dc_lock); + + aconn =dm_kunit_alloc_connector (test, adev,NULL ); +mutex_init (&aconn->hpd_lock); +INIT_DELAYED_WORK (&aconn->hdmi_hpd_debounce_work, + amdgpu_dm_hdmi_hpd_debounce_work); + + dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc); + ctx =kunit_kzalloc (test,sizeof (*ctx),GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); + link_srv =kunit_kzalloc (test,sizeof (*link_srv),GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link_srv); + link =kunit_kzalloc (test,sizeof (*link),GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link); + + link_srv->detect_link = dm_test_detect_link_false; + dc->ctx = ctx; + dc->link_srv = link_srv; + ctx->dc = dc; + link->dc = dc; + link->ctx = ctx; + aconn->dc_link = link; + + *link_srv_out = link_srv; + +return aconn; +} +/** * dm_test_hdmi_hpd_debounce_detect_false - Test debounce false detect path * @test: The KUnit test context
@@ -2874,6 +2925,67 @@ static void dm_test_hdmi_hpd_debounce_reallow_idle(struct kunit *test)KUNIT_EXPECT_NULL (test, aconn->hdmi_prev_sink); } +/** +* dm_test_hdmi_hpd_debounce_sink_unchanged - Test the spontaneous-toggle path +* @test: The KUnit test context +* +* A re-detect that finds the same sink as before the HPD toggle is an internal +* re-enable, so the connector state is refreshed but no hotplug event is sent +* to userspace. An MST-state connector keeps +* amdgpu_dm_update_connector_after_detect() to its early return. +*/ +static void dm_test_hdmi_hpd_debounce_sink_unchanged (struct kunit *test) +{ +struct amdgpu_dm_connector *aconn; +struct link_service *link_srv; +struct dc_link *link; + + aconn =dm_test_setup_hdmi_debounce (test, &link_srv); + link_srv->detect_link = dm_test_detect_link_true; + aconn->mst_mgr.mst_state = true; + link = aconn->dc_link; + +/* Two identically zeroed sinks compare equal, i.e. a spurious toggle. */ + link->local_sink =dm_test_sink_create (link); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link->local_sink); + aconn->hdmi_prev_sink =dm_test_sink_create (link); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, aconn->hdmi_prev_sink); + +amdgpu_dm_hdmi_hpd_debounce_work (&aconn->hdmi_hpd_debounce_work.work); + +KUNIT_EXPECT_NULL (test, aconn->hdmi_prev_sink); + +dm_test_sink_release (link->local_sink); +} + +/** +* dm_test_hdmi_hpd_debounce_sink_changed - Test the real-hotplug path +* @test: The KUnit test context +* +* A re-detect that finds a different sink than the one cached before the HPD +* toggle is a real hotplug, so userspace must be notified. Sending the uevent +* needs a registered DRM device. +*/ +static void dm_test_hdmi_hpd_debounce_sink_changed (struct kunit *test) +{ +struct amdgpu_dm_connector *aconn; +struct link_service *link_srv; + + aconn =dm_test_setup_hdmi_debounce (test, &link_srv); +dm_test_register_drm_dev (test,drm_to_adev (aconn->base.dev)); + + link_srv->detect_link = dm_test_detect_link_true; + aconn->mst_mgr.mst_state = true; + +/* The link lost its sink, so it cannot match the cached one. */ + aconn->hdmi_prev_sink =dm_test_sink_create (aconn->dc_link); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, aconn->hdmi_prev_sink); + +amdgpu_dm_hdmi_hpd_debounce_work (&aconn->hdmi_hpd_debounce_work.work); + +KUNIT_EXPECT_NULL (test, aconn->hdmi_prev_sink); +} +/* Tests for handle_hpd_irq()/handle_hpd_irq_helper() */ /**
@@ -5298,6 +5410,8 @@ static struct kunit_case amdgpu_dm_irq_tests[] = {/* amdgpu_dm_hdmi_hpd_debounce_work */ KUNIT_CASE (dm_test_hdmi_hpd_debounce_detect_false),KUNIT_CASE (dm_test_hdmi_hpd_debounce_reallow_idle), +KUNIT_CASE (dm_test_hdmi_hpd_debounce_sink_unchanged), +KUNIT_CASE (dm_test_hdmi_hpd_debounce_sink_changed),/* handle_hpd_irq/handle_hpd_irq_helper */ KUNIT_CASE (dm_test_handle_hpd_irq_disabled), KUNIT_CASE(dm_test_handle_hpd_irq_helper_debounce_schedule),
Signature · 1 line
2.55.0
PATCH 35/64 drm/amd/display: Test HPD handler HDCP and detect
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHAT]handle_hpd_irq_helper() never ran its HDCP reset, its forced connector branch or its successful re-detect branch.
[HOW]
Add a minimal HDCP work queue fixture and three tests: an HPD on a driver that carries an HDCP work queue, which must reset the display and flag the connector state; a connector forced on that reports no connection and is emulated instead of detected; and a successful re-detect that notifies userspace.
--- .../amdgpu_dm/tests/amdgpu_dm_irq_test.c | 119 ++++++++++++++++++ 1 file changed, 119 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c +119 -0
@@ -21,6 +21,7 @@#include "amdgpu.h" #include "amdgpu_mode.h" #include "amdgpu_dm.h" +#include "amdgpu_dm_hdcp.h" #include "amdgpu_dm_irq.h" #include "amdgpu_dm_kunit_test_helpers.h" #include "dc_dmub_srv.h"
@@ -547,6 +548,39 @@ static void dm_test_register_drm_dev(struct kunit *test, struct amdgpu_device *a &adev->ddev), 0); } +static void dm_test_hdcp_dummy_work (struct work_struct *work) +{ +} + +/* +* Allocate the minimal hdcp_workqueue that hdcp_reset_display() and +* hdcp_handle_cpirq() touch: the per-link mutex, the delayed works +* process_output() re-arms, and the CP IRQ work item. +*/ +static struct hdcp_workqueue *dm_test_alloc_hdcp_workqueue (struct kunit *test) +{ +struct hdcp_workqueue *hdcp_work; + + hdcp_work =kunit_kzalloc (test,sizeof (*hdcp_work),GFP_KERNEL ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, hdcp_work); + +mutex_init (&hdcp_work->mutex); +INIT_WORK (&hdcp_work->cpirq_work, dm_test_hdcp_dummy_work); +INIT_DELAYED_WORK (&hdcp_work->callback_dwork, dm_test_hdcp_dummy_work); +INIT_DELAYED_WORK (&hdcp_work->watchdog_timer_dwork, dm_test_hdcp_dummy_work); +INIT_DELAYED_WORK (&hdcp_work->property_validate_dwork, dm_test_hdcp_dummy_work); + +return hdcp_work; +} + +static void dm_test_flush_hdcp_workqueue (struct hdcp_workqueue *hdcp_work) +{ +flush_work (&hdcp_work->cpirq_work); +cancel_delayed_work_sync (&hdcp_work->callback_dwork); +cancel_delayed_work_sync (&hdcp_work->watchdog_timer_dwork); +cancel_delayed_work_sync (&hdcp_work->property_validate_dwork); +} +/* Tests for amdgpu_dm_hpd_to_dal_irq_source() */ /**
@@ -3206,6 +3240,88 @@ static void dm_test_handle_hpd_irq_helper_detect_type_fails(struct kunit *test)KUNIT_EXPECT_FALSE (test, aconn->fake_enable); } +/** +* dm_test_handle_hpd_irq_helper_hdcp_reset - Test the HDCP reset branch +* @test: The KUnit test context +* +* An HPD invalidates the link's HDCP authentication, so a driver carrying an +* HDCP work queue must reset the display and flag the connector state for a +* property update. +*/ +static void dm_test_handle_hpd_irq_helper_hdcp_reset (struct kunit *test) +{ +struct amdgpu_dm_connector *aconn; +struct hdcp_workqueue *hdcp_work; +struct link_service *link_srv; + + aconn =dm_test_setup_hpd_irq_helper (test, &link_srv); + link_srv->detect_link = dm_test_detect_link_false; + + hdcp_work =dm_test_alloc_hdcp_workqueue (test); +drm_to_adev (aconn->base.dev)->dm.hdcp_workqueue = hdcp_work; + +handle_hpd_irq_helper (aconn,DETECT_REASON_HPD ); + +KUNIT_EXPECT_TRUE (test,to_dm_connector_state (aconn->base.state)->update_hdcp); + +dm_test_flush_hdcp_workqueue (hdcp_work); +} + +/** +* dm_test_handle_hpd_irq_helper_forced_detect - Test the forced-connector branch +* @test: The KUnit test context +* +* A connector forced on but reporting no connection is emulated rather than +* detected, and an HPD RX always notifies userspace. An unset connector signal +* keeps amdgpu_dm_emulated_link_detect() to its unsupported-signal early +* return. +*/ +static void dm_test_handle_hpd_irq_helper_forced_detect (struct kunit *test) +{ +struct amdgpu_dm_connector *aconn; +struct link_service *link_srv; + + dm_test_detect_link_count =0 ; + + aconn =dm_test_setup_hpd_irq_helper (test, &link_srv); +dm_test_register_drm_dev (test,drm_to_adev (aconn->base.dev)); + + link_srv->detect_link = dm_test_detect_link_false_count; + aconn->base.force =DRM_FORCE_ON ; + aconn->dc_link->ctx->driver_context =drm_to_adev (aconn->base.dev); + +handle_hpd_irq_helper (aconn,DETECT_REASON_HPDRX ); + +/* The emulated path replaces detection entirely. */ +KUNIT_EXPECT_EQ (test, dm_test_detect_link_count,0 ); +} + +/** +* dm_test_handle_hpd_irq_helper_detect_true - Test the connected detect branch +* @test: The KUnit test context +* +* A successful re-detect refreshes the connector state and notifies userspace. +* An MST-state connector keeps amdgpu_dm_update_connector_after_detect() to its +* early return. +*/ +static void dm_test_handle_hpd_irq_helper_detect_true (struct kunit *test) +{ +struct amdgpu_dm_connector *aconn; +struct link_service *link_srv; + + aconn =dm_test_setup_hpd_irq_helper (test, &link_srv); +dm_test_register_drm_dev (test,drm_to_adev (aconn->base.dev)); + + link_srv->detect_connection_type = dm_test_detect_connection_single; + link_srv->detect_link = dm_test_detect_link_true; + aconn->mst_mgr.mst_state = true; + aconn->fake_enable = true; + +handle_hpd_irq_helper (aconn,DETECT_REASON_HPD ); + +KUNIT_EXPECT_FALSE (test, aconn->fake_enable); +} +/** * dm_test_handle_hpd_irq_helper_debounce_pending - Test pending-debounce exit * @test: The KUnit test context
@@ -5419,6 +5535,9 @@ static struct kunit_case amdgpu_dm_irq_tests[] = {KUNIT_CASE (dm_test_handle_hpd_irq_helper_detect_false),KUNIT_CASE (dm_test_handle_hpd_irq_helper_detect_type_fails),KUNIT_CASE (dm_test_handle_hpd_irq_helper_debounce_pending), +KUNIT_CASE (dm_test_handle_hpd_irq_helper_hdcp_reset), +KUNIT_CASE (dm_test_handle_hpd_irq_helper_forced_detect), +KUNIT_CASE (dm_test_handle_hpd_irq_helper_detect_true),/* handle_hpd_rx_irq/schedule_hpd_rx_offload_work */ KUNIT_CASE (dm_test_handle_hpd_rx_irq_disabled), KUNIT_CASE(dm_test_handle_hpd_rx_irq_no_left_work),
Signature · 1 line
2.55.0
PATCH 36/64 drm/amd/display: Test HPD RX downstream handling
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHAT]handle_hpd_rx_irq() left its whole post-detect block untested apart from a failing re-detect, and never dispatched a CP_IRQ.
[HOW]
Add four tests covering a failing connection-type probe, a connector forced on that is emulated instead of detected, a successful re-detect that notifies userspace, and a CP_IRQ that must be handed to the HDCP work queue for the connector that raised it.
--- .../amdgpu_dm/tests/amdgpu_dm_irq_test.c | 134 ++++++++++++++++++ 1 file changed, 134 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c +134 -0
@@ -231,6 +231,19 @@ static bool dm_test_handle_hpd_rx_result_true(struct dc_link *link,return true; } +static bool dm_test_handle_hpd_rx_cp_irq (struct dc_link *link, +union hpd_irq_data *hpd_irq_data, +bool *link_loss, +bool defer_handling, +bool *has_left_work) +{ + *link_loss = false; + *has_left_work = false; + hpd_irq_data->bytes.device_service_irq.bits.CP_IRQ =1 ; + +return false; +} +static bool dm_test_allow_hpd_rx_irq_true (const struct dc_link *link) {return true;
@@ -3594,6 +3607,123 @@ static void dm_test_handle_hpd_rx_irq_downstream_change(struct kunit *test)KUNIT_EXPECT_TRUE (test, aconn->fake_enable); } +/** +* dm_test_handle_hpd_rx_irq_detect_type_fails - Test HPDRX detect failure logging +* @test: The KUnit test context +* +* A handled HPD RX IRQ on a connector that is not an MST root means a +* downstream port status change, so the handler must re-detect the link. The +* connection-type probe is stubbed to fail, so it logs an error and continues +* into the re-detect branch, and a non-MST-branch link also exercises the +* trailing CEC IRQ dispatch. +*/ +static void dm_test_handle_hpd_rx_irq_detect_type_fails (struct kunit *test) +{ +struct amdgpu_dm_connector *aconn; +struct link_service *link_srv; + + dm_test_detect_link_count =0 ; + + aconn =dm_test_setup_hpd_rx_irq (test, &link_srv); + link_srv->dp_handle_hpd_rx_irq = dm_test_handle_hpd_rx_result_true; + link_srv->detect_connection_type = dm_test_detect_connection_fail; + link_srv->detect_link = dm_test_detect_link_false_count; + + aconn->mst_mgr.mst_state = false; + aconn->dc_link->type = dc_connection_single; + +handle_hpd_rx_irq (aconn); + +KUNIT_EXPECT_EQ (test, dm_test_detect_link_count,1 ); +} + +/** +* dm_test_handle_hpd_rx_irq_forced_detect - Test HPDRX forced-connector branch +* @test: The KUnit test context +* +* A connector forced on but reporting no connection is emulated rather than +* detected, and userspace is always notified. An unset connector signal keeps +* amdgpu_dm_emulated_link_detect() to its unsupported-signal early return, and +* a sink-less link keeps amdgpu_dm_update_connector_after_detect() to its +* unchanged-sink early return. +*/ +static void dm_test_handle_hpd_rx_irq_forced_detect (struct kunit *test) +{ +struct amdgpu_dm_connector *aconn; +struct link_service *link_srv; + + dm_test_detect_link_count =0 ; + + aconn =dm_test_setup_hpd_rx_irq (test, &link_srv); +dm_test_register_drm_dev (test,drm_to_adev (aconn->base.dev)); + + link_srv->dp_handle_hpd_rx_irq = dm_test_handle_hpd_rx_result_true; + link_srv->detect_connection_type = dm_test_detect_connection_none; + link_srv->detect_link = dm_test_detect_link_false_count; + + aconn->mst_mgr.mst_state = false; + aconn->base.force =DRM_FORCE_ON ; + aconn->dc_link->ctx->driver_context =drm_to_adev (aconn->base.dev); + aconn->fake_enable = true; + +handle_hpd_rx_irq (aconn); + +KUNIT_EXPECT_FALSE (test, aconn->fake_enable); +KUNIT_EXPECT_EQ (test, dm_test_detect_link_count,0 ); +} + +/** +* dm_test_handle_hpd_rx_irq_detect_true - Test HPDRX connected detect branch +* @test: The KUnit test context +* +* A downstream-port change that re-detects a display refreshes the connector +* and notifies userspace. A sink-less link keeps +* amdgpu_dm_update_connector_after_detect() to its unchanged-sink early return. +*/ +static void dm_test_handle_hpd_rx_irq_detect_true (struct kunit *test) +{ +struct amdgpu_dm_connector *aconn; +struct link_service *link_srv; + + aconn =dm_test_setup_hpd_rx_irq (test, &link_srv); +dm_test_register_drm_dev (test,drm_to_adev (aconn->base.dev)); + + link_srv->dp_handle_hpd_rx_irq = dm_test_handle_hpd_rx_result_true; + link_srv->detect_connection_type = dm_test_detect_connection_single; + link_srv->detect_link = dm_test_detect_link_true; + + aconn->mst_mgr.mst_state = false; + aconn->fake_enable = true; + +handle_hpd_rx_irq (aconn); + +KUNIT_EXPECT_FALSE (test, aconn->fake_enable); +} + +/** +* dm_test_handle_hpd_rx_irq_cp_irq - Test HPDRX content-protection dispatch +* @test: The KUnit test context +* +* A CP_IRQ in the device service field must be handed to the HDCP work queue +* for the connector that raised it. +*/ +static void dm_test_handle_hpd_rx_irq_cp_irq (struct kunit *test) +{ +struct amdgpu_dm_connector *aconn; +struct hdcp_workqueue *hdcp_work; +struct link_service *link_srv; + + aconn =dm_test_setup_hpd_rx_irq (test, &link_srv); + link_srv->dp_handle_hpd_rx_irq = dm_test_handle_hpd_rx_cp_irq; + + hdcp_work =dm_test_alloc_hdcp_workqueue (test); +drm_to_adev (aconn->base.dev)->dm.hdcp_workqueue = hdcp_work; + +handle_hpd_rx_irq (aconn); + +dm_test_flush_hdcp_workqueue (hdcp_work); +} +/* Tests for dmub_hpd_callback()/dmub_hpd_sense_callback() */ /**
@@ -5545,6 +5675,10 @@ static struct kunit_case amdgpu_dm_irq_tests[] = {KUNIT_CASE (dm_test_handle_hpd_rx_irq_msg_rdy),KUNIT_CASE (dm_test_handle_hpd_rx_irq_link_loss),KUNIT_CASE (dm_test_handle_hpd_rx_irq_downstream_change), +KUNIT_CASE (dm_test_handle_hpd_rx_irq_detect_type_fails), +KUNIT_CASE (dm_test_handle_hpd_rx_irq_forced_detect), +KUNIT_CASE (dm_test_handle_hpd_rx_irq_detect_true), +KUNIT_CASE (dm_test_handle_hpd_rx_irq_cp_irq),KUNIT_CASE (dm_test_schedule_hpd_rx_offload_work),/* dmub_hpd_callback/dmub_hpd_sense_callback */ KUNIT_CASE(dm_test_dmub_hpd_callback_null_inputs),
Signature · 1 line
2.55.0
PATCH 37/64 drm/amd/display: Drop redundant amdgpu_dm_irq tests
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHAT]
Thirteen tests in the amdgpu_dm_irq suite only re-ran a path that another test already covered, and five more repeated setup that the fixtures added by the preceding patches now provide.
[HOW]
Delete the tests whose executed path is a strict subset of another's, and fold the remaining duplicated setup onto the shared fixtures.
--- .../amdgpu_dm/tests/amdgpu_dm_irq_test.c | 499 +----------------- 1 file changed, 11 insertions(+), 488 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c +11 -488
@@ -266,7 +266,6 @@ static const struct timing_generator_funcs dm_test_tg_funcs = { .get_scanoutpos = dm_test_tg_get_scanoutpos, }; -static uint32_t dm_test_dmub_get_outbox0_wptr (struct dmub_srv *dmub) {return 0 ;
@@ -666,27 +665,8 @@ static void dm_test_hpd_to_dal_irq_source_invalid(struct kunit *test) (int)DC_IRQ_SOURCE_INVALID); } -/** -* dm_test_hpd_to_dal_irq_source_out_of_range - Test Hpd to dal irq source out of range -* @test: The KUnit test context -*/ -static void dm_test_hpd_to_dal_irq_source_out_of_range (struct kunit *test) -{ -KUNIT_EXPECT_EQ (test, (int )amdgpu_dm_hpd_to_dal_irq_source (99 ), - (int )DC_IRQ_SOURCE_INVALID ); -} -/* Tests for are_sinks_equal() */ -/** -* dm_test_are_sinks_equal_both_null - Test Are sinks equal both null -* @test: The KUnit test context -*/ -static void dm_test_are_sinks_equal_both_null (struct kunit *test) -{ -KUNIT_EXPECT_FALSE (test,are_sinks_equal (NULL ,NULL )); -} -/** * dm_test_are_sinks_equal_first_null - Test Are sinks equal first null * @test: The KUnit test context
@@ -778,29 +758,6 @@ static void dm_test_are_sinks_equal_different_edid_data(struct kunit *test)KUNIT_EXPECT_FALSE (test,are_sinks_equal (sink1, sink2)); } -/** -* dm_test_are_sinks_equal_identical - Test Are sinks equal identical -* @test: The KUnit test context -*/ -static void dm_test_are_sinks_equal_identical (struct kunit *test) -{ -struct dc_sink *sink1, *sink2; - - sink1 =kunit_kzalloc (test,sizeof (*sink1),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, sink1); - sink2 =kunit_kzalloc (test,sizeof (*sink2),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, sink2); - - sink1->sink_signal =SIGNAL_TYPE_HDMI_TYPE_A ; - sink2->sink_signal =SIGNAL_TYPE_HDMI_TYPE_A ; - sink1->dc_edid.length =4 ; - sink2->dc_edid.length =4 ; -memset (sink1->dc_edid.raw_edid,0xAA ,4 ); -memset (sink2->dc_edid.raw_edid,0xAA ,4 ); - -KUNIT_EXPECT_TRUE (test,are_sinks_equal (sink1, sink2)); -} -/** * dm_test_are_sinks_equal_zero_length - Test Are sinks equal zero length * @test: The KUnit test context
@@ -1044,105 +1001,6 @@ static void dm_test_irq_register_rejects_invalid_source(struct kunit *test) dm_test_irq_handler, NULL)); } -/** -* dm_test_irq_register_adds_low_context_handler - Test register adds low handler -* @test: The KUnit test context -*/ -static void dm_test_irq_register_adds_low_context_handler (struct kunit *test) -{ -struct amdgpu_device *adev; -struct dc_interrupt_params int_params = {0 }; -void *handler; - - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); -KUNIT_ASSERT_EQ (test,amdgpu_dm_irq_init (adev),0 ); - - int_params.int_context =INTERRUPT_LOW_IRQ_CONTEXT ; - int_params.irq_source =DC_IRQ_SOURCE_HPD1 ; - - handler =amdgpu_dm_irq_register_interrupt (adev, &int_params, - dm_test_irq_handler, adev); - -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, handler); -KUNIT_EXPECT_FALSE (test, -list_empty (&adev->dm.irq_handler_list_low_tab[DC_IRQ_SOURCE_HPD1 ])); -KUNIT_EXPECT_TRUE (test, -list_empty (&adev->dm.irq_handler_list_high_tab[DC_IRQ_SOURCE_HPD1 ])); - -amdgpu_dm_irq_unregister_interrupt (adev,DC_IRQ_SOURCE_HPD1 , - dm_test_irq_handler); -KUNIT_EXPECT_TRUE (test, -list_empty (&adev->dm.irq_handler_list_low_tab[DC_IRQ_SOURCE_HPD1 ])); -} - -/** -* dm_test_irq_register_adds_high_context_handler - Test register adds high handler -* @test: The KUnit test context -*/ -static void dm_test_irq_register_adds_high_context_handler (struct kunit *test) -{ -struct amdgpu_device *adev; -struct dc_interrupt_params int_params = {0 }; -void *handler; - - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); -KUNIT_ASSERT_EQ (test,amdgpu_dm_irq_init (adev),0 ); - - int_params.int_context =INTERRUPT_HIGH_IRQ_CONTEXT ; - int_params.irq_source =DC_IRQ_SOURCE_HPD2 ; - - handler =amdgpu_dm_irq_register_interrupt (adev, &int_params, - dm_test_irq_handler, adev); - -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, handler); -KUNIT_EXPECT_FALSE (test, -list_empty (&adev->dm.irq_handler_list_high_tab[DC_IRQ_SOURCE_HPD2 ])); -KUNIT_EXPECT_TRUE (test, -list_empty (&adev->dm.irq_handler_list_low_tab[DC_IRQ_SOURCE_HPD2 ])); - -amdgpu_dm_irq_unregister_interrupt (adev,DC_IRQ_SOURCE_HPD2 , - dm_test_irq_handler); -KUNIT_EXPECT_TRUE (test, -list_empty (&adev->dm.irq_handler_list_high_tab[DC_IRQ_SOURCE_HPD2 ])); -} - -/** -* dm_test_irq_register_multiple_handlers - Test register keeps multiple handlers -* @test: The KUnit test context -*/ -static void dm_test_irq_register_multiple_handlers (struct kunit *test) -{ -struct amdgpu_device *adev; -struct dc_interrupt_params int_params = {0 }; -struct list_head *hnd_list; -void *handler1, *handler2; - - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); -KUNIT_ASSERT_EQ (test,amdgpu_dm_irq_init (adev),0 ); - - int_params.int_context =INTERRUPT_LOW_IRQ_CONTEXT ; - int_params.irq_source =DC_IRQ_SOURCE_HPD1 ; - - handler1 =amdgpu_dm_irq_register_interrupt (adev, &int_params, - dm_test_irq_handler, adev); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, handler1); - handler2 =amdgpu_dm_irq_register_interrupt (adev, &int_params, - dm_test_irq_handler_alt, adev); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, handler2); - - hnd_list = &adev->dm.irq_handler_list_low_tab[DC_IRQ_SOURCE_HPD1 ]; -KUNIT_EXPECT_EQ (test,list_count_nodes (hnd_list),2 ); - -amdgpu_dm_irq_unregister_interrupt (adev,DC_IRQ_SOURCE_HPD1 , - dm_test_irq_handler); -amdgpu_dm_irq_unregister_interrupt (adev,DC_IRQ_SOURCE_HPD1 , - dm_test_irq_handler_alt); -KUNIT_EXPECT_TRUE (test,list_empty (hnd_list)); -} -/** * dm_test_irq_register_separate_contexts - Test register same source in two contexts * @test: The KUnit test context
@@ -1870,48 +1728,6 @@ static void dm_test_set_pflip_irq_state_disable(struct kunit *test) amdgpu_dm_set_pflip_irq_state(adev, NULL, 0, AMDGPU_IRQ_STATE_DISABLE), 0); } -/** -* dm_test_set_vline0_irq_state_enable - Test vline0 irq state reaches DC (enable) -* @test: The KUnit test context -*/ -static void dm_test_set_vline0_irq_state_enable (struct kunit *test) -{ -struct amdgpu_device *adev; -struct amdgpu_crtc *acrtc; - - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); - acrtc =kunit_kzalloc (test,sizeof (*acrtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, acrtc); - - acrtc->otg_inst =0 ; - adev->mode_info.crtcs[0 ] = acrtc; - -KUNIT_EXPECT_EQ (test, -amdgpu_dm_set_vline0_irq_state (adev,NULL ,0 ,AMDGPU_IRQ_STATE_ENABLE ),0 ); -} - -/** -* dm_test_set_vupdate_irq_state_enable - Test vupdate irq state reaches DC (enable) -* @test: The KUnit test context -*/ -static void dm_test_set_vupdate_irq_state_enable (struct kunit *test) -{ -struct amdgpu_device *adev; -struct amdgpu_crtc *acrtc; - - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); - acrtc =kunit_kzalloc (test,sizeof (*acrtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, acrtc); - - acrtc->otg_inst =2 ; - adev->mode_info.crtcs[0 ] = acrtc; - -KUNIT_EXPECT_EQ (test, -amdgpu_dm_set_vupdate_irq_state (adev,NULL ,0 ,AMDGPU_IRQ_STATE_ENABLE ),0 ); -} -/** * dm_test_set_crtc_irq_state_allows_idle - Test the idle-optimization branch * @test: The KUnit test context
@@ -1971,34 +1787,6 @@ static void dm_test_irq_immediate_work_empty(struct kunit *test)amdgpu_dm_irq_immediate_work (adev,DC_IRQ_SOURCE_HPD1 ); } -/** -* dm_test_irq_immediate_work_invokes_handler - Test immediate work calls handler -* @test: The KUnit test context -*/ -static void dm_test_irq_immediate_work_invokes_handler (struct kunit *test) -{ -struct amdgpu_device *adev; -struct dc_interrupt_params int_params = {0 }; -int count =0 ; -void *handler; - - adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); -KUNIT_ASSERT_EQ (test,amdgpu_dm_irq_init (adev),0 ); - - int_params.int_context =INTERRUPT_HIGH_IRQ_CONTEXT ; - int_params.irq_source =DC_IRQ_SOURCE_HPD1 ; - handler =amdgpu_dm_irq_register_interrupt (adev, &int_params, - dm_test_irq_handler_count, &count); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, handler); - -/* High-context handlers are invoked synchronously, in-place. */ -amdgpu_dm_irq_immediate_work (adev,DC_IRQ_SOURCE_HPD1 ); -KUNIT_EXPECT_EQ (test, count,1 ); - -amdgpu_dm_irq_unregister_interrupt (adev,DC_IRQ_SOURCE_HPD1 , dm_test_irq_handler_count); -} -/** * dm_test_irq_immediate_work_invokes_all - Test immediate work calls all handlers * @test: The KUnit test context
@@ -2449,52 +2237,6 @@ static void dm_test_hpd_rx_offload_work_no_connector(struct kunit *test)dm_handle_hpd_rx_offload_work (&offload_work->work); } -/** -* dm_test_hpd_rx_offload_work_no_connection - Test no connection early exit -* @test: The KUnit test context -*/ -static void dm_test_hpd_rx_offload_work_no_connection (struct kunit *test) -{ -struct hpd_rx_irq_offload_work_queue *offload_wq; -struct hpd_rx_irq_offload_work *offload_work; -struct amdgpu_dm_connector *aconn; -struct link_service *link_srv; -struct amdgpu_device *adev; -struct dc_link *link; -struct dc *dc; - - adev =dm_kunit_alloc_adev (test); -mutex_init (&adev->dm.dc_lock); - - offload_wq =kunit_kzalloc (test,sizeof (*offload_wq),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, offload_wq); - - aconn =dm_kunit_alloc_connector (test, adev,NULL ); -mutex_init (&aconn->hpd_lock); - offload_wq->aconnector = aconn; - - dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc); - - link_srv =kunit_kzalloc (test,sizeof (*link_srv),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link_srv); - link_srv->detect_connection_type = dm_test_detect_connection_none; - dc->link_srv = link_srv; - - link =kunit_kzalloc (test,sizeof (*link),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link); - link->dc = dc; - aconn->dc_link = link; - - offload_work =kzalloc (sizeof (*offload_work),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, offload_work); - offload_work->offload_wq = offload_wq; - offload_work->adev = adev; -INIT_WORK (&offload_work->work, dm_handle_hpd_rx_offload_work); - -dm_handle_hpd_rx_offload_work (&offload_work->work); -} -/* * Build a queued hpd_rx_irq_offload_work for dm_handle_hpd_rx_offload_work(): * an adev that is not in reset, an offload queue owning a connector with an
@@ -2656,58 +2398,15 @@ static void dm_test_hpd_rx_offload_work_msg_rdy(struct kunit *test)*/ static void dm_test_hpd_rx_offload_work_automated_test (struct kunit *test) { -struct hpd_rx_irq_offload_work_queue *offload_wq;struct hpd_rx_irq_offload_work *offload_work; -struct amdgpu_dm_connector *aconn;struct link_service *link_srv; -struct amdgpu_device *adev; -struct dc_context *ctx; -struct dc_link *link; -struct dc *dc; dm_test_automated_test_count =0 ; - adev =dm_kunit_alloc_adev (test); -mutex_init (&adev->dm.dc_lock); - adev->reset_domain =kunit_kzalloc (test,sizeof (*adev->reset_domain), -GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev->reset_domain); - - offload_wq =kunit_kzalloc (test,sizeof (*offload_wq),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, offload_wq); -spin_lock_init (&offload_wq->offload_lock); - - aconn =dm_kunit_alloc_connector (test, adev,NULL ); -mutex_init (&aconn->hpd_lock); - aconn->timing_changed = false; - offload_wq->aconnector = aconn; - - dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc); - ctx =kunit_kzalloc (test,sizeof (*ctx),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - link_srv =kunit_kzalloc (test,sizeof (*link_srv),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link_srv); - link =kunit_kzalloc (test,sizeof (*link),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link); - - link_srv->detect_connection_type = dm_test_detect_connection_single; + offload_work =dm_test_setup_hpd_rx_offload_work (test, &link_srv); link_srv->dp_handle_automated_test = dm_test_dp_handle_automated_test; - dc->link_srv = link_srv; - dc->ctx = ctx; - ctx->dc = dc; - link->dc = dc; - link->ctx = ctx; - link->aux_access_disabled = true; - link->connector_signal =SIGNAL_TYPE_DISPLAY_PORT ; - aconn->dc_link = link; - - offload_work =kzalloc (sizeof (*offload_work),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, offload_work); - offload_work->offload_wq = offload_wq; - offload_work->adev = adev; + offload_work->offload_wq->aconnector->dc_link->aux_access_disabled = true; offload_work->data.bytes.device_service_irq.bits.AUTOMATED_TEST =1 ; -INIT_WORK (&offload_work->work, dm_handle_hpd_rx_offload_work);dm_handle_hpd_rx_offload_work (&offload_work->work);
@@ -2757,58 +2456,16 @@ static void dm_test_hpd_rx_offload_work_timing_changed(struct kunit *test)*/ static void dm_test_hpd_rx_offload_work_link_loss (struct kunit *test) { -struct hpd_rx_irq_offload_work_queue *offload_wq;struct hpd_rx_irq_offload_work *offload_work; -struct amdgpu_dm_connector *aconn;struct link_service *link_srv; -struct amdgpu_device *adev; -struct dc_context *ctx; -struct dc_link *link; -struct dc *dc; dm_test_handle_link_loss_count =0 ; - adev =dm_kunit_alloc_adev (test); -mutex_init (&adev->dm.dc_lock); - adev->reset_domain =kunit_kzalloc (test,sizeof (*adev->reset_domain), -GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev->reset_domain); - - offload_wq =kunit_kzalloc (test,sizeof (*offload_wq),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, offload_wq); -spin_lock_init (&offload_wq->offload_lock); - - aconn =dm_kunit_alloc_connector (test, adev,NULL ); -mutex_init (&aconn->hpd_lock); - offload_wq->aconnector = aconn; - - dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc); - ctx =kunit_kzalloc (test,sizeof (*ctx),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - link_srv =kunit_kzalloc (test,sizeof (*link_srv),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link_srv); - link =kunit_kzalloc (test,sizeof (*link),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link); - - link_srv->detect_connection_type = dm_test_detect_connection_single; + offload_work =dm_test_setup_hpd_rx_offload_work (test, &link_srv); link_srv->dp_parse_link_loss_status = dm_test_dp_parse_link_loss_true; link_srv->dp_should_allow_hpd_rx_irq = dm_test_dp_should_allow_hpd_rx_irq_true; link_srv->dp_read_hpd_rx_irq_data = dm_test_dp_read_hpd_rx_irq_data_ok; link_srv->dp_handle_link_loss = dm_test_dp_handle_link_loss; - dc->link_srv = link_srv; - dc->ctx = ctx; - ctx->dc = dc; - link->dc = dc; - link->ctx = ctx; - link->connector_signal =SIGNAL_TYPE_DISPLAY_PORT ; - aconn->dc_link = link; - - offload_work =kzalloc (sizeof (*offload_work),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, offload_work); - offload_work->offload_wq = offload_wq; - offload_work->adev = adev; -INIT_WORK (&offload_work->work, dm_handle_hpd_rx_offload_work);dm_handle_hpd_rx_offload_work (&offload_work->work);
@@ -2870,35 +2527,8 @@ static void dm_test_hdmi_hpd_debounce_detect_false(struct kunit *test) {struct amdgpu_dm_connector *aconn;struct link_service *link_srv; -struct amdgpu_device *adev; -struct dc_context *ctx; -struct dc_link *link; -struct dc *dc; - - adev =dm_kunit_alloc_adev (test); -mutex_init (&adev->dm.dc_lock); - - aconn =dm_kunit_alloc_connector (test, adev,NULL ); -mutex_init (&aconn->hpd_lock); -INIT_DELAYED_WORK (&aconn->hdmi_hpd_debounce_work, - amdgpu_dm_hdmi_hpd_debounce_work); - - dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc); - ctx =kunit_kzalloc (test,sizeof (*ctx),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - link_srv =kunit_kzalloc (test,sizeof (*link_srv),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link_srv); - link =kunit_kzalloc (test,sizeof (*link),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link); - link_srv->detect_link = dm_test_detect_link_false; - dc->ctx = ctx; - dc->link_srv = link_srv; - ctx->dc = dc; - link->dc = dc; - link->ctx = ctx; - aconn->dc_link = link; + aconn =dm_test_setup_hdmi_debounce (test, &link_srv);amdgpu_dm_hdmi_hpd_debounce_work (&aconn->hdmi_hpd_debounce_work.work);KUNIT_EXPECT_NULL (test, aconn->hdmi_prev_sink);
@@ -2919,43 +2549,19 @@ static void dm_test_hdmi_hpd_debounce_reallow_idle(struct kunit *test)struct amdgpu_dm_connector *aconn;struct link_service *link_srv;struct dc_dmub_srv *dmub_srv; -struct amdgpu_device *adev;struct dal_logger *logger; -struct dc_context *ctx; -struct dc_link *link;struct dc *dc; - adev =dm_kunit_alloc_adev (test); -mutex_init (&adev->dm.dc_lock); - - aconn =dm_kunit_alloc_connector (test, adev,NULL ); -mutex_init (&aconn->hpd_lock); -INIT_DELAYED_WORK (&aconn->hdmi_hpd_debounce_work, - amdgpu_dm_hdmi_hpd_debounce_work); + aconn =dm_test_setup_hdmi_debounce (test, &link_srv); + dc = aconn->dc_link->ctx->dc; - dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc); - ctx =kunit_kzalloc (test,sizeof (*ctx),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); - link_srv =kunit_kzalloc (test,sizeof (*link_srv),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link_srv); - link =kunit_kzalloc (test,sizeof (*link),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link); logger =kunit_kzalloc (test,sizeof (*logger),GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, logger); dmub_srv =kunit_kzalloc (test,sizeof (*dmub_srv),GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dmub_srv); - link_srv->detect_link = dm_test_detect_link_false; - dc->ctx = ctx; - dc->link_srv = link_srv; - ctx->dc = dc; - link->dc = dc; - link->ctx = ctx; - aconn->dc_link = link; -/* DC_LOG_* dereferences ctx->logger->dev, so wire a real drm device. */ - logger->dev = &adev->ddev; + logger->dev = aconn->base.dev; dc->ctx->logger = logger;/* Make reallow_idle true and keep dc_allow_idle*() a safe early return. */
@@ -2965,7 +2571,7 @@ static void dm_test_hdmi_hpd_debounce_reallow_idle(struct kunit *test) dc->debug.disable_idle_power_optimizations = true;/* A cached previous sink must be released and cleared. */ - aconn->hdmi_prev_sink =dm_test_sink_create (link); + aconn->hdmi_prev_sink =dm_test_sink_create (aconn->dc_link);KUNIT_ASSERT_NOT_ERR_OR_NULL (test, aconn->hdmi_prev_sink);amdgpu_dm_hdmi_hpd_debounce_work (&aconn->hdmi_hpd_debounce_work.work);
@@ -3206,37 +2812,13 @@ static void dm_test_handle_hpd_irq_helper_debounce_release_prev(struct kunit *tedm_test_sink_release (link->local_sink); } -/** -* dm_test_handle_hpd_irq_helper_detect_false - Test immediate detect branch -* @test: The KUnit test context -* -* With no force, no debounce, and detection stubbed to report no connection, -* the helper takes the else branch: dc_exit_ips_for_hw_access() is a safe -* no-op (no IPS support) and dc_link_detect() returns false, so the connected -* if (ret) block is skipped. fake_enable must still be cleared. -*/ -static void dm_test_handle_hpd_irq_helper_detect_false (struct kunit *test) -{ -struct amdgpu_dm_connector *aconn; -struct link_service *link_srv; - - aconn =dm_test_setup_hpd_irq_helper (test, &link_srv); - link_srv->detect_link = dm_test_detect_link_false; - aconn->fake_enable = true; - -/* No debounce delay and no force -> immediate-detect else branch. */ -handle_hpd_irq_helper (aconn,DETECT_REASON_HPD ); - -KUNIT_EXPECT_FALSE (test, aconn->fake_enable); -} -/** * dm_test_handle_hpd_irq_helper_detect_type_fails - Test detect failure logging * @test: The KUnit test context * -* When dc_link_detect_connection_type() itself fails the helper logs an error -* and carries on with the connection type left as none, so it still falls -* through to the immediate-detect branch. +* When dc_link_detect_connection_type() fails the helper logs an error and +* carries on with the connection type left as none, so with no force and no +* debounce it still takes the immediate-detect branch. */ static void dm_test_handle_hpd_irq_helper_detect_type_fails (struct kunit *test) {
@@ -3497,24 +3079,6 @@ static struct amdgpu_dm_connector *dm_test_setup_hpd_rx_irq(struct kunit *test,return aconn; } -/** -* dm_test_handle_hpd_rx_irq_no_left_work - Test HPDRX early out (no left work) -* @test: The KUnit test context -* -* When dc_link_handle_hpd_rx_irq() reports no left-over work, the handler -* jumps to out and returns without scheduling any offload work. -*/ -static void dm_test_handle_hpd_rx_irq_no_left_work (struct kunit *test) -{ -struct amdgpu_dm_connector *aconn; -struct link_service *link_srv; - - aconn =dm_test_setup_hpd_rx_irq (test, &link_srv); - link_srv->dp_handle_hpd_rx_irq = dm_test_handle_hpd_rx_no_work; - -handle_hpd_rx_irq (aconn); -} -/** * dm_test_handle_hpd_rx_irq_automated_test - Test HPDRX automated-test path * @test: The KUnit test context
@@ -3579,34 +3143,6 @@ static void dm_test_handle_hpd_rx_irq_link_loss(struct kunit *test) ->dm.hpd_rx_offload_wq->is_handling_link_loss); } -/** -* dm_test_handle_hpd_rx_irq_downstream_change - Test HPDRX post-detect block -* @test: The KUnit test context -* -* A handled HPD RX IRQ on a connector that is not an MST root means a -* downstream port status change, so the handler must re-detect the link. -* Detection is stubbed to fail, leaving the connector untouched, and a -* non-MST-branch link also exercises the trailing CEC IRQ dispatch. -*/ -static void dm_test_handle_hpd_rx_irq_downstream_change (struct kunit *test) -{ -struct amdgpu_dm_connector *aconn; -struct link_service *link_srv; - - aconn =dm_test_setup_hpd_rx_irq (test, &link_srv); - link_srv->dp_handle_hpd_rx_irq = dm_test_handle_hpd_rx_result_true; - link_srv->detect_connection_type = dm_test_detect_connection_single; - link_srv->detect_link = dm_test_detect_link_false; - - aconn->mst_mgr.mst_state = false; - aconn->dc_link->type = dc_connection_single; - aconn->fake_enable = true; - -handle_hpd_rx_irq (aconn); - -KUNIT_EXPECT_TRUE (test, aconn->fake_enable); -} -/** * dm_test_handle_hpd_rx_irq_detect_type_fails - Test HPDRX detect failure logging * @test: The KUnit test context
@@ -5548,15 +5084,12 @@ static struct kunit_case amdgpu_dm_irq_tests[] = {KUNIT_CASE (dm_test_hpd_to_dal_irq_source_hpd5),KUNIT_CASE (dm_test_hpd_to_dal_irq_source_hpd6),KUNIT_CASE (dm_test_hpd_to_dal_irq_source_invalid), -KUNIT_CASE (dm_test_hpd_to_dal_irq_source_out_of_range),/* are_sinks_equal */ -KUNIT_CASE (dm_test_are_sinks_equal_both_null),KUNIT_CASE (dm_test_are_sinks_equal_first_null),KUNIT_CASE (dm_test_are_sinks_equal_second_null),KUNIT_CASE (dm_test_are_sinks_equal_different_signal),KUNIT_CASE (dm_test_are_sinks_equal_different_edid_length),KUNIT_CASE (dm_test_are_sinks_equal_different_edid_data), -KUNIT_CASE (dm_test_are_sinks_equal_identical),KUNIT_CASE (dm_test_are_sinks_equal_zero_length),KUNIT_CASE (dm_test_are_sinks_equal_full_edid_identical), KUNIT_CASE(dm_test_are_sinks_equal_full_edid_last_byte_differs),
@@ -5576,9 +5109,6 @@ static struct kunit_case amdgpu_dm_irq_tests[] = {KUNIT_CASE (dm_test_irq_register_rejects_null_params),KUNIT_CASE (dm_test_irq_register_rejects_invalid_context),KUNIT_CASE (dm_test_irq_register_rejects_invalid_source), -KUNIT_CASE (dm_test_irq_register_adds_low_context_handler), -KUNIT_CASE (dm_test_irq_register_adds_high_context_handler), -KUNIT_CASE (dm_test_irq_register_multiple_handlers),KUNIT_CASE (dm_test_irq_register_separate_contexts),/* amdgpu_dm_irq_unregister_interrupt */ KUNIT_CASE(dm_test_irq_unregister_rejects_invalid_source),
@@ -5617,12 +5147,9 @@ static struct kunit_case amdgpu_dm_irq_tests[] = {KUNIT_CASE (dm_test_set_crtc_irq_state_otg_disabled),KUNIT_CASE (dm_test_set_crtc_irq_state_enable),KUNIT_CASE (dm_test_set_pflip_irq_state_disable), -KUNIT_CASE (dm_test_set_vline0_irq_state_enable), -KUNIT_CASE (dm_test_set_vupdate_irq_state_enable),KUNIT_CASE (dm_test_set_crtc_irq_state_allows_idle),/* amdgpu_dm_irq_immediate_work */ KUNIT_CASE (dm_test_irq_immediate_work_empty), -KUNIT_CASE (dm_test_irq_immediate_work_invokes_handler),KUNIT_CASE (dm_test_irq_immediate_work_invokes_all),/* amdgpu_dm_irq_schedule_work */ KUNIT_CASE(dm_test_irq_schedule_work_empty),
@@ -5646,7 +5173,6 @@ static struct kunit_case amdgpu_dm_irq_tests[] = {KUNIT_CASE (dm_test_hpd_init_skips_connector_without_link),/* dm_handle_hpd_rx_offload_work */ KUNIT_CASE (dm_test_hpd_rx_offload_work_no_connector), -KUNIT_CASE (dm_test_hpd_rx_offload_work_no_connection),KUNIT_CASE (dm_test_hpd_rx_offload_work_detect_type_fails),KUNIT_CASE (dm_test_hpd_rx_offload_work_in_reset), KUNIT_CASE(dm_test_hpd_rx_offload_work_msg_rdy),
@@ -5662,7 +5188,6 @@ static struct kunit_case amdgpu_dm_irq_tests[] = {KUNIT_CASE (dm_test_handle_hpd_irq_disabled),KUNIT_CASE (dm_test_handle_hpd_irq_helper_debounce_schedule),KUNIT_CASE (dm_test_handle_hpd_irq_helper_debounce_release_prev), -KUNIT_CASE (dm_test_handle_hpd_irq_helper_detect_false),KUNIT_CASE (dm_test_handle_hpd_irq_helper_detect_type_fails),KUNIT_CASE (dm_test_handle_hpd_irq_helper_debounce_pending), KUNIT_CASE(dm_test_handle_hpd_irq_helper_hdcp_reset),
@@ -5670,11 +5195,9 @@ static struct kunit_case amdgpu_dm_irq_tests[] = {KUNIT_CASE (dm_test_handle_hpd_irq_helper_detect_true),/* handle_hpd_rx_irq/schedule_hpd_rx_offload_work */ KUNIT_CASE (dm_test_handle_hpd_rx_irq_disabled), -KUNIT_CASE (dm_test_handle_hpd_rx_irq_no_left_work),KUNIT_CASE (dm_test_handle_hpd_rx_irq_automated_test),KUNIT_CASE (dm_test_handle_hpd_rx_irq_msg_rdy),KUNIT_CASE (dm_test_handle_hpd_rx_irq_link_loss), -KUNIT_CASE (dm_test_handle_hpd_rx_irq_downstream_change),KUNIT_CASE (dm_test_handle_hpd_rx_irq_detect_type_fails),KUNIT_CASE (dm_test_handle_hpd_rx_irq_forced_detect), KUNIT_CASE(dm_test_handle_hpd_rx_irq_detect_true),
Signature · 1 line
2.55.0
PATCH 38/64 drm/amd/display: Add inst field to encoder structs
In reply to George ZhangFrom: Tony Cheng <[email protected]>
Add an inst member to struct link_encoder, struct stream_encoder and struct hpo_frl_stream_encoder, and populate it in the DCN10 through DCN60 construct paths.
No functional change; the field has no readers yet.
--- drivers/gpu/drm/amd/display/dc/dio/dcn10/dcn10_link_encoder.c | 2 ++ .../gpu/drm/amd/display/dc/dio/dcn10/dcn10_stream_encoder.c | 2 ++ drivers/gpu/drm/amd/display/dc/dio/dcn20/dcn20_link_encoder.c | 2 ++ .../gpu/drm/amd/display/dc/dio/dcn20/dcn20_stream_encoder.c | 2 ++ .../gpu/drm/amd/display/dc/dio/dcn30/dcn30_dio_link_encoder.c | 2 ++ .../drm/amd/display/dc/dio/dcn30/dcn30_dio_stream_encoder.c | 2 ++ .../drm/amd/display/dc/dio/dcn301/dcn301_dio_link_encoder.c | 2 ++ .../gpu/drm/amd/display/dc/dio/dcn31/dcn31_dio_link_encoder.c | 2 ++ .../drm/amd/display/dc/dio/dcn314/dcn314_dio_stream_encoder.c | 2 ++ .../gpu/drm/amd/display/dc/dio/dcn32/dcn32_dio_link_encoder.c | 2 ++ .../drm/amd/display/dc/dio/dcn32/dcn32_dio_stream_encoder.c | 2 ++ .../drm/amd/display/dc/dio/dcn321/dcn321_dio_link_encoder.c | 2 ++ .../gpu/drm/amd/display/dc/dio/dcn35/dcn35_dio_link_encoder.c | 2 ++ .../drm/amd/display/dc/dio/dcn35/dcn35_dio_stream_encoder.c | 2 ++ .../drm/amd/display/dc/dio/dcn401/dcn401_dio_link_encoder.c | 2 ++ .../drm/amd/display/dc/dio/dcn401/dcn401_dio_stream_encoder.c | 1 + .../gpu/drm/amd/display/dc/dio/dcn42/dcn42_dio_link_encoder.c | 2 ++ .../drm/amd/display/dc/dio/dcn42/dcn42_dio_stream_encoder.c | 2 ++ .../gpu/drm/amd/display/dc/dio/dcn60/dcn60_dio_link_encoder.c | 2 ++ .../drm/amd/display/dc/dio/dcn60/dcn60_dio_stream_encoder.c | 2 ++ .../gpu/drm/amd/display/dc/dio/virtual/virtual_link_encoder.c | 3 +++ .../drm/amd/display/dc/dio/virtual/virtual_stream_encoder.c | 1 + .../amd/display/dc/hpo/dcn30/dcn30_hpo_frl_stream_encoder.c | 2 ++ .../amd/display/dc/hpo/dcn401/dcn401_hpo_frl_stream_encoder.c | 2 ++ .../amd/display/dc/hpo/dcn42/dcn42_hpo_frl_stream_encoder.c | 2 ++ .../amd/display/dc/hpo/dcn60/dcn60_hpo_frl_stream_encoder.c | 2 ++ drivers/gpu/drm/amd/display/dc/inc/hw/link_encoder.h | 1 + drivers/gpu/drm/amd/display/dc/inc/hw/stream_encoder.h | 2 ++ 28 files changed, 54 insertions(+)
drivers/gpu/drm/amd/display/dc/dio/dcn10/dcn10_link_encoder.c +2 -0
@@ -781,6 +781,8 @@ void dcn10_link_encoder_construct(if (enc10->base.ctx->dc->debug.hdmi20_disable) { enc10->base.features.flags.bits.HDMI_6GB_EN =0 ; } + + enc10->base.inst = (unsigned int )enc10->base.preferred_engine; } bool dcn10_link_encoder_validate_output_with_stream(
drivers/gpu/drm/amd/display/dc/dio/dcn10/dcn10_stream_encoder.c +2 -0
@@ -1625,5 +1625,7 @@ void dcn10_stream_encoder_construct( enc1->se_shift = se_shift; enc1->se_mask = se_mask; enc1->base.stream_enc_inst = eng_id -ENGINE_ID_DIGA ; + enc1->base.inst = enc1->base.stream_enc_inst; + }
drivers/gpu/drm/amd/display/dc/dio/dcn20/dcn20_link_encoder.c +2 -0
@@ -502,4 +502,6 @@ void dcn20_link_encoder_construct(if (enc10->base.ctx->dc->debug.hdmi20_disable) { enc10->base.features.flags.bits.HDMI_6GB_EN =0 ; } + + enc10->base.inst = (unsigned int )enc10->base.preferred_engine; }
drivers/gpu/drm/amd/display/dc/dio/dcn20/dcn20_stream_encoder.c +2 -0
@@ -657,5 +657,7 @@ void dcn20_stream_encoder_construct( enc1->se_shift = se_shift; enc1->se_mask = se_mask; enc1->base.stream_enc_inst = eng_id -ENGINE_ID_DIGA ; + enc1->base.inst = enc1->base.stream_enc_inst; + }
drivers/gpu/drm/amd/display/dc/dio/dcn30/dcn30_dio_link_encoder.c +2 -0
@@ -456,6 +456,8 @@ void dcn30_link_encoder_construct( enc10->base.features.flags.bits.IS_FRL_10G_CAPABLE =1 ; enc10->base.features.flags.bits.IS_FRL_12G_CAPABLE =1 ; } + + enc10->base.inst = (unsigned int )enc10->base.preferred_engine; }#define AUX_REG (reg)\
drivers/gpu/drm/amd/display/dc/dio/dcn30/dcn30_dio_stream_encoder.c +2 -0
@@ -899,5 +899,7 @@ void dcn30_dio_stream_encoder_construct( enc1->se_shift = se_shift; enc1->se_mask = se_mask; enc1->base.stream_enc_inst = vpg->inst; + enc1->base.inst = enc1->base.stream_enc_inst; + }
drivers/gpu/drm/amd/display/dc/dio/dcn301/dcn301_dio_link_encoder.c +2 -0
@@ -209,4 +209,6 @@ void dcn301_link_encoder_construct( enc10->base.features.flags.bits.IS_FRL_10G_CAPABLE =1 ; enc10->base.features.flags.bits.IS_FRL_12G_CAPABLE =1 ; } + + enc10->base.inst = (unsigned int )enc10->base.preferred_engine; }
drivers/gpu/drm/amd/display/dc/dio/dcn31/dcn31_dio_link_encoder.c +2 -0
@@ -509,6 +509,8 @@ void dcn31_link_encoder_construct( enc10->base.features.flags.bits.IS_FRL_10G_CAPABLE =1 ; enc10->base.features.flags.bits.IS_FRL_12G_CAPABLE =1 ; } + + enc10->base.inst = (unsigned int )enc10->base.preferred_engine; } void dcn31_link_encoder_construct_minimal(
drivers/gpu/drm/amd/display/dc/dio/dcn314/dcn314_dio_stream_encoder.c +2 -0
@@ -504,5 +504,7 @@ void dcn314_dio_stream_encoder_construct( enc1->se_shift = se_shift; enc1->se_mask = se_mask; enc1->base.stream_enc_inst = vpg->inst; + enc1->base.inst = enc1->base.stream_enc_inst; + }
drivers/gpu/drm/amd/display/dc/dio/dcn32/dcn32_dio_link_encoder.c +2 -0
@@ -551,4 +551,6 @@ void dcn32_link_encoder_construct( enc10->base.features.flags.bits.IS_FRL_10G_CAPABLE =1 ; enc10->base.features.flags.bits.IS_FRL_12G_CAPABLE =1 ; } + + enc10->base.inst = (unsigned int )enc10->base.preferred_engine; }
drivers/gpu/drm/amd/display/dc/dio/dcn32/dcn32_dio_stream_encoder.c +2 -0
@@ -491,5 +491,7 @@ void dcn32_dio_stream_encoder_construct( enc1->se_shift = se_shift; enc1->se_mask = se_mask; enc1->base.stream_enc_inst = vpg->inst; + enc1->base.inst = enc1->base.stream_enc_inst; + }
drivers/gpu/drm/amd/display/dc/dio/dcn321/dcn321_dio_link_encoder.c +2 -0
@@ -210,4 +210,6 @@ void dcn321_link_encoder_construct( enc10->base.features.flags.bits.IS_FRL_10G_CAPABLE =1 ; enc10->base.features.flags.bits.IS_FRL_12G_CAPABLE =1 ; } + + enc10->base.inst = (unsigned int )enc10->base.preferred_engine; }
drivers/gpu/drm/amd/display/dc/dio/dcn35/dcn35_dio_link_encoder.c +2 -0
@@ -290,6 +290,8 @@ void dcn35_link_encoder_construct( enc10->base.features.flags.bits.IS_FRL_12G_CAPABLE =1 ; } + + enc10->base.inst = (unsigned int )enc10->base.preferred_engine; }/* DPIA equivalent of link_transmitter_control. */
drivers/gpu/drm/amd/display/dc/dio/dcn35/dcn35_dio_stream_encoder.c +2 -0
@@ -517,5 +517,7 @@ void dcn35_dio_stream_encoder_construct( enc1->se_shift = se_shift; enc1->se_mask = se_mask; enc1->base.stream_enc_inst = vpg->inst; + enc1->base.inst = enc1->base.stream_enc_inst; + }
drivers/gpu/drm/amd/display/dc/dio/dcn401/dcn401_dio_link_encoder.c +2 -0
@@ -557,4 +557,6 @@ void dcn401_link_encoder_construct( enc10->base.features.flags.bits.IS_FRL_10G_CAPABLE =1 ; enc10->base.features.flags.bits.IS_FRL_12G_CAPABLE =1 ; } + + enc10->base.inst = (unsigned int )enc10->base.preferred_engine; }
drivers/gpu/drm/amd/display/dc/dio/dcn401/dcn401_dio_stream_encoder.c +1 -0
@@ -793,6 +793,7 @@ void dcn401_dio_stream_encoder_construct( enc1->se_shift = se_shift; enc1->se_mask = se_mask; enc1->base.stream_enc_inst = vpg->inst; + enc1->base.inst = enc1->base.stream_enc_inst; } void enc401_set_dynamic_metadata(struct stream_encoder *enc,
drivers/gpu/drm/amd/display/dc/dio/dcn42/dcn42_dio_link_encoder.c +2 -0
@@ -223,4 +223,6 @@ void dcn42_link_encoder_construct( enc10->base.features.flags.bits.IS_FRL_10G_CAPABLE =1 ; enc10->base.features.flags.bits.IS_FRL_12G_CAPABLE =1 ; } + + enc10->base.inst = (unsigned int )enc10->base.preferred_engine; }
drivers/gpu/drm/amd/display/dc/dio/dcn42/dcn42_dio_stream_encoder.c +2 -0
@@ -581,4 +581,6 @@ void dcn42_dio_stream_encoder_construct( enc1->se_shift = se_shift; enc1->se_mask = se_mask; enc1->base.stream_enc_inst = vpg->inst; + enc1->base.inst = enc1->base.stream_enc_inst; + }
drivers/gpu/drm/amd/display/dc/dio/dcn60/dcn60_dio_link_encoder.c +2 -0
@@ -370,4 +370,6 @@ void dcn60_link_encoder_construct( enc10->base.features.flags.bits.IS_FRL_20G_CAPABLE =1 ; enc10->base.features.flags.bits.IS_FRL_24G_CAPABLE =0 ; } + + enc10->base.inst = (unsigned int )enc10->base.preferred_engine; }
drivers/gpu/drm/amd/display/dc/dio/dcn60/dcn60_dio_stream_encoder.c +2 -0
@@ -535,4 +535,6 @@ void dcn60_dio_stream_encoder_construct( enc1->se_shift = se_shift; enc1->se_mask = se_mask; enc1->base.stream_enc_inst = vpg->inst; + enc1->base.inst = enc1->base.stream_enc_inst; + }
drivers/gpu/drm/amd/display/dc/dio/virtual/virtual_link_encoder.c +3 -0
@@ -27,6 +27,7 @@#include "dm_services_types.h" #include "virtual_link_encoder.h" +#include "stream_encoder.h" static bool virtual_link_encoder_validate_output_with_stream( struct link_encoder *enc,
@@ -167,5 +168,7 @@ bool virtual_link_encoder_construct( enc->preferred_engine =ENGINE_ID_VIRTUAL ; + enc->inst =0 ; +return true; }
drivers/gpu/drm/amd/display/dc/dio/virtual/virtual_stream_encoder.c +1 -0
@@ -190,6 +190,7 @@ bool virtual_stream_encoder_construct(struct dc_context *ctx, struct dc_bios *bp) { + enc->inst = 0;if (!enc)return false;if (!bp)
drivers/gpu/drm/amd/display/dc/hpo/dcn30/dcn30_hpo_frl_stream_encoder.c +2 -0
@@ -1040,4 +1040,6 @@ void dcn30_hpo_frl_stream_encoder_construct( enc3->hpo_se_shift = hpo_se_shift; enc3->hpo_se_mask = hpo_se_mask; enc3->base.stream_enc_inst = vpg->inst; + enc3->base.inst = enc3->base.stream_enc_inst; + }
drivers/gpu/drm/amd/display/dc/hpo/dcn401/dcn401_hpo_frl_stream_encoder.c +2 -0
@@ -904,4 +904,6 @@ void dcn401_hpo_frl_stream_encoder_construct( enc401->hpo_se_shift = hpo_se_shift; enc401->hpo_se_mask = hpo_se_mask; enc401->base.stream_enc_inst = vpg->inst; + enc401->base.inst = enc401->base.stream_enc_inst; + }
drivers/gpu/drm/amd/display/dc/hpo/dcn42/dcn42_hpo_frl_stream_encoder.c +2 -0
@@ -209,4 +209,6 @@ void dcn42_hpo_frl_stream_encoder_construct( enc42->hpo_se_shift = hpo_se_shift; enc42->hpo_se_mask = hpo_se_mask; enc42->base.stream_enc_inst = vpg->inst; + enc42->base.inst = enc42->base.stream_enc_inst; + }
drivers/gpu/drm/amd/display/dc/hpo/dcn60/dcn60_hpo_frl_stream_encoder.c +2 -0
@@ -231,4 +231,6 @@ void dcn60_hpo_frl_stream_encoder_construct( enc401->hpo_se_shift = hpo_se_shift; enc401->hpo_se_mask = hpo_se_mask; enc401->base.stream_enc_inst = vpg->inst; + enc401->base.inst = enc401->base.stream_enc_inst; + }
drivers/gpu/drm/amd/display/dc/inc/hw/link_encoder.h +1 -0
@@ -100,6 +100,7 @@ struct link_encoder {struct graphics_object_id connector;uint32_t output_signals;enum engine_id preferred_engine; +unsigned int inst;enum engine_id analog_engine;struct encoder_feature_support features;enum transmitter transmitter;
drivers/gpu/drm/amd/display/dc/inc/hw/stream_encoder.h +2 -0
@@ -126,6 +126,7 @@ struct stream_encoder {struct dc_bios *bp;enum engine_id id;uint32_t stream_enc_inst; +unsigned int inst;struct vpg *vpg;struct afmt *afmt;struct apg *apg;
@@ -319,6 +320,7 @@ struct hpo_frl_stream_encoder {* @stream_enc_inst: Instance ID reference. */ uint32_t stream_enc_inst; +unsigned int inst;/** * @ctx: DC context.
Signature · 1 line
2.55.0
PATCH 39/64 drm/amd/display: Add inst field to clock_source and dio
In reply to George ZhangFrom: Tony Cheng <[email protected]>
Add an inst member to struct clock_source and struct dio. The DCE110 and DCE112 clock sources derive it from their clock_source_id; the DCN10 DIO is a singleton and uses 0.
Also move the (void)encoding cast in dcn401_program_pix_clk() below the local declarations, where it belongs.
No functional change; the inst field has no readers yet.
--- drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c | 4 +++- drivers/gpu/drm/amd/display/dc/dio/dcn10/dcn10_dio.c | 1 + drivers/gpu/drm/amd/display/dc/inc/clock_source.h | 1 + drivers/gpu/drm/amd/display/dc/inc/hw/dio.h | 1 + 4 files changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c +3 -1
@@ -1074,7 +1074,6 @@ static bool dcn401_program_pix_clk(enum dp_link_encoding encoding, struct pll_settings *pll_settings) { - (void)encoding; struct dce110_clk_src *clk_src = TO_DCE110_CLK_SRC(clock_source);unsigned int inst = pix_clk_params->controller_id -CONTROLLER_ID_D0 ; const struct pixel_rate_range_table_entry *e =
@@ -1082,6 +1081,7 @@ static bool dcn401_program_pix_clk(struct bp_pixel_clock_parameters bp_pc_params = {0 };enum transmitter_color_depth bp_pc_colour_depth =TRANSMITTER_COLOR_DEPTH_24 ;struct dp_dto_params dto_params = {0 }; + (void )encoding; dto_params.otg_inst = inst; dto_params.signal = pix_clk_params->signal_type;
@@ -1757,6 +1757,7 @@ bool dce110_clk_src_construct( clk_src->base.ctx = ctx; clk_src->bios = bios; clk_src->base.id = id; + clk_src->base.inst = (unsigned int )id; clk_src->base.funcs = &dce110_clk_src_funcs; clk_src->regs = regs;
@@ -1855,6 +1856,7 @@ bool dce112_clk_src_construct( clk_src->base.ctx = ctx; clk_src->bios = bios; clk_src->base.id = id; + clk_src->base.inst = (unsigned int )id; clk_src->base.funcs = &dce112_clk_src_funcs; clk_src->regs = regs;
drivers/gpu/drm/amd/display/dc/dio/dcn10/dcn10_dio.c +1 -0
@@ -40,6 +40,7 @@ void dcn10_dio_construct( { dio10->base.ctx = ctx; dio10->base.funcs = &dcn10_dio_funcs; + dio10->base.inst =0 ; dio10->regs = regs; dio10->shifts = shifts;
drivers/gpu/drm/amd/display/dc/inc/clock_source.h +1 -0
@@ -186,6 +186,7 @@ struct clock_source {const struct clock_source_funcs *funcs;struct dc_context *ctx;enum clock_source_id id; +unsigned int inst;bool dp_clk_src; };
drivers/gpu/drm/amd/display/dc/inc/hw/dio.h +1 -0
@@ -17,6 +17,7 @@ struct dio_funcs {struct dio {const struct dio_funcs *funcs;struct dc_context *ctx; +unsigned int inst; };#endif /* __DC_DIO_H__ */
Signature · 1 line
2.55.0
PATCH 40/64 drm/amd/display: Fix missing gaps for link lock with inbox0
In reply to George ZhangFrom: Nicholas Kazlauskas <[email protected]>
[Why]
Inbox1 was previously being used for cursor and DIG locking with DMUB doing the relevant programming on behalf of driver.
With the Inbox0 lock the driver is expected to do the programming itself and the Inbox0 lock acts as nothing more than a SW mutex.
There are still a few gaps in how Inbox1 was being leveraged in the cursor path that need to be addressed for Inbox0.
[How]
Add a should_use_dmub_inbox0_lock_for_link helper to help check if we support the Inbox0 locking infrastructure and we should be locking it if the specific link in question requires it.
--- .../gpu/drm/amd/display/dc/core/dc_stream.c | 21 +++++++++++++++++++ .../drm/amd/display/dc/dce/dmub_hw_lock_mgr.c | 10 ++++++++- .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 3 ++- 3 files changed, 32 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +21 -0
@@ -34,6 +34,7 @@#include "dc_dmub_srv.h" #include "dc_state_priv.h" #include "dc_stream_priv.h" +#include "dce/dmub_hw_lock_mgr.h" #define DC_LOGGER dc->ctx->logger#ifndef MIN
@@ -307,6 +308,7 @@ void program_cursor_attributes(struct resource_context *res_ctx;struct pipe_ctx *pipe_to_program =NULL ;bool enable_cursor_offload =dc_dmub_srv_is_cursor_offload_enabled (dc); +bool unlock_dmub = false;if (!stream)return ;
@@ -330,6 +332,12 @@ void program_cursor_attributes( pipe_ctx->plane_res.dpp, pipe_ctx->plane_res.hubp, top_pipe->pipe_idx); }else { +if (dc->hwss.dmub_hw_control_lock && pipe_ctx->stream && +should_use_dmub_inbox0_lock_for_link (dc, pipe_ctx->stream->link)) { + dc->hwss.dmub_hw_control_lock (dc, dc->current_state, true); + unlock_dmub = true; + } + dc->hwss.cursor_lock (dc, pipe_to_program, true);if (pipe_to_program->next_odm_pipe) dc->hwss.cursor_lock (dc, pipe_to_program->next_odm_pipe, true);
@@ -362,6 +370,9 @@ void program_cursor_attributes( dc->hwss.cursor_lock (dc, pipe_to_program, false);if (pipe_to_program->next_odm_pipe) dc->hwss.cursor_lock (dc, pipe_to_program->next_odm_pipe, false); + +if (unlock_dmub) + dc->hwss.dmub_hw_control_lock (dc, dc->current_state, false); } } }
@@ -481,6 +492,7 @@ void program_cursor_position(struct resource_context *res_ctx;struct pipe_ctx *pipe_to_program =NULL ;bool enable_cursor_offload =dc_dmub_srv_is_cursor_offload_enabled (dc); +bool unlock_dmub = false;if (!stream)return ;
@@ -508,6 +520,12 @@ void program_cursor_position( pipe_ctx->plane_res.dpp, pipe_ctx->plane_res.hubp, top_pipe->pipe_idx); }else { +if (dc->hwss.dmub_hw_control_lock && pipe_ctx->stream && +should_use_dmub_inbox0_lock_for_link (dc, pipe_ctx->stream->link)) { + dc->hwss.dmub_hw_control_lock (dc, dc->current_state, true); + unlock_dmub = true; + } + dc->hwss.cursor_lock (dc, pipe_to_program, true); } }
@@ -535,6 +553,9 @@ void program_cursor_position( top_pipe->pipe_idx); }else { dc->hwss.cursor_lock (dc, pipe_to_program, false); + +if (unlock_dmub) + dc->hwss.dmub_hw_control_lock (dc, dc->current_state, false); } } }
drivers/gpu/drm/amd/display/dc/dce/dmub_hw_lock_mgr.c +9 -1
@@ -36,6 +36,14 @@ static bool dmub_hw_lock_has_inbox0_lock(const struct dc *dc) dc->ctx->dmub_srv->dmub->meta_info.feature_bits.bits.inbox0_lock_support; } +static bool dmub_hw_lock_has_inbox0_lock_split (const struct dc *dc) +{ +return dc->ctx && dc->ctx->dmub_srv && + dc->hwss.dmub_hw_control_lock && + dc->hwss.dmub_hw_control_lock_fast && + dc->ctx->dmub_srv->dmub->meta_info.feature_bits.bits.inbox0_lock_split; +} + void dmub_hw_lock_mgr_cmd(struct dc_dmub_srv *dmub_srv, bool lock, union dmub_hw_lock_flags *hw_locks,
@@ -121,5 +129,5 @@ bool should_use_dmub_inbox1_lock(const struct dc *dc, const struct dc_link *linkbool should_use_dmub_inbox0_lock_for_link (const struct dc *dc,const struct dc_link *link) { -return dmub_hw_lock_has_inbox0_lock (dc) &&dmub_hw_lock_mgr_does_link_require_lock (dc, link); +return dmub_hw_lock_has_inbox0_lock_split (dc) &&dmub_hw_lock_mgr_does_link_require_lock (dc, link); }
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +2 -1
@@ -1004,7 +1004,8 @@ union dmub_fw_meta_feature_bits { uint32_t shared_state_link_detection : 1; /**< 1 supports link detection via shared state */ uint32_t cursor_offload_v1_support: 1; /**< 1 supports cursor offload */ uint32_t inbox0_lock_support: 1; /**< 1 supports inbox0 lock mechanism */ - uint32_t reserved : 29; + uint32_t inbox0_lock_split: 1; /**< 1 supports inbox0 lock acquire/release split mechanism */ + uint32_t reserved : 28; } bits;/**< status bits */ uint32_t all;/**< 32-bit access to status bits */ };
--
2.55.0
PATCH 41/64 drm/amd/display: Add more diagnostic logs for DMU
In reply to George ZhangFrom: Dillon Varone <[email protected]>
[WHY&HOW]
Adds diagnostic logs for recent DMU traces.
--- drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 125 ++++++++++++------ drivers/gpu/drm/amd/display/dmub/dmub_srv.h | 58 +++++++- .../gpu/drm/amd/display/dmub/src/dmub_dcn20.c | 84 ++++++------ .../gpu/drm/amd/display/dmub/src/dmub_dcn20.h | 2 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn31.c | 94 +++++++------ .../gpu/drm/amd/display/dmub/src/dmub_dcn31.h | 2 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn32.c | 94 +++++++------ .../gpu/drm/amd/display/dmub/src/dmub_dcn32.h | 2 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn35.c | 94 +++++++------ .../gpu/drm/amd/display/dmub/src/dmub_dcn35.h | 2 +- .../drm/amd/display/dmub/src/dmub_dcn401.c | 98 +++++++------- .../drm/amd/display/dmub/src/dmub_dcn401.h | 2 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn42.c | 98 +++++++------- .../gpu/drm/amd/display/dmub/src/dmub_dcn42.h | 2 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn60.c | 98 +++++++------- .../gpu/drm/amd/display/dmub/src/dmub_dcn60.h | 2 +- .../gpu/drm/amd/display/dmub/src/dmub_srv.c | 54 +++++++- 17 files changed, 511 insertions(+), 400 deletions(-)
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c +82 -43
@@ -273,6 +273,49 @@ bool dc_dmub_srv_cmd_list_queue_execute(struct dc_dmub_srv *dc_dmub_srv,return dc_dmub_srv_cmd_list_queue_execute_timeout (dc_dmub_srv, count, cmd_list,DMUB_CMD_DEFAULT_MAX_WAIT_US ); } +static void dc_dmub_srv_log_timeout (const struct dc_dmub_srv *dc_dmub_srv, +struct dmub_timeout_info *timeout_info, +union dmub_rb_cmd *cmd) +{ +struct dmub_srv *dmub; + +if (!dc_dmub_srv || !dc_dmub_srv->dmub) +return ; + + dmub = dc_dmub_srv->dmub; + +// timeout already ocurred, do not overwrite +if (timeout_info->timeout_occured) +return ; + + timeout_info->timeout_occured = true; +if (cmd) + timeout_info->timeout_cmd = *cmd; + timeout_info->timestamp =dm_get_timestamp (dc_dmub_srv->ctx); + +// capture last trace entries from the DMCUB trace buffer +dmub_srv_get_trace_snapshot (dmub, + &timeout_info->trace_snapshot); +} + +static void dc_dmub_srv_log_timeouts (struct dc_dmub_srv *dc_dmub_srv, +union dmub_rb_cmd *cmd) +{ +struct dmub_srv *dmub; + +if (!dc_dmub_srv || !dc_dmub_srv->dmub) +return ; + + dmub = dc_dmub_srv->dmub; + +// log if this is the first timeout +dc_dmub_srv_log_timeout (dc_dmub_srv, &dmub->debug.first_timeout_info, cmd); + +// clear valid flag and log latest timeout + dmub->debug.latest_timeout_info.timeout_occured = false; +dc_dmub_srv_log_timeout (dc_dmub_srv, &dmub->debug.latest_timeout_info, cmd); +} + bool dc_dmub_srv_wait_for_idle(struct dc_dmub_srv *dc_dmub_srv, enum dm_dmub_wait_type wait_type, union dmub_rb_cmd *cmd_list,
@@ -294,12 +337,8 @@ bool dc_dmub_srv_wait_for_idle(struct dc_dmub_srv *dc_dmub_srv,if (status !=DMUB_STATUS_OK ) {DC_LOG_DEBUG ("No reply for DMUB command: status=%d\n" , status); -if (!dmub->debug.timeout_info.timeout_occured) { - dmub->debug.timeout_info.timeout_occured = true; -if (cmd_list) - dmub->debug.timeout_info.timeout_cmd = *cmd_list; - dmub->debug.timeout_info.timestamp =dm_get_timestamp (dc_dmub_srv->ctx); - } + +dc_dmub_srv_log_timeouts (dc_dmub_srv, cmd_list);dc_dmub_srv_handle_failure (dc_dmub_srv);return false; }
@@ -985,44 +1024,44 @@ void dc_dmub_srv_log_diagnostic_data(struct dc_dmub_srv *dc_dmub_srv) }DC_LOG_DEBUG ("DMCUB STATE:" ); -DC_LOG_DEBUG (" dmcub_version : %08x" , dc_dmub_srv->dmub->debug.dmcub_version); -DC_LOG_DEBUG (" scratch [0] : %08x" , dc_dmub_srv->dmub->debug.scratch[0 ]); -DC_LOG_DEBUG (" scratch [1] : %08x" , dc_dmub_srv->dmub->debug.scratch[1 ]); -DC_LOG_DEBUG (" scratch [2] : %08x" , dc_dmub_srv->dmub->debug.scratch[2 ]); -DC_LOG_DEBUG (" scratch [3] : %08x" , dc_dmub_srv->dmub->debug.scratch[3 ]); -DC_LOG_DEBUG (" scratch [4] : %08x" , dc_dmub_srv->dmub->debug.scratch[4 ]); -DC_LOG_DEBUG (" scratch [5] : %08x" , dc_dmub_srv->dmub->debug.scratch[5 ]); -DC_LOG_DEBUG (" scratch [6] : %08x" , dc_dmub_srv->dmub->debug.scratch[6 ]); -DC_LOG_DEBUG (" scratch [7] : %08x" , dc_dmub_srv->dmub->debug.scratch[7 ]); -DC_LOG_DEBUG (" scratch [8] : %08x" , dc_dmub_srv->dmub->debug.scratch[8 ]); -DC_LOG_DEBUG (" scratch [9] : %08x" , dc_dmub_srv->dmub->debug.scratch[9 ]); -DC_LOG_DEBUG (" scratch [10] : %08x" , dc_dmub_srv->dmub->debug.scratch[10 ]); -DC_LOG_DEBUG (" scratch [11] : %08x" , dc_dmub_srv->dmub->debug.scratch[11 ]); -DC_LOG_DEBUG (" scratch [12] : %08x" , dc_dmub_srv->dmub->debug.scratch[12 ]); -DC_LOG_DEBUG (" scratch [13] : %08x" , dc_dmub_srv->dmub->debug.scratch[13 ]); -DC_LOG_DEBUG (" scratch [14] : %08x" , dc_dmub_srv->dmub->debug.scratch[14 ]); -DC_LOG_DEBUG (" scratch [15] : %08x" , dc_dmub_srv->dmub->debug.scratch[15 ]); +DC_LOG_DEBUG (" dmcub_version : %08x" , dc_dmub_srv->dmub->debug.hw.dmcub_version); +DC_LOG_DEBUG (" scratch [0] : %08x" , dc_dmub_srv->dmub->debug.hw.scratch[0 ]); +DC_LOG_DEBUG (" scratch [1] : %08x" , dc_dmub_srv->dmub->debug.hw.scratch[1 ]); +DC_LOG_DEBUG (" scratch [2] : %08x" , dc_dmub_srv->dmub->debug.hw.scratch[2 ]); +DC_LOG_DEBUG (" scratch [3] : %08x" , dc_dmub_srv->dmub->debug.hw.scratch[3 ]); +DC_LOG_DEBUG (" scratch [4] : %08x" , dc_dmub_srv->dmub->debug.hw.scratch[4 ]); +DC_LOG_DEBUG (" scratch [5] : %08x" , dc_dmub_srv->dmub->debug.hw.scratch[5 ]); +DC_LOG_DEBUG (" scratch [6] : %08x" , dc_dmub_srv->dmub->debug.hw.scratch[6 ]); +DC_LOG_DEBUG (" scratch [7] : %08x" , dc_dmub_srv->dmub->debug.hw.scratch[7 ]); +DC_LOG_DEBUG (" scratch [8] : %08x" , dc_dmub_srv->dmub->debug.hw.scratch[8 ]); +DC_LOG_DEBUG (" scratch [9] : %08x" , dc_dmub_srv->dmub->debug.hw.scratch[9 ]); +DC_LOG_DEBUG (" scratch [10] : %08x" , dc_dmub_srv->dmub->debug.hw.scratch[10 ]); +DC_LOG_DEBUG (" scratch [11] : %08x" , dc_dmub_srv->dmub->debug.hw.scratch[11 ]); +DC_LOG_DEBUG (" scratch [12] : %08x" , dc_dmub_srv->dmub->debug.hw.scratch[12 ]); +DC_LOG_DEBUG (" scratch [13] : %08x" , dc_dmub_srv->dmub->debug.hw.scratch[13 ]); +DC_LOG_DEBUG (" scratch [14] : %08x" , dc_dmub_srv->dmub->debug.hw.scratch[14 ]); +DC_LOG_DEBUG (" scratch [15] : %08x" , dc_dmub_srv->dmub->debug.hw.scratch[15 ]);for (i =0 ; i <DMUB_PC_SNAPSHOT_COUNT ; i++) -DC_LOG_DEBUG (" pc[%d] : %08x" , i, dc_dmub_srv->dmub->debug.pc[i]); -DC_LOG_DEBUG (" unk_fault_addr : %08x" , dc_dmub_srv->dmub->debug.undefined_address_fault_addr); -DC_LOG_DEBUG (" inst_fault_addr : %08x" , dc_dmub_srv->dmub->debug.inst_fetch_fault_addr); -DC_LOG_DEBUG (" data_fault_addr : %08x" , dc_dmub_srv->dmub->debug.data_write_fault_addr); -DC_LOG_DEBUG (" inbox1_rptr : %08x" , dc_dmub_srv->dmub->debug.inbox1_rptr); -DC_LOG_DEBUG (" inbox1_wptr : %08x" , dc_dmub_srv->dmub->debug.inbox1_wptr); -DC_LOG_DEBUG (" inbox1_size : %08x" , dc_dmub_srv->dmub->debug.inbox1_size); -DC_LOG_DEBUG (" inbox0_rptr : %08x" , dc_dmub_srv->dmub->debug.inbox0_rptr); -DC_LOG_DEBUG (" inbox0_wptr : %08x" , dc_dmub_srv->dmub->debug.inbox0_wptr); -DC_LOG_DEBUG (" inbox0_size : %08x" , dc_dmub_srv->dmub->debug.inbox0_size); -DC_LOG_DEBUG (" outbox1_rptr : %08x" , dc_dmub_srv->dmub->debug.outbox1_rptr); -DC_LOG_DEBUG (" outbox1_wptr : %08x" , dc_dmub_srv->dmub->debug.outbox1_wptr); -DC_LOG_DEBUG (" outbox1_size : %08x" , dc_dmub_srv->dmub->debug.outbox1_size); -DC_LOG_DEBUG (" is_enabled : %d" , dc_dmub_srv->dmub->debug.is_dmcub_enabled); -DC_LOG_DEBUG (" is_soft_reset : %d" , dc_dmub_srv->dmub->debug.is_dmcub_soft_reset); -DC_LOG_DEBUG (" is_secure_reset : %d" , dc_dmub_srv->dmub->debug.is_dmcub_secure_reset); -DC_LOG_DEBUG (" is_traceport_en : %d" , dc_dmub_srv->dmub->debug.is_traceport_en); -DC_LOG_DEBUG (" is_cw0_en : %d" , dc_dmub_srv->dmub->debug.is_cw0_enabled); -DC_LOG_DEBUG (" is_cw6_en : %d" , dc_dmub_srv->dmub->debug.is_cw6_enabled); -DC_LOG_DEBUG (" is_pwait : %d" , dc_dmub_srv->dmub->debug.is_pwait); +DC_LOG_DEBUG (" pc[%d] : %08x" , i, dc_dmub_srv->dmub->debug.hw.pc[i]); +DC_LOG_DEBUG (" unk_fault_addr : %08x" , dc_dmub_srv->dmub->debug.hw.undefined_address_fault_addr); +DC_LOG_DEBUG (" inst_fault_addr : %08x" , dc_dmub_srv->dmub->debug.hw.inst_fetch_fault_addr); +DC_LOG_DEBUG (" data_fault_addr : %08x" , dc_dmub_srv->dmub->debug.hw.data_write_fault_addr); +DC_LOG_DEBUG (" inbox1_rptr : %08x" , dc_dmub_srv->dmub->debug.hw.inbox1_rptr); +DC_LOG_DEBUG (" inbox1_wptr : %08x" , dc_dmub_srv->dmub->debug.hw.inbox1_wptr); +DC_LOG_DEBUG (" inbox1_size : %08x" , dc_dmub_srv->dmub->debug.hw.inbox1_size); +DC_LOG_DEBUG (" inbox0_rptr : %08x" , dc_dmub_srv->dmub->debug.hw.inbox0_rptr); +DC_LOG_DEBUG (" inbox0_wptr : %08x" , dc_dmub_srv->dmub->debug.hw.inbox0_wptr); +DC_LOG_DEBUG (" inbox0_size : %08x" , dc_dmub_srv->dmub->debug.hw.inbox0_size); +DC_LOG_DEBUG (" outbox1_rptr : %08x" , dc_dmub_srv->dmub->debug.hw.outbox1_rptr); +DC_LOG_DEBUG (" outbox1_wptr : %08x" , dc_dmub_srv->dmub->debug.hw.outbox1_wptr); +DC_LOG_DEBUG (" outbox1_size : %08x" , dc_dmub_srv->dmub->debug.hw.outbox1_size); +DC_LOG_DEBUG (" is_enabled : %d" , dc_dmub_srv->dmub->debug.hw.is_dmcub_enabled); +DC_LOG_DEBUG (" is_soft_reset : %d" , dc_dmub_srv->dmub->debug.hw.is_dmcub_soft_reset); +DC_LOG_DEBUG (" is_secure_reset : %d" , dc_dmub_srv->dmub->debug.hw.is_dmcub_secure_reset); +DC_LOG_DEBUG (" is_traceport_en : %d" , dc_dmub_srv->dmub->debug.hw.is_traceport_en); +DC_LOG_DEBUG (" is_cw0_en : %d" , dc_dmub_srv->dmub->debug.hw.is_cw0_enabled); +DC_LOG_DEBUG (" is_cw6_en : %d" , dc_dmub_srv->dmub->debug.hw.is_cw6_enabled); +DC_LOG_DEBUG (" is_pwait : %d" , dc_dmub_srv->dmub->debug.hw.is_pwait); }bool dc_dmub_should_update_cursor_data (struct pipe_ctx *pipe_ctx)
drivers/gpu/drm/amd/display/dmub/dmub_srv.h +53 -5
114 lines not on this page · raw message
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn20.c +40 -44
112 lines not on this page · raw message
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn20.h +1 -1
@@ -247,6 +247,6 @@ bool dmub_dcn20_use_cached_trace_buffer(struct dmub_srv *dmub);uint32_t dmub_dcn20_get_current_time (struct dmub_srv *dmub); -void dmub_dcn20_get_diagnostic_data (struct dmub_srv *dmub); +void dmub_dcn20_get_diagnostic_data (struct dmub_srv *dmub,struct dmub_hw_diagnostic_data *hw_data);#endif /* _DMUB_DCN20_H_ */
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.c +45 -49
127 lines not on this page · raw message
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.h +1 -1
@@ -251,7 +251,7 @@ void dmub_dcn31_set_outbox0_rptr(struct dmub_srv *dmub, uint32_t rptr_offset);uint32_t dmub_dcn31_get_current_time (struct dmub_srv *dmub); -void dmub_dcn31_get_diagnostic_data (struct dmub_srv *dmub); +void dmub_dcn31_get_diagnostic_data (struct dmub_srv *dmub,struct dmub_hw_diagnostic_data *hw_data);bool dmub_dcn31_should_detect (struct dmub_srv *dmub);
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn32.c +45 -49
122 lines not on this page · raw message
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn32.h +1 -1
@@ -260,7 +260,7 @@ void dmub_dcn32_set_outbox0_rptr(struct dmub_srv *dmub, uint32_t rptr_offset);uint32_t dmub_dcn32_get_current_time (struct dmub_srv *dmub); -void dmub_dcn32_get_diagnostic_data (struct dmub_srv *dmub); +void dmub_dcn32_get_diagnostic_data (struct dmub_srv *dmub,struct dmub_hw_diagnostic_data *hw_data);void dmub_dcn32_configure_dmub_in_system_memory (struct dmub_srv *dmub);void dmub_dcn32_send_inbox0_cmd (struct dmub_srv *dmub,union dmub_inbox0_data_register data);
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn35.c +45 -49
122 lines not on this page · raw message
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn35.h +1 -1
@@ -269,7 +269,7 @@ void dmub_dcn35_set_outbox0_rptr(struct dmub_srv *dmub, uint32_t rptr_offset);uint32_t dmub_dcn35_get_current_time (struct dmub_srv *dmub); -void dmub_dcn35_get_diagnostic_data (struct dmub_srv *dmub); +void dmub_dcn35_get_diagnostic_data (struct dmub_srv *dmub,struct dmub_hw_diagnostic_data *hw_data);void dmub_dcn35_configure_dmub_in_system_memory (struct dmub_srv *dmub);
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn401.c +47 -51
132 lines not on this page · raw message
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn401.h +1 -1
@@ -264,7 +264,7 @@ void dmub_dcn401_set_outbox0_rptr(struct dmub_srv *dmub, uint32_t rptr_offset);uint32_t dmub_dcn401_get_current_time (struct dmub_srv *dmub); -void dmub_dcn401_get_diagnostic_data (struct dmub_srv *dmub); +void dmub_dcn401_get_diagnostic_data (struct dmub_srv *dmub,struct dmub_hw_diagnostic_data *hw_data);void dmub_dcn401_configure_dmub_in_system_memory (struct dmub_srv *dmub);void dmub_dcn401_send_inbox0_cmd (struct dmub_srv *dmub,union dmub_inbox0_data_register data);
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn42.c +47 -51
132 lines not on this page · raw message
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn42.h +1 -1
@@ -297,7 +297,7 @@ union dmub_fw_boot_options dmub_dcn42_get_fw_boot_option(struct dmub_srv *dmub);/* Timing and diagnostics */ uint32_t dmub_dcn42_get_current_time (struct dmub_srv *dmub); -void dmub_dcn42_get_diagnostic_data (struct dmub_srv *dmub); +void dmub_dcn42_get_diagnostic_data (struct dmub_srv *dmub,struct dmub_hw_diagnostic_data *hw_data);bool dmub_dcn42_get_preos_fw_info (struct dmub_srv *dmub);#endif /* _DMUB_DCN42_H_ */
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn60.c +47 -51
132 lines not on this page · raw message
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn60.h +1 -1
@@ -277,7 +277,7 @@ void dmub_dcn60_set_outbox0_rptr(struct dmub_srv *dmub, uint32_t rptr_offset);uint32_t dmub_dcn60_get_current_time (struct dmub_srv *dmub); -void dmub_dcn60_get_diagnostic_data (struct dmub_srv *dmub); +void dmub_dcn60_get_diagnostic_data (struct dmub_srv *dmub,struct dmub_hw_diagnostic_data *hw_data);void dmub_dcn60_configure_dmub_in_system_memory (struct dmub_srv *dmub);void dmub_dcn60_send_inbox0_cmd (struct dmub_srv *dmub,union dmub_inbox0_data_register data);
drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c +53 -1
64 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH 42/64 drm/amd/display: Fix DCN42B plane alpha
In reply to George ZhangFrom: Matthew Stewart <[email protected]>
Like DCN42, the alpha field is 12 bits compared to the 16 bit value in plane_state; must convert it.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +1 -0
@@ -146,6 +146,7 @@ void amdgpu_dm_plane_fill_blending_from_plane_state(const struct drm_plane_state* 16-bit, so scale it down to the width the hardware expects. */ if (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 )) *global_alpha_value = plane_state->alpha >>4 ;else
Signature · 1 line
2.55.0
PATCH 43/64 drm/amd/display: Fix KUnit connector warnings
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHY]
Connector mode population without mode_config.mutex produces warning stack traces. Legacy property reads also warn on atomic DRM devices.
[HOW]
Lock mode-population calls and release the mutex before assertions. Read stored property values with the atomic-compatible default getter.
--- .../tests/amdgpu_dm_connector_test.c | 53 +++++++++++++++---- 1 file changed, 42 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c +42 -11
@@ -2735,7 +2735,7 @@ static void dm_test_update_subconnector_dp_with_sink(struct kunit *test)update_subconnector_property (aconnector); -KUNIT_EXPECT_EQ (test,drm_object_property_get_value (&aconnector->base.base, +KUNIT_EXPECT_EQ (test,drm_object_property_get_default_value (&aconnector->base.base, aconnector->base.dev->mode_config.dp_subconnector_property, &val),0 );KUNIT_EXPECT_EQ (test, (int )val, (int )DRM_MODE_SUBCONNECTOR_VGA );
@@ -2778,7 +2778,7 @@ static void dm_test_update_subconnector_dp_no_sink(struct kunit *test)update_subconnector_property (aconnector); -KUNIT_EXPECT_EQ (test,drm_object_property_get_value (&aconnector->base.base, +KUNIT_EXPECT_EQ (test,drm_object_property_get_default_value (&aconnector->base.base, aconnector->base.dev->mode_config.dp_subconnector_property, &val),0 );KUNIT_EXPECT_EQ (test, (int )val, (int )DRM_MODE_SUBCONNECTOR_Unknown);
@@ -2827,7 +2827,7 @@ static void dm_test_update_subconnector_non_dp_noop(struct kunit *test)update_subconnector_property (aconnector);/* Non-DP connector: value must remain what we seeded */ -KUNIT_EXPECT_EQ (test,drm_object_property_get_value (&aconnector->base.base, +KUNIT_EXPECT_EQ (test,drm_object_property_get_default_value (&aconnector->base.base, aconnector->base.dev->mode_config.dp_subconnector_property, &val),0 );KUNIT_EXPECT_EQ (test, (int )val, (int )DRM_MODE_SUBCONNECTOR_VGA );
@@ -3339,7 +3339,7 @@ static uint64_t dm_test_panel_prop_value(struct kunit *test,uint64_t val = ~0ULL ;KUNIT_EXPECT_EQ (test, -drm_object_property_get_value (&ctx->aconnector->base.base, +drm_object_property_get_default_value (&ctx->aconnector->base.base, ctx->drm->mode_config.panel_type_property, &val),0 );return val; }
@@ -5733,9 +5733,11 @@ static void dm_test_native_mode_copies_preferred(struct kunit *test) mode->clock =148500 ; mode->hdisplay =1920 ; mode->vdisplay =1080 ; +mutex_lock (&ctx->drm->mode_config.mutex);drm_mode_probed_add (&ctx->aconnector->base, mode);amdgpu_dm_get_native_mode (&ctx->aconnector->base); +mutex_unlock (&ctx->drm->mode_config.mutex);KUNIT_EXPECT_EQ (test, ctx->aenc->native_mode.hdisplay,1920 );KUNIT_EXPECT_EQ (test, ctx->aenc->native_mode.vdisplay,1080 );
@@ -5788,8 +5790,10 @@ static void dm_test_add_common_modes_non_edp_noop(struct kunit *test) ctx->aenc->native_mode.hdisplay =1920 ; ctx->aenc->native_mode.vdisplay =1200 ; +mutex_lock (&ctx->drm->mode_config.mutex);amdgpu_dm_connector_add_common_modes (&ctx->aenc->base, &ctx->aconnector->base); +mutex_unlock (&ctx->drm->mode_config.mutex);KUNIT_EXPECT_EQ (test, ctx->aconnector->num_modes,0 ); }
@@ -5809,8 +5813,10 @@ static void dm_test_add_common_modes_edp_adds(struct kunit *test) ctx->aenc->native_mode.hdisplay =1920 ; ctx->aenc->native_mode.vdisplay =1200 ; +mutex_lock (&ctx->drm->mode_config.mutex);amdgpu_dm_connector_add_common_modes (&ctx->aenc->base, &ctx->aconnector->base); +mutex_unlock (&ctx->drm->mode_config.mutex);KUNIT_EXPECT_EQ (test, ctx->aconnector->num_modes,10 ); }
@@ -5887,12 +5893,18 @@ static struct amdgpu_dm_connector *dm_test_fs_setup(struct kunit *test)static void dm_test_add_fs_modes_generates (struct kunit *test) {struct amdgpu_dm_connector *aconnector =dm_test_fs_setup (test); +unsigned int count, duplicate_count; aconnector->min_vfreq =20 ; aconnector->max_vfreq =60 ; -KUNIT_EXPECT_EQ (test, (int )add_fs_modes (aconnector),8 ); -KUNIT_EXPECT_EQ (test, (int )add_fs_modes (aconnector),0 ); +mutex_lock (&aconnector->base.dev->mode_config.mutex); + count =add_fs_modes (aconnector); + duplicate_count =add_fs_modes (aconnector); +mutex_unlock (&aconnector->base.dev->mode_config.mutex); + +KUNIT_EXPECT_EQ (test, count,8 ); +KUNIT_EXPECT_EQ (test, duplicate_count,0 ); }/**
@@ -8404,9 +8416,13 @@ static void dm_test_get_modes_noedid_default(struct kunit *test) {struct dm_test_gm_ctx *ctx =dm_test_gm_ctx_alloc (test, DRM_MODE_CONNECTOR_DisplayPort); +int count; + +mutex_lock (&ctx->drm->mode_config.mutex); + count =amdgpu_dm_connector_get_modes (&ctx->aconnector->base); +mutex_unlock (&ctx->drm->mode_config.mutex); -KUNIT_EXPECT_GT (test, -amdgpu_dm_connector_get_modes (&ctx->aconnector->base),0 ); +KUNIT_EXPECT_GT (test, count,0 ); }/**
@@ -8422,10 +8438,12 @@ static void dm_test_get_modes_noedid_128b_adds_more(struct kunit *test)dm_test_gm_ctx_alloc (test, DRM_MODE_CONNECTOR_DisplayPort);int n_8b, n_128b; +mutex_lock (&ctx->drm->mode_config.mutex); n_8b =amdgpu_dm_connector_get_modes (&ctx->aconnector->base); ctx->link_srv->dp_get_encoding_format = dm_test_gm_enc_128b; n_128b =amdgpu_dm_connector_get_modes (&ctx->aconnector->base); +mutex_unlock (&ctx->drm->mode_config.mutex);KUNIT_EXPECT_GT (test, n_128b, n_8b); }
@@ -8444,7 +8462,9 @@ static void dm_test_get_modes_noedid_analog_adds_common(struct kunit *test)struct dc_sink *sink;int n_base, n_analog; +mutex_lock (&ctx->drm->mode_config.mutex); n_base =amdgpu_dm_connector_get_modes (&ctx->aconnector->base); +mutex_unlock (&ctx->drm->mode_config.mutex); sink =kunit_kzalloc (test,sizeof (*sink),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, sink);
@@ -8452,7 +8472,9 @@ static void dm_test_get_modes_noedid_analog_adds_common(struct kunit *test) ctx->aconnector->dc_sink = sink; ctx->link->link_id.id =CONNECTOR_ID_VGA ; +mutex_lock (&ctx->drm->mode_config.mutex); n_analog =amdgpu_dm_connector_get_modes (&ctx->aconnector->base); +mutex_unlock (&ctx->drm->mode_config.mutex);KUNIT_EXPECT_GT (test, n_analog, n_base); }
@@ -8469,6 +8491,7 @@ static void dm_test_get_modes_with_edid(struct kunit *test)struct dm_test_gm_ctx *ctx =dm_test_gm_ctx_alloc (test, DRM_MODE_CONNECTOR_eDP);const struct drm_edid *drm_edid; +int count; drm_edid =drm_edid_alloc (dm_test_uad_edid,sizeof (dm_test_uad_edid));KUNIT_ASSERT_NOT_NULL (test, drm_edid);
@@ -8478,8 +8501,11 @@ static void dm_test_get_modes_with_edid(struct kunit *test) ctx->aenc->native_mode.hdisplay =1920 ; ctx->aenc->native_mode.vdisplay =1200 ; -KUNIT_EXPECT_GT (test, -amdgpu_dm_connector_get_modes (&ctx->aconnector->base),0 ); +mutex_lock (&ctx->drm->mode_config.mutex); + count =amdgpu_dm_connector_get_modes (&ctx->aconnector->base); +mutex_unlock (&ctx->drm->mode_config.mutex); + +KUNIT_EXPECT_GT (test, count,0 );drm_edid_free (drm_edid); ctx->aconnector->drm_edid =NULL ;
@@ -10068,6 +10094,7 @@ static void dm_test_conn_init_get_modes_hook(struct kunit *test)dm_test_conn_init_ctx_alloc (test,SIGNAL_TYPE_HDMI_TYPE_A );const struct drm_connector_helper_funcs *helper;struct drm_connector *connector = &ctx->aconnector->base; +int count; KUNIT_ASSERT_EQ(test, amdgpu_dm_connector_init(ctx->dm, ctx->aconnector, 0,
@@ -10077,7 +10104,11 @@ static void dm_test_conn_init_get_modes_hook(struct kunit *test)KUNIT_ASSERT_NOT_NULL (test, helper);KUNIT_ASSERT_NOT_NULL (test, helper->get_modes); -KUNIT_EXPECT_GT (test, helper->get_modes (connector),0 ); +mutex_lock (&ctx->drm->mode_config.mutex); + count = helper->get_modes (connector); +mutex_unlock (&ctx->drm->mode_config.mutex); + +KUNIT_EXPECT_GT (test, count,0 );KUNIT_EXPECT_GT (test, ctx->aconnector->num_modes,0 ); }
Signature · 1 line
2.55.0
PATCH 44/64 drm/amd/display: Fix KUnit CRTC warnings
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHY]
Incomplete CRTC callbacks and vblank teardown cause DRM warnings in CRTC tests.
[HOW]
Provide the required CRTC callbacks, link fake CRTCs for vblank lookup, and register cleanup actions to disable vblank before unlinking them.
--- .../amdgpu_dm/tests/amdgpu_dm_crtc_test.c | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c +44 -0
@@ -877,10 +877,39 @@ static bool dm_test_crtc_get_vblank_timestamp(struct drm_crtc *crtc,return false; } +static int dm_test_crtc_enable_vblank (struct drm_crtc *crtc) +{ +return 0 ; +} + +static void dm_test_crtc_disable_vblank (struct drm_crtc *crtc) +{ +} + +static u32 dm_test_crtc_get_vblank_counter (struct drm_crtc *crtc) +{ +return 0 ; +} +static const struct drm_crtc_funcs dm_test_crtc_funcs = { + .destroy = amdgpu_dm_crtc_destroy, + .atomic_duplicate_state = amdgpu_dm_crtc_duplicate_state, + .atomic_destroy_state = amdgpu_dm_crtc_destroy_state, + .enable_vblank = dm_test_crtc_enable_vblank, + .disable_vblank = dm_test_crtc_disable_vblank, + .get_vblank_counter = dm_test_crtc_get_vblank_counter, .get_vblank_timestamp = dm_test_crtc_get_vblank_timestamp, }; +static void dm_test_crtc_cleanup (void *data) +{ +struct amdgpu_crtc *acrtc = data; + +if (acrtc->base.dev &&drm_dev_has_vblank (acrtc->base.dev)) +drm_crtc_vblank_off (&acrtc->base); +list_del_init (&acrtc->base.head); +} +/* * dm_test_crtc_arm_irq_src - Prime an IRQ source so get()/put() short-circuit. * @test: The KUnit test context
@@ -947,8 +976,13 @@ dm_test_crtc_setup_enable(struct kunit *test, struct amdgpu_device **adev_out, acrtc =kunit_kzalloc (test,sizeof (*acrtc),GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, acrtc); acrtc->base.dev = &adev->ddev; + acrtc->base.funcs = &dm_test_crtc_funcs; acrtc->base.enabled = true; acrtc->crtc_id =0 ; +INIT_LIST_HEAD (&acrtc->base.head); +list_add_tail (&acrtc->base.head, &adev->ddev.mode_config.crtc_list); +KUNIT_ASSERT_EQ (test, +kunit_add_action_or_reset (test, dm_test_crtc_cleanup, acrtc),0 ); link =dm_kunit_alloc_link (test); stream =dm_kunit_alloc_stream (test, link);
@@ -1783,6 +1817,11 @@ static void dm_test_crtc_handle_vblank_skips_when_flip_submitted(struct kunit *tKUNIT_ASSERT_NOT_ERR_OR_NULL (test, event); acrtc->base.dev = &adev->ddev; + acrtc->base.funcs = &dm_test_crtc_funcs; +INIT_LIST_HEAD (&acrtc->base.head); +list_add_tail (&acrtc->base.head, &adev->ddev.mode_config.crtc_list); +KUNIT_ASSERT_EQ (test, +kunit_add_action_or_reset (test, dm_test_crtc_cleanup, acrtc),0 ); acrtc->event = event; acrtc->pflip_status =AMDGPU_FLIP_SUBMITTED ;
@@ -1819,6 +1858,11 @@ static void dm_test_crtc_handle_vblank_completes_cursor_only(struct kunit *test)KUNIT_ASSERT_NOT_ERR_OR_NULL (test, event); acrtc->base.dev = &adev->ddev; + acrtc->base.funcs = &dm_test_crtc_funcs; +INIT_LIST_HEAD (&acrtc->base.head); +list_add_tail (&acrtc->base.head, &adev->ddev.mode_config.crtc_list); +KUNIT_ASSERT_EQ (test, +kunit_add_action_or_reset (test, dm_test_crtc_cleanup, acrtc),0 ); acrtc->event = event; acrtc->pflip_status =AMDGPU_FLIP_NONE ;
Signature · 1 line
2.55.0
PATCH 45/64 drm/amd/display: Fix KUnit cursor warning
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHY]
The cursor offset test binds a CRTC without a framebuffer, triggering a plane-state consistency warning before the intended offset check.
[HOW]
Provide a test framebuffer in the new plane state while retaining the invalid offset and its expected rejection.
--- .../drm/amd/display/amdgpu_dm/tests/amdgpu_dm_cursor_test.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_cursor_test.c +4 -0
@@ -365,6 +365,7 @@ static void dm_test_check_native_cursor_state_rejects_offset(struct kunit *test)struct amdgpu_device *adev =dm_kunit_alloc_adev (test);struct amdgpu_crtc *acrtc;struct drm_plane *plane; +struct drm_framebuffer *fb;struct drm_plane_state *old_plane_state;struct drm_plane_state *new_plane_state;int ret;
@@ -373,6 +374,8 @@ static void dm_test_check_native_cursor_state_rejects_offset(struct kunit *test)KUNIT_ASSERT_NOT_NULL (test, acrtc); plane =kunit_kzalloc (test,sizeof (*plane),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, plane); + fb =kunit_kzalloc (test,sizeof (*fb),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, fb); old_plane_state =kunit_kzalloc (test,sizeof (*old_plane_state),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, old_plane_state); new_plane_state =kunit_kzalloc (test,sizeof (*new_plane_state),GFP_KERNEL );
@@ -381,6 +384,7 @@ static void dm_test_check_native_cursor_state_rejects_offset(struct kunit *test) acrtc->base.dev = &adev->ddev; old_plane_state->crtc = &acrtc->base; new_plane_state->crtc = &acrtc->base; + new_plane_state->fb = fb; new_plane_state->src_x =1 ; plane->state = old_plane_state;
Signature · 1 line
2.55.0
PATCH 46/64 drm/amd/display: Fix KUnit VRR warnings
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHY]
The VRR transition test needs a discoverable CRTC and balanced vblank teardown. Assertion failures must not leave freed CRTCs linked.
[HOW]
Supply a vblank counter callback and link the test CRTC. Register a KUnit cleanup action to disable vblank and unlink it on every exit.
--- .../amdgpu_dm/tests/amdgpu_dm_freesync_test.c | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_freesync_test.c +22 -0
@@ -21,6 +21,23 @@#include "amdgpu_dm_freesync.h" #include "amdgpu_dm_kunit_test_helpers.h" +static u32 dm_test_freesync_vblank_counter (struct drm_crtc *crtc) +{ +return 0 ; +} + +static const struct drm_crtc_funcs dm_test_freesync_crtc_funcs = { + .get_vblank_counter = dm_test_freesync_vblank_counter, +}; + +static void dm_test_freesync_crtc_cleanup (void *data) +{ +struct amdgpu_crtc *acrtc = data; + +drm_crtc_vblank_off (&acrtc->base); +list_del_init (&acrtc->base.head); +} +/* Tests for amdgpu_dm_is_timing_unchanged_for_freesync() */ /**
@@ -782,6 +799,11 @@ static void dm_test_handle_vrr_transition_round_trip(struct kunit *test) acrtc =kunit_kzalloc (test,sizeof (*acrtc),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, acrtc); acrtc->base.dev = &adev->ddev; + acrtc->base.funcs = &dm_test_freesync_crtc_funcs; +INIT_LIST_HEAD (&acrtc->base.head); +list_add_tail (&acrtc->base.head, &adev->ddev.mode_config.crtc_list); +KUNIT_ASSERT_EQ (test, +kunit_add_action_or_reset (test, dm_test_freesync_crtc_cleanup, acrtc),0 ); acrtc->otg_inst =-1 ; vblank =drm_crtc_vblank_crtc (&acrtc->base); adev->ddev.vblank[0 ].enabled = true;
Signature · 1 line
2.55.0
PATCH 47/64 drm/amd/display: Fix KUnit helper warnings
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHY]
The real connector fixture lacks atomic state callbacks required by DRM connector initialization.
[HOW]
Install the DRM atomic connector duplicate and destroy state helpers alongside the existing reset callback.
--- .../drm/amd/display/amdgpu_dm/tests/amdgpu_dm_helpers_test.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_helpers_test.c +2 -0
@@ -4293,6 +4293,8 @@ static void dm_test_is_dp_sink_present_queries_link_service(struct kunit *test)*/ static const struct drm_connector_funcs dm_test_connector_funcs = { .reset = drm_atomic_helper_connector_reset, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; static struct amdgpu_dm_connector *dm_test_alloc_real_connector(struct kunit *test,
Signature · 1 line
2.55.0
PATCH 48/64 drm/amd/display: Fix KUnit IRQ warnings
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHY]
IRQ tests leave vblank active when removing their fake CRTCs, causing warnings during DRM device teardown.
[HOW]
Turn off initialized vblank before unlinking each test CRTC in the existing cleanup action.
--- .../gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c +3 -0
@@ -480,6 +480,9 @@ static void dm_test_crtc_list_del(void *data) {struct amdgpu_crtc *acrtc = data; +if (acrtc->base.dev &&drm_dev_has_vblank (acrtc->base.dev)) +drm_crtc_vblank_off (&acrtc->base); +list_del_init (&acrtc->base.head); }
Signature · 1 line
2.55.0
PATCH 49/64 drm/amd/display: Fix KUnit MST warnings
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHY]
The MST add-connector fixture registers an unmanaged master connector but does not clean it up before its KUnit-owned storage is released.
[HOW]
Register a KUnit action after successful connector initialization to run drm_connector_cleanup before freeing the master connector.
--- .../display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c +9 -0
@@ -1311,6 +1311,13 @@ struct dm_mst_test_add_ctx {struct dc_link *link; }; +static void dm_mst_test_cleanup_add_ctx (void *data) +{ +struct amdgpu_dm_connector *master = data; + +drm_connector_cleanup (&master->base); +} +/* * Stand in for amdgpu_display_modeset_create_props(), which the test module * cannot link against. Only the properties amdgpu_dm_connector_init_helper()
@@ -1368,6 +1375,8 @@ static void dm_mst_test_init_add_ctx(struct kunit *test, struct dm_mst_test_add_ ret =drm_connector_init (drm, &ctx->master->base, &dm_mst_test_connector_funcs, DRM_MODE_CONNECTOR_DisplayPort);KUNIT_ASSERT_EQ (test, ret,0 ); +KUNIT_ASSERT_EQ (test, +kunit_add_action_or_reset (test, dm_mst_test_cleanup_add_ctx, ctx->master),0 ); ctx->port =kunit_kzalloc (test,sizeof (*ctx->port),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, ctx->port);
Signature · 1 line
2.55.0
PATCH 50/64 drm/amd/display: Fix KUnit DM warnings
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHY]
Vblank and interrupt-management tests need discoverable CRTCs with complete vblank callbacks and balanced teardown.
[HOW]
Add the callbacks, link the fake CRTCs, and register cleanup actions to disable vblank before unlinking. Pass the CRTC directly so cleanup does not reinterpret two different fixture types through one layout.
--- .../display/amdgpu_dm/tests/amdgpu_dm_test.c | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +41 -0
@@ -1681,6 +1681,35 @@ struct dm_test_vblank_ctx {struct drm_pending_vblank_event *event; }; +static int dm_test_vblank_enable (struct drm_crtc *crtc) +{ +return 0 ; +} + +static void dm_test_vblank_disable (struct drm_crtc *crtc) +{ +} + +static u32 dm_test_vblank_counter (struct drm_crtc *crtc) +{ +return 0 ; +} + +static const struct drm_crtc_funcs dm_test_vblank_crtc_funcs = { + .enable_vblank = dm_test_vblank_enable, + .disable_vblank = dm_test_vblank_disable, + .get_vblank_counter = dm_test_vblank_counter, +}; + +static void dm_test_vblank_ctx_cleanup (void *data) +{ +struct amdgpu_crtc *acrtc = data; + +if (drm_dev_has_vblank (acrtc->base.dev)) +drm_crtc_vblank_off (&acrtc->base); +list_del_init (&acrtc->base.head); +} +/* * A CRTC with one active plane and a pending vblank event. There is no * initialised vblank, so drm_crtc_vblank_get() fails, which the function under
@@ -1702,9 +1731,15 @@ static struct dm_test_vblank_ctx *dm_test_vblank_ctx_alloc(struct kunit *test)KUNIT_ASSERT_NOT_NULL (test, ctx->event); ctx->acrtc->base.dev = &ctx->adev->ddev; + ctx->acrtc->base.funcs = &dm_test_vblank_crtc_funcs; +INIT_LIST_HEAD (&ctx->acrtc->base.head); +list_add_tail (&ctx->acrtc->base.head, + &ctx->adev->ddev.mode_config.crtc_list); ctx->acrtc->base.state = &ctx->acrtc_state->base; ctx->acrtc_state->base.event = ctx->event; ctx->acrtc_state->active_planes =1 ; +KUNIT_ASSERT_EQ (test, +kunit_add_action_or_reset (test, dm_test_vblank_ctx_cleanup, ctx->acrtc),0 );return ctx; }
@@ -4185,7 +4220,13 @@ static struct dm_test_irq_mgmt_ctx *dm_test_irq_mgmt_ctx_alloc(struct kunit *tes ctx->adev->mode_info.num_crtc =1 ; ctx->acrtc->base.dev = &ctx->adev->ddev; + ctx->acrtc->base.funcs = &dm_test_vblank_crtc_funcs; +INIT_LIST_HEAD (&ctx->acrtc->base.head); +list_add_tail (&ctx->acrtc->base.head, + &ctx->adev->ddev.mode_config.crtc_list); ctx->acrtc->crtc_id =0 ; +KUNIT_ASSERT_EQ (test, +kunit_add_action_or_reset (test, dm_test_vblank_ctx_cleanup, ctx->acrtc),0 ); ctx->acrtc_state->stream =dm_kunit_alloc_stream (test,NULL ); timing = &ctx->acrtc_state->stream->timing;
Signature · 1 line
2.55.0
PATCH 51/64 drm/amd/display: Fix KUnit writeback warnings
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHY]
Writeback mode tests call drm_mode_probed_add without holding mode_config.mutex, producing a warning for every generated mode.
[HOW]
Hold the mutex around writeback mode enumeration and release it before checking the returned count or inspecting the generated modes.
--- .../gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_wb_test.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_wb_test.c +4 -0
@@ -418,7 +418,9 @@ static void dm_test_wb_get_modes_returns_modes(struct kunit *test)drmm_connector_init (drm, connector, &dm_wb_test_connector_funcs,DRM_MODE_CONNECTOR_VIRTUAL ,NULL ); +mutex_lock (&drm->mode_config.mutex); count =amdgpu_dm_wb_connector_get_modes (connector); +mutex_unlock (&drm->mode_config.mutex);/* drm_add_modes_noedid should return at least one mode */ KUNIT_EXPECT_GT (test, count,0 );
@@ -453,7 +455,9 @@ static void dm_test_wb_get_modes_bounded_by_max(struct kunit *test)drmm_connector_init (drm, connector, &dm_wb_test_connector_funcs,DRM_MODE_CONNECTOR_VIRTUAL ,NULL ); +mutex_lock (&drm->mode_config.mutex);amdgpu_dm_wb_connector_get_modes (connector); +mutex_unlock (&drm->mode_config.mutex);/* All modes must fit within 3840x2160 */ list_for_each_entry (mode, &connector->probed_modes, head) {
Signature · 1 line
2.55.0
PATCH 52/64 drm/amd/display: Restore FreeSync VCP code check for HDMI/PCON sinks
In reply to George ZhangFrom: Fangzhi Zuo <[email protected]>
[WHAT]
Folding the MCCS FreeSync checks into the do_mccs block dropped the other half of the original condition: the check that clears freesync_capable for HDMI or PCON-in-whitelist sinks that expose no EDID FreeSync VCP code. That check does not depend on the MCCS caps and must run regardless of do_mccs.
As a result, when do_mccs is false such a sink without a FreeSync VCP code is still reported as FreeSync-capable.
[HOW]
Restore the VCP code check outside the do_mccs block so it is evaluated whether or not MCCS caps were read.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c | 6 ++++++ .../display/amdgpu_dm/tests/amdgpu_dm_connector_test.c | 9 ++++++--- 2 files changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c +6 -0
@@ -3987,6 +3987,12 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector, amdgpu_dm_connector->min_vfreq; } +/* HDMI/PCON without an EDID FreeSync VCP code is not FreeSync-capable. */ +if ((sink->sink_signal ==SIGNAL_TYPE_HDMI_TYPE_A || + as_type ==FREESYNC_TYPE_PCON_IN_WHITELIST ) && + !sink->edid_caps.freesync_vcp_code) + freesync_capable = false; +/* Handle MCCS */ if (do_mccs) {dm_helpers_read_mccs_caps (adev->dm.dc->ctx, amdgpu_dm_connector->dc_link, sink);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c +6 -3
@@ -9783,6 +9783,8 @@ static void dm_test_fs_caps_edp_replay_mode(struct kunit *test)* * On HDMI the CEA extension is handed to the DMCU parser, whose reported * 24-60Hz range is copied to the connector and published as the monitor range. +* The DMCU does not report an EDID FreeSync VCP code, so the connector is not +* marked FreeSync-capable. */ static void dm_test_fs_caps_hdmi_vsdb (struct kunit *test) {
@@ -9800,7 +9802,7 @@ static void dm_test_fs_caps_hdmi_vsdb(struct kunit *test)KUNIT_EXPECT_EQ (test, ctx->aconnector->max_vfreq,60 );KUNIT_EXPECT_EQ (test, connector->display_info.monitor_range.min_vfreq,24 );KUNIT_EXPECT_EQ (test, connector->display_info.monitor_range.max_vfreq,60 ); -KUNIT_EXPECT_TRUE (test,dm_test_fs_caps_capable (ctx)); +KUNIT_EXPECT_FALSE (test,dm_test_fs_caps_capable (ctx)); }/**
@@ -9827,7 +9829,8 @@ static void dm_test_fs_caps_hdmi_no_vsdb(struct kunit *test)* @test: The KUnit test context * * A whitelisted protocol converter re-parses the AMD VSDB, enables SDP v1.3 -* packing and adopts the converter adaptive sync type. +* packing and adopts the converter adaptive sync type. Without an EDID +* FreeSync VCP code, the connector is not marked FreeSync-capable. */ static void dm_test_fs_caps_pcon_whitelist (struct kunit *test) {
@@ -9850,7 +9853,7 @@ static void dm_test_fs_caps_pcon_whitelist(struct kunit *test) (int)FREESYNC_TYPE_PCON_IN_WHITELIST);KUNIT_EXPECT_EQ (test, ctx->aconnector->min_vfreq,24 );KUNIT_EXPECT_EQ (test, ctx->aconnector->max_vfreq,60 ); -KUNIT_EXPECT_TRUE (test,dm_test_fs_caps_capable (ctx)); +KUNIT_EXPECT_FALSE (test,dm_test_fs_caps_capable (ctx)); }/**
Signature · 1 line
2.55.0
PATCH 53/64 drm/amd/display: Fix KUnit checkpatch warnings
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHY]
Clean up the AMDGPU DM KUnit tests after checkpatch reported an invalid sizeof(void) allocation, typed kzalloc patterns, and a repeated word in a kernel-doc summary. Clarify the test name that covers an active CRTC state transition.
[HOW]
- Use sizeof(cpu_ptr) for the fake CPU pointer allocation.
- Replace typed kzalloc(sizeof(*object), ...) calls with kzalloc_obj(*object, ...) in the connector, IRQ, plane, and atomic-state tests.
- Rename the CRTC active-state test and update its kernel-doc and suite registration.
--- .../display/amdgpu_dm/tests/amdgpu_dm_connector_test.c | 2 +- .../amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c | 6 +++--- .../amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c | 10 +++++----- .../amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c | 6 +++--- .../display/amdgpu_dm/tests/amdgpu_dm_services_test.c | 2 +- .../drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c +1 -1
@@ -4897,7 +4897,7 @@ dm_test_destroy_connector(struct kunit *test, struct drm_device *drm) {struct amdgpu_dm_connector *aconnector; - aconnector =kzalloc (sizeof (*aconnector),GFP_KERNEL ); + aconnector =kzalloc_obj (*aconnector,GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, aconnector); KUNIT_ASSERT_EQ(test,
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c +3 -3
@@ -42,10 +42,10 @@ static void dm_test_crtc_modeset_required_active_mode_changed(struct kunit *test }/** -* dm_test_crtc_modeset_required_active_active_changed - Test Crtc modeset required active active changed +* dm_test_crtc_modeset_required_active_state_changed - Test modeset required when the active state changes * @test: The KUnit test context */ -static void dm_test_crtc_modeset_required_active_active_changed (struct kunit *test) +static void dm_test_crtc_modeset_required_active_state_changed (struct kunit *test) {struct drm_crtc_state state = {};
@@ -2622,7 +2622,7 @@ static void dm_test_crtc_atomic_check_invalid_stream_fails(struct kunit *test)static struct kunit_case amdgpu_dm_crtc_tests[] = {/* amdgpu_dm_crtc_modeset_required */ KUNIT_CASE (dm_test_crtc_modeset_required_active_mode_changed), -KUNIT_CASE (dm_test_crtc_modeset_required_active_active_changed), +KUNIT_CASE (dm_test_crtc_modeset_required_active_state_changed),KUNIT_CASE (dm_test_crtc_modeset_required_active_connectors_changed),KUNIT_CASE (dm_test_crtc_modeset_required_inactive),KUNIT_CASE (dm_test_crtc_modeset_required_no_changes),
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c +5 -5
@@ -2231,7 +2231,7 @@ static void dm_test_hpd_rx_offload_work_no_connector(struct kunit *test) offload_wq =kunit_kzalloc (test,sizeof (*offload_wq),GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, offload_wq); - offload_work =kzalloc (sizeof (*offload_work),GFP_KERNEL ); + offload_work =kzalloc_obj (*offload_work,GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, offload_work); offload_work->offload_wq = offload_wq; offload_work->adev = adev;
@@ -4285,9 +4285,9 @@ static void dm_test_handle_hpd_work_out_of_range(struct kunit *test)struct amdgpu_device *adev; adev =dm_kunit_alloc_adev (test); - hpd_work =kzalloc (sizeof (*hpd_work),GFP_KERNEL ); + hpd_work =kzalloc_obj (*hpd_work,GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, hpd_work); - hpd_work->dmub_notify =kzalloc (sizeof (*hpd_work->dmub_notify),GFP_KERNEL ); + hpd_work->dmub_notify =kzalloc_obj (*hpd_work->dmub_notify,GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, hpd_work->dmub_notify); hpd_work->dmub_notify->type = (enum dmub_notification_type )ARRAY_SIZE (adev->dm.dmub_callback);
@@ -5059,9 +5059,9 @@ static void dm_test_handle_vmin_vmax_update(struct kunit *test)kref_get (&stream->refcount);/* The worker kfree()s both, so they must come from the slab. */ - work =kzalloc (sizeof (*work),GFP_KERNEL ); + work =kzalloc_obj (*work,GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, work); - adjust =kzalloc (sizeof (*adjust),GFP_KERNEL ); + adjust =kzalloc_obj (*adjust,GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adjust); work->adev = adev;
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +3 -3
@@ -2266,7 +2266,7 @@ static void dm_test_plane_reset_initializes_state(struct kunit *test)* destroy-existing-state path. The destroy hook frees this state, so it * must be a plain (non-KUnit-managed) allocation. */ - old_state =kzalloc (sizeof (*old_state),GFP_KERNEL ); + old_state =kzalloc_obj (*old_state,GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, old_state); plane->funcs = &dm_test_plane_reset_funcs; plane->state = &old_state->base;
@@ -2428,7 +2428,7 @@ static void dm_test_plane_destroy_state_minimal(struct kunit *test)KUNIT_ASSERT_NOT_NULL (test, plane);/* destroy_state frees the state itself, so use a plain allocation. */ - dm_plane_state =kzalloc (sizeof (*dm_plane_state),GFP_KERNEL ); + dm_plane_state =kzalloc_obj (*dm_plane_state,GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, dm_plane_state);amdgpu_dm_plane_drm_plane_destroy_state (plane, &dm_plane_state->base);
@@ -2456,7 +2456,7 @@ static void dm_test_plane_destroy_state_releases_resources(struct kunit *test)KUNIT_ASSERT_NOT_NULL (test, dc_plane_state);/* destroy_state frees the state itself, so use a plain allocation. */ - dm_plane_state =kzalloc (sizeof (*dm_plane_state),GFP_KERNEL ); + dm_plane_state =kzalloc_obj (*dm_plane_state,GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, dm_plane_state);/* Hold an extra reference so the release does not free KUnit memory. */
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_services_test.c +1 -1
@@ -337,7 +337,7 @@ static int dm_test_gpu_mem_init(struct kunit *test) {void *cpu_ptr; - cpu_ptr =kunit_kzalloc (test,sizeof (*cpu_ptr),GFP_KERNEL ); + cpu_ptr =kunit_kzalloc (test,sizeof (cpu_ptr),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, cpu_ptr); dm_test_bo_ctx = (struct dm_test_bo_ops_ctx ) {
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +1 -1
@@ -247,7 +247,7 @@ static void dm_test_atomic_destroy_state_no_context(struct kunit *test)* Use kzalloc(), not kunit_kzalloc(): dm_atomic_destroy_state() frees * the state itself, so KUnit-managed memory would be double-freed. */ - dm_state =kzalloc (sizeof (*dm_state),GFP_KERNEL ); + dm_state =kzalloc_obj (*dm_state,GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, dm_state);/* context == NULL: dc_state_release() is skipped and the state is freed. */
Signature · 1 line
2.55.0
PATCH 54/64 drm/amd/display: Drop pipe_ctx from hwss block sequence operations
In reply to George ZhangFrom: Rafal Ostrowski <[email protected]>
[Why]pipe_ctx is not allowed to reach a block sequence step. Several operations still carried it into the executor, which then walked the logical state at execute time (pipe_ctx->stream->timing, pipe_ctx->plane_state and similar) instead of acting on data resolved during build.
[How]
Give each operation a flat parameter list holding only the hardware objects and values the final hwss call needs, and change the matching hooks to take it. The function pointer, the params struct, the executor, the builder helpers and all call sites are updated together.
Operations covered:
- OPTC_PROGRAM_MANUAL_TRIGGER - takes tg
- HUBP_PROGRAM_TRIPLEBUFFER - program_triplebuffer takes (hubp, bool)
- DPP_SETUP_DPP, DPP_PROGRAM_BIAS_AND_SCALE - take (dpp, plane_state)
- DSC_ENABLE_WITH_OPP - takes (dsc, opp_inst)
- OPP_PROGRAM_BIT_DEPTH_REDUCTION - opp
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 4 +- .../drm/amd/display/dc/core/dc_hw_sequencer.c | 165 ++++++++++-------- .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 12 +- .../amd/display/dc/hwss/dcn20/dcn20_hwseq.h | 3 +- .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 6 +- .../amd/display/dc/hwss/dcn50/dcn50_hwseq.c | 4 +- .../drm/amd/display/dc/hwss/hw_sequencer.h | 34 ++-- 7 files changed, 128 insertions(+), 100 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -2
@@ -5140,7 +5140,7 @@ static void commit_planes_for_stream(struct dc *dc,if (dc->hwss.program_triplebuffer !=NULL && dc->debug.enable_tri_buf) {/*turn off triple buffer for full update*/ dc->hwss.program_triplebuffer ( - dc, pipe_ctx, pipe_ctx->plane_state->triplebuffer_flips); + pipe_ctx->plane_res.hubp, pipe_ctx->plane_state->triplebuffer_flips); } }
@@ -5215,7 +5215,7 @@ static void commit_planes_for_stream(struct dc *dc,if (dc->hwss.program_triplebuffer !=NULL && dc->debug.enable_tri_buf) {/*only enable triplebuffer for fast_update*/ dc->hwss.program_triplebuffer ( - dc, pipe_ctx, pipe_ctx->plane_state->triplebuffer_flips); + pipe_ctx->plane_res.hubp, pipe_ctx->plane_state->triplebuffer_flips); }if (pipe_ctx->plane_state->update_bits.addr_update) dc->hwss.update_plane_addr (dc, pipe_ctx);
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +95 -70
284 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +5 -7
@@ -394,14 +394,12 @@ void dcn20_disable_vga( }void dcn20_program_triple_buffer ( -const struct dc *dc, -struct pipe_ctx *pipe_ctx, +struct hubp *hubp,bool enable_triple_buffer) { - (void )dc; -if (pipe_ctx->plane_res.hubp && pipe_ctx->plane_res.hubp->funcs) { - pipe_ctx->plane_res.hubp->funcs->hubp_enable_tripleBuffer ( - pipe_ctx->plane_res.hubp, +if (hubp && hubp->funcs) { + hubp->funcs->hubp_enable_tripleBuffer ( + hubp, enable_triple_buffer); } }
@@ -2110,7 +2108,7 @@ void dcn20_program_front_end_for_ctx(ASSERT (!pipe->plane_state->triplebuffer_flips);/*turn off triple buffer for full update*/ dc->hwss.program_triplebuffer ( - dc, pipe, pipe->plane_state->triplebuffer_flips); + pipe->plane_res.hubp, pipe->plane_state->triplebuffer_flips); } } }
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.h +1 -2
@@ -114,8 +114,7 @@ void dcn20_hubp_pg_control(unsigned int hubp_inst, bool power_on);void dcn20_program_triple_buffer ( -const struct dc *dc, -struct pipe_ctx *pipe_ctx, +struct hubp *hubp,bool enable_triple_buffer); void dcn20_enable_writeback( struct dc *dc,
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +3 -3
@@ -2533,7 +2533,7 @@ void dcn401_program_front_end_for_ctx(/*turn off triple buffer for full update*/ dc->hwss.program_triplebuffer ( - dc, pipe, pipe->plane_state->triplebuffer_flips); + pipe->plane_res.hubp, pipe->plane_state->triplebuffer_flips); } } }
@@ -3686,7 +3686,7 @@ void dcn401_update_dchubp_dpp_sequence(struct dc *dc, plane_state->update_bits.input_csc_change || plane_state->update_bits.color_space_change || plane_state->update_bits.coeff_reduction_change) { -hwss_add_dpp_setup_dpp (seq_state, pipe_ctx); +hwss_add_dpp_setup_dpp (seq_state, dpp, plane_state);/* Step 8: DPP cursor matrix setup */ if (dpp->funcs->set_cursor_matrix) {
@@ -3696,7 +3696,7 @@ void dcn401_update_dchubp_dpp_sequence(struct dc *dc,/* Step 9: DPP program bias and scale */ if (dpp->funcs->dpp_program_bias_and_scale) -hwss_add_dpp_program_bias_and_scale (seq_state, pipe_ctx); +hwss_add_dpp_program_bias_and_scale (seq_state, dpp, plane_state); }/* Step 10: MPCC updates */
drivers/gpu/drm/amd/display/dc/hwss/dcn50/dcn50_hwseq.c +2 -2
@@ -315,7 +315,7 @@ void dcn50_update_dchubp_dpp_sequence(struct dc *dc, plane_state->update_bits.input_csc_change || plane_state->update_bits.color_space_change || plane_state->update_bits.coeff_reduction_change) { -hwss_add_dpp_setup_dpp (seq_state, pipe_ctx); +hwss_add_dpp_setup_dpp (seq_state, dpp, plane_state);/* Step 8: DPP cursor matrix setup */ if (dpp->funcs->set_cursor_matrix) {
@@ -325,7 +325,7 @@ void dcn50_update_dchubp_dpp_sequence(struct dc *dc,/* Step 9: DPP program bias and scale */ if (dpp->funcs->dpp_program_bias_and_scale) -hwss_add_dpp_program_bias_and_scale (seq_state, pipe_ctx); +hwss_add_dpp_program_bias_and_scale (seq_state, dpp, plane_state); }/* Step 10: MPCC updates */
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +20 -14
@@ -87,8 +87,7 @@ struct set_flip_control_gsl_params { };struct program_triplebuffer_params { -const struct dc *dc; -struct pipe_ctx *pipe_ctx; +struct hubp *hubp;bool enableTripleBuffer; };
@@ -138,7 +137,7 @@ struct update_info_frame_params { };struct program_manual_trigger_params { -struct pipe_ctx *pipe_ctx; +struct timing_generator *tg; };struct send_dmcub_cmd_params {
@@ -156,11 +155,15 @@ struct lsdma_send_pio_copy_params { };struct setup_dpp_params { -struct pipe_ctx *pipe_ctx; +struct dpp *dpp; +enum surface_pixel_format format; +struct dc_csc_transform input_csc_color_matrix; +enum dc_color_space color_space; };struct program_bias_and_scale_params { -struct pipe_ctx *pipe_ctx; +struct dpp *dpp; +struct dc_bias_and_scale bias_and_scale; };struct set_output_transfer_func_params {
@@ -313,7 +316,8 @@ struct dsc_calculate_and_set_config_params { };struct dsc_enable_with_opp_params { -struct pipe_ctx *pipe_ctx; +struct display_stream_compressor *dsc; +int opp_inst; };struct program_tg_params {
@@ -412,8 +416,7 @@ struct opp_program_fmt_params {struct opp_program_bit_depth_reduction_params {struct output_pixel_processor *opp; -bool use_default_params; -struct pipe_ctx *pipe_ctx; +struct bit_depth_reduction_params bit_depth_params; };struct opp_set_disp_pattern_generator_params {
@@ -1463,8 +1466,7 @@ struct hw_sequencer_funcs {void (*edp_backlight_control)(struct dc_link *link,bool enable); -void (*program_triplebuffer)(const struct dc *dc, -struct pipe_ctx *pipe_ctx,bool enableTripleBuffer); +void (*program_triplebuffer)(struct hubp *hubp,bool enableTripleBuffer);void (*update_pending_status)(struct pipe_ctx *pipe_ctx);void (*update_dsc_pg)(struct dc *dc,struct dc_state *context,bool safe_to_disable);void (*clear_surface_dcc_and_tiling)(struct pipe_ctx *pipe_ctx,struct dc_plane_state *plane_state,bool clear_tiling);
@@ -1871,6 +1873,8 @@ void hwss_process_outstanding_hw_updates(struct dc *dc,void hwss_send_dmcub_cmd (union block_sequence_params *params);void hwss_lsdma_send_pio_copy (union block_sequence_params *params); +void hwss_program_triplebuffer (union block_sequence_params *params); +void hwss_program_manual_trigger (union block_sequence_params *params);void hwss_setup_dpp (union block_sequence_params *params);
@@ -2188,7 +2192,7 @@ void hwss_add_hubp_set_flip_control_gsl(struct block_sequence_state *seq_state, struct hubp *hubp, bool flip_immediate);void hwss_add_hubp_program_triplebuffer (struct block_sequence_state *seq_state, -struct dc *dc,struct pipe_ctx *pipe_ctx,bool enableTripleBuffer); +struct hubp *hubp,bool enableTripleBuffer);void hwss_add_hubp_update_plane_addr (struct block_sequence_state *seq_state,struct dc *dc,struct pipe_ctx *pipe_ctx);
@@ -2200,10 +2204,11 @@ void hwss_add_dpp_program_gamut_remap(struct block_sequence_state *seq_state, struct pipe_ctx *pipe_ctx);void hwss_add_dpp_program_bias_and_scale (struct block_sequence_state *seq_state, -struct pipe_ctx *pipe_ctx); +struct dpp *dpp, +struct dc_plane_state *plane_state);void hwss_add_optc_program_manual_trigger (struct block_sequence_state *seq_state, -struct pipe_ctx *pipe_ctx); +struct timing_generator *tg);void hwss_add_dpp_set_output_transfer_func (struct block_sequence_state *seq_state,struct dc *dc,struct pipe_ctx *pipe_ctx);
@@ -2581,7 +2586,8 @@ void hwss_add_hubp_program_surface_config(struct block_sequence_state *seq_state int compat_level);void hwss_add_dpp_setup_dpp (struct block_sequence_state *seq_state, -struct pipe_ctx *pipe_ctx); +struct dpp *dpp, +struct dc_plane_state *plane_state); void hwss_add_dpp_set_cursor_matrix(struct block_sequence_state *seq_state, struct dpp *dpp,
Signature · 1 line
2.55.0
PATCH 55/64 drm/amd/display: refactor hwss SET_CURSOR_POSITION block sequence
In reply to George ZhangFrom: Rafal Ostrowski <[email protected]>
Flatten the executor params for the initial set of HWSS block sequence ops for SET_CURSOR_POSITION to separate SW and HW logic
--- .../drm/amd/display/dc/core/dc_hw_sequencer.c | 52 +++++++++++++-- .../gpu/drm/amd/display/dc/core/dc_stream.c | 2 +- drivers/gpu/drm/amd/display/dc/dc_hw_types.h | 3 + .../amd/display/dc/hubp/dcn401/dcn401_hubp.c | 51 ++------------ .../amd/display/dc/hwss/dce110/dce110_hwseq.c | 2 +- .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 20 ++++-- .../amd/display/dc/hwss/dcn10/dcn10_hwseq.h | 7 +- .../amd/display/dc/hwss/dcn10/dcn10_init.c | 1 + .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 2 +- .../amd/display/dc/hwss/dcn20/dcn20_init.c | 1 + .../amd/display/dc/hwss/dcn201/dcn201_init.c | 1 + .../amd/display/dc/hwss/dcn21/dcn21_init.c | 1 + .../amd/display/dc/hwss/dcn30/dcn30_init.c | 1 + .../amd/display/dc/hwss/dcn301/dcn301_init.c | 1 + .../amd/display/dc/hwss/dcn31/dcn31_init.c | 1 + .../amd/display/dc/hwss/dcn314/dcn314_init.c | 1 + .../amd/display/dc/hwss/dcn32/dcn32_init.c | 1 + .../amd/display/dc/hwss/dcn35/dcn35_init.c | 1 + .../amd/display/dc/hwss/dcn351/dcn351_init.c | 1 + .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 66 +++++++++++++++++-- .../amd/display/dc/hwss/dcn401/dcn401_hwseq.h | 7 +- .../amd/display/dc/hwss/dcn401/dcn401_init.c | 1 + .../amd/display/dc/hwss/dcn42/dcn42_init.c | 1 + .../amd/display/dc/hwss/dcn50/dcn50_hwseq.c | 2 +- .../amd/display/dc/hwss/dcn60/dcn60_init.c | 1 + .../drm/amd/display/dc/hwss/hw_sequencer.h | 13 +++- .../display/dc/hwss/hw_sequencer_private.h | 3 + 27 files changed, 172 insertions(+), 72 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +45 -7
@@ -1304,7 +1304,8 @@ void hwss_build_fast_sequence(struct dc *dc,bool enable_cursor_offload = false;if ((dc->hwss.set_cursor_attribute && stream->update_flags.bits.cursor_attr) || - (dc->hwss.set_cursor_position && stream->update_flags.bits.cursor_pos)) + (dc->hwseq && dc->hwseq->funcs.build_cursor_position && + dc->hwss.set_cursor_position && stream->update_flags.bits.cursor_pos)) enable_cursor_offload =dc_dmub_srv_is_cursor_offload_enabled (dc);/* Cursor attribute updates - separate lock/iterate/unlock */
@@ -1390,7 +1391,8 @@ void hwss_build_fast_sequence(struct dc *dc, }/* Cursor position updates */ -if (dc->hwss.set_cursor_position && stream->update_flags.bits.cursor_pos) { +if (dc->hwseq && dc->hwseq->funcs.build_cursor_position && + dc->hwss.set_cursor_position && stream->update_flags.bits.cursor_pos) {struct pipe_ctx *cursor_pipe_to_program =NULL ;for (i =0 ; i <MAX_PIPES ; i++) {
@@ -1417,8 +1419,16 @@ void hwss_build_fast_sequence(struct dc *dc, } } +struct dc_cursor_position pos; +struct dc_cursor_mi_param param; + + dc->hwseq->funcs.build_cursor_position (current_pipe, &pos, ¶m); + block_sequence[*num_steps].params.set_cursor_position_params.dc = dc; - block_sequence[*num_steps].params.set_cursor_position_params.pipe_ctx = current_pipe; + block_sequence[*num_steps].params.set_cursor_position_params.hubp = current_pipe->plane_res.hubp; + block_sequence[*num_steps].params.set_cursor_position_params.dpp = current_pipe->plane_res.dpp; + block_sequence[*num_steps].params.set_cursor_position_params.pos = pos; + block_sequence[*num_steps].params.set_cursor_position_params.param = param; block_sequence[*num_steps].func =SET_CURSOR_POSITION ; (*num_steps)++;
@@ -4357,10 +4367,28 @@ void hwss_dpp_set_cursor_attributes(union block_sequence_params *params)void hwss_set_cursor_position (union block_sequence_params *params) {struct dc *dc = params->set_cursor_position_params.dc; -struct pipe_ctx *pipe_ctx = params->set_cursor_position_params.pipe_ctx; +struct hubp *hubp = params->set_cursor_position_params.hubp; +struct dpp *dpp = params->set_cursor_position_params.dpp; +const struct dc_cursor_position *pos = ¶ms->set_cursor_position_params.pos; +const struct dc_cursor_mi_param *param = ¶ms->set_cursor_position_params.param; +/* DCN path: SW logic ran in the builder; just invoke the BLCs */ if (dc && dc->hwss.set_cursor_position) - dc->hwss.set_cursor_position (pipe_ctx); + dc->hwss.set_cursor_position (hubp, dpp, pos, param); +} + +void hwss_program_cursor_position (struct dc *dc,struct pipe_ctx *pipe_ctx) +{ +if (dc->hwseq && dc->hwseq->funcs.build_cursor_position && dc->hwss.set_cursor_position) { +struct dc_cursor_position pos; +struct dc_cursor_mi_param param; + + dc->hwseq->funcs.build_cursor_position (pipe_ctx, &pos, ¶m); + dc->hwss.set_cursor_position (pipe_ctx->plane_res.hubp, + pipe_ctx->plane_res.dpp, &pos, ¶m); + }else if (dc->hwss.set_cursor_position_legacy) { + dc->hwss.set_cursor_position_legacy (pipe_ctx); + } }void hwss_set_cursor_sdr_white_level (union block_sequence_params *params)
@@ -5783,10 +5811,20 @@ void hwss_add_set_cursor_position(struct block_sequence_state *seq_state, struct dc *dc, struct pipe_ctx *pipe_ctx) { -if (*seq_state->num_steps <MAX_HWSS_BLOCK_SEQUENCE_SIZE ) { +if (*seq_state->num_steps <MAX_HWSS_BLOCK_SEQUENCE_SIZE && + dc->hwseq && dc->hwseq->funcs.build_cursor_position && + dc->hwss.set_cursor_position) { +struct dc_cursor_position pos; +struct dc_cursor_mi_param param; + + dc->hwseq->funcs.build_cursor_position (pipe_ctx, &pos, ¶m); + seq_state->steps[*seq_state->num_steps].func =SET_CURSOR_POSITION ; seq_state->steps[*seq_state->num_steps].params.set_cursor_position_params.dc = dc; - seq_state->steps[*seq_state->num_steps].params.set_cursor_position_params.pipe_ctx = pipe_ctx; + seq_state->steps[*seq_state->num_steps].params.set_cursor_position_params.hubp = pipe_ctx->plane_res.hubp; + seq_state->steps[*seq_state->num_steps].params.set_cursor_position_params.dpp = pipe_ctx->plane_res.dpp; + seq_state->steps[*seq_state->num_steps].params.set_cursor_position_params.pos = pos; + seq_state->steps[*seq_state->num_steps].params.set_cursor_position_params.param = param; (*seq_state->num_steps)++; } }
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +1 -1
@@ -530,7 +530,7 @@ void program_cursor_position( } } - dc->hwss.set_cursor_position (pipe_ctx); +hwss_program_cursor_position (dc, pipe_ctx);if (enable_cursor_offload && dc->hwss.update_cursor_offload_pipe) {struct pipe_ctx *top_pipe =resource_get_otg_master (pipe_ctx);
drivers/gpu/drm/amd/display/dc/dc_hw_types.h +3 -0
@@ -562,6 +562,9 @@ struct dc_cursor_mi_param {enum dc_rotation_angle rotation;bool mirror;struct dc_stream_state *stream; +int dst_x_offset; +int cur_rect_x; +int cur_rect_y; };/* IPP related types */
drivers/gpu/drm/amd/display/dc/hubp/dcn401/dcn401_hubp.c +4 -47
78 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c +1 -1
@@ -3655,7 +3655,7 @@ static const struct hw_sequencer_funcs dce110_funcs = { .edp_backlight_control = dce110_edp_backlight_control, .edp_power_control = dce110_edp_power_control, .edp_wait_for_hpd_ready = dce110_edp_wait_for_hpd_ready, - .set_cursor_position = dce110_set_cursor_position, + .set_cursor_position_legacy = dce110_set_cursor_position, .set_cursor_attribute = dce110_set_cursor_attribute, .set_backlight_level = dce110_set_backlight_level, .set_abm_immediate_disable = dce110_set_abm_immediate_disable,
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +14 -6
@@ -3176,7 +3176,7 @@ static void dcn10_update_dchubp_dpp( } dc->hwss.set_cursor_attribute (pipe_ctx); - dc->hwss.set_cursor_position (pipe_ctx); +hwss_program_cursor_position (dc, pipe_ctx);if (dc->hwss.set_cursor_sdr_white_level) dc->hwss.set_cursor_sdr_white_level (pipe_ctx);
@@ -3729,11 +3729,11 @@ void dcn10_update_dchub(struct dce_hwseq *hws, struct dchub_init_data *dh_data) hubbub->funcs->update_dchub (hubbub, dh_data); } -void dcn10_set_cursor_position (struct pipe_ctx *pipe_ctx) +void dcn10_build_cursor_position (struct pipe_ctx *pipe_ctx, +struct dc_cursor_position *pos_out, +struct dc_cursor_mi_param *param_out) {struct dc_cursor_position pos_cpy = pipe_ctx->stream->cursor_position; -struct hubp *hubp = pipe_ctx->plane_res.hubp; -struct dpp *dpp = pipe_ctx->plane_res.dpp;struct dc_cursor_mi_param param = { .pixel_clk_khz = pipe_ctx->stream->timing.pix_clk_100hz /10 , .ref_clk_khz = pipe_ctx->stream->ctx->dc->res_pool->ref_clocks.dchub_ref_clock_inKhz,
@@ -3949,8 +3949,16 @@ void dcn10_set_cursor_position(struct pipe_ctx *pipe_ctx) pipe_ctx->plane_res.scl_data.viewport.height - pos_cpy.y; } - hubp->funcs->set_cursor_position (hubp, &pos_cpy, ¶m); - dpp->funcs->set_cursor_position (dpp, &pos_cpy, ¶m, hubp->curs_attr.width, hubp->curs_attr.height); + *pos_out = pos_cpy; + *param_out = param; +} + +void dcn10_set_cursor_position (struct hubp *hubp,struct dpp *dpp, +const struct dc_cursor_position *pos, +const struct dc_cursor_mi_param *param) +{ + hubp->funcs->set_cursor_position (hubp, pos, param); + dpp->funcs->set_cursor_position (dpp, pos, param, hubp->curs_attr.width, hubp->curs_attr.height); }void dcn10_set_cursor_attribute (struct pipe_ctx *pipe_ctx)
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.h +6 -1
@@ -177,7 +177,12 @@ void dce110_edp_power_control(void dce110_edp_wait_for_hpd_ready (struct dc_link *link,bool power_up); -void dcn10_set_cursor_position (struct pipe_ctx *pipe_ctx); +void dcn10_build_cursor_position (struct pipe_ctx *pipe_ctx, +struct dc_cursor_position *pos, +struct dc_cursor_mi_param *param); +void dcn10_set_cursor_position (struct hubp *hubp,struct dpp *dpp, +const struct dc_cursor_position *pos, +const struct dc_cursor_mi_param *param);void dcn10_set_cursor_attribute (struct pipe_ctx *pipe_ctx);void dcn10_set_cursor_sdr_white_level (struct pipe_ctx *pipe_ctx); void dcn10_setup_periodic_interrupt(
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_init.c +1 -0
@@ -94,6 +94,7 @@ static const struct hw_sequencer_funcs dcn10_funcs = { };static const struct hwseq_private_funcs dcn10_private_funcs = { + .build_cursor_position = dcn10_build_cursor_position, .init_pipes = dcn10_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .program_pipe = dcn10_program_pipe,
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +1 -1
@@ -1846,7 +1846,7 @@ void dcn20_update_dchubp_dpp( } dc->hwss.set_cursor_attribute (pipe_ctx); - dc->hwss.set_cursor_position (pipe_ctx); +hwss_program_cursor_position (dc, pipe_ctx);if (dc->hwss.set_cursor_sdr_white_level) dc->hwss.set_cursor_sdr_white_level (pipe_ctx);
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_init.c +1 -0
@@ -107,6 +107,7 @@ static const struct hw_sequencer_funcs dcn20_funcs = { };static const struct hwseq_private_funcs dcn20_private_funcs = { + .build_cursor_position = dcn10_build_cursor_position, .init_pipes = dcn10_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .update_mpcc = dcn20_update_mpcc,
drivers/gpu/drm/amd/display/dc/hwss/dcn201/dcn201_init.c +1 -0
@@ -99,6 +99,7 @@ static const struct hw_sequencer_funcs dcn201_funcs = { };static const struct hwseq_private_funcs dcn201_private_funcs = { + .build_cursor_position = dcn10_build_cursor_position, .init_pipes =NULL , .plane_atomic_disconnect = dcn201_plane_atomic_disconnect, .program_pipe = dcn10_program_pipe,
drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_init.c +1 -0
@@ -110,6 +110,7 @@ static const struct hw_sequencer_funcs dcn21_funcs = { };static const struct hwseq_private_funcs dcn21_private_funcs = { + .build_cursor_position = dcn10_build_cursor_position, .init_pipes = dcn10_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .update_mpcc = dcn20_update_mpcc,
drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_init.c +1 -0
@@ -117,6 +117,7 @@ static const struct hw_sequencer_funcs dcn30_funcs = { };static const struct hwseq_private_funcs dcn30_private_funcs = { + .build_cursor_position = dcn10_build_cursor_position, .init_pipes = dcn10_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .update_mpcc = dcn20_update_mpcc,
drivers/gpu/drm/amd/display/dc/hwss/dcn301/dcn301_init.c +1 -0
@@ -113,6 +113,7 @@ static const struct hw_sequencer_funcs dcn301_funcs = { };static const struct hwseq_private_funcs dcn301_private_funcs = { + .build_cursor_position = dcn10_build_cursor_position, .init_pipes = dcn10_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .update_mpcc = dcn20_update_mpcc,
drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_init.c +1 -0
@@ -119,6 +119,7 @@ static const struct hw_sequencer_funcs dcn31_funcs = { };static const struct hwseq_private_funcs dcn31_private_funcs = { + .build_cursor_position = dcn10_build_cursor_position, .init_pipes = dcn10_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .update_mpcc = dcn20_update_mpcc,
drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_init.c +1 -0
@@ -122,6 +122,7 @@ static const struct hw_sequencer_funcs dcn314_funcs = { };static const struct hwseq_private_funcs dcn314_private_funcs = { + .build_cursor_position = dcn10_build_cursor_position, .init_pipes = dcn10_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .update_mpcc = dcn20_update_mpcc,
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_init.c +1 -0
@@ -130,6 +130,7 @@ static const struct hw_sequencer_funcs dcn32_funcs = { };static const struct hwseq_private_funcs dcn32_private_funcs = { + .build_cursor_position = dcn10_build_cursor_position, .init_pipes = dcn10_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .update_mpcc = dcn20_update_mpcc,
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_init.c +1 -0
@@ -140,6 +140,7 @@ static const struct hw_sequencer_funcs dcn35_funcs = { };static const struct hwseq_private_funcs dcn35_private_funcs = { + .build_cursor_position = dcn10_build_cursor_position, .init_pipes = dcn35_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .update_mpcc = dcn20_update_mpcc,
drivers/gpu/drm/amd/display/dc/hwss/dcn351/dcn351_init.c +1 -0
@@ -129,6 +129,7 @@ static const struct hw_sequencer_funcs dcn351_funcs = { };static const struct hwseq_private_funcs dcn351_private_funcs = { + .build_cursor_position = dcn10_build_cursor_position, .init_pipes = dcn35_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .update_mpcc = dcn20_update_mpcc,
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +62 -4
87 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.h +6 -1
@@ -55,7 +55,12 @@ void dcn401_disable_link_output(struct dc_link *link,const struct link_resource *link_res, enum signal_type signal); -void dcn401_set_cursor_position (struct pipe_ctx *pipe_ctx); +void dcn401_build_cursor_position (struct pipe_ctx *pipe_ctx, +struct dc_cursor_position *pos, +struct dc_cursor_mi_param *param); +void dcn401_set_cursor_position (struct hubp *hubp,struct dpp *dpp, +const struct dc_cursor_position *pos, +const struct dc_cursor_mi_param *param);bool dcn401_apply_idle_power_optimizations (struct dc *dc,bool enable);
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_init.c +1 -0
@@ -125,6 +125,7 @@ static const struct hw_sequencer_funcs dcn401_funcs = { };static const struct hwseq_private_funcs dcn401_private_funcs = { + .build_cursor_position = dcn401_build_cursor_position, .init_pipes = dcn10_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .plane_atomic_disconnect_sequence = dcn401_plane_atomic_disconnect_sequence,
drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_init.c +1 -0
@@ -129,6 +129,7 @@ static const struct hw_sequencer_funcs dcn42_funcs = { };static const struct hwseq_private_funcs dcn42_private_funcs = { + .build_cursor_position = dcn401_build_cursor_position, .init_pipes = dcn35_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .update_mpcc = dcn42_update_mpcc,
drivers/gpu/drm/amd/display/dc/hwss/dcn50/dcn50_hwseq.c +1 -1
@@ -212,7 +212,7 @@ void dcn50_update_dchubp_dpp( } dc->hwss.set_cursor_attribute (pipe_ctx); - dc->hwss.set_cursor_position (pipe_ctx); +hwss_program_cursor_position (dc, pipe_ctx);if (dc->hwss.set_cursor_sdr_white_level) dc->hwss.set_cursor_sdr_white_level (pipe_ctx);
drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_init.c +1 -0
@@ -128,6 +128,7 @@ static const struct hw_sequencer_funcs dcn60_funcs = { };static const struct hwseq_private_funcs dcn60_private_funcs = { + .build_cursor_position = dcn401_build_cursor_position, .init_pipes = dcn10_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .plane_atomic_disconnect_sequence = dcn401_plane_atomic_disconnect_sequence,
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +11 -2
@@ -874,7 +874,10 @@ struct dpp_set_cursor_attributes_params {struct set_cursor_position_params {struct dc *dc; -struct pipe_ctx *pipe_ctx; +struct hubp *hubp; +struct dpp *dpp; +struct dc_cursor_position pos; +struct dc_cursor_mi_param param; };struct set_cursor_sdr_white_level_params {
@@ -1539,7 +1542,11 @@ struct hw_sequencer_funcs {bool (*dmdata_status_done)(struct pipe_ctx *pipe_ctx);/* Cursor Related */ -void (*set_cursor_position)(struct pipe_ctx *pipe); +void (*set_cursor_position)(struct hubp *hubp,struct dpp *dpp, +const struct dc_cursor_position *pos, +const struct dc_cursor_mi_param *param); +/* Fallback for DCE */ +void (*set_cursor_position_legacy)(struct pipe_ctx *pipe);void (*set_cursor_attribute)(struct pipe_ctx *pipe);void (*set_cursor_sdr_white_level)(struct pipe_ctx *pipe); void (*abort_cursor_offload_update)(struct dmub_srv *dmub, struct dpp *dpp,
@@ -2152,6 +2159,8 @@ void hwss_dpp_set_cursor_attributes(union block_sequence_params *params);void hwss_set_cursor_position (union block_sequence_params *params); +void hwss_program_cursor_position (struct dc *dc,struct pipe_ctx *pipe_ctx); +void hwss_set_cursor_sdr_white_level (union block_sequence_params *params);void hwss_program_gamut_remap (struct pipe_ctx *pipe_ctx);
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer_private.h +3 -0
@@ -229,6 +229,9 @@ struct hwseq_private_funcs {void (*program_cm_hist)(struct dc *dc,struct pipe_ctx *pipe_ctx,const struct dc_plane_state *plane_state); +void (*build_cursor_position)(struct pipe_ctx *pipe_ctx, +struct dc_cursor_position *pos, +struct dc_cursor_mi_param *param); };struct dce_hwseq {
Signature · 1 line
2.55.0
PATCH 56/64 drm/amd/display: fix cursor refactor fallout and sync UT headers
In reply to George ZhangFrom: Piotr Maziarz <[email protected]>
[Why]
UT mirror headers still declared the old prototypes and hwss_gtest still called the callback directly. Separately, the divide by param.pixel_clk_khz used to sit after hubp401_cursor_set_position()'s "curs_attr.address == 0" early return; hoisting the math into the builder moved it ahead of that guard, so it now traps on streams with no timing programmed.
[How]
Guard the dst_x_offset block with "if (param.pixel_clk_khz)" Route the test through hwss_program_cursor_position().
Update dc_hwss_ut.h / dc_hwseq_ut.h and the BLS docs to the new signatures. Move the pos/param declarations to the top of the loop body.
--- .../drm/amd/display/dc/core/dc_hw_sequencer.c | 6 ++--- .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 25 +++++++++++-------- 2 files changed, 17 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +3 -3
@@ -1396,6 +1396,9 @@ void hwss_build_fast_sequence(struct dc *dc,struct pipe_ctx *cursor_pipe_to_program =NULL ;for (i =0 ; i <MAX_PIPES ; i++) { +struct dc_cursor_position pos; +struct dc_cursor_mi_param param; + current_pipe = &context->res_ctx.pipe_ctx[i]; if (current_pipe->stream != stream ||
@@ -1419,9 +1422,6 @@ void hwss_build_fast_sequence(struct dc *dc, } } -struct dc_cursor_position pos; -struct dc_cursor_mi_param param; - dc->hwseq->funcs.build_cursor_position (current_pipe, &pos, ¶m); block_sequence[*num_steps].params.set_cursor_position_params.dc = dc;
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +14 -11
@@ -1233,20 +1233,23 @@ void dcn401_build_cursor_position(struct pipe_ctx *pipe_ctx,ASSERT (!pos_cpy.enable || pos_cpy.x_hotspot ==0 ); } - dst_x_offset = x_pos_viewport - x_hot_viewport * - (1 + hubp->curs_attr.attribute_flags.bits.ENABLE_MAGNIFICATION); - dst_x_offset = (dst_x_offset >=0 ) ? dst_x_offset :0 ; - dst_x_offset *= param.ref_clk_khz; - dst_x_offset /= param.pixel_clk_khz; +/* pixel_clk_khz is 0 when no timing is programmed on the stream */ +if (param.pixel_clk_khz) { + dst_x_offset = x_pos_viewport - x_hot_viewport * + (1 + hubp->curs_attr.attribute_flags.bits.ENABLE_MAGNIFICATION); + dst_x_offset = (dst_x_offset >=0 ) ? dst_x_offset :0 ; + dst_x_offset *= param.ref_clk_khz; + dst_x_offset /= param.pixel_clk_khz; -ASSERT (param.h_scale_ratio.value); +ASSERT (param.h_scale_ratio.value); -if (param.h_scale_ratio.value) - dst_x_offset =dc_fixpt_floor (dc_fixpt_div ( -dc_fixpt_from_int (dst_x_offset), - param.h_scale_ratio)); +if (param.h_scale_ratio.value) + dst_x_offset =dc_fixpt_floor (dc_fixpt_div ( +dc_fixpt_from_int (dst_x_offset), + param.h_scale_ratio)); - param.dst_x_offset = dst_x_offset; + param.dst_x_offset = dst_x_offset; + }/* Cursor rectangle cache origin: derived from the final cursor position * minus hotspot, clamped to 0, offset by the recout origin. Precompute
Signature · 1 line
2.55.0
PATCH 57/64 drm/amd/display: clamp cursor hotspot at the register write
In reply to George ZhangFrom: Piotr Maziarz <[email protected]>
[Why]dcn401_build_cursor_position() clamped x_hotspot to 0xFF before publishing *pos_out, but that field is also stored into hubp->curs_pos and forwarded to dpp1_set_cursor_position(), which derives src_x_offset from it. The ODM/MPC slice adjustments earlier in the same function deliberately grow x_hotspot past 255 to keep the cursor visible across a slice boundary, so the clamp corrupted DPP source addressing in exactly the case it was meant to handle.
[How]
Clamp in hubp401_cursor_set_position() instead, where the 8-bit CURSOR_HOT_SPOT_X field lives. A local is used for the register write only; pos->x_hotspot passes through unmodified.
--- drivers/gpu/drm/amd/display/dc/hubp/dcn401/dcn401_hubp.c | 4 +++- drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 4 ---- 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/hubp/dcn401/dcn401_hubp.c +3 -1
@@ -818,6 +818,8 @@ void hubp401_cursor_set_position(struct dcn20_hubp *hubp2 =TO_DCN20_HUBP (hubp);int dst_x_offset = param->dst_x_offset;uint32_t cur_en = pos->enable ?1 :0 ; +/* CURSOR_HOT_SPOT_X is 8 bits wide; clamp only the register write */ +uint32_t x_hotspot_clamped = pos->x_hotspot >0xFF ?0xFF : pos->x_hotspot; hubp->curs_pos = *pos;/*
@@ -842,7 +844,7 @@ void hubp401_cursor_set_position( CURSOR_Y_POSITION, pos->y);REG_SET_2 (CURSOR_HOT_SPOT ,0 , -CURSOR_HOT_SPOT_X , pos->x_hotspot, +CURSOR_HOT_SPOT_X , x_hotspot_clamped,CURSOR_HOT_SPOT_Y , pos->y_hotspot); REG_SET(CURSOR_DST_OFFSET, 0,
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +0 -4
@@ -1264,10 +1264,6 @@ void dcn401_build_cursor_position(struct pipe_ctx *pipe_ctx, param.cur_rect_x = rec_x_offset + param.recout.x; param.cur_rect_y = rec_y_offset + param.recout.y; -/* Clamp hotspot to the CURSOR_HOT_SPOT_X register field width */ -if (pos_cpy.x_hotspot >0xFF ) - pos_cpy.x_hotspot =0xFF ; - *pos_out = pos_cpy; *param_out = param; }
Signature · 1 line
2.55.0
PATCH 58/64 drm/amd/display: Rename build_cursor_position to dcn10_build_cursor_pos_update_params
In reply to George ZhangFrom: Piotr Maziarz <[email protected]>
This commit contains renames, adding const to pipe_ctx in build_cursor_pos_update_params and also removing unnecessary checks before dc_dmub_srv_is_cursor_offload_enabled().
[Why]
It improves code clarity.
--- .../drm/amd/display/dc/core/dc_hw_sequencer.c | 19 +++++++------------ .../gpu/drm/amd/display/dc/core/dc_resource.c | 6 +++--- .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 2 +- .../amd/display/dc/hwss/dcn10/dcn10_hwseq.h | 2 +- .../amd/display/dc/hwss/dcn10/dcn10_init.c | 2 +- .../amd/display/dc/hwss/dcn20/dcn20_init.c | 2 +- .../amd/display/dc/hwss/dcn201/dcn201_init.c | 2 +- .../amd/display/dc/hwss/dcn21/dcn21_init.c | 2 +- .../amd/display/dc/hwss/dcn30/dcn30_init.c | 2 +- .../amd/display/dc/hwss/dcn301/dcn301_init.c | 2 +- .../amd/display/dc/hwss/dcn31/dcn31_init.c | 2 +- .../amd/display/dc/hwss/dcn314/dcn314_init.c | 2 +- .../amd/display/dc/hwss/dcn32/dcn32_init.c | 2 +- .../amd/display/dc/hwss/dcn35/dcn35_init.c | 2 +- .../amd/display/dc/hwss/dcn351/dcn351_init.c | 2 +- .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 2 +- .../amd/display/dc/hwss/dcn401/dcn401_hwseq.h | 2 +- .../amd/display/dc/hwss/dcn401/dcn401_init.c | 2 +- .../amd/display/dc/hwss/dcn42/dcn42_init.c | 2 +- .../amd/display/dc/hwss/dcn60/dcn60_init.c | 2 +- .../display/dc/hwss/hw_sequencer_private.h | 2 +- drivers/gpu/drm/amd/display/dc/inc/resource.h | 2 +- 22 files changed, 30 insertions(+), 35 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +7 -12
@@ -1301,12 +1301,7 @@ void hwss_build_fast_sequence(struct dc *dc, }/* Track cursor lock state - separate locks for attribute and position updates */ -bool enable_cursor_offload = false; - -if ((dc->hwss.set_cursor_attribute && stream->update_flags.bits.cursor_attr) || - (dc->hwseq && dc->hwseq->funcs.build_cursor_position && - dc->hwss.set_cursor_position && stream->update_flags.bits.cursor_pos)) - enable_cursor_offload =dc_dmub_srv_is_cursor_offload_enabled (dc); +bool enable_cursor_offload =dc_dmub_srv_is_cursor_offload_enabled (dc);/* Cursor attribute updates - separate lock/iterate/unlock */ if (dc->hwss.set_cursor_attribute && stream->update_flags.bits.cursor_attr) {
@@ -1391,7 +1386,7 @@ void hwss_build_fast_sequence(struct dc *dc, }/* Cursor position updates */ -if (dc->hwseq && dc->hwseq->funcs.build_cursor_position && +if (dc->hwseq && dc->hwseq->funcs.build_cursor_pos_update_params && dc->hwss.set_cursor_position && stream->update_flags.bits.cursor_pos) {struct pipe_ctx *cursor_pipe_to_program =NULL ;
@@ -1422,7 +1417,7 @@ void hwss_build_fast_sequence(struct dc *dc, } } - dc->hwseq->funcs.build_cursor_position (current_pipe, &pos, ¶m); + dc->hwseq->funcs.build_cursor_pos_update_params (current_pipe, &pos, ¶m); block_sequence[*num_steps].params.set_cursor_position_params.dc = dc; block_sequence[*num_steps].params.set_cursor_position_params.hubp = current_pipe->plane_res.hubp;
@@ -4379,11 +4374,11 @@ void hwss_set_cursor_position(union block_sequence_params *params)void hwss_program_cursor_position (struct dc *dc,struct pipe_ctx *pipe_ctx) { -if (dc->hwseq && dc->hwseq->funcs.build_cursor_position && dc->hwss.set_cursor_position) { +if (dc->hwseq && dc->hwseq->funcs.build_cursor_pos_update_params && dc->hwss.set_cursor_position) {struct dc_cursor_position pos;struct dc_cursor_mi_param param; - dc->hwseq->funcs.build_cursor_position (pipe_ctx, &pos, ¶m); + dc->hwseq->funcs.build_cursor_pos_update_params (pipe_ctx, &pos, ¶m); dc->hwss.set_cursor_position (pipe_ctx->plane_res.hubp, pipe_ctx->plane_res.dpp, &pos, ¶m); }else if (dc->hwss.set_cursor_position_legacy) {
@@ -5812,12 +5807,12 @@ void hwss_add_set_cursor_position(struct block_sequence_state *seq_state, struct pipe_ctx *pipe_ctx) {if (*seq_state->num_steps <MAX_HWSS_BLOCK_SEQUENCE_SIZE && - dc->hwseq && dc->hwseq->funcs.build_cursor_position && + dc->hwseq && dc->hwseq->funcs.build_cursor_pos_update_params && dc->hwss.set_cursor_position) {struct dc_cursor_position pos;struct dc_cursor_mi_param param; - dc->hwseq->funcs.build_cursor_position (pipe_ctx, &pos, ¶m); + dc->hwseq->funcs.build_cursor_pos_update_params (pipe_ctx, &pos, ¶m); seq_state->steps[*seq_state->num_steps].func =SET_CURSOR_POSITION ; seq_state->steps[*seq_state->num_steps].params.set_cursor_position_params.dc = dc;
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +3 -3
@@ -1049,7 +1049,7 @@ static struct rect calculate_mpc_slice_in_timing_active(return mpc_rec; } -static void calculate_adjust_recout_for_visual_confirm (struct pipe_ctx *pipe_ctx, +static void calculate_adjust_recout_for_visual_confirm (const struct pipe_ctx *pipe_ctx,unsigned int *base_offset,unsigned int *dpp_offset) {struct dc *dc = pipe_ctx->stream->ctx->dc;
@@ -1070,7 +1070,7 @@ static void calculate_adjust_recout_for_visual_confirm(struct pipe_ctx *pipe_ctx }static void reverse_adjust_recout_for_visual_confirm (struct rect *recout, -struct pipe_ctx *pipe_ctx) +const struct pipe_ctx *pipe_ctx) {unsigned int dpp_offset, base_offset;
@@ -1775,7 +1775,7 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx)return res; } -bool resource_can_pipe_disable_cursor (struct pipe_ctx *pipe_ctx) +bool resource_can_pipe_disable_cursor (const struct pipe_ctx *pipe_ctx) {struct pipe_ctx *test_pipe, *split_pipe;struct rect r1 = pipe_ctx->plane_res.scl_data.recout;
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +1 -1
@@ -3729,7 +3729,7 @@ void dcn10_update_dchub(struct dce_hwseq *hws, struct dchub_init_data *dh_data) hubbub->funcs->update_dchub (hubbub, dh_data); } -void dcn10_build_cursor_position (struct pipe_ctx *pipe_ctx, +void dcn10_build_cursor_pos_update_params (const struct pipe_ctx *pipe_ctx,struct dc_cursor_position *pos_out,struct dc_cursor_mi_param *param_out) {
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.h +1 -1
@@ -177,7 +177,7 @@ void dce110_edp_power_control(void dce110_edp_wait_for_hpd_ready (struct dc_link *link,bool power_up); -void dcn10_build_cursor_position (struct pipe_ctx *pipe_ctx, +void dcn10_build_cursor_pos_update_params (const struct pipe_ctx *pipe_ctx,struct dc_cursor_position *pos,struct dc_cursor_mi_param *param); void dcn10_set_cursor_position(struct hubp *hubp, struct dpp *dpp,
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_init.c +1 -1
@@ -94,7 +94,7 @@ static const struct hw_sequencer_funcs dcn10_funcs = { };static const struct hwseq_private_funcs dcn10_private_funcs = { - .build_cursor_position = dcn10_build_cursor_position, + .build_cursor_pos_update_params = dcn10_build_cursor_pos_update_params, .init_pipes = dcn10_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .program_pipe = dcn10_program_pipe,
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_init.c +1 -1
@@ -107,7 +107,7 @@ static const struct hw_sequencer_funcs dcn20_funcs = { };static const struct hwseq_private_funcs dcn20_private_funcs = { - .build_cursor_position = dcn10_build_cursor_position, + .build_cursor_pos_update_params = dcn10_build_cursor_pos_update_params, .init_pipes = dcn10_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .update_mpcc = dcn20_update_mpcc,
drivers/gpu/drm/amd/display/dc/hwss/dcn201/dcn201_init.c +1 -1
@@ -99,7 +99,7 @@ static const struct hw_sequencer_funcs dcn201_funcs = { };static const struct hwseq_private_funcs dcn201_private_funcs = { - .build_cursor_position = dcn10_build_cursor_position, + .build_cursor_pos_update_params = dcn10_build_cursor_pos_update_params, .init_pipes =NULL , .plane_atomic_disconnect = dcn201_plane_atomic_disconnect, .program_pipe = dcn10_program_pipe,
drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_init.c +1 -1
@@ -110,7 +110,7 @@ static const struct hw_sequencer_funcs dcn21_funcs = { };static const struct hwseq_private_funcs dcn21_private_funcs = { - .build_cursor_position = dcn10_build_cursor_position, + .build_cursor_pos_update_params = dcn10_build_cursor_pos_update_params, .init_pipes = dcn10_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .update_mpcc = dcn20_update_mpcc,
drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_init.c +1 -1
@@ -117,7 +117,7 @@ static const struct hw_sequencer_funcs dcn30_funcs = { };static const struct hwseq_private_funcs dcn30_private_funcs = { - .build_cursor_position = dcn10_build_cursor_position, + .build_cursor_pos_update_params = dcn10_build_cursor_pos_update_params, .init_pipes = dcn10_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .update_mpcc = dcn20_update_mpcc,
drivers/gpu/drm/amd/display/dc/hwss/dcn301/dcn301_init.c +1 -1
@@ -113,7 +113,7 @@ static const struct hw_sequencer_funcs dcn301_funcs = { };static const struct hwseq_private_funcs dcn301_private_funcs = { - .build_cursor_position = dcn10_build_cursor_position, + .build_cursor_pos_update_params = dcn10_build_cursor_pos_update_params, .init_pipes = dcn10_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .update_mpcc = dcn20_update_mpcc,
drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_init.c +1 -1
@@ -119,7 +119,7 @@ static const struct hw_sequencer_funcs dcn31_funcs = { };static const struct hwseq_private_funcs dcn31_private_funcs = { - .build_cursor_position = dcn10_build_cursor_position, + .build_cursor_pos_update_params = dcn10_build_cursor_pos_update_params, .init_pipes = dcn10_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .update_mpcc = dcn20_update_mpcc,
drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_init.c +1 -1
@@ -122,7 +122,7 @@ static const struct hw_sequencer_funcs dcn314_funcs = { };static const struct hwseq_private_funcs dcn314_private_funcs = { - .build_cursor_position = dcn10_build_cursor_position, + .build_cursor_pos_update_params = dcn10_build_cursor_pos_update_params, .init_pipes = dcn10_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .update_mpcc = dcn20_update_mpcc,
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_init.c +1 -1
@@ -130,7 +130,7 @@ static const struct hw_sequencer_funcs dcn32_funcs = { };static const struct hwseq_private_funcs dcn32_private_funcs = { - .build_cursor_position = dcn10_build_cursor_position, + .build_cursor_pos_update_params = dcn10_build_cursor_pos_update_params, .init_pipes = dcn10_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .update_mpcc = dcn20_update_mpcc,
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_init.c +1 -1
@@ -140,7 +140,7 @@ static const struct hw_sequencer_funcs dcn35_funcs = { };static const struct hwseq_private_funcs dcn35_private_funcs = { - .build_cursor_position = dcn10_build_cursor_position, + .build_cursor_pos_update_params = dcn10_build_cursor_pos_update_params, .init_pipes = dcn35_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .update_mpcc = dcn20_update_mpcc,
drivers/gpu/drm/amd/display/dc/hwss/dcn351/dcn351_init.c +1 -1
@@ -129,7 +129,7 @@ static const struct hw_sequencer_funcs dcn351_funcs = { };static const struct hwseq_private_funcs dcn351_private_funcs = { - .build_cursor_position = dcn10_build_cursor_position, + .build_cursor_pos_update_params = dcn10_build_cursor_pos_update_params, .init_pipes = dcn35_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .update_mpcc = dcn20_update_mpcc,
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +1 -1
@@ -1045,7 +1045,7 @@ void dcn401_disable_link_output(struct dc_link *link, dc->link_srv->dp_trace_source_sequence (link,DPCD_SOURCE_SEQ_AFTER_DISABLE_LINK_PHY ); } -void dcn401_build_cursor_position (struct pipe_ctx *pipe_ctx, +void dcn401_build_cursor_pos_update_params (const struct pipe_ctx *pipe_ctx,struct dc_cursor_position *pos_out,struct dc_cursor_mi_param *param_out) {
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.h +1 -1
@@ -55,7 +55,7 @@ void dcn401_disable_link_output(struct dc_link *link,const struct link_resource *link_res, enum signal_type signal); -void dcn401_build_cursor_position (struct pipe_ctx *pipe_ctx, +void dcn401_build_cursor_pos_update_params (const struct pipe_ctx *pipe_ctx,struct dc_cursor_position *pos,struct dc_cursor_mi_param *param); void dcn401_set_cursor_position(struct hubp *hubp, struct dpp *dpp,
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_init.c +1 -1
@@ -125,7 +125,7 @@ static const struct hw_sequencer_funcs dcn401_funcs = { };static const struct hwseq_private_funcs dcn401_private_funcs = { - .build_cursor_position = dcn401_build_cursor_position, + .build_cursor_pos_update_params = dcn401_build_cursor_pos_update_params, .init_pipes = dcn10_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .plane_atomic_disconnect_sequence = dcn401_plane_atomic_disconnect_sequence,
drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_init.c +1 -1
@@ -129,7 +129,7 @@ static const struct hw_sequencer_funcs dcn42_funcs = { };static const struct hwseq_private_funcs dcn42_private_funcs = { - .build_cursor_position = dcn401_build_cursor_position, + .build_cursor_pos_update_params = dcn401_build_cursor_pos_update_params, .init_pipes = dcn35_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .update_mpcc = dcn42_update_mpcc,
drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_init.c +1 -1
@@ -128,7 +128,7 @@ static const struct hw_sequencer_funcs dcn60_funcs = { };static const struct hwseq_private_funcs dcn60_private_funcs = { - .build_cursor_position = dcn401_build_cursor_position, + .build_cursor_pos_update_params = dcn401_build_cursor_pos_update_params, .init_pipes = dcn10_init_pipes, .plane_atomic_disconnect = dcn10_plane_atomic_disconnect, .plane_atomic_disconnect_sequence = dcn401_plane_atomic_disconnect_sequence,
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer_private.h +1 -1
@@ -229,7 +229,7 @@ struct hwseq_private_funcs {void (*program_cm_hist)(struct dc *dc,struct pipe_ctx *pipe_ctx,const struct dc_plane_state *plane_state); -void (*build_cursor_position)(struct pipe_ctx *pipe_ctx, +void (*build_cursor_pos_update_params)(const struct pipe_ctx *pipe_ctx,struct dc_cursor_position *pos,struct dc_cursor_mi_param *param); };
drivers/gpu/drm/amd/display/dc/inc/resource.h +1 -1
@@ -172,7 +172,7 @@ bool resource_attach_surfaces_to_context(struct dc_state *context, const struct resource_pool *pool); -bool resource_can_pipe_disable_cursor (struct pipe_ctx *pipe_ctx); +bool resource_can_pipe_disable_cursor (const struct pipe_ctx *pipe_ctx);#define FREE_PIPE_INDEX_NOT_FOUND -1
Signature · 1 line
2.55.0
PATCH 59/64 drm/amd/display: Remove DCN6 DCFCLK num assert
In reply to George ZhangFrom: Ivan Lipski <[email protected]>
[Why&How]
There can be more than 2 DCFCLK values for DCN6, so the assert is not applicable.
Remove it.
--- .../dc/dml2_0/dml21/src/dml2_utm_soc_bb/dml2_utm_soc_bb_dcn6.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_utm_soc_bb/dml2_utm_soc_bb_dcn6.c +0 -2
@@ -288,8 +288,6 @@ static void dcn6_copy_utm_qos_model(struct utm_qos_model *dest, struct utm_qos_mstatic void dcn6_initialize_from_soc_bb (struct dml2_utm_soc_bb *utm_soc_bb,const struct dml2_soc_bb *soc_bb) { -DML_ASSERT_MSG (soc_bb->clk_table.dcfclk.num_clk_values ==2 ,"soc_bb must provide min and max dcfclk values!\n" ); -/* initialize based on soc bb */ utm_soc_bb->max_dispclk_khz = soc_bb->clk_table.dispclk.clk_values_khz[soc_bb->clk_table.dispclk.num_clk_values -1 ]; utm_soc_bb->max_dppclk_khz = soc_bb->clk_table.dppclk.clk_values_khz[soc_bb->clk_table.dppclk.num_clk_values -1 ];
Signature · 1 line
2.55.0
PATCH 60/64 drm/amd/display: Resync cursor cache after offload abort on DCN60
In reply to George ZhangFrom: Ivan Lipski <[email protected]>
[Why&How]
The cursor programming path caches the last-written cursor state in SW and, for the enable bit, skips the register write when the cache already matches the request. Under cursor offload the SW cache is updated even though the actual register write is deferred to firmware. When an offloaded cursor update is aborted (e.g. an overlay geometry change reprograms the cursor directly in the same frame), the queued firmware write is dropped but the cache is left stale, so the following direct programming pass skips the enable write and the cursor disappears over the overlay plane.
Add a refresh_cursor_state() hubp/dpp hook that reads the cursor position and attribute registers back from hardware into the SW cache, and call it from dcn35_abort_cursor_offload_update() so the cache is truthful after an abort. This keeps the enable-change optimization intact for all ASICs and is race-robust regardless of whether firmware applied the queued write before the abort. Only dcn60 (the sole offload user) wires up the hook.
--- .../amd/display/dc/dpp/dcn401/dcn401_dpp.h | 2 + .../amd/display/dc/dpp/dcn401/dcn401_dpp_cm.c | 19 +++++++ .../drm/amd/display/dc/dpp/dcn60/dcn60_dpp.c | 1 + .../amd/display/dc/hubp/dcn401/dcn401_hubp.c | 54 +++++++++++++++++++ .../amd/display/dc/hubp/dcn401/dcn401_hubp.h | 2 + .../amd/display/dc/hubp/dcn60/dcn60_hubp.c | 1 + .../amd/display/dc/hwss/dcn35/dcn35_hwseq.c | 11 ++++ drivers/gpu/drm/amd/display/dc/inc/hw/dpp.h | 2 + drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h | 2 + 9 files changed, 94 insertions(+)
drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp.h +2 -0
@@ -725,6 +725,8 @@ void dpp401_set_cursor_position(uint32_t width, uint32_t height); +void dpp401_cursor_refresh_state (struct dpp *dpp_base); +void dpp401_set_optional_cursor_attributes (struct dpp *dpp_base,struct dpp_cursor_attributes *attr);
drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp_cm.c +19 -0
@@ -144,6 +144,25 @@ void dpp401_set_cursor_position( dpp_base->att.cur0_ctl.bits.cur0_enable = cur_en; } +/* Resync the SW cursor cache from real hardware state. */ +void dpp401_cursor_refresh_state (struct dpp *dpp_base) +{ +struct dcn401_dpp *dpp =TO_DCN401_DPP (dpp_base); +uint32_t cur0_enable =0 , mode =0 , expansion_mode =0 , rom_en =0 ; + +REG_GET_4 (CURSOR0_CONTROL , +CUR0_ENABLE , &cur0_enable, +CUR0_MODE , &mode, +CUR0_EXPANSION_MODE , &expansion_mode, +CUR0_ROM_EN , &rom_en); + + dpp_base->pos.cur0_ctl.bits.cur0_enable = cur0_enable; + dpp_base->att.cur0_ctl.bits.cur0_enable = cur0_enable; + dpp_base->att.cur0_ctl.bits.mode = mode; + dpp_base->att.cur0_ctl.bits.expansion_mode = expansion_mode; + dpp_base->att.cur0_ctl.bits.cur0_rom_en = rom_en; +} +void dpp401_set_optional_cursor_attributes (struct dpp *dpp_base,struct dpp_cursor_attributes *attr)
drivers/gpu/drm/amd/display/dc/dpp/dcn60/dcn60_dpp.c +1 -0
@@ -308,6 +308,7 @@ static struct dpp_funcs dcn60_dpp_funcs = { .dpp_cnv_set_alpha_keyer = dpp2_cnv_set_alpha_keyer, .set_cursor_attributes = dpp401_set_cursor_attributes, .set_cursor_position = dpp401_set_cursor_position, + .refresh_cursor_state = dpp401_cursor_refresh_state, .set_optional_cursor_attributes = dpp401_set_optional_cursor_attributes, .dpp_dppclk_control = dpp1_dppclk_control, .dpp_set_hdr_multiplier = dpp3_set_hdr_multiplier,
drivers/gpu/drm/amd/display/dc/hubp/dcn401/dcn401_hubp.c +54 -0
60 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/hubp/dcn401/dcn401_hubp.h +2 -0
@@ -313,6 +313,8 @@ void hubp401_cursor_set_position(const struct dc_cursor_position *pos, const struct dc_cursor_mi_param *param); +void hubp401_cursor_refresh_state (struct hubp *hubp); +void hubp401_read_state (struct hubp *hubp); bool hubp401_construct(
drivers/gpu/drm/amd/display/dc/hubp/dcn60/dcn60_hubp.c +1 -0
@@ -427,6 +427,7 @@ static struct hubp_funcs dcn60_hubp_funcs = { .mem_program_viewport = hubp401_set_viewport, .set_cursor_attributes = hubp60_cursor_set_attributes, .set_cursor_position = hubp401_cursor_set_position, + .refresh_cursor_state = hubp401_cursor_refresh_state, .hubp_clk_cntl = hubp2_clk_cntl, .hubp_vtg_sel = hubp2_vtg_sel, .dmdata_set_attributes = hubp3_dmdata_set_attributes,
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c +11 -0
@@ -1671,6 +1671,17 @@ void dcn35_abort_cursor_offload_update(struct dmub_srv *dmub, struct dpp *dpp, sif (dc->hwss.commit_cursor_offload_update) dc->hwss.commit_cursor_offload_update (dmub, dpp, hubp, stream_idx); + +/* +* The aborted payload is dropped by firmware, so resync the SW cursor +* cache from real hardware state. This lets the next direct +* set_cursor_position re-program CURSOR_ENABLE instead of skipping it +* because of a stale cache. +*/ +if (dpp->funcs->refresh_cursor_state) + dpp->funcs->refresh_cursor_state (dpp); +if (hubp && hubp->funcs->refresh_cursor_state) + hubp->funcs->refresh_cursor_state (hubp); }void dcn35_begin_cursor_offload_update (struct dmub_srv *dmub,struct dpp *dpp,struct hubp *hubp,uint32_t stream_idx)
drivers/gpu/drm/amd/display/dc/inc/hw/dpp.h +2 -0
@@ -330,6 +330,8 @@ struct dpp_funcs {uint32_t height ); +void (*refresh_cursor_state)(struct dpp *dpp_base); +void (*dpp_set_hdr_multiplier)(struct dpp *dpp_base,uint32_t multiplier);
drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h +2 -0
@@ -219,6 +219,8 @@ struct hubp_funcs {const struct dc_cursor_position *pos, const struct dc_cursor_mi_param *param); +void (*refresh_cursor_state)(struct hubp *hubp); +void (*hubp_disconnect)(struct hubp *hubp);void (*hubp_clk_cntl)(struct hubp *hubp,bool enable);
Signature · 1 line
2.55.0
PATCH 61/64 drm/amd/display: Revert "request DMUB HW cursor offload"
In reply to George ZhangFrom: Tony Qi <[email protected]>
This reverts commit 6624a33b3807 ("Request DMUB HW cursor offload).
[WHY]
This commit causes the following failures on DCN42:
igt@kms_plane_cursor@viewport
igt@kms_plane_cursor@overlay
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 ---------- drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 9 +-------- 2 files changed, 1 insertion(+), 18 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -10
@@ -606,13 +606,6 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) init_data.flags.enable_mipi_converter_optimization = true; -/* -* Request HW cursor offload so DMUB programs the cursor; cursor -* updates then avoid the DMUB inbox0 HW lock during mclk switches. -* dc_dmub_srv_cursor_offload_init() self-gates on FW capability. -*/ - init_data.flags.enable_cursor_offload = true; - init_data.dcn_reg_offsets = adev->reg_offset[DCE_HWIP ][0 ]; init_data.nbio_reg_offsets = adev->reg_offset[NBIO_HWIP ][0 ]; init_data.clk_reg_offsets = adev->reg_offset[CLK_HWIP ][0 ];
@@ -730,9 +723,6 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)dc_hardware_init (adev->dm.dc); -/* Enable cursor offload if the DMUB firmware supports it. */ -dc_dmub_srv_cursor_offload_init (adev->dm.dc); -/* GOP/vBIOS may leave an OPTC enabled for a display present at power-on * but no longer driven (e.g. an external DP unplugged at boot). Such a * dangling pipe keeps DCN out of idle and blocks s0i3. Power it down
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c +1 -8
@@ -1250,16 +1250,9 @@ void dc_dmub_srv_subvp_save_surf_addr(const struct dc_dmub_srv *dc_dmub_srv, convoid dc_dmub_srv_cursor_offload_init (struct dc *dc) {struct dmub_rb_cmd_cursor_offload_init *init; -struct dc_dmub_srv *dc_dmub_srv; +struct dc_dmub_srv *dc_dmub_srv = dc->ctx->dmub_srv;union dmub_rb_cmd cmd; -if (!dc || !dc->ctx) -return ; - - dc_dmub_srv = dc->ctx->dmub_srv; -if (!dc_dmub_srv || !dc_dmub_srv->dmub) -return ; -if (!dc->config.enable_cursor_offload)return ;
Signature · 1 line
2.55.0
PATCH 62/64 drm/amd/display: Fix LSDMA divide by zero
In reply to George ZhangFrom: Alex Hung <[email protected]>
[WHY]element_size_to_bytes_per_pixel() handled only element sizes 0 to 4 and returned 0 for every other value, and an unexpected element size caused a divide by zero.
[HOW]
Derive the size as 1 << element_size, which matches the existing encoding, and fall back to 1 for values of 8 or more to keep the result nonzero.
--- .../alternate_pstate_shared_lib.c | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_standalone_libraries/alternate_pstate_shared_lib.c +1 -21
@@ -884,27 +884,7 @@ static void populate_lsdma_start_end_lines(static uint8_t element_size_to_bytes_per_pixel (uint8_t element_size) { -uint8_t bytes_per_pixel =0 ; - -switch (element_size) {// 0: 8bpp, 1: 16bpp, 2: 32bpp, 3: 64bpp, 4: 128bpp - Values supported by LSDMA Controller -case 0 : - bytes_per_pixel =1 ; -break ; -case 1 : - bytes_per_pixel =2 ; -break ; -case 2 : - bytes_per_pixel =4 ; -break ; -case 3 : - bytes_per_pixel =8 ; -break ; -case 4 : - bytes_per_pixel =16 ; -break ; - } - -return bytes_per_pixel; +return element_size <8 ? (uint8_t )(1U << element_size) :1 ; } static void populate_lsdma(
Signature · 1 line
2.55.0
PATCH 63/64 drm/amd/display: [FW Promotion] Release 0.1.76.0
In reply to George ZhangFrom: Taimur Hassan <[email protected]>
Updated DMUB interface
- Add OEM visual debug flags
- Updated HW lock pending error
- Add new DMUB_CMD__NBIF_AZ_PME_RESTORE command
--- .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 50 ++++++++++++++++++- 1 file changed, 48 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +48 -2
@@ -582,7 +582,14 @@ union replay_debug_flags {*/ uint32_t enable_sub_feature_visual_confirm : 1; - uint32_t reserved : 16; +/** +* 0x10000 (bit 16) +* @enable_oem_visual_confirm: Enable OEM visual confirm +* Black = state 0, Blue = state non-zero, Green = frame skipping active +*/ + uint32_t enable_oem_visual_confirm : 1; + + uint32_t reserved : 15; } bitfields;uint32_t u32All;
@@ -743,7 +750,14 @@ union pr_debug_flags {*/ uint32_t force_hubp_on : 1; - uint32_t reserved : 24; +/** +* 0x100 (bit 8) +* @enable_oem_visual_confirm: Enable OEM visual confirm +* Black = state 0, Blue = state non-zero +*/ + uint32_t enable_oem_visual_confirm : 1; + + uint32_t reserved : 23; } bitfields;uint32_t u32All;
@@ -2048,6 +2062,11 @@ enum dmub_cmd_type {*/ DMUB_CMD__DC_BLS =98 , +/** +* Command type used to notify nbif az pme restore. +*/ + DMUB_CMD__NBIF_AZ_PME_RESTORE = 99, +/** * Command type use for VBIOS shared commands. */
@@ -3637,6 +3656,28 @@ struct dmub_rb_cmd_query_hpd_state {struct dmub_cmd_hpd_state_query_data data; }; +/** +* Data passed from driver to FW in a DMUB_CMD__NBIF_AZ_PME_RESTORE command. +*/ +struct dmub_cmd_nbif_az_pme_restore_data { +uint8_t az_inst;/**< Azalia codec endpoint instance */ +uint8_t pad[3 ];/**< Alignment */ +}; + +/** +* Definition of a DMUB_CMD__NBIF_AZ_PME_RESTORE command. +*/ +struct dmub_rb_cmd_nbif_az_pme_restore { +/** +* Command header. +*/ +struct dmub_cmd_header header; +/** +* Data passed from driver to FW in a DMUB_CMD__NBIF_AZ_PME_RESTORE command. +*/ +struct dmub_cmd_nbif_az_pme_restore_data data; +}; +/** * struct dmub_rb_cmd_hpd_sense_notify - HPD sense notification data. */
@@ -7878,6 +7919,11 @@ union dmub_rb_cmd {* Definition of a DMUB_CMD__QUERY_HPD_STATE command. */ struct dmub_rb_cmd_query_hpd_state query_hpd; + +/** +* Definition of a DMUB_CMD__NBIF_AZ_PME_RESTORE command. +*/ +struct dmub_rb_cmd_nbif_az_pme_restore nbif_az_pme_restore;/** * Definition of a DMUB_CMD__SECURE_DISPLAY command. */
Signature · 1 line
2.55.0
PATCH 64/64 drm/amd/display: Promote DC to 3.2.399
In reply to George ZhangFrom: Taimur Hassan <[email protected]>
This DC patchset brings improvements in multiple areas. In summary, we have:
- Increased KUnit coverage
- Reverts a patch causing regression on DCN42
- Fixes for cursor
- Imporvements for ABM
--- 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
@@ -67,7 +67,7 @@ struct dcn_dsc_reg_state;struct dcn_optc_reg_state ;struct dcn_dccg_reg_state ; -#define DC_VER "3.2.398" +#define DC_VER "3.2.399"/** * MAX_SURFACES - representative of the upper bound of surfaces that can be piped to a single CRTC
Signature · 1 line
2.55.0
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 -> c9c3b6a85b346a8aba4b4009c2cd66a37e6bc0b9 -> drm/amdgpu/sdma: Fix executing duplicate commands after recovery on SDMA v4.4.2) 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: Zhang, George <[email protected]>
Sent: Wednesday, September 16, 2026 1:51 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]>; Zhang, George <[email protected]>
Subject: [PATCH 00/64] DC Patches for September 16, 2026
This DC patchset brings improvements in multiple areas. In summary, we have:
- Increased KUnit coverage
- Reverts a patch causing regression on DCN42
- Fixes for cursor
- Imporvements for ABM
Alex Hung (33):
drm/amd/display: Select KUnit helpers drm/amd/display: Fold blending tests into two cases drm/amd/display: Fold universal overlay format test drm/amd/display: Fold plane modifier list tests drm/amd/display: Fold modifier append tests drm/amd/display: Fold GFX9 tiling info tests drm/amd/display: Fold GFX6-8 tiling and modifier tests drm/amd/display: Fold DCC validation tests drm/amd/display: Fold DCC block mode tests drm/amd/display: Fold plane scaling and cursor tests drm/amd/display: Fold plane state check tests drm/amd/display: Fix amdgpu_dm's kernel-doc warnings drm/amd/display: Test EDID helper paths drm/amd/display: Test AUX transfer paths drm/amd/display: Test MST topology start drm/amd/display: Test unassigned OTG CRTC lookup drm/amd/display: Test VRR pageflip completion drm/amd/display: Test HPD RX offload work branches drm/amd/display: Test HDMI HPD debounce re-detect drm/amd/display: Test HPD handler HDCP and detect drm/amd/display: Test HPD RX downstream handling drm/amd/display: Drop redundant amdgpu_dm_irq tests drm/amd/display: Fix KUnit connector warnings drm/amd/display: Fix KUnit CRTC warnings drm/amd/display: Fix KUnit cursor warning drm/amd/display: Fix KUnit VRR warnings drm/amd/display: Fix KUnit helper warnings drm/amd/display: Fix KUnit IRQ warnings drm/amd/display: Fix KUnit MST warnings drm/amd/display: Fix KUnit DM warnings drm/amd/display: Fix KUnit writeback warnings drm/amd/display: Fix KUnit checkpatch warnings drm/amd/display: Fix LSDMA divide by zero
Alvin Lee (3):
drm/amd/display: Enable double buffering for DSCCLK updates drm/amd/display: Wait response should be based on fw_based_mclk_switch drm/amd/display: Re-enable P-State message to SMU
Austin Zheng (1):
drm/amd/display: Add Back Unified CalculateFlipSchedule
Dillon Varone (1):
drm/amd/display: Add more diagnostic logs for DMU
Fangzhi Zuo (1):
drm/amd/display: Restore FreeSync VCP code check for HDMI/PCON sinks
Huang, Leon (1):
drm/amd/display: Forward periodic ABM keep-alive scenario to DMU
Ivan Lipski (3):
drm/amd/display: Expose 3 overlay planes on DCN6 drm/amd/display: Remove DCN6 DCFCLK num assert drm/amd/display: Resync cursor cache after offload abort on DCN60
Matthew Stewart (1):
drm/amd/display: Fix DCN42B plane alpha
Nicholas Kazlauskas (1):
drm/amd/display: Fix missing gaps for link lock with inbox0
Piotr Maziarz (5):
drm/amd/display: Refactor DPP_PROGRAM_UPSP to drop pipe_ctx drm/amd/display: Remove phantom SW state ops from block sequence drm/amd/display: fix cursor refactor fallout and sync UT headers drm/amd/display: clamp cursor hotspot at the register write drm/amd/display: Rename build_cursor_position to
dcn10_build_cursor_pos_update_params
Rafal Ostrowski (2):
drm/amd/display: Drop pipe_ctx from hwss block sequence operations drm/amd/display: refactor hwss SET_CURSOR_POSITION block sequence
Taimur Hassan (2):
drm/amd/display: [FW Promotion] Release 0.1.76.0 drm/amd/display: Promote DC to 3.2.399
Tony Cheng (9):
drm/amd/display: add SPDX-License-Identifier drm/amd/display: Add inst field to struct hubbub drm/amd/display: Add inst field to struct clk_mgr drm/amd/display: Add inst field to struct abm drm/amd/display: Add inst field to struct dmub_psr drm/amd/display: Add inst field to struct dmub_replay drm/amd/display: Add inst field to struct pg_cntl drm/amd/display: Add inst field to encoder structs drm/amd/display: Add inst field to clock_source and dio
Tony Qi (1):
drm/amd/display: Revert "request DMUB HW cursor offload"
drivers/gpu/drm/amd/display/Kconfig | 3 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 - .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 7 +- .../display/amdgpu_dm/amdgpu_dm_connector.c | 6 + .../drm/amd/display/amdgpu_dm/amdgpu_dm_irq.h | 9 + .../display/amdgpu_dm/amdgpu_dm_mst_types.h | 2 +- .../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 1 + .../amd/display/amdgpu_dm/tests/.kunitconfig | 1 - .../tests/amdgpu_dm_connector_test.c | 64 +- .../amdgpu_dm/tests/amdgpu_dm_crtc_test.c | 50 +- .../amdgpu_dm/tests/amdgpu_dm_cursor_test.c | 4 + .../amdgpu_dm/tests/amdgpu_dm_freesync_test.c | 22 + .../amdgpu_dm/tests/amdgpu_dm_helpers_test.c | 250 ++ .../amdgpu_dm/tests/amdgpu_dm_irq_test.c | 1066 +++++---- .../tests/amdgpu_dm_mst_types_test.c | 9 + .../amdgpu_dm/tests/amdgpu_dm_plane_test.c | 2036 +++++------------ .../amdgpu_dm/tests/amdgpu_dm_services_test.c | 2 +- .../display/amdgpu_dm/tests/amdgpu_dm_test.c | 43 +- .../amdgpu_dm/tests/amdgpu_dm_wb_test.c | 4 + .../dc/clk_mgr/dcn401/dcn401_clk_mgr.c | 1 + .../display/dc/clk_mgr/dcn42/dcn42_clk_mgr.c | 7 +- .../dc/clk_mgr/dcn42b/dcn42b_clk_mgr.c | 3 +- .../drm/amd/display/dc/clk_mgr/dcn60/dalsmc.h | 3 +- .../display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c | 4 +- .../dc/clk_mgr/dcn60/dcn60_clk_mgr_smu_msg.c | 36 +- drivers/gpu/drm/amd/display/dc/core/dc.c | 4 +- .../drm/amd/display/dc/core/dc_hw_sequencer.c | 301 +-- .../gpu/drm/amd/display/dc/core/dc_resource.c | 6 +- .../gpu/drm/amd/display/dc/core/dc_stream.c | 23 +- drivers/gpu/drm/amd/display/dc/dc.h | 2 +- drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 134 +- drivers/gpu/drm/amd/display/dc/dc_hw_types.h | 3 + drivers/gpu/drm/amd/display/dc/dc_types.h | 2 + .../amd/display/dc/dccg/dcn20/dcn20_dccg.h | 4 + .../amd/display/dc/dccg/dcn60/dcn60_dccg.c | 4 + .../amd/display/dc/dccg/dcn60/dcn60_dccg.h | 4 + drivers/gpu/drm/amd/display/dc/dce/dce_abm.c | 2 + .../drm/amd/display/dc/dce/dce_clock_source.c | 5 +- drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c | 1 + .../drm/amd/display/dc/dce/dmub_hw_lock_mgr.c | 10 +- drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c | 1 + drivers/gpu/drm/amd/display/dc/dce/dmub_psr.h | 1 + .../gpu/drm/amd/display/dc/dce/dmub_replay.c | 3 +- .../gpu/drm/amd/display/dc/dce/dmub_replay.h | 1 + .../amd/display/dc/dcn301/dcn301_panel_cntl.c | 1 + .../amd/display/dc/dcn31/dcn31_panel_cntl.c | 1 + .../drm/amd/display/dc/dio/dcn10/dcn10_dio.c | 1 + .../display/dc/dio/dcn10/dcn10_link_encoder.c | 2 + .../dc/dio/dcn10/dcn10_stream_encoder.c | 2 + .../display/dc/dio/dcn20/dcn20_link_encoder.c | 2 + .../dc/dio/dcn20/dcn20_stream_encoder.c | 2 + .../dc/dio/dcn30/dcn30_dio_link_encoder.c | 2 + .../dc/dio/dcn30/dcn30_dio_stream_encoder.c | 2 + .../dc/dio/dcn301/dcn301_dio_link_encoder.c | 2 + .../dc/dio/dcn31/dcn31_dio_link_encoder.c | 2 + .../dc/dio/dcn314/dcn314_dio_stream_encoder.c | 2 + .../dc/dio/dcn32/dcn32_dio_link_encoder.c | 2 + .../dc/dio/dcn32/dcn32_dio_stream_encoder.c | 2 + .../dc/dio/dcn321/dcn321_dio_link_encoder.c | 2 + .../dc/dio/dcn35/dcn35_dio_link_encoder.c | 2 + .../dc/dio/dcn35/dcn35_dio_stream_encoder.c | 2 + .../dc/dio/dcn401/dcn401_dio_link_encoder.c | 2 + .../dc/dio/dcn401/dcn401_dio_stream_encoder.c | 1 + .../dc/dio/dcn42/dcn42_dio_link_encoder.c | 2 + .../dc/dio/dcn42/dcn42_dio_stream_encoder.c | 2 + .../dc/dio/dcn60/dcn60_dio_link_encoder.c | 2 + .../dc/dio/dcn60/dcn60_dio_stream_encoder.c | 2 + .../dc/dio/virtual/virtual_link_encoder.c | 3 + .../dc/dio/virtual/virtual_stream_encoder.c | 1 + .../dml21/inc/bounding_boxes/dcn4_soc_bb.h | 2 +- .../src/dml2_core/dml2_core_dcn4_calcs.c | 164 +- .../src/dml2_core/dml2_core_shared_types.h | 3 + .../alternate_pstate_shared_lib.c | 22 +- .../dml2_utm_soc_bb/dml2_utm_soc_bb_dcn6.c | 2 - .../amd/display/dc/dpp/dcn401/dcn401_dpp.h | 2 + .../amd/display/dc/dpp/dcn401/dcn401_dpp_cm.c | 19 + .../drm/amd/display/dc/dpp/dcn60/dcn60_dpp.c | 1 + .../hpo/dcn30/dcn30_hpo_frl_stream_encoder.c | 2 + .../dcn401/dcn401_hpo_frl_stream_encoder.c | 2 + .../hpo/dcn42/dcn42_hpo_frl_stream_encoder.c | 2 + .../hpo/dcn60/dcn60_hpo_frl_stream_encoder.c | 2 + .../display/dc/hubbub/dcn10/dcn10_hubbub.c | 2 + .../display/dc/hubbub/dcn20/dcn20_hubbub.c | 2 + .../display/dc/hubbub/dcn201/dcn201_hubbub.c | 2 + .../display/dc/hubbub/dcn21/dcn21_hubbub.c | 2 + .../display/dc/hubbub/dcn30/dcn30_hubbub.c | 2 + .../display/dc/hubbub/dcn301/dcn301_hubbub.c | 2 + .../display/dc/hubbub/dcn31/dcn31_hubbub.c | 1 + .../display/dc/hubbub/dcn32/dcn32_hubbub.c | 2 + .../display/dc/hubbub/dcn35/dcn35_hubbub.c | 2 + .../display/dc/hubbub/dcn401/dcn401_hubbub.c | 2 + .../display/dc/hubbub/dcn42/dcn42_hubbub.c | 2 + .../display/dc/hubbub/dcn60/dcn60_hubbub.c | 2 + .../amd/display/dc/hubp/dcn31/dcn31_hubp.c | 1 + .../amd/display/dc/hubp/dcn401/dcn401_hubp.c | 105 +- .../amd/display/dc/hubp/dcn401/dcn401_hubp.h | 2 + .../amd/display/dc/hubp/dcn60/dcn60_hubp.c | 1 + .../amd/display/dc/hwss/dce110/dce110_hwseq.c | 2 +- .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 20 +- .../amd/display/dc/hwss/dcn10/dcn10_hwseq.h | 7 +- .../amd/display/dc/hwss/dcn10/dcn10_init.c | 1 + .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 14 +- .../amd/display/dc/hwss/dcn20/dcn20_hwseq.h | 3 +- .../amd/display/dc/hwss/dcn20/dcn20_init.c | 1 + .../amd/display/dc/hwss/dcn201/dcn201_init.c | 1 + .../amd/display/dc/hwss/dcn21/dcn21_init.c | 1 + .../amd/display/dc/hwss/dcn30/dcn30_init.c | 1 + .../amd/display/dc/hwss/dcn301/dcn301_init.c | 1 + .../amd/display/dc/hwss/dcn31/dcn31_init.c | 1 + .../amd/display/dc/hwss/dcn314/dcn314_init.c | 1 + .../amd/display/dc/hwss/dcn32/dcn32_init.c | 1 + .../amd/display/dc/hwss/dcn35/dcn35_hwseq.c | 11 + .../amd/display/dc/hwss/dcn35/dcn35_init.c | 1 + .../amd/display/dc/hwss/dcn351/dcn351_init.c | 1 + .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 71 +- .../amd/display/dc/hwss/dcn401/dcn401_hwseq.h | 7 +- .../amd/display/dc/hwss/dcn401/dcn401_init.c | 1 + .../amd/display/dc/hwss/dcn42/dcn42_init.c | 1 + .../amd/display/dc/hwss/dcn50/dcn50_hwseq.c | 6 +- .../amd/display/dc/hwss/dcn60/dcn60_init.c | 1 + .../drm/amd/display/dc/hwss/hw_sequencer.h | 75 +- .../display/dc/hwss/hw_sequencer_private.h | 3 + .../gpu/drm/amd/display/dc/inc/clock_source.h | 2 + drivers/gpu/drm/amd/display/dc/inc/hw/abm.h | 1 + .../gpu/drm/amd/display/dc/inc/hw/clk_mgr.h | 1 + .../gpu/drm/amd/display/dc/inc/hw/dchubbub.h | 1 + drivers/gpu/drm/amd/display/dc/inc/hw/dio.h | 1 + drivers/gpu/drm/amd/display/dc/inc/hw/dpp.h | 2 + drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h | 2 + .../drm/amd/display/dc/inc/hw/link_encoder.h | 1 + .../gpu/drm/amd/display/dc/inc/hw/pg_cntl.h | 1 + .../amd/display/dc/inc/hw/stream_encoder.h | 2 + drivers/gpu/drm/amd/display/dc/inc/resource.h | 2 +- .../amd/display/dc/pg/dcn35/dcn35_pg_cntl.c | 1 + .../amd/display/dc/pg/dcn42/dcn42_pg_cntl.c | 1 + .../dc/resource/dcn60/dcn60_resource.c | 6 +- drivers/gpu/drm/amd/display/dmub/dmub_srv.h | 58 +- .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 53 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn20.c | 84 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn20.h | 2 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn31.c | 94 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn31.h | 2 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn32.c | 94 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn32.h | 2 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn35.c | 94 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn35.h | 2 +- .../drm/amd/display/dmub/src/dmub_dcn401.c | 98 +- .../drm/amd/display/dmub/src/dmub_dcn401.h | 2 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn42.c | 98 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn42.h | 2 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn60.c | 98 +- .../gpu/drm/amd/display/dmub/src/dmub_dcn60.h | 2 +- .../gpu/drm/amd/display/dmub/src/dmub_srv.c | 54 +- 153 files changed, 2963 insertions(+), 2688 deletions(-)
--
2.55.0