drm/amd/display: refactor DC interfaces to abstract it better.
Subsystems (5)
cover drm/amd/display: refactor DC interfaces to abstract it better.
I recently was looking into refactoring some things and noticed that "struct dc" leaks outside of dc a lot, and this is a large messy struct and if say someone wanted to use bindgen anywhere near this code it would be a nightmare.
Then I thought, struct dc isn't meant to be like this, so I spent some time with an LLM refactoring it so that it's hidden again.
This series does that, it starts by dropping some dead code, adding some DC accessors, using them in various places.
It then moves dc.h and then a hacky patch to stop dc includes from leaking out again.
Then it does it all again for some other dc structs that are private.
Some things are a bit messy, especially the ABM calculations, and things in modules not being quite separated enough, but I've tried to keep the solutions sane.
Dave.
---
Dave Airlie (19):
drm/amd/display: Drop the dead vmid module
drm/amd/display: Add DC accessors as the first step to opaque struct dc drm/amd/display: Take struct dc in public DSC compute helpers drm/amd/display/amdgpu_dm: Use DC accessors in audio/color/backlight paths drm/amd/display/amdgpu_dm: Use DC accessors in psr/replay/dmub/hdcp/irq paths drm/amd/display/amdgpu_dm: Use DC accessors in plane/crtc/helpers paths drm/amd/display/amdgpu_dm: Use DC accessors in connector paths drm/amd/display: Use DC accessors in DAL modules drm/amd/display/amdgpu_dm: Use DC accessors in debugfs paths drm/amd/display/amdgpu_dm: Use DC accessors in the DM core paths drm/amd/display/amdgpu_dm: Finish DC accessor migration for non-test code drm/amd/display: Migrate amdgpu_dm KUnit tests off struct dc internals drm/amd/display: Move struct dc out of the public dc.h drm/amd/display: Restrict the dc directory root to DC-internal builds drm/amd/display: Add dc_force_max_dramclk for the DP compliance workaround drm/amd/display: Add DC primitives for ABM hardware programming drm/amd/display: Replace the dc_get_res_pool accessor with purpose APIs drm/amd/display: Replace dc_get_config with per-option config reads drm/amd/display: Replace dc_get_caps with purpose-built capability queries
drivers/gpu/drm/amd/amdgpu/Makefile | 1 -
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 172 ++++----
.../drm/amd/display/amdgpu_dm/amdgpu_dm_audio.c | 8 +-
.../amd/display/amdgpu_dm/amdgpu_dm_backlight.c | 12 +-
.../drm/amd/display/amdgpu_dm/amdgpu_dm_color.c | 40 +-
.../drm/amd/display/amdgpu_dm/amdgpu_dm_color.h | 4 +-
.../drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c | 7 +-
.../amd/display/amdgpu_dm/amdgpu_dm_connector.c | 49 +--
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 25 +-
.../drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 132 +++---
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c | 61 +--
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c | 39 +-
.../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 30 +-
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c | 30 +-
.../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 44 +-
.../drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 33 +-
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c | 10 +-
.../drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c | 12 +-
.../drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h | 4 +-
.../gpu/drm/amd/display/amdgpu_dm/tests/Makefile | 1 -
.../display/amdgpu_dm/tests/amdgpu_dm_audio_test.c | 51 +--
.../amdgpu_dm/tests/amdgpu_dm_backlight_test.c | 73 ++--
.../display/amdgpu_dm/tests/amdgpu_dm_color_test.c | 25 +-
.../amdgpu_dm/tests/amdgpu_dm_colorop_test.c | 8 +-
.../amdgpu_dm/tests/amdgpu_dm_connector_test.c | 80 ++--
.../display/amdgpu_dm/tests/amdgpu_dm_crc_test.c | 7 +-
.../display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c | 66 +--
.../display/amdgpu_dm/tests/amdgpu_dm_dmub_test.c | 86 ++--
.../amdgpu_dm/tests/amdgpu_dm_freesync_test.c | 7 +-
.../display/amdgpu_dm/tests/amdgpu_dm_hdcp_test.c | 23 +-
.../amdgpu_dm/tests/amdgpu_dm_helpers_test.c | 74 ++--
.../display/amdgpu_dm/tests/amdgpu_dm_irq_test.c | 201 +++++-----
.../display/amdgpu_dm/tests/amdgpu_dm_ism_test.c | 31 +-
.../amdgpu_dm/tests/amdgpu_dm_kunit_helpers.c | 39 +-
.../amdgpu_dm/tests/amdgpu_dm_kunit_test_helpers.h | 3 +
.../amdgpu_dm/tests/amdgpu_dm_mst_types_test.c | 90 +++--
.../display/amdgpu_dm/tests/amdgpu_dm_plane_test.c | 75 ++--
.../display/amdgpu_dm/tests/amdgpu_dm_psr_test.c | 21 +-
.../amd/display/amdgpu_dm/tests/amdgpu_dm_test.c | 55 ++-
.../display/amdgpu_dm/tests/amdgpu_dm_wb_test.c | 6 +-
drivers/gpu/drm/amd/display/dc/Makefile | 16 +
drivers/gpu/drm/amd/display/dc/basics/dce_calcs.c | 1 +
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 1 +
.../gpu/drm/amd/display/dc/bios/command_table2.c | 1 +
.../drm/amd/display/dc/bls_builder/bls_builder.c | 1 +
.../dc/bls_builder/bls_builder_legacy_init.h | 2 +-
.../display/dc/bls_builder/dcn401_init_builder.c | 1 +
.../dc/bls_builder/dcn401_init_builder_legacy.c | 1 +
.../drm/amd/display/dc/bls_executor/bls_executor.c | 1 +
drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c | 1 +
.../amd/display/dc/clk_mgr/dce100/dce_clk_mgr.c | 1 +
.../amd/display/dc/clk_mgr/dce110/dce110_clk_mgr.c | 1 +
.../amd/display/dc/clk_mgr/dce112/dce112_clk_mgr.c | 1 +
.../amd/display/dc/clk_mgr/dce120/dce120_clk_mgr.c | 1 +
.../amd/display/dc/clk_mgr/dcn10/dcn10_clk_mgr.c | 1 +
.../drm/amd/display/dc/clk_mgr/dcn10/rv1_clk_mgr.c | 1 +
.../dc/clk_mgr/dcn10/rv1_clk_mgr_vbios_smu.c | 1 +
.../amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c | 1 +
.../amd/display/dc/clk_mgr/dcn201/dcn201_clk_mgr.c | 1 +
.../drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c | 1 +
.../dc/clk_mgr/dcn21/rn_clk_mgr_vbios_smu.c | 1 +
.../amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c | 1 +
.../drm/amd/display/dc/clk_mgr/dcn301/vg_clk_mgr.c | 1 +
.../amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c | 1 +
.../drm/amd/display/dc/clk_mgr/dcn31/dcn31_smu.c | 1 +
.../amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.c | 1 +
.../drm/amd/display/dc/clk_mgr/dcn314/dcn314_smu.c | 1 +
.../amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c | 1 +
.../drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.c | 1 +
.../amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.c | 1 +
.../drm/amd/display/dc/clk_mgr/dcn316/dcn316_smu.c | 1 +
.../amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c | 1 +
.../amd/display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c | 1 +
.../drm/amd/display/dc/clk_mgr/dcn35/dcn35_smu.c | 1 +
.../amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c | 1 +
.../amd/display/dc/clk_mgr/dcn42/dcn42_clk_mgr.c | 1 +
.../drm/amd/display/dc/clk_mgr/dcn42/dcn42_smu.c | 1 +
.../amd/display/dc/clk_mgr/dcn42b/dcn42b_clk_mgr.c | 1 +
.../amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c | 1 +
drivers/gpu/drm/amd/display/dc/core/dc.c | 23 ++
drivers/gpu/drm/amd/display/dc/core/dc_abm.c | 132 ++++++
drivers/gpu/drm/amd/display/dc/core/dc_accessors.c | 313 +++++++++++++++
drivers/gpu/drm/amd/display/dc/core/dc_debug.c | 1 +
.../gpu/drm/amd/display/dc/core/dc_hw_sequencer.c | 1 +
.../gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c | 1 +
.../gpu/drm/amd/display/dc/core/dc_link_exports.c | 86 ++++
drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 11 +
drivers/gpu/drm/amd/display/dc/core/dc_stat.c | 3 +-
drivers/gpu/drm/amd/display/dc/core/dc_state.c | 1 +
drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 1 +
drivers/gpu/drm/amd/display/dc/core/dc_surface.c | 1 +
drivers/gpu/drm/amd/display/dc/core/dc_test.c | 155 +++++++
drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c | 1 +
drivers/gpu/drm/amd/display/dc/core2/dc_core2.h | 2 +-
.../drm/amd/display/dc/dc_api_dispatch/api_shim.c | 2 +-
.../drm/amd/display/dc/dc_api_dispatch/api_shim.h | 3 +-
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 1 +
drivers/gpu/drm/amd/display/dc/dc_priv.h | 186 +++++++++
drivers/gpu/drm/amd/display/dc/dc_spl_translate.c | 1 +
.../gpu/drm/amd/display/dc/dccg/dcn31/dcn31_dccg.c | 1 +
.../drm/amd/display/dc/dccg/dcn314/dcn314_dccg.c | 1 +
.../gpu/drm/amd/display/dc/dccg/dcn35/dcn35_dccg.c | 1 +
.../drm/amd/display/dc/dccg/dcn401/dcn401_dccg.c | 1 +
.../gpu/drm/amd/display/dc/dccg/dcn42/dcn42_dccg.c | 1 +
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c | 1 +
drivers/gpu/drm/amd/display/dc/dce/dce_aux.h | 2 +-
.../gpu/drm/amd/display/dc/dce/dce_clock_source.c | 1 +
drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c | 1 +
drivers/gpu/drm/amd/display/dc/dce/dce_i2c.c | 1 +
drivers/gpu/drm/amd/display/dc/dce/dce_i2c.h | 2 +-
drivers/gpu/drm/amd/display/dc/dce/dce_i2c_hw.c | 1 +
.../gpu/drm/amd/display/dc/dce/dce_link_encoder.c | 1 +
drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c | 1 +
drivers/gpu/drm/amd/display/dc/dce/dce_transform.c | 1 +
drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c | 1 +
drivers/gpu/drm/amd/display/dc/dce/dmub_abm_cacp.c | 1 +
drivers/gpu/drm/amd/display/dc/dce/dmub_abm_lcd.c | 1 +
.../gpu/drm/amd/display/dc/dce/dmub_hw_lock_mgr.c | 1 +
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c | 1 +
drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c | 1 +
.../drm/amd/display/dc/dce110/dce110_mem_input_v.c | 3 +-
.../drm/amd/display/dc/dce110/dce110_transform_v.c | 1 +
.../display/dc/dcn10/dcn10_hw_sequencer_debug.c | 1 +
.../amd/display/dc/dcn201/dcn201_link_encoder.c | 1 +
.../drm/amd/display/dc/dcn21/dcn21_link_encoder.c | 1 +
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_afmt.c | 3 +-
.../drm/amd/display/dc/dcn31/dcn31_panel_cntl.c | 1 +
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_vpg.c | 3 +-
.../amd/display/dc/dio/dcn10/dcn10_link_encoder.c | 1 +
.../display/dc/dio/dcn10/dcn10_stream_encoder.c | 1 +
.../amd/display/dc/dio/dcn20/dcn20_link_encoder.c | 1 +
.../display/dc/dio/dcn20/dcn20_stream_encoder.c | 1 +
.../display/dc/dio/dcn30/dcn30_dio_link_encoder.c | 1 +
.../dc/dio/dcn30/dcn30_dio_stream_encoder.c | 1 +
.../dc/dio/dcn301/dcn301_dio_link_encoder.c | 1 +
.../display/dc/dio/dcn31/dcn31_dio_link_encoder.c | 1 +
.../dc/dio/dcn314/dcn314_dio_stream_encoder.c | 1 +
.../display/dc/dio/dcn32/dcn32_dio_link_encoder.c | 1 +
.../dc/dio/dcn32/dcn32_dio_stream_encoder.c | 1 +
.../dc/dio/dcn321/dcn321_dio_link_encoder.c | 1 +
.../display/dc/dio/dcn35/dcn35_dio_link_encoder.c | 1 +
.../dc/dio/dcn35/dcn35_dio_stream_encoder.c | 1 +
.../dc/dio/dcn401/dcn401_dio_link_encoder.c | 1 +
.../dc/dio/dcn401/dcn401_dio_stream_encoder.c | 1 +
.../display/dc/dio/dcn42/dcn42_dio_link_encoder.c | 1 +
.../dc/dio/dcn42/dcn42_dio_stream_encoder.c | 1 +
.../display/dc/dio/dcn60/dcn60_dio_link_encoder.c | 1 +
.../dc/dio/dcn60/dcn60_dio_stream_encoder.c | 1 +
.../gpu/drm/amd/display/dc/dml/calcs/dcn_calcs.c | 1 +
.../gpu/drm/amd/display/dc/dml/dcn10/dcn10_fpu.c | 1 +
.../gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c | 1 +
.../gpu/drm/amd/display/dc/dml/dcn30/dcn30_fpu.c | 1 +
.../gpu/drm/amd/display/dc/dml/dcn301/dcn301_fpu.c | 1 +
.../gpu/drm/amd/display/dc/dml/dcn302/dcn302_fpu.c | 1 +
.../gpu/drm/amd/display/dc/dml/dcn303/dcn303_fpu.c | 1 +
.../gpu/drm/amd/display/dc/dml/dcn31/dcn31_fpu.c | 1 +
.../gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c | 1 +
.../gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c | 1 +
.../gpu/drm/amd/display/dc/dml/dcn321/dcn321_fpu.c | 1 +
.../gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.c | 1 +
.../gpu/drm/amd/display/dc/dml/dcn351/dcn351_fpu.c | 1 +
.../dml21_wrapper/dml21_translation_helper.c | 1 +
.../dc/dml2_wrapper/dml21_wrapper/dml21_utils.c | 1 +
.../dml2_wrapper/dml21_wrapper/dml21_wrapper_fpu.c | 1 +
.../dc/dml2_wrapper/dml2_dc_resource_mgmt.c | 1 +
.../display/dc/dml2_wrapper/dml2_mall_phantom.c | 1 +
.../dc/dml2_wrapper/dml2_translation_helper.c | 1 +
.../drm/amd/display/dc/dml2_wrapper/dml2_utils.c | 1 +
.../drm/amd/display/dc/dml2_wrapper/dml2_wrapper.c | 1 +
.../amd/display/dc/dml2_wrapper/dml2_wrapper_fpu.c | 1 +
.../gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp.c | 1 +
.../drm/amd/display/dc/dpp/dcn10/dcn10_dpp_dscl.c | 1 +
.../drm/amd/display/dc/dpp/dcn20/dcn20_dpp_cm.c | 1 +
.../gpu/drm/amd/display/dc/dpp/dcn201/dcn201_dpp.c | 1 +
.../gpu/drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c | 1 +
.../drm/amd/display/dc/dpp/dcn30/dcn30_dpp_cm.c | 1 +
.../amd/display/dc/dpp/dcn401/dcn401_dpp_dscl.c | 1 +
.../drm/amd/display/dc/dpp/dcn60/dcn60_dpp_cm.c | 1 +
.../drm/amd/display/dc/dpp/dcn60/dcn60_dpp_dscl.c | 1 +
drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c | 18 +-
drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c | 1 +
.../dc/hpo/dcn30/dcn30_hpo_frl_link_encoder.c | 1 +
.../drm/amd/display/dc/hubbub/dcn10/dcn10_hubbub.c | 1 +
.../drm/amd/display/dc/hubbub/dcn20/dcn20_hubbub.c | 1 +
.../amd/display/dc/hubbub/dcn201/dcn201_hubbub.c | 1 +
.../drm/amd/display/dc/hubbub/dcn21/dcn21_hubbub.c | 1 +
.../drm/amd/display/dc/hubbub/dcn30/dcn30_hubbub.c | 1 +
.../drm/amd/display/dc/hubbub/dcn31/dcn31_hubbub.c | 1 +
.../drm/amd/display/dc/hubbub/dcn32/dcn32_hubbub.c | 1 +
.../drm/amd/display/dc/hubbub/dcn35/dcn35_hubbub.c | 1 +
.../amd/display/dc/hubbub/dcn401/dcn401_hubbub.c | 1 +
.../drm/amd/display/dc/hubbub/dcn42/dcn42_hubbub.c | 1 +
.../drm/amd/display/dc/hubbub/dcn60/dcn60_hubbub.c | 1 +
.../gpu/drm/amd/display/dc/hubp/dcn21/dcn21_hubp.c | 1 +
.../gpu/drm/amd/display/dc/hubp/dcn35/dcn35_hubp.c | 1 +
.../gpu/drm/amd/display/dc/hubp/dcn42/dcn42_hubp.c | 1 +
.../gpu/drm/amd/display/dc/hwss/dce/dce_hwseq.c | 1 +
.../drm/amd/display/dc/hwss/dce100/dce100_hwseq.c | 1 +
.../drm/amd/display/dc/hwss/dce110/dce110_hwseq.c | 1 +
.../drm/amd/display/dc/hwss/dce112/dce112_hwseq.c | 1 +
.../drm/amd/display/dc/hwss/dce120/dce120_hwseq.c | 1 +
.../drm/amd/display/dc/hwss/dce60/dce60_hwseq.c | 1 +
.../drm/amd/display/dc/hwss/dce80/dce80_hwseq.c | 1 +
.../drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 1 +
.../gpu/drm/amd/display/dc/hwss/dcn10/dcn10_init.c | 3 +-
.../drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 3 +-
.../gpu/drm/amd/display/dc/hwss/dcn20/dcn20_init.c | 1 +
.../drm/amd/display/dc/hwss/dcn201/dcn201_hwseq.c | 1 +
.../drm/amd/display/dc/hwss/dcn201/dcn201_init.c | 1 +
.../drm/amd/display/dc/hwss/dcn21/dcn21_hwseq.c | 1 +
.../gpu/drm/amd/display/dc/hwss/dcn21/dcn21_init.c | 1 +
.../drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c | 1 +
.../gpu/drm/amd/display/dc/hwss/dcn30/dcn30_init.c | 1 +
.../drm/amd/display/dc/hwss/dcn301/dcn301_init.c | 1 +
.../drm/amd/display/dc/hwss/dcn302/dcn302_hwseq.c | 1 +
.../drm/amd/display/dc/hwss/dcn302/dcn302_init.c | 1 +
.../drm/amd/display/dc/hwss/dcn303/dcn303_init.c | 1 +
.../drm/amd/display/dc/hwss/dcn31/dcn31_hwseq.c | 3 +-
.../gpu/drm/amd/display/dc/hwss/dcn31/dcn31_init.c | 1 +
.../drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.c | 3 +-
.../drm/amd/display/dc/hwss/dcn314/dcn314_init.c | 1 +
.../drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c | 1 +
.../gpu/drm/amd/display/dc/hwss/dcn32/dcn32_init.c | 1 +
.../drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c | 3 +-
.../drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.h | 2 +-
.../gpu/drm/amd/display/dc/hwss/dcn35/dcn35_init.c | 1 +
.../drm/amd/display/dc/hwss/dcn351/dcn351_hwseq.c | 1 +
.../drm/amd/display/dc/hwss/dcn351/dcn351_init.c | 1 +
.../drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 1 +
.../drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.h | 2 +-
.../drm/amd/display/dc/hwss/dcn401/dcn401_init.c | 1 +
.../drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.c | 1 +
.../gpu/drm/amd/display/dc/hwss/dcn42/dcn42_init.c | 1 +
.../drm/amd/display/dc/hwss/dcn42b/dcn42b_hwseq.c | 1 +
.../drm/amd/display/dc/hwss/dcn42b/dcn42b_init.c | 1 +
.../drm/amd/display/dc/hwss/dcn50/dcn50_hwseq.c | 1 +
.../drm/amd/display/dc/hwss/dcn50/dcn50_hwseq.h | 2 +-
.../drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.c | 1 +
.../drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.h | 2 +-
.../gpu/drm/amd/display/dc/hwss/dcn60/dcn60_init.c | 1 +
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h | 16 +-
drivers/gpu/drm/amd/display/dc/inc/core_types.h | 8 +-
drivers/gpu/drm/amd/display/dc/{ => inc}/dc.h | 446 ++++++++++++++-------
.../drm/amd/display/dc/{ => inc}/dc_bios_types.h | 0
.../drm/amd/display/dc/{ => inc}/dc_ddc_types.h | 0
.../gpu/drm/amd/display/dc/{ => inc}/dc_dmub_srv.h | 0
.../gpu/drm/amd/display/dc/{ => inc}/dc_dp_types.h | 0
drivers/gpu/drm/amd/display/dc/{ => inc}/dc_dsc.h | 4 +-
.../gpu/drm/amd/display/dc/{ => inc}/dc_fused_io.h | 0
.../drm/amd/display/dc/{ => inc}/dc_hdmi_types.h | 0
.../gpu/drm/amd/display/dc/{ => inc}/dc_hw_types.h | 0
.../drm/amd/display/dc/{ => inc}/dc_memory_pool.h | 0
.../gpu/drm/amd/display/dc/{ => inc}/dc_plane.h | 0
.../gpu/drm/amd/display/dc/{ => inc}/dc_probe.h | 0
drivers/gpu/drm/amd/display/dc/{ => inc}/dc_stat.h | 0
.../gpu/drm/amd/display/dc/{ => inc}/dc_state.h | 2 +-
.../gpu/drm/amd/display/dc/{ => inc}/dc_stream.h | 0
drivers/gpu/drm/amd/display/dc/inc/dc_test.h | 85 ++++
.../gpu/drm/amd/display/dc/{ => inc}/dc_trace.h | 0
.../gpu/drm/amd/display/dc/{ => inc}/dc_types.h | 0
drivers/gpu/drm/amd/display/dc/inc/dcn_calcs.h | 2 +-
.../gpu/drm/amd/display/dc/{ => inc}/dm_cp_psp.h | 0
.../gpu/drm/amd/display/dc/{ => inc}/dm_helpers.h | 0
.../gpu/drm/amd/display/dc/{ => inc}/dm_pp_smu.h | 0
.../gpu/drm/amd/display/dc/{ => inc}/dm_services.h | 16 +
.../amd/display/dc/{ => inc}/dm_services_types.h | 0
drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h | 2 +-
drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h | 4 +-
drivers/gpu/drm/amd/display/dc/inc/hw/mcif_wb.h | 2 +-
drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h | 4 +-
drivers/gpu/drm/amd/display/dc/inc/hw/transform.h | 2 +-
.../gpu/drm/amd/display/dc/{ => inc}/irq_types.h | 0
.../gpu/drm/amd/display/dc/{ => inc}/os_types.h | 0
.../amd/display/dc/irq/dce110/irq_service_dce110.c | 1 +
.../amd/display/dc/link/accessories/link_dp_cts.c | 1 +
.../display/dc/link/accessories/link_dp_trace.c | 1 +
.../drm/amd/display/dc/link/hwss/link_hwss_dio.c | 1 +
.../link/hwss/link_hwss_dio_fixed_vs_pe_retimer.c | 1 +
.../drm/amd/display/dc/link/hwss/link_hwss_dpia.c | 1 +
.../amd/display/dc/link/hwss/link_hwss_hpo_dp.c | 1 +
.../hwss/link_hwss_hpo_fixed_vs_pe_retimer_dp.c | 1 +
.../amd/display/dc/link/hwss/link_hwss_hpo_frl.c | 1 +
.../gpu/drm/amd/display/dc/link/link_detection.c | 1 +
drivers/gpu/drm/amd/display/dc/link/link_dpms.c | 1 +
drivers/gpu/drm/amd/display/dc/link/link_factory.c | 1 +
.../gpu/drm/amd/display/dc/link/link_resource.c | 1 +
.../gpu/drm/amd/display/dc/link/link_validation.c | 1 +
.../drm/amd/display/dc/link/protocols/link_ddc.c | 1 +
.../display/dc/link/protocols/link_dp_capability.c | 1 +
.../amd/display/dc/link/protocols/link_dp_dpia.c | 2 +-
.../display/dc/link/protocols/link_dp_dpia_bw.c | 1 +
.../dc/link/protocols/link_dp_irq_handler.c | 1 +
.../dc/link/protocols/link_dp_panel_replay.c | 3 +-
.../amd/display/dc/link/protocols/link_dp_phy.c | 1 +
.../display/dc/link/protocols/link_dp_training.c | 1 +
.../dc/link/protocols/link_dp_training_128b_132b.c | 1 +
.../dc/link/protocols/link_dp_training_8b_10b.c | 1 +
.../dc/link/protocols/link_dp_training_dpia.c | 3 +-
.../link_dp_training_fixed_vs_pe_retimer.c | 1 +
.../dc/link/protocols/link_edp_panel_control.c | 3 +-
.../amd/display/dc/link/protocols/link_hdmi_frl.c | 1 +
.../gpu/drm/amd/display/dc/mpc/dcn20/dcn20_mpc.c | 1 +
.../gpu/drm/amd/display/dc/mpc/dcn30/dcn30_mpc.c | 1 +
.../gpu/drm/amd/display/dc/mpc/dcn32/dcn32_mpc.c | 1 +
.../gpu/drm/amd/display/dc/mpc/dcn401/dcn401_mpc.c | 1 +
.../gpu/drm/amd/display/dc/mpc/dcn60/dcn60_mpc.c | 1 +
.../gpu/drm/amd/display/dc/opp/dcn10/dcn10_opp.c | 1 +
.../gpu/drm/amd/display/dc/opp/dcn20/dcn20_opp.c | 1 +
.../gpu/drm/amd/display/dc/optc/dcn30/dcn30_optc.c | 1 +
.../gpu/drm/amd/display/dc/optc/dcn32/dcn32_optc.c | 1 +
.../gpu/drm/amd/display/dc/optc/dcn35/dcn35_optc.c | 1 +
.../drm/amd/display/dc/optc/dcn401/dcn401_optc.c | 1 +
.../gpu/drm/amd/display/dc/optc/dcn42/dcn42_optc.c | 1 +
.../drm/amd/display/dc/pg/dcn35/dcn35_pg_cntl.c | 1 +
.../drm/amd/display/dc/pg/dcn42/dcn42_pg_cntl.c | 1 +
.../display/dc/resource/dce100/dce100_resource.c | 1 +
.../display/dc/resource/dce110/dce110_resource.c | 1 +
.../display/dc/resource/dce112/dce112_resource.c | 1 +
.../display/dc/resource/dce120/dce120_resource.c | 1 +
.../amd/display/dc/resource/dce60/dce60_resource.c | 1 +
.../amd/display/dc/resource/dce80/dce80_resource.c | 1 +
.../amd/display/dc/resource/dcn10/dcn10_resource.c | 1 +
.../amd/display/dc/resource/dcn20/dcn20_resource.c | 1 +
.../display/dc/resource/dcn201/dcn201_resource.c | 1 +
.../amd/display/dc/resource/dcn21/dcn21_resource.c | 1 +
.../amd/display/dc/resource/dcn30/dcn30_resource.c | 1 +
.../display/dc/resource/dcn301/dcn301_resource.c | 1 +
.../display/dc/resource/dcn302/dcn302_resource.c | 1 +
.../display/dc/resource/dcn303/dcn303_resource.c | 1 +
.../amd/display/dc/resource/dcn31/dcn31_resource.c | 1 +
.../display/dc/resource/dcn314/dcn314_resource.c | 1 +
.../display/dc/resource/dcn315/dcn315_resource.c | 1 +
.../display/dc/resource/dcn316/dcn316_resource.c | 1 +
.../amd/display/dc/resource/dcn32/dcn32_resource.c | 1 +
.../dc/resource/dcn32/dcn32_resource_helpers.c | 1 +
.../display/dc/resource/dcn321/dcn321_resource.c | 1 +
.../amd/display/dc/resource/dcn35/dcn35_resource.c | 1 +
.../display/dc/resource/dcn351/dcn351_resource.c | 1 +
.../amd/display/dc/resource/dcn36/dcn36_resource.c | 1 +
.../display/dc/resource/dcn401/dcn401_resource.c | 1 +
.../amd/display/dc/resource/dcn42/dcn42_resource.c | 1 +
.../display/dc/resource/dcn42/dcn42_resource_fpu.c | 1 +
.../display/dc/resource/dcn42b/dcn42b_resource.c | 1 +
.../amd/display/dc/resource/dcn60/dcn60_resource.c | 1 +
.../gpu/drm/amd/display/dc/rmcm/dcn42/dcn42_rmcm.c | 1 +
.../gpu/drm/amd/display/dc/rmcm/dcn60/dcn60_rmcm.c | 1 +
.../dcn401/dcn401_soc_and_ip_translator.c | 1 +
.../dcn42/dcn42_soc_and_ip_translator.c | 1 +
.../dcn60/dcn60_soc_and_ip_translator.c | 1 +
drivers/gpu/drm/amd/display/dmub/dmub_srv.h | 2 +-
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn32.c | 2 +-
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn35.c | 2 +-
.../gpu/drm/amd/display/include/logger_interface.h | 13 +-
.../drm/amd/display/modules/color/color_gamma.c | 2 +-
.../drm/amd/display/modules/color/color_gamma.h | 2 +-
.../drm/amd/display/modules/freesync/freesync.c | 14 +-
.../gpu/drm/amd/display/modules/inc/mod_freesync.h | 2 +
.../gpu/drm/amd/display/modules/inc/mod_stats.h | 75 ----
drivers/gpu/drm/amd/display/modules/inc/mod_vmid.h | 46 ---
drivers/gpu/drm/amd/display/modules/power/power.c | 6 +-
.../gpu/drm/amd/display/modules/power/power_abm.c | 168 +++-----
.../drm/amd/display/modules/power/power_helpers.h | 17 +-
.../gpu/drm/amd/display/modules/power/power_psr.c | 12 +-
.../drm/amd/display/modules/power/power_replay.c | 27 +-
drivers/gpu/drm/amd/display/modules/vmid/vmid.c | 178 --------
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h | 2 +-
366 files changed, 2633 insertions(+), 1508 deletions(-)---
base-commit: a6836fcbb5b22968019256025321d655b78bc49c
change-id: 20261112-amdgpu-dc-cleanup-bc5be9190d11
Best regards,
Signature · 1 line
Dave Airlie <[email protected]>
PATCH 1/19 drm/amd/display: Drop the dead vmid module
modules/vmid, mod_vmid.h and mod_stats.h are not referenced by any Makefile; remove the dead code.
--- .../gpu/drm/amd/display/modules/inc/mod_stats.h | 75 --------- drivers/gpu/drm/amd/display/modules/inc/mod_vmid.h | 46 ------ drivers/gpu/drm/amd/display/modules/vmid/vmid.c | 178 --------------------- 3 files changed, 299 deletions(-)
drivers/gpu/drm/amd/display/modules/inc/mod_stats.h deleted +0 -75
@@ -1,75 +0,0 @@ -/* -* Copyright 2016 Advanced Micro Devices, Inc. -* -* 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 -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR -* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -* OTHER DEALINGS IN THE SOFTWARE. -* -* Authors: AMD -* -*/ - -#ifndef MODULES_INC_MOD_STATS_H_ -#define MODULES_INC_MOD_STATS_H_ - -#include "dm_services.h" - -struct mod_stats { -int dummy; -}; - -struct mod_stats_caps { -bool dummy; -}; - -struct mod_stats_init_params { -unsigned int stats_enable; -unsigned int stats_entries; -}; - -struct mod_stats *mod_stats_create (struct dc *dc, -struct mod_stats_init_params *init_params); - -void mod_stats_destroy (struct mod_stats *mod_stats); - -bool mod_stats_init (struct mod_stats *mod_stats); - -void mod_stats_dump (struct mod_stats *mod_stats); - -void mod_stats_reset_data (struct mod_stats *mod_stats); - -void mod_stats_update_event (struct mod_stats *mod_stats, -const char *event_string, -unsigned int length); - -void mod_stats_update_flip (struct mod_stats *mod_stats, -unsigned long long timestamp_in_ns); - -void mod_stats_update_vupdate (struct mod_stats *mod_stats, -unsigned long long timestamp_in_ns); - -void mod_stats_update_freesync (struct mod_stats *mod_stats, -unsigned int v_total_min, -unsigned int v_total_max, -unsigned int event_triggers, -unsigned int window_min, -unsigned int window_max, -unsigned int lfc_mid_point_in_us, -unsigned int inserted_frames, -unsigned int inserted_frame_duration_in_us); - -#endif /* MODULES_INC_MOD_STATS_H_ */
drivers/gpu/drm/amd/display/modules/inc/mod_vmid.h deleted +0 -46
46 lines not on this page · raw message
drivers/gpu/drm/amd/display/modules/vmid/vmid.c deleted +0 -178
178 lines not on this page · raw message
Signature · 1 line
2.56.0
PATCH 2/19 drm/amd/display: Add DC accessors as the first step to opaque struct dc
In reply to Dave Airliestruct dc is defined in dc.h which is included by DM and DAL modules, so any of them can dereference dc members directly. As a first step towards making struct dc private to DC, add an accessor layer:
- Introspection accessors (link count, ctx, caps, config, debug options, current state, idle optimizations, resource pool, clock manager) implemented in a new dc/core/dc_accessors.c which is the single place mapping accessor names onto struct dc fields.
- hwss/cap_funcs wrappers for log_hw_state, get_dcc_en_bits, prepare_ddc, get_dcc_compression_cap and get_subvp_en.
- FBC and DML2 alternate channel configuration helpers.
- link_service wrappers in dc/core/dc_link_exports.c for the entry points that DM and DAL modules reach through dc->link_srv today, violating the link_service.h usage policy.
The accessors are additive; no consumer is migrated yet.
--- drivers/gpu/drm/amd/display/dc/Makefile | 1 + drivers/gpu/drm/amd/display/dc/core/dc_accessors.c | 136 ++++++++++++++++ .../gpu/drm/amd/display/dc/core/dc_link_exports.c | 85 ++++++++++ drivers/gpu/drm/amd/display/dc/dc.h | 174 +++++++++++++++++++++ 4 files changed, 396 insertions(+)
drivers/gpu/drm/amd/display/dc/Makefile +1 -0
@@ -68,6 +68,7 @@ FILES += dc_fused_io.o FILES += dc_helper.o FILES += dc_memory_pool.o FILES += core/dc.o +FILES += core/dc_accessors.o FILES += dc_api_dispatch/api_shim.o FILES += core/dc_debug.o FILES += core/dc_hw_sequencer.o
drivers/gpu/drm/amd/display/dc/core/dc_accessors.c new file +136 -0
136 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/core/dc_link_exports.c +85 -0
91 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dc.h +174 -0
186 lines not on this page · raw message
Signature · 1 line
2.56.0
PATCH 3/19 drm/amd/display: Take struct dc in public DSC compute helpers
In reply to Dave Airliedc_dsc_compute_bandwidth_range() and dc_dsc_compute_config() took a display_stream_compressor pointer that every caller fetched with dc->res_pool->dscs[0]. The implementations immediately derive the dc from dsc->ctx->dc anyway, so take struct dc directly and let DC pick the DSC engine internally.
This removes all res_pool->dscs[0] dereferences from amdgpu_dm and is a step towards not exposing struct dc outside DC.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c | 12 ++++++------ .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 14 +++++++------- drivers/gpu/drm/amd/display/dc/dc_dsc.h | 4 ++-- drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c | 17 +++++++++++++++-- 4 files changed, 30 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c +6 -6
@@ -1229,7 +1229,7 @@ static void apply_dsc_policy_for_edp(struct amdgpu_dm_connector *aconnector,if (edp_max_bpp_x16 < edp_min_bpp_x16) edp_min_bpp_x16 = edp_max_bpp_x16; - if (dc_dsc_compute_bandwidth_range(dc->res_pool->dscs[0], + if (dc_dsc_compute_bandwidth_range(dc, dc->debug.dsc_min_slice_height_override, edp_min_bpp_x16, edp_max_bpp_x16, dsc_caps,
@@ -1238,7 +1238,7 @@ static void apply_dsc_policy_for_edp(struct amdgpu_dm_connector *aconnector, &bw_range)) {if (bw_range.max_kbps < link_bw_in_kbps) { - if (dc_dsc_compute_config(dc->res_pool->dscs[0], + if (dc_dsc_compute_config(dc, dsc_caps, &dsc_options, 0,
@@ -1253,7 +1253,7 @@ static void apply_dsc_policy_for_edp(struct amdgpu_dm_connector *aconnector, } } - if (dc_dsc_compute_config(dc->res_pool->dscs[0], + if (dc_dsc_compute_config(dc, dsc_caps, &dsc_options, link_bw_in_kbps,
@@ -1309,7 +1309,7 @@ static void apply_dsc_policy_for_stream(struct amdgpu_dm_connector *aconnector, }else if (sink->sink_signal ==SIGNAL_TYPE_DISPLAY_PORT ) {if (sink->link->dpcd_caps.dongle_type ==DISPLAY_DONGLE_NONE ) { - if (dc_dsc_compute_config(aconnector->dc_link->ctx->dc->res_pool->dscs[0], + if (dc_dsc_compute_config(dc, dsc_caps, &dsc_options, link_bandwidth_kbps,
@@ -1339,7 +1339,7 @@ static void apply_dsc_policy_for_stream(struct amdgpu_dm_connector *aconnector,if (timing_bw_in_kbps > max_supported_bw_in_kbps && max_supported_bw_in_kbps >0 && dsc_max_supported_bw_in_kbps >0 ) - if (dc_dsc_compute_config(aconnector->dc_link->ctx->dc->res_pool->dscs[0], + if (dc_dsc_compute_config(dc, dsc_caps, &dsc_options, dsc_max_supported_bw_in_kbps,
@@ -1368,7 +1368,7 @@ static void apply_dsc_policy_for_stream(struct amdgpu_dm_connector *aconnector,if ((timing_bw_in_kbps > link_bandwidth_kbps && dsc_sink_bw_in_kbps >0 ) || (dsc_policy.enable_dsc_when_not_needed || dsc_options.force_dsc_when_not_needed)) { - if (dc_dsc_compute_config(aconnector->dc_link->ctx->dc->res_pool->dscs[0], + if (dc_dsc_compute_config(dc, dsc_caps, &dsc_options, dsc_sink_bw_in_kbps,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +7 -7
@@ -980,7 +980,7 @@ static void set_dsc_configs_from_fairness_vars(struct dsc_mst_fairness_params *pmemset (¶ms[i].timing->dsc_cfg,0 ,sizeof (params[i].timing->dsc_cfg)); if (vars[i + k].dsc_enabled && dc_dsc_compute_config( - params[i].sink->ctx->dc->res_pool->dscs[0], + params[i].sink->ctx->dc, ¶ms[i].sink->dsc_caps.dsc_dec_caps, &dsc_options, 0,
@@ -1033,7 +1033,7 @@ static int bpp_x16_from_pbn(struct dsc_mst_fairness_params param, int pbn) kbps =div_u64 ((u64 )pbn *994 *8 *54 ,64 ); dc_dsc_compute_config( - param.sink->ctx->dc->res_pool->dscs[0], + param.sink->ctx->dc, ¶m.sink->dsc_caps.dsc_dec_caps, &dsc_options, (int) kbps, param.timing,
@@ -1278,7 +1278,7 @@ static void build_frl_mst_dsc_params(struct amdgpu_dm_connector *aconnector, stream->sink->edid_caps.panel_patch.max_dsc_target_bpp_limit *16 ; if (dc_dsc_compute_config( - stream->sink->ctx->dc->res_pool->dscs[0], + stream->sink->ctx->dc, &stream->sink->dsc_caps.dsc_dec_caps, &dsc_options, frl_conv_dsc_bw_in_kbps,
@@ -1398,7 +1398,7 @@ static int compute_mst_dsc_configs_for_link(struct drm_atomic_commit *state, stream->sink->dsc_caps.dsc_dec_caps.is_frl)build_frl_mst_dsc_params (aconnector, stream, &dsc_policy, ¶ms[count], frl_conv_dsc_bw_in_kbps); if (!dc_dsc_compute_bandwidth_range( - stream->sink->ctx->dc->res_pool->dscs[0], + stream->sink->ctx->dc, stream->sink->ctx->dc->debug.dsc_min_slice_height_override, min_target_bpp_x16, max_target_bpp_x16,
@@ -1651,7 +1651,7 @@ int compute_mst_dsc_configs_for_state(struct drm_atomic_commit *state,for (i =0 ; i < dc_state->stream_count; i++) { stream = dc_state->streams[i]; - res_pool = stream->ctx->dc->res_pool; + res_pool =dc_get_res_pool (stream->ctx->dc);if (stream->signal !=SIGNAL_TYPE_DISPLAY_PORT_MST )continue ;
@@ -1943,7 +1943,7 @@ static bool is_dsc_common_config_possible(struct dc_stream_state *stream,bool is_dsc_possible;dc_dsc_get_policy_for_timing (&stream->timing,0 , &dsc_policy,dc_link_get_highest_encoding_format (stream->link)); - is_dsc_possible = dc_dsc_compute_bandwidth_range(stream->sink->ctx->dc->res_pool->dscs[0], + is_dsc_possible = dc_dsc_compute_bandwidth_range(stream->sink->ctx->dc, stream->sink->ctx->dc->debug.dsc_min_slice_height_override, dsc_policy.min_target_bpp * 16, dsc_policy.max_target_bpp * 16,
@@ -2108,7 +2108,7 @@ enum dc_status dm_dp_mst_is_port_support_mode(/*Confirm if we can obtain dsc config*/ dc_dsc_get_default_config_option (stream->link->dc, &dsc_options); dsc_options.max_target_bpp_limit_override_x16 = aconnector->base.display_info.max_dsc_bpp *16 ; - if (dc_dsc_compute_config(stream->sink->ctx->dc->res_pool->dscs[0], + if (dc_dsc_compute_config(stream->sink->ctx->dc, &stream->sink->dsc_caps.dsc_dec_caps, &dsc_options, end_to_end_bw_in_kbps,
drivers/gpu/drm/amd/display/dc/dc_dsc.h +2 -2
@@ -77,7 +77,7 @@ bool dc_dsc_parse_dsc_edid(const struct dc *dc, struct dsc_dec_dpcd_caps *dsc_sink_caps); bool dc_dsc_compute_bandwidth_range( - const struct display_stream_compressor *dsc, + const struct dc *dc, uint32_t dsc_min_slice_height_override, uint32_t min_bpp_x16, uint32_t max_bpp_x16,
@@ -87,7 +87,7 @@ bool dc_dsc_compute_bandwidth_range( struct dc_dsc_bw_range *range); bool dc_dsc_compute_config( - const struct display_stream_compressor *dsc, + const struct dc *dc, const struct dsc_dec_dpcd_caps *dsc_sink_caps, const struct dc_dsc_config_options *options, uint32_t target_bandwidth_kbps,
drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c +15 -2
@@ -924,7 +924,7 @@ bool dc_dsc_parse_dsc_edid(const struct dc *dc, const struct dc_edid_caps *edid_* If DSC is not possible, leave '*range' untouched. */ bool dc_dsc_compute_bandwidth_range( - const struct display_stream_compressor *dsc, + const struct dc *dc, uint32_t dsc_min_slice_height_override, uint32_t min_bpp_x16, uint32_t max_bpp_x16,
@@ -939,6 +939,12 @@ bool dc_dsc_compute_bandwidth_range(struct dsc_enc_caps dsc_common_caps;struct dc_dsc_config config = {0 };struct dc_dsc_config_options options = {0 }; +const struct display_stream_compressor *dsc; + +if (!dc || !dc->res_pool) +return false; + + dsc = dc->res_pool->dscs[0 ]; options.dsc_min_slice_height_override = dsc_min_slice_height_override; options.max_target_bpp_limit_override_x16 = max_bpp_x16;
@@ -2020,7 +2026,7 @@ static bool setup_dsc_config( } bool dc_dsc_compute_config( - const struct display_stream_compressor *dsc, + const struct dc *dc, const struct dsc_dec_dpcd_caps *dsc_sink_caps, const struct dc_dsc_config_options *options, uint32_t target_bandwidth_kbps,
@@ -2031,6 +2037,13 @@ bool dc_dsc_compute_config(bool is_dsc_possible = false;struct dsc_enc_caps dsc_enc_caps;unsigned int min_dsc_slice_count; +const struct display_stream_compressor *dsc; + +if (!dc || !dc->res_pool) +return false; + + dsc = dc->res_pool->dscs[0 ]; +get_dsc_enc_caps (dsc, &dsc_enc_caps, timing->pix_clk_100hz); min_dsc_slice_count =get_min_dsc_slice_count_for_odm (dsc, &dsc_enc_caps, timing);
Signature · 1 line
2.56.0
PATCH 4/19 drm/amd/display/amdgpu_dm: Use DC accessors in audio/color/backlight paths
In reply to Dave AirlieReplace direct struct dc member dereferences with the DC accessor layer in amdgpu_dm_audio.c, amdgpu_dm_color.c, amdgpu_dm_colorop.c and amdgpu_dm_backlight.c.
Part of making struct dc private to DC.
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_audio.c | 6 +++-- .../amd/display/amdgpu_dm/amdgpu_dm_backlight.c | 6 ++--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_color.c | 28 +++++++++++++--------- .../drm/amd/display/amdgpu_dm/amdgpu_dm_color.h | 4 ++-- .../drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c | 4 ++-- .../drm/amd/display/modules/color/color_gamma.c | 2 +- .../drm/amd/display/modules/color/color_gamma.h | 2 +- 7 files changed, 30 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_audio.c +4 -2
@@ -140,6 +140,7 @@ EXPORT_IF_KUNIT(amdgpu_dm_audio_init_pins);int amdgpu_dm_audio_init (struct amdgpu_device *adev) {unsigned int inst_array[MAX_AUDIOS ]; +struct resource_pool *res_pool;int audio_count;int i, ret;
@@ -148,9 +149,10 @@ int amdgpu_dm_audio_init(struct amdgpu_device *adev) adev->mode_info.audio.enabled = true; - audio_count = adev->dm.dc->res_pool->audio_count; + res_pool =dc_get_res_pool (adev->dm.dc); + audio_count = res_pool->audio_count;for (i =0 ; i < audio_count; i++) - inst_array[i] = adev->dm.dc->res_pool->audios[i]->inst; + inst_array[i] = res_pool->audios[i]->inst;amdgpu_dm_audio_init_pins (adev, audio_count, inst_array); ret =component_add (adev->dev, &amdgpu_dm_audio_component_bind_ops);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c +3 -3
@@ -296,7 +296,7 @@ struct dc_stream_state *dm_find_stream_with_link(struct amdgpu_display_manager *dm, struct dc_link *link) { - struct dc_state *cur_dc_state = dm->dc->current_state; + struct dc_state *cur_dc_state = dc_get_current_state(dm->dc);struct dc_stream_state *stream =NULL ;int i;
@@ -383,7 +383,7 @@ void amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm, }mutex_lock (&dm->dc_lock); -if (dm->dc->caps.ips_support && dm->dc->ctx->dmub_srv->idle_allowed) { +if (dc_get_caps (dm->dc)->ips_support &&dc_get_ctx (dm->dc)->dmub_srv->idle_allowed) {dc_allow_idle_optimizations (dm->dc, false); reallow_idle = true; }
@@ -415,7 +415,7 @@ void amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm,amdgpu_dm_replay_set_event (dm, stream, true, replay_event_hw_programming, true); -if (dm->dc->caps.ips_support && reallow_idle) +if (dc_get_caps (dm->dc)->ips_support && reallow_idle)dc_allow_idle_optimizations (dm->dc, true);mutex_unlock (&dm->dc_lock);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +17 -11
@@ -832,7 +832,7 @@ EXPORT_IF_KUNIT(amdgpu_dm_set_atomic_regamma);* Returns: * 0 in case of success. -ENOMEM if fails. */ -STATIC_IFN_KUNIT int __set_input_tf(struct dc_color_caps *caps, +STATIC_IFN_KUNIT int __set_input_tf(const struct dc_color_caps *caps,struct dc_transfer_func *func,const struct drm_color_lut *lut,uint32_t lut_size) {
@@ -870,7 +870,7 @@ EXPORT_IF_KUNIT(__set_input_tf);* Returns: * 0 in case of success. -ENOMEM if fails. */ -STATIC_IFN_KUNIT int __set_input_tf_32(struct dc_color_caps *caps, +STATIC_IFN_KUNIT int __set_input_tf_32(const struct dc_color_caps *caps,struct dc_transfer_func *func,const struct drm_color_lut32 *lut,uint32_t lut_size) {
@@ -1168,7 +1168,9 @@ int amdgpu_dm_verify_lut3d_size(struct amdgpu_device *adev,struct dm_plane_state *dm_plane_state =to_dm_plane_state (plane_state);const struct drm_color_lut *shaper =NULL , *lut3d =NULL ;uint32_t exp_size, size, dim_size =MAX_COLOR_3DLUT_SIZE ; -bool has_3dlut = adev->dm.dc->caps.color.dpp.hw_3d_lut || adev->dm.dc->caps.color.mpc.preblend; +const struct dc_caps *caps =dc_get_caps (adev->dm.dc); +bool has_3dlut = + caps->color.dpp.hw_3d_lut || caps->color.mpc.preblend;/* shaper LUT is only available if 3D LUT color caps */ exp_size = has_3dlut ?MAX_COLOR_LUT_ENTRIES :0 ;
@@ -1403,7 +1405,7 @@ EXPORT_IF_KUNIT(amdgpu_dm_update_crtc_color_mgmt);static int map_crtc_degamma_to_dc_plane (struct dm_crtc_state *crtc,struct dc_plane_state *dc_plane_state, -struct dc_color_caps *caps) +const struct dc_color_caps *caps) {const struct drm_color_lut *degamma_lut;enum dc_transfer_func_predefined tf =TRANSFER_FUNCTION_SRGB ;
@@ -1483,7 +1485,7 @@ map_crtc_degamma_to_dc_plane(struct dm_crtc_state *crtc,static int __set_dm_plane_degamma (struct drm_plane_state *plane_state,struct dc_plane_state *dc_plane_state, -struct dc_color_caps *color_caps) +const struct dc_color_caps *color_caps) {struct dm_plane_state *dm_plane_state =to_dm_plane_state (plane_state);const struct drm_color_lut *degamma_lut;
@@ -1551,7 +1553,7 @@ __set_colorop_in_tf_1d_curve(struct dc_plane_state *dc_plane_state,struct dc_transfer_func *tf = &dc_plane_state->in_transfer_func;struct drm_colorop *colorop = colorop_state->colorop;struct drm_device *drm = colorop->dev; -struct dc_color_caps *color_caps =NULL ; +const struct dc_color_caps *color_caps =NULL ;bool is_subsampled_format;if (colorop->type !=DRM_COLOROP_1D_CURVE )
@@ -1575,7 +1577,7 @@ __set_colorop_in_tf_1d_curve(struct dc_plane_state *dc_plane_state, tf->tf =amdgpu_colorop_tf_to_dc_tf (colorop_state->curve_1d_type);if (dc_plane_state->ctx && dc_plane_state->ctx->dc) - color_caps = &dc_plane_state->ctx->dc->caps.color; + color_caps = &dc_get_caps (dc_plane_state->ctx->dc)->color;if (!mod_color_calculate_degamma_params (color_caps, tf,NULL , is_subsampled_format)) {
@@ -1865,7 +1867,9 @@ __set_dm_plane_colorop_3dlut(struct drm_plane_state *plane_state,struct dc_transfer_func *tf = &dc_plane_state->cm.shaper_func;struct drm_atomic_commit *state = plane_state->state;const struct amdgpu_device *adev =drm_to_adev (colorop->dev); -bool has_3dlut = adev->dm.dc->caps.color.dpp.hw_3d_lut || adev->dm.dc->caps.color.mpc.preblend; +const struct dc_caps *caps =dc_get_caps (adev->dm.dc); +bool has_3dlut = + caps->color.dpp.hw_3d_lut || caps->color.mpc.preblend;const struct drm_device *dev = colorop->dev;const struct drm_color_lut32 *lut3d;uint32_t lut3d_size;
@@ -2044,7 +2048,9 @@ amdgpu_dm_plane_set_colorop_properties(struct drm_plane_state *plane_state,struct drm_colorop *colorop = plane_state->color_pipeline;struct drm_device *dev = plane_state->plane->dev;struct amdgpu_device *adev =drm_to_adev (dev); -bool has_3dlut = adev->dm.dc->caps.color.dpp.hw_3d_lut || adev->dm.dc->caps.color.mpc.preblend; +const struct dc_caps *caps =dc_get_caps (adev->dm.dc); +bool has_3dlut = + caps->color.dpp.hw_3d_lut || caps->color.mpc.preblend;int ret;/* Fixed Matrix (YUV to RGB) */
@@ -2156,7 +2162,7 @@ int amdgpu_dm_update_plane_color_mgmt(struct dm_crtc_state *crtc,struct amdgpu_device *adev =drm_to_adev (crtc->base.state->dev);struct dm_plane_state *dm_plane_state =to_dm_plane_state (plane_state);struct drm_color_ctm_3x4 *ctm =NULL ; -struct dc_color_caps *color_caps =NULL ; +const struct dc_color_caps *color_caps =NULL ;bool has_crtc_cm_degamma;int ret;
@@ -2167,7 +2173,7 @@ int amdgpu_dm_update_plane_color_mgmt(struct dm_crtc_state *crtc, }if (dc_plane_state->ctx && dc_plane_state->ctx->dc) - color_caps = &dc_plane_state->ctx->dc->caps.color; + color_caps = &dc_get_caps (dc_plane_state->ctx->dc)->color;/* Initially, we can just bypass the DGM block. */ dc_plane_state->in_transfer_func.type =TF_TYPE_BYPASS ;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.h +2 -2
@@ -74,9 +74,9 @@ int __set_output_tf_32(struct dc_transfer_func *func, const struct drm_color_lut32 *lut, uint32_t lut_size, bool has_rom);struct dc_color_caps ; -int __set_input_tf (struct dc_color_caps *caps,struct dc_transfer_func *func, +int __set_input_tf (const struct dc_color_caps *caps,struct dc_transfer_func *func,const struct drm_color_lut *lut,uint32_t lut_size); -int __set_input_tf_32 (struct dc_color_caps *caps,struct dc_transfer_func *func, +int __set_input_tf_32 (const struct dc_color_caps *caps,struct dc_transfer_func *func,const struct drm_color_lut32 *lut,uint32_t lut_size);enum dc_transfer_func_predefined amdgpu_tf_to_dc_tf (enum amdgpu_transfer_function tf);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c +2 -2
@@ -299,8 +299,8 @@ int amdgpu_dm_initialize_default_pipeline(struct drm_plane *plane, struct drm_pr {struct drm_device *dev = plane->dev;struct amdgpu_device *adev =drm_to_adev (dev); -bool hw_3d_lut = adev->dm.dc->caps.color.dpp.hw_3d_lut || - adev->dm.dc->caps.color.mpc.preblend; +bool hw_3d_lut =dc_get_caps (adev->dm.dc)->color.dpp.hw_3d_lut || +dc_get_caps (adev->dm.dc)->color.mpc.preblend;return amdgpu_dm_build_default_pipeline (dev, plane, hw_3d_lut, list); }
drivers/gpu/drm/amd/display/modules/color/color_gamma.c +1 -1
@@ -1669,7 +1669,7 @@ static bool map_regamma_hw_to_x_user(#define _EXTRA_POINTS 3 -bool mod_color_calculate_degamma_params (struct dc_color_caps *dc_caps, +bool mod_color_calculate_degamma_params (const struct dc_color_caps *dc_caps,struct dc_transfer_func *input_tf,const struct dc_gamma *ramp,bool map_user_ramp) {
drivers/gpu/drm/amd/display/modules/color/color_gamma.h +1 -1
@@ -111,7 +111,7 @@ bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf,const struct hdr_tm_params *fs_params, struct calculate_buffer *cal_buffer); -bool mod_color_calculate_degamma_params (struct dc_color_caps *dc_caps, +bool mod_color_calculate_degamma_params (const struct dc_color_caps *dc_caps,struct dc_transfer_func *output_tf,const struct dc_gamma *ramp,bool mapUserRamp);
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH 04/19] drm/amd/display/amdgpu_dm: Use DC accessors in audio/color/backlight paths
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 2 related pre-existing issues it does not introduce: - [Critical] drm/amd/display: race and invalid…
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 2 related pre-existing issues it does not introduce:
- [Critical] drm/amd/display: race and invalid downcast in amdgpu_dm_backlight_set_level() [1]
- [Medium] drm/amd/display: swallowed error in amdgpu_dm_update_plane_color_mgmt() [2]
--
commit c710d624f30d7a2d26cb80389657ac035d1c1f5e
Author: Dave Airlie <[email protected]>
drm/amd/display/amdgpu_dm: Use DC accessors in audio/color/backlight paths
This commit replaces direct struct dc member accesses with DC accessor calls in the audio, backlight, and color management paths.
Quoted 14 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c +1
-1@@ -296,7 +296,7 @@ struct dc_stream_state *dm_find_stream_with_link(struct amdgpu_display_manager *dm, struct dc_link *link) { - struct dc_state *cur_dc_state = dm->dc->current_state; + struct dc_state *cur_dc_state = dc_get_current_state(dm->dc);struct dc_stream_state *stream =NULL ;int i;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c void amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm, · line 389
Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c +1
-1@@ -383,7 +383,7 @@ void amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm, }mutex_lock (&dm->dc_lock); -if (dm->dc->caps.ips_support && dm->dc->ctx->dmub_srv->idle_allowed) { +if (dc_get_caps (dm->dc)->ips_support &&dc_get_ctx (dm->dc)->dmub_srv->idle_allowed) {dc_allow_idle_optimizations (dm->dc, false); reallow_idle = true; }
[Severity: Critical]
This problem wasn't introduced by this patch, but can amdgpu_dm_backlight_set_level() race with a concurrent atomic commit and use cur_dc_state or stream after it has been freed [1]?
amdgpu_dm_backlight_set_level() calls dm_find_stream_with_link() before acquiring dm->dc_lock:
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c:amdgpu_dm_backlight_set_level() {
...
list_for_each_entry(connector, &dm->ddev->mode_config.connector_list, head) {
struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
...
}
...
link = (struct dc_link *)dm->backlight_link[bl_idx];
stream = dm_find_stream_with_link(dm, link);
if (!stream)
return;
...
mutex_lock(&dm->dc_lock);
}A concurrent commit can replace current_state and release the old state and its streams while dm_find_stream_with_link() is walking it or before dm->dc_lock is taken:
CPU0 CPU1amdgpu_dm_backlight_set_level()
dm_find_stream_with_link()
cur_dc_state =
dc_get_current_state(dm->dc)
stream = cur_dc_state->streams[i]
amdgpu_dm_commit_streams()
mutex_lock(&dm->dc_lock)
dc_commit_streams()
/* replaces current_state,
releases old state/streams */
mutex_unlock(&dm->dc_lock) mutex_lock(&dm->dc_lock)
mod_power_set_backlight_nits(...,
stream, ...) <-- use-after-free
In addition, the loop at the start of amdgpu_dm_backlight_set_level() walks mode_config.connector_list with list_for_each_entry() instead of drm_connector_list_iter_begin()/end(), which can race with DP MST connector removal, and unconditionally calls to_amdgpu_dm_connector() on every entry, which causes type confusion on DRM_MODE_CONNECTOR_WRITEBACK connectors (allocated as struct amdgpu_dm_wb_connector).
Quoted 4 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +0
-0
[ ... ]
Quoted 10 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +1
-1@@ -2156,7 +2162,7 @@ int amdgpu_dm_update_plane_color_mgmt(struct dm_crtc_state *crtc,struct amdgpu_device *adev =drm_to_adev (crtc->base.state->dev);struct dm_plane_state *dm_plane_state =to_dm_plane_state (plane_state);struct drm_color_ctm_3x4 *ctm =NULL ; -struct dc_color_caps *color_caps =NULL ; +const struct dc_color_caps *color_caps =NULL ;bool has_crtc_cm_degamma;int ret;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c int amdgpu_dm_update_plane_color_mgmt(struct dm_crtc_state *crtc, · line 2179
Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +1
-1@@ -2167,7 +2173,7 @@ int amdgpu_dm_update_plane_color_mgmt(struct dm_crtc_state *crtc, }if (dc_plane_state->ctx && dc_plane_state->ctx->dc) - color_caps = &dc_plane_state->ctx->dc->caps.color; + color_caps = &dc_get_caps (dc_plane_state->ctx->dc)->color;/* Initially, we can just bypass the DGM block. */ dc_plane_state->in_transfer_func.type =TF_TYPE_BYPASS ;
[Severity: Medium]
This problem wasn't introduced by this patch, but does amdgpu_dm_update_plane_color_mgmt() swallow errors from amdgpu_dm_plane_set_colorop_properties() [2]?
At the end of amdgpu_dm_update_plane_color_mgmt():
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c:amdgpu_dm_update_plane_color_mgmt() {
...
if (!amdgpu_dm_plane_set_colorop_properties(plane_state, dc_plane_state))
return 0;
return amdgpu_dm_plane_set_color_properties(plane_state, dc_plane_state);
}When plane_state->color_pipeline is set and amdgpu_dm_plane_set_colorop_properties() fails with a negative error code (such as -EINVAL or -ENOMEM), the ! check evaluates to false and execution falls through to amdgpu_dm_plane_set_color_properties(). Because no legacy color properties are set on a colorop commit, the fallback bypasses the color blocks and returns 0, causing the atomic commit to succeed with plane color management silently disabled.
[1] https://sashiko.dev/#/bug/linux-d25140b3-5901-4689-81c3-c3890f66e5a2
[2] https://sashiko.dev/#/bug/linux-2356891c-983c-48f7-a656-56667766fead
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
PATCH 5/19 drm/amd/display/amdgpu_dm: Use DC accessors in psr/replay/dmub/hdcp/irq paths
In reply to Dave AirlieReplace direct struct dc member dereferences with the DC accessor layer in amdgpu_dm_psr.c, amdgpu_dm_replay.c, amdgpu_dm_dmub.c, amdgpu_dm_hdcp.c and amdgpu_dm_irq.c.
Add dc_get_dce_version() for the frequent ctx->dce_version reads and split the debug options accessor into a const read view (dc_get_debug_options) and an interim writable view (dc_get_debug_options_mutable) for the remaining module parameter and debugfs write sites.
Also constify the dc_color_caps consumers in the color module so dc_get_caps() read views can flow through them.
Part of making struct dc private to DC.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c | 41 ++++++++++++---------- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c | 39 ++++++++++---------- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c | 22 ++++++------ .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c | 10 +++--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c | 10 +++--- drivers/gpu/drm/amd/display/dc/core/dc_accessors.c | 12 ++++++- drivers/gpu/drm/amd/display/dc/dc.h | 10 ++++-- 7 files changed, 85 insertions(+), 59 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c +23 -18
@@ -179,6 +179,7 @@ dm_get_alt_channel_pstate_switch_aperture(struct amdgpu_device *adev, G7_PSTATE_APERTURE2_ID, };struct mem_reserved_info apertures[ARRAY_SIZE (region_ids)]; +struct dml2_soc_alt_ch_info alt_ch_cfg = {0 };u64 aperture_mc_bases[ARRAY_SIZE (region_ids)];u32 i;int r;
@@ -214,11 +215,13 @@ dm_get_alt_channel_pstate_switch_aperture(struct amdgpu_device *adev, hw_params->soc_fb_info.alt_channel_region_size[i] = apertures[i].reserved_region_size;/* DML consumes the MC base address bits [47:16]. */ - adev->dm.dc->dml2_options.alt_ch_cfg.region_base_addr_47_16[i] = + alt_ch_cfg.region_base_addr_47_16[i] = (u32)(aperture_mc_bases[i] >>16 ); - adev->dm.dc->dml2_options.alt_ch_cfg.region_size_bytes[i] = + alt_ch_cfg.region_size_bytes[i] = (u32 )apertures[i].reserved_region_size; } + +dc_set_dml2_alt_ch_cfg (adev->dm.dc, &alt_ch_cfg); }
@@ -229,9 +232,10 @@ int dm_dmub_hw_init(struct amdgpu_device *adev)struct dmub_srv_fb_info *fb_info = adev->dm.dmub_fb_info;const struct firmware *dmub_fw = adev->dm.dmub_fw;struct dc *dc = adev->dm.dc; -struct dmcu *dmcu = adev->dm.dc->res_pool->dmcu; -struct abm *abm = adev->dm.dc->res_pool->abm; -struct dc_context *ctx = adev->dm.dc->ctx; +struct resource_pool *res_pool =dc_get_res_pool (dc); +struct dmcu *dmcu = res_pool->dmcu; +struct abm *abm = res_pool->abm; +struct dc_context *ctx =dc_get_ctx (adev->dm.dc);struct dmub_srv_hw_params hw_params;enum dmub_status status;const unsigned char *fw_inst_const, *fw_bss_data;
@@ -335,14 +339,15 @@ int dm_dmub_hw_init(struct amdgpu_device *adev) hw_params.fb_info = fb_info;/* Enable usb4 dpia in the FW APU */ -if (dc->caps.is_apu && - dc->res_pool->usb4_dpia_count !=0 && - !dc->debug.dpia_debug.bits.disable_dpia) { +if (dc_get_caps (dc)->is_apu && +dc_get_res_pool (dc)->usb4_dpia_count !=0 && + !dc_get_debug_options (dc)->dpia_debug.bits.disable_dpia) { hw_params.dpia_supported = true; - hw_params.disable_dpia = dc->debug.dpia_debug.bits.disable_dpia; + hw_params.disable_dpia =dc_get_debug_options (dc)->dpia_debug.bits.disable_dpia; hw_params.dpia_hpd_int_enable_supported = false; - hw_params.enable_non_transparent_setconfig = dc->config.consolidated_dpia_dp_lt; - hw_params.disable_dpia_bw_allocation = !dc->config.usb4_bw_alloc_support; + hw_params.enable_non_transparent_setconfig = +dc_get_config (dc)->consolidated_dpia_dp_lt; + hw_params.disable_dpia_bw_allocation = !dc_get_config (dc)->usb4_bw_alloc_support; }switch (amdgpu_ip_version (adev,DCE_HWIP ,0 )) {
@@ -375,9 +380,9 @@ int dm_dmub_hw_init(struct amdgpu_device *adev) abm->dmcu_is_running = dmcu->funcs->is_dmcu_initialized (dmcu); } -if (!adev->dm.dc->ctx->dmub_srv) - adev->dm.dc->ctx->dmub_srv =dc_dmub_srv_create (adev->dm.dc, dmub_srv); -if (!adev->dm.dc->ctx->dmub_srv) { +if (!dc_get_ctx (adev->dm.dc)->dmub_srv) +dc_get_ctx (adev->dm.dc)->dmub_srv =dc_dmub_srv_create (adev->dm.dc, dmub_srv); +if (!dc_get_ctx (adev->dm.dc)->dmub_srv) {drm_err (adev_to_drm (adev),"Couldn't allocate DC DMUB server!\n" );return -ENOMEM ; }
@@ -401,13 +406,13 @@ int dm_dmub_hw_init(struct amdgpu_device *adev)if (adev->dm.dmcub_fw_version && adev->dm.dmcub_fw_version >=DMUB_FW_VERSION (4 ,0 ,0 ) && adev->dm.dmcub_fw_version <DMUB_FW_VERSION (4 ,0 ,59 )) - adev->dm.dc->debug.sanity_checks = true; +dc_get_debug_options_mutable (adev->dm.dc)->sanity_checks = true;break ;case IP_VERSION (3 ,1 ,4 ):if (adev->dm.dmcub_fw_version && adev->dm.dmcub_fw_version >=DMUB_FW_VERSION (4 ,0 ,0 ) && adev->dm.dmcub_fw_version <DMUB_FW_VERSION (8 ,0 ,16 )) - adev->dm.dc->debug.sanity_checks = true; +dc_get_debug_options_mutable (adev->dm.dc)->sanity_checks = true;break ;default :break ;
@@ -565,7 +570,7 @@ STATIC_IFN_KUNIT uint32_t amdgpu_dm_dmub_reg_read(void *ctx, uint32_t address) {struct amdgpu_device *adev = ctx; -return dm_read_reg (adev->dm.dc->ctx, address); +return dm_read_reg (dc_get_ctx (adev->dm.dc), address); }EXPORT_IF_KUNIT (amdgpu_dm_dmub_reg_read);
@@ -574,7 +579,7 @@ STATIC_IFN_KUNIT void amdgpu_dm_dmub_reg_write(void *ctx, uint32_t address, {struct amdgpu_device *adev = ctx; -return dm_write_reg (adev->dm.dc->ctx, address, value); +return dm_write_reg (dc_get_ctx (adev->dm.dc), address, value); }EXPORT_IF_KUNIT (amdgpu_dm_dmub_reg_write);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c +21 -18
@@ -43,7 +43,7 @@ STATIC_IFN_KUNIT bool lp_write_i2c(void *handle, uint32_t address, const uint8_tstruct dc_link *link = handle;struct i2c_payload i2c_payloads[] = {{true, address, size, (void *)data} };struct i2c_command cmd = {i2c_payloads,1 ,I2C_COMMAND_ENGINE_HW , - link->dc->caps.i2c_speed_in_khz}; +dc_get_caps (link->dc)->i2c_speed_in_khz};return dm_helpers_submit_i2c (link->ctx, link, &cmd); }
@@ -56,7 +56,7 @@ STATIC_IFN_KUNIT bool lp_read_i2c(void *handle, uint32_t address, uint8_t offsetstruct i2c_payload i2c_payloads[] = {{true, address,1 , &offset}, {false, address, size, data} };struct i2c_command cmd = {i2c_payloads,2 ,I2C_COMMAND_ENGINE_HW , - link->dc->caps.i2c_speed_in_khz}; +dc_get_caps (link->dc)->i2c_speed_in_khz};return dm_helpers_submit_i2c (link->ctx, link, &cmd); }
@@ -308,9 +308,9 @@ void hdcp_update_display(struct hdcp_workqueue *hdcp_work, hdcp_w->aconnector[conn_index] = aconnector;hdcp_get_link_display_adjustments (enable_encryption, content_type, - dc->caps.fused_io_supported, - dc->debug.hdcp_lc_force_fw_enable, - dc->debug.hdcp_lc_enable_sw_fallback, +dc_get_caps (dc)->fused_io_supported, +dc_get_debug_options (dc)->hdcp_lc_force_fw_enable, +dc_get_debug_options (dc)->hdcp_lc_enable_sw_fallback, &link_adjust, &display_adjust);hdcp_update_display_encryption_control (hdcp_work, hdcp_w, conn_index, enable_encryption);
@@ -676,8 +676,11 @@ void update_config(void *handle, struct cp_psp_stream_config *config) link->adjust.auth_delay =2 ; link->adjust.retry_limit =MAX_NUM_OF_ATTEMPTS ; link->adjust.hdcp1.disable =0 ; - link->adjust.hdcp2.use_fw_locality_check = (dc->caps.fused_io_supported || dc->debug.hdcp_lc_force_fw_enable); - link->adjust.hdcp2.use_sw_locality_fallback = dc->debug.hdcp_lc_enable_sw_fallback; + link->adjust.hdcp2.use_fw_locality_check = + (dc_get_caps (dc)->fused_io_supported || +dc_get_debug_options (dc)->hdcp_lc_force_fw_enable); + link->adjust.hdcp2.use_sw_locality_fallback = +dc_get_debug_options (dc)->hdcp_lc_enable_sw_fallback; hdcp_w->encryption_status[display->index] =MOD_HDCP_ENCRYPTION_STATUS_HDCP_OFF ; DRM_DEBUG_DRIVER("[HDCP_DM] display %d, CP %d, type %d\n", aconnector->base.index,
@@ -839,7 +842,7 @@ static const struct bin_attribute data_attr = {struct hdcp_workqueue *hdcp_create_workqueue (struct amdgpu_device *adev,struct cp_psp *cp_psp,struct dc *dc) { -int max_caps = dc->caps.max_links; +int max_caps =dc_get_caps (dc)->max_links;struct hdcp_workqueue *hdcp_work;int i =0 ;
@@ -874,16 +877,16 @@ struct hdcp_workqueue *hdcp_create_workqueue(struct amdgpu_device *adev,struct mod_hdcp_ddc_funcs *ddc_funcs = &config->ddc.funcs; config->psp.handle = &adev->psp; -if (dc->ctx->dce_version ==DCN_VERSION_3_1 || - dc->ctx->dce_version ==DCN_VERSION_3_14 || - dc->ctx->dce_version ==DCN_VERSION_3_15 || - dc->ctx->dce_version ==DCN_VERSION_3_16 || - dc->ctx->dce_version ==DCN_VERSION_3_2 || - dc->ctx->dce_version ==DCN_VERSION_3_21 || - dc->ctx->dce_version ==DCN_VERSION_3_5 || - dc->ctx->dce_version ==DCN_VERSION_3_51 || - dc->ctx->dce_version ==DCN_VERSION_3_6 || - dc->ctx->dce_version ==DCN_VERSION_4_01 ) +if (dc_get_dce_version (dc) ==DCN_VERSION_3_1 || +dc_get_dce_version (dc) ==DCN_VERSION_3_14 || +dc_get_dce_version (dc) ==DCN_VERSION_3_15 || +dc_get_dce_version (dc) ==DCN_VERSION_3_16 || +dc_get_dce_version (dc) ==DCN_VERSION_3_2 || +dc_get_dce_version (dc) ==DCN_VERSION_3_21 || +dc_get_dce_version (dc) ==DCN_VERSION_3_5 || +dc_get_dce_version (dc) ==DCN_VERSION_3_51 || +dc_get_dce_version (dc) ==DCN_VERSION_3_6 || +dc_get_dce_version (dc) ==DCN_VERSION_4_01 ) config->psp.caps.dtm_v3_supported =1 ; config->ddc.handle =dc_get_link_at_index (dc, i);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c +11 -11
@@ -808,7 +808,7 @@ static inline int dm_irq_state(struct amdgpu_device *adev, st = (state ==AMDGPU_IRQ_STATE_ENABLE ); -if (dc && dc->caps.ips_support && dc->idle_optimizations_allowed) +if (dc &&dc_get_caps (dc)->ips_support &&dc_is_idle_optimizations_allowed (dc))dc_allow_idle_optimizations (dc, false);amdgpu_dm_irq_set (adev, irq_source, st);
@@ -989,8 +989,8 @@ void amdgpu_dm_hpd_init(struct amdgpu_device *adev)* has rather than over the whole enum: the unused slots of the DC * interrupt table hold dummy handlers that assert when touched. */ -for (i =0 ; i < adev->dm.dc->link_count; i++) { -const struct dc_link *link = adev->dm.dc->links[i]; +for (i =0 ; i <dc_get_link_count (adev->dm.dc); i++) { +const struct dc_link *link =dc_get_link_at_index (adev->dm.dc, i);if (link->irq_source_hpd !=DC_IRQ_SOURCE_INVALID && !amdgpu_dm_irq_set (adev, link->irq_source_hpd, false))
@@ -1226,7 +1226,7 @@ EXPORT_IF_KUNIT(dm_handle_hpd_rx_offload_work);struct hpd_rx_irq_offload_work_queue *amdgpu_dm_hpd_rx_irq_create_workqueue (struct amdgpu_device *adev) {struct dc *dc = adev->dm.dc; -int max_caps = dc->caps.max_links; +int max_caps =dc_get_caps (dc)->max_links;int i =0 ;struct hpd_rx_irq_offload_work_queue *hpd_rx_offload_wq =NULL ;
@@ -1265,7 +1265,7 @@ void amdgpu_dm_hpd_rx_irq_work_suspend(struct amdgpu_display_manager *dm)int i;if (dm->hpd_rx_offload_wq) { -for (i =0 ; i < dm->dc->caps.max_links; i++) +for (i =0 ; i <dc_get_caps (dm->dc)->max_links; i++)flush_workqueue (dm->hpd_rx_offload_wq[i].wq); } }
@@ -1321,7 +1321,7 @@ void amdgpu_dm_hdmi_hpd_debounce_work(struct work_struct *work)/* Re-detect the display */ scoped_guard(mutex, &adev->dm.dc_lock) { -if (dc->caps.ips_support && dc->ctx->dmub_srv->idle_allowed) { +if (dc_get_caps (dc)->ips_support &&dc_get_ctx (dc)->dmub_srv->idle_allowed) {dc_allow_idle_optimizations (dc, false); reallow_idle = true; }
@@ -1359,7 +1359,7 @@ void amdgpu_dm_hdmi_hpd_debounce_work(struct work_struct *work) } scoped_guard(mutex, &adev->dm.dc_lock) { -if (reallow_idle && dc->caps.ips_support) +if (reallow_idle &&dc_get_caps (dc)->ips_support)dc_allow_idle_optimizations (dc, true); } }
@@ -1668,7 +1668,7 @@ STATIC_IFN_KUNIT void dmub_hpd_callback(struct amdgpu_device *adev, } link_index = notify->link_index; - link = adev->dm.dc->links[link_index]; + link =dc_get_link_at_index (adev->dm.dc, link_index); dev = adev->dm.ddev;drm_connector_list_iter_begin (dev, &iter);
@@ -2362,7 +2362,7 @@ int amdgpu_dm_dce110_register_irq_handlers(struct amdgpu_device *adev)unsigned int client_id =AMDGPU_IRQ_CLIENTID_LEGACY ;/* Use different interrupts for VBLANK on DCE 6 vs. newer. */ const unsigned int vblank_d1 = - adev->dm.dc->ctx->dce_version >=DCE_VERSION_8_0 +dc_get_dce_version (adev->dm.dc) >=DCE_VERSION_8_0 ?VISLANDS30_IV_SRCID_D1_VERTICAL_INTERRUPT0 :1 ;if (adev->family >=AMDGPU_FAMILY_AI )
@@ -2413,7 +2413,7 @@ int amdgpu_dm_dce110_register_irq_handlers(struct amdgpu_device *adev)return -ENOMEM ; } -if (dc_supports_vrr (adev->dm.dc->ctx->dce_version)) { +if (dc_supports_vrr (dc_get_dce_version (adev->dm.dc))) {/* Use VUPDATE interrupt */ for (i =0 ; i < adev->mode_info.num_crtc; i++) { src_id =VISLANDS30_IV_SRCID_D1_V_UPDATE_INT + i *2 ;
@@ -2626,7 +2626,7 @@ int amdgpu_dm_register_outbox_irq_handlers(struct amdgpu_device *adev)return r; } -if (dc->ctx->dmub_srv) { +if (dc_get_ctx (dc)->dmub_srv) { i =DCN_1_0__SRCID__DMCUB_OUTBOX_LOW_PRIORITY_READY_INT ; int_params.int_context =INTERRUPT_LOW_IRQ_CONTEXT ; int_params.irq_source =
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c +5 -5
@@ -37,10 +37,10 @@ bool link_supports_psrsu(struct dc_link *link) {struct dc *dc = link->ctx->dc; -if (!dc->caps.dmcub_support) +if (!dc_get_caps (dc)->dmcub_support)return false; -if (dc->ctx->dce_version <DCN_VERSION_3_1 ) +if (dc_get_dce_version (dc) <DCN_VERSION_3_1 )return false;if (!is_psr_su_specific_panel (link))
@@ -111,7 +111,7 @@ bool amdgpu_dm_set_psr_caps(struct dc_link *link, struct amdgpu_dm_connector *ac/* Reset psr version first */ link->psr_settings.psr_version =DC_PSR_VERSION_UNSUPPORTED ; -if (!dc->caps.dmub_caps.psr) +if (!dc_get_caps (dc)->dmub_caps.psr)return false;if (!(link->connector_signal &SIGNAL_TYPE_EDP ))
@@ -148,8 +148,8 @@ bool amdgpu_dm_psr_is_active_allowed(struct amdgpu_display_manager *dm) {unsigned int i; -for (i =0 ; i < dm->dc->current_state->stream_count; i++) { -const struct dc_link *link = dm->dc->current_state->streams[i]->link; +for (i =0 ; i <dc_get_current_state (dm->dc)->stream_count; i++) { +const struct dc_link *link =dc_get_current_state (dm->dc)->streams[i]->link;if (!link)continue ;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c +6 -4
@@ -97,8 +97,8 @@ bool amdgpu_dm_set_replay_caps(struct dc_link *link, struct amdgpu_dm_connectorif (!amdgpu_dm_link_supports_replay (link, aconnector))return false; -if (!dc->ctx->dmub_srv || !dc->ctx->dmub_srv->dmub || - !dc->ctx->dmub_srv->dmub->feature_caps.replay_supported) +if (!dc_get_ctx (dc)->dmub_srv || !dc_get_ctx (dc)->dmub_srv->dmub || + !dc_get_ctx (dc)->dmub_srv->dmub->feature_caps.replay_supported)return false;/* Mark Replay is supported in link and update related attributes
@@ -121,8 +121,10 @@ bool amdgpu_dm_set_replay_caps(struct dc_link *link, struct amdgpu_dm_connector debug_flags = (union replay_debug_flags *)&pr_config.debug_flags; debug_flags->u32All =0 ; - debug_flags->bitfields.visual_confirm = dc->debug.visual_confirm ==VISUAL_CONFIRM_REPLAY ; - debug_flags->bitfields.skip_crtc_disabled = dc->debug.replay_skip_crtc_disabled; + debug_flags->bitfields.visual_confirm = +dc_get_debug_options (dc)->visual_confirm ==VISUAL_CONFIRM_REPLAY ; + debug_flags->bitfields.skip_crtc_disabled = +dc_get_debug_options (dc)->replay_skip_crtc_disabled;init_replay_config (link, &pr_config);
drivers/gpu/drm/amd/display/dc/core/dc_accessors.c +11 -1
@@ -42,6 +42,11 @@ struct dc_context *dc_get_ctx(const struct dc *dc)return dc->ctx; } +enum dce_version dc_get_dce_version (const struct dc *dc) +{ +return dc->ctx->dce_version; +} +const struct dc_caps *dc_get_caps (const struct dc *dc) {return &dc->caps;
@@ -52,7 +57,12 @@ const struct dc_config *dc_get_config(const struct dc *dc)return &dc->config; } -struct dc_debug_options *dc_get_debug_options (struct dc *dc) +const struct dc_debug_options *dc_get_debug_options (const struct dc *dc) +{ +return &dc->debug; +} + +struct dc_debug_options *dc_get_debug_options_mutable (struct dc *dc) {return &dc->debug; }
drivers/gpu/drm/amd/display/dc/dc.h +8 -2
@@ -2479,14 +2479,20 @@ uint8_t dc_get_link_count(const struct dc *dc);/* The DC context (logging, register access, dmub service). */ struct dc_context *dc_get_ctx (const struct dc *dc); +/* The ASIC display engine version. */ +enum dce_version dc_get_dce_version (const struct dc *dc); +/* Capabilities detected at dc_create() time. Read-only. */ const struct dc_caps *dc_get_caps (const struct dc *dc);/* Configuration captured at dc_create() time. Read-only. */ const struct dc_config *dc_get_config (const struct dc *dc); -/* Debug overrides (module parameters, debugfs). Writable. */ -struct dc_debug_options *dc_get_debug_options (struct dc *dc); +/* Debug overrides (module parameters, debugfs). Read-only view. */ +const struct dc_debug_options *dc_get_debug_options (const struct dc *dc); + +/* Debug overrides; writable view for module parameter and debugfs writes. */ +struct dc_debug_options *dc_get_debug_options_mutable (struct dc *dc);/* The currently committed state. Owned by DC; read-only for DM. */ struct dc_state *dc_get_current_state (const struct dc *dc);
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH 05/19] drm/amd/display/amdgpu_dm: Use DC accessors in psr/replay/dmub/hdcp/irq paths
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] drm/amd/display: commit message claims dc_color_caps changes from parent commit --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] drm/amd/display: commit message claims dc_color_caps changes from parent commit
--
commit 343696be48b1784f753cb65b6771fbf97af59e1d
Author: Dave Airlie <[email protected]>
drm/amd/display/amdgpu_dm: Use DC accessors in psr/replay/dmub/hdcp/irq paths
This commit replaces direct struct dc member accesses with DC accessor helpers across the psr, replay, dmub, hdcp, and irq paths, adds dc_get_dce_version(), and splits debug option access into const and mutable accessors.
Quoted 2 lines
Also constify the
dc_color_capsconsumers in the color module sodc_get_caps()read views can flow through them.
[Severity: Low]
Should this paragraph be dropped from the commit message? This patch does not touch any color module files; the dc_color_caps consumers were already constified in the preceding commit "drm/amd/display/amdgpu_dm: Use DC accessors in audio/color/backlight paths".
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
PATCH 6/19 drm/amd/display/amdgpu_dm: Use DC accessors in plane/crtc/helpers paths
In reply to Dave AirlieReplace direct struct dc member dereferences with the DC accessor layer in amdgpu_dm_plane.c, amdgpu_dm_crtc.c and amdgpu_dm_helpers.c, including the cap_funcs DCC query (dc_get_dcc_compression_cap), the hwss prepare_ddc sequence (dc_prepare_ddc) and the clk_mgr use in the DP compliance test path (dc_get_clk_mgr).
Part of making struct dc private to DC.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 16 +++++++-------- .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 24 ++++++++++++---------- .../drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 21 ++++++++----------- 3 files changed, 30 insertions(+), 31 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +8 -8
@@ -180,7 +180,7 @@ STATIC_IFN_KUNIT void amdgpu_dm_idle_worker(struct work_struct *work)while (idle_work->enable) {fsleep (HPD_DETECTION_PERIOD_uS);mutex_lock (&idle_work->dm->dc_lock); -if (!idle_work->dm->dc->idle_optimizations_allowed) { +if (!dc_is_idle_optimizations_allowed (idle_work->dm->dc)) {mutex_unlock (&idle_work->dm->dc_lock);break ; }
@@ -308,8 +308,8 @@ static inline int amdgpu_dm_crtc_set_vblank(struct drm_crtc *crtc, bool enable)* Call this function to estimate missed vblanks by using timestamps and * update the vblank counter in DRM. */ -if (dc->caps.ips_support && - dc->config.disable_ips !=DMUB_IPS_DISABLE_ALL && +if (dc_get_caps (dc)->ips_support && +dc_get_config (dc)->disable_ips !=DMUB_IPS_DISABLE_ALL && sr_supported && vblank->config.disable_immediate)drm_crtc_vblank_restore (crtc); }
@@ -327,7 +327,7 @@ static inline int amdgpu_dm_crtc_set_vblank(struct drm_crtc *crtc, bool enable) rc =amdgpu_irq_put (adev, &adev->vupdate_irq, irq_type);drm_dbg_vbl (crtc->dev,"Put vupdate_irq ret=%d\n" , rc); } - }else if (dc_supports_vrr (dm->dc->ctx->dce_version)) { + }else if (dc_supports_vrr (dc_get_dce_version (dm->dc))) {if (enable) {/* vblank irq on -> Only need vupdate irq in vrr mode * Not ref-counted since we need explicit enable/disable
@@ -530,7 +530,7 @@ dm_crtc_additional_color_mgmt(struct drm_crtc *crtc) {struct amdgpu_device *adev =drm_to_adev (crtc->dev); -if (adev->dm.dc->caps.color.mpc.ogam_ram) +if (dc_get_caps (adev->dm.dc)->color.mpc.ogam_ram)drm_object_attach_property (&crtc->base, adev->mode_info.regamma_tf_property,AMDGPU_TRANSFER_FUNCTION_DEFAULT );
@@ -813,8 +813,8 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm, acrtc->base.state = crtc_state; } - acrtc->max_cursor_width = dm->adev->dm.dc->caps.max_cursor_size; - acrtc->max_cursor_height = dm->adev->dm.dc->caps.max_cursor_size; + acrtc->max_cursor_width =dc_get_caps (dm->adev->dm.dc)->max_cursor_size; + acrtc->max_cursor_height =dc_get_caps (dm->adev->dm.dc)->max_cursor_size; acrtc->crtc_id = crtc_index; acrtc->base.enabled = false;
@@ -830,7 +830,7 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,* or the COLOR_PIPELINE property. An atomic commit which attempts to enable * both is rejected. */ - has_degamma = dm->adev->dm.dc->caps.color.dpp.dcn_arch && + has_degamma =dc_get_caps (dm->adev->dm.dc)->color.dpp.dcn_arch && dm->adev->dm.dc->ctx->dce_version !=DCN_VERSION_4_01 ; drm_crtc_enable_color_mgmt(&acrtc->base, has_degamma ? MAX_COLOR_LUT_ENTRIES : 0,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +13 -11
@@ -136,7 +136,8 @@ STATIC_IFN_KUNIT void apply_edid_quirks(struct dc_link *link, struct edid *edid,if (dc_is_embedded_signal (link->connector_signal)) {drm_dbg_driver (dev,"Force PHY power down/up level 2 on panel id %X\n" , panel_id); - link->ctx->dc->debug.psr_phy_force_phy_power_down_up_level_2 = true; +dc_get_debug_options_mutable (link->ctx->dc)-> + psr_phy_force_phy_power_down_up_level_2 = true; }break ;/* Workaround for monitors that get corrupted by the PHY SSC reduction */
@@ -227,7 +228,9 @@ enum dc_edid_status dm_helpers_parse_edid_caps(if (edid_caps->edid_hdmi) { edid_caps->qs_bit = connector->display_info.rgb_quant_range_selectable; -populate_hdmi_info_from_connector (link->dc->config.enable_frl, &connector->display_info.hdmi, edid_caps); +populate_hdmi_info_from_connector ( +dc_get_config (link->dc)->enable_frl, + &connector->display_info.hdmi, edid_caps);drm_dbg_driver (connector->dev,"%s: HDMI_FRL [%s] max_frl_rate %d\n" , __func__, connector->name, edid_caps->max_frl_rate);if (edid_caps->frl_dsc_support) drm_dbg_driver(connector->dev, "%s: HDMI_FRL_DSC [%s] frl_dsc_10bpc %d, frl_dsc_12bpc %d, frl_dsc_all_bpp %d, frl_dsc_native_420 %d, frl_dsc_max_slices %d, frl_dsc_max_frl_rate %d, frl_dsc_total_chunk_kbytes %d\n",
@@ -236,8 +239,8 @@ enum dc_edid_status dm_helpers_parse_edid_caps( edid_caps->frl_dsc_max_frl_rate, edid_caps->frl_dsc_total_chunk_kbytes);if (aconnector->hdmi_comp_auto) { edid_caps->panel_patch.hdmi_comp_auto = true; - link->ctx->dc->debug.force_frl_max = true; - link->ctx->dc->debug.force_frl_dsc = true; +dc_get_debug_options_mutable (link->ctx->dc)->force_frl_max = true; +dc_get_debug_options_mutable (link->ctx->dc)->force_frl_dsc = true;drm_dbg_driver (connector->dev,"%s: HDMI_FRL [%s] hdmi_comp_auto --> enabled\n" , __func__, connector->name); } }
@@ -1291,8 +1294,7 @@ enum dc_edid_status dm_helpers_read_local_edid(else ddc = &aconnector->i2c->base; -if (link->dc->hwss.prepare_ddc) - link->dc->hwss.prepare_ddc (link); +dc_prepare_ddc (link);dm_helpers_wait_for_edid_ready (link, ddc);
@@ -1552,12 +1554,12 @@ bool dm_helpers_dp_handle_test_pattern_request(DP_TEST_PATTERN_COLOR_SPACE_UNDEFINED ;enum dc_color_depth requestColorDepth =COLOR_DEPTH_UNDEFINED ;enum dc_pixel_encoding requestPixelEncoding =PIXEL_ENCODING_UNDEFINED ; -struct pipe_ctx *pipes = link->dc->current_state->res_ctx.pipe_ctx; +struct pipe_ctx *pipes =dc_get_current_state (link->dc)->res_ctx.pipe_ctx;struct pipe_ctx *pipe_ctx =NULL ;struct amdgpu_dm_connector *aconnector = link->priv;struct drm_device *dev = aconnector->base.dev; -struct dc_state *dc_state = ctx->dc->current_state; -struct clk_mgr *clk_mgr = ctx->dc->clk_mgr; +struct dc_state *dc_state =dc_get_current_state (ctx->dc); +struct clk_mgr *clk_mgr =dc_get_clk_mgr (ctx->dc);int i;for (i =0 ; i <MAX_PIPES ; i++) {
@@ -1663,8 +1665,8 @@ bool dm_helpers_dp_handle_test_pattern_request( dc_state->bw_ctx.bw.dcn.clk.dramclk_khz = clk_mgr->dc_mode_softmax_enabled ? clk_mgr->bw_params->dc_mode_softmax_memclk : clk_mgr->bw_params->max_memclk_mhz; dc_state->bw_ctx.bw.dcn.clk.idle_dramclk_khz = dc_state->bw_ctx.bw.dcn.clk.dramclk_khz; - ctx->dc->clk_mgr->funcs->update_clocks ( - ctx->dc->clk_mgr, +dc_get_clk_mgr (ctx->dc)->funcs->update_clocks ( +dc_get_clk_mgr (ctx->dc), dc_state, false);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +9 -12
@@ -306,9 +306,6 @@ STATIC_IFN_KUNIT int amdgpu_dm_plane_validate_dcc(struct amdgpu_device *adev, format >= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN)return -EINVAL ; -if (!dc->cap_funcs.get_dcc_compression_cap) -return -EINVAL ; - input.format = format; input.surface_size.width = plane_size->surface_size.width; input.surface_size.height = plane_size->surface_size.height;
@@ -319,7 +316,7 @@ STATIC_IFN_KUNIT int amdgpu_dm_plane_validate_dcc(struct amdgpu_device *adev,else if (rotation ==ROTATION_ANGLE_90 || rotation ==ROTATION_ANGLE_270 ) input.scan =SCAN_DIRECTION_VERTICAL ; -if (!dc->cap_funcs.get_dcc_compression_cap (dc, &input, &output)) +if (!dc_get_dcc_compression_cap (dc, &input, &output))return -EINVAL ;if (!output.capable)
@@ -1337,7 +1334,7 @@ STATIC_IFN_KUNIT void amdgpu_dm_plane_get_min_max_dc_plane_scaling(struct drm_destruct amdgpu_device *adev =drm_to_adev (dev);struct dc *dc = adev->dm.dc;/* Caps for all supported planes are the same on DCE and DCN 1 - 3 */ -struct dc_plane_cap *plane_cap = &dc->caps.planes[0 ]; +const struct dc_plane_cap *plane_cap = &dc_get_caps (dc)->planes[0 ];switch (fb->format->format) {case DRM_FORMAT_P010 :
@@ -1697,7 +1694,7 @@ void amdgpu_dm_plane_handle_cursor_update(struct drm_plane *plane,* legacy gamma setup. */ if (crtc_state->cm_is_degamma_srgb && - adev->dm.dc->caps.color.dpp.gamma_corr) +dc_get_caps (adev->dm.dc)->color.dpp.gamma_corr) attributes.attribute_flags.bits.ENABLE_CURSOR_DEGAMMA =1 ;if (afb)
@@ -1977,7 +1974,7 @@ dm_atomic_plane_attach_color_mgmt_properties(struct amdgpu_display_manager *dm, struct drm_plane *plane) {struct amdgpu_mode_info mode_info = dm->adev->mode_info; -struct dpp_color_caps dpp_color_caps = dm->dc->caps.color.dpp; +struct dpp_color_caps dpp_color_caps =dc_get_caps (dm->dc)->color.dpp;/* Check HW color pipeline capabilities on DPP block (pre-blending) * before exposing related properties.
@@ -1999,11 +1996,11 @@ dm_atomic_plane_attach_color_mgmt_properties(struct amdgpu_display_manager *dm, AMDGPU_HDR_MULT_DEFAULT);/* Only enable plane CTM if both DPP and MPC gamut remap is available. */ -if (dm->dc->caps.color.mpc.gamut_remap) +if (dc_get_caps (dm->dc)->color.mpc.gamut_remap)drm_object_attach_property (&plane->base, dm->adev->mode_info.plane_ctm_property,0 ); -if (dpp_color_caps.hw_3d_lut || dm->dc->caps.color.mpc.preblend) { +if (dpp_color_caps.hw_3d_lut ||dc_get_caps (dm->dc)->color.mpc.preblend) {drm_object_attach_property (&plane->base, mode_info.plane_shaper_lut_property,0 ); drm_object_attach_property(&plane->base,
@@ -2019,7 +2016,7 @@ dm_atomic_plane_attach_color_mgmt_properties(struct amdgpu_display_manager *dm, MAX_COLOR_3DLUT_SIZE); } -if (dpp_color_caps.ogam_ram || dm->dc->caps.color.mpc.preblend) { +if (dpp_color_caps.ogam_ram ||dc_get_caps (dm->dc)->color.mpc.preblend) {drm_object_attach_property (&plane->base, mode_info.plane_blend_lut_property,0 ); drm_object_attach_property(&plane->base,
@@ -2171,7 +2168,7 @@ dm_plane_init_colorops(struct drm_plane *plane)return 0 ;/* initialize pipeline */ -if (dc->ctx->dce_version >=DCN_VERSION_3_0 ) { +if (dc_get_dce_version (dc) >=DCN_VERSION_3_0 ) { ret =amdgpu_dm_initialize_default_pipeline (plane, &pipelines[len]);if (ret) { drm_err(plane->dev, "Failed to create color pipeline for plane %d: %pe\n",
@@ -2218,7 +2215,7 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,int res = -EPERM ;unsigned int supported_rotations;uint64_t *modifiers =NULL ; -unsigned int primary_zpos = dm->dc->caps.max_slave_planes; +unsigned int primary_zpos =dc_get_caps (dm->dc)->max_slave_planes; num_formats =amdgpu_dm_plane_get_plane_formats (plane, plane_cap, formats,ARRAY_SIZE (formats));
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH 06/19] drm/amd/display/amdgpu_dm: Use DC accessors in plane/crtc/helpers paths
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [Medium] drm/amd/display: memory leak in…
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce:
- [Medium] drm/amd/display: memory leak in dm_helpers_read_local_edid()
[1]
--
commit cb81c7873176d93f0193d77abe7f41c76b00d56d
Author: Dave Airlie <[email protected]>
drm/amd/display/amdgpu_dm: Use DC accessors in plane/crtc/helpers paths
This commit replaces direct struct dc member dereferences with DC accessor functions across amdgpu_dm_plane.c, amdgpu_dm_crtc.c, and amdgpu_dm_helpers.c.
Quoted 4 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +0
-0
[ ... ]
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c enum dc_edid_status dm_helpers_read_local_edid( · line 1300
Quoted 10 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +1
-2@@ -1291,8 +1294,7 @@ enum dc_edid_status dm_helpers_read_local_edid(else ddc = &aconnector->i2c->base; -if (link->dc->hwss.prepare_ddc) - link->dc->hwss.prepare_ddc (link); +dc_prepare_ddc (link);dm_helpers_wait_for_edid_ready (link, ddc);
[Severity: Medium]
This problem wasn't introduced by this patch, but does dm_helpers_read_local_edid() leak drm_edid [1] when returning EDID_BAD_INPUT?
Later in the retry loop, if the raw EDID check or length validation fails, the function returns without calling drm_edid_free(drm_edid):
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c:dm_helpers_read_local_edid() {
...
if (!edid || !connector->edid_blob_ptr ||
connector->edid_blob_ptr->length > sizeof(sink->dc_edid.raw_edid))
return EDID_BAD_INPUT;
...
drm_edid_free(drm_edid);
...
}[1] https://sashiko.dev/#/bug/linux-5db7be8c-2e59-46d2-b3bf-37e1b52f73e4
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
PATCH 7/19 drm/amd/display/amdgpu_dm: Use DC accessors in connector paths
In reply to Dave AirlieReplace direct struct dc member dereferences with the DC accessor layer in amdgpu_dm_connector.c, including the link_service encoding format query (dc_link_dp_get_encoding_format), link array iteration (dc_get_link_at_index), the FBC compressor checks and the debug and caps reads in the DSC policy paths.
Part of making struct dc private to DC.
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c +11 -10
@@ -266,7 +266,7 @@ STATIC_IFN_KUNIT void amdgpu_dm_fbc_init(struct drm_connector *connector)struct drm_display_mode *mode;unsigned long max_size =0 ; -if (adev->dm.dc->fbc_compressor ==NULL ) +if (!dc_is_fbc_compressor_available (adev->dm.dc))return ;if (aconn->dc_link->connector_signal !=SIGNAL_TYPE_EDP )
@@ -289,7 +289,7 @@ STATIC_IFN_KUNIT void amdgpu_dm_fbc_init(struct drm_connector *connector)if (r)drm_err (adev_to_drm (adev),"DM: Failed to initialize FBC\n" );else { - adev->dm.dc->ctx->fbc_gpu_addr = compressor->gpu_addr; +dc_set_fbc_gpu_addr (adev->dm.dc, compressor->gpu_addr);drm_info (adev_to_drm (adev),"DM: FBC alloc %lu\n" , max_size*4 ); }
@@ -1230,7 +1230,7 @@ static void apply_dsc_policy_for_edp(struct amdgpu_dm_connector *aconnector, edp_min_bpp_x16 = edp_max_bpp_x16; if (dc_dsc_compute_bandwidth_range(dc, - dc->debug.dsc_min_slice_height_override, + dc_get_debug_options(dc)->dsc_min_slice_height_override, edp_min_bpp_x16, edp_max_bpp_x16, dsc_caps, &stream->timing,
@@ -1303,7 +1303,8 @@ static void apply_dsc_policy_for_stream(struct amdgpu_dm_connector *aconnector,if (sink->sink_signal ==SIGNAL_TYPE_EDP && !aconnector->dc_link->panel_config.dsc.disable_dsc_edp && - dc->caps.edp_dsc_support && aconnector->dsc_settings.dsc_force_enable !=DSC_CLK_FORCE_DISABLE ) { +dc_get_caps (dc)->edp_dsc_support && + aconnector->dsc_settings.dsc_force_enable !=DSC_CLK_FORCE_DISABLE ) {apply_dsc_policy_for_edp (aconnector, sink, stream, dsc_caps, max_dsc_target_bpp_limit_override);
@@ -3190,15 +3191,13 @@ STATIC_IFN_KUNIT int amdgpu_dm_connector_get_modes(struct drm_connector *connectstruct dc_link *dc_link = amdgpu_dm_connector->dc_link;struct drm_encoder *encoder;const struct drm_edid *drm_edid = amdgpu_dm_connector->drm_edid; -struct dc_link_settings *verified_link_cap = &dc_link->verified_link_cap; -const struct dc *dc = dc_link->dc; encoder =amdgpu_dm_connector_to_encoder (connector);if (!drm_edid) { amdgpu_dm_connector->num_modes =drm_add_modes_noedid (connector,640 ,480 ); -if (dc->link_srv->dp_get_encoding_format (verified_link_cap) == DP_128b_132b_ENCODING) +if (dc_link_dp_get_encoding_format (dc_link) == DP_128b_132b_ENCODING) amdgpu_dm_connector->num_modes +=drm_add_modes_noedid (connector,1920 ,1080 );
@@ -3249,7 +3248,7 @@ void hdmi_frl_status_polling_work(struct work_struct *work)/* Defer to the next cycle rather than block on a busy dc_lock. */ if (mutex_trylock (&dm->dc_lock)) {for (int i =0 ; i <MAX_LINKS ; i++) { - dc_link = dc->links[i]; + dc_link =dc_get_link_at_index (dc, i);if (!dc_link || !dc_link->local_sink)continue ;
@@ -4027,13 +4026,15 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,/* Handle MCCS */ if (do_mccs) { -dm_helpers_read_mccs_caps (adev->dm.dc->ctx, amdgpu_dm_connector->dc_link, sink); +dm_helpers_read_mccs_caps (dc_get_ctx (adev->dm.dc), + amdgpu_dm_connector->dc_link, sink);if (sink->edid_caps.freesync_vcp_code && !sink->mccs_caps.freesync_supported) freesync_capable = false;if (sink->mccs_caps.freesync_supported && freesync_capable) -dm_helpers_mccs_vcp_set (adev->dm.dc->ctx, amdgpu_dm_connector->dc_link, sink); +dm_helpers_mccs_vcp_set (dc_get_ctx (adev->dm.dc), + amdgpu_dm_connector->dc_link, sink); } update:
Signature · 1 line
2.56.0
PATCH 8/19 drm/amd/display: Use DC accessors in DAL modules
In reply to Dave AirlieMigrate modules/freesync, modules/power and the remaining module users of struct dc members to the DC accessor layer, replacing the direct link_service calls (edp_get_psr_residency, edp_send_replay_cmd, edp_set_coasting_vtotal, dp_setup_replay, get_ddc_aux_inst, ...) with the dc_link_* wrappers.
Add missing struct dc forward declarations to logger_interface.h and mod_freesync.h.
Part of making struct dc private to DC.
--- .../gpu/drm/amd/display/include/logger_interface.h | 1 + .../drm/amd/display/modules/freesync/freesync.c | 14 +++++------ .../gpu/drm/amd/display/modules/inc/mod_freesync.h | 2 ++ drivers/gpu/drm/amd/display/modules/power/power.c | 5 ++-- .../gpu/drm/amd/display/modules/power/power_abm.c | 29 +++++++++++----------- .../gpu/drm/amd/display/modules/power/power_psr.c | 10 ++++---- .../drm/amd/display/modules/power/power_replay.c | 25 ++++++++----------- 7 files changed, 44 insertions(+), 42 deletions(-)
drivers/gpu/drm/amd/display/include/logger_interface.h +1 -0
@@ -28,6 +28,7 @@#include "logger_types.h" +struct dc ;struct dc_context ;struct dc_link ;struct dc_surface_update ;
drivers/gpu/drm/amd/display/modules/freesync/freesync.c +7 -7
@@ -125,11 +125,10 @@ static unsigned int calc_duration_in_us_from_v_total(static unsigned int calc_max_hardware_v_total (const struct dc_stream_state *stream) { -unsigned int max_hw_v_total = stream->ctx->dc->caps.max_v_total; +unsigned int max_hw_v_total =dc_get_caps (stream->ctx->dc)->max_v_total; -if (stream->ctx->dc->caps.vtotal_limited_by_fp2) { +if (dc_get_caps (stream->ctx->dc)->vtotal_limited_by_fp2) max_hw_v_total -= stream->timing.v_front_porch +1 ; - }return max_hw_v_total; }
@@ -1008,7 +1007,7 @@ void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync, nominal_field_rate_in_uhz =mod_freesync_calc_nominal_field_rate (stream); -if (stream->ctx->dc->caps.max_v_total !=0 && stream->timing.h_total !=0 ) { +if (dc_get_caps (stream->ctx->dc)->max_v_total !=0 && stream->timing.h_total !=0 ) { min_hardware_refresh_in_uhz =div64_u64 ((stream->timing.pix_clk_100hz *100000000ULL ), (stream->timing.h_total * (long long )calc_max_hardware_v_total (stream))); }
@@ -1196,9 +1195,10 @@ void mod_freesync_handle_v_update(struct mod_freesync *mod_freesync,if (in_out_vrr->supported == false)return ; - cur_tick =dm_get_timestamp (core_freesync->dc->ctx); - cur_timestamp_in_us = (unsigned int ) -div_u64 (dm_get_elapse_time_in_ns (core_freesync->dc->ctx, cur_tick,0 ),1000 ); + cur_tick =dm_get_timestamp (dc_get_ctx (core_freesync->dc)); + cur_timestamp_in_us = (unsigned int )div_u64 ( +dm_get_elapse_time_in_ns (dc_get_ctx (core_freesync->dc), cur_tick,0 ), +1000 ); in_out_vrr->flip_interval.vsyncs_between_flip++; in_out_vrr->flip_interval.v_update_timestamp_in_us = cur_timestamp_in_us;
drivers/gpu/drm/amd/display/modules/inc/mod_freesync.h +2 -0
@@ -28,6 +28,8 @@#include "mod_shared.h" +struct dc ; +// Access structures struct mod_freesync {int dummy;
drivers/gpu/drm/amd/display/modules/power/power.c +3 -2
@@ -192,7 +192,8 @@ struct mod_power *mod_power_create(struct dc *dc, }// ABM used to contain 4 different configs. There is only 3 since ABM 2.3. -if ((dc->res_pool->dmcu !=NULL ) && (dc->res_pool->dmcu->dmcu_version.abm_version <0x23 )) +if (dc_get_res_pool (dc)->dmcu !=NULL && +dc_get_res_pool (dc)->dmcu->dmcu_version.abm_version <0x23 ) abm_max_config =4 ;else abm_max_config =3 ;
@@ -480,7 +481,7 @@ bool mod_power_notify_mode_change(struct mod_power *mod_power, link =dc_stream_get_link (stream);if (link !=NULL &&dc_get_edp_link_panel_inst (dc, link, &panel_inst)) { - aux_inst = link->dc->link_srv->get_ddc_aux_inst (link); + aux_inst =dc_link_get_ddc_aux_inst (link);mod_power_update_backlight_on_mode_change (core_power, link, panel_inst, aux_inst, is_hdr);
drivers/gpu/drm/amd/display/modules/power/power_abm.c +15 -14
@@ -712,7 +712,7 @@ void initialize_backlight_caps(struct core_power *core_power, unsigned int inst)/* Retrieve ACPI extended brightness caps */ if (dm_query_extended_brightness_caps - (dc->ctx, acpi_display_type, ext_backlight_caps)) { + (dc_get_ctx (dc), acpi_display_type, ext_backlight_caps)) { custom_curve_present =validate_ext_backlight_caps (ext_backlight_caps); }
@@ -868,7 +868,7 @@ bool mod_power_hw_init_backlight(struct mod_power *mod_power) params.backlight_lut_array_size = core_power->bl_prop[i].num_backlight_levels; params.min_abm_backlight = core_power->bl_prop[i].min_abm_backlight; - dmcu = dc->res_pool->dmcu; + dmcu =dc_get_res_pool (dc)->dmcu;// In the case where abm is implemented on dmcub, // dmcu object will be null.
@@ -876,8 +876,8 @@ bool mod_power_hw_init_backlight(struct mod_power *mod_power)if (dmcu) {//DMCU does not support multiple eDP return dmcu_load_iram (dmcu, params); - }else if (dc->ctx->dmub_srv) { -if (!dmub_init_abm_config (dc->res_pool, params, i)) + }else if (dc_get_ctx (dc)->dmub_srv) { +if (!dmub_init_abm_config (dc_get_res_pool (dc), params, i))return false; }else return false;
@@ -935,7 +935,7 @@ static bool set_backlight_millinits_aux(struct core_power *core_power,// only use internal backlight control if dmub capabilities are not present if (link->backlight_control_type ==BACKLIGHT_CONTROL_VESA_AUX && - link->dc->caps.dmub_caps.aux_backlight_support) +dc_get_caps (link->dc)->dmub_caps.aux_backlight_support)return true; return dc_link_set_backlight_level_nits(link, core_power->bl_state[inst].isHDR,
@@ -1041,7 +1041,7 @@ bool mod_power_set_backlight_nits(struct mod_power *mod_power, core_power =MOD_POWER_TO_CORE (mod_power); link =dc_stream_get_link (stream); - aux_inst = link->dc->link_srv->get_ddc_aux_inst (link); + aux_inst =dc_link_get_ddc_aux_inst (link);if (!dc_get_edp_link_panel_inst (core_power->dc, stream->link, &panel_inst))return false;
@@ -1128,7 +1128,7 @@ bool mod_power_set_backlight_percent(struct mod_power *mod_power, core_power =MOD_POWER_TO_CORE (mod_power); link =dc_stream_get_link (stream); - aux_inst = link->dc->link_srv->get_ddc_aux_inst (link); + aux_inst =dc_link_get_ddc_aux_inst (link);if (!dc_get_edp_link_panel_inst (core_power->dc, stream->link, &panel_inst))return false;
@@ -1658,8 +1658,8 @@ bool mod_power_is_abm_supported(struct mod_power *mod_power, dc = core_power->dc;// It's only implemented on dmcub. -if (dc->ctx->dmub_srv) { -if (!dmub_is_abm_supported (dc->res_pool, inst)) +if (dc_get_ctx (dc)->dmub_srv) { +if (!dmub_is_abm_supported (dc_get_res_pool (dc), inst))return false; }else return false;
@@ -1682,9 +1682,10 @@ bool mod_power_abm_set_event(struct mod_power *mod_power, dc = core_power->dc;// It's only implemented on dmcub. -if (dc->ctx->dmub_srv) { -if (!dmub_set_abm_event (dc->res_pool, full_screen, trans_info, - hdr_mode, scaling_enable, scaling_strength_map, inst)) +if (dc_get_ctx (dc)->dmub_srv) { +if (!dmub_set_abm_event (dc_get_res_pool (dc), full_screen, + trans_info, hdr_mode, scaling_enable, + scaling_strength_map, inst))return false; }else return false;
@@ -1706,8 +1707,8 @@ bool mod_power_abm_set_strength(struct mod_power *mod_power, dc = core_power->dc;// It's only implemented on dmcub. -if (dc->ctx->dmub_srv) { -if (!dmub_set_abm_strength (dc->res_pool, strength, inst)) +if (dc_get_ctx (dc)->dmub_srv) { +if (!dmub_set_abm_strength (dc_get_res_pool (dc), strength, inst))return false; }else return false;
drivers/gpu/drm/amd/display/modules/power/power_psr.c +5 -5
@@ -70,13 +70,13 @@ bool mod_power_psr_notify_mode_change(struct mod_power *mod_power, psr_config.psr_exit_link_training_required = core_power->map[stream_index].caps->psr_exit_link_training_required; -if (dc->ctx->asic_id.chip_family >=AMDGPU_FAMILY_GC_11_0_1 ) +if (dc_get_ctx (dc)->asic_id.chip_family >=AMDGPU_FAMILY_GC_11_0_1 ) psr_config.allow_smu_optimizations = core_power->psr_smu_optimizations_support &&dc_is_embedded_signal (stream->signal);else psr_config.allow_smu_optimizations = core_power->psr_smu_optimizations_support && -mod_power_only_edp (dc->current_state, stream); +mod_power_only_edp (dc_get_current_state (dc), stream); psr_config.allow_multi_disp_optimizations = core_power->multi_disp_optimizations_support;
@@ -455,7 +455,7 @@ void mod_power_psr_residency(struct mod_power *mod_power, link =dc_stream_get_link (stream);if (link !=NULL ) - link->dc->link_srv->edp_get_psr_residency (link, residency, mode); +dc_link_edp_get_psr_residency (link, residency, mode); }bool mod_power_psr_get_active_psr_events (struct mod_power *mod_power,const struct dc_stream_state *stream,unsigned int *active_psr_events)
@@ -510,7 +510,7 @@ bool mod_power_psr_set_sink_vtotal_in_psr_active(struct mod_power *mod_power, link =dc_stream_get_link (stream); -return link->dc->link_srv->edp_set_sink_vtotal_in_psr_active ( +return dc_link_edp_set_sink_vtotal_in_psr_active ( link, psr_vtotal_idle, psr_vtotal_su); }/*
@@ -645,7 +645,7 @@ bool psr_su_set_dsc_slice_height(struct dc *dc, struct dc_link *link, config->dsc_slice_height =0 ;if (!(link->connector_signal &SIGNAL_TYPE_EDP ) || - !dc->caps.edp_dsc_support || + !dc_get_caps (dc)->edp_dsc_support || link->panel_config.dsc.disable_dsc_edp || !link->dpcd_caps.dsc_caps.dsc_basic_caps.fields.dsc_support.DSC_SUPPORT || !stream->timing.dsc_cfg.num_slices_v)
drivers/gpu/drm/amd/display/modules/power/power_replay.c +11 -14
@@ -372,7 +372,7 @@ bool mod_power_replay_set_coasting_vtotal(struct mod_power *mod_power,if (core_power->num_entities ==0 )return false; -return link->dc->link_srv->edp_set_coasting_vtotal (link, coasting_vtotal, frame_skip_number); +return dc_link_edp_set_coasting_vtotal (link, coasting_vtotal, frame_skip_number); } void mod_power_replay_set_timing_sync_supported(struct mod_power *mod_power,
@@ -400,7 +400,7 @@ void mod_power_replay_set_timing_sync_supported(struct mod_power *mod_power, cmd_data.sync_data.timing_sync_supported = link->replay_settings.config.replay_timing_sync_supported; - link->dc->link_srv->edp_send_replay_cmd (link, Replay_Set_Timing_Sync_Supported, +dc_link_edp_send_replay_cmd (link, Replay_Set_Timing_Sync_Supported, &cmd_data); }
@@ -429,7 +429,7 @@ void mod_power_replay_disabled_adaptive_sync_sdp(struct mod_power *mod_power, cmd_data.disabled_adaptive_sync_sdp_data.force_disabled = force_disabled; - link->dc->link_srv->edp_send_replay_cmd (link, Replay_Disabled_Adaptive_Sync_SDP, +dc_link_edp_send_replay_cmd (link, Replay_Disabled_Adaptive_Sync_SDP, &cmd_data); }
@@ -461,7 +461,7 @@ static void mod_power_replay_set_general_cmd(struct mod_power *mod_power, cmd_data.set_general_cmd_data.subtype = general_cmd_type; cmd_data.set_general_cmd_data.param1 = param1; cmd_data.set_general_cmd_data.param2 = param2; - link->dc->link_srv->edp_send_replay_cmd (link, Replay_Set_General_Cmd, +dc_link_edp_send_replay_cmd (link, Replay_Set_General_Cmd, &cmd_data); }
@@ -500,7 +500,7 @@ static void mod_power_replay_set_pseudo_vtotal(struct mod_power *mod_power,if (link->replay_settings.last_pseudo_vtotal != vtotal) { link->replay_settings.last_pseudo_vtotal = vtotal; - link->dc->link_srv->edp_send_replay_cmd (link, Replay_Set_Pseudo_VTotal, &cmd_data); +dc_link_edp_send_replay_cmd (link, Replay_Set_Pseudo_VTotal, &cmd_data); } }
@@ -759,8 +759,7 @@ void mod_power_replay_residency(const struct dc_stream_state *stream,else mode =PR_RESIDENCY_MODE_PHY ; -if (link && link->dc && link->dc->link_srv) - link->dc->link_srv->edp_replay_residency (link, residency, is_start, mode); +dc_link_edp_replay_residency (link, residency, is_start, mode); } bool mod_power_replay_get_cumulative_residency(const struct dc_stream_state *stream,
@@ -768,10 +767,7 @@ bool mod_power_replay_get_cumulative_residency(const struct dc_stream_state *str {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 ( +return dc_link_edp_replay_get_cumulative_residency ( link, residency_milli_pct); }
@@ -802,7 +798,8 @@ bool mod_power_replay_set_power_opt_and_coasting_vtotal(struct mod_power *mod_po power_opt =mod_power_replay_setup_power_opt (link, active_replay_events, is_ultra_sleep_mode); -return link->dc->link_srv->edp_set_replay_power_opt_and_coasting_vtotal (link, &power_opt, coasting_vtotal, frame_skip_number); +return dc_link_edp_set_replay_power_opt_and_coasting_vtotal ( + link, &power_opt, coasting_vtotal, frame_skip_number); } void mod_power_replay_notify_mode_change(struct mod_power *mod_power,
@@ -829,14 +826,14 @@ void mod_power_replay_notify_mode_change(struct mod_power *mod_power, link->replay_settings.replay_smu_opt_enable = (link->replay_settings.config.replay_smu_opt_supported && -mod_power_only_edp (dc->current_state, stream)); +mod_power_only_edp (dc_get_current_state (dc), stream));if (active_replay_events & replay_event_os_request_force_ffu) { link->replay_settings.config.os_request_force_ffu = true; }if (dc_is_embedded_signal (stream->signal)) - dc->link_srv->dp_setup_replay (link, stream); +dc_link_dp_setup_replay (link, stream); }void init_replay_config (struct dc_link *link,struct replay_config *pr_config)
Signature · 1 line
2.56.0
PATCH 9/19 drm/amd/display/amdgpu_dm: Use DC accessors in debugfs paths
In reply to Dave AirlieReplace direct struct dc member dereferences with the DC accessor layer in amdgpu_dm_debugfs.c: dmub context access, current_state and pipe enumeration, IPS config/idle optimization reads, PSR/Panel Replay residency queries, hwss state dumps (dc_log_hw_state, dc_get_dcc_en_bits), the SubVP query and the debug option writes.
Add a purpose-specific setter for the eDP hotplug detection mode (dc_set_allow_edp_hotplug_detection) instead of writing through dc->config.
Part of making struct dc private to DC.
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 123 ++++++++++----------- drivers/gpu/drm/amd/display/dc/core/dc_accessors.c | 6 + drivers/gpu/drm/amd/display/dc/dc.h | 7 ++ 3 files changed, 73 insertions(+), 63 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +60 -63
@@ -1028,9 +1028,9 @@ static int replay_capability_show(struct seq_file *m, void *data)struct dc *dc = link->ctx->dc; sink_support_replay =amdgpu_dm_link_supports_replay (link, aconnector); -if (dc->ctx->dmub_srv && dc->ctx->dmub_srv->dmub) +if (dc_get_ctx (dc)->dmub_srv &&dc_get_ctx (dc)->dmub_srv->dmub) driver_support_replay = - (bool )dc->ctx->dmub_srv->dmub->feature_caps.replay_supported; + (bool )dc_get_ctx (dc)->dmub_srv->dmub->feature_caps.replay_supported; }seq_printf (m,"Sink support: %s\n" ,str_yes_no (sink_support_replay));
@@ -1295,7 +1295,7 @@ static int max_downscale_src_width_show(struct seq_file *m, void *unused)if (!link)return -ENODEV ; -seq_printf (m,"%d\n" , link->dc->debug.max_downscale_src_width); +seq_printf (m,"%d\n" ,dc_get_debug_options (link->dc)->max_downscale_src_width);return 0 ; }
@@ -1313,7 +1313,7 @@ static int odm_combine_segments_show(struct seq_file *m, void *unused)int i, segments = -EOPNOTSUPP ;for (i =0 ; i <MAX_PIPES ; i++) { - pipe_ctx = &link->dc->current_state->res_ctx.pipe_ctx[i]; + pipe_ctx = &dc_get_current_state (link->dc)->res_ctx.pipe_ctx[i];if (pipe_ctx->stream && pipe_ctx->stream->link == link)break ;
@@ -1594,7 +1594,7 @@ static ssize_t dp_dsc_clock_en_read(struct file *f, char __user *buf,return -ENOMEM ;for (i =0 ; i <MAX_PIPES ; i++) { - pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; + pipe_ctx = &dc_get_current_state (aconnector->dc_link->dc)->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link && pipe_ctx->stream->sink &&
@@ -1696,7 +1696,7 @@ static ssize_t dp_dsc_clock_en_write(struct file *f, const char __user *buf, }for (i =0 ; i <MAX_PIPES ; i++) { - pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; + pipe_ctx = &dc_get_current_state (aconnector->dc_link->dc)->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link && pipe_ctx->stream->sink &&
@@ -1780,7 +1780,7 @@ static ssize_t dp_dsc_slice_width_read(struct file *f, char __user *buf,return -ENOMEM ;for (i =0 ; i <MAX_PIPES ; i++) { - pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; + pipe_ctx = &dc_get_current_state (aconnector->dc_link->dc)->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link && pipe_ctx->stream->sink &&
@@ -1880,7 +1880,7 @@ static ssize_t dp_dsc_slice_width_write(struct file *f, const char __user *buf, }for (i =0 ; i <MAX_PIPES ; i++) { - pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; + pipe_ctx = &dc_get_current_state (aconnector->dc_link->dc)->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link && pipe_ctx->stream->sink &&
@@ -1964,7 +1964,7 @@ static ssize_t dp_dsc_slice_height_read(struct file *f, char __user *buf,return -ENOMEM ;for (i =0 ; i <MAX_PIPES ; i++) { - pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; + pipe_ctx = &dc_get_current_state (aconnector->dc_link->dc)->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link && pipe_ctx->stream->sink &&
@@ -2064,7 +2064,7 @@ static ssize_t dp_dsc_slice_height_write(struct file *f, const char __user *buf, }for (i =0 ; i <MAX_PIPES ; i++) { - pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; + pipe_ctx = &dc_get_current_state (aconnector->dc_link->dc)->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link && pipe_ctx->stream->sink &&
@@ -2144,7 +2144,7 @@ static ssize_t dp_dsc_bits_per_pixel_read(struct file *f, char __user *buf,return -ENOMEM ;for (i =0 ; i <MAX_PIPES ; i++) { - pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; + pipe_ctx = &dc_get_current_state (aconnector->dc_link->dc)->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link && pipe_ctx->stream->sink &&
@@ -2241,7 +2241,7 @@ static ssize_t dp_dsc_bits_per_pixel_write(struct file *f, const char __user *bu }for (i =0 ; i <MAX_PIPES ; i++) { - pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; + pipe_ctx = &dc_get_current_state (aconnector->dc_link->dc)->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link && pipe_ctx->stream->sink &&
@@ -2319,7 +2319,7 @@ static ssize_t dp_dsc_pic_width_read(struct file *f, char __user *buf,return -ENOMEM ;for (i =0 ; i <MAX_PIPES ; i++) { - pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; + pipe_ctx = &dc_get_current_state (aconnector->dc_link->dc)->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link && pipe_ctx->stream->sink &&
@@ -2373,7 +2373,7 @@ static ssize_t dp_dsc_pic_height_read(struct file *f, char __user *buf,return -ENOMEM ;for (i =0 ; i <MAX_PIPES ; i++) { - pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; + pipe_ctx = &dc_get_current_state (aconnector->dc_link->dc)->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link && pipe_ctx->stream->sink &&
@@ -2442,7 +2442,7 @@ static ssize_t dp_dsc_chunk_size_read(struct file *f, char __user *buf,return -ENOMEM ;for (i =0 ; i <MAX_PIPES ; i++) { - pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; + pipe_ctx = &dc_get_current_state (aconnector->dc_link->dc)->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link && pipe_ctx->stream->sink &&
@@ -2511,7 +2511,7 @@ static ssize_t dp_dsc_slice_bpg_offset_read(struct file *f, char __user *buf,return -ENOMEM ;for (i =0 ; i <MAX_PIPES ; i++) { - pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; + pipe_ctx = &dc_get_current_state (aconnector->dc_link->dc)->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link && pipe_ctx->stream->sink &&
@@ -2701,15 +2701,15 @@ static int ips_status_show(struct seq_file *m, void *unused)struct dc *dc = adev->dm.dc;struct dc_dmub_srv *dc_dmub_srv; -seq_printf (m,"IPS config: %d\n" , dc->config.disable_ips); -seq_printf (m,"Idle optimization: %d\n" , dc->idle_optimizations_allowed); +seq_printf (m,"IPS config: %d\n" ,dc_get_config (dc)->disable_ips); +seq_printf (m,"Idle optimization: %d\n" ,dc_is_idle_optimizations_allowed (dc));if (adev->dm.idle_workqueue) {seq_printf (m,"Idle workqueue - enabled: %d\n" , adev->dm.idle_workqueue->enable);seq_printf (m,"Idle workqueue - running: %d\n" , adev->dm.idle_workqueue->running); } - dc_dmub_srv = dc->ctx->dmub_srv; + dc_dmub_srv =dc_get_ctx (dc)->dmub_srv;if (dc_dmub_srv && dc_dmub_srv->dmub) {uint32_t rcg_count, ips1_count, ips2_count; volatile const struct dmub_shared_state_ips_fw *ips_fw =
@@ -2752,7 +2752,7 @@ static int ips_residency_show(struct seq_file *m, void *unused)mutex_lock (&adev->dm.dc_lock); mode =IPS_RESIDENCY__IPS1_RCG ; -if (!dc_dmub_srv_ips_query_residency_info (dc->ctx, panel_inst, &info, mode)) { +if (!dc_dmub_srv_ips_query_residency_info (dc_get_ctx (dc), panel_inst, &info, mode)) {seq_printf (m,"ISP query failed\n" ); }else {unsigned int pct, frac;
@@ -2785,7 +2785,7 @@ static int ips_residency_cntl_set(void *data, u64 val)int ret =0 ;mutex_lock (&adev->dm.dc_lock); -if (!dc_dmub_srv_ips_residency_cntl (dc->ctx, panel_inst, !!val)) +if (!dc_dmub_srv_ips_residency_cntl (dc_get_ctx (dc), panel_inst, !!val)) ret = -EIO ;mutex_unlock (&adev->dm.dc_lock);
@@ -3231,7 +3231,7 @@ static int replay_get_state(void *data, u64 *val)mutex_lock (&adev->dm.dc_lock); -if (dc->idle_optimizations_allowed) { +if (dc_is_idle_optimizations_allowed (dc)) {dc_allow_idle_optimizations (dc, false); reallow_idle = true; }
@@ -3263,12 +3263,12 @@ static int replay_set_residency(void *data, u64 val)mutex_lock (&adev->dm.dc_lock); -if (dc->idle_optimizations_allowed) { +if (dc_is_idle_optimizations_allowed (dc)) {dc_allow_idle_optimizations (dc, false); reallow_idle = true; } - link->dc->link_srv->edp_replay_residency (link, &residency, is_start,PR_RESIDENCY_MODE_PHY ); +dc_link_edp_replay_residency (link, &residency, is_start,PR_RESIDENCY_MODE_PHY );if (reallow_idle)dc_allow_idle_optimizations (dc, true);
@@ -3292,12 +3292,12 @@ static int replay_get_residency(void *data, u64 *val)mutex_lock (&adev->dm.dc_lock); -if (dc->idle_optimizations_allowed) { +if (dc_is_idle_optimizations_allowed (dc)) {dc_allow_idle_optimizations (dc, false); reallow_idle = true; } - link->dc->link_srv->edp_replay_residency (link, &residency, false,PR_RESIDENCY_MODE_PHY ); +dc_link_edp_replay_residency (link, &residency, false,PR_RESIDENCY_MODE_PHY );if (reallow_idle)dc_allow_idle_optimizations (dc, true);
@@ -3323,7 +3323,7 @@ static int psr_get(void *data, u64 *val)mutex_lock (&adev->dm.dc_lock); -if (dc->idle_optimizations_allowed) { +if (dc_is_idle_optimizations_allowed (dc)) {dc_allow_idle_optimizations (dc, false); reallow_idle = true; }
@@ -3354,12 +3354,12 @@ static int psr_read_residency(void *data, u64 *val)mutex_lock (&adev->dm.dc_lock); -if (dc->idle_optimizations_allowed) { +if (dc_is_idle_optimizations_allowed (dc)) {dc_allow_idle_optimizations (dc, false); reallow_idle = true; } - link->dc->link_srv->edp_get_psr_residency (link, &residency,PSR_RESIDENCY_MODE_PHY ); +dc_link_edp_get_psr_residency (link, &residency,PSR_RESIDENCY_MODE_PHY );if (reallow_idle)dc_allow_idle_optimizations (dc, true);
@@ -3379,7 +3379,7 @@ static int allow_edp_hotplug_detection_get(void *data, u64 *val)struct drm_device *dev = connector->dev;struct amdgpu_device *adev =drm_to_adev (dev); - *val = adev->dm.dc->config.allow_edp_hotplug_detection; + *val =dc_get_config (adev->dm.dc)->allow_edp_hotplug_detection;return 0 ; }
@@ -3392,7 +3392,7 @@ static int allow_edp_hotplug_detection_set(void *data, u64 val)struct drm_device *dev = connector->dev;struct amdgpu_device *adev =drm_to_adev (dev); - adev->dm.dc->config.allow_edp_hotplug_detection = (uint32_t ) val; +dc_set_allow_edp_hotplug_detection (adev->dm.dc, (enum dc_hpd_enable_select )val);return 0 ; }
@@ -3532,10 +3532,10 @@ static int dmub_trace_mask_set(void *data, u64 val)u32 res;int i; -if (!adev->dm.dc || !adev->dm.dc->ctx || !adev->dm.dc->ctx->dmub_srv) +if (!adev->dm.dc || !dc_get_ctx (adev->dm.dc) || !dc_get_ctx (adev->dm.dc)->dmub_srv)return -EINVAL ; - dc_dmub_srv = adev->dm.dc->ctx->dmub_srv; + dc_dmub_srv =dc_get_ctx (adev->dm.dc)->dmub_srv; srv = dc_dmub_srv->dmub;if (!srv || !srv->fw_version)return -EINVAL ;
@@ -3558,7 +3558,8 @@ static int dmub_trace_mask_set(void *data, u64 val)break ; } -if (!dc_wake_and_execute_gpint (adev->dm.dc->ctx, cmd, res,NULL ,DM_DMUB_WAIT_TYPE_WAIT )) +if (!dc_wake_and_execute_gpint (dc_get_ctx (adev->dm.dc), cmd, res, +NULL ,DM_DMUB_WAIT_TYPE_WAIT ))return -EIO ;usleep_range (100 ,1000 );
@@ -3581,10 +3582,10 @@ static int dmub_trace_mask_show(void *data, u64 *val)u64 res =0 ;int i =0 ; -if (!adev->dm.dc || !adev->dm.dc->ctx || !adev->dm.dc->ctx->dmub_srv) +if (!adev->dm.dc || !dc_get_ctx (adev->dm.dc) || !dc_get_ctx (adev->dm.dc)->dmub_srv)return -EINVAL ; - dc_dmub_srv = adev->dm.dc->ctx->dmub_srv; + dc_dmub_srv =dc_get_ctx (adev->dm.dc)->dmub_srv; srv = dc_dmub_srv->dmub;if (!srv || !srv->fw_version)return -EINVAL ;
@@ -3592,7 +3593,9 @@ static int dmub_trace_mask_show(void *data, u64 *val)while (i <4 ) {uint32_t response; -if (!dc_wake_and_execute_gpint (adev->dm.dc->ctx, cmd,0 , &response,DM_DMUB_WAIT_TYPE_WAIT_WITH_REPLY )) +if (!dc_wake_and_execute_gpint (dc_get_ctx (adev->dm.dc), cmd,0 , + &response, +DM_DMUB_WAIT_TYPE_WAIT_WITH_REPLY ))return -EIO ; raw = response;
@@ -3715,12 +3718,12 @@ static int cacp_ace_curve_area_show(struct seq_file *m, void *unused)mutex_lock (&adev->dm.dc_lock); -if (dc->idle_optimizations_allowed) { +if (dc_is_idle_optimizations_allowed (dc)) {dc_allow_idle_optimizations (dc, false); reallow_idle = true; } -if (!dc_wake_and_execute_dmub_cmd (dc->ctx, &cmd, +if (!dc_wake_and_execute_dmub_cmd (dc_get_ctx (dc), &cmd,DM_DMUB_WAIT_TYPE_WAIT_WITH_REPLY ) || cmd.cacp_get_ace_curve_area.header.ret_status) ret = -EIO ;
@@ -4243,11 +4246,9 @@ static ssize_t dtn_log_read(if (!buf || !size)return -EINVAL ; -if (!dc->hwss.log_hw_state) +if (!dc_log_hw_state (dc, &log_ctx))return 0 ; - dc->hwss.log_hw_state (dc, &log_ctx); -if (*pos < log_ctx.pos) {size_t to_copy = log_ctx.pos - *pos;
@@ -4281,8 +4282,7 @@ static ssize_t dtn_log_write(if (size ==0 )return 0 ; -if (dc->hwss.log_hw_state) - dc->hwss.log_hw_state (dc,NULL ); +dc_log_hw_state (dc,NULL );return size; }
@@ -4459,18 +4459,17 @@ static int capabilities_show(struct seq_file *m, void *unused) {struct amdgpu_device *adev = (struct amdgpu_device *)m->private;struct dc *dc = adev->dm.dc; -bool mall_supported = dc->caps.mall_size_total; -bool subvp_supported = dc->caps.subvp_fw_processing_delay_us; +bool mall_supported =dc_get_caps (dc)->mall_size_total; +bool subvp_supported =dc_get_caps (dc)->subvp_fw_processing_delay_us;unsigned int mall_in_use = false;unsigned int subvp_in_use = false; -struct hubbub *hubbub = dc->res_pool->hubbub; +struct hubbub *hubbub =dc_get_res_pool (dc)->hubbub;if (hubbub && hubbub->funcs->get_mall_en) hubbub->funcs->get_mall_en (hubbub, &mall_in_use); -if (dc->cap_funcs.get_subvp_en) - subvp_in_use = dc->cap_funcs.get_subvp_en (dc, dc->current_state); + subvp_in_use =dc_get_subvp_en (dc,dc_get_current_state (dc));seq_printf (m,"mall supported: %s, enabled: %s\n" , mall_supported ?"yes" :"no" , mall_in_use ?"yes" :"no" );
@@ -4490,7 +4489,7 @@ static int dp_force_sst_set(void *data, u64 val) {struct amdgpu_device *adev = data; - adev->dm.dc->debug.set_mst_en_for_sst = val; +dc_get_debug_options_mutable (adev->dm.dc)->set_mst_en_for_sst = val;return 0 ; }
@@ -4499,7 +4498,7 @@ static int dp_force_sst_get(void *data, u64 *val) {struct amdgpu_device *adev = data; - *val = adev->dm.dc->debug.set_mst_en_for_sst; + *val =dc_get_debug_options (adev->dm.dc)->set_mst_en_for_sst;return 0 ; }
@@ -4514,7 +4513,7 @@ static int dp_ignore_cable_id_set(void *data, u64 val) {struct amdgpu_device *adev = data; - adev->dm.dc->debug.ignore_cable_id = val; +dc_get_debug_options_mutable (adev->dm.dc)->ignore_cable_id = val;return 0 ; }
@@ -4523,7 +4522,7 @@ static int dp_ignore_cable_id_get(void *data, u64 *val) {struct amdgpu_device *adev = data; - *val = adev->dm.dc->debug.ignore_cable_id; + *val =dc_get_debug_options (adev->dm.dc)->ignore_cable_id;return 0 ; }
@@ -4538,7 +4537,7 @@ static int visual_confirm_set(void *data, u64 val) {struct amdgpu_device *adev = data; - adev->dm.dc->debug.visual_confirm = (enum visual_confirm )val; +dc_get_debug_options_mutable (adev->dm.dc)->visual_confirm = (enum visual_confirm )val;return 0 ; }
@@ -4551,7 +4550,7 @@ static int visual_confirm_get(void *data, u64 *val) {struct amdgpu_device *adev = data; - *val = adev->dm.dc->debug.visual_confirm; + *val =dc_get_debug_options (adev->dm.dc)->visual_confirm;return 0 ; }
@@ -4570,9 +4569,9 @@ static int skip_detection_link_training_set(void *data, u64 val)struct amdgpu_device *adev = data;if (val ==0 ) - adev->dm.dc->debug.skip_detection_link_training = false; +dc_get_debug_options_mutable (adev->dm.dc)->skip_detection_link_training = false;else - adev->dm.dc->debug.skip_detection_link_training = true; +dc_get_debug_options_mutable (adev->dm.dc)->skip_detection_link_training = true;return 0 ; }
@@ -4585,7 +4584,7 @@ static int skip_detection_link_training_get(void *data, u64 *val) {struct amdgpu_device *adev = data; - *val = adev->dm.dc->debug.skip_detection_link_training; + *val =dc_get_debug_options (adev->dm.dc)->skip_detection_link_training;return 0 ; }
@@ -4610,7 +4609,7 @@ static ssize_t dcc_en_bits_read(const uint32_t rd_buf_size =32 ;uint32_t result =0 ;int offset =0 ; -int num_pipes = dc->res_pool->pipe_count; +int num_pipes =dc_get_res_pool (dc)->pipe_count;int *dcc_en_bits;int i, r;
@@ -4618,13 +4617,11 @@ static ssize_t dcc_en_bits_read(if (!dcc_en_bits)return -ENOMEM ; -if (!dc->hwss.get_dcc_en_bits) { +if (!dc_get_dcc_en_bits (dc, dcc_en_bits)) {kfree (dcc_en_bits);return 0 ; } - dc->hwss.get_dcc_en_bits (dc, dcc_en_bits); - rd_buf =kcalloc (rd_buf_size,sizeof (char ),GFP_KERNEL );if (!rd_buf) {kfree (dcc_en_bits);
@@ -4714,7 +4711,7 @@ void dtn_debugfs_init(struct amdgpu_device *adev)debugfs_create_file_unsafe ("amdgpu_dm_disable_hpd" ,0644 , root, adev, &disable_hpd_ops); -if (adev->dm.dc->caps.ips_support) { +if (dc_get_caps (adev->dm.dc)->ips_support) {debugfs_create_file_unsafe ("amdgpu_dm_ips_status" ,0644 , root, adev, &ips_status_fops);
drivers/gpu/drm/amd/display/dc/core/dc_accessors.c +6 -0
@@ -57,6 +57,12 @@ const struct dc_config *dc_get_config(const struct dc *dc)return &dc->config; } +void dc_set_allow_edp_hotplug_detection (struct dc *dc, +enum dc_hpd_enable_select hpd_select) +{ + dc->config.allow_edp_hotplug_detection = hpd_select; +} +const struct dc_debug_options *dc_get_debug_options (const struct dc *dc) {return &dc->debug;
drivers/gpu/drm/amd/display/dc/dc.h +7 -0
@@ -2488,6 +2488,13 @@ const struct dc_caps *dc_get_caps(const struct dc *dc);/* Configuration captured at dc_create() time. Read-only. */ const struct dc_config *dc_get_config (const struct dc *dc); +/* +* Select which eDP connectors get hotplug detection enabled; see +* enum dc_hpd_enable_select. Runtime configurable (debugfs). +*/ +void dc_set_allow_edp_hotplug_detection (struct dc *dc, +enum dc_hpd_enable_select hpd_select); +/* Debug overrides (module parameters, debugfs). Read-only view. */ const struct dc_debug_options *dc_get_debug_options (const struct dc *dc);
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH 09/19] drm/amd/display/amdgpu_dm: Use DC accessors in debugfs paths
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [Critical] drm/amd/display: use-after-free in…
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce:
- [Critical] drm/amd/display: use-after-free in dp_dsc_clock_en_write()
[1]
--
commit 8d9d786f748dd7764b2335ea8779ba852b1d97b2
Author: Dave Airlie <[email protected]>
drm/amd/display/amdgpu_dm: Use DC accessors in debugfs paths
This commit replaces direct struct dc member dereferences in amdgpu_dm_debugfs.c with DC accessor functions and adds a setter for the eDP hotplug detection mode.
Quoted 4 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +0
-0
[ ... ]
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c static ssize_t dp_dsc_clock_en_write(struct file *f, const char __user *buf, · line 1702
Quoted 9 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +1
-1@@ -1696,7 +1696,7 @@ static ssize_t dp_dsc_clock_en_write(struct file *f, const char __user *buf, }for (i =0 ; i <MAX_PIPES ; i++) { - pipe_ctx = &aconnector->dc_link->dc->current_state->res_ctx.pipe_ctx[i]; + pipe_ctx = &dc_get_current_state (aconnector->dc_link->dc)->res_ctx.pipe_ctx[i]; if (pipe_ctx->stream && pipe_ctx->stream->link == aconnector->dc_link && pipe_ctx->stream->sink &&
[Severity: Critical]
This problem wasn't introduced by this patch, but can a concurrent atomic commit free current_state while dp_dsc_clock_en_write() iterates over res_ctx.pipe_ctx[] [1]?
dp_dsc_clock_en_write() walks dc_get_current_state()->res_ctx.pipe_ctx[] before taking dev->mode_config.mutex and dev->mode_config.connection_mutex:
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c:dp_dsc_clock_en_write() {
...
for (i = 0; i < MAX_PIPES; i++) {
pipe_ctx = &dc_get_current_state(aconnector->dc_link->dc)->res_ctx.pipe_ctx[i];
if (pipe_ctx->stream &&
...
break;
}
if (!pipe_ctx->stream)
goto done;
// Get CRTC state
mutex_lock(&dev->mode_config.mutex);
drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
...
}CPU0 CPU1dp_dsc_clock_en_write()
state = dc_get_current_state(dc)
amdgpu_dm_atomic_commit_tail()
...
dc_state_release(old_state) pipe_ctx = &state->res_ctx.pipe_ctx[i]
if (pipe_ctx->stream && ...) <-- use-after-free
If an atomic modeset commit swaps out and frees current_state during the unlocked loop, dp_dsc_clock_en_write() dereferences freed memory.
[1] https://sashiko.dev/#/bug/linux-3a852cda-9b25-49c2-b119-47f2a71a94c3
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=9
PATCH 10/19 drm/amd/display/amdgpu_dm: Use DC accessors in the DM core paths
In reply to Dave AirlieReplace direct struct dc member dereferences with the DC accessor layer in amdgpu_dm.c: dmub context access, caps reads (cursor size, plane/stream/link counts, IPS, planes array), the module parameter debug overrides, current_state access across suspend/resume and master-sync, link iteration, and the DMCU/ABM resource pool reads.
With this, no production code outside DC dereferences struct dc members anymore; only the amdgpu_dm KUnit tests remain.
Part of making struct dc private to DC.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 141 ++++++++++++---------- 1 file changed, 74 insertions(+), 67 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +74 -67
@@ -150,7 +150,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,static inline void amdgpu_dm_exit_ips_for_hw_access (struct dc *dc) { -if (dc->ctx->dmub_srv && !dc->ctx->dmub_srv->idle_exit_counter) +if (dc_get_ctx (dc)->dmub_srv && !dc_get_ctx (dc)->dmub_srv->idle_exit_counter)dc_exit_ips_for_hw_access (dc); }
@@ -204,7 +204,7 @@ STATIC_IFN_KUNIT int dm_crtc_get_scanoutpos(struct amdgpu_device *adev, int crtcreturn 0 ; } -if (dc && dc->caps.ips_support && dc->idle_optimizations_allowed) +if (dc &&dc_get_caps (dc)->ips_support &&dc_is_idle_optimizations_allowed (dc))dc_allow_idle_optimizations (dc, false);/*
@@ -486,6 +486,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) {struct dc_init_data init_data;struct dc_callback_init init_params; +struct dc_debug_options *debug_opts;int r; adev->dm.ddev =adev_to_drm (adev);
@@ -650,62 +651,65 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)if (adev->dm.dc) {drm_info (adev_to_drm (adev),"Display Core v%s initialized on %s\n" ,DC_VER , -dce_version_to_string (adev->dm.dc->ctx->dce_version)); +dce_version_to_string (dc_get_dce_version (adev->dm.dc))); }else {drm_info (adev_to_drm (adev),"Display Core failed to initialize with v%s!\n" ,DC_VER ); goto error; } + debug_opts =dc_get_debug_options_mutable (adev->dm.dc); +if (amdgpu_dc_debug_mask &DC_DISABLE_PIPE_SPLIT ) { - adev->dm.dc->debug.force_single_disp_pipe_split = false; - adev->dm.dc->debug.pipe_split_policy =MPC_SPLIT_AVOID ; + debug_opts->force_single_disp_pipe_split = false; + debug_opts->pipe_split_policy =MPC_SPLIT_AVOID ; }if (adev->asic_type !=CHIP_CARRIZO && adev->asic_type !=CHIP_STONEY ) - adev->dm.dc->debug.disable_stutter = amdgpu_pp_feature_mask &PP_STUTTER_MODE ? false : true; + debug_opts->disable_stutter = + amdgpu_pp_feature_mask &PP_STUTTER_MODE ? false : true;if (dm_should_disable_stutter (adev->pdev)) - adev->dm.dc->debug.disable_stutter = true; + debug_opts->disable_stutter = true;if (amdgpu_dc_debug_mask &DC_DISABLE_STUTTER ) - adev->dm.dc->debug.disable_stutter = true; + debug_opts->disable_stutter = true;if (amdgpu_dc_debug_mask &DC_DISABLE_DSC ) - adev->dm.dc->debug.disable_dsc = true; + debug_opts->disable_dsc = true;if (amdgpu_dc_debug_mask &DC_DISABLE_CLOCK_GATING ) - adev->dm.dc->debug.disable_clock_gate = true; + debug_opts->disable_clock_gate = true;if (amdgpu_dc_debug_mask &DC_FORCE_SUBVP_MCLK_SWITCH ) - adev->dm.dc->debug.force_subvp_mclk_switch = true; + debug_opts->force_subvp_mclk_switch = true;if (amdgpu_dc_debug_mask &DC_DISABLE_SUBVP_FAMS ) { - adev->dm.dc->debug.force_disable_subvp = true; - adev->dm.dc->debug.fams2_config.bits.enable = false; + debug_opts->force_disable_subvp = true; + debug_opts->fams2_config.bits.enable = false; }if (amdgpu_dc_debug_mask &DC_ENABLE_DML2 ) { - adev->dm.dc->debug.using_dml2 = true; - adev->dm.dc->debug.using_dml21 = true; + debug_opts->using_dml2 = true; + debug_opts->using_dml21 = true; }if (amdgpu_dc_debug_mask &DC_HDCP_LC_FORCE_FW_ENABLE ) - adev->dm.dc->debug.hdcp_lc_force_fw_enable = true; + debug_opts->hdcp_lc_force_fw_enable = true;if (amdgpu_dc_debug_mask &DC_HDCP_LC_ENABLE_SW_FALLBACK ) - adev->dm.dc->debug.hdcp_lc_enable_sw_fallback = true; + debug_opts->hdcp_lc_enable_sw_fallback = true;if (amdgpu_dc_debug_mask &DC_SKIP_DETECTION_LT ) - adev->dm.dc->debug.skip_detection_link_training = true; + debug_opts->skip_detection_link_training = true; - adev->dm.dc->debug.visual_confirm = amdgpu_dc_visual_confirm; + debug_opts->visual_confirm = amdgpu_dc_visual_confirm;/* TODO: Remove after DP2 receiver gets proper support of Cable ID feature */ - adev->dm.dc->debug.ignore_cable_id = true; + debug_opts->ignore_cable_id = true;/* temporary enable immediate restore for FAMS2 */ - adev->dm.dc->debug.fams2_imm_restore_drr = true; + debug_opts->fams2_imm_restore_drr = true; -if (adev->dm.dc->caps.dp_hdmi21_pcon_support) +if (dc_get_caps (adev->dm.dc)->dp_hdmi21_pcon_support)drm_info (adev_to_drm (adev),"DP-HDMI FRL PCON supported\n" ); r =dm_dmub_hw_init (adev);
@@ -749,18 +753,18 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)amdgpu_dm_init_color_mod (); -if (adev->dm.dc->caps.max_links >0 ) { +if (dc_get_caps (adev->dm.dc)->max_links >0 ) { adev->dm.vblank_control_workqueue =create_singlethread_workqueue ("dm_vblank_control_workqueue" );if (!adev->dm.vblank_control_workqueue)drm_err (adev_to_drm (adev),"failed to initialize vblank_workqueue.\n" ); } -if (adev->dm.dc->caps.ips_support && - adev->dm.dc->config.disable_ips !=DMUB_IPS_DISABLE_ALL ) +if (dc_get_caps (adev->dm.dc)->ips_support && +dc_get_config (adev->dm.dc)->disable_ips !=DMUB_IPS_DISABLE_ALL ) adev->dm.idle_workqueue =idle_create_workqueue (adev); -if (adev->dm.dc->caps.max_links >0 && adev->family >=AMDGPU_FAMILY_RV ) { +if (dc_get_caps (adev->dm.dc)->max_links >0 && adev->family >=AMDGPU_FAMILY_RV ) { adev->dm.hdcp_workqueue =hdcp_create_workqueue (adev, &init_params.cp_psp, adev->dm.dc);if (!adev->dm.hdcp_workqueue)
@@ -772,7 +776,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)dc_init_callbacks (adev->dm.dc, &init_params); } -if (adev->dm.dc->caps.max_links >0 ) { +if (dc_get_caps (adev->dm.dc)->max_links >0 ) { adev->dm.hdmi_frl_status_polling_wq =create_singlethread_workqueue ("hdmi_frl_status_polling_wq" );if (!adev->dm.hdmi_frl_status_polling_wq)
@@ -836,8 +840,8 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)/* TODO: Add_display_info? */ /* TODO use dynamic cursor width */ -adev_to_drm (adev)->mode_config.cursor_width = adev->dm.dc->caps.max_cursor_size; -adev_to_drm (adev)->mode_config.cursor_height = adev->dm.dc->caps.max_cursor_size; +adev_to_drm (adev)->mode_config.cursor_width =dc_get_caps (adev->dm.dc)->max_cursor_size; +adev_to_drm (adev)->mode_config.cursor_height =dc_get_caps (adev->dm.dc)->max_cursor_size;if (drm_vblank_init (adev_to_drm (adev), adev->dm.display_indexes_num)) { drm_err(adev_to_drm(adev),
@@ -925,7 +929,7 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev)if (adev->dm.dc) {dc_deinit_callbacks (adev->dm.dc); -dc_dmub_srv_destroy (&adev->dm.dc->ctx->dmub_srv); +dc_dmub_srv_destroy (&dc_get_ctx (adev->dm.dc)->dmub_srv);if (dc_enable_dmub_notifications (adev->dm.dc)) {kfree (adev->dm.dmub_notify); adev->dm.dmub_notify =NULL ;
@@ -945,7 +949,7 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev) &adev->dm.boot_time_crc_info.cpu_addr);if (adev->dm.hpd_rx_offload_wq && adev->dm.dc) { -for (i =0 ; i < adev->dm.dc->caps.max_links; i++) { +for (i =0 ; i <dc_get_caps (adev->dm.dc)->max_links; i++) {if (adev->dm.hpd_rx_offload_wq[i].wq) {destroy_workqueue (adev->dm.hpd_rx_offload_wq[i].wq); adev->dm.hpd_rx_offload_wq[i].wq =NULL ;
@@ -1157,11 +1161,11 @@ static void amdgpu_dm_boot_time_crc_init(struct amdgpu_device *adev)const uint32_t fb_size =3 *1024 *1024 ;/* 3MB for DCC pattern */ if (!adev || !adev->dm.dc || !adev->dm.dc->ctx || - !adev->dm.dc->ctx->dmub_srv) { + !dc_get_ctx (adev->dm.dc)->dmub_srv) {return ; } - dmub = adev->dm.dc->ctx->dmub_srv->dmub; + dmub =dc_get_ctx (adev->dm.dc)->dmub_srv->dmub; bootcrc_info = &adev->dm.boot_time_crc_info;if (!dmub || !dmub->hw_funcs.get_fw_boot_option) {
@@ -1205,7 +1209,7 @@ STATIC_IFN_KUNIT int dm_late_init(struct amdgpu_ip_block *ip_block)int i;struct dmcu *dmcu =NULL ; - dmcu = adev->dm.dc->res_pool->dmcu; + dmcu =dc_get_res_pool (adev->dm.dc)->dmcu;/* Init the boot time CRC (skip in resume) */ if ((adev->in_suspend == 0) &&
@@ -1233,13 +1237,13 @@ STATIC_IFN_KUNIT int dm_late_init(struct amdgpu_ip_block *ip_block)if (dmcu) {if (!dmcu_load_iram (dmcu, params))return -EINVAL ; - }else if (adev->dm.dc->ctx->dmub_srv) { + }else if (dc_get_ctx (adev->dm.dc)->dmub_srv) {struct dc_link *edp_links[MAX_NUM_EDP ];int edp_num;dc_get_edp_links (adev->dm.dc, edp_links, &edp_num);for (i =0 ; i < edp_num; i++) { -if (!dmub_init_abm_config (adev->dm.dc->res_pool, params, i)) +if (!dmub_init_abm_config (dc_get_res_pool (adev->dm.dc), params, i))return -EINVAL ; } }
@@ -1460,7 +1464,7 @@ STATIC_IFN_KUNIT void dm_gpureset_toggle_interrupts(struct amdgpu_device *adev,drm_warn (adev_to_drm (adev),"Failed to %s pflip interrupts\n" , enable ?"enable" :"disable" ); -if (dc_supports_vrr (adev->dm.dc->ctx->dce_version)) { +if (dc_supports_vrr (dc_get_dce_version (adev->dm.dc))) {if (enable) {if (amdgpu_dm_crtc_vrr_active (to_dm_crtc_state (acrtc->base.state)))
@@ -1620,7 +1624,7 @@ static int dm_suspend(struct amdgpu_ip_block *ip_block)amdgpu_dm_ism_force_full_power (dm);dc_allow_idle_optimizations (adev->dm.dc, false); - dm->cached_dc_state =dc_state_create_copy (dm->dc->current_state); + dm->cached_dc_state =dc_state_create_copy (dc_get_current_state (dm->dc));if (!dm->cached_dc_state) {drm_err (adev_to_drm (adev),"Failed to allocate cached DC state during suspend\n" );
@@ -1671,10 +1675,10 @@ static int dm_suspend(struct amdgpu_ip_block *ip_block)dc_set_power_state (dm->dc,DC_ACPI_CM_POWER_STATE_D3 ); -if (dm->dc->caps.ips_support && adev->in_s0ix) +if (dc_get_caps (dm->dc)->ips_support && adev->in_s0ix)dc_allow_idle_optimizations (dm->dc, true); -dc_dmub_srv_set_power_state (dm->dc->ctx->dmub_srv,DC_ACPI_CM_POWER_STATE_D3 ); +dc_dmub_srv_set_power_state (dc_get_ctx (dm->dc)->dmub_srv,DC_ACPI_CM_POWER_STATE_D3 );return 0 ; }
@@ -1837,8 +1841,8 @@ STATIC_IFN_KUNIT void amdgpu_dm_dump_links_and_sinks(struct amdgpu_device *adev)if (!dc)return ; -for (li =0 ; li < dc->link_count; li++) { -struct dc_link *l = dc->links[li]; +for (li =0 ; li <dc_get_link_count (dc); li++) { +struct dc_link *l =dc_get_link_at_index (dc, li);const char *name =NULL ;int rs;
@@ -1896,14 +1900,15 @@ static int dm_resume(struct amdgpu_ip_block *ip_block)int i, r, j;struct dc_commit_streams_params commit_params = {}; -if (dm->dc->caps.ips_support) { +if (dc_get_caps (dm->dc)->ips_support) {if (!amdgpu_in_reset (adev))mutex_lock (&dm->dc_lock);/* Need to set POWER_STATE_D0 first or it will not execute * idle_power_optimizations command to DMUB. */ -dc_dmub_srv_set_power_state (dm->dc->ctx->dmub_srv,DC_ACPI_CM_POWER_STATE_D0 ); +dc_dmub_srv_set_power_state (dc_get_ctx (dm->dc)->dmub_srv, +DC_ACPI_CM_POWER_STATE_D0 );dc_dmub_srv_apply_idle_power_optimizations (dm->dc, false);if (!amdgpu_in_reset (adev))
@@ -1914,7 +1919,7 @@ static int dm_resume(struct amdgpu_ip_block *ip_block) dc_state = dm->cached_dc_state;/* -* The dc->current_state is backed up into dm->cached_dc_state +* The dc_get_current_state(dc) is backed up into dm->cached_dc_state * before we commit 0 streams. * * DC will clear link encoder assignments on the real state
@@ -1928,7 +1933,7 @@ static int dm_resume(struct amdgpu_ip_block *ip_block)* We lose the previous assignments, but we had already * commit 0 streams anyway. */ -link_enc_cfg_copy (adev->dm.dc->current_state, dc_state); +link_enc_cfg_copy (dc_get_current_state (adev->dm.dc), dc_state); r =dm_dmub_hw_init (adev);if (r) {
@@ -1939,7 +1944,8 @@ static int dm_resume(struct amdgpu_ip_block *ip_block)return r; } -dc_dmub_srv_set_power_state (dm->dc->ctx->dmub_srv,DC_ACPI_CM_POWER_STATE_D0 ); +dc_dmub_srv_set_power_state (dc_get_ctx (dm->dc)->dmub_srv, +DC_ACPI_CM_POWER_STATE_D0 );dc_set_power_state (dm->dc,DC_ACPI_CM_POWER_STATE_D0 );dc_resume (dm->dc);
@@ -1998,7 +2004,7 @@ static int dm_resume(struct amdgpu_ip_block *ip_block) }/* power on hardware */ -dc_dmub_srv_set_power_state (dm->dc->ctx->dmub_srv,DC_ACPI_CM_POWER_STATE_D0 ); +dc_dmub_srv_set_power_state (dc_get_ctx (dm->dc)->dmub_srv,DC_ACPI_CM_POWER_STATE_D0 );dc_set_power_state (dm->dc,DC_ACPI_CM_POWER_STATE_D0 );/* program HPD filter */
@@ -2340,7 +2346,7 @@ STATIC_IFN_KUNIT int initialize_plane(struct amdgpu_display_manager *dm,* for a CRTC - like overlay or underlay planes. */ possible_crtcs =1 << plane_id; -if (plane_id >= dm->dc->caps.max_streams) +if (plane_id >=dc_get_caps (dm->dc)->max_streams) possible_crtcs =0xff ; ret =amdgpu_dm_plane_init (dm, plane, possible_crtcs, plane_cap);
@@ -2380,22 +2386,22 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)const struct dc_plane_cap *plane;bool psr_feature_enabled = false;bool replay_feature_enabled = false; -int max_overlay = dm->dc->caps.max_slave_planes; +int max_overlay =dc_get_caps (dm->dc)->max_slave_planes; - dm->display_indexes_num = dm->dc->caps.max_streams; + dm->display_indexes_num =dc_get_caps (dm->dc)->max_streams;/* Update the actual used number of crtc */ adev->mode_info.num_crtc = adev->dm.display_indexes_num;amdgpu_dm_set_irq_funcs (adev); - link_cnt = dm->dc->caps.max_links; + link_cnt =dc_get_caps (dm->dc)->max_links;if (amdgpu_dm_mode_config_init (dm->adev)) {drm_err (adev_to_drm (adev),"DM: Failed to initialize mode config\n" );return -EINVAL ; }/* There is one primary plane per CRTC */ - primary_planes = dm->dc->caps.max_streams; + primary_planes =dc_get_caps (dm->dc)->max_streams;if (primary_planes >AMDGPU_MAX_PLANES ) {drm_err (adev_to_drm (adev),"DM: Plane nums out of 6 planes\n" );return -EINVAL ;
@@ -2406,7 +2412,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)* Order is reversed to match iteration order in atomic check. */ for (i = (primary_planes -1 ); i >=0 ; i--) { - plane = &dm->dc->caps.planes[i]; + plane = &dc_get_caps (dm->dc)->planes[i];if (initialize_plane (dm, mode_info, i,DRM_PLANE_TYPE_PRIMARY , plane)) {
@@ -2424,8 +2430,8 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)* Only support DCN for now, and only expose one so we don't encourage * userspace to use up all the pipes. */ -for (i =0 ; i < dm->dc->caps.max_planes; ++i) { -struct dc_plane_cap *plane = &dm->dc->caps.planes[i]; +for (i =0 ; i <dc_get_caps (dm->dc)->max_planes; ++i) { +const struct dc_plane_cap *plane = &dc_get_caps (dm->dc)->planes[i];/* Do not create overlay if MPO disabled */ if (amdgpu_dc_debug_mask &DC_DISABLE_MPO )
@@ -2447,7 +2453,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) } } -for (i =0 ; i < dm->dc->caps.max_streams; i++) +for (i =0 ; i <dc_get_caps (dm->dc)->max_streams; i++)if (amdgpu_dm_crtc_init (dm, mode_info->planes[i], i)) {drm_err (adev_to_drm (adev),"KMS: Failed to initialize crtc\n" ); goto fail;
@@ -3717,7 +3723,7 @@ STATIC_IFN_KUNIT void amdgpu_dm_update_cursor(struct drm_plane *plane,* legacy gamma setup. */ if (crtc_state->cm_is_degamma_srgb && - adev->dm.dc->caps.color.dpp.gamma_corr) +dc_get_caps (adev->dm.dc)->color.dpp.gamma_corr) attributes.attribute_flags.bits.ENABLE_CURSOR_DEGAMMA =1 ;if (afb)
@@ -4843,8 +4849,9 @@ dm_set_writeback(struct amdgpu_display_manager *dm, }for (i =0 ; i <MAX_PIPES ; i++) { -if (dm->dc->current_state->res_ctx.pipe_ctx[i].stream == crtc_state->stream) { - pipe = &dm->dc->current_state->res_ctx.pipe_ctx[i]; +if (dc_get_current_state (dm->dc)->res_ctx.pipe_ctx[i].stream == + crtc_state->stream) { + pipe = &dc_get_current_state (dm->dc)->res_ctx.pipe_ctx[i];break ; } }
@@ -6795,14 +6802,14 @@ void amdgpu_dm_trigger_timing_sync(struct drm_device *dev)int i;mutex_lock (&adev->dm.dc_lock); -if (dc->current_state) { -for (i =0 ; i < dc->current_state->stream_count; ++i) - dc->current_state->streams[i] +if (dc_get_current_state (dc)) { +for (i =0 ; i <dc_get_current_state (dc)->stream_count; ++i) +dc_get_current_state (dc)->streams[i] ->triggered_crtc_reset.enabled = adev->dm.force_timing_sync; -dm_enable_per_frame_crtc_master_sync (dc->current_state); -dc_trigger_sync (dc, dc->current_state); +dm_enable_per_frame_crtc_master_sync (dc_get_current_state (dc)); +dc_trigger_sync (dc,dc_get_current_state (dc)); }mutex_unlock (&adev->dm.dc_lock); }
@@ -6872,8 +6879,8 @@ void amdgpu_dm_update_memclk_states(struct amdgpu_device *adev)if (!dc)return ; -if (dc->ctx->dce_version !=DCN_VERSION_3_2 && - dc->ctx->dce_version !=DCN_VERSION_3_21 ) +if (dc_get_dce_version (dc) !=DCN_VERSION_3_2 && +dc_get_dce_version (dc) !=DCN_VERSION_3_21 )return ;mutex_lock (&adev->dm.dc_lock);
Signature · 1 line
2.56.0
PATCH 11/19 drm/amd/display/amdgpu_dm: Finish DC accessor migration for non-test code
In reply to Dave AirlieConvert the last struct dc member dereferences outside DC (crtc, irq, mst_types, amdgpu_dm ctx NULL check) to the accessor layer, and move the PERFORMANCE_TRACE_{START,END} macros, which dereference a dc-local variable, from the public logger_interface.h into dc/dm_services.h where their users live.
No production code outside the dc directory dereferences struct dc members anymore. Only the amdgpu_dm KUnit tests remain to migrate.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 2 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c | 2 +- .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 26 +++++++++++++--------- drivers/gpu/drm/amd/display/dc/dm_services.h | 16 +++++++++++++ .../gpu/drm/amd/display/include/logger_interface.h | 12 ---------- 6 files changed, 34 insertions(+), 26 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
@@ -1160,7 +1160,7 @@ static void amdgpu_dm_boot_time_crc_init(struct amdgpu_device *adev)int ret =0 ;const uint32_t fb_size =3 *1024 *1024 ;/* 3MB for DCC pattern */ -if (!adev || !adev->dm.dc || !adev->dm.dc->ctx || +if (!adev || !adev->dm.dc || !dc_get_ctx (adev->dm.dc) || !dc_get_ctx (adev->dm.dc)->dmub_srv) {return ; }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +1 -1
@@ -831,7 +831,7 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,* both is rejected. */ has_degamma =dc_get_caps (dm->adev->dm.dc)->color.dpp.dcn_arch && - dm->adev->dm.dc->ctx->dce_version !=DCN_VERSION_4_01 ; +dc_get_dce_version (dm->adev->dm.dc) !=DCN_VERSION_4_01 ;drm_crtc_enable_color_mgmt (&acrtc->base, has_degamma ?MAX_COLOR_LUT_ENTRIES :0 , true,MAX_COLOR_LUT_ENTRIES );
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c +1 -1
@@ -1656,7 +1656,7 @@ STATIC_IFN_KUNIT void dmub_hpd_callback(struct amdgpu_device *adev,return ; } -if (notify->link_index > adev->dm.dc->link_count) { +if (notify->link_index >dc_get_link_count (adev->dm.dc)) {drm_err (adev_to_drm (adev),"DMUB HPD index (%u)is abnormal" , notify->link_index);return ; }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +15 -11
@@ -1239,7 +1239,7 @@ STATIC_IFN_KUNIT bool get_conv_frl_bw(struct amdgpu_dm_connector *aconnector,unsigned int dsc_max_sink_bw_in_kbps =0 ;if (aconnector->dc_sink && - aconnector->dc_link->dc->caps.dp_hdmi21_pcon_support && +dc_get_caps (aconnector->dc_link->dc)->dp_hdmi21_pcon_support && aconnector->mst_downstream_port_caps.bytes.byte0.bits.DWN_STRM_PORTX_TYPE ==DOWN_STREAM_DETAILED_HDMI ) { max_conv_bw_in_kbps = dc_link_bw_kbps_from_raw_frl_link_rate_data( aconnector->dc_link->dc,
@@ -1399,7 +1399,8 @@ static int compute_mst_dsc_configs_for_link(struct drm_atomic_commit *state,build_frl_mst_dsc_params (aconnector, stream, &dsc_policy, ¶ms[count], frl_conv_dsc_bw_in_kbps); if (!dc_dsc_compute_bandwidth_range( stream->sink->ctx->dc, - stream->sink->ctx->dc->debug.dsc_min_slice_height_override, + dc_get_debug_options( + stream->sink->ctx->dc)->dsc_min_slice_height_override, min_target_bpp_x16, max_target_bpp_x16, &stream->sink->dsc_caps.dsc_dec_caps,
@@ -1593,13 +1594,13 @@ STATIC_IFN_KUNIT bool is_dsc_need_re_compute( }DRM_DEBUG_DRIVER ("%s: MST_DSC check on %d streams in current dc_state\n" , - __func__, dc->current_state->stream_count); + __func__,dc_get_current_state (dc)->stream_count);/* check current_state if there stream on link but it is not in * new request state */ -for (i =0 ; i < dc->current_state->stream_count; i++) { - stream = dc->current_state->streams[i]; +for (i =0 ; i <dc_get_current_state (dc)->stream_count; i++) { + stream =dc_get_current_state (dc)->streams[i];/* only check stream on the mst hub */ if (stream->link != dc_link)continue ;
@@ -1943,12 +1944,15 @@ static bool is_dsc_common_config_possible(struct dc_stream_state *stream,bool is_dsc_possible;dc_dsc_get_policy_for_timing (&stream->timing,0 , &dsc_policy,dc_link_get_highest_encoding_format (stream->link)); - is_dsc_possible =dc_dsc_compute_bandwidth_range (stream->sink->ctx->dc, - stream->sink->ctx->dc->debug.dsc_min_slice_height_override, - 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 (stream->link), bw_range); + is_dsc_possible =dc_dsc_compute_bandwidth_range ( + stream->sink->ctx->dc, +dc_get_debug_options ( + stream->sink->ctx->dc)->dsc_min_slice_height_override, + 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 (stream->link), bw_range);return is_dsc_possible; }
drivers/gpu/drm/amd/display/dc/dm_services.h +16 -0
@@ -262,6 +262,22 @@ void dm_perf_trace_timestamp(const char *func_name, unsigned int line, struct dc#define PERF_TRACE () dm_perf_trace_timestamp(__func__, __LINE__, CTX)#define PERF_TRACE_CTX (__CTX) dm_perf_trace_timestamp(__func__, __LINE__, __CTX) +/* +* These macros dereference a dc-local variable and are therefore only +* usable from DC-internal code. +*/ +#define PERFORMANCE_TRACE_START () \ + unsigned long long perf_trc_start_stmp = dm_get_timestamp(dc->ctx) + +#define PERFORMANCE_TRACE_END () \ + do { \ + unsigned long long perf_trc_end_stmp = dm_get_timestamp(dc->ctx); \ + if (dc->debug.performance_trace) { \ + DC_LOG_PERF_TRACE("%s duration: %lld ticks\n", __func__, \ + perf_trc_end_stmp - perf_trc_start_stmp); \ + } \ + } while (0) +/* * SMU message tracing */
drivers/gpu/drm/amd/display/include/logger_interface.h +0 -12
@@ -125,18 +125,6 @@ void context_clock_trace(#define DTN_INFO_END () \ dm_dtn_log_end(dc_ctx, log_ctx) -#define PERFORMANCE_TRACE_START () \ - unsigned long long perf_trc_start_stmp = dm_get_timestamp(dc->ctx) - -#define PERFORMANCE_TRACE_END () \ - do { \ - unsigned long long perf_trc_end_stmp = dm_get_timestamp(dc->ctx); \ - if (dc->debug.performance_trace) { \ - DC_LOG_PERF_TRACE("%s duration: %lld ticks\n", __func__, \ - perf_trc_end_stmp - perf_trc_start_stmp); \ - } \ - } while (0) -#define DISPLAY_STATS_BEGIN (entry) (void)(entry)#define DISPLAY_STATS (msg, ...) DC_LOG_PERF_TRACE(msg, __VA_ARGS__)
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH 11/19] drm/amd/display/amdgpu_dm: Finish DC accessor migration for non-test code
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [High] drm/amd/display: uninitialized stack…
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce:
- [High] drm/amd/display: uninitialized stack memory read in get_conv_frl_bw() [1]
--
commit 7d52238d02a453de3c024a3c4edfc5cc756f0bed
Author: Dave Airlie <[email protected]>
drm/amd/display/amdgpu_dm: Finish DC accessor migration for non-test code
This commit converts the remaining struct dc member dereferences in amdgpu_dm production code to use accessor functions and moves the PERFORMANCE_TRACE_START and PERFORMANCE_TRACE_END macros into dc/dm_services.h.
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c STATIC_IFN_KUNIT bool get_conv_frl_bw(struct amdgpu_dm_connector *aconnector, · line 1245
Quoted 13 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +1
-1@@ -1239,7 +1239,7 @@ STATIC_IFN_KUNIT bool get_conv_frl_bw(struct amdgpu_dm_connector *aconnector,unsigned int dsc_max_sink_bw_in_kbps =0 ;if (aconnector->dc_sink && - aconnector->dc_link->dc->caps.dp_hdmi21_pcon_support && +dc_get_caps (aconnector->dc_link->dc)->dp_hdmi21_pcon_support && aconnector->mst_downstream_port_caps.bytes.byte0.bits.DWN_STRM_PORTX_TYPE ==DOWN_STREAM_DETAILED_HDMI ) { max_conv_bw_in_kbps = dc_link_bw_kbps_from_raw_frl_link_rate_data( aconnector->dc_link->dc,
[Severity: High]
This problem wasn't introduced by this patch, but can get_conv_frl_bw() read uninitialized stack memory from *bw_in_kbps [1]?
compute_mst_dsc_configs_for_link() declares frl_conv_bw_in_kbps and frl_conv_dsc_bw_in_kbps on the stack without initializing them and passes them to get_conv_frl_bw():
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c:get_conv_frl_bw() {
if (aconnector->dc_sink &&
dc_get_caps(aconnector->dc_link->dc)->dp_hdmi21_pcon_support &&
aconnector->mst_downstream_port_caps.bytes.byte0.bits.DWN_STRM_PORTX_TYPE == DOWN_STREAM_DETAILED_HDMI) {
...
if (aconnector->dc_sink->edid_caps.max_frl_rate && max_conv_bw_in_kbps) {
...
*bw_in_kbps = min(max_conv_bw_in_kbps, max_sink_bw_in_kbps);
*dsc_bw_in_kbps = min(*bw_in_kbps, dsc_max_sink_bw_in_kbps);
}
}
return *bw_in_kbps > 0; // Frl endpoint is detected
}When the downstream port is not HDMI 2.1 PCON or max_frl_rate is 0, neither output pointer is written before *bw_in_kbps > 0 is evaluated. If stack contents make *bw_in_kbps non-zero, get_conv_frl_bw() returns true and compute_mst_dsc_configs_for_link() passes the uninitialized frl_conv_dsc_bw_in_kbps into build_frl_mst_dsc_params().
[1] https://sashiko.dev/#/bug/linux-04300f5e-3be1-4eaf-ab02-d1aa2df32bb9
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=11
PATCH 12/19 drm/amd/display: Migrate amdgpu_dm KUnit tests off struct dc internals
In reply to Dave AirlieThe amdgpu_dm KUnit tests constructed fake struct dc instances with kunit_kzalloc(sizeof(*dc)) and populated members directly. Add a KUnit-gated test double API in DC (dc/inc/dc_test.h implemented in dc/core/dc_test.c) that allocates the fake and exposes setters and mutable views for the members tests need:
- dc_test_create/destroy for the fake instance
- setters for ctx, current_state, link_srv, res_pool, clk_mgr, fbc_compressor, links[], link_count, idle_optimizations_allowed
- mutable views for caps, config, debug, hwss and cap_funcs
Rework dm_kunit_alloc_dc* helpers on top of it and convert all test files to the API plus the public accessors (dc_get_ctx, dc_get_current_state, dc_get_res_pool, dc_get_clk_mgr, ...), which are exported for the test modules with EXPORT_IF_KUNIT.
No test logic changes; only how the fakes are built.
Part of making struct dc private to DC.
--- .../display/amdgpu_dm/tests/amdgpu_dm_audio_test.c | 41 ++--- .../amdgpu_dm/tests/amdgpu_dm_backlight_test.c | 71 ++++---- .../display/amdgpu_dm/tests/amdgpu_dm_color_test.c | 21 +-- .../amdgpu_dm/tests/amdgpu_dm_colorop_test.c | 8 +- .../amdgpu_dm/tests/amdgpu_dm_connector_test.c | 62 ++++--- .../display/amdgpu_dm/tests/amdgpu_dm_crc_test.c | 5 +- .../display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c | 59 ++++--- .../display/amdgpu_dm/tests/amdgpu_dm_dmub_test.c | 74 ++++---- .../amdgpu_dm/tests/amdgpu_dm_freesync_test.c | 3 +- .../display/amdgpu_dm/tests/amdgpu_dm_hdcp_test.c | 23 ++- .../amdgpu_dm/tests/amdgpu_dm_helpers_test.c | 70 ++++---- .../display/amdgpu_dm/tests/amdgpu_dm_irq_test.c | 195 ++++++++++----------- .../display/amdgpu_dm/tests/amdgpu_dm_ism_test.c | 31 ++-- .../amdgpu_dm/tests/amdgpu_dm_kunit_helpers.c | 26 ++- .../amdgpu_dm/tests/amdgpu_dm_kunit_test_helpers.h | 1 + .../amdgpu_dm/tests/amdgpu_dm_mst_types_test.c | 81 ++++----- .../display/amdgpu_dm/tests/amdgpu_dm_plane_test.c | 73 ++++---- .../display/amdgpu_dm/tests/amdgpu_dm_psr_test.c | 21 +-- .../amd/display/amdgpu_dm/tests/amdgpu_dm_test.c | 53 +++--- .../display/amdgpu_dm/tests/amdgpu_dm_wb_test.c | 6 +- drivers/gpu/drm/amd/display/dc/Makefile | 4 + drivers/gpu/drm/amd/display/dc/core/dc_accessors.c | 7 + drivers/gpu/drm/amd/display/dc/core/dc_test.c | 135 ++++++++++++++ drivers/gpu/drm/amd/display/dc/inc/dc_test.h | 81 +++++++++ 24 files changed, 689 insertions(+), 462 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_audio_test.c +21 -20
@@ -18,6 +18,7 @@#include <drm/drm_probe_helper.h> #include "dc.h" +#include "dc_test.h" #include "dc/inc/core_types.h" #include "dc/inc/hw/audio.h" #include "amdgpu.h"
@@ -103,7 +104,7 @@ static void dm_test_audio_init_enabled_success(struct kunit *test)int saved_audio =amdgpu_dm_audio_get_param (); adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); - dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); + dc =dm_kunit_alloc_dc (test); res_pool =kunit_kzalloc (test,sizeof (*res_pool),GFP_KERNEL ); audio0 =kunit_kzalloc (test,sizeof (*audio0),GFP_KERNEL ); audio1 =kunit_kzalloc (test,sizeof (*audio1),GFP_KERNEL );
@@ -121,7 +122,7 @@ static void dm_test_audio_init_enabled_success(struct kunit *test) res_pool->audio_count =2 ; res_pool->audios[0 ] = audio0; res_pool->audios[1 ] = audio1; - dc->res_pool = res_pool; +dc_test_set_res_pool (dc, res_pool); adev->dm.dc = dc; adev->dev = dev;
@@ -810,16 +811,16 @@ static void dm_test_commit_audio_notifies_added_connector(struct kunit *test) adev->dm.dc =kunit_kzalloc (test,sizeof (*adev->dm.dc),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, adev->dm.dc); - adev->dm.dc->current_state =kunit_kzalloc (test, -sizeof (*adev->dm.dc->current_state), -GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, adev->dm.dc->current_state); +dc_test_set_current_state (adev->dm.dc,kunit_kzalloc (test, +sizeof (*dc_get_current_state (adev->dm.dc)), +GFP_KERNEL )); +KUNIT_ASSERT_NOT_NULL (test,dc_get_current_state (adev->dm.dc)); stream->ctx =kunit_kzalloc (test,sizeof (*stream->ctx),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, stream->ctx); stream->ctx->dc = adev->dm.dc; - adev->dm.dc->current_state->stream_count =1 ; - adev->dm.dc->current_state->streams[0 ] = stream; - adev->dm.dc->current_state->stream_status[0 ].audio_inst =8 ; +dc_get_current_state (adev->dm.dc)->stream_count =1 ; +dc_get_current_state (adev->dm.dc)->streams[0 ] = stream; +dc_get_current_state (adev->dm.dc)->stream_status[0 ].audio_inst =8 ;mutex_init (&adev->dm.audio_lock);dm_test_audio_setup_notify_component (test, adev);
@@ -968,10 +969,10 @@ static void dm_test_commit_audio_skips_without_stream_status(struct kunit *test) adev->dm.dc =kunit_kzalloc (test,sizeof (*adev->dm.dc),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, adev->dm.dc); - adev->dm.dc->current_state =kunit_kzalloc (test, -sizeof (*adev->dm.dc->current_state), -GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, adev->dm.dc->current_state); +dc_test_set_current_state (adev->dm.dc,kunit_kzalloc (test, +sizeof (*dc_get_current_state (adev->dm.dc)), +GFP_KERNEL )); +KUNIT_ASSERT_NOT_NULL (test,dc_get_current_state (adev->dm.dc)); stream->ctx =kunit_kzalloc (test,sizeof (*stream->ctx),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, stream->ctx); stream->ctx->dc = adev->dm.dc;
@@ -1173,16 +1174,16 @@ static void dm_test_commit_audio_skips_writeback_addition(struct kunit *test) adev->dm.dc =kunit_kzalloc (test,sizeof (*adev->dm.dc),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, adev->dm.dc); - adev->dm.dc->current_state =kunit_kzalloc (test, -sizeof (*adev->dm.dc->current_state), -GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, adev->dm.dc->current_state); +dc_test_set_current_state (adev->dm.dc,kunit_kzalloc (test, +sizeof (*dc_get_current_state (adev->dm.dc)), +GFP_KERNEL )); +KUNIT_ASSERT_NOT_NULL (test,dc_get_current_state (adev->dm.dc)); stream->ctx =kunit_kzalloc (test,sizeof (*stream->ctx),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, stream->ctx); stream->ctx->dc = adev->dm.dc; - adev->dm.dc->current_state->stream_count =1 ; - adev->dm.dc->current_state->streams[0 ] = stream; - adev->dm.dc->current_state->stream_status[0 ].audio_inst =14 ; +dc_get_current_state (adev->dm.dc)->stream_count =1 ; +dc_get_current_state (adev->dm.dc)->streams[0 ] = stream; +dc_get_current_state (adev->dm.dc)->stream_status[0 ].audio_inst =14 ;mutex_init (&adev->dm.audio_lock);dm_test_audio_setup_notify_component (test, adev);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_backlight_test.c +40 -31
193 lines not on this page · raw message
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_color_test.c +11 -10
@@ -13,6 +13,7 @@#include <uapi/drm/drm_mode.h> #include "dc.h" +#include "dc_test.h" #include "amdgpu.h" #include "amdgpu_mode.h" #include "amdgpu_dm.h"
@@ -1759,7 +1760,7 @@ dm_test_verify_lut3d_alloc_adev(struct kunit *test, bool has_3dlut) adev->dm.dc =kunit_kzalloc (test,sizeof (*adev->dm.dc),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, adev->dm.dc); - adev->dm.dc->caps.color.dpp.hw_3d_lut = has_3dlut; +dc_test_caps (adev->dm.dc)->color.dpp.hw_3d_lut = has_3dlut;return adev; }
@@ -2201,7 +2202,7 @@ static void dm_test_update_plane_color_mgmt_bad_lut3d(struct kunit *test) {struct dm_test_color_update_fixture f =dm_test_color_update_setup (test); - f.adev->dm.dc->caps.color.dpp.hw_3d_lut = true; +dc_test_caps (f.adev->dm.dc)->color.dpp.hw_3d_lut = true; f.dm_plane_state->lut3d =dm_test_make_lut_blob (test,128 ); KUNIT_EXPECT_EQ(test,
@@ -2385,7 +2386,7 @@ static void dm_test_update_plane_color_mgmt_legacy_luts(struct kunit *test)struct drm_plane_state *plane_state = &f.dm_plane_state->base;int ret; - f.adev->dm.dc->caps.color.dpp.hw_3d_lut = true; +dc_test_caps (f.adev->dm.dc)->color.dpp.hw_3d_lut = true; f.dm_plane_state->shaper_lut =dm_test_make_lut_blob (test,MAX_COLOR_LUT_ENTRIES ); f.dm_plane_state->lut3d =dm_test_make_lut_blob (test, lut3d_entries);
@@ -2537,7 +2538,7 @@ static void dm_test_update_plane_color_mgmt_colorop_bypass_pipeline(struct kunit };struct dm_test_color_update_fixture f =dm_test_color_update_setup (test); - f.adev->dm.dc->caps.color.dpp.hw_3d_lut = true; +dc_test_caps (f.adev->dm.dc)->color.dpp.hw_3d_lut = true; f.dm_plane_state->base.color_pipeline =dm_test_colorop_pipeline_setup (test, &f, types, curves, bypass,ARRAY_SIZE (types));
@@ -2635,7 +2636,7 @@ static void dm_test_update_plane_color_mgmt_colorop_truncated(struct kunit *teststruct dm_crtc_state *crtc_state = f.crtc_state;int count, ret; - f.adev->dm.dc->caps.color.dpp.hw_3d_lut = true; +dc_test_caps (f.adev->dm.dc)->color.dpp.hw_3d_lut = true;for (count =3 ; count <=ARRAY_SIZE (types); count++) { f.dm_plane_state->base.color_pipeline =
@@ -2681,11 +2682,11 @@ static void dm_test_update_plane_color_mgmt_colorop_no_3dlut_hw(struct kunit *te };struct dm_test_color_update_fixture f =dm_test_color_update_setup (test); - f.adev->dm.dc->caps.color.dpp.hw_3d_lut = true; +dc_test_caps (f.adev->dm.dc)->color.dpp.hw_3d_lut = true; f.dm_plane_state->base.color_pipeline =dm_test_colorop_pipeline_setup (test, &f, types, curves, bypass,ARRAY_SIZE (types)); - f.adev->dm.dc->caps.color.dpp.hw_3d_lut = false; +dc_test_caps (f.adev->dm.dc)->color.dpp.hw_3d_lut = false; KUNIT_EXPECT_EQ(test, amdgpu_dm_update_plane_color_mgmt(f.crtc_state, &f.dm_plane_state->base,
@@ -2729,7 +2730,7 @@ static void dm_test_update_plane_color_mgmt_colorop_shaper(struct kunit *test)struct drm_property_blob *blob;int ret; - f.adev->dm.dc->caps.color.dpp.hw_3d_lut = true; +dc_test_caps (f.adev->dm.dc)->color.dpp.hw_3d_lut = true; f.dm_plane_state->base.color_pipeline =dm_test_colorop_pipeline_setup (test, &f, types, curves, bypass,ARRAY_SIZE (types));
@@ -2784,7 +2785,7 @@ static void dm_test_update_plane_color_mgmt_colorop_3dlut(struct kunit *test)struct drm_property_blob *blob;int ret; - f.adev->dm.dc->caps.color.dpp.hw_3d_lut = true; +dc_test_caps (f.adev->dm.dc)->color.dpp.hw_3d_lut = true; f.dm_plane_state->base.color_pipeline =dm_test_colorop_pipeline_setup (test, &f, types, curves, bypass,ARRAY_SIZE (types));
@@ -2839,7 +2840,7 @@ static void dm_test_update_plane_color_mgmt_colorop_3dlut_no_data(struct kunit *struct drm_plane_state *plane_state = &f.dm_plane_state->base;int ret; - f.adev->dm.dc->caps.color.dpp.hw_3d_lut = true; +dc_test_caps (f.adev->dm.dc)->color.dpp.hw_3d_lut = true; f.dm_plane_state->base.color_pipeline =dm_test_colorop_pipeline_setup (test, &f, types, curves, bypass,ARRAY_SIZE (types));
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_colorop_test.c +4 -4
@@ -10,6 +10,7 @@#include <drm/drm_kunit_helpers.h> #include "dc.h" +#include "dc_test.h" #include "amdgpu.h" #include "amdgpu_dm_colorop.h" #include "amdgpu_dm_kunit_test_helpers.h"
@@ -231,11 +232,10 @@ static void dm_test_initialize_default_pipeline_caps(struct kunit *test, adev =dm_kunit_alloc_adev (test); drm = &adev->ddev; - dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, dc); + dc =dm_kunit_alloc_dc (test); adev->dm.dc = dc; - adev->dm.dc->caps.color.dpp.hw_3d_lut = dpp_hw_3d_lut; - adev->dm.dc->caps.color.mpc.preblend = mpc_preblend; +dc_test_caps (adev->dm.dc)->color.dpp.hw_3d_lut = dpp_hw_3d_lut; +dc_test_caps (adev->dm.dc)->color.mpc.preblend = mpc_preblend; plane =drm_kunit_helper_create_primary_plane (test, drm,NULL ,NULL ,NULL ,0 ,NULL );
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c +30 -32
173 lines not on this page · raw message
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crc_test.c +3 -2
@@ -16,6 +16,7 @@#include <drm/drm_vblank.h> #include "dc.h" +#include "dc_test.h" #include "core_types.h" #include "logger_types.h" #include "opp.h"
@@ -137,8 +138,8 @@ static struct dm_test_crc_dc_fixture *dm_test_alloc_crc_dc_fixture(struct kunitmutex_init (&adev->dm.dc_lock); adev->dm.dc = fixture->dc; - fixture->dc->ctx = fixture->dc_ctx; - fixture->dc->current_state = fixture->dc_state; +dc_test_set_ctx (fixture->dc, fixture->dc_ctx); +dc_test_set_current_state (fixture->dc, fixture->dc_state); fixture->dc_ctx->dc = fixture->dc; fixture->dc_ctx->logger = fixture->logger; fixture->link->dc = fixture->dc;
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c +30 -29
179 lines not on this page · raw message
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_dmub_test.c +35 -39
213 lines not on this page · raw message
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_freesync_test.c +2 -1
@@ -13,6 +13,7 @@#include <drm/drm_vblank.h> #include "dc.h" +#include "dc_test.h" #include "inc/core_types.h" #include "amd_shared.h" #include "amdgpu.h"
@@ -594,7 +595,7 @@ static void dm_test_update_freesync_state_pre_ai_active(struct kunit *test) stream->timing.v_total =1125 ; adev->dm.adev = adev; adev->dm.dc =dm_kunit_alloc_dc_with_ctx (test); - adev->dm.dc->current_state =dm_kunit_alloc_dc_state (test); +dc_test_set_current_state (adev->dm.dc,dm_kunit_alloc_dc_state (test));amdgpu_dm_update_freesync_state_on_stream (&adev->dm, &crtc_state, stream, surface,0 );
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_hdcp_test.c +11 -12
@@ -11,6 +11,7 @@#include <linux/slab.h> #include <linux/sysfs.h> #include <linux/i2c.h> +#include "dc_test.h" #include <drm/display/drm_dp_helper.h>
@@ -1161,7 +1162,7 @@ static void dm_test_hdcp_update_display_disable_resets_status_and_cancels_valida* dm_test_hdcp_create_workqueue_zero_max_links_returns_null - zero-link creation fails early * @test: KUnit test context * -* When dc->caps.max_links is zero, hdcp_create_workqueue() should fail +* When dc_test_caps(dc)->max_links is zero, hdcp_create_workqueue() should fail * the initial allocation path and return NULL. */ static void dm_test_hdcp_create_workqueue_zero_max_links_returns_null (struct kunit *test)
@@ -1170,10 +1171,9 @@ static void dm_test_hdcp_create_workqueue_zero_max_links_returns_null(struct kunstruct dc *dc;struct hdcp_workqueue *work; - dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, dc); + dc =dm_kunit_alloc_dc (test); - dc->caps.max_links =0 ; +dc_test_caps (dc)->max_links =0 ; work =hdcp_create_workqueue (NULL , &cp_psp, dc);
@@ -1200,9 +1200,9 @@ static void dm_test_hdcp_create_workqueue_initializes_work(struct kunit *test)/* sysfs_create_bin_file() needs a real device kobject. */ adev->dev = adev->ddev.dev; - dc->caps.max_links =1 ; +dc_test_caps (dc)->max_links =1 ;/* DCE_VERSION_UNKNOWN (0) is not in the DTM v3 list. */ - dc->ctx->dce_version =DCE_VERSION_UNKNOWN ; +dc_get_ctx (dc)->dce_version =DCE_VERSION_UNKNOWN ; work =hdcp_create_workqueue (adev, &cp_psp, dc);
@@ -1236,8 +1236,8 @@ static void dm_test_hdcp_create_workqueue_sets_dtm_v3_for_dcn31(struct kunit *testruct hdcp_workqueue *work; adev->dev = adev->ddev.dev; - dc->caps.max_links =1 ; - dc->ctx->dce_version =DCN_VERSION_3_1 ; +dc_test_caps (dc)->max_links =1 ; +dc_get_ctx (dc)->dce_version =DCN_VERSION_3_1 ; work =hdcp_create_workqueue (adev, &cp_psp, dc);
@@ -1264,8 +1264,8 @@ static void dm_test_hdcp_create_workqueue_initializes_all_links(struct kunit *teint i; adev->dev = adev->ddev.dev; - dc->caps.max_links =3 ; - dc->ctx->dce_version =DCN_VERSION_3_1 ; +dc_test_caps (dc)->max_links =3 ; +dc_get_ctx (dc)->dce_version =DCN_VERSION_3_1 ; work =hdcp_create_workqueue (adev, &cp_psp, dc);
@@ -2089,8 +2089,7 @@ static struct amdgpu_dm_connector *alloc_test_connector(struct kunit *test,KUNIT_ASSERT_NOT_NULL (test, aconnector); dc_link =kunit_kzalloc (test,sizeof (*dc_link),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, dc_link); - dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, dc); + dc =dm_kunit_alloc_dc (test);kref_init (&aconnector->base.base.refcount); aconnector->base.index = index;
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_helpers_test.c +32 -38
199 lines not on this page · raw message
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c +89 -106
518 lines not on this page · raw message
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_ism_test.c +16 -15
@@ -8,6 +8,7 @@#include <kunit/test.h> #include "dc.h" +#include "dc_test.h" #include "amdgpu.h" #include "amdgpu_mode.h" #include "amdgpu_dm.h"
@@ -1191,9 +1192,9 @@ static void dm_test_ism_dispatch_optimized_idle_defers_sso(struct kunit *test)* ===== Behavioural tests for dm_ism_commit_idle_optimization_state ===== * * The commit path runs the real DC calls. dc_allow_idle_optimizations() only -* reaches hardware through dc->hwss.apply_idle_power_optimizations(), so the +* reaches hardware through dc_test_hwss(dc)->apply_idle_power_optimizations(), so the * spy is installed there — DC's own seam — and the outcome is read back from -* dc->idle_optimizations_allowed. The callback fires only on an actual +* dc_is_idle_optimizations_allowed(dc). The callback fires only on an actual * transition, so the call count is the number of idle state changes requested. */
@@ -1236,12 +1237,12 @@ static struct dc_stream_state *setup_commit_test(struct kunit *test, logger =kunit_kzalloc (test,sizeof (*logger),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, logger); logger->dev = &adev->ddev; - dc->ctx->logger = logger; +dc_get_ctx (dc)->logger = logger;/* is_apu path avoids DC_LOG_DC()'s NULL-logger dereference. */ - dc->caps.is_apu = true; +dc_test_caps (dc)->is_apu = true;/* dc_allow() only calls apply() when clk_mgr is present. */ - dc->clk_mgr =dm_kunit_alloc_clk_mgr (test); - dc->hwss.apply_idle_power_optimizations = dm_ism_test_apply_idle; +dc_test_set_clk_mgr (dc,dm_kunit_alloc_clk_mgr (test)); +dc_test_hwss (dc)->apply_idle_power_optimizations = dm_ism_test_apply_idle; dm_ism_test_idle = (typeof (dm_ism_test_idle )){ };amdgpu_dm_ism_init (&acrtc->ism, config);
@@ -1281,7 +1282,7 @@ static void dm_test_ism_commit_allows_idle_on_optimized_idle(struct kunit *test)/* vblank disabled + no SSO -> a single allow-idle transition. */ KUNIT_EXPECT_EQ (test, dm_ism_test_idle.calls,1 );KUNIT_EXPECT_TRUE (test, dm_ism_test_idle.last_allow); -KUNIT_EXPECT_TRUE (test, adev->dm.dc->idle_optimizations_allowed); +KUNIT_EXPECT_TRUE (test,dc_is_idle_optimizations_allowed (adev->dm.dc));cancel_delayed_work (&acrtc->ism.sso_delayed_work); }
@@ -1308,7 +1309,7 @@ static void dm_test_ism_commit_enables_sso_on_optimized_idle_sso(struct kunit *t };setup_commit_test (test, acrtc, &config); - adev->dm.dc->idle_optimizations_allowed = true; +dc_test_set_idle_optimizations_allowed (adev->dm.dc, true); scoped_guard(mutex, &adev->dm.dc_lock) { amdgpu_dm_ism_commit_event(&acrtc->ism,
@@ -1320,7 +1321,7 @@ static void dm_test_ism_commit_enables_sso_on_optimized_idle_sso(struct kunit *t/* SSO engagement disallows idle, then re-allows it. */ KUNIT_EXPECT_EQ (test, dm_ism_test_idle.calls,2 );KUNIT_EXPECT_TRUE (test, dm_ism_test_idle.last_allow); -KUNIT_EXPECT_TRUE (test, adev->dm.dc->idle_optimizations_allowed); +KUNIT_EXPECT_TRUE (test,dc_is_idle_optimizations_allowed (adev->dm.dc)); }amdgpu_dm_ism_flush (&acrtc->ism);
@@ -1351,7 +1352,7 @@ static void dm_test_ism_commit_disallows_idle_on_timer_aborted(struct kunit *tes stream =setup_commit_test (test, acrtc, &config);setup_idle_delay_history (&acrtc->ism, stream); - adev->dm.dc->idle_optimizations_allowed = true; +dc_test_set_idle_optimizations_allowed (adev->dm.dc, true); scoped_guard(mutex, &adev->dm.dc_lock) {/* Non-zero delay parks the FSM in HYSTERESIS_WAITING. */
@@ -1369,7 +1370,7 @@ static void dm_test_ism_commit_disallows_idle_on_timer_aborted(struct kunit *tes/* TIMER_ABORTED commit runs with vblank_enabled=true. */ KUNIT_EXPECT_EQ (test, dm_ism_test_idle.calls,1 );KUNIT_EXPECT_FALSE (test, dm_ism_test_idle.last_allow); -KUNIT_EXPECT_FALSE (test, adev->dm.dc->idle_optimizations_allowed); +KUNIT_EXPECT_FALSE (test,dc_is_idle_optimizations_allowed (adev->dm.dc)); }amdgpu_dm_ism_flush (&acrtc->ism);
@@ -1409,7 +1410,7 @@ static void dm_test_ism_exit_from_optimized_idle_disallows_idle(struct kunit *te/* Allow on entry, disallow on exit. */ KUNIT_EXPECT_EQ (test, dm_ism_test_idle.calls,2 );KUNIT_EXPECT_FALSE (test, dm_ism_test_idle.last_allow); -KUNIT_EXPECT_FALSE (test, adev->dm.dc->idle_optimizations_allowed); +KUNIT_EXPECT_FALSE (test,dc_is_idle_optimizations_allowed (adev->dm.dc));/* The idle period was recorded on the way out. */ KUNIT_EXPECT_EQ (test, acrtc->ism.next_record_idx,1 ); }
@@ -1449,7 +1450,7 @@ static void dm_test_ism_exit_from_sso_disallows_idle(struct kunit *test)KUNIT_EXPECT_EQ (test, dm_ism_test_idle.calls,2 );KUNIT_EXPECT_FALSE (test, dm_ism_test_idle.last_allow); -KUNIT_EXPECT_FALSE (test, adev->dm.dc->idle_optimizations_allowed); +KUNIT_EXPECT_FALSE (test,dc_is_idle_optimizations_allowed (adev->dm.dc));KUNIT_EXPECT_EQ (test, acrtc->ism.next_record_idx,1 ); }
@@ -1495,7 +1496,7 @@ static void dm_test_ism_delayed_work_runs_timer_elapsed(struct kunit *test)KUNIT_EXPECT_EQ (test, (int )acrtc->ism.current_state, (int )DM_ISM_STATE_OPTIMIZED_IDLE_SSO );KUNIT_EXPECT_EQ (test, dm_ism_test_idle.calls,1 ); -KUNIT_EXPECT_TRUE (test, adev->dm.dc->idle_optimizations_allowed); +KUNIT_EXPECT_TRUE (test,dc_is_idle_optimizations_allowed (adev->dm.dc));amdgpu_dm_ism_flush (&acrtc->ism); }
@@ -1533,7 +1534,7 @@ static void dm_test_ism_sso_delayed_work_runs_sso_elapsed(struct kunit *test)KUNIT_EXPECT_EQ (test, (int )acrtc->ism.current_state, (int )DM_ISM_STATE_OPTIMIZED_IDLE_SSO );KUNIT_EXPECT_EQ (test, dm_ism_test_idle.calls,3 ); -KUNIT_EXPECT_TRUE (test, adev->dm.dc->idle_optimizations_allowed); +KUNIT_EXPECT_TRUE (test,dc_is_idle_optimizations_allowed (adev->dm.dc));amdgpu_dm_ism_flush (&acrtc->ism); }
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_kunit_helpers.c +18 -8
@@ -11,6 +11,7 @@#include <drm/drm_managed.h> #include "dc.h" +#include "dc_test.h" #include "core_types.h" #include "clk_mgr.h" #include "amdgpu.h"
@@ -47,18 +48,29 @@ struct dc_link *dm_kunit_alloc_link(struct kunit *test) }EXPORT_SYMBOL (dm_kunit_alloc_link); +struct dc *dm_kunit_alloc_dc (struct kunit *test) +{ +struct dc *dc; + + dc =dc_test_create (); +KUNIT_ASSERT_NOT_NULL (test, dc); +kunit_add_action (test, (kunit_action_t *)dc_test_destroy, dc); + +return dc; +} +EXPORT_SYMBOL (dm_kunit_alloc_dc); +struct dc *dm_kunit_alloc_dc_with_ctx (struct kunit *test) {struct dc_context *ctx;struct dc *dc; - dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, dc); + dc =dm_kunit_alloc_dc (test); ctx =kunit_kzalloc (test,sizeof (*ctx),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, ctx); - dc->ctx = ctx; +dc_test_set_ctx (dc, ctx); ctx->dc = dc;return dc;
@@ -72,7 +84,7 @@ struct dc_link *dm_kunit_alloc_link_with_ctx(struct kunit *test) link =dm_kunit_alloc_link (test); dc =dm_kunit_alloc_dc_with_ctx (test); - link->ctx = dc->ctx; + link->ctx =dc_get_ctx (dc);return link; }
@@ -87,14 +99,12 @@ struct amdgpu_display_manager *dm_kunit_alloc_dm(struct kunit *test) dm =kunit_kzalloc (test,sizeof (*dm),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, dm); - dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, dc); - + dc =dm_kunit_alloc_dc (test); state =kunit_kzalloc (test,sizeof (*state),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, state); dm->dc = dc; - dc->current_state = state; +dc_test_set_current_state (dc, state);return dm; }
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_kunit_test_helpers.h +1 -0
@@ -21,6 +21,7 @@ struct dc_stream_state;struct drm_device ;struct amdgpu_device *dm_kunit_alloc_adev (struct kunit *test); +struct dc *dm_kunit_alloc_dc (struct kunit *test);struct dc *dm_kunit_alloc_dc_with_ctx (struct kunit *test);struct dc_link *dm_kunit_alloc_link (struct kunit *test);struct dc_link *dm_kunit_alloc_link_with_ctx (struct kunit *test);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c +41 -40
281 lines not on this page · raw message
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +37 -36
218 lines not on this page · raw message
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_psr_test.c +11 -10
@@ -8,6 +8,7 @@#include <kunit/test.h> #include "dc.h" +#include "dc_test.h" #include "core_types.h" #include "amdgpu_mode.h" #include "amdgpu_dm.h"
@@ -50,7 +51,7 @@ static struct dc_link *alloc_test_psrsu_link(struct kunit *test)struct dc_context *ctx = link->ctx;struct dc *dc = ctx->dc; - dc->caps.dmcub_support = true; +dc_test_caps (dc)->dmcub_support = true; ctx->dce_version =DCN_VERSION_3_1 ; link->dpcd_caps.edp_rev =DP_EDP_14 ; link->dpcd_caps.psr_info.psr_version =DP_PSR2_WITH_Y_COORD_ET_SUPPORTED ;
@@ -64,7 +65,7 @@ static struct dc_link *alloc_test_psr_caps_link(struct kunit *test) {struct dc_link *link =alloc_test_psrsu_link (test); - link->ctx->dc->caps.dmub_caps.psr = true; +dc_test_caps (link->ctx->dc)->dmub_caps.psr = true; link->connector_signal =SIGNAL_TYPE_EDP ; link->type = dc_connection_single;
@@ -91,7 +92,7 @@ static void dm_test_link_supports_psrsu_no_dmcub(struct kunit *test) {struct dc_link *link =alloc_test_psrsu_link (test); - link->ctx->dc->caps.dmcub_support = false; +dc_test_caps (link->ctx->dc)->dmcub_support = false;KUNIT_EXPECT_FALSE (test,link_supports_psrsu (link)); }
@@ -232,7 +233,7 @@ static void dm_test_set_psr_caps_no_dmub_psr(struct kunit *test)struct amdgpu_dm_connector *aconnector =alloc_test_aconnector (test); link->psr_settings.psr_version =DC_PSR_VERSION_1 ; - link->ctx->dc->caps.dmub_caps.psr = false; +dc_test_caps (link->ctx->dc)->dmub_caps.psr = false;KUNIT_EXPECT_FALSE (test,amdgpu_dm_set_psr_caps (link, aconnector)); KUNIT_EXPECT_EQ(test, link->psr_settings.psr_version,
@@ -293,9 +294,9 @@ static void dm_test_set_psr_caps_edp1_disabled(struct kunit *test)struct dc *dc = link->ctx->dc; edp0->connector_signal =SIGNAL_TYPE_EDP ; - dc->links[0 ] = edp0; - dc->links[1 ] = link; - dc->link_count =2 ; +dc_test_set_link (dc,0 , edp0); +dc_test_set_link (dc,1 , link); +dc_test_set_link_count (dc,2 );KUNIT_EXPECT_FALSE (test,amdgpu_dm_set_psr_caps (link, aconnector)); }
@@ -647,7 +648,7 @@ static void dm_test_psr_is_active_allowed_no_streams(struct kunit *test)static void dm_test_psr_is_active_allowed_null_link (struct kunit *test) {struct amdgpu_display_manager *dm =dm_kunit_alloc_dm (test); -struct dc_state *state = dm->dc->current_state; +struct dc_state *state =dc_get_current_state (dm->dc);dm_kunit_add_stream_to_state (test, state,0 ,NULL );
@@ -662,7 +663,7 @@ static void dm_test_psr_is_active_allowed_null_link(struct kunit *test)static void dm_test_psr_is_active_allowed_requires_enabled_and_allowed (struct kunit *test) {struct amdgpu_display_manager *dm =dm_kunit_alloc_dm (test); -struct dc_state *state = dm->dc->current_state; +struct dc_state *state =dc_get_current_state (dm->dc);struct dc_link *link =dm_kunit_alloc_link (test);dm_kunit_add_stream_to_state (test, state,0 , link);
@@ -682,7 +683,7 @@ static void dm_test_psr_is_active_allowed_requires_enabled_and_allowed(struct kustatic void dm_test_psr_is_active_allowed_any_stream (struct kunit *test) {struct amdgpu_display_manager *dm =dm_kunit_alloc_dm (test); -struct dc_state *state = dm->dc->current_state; +struct dc_state *state =dc_get_current_state (dm->dc);struct dc_link *disabled_link =dm_kunit_alloc_link (test);struct dc_link *allowed_link =dm_kunit_alloc_link (test);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +27 -26
158 lines not on this page · raw message
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_wb_test.c +3 -3
@@ -18,6 +18,7 @@#include <drm/drm_writeback.h> #include "dc.h" +#include "dc_test.h" #include "amdgpu.h" #include "amdgpu_dm.h" #include "amdgpu_dm_wb.h"
@@ -495,13 +496,12 @@ static void dm_test_wb_connector_init_success(struct kunit *test) dm = &adev->dm; dm->adev = adev; - dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_NULL (test, dc); + dc =dm_kunit_alloc_dc (test); link =kunit_kzalloc (test,sizeof (*link),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, link); - dc->links[0 ] = link; +dc_test_set_link (dc,0 , link); dm->dc = dc; ret =amdgpu_dm_wb_connector_init (dm, wbcon,0 );
drivers/gpu/drm/amd/display/dc/Makefile +4 -0
@@ -92,5 +92,9 @@ FILES += bls_executor/bls_executor.o FILES += workaround_manager/workaround_manager.o FILES += dmub_messenger/dmub_messenger.o +ifneq ($(CONFIG_DRM_AMD_DC_KUNIT_TEST),) +FILES += core/dc_test.o +endif + AMD_DISPLAY_FILES += $(addprefix $(AMDDALPATH)/dc/, $(FILES))
drivers/gpu/drm/amd/display/dc/core/dc_accessors.c +7 -0
@@ -31,6 +31,7 @@* mapping stays obvious and auditable. */ #include "dc.h" +#include "dm_helpers.h" /* EXPORT_IF_KUNIT */ uint8_t dc_get_link_count (const struct dc *dc) {
@@ -41,6 +42,7 @@ struct dc_context *dc_get_ctx(const struct dc *dc) {return dc->ctx; } +EXPORT_IF_KUNIT (dc_get_ctx);enum dce_version dc_get_dce_version (const struct dc *dc) {
@@ -77,21 +79,25 @@ struct dc_state *dc_get_current_state(const struct dc *dc) {return dc->current_state; } +EXPORT_IF_KUNIT (dc_get_current_state);bool dc_is_idle_optimizations_allowed (const struct dc *dc) {return dc->idle_optimizations_allowed; } +EXPORT_IF_KUNIT (dc_is_idle_optimizations_allowed);struct resource_pool *dc_get_res_pool (const struct dc *dc) {return dc->res_pool; } +EXPORT_IF_KUNIT (dc_get_res_pool);struct clk_mgr *dc_get_clk_mgr (struct dc *dc) {return dc->clk_mgr; } +EXPORT_IF_KUNIT (dc_get_clk_mgr); bool dc_get_dcc_compression_cap(const struct dc *dc, const struct dc_dcc_surface_param *input,
@@ -139,6 +145,7 @@ bool dc_is_fbc_compressor_available(const struct dc *dc) {return dc->fbc_compressor !=NULL ; } +EXPORT_IF_KUNIT (dc_is_fbc_compressor_available);void dc_set_fbc_gpu_addr (struct dc *dc,uint64_t gpu_addr) {
drivers/gpu/drm/amd/display/dc/core/dc_test.c new file +135 -0
135 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/inc/dc_test.h new file +81 -0
81 lines not on this page · raw message
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH 12/19] drm/amd/display: Migrate amdgpu_dm KUnit tests off struct dc internals
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] drm/amd/display: CFI violation and unchecked kunit_add_action() in dm_kunit_alloc_dc() --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] drm/amd/display: CFI violation and unchecked kunit_add_action() in dm_kunit_alloc_dc()
--
commit 3e7024f14775977bb5d35f97fcb673f3cd943908
Author: Dave Airlie <[email protected]>
drm/amd/display: Migrate amdgpu_dm KUnit tests off struct dc internals
This commit adds a KUnit test double API for struct dc and converts the amdgpu_dm KUnit tests to use it instead of accessing struct dc fields directly.
Quoted 5 lines
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_kunit_helpers.c +0
-0
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_kunit_helpers.c struct dc_link *dm_kunit_alloc_link(struct kunit *test) · line 57
Quoted 10 lines
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_kunit_helpers.c +7
-0@@ -47,18 +48,29 @@ struct dc_link *dm_kunit_alloc_link(struct kunit *test) }EXPORT_SYMBOL (dm_kunit_alloc_link); +struct dc *dm_kunit_alloc_dc (struct kunit *test) +{ +struct dc *dc; + + dc =dc_test_create (); +KUNIT_ASSERT_NOT_NULL (test, dc); +kunit_add_action (test, (kunit_action_t *)dc_test_destroy, dc);
[Severity: Low]
Does casting dc_test_destroy() (which takes struct dc *) to kunit_action_t * (void (*)(void *)) trigger a KCFI failure on test teardown when built with CONFIG_CFI_CLANG? Also, kunit_add_action() can fail and leak dc if its return value is not checked, whereas KUNIT_DEFINE_ACTION_WRAPPER() with kunit_add_action_or_reset() avoids both issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=12
kernel test robot
build botRe: [PATCH 12/19] drm/amd/display: Migrate amdgpu_dm KUnit tests off struct dc internals
In reply to Dave Airliekernel test robot noticed the following build warnings:
Hi Dave,
kernel test robot noticed the following build warnings:
[auto build test WARNING on a6836fcbb5b22968019256025321d655b78bc49c]
url: https://github.com/intel-lab-lkp/linux/commits/Dave-Airlie-via-B4-Relay/drm-amd-display-Drop-the-dead-vmid-module/20261112-114336 base: a6836fcbb5b22968019256025321d655b78bc49c patch link: https://lore.kernel.org/r/20261112-amdgpu-dc-cleanup-v1-12-0fae41718ad2%40redhat.com patch subject: [PATCH 12/19] drm/amd/display: Migrate amdgpu_dm KUnit tests off struct dc internals config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20261117/[email protected]/config) compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261117/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/tests/amdgpu_dm_kunit_helpers.c:57:25: warning: cast from 'void (*)(struct dc *)' to 'kunit_action_t *' (aka 'void (*)(void *)') converts to incompatible function type [-Wcast-function-type-strict]
57 | kunit_add_action(test, (kunit_action_t *)dc_test_destroy, dc);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~1 warning generated.
vim +57 drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/tests/amdgpu_dm_kunit_helpers.c
50
51 struct dc *dm_kunit_alloc_dc(struct kunit *test)
52 {
53 struct dc *dc;
54
55 dc = dc_test_create();
56 KUNIT_ASSERT_NOT_NULL(test, dc);
> 57 kunit_add_action(test, (kunit_action_t *)dc_test_destroy, dc);
58
59 return dc;
60 }
61 EXPORT_SYMBOL(dm_kunit_alloc_dc);
62 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH 13/19 drm/amd/display: Move struct dc out of the public dc.h
In reply to Dave Airliestruct dc is now defined in the new dc/dc_priv.h, which must only be included from inside the dc directory. dc.h keeps the public API and public types and forward-declares struct dc; consumers outside DC hold opaque pointers and go through the accessor layer.
Also move the BW_VAL_TRACE_* macros, which dereference a dc-local variable, from dc.h into dc_priv.h.
Update DC-internal includes accordingly (~300 files gain an include of dc_priv.h next to their existing dc.h include or at the end of their include block). With this, code outside the dc directory can no longer compile against struct dc members: the compiler enforces the boundary.
--- .../display/amdgpu_dm/tests/amdgpu_dm_audio_test.c | 6 +- .../display/amdgpu_dm/tests/amdgpu_dm_color_test.c | 4 +- .../amdgpu_dm/tests/amdgpu_dm_connector_test.c | 12 +- .../display/amdgpu_dm/tests/amdgpu_dm_crc_test.c | 2 +- .../amdgpu_dm/tests/amdgpu_dm_freesync_test.c | 2 +- .../amdgpu_dm/tests/amdgpu_dm_helpers_test.c | 4 +- .../display/amdgpu_dm/tests/amdgpu_dm_plane_test.c | 2 +- drivers/gpu/drm/amd/display/dc/basics/dce_calcs.c | 1 + drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 1 + .../gpu/drm/amd/display/dc/bios/command_table2.c | 1 + .../drm/amd/display/dc/bls_builder/bls_builder.c | 1 + .../display/dc/bls_builder/dcn401_init_builder.c | 1 + .../dc/bls_builder/dcn401_init_builder_legacy.c | 1 + .../drm/amd/display/dc/bls_executor/bls_executor.c | 1 + drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c | 1 + .../amd/display/dc/clk_mgr/dce100/dce_clk_mgr.c | 1 + .../amd/display/dc/clk_mgr/dce110/dce110_clk_mgr.c | 1 + .../amd/display/dc/clk_mgr/dce112/dce112_clk_mgr.c | 1 + .../amd/display/dc/clk_mgr/dce120/dce120_clk_mgr.c | 1 + .../amd/display/dc/clk_mgr/dcn10/dcn10_clk_mgr.c | 1 + .../drm/amd/display/dc/clk_mgr/dcn10/rv1_clk_mgr.c | 1 + .../dc/clk_mgr/dcn10/rv1_clk_mgr_vbios_smu.c | 1 + .../amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c | 1 + .../amd/display/dc/clk_mgr/dcn201/dcn201_clk_mgr.c | 1 + .../drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c | 1 + .../dc/clk_mgr/dcn21/rn_clk_mgr_vbios_smu.c | 1 + .../amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c | 1 + .../drm/amd/display/dc/clk_mgr/dcn301/vg_clk_mgr.c | 1 + .../amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c | 1 + .../drm/amd/display/dc/clk_mgr/dcn31/dcn31_smu.c | 1 + .../amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.c | 1 + .../drm/amd/display/dc/clk_mgr/dcn314/dcn314_smu.c | 1 + .../amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c | 1 + .../drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.c | 1 + .../amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.c | 1 + .../drm/amd/display/dc/clk_mgr/dcn316/dcn316_smu.c | 1 + .../amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c | 1 + .../amd/display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c | 1 + .../drm/amd/display/dc/clk_mgr/dcn35/dcn35_smu.c | 1 + .../amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c | 1 + .../amd/display/dc/clk_mgr/dcn42/dcn42_clk_mgr.c | 1 + .../drm/amd/display/dc/clk_mgr/dcn42/dcn42_smu.c | 1 + .../amd/display/dc/clk_mgr/dcn42b/dcn42b_clk_mgr.c | 1 + .../amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c | 1 + drivers/gpu/drm/amd/display/dc/core/dc_accessors.c | 1 + drivers/gpu/drm/amd/display/dc/core/dc_debug.c | 1 + .../gpu/drm/amd/display/dc/core/dc_hw_sequencer.c | 1 + .../gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c | 1 + .../gpu/drm/amd/display/dc/core/dc_link_exports.c | 1 + drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 1 + drivers/gpu/drm/amd/display/dc/core/dc_stat.c | 1 + drivers/gpu/drm/amd/display/dc/core/dc_state.c | 1 + drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 1 + drivers/gpu/drm/amd/display/dc/core/dc_surface.c | 1 + drivers/gpu/drm/amd/display/dc/core/dc_test.c | 1 + drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c | 1 + drivers/gpu/drm/amd/display/dc/dc.h | 131 --------------- .../drm/amd/display/dc/dc_api_dispatch/api_shim.h | 1 + drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 1 + drivers/gpu/drm/amd/display/dc/dc_priv.h | 186 +++++++++++++++++++++ drivers/gpu/drm/amd/display/dc/dc_spl_translate.c | 1 + .../gpu/drm/amd/display/dc/dccg/dcn31/dcn31_dccg.c | 1 + .../drm/amd/display/dc/dccg/dcn314/dcn314_dccg.c | 1 + .../gpu/drm/amd/display/dc/dccg/dcn35/dcn35_dccg.c | 1 + .../drm/amd/display/dc/dccg/dcn401/dcn401_dccg.c | 1 + .../gpu/drm/amd/display/dc/dccg/dcn42/dcn42_dccg.c | 1 + drivers/gpu/drm/amd/display/dc/dce/dce_aux.c | 1 + .../gpu/drm/amd/display/dc/dce/dce_clock_source.c | 1 + drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c | 1 + drivers/gpu/drm/amd/display/dc/dce/dce_i2c.c | 1 + drivers/gpu/drm/amd/display/dc/dce/dce_i2c_hw.c | 1 + .../gpu/drm/amd/display/dc/dce/dce_link_encoder.c | 1 + drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c | 1 + drivers/gpu/drm/amd/display/dc/dce/dce_transform.c | 1 + drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c | 1 + drivers/gpu/drm/amd/display/dc/dce/dmub_abm_cacp.c | 1 + drivers/gpu/drm/amd/display/dc/dce/dmub_abm_lcd.c | 1 + .../gpu/drm/amd/display/dc/dce/dmub_hw_lock_mgr.c | 1 + drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c | 1 + drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c | 1 + .../drm/amd/display/dc/dce110/dce110_mem_input_v.c | 1 + .../drm/amd/display/dc/dce110/dce110_transform_v.c | 1 + .../display/dc/dcn10/dcn10_hw_sequencer_debug.c | 1 + .../amd/display/dc/dcn201/dcn201_link_encoder.c | 1 + .../drm/amd/display/dc/dcn21/dcn21_link_encoder.c | 1 + drivers/gpu/drm/amd/display/dc/dcn31/dcn31_afmt.c | 1 + .../drm/amd/display/dc/dcn31/dcn31_panel_cntl.c | 1 + drivers/gpu/drm/amd/display/dc/dcn31/dcn31_vpg.c | 1 + .../amd/display/dc/dio/dcn10/dcn10_link_encoder.c | 1 + .../display/dc/dio/dcn10/dcn10_stream_encoder.c | 1 + .../amd/display/dc/dio/dcn20/dcn20_link_encoder.c | 1 + .../display/dc/dio/dcn20/dcn20_stream_encoder.c | 1 + .../display/dc/dio/dcn30/dcn30_dio_link_encoder.c | 1 + .../dc/dio/dcn30/dcn30_dio_stream_encoder.c | 1 + .../dc/dio/dcn301/dcn301_dio_link_encoder.c | 1 + .../display/dc/dio/dcn31/dcn31_dio_link_encoder.c | 1 + .../dc/dio/dcn314/dcn314_dio_stream_encoder.c | 1 + .../display/dc/dio/dcn32/dcn32_dio_link_encoder.c | 1 + .../dc/dio/dcn32/dcn32_dio_stream_encoder.c | 1 + .../dc/dio/dcn321/dcn321_dio_link_encoder.c | 1 + .../display/dc/dio/dcn35/dcn35_dio_link_encoder.c | 1 + .../dc/dio/dcn35/dcn35_dio_stream_encoder.c | 1 + .../dc/dio/dcn401/dcn401_dio_link_encoder.c | 1 + .../dc/dio/dcn401/dcn401_dio_stream_encoder.c | 1 + .../display/dc/dio/dcn42/dcn42_dio_link_encoder.c | 1 + .../dc/dio/dcn42/dcn42_dio_stream_encoder.c | 1 + .../display/dc/dio/dcn60/dcn60_dio_link_encoder.c | 1 + .../dc/dio/dcn60/dcn60_dio_stream_encoder.c | 1 + .../gpu/drm/amd/display/dc/dml/calcs/dcn_calcs.c | 1 + .../gpu/drm/amd/display/dc/dml/dcn10/dcn10_fpu.c | 1 + .../gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c | 1 + .../gpu/drm/amd/display/dc/dml/dcn30/dcn30_fpu.c | 1 + .../gpu/drm/amd/display/dc/dml/dcn301/dcn301_fpu.c | 1 + .../gpu/drm/amd/display/dc/dml/dcn302/dcn302_fpu.c | 1 + .../gpu/drm/amd/display/dc/dml/dcn303/dcn303_fpu.c | 1 + .../gpu/drm/amd/display/dc/dml/dcn31/dcn31_fpu.c | 1 + .../gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c | 1 + .../gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c | 1 + .../gpu/drm/amd/display/dc/dml/dcn321/dcn321_fpu.c | 1 + .../gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.c | 1 + .../gpu/drm/amd/display/dc/dml/dcn351/dcn351_fpu.c | 1 + .../dml21_wrapper/dml21_translation_helper.c | 1 + .../dc/dml2_wrapper/dml21_wrapper/dml21_utils.c | 1 + .../dml2_wrapper/dml21_wrapper/dml21_wrapper_fpu.c | 1 + .../dc/dml2_wrapper/dml2_dc_resource_mgmt.c | 1 + .../display/dc/dml2_wrapper/dml2_mall_phantom.c | 1 + .../dc/dml2_wrapper/dml2_translation_helper.c | 1 + .../drm/amd/display/dc/dml2_wrapper/dml2_utils.c | 1 + .../drm/amd/display/dc/dml2_wrapper/dml2_wrapper.c | 1 + .../amd/display/dc/dml2_wrapper/dml2_wrapper_fpu.c | 1 + .../gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp.c | 1 + .../drm/amd/display/dc/dpp/dcn10/dcn10_dpp_dscl.c | 1 + .../drm/amd/display/dc/dpp/dcn20/dcn20_dpp_cm.c | 1 + .../gpu/drm/amd/display/dc/dpp/dcn201/dcn201_dpp.c | 1 + .../gpu/drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c | 1 + .../drm/amd/display/dc/dpp/dcn30/dcn30_dpp_cm.c | 1 + .../amd/display/dc/dpp/dcn401/dcn401_dpp_dscl.c | 1 + .../drm/amd/display/dc/dpp/dcn60/dcn60_dpp_cm.c | 1 + .../drm/amd/display/dc/dpp/dcn60/dcn60_dpp_dscl.c | 1 + drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c | 1 + drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c | 1 + .../dc/hpo/dcn30/dcn30_hpo_frl_link_encoder.c | 1 + .../drm/amd/display/dc/hubbub/dcn10/dcn10_hubbub.c | 1 + .../drm/amd/display/dc/hubbub/dcn20/dcn20_hubbub.c | 1 + .../amd/display/dc/hubbub/dcn201/dcn201_hubbub.c | 1 + .../drm/amd/display/dc/hubbub/dcn21/dcn21_hubbub.c | 1 + .../drm/amd/display/dc/hubbub/dcn30/dcn30_hubbub.c | 1 + .../drm/amd/display/dc/hubbub/dcn31/dcn31_hubbub.c | 1 + .../drm/amd/display/dc/hubbub/dcn32/dcn32_hubbub.c | 1 + .../drm/amd/display/dc/hubbub/dcn35/dcn35_hubbub.c | 1 + .../amd/display/dc/hubbub/dcn401/dcn401_hubbub.c | 1 + .../drm/amd/display/dc/hubbub/dcn42/dcn42_hubbub.c | 1 + .../drm/amd/display/dc/hubbub/dcn60/dcn60_hubbub.c | 1 + .../gpu/drm/amd/display/dc/hubp/dcn21/dcn21_hubp.c | 1 + .../gpu/drm/amd/display/dc/hubp/dcn35/dcn35_hubp.c | 1 + .../gpu/drm/amd/display/dc/hubp/dcn42/dcn42_hubp.c | 1 + .../gpu/drm/amd/display/dc/hwss/dce/dce_hwseq.c | 1 + .../drm/amd/display/dc/hwss/dce100/dce100_hwseq.c | 1 + .../drm/amd/display/dc/hwss/dce110/dce110_hwseq.c | 1 + .../drm/amd/display/dc/hwss/dce112/dce112_hwseq.c | 1 + .../drm/amd/display/dc/hwss/dce120/dce120_hwseq.c | 1 + .../drm/amd/display/dc/hwss/dce60/dce60_hwseq.c | 1 + .../drm/amd/display/dc/hwss/dce80/dce80_hwseq.c | 1 + .../drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 1 + .../gpu/drm/amd/display/dc/hwss/dcn10/dcn10_init.c | 1 + .../drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 1 + .../gpu/drm/amd/display/dc/hwss/dcn20/dcn20_init.c | 1 + .../drm/amd/display/dc/hwss/dcn201/dcn201_hwseq.c | 1 + .../drm/amd/display/dc/hwss/dcn201/dcn201_init.c | 1 + .../drm/amd/display/dc/hwss/dcn21/dcn21_hwseq.c | 1 + .../gpu/drm/amd/display/dc/hwss/dcn21/dcn21_init.c | 1 + .../drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c | 1 + .../gpu/drm/amd/display/dc/hwss/dcn30/dcn30_init.c | 1 + .../drm/amd/display/dc/hwss/dcn301/dcn301_init.c | 1 + .../drm/amd/display/dc/hwss/dcn302/dcn302_hwseq.c | 1 + .../drm/amd/display/dc/hwss/dcn302/dcn302_init.c | 1 + .../drm/amd/display/dc/hwss/dcn303/dcn303_init.c | 1 + .../drm/amd/display/dc/hwss/dcn31/dcn31_hwseq.c | 1 + .../gpu/drm/amd/display/dc/hwss/dcn31/dcn31_init.c | 1 + .../drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.c | 1 + .../drm/amd/display/dc/hwss/dcn314/dcn314_init.c | 1 + .../drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c | 1 + .../gpu/drm/amd/display/dc/hwss/dcn32/dcn32_init.c | 1 + .../drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c | 1 + .../gpu/drm/amd/display/dc/hwss/dcn35/dcn35_init.c | 1 + .../drm/amd/display/dc/hwss/dcn351/dcn351_hwseq.c | 1 + .../drm/amd/display/dc/hwss/dcn351/dcn351_init.c | 1 + .../drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 1 + .../drm/amd/display/dc/hwss/dcn401/dcn401_init.c | 1 + .../drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.c | 1 + .../gpu/drm/amd/display/dc/hwss/dcn42/dcn42_init.c | 1 + .../drm/amd/display/dc/hwss/dcn42b/dcn42b_hwseq.c | 1 + .../drm/amd/display/dc/hwss/dcn42b/dcn42b_init.c | 1 + .../drm/amd/display/dc/hwss/dcn50/dcn50_hwseq.c | 1 + .../drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.c | 1 + .../gpu/drm/amd/display/dc/hwss/dcn60/dcn60_init.c | 1 + .../amd/display/dc/irq/dce110/irq_service_dce110.c | 1 + .../amd/display/dc/link/accessories/link_dp_cts.c | 1 + .../display/dc/link/accessories/link_dp_trace.c | 1 + .../drm/amd/display/dc/link/hwss/link_hwss_dio.c | 1 + .../link/hwss/link_hwss_dio_fixed_vs_pe_retimer.c | 1 + .../drm/amd/display/dc/link/hwss/link_hwss_dpia.c | 1 + .../amd/display/dc/link/hwss/link_hwss_hpo_dp.c | 1 + .../hwss/link_hwss_hpo_fixed_vs_pe_retimer_dp.c | 1 + .../amd/display/dc/link/hwss/link_hwss_hpo_frl.c | 1 + .../gpu/drm/amd/display/dc/link/link_detection.c | 1 + drivers/gpu/drm/amd/display/dc/link/link_dpms.c | 1 + drivers/gpu/drm/amd/display/dc/link/link_factory.c | 1 + .../gpu/drm/amd/display/dc/link/link_resource.c | 1 + .../gpu/drm/amd/display/dc/link/link_validation.c | 1 + .../drm/amd/display/dc/link/protocols/link_ddc.c | 1 + .../display/dc/link/protocols/link_dp_capability.c | 1 + .../display/dc/link/protocols/link_dp_dpia_bw.c | 1 + .../dc/link/protocols/link_dp_irq_handler.c | 1 + .../dc/link/protocols/link_dp_panel_replay.c | 1 + .../amd/display/dc/link/protocols/link_dp_phy.c | 1 + .../display/dc/link/protocols/link_dp_training.c | 1 + .../dc/link/protocols/link_dp_training_128b_132b.c | 1 + .../dc/link/protocols/link_dp_training_8b_10b.c | 1 + .../dc/link/protocols/link_dp_training_dpia.c | 1 + .../link_dp_training_fixed_vs_pe_retimer.c | 1 + .../dc/link/protocols/link_edp_panel_control.c | 1 + .../amd/display/dc/link/protocols/link_hdmi_frl.c | 1 + .../gpu/drm/amd/display/dc/mpc/dcn20/dcn20_mpc.c | 1 + .../gpu/drm/amd/display/dc/mpc/dcn30/dcn30_mpc.c | 1 + .../gpu/drm/amd/display/dc/mpc/dcn32/dcn32_mpc.c | 1 + .../gpu/drm/amd/display/dc/mpc/dcn401/dcn401_mpc.c | 1 + .../gpu/drm/amd/display/dc/mpc/dcn60/dcn60_mpc.c | 1 + .../gpu/drm/amd/display/dc/opp/dcn10/dcn10_opp.c | 1 + .../gpu/drm/amd/display/dc/opp/dcn20/dcn20_opp.c | 1 + .../gpu/drm/amd/display/dc/optc/dcn30/dcn30_optc.c | 1 + .../gpu/drm/amd/display/dc/optc/dcn32/dcn32_optc.c | 1 + .../gpu/drm/amd/display/dc/optc/dcn35/dcn35_optc.c | 1 + .../drm/amd/display/dc/optc/dcn401/dcn401_optc.c | 1 + .../gpu/drm/amd/display/dc/optc/dcn42/dcn42_optc.c | 1 + .../drm/amd/display/dc/pg/dcn35/dcn35_pg_cntl.c | 1 + .../drm/amd/display/dc/pg/dcn42/dcn42_pg_cntl.c | 1 + .../display/dc/resource/dce100/dce100_resource.c | 1 + .../display/dc/resource/dce110/dce110_resource.c | 1 + .../display/dc/resource/dce112/dce112_resource.c | 1 + .../display/dc/resource/dce120/dce120_resource.c | 1 + .../amd/display/dc/resource/dce60/dce60_resource.c | 1 + .../amd/display/dc/resource/dce80/dce80_resource.c | 1 + .../amd/display/dc/resource/dcn10/dcn10_resource.c | 1 + .../amd/display/dc/resource/dcn20/dcn20_resource.c | 1 + .../display/dc/resource/dcn201/dcn201_resource.c | 1 + .../amd/display/dc/resource/dcn21/dcn21_resource.c | 1 + .../amd/display/dc/resource/dcn30/dcn30_resource.c | 1 + .../display/dc/resource/dcn301/dcn301_resource.c | 1 + .../display/dc/resource/dcn302/dcn302_resource.c | 1 + .../display/dc/resource/dcn303/dcn303_resource.c | 1 + .../amd/display/dc/resource/dcn31/dcn31_resource.c | 1 + .../display/dc/resource/dcn314/dcn314_resource.c | 1 + .../display/dc/resource/dcn315/dcn315_resource.c | 1 + .../display/dc/resource/dcn316/dcn316_resource.c | 1 + .../amd/display/dc/resource/dcn32/dcn32_resource.c | 1 + .../dc/resource/dcn32/dcn32_resource_helpers.c | 1 + .../display/dc/resource/dcn321/dcn321_resource.c | 1 + .../amd/display/dc/resource/dcn35/dcn35_resource.c | 1 + .../display/dc/resource/dcn351/dcn351_resource.c | 1 + .../amd/display/dc/resource/dcn36/dcn36_resource.c | 1 + .../display/dc/resource/dcn401/dcn401_resource.c | 1 + .../amd/display/dc/resource/dcn42/dcn42_resource.c | 1 + .../display/dc/resource/dcn42/dcn42_resource_fpu.c | 1 + .../display/dc/resource/dcn42b/dcn42b_resource.c | 1 + .../amd/display/dc/resource/dcn60/dcn60_resource.c | 1 + .../gpu/drm/amd/display/dc/rmcm/dcn42/dcn42_rmcm.c | 1 + .../gpu/drm/amd/display/dc/rmcm/dcn60/dcn60_rmcm.c | 1 + .../dcn401/dcn401_soc_and_ip_translator.c | 1 + .../dcn42/dcn42_soc_and_ip_translator.c | 1 + .../dcn60/dcn60_soc_and_ip_translator.c | 1 + 271 files changed, 464 insertions(+), 147 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_audio_test.c +3 -3
@@ -809,7 +809,7 @@ static void dm_test_commit_audio_notifies_added_connector(struct kunit *test)KUNIT_ASSERT_NOT_NULL (test, dm_crtc_state);KUNIT_ASSERT_NOT_NULL (test, stream); - adev->dm.dc =kunit_kzalloc (test,sizeof (*adev->dm.dc),GFP_KERNEL ); + adev->dm.dc =dm_kunit_alloc_dc (test);KUNIT_ASSERT_NOT_NULL (test, adev->dm.dc); dc_test_set_current_state(adev->dm.dc, kunit_kzalloc(test, sizeof(*dc_get_current_state(adev->dm.dc)),
@@ -967,7 +967,7 @@ static void dm_test_commit_audio_skips_without_stream_status(struct kunit *test)KUNIT_ASSERT_NOT_NULL (test, dm_crtc_state);KUNIT_ASSERT_NOT_NULL (test, stream); - adev->dm.dc =kunit_kzalloc (test,sizeof (*adev->dm.dc),GFP_KERNEL ); + adev->dm.dc =dm_kunit_alloc_dc (test);KUNIT_ASSERT_NOT_NULL (test, adev->dm.dc); dc_test_set_current_state(adev->dm.dc, kunit_kzalloc(test, sizeof(*dc_get_current_state(adev->dm.dc)),
@@ -1172,7 +1172,7 @@ static void dm_test_commit_audio_skips_writeback_addition(struct kunit *test)KUNIT_ASSERT_NOT_NULL (test, dm_crtc_state);KUNIT_ASSERT_NOT_NULL (test, stream); - adev->dm.dc =kunit_kzalloc (test,sizeof (*adev->dm.dc),GFP_KERNEL ); + adev->dm.dc =dm_kunit_alloc_dc (test);KUNIT_ASSERT_NOT_NULL (test, adev->dm.dc); dc_test_set_current_state(adev->dm.dc, kunit_kzalloc(test, sizeof(*dc_get_current_state(adev->dm.dc)),
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_color_test.c +2 -2
@@ -1758,7 +1758,7 @@ dm_test_verify_lut3d_alloc_adev(struct kunit *test, bool has_3dlut) {struct amdgpu_device *adev =dm_kunit_alloc_adev (test); - adev->dm.dc =kunit_kzalloc (test,sizeof (*adev->dm.dc),GFP_KERNEL ); + adev->dm.dc =dm_kunit_alloc_dc (test);KUNIT_ASSERT_NOT_NULL (test, adev->dm.dc);dc_test_caps (adev->dm.dc)->color.dpp.hw_3d_lut = has_3dlut;
@@ -2060,7 +2060,7 @@ dm_test_color_update_setup(struct kunit *test)struct dm_test_color_update_fixture f = {0 }; f.adev =dm_kunit_alloc_adev (test); - f.adev->dm.dc =kunit_kzalloc (test,sizeof (*f.adev->dm.dc),GFP_KERNEL ); + f.adev->dm.dc =dm_kunit_alloc_dc (test);KUNIT_ASSERT_NOT_NULL (test, f.adev->dm.dc); f.state =kunit_kzalloc (test,sizeof (*f.state),GFP_KERNEL );
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c +6 -6
@@ -3041,7 +3041,7 @@ static struct dm_test_fbc_ctx *dm_test_fbc_ctx_alloc(struct kunit *test)KUNIT_ASSERT_NOT_NULL (test, ctx->adev); ctx->aconnector =kunit_kzalloc (test,sizeof (*ctx->aconnector),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, ctx->aconnector); - ctx->dc =kunit_kzalloc (test,sizeof (*ctx->dc),GFP_KERNEL ); + ctx->dc =dm_kunit_alloc_dc (test);KUNIT_ASSERT_NOT_NULL (test, ctx->dc); ctx->link =kunit_kzalloc (test,sizeof (*ctx->link),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, ctx->link);
@@ -5073,7 +5073,7 @@ static struct dm_test_poll_ctx *dm_test_poll_ctx_alloc(struct kunit *test) DRM_MODE_CONNECTOR_VGA, NULL), 0);mutex_init (&ctx->aconnector->hpd_lock); - ctx->dc =kunit_kzalloc (test,sizeof (*ctx->dc),GFP_KERNEL ); + ctx->dc =dm_kunit_alloc_dc (test);KUNIT_ASSERT_NOT_NULL (test, ctx->dc); ctx->link_srv =kunit_kzalloc (test,sizeof (*ctx->link_srv),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, ctx->link_srv);
@@ -6458,7 +6458,7 @@ static struct dm_test_i2c_ctx *dm_test_i2c_setup(struct kunit *test)KUNIT_ASSERT_NOT_NULL (test, ctx->ddc); ctx->dc_ctx =kunit_kzalloc (test,sizeof (*ctx->dc_ctx),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, ctx->dc_ctx); - ctx->dc =kunit_kzalloc (test,sizeof (*ctx->dc),GFP_KERNEL ); + ctx->dc =dm_kunit_alloc_dc (test);KUNIT_ASSERT_NOT_NULL (test, ctx->dc); ctx->link =kunit_kzalloc (test,sizeof (*ctx->link),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, ctx->link);
@@ -7382,7 +7382,7 @@ static struct dm_test_cvs_dc *dm_test_cvs_dc_alloc(struct kunit *test) pool->timing_generators[0 ] = tg; pool->timing_generator_count =0 ; - c->dc =kunit_kzalloc (test,sizeof (*c->dc),GFP_KERNEL ); + c->dc =dm_kunit_alloc_dc (test);KUNIT_ASSERT_NOT_NULL (test, c->dc);dc_test_set_ctx (c->dc, dcc);dc_test_set_res_pool (c->dc, pool);
@@ -8476,7 +8476,7 @@ dm_test_gm_ctx_alloc(struct kunit *test, int connector_type) &ctx->aenc->base);KUNIT_ASSERT_EQ (test, ret,0 ); - ctx->dc =kunit_kzalloc (test,sizeof (*ctx->dc),GFP_KERNEL ); + ctx->dc =dm_kunit_alloc_dc (test);KUNIT_ASSERT_NOT_NULL (test, ctx->dc); ctx->link_srv =kunit_kzalloc (test,sizeof (*ctx->link_srv),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, ctx->link_srv);
@@ -9072,7 +9072,7 @@ static struct dm_test_frl_ctx *dm_test_frl_ctx_alloc(struct kunit *test) ctx->dm =kunit_kzalloc (test,sizeof (*ctx->dm),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, ctx->dm); - ctx->dc =kunit_kzalloc (test,sizeof (*ctx->dc),GFP_KERNEL ); + ctx->dc =dm_kunit_alloc_dc (test);KUNIT_ASSERT_NOT_NULL (test, ctx->dc); ctx->link_srv =kunit_kzalloc (test,sizeof (*ctx->link_srv),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, ctx->link_srv);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crc_test.c +1 -1
@@ -121,7 +121,7 @@ static struct dm_test_crc_dc_fixture *dm_test_alloc_crc_dc_fixture(struct kunit fixture->dm_state =kunit_kzalloc (test,sizeof (*fixture->dm_state),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, fixture->dm_state); - fixture->dc =kunit_kzalloc (test,sizeof (*fixture->dc),GFP_KERNEL ); + fixture->dc =dm_kunit_alloc_dc (test);KUNIT_ASSERT_NOT_NULL (test, fixture->dc); fixture->dc_ctx =kunit_kzalloc (test,sizeof (*fixture->dc_ctx),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, fixture->dc_ctx);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_freesync_test.c +1 -1
@@ -851,7 +851,7 @@ static void dm_test_handle_vrr_transition_round_trip(struct kunit *test) vblank =drm_crtc_vblank_crtc (&acrtc->base); adev->ddev.vblank[0 ].enabled = true; adev->dm.adev = adev; - adev->dm.dc =kunit_kzalloc (test,sizeof (*adev->dm.dc),GFP_KERNEL ); + adev->dm.dc =dm_kunit_alloc_dc (test);KUNIT_ASSERT_NOT_NULL (test, adev->dm.dc);mutex_init (&adev->dm.dc_lock);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_helpers_test.c +2 -2
@@ -2550,7 +2550,7 @@ static void dm_test_dmub_aux_transfer_sync_hpd_connected(struct kunit *test) adev =dm_kunit_alloc_adev (test);KUNIT_ASSERT_NOT_NULL (test, adev); - ctx =dm_kunit_alloc_dc_with_ctx (test)->ctx; + ctx =dc_get_ctx (dm_kunit_alloc_dc_with_ctx (test)); link =dm_kunit_alloc_link (test); ctx->driver_context = adev;
@@ -4454,7 +4454,7 @@ static struct dm_test_local_edid dm_test_setup_local_edid(struct kunit *test)KUNIT_ASSERT_NOT_NULL (test, fixture.ctx); fixture.sink =kunit_kzalloc (test,sizeof (*fixture.sink),GFP_KERNEL );KUNIT_ASSERT_NOT_NULL (test, fixture.sink); - fixture.dc =kunit_kzalloc (test,sizeof (*fixture.dc),GFP_KERNEL ); + fixture.dc =dm_kunit_alloc_dc (test);KUNIT_ASSERT_NOT_NULL (test, fixture.dc); fixture.link =dm_kunit_alloc_link (test); dc_edid =kunit_kzalloc (test,sizeof (*dc_edid),GFP_KERNEL );
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c +1 -1
@@ -87,7 +87,7 @@ static void dm_test_init_validate_dcc_inputs(struct amdgpu_device **adev, struct kunit *test) { *adev =kunit_kzalloc (test,sizeof (**adev),GFP_KERNEL ); - *dc =kunit_kzalloc (test,sizeof (**dc),GFP_KERNEL ); + *dc =dm_kunit_alloc_dc (test);KUNIT_ASSERT_NOT_NULL (test, *adev);KUNIT_ASSERT_NOT_NULL (test, *dc);
drivers/gpu/drm/amd/display/dc/basics/dce_calcs.c +1 -0
@@ -27,6 +27,7 @@#include "dm_services.h" #include "dce_calcs.h" #include "dc.h" +#include "dc_priv.h" #include "core_types.h" #include "dal_asic_id.h" #include "calcs_logger.h"
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +1 -0
@@ -43,6 +43,7 @@#include "bios_parser_interface.h" #include "bios_parser_common.h" +#include "dc_priv.h" #define DC_LOGGER \ bp->base.ctx->logger
drivers/gpu/drm/amd/display/dc/bios/command_table2.c +1 -0
@@ -39,6 +39,7 @@#include "dc_dmub_srv.h" #include "dc.h" +#include "dc_priv.h" #define DC_LOGGER \ bp->base.ctx->logger
drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder.c +1 -0
@@ -5,6 +5,7 @@#include "dm_services.h" #include "bls_builder/bls_builder_internal.h" +#include "dc_priv.h" const struct bls_builder *bls_builder_create (struct dc *dc,enum bls_builder_name name)
drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_init_builder.c +1 -0
@@ -13,6 +13,7 @@#include "bls_builder/bls_builder_internal.h" #include "bls_builder/dcn401_init_builder.h" #include "bls_builder/dcn401_init_builder_legacy.h" +#include "dc_priv.h" static const enum block_sequence_func dcn401_dc2_init_sequence[] = {LEGACY_CLK_MGR_INIT_CLOCKS ,
drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_init_builder_legacy.c +1 -0
@@ -23,6 +23,7 @@#include "dcn32/dcn32_resource.h" #include "bls_builder/dcn401_init_builder.h" #include "bls_builder/dcn401_init_builder_legacy.h" +#include "dc_priv.h" /* * DC2_DC1_Wrapped: dcn401_init_hw as BLS entries, built one stage per
drivers/gpu/drm/amd/display/dc/bls_executor/bls_executor.c +1 -0
@@ -22,6 +22,7 @@#include "hwss/hw_sequencer_private.h" #include "bls_executor/bls_executor.h" #include "dmub_messenger/dmub_messenger.h" +#include "dc_priv.h" static noinline_for_stack bool dc2_bls_step_supported(const struct dc2 *dc2,const struct block_sequence *step)
drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c +1 -0
@@ -53,6 +53,7 @@#include "dcn42/dcn42_clk_mgr.h" #include "dcn42b/dcn42b_clk_mgr.h" #include "dcn60/dcn60_clk_mgr.h" +#include "dc_priv.h" int clk_mgr_helper_get_active_display_cnt( struct dc *dc,
drivers/gpu/drm/amd/display/dc/clk_mgr/dce100/dce_clk_mgr.c +1 -0
@@ -42,6 +42,7 @@*/ #include "dce/dce_8_0_d.h" #include "dce/dce_8_0_sh_mask.h" +#include "dc_priv.h" #define REG (reg) \ (clk_mgr->regs->reg)
drivers/gpu/drm/amd/display/dc/clk_mgr/dce110/dce110_clk_mgr.c +1 -0
@@ -30,6 +30,7 @@#include "dce/dce_11_0_sh_mask.h" #include "dce110_clk_mgr.h" #include "../clk_mgr/dce100/dce_clk_mgr.h" +#include "dc_priv.h" /* set register offset */ #define SR (reg_name)\
drivers/gpu/drm/amd/display/dc/clk_mgr/dce112/dce112_clk_mgr.c +1 -0
@@ -32,6 +32,7 @@#include "dce110/dce110_clk_mgr.h" #include "dce112_clk_mgr.h" #include "dal_asic_id.h" +#include "dc_priv.h" /* set register offset */ #define SR (reg_name)\
drivers/gpu/drm/amd/display/dc/clk_mgr/dce120/dce120_clk_mgr.c +1 -0
@@ -31,6 +31,7 @@#include "dce120_clk_mgr.h" #include "dce100/dce_clk_mgr.h" #include "dce120/dce120_hwseq.h" +#include "dc_priv.h" /** * dce121_clock_patch_xgmi_ss_info() - Save XGMI spread spectrum info
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn10/dcn10_clk_mgr.c +1 -0
@@ -6,6 +6,7 @@#include "core_types.h" #include "dal_asic_id.h" #include "dcn10_clk_mgr.h" +#include "dc_priv.h" unsigned int dcn10_dentist_get_divider_from_did (unsigned int did) {
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn10/rv1_clk_mgr.c +1 -0
@@ -29,6 +29,7 @@#include "dcn10/dcn10_clk_mgr.h" #include "rv1_clk_mgr_vbios_smu.h" #include "rv1_clk_mgr_clk.h" +#include "dc_priv.h" static void rv1_init_clocks (struct clk_mgr *clk_mgr) {
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn10/rv1_clk_mgr_vbios_smu.c +1 -0
@@ -28,6 +28,7 @@#include "reg_helper.h" #include "rv1_clk_mgr_vbios_smu.h" +#include "dc_priv.h" #define MAX_INSTANCE 5#define MAX_SEGMENT 5
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c +1 -0
@@ -37,6 +37,7 @@#include "dcn/dcn_2_0_0_sh_mask.h" #include "clk/clk_11_0_0_offset.h" #include "clk/clk_11_0_0_sh_mask.h" +#include "dc_priv.h" #undef FN
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn201/dcn201_clk_mgr.c +1 -0
@@ -38,6 +38,7 @@#include "dcn/dcn_2_0_1_sh_mask.h" #include "clk/clk_11_0_1_offset.h" #include "clk/clk_11_0_1_sh_mask.h" +#include "dc_priv.h" #define REG (reg) \ (clk_mgr->regs->reg)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c +1 -0
@@ -40,6 +40,7 @@#include "clk/clk_10_0_2_offset.h" #include "clk/clk_10_0_2_sh_mask.h" #include "renoir_ip_offset.h" +#include "dc_priv.h" /* Constants */
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr_vbios_smu.c +1 -0
@@ -44,6 +44,7 @@ FD(reg_name##__##field)#include "logger_types.h" +#include "dc_priv.h" #undef DC_LOGGER#define DC_LOGGER \ CTX->logger
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c +1 -0
@@ -44,6 +44,7 @@#include "mmhub/mmhub_2_0_0_offset.h" #include "mmhub/mmhub_2_0_0_sh_mask.h" #include "dcn30_smu11_driver_if.h" +#include "dc_priv.h" #undef FN#define FN (reg_name, field_name) \
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn301/vg_clk_mgr.c +1 -0
@@ -45,6 +45,7 @@#include "vangogh_ip_offset.h" #include "clk/clk_11_5_0_offset.h" #include "clk/clk_11_5_0_sh_mask.h" +#include "dc_priv.h" /* Constants */
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c +1 -0
@@ -53,6 +53,7 @@#include "yellow_carp_offset.h" +#include "dc_priv.h" #undef DC_LOGGER#define DC_LOGGER \ clk_mgr->base.base.ctx->logger
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_smu.c +1 -0
@@ -40,6 +40,7 @@ FD(reg_name##__##field)#include "logger_types.h" +#include "dc_priv.h" #undef DC_LOGGER#define DC_LOGGER \ CTX->logger
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.c +1 -0
@@ -53,6 +53,7 @@#include "logger_types.h" +#include "dc_priv.h" #define MAX_INSTANCE 7
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_smu.c +1 -0
@@ -56,6 +56,7 @@ FD(reg_name##__##field)#include "logger_types.h" +#include "dc_priv.h" #undef DC_LOGGER#define DC_LOGGER \ CTX->logger
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c +1 -0
@@ -47,6 +47,7 @@ clk_mgr->base.base.ctx->logger#include "link_service.h" +#include "dc_priv.h" #define TO_CLK_MGR_DCN315 (clk_mgr)\ container_of(clk_mgr, struct clk_mgr_dcn315, base)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.c +1 -0
@@ -30,6 +30,7 @@#include "dcn315_smu.h" #include "mp/mp_13_0_5_offset.h" #include "logger_types.h" +#include "dc_priv.h" #define MAX_INSTANCE 6#define MAX_SEGMENT 6
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.c +1 -0
@@ -40,6 +40,7 @@#include "dm_helpers.h" #include "dc_dmub_srv.h" #include "link_service.h" +#include "dc_priv.h" // DCN316 this is CLK1 instance #define MAX_INSTANCE 7
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_smu.c +1 -0
@@ -57,6 +57,7 @@ static const struct IP_BASE MP0_BASE = { { { { 0x00016000, 0x00DC0000, 0x00E0000 FD(reg_name##__##field)#include "logger_types.h" +#include "dc_priv.h" #undef DC_LOGGER#define DC_LOGGER \ CTX->logger
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c +1 -0
@@ -42,6 +42,7 @@#include "dcn/dcn_3_2_0_sh_mask.h" #include "dml/dcn32/dcn32_fpu.h" +#include "dc_priv.h" #define DCN_BASE__INST0_SEG1 0x000000C0
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c +1 -0
@@ -46,6 +46,7 @@#include "dc_dmub_srv.h" #include "link_service.h" #include "logger_types.h" +#include "dc_priv.h" #undef DC_LOGGER#define DC_LOGGER \
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn35/dcn35_smu.c +1 -0
@@ -56,6 +56,7 @@ FD(reg_name##__##field)#include "logger_types.h" +#include "dc_priv.h" #undef DC_LOGGER#define DC_LOGGER \ CTX->logger
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c +1 -0
@@ -22,6 +22,7 @@#include "dcn/dcn_4_1_0_offset.h" #include "dcn/dcn_4_1_0_sh_mask.h" +#include "dc_priv.h" #define DCN_BASE__INST0_SEG1 0x000000C0
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn42/dcn42_clk_mgr.c +1 -0
@@ -35,6 +35,7 @@#include "clk/clk_15_0_0_sh_mask.h" #include "dcn/dcn_4_2_0_offset.h" #include "dcn/dcn_4_2_0_sh_mask.h" +#include "dc_priv.h" #undef DC_LOGGER
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn42/dcn42_smu.c +1 -0
@@ -38,6 +38,7 @@ FD(reg_name##__##field)#include "logger_types.h" +#include "dc_priv.h" #undef DC_LOGGER#define DC_LOGGER \ CTX->logger
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn42b/dcn42b_clk_mgr.c +1 -0
@@ -36,6 +36,7 @@#include "dcn/dcn_4_2_1_sh_mask.h" #include <linux/power_supply.h> +#include "dc_priv.h" #define DCN_BASE__INST0_SEG0 0x00000012#define DCN_BASE__INST0_SEG1 0x000000C0
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c +1 -0
@@ -25,6 +25,7 @@#include "dcn/dcn_6_0_0_offset.h" #include "dcn/dcn_6_0_0_sh_mask.h" +#include "dc_priv.h" #undef DC_LOGGER#define DC_LOGGER \
drivers/gpu/drm/amd/display/dc/core/dc_accessors.c +1 -0
@@ -31,6 +31,7 @@* mapping stays obvious and auditable. */ #include "dc.h" +#include "dc_priv.h" #include "dm_helpers.h" /* EXPORT_IF_KUNIT */ uint8_t dc_get_link_count (const struct dc *dc)
drivers/gpu/drm/amd/display/dc/core/dc_debug.c +1 -0
@@ -30,6 +30,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "core_status.h" #include "core_types.h"
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +1 -0
@@ -42,6 +42,7 @@#include "dce/dmub_hw_lock_mgr.h" #include "link_service.h" #include "custom_float.h" +#include "dc_priv.h" static union dmub_inbox0_cmd_lock_hw hwss_build_dmub_lock_command (bool lock) {
drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c +1 -0
@@ -25,6 +25,7 @@#include "link_enc_cfg.h" #include "resource.h" #include "link_service.h" +#include "dc_priv.h" #define DC_LOGGER dc->ctx->logger
drivers/gpu/drm/amd/display/dc/core/dc_link_exports.c +1 -0
@@ -35,6 +35,7 @@*/ #include "link_service.h" #include "dce/dce_i2c.h" +#include "dc_priv.h" struct dc_link *dc_get_link_at_index (struct dc *dc,uint32_t link_index) {
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +1 -0
@@ -78,6 +78,7 @@#include "dcn321/dcn321_resource.h" #include "dcn35/dcn35_resource.h" #include "dcn351/dcn351_resource.h" +#include "dc_priv.h" #include "dcn36/dcn36_resource.h" #include "dcn401/dcn401_resource.h" #include "dcn42/dcn42_resource.h"
drivers/gpu/drm/amd/display/dc/core/dc_stat.c +1 -0
@@ -25,6 +25,7 @@#include "dc/dc_stat.h" #include "dmub/dmub_srv_stat.h" #include "dc_dmub_srv.h" +#include "dc_priv.h" /** * DOC: DC STAT Interface
drivers/gpu/drm/amd/display/dc/core/dc_state.c +1 -0
@@ -26,6 +26,7 @@#include "core_types.h" #include "core_status.h" #include "dc.h" +#include "dc_priv.h" #include "dc_state.h" #include "dc_state_priv.h" #include "dc_stream_priv.h"
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +1 -0
@@ -27,6 +27,7 @@#include "dm_helpers.h" #include "basics/dc_common.h" #include "dc.h" +#include "dc_priv.h" #include "core_types.h" #include "resource.h" #include "ipp.h"
drivers/gpu/drm/amd/display/dc/core/dc_surface.c +1 -0
@@ -26,6 +26,7 @@/* DC interface (public) */ #include "dm_services.h" #include "dc.h" +#include "dc_priv.h" /* DC core (private) */ #include "core_types.h"
drivers/gpu/drm/amd/display/dc/core/dc_test.c +1 -0
@@ -32,6 +32,7 @@#include <linux/export.h> #include "dc.h" +#include "dc_priv.h" #include "dc_test.h" struct dc *dc_test_create (void )
drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c +1 -0
@@ -25,6 +25,7 @@#include "vm_helper.h" #include "dc.h" +#include "dc_priv.h" void vm_helper_mark_vmid_used (struct vm_helper *vm_helper,unsigned int pos,uint8_t hubp_idx) {
drivers/gpu/drm/amd/display/dc/dc.h +0 -131
143 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.h +1 -0
@@ -6,6 +6,7 @@#pragma once#include "dc.h" +#include "dc_priv.h" #include "inc/dc_core_interface.h" #include "bls_builder/dmub_abi.h"
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c +1 -0
@@ -25,6 +25,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "dc_dmub_srv.h" #include "../dmub/dmub_srv.h" #include "dm_helpers.h"
drivers/gpu/drm/amd/display/dc/dc_priv.h new file +186 -0
186 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dc_spl_translate.c +1 -0
@@ -6,6 +6,7 @@#include "dcn20/dcn20_dpp.h" #include "dcn32/dcn32_dpp.h" #include "dcn401/dcn401_dpp.h" +#include "dc_priv.h" static struct spl_callbacks dcn2_spl_callbacks = { .spl_calc_lb_num_partitions = dscl2_spl_calc_lb_num_partitions,
drivers/gpu/drm/amd/display/dc/dccg/dcn31/dcn31_dccg.c +1 -0
@@ -28,6 +28,7 @@#include "dcn31_dccg.h" #include "dcn20/dcn20_dccg.h" #include "dal_asic_id.h" +#include "dc_priv.h" #define TO_DCN_DCCG (dccg)\ container_of(dccg, struct dcn_dccg, base)
drivers/gpu/drm/amd/display/dc/dccg/dcn314/dcn314_dccg.c +1 -0
@@ -30,6 +30,7 @@#include "dcn31/dcn31_dccg.h" #include "dcn314_dccg.h" #include "dcn20/dcn20_dccg.h" +#include "dc_priv.h" #define TO_DCN_DCCG (dccg)\ container_of(dccg, struct dcn_dccg, base)
drivers/gpu/drm/amd/display/dc/dccg/dcn35/dcn35_dccg.c +1 -0
@@ -41,6 +41,7 @@#define CTX \ dccg_dcn->base.ctx#include "logger_types.h" +#include "dc_priv.h" #define DC_LOGGER \ dccg->ctx->logger
drivers/gpu/drm/amd/display/dc/dccg/dcn401/dcn401_dccg.c +1 -0
@@ -28,6 +28,7 @@#include "dcn401_dccg.h" #include "dcn31/dcn31_dccg.h" #include "dcn20/dcn20_dccg.h" +#include "dc_priv.h" /* #include "dmub_common.h"
drivers/gpu/drm/amd/display/dc/dccg/dcn42/dcn42_dccg.c +1 -0
@@ -7,6 +7,7 @@#include "dcn35/dcn35_dccg.h" #include "dcn42_dccg.h" #include "dcn20/dcn20_dccg.h" +#include "dc_priv.h" #define TO_DCN_DCCG (dccg)\ container_of(dccg, struct dcn_dccg, base)
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c +1 -0
@@ -46,6 +46,7 @@#define LOG_FLAG_I2cAux_DceAux LOG_I2C_AUX#include "reg_helper.h" +#include "dc_priv.h" #undef FN#define FN (reg_name, field_name) \
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c +1 -0
@@ -38,6 +38,7 @@#include "dccg.h" #include "reg_helper.h" +#include "dc_priv.h" #define REG (reg)\ (clk_src->regs->reg)
drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c +1 -0
@@ -30,6 +30,7 @@#include "reg_helper.h" #include "fixed31_32.h" #include "dc.h" +#include "dc_priv.h" #define TO_DCE_DMCU (dmcu)\ container_of(dmcu, struct dce_dmcu, base)
drivers/gpu/drm/amd/display/dc/dce/dce_i2c.c +1 -0
@@ -24,6 +24,7 @@*/ #include "dce_i2c.h" #include "reg_helper.h" +#include "dc_priv.h" bool dce_i2c_oem_device_present( struct resource_pool *pool,
drivers/gpu/drm/amd/display/dc/dce/dce_i2c_hw.c +1 -0
@@ -27,6 +27,7 @@#include "dce_i2c_hw.h" #include "reg_helper.h" #include "include/gpio_service_interface.h" +#include "dc_priv.h" #define CTX \ dce_i2c_hw->ctx
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c +1 -0
@@ -36,6 +36,7 @@#include "dce/dce_11_0_d.h" #include "dce/dce_11_0_sh_mask.h" #include "dce/dce_11_0_enum.h" +#include "dc_priv.h" #ifndef DMU_MEM_PWR_CNTL__DMCU_IRAM_MEM_PWR_STATE__SHIFT #define DMU_MEM_PWR_CNTL__DMCU_IRAM_MEM_PWR_STATE__SHIFT 0xa
drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c +1 -0
@@ -26,6 +26,7 @@#include "dce_mem_input.h" #include "reg_helper.h" #include "basics/conversion.h" +#include "dc_priv.h" #define CTX \ dce_mi->base.ctx
drivers/gpu/drm/amd/display/dc/dce/dce_transform.c +1 -0
@@ -28,6 +28,7 @@#include "opp.h" #include "basics/conversion.h" #include "dc.h" +#include "dc_priv.h" #define REG (reg) \ (xfm_dce->regs->reg)
drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c +1 -0
@@ -27,6 +27,7 @@#include "dmub_abm_lcd.h" #include "dmub_abm_cacp.h" #include "dc.h" +#include "dc_priv.h" #include "core_types.h" #include "dmub_cmd.h" #include "dc_dmub_srv.h"
drivers/gpu/drm/amd/display/dc/dce/dmub_abm_cacp.c +1 -0
@@ -4,6 +4,7 @@#include "dmub_abm_cacp.h" #include "dce_abm.h" #include "dc.h" +#include "dc_priv.h" #include "dc_dmub_srv.h" #include "dmub/dmub_srv.h" #include "core_types.h"
drivers/gpu/drm/amd/display/dc/dce/dmub_abm_lcd.c +1 -0
@@ -27,6 +27,7 @@#include "dmub_abm_lcd.h" #include "dce_abm.h" #include "dc.h" +#include "dc_priv.h" #include "dc_dmub_srv.h" #include "dmub/dmub_srv.h" #include "core_types.h"
drivers/gpu/drm/amd/display/dc/dce/dmub_hw_lock_mgr.c +1 -0
@@ -27,6 +27,7 @@#include "dc_dmub_srv.h" #include "dc_types.h" #include "core_types.h" +#include "dc_priv.h" static bool dmub_hw_lock_has_inbox0_lock (const struct dc *dc) {
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c +1 -0
@@ -25,6 +25,7 @@#include "dmub_psr.h" #include "dc.h" +#include "dc_priv.h" #include "dc_dmub_srv.h" #include "dmub/dmub_srv.h" #include "core_types.h"
drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c +1 -0
@@ -3,6 +3,7 @@// Copyright 2024 Advanced Micro Devices, Inc. #include "dc.h" +#include "dc_priv.h" #include "link_service.h" #include "dc_dmub_srv.h" #include "dmub/dmub_srv.h"
drivers/gpu/drm/amd/display/dc/dce110/dce110_mem_input_v.c +1 -0
@@ -33,6 +33,7 @@#include "dce/dce_mem_input.h" #include "dce110_mem_input_v.h" +#include "dc_priv.h" static void set_flip_control( struct dce_mem_input *mem_input110,
drivers/gpu/drm/amd/display/dc/dce110/dce110_transform_v.c +1 -0
@@ -26,6 +26,7 @@#include "dce110_transform_v.h" #include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "dce/dce_11_0_d.h" #include "dce/dce_11_0_sh_mask.h"
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer_debug.c +1 -0
@@ -45,6 +45,7 @@#include "dcn10_cm_common.h" #include "clk_mgr.h" #include "dsc.h" +#include "dc_priv.h" __printf(3, 4)unsigned int snprintf_count (char *pbuf,unsigned int bufsize,const char *fmt, ...)
drivers/gpu/drm/amd/display/dc/dcn201/dcn201_link_encoder.c +1 -0
@@ -32,6 +32,7 @@#include "dc_bios_types.h" #include "gpio_service_interface.h" +#include "dc_priv.h" #define CTX \ enc10->base.ctx
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_link_encoder.c +1 -0
@@ -34,6 +34,7 @@#include "dc_bios_types.h" #include "gpio_service_interface.h" +#include "dc_priv.h" #define CTX \ enc10->base.ctx
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_afmt.c +1 -0
@@ -29,6 +29,7 @@#include "dcn31_afmt.h" #include "reg_helper.h" #include "dc/dc.h" +#include "dc_priv.h" #define DC_LOGGER \ afmt31->base.ctx->logger
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_panel_cntl.c +1 -0
@@ -29,6 +29,7 @@#include "dc_dmub_srv.h" #include "dcn31_panel_cntl.h" #include "atom.h" +#include "dc_priv.h" #define TO_DCN31_PANEL_CNTL (panel_cntl)\ container_of(panel_cntl, struct dcn31_panel_cntl, base)
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_vpg.c +1 -0
@@ -28,6 +28,7 @@#include "dcn31_vpg.h" #include "reg_helper.h" #include "dc/dc.h" +#include "dc_priv.h" #define DC_LOGGER \ vpg31->base.ctx->logger
drivers/gpu/drm/amd/display/dc/dio/dcn10/dcn10_link_encoder.c +1 -0
@@ -32,6 +32,7 @@#include "dc_bios_types.h" #include "gpio_service_interface.h" +#include "dc_priv.h" #define CTX \ enc10->base.ctx
drivers/gpu/drm/amd/display/dc/dio/dcn10/dcn10_stream_encoder.c +1 -0
@@ -31,6 +31,7 @@#include "link_service.h" #include "dpcd_defs.h" #include "dcn30/dcn30_afmt.h" +#include "dc_priv.h" #define DC_LOGGER \ enc1->base.ctx->logger
drivers/gpu/drm/amd/display/dc/dio/dcn20/dcn20_link_encoder.c +1 -0
@@ -32,6 +32,7 @@#include "dc_bios_types.h" #include "gpio_service_interface.h" +#include "dc_priv.h" #define CTX \ enc10->base.ctx
drivers/gpu/drm/amd/display/dc/dio/dcn20/dcn20_stream_encoder.c +1 -0
@@ -31,6 +31,7 @@#include "hw_shared.h" #include "link_service.h" #include "dpcd_defs.h" +#include "dc_priv.h" #define DC_LOGGER \ enc1->base.ctx->logger
drivers/gpu/drm/amd/display/dc/dio/dcn30/dcn30_dio_link_encoder.c +1 -0
@@ -31,6 +31,7 @@#include "stream_encoder.h" #include "dc_bios_types.h" #include "gpio_service_interface.h" +#include "dc_priv.h" #define CTX \ enc10->base.ctx
drivers/gpu/drm/amd/display/dc/dio/dcn30/dcn30_dio_stream_encoder.c +1 -0
@@ -29,6 +29,7 @@#include "reg_helper.h" #include "hw_shared.h" #include "dc.h" +#include "dc_priv.h" #define DC_LOGGER \ enc1->base.ctx->logger
drivers/gpu/drm/amd/display/dc/dio/dcn301/dcn301_dio_link_encoder.c +1 -0
@@ -31,6 +31,7 @@#include "stream_encoder.h" #include "dc_bios_types.h" #include "gpio_service_interface.h" +#include "dc_priv.h" #define CTX \ enc10->base.ctx
drivers/gpu/drm/amd/display/dc/dio/dcn31/dcn31_dio_link_encoder.c +1 -0
@@ -38,6 +38,7 @@#include "dc_dmub_srv.h" #include "dal_asic_id.h" #include "link_service.h" +#include "dc_priv.h" #define CTX \ enc10->base.ctx
drivers/gpu/drm/amd/display/dc/dio/dcn314/dcn314_dio_stream_encoder.c +1 -0
@@ -32,6 +32,7 @@#include "hw_shared.h" #include "link_service.h" #include "dpcd_defs.h" +#include "dc_priv.h" #define DC_LOGGER \ enc1->base.ctx->logger
drivers/gpu/drm/amd/display/dc/dio/dcn32/dcn32_dio_link_encoder.c +1 -0
@@ -36,6 +36,7 @@#include "dc_dmub_srv.h" #include "gpio_service_interface.h" +#include "dc_priv.h" #ifndef MIN #define MIN (X ,Y ) ((X) < (Y) ? (X) : (Y))
drivers/gpu/drm/amd/display/dc/dio/dcn32/dcn32_dio_stream_encoder.c +1 -0
@@ -31,6 +31,7 @@#include "hw_shared.h" #include "link_service.h" #include "dpcd_defs.h" +#include "dc_priv.h" #define DC_LOGGER \ enc1->base.ctx->logger
drivers/gpu/drm/amd/display/dc/dio/dcn321/dcn321_dio_link_encoder.c +1 -0
@@ -33,6 +33,7 @@#include "dc_bios_types.h" #include "gpio_service_interface.h" +#include "dc_priv.h" #ifndef MIN #define MIN (X ,Y ) ((X) < (Y) ? (X) : (Y))
drivers/gpu/drm/amd/display/dc/dio/dcn35/dcn35_dio_link_encoder.c +1 -0
@@ -29,6 +29,7 @@#include "dcn31/dcn31_dio_link_encoder.h" #include "dcn35_dio_link_encoder.h" #include "dc_dmub_srv.h" +#include "dc_priv.h" #define CTX \ enc10->base.ctx#define DC_LOGGER \
drivers/gpu/drm/amd/display/dc/dio/dcn35/dcn35_dio_stream_encoder.c +1 -0
@@ -31,6 +31,7 @@#include "hw_shared.h" #include "link_service.h" #include "dpcd_defs.h" +#include "dc_priv.h" #define DC_LOGGER \ enc1->base.ctx->logger
drivers/gpu/drm/amd/display/dc/dio/dcn401/dcn401_dio_link_encoder.c +1 -0
@@ -35,6 +35,7 @@#include "dc_bios_types.h" #include "gpio_service_interface.h" +#include "dc_priv.h" #ifndef MIN #define MIN (X ,Y ) ((X) < (Y) ? (X) : (Y))
drivers/gpu/drm/amd/display/dc/dio/dcn401/dcn401_dio_stream_encoder.c +1 -0
@@ -34,6 +34,7 @@#include "hw_shared.h" #include "link_service.h" #include "dpcd_defs.h" +#include "dc_priv.h" #define DC_LOGGER \ enc1->base.ctx->logger
drivers/gpu/drm/amd/display/dc/dio/dcn42/dcn42_dio_link_encoder.c +1 -0
@@ -8,6 +8,7 @@#include "link_encoder.h" #include "dcn35/dcn35_dio_link_encoder.h" #include "dcn42_dio_link_encoder.h" +#include "dc_priv.h" #ifndef MIN #define MIN (X ,Y ) ((X) < (Y) ? (X) : (Y))
drivers/gpu/drm/amd/display/dc/dio/dcn42/dcn42_dio_stream_encoder.c +1 -0
@@ -14,6 +14,7 @@#include "hw_shared.h" #include "link_service.h" #include "dpcd_defs.h" +#include "dc_priv.h" #define DC_LOGGER \ enc1->base.ctx->logger
drivers/gpu/drm/amd/display/dc/dio/dcn60/dcn60_dio_link_encoder.c +1 -0
@@ -15,6 +15,7 @@#include "dc_bios_types.h" #include "gpio_service_interface.h" +#include "dc_priv.h" #ifndef MIN #define MIN (X ,Y ) ((X) < (Y) ? (X) : (Y))
drivers/gpu/drm/amd/display/dc/dio/dcn60/dcn60_dio_stream_encoder.c +1 -0
@@ -13,6 +13,7 @@#include "hw_shared.h" #include "link_service.h" #include "dpcd_defs.h" +#include "dc_priv.h" #define DC_LOGGER \ enc1->base.ctx->logger
drivers/gpu/drm/amd/display/dc/dml/calcs/dcn_calcs.c +1 -0
@@ -26,6 +26,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "dcn_calcs.h" #include "dcn_calc_auto.h" #include "dal_asic_id.h"
drivers/gpu/drm/amd/display/dc/dml/dcn10/dcn10_fpu.c +1 -0
@@ -28,6 +28,7 @@#include "dcn10_fpu.h" #include "resource.h" +#include "dc_priv.h" /** * DOC: DCN10 FPU manipulation Overview
drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c +1 -0
@@ -33,6 +33,7 @@#include "link_service.h" #include "dcn20_fpu.h" #include "dc_state_priv.h" +#include "dc_priv.h" #define DC_LOGGER \ dc->ctx->logger
drivers/gpu/drm/amd/display/dc/dml/dcn30/dcn30_fpu.c +1 -0
@@ -34,6 +34,7 @@#include "dcn30_fpu.h" #include "../dml1_frl_cap_chk.h" +#include "dc_priv.h" #define REG (reg)\ optc1->tg_regs->reg
drivers/gpu/drm/amd/display/dc/dml/dcn301/dcn301_fpu.c +1 -0
@@ -30,6 +30,7 @@#include "dml/dcn20/dcn20_fpu.h" #include "dcn301_fpu.h" +#include "dc_priv.h" #define TO_DCN301_RES_POOL (pool)\ container_of(pool, struct dcn301_resource_pool, base)
drivers/gpu/drm/amd/display/dc/dml/dcn302/dcn302_fpu.c +1 -0
@@ -30,6 +30,7 @@#include "dml/dcn20/dcn20_fpu.h" #include "dcn302_fpu.h" +#include "dc_priv.h" struct _vcs_dpi_ip_params_st dcn3_02_ip = { .use_min_dcfclk =0 ,
drivers/gpu/drm/amd/display/dc/dml/dcn303/dcn303_fpu.c +1 -0
@@ -29,6 +29,7 @@#include "dml/dcn20/dcn20_fpu.h" #include "dcn303_fpu.h" +#include "dc_priv.h" struct _vcs_dpi_ip_params_st dcn3_03_ip = { .use_min_dcfclk =0 ,
drivers/gpu/drm/amd/display/dc/dml/dcn31/dcn31_fpu.c +1 -0
@@ -31,6 +31,7 @@#include "dml/dcn20/dcn20_fpu.h" #include "dcn31_fpu.h" +#include "dc_priv.h" /** * DOC: DCN31x FPU manipulation Overview
drivers/gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c +1 -0
@@ -32,6 +32,7 @@#include "dml/dcn31/dcn31_fpu.h" #include "dml/display_mode_vba.h" #include "dml/dml_inline_defs.h" +#include "dc_priv.h" struct _vcs_dpi_ip_params_st dcn3_14_ip = { .VBlankNomDefaultUS =668 ,
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c +1 -0
@@ -33,6 +33,7 @@#include "dcn30/dcn30_resource.h" #include "link_service.h" #include "dc_state_priv.h" +#include "dc_priv.h" #define DC_LOGGER_INIT (logger)
drivers/gpu/drm/amd/display/dc/dml/dcn321/dcn321_fpu.c +1 -0
@@ -30,6 +30,7 @@#include "dcn32/dcn32_resource.h" #include "dcn321/dcn321_resource.h" #include "dml/dcn32/display_mode_vba_util_32.h" +#include "dc_priv.h" #define DCN3_2_DEFAULT_DET_SIZE 256
drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.c +1 -0
@@ -32,6 +32,7 @@#include "dml/dml_inline_defs.h" #include "link_service.h" +#include "dc_priv.h" #define DC_LOGGER_INIT (logger)
drivers/gpu/drm/amd/display/dc/dml/dcn351/dcn351_fpu.c +1 -0
@@ -11,6 +11,7 @@#include "dml/dml_inline_defs.h" #include "link_service.h" +#include "dc_priv.h" #define DC_LOGGER_INIT (logger)
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml21_wrapper/dml21_translation_helper.c +1 -0
@@ -9,6 +9,7 @@#include "dml21_utils.h" #include "dml21_translation_helper.h" #include "soc_and_ip_translator.h" +#include "dc_priv.h" static void dml21_populate_pmo_options(struct dml2_pmo_options *pmo_options, const struct dc *in_dc,
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml21_wrapper/dml21_utils.c +1 -0
@@ -10,6 +10,7 @@#include "dml2_dc_resource_mgmt.h" #include "dml2_core_dcn4_calcs.h" +#include "dc_priv.h" int dml21_helper_find_dml_pipe_idx_by_stream_id (struct dml2_context *ctx,unsigned int stream_id) {
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml21_wrapper/dml21_wrapper_fpu.c +1 -0
@@ -13,6 +13,7 @@#include "dml2_wrapper_fpu.h" #include "dml21_wrapper.h" #include "dml21_wrapper_fpu.h" +#include "dc_priv.h" #define INVALID -1
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_dc_resource_mgmt.c +1 -0
@@ -30,6 +30,7 @@#include "dml2_internal_types.h" #include "dml2_utils.h" #include "dml2_dc_resource_mgmt.h" +#include "dc_priv.h" #define MAX_ODM_FACTOR 4#define MAX_MPCC_FACTOR 4
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_mall_phantom.c +1 -0
@@ -29,6 +29,7 @@#include "dml2_internal_types.h" #include "dml2_utils.h" #include "dml2_mall_phantom.h" +#include "dc_priv.h" unsigned int dml2_helper_calculate_num_ways_for_subvp (struct dml2_context *ctx,struct dc_state *context) {
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_translation_helper.c +1 -0
@@ -27,6 +27,7 @@#include "display_mode_core.h" #include "dml2_internal_types.h" #include "dml2_translation_helper.h" +#include "dc_priv.h" #define NUM_DCFCLK_STAS 5#define NUM_DCFCLK_STAS_NEW 8
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_utils.c +1 -0
@@ -30,6 +30,7 @@#include "dml2_internal_types.h" #include "dml2_translation_helper.h" #include "dml2_utils.h" +#include "dc_priv.h" void dml2_util_copy_dml_timing (struct dml_timing_cfg_st *dml_timing_array,unsigned int dst_index,unsigned int src_index) {
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_wrapper.c +1 -0
@@ -12,6 +12,7 @@#include "dml21_wrapper/dml21_wrapper_fpu.h" #include "dc_fpu.h" +#include "dc_priv.h" #if !defined(DC_RUN_WITH_PREEMPTION_ENABLED )#define DC_RUN_WITH_PREEMPTION_ENABLED (code) code
drivers/gpu/drm/amd/display/dc/dml2_wrapper/dml2_wrapper_fpu.c +1 -0
@@ -35,6 +35,7 @@#include "dml2_wrapper_fpu.h" #include "dml21_wrapper/dml21_wrapper.h" #include "dml21_wrapper/dml21_wrapper_fpu.h" +#include "dc_priv.h" void initialize_dml2_ip_params (struct dml2_context *dml2,const struct dc *in_dc,struct ip_params_st *out) {
drivers/gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp.c +1 -0
@@ -30,6 +30,7 @@#include "reg_helper.h" #include "dcn10/dcn10_dpp.h" #include "basics/conversion.h" +#include "dc_priv.h" #define NUM_PHASES 64#define HORZ_MAX_TAPS 8
drivers/gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp_dscl.c +1 -0
@@ -30,6 +30,7 @@#include "reg_helper.h" #include "dcn10/dcn10_dpp.h" #include "basics/conversion.h" +#include "dc_priv.h" #define NUM_PHASES 64
drivers/gpu/drm/amd/display/dc/dpp/dcn20/dcn20_dpp_cm.c +1 -0
@@ -32,6 +32,7 @@#include "basics/conversion.h" #include "dcn10/dcn10_cm_common.h" +#include "dc_priv.h" #define REG (reg)\ dpp->tf_regs->reg
drivers/gpu/drm/amd/display/dc/dpp/dcn201/dcn201_dpp.c +1 -0
@@ -30,6 +30,7 @@#include "reg_helper.h" #include "dcn201/dcn201_dpp.h" #include "basics/conversion.h" +#include "dc_priv.h" #define REG (reg)\ dpp->tf_regs->reg
drivers/gpu/drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c +1 -0
@@ -29,6 +29,7 @@#include "dcn30/dcn30_dpp.h" #include "basics/conversion.h" #include "dcn30/dcn30_cm_common.h" +#include "dc_priv.h" #define REG (reg)\ dpp->tf_regs->reg
drivers/gpu/drm/amd/display/dc/dpp/dcn30/dcn30_dpp_cm.c +1 -0
@@ -31,6 +31,7 @@#include "dcn30/dcn30_dpp.h" #include "basics/conversion.h" #include "dcn30/dcn30_cm_common.h" +#include "dc_priv.h" #define REG (reg)\ dpp->tf_regs->reg
drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp_dscl.c +1 -0
@@ -30,6 +30,7 @@#include "reg_helper.h" #include "dcn401/dcn401_dpp.h" #include "basics/conversion.h" +#include "dc_priv.h" #define NUM_PHASES 64
drivers/gpu/drm/amd/display/dc/dpp/dcn60/dcn60_dpp_cm.c +1 -0
@@ -4,6 +4,7 @@#include "dcn60/dcn60_dpp.h" #include "dcn30/dcn30_cm_common.h" #include "basics/conversion.h" +#include "dc_priv.h" #define REG (reg) \ dpp->tf_regs->reg
drivers/gpu/drm/amd/display/dc/dpp/dcn60/dcn60_dpp_dscl.c +1 -0
@@ -9,6 +9,7 @@#include "reg_helper.h" #include "dcn60/dcn60_dpp.h" #include "basics/conversion.h" +#include "dc_priv.h" #define REG (reg)\ dpp->tf_regs->reg
drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c +1 -0
@@ -27,6 +27,7 @@#include "dc_hw_types.h" #include "dsc.h" #include "dc.h" +#include "dc_priv.h" #include "rc_calc.h" #include "fixed31_32.h"
drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c +1 -0
@@ -31,6 +31,7 @@#include "link_service.h" #include "link_hwss.h" #include "link/protocols/link_dpcd.h" +#include "dc_priv.h" #define DC_LOGGER \ link->ctx->logger
drivers/gpu/drm/amd/display/dc/hpo/dcn30/dcn30_hpo_frl_link_encoder.c +1 -0
@@ -29,6 +29,7 @@#include "dcn30_hpo_frl_link_encoder.h" #include "reg_helper.h" #include "dcn10/dcn10_link_encoder.h" +#include "dc_priv.h" #define DC_LOGGER enc3->base.ctx->logger
drivers/gpu/drm/amd/display/dc/hubbub/dcn10/dcn10_hubbub.c +1 -0
@@ -27,6 +27,7 @@#include "dcn10/dcn10_hubp.h" #include "dcn10_hubbub.h" #include "reg_helper.h" +#include "dc_priv.h" #define CTX \ hubbub1->base.ctx
drivers/gpu/drm/amd/display/dc/hubbub/dcn20/dcn20_hubbub.c +1 -0
@@ -27,6 +27,7 @@#include "dcn20_hubbub.h" #include "reg_helper.h" #include "clk_mgr.h" +#include "dc_priv.h" #define REG (reg)\ hubbub1->regs->reg
drivers/gpu/drm/amd/display/dc/hubbub/dcn201/dcn201_hubbub.c +1 -0
@@ -26,6 +26,7 @@#include "dcn20/dcn20_hubbub.h" #include "dcn201_hubbub.h" #include "reg_helper.h" +#include "dc_priv.h" #define REG (reg)\ hubbub1->regs->reg
drivers/gpu/drm/amd/display/dc/hubbub/dcn21/dcn21_hubbub.c +1 -0
@@ -27,6 +27,7 @@#include "dcn20/dcn20_hubbub.h" #include "dcn21_hubbub.h" #include "reg_helper.h" +#include "dc_priv.h" #define REG (reg)\ hubbub1->regs->reg
drivers/gpu/drm/amd/display/dc/hubbub/dcn30/dcn30_hubbub.c +1 -0
@@ -27,6 +27,7 @@#include "dm_services.h" #include "reg_helper.h" #include "dcn30_hubbub.h" +#include "dc_priv.h" #define CTX \
drivers/gpu/drm/amd/display/dc/hubbub/dcn31/dcn31_hubbub.c +1 -0
@@ -28,6 +28,7 @@#include "dcn31_hubbub.h" #include "dm_services.h" #include "reg_helper.h" +#include "dc_priv.h" #define CTX \
drivers/gpu/drm/amd/display/dc/hubbub/dcn32/dcn32_hubbub.c +1 -0
@@ -29,6 +29,7 @@#include "dm_services.h" #include "reg_helper.h" #include "dal_asic_id.h" +#include "dc_priv.h" #define CTX \
drivers/gpu/drm/amd/display/dc/hubbub/dcn35/dcn35_hubbub.c +1 -0
@@ -32,6 +32,7 @@#include "dm_services.h" #include "reg_helper.h" #include "dc_dmub_srv.h" +#include "dc_priv.h" #define CTX \
drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c +1 -0
@@ -28,6 +28,7 @@#include "dcn401_hubbub.h" #include "dm_services.h" #include "reg_helper.h" +#include "dc_priv.h" #define CTX \
drivers/gpu/drm/amd/display/dc/hubbub/dcn42/dcn42_hubbub.c +1 -0
@@ -10,6 +10,7 @@#include "dcn42/dcn42_hubbub.h" #include "dm_services.h" #include "reg_helper.h" +#include "dc_priv.h" #define DCN42_CRB_SEGMENT_SIZE_KB 64
drivers/gpu/drm/amd/display/dc/hubbub/dcn60/dcn60_hubbub.c +1 -0
@@ -6,6 +6,7 @@#include "dm_services.h" #include "reg_helper.h" #include "fixed31_32.h" +#include "dc_priv.h" #define CTX \ hubbub2->base.ctx
drivers/gpu/drm/amd/display/dc/hubp/dcn21/dcn21_hubp.c +1 -0
@@ -30,6 +30,7 @@#include "reg_helper.h" #include "dc_dmub_srv.h" +#include "dc_priv.h" #define DC_LOGGER \ ctx->logger
drivers/gpu/drm/amd/display/dc/hubp/dcn35/dcn35_hubp.c +1 -0
@@ -26,6 +26,7 @@#include "dcn35_hubp.h" #include "reg_helper.h" +#include "dc_priv.h" #define REG (reg)\ hubp2->hubp_regs->reg
drivers/gpu/drm/amd/display/dc/hubp/dcn42/dcn42_hubp.c +1 -0
@@ -5,6 +5,7 @@#include "dcn401/dcn401_hubp.h" #include "dcn42_hubp.h" #include "reg_helper.h" +#include "dc_priv.h" #define REG (reg) \ hubp2->hubp_regs->reg
drivers/gpu/drm/amd/display/dc/hwss/dce/dce_hwseq.c +1 -0
@@ -27,6 +27,7 @@#include "reg_helper.h" #include "hw_sequencer_private.h" #include "core_types.h" +#include "dc_priv.h" #define CTX \ hws->ctx
drivers/gpu/drm/amd/display/dc/hwss/dce100/dce100_hwseq.c +1 -0
@@ -24,6 +24,7 @@*/ #include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "core_types.h" #include "clk_mgr.h" #include "dce100_hwseq.h"
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c +1 -0
@@ -25,6 +25,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "dc_bios_types.h" #include "core_types.h" #include "core_status.h"
drivers/gpu/drm/amd/display/dc/hwss/dce112/dce112_hwseq.c +1 -0
@@ -25,6 +25,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "core_types.h" #include "dce112_hwseq.h"
drivers/gpu/drm/amd/display/dc/hwss/dce120/dce120_hwseq.c +1 -0
@@ -25,6 +25,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "core_types.h" #include "dce120_hwseq.h" #include "dce/dce_hwseq.h"
drivers/gpu/drm/amd/display/dc/hwss/dce60/dce60_hwseq.c +1 -0
@@ -25,6 +25,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "core_types.h" #include "dce60_hwseq.h"
drivers/gpu/drm/amd/display/dc/hwss/dce80/dce80_hwseq.c +1 -0
@@ -25,6 +25,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "core_types.h" #include "dce80_hwseq.h"
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +1 -0
@@ -59,6 +59,7 @@#include "dce/dmub_outbox.h" #include "link_service.h" #include "dc_state_priv.h" +#include "dc_priv.h" #define DC_LOGGER \ dc_ctx->logger
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_init.c +1 -0
@@ -28,6 +28,7 @@#include "dcn10/dcn10_hwseq.h" #include "dcn20/dcn20_hwseq.h" #include "dc/hwss/dce/dce_hwseq.h" +#include "dc_priv.h" static const struct hw_sequencer_funcs dcn10_funcs = { .program_gamut_remap = dcn10_program_gamut_remap,
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +1 -0
@@ -57,6 +57,7 @@#include "link_hwss.h" #include "link_service.h" #include "dc_state_priv.h" +#include "dc_priv.h" #define DC_LOGGER \ dc_logger
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_init.c +1 -0
@@ -28,6 +28,7 @@#include "dcn20/dcn20_hwseq.h" #include "dcn20_init.h" +#include "dc_priv.h" static const struct hw_sequencer_funcs dcn20_funcs = { .program_gamut_remap = dcn10_program_gamut_remap,
drivers/gpu/drm/amd/display/dc/hwss/dcn201/dcn201_hwseq.c +1 -0
@@ -41,6 +41,7 @@#include "reg_helper.h" #include "dcn10/dcn10_hubbub.h" #include "dio/dcn10/dcn10_dio.h" +#include "dc_priv.h" #define CTX \
drivers/gpu/drm/amd/display/dc/hwss/dcn201/dcn201_init.c +1 -0
@@ -29,6 +29,7 @@#include "dcn20/dcn20_hwseq.h" #include "dcn201/dcn201_hwseq.h" #include "dcn201_init.h" +#include "dc_priv.h" static const struct hw_sequencer_funcs dcn201_funcs = { .program_gamut_remap = dcn10_program_gamut_remap,
drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_hwseq.c +1 -0
@@ -37,6 +37,7 @@#include "dc_dmub_srv.h" #include "abm.h" #include "link_service.h" +#include "dc_priv.h" #define DC_LOGGER_INIT (logger)
drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_init.c +1 -0
@@ -29,6 +29,7 @@#include "dcn21/dcn21_hwseq.h" #include "dcn21_init.h" +#include "dc_priv.h" static const struct hw_sequencer_funcs dcn21_funcs = { .program_gamut_remap = dcn10_program_gamut_remap,
drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c +1 -0
@@ -54,6 +54,7 @@#include "link_service.h" #include "dc_state_priv.h" #include "dio/dcn10/dcn10_dio.h" +#include "dc_priv.h" #define TO_DCN_DCCG (dccg)\ container_of(dccg, struct dcn_dccg, base)
drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_init.c +1 -0
@@ -30,6 +30,7 @@#include "dcn30/dcn30_hwseq.h" #include "dcn30_init.h" +#include "dc_priv.h" static const struct hw_sequencer_funcs dcn30_funcs = { .program_gamut_remap = dcn30_program_gamut_remap,
drivers/gpu/drm/amd/display/dc/hwss/dcn301/dcn301_init.c +1 -0
@@ -31,6 +31,7 @@#include "dcn301/dcn301_hwseq.h" #include "dcn301_init.h" +#include "dc_priv.h" static const struct hw_sequencer_funcs dcn301_funcs = { .program_gamut_remap = dcn30_program_gamut_remap,
drivers/gpu/drm/amd/display/dc/hwss/dcn302/dcn302_hwseq.c +1 -0
@@ -29,6 +29,7 @@#include "reg_helper.h" #include "dc.h" +#include "dc_priv.h" #define DC_LOGGER_INIT (logger)
drivers/gpu/drm/amd/display/dc/hwss/dcn302/dcn302_init.c +1 -0
@@ -28,6 +28,7 @@#include "dcn30/dcn30_init.h" #include "dc.h" +#include "dc_priv.h" #include "dcn302_init.h"
drivers/gpu/drm/amd/display/dc/hwss/dcn303/dcn303_init.c +1 -0
@@ -26,6 +26,7 @@#include "dcn303/dcn303_hwseq.h" #include "dcn30/dcn30_init.h" #include "dc.h" +#include "dc_priv.h" #include "dcn303_init.h"
drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_hwseq.c +1 -0
@@ -55,6 +55,7 @@#include "dce/dmub_abm_lcd.h" #include "dio/dcn10/dcn10_dio.h" #include "dce/dmub_abm_cacp.h" +#include "dc_priv.h" #define DC_LOGGER_INIT (logger)
drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_init.c +1 -0
@@ -32,6 +32,7 @@#include "dcn31/dcn31_hwseq.h" #include "dcn31_init.h" +#include "dc_priv.h" static const struct hw_sequencer_funcs dcn31_funcs = { .program_gamut_remap = dcn30_program_gamut_remap,
drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.c +1 -0
@@ -54,6 +54,7 @@#include "dsc.h" #include "dcn20/dcn20_optc.h" #include "dcn30/dcn30_cm_common.h" +#include "dc_priv.h" #define DC_LOGGER_INIT (logger)
drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_init.c +1 -0
@@ -34,6 +34,7 @@#include "dcn314/dcn314_hwseq.h" #include "dcn314_init.h" +#include "dc_priv.h" static const struct hw_sequencer_funcs dcn314_funcs = { .program_gamut_remap = dcn30_program_gamut_remap,
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +1 -0
@@ -53,6 +53,7 @@#include "../dcn20/dcn20_hwseq.h" #include "dc_state_priv.h" #include "dio/dcn10/dcn10_dio.h" +#include "dc_priv.h" #define DC_LOGGER_INIT (logger)
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_init.c +1 -0
@@ -33,6 +33,7 @@#include "dcn401/dcn401_hwseq.h" #include "dml/dcn32/dcn32_fpu.h" #include "dcn32_init.h" +#include "dc_priv.h" static const struct hw_sequencer_funcs dcn32_funcs = { .program_gamut_remap = dcn30_program_gamut_remap,
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c +1 -0
@@ -60,6 +60,7 @@#include "dcn31/dcn31_hwseq.h" #include "dcn20/dcn20_hwseq.h" #include "dc_state_priv.h" +#include "dc_priv.h" #define DC_LOGGER \ dc_ctx->logger
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_init.c +1 -0
@@ -36,6 +36,7 @@#include "dcn35/dcn35_hwseq.h" #include "dcn35_init.h" +#include "dc_priv.h" static const struct hw_sequencer_funcs dcn35_funcs = { .program_gamut_remap = dcn30_program_gamut_remap,
drivers/gpu/drm/amd/display/dc/hwss/dcn351/dcn351_hwseq.c +1 -0
@@ -28,6 +28,7 @@#include "resource.h" #include "dcn351_hwseq.h" #include "dcn35/dcn35_hwseq.h" +#include "dc_priv.h" #define DC_LOGGER_INIT (logger) \ struct dal_logger *dc_logger = logger
drivers/gpu/drm/amd/display/dc/hwss/dcn351/dcn351_init.c +1 -0
@@ -35,6 +35,7 @@#include "dcn351/dcn351_hwseq.h" #include "dcn351_init.h" +#include "dc_priv.h" static const struct hw_sequencer_funcs dcn351_funcs = { .program_gamut_remap = dcn30_program_gamut_remap,
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +1 -0
@@ -41,6 +41,7 @@#include "../hw_sequencer.h" #include "dio/dcn10/dcn10_dio.h" #include "gpio_service_interface.h" +#include "dc_priv.h" #define DC_LOGGER_INIT (logger)
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_init.c +1 -0
@@ -12,6 +12,7 @@#include "dcn35/dcn35_hwseq.h" #include "dcn401/dcn401_hwseq.h" #include "dcn401_init.h" +#include "dc_priv.h" static const struct hw_sequencer_funcs dcn401_funcs = { .program_gamut_remap = dcn401_program_gamut_remap,
drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.c +1 -0
@@ -36,6 +36,7 @@#include "dcn35/dcn35_hwseq.h" #include "dcn42/dcn42_hwseq.h" #include "dio/dcn10/dcn10_dio.h" +#include "dc_priv.h" #define DC_LOGGER \ ctx->logger
drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_init.c +1 -0
@@ -14,6 +14,7 @@#include "dcn401/dcn401_hwseq.h" #include "dcn42/dcn42_hwseq.h" #include "dcn42_init.h" +#include "dc_priv.h" static const struct hw_sequencer_funcs dcn42_funcs = { .program_gamut_remap = dcn401_program_gamut_remap,
drivers/gpu/drm/amd/display/dc/hwss/dcn42b/dcn42b_hwseq.c +1 -0
@@ -16,6 +16,7 @@#include "opp.h" #include "mpc.h" #include "dcn42b_hwseq.h" +#include "dc_priv.h" #define CTX \ hws->ctx
drivers/gpu/drm/amd/display/dc/hwss/dcn42b/dcn42b_init.c +1 -0
@@ -8,6 +8,7 @@#include "dcn42/dcn42_init.h" #include "dcn42b_hwseq.h" #include "dcn42b_init.h" +#include "dc_priv.h" void dcn42b_hw_sequencer_init_functions (struct dc *dc) {
drivers/gpu/drm/amd/display/dc/hwss/dcn50/dcn50_hwseq.c +1 -0
@@ -36,6 +36,7 @@#include "dc_state_priv.h" #include "link_enc_cfg.h" #include "dio/dcn10/dcn10_dio.h" +#include "dc_priv.h" #define DC_LOGGER_INIT (logger)
drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.c +1 -0
@@ -39,6 +39,7 @@#include "dc_state_priv.h" #include "link_enc_cfg.h" #include "dio/dcn10/dcn10_dio.h" +#include "dc_priv.h" #define DC_LOGGER_INIT (logger)
drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_init.c +1 -0
@@ -15,6 +15,7 @@#include "dcn50/dcn50_hwseq.h" #include "dcn60_init.h" #include "dcn60_hwseq.h" +#include "dc_priv.h" static const struct hw_sequencer_funcs dcn60_funcs = { .program_gamut_remap = dcn401_program_gamut_remap,
drivers/gpu/drm/amd/display/dc/irq/dce110/irq_service_dce110.c +1 -0
@@ -35,6 +35,7 @@#include "ivsrcid/ivsrcid_vislands30.h" #include "dc.h" +#include "dc_priv.h" #include "core_types.h" #define DC_LOGGER \ irq_service->ctx->logger
drivers/gpu/drm/amd/display/dc/link/accessories/link_dp_cts.c +1 -0
@@ -35,6 +35,7 @@#include "dc_dmub_srv.h" #include "dce/dmub_hw_lock_mgr.h" #include "clk_mgr.h" +#include "dc_priv.h" #define DC_LOGGER \ link->ctx->logger
drivers/gpu/drm/amd/display/dc/link/accessories/link_dp_trace.c +1 -0
@@ -24,6 +24,7 @@*/ #include "link_dp_trace.h" #include "link/protocols/link_dpcd.h" +#include "dc_priv.h" void dp_trace_init (struct dc_link *link) {
drivers/gpu/drm/amd/display/dc/link/hwss/link_hwss_dio.c +1 -0
@@ -25,6 +25,7 @@#include "link_hwss_dio.h" #include "core_types.h" #include "link_enc_cfg.h" +#include "dc_priv.h" /** * DOC: overview
drivers/gpu/drm/amd/display/dc/link/hwss/link_hwss_dio_fixed_vs_pe_retimer.c +1 -0
@@ -25,6 +25,7 @@#include "link_hwss_dio.h" #include "link_hwss_dio_fixed_vs_pe_retimer.h" #include "link_enc_cfg.h" +#include "dc_priv.h" uint8_t dp_dio_fixed_vs_pe_retimer_lane_cfg_to_hw_cfg (struct dc_link *link) {
drivers/gpu/drm/amd/display/dc/link/hwss/link_hwss_dpia.c +1 -0
@@ -26,6 +26,7 @@#include "core_types.h" #include "link_hwss_dio.h" #include "link_enc_cfg.h" +#include "dc_priv.h" #define DC_LOGGER \ link->ctx->logger
drivers/gpu/drm/amd/display/dc/link/hwss/link_hwss_hpo_dp.c +1 -0
@@ -27,6 +27,7 @@#include "core_types.h" #include "dccg.h" #include "clk_mgr.h" +#include "dc_priv.h" #define DC_LOGGER link->ctx->logger
drivers/gpu/drm/amd/display/dc/link/hwss/link_hwss_hpo_fixed_vs_pe_retimer_dp.c +1 -0
@@ -25,6 +25,7 @@#include "link_hwss_hpo_dp.h" #include "link_hwss_hpo_fixed_vs_pe_retimer_dp.h" #include "link_hwss_dio_fixed_vs_pe_retimer.h" +#include "dc_priv.h" static void dp_hpo_fixed_vs_pe_retimer_set_tx_ffe (struct dc_link *link,const struct dc_lane_settings *hw_lane_settings)
drivers/gpu/drm/amd/display/dc/link/hwss/link_hwss_hpo_frl.c +1 -0
@@ -25,6 +25,7 @@#include "link_hwss_hpo_frl.h" #include "core_types.h" #include "link/hwss/link_hwss_virtual.h" +#include "dc_priv.h" static void setup_hpo_frl_stream_attribute (struct pipe_ctx *pipe_ctx) {
drivers/gpu/drm/amd/display/dc/link/link_detection.c +1 -0
@@ -48,6 +48,7 @@#include "link_enc_cfg.h" #include "dm_helpers.h" #include "clk_mgr.h" +#include "dc_priv.h" // Offset DPCD 050Eh == 0x5A #define MST_HUB_ID_0x5A 0x5A
drivers/gpu/drm/amd/display/dc/link/link_dpms.c +1 -0
@@ -58,6 +58,7 @@#include "clk_mgr.h" #include "atomfirmware.h" #include "vpg.h" +#include "dc_priv.h" #define DC_LOGGER \ dc_logger
drivers/gpu/drm/amd/display/dc/link/link_factory.c +1 -0
@@ -46,6 +46,7 @@#include "protocols/link_hpd.h" #include "gpio_service_interface.h" #include "atomfirmware.h" +#include "dc_priv.h" #define DC_LOGGER \ dc_ctx->logger
drivers/gpu/drm/amd/display/dc/link/link_resource.c +1 -0
@@ -28,6 +28,7 @@#include "link_resource.h" #include "protocols/link_dp_capability.h" +#include "dc_priv.h" void link_get_cur_link_res (const struct dc_link *link,struct link_resource *link_res)
drivers/gpu/drm/amd/display/dc/link/link_validation.c +1 -0
@@ -33,6 +33,7 @@#include "protocols/link_dp_dpia_bw.h" #include "protocols/link_hdmi_frl.h" #include "resource.h" +#include "dc_priv.h" #define DC_LOGGER_INIT (logger)
drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.c +1 -0
@@ -38,6 +38,7 @@#include "link_dpcd.h" #include "dm_helpers.h" #include "atomfirmware.h" +#include "dc_priv.h" #define DC_LOGGER \ ddc_service->ctx->logger
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c +1 -0
@@ -50,6 +50,7 @@#include "link_enc_cfg.h" #include "dc_dmub_srv.h" #include "gpio_service_interface.h" +#include "dc_priv.h" #define DC_TRACE_LEVEL_MESSAGE (...)/* do nothing */
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c +1 -0
@@ -29,6 +29,7 @@#include "link_dp_dpia_bw.h" #include "link_dpcd.h" #include "dc_dmub_srv.h" +#include "dc_priv.h" #define DC_LOGGER \ link->ctx->logger
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_irq_handler.c +1 -0
@@ -39,6 +39,7 @@#include "link/link_dpms.h" #include "dm_helpers.h" #include "link_dp_dpia_bw.h" +#include "dc_priv.h" #define DC_LOGGER \ link->ctx->logger
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.c +1 -0
@@ -30,6 +30,7 @@#include "dm_helpers.h" #include "dc/dc_dmub_srv.h" #include "dce/dmub_replay.h" +#include "dc_priv.h" #define DC_LOGGER \ link->ctx->logger
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_phy.c +1 -0
@@ -38,6 +38,7 @@#include "resource.h" #include "link_enc_cfg.h" #include "atomfirmware.h" +#include "dc_priv.h" #define DC_LOGGER \ link->ctx->logger
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c +1 -0
@@ -47,6 +47,7 @@#include "link_enc_cfg.h" #include "resource.h" #include "dm_helpers.h" +#include "dc_priv.h" #define DC_LOGGER \ link->ctx->logger
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training_128b_132b.c +1 -0
@@ -32,6 +32,7 @@#include "link_dpcd.h" #include "link_dp_phy.h" #include "link_dp_capability.h" +#include "dc_priv.h" #define DC_LOGGER \ link->ctx->logger
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training_8b_10b.c +1 -0
@@ -31,6 +31,7 @@#include "link_dpcd.h" #include "link_dp_phy.h" #include "link_dp_capability.h" +#include "dc_priv.h" #define DC_LOGGER \ link->ctx->logger
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training_dpia.c +1 -0
@@ -28,6 +28,7 @@*/ #include "link_dp_training_dpia.h" #include "dc.h" +#include "dc_priv.h" #include "inc/core_status.h" #include "dpcd_defs.h"
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training_fixed_vs_pe_retimer.c +1 -0
@@ -37,6 +37,7 @@#include "link_dp_phy.h" #include "link_dp_capability.h" #include "link_ddc.h" +#include "dc_priv.h" #define DC_LOGGER \ link->ctx->logger
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +1 -0
@@ -41,6 +41,7 @@#include "abm.h" #include "resource.h" #include "link_dp_panel_replay.h" +#include "dc_priv.h" #define DC_LOGGER \ link->ctx->logger#define DC_LOGGER_INIT (logger)
drivers/gpu/drm/amd/display/dc/link/protocols/link_hdmi_frl.c +1 -0
@@ -42,6 +42,7 @@#include "dccg.h" #include "dml/dml1_frl_cap_chk.h" +#include "dc_priv.h" #define DC_LOGGER \ dc_logger
drivers/gpu/drm/amd/display/dc/mpc/dcn20/dcn20_mpc.c +1 -0
@@ -27,6 +27,7 @@#include "reg_helper.h" #include "dc.h" +#include "dc_priv.h" #include "mem_input.h" #include "dcn10/dcn10_cm_common.h"
drivers/gpu/drm/amd/display/dc/mpc/dcn30/dcn30_mpc.c +1 -0
@@ -29,6 +29,7 @@#include "basics/conversion.h" #include "dcn10/dcn10_cm_common.h" #include "dc.h" +#include "dc_priv.h" #define REG (reg)\ mpc30->mpc_regs->reg
drivers/gpu/drm/amd/display/dc/mpc/dcn32/dcn32_mpc.c +1 -0
@@ -30,6 +30,7 @@#include "basics/conversion.h" #include "dcn10/dcn10_cm_common.h" #include "dc.h" +#include "dc_priv.h" #define REG (reg)\ mpc30->mpc_regs->reg
drivers/gpu/drm/amd/display/dc/mpc/dcn401/dcn401_mpc.c +1 -0
@@ -25,6 +25,7 @@#include "reg_helper.h" #include "dc.h" +#include "dc_priv.h" #include "dcn401_mpc.h" #include "dcn10/dcn10_cm_common.h" #include "basics/conversion.h"
drivers/gpu/drm/amd/display/dc/mpc/dcn60/dcn60_mpc.c +1 -0
@@ -3,6 +3,7 @@// Copyright 2025 Advanced Micro Devices, Inc. #include "reg_helper.h" #include "dc.h" +#include "dc_priv.h" #include "dcn60_mpc.h" #include "dcn10/dcn10_cm_common.h" #include "basics/conversion.h"
drivers/gpu/drm/amd/display/dc/opp/dcn10/dcn10_opp.c +1 -0
@@ -27,6 +27,7 @@#include "dm_services.h" #include "dcn10_opp.h" #include "reg_helper.h" +#include "dc_priv.h" #define REG (reg) \ (oppn10->regs->reg)
drivers/gpu/drm/amd/display/dc/opp/dcn20/dcn20_opp.c +1 -0
@@ -27,6 +27,7 @@#include "dm_services.h" #include "dcn20_opp.h" #include "reg_helper.h" +#include "dc_priv.h" #define REG (reg) \ (oppn20->regs->reg)
drivers/gpu/drm/amd/display/dc/optc/dcn30/dcn30_optc.c +1 -0
@@ -26,6 +26,7 @@#include "reg_helper.h" #include "dcn30_optc.h" #include "dc.h" +#include "dc_priv.h" #include "dcn_calc_math.h" #include "dc_dmub_srv.h"
drivers/gpu/drm/amd/display/dc/optc/dcn32/dcn32_optc.c +1 -0
@@ -29,6 +29,7 @@#include "dcn31/dcn31_optc.h" #include "reg_helper.h" #include "dc.h" +#include "dc_priv.h" #include "dcn_calc_math.h" #include "dc_dmub_srv.h"
drivers/gpu/drm/amd/display/dc/optc/dcn35/dcn35_optc.c +1 -0
@@ -31,6 +31,7 @@#include "dcn32/dcn32_optc.h" #include "reg_helper.h" #include "dc.h" +#include "dc_priv.h" #include "dcn_calc_math.h" #include "dc_dmub_srv.h"
drivers/gpu/drm/amd/display/dc/optc/dcn401/dcn401_optc.c +1 -0
@@ -8,6 +8,7 @@#include "dcn32/dcn32_optc.h" #include "reg_helper.h" #include "dc.h" +#include "dc_priv.h" #include "dcn_calc_math.h" #include "dc_dmub_srv.h"
drivers/gpu/drm/amd/display/dc/optc/dcn42/dcn42_optc.c +1 -0
@@ -10,6 +10,7 @@#include "dcn401/dcn401_optc.h" #include "reg_helper.h" #include "dc.h" +#include "dc_priv.h" #include "dcn_calc_math.h" #include "dc_dmub_srv.h" #include "dc_trace.h"
drivers/gpu/drm/amd/display/dc/pg/dcn35/dcn35_pg_cntl.c +1 -0
@@ -28,6 +28,7 @@#include "core_types.h" #include "dcn35_pg_cntl.h" #include "dccg.h" +#include "dc_priv.h" #define TO_DCN_PG_CNTL (pg_cntl)\ container_of(pg_cntl, struct dcn_pg_cntl, base)
drivers/gpu/drm/amd/display/dc/pg/dcn42/dcn42_pg_cntl.c +1 -0
@@ -7,6 +7,7 @@#include "dcn42_pg_cntl.h" #include "dccg.h" #include "resource.h" +#include "dc_priv.h" #define TO_DCN_PG_CNTL (pg_cntl)\ container_of(pg_cntl, struct dcn_pg_cntl, base)
drivers/gpu/drm/amd/display/dc/resource/dce100/dce100_resource.c +1 -0
@@ -62,6 +62,7 @@#ifndef mmMC_HUB_RDREQ_DMIF_LIMIT#include "gmc/gmc_8_2_d.h" #include "gmc/gmc_8_2_sh_mask.h" +#include "dc_priv.h" #endif #ifndef mmDP_DPHY_INTERNAL_CTRL
drivers/gpu/drm/amd/display/dc/resource/dce110/dce110_resource.c +1 -0
@@ -66,6 +66,7 @@#ifndef mmMC_HUB_RDREQ_DMIF_LIMIT#include "gmc/gmc_8_2_d.h" #include "gmc/gmc_8_2_sh_mask.h" +#include "dc_priv.h" #endif #ifndef mmDP_DPHY_INTERNAL_CTRL
drivers/gpu/drm/amd/display/dc/resource/dce112/dce112_resource.c +1 -0
@@ -58,6 +58,7 @@#include "dce100/dce100_resource.h" #include "dce112_resource.h" +#include "dc_priv.h" #define DC_LOGGER \ dc->ctx->logger
drivers/gpu/drm/amd/display/dc/resource/dce120/dce120_resource.c +1 -0
@@ -68,6 +68,7 @@#include "dce100/dce100_resource.h" #include "link_service.h" +#include "dc_priv.h" #ifndef mmDP0_DP_DPHY_INTERNAL_CTRL#define mmDP0_DP_DPHY_INTERNAL_CTRL 0x210f
drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c +1 -0
@@ -66,6 +66,7 @@#ifndef mmMC_HUB_RDREQ_DMIF_LIMIT#include "gmc/gmc_6_0_d.h" #include "gmc/gmc_6_0_sh_mask.h" +#include "dc_priv.h" #endif #ifndef mmDP_DPHY_INTERNAL_CTRL
drivers/gpu/drm/amd/display/dc/resource/dce80/dce80_resource.c +1 -0
@@ -64,6 +64,7 @@#endif #include "dce80/dce80_resource.h" +#include "dc_priv.h" #ifndef mmDP_DPHY_INTERNAL_CTRL#define mmDP_DPHY_INTERNAL_CTRL 0x1CDE
drivers/gpu/drm/amd/display/dc/resource/dcn10/dcn10_resource.c +1 -0
@@ -26,6 +26,7 @@#include "core_status.h" #include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "dcn10/dcn10_init.h"
drivers/gpu/drm/amd/display/dc/resource/dcn20/dcn20_resource.c +1 -0
@@ -26,6 +26,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "dcn20/dcn20_init.h"
drivers/gpu/drm/amd/display/dc/resource/dcn201/dcn201_resource.c +1 -0
@@ -25,6 +25,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "dcn201/dcn201_init.h" #include "dml/dcn20/dcn20_fpu.h"
drivers/gpu/drm/amd/display/dc/resource/dcn21/dcn21_resource.c +1 -0
@@ -28,6 +28,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "dcn21/dcn21_init.h"
drivers/gpu/drm/amd/display/dc/resource/dcn30/dcn30_resource.c +1 -0
@@ -26,6 +26,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "dcn30/dcn30_init.h"
drivers/gpu/drm/amd/display/dc/resource/dcn301/dcn301_resource.c +1 -0
@@ -26,6 +26,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "dcn301/dcn301_init.h"
drivers/gpu/drm/amd/display/dc/resource/dcn302/dcn302_resource.c +1 -0
@@ -78,6 +78,7 @@#include "dpcs/dpcs_3_0_0_sh_mask.h" #include "nbio/nbio_7_4_offset.h" #include "amdgpu_socbb.h" +#include "dc_priv.h" #define DC_LOGGER \ dc->ctx->logger
drivers/gpu/drm/amd/display/dc/resource/dcn303/dcn303_resource.c +1 -0
@@ -77,6 +77,7 @@#include "nbio/nbio_2_3_offset.h" #include "dml/dcn303/dcn303_fpu.h" +#include "dc_priv.h" #define DC_LOGGER \ dc->ctx->logger
drivers/gpu/drm/amd/display/dc/resource/dcn31/dcn31_resource.c +1 -0
@@ -26,6 +26,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "dcn31/dcn31_init.h"
drivers/gpu/drm/amd/display/dc/resource/dcn314/dcn314_resource.c +1 -0
@@ -27,6 +27,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "dcn31/dcn31_init.h" #include "dcn314/dcn314_init.h"
drivers/gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c +1 -0
@@ -26,6 +26,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "dcn31/dcn31_init.h"
drivers/gpu/drm/amd/display/dc/resource/dcn316/dcn316_resource.c +1 -0
@@ -26,6 +26,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "dcn31/dcn31_init.h"
drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c +1 -0
@@ -27,6 +27,7 @@#include "dc_types.h" #include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "dcn32/dcn32_init.h"
drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource_helpers.c +1 -0
@@ -30,6 +30,7 @@#include "dml/dcn32/dcn32_fpu.h" #include "dc_state_priv.h" #include "dc_stream_priv.h" +#include "dc_priv.h" static bool is_dual_plane (enum surface_pixel_format format) {
drivers/gpu/drm/amd/display/dc/resource/dcn321/dcn321_resource.c +1 -0
@@ -26,6 +26,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "dcn32/dcn32_init.h"
drivers/gpu/drm/amd/display/dc/resource/dcn35/dcn35_resource.c +1 -0
@@ -26,6 +26,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "dcn31/dcn31_init.h" #include "dcn35/dcn35_init.h"
drivers/gpu/drm/amd/display/dc/resource/dcn351/dcn351_resource.c +1 -0
@@ -4,6 +4,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "dcn31/dcn31_init.h" #include "dcn351/dcn351_init.h"
drivers/gpu/drm/amd/display/dc/resource/dcn36/dcn36_resource.c +1 -0
@@ -3,6 +3,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "dcn31/dcn31_init.h" #include "dcn35/dcn35_init.h"
drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c +1 -0
@@ -4,6 +4,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "dcn32/dcn32_init.h" #include "dcn401/dcn401_init.h"
drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c +1 -0
@@ -4,6 +4,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "dcn32/dcn32_init.h" #include "dcn42/dcn42_init.h"
drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource_fpu.c +1 -0
@@ -5,6 +5,7 @@#include "dc.h" +#include "dc_priv.h" #include "dcn42_resource_fpu.h" #define DC_LOGGER_INIT (logger)
drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c +1 -0
@@ -6,6 +6,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "dcn32/dcn32_init.h" #include "dcn42/dcn42_init.h"
drivers/gpu/drm/amd/display/dc/resource/dcn60/dcn60_resource.c +1 -0
@@ -5,6 +5,7 @@#include "dm_services.h" #include "dm_helpers.h" #include "dc.h" +#include "dc_priv.h" #include "dcn32/dcn32_init.h" #include "dcn401/dcn401_init.h"
drivers/gpu/drm/amd/display/dc/rmcm/dcn42/dcn42_rmcm.c +1 -0
@@ -25,6 +25,7 @@#include "reg_helper.h" #include "dc.h" +#include "dc_priv.h" #include "dcn42_rmcm.h" #include "dcn10/dcn10_cm_common.h" #include "basics/conversion.h"
drivers/gpu/drm/amd/display/dc/rmcm/dcn60/dcn60_rmcm.c +1 -0
@@ -25,6 +25,7 @@#include "dm_services.h" #include "dc.h" +#include "dc_priv.h" #include "reg_helper.h" #include "dcn/dcn_6_0_0_offset.h"
drivers/gpu/drm/amd/display/dc/soc_and_ip_translator/dcn401/dcn401_soc_and_ip_translator.c +1 -0
@@ -4,6 +4,7 @@#include "dcn401_soc_and_ip_translator.h" #include "bounding_boxes/dcn4_soc_bb.h" +#include "dc_priv.h" /* soc_and_ip_translator component used to get up-to-date values for bounding box. * Bounding box values are stored in several locations and locations can vary with DCN revision.
drivers/gpu/drm/amd/display/dc/soc_and_ip_translator/dcn42/dcn42_soc_and_ip_translator.c +1 -0
@@ -5,6 +5,7 @@#include "dcn42_soc_and_ip_translator.h" #include "../dcn401/dcn401_soc_and_ip_translator.h" #include "bounding_boxes/dcn42_soc_bb.h" +#include "dc_priv.h" /* soc_and_ip_translator component used to get up-to-date values for bounding box. * Bounding box values are stored in several locations and locations can vary with DCN revision.
drivers/gpu/drm/amd/display/dc/soc_and_ip_translator/dcn60/dcn60_soc_and_ip_translator.c +1 -0
@@ -6,6 +6,7 @@#include "soc_and_ip_translator/dcn401/dcn401_soc_and_ip_translator.h" #include "bounding_boxes/dcn6_soc_bb.h" #include "dal_asic_id.h" +#include "dc_priv.h" /* soc_and_ip_translator component used to get up-to-date values for bounding box. * Bounding box values are stored in several locations and locations can vary with DCN revision.
Signature · 1 line
2.56.0
PATCH 14/19 drm/amd/display: Restrict the dc directory root to DC-internal builds
In reply to Dave AirlieThe dc directory root holds private headers (dc_priv.h and the other *_priv.h / internal headers). Remove the global -I(full-amd-display-path)/dc include flags from amdgpu/Makefile, amdgpu_dm/Makefile and the amdgpu_dm tests so the root cannot be reached from outside DC anymore; with this, including dc_priv.h from DM or the DAL modules fails at compile time.
To keep the many "subdir/header.h" includes inside DC working, give DC-internal objects the root on their include path through per-object CFLAGS in dc/Makefile (same mechanism the DML Makefiles already use for FPU flags) instead of a global ccflags-y entry.
Relocate the public dc-root headers to dc/inc, which was already the exported interface directory:
dc.h, dc_types.h, dc_state.h, dc_plane.h, dc_probe.h, dc_memory_pool.h, dc_ddc_types.h, dc_dp_types.h, dc_hdmi_types.h, dc_hw_types.h, os_types.h, irq_types.h, dm_helpers.h, dm_services.h, dm_services_types.h, dm_pp_smu.h, dc_dmub_srv.h, dc_bios_types.h, dc_trace.h, dm_cp_psp.h, dc_fused_io.h, dc_stat.h, dc_stream.h, dc_dsc.h
No includer outside DC needs to change: bare-name includes resolve through the existing -Idc/inc. Fix the few headers that referenced siblings through the old root-relative forms (angle-bracket inc/hw/*.h includes, inc/, dml/, dml2_wrapper/, sspl/ prefixes), the handful of DM and dmub path includes, and the dm_pp_smu.h include in pm/swsmu.
Also drop an unused dcn20_resource.h include from amdgpu_dm_mst_types.c that only worked by accident.
---
drivers/gpu/drm/amd/amdgpu/Makefile | 1 -
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 18 +++++++++---------
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_audio.c | 2 +-
.../drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c | 6 +++---
.../drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c | 16 ++++++++--------
.../drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 6 +++---
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c | 8 ++++----
.../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 2 +-
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c | 6 +++---
.../drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 2 +-
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c | 2 +-
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h | 4 ++--
drivers/gpu/drm/amd/display/amdgpu_dm/tests/Makefile | 1 -
.../display/amdgpu_dm/tests/amdgpu_dm_audio_test.c | 4 ++--
.../amdgpu_dm/tests/amdgpu_dm_backlight_test.c | 2 +-
.../amdgpu_dm/tests/amdgpu_dm_connector_test.c | 6 +++---
.../display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c | 8 ++++----
.../display/amdgpu_dm/tests/amdgpu_dm_dmub_test.c | 6 +++---
.../amdgpu_dm/tests/amdgpu_dm_freesync_test.c | 2 +-
.../amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c | 6 +++---
.../amdgpu_dm/tests/amdgpu_dm_mst_types_test.c | 6 +++---
.../drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c | 4 ++--
drivers/gpu/drm/amd/display/dc/Makefile | 10 ++++++++++
.../display/dc/bls_builder/bls_builder_legacy_init.h | 2 +-
drivers/gpu/drm/amd/display/dc/core/dc_stat.c | 2 +-
drivers/gpu/drm/amd/display/dc/core2/dc_core2.h | 2 +-
.../drm/amd/display/dc/dc_api_dispatch/api_shim.c | 2 +-
.../drm/amd/display/dc/dc_api_dispatch/api_shim.h | 2 +-
drivers/gpu/drm/amd/display/dc/dce/dce_aux.h | 2 +-
drivers/gpu/drm/amd/display/dc/dce/dce_i2c.h | 2 +-
.../drm/amd/display/dc/dce110/dce110_mem_input_v.c | 2 +-
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_afmt.c | 2 +-
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_vpg.c | 2 +-
.../gpu/drm/amd/display/dc/hwss/dcn10/dcn10_init.c | 2 +-
.../gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 2 +-
.../gpu/drm/amd/display/dc/hwss/dcn31/dcn31_hwseq.c | 2 +-
.../drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.c | 2 +-
.../gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c | 2 +-
.../gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.h | 2 +-
.../drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.h | 2 +-
.../gpu/drm/amd/display/dc/hwss/dcn50/dcn50_hwseq.h | 2 +-
.../gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.h | 2 +-
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h | 16 ++++++++--------
drivers/gpu/drm/amd/display/dc/inc/core_types.h | 8 ++++----
drivers/gpu/drm/amd/display/dc/{ => inc}/dc.h | 20 ++++++++++----------
.../gpu/drm/amd/display/dc/{ => inc}/dc_bios_types.h | 0
.../gpu/drm/amd/display/dc/{ => inc}/dc_ddc_types.h | 0
.../gpu/drm/amd/display/dc/{ => inc}/dc_dmub_srv.h | 0
.../gpu/drm/amd/display/dc/{ => inc}/dc_dp_types.h | 0
drivers/gpu/drm/amd/display/dc/{ => inc}/dc_dsc.h | 0
.../gpu/drm/amd/display/dc/{ => inc}/dc_fused_io.h | 0
.../gpu/drm/amd/display/dc/{ => inc}/dc_hdmi_types.h | 0
.../gpu/drm/amd/display/dc/{ => inc}/dc_hw_types.h | 0
.../drm/amd/display/dc/{ => inc}/dc_memory_pool.h | 0
drivers/gpu/drm/amd/display/dc/{ => inc}/dc_plane.h | 0
drivers/gpu/drm/amd/display/dc/{ => inc}/dc_probe.h | 0
drivers/gpu/drm/amd/display/dc/{ => inc}/dc_stat.h | 0
drivers/gpu/drm/amd/display/dc/{ => inc}/dc_state.h | 2 +-
drivers/gpu/drm/amd/display/dc/{ => inc}/dc_stream.h | 0
drivers/gpu/drm/amd/display/dc/{ => inc}/dc_trace.h | 0
drivers/gpu/drm/amd/display/dc/{ => inc}/dc_types.h | 0
drivers/gpu/drm/amd/display/dc/inc/dcn_calcs.h | 2 +-
drivers/gpu/drm/amd/display/dc/{ => inc}/dm_cp_psp.h | 0
.../gpu/drm/amd/display/dc/{ => inc}/dm_helpers.h | 0
drivers/gpu/drm/amd/display/dc/{ => inc}/dm_pp_smu.h | 0
.../gpu/drm/amd/display/dc/{ => inc}/dm_services.h | 0
.../drm/amd/display/dc/{ => inc}/dm_services_types.h | 0
drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h | 2 +-
drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h | 4 ++--
drivers/gpu/drm/amd/display/dc/inc/hw/mcif_wb.h | 2 +-
drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h | 4 ++--
drivers/gpu/drm/amd/display/dc/inc/hw/transform.h | 2 +-
drivers/gpu/drm/amd/display/dc/{ => inc}/irq_types.h | 0
drivers/gpu/drm/amd/display/dc/{ => inc}/os_types.h | 0
.../drm/amd/display/dc/link/protocols/link_dp_dpia.c | 2 +-
.../display/dc/link/protocols/link_dp_panel_replay.c | 2 +-
.../dc/link/protocols/link_dp_training_dpia.c | 2 +-
.../dc/link/protocols/link_edp_panel_control.c | 2 +-
drivers/gpu/drm/amd/display/dmub/dmub_srv.h | 2 +-
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn32.c | 2 +-
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn35.c | 2 +-
drivers/gpu/drm/amd/display/modules/power/power.c | 2 +-
.../gpu/drm/amd/display/modules/power/power_abm.c | 2 +-
.../gpu/drm/amd/display/modules/power/power_psr.c | 2 +-
.../gpu/drm/amd/display/modules/power/power_replay.c | 2 +-
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h | 2 +-
86 files changed, 130 insertions(+), 122 deletions(-)drivers/gpu/drm/amd/amdgpu/Makefile +0 -1
@@ -39,7 +39,6 @@ ccflags-y := -I$(FULL_AMD_PATH)/include/asic_reg \ -I$(FULL_AMD_DISPLAY_PATH) \ -I$(FULL_AMD_DISPLAY_PATH)/include \ -I$(FULL_AMD_DISPLAY_PATH)/modules/inc \ - -I$(FULL_AMD_DISPLAY_PATH)/dc \ -I$(FULL_AMD_DISPLAY_PATH)/amdgpu_dm \ -I$(FULL_AMD_PATH)/amdkfd \ -I$(FULL_AMD_PATH)/ras/ras_mgr
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +9 -9
@@ -30,19 +30,19 @@#include "dm_services_types.h" #include "dc.h" #include "link_enc_cfg.h" -#include "dc/inc/core_types.h" +#include "core_types.h" #include "dal_asic_id.h" #include "dmub/dmub_srv.h" -#include "dc/inc/hw/dmcu.h" -#include "dc/inc/hw/abm.h" -#include "dc/dc_dmub_srv.h" -#include "dc/dc_stat.h" -#include "dc/dc_state.h" +#include "hw/dmcu.h" +#include "hw/abm.h" +#include "dc_dmub_srv.h" +#include "dc_stat.h" +#include "dc_state.h" #include "amdgpu_dm_trace.h" -#include "link/protocols/link_dpcd.h" +#include "dc/link/protocols/link_dpcd.h" #include "link_service_types.h" -#include "link/protocols/link_dp_capability.h" -#include "link/protocols/link_ddc.h" +#include "dc/link/protocols/link_dp_capability.h" +#include "dc/link/protocols/link_ddc.h" #include "amdgpu.h" #include "amdgpu_display.h"
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_audio.c +1 -1
@@ -36,7 +36,7 @@#include <drm/drm_edid.h> #include <drm/drm_eld.h> -#include "dc/inc/core_types.h" +#include "core_types.h" static int amdgpu_dm_audio_component_get_eld(struct device *kdev, int port, int pipe, bool *enabled,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c +3 -3
@@ -24,9 +24,9 @@*/ #include "dc.h" -#include "dc/dc_dmub_srv.h" -#include "dc/dc_state.h" -#include "dc/dc_stat.h" +#include "dc_dmub_srv.h" +#include "dc_state.h" +#include "dc_stat.h" #include "amdgpu.h" #include "amdgpu_display.h"
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c +8 -8
@@ -26,16 +26,16 @@#include "dm_services_types.h" #include "dc.h" -#include "dc/dc_dmub_srv.h" -#include "dc/dc_stat.h" -#include "dc/dc_state.h" -#include "dc/dc_stream.h" -#include "dc/inc/core_types.h" +#include "dc_dmub_srv.h" +#include "dc_stat.h" +#include "dc_state.h" +#include "dc_stream.h" +#include "core_types.h" #include "link_enc_cfg.h" -#include "link/protocols/link_dpcd.h" +#include "dc/link/protocols/link_dpcd.h" #include "link_service_types.h" -#include "link/protocols/link_dp_capability.h" -#include "link/protocols/link_ddc.h" +#include "dc/link/protocols/link_dp_capability.h" +#include "dc/link/protocols/link_ddc.h" #include "amdgpu.h" #include "amdgpu_display.h"
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +3 -3
@@ -39,9 +39,9 @@#include "resource.h" #include "dsc.h" #include "link_hwss.h" -#include "dc/dc_dmub_srv.h" -#include "link/protocols/link_dp_capability.h" -#include "inc/hw/dchubbub.h" +#include "dc_dmub_srv.h" +#include "dc/link/protocols/link_dp_capability.h" +#include "dc/inc/hw/dchubbub.h" #ifdef CONFIG_DRM_AMD_SECURE_DISPLAY #include "amdgpu_dm_psr.h"
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c +4 -4
@@ -26,11 +26,11 @@#include "dm_services_types.h" #include "dc.h" -#include "dc/inc/core_types.h" -#include "dc/dc_dmub_srv.h" +#include "core_types.h" +#include "dc_dmub_srv.h" #include "dmub/dmub_srv.h" -#include "dc/inc/hw/dmcu.h" -#include "dc/inc/hw/abm.h" +#include "hw/dmcu.h" +#include "hw/abm.h" #include "dal_asic_id.h" #include "amdgpu.h"
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +1 -1
@@ -43,7 +43,7 @@#include "amdgpu_dm_irq.h" #include "amdgpu_dm_mst_types.h" #include "dpcd_defs.h" -#include "dc/inc/core_types.h" +#include "core_types.h" #include "dm_helpers.h" #include "ddc_service_types.h"
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c +3 -3
@@ -26,8 +26,8 @@#include "dm_services_types.h" #include "dc.h" -#include "dc/dc_dmub_srv.h" -#include "dc/dc_stat.h" +#include "dc_dmub_srv.h" +#include "dc_stat.h" #include "amdgpu.h" #include "amdgpu_display.h"
@@ -39,7 +39,7 @@#include "amdgpu_dm_mst_types.h" #include "amdgpu_dm_dmub.h" #include "amdgpu_dm_trace.h" -#include "link/protocols/link_dpcd.h" +#include "dc/link/protocols/link_dpcd.h" #include "link_service_types.h" #include "ivsrcid/ivsrcid_vislands30.h" #include "ivsrcid/dcn/irqsrcs_dcn_1_0.h"
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +1 -1
@@ -39,6 +39,7 @@#include "amdgpu_dm_hdcp.h" #include "dc.h" +#include "core_types.h" #include "dm_helpers.h" #include "ddc_service_types.h"
@@ -48,7 +49,6 @@#include "amdgpu_dm_debugfs.h" #endif -#include "dc/resource/dcn20/dcn20_resource.h" #define PEAK_FACTOR_X1000 1006
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c +1 -1
@@ -30,7 +30,7 @@#include "amdgpu_dm.h" #include "modules/power/power_helpers.h" #include "dmub/inc/dmub_cmd.h" -#include "dc/inc/link_service.h" +#include "link_service.h" #include "dm_helpers.h"
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_trace.h +2 -2
@@ -38,9 +38,9 @@#include <drm/drm_framebuffer.h> #include <drm/drm_encoder.h> #include <drm/drm_atomic.h> -#include "dc/inc/hw/optc.h" +#include "hw/optc.h" -#include "dc/inc/core_types.h" +#include "core_types.h" DECLARE_EVENT_CLASS(amdgpu_dc_reg_template, TP_PROTO(unsigned long *count, uint32_t reg, uint32_t value),
drivers/gpu/drm/amd/display/amdgpu_dm/tests/Makefile +0 -1
@@ -8,7 +8,6 @@ ccflags-y += -I$(src)/.. ccflags-y += -I$(src)/../.. ccflags-y += -I$(src)/../../include ccflags-y += -I$(src)/../../modules/inc -ccflags-y += -I$(src)/../../dc ccflags-y += -I$(src)/../../../amdgpu ccflags-y += -I$(src)/../../../amdkfd ccflags-y += -I$(src)/../../../include
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_audio_test.c +2 -2
@@ -19,8 +19,8 @@#include "dc.h" #include "dc_test.h" -#include "dc/inc/core_types.h" -#include "dc/inc/hw/audio.h" +#include "core_types.h" +#include "hw/audio.h" #include "amdgpu.h" #include "amdgpu_mode.h" #include "amdgpu_dm.h"
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_backlight_test.c +1 -1
@@ -24,7 +24,7 @@#include "amdgpu_dm_kunit_test_helpers.h" #include "amd_shared.h" #include "link_service.h" -#include "dc/inc/hw/panel_cntl.h" +#include "hw/panel_cntl.h" struct dm_backlight_connector_fixture {struct amdgpu_device *adev;
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c +3 -3
@@ -34,9 +34,9 @@#include "amdgpu_dm_psr.h" #include "include/grph_object_id.h" #include "amdgpu_dm_kunit_test_helpers.h" -#include "inc/link_service.h" -#include "inc/resource.h" -#include "inc/hw/timing_generator.h" +#include "link_service.h" +#include "resource.h" +#include "dc/inc/hw/timing_generator.h" /* Tests for get_subconnector_type() */
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c +4 -4
@@ -14,10 +14,10 @@#include "dc.h" #include "dc_test.h" -#include "inc/core_types.h" -#include "irq/irq_service.h" -#include "inc/hw/timing_generator.h" -#include "inc/link_service.h" +#include "core_types.h" +#include "dc/irq/irq_service.h" +#include "dc/inc/hw/timing_generator.h" +#include "link_service.h" #include "amdgpu.h" #include "amdgpu_mode.h" #include "amdgpu_dm.h"
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_dmub_test.c +3 -3
@@ -11,9 +11,9 @@#include "dc.h" #include "dc_test.h" #include "amdgpu_dm_kunit_test_helpers.h" -#include "dc/inc/core_types.h" -#include "dc/inc/hw/dmcu.h" -#include "dc/inc/hw/abm.h" +#include "core_types.h" +#include "hw/dmcu.h" +#include "hw/abm.h" #include "amdgpu_mode.h" #include "amdgpu_dm.h" #include "dal_asic_id.h"
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_freesync_test.c +1 -1
@@ -14,7 +14,7 @@#include "dc.h" #include "dc_test.h" -#include "inc/core_types.h" +#include "core_types.h" #include "amd_shared.h" #include "amdgpu.h" #include "amdgpu_mode.h"
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c +3 -3
@@ -16,9 +16,9 @@#include "dc.h" #include "dc_test.h" -#include "inc/core_types.h" -#include "inc/hw/timing_generator.h" -#include "irq/irq_service.h" +#include "core_types.h" +#include "dc/inc/hw/timing_generator.h" +#include "dc/irq/irq_service.h" #include "amdgpu.h" #include "amdgpu_mode.h" #include "amdgpu_dm.h"
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c +3 -3
@@ -32,9 +32,9 @@#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" +#include "dc/dsc/dsc.h" +#include "core_types.h" +#include "link_service.h" /* * Minimal mock DPCD backing store and AUX transfer callback used to exercise
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +2 -2
@@ -23,11 +23,11 @@#include "dc.h" #include "dc_test.h" -#include "dc/dc_dmub_srv.h" +#include "dc_dmub_srv.h" #include "dal_asic_id.h" #include "dm_services_types.h" #include "dmub/dmub_srv.h" -#include "inc/core_types.h" +#include "core_types.h" #include "logger_types.h" #include "amd_shared.h" #include "amdgpu.h"
drivers/gpu/drm/amd/display/dc/Makefile +10 -0
@@ -98,3 +98,13 @@ endif AMD_DISPLAY_FILES += $(addprefix $(AMDDALPATH)/dc/, $(FILES)) +# The dc directory root holds private headers (dc_priv.h and friends) that +# must not be reachable outside DC, so the global include path deliberately +# stops at dc/inc. DC-internal objects still need the root on their include +# path for the many "subdir/header.h" includes inside DC, so add it per +# object instead of through a global ccflags-y entry. +DC_INTERNAL_OBJS := $(filter $(AMDDALPATH)/dc/%,$(AMD_DISPLAY_FILES)) +$(foreach obj,$(DC_INTERNAL_OBJS),\ + $(eval CFLAGS_$(obj) += -I$(FULL_AMD_DISPLAY_PATH)/dc)) + +
drivers/gpu/drm/amd/display/dc/bls_builder/bls_builder_legacy_init.h +1 -1
@@ -8,7 +8,7 @@#include "dmub_cmd.h" #include "grph_object_ctrl_defs.h" #include "bios_parser_types.h" -#include "inc/hw/hw_shared.h" +#include "hw/hw_shared.h" /* * DC2_DC1_Wrapped hardware init: dcn401_init_hw as twelve BLS stages.
drivers/gpu/drm/amd/display/dc/core/dc_stat.c +1 -1
@@ -22,7 +22,7 @@* Authors: AMD */ -#include "dc/dc_stat.h" +#include "dc_stat.h" #include "dmub/dmub_srv_stat.h" #include "dc_dmub_srv.h" #include "dc_priv.h"
drivers/gpu/drm/amd/display/dc/core2/dc_core2.h +1 -1
@@ -5,7 +5,7 @@#pragma once -#include "inc/dc_core_interface.h" +#include "dc_core_interface.h" struct dc ;
drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.c +1 -1
@@ -7,7 +7,7 @@#include "dc.h" #include "dc_api_dispatch/api_shim.h" #include "core2/dc_core2.h" -#include "inc/dc_core_interface.h" +#include "dc_core_interface.h" void api_shim_construct (struct dc *dc,const struct dc_init_data *init_params) {
drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.h +1 -1
@@ -7,7 +7,7 @@#include "dc.h" #include "dc_priv.h" -#include "inc/dc_core_interface.h" +#include "dc_core_interface.h" #include "bls_builder/dmub_abi.h" struct dc2 {
drivers/gpu/drm/amd/display/dc/dce/dce_aux.h +1 -1
@@ -27,7 +27,7 @@#define __DAL_AUX_ENGINE_DCE110_H__#include "gpio_service_interface.h" -#include "inc/hw/aux_engine.h" +#include "hw/aux_engine.h" enum aux_return_code_type ;
drivers/gpu/drm/amd/display/dc/dce/dce_i2c.h +1 -1
@@ -26,7 +26,7 @@#ifndef __DCE_I2C_H__#define __DCE_I2C_H__ -#include "inc/core_types.h" +#include "core_types.h" #include "dce_i2c_hw.h" #include "dce_i2c_sw.h"
drivers/gpu/drm/amd/display/dc/dce110/dce110_mem_input_v.c +1 -1
@@ -29,7 +29,7 @@/* TODO: this needs to be looked at, used by Stella's workaround*/ #include "include/logger_interface.h" -#include "inc/dce_calcs.h" +#include "dce_calcs.h" #include "dce/dce_mem_input.h" #include "dce110_mem_input_v.h"
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_afmt.c +1 -1
@@ -28,7 +28,7 @@#include "dcn30/dcn30_afmt.h" #include "dcn31_afmt.h" #include "reg_helper.h" -#include "dc/dc.h" +#include "dc.h" #include "dc_priv.h" #define DC_LOGGER \
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_vpg.c +1 -1
@@ -27,7 +27,7 @@#include "dcn30/dcn30_vpg.h" #include "dcn31_vpg.h" #include "reg_helper.h" -#include "dc/dc.h" +#include "dc.h" #include "dc_priv.h" #define DC_LOGGER \
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_init.c +1 -1
@@ -27,7 +27,7 @@#include "dce110/dce110_hwseq.h" #include "dcn10/dcn10_hwseq.h" #include "dcn20/dcn20_hwseq.h" -#include "dc/hwss/dce/dce_hwseq.h" +#include "hwss/dce/dce_hwseq.h" #include "dc_priv.h" static const struct hw_sequencer_funcs dcn10_funcs = {
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +1 -1
@@ -53,7 +53,7 @@#include "dce/dmub_hw_lock_mgr.h" #include "hw_sequencer.h" #include "dpcd_defs.h" -#include "inc/link_enc_cfg.h" +#include "link_enc_cfg.h" #include "link_hwss.h" #include "link_service.h" #include "dc_state_priv.h"
drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_hwseq.c +1 -1
@@ -49,7 +49,7 @@#include "link_service.h" #include "dcn10/dcn10_hwseq.h" #include "dcn21/dcn21_hwseq.h" -#include "inc/link_enc_cfg.h" +#include "link_enc_cfg.h" #include "dcn30/dcn30_vpg.h" #include "dce/dce_i2c_hw.h" #include "dce/dmub_abm_lcd.h"
drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.c +1 -1
@@ -48,7 +48,7 @@#include "dce/dmub_outbox.h" #include "link_service.h" #include "dcn10/dcn10_hwseq.h" -#include "inc/link_enc_cfg.h" +#include "link_enc_cfg.h" #include "dcn30/dcn30_vpg.h" #include "dce/dce_i2c_hw.h" #include "dsc.h"
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c +1 -1
@@ -50,7 +50,7 @@#include "link_service.h" #include "dce/dmub_hw_lock_mgr.h" #include "dcn10/dcn10_hwseq.h" -#include "inc/link_enc_cfg.h" +#include "link_enc_cfg.h" #include "dcn30/dcn30_vpg.h" #include "dce/dce_i2c_hw.h" #include "dsc.h"
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.h +1 -1
@@ -27,7 +27,7 @@#ifndef __DC_HWSS_DCN35_H__#define __DC_HWSS_DCN35_H__ -#include "inc/core_types.h" +#include "core_types.h" #include "dc.h" #include "hw_sequencer_private.h"
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.h +1 -1
@@ -5,7 +5,7 @@#ifndef __DC_HWSS_DCN401_H__#define __DC_HWSS_DCN401_H__ -#include "inc/core_types.h" +#include "core_types.h" #include "dc.h" #include "dc_stream.h" #include "hw_sequencer_private.h"
drivers/gpu/drm/amd/display/dc/hwss/dcn50/dcn50_hwseq.h +1 -1
@@ -5,7 +5,7 @@#ifndef __DC_HWSS_DCN50_H__#define __DC_HWSS_DCN50_H__ -#include "inc/core_types.h" +#include "core_types.h" #include "dc.h" #include "dc_stream.h" #include "hw_sequencer_private.h"
drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.h +1 -1
@@ -5,7 +5,7 @@#ifndef __DC_HWSS_DCN60_H__#define __DC_HWSS_DCN60_H__ -#include "inc/core_types.h" +#include "core_types.h" #include "dc.h" #include "dc_stream.h" #include "hw_sequencer_private.h"
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +8 -8
@@ -26,14 +26,14 @@#ifndef __DC_HW_SEQUENCER_H__#define __DC_HW_SEQUENCER_H__#include "dc_types.h" -#include "inc/clock_source.h" -#include "inc/hw/timing_generator.h" -#include "inc/hw/opp.h" -#include "inc/hw/link_encoder.h" -#include "inc/core_status.h" -#include "inc/hw/hw_shared.h" -#include "inc/hw/dchubbub.h" -#include "dsc/dsc.h" +#include "clock_source.h" +#include "hw/timing_generator.h" +#include "hw/opp.h" +#include "hw/link_encoder.h" +#include "core_status.h" +#include "hw/hw_shared.h" +#include "hw/dchubbub.h" +#include "../dsc/dsc.h" #include "link_service_types.h" #include "dmub/inc/dmub_cmd.h" #include "dc_dmub_srv.h"
drivers/gpu/drm/amd/display/dc/inc/core_types.h +4 -4
@@ -40,9 +40,9 @@#include "mcif_wb.h" #include "panel_cntl.h" #include "dmub/inc/dmub_cmd.h" -#include "bls_builder/bls_builder_legacy_init.h" +#include "../bls_builder/bls_builder_legacy_init.h" #include "pg_cntl.h" -#include "sspl/dc_spl.h" +#include "../sspl/dc_spl.h" #define MAX_CLOCK_SOURCES 7#define MAX_SVP_PHANTOM_STREAMS 2
@@ -61,8 +61,8 @@#include "transform.h" #include "dpp.h" -#include "dml2_0/dml21/inc/dml_top_dchub_registers.h" -#include "dml2_0/dml21/inc/dml_top_types.h" +#include "../dml2_0/dml21/inc/dml_top_dchub_registers.h" +#include "../dml2_0/dml21/inc/dml_top_types.h" struct resource_pool ;struct dc_state ;
drivers/gpu/drm/amd/display/dc/inc/dc.h renamed from drivers/gpu/drm/amd/display/dc/dc.h +10 -10
@@ -37,22 +37,22 @@#include "gpio_types.h" #include "link_service_types.h" #include "grph_object_ctrl_defs.h" -#include <inc/hw/opp.h> -#include <inc/hw/rmcm.h> +#include "hw/opp.h" +#include "hw/rmcm.h" -#include "hwss/hw_sequencer.h" -#include "inc/compressor.h" -#include "inc/hw/dmcu.h" -#include "dml/display_mode_lib.h" +#include "../hwss/hw_sequencer.h" +#include "compressor.h" +#include "hw/dmcu.h" +#include "../dml/display_mode_lib.h" -#include "dml2_wrapper/dml2_wrapper.h" +#include "../dml2_wrapper/dml2_wrapper.h" #include "dmub/inc/dmub_cmd.h" -#include "dml/dml1_frl_cap_chk.h" +#include "../dml/dml1_frl_cap_chk.h" -#include "sspl/dc_spl_types.h" -#include "inc/dc_core_interface.h" +#include "../sspl/dc_spl_types.h" +#include "dc_core_interface.h" struct abm_save_restore ;
drivers/gpu/drm/amd/display/dc/inc/dc_bios_types.h renamed from drivers/gpu/drm/amd/display/dc/dc_bios_types.h +0 -0
drivers/gpu/drm/amd/display/dc/inc/dc_ddc_types.h renamed from drivers/gpu/drm/amd/display/dc/dc_ddc_types.h +0 -0
drivers/gpu/drm/amd/display/dc/inc/dc_dmub_srv.h renamed from drivers/gpu/drm/amd/display/dc/dc_dmub_srv.h +0 -0
drivers/gpu/drm/amd/display/dc/inc/dc_dp_types.h renamed from drivers/gpu/drm/amd/display/dc/dc_dp_types.h +0 -0
drivers/gpu/drm/amd/display/dc/inc/dc_dsc.h renamed from drivers/gpu/drm/amd/display/dc/dc_dsc.h +0 -0
drivers/gpu/drm/amd/display/dc/inc/dc_fused_io.h renamed from drivers/gpu/drm/amd/display/dc/dc_fused_io.h +0 -0
drivers/gpu/drm/amd/display/dc/inc/dc_hdmi_types.h renamed from drivers/gpu/drm/amd/display/dc/dc_hdmi_types.h +0 -0
drivers/gpu/drm/amd/display/dc/inc/dc_hw_types.h renamed from drivers/gpu/drm/amd/display/dc/dc_hw_types.h +0 -0
drivers/gpu/drm/amd/display/dc/inc/dc_memory_pool.h renamed from drivers/gpu/drm/amd/display/dc/dc_memory_pool.h +0 -0
drivers/gpu/drm/amd/display/dc/inc/dc_plane.h renamed from drivers/gpu/drm/amd/display/dc/dc_plane.h +0 -0
drivers/gpu/drm/amd/display/dc/inc/dc_probe.h renamed from drivers/gpu/drm/amd/display/dc/dc_probe.h +0 -0
drivers/gpu/drm/amd/display/dc/inc/dc_stat.h renamed from drivers/gpu/drm/amd/display/dc/dc_stat.h +0 -0
drivers/gpu/drm/amd/display/dc/inc/dc_state.h renamed from drivers/gpu/drm/amd/display/dc/dc_state.h +1 -1
@@ -26,7 +26,7 @@#ifndef _DC_STATE_H_#define _DC_STATE_H_ -#include "inc/core_status.h" +#include "core_status.h" struct dc_state *dc_state_create (struct dc *dc,struct dc_state_create_params *params);void dc_state_copy (struct dc_state *dst_state,struct dc_state *src_state);
drivers/gpu/drm/amd/display/dc/inc/dc_stream.h renamed from drivers/gpu/drm/amd/display/dc/dc_stream.h +0 -0
drivers/gpu/drm/amd/display/dc/inc/dc_trace.h renamed from drivers/gpu/drm/amd/display/dc/dc_trace.h +0 -0
drivers/gpu/drm/amd/display/dc/inc/dc_types.h renamed from drivers/gpu/drm/amd/display/dc/dc_types.h +0 -0
drivers/gpu/drm/amd/display/dc/inc/dcn_calcs.h +1 -1
@@ -31,7 +31,7 @@#define __DCN_CALCS_H__#include "bw_fixed.h" -#include "dml/display_mode_lib.h" +#include "../dml/display_mode_lib.h" struct dc ;
drivers/gpu/drm/amd/display/dc/inc/dm_cp_psp.h renamed from drivers/gpu/drm/amd/display/dc/dm_cp_psp.h +0 -0
drivers/gpu/drm/amd/display/dc/inc/dm_helpers.h renamed from drivers/gpu/drm/amd/display/dc/dm_helpers.h +0 -0
drivers/gpu/drm/amd/display/dc/inc/dm_pp_smu.h renamed from drivers/gpu/drm/amd/display/dc/dm_pp_smu.h +0 -0
drivers/gpu/drm/amd/display/dc/inc/dm_services.h renamed from drivers/gpu/drm/amd/display/dc/dm_services.h +0 -0
drivers/gpu/drm/amd/display/dc/inc/dm_services_types.h renamed from drivers/gpu/drm/amd/display/dc/dm_services_types.h +0 -0
drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h +1 -1
@@ -33,7 +33,7 @@* blocks for the Data Fabric Interface that are not clock/power gated. */ -#include "dc/dc_hw_types.h" +#include "dc_hw_types.h" enum dcc_control { dcc_control__256_256_xxx,
drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h +2 -2
@@ -41,8 +41,8 @@#include "mem_input.h" #include "cursor_reg_cache.h" -#include "dml2_0/dml21/inc/dml_top_dchub_registers.h" -#include "dml2_0/dml21/inc/dml_top_types.h" +#include "../../dml2_0/dml21/inc/dml_top_dchub_registers.h" +#include "../../dml2_0/dml21/inc/dml_top_types.h" #define OPP_ID_INVALID 0xf#define MAX_TTU 0xffffff
drivers/gpu/drm/amd/display/dc/inc/hw/mcif_wb.h +1 -1
@@ -27,7 +27,7 @@#include "dc_hw_types.h" -#include "dml2_0/dml21/inc/dml_top_dchub_registers.h" +#include "../../dml2_0/dml21/inc/dml_top_dchub_registers.h" enum mmhubbub_wbif_mode {PACKED_444 =0 ,
drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h +2 -2
@@ -28,8 +28,8 @@#include "dc.h" #include "include/grph_object_id.h" -#include "dml/display_mode_structs.h" -#include "dml2_0/dml21/inc/dml_top_dchub_registers.h" +#include "../../dml/display_mode_structs.h" +#include "../../dml2_0/dml21/inc/dml_top_dchub_registers.h" struct dchub_init_data ;struct cstate_pstate_watermarks_st {
drivers/gpu/drm/amd/display/dc/inc/hw/transform.h +1 -1
@@ -29,7 +29,7 @@#include "hw_shared.h" #include "dc_hw_types.h" #include "fixed31_32.h" -#include "sspl/dc_spl_types.h" +#include "../sspl/dc_spl_types.h" #define CSC_TEMPERATURE_MATRIX_SIZE 12
drivers/gpu/drm/amd/display/dc/inc/irq_types.h renamed from drivers/gpu/drm/amd/display/dc/irq_types.h +0 -0
drivers/gpu/drm/amd/display/dc/inc/os_types.h renamed from drivers/gpu/drm/amd/display/dc/os_types.h +0 -0
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia.c +1 -1
@@ -25,7 +25,7 @@*/ #include "dc.h" -#include "inc/core_status.h" +#include "core_status.h" #include "dpcd_defs.h" #include "link_dp_dpia.h"
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_panel_replay.c +1 -1
@@ -28,7 +28,7 @@#include "link_ddc.h" #include "link_dpcd.h" #include "dm_helpers.h" -#include "dc/dc_dmub_srv.h" +#include "dc_dmub_srv.h" #include "dce/dmub_replay.h" #include "dc_priv.h"
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training_dpia.c +1 -1
@@ -29,7 +29,7 @@#include "link_dp_training_dpia.h" #include "dc.h" #include "dc_priv.h" -#include "inc/core_status.h" +#include "core_status.h" #include "dpcd_defs.h" #include "link_dp_dpia.h"
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +1 -1
@@ -36,7 +36,7 @@#include "dal_asic_id.h" #include "link_dp_phy.h" #include "dce/dmub_psr.h" -#include "dc/dc_dmub_srv.h" +#include "dc_dmub_srv.h" #include "dce/dmub_replay.h" #include "abm.h" #include "resource.h"
drivers/gpu/drm/amd/display/dmub/dmub_srv.h +1 -1
@@ -66,7 +66,7 @@*/ #include "inc/dmub_cmd.h" -#include "dc/dc_types.h" +#include "dc_types.h" #define DMUB_PC_SNAPSHOT_COUNT 10#define DMUB_TRACE_SNAPSHOT_COUNT 8
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn32.c +1 -1
@@ -26,7 +26,7 @@#include "../dmub_srv.h" #include "dmub_reg.h" #include "dmub_dcn32.h" -#include "dc/dc_types.h" +#include "dc_types.h" #include "dc_hw_types.h" #include "dcn/dcn_3_2_0_offset.h"
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn35.c +1 -1
@@ -27,7 +27,7 @@#include "dc_types.h" #include "dmub_reg.h" #include "dmub_dcn35.h" -#include "dc/dc_types.h" +#include "dc_types.h" #include "dcn/dcn_3_5_0_offset.h" #include "dcn/dcn_3_5_0_sh_mask.h"
drivers/gpu/drm/amd/display/modules/power/power.c +1 -1
@@ -30,7 +30,7 @@#include "dmcu.h" #include "abm.h" #include "power_helpers.h" -#include "dce/dmub_psr.h" +#include "dc/dce/dmub_psr.h" #include "dal_asic_id.h" #include "link_service.h" #include <linux/math.h>
drivers/gpu/drm/amd/display/modules/power/power_abm.c +1 -1
@@ -9,7 +9,7 @@#include "dmcu.h" #include "abm.h" #include "power_helpers.h" -#include "dce/dmub_psr.h" +#include "dc/dce/dmub_psr.h" #include "dal_asic_id.h" #include "link_service.h" #include <linux/math.h>
drivers/gpu/drm/amd/display/modules/power/power_psr.c +1 -1
@@ -9,7 +9,7 @@#include "dmcu.h" #include "abm.h" #include "power_helpers.h" -#include "dce/dmub_psr.h" +#include "dc/dce/dmub_psr.h" #include "dal_asic_id.h" #include "link_service.h" #include <linux/math.h>
drivers/gpu/drm/amd/display/modules/power/power_replay.c +1 -1
@@ -9,7 +9,7 @@#include "dmcu.h" #include "abm.h" #include "power_helpers.h" -#include "dce/dmub_psr.h" +#include "dc/dce/dmub_psr.h" #include "dal_asic_id.h" #include "link_service.h" #include <linux/math.h>
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +1 -1
@@ -28,7 +28,7 @@#include "amdgpu.h" #include "kgd_pp_interface.h" #include "dm_pp_interface.h" -#include "dm_pp_smu.h" +#include "dc/inc/dm_pp_smu.h" #include "smu_types.h" #include "linux/firmware.h" #include <linux/ktime.h>
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH 14/19] drm/amd/display: Restrict the dc directory root to DC-internal builds
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [High] drm/amdgpu: build failure with CONFIG_DRM_AMD_DC=n due to missing dc/inc path - [Medium]…
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider:
- [High] drm/amdgpu: build failure with CONFIG_DRM_AMD_DC=n due to missing dc/inc path
- [Medium] drm/amd/display: dc root include flag left in amdgpu_dm/Makefile
- [Low] drm/amd/display: stale dc.h path in display-manager.rst kernel-doc directives
--
commit a3254d30f8e563b4854ad67277856c56f8a96107
Author: Dave Airlie <[email protected]>
drm/amd/display: Restrict the dc directory root to DC-internal builds
This commit moves public headers from drivers/gpu/drm/amd/display/dc/ into drivers/gpu/drm/amd/display/dc/inc/ and restricts the dc root include path to DC-internal objects.
drivers/gpu/drm/amd/amdgpu/Makefile ccflags-y := -I$(FULL_AMD_PATH)/include/asic_reg \ · line 44
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/Makefile +0
-1@@ -39,7 +39,6 @@ ccflags-y := -I$(FULL_AMD_PATH)/include/asic_reg \ -I$(FULL_AMD_DISPLAY_PATH) \ -I$(FULL_AMD_DISPLAY_PATH)/include \ -I$(FULL_AMD_DISPLAY_PATH)/modules/inc \ - -I$(FULL_AMD_DISPLAY_PATH)/dc \ -I$(FULL_AMD_DISPLAY_PATH)/amdgpu_dm \ -I$(FULL_AMD_PATH)/amdkfd \ -I$(FULL_AMD_PATH)/ras/ras_mgr
[Severity: High]
Does removing -I$(FULL_AMD_DISPLAY_PATH)/dc without replacing it with -I$(FULL_AMD_DISPLAY_PATH)/dc/inc break the build when CONFIG_DRM_AMD_DC is disabled?
-I$(FULL_AMD_DISPLAY_PATH)/dc/inc/ is only added in drivers/gpu/drm/amd/display/Makefile, which is included conditionally on CONFIG_DRM_AMD_DC. However, drivers/gpu/drm/amd/amdgpu/amdgpu.h unconditionally includes dm_pp_interface.h and amdgpu_dm.h, which pull in dm_services_types.h, os_types.h, dc_types.h, irq_types.h, and dm_services.h that this patch moves into dc/inc/.
[ ... ]
Quoted 8 lines
drivers/gpu/drm/amd/display/dc/Makefile +0
-0@@ -98,3 +98,13 @@ endif AMD_DISPLAY_FILES += $(addprefix $(AMDDALPATH)/dc/, $(FILES))
drivers/gpu/drm/amd/display/dc/Makefile endif · line 110
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/Makefile +10
-0+# The dc directory root holds private headers (dc_priv.h and friends) that +# must not be reachable outside DC, so the global include path deliberately +# stops at dc/inc. DC-internal objects still need the root on their include +# path for the many "subdir/header.h" includes inside DC, so add it per +# object instead of through a global ccflags-y entry. +DC_INTERNAL_OBJS := $(filter $(AMDDALPATH)/dc/%,$(AMD_DISPLAY_FILES)) +$(foreach obj,$(DC_INTERNAL_OBJS),\ + $(eval CFLAGS_$(obj) += -I$(FULL_AMD_DISPLAY_PATH)/dc)) + +
[Severity: Medium]
Does drivers/gpu/drm/amd/display/amdgpu_dm/Makefile still export the dc root include path globally?
The commit message notes that -I$(FULL_AMD_DISPLAY_PATH)/dc is removed from amdgpu_dm/Makefile, but that file is not modified by this patch and still has:
drivers/gpu/drm/amd/display/amdgpu_dm/Makefile:
subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc
Because drivers/gpu/drm/amd/display/Makefile includes amdgpu_dm/Makefile in the top-level amdgpu build, Kbuild adds subdir-ccflags-y to KBUILD_CFLAGS for all objects in amdgpu, amdgpu_dm, DAL modules, and tests, leaving dc_priv.h and other dc root headers reachable outside DC.
[ ... ]
drivers/gpu/drm/amd/display/dc/inc/dc.h
Quoted 4 lines
drivers/gpu/drm/amd/display/dc/inc/dc.h renamed from drivers/gpu/drm/amd/display/dc/dc.h +0
-0
[Severity: Low]
Should Documentation/gpu/amdgpu/display/display-manager.rst also be updated for the new path of dc.h? It has two kernel-doc directives that still reference drivers/gpu/drm/amd/display/dc/dc.h, which will cause htmldocs builds to fail to locate the file.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=14
kernel test robot
build botRe: [PATCH 14/19] drm/amd/display: Restrict the dc directory root to DC-internal builds
In reply to Dave Airliekernel test robot noticed the following build errors:
Hi Dave,
kernel test robot noticed the following build errors:
[auto build test ERROR on a6836fcbb5b22968019256025321d655b78bc49c]
url: https://github.com/intel-lab-lkp/linux/commits/Dave-Airlie-via-B4-Relay/drm-amd-display-Drop-the-dead-vmid-module/20261112-114336 base: a6836fcbb5b22968019256025321d655b78bc49c patch link: https://lore.kernel.org/r/20261112-amdgpu-dc-cleanup-v1-14-0fae41718ad2%40redhat.com patch subject: [PATCH 14/19] drm/amd/display: Restrict the dc directory root to DC-internal builds config: x86_64-randconfig-1001-20261117 (https://download.01.org/0day-ci/archive/20261117/[email protected]/config) compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261117/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_device_queue_manager_v12.c:25:
In file included from drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_device_queue_manager.h:32:
In file included from drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_priv.h:51:
In file included from drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu.h:57:
>> drivers/gpu/drm/amd/amdgpu/../include/dm_pp_interface.h:26:10: fatal error: 'dm_services_types.h' file not found
26 | #include "dm_services_types.h"
| ^~~~~~~~~~~~~~~~~~~~~1 error generated.
vim +26 drivers/gpu/drm/amd/amdgpu/../include/dm_pp_interface.h
a2dd023a7788ba6 Eric Huang 2017-03-06 2520582319bce482e Rex Zhu 2018-06-20 @26 #include "dm_services_types.h"20582319bce482e Rex Zhu 2018-06-20 27
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH 14/19] drm/amd/display: Restrict the dc directory root to DC-internal builds
In reply to Dave Airliekernel test robot noticed the following build errors:
Hi Dave,
kernel test robot noticed the following build errors:
[auto build test ERROR on a6836fcbb5b22968019256025321d655b78bc49c]
url: https://github.com/intel-lab-lkp/linux/commits/Dave-Airlie-via-B4-Relay/drm-amd-display-Drop-the-dead-vmid-module/20261112-114336 base: a6836fcbb5b22968019256025321d655b78bc49c patch link: https://lore.kernel.org/r/20261112-amdgpu-dc-cleanup-v1-14-0fae41718ad2%40redhat.com patch subject: [PATCH 14/19] drm/amd/display: Restrict the dc directory root to DC-internal builds config: i386-randconfig-1006-20260925 (https://download.01.org/0day-ci/archive/20261118/[email protected]/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261118/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from drivers/gpu/drm/amd/amdgpu/amdgpu.h:57,
from drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_1.c:24:
>> drivers/gpu/drm/amd/amdgpu/../include/dm_pp_interface.h:26:10: fatal error: dm_services_types.h: No such file or directory
26 | #include "dm_services_types.h"
| ^~~~~~~~~~~~~~~~~~~~~compilation terminated.
vim +26 drivers/gpu/drm/amd/amdgpu/../include/dm_pp_interface.h
a2dd023a7788ba6 Eric Huang 2017-03-06 2520582319bce482e Rex Zhu 2018-06-20 @26 #include "dm_services_types.h"20582319bce482e Rex Zhu 2018-06-20 27
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH 15/19 drm/amd/display: Add dc_force_max_dramclk for the DP compliance workaround
In reply to Dave AirlieThe DP compliance test pattern workaround in dm_helpers_dp_handle_test_pattern_request() reached into the clock manager (dc_get_clk_mgr) to read the softmax memory clock limits and to invoke the clock update. Move the whole sequence into DC as dc_force_max_dramclk() and drop the dc_get_clk_mgr accessor; no code outside DC references struct clk_mgr anymore.
Part of making the struct dc sub-structures opaque outside DC.
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 10 +--------- .../display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c | 1 - drivers/gpu/drm/amd/display/dc/core/dc.c | 23 ++++++++++++++++++++++ drivers/gpu/drm/amd/display/dc/core/dc_accessors.c | 5 ----- drivers/gpu/drm/amd/display/dc/inc/dc.h | 8 ++++++-- 5 files changed, 30 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +1 -9
@@ -1559,7 +1559,6 @@ bool dm_helpers_dp_handle_test_pattern_request(struct amdgpu_dm_connector *aconnector = link->priv;struct drm_device *dev = aconnector->base.dev;struct dc_state *dc_state =dc_get_current_state (ctx->dc); -struct clk_mgr *clk_mgr =dc_get_clk_mgr (ctx->dc);int i;for (i =0 ; i <MAX_PIPES ; i++) {
@@ -1661,14 +1660,7 @@ bool dm_helpers_dp_handle_test_pattern_request( pipe_ctx->stream->test_pattern.color_space = test_pattern_color_space;/* Temp W/A for compliance test failure */ - dc_state->bw_ctx.bw.dcn.clk.p_state_change_support = false; - dc_state->bw_ctx.bw.dcn.clk.dramclk_khz = clk_mgr->dc_mode_softmax_enabled ? - clk_mgr->bw_params->dc_mode_softmax_memclk : clk_mgr->bw_params->max_memclk_mhz; - dc_state->bw_ctx.bw.dcn.clk.idle_dramclk_khz = dc_state->bw_ctx.bw.dcn.clk.dramclk_khz; -dc_get_clk_mgr (ctx->dc)->funcs->update_clocks ( -dc_get_clk_mgr (ctx->dc), - dc_state, - false); +dc_force_max_dramclk (ctx->dc, dc_state); dc_link_dp_set_test_pattern( (struct dc_link *) link,
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c +0 -1
@@ -732,7 +732,6 @@ static void dm_test_idle_worker_enabled_runs_body(struct kunit *test)dc_get_ctx (adev->dm.dc)->logger = logger;/* dc_allow() only flips the flag when clk_mgr and apply() are present. */ dc_test_set_clk_mgr (adev->dm.dc,dm_kunit_alloc_clk_mgr (test)); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test,dc_get_clk_mgr (adev->dm.dc));dc_test_hwss (adev->dm.dc)->apply_idle_power_optimizations = dm_test_idle_apply_flip; idle_work =kunit_kzalloc (test,sizeof (*idle_work),GFP_KERNEL );
drivers/gpu/drm/amd/display/dc/core/dc.c +23 -0
@@ -7357,6 +7357,29 @@ void dc_set_edp_power(const struct dc *dc, struct dc_link *edp_link, edp_link->dc->link_srv->edp_set_panel_power (edp_link, powerOn); } +/** +* dc_force_max_dramclk() - raise the memory clock for DP compliance tests +* @dc: Current DC state +* @context: The state whose clocks are programmed +* +* Temporary workaround for DP compliance test failures: disallow p-state +* switching for the given state, raise the memory clock to the maximum +* supported level and apply the resulting clocks immediately. +*/ +void dc_force_max_dramclk (struct dc *dc,struct dc_state *context) +{ + context->bw_ctx.bw.dcn.clk.p_state_change_support = false; + context->bw_ctx.bw.dcn.clk.dramclk_khz = + dc->clk_mgr->dc_mode_softmax_enabled ? + dc->clk_mgr->bw_params->dc_mode_softmax_memclk : + dc->clk_mgr->bw_params->max_memclk_mhz; + context->bw_ctx.bw.dcn.clk.idle_dramclk_khz = + context->bw_ctx.bw.dcn.clk.dramclk_khz; + +if (dc->clk_mgr && dc->clk_mgr->funcs->update_clocks) + dc->clk_mgr->funcs->update_clocks (dc->clk_mgr, context, false); +} +/** * dc_get_power_profile_for_dc_state() - extracts power profile from dc state *
drivers/gpu/drm/amd/display/dc/core/dc_accessors.c +0 -5
@@ -94,11 +94,6 @@ struct resource_pool *dc_get_res_pool(const struct dc *dc) }EXPORT_IF_KUNIT (dc_get_res_pool); -struct clk_mgr *dc_get_clk_mgr (struct dc *dc) -{ -return dc->clk_mgr; -} -EXPORT_IF_KUNIT (dc_get_clk_mgr); bool dc_get_dcc_compression_cap(const struct dc *dc, const struct dc_dcc_surface_param *input,
drivers/gpu/drm/amd/display/dc/inc/dc.h +6 -2
@@ -2382,8 +2382,12 @@ bool dc_is_idle_optimizations_allowed(const struct dc *dc);*/ struct resource_pool *dc_get_res_pool (const struct dc *dc); -/* The clock manager. Interim accessor. */ -struct clk_mgr *dc_get_clk_mgr (struct dc *dc); +/* +* Temporary workaround for DP compliance test failures: disallow p-state +* switching for the given state, raise the memory clock to the maximum +* supported level and apply the resulting clocks immediately. +*/ +void dc_force_max_dramclk (struct dc *dc,struct dc_state *context);/* * Query DCC compression support for a surface.
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH 15/19] drm/amd/display: Add dc_force_max_dramclk for the DP compliance workaround
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] drm/amd/display: NULL pointer dereference in dc_force_max_dramclk() --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [High] drm/amd/display: NULL pointer dereference in dc_force_max_dramclk()
--
commit b8f4fd55c6e73f430098a070c075751210c4007a
Author: Dave Airlie <[email protected]>
drm/amd/display: Add dc_force_max_dramclk for the DP compliance workaround
This commit moves the DP compliance test pattern memory clock workaround from dm_helpers_dp_handle_test_pattern_request() into a new dc_force_max_dramclk() helper in DC and removes the dc_get_clk_mgr() accessor.
Quoted 20 lines
drivers/gpu/drm/amd/display/dc/core/dc.c +12
-0@@ -7357,6 +7357,29 @@ void dc_set_edp_power(const struct dc *dc, struct dc_link *edp_link, edp_link->dc->link_srv->edp_set_panel_power (edp_link, powerOn); } +/** +* dc_force_max_dramclk() - raise the memory clock for DP compliance tests +* @dc: Current DC state +* @context: The state whose clocks are programmed +* +* Temporary workaround for DP compliance test failures: disallow p-state +* switching for the given state, raise the memory clock to the maximum +* supported level and apply the resulting clocks immediately. +*/ +void dc_force_max_dramclk (struct dc *dc,struct dc_state *context) +{ + context->bw_ctx.bw.dcn.clk.p_state_change_support = false;
drivers/gpu/drm/amd/display/dc/core/dc.c void dc_set_edp_power(const struct dc *dc, struct dc_link *edp_link, · line 7381
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/core/dc.c +10
-0+ context->bw_ctx.bw.dcn.clk.dramclk_khz = + dc->clk_mgr->dc_mode_softmax_enabled ? + dc->clk_mgr->bw_params->dc_mode_softmax_memclk : + dc->clk_mgr->bw_params->max_memclk_mhz; + context->bw_ctx.bw.dcn.clk.idle_dramclk_khz = + context->bw_ctx.bw.dcn.clk.dramclk_khz; + +if (dc->clk_mgr && dc->clk_mgr->funcs->update_clocks) + dc->clk_mgr->funcs->update_clocks (dc->clk_mgr, context, false); +}
[Severity: High]
Can this dereference a NULL dc->clk_mgr or dc->clk_mgr->bw_params?
dc->clk_mgr is dereferenced before the NULL check on dc->clk_mgr below, and dc->clk_mgr->bw_params is not checked at all. In dc_clk_mgr_create(), bw_params is only populated on DCN 2.1 and DCN 3.0+ and remains NULL on DCE, DCN 1.0, and DCN 2.0/2.01 (which is why dc_refresh_memclk_states() in this file checks both !dc->clk_mgr and !dc->clk_mgr->bw_params). A DP link test pattern request via dm_helpers_dp_handle_test_pattern_request() on those ASICs will crash with a NULL pointer dereference.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=15
PATCH 16/19 drm/amd/display: Add DC primitives for ABM hardware programming
In reply to Dave AirlieThe ABM code in modules/power programmed the DMCU iRAM and the DMCUB ABM configuration through struct resource_pool, forcing the power module and DM to reach into DC internals.
Keep the ABM curve and iRAM table baking in modules/power where it belongs, and add thin DC-side hardware primitives that the module drives with baked blobs:
- dc_has_dmcu(), dc_get_dmcu_abm_version(), dc_dmcu_is_initialized() for the dispatch decisions
- dc_dmcu_load_iram() to load a baked iRAM blob at a given offset
- dc_abm_program_config() to program a baked ABM configuration table
- dc_abm_is_supported(), dc_abm_set_event() and dc_abm_set_strength() for the ABM event/strength dispatch
dmcu_load_iram() and dmub_init_abm_config() stay in modules/power and now take struct dc; struct dmcu_iram_parameters and enum abm_defines stay in power_helpers.h with them. The module no longer references struct resource_pool.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +- drivers/gpu/drm/amd/display/dc/Makefile | 1 + drivers/gpu/drm/amd/display/dc/core/dc_abm.c | 121 ++++++++++++++++ drivers/gpu/drm/amd/display/dc/inc/dc.h | 42 ++++++ drivers/gpu/drm/amd/display/modules/power/power.c | 3 +- .../gpu/drm/amd/display/modules/power/power_abm.c | 153 +++++++-------------- .../drm/amd/display/modules/power/power_helpers.h | 17 +-- 7 files changed, 218 insertions(+), 128 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -6
@@ -1207,9 +1207,6 @@ STATIC_IFN_KUNIT int dm_late_init(struct amdgpu_ip_block *ip_block)struct dmcu_iram_parameters params;unsigned int linear_lut[16 ];int i; -struct dmcu *dmcu =NULL ; - - dmcu =dc_get_res_pool (adev->dm.dc)->dmcu;/* Init the boot time CRC (skip in resume) */ if ((adev->in_suspend == 0) &&
@@ -1234,8 +1231,8 @@ STATIC_IFN_KUNIT int dm_late_init(struct amdgpu_ip_block *ip_block)* dmcu object will be null. * ABM 2.4 and up are implemented on dmcub. */ -if (dmcu) { -if (!dmcu_load_iram (dmcu, params)) +if (dc_has_dmcu (adev->dm.dc)) { +if (!dmcu_load_iram (adev->dm.dc, params))return -EINVAL ; }else if (dc_get_ctx (adev->dm.dc)->dmub_srv) {struct dc_link *edp_links[MAX_NUM_EDP ];
@@ -1243,7 +1240,7 @@ STATIC_IFN_KUNIT int dm_late_init(struct amdgpu_ip_block *ip_block)dc_get_edp_links (adev->dm.dc, edp_links, &edp_num);for (i =0 ; i < edp_num; i++) { -if (!dmub_init_abm_config (dc_get_res_pool (adev->dm.dc), params, i)) +if (!dmub_init_abm_config (adev->dm.dc, params, i))return -EINVAL ; } }
drivers/gpu/drm/amd/display/dc/Makefile +1 -0
@@ -69,6 +69,7 @@ FILES += dc_helper.o FILES += dc_memory_pool.o FILES += core/dc.o FILES += core/dc_accessors.o +FILES += core/dc_abm.o FILES += dc_api_dispatch/api_shim.o FILES += core/dc_debug.o FILES += core/dc_hw_sequencer.o
drivers/gpu/drm/amd/display/dc/core/dc_abm.c new file +121 -0
121 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/inc/dc.h +42 -0
48 lines not on this page · raw message
drivers/gpu/drm/amd/display/modules/power/power.c +1 -2
@@ -192,8 +192,7 @@ struct mod_power *mod_power_create(struct dc *dc, }// ABM used to contain 4 different configs. There is only 3 since ABM 2.3. -if (dc_get_res_pool (dc)->dmcu !=NULL && -dc_get_res_pool (dc)->dmcu->dmcu_version.abm_version <0x23 ) +if (dc_has_dmcu (dc) &&dc_get_dmcu_abm_version (dc) <0x23 ) abm_max_config =4 ;else abm_max_config =3 ;
drivers/gpu/drm/amd/display/modules/power/power_abm.c +46 -107
248 lines not on this page · raw message
drivers/gpu/drm/amd/display/modules/power/power_helpers.h +4 -13
@@ -30,7 +30,7 @@#include "dc/inc/core_types.h" #include "mod_power.h" -struct resource_pool ; +struct dc ;enum abm_defines {
@@ -47,6 +47,7 @@ struct dmcu_iram_parameters {unsigned int min_abm_backlight;unsigned int set; }; +struct backlight_state {/* HW uses u16.16 format for backlight PWM */ unsigned int backlight_pwm;
@@ -147,22 +148,12 @@ union dmcu_abm_set_bl_params { } bits;unsigned int u32All; }; -bool dmcu_load_iram (struct dmcu *dmcu, +bool dmcu_load_iram (struct dc *dc,struct dmcu_iram_parameters params); -bool dmub_init_abm_config (struct resource_pool *res_pool, +bool dmub_init_abm_config (struct dc *dc,struct dmcu_iram_parameters params,unsigned int inst); -bool dmub_is_abm_supported (struct resource_pool *res_pool, -unsigned int inst); -bool dmub_set_abm_event (struct resource_pool *res_pool, -unsigned int full_screen,unsigned int trans_info, -unsigned int hdr_mode,unsigned int scaling_enable, -unsigned int scaling_strength_map,unsigned int inst); -bool dmub_set_abm_strength (struct resource_pool *res_pool, -unsigned int strength, -unsigned int inst); -void init_replay_config (struct dc_link *link,struct replay_config *pr_config); void set_replay_coasting_vtotal(struct dc_link *link, enum replay_coasting_vtotal_type type,
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH 16/19] drm/amd/display: Add DC primitives for ABM hardware programming
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] drm/amd/display: dc_dmcu_is_initialized() duplicates dc_is_dmcu_initialized() --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] drm/amd/display: dc_dmcu_is_initialized() duplicates dc_is_dmcu_initialized()
--
commit 73f1ba49a5d9e363674e88529801b1a9200d901c
Author: Dave Airlie <[email protected]>
drm/amd/display: Add DC primitives for ABM hardware programming
This commit adds DC-side hardware primitives for DMCU iRAM loading and ABM configuration and event programming so that modules/power and amdgpu_dm no longer access struct resource_pool directly.
Quoted 6 lines
drivers/gpu/drm/amd/display/dc/core/dc_abm.c new file +0
-0@@ -0,0 +1,121 @@
[ ... ]
drivers/gpu/drm/amd/display/dc/core/dc_abm.c line 31
Quoted 8 lines
drivers/gpu/drm/amd/display/dc/core/dc_abm.c new file +8
-0+bool dc_dmcu_is_initialized (struct dc *dc) +{ +if (!dc->res_pool || !dc->res_pool->dmcu) +return false; + +return dc->res_pool->dmcu->funcs->is_dmcu_initialized ( + dc->res_pool->dmcu); +}
[Severity: Low]
Does dc_dmcu_is_initialized() duplicate the existing dc_is_dmcu_initialized() helper?
drivers/gpu/drm/amd/display/dc/core/dc.c:dc_is_dmcu_initialized() {
struct dmcu *dmcu = dc->res_pool->dmcu;
if (dmcu)
return dmcu->funcs->is_dmcu_initialized(dmcu);
return false;
}dc_is_dmcu_initialized() is already declared in dc.h and has no other callers in the tree, so these two public helpers could be consolidated.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=16
PATCH 17/19 drm/amd/display: Replace the dc_get_res_pool accessor with purpose APIs
In reply to Dave AirlieAdd the last purpose-built interfaces for the data DM was reading through dc_get_res_pool() and drop the accessor entirely:
- dc_get_audio_instances() fills the audio instance id array for amdgpu_dm_audio_init()
- dc_get_pipe_count() for the debugfs DCC bits dump
- dc_get_usb4_dpia_count() for the DMUB DPIA enablement
- dc_get_dmcu_psp_version() and dc_dmcu_init_abm() for the DMUB hardware init path
- dc_get_mall_en() for the debugfs capabilities dump
- dc_remove_stream_from_ctx() for the MST DSC recomputation
No code outside the dc directory references struct resource_pool in production anymore; only the KUnit tests keep installing fake pools through dc_test_set_res_pool() / dm_kunit_alloc_res_pool().
Part of making the struct dc sub-structures opaque outside DC.
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_audio.c | 8 +--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 7 +--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c | 14 ++----- .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 6 +-- .../display/amdgpu_dm/tests/amdgpu_dm_dmub_test.c | 12 ++++-- .../display/amdgpu_dm/tests/amdgpu_dm_irq_test.c | 2 +- .../amdgpu_dm/tests/amdgpu_dm_kunit_helpers.c | 13 +++++++ .../amdgpu_dm/tests/amdgpu_dm_kunit_test_helpers.h | 2 + .../amdgpu_dm/tests/amdgpu_dm_mst_types_test.c | 5 ++- .../amd/display/amdgpu_dm/tests/amdgpu_dm_test.c | 6 +-- drivers/gpu/drm/amd/display/dc/core/dc_abm.c | 11 ++++++ drivers/gpu/drm/amd/display/dc/core/dc_accessors.c | 44 ++++++++++++++++++++-- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 10 +++++ drivers/gpu/drm/amd/display/dc/inc/dc.h | 38 ++++++++++++++++--- 14 files changed, 135 insertions(+), 43 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_audio.c +2 -6
@@ -140,19 +140,15 @@ EXPORT_IF_KUNIT(amdgpu_dm_audio_init_pins);int amdgpu_dm_audio_init (struct amdgpu_device *adev) {unsigned int inst_array[MAX_AUDIOS ]; -struct resource_pool *res_pool;int audio_count; -int i, ret; +int ret;if (!amdgpu_audio)return 0 ; adev->mode_info.audio.enabled = true; - res_pool =dc_get_res_pool (adev->dm.dc); - audio_count = res_pool->audio_count; -for (i =0 ; i < audio_count; i++) - inst_array[i] = res_pool->audios[i]->inst; + audio_count =dc_get_audio_instances (adev->dm.dc, inst_array);amdgpu_dm_audio_init_pins (adev, audio_count, inst_array); ret =component_add (adev->dev, &amdgpu_dm_audio_component_bind_ops);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +2 -5
@@ -4464,10 +4464,7 @@ static int capabilities_show(struct seq_file *m, void *unused)unsigned int mall_in_use = false;unsigned int subvp_in_use = false; -struct hubbub *hubbub =dc_get_res_pool (dc)->hubbub; - -if (hubbub && hubbub->funcs->get_mall_en) - hubbub->funcs->get_mall_en (hubbub, &mall_in_use); +dc_get_mall_en (dc, &mall_in_use); subvp_in_use =dc_get_subvp_en (dc,dc_get_current_state (dc));
@@ -4609,7 +4606,7 @@ static ssize_t dcc_en_bits_read(const uint32_t rd_buf_size =32 ;uint32_t result =0 ;int offset =0 ; -int num_pipes =dc_get_res_pool (dc)->pipe_count; +int num_pipes =dc_get_pipe_count (dc);int *dcc_en_bits;int i, r;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c +4 -10
@@ -232,9 +232,6 @@ int dm_dmub_hw_init(struct amdgpu_device *adev)struct dmub_srv_fb_info *fb_info = adev->dm.dmub_fb_info;const struct firmware *dmub_fw = adev->dm.dmub_fw;struct dc *dc = adev->dm.dc; -struct resource_pool *res_pool =dc_get_res_pool (dc); -struct dmcu *dmcu = res_pool->dmcu; -struct abm *abm = res_pool->abm;struct dc_context *ctx =dc_get_ctx (adev->dm.dc);struct dmub_srv_hw_params hw_params;enum dmub_status status;
@@ -333,14 +330,14 @@ int dm_dmub_hw_init(struct amdgpu_device *adev)if (adev->firmware.load_type !=AMDGPU_FW_LOAD_PSP ) hw_params.load_inst_const = true; -if (dmcu) - hw_params.psp_version = dmcu->psp_version; +if (dc_has_dmcu (dc)) + hw_params.psp_version =dc_get_dmcu_psp_version (dc); hw_params.fb_info = fb_info;/* Enable usb4 dpia in the FW APU */ if (dc_get_caps (dc)->is_apu && -dc_get_res_pool (dc)->usb4_dpia_count !=0 && +dc_get_usb4_dpia_count (dc) !=0 && !dc_get_debug_options (dc)->dpia_debug.bits.disable_dpia) { hw_params.dpia_supported = true; hw_params.disable_dpia =dc_get_debug_options (dc)->dpia_debug.bits.disable_dpia;
@@ -375,10 +372,7 @@ int dm_dmub_hw_init(struct amdgpu_device *adev)drm_warn (adev_to_drm (adev),"Wait for DMUB auto-load failed: %d\n" , status);/* Init DMCU and ABM if available. */ -if (dmcu && abm) { - dmcu->funcs->dmcu_init (dmcu); - abm->dmcu_is_running = dmcu->funcs->is_dmcu_initialized (dmcu); - } +dc_dmcu_init_abm (dc);if (!dc_get_ctx (adev->dm.dc)->dmub_srv)dc_get_ctx (adev->dm.dc)->dmub_srv =dc_dmub_srv_create (adev->dm.dc, dmub_srv);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +2 -4
@@ -1643,7 +1643,6 @@ int compute_mst_dsc_configs_for_state(struct drm_atomic_commit *state,bool computed_streams[MAX_PIPES ];struct amdgpu_dm_connector *aconnector;struct drm_dp_mst_topology_mgr *mst_mgr; -struct resource_pool *res_pool;int link_vars_start_index =0 ;int ret =0 ;
@@ -1652,7 +1651,7 @@ int compute_mst_dsc_configs_for_state(struct drm_atomic_commit *state,for (i =0 ; i < dc_state->stream_count; i++) { stream = dc_state->streams[i]; - res_pool =dc_get_res_pool (stream->ctx->dc); +if (stream->signal !=SIGNAL_TYPE_DISPLAY_PORT_MST )continue ;
@@ -1671,8 +1670,7 @@ int compute_mst_dsc_configs_for_state(struct drm_atomic_commit *state,if (computed_streams[i])continue ; -if (res_pool->funcs->remove_stream_from_ctx && - res_pool->funcs->remove_stream_from_ctx (stream->ctx->dc, dc_state, stream) !=DC_OK ) +if (dc_remove_stream_from_ctx (stream->ctx->dc, dc_state, stream) !=DC_OK )return -EINVAL ;if (!is_dsc_need_re_compute (state, dc_state, stream->link))
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_dmub_test.c +9 -3
@@ -731,11 +731,14 @@ static void dm_test_dmub_hw_init_auto_load_timeout(struct kunit *test)*/ static void dm_test_dmub_hw_init_apu_dpia_dcn35 (struct kunit *test) { +struct resource_pool *res_pool; +struct amdgpu_device *adev =dm_test_alloc_adev_with_dmub (test); adev->ip_versions[DCE_HWIP ][0 ] =IP_VERSION (3 ,5 ,0 );dc_test_caps (adev->dm.dc)->is_apu = true; -dc_get_res_pool (adev->dm.dc)->usb4_dpia_count =1 ; + res_pool =dm_kunit_alloc_res_pool (test, adev->dm.dc); + res_pool->usb4_dpia_count =1 ;KUNIT_EXPECT_EQ (test,dm_dmub_hw_init (adev),0 );KUNIT_EXPECT_TRUE (test, adev->dm.dmub_srv->hw_init);
@@ -787,6 +790,8 @@ static void dm_test_dmub_hw_init_sanity_checks_dcn314(struct kunit *test)*/ static void dm_test_dmub_hw_init_dmcu_abm (struct kunit *test) { +struct resource_pool *res_pool; +struct amdgpu_device *adev =dm_test_alloc_adev_with_dmub (test);struct dmcu *dmcu;struct abm *abm;
@@ -799,8 +804,9 @@ static void dm_test_dmub_hw_init_dmcu_abm(struct kunit *test) dmcu->funcs = &dm_test_dmcu_funcs; dmcu->psp_version =0x12345678 ; -dc_get_res_pool (adev->dm.dc)->dmcu = dmcu; -dc_get_res_pool (adev->dm.dc)->abm = abm; + res_pool =dm_kunit_alloc_res_pool (test, adev->dm.dc); + res_pool->dmcu = dmcu; + res_pool->abm = abm;KUNIT_EXPECT_EQ (test,dm_dmub_hw_init (adev),0 );KUNIT_EXPECT_TRUE (test, abm->dmcu_is_running);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c +1 -1
@@ -4188,7 +4188,7 @@ static void dm_test_crtc_high_irq_writeback_disables(struct kunit *test) adev =dm_kunit_alloc_adev (test);KUNIT_ASSERT_EQ (test,drm_vblank_init (&adev->ddev,1 ),0 ); -/* dc_stream_fc_disable_writeback() dereferences dc_get_res_pool(dc). */ +/* dc_stream_fc_disable_writeback() dereferences the DC resource pool. */ dc =dm_test_alloc_dc_with_irq_service (test, &dm_test_irq_service_funcs_dcn10); adev->dm.dc = dc;
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_kunit_helpers.c +13 -0
@@ -136,6 +136,19 @@ struct dc_state *dm_kunit_alloc_dc_state(struct kunit *test) }EXPORT_SYMBOL (dm_kunit_alloc_dc_state); +struct resource_pool *dm_kunit_alloc_res_pool (struct kunit *test,struct dc *dc) +{ +struct resource_pool *res_pool; + + res_pool =kunit_kzalloc (test,sizeof (*res_pool),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, res_pool); + +dc_test_set_res_pool (dc, res_pool); + +return res_pool; +} +EXPORT_SYMBOL (dm_kunit_alloc_res_pool); +struct clk_mgr *dm_kunit_alloc_clk_mgr (struct kunit *test) {struct clk_mgr *clk_mgr;
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_kunit_test_helpers.h +2 -0
@@ -28,6 +28,8 @@ struct dc_link *dm_kunit_alloc_link_with_ctx(struct kunit *test);struct amdgpu_display_manager *dm_kunit_alloc_dm (struct kunit *test);struct drm_device *dm_kunit_alloc_drm_with_connector_list (struct kunit *test);struct dc_state *dm_kunit_alloc_dc_state (struct kunit *test); +struct resource_pool ; +struct resource_pool *dm_kunit_alloc_res_pool (struct kunit *test,struct dc *dc);struct clk_mgr *dm_kunit_alloc_clk_mgr (struct kunit *test);struct dc_stream_state *dm_kunit_alloc_stream (struct kunit *test,struct dc_link *link);
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c +4 -1
@@ -2783,6 +2783,8 @@ static const struct dsc_funcs dm_mst_test_dsc_funcs = {/* 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 resource_pool *res_pool; +struct dsc_dec_dpcd_caps *dec = &sink->dsc_caps.dsc_dec_caps;struct display_stream_compressor *dsc;
@@ -2791,7 +2793,8 @@ static void dm_mst_test_setup_dsc_caps(struct kunit *test, struct dc *dc, struct dsc->funcs = &dm_mst_test_dsc_funcs; dsc->ctx =dc_get_ctx (dc); -dc_get_res_pool (dc)->dscs[0 ] = dsc; + res_pool =dm_kunit_alloc_res_pool (test, dc); + res_pool->dscs[0 ] = dsc; dec->is_dsc_supported = true; dec->dsc_version =0x21 ;
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c +2 -4
@@ -3388,8 +3388,7 @@ static void dm_test_oem_i2c_hw_init_no_device(struct kunit *test)struct amdgpu_device *adev =dm_kunit_alloc_adev (test);struct dc *dc =dm_kunit_alloc_dc_with_ctx (test); -dc_test_set_res_pool (dc,kunit_kzalloc (test,sizeof (*dc_get_res_pool (dc)),GFP_KERNEL )); -KUNIT_ASSERT_NOT_NULL (test,dc_get_res_pool (dc)); +dm_kunit_alloc_res_pool (test, dc); adev->dm.dc = dc;KUNIT_EXPECT_EQ (test,dm_oem_i2c_hw_init (adev),0 );
@@ -4981,8 +4980,7 @@ static struct amdgpu_device *dm_test_late_init_adev(struct kunit *test)struct amdgpu_device *adev =dm_kunit_alloc_adev (test);struct dc *dc =dm_kunit_alloc_dc_with_ctx (test); -dc_test_set_res_pool (dc,kunit_kzalloc (test,sizeof (*dc_get_res_pool (dc)),GFP_KERNEL )); -KUNIT_ASSERT_NOT_NULL (test,dc_get_res_pool (dc)); +dm_kunit_alloc_res_pool (test, dc); adev->dm.dc = dc;return adev;
drivers/gpu/drm/amd/display/dc/core/dc_abm.c +11 -0
@@ -119,3 +119,14 @@ unsigned int dc_get_dmcu_abm_version(const struct dc *dc)return dc->res_pool->dmcu->dmcu_version.abm_version; } + +void dc_dmcu_init_abm (struct dc *dc) +{ +struct dmcu *dmcu = dc->res_pool ? dc->res_pool->dmcu :NULL ; +struct abm *abm = dc->res_pool ? dc->res_pool->abm :NULL ; + +if (dmcu && abm) { + dmcu->funcs->dmcu_init (dmcu); + abm->dmcu_is_running = dmcu->funcs->is_dmcu_initialized (dmcu); + } +}
drivers/gpu/drm/amd/display/dc/core/dc_accessors.c +41 -3
58 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +10 -0
@@ -6349,3 +6349,13 @@ bool resource_is_hpo_acquired(struct dc_state *context)return false; } + +enum dc_status dc_remove_stream_from_ctx (struct dc *dc, +struct dc_state *context,struct dc_stream_state *stream) +{ +if (dc->res_pool->funcs->remove_stream_from_ctx) +return dc->res_pool->funcs->remove_stream_from_ctx ( + dc, context, stream); + +return DC_OK ; +}
drivers/gpu/drm/amd/display/dc/inc/dc.h +32 -6
@@ -2376,12 +2376,6 @@ struct dc_state *dc_get_current_state(const struct dc *dc);/* Whether DC may enter idle power optimizations right now. */ bool dc_is_idle_optimizations_allowed (const struct dc *dc); -/* -* The hardware resource pool (DSC engines, audio instances, DMCU/ABM...). -* Interim accessor; prefer purpose-built DC interfaces where available. -*/ -struct resource_pool *dc_get_res_pool (const struct dc *dc); -/* * Temporary workaround for DP compliance test failures: disallow p-state * switching for the given state, raise the memory clock to the maximum
@@ -2431,6 +2425,38 @@ bool dc_abm_set_event(struct dc *dc, unsigned int full_screen,bool dc_abm_set_strength (struct dc *dc,unsigned int strength,unsigned int panel_inst); +/* +* Fill inst_array with the instance ids of the DIO audio blocks and +* return their count. inst_array must have room for MAX_AUDIOS entries. +*/ +unsigned int dc_get_audio_instances (const struct dc *dc, +unsigned int *inst_array); + +/* Number of pipes available for rendering. */ +unsigned int dc_get_pipe_count (const struct dc *dc); + +/* Number of USB4 DPIA endpoints. */ +unsigned int dc_get_usb4_dpia_count (const struct dc *dc); + +/* Read the DMCU PSP version; 0 when there is no DMCU. */ +unsigned int dc_get_dmcu_psp_version (const struct dc *dc); + +/* +* Initialize the DMCU and update the ABM "DMCU running" state. +* No-op when the ASIC has no DMCU or ABM. +*/ +void dc_dmcu_init_abm (struct dc *dc); + +/* Whether MALL is currently enabled. */ +void dc_get_mall_en (struct dc *dc,unsigned int *mall_in_use); + +/* +* Remove the resources assigned to a stream in the given state. +* Returns DC_OK when the ASIC does not implement the removal. +*/ +enum dc_status dc_remove_stream_from_ctx (struct dc *dc, +struct dc_state *context,struct dc_stream_state *stream); +/* * Query DCC compression support for a surface. * return false - when the asic does not implement the query.
Signature · 1 line
2.56.0
PATCH 18/19 drm/amd/display: Replace dc_get_config with per-option config reads
In reply to Dave AirlieThe only external reads of struct dc_config were five runtime-mutable options. Give each a purpose-built getter (dc_get_disable_ips, dc_get_enable_frl, dc_get_consolidated_dpia_dp_lt, dc_get_usb4_bw_alloc_support, dc_get_allow_edp_hotplug_detection, complementing the existing setter) and drop the dc_get_config view. KUnit tests install the options through dc_test_set_* setters.
No code outside the dc directory references struct dc_config in production anymore.
Part of making the struct dc sub-structures opaque outside DC.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 2 +- .../drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 4 +-- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c | 14 ++++++----- .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 4 +-- .../display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c | 4 +-- .../amdgpu_dm/tests/amdgpu_dm_helpers_test.c | 4 +-- drivers/gpu/drm/amd/display/dc/core/dc_accessors.c | 25 +++++++++++++++++-- drivers/gpu/drm/amd/display/dc/core/dc_test.c | 29 ++++++++++++++++++---- drivers/gpu/drm/amd/display/dc/inc/dc.h | 10 +++++--- drivers/gpu/drm/amd/display/dc/inc/dc_test.h | 6 ++++- 11 files changed, 77 insertions(+), 27 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
@@ -761,7 +761,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) }if (dc_get_caps (adev->dm.dc)->ips_support && -dc_get_config (adev->dm.dc)->disable_ips !=DMUB_IPS_DISABLE_ALL ) +dc_get_disable_ips (adev->dm.dc) !=DMUB_IPS_DISABLE_ALL ) adev->dm.idle_workqueue =idle_create_workqueue (adev);if (dc_get_caps (adev->dm.dc)->max_links >0 && adev->family >=AMDGPU_FAMILY_RV ) {
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +1 -1
@@ -309,7 +309,7 @@ static inline int amdgpu_dm_crtc_set_vblank(struct drm_crtc *crtc, bool enable)* update the vblank counter in DRM. */ if (dc_get_caps (dc)->ips_support && -dc_get_config (dc)->disable_ips !=DMUB_IPS_DISABLE_ALL && +dc_get_disable_ips (dc) !=DMUB_IPS_DISABLE_ALL && sr_supported && vblank->config.disable_immediate)drm_crtc_vblank_restore (crtc); }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +2 -2
@@ -2701,7 +2701,7 @@ static int ips_status_show(struct seq_file *m, void *unused)struct dc *dc = adev->dm.dc;struct dc_dmub_srv *dc_dmub_srv; -seq_printf (m,"IPS config: %d\n" ,dc_get_config (dc)->disable_ips); +seq_printf (m,"IPS config: %d\n" ,dc_get_disable_ips (dc));seq_printf (m,"Idle optimization: %d\n" ,dc_is_idle_optimizations_allowed (dc));if (adev->dm.idle_workqueue) {
@@ -3379,7 +3379,7 @@ static int allow_edp_hotplug_detection_get(void *data, u64 *val)struct drm_device *dev = connector->dev;struct amdgpu_device *adev =drm_to_adev (dev); - *val =dc_get_config (adev->dm.dc)->allow_edp_hotplug_detection; + *val =dc_get_allow_edp_hotplug_detection (adev->dm.dc);return 0 ; }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c +8 -6
@@ -340,11 +340,11 @@ int dm_dmub_hw_init(struct amdgpu_device *adev) dc_get_usb4_dpia_count(dc) != 0 && !dc_get_debug_options(dc)->dpia_debug.bits.disable_dpia) { hw_params.dpia_supported = true; - hw_params.disable_dpia =dc_get_debug_options (dc)->dpia_debug.bits.disable_dpia; + hw_params.disable_dpia = +dc_get_debug_options (dc)->dpia_debug.bits.disable_dpia; hw_params.dpia_hpd_int_enable_supported = false; - hw_params.enable_non_transparent_setconfig = -dc_get_config (dc)->consolidated_dpia_dp_lt; - hw_params.disable_dpia_bw_allocation = !dc_get_config (dc)->usb4_bw_alloc_support; + hw_params.enable_non_transparent_setconfig =dc_get_consolidated_dpia_dp_lt (dc); + hw_params.disable_dpia_bw_allocation = !dc_get_usb4_bw_alloc_support (dc); }switch (amdgpu_ip_version (adev,DCE_HWIP ,0 )) {
@@ -399,14 +399,16 @@ int dm_dmub_hw_init(struct amdgpu_device *adev)case IP_VERSION (3 ,1 ,3 ):if (adev->dm.dmcub_fw_version && adev->dm.dmcub_fw_version >=DMUB_FW_VERSION (4 ,0 ,0 ) && - adev->dm.dmcub_fw_version <DMUB_FW_VERSION (4 ,0 ,59 )) + adev->dm.dmcub_fw_version <DMUB_FW_VERSION (4 ,0 ,59 )) {dc_get_debug_options_mutable (adev->dm.dc)->sanity_checks = true; + }break ;case IP_VERSION (3 ,1 ,4 ):if (adev->dm.dmcub_fw_version && adev->dm.dmcub_fw_version >=DMUB_FW_VERSION (4 ,0 ,0 ) && - adev->dm.dmcub_fw_version <DMUB_FW_VERSION (8 ,0 ,16 )) + adev->dm.dmcub_fw_version <DMUB_FW_VERSION (8 ,0 ,16 )) {dc_get_debug_options_mutable (adev->dm.dc)->sanity_checks = true; + }break ;default :break ;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +2 -2
@@ -229,8 +229,8 @@ enum dc_edid_status dm_helpers_parse_edid_caps(if (edid_caps->edid_hdmi) { edid_caps->qs_bit = connector->display_info.rgb_quant_range_selectable;populate_hdmi_info_from_connector ( -dc_get_config (link->dc)->enable_frl, - &connector->display_info.hdmi, edid_caps); +dc_get_enable_frl (link->dc), + &connector->display_info.hdmi, edid_caps);drm_dbg_driver (connector->dev,"%s: HDMI_FRL [%s] max_frl_rate %d\n" , __func__, connector->name, edid_caps->max_frl_rate);if (edid_caps->frl_dsc_support) drm_dbg_driver(connector->dev, "%s: HDMI_FRL_DSC [%s] frl_dsc_10bpc %d, frl_dsc_12bpc %d, frl_dsc_all_bpp %d, frl_dsc_native_420 %d, frl_dsc_max_slices %d, frl_dsc_max_frl_rate %d, frl_dsc_total_chunk_kbytes %d\n",
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c +2 -2
@@ -1194,7 +1194,7 @@ static void dm_test_crtc_enable_vblank_ips_restore(struct kunit *test)/* IPS enabled and not fully disabled -> first restore condition holds. */ dc_test_caps (adev->dm.dc)->ips_support = true; -dc_test_config (adev->dm.dc)->disable_ips =DMUB_IPS_ENABLE ; +dc_test_set_disable_ips (adev->dm.dc,DMUB_IPS_ENABLE );/* Supported PSR version makes self-refresh supported. */ link = acrtc_state->stream->link;
@@ -1241,7 +1241,7 @@ static void dm_test_crtc_enable_vblank_ips_restore_replay(struct kunit *test)/* IPS enabled and not fully disabled -> first restore condition holds. */ dc_test_caps (adev->dm.dc)->ips_support = true; -dc_test_config (adev->dm.dc)->disable_ips =DMUB_IPS_ENABLE ; +dc_test_set_disable_ips (adev->dm.dc,DMUB_IPS_ENABLE );/* * PSR unsupported but replay supported -> sr_supported is driven by the
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_helpers_test.c +2 -2
@@ -435,7 +435,7 @@ static void dm_test_parse_edid_caps_hdmi_frl(struct kunit *test) dc =dm_kunit_alloc_dc (test); link->dc = dc; -dc_test_config (dc)->enable_frl = true; +dc_test_set_enable_frl (dc, true);dm_test_fill_base_edid (dc_edid, true);
@@ -477,7 +477,7 @@ static void dm_test_parse_edid_caps_hdmi_frl_dsc(struct kunit *test) dc =dm_kunit_alloc_dc (test); link->dc = dc; -dc_test_config (dc)->enable_frl = true; +dc_test_set_enable_frl (dc, true);dm_test_fill_base_edid (dc_edid, true);
drivers/gpu/drm/amd/display/dc/core/dc_accessors.c +23 -2
@@ -57,9 +57,25 @@ const struct dc_caps *dc_get_caps(const struct dc *dc)return &dc->caps; } -const struct dc_config *dc_get_config (const struct dc *dc) +unsigned int dc_get_disable_ips (const struct dc *dc) { -return &dc->config; +return dc->config.disable_ips; +} +EXPORT_IF_KUNIT (dc_get_disable_ips); + +bool dc_get_enable_frl (const struct dc *dc) +{ +return dc->config.enable_frl; +} + +bool dc_get_consolidated_dpia_dp_lt (const struct dc *dc) +{ +return dc->config.consolidated_dpia_dp_lt; +} + +bool dc_get_usb4_bw_alloc_support (const struct dc *dc) +{ +return dc->config.usb4_bw_alloc_support; } void dc_set_allow_edp_hotplug_detection(struct dc *dc,
@@ -68,6 +84,11 @@ void dc_set_allow_edp_hotplug_detection(struct dc *dc, dc->config.allow_edp_hotplug_detection = hpd_select; } +unsigned int dc_get_allow_edp_hotplug_detection (const struct dc *dc) +{ +return dc->config.allow_edp_hotplug_detection; +} +const struct dc_debug_options *dc_get_debug_options (const struct dc *dc) {return &dc->debug;
drivers/gpu/drm/amd/display/dc/core/dc_test.c +24 -5
@@ -105,17 +105,36 @@ void dc_test_set_idle_optimizations_allowed(struct dc *dc, bool allowed) }EXPORT_SYMBOL (dc_test_set_idle_optimizations_allowed); +void dc_test_set_disable_ips (struct dc *dc,unsigned int disable_ips) +{ + dc->config.disable_ips = disable_ips; +} +EXPORT_SYMBOL (dc_test_set_disable_ips); + +void dc_test_set_enable_frl (struct dc *dc,bool enable) +{ + dc->config.enable_frl = enable; +} +EXPORT_SYMBOL (dc_test_set_enable_frl); + +void dc_test_set_consolidated_dpia_dp_lt (struct dc *dc,bool enable) +{ + dc->config.consolidated_dpia_dp_lt = enable; +} +EXPORT_SYMBOL (dc_test_set_consolidated_dpia_dp_lt); + +void dc_test_set_usb4_bw_alloc_support (struct dc *dc,bool enable) +{ + dc->config.usb4_bw_alloc_support = enable; +} +EXPORT_SYMBOL (dc_test_set_usb4_bw_alloc_support); +struct dc_caps *dc_test_caps (struct dc *dc) {return &dc->caps; }EXPORT_SYMBOL (dc_test_caps); -struct dc_config *dc_test_config (struct dc *dc) -{ -return &dc->config; -} -EXPORT_SYMBOL (dc_test_config);struct dc_debug_options *dc_test_debug_options (struct dc *dc) {
drivers/gpu/drm/amd/display/dc/inc/dc.h +7 -3
@@ -2354,9 +2354,6 @@ enum dce_version dc_get_dce_version(const struct dc *dc);/* Capabilities detected at dc_create() time. Read-only. */ const struct dc_caps *dc_get_caps (const struct dc *dc); -/* Configuration captured at dc_create() time. Read-only. */ -const struct dc_config *dc_get_config (const struct dc *dc); -/* * Select which eDP connectors get hotplug detection enabled; see * enum dc_hpd_enable_select. Runtime configurable (debugfs).
@@ -2364,6 +2361,13 @@ const struct dc_config *dc_get_config(const struct dc *dc);void dc_set_allow_edp_hotplug_detection (struct dc *dc,enum dc_hpd_enable_select hpd_select); +/* Configuration reads for the runtime-mutable options. */ +unsigned int dc_get_disable_ips (const struct dc *dc); +bool dc_get_enable_frl (const struct dc *dc); +bool dc_get_consolidated_dpia_dp_lt (const struct dc *dc); +bool dc_get_usb4_bw_alloc_support (const struct dc *dc); +unsigned int dc_get_allow_edp_hotplug_detection (const struct dc *dc); +/* Debug overrides (module parameters, debugfs). Read-only view. */ const struct dc_debug_options *dc_get_debug_options (const struct dc *dc);
drivers/gpu/drm/amd/display/dc/inc/dc_test.h +5 -1
@@ -69,9 +69,13 @@ void dc_test_set_link(struct dc *dc, unsigned int index, struct dc_link *link);void dc_test_set_link_count (struct dc *dc,unsigned int count);void dc_test_set_idle_optimizations_allowed (struct dc *dc,bool allowed); +void dc_test_set_disable_ips (struct dc *dc,unsigned int disable_ips); +void dc_test_set_enable_frl (struct dc *dc,bool enable); +void dc_test_set_consolidated_dpia_dp_lt (struct dc *dc,bool enable); +void dc_test_set_usb4_bw_alloc_support (struct dc *dc,bool enable); +/* Mutable views of embedded sub-structures, for test faking only. */ struct dc_caps *dc_test_caps (struct dc *dc); -struct dc_config *dc_test_config (struct dc *dc);struct dc_debug_options *dc_test_debug_options (struct dc *dc);struct dc_cap_funcs *dc_test_cap_funcs (struct dc *dc);struct hw_sequencer_funcs *dc_test_hwss (struct dc *dc);
Signature · 1 line
2.56.0
Harry Wentland
maintainerRe: [PATCH 18/19] drm/amd/display: Replace dc_get_config with per-option config reads
Quoted 16 lines · On 11/11/26 20:43, Dave Airlie via B4 Relay wrote:
From: Dave Airlie <[email protected]>
The only external reads of struct
dc_configwere five runtime-mutable options. Give each a purpose-built getter (dc_get_disable_ips,dc_get_enable_frl,dc_get_consolidated_dpia_dp_lt,dc_get_usb4_bw_alloc_support,dc_get_allow_edp_hotplug_detection, complementing the existing setter) and drop thedc_get_configview. KUnit tests install the options through dc_test_set_* setters.No code outside the dc directory references struct
dc_configin production anymore.Part of making the struct dc sub-structures opaque outside DC.
Signed-off-by Dave Airlie <[email protected]>---
<snip>
Quoted 22 lines
drivers/gpu/drm/amd/display/dc/core/dc_test.c +14
-0@@ -105,17 +105,36 @@ void dc_test_set_idle_optimizations_allowed(struct dc *dc, bool allowed) }EXPORT_SYMBOL (dc_test_set_idle_optimizations_allowed); +void dc_test_set_disable_ips (struct dc *dc,unsigned int disable_ips) +{ + dc->config.disable_ips = disable_ips; +} +EXPORT_SYMBOL (dc_test_set_disable_ips); + +void dc_test_set_enable_frl (struct dc *dc,bool enable) +{ + dc->config.enable_frl = enable; +} +EXPORT_SYMBOL (dc_test_set_enable_frl); + +void dc_test_set_consolidated_dpia_dp_lt (struct dc *dc,bool enable) +{
drivers/gpu/drm/amd/display/dc/core/dc_test.c void dc_test_set_idle_optimizations_allowed(struct dc *dc, bool allowed) · line 131
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/core/dc_test.c +10
-0+ dc->config.consolidated_dpia_dp_lt = enable; +} +EXPORT_SYMBOL (dc_test_set_consolidated_dpia_dp_lt); + +void dc_test_set_usb4_bw_alloc_support (struct dc *dc,bool enable) +{ + dc->config.usb4_bw_alloc_support = enable; +} +EXPORT_SYMBOL (dc_test_set_usb4_bw_alloc_support); +
Similar to the comment on Patch 19/19, this creates a bit of API bloat. Something like dc_test_set_config(dc, config) might be better.
Harry
PATCH 19/19 drm/amd/display: Replace dc_get_caps with purpose-built capability queries
In reply to Dave AirlieSplit the caps view accessor into per-capability queries so DM and the DAL modules no longer read through struct dc_caps:
- scalar getters for is_apu, ips/dmcub support, max links/streams/ planes/slave planes/cursor size/v_total, vtotal_limited_by_fp2, i2c speed, PCON/DSC/fused-io support, SubVP processing delay and MALL size
- dc_dmub_supports_psr()/dc_dmub_supports_aux_backlight() for the DMUB capability bits
- dc_get_color_caps() copies out the color pipeline capabilities
- dc_get_plane_caps() returns the static plane capability array
The KUnit tests keep installing fake capabilities through the dc_test_caps() view of their own fake DC.
No production code outside the dc directory reads struct dc members through a caps view anymore.
Part of making the struct dc sub-structures opaque outside DC.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 48 +++++----- .../amd/display/amdgpu_dm/amdgpu_dm_backlight.c | 4 +- .../drm/amd/display/amdgpu_dm/amdgpu_dm_color.c | 38 ++++---- .../drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c | 7 +- .../amd/display/amdgpu_dm/amdgpu_dm_connector.c | 2 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 17 ++-- .../drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 6 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c | 2 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c | 10 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c | 10 +- .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 2 +- .../drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 26 ++++-- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c | 4 +- drivers/gpu/drm/amd/display/dc/core/dc_accessors.c | 103 ++++++++++++++++++++- drivers/gpu/drm/amd/display/dc/inc/dc.h | 36 ++++++- .../drm/amd/display/modules/freesync/freesync.c | 6 +- .../gpu/drm/amd/display/modules/power/power_abm.c | 2 +- .../gpu/drm/amd/display/modules/power/power_psr.c | 2 +- 18 files changed, 241 insertions(+), 84 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +26 -22
@@ -204,7 +204,7 @@ STATIC_IFN_KUNIT int dm_crtc_get_scanoutpos(struct amdgpu_device *adev, int crtcreturn 0 ; } -if (dc &&dc_get_caps (dc)->ips_support &&dc_is_idle_optimizations_allowed (dc)) +if (dc &&dc_get_ips_support (dc) &&dc_is_idle_optimizations_allowed (dc))dc_allow_idle_optimizations (dc, false);/*
@@ -709,7 +709,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)/* temporary enable immediate restore for FAMS2 */ debug_opts->fams2_imm_restore_drr = true; -if (dc_get_caps (adev->dm.dc)->dp_hdmi21_pcon_support) +if (dc_get_dp_hdmi21_pcon_support (adev->dm.dc))drm_info (adev_to_drm (adev),"DP-HDMI FRL PCON supported\n" ); r =dm_dmub_hw_init (adev);
@@ -753,18 +753,18 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)amdgpu_dm_init_color_mod (); -if (dc_get_caps (adev->dm.dc)->max_links >0 ) { +if (dc_get_max_links (adev->dm.dc) >0 ) { adev->dm.vblank_control_workqueue =create_singlethread_workqueue ("dm_vblank_control_workqueue" );if (!adev->dm.vblank_control_workqueue)drm_err (adev_to_drm (adev),"failed to initialize vblank_workqueue.\n" ); } -if (dc_get_caps (adev->dm.dc)->ips_support && +if (dc_get_ips_support (adev->dm.dc) &&dc_get_disable_ips (adev->dm.dc) !=DMUB_IPS_DISABLE_ALL ) adev->dm.idle_workqueue =idle_create_workqueue (adev); -if (dc_get_caps (adev->dm.dc)->max_links >0 && adev->family >=AMDGPU_FAMILY_RV ) { +if (dc_get_max_links (adev->dm.dc) >0 && adev->family >=AMDGPU_FAMILY_RV ) { adev->dm.hdcp_workqueue =hdcp_create_workqueue (adev, &init_params.cp_psp, adev->dm.dc);if (!adev->dm.hdcp_workqueue)
@@ -776,7 +776,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)dc_init_callbacks (adev->dm.dc, &init_params); } -if (dc_get_caps (adev->dm.dc)->max_links >0 ) { +if (dc_get_max_links (adev->dm.dc) >0 ) { adev->dm.hdmi_frl_status_polling_wq =create_singlethread_workqueue ("hdmi_frl_status_polling_wq" );if (!adev->dm.hdmi_frl_status_polling_wq)
@@ -840,8 +840,8 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)/* TODO: Add_display_info? */ /* TODO use dynamic cursor width */ -adev_to_drm (adev)->mode_config.cursor_width =dc_get_caps (adev->dm.dc)->max_cursor_size; -adev_to_drm (adev)->mode_config.cursor_height =dc_get_caps (adev->dm.dc)->max_cursor_size; +adev_to_drm (adev)->mode_config.cursor_width =dc_get_max_cursor_size (adev->dm.dc); +adev_to_drm (adev)->mode_config.cursor_height =dc_get_max_cursor_size (adev->dm.dc);if (drm_vblank_init (adev_to_drm (adev), adev->dm.display_indexes_num)) { drm_err(adev_to_drm(adev),
@@ -949,7 +949,7 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev) &adev->dm.boot_time_crc_info.cpu_addr);if (adev->dm.hpd_rx_offload_wq && adev->dm.dc) { -for (i =0 ; i <dc_get_caps (adev->dm.dc)->max_links; i++) { +for (i =0 ; i <dc_get_max_links (adev->dm.dc); i++) {if (adev->dm.hpd_rx_offload_wq[i].wq) {destroy_workqueue (adev->dm.hpd_rx_offload_wq[i].wq); adev->dm.hpd_rx_offload_wq[i].wq =NULL ;
@@ -1672,7 +1672,7 @@ static int dm_suspend(struct amdgpu_ip_block *ip_block)dc_set_power_state (dm->dc,DC_ACPI_CM_POWER_STATE_D3 ); -if (dc_get_caps (dm->dc)->ips_support && adev->in_s0ix) +if (dc_get_ips_support (dm->dc) && adev->in_s0ix)dc_allow_idle_optimizations (dm->dc, true);dc_dmub_srv_set_power_state (dc_get_ctx (dm->dc)->dmub_srv,DC_ACPI_CM_POWER_STATE_D3 );
@@ -1897,7 +1897,7 @@ static int dm_resume(struct amdgpu_ip_block *ip_block)int i, r, j;struct dc_commit_streams_params commit_params = {}; -if (dc_get_caps (dm->dc)->ips_support) { +if (dc_get_ips_support (dm->dc)) {if (!amdgpu_in_reset (adev))mutex_lock (&dm->dc_lock);
@@ -2343,7 +2343,7 @@ STATIC_IFN_KUNIT int initialize_plane(struct amdgpu_display_manager *dm,* for a CRTC - like overlay or underlay planes. */ possible_crtcs =1 << plane_id; -if (plane_id >=dc_get_caps (dm->dc)->max_streams) +if (plane_id >=dc_get_max_streams (dm->dc)) possible_crtcs =0xff ; ret =amdgpu_dm_plane_init (dm, plane, possible_crtcs, plane_cap);
@@ -2380,25 +2380,28 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)u32 link_cnt;s32 primary_planes;enum dc_connection_type new_connection_type = dc_connection_none; +const struct dc_plane_cap *plane_caps; +unsigned int plane_count;const struct dc_plane_cap *plane;bool psr_feature_enabled = false;bool replay_feature_enabled = false; -int max_overlay =dc_get_caps (dm->dc)->max_slave_planes; +int max_overlay =dc_get_max_slave_planes (dm->dc); - dm->display_indexes_num =dc_get_caps (dm->dc)->max_streams; + dm->display_indexes_num =dc_get_max_streams (dm->dc);/* Update the actual used number of crtc */ adev->mode_info.num_crtc = adev->dm.display_indexes_num;amdgpu_dm_set_irq_funcs (adev); - link_cnt =dc_get_caps (dm->dc)->max_links; + link_cnt =dc_get_max_links (dm->dc); + plane_caps =dc_get_plane_caps (dm->dc, &plane_count);if (amdgpu_dm_mode_config_init (dm->adev)) {drm_err (adev_to_drm (adev),"DM: Failed to initialize mode config\n" );return -EINVAL ; }/* There is one primary plane per CRTC */ - primary_planes =dc_get_caps (dm->dc)->max_streams; + primary_planes =dc_get_max_streams (dm->dc);if (primary_planes >AMDGPU_MAX_PLANES ) {drm_err (adev_to_drm (adev),"DM: Plane nums out of 6 planes\n" );return -EINVAL ;
@@ -2409,7 +2412,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)* Order is reversed to match iteration order in atomic check. */ for (i = (primary_planes -1 ); i >=0 ; i--) { - plane = &dc_get_caps (dm->dc)->planes[i]; + plane = &plane_caps[i];if (initialize_plane (dm, mode_info, i,DRM_PLANE_TYPE_PRIMARY , plane)) {
@@ -2427,8 +2430,8 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)* Only support DCN for now, and only expose one so we don't encourage * userspace to use up all the pipes. */ -for (i =0 ; i <dc_get_caps (dm->dc)->max_planes; ++i) { -const struct dc_plane_cap *plane = &dc_get_caps (dm->dc)->planes[i]; +for (i =0 ; i < plane_count; ++i) { +const struct dc_plane_cap *plane = &plane_caps[i];/* Do not create overlay if MPO disabled */ if (amdgpu_dc_debug_mask &DC_DISABLE_MPO )
@@ -2450,7 +2453,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) } } -for (i =0 ; i <dc_get_caps (dm->dc)->max_streams; i++) +for (i =0 ; i <dc_get_max_streams (dm->dc); i++)if (amdgpu_dm_crtc_init (dm, mode_info->planes[i], i)) {drm_err (adev_to_drm (adev),"KMS: Failed to initialize crtc\n" ); goto fail;
@@ -3681,6 +3684,7 @@ STATIC_IFN_KUNIT void amdgpu_dm_update_cursor(struct drm_plane *plane,uint64_t address = afb ? afb->address :0 ;struct dc_cursor_position position = {0 };struct dc_cursor_attributes attributes; +struct dc_color_caps color_caps;int ret;if (!plane->state->fb && !old_plane_state->fb)
@@ -3707,6 +3711,7 @@ STATIC_IFN_KUNIT void amdgpu_dm_update_cursor(struct drm_plane *plane, amdgpu_crtc->cursor_width = plane->state->crtc_w; amdgpu_crtc->cursor_height = plane->state->crtc_h; +dc_get_color_caps (adev->dm.dc, &color_caps);memset (&attributes,0 ,sizeof (attributes)); attributes.address.high_part =upper_32_bits (address); attributes.address.low_part =lower_32_bits (address);
@@ -3719,8 +3724,7 @@ STATIC_IFN_KUNIT void amdgpu_dm_update_cursor(struct drm_plane *plane,/* Enable cursor degamma ROM on DCN3+ for implicit sRGB degamma in DRM * legacy gamma setup. */ -if (crtc_state->cm_is_degamma_srgb && -dc_get_caps (adev->dm.dc)->color.dpp.gamma_corr) +if (crtc_state->cm_is_degamma_srgb && color_caps.dpp.gamma_corr) attributes.attribute_flags.bits.ENABLE_CURSOR_DEGAMMA =1 ;if (afb)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c +2 -2
@@ -383,7 +383,7 @@ void amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm, }mutex_lock (&dm->dc_lock); -if (dc_get_caps (dm->dc)->ips_support &&dc_get_ctx (dm->dc)->dmub_srv->idle_allowed) { +if (dc_get_ips_support (dm->dc) &&dc_get_ctx (dm->dc)->dmub_srv->idle_allowed) {dc_allow_idle_optimizations (dm->dc, false); reallow_idle = true; }
@@ -415,7 +415,7 @@ void amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm,amdgpu_dm_replay_set_event (dm, stream, true, replay_event_hw_programming, true); -if (dc_get_caps (dm->dc)->ips_support && reallow_idle) +if (dc_get_ips_support (dm->dc) && reallow_idle)dc_allow_idle_optimizations (dm->dc, true);mutex_unlock (&dm->dc_lock);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +22 -16
@@ -1168,9 +1168,11 @@ int amdgpu_dm_verify_lut3d_size(struct amdgpu_device *adev,struct dm_plane_state *dm_plane_state =to_dm_plane_state (plane_state);const struct drm_color_lut *shaper =NULL , *lut3d =NULL ;uint32_t exp_size, size, dim_size =MAX_COLOR_3DLUT_SIZE ; -const struct dc_caps *caps =dc_get_caps (adev->dm.dc); -bool has_3dlut = - caps->color.dpp.hw_3d_lut || caps->color.mpc.preblend; +struct dc_color_caps color_caps; +bool has_3dlut; + +dc_get_color_caps (adev->dm.dc, &color_caps); + has_3dlut = color_caps.dpp.hw_3d_lut || color_caps.mpc.preblend;/* shaper LUT is only available if 3D LUT color caps */ exp_size = has_3dlut ?MAX_COLOR_LUT_ENTRIES :0 ;
@@ -1553,7 +1555,7 @@ __set_colorop_in_tf_1d_curve(struct dc_plane_state *dc_plane_state,struct dc_transfer_func *tf = &dc_plane_state->in_transfer_func;struct drm_colorop *colorop = colorop_state->colorop;struct drm_device *drm = colorop->dev; -const struct dc_color_caps *color_caps =NULL ; +struct dc_color_caps color_caps = { };bool is_subsampled_format;if (colorop->type !=DRM_COLOROP_1D_CURVE )
@@ -1577,9 +1579,9 @@ __set_colorop_in_tf_1d_curve(struct dc_plane_state *dc_plane_state, tf->tf =amdgpu_colorop_tf_to_dc_tf (colorop_state->curve_1d_type);if (dc_plane_state->ctx && dc_plane_state->ctx->dc) - color_caps = &dc_get_caps (dc_plane_state->ctx->dc)->color; +dc_get_color_caps (dc_plane_state->ctx->dc, &color_caps); -if (!mod_color_calculate_degamma_params (color_caps, tf,NULL , +if (!mod_color_calculate_degamma_params (&color_caps, tf,NULL , is_subsampled_format)) {drm_err (drm,"Failed to calculate degamma params\n" );return -EINVAL ;
@@ -1867,9 +1869,11 @@ __set_dm_plane_colorop_3dlut(struct drm_plane_state *plane_state,struct dc_transfer_func *tf = &dc_plane_state->cm.shaper_func;struct drm_atomic_commit *state = plane_state->state;const struct amdgpu_device *adev =drm_to_adev (colorop->dev); -const struct dc_caps *caps =dc_get_caps (adev->dm.dc); -bool has_3dlut = - caps->color.dpp.hw_3d_lut || caps->color.mpc.preblend; +struct dc_color_caps color_caps; +bool has_3dlut; + +dc_get_color_caps (adev->dm.dc, &color_caps); + has_3dlut = color_caps.dpp.hw_3d_lut || color_caps.mpc.preblend;const struct drm_device *dev = colorop->dev;const struct drm_color_lut32 *lut3d;uint32_t lut3d_size;
@@ -2048,9 +2052,11 @@ amdgpu_dm_plane_set_colorop_properties(struct drm_plane_state *plane_state,struct drm_colorop *colorop = plane_state->color_pipeline;struct drm_device *dev = plane_state->plane->dev;struct amdgpu_device *adev =drm_to_adev (dev); -const struct dc_caps *caps =dc_get_caps (adev->dm.dc); -bool has_3dlut = - caps->color.dpp.hw_3d_lut || caps->color.mpc.preblend; +struct dc_color_caps color_caps; +bool has_3dlut; + +dc_get_color_caps (adev->dm.dc, &color_caps); + has_3dlut = color_caps.dpp.hw_3d_lut || color_caps.mpc.preblend;int ret;/* Fixed Matrix (YUV to RGB) */
@@ -2162,7 +2168,7 @@ int amdgpu_dm_update_plane_color_mgmt(struct dm_crtc_state *crtc,struct amdgpu_device *adev =drm_to_adev (crtc->base.state->dev);struct dm_plane_state *dm_plane_state =to_dm_plane_state (plane_state);struct drm_color_ctm_3x4 *ctm =NULL ; -const struct dc_color_caps *color_caps =NULL ; +struct dc_color_caps color_caps = { };bool has_crtc_cm_degamma;int ret;
@@ -2173,7 +2179,7 @@ int amdgpu_dm_update_plane_color_mgmt(struct dm_crtc_state *crtc, }if (dc_plane_state->ctx && dc_plane_state->ctx->dc) - color_caps = &dc_get_caps (dc_plane_state->ctx->dc)->color; +dc_get_color_caps (dc_plane_state->ctx->dc, &color_caps);/* Initially, we can just bypass the DGM block. */ dc_plane_state->in_transfer_func.type =TF_TYPE_BYPASS ;
@@ -2182,7 +2188,7 @@ int amdgpu_dm_update_plane_color_mgmt(struct dm_crtc_state *crtc,/* After, we start to update values according to color props */ has_crtc_cm_degamma = (crtc->cm_has_degamma || crtc->cm_is_degamma_srgb); - ret =__set_dm_plane_degamma (plane_state, dc_plane_state, color_caps); + ret =__set_dm_plane_degamma (plane_state, dc_plane_state, &color_caps);if (ret == -ENOMEM )return ret;
@@ -2209,7 +2215,7 @@ int amdgpu_dm_update_plane_color_mgmt(struct dm_crtc_state *crtc,* linearize (implicit degamma) from sRGB/BT709 according to * the input space. */ - ret =map_crtc_degamma_to_dc_plane (crtc, dc_plane_state, color_caps); + ret =map_crtc_degamma_to_dc_plane (crtc, dc_plane_state, &color_caps);if (ret)return ret; }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c +5 -2
@@ -299,8 +299,11 @@ int amdgpu_dm_initialize_default_pipeline(struct drm_plane *plane, struct drm_pr {struct drm_device *dev = plane->dev;struct amdgpu_device *adev =drm_to_adev (dev); -bool hw_3d_lut =dc_get_caps (adev->dm.dc)->color.dpp.hw_3d_lut || -dc_get_caps (adev->dm.dc)->color.mpc.preblend; +struct dc_color_caps color_caps; +bool hw_3d_lut; + +dc_get_color_caps (adev->dm.dc, &color_caps); + hw_3d_lut = color_caps.dpp.hw_3d_lut || color_caps.mpc.preblend;return amdgpu_dm_build_default_pipeline (dev, plane, hw_3d_lut, list); }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c +1 -1
@@ -1303,7 +1303,7 @@ static void apply_dsc_policy_for_stream(struct amdgpu_dm_connector *aconnector,if (sink->sink_signal ==SIGNAL_TYPE_EDP && !aconnector->dc_link->panel_config.dsc.disable_dsc_edp && -dc_get_caps (dc)->edp_dsc_support && +dc_get_edp_dsc_support (dc) && aconnector->dsc_settings.dsc_force_enable !=DSC_CLK_FORCE_DISABLE ) {apply_dsc_policy_for_edp (aconnector, sink, stream, dsc_caps, max_dsc_target_bpp_limit_override);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +11 -6
@@ -308,7 +308,7 @@ static inline int amdgpu_dm_crtc_set_vblank(struct drm_crtc *crtc, bool enable)* Call this function to estimate missed vblanks by using timestamps and * update the vblank counter in DRM. */ -if (dc_get_caps (dc)->ips_support && +if (dc_get_ips_support (dc) &&dc_get_disable_ips (dc) !=DMUB_IPS_DISABLE_ALL && sr_supported && vblank->config.disable_immediate)drm_crtc_vblank_restore (crtc);
@@ -529,8 +529,11 @@ static void dm_crtc_additional_color_mgmt(struct drm_crtc *crtc) {struct amdgpu_device *adev =drm_to_adev (crtc->dev); +struct dc_color_caps color_caps; -if (dc_get_caps (adev->dm.dc)->color.mpc.ogam_ram) +dc_get_color_caps (adev->dm.dc, &color_caps); + +if (color_caps.mpc.ogam_ram)drm_object_attach_property (&crtc->base, adev->mode_info.regamma_tf_property,AMDGPU_TRANSFER_FUNCTION_DEFAULT );
@@ -770,9 +773,12 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm, {struct amdgpu_crtc *acrtc =NULL ;struct drm_plane *cursor_plane; +struct dc_color_caps color_caps;bool has_degamma;int res = -ENOMEM ; +dc_get_color_caps (dm->dc, &color_caps); + cursor_plane =kzalloc_obj (*cursor_plane);if (!cursor_plane) goto fail;
@@ -809,12 +815,11 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm, res =PTR_ERR (crtc_state); goto error_ism_fini; } - acrtc->base.state = crtc_state; } - acrtc->max_cursor_width =dc_get_caps (dm->adev->dm.dc)->max_cursor_size; - acrtc->max_cursor_height =dc_get_caps (dm->adev->dm.dc)->max_cursor_size; + acrtc->max_cursor_width =dc_get_max_cursor_size (dm->adev->dm.dc); + acrtc->max_cursor_height =dc_get_max_cursor_size (dm->adev->dm.dc); acrtc->crtc_id = crtc_index; acrtc->base.enabled = false;
@@ -830,7 +835,7 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,* or the COLOR_PIPELINE property. An atomic commit which attempts to enable * both is rejected. */ - has_degamma =dc_get_caps (dm->adev->dm.dc)->color.dpp.dcn_arch && + has_degamma = color_caps.dpp.dcn_arch &&dc_get_dce_version (dm->adev->dm.dc) !=DCN_VERSION_4_01 ; drm_crtc_enable_color_mgmt(&acrtc->base, has_degamma ? MAX_COLOR_LUT_ENTRIES : 0,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +3 -3
@@ -4459,8 +4459,8 @@ static int capabilities_show(struct seq_file *m, void *unused) {struct amdgpu_device *adev = (struct amdgpu_device *)m->private;struct dc *dc = adev->dm.dc; -bool mall_supported =dc_get_caps (dc)->mall_size_total; -bool subvp_supported =dc_get_caps (dc)->subvp_fw_processing_delay_us; +bool mall_supported =dc_get_mall_size_total (dc); +bool subvp_supported =dc_get_subvp_fw_processing_delay_us (dc);unsigned int mall_in_use = false;unsigned int subvp_in_use = false;
@@ -4708,7 +4708,7 @@ void dtn_debugfs_init(struct amdgpu_device *adev)debugfs_create_file_unsafe ("amdgpu_dm_disable_hpd" ,0644 , root, adev, &disable_hpd_ops); -if (dc_get_caps (adev->dm.dc)->ips_support) { +if (dc_get_ips_support (adev->dm.dc)) {debugfs_create_file_unsafe ("amdgpu_dm_ips_status" ,0644 , root, adev, &ips_status_fops);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c +1 -1
@@ -336,7 +336,7 @@ int dm_dmub_hw_init(struct amdgpu_device *adev) hw_params.fb_info = fb_info;/* Enable usb4 dpia in the FW APU */ -if (dc_get_caps (dc)->is_apu && +if (dc_is_apu (dc) &&dc_get_usb4_dpia_count (dc) !=0 && !dc_get_debug_options (dc)->dpia_debug.bits.disable_dpia) { hw_params.dpia_supported = true;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c +5 -5
@@ -43,7 +43,7 @@ STATIC_IFN_KUNIT bool lp_write_i2c(void *handle, uint32_t address, const uint8_tstruct dc_link *link = handle;struct i2c_payload i2c_payloads[] = {{true, address, size, (void *)data} };struct i2c_command cmd = {i2c_payloads,1 ,I2C_COMMAND_ENGINE_HW , -dc_get_caps (link->dc)->i2c_speed_in_khz}; +dc_get_i2c_speed_in_khz (link->dc)};return dm_helpers_submit_i2c (link->ctx, link, &cmd); }
@@ -56,7 +56,7 @@ STATIC_IFN_KUNIT bool lp_read_i2c(void *handle, uint32_t address, uint8_t offsetstruct i2c_payload i2c_payloads[] = {{true, address,1 , &offset}, {false, address, size, data} };struct i2c_command cmd = {i2c_payloads,2 ,I2C_COMMAND_ENGINE_HW , -dc_get_caps (link->dc)->i2c_speed_in_khz}; +dc_get_i2c_speed_in_khz (link->dc)};return dm_helpers_submit_i2c (link->ctx, link, &cmd); }
@@ -308,7 +308,7 @@ void hdcp_update_display(struct hdcp_workqueue *hdcp_work, hdcp_w->aconnector[conn_index] = aconnector;hdcp_get_link_display_adjustments (enable_encryption, content_type, -dc_get_caps (dc)->fused_io_supported, +dc_get_fused_io_support (dc),dc_get_debug_options (dc)->hdcp_lc_force_fw_enable,dc_get_debug_options (dc)->hdcp_lc_enable_sw_fallback, &link_adjust, &display_adjust);
@@ -677,7 +677,7 @@ void update_config(void *handle, struct cp_psp_stream_config *config) link->adjust.retry_limit =MAX_NUM_OF_ATTEMPTS ; link->adjust.hdcp1.disable =0 ; link->adjust.hdcp2.use_fw_locality_check = - (dc_get_caps (dc)->fused_io_supported || + (dc_get_fused_io_support (dc) ||dc_get_debug_options (dc)->hdcp_lc_force_fw_enable); link->adjust.hdcp2.use_sw_locality_fallback =dc_get_debug_options (dc)->hdcp_lc_enable_sw_fallback;
@@ -842,7 +842,7 @@ static const struct bin_attribute data_attr = {struct hdcp_workqueue *hdcp_create_workqueue (struct amdgpu_device *adev,struct cp_psp *cp_psp,struct dc *dc) { -int max_caps =dc_get_caps (dc)->max_links; +int max_caps =dc_get_max_links (dc);struct hdcp_workqueue *hdcp_work;int i =0 ;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c +5 -5
@@ -808,7 +808,7 @@ static inline int dm_irq_state(struct amdgpu_device *adev, st = (state ==AMDGPU_IRQ_STATE_ENABLE ); -if (dc &&dc_get_caps (dc)->ips_support &&dc_is_idle_optimizations_allowed (dc)) +if (dc &&dc_get_ips_support (dc) &&dc_is_idle_optimizations_allowed (dc))dc_allow_idle_optimizations (dc, false);amdgpu_dm_irq_set (adev, irq_source, st);
@@ -1226,7 +1226,7 @@ EXPORT_IF_KUNIT(dm_handle_hpd_rx_offload_work);struct hpd_rx_irq_offload_work_queue *amdgpu_dm_hpd_rx_irq_create_workqueue (struct amdgpu_device *adev) {struct dc *dc = adev->dm.dc; -int max_caps =dc_get_caps (dc)->max_links; +int max_caps =dc_get_max_links (dc);int i =0 ;struct hpd_rx_irq_offload_work_queue *hpd_rx_offload_wq =NULL ;
@@ -1265,7 +1265,7 @@ void amdgpu_dm_hpd_rx_irq_work_suspend(struct amdgpu_display_manager *dm)int i;if (dm->hpd_rx_offload_wq) { -for (i =0 ; i <dc_get_caps (dm->dc)->max_links; i++) +for (i =0 ; i <dc_get_max_links (dm->dc); i++)flush_workqueue (dm->hpd_rx_offload_wq[i].wq); } }
@@ -1321,7 +1321,7 @@ void amdgpu_dm_hdmi_hpd_debounce_work(struct work_struct *work)/* Re-detect the display */ scoped_guard(mutex, &adev->dm.dc_lock) { -if (dc_get_caps (dc)->ips_support &&dc_get_ctx (dc)->dmub_srv->idle_allowed) { +if (dc_get_ips_support (dc) &&dc_get_ctx (dc)->dmub_srv->idle_allowed) {dc_allow_idle_optimizations (dc, false); reallow_idle = true; }
@@ -1359,7 +1359,7 @@ void amdgpu_dm_hdmi_hpd_debounce_work(struct work_struct *work) } scoped_guard(mutex, &adev->dm.dc_lock) { -if (reallow_idle &&dc_get_caps (dc)->ips_support) +if (reallow_idle &&dc_get_ips_support (dc))dc_allow_idle_optimizations (dc, true); } }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +1 -1
@@ -1239,7 +1239,7 @@ STATIC_IFN_KUNIT bool get_conv_frl_bw(struct amdgpu_dm_connector *aconnector,unsigned int dsc_max_sink_bw_in_kbps =0 ;if (aconnector->dc_sink && -dc_get_caps (aconnector->dc_link->dc)->dp_hdmi21_pcon_support && +dc_get_dp_hdmi21_pcon_support (aconnector->dc_link->dc) && aconnector->mst_downstream_port_caps.bytes.byte0.bits.DWN_STRM_PORTX_TYPE ==DOWN_STREAM_DETAILED_HDMI ) { max_conv_bw_in_kbps = dc_link_bw_kbps_from_raw_frl_link_rate_data( aconnector->dc_link->dc,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +18 -8
@@ -1333,8 +1333,13 @@ STATIC_IFN_KUNIT void amdgpu_dm_plane_get_min_max_dc_plane_scaling(struct drm_de {struct amdgpu_device *adev =drm_to_adev (dev);struct dc *dc = adev->dm.dc; +const struct dc_plane_cap *plane_caps; +unsigned int plane_count;/* Caps for all supported planes are the same on DCE and DCN 1 - 3 */ -const struct dc_plane_cap *plane_cap = &dc_get_caps (dc)->planes[0 ]; +const struct dc_plane_cap *plane_cap; + + plane_caps =dc_get_plane_caps (dc, &plane_count); + plane_cap = &plane_caps[0 ];switch (fb->format->format) {case DRM_FORMAT_P010 :
@@ -1646,6 +1651,7 @@ void amdgpu_dm_plane_handle_cursor_update(struct drm_plane *plane,uint64_t address = afb ? afb->address :0 ;struct dc_cursor_position position = {0 };struct dc_cursor_attributes attributes; +struct dc_color_caps color_caps;int ret;if (!plane->state->fb && !old_plane_state->fb)
@@ -1681,6 +1687,7 @@ void amdgpu_dm_plane_handle_cursor_update(struct drm_plane *plane, amdgpu_crtc->cursor_width = plane->state->crtc_w; amdgpu_crtc->cursor_height = plane->state->crtc_h; +dc_get_color_caps (adev->dm.dc, &color_caps);memset (&attributes,0 ,sizeof (attributes)); attributes.address.high_part =upper_32_bits (address); attributes.address.low_part =lower_32_bits (address);
@@ -1693,8 +1700,7 @@ void amdgpu_dm_plane_handle_cursor_update(struct drm_plane *plane,/* Enable cursor degamma ROM on DCN3+ for implicit sRGB degamma in DRM * legacy gamma setup. */ -if (crtc_state->cm_is_degamma_srgb && -dc_get_caps (adev->dm.dc)->color.dpp.gamma_corr) +if (crtc_state->cm_is_degamma_srgb && color_caps.dpp.gamma_corr) attributes.attribute_flags.bits.ENABLE_CURSOR_DEGAMMA =1 ;if (afb)
@@ -1974,7 +1980,11 @@ dm_atomic_plane_attach_color_mgmt_properties(struct amdgpu_display_manager *dm, struct drm_plane *plane) {struct amdgpu_mode_info mode_info = dm->adev->mode_info; -struct dpp_color_caps dpp_color_caps =dc_get_caps (dm->dc)->color.dpp; +struct dc_color_caps color_caps; +struct dpp_color_caps dpp_color_caps; + +dc_get_color_caps (dm->dc, &color_caps); + dpp_color_caps = color_caps.dpp;/* Check HW color pipeline capabilities on DPP block (pre-blending) * before exposing related properties.
@@ -1996,11 +2006,11 @@ dm_atomic_plane_attach_color_mgmt_properties(struct amdgpu_display_manager *dm, AMDGPU_HDR_MULT_DEFAULT);/* Only enable plane CTM if both DPP and MPC gamut remap is available. */ -if (dc_get_caps (dm->dc)->color.mpc.gamut_remap) +if (color_caps.mpc.gamut_remap)drm_object_attach_property (&plane->base, dm->adev->mode_info.plane_ctm_property,0 ); -if (dpp_color_caps.hw_3d_lut ||dc_get_caps (dm->dc)->color.mpc.preblend) { +if (dpp_color_caps.hw_3d_lut || color_caps.mpc.preblend) {drm_object_attach_property (&plane->base, mode_info.plane_shaper_lut_property,0 ); drm_object_attach_property(&plane->base,
@@ -2016,7 +2026,7 @@ dm_atomic_plane_attach_color_mgmt_properties(struct amdgpu_display_manager *dm, MAX_COLOR_3DLUT_SIZE); } -if (dpp_color_caps.ogam_ram ||dc_get_caps (dm->dc)->color.mpc.preblend) { +if (dpp_color_caps.ogam_ram || color_caps.mpc.preblend) {drm_object_attach_property (&plane->base, mode_info.plane_blend_lut_property,0 ); drm_object_attach_property(&plane->base,
@@ -2215,7 +2225,7 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,int res = -EPERM ;unsigned int supported_rotations;uint64_t *modifiers =NULL ; -unsigned int primary_zpos =dc_get_caps (dm->dc)->max_slave_planes; +unsigned int primary_zpos =dc_get_max_slave_planes (dm->dc); num_formats =amdgpu_dm_plane_get_plane_formats (plane, plane_cap, formats,ARRAY_SIZE (formats));
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c +2 -2
@@ -37,7 +37,7 @@ bool link_supports_psrsu(struct dc_link *link) {struct dc *dc = link->ctx->dc; -if (!dc_get_caps (dc)->dmcub_support) +if (!dc_get_dmcub_support (dc))return false;if (dc_get_dce_version (dc) <DCN_VERSION_3_1 )
@@ -111,7 +111,7 @@ bool amdgpu_dm_set_psr_caps(struct dc_link *link, struct amdgpu_dm_connector *ac/* Reset psr version first */ link->psr_settings.psr_version =DC_PSR_VERSION_UNSUPPORTED ; -if (!dc_get_caps (dc)->dmub_caps.psr) +if (!dc_dmub_supports_psr (dc))return false;if (!(link->connector_signal &SIGNAL_TYPE_EDP ))
drivers/gpu/drm/amd/display/dc/core/dc_accessors.c +101 -2
110 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/inc/dc.h +33 -3
@@ -2351,8 +2351,38 @@ struct dc_context *dc_get_ctx(const struct dc *dc);/* The ASIC display engine version. */ enum dce_version dc_get_dce_version (const struct dc *dc); -/* Capabilities detected at dc_create() time. Read-only. */ -const struct dc_caps *dc_get_caps (const struct dc *dc); +/* +* Capabilities detected at dc_create() time. Read-only; prefer the +* purpose-built queries below over reaching into the caps structure. +*/ +bool dc_is_apu (const struct dc *dc); +bool dc_get_ips_support (const struct dc *dc); +bool dc_get_dmcub_support (const struct dc *dc); +unsigned int dc_get_max_links (const struct dc *dc); +unsigned int dc_get_max_streams (const struct dc *dc); +unsigned int dc_get_max_planes (const struct dc *dc); +unsigned int dc_get_max_slave_planes (const struct dc *dc); +unsigned int dc_get_max_cursor_size (const struct dc *dc); +unsigned int dc_get_max_v_total (const struct dc *dc); +bool dc_get_vtotal_limited_by_fp2 (const struct dc *dc); +unsigned int dc_get_i2c_speed_in_khz (const struct dc *dc); +bool dc_get_dp_hdmi21_pcon_support (const struct dc *dc); +bool dc_get_edp_dsc_support (const struct dc *dc); +bool dc_get_fused_io_support (const struct dc *dc); +unsigned int dc_get_subvp_fw_processing_delay_us (const struct dc *dc); +unsigned int dc_get_mall_size_total (const struct dc *dc); +bool dc_dmub_supports_psr (const struct dc *dc); +bool dc_dmub_supports_aux_backlight (const struct dc *dc); + +/* Copy out the color pipeline capabilities. */ +void dc_get_color_caps (const struct dc *dc,struct dc_color_caps *caps); + +/* +* Return the static plane capability array and its entry count. +* Valid until the DC is destroyed. +*/ +const struct dc_plane_cap *dc_get_plane_caps (const struct dc *dc, +unsigned int *count);/* * Select which eDP connectors get hotplug detection enabled; see
@@ -2512,7 +2542,7 @@ void dc_set_dml2_alt_ch_cfg(struct dc *dc,/* Return an enumerated dc_link. * dc_link order is constant and determined at * boot time. They cannot be created or destroyed. -* Use dc_get_caps() to get number of links. +* Use dc_get_max_links() to get number of links. */ struct dc_link *dc_get_link_at_index (struct dc *dc,uint32_t link_index);
drivers/gpu/drm/amd/display/modules/freesync/freesync.c +3 -3
@@ -125,9 +125,9 @@ static unsigned int calc_duration_in_us_from_v_total(static unsigned int calc_max_hardware_v_total (const struct dc_stream_state *stream) { -unsigned int max_hw_v_total =dc_get_caps (stream->ctx->dc)->max_v_total; +unsigned int max_hw_v_total =dc_get_max_v_total (stream->ctx->dc); -if (dc_get_caps (stream->ctx->dc)->vtotal_limited_by_fp2) +if (dc_get_vtotal_limited_by_fp2 (stream->ctx->dc)) max_hw_v_total -= stream->timing.v_front_porch +1 ;return max_hw_v_total;
@@ -1007,7 +1007,7 @@ void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync, nominal_field_rate_in_uhz =mod_freesync_calc_nominal_field_rate (stream); -if (dc_get_caps (stream->ctx->dc)->max_v_total !=0 && stream->timing.h_total !=0 ) { +if (dc_get_max_v_total (stream->ctx->dc) !=0 && stream->timing.h_total !=0 ) { min_hardware_refresh_in_uhz =div64_u64 ((stream->timing.pix_clk_100hz *100000000ULL ), (stream->timing.h_total * (long long )calc_max_hardware_v_total (stream))); }
drivers/gpu/drm/amd/display/modules/power/power_abm.c +1 -1
@@ -935,7 +935,7 @@ static bool set_backlight_millinits_aux(struct core_power *core_power,// only use internal backlight control if dmub capabilities are not present if (link->backlight_control_type ==BACKLIGHT_CONTROL_VESA_AUX && -dc_get_caps (link->dc)->dmub_caps.aux_backlight_support) +dc_dmub_supports_aux_backlight (link->dc))return true; return dc_link_set_backlight_level_nits(link, core_power->bl_state[inst].isHDR,
drivers/gpu/drm/amd/display/modules/power/power_psr.c +1 -1
@@ -645,7 +645,7 @@ bool psr_su_set_dsc_slice_height(struct dc *dc, struct dc_link *link, config->dsc_slice_height =0 ;if (!(link->connector_signal &SIGNAL_TYPE_EDP ) || - !dc_get_caps (dc)->edp_dsc_support || + !dc_get_edp_dsc_support (dc) || link->panel_config.dsc.disable_dsc_edp || !link->dpcd_caps.dsc_caps.dsc_basic_caps.fields.dsc_support.DSC_SUPPORT || !stream->timing.dsc_cfg.num_slices_v)
Signature · 1 line
2.56.0
[email protected]
AI reviewRe: [PATCH 19/19] drm/amd/display: Replace dc_get_caps with purpose-built capability queries
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [High] drm/amd/display: missing fused_io and…
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce:
- [High] drm/amd/display: missing fused_io and hdcp_lc_force_fw_enable checks in dc_is_dmub_outbox_supported() [1]
--
commit c8a21aad95119e6c5fca592bbd2394b8b1a780d9
Author: Dave Airlie <[email protected]>
drm/amd/display: Replace dc_get_caps with purpose-built capability queries
This commit replaces the dc_get_caps() view accessor with dedicated capability query functions so callers outside DC no longer access struct dc_caps directly.
Quoted 4 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c +0
-0
[ ... ]
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c void update_config(void *handle, struct cp_psp_stream_config *config) · line 683
Quoted 9 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c +1
-1@@ -677,7 +677,7 @@ void update_config(void *handle, struct cp_psp_stream_config *config) link->adjust.retry_limit =MAX_NUM_OF_ATTEMPTS ; link->adjust.hdcp1.disable =0 ; link->adjust.hdcp2.use_fw_locality_check = - (dc_get_caps (dc)->fused_io_supported || + (dc_get_fused_io_support (dc) ||dc_get_debug_options (dc)->hdcp_lc_force_fw_enable); link->adjust.hdcp2.use_sw_locality_fallback =dc_get_debug_options (dc)->hdcp_lc_enable_sw_fallback;
[Severity: High]
This problem wasn't introduced by this patch, but can enabling use_fw_locality_check here cause a NULL pointer dereference in execute_fused_io() [1]?
amdgpu_dm_init() only initializes adev->dm.fused_io[].replied and enables the DMUB outbox when dc_is_dmub_outbox_supported() returns true:
drivers/gpu/drm/amd/display/dc/core/dc.c:dc_is_dmub_outbox_supported() {
if (!dc->caps.dmcub_support)
return false;
switch (dc->ctx->asic_id.chip_family) {
...
}
/* dmub aux needs dmub notifications to be enabled */
return dc->debug.enable_dmub_aux_for_legacy_ddc;
}Because dc_is_dmub_outbox_supported() does not check fused_io_supported or hdcp_lc_force_fw_enable, it returns false on ASICs such as AMDGPU_FAMILY_GC_13_0_1 where Fused IO is supported without DPIA or legacy DDC DMUB AUX notifications. When an HDCP2 locality check runs, execute_fused_io() calls wait_for_completion_timeout() on the uninitialized completion.
[1] https://sashiko.dev/#/bug/linux-dc486f6b-5c5b-43d8-842b-cdc1ed0770b0
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=19
Harry Wentland
maintainerRe: [PATCH 19/19] drm/amd/display: Replace dc_get_caps with purpose-built capability queries
In reply to Dave AirlieQuoted 24 lines · On 11/11/26 20:43, Dave Airlie via B4 Relay wrote:
From: Dave Airlie <[email protected]>
Split the caps view accessor into per-capability queries so DM and the DAL modules no longer read through struct
dc_caps:- scalar getters for
is_apu, ips/dmcub support, max links/streams/ planes/slave planes/cursor size/v_total,vtotal_limited_by_fp2, i2c speed, PCON/DSC/fused-io support, SubVP processing delay and MALL size
- dc_dmub_supports_psr()/dc_dmub_supports_aux_backlight() for the DMUB capability bits
-dc_get_color_caps()copies out the color pipeline capabilities
-dc_get_plane_caps()returns the static plane capability arrayThe KUnit tests keep installing fake capabilities through the
dc_test_caps()view of their own fake DC.No production code outside the dc directory reads struct dc members through a caps view anymore.
Part of making the struct dc sub-structures opaque outside DC.
Signed-off-by Dave Airlie <[email protected]>---
<snip>
Quoted 35 lines
unsigned int
dc_get_disable_ips(const struct dc *dc)drivers/gpu/drm/amd/display/dc/inc/dc.h +23
-2@@ -2351,8 +2351,38 @@ struct dc_context *dc_get_ctx(const struct dc *dc);/* The ASIC display engine version. */ enum dce_version dc_get_dce_version (const struct dc *dc); -/* Capabilities detected at dc_create() time. Read-only. */ -const struct dc_caps *dc_get_caps (const struct dc *dc); +/* +* Capabilities detected at dc_create() time. Read-only; prefer the +* purpose-built queries below over reaching into the caps structure. +*/ +bool dc_is_apu (const struct dc *dc); +bool dc_get_ips_support (const struct dc *dc); +bool dc_get_dmcub_support (const struct dc *dc); +unsigned int dc_get_max_links (const struct dc *dc); +unsigned int dc_get_max_streams (const struct dc *dc); +unsigned int dc_get_max_planes (const struct dc *dc); +unsigned int dc_get_max_slave_planes (const struct dc *dc); +unsigned int dc_get_max_cursor_size (const struct dc *dc); +unsigned int dc_get_max_v_total (const struct dc *dc); +bool dc_get_vtotal_limited_by_fp2 (const struct dc *dc); +unsigned int dc_get_i2c_speed_in_khz (const struct dc *dc); +bool dc_get_dp_hdmi21_pcon_support (const struct dc *dc); +bool dc_get_edp_dsc_support (const struct dc *dc); +bool dc_get_fused_io_support (const struct dc *dc); +unsigned int dc_get_subvp_fw_processing_delay_us (const struct dc *dc); +unsigned int dc_get_mall_size_total (const struct dc *dc); +bool dc_dmub_supports_psr (const struct dc *dc); +bool dc_dmub_supports_aux_backlight (const struct dc *dc); +
drivers/gpu/drm/amd/display/dc/inc/dc.h struct dc_context *dc_get_ctx(const struct dc *dc); · line 2386
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/inc/dc.h +9
-0+/* Copy out the color pipeline capabilities. */ +void dc_get_color_caps (const struct dc *dc,struct dc_color_caps *caps); + +/* +* Return the static plane capability array and its entry count. +* Valid until the DC is destroyed. +*/ +const struct dc_plane_cap *dc_get_plane_caps (const struct dc *dc, +unsigned int *count);
This creates some API bloat.
What about creating a new public struct header and throwing dc_caps (or a subset of it) in there?
The intent to decouple how DC stores and reports caps is valid.
Harry
Re: [PATCH 19/19] drm/amd/display: Replace dc_get_caps with purpose-built capability queries
Quoted 77 lines · Harry Wentland
Quoted 24 lines · On 11/11/26 20:43, Dave Airlie via B4 Relay wrote:
From: Dave Airlie <[email protected]>
Split the caps view accessor into per-capability queries so DM and the DAL modules no longer read through struct
dc_caps:- scalar getters for
is_apu, ips/dmcub support, max links/streams/ planes/slave planes/cursor size/v_total,vtotal_limited_by_fp2, i2c speed, PCON/DSC/fused-io support, SubVP processing delay and MALL size
- dc_dmub_supports_psr()/dc_dmub_supports_aux_backlight() for the DMUB capability bits
-dc_get_color_caps()copies out the color pipeline capabilities
-dc_get_plane_caps()returns the static plane capability arrayThe KUnit tests keep installing fake capabilities through the
dc_test_caps()view of their own fake DC.No production code outside the dc directory reads struct dc members through a caps view anymore.
Part of making the struct dc sub-structures opaque outside DC.
Signed-off-by Dave Airlie <[email protected]>---
<snip>
Quoted 35 lines
unsigned int
dc_get_disable_ips(const struct dc *dc)drivers/gpu/drm/amd/display/dc/inc/dc.h +23
-2@@ -2351,8 +2351,38 @@ struct dc_context *dc_get_ctx(const struct dc *dc);/* The ASIC display engine version. */ enum dce_version dc_get_dce_version (const struct dc *dc); -/* Capabilities detected at dc_create() time. Read-only. */ -const struct dc_caps *dc_get_caps (const struct dc *dc); +/* +* Capabilities detected at dc_create() time. Read-only; prefer the +* purpose-built queries below over reaching into the caps structure. +*/ +bool dc_is_apu (const struct dc *dc); +bool dc_get_ips_support (const struct dc *dc); +bool dc_get_dmcub_support (const struct dc *dc); +unsigned int dc_get_max_links (const struct dc *dc); +unsigned int dc_get_max_streams (const struct dc *dc); +unsigned int dc_get_max_planes (const struct dc *dc); +unsigned int dc_get_max_slave_planes (const struct dc *dc); +unsigned int dc_get_max_cursor_size (const struct dc *dc); +unsigned int dc_get_max_v_total (const struct dc *dc); +bool dc_get_vtotal_limited_by_fp2 (const struct dc *dc); +unsigned int dc_get_i2c_speed_in_khz (const struct dc *dc); +bool dc_get_dp_hdmi21_pcon_support (const struct dc *dc); +bool dc_get_edp_dsc_support (const struct dc *dc); +bool dc_get_fused_io_support (const struct dc *dc); +unsigned int dc_get_subvp_fw_processing_delay_us (const struct dc *dc); +unsigned int dc_get_mall_size_total (const struct dc *dc); +bool dc_dmub_supports_psr (const struct dc *dc); +bool dc_dmub_supports_aux_backlight (const struct dc *dc); +drivers/gpu/drm/amd/display/dc/inc/dc.h struct dc_context *dc_get_ctx(const struct dc *dc); · line 2386
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/inc/dc.h +9
-0+/* Copy out the color pipeline capabilities. */ +void dc_get_color_caps (const struct dc *dc,struct dc_color_caps *caps); + +/* +* Return the static plane capability array and its entry count. +* Valid until the DC is destroyed. +*/ +const struct dc_plane_cap *dc_get_plane_caps (const struct dc *dc, +unsigned int *count);This creates some API bloat.
Quoted 4 lines
What about creating a new public struct header and throwing
dc_caps(or a subset of it) in there?The intent to decouple how DC stores and reports caps is valid.
Yes I think it's probably a good idea, the last couple of patches were definitely pushing the limits of where I wanted to go, dc_caps is at least a reasonably self contained if not a bit haphazard.
Dave.