DC Patches Sep 14 2026
Subsystems (5)
cover DC Patches Sep 14 2026
This DC patchset brings improvements in multiple areas. In summary, we highlight:
- Expand amdgpu_dm KUnit coverage across connector init, sink stream creation, FreeSync caps, forced atomic commit, plane modifiers, cursor updates, panic flush, MST connector creation, AUX transfers, link bandwidth readback and MST DSC configuration.
- Refactor RMCM into a separate module.
- Decouple cursor offload hwss executors from pipe context.
- Decouple HUBP_UPDATE_PLANE_ADDR from pipe_ctx.
- Rename lock_and_validation_needed to needs_dc_state_realloc.
- Drop the dead update_type param from update_planes_and_stream_adapter.
- Attach only plane updates and stream updates that actually changed.
- Unify fast update classification paths.
- Request DMUB HW cursor offload.
- Program DCC as part of address update.
- Update LLS and UPSP programming paths.
- Add lock-free memory pool.
- Add instance field to struct mpc and struct dccg.
- Cleanup DMUB command submission interfaces.
- Add inbox0 HW lock helpers for DCN35.
- Atomize IRQ register read/modify/write ops.
- Add Replay cumulative residency query.
- Add urgent assertion counter probe.
- Add debug option to force optional UCLK support.
- Force DSC to 8bpp for SST and MST DP tunneling over USB4.
- Honor forced RGB pixel encoding.
- Add option for certain panels to disable FEC.
- Cap DML2.1 vmin ODM combine at 2:1 for eDP.
- Add is_odm_enabled callback to skip init_odm on active ODM pipes.
- Remove MALL capabilities from DCN42B.
- Skip MALL calculations when there is no MALL.
- Enable power gating on dcn42b.
- Remove SDPIF_PORT_CONTROL programming for DCN31/35/42.
- Enable back alt-ch.
- Flush ISM work before releasing the stream.
- Fix HDMI FRL audio enable.
- Fix peak bandwidth measurement sequence.
- Bound the DSC power gating loop by num_dsc.
- Cast DP DTO pixel clock math to avoid overflow and narrowing.
- Use unsigned types for FRL cap check params and HPO read_state.
- Return success status from check_mode_supported.
- Add SPDX license identifier to dcn30_dpp_cm.c.
Alex Hung (25):
drm/amd/display: Test sink stream creation drm/amd/display: Test connector init helper drm/amd/display: Test HDMI connector init drm/amd/display: Test FreeSync caps update drm/amd/display: Test connector init drm/amd/display: Test forced atomic commit drm/amd/display: Test DCC reject for multi-plane format drm/amd/display: Test modifier list growth failure drm/amd/display: Test pre-GFX9 plane buffer attributes drm/amd/display: Test accepted plane atomic check drm/amd/display: Test cursor update without DC stream drm/amd/display: Test panic flush DCC teardown drm/amd/display: Test optional plane property creation drm/amd/display: Build MST DSC helpers for KUnit drm/amd/display: Test oversized AUX transfer drm/amd/display: Test MST connector creation drm/amd/display: Test link bandwidth readback drm/amd/display: Test cascaded Panamera check drm/amd/display: Test DSC caps validation drm/amd/display: Test MST port mode support drm/amd/display: Test FRL bandwidth lookup drm/amd/display: Test DSC precompute helpers drm/amd/display: Test DSC recompute check drm/amd/display: Test DSC config computation drm/amd/display: Test per-link DSC configs
Alvin Lee (5):
drm/amd/display: Update LLS and UPSP programming paths drm/amd/display: Add debug option to force optional UCLK support drm/amd/display: Enable back alt-ch
drm/amd/display: Program DCC as part of address update drm/amd/display: Return success status from check_mode_supported
Chenyu Chen (1):
drm/amd/display: Use unsigned types for FRL cap check params and HPO
read_state
Dillon Varone (1):
drm/amd/display: Cleanup DMUB command submission interfaces
Dominik Kaszewski (1):
drm/amd/display: Add lock-free memory pool
Fangzhi Zuo (2):
drm/amd/display: Force DSC to 8bpp for MST DP tunneling over USB4 drm/amd/display: Force DSC to 8bpp for SST DP tunneling over USB4
Gabe Teeger (4):
drm/amd/display: Enable power gating on dcn42b drm/amd/display: Bound DSC power gating loop by num_dsc drm/amd/display: Remove MALL capabilities from DCN42B drm/amd/display: Remove MALL capabilities from DCN42B bounding box
Ilya Bakoulin (1):
drm/amd/display: Fix HDMI FRL audio enable
Ivan Lipski (1):
drm/amd/display: Honor forced RGB pixel encoding
James Lin (6):
drm/amd/display: Rename lock_and_validation_needed to
needs_dc_state_realloc
drm/amd/display: Attach only plane updates that actually changed drm/amd/display: Request DMUB HW cursor offload drm/amd/display: Send stream_update to DC only when it changed drm/amd/display: Drop dead update_type param from
update_planes_and_stream_adapter
drm/amd/display: Cast DP DTO pixel clock math to avoid overflow and
narrowing
Leo Chen (1):
drm/amd/display: Cap DML2.1 vmin ODM combine at 2:1 for eDP
Leo Li (1):
drm/amd/display: Atomize IRQ register read/modify/write ops
Ovidiu Bunea (2):
drm/amd/display: Remove SDPIF_PORT_CONTROL programming for DCN31/35/42 drm/amd/display: Add condition to skip MALL calculations if there is
no MALL
Rafal Ostrowski (2):
drm/amd/display: Refactor RMCM into a separate module drm/amd/display: Unify fast update classification paths
Ray Wu (1):
drm/amd/display: Flush ISM work before releasing the stream
Taimur Hassan (1):
drm/amd/display: Promote DC to 3.2.398
Tom Chung (1):
drm/amd/display: Add inbox0 HW lock helpers for DCN35
Tomasz Siemek (2):
drm/amd/display: Decouple cursor offload hwss executors from pipe
context
drm/amd/display: Decouple HUBP_UPDATE_PLANE_ADDR from pipe_ctx
Tony Cheng (3):
drm/amd/display: Add instance field to struct mpc drm/amd/display: Add instance field to struct dccg drm/amd/display: Add SPDX license identifier to dcn30_dpp_cm.c
Wang, Sung-huai (1):
drm/amd/display: Add is_odm_enabled callback to skip init_odm on
active ODM pipes
Wei-Guang Li (1):
drm/amd/display: Add Replay cumulative residency query
Wenjing Liu (2):
drm/amd/display: Add urgent assertion counter probe drm/amd/display: Fix peak bandwidth measurement sequence
Yi-Ling Chen (1):
drm/amd/display: Add option for certain panels to disable FEC
drivers/gpu/drm/amd/display/Makefile | 1 + .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 113 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 27 +- .../display/amdgpu_dm/amdgpu_dm_connector.c | 19 +- .../display/amdgpu_dm/amdgpu_dm_connector.h | 1 + .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 9 +- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 3 +- .../drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c | 64 +- .../drm/amd/display/amdgpu_dm/amdgpu_dm_irq.h | 28 + .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c | 21 +- .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.h | 2 +- .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 61 +- .../display/amdgpu_dm/amdgpu_dm_mst_types.h | 19 + .../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 33 + .../tests/amdgpu_dm_connector_test.c | 1345 +++++++++++ .../amdgpu_dm/tests/amdgpu_dm_crtc_test.c | 16 +- .../amdgpu_dm/tests/amdgpu_dm_helpers_test.c | 8 +- .../amdgpu_dm/tests/amdgpu_dm_irq_test.c | 34 +- .../amdgpu_dm/tests/amdgpu_dm_ism_test.c | 83 +- .../tests/amdgpu_dm_mst_types_test.c | 2041 ++++++++++++++++- .../amdgpu_dm/tests/amdgpu_dm_plane_test.c | 357 ++- .../display/amdgpu_dm/tests/amdgpu_dm_test.c | 4 +- drivers/gpu/drm/amd/display/dc/Makefile | 3 +- drivers/gpu/drm/amd/display/dc/core/dc.c | 254 +- .../drm/amd/display/dc/core/dc_hw_sequencer.c | 246 +- .../gpu/drm/amd/display/dc/core/dc_resource.c | 147 +- .../gpu/drm/amd/display/dc/core/dc_state.c | 2 - .../gpu/drm/amd/display/dc/core/dc_stream.c | 124 +- drivers/gpu/drm/amd/display/dc/dc.h | 48 +- drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 50 +- drivers/gpu/drm/amd/display/dc/dc_dmub_srv.h | 12 +- .../gpu/drm/amd/display/dc/dc_memory_pool.c | 277 +++ .../gpu/drm/amd/display/dc/dc_memory_pool.h | 107 + drivers/gpu/drm/amd/display/dc/dc_stream.h | 14 +- .../amd/display/dc/dccg/dcn20/dcn20_dccg.c | 1 + .../amd/display/dc/dccg/dcn201/dcn201_dccg.c | 1 + .../amd/display/dc/dccg/dcn21/dcn21_dccg.c | 1 + .../amd/display/dc/dccg/dcn30/dcn30_dccg.c | 2 + .../amd/display/dc/dccg/dcn301/dcn301_dccg.c | 1 + .../amd/display/dc/dccg/dcn31/dcn31_dccg.c | 1 + .../amd/display/dc/dccg/dcn314/dcn314_dccg.c | 1 + .../amd/display/dc/dccg/dcn32/dcn32_dccg.c | 1 + .../amd/display/dc/dccg/dcn35/dcn35_dccg.c | 1 + .../amd/display/dc/dccg/dcn401/dcn401_dccg.c | 1 + .../amd/display/dc/dccg/dcn42/dcn42_dccg.c | 1 + .../amd/display/dc/dccg/dcn60/dcn60_dccg.c | 1 + .../drm/amd/display/dc/dce/dce_clock_source.c | 6 +- .../gpu/drm/amd/display/dc/dce/dmub_replay.c | 25 + .../gpu/drm/amd/display/dc/dce/dmub_replay.h | 2 + .../dml21/inc/bounding_boxes/dcn42b_soc_bb.h | 2 +- .../src/dml2_core/dml2_core_dcn4_calcs.c | 4 + .../dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c | 11 +- .../dml2_0/dml21/src/dml2_top/dml2_top_utm.c | 2 +- .../dml21_wrapper/dml21_translation_helper.c | 1 + .../amd/display/dc/dpp/dcn30/dcn30_dpp_cm.c | 2 + .../drm/amd/display/dc/dpp/dcn50/dcn50_dpp.c | 20 +- .../drm/amd/display/dc/dpp/dcn50/dcn50_dpp.h | 3 +- .../hpo/dcn30/dcn30_hpo_frl_stream_encoder.c | 6 +- .../hpo/dcn42/dcn42_hpo_frl_stream_encoder.c | 9 +- .../hpo/dcn60/dcn60_hpo_frl_stream_encoder.c | 9 +- .../display/dc/hubbub/dcn31/dcn31_hubbub.c | 5 - .../display/dc/hubbub/dcn35/dcn35_hubbub.c | 7 +- .../display/dc/hubbub/dcn42/dcn42_hubbub.c | 13 +- .../display/dc/hubbub/dcn60/dcn60_hubbub.c | 44 +- .../amd/display/dc/hubp/dcn10/dcn10_hubp.c | 4 +- .../amd/display/dc/hubp/dcn10/dcn10_hubp.h | 3 +- .../amd/display/dc/hubp/dcn20/dcn20_hubp.c | 5 +- .../amd/display/dc/hubp/dcn20/dcn20_hubp.h | 3 +- .../amd/display/dc/hubp/dcn21/dcn21_hubp.c | 5 +- .../amd/display/dc/hubp/dcn30/dcn30_hubp.c | 5 +- .../amd/display/dc/hubp/dcn30/dcn30_hubp.h | 3 +- .../amd/display/dc/hubp/dcn401/dcn401_hubp.c | 9 +- .../amd/display/dc/hubp/dcn401/dcn401_hubp.h | 3 +- .../amd/display/dc/hubp/dcn42/dcn42_hubp.c | 6 +- .../amd/display/dc/hubp/dcn50/dcn50_hubp.c | 28 +- .../amd/display/dc/hubp/dcn50/dcn50_hubp.h | 3 +- .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 108 +- .../amd/display/dc/hwss/dcn10/dcn10_hwseq.h | 2 + .../amd/display/dc/hwss/dcn10/dcn10_init.c | 1 + .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 40 +- .../amd/display/dc/hwss/dcn20/dcn20_hwseq.h | 2 + .../amd/display/dc/hwss/dcn20/dcn20_init.c | 1 + .../amd/display/dc/hwss/dcn201/dcn201_hwseq.c | 27 +- .../amd/display/dc/hwss/dcn201/dcn201_hwseq.h | 2 + .../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_hwseq.c | 43 +- .../amd/display/dc/hwss/dcn32/dcn32_init.c | 1 + .../amd/display/dc/hwss/dcn35/dcn35_hwseq.c | 117 +- .../amd/display/dc/hwss/dcn35/dcn35_hwseq.h | 14 +- .../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 | 39 +- .../amd/display/dc/hwss/dcn401/dcn401_hwseq.h | 5 +- .../amd/display/dc/hwss/dcn401/dcn401_init.c | 1 + .../amd/display/dc/hwss/dcn42/dcn42_hwseq.c | 283 ++- .../amd/display/dc/hwss/dcn42/dcn42_hwseq.h | 17 +- .../amd/display/dc/hwss/dcn42/dcn42_init.c | 6 +- .../amd/display/dc/hwss/dcn50/dcn50_hwseq.c | 10 +- .../amd/display/dc/hwss/dcn60/dcn60_hwseq.c | 194 +- .../amd/display/dc/hwss/dcn60/dcn60_hwseq.h | 5 +- .../amd/display/dc/hwss/dcn60/dcn60_init.c | 8 +- .../drm/amd/display/dc/hwss/hw_sequencer.h | 70 +- .../display/dc/hwss/hw_sequencer_private.h | 4 + .../gpu/drm/amd/display/dc/inc/core_types.h | 4 +- drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h | 1 + drivers/gpu/drm/amd/display/dc/inc/hw/dpp.h | 3 +- drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h | 4 +- drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h | 65 +- drivers/gpu/drm/amd/display/dc/inc/hw/rmcm.h | 140 ++ .../amd/display/dc/inc/hw/timing_generator.h | 1 + .../gpu/drm/amd/display/dc/inc/link_service.h | 2 + drivers/gpu/drm/amd/display/dc/inc/resource.h | 18 +- .../drm/amd/display/dc/link/link_factory.c | 1 + .../link/protocols/link_edp_panel_control.c | 22 + .../link/protocols/link_edp_panel_control.h | 2 + .../drm/amd/display/dc/mpc/dcn10/dcn10_mpc.c | 1 + .../drm/amd/display/dc/mpc/dcn20/dcn20_mpc.c | 1 + .../drm/amd/display/dc/mpc/dcn30/dcn30_mpc.c | 1 + .../drm/amd/display/dc/mpc/dcn32/dcn32_mpc.c | 1 + .../amd/display/dc/mpc/dcn401/dcn401_mpc.c | 1 + .../drm/amd/display/dc/mpc/dcn42/dcn42_mpc.c | 680 +----- .../drm/amd/display/dc/mpc/dcn42/dcn42_mpc.h | 714 +----- .../drm/amd/display/dc/mpc/dcn60/dcn60_mpc.c | 41 +- .../drm/amd/display/dc/mpc/dcn60/dcn60_mpc.h | 238 -- .../amd/display/dc/optc/dcn31/dcn31_optc.c | 10 + .../amd/display/dc/optc/dcn31/dcn31_optc.h | 1 + .../amd/display/dc/optc/dcn314/dcn314_optc.c | 1 + .../amd/display/dc/optc/dcn35/dcn35_optc.c | 1 + .../amd/display/dc/optc/dcn42/dcn42_optc.c | 1 + drivers/gpu/drm/amd/display/dc/os_types.h | 1 + .../amd/display/dc/pg/dcn42/dcn42_pg_cntl.c | 4 + .../dc/resource/dcn42/dcn42_resource.c | 56 +- .../dc/resource/dcn42b/dcn42b_resource.c | 123 +- .../dc/resource/dcn60/dcn60_resource.c | 20 +- drivers/gpu/drm/amd/display/dc/rmcm/Makefile | 44 + .../amd/display/dc/rmcm/dcn42/dcn42_rmcm.c | 867 +++++++ .../amd/display/dc/rmcm/dcn42/dcn42_rmcm.h | 717 ++++++ .../amd/display/dc/rmcm/dcn60/dcn60_rmcm.c | 251 ++ .../amd/display/dc/rmcm/dcn60/dcn60_rmcm.h | 35 + drivers/gpu/drm/amd/display/dmub/dmub_srv.h | 2 +- .../gpu/drm/amd/display/dmub/src/dmub_srv.c | 7 +- .../drm/amd/display/modules/inc/mod_power.h | 3 + .../amd/display/modules/power/power_replay.c | 13 + 148 files changed, 8132 insertions(+), 2808 deletions(-) create mode 100644 drivers/gpu/drm/amd/display/dc/dc_memory_pool.c create mode 100644 drivers/gpu/drm/amd/display/dc/dc_memory_pool.h create mode 100644 drivers/gpu/drm/amd/display/dc/inc/hw/rmcm.h create mode 100644 drivers/gpu/drm/amd/display/dc/rmcm/Makefile create mode 100644 drivers/gpu/drm/amd/display/dc/rmcm/dcn42/dcn42_rmcm.c create mode 100644 drivers/gpu/drm/amd/display/dc/rmcm/dcn42/dcn42_rmcm.h create mode 100644 drivers/gpu/drm/amd/display/dc/rmcm/dcn60/dcn60_rmcm.c create mode 100644 drivers/gpu/drm/amd/display/dc/rmcm/dcn60/dcn60_rmcm.h
Signature · 1 line
2.43.0
PATCH 1/66 drm/amd/display: Decouple cursor offload hwss executors from pipe context
From: Tomasz Siemek <[email protected]>
[Why]
Hwss executors shouldn't be coupled to complex dc structs such as pipe_ctx.
[How]
Refactor cursor offload hardware sequencer extension to accept only the parameters required for programming cursor offload state. Extract these parameters in the generic HWSS layer for both immediate execution and block-sequence construction.
--- .../drm/amd/display/dc/core/dc_hw_sequencer.c | 211 ++++++++++-------- .../gpu/drm/amd/display/dc/core/dc_stream.c | 58 ++++- .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 10 +- .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 10 +- .../amd/display/dc/hwss/dcn35/dcn35_hwseq.c | 67 +++--- .../amd/display/dc/hwss/dcn35/dcn35_hwseq.h | 10 +- .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 18 +- .../amd/display/dc/hwss/dcn401/dcn401_hwseq.h | 3 +- .../amd/display/dc/hwss/dcn50/dcn50_hwseq.c | 10 +- .../amd/display/dc/hwss/dcn60/dcn60_hwseq.c | 18 +- .../amd/display/dc/hwss/dcn60/dcn60_hwseq.h | 3 +- .../drm/amd/display/dc/hwss/hw_sequencer.h | 56 +++-- 12 files changed, 274 insertions(+), 200 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +121 -90
@@ -1319,11 +1319,7 @@ void hwss_build_fast_sequence(struct dc *dc, cursor_pipe_to_program = current_pipe;if (enable_cursor_offload && dc->hwss.begin_cursor_offload_update) { - block_sequence[*num_steps].params.begin_cursor_offload_update_params.dc = dc; - block_sequence[*num_steps].params.begin_cursor_offload_update_params.pipe_ctx = - current_pipe; - block_sequence[*num_steps].func =HWSS_BEGIN_CURSOR_OFFLOAD_UPDATE ; - (*num_steps)++; +hwss_add_begin_cursor_offload_update (&seq_state, dc, current_pipe); }else { block_sequence[*num_steps].params.cursor_lock_params.dc = dc; block_sequence[*num_steps].params.cursor_lock_params.pipe_ctx = current_pipe;
@@ -1364,22 +1360,14 @@ void hwss_build_fast_sequence(struct dc *dc,hwss_add_set_cursor_sdr_white_level (&seq_state, current_pipe);if (enable_cursor_offload && dc->hwss.update_cursor_offload_pipe) { - block_sequence[*num_steps].params.update_cursor_offload_pipe_params.dc = dc; - block_sequence[*num_steps].params.update_cursor_offload_pipe_params.pipe_ctx = - current_pipe; - block_sequence[*num_steps].func =HWSS_UPDATE_CURSOR_OFFLOAD_PIPE ; - (*num_steps)++; +hwss_add_update_cursor_offload_pipe (&seq_state, dc, current_pipe); } }/* Unlock cursor attributes after all pipes have been programmed */ if (cursor_pipe_to_program) {if (enable_cursor_offload && dc->hwss.commit_cursor_offload_update) { - block_sequence[*num_steps].params.commit_cursor_offload_update_params.dc = dc; - block_sequence[*num_steps].params.commit_cursor_offload_update_params.pipe_ctx = - cursor_pipe_to_program; - block_sequence[*num_steps].func =HWSS_COMMIT_CURSOR_OFFLOAD_UPDATE ; - (*num_steps)++; +hwss_add_commit_cursor_offload_update (&seq_state, dc, cursor_pipe_to_program); }else { block_sequence[*num_steps].params.cursor_lock_params.dc = dc; block_sequence[*num_steps].params.cursor_lock_params.pipe_ctx = cursor_pipe_to_program;
@@ -1417,11 +1405,7 @@ void hwss_build_fast_sequence(struct dc *dc, cursor_pipe_to_program = current_pipe;if (enable_cursor_offload && dc->hwss.begin_cursor_offload_update) { - block_sequence[*num_steps].params.begin_cursor_offload_update_params.dc = dc; - block_sequence[*num_steps].params.begin_cursor_offload_update_params.pipe_ctx = - current_pipe; - block_sequence[*num_steps].func =HWSS_BEGIN_CURSOR_OFFLOAD_UPDATE ; - (*num_steps)++; +hwss_add_begin_cursor_offload_update (&seq_state, dc, current_pipe); }else { block_sequence[*num_steps].params.cursor_lock_params.dc = dc; block_sequence[*num_steps].params.cursor_lock_params.pipe_ctx = current_pipe;
@@ -1437,11 +1421,7 @@ void hwss_build_fast_sequence(struct dc *dc, (*num_steps)++;if (enable_cursor_offload && dc->hwss.update_cursor_offload_pipe) { - block_sequence[*num_steps].params.update_cursor_offload_pipe_params.dc = dc; - block_sequence[*num_steps].params.update_cursor_offload_pipe_params.pipe_ctx = - current_pipe; - block_sequence[*num_steps].func =HWSS_UPDATE_CURSOR_OFFLOAD_PIPE ; - (*num_steps)++; +hwss_add_update_cursor_offload_pipe (&seq_state, dc, current_pipe); }if (dc->ctx->dmub_srv)
@@ -1453,11 +1433,7 @@ void hwss_build_fast_sequence(struct dc *dc,/* Unlock cursor position after all pipes have been programmed */ if (cursor_pipe_to_program) {if (enable_cursor_offload && dc->hwss.commit_cursor_offload_update) { - block_sequence[*num_steps].params.commit_cursor_offload_update_params.dc = dc; - block_sequence[*num_steps].params.commit_cursor_offload_update_params.pipe_ctx = - cursor_pipe_to_program; - block_sequence[*num_steps].func =HWSS_COMMIT_CURSOR_OFFLOAD_UPDATE ; - (*num_steps)++; +hwss_add_commit_cursor_offload_update (&seq_state, dc, cursor_pipe_to_program); }else { block_sequence[*num_steps].params.cursor_lock_params.dc = dc; block_sequence[*num_steps].params.cursor_lock_params.pipe_ctx = cursor_pipe_to_program;
@@ -2127,20 +2103,20 @@ void hwss_execute_sequence(struct dc *dc,case HUBP_MEM_PROGRAM_VIEWPORT :hwss_hubp_mem_program_viewport (params);break ; -case ABORT_CURSOR_OFFLOAD_UPDATE : -hwss_abort_cursor_offload_update (params); -break ;case HWSS_CURSOR_LOCK :hwss_cursor_lock (params);break ;case HWSS_BEGIN_CURSOR_OFFLOAD_UPDATE : -hwss_begin_cursor_offload_update (params); +hwss_begin_cursor_offload_update (dc, params);break ;case HWSS_COMMIT_CURSOR_OFFLOAD_UPDATE : -hwss_commit_cursor_offload_update (params); +hwss_commit_cursor_offload_update (dc, params);break ;case HWSS_UPDATE_CURSOR_OFFLOAD_PIPE : -hwss_update_cursor_offload_pipe (params); +hwss_update_cursor_offload_pipe (dc, params); +break ; +case ABORT_CURSOR_OFFLOAD_UPDATE : +hwss_abort_cursor_offload_update (dc, params);break ;case DC_SEND_CURSOR_INFO_TO_DMU :hwss_send_cursor_info_to_dmu (params);
@@ -4321,15 +4297,6 @@ void hwss_hubp_mem_program_viewport(union block_sequence_params *params) hubp->funcs->mem_program_viewport (hubp, viewport, viewport_c); } -void hwss_abort_cursor_offload_update (union block_sequence_params *params) -{ -struct dc *dc = params->abort_cursor_offload_update_params.dc; -struct pipe_ctx *pipe_ctx = params->abort_cursor_offload_update_params.pipe_ctx; - -if (dc && dc->hwss.abort_cursor_offload_update) - dc->hwss.abort_cursor_offload_update (dc, pipe_ctx); -} -void hwss_cursor_lock (union block_sequence_params *params) {struct dc *dc = params->cursor_lock_params.dc;
@@ -4340,31 +4307,45 @@ void hwss_cursor_lock(union block_sequence_params *params) dc->hwss.cursor_lock (dc, pipe_ctx, lock); } -void hwss_begin_cursor_offload_update (union block_sequence_params *params) +void hwss_begin_cursor_offload_update (struct dc *dc,union block_sequence_params *params) { -struct dc *dc = params->begin_cursor_offload_update_params.dc; -struct pipe_ctx *pipe_ctx = params->begin_cursor_offload_update_params.pipe_ctx; - -if (dc && dc->hwss.begin_cursor_offload_update) - dc->hwss.begin_cursor_offload_update (dc, pipe_ctx); +if (dc->hwss.begin_cursor_offload_update) + dc->hwss.begin_cursor_offload_update ( + params->begin_cursor_offload_update_params.dmub, + params->begin_cursor_offload_update_params.dpp, + params->begin_cursor_offload_update_params.hubp, + params->begin_cursor_offload_update_params.stream_idx); } -void hwss_commit_cursor_offload_update (union block_sequence_params *params) +void hwss_commit_cursor_offload_update (struct dc *dc,union block_sequence_params *params) { -struct dc *dc = params->commit_cursor_offload_update_params.dc; -struct pipe_ctx *pipe_ctx = params->commit_cursor_offload_update_params.pipe_ctx; - -if (dc && dc->hwss.commit_cursor_offload_update) - dc->hwss.commit_cursor_offload_update (dc, pipe_ctx); +if (dc->hwss.commit_cursor_offload_update) + dc->hwss.commit_cursor_offload_update ( + params->commit_cursor_offload_update_params.dmub, + params->commit_cursor_offload_update_params.dpp, + params->commit_cursor_offload_update_params.hubp, + params->commit_cursor_offload_update_params.stream_idx); } -void hwss_update_cursor_offload_pipe (union block_sequence_params *params) +void hwss_update_cursor_offload_pipe (struct dc *dc,union block_sequence_params *params) { -struct dc *dc = params->update_cursor_offload_pipe_params.dc; -struct pipe_ctx *pipe_ctx = params->update_cursor_offload_pipe_params.pipe_ctx; +if (dc->hwss.update_cursor_offload_pipe) + dc->hwss.update_cursor_offload_pipe ( + params->update_cursor_offload_pipe_params.dmub, + params->update_cursor_offload_pipe_params.stream_idx, + params->update_cursor_offload_pipe_params.pipe_idx, + params->update_cursor_offload_pipe_params.dpp, + params->update_cursor_offload_pipe_params.hubp); +} -if (dc && dc->hwss.update_cursor_offload_pipe) - dc->hwss.update_cursor_offload_pipe (dc, pipe_ctx); +void hwss_abort_cursor_offload_update (struct dc *dc,union block_sequence_params *params) +{ +if (dc->hwss.abort_cursor_offload_update) + dc->hwss.abort_cursor_offload_update ( + params->abort_cursor_offload_update_params.dmub, + params->abort_cursor_offload_update_params.dpp, + params->abort_cursor_offload_update_params.hubp, + params->abort_cursor_offload_update_params.stream_idx); }void hwss_send_cursor_info_to_dmu (union block_sequence_params *params)
@@ -5755,18 +5736,6 @@ void hwss_add_hubp_mem_program_viewport(struct block_sequence_state *seq_state, } } -void hwss_add_abort_cursor_offload_update (struct block_sequence_state *seq_state, -struct dc *dc, -struct pipe_ctx *pipe_ctx) -{ -if (*seq_state->num_steps <MAX_HWSS_BLOCK_SEQUENCE_SIZE ) { - seq_state->steps[*seq_state->num_steps].func =ABORT_CURSOR_OFFLOAD_UPDATE ; - seq_state->steps[*seq_state->num_steps].params.abort_cursor_offload_update_params.dc = dc; - seq_state->steps[*seq_state->num_steps].params.abort_cursor_offload_update_params.pipe_ctx = pipe_ctx; - (*seq_state->num_steps)++; - } -} -void hwss_add_set_cursor_attribute (struct block_sequence_state *seq_state,struct dc *dc,struct pipe_ctx *pipe_ctx)
@@ -5907,18 +5876,6 @@ void hwss_add_tg_get_frame_count(struct block_sequence_state *seq_state, } } -void hwss_add_begin_cursor_offload_update (struct block_sequence_state *seq_state, -struct dc *dc, -struct pipe_ctx *pipe_ctx) -{ -if (*seq_state->num_steps <MAX_HWSS_BLOCK_SEQUENCE_SIZE ) { - seq_state->steps[*seq_state->num_steps].func =HWSS_BEGIN_CURSOR_OFFLOAD_UPDATE ; - seq_state->steps[*seq_state->num_steps].params.begin_cursor_offload_update_params.dc = dc; - seq_state->steps[*seq_state->num_steps].params.begin_cursor_offload_update_params.pipe_ctx = pipe_ctx; - (*seq_state->num_steps)++; - } -} - void hwss_add_cursor_lock(struct block_sequence_state *seq_state, struct dc *dc, struct pipe_ctx *pipe_ctx,
@@ -5967,10 +5924,27 @@ void hwss_add_update_cursor_offload_pipe(struct block_sequence_state *seq_state,struct dc *dc, struct pipe_ctx *pipe_ctx) { + const struct pipe_ctx *top_pipe; + +if (!dc->hwss.update_cursor_offload_pipe) +return ; + + top_pipe =resource_get_otg_master (pipe_ctx); +if (!top_pipe) +return ; +if (*seq_state->num_steps <MAX_HWSS_BLOCK_SEQUENCE_SIZE ) { seq_state->steps[*seq_state->num_steps].func =HWSS_UPDATE_CURSOR_OFFLOAD_PIPE ; - seq_state->steps[*seq_state->num_steps].params.update_cursor_offload_pipe_params.dc = dc; - seq_state->steps[*seq_state->num_steps].params.update_cursor_offload_pipe_params.pipe_ctx = pipe_ctx; + seq_state->steps[*seq_state->num_steps].params.update_cursor_offload_pipe_params.dmub = + dc->ctx->dmub_srv->dmub; + seq_state->steps[*seq_state->num_steps].params.update_cursor_offload_pipe_params.stream_idx = + top_pipe->pipe_idx; + seq_state->steps[*seq_state->num_steps].params.update_cursor_offload_pipe_params.pipe_idx = + pipe_ctx->pipe_idx; + seq_state->steps[*seq_state->num_steps].params.update_cursor_offload_pipe_params.dpp = + pipe_ctx->plane_res.dpp; + seq_state->steps[*seq_state->num_steps].params.update_cursor_offload_pipe_params.hubp = + pipe_ctx->plane_res.hubp; (*seq_state->num_steps)++; } }
@@ -5979,10 +5953,67 @@ void hwss_add_commit_cursor_offload_update(struct block_sequence_state *seq_statstruct dc *dc, struct pipe_ctx *pipe_ctx) { + const struct pipe_ctx *top_pipe = resource_get_otg_master(pipe_ctx); + +if (!top_pipe) +return ; +if (*seq_state->num_steps <MAX_HWSS_BLOCK_SEQUENCE_SIZE ) { seq_state->steps[*seq_state->num_steps].func =HWSS_COMMIT_CURSOR_OFFLOAD_UPDATE ; - seq_state->steps[*seq_state->num_steps].params.commit_cursor_offload_update_params.dc = dc; - seq_state->steps[*seq_state->num_steps].params.commit_cursor_offload_update_params.pipe_ctx = pipe_ctx; + seq_state->steps[*seq_state->num_steps].params.commit_cursor_offload_update_params.dmub = + dc->ctx->dmub_srv->dmub; + seq_state->steps[*seq_state->num_steps].params.commit_cursor_offload_update_params.stream_idx = + top_pipe->pipe_idx; + seq_state->steps[*seq_state->num_steps].params.commit_cursor_offload_update_params.dpp = + pipe_ctx->plane_res.dpp; + seq_state->steps[*seq_state->num_steps].params.commit_cursor_offload_update_params.hubp = + pipe_ctx->plane_res.hubp; + (*seq_state->num_steps)++; + } +} + +void hwss_add_begin_cursor_offload_update (struct block_sequence_state *seq_state, +struct dc *dc, +struct pipe_ctx *pipe_ctx) +{ +const struct pipe_ctx *top_pipe =resource_get_otg_master (pipe_ctx); + +if (!top_pipe) +return ; + +if (*seq_state->num_steps <MAX_HWSS_BLOCK_SEQUENCE_SIZE ) { + seq_state->steps[*seq_state->num_steps].func =HWSS_BEGIN_CURSOR_OFFLOAD_UPDATE ; + seq_state->steps[*seq_state->num_steps].params.begin_cursor_offload_update_params.dmub = + dc->ctx->dmub_srv->dmub; + seq_state->steps[*seq_state->num_steps].params.begin_cursor_offload_update_params.stream_idx = + top_pipe->pipe_idx; + seq_state->steps[*seq_state->num_steps].params.begin_cursor_offload_update_params.dpp = + pipe_ctx->plane_res.dpp; + seq_state->steps[*seq_state->num_steps].params.begin_cursor_offload_update_params.hubp = + pipe_ctx->plane_res.hubp; + (*seq_state->num_steps)++; + } +} + +void hwss_add_abort_cursor_offload_update (struct block_sequence_state *seq_state, +struct dc *dc, +struct pipe_ctx *pipe_ctx) +{ +const struct pipe_ctx *top_pipe =resource_get_otg_master (pipe_ctx); + +if (!top_pipe) +return ; + +if (*seq_state->num_steps <MAX_HWSS_BLOCK_SEQUENCE_SIZE ) { + seq_state->steps[*seq_state->num_steps].func =ABORT_CURSOR_OFFLOAD_UPDATE ; + seq_state->steps[*seq_state->num_steps].params.abort_cursor_offload_update_params.dmub = + dc->ctx->dmub_srv->dmub; + seq_state->steps[*seq_state->num_steps].params.abort_cursor_offload_update_params.stream_idx = + top_pipe->pipe_idx; + seq_state->steps[*seq_state->num_steps].params.abort_cursor_offload_update_params.dpp = + pipe_ctx->plane_res.dpp; + seq_state->steps[*seq_state->num_steps].params.abort_cursor_offload_update_params.hubp = + pipe_ctx->plane_res.hubp; (*seq_state->num_steps)++; } }
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +46 -12
90 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +8 -2
@@ -3145,8 +3145,14 @@ static void dcn10_update_dchubp_dpp( }if (pipe_ctx->stream->cursor_attributes.address.quad_part !=0 ) { -if (dc->hwss.abort_cursor_offload_update) - dc->hwss.abort_cursor_offload_update (dc, pipe_ctx); +if (dc_dmub_srv_is_cursor_offload_enabled (dc) && dc->hwss.abort_cursor_offload_update) { +struct pipe_ctx *top_pipe =resource_get_otg_master (pipe_ctx); + +if (top_pipe) + dc->hwss.abort_cursor_offload_update (dc->ctx->dmub_srv->dmub, + pipe_ctx->plane_res.dpp, pipe_ctx->plane_res.hubp, + top_pipe->pipe_idx); + } dc->hwss.set_cursor_attribute (pipe_ctx); dc->hwss.set_cursor_position (pipe_ctx);
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +8 -2
@@ -1834,8 +1834,14 @@ void dcn20_update_dchubp_dpp(if ((pipe_ctx->update_flags.bits.enable || pipe_ctx->update_flags.bits.opp_changed || pipe_ctx->update_flags.bits.scaler || viewport_changed == true) && pipe_ctx->stream->cursor_attributes.address.quad_part !=0 ) { -if (dc->hwss.abort_cursor_offload_update) - dc->hwss.abort_cursor_offload_update (dc, pipe_ctx); +if (dc_dmub_srv_is_cursor_offload_enabled (dc) && dc->hwss.abort_cursor_offload_update) { +struct pipe_ctx *top_pipe =resource_get_otg_master (pipe_ctx); + +if (top_pipe) + dc->hwss.abort_cursor_offload_update (dc->ctx->dmub_srv->dmub, + pipe_ctx->plane_res.dpp, pipe_ctx->plane_res.hubp, + top_pipe->pipe_idx); + } dc->hwss.set_cursor_attribute (pipe_ctx); dc->hwss.set_cursor_position (pipe_ctx);
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c +25 -42
121 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.h +6 -4
@@ -103,10 +103,12 @@ bool dcn35_is_dp_dig_pixel_rate_div_policy(struct pipe_ctx *pipe_ctx);void dcn35_hardware_release (struct dc *dc); -void dcn35_abort_cursor_offload_update (struct dc *dc,const struct pipe_ctx *pipe); -void dcn35_begin_cursor_offload_update (struct dc *dc,const struct pipe_ctx *pipe); -void dcn35_commit_cursor_offload_update (struct dc *dc,const struct pipe_ctx *pipe); -void dcn35_update_cursor_offload_pipe (struct dc *dc,const struct pipe_ctx *pipe); +void dcn35_abort_cursor_offload_update (struct dmub_srv *dmub,struct dpp *dpp,struct hubp *hubp,uint32_t stream_idx); +void dcn35_begin_cursor_offload_update (struct dmub_srv *dmub,struct dpp *dpp,struct hubp *hubp,uint32_t stream_idx); +void dcn35_commit_cursor_offload_update (struct dmub_srv *dmub,struct dpp *dpp, +struct hubp *hubp,uint32_t stream_idx); +void dcn35_update_cursor_offload_pipe (struct dmub_srv *dmub,uint32_t stream_idx, +uint8_t pipe_idx,const struct dpp *dpp,const struct hubp *hubp);void dcn35_notify_cursor_offload_drr_update (struct dc *dc,struct dc_state *context,const struct dc_stream_state *stream);void dcn35_program_cursor_offload_now (struct dc *dc,const struct pipe_ctx *pipe);
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +6 -12
@@ -3089,23 +3089,17 @@ void dcn401_plane_atomic_power_down(struct dc *dc, hws->funcs.dpp_root_clock_control (hws, dpp->inst, false); } -void dcn401_update_cursor_offload_pipe (struct dc *dc,const struct pipe_ctx *pipe) +void dcn401_update_cursor_offload_pipe (struct dmub_srv *dmub,uint32_t stream_idx, +uint8_t pipe_idx,const struct dpp *dpp,const struct hubp *hubp) { -volatile struct dmub_cursor_offload_v1 *cs = dc->ctx->dmub_srv->dmub->cursor_offload_v1; -const struct pipe_ctx *top_pipe =resource_get_otg_master (pipe); -const struct hubp *hubp = pipe->plane_res.hubp; -const struct dpp *dpp = pipe->plane_res.dpp; +volatile struct dmub_cursor_offload_v1 *cs = dmub->cursor_offload_v1;volatile struct dmub_cursor_offload_pipe_data_dcn401_v1 *p; -uint32_t stream_idx, write_idx, payload_idx; +uint32_t write_idx, payload_idx; -if (!top_pipe || !hubp || !dpp) -return ; - - stream_idx = top_pipe->pipe_idx; write_idx = cs->offload_streams[stream_idx].write_idx +1 ;/* new payload (+1) */ payload_idx = write_idx %ARRAY_SIZE (cs->offload_streams[stream_idx].payloads); - p = &cs->offload_streams[stream_idx].payloads[payload_idx].pipe_data[pipe->pipe_idx].dcn401; + p = &cs->offload_streams[stream_idx].payloads[payload_idx].pipe_data[pipe_idx].dcn401; p->CURSOR0_0_CURSOR_SURFACE_ADDRESS = hubp->att.SURFACE_ADDR; p->CURSOR0_0_CURSOR_SURFACE_ADDRESS_HIGH = hubp->att.SURFACE_ADDR_HIGH;
@@ -3142,7 +3136,7 @@ void dcn401_update_cursor_offload_pipe(struct dc *dc, const struct pipe_ctx *pip p->HUBPREQ0_CURSOR_SETTINGS__CURSOR0_CHUNK_HDL_ADJUST = hubp->att.settings.bits.chunk_hdl_adjust; p->HUBP0_DCHUBP_MALL_CONFIG__USE_MALL_FOR_CURSOR = hubp->use_mall_for_cursor; - cs->offload_streams[stream_idx].payloads[payload_idx].pipe_mask |= (1u << pipe->pipe_idx); + cs->offload_streams[stream_idx].payloads[payload_idx].pipe_mask |= (1u << pipe_idx); } void dcn401_plane_atomic_power_down_sequence(struct dc *dc,
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.h +2 -1
@@ -136,7 +136,8 @@ void dcn401_blank_pixel_data_sequence(bool blank, struct block_sequence_state *seq_state);void dcn401_initialize_min_clocks (struct dc *dc); -void dcn401_update_cursor_offload_pipe (struct dc *dc,const struct pipe_ctx *pipe); +void dcn401_update_cursor_offload_pipe (struct dmub_srv *dmub,uint32_t stream_idx, +uint8_t pipe_idx,const struct dpp *dpp,const struct hubp *hubp); void dcn401_program_all_writeback_pipes_in_tree_sequence( struct dc *dc,
drivers/gpu/drm/amd/display/dc/hwss/dcn50/dcn50_hwseq.c +8 -2
@@ -201,8 +201,14 @@ void dcn50_update_dchubp_dpp(if ((pipe_ctx->update_flags.bits.enable || pipe_ctx->update_flags.bits.opp_changed || pipe_ctx->update_flags.bits.scaler || viewport_changed == true) && pipe_ctx->stream->cursor_attributes.address.quad_part !=0 ) { -if (dc->hwss.abort_cursor_offload_update) - dc->hwss.abort_cursor_offload_update (dc, pipe_ctx); +if (dc_dmub_srv_is_cursor_offload_enabled (dc) && dc->hwss.abort_cursor_offload_update) { +struct pipe_ctx *top_pipe =resource_get_otg_master (pipe_ctx); + +if (top_pipe) + dc->hwss.abort_cursor_offload_update (dc->ctx->dmub_srv->dmub, + pipe_ctx->plane_res.dpp, pipe_ctx->plane_res.hubp, + top_pipe->pipe_idx); + } dc->hwss.set_cursor_attribute (pipe_ctx); dc->hwss.set_cursor_position (pipe_ctx);
drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.c +6 -12
@@ -790,23 +790,17 @@ void dcn60_set_cursor_attribute(struct pipe_ctx *pipe_ctx) pipe_ctx->plane_res.dpp, attributes); } -void dcn60_update_cursor_offload_pipe (struct dc *dc,const struct pipe_ctx *pipe) +void dcn60_update_cursor_offload_pipe (struct dmub_srv *dmub,uint32_t stream_idx, +uint8_t pipe_idx,const struct dpp *dpp,const struct hubp *hubp) { -volatile struct dmub_cursor_offload_v1 *cs = dc->ctx->dmub_srv->dmub->cursor_offload_v1; -const struct pipe_ctx *top_pipe =resource_get_otg_master (pipe); -const struct hubp *hubp = pipe->plane_res.hubp; -const struct dpp *dpp = pipe->plane_res.dpp; +volatile struct dmub_cursor_offload_v1 *cs = dmub->cursor_offload_v1;volatile struct dmub_cursor_offload_pipe_data_dcn60_v1 *p; -uint32_t stream_idx, write_idx, payload_idx; +uint32_t write_idx, payload_idx; -if (!top_pipe || !hubp || !dpp) -return ; - - stream_idx = top_pipe->pipe_idx; write_idx = cs->offload_streams[stream_idx].write_idx +1 ;/* new payload (+1) */ payload_idx = write_idx %ARRAY_SIZE (cs->offload_streams[stream_idx].payloads); - p = &cs->offload_streams[stream_idx].payloads[payload_idx].pipe_data[pipe->pipe_idx].dcn60; + p = &cs->offload_streams[stream_idx].payloads[payload_idx].pipe_data[pipe_idx].dcn60; p->CURSOR0_0_CURSOR_SURFACE_ADDRESS = hubp->att.SURFACE_ADDR; p->CURSOR0_0_CURSOR_SURFACE_ADDRESS_HIGH = hubp->att.SURFACE_ADDR_HIGH;
@@ -843,7 +837,7 @@ void dcn60_update_cursor_offload_pipe(struct dc *dc, const struct pipe_ctx *pipe p->HUBPREQ0_CURSOR_SETTINGS__CURSOR0_CHUNK_HDL_ADJUST = hubp->att.settings.bits.chunk_hdl_adjust; p->HUBPREQ0_CURSOR_SETTINGS__FORCE_CURSOR_TO_DISP_PREF = hubp->att.settings.bits.force_cursor_to_disp_pref; - cs->offload_streams[stream_idx].payloads[payload_idx].pipe_mask |= (1u << pipe->pipe_idx); + cs->offload_streams[stream_idx].payloads[payload_idx].pipe_mask |= (1u << pipe_idx); }/**
drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.h +2 -1
@@ -24,7 +24,8 @@ enum dc_status dcn60_apply_single_controller_ctx_to_hw(void dcn60_init_hw (struct dc *dc);void dcn60_set_cursor_attribute (struct pipe_ctx *pipe_ctx); -void dcn60_update_cursor_offload_pipe (struct dc *dc,const struct pipe_ctx *pipe); +void dcn60_update_cursor_offload_pipe (struct dmub_srv *dmub,uint32_t stream_idx, +uint8_t pipe_idx,const struct dpp *dpp,const struct hubp *hubp);void dcn60_program_perfmon (struct dc *dc,struct dc_state *context);bool dcn60_apply_idle_power_optimizations (struct dc *dc,bool enable);
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +36 -20
94 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 2/66 drm/amd/display: Update LLS and UPSP programming paths
In reply to Chenyu ChenFrom: Alvin Lee <[email protected]>
[Description]
- UPSP should only be enabled when we want linear scaling for 420/422
- In DC for non-FP16 formats that are told to scale in non-linear, program bypass for PRE_GAM since these formats are already non-linear (i.e., YUV420, YUV422, RGB, etc.)
--- .../gpu/drm/amd/display/dc/core/dc_resource.c | 18 ++++++++++++---- .../drm/amd/display/dc/dpp/dcn50/dcn50_dpp.c | 20 +++++++++++++----- .../drm/amd/display/dc/dpp/dcn50/dcn50_dpp.h | 3 ++- .../amd/display/dc/hwss/dcn32/dcn32_hwseq.c | 21 ++++++++++++++++++- drivers/gpu/drm/amd/display/dc/inc/hw/dpp.h | 3 ++- drivers/gpu/drm/amd/display/dc/inc/resource.h | 3 ++- 6 files changed, 55 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +14 -4
@@ -1557,11 +1557,21 @@ void resource_build_test_pattern_params(struct resource_context *res_ctx, } } -enum upsp_mode resource_is_upsp_required (enum surface_pixel_format format) +enum upsp_mode resource_is_upsp_required (enum surface_pixel_format format, +enum dc_scaling_linearity scaling_linearity) { -if (format >=SURFACE_PIXEL_FORMAT_VIDEO_BEGIN && format <= SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCrCb)//420 Formats +bool scaling_in_linear = (scaling_linearity ==DC_SCALING_LINEARITY_LINEAR ); +bool is_420_format = (format >=SURFACE_PIXEL_FORMAT_VIDEO_BEGIN && + format <= SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCrCb); +bool is_422_format = (format > SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCrCb && + format <SURFACE_PIXEL_FORMAT_SUBSAMPLE_END ); + +/* UPSP (chroma upsampling) is only needed when subsampled YUV is scaled in +* linear space. +*/ +if (scaling_in_linear && is_420_format)return UPSP_HORIZONTAL_VERTICAL_UPSAMPLING ; -if (format > SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCrCb && format <SURFACE_PIXEL_FORMAT_SUBSAMPLE_END )//422 Formats +if (scaling_in_linear && is_422_format)return UPSP_HORIZONTAL_UPSAMPLING_ONLY ;return UPSP_BYPASS ; }
@@ -1611,7 +1621,7 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx) pipe_ctx->plane_res.scl_data.lb_params.depth =LB_PIXEL_DEPTH_30BPP ; pipe_ctx->plane_res.scl_data.lb_params.alpha_en = plane_state->per_pixel_alpha; - pipe_ctx->plane_res.scl_data.upsp =resource_is_upsp_required (plane_state->format); + pipe_ctx->plane_res.scl_data.upsp =resource_is_upsp_required (plane_state->format, plane_state->scaling_linearity);// Convert pipe_ctx to respective input params for SPL translate_SPL_in_params_from_pipe_ctx (pipe_ctx, spl_in);
drivers/gpu/drm/amd/display/dc/dpp/dcn50/dcn50_dpp.c +15 -5
@@ -25,17 +25,27 @@void dpp50_set_pregam_state (struct dpp *dpp_base,enum dc_transfer_func_predefined tr, -enum dc_scaling_linearity scaling) +enum dc_scaling_linearity scaling, +bool source_is_linear) {struct dcn50_dpp *dpp =TO_DCN50_DPP (dpp_base);enum pregam_mode pre_degam_en =PREGAM_DEGAM ;enum degam_lut degamma_lut_selection =0 ;if (scaling ==DC_SCALING_LINEARITY_SOURCE ) { -//If scaling in non-linear, apply regamma -REG_SET_2 (PRE_GAM ,0 , -PRE_GAM_MODE ,PREGAM_REGAM , -PRE_REGAM_SELECT ,REGAM_20 ); +if (source_is_linear) { +//Linear source data (e.g. FP16) must be de-linearized +//(apply regamma) before scaling in source/non-linear space. +REG_SET_2 (PRE_GAM ,0 , +PRE_GAM_MODE ,PREGAM_REGAM , +PRE_REGAM_SELECT ,REGAM_20 ); + }else { +//Non-linear source data (e.g. YUV) is already in source +//space, so scale directly with no pregam conversion. +REG_SET_2 (PRE_GAM ,0 , +PRE_GAM_MODE ,PREGAM_BYPASS , +PRE_DEGAM_SELECT ,0 ); + } }else {//If scaling in linear, apply degamma based on TF switch (tr) {
drivers/gpu/drm/amd/display/dc/dpp/dcn50/dcn50_dpp.h +2 -1
@@ -82,6 +82,7 @@ void dpp50_dpp_setup(void dpp50_set_pregam_state (struct dpp *dpp_base,enum dc_transfer_func_predefined tr, -enum dc_scaling_linearity scaling); +enum dc_scaling_linearity scaling, +bool source_is_linear);#endif /* __DCN50_DPP_H__ */
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +20 -1
@@ -528,6 +528,24 @@ bool dcn32_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp,return result; } +/* +* FP16 / 64bpp 16161616 surfaces store pixel data in linear light. These are +* the only source formats that must be de-linearized before scaling in +* source/non-linear space; every other format is already non-linear. +*/ +static bool is_source_pixel_format_linear (enum surface_pixel_format format) +{ +switch (format) { +case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616 : +case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616 : +case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616F : +case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F : +return true; +default : +return false; + } +} +bool dcn32_set_input_transfer_func (struct set_input_transfer_func_params *params) {struct dce_hwseq *hws = params->dc->hwseq;
@@ -547,7 +565,8 @@ bool dcn32_set_input_transfer_func(struct set_input_transfer_func_params *params tf = plane_state->in_transfer_func.tf;if (dpp->funcs->dpp_set_pregam_state) - dpp->funcs->dpp_set_pregam_state (dpp, tf, plane_state->scaling_linearity); + dpp->funcs->dpp_set_pregam_state (dpp, tf, plane_state->scaling_linearity, +is_source_pixel_format_linear (plane_state->format));else dpp->funcs->dpp_set_pre_degam (dpp, tf);
drivers/gpu/drm/amd/display/dc/inc/hw/dpp.h +2 -1
@@ -378,7 +378,8 @@ struct dpp_funcs {void (*dpp_set_pregam_state)(struct dpp *dpp_base,enum dc_transfer_func_predefined tr, -enum dc_scaling_linearity scaling); +enum dc_scaling_linearity scaling, +bool source_is_linear);void (*dpp_program_upsp)(struct dpp *dpp_base,const struct dscl_prog_data *dscl_prog_data);
drivers/gpu/drm/amd/display/dc/inc/resource.h +2 -1
@@ -123,7 +123,8 @@ void resource_build_test_pattern_params(struct resource_context *res_ctx, struct pipe_ctx *pipe_ctx); -enum upsp_mode resource_is_upsp_required (enum surface_pixel_format format); +enum upsp_mode resource_is_upsp_required (enum surface_pixel_format format, +enum dc_scaling_linearity scaling_linearity);bool resource_build_scaling_params (struct pipe_ctx *pipe_ctx);
Signature · 1 line
2.43.0
PATCH 3/66 drm/amd/display: Refactor RMCM into a separate module
In reply to Chenyu ChenFrom: Rafal Ostrowski <[email protected]>
[WHY]
The RMCM logic was embedded inside the MPC block, sharing its source files, functions, register definitions and other logic. This tight coupling created several problems:
- The RMCM vtable was bolted onto struct mpc_funcs, making it impossible to instantiate RMCM independently of MPC
- RMCM resource acquisition had no tracking - there was no mechanism to allocate the 2 available RMCM instances to pipes or release them
[HOW]
RMCM is now a separate module:
- dc/rmcm/ directory with per-ASIC implementations
- new struct rmcm with its own funcs vtable containing shaper, 3DLUT, and fast-load operations
- removed all RMCM code from MPC
- added RMCM resource lifecycle management in dc_resource.c:
- resource_assign_rmcm(): Assigns the instances for a whole context, so a plane that is only now asking never evicts one already using an instance
- resource_release_rmcm(): Clears the pipe's allocation.
- updated resource pool constructors (dcn42, dcn42b, dcn60) to create RMCM instances via the new dcnXX_rmcm_create() and destroy them in pool teardown
--- drivers/gpu/drm/amd/display/Makefile | 1 + drivers/gpu/drm/amd/display/dc/Makefile | 2 +- drivers/gpu/drm/amd/display/dc/core/dc.c | 2 - .../drm/amd/display/dc/core/dc_hw_sequencer.c | 7 +- .../gpu/drm/amd/display/dc/core/dc_resource.c | 101 ++ .../gpu/drm/amd/display/dc/core/dc_state.c | 2 - .../gpu/drm/amd/display/dc/core/dc_stream.c | 66 -- drivers/gpu/drm/amd/display/dc/dc.h | 6 +- drivers/gpu/drm/amd/display/dc/dc_stream.h | 11 - .../amd/display/dc/hubp/dcn401/dcn401_hubp.c | 4 + .../amd/display/dc/hubp/dcn42/dcn42_hubp.c | 1 - .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 65 +- .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 4 + .../amd/display/dc/hwss/dcn32/dcn32_hwseq.c | 22 +- .../amd/display/dc/hwss/dcn35/dcn35_hwseq.c | 4 + .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 9 + .../amd/display/dc/hwss/dcn42/dcn42_hwseq.c | 270 ++++-- .../amd/display/dc/hwss/dcn42/dcn42_hwseq.h | 15 +- .../amd/display/dc/hwss/dcn42/dcn42_init.c | 5 +- .../amd/display/dc/hwss/dcn60/dcn60_hwseq.c | 122 +++ .../amd/display/dc/hwss/dcn60/dcn60_hwseq.h | 2 + .../amd/display/dc/hwss/dcn60/dcn60_init.c | 7 +- .../drm/amd/display/dc/hwss/hw_sequencer.h | 2 + .../display/dc/hwss/hw_sequencer_private.h | 4 + .../gpu/drm/amd/display/dc/inc/core_types.h | 4 +- drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h | 1 + drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h | 64 -- drivers/gpu/drm/amd/display/dc/inc/hw/rmcm.h | 140 +++ drivers/gpu/drm/amd/display/dc/inc/resource.h | 15 + .../drm/amd/display/dc/mpc/dcn42/dcn42_mpc.c | 679 -------------- .../drm/amd/display/dc/mpc/dcn42/dcn42_mpc.h | 714 +-------------- .../drm/amd/display/dc/mpc/dcn60/dcn60_mpc.c | 40 - .../drm/amd/display/dc/mpc/dcn60/dcn60_mpc.h | 238 ----- .../dc/resource/dcn42/dcn42_resource.c | 56 +- .../dc/resource/dcn42b/dcn42b_resource.c | 57 +- .../dc/resource/dcn60/dcn60_resource.c | 17 +- drivers/gpu/drm/amd/display/dc/rmcm/Makefile | 44 + .../amd/display/dc/rmcm/dcn42/dcn42_rmcm.c | 867 ++++++++++++++++++ .../amd/display/dc/rmcm/dcn42/dcn42_rmcm.h | 717 +++++++++++++++ .../amd/display/dc/rmcm/dcn60/dcn60_rmcm.c | 251 +++++ .../amd/display/dc/rmcm/dcn60/dcn60_rmcm.h | 35 + 41 files changed, 2711 insertions(+), 1962 deletions(-) create mode 100644 drivers/gpu/drm/amd/display/dc/inc/hw/rmcm.h create mode 100644 drivers/gpu/drm/amd/display/dc/rmcm/Makefile create mode 100644 drivers/gpu/drm/amd/display/dc/rmcm/dcn42/dcn42_rmcm.c create mode 100644 drivers/gpu/drm/amd/display/dc/rmcm/dcn42/dcn42_rmcm.h create mode 100644 drivers/gpu/drm/amd/display/dc/rmcm/dcn60/dcn60_rmcm.c create mode 100644 drivers/gpu/drm/amd/display/dc/rmcm/dcn60/dcn60_rmcm.h
drivers/gpu/drm/amd/display/Makefile +1 -0
@@ -42,6 +42,7 @@ subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/dwb subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/hpo subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/mmhubbub subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/mpc +subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/rmcm subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/opp subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/pg subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/soc_and_ip_translator
drivers/gpu/drm/amd/display/dc/Makefile +1 -1
@@ -22,7 +22,7 @@ # # Makefile for Display Core (dc) component. -DC_LIBS = basics bios dml clk_mgr dce gpio hwss irq link dsc resource optc dpp hubbub dccg hubp dio dwb hpo mmhubbub mpc opp pg +DC_LIBS = basics bios dml clk_mgr dce gpio hwss irq link dsc resource optc dpp hubbub dccg hubp dio dwb hpo mmhubbub mpc opp pg rmcm ifdef CONFIG_DRM_AMD_DC_FP
drivers/gpu/drm/amd/display/dc/core/dc.c +0 -2
@@ -993,8 +993,6 @@ static bool dc_construct_ctx(struct dc *dc,if (!dc_ctx)return false; -dc_stream_init_rmcm_3dlut (dc); - dc_ctx->cgs_device = init_params->cgs_device; dc_ctx->driver_context = init_params->driver; dc_ctx->dc = dc;
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +6 -1
@@ -1489,7 +1489,9 @@ void hwss_build_fast_sequence(struct dc *dc,if (current_mpc_pipe->plane_state->update_bits.lut_3d && current_mpc_pipe->plane_state->cm.flags.bits.lut3d_dma_enable && - current_mpc_pipe->plane_state->cm.flags.bits.shaper_enable && +/* RMCM drives the 3DLUT without a shaper */ + (current_mpc_pipe->plane_state->cm.flags.bits.shaper_enable || + current_mpc_pipe->plane_state->cm.flags.bits.rmcm_enable) && current_mpc_pipe->plane_state->cm.flags.bits.lut3d_enable && current_mpc_pipe->plane_res.hubp->funcs->hubp_enable_3dlut_fl) { block_sequence[*num_steps].params.hubp_enable_3dlut_fl_params.hubp =
@@ -1510,6 +1512,7 @@ void hwss_build_fast_sequence(struct dc *dc, primary_dpp_pipe->plane_res.hubp : current_mpc_pipe->plane_res.hubp, .ipp = current_mpc_pipe->plane_res.ipp, .mpc = dc->res_pool->mpc, + .rmcm = current_mpc_pipe->plane_res.rmcm, .mpcc_id = current_mpc_pipe->plane_res.mpcc_inst, .stream = current_mpc_pipe->stream, .plane_state = current_mpc_pipe->plane_state,
@@ -2368,6 +2371,7 @@ void hwss_add_dpp_set_input_transfer_func(struct block_sequence_state *seq_state primary_dpp_pipe->plane_res.hubp : pipe_ctx->plane_res.hubp, .ipp = pipe_ctx->plane_res.ipp, .mpc = dc->res_pool->mpc, + .rmcm = pipe_ctx->plane_res.rmcm, .mpcc_id = pipe_ctx->plane_res.mpcc_inst, .plane_state = pipe_ctx->plane_state, .stream = pipe_ctx->stream,
@@ -4644,6 +4648,7 @@ void hwss_set_input_transfer_func(struct dc *dc, struct pipe_ctx *pipe_ctx) primary_dpp_pipe->plane_res.hubp : pipe_ctx->plane_res.hubp, .ipp = pipe_ctx->plane_res.ipp, .mpc = dc->res_pool->mpc, + .rmcm = pipe_ctx->plane_res.rmcm, .mpcc_id = pipe_ctx->plane_res.mpcc_inst, .plane_state = pipe_ctx->plane_state, .stream = pipe_ctx->stream,
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +101 -0
119 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/core/dc_state.c +0 -2
@@ -467,8 +467,6 @@ enum dc_status dc_state_remove_stream(return DC_ERROR_UNEXPECTED ; } -dc_stream_release_3dlut_for_stream (dc, stream); -dc_stream_release (state->streams[i]); state->stream_count--;
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +0 -66
72 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dc.h +1 -5
@@ -37,6 +37,7 @@#include "link_service_types.h" #include "grph_object_ctrl_defs.h" #include <inc/hw/opp.h> +#include <inc/hw/rmcm.h> #include "hwss/hw_sequencer.h" #include "inc/compressor.h"
@@ -1514,11 +1515,6 @@ struct lut_mem_mapping {uint16_t size; }; -struct dc_rmcm_3dlut { -bool isInUse; -const struct dc_stream_state *stream; -}; -struct dc_3dlut {struct kref refcount;struct tetrahedral_params lut_3d;
drivers/gpu/drm/amd/display/dc/dc_stream.h +0 -11
@@ -611,17 +611,6 @@ bool dc_stream_set_gamut_remap(struct dc *dc,bool dc_stream_program_csc_matrix (struct dc *dc,struct dc_stream_state *stream); -struct dc_rmcm_3dlut *dc_stream_get_3dlut_for_stream ( -const struct dc *dc, -const struct dc_stream_state *stream, -bool allocate_one); - -void dc_stream_release_3dlut_for_stream ( -const struct dc *dc, -const struct dc_stream_state *stream); - -void dc_stream_init_rmcm_3dlut (struct dc *dc); -struct pipe_ctx *dc_stream_get_pipe_ctx (struct dc_stream_state *stream); void dc_dmub_update_dirty_rect(struct dc *dc,
drivers/gpu/drm/amd/display/dc/hubp/dcn401/dcn401_hubp.c +4 -0
@@ -126,6 +126,10 @@ static enum hubp_3dlut_fl_width hubp401_get_3dlut_fl_width(enum hubp_3dlut_fl_width width =0 ;switch (size) { +case CM_LUT_SIZE_999 : +ASSERT (swizzle !=CM_LUT_1D_PACKED_LINEAR ); + width = hubp_3dlut_fl_width_9; +break ;case CM_LUT_SIZE_333333 :ASSERT (swizzle !=CM_LUT_1D_PACKED_LINEAR ); width = hubp_3dlut_fl_width_33;
drivers/gpu/drm/amd/display/dc/hubp/dcn42/dcn42_hubp.c +0 -1
@@ -732,7 +732,6 @@ struct hubp_funcs dcn42_hubp_funcs = { .hubp_program_3dlut_fl_crossbar = hubp42_program_3dlut_fl_crossbar, .hubp_get_3dlut_fl_done = hubp401_get_3dlut_fl_done, .hubp_clear_tiling = hubp3_clear_tiling, - .hubp_program_3dlut_fl_config = hubp401_program_3dlut_fl_config, .hubp_read_reg_state = hubp3_read_reg_state };
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +34 -31
88 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +4 -0
@@ -719,6 +719,10 @@ void dcn20_plane_atomic_disable(struct dc *dc, struct pipe_ctx *pipe_ctx)struct hubp *hubp = pipe_ctx->plane_res.hubp;struct dpp *dpp = pipe_ctx->plane_res.dpp; +/* Clearing 3DLUT fast load writes to HUBP, so it must precede hubp_clk_cntl() below */ +if (hws->funcs.disable_rmcm_luts) + hws->funcs.disable_rmcm_luts (dc, pipe_ctx->plane_res.rmcm, hubp, pipe_ctx->plane_res.mpcc_inst); + dc->hwss.wait_for_mpcc_disconnect (dc, dc->res_pool, pipe_ctx);/* In flip immediate with pipe splitting case GSL is used for
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +18 -4
@@ -579,10 +579,24 @@ bool dcn32_set_input_transfer_func(struct set_input_transfer_func_params *params dpp->funcs->dpp_program_gamcor_lut (dpp, pwl_params); -if (hws->funcs.set_mcm_luts) - result = hws->funcs.set_mcm_luts (params->dc, dpp, params->hubp, - params->primary_hubp, params->mpc, params->mpcc_id, - params->stream, plane_state); +/* MCM and RMCM are mutually exclusive - tear the inactive one out before programming +* the active one, which then owns the shared HUBP 3DLUT fast load. +*/ +if (plane_state->cm.flags.bits.rmcm_enable && hws->funcs.set_rmcm_luts) { +if (hws->funcs.disable_mcm_luts) + hws->funcs.disable_mcm_luts (params->mpc, params->mpcc_id); + + result = hws->funcs.set_rmcm_luts (params); + }else { +if (hws->funcs.disable_rmcm_luts) + hws->funcs.disable_rmcm_luts (params->dc, params->rmcm, + params->hubp, params->mpcc_id); + +if (hws->funcs.set_mcm_luts) + result = hws->funcs.set_mcm_luts (params->dc, dpp, params->hubp, + params->primary_hubp, params->mpc, params->mpcc_id, + params->stream, plane_state); + }return result; }
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c +4 -0
@@ -872,9 +872,13 @@ void dcn35_enable_plane(struct dc *dc, struct pipe_ctx *pipe_ctx,*/ void dcn35_plane_atomic_disable (struct dc *dc,struct pipe_ctx *pipe_ctx) { +struct dce_hwseq *hws = dc->hwseq;struct hubp *hubp = pipe_ctx->plane_res.hubp;struct dpp *dpp = pipe_ctx->plane_res.dpp; +/* Clearing 3DLUT fast load writes to HUBP, so it must precede hubp_clk_cntl() below */ +if (hws->funcs.disable_rmcm_luts) + hws->funcs.disable_rmcm_luts (dc, pipe_ctx->plane_res.rmcm, hubp, pipe_ctx->plane_res.mpcc_inst); dc->hwss.wait_for_mpcc_disconnect (dc, dc->res_pool, pipe_ctx);
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +9 -0
@@ -457,6 +457,9 @@ bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp,/* 1D LUT */ lut_enable = cm->flags.bits.blend_enable !=0u ; +if (cm->flags.bits.rmcm_enable) + lut_enable = false; +memset (&m_lut_params,0 ,sizeof (m_lut_params));if (lut_enable) {if (cm->blend_func.type ==TF_TYPE_HWPWL )
@@ -483,6 +486,9 @@ bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp,/* Shaper */ lut_enable = cm->flags.bits.shaper_enable !=0u ; +if (cm->flags.bits.rmcm_enable) + lut_enable = false; +if (lut_enable) {memset (&m_lut_params,0 ,sizeof (m_lut_params));if (cm->shaper_func.type ==TF_TYPE_HWPWL )
@@ -514,6 +520,9 @@ bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp,/* 3DLUT */ lut_enable = cm->flags.bits.lut3d_enable !=0u ; +if (cm->flags.bits.rmcm_enable) + lut_enable = false; +if (lut_enable && cm->flags.bits.lut3d_dma_enable) {/* Fast (DMA) Load Mode */ /* MPC */
drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.c +185 -85
322 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.h +7 -8
@@ -20,14 +20,13 @@ bool dcn42_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp,struct dc_stream_state *stream, struct dc_plane_state *plane_state); -bool dcn42_program_rmcm_luts ( -struct dc *dc, -struct dpp *dpp, -struct hubp *hubp, -const struct dc_plane_cm *cm, -struct mpc *mpc, -int mpcc_id, -struct dc_stream_state *stream); +void dcn42_disable_rmcm_luts (struct dc *dc,struct rmcm *rmcm,struct hubp *hubp,int mpcc_id); +void dcn42_release_rmcm_from_mpcc (struct dc *dc,int mpcc_id,const struct rmcm *keep); +void dcn42_disable_mcm_luts (struct mpc *mpc,int mpcc_id); +void dcn42_trigger_3dlut_dma_load (struct pipe_ctx *pipe_ctx); + +bool dcn42_set_rmcm_luts (struct set_input_transfer_func_params *params); +void dcn42_hardware_release (struct dc *dc); void dcn42_prepare_bandwidth(
drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_init.c +4 -1
@@ -29,7 +29,7 @@ static const struct hw_sequencer_funcs dcn42_funcs = { .update_dchub = dcn10_update_dchub, .update_pending_status = dcn10_update_pending_status, .program_output_csc = dcn20_program_output_csc, - .trigger_3dlut_dma_load = dcn401_trigger_3dlut_dma_load, + .trigger_3dlut_dma_load = dcn42_trigger_3dlut_dma_load, .enable_accelerated_mode = dce110_enable_accelerated_mode, .enable_timing_synchronization = dcn10_enable_timing_synchronization, .enable_per_frame_crtc_position_reset = dcn10_enable_per_frame_crtc_position_reset,
@@ -151,6 +151,9 @@ static const struct hwseq_private_funcs dcn42_private_funcs = { .set_hdr_multiplier = dcn10_set_hdr_multiplier, .wait_for_blank_complete = dcn20_wait_for_blank_complete, .set_mcm_luts = dcn42_set_mcm_luts, + .set_rmcm_luts = dcn42_set_rmcm_luts, + .disable_mcm_luts = dcn42_disable_mcm_luts, + .disable_rmcm_luts = dcn42_disable_rmcm_luts, .program_mall_pipe_config = dcn32_program_mall_pipe_config, .update_mall_sel = dcn32_update_mall_sel, .calculate_dccg_k1_k2_values = NULL,
drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.c +122 -0
134 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.h +2 -0
@@ -30,4 +30,6 @@ void dcn60_update_cursor_offload_pipe(struct dmub_srv *dmub, uint32_t stream_idxvoid dcn60_program_perfmon (struct dc *dc,struct dc_state *context);bool dcn60_apply_idle_power_optimizations (struct dc *dc,bool enable); +bool dcn60_set_rmcm_luts (struct set_input_transfer_func_params *params); +#endif /* __DC_HWSS_DCN60_H__ */
drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_init.c +5 -2
@@ -28,7 +28,7 @@ static const struct hw_sequencer_funcs dcn60_funcs = { .update_dchub = dcn10_update_dchub, .update_pending_status = dcn10_update_pending_status, .program_output_csc = dcn20_program_output_csc, - .trigger_3dlut_dma_load = dcn401_trigger_3dlut_dma_load, + .trigger_3dlut_dma_load = dcn42_trigger_3dlut_dma_load, .enable_accelerated_mode = dce110_enable_accelerated_mode, .enable_timing_synchronization = dcn10_enable_timing_synchronization, .enable_per_frame_crtc_position_reset = dcn10_enable_per_frame_crtc_position_reset,
@@ -147,7 +147,7 @@ static const struct hwseq_private_funcs dcn60_private_funcs = { .init_blank = dcn32_init_blank, .disable_vga = NULL, .bios_golden_init = dcn10_bios_golden_init, - .plane_atomic_disable = dcn20_plane_atomic_disable, + .plane_atomic_disable = dcn35_plane_atomic_disable, .plane_atomic_power_down = dcn401_plane_atomic_power_down, .plane_atomic_power_down_sequence = dcn401_plane_atomic_power_down_sequence, .enable_power_gating_plane = NULL,
@@ -162,6 +162,9 @@ static const struct hwseq_private_funcs dcn60_private_funcs = { .set_hdr_multiplier_sequence = dcn401_set_hdr_multiplier_sequence, .wait_for_blank_complete = dcn20_wait_for_blank_complete, .set_mcm_luts = dcn42_set_mcm_luts, + .set_rmcm_luts = dcn60_set_rmcm_luts, + .disable_mcm_luts = dcn42_disable_mcm_luts, + .disable_rmcm_luts = dcn42_disable_rmcm_luts, .program_mall_pipe_config = NULL, .update_mall_sel = NULL, .calculate_dccg_k1_k2_values = NULL,
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +2 -0
@@ -46,6 +46,7 @@ struct resource_pool;struct dc_phy_addr_space_config ;struct dc_virtual_addr_space_config ;struct dpp ; +struct rmcm ;struct dce_hwseq ;struct link_resource ;struct dc_dmub_cmd ;
@@ -101,6 +102,7 @@ struct set_input_transfer_func_params {struct hubp *hubp;struct hubp *primary_hubp;struct mpc *mpc; +struct rmcm *rmcm;int mpcc_id;struct dc_stream_state *stream;struct input_pixel_processor *ipp;
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer_private.h +4 -0
@@ -73,6 +73,7 @@ struct timing_generator;struct tg_color ;struct output_pixel_processor ;struct mpcc_blnd_cfg ; +struct rmcm ;struct hwseq_private_funcs {
@@ -193,6 +194,9 @@ struct hwseq_private_funcs { struct hubp *primary_hubp, struct mpc *mpc, int mpcc_id, struct dc_stream_state *stream, struct dc_plane_state *plane_state); +bool (*set_rmcm_luts)(struct set_input_transfer_func_params *params); +void (*disable_mcm_luts)(struct mpc *mpc,int mpcc_id); +void (*disable_rmcm_luts)(struct dc *dc,struct rmcm *rmcm,struct hubp *hubp,int mpcc_id);void (*PLAT_58856_wa)(struct dc_state *context,struct pipe_ctx *pipe_ctx);void (*setup_hpo_hw_control)(const struct dce_hwseq *hws,bool enable);
drivers/gpu/drm/amd/display/dc/inc/core_types.h +3 -1
@@ -308,7 +308,7 @@ struct resource_pool {struct hpo_dp_link_encoder *hpo_dp_link_enc[MAX_HPO_DP2_LINK_ENCODERS ];struct dc_3dlut *mpc_lut[MAX_PIPES ];struct dc_transfer_func *mpc_shaper[MAX_PIPES ]; -struct dc_rmcm_3dlut rmcm_3dlut[MAX_RMCM_INST ]; +struct rmcm *rmcm[MAX_RMCM_INST ];struct {unsigned int xtalin_clock_inKhz;
@@ -401,6 +401,7 @@ struct plane_resource {struct transform *xfm;struct dpp *dpp;uint8_t mpcc_inst; +struct rmcm *rmcm;struct dcn_fe_bandwidth bw; };
@@ -558,6 +559,7 @@ struct resource_context {unsigned int hpo_dp_link_enc_to_link_idx[MAX_HPO_DP2_LINK_ENCODERS ];int hpo_dp_link_enc_ref_cnts[MAX_HPO_DP2_LINK_ENCODERS ];bool is_mpc_3dlut_acquired[MAX_PIPES ]; +bool rmcm_in_use[MAX_RMCM_INST ];/* used to build scalar data in dml2 and for edp backlight programming */ struct pipe_ctx temp_pipe; };
drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h +1 -0
@@ -87,6 +87,7 @@ enum hubp_3dlut_fl_addressing_mode { };enum hubp_3dlut_fl_width { + hubp_3dlut_fl_width_9 =9 , hubp_3dlut_fl_width_17 =17 , hubp_3dlut_fl_width_33 =33 , hubp_3dlut_fl_width_17_transformed =4916 ,//mpc default
drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h +0 -64
82 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/inc/hw/rmcm.h new file +140 -0
140 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/inc/resource.h +15 -0
@@ -336,6 +336,21 @@ void resource_remove_dpp_pipes_for_plane_composition(const struct resource_pool *pool, const struct dc_plane_state *plane_state); +/* +* RMCM resource management. Instances are handed out for a whole context at once so that a +* plane that is only now asking cannot evict one that is already using an instance. +* Tracking is via res_ctx->rmcm_in_use[]. +*/ +void resource_assign_rmcm ( +struct dc_state *new_ctx, +const struct dc_state *cur_ctx, +const struct resource_pool *pool); + +void resource_release_rmcm ( +struct resource_context *res_ctx, +const struct resource_pool *pool, +struct rmcm **rmcm); +/* * Update ODM slice count by acquiring or releasing pipes. If new slices need * to be added, it is going to add them to the last ODM index. If existing
drivers/gpu/drm/amd/display/dc/mpc/dcn42/dcn42_mpc.c +0 -679
699 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/mpc/dcn42/dcn42_mpc.h +3 -711
735 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/mpc/dcn60/dcn60_mpc.c +0 -40
@@ -111,34 +111,6 @@ static struct mpcc *mpc60_insert_plane(return new_mpcc; } -void mpc60_program_rmcm_lut_read_write_control (struct mpc *mpc,const enum MCM_LUT_ID id, -bool lut_bank_a,bool enabled,int mpcc_id) -{ -struct dcn60_mpc *mpc60 =TO_DCN60_MPC (mpc); - -switch (id) { -case MCM_LUT_3DLUT : -REG_UPDATE (MPC_RMCM_3DLUT_MODE [mpcc_id],MPC_RMCM_3DLUT_MODE , - (!enabled) ?0 : - (lut_bank_a) ?1 :2 ); -break ; - -case MCM_LUT_SHAPER : -REG_UPDATE (MPC_RMCM_SHAPER_LUT_WRITE_EN_MASK [mpcc_id], -MPC_RMCM_SHAPER_LUT_WRITE_EN_MASK ,7 ); - -REG_UPDATE (MPC_RMCM_SHAPER_LUT_WRITE_EN_MASK [mpcc_id], -MPC_RMCM_SHAPER_LUT_WRITE_SEL , - lut_bank_a == true ?0 :1 ); - -REG_SET (MPC_RMCM_SHAPER_LUT_INDEX [mpcc_id],0 , -MPC_RMCM_SHAPER_LUT_INDEX ,0 ); -break ; -default : -break ; - } -} - static void mpc60_program_lut_read_write_control(struct mpc *mpc, const enum MCM_LUT_ID id, const bool lut_bank_a,
@@ -288,18 +260,6 @@ static const struct mpc_funcs dcn60_mpc_funcs = { .program_lut_read_write_control = mpc60_program_lut_read_write_control, .program_lut_mode = mpc60_program_lut_mode, .get_lut_mode = mpc401_get_lut_mode, - .rmcm = { - .enable_3dlut_fl = mpc42_enable_3dlut_fl, - .update_3dlut_fast_load_select = mpc42_update_3dlut_fast_load_select, - .program_lut_read_write_control = mpc60_program_rmcm_lut_read_write_control, - .program_lut_mode = mpc42_program_lut_mode, - .program_3dlut_size = mpc42_program_rmcm_3dlut_size, - .program_bias_scale = mpc42_program_rmcm_3dlut_fast_load_bias_scale, - .program_bit_depth = mpc42_program_rmcm_bit_depth, - .power_on_shaper_3dlut = mpc42_power_on_rmcm_shaper_3dlut, - .populate_lut = mpc42_populate_rmcm_lut, - .get_3dlut_mode = mpc42_get_rmcm_3dlut_mode, - }, }; void dcn60_mpc_construct(struct dcn60_mpc *mpc60,
drivers/gpu/drm/amd/display/dc/mpc/dcn60/dcn60_mpc.h +0 -238
216 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c +53 -3
56 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c +54 -3
57 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/resource/dcn60/dcn60_resource.c +14 -3
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/display/dc/rmcm/Makefile new file +44 -0
44 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/rmcm/dcn42/dcn42_rmcm.c new file +867 -0
867 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/rmcm/dcn42/dcn42_rmcm.h new file +717 -0
717 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/rmcm/dcn60/dcn60_rmcm.c new file +251 -0
251 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/rmcm/dcn60/dcn60_rmcm.h new file +35 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.43.0
Part of the diff is not shown here. View the raw message.
PATCH 4/66 drm/amd/display: Remove SDPIF_PORT_CONTROL programming for DCN31/35/42
In reply to Chenyu ChenFrom: Ovidiu Bunea <[email protected]>
[why & how]
DCN IP team recommends SDPIF_PORT_CONTROL=0 as POR value for APUs.
The new POR value ensures that DCHUBBUB will not disconnect the SDP port to DF unless it explicitly receives the pre_cstate_req signal. SDPIF_PORT_CONTROL=1 will only be used for IPS entry sequences, where it will be restored to 0 upon IPS exit.
--- .../drm/amd/display/dc/hubbub/dcn31/dcn31_hubbub.c | 5 ----- .../drm/amd/display/dc/hubbub/dcn35/dcn35_hubbub.c | 7 +------ .../drm/amd/display/dc/hubbub/dcn42/dcn42_hubbub.c | 13 +------------ 3 files changed, 2 insertions(+), 23 deletions(-)
drivers/gpu/drm/amd/display/dc/hubbub/dcn31/dcn31_hubbub.c +0 -5
@@ -1048,11 +1048,6 @@ void hubbub31_init(struct hubbub *hubbub)DISPCLK_R_DCHUBBUB_GATE_DIS ,1 , DCFCLK_R_DCHUBBUB_GATE_DIS, 1); } - -/* -only the DCN will determine when to connect the SDP port -*/ -REG_UPDATE (DCHUBBUB_SDPIF_CFG0 ,SDPIF_PORT_CONTROL ,1 ); }static const struct hubbub_funcs hubbub31_funcs = { .update_dchub = hubbub2_update_dchub,
drivers/gpu/drm/amd/display/dc/hubbub/dcn35/dcn35_hubbub.c +1 -6
@@ -531,12 +531,7 @@ void hubbub35_init(struct hubbub *hubbub)hubbub35_set_fgcg (hubbub2, hubbub->ctx->dc->debug.enable_fine_grain_clock_gating .bits.dchubbub); -/* -ignore the "df_pre_cstate_req" from the SDP port control. -only the DCN will determine when to connect the SDP port -*/ -REG_UPDATE (DCHUBBUB_SDPIF_CFG0 , -SDPIF_PORT_CONTROL ,1 ); +/*Set SDP's max outstanding request When set to 1: Max outstanding is 512 When set to 0: Max outstanding is 256
drivers/gpu/drm/amd/display/dc/hubbub/dcn42/dcn42_hubbub.c +1 -12
@@ -431,13 +431,6 @@ static void hubbub42_allow_self_refresh_control(struct hubbub *hubbub, bool alloDCHUBBUB_ARB_ALLOW_SELF_REFRESH_FORCE_VALUE ,0 , DCHUBBUB_ARB_ALLOW_SELF_REFRESH_FORCE_ENABLE, !allow); } -static void hubbub42_set_sdp_control (struct hubbub *hubbub,bool dc_control) -{ -struct dcn20_hubbub *hubbub2 =TO_DCN20_HUBBUB (hubbub); - -REG_UPDATE (DCHUBBUB_SDPIF_CFG0 , -SDPIF_PORT_CONTROL , dc_control); -} static bool hubbub42_program_watermarks( struct hubbub *hubbub,
@@ -449,9 +442,8 @@ static bool hubbub42_program_watermarks(struct dcn20_hubbub *hubbub2 =TO_DCN20_HUBBUB (hubbub);if (!safe_to_lower && hubbub->ctx->dc->debug.disable_stutter_for_wm_program) { -/* before raising watermarks, SDP control give to DF, stutter must be disabled */ +/* before raising watermarks, stutter must be disabled */ wm_pending = true; -hubbub42_set_sdp_control (hubbub, false);hubbub42_allow_self_refresh_control (hubbub, false); }if (hubbub42_program_urgent_watermarks (hubbub, watermarks, safe_to_lower))
@@ -478,9 +470,6 @@ static bool hubbub42_program_watermarks(if (safe_to_lower || hubbub->ctx->dc->debug.disable_stutter)hubbub42_allow_self_refresh_control (hubbub, !hubbub->ctx->dc->debug.disable_stutter); -if (safe_to_lower && hubbub->ctx->dc->debug.disable_stutter_for_wm_program) { -hubbub42_set_sdp_control (hubbub, true); - }hubbub32_force_usr_retraining_allow (hubbub, hubbub->ctx->dc->debug.force_usr_allow);return wm_pending;
Signature · 1 line
2.43.0
PATCH 5/66 drm/amd/display: Test sink stream creation
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Add KUnit tests for create_stream_for_sink() covering the preferred mode timing recalculation, the scaled path that keeps the previous refresh rate, the automated test timing override, the DisplayPort VSC SDP colorimetry decision with and without the disable-colorimetry quirk, and the HDMI vendor specific infoframe path.
--- .../tests/amdgpu_dm_connector_test.c | 218 ++++++++++++++++++ 1 file changed, 218 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c +218 -0
@@ -27,6 +27,7 @@#include "amdgpu_dm.h" #include "amdgpu_dm_connector.h" #include "amdgpu_dm_backlight.h" +#include "amdgpu_dm_psr.h" #include "include/grph_object_id.h" #include "amdgpu_dm_kunit_test_helpers.h" #include "inc/link_service.h"
@@ -4146,6 +4147,217 @@ static void dm_test_create_stream_existing_sink(struct kunit *test)dc_sink_release (sink); } +/* Append a copy of the context mode to the connector's mode list. */ +static void dm_test_stream_add_mode (struct kunit *test,struct dm_test_stream_ctx *ctx, +u32 type) +{ +struct drm_display_mode *mode =drm_mode_create (ctx->drm); + +KUNIT_ASSERT_NOT_NULL (test, mode); +drm_mode_copy (mode, ctx->mode); + mode->type = type; +list_add_tail (&mode->head, &ctx->aconnector->base.modes); +} + +/* Give the context mode a full set of CRTC timings. */ +static void dm_test_stream_set_timings (struct dm_test_stream_ctx *ctx) +{ + ctx->mode->hsync_start =2008 ; + ctx->mode->hsync_end =2052 ; + ctx->mode->htotal =2200 ; + ctx->mode->vsync_start =1084 ; + ctx->mode->vsync_end =1089 ; + ctx->mode->vtotal =1125 ; +} + +/* Create a real dc_sink of @signal owned by the caller. */ +static struct dc_sink *dm_test_stream_add_sink (struct kunit *test, +struct dm_test_stream_ctx *ctx, +enum signal_type signal) +{ +struct dc_sink_init_data sink_init = {0 }; +struct dc_sink *sink; + + sink_init.link = ctx->link; + sink_init.sink_signal = signal; + sink =dc_sink_create (&sink_init); +KUNIT_ASSERT_NOT_NULL (test, sink); + sink->sink_signal = signal; + ctx->aconnector->dc_sink = sink; + +return sink; +} + +/** +* dm_test_create_stream_preferred_mode - Test the preferred mode drives the timing +* @test: The KUnit test context +* +* A preferred mode in the connector's mode list is used to recompute the CRTC +* timings of the requested mode before the stream properties are filled in. +*/ +static void dm_test_create_stream_preferred_mode (struct kunit *test) +{ +struct dm_test_stream_ctx *ctx =dm_test_stream_ctx_alloc (test); +struct dc_stream_state *stream; + +dm_test_stream_set_timings (ctx); +dm_test_stream_add_mode (test, ctx,DRM_MODE_TYPE_PREFERRED ); + + stream =create_stream_for_sink (&ctx->aconnector->base, ctx->mode, + ctx->dm_state,NULL ,8 , +PIXEL_ENCODING_RGB , false); + +KUNIT_ASSERT_NOT_NULL (test, stream); +KUNIT_EXPECT_EQ (test, (int )stream->timing.h_addressable,1920 ); +KUNIT_EXPECT_EQ (test, (int )stream->timing.v_addressable,1080 ); +KUNIT_EXPECT_EQ (test, (int )stream->timing.h_total,2200 ); +KUNIT_EXPECT_EQ (test, (int )stream->timing.v_total,1125 ); +dc_stream_release (stream); +} + +/** +* dm_test_create_stream_scaled_keeps_refresh - Test scaling reuses the old timing +* @test: The KUnit test context +* +* With scaling enabled and an unchanged refresh rate the stream properties are +* filled from the old stream so the VIC and sync polarities are preserved. +*/ +static void dm_test_create_stream_scaled_keeps_refresh (struct kunit *test) +{ +struct dm_test_stream_ctx *ctx =dm_test_stream_ctx_alloc (test); +struct dc_stream_state *stream; + +dm_test_stream_set_timings (ctx); +dm_test_stream_add_mode (test, ctx,DRM_MODE_TYPE_PREFERRED ); + ctx->dm_state->scaling =RMX_FULL ; + + stream =create_stream_for_sink (&ctx->aconnector->base, ctx->mode, + ctx->dm_state,NULL ,8 , +PIXEL_ENCODING_RGB , false); + +KUNIT_ASSERT_NOT_NULL (test, stream); +KUNIT_EXPECT_EQ (test, (int )stream->timing.h_addressable,1920 ); +dc_stream_release (stream); +} + +/** +* dm_test_create_stream_timing_override - Test the automated test timing override +* @test: The KUnit test context +* +* A connector carrying a requested timing from an automated test replaces the +* timing derived from the mode. +*/ +static void dm_test_create_stream_timing_override (struct kunit *test) +{ +struct dm_test_stream_ctx *ctx =dm_test_stream_ctx_alloc (test); +struct dc_crtc_timing *timing; +struct dc_stream_state *stream; + + timing =kunit_kzalloc (test,sizeof (*timing),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, timing); + timing->h_addressable =1280 ; + timing->v_addressable =720 ; + timing->display_color_depth =COLOR_DEPTH_101010 ; + + ctx->aconnector->timing_changed = true; + ctx->aconnector->timing_requested = timing; + + stream =create_stream_for_sink (&ctx->aconnector->base, ctx->mode, + ctx->dm_state,NULL ,8 , +PIXEL_ENCODING_RGB , false); + +KUNIT_ASSERT_NOT_NULL (test, stream); +KUNIT_EXPECT_EQ (test, (int )stream->timing.h_addressable,1280 ); +KUNIT_EXPECT_EQ (test, (int )stream->timing.display_color_depth, + (int )COLOR_DEPTH_101010 ); +dc_stream_release (stream); +} + +/** +* dm_test_create_stream_dp_vsc_colorimetry - Test the DP VSC SDP colorimetry decision +* @test: The KUnit test context +* +* A DisplayPort sink on a DPCD 1.4 link advertising VSC SDP colorimetry, and +* without the disable-colorimetry quirk, enables VSC SDP colorimetry and +* arms the self refresh entry delay. +*/ +static void dm_test_create_stream_dp_vsc_colorimetry (struct kunit *test) +{ +struct dm_test_stream_ctx *ctx =dm_test_stream_ctx_alloc (test); +struct dc_stream_state *stream; +struct dc_sink *sink; + + sink =dm_test_stream_add_sink (test, ctx,SIGNAL_TYPE_DISPLAY_PORT ); + ctx->link->dpcd_caps.dpcd_rev.raw =0x14 ; + ctx->link->dpcd_caps.dprx_feature.bits.VSC_SDP_COLORIMETRY_SUPPORTED =1 ; + + stream =create_stream_for_sink (&ctx->aconnector->base, ctx->mode, + ctx->dm_state,NULL ,8 , +PIXEL_ENCODING_RGB , false); + +KUNIT_ASSERT_NOT_NULL (test, stream); +KUNIT_EXPECT_EQ (test, (int )stream->signal, (int )SIGNAL_TYPE_DISPLAY_PORT ); +KUNIT_EXPECT_TRUE (test, stream->use_vsc_sdp_for_colorimetry); +KUNIT_EXPECT_EQ (test, ctx->aconnector->sr_skip_count,AMDGPU_DM_PSR_ENTRY_DELAY ); + +dc_stream_release (stream); +dc_sink_release (sink); +} + +/** +* dm_test_create_stream_dp_colorimetry_quirk - Test the disable colorimetry quirk +* @test: The KUnit test context +*/ +static void dm_test_create_stream_dp_colorimetry_quirk (struct kunit *test) +{ +struct dm_test_stream_ctx *ctx =dm_test_stream_ctx_alloc (test); +struct dc_stream_state *stream; +struct dc_sink *sink; + + sink =dm_test_stream_add_sink (test, ctx,SIGNAL_TYPE_DISPLAY_PORT ); + sink->edid_caps.panel_patch.disable_colorimetry = true; + ctx->link->dpcd_caps.dpcd_rev.raw =0x14 ; + ctx->link->dpcd_caps.dprx_feature.bits.VSC_SDP_COLORIMETRY_SUPPORTED =1 ; + + stream =create_stream_for_sink (&ctx->aconnector->base, ctx->mode, + ctx->dm_state,NULL ,8 , +PIXEL_ENCODING_RGB , false); + +KUNIT_ASSERT_NOT_NULL (test, stream); +KUNIT_EXPECT_FALSE (test, stream->use_vsc_sdp_for_colorimetry); + +dc_stream_release (stream); +dc_sink_release (sink); +} + +/** +* dm_test_create_stream_hdmi_vsif - Test the HDMI vendor specific infoframe +* @test: The KUnit test context +* +* An HDMI sink takes the HDMI Forum vendor specific infoframe path. A plain +* 2D, non-HDMI-VIC timing carries no payload, so the packet stays invalid. +*/ +static void dm_test_create_stream_hdmi_vsif (struct kunit *test) +{ +struct dm_test_stream_ctx *ctx =dm_test_stream_ctx_alloc (test); +struct dc_stream_state *stream; +struct dc_sink *sink; + + ctx->link->connector_signal =SIGNAL_TYPE_HDMI_TYPE_A ; + sink =dm_test_stream_add_sink (test, ctx,SIGNAL_TYPE_HDMI_TYPE_A ); + + stream =create_stream_for_sink (&ctx->aconnector->base, ctx->mode, + ctx->dm_state,NULL ,8 , +PIXEL_ENCODING_RGB , false); + +KUNIT_ASSERT_NOT_NULL (test, stream); +KUNIT_EXPECT_EQ (test, (int )stream->signal, (int )SIGNAL_TYPE_HDMI_TYPE_A ); +KUNIT_EXPECT_FALSE (test, stream->vsp_infopacket.valid); + +dc_stream_release (stream); +dc_sink_release (sink); +} +/* Tests for amdgpu_dm_connector_detect() */ /*
@@ -9087,6 +9299,12 @@ static struct kunit_case amdgpu_dm_connector_tests[] = {KUNIT_CASE (dm_test_create_stream_virtual_signal),KUNIT_CASE (dm_test_create_stream_scaling_src),KUNIT_CASE (dm_test_create_stream_existing_sink), +KUNIT_CASE (dm_test_create_stream_preferred_mode), +KUNIT_CASE (dm_test_create_stream_scaled_keeps_refresh), +KUNIT_CASE (dm_test_create_stream_timing_override), +KUNIT_CASE (dm_test_create_stream_dp_vsc_colorimetry), +KUNIT_CASE (dm_test_create_stream_dp_colorimetry_quirk), +KUNIT_CASE (dm_test_create_stream_hdmi_vsif),/* amdgpu_dm_connector_detect */ KUNIT_CASE (dm_test_detect_force_on), KUNIT_CASE(dm_test_detect_force_on_digital),
Signature · 1 line
2.43.0
PATCH 6/66 drm/amd/display: Test connector init helper
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Add KUnit tests for amdgpu_dm_connector_init_helper() covering the common connector defaults and attached properties, the HDMI, DisplayPort, DVI-D, VGA, eDP and unhandled connector types, an MST branch connector that skips the root-only properties, the content protection property and the default HPD debounce delay.
--- .../display/amdgpu_dm/amdgpu_dm_connector.c | 1 + .../tests/amdgpu_dm_connector_test.c | 355 ++++++++++++++++++ 2 files changed, 356 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c +1 -0
@@ -3263,6 +3263,7 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, } } } +EXPORT_IF_KUNIT (amdgpu_dm_connector_init_helper); STATIC_IFN_KUNIT int amdgpu_dm_i2c_xfer(struct i2c_adapter *i2c_adap,struct i2c_msg *msgs,int num)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c +355 -0
373 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 7/66 drm/amd/display: Test HDMI connector init
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Add a KUnit test for amdgpu_dm_initialize_hdmi_connector() verifying that a CEC notifier is created for the connector.
--- .../display/amdgpu_dm/amdgpu_dm_connector.c | 1 + .../tests/amdgpu_dm_connector_test.c | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c +1 -0
@@ -3368,6 +3368,7 @@ int amdgpu_dm_initialize_hdmi_connector(struct amdgpu_dm_connector *aconnector)return 0 ; } +EXPORT_IF_KUNIT (amdgpu_dm_initialize_hdmi_connector);/* * Note: this function assumes that dc_link_detect() was called for the
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c +20 -0
@@ -9422,6 +9422,24 @@ static void dm_test_init_helper_hpd_debounce_disabled(struct kunit *test)KUNIT_EXPECT_EQ (test, ctx->aconnector->hdmi_hpd_debounce_delay_ms,0 ); } +/* Tests for amdgpu_dm_initialize_hdmi_connector() */ + +/** +* dm_test_initialize_hdmi_cec_registers - Test the CEC notifier is registered +* @test: The KUnit test context +* +* Without DC_DISABLE_HDMI_CEC in the debug mask a CEC notifier is created for +* the connector. +*/ +static void dm_test_initialize_hdmi_cec_registers (struct kunit *test) +{ +struct dm_test_init_helper_ctx *ctx = +dm_test_init_helper_ctx_alloc (test,DRM_MODE_CONNECTOR_HDMIA ); + +KUNIT_EXPECT_EQ (test,amdgpu_dm_initialize_hdmi_connector (ctx->aconnector),0 ); +KUNIT_EXPECT_NOT_NULL (test, ctx->aconnector->notifier); +} +static struct kunit_case amdgpu_dm_connector_tests[] = {/* get_subconnector_type */ KUNIT_CASE (dm_test_subconnector_type_none),
@@ -9830,6 +9848,8 @@ static struct kunit_case amdgpu_dm_connector_tests[] = {KUNIT_CASE (dm_test_init_helper_edp),KUNIT_CASE (dm_test_init_helper_hdcp_property),KUNIT_CASE (dm_test_init_helper_hpd_debounce_disabled), +/* amdgpu_dm_initialize_hdmi_connector */ + KUNIT_CASE(dm_test_initialize_hdmi_cec_registers), {} };
Signature · 1 line
2.43.0
PATCH 8/66 drm/amd/display: Test FreeSync caps update
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Add KUnit tests for amdgpu_dm_update_freesync_caps() covering the DisplayPort invalid-MSA refresh range along with its narrow-range and valid-MSA-required rejections, an eDP panel advertising replay, the HDMI AMD VSDB range with and without a parser, a whitelisted DP to HDMI converter, the forced FreeSync minimum quirk, the MCCS capability withdrawal and the replay teardown.
--- .../display/amdgpu_dm/amdgpu_dm_connector.c | 1 + .../tests/amdgpu_dm_connector_test.c | 431 ++++++++++++++++++ 2 files changed, 432 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c +1 -0
@@ -4001,3 +4001,4 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,drm_connector_set_vrr_capable_property (connector, freesync_capable); } +EXPORT_IF_KUNIT (amdgpu_dm_update_freesync_caps);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c +431 -0
443 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 9/66 drm/amd/display: Test connector init
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Add KUnit tests for amdgpu_dm_connector_init() covering a HDMI link that is fully brought up, a DVI link that maps to a DVI-D connector without a CEC notifier, and the get_modes() helper hook it installs.
--- .../display/amdgpu_dm/amdgpu_dm_connector.c | 1 + .../tests/amdgpu_dm_connector_test.c | 190 ++++++++++++++++++ 2 files changed, 191 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c +1 -0
@@ -3446,6 +3446,7 @@ int amdgpu_dm_connector_init(struct amdgpu_display_manager *dm, }return res; } +EXPORT_IF_KUNIT (amdgpu_dm_connector_init);static int dm_force_atomic_commit (struct drm_connector *connector) {
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c +190 -0
208 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 10/66 drm/amd/display: Test forced atomic commit
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Add KUnit tests for dm_force_atomic_commit() covering a successful restore of the connector, its CRTC and the CRTC primary plane, and the error path taken when the connector state cannot be duplicated.
--- .../display/amdgpu_dm/amdgpu_dm_connector.c | 3 +- .../display/amdgpu_dm/amdgpu_dm_connector.h | 1 + .../tests/amdgpu_dm_connector_test.c | 131 ++++++++++++++++++ 3 files changed, 134 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c +2 -1
@@ -3448,7 +3448,7 @@ int amdgpu_dm_connector_init(struct amdgpu_display_manager *dm, }EXPORT_IF_KUNIT (amdgpu_dm_connector_init); -static int dm_force_atomic_commit (struct drm_connector *connector) +STATIC_IFN_KUNIT int dm_force_atomic_commit(struct drm_connector *connector) {int ret =0 ;struct drm_device *ddev = connector->dev;
@@ -3508,6 +3508,7 @@ static int dm_force_atomic_commit(struct drm_connector *connector)return ret; } +EXPORT_IF_KUNIT (dm_force_atomic_commit);/* * This function handles all cases when set mode does not come upon hotplug.
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.h +1 -0
@@ -239,5 +239,6 @@ void amdgpu_dm_update_cacp_caps(struct amdgpu_dm_connector *aconnector);struct drm_atomic_commit ;int amdgpu_dm_connector_atomic_check (struct drm_connector *conn,struct drm_atomic_commit *state); +int dm_force_atomic_commit (struct drm_connector *connector);#endif #endif /* __AMDGPU_DM_CONNECTOR_H__ */
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c +131 -0
143 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 11/66 drm/amd/display: Test DCC reject for multi-plane format
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Extend the amdgpu_dm_plane_format_mod_supported() test to cover the rejection of a format that carries an extra plane alongside a DCC modifier.
[HOW]
Reuse the existing GFX9 DCC modifier and ask for XRGB8888_A8, whose 4 bytes-per-pixel main plane passes the bpp check but whose alpha plane collides with the DCC metadata plane.
--- .../drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +5 -0
@@ -506,6 +506,11 @@ static void dm_test_format_mod_supported(struct kunit *test)KUNIT_EXPECT_FALSE (test,amdgpu_dm_plane_format_mod_supported (plane,DRM_FORMAT_NV12 , listed_mod)); + +/* 4 bytes per pixel, but its extra plane collides with the DCC metadata plane. */ +KUNIT_EXPECT_FALSE (test, +amdgpu_dm_plane_format_mod_supported (plane,DRM_FORMAT_XRGB8888_A8 , + listed_mod)); }/**
Signature · 1 line
2.43.0
PATCH 12/66 drm/amd/display: Test modifier list growth failure
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Add a KUnit test for amdgpu_dm_plane_add_modifier() covering the allocation failure that happens while growing the modifier list.
[HOW]
Seed a capacity whose doubling overflows the kmalloc_array() size product, so the allocation fails without fault injection, and assert the list is released and cleared for the caller.
--- .../amdgpu_dm/tests/amdgpu_dm_plane_test.c | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +23 -0
@@ -3686,6 +3686,28 @@ 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 ); +} +static struct kunit_case amdgpu_dm_plane_test_cases[] = {/* amdgpu_dm_plane_is_video_format() */ KUNIT_CASE (dm_test_plane_is_video_format_known_video),
@@ -3782,6 +3804,7 @@ static struct kunit_case amdgpu_dm_plane_test_cases[] = {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),/* 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),
Signature · 1 line
2.43.0
PATCH 13/66 drm/amd/display: Test pre-GFX9 plane buffer attributes
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Add a KUnit test for amdgpu_dm_plane_fill_plane_buffer_attributes() covering the pre-Vega dispatch to the GFX6 modifier decoder.
[HOW]
Run a GFX6-family framebuffer through a 1D tiled modifier and check the decoded tiling version, then repeat with a GFX9 modifier to check that the decode error is propagated instead.
--- .../amdgpu_dm/tests/amdgpu_dm_plane_test.c | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +47 -0
@@ -3708,6 +3708,52 @@ static void dm_test_add_modifier_alloc_failure(struct kunit *test)KUNIT_EXPECT_EQ (test, size,1ULL <<62 ); } +/** +* dm_test_fill_plane_buffer_attributes_gfx6() - Verify the pre-GFX9 dispatch. +* @test: KUnit test context. +* +* Verify if a pre-Vega family decodes tiling from the GFX6 modifier instead of +* taking the GFX9 or GFX12 modifier paths, and propagates the decode error for +* a modifier the GFX6 decoder does not understand. +*/ +static void dm_test_fill_plane_buffer_attributes_gfx6 (struct kunit *test) +{ +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 amdgpu_framebuffer *afb; +struct amdgpu_device *adev; + + adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); + afb =kunit_kzalloc (test,sizeof (*afb),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, adev); +KUNIT_ASSERT_NOT_NULL (test, afb); + + adev->family =AMDGPU_FAMILY_CZ ; + afb->address =0x80000000ULL ; + afb->base.width =1920 ; + afb->base.height =1080 ; + afb->base.pitches[0 ] =7680 ; + afb->base.format =drm_format_info (DRM_FORMAT_XRGB8888 ); +KUNIT_ASSERT_NOT_NULL (test, afb->base.format); + afb->base.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 ); + +KUNIT_EXPECT_EQ (test,dm_test_graphics_attrs (adev, afb, &tiling_info, + &plane_size, &dcc, &address),0 ); +KUNIT_EXPECT_EQ (test, address.type, (int )PLN_ADDR_TYPE_GRAPHICS ); +KUNIT_EXPECT_EQ (test, (int )tiling_info.gfxversion, (int )DcGfxVersion8); + + afb->base.modifier =AMD_FMT_MOD | +AMD_FMT_MOD_SET (TILE_VERSION ,AMD_FMT_MOD_TILE_VER_GFX9 ); + +KUNIT_EXPECT_EQ (test,dm_test_graphics_attrs (adev, afb, &tiling_info, + &plane_size, &dcc, &address), -EINVAL ); +} +static struct kunit_case amdgpu_dm_plane_test_cases[] = {/* amdgpu_dm_plane_is_video_format() */ KUNIT_CASE (dm_test_plane_is_video_format_known_video),
@@ -3746,6 +3792,7 @@ static struct kunit_case amdgpu_dm_plane_test_cases[] = {/* 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),
Signature · 1 line
2.43.0
PATCH 14/66 drm/amd/display: Test accepted plane atomic check
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Add a KUnit test for amdgpu_dm_plane_atomic_check() covering the success path taken once DC validation accepts the plane.
[HOW]
Extend the shared atomic-check fixture with a resource pool that has no validate_plane callback, so dc_validate_plane() only inspects the source and destination rectangles.
--- .../amdgpu_dm/tests/amdgpu_dm_plane_test.c | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +36 -0
@@ -3754,6 +3754,41 @@ static void dm_test_fill_plane_buffer_attributes_gfx6(struct kunit *test) &plane_size, &dcc, &address), -EINVAL); } +/** +* dm_test_atomic_check_success() - Verify a fully valid plane state is accepted. +* @test: KUnit test context. +* +* Verify if atomic_check reports success once DC validation accepts the plane. +* The resource pool exposes no validate_plane callback, so DC falls back to +* checking the source and destination rectangles only. +*/ +static void dm_test_atomic_check_success (struct kunit *test) +{ +struct dm_plane_state *dm_plane_state; +struct drm_crtc_state *new_crtc_state; +struct drm_atomic_commit *state; +struct resource_pool *res_pool; +struct amdgpu_device *adev; +struct drm_framebuffer *fb; +struct drm_plane *plane; + + adev =dm_test_init_atomic_check_state (test, &state, &plane, &dm_plane_state, + &new_crtc_state, &fb); + res_pool =kunit_kzalloc (test,sizeof (*res_pool),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, res_pool); + res_pool->funcs =kunit_kzalloc (test,sizeof (*res_pool->funcs),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, res_pool->funcs); + + adev->dm.dc->res_pool = res_pool; + + dm_plane_state->dc_state->src_rect.width =100 ; + dm_plane_state->dc_state->src_rect.height =100 ; + dm_plane_state->dc_state->dst_rect.width =100 ; + dm_plane_state->dc_state->dst_rect.height =100 ; + +KUNIT_EXPECT_EQ (test,amdgpu_dm_plane_atomic_check (plane, state),0 ); +} +static struct kunit_case amdgpu_dm_plane_test_cases[] = {/* amdgpu_dm_plane_is_video_format() */ KUNIT_CASE (dm_test_plane_is_video_format_known_video),
@@ -3837,6 +3872,7 @@ static struct kunit_case amdgpu_dm_plane_test_cases[] = {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_success),/* amdgpu_dm_plane_panic_flush() */ KUNIT_CASE(dm_test_panic_flush_no_dc_state),/* amdgpu_dm_plane_drm_plane_reset() */
Signature · 1 line
2.43.0
PATCH 15/66 drm/amd/display: Test cursor update without DC stream
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Add KUnit tests for amdgpu_dm_plane_handle_cursor_update() covering a cursor reported as disabled, and an enabled cursor whose attributes are assembled before DC programming.
[HOW]
Add a fixture binding a 64x64 cursor plane to an amdgpu_crtc whose DM CRTC state carries no stream. Place the cursor off the left edge for the disabled case, and advertise the degamma ROM capability for the enabled case.
--- .../amdgpu_dm/tests/amdgpu_dm_plane_test.c | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +98 -0
@@ -3789,6 +3789,102 @@ static void dm_test_atomic_check_success(struct kunit *test)KUNIT_EXPECT_EQ (test,amdgpu_dm_plane_atomic_check (plane, state),0 ); } +struct dm_test_cursor_ctx { +struct amdgpu_device *adev; +struct amdgpu_crtc *acrtc; +struct dm_crtc_state *crtc_state; +struct drm_plane_state *state; +struct drm_plane_state old_state; +struct drm_plane *plane; +}; + +/* +* Build a 64x64 cursor plane bound to an amdgpu_crtc whose DM CRTC state +* carries no DC stream, so the cursor update stops before programming DC. +*/ +static struct dm_test_cursor_ctx *dm_test_alloc_cursor_ctx (struct kunit *test) +{ +struct amdgpu_framebuffer *afb; +struct dm_test_cursor_ctx *ctx; + + ctx =kunit_kzalloc (test,sizeof (*ctx),GFP_KERNEL ); + afb =kunit_kzalloc (test,sizeof (*afb),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, ctx); +KUNIT_ASSERT_NOT_NULL (test, afb); + + ctx->adev =dm_kunit_alloc_adev (test); + ctx->acrtc =kunit_kzalloc (test,sizeof (*ctx->acrtc),GFP_KERNEL ); + ctx->crtc_state =kunit_kzalloc (test,sizeof (*ctx->crtc_state),GFP_KERNEL ); + ctx->state =kunit_kzalloc (test,sizeof (*ctx->state),GFP_KERNEL ); + ctx->plane =kunit_kzalloc (test,sizeof (*ctx->plane),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, ctx->acrtc); +KUNIT_ASSERT_NOT_NULL (test, ctx->crtc_state); +KUNIT_ASSERT_NOT_NULL (test, ctx->state); +KUNIT_ASSERT_NOT_NULL (test, ctx->plane); + + ctx->adev->dm.dc =dm_kunit_alloc_dc_with_ctx (test); + + ctx->acrtc->base.dev = &ctx->adev->ddev; + ctx->acrtc->base.state = &ctx->crtc_state->base; + ctx->acrtc->max_cursor_width =64 ; + ctx->acrtc->max_cursor_height =64 ; + + afb->address =0x80000000ULL ; + afb->base.pitches[0 ] =256 ; + afb->base.format =drm_format_info (DRM_FORMAT_ARGB8888 ); +KUNIT_ASSERT_NOT_NULL (test, afb->base.format); + + ctx->state->fb = &afb->base; + ctx->state->crtc = &ctx->acrtc->base; + ctx->state->crtc_w =64 ; + ctx->state->crtc_h =64 ; + + ctx->plane->dev = &ctx->adev->ddev; + ctx->plane->state = ctx->state; + +return ctx; +} + +/** +* dm_test_handle_cursor_update_disabled() - Verify the cursor-off path. +* @test: KUnit test context. +* +* Verify if a cursor positioned fully off the left edge is treated as disabled +* and returns before the cursor geometry is latched on the CRTC. +*/ +static void dm_test_handle_cursor_update_disabled (struct kunit *test) +{ +struct dm_test_cursor_ctx *ctx =dm_test_alloc_cursor_ctx (test); + + ctx->state->crtc_x =-64 ; + +amdgpu_dm_plane_handle_cursor_update (ctx->plane, &ctx->old_state); + +KUNIT_EXPECT_EQ (test, ctx->acrtc->cursor_width,0 ); +KUNIT_EXPECT_EQ (test, ctx->acrtc->cursor_height,0 ); +} + +/** +* dm_test_handle_cursor_update_no_stream() - Verify cursor attribute assembly. +* @test: KUnit test context. +* +* Verify if an enabled cursor latches its geometry on the CRTC and builds the +* DC cursor attributes, including the degamma ROM bit, before stopping at the +* missing DC stream. +*/ +static void dm_test_handle_cursor_update_no_stream (struct kunit *test) +{ +struct dm_test_cursor_ctx *ctx =dm_test_alloc_cursor_ctx (test); + + ctx->crtc_state->cm_is_degamma_srgb = true; + ctx->adev->dm.dc->caps.color.dpp.gamma_corr = true; + +amdgpu_dm_plane_handle_cursor_update (ctx->plane, &ctx->old_state); + +KUNIT_EXPECT_EQ (test, ctx->acrtc->cursor_width,64 ); +KUNIT_EXPECT_EQ (test, ctx->acrtc->cursor_height,64 ); +} +static struct kunit_case amdgpu_dm_plane_test_cases[] = {/* amdgpu_dm_plane_is_video_format() */ KUNIT_CASE (dm_test_plane_is_video_format_known_video),
@@ -3861,6 +3957,8 @@ static struct kunit_case amdgpu_dm_plane_test_cases[] = {KUNIT_CASE (dm_test_helper_cleanup_fb_no_fb),/* amdgpu_dm_plane_handle_cursor_update() */ KUNIT_CASE (dm_test_handle_cursor_update_no_fb), +KUNIT_CASE (dm_test_handle_cursor_update_disabled), +KUNIT_CASE (dm_test_handle_cursor_update_no_stream),/* amdgpu_dm_plane_atomic_async_update() */ KUNIT_CASE(dm_test_atomic_async_update_copies_state),/* amdgpu_dm_plane_atomic_async_check() */
Signature · 1 line
2.43.0
PATCH 16/66 drm/amd/display: Test panic flush DCC teardown
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Add a KUnit test for amdgpu_dm_plane_panic_flush() covering the request to clear DCC and tiling on the active pipe.
[HOW]
Install a spy on dc->hwss.clear_surface_dcc_and_tiling and drive the flush with a non-linear framebuffer, counting the calls that ask for the tiling teardown.
--- .../amdgpu_dm/tests/amdgpu_dm_plane_test.c | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +57 -0
@@ -3885,6 +3885,62 @@ static void dm_test_handle_cursor_update_no_stream(struct kunit *test)KUNIT_EXPECT_EQ (test, ctx->acrtc->cursor_height,64 ); } +static int dm_test_clear_dcc_tiling_count; + +static void dm_test_clear_surface_dcc_and_tiling (struct pipe_ctx *pipe_ctx, +struct dc_plane_state *plane_state, +bool clear_tiling) +{ +if (clear_tiling) + dm_test_clear_dcc_tiling_count++; +} + +/** +* dm_test_panic_flush_disables_dcc() - Verify panic flush disables DCC. +* @test: KUnit test context. +* +* Verify if panic_flush asks DC to clear DCC on the active pipe, and requests +* the tiling teardown as well when the framebuffer is not linear. +*/ +static void dm_test_panic_flush_disables_dcc (struct kunit *test) +{ +struct dc_plane_state *dc_plane_state; +struct dm_plane_state *dm_plane_state; +struct resource_pool *res_pool; +struct drm_framebuffer *fb; +struct drm_plane *plane; +struct dc *dc; + + plane =kunit_kzalloc (test,sizeof (*plane),GFP_KERNEL ); + dm_plane_state =kunit_kzalloc (test,sizeof (*dm_plane_state),GFP_KERNEL ); + dc_plane_state =kunit_kzalloc (test,sizeof (*dc_plane_state),GFP_KERNEL ); + fb =kunit_kzalloc (test,sizeof (*fb),GFP_KERNEL ); + res_pool =kunit_kzalloc (test,sizeof (*res_pool),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, plane); +KUNIT_ASSERT_NOT_NULL (test, dm_plane_state); +KUNIT_ASSERT_NOT_NULL (test, dc_plane_state); +KUNIT_ASSERT_NOT_NULL (test, fb); +KUNIT_ASSERT_NOT_NULL (test, res_pool); + + dc =dm_kunit_alloc_dc_with_ctx (test); + dc->current_state =dm_kunit_alloc_dc_state (test); + dc->hwss.clear_surface_dcc_and_tiling = dm_test_clear_surface_dcc_and_tiling; + res_pool->pipe_count =1 ; + dc->res_pool = res_pool; + dc_plane_state->ctx = dc->ctx; + + fb->modifier =AMD_FMT_MOD ; + dm_plane_state->base.fb = fb; + dm_plane_state->dc_state = dc_plane_state; + plane->state = &dm_plane_state->base; + + dm_test_clear_dcc_tiling_count =0 ; + +amdgpu_dm_plane_panic_flush (plane); + +KUNIT_EXPECT_EQ (test, dm_test_clear_dcc_tiling_count,1 ); +} +static struct kunit_case amdgpu_dm_plane_test_cases[] = {/* amdgpu_dm_plane_is_video_format() */ KUNIT_CASE (dm_test_plane_is_video_format_known_video),
@@ -3973,6 +4029,7 @@ static struct kunit_case amdgpu_dm_plane_test_cases[] = {KUNIT_CASE (dm_test_atomic_check_success),/* amdgpu_dm_plane_panic_flush() */ KUNIT_CASE (dm_test_panic_flush_no_dc_state), +KUNIT_CASE (dm_test_panic_flush_disables_dcc),/* amdgpu_dm_plane_drm_plane_reset() */ KUNIT_CASE(dm_test_plane_reset_initializes_state),/* amdgpu_dm_plane_drm_plane_duplicate_state() */
Signature · 1 line
2.43.0
PATCH 17/66 drm/amd/display: Test optional plane property creation
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Add KUnit tests for amdgpu_dm_plane_init() covering the rotation property and framebuffer damage clips on newer ASICs, and the default color pipeline on DCN 3.0 and newer.
[HOW]
Initialize an overlay plane on a standard DRM KUnit device, varying the ASIC type, the DCE IP version and the DC context DCE version to select each optional property.
--- .../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 1 + .../amdgpu_dm/tests/amdgpu_dm_plane_test.c | 70 +++++++++++++++++++ 2 files changed, 71 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +1 -0
@@ -2294,6 +2294,7 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,return 0 ; } +EXPORT_IF_KUNIT (amdgpu_dm_plane_init);bool amdgpu_dm_plane_is_video_format (uint32_t format) {
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +70 -0
82 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 18/66 drm/amd/display: Add option for certain panels to disable FEC
In reply to Chenyu ChenFrom: Yi-Ling Chen <[email protected]>
[Why]
Disable FEC for certain panels.
[How]
To align FEC HW/SW status when enabling the option.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc.c +6 -0
@@ -1870,6 +1870,12 @@ bool dc_validate_boot_timing(const struct dc *dc,return false; } +if (sink->edid_caps.panel_patch.disable_fec && + (link->fec_state == dc_link_fec_enabled)) { +DC_LOG_DEBUG ("boot timing validation failed due to FEC WA & FEC HW is active\n" ); +return false; + } +/* Check for enabled DIG to identify enabled display */ if (!link->link_enc->funcs->is_dig_enabled (link->link_enc)) {DC_LOG_DEBUG ("boot timing validation failed due to disabled DIG\n" );
Signature · 1 line
2.43.0
PATCH 19/66 drm/amd/display: Build MST DSC helpers for KUnit
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
The MST DSC helpers in amdgpu_dm_mst_types.c are compiled only when CONFIG_DRM_AMD_DC_FP is enabled, which no UML KUnit build can select, so none of them can be reached from the KUnit suite.
[HOW]
Widen the CONFIG_DRM_AMD_DC_FP guards to also build when CONFIG_DRM_AMD_DC_KUNIT_TEST is set. The only caller of validate_dsc_caps_on_connector() is guarded as well, so guard it by IS_ENABLED() instead to keep it out of the KUnit build while still referencing the helper. With the real bodies now built, dm_mst_test_fp_guarded_public_stubs() no longer describes reachable behaviour, so remove it along with its case entry.
--- .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 12 ++++++------ .../tests/amdgpu_dm_mst_types_test.c | 19 ------------------- 2 files changed, 6 insertions(+), 25 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +6 -6
@@ -278,7 +278,7 @@ bool needs_dsc_aux_workaround(struct dc_link *link) }EXPORT_IF_KUNIT (needs_dsc_aux_workaround); -#if defined(CONFIG_DRM_AMD_DC_FP ) +#if defined(CONFIG_DRM_AMD_DC_FP ) ||IS_ENABLED (CONFIG_DRM_AMD_DC_KUNIT_TEST )static bool is_synaptics_cascaded_panamera (struct dc_link *link,struct drm_dp_mst_port *port) {u8 branch_vendor_data[4 ] = {0 };// Vendor data 0x50C ~ 0x50F
@@ -504,8 +504,8 @@ STATIC_IFN_KUNIT int dm_dp_mst_get_modes(struct drm_connector *connector)amdgpu_dm_update_freesync_caps ( connector, aconnector->drm_edid, true); -#if defined(CONFIG_DRM_AMD_DC_FP ) -if (!validate_dsc_caps_on_connector (aconnector)) +#if defined(CONFIG_DRM_AMD_DC_FP ) ||IS_ENABLED (CONFIG_DRM_AMD_DC_KUNIT_TEST ) +if (IS_ENABLED (CONFIG_DRM_AMD_DC_FP ) && !validate_dsc_caps_on_connector (aconnector))memset (&aconnector->dc_sink->dsc_caps,0 ,sizeof (aconnector->dc_sink->dsc_caps));#endif
@@ -937,7 +937,7 @@ struct dsc_mst_fairness_params {struct amdgpu_dm_connector *aconnector; }; -#if defined(CONFIG_DRM_AMD_DC_FP ) +#if defined(CONFIG_DRM_AMD_DC_FP ) ||IS_ENABLED (CONFIG_DRM_AMD_DC_KUNIT_TEST )static uint16_t get_fec_overhead_multiplier (struct dc_link *dc_link) {u8 link_coding_cap;
@@ -1928,7 +1928,7 @@ static bool is_dsc_common_config_possible(struct dc_stream_state *stream, }#endif -#if defined(CONFIG_DRM_AMD_DC_FP ) +#if defined(CONFIG_DRM_AMD_DC_FP ) ||IS_ENABLED (CONFIG_DRM_AMD_DC_KUNIT_TEST )static bool dp_get_link_current_set_bw (struct drm_dp_aux *aux,uint32_t *cur_link_bw) {uint32_t total_data_bw_efficiency_x10000 =0 ;
@@ -1990,7 +1990,7 @@ enum dc_status dm_dp_mst_is_port_support_mode( struct amdgpu_dm_connector *aconnector, struct dc_stream_state *stream) { -#if defined(CONFIG_DRM_AMD_DC_FP ) +#if defined(CONFIG_DRM_AMD_DC_FP ) ||IS_ENABLED (CONFIG_DRM_AMD_DC_KUNIT_TEST )int branch_max_throughput_mps =0 ;struct dc_link_settings cur_link_settings;uint32_t end_to_end_bw_in_kbps =0 ;
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c +0 -19
@@ -2058,21 +2058,6 @@ static void dm_mst_test_sideband_msg_ready_ack_write_fails(struct kunit *test)dm_mst_test_free_armed_sideband_connector (aconnector); } -#if !defined(CONFIG_DRM_AMD_DC_FP ) -/** -* dm_mst_test_fp_guarded_public_stubs - Test FP-off public fallbacks -* @test: KUnit test context -* -* When CONFIG_DRM_AMD_DC_FP is disabled, the public DSC validation helper -* has no FP body and must return DC_OK without touching its arguments. -*/ -static void dm_mst_test_fp_guarded_public_stubs (struct kunit *test) -{ -KUNIT_EXPECT_EQ (test,dm_dp_mst_is_port_support_mode (NULL ,NULL ), - (enum dc_status )DC_OK ); -} -#endif -static struct kunit_case dm_mst_types_test_cases[] = {/* needs_dsc_aux_workaround tests */ KUNIT_CASE (dm_mst_test_needs_dsc_aux_workaround_match),
@@ -2152,10 +2137,6 @@ static struct kunit_case dm_mst_types_test_cases[] = {/* dm_dp_mst_connector_destroy tests */ KUNIT_CASE(dm_mst_test_connector_destroy_no_sink), KUNIT_CASE(dm_mst_test_connector_destroy_releases_sink), -/* CONFIG_DRM_AMD_DC_FP disabled public paths */ -#if !defined(CONFIG_DRM_AMD_DC_FP) - KUNIT_CASE(dm_mst_test_fp_guarded_public_stubs), -#endif {} };
Signature · 1 line
2.43.0
PATCH 20/66 drm/amd/display: Test oversized AUX transfer
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Add a KUnit test for dm_dp_aux_transfer() covering the message size rejection path.
[HOW]
Build a drm_dp_aux_msg whose size exceeds the aux_payload buffer and verify that dm_dp_aux_transfer() returns -E2BIG without issuing a transfer.
--- .../tests/amdgpu_dm_mst_types_test.c | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c +21 -0
@@ -885,6 +885,26 @@ static void dm_mst_test_aux_transfer_non_ack_reply(struct kunit *test)KUNIT_EXPECT_EQ (test, dm_mst_test_last_payload.address,4U ); } +/** +* dm_mst_test_aux_transfer_oversized - oversized AUX message is rejected. +* @test: KUnit test context. +* +* The payload is copied into a 16-byte stack buffer, so a larger message must +* be rejected with -E2BIG before the AUX handle is touched. The guard warns, +* which is the expected behaviour for this caller bug. +*/ +static void dm_mst_test_aux_transfer_oversized (struct kunit *test) +{ +struct drm_dp_aux_msg msg = {0 }; +u8 buffer[17 ] = {0 }; + + msg.request =DP_AUX_NATIVE_WRITE ; + msg.buffer = buffer; + msg.size =sizeof (buffer); + +KUNIT_EXPECT_EQ (test,dm_dp_aux_transfer (NULL , &msg), (ssize_t )-E2BIG ); +} +/** * dm_mst_test_fill_payload_flags_native_write - native write request decode. * @test: KUnit test context.
@@ -2089,6 +2109,7 @@ static struct kunit_case dm_mst_types_test_cases[] = {KUNIT_CASE (dm_mst_test_aux_transfer_error_result),KUNIT_CASE (dm_mst_test_aux_transfer_hpd_discon_quirk),KUNIT_CASE (dm_mst_test_aux_transfer_non_ack_reply), +KUNIT_CASE (dm_mst_test_aux_transfer_oversized),/* dm_dp_aux_fill_payload_flags tests */ KUNIT_CASE (dm_mst_test_fill_payload_flags_native_write), KUNIT_CASE(dm_mst_test_fill_payload_flags_native_read),
Signature · 1 line
2.43.0
PATCH 21/66 drm/amd/display: Test MST connector creation
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Add KUnit tests for dm_dp_add_mst_connector() covering successful connector creation, inheritance of the master connector properties and the connector init failure path.
[HOW]
Set up an MST topology manager owned by a master amdgpu_dm_connector plus the mode properties the helper attaches, then add a port and check the resulting connector, its property values and the encoder links. The failure path is driven by a mode config without the connector functions required by drm_connector_init(), and the port reference count is checked to confirm the error unwind releases it.
--- .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 3 +- .../display/amdgpu_dm/amdgpu_dm_mst_types.h | 4 + .../tests/amdgpu_dm_mst_types_test.c | 202 ++++++++++++++++++ 3 files changed, 208 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +2 -1
@@ -660,7 +660,7 @@ dm_dp_create_fake_mst_encoders(struct amdgpu_device *adev) }EXPORT_IF_KUNIT (dm_dp_create_fake_mst_encoders); -static struct drm_connector * +STATIC_IFN_KUNIT struct drm_connector *dm_dp_add_mst_connector (struct drm_dp_mst_topology_mgr *mgr,struct drm_dp_mst_port *port,const char *pathprop)
@@ -742,6 +742,7 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr,return connector; } +EXPORT_IF_KUNIT (dm_dp_add_mst_connector);/* * Select the ESI[1] mask used to filter the MST sideband ready bits for a
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h +4 -0
@@ -65,6 +65,7 @@ struct dc_state;struct dc_stream_state ;struct dm_atomic_state ;struct drm_atomic_commit ; +struct drm_dp_mst_port ;struct drm_dp_mst_topology_mgr ;uint32_t dm_mst_get_pbn_divider (struct dc_link *link);
@@ -119,6 +120,9 @@ int dm_dp_mst_atomic_check(struct drm_connector *connector,int dm_dp_mst_detect (struct drm_connector *connector,struct drm_modeset_acquire_ctx *ctx,bool force);int dm_dp_mst_get_modes (struct drm_connector *connector); +struct drm_connector *dm_dp_add_mst_connector (struct drm_dp_mst_topology_mgr *mgr, +struct drm_dp_mst_port *port, +const char *pathprop);int amdgpu_dm_mst_connector_late_register (struct drm_connector *connector);void amdgpu_dm_mst_connector_early_unregister (struct drm_connector *connector);void dm_dp_mst_connector_destroy (struct drm_connector *connector);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c +202 -0
220 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 22/66 drm/amd/display: Test link bandwidth readback
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Add KUnit tests for dp_get_link_current_set_bw() covering every link rate the helper knows about, the unknown rate fallback and the DPCD read error path.
[HOW]
Add a DPCD backing store for the DSC helpers that is addressed absolutely, because they read offsets spread across the whole map. A table driven test then programs the link rate and lane count into the fake DPCD and checks the returned bandwidth, with one entry arming the AUX transfer to fail.
--- .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 3 +- .../display/amdgpu_dm/amdgpu_dm_mst_types.h | 2 + .../tests/amdgpu_dm_mst_types_test.c | 120 ++++++++++++++++++ 3 files changed, 124 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +2 -1
@@ -1930,7 +1930,7 @@ static bool is_dsc_common_config_possible(struct dc_stream_state *stream,#endif #if defined(CONFIG_DRM_AMD_DC_FP ) ||IS_ENABLED (CONFIG_DRM_AMD_DC_KUNIT_TEST ) -static bool dp_get_link_current_set_bw (struct drm_dp_aux *aux,uint32_t *cur_link_bw) +STATIC_IFN_KUNIT bool dp_get_link_current_set_bw(struct drm_dp_aux *aux, uint32_t *cur_link_bw) {uint32_t total_data_bw_efficiency_x10000 =0 ;uint32_t link_rate_per_lane_kbps =0 ;
@@ -1985,6 +1985,7 @@ static bool dp_get_link_current_set_bw(struct drm_dp_aux *aux, uint32_t *cur_lin *cur_link_bw = link_rate_per_lane_kbps * lane_count.bits.LANE_COUNT_SET /10000 * total_data_bw_efficiency_x10000;return true; } +EXPORT_IF_KUNIT (dp_get_link_current_set_bw);#endif enum dc_status dm_dp_mst_is_port_support_mode(
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h +2 -0
@@ -65,6 +65,7 @@ struct dc_state;struct dc_stream_state ;struct dm_atomic_state ;struct drm_atomic_commit ; +struct drm_dp_aux ;struct drm_dp_mst_port ;struct drm_dp_mst_topology_mgr ;
@@ -104,6 +105,7 @@ enum dc_status dm_dp_mst_is_port_support_mode(#if IS_ENABLED (CONFIG_DRM_AMD_DC_KUNIT_TEST )void amdgpu_dm_mst_reset_mst_connector_setting (struct amdgpu_dm_connector *aconnector); +bool dp_get_link_current_set_bw (struct drm_dp_aux *aux,uint32_t *cur_link_bw);bool retrieve_downstream_port_device (struct amdgpu_dm_connector *aconnector);bool retrieve_branch_specific_data (struct amdgpu_dm_connector *aconnector); ssize_t dm_dp_aux_transfer_result(ssize_t result,
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c +120 -0
132 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 23/66 drm/amd/display: Test cascaded Panamera check
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Add KUnit tests for is_synaptics_cascaded_panamera() covering a matching cascaded hub, a non Synaptics branch, a non Panamera device ID, an unsupported branch firmware revision and a port without a parent branch.
[HOW]
Allocate an MST topology manager with a branch and a port, and drive a table driven test that fills in the branch OUI, device ID and firmware revision for each case before checking the returned verdict.
--- .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 3 +- .../display/amdgpu_dm/amdgpu_dm_mst_types.h | 1 + .../tests/amdgpu_dm_mst_types_test.c | 81 +++++++++++++++++++ 3 files changed, 84 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +2 -1
@@ -279,7 +279,7 @@ bool needs_dsc_aux_workaround(struct dc_link *link)EXPORT_IF_KUNIT (needs_dsc_aux_workaround);#if defined(CONFIG_DRM_AMD_DC_FP ) ||IS_ENABLED (CONFIG_DRM_AMD_DC_KUNIT_TEST ) -static bool is_synaptics_cascaded_panamera (struct dc_link *link,struct drm_dp_mst_port *port) +STATIC_IFN_KUNIT bool is_synaptics_cascaded_panamera(struct dc_link *link, struct drm_dp_mst_port *port) {u8 branch_vendor_data[4 ] = {0 };// Vendor data 0x50C ~ 0x50F
@@ -293,6 +293,7 @@ static bool is_synaptics_cascaded_panamera(struct dc_link *link, struct drm_dp_mreturn false; } +EXPORT_IF_KUNIT (is_synaptics_cascaded_panamera);static bool validate_dsc_caps_on_connector (struct amdgpu_dm_connector *aconnector) {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h +1 -0
@@ -105,6 +105,7 @@ enum dc_status dm_dp_mst_is_port_support_mode(#if IS_ENABLED (CONFIG_DRM_AMD_DC_KUNIT_TEST )void amdgpu_dm_mst_reset_mst_connector_setting (struct amdgpu_dm_connector *aconnector); +bool is_synaptics_cascaded_panamera (struct dc_link *link,struct drm_dp_mst_port *port);bool dp_get_link_current_set_bw (struct drm_dp_aux *aux,uint32_t *cur_link_bw);bool retrieve_downstream_port_device (struct amdgpu_dm_connector *aconnector);bool retrieve_branch_specific_data (struct amdgpu_dm_connector *aconnector);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c +81 -0
93 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 24/66 drm/amd/display: Test DSC caps validation
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Add KUnit tests for validate_dsc_caps_on_connector() covering a port without a DSC AUX channel, the branch AUX workaround, the cascaded Panamera hub override, a DSC caps read failure and a decoder that does not advertise DSC.
[HOW]
Attach the absolute DPCD fake to both the root and the port AUX channels and populate the DSC capability block, then select each path by tuning the branch descriptor and the topology, and check which AUX channel is recorded along with the parsed DSC capabilities.
--- .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 3 +- .../display/amdgpu_dm/amdgpu_dm_mst_types.h | 1 + .../tests/amdgpu_dm_mst_types_test.c | 153 ++++++++++++++++++ 3 files changed, 156 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +2 -1
@@ -295,7 +295,7 @@ STATIC_IFN_KUNIT bool is_synaptics_cascaded_panamera(struct dc_link *link, struc }EXPORT_IF_KUNIT (is_synaptics_cascaded_panamera); -static bool validate_dsc_caps_on_connector (struct amdgpu_dm_connector *aconnector) +STATIC_IFN_KUNIT bool validate_dsc_caps_on_connector(struct amdgpu_dm_connector *aconnector) {struct dc_sink *dc_sink = aconnector->dc_sink;struct drm_dp_mst_port *port = aconnector->mst_output_port;
@@ -339,6 +339,7 @@ static bool validate_dsc_caps_on_connector(struct amdgpu_dm_connector *aconnectoreturn true; } +EXPORT_IF_KUNIT (validate_dsc_caps_on_connector);#endif STATIC_IFN_KUNIT bool retrieve_downstream_port_device(struct amdgpu_dm_connector *aconnector)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h +1 -0
@@ -107,6 +107,7 @@ enum dc_status dm_dp_mst_is_port_support_mode(void amdgpu_dm_mst_reset_mst_connector_setting (struct amdgpu_dm_connector *aconnector);bool is_synaptics_cascaded_panamera (struct dc_link *link,struct drm_dp_mst_port *port);bool dp_get_link_current_set_bw (struct drm_dp_aux *aux,uint32_t *cur_link_bw); +bool validate_dsc_caps_on_connector (struct amdgpu_dm_connector *aconnector);bool retrieve_downstream_port_device (struct amdgpu_dm_connector *aconnector);bool retrieve_branch_specific_data (struct amdgpu_dm_connector *aconnector); ssize_t dm_dp_aux_transfer_result(ssize_t result,
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c +153 -0
165 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 25/66 drm/amd/display: Test MST port mode support
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Add KUnit tests for dm_dp_mst_is_port_support_mode() covering a mode that fits uncompressed, a port without a DSC AUX channel, a link with no common DSC config, the DSC passthrough accept and reject paths, the last link bandwidth check with a fresh read, a cached value and the Synaptics quirk, the upstream virtual channel limit and the branch throughput limit.
[HOW]
Build an MST connector with a stream and a DSC capable encoder, using a fake dsc_funcs that reports encoder capabilities so the DC bandwidth range helpers produce usable values. Each path is then selected by varying the timing, the port DSC capabilities, the full and available PBN of the topology and the branch descriptor.
--- .../tests/amdgpu_dm_mst_types_test.c | 370 ++++++++++++++++++ 1 file changed, 370 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c +370 -0
@@ -29,6 +29,8 @@#include "amdgpu_dm_hdcp.h" #include "amdgpu_dm_mst_types.h" #include "amdgpu_dm_kunit_test_helpers.h" +#include "dsc/dsc.h" +#include "inc/core_types.h" #include "inc/link_service.h" /*
@@ -2620,6 +2622,363 @@ static void dm_mst_test_validate_dsc_caps_unsupported(struct kunit *test)KUNIT_EXPECT_FALSE (test, ctx.sink->dsc_caps.dsc_dec_caps.is_dsc_supported); } +/* Tests for dm_dp_mst_is_port_support_mode */ + +static uint32_t dm_mst_test_root_link_bw_kbps; + +static uint32_t dm_mst_test_root_bandwidth_kbps (const struct dc_link *link, +const struct dc_link_settings *link_settings) +{ +return dm_mst_test_root_link_bw_kbps; +} + +struct dm_mst_test_port_mode_ctx { +struct amdgpu_dm_connector *aconnector; +struct dc_stream_state *stream; +struct drm_dp_mst_port *port; +struct dc_sink *sink; +struct dc_link *link; +struct dc *dc; +}; + +/* +* Build the minimum needed to price a mode: a link whose root bandwidth is +* faked, a virtual channel sized by the port's full_pbn, and a 24bpp timing +* that needs pix_clk_100hz / 10 * 24 kbps uncompressed. +*/ +static void dm_mst_test_init_port_mode_ctx (struct kunit *test, +struct dm_mst_test_port_mode_ctx *ctx, +uint32_t root_link_bw_kbps,u32 full_pbn, +uint32_t pix_clk_100hz) +{ +struct link_service *link_srv; +struct resource_pool *res_pool; + +dm_mst_test_reset_dsc_dpcd (); + + ctx->aconnector =kunit_kzalloc (test,sizeof (*ctx->aconnector),GFP_KERNEL ); + ctx->sink =kunit_kzalloc (test,sizeof (*ctx->sink),GFP_KERNEL ); + link_srv =kunit_kzalloc (test,sizeof (*link_srv),GFP_KERNEL ); + res_pool =kunit_kzalloc (test,sizeof (*res_pool),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, ctx->aconnector); +KUNIT_ASSERT_NOT_NULL (test, ctx->sink); +KUNIT_ASSERT_NOT_NULL (test, link_srv); +KUNIT_ASSERT_NOT_NULL (test, res_pool); + + dm_mst_test_root_link_bw_kbps = root_link_bw_kbps; + link_srv->dp_link_bandwidth_kbps = dm_mst_test_root_bandwidth_kbps; + + ctx->dc =dm_kunit_alloc_dc_with_ctx (test); + ctx->dc->link_srv = link_srv; + ctx->dc->res_pool = res_pool; + + ctx->link =dm_kunit_alloc_link (test); + ctx->link->dc = ctx->dc; + ctx->link->ctx = ctx->dc->ctx; + + ctx->sink->ctx = ctx->dc->ctx; + ctx->port =dm_mst_test_alloc_mgr_port (test); + ctx->port->full_pbn = full_pbn; + + ctx->stream =dm_kunit_alloc_stream (test, ctx->link); + ctx->stream->sink = ctx->sink; + ctx->stream->timing.display_color_depth =COLOR_DEPTH_888 ; + ctx->stream->timing.pix_clk_100hz = pix_clk_100hz; + + ctx->aconnector->dc_link = ctx->link; + ctx->aconnector->dc_sink = ctx->sink; + ctx->aconnector->mst_output_port = ctx->port; +} + +/** +* dm_mst_test_port_mode_fits_without_dsc - sufficient bandwidth needs no DSC +* @test: KUnit test context +* +* When the uncompressed stream fits into the smaller of the root link and the +* virtual channel bandwidth, the mode is accepted before any DSC evaluation. +*/ +static void dm_mst_test_port_mode_fits_without_dsc (struct kunit *test) +{ +struct dm_mst_test_port_mode_ctx ctx; + +dm_mst_test_init_port_mode_ctx (test, &ctx,1000000 ,1000 ,100000 ); + +KUNIT_EXPECT_EQ (test,dm_dp_mst_is_port_support_mode (ctx.aconnector, ctx.stream),DC_OK ); +KUNIT_EXPECT_EQ (test, (u32 )ctx.stream->timing.flags.DSC,0U ); +} + +/** +* dm_mst_test_port_mode_no_dsc_aux - DSC is required but unavailable +* @test: KUnit test context +* +* A mode that exceeds the end-to-end bandwidth on a connector without a DSC +* AUX channel cannot be compressed, so validation must fail. +*/ +static void dm_mst_test_port_mode_no_dsc_aux (struct kunit *test) +{ +struct dm_mst_test_port_mode_ctx ctx; + +dm_mst_test_init_port_mode_ctx (test, &ctx,100000 ,10 ,100000 ); + +KUNIT_EXPECT_EQ (test,dm_dp_mst_is_port_support_mode (ctx.aconnector, ctx.stream), +DC_FAIL_BANDWIDTH_VALIDATE ); +} + +/** +* dm_mst_test_port_mode_no_common_dsc_config - no shared DSC config is fatal +* @test: KUnit test context +* +* With a DSC AUX but no DSC encoder in the resource pool, source and sink share +* no usable DSC configuration and the mode must be rejected. +*/ +static void dm_mst_test_port_mode_no_common_dsc_config (struct kunit *test) +{ +struct dm_mst_test_port_mode_ctx ctx; + +dm_mst_test_init_port_mode_ctx (test, &ctx,100000 ,10 ,100000 ); + ctx.aconnector->dsc_aux = ctx.port->mgr->aux; + +KUNIT_EXPECT_EQ (test,dm_dp_mst_is_port_support_mode (ctx.aconnector, ctx.stream), +DC_FAIL_BANDWIDTH_VALIDATE ); +} + +/* +* 1920x1080@60 RGB 8bpc needs 3564000 kbps uncompressed, and roughly 1188000 +* kbps at the 8bpp DSC policy minimum. +*/ +#define DM_MST_TEST_DSC_PIX_CLK_100HZ 1485000 + +/* Enough of dsc2_get_enc_caps() for the DSC policy and bandwidth maths. */ +static void dm_mst_test_dsc_get_enc_caps (struct dsc_enc_caps *dsc_enc_caps,int pixel_clock_100Hz) +{ + dsc_enc_caps->dsc_version =0x21 ; + dsc_enc_caps->slice_caps.bits.NUM_SLICES_1 =1 ; + dsc_enc_caps->slice_caps.bits.NUM_SLICES_2 =1 ; + dsc_enc_caps->slice_caps.bits.NUM_SLICES_4 =1 ; + dsc_enc_caps->lb_bit_depth =13 ; + dsc_enc_caps->is_block_pred_supported = true; + dsc_enc_caps->color_formats.bits.RGB =1 ; + dsc_enc_caps->color_depth.bits.COLOR_DEPTH_8_BPC =1 ; + dsc_enc_caps->max_total_throughput_mps =4800 ; + dsc_enc_caps->max_slice_width =5184 ; + dsc_enc_caps->bpp_increment_div =16 ; +} + +static const struct dsc_funcs dm_mst_test_dsc_funcs = { + .dsc_get_enc_caps = dm_mst_test_dsc_get_enc_caps, +}; + +/* Install the DSC encoder fake and matching sink decoder capabilities. */ +static void dm_mst_test_setup_dsc_caps (struct kunit *test,struct dc *dc,struct dc_sink *sink) +{ +struct dsc_dec_dpcd_caps *dec = &sink->dsc_caps.dsc_dec_caps; +struct display_stream_compressor *dsc; + + dsc =kunit_kzalloc (test,sizeof (*dsc),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, dsc); + + dsc->funcs = &dm_mst_test_dsc_funcs; + dsc->ctx = dc->ctx; + dc->res_pool->dscs[0 ] = dsc; + + dec->is_dsc_supported = true; + dec->dsc_version =0x21 ; + dec->rc_buffer_size =16 *1024 ; + dec->slice_caps1.bits.NUM_SLICES_1 =1 ; + dec->slice_caps1.bits.NUM_SLICES_2 =1 ; + dec->slice_caps1.bits.NUM_SLICES_4 =1 ; + dec->lb_bit_depth =13 ; + dec->is_block_pred_supported = true; + dec->color_formats.bits.RGB =1 ; + dec->color_depth.bits.COLOR_DEPTH_8_BPC =1 ; + dec->throughput_mode_0_mps =1000 ; + dec->throughput_mode_1_mps =1000 ; + dec->max_slice_width =5120 ; + dec->bpp_increment_div =16 ; +} + +static void dm_mst_test_set_dsc_timing (struct dc_crtc_timing *timing) +{ + timing->display_color_depth =COLOR_DEPTH_888 ; + timing->pixel_encoding =PIXEL_ENCODING_RGB ; + timing->h_addressable =1920 ; + timing->v_addressable =1080 ; + timing->pix_clk_100hz =DM_MST_TEST_DSC_PIX_CLK_100HZ ; +} + +/* +* Give the source a DSC encoder and the sink matching decoder capabilities so +* is_dsc_common_config_possible() succeeds, and switch to a timing that does +* not fit uncompressed. +*/ +static void dm_mst_test_enable_dsc (struct kunit *test,struct dm_mst_test_port_mode_ctx *ctx) +{ +struct drm_dp_mst_branch *branch; + + branch =kunit_kzalloc (test,sizeof (*branch),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, branch); + +dm_mst_test_setup_dsc_caps (test, ctx->dc, ctx->sink); +dm_mst_test_set_dsc_timing (&ctx->stream->timing); + + ctx->port->parent = branch; +dm_mst_test_init_dsc_aux (&ctx->port->aux,"dm_mst_test_port_mode_aux" ); + ctx->aconnector->dsc_aux = ctx->port->mgr->aux; +} + +/** +* dm_mst_test_port_mode_dsc_passthrough_fits - DSC passthrough accepts the mode +* @test: KUnit test context +* +* With DSC passthrough the compressed stream travels the whole path, so a +* minimum compression that fits the end-to-end bandwidth enables DSC. +*/ +static void dm_mst_test_port_mode_dsc_passthrough_fits (struct kunit *test) +{ +struct dm_mst_test_port_mode_ctx ctx; + +dm_mst_test_init_port_mode_ctx (test, &ctx,2500000 ,1000 ,100000 ); +dm_mst_test_enable_dsc (test, &ctx); + ctx.port->passthrough_aux = ctx.port->mgr->aux; + +KUNIT_EXPECT_EQ (test,dm_dp_mst_is_port_support_mode (ctx.aconnector, ctx.stream),DC_OK ); +KUNIT_EXPECT_EQ (test, (u32 )ctx.stream->timing.flags.DSC,1U ); +} + +/** +* dm_mst_test_port_mode_dsc_passthrough_too_narrow - max compression still too big +* @test: KUnit test context +* +* When even the smallest DSC bitstream exceeds the end-to-end bandwidth the +* mode must be rejected instead of enabling DSC. +*/ +static void dm_mst_test_port_mode_dsc_passthrough_too_narrow (struct kunit *test) +{ +struct dm_mst_test_port_mode_ctx ctx; + +dm_mst_test_init_port_mode_ctx (test, &ctx,1000000 ,1000 ,100000 ); +dm_mst_test_enable_dsc (test, &ctx); + ctx.port->passthrough_aux = ctx.port->mgr->aux; + +KUNIT_EXPECT_EQ (test,dm_dp_mst_is_port_support_mode (ctx.aconnector, ctx.stream), +DC_FAIL_BANDWIDTH_VALIDATE ); +KUNIT_EXPECT_EQ (test, (u32 )ctx.stream->timing.flags.DSC,0U ); +} + +/** +* dm_mst_test_port_mode_last_link_too_slow - the uncompressed last link is checked +* @test: KUnit test context +* +* DSC is decoded at the endpoint, so the last DP link still carries the +* uncompressed stream. Its current link settings are read from DPCD and cached +* on the connector, and a mode that does not fit is rejected. +*/ +static void dm_mst_test_port_mode_last_link_too_slow (struct kunit *test) +{ +struct dm_mst_test_port_mode_ctx ctx; + +dm_mst_test_init_port_mode_ctx (test, &ctx,2500000 ,1000 ,100000 ); +dm_mst_test_enable_dsc (test, &ctx); + ctx.port->pdt =DP_PEER_DEVICE_SST_SINK ; +/* RBR x1: 1257120 kbps, far below the 3564000 kbps the mode needs. */ +dm_mst_test_set_link_settings (DP_LINK_BW_1_62 ,1 , DP_8b_10b_ENCODING); + +KUNIT_EXPECT_EQ (test,dm_dp_mst_is_port_support_mode (ctx.aconnector, ctx.stream), +DC_FAIL_BANDWIDTH_VALIDATE ); +KUNIT_EXPECT_EQ (test, ctx.aconnector->mst_local_bw,1257120U ); +KUNIT_EXPECT_EQ (test, ctx.aconnector->vc_full_pbn, ctx.port->full_pbn); +} + +/** +* dm_mst_test_port_mode_last_link_cached_bw - a cached last link bandwidth is reused +* @test: KUnit test context +* +* While the virtual channel allocation is unchanged the previously read link +* bandwidth is reused instead of going out to DPCD again. +*/ +static void dm_mst_test_port_mode_last_link_cached_bw (struct kunit *test) +{ +struct dm_mst_test_port_mode_ctx ctx; + +dm_mst_test_init_port_mode_ctx (test, &ctx,2500000 ,1000 ,100000 ); +dm_mst_test_enable_dsc (test, &ctx); + ctx.port->pdt =DP_PEER_DEVICE_SST_SINK ; + ctx.aconnector->vc_full_pbn = ctx.port->full_pbn; + ctx.aconnector->mst_local_bw =100000 ; + +KUNIT_EXPECT_EQ (test,dm_dp_mst_is_port_support_mode (ctx.aconnector, ctx.stream), +DC_FAIL_BANDWIDTH_VALIDATE ); +KUNIT_EXPECT_EQ (test, ctx.aconnector->mst_local_bw,100000U ); +} + +/** +* dm_mst_test_port_mode_last_link_synaptics_quirk - Synaptics hubs skip the check +* @test: KUnit test context +* +* Synaptics branch devices misreport their last link settings, so the last +* link bandwidth check is skipped for them and the mode is accepted. +*/ +static void dm_mst_test_port_mode_last_link_synaptics_quirk (struct kunit *test) +{ +struct dm_mst_test_port_mode_ctx ctx; + +dm_mst_test_init_port_mode_ctx (test, &ctx,2500000 ,1000 ,100000 ); +dm_mst_test_enable_dsc (test, &ctx); + ctx.port->pdt =DP_PEER_DEVICE_SST_SINK ; + ctx.aconnector->branch_ieee_oui =DP_BRANCH_DEVICE_ID_90CC24 ; +dm_mst_test_set_link_settings (DP_LINK_BW_1_62 ,1 , DP_8b_10b_ENCODING); + +KUNIT_EXPECT_EQ (test,dm_dp_mst_is_port_support_mode (ctx.aconnector, ctx.stream),DC_OK ); +KUNIT_EXPECT_EQ (test, (u32 )ctx.stream->timing.flags.DSC,1U ); +} + +/** +* dm_mst_test_port_mode_upstream_vc_too_small - the upstream hop is the bottleneck +* @test: KUnit test context +* +* For a nested topology the virtual channel of the link before the last one +* caps the compressed bandwidth, and a mode that exceeds it is rejected. +*/ +static void dm_mst_test_port_mode_upstream_vc_too_small (struct kunit *test) +{ +struct dm_mst_test_port_mode_ctx ctx; +struct drm_dp_mst_port *upstream; + +dm_mst_test_init_port_mode_ctx (test, &ctx,2500000 ,1000 ,100000 ); +dm_mst_test_enable_dsc (test, &ctx); + ctx.port->pdt =DP_PEER_DEVICE_NONE ; + + upstream =kunit_kzalloc (test,sizeof (*upstream),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, upstream); +/* 100 PBN is about 670950 kbps, below the DSC minimum for this mode. */ + upstream->full_pbn =100 ; + ctx.port->parent->port_parent = upstream; + +KUNIT_EXPECT_EQ (test,dm_dp_mst_is_port_support_mode (ctx.aconnector, ctx.stream), +DC_FAIL_BANDWIDTH_VALIDATE ); +} + +/** +* dm_mst_test_port_mode_branch_throughput_exceeded - branch decoder limit applies +* @test: KUnit test context +* +* Even with a valid DSC configuration the branch decoder's overall throughput +* for RGB must be able to carry the pixel rate. +*/ +static void dm_mst_test_port_mode_branch_throughput_exceeded (struct kunit *test) +{ +struct dm_mst_test_port_mode_ctx ctx; + +dm_mst_test_init_port_mode_ctx (test, &ctx,2500000 ,1000 ,100000 ); +dm_mst_test_enable_dsc (test, &ctx); + ctx.port->passthrough_aux = ctx.port->mgr->aux; +/* 100 Mpix/s cannot carry the 148.5 Mpix/s this mode needs. */ + ctx.sink->dsc_caps.dsc_dec_caps.branch_overall_throughput_0_mps =100 ; + +KUNIT_EXPECT_EQ (test,dm_dp_mst_is_port_support_mode (ctx.aconnector, ctx.stream), +DC_FAIL_BANDWIDTH_VALIDATE ); +} +static struct kunit_case dm_mst_types_test_cases[] = {/* needs_dsc_aux_workaround tests */ KUNIT_CASE (dm_mst_test_needs_dsc_aux_workaround_match),
@@ -2714,6 +3073,17 @@ static struct kunit_case dm_mst_types_test_cases[] = {KUNIT_CASE (dm_mst_test_validate_dsc_caps_cascaded_hub),KUNIT_CASE (dm_mst_test_validate_dsc_caps_read_error),KUNIT_CASE (dm_mst_test_validate_dsc_caps_unsupported), +/* dm_dp_mst_is_port_support_mode tests */ +KUNIT_CASE (dm_mst_test_port_mode_fits_without_dsc), +KUNIT_CASE (dm_mst_test_port_mode_no_dsc_aux), +KUNIT_CASE (dm_mst_test_port_mode_no_common_dsc_config), +KUNIT_CASE (dm_mst_test_port_mode_dsc_passthrough_fits), +KUNIT_CASE (dm_mst_test_port_mode_dsc_passthrough_too_narrow), +KUNIT_CASE (dm_mst_test_port_mode_last_link_too_slow), +KUNIT_CASE (dm_mst_test_port_mode_last_link_cached_bw), +KUNIT_CASE (dm_mst_test_port_mode_last_link_synaptics_quirk), +KUNIT_CASE (dm_mst_test_port_mode_upstream_vc_too_small), + KUNIT_CASE(dm_mst_test_port_mode_branch_throughput_exceeded), {} };
Signature · 1 line
2.43.0
PATCH 26/66 drm/amd/display: Test FRL bandwidth lookup
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Add KUnit tests for get_conv_frl_bw() covering a protocol converter without FRL support, a downstream port that is not HDMI, a sink whose maximum FRL rate is zero and the case where the converter rate is the bottleneck.
[HOW]
Populate the display info and the downstream port capabilities of the connector for each case and check both the returned verdict and the bandwidth values it reports.
--- .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 5 +- .../display/amdgpu_dm/amdgpu_dm_mst_types.h | 2 + .../tests/amdgpu_dm_mst_types_test.c | 135 ++++++++++++++++++ 3 files changed, 140 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +3 -2
@@ -1231,8 +1231,8 @@ static int try_disable_dsc(struct drm_atomic_commit *state,return 0 ; } -static bool get_conv_frl_bw (struct amdgpu_dm_connector *aconnector, -uint32_t *bw_in_kbps,uint32_t *dsc_bw_in_kbps) +STATIC_IFN_KUNIT bool get_conv_frl_bw(struct amdgpu_dm_connector *aconnector, +uint32_t *bw_in_kbps,uint32_t *dsc_bw_in_kbps) {unsigned int max_conv_bw_in_kbps =0 ;unsigned int max_sink_bw_in_kbps =0 ;
@@ -1258,6 +1258,7 @@ static bool get_conv_frl_bw(struct amdgpu_dm_connector *aconnector,return *bw_in_kbps >0 ;// Frl endpoint is detected } +EXPORT_IF_KUNIT (get_conv_frl_bw); static void build_frl_mst_dsc_params(struct amdgpu_dm_connector *aconnector, struct dc_stream_state *stream,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h +2 -0
@@ -107,6 +107,8 @@ enum dc_status dm_dp_mst_is_port_support_mode(void amdgpu_dm_mst_reset_mst_connector_setting (struct amdgpu_dm_connector *aconnector);bool is_synaptics_cascaded_panamera (struct dc_link *link,struct drm_dp_mst_port *port);bool dp_get_link_current_set_bw (struct drm_dp_aux *aux,uint32_t *cur_link_bw); +bool get_conv_frl_bw (struct amdgpu_dm_connector *aconnector, +uint32_t *bw_in_kbps,uint32_t *dsc_bw_in_kbps);bool validate_dsc_caps_on_connector (struct amdgpu_dm_connector *aconnector);bool retrieve_downstream_port_device (struct amdgpu_dm_connector *aconnector);bool retrieve_branch_specific_data (struct amdgpu_dm_connector *aconnector);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c +135 -0
147 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 27/66 drm/amd/display: Test DSC precompute helpers
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Add KUnit tests for log_dsc_params(), for find_crtc_index_in_state_by_stream() with a matching and a missing stream, and for is_dsc_precompute_needed() covering an empty state, a stream without a link, a non MST link, an MST link whose CRTC is not in the state and an MST link that needs the precompute pass.
[HOW]
Hand build a drm_atomic_commit with CRTC states and DC stream states so the stream to CRTC lookup can be driven directly, and reuse it for a table driven is_dsc_precompute_needed() test that varies the link signal type and whether the CRTC is present.
--- .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 11 +- .../display/amdgpu_dm/amdgpu_dm_mst_types.h | 4 + .../tests/amdgpu_dm_mst_types_test.c | 174 ++++++++++++++++++ 3 files changed, 185 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +7 -4
@@ -1303,7 +1303,7 @@ static void build_frl_mst_dsc_params(struct amdgpu_dm_connector *aconnector, } } -static void log_dsc_params (int count,struct dsc_mst_fairness_vars *vars,int k) +STATIC_IFN_KUNIT void log_dsc_params(int count, struct dsc_mst_fairness_vars *vars, int k) {int i;
@@ -1311,6 +1311,7 @@ static void log_dsc_params(int count, struct dsc_mst_fairness_vars *vars, int k)DRM_DEBUG_DRIVER ("MST_DSC DSC params: stream #%d --- dsc_enabled = %d, bpp_x16 = %d, pbn = %d\n" , i, vars[i + k].dsc_enabled, vars[i + k].bpp_x16, vars[i + k].pbn); } +EXPORT_IF_KUNIT (log_dsc_params); static int compute_mst_dsc_configs_for_link(struct drm_atomic_commit *state, struct dc_state *dc_state,
@@ -1739,8 +1740,8 @@ static int pre_compute_mst_dsc_configs_for_state(struct drm_atomic_commit *statereturn ret; } -static int find_crtc_index_in_state_by_stream (struct drm_atomic_commit *state, -struct dc_stream_state *stream) +STATIC_IFN_KUNIT int find_crtc_index_in_state_by_stream(struct drm_atomic_commit *state, +struct dc_stream_state *stream) {int i;struct drm_crtc *crtc;
@@ -1754,6 +1755,7 @@ static int find_crtc_index_in_state_by_stream(struct drm_atomic_commit *state, }return -1 ; } +EXPORT_IF_KUNIT (find_crtc_index_in_state_by_stream);static bool is_link_to_dschub (struct dc_link *dc_link) {
@@ -1770,7 +1772,7 @@ static bool is_link_to_dschub(struct dc_link *dc_link)return true; } -static bool is_dsc_precompute_needed (struct drm_atomic_commit *state) +STATIC_IFN_KUNIT bool is_dsc_precompute_needed(struct drm_atomic_commit *state) {int i;struct drm_crtc *crtc;
@@ -1790,6 +1792,7 @@ static bool is_dsc_precompute_needed(struct drm_atomic_commit *state) }return ret; } +EXPORT_IF_KUNIT (is_dsc_precompute_needed); int pre_validate_dsc(struct drm_atomic_commit *state, struct dm_atomic_state **dm_state_ptr,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h +4 -0
@@ -109,6 +109,10 @@ bool is_synaptics_cascaded_panamera(struct dc_link *link, struct drm_dp_mst_portbool dp_get_link_current_set_bw (struct drm_dp_aux *aux,uint32_t *cur_link_bw);bool get_conv_frl_bw (struct amdgpu_dm_connector *aconnector,uint32_t *bw_in_kbps,uint32_t *dsc_bw_in_kbps); +void log_dsc_params (int count,struct dsc_mst_fairness_vars *vars,int k); +int find_crtc_index_in_state_by_stream (struct drm_atomic_commit *state, +struct dc_stream_state *stream); +bool is_dsc_precompute_needed (struct drm_atomic_commit *state);bool validate_dsc_caps_on_connector (struct amdgpu_dm_connector *aconnector);bool retrieve_downstream_port_device (struct amdgpu_dm_connector *aconnector);bool retrieve_branch_specific_data (struct amdgpu_dm_connector *aconnector);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c +174 -0
186 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 28/66 drm/amd/display: Test DSC recompute check
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Add KUnit tests for is_dsc_need_re_compute() covering a non MST branch, a legacy hub without DSC support, a state with no stream on the link, a mode change, an unchanged stream, a removed stream, a stream without a connector and a connector without a CRTC.
[HOW]
Build a DC state carrying streams on the link under test together with a matching drm_atomic_commit, then vary the topology, the connector to CRTC mapping and the mode changed flag to select each path.
--- .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 3 +- .../display/amdgpu_dm/amdgpu_dm_mst_types.h | 2 + .../tests/amdgpu_dm_mst_types_test.c | 228 ++++++++++++++++++ 3 files changed, 232 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +2 -1
@@ -1485,7 +1485,7 @@ static int compute_mst_dsc_configs_for_link(struct drm_atomic_commit *state,return 0 ; } -static bool is_dsc_need_re_compute ( +STATIC_IFN_KUNIT bool is_dsc_need_re_compute(struct drm_atomic_commit *state,struct dc_state *dc_state,struct dc_link *dc_link)
@@ -1616,6 +1616,7 @@ static bool is_dsc_need_re_compute(return is_dsc_need_re_compute; } +EXPORT_IF_KUNIT (is_dsc_need_re_compute); int compute_mst_dsc_configs_for_state(struct drm_atomic_commit *state, struct dc_state *dc_state,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h +2 -0
@@ -113,6 +113,8 @@ void log_dsc_params(int count, struct dsc_mst_fairness_vars *vars, int k);int find_crtc_index_in_state_by_stream (struct drm_atomic_commit *state,struct dc_stream_state *stream);bool is_dsc_precompute_needed (struct drm_atomic_commit *state); +bool is_dsc_need_re_compute (struct drm_atomic_commit *state,struct dc_state *dc_state, +struct dc_link *dc_link);bool validate_dsc_caps_on_connector (struct amdgpu_dm_connector *aconnector);bool retrieve_downstream_port_device (struct amdgpu_dm_connector *aconnector);bool retrieve_branch_specific_data (struct amdgpu_dm_connector *aconnector);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c +228 -0
240 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 29/66 drm/amd/display: Test DSC config computation
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Add KUnit tests for compute_mst_dsc_configs_for_state() covering an SST stream, a stream with an incomplete topology, a failing stream removal and a link that does not need a recompute, plus a test for pre_validate_dsc() when no precompute pass is required.
[HOW]
Add a helper that appends an MST stream with a DSC capable link to a DC state, including the resource pool functions the compute pass calls unconditionally, and let each test supply its own stream removal callback to reach the error path.
--- .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 2 + .../tests/amdgpu_dm_mst_types_test.c | 150 ++++++++++++++++++ 2 files changed, 152 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +2 -0
@@ -1687,6 +1687,7 @@ int compute_mst_dsc_configs_for_state(struct drm_atomic_commit *state,return ret; } +EXPORT_IF_KUNIT (compute_mst_dsc_configs_for_state); static int pre_compute_mst_dsc_configs_for_state(struct drm_atomic_commit *state, struct dc_state *dc_state,
@@ -1905,6 +1906,7 @@ int pre_validate_dsc(struct drm_atomic_commit *state,return ret; } +EXPORT_IF_KUNIT (pre_validate_dsc);static uint32_t kbps_from_pbn (unsigned int pbn) {
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c +150 -0
162 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 30/66 drm/amd/display: Test per-link DSC configs
In reply to Chenyu ChenFrom: Alex Hung <[email protected]>
[WHAT]
Add KUnit tests for pre_compute_mst_dsc_configs_for_state() covering an SST stream, a stream with an incomplete topology and a link that does not need a recompute, and for compute_mst_dsc_configs_for_link() covering a mode that fits uncompressed, a link that needs compression, a link that runs out of time slots, forced DSC, forced DSC on an already compressed stream, a bits per pixel overwrite, disabled compression and a target that lands between the DSC limits.
[HOW]
Build an MST topology with a payload allocation and a DC state holding the streams under test, and bind the connector to a CRTC through the atomic helpers so the state teardown keeps the reference counts balanced. Each path is then selected by varying the available time slots and the per stream DSC policy.
--- .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 7 +- .../display/amdgpu_dm/amdgpu_dm_mst_types.h | 3 + .../tests/amdgpu_dm_mst_types_test.c | 402 ++++++++++++++++++ 3 files changed, 409 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +4 -3
@@ -1689,9 +1689,9 @@ int compute_mst_dsc_configs_for_state(struct drm_atomic_commit *state, }EXPORT_IF_KUNIT (compute_mst_dsc_configs_for_state); -static int pre_compute_mst_dsc_configs_for_state (struct drm_atomic_commit *state, -struct dc_state *dc_state, -struct dsc_mst_fairness_vars *vars) +STATIC_IFN_KUNIT int pre_compute_mst_dsc_configs_for_state(struct drm_atomic_commit *state, +struct dc_state *dc_state, +struct dsc_mst_fairness_vars *vars) {int i, j;struct dc_stream_state *stream;
@@ -1741,6 +1741,7 @@ static int pre_compute_mst_dsc_configs_for_state(struct drm_atomic_commit *statereturn ret; } +EXPORT_IF_KUNIT (pre_compute_mst_dsc_configs_for_state); STATIC_IFN_KUNIT int find_crtc_index_in_state_by_stream(struct drm_atomic_commit *state,struct dc_stream_state *stream)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h +3 -0
@@ -115,6 +115,9 @@ int find_crtc_index_in_state_by_stream(struct drm_atomic_commit *state,bool is_dsc_precompute_needed (struct drm_atomic_commit *state);bool is_dsc_need_re_compute (struct drm_atomic_commit *state,struct dc_state *dc_state,struct dc_link *dc_link); +int pre_compute_mst_dsc_configs_for_state (struct drm_atomic_commit *state, +struct dc_state *dc_state, +struct dsc_mst_fairness_vars *vars);bool validate_dsc_caps_on_connector (struct amdgpu_dm_connector *aconnector);bool retrieve_downstream_port_device (struct amdgpu_dm_connector *aconnector);bool retrieve_branch_specific_data (struct amdgpu_dm_connector *aconnector);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c +402 -0
423 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 31/66 drm/amd/display: Add urgent assertion counter probe
In reply to Chenyu ChenFrom: Wenjing Liu <[email protected]>
[Why]
Expose continuous urgent assertion counts for memory QoS debugging.
[How]
Track probe running state and poll the counter through the update path.
--- .../gpu/drm/amd/display/dc/core/dc_resource.c | 28 ++++++++-- drivers/gpu/drm/amd/display/dc/dc.h | 2 + .../amd/display/dc/hwss/dcn60/dcn60_hwseq.c | 54 ++++++++++++++----- 3 files changed, 67 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +24 -4
@@ -4581,11 +4581,31 @@ enum dc_status resource_validate_probe_set(struct dc *dc,return DC_NOT_SUPPORTED ;for (i =0 ; i < probe_count; i++) { -if (probes[i].target_state ==DC_PROBE_MEASURING ) -return DC_NOT_SUPPORTED ; - -if (probes[i].scope.type !=DC_PROBE_SCOPE_GLOBAL ) +switch (probes[i].type) { +/* These global probes support a one-frame measurement and reset. */ +case DC_PROBE_PEAK_MEM_BW : +case DC_PROBE_PEAK_MEM_BW_STRESSED : +case DC_PROBE_AVG_MEM_BW : +case DC_PROBE_MEM_LATENCY : +case DC_PROBE_PREFETCH_DATA_SIZE : +if (probes[i].scope.type !=DC_PROBE_SCOPE_GLOBAL ) +return DC_NOT_SUPPORTED ; +if (probes[i].target_state !=DC_PROBE_NOT_MEASURING && + probes[i].target_state !=DC_PROBE_MEASURED ) +return DC_NOT_SUPPORTED ; +break ; +/* The global urgent assertion counter additionally supports polling. */ +case DC_PROBE_URGENT_ASSERTION_COUNT : +if (probes[i].scope.type !=DC_PROBE_SCOPE_GLOBAL ) +return DC_NOT_SUPPORTED ; +if (probes[i].target_state !=DC_PROBE_NOT_MEASURING && + probes[i].target_state !=DC_PROBE_MEASURING && + probes[i].target_state !=DC_PROBE_MEASURED ) +return DC_NOT_SUPPORTED ; +break ; +default :return DC_NOT_SUPPORTED ; + }if (probes[i].type ==DC_PROBE_PEAK_MEM_BW_STRESSED && !dc->res_pool->lsdma_scratch.buffer)
drivers/gpu/drm/amd/display/dc/dc.h +2 -0
@@ -2223,6 +2223,7 @@ struct dc_probe_latencies {/** * struct dc_probe_status - results for a probe. * @valid: true if a measurement was latched. +* @measuring: true if the hardware counter is currently running. * @type: type of the probe that produced this result. * @u.bandwidth_mbps: peak BW in Mbps (DC_PROBE_PEAK_MEM_BW). * @u.latency: min/max/avg memory latency in ns (DC_PROBE_MEM_LATENCY),
@@ -2232,6 +2233,7 @@ struct dc_probe_latencies {*/ struct dc_probe_status {bool valid; +bool measuring;enum dc_probe_type type;union {uint32_t bandwidth_mbps;
drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.c +41 -13
127 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 32/66 drm/amd/display: Add debug option to force optional UCLK support
In reply to Chenyu ChenFrom: Alvin Lee <[email protected]>
[Description]
Add debug option to force optional uclk support
--- drivers/gpu/drm/amd/display/dc/dc.h | 1 + .../dc/dml2_wrapper/dml21_wrapper/dml21_translation_helper.c | 1 + 2 files changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
@@ -1288,6 +1288,7 @@ struct dc_debug_options {bool dml21_force_pstate_method;uint32_t dml21_force_pstate_method_values[MAX_PIPES ];uint32_t dml21_disable_pstate_method_mask; +bool force_optional_uclk_pstate_support;union fw_assisted_mclk_switch_version fams_version;union dmub_fams2_global_feature_config fams2_config;bool fams2_imm_restore_drr;
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml21_wrapper/dml21_translation_helper.c +1 -0
@@ -39,6 +39,7 @@ static void dml21_populate_pmo_options(struct dml2_pmo_options *pmo_options, pmo_options->disable_drr_clamped_when_var_active = in_dc->debug.disable_fams_gaming ==INGAME_FAMS_DISABLE ; pmo_options->force_mandatory_uclk_pstate_support = config->pmo.force_mandatory_uclk_pstate_support; + pmo_options->force_optional_uclk_pstate_support = in_dc->debug.force_optional_uclk_pstate_support; }static enum dml2_project_id dml21_dcn_revision_to_dml2_project_id (const struct dc *in_dc)
Signature · 1 line
2.43.0
PATCH 33/66 drm/amd/display: Honor forced RGB pixel encoding
In reply to Chenyu ChenFrom: Ivan Lipski <[email protected]>
[Why&How]
Forcing RGB format via debugfs on a monitor supporting YUV444 is ignored.
Similarly to YUV format forcing, only use RGB pixel encoding if it is specified in the force_yuv_pixel_formats debugfs.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c +5 -1
@@ -2289,7 +2289,9 @@ amdgpu_dm_create_validate_stream_for_sink(struct drm_connector *connector,* (drm_mode_is_420_also() clear), as required for HDMI compliance * testing; dc_validate_stream() still rejects anything the link * genuinely cannot carry. The YCbCr422/YCbCr444 forces stay gated on -* the sink's advertised caps. +* the sink's advertised caps. An RGB force pins to RGB alone and is +* always honoured, since RGB is the mandatory baseline every sink +* (DP or HDMI) supports. */ if (drm_mode_is_420_only (info, drm_mode) || aconnector->force_yuv_pixel_format ==PIXEL_ENCODING_YCBCR420 ) {
@@ -2301,6 +2303,8 @@ amdgpu_dm_create_validate_stream_for_sink(struct drm_connector *connector, (info->color_formats & BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444)) && is_hdmi_ep) { encoding_mask = BIT(PIXEL_ENCODING_YCBCR444); + } else if (aconnector->force_yuv_pixel_format == PIXEL_ENCODING_RGB) { + encoding_mask = BIT(PIXEL_ENCODING_RGB); } else { encoding_mask =BIT (PIXEL_ENCODING_RGB );
Signature · 1 line
2.43.0
PATCH 34/66 drm/amd/display: Add Replay cumulative residency query
In reply to Chenyu ChenFrom: Wei-Guang Li <[email protected]>
[Why&How]
Add driver-side support for querying boot-time cumulative PHY-off residency via the REPLAY_SNAPSHOT_CUMULATIVE_RESIDENCY GPINT command implemented in DMUB FW.
--- .../gpu/drm/amd/display/dc/dce/dmub_replay.c | 25 +++++++++++++++++++ .../gpu/drm/amd/display/dc/dce/dmub_replay.h | 2 ++ .../gpu/drm/amd/display/dc/inc/link_service.h | 2 ++ .../drm/amd/display/dc/link/link_factory.c | 1 + .../link/protocols/link_edp_panel_control.c | 22 ++++++++++++++++ .../link/protocols/link_edp_panel_control.h | 2 ++ .../drm/amd/display/modules/inc/mod_power.h | 3 +++ .../amd/display/modules/power/power_replay.c | 13 ++++++++++ 8 files changed, 70 insertions(+)
drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c +25 -0
@@ -415,6 +415,30 @@ static void dmub_replay_send_cmd(struct dmub_replay *dmub,dc_wake_and_execute_dmub_cmd (ctx, &cmd,DM_DMUB_WAIT_TYPE_WAIT ); } +static bool dmub_replay_get_cumulative_residency (struct dmub_replay *dmub, +uint8_t panel_inst,uint32_t *residency_milli_pct) +{ +uint32_t milli_pct =0 ; +uint16_t param = (uint16_t )panel_inst; + +if (!residency_milli_pct) +return false; + +/* Zero on failure so the caller never reads a stale value, and report +* false so a failed query is still distinguishable from a genuine 0%. +*/ + *residency_milli_pct =0 ; + +if (!dc_wake_and_execute_gpint (dmub->ctx, +DMUB_GPINT__REPLAY_SNAPSHOT_CUMULATIVE_RESIDENCY , + param, &milli_pct,DM_DMUB_WAIT_TYPE_WAIT_WITH_REPLY )) +return false; + + *residency_milli_pct = milli_pct; + +return true; +} +static const struct dmub_replay_funcs replay_funcs = { .replay_copy_settings = dmub_replay_copy_settings, .replay_enable = dmub_replay_enable,
@@ -424,6 +448,7 @@ static const struct dmub_replay_funcs replay_funcs = { .replay_residency = dmub_replay_residency, .replay_set_power_opt_and_coasting_vtotal = dmub_replay_set_power_opt_and_coasting_vtotal, .replay_send_cmd = dmub_replay_send_cmd, + .replay_get_cumulative_residency = dmub_replay_get_cumulative_residency, };/*
drivers/gpu/drm/amd/display/dc/dce/dmub_replay.h +2 -0
@@ -33,6 +33,8 @@ struct dmub_replay_funcs {void (*replay_set_power_opt_and_coasting_vtotal)(struct dmub_replay *dmub,unsigned int power_opt,uint8_t panel_inst,uint32_t coasting_vtotal,uint16_t frame_skip_number); +bool (*replay_get_cumulative_residency)(struct dmub_replay *dmub, +uint8_t panel_inst,uint32_t *residency_milli_pct); };struct dmub_replay *dmub_replay_create (struct dc_context *ctx);
drivers/gpu/drm/amd/display/dc/inc/link_service.h +2 -0
@@ -297,6 +297,8 @@ struct link_service {bool (*edp_replay_residency)(const struct dc_link *link,unsigned int *residency,const bool is_start,const enum pr_residency_mode mode); +bool (*edp_replay_get_cumulative_residency)(const struct dc_link *link, +uint32_t *residency_milli_pct);bool (*edp_set_replay_power_opt_and_coasting_vtotal)(struct dc_link *link,const unsigned int *power_opts,uint32_t coasting_vtotal,uint16_t frame_skip_number);
drivers/gpu/drm/amd/display/dc/link/link_factory.c +1 -0
@@ -223,6 +223,7 @@ static void construct_link_service_edp_panel_control(struct link_service *link_s link_srv->edp_send_replay_cmd = edp_send_replay_cmd; link_srv->edp_set_coasting_vtotal = edp_set_coasting_vtotal; link_srv->edp_replay_residency = edp_replay_residency; + link_srv->edp_replay_get_cumulative_residency = edp_replay_get_cumulative_residency; link_srv->edp_set_replay_power_opt_and_coasting_vtotal = edp_set_replay_power_opt_and_coasting_vtotal; link_srv->edp_wait_for_t12 = edp_wait_for_t12;
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +22 -0
@@ -1154,6 +1154,28 @@ bool edp_replay_residency(const struct dc_link *link,return true; } +bool edp_replay_get_cumulative_residency (const struct dc_link *link, +uint32_t *residency_milli_pct) +{ +struct dc *dc = link->ctx->dc; +struct dmub_replay *replay = dc->res_pool->replay; +unsigned int panel_inst; + +if (!dp_pr_get_pr_panel_inst (dc, link, &panel_inst)) +return false; + +if (replay && link->replay_settings.replay_feature_enabled && + replay->funcs->replay_get_cumulative_residency) +return replay->funcs->replay_get_cumulative_residency (replay, + (uint8_t )panel_inst, residency_milli_pct); + +if (residency_milli_pct) + *residency_milli_pct =0 ; + +return true; +} + +bool edp_set_replay_power_opt_and_coasting_vtotal (struct dc_link *link,const unsigned int *power_opts,uint32_t coasting_vtotal,uint16_t frame_skip_number) {
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.h +2 -0
@@ -60,6 +60,8 @@ bool edp_send_replay_cmd(struct dc_link *link,bool edp_set_coasting_vtotal (struct dc_link *link,uint32_t coasting_vtotal,uint16_t frame_skip_number);bool edp_replay_residency (const struct dc_link *link,unsigned int *residency,const bool is_start,const enum pr_residency_mode mode); +bool edp_replay_get_cumulative_residency (const struct dc_link *link, +uint32_t *residency_milli_pct);bool edp_get_replay_state (const struct dc_link *link,uint64_t *state);bool edp_set_replay_power_opt_and_coasting_vtotal (struct dc_link *link,const unsigned int *power_opts,uint32_t coasting_vtotal,uint16_t frame_skip_number);
drivers/gpu/drm/amd/display/modules/inc/mod_power.h +3 -0
@@ -375,6 +375,9 @@ bool mod_power_replay_set_coasting_vtotal(struct mod_power *mod_power,void mod_power_replay_residency (const struct dc_stream_state *stream,unsigned int *residency,const bool is_start,const bool is_alpm); +bool mod_power_replay_get_cumulative_residency (const struct dc_stream_state *stream, +uint32_t *residency_milli_pct); +bool mod_power_replay_set_power_opt_and_coasting_vtotal (struct mod_power *mod_power,const struct dc_stream_state *stream,unsigned int active_replay_events,uint32_t coasting_vtotal,bool is_ultra_sleep_mode,uint16_t frame_skip_number);
drivers/gpu/drm/amd/display/modules/power/power_replay.c +13 -0
@@ -761,6 +761,19 @@ void mod_power_replay_residency(const struct dc_stream_state *stream, link->dc->link_srv->edp_replay_residency (link, residency, is_start, mode); } +bool mod_power_replay_get_cumulative_residency (const struct dc_stream_state *stream, +uint32_t *residency_milli_pct) +{ +const struct dc_link *link =dc_stream_get_link (stream); + +if (!link || !link->dc || !link->dc->link_srv) +return false; + +return link->dc->link_srv->edp_replay_get_cumulative_residency ( + link, residency_milli_pct); +} + +bool mod_power_replay_set_power_opt_and_coasting_vtotal (struct mod_power *mod_power,const struct dc_stream_state *stream,unsigned int active_replay_events,uint32_t coasting_vtotal,bool is_ultra_sleep_mode,uint16_t frame_skip_number)
Signature · 1 line
2.43.0
PATCH 35/66 drm/amd/display: Force DSC to 8bpp for MST DP tunneling over USB4
In reply to Chenyu ChenFrom: Fangzhi Zuo <[email protected]>
Commit "drm/amd/display: Force DSC to 8bpp for SST DP tunneling over USB4" forces DSC and caps the target to 8 bpp for SST streams on a USB4 DPIA link with bandwidth allocation enabled. The MST DSC fairness path does not honor that policy: it derives the bpp range purely from the timing's DSC policy and picks the highest bpp the native DP link can carry, which overflows the smaller USB4 tunnel budget on a dock that fans out via an internal MST hub.
Apply the equivalent policy in compute_mst_dsc_configs_for_link(): when the link is a USB4 DPIA with BW allocation enabled, force DSC on (so the fairness pass does not leave a stream uncompressed just because the native link looks large enough) and pin the target to the minimum bpp (so the compressed stream fits the tunnel and reserves headroom for the other tunnels on the same host router).
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +8 -1
@@ -1375,6 +1375,10 @@ static int compute_mst_dsc_configs_for_link(struct drm_atomic_commit *state, params[count].num_slices_v = aconnector->dsc_settings.dsc_num_slices_v; params[count].bpp_overwrite = aconnector->dsc_settings.dsc_bits_per_pixel; params[count].compression_possible = stream->sink->dsc_caps.dsc_dec_caps.is_dsc_supported; +if (params[count].compression_possible && + dc_link->ep_type ==DISPLAY_ENDPOINT_USB4_DPIA && + dc_link->dpia_bw_alloc_config.bw_alloc_enabled) + params[count].clock_force_enable =DSC_CLK_FORCE_ENABLE ;dc_dsc_get_policy_for_timing (params[count].timing,0 , &dsc_policy,dc_link_get_highest_encoding_format (stream->link)); is_frl_endpoint_present =get_conv_frl_bw (aconnector, &frl_conv_bw_in_kbps, &frl_conv_dsc_bw_in_kbps); if (stream->sink->dsc_caps.dsc_dec_caps.is_dsc_supported &&
@@ -1386,7 +1390,10 @@ static int compute_mst_dsc_configs_for_link(struct drm_atomic_commit *state, stream->sink->ctx->dc->res_pool->dscs[0 ], stream->sink->ctx->dc->debug.dsc_min_slice_height_override, dsc_policy.min_target_bpp *16 , - dsc_policy.max_target_bpp *16 , + (dc_link->ep_type ==DISPLAY_ENDPOINT_USB4_DPIA && + dc_link->dpia_bw_alloc_config.bw_alloc_enabled) ? + dsc_policy.min_target_bpp *16 : + dsc_policy.max_target_bpp *16 , &stream->sink->dsc_caps.dsc_dec_caps, &stream->timing, dc_link_get_highest_encoding_format(dc_link),
Signature · 1 line
2.43.0
PATCH 36/66 drm/amd/display: Force DSC to 8bpp for SST DP tunneling over USB4
In reply to Chenyu ChenFrom: Fangzhi Zuo <[email protected]>
A 4K144 display attached through a USB4 (Thunderbolt) dock does not light up on DCN4.2. The native DP link bandwidth reported for the sink is far larger than the USB4 tunnel can carry, so DSC is sized to the link and the resulting stream overflows the tunnel's granted bandwidth. The bandwidth allocation request fails and the display stays dark.
When the endpoint is a USB4 DPIA with BW allocation enabled, force DSC and cap the target to 8 bpp in SST mode. This keeps the compressed stream within the tunnel budget and reserves headroom for other DP tunnels sharing the same host router.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c +6 -0
@@ -1264,6 +1264,12 @@ static void apply_dsc_policy_for_stream(struct amdgpu_dm_connector *aconnector, link_bandwidth_kbps =dc_link_bandwidth_kbps (aconnector->dc_link,dc_link_get_link_cap (aconnector->dc_link)); +if (aconnector->dc_link->ep_type ==DISPLAY_ENDPOINT_USB4_DPIA && + aconnector->dc_link->dpia_bw_alloc_config.bw_alloc_enabled) { + dsc_options.max_target_bpp_limit_override_x16 =8 *16 ; + dsc_options.force_dsc_when_not_needed = true; + } +/* Set DSC policy according to dsc_clock_en */ dc_dsc_policy_set_enable_dsc_when_not_needed ( aconnector->dsc_settings.dsc_force_enable ==DSC_CLK_FORCE_ENABLE );
Signature · 1 line
2.43.0
PATCH 37/66 drm/amd/display: Fix peak bandwidth measurement sequence
In reply to Chenyu ChenFrom: Wenjing Liu <[email protected]>
[Why]
Peak bandwidth samples could intermittently report invalid counter values because completion and stale stop events were not isolated. The default measurement window also made completion less likely within the available sampling period.
[How]
Clear indirect counter state while masking stop output, use one counter as the sole measurement completion source, and shorten the default measurement window to 5000 events.
--- .../display/dc/hubbub/dcn60/dcn60_hubbub.c | 44 ++++++++++++------- 1 file changed, 29 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/display/dc/hubbub/dcn60/dcn60_hubbub.c +29 -15
@@ -742,9 +742,19 @@ static void hubbub60_wm_read_state(struct hubbub *hubbub,static void hubbub60_perfmon_reset (struct hubbub *hubbub) {struct dcn20_hubbub *hubbub2 =TO_DCN20_HUBBUB (hubbub); +unsigned int counter;REG_WRITE (DC_PERFMON5_PERFMON_CNTL ,0 );REG_WRITE (DC_PERFMON5_PERFMON_CNTL2 ,0 ); + +for (counter =0 ; counter <8 ; counter++) { +REG_SET_2 (DC_PERFMON5_PERFCOUNTER_CNTL ,0 , +PERFCOUNTER_CNTL_SEL , counter, +PERFCOUNTER_OFF_MASK ,0x1 ); +REG_SET (DC_PERFMON5_PERFCOUNTER_CNTL2 ,0 , +PERFCOUNTER_CNTL2_SEL , counter); + } +REG_WRITE (DC_PERFMON5_PERFCOUNTER_STATE ,0 );REG_WRITE (DC_PERFMON5_PERFMON_CVALUE_INT_MISC ,0xFF00 );REG_WRITE (DC_PERFMON5_PERFMON_CVALUE_LOW ,0 );
@@ -1381,7 +1391,7 @@ static uint32_t hubbub60_perfmon_get_urgent_ramp_latency_ns(* Counter 1: data counter — tracks total data received during the measurement * period. * Counter 2: target-reached generator — duplicates counter 1's event/target -* and generates the interrupt that stops counters 1 and 4. +* and generates the counter-off event that stops counters 1 and 4. * Counter 4: duration timer — measures elapsed time in refclk cycles. * * UTM_FILTER_SEL is set to 0 so that isolation comes from OTG-vblank gating
@@ -1396,7 +1406,7 @@ static uint32_t hubbub60_perfmon_get_urgent_ramp_latency_ns(* windbg (ed dcn60_debug_peak_bw_ramp_size / ed dcn60_debug_peak_bw_window_size). */ static unsigned int dcn60_debug_peak_bw_ramp_size =0x100 ; -static unsigned int dcn60_debug_peak_bw_window_size =0x2500 ; +static unsigned int dcn60_debug_peak_bw_window_size =5000 ;/* Minimum count4 (refclk ticks) for a peak-BW sample to be trusted. */ #define DCN60_OUT_OF_ORDER_BW_MIN_DURATION_TICKS 20
@@ -1419,7 +1429,7 @@ static void hubbub60_perfmon_arm_measuring_out_of_order_bandwidth( UTM_FILTER_SEL, 0x0);/* Program counter 0 as the count off counter */ - REG_SET_8(DC_PERFMON5_PERFCOUNTER_CNTL, 0, + REG_SET_9(DC_PERFMON5_PERFCOUNTER_CNTL, 0, PERFCOUNTER_CNTL_SEL, 0x0, // select counter 0 PERFCOUNTER_EVENT_SEL, 259, // response vld PERFCOUNTER_CVALUE_SEL, 0x1, // use cvalue bits 15-0
@@ -1427,7 +1437,8 @@ static void hubbub60_perfmon_arm_measuring_out_of_order_bandwidth(PERFCOUNTER_HW_CNTL_SEL ,0x0 ,// simutaneous mode PERFCOUNTER_RUNEN_MODE ,0x0 ,// counter runs as long as run_enable is high PERFCOUNTER_RESTART_EN ,0x0 ,// stop after counting is done - PERFCOUNTER_ACTIVE, 1); +PERFCOUNTER_OFF_MASK ,0x1 ,// do not generate pmon_counter_off_out + PERFCOUNTER_ACTIVE, 0x1); REG_SET_4(DC_PERFMON5_PERFCOUNTER_CNTL2, 0, PERFCOUNTER_CNTL2_SEL, 0x0, // select counter 0 PERFCOUNTER_COUNTED_VALUE_TYPE, 0x0, // count the accumulated value
@@ -1436,7 +1447,7 @@ static void hubbub60_perfmon_arm_measuring_out_of_order_bandwidth(/* Program counter 1 as a passive data accumulator, slaved to the same * external stop signal as counter 4 (generated by counter 2 below). */ - REG_SET_9(DC_PERFMON5_PERFCOUNTER_CNTL, 0, + REG_SET_10(DC_PERFMON5_PERFCOUNTER_CNTL, 0, PERFCOUNTER_CNTL_SEL, 0x1, // select counter 1 PERFCOUNTER_EVENT_SEL, 259, // response vld PERFCOUNTER_CVALUE_SEL, 0x2, // use cvalue bits 31-16
@@ -1444,7 +1455,8 @@ static void hubbub60_perfmon_arm_measuring_out_of_order_bandwidth(PERFCOUNTER_HW_CNTL_SEL ,0x1 ,// independent mode PERFCOUNTER_RUNEN_MODE ,0x0 ,// counter runs as long as run_enable is high PERFCOUNTER_RESTART_EN ,0x0 ,// stop after counting is done -PERFCOUNTER_INT_EN ,0 ,// counter 2 now generates the interrupt +PERFCOUNTER_INT_EN ,0 ,// counter 2 is the completion source +PERFCOUNTER_OFF_MASK ,0x1 ,// do not generate pmon_counter_off_out PERFCOUNTER_ACTIVE, 0x1); REG_SET_5(DC_PERFMON5_PERFCOUNTER_CNTL2, 0, PERFCOUNTER_CNTL2_SEL, 0x1,
@@ -1454,9 +1466,9 @@ static void hubbub60_perfmon_arm_measuring_out_of_order_bandwidth( PERFCOUNTER_HW_STOP2_SEL, 0x1); // stop via the same external signal as counter 4/* Counter 2 is a dedicated "target reached" generator: it duplicates -* counter 1's event/target and is the sole source of the completion -* interrupt driving PERFMON_RUN_ENABLE_STOP_SEL. */ - REG_SET_9(DC_PERFMON5_PERFCOUNTER_CNTL, 0, +* counter 1's event/target and is the sole source of the counter-off +* event driving PERFMON_RUN_ENABLE_STOP_SEL. */ + REG_SET_10(DC_PERFMON5_PERFCOUNTER_CNTL, 0, PERFCOUNTER_CNTL_SEL, 0x2, // select counter 2 PERFCOUNTER_EVENT_SEL, 259, // response vld PERFCOUNTER_CVALUE_SEL, 0x2, // use cvalue bits 31-16 (same window target as counter 1)
@@ -1464,7 +1476,8 @@ static void hubbub60_perfmon_arm_measuring_out_of_order_bandwidth(PERFCOUNTER_HW_CNTL_SEL ,0x1 ,// independent mode PERFCOUNTER_RUNEN_MODE ,0x0 ,// counter runs as long as run_enable is high PERFCOUNTER_RESTART_EN ,0x0 ,// stop after counting is done -PERFCOUNTER_INT_EN ,1 ,// signal when the measurement is complete +PERFCOUNTER_INT_EN ,0 ,// counter-off is the completion source +PERFCOUNTER_OFF_MASK ,0x0 ,// generate pmon_counter_off_out at CVALUE PERFCOUNTER_ACTIVE, 0x1); REG_SET_5(DC_PERFMON5_PERFCOUNTER_CNTL2, 0, PERFCOUNTER_CNTL2_SEL, 0x2,
@@ -1474,7 +1487,7 @@ static void hubbub60_perfmon_arm_measuring_out_of_order_bandwidth( PERFCOUNTER_HW_STOP2_SEL, 0x0); // the stop trigger is that perfcounter meet the target CVALUE/* Program counter 4 to count the measuring time */ - REG_SET_8(DC_PERFMON5_PERFCOUNTER_CNTL, 0, + REG_SET_9(DC_PERFMON5_PERFCOUNTER_CNTL, 0, PERFCOUNTER_CNTL_SEL, 0x4, // select counter 4 PERFCOUNTER_EVENT_SEL, 19, // always 1 event PERFCOUNTER_CVALUE_SEL, 0x0, // ignored
@@ -1482,6 +1495,7 @@ static void hubbub60_perfmon_arm_measuring_out_of_order_bandwidth(PERFCOUNTER_HW_CNTL_SEL ,0x1 ,// independent mode PERFCOUNTER_RUNEN_MODE ,0x0 ,// counter runs as long as run_enable is high PERFCOUNTER_RESTART_EN ,0x0 ,// stop after counting is done +PERFCOUNTER_OFF_MASK ,0x1 ,// do not generate pmon_counter_off_out PERFCOUNTER_ACTIVE, 1); REG_SET_5(DC_PERFMON5_PERFCOUNTER_CNTL2, 0, PERFCOUNTER_CNTL2_SEL, 0x4, // select counter 4
@@ -1509,7 +1523,7 @@ static void hubbub60_perfmon_arm_measuring_out_of_order_bandwidth(REG_SET_2 (DC_PERFMON5_PERFMON_CNTL2 ,0 ,PERFMON_RUN_ENABLE_START_SEL ,0x0 , -PERFMON_RUN_ENABLE_STOP_SEL ,11 );// perfmon counter off event +PERFMON_RUN_ENABLE_STOP_SEL ,10 );// stop on counter-off event }/**
@@ -1517,9 +1531,9 @@ static void hubbub60_perfmon_arm_measuring_out_of_order_bandwidth(* @hubbub: pointer to the hubbub hardware instance * * Enables the performance monitor counters previously configured by -* hubbub60_perfmon_arm_measuring_out_of_order_bandwidth(). The counter -* self-stops once the count-off counter reaches its target; there is no -* explicit stop step for the peak-BW path. +* hubbub60_perfmon_arm_measuring_out_of_order_bandwidth(). Counter 2 stops +* the measurement once it reaches its target; there is no explicit stop +* step for the peak-BW path. */ static void hubbub60_perfmon_start_measuring_out_of_order_bandwidth (struct hubbub *hubbub)
Signature · 1 line
2.43.0
PATCH 38/66 drm/amd/display: Add instance field to struct mpc
In reply to Chenyu ChenFrom: Tony Cheng <[email protected]>
[Why]
struct mpc has no instance identifier, unlike other DC hardware blocks. Debug and tracing helpers need one to identify the block.
[How]
Add an inst member to struct mpc and initialize it to 0 in every dcnXX_mpc_construct(), since there is one MPC instance per ASIC.
--- drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h | 1 + drivers/gpu/drm/amd/display/dc/mpc/dcn10/dcn10_mpc.c | 1 + drivers/gpu/drm/amd/display/dc/mpc/dcn20/dcn20_mpc.c | 1 + drivers/gpu/drm/amd/display/dc/mpc/dcn30/dcn30_mpc.c | 1 + drivers/gpu/drm/amd/display/dc/mpc/dcn32/dcn32_mpc.c | 1 + drivers/gpu/drm/amd/display/dc/mpc/dcn401/dcn401_mpc.c | 1 + drivers/gpu/drm/amd/display/dc/mpc/dcn42/dcn42_mpc.c | 1 + drivers/gpu/drm/amd/display/dc/mpc/dcn60/dcn60_mpc.c | 1 + 8 files changed, 8 insertions(+)
drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h +1 -0
@@ -281,6 +281,7 @@ struct mpc_tree {struct mpc {const struct mpc_funcs *funcs;struct dc_context *ctx; +int inst;struct mpcc mpcc_array[MAX_MPCC ];struct pwl_params blender_params;
drivers/gpu/drm/amd/display/dc/mpc/dcn10/dcn10_mpc.c +1 -0
@@ -503,6 +503,7 @@ void dcn10_mpc_construct(struct dcn10_mpc *mpc10,int i; mpc10->base.ctx = ctx; + mpc10->base.inst =0 ; mpc10->base.funcs = &dcn10_mpc_funcs;
drivers/gpu/drm/amd/display/dc/mpc/dcn20/dcn20_mpc.c +1 -0
@@ -588,6 +588,7 @@ void dcn20_mpc_construct(struct dcn20_mpc *mpc20,int i; mpc20->base.ctx = ctx; + mpc20->base.inst =0 ; mpc20->base.funcs = &dcn20_mpc_funcs;
drivers/gpu/drm/amd/display/dc/mpc/dcn30/dcn30_mpc.c +1 -0
@@ -1589,6 +1589,7 @@ void dcn30_mpc_construct(struct dcn30_mpc *mpc30,int i; mpc30->base.ctx = ctx; + mpc30->base.inst =0 ; mpc30->base.funcs = &dcn30_mpc_funcs;
drivers/gpu/drm/amd/display/dc/mpc/dcn32/dcn32_mpc.c +1 -0
@@ -1036,6 +1036,7 @@ void dcn32_mpc_construct(struct dcn30_mpc *mpc30,int i; mpc30->base.ctx = ctx; + mpc30->base.inst =0 ; mpc30->base.funcs = &dcn32_mpc_funcs;
drivers/gpu/drm/amd/display/dc/mpc/dcn401/dcn401_mpc.c +1 -0
@@ -680,6 +680,7 @@ void dcn401_mpc_construct(struct dcn401_mpc *mpc401,int i; mpc401->base.ctx = ctx; + mpc401->base.inst =0 ; mpc401->base.funcs = &dcn401_mpc_funcs;
drivers/gpu/drm/amd/display/dc/mpc/dcn42/dcn42_mpc.c +1 -0
@@ -121,6 +121,7 @@ void dcn42_mpc_construct(struct dcn42_mpc *mpc42,int i; mpc42->base.ctx = ctx; + mpc42->base.inst =0 ; mpc42->base.funcs = &dcn42_mpc_funcs;
drivers/gpu/drm/amd/display/dc/mpc/dcn60/dcn60_mpc.c +1 -0
@@ -273,6 +273,7 @@ void dcn60_mpc_construct(struct dcn60_mpc *mpc60,int i; mpc60->base.ctx = ctx; + mpc60->base.inst =0 ; mpc60->base.funcs = &dcn60_mpc_funcs;
Signature · 1 line
2.43.0
PATCH 39/66 drm/amd/display: Enable back alt-ch
In reply to Chenyu ChenFrom: Alvin Lee <[email protected]>
[Description]
Enable back alt-ch support since external dependencies are ready. Also enable workaround path for better debug capability.
--- drivers/gpu/drm/amd/display/dc/resource/dcn60/dcn60_resource.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/resource/dcn60/dcn60_resource.c +1 -2
@@ -670,11 +670,10 @@ static const struct dc_debug_options debug_defaults_drv = { .enable_ppt_check = true, .enable_offload_flip = true, .enable_stall_recovery = true, + .alternate_channel_workaround = true, } }, .force_cositing = CHROMA_COSITING_NONE + 1, - .dml21_disable_pstate_method_mask = 0x20, // disable alt-ch unconditionally until dependencies are ready - };static const struct dc_check_config config_defaults = {
Signature · 1 line
2.43.0
PATCH 40/66 drm/amd/display: Decouple HUBP_UPDATE_PLANE_ADDR from pipe_ctx
In reply to Chenyu ChenFrom: Tomasz Siemek <[email protected]>
[Why]
Every HWSS Block Level Sequence operation should have flat parameter list and an explicit instance pointer. Global state should not be accessed at execute time.
HUBP_UPDATE_PLANE_ADDR does not adhere. It stashes pipe_ctx in its params. Pipe context is mutated during execution.
[How]
- Adjust HUBP_UPDATE_PLANE_ADDR params to hubp_program_surface_flip_and_addr parameter list.
- Add a build-phase hwss vtable entry - prepare_plane_addr_update that does parameter preparation and all global state mutation.
- Execute hubp_program_surface_flip_and_addr with precalculated parameters during execution phase.
--- .../drm/amd/display/dc/core/dc_hw_sequencer.c | 26 ++++++++++++------- .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 25 ++++++++++++++---- .../amd/display/dc/hwss/dcn10/dcn10_hwseq.h | 2 ++ .../amd/display/dc/hwss/dcn10/dcn10_init.c | 1 + .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 25 ++++++++++++++---- .../amd/display/dc/hwss/dcn20/dcn20_hwseq.h | 2 ++ .../amd/display/dc/hwss/dcn20/dcn20_init.c | 1 + .../amd/display/dc/hwss/dcn201/dcn201_hwseq.c | 26 +++++++++++++++---- .../amd/display/dc/hwss/dcn201/dcn201_hwseq.h | 2 ++ .../amd/display/dc/hwss/dcn201/dcn201_init.c | 1 + .../amd/display/dc/hwss/dcn21/dcn21_init.c | 1 + .../amd/display/dc/hwss/dcn30/dcn30_init.c | 1 + .../amd/display/dc/hwss/dcn301/dcn301_init.c | 1 + .../amd/display/dc/hwss/dcn31/dcn31_init.c | 1 + .../amd/display/dc/hwss/dcn314/dcn314_init.c | 1 + .../amd/display/dc/hwss/dcn32/dcn32_init.c | 1 + .../amd/display/dc/hwss/dcn35/dcn35_init.c | 1 + .../amd/display/dc/hwss/dcn351/dcn351_init.c | 1 + .../amd/display/dc/hwss/dcn401/dcn401_init.c | 1 + .../amd/display/dc/hwss/dcn42/dcn42_init.c | 1 + .../amd/display/dc/hwss/dcn60/dcn60_init.c | 1 + .../drm/amd/display/dc/hwss/hw_sequencer.h | 9 +++++-- 22 files changed, 105 insertions(+), 26 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +17 -9
@@ -1471,7 +1471,7 @@ void hwss_build_fast_sequence(struct dc *dc, block_sequence[*num_steps].func =HUBP_PROGRAM_TRIPLEBUFFER ; (*num_steps)++; } -if (dc->hwss.update_plane_addr && current_mpc_pipe->plane_state->update_bits.addr_update) { +if (dc->hwss.prepare_plane_addr_update && current_mpc_pipe->plane_state->update_bits.addr_update) {if (resource_is_pipe_type (current_mpc_pipe,OTG_MASTER ) && stream_status->mall_stream_config.type ==SUBVP_MAIN ) { block_sequence[*num_steps].params.subvp_save_surf_addr.dc_dmub_srv = dc->ctx->dmub_srv;
@@ -1481,10 +1481,7 @@ void hwss_build_fast_sequence(struct dc *dc, (*num_steps)++; } - block_sequence[*num_steps].params.update_plane_addr_params.dc = dc; - block_sequence[*num_steps].params.update_plane_addr_params.pipe_ctx = current_mpc_pipe; - block_sequence[*num_steps].func =HUBP_UPDATE_PLANE_ADDR ; - (*num_steps)++; +hwss_add_hubp_update_plane_addr (&seq_state, dc, current_mpc_pipe); } if (current_mpc_pipe->plane_state->update_bits.lut_3d &&
@@ -1713,8 +1710,10 @@ void hwss_execute_sequence(struct dc *dc, params->program_triplebuffer_params.enableTripleBuffer);break ;case HUBP_UPDATE_PLANE_ADDR : - dc->hwss.update_plane_addr (params->update_plane_addr_params.dc, - params->update_plane_addr_params.pipe_ctx); + params->update_plane_addr_params.hubp->funcs->hubp_program_surface_flip_and_addr ( + params->update_plane_addr_params.hubp, + ¶ms->update_plane_addr_params.address, + params->update_plane_addr_params.flip_immediate);break ;case DPP_SET_INPUT_TRANSFER_FUNC : hws->funcs.set_input_transfer_func (¶ms->set_input_transfer_func_params);
@@ -2345,9 +2344,18 @@ void hwss_add_hubp_update_plane_addr(struct block_sequence_state *seq_state,struct dc *dc, struct pipe_ctx *pipe_ctx) { + struct hubp *hubp = pipe_ctx->plane_res.hubp; + +if (!dc->hwss.prepare_plane_addr_update || !hubp || !hubp->funcs->hubp_program_surface_flip_and_addr) +return ; +if (*seq_state->num_steps <MAX_HWSS_BLOCK_SEQUENCE_SIZE ) { - seq_state->steps[*seq_state->num_steps].params.update_plane_addr_params.dc = dc; - seq_state->steps[*seq_state->num_steps].params.update_plane_addr_params.pipe_ctx = pipe_ctx; +struct update_plane_addr_params *params = + &seq_state->steps[*seq_state->num_steps].params.update_plane_addr_params; + + dc->hwss.prepare_plane_addr_update (dc, pipe_ctx, + ¶ms->address, ¶ms->flip_immediate); + params->hubp = hubp; seq_state->steps[*seq_state->num_steps].func =HUBP_UPDATE_PLANE_ADDR ; (*seq_state->num_steps)++; }
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +20 -5
@@ -2060,7 +2060,8 @@ static bool patch_address_for_sbs_tb_stereo(return false; } -void dcn10_update_plane_addr (const struct dc *dc,struct pipe_ctx *pipe_ctx) +void dcn10_prepare_plane_addr_update (const struct dc *dc,struct pipe_ctx *pipe_ctx, +struct dc_plane_address *addr_to_program,bool *flip_immediate) { (void )dc;bool addr_patched = false;
@@ -2072,10 +2073,8 @@ void dcn10_update_plane_addr(const struct dc *dc, struct pipe_ctx *pipe_ctx) addr_patched =patch_address_for_sbs_tb_stereo (pipe_ctx, &addr); - pipe_ctx->plane_res.hubp->funcs->hubp_program_surface_flip_and_addr ( - pipe_ctx->plane_res.hubp, - &plane_state->address, - plane_state->flip_immediate); + *addr_to_program = plane_state->address; + *flip_immediate = plane_state->flip_immediate; plane_state->status.requested_address = plane_state->address;
@@ -2086,6 +2085,22 @@ void dcn10_update_plane_addr(const struct dc *dc, struct pipe_ctx *pipe_ctx) pipe_ctx->plane_state->address.grph_stereo.left_addr = addr; } +void dcn10_update_plane_addr (const struct dc *dc,struct pipe_ctx *pipe_ctx) +{ +struct dc_plane_address address; +bool flip_immediate; + +if (pipe_ctx->plane_state ==NULL ) +return ; + +dcn10_prepare_plane_addr_update (dc, pipe_ctx, &address, &flip_immediate); + + pipe_ctx->plane_res.hubp->funcs->hubp_program_surface_flip_and_addr ( + pipe_ctx->plane_res.hubp, + &address, + flip_immediate); +} +bool dcn10_set_input_transfer_func (struct set_input_transfer_func_params *params) {struct dpp *dpp = params->dpp;
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.h +2 -0
@@ -73,6 +73,8 @@ void dcn10_program_output_csc(struct dc *dc,bool dcn10_set_output_transfer_func (struct set_output_transfer_func_params *params);bool dcn10_set_input_transfer_func (struct set_input_transfer_func_params *params);void dcn10_update_plane_addr (const struct dc *dc,struct pipe_ctx *pipe_ctx); +void dcn10_prepare_plane_addr_update (const struct dc *dc,struct pipe_ctx *pipe_ctx, +struct dc_plane_address *addr_to_program,bool *flip_immediate);void dcn10_update_mpcc (struct dc *dc,struct pipe_ctx *pipe_ctx); void dcn10_reset_hw_ctx_wrap( struct dc *dc,
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_init.c +1 -0
@@ -39,6 +39,7 @@ static const struct hw_sequencer_funcs dcn10_funcs = { .post_unlock_program_front_end = dcn10_post_unlock_program_front_end, .wait_for_pending_cleared = dcn10_wait_for_pending_cleared, .update_plane_addr = dcn10_update_plane_addr, + .prepare_plane_addr_update = dcn10_prepare_plane_addr_update, .update_dchub = dcn10_update_dchub, .update_pending_status = dcn10_update_pending_status, .clear_surface_dcc_and_tiling = dcn10_reset_surface_dcc_and_tiling,
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +20 -5
@@ -2777,7 +2777,8 @@ static bool patch_address_for_sbs_tb_stereo(return false; } -void dcn20_update_plane_addr (const struct dc *dc,struct pipe_ctx *pipe_ctx) +void dcn20_prepare_plane_addr_update (const struct dc *dc,struct pipe_ctx *pipe_ctx, +struct dc_plane_address *addr_to_program,bool *flip_immediate) {bool addr_patched = false;PHYSICAL_ADDRESS_LOC addr;
@@ -2792,10 +2793,8 @@ void dcn20_update_plane_addr(const struct dc *dc, struct pipe_ctx *pipe_ctx)vm_helper_mark_vmid_used (dc->vm_helper, plane_state->address.vmid, (uint8_t )pipe_ctx->plane_res.hubp->inst); - pipe_ctx->plane_res.hubp->funcs->hubp_program_surface_flip_and_addr ( - pipe_ctx->plane_res.hubp, - &plane_state->address, - plane_state->flip_immediate); + *addr_to_program = plane_state->address; + *flip_immediate = plane_state->flip_immediate; plane_state->status.requested_address = plane_state->address;
@@ -2806,6 +2805,22 @@ void dcn20_update_plane_addr(const struct dc *dc, struct pipe_ctx *pipe_ctx) pipe_ctx->plane_state->address.grph_stereo.left_addr = addr; } +void dcn20_update_plane_addr (const struct dc *dc,struct pipe_ctx *pipe_ctx) +{ +struct dc_plane_address address; +bool flip_immediate; + +if (pipe_ctx->plane_state ==NULL ) +return ; + +dcn20_prepare_plane_addr_update (dc, pipe_ctx, &address, &flip_immediate); + + pipe_ctx->plane_res.hubp->funcs->hubp_program_surface_flip_and_addr ( + pipe_ctx->plane_res.hubp, + &address, + flip_immediate); +} +void dcn20_unblank_stream (struct pipe_ctx *pipe_ctx,struct dc_link_settings *link_settings) {
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.h +2 -0
@@ -41,6 +41,8 @@ void dcn20_post_unlock_program_front_end(struct dc *dc, struct dc_state *context);void dcn20_update_plane_addr (const struct dc *dc,struct pipe_ctx *pipe_ctx); +void dcn20_prepare_plane_addr_update (const struct dc *dc,struct pipe_ctx *pipe_ctx, +struct dc_plane_address *addr_to_program,bool *flip_immediate);void dcn20_update_mpcc (struct dc *dc,struct pipe_ctx *pipe_ctx);bool dcn20_set_input_transfer_func (struct set_input_transfer_func_params *params);bool dcn20_set_output_transfer_func (struct set_output_transfer_func_params *params);
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_init.c +1 -0
@@ -40,6 +40,7 @@ static const struct hw_sequencer_funcs dcn20_funcs = { .wait_for_pending_cleared = dcn10_wait_for_pending_cleared, .post_unlock_program_front_end = dcn20_post_unlock_program_front_end, .update_plane_addr = dcn20_update_plane_addr, + .prepare_plane_addr_update = dcn20_prepare_plane_addr_update, .update_dchub = dcn10_update_dchub, .update_pending_status = dcn10_update_pending_status, .program_output_csc = dcn20_program_output_csc,
drivers/gpu/drm/amd/display/dc/hwss/dcn201/dcn201_hwseq.c +21 -5
@@ -133,7 +133,8 @@ static void plane_address_in_gpu_space_to_uma(struct dce_hwseq *hwseq, } } -void dcn201_update_plane_addr (const struct dc *dc,struct pipe_ctx *pipe_ctx) +void dcn201_prepare_plane_addr_update (const struct dc *dc,struct pipe_ctx *pipe_ctx, +struct dc_plane_address *addr_to_program,bool *flip_immediate) {bool addr_patched = false;PHYSICAL_ADDRESS_LOC addr;
@@ -149,10 +150,9 @@ void dcn201_update_plane_addr(const struct dc *dc, struct pipe_ctx *pipe_ctx)plane_address_in_gpu_space_to_uma (hws, &uma); - pipe_ctx->plane_res.hubp->funcs->hubp_program_surface_flip_and_addr ( - pipe_ctx->plane_res.hubp, - &uma, - plane_state->flip_immediate); +/* snapshot the UMA-converted address before the stereo patch is restored */ + *addr_to_program = uma; + *flip_immediate = plane_state->flip_immediate; plane_state->status.requested_address = plane_state->address;
@@ -163,6 +163,22 @@ void dcn201_update_plane_addr(const struct dc *dc, struct pipe_ctx *pipe_ctx) pipe_ctx->plane_state->address.grph_stereo.left_addr = addr; } +void dcn201_update_plane_addr (const struct dc *dc,struct pipe_ctx *pipe_ctx) +{ +struct dc_plane_address address; +bool flip_immediate; + +if (pipe_ctx->plane_state ==NULL ) +return ; + +dcn201_prepare_plane_addr_update (dc, pipe_ctx, &address, &flip_immediate); + + pipe_ctx->plane_res.hubp->funcs->hubp_program_surface_flip_and_addr ( + pipe_ctx->plane_res.hubp, + &address, + flip_immediate); +} +/* Blank pixel data during initialization */ void dcn201_init_blank( struct dc *dc,
drivers/gpu/drm/amd/display/dc/hwss/dcn201/dcn201_hwseq.h +2 -0
@@ -33,6 +33,8 @@ void dcn201_init_hw(struct dc *dc);void dcn201_unblank_stream (struct pipe_ctx *pipe_ctx,struct dc_link_settings *link_settings);void dcn201_update_plane_addr (const struct dc *dc,struct pipe_ctx *pipe_ctx); +void dcn201_prepare_plane_addr_update (const struct dc *dc,struct pipe_ctx *pipe_ctx, +struct dc_plane_address *addr_to_program,bool *flip_immediate);void dcn201_plane_atomic_disconnect (struct dc *dc,struct dc_state *state,struct pipe_ctx *pipe_ctx);void dcn201_update_mpcc (struct dc *dc,struct pipe_ctx *pipe_ctx);void dcn201_set_cursor_attribute (struct pipe_ctx *pipe_ctx);
drivers/gpu/drm/amd/display/dc/hwss/dcn201/dcn201_init.c +1 -0
@@ -41,6 +41,7 @@ static const struct hw_sequencer_funcs dcn201_funcs = { .wait_for_pending_cleared = dcn10_wait_for_pending_cleared, .post_unlock_program_front_end = dcn10_post_unlock_program_front_end, .update_plane_addr = dcn201_update_plane_addr, + .prepare_plane_addr_update = dcn201_prepare_plane_addr_update, .update_dchub = dcn10_update_dchub, .update_pending_status = dcn10_update_pending_status, .program_output_csc = dcn20_program_output_csc,
drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_init.c +1 -0
@@ -41,6 +41,7 @@ static const struct hw_sequencer_funcs dcn21_funcs = { .wait_for_pending_cleared = dcn10_wait_for_pending_cleared, .post_unlock_program_front_end = dcn20_post_unlock_program_front_end, .update_plane_addr = dcn20_update_plane_addr, + .prepare_plane_addr_update = dcn20_prepare_plane_addr_update, .update_dchub = dcn10_update_dchub, .update_pending_status = dcn10_update_pending_status, .program_output_csc = dcn20_program_output_csc,
drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_init.c +1 -0
@@ -41,6 +41,7 @@ static const struct hw_sequencer_funcs dcn30_funcs = { .wait_for_pending_cleared = dcn10_wait_for_pending_cleared, .post_unlock_program_front_end = dcn20_post_unlock_program_front_end, .update_plane_addr = dcn20_update_plane_addr, + .prepare_plane_addr_update = dcn20_prepare_plane_addr_update, .update_dchub = dcn10_update_dchub, .update_pending_status = dcn10_update_pending_status, .program_output_csc = dcn20_program_output_csc,
drivers/gpu/drm/amd/display/dc/hwss/dcn301/dcn301_init.c +1 -0
@@ -43,6 +43,7 @@ static const struct hw_sequencer_funcs dcn301_funcs = { .wait_for_pending_cleared = dcn10_wait_for_pending_cleared, .post_unlock_program_front_end = dcn20_post_unlock_program_front_end, .update_plane_addr = dcn20_update_plane_addr, + .prepare_plane_addr_update = dcn20_prepare_plane_addr_update, .update_dchub = dcn10_update_dchub, .update_pending_status = dcn10_update_pending_status, .program_output_csc = dcn20_program_output_csc,
drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_init.c +1 -0
@@ -44,6 +44,7 @@ static const struct hw_sequencer_funcs dcn31_funcs = { .wait_for_pending_cleared = dcn10_wait_for_pending_cleared, .post_unlock_program_front_end = dcn20_post_unlock_program_front_end, .update_plane_addr = dcn20_update_plane_addr, + .prepare_plane_addr_update = dcn20_prepare_plane_addr_update, .update_dchub = dcn10_update_dchub, .update_pending_status = dcn10_update_pending_status, .program_output_csc = dcn20_program_output_csc,
drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_init.c +1 -0
@@ -46,6 +46,7 @@ static const struct hw_sequencer_funcs dcn314_funcs = { .wait_for_pending_cleared = dcn10_wait_for_pending_cleared, .post_unlock_program_front_end = dcn20_post_unlock_program_front_end, .update_plane_addr = dcn20_update_plane_addr, + .prepare_plane_addr_update = dcn20_prepare_plane_addr_update, .update_dchub = dcn10_update_dchub, .update_pending_status = dcn10_update_pending_status, .program_output_csc = dcn20_program_output_csc,
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_init.c +1 -0
@@ -44,6 +44,7 @@ static const struct hw_sequencer_funcs dcn32_funcs = { .wait_for_pending_cleared = dcn10_wait_for_pending_cleared, .post_unlock_program_front_end = dcn20_post_unlock_program_front_end, .update_plane_addr = dcn20_update_plane_addr, + .prepare_plane_addr_update = dcn20_prepare_plane_addr_update, .update_dchub = dcn10_update_dchub, .update_pending_status = dcn10_update_pending_status, .program_output_csc = dcn20_program_output_csc,
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_init.c +1 -0
@@ -48,6 +48,7 @@ static const struct hw_sequencer_funcs dcn35_funcs = { .wait_for_pending_cleared = dcn10_wait_for_pending_cleared, .post_unlock_program_front_end = dcn20_post_unlock_program_front_end, .update_plane_addr = dcn20_update_plane_addr, + .prepare_plane_addr_update = dcn20_prepare_plane_addr_update, .update_dchub = dcn10_update_dchub, .update_pending_status = dcn10_update_pending_status, .program_output_csc = dcn20_program_output_csc,
drivers/gpu/drm/amd/display/dc/hwss/dcn351/dcn351_init.c +1 -0
@@ -47,6 +47,7 @@ static const struct hw_sequencer_funcs dcn351_funcs = { .wait_for_pending_cleared = dcn10_wait_for_pending_cleared, .post_unlock_program_front_end = dcn20_post_unlock_program_front_end, .update_plane_addr = dcn20_update_plane_addr, + .prepare_plane_addr_update = dcn20_prepare_plane_addr_update, .update_dchub = dcn10_update_dchub, .update_pending_status = dcn10_update_pending_status, .program_output_csc = dcn20_program_output_csc,
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_init.c +1 -0
@@ -23,6 +23,7 @@ static const struct hw_sequencer_funcs dcn401_funcs = { .wait_for_pending_cleared = dcn10_wait_for_pending_cleared, .post_unlock_program_front_end = dcn401_post_unlock_program_front_end, .update_plane_addr = dcn20_update_plane_addr, + .prepare_plane_addr_update = dcn20_prepare_plane_addr_update, .update_dchub = dcn10_update_dchub, .update_pending_status = dcn10_update_pending_status, .program_output_csc = dcn20_program_output_csc,
drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_init.c +1 -0
@@ -26,6 +26,7 @@ static const struct hw_sequencer_funcs dcn42_funcs = { .wait_for_pending_cleared = dcn10_wait_for_pending_cleared, .post_unlock_program_front_end = dcn401_post_unlock_program_front_end, .update_plane_addr = dcn20_update_plane_addr, + .prepare_plane_addr_update = dcn20_prepare_plane_addr_update, .update_dchub = dcn10_update_dchub, .update_pending_status = dcn10_update_pending_status, .program_output_csc = dcn20_program_output_csc,
drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_init.c +1 -0
@@ -25,6 +25,7 @@ static const struct hw_sequencer_funcs dcn60_funcs = { .wait_for_pending_cleared = dcn10_wait_for_pending_cleared, .post_unlock_program_front_end = dcn50_post_unlock_program_front_end, .update_plane_addr = dcn20_update_plane_addr, + .prepare_plane_addr_update = dcn20_prepare_plane_addr_update, .update_dchub = dcn10_update_dchub, .update_pending_status = dcn10_update_pending_status, .program_output_csc = dcn20_program_output_csc,
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +7 -2
@@ -92,8 +92,9 @@ struct program_triplebuffer_params { };struct update_plane_addr_params { -struct dc *dc; -struct pipe_ctx *pipe_ctx; +struct hubp *hubp; +struct dc_plane_address address; +bool flip_immediate; };struct set_input_transfer_func_params {
@@ -1457,6 +1458,10 @@ struct hw_sequencer_funcs { struct dc_state *context);void (*update_plane_addr)(const struct dc *dc,struct pipe_ctx *pipe_ctx); +void (*prepare_plane_addr_update)(const struct dc *dc, +struct pipe_ctx *pipe_ctx, +struct dc_plane_address *addr_to_program, +bool *flip_immediate);void (*update_dchub)(struct dce_hwseq *hws,struct dchub_init_data *dh_data); void (*wait_for_mpcc_disconnect)(struct dc *dc,
Signature · 1 line
2.43.0
PATCH 41/66 drm/amd/display: Cleanup DMUB command submission interfaces
In reply to Chenyu ChenFrom: Dillon Varone <[email protected]>
[WHY&HOW]
Allow for custom timeout passing where needed, and make inputs const where applicable.
--- drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 41 +++++++++++-------- drivers/gpu/drm/amd/display/dc/dc_dmub_srv.h | 12 +++++- drivers/gpu/drm/amd/display/dmub/dmub_srv.h | 2 +- .../gpu/drm/amd/display/dmub/src/dmub_srv.c | 7 +++- 4 files changed, 41 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c +25 -16
@@ -41,8 +41,6 @@#define DC_LOGGER CTX->logger#define GPINT_RETRY_NUM 20 -#define MAX_WAIT_US 500000 -static void dc_dmub_srv_construct (struct dc_dmub_srv *dc_srv,struct dc *dc,struct dmub_srv *dmub) {
@@ -93,7 +91,7 @@ bool dc_dmub_srv_wait_for_pending(struct dc_dmub_srv *dc_dmub_srv) dmub = dc_dmub_srv->dmub;do { - status =dmub_srv_wait_for_pending (dmub,MAX_WAIT_US ); + status =dmub_srv_wait_for_pending (dmub,DMUB_CMD_DEFAULT_MAX_WAIT_US ); }while (dc_dmub_srv->ctx->dc->debug.disable_timeout && status !=DMUB_STATUS_OK );if (status !=DMUB_STATUS_OK ) {
@@ -123,7 +121,7 @@ void dc_dmub_srv_wait_for_inbox0_ack(struct dc_dmub_srv *dc_dmub_srv)struct dc_context *dc_ctx = dc_dmub_srv->ctx;enum dmub_status status =DMUB_STATUS_OK ; - status =dmub_srv_wait_for_inbox0_ack (dmub,MAX_WAIT_US ); + status =dmub_srv_wait_for_inbox0_ack (dmub,DMUB_CMD_DEFAULT_MAX_WAIT_US );if (status !=DMUB_STATUS_OK ) {DC_ERROR ("Error waiting for INBOX0 HW Lock Ack\n" );dc_dmub_srv_handle_failure (dc_dmub_srv);
@@ -146,7 +144,8 @@ void dc_dmub_srv_send_inbox0_cmd(struct dc_dmub_srv *dc_dmub_srv,static bool dc_dmub_srv_reg_cmd_list_queue_execute (struct dc_dmub_srv *dc_dmub_srv,unsigned int count, -union dmub_rb_cmd *cmd_list) +const union dmub_rb_cmd *cmd_list, +unsigned int timeout_us) {struct dc_context *dc_ctx;struct dmub_srv *dmub;
@@ -162,7 +161,7 @@ static bool dc_dmub_srv_reg_cmd_list_queue_execute(struct dc_dmub_srv *dc_dmub_sfor (i =0 ; i < count; i++) {/* confirm no messages pending */ do { - status =dmub_srv_wait_for_idle (dmub,MAX_WAIT_US ); + status =dmub_srv_wait_for_idle (dmub, timeout_us); }while (dc_dmub_srv->ctx->dc->debug.disable_timeout && status !=DMUB_STATUS_OK );/* queue command */
@@ -188,7 +187,8 @@ static bool dc_dmub_srv_reg_cmd_list_queue_execute(struct dc_dmub_srv *dc_dmub_sstatic bool dc_dmub_srv_fb_cmd_list_queue_execute (struct dc_dmub_srv *dc_dmub_srv,unsigned int count, -union dmub_rb_cmd *cmd_list) +const union dmub_rb_cmd *cmd_list, +unsigned int timeout_us) {struct dc_context *dc_ctx;struct dmub_srv *dmub;
@@ -217,7 +217,7 @@ static bool dc_dmub_srv_fb_cmd_list_queue_execute(struct dc_dmub_srv *dc_dmub_srreturn false;do { - status =dmub_srv_wait_for_inbox_free (dmub,MAX_WAIT_US , count - i); + status =dmub_srv_wait_for_inbox_free (dmub, timeout_us, count - i); }while (dc_dmub_srv->ctx->dc->debug.disable_timeout && status !=DMUB_STATUS_OK );/* Requeue the command. */
@@ -245,17 +245,18 @@ static bool dc_dmub_srv_fb_cmd_list_queue_execute(struct dc_dmub_srv *dc_dmub_srreturn true; } -bool dc_dmub_srv_cmd_list_queue_execute (struct dc_dmub_srv *dc_dmub_srv, +bool dc_dmub_srv_cmd_list_queue_execute_timeout (struct dc_dmub_srv *dc_dmub_srv,unsigned int count, -union dmub_rb_cmd *cmd_list) +const union dmub_rb_cmd *cmd_list, +unsigned int timeout_us) {bool res = false;if (dc_dmub_srv && dc_dmub_srv->dmub) {if (dc_dmub_srv->dmub->inbox_type ==DMUB_CMD_INTERFACE_REG ) { - res =dc_dmub_srv_reg_cmd_list_queue_execute (dc_dmub_srv, count, cmd_list); + res =dc_dmub_srv_reg_cmd_list_queue_execute (dc_dmub_srv, count, cmd_list, timeout_us); }else { - res =dc_dmub_srv_fb_cmd_list_queue_execute (dc_dmub_srv, count, cmd_list); + res =dc_dmub_srv_fb_cmd_list_queue_execute (dc_dmub_srv, count, cmd_list, timeout_us); }if (res)
@@ -265,9 +266,17 @@ bool dc_dmub_srv_cmd_list_queue_execute(struct dc_dmub_srv *dc_dmub_srv,return res; } +bool dc_dmub_srv_cmd_list_queue_execute (struct dc_dmub_srv *dc_dmub_srv, +unsigned int count, +const union dmub_rb_cmd *cmd_list) +{ +return dc_dmub_srv_cmd_list_queue_execute_timeout (dc_dmub_srv, count, cmd_list,DMUB_CMD_DEFAULT_MAX_WAIT_US ); +} +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) +union dmub_rb_cmd *cmd_list, +unsigned int timeout_us) {struct dmub_srv *dmub;enum dmub_status status;
@@ -280,7 +289,7 @@ bool dc_dmub_srv_wait_for_idle(struct dc_dmub_srv *dc_dmub_srv,// Wait for DMUB to process command if (wait_type !=DM_DMUB_WAIT_TYPE_NO_WAIT ) {do { - status =dmub_srv_wait_for_idle (dmub,MAX_WAIT_US ); + status =dmub_srv_wait_for_idle (dmub, timeout_us); }while (dc_dmub_srv->ctx->dc->debug.disable_timeout && status !=DMUB_STATUS_OK );if (status !=DMUB_STATUS_OK ) {
@@ -314,7 +323,7 @@ bool dc_dmub_srv_cmd_run_list(struct dc_dmub_srv *dc_dmub_srv, unsigned int counif (!dc_dmub_srv_cmd_list_queue_execute (dc_dmub_srv, count, cmd_list))return false; -return dc_dmub_srv_wait_for_idle (dc_dmub_srv, wait_type, cmd_list); +return dc_dmub_srv_wait_for_idle (dc_dmub_srv, wait_type, cmd_list,DMUB_CMD_DEFAULT_MAX_WAIT_US ); }bool dc_dmub_srv_optimized_init_done (struct dc_dmub_srv *dc_dmub_srv)
@@ -1370,7 +1379,7 @@ static void dc_dmub_srv_notify_idle(const struct dc *dc, bool allow_idle) ips_fw->signals.bits.ips1_commit, ips_fw->signals.bits.ips2_commit); -dc_dmub_srv_wait_for_idle (dc->ctx->dmub_srv,DM_DMUB_WAIT_TYPE_WAIT ,NULL ); +dc_dmub_srv_wait_for_idle (dc->ctx->dmub_srv,DM_DMUB_WAIT_TYPE_WAIT ,NULL ,DMUB_CMD_DEFAULT_MAX_WAIT_US );memset (&new_signals,0 ,sizeof (new_signals));
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.h +10 -2
@@ -29,6 +29,8 @@#include "dm_services_types.h" #include "dmub/dmub_srv.h" +#define DMUB_CMD_DEFAULT_MAX_WAIT_US 500000 +struct dmub_srv ;struct dc ;struct dc_context ;
@@ -59,11 +61,17 @@ bool dc_dmub_srv_optimized_init_done(struct dc_dmub_srv *dc_dmub_srv);bool dc_dmub_srv_cmd_list_queue_execute (struct dc_dmub_srv *dc_dmub_srv,unsigned int count, -union dmub_rb_cmd *cmd_list); +const union dmub_rb_cmd *cmd_list); + +bool dc_dmub_srv_cmd_list_queue_execute_timeout (struct dc_dmub_srv *dc_dmub_srv, +unsigned int count, +const union dmub_rb_cmd *cmd_list, +unsigned int timeout_us);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); +union dmub_rb_cmd *cmd_list, +unsigned int timeout_us);bool dc_dmub_srv_cmd_run (struct dc_dmub_srv *dc_dmub_srv,union dmub_rb_cmd *cmd,enum dm_dmub_wait_type wait_type);
drivers/gpu/drm/amd/display/dmub/dmub_srv.h +1 -1
@@ -1073,7 +1073,7 @@ void dmub_srv_set_power_state(struct dmub_srv *dmub, enum dmub_srv_power_state_t* DMUB_STATUS_OK - success * DMUB_STATUS_INVALID - unspecified error */ -enum dmub_status dmub_srv_reg_cmd_execute (struct dmub_srv *dmub,union dmub_rb_cmd *cmd); +enum dmub_status dmub_srv_reg_cmd_execute (struct dmub_srv *dmub,const union dmub_rb_cmd *cmd);/**
drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c +5 -2
@@ -1385,7 +1385,7 @@ void dmub_srv_set_power_state(struct dmub_srv *dmub, enum dmub_srv_power_state_t dmub->power_state = dmub_srv_power_state; } -enum dmub_status dmub_srv_reg_cmd_execute (struct dmub_srv *dmub,union dmub_rb_cmd *cmd) +enum dmub_status dmub_srv_reg_cmd_execute (struct dmub_srv *dmub,const union dmub_rb_cmd *cmd) {uint64_t num_pending =0 ;
@@ -1411,7 +1411,10 @@ enum dmub_status dmub_srv_reg_cmd_execute(struct dmub_srv *dmub, union dmub_rb_c/* clear last rsp ack and send message */ dmub->hw_funcs.clear_reg_inbox0_rsp_int_ack (dmub); - dmub->hw_funcs.send_reg_inbox0_cmd_msg (dmub, cmd); +/* hw_funcs signature is not const as some ASIC variants may reuse the +* buffer; send_reg_inbox0_cmd_msg implementations only read from cmd. +*/ + dmub->hw_funcs.send_reg_inbox0_cmd_msg (dmub, (union dmub_rb_cmd *)cmd); dmub->reg_inbox0.num_submitted++; dmub->reg_inbox0.is_pending = true;
Signature · 1 line
2.43.0
PATCH 42/66 drm/amd/display: Enable power gating on dcn42b
In reply to Chenyu ChenFrom: Gabe Teeger <[email protected]>
Turn on power gating by default for dcn42b in the following domains:
DPP, HUBP, DSC.
Root clock gating is enabled for the following domains:
DPP, DSC, DPSTREAM, SYMCLK.
Now DCN42b will match the exact PG and CG policies as dcn42.
--- .../dc/resource/dcn42b/dcn42b_resource.c | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c +12 -9
@@ -802,9 +802,13 @@ static const struct dc_debug_options debug_defaults_drv = { .force_abm_enable = false, .clock_trace = true, .disable_pplib_clock_request = false, - .disable_dpp_power_gate = true, - .disable_hubp_power_gate = true, + .ignore_pg = false, + .disable_dpp_power_gate = false, + .disable_hubp_power_gate = false, .disable_optc_power_gate = true, + .disable_dsc_power_gate = false, + .disable_dio_power_gate = true, + .disable_hpo_power_gate = true, .pipe_split_policy = MPC_SPLIT_AVOID, .force_single_disp_pipe_split = false, .disable_dcc = DCC_ENABLE,
@@ -830,14 +834,14 @@ static const struct dc_debug_options debug_defaults_drv = { }}, .root_clock_optimization = { .bits = { - .dpp = false, - .dsc = false,/*dscclk and dsc pg*/ + .dpp = true, + .dsc = true,/*dscclk and dsc pg*/ .hdmistream = false, .hdmichar = false, - .dpstream = false, - .symclk32_se = false, - .symclk32_le = false, - .symclk_fe = false, + .dpstream = true, + .symclk32_se = true, + .symclk32_le = true, + .symclk_fe = true, .physymclk = false, .dpiasymclk = false, }
@@ -866,7 +870,6 @@ static const struct dc_debug_options debug_defaults_drv = { .min_disp_clk_khz = 50000, .static_screen_wait_frames = 2, .disable_z10 = false, - .ignore_pg = true, .disable_stutter_for_wm_program = true, .min_deep_sleep_dcfclk_khz = 8000, .replay_skip_crtc_disabled = true,
Signature · 1 line
2.43.0
PATCH 43/66 drm/amd/display: Bound DSC power gating loop by num_dsc
In reply to Chenyu ChenFrom: Gabe Teeger <[email protected]>
pg_cntl42_dsc_pg_status(i) should be bounded by the number of dsc, which is different from the number of DPP on dcn42b.
--- drivers/gpu/drm/amd/display/dc/pg/dcn42/dcn42_pg_cntl.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/display/dc/pg/dcn42/dcn42_pg_cntl.c +4 -0
@@ -6,6 +6,7 @@#include "core_types.h" #include "dcn42_pg_cntl.h" #include "dccg.h" +#include "resource.h" #define TO_DCN_PG_CNTL (pg_cntl)\ container_of(pg_cntl, struct dcn_pg_cntl, base)
@@ -582,7 +583,10 @@ void pg_cntl42_init_pg_status(struct pg_cntl *pg_cntl) block_enabled =pg_cntl42_hubp_dpp_pg_status (pg_cntl, i); pg_cntl->pg_pipe_res_enable[PG_HUBP ][i] = block_enabled; pg_cntl->pg_pipe_res_enable[PG_DPP ][i] = block_enabled; + } +/* DSC count can be lower than pipe count (e.g. DCN42B has 4 pipes, 3 DSCs) */ +for (i =0 ; i < (unsigned int )pg_cntl->ctx->dc->res_pool->res_cap->num_dsc; i++) { block_enabled =pg_cntl42_dsc_pg_status (pg_cntl, i); pg_cntl->pg_pipe_res_enable[PG_DSC ][i] = block_enabled; }
Signature · 1 line
2.43.0
PATCH 44/66 drm/amd/display: Add lock-free memory pool
In reply to Chenyu ChenFrom: Dominik Kaszewski <[email protected]>
[Why]
Two memory limitations - limited stack size and heap allocations not allowed in interrupts - combined together lead to scratch structures and buffers scattered throughout the code, requiring piping them through interfaces.
[How]
* OS-provided lock-free lists still need external locking for some operations, requiring a custom implementation.
* Implement memory pool which can preallocate a number of blocks with given size, then later "allocate" from them without any heap use.
* Pool implemented as lock-free Treiber stack to avoid operations being blocked by suspended thread, including a same-thread interrupt exemption causing an indefinite block.
* Indexed free list and generation counter protect against ABA data corruption.
--- drivers/gpu/drm/amd/display/dc/Makefile | 1 + .../gpu/drm/amd/display/dc/dc_memory_pool.c | 277 ++++++++++++++++++ .../gpu/drm/amd/display/dc/dc_memory_pool.h | 107 +++++++ drivers/gpu/drm/amd/display/dc/os_types.h | 1 + 4 files changed, 386 insertions(+) create mode 100644 drivers/gpu/drm/amd/display/dc/dc_memory_pool.c create mode 100644 drivers/gpu/drm/amd/display/dc/dc_memory_pool.h
drivers/gpu/drm/amd/display/dc/Makefile +1 -0
@@ -67,6 +67,7 @@ FILES += dc_dmub_srv.o FILES += dc_edid_parser.o FILES += dc_fused_io.o FILES += dc_helper.o +FILES += dc_memory_pool.o FILES += core/dc.o FILES += core/dc_debug.o FILES += core/dc_hw_sequencer.o
drivers/gpu/drm/amd/display/dc/dc_memory_pool.c new file +277 -0
277 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dc_memory_pool.h new file +107 -0
107 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/os_types.h +1 -0
@@ -27,6 +27,7 @@#ifndef _OS_TYPES_H_#define _OS_TYPES_H_ +#include <linux/compiler_attributes.h> #include <linux/slab.h> #include <linux/kgdb.h> #include <linux/delay.h>
Signature · 1 line
2.43.0
PATCH 45/66 drm/amd/display: Rename lock_and_validation_needed to needs_dc_state_realloc
In reply to Chenyu ChenFrom: James Lin <[email protected]>
[Why & How]
Split the boolean's two meanings: it only tracks whether the commit needs to rebuild the dc_state and take the global lock, not the update magnitude. Rename it so the name reflects that; no functional change.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +15 -15
@@ -5443,7 +5443,7 @@ STATIC_IFN_KUNIT int dm_update_crtc_state(struct amdgpu_display_manager *dm,struct drm_crtc_state *old_crtc_state, struct drm_crtc_state *new_crtc_state, bool enable, - bool *lock_and_validation_needed) + bool *needs_dc_state_realloc) { struct dm_atomic_state *dm_state = NULL;struct dm_crtc_state *dm_old_crtc_state, *dm_new_crtc_state;
@@ -5616,7 +5616,7 @@ STATIC_IFN_KUNIT int dm_update_crtc_state(struct amdgpu_display_manager *dm,amdgpu_dm_reset_freesync_config_for_crtc (dm_new_crtc_state); - *lock_and_validation_needed = true; + *needs_dc_state_realloc = true; }else {/* Add stream for any updated/enabled CRTC */ /*
@@ -5654,7 +5654,7 @@ STATIC_IFN_KUNIT int dm_update_crtc_state(struct amdgpu_display_manager *dm, goto fail; } - *lock_and_validation_needed = true; + *needs_dc_state_realloc = true; } }
@@ -5886,7 +5886,7 @@ dm_update_plane_state(struct dc *dc,struct drm_plane_state *old_plane_state, struct drm_plane_state *new_plane_state, bool enable, - bool *lock_and_validation_needed, + bool *needs_dc_state_realloc, bool *is_top_most_overlay) {
@@ -5957,7 +5957,7 @@ dm_update_plane_state(struct dc *dc, dm_new_plane_state->dc_state =NULL ; - *lock_and_validation_needed = true; + *needs_dc_state_realloc = true; }else {/* Add new planes */ struct dc_plane_state *dc_new_plane_state;
@@ -6035,7 +6035,7 @@ dm_update_plane_state(struct dc *dc,*/ dm_new_plane_state->dc_state->update_bits.full_update =1 ; - *lock_and_validation_needed = true; + *needs_dc_state_realloc = true; } out:
@@ -6192,7 +6192,7 @@ STATIC_IFN_KUNIT int amdgpu_dm_atomic_check(struct drm_device *dev,struct drm_plane_state *old_plane_state, *new_plane_state, *new_cursor_state;enum dc_status status;int ret, i; -bool lock_and_validation_needed = false; +bool needs_dc_state_realloc = false;bool is_top_most_overlay = true;struct dm_crtc_state *dm_old_crtc_state, *dm_new_crtc_state;struct drm_dp_mst_topology_mgr *mgr;
@@ -6366,7 +6366,7 @@ STATIC_IFN_KUNIT int amdgpu_dm_atomic_check(struct drm_device *dev, old_plane_state, new_plane_state, false, - &lock_and_validation_needed, + &needs_dc_state_realloc, &is_top_most_overlay);if (ret) {drm_dbg_atomic (dev,"dm_update_plane_state() failed: %pe\n" ,ERR_PTR (ret));
@@ -6380,7 +6380,7 @@ STATIC_IFN_KUNIT int amdgpu_dm_atomic_check(struct drm_device *dev, old_crtc_state, new_crtc_state, false, - &lock_and_validation_needed); + &needs_dc_state_realloc);if (ret) {drm_dbg_atomic (dev,"DISABLE: dm_update_crtc_state() failed: %pe\n" ,ERR_PTR (ret)); goto fail;
@@ -6393,7 +6393,7 @@ STATIC_IFN_KUNIT int amdgpu_dm_atomic_check(struct drm_device *dev, old_crtc_state, new_crtc_state, true, - &lock_and_validation_needed); + &needs_dc_state_realloc);if (ret) {drm_dbg_atomic (dev,"ENABLE: dm_update_crtc_state() failed: %pe\n" ,ERR_PTR (ret)); goto fail;
@@ -6406,7 +6406,7 @@ STATIC_IFN_KUNIT int amdgpu_dm_atomic_check(struct drm_device *dev, old_plane_state, new_plane_state, true, - &lock_and_validation_needed, + &needs_dc_state_realloc, &is_top_most_overlay);if (ret) {drm_dbg_atomic (dev,"dm_update_plane_state() failed: %pe\n" ,ERR_PTR (ret));
@@ -6521,7 +6521,7 @@ STATIC_IFN_KUNIT int amdgpu_dm_atomic_check(struct drm_device *dev,if (!is_scaling_state_different (dm_new_con_state, dm_old_con_state))continue ; - lock_and_validation_needed = true; + needs_dc_state_realloc = true; }/* set the slot info for each mst_state based on the link encoding format */
@@ -6557,7 +6557,7 @@ STATIC_IFN_KUNIT int amdgpu_dm_atomic_check(struct drm_device *dev,* * TODO: Remove this stall and drop DM state private objects. */ -if (lock_and_validation_needed) { +if (needs_dc_state_realloc) { ret =dm_atomic_get_state (state, &dm_state);if (ret) {drm_dbg_atomic (dev,"dm_atomic_get_state() failed: %pe\n" ,ERR_PTR (ret));
@@ -6658,7 +6658,7 @@ STATIC_IFN_KUNIT int amdgpu_dm_atomic_check(struct drm_device *dev,* the FB pitch, the DCC state, rotation, mem_type, etc. */ if (new_crtc_state->async_flip && - (lock_and_validation_needed || + (needs_dc_state_realloc ||amdgpu_dm_crtc_mem_type_changed (dev, state, new_crtc_state))) { drm_dbg_atomic(crtc->dev, "[CRTC:%d:%s] async flips are only supported for fast updates\n",
@@ -6667,7 +6667,7 @@ STATIC_IFN_KUNIT int amdgpu_dm_atomic_check(struct drm_device *dev, goto fail; } - dm_new_crtc_state->update_type = lock_and_validation_needed ? + dm_new_crtc_state->update_type = needs_dc_state_realloc ?UPDATE_TYPE_FULL :UPDATE_TYPE_FAST ; }
Signature · 1 line
2.43.0
PATCH 46/66 drm/amd/display: Attach only plane updates that actually changed
In reply to Chenyu ChenFrom: James Lin <[email protected]>
[Why & How]
Cache the last programmed dc_flip_addrs/dc_plane_info/dc_scaling_info in dm_plane_state and carry them across atomic_duplicate_state. In amdgpu_dm_commit_planes() attach each flip_addr/plane_info/scaling_info surface update only when it differs from the cache (memcmp), so an address-only flip sends no plane_info/scaling_info update and stays on the FAMS2 offload path.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 43 ++++++++++++++++--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 14 ++++++ .../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 32 ++++++++++++++ .../amdgpu_dm/tests/amdgpu_dm_plane_test.c | 21 ++++++++- 4 files changed, 101 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +36 -7
@@ -3923,6 +3923,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_commit *state,bool plane_needs_flip;struct dc_plane_state *dc_plane;struct dm_plane_state *dm_new_plane_state =to_dm_plane_state (new_plane_state); +struct dm_plane_state *dm_old_plane_state =to_dm_plane_state (old_plane_state);/* Cursor plane is handled after stream updates */ if (plane->type == DRM_PLANE_TYPE_CURSOR &&
@@ -3957,11 +3958,22 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_commit *state, bundle->surface_updates[planes_count].cm = &dc_plane->cm; } -amdgpu_dm_plane_fill_dc_scaling_info (dm->adev, new_plane_state, - &bundle->scaling_infos[planes_count]); +if (amdgpu_dm_plane_fill_dc_scaling_info (dm->adev, new_plane_state, + &bundle->scaling_infos[planes_count])) { + planes_count +=1 ; +continue ; + } - bundle->surface_updates[planes_count].scaling_info = - &bundle->scaling_infos[planes_count]; +/* Cache the newly computed scaling_info in the plane state */ + *dm_new_plane_state->scaling_info = + bundle->scaling_infos[planes_count]; + +/* Only send a scaling_info update if it changed vs the old state */ +if (memcmp (dm_old_plane_state->scaling_info, + dm_new_plane_state->scaling_info, +sizeof (struct dc_scaling_info ))) + bundle->surface_updates[planes_count].scaling_info = + &bundle->scaling_infos[planes_count]; plane_needs_flip = old_plane_state->fb && new_plane_state->fb;
@@ -3982,8 +3994,16 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_commit *state, new_plane_state->plane->index, bundle->plane_infos[planes_count].dcc.enable); - bundle->surface_updates[planes_count].plane_info = - &bundle->plane_infos[planes_count]; +/* Cache the newly computed plane_info in the plane state */ + *dm_new_plane_state->plane_info = + bundle->plane_infos[planes_count]; + +/* Only send a plane_info update if it changed vs the old state */ +if (memcmp (dm_old_plane_state->plane_info, + dm_new_plane_state->plane_info, +sizeof (struct dc_plane_info ))) + bundle->surface_updates[planes_count].plane_info = + &bundle->plane_infos[planes_count];if (acrtc_state->stream->link->psr_settings.psr_feature_enabled || acrtc_state->stream->link->replay_settings.replay_feature_enabled) {
@@ -4038,7 +4058,16 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_commit *state, timestamp_ns =ktime_get_ns (); bundle->flip_addrs[planes_count].flip_timestamp_in_us =div_u64 (timestamp_ns,1000 ); - bundle->surface_updates[planes_count].flip_addr = &bundle->flip_addrs[planes_count]; +/* Cache the newly computed flip_addr in the plane state */ + *dm_new_plane_state->flip_addr = + bundle->flip_addrs[planes_count]; + +/* Only send a flip_addr update if it changed vs the old state */ +if (memcmp (dm_old_plane_state->flip_addr, + dm_new_plane_state->flip_addr, +sizeof (struct dc_flip_addrs ))) + bundle->surface_updates[planes_count].flip_addr = + &bundle->flip_addrs[planes_count]; bundle->surface_updates[planes_count].surface = dc_plane;if (!bundle->surface_updates[planes_count].surface) {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +14 -0
@@ -937,6 +937,10 @@ enum amdgpu_transfer_function {AMDGPU_TRANSFER_FUNCTION_COUNT }; +struct dc_flip_addrs ; +struct dc_scaling_info ; +struct dc_plane_info ; +struct dm_plane_state {struct drm_plane_state base;struct dc_plane_state *dc_state;
@@ -1006,6 +1010,16 @@ struct dm_plane_state {* applying blend LUT. */ enum amdgpu_transfer_function blend_tf; + +/* Cached per-plane surface descriptors kept in the DRM plane state. +* The DRM atomic old/new state swap lets us compare the previous +* commit's values (old) against the newly computed ones to detect a +* real plane change (vs an address-only flip) so DC only gets a +* scaling_info/plane_info surface update when it actually changed. +*/ +struct dc_flip_addrs *flip_addr; +struct dc_scaling_info *scaling_info; +struct dc_plane_info *plane_info; };enum amdgpu_dm_cursor_mode {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +32 -0
@@ -33,6 +33,7 @@#include <drm/drm_fourcc.h> #include "amdgpu.h" +#include "dc.h" #include "dal_asic_id.h" #include "amdgpu_display.h" #include "amdgpu_dm_trace.h"
@@ -1806,6 +1807,18 @@ STATIC_IFN_KUNIT void amdgpu_dm_plane_drm_plane_reset(struct drm_plane *plane)if (!amdgpu_state)return ; + amdgpu_state->flip_addr =kzalloc_obj (*amdgpu_state->flip_addr); + amdgpu_state->scaling_info =kzalloc_obj (*amdgpu_state->scaling_info); + amdgpu_state->plane_info =kzalloc_obj (*amdgpu_state->plane_info); +if (!amdgpu_state->flip_addr || !amdgpu_state->scaling_info || + !amdgpu_state->plane_info) { +kfree (amdgpu_state->flip_addr); +kfree (amdgpu_state->scaling_info); +kfree (amdgpu_state->plane_info); +kfree (amdgpu_state); +return ; + } +if (plane->state) plane->funcs->atomic_destroy_state (plane, plane->state);
@@ -1827,6 +1840,21 @@ amdgpu_dm_plane_drm_plane_duplicate_state(struct drm_plane *plane)if (!dm_plane_state)return NULL ; + dm_plane_state->flip_addr =kmemdup (old_dm_plane_state->flip_addr, +sizeof (*old_dm_plane_state->flip_addr),GFP_KERNEL ); + dm_plane_state->scaling_info =kmemdup (old_dm_plane_state->scaling_info, +sizeof (*old_dm_plane_state->scaling_info),GFP_KERNEL ); + dm_plane_state->plane_info =kmemdup (old_dm_plane_state->plane_info, +sizeof (*old_dm_plane_state->plane_info),GFP_KERNEL ); +if (!dm_plane_state->flip_addr || !dm_plane_state->scaling_info || + !dm_plane_state->plane_info) { +kfree (dm_plane_state->flip_addr); +kfree (dm_plane_state->scaling_info); +kfree (dm_plane_state->plane_info); +kfree (dm_plane_state); +return NULL ; + } +__drm_atomic_helper_plane_duplicate_state (plane, &dm_plane_state->base);if (old_dm_plane_state->dc_state) {
@@ -1946,6 +1974,10 @@ STATIC_IFN_KUNIT void amdgpu_dm_plane_drm_plane_destroy_state(struct drm_plane *if (dm_plane_state->blend_lut)drm_property_blob_put (dm_plane_state->blend_lut); +kfree (dm_plane_state->flip_addr); +kfree (dm_plane_state->scaling_info); +kfree (dm_plane_state->plane_info); +if (dm_plane_state->dc_state)dc_plane_state_release (dm_plane_state->dc_state);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +19 -2
@@ -2977,7 +2977,7 @@ static void dm_test_plane_reset_initializes_state(struct kunit *test)KUNIT_EXPECT_EQ (test, new_state->shaper_tf,AMDGPU_TRANSFER_FUNCTION_DEFAULT );KUNIT_EXPECT_EQ (test, new_state->blend_tf,AMDGPU_TRANSFER_FUNCTION_DEFAULT ); -kfree (new_state); +amdgpu_dm_plane_drm_plane_destroy_state (plane, &new_state->base); }/**
@@ -3000,6 +3000,14 @@ static void dm_test_plane_duplicate_state_copies_fields(struct kunit *test)KUNIT_ASSERT_NOT_NULL (test, plane);KUNIT_ASSERT_NOT_NULL (test, old_state); +/* duplicate_state kmemdup()s these, so the source state must own them. */ + old_state->flip_addr =kunit_kzalloc (test,sizeof (*old_state->flip_addr),GFP_KERNEL ); + old_state->scaling_info =kunit_kzalloc (test,sizeof (*old_state->scaling_info),GFP_KERNEL ); + old_state->plane_info =kunit_kzalloc (test,sizeof (*old_state->plane_info),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, old_state->flip_addr); +KUNIT_ASSERT_NOT_NULL (test, old_state->scaling_info); +KUNIT_ASSERT_NOT_NULL (test, old_state->plane_info); + old_state->degamma_tf =AMDGPU_TRANSFER_FUNCTION_PQ_EOTF ; old_state->hdr_mult =0x123456789ULL ; old_state->shaper_tf =AMDGPU_TRANSFER_FUNCTION_IDENTITY ;
@@ -3016,7 +3024,7 @@ static void dm_test_plane_duplicate_state_copies_fields(struct kunit *test)KUNIT_EXPECT_EQ (test, dup_state->blend_tf,AMDGPU_TRANSFER_FUNCTION_SRGB_EOTF );KUNIT_EXPECT_NULL (test, dup_state->dc_state); -kfree (dup_state); +amdgpu_dm_plane_drm_plane_destroy_state (plane, dup_base); }/*
@@ -3067,6 +3075,15 @@ static void dm_test_plane_duplicate_state_copies_resources(struct kunit *test)kref_init (&dc_plane_state->refcount); old_state->dc_state = dc_plane_state;dm_test_attach_color_blobs (test, &adev->ddev, old_state); + +/* duplicate_state kmemdup()s these, so the source state must own them. */ + old_state->flip_addr =kunit_kzalloc (test,sizeof (*old_state->flip_addr),GFP_KERNEL ); + old_state->scaling_info =kunit_kzalloc (test,sizeof (*old_state->scaling_info),GFP_KERNEL ); + old_state->plane_info =kunit_kzalloc (test,sizeof (*old_state->plane_info),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, old_state->flip_addr); +KUNIT_ASSERT_NOT_NULL (test, old_state->scaling_info); +KUNIT_ASSERT_NOT_NULL (test, old_state->plane_info); + plane->state = &old_state->base; dup_base =amdgpu_dm_plane_drm_plane_duplicate_state (plane);
Signature · 1 line
2.43.0
PATCH 47/66 drm/amd/display: Request DMUB HW cursor offload
In reply to Chenyu ChenFrom: James Lin <[email protected]>
[Why & How]
Request cursor offload in dc_config and initialize it after DMUB is up (dc_dmub_srv_cursor_offload_init), which self-gates on the firmware cursor_offload_v1_support capability, so cursor programming no longer takes the inbox0 lock on alt-in-use streams.
--- 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, 18 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +10 -0
@@ -608,6 +608,13 @@ 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 ];
@@ -725,6 +732,9 @@ 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 +8 -1
@@ -1211,9 +1211,16 @@ 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 = dc->ctx->dmub_srv; +struct dc_dmub_srv *dc_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.43.0
PATCH 48/66 drm/amd/display: Send stream_update to DC only when it changed
In reply to Chenyu ChenFrom: James Lin <[email protected]>
[Why & How]
Track stream_update_needed and pass &bundle->stream_update to DC only when a real stream property was actually written (native-cursor disable, cursor position/attributes, VRR infopacket, modeset src/dst, color management, ABM level); otherwise pass NULL. An address-only flip then carries no stream_update and stays on the FAMS2 offload path.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +12 -3
@@ -3885,6 +3885,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_commit *state,bool flip_latched_during_prog = false;bool dirty_rects_changed = false;bool updated_planes_and_streams = false; +bool stream_update_needed = false;struct {struct dc_surface_update surface_updates[MAX_SURFACES ];struct dc_plane_info plane_infos[MAX_SURFACES ];
@@ -3918,6 +3919,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_commit *state, bundle->stream_update.cursor_position = &acrtc_state->stream->cursor_position; + stream_update_needed = true; } if (acrtc_state->active_planes == 0 &&
@@ -3941,8 +3943,10 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_commit *state,if ((fb && crtc == pcrtc) || (old_plane_state->fb && old_plane_state->crtc == pcrtc)) { cursor_update = true; -if (amdgpu_ip_version (dm->adev,DCE_HWIP ,0 ) !=0 ) +if (amdgpu_ip_version (dm->adev,DCE_HWIP ,0 ) !=0 ) {amdgpu_dm_update_cursor (plane, old_plane_state, &bundle->stream_update); + stream_update_needed = true; + } }continue ;
@@ -4149,6 +4153,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_commit *state, &acrtc_state->stream->vrr_infopacket; bundle->stream_update.vsp_infopacket = &acrtc_state->stream->vsp_infopacket; + stream_update_needed = true; } } }
@@ -4183,6 +4188,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_commit *state,if (new_pcrtc_state->mode_changed) { bundle->stream_update.src = acrtc_state->stream->src; bundle->stream_update.dst = acrtc_state->stream->dst; + stream_update_needed = true; }if (new_pcrtc_state->color_mgmt_changed) {
@@ -4200,11 +4206,14 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_commit *state, (struct dc_3dlut *) acrtc_state->stream->lut3d_func; bundle->stream_update.func_shaper = (struct dc_transfer_func *) acrtc_state->stream->func_shaper; + stream_update_needed = true; } acrtc_state->stream->abm_level = acrtc_state->abm_level; -if (acrtc_state->abm_level != dm_old_crtc_state->abm_level) +if (acrtc_state->abm_level != dm_old_crtc_state->abm_level) { bundle->stream_update.abm_level = &acrtc_state->abm_level; + stream_update_needed = true; + }/* * If FreeSync state on the stream has changed then we need to
@@ -4223,7 +4232,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_commit *state, acrtc_state->update_type, planes_count, acrtc_state->stream, - &bundle->stream_update, + stream_update_needed ? &bundle->stream_update :NULL , bundle->surface_updates); updated_planes_and_streams = true;
Signature · 1 line
2.43.0
PATCH 49/66 drm/amd/display: Drop dead update_type param from update_planes_and_stream_adapter
In reply to Chenyu ChenFrom: James Lin <[email protected]>
[Why & How]
The adapter never read update_type; DC derives the update type itself inside dc_update_planes_and_stream(). Drop the dead parameter from the prototype, the two callers and the KUnit tests.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 ---- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 1 - drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c | 4 ++-- 3 files changed, 2 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -4
@@ -275,7 +275,6 @@ static const struct amdgpu_dm_kunit_ops *amdgpu_dm_ops;* before passing control to DC. * * @dc: Display Core control structure -* @update_type: specify whether it is FULL/MEDIUM/FAST update * @planes_count: planes count to update * @stream: stream state * @stream_update: stream update
@@ -284,7 +283,6 @@ static const struct amdgpu_dm_kunit_ops *amdgpu_dm_ops;*/ STATIC_IFN_KUNIT INLINE_IFN_KUNIT bool update_planes_and_stream_adapter(struct dc *dc, - int update_type, int planes_count, struct dc_stream_state *stream, struct dc_stream_update *stream_update,
@@ -1807,7 +1805,6 @@ STATIC_IFN_KUNIT void dm_gpureset_commit_state(struct dc_state *dc_state, } update_planes_and_stream_adapter(dm->dc, - UPDATE_TYPE_FULL, dc_state->stream_status[k].plane_count, dc_state->streams[k], &bundle->stream_update,
@@ -4229,7 +4226,6 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_commit *state, }mutex_lock (&dm->dc_lock); update_planes_and_stream_adapter(dm->dc, - acrtc_state->update_type, planes_count, acrtc_state->stream, stream_update_needed ? &bundle->stream_update : NULL,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +0 -1
@@ -1251,7 +1251,6 @@ void s3_handle_mst(struct drm_device *dev, bool suspend);void dm_gpureset_commit_state (struct dc_state *dc_state,struct amdgpu_display_manager *dm);int dm_plane_layer_index_cmp (const void *a,const void *b); bool update_planes_and_stream_adapter(struct dc *dc, - int update_type, int planes_count, struct dc_stream_state *stream, struct dc_stream_update *stream_update,
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +2 -2
@@ -413,7 +413,7 @@ static void dm_test_update_planes_adapter_sorts_and_forwards(struct kunit *test) };dm_test_install_dm_ops (test, &dm_test_plane_update_ops); -KUNIT_EXPECT_TRUE (test,update_planes_and_stream_adapter (dc,UPDATE_TYPE_FAST ,3 , +KUNIT_EXPECT_TRUE (test,update_planes_and_stream_adapter (dc,3 , stream, stream_update, updates));KUNIT_EXPECT_EQ (test, updates[0 ].surface->layer_index,5 );KUNIT_EXPECT_EQ (test, updates[1 ].surface->layer_index,3 );
@@ -436,7 +436,7 @@ static void dm_test_update_planes_adapter_propagates_failure(struct kunit *test) dm_test_plane_update_ctx = (struct dm_test_plane_update_ops_ctx ) {0 };dm_test_install_dm_ops (test, &dm_test_plane_update_ops); -KUNIT_EXPECT_FALSE (test,update_planes_and_stream_adapter (NULL ,UPDATE_TYPE_FAST ,0 , +KUNIT_EXPECT_FALSE (test,update_planes_and_stream_adapter (NULL ,0 ,NULL ,NULL ,NULL )); }
Signature · 1 line
2.43.0
PATCH 50/66 drm/amd/display: Flush ISM work before releasing the stream
In reply to Chenyu ChenFrom: Ray Wu <[email protected]>
[Why]
ISM timers are not tied to the atomic commit, so a timer armed before a DPMS off can still fire after the stream is released. The external display check in dcn35_apply_idle_power_optimizations() loops over the active streams, so with none left it never runs and idle is allowed on an external-only system.
[How]
Wait out pending and in-flight ISM work before dc_stream_release(); dc_lock is not held there, so the sync wait is safe. Rename amdgpu_dm_ism_fini() to amdgpu_dm_ism_flush() and assert dc_lock is not held.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 ++ .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 6 +- .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c | 21 ++++- .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.h | 2 +- .../amdgpu_dm/tests/amdgpu_dm_ism_test.c | 83 ++++++++++--------- 5 files changed, 72 insertions(+), 47 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +7 -0
@@ -4612,6 +4612,13 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_commit *state, (!new_crtc_state->active || drm_atomic_crtc_needs_modeset(new_crtc_state))) {manage_dm_interrupts (adev, acrtc,NULL ); +/* +* ISM hysteresis lives on system_dfl_wq, not the +* vblank workqueue. Wait it out so a timer armed while +* the stream existed cannot allow idle after the +* stream is released. +*/ +amdgpu_dm_ism_flush (&acrtc->ism);dc_stream_release (dm_old_crtc_state->stream); } }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +3 -3
@@ -480,9 +480,9 @@ EXPORT_IF_KUNIT(amdgpu_dm_crtc_duplicate_state); STATIC_IFN_KUNIT void amdgpu_dm_crtc_destroy(struct drm_crtc *crtc) {/* -* amdgpu_dm_ism_fini() is intentionally called in amdgpu_dm_fini(). -* It must be called before dc_destroy() in amdgpu_dm_fini() -* to avoid ISM accessing an invalid dc handle once dc is released. +* ISM workers are intentionally quiesced by amdgpu_dm_ism_disable() +* in amdgpu_dm_fini(). That must happen before dc_destroy() so ISM +* cannot access an invalid dc handle once dc is released. */ drm_crtc_cleanup (crtc);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c +19 -2
@@ -647,9 +647,26 @@ void amdgpu_dm_ism_init(struct amdgpu_dm_ism *ism,EXPORT_IF_KUNIT (amdgpu_dm_ism_init); -void amdgpu_dm_ism_fini (struct amdgpu_dm_ism *ism) +/** +* amdgpu_dm_ism_flush - Cancel any pending, or wait out in-flight ISM work +* +* @ism: The CRTC's idle state manager +* +* Cancels the hysteresis and SSO timers and waits for a running worker to +* finish. Callers that are about to drop the CRTC's stream use this so that a +* timer armed while the stream was still around cannot allow idle afterwards. +* +* Must not be called with dc_lock held: the workers take dc_lock themselves, +* so waiting for them under it would deadlock. +*/ +void amdgpu_dm_ism_flush (struct amdgpu_dm_ism *ism) { +struct amdgpu_crtc *acrtc =ism_to_amdgpu_crtc (ism); +struct amdgpu_device *adev =drm_to_adev (acrtc->base.dev); + +lockdep_assert_not_held (&adev->dm.dc_lock); +cancel_delayed_work_sync (&ism->sso_delayed_work);cancel_delayed_work_sync (&ism->delayed_work); } -EXPORT_IF_KUNIT (amdgpu_dm_ism_fini); +EXPORT_IF_KUNIT (amdgpu_dm_ism_flush);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.h +1 -1
@@ -142,7 +142,7 @@ struct amdgpu_dm_ism {void amdgpu_dm_ism_init (struct amdgpu_dm_ism *ism,struct amdgpu_dm_ism_config *config); -void amdgpu_dm_ism_fini (struct amdgpu_dm_ism *ism); +void amdgpu_dm_ism_flush (struct amdgpu_dm_ism *ism);void amdgpu_dm_ism_commit_event (struct amdgpu_dm_ism *ism,enum amdgpu_dm_ism_event event);void amdgpu_dm_ism_disable (struct amdgpu_display_manager *dm);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_ism_test.c +42 -41
185 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH 51/66 drm/amd/display: Cap DML2.1 vmin ODM combine at 2:1 for eDP
In reply to Chenyu ChenFrom: Leo Chen <[email protected]>
[Why]
Currently in DML2.1, by design, the DPMs are unpinned when optimizing for Vmin PMO. This leads to an issue on DCN42 on specific panels (e.g. 4k144 eDP) where ODM4:1 is applied unexpectedly, which affects the urgent bandwidth required, raises DCFCLK to DPM1, and thus blocks Z8.
[How]
Clamp the ODM combine limit to 2 for eDP streams directly in pmo_dcn4_fams2_optimize_for_vmin()
--- .../dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c +10 -1
@@ -887,6 +887,7 @@ bool pmo_dcn4_fams2_optimize_for_vmin(struct dml2_pmo_optimize_for_vmin_in_out *const struct dml2_core_mode_support_result *mode_support_result = &in_out->base_display_config->mode_support_result;unsigned int odms_used; +int odm_combine_limit;struct dml2_stream_parameters *stream_descriptor;bool optimizable = false;
@@ -901,8 +902,16 @@ bool pmo_dcn4_fams2_optimize_for_vmin(struct dml2_pmo_optimize_for_vmin_in_out * in_out->base_display_config->stage4.unoptimizable_streams[stream_index])return false; +/* +* Enforce a max cap on ODM combine factor of 2:1 for eDP stream +*/ + odm_combine_limit = in_out->instance->odm_combine_limit; +if (display_config->stream_descriptors[stream_index].output.output_encoder == dml2_edp && + odm_combine_limit >2 ) + odm_combine_limit =2 ; + odms_used = mode_support_result->cfg_support_info.stream_support_info[stream_index].odms_used; -if ((int )odms_used >= in_out->instance->odm_combine_limit) +if ((int )odms_used >= odm_combine_limit)return false; memcpy(in_out->optimized_display_config,
Signature · 1 line
2.43.0
PATCH 52/66 drm/amd/display: Add is_odm_enabled callback to skip init_odm on active ODM pipes
In reply to Chenyu ChenFrom: "Wang, Sung-huai" <[email protected]>
[Why]dcn10_init_pipes unconditionally calls init_odm on all enabled TGs, resetting ODM combine state even when it should be preserved.
[How]
Add is_odm_enabled callback to timing_generator_funcs and guard init_odm to skip when ODM is already active.
--- .../gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 4 +++- .../gpu/drm/amd/display/dc/inc/hw/timing_generator.h | 1 + drivers/gpu/drm/amd/display/dc/optc/dcn31/dcn31_optc.c | 10 ++++++++++ drivers/gpu/drm/amd/display/dc/optc/dcn31/dcn31_optc.h | 1 + .../gpu/drm/amd/display/dc/optc/dcn314/dcn314_optc.c | 1 + drivers/gpu/drm/amd/display/dc/optc/dcn35/dcn35_optc.c | 1 + drivers/gpu/drm/amd/display/dc/optc/dcn42/dcn42_optc.c | 1 + 7 files changed, 18 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +3 -1
@@ -1750,7 +1750,9 @@ void dcn10_init_pipes(struct dc *dc, struct dc_state *context)if (tg->funcs->is_tg_enabled (tg)) {if (tg->funcs->init_odm) - tg->funcs->init_odm (tg); +if (!tg->funcs->is_odm_enabled || + !tg->funcs->is_odm_enabled (tg)) + tg->funcs->init_odm (tg); } tg->funcs->tg_init (tg);
drivers/gpu/drm/amd/display/dc/inc/hw/timing_generator.h +1 -0
@@ -512,6 +512,7 @@ struct timing_generator_funcs { uint32_t vtotal_change_limit);void (*init_odm)(struct timing_generator *tg); +bool (*is_odm_enabled)(struct timing_generator *tg);void (*wait_drr_doublebuffer_pending_clear)(struct timing_generator *tg);void (*set_long_vtotal)(struct timing_generator *optc,const struct long_vtotal_params *params);void (*wait_odm_doublebuffer_pending_clear)(struct timing_generator *tg);
drivers/gpu/drm/amd/display/dc/optc/dcn31/dcn31_optc.c +10 -0
@@ -221,6 +221,15 @@ void optc31_set_drr( } } +bool optc3_is_odm_enabled (struct timing_generator *optc) +{ +struct optc *optc1 =DCN10TG_FROM_TG (optc); +uint32_t num_segments =0 ; + +REG_GET (OPTC_DATA_SOURCE_SELECT ,OPTC_NUM_OF_INPUT_SEGMENT , &num_segments); +return num_segments >0 ; +} +void optc3_init_odm (struct timing_generator *optc) {struct optc *optc1 =DCN10TG_FROM_TG (optc);
@@ -503,6 +512,7 @@ static const struct timing_generator_funcs dcn31_tg_funcs = { .setup_manual_trigger = optc2_setup_manual_trigger, .get_hw_timing = optc1_get_hw_timing, .init_odm = optc3_init_odm, + .is_odm_enabled = optc3_is_odm_enabled, .is_two_pixels_per_container = optc1_is_two_pixels_per_container, .read_otg_state = optc31_read_otg_state, .optc_read_reg_state = optc31_read_reg_state,
drivers/gpu/drm/amd/display/dc/optc/dcn31/dcn31_optc.h +1 -0
@@ -274,6 +274,7 @@ bool optc31_immediate_disable_crtc(struct timing_generator *optc);void optc31_set_drr (struct timing_generator *optc,const struct drr_params *params);void optc3_init_odm (struct timing_generator *optc); +bool optc3_is_odm_enabled (struct timing_generator *optc);void optc31_read_otg_state (struct timing_generator *optc,struct dcn_otg_state *s);
drivers/gpu/drm/amd/display/dc/optc/dcn314/dcn314_optc.c +1 -0
@@ -247,6 +247,7 @@ static const struct timing_generator_funcs dcn314_tg_funcs = { .setup_manual_trigger = optc2_setup_manual_trigger, .get_hw_timing = optc1_get_hw_timing, .init_odm = optc3_init_odm, + .is_odm_enabled = optc3_is_odm_enabled, .set_odm_bypass = optc314_set_odm_bypass, .set_odm_combine = optc314_set_odm_combine, .set_h_timing_div_manual_mode = optc314_set_h_timing_div_manual_mode,
drivers/gpu/drm/amd/display/dc/optc/dcn35/dcn35_optc.c +1 -0
@@ -614,6 +614,7 @@ static const struct timing_generator_funcs dcn35_tg_funcs = { .setup_manual_trigger = optc2_setup_manual_trigger, .get_hw_timing = optc1_get_hw_timing, .init_odm = optc3_init_odm, + .is_odm_enabled = optc3_is_odm_enabled, .set_long_vtotal = optc35_set_long_vtotal, .is_two_pixels_per_container = optc1_is_two_pixels_per_container, .read_otg_state = optc31_read_otg_state,
drivers/gpu/drm/amd/display/dc/optc/dcn42/dcn42_optc.c +1 -0
@@ -261,6 +261,7 @@ static struct timing_generator_funcs dcn42_tg_funcs = { .setup_manual_trigger = optc2_setup_manual_trigger, .get_hw_timing = optc1_get_hw_timing, .init_odm = optc3_init_odm, + .is_odm_enabled = optc3_is_odm_enabled, .set_long_vtotal = optc35_set_long_vtotal, .is_two_pixels_per_container = optc1_is_two_pixels_per_container, .get_optc_double_buffer_pending = optc3_get_optc_double_buffer_pending,
Signature · 1 line
2.43.0
PATCH 53/66 drm/amd/display: Program DCC as part of address update
In reply to Chenyu ChenFrom: Alvin Lee <[email protected]>
[Description]
- DCC register is latched on the surface address register being updated
- In this case couple the DCC programming and the address update together to ensure the DCC programming is always taken as expected
- Update address programming function to take in DCC bool, use for DCN6+ and leave older DCN unchanged.
--- .../drm/amd/display/dc/core/dc_hw_sequencer.c | 4 ++- .../amd/display/dc/hubp/dcn10/dcn10_hubp.c | 4 ++- .../amd/display/dc/hubp/dcn10/dcn10_hubp.h | 3 +- .../amd/display/dc/hubp/dcn20/dcn20_hubp.c | 5 +++- .../amd/display/dc/hubp/dcn20/dcn20_hubp.h | 3 +- .../amd/display/dc/hubp/dcn21/dcn21_hubp.c | 5 +++- .../amd/display/dc/hubp/dcn30/dcn30_hubp.c | 5 +++- .../amd/display/dc/hubp/dcn30/dcn30_hubp.h | 3 +- .../amd/display/dc/hubp/dcn401/dcn401_hubp.c | 5 +++- .../amd/display/dc/hubp/dcn401/dcn401_hubp.h | 3 +- .../amd/display/dc/hubp/dcn42/dcn42_hubp.c | 5 +++- .../amd/display/dc/hubp/dcn50/dcn50_hubp.c | 28 ++++++++++++------- .../amd/display/dc/hubp/dcn50/dcn50_hubp.h | 3 +- .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 6 ++-- .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 3 +- .../amd/display/dc/hwss/dcn201/dcn201_hwseq.c | 3 +- .../drm/amd/display/dc/hwss/hw_sequencer.h | 1 + drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h | 3 +- 18 files changed, 65 insertions(+), 27 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +3 -1
@@ -1713,7 +1713,8 @@ void hwss_execute_sequence(struct dc *dc, params->update_plane_addr_params.hubp->funcs->hubp_program_surface_flip_and_addr ( params->update_plane_addr_params.hubp, ¶ms->update_plane_addr_params.address, - params->update_plane_addr_params.flip_immediate); + params->update_plane_addr_params.flip_immediate, + params->update_plane_addr_params.dcc);break ;case DPP_SET_INPUT_TRANSFER_FUNC : hws->funcs.set_input_transfer_func (¶ms->set_input_transfer_func_params);
@@ -2356,6 +2357,7 @@ void hwss_add_hubp_update_plane_addr(struct block_sequence_state *seq_state, dc->hwss.prepare_plane_addr_update (dc, pipe_ctx, ¶ms->address, ¶ms->flip_immediate); params->hubp = hubp; + params->dcc = pipe_ctx->plane_state ? pipe_ctx->plane_state->dcc.enable : false; seq_state->steps[*seq_state->num_steps].func =HUBP_UPDATE_PLANE_ADDR ; (*seq_state->num_steps)++; }
drivers/gpu/drm/amd/display/dc/hubp/dcn10/dcn10_hubp.c +3 -1
@@ -350,10 +350,12 @@ void hubp1_program_pixel_format(bool hubp1_program_surface_flip_and_addr (struct hubp *hubp,const struct dc_plane_address *address, -bool flip_immediate) +bool flip_immediate, +bool dcc) {struct dcn10_hubp *hubp1 =TO_DCN10_HUBP (hubp); + (void )dcc;//program flip type REG_UPDATE(DCSURF_FLIP_CONTROL,
drivers/gpu/drm/amd/display/dc/hubp/dcn10/dcn10_hubp.h +2 -1
@@ -905,7 +905,8 @@ void hubp_reset(struct hubp *hubp);bool hubp1_program_surface_flip_and_addr (struct hubp *hubp,const struct dc_plane_address *address, -bool flip_immediate); +bool flip_immediate, +bool dcc);bool hubp1_is_flip_pending (struct hubp *hubp);
drivers/gpu/drm/amd/display/dc/hubp/dcn20/dcn20_hubp.c +4 -1
@@ -730,10 +730,13 @@ bool hubp2_dmdata_status_done(struct hubp *hubp)bool hubp2_program_surface_flip_and_addr (struct hubp *hubp,const struct dc_plane_address *address, -bool flip_immediate) +bool flip_immediate, +bool dcc) {struct dcn20_hubp *hubp2 =TO_DCN20_HUBP (hubp); + (void )dcc; +//program flip type REG_UPDATE (DCSURF_FLIP_CONTROL ,SURFACE_FLIP_TYPE , flip_immediate);
drivers/gpu/drm/amd/display/dc/hubp/dcn20/dcn20_hubp.h +2 -1
@@ -399,7 +399,8 @@ void hubp2_program_deadline(bool hubp2_program_surface_flip_and_addr (struct hubp *hubp,const struct dc_plane_address *address, -bool flip_immediate); +bool flip_immediate, +bool dcc);void hubp2_dcc_control (struct hubp *hubp,bool enable,enum hubp_ind_block_size independent_64b_blks);
drivers/gpu/drm/amd/display/dc/hubp/dcn21/dcn21_hubp.c +4 -1
@@ -696,10 +696,13 @@ static void dmcub_PLAT_54186_wa(struct hubp *hubp,static bool hubp21_program_surface_flip_and_addr (struct hubp *hubp,const struct dc_plane_address *address, -bool flip_immediate) +bool flip_immediate, +bool dcc) {struct surface_flip_registers flip_regs = {0 }; + (void )dcc; + flip_regs.vmid = address->vmid;switch (address->type) {
drivers/gpu/drm/amd/display/dc/hubp/dcn30/dcn30_hubp.c +4 -1
@@ -68,10 +68,13 @@ void hubp3_set_vm_system_aperture_settings(struct hubp *hubp,bool hubp3_program_surface_flip_and_addr (struct hubp *hubp,const struct dc_plane_address *address, -bool flip_immediate) +bool flip_immediate, +bool dcc) {struct dcn20_hubp *hubp2 =TO_DCN20_HUBP (hubp); + (void )dcc; +//program flip type REG_UPDATE (DCSURF_FLIP_CONTROL ,SURFACE_FLIP_TYPE , flip_immediate);
drivers/gpu/drm/amd/display/dc/hubp/dcn30/dcn30_hubp.h +2 -1
@@ -260,7 +260,8 @@ void hubp3_set_vm_system_aperture_settings(struct hubp *hubp,bool hubp3_program_surface_flip_and_addr (struct hubp *hubp,const struct dc_plane_address *address, -bool flip_immediate); +bool flip_immediate, +bool dcc); void hubp3_program_surface_config( struct hubp *hubp,
drivers/gpu/drm/amd/display/dc/hubp/dcn401/dcn401_hubp.c +4 -1
@@ -486,10 +486,13 @@ void hubp401_setup_interdependent(bool hubp401_program_surface_flip_and_addr (struct hubp *hubp,const struct dc_plane_address *address, -bool flip_immediate) +bool flip_immediate, +bool dcc) {struct dcn20_hubp *hubp2 =TO_DCN20_HUBP (hubp); + (void )dcc; +//program flip type REG_UPDATE (DCSURF_FLIP_CONTROL ,SURFACE_FLIP_TYPE , flip_immediate);
drivers/gpu/drm/amd/display/dc/hubp/dcn401/dcn401_hubp.h +2 -1
@@ -271,7 +271,8 @@ void hubp401_setup_interdependent(bool hubp401_program_surface_flip_and_addr (struct hubp *hubp,const struct dc_plane_address *address, -bool flip_immediate); +bool flip_immediate, +bool dcc);void hubp401_dcc_control (struct hubp *hubp,struct dc_plane_dcc_param *dcc);
drivers/gpu/drm/amd/display/dc/hubp/dcn42/dcn42_hubp.c +4 -1
@@ -398,10 +398,13 @@ void hubp42_program_3dlut_fl_config(struct hubp *hubp,static bool hubp42_program_surface_flip_and_addr (struct hubp *hubp,const struct dc_plane_address *address, -bool flip_immediate) +bool flip_immediate, +bool dcc) {struct dcn20_hubp *hubp2 =TO_DCN20_HUBP (hubp); + (void )dcc; +//program flip type REG_UPDATE (DCSURF_FLIP_CONTROL ,SURFACE_FLIP_TYPE , flip_immediate);
drivers/gpu/drm/amd/display/dc/hubp/dcn50/dcn50_hubp.c +18 -10
@@ -22,7 +22,8 @@bool hubp50_program_surface_flip_and_addr (struct hubp *hubp,const struct dc_plane_address *address, -bool flip_immediate) +bool flip_immediate, +bool dcc) {struct dcn20_hubp *hubp2 =TO_DCN20_HUBP (hubp);
@@ -55,8 +56,10 @@ bool hubp50_program_surface_flip_and_addr(if (address->grph.addr.quad_part ==0 )break ; -REG_UPDATE (DCSURF_SURFACE_CONTROL , -PRIMARY_SURFACE_TMZ , address->tmz_surface); +REG_UPDATE_3 (DCSURF_SURFACE_CONTROL , +PRIMARY_SURFACE_TMZ , address->tmz_surface, +PRIMARY_SURFACE_DCC_EN , dcc, +SECONDARY_SURFACE_DCC_EN , dcc); REG_SET(DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH, 0, PRIMARY_SURFACE_ADDRESS_HIGH,
@@ -71,9 +74,11 @@ bool hubp50_program_surface_flip_and_addr( || address->video_progressive.chroma_addr.quad_part == 0)break ; -REG_UPDATE_2 (DCSURF_SURFACE_CONTROL , +REG_UPDATE_4 (DCSURF_SURFACE_CONTROL ,PRIMARY_SURFACE_TMZ , address->tmz_surface, -PRIMARY_SURFACE_TMZ_C , address->tmz_surface); +PRIMARY_SURFACE_TMZ_C , address->tmz_surface, +PRIMARY_SURFACE_DCC_EN , dcc, +SECONDARY_SURFACE_DCC_EN , dcc); REG_SET(DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH_C, 0, PRIMARY_SURFACE_ADDRESS_HIGH_C,
@@ -96,11 +101,13 @@ bool hubp50_program_surface_flip_and_addr( || address->grph_stereo.right_addr.quad_part == 0)break ; -REG_UPDATE_4 (DCSURF_SURFACE_CONTROL , +REG_UPDATE_6 (DCSURF_SURFACE_CONTROL ,PRIMARY_SURFACE_TMZ , address->tmz_surface,PRIMARY_SURFACE_TMZ_C , address->tmz_surface,SECONDARY_SURFACE_TMZ , address->tmz_surface, -SECONDARY_SURFACE_TMZ_C , address->tmz_surface); +SECONDARY_SURFACE_TMZ_C , address->tmz_surface, +PRIMARY_SURFACE_DCC_EN , dcc, +SECONDARY_SURFACE_DCC_EN , dcc); REG_SET(DCSURF_SECONDARY_SURFACE_ADDRESS_HIGH_C, 0, SECONDARY_SURFACE_ADDRESS_HIGH_C,
@@ -139,9 +146,11 @@ bool hubp50_program_surface_flip_and_addr( || address->rgbea.alpha_addr.quad_part == 0)break ; -REG_UPDATE_2 (DCSURF_SURFACE_CONTROL , +REG_UPDATE_4 (DCSURF_SURFACE_CONTROL ,PRIMARY_SURFACE_TMZ , address->tmz_surface, -PRIMARY_SURFACE_TMZ_C , address->tmz_surface); +PRIMARY_SURFACE_TMZ_C , address->tmz_surface, +PRIMARY_SURFACE_DCC_EN , dcc, +SECONDARY_SURFACE_DCC_EN , dcc); REG_SET(DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH_C, 0, PRIMARY_SURFACE_ADDRESS_HIGH_C,
@@ -457,7 +466,6 @@ void hubp50_program_surface_config( (void )compat_level;struct dcn20_hubp *hubp2 =TO_DCN20_HUBP (hubp); -hubp401_dcc_control (hubp, dcc);hubp50_program_tiling (hubp2, tiling_info, format);hubp401_program_size (hubp, format, plane_size, dcc);hubp2_program_rotation (hubp, rotation, horizontal_mirror);
drivers/gpu/drm/amd/display/dc/hubp/dcn50/dcn50_hubp.h +2 -1
@@ -21,7 +21,8 @@bool hubp50_program_surface_flip_and_addr (struct hubp *hubp,const struct dc_plane_address *address, -bool flip_immediate); +bool flip_immediate, +bool dcc); void hubp50_program_surface_config( struct hubp *hubp,
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +4 -2
@@ -2100,7 +2100,8 @@ void dcn10_update_plane_addr(const struct dc *dc, struct pipe_ctx *pipe_ctx) pipe_ctx->plane_res.hubp->funcs->hubp_program_surface_flip_and_addr ( pipe_ctx->plane_res.hubp, &address, - flip_immediate); + flip_immediate, + pipe_ctx->plane_state->dcc.enable); }bool dcn10_set_input_transfer_func (struct set_input_transfer_func_params *params)
@@ -4184,5 +4185,6 @@ void dcn10_reset_surface_dcc_and_tiling(struct pipe_ctx *pipe_ctx,/* force page flip to see the new content of the framebuffer */ hubp->funcs->hubp_program_surface_flip_and_addr (hubp, &plane_state->address, - true); + true, + plane_state->dcc.enable); }
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +2 -1
@@ -2818,7 +2818,8 @@ void dcn20_update_plane_addr(const struct dc *dc, struct pipe_ctx *pipe_ctx) pipe_ctx->plane_res.hubp->funcs->hubp_program_surface_flip_and_addr ( pipe_ctx->plane_res.hubp, &address, - flip_immediate); + flip_immediate, + pipe_ctx->plane_state->dcc.enable); } void dcn20_unblank_stream(struct pipe_ctx *pipe_ctx,
drivers/gpu/drm/amd/display/dc/hwss/dcn201/dcn201_hwseq.c +2 -1
@@ -176,7 +176,8 @@ void dcn201_update_plane_addr(const struct dc *dc, struct pipe_ctx *pipe_ctx) pipe_ctx->plane_res.hubp->funcs->hubp_program_surface_flip_and_addr ( pipe_ctx->plane_res.hubp, &address, - flip_immediate); + flip_immediate, + pipe_ctx->plane_state->dcc.enable); }/* Blank pixel data during initialization */
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +1 -0
@@ -95,6 +95,7 @@ struct update_plane_addr_params {struct hubp *hubp;struct dc_plane_address address;bool flip_immediate; +bool dcc; };struct set_input_transfer_func_params {
drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h +2 -1
@@ -176,7 +176,8 @@ struct hubp_funcs {bool (*hubp_program_surface_flip_and_addr)(struct hubp *hubp,const struct dc_plane_address *address, -bool flip_immediate); +bool flip_immediate, +bool dcc); void (*hubp_program_pte_vm)( struct hubp *hubp,
Signature · 1 line
2.43.0
PATCH 54/66 drm/amd/display: Add instance field to struct dccg
In reply to Chenyu ChenFrom: Tony Cheng <[email protected]>
[Why]
struct dccg has no instance identifier, unlike other DC hardware blocks. Debug and tracing helpers need one to identify the block.
[How]
Add an inst member to struct dccg and initialize it to 0 in every dccgX_create(), since there is one DCCG instance per ASIC.
--- drivers/gpu/drm/amd/display/dc/dccg/dcn20/dcn20_dccg.c | 1 + drivers/gpu/drm/amd/display/dc/dccg/dcn201/dcn201_dccg.c | 1 + drivers/gpu/drm/amd/display/dc/dccg/dcn21/dcn21_dccg.c | 1 + drivers/gpu/drm/amd/display/dc/dccg/dcn30/dcn30_dccg.c | 2 ++ drivers/gpu/drm/amd/display/dc/dccg/dcn301/dcn301_dccg.c | 1 + drivers/gpu/drm/amd/display/dc/dccg/dcn31/dcn31_dccg.c | 1 + drivers/gpu/drm/amd/display/dc/dccg/dcn314/dcn314_dccg.c | 1 + drivers/gpu/drm/amd/display/dc/dccg/dcn32/dcn32_dccg.c | 1 + drivers/gpu/drm/amd/display/dc/dccg/dcn35/dcn35_dccg.c | 1 + drivers/gpu/drm/amd/display/dc/dccg/dcn401/dcn401_dccg.c | 1 + drivers/gpu/drm/amd/display/dc/dccg/dcn42/dcn42_dccg.c | 1 + drivers/gpu/drm/amd/display/dc/dccg/dcn60/dcn60_dccg.c | 1 + drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h | 1 + 13 files changed, 14 insertions(+)
drivers/gpu/drm/amd/display/dc/dccg/dcn20/dcn20_dccg.c +1 -0
@@ -212,6 +212,7 @@ struct dccg *dccg2_create( base->ctx = ctx; base->funcs = &dccg2_funcs; + base->inst =0 ; dccg_dcn->regs = regs; dccg_dcn->dccg_shift = dccg_shift; dccg_dcn->dccg_mask = dccg_mask;
drivers/gpu/drm/amd/display/dc/dccg/dcn201/dcn201_dccg.c +1 -0
@@ -82,6 +82,7 @@ struct dccg *dccg201_create( base->ctx = ctx; base->funcs = &dccg201_funcs; + base->inst =0 ; dccg_dcn->regs = regs; dccg_dcn->dccg_shift = dccg_shift; dccg_dcn->dccg_mask = dccg_mask;
drivers/gpu/drm/amd/display/dc/dccg/dcn21/dcn21_dccg.c +1 -0
@@ -158,6 +158,7 @@ struct dccg *dccg21_create( base->ctx = ctx; base->funcs = &dccg21_funcs; + base->inst =0 ; dccg_dcn->regs = regs; dccg_dcn->dccg_shift = dccg_shift; dccg_dcn->dccg_mask = dccg_mask;
drivers/gpu/drm/amd/display/dc/dccg/dcn30/dcn30_dccg.c +2 -0
@@ -114,6 +114,7 @@ struct dccg *dccg3_create( base->ctx = ctx; base->funcs = &dccg3_funcs; + base->inst =0 ; dccg_dcn->regs = regs; dccg_dcn->dccg_shift = dccg_shift; dccg_dcn->dccg_mask = dccg_mask;
@@ -139,6 +140,7 @@ struct dccg *dccg30_create( base->ctx = ctx; base->funcs = &dccg3_funcs; + base->inst =0 ; dccg_dcn->regs = regs; dccg_dcn->dccg_shift = dccg_shift; dccg_dcn->dccg_mask = dccg_mask;
drivers/gpu/drm/amd/display/dc/dccg/dcn301/dcn301_dccg.c +1 -0
@@ -73,6 +73,7 @@ struct dccg *dccg301_create( base->ctx = ctx; base->funcs = &dccg301_funcs; + base->inst =0 ; dccg_dcn->regs = regs; dccg_dcn->dccg_shift = dccg_shift; dccg_dcn->dccg_mask = dccg_mask;
drivers/gpu/drm/amd/display/dc/dccg/dcn31/dcn31_dccg.c +1 -0
@@ -965,6 +965,7 @@ struct dccg *dccg31_create( base->ctx = ctx; base->funcs = &dccg31_funcs; + base->inst =0 ; dccg_dcn->regs = regs; dccg_dcn->dccg_shift = dccg_shift; dccg_dcn->dccg_mask = dccg_mask;
drivers/gpu/drm/amd/display/dc/dccg/dcn314/dcn314_dccg.c +1 -0
@@ -429,6 +429,7 @@ struct dccg *dccg314_create( base->ctx = ctx; base->funcs = &dccg314_funcs; + base->inst =0 ; dccg_dcn->regs = regs; dccg_dcn->dccg_shift = dccg_shift; dccg_dcn->dccg_mask = dccg_mask;
drivers/gpu/drm/amd/display/dc/dccg/dcn32/dcn32_dccg.c +1 -0
@@ -441,6 +441,7 @@ struct dccg *dccg32_create( base->ctx = ctx; base->funcs = &dccg32_funcs; + base->inst =0 ; dccg_dcn->regs = regs; dccg_dcn->dccg_shift = dccg_shift; dccg_dcn->dccg_mask = dccg_mask;
drivers/gpu/drm/amd/display/dc/dccg/dcn35/dcn35_dccg.c +1 -0
@@ -2804,6 +2804,7 @@ struct dccg *dccg35_create( base->ctx = ctx; base->funcs = &dccg35_funcs; + base->inst =0 ; dccg_dcn->regs = regs; dccg_dcn->dccg_shift = dccg_shift; dccg_dcn->dccg_mask = dccg_mask;
drivers/gpu/drm/amd/display/dc/dccg/dcn401/dcn401_dccg.c +1 -0
@@ -999,6 +999,7 @@ struct dccg *dccg401_create( base->ctx = ctx; base->funcs = &dccg401_funcs; + base->inst =0 ; dccg_dcn->regs = regs; dccg_dcn->dccg_shift = dccg_shift; dccg_dcn->dccg_mask = dccg_mask;
drivers/gpu/drm/amd/display/dc/dccg/dcn42/dcn42_dccg.c +1 -0
@@ -382,6 +382,7 @@ struct dccg *dccg42_create( base->ctx = ctx; base->funcs = &dccg42_funcs; + base->inst =0 ; dccg_dcn->regs = regs; dccg_dcn->dccg_shift = dccg_shift; dccg_dcn->dccg_mask = dccg_mask;
drivers/gpu/drm/amd/display/dc/dccg/dcn60/dcn60_dccg.c +1 -0
@@ -179,6 +179,7 @@ struct dccg *dccg60_create( base->ctx = ctx; base->funcs = &dccg60_funcs; + base->inst =0 ; dccg_dcn->regs = regs; dccg_dcn->dccg_shift = dccg_shift; dccg_dcn->dccg_mask = dccg_mask;
drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h +1 -0
@@ -193,6 +193,7 @@ struct dcn_dccg_reg_state {struct dccg {struct dc_context *ctx;const struct dccg_funcs *funcs; +int inst;int pipe_dppclk_khz[MAX_PIPES ];int ref_dppclk;bool dpp_clock_gated[MAX_PIPES ];
Signature · 1 line
2.43.0
PATCH 55/66 drm/amd/display: Add SPDX license identifier to dcn30_dpp_cm.c
In reply to Chenyu ChenFrom: Tony Cheng <[email protected]>
[Why&How]dcn30_dpp_cm.c carries the full MIT license text but no SPDX tag. Add the SPDX-License-Identifier line so the file matches the rest of the tree.
--- drivers/gpu/drm/amd/display/dc/dpp/dcn30/dcn30_dpp_cm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/dpp/dcn30/dcn30_dpp_cm.c +2 -0
@@ -1,6 +1,8 @@/* * Copyright 2020 Advanced Micro Devices, Inc. * +* SPDX-License-Identifier: MIT +* * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation
Signature · 1 line
2.43.0
PATCH 56/66 drm/amd/display: Remove MALL capabilities from DCN42B
In reply to Chenyu ChenFrom: Gabe Teeger <[email protected]>
[Why]
DCN42B has no MALL, but the resource file advertised MALL and CAB sizes. SubVP was also enabled even though its phantom surfaces are allocated in MALL.
[How]
Drop the MALL and SubVP caps, the dml2_options svp_pstate and mall_cfg setup, and the add_phantom_pipes and calculate_mall_ways_from_bytes callbacks. Disable SubVP.
--- .../dc/resource/dcn42b/dcn42b_resource.c | 45 +------------------ 1 file changed, 2 insertions(+), 43 deletions(-)
drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c +2 -43
@@ -851,7 +851,8 @@ static const struct dc_debug_options debug_defaults_drv = { .minimum_z8_residency_time = 1, /* Always allow when other conditions are met */ .support_eDP1_5 = true, .use_max_lb = true, - .force_disable_subvp = false, +/* SubVP phantom surfaces require MALL, which DCN42B does not have */ + .force_disable_subvp = true, .exit_idle_opt_for_cursor_updates = true, .using_dml2 = true, .using_dml21 = true,
@@ -1974,8 +1975,6 @@ static struct resource_funcs dcn42b_res_pool_funcs = { .get_panel_config_defaults = dcn42b_get_panel_config_defaults,//.get_preferred_eng_id_dpia = dcn42b_get_preferred_eng_id_dpia, .update_soc_for_wm_a = dcn30_update_soc_for_wm_a, - .add_phantom_pipes = dcn32_add_phantom_pipes, - .calculate_mall_ways_from_bytes = dcn32_calculate_mall_ways_from_bytes, .prepare_mcache_programming = dcn42b_prepare_mcache_programming, .build_pipe_pix_clk_params = dcn42b_build_pipe_pix_clk_params, .get_power_profile = dcn401_get_power_profile,
@@ -2041,27 +2040,7 @@ static bool dcn42b_resource_construct( dc->caps.cursor_not_scaled = true; dc->caps.min_horizontal_blanking_period =80 ; dc->caps.dmdata_alloc_size =2048 ; - dc->caps.mall_size_per_mem_channel =4 ; -/* total size = mall per channel * num channels * 1024 * 1024 */ - dc->caps.mall_size_total = dc->caps.mall_size_per_mem_channel * - dc->ctx->dc_bios->vram_info.num_chans *1048576 ; dc->caps.cursor_cache_size = dc->caps.max_cursor_size * dc->caps.max_cursor_size *8 ; - dc->caps.cache_line_size =64 ; - dc->caps.cache_num_ways =16 ; - -/* Calculate the available MALL space */ - dc->caps.max_cab_allocation_bytes = -dcn32_calc_num_avail_chans_for_mall (dc, dc->ctx->dc_bios->vram_info.num_chans) * - dc->caps.mall_size_per_mem_channel *1024 *1024 ; - dc->caps.mall_size_total = dc->caps.max_cab_allocation_bytes; - - dc->caps.subvp_fw_processing_delay_us =15 ; - dc->caps.subvp_drr_max_vblank_margin_us =40 ; - dc->caps.subvp_prefetch_end_to_mall_start_us =15 ; - dc->caps.subvp_swath_height_margin_lines =16 ; - dc->caps.subvp_pstate_allow_width_us =20 ; - dc->caps.subvp_vertical_int_margin_us =30 ; - dc->caps.subvp_drr_vblank_start_margin_us =100 ;// 100us margin dc->caps.max_slave_planes =2 ; dc->caps.max_slave_yuv_planes =2 ;
@@ -2449,26 +2428,6 @@ static bool dcn42b_resource_construct(resource_init_common_dml2_callbacks (dc, &dc->dml2_options); dc->dml2_options.callbacks.can_support_mclk_switch_using_fw_based_vblank_stretch = &dcn30_can_support_mclk_switch_using_fw_based_vblank_stretch; - dc->dml2_options.svp_pstate.callbacks.release_dsc = &dcn20_release_dsc; - dc->dml2_options.svp_pstate.callbacks.calculate_mall_ways_from_bytes = - pool->base.funcs->calculate_mall_ways_from_bytes; - - dc->dml2_options.svp_pstate.subvp_fw_processing_delay_us = dc->caps.subvp_fw_processing_delay_us; - dc->dml2_options.svp_pstate.subvp_prefetch_end_to_mall_start_us = dc->caps.subvp_prefetch_end_to_mall_start_us; - dc->dml2_options.svp_pstate.subvp_pstate_allow_width_us = dc->caps.subvp_pstate_allow_width_us; - dc->dml2_options.svp_pstate.subvp_swath_height_margin_lines = dc->caps.subvp_swath_height_margin_lines; - - dc->dml2_options.svp_pstate.force_disable_subvp = dc->debug.force_disable_subvp; - dc->dml2_options.svp_pstate.force_enable_subvp = dc->debug.force_subvp_mclk_switch; - - dc->dml2_options.mall_cfg.cache_line_size_bytes = dc->caps.cache_line_size; - dc->dml2_options.mall_cfg.cache_num_ways = dc->caps.cache_num_ways; - dc->dml2_options.mall_cfg.max_cab_allocation_bytes = - dc->caps.max_cab_allocation_bytes; - dc->dml2_options.mall_cfg.mblk_height_4bpe_pixels =DCN3_2_MBLK_HEIGHT_4BPE ; - dc->dml2_options.mall_cfg.mblk_height_8bpe_pixels =DCN3_2_MBLK_HEIGHT_8BPE ; - dc->dml2_options.mall_cfg.mblk_size_bytes =DCN3_2_MALL_MBLK_SIZE_BYTES ; - dc->dml2_options.mall_cfg.mblk_width_pixels =DCN3_2_MBLK_WIDTH ; dc->dml2_options.max_segments_per_hubp =24 ; dc->dml2_options.det_segment_size =DCN42_CRB_SEGMENT_SIZE_KB ;
Signature · 1 line
2.43.0
PATCH 57/66 drm/amd/display: Remove MALL capabilities from DCN42B bounding box
In reply to Chenyu ChenFrom: Gabe Teeger <[email protected]>
[Why]
DCN42B has no MALL, but MALL capabilities are non-zero.
[How]
Zero out MALL capabilities in the dcn42b bounding box.
--- .../display/dc/dml2_0/dml21/inc/bounding_boxes/dcn42b_soc_bb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/inc/bounding_boxes/dcn42b_soc_bb.h +1 -1
@@ -202,7 +202,7 @@ static const struct dml2_soc_bb dml2_socbb_dcn42b = { .xtalclk_mhz = 24, .pcie_refclk_mhz = 100, .dchub_refclk_mhz = 50, - .mall_allocated_for_dcn_mbytes = 64, + .mall_allocated_for_dcn_mbytes = 0, .max_outstanding_reqs = 256, .fabric_datapath_to_dcn_data_return_bytes = 32, .return_bus_width_bytes = 64,
Signature · 1 line
2.43.0
PATCH 58/66 drm/amd/display: Atomize IRQ register read/modify/write ops
In reply to Chenyu ChenFrom: Leo Li <[email protected]>
[Why]
The OTG_GLOBAL_SYNC_STATUS register controls various HW IRQ sources for the output timing generator (OTG). VUPDATE_NO_LOCK is one of them.
To enable the IRQ, driver sets the VUPDATE_NO_LOCK_EN bit in the GLOBAL_SYNC_STATUS register.
To ack the IRQ after it fires, the driver sets the VUPDATE_NO_LOCK_CLEAR bit in the same GLOBAL_SYNC_STATUS register.
The bit sets are done through read/modify/write operations, which are not atomic. Thus, the following race is possible:
Thread A: IRQ handler:
*HW IRQ fires*
# IRQ disable
val = read(GLOBAL_SYNC_STATUS)
unset(val, VUPDATE_NO_LOCK_EN)
write(val, GLOBAL_SYNC_STATUS)
# ACK reads VUPDATE_NO_LOCK_EN unset val1 = read(GLOBAL_SYNC_STATUS) set(val1, VUPDATE_NO_LOCK_CLEAR)
# IRQ enable
val = read(GLOBAL_SYNC_STATUS)
set(val, VUPDATE_NO_LOCK_EN)
write(val, GLOBAL_SYNC_STATUS)
# BAD! clears VUPDATE_NO_LOCK_EN write(val1, GLOBAL_SYNC_STATUS)
Regarding the tagged Fixes: change, it appears the change made this race more likely to occur. Since VUPDATE_NO_LOCK is now the sole IRQ source for vblank handling, a single race on high refresh panels can lead to a time out.
[How]
The GLOBAL_SYNC_STATUS register is only one example, other IRQ control registers also share the same scheme. On top of GLOBAL_SYNC_STATUS, let's clean up those as well.
To keep things simple, Let's atomize the IRQ rmw ops via a single driver-wide spinlock. Due to the small scope of this lock, it is unlikely to cause noticeable overhead on top of all the existing locking within the IRQ set/handle paths.
Since DM is responsible for locking, wrap dc_interrupt_set/ack with the spinlock in the new amdgpu_dm_irq_set/ack functions. Migrate/drop all references in DM to dc_interrupt_set/ack to use amdgpu_dm_irq_set/ack instead.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 12 ++++ .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 3 +- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 3 +- .../drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c | 64 +++++++++++-------- .../drm/amd/display/amdgpu_dm/amdgpu_dm_irq.h | 28 ++++++++ .../amdgpu_dm/tests/amdgpu_dm_crtc_test.c | 16 +++-- .../amdgpu_dm/tests/amdgpu_dm_helpers_test.c | 8 ++- .../amdgpu_dm/tests/amdgpu_dm_irq_test.c | 34 +++++----- 9 files changed, 117 insertions(+), 55 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -2
@@ -1472,7 +1472,7 @@ STATIC_IFN_KUNIT void dm_gpureset_toggle_interrupts(struct amdgpu_device *adev,if (acrtc && state->stream_status[i].plane_count !=0 &&amdgpu_ip_version (adev,DCE_HWIP ,0 ) ==0 ) { irq_source =IRQ_TYPE_PFLIP + acrtc->otg_inst; - rc =dc_interrupt_set (adev->dm.dc, irq_source, enable) ?0 : -EBUSY ; + rc =amdgpu_dm_irq_set (adev, irq_source, enable) ?0 : -EBUSY ;if (rc)drm_warn (adev_to_drm (adev),"Failed to %s pflip interrupts\n" , enable ?"enable" :"disable" );
@@ -1496,7 +1496,7 @@ STATIC_IFN_KUNIT void dm_gpureset_toggle_interrupts(struct amdgpu_device *adev,/* During gpu-reset we disable and then enable vblank irq, so * don't use amdgpu_irq_get/put() to avoid refcount change. */ -if (!dc_interrupt_set (adev->dm.dc, irq_source, enable)) +if (!amdgpu_dm_irq_set (adev, irq_source, enable))drm_warn (adev_to_drm (adev),"Failed to %sable vblank interrupt\n" , enable ?"en" :"dis" ); }else if (acrtc && state->stream_status[i].plane_count !=0 ) {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +12 -0
@@ -555,6 +555,18 @@ struct amdgpu_display_manager {struct common_irq_params vupdate_params[DC_IRQ_SOURCE_VUPDATE6 -DC_IRQ_SOURCE_VUPDATE1 +1 ]; +/** +* @irq_reg_lock: +* +* Serializes the read-modify-writes of the HW interrupt control +* registers. Several interrupt sources share one register - e.g. the +* enable and clear bits of both VSTARTUP (vblank) and VUPDATE_NO_LOCK +* live in OTG_GLOBAL_SYNC_STATUS. Therefore, enabling one source must +* not race with acking another. Held only across amdgpu_dm_irq_set() +* and amdgpu_dm_irq_ack(). +*/ +spinlock_t irq_reg_lock; +/** * @dmub_trace_params: *
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +2 -1
@@ -31,6 +31,7 @@#include "amdgpu_dm_psr.h" #include "amdgpu_dm_replay.h" #include "amdgpu_dm_crtc.h" +#include "amdgpu_dm_irq.h" #include "amdgpu_dm_plane.h" #include "amdgpu_dm_trace.h" #include "amdgpu_dm_debugfs.h"
@@ -91,7 +92,7 @@ int amdgpu_dm_crtc_set_vupdate_irq(struct drm_crtc *crtc, bool enable) irq_source =IRQ_TYPE_VUPDATE + acrtc->otg_inst; - rc =dc_interrupt_set (adev->dm.dc, irq_source, enable) ?0 : -EBUSY ; + rc =amdgpu_dm_irq_set (adev, irq_source, enable) ?0 : -EBUSY ;DRM_DEBUG_VBL ("crtc %d - vupdate irq %sabling: r=%d\n" , acrtc->crtc_id, enable ?"en" :"dis" , rc);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +2 -1
@@ -1469,12 +1469,13 @@ EXPORT_IF_KUNIT(dm_helpers_free_gpu_mem);bool dm_helpers_dmub_outbox_interrupt_control (struct dc_context *ctx,bool enable) { +struct amdgpu_device *adev = ctx->driver_context;enum dc_irq_source irq_source;bool ret; irq_source =DC_IRQ_SOURCE_DMCUB_OUTBOX ; - ret =dc_interrupt_set (ctx->dc, irq_source, enable); + ret =amdgpu_dm_irq_set (adev, irq_source, enable);DRM_DEBUG_DRIVER ("Dmub trace irq %sabling: r=%d\n" , enable ?"en" :"dis" , ret);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c +38 -26
168 lines not on this page · raw message
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.h +28 -0
@@ -89,6 +89,34 @@ void amdgpu_dm_irq_unregister_interrupt(struct amdgpu_device *adev,enum dc_irq_source irq_source, void *ih_index); +/** +* amdgpu_dm_irq_set - enable or disable a DC interrupt source. +* +* @adev: AMD DRM device +* @src: DC interrupt source to toggle +* @enable: true to enable the source, false to disable it +* +* DM-wide replacement for dc_interrupt_set(). As locking is DM's +* responsibility, this is a thin wrapper serializes the underlying +* read-modify-write against the other interrupt sources sharing HW control +* registers with @src, so DM must never call dc_interrupt_set() directly. +* +* Returns: true if the source was toggled. +*/ +bool amdgpu_dm_irq_set (struct amdgpu_device *adev,enum dc_irq_source src, +bool enable); + +/** +* amdgpu_dm_irq_ack - acknowledge a DC interrupt source. +* +* @adev: AMD DRM device +* @src: DC interrupt source to acknowledge +* +* DM-wide replacement for dc_interrupt_ack(), serialized the same way as +* amdgpu_dm_irq_set(). +*/ +void amdgpu_dm_irq_ack (struct amdgpu_device *adev,enum dc_irq_source src); +void amdgpu_dm_set_irq_funcs (struct amdgpu_device *adev);void amdgpu_dm_outbox_init (struct amdgpu_device *adev);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c +10 -6
@@ -439,7 +439,7 @@ static void dm_test_crtc_set_vupdate_irq_no_otg(struct kunit *test)* dm_test_crtc_set_vupdate_irq_dc_busy - Test vupdate irq when DC rejects request * @test: The KUnit test context * -* With an OTG instance assigned but no DC attached, dc_interrupt_set() returns +* With an OTG instance assigned but no DC attached, amdgpu_dm_irq_set() returns * false and the function must report the request as busy (-EBUSY). */ static void dm_test_crtc_set_vupdate_irq_dc_busy (struct kunit *test)
@@ -456,12 +456,12 @@ static void dm_test_crtc_set_vupdate_irq_dc_busy(struct kunit *test) acrtc->base.dev = &adev->ddev; acrtc->otg_inst =0 ; -/* adev->dm.dc is NULL, so dc_interrupt_set() returns false. */ +/* adev->dm.dc is NULL, so amdgpu_dm_irq_set() returns false. */ KUNIT_EXPECT_EQ (test,amdgpu_dm_crtc_set_vupdate_irq (&acrtc->base, true), -EBUSY ); } -/* Per-source funcs let dc_interrupt_set() succeed without register access. */ +/* Per-source funcs let amdgpu_dm_irq_set() succeed without register access. */ static bool dm_test_vupdate_irq_src_set (struct irq_service *irq_service,const struct irq_source_info *info,bool enable)
@@ -480,7 +480,7 @@ static struct irq_source_info_funcs dm_test_vupdate_irq_src_funcs = { .ack = dm_test_vupdate_irq_src_ack, }; -/* A .set that fails so dc_interrupt_set() reports the source as busy. */ +/* A .set that fails so amdgpu_dm_irq_set() reports the source as busy. */ static bool dm_test_vupdate_irq_src_set_busy (struct irq_service *irq_service,const struct irq_source_info *info,bool enable)
@@ -522,7 +522,9 @@ static void dm_test_crtc_set_vupdate_irq_enable(struct kunit *test) irqs =kunit_kzalloc (test,sizeof (*irqs),GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, irqs); -/* Populate the per-source info table so dc_interrupt_set() succeeds. */ +/* +* Populate the per-source info table so amdgpu_dm_irq_set() succeeds. +*/ info =kunit_kzalloc (test,sizeof (*info) *DAL_IRQ_SOURCES_NUMBER ,GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, info);
@@ -1021,7 +1023,9 @@ static void dm_test_crtc_enable_vblank_vupdate_busy(struct kunit *test) irqs =kunit_kzalloc (test,sizeof (*irqs),GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, irqs); -/* Per-source .set fails so dc_interrupt_set() reports the source busy. */ +/* +* Per-source .set fails so amdgpu_dm_irq_set() reports the source busy. +*/ info =kunit_kzalloc (test,sizeof (*info) *DAL_IRQ_SOURCES_NUMBER ,GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, info);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_helpers_test.c +6 -2
@@ -2592,17 +2592,21 @@ static void dm_test_is_dp_sink_present_null_priv(struct kunit *test)* dm_test_dmub_outbox_interrupt_control_null_dc - Test outbox irq control with NULL dc * @test: The KUnit test context * -* dc_interrupt_set() is NULL-safe and returns false when dc is NULL, so the +* amdgpu_dm_irq_set() is NULL-safe and returns false when dc is NULL, so the * helper returns false without touching real interrupt hardware. */ static void dm_test_dmub_outbox_interrupt_control_null_dc (struct kunit *test) { +struct amdgpu_device *adev;struct dc_context *ctx; + adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, adev); ctx =kunit_kzalloc (test,sizeof (*ctx),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, ctx); + ctx->driver_context = adev; -/* ctx->dc is NULL → dc_interrupt_set returns false */ +/* adev->dm.dc is NULL → amdgpu_dm_irq_set returns false */ KUNIT_EXPECT_FALSE (test,dm_helpers_dmub_outbox_interrupt_control (ctx, true));KUNIT_EXPECT_FALSE (test,dm_helpers_dmub_outbox_interrupt_control (ctx, false)); }
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c +17 -17
@@ -360,7 +360,7 @@ static bool dm_test_irq_src_ack(struct irq_service *irq_service,return true; } -/* Per-source funcs let dc_interrupt_set() succeed without register access. */ +/* Per-source funcs let amdgpu_dm_irq_set() succeed without register access. */ static struct irq_source_info_funcs dm_test_irq_src_funcs = { .set = dm_test_irq_src_set, .ack = dm_test_irq_src_ack,
@@ -382,7 +382,7 @@ static struct dc *dm_test_alloc_dc_with_irq_service(struct kunit *test,KUNIT_ASSERT_NOT_ERR_OR_NULL (test, irqs);/* -* Populate the per-source info table so dc_interrupt_set()/_ack() +* Populate the per-source info table so amdgpu_dm_irq_set()/_ack() * succeed without touching hardware registers. */ info = kunit_kzalloc(test, sizeof(*info) * DAL_IRQ_SOURCES_NUMBER,
@@ -1351,7 +1351,7 @@ static void dm_test_irq_suspend_empty(struct kunit *test)KUNIT_ASSERT_EQ (test,amdgpu_dm_irq_init (adev),0 );/* -* With no registered handlers the HW dc_interrupt_set() calls are +* With no registered handlers the amdgpu_dm_irq_set() calls are * skipped, so suspend must complete without touching the (absent) DC. */ amdgpu_dm_irq_suspend (adev);
@@ -1399,11 +1399,11 @@ static void dm_test_irq_resume_late_empty(struct kunit *test) }/** -* dm_test_irq_suspend_registered - Test suspend reaches the dc_interrupt_set path +* dm_test_irq_suspend_registered - Test suspend reaches the irq set path * @test: The KUnit test context * * Registers a low-context HPD handler so the handler list is non-empty, -* forcing amdgpu_dm_irq_suspend() to call dc_interrupt_set() (NULL-safe with +* forcing amdgpu_dm_irq_suspend() to call amdgpu_dm_irq_set() (NULL-safe with * no DC) and flush_work() on the registered handler. */ static void dm_test_irq_suspend_registered (struct kunit *test)
@@ -1454,11 +1454,11 @@ static void dm_test_irq_suspend_disables_polling(struct kunit *test) }/** -* dm_test_irq_resume_early_registered - Test early resume reaches dc_interrupt_set +* dm_test_irq_resume_early_registered - Test early resume reaches irq set * @test: The KUnit test context * * Registers a low-context HPD RX handler so early resume calls -* dc_interrupt_set() for the short-pulse interrupt source. +* amdgpu_dm_irq_set() for the short-pulse interrupt source. */ static void dm_test_irq_resume_early_registered (struct kunit *test) {
@@ -1482,10 +1482,10 @@ static void dm_test_irq_resume_early_registered(struct kunit *test) }/** -* dm_test_irq_resume_late_registered - Test late resume reaches dc_interrupt_set +* dm_test_irq_resume_late_registered - Test late resume reaches irq set * @test: The KUnit test context * -* Registers a low-context HPD handler so late resume calls dc_interrupt_set() +* Registers a low-context HPD handler so late resume calls amdgpu_dm_irq_set() * for the HPD interrupt source. */ static void dm_test_irq_resume_late_registered (struct kunit *test)
@@ -1716,7 +1716,7 @@ static void dm_test_set_crtc_irq_state_enable(struct kunit *test)/* * otg_inst >= 0 computes the irq source and reaches the NULL-safe -* dc_interrupt_set(); the ips_support branch is skipped (dc == NULL). +* amdgpu_dm_irq_set(); the ips_support branch is skipped (dc == NULL). */ acrtc->otg_inst =3 ; adev->mode_info.crtcs[0 ] = acrtc;
@@ -1795,8 +1795,8 @@ static void dm_test_set_vupdate_irq_state_enable(struct kunit *test)* * With a non-NULL DC that advertises IPS support and currently allows idle * optimizations, dm_irq_state() must call dc_allow_idle_optimizations() before -* dc_interrupt_set(). disable_idle_power_optimizations makes that call a safe -* early return, and per-source stub funcs let dc_interrupt_set() succeed. +* amdgpu_dm_irq_set(). disable_idle_power_optimizations makes that call a safe +* early return, and per-source stub funcs let amdgpu_dm_irq_set() succeed. */ static void dm_test_set_crtc_irq_state_allows_idle (struct kunit *test) {
@@ -2048,7 +2048,7 @@ static void dm_test_set_hpd_irq_state_null_dc(struct kunit *test) adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); -/* dc_interrupt_set() is a no-op when dc is NULL, so both states +/* amdgpu_dm_irq_set() is a no-op when dc is NULL, so both states * return 0 without dereferencing the (absent) DC. */ KUNIT_EXPECT_EQ(test, amdgpu_dm_set_hpd_irq_state(adev, NULL, AMDGPU_HPD_1,
@@ -2108,7 +2108,7 @@ static void dm_test_outbox_init_null_dc(struct kunit *test) adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); -/* Single dc_interrupt_set() call must be skipped when dc is NULL. */ +/* Single amdgpu_dm_irq_set() call must be skipped when dc is NULL. */ amdgpu_dm_outbox_init (adev); }
@@ -2126,7 +2126,7 @@ static void dm_test_hpd_init_empty_connectors(struct kunit *test)/* * With an empty connector list the per-connector loop is skipped and -* the initial clear loop relies on dc_interrupt_set() being a no-op +* the initial clear loop relies on amdgpu_dm_irq_set() being a no-op * for a NULL dc, so init must complete without touching the DC. */ amdgpu_dm_hpd_init (adev);
@@ -2161,7 +2161,7 @@ static void dm_test_hpd_init_fini_with_connectors(struct kunit *test)/* * num_hpd = 0 forces irq_type >= num_hpd so the loop takes the HW -* fallback (dc_interrupt_set()) instead of amdgpu_irq_get(); with a +* fallback (amdgpu_dm_irq_set()) instead of amdgpu_irq_get(); with a * NULL dc that fallback is a safe no-op. */ adev->mode_info.num_hpd =0 ;
@@ -2247,7 +2247,7 @@ static void dm_test_hpd_init_fini_irq_ref(struct kunit *test)/* * num_hpd >= 1 makes irq_type (0) < num_hpd, so the loop takes the * amdgpu_irq_get()/amdgpu_irq_put() branch instead of the -* dc_interrupt_set() fallback. The mock device has irq.installed == +* amdgpu_dm_irq_set() fallback. The mock device has irq.installed == * false, so both calls fail early with -ENOENT (logging an error) * without touching the base-driver irq state. */
Signature · 1 line
2.43.0
PATCH 59/66 drm/amd/display: Return success status from check_mode_supported
In reply to Chenyu ChenFrom: Alvin Lee <[email protected]>
[Description]dml21_top_utm_check_mode_supported must return the success status from the mode support result otherwise the caller will believe that mode support always returns true. This can cause issues where mode support returns true, where mode programming returns false.
--- .../drm/amd/display/dc/dml2_0/dml21/src/dml2_top/dml2_top_utm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_top/dml2_top_utm.c +1 -1
@@ -290,7 +290,7 @@ static bool dml2_top_utm_check_mode_supported(struct dml2_check_mode_supported_iDML_LOG_INFO ("%s exit with %s\n" , __func__,dml2_status_str (status));DML_LOG_TOP_IF_EXIT (); -return true; +return status ==DML2_STATUS_OK ; }static bool dml2_top_utm_build_mode_programming (struct dml2_build_mode_programming_in_out *in_out)
Signature · 1 line
2.43.0
PATCH 60/66 drm/amd/display: Add condition to skip MALL calculations if there is no MALL
In reply to Chenyu ChenFrom: Ovidiu Bunea <[email protected]>
[Why & How]
DCN42 has 0 bytes allocated for MALL, but this results in a 0 <= 0 comparison in CalculateMALLUseForStaticScreen(), which blindly returns true.
This causes DML to calculate with is_using_mall_for_ss[n] = true. Example:
0 + 0 <= 0 -> true
|
v
is_using_mall_for_ss[1] = true
|
v
use_one_row_for_frame[1] = true
PTE_BUFFER_MODE[1] = true
|
v
dpte_row_height : 128 -> 808
dpte_row_width_ub : 196,608 -> 1,204,224
|
+--> DST_Y_PER_PTE_ROW_NOM_L = 808
|
+--> N_groups = ceil(1,204,224 / 65,536 / 2) = 10
|
v
REFCYC_PER_PTE_GROUP_NOM_L = 8416 (0x20E0)Currently, DML does not plumb out the programming for PTE_BUFFER_MODE and FORCE_ONE_ROW_FOR_FRAME, but even adding that programming does not enable the mode to work with these values.
The simplest fix is to just block any opportunistic MALL calculations.
--- .../dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn4_calcs.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn4_calcs.c +4 -0
@@ -2001,6 +2001,10 @@ static void CalculateMALLUseForStaticScreen(#endif } +/* If no MALL is allocated for DCN, there is no need to calculate usage for static screen. */ +if (MALLAllocatedForDCN ==0 ) +return ; + SurfaceToAddToMALL =0 ; CanAddAnotherSurfaceToMALL = true;while (CanAddAnotherSurfaceToMALL) {
Signature · 1 line
2.43.0
PATCH 61/66 drm/amd/display: Fix HDMI FRL audio enable
In reply to Chenyu ChenFrom: Ilya Bakoulin <[email protected]>
[Why/How]
The APG_CLOCK_EN bit can stay at 0 in some cases when going between DPMS off and DPMS on.
Add APG_CLOCK_EN to audio_mute_control functions to make sure it gets programmed.
--- .../display/dc/hpo/dcn42/dcn42_hpo_frl_stream_encoder.c | 9 +++++++-- .../display/dc/hpo/dcn60/dcn60_hpo_frl_stream_encoder.c | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/hpo/dcn42/dcn42_hpo_frl_stream_encoder.c +7 -2
@@ -159,11 +159,16 @@ void hpo_enc42_audio_mute_control( struct hpo_frl_stream_encoder *enc, bool mute) { +struct dcn401_hpo_frl_stream_encoder *enc401 =DCN401_HPO_FRL_STRENC_FROM_HPO_FRL_STRENC (enc);ASSERT (enc->apg); -if (mute) + +if (mute) { enc->apg->funcs->disable_apg (enc->apg); -else +REG_UPDATE (HDMI_STREAM_ENC_AUDIO_CONTROL ,HDMI_STREAM_ENC_APG_CLOCK_EN ,0 ); + }else { +REG_UPDATE (HDMI_STREAM_ENC_AUDIO_CONTROL ,HDMI_STREAM_ENC_APG_CLOCK_EN ,1 ); enc->apg->funcs->enable_apg (enc->apg); + } }static const struct hpo_frl_stream_encoder_funcs dcn42_str_enc_funcs = {
drivers/gpu/drm/amd/display/dc/hpo/dcn60/dcn60_hpo_frl_stream_encoder.c +7 -2
@@ -36,11 +36,16 @@ static void hpo_enc60_audio_mute_control( struct hpo_frl_stream_encoder *enc, bool mute) { +struct dcn401_hpo_frl_stream_encoder *enc401 =DCN401_HPO_FRL_STRENC_FROM_HPO_FRL_STRENC (enc);ASSERT (enc->apg); -if (mute) + +if (mute) { enc->apg->funcs->disable_apg (enc->apg); -else +REG_UPDATE (HDMI_STREAM_ENC_AUDIO_CONTROL ,HDMI_STREAM_ENC_APG_CLOCK_EN ,0 ); + }else { +REG_UPDATE (HDMI_STREAM_ENC_AUDIO_CONTROL ,HDMI_STREAM_ENC_APG_CLOCK_EN ,1 ); enc->apg->funcs->enable_apg (enc->apg); + } }//Covered both, rounding up or rounding down from FRL Link Rate /18.
Signature · 1 line
2.43.0
PATCH 62/66 drm/amd/display: Cast DP DTO pixel clock math to avoid overflow and narrowing
In reply to Chenyu ChenFrom: James Lin <[email protected]>
[Why]
Commit 07bf51a19bf3 ("drm/amd/display: fix __udivdi3 link error") switched get_dp_dto_frequency_100hz() and dcn401_get_dp_dto_frequency_100hz() to div_u64() but dropped the original explicit casts, leaving two issues:
- In get_dp_dto_frequency_100hz(), "clock_hz * dp_dto_ref_khz * 10" is computed in 32-bit unsigned arithmetic (both operands are unsigned int) before being stored into the u64 temp, so the product can overflow before it is widened (flagged by Coverity OVERFLOW_BEFORE_WIDEN).
- div_u64() returns a u64 that is assigned directly to the unsigned int *pixel_clk_100hz, an implicit narrowing conversion that trips -Wconversion (possible loss of data) on stricter builds.
[How]
Cast clock_hz to unsigned long long so the multiplication is performed in 64-bit, and make the u64 -> unsigned int narrowing explicit with an (unsigned int) cast on the div_u64() results in both functions. The computed values are unchanged.
--- drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c +3 -3
@@ -1232,9 +1232,9 @@ static bool get_dp_dto_frequency_100hz(*/ modulo_hz =REG_READ (MODULO [inst]);if (modulo_hz) { - temp = clock_hz * dp_dto_ref_khz *10 ; + temp = (unsigned long long )clock_hz * dp_dto_ref_khz *10 ;ASSERT (temp <=UINT_MAX * modulo_hz *100ULL ); - *pixel_clk_100hz =div_u64 (temp, modulo_hz *100 ); + *pixel_clk_100hz = (unsigned int )div_u64 (temp, modulo_hz *100 ); }else *pixel_clk_100hz =0 ; }else {
@@ -1293,7 +1293,7 @@ static bool dcn401_get_dp_dto_frequency_100hz(const struct clock_source *clock_sBREAK_TO_DEBUGGER (); *pixel_clk_100hz =0 ; }else { - *pixel_clk_100hz =div_u64 (temp,100 ); + *pixel_clk_100hz = (unsigned int )div_u64 (temp,100 ); }return true;
Signature · 1 line
2.43.0
PATCH 63/66 drm/amd/display: Add inbox0 HW lock helpers for DCN35
In reply to Chenyu ChenFrom: Tom Chung <[email protected]>
Add dcn35_dmub_hw_control_lock() and dcn35_dmub_hw_control_lock_fast(), a SW lock mechanism to prevent racing between driver and FW.
The helpers are not wired into dcn35_funcs/dcn351_funcs yet, so there is no functional change: DCN3.5/3.5.1/3.6 keep using the existing inbox1 lock path. Enabling them will come in a follow-up patch.
--- .../amd/display/dc/hwss/dcn35/dcn35_hwseq.c | 43 +++++++++++++++++++ .../amd/display/dc/hwss/dcn35/dcn35_hwseq.h | 4 ++ 2 files changed, 47 insertions(+)
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c +43 -0
@@ -1822,3 +1822,46 @@ void dcn35_disable_link_output(struct dc_link *link, dc->link_srv->dp_trace_source_sequence (link,DPCD_SOURCE_SEQ_AFTER_DISABLE_LINK_PHY ); } + +void dcn35_dmub_hw_control_lock (struct dc *dc,struct dc_state *context,bool lock) +{ +/* use always for now */ +union dmub_inbox0_cmd_lock_hw hw_lock_cmd = {0 }; + +if (!dc->ctx || !dc->ctx->dmub_srv) +return ; + +/* if not support inbox0 lock, would not use inbox0 lock mechanism */ +if (!dc->ctx->dmub_srv->dmub->meta_info.feature_bits.bits.inbox0_lock_support) +return ; + +if (!dc_dmub_srv_is_cursor_offload_enabled (dc) && + !dmub_hw_lock_mgr_does_context_require_lock (dc, context)) +return ; + + hw_lock_cmd.bits.command_code =DMUB_INBOX0_CMD__HW_LOCK ; + hw_lock_cmd.bits.hw_lock_client =HW_LOCK_CLIENT_DRIVER ; + hw_lock_cmd.bits.lock = lock; + hw_lock_cmd.bits.should_release = !lock; +dmub_hw_lock_mgr_inbox0_cmd (dc->ctx->dmub_srv, hw_lock_cmd); +} + +void dcn35_dmub_hw_control_lock_fast (union block_sequence_params *params) +{ +struct dc *dc = params->dmub_hw_control_lock_fast_params.dc; +bool lock = params->dmub_hw_control_lock_fast_params.lock; + +/* if not support inbox0 lock, would not use inbox0 lock mechanism */ +if (!dc->ctx->dmub_srv->dmub->meta_info.feature_bits.bits.inbox0_lock_support) +return ; + +if (params->dmub_hw_control_lock_fast_params.is_required) { +union dmub_inbox0_cmd_lock_hw hw_lock_cmd = {0 }; + + hw_lock_cmd.bits.command_code =DMUB_INBOX0_CMD__HW_LOCK ; + hw_lock_cmd.bits.hw_lock_client =HW_LOCK_CLIENT_DRIVER ; + hw_lock_cmd.bits.lock = lock; + hw_lock_cmd.bits.should_release = !lock; +dmub_hw_lock_mgr_inbox0_cmd (dc->ctx->dmub_srv, hw_lock_cmd); + } +}
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.h +4 -0
@@ -27,6 +27,8 @@#ifndef __DC_HWSS_DCN35_H__#define __DC_HWSS_DCN35_H__ +#include "inc/core_types.h" +#include "dc.h" #include "hw_sequencer_private.h" struct dc ;
@@ -115,5 +117,7 @@ void dcn35_program_cursor_offload_now(struct dc *dc, const struct pipe_ctx *pipevoid dcn35_disable_link_output (struct dc_link *link,const struct link_resource *link_res,enum signal_type signal); +void dcn35_dmub_hw_control_lock (struct dc *dc,struct dc_state *context,bool lock); +void dcn35_dmub_hw_control_lock_fast (union block_sequence_params *params);#endif /* __DC_HWSS_DCN35_H__ */
Signature · 1 line
2.43.0
PATCH 64/66 drm/amd/display: Unify fast update classification paths
In reply to Chenyu ChenFrom: Rafal Ostrowski <[email protected]>
[Why]
The dc_fast_update intermediate struct created code duplication and complexity with multiple classification paths (populate_fast_updates, fast_nonaddr_updates_exist, full_update_required). This refactoring simplifies the update classification system by consolidating to a single path while maintaining compatibility.
[How]
Remove entire dc_fast_update struct and associated helper functions:
- populate_fast_updates
- fast_nonaddr_updates_exist
- full_update_required
Refactor check_update_surfaces_for_stream as the
single classification path with explicit handling for func_shaper, lut3d_func, cursor_csc_color_matrix_change, and scaler_sharpener_update. Add a reserved bitfield to the stream_update_flags union for completeness guards. Extract dc_check_address_only_update and dc_check_update_surfaces_for_stream as public.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 246 ++---------------- drivers/gpu/drm/amd/display/dc/dc.h | 31 --- drivers/gpu/drm/amd/display/dc/dc_stream.h | 3 + .../amd/display/dc/hwss/dcn35/dcn35_hwseq.c | 17 +- .../amd/display/dc/hwss/dcn35/dcn35_hwseq.h | 2 +- .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 12 +- .../amd/display/dc/hwss/dcn401/dcn401_hwseq.h | 2 +- .../amd/display/dc/hwss/dcn42/dcn42_hwseq.c | 13 +- .../amd/display/dc/hwss/dcn42/dcn42_hwseq.h | 2 +- .../drm/amd/display/dc/hwss/hw_sequencer.h | 2 +- 10 files changed, 58 insertions(+), 272 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +26 -220
@@ -2279,6 +2279,7 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *cstruct dc_stream_state *dc_streams[MAX_STREAMS ] = {0 };struct dc_state *old_state;bool subvp_prev_use = false; +bool dmub_locked = false;dc_z10_restore (dc);dc_allow_idle_optimizations (dc, false);
@@ -2330,7 +2331,7 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *cif (dc->hwss.subvp_pipe_control_lock) dc->hwss.subvp_pipe_control_lock (dc, context, true, true,NULL , subvp_prev_use);if (dc->hwss.dmub_hw_control_lock) - dc->hwss.dmub_hw_control_lock (dc, context, true); + dmub_locked = dc->hwss.dmub_hw_control_lock (dc, context, true);if (dc->hwss.update_dsc_pg) dc->hwss.update_dsc_pg (dc, context, false);
@@ -2406,7 +2407,7 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c dc->hwss.commit_subvp_config (dc, context);if (dc->hwss.subvp_pipe_control_lock) dc->hwss.subvp_pipe_control_lock (dc, context, false, true,NULL , subvp_prev_use); -if (dc->hwss.dmub_hw_control_lock) +if (dc->hwss.dmub_hw_control_lock && dmub_locked) dc->hwss.dmub_hw_control_lock (dc, context, false);for (i =0 ; i < context->stream_count; i++) {
@@ -3184,8 +3185,10 @@ static struct dc_update_descriptor check_update_surfaces_for_stream( stream_update->vrr_active_variable || stream_update->vrr_active_fixed)) su_flags->bits.fams_changed = 1; -if (stream_update->scaler_sharpener_update) +if (stream_update->scaler_sharpener_update) { su_flags->bits.scaler_sharpener =1 ; +elevate_update_type (&overall_type,UPDATE_TYPE_FULL ,LOCK_DESCRIPTOR_STREAM ); + }if (stream_update->sharpening_required) su_flags->bits.sharpening_required =1 ;
@@ -3250,6 +3253,16 @@ static struct dc_update_descriptor check_update_surfaces_for_stream( su_flags->bits.cursor_pos =1 ;elevate_update_type (&overall_type,UPDATE_TYPE_FAST ,LOCK_DESCRIPTOR_STREAM ); } + +if (stream_update->func_shaper) { + su_flags->bits.func_shaper =1 ; +elevate_update_type (&overall_type,UPDATE_TYPE_FULL ,LOCK_DESCRIPTOR_STREAM ); + } + +if (stream_update->lut3d_func) { + su_flags->bits.lut3d_func =1 ; +elevate_update_type (&overall_type,UPDATE_TYPE_FULL ,LOCK_DESCRIPTOR_STREAM ); + } }for (int i =0 ; i < surface_count; i++) {
@@ -4881,6 +4894,7 @@ static void commit_planes_for_stream(struct dc *dc,bool should_lock_all_pipes = (update_type !=UPDATE_TYPE_FAST );bool subvp_prev_use = false;bool subvp_curr_use = false; +bool dmub_locked = false;uint8_t current_stream_mask =0 ;if (should_lock_all_pipes)
@@ -4986,7 +5000,7 @@ static void commit_planes_for_stream(struct dc *dc, dc->hwss.subvp_pipe_control_lock (dc, context, true, should_lock_all_pipes,NULL , subvp_prev_use);if (dc->hwss.dmub_hw_control_lock) - dc->hwss.dmub_hw_control_lock (dc, context, true); + dmub_locked = dc->hwss.dmub_hw_control_lock (dc, context, true); dc->hwss.interdependent_update_lock (dc, context, true); }else {
@@ -4994,7 +5008,7 @@ static void commit_planes_for_stream(struct dc *dc, dc->hwss.subvp_pipe_control_lock (dc, context, true, should_lock_all_pipes, top_pipe_to_program, subvp_prev_use);if (dc->hwss.dmub_hw_control_lock) - dc->hwss.dmub_hw_control_lock (dc, context, true); + dmub_locked = dc->hwss.dmub_hw_control_lock (dc, context, true);/* Lock the top pipe while updating plane addrs, since freesync requires * plane addr update event triggers to be synchronized.
@@ -5037,7 +5051,7 @@ static void commit_planes_for_stream(struct dc *dc, dc->hwss.subvp_pipe_control_lock (dc, context, false, should_lock_all_pipes,NULL , subvp_prev_use); -if (dc->hwss.dmub_hw_control_lock) +if (dc->hwss.dmub_hw_control_lock && dmub_locked) dc->hwss.dmub_hw_control_lock (dc, context, false);return ; }
@@ -5273,12 +5287,12 @@ static void commit_planes_for_stream(struct dc *dc,if (should_lock_all_pipes && dc->hwss.interdependent_update_lock) {if (dc->hwss.subvp_pipe_control_lock) dc->hwss.subvp_pipe_control_lock (dc, context, false, should_lock_all_pipes,NULL , subvp_prev_use); -if (dc->hwss.dmub_hw_control_lock) +if (dc->hwss.dmub_hw_control_lock && dmub_locked) dc->hwss.dmub_hw_control_lock (dc, context, false); }else {if (dc->hwss.subvp_pipe_control_lock) dc->hwss.subvp_pipe_control_lock (dc, context, false, should_lock_all_pipes, top_pipe_to_program, subvp_prev_use); -if (dc->hwss.dmub_hw_control_lock) +if (dc->hwss.dmub_hw_control_lock && dmub_locked) dc->hwss.dmub_hw_control_lock (dc, context, false); }
@@ -5737,127 +5751,6 @@ static bool commit_minimal_transition_state(struct dc *dc,return true; } -void populate_fast_updates (struct dc_fast_update *fast_update, -struct dc_surface_update *srf_updates, -int surface_count, -struct dc_stream_update *stream_update) -{ -int i =0 ; - -if (stream_update) { - fast_update[0 ].out_transfer_func = stream_update->out_transfer_func; - fast_update[0 ].output_csc_transform = stream_update->output_csc_transform; - fast_update[0 ].cursor_attributes = stream_update->cursor_attributes; - fast_update[0 ].cursor_position = stream_update->cursor_position; - fast_update[0 ].periodic_interrupt = stream_update->periodic_interrupt; - fast_update[0 ].dither_option = stream_update->dither_option; - fast_update[0 ].gamut_remap = stream_update->gamut_remap; - fast_update[0 ].vrr_infopacket = stream_update->vrr_infopacket; - fast_update[0 ].vsc_infopacket = stream_update->vsc_infopacket; - fast_update[0 ].vsp_infopacket = stream_update->vsp_infopacket; - fast_update[0 ].hfvsif_infopacket = stream_update->hfvsif_infopacket; - fast_update[0 ].vtem_infopacket = stream_update->vtem_infopacket; - fast_update[0 ].adaptive_sync_infopacket = stream_update->adaptive_sync_infopacket; - fast_update[0 ].avi_infopacket = stream_update->avi_infopacket; - fast_update[0 ].hdr_static_metadata = stream_update->hdr_static_metadata; - }else { - fast_update[0 ].out_transfer_func =NULL ; - fast_update[0 ].output_csc_transform =NULL ; - fast_update[0 ].cursor_attributes =NULL ; - fast_update[0 ].cursor_position =NULL ; - fast_update[0 ].periodic_interrupt =NULL ; - fast_update[0 ].dither_option =NULL ; - fast_update[0 ].gamut_remap =NULL ; - fast_update[0 ].vrr_infopacket =NULL ; - fast_update[0 ].vsc_infopacket =NULL ; - fast_update[0 ].vsp_infopacket =NULL ; - fast_update[0 ].hfvsif_infopacket =NULL ; - fast_update[0 ].vtem_infopacket =NULL ; - fast_update[0 ].adaptive_sync_infopacket =NULL ; - fast_update[0 ].avi_infopacket =NULL ; - fast_update[0 ].hdr_static_metadata =NULL ; - } - -for (i =0 ; i < surface_count; i++) { - fast_update[i].flip_addr = srf_updates[i].flip_addr; - fast_update[i].gamma = srf_updates[i].gamma; - fast_update[i].gamut_remap_matrix = srf_updates[i].gamut_remap_matrix; - fast_update[i].input_csc_color_matrix = srf_updates[i].input_csc_color_matrix; - fast_update[i].coeff_reduction_factor = srf_updates[i].coeff_reduction_factor; - fast_update[i].cursor_csc_color_matrix = srf_updates[i].cursor_csc_color_matrix; - fast_update[i].cm_hist_control = srf_updates[i].cm_hist_control; - } -} - -static bool fast_updates_exist (const struct dc_fast_update *fast_update,int surface_count) -{ -int i; - -if (fast_update[0 ].out_transfer_func || - fast_update[0 ].output_csc_transform || - fast_update[0 ].cursor_attributes || - fast_update[0 ].cursor_position || - fast_update[0 ].periodic_interrupt || - fast_update[0 ].dither_option || - fast_update[0 ].gamut_remap || - fast_update[0 ].vrr_infopacket || - fast_update[0 ].vsc_infopacket || - fast_update[0 ].vsp_infopacket || - fast_update[0 ].hfvsif_infopacket || - fast_update[0 ].vtem_infopacket || - fast_update[0 ].adaptive_sync_infopacket || - fast_update[0 ].avi_infopacket || - fast_update[0 ].hdr_static_metadata) -return true; - -for (i =0 ; i < surface_count; i++) { -if (fast_update[i].flip_addr || - fast_update[i].gamma || - fast_update[i].gamut_remap_matrix || - fast_update[i].input_csc_color_matrix || - fast_update[i].cursor_csc_color_matrix || - fast_update[i].cm_hist_control || - fast_update[i].coeff_reduction_factor) -return true; - } - -return false; -} - -bool fast_nonaddr_updates_exist (struct dc_fast_update *fast_update,int surface_count) -{ -int i; - -if (fast_update[0 ].out_transfer_func || - fast_update[0 ].output_csc_transform || - fast_update[0 ].gamut_remap || - fast_update[0 ].cursor_attributes || - fast_update[0 ].cursor_position || - fast_update[0 ].periodic_interrupt || - fast_update[0 ].dither_option || - fast_update[0 ].vrr_infopacket || - fast_update[0 ].vsc_infopacket || - fast_update[0 ].vsp_infopacket || - fast_update[0 ].hfvsif_infopacket || - fast_update[0 ].vtem_infopacket || - fast_update[0 ].adaptive_sync_infopacket || - fast_update[0 ].avi_infopacket || - fast_update[0 ].hdr_static_metadata) -return true; - -for (i =0 ; i < surface_count; i++) { -if (fast_update[i].input_csc_color_matrix || - fast_update[i].gamma || - fast_update[i].gamut_remap_matrix || - fast_update[i].coeff_reduction_factor || - fast_update[i].cm_hist_control || - fast_update[i].cursor_csc_color_matrix) -return true; - } - -return false; -} - static bool full_update_required_weak( const struct dc *dc, const struct dc_surface_update *srf_updates,
@@ -5886,67 +5779,6 @@ static bool full_update_required_weak(return false; } -static bool full_update_required ( -const struct dc *dc, -const struct dc_surface_update *srf_updates, -int surface_count, -const struct dc_stream_update *stream_update, -const struct dc_stream_state *stream) -{ -if (full_update_required_weak (dc, srf_updates, surface_count, stream_update, stream)) -return true; - -for (int i =0 ; i < surface_count; i++) { -if (srf_updates && - (srf_updates[i].plane_info || - srf_updates[i].scaling_info || - (srf_updates[i].hdr_mult.value && - srf_updates[i].hdr_mult.value != srf_updates->surface->hdr_mult.value) || - (srf_updates[i].sdr_white_level_nits && - srf_updates[i].sdr_white_level_nits != srf_updates->surface->sdr_white_level_nits) || - srf_updates[i].in_transfer_func || - srf_updates[i].surface->force_full_update || - (srf_updates[i].flip_addr && - srf_updates[i].flip_addr->address.tmz_surface != srf_updates[i].surface->address.tmz_surface))) -return true; - } - -if (stream_update && - (((stream_update->src.height !=0 && stream_update->src.width !=0 ) || - (stream_update->dst.height !=0 && stream_update->dst.width !=0 ) || - stream_update->integer_scaling_update) || - stream_update->abm_level || - stream_update->dpms_off || - stream_update->allow_freesync || - stream_update->vrr_active_variable || - stream_update->vrr_active_fixed || - stream_update->output_color_space || - stream_update->wb_update || - stream_update->dsc_config || - stream_update->mst_bw_update || - stream_update->func_shaper || - stream_update->lut3d_func || - stream_update->pending_test_pattern || - stream_update->crtc_timing_adjust || - stream_update->scaler_sharpener_update || - stream_update->hw_cursor_req)) -return true; - -return false; -} - -static bool fast_update_only ( -const struct dc *dc, -const struct dc_fast_update *fast_update, -const struct dc_surface_update *srf_updates, -int surface_count, -const struct dc_stream_update *stream_update, -const struct dc_stream_state *stream) -{ -return fast_updates_exist (fast_update, surface_count) - && !full_update_required (dc, srf_updates, surface_count, stream_update, stream); -} - static bool update_planes_and_stream_v2(struct dc *dc, struct dc_surface_update *srf_updates, int surface_count, struct dc_stream_state *stream,
@@ -5954,7 +5786,6 @@ static bool update_planes_and_stream_v2(struct dc *dc, {struct dc_state *context;enum dc_update_type update_type; -struct dc_fast_update fast_update[MAX_SURFACES ] = {0 };/* In cases where MPO and split or ODM are used transitions can * cause underflow. Apply stream configuration with minimal pipe
@@ -5962,11 +5793,7 @@ static bool update_planes_and_stream_v2(struct dc *dc,*/ bool force_minimal_pipe_splitting =0 ;bool is_plane_addition =0 ; -bool is_fast_update_only; -populate_fast_updates (fast_update, srf_updates, surface_count, stream_update); - is_fast_update_only =fast_update_only (dc, fast_update, srf_updates, - surface_count, stream_update, stream); force_minimal_pipe_splitting = could_mpcc_tree_change_for_active_pipes( dc, stream,
@@ -6004,7 +5831,7 @@ static bool update_planes_and_stream_v2(struct dc *dc,commit_minimal_transition_state_in_dc_update (dc, context, stream, srf_updates, surface_count); -if (is_fast_update_only && !dc->check_config.enable_legacy_fast_update) { +if (update_type ==UPDATE_TYPE_FAST && !dc->check_config.enable_legacy_fast_update) { commit_planes_for_stream_fast(dc, srf_updates, surface_count,
@@ -6040,13 +5867,8 @@ static void commit_planes_and_stream_update_on_current_context(struct dc *dc,struct dc_stream_update *stream_update, enum dc_update_type update_type) { - struct dc_fast_update fast_update[MAX_SURFACES] = {0}; - ASSERT(update_type < UPDATE_TYPE_FULL); -populate_fast_updates (fast_update, srf_updates, surface_count, - stream_update); - if (fast_update_only(dc, fast_update, srf_updates, surface_count, - stream_update, stream) && + if (update_type == UPDATE_TYPE_FAST && !dc->check_config.enable_legacy_fast_update) commit_planes_for_stream_fast(dc, srf_updates,
@@ -8242,23 +8064,6 @@ static bool update_planes_and_stream_prepare_v3(ASSERT (scratch->flow ==UPDATE_V3_FLOW_INVALID );dc_exit_ips_for_hw_access (scratch->dc); -/* HWSS path determination needs to be done prior to updating the surface and stream states. */ -struct dc_fast_update fast_update[MAX_SURFACES ] = {0 }; - -populate_fast_updates (fast_update, - scratch->surface_updates, - scratch->surface_count, - scratch->stream_update); - -const bool is_hwss_fast_path_only = -fast_update_only (scratch->dc, - fast_update, - scratch->surface_updates, - scratch->surface_count, - scratch->stream_update, - scratch->stream) && - !scratch->dc->check_config.enable_legacy_fast_update; - if (!update_planes_and_stream_state( scratch->dc, scratch->surface_updates,
@@ -8274,7 +8079,8 @@ static bool update_planes_and_stream_prepare_v3(if (scratch->new_context == scratch->dc->current_state) {ASSERT (scratch->update_type <UPDATE_TYPE_FULL ); - scratch->flow = is_hwss_fast_path_only + scratch->flow = (scratch->update_type ==UPDATE_TYPE_FAST && + !scratch->dc->check_config.enable_legacy_fast_update) ?UPDATE_V3_FLOW_NO_NEW_CONTEXT_CONTEXT_FAST :UPDATE_V3_FLOW_NO_NEW_CONTEXT_CONTEXT_FULL ;return true;
drivers/gpu/drm/amd/display/dc/dc.h +0 -31
@@ -2091,32 +2091,6 @@ struct dc_scaling_info {struct scaling_taps scaling_quality; }; -struct dc_fast_update { -const struct dc_flip_addrs *flip_addr; -const struct dc_gamma *gamma; -const struct colorspace_transform *gamut_remap_matrix; -const struct dc_csc_transform *input_csc_color_matrix; -const struct fixed31_32 *coeff_reduction_factor; -struct dc_transfer_func *out_transfer_func; -struct dc_csc_transform *output_csc_transform; -const struct dc_csc_transform *cursor_csc_color_matrix; -struct cm_hist_control *cm_hist_control; -/* stream-level fast updates */ -const struct colorspace_transform *gamut_remap; -const struct dc_cursor_attributes *cursor_attributes; -const struct dc_cursor_position *cursor_position; -const struct periodic_interrupt_config *periodic_interrupt; -const enum dc_dither_option *dither_option; -struct dc_info_packet *vrr_infopacket; -struct dc_info_packet *vsc_infopacket; -struct dc_info_packet *vsp_infopacket; -struct dc_info_packet *hfvsif_infopacket; -struct dc_info_packet *vtem_infopacket; -struct dc_info_packet *adaptive_sync_infopacket; -struct dc_info_packet *avi_infopacket; -struct dc_info_packet *hdr_static_metadata; -}; -struct dc_surface_update {struct dc_plane_state *surface;
@@ -2422,11 +2396,6 @@ bool dc_resource_is_dsc_encoding_supported(const struct dc *dc);void get_audio_check (struct audio_info *aud_modes,struct audio_check *aud_chk); -bool fast_nonaddr_updates_exist (struct dc_fast_update *fast_update,int surface_count); -void populate_fast_updates (struct dc_fast_update *fast_update, -struct dc_surface_update *srf_updates, -int surface_count, -struct dc_stream_update *stream_update);/* * Set up streams and links associated to drive sinks * The streams parameter is an absolute set of all active streams.
drivers/gpu/drm/amd/display/dc/dc_stream.h +3 -0
@@ -123,6 +123,9 @@ union stream_update_flags { uint32_t info_frame : 1; uint32_t dmdata : 1; uint32_t dither : 1; + uint32_t func_shaper : 1; + uint32_t lut3d_func : 1; + uint32_t reserved : 11; /* adjust when adding new flags */ } bits;uint32_t raw;
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c +10 -7
@@ -1823,27 +1823,30 @@ void dcn35_disable_link_output(struct dc_link *link, dc->link_srv->dp_trace_source_sequence (link,DPCD_SOURCE_SEQ_AFTER_DISABLE_LINK_PHY ); } -void dcn35_dmub_hw_control_lock (struct dc *dc,struct dc_state *context,bool lock) +bool dcn35_dmub_hw_control_lock (struct dc *dc,struct dc_state *context,bool lock) { -/* use always for now */ union dmub_inbox0_cmd_lock_hw hw_lock_cmd = {0 };if (!dc->ctx || !dc->ctx->dmub_srv) -return ; +return false;/* if not support inbox0 lock, would not use inbox0 lock mechanism */ if (!dc->ctx->dmub_srv->dmub->meta_info.feature_bits.bits.inbox0_lock_support) -return ; +return false; -if (!dc_dmub_srv_is_cursor_offload_enabled (dc) && - !dmub_hw_lock_mgr_does_context_require_lock (dc, context)) -return ; +if (lock) { +if (!dc_dmub_srv_is_cursor_offload_enabled (dc) && + !dmub_hw_lock_mgr_does_context_require_lock (dc, context)) +return false; + } hw_lock_cmd.bits.command_code =DMUB_INBOX0_CMD__HW_LOCK ; hw_lock_cmd.bits.hw_lock_client =HW_LOCK_CLIENT_DRIVER ; hw_lock_cmd.bits.lock = lock; hw_lock_cmd.bits.should_release = !lock;dmub_hw_lock_mgr_inbox0_cmd (dc->ctx->dmub_srv, hw_lock_cmd); + +return true; }void dcn35_dmub_hw_control_lock_fast (union block_sequence_params *params)
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.h +1 -1
@@ -117,7 +117,7 @@ void dcn35_program_cursor_offload_now(struct dc *dc, const struct pipe_ctx *pipevoid dcn35_disable_link_output (struct dc_link *link,const struct link_resource *link_res,enum signal_type signal); -void dcn35_dmub_hw_control_lock (struct dc *dc,struct dc_state *context,bool lock); +bool dcn35_dmub_hw_control_lock (struct dc *dc,struct dc_state *context,bool lock);void dcn35_dmub_hw_control_lock_fast (union block_sequence_params *params);#endif /* __DC_HWSS_DCN35_H__ */
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +7 -5
@@ -1556,25 +1556,27 @@ void dcn401_optimize_bandwidth_sequence(struct dc *dc, dc->clk_mgr, context, true, seq_state); } -void dcn401_dmub_hw_control_lock (struct dc *dc, +bool dcn401_dmub_hw_control_lock (struct dc *dc,struct dc_state *context,bool lock) { (void )context; -/* use always for now */ union dmub_inbox0_cmd_lock_hw hw_lock_cmd = {0 };if (!dc->ctx || !dc->ctx->dmub_srv) -return ; +return false; -if (!dc->debug.fams2_config.bits.enable && !dc_dmub_srv_is_cursor_offload_enabled (dc)) -return ; +if (lock) { +if (!dc->debug.fams2_config.bits.enable && !dc_dmub_srv_is_cursor_offload_enabled (dc)) +return false; + } hw_lock_cmd.bits.command_code =DMUB_INBOX0_CMD__HW_LOCK ; hw_lock_cmd.bits.hw_lock_client =HW_LOCK_CLIENT_DRIVER ; hw_lock_cmd.bits.lock = lock; hw_lock_cmd.bits.should_release = !lock;dmub_hw_lock_mgr_inbox0_cmd (dc->ctx->dmub_srv, hw_lock_cmd); +return true; }void dcn401_dmub_hw_control_lock_fast (union block_sequence_params *params)
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.h +1 -1
@@ -78,7 +78,7 @@ void dcn401_optimize_bandwidth_sequence(struct dc *dc,struct dc_state *context, struct block_sequence_state *seq_state); -void dcn401_dmub_hw_control_lock (struct dc *dc, +bool dcn401_dmub_hw_control_lock (struct dc *dc,struct dc_state *context,bool lock);void dcn401_fams2_update_config (struct dc *dc,struct dc_state *context,bool enable);
drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.c +8 -5
@@ -1188,25 +1188,28 @@ void dcn42_setup_stereo(struct pipe_ctx *pipe_ctx, struct dc *dc)return ; } -void dcn42_dmub_hw_control_lock (struct dc *dc,struct dc_state *context,bool lock) +bool dcn42_dmub_hw_control_lock (struct dc *dc,struct dc_state *context,bool lock) {union dmub_inbox0_cmd_lock_hw hw_lock_cmd = {0 };if (!dc->ctx || !dc->ctx->dmub_srv) -return ; +return false;/* Use helper to check PSR/Replay for all streams in context */ -if (!dc->debug.fams2_config.bits.enable && !dc_dmub_srv_is_cursor_offload_enabled (dc) - && !dmub_hw_lock_mgr_does_context_require_lock (dc, context)) -return ; +if (lock) { +if (!dc->debug.fams2_config.bits.enable && !dc_dmub_srv_is_cursor_offload_enabled (dc) + && !dmub_hw_lock_mgr_does_context_require_lock (dc, context)) +return false; + } hw_lock_cmd.bits.command_code =DMUB_INBOX0_CMD__HW_LOCK ; hw_lock_cmd.bits.hw_lock_client =HW_LOCK_CLIENT_DRIVER ; hw_lock_cmd.bits.lock = lock; hw_lock_cmd.bits.should_release = !lock;dmub_hw_lock_mgr_inbox0_cmd (dc->ctx->dmub_srv, hw_lock_cmd); +return true; }void dcn42_dmub_hw_control_lock_fast (union block_sequence_params *params)
drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.h +1 -1
@@ -43,7 +43,7 @@ void dcn42_hw_block_power_up(struct dc *dc, struct pg_block_update *update_state);void dcn42_root_clock_control (struct dc *dc,struct pg_block_update *update_state,bool power_on); -void dcn42_dmub_hw_control_lock (struct dc *dc,struct dc_state *context,bool lock); +bool dcn42_dmub_hw_control_lock (struct dc *dc,struct dc_state *context,bool lock);void dcn42_dmub_hw_control_lock_fast (union block_sequence_params *params);void dcn42_setup_stereo (struct pipe_ctx *pipe_ctx,struct dc *dc);void dcn42_power_down_on_boot (struct dc *dc);
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +1 -1
@@ -1719,7 +1719,7 @@ struct hw_sequencer_funcs {const struct dc_state *cur_ctx, const struct dc_state *new_ctx);void (*wait_for_dcc_meta_propagation)(uint32_t delay); -void (*dmub_hw_control_lock)(struct dc *dc, +bool (*dmub_hw_control_lock)(struct dc *dc,struct dc_state *context,bool lock); void (*fams2_update_config)(struct dc *dc,
Signature · 1 line
2.43.0
PATCH 65/66 drm/amd/display: Use unsigned types for FRL cap check params and HPO read_state
In reply to Chenyu Chen[Why]
Commit c3fb1fb9e65f ("drm/amd/display: Fix warnings") aligned the signedness of a large number of DC values, but two hunks of the original change were not carried over:
- struct frl_cap_chk_params_fixed31_32 still declares audio_packet_type, h_active and h_blank as int. All three only ever hold non-negative
values: h_active and h_blank are HDMI timing quantities counted in pixels, and audio_packet_type is only compared against the positive HDMI audio packet type constants 0x02, 0x07, 0x08, 0x09 and 0x0e in frl_capacity_computations_common().
- hpo_enc3_read_state() still declares pixel_encoding, color_depth and odm_combine as int and passes their addresses to REG_GET_2()/REG_GET(), whose generic_reg_get*() backends take uint32_t *. The mismatch is only hidden by the explicit (uint32_t *) cast inside the REG_GET macros. The DCN401 equivalent, hpo_enc401_read_state(), already uses uint32_t.
[How]
Widen the three struct fields to unsigned int/uint32_t and the three locals to uint32_t so the types match how the values are produced and consumed. No computed value changes.
--- drivers/gpu/drm/amd/display/dc/dc.h | 6 +++--- .../amd/display/dc/hpo/dcn30/dcn30_hpo_frl_stream_encoder.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/dc.h +3 -3
@@ -112,10 +112,10 @@ struct frl_cap_chk_params_fixed31_32 {int lanes;struct fixed31_32 f_pixel_clock_nominal;/* Pixel Clock rate (Hz) */ struct fixed31_32 r_bit_nominal;/* FRL bitrate (bps) */ -int audio_packet_type; +unsigned int audio_packet_type;struct fixed31_32 f_audio;/* Audio rate (Hz) */ -int h_active;/* Active pixels per line */ -int h_blank;/* Blanking pixels per line */ +uint32_t h_active;/* Active pixels per line */ +uint32_t h_blank;/* Blanking pixels per line */ int bpc;/* Bits per component */ int vic;/* Video Identification Code */
drivers/gpu/drm/amd/display/dc/hpo/dcn30/dcn30_hpo_frl_stream_encoder.c +3 -3
@@ -921,9 +921,9 @@ void hpo_enc3_read_state(struct hpo_frl_stream_encoder *enc, struct hpo_frl_stream_encoder_state *state) { - int pixel_encoding; -int color_depth; -int odm_combine; + uint32_t pixel_encoding; +uint32_t color_depth; +uint32_t odm_combine;struct dcn30_hpo_frl_stream_encoder *enc3 =DCN30_HPO_FRL_STRENC_FROM_HPO_FRL_STRENC (enc);ASSERT (state);
Signature · 1 line
2.43.0
PATCH 66/66 drm/amd/display: Promote DC to 3.2.398
In reply to Chenyu ChenFrom: Taimur Hassan <[email protected]>
This version brings along the following updates:
- Expand amdgpu_dm KUnit coverage across connector init, sink stream creation, FreeSync caps, forced atomic commit, plane modifiers, cursor updates, panic flush, MST connector creation, AUX transfers, link bandwidth readback and MST DSC configuration.
- Refactor RMCM into a separate module.
- Decouple cursor offload hwss executors from pipe context.
- Decouple HUBP_UPDATE_PLANE_ADDR from pipe_ctx.
- Rename lock_and_validation_needed to needs_dc_state_realloc.
- Drop the dead update_type param from update_planes_and_stream_adapter.
- Attach only plane updates and stream updates that actually changed.
- Unify fast update classification paths.
- Request DMUB HW cursor offload.
- Program DCC as part of address update.
- Update LLS and UPSP programming paths.
- Add lock-free memory pool.
- Add instance field to struct mpc and struct dccg.
- Cleanup DMUB command submission interfaces.
- Add inbox0 HW lock helpers for DCN35.
- Atomize IRQ register read/modify/write ops.
- Add Replay cumulative residency query.
- Add urgent assertion counter probe.
- Add debug option to force optional UCLK support.
- Force DSC to 8bpp for SST and MST DP tunneling over USB4.
- Honor forced RGB pixel encoding.
- Add option for certain panels to disable FEC.
- Cap DML2.1 vmin ODM combine at 2:1 for eDP.
- Add is_odm_enabled callback to skip init_odm on active ODM pipes.
- Remove MALL capabilities from DCN42B.
- Skip MALL calculations when there is no MALL.
- Enable power gating on dcn42b.
- Remove SDPIF_PORT_CONTROL programming for DCN31/35/42.
- Enable back alt-ch.
- Flush ISM work before releasing the stream.
- Fix HDMI FRL audio enable.
- Fix peak bandwidth measurement sequence.
- Bound the DSC power gating loop by num_dsc.
- Cast DP DTO pixel clock math to avoid overflow and narrowing.
- Use unsigned types for FRL cap check params and HPO read_state.
- Return success status from check_mode_supported.
- Add SPDX license identifier to dcn30_dpp_cm.c.
--- 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.397" +#define DC_VER "3.2.398"/** * MAX_SURFACES - representative of the upper bound of surfaces that can be piped to a single CRTC
Signature · 1 line
2.43.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 -> 29393ab0e49fe052ee7292481733c3d0ce7151e2 -> drm/amd/display: Promote DC to 3.2.397) 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: Chenyu Chen <[email protected]>
Sent: Tuesday, September 8, 2026 7:31 AM
To: [email protected]
Cc: Wentland, Harry <[email protected]>; Li, Sun peng (Leo) <[email protected]>; Pillai, Aurabindo <[email protected]>; Li, Roman <[email protected]>; Lin, Wayne <[email protected]>; Chung, ChiaHsuan (Tom) <[email protected]>; Zuo, Jerry <[email protected]>; Wheeler, Daniel <[email protected]>; Wu, Ray <[email protected]>; LIPSKI, IVAN <[email protected]>; Hung, Alex <[email protected]>; Lin, Ping Lei <[email protected]>; Chen, Chen-Yu <[email protected]>; Chen, Chen-Yu <[email protected]>
Subject: [PATCH 00/66] DC Patches Sep 14 2026
This DC patchset brings improvements in multiple areas. In summary, we highlight:
- Expand amdgpu_dm KUnit coverage across connector init, sink stream creation, FreeSync caps, forced atomic commit, plane modifiers, cursor updates, panic flush, MST connector creation, AUX transfers, link bandwidth readback and MST DSC configuration.
- Refactor RMCM into a separate module.
- Decouple cursor offload hwss executors from pipe context.
- Decouple HUBP_UPDATE_PLANE_ADDR from pipe_ctx.
- Rename lock_and_validation_needed to needs_dc_state_realloc.
- Drop the dead update_type param from update_planes_and_stream_adapter.
- Attach only plane updates and stream updates that actually changed.
- Unify fast update classification paths.
- Request DMUB HW cursor offload.
- Program DCC as part of address update.
- Update LLS and UPSP programming paths.
- Add lock-free memory pool.
- Add instance field to struct mpc and struct dccg.
- Cleanup DMUB command submission interfaces.
- Add inbox0 HW lock helpers for DCN35.
- Atomize IRQ register read/modify/write ops.
- Add Replay cumulative residency query.
- Add urgent assertion counter probe.
- Add debug option to force optional UCLK support.
- Force DSC to 8bpp for SST and MST DP tunneling over USB4.
- Honor forced RGB pixel encoding.
- Add option for certain panels to disable FEC.
- Cap DML2.1 vmin ODM combine at 2:1 for eDP.
- Add is_odm_enabled callback to skip init_odm on active ODM pipes.
- Remove MALL capabilities from DCN42B.
- Skip MALL calculations when there is no MALL.
- Enable power gating on dcn42b.
- Remove SDPIF_PORT_CONTROL programming for DCN31/35/42.
- Enable back alt-ch.
- Flush ISM work before releasing the stream.
- Fix HDMI FRL audio enable.
- Fix peak bandwidth measurement sequence.
- Bound the DSC power gating loop by num_dsc.
- Cast DP DTO pixel clock math to avoid overflow and narrowing.
- Use unsigned types for FRL cap check params and HPO read_state.
- Return success status from check_mode_supported.
- Add SPDX license identifier to dcn30_dpp_cm.c.
Alex Hung (25):
drm/amd/display: Test sink stream creation drm/amd/display: Test connector init helper drm/amd/display: Test HDMI connector init drm/amd/display: Test FreeSync caps update drm/amd/display: Test connector init drm/amd/display: Test forced atomic commit drm/amd/display: Test DCC reject for multi-plane format drm/amd/display: Test modifier list growth failure drm/amd/display: Test pre-GFX9 plane buffer attributes drm/amd/display: Test accepted plane atomic check drm/amd/display: Test cursor update without DC stream drm/amd/display: Test panic flush DCC teardown drm/amd/display: Test optional plane property creation drm/amd/display: Build MST DSC helpers for KUnit drm/amd/display: Test oversized AUX transfer drm/amd/display: Test MST connector creation drm/amd/display: Test link bandwidth readback drm/amd/display: Test cascaded Panamera check drm/amd/display: Test DSC caps validation drm/amd/display: Test MST port mode support drm/amd/display: Test FRL bandwidth lookup drm/amd/display: Test DSC precompute helpers drm/amd/display: Test DSC recompute check drm/amd/display: Test DSC config computation drm/amd/display: Test per-link DSC configs
Alvin Lee (5):
drm/amd/display: Update LLS and UPSP programming paths drm/amd/display: Add debug option to force optional UCLK support drm/amd/display: Enable back alt-ch
drm/amd/display: Program DCC as part of address update drm/amd/display: Return success status from check_mode_supported
Chenyu Chen (1):
drm/amd/display: Use unsigned types for FRL cap check params and HPO
read_state
Dillon Varone (1):
drm/amd/display: Cleanup DMUB command submission interfaces
Dominik Kaszewski (1):
drm/amd/display: Add lock-free memory pool
Fangzhi Zuo (2):
drm/amd/display: Force DSC to 8bpp for MST DP tunneling over USB4 drm/amd/display: Force DSC to 8bpp for SST DP tunneling over USB4
Gabe Teeger (4):
drm/amd/display: Enable power gating on dcn42b drm/amd/display: Bound DSC power gating loop by num_dsc drm/amd/display: Remove MALL capabilities from DCN42B drm/amd/display: Remove MALL capabilities from DCN42B bounding box
Ilya Bakoulin (1):
drm/amd/display: Fix HDMI FRL audio enable
Ivan Lipski (1):
drm/amd/display: Honor forced RGB pixel encoding
James Lin (6):
drm/amd/display: Rename lock_and_validation_needed to
needs_dc_state_realloc
drm/amd/display: Attach only plane updates that actually changed drm/amd/display: Request DMUB HW cursor offload drm/amd/display: Send stream_update to DC only when it changed drm/amd/display: Drop dead update_type param from
update_planes_and_stream_adapter
drm/amd/display: Cast DP DTO pixel clock math to avoid overflow and
narrowing
Leo Chen (1):
drm/amd/display: Cap DML2.1 vmin ODM combine at 2:1 for eDP
Leo Li (1):
drm/amd/display: Atomize IRQ register read/modify/write ops
Ovidiu Bunea (2):
drm/amd/display: Remove SDPIF_PORT_CONTROL programming for DCN31/35/42 drm/amd/display: Add condition to skip MALL calculations if there is
no MALL
Rafal Ostrowski (2):
drm/amd/display: Refactor RMCM into a separate module drm/amd/display: Unify fast update classification paths
Ray Wu (1):
drm/amd/display: Flush ISM work before releasing the stream
Taimur Hassan (1):
drm/amd/display: Promote DC to 3.2.398
Tom Chung (1):
drm/amd/display: Add inbox0 HW lock helpers for DCN35
Tomasz Siemek (2):
drm/amd/display: Decouple cursor offload hwss executors from pipe
context
drm/amd/display: Decouple HUBP_UPDATE_PLANE_ADDR from pipe_ctx
Tony Cheng (3):
drm/amd/display: Add instance field to struct mpc drm/amd/display: Add instance field to struct dccg drm/amd/display: Add SPDX license identifier to dcn30_dpp_cm.c
Wang, Sung-huai (1):
drm/amd/display: Add is_odm_enabled callback to skip init_odm on
active ODM pipes
Wei-Guang Li (1):
drm/amd/display: Add Replay cumulative residency query
Wenjing Liu (2):
drm/amd/display: Add urgent assertion counter probe drm/amd/display: Fix peak bandwidth measurement sequence
Yi-Ling Chen (1):
drm/amd/display: Add option for certain panels to disable FEC
drivers/gpu/drm/amd/display/Makefile | 1 + .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 113 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 27 +- .../display/amdgpu_dm/amdgpu_dm_connector.c | 19 +- .../display/amdgpu_dm/amdgpu_dm_connector.h | 1 + .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 9 +- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 3 +- .../drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c | 64 +- .../drm/amd/display/amdgpu_dm/amdgpu_dm_irq.h | 28 + .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c | 21 +- .../drm/amd/display/amdgpu_dm/amdgpu_dm_ism.h | 2 +- .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 61 +- .../display/amdgpu_dm/amdgpu_dm_mst_types.h | 19 + .../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 33 + .../tests/amdgpu_dm_connector_test.c | 1345 +++++++++++ .../amdgpu_dm/tests/amdgpu_dm_crtc_test.c | 16 +- .../amdgpu_dm/tests/amdgpu_dm_helpers_test.c | 8 +- .../amdgpu_dm/tests/amdgpu_dm_irq_test.c | 34 +- .../amdgpu_dm/tests/amdgpu_dm_ism_test.c | 83 +- .../tests/amdgpu_dm_mst_types_test.c | 2041 ++++++++++++++++- .../amdgpu_dm/tests/amdgpu_dm_plane_test.c | 357 ++- .../display/amdgpu_dm/tests/amdgpu_dm_test.c | 4 +- drivers/gpu/drm/amd/display/dc/Makefile | 3 +- drivers/gpu/drm/amd/display/dc/core/dc.c | 254 +- .../drm/amd/display/dc/core/dc_hw_sequencer.c | 246 +- .../gpu/drm/amd/display/dc/core/dc_resource.c | 147 +- .../gpu/drm/amd/display/dc/core/dc_state.c | 2 - .../gpu/drm/amd/display/dc/core/dc_stream.c | 124 +- drivers/gpu/drm/amd/display/dc/dc.h | 48 +- drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 50 +- drivers/gpu/drm/amd/display/dc/dc_dmub_srv.h | 12 +- .../gpu/drm/amd/display/dc/dc_memory_pool.c | 277 +++ .../gpu/drm/amd/display/dc/dc_memory_pool.h | 107 + drivers/gpu/drm/amd/display/dc/dc_stream.h | 14 +- .../amd/display/dc/dccg/dcn20/dcn20_dccg.c | 1 + .../amd/display/dc/dccg/dcn201/dcn201_dccg.c | 1 + .../amd/display/dc/dccg/dcn21/dcn21_dccg.c | 1 + .../amd/display/dc/dccg/dcn30/dcn30_dccg.c | 2 + .../amd/display/dc/dccg/dcn301/dcn301_dccg.c | 1 + .../amd/display/dc/dccg/dcn31/dcn31_dccg.c | 1 + .../amd/display/dc/dccg/dcn314/dcn314_dccg.c | 1 + .../amd/display/dc/dccg/dcn32/dcn32_dccg.c | 1 + .../amd/display/dc/dccg/dcn35/dcn35_dccg.c | 1 + .../amd/display/dc/dccg/dcn401/dcn401_dccg.c | 1 + .../amd/display/dc/dccg/dcn42/dcn42_dccg.c | 1 + .../amd/display/dc/dccg/dcn60/dcn60_dccg.c | 1 + .../drm/amd/display/dc/dce/dce_clock_source.c | 6 +- .../gpu/drm/amd/display/dc/dce/dmub_replay.c | 25 + .../gpu/drm/amd/display/dc/dce/dmub_replay.h | 2 + .../dml21/inc/bounding_boxes/dcn42b_soc_bb.h | 2 +- .../src/dml2_core/dml2_core_dcn4_calcs.c | 4 + .../dml21/src/dml2_pmo/dml2_pmo_dcn4_fams2.c | 11 +- .../dml2_0/dml21/src/dml2_top/dml2_top_utm.c | 2 +- .../dml21_wrapper/dml21_translation_helper.c | 1 + .../amd/display/dc/dpp/dcn30/dcn30_dpp_cm.c | 2 + .../drm/amd/display/dc/dpp/dcn50/dcn50_dpp.c | 20 +- .../drm/amd/display/dc/dpp/dcn50/dcn50_dpp.h | 3 +- .../hpo/dcn30/dcn30_hpo_frl_stream_encoder.c | 6 +- .../hpo/dcn42/dcn42_hpo_frl_stream_encoder.c | 9 +- .../hpo/dcn60/dcn60_hpo_frl_stream_encoder.c | 9 +- .../display/dc/hubbub/dcn31/dcn31_hubbub.c | 5 - .../display/dc/hubbub/dcn35/dcn35_hubbub.c | 7 +- .../display/dc/hubbub/dcn42/dcn42_hubbub.c | 13 +- .../display/dc/hubbub/dcn60/dcn60_hubbub.c | 44 +- .../amd/display/dc/hubp/dcn10/dcn10_hubp.c | 4 +- .../amd/display/dc/hubp/dcn10/dcn10_hubp.h | 3 +- .../amd/display/dc/hubp/dcn20/dcn20_hubp.c | 5 +- .../amd/display/dc/hubp/dcn20/dcn20_hubp.h | 3 +- .../amd/display/dc/hubp/dcn21/dcn21_hubp.c | 5 +- .../amd/display/dc/hubp/dcn30/dcn30_hubp.c | 5 +- .../amd/display/dc/hubp/dcn30/dcn30_hubp.h | 3 +- .../amd/display/dc/hubp/dcn401/dcn401_hubp.c | 9 +- .../amd/display/dc/hubp/dcn401/dcn401_hubp.h | 3 +- .../amd/display/dc/hubp/dcn42/dcn42_hubp.c | 6 +- .../amd/display/dc/hubp/dcn50/dcn50_hubp.c | 28 +- .../amd/display/dc/hubp/dcn50/dcn50_hubp.h | 3 +- .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 108 +- .../amd/display/dc/hwss/dcn10/dcn10_hwseq.h | 2 + .../amd/display/dc/hwss/dcn10/dcn10_init.c | 1 + .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 40 +- .../amd/display/dc/hwss/dcn20/dcn20_hwseq.h | 2 + .../amd/display/dc/hwss/dcn20/dcn20_init.c | 1 + .../amd/display/dc/hwss/dcn201/dcn201_hwseq.c | 27 +- .../amd/display/dc/hwss/dcn201/dcn201_hwseq.h | 2 + .../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_hwseq.c | 43 +- .../amd/display/dc/hwss/dcn32/dcn32_init.c | 1 + .../amd/display/dc/hwss/dcn35/dcn35_hwseq.c | 117 +- .../amd/display/dc/hwss/dcn35/dcn35_hwseq.h | 14 +- .../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 | 39 +- .../amd/display/dc/hwss/dcn401/dcn401_hwseq.h | 5 +- .../amd/display/dc/hwss/dcn401/dcn401_init.c | 1 + .../amd/display/dc/hwss/dcn42/dcn42_hwseq.c | 283 ++- .../amd/display/dc/hwss/dcn42/dcn42_hwseq.h | 17 +- .../amd/display/dc/hwss/dcn42/dcn42_init.c | 6 +- .../amd/display/dc/hwss/dcn50/dcn50_hwseq.c | 10 +- .../amd/display/dc/hwss/dcn60/dcn60_hwseq.c | 194 +- .../amd/display/dc/hwss/dcn60/dcn60_hwseq.h | 5 +- .../amd/display/dc/hwss/dcn60/dcn60_init.c | 8 +- .../drm/amd/display/dc/hwss/hw_sequencer.h | 70 +- .../display/dc/hwss/hw_sequencer_private.h | 4 + .../gpu/drm/amd/display/dc/inc/core_types.h | 4 +- drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h | 1 + drivers/gpu/drm/amd/display/dc/inc/hw/dpp.h | 3 +- drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h | 4 +- drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h | 65 +- drivers/gpu/drm/amd/display/dc/inc/hw/rmcm.h | 140 ++ .../amd/display/dc/inc/hw/timing_generator.h | 1 + .../gpu/drm/amd/display/dc/inc/link_service.h | 2 + drivers/gpu/drm/amd/display/dc/inc/resource.h | 18 +- .../drm/amd/display/dc/link/link_factory.c | 1 + .../link/protocols/link_edp_panel_control.c | 22 + .../link/protocols/link_edp_panel_control.h | 2 + .../drm/amd/display/dc/mpc/dcn10/dcn10_mpc.c | 1 + .../drm/amd/display/dc/mpc/dcn20/dcn20_mpc.c | 1 + .../drm/amd/display/dc/mpc/dcn30/dcn30_mpc.c | 1 + .../drm/amd/display/dc/mpc/dcn32/dcn32_mpc.c | 1 + .../amd/display/dc/mpc/dcn401/dcn401_mpc.c | 1 + .../drm/amd/display/dc/mpc/dcn42/dcn42_mpc.c | 680 +----- .../drm/amd/display/dc/mpc/dcn42/dcn42_mpc.h | 714 +----- .../drm/amd/display/dc/mpc/dcn60/dcn60_mpc.c | 41 +- .../drm/amd/display/dc/mpc/dcn60/dcn60_mpc.h | 238 -- .../amd/display/dc/optc/dcn31/dcn31_optc.c | 10 + .../amd/display/dc/optc/dcn31/dcn31_optc.h | 1 + .../amd/display/dc/optc/dcn314/dcn314_optc.c | 1 + .../amd/display/dc/optc/dcn35/dcn35_optc.c | 1 + .../amd/display/dc/optc/dcn42/dcn42_optc.c | 1 + drivers/gpu/drm/amd/display/dc/os_types.h | 1 + .../amd/display/dc/pg/dcn42/dcn42_pg_cntl.c | 4 + .../dc/resource/dcn42/dcn42_resource.c | 56 +- .../dc/resource/dcn42b/dcn42b_resource.c | 123 +- .../dc/resource/dcn60/dcn60_resource.c | 20 +- drivers/gpu/drm/amd/display/dc/rmcm/Makefile | 44 + .../amd/display/dc/rmcm/dcn42/dcn42_rmcm.c | 867 +++++++ .../amd/display/dc/rmcm/dcn42/dcn42_rmcm.h | 717 ++++++ .../amd/display/dc/rmcm/dcn60/dcn60_rmcm.c | 251 ++ .../amd/display/dc/rmcm/dcn60/dcn60_rmcm.h | 35 + drivers/gpu/drm/amd/display/dmub/dmub_srv.h | 2 +- .../gpu/drm/amd/display/dmub/src/dmub_srv.c | 7 +- .../drm/amd/display/modules/inc/mod_power.h | 3 + .../amd/display/modules/power/power_replay.c | 13 + 148 files changed, 8132 insertions(+), 2808 deletions(-) create mode 100644 drivers/gpu/drm/amd/display/dc/dc_memory_pool.c create mode 100644 drivers/gpu/drm/amd/display/dc/dc_memory_pool.h create mode 100644 drivers/gpu/drm/amd/display/dc/inc/hw/rmcm.h create mode 100644 drivers/gpu/drm/amd/display/dc/rmcm/Makefile create mode 100644 drivers/gpu/drm/amd/display/dc/rmcm/dcn42/dcn42_rmcm.c create mode 100644 drivers/gpu/drm/amd/display/dc/rmcm/dcn42/dcn42_rmcm.h create mode 100644 drivers/gpu/drm/amd/display/dc/rmcm/dcn60/dcn60_rmcm.c create mode 100644 drivers/gpu/drm/amd/display/dc/rmcm/dcn60/dcn60_rmcm.h
--
2.43.0