DC Patches 09 Aug, 2019
cover DC Patches 09 Aug, 2019
From: Leo Li <[email protected]>
Summary of change:
* Fix potential black-screen after mode change on DCN20
* Fix igt@kms_vrr for DCN20
* Link training optimizations
* Fix NV12 SOC bounding box loading from firmware
Anthony Koo (3):
drm/amd/display: fix issue where 252-255 values are clipped drm/amd/display: 3.2.45
drm/amd/display: 3.2.46
Aric Cyr (2):
drm/amd/display: 3.2.43
drm/amd/display: 3.2.44
Bayan Zabihiyan (1):
drm/amd/display: Fix frames_to_insert math
Charlene Liu (2):
drm/amd/display: wake up ogam mem pwr before programming ocsc drm/amd/display: enable dcn_mem_pwr as golden setting updates
David Galiffi (1):
drm/amd/display: Synchronous DisplayPort Link Training
Dmytro Laktyushkin (3):
drm/amd/display: make firmware info only load once during dc_bios
create
drm/amd/display: update optc odm interface for more than 2 opps drm/amd/display: fix dcn20 global sync dml param extraction
Eric Yang (1):
drm/amd/display: Enable type C hotplug
Ilya Bakoulin (3):
drm/amd/display: Update DML parameters drm/amd/display: HUBP/HUBBUB register programming fixes drm/amd/display: Fix type of ODMCombineType field
Jaehyun Chung (1):
drm/amd/display: Add work-around option to skip DCN20 clock updates
Julian Parkin (3):
drm/amd/display: Improve sharing of HUBBUB register lists drm/amd/display: Remove duplicate interface for programming FB drm/amd/display: Remove redundant definition of dwb_source enums
Jun Lei (4):
drm/amd/display: fixup DPP programming sequence drm/amd/display: wait for pending complete when enabling a plane drm/amd/display: clean up DML for DCN2x drm/amd/display: fix pipe selection logic in validate
Leo Li (1):
drm/amd/display: Load NV12 SOC BB from firmware
Lewis Huang (1):
drm/amd/display: reprogram VM config when system resume
Martin Leung (3):
drm/amd/display: Make init_hw and init_pipes generic for seamless boot drm/amd/display: fix dcn-specific clk_mgr init_clocks drm/amd/display: enabling seamless boot sequence for dcn2
Michael Strauss (1):
drm/amd/display: Enable MPO with pre-blend color processing (RGB)
Nicholas Kazlauskas (1):
drm/amd/display: Register VUPDATE_NO_LOCK interrupts for DCN2
Nikola Cornij (5):
drm/amd/display: Change DSC policy from slices per column to minimum
slice height
drm/amd/display: Set DSC before DIG front-end is connected to its
back-end
drm/amd/display: Remove 4:2:2 DSC support drm/amd/display: Correct DSC PPS log
drm/amd/display: Add and refine DSC logs in enable sequence
Qingqing Zhuo (1):
drm/amd/display: Add enum for H-timing divider mode
Su Sung Chung (1):
drm/amd/display: refactor gpio to allocate hw_container in constructor
Vitaly Prosyak (3):
drm/amd/display: Add 22, 24, and 26 degamma drm/amd/display: Add HLG support in color module drm/amd/display: Check if set_blank_data_double_buffer exists before
call
Wenjing Liu (3):
drm/amd/display: reset drr programming on pipe reset drm/amd/display: reset hdmi tmds rate and data scramble on pipe reset drm/amd/display: check hpd before retry verify link cap
Wyatt Wood (2):
drm/amd/display: Add Logging for Gamma Related information (1/2) drm/amd/display: Add Logging for Gamma Related information (2/2)
Yongqiang Sun (2):
drm/amd/display: Add PIXEL_RATE control regs for more instances drm/amd/display: Add DFS reference clock field
yanyan kang (1):
drm/amd/display: audio cannot switch to internal when display turns
off
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 + .../gpu/drm/amd/display/dc/bios/bios_parser.c | 3 +- .../drm/amd/display/dc/bios/bios_parser2.c | 3 +- .../display/dc/clk_mgr/dce100/dce_clk_mgr.c | 17 +- .../display/dc/clk_mgr/dcn10/rv1_clk_mgr.c | 12 +- .../display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c | 136 +++-- drivers/gpu/drm/amd/display/dc/core/dc.c | 39 +- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 172 ++++--- .../gpu/drm/amd/display/dc/core/dc_link_dp.c | 320 ++++++++++-- .../drm/amd/display/dc/core/dc_link_hwss.c | 151 +++--- .../gpu/drm/amd/display/dc/core/dc_resource.c | 46 +- drivers/gpu/drm/amd/display/dc/dc.h | 11 +- .../gpu/drm/amd/display/dc/dc_bios_types.h | 5 +- drivers/gpu/drm/amd/display/dc/dc_dp_types.h | 3 + drivers/gpu/drm/amd/display/dc/dc_link.h | 10 + .../drm/amd/display/dc/dce/dce_clock_source.c | 35 +- .../gpu/drm/amd/display/dc/dce/dce_hwseq.h | 25 +- .../gpu/drm/amd/display/dc/dce/dce_i2c_hw.c | 13 +- .../amd/display/dc/dce/dce_stream_encoder.c | 31 ++ .../amd/display/dc/dce100/dce100_resource.c | 4 +- .../display/dc/dce110/dce110_hw_sequencer.c | 17 +- .../display/dc/dce110/dce110_hw_sequencer.h | 6 +- .../amd/display/dc/dce110/dce110_resource.c | 4 +- .../drm/amd/display/dc/dce80/dce80_resource.c | 12 +- .../amd/display/dc/dcn10/dcn10_cm_common.c | 7 +- .../drm/amd/display/dc/dcn10/dcn10_hubbub.c | 4 +- .../drm/amd/display/dc/dcn10/dcn10_hubbub.h | 2 +- .../gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c | 2 +- .../gpu/drm/amd/display/dc/dcn10/dcn10_hubp.h | 26 +- .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 299 ++++++++--- .../amd/display/dc/dcn10/dcn10_link_encoder.c | 49 +- .../amd/display/dc/dcn10/dcn10_link_encoder.h | 1 + .../gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c | 19 + .../gpu/drm/amd/display/dc/dcn10/dcn10_mpc.h | 4 + .../gpu/drm/amd/display/dc/dcn10/dcn10_optc.c | 10 +- .../gpu/drm/amd/display/dc/dcn10/dcn10_optc.h | 6 +- .../drm/amd/display/dc/dcn10/dcn10_resource.c | 8 + .../display/dc/dcn10/dcn10_stream_encoder.c | 26 + .../display/dc/dcn10/dcn10_stream_encoder.h | 6 + .../gpu/drm/amd/display/dc/dcn20/dcn20_dccg.c | 31 +- .../gpu/drm/amd/display/dc/dcn20/dcn20_dccg.h | 2 +- .../gpu/drm/amd/display/dc/dcn20/dcn20_dpp.c | 16 + .../gpu/drm/amd/display/dc/dcn20/dcn20_dpp.h | 19 +- .../gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c | 118 +++-- .../drm/amd/display/dc/dcn20/dcn20_hubbub.c | 83 +-- .../drm/amd/display/dc/dcn20/dcn20_hubbub.h | 9 +- .../gpu/drm/amd/display/dc/dcn20/dcn20_hubp.c | 78 +-- .../gpu/drm/amd/display/dc/dcn20/dcn20_hubp.h | 18 +- .../drm/amd/display/dc/dcn20/dcn20_hwseq.c | 437 +++++++--------- .../gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c | 6 +- .../gpu/drm/amd/display/dc/dcn20/dcn20_mpc.h | 6 +- .../gpu/drm/amd/display/dc/dcn20/dcn20_optc.c | 23 +- .../gpu/drm/amd/display/dc/dcn20/dcn20_optc.h | 4 +- .../drm/amd/display/dc/dcn20/dcn20_resource.c | 476 +++++++++++------- .../display/dc/dcn20/dcn20_stream_encoder.c | 27 +- .../amd/display/dc/dml/display_mode_enums.h | 22 +- .../amd/display/dc/dml/display_mode_structs.h | 3 + .../drm/amd/display/dc/dml/display_mode_vba.c | 9 + .../drm/amd/display/dc/dml/display_mode_vba.h | 18 + drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c | 71 ++- .../dc/gpio/dce110/hw_factory_dce110.c | 18 +- .../dc/gpio/dce120/hw_factory_dce120.c | 14 +- .../display/dc/gpio/dce80/hw_factory_dce80.c | 14 +- .../display/dc/gpio/dcn10/hw_factory_dcn10.c | 12 +- .../display/dc/gpio/dcn20/hw_factory_dcn20.c | 12 +- .../dc/gpio/diagnostics/hw_factory_diag.c | 9 +- .../gpu/drm/amd/display/dc/gpio/gpio_base.c | 74 ++- .../drm/amd/display/dc/gpio/gpio_service.c | 51 +- .../drm/amd/display/dc/gpio/gpio_service.h | 6 +- drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c | 26 +- drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.h | 5 +- .../gpu/drm/amd/display/dc/gpio/hw_factory.h | 48 +- .../gpu/drm/amd/display/dc/gpio/hw_generic.c | 32 +- .../gpu/drm/amd/display/dc/gpio/hw_generic.h | 6 +- drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c | 31 +- drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.h | 5 +- .../gpu/drm/amd/display/dc/inc/core_types.h | 2 - .../gpu/drm/amd/display/dc/inc/dc_link_dp.h | 11 +- .../amd/display/dc/inc/hw/clk_mgr_internal.h | 12 +- drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h | 3 +- .../gpu/drm/amd/display/dc/inc/hw/dchubbub.h | 4 + drivers/gpu/drm/amd/display/dc/inc/hw/dsc.h | 4 +- drivers/gpu/drm/amd/display/dc/inc/hw/dwb.h | 12 - drivers/gpu/drm/amd/display/dc/inc/hw/gpio.h | 10 + drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h | 11 +- .../drm/amd/display/dc/inc/hw/link_encoder.h | 1 + drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h | 7 + .../amd/display/dc/inc/hw/stream_encoder.h | 18 +- .../amd/display/dc/inc/hw/timing_generator.h | 11 +- .../gpu/drm/amd/display/dc/inc/hw_sequencer.h | 32 ++ .../gpu/drm/amd/display/dc/inc/link_hwss.h | 2 - .../display/dc/irq/dcn20/irq_service_dcn20.c | 28 +- .../dc/virtual/virtual_stream_encoder.c | 5 + .../drm/amd/display/include/gpio_interface.h | 9 + .../amd/display/include/logger_interface.h | 2 + .../drm/amd/display/include/logger_types.h | 7 + .../amd/display/modules/color/color_gamma.c | 224 ++++++--- .../amd/display/modules/color/color_gamma.h | 1 + .../amd/display/modules/freesync/freesync.c | 27 +- 99 files changed, 2418 insertions(+), 1411 deletions(-)
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/49 drm/amd/display: Add PIXEL_RATE control regs for more instances
From: Yongqiang Sun <[email protected]>
For use by future ASICs
--- .../gpu/drm/amd/display/dc/dce/dce_hwseq.h | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_hwseq.h +20 -5
@@ -62,6 +62,10 @@SRII (BLND_CONTROL ,BLND ,4 ), \ SRII(BLND_CONTROL, BLND, 5) +#define HSWEQ_DCN_PIXEL_RATE_REG_LIST (blk, inst) \ + SRII(PIXEL_RATE_CNTL, blk, inst), \ + SRII(PHYPLL_PIXEL_RATE_CNTL, blk, inst) +#define HWSEQ_PIXEL_RATE_REG_LIST (blk) \ SRII(PIXEL_RATE_CNTL, blk, 0), \ SRII(PIXEL_RATE_CNTL, blk, 1), \
@@ -151,7 +155,10 @@SR (DCCG_GATE_DISABLE_CNTL2 ), \SR (DCFCLK_CNTL ),\SR (DCFCLK_CNTL ), \ -SR (DC_MEM_GLOBAL_PWR_REQ_CNTL ), \ + SR(DC_MEM_GLOBAL_PWR_REQ_CNTL) + + +#define MMHUB_DCN_REG_LIST ()\/* todo: get these from GVM instead of reading registers ourselves */ \ MMHUB_SR(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_HI32),\ MMHUB_SR(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32),\
@@ -166,10 +173,14 @@MMHUB_SR (MC_VM_SYSTEM_APERTURE_LOW_ADDR ),\ MMHUB_SR(MC_VM_SYSTEM_APERTURE_HIGH_ADDR) +#define HWSEQ_DCN1_REG_LIST ()\ HWSEQ_DCN_REG_LIST(), \ - HWSEQ_PIXEL_RATE_REG_LIST(OTG), \ - HWSEQ_PHYPLL_REG_LIST(OTG), \ + MMHUB_DCN_REG_LIST(), \ + HSWEQ_DCN_PIXEL_RATE_REG_LIST(OTG, 0), \ + HSWEQ_DCN_PIXEL_RATE_REG_LIST(OTG, 1), \ + HSWEQ_DCN_PIXEL_RATE_REG_LIST(OTG, 2), \ + HSWEQ_DCN_PIXEL_RATE_REG_LIST(OTG, 3), \ SR(DCHUBBUB_SDPIF_FB_BASE),\ SR(DCHUBBUB_SDPIF_FB_OFFSET),\ SR(DCHUBBUB_SDPIF_AGP_BASE),\
@@ -202,8 +213,12 @@#if defined(CONFIG_DRM_AMD_DC_DCN2_0 )#define HWSEQ_DCN2_REG_LIST ()\ HWSEQ_DCN_REG_LIST(), \ - HWSEQ_PIXEL_RATE_REG_LIST(OTG), \ - HWSEQ_PHYPLL_REG_LIST(OTG), \ + HSWEQ_DCN_PIXEL_RATE_REG_LIST(OTG, 0), \ + HSWEQ_DCN_PIXEL_RATE_REG_LIST(OTG, 1), \ + HSWEQ_DCN_PIXEL_RATE_REG_LIST(OTG, 2), \ + HSWEQ_DCN_PIXEL_RATE_REG_LIST(OTG, 3), \ + HSWEQ_DCN_PIXEL_RATE_REG_LIST(OTG, 4), \ + HSWEQ_DCN_PIXEL_RATE_REG_LIST(OTG, 5), \ SR(MICROSECOND_TIME_BASE_DIV), \ SR(MILLISECOND_TIME_BASE_DIV), \ SR(DISPCLK_FREQ_CHANGE_CNTL), \
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/49 drm/amd/display: Add DFS reference clock field
In reply to a message not in the archiveFrom: Yongqiang Sun <[email protected]>
Add to clk_mgr_internal struct, for future use.
--- drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr_internal.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr_internal.h +2 -0
@@ -216,6 +216,8 @@ struct clk_mgr_internal {bool dfs_bypass_enabled;/* True if the DFS-bypass feature is enabled and active. */ bool dfs_bypass_active; + +uint32_t dfs_ref_freq_khz;/* * Cache the display clock returned by VBIOS if DFS-bypass is enabled. * This is basically "Crystal Frequency In KHz" (XTALIN) frequency
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/49 drm/amd/display: reset drr programming on pipe reset
In reply to a message not in the archiveFrom: Wenjing Liu <[email protected]>
[why]
drr is still enabled after driver is unloaded causing black screen
[how]
disable drr during pipe reset.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 3 +++ drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 4 ++++ 2 files changed, 7 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +3 -0
@@ -822,6 +822,9 @@ static void dcn10_reset_back_end_for_pipe( pipe_ctx->stream_res.tg->funcs->disable_crtc (pipe_ctx->stream_res.tg); pipe_ctx->stream_res.tg->funcs->enable_optc_clock (pipe_ctx->stream_res.tg, false); +if (pipe_ctx->stream_res.tg->funcs->set_drr) + pipe_ctx->stream_res.tg->funcs->set_drr ( + pipe_ctx->stream_res.tg,NULL ); }for (i =0 ; i < dc->res_pool->pipe_count; i++)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +4 -0
@@ -1834,6 +1834,10 @@ static void dcn20_reset_back_end_for_pipe(if (pipe_ctx->stream_res.tg->funcs->set_odm_bypass) pipe_ctx->stream_res.tg->funcs->set_odm_bypass ( pipe_ctx->stream_res.tg, &pipe_ctx->stream->timing); + +if (pipe_ctx->stream_res.tg->funcs->set_drr) + pipe_ctx->stream_res.tg->funcs->set_drr ( + pipe_ctx->stream_res.tg,NULL ); }for (i =0 ; i < dc->res_pool->pipe_count; i++)
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/49 drm/amd/display: reset hdmi tmds rate and data scramble on pipe reset
In reply to a message not in the archiveFrom: Wenjing Liu <[email protected]>
[why]
hdmi data scramble and tmds rate is not reset during pipe reset.
[how]
reset hdmi tmds rate and data scramble on pipe reset
--- .../amd/display/dc/dce/dce_stream_encoder.c | 19 +++++++++++++++++++ .../display/dc/dce110/dce110_hw_sequencer.c | 5 ++++- .../display/dc/dcn10/dcn10_stream_encoder.c | 14 ++++++++++++++ .../display/dc/dcn10/dcn10_stream_encoder.h | 3 +++ .../display/dc/dcn20/dcn20_stream_encoder.c | 1 + .../amd/display/dc/inc/hw/stream_encoder.h | 3 +++ .../dc/virtual/virtual_stream_encoder.c | 5 +++++ 7 files changed, 49 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c +19 -0
@@ -1036,6 +1036,24 @@ static void dce110_stream_encoder_set_avmute( } +static void dce110_reset_hdmi_stream_attribute ( +struct stream_encoder *enc) +{ +struct dce110_stream_encoder *enc110 =DCE110STRENC_FROM_STRENC (enc); +if (enc110->se_mask->HDMI_DATA_SCRAMBLE_EN) +REG_UPDATE_5 (HDMI_CONTROL , +HDMI_PACKET_GEN_VERSION ,1 , +HDMI_KEEPOUT_MODE ,1 , +HDMI_DEEP_COLOR_ENABLE ,0 , +HDMI_DATA_SCRAMBLE_EN ,0 , +HDMI_CLOCK_CHANNEL_RATE ,0 ); +else +REG_UPDATE_3 (HDMI_CONTROL , +HDMI_PACKET_GEN_VERSION ,1 , +HDMI_KEEPOUT_MODE ,1 , +HDMI_DEEP_COLOR_ENABLE ,0 ); +} +#define DP_SEC_AUD_N__DP_SEC_AUD_N__DEFAULT 0x8000#define DP_SEC_TIMESTAMP__DP_SEC_TIMESTAMP_MODE__AUTO_CALC 1
@@ -1616,6 +1634,7 @@ static const struct stream_encoder_funcs dce110_str_enc_funcs = { .setup_stereo_sync = setup_stereo_sync, .set_avmute = dce110_stream_encoder_set_avmute, .dig_connect_to_otg = dig_connect_to_otg, + .hdmi_reset_stream_attribute = dce110_reset_hdmi_stream_attribute, }; void dce110_stream_encoder_construct(
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +4 -1
@@ -1037,9 +1037,12 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx, int option)struct dc_link *link = stream->link;struct dc *dc = pipe_ctx->stream->ctx->dc; -if (dc_is_hdmi_tmds_signal (pipe_ctx->stream->signal)) +if (dc_is_hdmi_tmds_signal (pipe_ctx->stream->signal)) { pipe_ctx->stream_res.stream_enc->funcs->stop_hdmi_info_packets ( pipe_ctx->stream_res.stream_enc); + pipe_ctx->stream_res.stream_enc->funcs->hdmi_reset_stream_attribute ( + pipe_ctx->stream_res.stream_enc); + }if (dc_is_dp_signal (pipe_ctx->stream->signal)) pipe_ctx->stream_res.stream_enc->funcs->stop_dp_info_packets(
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c +14 -0
@@ -1003,6 +1003,19 @@ void enc1_stream_encoder_set_avmute(REG_UPDATE (HDMI_GC ,HDMI_GC_AVMUTE , value); } +void enc1_reset_hdmi_stream_attribute ( +struct stream_encoder *enc) +{ +struct dcn10_stream_encoder *enc1 =DCN10STRENC_FROM_STRENC (enc); + +REG_UPDATE_5 (HDMI_CONTROL , +HDMI_PACKET_GEN_VERSION ,1 , +HDMI_KEEPOUT_MODE ,1 , +HDMI_DEEP_COLOR_ENABLE ,0 , +HDMI_DATA_SCRAMBLE_EN ,0 , +HDMI_CLOCK_CHANNEL_RATE ,0 ); +} +#define DP_SEC_AUD_N__DP_SEC_AUD_N__DEFAULT 0x8000#define DP_SEC_TIMESTAMP__DP_SEC_TIMESTAMP_MODE__AUTO_CALC 1
@@ -1562,6 +1575,7 @@ static const struct stream_encoder_funcs dcn10_str_enc_funcs = { .setup_stereo_sync = enc1_setup_stereo_sync, .set_avmute = enc1_stream_encoder_set_avmute, .dig_connect_to_otg = enc1_dig_connect_to_otg, + .hdmi_reset_stream_attribute = enc1_reset_hdmi_stream_attribute, }; void dcn10_stream_encoder_construct(
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.h +3 -0
@@ -615,4 +615,7 @@ void get_audio_clock_info(uint32_t actual_pixel_clock_100Hz, struct audio_clock_info *audio_clock_info); +void enc1_reset_hdmi_stream_attribute ( +struct stream_encoder *enc); +#endif /* __DC_STREAM_ENCODER_DCN10_H__ */
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_stream_encoder.c +1 -0
@@ -586,6 +586,7 @@ static const struct stream_encoder_funcs dcn20_str_enc_funcs = { .dp_set_dsc_config = enc2_dp_set_dsc_config, #endif .set_dynamic_metadata = enc2_set_dynamic_metadata, + .hdmi_reset_stream_attribute = enc1_reset_hdmi_stream_attribute, }; void dcn20_stream_encoder_construct(
drivers/gpu/drm/amd/display/dc/inc/hw/stream_encoder.h +3 -0
@@ -211,6 +211,9 @@ struct stream_encoder_funcs {struct stream_encoder *enc, int tg_inst); +void (*hdmi_reset_stream_attribute)( +struct stream_encoder *enc); +#if defined(CONFIG_DRM_AMD_DC_DCN2_0 )#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT void (*dp_set_dsc_config)(
drivers/gpu/drm/amd/display/dc/virtual/virtual_stream_encoder.c +5 -0
@@ -75,6 +75,10 @@ static void virtual_audio_mute_control( struct stream_encoder *enc, bool mute) {} +static void virtual_stream_encoder_reset_hdmi_stream_attribute ( +struct stream_encoder *enc) +{} +#ifdef CONFIG_DRM_AMD_DC_DCN2_0 #ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT static void virtual_enc_dp_set_odm_combine(
@@ -114,6 +118,7 @@ static const struct stream_encoder_funcs virtual_str_enc_funcs = { .audio_mute_control = virtual_audio_mute_control, .set_avmute = virtual_stream_encoder_set_avmute, + .hdmi_reset_stream_attribute = virtual_stream_encoder_reset_hdmi_stream_attribute, }; bool virtual_stream_encoder_construct(
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/49 drm/amd/display: fix issue where 252-255 values are clipped
In reply to a message not in the archiveFrom: Anthony Koo <[email protected]>
[Why]
When endpoint is at the boundary of a region, such as at 2^0=1 we find that the last segment has a sharp slope and some points are clipped at the top.
[How]
If end point is 1, which is exactly at the 2^0 region boundary, we need to program an additional region beyond this point.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c +2 -1
@@ -357,9 +357,10 @@ bool cm_helper_translate_curve_to_hw_format( seg_distr[7 ] =4 ; seg_distr[8 ] =4 ; seg_distr[9 ] =4 ; + seg_distr[10 ] =1 ; region_start =-10 ; - region_end =0 ; + region_end =1 ; }for (i = region_end - region_start; i <MAX_REGIONS_NUMBER ; i++)
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/49 drm/amd/display: Fix frames_to_insert math
In reply to a message not in the archiveFrom: Bayan Zabihiyan <[email protected]>
[Why]
The math on deciding on how many
"frames to insert" sometimes sent us over the max refresh rate. Also integer overflow can occur if we have high refresh rates.
[How]
Instead of clipping the frame duration such that it doesn’t go below the min, just remove a frame from the number of frames to insert. +
Use unsigned long long for intermediate calculations to prevent integer overflow.
--- .../amd/display/modules/freesync/freesync.c | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/modules/freesync/freesync.c +17 -10
@@ -433,6 +433,12 @@ static void apply_below_the_range(struct core_freesync *core_freesync,/* Either we've calculated the number of frames to insert, * or we need to insert min duration frames */ +if (last_render_time_in_us / frames_to_insert < + in_out_vrr->min_duration_in_us){ + frames_to_insert -= (frames_to_insert >1 ) ? +1 :0 ; + } +if (frames_to_insert >0 ) inserted_frame_duration_in_us = last_render_time_in_us / frames_to_insert;
@@ -885,8 +891,8 @@ void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync,struct core_freesync *core_freesync =NULL ;unsigned long long nominal_field_rate_in_uhz =0 ;unsigned int refresh_range =0 ; -unsigned int min_refresh_in_uhz =0 ; -unsigned int max_refresh_in_uhz =0 ; +unsigned long long min_refresh_in_uhz =0 ; +unsigned long long max_refresh_in_uhz =0 ;if (mod_freesync ==NULL )return ;
@@ -913,7 +919,7 @@ void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync, min_refresh_in_uhz = nominal_field_rate_in_uhz;if (!vrr_settings_require_update (core_freesync, - in_config, min_refresh_in_uhz, max_refresh_in_uhz, + in_config, (unsigned int )min_refresh_in_uhz, (unsigned int )max_refresh_in_uhz, in_out_vrr))return ;
@@ -929,15 +935,15 @@ void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync,return ; }else { - in_out_vrr->min_refresh_in_uhz = min_refresh_in_uhz; + in_out_vrr->min_refresh_in_uhz = (unsigned int )min_refresh_in_uhz; in_out_vrr->max_duration_in_us =calc_duration_in_us_from_refresh_in_uhz ( - min_refresh_in_uhz); + (unsigned int )min_refresh_in_uhz); - in_out_vrr->max_refresh_in_uhz = max_refresh_in_uhz; + in_out_vrr->max_refresh_in_uhz = (unsigned int )max_refresh_in_uhz; in_out_vrr->min_duration_in_us =calc_duration_in_us_from_refresh_in_uhz ( - max_refresh_in_uhz); + (unsigned int )max_refresh_in_uhz); refresh_range = in_out_vrr->max_refresh_in_uhz - in_out_vrr->min_refresh_in_uhz;
@@ -948,17 +954,18 @@ void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync, in_out_vrr->fixed.ramping_active = in_config->ramping; in_out_vrr->btr.btr_enabled = in_config->btr; +if (in_out_vrr->max_refresh_in_uhz <2 * in_out_vrr->min_refresh_in_uhz) in_out_vrr->btr.btr_enabled = false; + in_out_vrr->btr.btr_active = false; in_out_vrr->btr.inserted_duration_in_us =0 ; in_out_vrr->btr.frames_to_insert =0 ; in_out_vrr->btr.frame_counter =0 ; in_out_vrr->btr.mid_point_in_us = - in_out_vrr->min_duration_in_us + - (in_out_vrr->max_duration_in_us - - in_out_vrr->min_duration_in_us) /2 ; + (in_out_vrr->min_duration_in_us + + in_out_vrr->max_duration_in_us) /2 ;if (in_out_vrr->state ==VRR_STATE_UNSUPPORTED ) { in_out_vrr->adjust.v_total_min = stream->timing.v_total;
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/49 drm/amd/display: Add 22, 24, and 26 degamma
In reply to a message not in the archiveFrom: Vitaly Prosyak <[email protected]>
[Why & How]
Support degamma ROM and RAM based on hardware capabilities. Some refactoring into color module
--- drivers/gpu/drm/amd/display/dc/dc.h | 5 +- .../amd/display/modules/color/color_gamma.c | 116 +++++++++++------- 2 files changed, 75 insertions(+), 46 deletions(-)
drivers/gpu/drm/amd/display/dc/dc.h +4 -1
@@ -614,9 +614,12 @@ enum dc_transfer_func_predefined {TRANSFER_FUNCTION_UNITY ,TRANSFER_FUNCTION_HLG ,TRANSFER_FUNCTION_HLG12 , -TRANSFER_FUNCTION_GAMMA22 +TRANSFER_FUNCTION_GAMMA22 , +TRANSFER_FUNCTION_GAMMA24 , +TRANSFER_FUNCTION_GAMMA26 }; +struct dc_transfer_func {struct kref refcount;enum dc_transfer_func_type type;
drivers/gpu/drm/amd/display/modules/color/color_gamma.c +71 -45
252 lines not on this page · raw message
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/49 drm/amd/display: Improve sharing of HUBBUB register lists
In reply to a message not in the archiveFrom: Julian Parkin <[email protected]>
Add DCN20 common register list that contains registers shared between DCN20 generations.
--- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubbub.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubbub.h +6 -3
@@ -32,10 +32,8 @@#define TO_DCN20_HUBBUB (hubbub)\ container_of(hubbub, struct dcn20_hubbub, base) -#define HUBBUB_REG_LIST_DCN20 (id)\ +#define HUBBUB_REG_LIST_DCN20_COMMON ()\ HUBBUB_REG_LIST_DCN_COMMON(), \ - HUBBUB_VM_REG_LIST(), \ - HUBBUB_SR_WATERMARK_REG_LIST(), \ SR(DCHUBBUB_CRC_CTRL), \ SR(DCN_VM_FB_LOCATION_BASE),\ SR(DCN_VM_FB_LOCATION_TOP),\
@@ -44,6 +42,11 @@SR (DCN_VM_AGP_TOP ),\ SR(DCN_VM_AGP_BASE) +#define HUBBUB_REG_LIST_DCN20 (id)\ + HUBBUB_REG_LIST_DCN20_COMMON(), \ + HUBBUB_SR_WATERMARK_REG_LIST(), \ + HUBBUB_VM_REG_LIST() +#define HUBBUB_MASK_SH_LIST_DCN20 (mask_sh)\ HUBBUB_MASK_SH_LIST_DCN_COMMON(mask_sh), \ HUBBUB_MASK_SH_LIST_STUTTER(mask_sh), \
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 9/49 drm/amd/display: Synchronous DisplayPort Link Training
In reply to a message not in the archiveFrom: David Galiffi <[email protected]>
[WHY]
We require a method to perform synchronous link training.
[HOW]
Sync LT is broken into 3 basic steps.
"Begin" starts the state machine, and resets "preferred" link settings. "Attempt" will attempt to train the link with a given set of training parameters.
"End" stops the state machine, and will optionally disable the link phy. Between "Begin" and "End" DPCD:600h must not be set to "2" (D3:Powered Down).
Between "Begin" and "End", there may be multiple "Attempts" with different training parameters.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 53 +--- .../gpu/drm/amd/display/dc/core/dc_link_dp.c | 293 ++++++++++++++++-- .../drm/amd/display/dc/core/dc_link_hwss.c | 43 +-- drivers/gpu/drm/amd/display/dc/dc_dp_types.h | 3 + drivers/gpu/drm/amd/display/dc/dc_link.h | 10 + .../gpu/drm/amd/display/dc/inc/dc_link_dp.h | 3 + .../gpu/drm/amd/display/dc/inc/link_hwss.h | 2 - 7 files changed, 282 insertions(+), 125 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1 -52
@@ -1385,57 +1385,6 @@ void link_destroy(struct dc_link **link) *link =NULL ; } -static void dpcd_configure_panel_mode ( -struct dc_link *link, -enum dp_panel_mode panel_mode) -{ -union dpcd_edp_config edp_config_set; -bool panel_mode_edp = false; -DC_LOGGER_INIT (link->ctx->logger); - -memset (&edp_config_set,'\0' ,sizeof (union dpcd_edp_config )); - -if (DP_PANEL_MODE_DEFAULT != panel_mode) { - -switch (panel_mode) { -case DP_PANEL_MODE_EDP : -case DP_PANEL_MODE_SPECIAL : - panel_mode_edp = true; -break ; - -default : -break ; - } - -/*set edp panel mode in receiver*/ -core_link_read_dpcd ( - link, -DP_EDP_CONFIGURATION_SET , - &edp_config_set.raw, -sizeof (edp_config_set.raw)); - -if (edp_config_set.bits.PANEL_MODE_EDP - != panel_mode_edp) { -enum ddc_result result =DDC_RESULT_UNKNOWN ; - - edp_config_set.bits.PANEL_MODE_EDP = - panel_mode_edp; - result =core_link_write_dpcd ( - link, -DP_EDP_CONFIGURATION_SET , - &edp_config_set.raw, -sizeof (edp_config_set.raw)); - -ASSERT (result ==DDC_RESULT_SUCESSFULL ); - } - } -DC_LOG_DETECTION_DP_CAPS ("Link: %d eDP panel mode supported: %d " -"eDP panel mode enabled: %d \n" , - link->link_index, - link->dpcd_caps.panel_mode_edp, - panel_mode_edp); -} -static void enable_stream_features (struct pipe_ctx *pipe_ctx) {struct dc_stream_state *stream = pipe_ctx->stream;
@@ -1506,7 +1455,7 @@ static enum dc_status enable_link_dp( } panel_mode =dp_get_panel_mode (link); -dpcd_configure_panel_mode (link, panel_mode); +dp_set_panel_mode (link, panel_mode); skip_video_pattern = true;
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +262 -31
370 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +3 -40
55 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dc_dp_types.h +3 -0
@@ -128,7 +128,10 @@ struct dc_link_training_overrides {enum dc_link_spread *downspread;bool *alternate_scrambler_reset;bool *enhanced_framing; +bool *mst_enable; +#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT bool *fec_enable; +#endif };union dpcd_rev {
drivers/gpu/drm/amd/display/dc/dc_link.h +10 -0
@@ -84,6 +84,7 @@ struct dc_link {bool dp_ss_off;bool link_state_valid;bool aux_access_disabled; +bool sync_lt_in_progress;/* caps is the same as reported_link_cap. link_traing use * reported_link_cap. Will clean up. TODO
@@ -228,6 +229,15 @@ enum link_training_result dc_link_dp_perform_link_training(const struct dc_link_settings *link_setting, bool skip_video_pattern); +bool dc_link_dp_sync_lt_begin (struct dc_link *link); + +enum link_training_result dc_link_dp_sync_lt_attempt ( +struct dc_link *link, +struct dc_link_settings *link_setting, +struct dc_link_training_overrides *lt_settings); + +bool dc_link_dp_sync_lt_end (struct dc_link *link,bool link_down); +void dc_link_dp_enable_hpd (const struct dc_link *link);void dc_link_dp_disable_hpd (const struct dc_link *link);
drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h +3 -0
@@ -62,6 +62,9 @@ bool is_dp_active_dongle(const struct dc_link *link);void dp_enable_mst_on_sink (struct dc_link *link,bool enable); +enum dp_panel_mode dp_get_panel_mode (struct dc_link *link); +void dp_set_panel_mode (struct dc_link *link,enum dp_panel_mode panel_mode); +#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT void dp_set_fec_ready (struct dc_link *link,bool ready);void dp_set_fec_enable (struct dc_link *link,bool enable);
drivers/gpu/drm/amd/display/dc/inc/link_hwss.h +0 -2
@@ -72,8 +72,6 @@ void dp_set_hw_test_pattern(uint8_t *custom_pattern, uint32_t custom_pattern_size); -enum dp_panel_mode dp_get_panel_mode (struct dc_link *link); -void dp_retrain_link_dp_test (struct dc_link *link,struct dc_link_settings *link_setting,bool skip_video_pattern);
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 10/49 drm/amd/display: make firmware info only load once during dc_bios create
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
Currently every time DC wants to access firmware info we make a call into VBIOS. This makes no sense as there is nothing that can change runtime inside fw info and can cause issues when calling unstable bios during bringup.
This change eliminate this behavior by only calling bios once for fw info and keeping it stored as part of dc_bios.
--- .../gpu/drm/amd/display/dc/bios/bios_parser.c | 3 +- .../drm/amd/display/dc/bios/bios_parser2.c | 3 +- .../display/dc/clk_mgr/dce100/dce_clk_mgr.c | 17 ++++------ .../display/dc/clk_mgr/dcn10/rv1_clk_mgr.c | 6 ++-- .../gpu/drm/amd/display/dc/core/dc_resource.c | 7 ++-- .../gpu/drm/amd/display/dc/dc_bios_types.h | 5 ++- .../drm/amd/display/dc/dce/dce_clock_source.c | 32 +++++++------------ .../gpu/drm/amd/display/dc/dce/dce_i2c_hw.c | 13 +------- .../amd/display/dc/dce100/dce100_resource.c | 4 +-- .../amd/display/dc/dce110/dce110_resource.c | 4 +-- .../drm/amd/display/dc/dce80/dce80_resource.c | 12 ++----- .../drm/amd/display/dc/dcn20/dcn20_hwseq.c | 9 +++--- 12 files changed, 36 insertions(+), 79 deletions(-)
drivers/gpu/drm/amd/display/dc/bios/bios_parser.c +1 -2
@@ -2794,8 +2794,6 @@ static const struct dc_vbios_funcs vbios_funcs = { .get_device_tag = bios_parser_get_device_tag, - .get_firmware_info = bios_parser_get_firmware_info, - .get_spread_spectrum_info = bios_parser_get_spread_spectrum_info, .get_ss_entry_number = bios_parser_get_ss_entry_number,
@@ -2920,6 +2918,7 @@ static bool bios_parser_construct(dal_bios_parser_init_cmd_tbl_helper (&bp->cmd_helper, dce_version); bp->base.integrated_info =bios_parser_create_integrated_info (&bp->base); + bp->base.fw_info_valid =bios_parser_get_firmware_info (&bp->base, &bp->base.fw_info) ==BP_RESULT_OK ;return true; }
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +1 -2
@@ -1879,8 +1879,6 @@ static const struct dc_vbios_funcs vbios_funcs = { .get_device_tag = bios_parser_get_device_tag, - .get_firmware_info = bios_parser_get_firmware_info, - .get_spread_spectrum_info = bios_parser_get_spread_spectrum_info, .get_ss_entry_number = bios_parser_get_ss_entry_number,
@@ -1996,6 +1994,7 @@ static bool bios_parser_construct(dal_bios_parser_init_cmd_tbl_helper2 (&bp->cmd_helper, dce_version); bp->base.integrated_info =bios_parser_create_integrated_info (&bp->base); + bp->base.fw_info_valid =bios_parser_get_firmware_info (&bp->base, &bp->base.fw_info) ==BP_RESULT_OK ;return true; }
drivers/gpu/drm/amd/display/dc/clk_mgr/dce100/dce_clk_mgr.c +6 -11
@@ -273,18 +273,12 @@ static void dce_clock_read_integrated_info(struct clk_mgr_internal *clk_mgr_dce) {struct dc_debug_options *debug = &clk_mgr_dce->base.ctx->dc->debug;struct dc_bios *bp = clk_mgr_dce->base.ctx->dc_bios; -struct integrated_info info = { { {0 } } }; -struct dc_firmware_info fw_info = { {0 } };int i;if (bp->integrated_info) - info = *bp->integrated_info; - - clk_mgr_dce->dentist_vco_freq_khz = info.dentist_vco_freq; + clk_mgr_dce->dentist_vco_freq_khz = bp->integrated_info->dentist_vco_freq;if (clk_mgr_dce->dentist_vco_freq_khz ==0 ) { - bp->funcs->get_firmware_info (bp, &fw_info); - clk_mgr_dce->dentist_vco_freq_khz = - fw_info.smu_gpu_pll_output_freq; + clk_mgr_dce->dentist_vco_freq_khz = bp->fw_info.smu_gpu_pll_output_freq;if (clk_mgr_dce->dentist_vco_freq_khz ==0 ) clk_mgr_dce->dentist_vco_freq_khz =3600000 ; }
@@ -317,9 +311,10 @@ static void dce_clock_read_integrated_info(struct clk_mgr_internal *clk_mgr_dce)/*Do not allow bad VBIOS/SBIOS to override with invalid values, * check for > 100MHz*/ -if (info.disp_clk_voltage[i].max_supported_clk >=100000 ) - clk_mgr_dce->max_clks_by_state[clk_state].display_clk_khz = - info.disp_clk_voltage[i].max_supported_clk; +if (bp->integrated_info) +if (bp->integrated_info->disp_clk_voltage[i].max_supported_clk >=100000 ) + clk_mgr_dce->max_clks_by_state[clk_state].display_clk_khz = + bp->integrated_info->disp_clk_voltage[i].max_supported_clk; }if (!debug->disable_dfs_bypass && bp->integrated_info)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn10/rv1_clk_mgr.c +2 -4
@@ -243,7 +243,6 @@ void rv1_clk_mgr_construct(struct dc_context *ctx, struct clk_mgr_internal *clk_ {struct dc_debug_options *debug = &ctx->dc->debug;struct dc_bios *bp = ctx->dc_bios; -struct dc_firmware_info fw_info = { {0 } }; clk_mgr->base.ctx = ctx; clk_mgr->pp_smu = pp_smu;
@@ -259,9 +258,8 @@ void rv1_clk_mgr_construct(struct dc_context *ctx, struct clk_mgr_internal *clk_if (bp->integrated_info) clk_mgr->dentist_vco_freq_khz = bp->integrated_info->dentist_vco_freq; -if (clk_mgr->dentist_vco_freq_khz ==0 ) { - bp->funcs->get_firmware_info (bp, &fw_info); - clk_mgr->dentist_vco_freq_khz = fw_info.smu_gpu_pll_output_freq; +if (bp->fw_info_valid && clk_mgr->dentist_vco_freq_khz ==0 ) { + clk_mgr->dentist_vco_freq_khz = bp->fw_info.smu_gpu_pll_output_freq;if (clk_mgr->dentist_vco_freq_khz ==0 ) clk_mgr->dentist_vco_freq_khz =3600000 ; }
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +2 -5
@@ -170,12 +170,9 @@ struct resource_pool *dc_create_resource_pool(struct dc *dc,break ; }if (res_pool !=NULL ) { -struct dc_firmware_info fw_info = { {0 } }; - -if (dc->ctx->dc_bios->funcs->get_firmware_info (dc->ctx->dc_bios, - &fw_info) ==BP_RESULT_OK ) { +if (dc->ctx->dc_bios->fw_info_valid) { res_pool->ref_clocks.xtalin_clock_inKhz = - fw_info.pll_info.crystal_frequency; + dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency;/* initialize with firmware data first, no all * ASIC have DCCG SW component. FPGA or * simulation need initialization of
drivers/gpu/drm/amd/display/dc/dc_bios_types.h +2 -3
@@ -61,9 +61,6 @@ struct dc_vbios_funcs {struct graphics_object_id connector_object_id, uint32_t device_tag_index, struct connector_device_tag_info *info); -enum bp_result (*get_firmware_info)( -struct dc_bios *bios, -struct dc_firmware_info *info); enum bp_result (*get_spread_spectrum_info)( struct dc_bios *bios, enum as_signal_type signal,
@@ -152,6 +149,8 @@ struct dc_bios {struct dc_context *ctx;const struct bios_registers *regs;struct integrated_info *integrated_info; +struct dc_firmware_info fw_info; + bool fw_info_valid; };#endif /* DC_BIOS_TYPES_H */
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c +12 -20
@@ -1232,37 +1232,35 @@ static bool calc_pll_max_vco_construct( struct calc_pll_clock_source_init_data *init_data) {uint32_t i; -struct dc_firmware_info fw_info = { {0 } }; +struct dc_firmware_info *fw_info = &init_data->bp->fw_info;if (calc_pll_cs ==NULL || init_data ==NULL || init_data->bp ==NULL )return false; -if (init_data->bp->funcs->get_firmware_info ( - init_data->bp, - &fw_info) !=BP_RESULT_OK ) +if (init_data->bp->fw_info_valid)return false; calc_pll_cs->ctx = init_data->ctx; - calc_pll_cs->ref_freq_khz = fw_info.pll_info.crystal_frequency; + calc_pll_cs->ref_freq_khz = fw_info->pll_info.crystal_frequency; calc_pll_cs->min_vco_khz = - fw_info.pll_info.min_output_pxl_clk_pll_frequency; + fw_info->pll_info.min_output_pxl_clk_pll_frequency; calc_pll_cs->max_vco_khz = - fw_info.pll_info.max_output_pxl_clk_pll_frequency; + fw_info->pll_info.max_output_pxl_clk_pll_frequency;if (init_data->max_override_input_pxl_clk_pll_freq_khz !=0 ) calc_pll_cs->max_pll_input_freq_khz = init_data->max_override_input_pxl_clk_pll_freq_khz;else calc_pll_cs->max_pll_input_freq_khz = - fw_info.pll_info.max_input_pxl_clk_pll_frequency; + fw_info->pll_info.max_input_pxl_clk_pll_frequency;if (init_data->min_override_input_pxl_clk_pll_freq_khz !=0 ) calc_pll_cs->min_pll_input_freq_khz = init_data->min_override_input_pxl_clk_pll_freq_khz;else calc_pll_cs->min_pll_input_freq_khz = - fw_info.pll_info.min_input_pxl_clk_pll_frequency; + fw_info->pll_info.min_input_pxl_clk_pll_frequency; calc_pll_cs->min_pix_clock_pll_post_divider = init_data->min_pix_clk_pll_post_divider;
@@ -1314,7 +1312,6 @@ bool dce110_clk_src_construct(const struct dce110_clk_src_shift *cs_shift, const struct dce110_clk_src_mask *cs_mask) { - struct dc_firmware_info fw_info = { { 0 } }; struct calc_pll_clock_source_init_data calc_pll_cs_init_data_hdmi;struct calc_pll_clock_source_init_data calc_pll_cs_init_data;
@@ -1327,14 +1324,12 @@ bool dce110_clk_src_construct( clk_src->cs_shift = cs_shift; clk_src->cs_mask = cs_mask; -if (clk_src->bios->funcs->get_firmware_info ( - clk_src->bios, &fw_info) !=BP_RESULT_OK ) { +if (!clk_src->bios->fw_info_valid) {ASSERT_CRITICAL (false); goto unexpected_failure; } - clk_src->ext_clk_khz = - fw_info.external_clock_source_frequency_for_dp; + clk_src->ext_clk_khz = clk_src->bios->fw_info.external_clock_source_frequency_for_dp;/* structure normally used with PLL ranges from ATOMBIOS; DS on by default */ calc_pll_cs_init_data.bp = bios;
@@ -1374,7 +1369,7 @@ bool dce110_clk_src_construct(FRACT_FB_DIVIDER_DEC_POINTS_MAX_NUM ; calc_pll_cs_init_data_hdmi.ctx = ctx; - clk_src->ref_freq_khz = fw_info.pll_info.crystal_frequency; + clk_src->ref_freq_khz = clk_src->bios->fw_info.pll_info.crystal_frequency;if (clk_src->base.id ==CLOCK_SOURCE_ID_EXTERNAL )return true;
@@ -1417,8 +1412,6 @@ bool dce112_clk_src_construct(const struct dce110_clk_src_shift *cs_shift, const struct dce110_clk_src_mask *cs_mask) { - struct dc_firmware_info fw_info = { { 0 } }; - clk_src->base.ctx = ctx; clk_src->bios = bios; clk_src->base.id = id;
@@ -1428,13 +1421,12 @@ bool dce112_clk_src_construct( clk_src->cs_shift = cs_shift; clk_src->cs_mask = cs_mask; -if (clk_src->bios->funcs->get_firmware_info ( - clk_src->bios, &fw_info) !=BP_RESULT_OK ) { +if (!clk_src->bios->fw_info_valid) {ASSERT_CRITICAL (false);return false; } - clk_src->ext_clk_khz = fw_info.external_clock_source_frequency_for_dp; + clk_src->ext_clk_khz = clk_src->bios->fw_info.external_clock_source_frequency_for_dp;return true; }
drivers/gpu/drm/amd/display/dc/dce/dce_i2c_hw.c +1 -12
@@ -96,17 +96,6 @@ static uint32_t get_hw_buffer_available_size( dce_i2c_hw->buffer_used_bytes; } -uint32_t get_reference_clock ( -struct dc_bios *bios) -{ -struct dc_firmware_info info = { {0 } }; - -if (bios->funcs->get_firmware_info (bios, &info) !=BP_RESULT_OK ) -return 0 ; - -return info.pll_info.crystal_frequency; -} -static uint32_t get_speed (const struct dce_i2c_hw *dce_i2c_hw) {
@@ -629,7 +618,7 @@ void dce_i2c_hw_construct( { dce_i2c_hw->ctx = ctx; dce_i2c_hw->engine_id = engine_id; - dce_i2c_hw->reference_frequency =get_reference_clock (ctx->dc_bios) >>1 ; + dce_i2c_hw->reference_frequency = (ctx->dc_bios->fw_info.pll_info.crystal_frequency) >>1 ; dce_i2c_hw->regs = regs; dce_i2c_hw->shifts = shifts; dce_i2c_hw->masks = masks;
drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c +1 -3
@@ -907,7 +907,6 @@ static bool construct( {unsigned int i;struct dc_context *ctx = dc->ctx; -struct dc_firmware_info info;struct dc_bios *bp; ctx->dc_bios->regs = &bios_regs;
@@ -918,8 +917,7 @@ static bool construct( bp = ctx->dc_bios; -if ((bp->funcs->get_firmware_info (bp, &info) ==BP_RESULT_OK ) && - info.external_clock_source_frequency_for_dp !=0 ) { +if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp !=0 ) { pool->base.dp_clock_source =dce100_clock_source_create (ctx, bp,CLOCK_SOURCE_ID_EXTERNAL ,NULL , true);
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +1 -3
@@ -1272,7 +1272,6 @@ static bool construct( {unsigned int i;struct dc_context *ctx = dc->ctx; -struct dc_firmware_info info;struct dc_bios *bp; ctx->dc_bios->regs = &bios_regs;
@@ -1298,8 +1297,7 @@ static bool construct( bp = ctx->dc_bios; -if ((bp->funcs->get_firmware_info (bp, &info) ==BP_RESULT_OK ) && - info.external_clock_source_frequency_for_dp !=0 ) { +if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp !=0 ) { pool->base.dp_clock_source =dce110_clock_source_create (ctx, bp,CLOCK_SOURCE_ID_EXTERNAL ,NULL , true);
drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c +3 -9
@@ -874,7 +874,6 @@ static bool dce80_construct( {unsigned int i;struct dc_context *ctx = dc->ctx; -struct dc_firmware_info info;struct dc_bios *bp; ctx->dc_bios->regs = &bios_regs;
@@ -900,8 +899,7 @@ static bool dce80_construct( bp = ctx->dc_bios; -if ((bp->funcs->get_firmware_info (bp, &info) ==BP_RESULT_OK ) && - info.external_clock_source_frequency_for_dp !=0 ) { +if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp !=0 ) { pool->base.dp_clock_source =dce80_clock_source_create (ctx, bp,CLOCK_SOURCE_ID_EXTERNAL ,NULL , true);
@@ -1073,7 +1071,6 @@ static bool dce81_construct( {unsigned int i;struct dc_context *ctx = dc->ctx; -struct dc_firmware_info info;struct dc_bios *bp; ctx->dc_bios->regs = &bios_regs;
@@ -1099,8 +1096,7 @@ static bool dce81_construct( bp = ctx->dc_bios; -if ((bp->funcs->get_firmware_info (bp, &info) ==BP_RESULT_OK ) && - info.external_clock_source_frequency_for_dp !=0 ) { +if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp !=0 ) { pool->base.dp_clock_source =dce80_clock_source_create (ctx, bp,CLOCK_SOURCE_ID_EXTERNAL ,NULL , true);
@@ -1272,7 +1268,6 @@ static bool dce83_construct( {unsigned int i;struct dc_context *ctx = dc->ctx; -struct dc_firmware_info info;struct dc_bios *bp; ctx->dc_bios->regs = &bios_regs;
@@ -1298,8 +1293,7 @@ static bool dce83_construct( bp = ctx->dc_bios; -if ((bp->funcs->get_firmware_info (bp, &info) ==BP_RESULT_OK ) && - info.external_clock_source_frequency_for_dp !=0 ) { +if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp !=0 ) { pool->base.dp_clock_source =dce80_clock_source_create (ctx, bp,CLOCK_SOURCE_ID_EXTERNAL ,NULL , true);
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +4 -5
@@ -568,7 +568,6 @@ static void dcn20_init_hw(struct dc *dc)struct dc_bios *dcb = dc->ctx->dc_bios;struct resource_pool *res_pool = dc->res_pool;struct dc_state *context = dc->current_state; -struct dc_firmware_info fw_info = { {0 } };if (dc->clk_mgr && dc->clk_mgr->funcs->init_clocks) dc->clk_mgr->funcs->init_clocks (dc->clk_mgr);
@@ -592,15 +591,15 @@ static void dcn20_init_hw(struct dc *dc) }else {if (!dcb->funcs->is_accelerated_mode (dcb)) {bios_golden_init (dc); -if (dc->ctx->dc_bios->funcs->get_firmware_info ( - dc->ctx->dc_bios, &fw_info) ==BP_RESULT_OK ) { - res_pool->ref_clocks.xtalin_clock_inKhz = fw_info.pll_info.crystal_frequency; +if (dc->ctx->dc_bios->fw_info_valid) { + res_pool->ref_clocks.xtalin_clock_inKhz = + dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency;if (!IS_FPGA_MAXIMUS_DC (dc->ctx->dce_environment)) {if (res_pool->dccg && res_pool->hubbub) { (res_pool->dccg->funcs->get_dccg_ref_freq)(res_pool->dccg, - fw_info.pll_info.crystal_frequency, + dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency, &res_pool->ref_clocks.dccg_ref_clock_inKhz); (res_pool->hubbub->funcs->get_dchub_ref_freq)(res_pool->hubbub,
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 10/49] drm/amd/display: make firmware info only load once during dc_bios create
Quoted 452 lines · On Fri, 9 Aug 2019 at 22:38, <[email protected]> wrote:
From: Dmytro Laktyushkin <[email protected]>
Currently every time DC wants to access firmware info we make a call into VBIOS. This makes no sense as there is nothing that can change runtime inside fw info and can cause issues when calling unstable bios during bringup.
This change eliminate this behavior by only calling bios once for fw info and keeping it stored as part of
dc_bios.Signed-off-by Dmytro Laktyushkin <[email protected]>Reviewed-by Chris Park <[email protected]>Acked-by Leo Li <[email protected]>--- .../gpu/drm/amd/display/dc/bios/bios_parser.c | 3 +- .../drm/amd/display/dc/bios/bios_parser2.c | 3 +- .../display/dc/clk_mgr/dce100/dce_clk_mgr.c | 17 ++++------ .../display/dc/clk_mgr/dcn10/rv1_clk_mgr.c | 6 ++-- .../gpu/drm/amd/display/dc/core/dc_resource.c | 7 ++-- .../gpu/drm/amd/display/dc/dc_bios_types.h | 5 ++- .../drm/amd/display/dc/dce/dce_clock_source.c | 32 +++++++------------ .../gpu/drm/amd/display/dc/dce/dce_i2c_hw.c | 13 +------- .../amd/display/dc/dce100/dce100_resource.c | 4 +-- .../amd/display/dc/dce110/dce110_resource.c | 4 +-- .../drm/amd/display/dc/dce80/dce80_resource.c | 12 ++----- .../drm/amd/display/dc/dcn20/dcn20_hwseq.c | 9 +++--- 12 files changed, 36 insertions(+), 79 deletions(-)drivers/gpu/drm/amd/display/dc/bios/bios_parser.c +1
-2@@ -2794,8 +2794,6 @@ static const struct dc_vbios_funcs vbios_funcs = { .get_device_tag = bios_parser_get_device_tag, - .get_firmware_info = bios_parser_get_firmware_info, - .get_spread_spectrum_info = bios_parser_get_spread_spectrum_info, .get_ss_entry_number = bios_parser_get_ss_entry_number,@@ -2920,6 +2918,7 @@ static bool bios_parser_construct(dal_bios_parser_init_cmd_tbl_helper (&bp->cmd_helper, dce_version); bp->base.integrated_info =bios_parser_create_integrated_info (&bp->base); + bp->base.fw_info_valid =bios_parser_get_firmware_info (&bp->base, &bp->base.fw_info) ==BP_RESULT_OK ;return true; }drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +1
-2@@ -1879,8 +1879,6 @@ static const struct dc_vbios_funcs vbios_funcs = { .get_device_tag = bios_parser_get_device_tag, - .get_firmware_info = bios_parser_get_firmware_info, - .get_spread_spectrum_info = bios_parser_get_spread_spectrum_info, .get_ss_entry_number = bios_parser_get_ss_entry_number,@@ -1996,6 +1994,7 @@ static bool bios_parser_construct(dal_bios_parser_init_cmd_tbl_helper2 (&bp->cmd_helper, dce_version); bp->base.integrated_info =bios_parser_create_integrated_info (&bp->base); + bp->base.fw_info_valid =bios_parser_get_firmware_info (&bp->base, &bp->base.fw_info) ==BP_RESULT_OK ;return true; }drivers/gpu/drm/amd/display/dc/clk_mgr/dce100/dce_clk_mgr.c +6
-11@@ -273,18 +273,12 @@ static void dce_clock_read_integrated_info(struct clk_mgr_internal *clk_mgr_dce) {struct dc_debug_options *debug = &clk_mgr_dce->base.ctx->dc->debug;struct dc_bios *bp = clk_mgr_dce->base.ctx->dc_bios; -struct integrated_info info = { { {0 } } }; -struct dc_firmware_info fw_info = { {0 } };int i;if (bp->integrated_info) - info = *bp->integrated_info; - - clk_mgr_dce->dentist_vco_freq_khz = info.dentist_vco_freq; + clk_mgr_dce->dentist_vco_freq_khz = bp->integrated_info->dentist_vco_freq;if (clk_mgr_dce->dentist_vco_freq_khz ==0 ) { - bp->funcs->get_firmware_info (bp, &fw_info); - clk_mgr_dce->dentist_vco_freq_khz = - fw_info.smu_gpu_pll_output_freq; + clk_mgr_dce->dentist_vco_freq_khz = bp->fw_info.smu_gpu_pll_output_freq;if (clk_mgr_dce->dentist_vco_freq_khz ==0 ) clk_mgr_dce->dentist_vco_freq_khz =3600000 ; }@@ -317,9 +311,10 @@ static void dce_clock_read_integrated_info(struct clk_mgr_internal *clk_mgr_dce)/*Do not allow bad VBIOS/SBIOS to override with invalid values, * check for > 100MHz*/ -if (info.disp_clk_voltage[i].max_supported_clk >=100000 ) - clk_mgr_dce->max_clks_by_state[clk_state].display_clk_khz = - info.disp_clk_voltage[i].max_supported_clk; +if (bp->integrated_info) +if (bp->integrated_info->disp_clk_voltage[i].max_supported_clk >=100000 ) + clk_mgr_dce->max_clks_by_state[clk_state].display_clk_khz = + bp->integrated_info->disp_clk_voltage[i].max_supported_clk; }if (!debug->disable_dfs_bypass && bp->integrated_info)drivers/gpu/drm/amd/display/dc/clk_mgr/dcn10/rv1_clk_mgr.c +2
-4@@ -243,7 +243,6 @@ void rv1_clk_mgr_construct(struct dc_context *ctx, struct clk_mgr_internal *clk_ {struct dc_debug_options *debug = &ctx->dc->debug;struct dc_bios *bp = ctx->dc_bios; -struct dc_firmware_info fw_info = { {0 } }; clk_mgr->base.ctx = ctx; clk_mgr->pp_smu = pp_smu;@@ -259,9 +258,8 @@ void rv1_clk_mgr_construct(struct dc_context *ctx, struct clk_mgr_internal *clk_if (bp->integrated_info) clk_mgr->dentist_vco_freq_khz = bp->integrated_info->dentist_vco_freq; -if (clk_mgr->dentist_vco_freq_khz ==0 ) { - bp->funcs->get_firmware_info (bp, &fw_info); - clk_mgr->dentist_vco_freq_khz = fw_info.smu_gpu_pll_output_freq; +if (bp->fw_info_valid && clk_mgr->dentist_vco_freq_khz ==0 ) { + clk_mgr->dentist_vco_freq_khz = bp->fw_info.smu_gpu_pll_output_freq;if (clk_mgr->dentist_vco_freq_khz ==0 ) clk_mgr->dentist_vco_freq_khz =3600000 ; }drivers/gpu/drm/amd/display/dc/core/dc_resource.c +2
-5@@ -170,12 +170,9 @@ struct resource_pool *dc_create_resource_pool(struct dc *dc,break ; }if (res_pool !=NULL ) { -struct dc_firmware_info fw_info = { {0 } }; - -if (dc->ctx->dc_bios->funcs->get_firmware_info (dc->ctx->dc_bios, - &fw_info) ==BP_RESULT_OK ) { +if (dc->ctx->dc_bios->fw_info_valid) { res_pool->ref_clocks.xtalin_clock_inKhz = - fw_info.pll_info.crystal_frequency; + dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency;/* initialize with firmware data first, no all * ASIC have DCCG SW component. FPGA or * simulation need initialization of drivers/gpu/drm/amd/display/dc/dc_bios_types.h +2
-3@@ -61,9 +61,6 @@ struct dc_vbios_funcs {struct graphics_object_id connector_object_id, uint32_t device_tag_index, struct connector_device_tag_info *info); -enum bp_result (*get_firmware_info)( -struct dc_bios *bios, -struct dc_firmware_info *info); enum bp_result (*get_spread_spectrum_info)( struct dc_bios *bios, enum as_signal_type signal,@@ -152,6 +149,8 @@ struct dc_bios {struct dc_context *ctx;const struct bios_registers *regs;struct integrated_info *integrated_info; +struct dc_firmware_info fw_info; + bool fw_info_valid; };#endif /* DC_BIOS_TYPES_H */ drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c +12
-20@@ -1232,37 +1232,35 @@ static bool calc_pll_max_vco_construct( struct calc_pll_clock_source_init_data *init_data) {uint32_t i; -struct dc_firmware_info fw_info = { {0 } }; +struct dc_firmware_info *fw_info = &init_data->bp->fw_info;if (calc_pll_cs ==NULL || init_data ==NULL || init_data->bp ==NULL )return false; -if (init_data->bp->funcs->get_firmware_info ( - init_data->bp, - &fw_info) !=BP_RESULT_OK ) +if (init_data->bp->fw_info_valid)return false; calc_pll_cs->ctx = init_data->ctx; - calc_pll_cs->ref_freq_khz = fw_info.pll_info.crystal_frequency; + calc_pll_cs->ref_freq_khz = fw_info->pll_info.crystal_frequency; calc_pll_cs->min_vco_khz = - fw_info.pll_info.min_output_pxl_clk_pll_frequency; + fw_info->pll_info.min_output_pxl_clk_pll_frequency; calc_pll_cs->max_vco_khz = - fw_info.pll_info.max_output_pxl_clk_pll_frequency; + fw_info->pll_info.max_output_pxl_clk_pll_frequency;if (init_data->max_override_input_pxl_clk_pll_freq_khz !=0 ) calc_pll_cs->max_pll_input_freq_khz = init_data->max_override_input_pxl_clk_pll_freq_khz;else calc_pll_cs->max_pll_input_freq_khz = - fw_info.pll_info.max_input_pxl_clk_pll_frequency; + fw_info->pll_info.max_input_pxl_clk_pll_frequency;if (init_data->min_override_input_pxl_clk_pll_freq_khz !=0 ) calc_pll_cs->min_pll_input_freq_khz = init_data->min_override_input_pxl_clk_pll_freq_khz;else calc_pll_cs->min_pll_input_freq_khz = - fw_info.pll_info.min_input_pxl_clk_pll_frequency; + fw_info->pll_info.min_input_pxl_clk_pll_frequency; calc_pll_cs->min_pix_clock_pll_post_divider = init_data->min_pix_clk_pll_post_divider;@@ -1314,7 +1312,6 @@ bool dce110_clk_src_construct(const struct dce110_clk_src_shift *cs_shift, const struct dce110_clk_src_mask *cs_mask) { - struct dc_firmware_info fw_info = { { 0 } }; struct calc_pll_clock_source_init_data calc_pll_cs_init_data_hdmi;struct calc_pll_clock_source_init_data calc_pll_cs_init_data;@@ -1327,14 +1324,12 @@ bool dce110_clk_src_construct( clk_src->cs_shift = cs_shift; clk_src->cs_mask = cs_mask; -if (clk_src->bios->funcs->get_firmware_info ( - clk_src->bios, &fw_info) !=BP_RESULT_OK ) { +if (!clk_src->bios->fw_info_valid) {ASSERT_CRITICAL (false); goto unexpected_failure; } - clk_src->ext_clk_khz = - fw_info.external_clock_source_frequency_for_dp; + clk_src->ext_clk_khz = clk_src->bios->fw_info.external_clock_source_frequency_for_dp;/* structure normally used with PLL ranges from ATOMBIOS; DS on by default */ calc_pll_cs_init_data.bp = bios;@@ -1374,7 +1369,7 @@ bool dce110_clk_src_construct(FRACT_FB_DIVIDER_DEC_POINTS_MAX_NUM ; calc_pll_cs_init_data_hdmi.ctx = ctx; - clk_src->ref_freq_khz = fw_info.pll_info.crystal_frequency; + clk_src->ref_freq_khz = clk_src->bios->fw_info.pll_info.crystal_frequency;if (clk_src->base.id ==CLOCK_SOURCE_ID_EXTERNAL )return true;@@ -1417,8 +1412,6 @@ bool dce112_clk_src_construct(const struct dce110_clk_src_shift *cs_shift, const struct dce110_clk_src_mask *cs_mask) { - struct dc_firmware_info fw_info = { { 0 } }; - clk_src->base.ctx = ctx; clk_src->bios = bios; clk_src->base.id = id;@@ -1428,13 +1421,12 @@ bool dce112_clk_src_construct( clk_src->cs_shift = cs_shift; clk_src->cs_mask = cs_mask; -if (clk_src->bios->funcs->get_firmware_info ( - clk_src->bios, &fw_info) !=BP_RESULT_OK ) { +if (!clk_src->bios->fw_info_valid) {ASSERT_CRITICAL (false);return false; } - clk_src->ext_clk_khz = fw_info.external_clock_source_frequency_for_dp; + clk_src->ext_clk_khz = clk_src->bios->fw_info.external_clock_source_frequency_for_dp;return true; }drivers/gpu/drm/amd/display/dc/dce/dce_i2c_hw.c +1
-12@@ -96,17 +96,6 @@ static uint32_t get_hw_buffer_available_size( dce_i2c_hw->buffer_used_bytes; } -uint32_t get_reference_clock ( -struct dc_bios *bios) -{ -struct dc_firmware_info info = { {0 } }; - -if (bios->funcs->get_firmware_info (bios, &info) !=BP_RESULT_OK ) -return 0 ; - -return info.pll_info.crystal_frequency; -} -static uint32_t get_speed (const struct dce_i2c_hw *dce_i2c_hw) {@@ -629,7 +618,7 @@ void dce_i2c_hw_construct( { dce_i2c_hw->ctx = ctx; dce_i2c_hw->engine_id = engine_id; - dce_i2c_hw->reference_frequency =get_reference_clock (ctx->dc_bios) >>1 ; + dce_i2c_hw->reference_frequency = (ctx->dc_bios->fw_info.pll_info.crystal_frequency) >>1 ; dce_i2c_hw->regs = regs; dce_i2c_hw->shifts = shifts; dce_i2c_hw->masks = masks;drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c +1
-3@@ -907,7 +907,6 @@ static bool construct( {unsigned int i;struct dc_context *ctx = dc->ctx; -struct dc_firmware_info info;struct dc_bios *bp; ctx->dc_bios->regs = &bios_regs;@@ -918,8 +917,7 @@ static bool construct( bp = ctx->dc_bios; -if ((bp->funcs->get_firmware_info (bp, &info) ==BP_RESULT_OK ) && - info.external_clock_source_frequency_for_dp !=0 ) { +if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp !=0 ) { pool->base.dp_clock_source =dce100_clock_source_create (ctx, bp,CLOCK_SOURCE_ID_EXTERNAL ,NULL , true);drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +1
-3@@ -1272,7 +1272,6 @@ static bool construct( {unsigned int i;struct dc_context *ctx = dc->ctx; -struct dc_firmware_info info;struct dc_bios *bp; ctx->dc_bios->regs = &bios_regs;@@ -1298,8 +1297,7 @@ static bool construct( bp = ctx->dc_bios; -if ((bp->funcs->get_firmware_info (bp, &info) ==BP_RESULT_OK ) && - info.external_clock_source_frequency_for_dp !=0 ) { +if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp !=0 ) { pool->base.dp_clock_source =dce110_clock_source_create (ctx, bp,CLOCK_SOURCE_ID_EXTERNAL ,NULL , true);drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c +3
-9@@ -874,7 +874,6 @@ static bool dce80_construct( {unsigned int i;struct dc_context *ctx = dc->ctx; -struct dc_firmware_info info;struct dc_bios *bp; ctx->dc_bios->regs = &bios_regs;@@ -900,8 +899,7 @@ static bool dce80_construct( bp = ctx->dc_bios; -if ((bp->funcs->get_firmware_info (bp, &info) ==BP_RESULT_OK ) && - info.external_clock_source_frequency_for_dp !=0 ) { +if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp !=0 ) { pool->base.dp_clock_source =dce80_clock_source_create (ctx, bp,CLOCK_SOURCE_ID_EXTERNAL ,NULL , true);@@ -1073,7 +1071,6 @@ static bool dce81_construct( {unsigned int i;struct dc_context *ctx = dc->ctx; -struct dc_firmware_info info;struct dc_bios *bp; ctx->dc_bios->regs = &bios_regs;@@ -1099,8 +1096,7 @@ static bool dce81_construct( bp = ctx->dc_bios; -if ((bp->funcs->get_firmware_info (bp, &info) ==BP_RESULT_OK ) && - info.external_clock_source_frequency_for_dp !=0 ) { +if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp !=0 ) { pool->base.dp_clock_source =dce80_clock_source_create (ctx, bp,CLOCK_SOURCE_ID_EXTERNAL ,NULL , true);@@ -1272,7 +1268,6 @@ static bool dce83_construct( {unsigned int i;struct dc_context *ctx = dc->ctx; -struct dc_firmware_info info;struct dc_bios *bp; ctx->dc_bios->regs = &bios_regs;@@ -1298,8 +1293,7 @@ static bool dce83_construct( bp = ctx->dc_bios; -if ((bp->funcs->get_firmware_info (bp, &info) ==BP_RESULT_OK ) && - info.external_clock_source_frequency_for_dp !=0 ) { +if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp !=0 ) { pool->base.dp_clock_source =dce80_clock_source_create (ctx, bp,CLOCK_SOURCE_ID_EXTERNAL ,NULL , true);drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +4
-6@@ -568,7 +568,6 @@ static void dcn20_init_hw(struct dc *dc)struct dc_bios *dcb = dc->ctx->dc_bios;struct resource_pool *res_pool = dc->res_pool;struct dc_state *context = dc->current_state; -struct dc_firmware_info fw_info = { {0 } };if (dc->clk_mgr && dc->clk_mgr->funcs->init_clocks) dc->clk_mgr->funcs->init_clocks (dc->clk_mgr);@@ -592,15 +591,15 @@ static void dcn20_init_hw(struct dc *dc) }else {if (!dcb->funcs->is_accelerated_mode (dcb)) {bios_golden_init (dc); -if (dc->ctx->dc_bios->funcs->get_firmware_info ( - dc->ctx->dc_bios, &fw_info) ==BP_RESULT_OK ) { - res_pool->ref_clocks.xtalin_clock_inKhz = fw_info.pll_info.crystal_frequency; +if (dc->ctx->dc_bios->fw_info_valid) { + res_pool->ref_clocks.xtalin_clock_inKhz = + dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency;if (!IS_FPGA_MAXIMUS_DC (dc->ctx->dce_environment)) {if (res_pool->dccg && res_pool->hubbub) { (res_pool->dccg->funcs->get_dccg_ref_freq)(res_pool->dccg, - fw_info.pll_info.crystal_frequency, + dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency, &res_pool->ref_clocks.dccg_ref_clock_inKhz); (res_pool->hubbub->funcs->get_dchub_ref_freq)(res_pool->hubbub, --2.22.0
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Hi
This patch is causing me issues
https://bugs.freedesktop.org/show_bug.cgi?id=111432
It won't revert cleanly - so I've not been able to check if reverting it makes the issue go away but i did bisect back to this commit
It's a prime Skylake/Tonga laptop
Cheers
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 11/49 drm/amd/display: fixup DPP programming sequence
In reply to a message not in the archiveFrom: Jun Lei <[email protected]>
[why]
DC does not correct account for the fact that DPP DTO is double buffered while DPP ref is not. This means that when DPP ref clock is lowered when it's "safe to lower", the DPP blocks that need an increased divider will temporarily have actual DPP clock drop below minimum while DTO double buffering takes effect. This results in temporary underflow.
[how]
To fix this, DPP clock cannot be programmed atomically, but rather be broken up into the DTO and the ref. Each has a separate "safe to lower" logic. When doing "prepare" the ref and dividers may only increase. When doing "optimize", both may decrease. It is guaranteed that we won't exceed max DPP clock because we do not use dividers larger than 1.
--- .../display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c | 133 +++++++++++++----- drivers/gpu/drm/amd/display/dc/core/dc.c | 3 + .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 3 +- .../gpu/drm/amd/display/dc/dcn20/dcn20_dccg.c | 31 +++- .../gpu/drm/amd/display/dc/dcn20/dcn20_dccg.h | 2 +- .../drm/amd/display/dc/dcn20/dcn20_resource.c | 2 +- .../gpu/drm/amd/display/dc/inc/core_types.h | 1 - .../amd/display/dc/inc/hw/clk_mgr_internal.h | 10 +- drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h | 3 +- 9 files changed, 141 insertions(+), 47 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c +97 -36
@@ -104,7 +104,6 @@ void dcn20_update_clocks_update_dpp_dto(struct clk_mgr_internal *clk_mgr, {int i; - clk_mgr->dccg->ref_dppclk = clk_mgr->base.clks.dppclk_khz;for (i =0 ; i < clk_mgr->base.ctx->dc->res_pool->pipe_count; i++) {int dpp_inst, dppclk_khz;
@@ -114,28 +113,75 @@ void dcn20_update_clocks_update_dpp_dto(struct clk_mgr_internal *clk_mgr, dpp_inst = context->res_ctx.pipe_ctx[i].plane_res.dpp->inst; dppclk_khz = context->res_ctx.pipe_ctx[i].plane_res.bw.dppclk_khz; clk_mgr->dccg->funcs->update_dpp_dto ( - clk_mgr->dccg, dpp_inst, dppclk_khz); + clk_mgr->dccg, dpp_inst, dppclk_khz, false); } } -void dcn20_update_clocks_update_dentist (struct clk_mgr_internal *clk_mgr) +static void update_global_dpp_clk (struct clk_mgr_internal *clk_mgr,unsigned int khz) {int dpp_divider =DENTIST_DIVIDER_RANGE_SCALE_FACTOR - * clk_mgr->dentist_vco_freq_khz / clk_mgr->base.clks.dppclk_khz; -int disp_divider =DENTIST_DIVIDER_RANGE_SCALE_FACTOR - * clk_mgr->dentist_vco_freq_khz / clk_mgr->base.clks.dispclk_khz; + * clk_mgr->dentist_vco_freq_khz / khz;uint32_t dppclk_wdivider =dentist_get_did_from_divider (dpp_divider); -uint32_t dispclk_wdivider =dentist_get_did_from_divider (disp_divider); -REG_UPDATE (DENTIST_DISPCLK_CNTL , -DENTIST_DISPCLK_WDIVIDER , dispclk_wdivider); -// REG_WAIT(DENTIST_DISPCLK_CNTL, DENTIST_DISPCLK_CHG_DONE, 1, 5, 100); REG_UPDATE (DENTIST_DISPCLK_CNTL ,DENTIST_DPPCLK_WDIVIDER , dppclk_wdivider);REG_WAIT (DENTIST_DISPCLK_CNTL ,DENTIST_DPPCLK_CHG_DONE ,1 ,5 ,100 ); } +static void update_display_clk (struct clk_mgr_internal *clk_mgr,unsigned int khz) +{ +int disp_divider =DENTIST_DIVIDER_RANGE_SCALE_FACTOR + * clk_mgr->dentist_vco_freq_khz / khz; + +uint32_t dispclk_wdivider =dentist_get_did_from_divider (disp_divider); + +REG_UPDATE (DENTIST_DISPCLK_CNTL , +DENTIST_DISPCLK_WDIVIDER , dispclk_wdivider); +} + +static void request_voltage_and_program_disp_clk (struct clk_mgr *clk_mgr_base,unsigned int khz) +{ +struct clk_mgr_internal *clk_mgr =TO_CLK_MGR_INTERNAL (clk_mgr_base); +struct dc *dc = clk_mgr_base->ctx->dc; +struct pp_smu_funcs_nv *pp_smu =NULL ; +bool going_up = clk_mgr->base.clks.dispclk_khz < khz; + +if (dc->res_pool->pp_smu) + pp_smu = &dc->res_pool->pp_smu->nv_funcs; + + clk_mgr->base.clks.dispclk_khz = khz; + +if (going_up && pp_smu && pp_smu->set_voltage_by_freq) + pp_smu->set_voltage_by_freq (&pp_smu->pp_smu,PP_SMU_NV_DISPCLK , clk_mgr_base->clks.dispclk_khz /1000 ); + +update_display_clk (clk_mgr, khz); + +if (!going_up && pp_smu && pp_smu->set_voltage_by_freq) + pp_smu->set_voltage_by_freq (&pp_smu->pp_smu,PP_SMU_NV_DISPCLK , clk_mgr_base->clks.dispclk_khz /1000 ); +} + +static void request_voltage_and_program_global_dpp_clk (struct clk_mgr *clk_mgr_base,unsigned int khz) +{ +struct clk_mgr_internal *clk_mgr =TO_CLK_MGR_INTERNAL (clk_mgr_base); +struct dc *dc = clk_mgr_base->ctx->dc; +struct pp_smu_funcs_nv *pp_smu =NULL ; +bool going_up = clk_mgr->base.clks.dppclk_khz < khz; + +if (dc->res_pool->pp_smu) + pp_smu = &dc->res_pool->pp_smu->nv_funcs; + + clk_mgr->base.clks.dppclk_khz = khz; + clk_mgr->dccg->ref_dppclk = khz; + +if (going_up && pp_smu && pp_smu->set_voltage_by_freq) + pp_smu->set_voltage_by_freq (&pp_smu->pp_smu,PP_SMU_NV_PIXELCLK , clk_mgr_base->clks.dppclk_khz /1000 ); + +update_global_dpp_clk (clk_mgr, khz); + +if (!going_up && pp_smu && pp_smu->set_voltage_by_freq) + pp_smu->set_voltage_by_freq (&pp_smu->pp_smu,PP_SMU_NV_PIXELCLK , clk_mgr_base->clks.dppclk_khz /1000 ); +} void dcn2_update_clocks(struct clk_mgr *clk_mgr_base, struct dc_state *context,
@@ -146,12 +192,11 @@ void dcn2_update_clocks(struct clk_mgr *clk_mgr_base,struct dc *dc = clk_mgr_base->ctx->dc;struct pp_smu_funcs_nv *pp_smu =NULL ;int display_count; -bool update_dppclk = false;bool update_dispclk = false;bool enter_display_off = false; -bool dpp_clock_lowered = false;struct dmcu *dmcu = clk_mgr_base->ctx->dc->res_pool->dmcu;bool force_reset = false; +int i;if (clk_mgr_base->clks.dispclk_khz ==0 || dc->debug.force_clock_mode &0x1 ) {
@@ -177,6 +222,7 @@ void dcn2_update_clocks(struct clk_mgr *clk_mgr_base, pp_smu->set_voltage_by_freq (&pp_smu->pp_smu,PP_SMU_NV_PHYCLK , clk_mgr_base->clks.phyclk_khz /1000 ); } +if (dc->debug.force_min_dcfclk_mhz >0 ) new_clocks->dcfclk_khz = (new_clocks->dcfclk_khz > (dc->debug.force_min_dcfclk_mhz *1000 )) ? new_clocks->dcfclk_khz : (dc->debug.force_min_dcfclk_mhz *1000 );
@@ -202,10 +248,12 @@ void dcn2_update_clocks(struct clk_mgr *clk_mgr_base,if (should_update_pstate_support (safe_to_lower, new_clocks->p_state_change_support, clk_mgr_base->clks.p_state_change_support)) { clk_mgr_base->clks.prev_p_state_change_support = clk_mgr_base->clks.p_state_change_support; + clk_mgr_base->clks.p_state_change_support = new_clocks->p_state_change_support;if (pp_smu && pp_smu->set_pstate_handshake_support) pp_smu->set_pstate_handshake_support (&pp_smu->pp_smu, clk_mgr_base->clks.p_state_change_support); } + clk_mgr_base->clks.prev_p_state_change_support = clk_mgr_base->clks.p_state_change_support;if (should_set_clock (safe_to_lower, new_clocks->dramclk_khz, clk_mgr_base->clks.dramclk_khz)) { clk_mgr_base->clks.dramclk_khz = new_clocks->dramclk_khz;
@@ -213,35 +261,48 @@ void dcn2_update_clocks(struct clk_mgr *clk_mgr_base, pp_smu->set_hard_min_uclk_by_freq (&pp_smu->pp_smu, clk_mgr_base->clks.dramclk_khz /1000 ); } -if (should_set_clock (safe_to_lower, new_clocks->dppclk_khz, clk_mgr->base.clks.dppclk_khz)) { -if (clk_mgr->base.clks.dppclk_khz > new_clocks->dppclk_khz) - dpp_clock_lowered = true; - clk_mgr->base.clks.dppclk_khz = new_clocks->dppclk_khz; +if (dc->config.forced_clocks == false) { +// First update display clock +if (should_set_clock (safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz)) +request_voltage_and_program_disp_clk (clk_mgr_base, new_clocks->dispclk_khz); -if (pp_smu && pp_smu->set_voltage_by_freq) - pp_smu->set_voltage_by_freq (&pp_smu->pp_smu,PP_SMU_NV_PIXELCLK , clk_mgr_base->clks.dppclk_khz /1000 ); +// Updating DPP clock requires some more logic +if (!safe_to_lower) { +// For pre-programming, we need to make sure any DPP clock that will go up has to go up - update_dppclk = true; - } +// First raise the global reference if needed +if (new_clocks->dppclk_khz > clk_mgr_base->clks.dppclk_khz) +request_voltage_and_program_global_dpp_clk (clk_mgr_base, new_clocks->dppclk_khz); -if (should_set_clock (safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz)) { - clk_mgr_base->clks.dispclk_khz = new_clocks->dispclk_khz; -if (pp_smu && pp_smu->set_voltage_by_freq) - pp_smu->set_voltage_by_freq (&pp_smu->pp_smu,PP_SMU_NV_DISPCLK , clk_mgr_base->clks.dispclk_khz /1000 ); +// Then raise any dividers that need raising +for (i =0 ; i < clk_mgr->base.ctx->dc->res_pool->pipe_count; i++) { +int dpp_inst, dppclk_khz; - update_dispclk = true; - } -if (dc->config.forced_clocks == false || (force_reset && safe_to_lower)) { -if (dpp_clock_lowered) { -// if clock is being lowered, increase DTO before lowering refclk -dcn20_update_clocks_update_dpp_dto (clk_mgr, context); -dcn20_update_clocks_update_dentist (clk_mgr); +if (!context->res_ctx.pipe_ctx[i].plane_state) +continue ; + + dpp_inst = context->res_ctx.pipe_ctx[i].plane_res.dpp->inst; + dppclk_khz = context->res_ctx.pipe_ctx[i].plane_res.bw.dppclk_khz; + + clk_mgr->dccg->funcs->update_dpp_dto (clk_mgr->dccg, dpp_inst, dppclk_khz, true); + } }else { -// if clock is being raised, increase refclk before lowering DTO -if (update_dppclk || update_dispclk) -dcn20_update_clocks_update_dentist (clk_mgr); -if (update_dppclk) -dcn20_update_clocks_update_dpp_dto (clk_mgr, context); +// For post-programming, we can lower ref clk if needed, and unconditionally set all the DTOs + +if (new_clocks->dppclk_khz < clk_mgr_base->clks.dppclk_khz) +request_voltage_and_program_global_dpp_clk (clk_mgr_base, new_clocks->dppclk_khz); + +for (i =0 ; i < clk_mgr->base.ctx->dc->res_pool->pipe_count; i++) { +int dpp_inst, dppclk_khz; + +if (!context->res_ctx.pipe_ctx[i].plane_state) +continue ; + + dpp_inst = context->res_ctx.pipe_ctx[i].plane_res.dpp->inst; + dppclk_khz = context->res_ctx.pipe_ctx[i].plane_res.bw.dppclk_khz; + + clk_mgr->dccg->funcs->update_dpp_dto (clk_mgr->dccg, dpp_inst, dppclk_khz, false); + } } } if (update_dispclk &&
drivers/gpu/drm/amd/display/dc/core/dc.c +3 -0
@@ -1600,6 +1600,9 @@ enum surface_update_type dc_check_update_surfaces_for_stream(for (i =0 ; i < surface_count; i++) updates[i].surface->update_flags.raw =0xFFFFFFFF ; +if (type ==UPDATE_TYPE_FAST &&memcmp (&dc->current_state->bw_ctx.bw.dcn.clk, &dc->clk_mgr->clks, offsetof(struct dc_clocks , prev_p_state_change_support)) !=0 ) + dc->optimized_required = true; +return type; }
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +2 -1
@@ -2154,7 +2154,8 @@ void update_dchubp_dpp( dc->res_pool->dccg->funcs->update_dpp_dto ( dc->res_pool->dccg, dpp->inst, - pipe_ctx->plane_res.bw.dppclk_khz); + pipe_ctx->plane_res.bw.dppclk_khz, + false); else dc->clk_mgr->clks.dppclk_khz = should_divided_by_2 ? dc->clk_mgr->clks.dispclk_khz / 2 :
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dccg.c +27 -4
@@ -42,12 +42,16 @@#define DC_LOGGER \ dccg->ctx->logger -void dccg2_update_dpp_dto (struct dccg *dccg,int dpp_inst,int req_dppclk) +void dccg2_update_dpp_dto (struct dccg *dccg, +int dpp_inst, +int req_dppclk, +bool reduce_divider_only) {struct dcn_dccg *dccg_dcn =TO_DCN_DCCG (dccg);if (dccg->ref_dppclk && req_dppclk) {int ref_dppclk = dccg->ref_dppclk; +int current_phase, current_modulo;ASSERT (req_dppclk <= ref_dppclk);/* need to clamp to 8 bits */
@@ -59,9 +63,28 @@ void dccg2_update_dpp_dto(struct dccg *dccg, int dpp_inst, int req_dppclk)if (req_dppclk > ref_dppclk) req_dppclk = ref_dppclk; } -REG_SET_2 (DPPCLK_DTO_PARAM [dpp_inst],0 , -DPPCLK0_DTO_PHASE , req_dppclk, -DPPCLK0_DTO_MODULO , ref_dppclk); + +REG_GET_2 (DPPCLK_DTO_PARAM [dpp_inst], +DPPCLK0_DTO_PHASE , ¤t_phase, +DPPCLK0_DTO_MODULO , ¤t_modulo); + +if (reduce_divider_only) { +// requested phase/modulo greater than current +if (req_dppclk * current_modulo >= current_phase * ref_dppclk) { +REG_SET_2 (DPPCLK_DTO_PARAM [dpp_inst],0 , +DPPCLK0_DTO_PHASE , req_dppclk, +DPPCLK0_DTO_MODULO , ref_dppclk); + }else { +REG_SET_2 (DPPCLK_DTO_PARAM [dpp_inst],0 , +DPPCLK0_DTO_PHASE , current_phase, +DPPCLK0_DTO_MODULO , current_modulo); + } + }else { +REG_SET_2 (DPPCLK_DTO_PARAM [dpp_inst],0 , +DPPCLK0_DTO_PHASE , req_dppclk, +DPPCLK0_DTO_MODULO , ref_dppclk); + } +REG_UPDATE (DPPCLK_DTO_CTRL ,DPPCLK_DTO_ENABLE [dpp_inst],1 ); }else {
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dccg.h +1 -1
@@ -97,7 +97,7 @@ struct dcn_dccg {const struct dccg_mask *dccg_mask; }; -void dccg2_update_dpp_dto (struct dccg *dccg,int dpp_inst,int req_dppclk); +void dccg2_update_dpp_dto (struct dccg *dccg,int dpp_inst,int req_dppclk,bool raise_divider_only); void dccg2_get_dccg_ref_freq(struct dccg *dccg, unsigned int xtalin_freq_inKhz,
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +1 -1
@@ -2480,7 +2480,7 @@ void dcn20_calculate_dlg_params( context->bw_ctx.bw.dcn.clk.socclk_khz = context->bw_ctx.dml.vba.SOCCLK *1000 ; context->bw_ctx.bw.dcn.clk.dramclk_khz = context->bw_ctx.dml.vba.DRAMSpeed *1000 /16 ; context->bw_ctx.bw.dcn.clk.dcfclk_deep_sleep_khz = context->bw_ctx.dml.vba.DCFCLKDeepSleep *1000 ; - context->bw_ctx.bw.dcn.clk.fclk_khz = context->bw_ctx.dml.vba.FabricClock *1000 ; + context->bw_ctx.bw.dcn.clk.fclk_khz =0 ; context->bw_ctx.bw.dcn.clk.p_state_change_support = context->bw_ctx.dml.vba.DRAMClockChangeSupport[vlevel][context->bw_ctx.dml.vba.maxMpcComb] != dm_dram_clock_change_unsupported;
drivers/gpu/drm/amd/display/dc/inc/core_types.h +0 -1
@@ -228,7 +228,6 @@ struct resource_pool {struct dcn_fe_bandwidth {int dppclk_khz; - };struct stream_resource {
drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr_internal.h +8 -2
@@ -281,8 +281,14 @@ static inline bool should_set_clock(bool safe_to_lower, int calc_clk, int cur_clstatic inline bool should_update_pstate_support (bool safe_to_lower,bool calc_support,bool cur_support) { -// Whenever we are transitioning pstate support, we always want to notify prior to committing state -return (calc_support != cur_support) ? !safe_to_lower : false; +if (cur_support != calc_support) { +if (calc_support == true && safe_to_lower) +return true; +else if (calc_support == false && !safe_to_lower) +return true; + } + +return false; } int clk_mgr_helper_get_active_display_cnt(
drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h +2 -1
@@ -38,7 +38,8 @@ struct dccg {struct dccg_funcs {void (*update_dpp_dto)(struct dccg *dccg,int dpp_inst, -int req_dppclk); +int req_dppclk, +bool reduce_divider_only);void (*get_dccg_ref_freq)(struct dccg *dccg,unsigned int xtalin_freq_inKhz,unsigned int *dccg_ref_freq_inKhz);
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 12/49 drm/amd/display: Add work-around option to skip DCN20 clock updates
In reply to a message not in the archiveFrom: Jaehyun Chung <[email protected]>
[Why] Auto Overclock Memory fails for some systems that don't support p-state.
[How] Implement the workaround, and it's corresponding enable flag.
--- drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c | 3 +++ drivers/gpu/drm/amd/display/dc/dc.h | 1 + 2 files changed, 4 insertions(+)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c +3 -0
@@ -198,6 +198,9 @@ void dcn2_update_clocks(struct clk_mgr *clk_mgr_base,bool force_reset = false;int i; +if (dc->work_arounds.skip_clock_update) +return ; +if (clk_mgr_base->clks.dispclk_khz ==0 || dc->debug.force_clock_mode &0x1 ) {//this is from resume or boot up, if forced_clock cfg option used, we bypass program dispclk and DPPCLK, but need set them for S3.
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
@@ -122,6 +122,7 @@ struct dc_bug_wa {bool no_connect_phy_config;bool dedcn20_305_wa;struct display_mode_lib alternate_dml; + bool skip_clock_update; };#endif
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 13/49 drm/amd/display: refactor gpio to allocate hw_container in constructor
In reply to a message not in the archiveFrom: Su Sung Chung <[email protected]>
[why]
if dynamic allocation fails during gpio_open, it will cause crash due to page fault.
[how]
handle allocation when gpio object gets created and prevent from calling gpio_open if allocation failed
--- .../dc/gpio/dce110/hw_factory_dce110.c | 18 +++-- .../dc/gpio/dce120/hw_factory_dce120.c | 14 ++-- .../display/dc/gpio/dce80/hw_factory_dce80.c | 14 ++-- .../display/dc/gpio/dcn10/hw_factory_dcn10.c | 12 +-- .../display/dc/gpio/dcn20/hw_factory_dcn20.c | 12 +-- .../dc/gpio/diagnostics/hw_factory_diag.c | 9 +-- .../gpu/drm/amd/display/dc/gpio/gpio_base.c | 74 ++++++++++++++++++- .../drm/amd/display/dc/gpio/gpio_service.c | 51 ++++++------- .../drm/amd/display/dc/gpio/gpio_service.h | 6 +- drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c | 26 ++++--- drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.h | 5 +- .../gpu/drm/amd/display/dc/gpio/hw_factory.h | 48 ++++++------ .../gpu/drm/amd/display/dc/gpio/hw_generic.c | 32 ++++---- .../gpu/drm/amd/display/dc/gpio/hw_generic.h | 6 +- drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c | 31 ++++---- drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.h | 5 +- drivers/gpu/drm/amd/display/dc/inc/hw/gpio.h | 10 +++ .../drm/amd/display/include/gpio_interface.h | 9 +++ 18 files changed, 245 insertions(+), 137 deletions(-)
drivers/gpu/drm/amd/display/dc/gpio/dce110/hw_factory_dce110.c +12 -6
@@ -24,9 +24,15 @@*/ #include "dm_services.h" +#include "include/gpio_types.h" #include "../hw_factory.h" +#include "../hw_gpio.h" +#include "../hw_ddc.h" +#include "../hw_hpd.h" +#include "../hw_generic.h" +#include "hw_factory_dce110.h" #include "dce/dce_11_0_d.h"
@@ -143,12 +149,12 @@ static void define_hpd_registers(struct hw_gpio_pin *pin, uint32_t en) }static const struct hw_factory_funcs funcs = { - .create_ddc_data = dal_hw_ddc_create, - .create_ddc_clock = dal_hw_ddc_create, - .create_generic =NULL , - .create_hpd = dal_hw_hpd_create, - .create_sync =NULL , - .create_gsl =NULL , + .init_ddc_data = dal_hw_ddc_init, + .init_generic =NULL , + .init_hpd = dal_hw_hpd_init, + .get_ddc_pin = dal_hw_ddc_get_pin, + .get_hpd_pin = dal_hw_hpd_get_pin, + .get_generic_pin =NULL , .define_hpd_registers = define_hpd_registers, .define_ddc_registers = define_ddc_registers };
drivers/gpu/drm/amd/display/dc/gpio/dce120/hw_factory_dce120.c +7 -7
@@ -27,10 +27,10 @@#include "include/gpio_types.h" #include "../hw_factory.h" -#include "../hw_gpio.h" #include "../hw_ddc.h" #include "../hw_hpd.h" +#include "../hw_generic.h" #include "hw_factory_dce120.h"
@@ -164,12 +164,12 @@ static void define_hpd_registers(struct hw_gpio_pin *pin, uint32_t en)/* fucntion table */ static const struct hw_factory_funcs funcs = { - .create_ddc_data = dal_hw_ddc_create, - .create_ddc_clock = dal_hw_ddc_create, - .create_generic =NULL , - .create_hpd = dal_hw_hpd_create, - .create_sync =NULL , - .create_gsl =NULL , + .init_ddc_data = dal_hw_ddc_init, + .init_generic =NULL , + .init_hpd = dal_hw_hpd_init, + .get_ddc_pin = dal_hw_ddc_get_pin, + .get_hpd_pin = dal_hw_hpd_get_pin, + .get_generic_pin =NULL , .define_hpd_registers = define_hpd_registers, .define_ddc_registers = define_ddc_registers };
drivers/gpu/drm/amd/display/dc/gpio/dce80/hw_factory_dce80.c +8 -6
@@ -32,10 +32,12 @@#include "../hw_gpio.h" #include "../hw_ddc.h" #include "../hw_hpd.h" +#include "../hw_generic.h" #include "dce/dce_8_0_d.h" #include "dce/dce_8_0_sh_mask.h" +#define REG (reg_name)\ mm ## reg_name
@@ -147,12 +149,12 @@ static void define_hpd_registers(struct hw_gpio_pin *pin, uint32_t en) }static const struct hw_factory_funcs funcs = { - .create_ddc_data = dal_hw_ddc_create, - .create_ddc_clock = dal_hw_ddc_create, - .create_generic =NULL , - .create_hpd = dal_hw_hpd_create, - .create_sync =NULL , - .create_gsl =NULL , + .init_ddc_data = dal_hw_ddc_init, + .init_generic =NULL , + .init_hpd = dal_hw_hpd_init, + .get_ddc_pin = dal_hw_ddc_get_pin, + .get_hpd_pin = dal_hw_hpd_get_pin, + .get_generic_pin =NULL , .define_hpd_registers = define_hpd_registers, .define_ddc_registers = define_ddc_registers };
drivers/gpu/drm/amd/display/dc/gpio/dcn10/hw_factory_dcn10.c +6 -6
@@ -196,12 +196,12 @@ static void define_hpd_registers(struct hw_gpio_pin *pin, uint32_t en)/* fucntion table */ static const struct hw_factory_funcs funcs = { - .create_ddc_data = dal_hw_ddc_create, - .create_ddc_clock = dal_hw_ddc_create, - .create_generic = dal_hw_generic_create, - .create_hpd = dal_hw_hpd_create, - .create_sync =NULL , - .create_gsl =NULL , + .init_ddc_data = dal_hw_ddc_init, + .init_generic = dal_hw_generic_init, + .init_hpd = dal_hw_hpd_init, + .get_ddc_pin = dal_hw_ddc_get_pin, + .get_hpd_pin = dal_hw_hpd_get_pin, + .get_generic_pin = dal_hw_generic_get_pin, .define_hpd_registers = define_hpd_registers, .define_ddc_registers = define_ddc_registers, .define_generic_registers = define_generic_registers
drivers/gpu/drm/amd/display/dc/gpio/dcn20/hw_factory_dcn20.c +6 -6
@@ -212,12 +212,12 @@ static void define_generic_registers(struct hw_gpio_pin *pin, uint32_t en)/* fucntion table */ static const struct hw_factory_funcs funcs = { - .create_ddc_data = dal_hw_ddc_create, - .create_ddc_clock = dal_hw_ddc_create, - .create_generic = dal_hw_generic_create, - .create_hpd = dal_hw_hpd_create, - .create_sync =NULL , - .create_gsl =NULL , + .init_ddc_data = dal_hw_ddc_init, + .init_generic = dal_hw_generic_init, + .init_hpd = dal_hw_hpd_init, + .get_ddc_pin = dal_hw_ddc_get_pin, + .get_hpd_pin = dal_hw_hpd_get_pin, + .get_generic_pin = dal_hw_generic_get_pin, .define_hpd_registers = define_hpd_registers, .define_ddc_registers = define_ddc_registers, .define_generic_registers = define_generic_registers,
drivers/gpu/drm/amd/display/dc/gpio/diagnostics/hw_factory_diag.c +3 -6
@@ -42,12 +42,9 @@/* function table */ static const struct hw_factory_funcs funcs = { - .create_ddc_data =NULL , - .create_ddc_clock =NULL , - .create_generic =NULL , - .create_hpd =NULL , - .create_sync =NULL , - .create_gsl =NULL , + .init_ddc_data =NULL , + .init_generic =NULL , + .init_hpd =NULL , };void dal_hw_factory_diag_fpga_init (struct hw_factory *factory)
drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c +72 -2
100 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c +22 -29
97 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/gpio/gpio_service.h +1 -5
@@ -42,11 +42,7 @@ struct gpio_service { };enum gpio_result dal_gpio_service_open ( -struct gpio_service *service, -enum gpio_id id, -uint32_t en, -enum gpio_mode mode, -struct hw_gpio_pin **ptr); +struct gpio *gpio); void dal_gpio_service_close( struct gpio_service *service,
drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c +17 -9
@@ -25,6 +25,7 @@#include "dm_services.h" +#include "include/gpio_interface.h" #include "include/gpio_types.h" #include "hw_gpio.h" #include "hw_ddc.h"
@@ -42,6 +43,8 @@#define REG (reg)\ (ddc->regs->reg) +struct gpio ; +static void destruct (struct hw_ddc *pin) {
@@ -224,24 +227,29 @@ static void construct( ddc->base.base.funcs = &funcs; } -struct hw_gpio_pin *dal_hw_ddc_create ( +void dal_hw_ddc_init ( +struct hw_ddc **hw_ddc,struct dc_context *ctx,enum gpio_id id,uint32_t en) { -struct hw_ddc *pin; -if ((en <GPIO_DDC_LINE_MIN ) || (en >GPIO_DDC_LINE_MAX )) {ASSERT_CRITICAL (false); -return NULL ; + *hw_ddc =NULL ; } - pin =kzalloc (sizeof (struct hw_ddc ),GFP_KERNEL ); -if (!pin) { + *hw_ddc =kzalloc (sizeof (struct hw_ddc ),GFP_KERNEL ); +if (!*hw_ddc) {ASSERT_CRITICAL (false); -return NULL ; +return ; } -construct (pin, id, en, ctx); -return &pin->base.base; +construct (*hw_ddc, id, en, ctx); +} + +struct hw_gpio_pin *dal_hw_ddc_get_pin (struct gpio *gpio) +{ +struct hw_ddc *hw_ddc =dal_gpio_get_ddc (gpio); + +return &hw_ddc->base.base; }
drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.h +4 -1
@@ -38,9 +38,12 @@ struct hw_ddc {#define HW_DDC_FROM_BASE (hw_gpio) \ container_of((HW_GPIO_FROM_BASE(hw_gpio)), struct hw_ddc, base) -struct hw_gpio_pin *dal_hw_ddc_create ( +void dal_hw_ddc_init ( +struct hw_ddc **hw_ddc,struct dc_context *ctx,enum gpio_id id,uint32_t en); +struct hw_gpio_pin *dal_hw_ddc_get_pin (struct gpio *gpio); +#endif
drivers/gpu/drm/amd/display/dc/gpio/hw_factory.h +24 -24
59 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c +18 -14
@@ -25,6 +25,7 @@#include "dm_services.h" +#include "include/gpio_interface.h" #include "include/gpio_types.h" #include "hw_gpio.h" #include "hw_generic.h"
@@ -41,6 +42,8 @@#define REG (reg)\ (generic->regs->reg) +struct gpio ; + static void dal_hw_generic_construct( struct hw_generic *pin, enum gpio_id id,
@@ -104,29 +107,30 @@ static void construct( generic->base.base.funcs = &funcs; } -struct hw_gpio_pin *dal_hw_generic_create ( +void dal_hw_generic_init ( +struct hw_generic **hw_generic,struct dc_context *ctx,enum gpio_id id,uint32_t en) { -struct hw_generic *generic; - -if (id !=GPIO_ID_GENERIC ) { +if ((en <GPIO_DDC_LINE_MIN ) || (en >GPIO_DDC_LINE_MAX )) {ASSERT_CRITICAL (false); -return NULL ; + *hw_generic =NULL ; } -if ((en <GPIO_GENERIC_MIN ) || (en >GPIO_GENERIC_MAX )) { + *hw_generic =kzalloc (sizeof (struct hw_generic ),GFP_KERNEL ); +if (!*hw_generic) {ASSERT_CRITICAL (false); -return NULL ; +return ; } - generic =kzalloc (sizeof (struct hw_generic ),GFP_KERNEL ); -if (!generic) { -ASSERT_CRITICAL (false); -return NULL ; - } +construct (*hw_generic, id, en, ctx); +} + + +struct hw_gpio_pin *dal_hw_generic_get_pin (struct gpio *gpio) +{ +struct hw_generic *hw_generic =dal_gpio_get_generic (gpio); -construct (generic, id, en, ctx); -return &generic->base.base; +return &hw_generic->base.base; }
drivers/gpu/drm/amd/display/dc/gpio/hw_generic.h +5 -1
@@ -27,6 +27,7 @@#define __DAL_HW_generic_H__#include "generic_regs.h" +#include "hw_gpio.h" struct hw_generic {struct hw_gpio base;
@@ -38,9 +39,12 @@ struct hw_generic {#define HW_GENERIC_FROM_BASE (hw_gpio) \ container_of((HW_GPIO_FROM_BASE(hw_gpio)), struct hw_generic, base) -struct hw_gpio_pin *dal_hw_generic_create ( +void dal_hw_generic_init ( +struct hw_generic **hw_generic,struct dc_context *ctx,enum gpio_id id,uint32_t en); +struct hw_gpio_pin *dal_hw_generic_get_pin (struct gpio *gpio); +#endif
drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c +17 -14
@@ -25,6 +25,7 @@#include "dm_services.h" +#include "include/gpio_interface.h" #include "include/gpio_types.h" #include "hw_gpio.h" #include "hw_hpd.h"
@@ -41,6 +42,8 @@#define REG (reg)\ (hpd->regs->reg) +struct gpio ; + static void dal_hw_hpd_construct( struct hw_hpd *pin, enum gpio_id id,
@@ -134,29 +137,29 @@ static void construct( hpd->base.base.funcs = &funcs; } -struct hw_gpio_pin *dal_hw_hpd_create ( +void dal_hw_hpd_init ( +struct hw_hpd **hw_hpd,struct dc_context *ctx,enum gpio_id id,uint32_t en) { -struct hw_hpd *hpd; - -if (id !=GPIO_ID_HPD ) { +if ((en <GPIO_DDC_LINE_MIN ) || (en >GPIO_DDC_LINE_MAX )) {ASSERT_CRITICAL (false); -return NULL ; + *hw_hpd =NULL ; } -if ((en <GPIO_HPD_MIN ) || (en >GPIO_HPD_MAX )) { + *hw_hpd =kzalloc (sizeof (struct hw_hpd ),GFP_KERNEL ); +if (!*hw_hpd) {ASSERT_CRITICAL (false); -return NULL ; +return ; } - hpd =kzalloc (sizeof (struct hw_hpd ),GFP_KERNEL ); -if (!hpd) { -ASSERT_CRITICAL (false); -return NULL ; - } +construct (*hw_hpd, id, en, ctx); +} + +struct hw_gpio_pin *dal_hw_hpd_get_pin (struct gpio *gpio) +{ +struct hw_hpd *hw_hpd =dal_gpio_get_hpd (gpio); -construct (hpd, id, en, ctx); -return &hpd->base.base; +return &hw_hpd->base.base; }
drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.h +4 -1
@@ -38,9 +38,12 @@ struct hw_hpd {#define HW_HPD_FROM_BASE (hw_gpio) \ container_of((HW_GPIO_FROM_BASE(hw_gpio)), struct hw_hpd, base) -struct hw_gpio_pin *dal_hw_hpd_create ( +void dal_hw_hpd_init ( +struct hw_hpd **hw_hpd,struct dc_context *ctx,enum gpio_id id,uint32_t en); +struct hw_gpio_pin *dal_hw_hpd_get_pin (struct gpio *gpio); +#endif
drivers/gpu/drm/amd/display/dc/inc/hw/gpio.h +10 -0
@@ -28,12 +28,22 @@#include "gpio_types.h" + +union gpio_hw_container { +struct hw_ddc *ddc; +struct hw_generic *generic; +struct hw_hpd *hpd; +}; +struct gpio {struct gpio_service *service;struct hw_gpio_pin *pin;enum gpio_id id;uint32_t en; + +union gpio_hw_container hw_container;enum gpio_mode mode; +/* when GPIO comes from VBIOS, it has defined output state */ enum gpio_pin_output_state output_state; };
drivers/gpu/drm/amd/display/include/gpio_interface.h +9 -0
@@ -93,8 +93,17 @@ enum sync_source dal_gpio_get_sync_source(enum gpio_pin_output_state dal_gpio_get_output_state (const struct gpio *gpio); +struct hw_ddc *dal_gpio_get_ddc (struct gpio *gpio); + +struct hw_hpd *dal_gpio_get_hpd (struct gpio *gpio); + +struct hw_generic *dal_gpio_get_generic (struct gpio *gpio); +/* Close the handle */ void dal_gpio_close (struct gpio *gpio); + + +#endif
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 14/49 drm/amd/display: wait for pending complete when enabling a plane
In reply to a message not in the archiveFrom: Jun Lei <[email protected]>
[why]
When planes are enabled, they must be enabled using VSYNC update (not immediate). However, before the VUPDATE occurs, DM may call with an "immediate" flip which is address only. This operation would normally be okay, but if the locking for immediate flip happens to occur before the VUPDATE associated with the initial plane enablement, it will cause HW to hang.
[how]
HWSS should enforce plane enable in HW to be synchronous with the call that enables the plane.
--- .../drm/amd/display/dc/dcn20/dcn20_hwseq.c | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +19 -1
@@ -1353,13 +1353,15 @@ static void dcn20_apply_ctx_for_surface( int num_planes, struct dc_state *context) { - +const unsigned int TIMEOUT_FOR_PIPE_ENABLE_MS =100 ;int i;struct timing_generator *tg;bool removed_pipe[6 ] = { false };bool interdependent_update = false;struct pipe_ctx *top_pipe_to_program =find_top_pipe_for_stream (dc, context, stream); +struct pipe_ctx *prev_top_pipe_to_program = +find_top_pipe_for_stream (dc, dc->current_state, stream);DC_LOGGER_INIT (dc->ctx->logger);if (!top_pipe_to_program)
@@ -1453,6 +1455,22 @@ static void dcn20_apply_ctx_for_surface(for (i =0 ; i < dc->res_pool->pipe_count; i++)if (removed_pipe[i])dcn20_disable_plane (dc, &dc->current_state->res_ctx.pipe_ctx[i]); + +/* +* If we are enabling a pipe, we need to wait for pending clear as this is a critical +* part of the enable operation otherwise, DM may request an immediate flip which +* will cause HW to perform an "immediate enable" (as opposed to "vsync enable") which +* is unsupported on DCN. +*/ + i =0 ; +if (num_planes >0 && top_pipe_to_program && + (prev_top_pipe_to_program ==NULL || prev_top_pipe_to_program->plane_state ==NULL )) { +while (i <TIMEOUT_FOR_PIPE_ENABLE_MS && + top_pipe_to_program->plane_res.hubp->funcs->hubp_is_flip_pending (top_pipe_to_program->plane_res.hubp)) { + i +=1 ; +msleep (1 ); + } + } }
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 15/49 drm/amd/display: 3.2.43
In reply to a message not in the archiveFrom: Aric Cyr <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
@@ -39,7 +39,7 @@#include "inc/hw/dmcu.h" #include "dml/display_mode_lib.h" -#define DC_VER "3.2.42" +#define DC_VER "3.2.43"#define MAX_SURFACES 3#define MAX_PLANES 6
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 16/49 drm/amd/display: Make init_hw and init_pipes generic for seamless boot
In reply to a message not in the archiveFrom: Martin Leung <[email protected]>
[Why]
For seamless boot the init_hw sequence must be split into actual hardware vs pipes, in order to defer pipe initialization to set mode and skip of pipe-destructive sequences
[How]
made dcn10_init_hw and dcn10_init_pipes generic for future dcns to inherit deleted dcn20 specific versions. This is part 1 of a 2 partimplementation of seamless boot
--- .../display/dc/dce110/dce110_hw_sequencer.c | 12 +- .../display/dc/dce110/dce110_hw_sequencer.h | 6 +- .../drm/amd/display/dc/dcn10/dcn10_hubbub.c | 4 +- .../drm/amd/display/dc/dcn10/dcn10_hubbub.h | 2 +- .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 182 ++++++--- .../drm/amd/display/dc/dcn20/dcn20_hubbub.c | 2 +- .../drm/amd/display/dc/dcn20/dcn20_hwseq.c | 381 +++++++----------- .../gpu/drm/amd/display/dc/inc/hw/dchubbub.h | 4 + .../gpu/drm/amd/display/dc/inc/hw_sequencer.h | 32 ++ 9 files changed, 312 insertions(+), 313 deletions(-)
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +6 -6
@@ -728,7 +728,7 @@ static enum bp_result link_transmitter_control(* @brief * eDP only. */ -void hwss_edp_wait_for_hpd_ready ( +void dce110_edp_wait_for_hpd_ready (struct dc_link *link,bool power_up) {
@@ -796,7 +796,7 @@ void hwss_edp_wait_for_hpd_ready( } } -void hwss_edp_power_control ( +void dce110_edp_power_control (struct dc_link *link,bool power_up) {
@@ -878,7 +878,7 @@ void hwss_edp_power_control(* @brief * eDP only. Control the backlight of the eDP panel */ -void hwss_edp_backlight_control ( +void dce110_edp_backlight_control (struct dc_link *link,bool enable) {
@@ -2755,9 +2755,9 @@ static const struct hw_sequencer_funcs dce110_funcs = { .setup_stereo = NULL, .set_avmute = dce110_set_avmute, .wait_for_mpcc_disconnect = dce110_wait_for_mpcc_disconnect, - .edp_backlight_control = hwss_edp_backlight_control, - .edp_power_control = hwss_edp_power_control, - .edp_wait_for_hpd_ready = hwss_edp_wait_for_hpd_ready, + .edp_backlight_control = dce110_edp_backlight_control, + .edp_power_control = dce110_edp_power_control, + .edp_wait_for_hpd_ready = dce110_edp_wait_for_hpd_ready, .set_cursor_position = dce110_set_cursor_position, .set_cursor_attribute = dce110_set_cursor_attribute };
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.h +3 -3
@@ -73,15 +73,15 @@ void dce110_optimize_bandwidth(void dp_receiver_power_ctrl (struct dc_link *link,bool on); -void hwss_edp_power_control ( +void dce110_edp_power_control (struct dc_link *link,bool power_up); -void hwss_edp_backlight_control ( +void dce110_edp_backlight_control (struct dc_link *link,bool enable); -void hwss_edp_wait_for_hpd_ready ( +void dce110_edp_wait_for_hpd_ready (struct dc_link *link,bool power_up);
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.c +3 -1
@@ -102,7 +102,7 @@ void hubbub1_allow_self_refresh_control(struct hubbub *hubbub, bool allow) DCHUBBUB_ARB_ALLOW_SELF_REFRESH_FORCE_ENABLE, !allow); } -bool hububu1_is_allow_self_refresh_enabled (struct hubbub *hubbub) +bool hubbub1_is_allow_self_refresh_enabled (struct hubbub *hubbub) {struct dcn10_hubbub *hubbub1 =TO_DCN10_HUBBUB (hubbub);uint32_t enable =0 ;
@@ -943,6 +943,8 @@ static const struct hubbub_funcs hubbub1_funcs = { .get_dcc_compression_cap = hubbub1_get_dcc_compression_cap, .wm_read_state = hubbub1_wm_read_state, .program_watermarks = hubbub1_program_watermarks, + .is_allow_self_refresh_enabled = hubbub1_is_allow_self_refresh_enabled, + .allow_self_refresh_control = hubbub1_allow_self_refresh_control, }; void hubbub1_construct(struct hubbub *hubbub,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.h +1 -1
@@ -247,7 +247,7 @@ void hubbub1_program_watermarks(void hubbub1_allow_self_refresh_control (struct hubbub *hubbub,bool allow); -bool hububu1_is_allow_self_refresh_enabled (struct hubbub *hubub); +bool hubbub1_is_allow_self_refresh_enabled (struct hubbub *hubub);void hubbub1_toggle_watermark_change_req (struct hubbub *hubbub);
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +126 -56
390 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubbub.c +1 -1
@@ -582,7 +582,7 @@ static const struct hubbub_funcs hubbub2_funcs = { .get_dcc_compression_cap = hubbub2_get_dcc_compression_cap, .wm_read_state = hubbub2_wm_read_state, .get_dchub_ref_freq = hubbub2_get_dchub_ref_freq, - .program_watermarks = hubbub2_program_watermarks, + .program_watermarks = hubbub2_program_watermarks }; void hubbub2_construct(struct dcn20_hubbub *hubbub,
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +136 -245
432 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h +4 -0
@@ -141,6 +141,10 @@ struct hubbub_funcs {struct dcn_watermark_set *watermarks, unsigned int refclk_mhz, bool safe_to_lower); + +bool (*is_allow_self_refresh_enabled)(struct hubbub *hubbub); +void (*allow_self_refresh_control)(struct hubbub *hubbub,bool allow); + };struct hubbub {
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +32 -0
@@ -78,6 +78,8 @@ struct stream_resource;struct dc_phy_addr_space_config ;struct dc_virtual_addr_space_config ;#endif +struct hubp ; +struct dpp ;struct hw_sequencer_funcs {
@@ -280,6 +282,36 @@ struct hw_sequencer_funcs {void (*setup_vupdate_interrupt)(struct pipe_ctx *pipe_ctx);bool (*did_underflow_occur)(struct dc *dc,struct pipe_ctx *pipe_ctx); +void (*init_blank)(struct dc *dc,struct timing_generator *tg); +void (*disable_vga)(struct dce_hwseq *hws); +void (*bios_golden_init)(struct dc *dc); +void (*plane_atomic_power_down)(struct dc *dc, +struct dpp *dpp, +struct hubp *hubp); + +void (*plane_atomic_disable)( +struct dc *dc,struct pipe_ctx *pipe_ctx); + +void (*enable_power_gating_plane)( +struct dce_hwseq *hws, +bool enable); + +void (*dpp_pg_control)( +struct dce_hwseq *hws, +unsigned int dpp_inst, +bool power_on); + +void (*hubp_pg_control)( +struct dce_hwseq *hws, +unsigned int hubp_inst, +bool power_on); + +void (*dsc_pg_control)( +struct dce_hwseq *hws, +unsigned int dsc_inst, +bool power_on); + +#if defined(CONFIG_DRM_AMD_DC_DCN2_0 )void (*update_odm)(struct dc *dc,struct dc_state *context,struct pipe_ctx *pipe_ctx); void (*program_all_writeback_pipes_in_tree)(
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 17/49 drm/amd/display: fix dcn-specific clk_mgr init_clocks
In reply to a message not in the archiveFrom: Martin Leung <[email protected]>
[Why]
underflow seen on certain monitor setups caused by making dcnxx_init_hw generic
[How]
by moving dcn20_init_hw into dcn10, we added a dcn-specific clk_mgr init (dc->clk_mgr->funcs->init_clocks()). Thus, put old clk_mgr memset in an else statement so both memsets don't get set
--- drivers/gpu/drm/amd/display/dc/clk_mgr/dcn10/rv1_clk_mgr.c | 6 ++++++ drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn10/rv1_clk_mgr.c +6 -0
@@ -31,6 +31,11 @@#include "rv1_clk_mgr_vbios_smu.h" #include "rv1_clk_mgr_clk.h" +void rv1_init_clocks (struct clk_mgr *clk_mgr) +{ +memset (&(clk_mgr->clks),0 ,sizeof (struct dc_clocks )); +} +static int rv1_determine_dppclk_threshold (struct clk_mgr_internal *clk_mgr,struct dc_clocks *new_clocks) {bool request_dpp_div = new_clocks->dispclk_khz > new_clocks->dppclk_khz;
@@ -229,6 +234,7 @@ static void rv1_enable_pme_wa(struct clk_mgr *clk_mgr_base) }static struct clk_mgr_funcs rv1_clk_funcs = { + .init_clocks = rv1_init_clocks, .get_dp_ref_clk_frequency = dce12_get_dp_ref_freq_khz, .update_clocks = rv1_update_clocks, .enable_pme_wa = rv1_enable_pme_wa,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +0 -2
@@ -1290,8 +1290,6 @@ static void dcn10_init_hw(struct dc *dc) } dc->hwss.enable_power_gating_plane (dc->hwseq, true); - -memset (&dc->clk_mgr->clks,0 ,sizeof (dc->clk_mgr->clks)); } static void dcn10_reset_hw_ctx_wrap(
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 18/49 drm/amd/display: enabling seamless boot sequence for dcn2
In reply to a message not in the archiveFrom: Martin Leung <[email protected]>
[Why]
Seamless boot (building SW state inheriting BIOS-initialized timing) was enabled on DCN2, including fixes
[How]
Includes fixes for MPC, DPPCLK, and DIG FE mapping/OTG source select/ Pixel clock.
This is part 2 of 2 for seamless boot NV10
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 26 +++++++--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 13 ++++- .../gpu/drm/amd/display/dc/core/dc_resource.c | 39 +++++++++------ .../drm/amd/display/dc/dce/dce_clock_source.c | 3 +- .../amd/display/dc/dce/dce_stream_encoder.c | 12 +++++ .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 13 +++-- .../amd/display/dc/dcn10/dcn10_link_encoder.c | 49 +++++++++++++++---- .../gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c | 19 +++++++ .../gpu/drm/amd/display/dc/dcn10/dcn10_mpc.h | 4 ++ .../gpu/drm/amd/display/dc/dcn10/dcn10_optc.h | 4 ++ .../display/dc/dcn10/dcn10_stream_encoder.c | 12 +++++ .../display/dc/dcn10/dcn10_stream_encoder.h | 3 ++ .../gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c | 1 + .../gpu/drm/amd/display/dc/dcn20/dcn20_optc.c | 3 +- .../display/dc/dcn20/dcn20_stream_encoder.c | 1 + drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h | 3 ++ .../amd/display/dc/inc/hw/stream_encoder.h | 3 ++ 17 files changed, 172 insertions(+), 36 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +20 -6
@@ -957,7 +957,7 @@ bool dc_validate_seamless_boot_timing(const struct dc *dc, {struct timing_generator *tg;struct dc_link *link = sink->link; -unsigned int inst; +unsigned int enc_inst, tg_inst;/* Check for enabled DIG to identify enabled display */ if (!link->link_enc->funcs->is_dig_enabled (link->link_enc))
@@ -969,13 +969,22 @@ bool dc_validate_seamless_boot_timing(const struct dc *dc,* current implementation always map 1-to-1, so this code makes * the same assumption and doesn't check OTG source. */ - inst = link->link_enc->funcs->get_dig_frontend (link->link_enc) -1 ; + enc_inst = link->link_enc->funcs->get_dig_frontend (link->link_enc);/* Instance should be within the range of the pool */ -if (inst >= dc->res_pool->pipe_count) +if (enc_inst >= dc->res_pool->pipe_count)return false; - tg = dc->res_pool->timing_generators[inst]; +if (enc_inst >= dc->res_pool->stream_enc_count) +return false; + + tg_inst = dc->res_pool->stream_enc[enc_inst]->funcs->dig_source_otg ( + dc->res_pool->stream_enc[enc_inst]); + +if (tg_inst >= dc->res_pool->timing_generator_count) +return false; + + tg = dc->res_pool->timing_generators[tg_inst];if (!tg->funcs->is_matching_timing)return false;
@@ -988,10 +997,11 @@ bool dc_validate_seamless_boot_timing(const struct dc *dc, dc->res_pool->dp_clock_source->funcs->get_pixel_clk_frequency_100hz ( dc->res_pool->dp_clock_source, - inst, &pix_clk_100hz); + tg_inst, &pix_clk_100hz);if (crtc_timing->pix_clk_100hz != pix_clk_100hz)return false; + }return true;
@@ -1901,13 +1911,17 @@ static void commit_planes_do_stream_update(struct dc *dc,if (stream_update->dpms_off) { dc->hwss.pipe_control_lock (dc, pipe_ctx, true); +if (*stream_update->dpms_off) {core_link_disable_stream (pipe_ctx,KEEP_ACQUIRED_RESOURCE ); dc->hwss.optimize_bandwidth (dc, dc->current_state); }else { - dc->hwss.prepare_bandwidth (dc, dc->current_state); +if (!dc->optimize_seamless_boot) + dc->hwss.prepare_bandwidth (dc, dc->current_state); +core_link_enable_stream (dc->current_state, pipe_ctx); } + dc->hwss.pipe_control_lock (dc, pipe_ctx, false); }
drivers/gpu/drm/amd/display/dc/core/dc_link.c +12 -1
@@ -1419,6 +1419,16 @@ static enum dc_status enable_link_dp(#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT bool fec_enable;#endif +int i; +bool apply_seamless_boot_optimization = false; + +// check for seamless boot +for (i =0 ; i < state->stream_count; i++) { +if (state->streams[i]->apply_seamless_boot_optimization) { + apply_seamless_boot_optimization = true; +break ; + } + }/* get link settings for video mode timing */ decide_link_settings (stream, &link_settings);
@@ -1440,7 +1450,8 @@ static enum dc_status enable_link_dp( pipe_ctx->stream_res.pix_clk_params.requested_sym_clk = link_settings.link_rate *LINK_RATE_REF_FREQ_IN_KHZ ; - state->clk_mgr->funcs->update_clocks (state->clk_mgr, state, false); +if (!apply_seamless_boot_optimization) + state->clk_mgr->funcs->update_clocks (state->clk_mgr, state, false); dp_enable_link_phy( link,
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +24 -15
@@ -1890,7 +1890,7 @@ static int acquire_resource_from_hw_enabled_state( struct dc_stream_state *stream) {struct dc_link *link = stream->link; -unsigned int inst; +unsigned int inst, tg_inst;/* Check for enabled DIG to identify enabled display */ if (!link->link_enc->funcs->is_dig_enabled (link->link_enc))
@@ -1902,28 +1902,37 @@ static int acquire_resource_from_hw_enabled_state(* current implementation always map 1-to-1, so this code makes * the same assumption and doesn't check OTG source. */ - inst = link->link_enc->funcs->get_dig_frontend (link->link_enc) -1 ; + inst = link->link_enc->funcs->get_dig_frontend (link->link_enc);/* Instance should be within the range of the pool */ if (inst >= pool->pipe_count)return -1 ; -if (!res_ctx->pipe_ctx[inst].stream) { -struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[inst]; +if (inst >= pool->stream_enc_count) +return -1 ; + + tg_inst = pool->stream_enc[inst]->funcs->dig_source_otg (pool->stream_enc[inst]); + +if (tg_inst >= pool->timing_generator_count) +return false; + +if (!res_ctx->pipe_ctx[tg_inst].stream) { +struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[tg_inst]; + + pipe_ctx->stream_res.tg = pool->timing_generators[tg_inst]; + pipe_ctx->plane_res.mi = pool->mis[tg_inst]; + pipe_ctx->plane_res.hubp = pool->hubps[tg_inst]; + pipe_ctx->plane_res.ipp = pool->ipps[tg_inst]; + pipe_ctx->plane_res.xfm = pool->transforms[tg_inst]; + pipe_ctx->plane_res.dpp = pool->dpps[tg_inst]; + pipe_ctx->stream_res.opp = pool->opps[tg_inst]; - pipe_ctx->stream_res.tg = pool->timing_generators[inst]; - pipe_ctx->plane_res.mi = pool->mis[inst]; - pipe_ctx->plane_res.hubp = pool->hubps[inst]; - pipe_ctx->plane_res.ipp = pool->ipps[inst]; - pipe_ctx->plane_res.xfm = pool->transforms[inst]; - pipe_ctx->plane_res.dpp = pool->dpps[inst]; - pipe_ctx->stream_res.opp = pool->opps[inst]; -if (pool->dpps[inst]) - pipe_ctx->plane_res.mpcc_inst = pool->dpps[inst]->inst; - pipe_ctx->pipe_idx = inst; +if (pool->dpps[tg_inst]) + pipe_ctx->plane_res.mpcc_inst = pool->dpps[tg_inst]->inst; + pipe_ctx->pipe_idx = tg_inst; pipe_ctx->stream = stream; -return inst; +return tg_inst; }return -1 ;
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c +2 -1
@@ -1059,7 +1059,8 @@ static bool dcn20_program_pix_clk(static const struct clock_source_funcs dcn20_clk_src_funcs = { .cs_power_down = dce110_clock_source_power_down, .program_pix_clk = dcn20_program_pix_clk, - .get_pix_clk_dividers = dce112_get_pix_clk_dividers + .get_pix_clk_dividers = dce112_get_pix_clk_dividers, + .get_pixel_clk_frequency_100hz = get_pixel_clk_frequency_100hz };#endif
drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c +12 -0
@@ -1600,6 +1600,17 @@ static void dig_connect_to_otg(REG_UPDATE (DIG_FE_CNTL ,DIG_SOURCE_SELECT , tg_inst); } +static unsigned int dig_source_otg ( +struct stream_encoder *enc) +{ +uint32_t tg_inst =0 ; +struct dce110_stream_encoder *enc110 =DCE110STRENC_FROM_STRENC (enc); + +REG_GET (DIG_FE_CNTL ,DIG_SOURCE_SELECT , &tg_inst); + +return tg_inst; +} +static const struct stream_encoder_funcs dce110_str_enc_funcs = { .dp_set_stream_attribute = dce110_stream_encoder_dp_set_stream_attribute,
@@ -1635,6 +1646,7 @@ static const struct stream_encoder_funcs dce110_str_enc_funcs = { .set_avmute = dce110_stream_encoder_set_avmute, .dig_connect_to_otg = dig_connect_to_otg, .hdmi_reset_stream_attribute = dce110_reset_hdmi_stream_attribute, + .dig_source_otg = dig_source_otg, }; void dce110_stream_encoder_construct(
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +10 -3
@@ -1097,9 +1097,16 @@ static void dcn10_init_pipes(struct dc *dc, struct dc_state *context) } } -/* Cannot reset the MPC mux if seamless boot */ -if (!can_apply_seamless_boot) - dc->res_pool->mpc->funcs->mpc_init (dc->res_pool->mpc); +for (i =0 ; i < dc->res_pool->pipe_count; i++) { +struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i]; + +/* Cannot reset the MPC mux if seamless boot */ +if (pipe_ctx->stream !=NULL && can_apply_seamless_boot) +continue ; + + dc->res_pool->mpc->funcs->mpc_init_single_inst ( + dc->res_pool->mpc, i); + }for (i =0 ; i < dc->res_pool->pipe_count; i++) {struct timing_generator *tg = dc->res_pool->timing_generators[i];
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.c +40 -9
61 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c +19 -0
@@ -364,6 +364,24 @@ void mpc1_mpc_init(struct mpc *mpc) } } +void mpc1_mpc_init_single_inst (struct mpc *mpc,unsigned int mpcc_id) +{ +struct dcn10_mpc *mpc10 =TO_DCN10_MPC (mpc); +int opp_id; + +REG_GET (MPCC_OPP_ID [mpcc_id],MPCC_OPP_ID , &opp_id); + +REG_SET (MPCC_TOP_SEL [mpcc_id],0 ,MPCC_TOP_SEL ,0xf ); +REG_SET (MPCC_BOT_SEL [mpcc_id],0 ,MPCC_BOT_SEL ,0xf ); +REG_SET (MPCC_OPP_ID [mpcc_id],0 ,MPCC_OPP_ID ,0xf ); + +mpc1_init_mpcc (&(mpc->mpcc_array[mpcc_id]), mpcc_id); + +if (opp_id <MAX_OPP &® (MUX [opp_id])) +REG_UPDATE (MUX [opp_id],MPC_OUT_MUX ,0xf ); +} + +void mpc1_init_mpcc_list_from_hw (struct mpc *mpc,struct mpc_tree *tree)
@@ -433,6 +451,7 @@ static const struct mpc_funcs dcn10_mpc_funcs = { .insert_plane = mpc1_insert_plane, .remove_mpcc = mpc1_remove_mpcc, .mpc_init = mpc1_mpc_init, + .mpc_init_single_inst = mpc1_mpc_init_single_inst, .get_mpcc_for_dpp = mpc1_get_mpcc_for_dpp, .wait_for_idle = mpc1_assert_idle_mpcc, .assert_mpcc_idle_before_connect = mpc1_assert_mpcc_idle_before_connect,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.h +4 -0
@@ -149,6 +149,10 @@ void mpc1_remove_mpcc(void mpc1_mpc_init (struct mpc *mpc); +void mpc1_mpc_init_single_inst ( +struct mpc *mpc, +unsigned int mpcc_id); +void mpc1_assert_idle_mpcc (struct mpc *mpc,int id);
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.h +4 -0
@@ -539,6 +539,10 @@ struct dcn_otg_state {void optc1_read_otg_state (struct optc *optc1,struct dcn_otg_state *s); +bool optc1_is_matching_timing ( +struct timing_generator *tg, +const struct dc_crtc_timing *otg_timing); +bool optc1_validate_timing (struct timing_generator *optc,const struct dc_crtc_timing *timing);
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.c +12 -0
@@ -1541,6 +1541,17 @@ void enc1_dig_connect_to_otg(REG_UPDATE (DIG_FE_CNTL ,DIG_SOURCE_SELECT , tg_inst); } +unsigned int enc1_dig_source_otg ( +struct stream_encoder *enc) +{ +uint32_t tg_inst =0 ; +struct dcn10_stream_encoder *enc1 =DCN10STRENC_FROM_STRENC (enc); + +REG_GET (DIG_FE_CNTL ,DIG_SOURCE_SELECT , &tg_inst); + +return tg_inst; +} +static const struct stream_encoder_funcs dcn10_str_enc_funcs = { .dp_set_stream_attribute = enc1_stream_encoder_dp_set_stream_attribute,
@@ -1576,6 +1587,7 @@ static const struct stream_encoder_funcs dcn10_str_enc_funcs = { .set_avmute = enc1_stream_encoder_set_avmute, .dig_connect_to_otg = enc1_dig_connect_to_otg, .hdmi_reset_stream_attribute = enc1_reset_hdmi_stream_attribute, + .dig_source_otg = enc1_dig_source_otg, }; void dcn10_stream_encoder_construct(
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_stream_encoder.h +3 -0
@@ -598,6 +598,9 @@ void enc1_dig_connect_to_otg(struct stream_encoder *enc, int tg_inst); +unsigned int enc1_dig_source_otg ( +struct stream_encoder *enc); +void enc1_stream_encoder_set_stream_attribute_helper (struct dcn10_stream_encoder *enc1,struct dc_crtc_timing *crtc_timing);
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c +1 -0
@@ -498,6 +498,7 @@ const struct mpc_funcs dcn20_mpc_funcs = { .insert_plane = mpc1_insert_plane, .remove_mpcc = mpc1_remove_mpcc, .mpc_init = mpc1_mpc_init, + .mpc_init_single_inst = mpc1_mpc_init_single_inst, .update_blending = mpc2_update_blending, .get_mpcc_for_dpp = mpc2_get_mpcc_for_dpp, .wait_for_idle = mpc2_assert_idle_mpcc,
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_optc.c +2 -1
@@ -522,7 +522,8 @@ static struct timing_generator_funcs dcn20_tg_funcs = { .set_gsl_source_select = optc2_set_gsl_source_select, .set_vtg_params = optc1_set_vtg_params, .program_manual_trigger = optc2_program_manual_trigger, - .setup_manual_trigger = optc2_setup_manual_trigger + .setup_manual_trigger = optc2_setup_manual_trigger, + .is_matching_timing = optc1_is_matching_timing };void dcn20_timing_generator_init (struct optc *optc1)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_stream_encoder.c +1 -0
@@ -578,6 +578,7 @@ static const struct stream_encoder_funcs dcn20_str_enc_funcs = { .setup_stereo_sync = enc1_setup_stereo_sync, .set_avmute = enc1_stream_encoder_set_avmute, .dig_connect_to_otg = enc1_dig_connect_to_otg, + .dig_source_otg = enc1_dig_source_otg,#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT .enc_read_state = enc2_read_state,#endif
drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h +3 -0
@@ -199,6 +199,9 @@ struct mpc_funcs {* Return: void */ void (*mpc_init)(struct mpc *mpc); +void (*mpc_init_single_inst)( +struct mpc *mpc, +unsigned int mpcc_id);/* * Update the blending configuration for a specified MPCC.
drivers/gpu/drm/amd/display/dc/inc/hw/stream_encoder.h +3 -0
@@ -214,6 +214,9 @@ struct stream_encoder_funcs {void (*hdmi_reset_stream_attribute)(struct stream_encoder *enc); +unsigned int (*dig_source_otg)( +struct stream_encoder *enc); +#if defined(CONFIG_DRM_AMD_DC_DCN2_0 )#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT void (*dp_set_dsc_config)(
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 19/49 drm/amd/display: clean up DML for DCN2x
In reply to a message not in the archiveFrom: Jun Lei <[email protected]>
[why]
Previous "less risky" implemenation of 3 tiered fallback is no longer necessary since DMLv2 has gone through proper validation. v2 can now be used as the default and 1 level of fallback can be removed
[how]
remove previous workaround implemenation
--- drivers/gpu/drm/amd/display/dc/dc.h | 1 - .../drm/amd/display/dc/dcn20/dcn20_resource.c | 19 +++---------------- 2 files changed, 3 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/display/dc/dc.h +0 -1
@@ -121,7 +121,6 @@ struct dc_caps {struct dc_bug_wa {bool no_connect_phy_config;bool dedcn20_305_wa; -struct display_mode_lib alternate_dml;bool skip_clock_update; };#endif
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +3 -16
@@ -2610,7 +2610,7 @@ bool dcn20_validate_bandwidth(struct dc *dc, struct dc_state *context, goto restore_dml_state; } -// Fallback #1: Try to only support G6 temperature read latency +// Fallback: Try to only support G6 temperature read latency context->bw_ctx.dml.soc.dram_clock_change_latency_us = context->bw_ctx.dml.soc.dummy_pstate_latency_us; voltage_supported =dcn20_validate_bandwidth_internal (dc, context, false);
@@ -2621,19 +2621,7 @@ bool dcn20_validate_bandwidth(struct dc *dc, struct dc_state *context, goto restore_dml_state; } -// Fallback #2: Retry with "new" DCN20 to support G6 temperature read latency -memcpy (&context->bw_ctx.dml, &dc->work_arounds.alternate_dml,sizeof (struct display_mode_lib )); - context->bw_ctx.dml.soc.dram_clock_change_latency_us = context->bw_ctx.dml.soc.dummy_pstate_latency_us; - - voltage_supported =dcn20_validate_bandwidth_internal (dc, context, false); - dummy_pstate_supported = context->bw_ctx.bw.dcn.clk.p_state_change_support; - -if (voltage_supported && dummy_pstate_supported) { - context->bw_ctx.bw.dcn.clk.p_state_change_support = false; - goto restore_dml_state; - } - -// ERROR: fallback #2 is supposed to always work. +// ERROR: fallback is supposed to always work. ASSERT (false); restore_dml_state:
@@ -3238,8 +3226,7 @@ static bool construct( goto create_fail; } -dml_init_instance (&dc->dml, &dcn2_0_soc, &dcn2_0_ip,DML_PROJECT_NAVI10 ); -dml_init_instance (&dc->work_arounds.alternate_dml, &dcn2_0_soc, &dcn2_0_ip, DML_PROJECT_NAVI10v2); +dml_init_instance (&dc->dml, &dcn2_0_soc, &dcn2_0_ip, DML_PROJECT_NAVI10v2);if (!dc->debug.disable_pplib_wm_range) {struct pp_smu_wm_range_sets ranges = {0 };
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 20/49 drm/amd/display: Add HLG support in color module
In reply to a message not in the archiveFrom: Vitaly Prosyak <[email protected]>
[Why & How]
Support hlg OETF and EOTF based on BT.2100-2 Follow up is required.
--- .../amd/display/modules/color/color_gamma.c | 102 +++++++++++------- 1 file changed, 61 insertions(+), 41 deletions(-)
drivers/gpu/drm/amd/display/modules/color/color_gamma.c +61 -41
@@ -27,7 +27,6 @@#include "opp.h" #include "color_gamma.h" -#define NUM_PTS_IN_REGION 16#define NUM_REGIONS 32#define MAX_HW_POINTS (NUM_PTS_IN_REGION*NUM_REGIONS)
@@ -159,59 +158,68 @@ static void compute_de_pq(struct fixed31_32 in_x, struct fixed31_32 *out_y) } +/*de gamma, none linear to linear*/ -static void compute_hlg_oetf (struct fixed31_32 in_x,bool is_light0_12,struct fixed31_32 *out_y) +static void compute_hlg_eotf (struct fixed31_32 in_x, +struct fixed31_32 *out_y, +uint32_t sdr_white_level,uint32_t max_luminance_nits) {struct fixed31_32 a;struct fixed31_32 b;struct fixed31_32 c;struct fixed31_32 threshold; -struct fixed31_32 reference_white_level; +struct fixed31_32 x; +struct fixed31_32 scaling_factor = +dc_fixpt_from_fraction (max_luminance_nits, sdr_white_level); a =dc_fixpt_from_fraction (17883277 ,100000000 ); -if (is_light0_12) { -/*light 0-12*/ - b =dc_fixpt_from_fraction (28466892 ,100000000 ); - c =dc_fixpt_from_fraction (55991073 ,100000000 ); - threshold = dc_fixpt_one; - reference_white_level = dc_fixpt_half; + b =dc_fixpt_from_fraction (28466892 ,100000000 ); + c =dc_fixpt_from_fraction (55991073 ,100000000 ); + threshold =dc_fixpt_from_fraction (1 ,2 ); + +if (dc_fixpt_lt (in_x, threshold)) { + x =dc_fixpt_mul (in_x, in_x); + x =dc_fixpt_div_int (x,3 ); }else { -/*light 0-1*/ - b =dc_fixpt_from_fraction (2372241 ,100000000 ); - c =dc_fixpt_add (dc_fixpt_one,dc_fixpt_from_fraction (429347 ,100000000 )); - threshold =dc_fixpt_from_fraction (1 ,12 ); - reference_white_level =dc_fixpt_pow (dc_fixpt_from_fraction (3 ,1 ), dc_fixpt_half); + x =dc_fixpt_sub (in_x, c); + x =dc_fixpt_div (x, a); + x =dc_fixpt_exp (x); + x =dc_fixpt_add (x, b); + x =dc_fixpt_div_int (x,12 ); } -if (dc_fixpt_lt (threshold, in_x)) - *out_y =dc_fixpt_add (c,dc_fixpt_mul (a,dc_fixpt_log (dc_fixpt_sub (in_x, b)))); -else - *out_y =dc_fixpt_mul (dc_fixpt_pow (in_x, dc_fixpt_half), reference_white_level); + *out_y =dc_fixpt_mul (x, scaling_factor); + }/*re gamma, linear to none linear*/ -static void compute_hlg_eotf (struct fixed31_32 in_x,bool is_light0_12,struct fixed31_32 *out_y) +static void compute_hlg_oetf (struct fixed31_32 in_x,struct fixed31_32 *out_y, +uint32_t sdr_white_level,uint32_t max_luminance_nits) {struct fixed31_32 a;struct fixed31_32 b;struct fixed31_32 c; -struct fixed31_32 reference_white_level; +struct fixed31_32 threshold; +struct fixed31_32 x; +struct fixed31_32 scaling_factor = +dc_fixpt_from_fraction (sdr_white_level, max_luminance_nits); a =dc_fixpt_from_fraction (17883277 ,100000000 ); -if (is_light0_12) { -/*light 0-12*/ - b =dc_fixpt_from_fraction (28466892 ,100000000 ); - c =dc_fixpt_from_fraction (55991073 ,100000000 ); - reference_white_level =dc_fixpt_from_fraction (4 ,1 ); + b =dc_fixpt_from_fraction (28466892 ,100000000 ); + c =dc_fixpt_from_fraction (55991073 ,100000000 ); + threshold =dc_fixpt_from_fraction (1 ,12 ); + x =dc_fixpt_mul (in_x, scaling_factor); + + +if (dc_fixpt_lt (x, threshold)) { + x =dc_fixpt_mul (x,dc_fixpt_from_fraction (3 ,1 )); + *out_y =dc_fixpt_pow (x, dc_fixpt_half); }else { -/*light 0-1*/ - b =dc_fixpt_from_fraction (2372241 ,100000000 ); - c =dc_fixpt_add (dc_fixpt_one,dc_fixpt_from_fraction (429347 ,100000000 )); - reference_white_level =dc_fixpt_from_fraction (1 ,3 ); + x =dc_fixpt_mul (x,dc_fixpt_from_fraction (12 ,1 )); + x =dc_fixpt_sub (x, b); + x =dc_fixpt_log (x); + x =dc_fixpt_mul (a, x); + *out_y =dc_fixpt_add (x, c); } -if (dc_fixpt_lt (dc_fixpt_half, in_x)) - *out_y =dc_fixpt_add (dc_fixpt_exp (dc_fixpt_div (dc_fixpt_sub (in_x, c), a)), b); -else - *out_y =dc_fixpt_mul (dc_fixpt_pow (in_x,dc_fixpt_from_fraction (2 ,1 )), reference_white_level); }
@@ -997,9 +1005,14 @@ static bool build_degamma(struct pwl_float_data_ex *curve,return ret; } + + + +static void build_hlg_degamma (struct pwl_float_data_ex *degamma,uint32_t hw_points_num, -const struct hw_x_point *coordinate_x,bool is_light0_12) +const struct hw_x_point *coordinate_x, +uint32_t sdr_white_level,uint32_t max_luminance_nits) {uint32_t i;
@@ -1007,9 +1020,9 @@ static void build_hlg_degamma(struct pwl_float_data_ex *degamma,const struct hw_x_point *coord_x = coordinate_x; i =0 ; - +//check when i == 434 while (i != hw_points_num +1 ) { -compute_hlg_oetf (coord_x->x, is_light0_12, &rgb->r); +compute_hlg_eotf (coord_x->x, &rgb->r, sdr_white_level, max_luminance_nits); rgb->g = rgb->r; rgb->b = rgb->r; ++coord_x;
@@ -1018,9 +1031,11 @@ static void build_hlg_degamma(struct pwl_float_data_ex *degamma, } } +static void build_hlg_regamma (struct pwl_float_data_ex *regamma,uint32_t hw_points_num, -const struct hw_x_point *coordinate_x,bool is_light0_12) +const struct hw_x_point *coordinate_x, +uint32_t sdr_white_level,uint32_t max_luminance_nits) {uint32_t i;
@@ -1029,8 +1044,9 @@ static void build_hlg_regamma(struct pwl_float_data_ex *regamma, i =0 ; +//when i == 471 while (i != hw_points_num +1 ) { -compute_hlg_eotf (coord_x->x, is_light0_12, &rgb->r); +compute_hlg_oetf (coord_x->x, &rgb->r, sdr_white_level, max_luminance_nits); rgb->g = rgb->r; rgb->b = rgb->r; ++coord_x;
@@ -1916,7 +1932,7 @@ bool mod_color_calculate_degamma_params(struct dc_transfer_func *input_tf,build_hlg_degamma (curve,MAX_HW_POINTS , coordinates_x, - true); +80 ,1000 ); else if (tf == TRANSFER_FUNCTION_LINEAR) {// just copy coordinates_x into curve i =0 ;
@@ -2035,11 +2051,15 @@ bool mod_color_calculate_curve(enum dc_transfer_func_predefined trans, GFP_KERNEL);if (!rgb_regamma) goto rgb_regamma_alloc_fail; + points->end_exponent =4 ; + points->x_point_at_y1_red =12 ; + points->x_point_at_y1_green =12 ; + points->x_point_at_y1_blue =12 ;build_hlg_regamma (rgb_regamma,MAX_HW_POINTS , coordinates_x, - true); +80 ,1000 );for (i =0 ; i <=MAX_HW_POINTS ; i++) { points->red[i] = rgb_regamma[i].r; points->green[i] = rgb_regamma[i].g;
@@ -2121,7 +2141,7 @@ bool mod_color_calculate_degamma_curve(enum dc_transfer_func_predefined trans,build_hlg_degamma (rgb_degamma,MAX_HW_POINTS , coordinates_x, - true); +80 ,1000 );for (i =0 ; i <=MAX_HW_POINTS ; i++) { points->red[i] = rgb_degamma[i].r; points->green[i] = rgb_degamma[i].g;
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 21/49 drm/amd/display: Change DSC policy from slices per column to minimum slice height
In reply to a message not in the archiveFrom: Nikola Cornij <[email protected]>
[why] Minimum slice height is recommended by VESA DSC Spreadsheet user guide
--- drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c | 71 ++++++++++----------- 1 file changed, 32 insertions(+), 39 deletions(-)
drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c +32 -39
@@ -28,6 +28,23 @@#include "dsc.h" #include <drm/drm_dp_helper.h> +struct dc_dsc_policy { +bool use_min_slices_h; +int max_slices_h;// Maximum available if 0 +int min_sice_height;// Must not be less than 8 +int max_target_bpp; +int min_target_bpp;// Minimum target bits per pixel +}; + +const struct dc_dsc_policy dsc_policy = { + .use_min_slices_h = true,// DSC Policy: Use minimum number of slices that fits the pixel clock + .max_slices_h =0 ,// DSC Policy: Use max available slices (in our case 4 for or 8, depending on the mode) + .min_sice_height =108 ,// DSC Policy: Use slice height recommended by VESA DSC Spreadsheet user guide + .max_target_bpp =16 , + .min_target_bpp =8 , +}; + +/* This module's internal functions */ static bool dsc_buff_block_size_from_dpcd (int dpcd_buff_block_size,int *buff_block_size)
@@ -241,14 +258,6 @@ static bool intersect_dsc_caps(return true; } -struct dc_dsc_policy { -bool use_min_slices_h; -int max_slices_h;// Maximum available if 0 -int num_slices_v; -int max_target_bpp; -int min_target_bpp;// Minimum target bits per pixel -}; -static inline uint32_t dsc_div_by_10_round_up (uint32_t value) {return (value +9 ) /10 ;
@@ -270,19 +279,6 @@ static inline uint32_t calc_dsc_bpp_x16(uint32_t stream_bandwidth_kbps, uint32_treturn dsc_target_bpp_x16; } -const struct dc_dsc_policy dsc_policy = { - .use_min_slices_h = true,// DSC Policy: Use minimum number of slices that fits the pixel clock - .max_slices_h =0 ,// DSC Policy: Use max available slices (in our case 4 for or 8, depending on the mode) -/* DSC Policy: Number of vertical slices set to 2 for no particular reason. -* Seems small enough to not affect the quality too much, while still providing some error -* propagation control (which may also help debugging). -*/ - .num_slices_v =16 , - .max_target_bpp =16 , - .min_target_bpp =8 , -}; - -/* Get DSC bandwidth range based on [min_bpp, max_bpp] target bitrate range, and timing's pixel clock * and uncompressed bandwidth. */
@@ -528,8 +524,8 @@ static bool setup_dsc_config(int sink_per_slice_throughput_mps;int branch_max_throughput_mps =0 ;bool is_dsc_possible = false; -int num_slices_v;int pic_height; +int slice_height;memset (dsc_cfg,0 ,sizeof (struct dc_dsc_config ));
@@ -615,7 +611,7 @@ static bool setup_dsc_config(if (!is_dsc_possible) goto done; -// DSC slicing +// Slice width (i.e. number of slices per line) max_slices_h =get_max_dsc_slices (dsc_common_caps.slice_caps);while (max_slices_h >0 ) {
@@ -678,29 +674,26 @@ static bool setup_dsc_config( dsc_cfg->num_slices_h = num_slices_h; slice_width = pic_width / num_slices_h; -// Vertical number of slices: start from policy and pick the first one that height is divisible by. + is_dsc_possible = slice_width <= dsc_common_caps.max_slice_width; +if (!is_dsc_possible) + goto done; + +// Slice height (i.e. number of slices per column): start with policy and pick the first one that height is divisible by. // For 4:2:0 make sure the slice height is divisible by 2 as well. - num_slices_v = dsc_policy.num_slices_v; -if (num_slices_v <1 ) - num_slices_v =1 ; - -while (num_slices_v >=1 ) { -if (timing->pixel_encoding ==PIXEL_ENCODING_YCBCR420 ) { -int slice_height = pic_height / num_slices_v; -if (pic_height % num_slices_v ==0 && slice_height %2 ==0 ) -break ; - }else if (pic_height % num_slices_v ==0 ) -break ; + slice_height =min (dsc_policy.min_sice_height, pic_height); - num_slices_v--; - } +while (slice_height < pic_height && (pic_height % slice_height !=0 || + (timing->pixel_encoding ==PIXEL_ENCODING_YCBCR420 && slice_height %2 !=0 ))) + slice_height++; - dsc_cfg->num_slices_v = num_slices_v; +if (timing->pixel_encoding ==PIXEL_ENCODING_YCBCR420 )// For the case when pic_height < dsc_policy.min_sice_height + is_dsc_possible = (slice_height %2 ==0 ); - is_dsc_possible = slice_width <= dsc_common_caps.max_slice_width;if (!is_dsc_possible) goto done; + dsc_cfg->num_slices_v = pic_height/slice_height; +// Final decission: can we do DSC or not? if (is_dsc_possible) {// Fill out the rest of DSC settings
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 22/49 drm/amd/display: Set DSC before DIG front-end is connected to its back-end
In reply to a message not in the archiveFrom: Nikola Cornij <[email protected]>
[why]
At the time DIG FE is connected to its BE, the clocks in OTG are enabled and PHY will also be set up. When DSC has to be used to fit the stream into the available bandwidth, without DSC being set DIG could get exposed to the higer bandwidth it (or link) could handle. This causes the HW to "reject" video enable setup (the register shows that video enable was attempted, but the status bit shows it as disabled).
[how]
- Separate DSC setup into DSC register config and DSC PPS SDP setup
- Move most of the DSC setup (register config) to before dcn10_link_encoder_connect_dig_be_to_fe() is called
- Set up DSC PPS SDP after DIG FE is connected to its BE. This is because setting DSC PPS SDP before that has no effect.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 20 ++-- .../drm/amd/display/dc/core/dc_link_hwss.c | 78 +++++++++++--- .../gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c | 100 ++++++++++-------- .../display/dc/dcn20/dcn20_stream_encoder.c | 25 +++-- .../gpu/drm/amd/display/dc/inc/dc_link_dp.h | 3 +- drivers/gpu/drm/amd/display/dc/inc/hw/dsc.h | 4 +- .../amd/display/dc/inc/hw/stream_encoder.h | 12 ++- 7 files changed, 158 insertions(+), 84 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +13 -7
@@ -2725,21 +2725,27 @@ void core_link_enable_stream(CONTROLLER_DP_TEST_PATTERN_VIDEOMODE , COLOR_DEPTH_UNDEFINED); +#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT +if (pipe_ctx->stream->timing.flags.DSC) { +if (dc_is_dp_signal (pipe_ctx->stream->signal) || +dc_is_virtual_signal (pipe_ctx->stream->signal)) +dp_set_dsc_enable (pipe_ctx, true); + } +#endif core_dc->hwss.enable_stream (pipe_ctx); -if (pipe_ctx->stream->signal ==SIGNAL_TYPE_DISPLAY_PORT_MST ) -allocate_mst_payload (pipe_ctx); -#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT +/* Set DPS PPS SDP (AKA "info frames") */ if (pipe_ctx->stream->timing.flags.DSC) {if (dc_is_dp_signal (pipe_ctx->stream->signal) ||dc_is_virtual_signal (pipe_ctx->stream->signal)) -dp_set_dsc_enable (pipe_ctx, true); - pipe_ctx->stream_res.tg->funcs->wait_for_state ( - pipe_ctx->stream_res.tg, -CRTC_STATE_VBLANK ); +dp_set_dsc_pps_sdp (pipe_ctx, true); }#endif + +if (pipe_ctx->stream->signal ==SIGNAL_TYPE_DISPLAY_PORT_MST ) +allocate_mst_payload (pipe_ctx); + core_dc->hwss.unblank_stream (pipe_ctx, &pipe_ctx->stream->link->cur_link_settings);
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +61 -17
145 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c +58 -42
183 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_stream_encoder.c +14 -11
@@ -205,9 +205,8 @@ static void enc2_stream_encoder_stop_hdmi_info_packets(#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT -/* Update GSP7 SDP 128 byte long */ -static void enc2_send_gsp7_128_info_packet ( +static void enc2_update_gsp7_128_info_packet (struct dcn10_stream_encoder *enc1,const struct dc_info_packet_128 *info_packet) {
@@ -275,8 +274,7 @@ static void enc2_send_gsp7_128_info_packet(static void enc2_dp_set_dsc_config (struct stream_encoder *enc,enum optc_dsc_mode dsc_mode,uint32_t dsc_bytes_per_pixel, -uint32_t dsc_slice_width, -uint8_t *dsc_packed_pps) +uint32_t dsc_slice_width) {struct dcn10_stream_encoder *enc1 =DCN10STRENC_FROM_STRENC (enc);uint32_t dsc_value =0 ;
@@ -294,8 +292,16 @@ static void enc2_dp_set_dsc_config(struct stream_encoder *enc,REG_SET (DP_DSC_BYTES_PER_PIXEL ,0 ,DP_DSC_BYTES_PER_PIXEL , dsc_bytes_per_pixel); +} + + +static void enc2_dp_set_dsc_pps_info_packet (struct stream_encoder *enc, +bool enable, +uint8_t *dsc_packed_pps) +{ +struct dcn10_stream_encoder *enc1 =DCN10STRENC_FROM_STRENC (enc); -if (dsc_mode !=OPTC_DSC_DISABLED ) { +if (enable) {struct dc_info_packet_128 pps_sdp;ASSERT (dsc_packed_pps);
@@ -307,7 +313,7 @@ static void enc2_dp_set_dsc_config(struct stream_encoder *enc, pps_sdp.hb2 =127 ; pps_sdp.hb3 =0 ;memcpy (&pps_sdp.sb[0 ], dsc_packed_pps,sizeof (pps_sdp.sb)); -enc2_send_gsp7_128_info_packet (enc1, &pps_sdp); +enc2_update_gsp7_128_info_packet (enc1, &pps_sdp);/* Enable Generic Stream Packet 7 (GSP) transmission */ //REG_UPDATE(DP_SEC_CNTL,
@@ -338,9 +344,8 @@ static void enc2_dp_set_dsc_config(struct stream_encoder *enc,REG_UPDATE (DP_SEC_CNTL2 ,DP_SEC_GSP7_PPS ,0 ); } } -#endif -#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT +/* this function read dsc related register fields to be logged later in dcn10_log_hw_state * into a dcn_dsc_state struct. */
@@ -581,10 +586,8 @@ static const struct stream_encoder_funcs dcn20_str_enc_funcs = { .dig_source_otg = enc1_dig_source_otg, #ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT .enc_read_state = enc2_read_state, -#endif - -#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT .dp_set_dsc_config = enc2_dp_set_dsc_config, + .dp_set_dsc_pps_info_packet = enc2_dp_set_dsc_pps_info_packet, #endif .set_dynamic_metadata = enc2_set_dynamic_metadata, .hdmi_reset_stream_attribute = enc1_reset_hdmi_stream_attribute,
drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h +2 -1
@@ -69,7 +69,8 @@ void dp_set_panel_mode(struct dc_link *link, enum dp_panel_mode panel_mode);void dp_set_fec_ready (struct dc_link *link,bool ready);void dp_set_fec_enable (struct dc_link *link,bool enable);bool dp_set_dsc_enable (struct pipe_ctx *pipe_ctx,bool enable); -void set_dsc_on_stream (struct pipe_ctx *pipe_ctx,bool enable); +bool dp_set_dsc_pps_sdp (struct pipe_ctx *pipe_ctx,bool enable); +void dp_set_dsc_on_stream (struct pipe_ctx *pipe_ctx,bool enable);bool dp_update_dsc_config (struct pipe_ctx *pipe_ctx);#endif
drivers/gpu/drm/amd/display/dc/inc/hw/dsc.h +3 -1
@@ -92,7 +92,9 @@ struct dsc_funcs {void (*dsc_read_state)(struct display_stream_compressor *dsc,struct dcn_dsc_state *s);bool (*dsc_validate_stream)(struct display_stream_compressor *dsc,const struct dsc_config *dsc_cfg);void (*dsc_set_config)(struct display_stream_compressor *dsc,const struct dsc_config *dsc_cfg, -struct dsc_optc_config *dsc_optc_cfg,uint8_t *dsc_packed_pps); +struct dsc_optc_config *dsc_optc_cfg); +bool (*dsc_get_packed_pps)(struct display_stream_compressor *dsc,const struct dsc_config *dsc_cfg, +uint8_t *dsc_packed_pps);void (*dsc_enable)(struct display_stream_compressor *dsc,int opp_pipe);void (*dsc_disable)(struct display_stream_compressor *dsc); };
drivers/gpu/drm/amd/display/dc/inc/hw/stream_encoder.h +7 -5
@@ -122,9 +122,6 @@ struct enc_state {#endif struct stream_encoder_funcs { -#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT -void (*enc_read_state)(struct stream_encoder *enc,struct enc_state *s); -#endif void (*dp_set_stream_attribute)( struct stream_encoder *enc, struct dc_crtc_timing *crtc_timing,
@@ -219,12 +216,17 @@ struct stream_encoder_funcs {#if defined(CONFIG_DRM_AMD_DC_DCN2_0 )#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT +void (*enc_read_state)(struct stream_encoder *enc,struct enc_state *s); +void (*dp_set_dsc_config)(struct stream_encoder *enc,enum optc_dsc_mode dsc_mode,uint32_t dsc_bytes_per_pixel, -uint32_t dsc_slice_width, -uint8_t *dsc_packed_pps); +uint32_t dsc_slice_width); + +void (*dp_set_dsc_pps_info_packet)(struct stream_encoder *enc, +bool enable, +uint8_t *dsc_packed_pps);#endif void (*set_dynamic_metadata)(struct stream_encoder *enc,
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 23/49 drm/amd/display: 3.2.44
In reply to a message not in the archiveFrom: Aric Cyr <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
@@ -39,7 +39,7 @@#include "inc/hw/dmcu.h" #include "dml/display_mode_lib.h" -#define DC_VER "3.2.43" +#define DC_VER "3.2.44"#define MAX_SURFACES 3#define MAX_PLANES 6
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 24/49 drm/amd/display: fix pipe selection logic in validate
In reply to a message not in the archiveFrom: Jun Lei <[email protected]>
[why]
Resource mapping done in dcn20_validate_bandwidth has a flaw: When a full update is performed, the HWSS will only update the MPCC tree for the stream that is updated as opposed to all streams. This means that when mapping pipes in validation, care must be taken to not change any existing mapping, otherwise it leads to partial hw programming
[how]
it's not strictly necessary to track which stream/mpcc tree is being updated, but rather it's sufficient to compare current and new state and just keep pipes that were previously already mapped unchanged.
--- .../drm/amd/display/dc/dcn20/dcn20_resource.c | 72 ++++++++++++++++++- 1 file changed, 70 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +70 -2
@@ -2126,6 +2126,74 @@ static bool dcn20_validate_dsc(struct dc *dc, struct dc_state *new_ctx) }#endif +static struct pipe_ctx *dcn20_find_secondary_pipe (struct dc *dc, +struct resource_context *res_ctx, +const struct resource_pool *pool, +const struct pipe_ctx *primary_pipe) +{ +struct pipe_ctx *secondary_pipe =NULL ; + +if (dc && primary_pipe) { +int j; +int preferred_pipe_idx =0 ; + +/* first check the prev dc state: +* if this primary pipe has a bottom pipe in prev. state +* and if the bottom pipe is still available (which it should be), +* pick that pipe as secondary +*/ +if (dc->current_state->res_ctx.pipe_ctx[primary_pipe->pipe_idx].bottom_pipe) { + preferred_pipe_idx = dc->current_state->res_ctx.pipe_ctx[primary_pipe->pipe_idx].bottom_pipe->pipe_idx; +if (res_ctx->pipe_ctx[preferred_pipe_idx].stream ==NULL ) { + secondary_pipe = &res_ctx->pipe_ctx[preferred_pipe_idx]; + secondary_pipe->pipe_idx = preferred_pipe_idx; + } + } + +/* +* if this primary pipe does not have a bottom pipe in prev. state +* start backward and find a pipe that did not used to be a bottom pipe in +* prev. dc state. This way we make sure we keep the same assignment as +* last state and will not have to reprogram every pipe +*/ +if (secondary_pipe ==NULL ) { +for (j = dc->res_pool->pipe_count -1 ; j >=0 ; j--) { +if (dc->current_state->res_ctx.pipe_ctx[j].top_pipe ==NULL ) { + preferred_pipe_idx = j; + +if (res_ctx->pipe_ctx[preferred_pipe_idx].stream ==NULL ) { + secondary_pipe = &res_ctx->pipe_ctx[preferred_pipe_idx]; + secondary_pipe->pipe_idx = preferred_pipe_idx; +break ; + } + } + } + } +/* +* We should never hit this assert unless assignments are shuffled around +* if this happens we will prob. hit a vsync tdr +*/ +ASSERT (secondary_pipe); +/* +* search backwards for the second pipe to keep pipe +* assignment more consistent +*/ +if (secondary_pipe ==NULL ) { +for (j = dc->res_pool->pipe_count -1 ; j >=0 ; j--) { + preferred_pipe_idx = j; + +if (res_ctx->pipe_ctx[preferred_pipe_idx].stream ==NULL ) { + secondary_pipe = &res_ctx->pipe_ctx[preferred_pipe_idx]; + secondary_pipe->pipe_idx = preferred_pipe_idx; +break ; + } + } + } + } + +return secondary_pipe; +} + bool dcn20_fast_validate_bw( struct dc *dc, struct dc_state *context,
@@ -2279,7 +2347,7 @@ bool dcn20_fast_validate_bw(if (force_split && context->bw_ctx.dml.vba.NoOfDPP[vlevel][context->bw_ctx.dml.vba.maxMpcComb][pipe_idx] ==1 ) context->bw_ctx.dml.vba.RequiredDPPCLK[vlevel][context->bw_ctx.dml.vba.maxMpcComb][pipe_idx] /=2 ; if (!pipe->top_pipe && !pipe->plane_state && context->bw_ctx.dml.vba.ODMCombineEnabled[pipe_idx]) { - hsplit_pipe = find_idle_secondary_pipe(&context->res_ctx, dc->res_pool, pipe); + hsplit_pipe = dcn20_find_secondary_pipe(dc, &context->res_ctx, dc->res_pool, pipe); ASSERT(hsplit_pipe); if (!dcn20_split_stream_for_combine( &context->res_ctx, dc->res_pool,
@@ -2320,7 +2388,7 @@ bool dcn20_fast_validate_bw(if (need_split3d || need_split || force_split) {if (!hsplit_pipe || hsplit_pipe->plane_state != pipe->plane_state) {/* pipe not split previously needs split */ - hsplit_pipe =find_idle_secondary_pipe (&context->res_ctx, dc->res_pool, pipe); + hsplit_pipe =dcn20_find_secondary_pipe (dc, &context->res_ctx, dc->res_pool, pipe);ASSERT (hsplit_pipe || force_split);if (!hsplit_pipe)continue ;
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 25/49 drm/amd/display: Remove duplicate interface for programming FB
In reply to a message not in the archiveFrom: Julian Parkin <[email protected]>
[Why]
There are currently two interfaces for exactly the same thing:hupb_update_dchub in hupb and update_dchub in hubbub. The hubbub version is currently unused past dcn10, largely because the call from the dcn10 hardware sequencer does not call through the interface, so the hupb interface was used instead. This is confusing because of the duplicate code, the unused functions, and the fact that more that one block currently owns this set of registers.
[How]
Remove the hubp interface entirely, as well as the register declarations that are not longer needed because of this. Change the call site to always call the hubbub version through the interface. Fix the update_dchub function in dcn20_hubbub.c to program the correct registers for dcn20.
--- .../gpu/drm/amd/display/dc/dcn10/dcn10_hubp.h | 24 ------ .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 10 +-- .../drm/amd/display/dc/dcn20/dcn20_hubbub.c | 81 +++++++++++-------- .../gpu/drm/amd/display/dc/dcn20/dcn20_hubp.c | 76 ----------------- .../gpu/drm/amd/display/dc/dcn20/dcn20_hubp.h | 16 ---- drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h | 3 - 6 files changed, 50 insertions(+), 160 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.h +0 -24
@@ -125,8 +125,6 @@SRI (DCN_VM_SYSTEM_APERTURE_LOW_ADDR_LSB ,HUBPREQ , id),\SRI (DCN_VM_SYSTEM_APERTURE_HIGH_ADDR_MSB ,HUBPREQ , id),\SRI (DCN_VM_SYSTEM_APERTURE_HIGH_ADDR_LSB ,HUBPREQ , id),\ -SR (DCHUBBUB_SDPIF_FB_BASE ),\ -SR (DCHUBBUB_SDPIF_FB_OFFSET ),\SRI (CURSOR_SETTINS ,HUBPREQ , id), \SRI (CURSOR_SURFACE_ADDRESS_HIGH ,CURSOR , id), \ SRI(CURSOR_SURFACE_ADDRESS, CURSOR, id), \
@@ -226,14 +224,6 @@uint32_t DCN_VM_SYSTEM_APERTURE_HIGH_ADDR_LSB ; \uint32_t DCN_VM_SYSTEM_APERTURE_LOW_ADDR ; \uint32_t DCN_VM_SYSTEM_APERTURE_HIGH_ADDR ; \ -uint32_t DCHUBBUB_SDPIF_FB_BASE ; \ -uint32_t DCHUBBUB_SDPIF_FB_OFFSET ; \ -uint32_t DCN_VM_FB_LOCATION_TOP ; \ -uint32_t DCN_VM_FB_LOCATION_BASE ; \ -uint32_t DCN_VM_FB_OFFSET ; \ -uint32_t DCN_VM_AGP_BASE ; \ -uint32_t DCN_VM_AGP_BOT ; \ -uint32_t DCN_VM_AGP_TOP ; \uint32_t CURSOR_SETTINS ; \uint32_t CURSOR_SETTINGS ; \uint32_t CURSOR_SURFACE_ADDRESS_HIGH ; \
@@ -417,8 +407,6 @@HUBP_SF (HUBPREQ0_DCN_VM_SYSTEM_APERTURE_LOW_ADDR_LSB ,MC_VM_SYSTEM_APERTURE_LOW_ADDR_LSB , mask_sh),\HUBP_SF (HUBPREQ0_DCN_VM_SYSTEM_APERTURE_HIGH_ADDR_MSB ,MC_VM_SYSTEM_APERTURE_HIGH_ADDR_MSB , mask_sh),\HUBP_SF (HUBPREQ0_DCN_VM_SYSTEM_APERTURE_HIGH_ADDR_LSB ,MC_VM_SYSTEM_APERTURE_HIGH_ADDR_LSB , mask_sh),\ -HUBP_SF (DCHUBBUB_SDPIF_FB_BASE ,SDPIF_FB_BASE , mask_sh),\ -HUBP_SF (DCHUBBUB_SDPIF_FB_OFFSET ,SDPIF_FB_OFFSET , mask_sh),\HUBP_SF (HUBPREQ0_DCN_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB ,MC_VM_SYSTEM_APERTURE_DEFAULT_SYSTEM , mask_sh),\HUBP_SF (HUBPREQ0_DCN_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB ,MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB , mask_sh),\ HUBP_SF(HUBPREQ0_DCN_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB, MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB, mask_sh),\
@@ -593,18 +581,6 @@type MC_VM_SYSTEM_APERTURE_HIGH_ADDR_LSB ;\type MC_VM_SYSTEM_APERTURE_LOW_ADDR ;\type MC_VM_SYSTEM_APERTURE_HIGH_ADDR ;\ -type SDPIF_FB_TOP ;\ -type SDPIF_FB_BASE ;\ -type SDPIF_FB_OFFSET ;\ -type SDPIF_AGP_BASE ;\ -type SDPIF_AGP_BOT ;\ -type SDPIF_AGP_TOP ;\ -type FB_TOP ;\ -type FB_BASE ;\ -type FB_OFFSET ;\ -type AGP_BASE ;\ -type AGP_BOT ;\ -type AGP_TOP ;\type DCN_VM_SYSTEM_APERTURE_DEFAULT_SYSTEM ;\type DCN_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB ;\type DCN_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB ;\
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +3 -7
@@ -2857,14 +2857,10 @@ static void dcn10_update_pending_status(struct pipe_ctx *pipe_ctx)static void dcn10_update_dchub (struct dce_hwseq *hws,struct dchub_init_data *dh_data) { -if (hws->ctx->dc->res_pool->hubbub !=NULL ) { -struct hubp *hubp = hws->ctx->dc->res_pool->hubps[0 ]; +struct hubbub *hubbub = hws->ctx->dc->res_pool->hubbub; -if (hubp->funcs->hubp_update_dchub) - hubp->funcs->hubp_update_dchub (hubp, dh_data); -else -hubbub1_update_dchub (hws->ctx->dc->res_pool->hubbub, dh_data); - } +/* In DCN, this programming sequence is owned by the hubbub */ + hubbub->funcs->update_dchub (hubbub, dh_data); }static void dcn10_set_cursor_position (struct pipe_ctx *pipe_ctx)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubbub.c +47 -34
101 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubp.c +0 -76
88 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubp.h +0 -16
@@ -38,12 +38,6 @@SRI (PREFETCH_SETTINGS_C ,HUBPREQ , id),\SRI (DCN_VM_SYSTEM_APERTURE_LOW_ADDR ,HUBPREQ , id),\SRI (DCN_VM_SYSTEM_APERTURE_HIGH_ADDR ,HUBPREQ , id),\ -SR (DCN_VM_FB_LOCATION_TOP ),\ -SR (DCN_VM_FB_LOCATION_BASE ),\ -SR (DCN_VM_FB_OFFSET ),\ -SR (DCN_VM_AGP_BASE ),\ -SR (DCN_VM_AGP_BOT ),\ -SR (DCN_VM_AGP_TOP ),\SRI (CURSOR_SETTINGS ,HUBPREQ , id), \SRI (CURSOR_SURFACE_ADDRESS_HIGH ,CURSOR0_ , id), \ SRI(CURSOR_SURFACE_ADDRESS, CURSOR0_, id), \
@@ -82,12 +76,6 @@HUBP_SF (HUBPREQ0_PREFETCH_SETTINGS_C ,VRATIO_PREFETCH_C , mask_sh),\HUBP_SF (HUBPREQ0_DCN_VM_SYSTEM_APERTURE_LOW_ADDR ,MC_VM_SYSTEM_APERTURE_LOW_ADDR , mask_sh),\HUBP_SF (HUBPREQ0_DCN_VM_SYSTEM_APERTURE_HIGH_ADDR ,MC_VM_SYSTEM_APERTURE_HIGH_ADDR , mask_sh),\ -HUBP_SF (DCN_VM_FB_LOCATION_TOP ,FB_TOP , mask_sh),\ -HUBP_SF (DCN_VM_FB_LOCATION_BASE ,FB_BASE , mask_sh),\ -HUBP_SF (DCN_VM_FB_OFFSET ,FB_OFFSET , mask_sh),\ -HUBP_SF (DCN_VM_AGP_BASE ,AGP_BASE , mask_sh),\ -HUBP_SF (DCN_VM_AGP_BOT ,AGP_BOT , mask_sh),\ -HUBP_SF (DCN_VM_AGP_TOP ,AGP_TOP , mask_sh),\HUBP_SF (HUBPREQ0_CURSOR_SETTINGS ,CURSOR0_DST_Y_OFFSET , mask_sh), \HUBP_SF (HUBPREQ0_CURSOR_SETTINGS ,CURSOR0_CHUNK_HDL_ADJUST , mask_sh), \ HUBP_SF(CURSOR0_0_CURSOR_SURFACE_ADDRESS_HIGH, CURSOR_SURFACE_ADDRESS_HIGH, mask_sh), \
@@ -222,10 +210,6 @@ void hubp2_setup_interdependent(void hubp2_vready_at_or_After_vsync (struct hubp *hubp,struct _vcs_dpi_display_pipe_dest_params_st *pipe_dest); -void hubp2_update_dchub ( -struct hubp *hubp, -struct dchub_init_data *dh_data); -void hubp2_cursor_set_attributes (struct hubp *hubp,const struct dc_cursor_attributes *attr);
drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h +0 -3
@@ -111,9 +111,6 @@ struct hubp_funcs {bool (*hubp_is_flip_pending)(struct hubp *hubp); -void (*hubp_update_dchub)(struct hubp *hubp, -struct dchub_init_data *dh_data); -void (*set_blank)(struct hubp *hubp,bool blank);void (*set_hubp_blank_en)(struct hubp *hubp,bool blank);
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 26/49 drm/amd/display: Update DML parameters
In reply to a message not in the archiveFrom: Ilya Bakoulin <[email protected]>
[Why]
Need to add DML struct members that were omitted in previous DML implemenations.
[How]
- Add missing enum values
- Add missing struct members
- Set new input values in the fetch functions
--- .../amd/display/dc/dml/display_mode_enums.h | 22 ++++++++++++++----- .../amd/display/dc/dml/display_mode_structs.h | 3 +++ .../drm/amd/display/dc/dml/display_mode_vba.c | 9 ++++++++ .../drm/amd/display/dc/dml/display_mode_vba.h | 18 +++++++++++++++ 4 files changed, 46 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/display_mode_enums.h +16 -6
@@ -37,11 +37,14 @@ enum source_format_class { dm_444_64 =2 , dm_420_8 =3 , dm_420_10 =4 , - dm_422_8 =5 , - dm_422_10 =6 , - dm_444_8 =7 , + dm_420_12 =5 , + dm_422_8 =6 , + dm_422_10 =7 , + dm_444_8 =8 , dm_mono_8 = dm_444_8, - dm_mono_16 = dm_444_16 + dm_mono_16 = dm_444_16, + dm_rgbe =9 , + dm_rgbe_alpha = 10, };enum output_bpc_class { dm_out_6 = 0, dm_out_8 = 1, dm_out_10 = 2, dm_out_12 = 3, dm_out_16 = 4
@@ -83,7 +86,7 @@ enum dm_swizzle_mode { dm_sw_var_d_x =30 , dm_sw_64kb_r_x, dm_sw_gfx7_2d_thin_lvp, - dm_sw_gfx7_2d_thin_gl + dm_sw_gfx7_2d_thin_gl, };enum lb_depth { dm_lb_10 = 0, dm_lb_8 = 1, dm_lb_6 = 2, dm_lb_12 = 3, dm_lb_16 = 4,
@@ -112,7 +115,8 @@ enum output_standard {enum mpc_combine_affinity { dm_mpc_always_when_possible, dm_mpc_reduce_voltage, - dm_mpc_reduce_voltage_and_clocks + dm_mpc_reduce_voltage_and_clocks, + dm_mpc_never };enum self_refresh_affinity {
@@ -157,4 +161,10 @@ enum writeback_config { dm_whole_buffer_for_single_stream_interleave, }; +enum odm_combine_mode { + dm_odm_combine_mode_disabled, + dm_odm_combine_mode_2to1, + dm_odm_combine_mode_4to1, +}; +#endif
drivers/gpu/drm/amd/display/dc/dml/display_mode_structs.h +3 -0
@@ -109,6 +109,9 @@ struct _vcs_dpi_soc_bounding_box_st {int use_urgent_burst_bw;unsigned int num_states;struct _vcs_dpi_voltage_scaling_st clock_limits[MAX_CLOCK_LIMIT_STATES ]; +bool do_urgent_latency_adjustment; +double urgent_latency_adjustment_fabric_clock_component_us; +double urgent_latency_adjustment_fabric_clock_reference_mhz; };struct _vcs_dpi_ip_params_st {
drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.c +9 -0
@@ -262,6 +262,13 @@ static void fetch_socbb_params(struct display_mode_lib *mode_lib)//mode_lib->vba.DRAMSpeedPerState[i] = soc->clock_limits[i].dram_speed_mhz; mode_lib->vba.MaxDispclk[i] = soc->clock_limits[i].dispclk_mhz; } + + mode_lib->vba.DoUrgentLatencyAdjustment = + soc->do_urgent_latency_adjustment; + mode_lib->vba.UrgentLatencyAdjustmentFabricClockComponent = + soc->urgent_latency_adjustment_fabric_clock_component_us; + mode_lib->vba.UrgentLatencyAdjustmentFabricClockReference = + soc->urgent_latency_adjustment_fabric_clock_reference_mhz; }static void fetch_ip_params (struct display_mode_lib *mode_lib)
@@ -385,8 +392,10 @@ static void fetch_pipe_params(struct display_mode_lib *mode_lib) src->viewport_y_c; mode_lib->vba.PitchY[mode_lib->vba.NumberOfActivePlanes] = src->data_pitch; mode_lib->vba.SurfaceHeightY[mode_lib->vba.NumberOfActivePlanes] = src->viewport_height; + mode_lib->vba.SurfaceWidthY[mode_lib->vba.NumberOfActivePlanes] = src->viewport_width; mode_lib->vba.PitchC[mode_lib->vba.NumberOfActivePlanes] = src->data_pitch_c; mode_lib->vba.SurfaceHeightC[mode_lib->vba.NumberOfActivePlanes] = src->viewport_height_c; + mode_lib->vba.SurfaceWidthC[mode_lib->vba.NumberOfActivePlanes] = src->viewport_width_c; mode_lib->vba.DCCMetaPitchY[mode_lib->vba.NumberOfActivePlanes] = src->meta_pitch; mode_lib->vba.DCCMetaPitchC[mode_lib->vba.NumberOfActivePlanes] = src->meta_pitch_c; mode_lib->vba.HRatio[mode_lib->vba.NumberOfActivePlanes] = scl->hscl_ratio;
drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.h +18 -0
@@ -290,6 +290,7 @@ struct vba_vars_st {double PixelClock[DC__NUM_DPP__MAX ];double PixelClockBackEnd[DC__NUM_DPP__MAX ];bool DCCEnable[DC__NUM_DPP__MAX ]; +bool FECEnable[DC__NUM_DPP__MAX ];unsigned int DCCMetaPitchY[DC__NUM_DPP__MAX ];unsigned int DCCMetaPitchC[DC__NUM_DPP__MAX ];enum scan_direction_class SourceScan[DC__NUM_DPP__MAX ];
@@ -317,6 +318,7 @@ struct vba_vars_st {double DCCRate[DC__NUM_DPP__MAX ];double AverageDCCCompressionRate;bool ODMCombineEnabled[DC__NUM_DPP__MAX ]; +enum odm_combine_mode ODMCombineTypeEnabled[DC__NUM_DPP__MAX ];double OutputBpp[DC__NUM_DPP__MAX ];bool DSCEnabled[DC__NUM_DPP__MAX ];unsigned int DSCInputBitPerComponent[DC__NUM_DPP__MAX ];
@@ -395,6 +397,7 @@ struct vba_vars_st {double FabricClockPerState[DC__VOLTAGE_STATES +1 ];double SOCCLKPerState[DC__VOLTAGE_STATES +1 ];double PHYCLKPerState[DC__VOLTAGE_STATES +1 ]; +double DTBCLKPerState[DC__VOLTAGE_STATES +1 ];double MaxDppclk[DC__VOLTAGE_STATES +1 ];double MaxDSCCLK[DC__VOLTAGE_STATES +1 ];double DRAMSpeedPerState[DC__VOLTAGE_STATES +1 ];
@@ -488,6 +491,7 @@ struct vba_vars_st {unsigned int NoOfDPP[DC__VOLTAGE_STATES +1 ][2 ][DC__NUM_DPP__MAX ];int NoOfDPPThisState[DC__NUM_DPP__MAX ];bool ODMCombineEnablePerState[DC__VOLTAGE_STATES +1 ][DC__NUM_DPP__MAX ]; +bool ODMCombineTypeEnablePerState[DC__VOLTAGE_STATES +1 ][DC__NUM_DPP__MAX ];unsigned int SwathWidthYThisState[DC__NUM_DPP__MAX ];unsigned int SwathHeightCPerState[DC__VOLTAGE_STATES +1 ][2 ][DC__NUM_DPP__MAX ];unsigned int SwathHeightYThisState[DC__NUM_DPP__MAX ];
@@ -513,6 +517,7 @@ struct vba_vars_st {bool DIOSupport[DC__VOLTAGE_STATES +1 ];bool NotEnoughDSCUnits[DC__VOLTAGE_STATES +1 ];bool DSCCLKRequiredMoreThanSupported[DC__VOLTAGE_STATES +1 ]; +bool DTBCLKRequiredMoreThanSupported[DC__VOLTAGE_STATES +1 ];double UrgentRoundTripAndOutOfOrderLatencyPerState[DC__VOLTAGE_STATES +1 ];bool ROBSupport[DC__VOLTAGE_STATES +1 ];bool PTEBufferSizeNotExceeded[DC__VOLTAGE_STATES +1 ][2 ];
@@ -605,6 +610,7 @@ struct vba_vars_st {double MaximumSwathWidthLuma[DC__NUM_DPP__MAX ];double MaximumSwathWidthChroma[DC__NUM_DPP__MAX ];bool odm_combine_dummy[DC__NUM_DPP__MAX ]; +enum odm_combine_mode odm_combine_mode_dummy[DC__NUM_DPP__MAX ];double dummy1[DC__NUM_DPP__MAX ];double dummy2[DC__NUM_DPP__MAX ];double dummy3[DC__NUM_DPP__MAX ];
@@ -625,6 +631,11 @@ struct vba_vars_st {unsigned int dummyinteger10;unsigned int dummyinteger11;unsigned int dummyinteger12; +unsigned int dummyintegerarr1[DC__NUM_DPP__MAX ]; +unsigned int dummyintegerarr2[DC__NUM_DPP__MAX ]; +unsigned int dummyintegerarr3[DC__NUM_DPP__MAX ]; +unsigned int dummyintegerarr4[DC__NUM_DPP__MAX ]; +long dummylongarr1[DC__NUM_DPP__MAX ];bool dummysinglestring;bool SingleDPPViewportSizeSupportPerPlane[DC__NUM_DPP__MAX ];double PlaneRequiredDISPCLKWithODMCombine2To1;
@@ -633,6 +644,7 @@ struct vba_vars_st {bool LinkDSCEnable;bool ODMCombine4To1SupportCheckOK[DC__VOLTAGE_STATES +1 ];bool ODMCombineEnableThisState[DC__NUM_DPP__MAX ]; +enum odm_combine_mode ODMCombineEnableTypeThisState[DC__NUM_DPP__MAX ];unsigned int SwathWidthCThisState[DC__NUM_DPP__MAX ];bool ViewportSizeSupportPerPlane[DC__NUM_DPP__MAX ];double AlignedDCCMetaPitchY[DC__NUM_DPP__MAX ];
@@ -641,6 +653,7 @@ struct vba_vars_st {unsigned int NotEnoughUrgentLatencyHiding;unsigned int NotEnoughUrgentLatencyHidingPre;long PTEBufferSizeInRequestsForLuma; +long PTEBufferSizeInRequestsForChroma;// Missing from VBA long dpte_group_bytes_chroma;
@@ -787,6 +800,9 @@ struct vba_vars_st {unsigned int PDEProcessingBufIn64KBReqs;double MaxTotalVActiveRDBandwidth; +bool DoUrgentLatencyAdjustment; +double UrgentLatencyAdjustmentFabricClockComponent; +double UrgentLatencyAdjustmentFabricClockReference;double MinUrgentLatencySupportUs;double MinFullDETBufferingTime;double AverageReadBandwidthGBytePerSecond;
@@ -801,6 +817,8 @@ struct vba_vars_st {bool ModeIsSupported;bool ODMCombine4To1Supported; +unsigned int SurfaceWidthY[DC__NUM_DPP__MAX ]; +unsigned int SurfaceWidthC[DC__NUM_DPP__MAX ];unsigned int SurfaceHeightY[DC__NUM_DPP__MAX ];unsigned int SurfaceHeightC[DC__NUM_DPP__MAX ];unsigned int WritebackHTaps[DC__NUM_DPP__MAX ];
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 27/49 drm/amd/display: update optc odm interface for more than 2 opps
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
Current optc odm interface only accepts 2 opps, we need to expand this to allow 4 to 1 odm combine.
--- .../gpu/drm/amd/display/dc/dcn10/dcn10_optc.c | 3 +-- .../gpu/drm/amd/display/dc/dcn10/dcn10_optc.h | 2 +- .../drm/amd/display/dc/dcn20/dcn20_hwseq.c | 22 +++++++++++-------- .../gpu/drm/amd/display/dc/dcn20/dcn20_optc.c | 20 +++++++++-------- .../gpu/drm/amd/display/dc/dcn20/dcn20_optc.h | 4 ++-- .../amd/display/dc/inc/hw/timing_generator.h | 6 ++--- 6 files changed, 31 insertions(+), 26 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c +1 -2
@@ -287,7 +287,7 @@ void optc1_program_timing( h_div_2 =optc1_is_two_pixels_per_containter (&patched_crtc_timing);REG_UPDATE (OTG_H_TIMING_CNTL , -OTG_H_TIMING_DIV_BY2 , h_div_2 || optc1->comb_opp_id !=0xf ); +OTG_H_TIMING_DIV_BY2 , h_div_2 || optc1->opp_count ==2 ); }
@@ -1513,7 +1513,6 @@ void dcn10_timing_generator_init(struct optc *optc1) optc1->min_v_blank_interlace =5 ; optc1->min_h_sync_width =8 ; optc1->min_v_sync_width =1 ; - optc1->comb_opp_id =0xf ; }#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.h +1 -1
@@ -494,7 +494,7 @@ struct optc {const struct dcn_optc_shift *tg_shift;const struct dcn_optc_mask *tg_mask; -int comb_opp_id; +int opp_count;uint32_t max_h_total;uint32_t max_v_total;
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +13 -9
@@ -545,12 +545,14 @@ enum dc_status dcn20_enable_stream_timing(/* TODO check if timing_changed, disable stream if timing changed */ -if (odm_pipe) +if (odm_pipe) { +int opp_inst[2 ] = { pipe_ctx->stream_res.opp->inst, odm_pipe->stream_res.opp->inst }; + pipe_ctx->stream_res.tg->funcs->set_odm_combine ( pipe_ctx->stream_res.tg, - odm_pipe->stream_res.opp->inst, - pipe_ctx->stream->timing.h_addressable/2 , - pipe_ctx->stream->timing.pixel_encoding); + opp_inst,2 , + &pipe_ctx->stream->timing); + }/* HW program guide assume display already disable * by unplug sequence. OTG assume stop. */
@@ -822,13 +824,15 @@ static void dcn20_update_odm(struct dc *dc, struct dc_state *context, struct pip {struct pipe_ctx *combine_pipe =dc_res_get_odm_bottom_pipe (pipe_ctx); -if (combine_pipe) +if (combine_pipe) { +int opp_inst[2 ] = { pipe_ctx->stream_res.opp->inst, + combine_pipe->stream_res.opp->inst }; + pipe_ctx->stream_res.tg->funcs->set_odm_combine ( pipe_ctx->stream_res.tg, - combine_pipe->stream_res.opp->inst, - pipe_ctx->plane_res.scl_data.h_active, - pipe_ctx->stream->timing.pixel_encoding); -else + opp_inst,2 , + &pipe_ctx->stream->timing); + }else pipe_ctx->stream_res.tg->funcs->set_odm_bypass ( pipe_ctx->stream_res.tg, &pipe_ctx->stream->timing); }
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_optc.c +11 -9
@@ -224,7 +224,6 @@ void optc2_set_odm_bypass(struct timing_generator *optc,struct optc *optc1 =DCN10TG_FROM_TG (optc);uint32_t h_div_2 =0 ; - optc1->comb_opp_id =0xf ; REG_SET_3(OPTC_DATA_SOURCE_SELECT, 0, OPTC_NUM_OF_INPUT_SEGMENT, 0, OPTC_SEG0_SRC_SEL, optc->inst,
@@ -236,13 +235,16 @@ void optc2_set_odm_bypass(struct timing_generator *optc, OTG_H_TIMING_DIV_BY2, h_div_2);REG_SET (OPTC_MEMORY_CONFIG ,0 ,OPTC_MEM_SEL ,0 ); + optc1->opp_count =1 ; } -void optc2_set_odm_combine (struct timing_generator *optc,int combine_opp_id, -int mpcc_hactive,enum dc_pixel_encoding pixel_encoding) +void optc2_set_odm_combine (struct timing_generator *optc,int *opp_id,int opp_cnt, +struct dc_crtc_timing *timing) {struct optc *optc1 =DCN10TG_FROM_TG (optc);/* 2 pieces of memory required for up to 5120 displays, 4 for up to 8192 */ +int mpcc_hactive = (timing->h_addressable + timing->h_border_left + timing->h_border_right) + / opp_cnt;int memory_mask = mpcc_hactive <=2560 ?0x3 :0xf ;uint32_t data_fmt =0 ;
@@ -257,23 +259,24 @@ void optc2_set_odm_combine(struct timing_generator *optc, int combine_opp_id,REG_SET (OPTC_MEMORY_CONFIG ,0 ,OPTC_MEM_SEL , memory_mask << (optc->inst *4 )); -if (pixel_encoding ==PIXEL_ENCODING_YCBCR422 ) +if (timing->pixel_encoding ==PIXEL_ENCODING_YCBCR422 ) data_fmt =1 ; -else if (pixel_encoding ==PIXEL_ENCODING_YCBCR420 ) +else if (timing->pixel_encoding ==PIXEL_ENCODING_YCBCR420 ) data_fmt =2 ;REG_UPDATE (OPTC_DATA_FORMAT_CONTROL ,OPTC_DATA_FORMAT , data_fmt); +ASSERT (opp_cnt ==2 );REG_SET_3 (OPTC_DATA_SOURCE_SELECT ,0 ,OPTC_NUM_OF_INPUT_SEGMENT ,1 , -OPTC_SEG0_SRC_SEL , optc->inst, -OPTC_SEG1_SRC_SEL , combine_opp_id); +OPTC_SEG0_SRC_SEL , opp_id[0 ], +OPTC_SEG1_SRC_SEL , opp_id[1 ]);REG_UPDATE (OPTC_WIDTH_CONTROL ,OPTC_SEGMENT_WIDTH , mpcc_hactive);REG_SET (OTG_H_TIMING_CNTL ,0 ,OTG_H_TIMING_DIV_BY2 ,1 ); - optc1->comb_opp_id = combine_opp_id; + optc1->opp_count = opp_cnt; } void optc2_get_optc_source(struct timing_generator *optc,
@@ -538,6 +541,5 @@ void dcn20_timing_generator_init(struct optc *optc1) optc1->min_v_blank_interlace =5 ; optc1->min_h_sync_width =4 ;// Minimum HSYNC = 8 pixels asked By HW in the first place for no actual reason. Oculus Rift S will not light up with 8 as it's hsyncWidth is 6. Changing it to 4 to fix that issue. optc1->min_v_sync_width =1 ; - optc1->comb_opp_id =0xf ; }
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_optc.h +2 -2
@@ -96,8 +96,8 @@ void optc2_set_dsc_config(struct timing_generator *optc,void optc2_set_odm_bypass (struct timing_generator *optc,const struct dc_crtc_timing *dc_crtc_timing); -void optc2_set_odm_combine (struct timing_generator *optc,int combine_opp_id, -int mpcc_hactive,enum dc_pixel_encoding pixel_encoding); +void optc2_set_odm_combine (struct timing_generator *optc,int *opp_id,int opp_cnt, +struct dc_crtc_timing *timing); void optc2_get_optc_source(struct timing_generator *optc, uint32_t *num_of_src_opp,
drivers/gpu/drm/amd/display/dc/inc/hw/timing_generator.h +3 -3
@@ -267,9 +267,9 @@ struct timing_generator_funcs {uint32_t dsc_bytes_per_pixel, uint32_t dsc_slice_width);#endif -void (*set_odm_bypass)(struct timing_generator *tg,const struct dc_crtc_timing *dc_crtc_timing); -void (*set_odm_combine)(struct timing_generator *tg,int combine_opp_id, -int mpcc_hactive,enum dc_pixel_encoding pixel_encoding); +void (*set_odm_bypass)(struct timing_generator *optc,const struct dc_crtc_timing *dc_crtc_timing); +void (*set_odm_combine)(struct timing_generator *optc,int *opp_id,int opp_cnt, +struct dc_crtc_timing *timing);void (*set_gsl)(struct timing_generator *optc,const struct gsl_params *params); void (*set_gsl_source_select)(struct timing_generator *optc, int group_idx,
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 28/49 drm/amd/display: HUBP/HUBBUB register programming fixes
In reply to a message not in the archiveFrom: Ilya Bakoulin <[email protected]>
[Why]
- Need to change interface function signature / add an enum to reflect the available register field values
[How]
- Add a new enum and modify existing functions to use it instead of bool
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c | 2 +- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.h | 2 +- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubp.c | 2 +- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubp.h | 2 +- drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h | 8 +++++++- 5 files changed, 11 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c +1 -1
@@ -509,7 +509,7 @@ bool hubp1_program_surface_flip_and_addr( }void hubp1_dcc_control (struct hubp *hubp,bool enable, -bool independent_64b_blks) +enum hubp_ind_block_size independent_64b_blks) {uint32_t dcc_en = enable ?1 :0 ;uint32_t dcc_ind_64b_blk = independent_64b_blks ?1 :0 ;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.h +1 -1
@@ -698,7 +698,7 @@ void hubp1_program_tiling(void hubp1_dcc_control (struct hubp *hubp,bool enable, -bool independent_64b_blks); +enum hubp_ind_block_size independent_64b_blks);#ifdef CONFIG_DRM_AMD_DC_DCN2_0 bool hubp1_program_surface_flip_and_addr(
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubp.c +1 -1
@@ -397,7 +397,7 @@ void hubp2_program_rotation( }void hubp2_dcc_control (struct hubp *hubp,bool enable, -bool independent_64b_blks) +enum hubp_ind_block_size independent_64b_blks) {uint32_t dcc_en = enable ?1 :0 ;uint32_t dcc_ind_64b_blk = independent_64b_blks ?1 :0 ;
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hubp.h +1 -1
@@ -252,7 +252,7 @@ bool hubp2_program_surface_flip_and_addr( bool flip_immediate);void hubp2_dcc_control (struct hubp *hubp,bool enable, -bool independent_64b_blks); +enum hubp_ind_block_size independent_64b_blks); void hubp2_program_size( struct hubp *hubp,
drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h +7 -1
@@ -47,6 +47,11 @@ enum cursor_lines_per_chunk {CURSOR_LINE_PER_CHUNK_16 }; +enum hubp_ind_block_size { + hubp_ind_block_unconstrained =0 , + hubp_ind_block_64b, +}; +struct hubp {const struct hubp_funcs *funcs;struct dc_context *ctx;
@@ -74,7 +79,8 @@ struct hubp_funcs { struct _vcs_dpi_display_ttu_regs_st *ttu_regs);void (*dcc_control)(struct hubp *hubp,bool enable, -bool independent_64b_blks); +enum hubp_ind_block_size blk_size); + void (*mem_program_viewport)( struct hubp *hubp, const struct rect *viewport,
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 29/49 drm/amd/display: Enable type C hotplug
In reply to a message not in the archiveFrom: Eric Yang <[email protected]>
[Why and How]
We want to change where timing is done for alt mode. Some of the commented out #ifs are needed for DCN20 so we enable them for that case.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 59 +++++++++++++++++++ .../amd/display/dc/dcn10/dcn10_link_encoder.h | 1 + .../drm/amd/display/dc/inc/hw/link_encoder.h | 1 + 3 files changed, 61 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +59 -0
@@ -682,6 +682,56 @@ static bool is_same_edid(struct dc_edid *old_edid, struct dc_edid *new_edid)return (memcmp (old_edid->raw_edid, new_edid->raw_edid, new_edid->length) ==0 ); } +bool wait_for_alt_mode (struct dc_link *link) +{ + +/** +* something is terribly wrong if time out is > 200ms. (5Hz) +* 500 microseconds * 400 tries us 200 ms +**/ +unsigned int sleep_time_in_microseconds =500 ; +unsigned int tries_allowed =400 ; +bool is_in_alt_mode; +unsigned long long enter_timestamp; +unsigned long long finish_timestamp; +unsigned long long time_taken_in_ns; +int tries_taken; + +DC_LOGGER_INIT (link->ctx->logger); + +if (link->link_enc->funcs->is_in_alt_mode ==NULL ) +return true; + + is_in_alt_mode = link->link_enc->funcs->is_in_alt_mode (link->link_enc); +DC_LOG_WARNING ("DP Alt mode state on HPD: %d\n" , is_in_alt_mode); + +if (is_in_alt_mode) +return true; + + enter_timestamp =dm_get_timestamp (link->ctx); + +for (tries_taken =0 ; tries_taken < tries_allowed; tries_taken++) { +udelay (sleep_time_in_microseconds); +/* ask the link if alt mode is enabled, if so return ok */ +if (link->link_enc->funcs->is_in_alt_mode (link->link_enc)) { + + finish_timestamp =dm_get_timestamp (link->ctx); + time_taken_in_ns =dm_get_elapse_time_in_ns ( + link->ctx, finish_timestamp, enter_timestamp); +DC_LOG_WARNING ("Alt mode entered finished after %llu ms\n" , + time_taken_in_ns /1000000 ); +return true; + } + + } + finish_timestamp =dm_get_timestamp (link->ctx); + time_taken_in_ns =dm_get_elapse_time_in_ns (link->ctx, finish_timestamp, + enter_timestamp); +DC_LOG_WARNING ("Alt mode has timed out after %llu ms\n" , + time_taken_in_ns /1000000 ); +return false; +} +/** * dc_link_detect() - Detect if a sink is attached to a given link *
@@ -770,6 +820,15 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason) } case SIGNAL_TYPE_DISPLAY_PORT: { + /* wa HPD high coming too early*/ + if (link->link_enc->features.flags.bits.DP_IS_USB_C == 1) { + + /* if alt mode times out, return false */ + if (wait_for_alt_mode(link) == false) { + return false; + } + } + if (!detect_dp( link, &sink_caps,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_link_encoder.h +1 -0
@@ -337,6 +337,7 @@ struct dcn10_link_enc_registers {type RDPCS_TX_FIFO_ERROR_MASK ;\type RDPCS_DPALT_DISABLE_TOGGLE_MASK ;\type RDPCS_DPALT_4LANE_TOGGLE_MASK ;\ +type RDPCS_PHY_DPALT_DISABLE ;\type RDPCS_PHY_DPALT_DISABLE_ACK ;\type RDPCS_PHY_DP_MPLLB_V2I ;\type RDPCS_PHY_DP_MPLLB_FREQ_VCO ;\
drivers/gpu/drm/amd/display/dc/inc/hw/link_encoder.h +1 -0
@@ -183,6 +183,7 @@ struct link_encoder_funcs {bool (*fec_is_active)(struct link_encoder *enc);#endif + bool (*is_in_alt_mode) (struct link_encoder *enc); };#endif /* LINK_ENCODER_H_ */
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 30/49 drm/amd/display: reprogram VM config when system resume
In reply to a message not in the archiveFrom: Lewis Huang <[email protected]>
[Why]
The vm config will be clear to 0 when system enter S4. It will cause hubbub didn't know how to fetch data when system resume. The flip always pending because earliest_inuse_address and request_address are different.
[How]
Reprogram VM config when system resume
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc.c +8 -0
@@ -2262,6 +2262,14 @@ void dc_set_power_state(dc_resource_state_construct (dc, dc->current_state); dc->hwss.init_hw (dc); + +#ifdef CONFIG_DRM_AMD_DC_DCN2_0 +if (dc->hwss.init_sys_ctx !=NULL && + dc->vm_pa_config.valid) { + dc->hwss.init_sys_ctx (dc->hwseq, dc, &dc->vm_pa_config); + } +#endif +break ;default :ASSERT (dc->current_state->stream_count ==0 );
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 31/49 drm/amd/display: Remove 4:2:2 DSC support
In reply to a message not in the archiveFrom: Nikola Cornij <[email protected]>
[why]
If DSC is available, a higher picture quality is achieved by using DSC with 4:4:4 format. Using 4:2:2 instead does not offer any benefit and would only introduce loss of quality. Removing it reduces maintenance and testing effort.
--- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c +2 -2
@@ -118,8 +118,8 @@ static void dsc2_get_enc_caps(struct dsc_enc_caps *dsc_enc_caps, int pixel_clock dsc_enc_caps->color_formats.bits.RGB =1 ; dsc_enc_caps->color_formats.bits.YCBCR_444 =1 ; - dsc_enc_caps->color_formats.bits.YCBCR_SIMPLE_422 =1 ; - dsc_enc_caps->color_formats.bits.YCBCR_NATIVE_422 =1 ; + dsc_enc_caps->color_formats.bits.YCBCR_SIMPLE_422 =0 ; + dsc_enc_caps->color_formats.bits.YCBCR_NATIVE_422 =0 ; dsc_enc_caps->color_formats.bits.YCBCR_NATIVE_420 =1 ; dsc_enc_caps->color_depth.bits.COLOR_DEPTH_8_BPC =1 ;
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 32/49 drm/amd/display: Add Logging for Gamma Related information (1/2)
In reply to a message not in the archiveFrom: Wyatt Wood <[email protected]>
[Why]
A recent bug showed that logging would be useful in debugging various gamma issues.
[How]
Add new log types and logging code to the color module.
--- .../gpu/drm/amd/display/include/logger_interface.h | 2 ++ drivers/gpu/drm/amd/display/include/logger_types.h | 1 + .../gpu/drm/amd/display/modules/color/color_gamma.c | 12 ++++++++++++ .../gpu/drm/amd/display/modules/color/color_gamma.h | 1 + 4 files changed, 16 insertions(+)
drivers/gpu/drm/amd/display/include/logger_interface.h +2 -0
@@ -155,4 +155,6 @@ void context_clock_trace(#define DISPLAY_STATS_END (entry) (void)(entry) +#define LOG_GAMMA_WRITE (msg, ...) +#endif /* __DAL_LOGGER_INTERFACE_H__ */
drivers/gpu/drm/amd/display/include/logger_types.h +1 -0
@@ -117,6 +117,7 @@ enum dc_log_type {LOG_DSC , #endifLOG_DWB , +LOG_GAMMA_DEBUG ,LOG_SECTION_TOTAL_COUNT };
drivers/gpu/drm/amd/display/modules/color/color_gamma.c +12 -0
@@ -94,6 +94,18 @@ void setup_x_points_distribution(void) } } +void log_x_points_distribution (struct dal_logger *logger) +{ +int i =0 ; + +if (logger !=NULL ) { +LOG_GAMMA_WRITE ("]Log X Distribution\n" ); + +for (i =0 ; i <MAX_HW_POINTS ; i++) +LOG_GAMMA_WRITE ("]%llu\n" , coordinates_x[i].x.value); + } +} +static void compute_pq (struct fixed31_32 in_x,struct fixed31_32 *out_y) {/* consts for PQ gamma formula. */
drivers/gpu/drm/amd/display/modules/color/color_gamma.h +1 -0
@@ -92,6 +92,7 @@ struct translate_from_linear_space_args { };void setup_x_points_distribution (void ); +void log_x_points_distribution (struct dal_logger *logger);void precompute_pq (void );void precompute_de_pq (void );
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 33/49 drm/amd/display: Fix type of ODMCombineType field
In reply to a message not in the archiveFrom: Ilya Bakoulin <[email protected]>
The type was changed previously to better reflect possible register values.
--- drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.h +1 -1
@@ -491,7 +491,7 @@ struct vba_vars_st {unsigned int NoOfDPP[DC__VOLTAGE_STATES +1 ][2 ][DC__NUM_DPP__MAX ];int NoOfDPPThisState[DC__NUM_DPP__MAX ];bool ODMCombineEnablePerState[DC__VOLTAGE_STATES +1 ][DC__NUM_DPP__MAX ]; -bool ODMCombineTypeEnablePerState[DC__VOLTAGE_STATES +1 ][DC__NUM_DPP__MAX ]; +enum odm_combine_mode ODMCombineTypeEnablePerState[DC__VOLTAGE_STATES +1 ][DC__NUM_DPP__MAX ];unsigned int SwathWidthYThisState[DC__NUM_DPP__MAX ];unsigned int SwathHeightCPerState[DC__VOLTAGE_STATES +1 ][2 ][DC__NUM_DPP__MAX ];unsigned int SwathHeightYThisState[DC__NUM_DPP__MAX ];
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 34/49 drm/amd/display: Check if set_blank_data_double_buffer exists before call
In reply to a message not in the archiveFrom: Vitaly Prosyak <[email protected]>
Not all ASIC types have this function implemented - check before calling.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +2 -1
@@ -720,7 +720,8 @@ static void false_optc_underflow_wa( dc->hwss.wait_for_mpcc_disconnect (dc, dc->res_pool, old_pipe_ctx); } - tg->funcs->set_blank_data_double_buffer (tg, true); +if (tg->funcs->set_blank_data_double_buffer) + tg->funcs->set_blank_data_double_buffer (tg, true);if (tg->funcs->is_optc_underflow_occurred (tg) && !underflow) tg->funcs->clear_optc_underflow (tg);
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 35/49 drm/amd/display: Correct DSC PPS log
In reply to a message not in the archiveFrom: Nikola Cornij <[email protected]>
[why]
A misleading message "Programming PPS" appears before both programming and "query PPS" functions
[how]
Move the message from "log PPS" function to "program PPS" function
--- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c +1 -1
@@ -192,6 +192,7 @@ static void dsc2_set_config(struct display_stream_compressor *dsc, const structdsc_config_log (dsc, dsc_cfg); is_config_ok =dsc_prepare_config (dsc_cfg, &dsc20->reg_vals, dsc_optc_cfg);ASSERT (is_config_ok); +DC_LOG_DSC ("programming DSC Picture Parameter Set (PPS):" );dsc_log_pps (dsc, &dsc20->reg_vals.pps);dsc_write_to_registers (dsc, &dsc20->reg_vals); }
@@ -250,7 +251,6 @@ static void dsc_log_pps(struct display_stream_compressor *dsc, struct drm_dsc_coint i;int bits_per_pixel = pps->bits_per_pixel; -DC_LOG_DSC ("programming DSC Picture Parameter Set (PPS):" );DC_LOG_DSC ("\tdsc_version_major %d" , pps->dsc_version_major);DC_LOG_DSC ("\tdsc_version_minor %d" , pps->dsc_version_minor);DC_LOG_DSC ("\tbits_per_component %d" , pps->bits_per_component);
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 36/49 drm/amd/display: wake up ogam mem pwr before programming ocsc
In reply to a message not in the archiveFrom: Charlene Liu <[email protected]>
[Description]OGAM_MEM_PWR could stay in light up when driver woke up to update gamma.
either disable MEM_LOW power feature or set to OGAM_bypass could make artificial color distortion goes away. Easy reproduce after LOW_MEM Power feature enables and resume from S3.
--- .../gpu/drm/amd/display/dc/dcn20/dcn20_dpp.c | 16 ++++++++++++++++ .../gpu/drm/amd/display/dc/dcn20/dcn20_dpp.h | 19 +++++++++++++++---- .../drm/amd/display/dc/dcn20/dcn20_hwseq.c | 6 ++++++ .../gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c | 5 +++-- .../gpu/drm/amd/display/dc/dcn20/dcn20_mpc.h | 6 +++++- drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h | 4 ++++ 6 files changed, 49 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dpp.c +16 -0
@@ -72,6 +72,21 @@ void dpp20_read_state(struct dpp *dpp_base, } } +void dpp2_power_on_obuf ( +struct dpp *dpp_base, +bool power_on) +{ +struct dcn20_dpp *dpp =TO_DCN20_DPP (dpp_base); + +REG_UPDATE (CM_MEM_PWR_CTRL ,SHARED_MEM_PWR_DIS , power_on == true ?1 :0 ); + +REG_UPDATE (OBUF_MEM_PWR_CTRL , +OBUF_MEM_PWR_FORCE , power_on == true ?0 :1 ); + +REG_UPDATE (DSCL_MEM_PWR_CTRL , +LUT_MEM_PWR_FORCE , power_on == true ?0 :1 ); +} +void dpp2_dummy_program_input_lut (struct dpp *dpp_base,const struct dc_gamma *gamma)
@@ -227,6 +242,7 @@ static void dpp2_cnv_setup ( CUR0_ENABLE, 0); } +dpp2_power_on_obuf (dpp_base, true); }
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dpp.h +15 -4
@@ -162,7 +162,9 @@SRI (COLOR_KEYER_GREEN ,CNVC_CFG , id), \SRI (COLOR_KEYER_BLUE ,CNVC_CFG , id), \SRI (CM_SHAPER_LUT_DATA ,CM , id), \ - SRI(CURSOR_CONTROL, CURSOR0_, id) +SRI (CURSOR_CONTROL ,CURSOR0_ , id),\ +SRI (OBUF_MEM_PWR_CTRL ,DSCL , id),\ + SRI(DSCL_MEM_PWR_CTRL, DSCL, id) #define TF_REG_LIST_SH_MASK_DCN20(mask_sh)\ TF_REG_LIST_SH_MASK_DCN(mask_sh), \
@@ -554,7 +556,9 @@TF_SF (CNVC_CFG0_COLOR_KEYER_BLUE ,COLOR_KEYER_BLUE_HIGH , mask_sh), \TF_SF (CNVC_CUR0_CURSOR0_CONTROL ,CUR0_PIX_INV_MODE , mask_sh), \TF_SF (CNVC_CUR0_CURSOR0_CONTROL ,CUR0_PIXEL_ALPHA_MOD_EN , mask_sh), \ - TF_SF(CNVC_CUR0_CURSOR0_CONTROL, CUR0_ROM_EN, mask_sh) +TF_SF (CNVC_CUR0_CURSOR0_CONTROL ,CUR0_ROM_EN , mask_sh),\ +TF_SF (DSCL0_OBUF_MEM_PWR_CTRL ,OBUF_MEM_PWR_FORCE , mask_sh),\ + TF_SF(DSCL0_DSCL_MEM_PWR_CTRL, LUT_MEM_PWR_FORCE, mask_sh) #define TF_REG_FIELD_LIST_DCN2_0(type) \TF_REG_FIELD_LIST (type) \
@@ -585,7 +589,9 @@type COLOR_KEYER_BLUE_HIGH ; \type CUR0_PIX_INV_MODE ; \type CUR0_PIXEL_ALPHA_MOD_EN ; \ - type CUR0_ROM_EN +type CUR0_ROM_EN ;\ +type OBUF_MEM_PWR_FORCE ;\ + type LUT_MEM_PWR_FORCEstruct dcn2_dpp_shift {TF_REG_FIELD_LIST_DCN2_0 (uint8_t );
@@ -609,7 +615,9 @@ struct dcn2_dpp_mask {uint32_t COLOR_KEYER_ALPHA ; \uint32_t COLOR_KEYER_RED ; \uint32_t COLOR_KEYER_GREEN ; \ - uint32_t COLOR_KEYER_BLUE +uint32_t COLOR_KEYER_BLUE ; \ +uint32_t OBUF_MEM_PWR_CTRL ;\ + uint32_t DSCL_MEM_PWR_CTRL struct dcn2_dpp_registers {DPP_DCN2_REG_VARIABLE_LIST ;
@@ -695,4 +703,7 @@ bool dpp2_construct(struct dcn20_dpp *dpp2,const struct dcn2_dpp_shift *tf_shift, const struct dcn2_dpp_mask *tf_mask); +void dpp2_power_on_obuf ( +struct dpp *dpp_base, +bool power_on);#endif /* __DC_HWSS_DCN20_H__ */
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +6 -0
@@ -631,6 +631,10 @@ void dcn20_program_output_csc(struct dc *dc, {struct mpc *mpc = dc->res_pool->mpc;enum mpc_output_csc_mode ocsc_mode =MPC_OUTPUT_CSC_COEF_A ; +int mpcc_id = pipe_ctx->plane_res.hubp->inst; + +if (mpc->funcs->power_on_mpc_mem_pwr) + mpc->funcs->power_on_mpc_mem_pwr (mpc, mpcc_id, true);if (pipe_ctx->stream->csc_color_matrix.enable_adjustment == true) {if (mpc->funcs->set_output_csc !=NULL )
@@ -660,6 +664,8 @@ bool dcn20_set_output_transfer_func(struct pipe_ctx *pipe_ctx,* if programming for all pipes is required then remove condition * pipe_ctx->top_pipe == NULL ,but then fix the diagnostic. */ +if (mpc->funcs->power_on_mpc_mem_pwr) + mpc->funcs->power_on_mpc_mem_pwr (mpc, mpcc_id, true);if ((pipe_ctx->top_pipe ==NULL ||dc_res_is_odm_head_pipe (pipe_ctx)) && mpc->funcs->set_output_gamma && stream->out_transfer_func) {if (stream->out_transfer_func->type ==TF_TYPE_HWPWL )
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c +3 -2
@@ -233,14 +233,14 @@ static void mpc2_ogam_get_reg_field( reg->masks.exp_resion_start_segment = mpc20->mpc_mask->MPCC_OGAM_RAMA_EXP_REGION_START_SEGMENT_B; } -static void mpc20_power_on_ogam_lut ( +void mpc20_power_on_ogam_lut (struct mpc *mpc,int mpcc_id,bool power_on) {struct dcn20_mpc *mpc20 =TO_DCN20_MPC (mpc);REG_SET (MPCC_MEM_PWR_CTRL [mpcc_id],0 , -MPCC_OGAM_MEM_PWR_FORCE , power_on == true ?0 :1 ); +MPCC_OGAM_MEM_PWR_DIS , power_on == true ?1 :0 ); }
@@ -509,6 +509,7 @@ const struct mpc_funcs dcn20_mpc_funcs = { .set_output_csc = mpc2_set_output_csc, .set_ocsc_default = mpc2_set_ocsc_default, .set_output_gamma = mpc2_set_output_gamma, + .power_on_mpc_mem_pwr = mpc20_power_on_ogam_lut, }; void dcn20_mpc_construct(struct dcn20_mpc *mpc20,
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.h +5 -1
@@ -159,6 +159,7 @@SF (MPCC_OGAM0_MPCC_OGAM_RAMB_START_CNTL_B ,MPCC_OGAM_RAMB_EXP_REGION_START_B , mask_sh),\SF (MPCC_OGAM0_MPCC_OGAM_RAMB_START_CNTL_B ,MPCC_OGAM_RAMB_EXP_REGION_START_SEGMENT_B , mask_sh),\SF (MPCC0_MPCC_MEM_PWR_CTRL ,MPCC_OGAM_MEM_PWR_FORCE , mask_sh),\ +SF (MPCC0_MPCC_MEM_PWR_CTRL ,MPCC_OGAM_MEM_PWR_DIS , mask_sh),\SF (MPCC_OGAM0_MPCC_OGAM_LUT_INDEX ,MPCC_OGAM_LUT_INDEX , mask_sh),\SF (MPCC_OGAM0_MPCC_OGAM_LUT_RAM_CONTROL ,MPCC_OGAM_LUT_WRITE_EN_MASK , mask_sh),\ SF(MPCC_OGAM0_MPCC_OGAM_LUT_RAM_CONTROL, MPCC_OGAM_LUT_RAM_SEL, mask_sh),\
@@ -173,6 +174,7 @@SF (MPC_OUT0_DENORM_CLAMP_B_CB ,MPC_OUT_DENORM_CLAMP_MAX_B_CB , mask_sh),\ SF(MPC_OUT0_DENORM_CLAMP_B_CB, MPC_OUT_DENORM_CLAMP_MIN_B_CB, mask_sh) +#define MPC_REG_FIELD_LIST_DCN2_0 (type) \ MPC_REG_FIELD_LIST(type)\ type MPCC_BG_BPC;\
@@ -217,7 +219,8 @@type MPC_OUT_DENORM_CLAMP_MIN_G_Y ;\type MPC_OUT_DENORM_CLAMP_MAX_B_CB ;\type MPC_OUT_DENORM_CLAMP_MIN_B_CB ;\ -type MPCC_DISABLED ; +type MPCC_DISABLED ;\ +type MPCC_OGAM_MEM_PWR_DIS ;struct dcn20_mpc_registers {MPC_REG_VARIABLE_LIST_DCN2_0
@@ -282,4 +285,5 @@ void mpc2_set_output_gamma(void mpc2_assert_idle_mpcc (struct mpc *mpc,int id);void mpc2_assert_mpcc_idle_before_connect (struct mpc *mpc,int mpcc_id); +void mpc20_power_on_ogam_lut (struct mpc *mpc,int mpcc_id,bool power_on);#endif
drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h +4 -0
@@ -254,6 +254,10 @@ struct mpc_funcs {struct mpc *mpc, int mpcc_id, const struct pwl_params *params); +void (*power_on_mpc_mem_pwr)( +struct mpc *mpc, +int mpcc_id, +bool power_on);#endif };
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 37/49 drm/amd/display: Register VUPDATE_NO_LOCK interrupts for DCN2
In reply to a message not in the archiveFrom: Nicholas Kazlauskas <[email protected]>
[Why]
These are needed to send back DRM vblank events in the case where VRR is on. Without the interrupt enabled we're deferring the events into the vblank queue and userspace is left waiting forever to get back the events they need.
Found using igt@kms_vrr - the test fails immediately due to vblank timeout.
[How]
Register them the same way we're handling it for DCN1.
This fixes igt@kms_vrr for DCN2.
--- .../display/dc/irq/dcn20/irq_service_dcn20.c | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/dc/irq/dcn20/irq_service_dcn20.c +18 -10
@@ -165,6 +165,11 @@ static const struct irq_source_info_funcs vblank_irq_info_funcs = { .ack = NULL }; +static const struct irq_source_info_funcs vupdate_no_lock_irq_info_funcs = { + .set =NULL , + .ack =NULL +}; +#undef BASE_INNER#define BASE_INNER (seg) DCN_BASE__INST0_SEG ## seg
@@ -219,12 +224,15 @@ static const struct irq_source_info_funcs vblank_irq_info_funcs = { .funcs = &pflip_irq_info_funcs\ } -#define vupdate_int_entry (reg_num)\ +/* vupdate_no_lock_int_entry maps to DC_IRQ_SOURCE_VUPDATEx, to match semantic +* of DCE's DC_IRQ_SOURCE_VUPDATEx. +*/ +#define vupdate_no_lock_int_entry (reg_num)\ [DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\ IRQ_REG_ENTRY(OTG, reg_num,\ - OTG_GLOBAL_SYNC_STATUS, VUPDATE_INT_EN,\ - OTG_GLOBAL_SYNC_STATUS, VUPDATE_EVENT_CLEAR),\ - .funcs = &vblank_irq_info_funcs\ + OTG_GLOBAL_SYNC_STATUS, VUPDATE_NO_LOCK_INT_EN,\ + OTG_GLOBAL_SYNC_STATUS, VUPDATE_NO_LOCK_EVENT_CLEAR),\ + .funcs = &vupdate_no_lock_irq_info_funcs\ }#define vblank_int_entry (reg_num)\
@@ -331,12 +339,12 @@ irq_source_info_dcn20[DAL_IRQ_SOURCES_NUMBER] = { dc_underflow_int_entry(6), [DC_IRQ_SOURCE_DMCU_SCP] = dummy_irq_entry(), [DC_IRQ_SOURCE_VBIOS_SW ] =dummy_irq_entry (), -vupdate_int_entry (0 ), -vupdate_int_entry (1 ), -vupdate_int_entry (2 ), -vupdate_int_entry (3 ), -vupdate_int_entry (4 ), -vupdate_int_entry (5 ), +vupdate_no_lock_int_entry (0 ), +vupdate_no_lock_int_entry (1 ), +vupdate_no_lock_int_entry (2 ), +vupdate_no_lock_int_entry (3 ), +vupdate_no_lock_int_entry (4 ), +vupdate_no_lock_int_entry (5 ),vblank_int_entry (0 ),vblank_int_entry (1 ), vblank_int_entry(2),
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 38/49 drm/amd/display: Add enum for H-timing divider mode
In reply to a message not in the archiveFrom: Qingqing Zhuo <[email protected]>
Add h_timing_div_mode enum to better reflect possible register values. Replace previously programmed values with enum
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c | 9 +++++---- drivers/gpu/drm/amd/display/dc/inc/hw/timing_generator.h | 5 +++++ 2 files changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c +5 -4
@@ -154,7 +154,7 @@ void optc1_program_timing(uint32_t h_sync_polarity, v_sync_polarity;uint32_t start_point =0 ;uint32_t field_num =0 ; -uint32_t h_div_2; +enum h_timing_div_mode h_div =H_TIMING_NO_DIV ;struct optc *optc1 =DCN10TG_FROM_TG (optc);
@@ -285,10 +285,11 @@ void optc1_program_timing(* of stereo handled in explicit call */ - h_div_2 =optc1_is_two_pixels_per_containter (&patched_crtc_timing); -REG_UPDATE (OTG_H_TIMING_CNTL , -OTG_H_TIMING_DIV_BY2 , h_div_2 || optc1->opp_count ==2 ); +if (optc1_is_two_pixels_per_containter (&patched_crtc_timing) || optc1->opp_count ==2 ) + h_div =H_TIMING_DIV_BY2 ; +REG_UPDATE (OTG_H_TIMING_CNTL , +OTG_H_TIMING_DIV_BY2 , h_div); } void optc1_set_vtg_params(struct timing_generator *optc,
drivers/gpu/drm/amd/display/dc/inc/hw/timing_generator.h +5 -0
@@ -96,6 +96,11 @@ enum crc_selection { INTERSECT_WINDOW_NOT_A_NOT_B, }; +enum h_timing_div_mode { +H_TIMING_NO_DIV , +H_TIMING_DIV_BY2 , +}; +struct crc_params {/* Regions used to calculate CRC*/ uint16_t windowa_x_start;
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 39/49 drm/amd/display: Remove redundant definition of dwb_source enums
In reply to a message not in the archiveFrom: Julian Parkin <[email protected]>
There are repeated (but guarded) definitions of dwb_src enums. There are also unused entires. Clean them up.
--- drivers/gpu/drm/amd/display/dc/inc/hw/dwb.h | 12 ------------ 1 file changed, 12 deletions(-)
drivers/gpu/drm/amd/display/dc/inc/hw/dwb.h +0 -12
@@ -45,22 +45,10 @@ enum dwb_source { dwb_src_scl =0 ,/* for DCE7x/9x, DCN won't support. */ dwb_src_blnd,/* for DCE7x/9x */ dwb_src_fmt,/* for DCE7x/9x */ -#if defined(CONFIG_DRM_AMD_DC_DCN2_0 ) dwb_src_otg0 =0x100 ,/* for DCN1.x/DCN2.x, register: mmDWB_SOURCE_SELECT */ dwb_src_otg1,/* for DCN1.x/DCN2.x */ dwb_src_otg2,/* for DCN1.x/DCN2.x */ dwb_src_otg3, /* for DCN1.x/DCN2.x */ -#else - dwb_src_otg0 =0x100 ,/* for DCN1.x, register: mmDWB_SOURCE_SELECT */ - dwb_src_otg1,/* for DCN1.x */ - dwb_src_otg2,/* for DCN1.x */ - dwb_src_otg3,/* for DCN1.x */ -#endif - dwb_src_mpc0 =0x200 ,/* for DCN2, register: mmMPC_DWB0_MUX, mmMPC_DWB1_MUX, mmMPC_DWB2_MUX */ - dwb_src_mpc1,/* for DCN2 */ - dwb_src_mpc2,/* for DCN2 */ - dwb_src_mpc3,/* for DCN2 */ - dwb_src_mpc4, /* for DCN2 */ };#if defined(CONFIG_DRM_AMD_DC_DCN2_0 )
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 40/49 drm/amd/display: Add Logging for Gamma Related information (2/2)
In reply to a message not in the archiveFrom: Wyatt Wood <[email protected]>
[Why]
A recent bug showed that logging would be useful in debugging various gamma issues.
[How]
Add logging in dc.
--- .../amd/display/dc/dcn10/dcn10_cm_common.c | 4 +-- .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 32 +++++++++++++++++++ .../drm/amd/display/include/logger_types.h | 6 ++++ 3 files changed, 40 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c +2 -2
@@ -343,8 +343,8 @@ bool cm_helper_translate_curve_to_hw_format( region_start = -MAX_LOW_POINT ; region_end =NUMBER_REGIONS -MAX_LOW_POINT ; }else { -/* 10 segments -* segment is from 2^-10 to 2^0 +/* 11 segments +* segment is from 2^-10 to 2^1 * There are less than 256 points, for optimization */ seg_distr[0 ] =3 ;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +32 -0
@@ -1434,6 +1434,34 @@ static bool dcn10_set_input_transfer_func(struct pipe_ctx *pipe_ctx,return result; } +#define MAX_NUM_HW_POINTS 0x200 + +static void log_tf (struct dc_context *ctx, +struct dc_transfer_func *tf,uint32_t hw_points_num) +{ +// DC_LOG_GAMMA is default logging of all hw points +// DC_LOG_ALL_GAMMA logs all points, not only hw points +// DC_LOG_ALL_TF_POINTS logs all channels of the tf +int i =0 ; + +DC_LOGGER_INIT (ctx->logger); +DC_LOG_GAMMA ("Gamma Correction TF" ); +DC_LOG_ALL_GAMMA ("Logging all tf points..." ); +DC_LOG_ALL_TF_CHANNELS ("Logging all channels..." ); + +for (i =0 ; i < hw_points_num; i++) { +DC_LOG_GAMMA ("R %d %llu\n" , i, tf->tf_pts.red[i].value); +DC_LOG_ALL_TF_CHANNELS ("G %d, %llu\n" , i, tf->tf_pts.green[i].value); +DC_LOG_ALL_TF_CHANNELS ("B %d, %llu\n" , i, tf->tf_pts.blue[i].value); + } + +for (i = hw_points_num; i <MAX_NUM_HW_POINTS ; i++) { +DC_LOG_ALL_GAMMA ("R %d %llu\n" , i, tf->tf_pts.red[i].value); +DC_LOG_ALL_TF_CHANNELS ("G %d %llu\n" , i, tf->tf_pts.green[i].value); +DC_LOG_ALL_TF_CHANNELS ("B %d %llu\n" , i, tf->tf_pts.blue[i].value); + } +} +static bool dcn10_set_output_transfer_func (struct pipe_ctx *pipe_ctx,const struct dc_stream_state *stream)
@@ -1462,6 +1490,10 @@ dcn10_set_output_transfer_func(struct pipe_ctx *pipe_ctx, }else dpp->funcs->dpp_program_regamma_pwl (dpp,NULL ,OPP_REGAMMA_BYPASS ); +log_tf (stream->ctx, + stream->out_transfer_func, + dpp->regamma_params.hw_points_num); +return true; }
drivers/gpu/drm/amd/display/include/logger_types.h +6 -0
@@ -63,6 +63,9 @@#define DC_LOG_IF_TRACE (...) pr_debug("[IF_TRACE]:"__VA_ARGS__)#define DC_LOG_PERF_TRACE (...) DRM_DEBUG_KMS(__VA_ARGS__)#define DC_LOG_RETIMER_REDRIVER (...) DRM_DEBUG_KMS(__VA_ARGS__) +#define DC_LOG_GAMMA (...) pr_debug("[GAMMA]:"__VA_ARGS__) +#define DC_LOG_ALL_GAMMA (...) pr_debug("[GAMMA]:"__VA_ARGS__) +#define DC_LOG_ALL_TF_CHANNELS (...) pr_debug("[GAMMA]:"__VA_ARGS__)#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT #define DC_LOG_DSC (...) DRM_DEBUG_KMS(__VA_ARGS__)#endif
@@ -118,6 +121,9 @@ enum dc_log_type {#endif LOG_DWB ,LOG_GAMMA_DEBUG , +LOG_MAX_HW_POINTS , +LOG_ALL_TF_CHANNELS , +LOG_SAMPLE_1DLUT , LOG_SECTION_TOTAL_COUNT };
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 41/49 drm/amd/display: Add and refine DSC logs in enable sequence
In reply to a message not in the archiveFrom: Nikola Cornij <[email protected]>
[why]
Some logs messages were not precise and some new log messages were needed after "get packed PPS" function was introduced
--- .../drm/amd/display/dc/core/dc_link_hwss.c | 34 ++++++++++++++----- .../gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c | 14 +++++--- 2 files changed, 35 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +26 -8
@@ -342,10 +342,22 @@ void dp_retrain_link_dp_test(struct dc_link *link,static void dsc_optc_config_log (struct display_stream_compressor *dsc,struct dsc_optc_config *config) { -DC_LOG_DSC ("Setting optc DSC config at DSC inst %d" , dsc->inst); -DC_LOG_DSC ("\n\tbytes_per_pixel %d\n\tis_pixel_format_444 %d\n\tslice_width %d" , - config->bytes_per_pixel, - config->is_pixel_format_444, config->slice_width); +uint32_t precision =1 <<28 ; +uint32_t bytes_per_pixel_int = config->bytes_per_pixel / precision; +uint32_t bytes_per_pixel_mod = config->bytes_per_pixel % precision; +uint64_t ll_bytes_per_pix_fraq = bytes_per_pixel_mod; + +/* 7 fractional digits decimal precision for bytes per pixel is enough because DSC +* bits per pixel precision is 1/16th of a pixel, which means bytes per pixel precision is +* 1/16/8 = 1/128 of a byte, or 0.0078125 decimal +*/ + ll_bytes_per_pix_fraq *=10000000 ; + ll_bytes_per_pix_fraq /= precision; + +DC_LOG_DSC ("\tbytes_per_pixel 0x%08x (%d.%07d)" , + config->bytes_per_pixel, bytes_per_pixel_int, (uint32_t )ll_bytes_per_pix_fraq); +DC_LOG_DSC ("\tis_pixel_format_444 %d" , config->is_pixel_format_444); +DC_LOG_DSC ("\tslice_width %d" , config->slice_width); }static bool dp_set_dsc_on_rx (struct pipe_ctx *pipe_ctx,bool enable)
@@ -400,17 +412,21 @@ void dp_set_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable) optc_dsc_mode = dsc_optc_cfg.is_pixel_format_444 ?OPTC_DSC_ENABLED_444 :OPTC_DSC_ENABLED_NATIVE_SUBSAMPLED ; -dsc_optc_config_log (dsc, &dsc_optc_cfg);/* Enable DSC in encoder */ -if (dc_is_dp_signal (stream->signal) && !IS_FPGA_MAXIMUS_DC (core_dc->ctx->dce_environment)) +if (dc_is_dp_signal (stream->signal) && !IS_FPGA_MAXIMUS_DC (core_dc->ctx->dce_environment)) { +DC_LOG_DSC ("Setting stream encoder DSC config for engine %d:" , (int )pipe_ctx->stream_res.stream_enc->id); +dsc_optc_config_log (dsc, &dsc_optc_cfg); pipe_ctx->stream_res.stream_enc->funcs->dp_set_dsc_config (pipe_ctx->stream_res.stream_enc, optc_dsc_mode, dsc_optc_cfg.bytes_per_pixel, dsc_optc_cfg.slice_width);/* PPS SDP is set elsewhere because it has to be done after DIG FE is connected to DIG BE */ + }/* Enable DSC in OPTC */ +DC_LOG_DSC ("Setting optc DSC config for tg instance %d:" , pipe_ctx->stream_res.tg->inst); +dsc_optc_config_log (dsc, &dsc_optc_cfg); pipe_ctx->stream_res.tg->funcs->set_dsc_config(pipe_ctx->stream_res.tg, optc_dsc_mode, dsc_optc_cfg.bytes_per_pixel,
@@ -482,13 +498,15 @@ bool dp_set_dsc_pps_sdp(struct pipe_ctx *pipe_ctx, bool enable) dsc_cfg.color_depth = stream->timing.display_color_depth; dsc_cfg.dc_dsc_cfg = stream->timing.dsc_cfg; +DC_LOG_DSC (" " ); dsc->funcs->dsc_get_packed_pps (dsc, &dsc_cfg, &dsc_packed_pps[0 ]); -if (dc_is_dp_signal (stream->signal) && !IS_FPGA_MAXIMUS_DC (core_dc->ctx->dce_environment)) +if (dc_is_dp_signal (stream->signal) && !IS_FPGA_MAXIMUS_DC (core_dc->ctx->dce_environment)) { +DC_LOG_DSC ("Setting stream encoder DSC PPS SDP for engine %d\n" , (int )pipe_ctx->stream_res.stream_enc->id); pipe_ctx->stream_res.stream_enc->funcs->dp_set_dsc_pps_info_packet ( pipe_ctx->stream_res.stream_enc, true, &dsc_packed_pps[0 ]); - + } }else {/* disable DSC PPS in stream encoder */ if (dc_is_dp_signal (stream->signal) && !IS_FPGA_MAXIMUS_DC (core_dc->ctx->dce_environment)) {
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c +9 -5
@@ -175,11 +175,13 @@ static bool dsc2_validate_stream(struct display_stream_compressor *dsc, const ststatic void dsc_config_log (struct display_stream_compressor *dsc,const struct dsc_config *config) { -DC_LOG_DSC ("\n\tnum_slices_h %d\n\tnum_slices_v %d\n\tbits_per_pixel %d\n\tcolor_depth %d" , - config->dc_dsc_cfg.num_slices_h, - config->dc_dsc_cfg.num_slices_v, +DC_LOG_DSC ("\tnum_slices_h %d" , config->dc_dsc_cfg.num_slices_h); +DC_LOG_DSC ("\tnum_slices_v %d" , config->dc_dsc_cfg.num_slices_v); +DC_LOG_DSC ("\tbits_per_pixel %d (%d.%04d)" , config->dc_dsc_cfg.bits_per_pixel, - config->color_depth); + config->dc_dsc_cfg.bits_per_pixel /16 , + ((config->dc_dsc_cfg.bits_per_pixel %16 ) *10000 ) /16 ); +DC_LOG_DSC ("\tcolor_depth %d" , config->color_depth); } static void dsc2_set_config(struct display_stream_compressor *dsc, const struct dsc_config *dsc_cfg,
@@ -188,6 +190,7 @@ static void dsc2_set_config(struct display_stream_compressor *dsc, const structbool is_config_ok;struct dcn20_dsc *dsc20 =TO_DCN20_DSC (dsc); +DC_LOG_DSC (" " );DC_LOG_DSC ("Setting DSC Config at DSC inst %d" , dsc->inst);dsc_config_log (dsc, dsc_cfg); is_config_ok =dsc_prepare_config (dsc_cfg, &dsc20->reg_vals, dsc_optc_cfg);
@@ -204,8 +207,9 @@ static bool dsc2_get_packed_pps(struct display_stream_compressor *dsc, const strstruct dsc_reg_values dsc_reg_vals;struct dsc_optc_config dsc_optc_cfg; -DC_LOG_DSC ("Packed DSC PPS for DSC Config:" ); +DC_LOG_DSC ("Getting packed DSC PPS for DSC Config:" );dsc_config_log (dsc, dsc_cfg); +DC_LOG_DSC ("DSC Picture Parameter Set (PPS):" ); is_config_ok =dsc_prepare_config (dsc_cfg, &dsc_reg_vals, &dsc_optc_cfg);ASSERT (is_config_ok);drm_dsc_pps_payload_pack ((struct drm_dsc_picture_parameter_set *)dsc_packed_pps, &dsc_reg_vals.pps);
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 42/49 drm/amd/display: 3.2.45
In reply to a message not in the archiveFrom: Anthony Koo <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
@@ -39,7 +39,7 @@#include "inc/hw/dmcu.h" #include "dml/display_mode_lib.h" -#define DC_VER "3.2.44" +#define DC_VER "3.2.45"#define MAX_SURFACES 3#define MAX_PLANES 6
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 43/49 drm/amd/display: fix dcn20 global sync dml param extraction
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
Currently the paremeters are extracted as if dml is calculating using pipes as we pass them in. in reality, dml internally merges pipes into planes if pipe split is detected.
This change adds reverse logic to dcn20_calculate_dlg_params so that the global sync parameters can be correctly extracted for all the pipes when pipe split is enabled.
--- .../drm/amd/display/dc/dcn20/dcn20_resource.c | 229 ++++++++++-------- .../gpu/drm/amd/display/dc/inc/core_types.h | 1 - 2 files changed, 131 insertions(+), 99 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +131 -98
@@ -2436,100 +2436,100 @@ void dcn20_calculate_wm(int pipe_cnt, i, pipe_idx;for (i =0 , pipe_idx =0 , pipe_cnt =0 ; i < dc->res_pool->pipe_count; i++) { -if (!context->res_ctx.pipe_ctx[i].stream) -continue ; - - pipes[pipe_cnt].clks_cfg.refclk_mhz = dc->res_pool->ref_clocks.dchub_ref_clock_inKhz /1000.0 ; - pipes[pipe_cnt].clks_cfg.dispclk_mhz = context->bw_ctx.dml.vba.RequiredDISPCLK[vlevel][context->bw_ctx.dml.vba.maxMpcComb]; - -if (pipe_split_from[i] <0 ) { - pipes[pipe_cnt].clks_cfg.dppclk_mhz = - context->bw_ctx.dml.vba.RequiredDPPCLK[vlevel][context->bw_ctx.dml.vba.maxMpcComb][pipe_idx]; -if (context->bw_ctx.dml.vba.BlendingAndTiming[pipe_idx] == pipe_idx) - pipes[pipe_cnt].pipe.dest.odm_combine = - context->bw_ctx.dml.vba.ODMCombineEnablePerState[vlevel][pipe_idx]; -else - pipes[pipe_cnt].pipe.dest.odm_combine =0 ; - pipe_idx++; - }else { - pipes[pipe_cnt].clks_cfg.dppclk_mhz = - context->bw_ctx.dml.vba.RequiredDPPCLK[vlevel][context->bw_ctx.dml.vba.maxMpcComb][pipe_split_from[i]]; -if (context->bw_ctx.dml.vba.BlendingAndTiming[pipe_split_from[i]] == pipe_split_from[i]) - pipes[pipe_cnt].pipe.dest.odm_combine = - context->bw_ctx.dml.vba.ODMCombineEnablePerState[vlevel][pipe_split_from[i]]; -else - pipes[pipe_cnt].pipe.dest.odm_combine =0 ; - } - -if (dc->config.forced_clocks) { - pipes[pipe_cnt].clks_cfg.dispclk_mhz = context->bw_ctx.dml.soc.clock_limits[0 ].dispclk_mhz; - pipes[pipe_cnt].clks_cfg.dppclk_mhz = context->bw_ctx.dml.soc.clock_limits[0 ].dppclk_mhz; - } -if (dc->debug.min_disp_clk_khz > pipes[pipe_cnt].clks_cfg.dispclk_mhz *1000 ) - pipes[pipe_cnt].clks_cfg.dispclk_mhz = dc->debug.min_disp_clk_khz /1000.0 ; -if (dc->debug.min_dpp_clk_khz > pipes[pipe_cnt].clks_cfg.dppclk_mhz *1000 ) - pipes[pipe_cnt].clks_cfg.dppclk_mhz = dc->debug.min_dpp_clk_khz /1000.0 ; +if (!context->res_ctx.pipe_ctx[i].stream) +continue ; - pipe_cnt++; - } + pipes[pipe_cnt].clks_cfg.refclk_mhz = dc->res_pool->ref_clocks.dchub_ref_clock_inKhz /1000.0 ; + pipes[pipe_cnt].clks_cfg.dispclk_mhz = context->bw_ctx.dml.vba.RequiredDISPCLK[vlevel][context->bw_ctx.dml.vba.maxMpcComb]; -if (pipe_cnt != pipe_idx) { -if (dc->res_pool->funcs->populate_dml_pipes) - pipe_cnt = dc->res_pool->funcs->populate_dml_pipes (dc, - &context->res_ctx, pipes); +if (pipe_split_from[i] <0 ) { + pipes[pipe_cnt].clks_cfg.dppclk_mhz = + context->bw_ctx.dml.vba.RequiredDPPCLK[vlevel][context->bw_ctx.dml.vba.maxMpcComb][pipe_idx]; +if (context->bw_ctx.dml.vba.BlendingAndTiming[pipe_idx] == pipe_idx) + pipes[pipe_cnt].pipe.dest.odm_combine = + context->bw_ctx.dml.vba.ODMCombineEnablePerState[vlevel][pipe_idx];else - pipe_cnt =dcn20_populate_dml_pipes_from_context (dc, - &context->res_ctx, pipes); + pipes[pipe_cnt].pipe.dest.odm_combine =0 ; + pipe_idx++; + }else { + pipes[pipe_cnt].clks_cfg.dppclk_mhz = + context->bw_ctx.dml.vba.RequiredDPPCLK[vlevel][context->bw_ctx.dml.vba.maxMpcComb][pipe_split_from[i]]; +if (context->bw_ctx.dml.vba.BlendingAndTiming[pipe_split_from[i]] == pipe_split_from[i]) + pipes[pipe_cnt].pipe.dest.odm_combine = + context->bw_ctx.dml.vba.ODMCombineEnablePerState[vlevel][pipe_split_from[i]]; +else + pipes[pipe_cnt].pipe.dest.odm_combine =0 ; } - *out_pipe_cnt = pipe_cnt; +if (dc->config.forced_clocks) { + pipes[pipe_cnt].clks_cfg.dispclk_mhz = context->bw_ctx.dml.soc.clock_limits[0 ].dispclk_mhz; + pipes[pipe_cnt].clks_cfg.dppclk_mhz = context->bw_ctx.dml.soc.clock_limits[0 ].dppclk_mhz; + } +if (dc->debug.min_disp_clk_khz > pipes[pipe_cnt].clks_cfg.dispclk_mhz *1000 ) + pipes[pipe_cnt].clks_cfg.dispclk_mhz = dc->debug.min_disp_clk_khz /1000.0 ; +if (dc->debug.min_dpp_clk_khz > pipes[pipe_cnt].clks_cfg.dppclk_mhz *1000 ) + pipes[pipe_cnt].clks_cfg.dppclk_mhz = dc->debug.min_dpp_clk_khz /1000.0 ; - pipes[0 ].clks_cfg.voltage = vlevel; - pipes[0 ].clks_cfg.dcfclk_mhz = context->bw_ctx.dml.soc.clock_limits[vlevel].dcfclk_mhz; - pipes[0 ].clks_cfg.socclk_mhz = context->bw_ctx.dml.soc.clock_limits[vlevel].socclk_mhz; + pipe_cnt++; + } -/* only pipe 0 is read for voltage and dcf/soc clocks */ -if (vlevel <1 ) { - pipes[0 ].clks_cfg.voltage =1 ; - pipes[0 ].clks_cfg.dcfclk_mhz = context->bw_ctx.dml.soc.clock_limits[1 ].dcfclk_mhz; - pipes[0 ].clks_cfg.socclk_mhz = context->bw_ctx.dml.soc.clock_limits[1 ].socclk_mhz; - } - context->bw_ctx.bw.dcn.watermarks.b.urgent_ns =get_wm_urgent (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; - context->bw_ctx.bw.dcn.watermarks.b.cstate_pstate.cstate_enter_plus_exit_ns =get_wm_stutter_enter_exit (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; - context->bw_ctx.bw.dcn.watermarks.b.cstate_pstate.cstate_exit_ns =get_wm_stutter_exit (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; - context->bw_ctx.bw.dcn.watermarks.b.cstate_pstate.pstate_change_ns =get_wm_dram_clock_change (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; - context->bw_ctx.bw.dcn.watermarks.b.pte_meta_urgent_ns =get_wm_memory_trip (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; - -if (vlevel <2 ) { - pipes[0 ].clks_cfg.voltage =2 ; - pipes[0 ].clks_cfg.dcfclk_mhz = context->bw_ctx.dml.soc.clock_limits[2 ].dcfclk_mhz; - pipes[0 ].clks_cfg.socclk_mhz = context->bw_ctx.dml.soc.clock_limits[2 ].socclk_mhz; - } - context->bw_ctx.bw.dcn.watermarks.c.urgent_ns =get_wm_urgent (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; - context->bw_ctx.bw.dcn.watermarks.c.cstate_pstate.cstate_enter_plus_exit_ns =get_wm_stutter_enter_exit (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; - context->bw_ctx.bw.dcn.watermarks.c.cstate_pstate.cstate_exit_ns =get_wm_stutter_exit (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; - context->bw_ctx.bw.dcn.watermarks.c.cstate_pstate.pstate_change_ns =get_wm_dram_clock_change (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; - context->bw_ctx.bw.dcn.watermarks.c.pte_meta_urgent_ns =get_wm_memory_trip (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; - -if (vlevel <3 ) { - pipes[0 ].clks_cfg.voltage =3 ; - pipes[0 ].clks_cfg.dcfclk_mhz = context->bw_ctx.dml.soc.clock_limits[2 ].dcfclk_mhz; - pipes[0 ].clks_cfg.socclk_mhz = context->bw_ctx.dml.soc.clock_limits[2 ].socclk_mhz; - } - context->bw_ctx.bw.dcn.watermarks.d.urgent_ns =get_wm_urgent (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; - context->bw_ctx.bw.dcn.watermarks.d.cstate_pstate.cstate_enter_plus_exit_ns =get_wm_stutter_enter_exit (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; - context->bw_ctx.bw.dcn.watermarks.d.cstate_pstate.cstate_exit_ns =get_wm_stutter_exit (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; - context->bw_ctx.bw.dcn.watermarks.d.cstate_pstate.pstate_change_ns =get_wm_dram_clock_change (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; - context->bw_ctx.bw.dcn.watermarks.d.pte_meta_urgent_ns =get_wm_memory_trip (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; - - pipes[0 ].clks_cfg.voltage = vlevel; - pipes[0 ].clks_cfg.dcfclk_mhz = context->bw_ctx.dml.soc.clock_limits[vlevel].dcfclk_mhz; - pipes[0 ].clks_cfg.socclk_mhz = context->bw_ctx.dml.soc.clock_limits[vlevel].socclk_mhz; - context->bw_ctx.bw.dcn.watermarks.a.urgent_ns =get_wm_urgent (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; - context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.cstate_enter_plus_exit_ns =get_wm_stutter_enter_exit (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; - context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.cstate_exit_ns =get_wm_stutter_exit (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; - context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.pstate_change_ns =get_wm_dram_clock_change (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; - context->bw_ctx.bw.dcn.watermarks.a.pte_meta_urgent_ns =get_wm_memory_trip (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; +if (pipe_cnt != pipe_idx) { +if (dc->res_pool->funcs->populate_dml_pipes) + pipe_cnt = dc->res_pool->funcs->populate_dml_pipes (dc, + &context->res_ctx, pipes); +else + pipe_cnt =dcn20_populate_dml_pipes_from_context (dc, + &context->res_ctx, pipes); + } + + *out_pipe_cnt = pipe_cnt; + + pipes[0 ].clks_cfg.voltage = vlevel; + pipes[0 ].clks_cfg.dcfclk_mhz = context->bw_ctx.dml.soc.clock_limits[vlevel].dcfclk_mhz; + pipes[0 ].clks_cfg.socclk_mhz = context->bw_ctx.dml.soc.clock_limits[vlevel].socclk_mhz; + +/* only pipe 0 is read for voltage and dcf/soc clocks */ +if (vlevel <1 ) { + pipes[0 ].clks_cfg.voltage =1 ; + pipes[0 ].clks_cfg.dcfclk_mhz = context->bw_ctx.dml.soc.clock_limits[1 ].dcfclk_mhz; + pipes[0 ].clks_cfg.socclk_mhz = context->bw_ctx.dml.soc.clock_limits[1 ].socclk_mhz; + } + context->bw_ctx.bw.dcn.watermarks.b.urgent_ns =get_wm_urgent (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; + context->bw_ctx.bw.dcn.watermarks.b.cstate_pstate.cstate_enter_plus_exit_ns =get_wm_stutter_enter_exit (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; + context->bw_ctx.bw.dcn.watermarks.b.cstate_pstate.cstate_exit_ns =get_wm_stutter_exit (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; + context->bw_ctx.bw.dcn.watermarks.b.cstate_pstate.pstate_change_ns =get_wm_dram_clock_change (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; + context->bw_ctx.bw.dcn.watermarks.b.pte_meta_urgent_ns =get_wm_memory_trip (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; + +if (vlevel <2 ) { + pipes[0 ].clks_cfg.voltage =2 ; + pipes[0 ].clks_cfg.dcfclk_mhz = context->bw_ctx.dml.soc.clock_limits[2 ].dcfclk_mhz; + pipes[0 ].clks_cfg.socclk_mhz = context->bw_ctx.dml.soc.clock_limits[2 ].socclk_mhz; + } + context->bw_ctx.bw.dcn.watermarks.c.urgent_ns =get_wm_urgent (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; + context->bw_ctx.bw.dcn.watermarks.c.cstate_pstate.cstate_enter_plus_exit_ns =get_wm_stutter_enter_exit (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; + context->bw_ctx.bw.dcn.watermarks.c.cstate_pstate.cstate_exit_ns =get_wm_stutter_exit (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; + context->bw_ctx.bw.dcn.watermarks.c.cstate_pstate.pstate_change_ns =get_wm_dram_clock_change (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; + context->bw_ctx.bw.dcn.watermarks.c.pte_meta_urgent_ns =get_wm_memory_trip (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; + +if (vlevel <3 ) { + pipes[0 ].clks_cfg.voltage =3 ; + pipes[0 ].clks_cfg.dcfclk_mhz = context->bw_ctx.dml.soc.clock_limits[2 ].dcfclk_mhz; + pipes[0 ].clks_cfg.socclk_mhz = context->bw_ctx.dml.soc.clock_limits[2 ].socclk_mhz; + } + context->bw_ctx.bw.dcn.watermarks.d.urgent_ns =get_wm_urgent (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; + context->bw_ctx.bw.dcn.watermarks.d.cstate_pstate.cstate_enter_plus_exit_ns =get_wm_stutter_enter_exit (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; + context->bw_ctx.bw.dcn.watermarks.d.cstate_pstate.cstate_exit_ns =get_wm_stutter_exit (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; + context->bw_ctx.bw.dcn.watermarks.d.cstate_pstate.pstate_change_ns =get_wm_dram_clock_change (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; + context->bw_ctx.bw.dcn.watermarks.d.pte_meta_urgent_ns =get_wm_memory_trip (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; + + pipes[0 ].clks_cfg.voltage = vlevel; + pipes[0 ].clks_cfg.dcfclk_mhz = context->bw_ctx.dml.soc.clock_limits[vlevel].dcfclk_mhz; + pipes[0 ].clks_cfg.socclk_mhz = context->bw_ctx.dml.soc.clock_limits[vlevel].socclk_mhz; + context->bw_ctx.bw.dcn.watermarks.a.urgent_ns =get_wm_urgent (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; + context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.cstate_enter_plus_exit_ns =get_wm_stutter_enter_exit (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; + context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.cstate_exit_ns =get_wm_stutter_exit (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; + context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.pstate_change_ns =get_wm_dram_clock_change (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; + context->bw_ctx.bw.dcn.watermarks.a.pte_meta_urgent_ns =get_wm_memory_trip (&context->bw_ctx.dml, pipes, pipe_cnt) *1000 ; } void dcn20_calculate_dlg_params(
@@ -2538,7 +2538,8 @@ void dcn20_calculate_dlg_params(int pipe_cnt, int vlevel) { - int i, pipe_idx; + int i, j, pipe_idx, pipe_idx_unsplit; +bool visited[MAX_PIPES ] = {0 };/* Writeback MCIF_WB arbitration parameters */ dc->res_pool->funcs->set_mcif_arb_params (dc, context, pipes, pipe_cnt);
@@ -2554,31 +2555,63 @@ void dcn20_calculate_dlg_params( != dm_dram_clock_change_unsupported; context->bw_ctx.bw.dcn.clk.dppclk_khz =0 ; +/* +* An artifact of dml pipe split/odm is that pipes get merged back together for +* calculation. Therefore we need to only extract for first pipe in ascending index order +* and copy into the other split half. +*/ +for (i =0 , pipe_idx =0 , pipe_idx_unsplit =0 ; i < dc->res_pool->pipe_count; i++) { +if (!context->res_ctx.pipe_ctx[i].stream) +continue ; +if (!visited[pipe_idx]) { +display_pipe_source_params_st *src = &pipes[pipe_idx_unsplit].pipe.src; +display_pipe_dest_params_st *dst = &pipes[pipe_idx_unsplit].pipe.dest; + + dst->vstartup_start = context->bw_ctx.dml.vba.VStartup[pipe_idx_unsplit]; + dst->vupdate_offset = context->bw_ctx.dml.vba.VUpdateOffsetPix[pipe_idx_unsplit]; + dst->vupdate_width = context->bw_ctx.dml.vba.VUpdateWidthPix[pipe_idx_unsplit]; + dst->vready_offset = context->bw_ctx.dml.vba.VReadyOffsetPix[pipe_idx_unsplit]; +/* +* j iterates inside pipes array, unlike i which iterates inside +* pipe_ctx array +*/ +if (src->is_hsplit) +for (j = pipe_idx +1 ; j < pipe_cnt; j++) { +display_pipe_source_params_st *src_j = &pipes[j].pipe.src; +display_pipe_dest_params_st *dst_j = &pipes[j].pipe.dest; + +if (src_j->is_hsplit && !visited[j] + && src->hsplit_grp == src_j->hsplit_grp) { + dst_j->vstartup_start = context->bw_ctx.dml.vba.VStartup[pipe_idx_unsplit]; + dst_j->vupdate_offset = context->bw_ctx.dml.vba.VUpdateOffsetPix[pipe_idx_unsplit]; + dst_j->vupdate_width = context->bw_ctx.dml.vba.VUpdateWidthPix[pipe_idx_unsplit]; + dst_j->vready_offset = context->bw_ctx.dml.vba.VReadyOffsetPix[pipe_idx_unsplit]; + visited[j] = true; + } + } + visited[pipe_idx] = true; + pipe_idx_unsplit++; + } + pipe_idx++; + }for (i =0 , pipe_idx =0 ; i < dc->res_pool->pipe_count; i++) {if (!context->res_ctx.pipe_ctx[i].stream)continue ; - pipes[pipe_idx].pipe.dest.vstartup_start = context->bw_ctx.dml.vba.VStartup[pipe_idx]; - pipes[pipe_idx].pipe.dest.vupdate_offset = context->bw_ctx.dml.vba.VUpdateOffsetPix[pipe_idx]; - pipes[pipe_idx].pipe.dest.vupdate_width = context->bw_ctx.dml.vba.VUpdateWidthPix[pipe_idx]; - pipes[pipe_idx].pipe.dest.vready_offset = context->bw_ctx.dml.vba.VReadyOffsetPix[pipe_idx];if (context->bw_ctx.bw.dcn.clk.dppclk_khz < pipes[pipe_idx].clks_cfg.dppclk_mhz *1000 ) context->bw_ctx.bw.dcn.clk.dppclk_khz = pipes[pipe_idx].clks_cfg.dppclk_mhz *1000 ; context->res_ctx.pipe_ctx[i].plane_res.bw.dppclk_khz = pipes[pipe_idx].clks_cfg.dppclk_mhz *1000 ; -#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT - context->res_ctx.pipe_ctx[i].stream_res.dscclk_khz = - context->bw_ctx.dml.vba.DSCCLK_calculated[pipe_idx] *1000 ; -#endif +ASSERT (visited[pipe_idx]); context->res_ctx.pipe_ctx[i].pipe_dlg_param = pipes[pipe_idx].pipe.dest; pipe_idx++; }/*save a original dppclock copy*/ context->bw_ctx.bw.dcn.clk.bw_dppclk_khz = context->bw_ctx.bw.dcn.clk.dppclk_khz; context->bw_ctx.bw.dcn.clk.bw_dispclk_khz = context->bw_ctx.bw.dcn.clk.dispclk_khz; - context->bw_ctx.bw.dcn.clk.max_supported_dppclk_khz = context->bw_ctx.dml.soc.clock_limits[vlevel].dppclk_mhz*1000 ; - context->bw_ctx.bw.dcn.clk.max_supported_dispclk_khz = context->bw_ctx.dml.soc.clock_limits[vlevel].dispclk_mhz*1000 ; + context->bw_ctx.bw.dcn.clk.max_supported_dppclk_khz = context->bw_ctx.dml.soc.clock_limits[vlevel].dppclk_mhz *1000 ; + context->bw_ctx.bw.dcn.clk.max_supported_dispclk_khz = context->bw_ctx.dml.soc.clock_limits[vlevel].dispclk_mhz *1000 ;for (i =0 , pipe_idx =0 ; i < dc->res_pool->pipe_count; i++) {bool cstate_en = context->bw_ctx.dml.vba.PrefetchMode[vlevel][context->bw_ctx.dml.vba.maxMpcComb] !=2 ;
drivers/gpu/drm/amd/display/dc/inc/core_types.h +0 -1
@@ -234,7 +234,6 @@ struct stream_resource {struct output_pixel_processor *opp;#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT struct display_stream_compressor *dsc; -int dscclk_khz;#endif struct timing_generator *tg;struct stream_encoder *stream_enc;
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 44/49 drm/amd/display: 3.2.46
In reply to a message not in the archiveFrom: Anthony Koo <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
@@ -39,7 +39,7 @@#include "inc/hw/dmcu.h" #include "dml/display_mode_lib.h" -#define DC_VER "3.2.45" +#define DC_VER "3.2.46"#define MAX_SURFACES 3#define MAX_PLANES 6
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 45/49 drm/amd/display: enable dcn_mem_pwr as golden setting updates
In reply to a message not in the archiveFrom: Charlene Liu <[email protected]>
Enable dcn_mem_pwr as golden setting updates
--- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +1 -2
@@ -142,8 +142,7 @@ void dcn20_display_init(struct dc *dc)/* DCCG */ dcn20_dccg_init (hws); -/* Disable all memory low power mode. All memories are enabled. */ -REG_UPDATE (DC_MEM_GLOBAL_PWR_REQ_CNTL ,DC_MEM_GLOBAL_PWR_REQ_DIS ,1 ); +REG_UPDATE (DC_MEM_GLOBAL_PWR_REQ_CNTL ,DC_MEM_GLOBAL_PWR_REQ_DIS ,0 );/* DCHUB/MMHUBBUB * set global timer refclk divider
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 46/49 drm/amd/display: check hpd before retry verify link cap
In reply to a message not in the archiveFrom: Wenjing Liu <[email protected]>
[why]
During detection link training if a display is disconnected, the current code will retry 3 times of link training on disconnected link before giving up.
[how]
Before each retry check for HPD status, only retry verify link cap when HPD is still high. Also put a 10ms delay between each retry to improve the chance of success.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 27 +++++-------------- .../gpu/drm/amd/display/dc/core/dc_link_dp.c | 27 +++++++++++++++++++ .../gpu/drm/amd/display/dc/inc/dc_link_dp.h | 5 ++++ 3 files changed, 38 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +6 -21
@@ -852,16 +852,9 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason)dc_sink_release (prev_sink); }else {/* Empty dongle plug in */ -for (i =0 ; i <LINK_TRAINING_MAX_VERIFY_RETRY ; i++) { -int fail_count =0 ; - -dp_verify_link_cap (link, - &link->reported_link_cap, - &fail_count); - -if (fail_count ==0 ) -break ; - } +dp_verify_link_cap_with_retries (link, + &link->reported_link_cap, +LINK_TRAINING_MAX_VERIFY_RETRY ); }return true; }
@@ -965,17 +958,9 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason)*/ /* deal with non-mst cases */ -for (i =0 ; i <LINK_TRAINING_MAX_VERIFY_RETRY ; i++) { -int fail_count =0 ; - -dp_verify_link_cap (link, - &link->reported_link_cap, - &fail_count); - -if (fail_count ==0 ) -break ; - } - +dp_verify_link_cap_with_retries (link, + &link->reported_link_cap, +LINK_TRAINING_MAX_VERIFY_RETRY ); }else {// If edid is the same, then discard new sink and revert back to original sink if (same_edid) {
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +27 -0
@@ -1643,6 +1643,33 @@ bool dp_verify_link_cap(return success; } +bool dp_verify_link_cap_with_retries ( +struct dc_link *link, +struct dc_link_settings *known_limit_link_setting, +int attempts) +{ +uint8_t i =0 ; +bool success = false; + +for (i =0 ; i < attempts; i++) { +int fail_count =0 ; +enum dc_connection_type type; + +memset (&link->verified_link_cap,0 , +sizeof (struct dc_link_settings )); +if (!dc_link_detect_sink (link, &type)) { +break ; + }else if (dp_verify_link_cap (link, + &link->reported_link_cap, + &fail_count) && fail_count ==0 ) { + success = true; +break ; + } +msleep (10 ); + } +return success; +} +static struct dc_link_settings get_common_supported_link_settings (struct dc_link_settings link_setting_a,struct dc_link_settings link_setting_b)
drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h +5 -0
@@ -38,6 +38,11 @@ bool dp_verify_link_cap(struct dc_link_settings *known_limit_link_setting, int *fail_count); +bool dp_verify_link_cap_with_retries ( +struct dc_link *link, +struct dc_link_settings *known_limit_link_setting, +int attempts); +bool dp_validate_mode_timing (struct dc_link *link,const struct dc_crtc_timing *timing);
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 47/49 drm/amd/display: audio cannot switch to internal when display turns off
In reply to a message not in the archiveFrom: yanyan kang <[email protected]>
[why]disable_az_endpoint has been skipped becausedc->debug.az_endpoint_mute_only = true.
[how]
set dc->debug.az_endpoint_mute_only false when PPLIB’s PME notification function
pointer is not NULL at the dcn10_resource construct function,because right now SMU/PPLIB and DAL all have the AZ D3 force PME notification implemented. AZ D3 should work.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +8 -0
@@ -1414,6 +1414,14 @@ static bool construct( pool->base.pp_smu =dcn10_pp_smu_create (ctx); +/* +* Right now SMU/PPLIB and DAL all have the AZ D3 force PME notification * +* implemented. So AZ D3 should work.For issue 197007. * +*/ +if (pool->base.pp_smu !=NULL + && pool->base.pp_smu->rv_funcs.set_pme_wa_enable !=NULL ) + dc->debug.az_endpoint_mute_only = false; +if (!dc->debug.disable_pplib_clock_request)dcn_bw_update_from_pplib (dc);dcn_bw_sync_calcs_and_dml (dc);
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 48/49 drm/amd/display: Enable MPO with pre-blend color processing (RGB)
In reply to a message not in the archiveFrom: Michael Strauss <[email protected]>
[Why]
DCN10 performs color processing before MPC combination, causes color shift in RGB colorspaces when positive brightness offset is applied However, YCbCr is still unfixed and remains disabled
[How]
Add layerIndex to dc_plane_state and dc_plane_info structs Re-enable MPO when brightness is adjusted and colorspace is not YCbCr Set rear plane's brightness offset to 0 when front plane visible
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++ drivers/gpu/drm/amd/display/dc/core/dc.c | 2 + drivers/gpu/drm/amd/display/dc/dc.h | 2 + .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 51 ++++++++++++++++++- 4 files changed, 56 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -0
@@ -3077,6 +3077,8 @@ fill_dc_plane_info_and_addr(struct amdgpu_device *adev, plane_info->visible = true; plane_info->stereo_format =PLANE_STEREO_FORMAT_NONE ; + plane_info->layer_index =0 ; + ret =fill_plane_color_attributes (plane_state, plane_info->format, &plane_info->color_space);if (ret)
@@ -3142,6 +3144,7 @@ static int fill_dc_plane_attributes(struct amdgpu_device *adev, dc_plane_state->global_alpha = plane_info.global_alpha; dc_plane_state->global_alpha_value = plane_info.global_alpha_value; dc_plane_state->dcc = plane_info.dcc; + dc_plane_state->layer_index = plane_info.layer_index;// Always returns 0 /* * Always set input transfer function, since plane state is refreshed
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -0
@@ -1689,6 +1689,8 @@ static void copy_surface_update_to_plane( srf_update->plane_info->dcc; surface->sdr_white_level = srf_update->plane_info->sdr_white_level; + surface->layer_index = + srf_update->plane_info->layer_index; } if (srf_update->gamma &&
drivers/gpu/drm/amd/display/dc/dc.h +2 -0
@@ -750,6 +750,7 @@ struct dc_plane_state {bool visible;bool flip_immediate;bool horizontal_mirror; +int layer_index;union surface_update_flags update_flags;/* private to DC core */
@@ -779,6 +780,7 @@ struct dc_plane_info {bool global_alpha;int global_alpha_value;bool input_csc_enabled; +int layer_index; };struct dc_scaling_info {
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +49 -2
63 lines not on this page · raw message
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 49/49 drm/amd/display: Load NV12 SOC BB from firmware
In reply to a message not in the archiveFrom: Leo Li <[email protected]>
[Why]
Previous SOC bounding box firmware loading logic was for NV10, when we still had it in firmware. Now that it's brought into driver code, and NV12 BB is in firmware, this logic needs to be repurposed for NV12.
[How]
Set SOC_BOUNDING_BOX_VALID to false, and add the dcn_2_0_nv12_soc BB struct. In init_soc_bounding_box, load firmware to nv12 BB instead.
In addition, conditionally update and patch the BB, depending on ASIC REV.
--- .../drm/amd/display/dc/dcn20/dcn20_resource.c | 156 +++++++++++------- 1 file changed, 96 insertions(+), 60 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +96 -60
@@ -80,7 +80,8 @@#include "amdgpu_socbb.h" -#define SOC_BOUNDING_BOX_VALID true +/* NV12 SOC BB is currently in FW, mark SW bounding box invalid. */ +#define SOC_BOUNDING_BOX_VALID false#define DC_LOGGER_INIT (logger)struct _vcs_dpi_ip_params_st dcn2_0_ip = {
@@ -266,6 +267,7 @@ struct _vcs_dpi_soc_bounding_box_st dcn2_0_soc = { .use_urgent_burst_bw = 0 }; +struct _vcs_dpi_soc_bounding_box_st dcn2_0_nv12_soc = {0 };#ifndef mmDP0_DP_DPHY_INTERNAL_CTRL#define mmDP0_DP_DPHY_INTERNAL_CTRL 0x210f
@@ -3042,6 +3044,27 @@ static void patch_bounding_box(struct dc *dc, struct _vcs_dpi_soc_bounding_box_skernel_fpu_end (); } +static struct _vcs_dpi_soc_bounding_box_st *get_asic_rev_soc_bb ( +uint32_t hw_internal_rev) +{ +if (ASICREV_IS_NAVI12_P (hw_internal_rev)) +return &dcn2_0_nv12_soc; + +return &dcn2_0_soc; +} + +static struct _vcs_dpi_ip_params_st *get_asic_rev_ip_params ( +uint32_t hw_internal_rev) +{ +/* NV12 and NV10 */ +return &dcn2_0_ip; +} + +static enum dml_project get_dml_project_version (uint32_t hw_internal_rev) +{ +return DML_PROJECT_NAVI10v2; +} +#define fixed16_to_double (x) (((double) x) / ((double) (1 << 16)))#define fixed16_to_double_to_cpu (x) fixed16_to_double(le32_to_cpu(x))
@@ -3049,6 +3072,11 @@ static bool init_soc_bounding_box(struct dc *dc, struct dcn20_resource_pool *pool) {const struct gpu_info_soc_bounding_box_v1_0 *bb = dc->soc_bounding_box; +struct _vcs_dpi_soc_bounding_box_st *loaded_bb = +get_asic_rev_soc_bb (dc->ctx->asic_id.hw_internal_rev); +struct _vcs_dpi_ip_params_st *loaded_ip = +get_asic_rev_ip_params (dc->ctx->asic_id.hw_internal_rev); +DC_LOGGER_INIT (dc->ctx->logger);if (!bb && !SOC_BOUNDING_BOX_VALID ) {
@@ -3059,101 +3087,103 @@ static bool init_soc_bounding_box(struct dc *dc,if (bb && !SOC_BOUNDING_BOX_VALID ) {int i; - dcn2_0_soc.sr_exit_time_us = + dcn2_0_nv12_soc.sr_exit_time_us =fixed16_to_double_to_cpu (bb->sr_exit_time_us); - dcn2_0_soc.sr_enter_plus_exit_time_us = + dcn2_0_nv12_soc.sr_enter_plus_exit_time_us =fixed16_to_double_to_cpu (bb->sr_enter_plus_exit_time_us); - dcn2_0_soc.urgent_latency_us = + dcn2_0_nv12_soc.urgent_latency_us =fixed16_to_double_to_cpu (bb->urgent_latency_us); - dcn2_0_soc.urgent_latency_pixel_data_only_us = + dcn2_0_nv12_soc.urgent_latency_pixel_data_only_us =fixed16_to_double_to_cpu (bb->urgent_latency_pixel_data_only_us); - dcn2_0_soc.urgent_latency_pixel_mixed_with_vm_data_us = + dcn2_0_nv12_soc.urgent_latency_pixel_mixed_with_vm_data_us =fixed16_to_double_to_cpu (bb->urgent_latency_pixel_mixed_with_vm_data_us); - dcn2_0_soc.urgent_latency_vm_data_only_us = + dcn2_0_nv12_soc.urgent_latency_vm_data_only_us =fixed16_to_double_to_cpu (bb->urgent_latency_vm_data_only_us); - dcn2_0_soc.urgent_out_of_order_return_per_channel_pixel_only_bytes = + dcn2_0_nv12_soc.urgent_out_of_order_return_per_channel_pixel_only_bytes =le32_to_cpu (bb->urgent_out_of_order_return_per_channel_pixel_only_bytes); - dcn2_0_soc.urgent_out_of_order_return_per_channel_pixel_and_vm_bytes = + dcn2_0_nv12_soc.urgent_out_of_order_return_per_channel_pixel_and_vm_bytes =le32_to_cpu (bb->urgent_out_of_order_return_per_channel_pixel_and_vm_bytes); - dcn2_0_soc.urgent_out_of_order_return_per_channel_vm_only_bytes = + dcn2_0_nv12_soc.urgent_out_of_order_return_per_channel_vm_only_bytes =le32_to_cpu (bb->urgent_out_of_order_return_per_channel_vm_only_bytes); - dcn2_0_soc.pct_ideal_dram_sdp_bw_after_urgent_pixel_only = + dcn2_0_nv12_soc.pct_ideal_dram_sdp_bw_after_urgent_pixel_only =fixed16_to_double_to_cpu (bb->pct_ideal_dram_sdp_bw_after_urgent_pixel_only); - dcn2_0_soc.pct_ideal_dram_sdp_bw_after_urgent_pixel_and_vm = + dcn2_0_nv12_soc.pct_ideal_dram_sdp_bw_after_urgent_pixel_and_vm =fixed16_to_double_to_cpu (bb->pct_ideal_dram_sdp_bw_after_urgent_pixel_and_vm); - dcn2_0_soc.pct_ideal_dram_sdp_bw_after_urgent_vm_only = + dcn2_0_nv12_soc.pct_ideal_dram_sdp_bw_after_urgent_vm_only =fixed16_to_double_to_cpu (bb->pct_ideal_dram_sdp_bw_after_urgent_vm_only); - dcn2_0_soc.max_avg_sdp_bw_use_normal_percent = + dcn2_0_nv12_soc.max_avg_sdp_bw_use_normal_percent =fixed16_to_double_to_cpu (bb->max_avg_sdp_bw_use_normal_percent); - dcn2_0_soc.max_avg_dram_bw_use_normal_percent = + dcn2_0_nv12_soc.max_avg_dram_bw_use_normal_percent =fixed16_to_double_to_cpu (bb->max_avg_dram_bw_use_normal_percent); - dcn2_0_soc.writeback_latency_us = + dcn2_0_nv12_soc.writeback_latency_us =fixed16_to_double_to_cpu (bb->writeback_latency_us); - dcn2_0_soc.ideal_dram_bw_after_urgent_percent = + dcn2_0_nv12_soc.ideal_dram_bw_after_urgent_percent =fixed16_to_double_to_cpu (bb->ideal_dram_bw_after_urgent_percent); - dcn2_0_soc.max_request_size_bytes = + dcn2_0_nv12_soc.max_request_size_bytes =le32_to_cpu (bb->max_request_size_bytes); - dcn2_0_soc.dram_channel_width_bytes = + dcn2_0_nv12_soc.dram_channel_width_bytes =le32_to_cpu (bb->dram_channel_width_bytes); - dcn2_0_soc.fabric_datapath_to_dcn_data_return_bytes = + dcn2_0_nv12_soc.fabric_datapath_to_dcn_data_return_bytes =le32_to_cpu (bb->fabric_datapath_to_dcn_data_return_bytes); - dcn2_0_soc.dcn_downspread_percent = + dcn2_0_nv12_soc.dcn_downspread_percent =fixed16_to_double_to_cpu (bb->dcn_downspread_percent); - dcn2_0_soc.downspread_percent = + dcn2_0_nv12_soc.downspread_percent =fixed16_to_double_to_cpu (bb->downspread_percent); - dcn2_0_soc.dram_page_open_time_ns = + dcn2_0_nv12_soc.dram_page_open_time_ns =fixed16_to_double_to_cpu (bb->dram_page_open_time_ns); - dcn2_0_soc.dram_rw_turnaround_time_ns = + dcn2_0_nv12_soc.dram_rw_turnaround_time_ns =fixed16_to_double_to_cpu (bb->dram_rw_turnaround_time_ns); - dcn2_0_soc.dram_return_buffer_per_channel_bytes = + dcn2_0_nv12_soc.dram_return_buffer_per_channel_bytes =le32_to_cpu (bb->dram_return_buffer_per_channel_bytes); - dcn2_0_soc.round_trip_ping_latency_dcfclk_cycles = + dcn2_0_nv12_soc.round_trip_ping_latency_dcfclk_cycles =le32_to_cpu (bb->round_trip_ping_latency_dcfclk_cycles); - dcn2_0_soc.urgent_out_of_order_return_per_channel_bytes = + dcn2_0_nv12_soc.urgent_out_of_order_return_per_channel_bytes =le32_to_cpu (bb->urgent_out_of_order_return_per_channel_bytes); - dcn2_0_soc.channel_interleave_bytes = + dcn2_0_nv12_soc.channel_interleave_bytes =le32_to_cpu (bb->channel_interleave_bytes); - dcn2_0_soc.num_banks = + dcn2_0_nv12_soc.num_banks =le32_to_cpu (bb->num_banks); - dcn2_0_soc.num_chans = + dcn2_0_nv12_soc.num_chans =le32_to_cpu (bb->num_chans); - dcn2_0_soc.vmm_page_size_bytes = + dcn2_0_nv12_soc.vmm_page_size_bytes =le32_to_cpu (bb->vmm_page_size_bytes); - dcn2_0_soc.dram_clock_change_latency_us = + dcn2_0_nv12_soc.dram_clock_change_latency_us =fixed16_to_double_to_cpu (bb->dram_clock_change_latency_us); - dcn2_0_soc.writeback_dram_clock_change_latency_us = +// HACK!! Lower uclock latency switch time so we don't switch + dcn2_0_nv12_soc.dram_clock_change_latency_us =10 ; + dcn2_0_nv12_soc.writeback_dram_clock_change_latency_us =fixed16_to_double_to_cpu (bb->writeback_dram_clock_change_latency_us); - dcn2_0_soc.return_bus_width_bytes = + dcn2_0_nv12_soc.return_bus_width_bytes =le32_to_cpu (bb->return_bus_width_bytes); - dcn2_0_soc.dispclk_dppclk_vco_speed_mhz = + dcn2_0_nv12_soc.dispclk_dppclk_vco_speed_mhz =le32_to_cpu (bb->dispclk_dppclk_vco_speed_mhz); - dcn2_0_soc.xfc_bus_transport_time_us = + dcn2_0_nv12_soc.xfc_bus_transport_time_us =le32_to_cpu (bb->xfc_bus_transport_time_us); - dcn2_0_soc.xfc_xbuf_latency_tolerance_us = + dcn2_0_nv12_soc.xfc_xbuf_latency_tolerance_us =le32_to_cpu (bb->xfc_xbuf_latency_tolerance_us); - dcn2_0_soc.use_urgent_burst_bw = + dcn2_0_nv12_soc.use_urgent_burst_bw =le32_to_cpu (bb->use_urgent_burst_bw); - dcn2_0_soc.num_states = + dcn2_0_nv12_soc.num_states =le32_to_cpu (bb->num_states); -for (i =0 ; i < dcn2_0_soc.num_states; i++) { - dcn2_0_soc.clock_limits[i].state = +for (i =0 ; i < dcn2_0_nv12_soc.num_states; i++) { + dcn2_0_nv12_soc.clock_limits[i].state =le32_to_cpu (bb->clock_limits[i].state); - dcn2_0_soc.clock_limits[i].dcfclk_mhz = + dcn2_0_nv12_soc.clock_limits[i].dcfclk_mhz =fixed16_to_double_to_cpu (bb->clock_limits[i].dcfclk_mhz); - dcn2_0_soc.clock_limits[i].fabricclk_mhz = + dcn2_0_nv12_soc.clock_limits[i].fabricclk_mhz =fixed16_to_double_to_cpu (bb->clock_limits[i].fabricclk_mhz); - dcn2_0_soc.clock_limits[i].dispclk_mhz = + dcn2_0_nv12_soc.clock_limits[i].dispclk_mhz =fixed16_to_double_to_cpu (bb->clock_limits[i].dispclk_mhz); - dcn2_0_soc.clock_limits[i].dppclk_mhz = + dcn2_0_nv12_soc.clock_limits[i].dppclk_mhz =fixed16_to_double_to_cpu (bb->clock_limits[i].dppclk_mhz); - dcn2_0_soc.clock_limits[i].phyclk_mhz = + dcn2_0_nv12_soc.clock_limits[i].phyclk_mhz =fixed16_to_double_to_cpu (bb->clock_limits[i].phyclk_mhz); - dcn2_0_soc.clock_limits[i].socclk_mhz = + dcn2_0_nv12_soc.clock_limits[i].socclk_mhz =fixed16_to_double_to_cpu (bb->clock_limits[i].socclk_mhz); - dcn2_0_soc.clock_limits[i].dscclk_mhz = + dcn2_0_nv12_soc.clock_limits[i].dscclk_mhz =fixed16_to_double_to_cpu (bb->clock_limits[i].dscclk_mhz); - dcn2_0_soc.clock_limits[i].dram_speed_mts = + dcn2_0_nv12_soc.clock_limits[i].dram_speed_mts =fixed16_to_double_to_cpu (bb->clock_limits[i].dram_speed_mts); } }
@@ -3184,14 +3214,14 @@ static bool init_soc_bounding_box(struct dc *dc, }if (clock_limits_available && uclk_states_available && num_states) -update_bounding_box (dc, &dcn2_0_soc, &max_clocks, uclk_states, num_states); +update_bounding_box (dc, loaded_bb, &max_clocks, uclk_states, num_states);else if (clock_limits_available) -cap_soc_clocks (&dcn2_0_soc, max_clocks); +cap_soc_clocks (loaded_bb, max_clocks); } - dcn2_0_ip.max_num_otg = pool->base.res_cap->num_timing_generator; - dcn2_0_ip.max_num_dpp = pool->base.pipe_count; -patch_bounding_box (dc, &dcn2_0_soc); + loaded_ip->max_num_otg = pool->base.res_cap->num_timing_generator; + loaded_ip->max_num_dpp = pool->base.pipe_count; +patch_bounding_box (dc, loaded_bb);return true; }
@@ -3204,6 +3234,12 @@ static bool construct(int i;struct dc_context *ctx = dc->ctx;struct irq_service_init_data init_data; +struct _vcs_dpi_soc_bounding_box_st *loaded_bb = +get_asic_rev_soc_bb (ctx->asic_id.hw_internal_rev); +struct _vcs_dpi_ip_params_st *loaded_ip = +get_asic_rev_ip_params (ctx->asic_id.hw_internal_rev); +enum dml_project dml_project_version = +get_dml_project_version (ctx->asic_id.hw_internal_rev); ctx->dc_bios->regs = &bios_regs; pool->base.funcs = &dcn20_res_pool_funcs;
@@ -3327,7 +3363,7 @@ static bool construct( goto create_fail; } -dml_init_instance (&dc->dml, &dcn2_0_soc, &dcn2_0_ip, DML_PROJECT_NAVI10v2); +dml_init_instance (&dc->dml, loaded_bb, loaded_ip, dml_project_version);if (!dc->debug.disable_pplib_wm_range) {struct pp_smu_wm_range_sets ranges = {0 };
@@ -3335,7 +3371,7 @@ static bool construct( ranges.num_reader_wm_sets =0 ; -if (dcn2_0_soc.num_states ==1 ) { +if (loaded_bb->num_states ==1 ) { ranges.reader_wm_sets[0 ].wm_inst = i; ranges.reader_wm_sets[0 ].min_drain_clk_mhz =PP_SMU_WM_SET_RANGE_CLK_UNCONSTRAINED_MIN ; ranges.reader_wm_sets[0 ].max_drain_clk_mhz =PP_SMU_WM_SET_RANGE_CLK_UNCONSTRAINED_MAX ;
@@ -3343,13 +3379,13 @@ static bool construct( ranges.reader_wm_sets[0 ].max_fill_clk_mhz =PP_SMU_WM_SET_RANGE_CLK_UNCONSTRAINED_MAX ; ranges.num_reader_wm_sets =1 ; - }else if (dcn2_0_soc.num_states >1 ) { -for (i =0 ; i <4 && i < dcn2_0_soc.num_states; i++) { + }else if (loaded_bb->num_states >1 ) { +for (i =0 ; i <4 && i < loaded_bb->num_states; i++) { ranges.reader_wm_sets[i].wm_inst = i; ranges.reader_wm_sets[i].min_drain_clk_mhz =PP_SMU_WM_SET_RANGE_CLK_UNCONSTRAINED_MIN ; ranges.reader_wm_sets[i].max_drain_clk_mhz =PP_SMU_WM_SET_RANGE_CLK_UNCONSTRAINED_MAX ; - ranges.reader_wm_sets[i].min_fill_clk_mhz = (i >0 ) ? (dcn2_0_soc.clock_limits[i -1 ].dram_speed_mts /16 ) +1 :0 ; - ranges.reader_wm_sets[i].max_fill_clk_mhz = dcn2_0_soc.clock_limits[i].dram_speed_mts /16 ; + ranges.reader_wm_sets[i].min_fill_clk_mhz = (i >0 ) ? (loaded_bb->clock_limits[i -1 ].dram_speed_mts /16 ) +1 :0 ; + ranges.reader_wm_sets[i].max_fill_clk_mhz = loaded_bb->clock_limits[i].dram_speed_mts /16 ; ranges.num_reader_wm_sets = i +1 ; }
Signature · 6 lines
2.22.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx