Add DCN 3.1.4 Support
Alex Deucher
maintainercover Add DCN 3.1.4 Support
This patch set adds support for DCN 3.1.4, a display block on AMD GPUs. Patch 1 adds new DCN registers and is too big for the mailing list.
Roman Li (9):
drm/amdgpu: Add reg headers for DCN314 drm/amd/display: Add DCN314 IRQ services drm/amd/display: Add DCN314 clock manager drm/amd/display: Add DCN314 DC resources drm/amd/display: Add DCN314 DML calculation support drm/amd/display: Add DCN314 version identifiers drm/amd/display: Enable DCN314 in DC drm/amd/display: Add DMUB support for DCN314 drm/amd/display: Enable DCN314 in DM
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 11 + .../amd/display/amdgpu_dm/amdgpu_dm_hdcp.c | 1 + drivers/gpu/drm/amd/display/dc/Makefile | 1 + .../display/dc/bios/command_table_helper2.c | 1 + .../gpu/drm/amd/display/dc/clk_mgr/Makefile | 9 + .../gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c | 22 +- .../dc/clk_mgr/dcn314/dcn314_clk_mgr.c | 751 + .../dc/clk_mgr/dcn314/dcn314_clk_mgr.h | 57 + .../display/dc/clk_mgr/dcn314/dcn314_smu.c | 391 + .../display/dc/clk_mgr/dcn314/dcn314_smu.h | 79 + drivers/gpu/drm/amd/display/dc/core/dc.c | 4 + drivers/gpu/drm/amd/display/dc/core/dc_link.c | 1 + .../gpu/drm/amd/display/dc/core/dc_resource.c | 8 + .../drm/amd/display/dc/dce/dce_clock_source.h | 5 +- .../gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c | 17 +- .../gpu/drm/amd/display/dc/dcn20/dcn20_dsc.h | 219 + .../gpu/drm/amd/display/dc/dcn31/dcn31_dccg.c | 16 +- .../gpu/drm/amd/display/dc/dcn31/dcn31_dccg.h | 35 + .../display/dc/dcn31/dcn31_dio_link_encoder.h | 28 + .../drm/amd/display/dc/dcn31/dcn31_resource.c | 3 + .../gpu/drm/amd/display/dc/dcn314/Makefile | 43 + .../drm/amd/display/dc/dcn314/dcn314_dccg.c | 265 + .../drm/amd/display/dc/dcn314/dcn314_dccg.h | 158 + .../dc/dcn314/dcn314_dio_stream_encoder.c | 448 + .../dc/dcn314/dcn314_dio_stream_encoder.h | 311 + .../drm/amd/display/dc/dcn314/dcn314_hwseq.c | 341 + .../drm/amd/display/dc/dcn314/dcn314_hwseq.h | 40 + .../drm/amd/display/dc/dcn314/dcn314_init.c | 158 + .../drm/amd/display/dc/dcn314/dcn314_init.h | 34 + .../drm/amd/display/dc/dcn314/dcn314_optc.c | 240 + .../drm/amd/display/dc/dcn314/dcn314_optc.h | 255 + .../amd/display/dc/dcn314/dcn314_resource.c | 2357 + .../amd/display/dc/dcn314/dcn314_resource.h | 43 + .../dc/dml/dcn314/display_mode_vba_314.c | 7420 ++ .../dc/dml/dcn314/display_mode_vba_314.h | 44 + .../dc/dml/dcn314/display_rq_dlg_calc_314.c | 1733 + .../dc/dml/dcn314/display_rq_dlg_calc_314.h | 70 + .../gpu/drm/amd/display/dc/gpio/hw_factory.c | 1 + .../drm/amd/display/dc/gpio/hw_translate.c | 1 + drivers/gpu/drm/amd/display/dc/irq/Makefile | 10 + .../dc/irq/dcn314/irq_service_dcn314.c | 434 + .../dc/irq/dcn314/irq_service_dcn314.h | 35 + drivers/gpu/drm/amd/display/dmub/dmub_srv.h | 1 + .../gpu/drm/amd/display/dmub/src/dmub_srv.c | 1 + .../gpu/drm/amd/display/include/dal_asic_id.h | 1 + .../gpu/drm/amd/display/include/dal_types.h | 1 + .../include/asic_reg/dcn/dcn_3_1_4_offset.h | 15245 ++++ .../include/asic_reg/dcn/dcn_3_1_4_sh_mask.h | 61832 ++++++++++++++++ .../include/asic_reg/dpcs/dpcs_3_1_4_offset.h | 7215 ++ .../asic_reg/dpcs/dpcs_3_1_4_sh_mask.h | 55194 ++++++++++++++ 50 files changed, 155575 insertions(+), 15 deletions(-) create mode 100644 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.c create mode 100644 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.h create mode 100644 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_smu.c create mode 100644 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_smu.h create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/Makefile create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.c create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.h create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dio_stream_encoder.c create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dio_stream_encoder.h create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.c create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.h create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_init.c create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_init.h create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_optc.c create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_optc.h create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.h create mode 100644 drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c create mode 100644 drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.h create mode 100644 drivers/gpu/drm/amd/display/dc/dml/dcn314/display_rq_dlg_calc_314.c create mode 100644 drivers/gpu/drm/amd/display/dc/dml/dcn314/display_rq_dlg_calc_314.h create mode 100644 drivers/gpu/drm/amd/display/dc/irq/dcn314/irq_service_dcn314.c create mode 100644 drivers/gpu/drm/amd/display/dc/irq/dcn314/irq_service_dcn314.h create mode 100644 drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_1_4_offset.h create mode 100644 drivers/gpu/drm/amd/include/asic_reg/dcn/dcn_3_1_4_sh_mask.h create mode 100644 drivers/gpu/drm/amd/include/asic_reg/dpcs/dpcs_3_1_4_offset.h create mode 100644 drivers/gpu/drm/amd/include/asic_reg/dpcs/dpcs_3_1_4_sh_mask.h
Signature · 1 line
2.35.3
Alex Deucher
maintainerPATCH 2/9 drm/amd/display: Add DCN314 IRQ services
From: Roman Li <[email protected]>
IRQ services to support DCN 3.1.4 interrupts.
--- .../dc/irq/dcn314/irq_service_dcn314.c | 434 ++++++++++++++++++ .../dc/irq/dcn314/irq_service_dcn314.h | 35 ++ 2 files changed, 469 insertions(+) create mode 100644 drivers/gpu/drm/amd/display/dc/irq/dcn314/irq_service_dcn314.c create mode 100644 drivers/gpu/drm/amd/display/dc/irq/dcn314/irq_service_dcn314.h
drivers/gpu/drm/amd/display/dc/irq/dcn314/irq_service_dcn314.c new file +434 -0
@@ -0,0 +1,434 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright 2022 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +* Authors: AMD +* +*/ + +#include "dm_services.h" +#include "include/logger_interface.h" +#include "../dce110/irq_service_dce110.h" + + +#include "dcn/dcn_3_1_4_offset.h" +#include "dcn/dcn_3_1_4_sh_mask.h" + +#include "irq_service_dcn314.h" + +#include "ivsrcid/dcn/irqsrcs_dcn_1_0.h" + +#define DCN_BASE__INST0_SEG2 0x000034C0 + +enum dc_irq_source to_dal_irq_source_dcn314 ( +struct irq_service *irq_service, +uint32_t src_id, +uint32_t ext_id) +{ +switch (src_id) { +case DCN_1_0__SRCID__DC_D1_OTG_VSTARTUP : +return DC_IRQ_SOURCE_VBLANK1 ; +case DCN_1_0__SRCID__DC_D2_OTG_VSTARTUP : +return DC_IRQ_SOURCE_VBLANK2 ; +case DCN_1_0__SRCID__DC_D3_OTG_VSTARTUP : +return DC_IRQ_SOURCE_VBLANK3 ; +case DCN_1_0__SRCID__DC_D4_OTG_VSTARTUP : +return DC_IRQ_SOURCE_VBLANK4 ; +case DCN_1_0__SRCID__DC_D5_OTG_VSTARTUP : +return DC_IRQ_SOURCE_VBLANK5 ; +case DCN_1_0__SRCID__DC_D6_OTG_VSTARTUP : +return DC_IRQ_SOURCE_VBLANK6 ; +case DCN_1_0__SRCID__OTG1_VERTICAL_INTERRUPT0_CONTROL : +return DC_IRQ_SOURCE_DC1_VLINE0 ; +case DCN_1_0__SRCID__OTG2_VERTICAL_INTERRUPT0_CONTROL : +return DC_IRQ_SOURCE_DC2_VLINE0 ; +case DCN_1_0__SRCID__OTG3_VERTICAL_INTERRUPT0_CONTROL : +return DC_IRQ_SOURCE_DC3_VLINE0 ; +case DCN_1_0__SRCID__OTG4_VERTICAL_INTERRUPT0_CONTROL : +return DC_IRQ_SOURCE_DC4_VLINE0 ; +case DCN_1_0__SRCID__OTG5_VERTICAL_INTERRUPT0_CONTROL : +return DC_IRQ_SOURCE_DC5_VLINE0 ; +case DCN_1_0__SRCID__OTG6_VERTICAL_INTERRUPT0_CONTROL : +return DC_IRQ_SOURCE_DC6_VLINE0 ; +case DCN_1_0__SRCID__HUBP0_FLIP_INTERRUPT : +return DC_IRQ_SOURCE_PFLIP1 ; +case DCN_1_0__SRCID__HUBP1_FLIP_INTERRUPT : +return DC_IRQ_SOURCE_PFLIP2 ; +case DCN_1_0__SRCID__HUBP2_FLIP_INTERRUPT : +return DC_IRQ_SOURCE_PFLIP3 ; +case DCN_1_0__SRCID__HUBP3_FLIP_INTERRUPT : +return DC_IRQ_SOURCE_PFLIP4 ; +case DCN_1_0__SRCID__HUBP4_FLIP_INTERRUPT : +return DC_IRQ_SOURCE_PFLIP5 ; +case DCN_1_0__SRCID__HUBP5_FLIP_INTERRUPT : +return DC_IRQ_SOURCE_PFLIP6 ; +case DCN_1_0__SRCID__OTG0_IHC_V_UPDATE_NO_LOCK_INTERRUPT : +return DC_IRQ_SOURCE_VUPDATE1 ; +case DCN_1_0__SRCID__OTG1_IHC_V_UPDATE_NO_LOCK_INTERRUPT : +return DC_IRQ_SOURCE_VUPDATE2 ; +case DCN_1_0__SRCID__OTG2_IHC_V_UPDATE_NO_LOCK_INTERRUPT : +return DC_IRQ_SOURCE_VUPDATE3 ; +case DCN_1_0__SRCID__OTG3_IHC_V_UPDATE_NO_LOCK_INTERRUPT : +return DC_IRQ_SOURCE_VUPDATE4 ; +case DCN_1_0__SRCID__OTG4_IHC_V_UPDATE_NO_LOCK_INTERRUPT : +return DC_IRQ_SOURCE_VUPDATE5 ; +case DCN_1_0__SRCID__OTG5_IHC_V_UPDATE_NO_LOCK_INTERRUPT : +return DC_IRQ_SOURCE_VUPDATE6 ; +case DCN_1_0__SRCID__DMCUB_OUTBOX_LOW_PRIORITY_READY_INT : +return DC_IRQ_SOURCE_DMCUB_OUTBOX ; +case DCN_1_0__SRCID__DC_HPD1_INT : +/* generic src_id for all HPD and HPDRX interrupts */ +switch (ext_id) { +case DCN_1_0__CTXID__DC_HPD1_INT : +return DC_IRQ_SOURCE_HPD1 ; +case DCN_1_0__CTXID__DC_HPD2_INT : +return DC_IRQ_SOURCE_HPD2 ; +case DCN_1_0__CTXID__DC_HPD3_INT : +return DC_IRQ_SOURCE_HPD3 ; +case DCN_1_0__CTXID__DC_HPD4_INT : +return DC_IRQ_SOURCE_HPD4 ; +case DCN_1_0__CTXID__DC_HPD5_INT : +return DC_IRQ_SOURCE_HPD5 ; +case DCN_1_0__CTXID__DC_HPD6_INT : +return DC_IRQ_SOURCE_HPD6 ; +case DCN_1_0__CTXID__DC_HPD1_RX_INT : +return DC_IRQ_SOURCE_HPD1RX ; +case DCN_1_0__CTXID__DC_HPD2_RX_INT : +return DC_IRQ_SOURCE_HPD2RX ; +case DCN_1_0__CTXID__DC_HPD3_RX_INT : +return DC_IRQ_SOURCE_HPD3RX ; +case DCN_1_0__CTXID__DC_HPD4_RX_INT : +return DC_IRQ_SOURCE_HPD4RX ; +case DCN_1_0__CTXID__DC_HPD5_RX_INT : +return DC_IRQ_SOURCE_HPD5RX ; +case DCN_1_0__CTXID__DC_HPD6_RX_INT : +return DC_IRQ_SOURCE_HPD6RX ; +default : +return DC_IRQ_SOURCE_INVALID ; + } +break ; + +default : +return DC_IRQ_SOURCE_INVALID ; + } +} + +static bool hpd_ack ( +struct irq_service *irq_service, +const struct irq_source_info *info) +{ +uint32_t addr = info->status_reg; +uint32_t value =dm_read_reg (irq_service->ctx, addr); +uint32_t current_status = +get_reg_field_value ( + value, +HPD0_DC_HPD_INT_STATUS , +DC_HPD_SENSE_DELAYED ); + +dal_irq_service_ack_generic (irq_service, info); + + value =dm_read_reg (irq_service->ctx, info->enable_reg); + +set_reg_field_value ( + value, + current_status ?0 :1 , +HPD0_DC_HPD_INT_CONTROL , +DC_HPD_INT_POLARITY ); + +dm_write_reg (irq_service->ctx, info->enable_reg, value); + +return true; +} + +static const struct irq_source_info_funcs hpd_irq_info_funcs = { + .set =NULL , + .ack = hpd_ack +}; + +static const struct irq_source_info_funcs hpd_rx_irq_info_funcs = { + .set =NULL , + .ack =NULL +}; + +static const struct irq_source_info_funcs pflip_irq_info_funcs = { + .set =NULL , + .ack =NULL +}; + +static const struct irq_source_info_funcs vupdate_no_lock_irq_info_funcs = { + .set =NULL , + .ack =NULL +}; + +static const struct irq_source_info_funcs vblank_irq_info_funcs = { + .set =NULL , + .ack =NULL +}; + +static const struct irq_source_info_funcs outbox_irq_info_funcs = { + .set =NULL , + .ack =NULL +}; + +static const struct irq_source_info_funcs vline0_irq_info_funcs = { + .set =NULL , + .ack =NULL +}; + +#undef BASE_INNER +#define BASE_INNER (seg) DCN_BASE__INST0_SEG ## seg + +/* compile time expand base address. */ +#define BASE (seg) \ + BASE_INNER(seg) + +#define SRI (reg_name, block, id)\ + (BASE(reg ## block ## id ## _ ## reg_name ## _BASE_IDX) + \ + reg ## block ## id ## _ ## reg_name) + +#define SRI_DMUB (reg_name)\ + (BASE(reg ## reg_name ## _BASE_IDX) + \ + reg ## reg_name) + +#define IRQ_REG_ENTRY (block, reg_num, reg1, mask1, reg2, mask2)\ + .enable_reg = SRI(reg1, block, reg_num),\ + .enable_mask = \ + block ## reg_num ## _ ## reg1 ## __ ## mask1 ## _MASK,\ + .enable_value = {\ + block ## reg_num ## _ ## reg1 ## __ ## mask1 ## _MASK,\ + ~block ## reg_num ## _ ## reg1 ## __ ## mask1 ## _MASK \ + },\ + .ack_reg = SRI(reg2, block, reg_num),\ + .ack_mask = \ + block ## reg_num ## _ ## reg2 ## __ ## mask2 ## _MASK,\ + .ack_value = \ + block ## reg_num ## _ ## reg2 ## __ ## mask2 ## _MASK \ + +#define IRQ_REG_ENTRY_DMUB (reg1, mask1, reg2, mask2)\ + .enable_reg = SRI_DMUB(reg1),\ + .enable_mask = \ + reg1 ## __ ## mask1 ## _MASK,\ + .enable_value = {\ + reg1 ## __ ## mask1 ## _MASK,\ + ~reg1 ## __ ## mask1 ## _MASK \ + },\ + .ack_reg = SRI_DMUB(reg2),\ + .ack_mask = \ + reg2 ## __ ## mask2 ## _MASK,\ + .ack_value = \ + reg2 ## __ ## mask2 ## _MASK \ + +#define hpd_int_entry (reg_num)\ + [DC_IRQ_SOURCE_HPD1 + reg_num] = {\ + IRQ_REG_ENTRY(HPD, reg_num,\ + DC_HPD_INT_CONTROL, DC_HPD_INT_EN,\ + DC_HPD_INT_CONTROL, DC_HPD_INT_ACK),\ + .status_reg = SRI(DC_HPD_INT_STATUS, HPD, reg_num),\ + .funcs = &hpd_irq_info_funcs\ + } + +#define hpd_rx_int_entry (reg_num)\ + [DC_IRQ_SOURCE_HPD1RX + reg_num] = {\ + IRQ_REG_ENTRY(HPD, reg_num,\ + DC_HPD_INT_CONTROL, DC_HPD_RX_INT_EN,\ + DC_HPD_INT_CONTROL, DC_HPD_RX_INT_ACK),\ + .status_reg = SRI(DC_HPD_INT_STATUS, HPD, reg_num),\ + .funcs = &hpd_rx_irq_info_funcs\ + } +#define pflip_int_entry (reg_num)\ + [DC_IRQ_SOURCE_PFLIP1 + reg_num] = {\ + IRQ_REG_ENTRY(HUBPREQ, reg_num,\ + DCSURF_SURFACE_FLIP_INTERRUPT, SURFACE_FLIP_INT_MASK,\ + DCSURF_SURFACE_FLIP_INTERRUPT, SURFACE_FLIP_CLEAR),\ + .funcs = &pflip_irq_info_funcs\ + } + +/* 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_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)\ + [DC_IRQ_SOURCE_VBLANK1 + reg_num] = {\ + IRQ_REG_ENTRY(OTG, reg_num,\ + OTG_GLOBAL_SYNC_STATUS, VSTARTUP_INT_EN,\ + OTG_GLOBAL_SYNC_STATUS, VSTARTUP_EVENT_CLEAR),\ + .funcs = &vblank_irq_info_funcs\ + } + +#define vline0_int_entry (reg_num)\ + [DC_IRQ_SOURCE_DC1_VLINE0 + reg_num] = {\ + IRQ_REG_ENTRY(OTG, reg_num,\ + OTG_VERTICAL_INTERRUPT0_CONTROL, OTG_VERTICAL_INTERRUPT0_INT_ENABLE,\ + OTG_VERTICAL_INTERRUPT0_CONTROL, OTG_VERTICAL_INTERRUPT0_CLEAR),\ + .funcs = &vline0_irq_info_funcs\ + } +#define dmub_outbox_int_entry ()\ + [DC_IRQ_SOURCE_DMCUB_OUTBOX] = {\ + IRQ_REG_ENTRY_DMUB(\ + DMCUB_INTERRUPT_ENABLE, DMCUB_OUTBOX1_READY_INT_EN,\ + DMCUB_INTERRUPT_ACK, DMCUB_OUTBOX1_READY_INT_ACK),\ + .funcs = &outbox_irq_info_funcs\ + } + +#define dummy_irq_entry () \ + {\ + .funcs = &dummy_irq_info_funcs\ + } + +#define i2c_int_entry (reg_num) \ + [DC_IRQ_SOURCE_I2C_DDC ## reg_num] = dummy_irq_entry() + +#define dp_sink_int_entry (reg_num) \ + [DC_IRQ_SOURCE_DPSINK ## reg_num] = dummy_irq_entry() + +#define gpio_pad_int_entry (reg_num) \ + [DC_IRQ_SOURCE_GPIOPAD ## reg_num] = dummy_irq_entry() + +#define dc_underflow_int_entry (reg_num) \ + [DC_IRQ_SOURCE_DC ## reg_num ## UNDERFLOW] = dummy_irq_entry() + +static const struct irq_source_info_funcs dummy_irq_info_funcs = { + .set = dal_irq_service_dummy_set, + .ack = dal_irq_service_dummy_ack +}; + +static const struct irq_source_info +irq_source_info_dcn314[DAL_IRQ_SOURCES_NUMBER ] = { + [DC_IRQ_SOURCE_INVALID ] =dummy_irq_entry (), +hpd_int_entry (0 ), +hpd_int_entry (1 ), +hpd_int_entry (2 ), +hpd_int_entry (3 ), +hpd_int_entry (4 ), +hpd_rx_int_entry (0 ), +hpd_rx_int_entry (1 ), +hpd_rx_int_entry (2 ), +hpd_rx_int_entry (3 ), +hpd_rx_int_entry (4 ), +i2c_int_entry (1 ), +i2c_int_entry (2 ), +i2c_int_entry (3 ), +i2c_int_entry (4 ), +i2c_int_entry (5 ), +i2c_int_entry (6 ), +dp_sink_int_entry (1 ), +dp_sink_int_entry (2 ), +dp_sink_int_entry (3 ), +dp_sink_int_entry (4 ), +dp_sink_int_entry (5 ), +dp_sink_int_entry (6 ), + [DC_IRQ_SOURCE_TIMER ] =dummy_irq_entry (), +pflip_int_entry (0 ), +pflip_int_entry (1 ), +pflip_int_entry (2 ), +pflip_int_entry (3 ), + [DC_IRQ_SOURCE_PFLIP5 ] =dummy_irq_entry (), + [DC_IRQ_SOURCE_PFLIP6 ] =dummy_irq_entry (), + [DC_IRQ_SOURCE_PFLIP_UNDERLAY0 ] =dummy_irq_entry (), +gpio_pad_int_entry (0 ), +gpio_pad_int_entry (1 ), +gpio_pad_int_entry (2 ), +gpio_pad_int_entry (3 ), +gpio_pad_int_entry (4 ), +gpio_pad_int_entry (5 ), +gpio_pad_int_entry (6 ), +gpio_pad_int_entry (7 ), +gpio_pad_int_entry (8 ), +gpio_pad_int_entry (9 ), +gpio_pad_int_entry (10 ), +gpio_pad_int_entry (11 ), +gpio_pad_int_entry (12 ), +gpio_pad_int_entry (13 ), +gpio_pad_int_entry (14 ), +gpio_pad_int_entry (15 ), +gpio_pad_int_entry (16 ), +gpio_pad_int_entry (17 ), +gpio_pad_int_entry (18 ), +gpio_pad_int_entry (19 ), +gpio_pad_int_entry (20 ), +gpio_pad_int_entry (21 ), +gpio_pad_int_entry (22 ), +gpio_pad_int_entry (23 ), +gpio_pad_int_entry (24 ), +gpio_pad_int_entry (25 ), +gpio_pad_int_entry (26 ), +gpio_pad_int_entry (27 ), +gpio_pad_int_entry (28 ), +gpio_pad_int_entry (29 ), +gpio_pad_int_entry (30 ), +dc_underflow_int_entry (1 ), +dc_underflow_int_entry (2 ), +dc_underflow_int_entry (3 ), +dc_underflow_int_entry (4 ), +dc_underflow_int_entry (5 ), +dc_underflow_int_entry (6 ), + [DC_IRQ_SOURCE_DMCU_SCP ] =dummy_irq_entry (), + [DC_IRQ_SOURCE_VBIOS_SW ] =dummy_irq_entry (), +vupdate_no_lock_int_entry (0 ), +vupdate_no_lock_int_entry (1 ), +vupdate_no_lock_int_entry (2 ), +vupdate_no_lock_int_entry (3 ), +vblank_int_entry (0 ), +vblank_int_entry (1 ), +vblank_int_entry (2 ), +vblank_int_entry (3 ), +vline0_int_entry (0 ), +vline0_int_entry (1 ), +vline0_int_entry (2 ), +vline0_int_entry (3 ), + [DC_IRQ_SOURCE_DC5_VLINE1 ] =dummy_irq_entry (), + [DC_IRQ_SOURCE_DC6_VLINE1 ] =dummy_irq_entry (), +dmub_outbox_int_entry (), +}; + +static const struct irq_service_funcs irq_service_funcs_dcn314 = { + .to_dal_irq_source = to_dal_irq_source_dcn314 +}; + +static void dcn314_irq_construct ( +struct irq_service *irq_service, +struct irq_service_init_data *init_data) +{ +dal_irq_service_construct (irq_service, init_data); + + irq_service->info = irq_source_info_dcn314; + irq_service->funcs = &irq_service_funcs_dcn314; +} + +struct irq_service *dal_irq_service_dcn314_create ( +struct irq_service_init_data *init_data) +{ +struct irq_service *irq_service =kzalloc (sizeof (*irq_service), +GFP_KERNEL ); + +if (!irq_service) +return NULL ; + +dcn314_irq_construct (irq_service, init_data); +return irq_service; +}
drivers/gpu/drm/amd/display/dc/irq/dcn314/irq_service_dcn314.h new file +35 -0
@@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright 2022 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +* Authors: AMD +* +*/ + +#ifndef __DAL_IRQ_SERVICE_DCN314_H__ +#define __DAL_IRQ_SERVICE_DCN314_H__ + +#include "../irq_service.h" + +struct irq_service *dal_irq_service_dcn314_create ( +struct irq_service_init_data *init_data); + +#endif /* __DAL_IRQ_SERVICE_DCN314_H__ */
Signature · 1 line
2.35.3
Alex Deucher
maintainerPATCH 3/9 drm/amd/display: Add DCN314 clock manager
In reply to Alex DeucherFrom: Roman Li <[email protected]>
Clock and SMU interfaces for DCN 3.1.4
--- .../dc/clk_mgr/dcn314/dcn314_clk_mgr.c | 751 ++++++++++++++++++ .../dc/clk_mgr/dcn314/dcn314_clk_mgr.h | 57 ++ .../display/dc/clk_mgr/dcn314/dcn314_smu.c | 391 +++++++++ .../display/dc/clk_mgr/dcn314/dcn314_smu.h | 79 ++ 4 files changed, 1278 insertions(+) create mode 100644 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.c create mode 100644 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.h create mode 100644 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_smu.c create mode 100644 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_smu.h
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.c new file +751 -0
@@ -0,0 +1,751 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright 2022 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +* Authors: AMD +* +*/ + + + +#include "dcn314_clk_mgr.h" + +#include "dccg.h" +#include "clk_mgr_internal.h" + +// For dce12_get_dp_ref_freq_khz +#include "dce100/dce_clk_mgr.h" + +// For dcn20_update_clocks_update_dpp_dto +#include "dcn20/dcn20_clk_mgr.h" + + + +#include "reg_helper.h" +#include "core_types.h" +#include "dm_helpers.h" + +/* TODO: remove this include once we ported over remaining clk mgr functions*/ +#include "dcn30/dcn30_clk_mgr.h" +#include "dcn31/dcn31_clk_mgr.h" + +#include "dc_dmub_srv.h" +#include "dc_link_dp.h" +#include "dcn314_smu.h" + +#define MAX_INSTANCE 7 +#define MAX_SEGMENT 8 + +struct IP_BASE_INSTANCE { +unsigned int segment[MAX_SEGMENT ]; +}; + +struct IP_BASE { +struct IP_BASE_INSTANCE instance[MAX_INSTANCE ]; +}; + +static const struct IP_BASE CLK_BASE = { { { {0x00016C00 ,0x02401800 ,0 ,0 ,0 ,0 ,0 ,0 } }, + { {0x00016E00 ,0x02401C00 ,0 ,0 ,0 ,0 ,0 ,0 } }, + { {0x00017000 ,0x02402000 ,0 ,0 ,0 ,0 ,0 ,0 } }, + { {0x00017200 ,0x02402400 ,0 ,0 ,0 ,0 ,0 ,0 } }, + { {0x0001B000 ,0x0242D800 ,0 ,0 ,0 ,0 ,0 ,0 } }, + { {0x0001B200 ,0x0242DC00 ,0 ,0 ,0 ,0 ,0 ,0 } }, + { {0x0001B400 ,0x0242E000 ,0 ,0 ,0 ,0 ,0 ,0 } } } }; + +#define regCLK1_CLK_PLL_REQ 0x0237 +#define regCLK1_CLK_PLL_REQ_BASE_IDX 0 + +#define CLK1_CLK_PLL_REQ__FbMult_int__SHIFT 0x0 +#define CLK1_CLK_PLL_REQ__PllSpineDiv__SHIFT 0xc +#define CLK1_CLK_PLL_REQ__FbMult_frac__SHIFT 0x10 +#define CLK1_CLK_PLL_REQ__FbMult_int_MASK 0x000001FFL +#define CLK1_CLK_PLL_REQ__PllSpineDiv_MASK 0x0000F000L +#define CLK1_CLK_PLL_REQ__FbMult_frac_MASK 0xFFFF0000L + +#define REG (reg_name) \ + (CLK_BASE.instance[0].segment[reg ## reg_name ## _BASE_IDX] + reg ## reg_name) + +#define TO_CLK_MGR_DCN314 (clk_mgr)\ + container_of(clk_mgr, struct clk_mgr_dcn314, base) + +static int dcn314_get_active_display_cnt_wa ( +struct dc *dc, +struct dc_state *context) +{ +int i, display_count; +bool tmds_present = false; + + display_count =0 ; +for (i =0 ; i < context->stream_count; i++) { +const struct dc_stream_state *stream = context->streams[i]; + +if (stream->signal ==SIGNAL_TYPE_HDMI_TYPE_A || + stream->signal ==SIGNAL_TYPE_DVI_SINGLE_LINK || + stream->signal ==SIGNAL_TYPE_DVI_DUAL_LINK ) + tmds_present = true; + } + +for (i =0 ; i < dc->link_count; i++) { +const struct dc_link *link = dc->links[i]; + +/* abusing the fact that the dig and phy are coupled to see if the phy is enabled */ +if (link->link_enc && link->link_enc->funcs->is_dig_enabled && + link->link_enc->funcs->is_dig_enabled (link->link_enc)) + display_count++; + } + +/* WA for hang on HDMI after display off back on*/ +if (display_count ==0 && tmds_present) + display_count =1 ; + +return display_count; +} + +static void dcn314_disable_otg_wa (struct clk_mgr *clk_mgr_base,bool disable) +{ +struct dc *dc = clk_mgr_base->ctx->dc; +int i; + +for (i =0 ; i < dc->res_pool->pipe_count; ++i) { +struct pipe_ctx *pipe = &dc->current_state->res_ctx.pipe_ctx[i]; + +if (pipe->top_pipe || pipe->prev_odm_pipe) +continue ; +if (pipe->stream && (pipe->stream->dpms_off || pipe->plane_state ==NULL || +dc_is_virtual_signal (pipe->stream->signal))) { +if (disable) + pipe->stream_res.tg->funcs->immediate_disable_crtc (pipe->stream_res.tg); +else + pipe->stream_res.tg->funcs->enable_crtc (pipe->stream_res.tg); + } + } +} + +void dcn314_update_clocks (struct clk_mgr *clk_mgr_base, +struct dc_state *context, +bool safe_to_lower) +{ +union dmub_rb_cmd cmd; +struct clk_mgr_internal *clk_mgr =TO_CLK_MGR_INTERNAL (clk_mgr_base); +struct dc_clocks *new_clocks = &context->bw_ctx.bw.dcn.clk; +struct dc *dc = clk_mgr_base->ctx->dc; +int display_count; +bool update_dppclk = false; +bool update_dispclk = false; +bool dpp_clock_lowered = false; + +if (dc->work_arounds.skip_clock_update) +return ; + +/* +* if it is safe to lower, but we are already in the lower state, we don't have to do anything +* also if safe to lower is false, we just go in the higher state +*/ +if (safe_to_lower) { +if (new_clocks->zstate_support !=DCN_ZSTATE_SUPPORT_DISALLOW && + new_clocks->zstate_support != clk_mgr_base->clks.zstate_support) { +dcn314_smu_set_zstate_support (clk_mgr, new_clocks->zstate_support); +dm_helpers_enable_periodic_detection (clk_mgr_base->ctx, true); + clk_mgr_base->clks.zstate_support = new_clocks->zstate_support; + } + +if (clk_mgr_base->clks.dtbclk_en && !new_clocks->dtbclk_en) { +dcn314_smu_set_dtbclk (clk_mgr, false); + clk_mgr_base->clks.dtbclk_en = new_clocks->dtbclk_en; + } +/* check that we're not already in lower */ +if (clk_mgr_base->clks.pwr_state !=DCN_PWR_STATE_LOW_POWER ) { + display_count =dcn314_get_active_display_cnt_wa (dc, context); +/* if we can go lower, go lower */ +if (display_count ==0 ) { +union display_idle_optimization_u idle_info = {0 }; + idle_info.idle_info.df_request_disabled =1 ; + idle_info.idle_info.phy_ref_clk_off =1 ; + idle_info.idle_info.s0i2_rdy =1 ; +dcn314_smu_set_display_idle_optimization (clk_mgr, idle_info.data); +/* update power state */ + clk_mgr_base->clks.pwr_state =DCN_PWR_STATE_LOW_POWER ; + } + } + }else { +if (new_clocks->zstate_support ==DCN_ZSTATE_SUPPORT_DISALLOW && + new_clocks->zstate_support != clk_mgr_base->clks.zstate_support) { +dcn314_smu_set_zstate_support (clk_mgr,DCN_ZSTATE_SUPPORT_DISALLOW ); +dm_helpers_enable_periodic_detection (clk_mgr_base->ctx, false); + clk_mgr_base->clks.zstate_support = new_clocks->zstate_support; + } + +if (!clk_mgr_base->clks.dtbclk_en && new_clocks->dtbclk_en) { +dcn314_smu_set_dtbclk (clk_mgr, true); + clk_mgr_base->clks.dtbclk_en = new_clocks->dtbclk_en; + } + +/* check that we're not already in D0 */ +if (clk_mgr_base->clks.pwr_state !=DCN_PWR_STATE_MISSION_MODE ) { +union display_idle_optimization_u idle_info = {0 }; + +dcn314_smu_set_display_idle_optimization (clk_mgr, idle_info.data); +/* update power state */ + clk_mgr_base->clks.pwr_state =DCN_PWR_STATE_MISSION_MODE ; + } + } + +if (should_set_clock (safe_to_lower, new_clocks->dcfclk_khz, clk_mgr_base->clks.dcfclk_khz)) { + clk_mgr_base->clks.dcfclk_khz = new_clocks->dcfclk_khz; +dcn314_smu_set_hard_min_dcfclk (clk_mgr, clk_mgr_base->clks.dcfclk_khz); + } + +if (should_set_clock (safe_to_lower, + new_clocks->dcfclk_deep_sleep_khz, clk_mgr_base->clks.dcfclk_deep_sleep_khz)) { + clk_mgr_base->clks.dcfclk_deep_sleep_khz = new_clocks->dcfclk_deep_sleep_khz; +dcn314_smu_set_min_deep_sleep_dcfclk (clk_mgr, clk_mgr_base->clks.dcfclk_deep_sleep_khz); + } + +// workaround: Limit dppclk to 100Mhz to avoid lower eDP panel switch to plus 4K monitor underflow. +if (!IS_DIAG_DC (dc->ctx->dce_environment)) { +if (new_clocks->dppclk_khz <100000 ) + new_clocks->dppclk_khz =100000 ; + } + +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; + update_dppclk = true; + } + +if (should_set_clock (safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz)) { +dcn314_disable_otg_wa (clk_mgr_base, true); + + clk_mgr_base->clks.dispclk_khz = new_clocks->dispclk_khz; +dcn314_smu_set_dispclk (clk_mgr, clk_mgr_base->clks.dispclk_khz); +dcn314_disable_otg_wa (clk_mgr_base, false); + + update_dispclk = true; + } + +if (dpp_clock_lowered) { +// increase per DPP DTO before lowering global dppclk +dcn20_update_clocks_update_dpp_dto (clk_mgr, context, safe_to_lower); +dcn314_smu_set_dppclk (clk_mgr, clk_mgr_base->clks.dppclk_khz); + }else { +// increase global DPPCLK before lowering per DPP DTO +if (update_dppclk || update_dispclk) +dcn314_smu_set_dppclk (clk_mgr, clk_mgr_base->clks.dppclk_khz); +// always update dtos unless clock is lowered and not safe to lower +if (new_clocks->dppclk_khz >= dc->current_state->bw_ctx.bw.dcn.clk.dppclk_khz) +dcn20_update_clocks_update_dpp_dto (clk_mgr, context, safe_to_lower); + } + +// notify DMCUB of latest clocks +memset (&cmd,0 ,sizeof (cmd)); + cmd.notify_clocks.header.type =DMUB_CMD__CLK_MGR ; + cmd.notify_clocks.header.sub_type =DMUB_CMD__CLK_MGR_NOTIFY_CLOCKS ; + cmd.notify_clocks.clocks.dcfclk_khz = clk_mgr_base->clks.dcfclk_khz; + cmd.notify_clocks.clocks.dcfclk_deep_sleep_khz = + clk_mgr_base->clks.dcfclk_deep_sleep_khz; + cmd.notify_clocks.clocks.dispclk_khz = clk_mgr_base->clks.dispclk_khz; + cmd.notify_clocks.clocks.dppclk_khz = clk_mgr_base->clks.dppclk_khz; + +dc_dmub_srv_cmd_queue (dc->ctx->dmub_srv, &cmd); +dc_dmub_srv_cmd_execute (dc->ctx->dmub_srv); +dc_dmub_srv_wait_idle (dc->ctx->dmub_srv); +} + +static int get_vco_frequency_from_reg (struct clk_mgr_internal *clk_mgr) +{ +/* get FbMult value */ +struct fixed31_32 pll_req; +unsigned int fbmult_frac_val =0 ; +unsigned int fbmult_int_val =0 ; + +/* +* Register value of fbmult is in 8.16 format, we are converting to 314.32 +* to leverage the fix point operations available in driver +*/ + +REG_GET (CLK1_CLK_PLL_REQ , FbMult_frac, &fbmult_frac_val);/* 16 bit fractional part*/ +REG_GET (CLK1_CLK_PLL_REQ , FbMult_int, &fbmult_int_val);/* 8 bit integer part */ + + pll_req =dc_fixpt_from_int (fbmult_int_val); + +/* +* since fractional part is only 16 bit in register definition but is 32 bit +* in our fix point definiton, need to shift left by 16 to obtain correct value +*/ + pll_req.value |= fbmult_frac_val <<16 ; + +/* multiply by REFCLK period */ + pll_req =dc_fixpt_mul_int (pll_req, clk_mgr->dfs_ref_freq_khz); + +/* integer part is now VCO frequency in kHz */ +return dc_fixpt_floor (pll_req); +} + +static void dcn314_enable_pme_wa (struct clk_mgr *clk_mgr_base) +{ +struct clk_mgr_internal *clk_mgr =TO_CLK_MGR_INTERNAL (clk_mgr_base); + +dcn314_smu_enable_pme_wa (clk_mgr); +} + +void dcn314_init_clocks (struct clk_mgr *clk_mgr) +{ +memset (&(clk_mgr->clks),0 ,sizeof (struct dc_clocks )); +// Assumption is that boot state always supports pstate + clk_mgr->clks.p_state_change_support = true; + clk_mgr->clks.prev_p_state_change_support = true; + clk_mgr->clks.pwr_state =DCN_PWR_STATE_UNKNOWN ; + clk_mgr->clks.zstate_support =DCN_ZSTATE_SUPPORT_UNKNOWN ; +} + +bool dcn314_are_clock_states_equal (struct dc_clocks *a, +struct dc_clocks *b) +{ +if (a->dispclk_khz != b->dispclk_khz) +return false; +else if (a->dppclk_khz != b->dppclk_khz) +return false; +else if (a->dcfclk_khz != b->dcfclk_khz) +return false; +else if (a->dcfclk_deep_sleep_khz != b->dcfclk_deep_sleep_khz) +return false; +else if (a->zstate_support != b->zstate_support) +return false; +else if (a->dtbclk_en != b->dtbclk_en) +return false; + +return true; +} + +static void dcn314_dump_clk_registers (struct clk_state_registers_and_bypass *regs_and_bypass, +struct clk_mgr *clk_mgr_base,struct clk_log_info *log_info) +{ +return ; +} + +static struct clk_bw_params dcn314_bw_params = { + .vram_type = Ddr4MemType, + .num_channels =1 , + .clk_table = { + .num_entries =4 , + }, + +}; + +static struct wm_table ddr5_wm_table = { + .entries = { + { + .wm_inst =WM_A , + .wm_type =WM_TYPE_PSTATE_CHG , + .pstate_latency_us =11.72 , + .sr_exit_time_us =9 , + .sr_enter_plus_exit_time_us =11 , + .valid = true, + }, + { + .wm_inst =WM_B , + .wm_type =WM_TYPE_PSTATE_CHG , + .pstate_latency_us =11.72 , + .sr_exit_time_us =9 , + .sr_enter_plus_exit_time_us =11 , + .valid = true, + }, + { + .wm_inst =WM_C , + .wm_type =WM_TYPE_PSTATE_CHG , + .pstate_latency_us =11.72 , + .sr_exit_time_us =9 , + .sr_enter_plus_exit_time_us =11 , + .valid = true, + }, + { + .wm_inst =WM_D , + .wm_type =WM_TYPE_PSTATE_CHG , + .pstate_latency_us =11.72 , + .sr_exit_time_us =9 , + .sr_enter_plus_exit_time_us =11 , + .valid = true, + }, + } +}; + +static struct wm_table lpddr5_wm_table = { + .entries = { + { + .wm_inst =WM_A , + .wm_type =WM_TYPE_PSTATE_CHG , + .pstate_latency_us =11.65333 , + .sr_exit_time_us =11.5 , + .sr_enter_plus_exit_time_us =14.5 , + .valid = true, + }, + { + .wm_inst =WM_B , + .wm_type =WM_TYPE_PSTATE_CHG , + .pstate_latency_us =11.65333 , + .sr_exit_time_us =11.5 , + .sr_enter_plus_exit_time_us =14.5 , + .valid = true, + }, + { + .wm_inst =WM_C , + .wm_type =WM_TYPE_PSTATE_CHG , + .pstate_latency_us =11.65333 , + .sr_exit_time_us =11.5 , + .sr_enter_plus_exit_time_us =14.5 , + .valid = true, + }, + { + .wm_inst =WM_D , + .wm_type =WM_TYPE_PSTATE_CHG , + .pstate_latency_us =11.65333 , + .sr_exit_time_us =11.5 , + .sr_enter_plus_exit_time_us =14.5 , + .valid = true, + }, + } +}; + +static DpmClocks_t dummy_clocks; + +static struct dcn314_watermarks dummy_wms = {0 }; + +static void dcn314_build_watermark_ranges (struct clk_bw_params *bw_params,struct dcn314_watermarks *table) +{ +int i, num_valid_sets; + + num_valid_sets =0 ; + +for (i =0 ; i <WM_SET_COUNT ; i++) { +/* skip empty entries, the smu array has no holes*/ +if (!bw_params->wm_table.entries[i].valid) +continue ; + + table->WatermarkRow[WM_DCFCLK ][num_valid_sets].WmSetting = bw_params->wm_table.entries[i].wm_inst; + table->WatermarkRow[WM_DCFCLK ][num_valid_sets].WmType = bw_params->wm_table.entries[i].wm_type; +/* We will not select WM based on fclk, so leave it as unconstrained */ + table->WatermarkRow[WM_DCFCLK ][num_valid_sets].MinClock =0 ; + table->WatermarkRow[WM_DCFCLK ][num_valid_sets].MaxClock =0xFFFF ; + +if (table->WatermarkRow[WM_DCFCLK ][num_valid_sets].WmType ==WM_TYPE_PSTATE_CHG ) { +if (i ==0 ) + table->WatermarkRow[WM_DCFCLK ][num_valid_sets].MinMclk =0 ; +else { +/* add 1 to make it non-overlapping with next lvl */ + table->WatermarkRow[WM_DCFCLK ][num_valid_sets].MinMclk = + bw_params->clk_table.entries[i -1 ].dcfclk_mhz +1 ; + } + table->WatermarkRow[WM_DCFCLK ][num_valid_sets].MaxMclk = + bw_params->clk_table.entries[i].dcfclk_mhz; + + }else { +/* unconstrained for memory retraining */ + table->WatermarkRow[WM_DCFCLK ][num_valid_sets].MinClock =0 ; + table->WatermarkRow[WM_DCFCLK ][num_valid_sets].MaxClock =0xFFFF ; + +/* Modify previous watermark range to cover up to max */ + table->WatermarkRow[WM_DCFCLK ][num_valid_sets -1 ].MaxClock =0xFFFF ; + } + num_valid_sets++; + } + +ASSERT (num_valid_sets !=0 );/* Must have at least one set of valid watermarks */ + +/* modify the min and max to make sure we cover the whole range*/ + table->WatermarkRow[WM_DCFCLK ][0 ].MinMclk =0 ; + table->WatermarkRow[WM_DCFCLK ][0 ].MinClock =0 ; + table->WatermarkRow[WM_DCFCLK ][num_valid_sets -1 ].MaxMclk =0xFFFF ; + table->WatermarkRow[WM_DCFCLK ][num_valid_sets -1 ].MaxClock =0xFFFF ; + +/* This is for writeback only, does not matter currently as no writeback support*/ + table->WatermarkRow[WM_SOCCLK ][0 ].WmSetting =WM_A ; + table->WatermarkRow[WM_SOCCLK ][0 ].MinClock =0 ; + table->WatermarkRow[WM_SOCCLK ][0 ].MaxClock =0xFFFF ; + table->WatermarkRow[WM_SOCCLK ][0 ].MinMclk =0 ; + table->WatermarkRow[WM_SOCCLK ][0 ].MaxMclk =0xFFFF ; +} + +static void dcn314_notify_wm_ranges (struct clk_mgr *clk_mgr_base) +{ +struct clk_mgr_internal *clk_mgr =TO_CLK_MGR_INTERNAL (clk_mgr_base); +struct clk_mgr_dcn314 *clk_mgr_dcn314 =TO_CLK_MGR_DCN314 (clk_mgr); +struct dcn314_watermarks *table = clk_mgr_dcn314->smu_wm_set.wm_set; + +if (!clk_mgr->smu_ver) +return ; + +if (!table || clk_mgr_dcn314->smu_wm_set.mc_address.quad_part ==0 ) +return ; + +memset (table,0 ,sizeof (*table)); + +dcn314_build_watermark_ranges (clk_mgr_base->bw_params, table); + +dcn314_smu_set_dram_addr_high (clk_mgr, + clk_mgr_dcn314->smu_wm_set.mc_address.high_part); +dcn314_smu_set_dram_addr_low (clk_mgr, + clk_mgr_dcn314->smu_wm_set.mc_address.low_part); +dcn314_smu_transfer_wm_table_dram_2_smu (clk_mgr); +} + +static void dcn314_get_dpm_table_from_smu (struct clk_mgr_internal *clk_mgr, +struct dcn314_smu_dpm_clks *smu_dpm_clks) +{ +DpmClocks_t *table = smu_dpm_clks->dpm_clks; + +if (!clk_mgr->smu_ver) +return ; + +if (!table || smu_dpm_clks->mc_address.quad_part ==0 ) +return ; + +memset (table,0 ,sizeof (*table)); + +dcn314_smu_set_dram_addr_high (clk_mgr, + smu_dpm_clks->mc_address.high_part); +dcn314_smu_set_dram_addr_low (clk_mgr, + smu_dpm_clks->mc_address.low_part); +dcn314_smu_transfer_dpm_table_smu_2_dram (clk_mgr); +} + +static uint32_t find_max_clk_value (const uint32_t clocks[],uint32_t num_clocks) +{ +uint32_t max =0 ; +int i; + +for (i =0 ; i < num_clocks; ++i) { +if (clocks[i] > max) + max = clocks[i]; + } + +return max; +} + +static unsigned int find_clk_for_voltage ( +const DpmClocks_t *clock_table, +const uint32_t clocks[], +unsigned int voltage) +{ +int i; +int max_voltage =0 ; +int clock =0 ; + +for (i =0 ; i <NUM_SOC_VOLTAGE_LEVELS ; i++) { +if (clock_table->SocVoltage[i] == voltage) { +return clocks[i]; + }else if (clock_table->SocVoltage[i] >= max_voltage && + clock_table->SocVoltage[i] < voltage) { + max_voltage = clock_table->SocVoltage[i]; + clock = clocks[i]; + } + } + +ASSERT (clock); +return clock; +} + +static void dcn314_clk_mgr_helper_populate_bw_params (struct clk_mgr_internal *clk_mgr, +struct integrated_info *bios_info, +const DpmClocks_t *clock_table) +{ +int i, j; +struct clk_bw_params *bw_params = clk_mgr->base.bw_params; +uint32_t max_dispclk =0 , max_dppclk =0 ; + + j =-1 ; + +ASSERT (NUM_DF_PSTATE_LEVELS <=MAX_NUM_DPM_LVL ); + +/* Find lowest DPM, FCLK is filled in reverse order*/ + +for (i =NUM_DF_PSTATE_LEVELS -1 ; i >=0 ; i--) { +if (clock_table->DfPstateTable[i].FClk !=0 ) { + j = i; +break ; + } + } + +if (j ==-1 ) { +/* clock table is all 0s, just use our own hardcode */ +ASSERT (0 ); +return ; + } + + bw_params->clk_table.num_entries = j +1 ; + +/* dispclk and dppclk can be max at any voltage, same number of levels for both */ +if (clock_table->NumDispClkLevelsEnabled <=NUM_DISPCLK_DPM_LEVELS && + clock_table->NumDispClkLevelsEnabled <=NUM_DPPCLK_DPM_LEVELS ) { + max_dispclk =find_max_clk_value (clock_table->DispClocks, clock_table->NumDispClkLevelsEnabled); + max_dppclk =find_max_clk_value (clock_table->DppClocks, clock_table->NumDispClkLevelsEnabled); + }else { +ASSERT (0 ); + } + +for (i =0 ; i < bw_params->clk_table.num_entries; i++, j--) { + bw_params->clk_table.entries[i].fclk_mhz = clock_table->DfPstateTable[j].FClk; + bw_params->clk_table.entries[i].memclk_mhz = clock_table->DfPstateTable[j].MemClk; + bw_params->clk_table.entries[i].voltage = clock_table->DfPstateTable[j].Voltage; +switch (clock_table->DfPstateTable[j].WckRatio) { +case WCK_RATIO_1_2 : + bw_params->clk_table.entries[i].wck_ratio =2 ; +break ; +case WCK_RATIO_1_4 : + bw_params->clk_table.entries[i].wck_ratio =4 ; +break ; +default : + bw_params->clk_table.entries[i].wck_ratio =1 ; + } + bw_params->clk_table.entries[i].dcfclk_mhz =find_clk_for_voltage (clock_table, clock_table->DcfClocks, clock_table->DfPstateTable[j].Voltage); + bw_params->clk_table.entries[i].socclk_mhz =find_clk_for_voltage (clock_table, clock_table->SocClocks, clock_table->DfPstateTable[j].Voltage); + bw_params->clk_table.entries[i].dispclk_mhz = max_dispclk; + bw_params->clk_table.entries[i].dppclk_mhz = max_dppclk; + } + + bw_params->vram_type = bios_info->memory_type; + bw_params->num_channels = bios_info->ma_channel_number; + +for (i =0 ; i <WM_SET_COUNT ; i++) { + bw_params->wm_table.entries[i].wm_inst = i; + +if (i >= bw_params->clk_table.num_entries) { + bw_params->wm_table.entries[i].valid = false; +continue ; + } + + bw_params->wm_table.entries[i].wm_type =WM_TYPE_PSTATE_CHG ; + bw_params->wm_table.entries[i].valid = true; + } +} + +static struct clk_mgr_funcs dcn314_funcs = { + .get_dp_ref_clk_frequency = dce12_get_dp_ref_freq_khz, + .get_dtb_ref_clk_frequency = dcn31_get_dtb_ref_freq_khz, + .update_clocks = dcn314_update_clocks, + .init_clocks = dcn314_init_clocks, + .enable_pme_wa = dcn314_enable_pme_wa, + .are_clock_states_equal = dcn314_are_clock_states_equal, + .notify_wm_ranges = dcn314_notify_wm_ranges +}; +extern struct clk_mgr_funcs dcn3_fpga_funcs; + +void dcn314_clk_mgr_construct ( +struct dc_context *ctx, +struct clk_mgr_dcn314 *clk_mgr, +struct pp_smu_funcs *pp_smu, +struct dccg *dccg) +{ +struct dcn314_smu_dpm_clks smu_dpm_clks = {0 }; + + clk_mgr->base.base.ctx = ctx; + clk_mgr->base.base.funcs = &dcn314_funcs; + + clk_mgr->base.pp_smu = pp_smu; + + clk_mgr->base.dccg = dccg; + clk_mgr->base.dfs_bypass_disp_clk =0 ; + + clk_mgr->base.dprefclk_ss_percentage =0 ; + clk_mgr->base.dprefclk_ss_divider =1000 ; + clk_mgr->base.ss_on_dprefclk = false; + clk_mgr->base.dfs_ref_freq_khz =48000 ; + + clk_mgr->smu_wm_set.wm_set = (struct dcn314_watermarks *)dm_helpers_allocate_gpu_mem ( + clk_mgr->base.base.ctx, +DC_MEM_ALLOC_TYPE_FRAME_BUFFER , +sizeof (struct dcn314_watermarks ), + &clk_mgr->smu_wm_set.mc_address.quad_part); + +if (!clk_mgr->smu_wm_set.wm_set) { + clk_mgr->smu_wm_set.wm_set = &dummy_wms; + clk_mgr->smu_wm_set.mc_address.quad_part =0 ; + } +ASSERT (clk_mgr->smu_wm_set.wm_set); + + smu_dpm_clks.dpm_clks = (DpmClocks_t *)dm_helpers_allocate_gpu_mem ( + clk_mgr->base.base.ctx, +DC_MEM_ALLOC_TYPE_FRAME_BUFFER , +sizeof (DpmClocks_t), + &smu_dpm_clks.mc_address.quad_part); + +if (smu_dpm_clks.dpm_clks ==NULL ) { + smu_dpm_clks.dpm_clks = &dummy_clocks; + smu_dpm_clks.mc_address.quad_part =0 ; + } + +ASSERT (smu_dpm_clks.dpm_clks); + +if (IS_FPGA_MAXIMUS_DC (ctx->dce_environment)) { + clk_mgr->base.base.funcs = &dcn3_fpga_funcs; + }else { +struct clk_log_info log_info = {0 }; + + clk_mgr->base.smu_ver =dcn314_smu_get_smu_version (&clk_mgr->base); + +if (clk_mgr->base.smu_ver) + clk_mgr->base.smu_present = true; + +/* TODO: Check we get what we expect during bringup */ + clk_mgr->base.base.dentist_vco_freq_khz =get_vco_frequency_from_reg (&clk_mgr->base); + +if (ctx->dc_bios->integrated_info->memory_type == LpDdr5MemType) + dcn314_bw_params.wm_table = lpddr5_wm_table; +else + dcn314_bw_params.wm_table = ddr5_wm_table; + +/* Saved clocks configured at boot for debug purposes */ +dcn314_dump_clk_registers (&clk_mgr->base.base.boot_snapshot, &clk_mgr->base.base, &log_info); + + } + + clk_mgr->base.base.dprefclk_khz =600000 ; + clk_mgr->base.base.clks.ref_dtbclk_khz =600000 ; +dce_clock_read_ss_info (&clk_mgr->base); +/*if bios enabled SS, driver needs to adjust dtb clock, only enable with correct bios*/ +//clk_mgr->base.dccg->ref_dtbclk_khz = dce_adjust_dp_ref_freq_for_ss(clk_mgr_internal, clk_mgr->base.base.dprefclk_khz); + + clk_mgr->base.base.bw_params = &dcn314_bw_params; + +if (clk_mgr->base.base.ctx->dc->debug.pstate_enabled) { +dcn314_get_dpm_table_from_smu (&clk_mgr->base, &smu_dpm_clks); + +if (ctx->dc_bios && ctx->dc_bios->integrated_info) { +dcn314_clk_mgr_helper_populate_bw_params ( + &clk_mgr->base, + ctx->dc_bios->integrated_info, + smu_dpm_clks.dpm_clks); + } + } + +if (smu_dpm_clks.dpm_clks && smu_dpm_clks.mc_address.quad_part !=0 ) +dm_helpers_free_gpu_mem (clk_mgr->base.base.ctx,DC_MEM_ALLOC_TYPE_FRAME_BUFFER , + smu_dpm_clks.dpm_clks); +} + +void dcn314_clk_mgr_destroy (struct clk_mgr_internal *clk_mgr_int) +{ +struct clk_mgr_dcn314 *clk_mgr =TO_CLK_MGR_DCN314 (clk_mgr_int); + +if (clk_mgr->smu_wm_set.wm_set && clk_mgr->smu_wm_set.mc_address.quad_part !=0 ) +dm_helpers_free_gpu_mem (clk_mgr_int->base.ctx,DC_MEM_ALLOC_TYPE_FRAME_BUFFER , + clk_mgr->smu_wm_set.wm_set); +}
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.h new file +57 -0
57 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_smu.c new file +391 -0
391 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_smu.h new file +79 -0
79 lines not on this page · raw message
Signature · 1 line
2.35.3
Alex Deucher
maintainerPATCH 4/9 drm/amd/display: Add DCN314 DC resources
In reply to Alex DeucherFrom: Roman Li <[email protected]>
Display Core support for DCN 3.1.4
v2:(squash)fix non-x86 in dc/dcn314/Makefile
Properly handle PPC as well. (Alex)
v3: minor cleanup (Alex)
--- .../gpu/drm/amd/display/dc/dcn314/Makefile | 43 + .../drm/amd/display/dc/dcn314/dcn314_dccg.c | 265 ++ .../drm/amd/display/dc/dcn314/dcn314_dccg.h | 158 ++ .../dc/dcn314/dcn314_dio_stream_encoder.c | 448 ++++ .../dc/dcn314/dcn314_dio_stream_encoder.h | 311 +++ .../drm/amd/display/dc/dcn314/dcn314_hwseq.c | 341 +++ .../drm/amd/display/dc/dcn314/dcn314_hwseq.h | 40 + .../drm/amd/display/dc/dcn314/dcn314_init.c | 158 ++ .../drm/amd/display/dc/dcn314/dcn314_init.h | 34 + .../drm/amd/display/dc/dcn314/dcn314_optc.c | 240 ++ .../drm/amd/display/dc/dcn314/dcn314_optc.h | 255 ++ .../amd/display/dc/dcn314/dcn314_resource.c | 2357 +++++++++++++++++ .../amd/display/dc/dcn314/dcn314_resource.h | 43 + 13 files changed, 4693 insertions(+) create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/Makefile create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.c create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.h create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dio_stream_encoder.c create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dio_stream_encoder.h create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.c create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.h create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_init.c create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_init.h create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_optc.c create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_optc.h create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c create mode 100644 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.h
drivers/gpu/drm/amd/display/dc/dcn314/Makefile new file +43 -0
@@ -0,0 +1,43 @@ +# +# (c) Copyright 2022 Advanced Micro Devices, Inc. All the rights reserved +# +# All rights reserved. This notice is intended as a precaution against +# inadvertent publication and does not imply publication or any waiver +# of confidentiality. The year included in the foregoing notice is the +# year of creation of the work. +# +# Authors: AMD +# +# Makefile for dcn314. + +DCN314 = dcn314_resource.o dcn314_hwseq.o dcn314_init.o \ + dcn314_dio_stream_encoder.o dcn314_dccg.o dcn314_optc.o + +ifdef CONFIG_X86 +CFLAGS_$(AMDDALPATH)/dc/dcn314/dcn314_resource.o := -mhard-float -msse +endif + +ifdef CONFIG_PPC64 +CFLAGS_$(AMDDALPATH)/dc/dcn314/dcn314_resource.o := -mhard-float -maltivec +endif + +ifdef CONFIG_CC_IS_GCC +ifeq ($(call cc-ifversion, -lt, 0701, y), y) +IS_OLD_GCC = 1 +endif +endif + +ifdef CONFIG_X86 +ifdef IS_OLD_GCC +# Stack alignment mismatch, proceed with caution. +# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 +# (8B stack alignment). +CFLAGS_$(AMDDALPATH)/dc/dcn314/dcn314_resource.o += -mpreferred-stack-boundary=4 +else +CFLAGS_$(AMDDALPATH)/dc/dcn314/dcn314_resource.o += -msse2 +endif +endif + +AMD_DAL_DCN314 = $(addprefix $(AMDDALPATH)/dc/dcn314/,$(DCN314)) + +AMD_DISPLAY_FILES += $(AMD_DAL_DCN314)
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.c new file +265 -0
265 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.h new file +158 -0
158 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dio_stream_encoder.c new file +448 -0
448 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dio_stream_encoder.h new file +311 -0
311 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.c new file +341 -0
341 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.h new file +40 -0
@@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright 2022 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +* Authors: AMD +* +*/ + +#ifndef __DC_HWSS_DCN314_H__ +#define __DC_HWSS_DCN314_H__ + +#include "hw_sequencer_private.h" + +struct dc ; + +void dcn314_update_odm (struct dc *dc,struct dc_state *context,struct pipe_ctx *pipe_ctx); + +void dcn314_dsc_pg_control (struct dce_hwseq *hws,unsigned int dsc_inst,bool power_on); + +void dcn314_enable_power_gating_plane (struct dce_hwseq *hws,bool enable); + +#endif /* __DC_HWSS_DCN314_H__ */
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_init.c new file +158 -0
158 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_init.h new file +34 -0
@@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright 2022 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +* Authors: AMD +* +*/ + +#ifndef __DC_DCN314_INIT_H__ +#define __DC_DCN314_INIT_H__ + +struct dc ; + +void dcn314_hw_sequencer_construct (struct dc *dc); + +#endif /* __DC_DCN314_INIT_H__ */
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_optc.c new file +240 -0
240 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_optc.h new file +255 -0
255 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c new file +2357 -0
707 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.h new file +43 -0
43 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.35.3
Part of the diff is not shown here. View the raw message.
Alex Deucher
maintainerPATCH 5/9 drm/amd/display: Add DCN314 DML calculation support
In reply to Alex DeucherFrom: Roman Li <[email protected]>
Display mode library for DCN 3.1.4
--- .../dc/dml/dcn314/display_mode_vba_314.c | 7420 +++++++++++++++++ .../dc/dml/dcn314/display_mode_vba_314.h | 44 + .../dc/dml/dcn314/display_rq_dlg_calc_314.c | 1733 ++++ .../dc/dml/dcn314/display_rq_dlg_calc_314.h | 70 + 4 files changed, 9267 insertions(+) create mode 100644 drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c create mode 100644 drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.h create mode 100644 drivers/gpu/drm/amd/display/dc/dml/dcn314/display_rq_dlg_calc_314.c create mode 100644 drivers/gpu/drm/amd/display/dc/dml/dcn314/display_rq_dlg_calc_314.h
drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c new file +7420 -0
@@ -0,0 +1,7420 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright 2022 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +* Authors: AMD +* +*/ + +#define UNIT_TEST 0 +#if !UNIT_TEST +#include "dc.h" +#include "dc_link.h" +#endif +#include "../display_mode_lib.h" +#include "display_mode_vba_314.h" +#include "../dml_inline_defs.h" + +/* +* NOTE: +* This file is gcc-parsable HW gospel, coming straight from HW engineers. +* +* It doesn't adhere to Linux kernel style and sometimes will do things in odd +* ways. Unless there is something clearly wrong with it the code should +* remain as-is as it provides us with a guarantee from HW that it is correct. +*/ + +#define BPP_INVALID 0 +#define BPP_BLENDED_PIPE 0xffffffff +#define DCN314_MAX_DSC_IMAGE_WIDTH 5184 +#define DCN314_MAX_FMT_420_BUFFER_WIDTH 4096 + +// For DML-C changes that hasn't been propagated to VBA yet +//#define __DML_VBA_ALLOW_DELTA__ + +// Move these to ip parameters/constant + +// At which vstartup the DML start to try if the mode can be supported +#define __DML_VBA_MIN_VSTARTUP__ 9 + +// Delay in DCFCLK from ARB to DET (1st num is ARB to SDPIF, 2nd number is SDPIF to DET) +#define __DML_ARB_TO_RET_DELAY__ (7 + 95) + +// fudge factor for min dcfclk calclation +#define __DML_MIN_DCFCLK_FACTOR__ 1.15 + +struct { +double DPPCLK; +double DISPCLK; +double PixelClock; +double DCFCLKDeepSleep; +unsigned int DPPPerPlane; +bool ScalerEnabled; +double VRatio; +double VRatioChroma; +enum scan_direction_class SourceScan; +unsigned int BlockWidth256BytesY; +unsigned int BlockHeight256BytesY; +unsigned int BlockWidth256BytesC; +unsigned int BlockHeight256BytesC; +unsigned int InterlaceEnable; +unsigned int NumberOfCursors; +unsigned int VBlank; +unsigned int HTotal; +unsigned int DCCEnable; +bool ODMCombineIsEnabled; +enum source_format_class SourcePixelFormat; +int BytePerPixelY; +int BytePerPixelC; +bool ProgressiveToInterlaceUnitInOPP; +} Pipe; + +#define BPP_INVALID 0 +#define BPP_BLENDED_PIPE 0xffffffff + +static bool CalculateBytePerPixelAnd256BBlockSizes ( +enum source_format_class SourcePixelFormat, +enum dm_swizzle_mode SurfaceTiling, +unsigned int *BytePerPixelY, +unsigned int *BytePerPixelC, +double *BytePerPixelDETY, +double *BytePerPixelDETC, +unsigned int *BlockHeight256BytesY, +unsigned int *BlockHeight256BytesC, +unsigned int *BlockWidth256BytesY, +unsigned int *BlockWidth256BytesC); +static void DisplayPipeConfiguration (struct display_mode_lib *mode_lib); +static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation (struct display_mode_lib *mode_lib); +static unsigned int dscceComputeDelay ( +unsigned int bpc, +double BPP , +unsigned int sliceWidth, +unsigned int numSlices, +enum output_format_class pixelFormat, +enum output_encoder_class Output); +static unsigned int dscComputeDelay (enum output_format_class pixelFormat,enum output_encoder_class Output); +static bool CalculatePrefetchSchedule ( +struct display_mode_lib *mode_lib, +double HostVMInefficiencyFactor, +Pipe *myPipe, +unsigned int DSCDelay, +double DPPCLKDelaySubtotalPlusCNVCFormater, +double DPPCLKDelaySCL, +double DPPCLKDelaySCLLBOnly, +double DPPCLKDelayCNVCCursor, +double DISPCLKDelaySubtotal, +unsigned int DPP_RECOUT_WIDTH , +enum output_format_class OutputFormat, +unsigned int MaxInterDCNTileRepeaters, +unsigned int VStartup, +unsigned int MaxVStartup, +unsigned int GPUVMPageTableLevels, +bool GPUVMEnable, +bool HostVMEnable, +unsigned int HostVMMaxNonCachedPageTableLevels, +double HostVMMinPageSize, +bool DynamicMetadataEnable, +bool DynamicMetadataVMEnabled, +int DynamicMetadataLinesBeforeActiveRequired, +unsigned int DynamicMetadataTransmittedBytes, +double UrgentLatency, +double UrgentExtraLatency, +double TCalc, +unsigned int PDEAndMetaPTEBytesFrame, +unsigned int MetaRowByte, +unsigned int PixelPTEBytesPerRow, +double PrefetchSourceLinesY, +unsigned int SwathWidthY, +double VInitPreFillY, +unsigned int MaxNumSwathY, +double PrefetchSourceLinesC, +unsigned int SwathWidthC, +double VInitPreFillC, +unsigned int MaxNumSwathC, +int swath_width_luma_ub, +int swath_width_chroma_ub, +unsigned int SwathHeightY, +unsigned int SwathHeightC, +double TWait, +double *DSTXAfterScaler, +double *DSTYAfterScaler, +double *DestinationLinesForPrefetch, +double *PrefetchBandwidth, +double *DestinationLinesToRequestVMInVBlank, +double *DestinationLinesToRequestRowInVBlank, +double *VRatioPrefetchY, +double *VRatioPrefetchC, +double *RequiredPrefetchPixDataBWLuma, +double *RequiredPrefetchPixDataBWChroma, +bool *NotEnoughTimeForDynamicMetadata, +double *Tno_bw, +double *prefetch_vmrow_bw, +double *Tdmdl_vm, +double *Tdmdl, +double *TSetup, +int *VUpdateOffsetPix, +double *VUpdateWidthPix, +double *VReadyOffsetPix); +static double RoundToDFSGranularityUp (double Clock,double VCOSpeed); +static double RoundToDFSGranularityDown (double Clock,double VCOSpeed); +static void CalculateDCCConfiguration ( +bool DCCEnabled, +bool DCCProgrammingAssumesScanDirectionUnknown, +enum source_format_class SourcePixelFormat, +unsigned int SurfaceWidthLuma, +unsigned int SurfaceWidthChroma, +unsigned int SurfaceHeightLuma, +unsigned int SurfaceHeightChroma, +double DETBufferSize, +unsigned int RequestHeight256ByteLuma, +unsigned int RequestHeight256ByteChroma, +enum dm_swizzle_mode TilingFormat, +unsigned int BytePerPixelY, +unsigned int BytePerPixelC, +double BytePerPixelDETY, +double BytePerPixelDETC, +enum scan_direction_class ScanOrientation, +unsigned int *MaxUncompressedBlockLuma, +unsigned int *MaxUncompressedBlockChroma, +unsigned int *MaxCompressedBlockLuma, +unsigned int *MaxCompressedBlockChroma, +unsigned int *IndependentBlockLuma, +unsigned int *IndependentBlockChroma); +static double CalculatePrefetchSourceLines ( +struct display_mode_lib *mode_lib, +double VRatio, +double vtaps, +bool Interlace, +bool ProgressiveToInterlaceUnitInOPP, +unsigned int SwathHeight, +unsigned int ViewportYStart, +double *VInitPreFill, +unsigned int *MaxNumSwath); +static unsigned int CalculateVMAndRowBytes ( +struct display_mode_lib *mode_lib, +bool DCCEnable, +unsigned int BlockHeight256Bytes, +unsigned int BlockWidth256Bytes, +enum source_format_class SourcePixelFormat, +unsigned int SurfaceTiling, +unsigned int BytePerPixel, +enum scan_direction_class ScanDirection, +unsigned int SwathWidth, +unsigned int ViewportHeight, +bool GPUVMEnable, +bool HostVMEnable, +unsigned int HostVMMaxNonCachedPageTableLevels, +unsigned int GPUVMMinPageSize, +unsigned int HostVMMinPageSize, +unsigned int PTEBufferSizeInRequests, +unsigned int Pitch, +unsigned int DCCMetaPitch, +unsigned int *MacroTileWidth, +unsigned int *MetaRowByte, +unsigned int *PixelPTEBytesPerRow, +bool *PTEBufferSizeNotExceeded, +int *dpte_row_width_ub, +unsigned int *dpte_row_height, +unsigned int *MetaRequestWidth, +unsigned int *MetaRequestHeight, +unsigned int *meta_row_width, +unsigned int *meta_row_height, +int *vm_group_bytes, +unsigned int *dpte_group_bytes, +unsigned int *PixelPTEReqWidth, +unsigned int *PixelPTEReqHeight, +unsigned int *PTERequestSize, +int *DPDE0BytesFrame, +int *MetaPTEBytesFrame); +static double CalculateTWait (unsigned int PrefetchMode,double DRAMClockChangeLatency,double UrgentLatency,double SREnterPlusExitTime); +static void CalculateRowBandwidth ( +bool GPUVMEnable, +enum source_format_class SourcePixelFormat, +double VRatio, +double VRatioChroma, +bool DCCEnable, +double LineTime, +unsigned int MetaRowByteLuma, +unsigned int MetaRowByteChroma, +unsigned int meta_row_height_luma, +unsigned int meta_row_height_chroma, +unsigned int PixelPTEBytesPerRowLuma, +unsigned int PixelPTEBytesPerRowChroma, +unsigned int dpte_row_height_luma, +unsigned int dpte_row_height_chroma, +double *meta_row_bw, +double *dpte_row_bw); + +static void CalculateFlipSchedule ( +struct display_mode_lib *mode_lib, +double HostVMInefficiencyFactor, +double UrgentExtraLatency, +double UrgentLatency, +unsigned int GPUVMMaxPageTableLevels, +bool HostVMEnable, +unsigned int HostVMMaxNonCachedPageTableLevels, +bool GPUVMEnable, +double HostVMMinPageSize, +double PDEAndMetaPTEBytesPerFrame, +double MetaRowBytes, +double DPTEBytesPerRow, +double BandwidthAvailableForImmediateFlip, +unsigned int TotImmediateFlipBytes, +enum source_format_class SourcePixelFormat, +double LineTime, +double VRatio, +double VRatioChroma, +double Tno_bw, +bool DCCEnable, +unsigned int dpte_row_height, +unsigned int meta_row_height, +unsigned int dpte_row_height_chroma, +unsigned int meta_row_height_chroma, +double *DestinationLinesToRequestVMInImmediateFlip, +double *DestinationLinesToRequestRowInImmediateFlip, +double *final_flip_bw, +bool *ImmediateFlipSupportedForPipe); +static double CalculateWriteBackDelay ( +enum source_format_class WritebackPixelFormat, +double WritebackHRatio, +double WritebackVRatio, +unsigned int WritebackVTaps, +int WritebackDestinationWidth, +int WritebackDestinationHeight, +int WritebackSourceHeight, +unsigned int HTotal); + +static void CalculateVupdateAndDynamicMetadataParameters ( +int MaxInterDCNTileRepeaters, +double DPPCLK , +double DISPCLK , +double DCFClkDeepSleep, +double PixelClock, +int HTotal, +int VBlank, +int DynamicMetadataTransmittedBytes, +int DynamicMetadataLinesBeforeActiveRequired, +int InterlaceEnable, +bool ProgressiveToInterlaceUnitInOPP, +double *TSetup, +double *Tdmbf, +double *Tdmec, +double *Tdmsks, +int *VUpdateOffsetPix, +double *VUpdateWidthPix, +double *VReadyOffsetPix); + +static void CalculateWatermarksAndDRAMSpeedChangeSupport ( +struct display_mode_lib *mode_lib, +unsigned int PrefetchMode, +unsigned int NumberOfActivePlanes, +unsigned int MaxLineBufferLines, +unsigned int LineBufferSize, +unsigned int WritebackInterfaceBufferSize, +double DCFCLK , +double ReturnBW, +bool SynchronizedVBlank, +unsigned int dpte_group_bytes[], +unsigned int MetaChunkSize, +double UrgentLatency, +double ExtraLatency, +double WritebackLatency, +double WritebackChunkSize, +double SOCCLK , +double DRAMClockChangeLatency, +double SRExitTime, +double SREnterPlusExitTime, +double SRExitZ8Time, +double SREnterPlusExitZ8Time, +double DCFCLKDeepSleep, +unsigned int DETBufferSizeY[], +unsigned int DETBufferSizeC[], +unsigned int SwathHeightY[], +unsigned int SwathHeightC[], +unsigned int LBBitPerPixel[], +double SwathWidthY[], +double SwathWidthC[], +double HRatio[], +double HRatioChroma[], +unsigned int vtaps[], +unsigned int VTAPsChroma[], +double VRatio[], +double VRatioChroma[], +unsigned int HTotal[], +double PixelClock[], +unsigned int BlendingAndTiming[], +unsigned int DPPPerPlane[], +double BytePerPixelDETY[], +double BytePerPixelDETC[], +double DSTXAfterScaler[], +double DSTYAfterScaler[], +bool WritebackEnable[], +enum source_format_class WritebackPixelFormat[], +double WritebackDestinationWidth[], +double WritebackDestinationHeight[], +double WritebackSourceHeight[], +bool UnboundedRequestEnabled, +unsigned int CompressedBufferSizeInkByte, +enum clock_change_support *DRAMClockChangeSupport, +double *UrgentWatermark, +double *WritebackUrgentWatermark, +double *DRAMClockChangeWatermark, +double *WritebackDRAMClockChangeWatermark, +double *StutterExitWatermark, +double *StutterEnterPlusExitWatermark, +double *Z8StutterExitWatermark, +double *Z8StutterEnterPlusExitWatermark, +double *MinActiveDRAMClockChangeLatencySupported); + +static void CalculateDCFCLKDeepSleep ( +struct display_mode_lib *mode_lib, +unsigned int NumberOfActivePlanes, +int BytePerPixelY[], +int BytePerPixelC[], +double VRatio[], +double VRatioChroma[], +double SwathWidthY[], +double SwathWidthC[], +unsigned int DPPPerPlane[], +double HRatio[], +double HRatioChroma[], +double PixelClock[], +double PSCL_THROUGHPUT [], +double PSCL_THROUGHPUT_CHROMA [], +double DPPCLK [], +double ReadBandwidthLuma[], +double ReadBandwidthChroma[], +int ReturnBusWidth, +double *DCFCLKDeepSleep); + +static void CalculateUrgentBurstFactor ( +int swath_width_luma_ub, +int swath_width_chroma_ub, +unsigned int SwathHeightY, +unsigned int SwathHeightC, +double LineTime, +double UrgentLatency, +double CursorBufferSize, +unsigned int CursorWidth, +unsigned int CursorBPP, +double VRatio, +double VRatioC, +double BytePerPixelInDETY, +double BytePerPixelInDETC, +double DETBufferSizeY, +double DETBufferSizeC, +double *UrgentBurstFactorCursor, +double *UrgentBurstFactorLuma, +double *UrgentBurstFactorChroma, +bool *NotEnoughUrgentLatencyHiding); + +static void UseMinimumDCFCLK ( +struct display_mode_lib *mode_lib, +int MaxPrefetchMode, +int ReorderingBytes); + +static void CalculatePixelDeliveryTimes ( +unsigned int NumberOfActivePlanes, +double VRatio[], +double VRatioChroma[], +double VRatioPrefetchY[], +double VRatioPrefetchC[], +unsigned int swath_width_luma_ub[], +unsigned int swath_width_chroma_ub[], +unsigned int DPPPerPlane[], +double HRatio[], +double HRatioChroma[], +double PixelClock[], +double PSCL_THROUGHPUT [], +double PSCL_THROUGHPUT_CHROMA [], +double DPPCLK [], +int BytePerPixelC[], +enum scan_direction_class SourceScan[], +unsigned int NumberOfCursors[], +unsigned int CursorWidth[][DC__NUM_CURSOR__MAX ], +unsigned int CursorBPP[][DC__NUM_CURSOR__MAX ], +unsigned int BlockWidth256BytesY[], +unsigned int BlockHeight256BytesY[], +unsigned int BlockWidth256BytesC[], +unsigned int BlockHeight256BytesC[], +double DisplayPipeLineDeliveryTimeLuma[], +double DisplayPipeLineDeliveryTimeChroma[], +double DisplayPipeLineDeliveryTimeLumaPrefetch[], +double DisplayPipeLineDeliveryTimeChromaPrefetch[], +double DisplayPipeRequestDeliveryTimeLuma[], +double DisplayPipeRequestDeliveryTimeChroma[], +double DisplayPipeRequestDeliveryTimeLumaPrefetch[], +double DisplayPipeRequestDeliveryTimeChromaPrefetch[], +double CursorRequestDeliveryTime[], +double CursorRequestDeliveryTimePrefetch[]); + +static void CalculateMetaAndPTETimes ( +int NumberOfActivePlanes, +bool GPUVMEnable, +int MetaChunkSize, +int MinMetaChunkSizeBytes, +int HTotal[], +double VRatio[], +double VRatioChroma[], +double DestinationLinesToRequestRowInVBlank[], +double DestinationLinesToRequestRowInImmediateFlip[], +bool DCCEnable[], +double PixelClock[], +int BytePerPixelY[], +int BytePerPixelC[], +enum scan_direction_class SourceScan[], +int dpte_row_height[], +int dpte_row_height_chroma[], +int meta_row_width[], +int meta_row_width_chroma[], +int meta_row_height[], +int meta_row_height_chroma[], +int meta_req_width[], +int meta_req_width_chroma[], +int meta_req_height[], +int meta_req_height_chroma[], +int dpte_group_bytes[], +int PTERequestSizeY[], +int PTERequestSizeC[], +int PixelPTEReqWidthY[], +int PixelPTEReqHeightY[], +int PixelPTEReqWidthC[], +int PixelPTEReqHeightC[], +int dpte_row_width_luma_ub[], +int dpte_row_width_chroma_ub[], +double DST_Y_PER_PTE_ROW_NOM_L [], +double DST_Y_PER_PTE_ROW_NOM_C [], +double DST_Y_PER_META_ROW_NOM_L [], +double DST_Y_PER_META_ROW_NOM_C [], +double TimePerMetaChunkNominal[], +double TimePerChromaMetaChunkNominal[], +double TimePerMetaChunkVBlank[], +double TimePerChromaMetaChunkVBlank[], +double TimePerMetaChunkFlip[], +double TimePerChromaMetaChunkFlip[], +double time_per_pte_group_nom_luma[], +double time_per_pte_group_vblank_luma[], +double time_per_pte_group_flip_luma[], +double time_per_pte_group_nom_chroma[], +double time_per_pte_group_vblank_chroma[], +double time_per_pte_group_flip_chroma[]); + +static void CalculateVMGroupAndRequestTimes ( +unsigned int NumberOfActivePlanes, +bool GPUVMEnable, +unsigned int GPUVMMaxPageTableLevels, +unsigned int HTotal[], +int BytePerPixelC[], +double DestinationLinesToRequestVMInVBlank[], +double DestinationLinesToRequestVMInImmediateFlip[], +bool DCCEnable[], +double PixelClock[], +int dpte_row_width_luma_ub[], +int dpte_row_width_chroma_ub[], +int vm_group_bytes[], +unsigned int dpde0_bytes_per_frame_ub_l[], +unsigned int dpde0_bytes_per_frame_ub_c[], +int meta_pte_bytes_per_frame_ub_l[], +int meta_pte_bytes_per_frame_ub_c[], +double TimePerVMGroupVBlank[], +double TimePerVMGroupFlip[], +double TimePerVMRequestVBlank[], +double TimePerVMRequestFlip[]); + +static void CalculateStutterEfficiency ( +struct display_mode_lib *mode_lib, +int CompressedBufferSizeInkByte, +bool UnboundedRequestEnabled, +int ConfigReturnBufferSizeInKByte, +int MetaFIFOSizeInKEntries, +int ZeroSizeBufferEntries, +int NumberOfActivePlanes, +int ROBBufferSizeInKByte, +double TotalDataReadBandwidth, +double DCFCLK , +double ReturnBW, +double COMPBUF_RESERVED_SPACE_64B , +double COMPBUF_RESERVED_SPACE_ZS , +double SRExitTime, +double SRExitZ8Time, +bool SynchronizedVBlank, +double Z8StutterEnterPlusExitWatermark, +double StutterEnterPlusExitWatermark, +bool ProgressiveToInterlaceUnitInOPP, +bool Interlace[], +double MinTTUVBlank[], +int DPPPerPlane[], +unsigned int DETBufferSizeY[], +int BytePerPixelY[], +double BytePerPixelDETY[], +double SwathWidthY[], +int SwathHeightY[], +int SwathHeightC[], +double NetDCCRateLuma[], +double NetDCCRateChroma[], +double DCCFractionOfZeroSizeRequestsLuma[], +double DCCFractionOfZeroSizeRequestsChroma[], +int HTotal[], +int VTotal[], +double PixelClock[], +double VRatio[], +enum scan_direction_class SourceScan[], +int BlockHeight256BytesY[], +int BlockWidth256BytesY[], +int BlockHeight256BytesC[], +int BlockWidth256BytesC[], +int DCCYMaxUncompressedBlock[], +int DCCCMaxUncompressedBlock[], +int VActive[], +bool DCCEnable[], +bool WritebackEnable[], +double ReadBandwidthPlaneLuma[], +double ReadBandwidthPlaneChroma[], +double meta_row_bw[], +double dpte_row_bw[], +double *StutterEfficiencyNotIncludingVBlank, +double *StutterEfficiency, +int *NumberOfStutterBurstsPerFrame, +double *Z8StutterEfficiencyNotIncludingVBlank, +double *Z8StutterEfficiency, +int *Z8NumberOfStutterBurstsPerFrame, +double *StutterPeriod); + +static void CalculateSwathAndDETConfiguration ( +bool ForceSingleDPP, +int NumberOfActivePlanes, +unsigned int DETBufferSizeInKByte, +double MaximumSwathWidthLuma[], +double MaximumSwathWidthChroma[], +enum scan_direction_class SourceScan[], +enum source_format_class SourcePixelFormat[], +enum dm_swizzle_mode SurfaceTiling[], +int ViewportWidth[], +int ViewportHeight[], +int SurfaceWidthY[], +int SurfaceWidthC[], +int SurfaceHeightY[], +int SurfaceHeightC[], +int Read256BytesBlockHeightY[], +int Read256BytesBlockHeightC[], +int Read256BytesBlockWidthY[], +int Read256BytesBlockWidthC[], +enum odm_combine_mode ODMCombineEnabled[], +int BlendingAndTiming[], +int BytePerPixY[], +int BytePerPixC[], +double BytePerPixDETY[], +double BytePerPixDETC[], +int HActive[], +double HRatio[], +double HRatioChroma[], +int DPPPerPlane[], +int swath_width_luma_ub[], +int swath_width_chroma_ub[], +double SwathWidth[], +double SwathWidthChroma[], +int SwathHeightY[], +int SwathHeightC[], +unsigned int DETBufferSizeY[], +unsigned int DETBufferSizeC[], +bool ViewportSizeSupportPerPlane[], +bool *ViewportSizeSupport); +static void CalculateSwathWidth ( +bool ForceSingleDPP, +int NumberOfActivePlanes, +enum source_format_class SourcePixelFormat[], +enum scan_direction_class SourceScan[], +int ViewportWidth[], +int ViewportHeight[], +int SurfaceWidthY[], +int SurfaceWidthC[], +int SurfaceHeightY[], +int SurfaceHeightC[], +enum odm_combine_mode ODMCombineEnabled[], +int BytePerPixY[], +int BytePerPixC[], +int Read256BytesBlockHeightY[], +int Read256BytesBlockHeightC[], +int Read256BytesBlockWidthY[], +int Read256BytesBlockWidthC[], +int BlendingAndTiming[], +int HActive[], +double HRatio[], +int DPPPerPlane[], +double SwathWidthSingleDPPY[], +double SwathWidthSingleDPPC[], +double SwathWidthY[], +double SwathWidthC[], +int MaximumSwathHeightY[], +int MaximumSwathHeightC[], +int swath_width_luma_ub[], +int swath_width_chroma_ub[]); + +static double CalculateExtraLatency ( +int RoundTripPingLatencyCycles, +int ReorderingBytes, +double DCFCLK , +int TotalNumberOfActiveDPP, +int PixelChunkSizeInKByte, +int TotalNumberOfDCCActiveDPP, +int MetaChunkSize, +double ReturnBW, +bool GPUVMEnable, +bool HostVMEnable, +int NumberOfActivePlanes, +int NumberOfDPP[], +int dpte_group_bytes[], +double HostVMInefficiencyFactor, +double HostVMMinPageSize, +int HostVMMaxNonCachedPageTableLevels); + +static double CalculateExtraLatencyBytes ( +int ReorderingBytes, +int TotalNumberOfActiveDPP, +int PixelChunkSizeInKByte, +int TotalNumberOfDCCActiveDPP, +int MetaChunkSize, +bool GPUVMEnable, +bool HostVMEnable, +int NumberOfActivePlanes, +int NumberOfDPP[], +int dpte_group_bytes[], +double HostVMInefficiencyFactor, +double HostVMMinPageSize, +int HostVMMaxNonCachedPageTableLevels); + +static double CalculateUrgentLatency ( +double UrgentLatencyPixelDataOnly, +double UrgentLatencyPixelMixedWithVMData, +double UrgentLatencyVMDataOnly, +bool DoUrgentLatencyAdjustment, +double UrgentLatencyAdjustmentFabricClockComponent, +double UrgentLatencyAdjustmentFabricClockReference, +double FabricClockSingle); + +static void CalculateUnboundedRequestAndCompressedBufferSize ( +unsigned int DETBufferSizeInKByte, +int ConfigReturnBufferSizeInKByte, +enum unbounded_requesting_policy UseUnboundedRequestingFinal, +int TotalActiveDPP, +bool NoChromaPlanes, +int MaxNumDPP, +int CompressedBufferSegmentSizeInkByteFinal, +enum output_encoder_class *Output, +bool *UnboundedRequestEnabled, +int *CompressedBufferSizeInkByte); + +static bool UnboundedRequest (enum unbounded_requesting_policy UseUnboundedRequestingFinal,int TotalNumberOfActiveDPP,bool NoChroma,enum output_encoder_class Output); +static unsigned int CalculateMaxVStartup ( +unsigned int VTotal, +unsigned int VActive, +unsigned int VBlankNom, +unsigned int HTotal, +double PixelClock, +bool ProgressiveTointerlaceUnitinOPP, +bool Interlace, +unsigned int VBlankNomDefaultUS, +double WritebackDelayTime); + +void dml314_recalculate (struct display_mode_lib *mode_lib) +{ +ModeSupportAndSystemConfiguration (mode_lib); +PixelClockAdjustmentForProgressiveToInterlaceUnit (mode_lib); +DisplayPipeConfiguration (mode_lib); +#ifdef __DML_VBA_DEBUG__ +dml_print ("DML::%s: Calling DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation\n" , __func__); +#endif +DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation (mode_lib); +} + +static unsigned int dscceComputeDelay ( +unsigned int bpc, +double BPP , +unsigned int sliceWidth, +unsigned int numSlices, +enum output_format_class pixelFormat, +enum output_encoder_class Output) +{ +// valid bpc = source bits per component in the set of {8, 10, 12} +// valid bpp = increments of 1/16 of a bit +// min = 6/7/8 in N420/N422/444, respectively +// max = such that compression is 1:1 +//valid sliceWidth = number of pixels per slice line, must be less than or equal to 5184/numSlices (or 4096/numSlices in 420 mode) +//valid numSlices = number of slices in the horiziontal direction per DSC engine in the set of {1, 2, 3, 4} +//valid pixelFormat = pixel/color format in the set of {:N444_RGB, :S422, :N422, :N420} + +// fixed value +unsigned int rcModelSize =8192 ; + +// N422/N420 operate at 2 pixels per clock +unsigned int pixelsPerClock =0 , lstall,D , initalXmitDelay, w, s, ix, wx,P , l0, a, ax,L , Delay, pixels; + +if (pixelFormat == dm_420) + pixelsPerClock =2 ; +else if (pixelFormat == dm_444) + pixelsPerClock =1 ; +else if (pixelFormat == dm_n422) + pixelsPerClock =2 ; +// #all other modes operate at 1 pixel per clock +else + pixelsPerClock =1 ; + +//initial transmit delay as per PPS + initalXmitDelay =dml_round (rcModelSize /2.0 /BPP / pixelsPerClock); + +//compute ssm delay +if (bpc ==8 ) +D =81 ; +else if (bpc ==10 ) +D =89 ; +else +D =113 ; + +//divide by pixel per cycle to compute slice width as seen by DSC + w = sliceWidth / pixelsPerClock; + +//422 mode has an additional cycle of delay +if (pixelFormat == dm_420 || pixelFormat == dm_444 || pixelFormat == dm_n422) + s =0 ; +else + s =1 ; + +//main calculation for the dscce + ix = initalXmitDelay +45 ; + wx = (w +2 ) /3 ; +P =3 * wx - w; + l0 = ix / w; + a = ix +P * l0; + ax = (a +2 ) /3 +D +6 +1 ; +L = (ax + wx -1 ) / wx; +if ((ix % w) ==0 &&P !=0 ) + lstall =1 ; +else + lstall =0 ; + Delay =L * wx * (numSlices -1 ) + ax + s + lstall +22 ; + +//dsc processes 3 pixel containers per cycle and a container can contain 1 or 2 pixels + pixels = Delay *3 * pixelsPerClock; +return pixels; +} + +static unsigned int dscComputeDelay (enum output_format_class pixelFormat,enum output_encoder_class Output) +{ +unsigned int Delay =0 ; + +if (pixelFormat == dm_420) { +// sfr + Delay = Delay +2 ; +// dsccif + Delay = Delay +0 ; +// dscc - input deserializer + Delay = Delay +3 ; +// dscc gets pixels every other cycle + Delay = Delay +2 ; +// dscc - input cdc fifo + Delay = Delay +12 ; +// dscc gets pixels every other cycle + Delay = Delay +13 ; +// dscc - cdc uncertainty + Delay = Delay +2 ; +// dscc - output cdc fifo + Delay = Delay +7 ; +// dscc gets pixels every other cycle + Delay = Delay +3 ; +// dscc - cdc uncertainty + Delay = Delay +2 ; +// dscc - output serializer + Delay = Delay +1 ; +// sft + Delay = Delay +1 ; + }else if (pixelFormat == dm_n422) { +// sfr + Delay = Delay +2 ; +// dsccif + Delay = Delay +1 ; +// dscc - input deserializer + Delay = Delay +5 ; +// dscc - input cdc fifo + Delay = Delay +25 ; +// dscc - cdc uncertainty + Delay = Delay +2 ; +// dscc - output cdc fifo + Delay = Delay +10 ; +// dscc - cdc uncertainty + Delay = Delay +2 ; +// dscc - output serializer + Delay = Delay +1 ; +// sft + Delay = Delay +1 ; + }else { +// sfr + Delay = Delay +2 ; +// dsccif + Delay = Delay +0 ; +// dscc - input deserializer + Delay = Delay +3 ; +// dscc - input cdc fifo + Delay = Delay +12 ; +// dscc - cdc uncertainty + Delay = Delay +2 ; +// dscc - output cdc fifo + Delay = Delay +7 ; +// dscc - output serializer + Delay = Delay +1 ; +// dscc - cdc uncertainty + Delay = Delay +2 ; +// sft + Delay = Delay +1 ; + } + +return Delay; +} + +static bool CalculatePrefetchSchedule( + struct display_mode_lib *mode_lib, + double HostVMInefficiencyFactor, + Pipe *myPipe, + unsigned int DSCDelay, + double DPPCLKDelaySubtotalPlusCNVCFormater, + double DPPCLKDelaySCL, + double DPPCLKDelaySCLLBOnly, + double DPPCLKDelayCNVCCursor, + double DISPCLKDelaySubtotal, + unsigned int DPP_RECOUT_WIDTH, + enum output_format_class OutputFormat, + unsigned int MaxInterDCNTileRepeaters, + unsigned int VStartup, + unsigned int MaxVStartup, + unsigned int GPUVMPageTableLevels, + bool GPUVMEnable, + bool HostVMEnable, + unsigned int HostVMMaxNonCachedPageTableLevels, + double HostVMMinPageSize, + bool DynamicMetadataEnable, + bool DynamicMetadataVMEnabled, + int DynamicMetadataLinesBeforeActiveRequired, + unsigned int DynamicMetadataTransmittedBytes, + double UrgentLatency, + double UrgentExtraLatency, + double TCalc, + unsigned int PDEAndMetaPTEBytesFrame, + unsigned int MetaRowByte, + unsigned int PixelPTEBytesPerRow, + double PrefetchSourceLinesY, + unsigned int SwathWidthY, + double VInitPreFillY, + unsigned int MaxNumSwathY, + double PrefetchSourceLinesC, + unsigned int SwathWidthC, + double VInitPreFillC, + unsigned int MaxNumSwathC, + int swath_width_luma_ub, + int swath_width_chroma_ub, + unsigned int SwathHeightY, + unsigned int SwathHeightC, + double TWait, + double *DSTXAfterScaler, + double *DSTYAfterScaler, + double *DestinationLinesForPrefetch, + double *PrefetchBandwidth, + double *DestinationLinesToRequestVMInVBlank, + double *DestinationLinesToRequestRowInVBlank, + double *VRatioPrefetchY, + double *VRatioPrefetchC, + double *RequiredPrefetchPixDataBWLuma, + double *RequiredPrefetchPixDataBWChroma, + bool *NotEnoughTimeForDynamicMetadata, + double *Tno_bw, + double *prefetch_vmrow_bw, + double *Tdmdl_vm, + double *Tdmdl, + double *TSetup, + int *VUpdateOffsetPix, + double *VUpdateWidthPix, + double *VReadyOffsetPix) +{ + bool MyError = false; + unsigned int DPPCycles, DISPCLKCycles; + double DSTTotalPixelsAfterScaler; + double LineTime; + double dst_y_prefetch_equ; + double Tsw_oto; + double prefetch_bw_oto; + double prefetch_bw_pr; + double Tvm_oto; + double Tr0_oto; + double Tvm_oto_lines; + double Tr0_oto_lines; + double dst_y_prefetch_oto; + double TimeForFetchingMetaPTE = 0; + double TimeForFetchingRowInVBlank = 0; + double LinesToRequestPrefetchPixelData = 0; + unsigned int HostVMDynamicLevelsTrips; + double trip_to_mem; + double Tvm_trips; + double Tr0_trips; + double Tvm_trips_rounded; + double Tr0_trips_rounded; + double Lsw_oto; + double Tpre_rounded; + double prefetch_bw_equ; + double Tvm_equ; + double Tr0_equ; + double Tdmbf; + double Tdmec; + double Tdmsks; + double prefetch_sw_bytes; + double bytes_pp; + double dep_bytes; + int max_vratio_pre = 4; + double min_Lsw; + double Tsw_est1 = 0; + double Tsw_est3 = 0; + double max_Tsw = 0; + + if (GPUVMEnable == true && HostVMEnable == true) { + HostVMDynamicLevelsTrips = HostVMMaxNonCachedPageTableLevels; + } else { + HostVMDynamicLevelsTrips = 0; + } +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: GPUVMEnable=%d HostVMEnable=%d HostVMInefficiencyFactor=%f\n", __func__, GPUVMEnable, HostVMEnable, HostVMInefficiencyFactor); +#endif + CalculateVupdateAndDynamicMetadataParameters( + MaxInterDCNTileRepeaters, + myPipe->DPPCLK, + myPipe->DISPCLK, + myPipe->DCFCLKDeepSleep, + myPipe->PixelClock, + myPipe->HTotal, + myPipe->VBlank, + DynamicMetadataTransmittedBytes, + DynamicMetadataLinesBeforeActiveRequired, + myPipe->InterlaceEnable, + myPipe->ProgressiveToInterlaceUnitInOPP, + TSetup, + &Tdmbf, + &Tdmec, + &Tdmsks, + VUpdateOffsetPix, + VUpdateWidthPix, + VReadyOffsetPix); + + LineTime = myPipe->HTotal / myPipe->PixelClock; + trip_to_mem = UrgentLatency; + Tvm_trips = UrgentExtraLatency + trip_to_mem * (GPUVMPageTableLevels * (HostVMDynamicLevelsTrips + 1) - 1); + +#ifdef __DML_VBA_ALLOW_DELTA__ + if (DynamicMetadataVMEnabled == true && GPUVMEnable == true) { +#else + if (DynamicMetadataVMEnabled == true) { +#endif + *Tdmdl = TWait + Tvm_trips + trip_to_mem; + } else { + *Tdmdl = TWait + UrgentExtraLatency; + } + +#ifdef __DML_VBA_ALLOW_DELTA__ + if (DynamicMetadataEnable == false) { + *Tdmdl = 0.0; + } +#endif + + if (DynamicMetadataEnable == true) { + if (VStartup * LineTime < *TSetup + *Tdmdl + Tdmbf + Tdmec + Tdmsks) { + *NotEnoughTimeForDynamicMetadata = true; + dml_print("DML::%s: Not Enough Time for Dynamic Meta!\n", __func__); + dml_print("DML::%s: Tdmbf: %fus - time for dmd transfer from dchub to dio output buffer\n", __func__, Tdmbf); + dml_print("DML::%s: Tdmec: %fus - time dio takes to transfer dmd\n", __func__, Tdmec); + dml_print("DML::%s: Tdmsks: %fus - time before active dmd must complete transmission at dio\n", __func__, Tdmsks); + dml_print("DML::%s: Tdmdl: %fus - time for fabric to become ready and fetch dmd\n", __func__, *Tdmdl); + } else { + *NotEnoughTimeForDynamicMetadata = false; + } + } else { + *NotEnoughTimeForDynamicMetadata = false; + } + + *Tdmdl_vm = (DynamicMetadataEnable == true && DynamicMetadataVMEnabled == true && GPUVMEnable == true ? TWait + Tvm_trips : 0); + + if (myPipe->ScalerEnabled) + DPPCycles = DPPCLKDelaySubtotalPlusCNVCFormater + DPPCLKDelaySCL; + else + DPPCycles = DPPCLKDelaySubtotalPlusCNVCFormater + DPPCLKDelaySCLLBOnly; + + DPPCycles = DPPCycles + myPipe->NumberOfCursors * DPPCLKDelayCNVCCursor; + + DISPCLKCycles = DISPCLKDelaySubtotal; + + if (myPipe->DPPCLK == 0.0 || myPipe->DISPCLK == 0.0) + return true; + + *DSTXAfterScaler = DPPCycles * myPipe->PixelClock / myPipe->DPPCLK + DISPCLKCycles * myPipe->PixelClock / myPipe->DISPCLK + DSCDelay; + +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: DPPCycles: %d\n", __func__, DPPCycles); + dml_print("DML::%s: PixelClock: %f\n", __func__, myPipe->PixelClock); + dml_print("DML::%s: DPPCLK: %f\n", __func__, myPipe->DPPCLK); + dml_print("DML::%s: DISPCLKCycles: %d\n", __func__, DISPCLKCycles); + dml_print("DML::%s: DISPCLK: %f\n", __func__, myPipe->DISPCLK); + dml_print("DML::%s: DSCDelay: %d\n", __func__, DSCDelay); + dml_print("DML::%s: DSTXAfterScaler: %d\n", __func__, *DSTXAfterScaler); + dml_print("DML::%s: ODMCombineIsEnabled: %d\n", __func__, myPipe->ODMCombineIsEnabled); +#endif + + *DSTXAfterScaler = *DSTXAfterScaler + ((myPipe->ODMCombineIsEnabled) ? 18 : 0) + (myPipe->DPPPerPlane - 1) * DPP_RECOUT_WIDTH; + + if (OutputFormat == dm_420 || (myPipe->InterlaceEnable && myPipe->ProgressiveToInterlaceUnitInOPP)) + *DSTYAfterScaler = 1; + else + *DSTYAfterScaler = 0; + + DSTTotalPixelsAfterScaler = *DSTYAfterScaler * myPipe->HTotal + *DSTXAfterScaler; + *DSTYAfterScaler = dml_floor(DSTTotalPixelsAfterScaler / myPipe->HTotal, 1); + *DSTXAfterScaler = DSTTotalPixelsAfterScaler - ((double) (*DSTYAfterScaler * myPipe->HTotal)); + +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: DSTXAfterScaler: %d (final)\n", __func__, *DSTXAfterScaler); +#endif + + MyError = false; + + Tr0_trips = trip_to_mem * (HostVMDynamicLevelsTrips + 1); + Tvm_trips_rounded = dml_ceil(4.0 * Tvm_trips / LineTime, 1) / 4 * LineTime; + Tr0_trips_rounded = dml_ceil(4.0 * Tr0_trips / LineTime, 1) / 4 * LineTime; + +#ifdef __DML_VBA_ALLOW_DELTA__ + if (!myPipe->DCCEnable) { + Tr0_trips = 0.0; + Tr0_trips_rounded = 0.0; + } +#endif + + if (!GPUVMEnable) { + Tvm_trips = 0.0; + Tvm_trips_rounded = 0.0; + } + + if (GPUVMEnable) { + if (GPUVMPageTableLevels >= 3) { + *Tno_bw = UrgentExtraLatency + trip_to_mem * ((GPUVMPageTableLevels - 2) - 1); + } else { + *Tno_bw = 0; + } + } else if (!myPipe->DCCEnable) { + *Tno_bw = LineTime; + } else { + *Tno_bw = LineTime / 4; + } + + if (myPipe->SourcePixelFormat == dm_420_8 || myPipe->SourcePixelFormat == dm_420_10 || myPipe->SourcePixelFormat == dm_420_12) + bytes_pp = myPipe->BytePerPixelY + myPipe->BytePerPixelC / 4; + else + bytes_pp = myPipe->BytePerPixelY + myPipe->BytePerPixelC; + /*rev 99*/ + prefetch_bw_pr = dml_min(1, bytes_pp * myPipe->PixelClock / (double) myPipe->DPPPerPlane); + max_Tsw = dml_max(PrefetchSourceLinesY, PrefetchSourceLinesC) * LineTime; + prefetch_sw_bytes = PrefetchSourceLinesY * swath_width_luma_ub * myPipe->BytePerPixelY + PrefetchSourceLinesC * swath_width_chroma_ub * myPipe->BytePerPixelC; + prefetch_bw_oto = dml_max(bytes_pp * myPipe->PixelClock / myPipe->DPPPerPlane, prefetch_sw_bytes / (dml_max(PrefetchSourceLinesY, PrefetchSourceLinesC) * LineTime)); + prefetch_bw_oto = dml_max(prefetch_bw_pr, prefetch_sw_bytes / max_Tsw); + + min_Lsw = dml_max(1, dml_max(PrefetchSourceLinesY, PrefetchSourceLinesC) / max_vratio_pre); + Lsw_oto = dml_ceil(4 * dml_max(prefetch_sw_bytes / prefetch_bw_oto / LineTime, min_Lsw), 1) / 4; + Tsw_oto = Lsw_oto * LineTime; + + prefetch_bw_oto = (PrefetchSourceLinesY * swath_width_luma_ub * myPipe->BytePerPixelY + PrefetchSourceLinesC * swath_width_chroma_ub * myPipe->BytePerPixelC) / Tsw_oto; + +#ifdef __DML_VBA_DEBUG__ + dml_print("DML: HTotal: %d\n", myPipe->HTotal); + dml_print("DML: prefetch_bw_oto: %f\n", prefetch_bw_oto); + dml_print("DML: PrefetchSourceLinesY: %f\n", PrefetchSourceLinesY); + dml_print("DML: swath_width_luma_ub: %d\n", swath_width_luma_ub); + dml_print("DML: BytePerPixelY: %d\n", myPipe->BytePerPixelY); + dml_print("DML: Tsw_oto: %f\n", Tsw_oto); +#endif + + if (GPUVMEnable == true) + Tvm_oto = dml_max3(*Tno_bw + PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor / prefetch_bw_oto, Tvm_trips, LineTime / 4.0); + else + Tvm_oto = LineTime / 4.0; + + if ((GPUVMEnable == true || myPipe->DCCEnable == true)) { + Tr0_oto = dml_max4((MetaRowByte + PixelPTEBytesPerRow * HostVMInefficiencyFactor) / prefetch_bw_oto, Tr0_trips, // PREVIOUS_ERROR (missing this term) + LineTime - Tvm_oto, + LineTime / 4); + } else { + Tr0_oto = (LineTime - Tvm_oto) / 2.0; + } + +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: Tvm_trips = %f\n", __func__, Tvm_trips); + dml_print("DML::%s: Tr0_trips = %f\n", __func__, Tr0_trips); + dml_print("DML::%s: PDEAndMetaPTEBytesFrame = %d\n", __func__, MetaRowByte); + dml_print("DML::%s: MetaRowByte = %d\n", __func__, MetaRowByte); + dml_print("DML::%s: PixelPTEBytesPerRow = %d\n", __func__, PixelPTEBytesPerRow); + dml_print("DML::%s: HostVMInefficiencyFactor = %f\n", __func__, HostVMInefficiencyFactor); + dml_print("DML::%s: prefetch_bw_oto = %f\n", __func__, prefetch_bw_oto); + dml_print("DML::%s: Tr0_oto = %f\n", __func__, Tr0_oto); + dml_print("DML::%s: Tvm_oto = %f\n", __func__, Tvm_oto); +#endif + + Tvm_oto_lines = dml_ceil(4.0 * Tvm_oto / LineTime, 1) / 4.0; + Tr0_oto_lines = dml_ceil(4.0 * Tr0_oto / LineTime, 1) / 4.0; + dst_y_prefetch_oto = Tvm_oto_lines + 2 * Tr0_oto_lines + Lsw_oto; + dst_y_prefetch_equ = VStartup - (*TSetup + dml_max(TWait + TCalc, *Tdmdl)) / LineTime - (*DSTYAfterScaler + *DSTXAfterScaler / myPipe->HTotal); + dst_y_prefetch_equ = dml_floor(4.0 * (dst_y_prefetch_equ + 0.125), 1) / 4.0; + Tpre_rounded = dst_y_prefetch_equ * LineTime; + + dep_bytes = dml_max(PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor, MetaRowByte + PixelPTEBytesPerRow * HostVMInefficiencyFactor); + + if (prefetch_sw_bytes < dep_bytes) + prefetch_sw_bytes = 2 * dep_bytes; + + dml_print("DML: dst_y_prefetch_oto: %f\n", dst_y_prefetch_oto); + dml_print("DML: Tvm_oto_lines: %f\n", Tvm_oto_lines); + dml_print("DML: Tr0_oto_lines: %f\n", Tr0_oto_lines); + dml_print("DML: Lsw_oto: %f\n", Lsw_oto); + dml_print("DML: LineTime: %f\n", LineTime); + dml_print("DML: dst_y_prefetch_equ: %f (after round)\n", dst_y_prefetch_equ); + + dml_print("DML: LineTime: %f\n", LineTime); + dml_print("DML: VStartup: %d\n", VStartup); + dml_print("DML: Tvstartup: %fus - time between vstartup and first pixel of active\n", VStartup * LineTime); + dml_print("DML: TSetup: %fus - time from vstartup to vready\n", *TSetup); + dml_print("DML: TCalc: %fus - time for calculations in dchub starting at vready\n", TCalc); + dml_print("DML: TWait: %fus - time for fabric to become ready max(pstate exit,cstate enter/exit, urgent latency) after TCalc\n", TWait); + dml_print("DML: Tdmbf: %fus - time for dmd transfer from dchub to dio output buffer\n", Tdmbf); + dml_print("DML: Tdmec: %fus - time dio takes to transfer dmd\n", Tdmec); + dml_print("DML: Tdmsks: %fus - time before active dmd must complete transmission at dio\n", Tdmsks); + dml_print("DML: Tdmdl_vm: %fus - time for vm stages of dmd\n", *Tdmdl_vm); + dml_print("DML: Tdmdl: %fus - time for fabric to become ready and fetch dmd\n", *Tdmdl); + dml_print("DML: DSTXAfterScaler: %f pixels - number of pixel clocks pipeline and buffer delay after scaler\n", *DSTXAfterScaler); + dml_print("DML: DSTYAfterScaler: %f lines - number of lines of pipeline and buffer delay after scaler\n", *DSTYAfterScaler); + + *PrefetchBandwidth = 0; + *DestinationLinesToRequestVMInVBlank = 0; + *DestinationLinesToRequestRowInVBlank = 0; + *VRatioPrefetchY = 0; + *VRatioPrefetchC = 0; + *RequiredPrefetchPixDataBWLuma = 0; + if (dst_y_prefetch_equ > 1) { + double PrefetchBandwidth1; + double PrefetchBandwidth2; + double PrefetchBandwidth3; + double PrefetchBandwidth4; + + if (Tpre_rounded - *Tno_bw > 0) { + PrefetchBandwidth1 = (PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor + 2 * MetaRowByte + 2 * PixelPTEBytesPerRow * HostVMInefficiencyFactor + + prefetch_sw_bytes) / (Tpre_rounded - *Tno_bw); + Tsw_est1 = prefetch_sw_bytes / PrefetchBandwidth1; + } else { + PrefetchBandwidth1 = 0; + } + + if (VStartup == MaxVStartup && Tsw_est1 / LineTime < min_Lsw && Tpre_rounded - min_Lsw * LineTime - 0.75 * LineTime - *Tno_bw > 0) { + PrefetchBandwidth1 = (PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor + 2 * MetaRowByte + 2 * PixelPTEBytesPerRow * HostVMInefficiencyFactor) + / (Tpre_rounded - min_Lsw * LineTime - 0.75 * LineTime - *Tno_bw); + } + + if (Tpre_rounded - *Tno_bw - 2 * Tr0_trips_rounded > 0) + PrefetchBandwidth2 = (PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor + prefetch_sw_bytes) / (Tpre_rounded - *Tno_bw - 2 * Tr0_trips_rounded); + else + PrefetchBandwidth2 = 0; + + if (Tpre_rounded - Tvm_trips_rounded > 0) { + PrefetchBandwidth3 = (2 * MetaRowByte + 2 * PixelPTEBytesPerRow * HostVMInefficiencyFactor + + prefetch_sw_bytes) / (Tpre_rounded - Tvm_trips_rounded); + Tsw_est3 = prefetch_sw_bytes / PrefetchBandwidth3; + } else { + PrefetchBandwidth3 = 0; + } + +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: Tpre_rounded: %f\n", __func__, Tpre_rounded); + dml_print("DML::%s: Tvm_trips_rounded: %f\n", __func__, Tvm_trips_rounded); + dml_print("DML::%s: PrefetchBandwidth3: %f\n", __func__, PrefetchBandwidth3); +#endif + if (VStartup == MaxVStartup && Tsw_est3 / LineTime < min_Lsw && Tpre_rounded - min_Lsw * LineTime - 0.75 * LineTime - Tvm_trips_rounded > 0) { + PrefetchBandwidth3 = (2 * MetaRowByte + 2 * PixelPTEBytesPerRow * HostVMInefficiencyFactor) + / (Tpre_rounded - min_Lsw * LineTime - 0.75 * LineTime - Tvm_trips_rounded); + } + + if (Tpre_rounded - Tvm_trips_rounded - 2 * Tr0_trips_rounded > 0) + PrefetchBandwidth4 = prefetch_sw_bytes / (Tpre_rounded - Tvm_trips_rounded - 2 * Tr0_trips_rounded); + else + PrefetchBandwidth4 = 0; + + { + bool Case1OK; + bool Case2OK; + bool Case3OK; + + if (PrefetchBandwidth1 > 0) { + if (*Tno_bw + PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor / PrefetchBandwidth1 >= Tvm_trips_rounded + && (MetaRowByte + PixelPTEBytesPerRow * HostVMInefficiencyFactor) / PrefetchBandwidth1 >= Tr0_trips_rounded) { + Case1OK = true; + } else { + Case1OK = false; + } + } else { + Case1OK = false; + } + + if (PrefetchBandwidth2 > 0) { + if (*Tno_bw + PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor / PrefetchBandwidth2 >= Tvm_trips_rounded + && (MetaRowByte + PixelPTEBytesPerRow * HostVMInefficiencyFactor) / PrefetchBandwidth2 < Tr0_trips_rounded) { + Case2OK = true; + } else { + Case2OK = false; + } + } else { + Case2OK = false; + } + + if (PrefetchBandwidth3 > 0) { + if (*Tno_bw + PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor / PrefetchBandwidth3 < Tvm_trips_rounded + && (MetaRowByte + PixelPTEBytesPerRow * HostVMInefficiencyFactor) / PrefetchBandwidth3 >= Tr0_trips_rounded) { + Case3OK = true; + } else { + Case3OK = false; + } + } else { + Case3OK = false; + } + + if (Case1OK) { + prefetch_bw_equ = PrefetchBandwidth1; + } else if (Case2OK) { + prefetch_bw_equ = PrefetchBandwidth2; + } else if (Case3OK) { + prefetch_bw_equ = PrefetchBandwidth3; + } else { + prefetch_bw_equ = PrefetchBandwidth4; + } + +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: Case1OK: %d\n", __func__, Case1OK); + dml_print("DML::%s: Case2OK: %d\n", __func__, Case2OK); + dml_print("DML::%s: Case3OK: %d\n", __func__, Case3OK); + dml_print("DML::%s: prefetch_bw_equ: %f\n", __func__, prefetch_bw_equ); +#endif + + if (prefetch_bw_equ > 0) { + if (GPUVMEnable == true) { + Tvm_equ = dml_max3(*Tno_bw + PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor / prefetch_bw_equ, Tvm_trips, LineTime / 4); + } else { + Tvm_equ = LineTime / 4; + } + + if ((GPUVMEnable == true || myPipe->DCCEnable == true)) { + Tr0_equ = dml_max4( + (MetaRowByte + PixelPTEBytesPerRow * HostVMInefficiencyFactor) / prefetch_bw_equ, + Tr0_trips, + (LineTime - Tvm_equ) / 2, + LineTime / 4); + } else { + Tr0_equ = (LineTime - Tvm_equ) / 2; + } + } else { + Tvm_equ = 0; + Tr0_equ = 0; + dml_print("DML: prefetch_bw_equ equals 0! %s:%d\n", __FILE__, __LINE__); + } + } + + if (dst_y_prefetch_oto < dst_y_prefetch_equ) { + *DestinationLinesForPrefetch = dst_y_prefetch_oto; + TimeForFetchingMetaPTE = Tvm_oto; + TimeForFetchingRowInVBlank = Tr0_oto; + *PrefetchBandwidth = prefetch_bw_oto; + } else { + *DestinationLinesForPrefetch = dst_y_prefetch_equ; + TimeForFetchingMetaPTE = Tvm_equ; + TimeForFetchingRowInVBlank = Tr0_equ; + *PrefetchBandwidth = prefetch_bw_equ; + } + + *DestinationLinesToRequestVMInVBlank = dml_ceil(4.0 * TimeForFetchingMetaPTE / LineTime, 1.0) / 4.0; + + *DestinationLinesToRequestRowInVBlank = dml_ceil(4.0 * TimeForFetchingRowInVBlank / LineTime, 1.0) / 4.0; + +#ifdef __DML_VBA_ALLOW_DELTA__ + LinesToRequestPrefetchPixelData = *DestinationLinesForPrefetch + // See note above dated 5/30/2018 + // - ((NumberOfCursors > 0 || GPUVMEnable || DCCEnable) ? + - ((GPUVMEnable || myPipe->DCCEnable) ? (*DestinationLinesToRequestVMInVBlank + 2 * *DestinationLinesToRequestRowInVBlank) : 0.0); // TODO: Did someone else add this?? +#else + LinesToRequestPrefetchPixelData = *DestinationLinesForPrefetch - *DestinationLinesToRequestVMInVBlank - 2 * *DestinationLinesToRequestRowInVBlank; +#endif + +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: DestinationLinesForPrefetch = %f\n", __func__, *DestinationLinesForPrefetch); + dml_print("DML::%s: DestinationLinesToRequestVMInVBlank = %f\n", __func__, *DestinationLinesToRequestVMInVBlank); + dml_print("DML::%s: TimeForFetchingRowInVBlank = %f\n", __func__, TimeForFetchingRowInVBlank); + dml_print("DML::%s: LineTime = %f\n", __func__, LineTime); + dml_print("DML::%s: DestinationLinesToRequestRowInVBlank = %f\n", __func__, *DestinationLinesToRequestRowInVBlank); + dml_print("DML::%s: PrefetchSourceLinesY = %f\n", __func__, PrefetchSourceLinesY); + dml_print("DML::%s: LinesToRequestPrefetchPixelData = %f\n", __func__, LinesToRequestPrefetchPixelData); +#endif + + if (LinesToRequestPrefetchPixelData > 0 && prefetch_bw_equ > 0) { + + *VRatioPrefetchY = (double) PrefetchSourceLinesY / LinesToRequestPrefetchPixelData; + *VRatioPrefetchY = dml_max(*VRatioPrefetchY, 1.0); +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: VRatioPrefetchY = %f\n", __func__, *VRatioPrefetchY); + dml_print("DML::%s: SwathHeightY = %d\n", __func__, SwathHeightY); + dml_print("DML::%s: VInitPreFillY = %f\n", __func__, VInitPreFillY); +#endif + if ((SwathHeightY > 4) && (VInitPreFillY > 3)) { + if (LinesToRequestPrefetchPixelData > (VInitPreFillY - 3.0) / 2.0) { + *VRatioPrefetchY = dml_max( + (double) PrefetchSourceLinesY / LinesToRequestPrefetchPixelData, + (double) MaxNumSwathY * SwathHeightY / (LinesToRequestPrefetchPixelData - (VInitPreFillY - 3.0) / 2.0)); + *VRatioPrefetchY = dml_max(*VRatioPrefetchY, 1.0); + } else { + MyError = true; + dml_print("DML: MyErr set %s:%d\n", __FILE__, __LINE__); + *VRatioPrefetchY = 0; + } +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: VRatioPrefetchY = %f\n", __func__, *VRatioPrefetchY); + dml_print("DML::%s: PrefetchSourceLinesY = %f\n", __func__, PrefetchSourceLinesY); + dml_print("DML::%s: MaxNumSwathY = %d\n", __func__, MaxNumSwathY); +#endif + } + + *VRatioPrefetchC = (double) PrefetchSourceLinesC / LinesToRequestPrefetchPixelData; + *VRatioPrefetchC = dml_max(*VRatioPrefetchC, 1.0); + +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: VRatioPrefetchC = %f\n", __func__, *VRatioPrefetchC); + dml_print("DML::%s: SwathHeightC = %d\n", __func__, SwathHeightC); + dml_print("DML::%s: VInitPreFillC = %f\n", __func__, VInitPreFillC); +#endif + if ((SwathHeightC > 4) || VInitPreFillC > 3) { + if (LinesToRequestPrefetchPixelData > (VInitPreFillC - 3.0) / 2.0) { + *VRatioPrefetchC = dml_max( + *VRatioPrefetchC, + (double) MaxNumSwathC * SwathHeightC / (LinesToRequestPrefetchPixelData - (VInitPreFillC - 3.0) / 2.0)); + *VRatioPrefetchC = dml_max(*VRatioPrefetchC, 1.0); + } else { + MyError = true; + dml_print("DML: MyErr set %s:%d\n", __FILE__, __LINE__); + *VRatioPrefetchC = 0; + } +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: VRatioPrefetchC = %f\n", __func__, *VRatioPrefetchC); + dml_print("DML::%s: PrefetchSourceLinesC = %f\n", __func__, PrefetchSourceLinesC); + dml_print("DML::%s: MaxNumSwathC = %d\n", __func__, MaxNumSwathC); +#endif + } + +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: BytePerPixelY = %d\n", __func__, myPipe->BytePerPixelY); + dml_print("DML::%s: swath_width_luma_ub = %d\n", __func__, swath_width_luma_ub); + dml_print("DML::%s: LineTime = %f\n", __func__, LineTime); +#endif + + *RequiredPrefetchPixDataBWLuma = (double) PrefetchSourceLinesY / LinesToRequestPrefetchPixelData * myPipe->BytePerPixelY * swath_width_luma_ub / LineTime; + +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: RequiredPrefetchPixDataBWLuma = %f\n", __func__, *RequiredPrefetchPixDataBWLuma); +#endif + + *RequiredPrefetchPixDataBWChroma = (double) PrefetchSourceLinesC / LinesToRequestPrefetchPixelData * myPipe->BytePerPixelC * swath_width_chroma_ub + / LineTime; + } else { + MyError = true; + dml_print("DML: MyErr set %s:%d\n", __FILE__, __LINE__); + dml_print("DML: LinesToRequestPrefetchPixelData: %f, should be > 0\n", LinesToRequestPrefetchPixelData); + *VRatioPrefetchY = 0; + *VRatioPrefetchC = 0; + *RequiredPrefetchPixDataBWLuma = 0; + *RequiredPrefetchPixDataBWChroma = 0; + } + + dml_print( + "DML: Tpre: %fus - sum of time to request meta pte, 2 x data pte + meta data, swaths\n", + (double) LinesToRequestPrefetchPixelData * LineTime + 2.0 * TimeForFetchingRowInVBlank + TimeForFetchingMetaPTE); + dml_print("DML: Tvm: %fus - time to fetch page tables for meta surface\n", TimeForFetchingMetaPTE); + dml_print("DML: Tr0: %fus - time to fetch first row of data pagetables and first row of meta data (done in parallel)\n", TimeForFetchingRowInVBlank); + dml_print( + "DML: Tsw: %fus = time to fetch enough pixel data and cursor data to feed the scalers init position and detile\n", + (double) LinesToRequestPrefetchPixelData * LineTime); + dml_print("DML: To: %fus - time for propagation from scaler to optc\n", (*DSTYAfterScaler + ((double) (*DSTXAfterScaler) / (double) myPipe->HTotal)) * LineTime); + dml_print("DML: Tvstartup - TSetup - Tcalc - Twait - Tpre - To > 0\n"); + dml_print( + "DML: Tslack(pre): %fus - time left over in schedule\n", + VStartup * LineTime - TimeForFetchingMetaPTE - 2 * TimeForFetchingRowInVBlank + - (*DSTYAfterScaler + ((double) (*DSTXAfterScaler) / (double) myPipe->HTotal)) * LineTime - TWait - TCalc - *TSetup); + dml_print("DML: row_bytes = dpte_row_bytes (per_pipe) = PixelPTEBytesPerRow = : %d\n", PixelPTEBytesPerRow); + + } else { + MyError = true; + dml_print("DML: MyErr set %s:%d\n", __FILE__, __LINE__); + } + + { + double prefetch_vm_bw; + double prefetch_row_bw; + + if (PDEAndMetaPTEBytesFrame == 0) { + prefetch_vm_bw = 0; + } else if (*DestinationLinesToRequestVMInVBlank > 0) { +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: PDEAndMetaPTEBytesFrame = %d\n", __func__, PDEAndMetaPTEBytesFrame); + dml_print("DML::%s: HostVMInefficiencyFactor = %f\n", __func__, HostVMInefficiencyFactor); + dml_print("DML::%s: DestinationLinesToRequestVMInVBlank = %f\n", __func__, *DestinationLinesToRequestVMInVBlank); + dml_print("DML::%s: LineTime = %f\n", __func__, LineTime); +#endif + prefetch_vm_bw = PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor / (*DestinationLinesToRequestVMInVBlank * LineTime); +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: prefetch_vm_bw = %f\n", __func__, prefetch_vm_bw); +#endif + } else { + prefetch_vm_bw = 0; + MyError = true; + dml_print("DML: MyErr set %s:%d\n", __FILE__, __LINE__); + } + + if (MetaRowByte + PixelPTEBytesPerRow == 0) { + prefetch_row_bw = 0; + } else if (*DestinationLinesToRequestRowInVBlank > 0) { + prefetch_row_bw = (MetaRowByte + PixelPTEBytesPerRow * HostVMInefficiencyFactor) / (*DestinationLinesToRequestRowInVBlank * LineTime); + +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: MetaRowByte = %d\n", __func__, MetaRowByte); + dml_print("DML::%s: PixelPTEBytesPerRow = %d\n", __func__, PixelPTEBytesPerRow); + dml_print("DML::%s: DestinationLinesToRequestRowInVBlank = %f\n", __func__, *DestinationLinesToRequestRowInVBlank); + dml_print("DML::%s: prefetch_row_bw = %f\n", __func__, prefetch_row_bw); +#endif + } else { + prefetch_row_bw = 0; + MyError = true; + dml_print("DML: MyErr set %s:%d\n", __FILE__, __LINE__); + } + + *prefetch_vmrow_bw = dml_max(prefetch_vm_bw, prefetch_row_bw); + } + + if (MyError) { + *PrefetchBandwidth = 0; + TimeForFetchingMetaPTE = 0; + TimeForFetchingRowInVBlank = 0; + *DestinationLinesToRequestVMInVBlank = 0; + *DestinationLinesToRequestRowInVBlank = 0; + *DestinationLinesForPrefetch = 0; + LinesToRequestPrefetchPixelData = 0; + *VRatioPrefetchY = 0; + *VRatioPrefetchC = 0; + *RequiredPrefetchPixDataBWLuma = 0; + *RequiredPrefetchPixDataBWChroma = 0; + } + + return MyError; +} + +static double RoundToDFSGranularityUp(double Clock, double VCOSpeed) +{ + return VCOSpeed * 4 / dml_floor(VCOSpeed * 4 / Clock, 1); +} + +static double RoundToDFSGranularityDown(double Clock, double VCOSpeed) +{ + return VCOSpeed * 4 / dml_ceil(VCOSpeed * 4.0 / Clock, 1); +} + +static void CalculateDCCConfiguration( + bool DCCEnabled, + bool DCCProgrammingAssumesScanDirectionUnknown, + enum source_format_class SourcePixelFormat, + unsigned int SurfaceWidthLuma, + unsigned int SurfaceWidthChroma, + unsigned int SurfaceHeightLuma, + unsigned int SurfaceHeightChroma, + double DETBufferSize, + unsigned int RequestHeight256ByteLuma, + unsigned int RequestHeight256ByteChroma, + enum dm_swizzle_mode TilingFormat, + unsigned int BytePerPixelY, + unsigned int BytePerPixelC, + double BytePerPixelDETY, + double BytePerPixelDETC, + enum scan_direction_class ScanOrientation, + unsigned int *MaxUncompressedBlockLuma, + unsigned int *MaxUncompressedBlockChroma, + unsigned int *MaxCompressedBlockLuma, + unsigned int *MaxCompressedBlockChroma, + unsigned int *IndependentBlockLuma, + unsigned int *IndependentBlockChroma) +{ + int yuv420; + int horz_div_l; + int horz_div_c; + int vert_div_l; + int vert_div_c; + + int swath_buf_size; + double detile_buf_vp_horz_limit; + double detile_buf_vp_vert_limit; + + int MAS_vp_horz_limit; + int MAS_vp_vert_limit; + int max_vp_horz_width; + int max_vp_vert_height; + int eff_surf_width_l; + int eff_surf_width_c; + int eff_surf_height_l; + int eff_surf_height_c; + + int full_swath_bytes_horz_wc_l; + int full_swath_bytes_horz_wc_c; + int full_swath_bytes_vert_wc_l; + int full_swath_bytes_vert_wc_c; + int req128_horz_wc_l; + int req128_horz_wc_c; + int req128_vert_wc_l; + int req128_vert_wc_c; + int segment_order_horz_contiguous_luma; + int segment_order_horz_contiguous_chroma; + int segment_order_vert_contiguous_luma; + int segment_order_vert_contiguous_chroma; + + enum { + REQ_256Bytes, REQ_128BytesNonContiguous, REQ_128BytesContiguous, REQ_NA + } RequestType; + RequestType RequestLuma; + RequestType RequestChroma; + + yuv420 = ((SourcePixelFormat == dm_420_8 || SourcePixelFormat == dm_420_10 || SourcePixelFormat == dm_420_12) ? 1 : 0); + horz_div_l = 1; + horz_div_c = 1; + vert_div_l = 1; + vert_div_c = 1; + + if (BytePerPixelY == 1) + vert_div_l = 0; + if (BytePerPixelC == 1) + vert_div_c = 0; + if (BytePerPixelY == 8 && (TilingFormat == dm_sw_64kb_s || TilingFormat == dm_sw_64kb_s_t || TilingFormat == dm_sw_64kb_s_x)) + horz_div_l = 0; + if (BytePerPixelC == 8 && (TilingFormat == dm_sw_64kb_s || TilingFormat == dm_sw_64kb_s_t || TilingFormat == dm_sw_64kb_s_x)) + horz_div_c = 0; + + if (BytePerPixelC == 0) { + swath_buf_size = DETBufferSize / 2 - 2 * 256; + detile_buf_vp_horz_limit = (double) swath_buf_size / ((double) RequestHeight256ByteLuma * BytePerPixelY / (1 + horz_div_l)); + detile_buf_vp_vert_limit = (double) swath_buf_size / (256.0 / RequestHeight256ByteLuma / (1 + vert_div_l)); + } else { + swath_buf_size = DETBufferSize / 2 - 2 * 2 * 256; + detile_buf_vp_horz_limit = (double) swath_buf_size + / ((double) RequestHeight256ByteLuma * BytePerPixelY / (1 + horz_div_l) + + (double) RequestHeight256ByteChroma * BytePerPixelC / (1 + horz_div_c) / (1 + yuv420)); + detile_buf_vp_vert_limit = (double) swath_buf_size + / (256.0 / RequestHeight256ByteLuma / (1 + vert_div_l) + 256.0 / RequestHeight256ByteChroma / (1 + vert_div_c) / (1 + yuv420)); + } + + if (SourcePixelFormat == dm_420_10) { + detile_buf_vp_horz_limit = 1.5 * detile_buf_vp_horz_limit; + detile_buf_vp_vert_limit = 1.5 * detile_buf_vp_vert_limit; + } + + detile_buf_vp_horz_limit = dml_floor(detile_buf_vp_horz_limit - 1, 16); + detile_buf_vp_vert_limit = dml_floor(detile_buf_vp_vert_limit - 1, 16); + + MAS_vp_horz_limit = SourcePixelFormat == dm_rgbe_alpha ? 3840 : 5760; + MAS_vp_vert_limit = (BytePerPixelC > 0 ? 2880 : 5760); + max_vp_horz_width = dml_min((double) MAS_vp_horz_limit, detile_buf_vp_horz_limit); + max_vp_vert_height = dml_min((double) MAS_vp_vert_limit, detile_buf_vp_vert_limit); + eff_surf_width_l = (SurfaceWidthLuma > max_vp_horz_width ? max_vp_horz_width : SurfaceWidthLuma); + eff_surf_width_c = eff_surf_width_l / (1 + yuv420); + eff_surf_height_l = (SurfaceHeightLuma > max_vp_vert_height ? max_vp_vert_height : SurfaceHeightLuma); + eff_surf_height_c = eff_surf_height_l / (1 + yuv420); + + full_swath_bytes_horz_wc_l = eff_surf_width_l * RequestHeight256ByteLuma * BytePerPixelY; + full_swath_bytes_vert_wc_l = eff_surf_height_l * 256 / RequestHeight256ByteLuma; + if (BytePerPixelC > 0) { + full_swath_bytes_horz_wc_c = eff_surf_width_c * RequestHeight256ByteChroma * BytePerPixelC; + full_swath_bytes_vert_wc_c = eff_surf_height_c * 256 / RequestHeight256ByteChroma; + } else { + full_swath_bytes_horz_wc_c = 0; + full_swath_bytes_vert_wc_c = 0; + } + + if (SourcePixelFormat == dm_420_10) { + full_swath_bytes_horz_wc_l = dml_ceil(full_swath_bytes_horz_wc_l * 2 / 3, 256); + full_swath_bytes_horz_wc_c = dml_ceil(full_swath_bytes_horz_wc_c * 2 / 3, 256); + full_swath_bytes_vert_wc_l = dml_ceil(full_swath_bytes_vert_wc_l * 2 / 3, 256); + full_swath_bytes_vert_wc_c = dml_ceil(full_swath_bytes_vert_wc_c * 2 / 3, 256); + } + + if (2 * full_swath_bytes_horz_wc_l + 2 * full_swath_bytes_horz_wc_c <= DETBufferSize) { + req128_horz_wc_l = 0; + req128_horz_wc_c = 0; + } else if (full_swath_bytes_horz_wc_l < 1.5 * full_swath_bytes_horz_wc_c && 2 * full_swath_bytes_horz_wc_l + full_swath_bytes_horz_wc_c <= DETBufferSize) { + req128_horz_wc_l = 0; + req128_horz_wc_c = 1; + } else if (full_swath_bytes_horz_wc_l >= 1.5 * full_swath_bytes_horz_wc_c && full_swath_bytes_horz_wc_l + 2 * full_swath_bytes_horz_wc_c <= DETBufferSize) { + req128_horz_wc_l = 1; + req128_horz_wc_c = 0; + } else { + req128_horz_wc_l = 1; + req128_horz_wc_c = 1; + } + + if (2 * full_swath_bytes_vert_wc_l + 2 * full_swath_bytes_vert_wc_c <= DETBufferSize) { + req128_vert_wc_l = 0; + req128_vert_wc_c = 0; + } else if (full_swath_bytes_vert_wc_l < 1.5 * full_swath_bytes_vert_wc_c && 2 * full_swath_bytes_vert_wc_l + full_swath_bytes_vert_wc_c <= DETBufferSize) { + req128_vert_wc_l = 0; + req128_vert_wc_c = 1; + } else if (full_swath_bytes_vert_wc_l >= 1.5 * full_swath_bytes_vert_wc_c && full_swath_bytes_vert_wc_l + 2 * full_swath_bytes_vert_wc_c <= DETBufferSize) { + req128_vert_wc_l = 1; + req128_vert_wc_c = 0; + } else { + req128_vert_wc_l = 1; + req128_vert_wc_c = 1; + } + + if (BytePerPixelY == 2 || (BytePerPixelY == 4 && TilingFormat != dm_sw_64kb_r_x)) { + segment_order_horz_contiguous_luma = 0; + } else { + segment_order_horz_contiguous_luma = 1; + } + if ((BytePerPixelY == 8 && (TilingFormat == dm_sw_64kb_d || TilingFormat == dm_sw_64kb_d_x || TilingFormat == dm_sw_64kb_d_t || TilingFormat == dm_sw_64kb_r_x)) + || (BytePerPixelY == 4 && TilingFormat == dm_sw_64kb_r_x)) { + segment_order_vert_contiguous_luma = 0; + } else { + segment_order_vert_contiguous_luma = 1; + } + if (BytePerPixelC == 2 || (BytePerPixelC == 4 && TilingFormat != dm_sw_64kb_r_x)) { + segment_order_horz_contiguous_chroma = 0; + } else { + segment_order_horz_contiguous_chroma = 1; + } + if ((BytePerPixelC == 8 && (TilingFormat == dm_sw_64kb_d || TilingFormat == dm_sw_64kb_d_x || TilingFormat == dm_sw_64kb_d_t || TilingFormat == dm_sw_64kb_r_x)) + || (BytePerPixelC == 4 && TilingFormat == dm_sw_64kb_r_x)) { + segment_order_vert_contiguous_chroma = 0; + } else { + segment_order_vert_contiguous_chroma = 1; + } + + if (DCCProgrammingAssumesScanDirectionUnknown == true) { + if (req128_horz_wc_l == 0 && req128_vert_wc_l == 0) { + RequestLuma = REQ_256Bytes; + } else if ((req128_horz_wc_l == 1 && segment_order_horz_contiguous_luma == 0) || (req128_vert_wc_l == 1 && segment_order_vert_contiguous_luma == 0)) { + RequestLuma = REQ_128BytesNonContiguous; + } else { + RequestLuma = REQ_128BytesContiguous; + } + if (req128_horz_wc_c == 0 && req128_vert_wc_c == 0) { + RequestChroma = REQ_256Bytes; + } else if ((req128_horz_wc_c == 1 && segment_order_horz_contiguous_chroma == 0) || (req128_vert_wc_c == 1 && segment_order_vert_contiguous_chroma == 0)) { + RequestChroma = REQ_128BytesNonContiguous; + } else { + RequestChroma = REQ_128BytesContiguous; + } + } else if (ScanOrientation != dm_vert) { + if (req128_horz_wc_l == 0) { + RequestLuma = REQ_256Bytes; + } else if (segment_order_horz_contiguous_luma == 0) { + RequestLuma = REQ_128BytesNonContiguous; + } else { + RequestLuma = REQ_128BytesContiguous; + } + if (req128_horz_wc_c == 0) { + RequestChroma = REQ_256Bytes; + } else if (segment_order_horz_contiguous_chroma == 0) { + RequestChroma = REQ_128BytesNonContiguous; + } else { + RequestChroma = REQ_128BytesContiguous; + } + } else { + if (req128_vert_wc_l == 0) { + RequestLuma = REQ_256Bytes; + } else if (segment_order_vert_contiguous_luma == 0) { + RequestLuma = REQ_128BytesNonContiguous; + } else { + RequestLuma = REQ_128BytesContiguous; + } + if (req128_vert_wc_c == 0) { + RequestChroma = REQ_256Bytes; + } else if (segment_order_vert_contiguous_chroma == 0) { + RequestChroma = REQ_128BytesNonContiguous; + } else { + RequestChroma = REQ_128BytesContiguous; + } + } + + if (RequestLuma == REQ_256Bytes) { + *MaxUncompressedBlockLuma = 256; + *MaxCompressedBlockLuma = 256; + *IndependentBlockLuma = 0; + } else if (RequestLuma == REQ_128BytesContiguous) { + *MaxUncompressedBlockLuma = 256; + *MaxCompressedBlockLuma = 128; + *IndependentBlockLuma = 128; + } else { + *MaxUncompressedBlockLuma = 256; + *MaxCompressedBlockLuma = 64; + *IndependentBlockLuma = 64; + } + + if (RequestChroma == REQ_256Bytes) { + *MaxUncompressedBlockChroma = 256; + *MaxCompressedBlockChroma = 256; + *IndependentBlockChroma = 0; + } else if (RequestChroma == REQ_128BytesContiguous) { + *MaxUncompressedBlockChroma = 256; + *MaxCompressedBlockChroma = 128; + *IndependentBlockChroma = 128; + } else { + *MaxUncompressedBlockChroma = 256; + *MaxCompressedBlockChroma = 64; + *IndependentBlockChroma = 64; + } + + if (DCCEnabled != true || BytePerPixelC == 0) { + *MaxUncompressedBlockChroma = 0; + *MaxCompressedBlockChroma = 0; + *IndependentBlockChroma = 0; + } + + if (DCCEnabled != true) { + *MaxUncompressedBlockLuma = 0; + *MaxCompressedBlockLuma = 0; + *IndependentBlockLuma = 0; + } +} + +static double CalculatePrefetchSourceLines( + struct display_mode_lib *mode_lib, + double VRatio, + double vtaps, + bool Interlace, + bool ProgressiveToInterlaceUnitInOPP, + unsigned int SwathHeight, + unsigned int ViewportYStart, + double *VInitPreFill, + unsigned int *MaxNumSwath) +{ + struct vba_vars_st *v = &mode_lib->vba; + unsigned int MaxPartialSwath; + + if (ProgressiveToInterlaceUnitInOPP) + *VInitPreFill = dml_floor((VRatio + vtaps + 1) / 2.0, 1); + else + *VInitPreFill = dml_floor((VRatio + vtaps + 1 + Interlace * 0.5 * VRatio) / 2.0, 1); + + if (!v->IgnoreViewportPositioning) { + + *MaxNumSwath = dml_ceil((*VInitPreFill - 1.0) / SwathHeight, 1) + 1.0; + + if (*VInitPreFill > 1.0) + MaxPartialSwath = (unsigned int) (*VInitPreFill - 2) % SwathHeight; + else + MaxPartialSwath = (unsigned int) (*VInitPreFill + SwathHeight - 2) % SwathHeight; + MaxPartialSwath = dml_max(1U, MaxPartialSwath); + + } else { + + if (ViewportYStart != 0) + dml_print("WARNING DML: using viewport y position of 0 even though actual viewport y position is non-zero in prefetch source lines calculation\n"); + + *MaxNumSwath = dml_ceil(*VInitPreFill / SwathHeight, 1); + + if (*VInitPreFill > 1.0) + MaxPartialSwath = (unsigned int) (*VInitPreFill - 1) % SwathHeight; + else + MaxPartialSwath = (unsigned int) (*VInitPreFill + SwathHeight - 1) % SwathHeight; + } + +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: VRatio = %f\n", __func__, VRatio); + dml_print("DML::%s: vtaps = %f\n", __func__, vtaps); + dml_print("DML::%s: VInitPreFill = %f\n", __func__, *VInitPreFill); + dml_print("DML::%s: ProgressiveToInterlaceUnitInOPP = %d\n", __func__, ProgressiveToInterlaceUnitInOPP); + dml_print("DML::%s: IgnoreViewportPositioning = %d\n", __func__, v->IgnoreViewportPositioning); + dml_print("DML::%s: SwathHeight = %d\n", __func__, SwathHeight); + dml_print("DML::%s: MaxPartialSwath = %d\n", __func__, MaxPartialSwath); + dml_print("DML::%s: MaxNumSwath = %d\n", __func__, *MaxNumSwath); + dml_print("DML::%s: Prefetch source lines = %d\n", __func__, *MaxNumSwath * SwathHeight + MaxPartialSwath); +#endif + return *MaxNumSwath * SwathHeight + MaxPartialSwath; +} + +static unsigned int CalculateVMAndRowBytes( + struct display_mode_lib *mode_lib, + bool DCCEnable, + unsigned int BlockHeight256Bytes, + unsigned int BlockWidth256Bytes, + enum source_format_class SourcePixelFormat, + unsigned int SurfaceTiling, + unsigned int BytePerPixel, + enum scan_direction_class ScanDirection, + unsigned int SwathWidth, + unsigned int ViewportHeight, + bool GPUVMEnable, + bool HostVMEnable, + unsigned int HostVMMaxNonCachedPageTableLevels, + unsigned int GPUVMMinPageSize, + unsigned int HostVMMinPageSize, + unsigned int PTEBufferSizeInRequests, + unsigned int Pitch, + unsigned int DCCMetaPitch, + unsigned int *MacroTileWidth, + unsigned int *MetaRowByte, + unsigned int *PixelPTEBytesPerRow, + bool *PTEBufferSizeNotExceeded, + int *dpte_row_width_ub, + unsigned int *dpte_row_height, + unsigned int *MetaRequestWidth, + unsigned int *MetaRequestHeight, + unsigned int *meta_row_width, + unsigned int *meta_row_height, + int *vm_group_bytes, + unsigned int *dpte_group_bytes, + unsigned int *PixelPTEReqWidth, + unsigned int *PixelPTEReqHeight, + unsigned int *PTERequestSize, + int *DPDE0BytesFrame, + int *MetaPTEBytesFrame) +{ + struct vba_vars_st *v = &mode_lib->vba; + unsigned int MPDEBytesFrame; + unsigned int DCCMetaSurfaceBytes; + unsigned int MacroTileSizeBytes; + unsigned int MacroTileHeight; + unsigned int ExtraDPDEBytesFrame; + unsigned int PDEAndMetaPTEBytesFrame; + unsigned int PixelPTEReqHeightPTEs = 0; + unsigned int HostVMDynamicLevels = 0; + double FractionOfPTEReturnDrop; + + if (GPUVMEnable == true && HostVMEnable == true) { + if (HostVMMinPageSize < 2048) { + HostVMDynamicLevels = HostVMMaxNonCachedPageTableLevels; + } else if (HostVMMinPageSize >= 2048 && HostVMMinPageSize < 1048576) { + HostVMDynamicLevels = dml_max(0, (int) HostVMMaxNonCachedPageTableLevels - 1); + } else { + HostVMDynamicLevels = dml_max(0, (int) HostVMMaxNonCachedPageTableLevels - 2); + } + } + + *MetaRequestHeight = 8 * BlockHeight256Bytes; + *MetaRequestWidth = 8 * BlockWidth256Bytes; + if (ScanDirection != dm_vert) { + *meta_row_height = *MetaRequestHeight; + *meta_row_width = dml_ceil((double) SwathWidth - 1, *MetaRequestWidth) + *MetaRequestWidth; + *MetaRowByte = *meta_row_width * *MetaRequestHeight * BytePerPixel / 256.0; + } else { + *meta_row_height = *MetaRequestWidth; + *meta_row_width = dml_ceil((double) SwathWidth - 1, *MetaRequestHeight) + *MetaRequestHeight; + *MetaRowByte = *meta_row_width * *MetaRequestWidth * BytePerPixel / 256.0; + } + DCCMetaSurfaceBytes = DCCMetaPitch * (dml_ceil(ViewportHeight - 1, 64 * BlockHeight256Bytes) + 64 * BlockHeight256Bytes) * BytePerPixel / 256; + if (GPUVMEnable == true) { + *MetaPTEBytesFrame = (dml_ceil((double) (DCCMetaSurfaceBytes - 4.0 * 1024.0) / (8 * 4.0 * 1024), 1) + 1) * 64; + MPDEBytesFrame = 128 * (v->GPUVMMaxPageTableLevels - 1); + } else { + *MetaPTEBytesFrame = 0; + MPDEBytesFrame = 0; + } + + if (DCCEnable != true) { + *MetaPTEBytesFrame = 0; + MPDEBytesFrame = 0; + *MetaRowByte = 0; + } + + if (SurfaceTiling == dm_sw_linear) { + MacroTileSizeBytes = 256; + MacroTileHeight = BlockHeight256Bytes; + } else { + MacroTileSizeBytes = 65536; + MacroTileHeight = 16 * BlockHeight256Bytes; + } + *MacroTileWidth = MacroTileSizeBytes / BytePerPixel / MacroTileHeight; + + if (GPUVMEnable == true && v->GPUVMMaxPageTableLevels > 1) { + if (ScanDirection != dm_vert) { + *DPDE0BytesFrame = 64 + * (dml_ceil( + ((Pitch * (dml_ceil(ViewportHeight - 1, MacroTileHeight) + MacroTileHeight) * BytePerPixel) - MacroTileSizeBytes) + / (8 * 2097152), + 1) + 1); + } else { + *DPDE0BytesFrame = 64 + * (dml_ceil( + ((Pitch * (dml_ceil((double) SwathWidth - 1, MacroTileHeight) + MacroTileHeight) * BytePerPixel) - MacroTileSizeBytes) + / (8 * 2097152), + 1) + 1); + } + ExtraDPDEBytesFrame = 128 * (v->GPUVMMaxPageTableLevels - 2); + } else { + *DPDE0BytesFrame = 0; + ExtraDPDEBytesFrame = 0; + } + + PDEAndMetaPTEBytesFrame = *MetaPTEBytesFrame + MPDEBytesFrame + *DPDE0BytesFrame + ExtraDPDEBytesFrame; + +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: MetaPTEBytesFrame = %d\n", __func__, *MetaPTEBytesFrame); + dml_print("DML::%s: MPDEBytesFrame = %d\n", __func__, MPDEBytesFrame); + dml_print("DML::%s: DPDE0BytesFrame = %d\n", __func__, *DPDE0BytesFrame); + dml_print("DML::%s: ExtraDPDEBytesFrame= %d\n", __func__, ExtraDPDEBytesFrame); + dml_print("DML::%s: PDEAndMetaPTEBytesFrame = %d\n", __func__, PDEAndMetaPTEBytesFrame); +#endif + + if (HostVMEnable == true) { + PDEAndMetaPTEBytesFrame = PDEAndMetaPTEBytesFrame * (1 + 8 * HostVMDynamicLevels); + } +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: PDEAndMetaPTEBytesFrame = %d\n", __func__, PDEAndMetaPTEBytesFrame); +#endif + + if (SurfaceTiling == dm_sw_linear) { + PixelPTEReqHeightPTEs = 1; + *PixelPTEReqHeight = 1; + *PixelPTEReqWidth = 32768.0 / BytePerPixel; + *PTERequestSize = 64; + FractionOfPTEReturnDrop = 0; + } else if (MacroTileSizeBytes == 4096) { + PixelPTEReqHeightPTEs = 1; + *PixelPTEReqHeight = MacroTileHeight; + *PixelPTEReqWidth = 8 * *MacroTileWidth; + *PTERequestSize = 64; + if (ScanDirection != dm_vert) + FractionOfPTEReturnDrop = 0; + else + FractionOfPTEReturnDrop = 7 / 8; + } else if (GPUVMMinPageSize == 4 && MacroTileSizeBytes > 4096) { + PixelPTEReqHeightPTEs = 16; + *PixelPTEReqHeight = 16 * BlockHeight256Bytes; + *PixelPTEReqWidth = 16 * BlockWidth256Bytes; + *PTERequestSize = 128; + FractionOfPTEReturnDrop = 0; + } else { + PixelPTEReqHeightPTEs = 1; + *PixelPTEReqHeight = MacroTileHeight; + *PixelPTEReqWidth = 8 * *MacroTileWidth; + *PTERequestSize = 64; + FractionOfPTEReturnDrop = 0; + } + + if (SurfaceTiling == dm_sw_linear) { + *dpte_row_height = dml_min(128, 1 << (unsigned int) dml_floor(dml_log2(PTEBufferSizeInRequests * *PixelPTEReqWidth / Pitch), 1)); + *dpte_row_width_ub = (dml_ceil((double)(Pitch * *dpte_row_height - 1) / *PixelPTEReqWidth, 1) + 1) * *PixelPTEReqWidth; + *PixelPTEBytesPerRow = *dpte_row_width_ub / *PixelPTEReqWidth * *PTERequestSize; + } else if (ScanDirection != dm_vert) { + *dpte_row_height = *PixelPTEReqHeight; + *dpte_row_width_ub = (dml_ceil((double) (SwathWidth - 1) / *PixelPTEReqWidth, 1) + 1) * *PixelPTEReqWidth; + *PixelPTEBytesPerRow = *dpte_row_width_ub / *PixelPTEReqWidth * *PTERequestSize; + } else { + *dpte_row_height = dml_min(*PixelPTEReqWidth, *MacroTileWidth); + *dpte_row_width_ub = (dml_ceil((double) (SwathWidth - 1) / *PixelPTEReqHeight, 1) + 1) * *PixelPTEReqHeight; + *PixelPTEBytesPerRow = *dpte_row_width_ub / *PixelPTEReqHeight * *PTERequestSize; + } + + if (*PixelPTEBytesPerRow * (1 - FractionOfPTEReturnDrop) <= 64 * PTEBufferSizeInRequests) { + *PTEBufferSizeNotExceeded = true; + } else { + *PTEBufferSizeNotExceeded = false; + } + + if (GPUVMEnable != true) { + *PixelPTEBytesPerRow = 0; + *PTEBufferSizeNotExceeded = true; + } + + dml_print("DML: vm_bytes = meta_pte_bytes_per_frame (per_pipe) = MetaPTEBytesFrame = : %i\n", *MetaPTEBytesFrame); + + if (HostVMEnable == true) { + *PixelPTEBytesPerRow = *PixelPTEBytesPerRow * (1 + 8 * HostVMDynamicLevels); + } + + if (HostVMEnable == true) { + *vm_group_bytes = 512; + *dpte_group_bytes = 512; + } else if (GPUVMEnable == true) { + *vm_group_bytes = 2048; + if (SurfaceTiling != dm_sw_linear && PixelPTEReqHeightPTEs == 1 && ScanDirection == dm_vert) { + *dpte_group_bytes = 512; + } else { + *dpte_group_bytes = 2048; + } + } else { + *vm_group_bytes = 0; + *dpte_group_bytes = 0; + } + return PDEAndMetaPTEBytesFrame; +} + +static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation(struct display_mode_lib *mode_lib) +{ + struct vba_vars_st *v = &mode_lib->vba; + unsigned int j, k; + double HostVMInefficiencyFactor = 1.0; + bool NoChromaPlanes = true; + int ReorderBytes; + double VMDataOnlyReturnBW; + double MaxTotalRDBandwidth = 0; + int PrefetchMode = v->PrefetchModePerState[v->VoltageLevel][v->maxMpcComb]; + + v->WritebackDISPCLK = 0.0; + v->DISPCLKWithRamping = 0; + v->DISPCLKWithoutRamping = 0; + v->GlobalDPPCLK = 0.0; + /* DAL custom code: need to update ReturnBW in case min dcfclk is overridden */ + { + double IdealFabricAndSDPPortBandwidthPerState = dml_min( + v->ReturnBusWidth * v->DCFCLKState[v->VoltageLevel][v->maxMpcComb], + v->FabricClockPerState[v->VoltageLevel] * v->FabricDatapathToDCNDataReturn); + double IdealDRAMBandwidthPerState = v->DRAMSpeedPerState[v->VoltageLevel] * v->NumberOfChannels * v->DRAMChannelWidth; + + if (v->HostVMEnable != true) { + v->ReturnBW = dml_min( + IdealFabricAndSDPPortBandwidthPerState * v->PercentOfIdealFabricAndSDPPortBWReceivedAfterUrgLatency / 100.0, + IdealDRAMBandwidthPerState * v->PercentOfIdealDRAMBWReceivedAfterUrgLatencyPixelDataOnly / 100.0); + } else { + v->ReturnBW = dml_min( + IdealFabricAndSDPPortBandwidthPerState * v->PercentOfIdealFabricAndSDPPortBWReceivedAfterUrgLatency / 100.0, + IdealDRAMBandwidthPerState * v->PercentOfIdealDRAMBWReceivedAfterUrgLatencyPixelMixedWithVMData / 100.0); + } + } + /* End DAL custom code */ + + // DISPCLK and DPPCLK Calculation + // + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + if (v->WritebackEnable[k]) { + v->WritebackDISPCLK = dml_max( + v->WritebackDISPCLK, + dml314_CalculateWriteBackDISPCLK( + v->WritebackPixelFormat[k], + v->PixelClock[k], + v->WritebackHRatio[k], + v->WritebackVRatio[k], + v->WritebackHTaps[k], + v->WritebackVTaps[k], + v->WritebackSourceWidth[k], + v->WritebackDestinationWidth[k], + v->HTotal[k], + v->WritebackLineBufferSize)); + } + } + + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + if (v->HRatio[k] > 1) { + v->PSCL_THROUGHPUT_LUMA[k] = dml_min( + v->MaxDCHUBToPSCLThroughput, + v->MaxPSCLToLBThroughput * v->HRatio[k] / dml_ceil(v->htaps[k] / 6.0, 1)); + } else { + v->PSCL_THROUGHPUT_LUMA[k] = dml_min(v->MaxDCHUBToPSCLThroughput, v->MaxPSCLToLBThroughput); + } + + v->DPPCLKUsingSingleDPPLuma = v->PixelClock[k] + * dml_max( + v->vtaps[k] / 6.0 * dml_min(1.0, v->HRatio[k]), + dml_max(v->HRatio[k] * v->VRatio[k] / v->PSCL_THROUGHPUT_LUMA[k], 1.0)); + + if ((v->htaps[k] > 6 || v->vtaps[k] > 6) && v->DPPCLKUsingSingleDPPLuma < 2 * v->PixelClock[k]) { + v->DPPCLKUsingSingleDPPLuma = 2 * v->PixelClock[k]; + } + + if ((v->SourcePixelFormat[k] != dm_420_8 && v->SourcePixelFormat[k] != dm_420_10 && v->SourcePixelFormat[k] != dm_420_12 + && v->SourcePixelFormat[k] != dm_rgbe_alpha)) { + v->PSCL_THROUGHPUT_CHROMA[k] = 0.0; + v->DPPCLKUsingSingleDPP[k] = v->DPPCLKUsingSingleDPPLuma; + } else { + if (v->HRatioChroma[k] > 1) { + v->PSCL_THROUGHPUT_CHROMA[k] = dml_min( + v->MaxDCHUBToPSCLThroughput, + v->MaxPSCLToLBThroughput * v->HRatioChroma[k] / dml_ceil(v->HTAPsChroma[k] / 6.0, 1.0)); + } else { + v->PSCL_THROUGHPUT_CHROMA[k] = dml_min(v->MaxDCHUBToPSCLThroughput, v->MaxPSCLToLBThroughput); + } + v->DPPCLKUsingSingleDPPChroma = v->PixelClock[k] + * dml_max3( + v->VTAPsChroma[k] / 6.0 * dml_min(1.0, v->HRatioChroma[k]), + v->HRatioChroma[k] * v->VRatioChroma[k] / v->PSCL_THROUGHPUT_CHROMA[k], + 1.0); + + if ((v->HTAPsChroma[k] > 6 || v->VTAPsChroma[k] > 6) && v->DPPCLKUsingSingleDPPChroma < 2 * v->PixelClock[k]) { + v->DPPCLKUsingSingleDPPChroma = 2 * v->PixelClock[k]; + } + + v->DPPCLKUsingSingleDPP[k] = dml_max(v->DPPCLKUsingSingleDPPLuma, v->DPPCLKUsingSingleDPPChroma); + } + } + + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + if (v->BlendingAndTiming[k] != k) + continue; + if (v->ODMCombineEnabled[k] == dm_odm_combine_mode_4to1) { + v->DISPCLKWithRamping = dml_max( + v->DISPCLKWithRamping, + v->PixelClock[k] / 4 * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100) + * (1 + v->DISPCLKRampingMargin / 100)); + v->DISPCLKWithoutRamping = dml_max( + v->DISPCLKWithoutRamping, + v->PixelClock[k] / 4 * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100)); + } else if (v->ODMCombineEnabled[k] == dm_odm_combine_mode_2to1) { + v->DISPCLKWithRamping = dml_max( + v->DISPCLKWithRamping, + v->PixelClock[k] / 2 * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100) + * (1 + v->DISPCLKRampingMargin / 100)); + v->DISPCLKWithoutRamping = dml_max( + v->DISPCLKWithoutRamping, + v->PixelClock[k] / 2 * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100)); + } else { + v->DISPCLKWithRamping = dml_max( + v->DISPCLKWithRamping, + v->PixelClock[k] * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100) * (1 + v->DISPCLKRampingMargin / 100)); + v->DISPCLKWithoutRamping = dml_max( + v->DISPCLKWithoutRamping, + v->PixelClock[k] * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100)); + } + } + + v->DISPCLKWithRamping = dml_max(v->DISPCLKWithRamping, v->WritebackDISPCLK); + v->DISPCLKWithoutRamping = dml_max(v->DISPCLKWithoutRamping, v->WritebackDISPCLK); + + ASSERT(v->DISPCLKDPPCLKVCOSpeed != 0); + v->DISPCLKWithRampingRoundedToDFSGranularity = RoundToDFSGranularityUp(v->DISPCLKWithRamping, v->DISPCLKDPPCLKVCOSpeed); + v->DISPCLKWithoutRampingRoundedToDFSGranularity = RoundToDFSGranularityUp(v->DISPCLKWithoutRamping, v->DISPCLKDPPCLKVCOSpeed); + v->MaxDispclkRoundedToDFSGranularity = RoundToDFSGranularityDown( + v->soc.clock_limits[v->soc.num_states - 1].dispclk_mhz, + v->DISPCLKDPPCLKVCOSpeed); + if (v->DISPCLKWithoutRampingRoundedToDFSGranularity > v->MaxDispclkRoundedToDFSGranularity) { + v->DISPCLK_calculated = v->DISPCLKWithoutRampingRoundedToDFSGranularity; + } else if (v->DISPCLKWithRampingRoundedToDFSGranularity > v->MaxDispclkRoundedToDFSGranularity) { + v->DISPCLK_calculated = v->MaxDispclkRoundedToDFSGranularity; + } else { + v->DISPCLK_calculated = v->DISPCLKWithRampingRoundedToDFSGranularity; + } + v->DISPCLK = v->DISPCLK_calculated; + DTRACE(" dispclk_mhz (calculated) = %f", v->DISPCLK_calculated); + + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + v->DPPCLK_calculated[k] = v->DPPCLKUsingSingleDPP[k] / v->DPPPerPlane[k] * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100); + v->GlobalDPPCLK = dml_max(v->GlobalDPPCLK, v->DPPCLK_calculated[k]); + } + v->GlobalDPPCLK = RoundToDFSGranularityUp(v->GlobalDPPCLK, v->DISPCLKDPPCLKVCOSpeed); + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + v->DPPCLK_calculated[k] = v->GlobalDPPCLK / 255 * dml_ceil(v->DPPCLK_calculated[k] * 255.0 / v->GlobalDPPCLK, 1); + DTRACE(" dppclk_mhz[%i] (calculated) = %f", k, v->DPPCLK_calculated[k]); + } + + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + v->DPPCLK[k] = v->DPPCLK_calculated[k]; + } + + // Urgent and B P-State/DRAM Clock Change Watermark + DTRACE(" dcfclk_mhz = %f", v->DCFCLK); + DTRACE(" return_bus_bw = %f", v->ReturnBW); + + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + CalculateBytePerPixelAnd256BBlockSizes( + v->SourcePixelFormat[k], + v->SurfaceTiling[k], + &v->BytePerPixelY[k], + &v->BytePerPixelC[k], + &v->BytePerPixelDETY[k], + &v->BytePerPixelDETC[k], + &v->BlockHeight256BytesY[k], + &v->BlockHeight256BytesC[k], + &v->BlockWidth256BytesY[k], + &v->BlockWidth256BytesC[k]); + } + + CalculateSwathWidth( + false, + v->NumberOfActivePlanes, + v->SourcePixelFormat, + v->SourceScan, + v->ViewportWidth, + v->ViewportHeight, + v->SurfaceWidthY, + v->SurfaceWidthC, + v->SurfaceHeightY, + v->SurfaceHeightC, + v->ODMCombineEnabled, + v->BytePerPixelY, + v->BytePerPixelC, + v->BlockHeight256BytesY, + v->BlockHeight256BytesC, + v->BlockWidth256BytesY, + v->BlockWidth256BytesC, + v->BlendingAndTiming, + v->HActive, + v->HRatio, + v->DPPPerPlane, + v->SwathWidthSingleDPPY, + v->SwathWidthSingleDPPC, + v->SwathWidthY, + v->SwathWidthC, + v->dummyinteger3, + v->dummyinteger4, + v->swath_width_luma_ub, + v->swath_width_chroma_ub); + + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + v->ReadBandwidthPlaneLuma[k] = v->SwathWidthSingleDPPY[k] * v->BytePerPixelY[k] / (v->HTotal[k] / v->PixelClock[k]) + * v->VRatio[k]; + v->ReadBandwidthPlaneChroma[k] = v->SwathWidthSingleDPPC[k] * v->BytePerPixelC[k] / (v->HTotal[k] / v->PixelClock[k]) + * v->VRatioChroma[k]; + DTRACE(" read_bw[%i] = %fBps", k, v->ReadBandwidthPlaneLuma[k] + v->ReadBandwidthPlaneChroma[k]); + } + + // DCFCLK Deep Sleep + CalculateDCFCLKDeepSleep( + mode_lib, + v->NumberOfActivePlanes, + v->BytePerPixelY, + v->BytePerPixelC, + v->VRatio, + v->VRatioChroma, + v->SwathWidthY, + v->SwathWidthC, + v->DPPPerPlane, + v->HRatio, + v->HRatioChroma, + v->PixelClock, + v->PSCL_THROUGHPUT_LUMA, + v->PSCL_THROUGHPUT_CHROMA, + v->DPPCLK, + v->ReadBandwidthPlaneLuma, + v->ReadBandwidthPlaneChroma, + v->ReturnBusWidth, + &v->DCFCLKDeepSleep); + + // DSCCLK + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + if ((v->BlendingAndTiming[k] != k) || !v->DSCEnabled[k]) { + v->DSCCLK_calculated[k] = 0.0; + } else { + if (v->OutputFormat[k] == dm_420) + v->DSCFormatFactor = 2; + else if (v->OutputFormat[k] == dm_444) + v->DSCFormatFactor = 1; + else if (v->OutputFormat[k] == dm_n422) + v->DSCFormatFactor = 2; + else + v->DSCFormatFactor = 1; + if (v->ODMCombineEnabled[k] == dm_odm_combine_mode_4to1) + v->DSCCLK_calculated[k] = v->PixelClockBackEnd[k] / 12 / v->DSCFormatFactor + / (1 - v->DISPCLKDPPCLKDSCCLKDownSpreading / 100); + else if (v->ODMCombineEnabled[k] == dm_odm_combine_mode_2to1) + v->DSCCLK_calculated[k] = v->PixelClockBackEnd[k] / 6 / v->DSCFormatFactor + / (1 - v->DISPCLKDPPCLKDSCCLKDownSpreading / 100); + else + v->DSCCLK_calculated[k] = v->PixelClockBackEnd[k] / 3 / v->DSCFormatFactor + / (1 - v->DISPCLKDPPCLKDSCCLKDownSpreading / 100); + } + } + + // DSC Delay + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + double BPP = v->OutputBpp[k]; + + if (v->DSCEnabled[k] && BPP != 0) { + if (v->ODMCombineEnabled[k] == dm_odm_combine_mode_disabled) { + v->DSCDelay[k] = dscceComputeDelay( + v->DSCInputBitPerComponent[k], + BPP, + dml_ceil((double) v->HActive[k] / v->NumberOfDSCSlices[k], 1), + v->NumberOfDSCSlices[k], + v->OutputFormat[k], + v->Output[k]) + dscComputeDelay(v->OutputFormat[k], v->Output[k]); + } else if (v->ODMCombineEnabled[k] == dm_odm_combine_mode_2to1) { + v->DSCDelay[k] = 2 + * (dscceComputeDelay( + v->DSCInputBitPerComponent[k], + BPP, + dml_ceil((double) v->HActive[k] / v->NumberOfDSCSlices[k], 1), + v->NumberOfDSCSlices[k] / 2.0, + v->OutputFormat[k], + v->Output[k]) + dscComputeDelay(v->OutputFormat[k], v->Output[k])); + } else { + v->DSCDelay[k] = 4 + * (dscceComputeDelay( + v->DSCInputBitPerComponent[k], + BPP, + dml_ceil((double) v->HActive[k] / v->NumberOfDSCSlices[k], 1), + v->NumberOfDSCSlices[k] / 4.0, + v->OutputFormat[k], + v->Output[k]) + dscComputeDelay(v->OutputFormat[k], v->Output[k])); + } + v->DSCDelay[k] = v->DSCDelay[k] * v->PixelClock[k] / v->PixelClockBackEnd[k]; + } else { + v->DSCDelay[k] = 0; + } + } + + for (k = 0; k < v->NumberOfActivePlanes; ++k) + for (j = 0; j < v->NumberOfActivePlanes; ++j) // NumberOfPlanes + if (j != k && v->BlendingAndTiming[k] == j && v->DSCEnabled[j]) + v->DSCDelay[k] = v->DSCDelay[j]; + + // Prefetch + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + unsigned int PDEAndMetaPTEBytesFrameY; + unsigned int PixelPTEBytesPerRowY; + unsigned int MetaRowByteY; + unsigned int MetaRowByteC; + unsigned int PDEAndMetaPTEBytesFrameC; + unsigned int PixelPTEBytesPerRowC; + bool PTEBufferSizeNotExceededY; + bool PTEBufferSizeNotExceededC; + + if (v->SourcePixelFormat[k] == dm_420_8 || v->SourcePixelFormat[k] == dm_420_10 || v->SourcePixelFormat[k] == dm_420_12 + || v->SourcePixelFormat[k] == dm_rgbe_alpha) { + if ((v->SourcePixelFormat[k] == dm_420_10 || v->SourcePixelFormat[k] == dm_420_12) && v->SourceScan[k] != dm_vert) { + v->PTEBufferSizeInRequestsForLuma = (v->PTEBufferSizeInRequestsLuma + v->PTEBufferSizeInRequestsChroma) / 2; + v->PTEBufferSizeInRequestsForChroma = v->PTEBufferSizeInRequestsForLuma; + } else { + v->PTEBufferSizeInRequestsForLuma = v->PTEBufferSizeInRequestsLuma; + v->PTEBufferSizeInRequestsForChroma = v->PTEBufferSizeInRequestsChroma; + } + + PDEAndMetaPTEBytesFrameC = CalculateVMAndRowBytes( + mode_lib, + v->DCCEnable[k], + v->BlockHeight256BytesC[k], + v->BlockWidth256BytesC[k], + v->SourcePixelFormat[k], + v->SurfaceTiling[k], + v->BytePerPixelC[k], + v->SourceScan[k], + v->SwathWidthC[k], + v->ViewportHeightChroma[k], + v->GPUVMEnable, + v->HostVMEnable, + v->HostVMMaxNonCachedPageTableLevels, + v->GPUVMMinPageSize, + v->HostVMMinPageSize, + v->PTEBufferSizeInRequestsForChroma, + v->PitchC[k], + v->DCCMetaPitchC[k], + &v->MacroTileWidthC[k], + &MetaRowByteC, + &PixelPTEBytesPerRowC, + &PTEBufferSizeNotExceededC, + &v->dpte_row_width_chroma_ub[k], + &v->dpte_row_height_chroma[k], + &v->meta_req_width_chroma[k], + &v->meta_req_height_chroma[k], + &v->meta_row_width_chroma[k], + &v->meta_row_height_chroma[k], + &v->dummyinteger1, + &v->dummyinteger2, + &v->PixelPTEReqWidthC[k], + &v->PixelPTEReqHeightC[k], + &v->PTERequestSizeC[k], + &v->dpde0_bytes_per_frame_ub_c[k], + &v->meta_pte_bytes_per_frame_ub_c[k]); + + v->PrefetchSourceLinesC[k] = CalculatePrefetchSourceLines( + mode_lib, + v->VRatioChroma[k], + v->VTAPsChroma[k], + v->Interlace[k], + v->ProgressiveToInterlaceUnitInOPP, + v->SwathHeightC[k], + v->ViewportYStartC[k], + &v->VInitPreFillC[k], + &v->MaxNumSwathC[k]); + } else { + v->PTEBufferSizeInRequestsForLuma = v->PTEBufferSizeInRequestsLuma + v->PTEBufferSizeInRequestsChroma; + v->PTEBufferSizeInRequestsForChroma = 0; + PixelPTEBytesPerRowC = 0; + PDEAndMetaPTEBytesFrameC = 0; + MetaRowByteC = 0; + v->MaxNumSwathC[k] = 0; + v->PrefetchSourceLinesC[k] = 0; + } + + PDEAndMetaPTEBytesFrameY = CalculateVMAndRowBytes( + mode_lib, + v->DCCEnable[k], + v->BlockHeight256BytesY[k], + v->BlockWidth256BytesY[k], + v->SourcePixelFormat[k], + v->SurfaceTiling[k], + v->BytePerPixelY[k], + v->SourceScan[k], + v->SwathWidthY[k], + v->ViewportHeight[k], + v->GPUVMEnable, + v->HostVMEnable, + v->HostVMMaxNonCachedPageTableLevels, + v->GPUVMMinPageSize, + v->HostVMMinPageSize, + v->PTEBufferSizeInRequestsForLuma, + v->PitchY[k], + v->DCCMetaPitchY[k], + &v->MacroTileWidthY[k], + &MetaRowByteY, + &PixelPTEBytesPerRowY, + &PTEBufferSizeNotExceededY, + &v->dpte_row_width_luma_ub[k], + &v->dpte_row_height[k], + &v->meta_req_width[k], + &v->meta_req_height[k], + &v->meta_row_width[k], + &v->meta_row_height[k], + &v->vm_group_bytes[k], + &v->dpte_group_bytes[k], + &v->PixelPTEReqWidthY[k], + &v->PixelPTEReqHeightY[k], + &v->PTERequestSizeY[k], + &v->dpde0_bytes_per_frame_ub_l[k], + &v->meta_pte_bytes_per_frame_ub_l[k]); + + v->PrefetchSourceLinesY[k] = CalculatePrefetchSourceLines( + mode_lib, + v->VRatio[k], + v->vtaps[k], + v->Interlace[k], + v->ProgressiveToInterlaceUnitInOPP, + v->SwathHeightY[k], + v->ViewportYStartY[k], + &v->VInitPreFillY[k], + &v->MaxNumSwathY[k]); + v->PixelPTEBytesPerRow[k] = PixelPTEBytesPerRowY + PixelPTEBytesPerRowC; + v->PDEAndMetaPTEBytesFrame[k] = PDEAndMetaPTEBytesFrameY + PDEAndMetaPTEBytesFrameC; + v->MetaRowByte[k] = MetaRowByteY + MetaRowByteC; + + CalculateRowBandwidth( + v->GPUVMEnable, + v->SourcePixelFormat[k], + v->VRatio[k], + v->VRatioChroma[k], + v->DCCEnable[k], + v->HTotal[k] / v->PixelClock[k], + MetaRowByteY, + MetaRowByteC, + v->meta_row_height[k], + v->meta_row_height_chroma[k], + PixelPTEBytesPerRowY, + PixelPTEBytesPerRowC, + v->dpte_row_height[k], + v->dpte_row_height_chroma[k], + &v->meta_row_bw[k], + &v->dpte_row_bw[k]); + } + + v->TotalDCCActiveDPP = 0; + v->TotalActiveDPP = 0; + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + v->TotalActiveDPP = v->TotalActiveDPP + v->DPPPerPlane[k]; + if (v->DCCEnable[k]) + v->TotalDCCActiveDPP = v->TotalDCCActiveDPP + v->DPPPerPlane[k]; + if (v->SourcePixelFormat[k] == dm_420_8 || v->SourcePixelFormat[k] == dm_420_10 || v->SourcePixelFormat[k] == dm_420_12 + || v->SourcePixelFormat[k] == dm_rgbe_alpha) + NoChromaPlanes = false; + } + + ReorderBytes = v->NumberOfChannels + * dml_max3( + v->UrgentOutOfOrderReturnPerChannelPixelDataOnly, + v->UrgentOutOfOrderReturnPerChannelPixelMixedWithVMData, + v->UrgentOutOfOrderReturnPerChannelVMDataOnly); + + VMDataOnlyReturnBW = dml_min( + dml_min(v->ReturnBusWidth * v->DCFCLK, v->FabricClock * v->FabricDatapathToDCNDataReturn) + * v->PercentOfIdealFabricAndSDPPortBWReceivedAfterUrgLatency / 100.0, + v->DRAMSpeed * v->NumberOfChannels * v->DRAMChannelWidth + * v->PercentOfIdealDRAMBWReceivedAfterUrgLatencyVMDataOnly / 100.0); + +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: v->ReturnBusWidth = %f\n", __func__, v->ReturnBusWidth); + dml_print("DML::%s: v->DCFCLK = %f\n", __func__, v->DCFCLK); + dml_print("DML::%s: v->FabricClock = %f\n", __func__, v->FabricClock); + dml_print("DML::%s: v->FabricDatapathToDCNDataReturn = %f\n", __func__, v->FabricDatapathToDCNDataReturn); + dml_print("DML::%s: v->PercentOfIdealFabricAndSDPPortBWReceivedAfterUrgLatency = %f\n", __func__, v->PercentOfIdealFabricAndSDPPortBWReceivedAfterUrgLatency); + dml_print("DML::%s: v->DRAMSpeed = %f\n", __func__, v->DRAMSpeed); + dml_print("DML::%s: v->NumberOfChannels = %f\n", __func__, v->NumberOfChannels); + dml_print("DML::%s: v->DRAMChannelWidth = %f\n", __func__, v->DRAMChannelWidth); + dml_print("DML::%s: v->PercentOfIdealDRAMBWReceivedAfterUrgLatencyVMDataOnly = %f\n", __func__, v->PercentOfIdealDRAMBWReceivedAfterUrgLatencyVMDataOnly); + dml_print("DML::%s: VMDataOnlyReturnBW = %f\n", __func__, VMDataOnlyReturnBW); + dml_print("DML::%s: ReturnBW = %f\n", __func__, v->ReturnBW); +#endif + + if (v->GPUVMEnable && v->HostVMEnable) + HostVMInefficiencyFactor = v->ReturnBW / VMDataOnlyReturnBW; + + v->UrgentExtraLatency = CalculateExtraLatency( + v->RoundTripPingLatencyCycles, + ReorderBytes, + v->DCFCLK, + v->TotalActiveDPP, + v->PixelChunkSizeInKByte, + v->TotalDCCActiveDPP, + v->MetaChunkSize, + v->ReturnBW, + v->GPUVMEnable, + v->HostVMEnable, + v->NumberOfActivePlanes, + v->DPPPerPlane, + v->dpte_group_bytes, + HostVMInefficiencyFactor, + v->HostVMMinPageSize, + v->HostVMMaxNonCachedPageTableLevels); + + v->TCalc = 24.0 / v->DCFCLKDeepSleep; + + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + if (v->BlendingAndTiming[k] == k) { + if (v->WritebackEnable[k] == true) { + v->WritebackDelay[v->VoltageLevel][k] = v->WritebackLatency + + CalculateWriteBackDelay( + v->WritebackPixelFormat[k], + v->WritebackHRatio[k], + v->WritebackVRatio[k], + v->WritebackVTaps[k], + v->WritebackDestinationWidth[k], + v->WritebackDestinationHeight[k], + v->WritebackSourceHeight[k], + v->HTotal[k]) / v->DISPCLK; + } else + v->WritebackDelay[v->VoltageLevel][k] = 0; + for (j = 0; j < v->NumberOfActivePlanes; ++j) { + if (v->BlendingAndTiming[j] == k && v->WritebackEnable[j] == true) { + v->WritebackDelay[v->VoltageLevel][k] = dml_max( + v->WritebackDelay[v->VoltageLevel][k], + v->WritebackLatency + + CalculateWriteBackDelay( + v->WritebackPixelFormat[j], + v->WritebackHRatio[j], + v->WritebackVRatio[j], + v->WritebackVTaps[j], + v->WritebackDestinationWidth[j], + v->WritebackDestinationHeight[j], + v->WritebackSourceHeight[j], + v->HTotal[k]) / v->DISPCLK); + } + } + } + } + + for (k = 0; k < v->NumberOfActivePlanes; ++k) + for (j = 0; j < v->NumberOfActivePlanes; ++j) + if (v->BlendingAndTiming[k] == j) + v->WritebackDelay[v->VoltageLevel][k] = v->WritebackDelay[v->VoltageLevel][j]; + + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + v->MaxVStartupLines[k] = + CalculateMaxVStartup( + v->VTotal[k], + v->VActive[k], + v->VBlankNom[k], + v->HTotal[k], + v->PixelClock[k], + v->ProgressiveToInterlaceUnitInOPP, + v->Interlace[k], + v->ip.VBlankNomDefaultUS, + v->WritebackDelay[v->VoltageLevel][k]); + +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: k=%d MaxVStartupLines = %d\n", __func__, k, v->MaxVStartupLines[k]); + dml_print("DML::%s: k=%d VoltageLevel = %d\n", __func__, k, v->VoltageLevel); + dml_print("DML::%s: k=%d WritebackDelay = %f\n", __func__, k, v->WritebackDelay[v->VoltageLevel][k]); +#endif + } + + v->MaximumMaxVStartupLines = 0; + for (k = 0; k < v->NumberOfActivePlanes; ++k) + v->MaximumMaxVStartupLines = dml_max(v->MaximumMaxVStartupLines, v->MaxVStartupLines[k]); + + // VBA_DELTA + // We don't really care to iterate between the various prefetch modes + //v->PrefetchERROR = CalculateMinAndMaxPrefetchMode(v->AllowDRAMSelfRefreshOrDRAMClockChangeInVblank, &v->MinPrefetchMode, &v->MaxPrefetchMode); + + v->UrgentLatency = CalculateUrgentLatency( + v->UrgentLatencyPixelDataOnly, + v->UrgentLatencyPixelMixedWithVMData, + v->UrgentLatencyVMDataOnly, + v->DoUrgentLatencyAdjustment, + v->UrgentLatencyAdjustmentFabricClockComponent, + v->UrgentLatencyAdjustmentFabricClockReference, + v->FabricClock); + + v->FractionOfUrgentBandwidth = 0.0; + v->FractionOfUrgentBandwidthImmediateFlip = 0.0; + + v->VStartupLines = __DML_VBA_MIN_VSTARTUP__; + + do { + double MaxTotalRDBandwidthNoUrgentBurst = 0.0; + bool DestinationLineTimesForPrefetchLessThan2 = false; + bool VRatioPrefetchMoreThan4 = false; + double TWait = CalculateTWait(PrefetchMode, v->DRAMClockChangeLatency, v->UrgentLatency, v->SREnterPlusExitTime); + + MaxTotalRDBandwidth = 0; + + dml_print("DML::%s: Start loop: VStartup = %d\n", __func__, v->VStartupLines); + + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + Pipe myPipe; + + myPipe.DPPCLK = v->DPPCLK[k]; + myPipe.DISPCLK = v->DISPCLK; + myPipe.PixelClock = v->PixelClock[k]; + myPipe.DCFCLKDeepSleep = v->DCFCLKDeepSleep; + myPipe.DPPPerPlane = v->DPPPerPlane[k]; + myPipe.ScalerEnabled = v->ScalerEnabled[k]; + myPipe.VRatio = v->VRatio[k]; + myPipe.VRatioChroma = v->VRatioChroma[k]; + myPipe.SourceScan = v->SourceScan[k]; + myPipe.BlockWidth256BytesY = v->BlockWidth256BytesY[k]; + myPipe.BlockHeight256BytesY = v->BlockHeight256BytesY[k]; + myPipe.BlockWidth256BytesC = v->BlockWidth256BytesC[k]; + myPipe.BlockHeight256BytesC = v->BlockHeight256BytesC[k]; + myPipe.InterlaceEnable = v->Interlace[k]; + myPipe.NumberOfCursors = v->NumberOfCursors[k]; + myPipe.VBlank = v->VTotal[k] - v->VActive[k]; + myPipe.HTotal = v->HTotal[k]; + myPipe.DCCEnable = v->DCCEnable[k]; + myPipe.ODMCombineIsEnabled = v->ODMCombineEnabled[k] == dm_odm_combine_mode_4to1 + || v->ODMCombineEnabled[k] == dm_odm_combine_mode_2to1; + myPipe.SourcePixelFormat = v->SourcePixelFormat[k]; + myPipe.BytePerPixelY = v->BytePerPixelY[k]; + myPipe.BytePerPixelC = v->BytePerPixelC[k]; + myPipe.ProgressiveToInterlaceUnitInOPP = v->ProgressiveToInterlaceUnitInOPP; + v->ErrorResult[k] = CalculatePrefetchSchedule( + mode_lib, + HostVMInefficiencyFactor, + &myPipe, + v->DSCDelay[k], + v->DPPCLKDelaySubtotal + v->DPPCLKDelayCNVCFormater, + v->DPPCLKDelaySCL, + v->DPPCLKDelaySCLLBOnly, + v->DPPCLKDelayCNVCCursor, + v->DISPCLKDelaySubtotal, + (unsigned int) (v->SwathWidthY[k] / v->HRatio[k]), + v->OutputFormat[k], + v->MaxInterDCNTileRepeaters, + dml_min(v->VStartupLines, v->MaxVStartupLines[k]), + v->MaxVStartupLines[k], + v->GPUVMMaxPageTableLevels, + v->GPUVMEnable, + v->HostVMEnable, + v->HostVMMaxNonCachedPageTableLevels, + v->HostVMMinPageSize, + v->DynamicMetadataEnable[k], + v->DynamicMetadataVMEnabled, + v->DynamicMetadataLinesBeforeActiveRequired[k], + v->DynamicMetadataTransmittedBytes[k], + v->UrgentLatency, + v->UrgentExtraLatency, + v->TCalc, + v->PDEAndMetaPTEBytesFrame[k], + v->MetaRowByte[k], + v->PixelPTEBytesPerRow[k], + v->PrefetchSourceLinesY[k], + v->SwathWidthY[k], + v->VInitPreFillY[k], + v->MaxNumSwathY[k], + v->PrefetchSourceLinesC[k], + v->SwathWidthC[k], + v->VInitPreFillC[k], + v->MaxNumSwathC[k], + v->swath_width_luma_ub[k], + v->swath_width_chroma_ub[k], + v->SwathHeightY[k], + v->SwathHeightC[k], + TWait, + &v->DSTXAfterScaler[k], + &v->DSTYAfterScaler[k], + &v->DestinationLinesForPrefetch[k], + &v->PrefetchBandwidth[k], + &v->DestinationLinesToRequestVMInVBlank[k], + &v->DestinationLinesToRequestRowInVBlank[k], + &v->VRatioPrefetchY[k], + &v->VRatioPrefetchC[k], + &v->RequiredPrefetchPixDataBWLuma[k], + &v->RequiredPrefetchPixDataBWChroma[k], + &v->NotEnoughTimeForDynamicMetadata[k], + &v->Tno_bw[k], + &v->prefetch_vmrow_bw[k], + &v->Tdmdl_vm[k], + &v->Tdmdl[k], + &v->TSetup[k], + &v->VUpdateOffsetPix[k], + &v->VUpdateWidthPix[k], + &v->VReadyOffsetPix[k]); + +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: k=%0d Prefetch cal result=%0d\n", __func__, k, v->ErrorResult[k]); +#endif + v->VStartup[k] = dml_min(v->VStartupLines, v->MaxVStartupLines[k]); + } + + v->NoEnoughUrgentLatencyHiding = false; + v->NoEnoughUrgentLatencyHidingPre = false; + + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + v->cursor_bw[k] = v->NumberOfCursors[k] * v->CursorWidth[k][0] * v->CursorBPP[k][0] / 8.0 + / (v->HTotal[k] / v->PixelClock[k]) * v->VRatio[k]; + v->cursor_bw_pre[k] = v->NumberOfCursors[k] * v->CursorWidth[k][0] * v->CursorBPP[k][0] / 8.0 + / (v->HTotal[k] / v->PixelClock[k]) * v->VRatioPrefetchY[k]; + + CalculateUrgentBurstFactor( + v->swath_width_luma_ub[k], + v->swath_width_chroma_ub[k], + v->SwathHeightY[k], + v->SwathHeightC[k], + v->HTotal[k] / v->PixelClock[k], + v->UrgentLatency, + v->CursorBufferSize, + v->CursorWidth[k][0], + v->CursorBPP[k][0], + v->VRatio[k], + v->VRatioChroma[k], + v->BytePerPixelDETY[k], + v->BytePerPixelDETC[k], + v->DETBufferSizeY[k], + v->DETBufferSizeC[k], + &v->UrgBurstFactorCursor[k], + &v->UrgBurstFactorLuma[k], + &v->UrgBurstFactorChroma[k], + &v->NoUrgentLatencyHiding[k]); + + CalculateUrgentBurstFactor( + v->swath_width_luma_ub[k], + v->swath_width_chroma_ub[k], + v->SwathHeightY[k], + v->SwathHeightC[k], + v->HTotal[k] / v->PixelClock[k], + v->UrgentLatency, + v->CursorBufferSize, + v->CursorWidth[k][0], + v->CursorBPP[k][0], + v->VRatioPrefetchY[k], + v->VRatioPrefetchC[k], + v->BytePerPixelDETY[k], + v->BytePerPixelDETC[k], + v->DETBufferSizeY[k], + v->DETBufferSizeC[k], + &v->UrgBurstFactorCursorPre[k], + &v->UrgBurstFactorLumaPre[k], + &v->UrgBurstFactorChromaPre[k], + &v->NoUrgentLatencyHidingPre[k]); + + MaxTotalRDBandwidth = MaxTotalRDBandwidth + + dml_max3( + v->DPPPerPlane[k] * v->prefetch_vmrow_bw[k], + v->ReadBandwidthPlaneLuma[k] * v->UrgBurstFactorLuma[k] + + v->ReadBandwidthPlaneChroma[k] * v->UrgBurstFactorChroma[k] + + v->cursor_bw[k] * v->UrgBurstFactorCursor[k] + + v->DPPPerPlane[k] * (v->meta_row_bw[k] + v->dpte_row_bw[k]), + v->DPPPerPlane[k] + * (v->RequiredPrefetchPixDataBWLuma[k] * v->UrgBurstFactorLumaPre[k] + + v->RequiredPrefetchPixDataBWChroma[k] * v->UrgBurstFactorChromaPre[k]) + + v->cursor_bw_pre[k] * v->UrgBurstFactorCursorPre[k]); + + MaxTotalRDBandwidthNoUrgentBurst = MaxTotalRDBandwidthNoUrgentBurst + + dml_max3( + v->DPPPerPlane[k] * v->prefetch_vmrow_bw[k], + v->ReadBandwidthPlaneLuma[k] + v->ReadBandwidthPlaneChroma[k] + v->cursor_bw[k] + + v->DPPPerPlane[k] * (v->meta_row_bw[k] + v->dpte_row_bw[k]), + v->DPPPerPlane[k] * (v->RequiredPrefetchPixDataBWLuma[k] + v->RequiredPrefetchPixDataBWChroma[k]) + + v->cursor_bw_pre[k]); + +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: k=%0d DPPPerPlane=%d\n", __func__, k, v->DPPPerPlane[k]); + dml_print("DML::%s: k=%0d UrgBurstFactorLuma=%f\n", __func__, k, v->UrgBurstFactorLuma[k]); + dml_print("DML::%s: k=%0d UrgBurstFactorChroma=%f\n", __func__, k, v->UrgBurstFactorChroma[k]); + dml_print("DML::%s: k=%0d UrgBurstFactorLumaPre=%f\n", __func__, k, v->UrgBurstFactorLumaPre[k]); + dml_print("DML::%s: k=%0d UrgBurstFactorChromaPre=%f\n", __func__, k, v->UrgBurstFactorChromaPre[k]); + + dml_print("DML::%s: k=%0d VRatioPrefetchY=%f\n", __func__, k, v->VRatioPrefetchY[k]); + dml_print("DML::%s: k=%0d VRatioY=%f\n", __func__, k, v->VRatio[k]); + + dml_print("DML::%s: k=%0d prefetch_vmrow_bw=%f\n", __func__, k, v->prefetch_vmrow_bw[k]); + dml_print("DML::%s: k=%0d ReadBandwidthPlaneLuma=%f\n", __func__, k, v->ReadBandwidthPlaneLuma[k]); + dml_print("DML::%s: k=%0d ReadBandwidthPlaneChroma=%f\n", __func__, k, v->ReadBandwidthPlaneChroma[k]); + dml_print("DML::%s: k=%0d cursor_bw=%f\n", __func__, k, v->cursor_bw[k]); + dml_print("DML::%s: k=%0d meta_row_bw=%f\n", __func__, k, v->meta_row_bw[k]); + dml_print("DML::%s: k=%0d dpte_row_bw=%f\n", __func__, k, v->dpte_row_bw[k]); + dml_print("DML::%s: k=%0d RequiredPrefetchPixDataBWLuma=%f\n", __func__, k, v->RequiredPrefetchPixDataBWLuma[k]); + dml_print("DML::%s: k=%0d RequiredPrefetchPixDataBWChroma=%f\n", __func__, k, v->RequiredPrefetchPixDataBWChroma[k]); + dml_print("DML::%s: k=%0d cursor_bw_pre=%f\n", __func__, k, v->cursor_bw_pre[k]); + dml_print("DML::%s: k=%0d MaxTotalRDBandwidthNoUrgentBurst=%f\n", __func__, k, MaxTotalRDBandwidthNoUrgentBurst); +#endif + + if (v->DestinationLinesForPrefetch[k] < 2) + DestinationLineTimesForPrefetchLessThan2 = true; + + if (v->VRatioPrefetchY[k] > 4 || v->VRatioPrefetchC[k] > 4) + VRatioPrefetchMoreThan4 = true; + + if (v->NoUrgentLatencyHiding[k] == true) + v->NoEnoughUrgentLatencyHiding = true; + + if (v->NoUrgentLatencyHidingPre[k] == true) + v->NoEnoughUrgentLatencyHidingPre = true; + } + + v->FractionOfUrgentBandwidth = MaxTotalRDBandwidthNoUrgentBurst / v->ReturnBW; + +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: MaxTotalRDBandwidthNoUrgentBurst=%f\n", __func__, MaxTotalRDBandwidthNoUrgentBurst); + dml_print("DML::%s: ReturnBW=%f\n", __func__, v->ReturnBW); + dml_print("DML::%s: FractionOfUrgentBandwidth=%f\n", __func__, v->FractionOfUrgentBandwidth); +#endif + + if (MaxTotalRDBandwidth <= v->ReturnBW && v->NoEnoughUrgentLatencyHiding == 0 && v->NoEnoughUrgentLatencyHidingPre == 0 + && !VRatioPrefetchMoreThan4 && !DestinationLineTimesForPrefetchLessThan2) + v->PrefetchModeSupported = true; + else { + v->PrefetchModeSupported = false; + dml_print("DML::%s: ***failed***. Bandwidth violation. Results are NOT valid\n", __func__); + dml_print("DML::%s: MaxTotalRDBandwidth:%f AvailReturnBandwidth:%f\n", __func__, MaxTotalRDBandwidth, v->ReturnBW); + dml_print("DML::%s: VRatioPrefetch %s more than 4\n", __func__, (VRatioPrefetchMoreThan4) ? "is" : "is not"); + dml_print("DML::%s: DestinationLines for Prefetch %s less than 2\n", __func__, (DestinationLineTimesForPrefetchLessThan2) ? "is" : "is not"); + } + + // PREVIOUS_ERROR + // This error result check was done after the PrefetchModeSupported. So we will + // still try to calculate flip schedule even prefetch mode not supported + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + if (v->ErrorResult[k] == true || v->NotEnoughTimeForDynamicMetadata[k] == true) { + v->PrefetchModeSupported = false; + dml_print("DML::%s: ***failed***. Prefetch schedule violation. Results are NOT valid\n", __func__); + } + } + + if (v->PrefetchModeSupported == true && v->ImmediateFlipSupport == true) { + v->BandwidthAvailableForImmediateFlip = v->ReturnBW; + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + v->BandwidthAvailableForImmediateFlip = v->BandwidthAvailableForImmediateFlip + - dml_max( + v->ReadBandwidthPlaneLuma[k] * v->UrgBurstFactorLuma[k] + + v->ReadBandwidthPlaneChroma[k] * v->UrgBurstFactorChroma[k] + + v->cursor_bw[k] * v->UrgBurstFactorCursor[k], + v->DPPPerPlane[k] + * (v->RequiredPrefetchPixDataBWLuma[k] * v->UrgBurstFactorLumaPre[k] + + v->RequiredPrefetchPixDataBWChroma[k] * v->UrgBurstFactorChromaPre[k]) + + v->cursor_bw_pre[k] * v->UrgBurstFactorCursorPre[k]); + } + + v->TotImmediateFlipBytes = 0; + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + v->TotImmediateFlipBytes = v->TotImmediateFlipBytes + + v->DPPPerPlane[k] * (v->PDEAndMetaPTEBytesFrame[k] + v->MetaRowByte[k] + v->PixelPTEBytesPerRow[k]); + } + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + CalculateFlipSchedule( + mode_lib, + HostVMInefficiencyFactor, + v->UrgentExtraLatency, + v->UrgentLatency, + v->GPUVMMaxPageTableLevels, + v->HostVMEnable, + v->HostVMMaxNonCachedPageTableLevels, + v->GPUVMEnable, + v->HostVMMinPageSize, + v->PDEAndMetaPTEBytesFrame[k], + v->MetaRowByte[k], + v->PixelPTEBytesPerRow[k], + v->BandwidthAvailableForImmediateFlip, + v->TotImmediateFlipBytes, + v->SourcePixelFormat[k], + v->HTotal[k] / v->PixelClock[k], + v->VRatio[k], + v->VRatioChroma[k], + v->Tno_bw[k], + v->DCCEnable[k], + v->dpte_row_height[k], + v->meta_row_height[k], + v->dpte_row_height_chroma[k], + v->meta_row_height_chroma[k], + &v->DestinationLinesToRequestVMInImmediateFlip[k], + &v->DestinationLinesToRequestRowInImmediateFlip[k], + &v->final_flip_bw[k], + &v->ImmediateFlipSupportedForPipe[k]); + } + + v->total_dcn_read_bw_with_flip = 0.0; + v->total_dcn_read_bw_with_flip_no_urgent_burst = 0.0; + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + v->total_dcn_read_bw_with_flip = v->total_dcn_read_bw_with_flip + + dml_max3( + v->DPPPerPlane[k] * v->prefetch_vmrow_bw[k], + v->DPPPerPlane[k] * v->final_flip_bw[k] + + v->ReadBandwidthLuma[k] * v->UrgBurstFactorLuma[k] + + v->ReadBandwidthChroma[k] * v->UrgBurstFactorChroma[k] + + v->cursor_bw[k] * v->UrgBurstFactorCursor[k], + v->DPPPerPlane[k] + * (v->final_flip_bw[k] + + v->RequiredPrefetchPixDataBWLuma[k] * v->UrgBurstFactorLumaPre[k] + + v->RequiredPrefetchPixDataBWChroma[k] * v->UrgBurstFactorChromaPre[k]) + + v->cursor_bw_pre[k] * v->UrgBurstFactorCursorPre[k]); + v->total_dcn_read_bw_with_flip_no_urgent_burst = v->total_dcn_read_bw_with_flip_no_urgent_burst + + dml_max3( + v->DPPPerPlane[k] * v->prefetch_vmrow_bw[k], + v->DPPPerPlane[k] * v->final_flip_bw[k] + v->ReadBandwidthPlaneLuma[k] + + v->ReadBandwidthPlaneChroma[k] + v->cursor_bw[k], + v->DPPPerPlane[k] + * (v->final_flip_bw[k] + v->RequiredPrefetchPixDataBWLuma[k] + + v->RequiredPrefetchPixDataBWChroma[k]) + v->cursor_bw_pre[k]); + } + v->FractionOfUrgentBandwidthImmediateFlip = v->total_dcn_read_bw_with_flip_no_urgent_burst / v->ReturnBW; + + v->ImmediateFlipSupported = true; + if (v->total_dcn_read_bw_with_flip > v->ReturnBW) { +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: total_dcn_read_bw_with_flip %f (bw w/ flip too high!)\n", __func__, v->total_dcn_read_bw_with_flip); +#endif + v->ImmediateFlipSupported = false; + v->total_dcn_read_bw_with_flip = MaxTotalRDBandwidth; + } + for (k = 0; k < v->NumberOfActivePlanes; ++k) { + if (v->ImmediateFlipSupportedForPipe[k] == false) { +#ifdef __DML_VBA_DEBUG__ + dml_print("DML::%s: Pipe %0d not supporing iflip\n", __func__, k); +#endif + v->ImmediateFlipSupported = false; + }
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.h new file +44 -0
44 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml/dcn314/display_rq_dlg_calc_314.c new file +1733 -0
1,733 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml/dcn314/display_rq_dlg_calc_314.h new file +70 -0
70 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.35.3
Part of the diff is not shown here. View the raw message.
Alex Deucher
maintainerPATCH 6/9 drm/amd/display: Add DCN314 version identifiers
In reply to Alex DeucherFrom: Roman Li <[email protected]>
DCN 3.1.4 version and family ids
--- drivers/gpu/drm/amd/display/dmub/dmub_srv.h | 1 + drivers/gpu/drm/amd/display/include/dal_asic_id.h | 1 + drivers/gpu/drm/amd/display/include/dal_types.h | 1 + 3 files changed, 3 insertions(+)
drivers/gpu/drm/amd/display/dmub/dmub_srv.h +1 -0
@@ -98,6 +98,7 @@ enum dmub_asic {DMUB_ASIC_DCN303 ,DMUB_ASIC_DCN31 ,DMUB_ASIC_DCN31B , +DMUB_ASIC_DCN314 ,DMUB_ASIC_DCN315 ,DMUB_ASIC_DCN316 , DMUB_ASIC_DCN32,
drivers/gpu/drm/amd/display/include/dal_asic_id.h +1 -0
@@ -244,6 +244,7 @@ enum {#define ASICREV_IS_GC_10_3_7 (eChipRev) ((eChipRev >= GC_10_3_7_A0) && (eChipRev < GC_10_3_7_UNKNOWN))#define AMDGPU_FAMILY_GC_11_0_0 145 +#define AMDGPU_FAMILY_GC_11_0_2 148#define GC_11_0_0_A0 0x1#define GC_11_0_2_A0 0x10#define GC_11_UNKNOWN 0xFF
drivers/gpu/drm/amd/display/include/dal_types.h +1 -0
@@ -57,6 +57,7 @@ enum dce_version {DCN_VERSION_3_02 ,DCN_VERSION_3_03 ,DCN_VERSION_3_1 , +DCN_VERSION_3_14 ,DCN_VERSION_3_15 ,DCN_VERSION_3_16 , DCN_VERSION_3_2,
Signature · 1 line
2.35.3
Alex Deucher
maintainerPATCH 7/9 drm/amd/display: Enable DCN314 in DC
In reply to Alex DeucherFrom: Roman Li <[email protected]>
Add support for DCN 3.1.4 in Display Core
--- drivers/gpu/drm/amd/display/dc/Makefile | 1 + .../display/dc/bios/command_table_helper2.c | 1 + .../gpu/drm/amd/display/dc/clk_mgr/Makefile | 9 + .../gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c | 22 +- drivers/gpu/drm/amd/display/dc/core/dc.c | 4 + drivers/gpu/drm/amd/display/dc/core/dc_link.c | 1 + .../gpu/drm/amd/display/dc/core/dc_resource.c | 8 + .../drm/amd/display/dc/dce/dce_clock_source.h | 5 +- .../gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c | 17 +- .../gpu/drm/amd/display/dc/dcn20/dcn20_dsc.h | 219 ++++++++++++++++++ .../gpu/drm/amd/display/dc/dcn31/dcn31_dccg.c | 16 +- .../gpu/drm/amd/display/dc/dcn31/dcn31_dccg.h | 35 +++ .../display/dc/dcn31/dcn31_dio_link_encoder.h | 28 +++ .../drm/amd/display/dc/dcn31/dcn31_resource.c | 3 + .../gpu/drm/amd/display/dc/gpio/hw_factory.c | 1 + .../drm/amd/display/dc/gpio/hw_translate.c | 1 + drivers/gpu/drm/amd/display/dc/irq/Makefile | 10 + 17 files changed, 366 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/display/dc/Makefile +1 -0
@@ -60,6 +60,7 @@ DC_LIBS += dcn301 DC_LIBS += dcn302 DC_LIBS += dcn303 DC_LIBS += dcn31 +DC_LIBS += dcn314 DC_LIBS += dcn315 DC_LIBS += dcn316 DC_LIBS += dcn32
drivers/gpu/drm/amd/display/dc/bios/command_table_helper2.c +1 -0
@@ -75,6 +75,7 @@ bool dal_bios_parser_init_cmd_tbl_helper2(case DCN_VERSION_3_02 :case DCN_VERSION_3_03 :case DCN_VERSION_3_1 : +case DCN_VERSION_3_14 :case DCN_VERSION_3_15 :case DCN_VERSION_3_16 :case DCN_VERSION_3_2 :
drivers/gpu/drm/amd/display/dc/clk_mgr/Makefile +9 -0
@@ -154,6 +154,15 @@ AMD_DAL_CLK_MGR_DCN31 = $(addprefix $(AMDDALPATH)/dc/clk_mgr/dcn31/,$(CLK_MGR_DC AMD_DISPLAY_FILES += $(AMD_DAL_CLK_MGR_DCN31) +############################################################################### +# DCN314 +############################################################################### +CLK_MGR_DCN314 = dcn314_smu.o dcn314_clk_mgr.o + +AMD_DAL_CLK_MGR_DCN314 = $(addprefix $(AMDDALPATH)/dc/clk_mgr/dcn314/,$(CLK_MGR_DCN314)) + +AMD_DISPLAY_FILES += $(AMD_DAL_CLK_MGR_DCN314) + ############################################################################### # DCN315 ###############################################################################
drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c +21 -1
@@ -43,11 +43,11 @@#include "dcn30/dcn30_clk_mgr.h" #include "dcn301/vg_clk_mgr.h" #include "dcn31/dcn31_clk_mgr.h" +#include "dcn314/dcn314_clk_mgr.h" #include "dcn315/dcn315_clk_mgr.h" #include "dcn316/dcn316_clk_mgr.h" #include "dcn32/dcn32_clk_mgr.h" -int clk_mgr_helper_get_active_display_cnt (struct dc *dc,struct dc_state *context)
@@ -287,6 +287,7 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *preturn &clk_mgr->base.base; }break ; +case FAMILY_YELLOW_CARP : {struct clk_mgr_dcn31 *clk_mgr =kzalloc (sizeof (*clk_mgr),GFP_KERNEL );
@@ -335,6 +336,20 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *preturn &clk_mgr->base; break; } + +case AMDGPU_FAMILY_GC_11_0_2 : { +struct clk_mgr_dcn314 *clk_mgr =kzalloc (sizeof (*clk_mgr),GFP_KERNEL ); + +if (clk_mgr ==NULL ) { +BREAK_TO_DEBUGGER (); +return NULL ; + } + +dcn314_clk_mgr_construct (ctx, clk_mgr, pp_smu, dccg); +return &clk_mgr->base.base; + } +break ; +#endif default :ASSERT (0 );/* Unknown Asic */
@@ -381,6 +396,11 @@ void dc_destroy_clk_mgr(struct clk_mgr *clk_mgr_base)case AMDGPU_FAMILY_GC_11_0_0 :dcn32_clk_mgr_destroy (clk_mgr);break ; + +case AMDGPU_FAMILY_GC_11_0_2 : +dcn314_clk_mgr_destroy (clk_mgr); +break ; +default :break ; }
drivers/gpu/drm/amd/display/dc/core/dc.c +4 -0
@@ -4167,6 +4167,10 @@ bool dc_is_dmub_outbox_supported(struct dc *dc) !dc->debug.dpia_debug.bits.disable_dpia)return true; +if (dc->ctx->asic_id.chip_family ==AMDGPU_FAMILY_GC_11_0_2 && + !dc->debug.dpia_debug.bits.disable_dpia) +return true; +/* dmub aux needs dmub notifications to be enabled */ return dc->debug.enable_dmub_aux_for_legacy_ddc; }
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1 -0
@@ -3368,6 +3368,7 @@ bool dc_link_setup_psr(struct dc_link *link,switch (link->ctx->asic_id.chip_family) {case FAMILY_YELLOW_CARP :case AMDGPU_FAMILY_GC_10_3_6 : +case AMDGPU_FAMILY_GC_11_0_2 :if (!dc->debug.disable_z10) psr_context->psr_level.bits.SKIP_CRTC_DISABLE = false;break ;
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +8 -0
@@ -63,6 +63,7 @@#include "dcn302/dcn302_resource.h" #include "dcn303/dcn303_resource.h" #include "dcn31/dcn31_resource.h" +#include "dcn314/dcn314_resource.h" #include "dcn315/dcn315_resource.h" #include "dcn316/dcn316_resource.h" #include "../dcn32/dcn32_resource.h"
@@ -167,6 +168,10 @@ enum dce_version resource_parse_asic_id(struct hw_asic_id asic_id)if (ASICREV_IS_GC_11_0_2 (asic_id.hw_internal_rev)) dc_version =DCN_VERSION_3_21 ;break ; +case AMDGPU_FAMILY_GC_11_0_2 : +if (ASICREV_IS_GC_11_0_2 (asic_id.hw_internal_rev)) + dc_version =DCN_VERSION_3_14 ; +break ;default : dc_version =DCE_VERSION_UNKNOWN ;break ;
@@ -256,6 +261,9 @@ struct resource_pool *dc_create_resource_pool(struct dc *dc,case DCN_VERSION_3_1 : res_pool =dcn31_create_resource_pool (init_data, dc);break ; +case DCN_VERSION_3_14 : + res_pool =dcn314_create_resource_pool (init_data, dc); +break ;case DCN_VERSION_3_15 : res_pool =dcn315_create_resource_pool (init_data, dc);break ;
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.h +4 -1
@@ -157,13 +157,16 @@SRII (PIXEL_RATE_CNTL ,OTG ,0 ),\ SRII(PIXEL_RATE_CNTL, OTG, 1) -#define CS_COMMON_MASK_SH_LIST_DCN2_0 (mask_sh)\ CS_SF(DP_DTO0_PHASE, DP_DTO0_PHASE, mask_sh),\ CS_SF(DP_DTO0_MODULO, DP_DTO0_MODULO, mask_sh),\ CS_SF(PHYPLLA_PIXCLK_RESYNC_CNTL, PHYPLLA_DCCG_DEEP_COLOR_CNTL, mask_sh),\ CS_SF(OTG0_PIXEL_RATE_CNTL, DP_DTO0_ENABLE, mask_sh) +#define CS_COMMON_MASK_SH_LIST_DCN3_1_4 (mask_sh)\ + CS_COMMON_MASK_SH_LIST_DCN2_0(mask_sh),\ + CS_SF(OTG0_PIXEL_RATE_CNTL, PIPE0_DTO_SRC_SEL, mask_sh), +#define CS_COMMON_MASK_SH_LIST_DCN3_2 (mask_sh)\ CS_COMMON_MASK_SH_LIST_DCN2_0(mask_sh),\ CS_SF(OTG0_PIXEL_RATE_CNTL, PIPE0_DTO_SRC_SEL, mask_sh)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c +12 -5
@@ -573,11 +573,18 @@ static void dsc_write_to_registers(struct display_stream_compressor *dsc, const PIC_HEIGHT, reg_vals->pps.pic_height);// dscc registers -REG_SET_4 (DSCC_CONFIG0 ,0 , -ICH_RESET_AT_END_OF_LINE , reg_vals->ich_reset_at_eol, -NUMBER_OF_SLICES_PER_LINE , reg_vals->num_slices_h -1 , -ALTERNATE_ICH_ENCODING_EN , reg_vals->alternate_ich_encoding_en, -NUMBER_OF_SLICES_IN_VERTICAL_DIRECTION , reg_vals->num_slices_v -1 ); +if (dsc20->dsc_mask->ICH_RESET_AT_END_OF_LINE ==0 ) { +REG_SET_3 (DSCC_CONFIG0 ,0 , +NUMBER_OF_SLICES_PER_LINE , reg_vals->num_slices_h -1 , +ALTERNATE_ICH_ENCODING_EN , reg_vals->alternate_ich_encoding_en, +NUMBER_OF_SLICES_IN_VERTICAL_DIRECTION , reg_vals->num_slices_v -1 ); + }else { +REG_SET_4 (DSCC_CONFIG0 ,0 ,ICH_RESET_AT_END_OF_LINE , + reg_vals->ich_reset_at_eol,NUMBER_OF_SLICES_PER_LINE , + reg_vals->num_slices_h -1 ,ALTERNATE_ICH_ENCODING_EN , + reg_vals->alternate_ich_encoding_en,NUMBER_OF_SLICES_IN_VERTICAL_DIRECTION , + reg_vals->num_slices_v -1 ); + }REG_SET (DSCC_CONFIG1 ,0 ,DSCC_RATE_CONTROL_BUFFER_MODEL_SIZE , reg_vals->rc_buffer_model_size);
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.h +219 -0
225 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_dccg.c +8 -8
@@ -43,7 +43,7 @@#define DC_LOGGER \ dccg->ctx->logger -static void dccg31_update_dpp_dto (struct dccg *dccg,int dpp_inst,int req_dppclk) +void dccg31_update_dpp_dto (struct dccg *dccg,int dpp_inst,int req_dppclk) {struct dcn_dccg *dccg_dcn =TO_DCN_DCCG (dccg);
@@ -338,7 +338,7 @@ void dccg31_disable_symclk32_le( } } -static void dccg31_disable_dscclk (struct dccg *dccg,int inst) +void dccg31_disable_dscclk (struct dccg *dccg,int inst) {struct dcn_dccg *dccg_dcn =TO_DCN_DCCG (dccg);
@@ -373,7 +373,7 @@ static void dccg31_disable_dscclk(struct dccg *dccg, int inst) } } -static void dccg31_enable_dscclk (struct dccg *dccg,int inst) +void dccg31_enable_dscclk (struct dccg *dccg,int inst) {struct dcn_dccg *dccg_dcn =TO_DCN_DCCG (dccg);
@@ -510,7 +510,7 @@ void dccg31_set_physymclk( }/* Controls the generation of pixel valid for OTG in (OTG -> HPO case) */ -static void dccg31_set_dtbclk_dto ( +void dccg31_set_dtbclk_dto (struct dccg *dccg,const struct dtbclk_dto_params *params) {
@@ -608,7 +608,7 @@ void dccg31_set_audio_dtbclk_dto( } } -static void dccg31_get_dccg_ref_freq (struct dccg *dccg, +void dccg31_get_dccg_ref_freq (struct dccg *dccg,unsigned int xtalin_freq_inKhz,unsigned int *dccg_ref_freq_inKhz) {
@@ -620,7 +620,7 @@ static void dccg31_get_dccg_ref_freq(struct dccg *dccg,return ; } -static void dccg31_set_dispclk_change_mode ( +void dccg31_set_dispclk_change_mode (struct dccg *dccg,enum dentist_dispclk_change_mode change_mode) {
@@ -662,7 +662,7 @@ void dccg31_init(struct dccg *dccg) } } -static void dccg31_otg_add_pixel (struct dccg *dccg, +void dccg31_otg_add_pixel (struct dccg *dccg,uint32_t otg_inst) {struct dcn_dccg *dccg_dcn =TO_DCN_DCCG (dccg);
@@ -671,7 +671,7 @@ static void dccg31_otg_add_pixel(struct dccg *dccg, OTG_ADD_PIXEL[otg_inst], 1); } -static void dccg31_otg_drop_pixel (struct dccg *dccg, +void dccg31_otg_drop_pixel (struct dccg *dccg,uint32_t otg_inst) {struct dcn_dccg *dccg_dcn =TO_DCN_DCCG (dccg);
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_dccg.h +35 -0
@@ -194,4 +194,39 @@ void dccg31_set_audio_dtbclk_dto(struct dccg *dccg, const struct dtbclk_dto_params *params); +void dccg31_update_dpp_dto ( +struct dccg *dccg, +int dpp_inst, +int req_dppclk); + +void dccg31_get_dccg_ref_freq ( +struct dccg *dccg, +unsigned int xtalin_freq_inKhz, +unsigned int *dccg_ref_freq_inKhz); + +void dccg31_set_dpstreamclk ( +struct dccg *dccg, +enum streamclk_source src, +int otg_inst); + +void dccg31_set_dtbclk_dto ( +struct dccg *dccg, +const struct dtbclk_dto_params *params); + +void dccg31_otg_add_pixel ( +struct dccg *dccg, +uint32_t otg_inst); + +void dccg31_otg_drop_pixel ( +struct dccg *dccg, +uint32_t otg_inst); + +void dccg31_set_dispclk_change_mode ( +struct dccg *dccg, +enum dentist_dispclk_change_mode change_mode); + +void dccg31_disable_dscclk (struct dccg *dccg,int inst); + +void dccg31_enable_dscclk (struct dccg *dccg,int inst); +#endif //__DCN31_DCCG_H__
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_dio_link_encoder.h +28 -0
@@ -198,6 +198,34 @@LE_SF (RDPCSTX0_RDPCSTX_PHY_FUSE3 ,RDPCS_PHY_DP_TX3_EQ_PRE , mask_sh),\ LE_SF(RDPCSTX0_RDPCSTX_PHY_FUSE3, RDPCS_PHY_DP_TX3_EQ_POST, mask_sh) +#define DPCS_DCN314_REG_LIST (id) \ + SRI(TMDS_CTL_BITS, DIG, id), \ + SRI(RDPCSTX_PHY_CNTL3, RDPCSTX, id), \ + SRI(RDPCSTX_PHY_CNTL4, RDPCSTX, id), \ + SRI(RDPCSTX_PHY_CNTL5, RDPCSTX, id), \ + SRI(RDPCSTX_PHY_CNTL7, RDPCSTX, id), \ + SRI(RDPCSTX_PHY_CNTL8, RDPCSTX, id), \ + SRI(RDPCSTX_PHY_CNTL9, RDPCSTX, id), \ + SRI(RDPCSTX_PHY_CNTL10, RDPCSTX, id), \ + SRI(RDPCSTX_PHY_CNTL11, RDPCSTX, id), \ + SRI(RDPCSTX_PHY_CNTL12, RDPCSTX, id), \ + SRI(RDPCSTX_PHY_CNTL13, RDPCSTX, id), \ + SRI(RDPCSTX_PHY_CNTL14, RDPCSTX, id), \ + SRI(RDPCSTX_CNTL, RDPCSTX, id), \ + SRI(RDPCSTX_CLOCK_CNTL, RDPCSTX, id), \ + SRI(RDPCSTX_INTERRUPT_CONTROL, RDPCSTX, id), \ + SRI(RDPCSTX_PHY_CNTL0, RDPCSTX, id), \ + SRI(RDPCSTX_PHY_CNTL2, RDPCSTX, id), \ + SRI(RDPCS_TX_CR_ADDR, RDPCSTX, id), \ + SRI(RDPCS_TX_CR_DATA, RDPCSTX, id), \ + SRI(RDPCSTX_PHY_FUSE0, RDPCSTX, id), \ + SRI(RDPCSTX_PHY_FUSE1, RDPCSTX, id), \ + SRI(RDPCSTX_PHY_FUSE2, RDPCSTX, id), \ + SRI(RDPCSTX_PHY_FUSE3, RDPCSTX, id), \ + SR(RDPCSTX0_RDPCSTX_SCRATCH), \ + SRI(RDPCSTX_PHY_RX_LD_VAL, RDPCSTX, id),\ + SRI(RDPCSTX_DMCU_DPALT_DIS_BLOCK_REG, RDPCSTX, id) + void dcn31_link_encoder_construct( struct dcn20_link_encoder *enc20, const struct encoder_init_data *init_data,
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c +3 -0
@@ -2162,6 +2162,9 @@ static bool dcn31_resource_construct( pool->base.usb4_dpia_count =4 ; } +if (dc->ctx->asic_id.chip_family ==AMDGPU_FAMILY_GC_11_0_2 ) + pool->base.usb4_dpia_count =4 ; +/* Audio, Stream Encoders including HPO and virtual, MPC 3D LUTs */ if (!resource_construct(num_virtual_links, dc, &pool->base, (!IS_FPGA_MAXIMUS_DC(dc->ctx->dce_environment) ?
drivers/gpu/drm/amd/display/dc/gpio/hw_factory.c +1 -0
@@ -100,6 +100,7 @@ bool dal_hw_factory_init(case DCN_VERSION_3_02 :case DCN_VERSION_3_03 :case DCN_VERSION_3_1 : +case DCN_VERSION_3_14 :case DCN_VERSION_3_16 :dal_hw_factory_dcn30_init (factory);return true;
drivers/gpu/drm/amd/display/dc/gpio/hw_translate.c +1 -0
@@ -101,6 +101,7 @@ bool dal_hw_translate_init(case DCN_VERSION_3_02 :case DCN_VERSION_3_03 :case DCN_VERSION_3_1 : +case DCN_VERSION_3_14 :case DCN_VERSION_3_16 :dal_hw_translate_dcn30_init (translate);return true;
drivers/gpu/drm/amd/display/dc/irq/Makefile +10 -0
@@ -135,6 +135,16 @@ IRQ_DCN31 = irq_service_dcn31.o AMD_DAL_IRQ_DCN31= $(addprefix $(AMDDALPATH)/dc/irq/dcn31/,$(IRQ_DCN31)) AMD_DISPLAY_FILES += $(AMD_DAL_IRQ_DCN31) + +############################################################################### +# DCN 314 +############################################################################### +IRQ_DCN314 = irq_service_dcn314.o + +AMD_DAL_IRQ_DCN314= $(addprefix $(AMDDALPATH)/dc/irq/dcn314/,$(IRQ_DCN314)) + +AMD_DISPLAY_FILES += $(AMD_DAL_IRQ_DCN314) + ############################################################################### # DCN 315 ###############################################################################
Signature · 1 line
2.35.3
Alex Deucher
maintainerPATCH 8/9 drm/amd/display: Add DMUB support for DCN314
In reply to Alex DeucherFrom: Roman Li <[email protected]>
Initialize DMUB for DCN 3.1.4.
Use same funcs as DCN31.
--- drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c +1 -0
@@ -223,6 +223,7 @@ static bool dmub_srv_hw_setup(struct dmub_srv *dmub, enum dmub_asic asic)case DMUB_ASIC_DCN31 :case DMUB_ASIC_DCN31B : +case DMUB_ASIC_DCN314 :case DMUB_ASIC_DCN315 :case DMUB_ASIC_DCN316 :if (asic ==DMUB_ASIC_DCN315 )
Signature · 1 line
2.35.3
Alex Deucher
maintainerPATCH 9/9 drm/amd/display: Enable DCN314 in DM
In reply to Alex DeucherFrom: Roman Li <[email protected]>
Add support for DCN 3.1.4 in Display Manager
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 11 +++++++++++ .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c | 1 + 2 files changed, 12 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +11 -0
@@ -116,6 +116,8 @@ MODULE_FIRMWARE(FIRMWARE_DIMGREY_CAVEFISH_DMUB);MODULE_FIRMWARE (FIRMWARE_BEIGE_GOBY_DMUB );#define FIRMWARE_YELLOW_CARP_DMUB "amdgpu/yellow_carp_dmcub.bin"MODULE_FIRMWARE (FIRMWARE_YELLOW_CARP_DMUB ); +#define FIRMWARE_DCN_314_DMUB "amdgpu/dcn_3_1_4_dmcub.bin" +MODULE_FIRMWARE (FIRMWARE_DCN_314_DMUB );#define FIRMWARE_DCN_315_DMUB "amdgpu/dcn_3_1_5_dmcub.bin"MODULE_FIRMWARE (FIRMWARE_DCN_315_DMUB );#define FIRMWARE_DCN316_DMUB "amdgpu/dcn_3_1_6_dmcub.bin"
@@ -1941,6 +1943,10 @@ static int dm_dmub_sw_init(struct amdgpu_device *adev) dmub_asic = (adev->external_rev_id ==YELLOW_CARP_B0 ) ?DMUB_ASIC_DCN31B :DMUB_ASIC_DCN31 ; fw_name_dmub =FIRMWARE_YELLOW_CARP_DMUB ;break ; +case IP_VERSION (3 ,1 ,4 ): + dmub_asic =DMUB_ASIC_DCN314 ; + fw_name_dmub =FIRMWARE_DCN_314_DMUB ; +break ;case IP_VERSION (3 ,1 ,5 ): dmub_asic =DMUB_ASIC_DCN315 ; fw_name_dmub =FIRMWARE_DCN_315_DMUB ;
@@ -4222,6 +4228,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)case IP_VERSION (3 ,0 ,0 ):case IP_VERSION (3 ,1 ,2 ):case IP_VERSION (3 ,1 ,3 ): +case IP_VERSION (3 ,1 ,4 ):case IP_VERSION (3 ,1 ,5 ):case IP_VERSION (3 ,1 ,6 ):case IP_VERSION (3 ,2 ,0 ):
@@ -4242,6 +4249,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)switch (adev->ip_versions[DCE_HWIP ][0 ]) {case IP_VERSION (3 ,1 ,2 ):case IP_VERSION (3 ,1 ,3 ): +case IP_VERSION (3 ,1 ,4 ):case IP_VERSION (3 ,1 ,5 ):case IP_VERSION (3 ,1 ,6 ):case IP_VERSION (3 ,2 ,0 ):
@@ -4358,6 +4366,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)case IP_VERSION (3 ,0 ,1 ):case IP_VERSION (3 ,1 ,2 ):case IP_VERSION (3 ,1 ,3 ): +case IP_VERSION (3 ,1 ,4 ):case IP_VERSION (3 ,1 ,5 ):case IP_VERSION (3 ,1 ,6 ):case IP_VERSION (3 ,2 ,0 ):
@@ -4546,6 +4555,7 @@ static int dm_early_init(void *handle)case IP_VERSION (2 ,1 ,0 ):case IP_VERSION (3 ,1 ,2 ):case IP_VERSION (3 ,1 ,3 ): +case IP_VERSION (3 ,1 ,4 ):case IP_VERSION (3 ,1 ,5 ):case IP_VERSION (3 ,1 ,6 ):case IP_VERSION (3 ,2 ,0 ):
@@ -5296,6 +5306,7 @@ get_plane_modifiers(struct amdgpu_device *adev, unsigned int plane_type, uint64_add_gfx10_1_modifiers (adev, mods, &size, &capacity);break ;case AMDGPU_FAMILY_GC_11_0_0 : +case AMDGPU_FAMILY_GC_11_0_2 :add_gfx11_modifiers (adev, mods, &size, &capacity);break ; }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c +1 -0
@@ -667,6 +667,7 @@ struct hdcp_workqueue *hdcp_create_workqueue(struct amdgpu_device *adev, struct hdcp_work[i].hdcp.config.psp.handle = &adev->psp;if (dc->ctx->dce_version ==DCN_VERSION_3_1 || + dc->ctx->dce_version ==DCN_VERSION_3_14 || dc->ctx->dce_version ==DCN_VERSION_3_15 || dc->ctx->dce_version ==DCN_VERSION_3_16 ) hdcp_work[i].hdcp.config.psp.caps.dtm_v3_supported =1 ;
Signature · 1 line
2.35.3