summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/display/dc/dml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 17:35:05 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 17:39:31 +0000
commit85c675d0d09a45a135bddd15d7b385f8758c32fb (patch)
tree76267dbc9b9a130337be3640948fe397b04ac629 /drivers/gpu/drm/amd/display/dc/dml
parentAdding upstream version 6.6.15. (diff)
downloadlinux-85c675d0d09a45a135bddd15d7b385f8758c32fb.tar.xz
linux-85c675d0d09a45a135bddd15d7b385f8758c32fb.zip
Adding upstream version 6.7.7.upstream/6.7.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'drivers/gpu/drm/amd/display/dc/dml')
-rw-r--r--drivers/gpu/drm/amd/display/dc/dml/Makefile11
-rw-r--r--drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c189
-rw-r--r--drivers/gpu/drm/amd/display/dc/dml/calcs/calcs_logger.h578
-rw-r--r--drivers/gpu/drm/amd/display/dc/dml/calcs/custom_float.c197
-rw-r--r--drivers/gpu/drm/amd/display/dc/dml/calcs/dce_calcs.c3623
-rw-r--r--drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c31
-rw-r--r--drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.h10
-rw-r--r--drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c2
-rw-r--r--drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c2
-rw-r--r--drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c819
-rw-r--r--drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.h3
-rw-r--r--drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c3
-rw-r--r--drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c37
-rw-r--r--drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h1
-rw-r--r--drivers/gpu/drm/amd/display/dc/dml/dcn321/dcn321_fpu.c81
-rw-r--r--drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.c589
-rw-r--r--drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.h44
17 files changed, 1355 insertions, 4865 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile
index c206812dc..59ade76ff 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile
@@ -72,11 +72,11 @@ CFLAGS_$(AMDDALPATH)/dc/dml/display_mode_lib.o := $(dml_ccflags)
CFLAGS_$(AMDDALPATH)/dc/dml/display_mode_vba.o := $(dml_ccflags)
CFLAGS_$(AMDDALPATH)/dc/dml/dcn10/dcn10_fpu.o := $(dml_ccflags)
CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/dcn20_fpu.o := $(dml_ccflags)
-CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_mode_vba_20.o := $(dml_ccflags)
+CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_mode_vba_20.o := $(dml_ccflags) $(frame_warn_flag)
CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_rq_dlg_calc_20.o := $(dml_ccflags)
-CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_mode_vba_20v2.o := $(dml_ccflags)
+CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_mode_vba_20v2.o := $(dml_ccflags) $(frame_warn_flag)
CFLAGS_$(AMDDALPATH)/dc/dml/dcn20/display_rq_dlg_calc_20v2.o := $(dml_ccflags)
-CFLAGS_$(AMDDALPATH)/dc/dml/dcn21/display_mode_vba_21.o := $(dml_ccflags)
+CFLAGS_$(AMDDALPATH)/dc/dml/dcn21/display_mode_vba_21.o := $(dml_ccflags) $(frame_warn_flag)
CFLAGS_$(AMDDALPATH)/dc/dml/dcn21/display_rq_dlg_calc_21.o := $(dml_ccflags)
CFLAGS_$(AMDDALPATH)/dc/dml/dcn30/display_mode_vba_30.o := $(dml_ccflags) $(frame_warn_flag)
CFLAGS_$(AMDDALPATH)/dc/dml/dcn30/display_rq_dlg_calc_30.o := $(dml_ccflags)
@@ -91,6 +91,7 @@ CFLAGS_$(AMDDALPATH)/dc/dml/dcn32/display_mode_vba_32.o := $(dml_ccflags) $(fram
CFLAGS_$(AMDDALPATH)/dc/dml/dcn32/display_rq_dlg_calc_32.o := $(dml_ccflags)
CFLAGS_$(AMDDALPATH)/dc/dml/dcn32/display_mode_vba_util_32.o := $(dml_ccflags) $(frame_warn_flag)
CFLAGS_$(AMDDALPATH)/dc/dml/dcn321/dcn321_fpu.o := $(dml_ccflags)
+CFLAGS_$(AMDDALPATH)/dc/dml/dcn35/dcn35_fpu.o := $(dml_ccflags)
CFLAGS_$(AMDDALPATH)/dc/dml/dcn31/dcn31_fpu.o := $(dml_ccflags)
CFLAGS_$(AMDDALPATH)/dc/dml/dcn301/dcn301_fpu.o := $(dml_ccflags)
CFLAGS_$(AMDDALPATH)/dc/dml/dcn302/dcn302_fpu.o := $(dml_ccflags)
@@ -124,6 +125,7 @@ CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/dcn314/dcn314_fpu.o := $(dml_rcflags)
CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/dcn30/dcn30_fpu.o := $(dml_rcflags)
CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/dcn32/dcn32_fpu.o := $(dml_rcflags)
CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/dcn321/dcn321_fpu.o := $(dml_rcflags)
+CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/dcn35/dcn35_fpu.o := $(dml_rcflags)
CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/dcn31/dcn31_fpu.o := $(dml_rcflags)
CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/dcn302/dcn302_fpu.o := $(dml_rcflags)
CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/dcn303/dcn303_fpu.o := $(dml_rcflags)
@@ -136,8 +138,6 @@ CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/calcs/dcn_calcs.o := $(dml_rcflags)
CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/calcs/dcn_calc_auto.o := $(dml_rcflags)
CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml/calcs/dcn_calc_math.o := $(dml_rcflags)
-DML = calcs/dce_calcs.o calcs/custom_float.o calcs/bw_fixed.o
-
ifdef CONFIG_DRM_AMD_DC_FP
DML += display_mode_lib.o display_rq_dlg_helpers.o dml1_display_rq_dlg_calc.o
DML += dcn10/dcn10_fpu.o
@@ -156,6 +156,7 @@ DML += dcn301/dcn301_fpu.o
DML += dcn302/dcn302_fpu.o
DML += dcn303/dcn303_fpu.o
DML += dcn314/dcn314_fpu.o
+DML += dcn35/dcn35_fpu.o
DML += dsc/rc_calc_fpu.o
DML += calcs/dcn_calcs.o calcs/dcn_calc_math.o calcs/dcn_calc_auto.o
endif
diff --git a/drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c b/drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c
deleted file mode 100644
index 3aa8dd0ac..000000000
--- a/drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright 2015 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 "bw_fixed.h"
-
-#define MAX_I64 \
- ((int64_t)((1ULL << 63) - 1))
-
-#define MIN_I64 \
- (-MAX_I64 - 1)
-
-#define FRACTIONAL_PART_MASK \
- ((1ULL << BW_FIXED_BITS_PER_FRACTIONAL_PART) - 1)
-
-#define GET_FRACTIONAL_PART(x) \
- (FRACTIONAL_PART_MASK & (x))
-
-static uint64_t abs_i64(int64_t arg)
-{
- if (arg >= 0)
- return (uint64_t)(arg);
- else
- return (uint64_t)(-arg);
-}
-
-struct bw_fixed bw_int_to_fixed_nonconst(int64_t value)
-{
- struct bw_fixed res;
-
- ASSERT(value < BW_FIXED_MAX_I32 && value > BW_FIXED_MIN_I32);
- res.value = value << BW_FIXED_BITS_PER_FRACTIONAL_PART;
- return res;
-}
-
-struct bw_fixed bw_frc_to_fixed(int64_t numerator, int64_t denominator)
-{
- struct bw_fixed res;
- bool arg1_negative = numerator < 0;
- bool arg2_negative = denominator < 0;
- uint64_t arg1_value;
- uint64_t arg2_value;
- uint64_t remainder;
-
- /* determine integer part */
- uint64_t res_value;
-
- ASSERT(denominator != 0);
-
- arg1_value = abs_i64(numerator);
- arg2_value = abs_i64(denominator);
- res_value = div64_u64_rem(arg1_value, arg2_value, &remainder);
-
- ASSERT(res_value <= BW_FIXED_MAX_I32);
-
- /* determine fractional part */
- {
- uint32_t i = BW_FIXED_BITS_PER_FRACTIONAL_PART;
-
- do {
- remainder <<= 1;
-
- res_value <<= 1;
-
- if (remainder >= arg2_value) {
- res_value |= 1;
- remainder -= arg2_value;
- }
- } while (--i != 0);
- }
-
- /* round up LSB */
- {
- uint64_t summand = (remainder << 1) >= arg2_value;
-
- ASSERT(res_value <= MAX_I64 - summand);
-
- res_value += summand;
- }
-
- res.value = (int64_t)(res_value);
-
- if (arg1_negative ^ arg2_negative)
- res.value = -res.value;
- return res;
-}
-
-struct bw_fixed bw_floor2(
- const struct bw_fixed arg,
- const struct bw_fixed significance)
-{
- struct bw_fixed result;
- int64_t multiplicand;
-
- multiplicand = div64_s64(arg.value, abs_i64(significance.value));
- result.value = abs_i64(significance.value) * multiplicand;
- ASSERT(abs_i64(result.value) <= abs_i64(arg.value));
- return result;
-}
-
-struct bw_fixed bw_ceil2(
- const struct bw_fixed arg,
- const struct bw_fixed significance)
-{
- struct bw_fixed result;
- int64_t multiplicand;
-
- multiplicand = div64_s64(arg.value, abs_i64(significance.value));
- result.value = abs_i64(significance.value) * multiplicand;
- if (abs_i64(result.value) < abs_i64(arg.value)) {
- if (arg.value < 0)
- result.value -= abs_i64(significance.value);
- else
- result.value += abs_i64(significance.value);
- }
- return result;
-}
-
-struct bw_fixed bw_mul(const struct bw_fixed arg1, const struct bw_fixed arg2)
-{
- struct bw_fixed res;
-
- bool arg1_negative = arg1.value < 0;
- bool arg2_negative = arg2.value < 0;
-
- uint64_t arg1_value = abs_i64(arg1.value);
- uint64_t arg2_value = abs_i64(arg2.value);
-
- uint64_t arg1_int = BW_FIXED_GET_INTEGER_PART(arg1_value);
- uint64_t arg2_int = BW_FIXED_GET_INTEGER_PART(arg2_value);
-
- uint64_t arg1_fra = GET_FRACTIONAL_PART(arg1_value);
- uint64_t arg2_fra = GET_FRACTIONAL_PART(arg2_value);
-
- uint64_t tmp;
-
- res.value = arg1_int * arg2_int;
-
- ASSERT(res.value <= BW_FIXED_MAX_I32);
-
- res.value <<= BW_FIXED_BITS_PER_FRACTIONAL_PART;
-
- tmp = arg1_int * arg2_fra;
-
- ASSERT(tmp <= (uint64_t)(MAX_I64 - res.value));
-
- res.value += tmp;
-
- tmp = arg2_int * arg1_fra;
-
- ASSERT(tmp <= (uint64_t)(MAX_I64 - res.value));
-
- res.value += tmp;
-
- tmp = arg1_fra * arg2_fra;
-
- tmp = (tmp >> BW_FIXED_BITS_PER_FRACTIONAL_PART) +
- (tmp >= (uint64_t)(bw_frc_to_fixed(1, 2).value));
-
- ASSERT(tmp <= (uint64_t)(MAX_I64 - res.value));
-
- res.value += tmp;
-
- if (arg1_negative ^ arg2_negative)
- res.value = -res.value;
- return res;
-}
-
diff --git a/drivers/gpu/drm/amd/display/dc/dml/calcs/calcs_logger.h b/drivers/gpu/drm/amd/display/dc/dml/calcs/calcs_logger.h
deleted file mode 100644
index 62435bfc2..000000000
--- a/drivers/gpu/drm/amd/display/dc/dml/calcs/calcs_logger.h
+++ /dev/null
@@ -1,578 +0,0 @@
-/*
- * Copyright 2018 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 _CALCS_CALCS_LOGGER_H_
-#define _CALCS_CALCS_LOGGER_H_
-#define DC_LOGGER ctx->logger
-
-static void print_bw_calcs_dceip(struct dc_context *ctx, const struct bw_calcs_dceip *dceip)
-{
-
- DC_LOG_BANDWIDTH_CALCS("#####################################################################");
- DC_LOG_BANDWIDTH_CALCS("struct bw_calcs_dceip");
- DC_LOG_BANDWIDTH_CALCS("#####################################################################");
- DC_LOG_BANDWIDTH_CALCS(" [enum] bw_calcs_version version %d", dceip->version);
- DC_LOG_BANDWIDTH_CALCS(" [bool] large_cursor: %d", dceip->large_cursor);
- DC_LOG_BANDWIDTH_CALCS(" [bool] dmif_pipe_en_fbc_chunk_tracker: %d", dceip->dmif_pipe_en_fbc_chunk_tracker);
- DC_LOG_BANDWIDTH_CALCS(" [bool] display_write_back_supported: %d", dceip->display_write_back_supported);
- DC_LOG_BANDWIDTH_CALCS(" [bool] argb_compression_support: %d", dceip->argb_compression_support);
- DC_LOG_BANDWIDTH_CALCS(" [bool] pre_downscaler_enabled: %d", dceip->pre_downscaler_enabled);
- DC_LOG_BANDWIDTH_CALCS(" [bool] underlay_downscale_prefetch_enabled: %d",
- dceip->underlay_downscale_prefetch_enabled);
- DC_LOG_BANDWIDTH_CALCS(" [bool] graphics_lb_nodownscaling_multi_line_prefetching: %d",
- dceip->graphics_lb_nodownscaling_multi_line_prefetching);
- DC_LOG_BANDWIDTH_CALCS(" [bool] limit_excessive_outstanding_dmif_requests: %d",
- dceip->limit_excessive_outstanding_dmif_requests);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] cursor_max_outstanding_group_num: %d",
- dceip->cursor_max_outstanding_group_num);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] lines_interleaved_into_lb: %d", dceip->lines_interleaved_into_lb);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] low_power_tiling_mode: %d", dceip->low_power_tiling_mode);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] chunk_width: %d", dceip->chunk_width);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] number_of_graphics_pipes: %d", dceip->number_of_graphics_pipes);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] number_of_underlay_pipes: %d", dceip->number_of_underlay_pipes);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] max_dmif_buffer_allocated: %d", dceip->max_dmif_buffer_allocated);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] graphics_dmif_size: %d", dceip->graphics_dmif_size);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] underlay_luma_dmif_size: %d", dceip->underlay_luma_dmif_size);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] underlay_chroma_dmif_size: %d", dceip->underlay_chroma_dmif_size);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] scatter_gather_lines_of_pte_prefetching_in_linear_mode: %d",
- dceip->scatter_gather_lines_of_pte_prefetching_in_linear_mode);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] display_write_back420_luma_mcifwr_buffer_size: %d",
- dceip->display_write_back420_luma_mcifwr_buffer_size);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] display_write_back420_chroma_mcifwr_buffer_size: %d",
- dceip->display_write_back420_chroma_mcifwr_buffer_size);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] scatter_gather_pte_request_rows_in_tiling_mode: %d",
- dceip->scatter_gather_pte_request_rows_in_tiling_mode);
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] underlay_vscaler_efficiency10_bit_per_component: %d",
- bw_fixed_to_int(dceip->underlay_vscaler_efficiency10_bit_per_component));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] underlay_vscaler_efficiency12_bit_per_component: %d",
- bw_fixed_to_int(dceip->underlay_vscaler_efficiency12_bit_per_component));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] graphics_vscaler_efficiency6_bit_per_component: %d",
- bw_fixed_to_int(dceip->graphics_vscaler_efficiency6_bit_per_component));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] graphics_vscaler_efficiency8_bit_per_component: %d",
- bw_fixed_to_int(dceip->graphics_vscaler_efficiency8_bit_per_component));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] graphics_vscaler_efficiency10_bit_per_component: %d",
- bw_fixed_to_int(dceip->graphics_vscaler_efficiency10_bit_per_component));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] graphics_vscaler_efficiency12_bit_per_component: %d",
- bw_fixed_to_int(dceip->graphics_vscaler_efficiency12_bit_per_component));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] alpha_vscaler_efficiency: %d",
- bw_fixed_to_int(dceip->alpha_vscaler_efficiency));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] lb_write_pixels_per_dispclk: %d",
- bw_fixed_to_int(dceip->lb_write_pixels_per_dispclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] lb_size_per_component444: %d",
- bw_fixed_to_int(dceip->lb_size_per_component444));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] stutter_and_dram_clock_state_change_gated_before_cursor: %d",
- bw_fixed_to_int(dceip->stutter_and_dram_clock_state_change_gated_before_cursor));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] underlay420_luma_lb_size_per_component: %d",
- bw_fixed_to_int(dceip->underlay420_luma_lb_size_per_component));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] underlay420_chroma_lb_size_per_component: %d",
- bw_fixed_to_int(dceip->underlay420_chroma_lb_size_per_component));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] underlay422_lb_size_per_component: %d",
- bw_fixed_to_int(dceip->underlay422_lb_size_per_component));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] cursor_chunk_width: %d", bw_fixed_to_int(dceip->cursor_chunk_width));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] cursor_dcp_buffer_lines: %d",
- bw_fixed_to_int(dceip->cursor_dcp_buffer_lines));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] underlay_maximum_width_efficient_for_tiling: %d",
- bw_fixed_to_int(dceip->underlay_maximum_width_efficient_for_tiling));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] underlay_maximum_height_efficient_for_tiling: %d",
- bw_fixed_to_int(dceip->underlay_maximum_height_efficient_for_tiling));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] peak_pte_request_to_eviction_ratio_limiting_multiple_displays_or_single_rotated_display: %d",
- bw_fixed_to_int(dceip->peak_pte_request_to_eviction_ratio_limiting_multiple_displays_or_single_rotated_display));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] peak_pte_request_to_eviction_ratio_limiting_single_display_no_rotation: %d",
- bw_fixed_to_int(dceip->peak_pte_request_to_eviction_ratio_limiting_single_display_no_rotation));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] minimum_outstanding_pte_request_limit: %d",
- bw_fixed_to_int(dceip->minimum_outstanding_pte_request_limit));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] maximum_total_outstanding_pte_requests_allowed_by_saw: %d",
- bw_fixed_to_int(dceip->maximum_total_outstanding_pte_requests_allowed_by_saw));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] linear_mode_line_request_alternation_slice: %d",
- bw_fixed_to_int(dceip->linear_mode_line_request_alternation_slice));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] request_efficiency: %d", bw_fixed_to_int(dceip->request_efficiency));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dispclk_per_request: %d", bw_fixed_to_int(dceip->dispclk_per_request));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dispclk_ramping_factor: %d",
- bw_fixed_to_int(dceip->dispclk_ramping_factor));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] display_pipe_throughput_factor: %d",
- bw_fixed_to_int(dceip->display_pipe_throughput_factor));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] mcifwr_all_surfaces_burst_time: %d",
- bw_fixed_to_int(dceip->mcifwr_all_surfaces_burst_time));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dmif_request_buffer_size: %d",
- bw_fixed_to_int(dceip->dmif_request_buffer_size));
-
-
-}
-
-static void print_bw_calcs_vbios(struct dc_context *ctx, const struct bw_calcs_vbios *vbios)
-{
-
- DC_LOG_BANDWIDTH_CALCS("#####################################################################");
- DC_LOG_BANDWIDTH_CALCS("struct bw_calcs_vbios vbios");
- DC_LOG_BANDWIDTH_CALCS("#####################################################################");
- DC_LOG_BANDWIDTH_CALCS(" [enum] bw_defines memory_type: %d", vbios->memory_type);
- DC_LOG_BANDWIDTH_CALCS(" [enum] bw_defines memory_type: %d", vbios->memory_type);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] dram_channel_width_in_bits: %d", vbios->dram_channel_width_in_bits);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] number_of_dram_channels: %d", vbios->number_of_dram_channels);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] number_of_dram_banks: %d", vbios->number_of_dram_banks);
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] low_yclk: %d", bw_fixed_to_int(vbios->low_yclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] mid_yclk: %d", bw_fixed_to_int(vbios->mid_yclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] high_yclk: %d", bw_fixed_to_int(vbios->high_yclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] low_sclk: %d", bw_fixed_to_int(vbios->low_sclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] mid1_sclk: %d", bw_fixed_to_int(vbios->mid1_sclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] mid2_sclk: %d", bw_fixed_to_int(vbios->mid2_sclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] mid3_sclk: %d", bw_fixed_to_int(vbios->mid3_sclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] mid4_sclk: %d", bw_fixed_to_int(vbios->mid4_sclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] mid5_sclk: %d", bw_fixed_to_int(vbios->mid5_sclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] mid6_sclk: %d", bw_fixed_to_int(vbios->mid6_sclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] high_sclk: %d", bw_fixed_to_int(vbios->high_sclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] low_voltage_max_dispclk: %d",
- bw_fixed_to_int(vbios->low_voltage_max_dispclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] mid_voltage_max_dispclk;: %d",
- bw_fixed_to_int(vbios->mid_voltage_max_dispclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] high_voltage_max_dispclk;: %d",
- bw_fixed_to_int(vbios->high_voltage_max_dispclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] low_voltage_max_phyclk: %d",
- bw_fixed_to_int(vbios->low_voltage_max_phyclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] mid_voltage_max_phyclk: %d",
- bw_fixed_to_int(vbios->mid_voltage_max_phyclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] high_voltage_max_phyclk: %d",
- bw_fixed_to_int(vbios->high_voltage_max_phyclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] data_return_bus_width: %d", bw_fixed_to_int(vbios->data_return_bus_width));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] trc: %d", bw_fixed_to_int(vbios->trc));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dmifmc_urgent_latency: %d", bw_fixed_to_int(vbios->dmifmc_urgent_latency));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] stutter_self_refresh_exit_latency: %d",
- bw_fixed_to_int(vbios->stutter_self_refresh_exit_latency));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] stutter_self_refresh_entry_latency: %d",
- bw_fixed_to_int(vbios->stutter_self_refresh_entry_latency));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] nbp_state_change_latency: %d",
- bw_fixed_to_int(vbios->nbp_state_change_latency));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] mcifwrmc_urgent_latency: %d",
- bw_fixed_to_int(vbios->mcifwrmc_urgent_latency));
- DC_LOG_BANDWIDTH_CALCS(" [bool] scatter_gather_enable: %d", vbios->scatter_gather_enable);
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] down_spread_percentage: %d",
- bw_fixed_to_int(vbios->down_spread_percentage));
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] cursor_width: %d", vbios->cursor_width);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] average_compression_rate: %d", vbios->average_compression_rate);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] number_of_request_slots_gmc_reserves_for_dmif_per_channel: %d",
- vbios->number_of_request_slots_gmc_reserves_for_dmif_per_channel);
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] blackout_duration: %d", bw_fixed_to_int(vbios->blackout_duration));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] maximum_blackout_recovery_time: %d",
- bw_fixed_to_int(vbios->maximum_blackout_recovery_time));
-
-
-}
-
-static void print_bw_calcs_data(struct dc_context *ctx, struct bw_calcs_data *data)
-{
-
- int i, j, k;
-
- DC_LOG_BANDWIDTH_CALCS("#####################################################################");
- DC_LOG_BANDWIDTH_CALCS("struct bw_calcs_data data");
- DC_LOG_BANDWIDTH_CALCS("#####################################################################");
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] number_of_displays: %d", data->number_of_displays);
- DC_LOG_BANDWIDTH_CALCS(" [enum] bw_defines underlay_surface_type: %d", data->underlay_surface_type);
- DC_LOG_BANDWIDTH_CALCS(" [enum] bw_defines panning_and_bezel_adjustment: %d",
- data->panning_and_bezel_adjustment);
- DC_LOG_BANDWIDTH_CALCS(" [enum] bw_defines graphics_tiling_mode: %d", data->graphics_tiling_mode);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] graphics_lb_bpc: %d", data->graphics_lb_bpc);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] underlay_lb_bpc: %d", data->underlay_lb_bpc);
- DC_LOG_BANDWIDTH_CALCS(" [enum] bw_defines underlay_tiling_mode: %d", data->underlay_tiling_mode);
- DC_LOG_BANDWIDTH_CALCS(" [enum] bw_defines d0_underlay_mode: %d", data->d0_underlay_mode);
- DC_LOG_BANDWIDTH_CALCS(" [bool] d1_display_write_back_dwb_enable: %d", data->d1_display_write_back_dwb_enable);
- DC_LOG_BANDWIDTH_CALCS(" [enum] bw_defines d1_underlay_mode: %d", data->d1_underlay_mode);
- DC_LOG_BANDWIDTH_CALCS(" [bool] cpup_state_change_enable: %d", data->cpup_state_change_enable);
- DC_LOG_BANDWIDTH_CALCS(" [bool] cpuc_state_change_enable: %d", data->cpuc_state_change_enable);
- DC_LOG_BANDWIDTH_CALCS(" [bool] nbp_state_change_enable: %d", data->nbp_state_change_enable);
- DC_LOG_BANDWIDTH_CALCS(" [bool] stutter_mode_enable: %d", data->stutter_mode_enable);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] y_clk_level: %d", data->y_clk_level);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] sclk_level: %d", data->sclk_level);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] number_of_underlay_surfaces: %d", data->number_of_underlay_surfaces);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] number_of_dram_wrchannels: %d", data->number_of_dram_wrchannels);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] chunk_request_delay: %d", data->chunk_request_delay);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] number_of_dram_channels: %d", data->number_of_dram_channels);
- DC_LOG_BANDWIDTH_CALCS(" [enum] bw_defines underlay_micro_tile_mode: %d", data->underlay_micro_tile_mode);
- DC_LOG_BANDWIDTH_CALCS(" [enum] bw_defines graphics_micro_tile_mode: %d", data->graphics_micro_tile_mode);
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] max_phyclk: %d", bw_fixed_to_int(data->max_phyclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dram_efficiency: %d", bw_fixed_to_int(data->dram_efficiency));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] src_width_after_surface_type: %d",
- bw_fixed_to_int(data->src_width_after_surface_type));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] src_height_after_surface_type: %d",
- bw_fixed_to_int(data->src_height_after_surface_type));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] hsr_after_surface_type: %d",
- bw_fixed_to_int(data->hsr_after_surface_type));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] vsr_after_surface_type: %d", bw_fixed_to_int(data->vsr_after_surface_type));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] src_width_after_rotation: %d",
- bw_fixed_to_int(data->src_width_after_rotation));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] src_height_after_rotation: %d",
- bw_fixed_to_int(data->src_height_after_rotation));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] hsr_after_rotation: %d", bw_fixed_to_int(data->hsr_after_rotation));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] vsr_after_rotation: %d", bw_fixed_to_int(data->vsr_after_rotation));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] source_height_pixels: %d", bw_fixed_to_int(data->source_height_pixels));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] hsr_after_stereo: %d", bw_fixed_to_int(data->hsr_after_stereo));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] vsr_after_stereo: %d", bw_fixed_to_int(data->vsr_after_stereo));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] source_width_in_lb: %d", bw_fixed_to_int(data->source_width_in_lb));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] lb_line_pitch: %d", bw_fixed_to_int(data->lb_line_pitch));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] underlay_maximum_source_efficient_for_tiling: %d",
- bw_fixed_to_int(data->underlay_maximum_source_efficient_for_tiling));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] num_lines_at_frame_start: %d",
- bw_fixed_to_int(data->num_lines_at_frame_start));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] min_dmif_size_in_time: %d", bw_fixed_to_int(data->min_dmif_size_in_time));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] min_mcifwr_size_in_time: %d",
- bw_fixed_to_int(data->min_mcifwr_size_in_time));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] total_requests_for_dmif_size: %d",
- bw_fixed_to_int(data->total_requests_for_dmif_size));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] peak_pte_request_to_eviction_ratio_limiting: %d",
- bw_fixed_to_int(data->peak_pte_request_to_eviction_ratio_limiting));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] useful_pte_per_pte_request: %d",
- bw_fixed_to_int(data->useful_pte_per_pte_request));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] scatter_gather_pte_request_rows: %d",
- bw_fixed_to_int(data->scatter_gather_pte_request_rows));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] scatter_gather_row_height: %d",
- bw_fixed_to_int(data->scatter_gather_row_height));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] scatter_gather_pte_requests_in_vblank: %d",
- bw_fixed_to_int(data->scatter_gather_pte_requests_in_vblank));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] inefficient_linear_pitch_in_bytes: %d",
- bw_fixed_to_int(data->inefficient_linear_pitch_in_bytes));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] cursor_total_data: %d", bw_fixed_to_int(data->cursor_total_data));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] cursor_total_request_groups: %d",
- bw_fixed_to_int(data->cursor_total_request_groups));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] scatter_gather_total_pte_requests: %d",
- bw_fixed_to_int(data->scatter_gather_total_pte_requests));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] scatter_gather_total_pte_request_groups: %d",
- bw_fixed_to_int(data->scatter_gather_total_pte_request_groups));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] tile_width_in_pixels: %d", bw_fixed_to_int(data->tile_width_in_pixels));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dmif_total_number_of_data_request_page_close_open: %d",
- bw_fixed_to_int(data->dmif_total_number_of_data_request_page_close_open));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] mcifwr_total_number_of_data_request_page_close_open: %d",
- bw_fixed_to_int(data->mcifwr_total_number_of_data_request_page_close_open));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] bytes_per_page_close_open: %d",
- bw_fixed_to_int(data->bytes_per_page_close_open));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] mcifwr_total_page_close_open_time: %d",
- bw_fixed_to_int(data->mcifwr_total_page_close_open_time));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] total_requests_for_adjusted_dmif_size: %d",
- bw_fixed_to_int(data->total_requests_for_adjusted_dmif_size));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] total_dmifmc_urgent_trips: %d",
- bw_fixed_to_int(data->total_dmifmc_urgent_trips));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] total_dmifmc_urgent_latency: %d",
- bw_fixed_to_int(data->total_dmifmc_urgent_latency));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] total_display_reads_required_data: %d",
- bw_fixed_to_int(data->total_display_reads_required_data));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] total_display_reads_required_dram_access_data: %d",
- bw_fixed_to_int(data->total_display_reads_required_dram_access_data));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] total_display_writes_required_data: %d",
- bw_fixed_to_int(data->total_display_writes_required_data));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] total_display_writes_required_dram_access_data: %d",
- bw_fixed_to_int(data->total_display_writes_required_dram_access_data));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] display_reads_required_data: %d",
- bw_fixed_to_int(data->display_reads_required_data));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] display_reads_required_dram_access_data: %d",
- bw_fixed_to_int(data->display_reads_required_dram_access_data));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dmif_total_page_close_open_time: %d",
- bw_fixed_to_int(data->dmif_total_page_close_open_time));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] min_cursor_memory_interface_buffer_size_in_time: %d",
- bw_fixed_to_int(data->min_cursor_memory_interface_buffer_size_in_time));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] min_read_buffer_size_in_time: %d",
- bw_fixed_to_int(data->min_read_buffer_size_in_time));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] display_reads_time_for_data_transfer: %d",
- bw_fixed_to_int(data->display_reads_time_for_data_transfer));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] display_writes_time_for_data_transfer: %d",
- bw_fixed_to_int(data->display_writes_time_for_data_transfer));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dmif_required_dram_bandwidth: %d",
- bw_fixed_to_int(data->dmif_required_dram_bandwidth));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] mcifwr_required_dram_bandwidth: %d",
- bw_fixed_to_int(data->mcifwr_required_dram_bandwidth));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] required_dmifmc_urgent_latency_for_page_close_open: %d",
- bw_fixed_to_int(data->required_dmifmc_urgent_latency_for_page_close_open));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] required_mcifmcwr_urgent_latency: %d",
- bw_fixed_to_int(data->required_mcifmcwr_urgent_latency));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] required_dram_bandwidth_gbyte_per_second: %d",
- bw_fixed_to_int(data->required_dram_bandwidth_gbyte_per_second));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dram_bandwidth: %d", bw_fixed_to_int(data->dram_bandwidth));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dmif_required_sclk: %d", bw_fixed_to_int(data->dmif_required_sclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] mcifwr_required_sclk: %d", bw_fixed_to_int(data->mcifwr_required_sclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] required_sclk: %d", bw_fixed_to_int(data->required_sclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] downspread_factor: %d", bw_fixed_to_int(data->downspread_factor));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] v_scaler_efficiency: %d", bw_fixed_to_int(data->v_scaler_efficiency));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] scaler_limits_factor: %d", bw_fixed_to_int(data->scaler_limits_factor));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] display_pipe_pixel_throughput: %d",
- bw_fixed_to_int(data->display_pipe_pixel_throughput));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] total_dispclk_required_with_ramping: %d",
- bw_fixed_to_int(data->total_dispclk_required_with_ramping));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] total_dispclk_required_without_ramping: %d",
- bw_fixed_to_int(data->total_dispclk_required_without_ramping));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] total_read_request_bandwidth: %d",
- bw_fixed_to_int(data->total_read_request_bandwidth));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] total_write_request_bandwidth: %d",
- bw_fixed_to_int(data->total_write_request_bandwidth));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dispclk_required_for_total_read_request_bandwidth: %d",
- bw_fixed_to_int(data->dispclk_required_for_total_read_request_bandwidth));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] total_dispclk_required_with_ramping_with_request_bandwidth: %d",
- bw_fixed_to_int(data->total_dispclk_required_with_ramping_with_request_bandwidth));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] total_dispclk_required_without_ramping_with_request_bandwidth: %d",
- bw_fixed_to_int(data->total_dispclk_required_without_ramping_with_request_bandwidth));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dispclk: %d", bw_fixed_to_int(data->dispclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] blackout_recovery_time: %d", bw_fixed_to_int(data->blackout_recovery_time));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] min_pixels_per_data_fifo_entry: %d",
- bw_fixed_to_int(data->min_pixels_per_data_fifo_entry));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] sclk_deep_sleep: %d", bw_fixed_to_int(data->sclk_deep_sleep));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] chunk_request_time: %d", bw_fixed_to_int(data->chunk_request_time));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] cursor_request_time: %d", bw_fixed_to_int(data->cursor_request_time));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] line_source_pixels_transfer_time: %d",
- bw_fixed_to_int(data->line_source_pixels_transfer_time));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dmifdram_access_efficiency: %d",
- bw_fixed_to_int(data->dmifdram_access_efficiency));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] mcifwrdram_access_efficiency: %d",
- bw_fixed_to_int(data->mcifwrdram_access_efficiency));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] total_average_bandwidth_no_compression: %d",
- bw_fixed_to_int(data->total_average_bandwidth_no_compression));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] total_average_bandwidth: %d",
- bw_fixed_to_int(data->total_average_bandwidth));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] total_stutter_cycle_duration: %d",
- bw_fixed_to_int(data->total_stutter_cycle_duration));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] stutter_burst_time: %d", bw_fixed_to_int(data->stutter_burst_time));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] time_in_self_refresh: %d", bw_fixed_to_int(data->time_in_self_refresh));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] stutter_efficiency: %d", bw_fixed_to_int(data->stutter_efficiency));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] worst_number_of_trips_to_memory: %d",
- bw_fixed_to_int(data->worst_number_of_trips_to_memory));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] immediate_flip_time: %d", bw_fixed_to_int(data->immediate_flip_time));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] latency_for_non_dmif_clients: %d",
- bw_fixed_to_int(data->latency_for_non_dmif_clients));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] latency_for_non_mcifwr_clients: %d",
- bw_fixed_to_int(data->latency_for_non_mcifwr_clients));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dmifmc_urgent_latency_supported_in_high_sclk_and_yclk: %d",
- bw_fixed_to_int(data->dmifmc_urgent_latency_supported_in_high_sclk_and_yclk));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] nbp_state_dram_speed_change_margin: %d",
- bw_fixed_to_int(data->nbp_state_dram_speed_change_margin));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] display_reads_time_for_data_transfer_and_urgent_latency: %d",
- bw_fixed_to_int(data->display_reads_time_for_data_transfer_and_urgent_latency));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dram_speed_change_margin: %d",
- bw_fixed_to_int(data->dram_speed_change_margin));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] min_vblank_dram_speed_change_margin: %d",
- bw_fixed_to_int(data->min_vblank_dram_speed_change_margin));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] min_stutter_refresh_duration: %d",
- bw_fixed_to_int(data->min_stutter_refresh_duration));
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] total_stutter_dmif_buffer_size: %d", data->total_stutter_dmif_buffer_size);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] total_bytes_requested: %d", data->total_bytes_requested);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] min_stutter_dmif_buffer_size: %d", data->min_stutter_dmif_buffer_size);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] num_stutter_bursts: %d", data->num_stutter_bursts);
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] v_blank_nbp_state_dram_speed_change_latency_supported: %d",
- bw_fixed_to_int(data->v_blank_nbp_state_dram_speed_change_latency_supported));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] nbp_state_dram_speed_change_latency_supported: %d",
- bw_fixed_to_int(data->nbp_state_dram_speed_change_latency_supported));
-
- for (i = 0; i < maximum_number_of_surfaces; i++) {
- DC_LOG_BANDWIDTH_CALCS(" [bool] fbc_en[%d]:%d\n", i, data->fbc_en[i]);
- DC_LOG_BANDWIDTH_CALCS(" [bool] lpt_en[%d]:%d", i, data->lpt_en[i]);
- DC_LOG_BANDWIDTH_CALCS(" [bool] displays_match_flag[%d]:%d", i, data->displays_match_flag[i]);
- DC_LOG_BANDWIDTH_CALCS(" [bool] use_alpha[%d]:%d", i, data->use_alpha[i]);
- DC_LOG_BANDWIDTH_CALCS(" [bool] orthogonal_rotation[%d]:%d", i, data->orthogonal_rotation[i]);
- DC_LOG_BANDWIDTH_CALCS(" [bool] enable[%d]:%d", i, data->enable[i]);
- DC_LOG_BANDWIDTH_CALCS(" [bool] access_one_channel_only[%d]:%d", i, data->access_one_channel_only[i]);
- DC_LOG_BANDWIDTH_CALCS(" [bool] scatter_gather_enable_for_pipe[%d]:%d",
- i, data->scatter_gather_enable_for_pipe[i]);
- DC_LOG_BANDWIDTH_CALCS(" [bool] interlace_mode[%d]:%d",
- i, data->interlace_mode[i]);
- DC_LOG_BANDWIDTH_CALCS(" [bool] display_pstate_change_enable[%d]:%d",
- i, data->display_pstate_change_enable[i]);
- DC_LOG_BANDWIDTH_CALCS(" [bool] line_buffer_prefetch[%d]:%d", i, data->line_buffer_prefetch[i]);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] bytes_per_pixel[%d]:%d", i, data->bytes_per_pixel[i]);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] max_chunks_non_fbc_mode[%d]:%d",
- i, data->max_chunks_non_fbc_mode[i]);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] lb_bpc[%d]:%d", i, data->lb_bpc[i]);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] output_bpphdmi[%d]:%d", i, data->output_bpphdmi[i]);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] output_bppdp4_lane_hbr[%d]:%d", i, data->output_bppdp4_lane_hbr[i]);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] output_bppdp4_lane_hbr2[%d]:%d",
- i, data->output_bppdp4_lane_hbr2[i]);
- DC_LOG_BANDWIDTH_CALCS(" [uint32_t] output_bppdp4_lane_hbr3[%d]:%d",
- i, data->output_bppdp4_lane_hbr3[i]);
- DC_LOG_BANDWIDTH_CALCS(" [enum] bw_defines stereo_mode[%d]:%d", i, data->stereo_mode[i]);
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dmif_buffer_transfer_time[%d]:%d",
- i, bw_fixed_to_int(data->dmif_buffer_transfer_time[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] displays_with_same_mode[%d]:%d",
- i, bw_fixed_to_int(data->displays_with_same_mode[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] stutter_dmif_buffer_size[%d]:%d",
- i, bw_fixed_to_int(data->stutter_dmif_buffer_size[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] stutter_refresh_duration[%d]:%d",
- i, bw_fixed_to_int(data->stutter_refresh_duration[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] stutter_exit_watermark[%d]:%d",
- i, bw_fixed_to_int(data->stutter_exit_watermark[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] stutter_entry_watermark[%d]:%d",
- i, bw_fixed_to_int(data->stutter_entry_watermark[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] h_total[%d]:%d", i, bw_fixed_to_int(data->h_total[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] v_total[%d]:%d", i, bw_fixed_to_int(data->v_total[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] pixel_rate[%d]:%d", i, bw_fixed_to_int(data->pixel_rate[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] src_width[%d]:%d", i, bw_fixed_to_int(data->src_width[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] pitch_in_pixels[%d]:%d",
- i, bw_fixed_to_int(data->pitch_in_pixels[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] pitch_in_pixels_after_surface_type[%d]:%d",
- i, bw_fixed_to_int(data->pitch_in_pixels_after_surface_type[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] src_height[%d]:%d", i, bw_fixed_to_int(data->src_height[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] scale_ratio[%d]:%d", i, bw_fixed_to_int(data->scale_ratio[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] h_taps[%d]:%d", i, bw_fixed_to_int(data->h_taps[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] v_taps[%d]:%d", i, bw_fixed_to_int(data->v_taps[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] h_scale_ratio[%d]:%d", i, bw_fixed_to_int(data->h_scale_ratio[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] v_scale_ratio[%d]:%d", i, bw_fixed_to_int(data->v_scale_ratio[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] rotation_angle[%d]:%d",
- i, bw_fixed_to_int(data->rotation_angle[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] compression_rate[%d]:%d",
- i, bw_fixed_to_int(data->compression_rate[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] hsr[%d]:%d", i, bw_fixed_to_int(data->hsr[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] vsr[%d]:%d", i, bw_fixed_to_int(data->vsr[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] source_width_rounded_up_to_chunks[%d]:%d",
- i, bw_fixed_to_int(data->source_width_rounded_up_to_chunks[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] source_width_pixels[%d]:%d",
- i, bw_fixed_to_int(data->source_width_pixels[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] source_height_rounded_up_to_chunks[%d]:%d",
- i, bw_fixed_to_int(data->source_height_rounded_up_to_chunks[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] display_bandwidth[%d]:%d",
- i, bw_fixed_to_int(data->display_bandwidth[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] request_bandwidth[%d]:%d",
- i, bw_fixed_to_int(data->request_bandwidth[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] bytes_per_request[%d]:%d",
- i, bw_fixed_to_int(data->bytes_per_request[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] useful_bytes_per_request[%d]:%d",
- i, bw_fixed_to_int(data->useful_bytes_per_request[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] lines_interleaved_in_mem_access[%d]:%d",
- i, bw_fixed_to_int(data->lines_interleaved_in_mem_access[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] latency_hiding_lines[%d]:%d",
- i, bw_fixed_to_int(data->latency_hiding_lines[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] lb_partitions[%d]:%d",
- i, bw_fixed_to_int(data->lb_partitions[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] lb_partitions_max[%d]:%d",
- i, bw_fixed_to_int(data->lb_partitions_max[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dispclk_required_with_ramping[%d]:%d",
- i, bw_fixed_to_int(data->dispclk_required_with_ramping[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dispclk_required_without_ramping[%d]:%d",
- i, bw_fixed_to_int(data->dispclk_required_without_ramping[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] data_buffer_size[%d]:%d",
- i, bw_fixed_to_int(data->data_buffer_size[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] outstanding_chunk_request_limit[%d]:%d",
- i, bw_fixed_to_int(data->outstanding_chunk_request_limit[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] urgent_watermark[%d]:%d",
- i, bw_fixed_to_int(data->urgent_watermark[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] nbp_state_change_watermark[%d]:%d",
- i, bw_fixed_to_int(data->nbp_state_change_watermark[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] v_filter_init[%d]:%d", i, bw_fixed_to_int(data->v_filter_init[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] stutter_cycle_duration[%d]:%d",
- i, bw_fixed_to_int(data->stutter_cycle_duration[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] average_bandwidth[%d]:%d",
- i, bw_fixed_to_int(data->average_bandwidth[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] average_bandwidth_no_compression[%d]:%d",
- i, bw_fixed_to_int(data->average_bandwidth_no_compression[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] scatter_gather_pte_request_limit[%d]:%d",
- i, bw_fixed_to_int(data->scatter_gather_pte_request_limit[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] lb_size_per_component[%d]:%d",
- i, bw_fixed_to_int(data->lb_size_per_component[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] memory_chunk_size_in_bytes[%d]:%d",
- i, bw_fixed_to_int(data->memory_chunk_size_in_bytes[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] pipe_chunk_size_in_bytes[%d]:%d",
- i, bw_fixed_to_int(data->pipe_chunk_size_in_bytes[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] number_of_trips_to_memory_for_getting_apte_row[%d]:%d",
- i, bw_fixed_to_int(data->number_of_trips_to_memory_for_getting_apte_row[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] adjusted_data_buffer_size[%d]:%d",
- i, bw_fixed_to_int(data->adjusted_data_buffer_size[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] adjusted_data_buffer_size_in_memory[%d]:%d",
- i, bw_fixed_to_int(data->adjusted_data_buffer_size_in_memory[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] pixels_per_data_fifo_entry[%d]:%d",
- i, bw_fixed_to_int(data->pixels_per_data_fifo_entry[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] scatter_gather_pte_requests_in_row[%d]:%d",
- i, bw_fixed_to_int(data->scatter_gather_pte_requests_in_row[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] pte_request_per_chunk[%d]:%d",
- i, bw_fixed_to_int(data->pte_request_per_chunk[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] scatter_gather_page_width[%d]:%d",
- i, bw_fixed_to_int(data->scatter_gather_page_width[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] scatter_gather_page_height[%d]:%d",
- i, bw_fixed_to_int(data->scatter_gather_page_height[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] lb_lines_in_per_line_out_in_beginning_of_frame[%d]:%d",
- i, bw_fixed_to_int(data->lb_lines_in_per_line_out_in_beginning_of_frame[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] lb_lines_in_per_line_out_in_middle_of_frame[%d]:%d",
- i, bw_fixed_to_int(data->lb_lines_in_per_line_out_in_middle_of_frame[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] cursor_width_pixels[%d]:%d",
- i, bw_fixed_to_int(data->cursor_width_pixels[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] minimum_latency_hiding[%d]:%d",
- i, bw_fixed_to_int(data->minimum_latency_hiding[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] maximum_latency_hiding[%d]:%d",
- i, bw_fixed_to_int(data->maximum_latency_hiding[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] minimum_latency_hiding_with_cursor[%d]:%d",
- i, bw_fixed_to_int(data->minimum_latency_hiding_with_cursor[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] maximum_latency_hiding_with_cursor[%d]:%d",
- i, bw_fixed_to_int(data->maximum_latency_hiding_with_cursor[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] src_pixels_for_first_output_pixel[%d]:%d",
- i, bw_fixed_to_int(data->src_pixels_for_first_output_pixel[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] src_pixels_for_last_output_pixel[%d]:%d",
- i, bw_fixed_to_int(data->src_pixels_for_last_output_pixel[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] src_data_for_first_output_pixel[%d]:%d",
- i, bw_fixed_to_int(data->src_data_for_first_output_pixel[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] src_data_for_last_output_pixel[%d]:%d",
- i, bw_fixed_to_int(data->src_data_for_last_output_pixel[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] active_time[%d]:%d", i, bw_fixed_to_int(data->active_time[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] horizontal_blank_and_chunk_granularity_factor[%d]:%d",
- i, bw_fixed_to_int(data->horizontal_blank_and_chunk_granularity_factor[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] cursor_latency_hiding[%d]:%d",
- i, bw_fixed_to_int(data->cursor_latency_hiding[i]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] v_blank_dram_speed_change_margin[%d]:%d",
- i, bw_fixed_to_int(data->v_blank_dram_speed_change_margin[i]));
- }
-
- for (i = 0; i < maximum_number_of_surfaces; i++) {
- for (j = 0; j < 3; j++) {
- for (k = 0; k < 8; k++) {
-
- DC_LOG_BANDWIDTH_CALCS("\n [bw_fixed] line_source_transfer_time[%d][%d][%d]:%d",
- i, j, k, bw_fixed_to_int(data->line_source_transfer_time[i][j][k]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dram_speed_change_line_source_transfer_time[%d][%d][%d]:%d",
- i, j, k,
- bw_fixed_to_int(data->dram_speed_change_line_source_transfer_time[i][j][k]));
- }
- }
- }
-
- for (i = 0; i < 3; i++) {
- for (j = 0; j < 8; j++) {
-
- DC_LOG_BANDWIDTH_CALCS("\n [uint32_t] num_displays_with_margin[%d][%d]:%d",
- i, j, data->num_displays_with_margin[i][j]);
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dmif_burst_time[%d][%d]:%d",
- i, j, bw_fixed_to_int(data->dmif_burst_time[i][j]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] mcifwr_burst_time[%d][%d]:%d",
- i, j, bw_fixed_to_int(data->mcifwr_burst_time[i][j]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] min_dram_speed_change_margin[%d][%d]:%d",
- i, j, bw_fixed_to_int(data->min_dram_speed_change_margin[i][j]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dispclk_required_for_dram_speed_change[%d][%d]:%d",
- i, j, bw_fixed_to_int(data->dispclk_required_for_dram_speed_change[i][j]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] blackout_duration_margin[%d][%d]:%d",
- i, j, bw_fixed_to_int(data->blackout_duration_margin[i][j]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dispclk_required_for_blackout_duration[%d][%d]:%d",
- i, j, bw_fixed_to_int(data->dispclk_required_for_blackout_duration[i][j]));
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dispclk_required_for_blackout_recovery[%d][%d]:%d",
- i, j, bw_fixed_to_int(data->dispclk_required_for_blackout_recovery[i][j]));
- }
- }
-
- for (i = 0; i < 6; i++) {
- DC_LOG_BANDWIDTH_CALCS(" [bw_fixed] dmif_required_sclk_for_urgent_latency[%d]:%d",
- i, bw_fixed_to_int(data->dmif_required_sclk_for_urgent_latency[i]));
- }
-}
-;
-
-#endif /* _CALCS_CALCS_LOGGER_H_ */
diff --git a/drivers/gpu/drm/amd/display/dc/dml/calcs/custom_float.c b/drivers/gpu/drm/amd/display/dc/dml/calcs/custom_float.c
deleted file mode 100644
index 31d167bc5..000000000
--- a/drivers/gpu/drm/amd/display/dc/dml/calcs/custom_float.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright 2017 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 "custom_float.h"
-
-
-static bool build_custom_float(
- struct fixed31_32 value,
- const struct custom_float_format *format,
- bool *negative,
- uint32_t *mantissa,
- uint32_t *exponenta)
-{
- uint32_t exp_offset = (1 << (format->exponenta_bits - 1)) - 1;
-
- const struct fixed31_32 mantissa_constant_plus_max_fraction =
- dc_fixpt_from_fraction(
- (1LL << (format->mantissa_bits + 1)) - 1,
- 1LL << format->mantissa_bits);
-
- struct fixed31_32 mantiss;
-
- if (dc_fixpt_eq(
- value,
- dc_fixpt_zero)) {
- *negative = false;
- *mantissa = 0;
- *exponenta = 0;
- return true;
- }
-
- if (dc_fixpt_lt(
- value,
- dc_fixpt_zero)) {
- *negative = format->sign;
- value = dc_fixpt_neg(value);
- } else {
- *negative = false;
- }
-
- if (dc_fixpt_lt(
- value,
- dc_fixpt_one)) {
- uint32_t i = 1;
-
- do {
- value = dc_fixpt_shl(value, 1);
- ++i;
- } while (dc_fixpt_lt(
- value,
- dc_fixpt_one));
-
- --i;
-
- if (exp_offset <= i) {
- *mantissa = 0;
- *exponenta = 0;
- return true;
- }
-
- *exponenta = exp_offset - i;
- } else if (dc_fixpt_le(
- mantissa_constant_plus_max_fraction,
- value)) {
- uint32_t i = 1;
-
- do {
- value = dc_fixpt_shr(value, 1);
- ++i;
- } while (dc_fixpt_lt(
- mantissa_constant_plus_max_fraction,
- value));
-
- *exponenta = exp_offset + i - 1;
- } else {
- *exponenta = exp_offset;
- }
-
- mantiss = dc_fixpt_sub(
- value,
- dc_fixpt_one);
-
- if (dc_fixpt_lt(
- mantiss,
- dc_fixpt_zero) ||
- dc_fixpt_lt(
- dc_fixpt_one,
- mantiss))
- mantiss = dc_fixpt_zero;
- else
- mantiss = dc_fixpt_shl(
- mantiss,
- format->mantissa_bits);
-
- *mantissa = dc_fixpt_floor(mantiss);
-
- return true;
-}
-
-static bool setup_custom_float(
- const struct custom_float_format *format,
- bool negative,
- uint32_t mantissa,
- uint32_t exponenta,
- uint32_t *result)
-{
- uint32_t i = 0;
- uint32_t j = 0;
-
- uint32_t value = 0;
-
- /* verification code:
- * once calculation is ok we can remove it
- */
-
- const uint32_t mantissa_mask =
- (1 << (format->mantissa_bits + 1)) - 1;
-
- const uint32_t exponenta_mask =
- (1 << (format->exponenta_bits + 1)) - 1;
-
- if (mantissa & ~mantissa_mask) {
- BREAK_TO_DEBUGGER();
- mantissa = mantissa_mask;
- }
-
- if (exponenta & ~exponenta_mask) {
- BREAK_TO_DEBUGGER();
- exponenta = exponenta_mask;
- }
-
- /* end of verification code */
-
- while (i < format->mantissa_bits) {
- uint32_t mask = 1 << i;
-
- if (mantissa & mask)
- value |= mask;
-
- ++i;
- }
-
- while (j < format->exponenta_bits) {
- uint32_t mask = 1 << j;
-
- if (exponenta & mask)
- value |= mask << i;
-
- ++j;
- }
-
- if (negative && format->sign)
- value |= 1 << (i + j);
-
- *result = value;
-
- return true;
-}
-
-bool convert_to_custom_float_format(
- struct fixed31_32 value,
- const struct custom_float_format *format,
- uint32_t *result)
-{
- uint32_t mantissa;
- uint32_t exponenta;
- bool negative;
-
- return build_custom_float(
- value, format, &negative, &mantissa, &exponenta) &&
- setup_custom_float(
- format, negative, mantissa, exponenta, result);
-}
-
-
diff --git a/drivers/gpu/drm/amd/display/dc/dml/calcs/dce_calcs.c b/drivers/gpu/drm/amd/display/dc/dml/calcs/dce_calcs.c
deleted file mode 100644
index f2dfa96f9..000000000
--- a/drivers/gpu/drm/amd/display/dc/dml/calcs/dce_calcs.c
+++ /dev/null
@@ -1,3623 +0,0 @@
-/*
- * Copyright 2015 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 <linux/slab.h>
-
-#include "resource.h"
-#include "dm_services.h"
-#include "dce_calcs.h"
-#include "dc.h"
-#include "core_types.h"
-#include "dal_asic_id.h"
-#include "calcs_logger.h"
-
-/*
- * NOTE:
- * This file is gcc-parseable 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.
- */
-
-/*******************************************************************************
- * Private Functions
- ******************************************************************************/
-
-static enum bw_calcs_version bw_calcs_version_from_asic_id(struct hw_asic_id asic_id)
-{
- switch (asic_id.chip_family) {
-
- case FAMILY_CZ:
- if (ASIC_REV_IS_STONEY(asic_id.hw_internal_rev))
- return BW_CALCS_VERSION_STONEY;
- return BW_CALCS_VERSION_CARRIZO;
-
- case FAMILY_VI:
- if (ASIC_REV_IS_POLARIS12_V(asic_id.hw_internal_rev))
- return BW_CALCS_VERSION_POLARIS12;
- if (ASIC_REV_IS_POLARIS10_P(asic_id.hw_internal_rev))
- return BW_CALCS_VERSION_POLARIS10;
- if (ASIC_REV_IS_POLARIS11_M(asic_id.hw_internal_rev))
- return BW_CALCS_VERSION_POLARIS11;
- if (ASIC_REV_IS_VEGAM(asic_id.hw_internal_rev))
- return BW_CALCS_VERSION_VEGAM;
- return BW_CALCS_VERSION_INVALID;
-
- case FAMILY_AI:
- return BW_CALCS_VERSION_VEGA10;
-
- default:
- return BW_CALCS_VERSION_INVALID;
- }
-}
-
-static void calculate_bandwidth(
- const struct bw_calcs_dceip *dceip,
- const struct bw_calcs_vbios *vbios,
- struct bw_calcs_data *data)
-
-{
- const int32_t pixels_per_chunk = 512;
- const int32_t high = 2;
- const int32_t mid = 1;
- const int32_t low = 0;
- const uint32_t s_low = 0;
- const uint32_t s_mid1 = 1;
- const uint32_t s_mid2 = 2;
- const uint32_t s_mid3 = 3;
- const uint32_t s_mid4 = 4;
- const uint32_t s_mid5 = 5;
- const uint32_t s_mid6 = 6;
- const uint32_t s_high = 7;
- const uint32_t dmif_chunk_buff_margin = 1;
-
- uint32_t max_chunks_fbc_mode;
- int32_t num_cursor_lines;
-
- int32_t i, j, k;
- struct bw_fixed *yclk;
- struct bw_fixed *sclk;
- bool d0_underlay_enable;
- bool d1_underlay_enable;
- bool fbc_enabled;
- bool lpt_enabled;
- enum bw_defines sclk_message;
- enum bw_defines yclk_message;
- enum bw_defines *tiling_mode;
- enum bw_defines *surface_type;
- enum bw_defines voltage;
- enum bw_defines pipe_check;
- enum bw_defines hsr_check;
- enum bw_defines vsr_check;
- enum bw_defines lb_size_check;
- enum bw_defines fbc_check;
- enum bw_defines rotation_check;
- enum bw_defines mode_check;
- enum bw_defines nbp_state_change_enable_blank;
- /*initialize variables*/
- int32_t number_of_displays_enabled = 0;
- int32_t number_of_displays_enabled_with_margin = 0;
- int32_t number_of_aligned_displays_with_no_margin = 0;
-
- yclk = kcalloc(3, sizeof(*yclk), GFP_KERNEL);
- if (!yclk)
- return;
-
- sclk = kcalloc(8, sizeof(*sclk), GFP_KERNEL);
- if (!sclk)
- goto free_yclk;
-
- tiling_mode = kcalloc(maximum_number_of_surfaces, sizeof(*tiling_mode), GFP_KERNEL);
- if (!tiling_mode)
- goto free_sclk;
-
- surface_type = kcalloc(maximum_number_of_surfaces, sizeof(*surface_type), GFP_KERNEL);
- if (!surface_type)
- goto free_tiling_mode;
-
- yclk[low] = vbios->low_yclk;
- yclk[mid] = vbios->mid_yclk;
- yclk[high] = vbios->high_yclk;
- sclk[s_low] = vbios->low_sclk;
- sclk[s_mid1] = vbios->mid1_sclk;
- sclk[s_mid2] = vbios->mid2_sclk;
- sclk[s_mid3] = vbios->mid3_sclk;
- sclk[s_mid4] = vbios->mid4_sclk;
- sclk[s_mid5] = vbios->mid5_sclk;
- sclk[s_mid6] = vbios->mid6_sclk;
- sclk[s_high] = vbios->high_sclk;
- /*''''''''''''''''''*/
- /* surface assignment:*/
- /* 0: d0 underlay or underlay luma*/
- /* 1: d0 underlay chroma*/
- /* 2: d1 underlay or underlay luma*/
- /* 3: d1 underlay chroma*/
- /* 4: d0 graphics*/
- /* 5: d1 graphics*/
- /* 6: d2 graphics*/
- /* 7: d3 graphics, same mode as d2*/
- /* 8: d4 graphics, same mode as d2*/
- /* 9: d5 graphics, same mode as d2*/
- /* ...*/
- /* maximum_number_of_surfaces-2: d1 display_write_back420 luma*/
- /* maximum_number_of_surfaces-1: d1 display_write_back420 chroma*/
- /* underlay luma and chroma surface parameters from spreadsheet*/
-
-
-
-
- if (data->d0_underlay_mode == bw_def_none)
- d0_underlay_enable = false;
- else
- d0_underlay_enable = true;
- if (data->d1_underlay_mode == bw_def_none)
- d1_underlay_enable = false;
- else
- d1_underlay_enable = true;
- data->number_of_underlay_surfaces = d0_underlay_enable + d1_underlay_enable;
- switch (data->underlay_surface_type) {
- case bw_def_420:
- surface_type[0] = bw_def_underlay420_luma;
- surface_type[2] = bw_def_underlay420_luma;
- data->bytes_per_pixel[0] = 1;
- data->bytes_per_pixel[2] = 1;
- surface_type[1] = bw_def_underlay420_chroma;
- surface_type[3] = bw_def_underlay420_chroma;
- data->bytes_per_pixel[1] = 2;
- data->bytes_per_pixel[3] = 2;
- data->lb_size_per_component[0] = dceip->underlay420_luma_lb_size_per_component;
- data->lb_size_per_component[1] = dceip->underlay420_chroma_lb_size_per_component;
- data->lb_size_per_component[2] = dceip->underlay420_luma_lb_size_per_component;
- data->lb_size_per_component[3] = dceip->underlay420_chroma_lb_size_per_component;
- break;
- case bw_def_422:
- surface_type[0] = bw_def_underlay422;
- surface_type[2] = bw_def_underlay422;
- data->bytes_per_pixel[0] = 2;
- data->bytes_per_pixel[2] = 2;
- data->lb_size_per_component[0] = dceip->underlay422_lb_size_per_component;
- data->lb_size_per_component[2] = dceip->underlay422_lb_size_per_component;
- break;
- default:
- surface_type[0] = bw_def_underlay444;
- surface_type[2] = bw_def_underlay444;
- data->bytes_per_pixel[0] = 4;
- data->bytes_per_pixel[2] = 4;
- data->lb_size_per_component[0] = dceip->lb_size_per_component444;
- data->lb_size_per_component[2] = dceip->lb_size_per_component444;
- break;
- }
- if (d0_underlay_enable) {
- switch (data->underlay_surface_type) {
- case bw_def_420:
- data->enable[0] = 1;
- data->enable[1] = 1;
- break;
- default:
- data->enable[0] = 1;
- data->enable[1] = 0;
- break;
- }
- }
- else {
- data->enable[0] = 0;
- data->enable[1] = 0;
- }
- if (d1_underlay_enable) {
- switch (data->underlay_surface_type) {
- case bw_def_420:
- data->enable[2] = 1;
- data->enable[3] = 1;
- break;
- default:
- data->enable[2] = 1;
- data->enable[3] = 0;
- break;
- }
- }
- else {
- data->enable[2] = 0;
- data->enable[3] = 0;
- }
- data->use_alpha[0] = 0;
- data->use_alpha[1] = 0;
- data->use_alpha[2] = 0;
- data->use_alpha[3] = 0;
- data->scatter_gather_enable_for_pipe[0] = vbios->scatter_gather_enable;
- data->scatter_gather_enable_for_pipe[1] = vbios->scatter_gather_enable;
- data->scatter_gather_enable_for_pipe[2] = vbios->scatter_gather_enable;
- data->scatter_gather_enable_for_pipe[3] = vbios->scatter_gather_enable;
- /*underlay0 same and graphics display pipe0*/
- data->interlace_mode[0] = data->interlace_mode[4];
- data->interlace_mode[1] = data->interlace_mode[4];
- /*underlay1 same and graphics display pipe1*/
- data->interlace_mode[2] = data->interlace_mode[5];
- data->interlace_mode[3] = data->interlace_mode[5];
- /*underlay0 same and graphics display pipe0*/
- data->h_total[0] = data->h_total[4];
- data->v_total[0] = data->v_total[4];
- data->h_total[1] = data->h_total[4];
- data->v_total[1] = data->v_total[4];
- /*underlay1 same and graphics display pipe1*/
- data->h_total[2] = data->h_total[5];
- data->v_total[2] = data->v_total[5];
- data->h_total[3] = data->h_total[5];
- data->v_total[3] = data->v_total[5];
- /*underlay0 same and graphics display pipe0*/
- data->pixel_rate[0] = data->pixel_rate[4];
- data->pixel_rate[1] = data->pixel_rate[4];
- /*underlay1 same and graphics display pipe1*/
- data->pixel_rate[2] = data->pixel_rate[5];
- data->pixel_rate[3] = data->pixel_rate[5];
- if ((data->underlay_tiling_mode == bw_def_array_linear_general || data->underlay_tiling_mode == bw_def_array_linear_aligned)) {
- tiling_mode[0] = bw_def_linear;
- tiling_mode[1] = bw_def_linear;
- tiling_mode[2] = bw_def_linear;
- tiling_mode[3] = bw_def_linear;
- }
- else {
- tiling_mode[0] = bw_def_landscape;
- tiling_mode[1] = bw_def_landscape;
- tiling_mode[2] = bw_def_landscape;
- tiling_mode[3] = bw_def_landscape;
- }
- data->lb_bpc[0] = data->underlay_lb_bpc;
- data->lb_bpc[1] = data->underlay_lb_bpc;
- data->lb_bpc[2] = data->underlay_lb_bpc;
- data->lb_bpc[3] = data->underlay_lb_bpc;
- data->compression_rate[0] = bw_int_to_fixed(1);
- data->compression_rate[1] = bw_int_to_fixed(1);
- data->compression_rate[2] = bw_int_to_fixed(1);
- data->compression_rate[3] = bw_int_to_fixed(1);
- data->access_one_channel_only[0] = 0;
- data->access_one_channel_only[1] = 0;
- data->access_one_channel_only[2] = 0;
- data->access_one_channel_only[3] = 0;
- data->cursor_width_pixels[0] = bw_int_to_fixed(0);
- data->cursor_width_pixels[1] = bw_int_to_fixed(0);
- data->cursor_width_pixels[2] = bw_int_to_fixed(0);
- data->cursor_width_pixels[3] = bw_int_to_fixed(0);
- /* graphics surface parameters from spreadsheet*/
- fbc_enabled = false;
- lpt_enabled = false;
- for (i = 4; i <= maximum_number_of_surfaces - 3; i++) {
- if (i < data->number_of_displays + 4) {
- if (i == 4 && data->d0_underlay_mode == bw_def_underlay_only) {
- data->enable[i] = 0;
- data->use_alpha[i] = 0;
- }
- else if (i == 4 && data->d0_underlay_mode == bw_def_blend) {
- data->enable[i] = 1;
- data->use_alpha[i] = 1;
- }
- else if (i == 4) {
- data->enable[i] = 1;
- data->use_alpha[i] = 0;
- }
- else if (i == 5 && data->d1_underlay_mode == bw_def_underlay_only) {
- data->enable[i] = 0;
- data->use_alpha[i] = 0;
- }
- else if (i == 5 && data->d1_underlay_mode == bw_def_blend) {
- data->enable[i] = 1;
- data->use_alpha[i] = 1;
- }
- else {
- data->enable[i] = 1;
- data->use_alpha[i] = 0;
- }
- }
- else {
- data->enable[i] = 0;
- data->use_alpha[i] = 0;
- }
- data->scatter_gather_enable_for_pipe[i] = vbios->scatter_gather_enable;
- surface_type[i] = bw_def_graphics;
- data->lb_size_per_component[i] = dceip->lb_size_per_component444;
- if (data->graphics_tiling_mode == bw_def_array_linear_general || data->graphics_tiling_mode == bw_def_array_linear_aligned) {
- tiling_mode[i] = bw_def_linear;
- }
- else {
- tiling_mode[i] = bw_def_tiled;
- }
- data->lb_bpc[i] = data->graphics_lb_bpc;
- if ((data->fbc_en[i] == 1 && (dceip->argb_compression_support || data->d0_underlay_mode != bw_def_blended))) {
- data->compression_rate[i] = bw_int_to_fixed(vbios->average_compression_rate);
- data->access_one_channel_only[i] = data->lpt_en[i];
- }
- else {
- data->compression_rate[i] = bw_int_to_fixed(1);
- data->access_one_channel_only[i] = 0;
- }
- if (data->fbc_en[i] == 1) {
- fbc_enabled = true;
- if (data->lpt_en[i] == 1) {
- lpt_enabled = true;
- }
- }
- data->cursor_width_pixels[i] = bw_int_to_fixed(vbios->cursor_width);
- }
- /* display_write_back420*/
- data->scatter_gather_enable_for_pipe[maximum_number_of_surfaces - 2] = 0;
- data->scatter_gather_enable_for_pipe[maximum_number_of_surfaces - 1] = 0;
- if (data->d1_display_write_back_dwb_enable == 1) {
- data->enable[maximum_number_of_surfaces - 2] = 1;
- data->enable[maximum_number_of_surfaces - 1] = 1;
- }
- else {
- data->enable[maximum_number_of_surfaces - 2] = 0;
- data->enable[maximum_number_of_surfaces - 1] = 0;
- }
- surface_type[maximum_number_of_surfaces - 2] = bw_def_display_write_back420_luma;
- surface_type[maximum_number_of_surfaces - 1] = bw_def_display_write_back420_chroma;
- data->lb_size_per_component[maximum_number_of_surfaces - 2] = dceip->underlay420_luma_lb_size_per_component;
- data->lb_size_per_component[maximum_number_of_surfaces - 1] = dceip->underlay420_chroma_lb_size_per_component;
- data->bytes_per_pixel[maximum_number_of_surfaces - 2] = 1;
- data->bytes_per_pixel[maximum_number_of_surfaces - 1] = 2;
- data->interlace_mode[maximum_number_of_surfaces - 2] = data->interlace_mode[5];
- data->interlace_mode[maximum_number_of_surfaces - 1] = data->interlace_mode[5];
- data->h_taps[maximum_number_of_surfaces - 2] = bw_int_to_fixed(1);
- data->h_taps[maximum_number_of_surfaces - 1] = bw_int_to_fixed(1);
- data->v_taps[maximum_number_of_surfaces - 2] = bw_int_to_fixed(1);
- data->v_taps[maximum_number_of_surfaces - 1] = bw_int_to_fixed(1);
- data->rotation_angle[maximum_number_of_surfaces - 2] = bw_int_to_fixed(0);
- data->rotation_angle[maximum_number_of_surfaces - 1] = bw_int_to_fixed(0);
- tiling_mode[maximum_number_of_surfaces - 2] = bw_def_linear;
- tiling_mode[maximum_number_of_surfaces - 1] = bw_def_linear;
- data->lb_bpc[maximum_number_of_surfaces - 2] = 8;
- data->lb_bpc[maximum_number_of_surfaces - 1] = 8;
- data->compression_rate[maximum_number_of_surfaces - 2] = bw_int_to_fixed(1);
- data->compression_rate[maximum_number_of_surfaces - 1] = bw_int_to_fixed(1);
- data->access_one_channel_only[maximum_number_of_surfaces - 2] = 0;
- data->access_one_channel_only[maximum_number_of_surfaces - 1] = 0;
- /*assume display pipe1 has dwb enabled*/
- data->h_total[maximum_number_of_surfaces - 2] = data->h_total[5];
- data->h_total[maximum_number_of_surfaces - 1] = data->h_total[5];
- data->v_total[maximum_number_of_surfaces - 2] = data->v_total[5];
- data->v_total[maximum_number_of_surfaces - 1] = data->v_total[5];
- data->pixel_rate[maximum_number_of_surfaces - 2] = data->pixel_rate[5];
- data->pixel_rate[maximum_number_of_surfaces - 1] = data->pixel_rate[5];
- data->src_width[maximum_number_of_surfaces - 2] = data->src_width[5];
- data->src_width[maximum_number_of_surfaces - 1] = data->src_width[5];
- data->src_height[maximum_number_of_surfaces - 2] = data->src_height[5];
- data->src_height[maximum_number_of_surfaces - 1] = data->src_height[5];
- data->pitch_in_pixels[maximum_number_of_surfaces - 2] = data->src_width[5];
- data->pitch_in_pixels[maximum_number_of_surfaces - 1] = data->src_width[5];
- data->h_scale_ratio[maximum_number_of_surfaces - 2] = bw_int_to_fixed(1);
- data->h_scale_ratio[maximum_number_of_surfaces - 1] = bw_int_to_fixed(1);
- data->v_scale_ratio[maximum_number_of_surfaces - 2] = bw_int_to_fixed(1);
- data->v_scale_ratio[maximum_number_of_surfaces - 1] = bw_int_to_fixed(1);
- data->stereo_mode[maximum_number_of_surfaces - 2] = bw_def_mono;
- data->stereo_mode[maximum_number_of_surfaces - 1] = bw_def_mono;
- data->cursor_width_pixels[maximum_number_of_surfaces - 2] = bw_int_to_fixed(0);
- data->cursor_width_pixels[maximum_number_of_surfaces - 1] = bw_int_to_fixed(0);
- data->use_alpha[maximum_number_of_surfaces - 2] = 0;
- data->use_alpha[maximum_number_of_surfaces - 1] = 0;
- /*mode check calculations:*/
- /* mode within dce ip capabilities*/
- /* fbc*/
- /* hsr*/
- /* vsr*/
- /* lb size*/
- /*effective scaling source and ratios:*/
- /*for graphics, non-stereo, non-interlace surfaces when the size of the source and destination are the same, only one tap is used*/
- /*420 chroma has half the width, height, horizontal and vertical scaling ratios than luma*/
- /*rotating a graphic or underlay surface swaps the width, height, horizontal and vertical scaling ratios*/
- /*in top-bottom stereo mode there is 2:1 vertical downscaling for each eye*/
- /*in side-by-side stereo mode there is 2:1 horizontal downscaling for each eye*/
- /*in interlace mode there is 2:1 vertical downscaling for each field*/
- /*in panning or bezel adjustment mode the source width has an extra 128 pixels*/
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if (bw_equ(data->h_scale_ratio[i], bw_int_to_fixed(1)) && bw_equ(data->v_scale_ratio[i], bw_int_to_fixed(1)) && surface_type[i] == bw_def_graphics && data->stereo_mode[i] == bw_def_mono && data->interlace_mode[i] == 0) {
- data->h_taps[i] = bw_int_to_fixed(1);
- data->v_taps[i] = bw_int_to_fixed(1);
- }
- if (surface_type[i] == bw_def_display_write_back420_chroma || surface_type[i] == bw_def_underlay420_chroma) {
- data->pitch_in_pixels_after_surface_type[i] = bw_div(data->pitch_in_pixels[i], bw_int_to_fixed(2));
- data->src_width_after_surface_type = bw_div(data->src_width[i], bw_int_to_fixed(2));
- data->src_height_after_surface_type = bw_div(data->src_height[i], bw_int_to_fixed(2));
- data->hsr_after_surface_type = bw_div(data->h_scale_ratio[i], bw_int_to_fixed(2));
- data->vsr_after_surface_type = bw_div(data->v_scale_ratio[i], bw_int_to_fixed(2));
- }
- else {
- data->pitch_in_pixels_after_surface_type[i] = data->pitch_in_pixels[i];
- data->src_width_after_surface_type = data->src_width[i];
- data->src_height_after_surface_type = data->src_height[i];
- data->hsr_after_surface_type = data->h_scale_ratio[i];
- data->vsr_after_surface_type = data->v_scale_ratio[i];
- }
- if ((bw_equ(data->rotation_angle[i], bw_int_to_fixed(90)) || bw_equ(data->rotation_angle[i], bw_int_to_fixed(270))) && surface_type[i] != bw_def_display_write_back420_luma && surface_type[i] != bw_def_display_write_back420_chroma) {
- data->src_width_after_rotation = data->src_height_after_surface_type;
- data->src_height_after_rotation = data->src_width_after_surface_type;
- data->hsr_after_rotation = data->vsr_after_surface_type;
- data->vsr_after_rotation = data->hsr_after_surface_type;
- }
- else {
- data->src_width_after_rotation = data->src_width_after_surface_type;
- data->src_height_after_rotation = data->src_height_after_surface_type;
- data->hsr_after_rotation = data->hsr_after_surface_type;
- data->vsr_after_rotation = data->vsr_after_surface_type;
- }
- switch (data->stereo_mode[i]) {
- case bw_def_top_bottom:
- data->source_width_pixels[i] = data->src_width_after_rotation;
- data->source_height_pixels = bw_mul(bw_int_to_fixed(2), data->src_height_after_rotation);
- data->hsr_after_stereo = data->hsr_after_rotation;
- data->vsr_after_stereo = bw_mul(bw_int_to_fixed(1), data->vsr_after_rotation);
- break;
- case bw_def_side_by_side:
- data->source_width_pixels[i] = bw_mul(bw_int_to_fixed(2), data->src_width_after_rotation);
- data->source_height_pixels = data->src_height_after_rotation;
- data->hsr_after_stereo = bw_mul(bw_int_to_fixed(1), data->hsr_after_rotation);
- data->vsr_after_stereo = data->vsr_after_rotation;
- break;
- default:
- data->source_width_pixels[i] = data->src_width_after_rotation;
- data->source_height_pixels = data->src_height_after_rotation;
- data->hsr_after_stereo = data->hsr_after_rotation;
- data->vsr_after_stereo = data->vsr_after_rotation;
- break;
- }
- data->hsr[i] = data->hsr_after_stereo;
- if (data->interlace_mode[i]) {
- data->vsr[i] = bw_mul(data->vsr_after_stereo, bw_int_to_fixed(2));
- }
- else {
- data->vsr[i] = data->vsr_after_stereo;
- }
- if (data->panning_and_bezel_adjustment != bw_def_none) {
- data->source_width_rounded_up_to_chunks[i] = bw_add(bw_floor2(bw_sub(data->source_width_pixels[i], bw_int_to_fixed(1)), bw_int_to_fixed(128)), bw_int_to_fixed(256));
- }
- else {
- data->source_width_rounded_up_to_chunks[i] = bw_ceil2(data->source_width_pixels[i], bw_int_to_fixed(128));
- }
- data->source_height_rounded_up_to_chunks[i] = data->source_height_pixels;
- }
- }
- /*mode support checks:*/
- /*the number of graphics and underlay pipes is limited by the ip support*/
- /*maximum horizontal and vertical scale ratio is 4, and should not exceed the number of taps*/
- /*for downscaling with the pre-downscaler, the horizontal scale ratio must be more than the ceiling of one quarter of the number of taps*/
- /*the pre-downscaler reduces the line buffer source by the horizontal scale ratio*/
- /*the number of lines in the line buffer has to exceed the number of vertical taps*/
- /*the size of the line in the line buffer is the product of the source width and the bits per component, rounded up to a multiple of 48*/
- /*the size of the line in the line buffer in the case of 10 bit per component is the product of the source width rounded up to multiple of 8 and 30.023438 / 3, rounded up to a multiple of 48*/
- /*the size of the line in the line buffer in the case of 8 bit per component is the product of the source width rounded up to multiple of 8 and 30.023438 / 3, rounded up to a multiple of 48*/
- /*frame buffer compression is not supported with stereo mode, rotation, or non- 888 formats*/
- /*rotation is not supported with linear of stereo modes*/
- if (dceip->number_of_graphics_pipes >= data->number_of_displays && dceip->number_of_underlay_pipes >= data->number_of_underlay_surfaces && !(dceip->display_write_back_supported == 0 && data->d1_display_write_back_dwb_enable == 1)) {
- pipe_check = bw_def_ok;
- }
- else {
- pipe_check = bw_def_notok;
- }
- hsr_check = bw_def_ok;
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if (bw_neq(data->hsr[i], bw_int_to_fixed(1))) {
- if (bw_mtn(data->hsr[i], bw_int_to_fixed(4))) {
- hsr_check = bw_def_hsr_mtn_4;
- }
- else {
- if (bw_mtn(data->hsr[i], data->h_taps[i])) {
- hsr_check = bw_def_hsr_mtn_h_taps;
- }
- else {
- if (dceip->pre_downscaler_enabled == 1 && bw_mtn(data->hsr[i], bw_int_to_fixed(1)) && bw_leq(data->hsr[i], bw_ceil2(bw_div(data->h_taps[i], bw_int_to_fixed(4)), bw_int_to_fixed(1)))) {
- hsr_check = bw_def_ceiling__h_taps_div_4___meq_hsr;
- }
- }
- }
- }
- }
- }
- vsr_check = bw_def_ok;
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if (bw_neq(data->vsr[i], bw_int_to_fixed(1))) {
- if (bw_mtn(data->vsr[i], bw_int_to_fixed(4))) {
- vsr_check = bw_def_vsr_mtn_4;
- }
- else {
- if (bw_mtn(data->vsr[i], data->v_taps[i])) {
- vsr_check = bw_def_vsr_mtn_v_taps;
- }
- }
- }
- }
- }
- lb_size_check = bw_def_ok;
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if ((dceip->pre_downscaler_enabled && bw_mtn(data->hsr[i], bw_int_to_fixed(1)))) {
- data->source_width_in_lb = bw_div(data->source_width_pixels[i], data->hsr[i]);
- }
- else {
- data->source_width_in_lb = data->source_width_pixels[i];
- }
- switch (data->lb_bpc[i]) {
- case 8:
- data->lb_line_pitch = bw_ceil2(bw_mul(bw_div(bw_frc_to_fixed(2401171875ul, 100000000), bw_int_to_fixed(3)), bw_ceil2(data->source_width_in_lb, bw_int_to_fixed(8))), bw_int_to_fixed(48));
- break;
- case 10:
- data->lb_line_pitch = bw_ceil2(bw_mul(bw_div(bw_frc_to_fixed(300234375, 10000000), bw_int_to_fixed(3)), bw_ceil2(data->source_width_in_lb, bw_int_to_fixed(8))), bw_int_to_fixed(48));
- break;
- default:
- data->lb_line_pitch = bw_ceil2(bw_mul(bw_int_to_fixed(data->lb_bpc[i]), data->source_width_in_lb), bw_int_to_fixed(48));
- break;
- }
- data->lb_partitions[i] = bw_floor2(bw_div(data->lb_size_per_component[i], data->lb_line_pitch), bw_int_to_fixed(1));
- /*clamp the partitions to the maxium number supported by the lb*/
- if ((surface_type[i] != bw_def_graphics || dceip->graphics_lb_nodownscaling_multi_line_prefetching == 1)) {
- data->lb_partitions_max[i] = bw_int_to_fixed(10);
- }
- else {
- data->lb_partitions_max[i] = bw_int_to_fixed(7);
- }
- data->lb_partitions[i] = bw_min2(data->lb_partitions_max[i], data->lb_partitions[i]);
- if (bw_mtn(bw_add(data->v_taps[i], bw_int_to_fixed(1)), data->lb_partitions[i])) {
- lb_size_check = bw_def_notok;
- }
- }
- }
- fbc_check = bw_def_ok;
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i] && data->fbc_en[i] == 1 && (bw_equ(data->rotation_angle[i], bw_int_to_fixed(90)) || bw_equ(data->rotation_angle[i], bw_int_to_fixed(270)) || data->stereo_mode[i] != bw_def_mono || data->bytes_per_pixel[i] != 4)) {
- fbc_check = bw_def_invalid_rotation_or_bpp_or_stereo;
- }
- }
- rotation_check = bw_def_ok;
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if ((bw_equ(data->rotation_angle[i], bw_int_to_fixed(90)) || bw_equ(data->rotation_angle[i], bw_int_to_fixed(270))) && (tiling_mode[i] == bw_def_linear || data->stereo_mode[i] != bw_def_mono)) {
- rotation_check = bw_def_invalid_linear_or_stereo_mode;
- }
- }
- }
- if (pipe_check == bw_def_ok && hsr_check == bw_def_ok && vsr_check == bw_def_ok && lb_size_check == bw_def_ok && fbc_check == bw_def_ok && rotation_check == bw_def_ok) {
- mode_check = bw_def_ok;
- }
- else {
- mode_check = bw_def_notok;
- }
- /*number of memory channels for write-back client*/
- data->number_of_dram_wrchannels = vbios->number_of_dram_channels;
- data->number_of_dram_channels = vbios->number_of_dram_channels;
- /*modify number of memory channels if lpt mode is enabled*/
- /* low power tiling mode register*/
- /* 0 = use channel 0*/
- /* 1 = use channel 0 and 1*/
- /* 2 = use channel 0,1,2,3*/
- if ((fbc_enabled == 1 && lpt_enabled == 1)) {
- if (vbios->memory_type == bw_def_hbm)
- data->dram_efficiency = bw_frc_to_fixed(5, 10);
- else
- data->dram_efficiency = bw_int_to_fixed(1);
-
-
- if (dceip->low_power_tiling_mode == 0) {
- data->number_of_dram_channels = 1;
- }
- else if (dceip->low_power_tiling_mode == 1) {
- data->number_of_dram_channels = 2;
- }
- else if (dceip->low_power_tiling_mode == 2) {
- data->number_of_dram_channels = 4;
- }
- else {
- data->number_of_dram_channels = 1;
- }
- }
- else {
- if (vbios->memory_type == bw_def_hbm)
- data->dram_efficiency = bw_frc_to_fixed(5, 10);
- else
- data->dram_efficiency = bw_frc_to_fixed(8, 10);
- }
- /*memory request size and latency hiding:*/
- /*request size is normally 64 byte, 2-line interleaved, with full latency hiding*/
- /*the display write-back requests are single line*/
- /*for tiled graphics surfaces, or undelay surfaces with width higher than the maximum size for full efficiency, request size is 32 byte in 8 and 16 bpp or if the rotation is orthogonal to the tiling grain. only half is useful of the bytes in the request size in 8 bpp or in 32 bpp if the rotation is orthogonal to the tiling grain.*/
- /*for undelay surfaces with width lower than the maximum size for full efficiency, requests are 4-line interleaved in 16bpp if the rotation is parallel to the tiling grain, and 8-line interleaved with 4-line latency hiding in 8bpp or if the rotation is orthogonal to the tiling grain.*/
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if ((bw_equ(data->rotation_angle[i], bw_int_to_fixed(90)) || bw_equ(data->rotation_angle[i], bw_int_to_fixed(270)))) {
- if ((i < 4)) {
- /*underlay portrait tiling mode is not supported*/
- data->orthogonal_rotation[i] = 1;
- }
- else {
- /*graphics portrait tiling mode*/
- if (data->graphics_micro_tile_mode == bw_def_rotated_micro_tiling) {
- data->orthogonal_rotation[i] = 0;
- }
- else {
- data->orthogonal_rotation[i] = 1;
- }
- }
- }
- else {
- if ((i < 4)) {
- /*underlay landscape tiling mode is only supported*/
- if (data->underlay_micro_tile_mode == bw_def_display_micro_tiling) {
- data->orthogonal_rotation[i] = 0;
- }
- else {
- data->orthogonal_rotation[i] = 1;
- }
- }
- else {
- /*graphics landscape tiling mode*/
- if (data->graphics_micro_tile_mode == bw_def_display_micro_tiling) {
- data->orthogonal_rotation[i] = 0;
- }
- else {
- data->orthogonal_rotation[i] = 1;
- }
- }
- }
- if (bw_equ(data->rotation_angle[i], bw_int_to_fixed(90)) || bw_equ(data->rotation_angle[i], bw_int_to_fixed(270))) {
- data->underlay_maximum_source_efficient_for_tiling = dceip->underlay_maximum_height_efficient_for_tiling;
- }
- else {
- data->underlay_maximum_source_efficient_for_tiling = dceip->underlay_maximum_width_efficient_for_tiling;
- }
- if (surface_type[i] == bw_def_display_write_back420_luma || surface_type[i] == bw_def_display_write_back420_chroma) {
- data->bytes_per_request[i] = bw_int_to_fixed(64);
- data->useful_bytes_per_request[i] = bw_int_to_fixed(64);
- data->lines_interleaved_in_mem_access[i] = bw_int_to_fixed(1);
- data->latency_hiding_lines[i] = bw_int_to_fixed(1);
- }
- else if (tiling_mode[i] == bw_def_linear) {
- data->bytes_per_request[i] = bw_int_to_fixed(64);
- data->useful_bytes_per_request[i] = bw_int_to_fixed(64);
- data->lines_interleaved_in_mem_access[i] = bw_int_to_fixed(2);
- data->latency_hiding_lines[i] = bw_int_to_fixed(2);
- }
- else {
- if (surface_type[i] == bw_def_graphics || (bw_mtn(data->source_width_rounded_up_to_chunks[i], bw_ceil2(data->underlay_maximum_source_efficient_for_tiling, bw_int_to_fixed(256))))) {
- switch (data->bytes_per_pixel[i]) {
- case 8:
- data->lines_interleaved_in_mem_access[i] = bw_int_to_fixed(2);
- data->latency_hiding_lines[i] = bw_int_to_fixed(2);
- if (data->orthogonal_rotation[i]) {
- data->bytes_per_request[i] = bw_int_to_fixed(32);
- data->useful_bytes_per_request[i] = bw_int_to_fixed(32);
- }
- else {
- data->bytes_per_request[i] = bw_int_to_fixed(64);
- data->useful_bytes_per_request[i] = bw_int_to_fixed(64);
- }
- break;
- case 4:
- if (data->orthogonal_rotation[i]) {
- data->lines_interleaved_in_mem_access[i] = bw_int_to_fixed(2);
- data->latency_hiding_lines[i] = bw_int_to_fixed(2);
- data->bytes_per_request[i] = bw_int_to_fixed(32);
- data->useful_bytes_per_request[i] = bw_int_to_fixed(16);
- }
- else {
- data->lines_interleaved_in_mem_access[i] = bw_int_to_fixed(2);
- data->latency_hiding_lines[i] = bw_int_to_fixed(2);
- data->bytes_per_request[i] = bw_int_to_fixed(64);
- data->useful_bytes_per_request[i] = bw_int_to_fixed(64);
- }
- break;
- case 2:
- data->lines_interleaved_in_mem_access[i] = bw_int_to_fixed(2);
- data->latency_hiding_lines[i] = bw_int_to_fixed(2);
- data->bytes_per_request[i] = bw_int_to_fixed(32);
- data->useful_bytes_per_request[i] = bw_int_to_fixed(32);
- break;
- default:
- data->lines_interleaved_in_mem_access[i] = bw_int_to_fixed(2);
- data->latency_hiding_lines[i] = bw_int_to_fixed(2);
- data->bytes_per_request[i] = bw_int_to_fixed(32);
- data->useful_bytes_per_request[i] = bw_int_to_fixed(16);
- break;
- }
- }
- else {
- data->bytes_per_request[i] = bw_int_to_fixed(64);
- data->useful_bytes_per_request[i] = bw_int_to_fixed(64);
- if (data->orthogonal_rotation[i]) {
- data->lines_interleaved_in_mem_access[i] = bw_int_to_fixed(8);
- data->latency_hiding_lines[i] = bw_int_to_fixed(4);
- }
- else {
- switch (data->bytes_per_pixel[i]) {
- case 4:
- data->lines_interleaved_in_mem_access[i] = bw_int_to_fixed(2);
- data->latency_hiding_lines[i] = bw_int_to_fixed(2);
- break;
- case 2:
- data->lines_interleaved_in_mem_access[i] = bw_int_to_fixed(4);
- data->latency_hiding_lines[i] = bw_int_to_fixed(4);
- break;
- default:
- data->lines_interleaved_in_mem_access[i] = bw_int_to_fixed(8);
- data->latency_hiding_lines[i] = bw_int_to_fixed(4);
- break;
- }
- }
- }
- }
- }
- }
- /*requested peak bandwidth:*/
- /*the peak request-per-second bandwidth is the product of the maximum source lines in per line out in the beginning*/
- /*and in the middle of the frame, the ratio of the source width to the line time, the ratio of line interleaving*/
- /*in memory to lines of latency hiding, and the ratio of bytes per pixel to useful bytes per request.*/
- /**/
- /*if the dmif data buffer size holds more than vta_ps worth of source lines, then only vsr is used.*/
- /*the peak bandwidth is the peak request-per-second bandwidth times the request size.*/
- /**/
- /*the line buffer lines in per line out in the beginning of the frame is the vertical filter initialization value*/
- /*rounded up to even and divided by the line times for initialization, which is normally three.*/
- /*the line buffer lines in per line out in the middle of the frame is at least one, or the vertical scale ratio,*/
- /*rounded up to line pairs if not doing line buffer prefetching.*/
- /**/
- /*the non-prefetching rounding up of the vertical scale ratio can also be done up to 1 (for a 0,2 pattern), 4/3 (for a 0,2,2 pattern),*/
- /*6/4 (for a 0,2,2,2 pattern), or 3 (for a 2,4 pattern).*/
- /**/
- /*the scaler vertical filter initialization value is calculated by the hardware as the floor of the average of the*/
- /*vertical scale ratio and the number of vertical taps increased by one. add one more for possible odd line*/
- /*panning/bezel adjustment mode.*/
- /**/
- /*for the bottom interlace field an extra 50% of the vertical scale ratio is considered for this calculation.*/
- /*in top-bottom stereo mode software has to set the filter initialization value manually and explicitly limit it to 4.*/
- /*furthermore, there is only one line time for initialization.*/
- /**/
- /*line buffer prefetching is done when the number of lines in the line buffer exceeds the number of taps plus*/
- /*the ceiling of the vertical scale ratio.*/
- /**/
- /*multi-line buffer prefetching is only done in the graphics pipe when the scaler is disabled or when upscaling and the vsr <= 0.8.'*/
- /**/
- /*the horizontal blank and chunk granularity factor is indirectly used indicate the interval of time required to transfer the source pixels.*/
- /*the denominator of this term represents the total number of destination output pixels required for the input source pixels.*/
- /*it applies when the lines in per line out is not 2 or 4. it does not apply when there is a line buffer between the scl and blnd.*/
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- data->v_filter_init[i] = bw_floor2(bw_div((bw_add(bw_add(bw_add(bw_int_to_fixed(1), data->v_taps[i]), data->vsr[i]), bw_mul(bw_mul(bw_int_to_fixed(data->interlace_mode[i]), bw_frc_to_fixed(5, 10)), data->vsr[i]))), bw_int_to_fixed(2)), bw_int_to_fixed(1));
- if (data->panning_and_bezel_adjustment == bw_def_any_lines) {
- data->v_filter_init[i] = bw_add(data->v_filter_init[i], bw_int_to_fixed(1));
- }
- if (data->stereo_mode[i] == bw_def_top_bottom) {
- data->v_filter_init[i] = bw_min2(data->v_filter_init[i], bw_int_to_fixed(4));
- }
- if (data->stereo_mode[i] == bw_def_top_bottom) {
- data->num_lines_at_frame_start = bw_int_to_fixed(1);
- }
- else {
- data->num_lines_at_frame_start = bw_int_to_fixed(3);
- }
- if ((bw_mtn(data->vsr[i], bw_int_to_fixed(1)) && surface_type[i] == bw_def_graphics) || data->panning_and_bezel_adjustment == bw_def_any_lines) {
- data->line_buffer_prefetch[i] = 0;
- }
- else if ((((dceip->underlay_downscale_prefetch_enabled == 1 && surface_type[i] != bw_def_graphics) || surface_type[i] == bw_def_graphics) && (bw_mtn(data->lb_partitions[i], bw_add(data->v_taps[i], bw_ceil2(data->vsr[i], bw_int_to_fixed(1))))))) {
- data->line_buffer_prefetch[i] = 1;
- }
- else {
- data->line_buffer_prefetch[i] = 0;
- }
- data->lb_lines_in_per_line_out_in_beginning_of_frame[i] = bw_div(bw_ceil2(data->v_filter_init[i], bw_int_to_fixed(dceip->lines_interleaved_into_lb)), data->num_lines_at_frame_start);
- if (data->line_buffer_prefetch[i] == 1) {
- data->lb_lines_in_per_line_out_in_middle_of_frame[i] = bw_max2(bw_int_to_fixed(1), data->vsr[i]);
- }
- else if (bw_leq(data->vsr[i], bw_int_to_fixed(1))) {
- data->lb_lines_in_per_line_out_in_middle_of_frame[i] = bw_int_to_fixed(1);
- } else if (bw_leq(data->vsr[i],
- bw_frc_to_fixed(4, 3))) {
- data->lb_lines_in_per_line_out_in_middle_of_frame[i] = bw_div(bw_int_to_fixed(4), bw_int_to_fixed(3));
- } else if (bw_leq(data->vsr[i],
- bw_frc_to_fixed(6, 4))) {
- data->lb_lines_in_per_line_out_in_middle_of_frame[i] = bw_div(bw_int_to_fixed(6), bw_int_to_fixed(4));
- }
- else if (bw_leq(data->vsr[i], bw_int_to_fixed(2))) {
- data->lb_lines_in_per_line_out_in_middle_of_frame[i] = bw_int_to_fixed(2);
- }
- else if (bw_leq(data->vsr[i], bw_int_to_fixed(3))) {
- data->lb_lines_in_per_line_out_in_middle_of_frame[i] = bw_int_to_fixed(3);
- }
- else {
- data->lb_lines_in_per_line_out_in_middle_of_frame[i] = bw_int_to_fixed(4);
- }
- if (data->line_buffer_prefetch[i] == 1 || bw_equ(data->lb_lines_in_per_line_out_in_middle_of_frame[i], bw_int_to_fixed(2)) || bw_equ(data->lb_lines_in_per_line_out_in_middle_of_frame[i], bw_int_to_fixed(4))) {
- data->horizontal_blank_and_chunk_granularity_factor[i] = bw_int_to_fixed(1);
- }
- else {
- data->horizontal_blank_and_chunk_granularity_factor[i] = bw_div(data->h_total[i], (bw_div((bw_add(data->h_total[i], bw_div((bw_sub(data->source_width_pixels[i], bw_int_to_fixed(dceip->chunk_width))), data->hsr[i]))), bw_int_to_fixed(2))));
- }
- data->request_bandwidth[i] = bw_div(bw_mul(bw_div(bw_mul(bw_div(bw_mul(bw_max2(data->lb_lines_in_per_line_out_in_beginning_of_frame[i], data->lb_lines_in_per_line_out_in_middle_of_frame[i]), data->source_width_rounded_up_to_chunks[i]), (bw_div(data->h_total[i], data->pixel_rate[i]))), bw_int_to_fixed(data->bytes_per_pixel[i])), data->useful_bytes_per_request[i]), data->lines_interleaved_in_mem_access[i]), data->latency_hiding_lines[i]);
- data->display_bandwidth[i] = bw_mul(data->request_bandwidth[i], data->bytes_per_request[i]);
- }
- }
- /*outstanding chunk request limit*/
- /*if underlay buffer sharing is enabled, the data buffer size for underlay in 422 or 444 is the sum of the luma and chroma data buffer sizes.*/
- /*underlay buffer sharing mode is only permitted in orthogonal rotation modes.*/
- /**/
- /*if there is only one display enabled, the dmif data buffer size for the graphics surface is increased by concatenating the adjacent buffers.*/
- /**/
- /*the memory chunk size in bytes is 1024 for the writeback, and 256 times the memory line interleaving and the bytes per pixel for graphics*/
- /*and underlay.*/
- /**/
- /*the pipe chunk size uses 2 for line interleaving, except for the write back, in which case it is 1.*/
- /*graphics and underlay data buffer size is adjusted (limited) using the outstanding chunk request limit if there is more than one*/
- /*display enabled or if the dmif request buffer is not large enough for the total data buffer size.*/
- /*the outstanding chunk request limit is the ceiling of the adjusted data buffer size divided by the chunk size in bytes*/
- /*the adjusted data buffer size is the product of the display bandwidth and the minimum effective data buffer size in terms of time,*/
- /*rounded up to the chunk size in bytes, but should not exceed the original data buffer size*/
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if ((dceip->dmif_pipe_en_fbc_chunk_tracker + 3 == i && fbc_enabled == 0 && tiling_mode[i] != bw_def_linear)) {
- data->max_chunks_non_fbc_mode[i] = 128 - dmif_chunk_buff_margin;
- }
- else {
- data->max_chunks_non_fbc_mode[i] = 16 - dmif_chunk_buff_margin;
- }
- }
- if (data->fbc_en[i] == 1) {
- max_chunks_fbc_mode = 128 - dmif_chunk_buff_margin;
- }
- }
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- switch (surface_type[i]) {
- case bw_def_display_write_back420_luma:
- data->data_buffer_size[i] = bw_int_to_fixed(dceip->display_write_back420_luma_mcifwr_buffer_size);
- break;
- case bw_def_display_write_back420_chroma:
- data->data_buffer_size[i] = bw_int_to_fixed(dceip->display_write_back420_chroma_mcifwr_buffer_size);
- break;
- case bw_def_underlay420_luma:
- data->data_buffer_size[i] = bw_int_to_fixed(dceip->underlay_luma_dmif_size);
- break;
- case bw_def_underlay420_chroma:
- data->data_buffer_size[i] = bw_div(bw_int_to_fixed(dceip->underlay_chroma_dmif_size), bw_int_to_fixed(2));
- break;
- case bw_def_underlay422:case bw_def_underlay444:
- if (data->orthogonal_rotation[i] == 0) {
- data->data_buffer_size[i] = bw_int_to_fixed(dceip->underlay_luma_dmif_size);
- }
- else {
- data->data_buffer_size[i] = bw_add(bw_int_to_fixed(dceip->underlay_luma_dmif_size), bw_int_to_fixed(dceip->underlay_chroma_dmif_size));
- }
- break;
- default:
- if (data->fbc_en[i] == 1) {
- /*data_buffer_size(i) = max_dmif_buffer_allocated * graphics_dmif_size*/
- if (data->number_of_displays == 1) {
- data->data_buffer_size[i] = bw_min2(bw_mul(bw_mul(bw_int_to_fixed(max_chunks_fbc_mode), bw_int_to_fixed(pixels_per_chunk)), bw_int_to_fixed(data->bytes_per_pixel[i])), bw_mul(bw_int_to_fixed(dceip->max_dmif_buffer_allocated), bw_int_to_fixed(dceip->graphics_dmif_size)));
- }
- else {
- data->data_buffer_size[i] = bw_min2(bw_mul(bw_mul(bw_int_to_fixed(max_chunks_fbc_mode), bw_int_to_fixed(pixels_per_chunk)), bw_int_to_fixed(data->bytes_per_pixel[i])), bw_int_to_fixed(dceip->graphics_dmif_size));
- }
- }
- else {
- /*the effective dmif buffer size in non-fbc mode is limited by the 16 entry chunk tracker*/
- if (data->number_of_displays == 1) {
- data->data_buffer_size[i] = bw_min2(bw_mul(bw_mul(bw_int_to_fixed(data->max_chunks_non_fbc_mode[i]), bw_int_to_fixed(pixels_per_chunk)), bw_int_to_fixed(data->bytes_per_pixel[i])), bw_mul(bw_int_to_fixed(dceip->max_dmif_buffer_allocated), bw_int_to_fixed(dceip->graphics_dmif_size)));
- }
- else {
- data->data_buffer_size[i] = bw_min2(bw_mul(bw_mul(bw_int_to_fixed(data->max_chunks_non_fbc_mode[i]), bw_int_to_fixed(pixels_per_chunk)), bw_int_to_fixed(data->bytes_per_pixel[i])), bw_int_to_fixed(dceip->graphics_dmif_size));
- }
- }
- break;
- }
- if (surface_type[i] == bw_def_display_write_back420_luma || surface_type[i] == bw_def_display_write_back420_chroma) {
- data->memory_chunk_size_in_bytes[i] = bw_int_to_fixed(1024);
- data->pipe_chunk_size_in_bytes[i] = bw_int_to_fixed(1024);
- }
- else {
- data->memory_chunk_size_in_bytes[i] = bw_mul(bw_mul(bw_int_to_fixed(dceip->chunk_width), data->lines_interleaved_in_mem_access[i]), bw_int_to_fixed(data->bytes_per_pixel[i]));
- data->pipe_chunk_size_in_bytes[i] = bw_mul(bw_mul(bw_int_to_fixed(dceip->chunk_width), bw_int_to_fixed(dceip->lines_interleaved_into_lb)), bw_int_to_fixed(data->bytes_per_pixel[i]));
- }
- }
- }
- data->min_dmif_size_in_time = bw_int_to_fixed(9999);
- data->min_mcifwr_size_in_time = bw_int_to_fixed(9999);
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if (surface_type[i] != bw_def_display_write_back420_luma && surface_type[i] != bw_def_display_write_back420_chroma) {
- if (bw_ltn(bw_div(bw_div(bw_mul(data->data_buffer_size[i], data->bytes_per_request[i]), data->useful_bytes_per_request[i]), data->display_bandwidth[i]), data->min_dmif_size_in_time)) {
- data->min_dmif_size_in_time = bw_div(bw_div(bw_mul(data->data_buffer_size[i], data->bytes_per_request[i]), data->useful_bytes_per_request[i]), data->display_bandwidth[i]);
- }
- }
- else {
- if (bw_ltn(bw_div(bw_div(bw_mul(data->data_buffer_size[i], data->bytes_per_request[i]), data->useful_bytes_per_request[i]), data->display_bandwidth[i]), data->min_mcifwr_size_in_time)) {
- data->min_mcifwr_size_in_time = bw_div(bw_div(bw_mul(data->data_buffer_size[i], data->bytes_per_request[i]), data->useful_bytes_per_request[i]), data->display_bandwidth[i]);
- }
- }
- }
- }
- data->total_requests_for_dmif_size = bw_int_to_fixed(0);
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i] && surface_type[i] != bw_def_display_write_back420_luma && surface_type[i] != bw_def_display_write_back420_chroma) {
- data->total_requests_for_dmif_size = bw_add(data->total_requests_for_dmif_size, bw_div(data->data_buffer_size[i], data->useful_bytes_per_request[i]));
- }
- }
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if (surface_type[i] != bw_def_display_write_back420_luma && surface_type[i] != bw_def_display_write_back420_chroma && dceip->limit_excessive_outstanding_dmif_requests && (data->number_of_displays > 1 || bw_mtn(data->total_requests_for_dmif_size, dceip->dmif_request_buffer_size))) {
- data->adjusted_data_buffer_size[i] = bw_min2(data->data_buffer_size[i], bw_ceil2(bw_mul(data->min_dmif_size_in_time, data->display_bandwidth[i]), data->memory_chunk_size_in_bytes[i]));
- }
- else {
- data->adjusted_data_buffer_size[i] = data->data_buffer_size[i];
- }
- }
- }
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if (data->number_of_displays == 1 && data->number_of_underlay_surfaces == 0) {
- /*set maximum chunk limit if only one graphic pipe is enabled*/
- data->outstanding_chunk_request_limit[i] = bw_int_to_fixed(127);
- }
- else {
- data->outstanding_chunk_request_limit[i] = bw_ceil2(bw_div(data->adjusted_data_buffer_size[i], data->pipe_chunk_size_in_bytes[i]), bw_int_to_fixed(1));
- /*clamp maximum chunk limit in the graphic display pipe*/
- if (i >= 4) {
- data->outstanding_chunk_request_limit[i] = bw_max2(bw_int_to_fixed(127), data->outstanding_chunk_request_limit[i]);
- }
- }
- }
- }
- /*outstanding pte request limit*/
- /*in tiling mode with no rotation the sg pte requests are 8 useful pt_es, the sg row height is the page height and the sg page width x height is 64x64 for 8bpp, 64x32 for 16 bpp, 32x32 for 32 bpp*/
- /*in tiling mode with rotation the sg pte requests are only one useful pte, and the sg row height is also the page height, but the sg page width and height are swapped*/
- /*in linear mode the pte requests are 8 useful pt_es, the sg page width is 4096 divided by the bytes per pixel, the sg page height is 1, but there is just one row whose height is the lines of pte prefetching*/
- /*the outstanding pte request limit is obtained by multiplying the outstanding chunk request limit by the peak pte request to eviction limiting ratio, rounding up to integer, multiplying by the pte requests per chunk, and rounding up to integer again*/
- /*if not using peak pte request to eviction limiting, the outstanding pte request limit is the pte requests in the vblank*/
- /*the pte requests in the vblank is the product of the number of pte request rows times the number of pte requests in a row*/
- /*the number of pte requests in a row is the quotient of the source width divided by 256, multiplied by the pte requests per chunk, rounded up to even, multiplied by the scatter-gather row height and divided by the scatter-gather page height*/
- /*the pte requests per chunk is 256 divided by the scatter-gather page width and the useful pt_es per pte request*/
- if (data->number_of_displays > 1 || (bw_neq(data->rotation_angle[4], bw_int_to_fixed(0)) && bw_neq(data->rotation_angle[4], bw_int_to_fixed(180)))) {
- data->peak_pte_request_to_eviction_ratio_limiting = dceip->peak_pte_request_to_eviction_ratio_limiting_multiple_displays_or_single_rotated_display;
- }
- else {
- data->peak_pte_request_to_eviction_ratio_limiting = dceip->peak_pte_request_to_eviction_ratio_limiting_single_display_no_rotation;
- }
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i] && data->scatter_gather_enable_for_pipe[i] == 1) {
- if (tiling_mode[i] == bw_def_linear) {
- data->useful_pte_per_pte_request = bw_int_to_fixed(8);
- data->scatter_gather_page_width[i] = bw_div(bw_int_to_fixed(4096), bw_int_to_fixed(data->bytes_per_pixel[i]));
- data->scatter_gather_page_height[i] = bw_int_to_fixed(1);
- data->scatter_gather_pte_request_rows = bw_int_to_fixed(1);
- data->scatter_gather_row_height = bw_int_to_fixed(dceip->scatter_gather_lines_of_pte_prefetching_in_linear_mode);
- }
- else if (bw_equ(data->rotation_angle[i], bw_int_to_fixed(0)) || bw_equ(data->rotation_angle[i], bw_int_to_fixed(180))) {
- data->useful_pte_per_pte_request = bw_int_to_fixed(8);
- switch (data->bytes_per_pixel[i]) {
- case 4:
- data->scatter_gather_page_width[i] = bw_int_to_fixed(32);
- data->scatter_gather_page_height[i] = bw_int_to_fixed(32);
- break;
- case 2:
- data->scatter_gather_page_width[i] = bw_int_to_fixed(64);
- data->scatter_gather_page_height[i] = bw_int_to_fixed(32);
- break;
- default:
- data->scatter_gather_page_width[i] = bw_int_to_fixed(64);
- data->scatter_gather_page_height[i] = bw_int_to_fixed(64);
- break;
- }
- data->scatter_gather_pte_request_rows = bw_int_to_fixed(dceip->scatter_gather_pte_request_rows_in_tiling_mode);
- data->scatter_gather_row_height = data->scatter_gather_page_height[i];
- }
- else {
- data->useful_pte_per_pte_request = bw_int_to_fixed(1);
- switch (data->bytes_per_pixel[i]) {
- case 4:
- data->scatter_gather_page_width[i] = bw_int_to_fixed(32);
- data->scatter_gather_page_height[i] = bw_int_to_fixed(32);
- break;
- case 2:
- data->scatter_gather_page_width[i] = bw_int_to_fixed(32);
- data->scatter_gather_page_height[i] = bw_int_to_fixed(64);
- break;
- default:
- data->scatter_gather_page_width[i] = bw_int_to_fixed(64);
- data->scatter_gather_page_height[i] = bw_int_to_fixed(64);
- break;
- }
- data->scatter_gather_pte_request_rows = bw_int_to_fixed(dceip->scatter_gather_pte_request_rows_in_tiling_mode);
- data->scatter_gather_row_height = data->scatter_gather_page_height[i];
- }
- data->pte_request_per_chunk[i] = bw_div(bw_div(bw_int_to_fixed(dceip->chunk_width), data->scatter_gather_page_width[i]), data->useful_pte_per_pte_request);
- data->scatter_gather_pte_requests_in_row[i] = bw_div(bw_mul(bw_ceil2(bw_mul(bw_div(data->source_width_rounded_up_to_chunks[i], bw_int_to_fixed(dceip->chunk_width)), data->pte_request_per_chunk[i]), bw_int_to_fixed(1)), data->scatter_gather_row_height), data->scatter_gather_page_height[i]);
- data->scatter_gather_pte_requests_in_vblank = bw_mul(data->scatter_gather_pte_request_rows, data->scatter_gather_pte_requests_in_row[i]);
- if (bw_equ(data->peak_pte_request_to_eviction_ratio_limiting, bw_int_to_fixed(0))) {
- data->scatter_gather_pte_request_limit[i] = data->scatter_gather_pte_requests_in_vblank;
- }
- else {
- data->scatter_gather_pte_request_limit[i] = bw_max2(dceip->minimum_outstanding_pte_request_limit, bw_min2(data->scatter_gather_pte_requests_in_vblank, bw_ceil2(bw_mul(bw_mul(bw_div(bw_ceil2(data->adjusted_data_buffer_size[i], data->memory_chunk_size_in_bytes[i]), data->memory_chunk_size_in_bytes[i]), data->pte_request_per_chunk[i]), data->peak_pte_request_to_eviction_ratio_limiting), bw_int_to_fixed(1))));
- }
- }
- }
- /*pitch padding recommended for efficiency in linear mode*/
- /*in linear mode graphics or underlay with scatter gather, a pitch that is a multiple of the channel interleave (256 bytes) times the channel-bank rotation is not efficient*/
- /*if that is the case it is recommended to pad the pitch by at least 256 pixels*/
- data->inefficient_linear_pitch_in_bytes = bw_mul(bw_mul(bw_int_to_fixed(256), bw_int_to_fixed(vbios->number_of_dram_banks)), bw_int_to_fixed(data->number_of_dram_channels));
-
- /*pixel transfer time*/
- /*the dmif and mcifwr yclk(pclk) required is the one that allows the transfer of all pipe's data buffer size in memory in the time for data transfer*/
- /*for dmif, pte and cursor requests have to be included.*/
- /*the dram data requirement is doubled when the data request size in bytes is less than the dram channel width times the burst size (8)*/
- /*the dram data requirement is also multiplied by the number of channels in the case of low power tiling*/
- /*the page close-open time is determined by trc and the number of page close-opens*/
- /*in tiled mode graphics or underlay with scatter-gather enabled the bytes per page close-open is the product of the memory line interleave times the maximum of the scatter-gather page width and the product of the tile width (8 pixels) times the number of channels times the number of banks.*/
- /*in linear mode graphics or underlay with scatter-gather enabled and inefficient pitch, the bytes per page close-open is the line request alternation slice, because different lines are in completely different 4k address bases.*/
- /*otherwise, the bytes page close-open is the chunk size because that is the arbitration slice.*/
- /*pte requests are grouped by pte requests per chunk if that is more than 1. each group costs a page close-open time for dmif reads*/
- /*cursor requests outstanding are limited to a group of two source lines. each group costs a page close-open time for dmif reads*/
- /*the display reads and writes time for data transfer is the minimum data or cursor buffer size in time minus the mc urgent latency*/
- /*the mc urgent latency is experienced more than one time if the number of dmif requests in the data buffer exceeds the request buffer size plus the request slots reserved for dmif in the dram channel arbiter queues*/
- /*the dispclk required is the maximum for all surfaces of the maximum of the source pixels for first output pixel times the throughput factor, divided by the pixels per dispclk, and divided by the minimum latency hiding minus the dram speed/p-state change latency minus the burst time, and the source pixels for last output pixel, times the throughput factor, divided by the pixels per dispclk, and divided by the minimum latency hiding minus the dram speed/p-state change latency minus the burst time, plus the active time.*/
- /*the data burst time is the maximum of the total page close-open time, total dmif/mcifwr buffer size in memory divided by the dram bandwidth, and the total dmif/mcifwr buffer size in memory divided by the 32 byte sclk data bus bandwidth, each multiplied by its efficiency.*/
- /*the source line transfer time is the maximum for all surfaces of the maximum of the burst time plus the urgent latency times the floor of the data required divided by the buffer size for the fist pixel, and the burst time plus the urgent latency times the floor of the data required divided by the buffer size for the last pixel plus the active time.*/
- /*the source pixels for the first output pixel is 512 if the scaler vertical filter initialization value is greater than 2, and it is 4 times the source width if it is greater than 4.*/
- /*the source pixels for the last output pixel is the source width times the scaler vertical filter initialization value rounded up to even*/
- /*the source data for these pixels is the number of pixels times the bytes per pixel times the bytes per request divided by the useful bytes per request.*/
- data->cursor_total_data = bw_int_to_fixed(0);
- data->cursor_total_request_groups = bw_int_to_fixed(0);
- data->scatter_gather_total_pte_requests = bw_int_to_fixed(0);
- data->scatter_gather_total_pte_request_groups = bw_int_to_fixed(0);
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- data->cursor_total_data = bw_add(data->cursor_total_data, bw_mul(bw_mul(bw_int_to_fixed(2), data->cursor_width_pixels[i]), bw_int_to_fixed(4)));
- if (dceip->large_cursor == 1) {
- data->cursor_total_request_groups = bw_add(data->cursor_total_request_groups, bw_int_to_fixed((dceip->cursor_max_outstanding_group_num + 1)));
- }
- else {
- data->cursor_total_request_groups = bw_add(data->cursor_total_request_groups, bw_ceil2(bw_div(data->cursor_width_pixels[i], dceip->cursor_chunk_width), bw_int_to_fixed(1)));
- }
- if (data->scatter_gather_enable_for_pipe[i]) {
- data->scatter_gather_total_pte_requests = bw_add(data->scatter_gather_total_pte_requests, data->scatter_gather_pte_request_limit[i]);
- data->scatter_gather_total_pte_request_groups = bw_add(data->scatter_gather_total_pte_request_groups, bw_ceil2(bw_div(data->scatter_gather_pte_request_limit[i], bw_ceil2(data->pte_request_per_chunk[i], bw_int_to_fixed(1))), bw_int_to_fixed(1)));
- }
- }
- }
- data->tile_width_in_pixels = bw_int_to_fixed(8);
- data->dmif_total_number_of_data_request_page_close_open = bw_int_to_fixed(0);
- data->mcifwr_total_number_of_data_request_page_close_open = bw_int_to_fixed(0);
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if (data->scatter_gather_enable_for_pipe[i] == 1 && tiling_mode[i] != bw_def_linear) {
- data->bytes_per_page_close_open = bw_mul(data->lines_interleaved_in_mem_access[i], bw_max2(bw_mul(bw_mul(bw_mul(bw_int_to_fixed(data->bytes_per_pixel[i]), data->tile_width_in_pixels), bw_int_to_fixed(vbios->number_of_dram_banks)), bw_int_to_fixed(data->number_of_dram_channels)), bw_mul(bw_int_to_fixed(data->bytes_per_pixel[i]), data->scatter_gather_page_width[i])));
- }
- else if (data->scatter_gather_enable_for_pipe[i] == 1 && tiling_mode[i] == bw_def_linear && bw_equ(bw_mod((bw_mul(data->pitch_in_pixels_after_surface_type[i], bw_int_to_fixed(data->bytes_per_pixel[i]))), data->inefficient_linear_pitch_in_bytes), bw_int_to_fixed(0))) {
- data->bytes_per_page_close_open = dceip->linear_mode_line_request_alternation_slice;
- }
- else {
- data->bytes_per_page_close_open = data->memory_chunk_size_in_bytes[i];
- }
- if (surface_type[i] != bw_def_display_write_back420_luma && surface_type[i] != bw_def_display_write_back420_chroma) {
- data->dmif_total_number_of_data_request_page_close_open = bw_add(data->dmif_total_number_of_data_request_page_close_open, bw_div(bw_ceil2(data->adjusted_data_buffer_size[i], data->memory_chunk_size_in_bytes[i]), data->bytes_per_page_close_open));
- }
- else {
- data->mcifwr_total_number_of_data_request_page_close_open = bw_add(data->mcifwr_total_number_of_data_request_page_close_open, bw_div(bw_ceil2(data->adjusted_data_buffer_size[i], data->memory_chunk_size_in_bytes[i]), data->bytes_per_page_close_open));
- }
- }
- }
- data->dmif_total_page_close_open_time = bw_div(bw_mul((bw_add(bw_add(data->dmif_total_number_of_data_request_page_close_open, data->scatter_gather_total_pte_request_groups), data->cursor_total_request_groups)), vbios->trc), bw_int_to_fixed(1000));
- data->mcifwr_total_page_close_open_time = bw_div(bw_mul(data->mcifwr_total_number_of_data_request_page_close_open, vbios->trc), bw_int_to_fixed(1000));
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- data->adjusted_data_buffer_size_in_memory[i] = bw_div(bw_mul(data->adjusted_data_buffer_size[i], data->bytes_per_request[i]), data->useful_bytes_per_request[i]);
- }
- }
- data->total_requests_for_adjusted_dmif_size = bw_int_to_fixed(0);
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if (surface_type[i] != bw_def_display_write_back420_luma && surface_type[i] != bw_def_display_write_back420_chroma) {
- data->total_requests_for_adjusted_dmif_size = bw_add(data->total_requests_for_adjusted_dmif_size, bw_div(data->adjusted_data_buffer_size[i], data->useful_bytes_per_request[i]));
- }
- }
- }
- data->total_dmifmc_urgent_trips = bw_ceil2(bw_div(data->total_requests_for_adjusted_dmif_size, (bw_add(dceip->dmif_request_buffer_size, bw_int_to_fixed(vbios->number_of_request_slots_gmc_reserves_for_dmif_per_channel * data->number_of_dram_channels)))), bw_int_to_fixed(1));
- data->total_dmifmc_urgent_latency = bw_mul(vbios->dmifmc_urgent_latency, data->total_dmifmc_urgent_trips);
- data->total_display_reads_required_data = bw_int_to_fixed(0);
- data->total_display_reads_required_dram_access_data = bw_int_to_fixed(0);
- data->total_display_writes_required_data = bw_int_to_fixed(0);
- data->total_display_writes_required_dram_access_data = bw_int_to_fixed(0);
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if (surface_type[i] != bw_def_display_write_back420_luma && surface_type[i] != bw_def_display_write_back420_chroma) {
- data->display_reads_required_data = data->adjusted_data_buffer_size_in_memory[i];
- /*for hbm memories, each channel is split into 2 pseudo-channels that are each 64 bits in width. each*/
- /*pseudo-channel may be read independently of one another.*/
- /*the read burst length (bl) for hbm memories is 4, so each read command will access 32 bytes of data.*/
- /*the 64 or 32 byte sized data is stored in one pseudo-channel.*/
- /*it will take 4 memclk cycles or 8 yclk cycles to fetch 64 bytes of data from the hbm memory (2 read commands).*/
- /*it will take 2 memclk cycles or 4 yclk cycles to fetch 32 bytes of data from the hbm memory (1 read command).*/
- /*for gddr5/ddr4 memories, there is additional overhead if the size of the request is smaller than 64 bytes.*/
- /*the read burst length (bl) for gddr5/ddr4 memories is 8, regardless of the size of the data request.*/
- /*therefore it will require 8 cycles to fetch 64 or 32 bytes of data from the memory.*/
- /*the memory efficiency will be 50% for the 32 byte sized data.*/
- if (vbios->memory_type == bw_def_hbm) {
- data->display_reads_required_dram_access_data = data->adjusted_data_buffer_size_in_memory[i];
- }
- else {
- data->display_reads_required_dram_access_data = bw_mul(data->adjusted_data_buffer_size_in_memory[i], bw_ceil2(bw_div(bw_int_to_fixed((8 * vbios->dram_channel_width_in_bits / 8)), data->bytes_per_request[i]), bw_int_to_fixed(1)));
- }
- data->total_display_reads_required_data = bw_add(data->total_display_reads_required_data, data->display_reads_required_data);
- data->total_display_reads_required_dram_access_data = bw_add(data->total_display_reads_required_dram_access_data, data->display_reads_required_dram_access_data);
- }
- else {
- data->total_display_writes_required_data = bw_add(data->total_display_writes_required_data, data->adjusted_data_buffer_size_in_memory[i]);
- data->total_display_writes_required_dram_access_data = bw_add(data->total_display_writes_required_dram_access_data, bw_mul(data->adjusted_data_buffer_size_in_memory[i], bw_ceil2(bw_div(bw_int_to_fixed(vbios->dram_channel_width_in_bits), data->bytes_per_request[i]), bw_int_to_fixed(1))));
- }
- }
- }
- data->total_display_reads_required_data = bw_add(bw_add(data->total_display_reads_required_data, data->cursor_total_data), bw_mul(data->scatter_gather_total_pte_requests, bw_int_to_fixed(64)));
- data->total_display_reads_required_dram_access_data = bw_add(bw_add(data->total_display_reads_required_dram_access_data, data->cursor_total_data), bw_mul(data->scatter_gather_total_pte_requests, bw_int_to_fixed(64)));
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if (bw_mtn(data->v_filter_init[i], bw_int_to_fixed(4))) {
- data->src_pixels_for_first_output_pixel[i] = bw_mul(bw_int_to_fixed(4), data->source_width_rounded_up_to_chunks[i]);
- }
- else {
- if (bw_mtn(data->v_filter_init[i], bw_int_to_fixed(2))) {
- data->src_pixels_for_first_output_pixel[i] = bw_int_to_fixed(512);
- }
- else {
- data->src_pixels_for_first_output_pixel[i] = bw_int_to_fixed(0);
- }
- }
- data->src_data_for_first_output_pixel[i] = bw_div(bw_mul(bw_mul(data->src_pixels_for_first_output_pixel[i], bw_int_to_fixed(data->bytes_per_pixel[i])), data->bytes_per_request[i]), data->useful_bytes_per_request[i]);
- data->src_pixels_for_last_output_pixel[i] = bw_mul(data->source_width_rounded_up_to_chunks[i], bw_max2(bw_ceil2(data->v_filter_init[i], bw_int_to_fixed(dceip->lines_interleaved_into_lb)), bw_mul(bw_ceil2(data->vsr[i], bw_int_to_fixed(dceip->lines_interleaved_into_lb)), data->horizontal_blank_and_chunk_granularity_factor[i])));
- data->src_data_for_last_output_pixel[i] = bw_div(bw_mul(bw_mul(bw_mul(data->source_width_rounded_up_to_chunks[i], bw_max2(bw_ceil2(data->v_filter_init[i], bw_int_to_fixed(dceip->lines_interleaved_into_lb)), data->lines_interleaved_in_mem_access[i])), bw_int_to_fixed(data->bytes_per_pixel[i])), data->bytes_per_request[i]), data->useful_bytes_per_request[i]);
- data->active_time[i] = bw_div(bw_div(data->source_width_rounded_up_to_chunks[i], data->hsr[i]), data->pixel_rate[i]);
- }
- }
- for (i = 0; i <= 2; i++) {
- for (j = 0; j <= 7; j++) {
- data->dmif_burst_time[i][j] = bw_max3(data->dmif_total_page_close_open_time, bw_div(data->total_display_reads_required_dram_access_data, (bw_mul(bw_div(bw_mul(bw_mul(data->dram_efficiency, yclk[i]), bw_int_to_fixed(vbios->dram_channel_width_in_bits)), bw_int_to_fixed(8)), bw_int_to_fixed(data->number_of_dram_channels)))), bw_div(data->total_display_reads_required_data, (bw_mul(bw_mul(sclk[j], vbios->data_return_bus_width), bw_frc_to_fixed(dceip->percent_of_ideal_port_bw_received_after_urgent_latency, 100)))));
- if (data->d1_display_write_back_dwb_enable == 1) {
- data->mcifwr_burst_time[i][j] = bw_max3(data->mcifwr_total_page_close_open_time, bw_div(data->total_display_writes_required_dram_access_data, (bw_mul(bw_div(bw_mul(bw_mul(data->dram_efficiency, yclk[i]), bw_int_to_fixed(vbios->dram_channel_width_in_bits)), bw_int_to_fixed(8)), bw_int_to_fixed(data->number_of_dram_wrchannels)))), bw_div(data->total_display_writes_required_data, (bw_mul(sclk[j], vbios->data_return_bus_width))));
- }
- }
- }
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- for (j = 0; j <= 2; j++) {
- for (k = 0; k <= 7; k++) {
- if (data->enable[i]) {
- if (surface_type[i] != bw_def_display_write_back420_luma && surface_type[i] != bw_def_display_write_back420_chroma) {
- /*time to transfer data from the dmif buffer to the lb. since the mc to dmif transfer time overlaps*/
- /*with the dmif to lb transfer time, only time to transfer the last chunk is considered.*/
- data->dmif_buffer_transfer_time[i] = bw_mul(data->source_width_rounded_up_to_chunks[i], (bw_div(dceip->lb_write_pixels_per_dispclk, (bw_div(vbios->low_voltage_max_dispclk, dceip->display_pipe_throughput_factor)))));
- data->line_source_transfer_time[i][j][k] = bw_max2(bw_mul((bw_add(data->total_dmifmc_urgent_latency, data->dmif_burst_time[j][k])), bw_floor2(bw_div(data->src_data_for_first_output_pixel[i], data->adjusted_data_buffer_size_in_memory[i]), bw_int_to_fixed(1))), bw_sub(bw_add(bw_mul((bw_add(data->total_dmifmc_urgent_latency, data->dmif_burst_time[j][k])), bw_floor2(bw_div(data->src_data_for_last_output_pixel[i], data->adjusted_data_buffer_size_in_memory[i]), bw_int_to_fixed(1))), data->dmif_buffer_transfer_time[i]), data->active_time[i]));
- /*during an mclk switch the requests from the dce ip are stored in the gmc/arb. these requests should be serviced immediately*/
- /*after the mclk switch sequence and not incur an urgent latency penalty. it is assumed that the gmc/arb can hold up to 256 requests*/
- /*per memory channel. if the dce ip is urgent after the mclk switch sequence, all pending requests and subsequent requests should be*/
- /*immediately serviced without a gap in the urgent requests.*/
- /*the latency incurred would be the time to issue the requests and return the data for the first or last output pixel.*/
- if (surface_type[i] == bw_def_graphics) {
- switch (data->lb_bpc[i]) {
- case 6:
- data->v_scaler_efficiency = dceip->graphics_vscaler_efficiency6_bit_per_component;
- break;
- case 8:
- data->v_scaler_efficiency = dceip->graphics_vscaler_efficiency8_bit_per_component;
- break;
- case 10:
- data->v_scaler_efficiency = dceip->graphics_vscaler_efficiency10_bit_per_component;
- break;
- default:
- data->v_scaler_efficiency = dceip->graphics_vscaler_efficiency12_bit_per_component;
- break;
- }
- if (data->use_alpha[i] == 1) {
- data->v_scaler_efficiency = bw_min2(data->v_scaler_efficiency, dceip->alpha_vscaler_efficiency);
- }
- }
- else {
- switch (data->lb_bpc[i]) {
- case 6:
- data->v_scaler_efficiency = dceip->underlay_vscaler_efficiency6_bit_per_component;
- break;
- case 8:
- data->v_scaler_efficiency = dceip->underlay_vscaler_efficiency8_bit_per_component;
- break;
- case 10:
- data->v_scaler_efficiency = dceip->underlay_vscaler_efficiency10_bit_per_component;
- break;
- default:
- data->v_scaler_efficiency = bw_int_to_fixed(3);
- break;
- }
- }
- if (dceip->pre_downscaler_enabled && bw_mtn(data->hsr[i], bw_int_to_fixed(1))) {
- data->scaler_limits_factor = bw_max2(bw_div(data->v_taps[i], data->v_scaler_efficiency), bw_div(data->source_width_rounded_up_to_chunks[i], data->h_total[i]));
- }
- else {
- data->scaler_limits_factor = bw_max3(bw_int_to_fixed(1), bw_ceil2(bw_div(data->h_taps[i], bw_int_to_fixed(4)), bw_int_to_fixed(1)), bw_mul(data->hsr[i], bw_max2(bw_div(data->v_taps[i], data->v_scaler_efficiency), bw_int_to_fixed(1))));
- }
- data->dram_speed_change_line_source_transfer_time[i][j][k] = bw_mul(bw_int_to_fixed(2), bw_max2((bw_add((bw_div(data->src_data_for_first_output_pixel[i], bw_min2(bw_mul(data->bytes_per_request[i], sclk[k]), bw_div(bw_mul(bw_mul(data->bytes_per_request[i], data->pixel_rate[i]), data->scaler_limits_factor), bw_int_to_fixed(2))))), (bw_mul(data->dmif_burst_time[j][k], bw_floor2(bw_div(data->src_data_for_first_output_pixel[i], data->adjusted_data_buffer_size_in_memory[i]), bw_int_to_fixed(1)))))), (bw_add((bw_div(data->src_data_for_last_output_pixel[i], bw_min2(bw_mul(data->bytes_per_request[i], sclk[k]), bw_div(bw_mul(bw_mul(data->bytes_per_request[i], data->pixel_rate[i]), data->scaler_limits_factor), bw_int_to_fixed(2))))), (bw_sub(bw_mul(data->dmif_burst_time[j][k], bw_floor2(bw_div(data->src_data_for_last_output_pixel[i], data->adjusted_data_buffer_size_in_memory[i]), bw_int_to_fixed(1))), data->active_time[i]))))));
- }
- else {
- data->line_source_transfer_time[i][j][k] = bw_max2(bw_mul((bw_add(vbios->mcifwrmc_urgent_latency, data->mcifwr_burst_time[j][k])), bw_floor2(bw_div(data->src_data_for_first_output_pixel[i], data->adjusted_data_buffer_size_in_memory[i]), bw_int_to_fixed(1))), bw_sub(bw_mul((bw_add(vbios->mcifwrmc_urgent_latency, data->mcifwr_burst_time[j][k])), bw_floor2(bw_div(data->src_data_for_last_output_pixel[i], data->adjusted_data_buffer_size_in_memory[i]), bw_int_to_fixed(1))), data->active_time[i]));
- /*during an mclk switch the requests from the dce ip are stored in the gmc/arb. these requests should be serviced immediately*/
- /*after the mclk switch sequence and not incur an urgent latency penalty. it is assumed that the gmc/arb can hold up to 256 requests*/
- /*per memory channel. if the dce ip is urgent after the mclk switch sequence, all pending requests and subsequent requests should be*/
- /*immediately serviced without a gap in the urgent requests.*/
- /*the latency incurred would be the time to issue the requests and return the data for the first or last output pixel.*/
- data->dram_speed_change_line_source_transfer_time[i][j][k] = bw_max2((bw_add((bw_div(data->src_data_for_first_output_pixel[i], bw_min2(bw_mul(data->bytes_per_request[i], sclk[k]), bw_div(bw_mul(data->bytes_per_request[i], vbios->low_voltage_max_dispclk), bw_int_to_fixed(2))))), (bw_mul(data->mcifwr_burst_time[j][k], bw_floor2(bw_div(data->src_data_for_first_output_pixel[i], data->adjusted_data_buffer_size_in_memory[i]), bw_int_to_fixed(1)))))), (bw_add((bw_div(data->src_data_for_last_output_pixel[i], bw_min2(bw_mul(data->bytes_per_request[i], sclk[k]), bw_div(bw_mul(data->bytes_per_request[i], vbios->low_voltage_max_dispclk), bw_int_to_fixed(2))))), (bw_sub(bw_mul(data->mcifwr_burst_time[j][k], bw_floor2(bw_div(data->src_data_for_last_output_pixel[i], data->adjusted_data_buffer_size_in_memory[i]), bw_int_to_fixed(1))), data->active_time[i])))));
- }
- }
- }
- }
- }
- /*cpu c-state and p-state change enable*/
- /*for cpu p-state change to be possible for a yclk(pclk) and sclk level the dispclk required has to be enough for the blackout duration*/
- /*for cpu c-state change to be possible for a yclk(pclk) and sclk level the dispclk required has to be enough for the blackout duration and recovery*/
- /*condition for the blackout duration:*/
- /* minimum latency hiding > blackout duration + dmif burst time + line source transfer time*/
- /*condition for the blackout recovery:*/
- /* recovery time > dmif burst time + 2 * urgent latency*/
- /* recovery time > (display bw * blackout duration + (2 * urgent latency + dmif burst time)*dispclk - dmif size )*/
- /* / (dispclk - display bw)*/
- /*the minimum latency hiding is the minimum for all pipes of one screen line time, plus one more line time if doing lb prefetch, plus the dmif data buffer size equivalent in time, minus the urgent latency.*/
- /*the minimum latency hiding is further limited by the cursor. the cursor latency hiding is the number of lines of the cursor buffer, minus one if the downscaling is less than two, or minus three if it is more*/
-
- /*initialize variables*/
- number_of_displays_enabled = 0;
- number_of_displays_enabled_with_margin = 0;
- for (k = 0; k <= maximum_number_of_surfaces - 1; k++) {
- if (data->enable[k]) {
- number_of_displays_enabled = number_of_displays_enabled + 1;
- }
- data->display_pstate_change_enable[k] = 0;
- }
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if ((bw_equ(dceip->stutter_and_dram_clock_state_change_gated_before_cursor, bw_int_to_fixed(0)) && bw_mtn(data->cursor_width_pixels[i], bw_int_to_fixed(0)))) {
- if (bw_ltn(data->vsr[i], bw_int_to_fixed(2))) {
- data->cursor_latency_hiding[i] = bw_div(bw_div(bw_mul((bw_sub(dceip->cursor_dcp_buffer_lines, bw_int_to_fixed(1))), data->h_total[i]), data->vsr[i]), data->pixel_rate[i]);
- }
- else {
- data->cursor_latency_hiding[i] = bw_div(bw_div(bw_mul((bw_sub(dceip->cursor_dcp_buffer_lines, bw_int_to_fixed(3))), data->h_total[i]), data->vsr[i]), data->pixel_rate[i]);
- }
- }
- else {
- data->cursor_latency_hiding[i] = bw_int_to_fixed(9999);
- }
- }
- }
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if (dceip->graphics_lb_nodownscaling_multi_line_prefetching == 1 && (bw_equ(data->vsr[i], bw_int_to_fixed(1)) || (bw_leq(data->vsr[i], bw_frc_to_fixed(8, 10)) && bw_leq(data->v_taps[i], bw_int_to_fixed(2)) && data->lb_bpc[i] == 8)) && surface_type[i] == bw_def_graphics) {
- if (number_of_displays_enabled > 2)
- data->minimum_latency_hiding[i] = bw_sub(bw_div(bw_mul((bw_div((bw_add(bw_sub(data->lb_partitions[i], bw_int_to_fixed(2)), bw_div(bw_div(data->data_buffer_size[i], bw_int_to_fixed(data->bytes_per_pixel[i])), data->source_width_pixels[i]))), data->vsr[i])), data->h_total[i]), data->pixel_rate[i]), data->total_dmifmc_urgent_latency);
- else
- data->minimum_latency_hiding[i] = bw_sub(bw_div(bw_mul((bw_div((bw_add(bw_sub(data->lb_partitions[i], bw_int_to_fixed(1)), bw_div(bw_div(data->data_buffer_size[i], bw_int_to_fixed(data->bytes_per_pixel[i])), data->source_width_pixels[i]))), data->vsr[i])), data->h_total[i]), data->pixel_rate[i]), data->total_dmifmc_urgent_latency);
- }
- else {
- data->minimum_latency_hiding[i] = bw_sub(bw_div(bw_mul((bw_div((bw_add(bw_int_to_fixed(1 + data->line_buffer_prefetch[i]), bw_div(bw_div(data->data_buffer_size[i], bw_int_to_fixed(data->bytes_per_pixel[i])), data->source_width_pixels[i]))), data->vsr[i])), data->h_total[i]), data->pixel_rate[i]), data->total_dmifmc_urgent_latency);
- }
- data->minimum_latency_hiding_with_cursor[i] = bw_min2(data->minimum_latency_hiding[i], data->cursor_latency_hiding[i]);
- }
- }
- for (i = 0; i <= 2; i++) {
- for (j = 0; j <= 7; j++) {
- data->blackout_duration_margin[i][j] = bw_int_to_fixed(9999);
- data->dispclk_required_for_blackout_duration[i][j] = bw_int_to_fixed(0);
- data->dispclk_required_for_blackout_recovery[i][j] = bw_int_to_fixed(0);
- for (k = 0; k <= maximum_number_of_surfaces - 1; k++) {
- if (data->enable[k] && bw_mtn(vbios->blackout_duration, bw_int_to_fixed(0))) {
- if (surface_type[k] != bw_def_display_write_back420_luma && surface_type[k] != bw_def_display_write_back420_chroma) {
- data->blackout_duration_margin[i][j] = bw_min2(data->blackout_duration_margin[i][j], bw_sub(bw_sub(bw_sub(data->minimum_latency_hiding_with_cursor[k], vbios->blackout_duration), data->dmif_burst_time[i][j]), data->line_source_transfer_time[k][i][j]));
- data->dispclk_required_for_blackout_duration[i][j] = bw_max3(data->dispclk_required_for_blackout_duration[i][j], bw_div(bw_div(bw_mul(data->src_pixels_for_first_output_pixel[k], dceip->display_pipe_throughput_factor), dceip->lb_write_pixels_per_dispclk), (bw_sub(bw_sub(data->minimum_latency_hiding_with_cursor[k], vbios->blackout_duration), data->dmif_burst_time[i][j]))), bw_div(bw_div(bw_mul(data->src_pixels_for_last_output_pixel[k], dceip->display_pipe_throughput_factor), dceip->lb_write_pixels_per_dispclk), (bw_add(bw_sub(bw_sub(data->minimum_latency_hiding_with_cursor[k], vbios->blackout_duration), data->dmif_burst_time[i][j]), data->active_time[k]))));
- if (bw_leq(vbios->maximum_blackout_recovery_time, bw_add(bw_mul(bw_int_to_fixed(2), data->total_dmifmc_urgent_latency), data->dmif_burst_time[i][j]))) {
- data->dispclk_required_for_blackout_recovery[i][j] = bw_int_to_fixed(9999);
- }
- else if (bw_ltn(data->adjusted_data_buffer_size[k], bw_mul(bw_div(bw_mul(data->display_bandwidth[k], data->useful_bytes_per_request[k]), data->bytes_per_request[k]), (bw_add(vbios->blackout_duration, bw_add(bw_mul(bw_int_to_fixed(2), data->total_dmifmc_urgent_latency), data->dmif_burst_time[i][j])))))) {
- data->dispclk_required_for_blackout_recovery[i][j] = bw_max2(data->dispclk_required_for_blackout_recovery[i][j], bw_div(bw_mul(bw_div(bw_div((bw_sub(bw_mul(bw_div(bw_mul(data->display_bandwidth[k], data->useful_bytes_per_request[k]), data->bytes_per_request[k]), (bw_add(vbios->blackout_duration, vbios->maximum_blackout_recovery_time))), data->adjusted_data_buffer_size[k])), bw_int_to_fixed(data->bytes_per_pixel[k])), (bw_sub(vbios->maximum_blackout_recovery_time, bw_sub(bw_mul(bw_int_to_fixed(2), data->total_dmifmc_urgent_latency), data->dmif_burst_time[i][j])))), data->latency_hiding_lines[k]), data->lines_interleaved_in_mem_access[k]));
- }
- }
- else {
- data->blackout_duration_margin[i][j] = bw_min2(data->blackout_duration_margin[i][j], bw_sub(bw_sub(bw_sub(bw_sub(data->minimum_latency_hiding_with_cursor[k], vbios->blackout_duration), data->dmif_burst_time[i][j]), data->mcifwr_burst_time[i][j]), data->line_source_transfer_time[k][i][j]));
- data->dispclk_required_for_blackout_duration[i][j] = bw_max3(data->dispclk_required_for_blackout_duration[i][j], bw_div(bw_div(bw_mul(data->src_pixels_for_first_output_pixel[k], dceip->display_pipe_throughput_factor), dceip->lb_write_pixels_per_dispclk), (bw_sub(bw_sub(bw_sub(data->minimum_latency_hiding_with_cursor[k], vbios->blackout_duration), data->dmif_burst_time[i][j]), data->mcifwr_burst_time[i][j]))), bw_div(bw_div(bw_mul(data->src_pixels_for_last_output_pixel[k], dceip->display_pipe_throughput_factor), dceip->lb_write_pixels_per_dispclk), (bw_add(bw_sub(bw_sub(bw_sub(data->minimum_latency_hiding_with_cursor[k], vbios->blackout_duration), data->dmif_burst_time[i][j]), data->mcifwr_burst_time[i][j]), data->active_time[k]))));
- if (bw_ltn(vbios->maximum_blackout_recovery_time, bw_add(bw_add(bw_mul(bw_int_to_fixed(2), vbios->mcifwrmc_urgent_latency), data->dmif_burst_time[i][j]), data->mcifwr_burst_time[i][j]))) {
- data->dispclk_required_for_blackout_recovery[i][j] = bw_int_to_fixed(9999);
- }
- else if (bw_ltn(data->adjusted_data_buffer_size[k], bw_mul(bw_div(bw_mul(data->display_bandwidth[k], data->useful_bytes_per_request[k]), data->bytes_per_request[k]), (bw_add(vbios->blackout_duration, bw_add(bw_mul(bw_int_to_fixed(2), data->total_dmifmc_urgent_latency), data->dmif_burst_time[i][j])))))) {
- data->dispclk_required_for_blackout_recovery[i][j] = bw_max2(data->dispclk_required_for_blackout_recovery[i][j], bw_div(bw_mul(bw_div(bw_div((bw_sub(bw_mul(bw_div(bw_mul(data->display_bandwidth[k], data->useful_bytes_per_request[k]), data->bytes_per_request[k]), (bw_add(vbios->blackout_duration, vbios->maximum_blackout_recovery_time))), data->adjusted_data_buffer_size[k])), bw_int_to_fixed(data->bytes_per_pixel[k])), (bw_sub(vbios->maximum_blackout_recovery_time, (bw_add(bw_mul(bw_int_to_fixed(2), data->total_dmifmc_urgent_latency), data->dmif_burst_time[i][j]))))), data->latency_hiding_lines[k]), data->lines_interleaved_in_mem_access[k]));
- }
- }
- }
- }
- }
- }
- if (bw_mtn(data->blackout_duration_margin[high][s_high], bw_int_to_fixed(0)) && bw_ltn(data->dispclk_required_for_blackout_duration[high][s_high], vbios->high_voltage_max_dispclk)) {
- data->cpup_state_change_enable = bw_def_yes;
- if (bw_ltn(data->dispclk_required_for_blackout_recovery[high][s_high], vbios->high_voltage_max_dispclk)) {
- data->cpuc_state_change_enable = bw_def_yes;
- }
- else {
- data->cpuc_state_change_enable = bw_def_no;
- }
- }
- else {
- data->cpup_state_change_enable = bw_def_no;
- data->cpuc_state_change_enable = bw_def_no;
- }
- /*nb p-state change enable*/
- /*for dram speed/p-state change to be possible for a yclk(pclk) and sclk level there has to be positive margin and the dispclk required has to be*/
- /*below the maximum.*/
- /*the dram speed/p-state change margin is the minimum for all surfaces of the maximum latency hiding minus the dram speed/p-state change latency,*/
- /*minus the dmif burst time, minus the source line transfer time*/
- /*the maximum latency hiding is the minimum latency hiding plus one source line used for de-tiling in the line buffer, plus half the urgent latency*/
- /*if stutter and dram clock state change are gated before cursor then the cursor latency hiding does not limit stutter or dram clock state change*/
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- /*maximum_latency_hiding(i) = minimum_latency_hiding(i) + 1 / vsr(i) **/
- /* h_total(i) / pixel_rate(i) + 0.5 * total_dmifmc_urgent_latency*/
- data->maximum_latency_hiding[i] = bw_add(data->minimum_latency_hiding[i],
- bw_mul(bw_frc_to_fixed(5, 10), data->total_dmifmc_urgent_latency));
- data->maximum_latency_hiding_with_cursor[i] = bw_min2(data->maximum_latency_hiding[i], data->cursor_latency_hiding[i]);
- }
- }
- for (i = 0; i <= 2; i++) {
- for (j = 0; j <= 7; j++) {
- data->min_dram_speed_change_margin[i][j] = bw_int_to_fixed(9999);
- data->dram_speed_change_margin = bw_int_to_fixed(9999);
- data->dispclk_required_for_dram_speed_change[i][j] = bw_int_to_fixed(0);
- data->num_displays_with_margin[i][j] = 0;
- for (k = 0; k <= maximum_number_of_surfaces - 1; k++) {
- if (data->enable[k]) {
- if (surface_type[k] != bw_def_display_write_back420_luma && surface_type[k] != bw_def_display_write_back420_chroma) {
- data->dram_speed_change_margin = bw_sub(bw_sub(bw_sub(data->maximum_latency_hiding_with_cursor[k], vbios->nbp_state_change_latency), data->dmif_burst_time[i][j]), data->dram_speed_change_line_source_transfer_time[k][i][j]);
- if ((bw_mtn(data->dram_speed_change_margin, bw_int_to_fixed(0)) && bw_ltn(data->dram_speed_change_margin, bw_int_to_fixed(9999)))) {
- /*determine the minimum dram clock change margin for each set of clock frequencies*/
- data->min_dram_speed_change_margin[i][j] = bw_min2(data->min_dram_speed_change_margin[i][j], data->dram_speed_change_margin);
- /*compute the maximum clock frequuency required for the dram clock change at each set of clock frequencies*/
- data->dispclk_required_for_dram_speed_change_pipe[i][j] = bw_max2(bw_div(bw_div(bw_mul(data->src_pixels_for_first_output_pixel[k], dceip->display_pipe_throughput_factor), dceip->lb_write_pixels_per_dispclk), (bw_sub(bw_sub(bw_sub(data->maximum_latency_hiding_with_cursor[k], vbios->nbp_state_change_latency), data->dmif_burst_time[i][j]), data->dram_speed_change_line_source_transfer_time[k][i][j]))), bw_div(bw_div(bw_mul(data->src_pixels_for_last_output_pixel[k], dceip->display_pipe_throughput_factor), dceip->lb_write_pixels_per_dispclk), (bw_add(bw_sub(bw_sub(bw_sub(data->maximum_latency_hiding_with_cursor[k], vbios->nbp_state_change_latency), data->dmif_burst_time[i][j]), data->dram_speed_change_line_source_transfer_time[k][i][j]), data->active_time[k]))));
- if ((bw_ltn(data->dispclk_required_for_dram_speed_change_pipe[i][j], vbios->high_voltage_max_dispclk))) {
- data->display_pstate_change_enable[k] = 1;
- data->num_displays_with_margin[i][j] = data->num_displays_with_margin[i][j] + 1;
- data->dispclk_required_for_dram_speed_change[i][j] = bw_max2(data->dispclk_required_for_dram_speed_change[i][j], data->dispclk_required_for_dram_speed_change_pipe[i][j]);
- }
- }
- }
- else {
- data->dram_speed_change_margin = bw_sub(bw_sub(bw_sub(bw_sub(data->maximum_latency_hiding_with_cursor[k], vbios->nbp_state_change_latency), data->dmif_burst_time[i][j]), data->mcifwr_burst_time[i][j]), data->dram_speed_change_line_source_transfer_time[k][i][j]);
- if ((bw_mtn(data->dram_speed_change_margin, bw_int_to_fixed(0)) && bw_ltn(data->dram_speed_change_margin, bw_int_to_fixed(9999)))) {
- /*determine the minimum dram clock change margin for each display pipe*/
- data->min_dram_speed_change_margin[i][j] = bw_min2(data->min_dram_speed_change_margin[i][j], data->dram_speed_change_margin);
- /*compute the maximum clock frequuency required for the dram clock change at each set of clock frequencies*/
- data->dispclk_required_for_dram_speed_change_pipe[i][j] = bw_max2(bw_div(bw_div(bw_mul(data->src_pixels_for_first_output_pixel[k], dceip->display_pipe_throughput_factor), dceip->lb_write_pixels_per_dispclk), (bw_sub(bw_sub(bw_sub(bw_sub(data->maximum_latency_hiding_with_cursor[k], vbios->nbp_state_change_latency), data->dmif_burst_time[i][j]), data->dram_speed_change_line_source_transfer_time[k][i][j]), data->mcifwr_burst_time[i][j]))), bw_div(bw_div(bw_mul(data->src_pixels_for_last_output_pixel[k], dceip->display_pipe_throughput_factor), dceip->lb_write_pixels_per_dispclk), (bw_add(bw_sub(bw_sub(bw_sub(bw_sub(data->maximum_latency_hiding_with_cursor[k], vbios->nbp_state_change_latency), data->dmif_burst_time[i][j]), data->dram_speed_change_line_source_transfer_time[k][i][j]), data->mcifwr_burst_time[i][j]), data->active_time[k]))));
- if ((bw_ltn(data->dispclk_required_for_dram_speed_change_pipe[i][j], vbios->high_voltage_max_dispclk))) {
- data->display_pstate_change_enable[k] = 1;
- data->num_displays_with_margin[i][j] = data->num_displays_with_margin[i][j] + 1;
- data->dispclk_required_for_dram_speed_change[i][j] = bw_max2(data->dispclk_required_for_dram_speed_change[i][j], data->dispclk_required_for_dram_speed_change_pipe[i][j]);
- }
- }
- }
- }
- }
- }
- }
- /*determine the number of displays with margin to switch in the v_active region*/
- for (k = 0; k <= maximum_number_of_surfaces - 1; k++) {
- if (data->enable[k] == 1 && data->display_pstate_change_enable[k] == 1) {
- number_of_displays_enabled_with_margin = number_of_displays_enabled_with_margin + 1;
- }
- }
- /*determine the number of displays that don't have any dram clock change margin, but*/
- /*have the same resolution. these displays can switch in a common vblank region if*/
- /*their frames are aligned.*/
- data->min_vblank_dram_speed_change_margin = bw_int_to_fixed(9999);
- for (k = 0; k <= maximum_number_of_surfaces - 1; k++) {
- if (data->enable[k]) {
- if (surface_type[k] != bw_def_display_write_back420_luma && surface_type[k] != bw_def_display_write_back420_chroma) {
- data->v_blank_dram_speed_change_margin[k] = bw_sub(bw_sub(bw_sub(bw_div(bw_mul((bw_sub(data->v_total[k], bw_sub(bw_div(data->src_height[k], data->v_scale_ratio[k]), bw_int_to_fixed(4)))), data->h_total[k]), data->pixel_rate[k]), vbios->nbp_state_change_latency), data->dmif_burst_time[low][s_low]), data->dram_speed_change_line_source_transfer_time[k][low][s_low]);
- data->min_vblank_dram_speed_change_margin = bw_min2(data->min_vblank_dram_speed_change_margin, data->v_blank_dram_speed_change_margin[k]);
- }
- else {
- data->v_blank_dram_speed_change_margin[k] = bw_sub(bw_sub(bw_sub(bw_sub(bw_div(bw_mul((bw_sub(data->v_total[k], bw_sub(bw_div(data->src_height[k], data->v_scale_ratio[k]), bw_int_to_fixed(4)))), data->h_total[k]), data->pixel_rate[k]), vbios->nbp_state_change_latency), data->dmif_burst_time[low][s_low]), data->mcifwr_burst_time[low][s_low]), data->dram_speed_change_line_source_transfer_time[k][low][s_low]);
- data->min_vblank_dram_speed_change_margin = bw_min2(data->min_vblank_dram_speed_change_margin, data->v_blank_dram_speed_change_margin[k]);
- }
- }
- }
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- data->displays_with_same_mode[i] = bw_int_to_fixed(0);
- if (data->enable[i] == 1 && data->display_pstate_change_enable[i] == 0 && bw_mtn(data->v_blank_dram_speed_change_margin[i], bw_int_to_fixed(0))) {
- for (j = 0; j <= maximum_number_of_surfaces - 1; j++) {
- if ((i == j || data->display_synchronization_enabled) && (data->enable[j] == 1 && bw_equ(data->source_width_rounded_up_to_chunks[i], data->source_width_rounded_up_to_chunks[j]) && bw_equ(data->source_height_rounded_up_to_chunks[i], data->source_height_rounded_up_to_chunks[j]) && bw_equ(data->vsr[i], data->vsr[j]) && bw_equ(data->hsr[i], data->hsr[j]) && bw_equ(data->pixel_rate[i], data->pixel_rate[j]))) {
- data->displays_with_same_mode[i] = bw_add(data->displays_with_same_mode[i], bw_int_to_fixed(1));
- }
- }
- }
- }
- /*compute the maximum number of aligned displays with no margin*/
- number_of_aligned_displays_with_no_margin = 0;
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- number_of_aligned_displays_with_no_margin = bw_fixed_to_int(bw_max2(bw_int_to_fixed(number_of_aligned_displays_with_no_margin), data->displays_with_same_mode[i]));
- }
- /*dram clock change is possible, if all displays have positive margin except for one display or a group of*/
- /*aligned displays with the same timing.*/
- /*the display(s) with the negative margin can be switched in the v_blank region while the other*/
- /*displays are in v_blank or v_active.*/
- if (number_of_displays_enabled_with_margin > 0 && (number_of_displays_enabled_with_margin + number_of_aligned_displays_with_no_margin) == number_of_displays_enabled && bw_mtn(data->min_dram_speed_change_margin[high][s_high], bw_int_to_fixed(0)) && bw_ltn(data->min_dram_speed_change_margin[high][s_high], bw_int_to_fixed(9999)) && bw_ltn(data->dispclk_required_for_dram_speed_change[high][s_high], vbios->high_voltage_max_dispclk)) {
- data->nbp_state_change_enable = bw_def_yes;
- }
- else {
- data->nbp_state_change_enable = bw_def_no;
- }
- /*dram clock change is possible only in vblank if all displays are aligned and have no margin*/
- if (number_of_aligned_displays_with_no_margin == number_of_displays_enabled) {
- nbp_state_change_enable_blank = bw_def_yes;
- }
- else {
- nbp_state_change_enable_blank = bw_def_no;
- }
-
- /*average bandwidth*/
- /*the average bandwidth with no compression is the vertical active time is the source width times the bytes per pixel divided by the line time, multiplied by the vertical scale ratio and the ratio of bytes per request divided by the useful bytes per request.*/
- /*the average bandwidth with compression is the same, divided by the compression ratio*/
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- data->average_bandwidth_no_compression[i] = bw_div(bw_mul(bw_mul(bw_div(bw_mul(data->source_width_rounded_up_to_chunks[i], bw_int_to_fixed(data->bytes_per_pixel[i])), (bw_div(data->h_total[i], data->pixel_rate[i]))), data->vsr[i]), data->bytes_per_request[i]), data->useful_bytes_per_request[i]);
- data->average_bandwidth[i] = bw_div(data->average_bandwidth_no_compression[i], data->compression_rate[i]);
- }
- }
- data->total_average_bandwidth_no_compression = bw_int_to_fixed(0);
- data->total_average_bandwidth = bw_int_to_fixed(0);
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- data->total_average_bandwidth_no_compression = bw_add(data->total_average_bandwidth_no_compression, data->average_bandwidth_no_compression[i]);
- data->total_average_bandwidth = bw_add(data->total_average_bandwidth, data->average_bandwidth[i]);
- }
- }
-
- /*required yclk(pclk)*/
- /*yclk requirement only makes sense if the dmif and mcifwr data total page close-open time is less than the time for data transfer and the total pte requests fit in the scatter-gather saw queque size*/
- /*if that is the case, the yclk requirement is the maximum of the ones required by dmif and mcifwr, and the high/low yclk(pclk) is chosen accordingly*/
- /*high yclk(pclk) has to be selected when dram speed/p-state change is not possible.*/
- data->min_cursor_memory_interface_buffer_size_in_time = bw_int_to_fixed(9999);
- /* number of cursor lines stored in the cursor data return buffer*/
- num_cursor_lines = 0;
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if (bw_mtn(data->cursor_width_pixels[i], bw_int_to_fixed(0))) {
- /*compute number of cursor lines stored in data return buffer*/
- if (bw_leq(data->cursor_width_pixels[i], bw_int_to_fixed(64)) && dceip->large_cursor == 1) {
- num_cursor_lines = 4;
- }
- else {
- num_cursor_lines = 2;
- }
- data->min_cursor_memory_interface_buffer_size_in_time = bw_min2(data->min_cursor_memory_interface_buffer_size_in_time, bw_div(bw_mul(bw_div(bw_int_to_fixed(num_cursor_lines), data->vsr[i]), data->h_total[i]), data->pixel_rate[i]));
- }
- }
- }
- /*compute minimum time to read one chunk from the dmif buffer*/
- if (number_of_displays_enabled > 2) {
- data->chunk_request_delay = 0;
- }
- else {
- data->chunk_request_delay = bw_fixed_to_int(bw_div(bw_int_to_fixed(512), vbios->high_voltage_max_dispclk));
- }
- data->min_read_buffer_size_in_time = bw_min2(data->min_cursor_memory_interface_buffer_size_in_time, data->min_dmif_size_in_time);
- data->display_reads_time_for_data_transfer = bw_sub(bw_sub(data->min_read_buffer_size_in_time, data->total_dmifmc_urgent_latency), bw_int_to_fixed(data->chunk_request_delay));
- data->display_writes_time_for_data_transfer = bw_sub(data->min_mcifwr_size_in_time, vbios->mcifwrmc_urgent_latency);
- data->dmif_required_dram_bandwidth = bw_div(data->total_display_reads_required_dram_access_data, data->display_reads_time_for_data_transfer);
- data->mcifwr_required_dram_bandwidth = bw_div(data->total_display_writes_required_dram_access_data, data->display_writes_time_for_data_transfer);
- data->required_dmifmc_urgent_latency_for_page_close_open = bw_div((bw_sub(data->min_read_buffer_size_in_time, data->dmif_total_page_close_open_time)), data->total_dmifmc_urgent_trips);
- data->required_mcifmcwr_urgent_latency = bw_sub(data->min_mcifwr_size_in_time, data->mcifwr_total_page_close_open_time);
- if (bw_mtn(data->scatter_gather_total_pte_requests, dceip->maximum_total_outstanding_pte_requests_allowed_by_saw)) {
- data->required_dram_bandwidth_gbyte_per_second = bw_int_to_fixed(9999);
- yclk_message = bw_def_exceeded_allowed_outstanding_pte_req_queue_size;
- data->y_clk_level = high;
- data->dram_bandwidth = bw_mul(bw_div(bw_mul(bw_mul(data->dram_efficiency, yclk[high]), bw_int_to_fixed(vbios->dram_channel_width_in_bits)), bw_int_to_fixed(8)), bw_int_to_fixed(data->number_of_dram_channels));
- }
- else if (bw_mtn(vbios->dmifmc_urgent_latency, data->required_dmifmc_urgent_latency_for_page_close_open) || bw_mtn(vbios->mcifwrmc_urgent_latency, data->required_mcifmcwr_urgent_latency)) {
- data->required_dram_bandwidth_gbyte_per_second = bw_int_to_fixed(9999);
- yclk_message = bw_def_exceeded_allowed_page_close_open;
- data->y_clk_level = high;
- data->dram_bandwidth = bw_mul(bw_div(bw_mul(bw_mul(data->dram_efficiency, yclk[high]), bw_int_to_fixed(vbios->dram_channel_width_in_bits)), bw_int_to_fixed(8)), bw_int_to_fixed(data->number_of_dram_channels));
- }
- else {
- data->required_dram_bandwidth_gbyte_per_second = bw_div(bw_max2(data->dmif_required_dram_bandwidth, data->mcifwr_required_dram_bandwidth), bw_int_to_fixed(1000));
- if (bw_ltn(data->total_average_bandwidth_no_compression, bw_mul(bw_mul(bw_mul(bw_frc_to_fixed(dceip->max_average_percent_of_ideal_drambw_display_can_use_in_normal_system_operation, 100),yclk[low]),bw_div(bw_int_to_fixed(vbios->dram_channel_width_in_bits),bw_int_to_fixed(8))),bw_int_to_fixed(vbios->number_of_dram_channels)))
- && bw_ltn(bw_mul(data->required_dram_bandwidth_gbyte_per_second, bw_int_to_fixed(1000)), bw_mul(bw_div(bw_mul(bw_mul(data->dram_efficiency, yclk[low]), bw_int_to_fixed(vbios->dram_channel_width_in_bits)), bw_int_to_fixed(8)), bw_int_to_fixed(data->number_of_dram_channels))) && (data->cpup_state_change_enable == bw_def_no || (bw_mtn(data->blackout_duration_margin[low][s_high], bw_int_to_fixed(0)) && bw_ltn(data->dispclk_required_for_blackout_duration[low][s_high], vbios->high_voltage_max_dispclk))) && (data->cpuc_state_change_enable == bw_def_no || (bw_mtn(data->blackout_duration_margin[low][s_high], bw_int_to_fixed(0)) && bw_ltn(data->dispclk_required_for_blackout_duration[low][s_high], vbios->high_voltage_max_dispclk) && bw_ltn(data->dispclk_required_for_blackout_recovery[low][s_high], vbios->high_voltage_max_dispclk))) && (!data->increase_voltage_to_support_mclk_switch || data->nbp_state_change_enable == bw_def_no || (bw_mtn(data->min_dram_speed_change_margin[low][s_high], bw_int_to_fixed(0)) && bw_ltn(data->min_dram_speed_change_margin[low][s_high], bw_int_to_fixed(9999)) && bw_leq(data->dispclk_required_for_dram_speed_change[low][s_high], vbios->high_voltage_max_dispclk) && data->num_displays_with_margin[low][s_high] == number_of_displays_enabled_with_margin))) {
- yclk_message = bw_fixed_to_int(vbios->low_yclk);
- data->y_clk_level = low;
- data->dram_bandwidth = bw_mul(bw_div(bw_mul(bw_mul(data->dram_efficiency, yclk[low]), bw_int_to_fixed(vbios->dram_channel_width_in_bits)), bw_int_to_fixed(8)), bw_int_to_fixed(data->number_of_dram_channels));
- }
- else if (bw_ltn(data->total_average_bandwidth_no_compression, bw_mul(bw_mul(bw_mul(bw_frc_to_fixed(dceip->max_average_percent_of_ideal_drambw_display_can_use_in_normal_system_operation, 100),yclk[mid]),bw_div(bw_int_to_fixed(vbios->dram_channel_width_in_bits),bw_int_to_fixed(8))),bw_int_to_fixed(vbios->number_of_dram_channels)))
- && bw_ltn(bw_mul(data->required_dram_bandwidth_gbyte_per_second, bw_int_to_fixed(1000)), bw_mul(bw_div(bw_mul(bw_mul(data->dram_efficiency, yclk[mid]), bw_int_to_fixed(vbios->dram_channel_width_in_bits)), bw_int_to_fixed(8)), bw_int_to_fixed(data->number_of_dram_channels))) && (data->cpup_state_change_enable == bw_def_no || (bw_mtn(data->blackout_duration_margin[mid][s_high], bw_int_to_fixed(0)) && bw_ltn(data->dispclk_required_for_blackout_duration[mid][s_high], vbios->high_voltage_max_dispclk))) && (data->cpuc_state_change_enable == bw_def_no || (bw_mtn(data->blackout_duration_margin[mid][s_high], bw_int_to_fixed(0)) && bw_ltn(data->dispclk_required_for_blackout_duration[mid][s_high], vbios->high_voltage_max_dispclk) && bw_ltn(data->dispclk_required_for_blackout_recovery[mid][s_high], vbios->high_voltage_max_dispclk))) && (!data->increase_voltage_to_support_mclk_switch || data->nbp_state_change_enable == bw_def_no || (bw_mtn(data->min_dram_speed_change_margin[mid][s_high], bw_int_to_fixed(0)) && bw_ltn(data->min_dram_speed_change_margin[mid][s_high], bw_int_to_fixed(9999)) && bw_leq(data->dispclk_required_for_dram_speed_change[mid][s_high], vbios->high_voltage_max_dispclk) && data->num_displays_with_margin[mid][s_high] == number_of_displays_enabled_with_margin))) {
- yclk_message = bw_fixed_to_int(vbios->mid_yclk);
- data->y_clk_level = mid;
- data->dram_bandwidth = bw_mul(bw_div(bw_mul(bw_mul(data->dram_efficiency, yclk[mid]), bw_int_to_fixed(vbios->dram_channel_width_in_bits)), bw_int_to_fixed(8)), bw_int_to_fixed(data->number_of_dram_channels));
- }
- else if (bw_ltn(data->total_average_bandwidth_no_compression, bw_mul(bw_mul(bw_mul(bw_frc_to_fixed(dceip->max_average_percent_of_ideal_drambw_display_can_use_in_normal_system_operation, 100),yclk[high]),bw_div(bw_int_to_fixed(vbios->dram_channel_width_in_bits),bw_int_to_fixed(8))),bw_int_to_fixed(vbios->number_of_dram_channels)))
- && bw_ltn(bw_mul(data->required_dram_bandwidth_gbyte_per_second, bw_int_to_fixed(1000)), bw_mul(bw_div(bw_mul(bw_mul(data->dram_efficiency, yclk[high]), bw_int_to_fixed(vbios->dram_channel_width_in_bits)), bw_int_to_fixed(8)), bw_int_to_fixed(data->number_of_dram_channels)))) {
- yclk_message = bw_fixed_to_int(vbios->high_yclk);
- data->y_clk_level = high;
- data->dram_bandwidth = bw_mul(bw_div(bw_mul(bw_mul(data->dram_efficiency, yclk[high]), bw_int_to_fixed(vbios->dram_channel_width_in_bits)), bw_int_to_fixed(8)), bw_int_to_fixed(data->number_of_dram_channels));
- }
- else {
- yclk_message = bw_def_exceeded_allowed_maximum_bw;
- data->y_clk_level = high;
- data->dram_bandwidth = bw_mul(bw_div(bw_mul(bw_mul(data->dram_efficiency, yclk[high]), bw_int_to_fixed(vbios->dram_channel_width_in_bits)), bw_int_to_fixed(8)), bw_int_to_fixed(data->number_of_dram_channels));
- }
- }
- /*required sclk*/
- /*sclk requirement only makes sense if the total pte requests fit in the scatter-gather saw queque size*/
- /*if that is the case, the sclk requirement is the maximum of the ones required by dmif and mcifwr, and the high/mid/low sclk is chosen accordingly, unless that choice results in foresaking dram speed/nb p-state change.*/
- /*the dmif and mcifwr sclk required is the one that allows the transfer of all pipe's data buffer size through the sclk bus in the time for data transfer*/
- /*for dmif, pte and cursor requests have to be included.*/
- data->dmif_required_sclk = bw_div(bw_div(data->total_display_reads_required_data, data->display_reads_time_for_data_transfer), (bw_mul(vbios->data_return_bus_width, bw_frc_to_fixed(dceip->percent_of_ideal_port_bw_received_after_urgent_latency, 100))));
- data->mcifwr_required_sclk = bw_div(bw_div(data->total_display_writes_required_data, data->display_writes_time_for_data_transfer), vbios->data_return_bus_width);
- if (bw_mtn(data->scatter_gather_total_pte_requests, dceip->maximum_total_outstanding_pte_requests_allowed_by_saw)) {
- data->required_sclk = bw_int_to_fixed(9999);
- sclk_message = bw_def_exceeded_allowed_outstanding_pte_req_queue_size;
- data->sclk_level = s_high;
- }
- else if (bw_mtn(vbios->dmifmc_urgent_latency, data->required_dmifmc_urgent_latency_for_page_close_open) || bw_mtn(vbios->mcifwrmc_urgent_latency, data->required_mcifmcwr_urgent_latency)) {
- data->required_sclk = bw_int_to_fixed(9999);
- sclk_message = bw_def_exceeded_allowed_page_close_open;
- data->sclk_level = s_high;
- }
- else {
- data->required_sclk = bw_max2(data->dmif_required_sclk, data->mcifwr_required_sclk);
- if (bw_ltn(data->total_average_bandwidth_no_compression, bw_mul(bw_mul(bw_frc_to_fixed(dceip->max_average_percent_of_ideal_port_bw_display_can_use_in_normal_system_operation, 100),sclk[low]),vbios->data_return_bus_width))
- && bw_ltn(data->required_sclk, sclk[s_low]) && (data->cpup_state_change_enable == bw_def_no || (bw_mtn(data->blackout_duration_margin[data->y_clk_level][s_low], bw_int_to_fixed(0)) && bw_ltn(data->dispclk_required_for_blackout_duration[data->y_clk_level][s_low], vbios->high_voltage_max_dispclk))) && (data->cpuc_state_change_enable == bw_def_no || (bw_mtn(data->blackout_duration_margin[data->y_clk_level][s_low], bw_int_to_fixed(0)) && bw_ltn(data->dispclk_required_for_blackout_duration[data->y_clk_level][s_low], vbios->high_voltage_max_dispclk) && bw_ltn(data->dispclk_required_for_blackout_recovery[data->y_clk_level][s_low], vbios->high_voltage_max_dispclk))) && (!data->increase_voltage_to_support_mclk_switch || data->nbp_state_change_enable == bw_def_no || (bw_mtn(data->min_dram_speed_change_margin[data->y_clk_level][s_low], bw_int_to_fixed(0)) && bw_ltn(data->min_dram_speed_change_margin[data->y_clk_level][s_low], bw_int_to_fixed(9999)) && bw_leq(data->dispclk_required_for_dram_speed_change[data->y_clk_level][s_low], vbios->low_voltage_max_dispclk) && data->num_displays_with_margin[data->y_clk_level][s_low] == number_of_displays_enabled_with_margin))) {
- sclk_message = bw_def_low;
- data->sclk_level = s_low;
- data->required_sclk = vbios->low_sclk;
- }
- else if (bw_ltn(data->total_average_bandwidth_no_compression, bw_mul(bw_mul(bw_frc_to_fixed(dceip->max_average_percent_of_ideal_port_bw_display_can_use_in_normal_system_operation, 100),sclk[mid]),vbios->data_return_bus_width))
- && bw_ltn(data->required_sclk, sclk[s_mid1]) && (data->cpup_state_change_enable == bw_def_no || (bw_mtn(data->blackout_duration_margin[data->y_clk_level][s_mid1], bw_int_to_fixed(0)) && bw_ltn(data->dispclk_required_for_blackout_duration[data->y_clk_level][s_mid1], vbios->high_voltage_max_dispclk))) && (data->cpuc_state_change_enable == bw_def_no || (bw_mtn(data->blackout_duration_margin[data->y_clk_level][s_mid1], bw_int_to_fixed(0)) && bw_ltn(data->dispclk_required_for_blackout_duration[data->y_clk_level][s_mid1], vbios->high_voltage_max_dispclk) && bw_ltn(data->dispclk_required_for_blackout_recovery[data->y_clk_level][s_mid1], vbios->high_voltage_max_dispclk))) && (!data->increase_voltage_to_support_mclk_switch || data->nbp_state_change_enable == bw_def_no || (bw_mtn(data->min_dram_speed_change_margin[data->y_clk_level][s_mid1], bw_int_to_fixed(0)) && bw_ltn(data->min_dram_speed_change_margin[data->y_clk_level][s_mid1], bw_int_to_fixed(9999)) && bw_leq(data->dispclk_required_for_dram_speed_change[data->y_clk_level][s_mid1], vbios->mid_voltage_max_dispclk) && data->num_displays_with_margin[data->y_clk_level][s_mid1] == number_of_displays_enabled_with_margin))) {
- sclk_message = bw_def_mid;
- data->sclk_level = s_mid1;
- data->required_sclk = vbios->mid1_sclk;
- }
- else if (bw_ltn(data->total_average_bandwidth_no_compression, bw_mul(bw_mul(bw_frc_to_fixed(dceip->max_average_percent_of_ideal_port_bw_display_can_use_in_normal_system_operation, 100),sclk[s_mid2]),vbios->data_return_bus_width))
- && bw_ltn(data->required_sclk, sclk[s_mid2]) && (data->cpup_state_change_enable == bw_def_no || (bw_mtn(data->blackout_duration_margin[data->y_clk_level][s_mid2], bw_int_to_fixed(0)) && bw_ltn(data->dispclk_required_for_blackout_duration[data->y_clk_level][s_mid2], vbios->high_voltage_max_dispclk))) && (data->cpuc_state_change_enable == bw_def_no || (bw_mtn(data->blackout_duration_margin[data->y_clk_level][s_mid2], bw_int_to_fixed(0)) && bw_ltn(data->dispclk_required_for_blackout_duration[data->y_clk_level][s_mid2], vbios->high_voltage_max_dispclk) && bw_ltn(data->dispclk_required_for_blackout_recovery[data->y_clk_level][s_mid2], vbios->high_voltage_max_dispclk))) && (!data->increase_voltage_to_support_mclk_switch || data->nbp_state_change_enable == bw_def_no || (bw_mtn(data->min_dram_speed_change_margin[data->y_clk_level][s_mid2], bw_int_to_fixed(0)) && bw_ltn(data->min_dram_speed_change_margin[data->y_clk_level][s_mid2], bw_int_to_fixed(9999)) && bw_leq(data->dispclk_required_for_dram_speed_change[data->y_clk_level][s_mid2], vbios->mid_voltage_max_dispclk) && data->num_displays_with_margin[data->y_clk_level][s_mid2] == number_of_displays_enabled_with_margin))) {
- sclk_message = bw_def_mid;
- data->sclk_level = s_mid2;
- data->required_sclk = vbios->mid2_sclk;
- }
- else if (bw_ltn(data->total_average_bandwidth_no_compression, bw_mul(bw_mul(bw_frc_to_fixed(dceip->max_average_percent_of_ideal_port_bw_display_can_use_in_normal_system_operation, 100),sclk[s_mid3]),vbios->data_return_bus_width))
- && bw_ltn(data->required_sclk, sclk[s_mid3]) && (data->cpup_state_change_enable == bw_def_no || (bw_mtn(data->blackout_duration_margin[data->y_clk_level][s_mid3], bw_int_to_fixed(0)) && bw_ltn(data->dispclk_required_for_blackout_duration[data->y_clk_level][s_mid3], vbios->high_voltage_max_dispclk))) && (data->cpuc_state_change_enable == bw_def_no || (bw_mtn(data->blackout_duration_margin[data->y_clk_level][s_mid3], bw_int_to_fixed(0)) && bw_ltn(data->dispclk_required_for_blackout_duration[data->y_clk_level][s_mid3], vbios->high_voltage_max_dispclk) && bw_ltn(data->dispclk_required_for_blackout_recovery[data->y_clk_level][s_mid3], vbios->high_voltage_max_dispclk))) && (!data->increase_voltage_to_support_mclk_switch || data->nbp_state_change_enable == bw_def_no || (bw_mtn(data->min_dram_speed_change_margin[data->y_clk_level][s_mid3], bw_int_to_fixed(0)) && bw_ltn(data->min_dram_speed_change_margin[data->y_clk_level][s_mid3], bw_int_to_fixed(9999)) && bw_leq(data->dispclk_required_for_dram_speed_change[data->y_clk_level][s_mid3], vbios->mid_voltage_max_dispclk) && data->num_displays_with_margin[data->y_clk_level][s_mid3] == number_of_displays_enabled_with_margin))) {
- sclk_message = bw_def_mid;
- data->sclk_level = s_mid3;
- data->required_sclk = vbios->mid3_sclk;
- }
- else if (bw_ltn(data->total_average_bandwidth_no_compression, bw_mul(bw_mul(bw_frc_to_fixed(dceip->max_average_percent_of_ideal_port_bw_display_can_use_in_normal_system_operation, 100),sclk[s_mid4]),vbios->data_return_bus_width))
- && bw_ltn(data->required_sclk, sclk[s_mid4]) && (data->cpup_state_change_enable == bw_def_no || (bw_mtn(data->blackout_duration_margin[data->y_clk_level][s_mid4], bw_int_to_fixed(0)) && bw_ltn(data->dispclk_required_for_blackout_duration[data->y_clk_level][s_mid4], vbios->high_voltage_max_dispclk))) && (data->cpuc_state_change_enable == bw_def_no || (bw_mtn(data->blackout_duration_margin[data->y_clk_level][s_mid4], bw_int_to_fixed(0)) && bw_ltn(data->dispclk_required_for_blackout_duration[data->y_clk_level][s_mid4], vbios->high_voltage_max_dispclk) && bw_ltn(data->dispclk_required_for_blackout_recovery[data->y_clk_level][s_mid4], vbios->high_voltage_max_dispclk))) && (!data->increase_voltage_to_support_mclk_switch || data->nbp_state_change_enable == bw_def_no || (bw_mtn(data->min_dram_speed_change_margin[data->y_clk_level][s_mid4], bw_int_to_fixed(0)) && bw_ltn(data->min_dram_speed_change_margin[data->y_clk_level][s_mid4], bw_int_to_fixed(9999)) && bw_leq(data->dispclk_required_for_dram_speed_change[data->y_clk_level][s_mid4], vbios->mid_voltage_max_dispclk) && data->num_displays_with_margin[data->y_clk_level][s_mid4] == number_of_displays_enabled_with_margin))) {
- sclk_message = bw_def_mid;
- data->sclk_level = s_mid4;
- data->required_sclk = vbios->mid4_sclk;
- }
- else if (bw_ltn(data->total_average_bandwidth_no_compression, bw_mul(bw_mul(bw_frc_to_fixed(dceip->max_average_percent_of_ideal_port_bw_display_can_use_in_normal_system_operation, 100),sclk[s_mid5]),vbios->data_return_bus_width))
- && bw_ltn(data->required_sclk, sclk[s_mid5]) && (data->cpup_state_change_enable == bw_def_no || (bw_mtn(data->blackout_duration_margin[data->y_clk_level][s_mid5], bw_int_to_fixed(0)) && bw_ltn(data->dispclk_required_for_blackout_duration[data->y_clk_level][s_mid5], vbios->high_voltage_max_dispclk))) && (data->cpuc_state_change_enable == bw_def_no || (bw_mtn(data->blackout_duration_margin[data->y_clk_level][s_mid5], bw_int_to_fixed(0)) && bw_ltn(data->dispclk_required_for_blackout_duration[data->y_clk_level][s_mid5], vbios->high_voltage_max_dispclk) && bw_ltn(data->dispclk_required_for_blackout_recovery[data->y_clk_level][s_mid5], vbios->high_voltage_max_dispclk))) && (!data->increase_voltage_to_support_mclk_switch || data->nbp_state_change_enable == bw_def_no || (bw_mtn(data->min_dram_speed_change_margin[data->y_clk_level][s_mid5], bw_int_to_fixed(0)) && bw_ltn(data->min_dram_speed_change_margin[data->y_clk_level][s_mid5], bw_int_to_fixed(9999)) && bw_leq(data->dispclk_required_for_dram_speed_change[data->y_clk_level][s_mid5], vbios->mid_voltage_max_dispclk) && data->num_displays_with_margin[data->y_clk_level][s_mid5] == number_of_displays_enabled_with_margin))) {
- sclk_message = bw_def_mid;
- data->sclk_level = s_mid5;
- data->required_sclk = vbios->mid5_sclk;
- }
- else if (bw_ltn(data->total_average_bandwidth_no_compression, bw_mul(bw_mul(bw_frc_to_fixed(dceip->max_average_percent_of_ideal_port_bw_display_can_use_in_normal_system_operation, 100),sclk[s_mid6]),vbios->data_return_bus_width))
- && bw_ltn(data->required_sclk, sclk[s_mid6]) && (data->cpup_state_change_enable == bw_def_no || (bw_mtn(data->blackout_duration_margin[data->y_clk_level][s_mid6], bw_int_to_fixed(0)) && bw_ltn(data->dispclk_required_for_blackout_duration[data->y_clk_level][s_mid6], vbios->high_voltage_max_dispclk))) && (data->cpuc_state_change_enable == bw_def_no || (bw_mtn(data->blackout_duration_margin[data->y_clk_level][s_mid6], bw_int_to_fixed(0)) && bw_ltn(data->dispclk_required_for_blackout_duration[data->y_clk_level][s_mid6], vbios->high_voltage_max_dispclk) && bw_ltn(data->dispclk_required_for_blackout_recovery[data->y_clk_level][s_mid6], vbios->high_voltage_max_dispclk))) && (!data->increase_voltage_to_support_mclk_switch || data->nbp_state_change_enable == bw_def_no || (bw_mtn(data->min_dram_speed_change_margin[data->y_clk_level][s_mid6], bw_int_to_fixed(0)) && bw_ltn(data->min_dram_speed_change_margin[data->y_clk_level][s_mid6], bw_int_to_fixed(9999)) && bw_leq(data->dispclk_required_for_dram_speed_change[data->y_clk_level][s_mid6], vbios->high_voltage_max_dispclk) && data->num_displays_with_margin[data->y_clk_level][s_mid6] == number_of_displays_enabled_with_margin))) {
- sclk_message = bw_def_mid;
- data->sclk_level = s_mid6;
- data->required_sclk = vbios->mid6_sclk;
- }
- else if (bw_ltn(data->total_average_bandwidth_no_compression, bw_mul(bw_mul(bw_frc_to_fixed(dceip->max_average_percent_of_ideal_port_bw_display_can_use_in_normal_system_operation, 100),sclk[s_high]),vbios->data_return_bus_width))
- && bw_ltn(data->required_sclk, sclk[s_high])) {
- sclk_message = bw_def_high;
- data->sclk_level = s_high;
- data->required_sclk = vbios->high_sclk;
- }
- else if (bw_meq(data->total_average_bandwidth_no_compression, bw_mul(bw_mul(bw_frc_to_fixed(dceip->max_average_percent_of_ideal_port_bw_display_can_use_in_normal_system_operation, 100),sclk[s_high]),vbios->data_return_bus_width))
- && bw_ltn(data->required_sclk, sclk[s_high])) {
- sclk_message = bw_def_high;
- data->sclk_level = s_high;
- data->required_sclk = vbios->high_sclk;
- }
- else {
- sclk_message = bw_def_exceeded_allowed_maximum_sclk;
- data->sclk_level = s_high;
- /*required_sclk = high_sclk*/
- }
- }
- /*dispclk*/
- /*if dispclk is set to the maximum, ramping is not required. dispclk required without ramping is less than the dispclk required with ramping.*/
- /*if dispclk required without ramping is more than the maximum dispclk, that is the dispclk required, and the mode is not supported*/
- /*if that does not happen, but dispclk required with ramping is more than the maximum dispclk, dispclk required is just the maximum dispclk*/
- /*if that does not happen either, dispclk required is the dispclk required with ramping.*/
- /*dispclk required without ramping is the maximum of the one required for display pipe pixel throughput, for scaler throughput, for total read request thrrougput and for dram/np p-state change if enabled.*/
- /*the display pipe pixel throughput is the maximum of lines in per line out in the beginning of the frame and lines in per line out in the middle of the frame multiplied by the horizontal blank and chunk granularity factor, altogether multiplied by the ratio of the source width to the line time, divided by the line buffer pixels per dispclk throughput, and multiplied by the display pipe throughput factor.*/
- /*the horizontal blank and chunk granularity factor is the ratio of the line time divided by the line time minus half the horizontal blank and chunk time. it applies when the lines in per line out is not 2 or 4.*/
- /*the dispclk required for scaler throughput is the product of the pixel rate and the scaling limits factor.*/
- /*the dispclk required for total read request throughput is the product of the peak request-per-second bandwidth and the dispclk cycles per request, divided by the request efficiency.*/
- /*for the dispclk required with ramping, instead of multiplying just the pipe throughput by the display pipe throughput factor, we multiply the scaler and pipe throughput by the ramping factor.*/
- /*the scaling limits factor is the product of the horizontal scale ratio, and the ratio of the vertical taps divided by the scaler efficiency clamped to at least 1.*/
- /*the scaling limits factor itself it also clamped to at least 1*/
- /*if doing downscaling with the pre-downscaler enabled, the horizontal scale ratio should not be considered above (use "1")*/
- data->downspread_factor = bw_add(bw_int_to_fixed(1), bw_div(vbios->down_spread_percentage, bw_int_to_fixed(100)));
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if (surface_type[i] == bw_def_graphics) {
- switch (data->lb_bpc[i]) {
- case 6:
- data->v_scaler_efficiency = dceip->graphics_vscaler_efficiency6_bit_per_component;
- break;
- case 8:
- data->v_scaler_efficiency = dceip->graphics_vscaler_efficiency8_bit_per_component;
- break;
- case 10:
- data->v_scaler_efficiency = dceip->graphics_vscaler_efficiency10_bit_per_component;
- break;
- default:
- data->v_scaler_efficiency = dceip->graphics_vscaler_efficiency12_bit_per_component;
- break;
- }
- if (data->use_alpha[i] == 1) {
- data->v_scaler_efficiency = bw_min2(data->v_scaler_efficiency, dceip->alpha_vscaler_efficiency);
- }
- }
- else {
- switch (data->lb_bpc[i]) {
- case 6:
- data->v_scaler_efficiency = dceip->underlay_vscaler_efficiency6_bit_per_component;
- break;
- case 8:
- data->v_scaler_efficiency = dceip->underlay_vscaler_efficiency8_bit_per_component;
- break;
- case 10:
- data->v_scaler_efficiency = dceip->underlay_vscaler_efficiency10_bit_per_component;
- break;
- default:
- data->v_scaler_efficiency = dceip->underlay_vscaler_efficiency12_bit_per_component;
- break;
- }
- }
- if (dceip->pre_downscaler_enabled && bw_mtn(data->hsr[i], bw_int_to_fixed(1))) {
- data->scaler_limits_factor = bw_max2(bw_div(data->v_taps[i], data->v_scaler_efficiency), bw_div(data->source_width_rounded_up_to_chunks[i], data->h_total[i]));
- }
- else {
- data->scaler_limits_factor = bw_max3(bw_int_to_fixed(1), bw_ceil2(bw_div(data->h_taps[i], bw_int_to_fixed(4)), bw_int_to_fixed(1)), bw_mul(data->hsr[i], bw_max2(bw_div(data->v_taps[i], data->v_scaler_efficiency), bw_int_to_fixed(1))));
- }
- data->display_pipe_pixel_throughput = bw_div(bw_div(bw_mul(bw_max2(data->lb_lines_in_per_line_out_in_beginning_of_frame[i], bw_mul(data->lb_lines_in_per_line_out_in_middle_of_frame[i], data->horizontal_blank_and_chunk_granularity_factor[i])), data->source_width_rounded_up_to_chunks[i]), (bw_div(data->h_total[i], data->pixel_rate[i]))), dceip->lb_write_pixels_per_dispclk);
- data->dispclk_required_without_ramping[i] = bw_mul(data->downspread_factor, bw_max2(bw_mul(data->pixel_rate[i], data->scaler_limits_factor), bw_mul(dceip->display_pipe_throughput_factor, data->display_pipe_pixel_throughput)));
- data->dispclk_required_with_ramping[i] = bw_mul(dceip->dispclk_ramping_factor, bw_max2(bw_mul(data->pixel_rate[i], data->scaler_limits_factor), data->display_pipe_pixel_throughput));
- }
- }
- data->total_dispclk_required_with_ramping = bw_int_to_fixed(0);
- data->total_dispclk_required_without_ramping = bw_int_to_fixed(0);
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if (bw_ltn(data->total_dispclk_required_with_ramping, data->dispclk_required_with_ramping[i])) {
- data->total_dispclk_required_with_ramping = data->dispclk_required_with_ramping[i];
- }
- if (bw_ltn(data->total_dispclk_required_without_ramping, data->dispclk_required_without_ramping[i])) {
- data->total_dispclk_required_without_ramping = data->dispclk_required_without_ramping[i];
- }
- }
- }
- data->total_read_request_bandwidth = bw_int_to_fixed(0);
- data->total_write_request_bandwidth = bw_int_to_fixed(0);
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if (surface_type[i] != bw_def_display_write_back420_luma && surface_type[i] != bw_def_display_write_back420_chroma) {
- data->total_read_request_bandwidth = bw_add(data->total_read_request_bandwidth, data->request_bandwidth[i]);
- }
- else {
- data->total_write_request_bandwidth = bw_add(data->total_write_request_bandwidth, data->request_bandwidth[i]);
- }
- }
- }
- data->dispclk_required_for_total_read_request_bandwidth = bw_div(bw_mul(data->total_read_request_bandwidth, dceip->dispclk_per_request), dceip->request_efficiency);
- data->total_dispclk_required_with_ramping_with_request_bandwidth = bw_max2(data->total_dispclk_required_with_ramping, data->dispclk_required_for_total_read_request_bandwidth);
- data->total_dispclk_required_without_ramping_with_request_bandwidth = bw_max2(data->total_dispclk_required_without_ramping, data->dispclk_required_for_total_read_request_bandwidth);
- if (data->cpuc_state_change_enable == bw_def_yes) {
- data->total_dispclk_required_with_ramping_with_request_bandwidth = bw_max3(data->total_dispclk_required_with_ramping_with_request_bandwidth, data->dispclk_required_for_blackout_duration[data->y_clk_level][data->sclk_level], data->dispclk_required_for_blackout_recovery[data->y_clk_level][data->sclk_level]);
- data->total_dispclk_required_without_ramping_with_request_bandwidth = bw_max3(data->total_dispclk_required_without_ramping_with_request_bandwidth, data->dispclk_required_for_blackout_duration[data->y_clk_level][data->sclk_level], data->dispclk_required_for_blackout_recovery[data->y_clk_level][data->sclk_level]);
- }
- if (data->cpup_state_change_enable == bw_def_yes) {
- data->total_dispclk_required_with_ramping_with_request_bandwidth = bw_max2(data->total_dispclk_required_with_ramping_with_request_bandwidth, data->dispclk_required_for_blackout_duration[data->y_clk_level][data->sclk_level]);
- data->total_dispclk_required_without_ramping_with_request_bandwidth = bw_max2(data->total_dispclk_required_without_ramping_with_request_bandwidth, data->dispclk_required_for_blackout_duration[data->y_clk_level][data->sclk_level]);
- }
- if (data->nbp_state_change_enable == bw_def_yes && data->increase_voltage_to_support_mclk_switch) {
- data->total_dispclk_required_with_ramping_with_request_bandwidth = bw_max2(data->total_dispclk_required_with_ramping_with_request_bandwidth, data->dispclk_required_for_dram_speed_change[data->y_clk_level][data->sclk_level]);
- data->total_dispclk_required_without_ramping_with_request_bandwidth = bw_max2(data->total_dispclk_required_without_ramping_with_request_bandwidth, data->dispclk_required_for_dram_speed_change[data->y_clk_level][data->sclk_level]);
- }
- if (bw_ltn(data->total_dispclk_required_with_ramping_with_request_bandwidth, vbios->high_voltage_max_dispclk)) {
- data->dispclk = data->total_dispclk_required_with_ramping_with_request_bandwidth;
- }
- else if (bw_ltn(data->total_dispclk_required_without_ramping_with_request_bandwidth, vbios->high_voltage_max_dispclk)) {
- data->dispclk = vbios->high_voltage_max_dispclk;
- }
- else {
- data->dispclk = data->total_dispclk_required_without_ramping_with_request_bandwidth;
- }
- /* required core voltage*/
- /* the core voltage required is low if sclk, yclk(pclk)and dispclk are within the low limits*/
- /* otherwise, the core voltage required is medium if yclk (pclk) is within the low limit and sclk and dispclk are within the medium limit*/
- /* otherwise, the core voltage required is high if the three clocks are within the high limits*/
- /* otherwise, or if the mode is not supported, core voltage requirement is not applicable*/
- if (pipe_check == bw_def_notok) {
- voltage = bw_def_na;
- }
- else if (mode_check == bw_def_notok) {
- voltage = bw_def_notok;
- }
- else if (bw_equ(bw_int_to_fixed(yclk_message), vbios->low_yclk) && sclk_message == bw_def_low && bw_ltn(data->dispclk, vbios->low_voltage_max_dispclk)) {
- voltage = bw_def_0_72;
- }
- else if ((bw_equ(bw_int_to_fixed(yclk_message), vbios->low_yclk) || bw_equ(bw_int_to_fixed(yclk_message), vbios->mid_yclk)) && (sclk_message == bw_def_low || sclk_message == bw_def_mid) && bw_ltn(data->dispclk, vbios->mid_voltage_max_dispclk)) {
- voltage = bw_def_0_8;
- }
- else if ((bw_equ(bw_int_to_fixed(yclk_message), vbios->low_yclk) || bw_equ(bw_int_to_fixed(yclk_message), vbios->mid_yclk) || bw_equ(bw_int_to_fixed(yclk_message), vbios->high_yclk)) && (sclk_message == bw_def_low || sclk_message == bw_def_mid || sclk_message == bw_def_high) && bw_leq(data->dispclk, vbios->high_voltage_max_dispclk)) {
- if ((data->nbp_state_change_enable == bw_def_no && nbp_state_change_enable_blank == bw_def_no)) {
- voltage = bw_def_high_no_nbp_state_change;
- }
- else {
- voltage = bw_def_0_9;
- }
- }
- else {
- voltage = bw_def_notok;
- }
- if (voltage == bw_def_0_72) {
- data->max_phyclk = vbios->low_voltage_max_phyclk;
- }
- else if (voltage == bw_def_0_8) {
- data->max_phyclk = vbios->mid_voltage_max_phyclk;
- }
- else {
- data->max_phyclk = vbios->high_voltage_max_phyclk;
- }
- /*required blackout recovery time*/
- data->blackout_recovery_time = bw_int_to_fixed(0);
- for (k = 0; k <= maximum_number_of_surfaces - 1; k++) {
- if (data->enable[k] && bw_mtn(vbios->blackout_duration, bw_int_to_fixed(0)) && data->cpup_state_change_enable == bw_def_yes) {
- if (surface_type[k] != bw_def_display_write_back420_luma && surface_type[k] != bw_def_display_write_back420_chroma) {
- data->blackout_recovery_time = bw_max2(data->blackout_recovery_time, bw_add(bw_mul(bw_int_to_fixed(2), data->total_dmifmc_urgent_latency), data->dmif_burst_time[data->y_clk_level][data->sclk_level]));
- if (bw_ltn(data->adjusted_data_buffer_size[k], bw_mul(bw_div(bw_mul(data->display_bandwidth[k], data->useful_bytes_per_request[k]), data->bytes_per_request[k]), (bw_add(vbios->blackout_duration, bw_add(bw_mul(bw_int_to_fixed(2), data->total_dmifmc_urgent_latency), data->dmif_burst_time[data->y_clk_level][data->sclk_level])))))) {
- data->blackout_recovery_time = bw_max2(data->blackout_recovery_time, bw_div((bw_add(bw_mul(bw_div(bw_mul(data->display_bandwidth[k], data->useful_bytes_per_request[k]), data->bytes_per_request[k]), vbios->blackout_duration), bw_sub(bw_div(bw_mul(bw_mul(bw_mul((bw_add(bw_mul(bw_int_to_fixed(2), data->total_dmifmc_urgent_latency), data->dmif_burst_time[data->y_clk_level][data->sclk_level])), data->dispclk), bw_int_to_fixed(data->bytes_per_pixel[k])), data->lines_interleaved_in_mem_access[k]), data->latency_hiding_lines[k]), data->adjusted_data_buffer_size[k]))), (bw_sub(bw_div(bw_mul(bw_mul(data->dispclk, bw_int_to_fixed(data->bytes_per_pixel[k])), data->lines_interleaved_in_mem_access[k]), data->latency_hiding_lines[k]), bw_div(bw_mul(data->display_bandwidth[k], data->useful_bytes_per_request[k]), data->bytes_per_request[k])))));
- }
- }
- else {
- data->blackout_recovery_time = bw_max2(data->blackout_recovery_time, bw_add(bw_mul(bw_int_to_fixed(2), vbios->mcifwrmc_urgent_latency), data->mcifwr_burst_time[data->y_clk_level][data->sclk_level]));
- if (bw_ltn(data->adjusted_data_buffer_size[k], bw_mul(bw_div(bw_mul(data->display_bandwidth[k], data->useful_bytes_per_request[k]), data->bytes_per_request[k]), (bw_add(vbios->blackout_duration, bw_add(bw_mul(bw_int_to_fixed(2), vbios->mcifwrmc_urgent_latency), data->mcifwr_burst_time[data->y_clk_level][data->sclk_level])))))) {
- data->blackout_recovery_time = bw_max2(data->blackout_recovery_time, bw_div((bw_add(bw_mul(bw_div(bw_mul(data->display_bandwidth[k], data->useful_bytes_per_request[k]), data->bytes_per_request[k]), vbios->blackout_duration), bw_sub(bw_div(bw_mul(bw_mul(bw_mul((bw_add(bw_add(bw_mul(bw_int_to_fixed(2), vbios->mcifwrmc_urgent_latency), data->dmif_burst_time[data->y_clk_level][data->sclk_level]), data->mcifwr_burst_time[data->y_clk_level][data->sclk_level])), data->dispclk), bw_int_to_fixed(data->bytes_per_pixel[k])), data->lines_interleaved_in_mem_access[k]), data->latency_hiding_lines[k]), data->adjusted_data_buffer_size[k]))), (bw_sub(bw_div(bw_mul(bw_mul(data->dispclk, bw_int_to_fixed(data->bytes_per_pixel[k])), data->lines_interleaved_in_mem_access[k]), data->latency_hiding_lines[k]), bw_div(bw_mul(data->display_bandwidth[k], data->useful_bytes_per_request[k]), data->bytes_per_request[k])))));
- }
- }
- }
- }
- /*sclk deep sleep*/
- /*during self-refresh, sclk can be reduced to dispclk divided by the minimum pixels in the data fifo entry, with 15% margin, but shoudl not be set to less than the request bandwidth.*/
- /*the data fifo entry is 16 pixels for the writeback, 64 bytes/bytes_per_pixel for the graphics, 16 pixels for the parallel rotation underlay,*/
- /*and 16 bytes/bytes_per_pixel for the orthogonal rotation underlay.*/
- /*in parallel mode (underlay pipe), the data read from the dmifv buffer is variable and based on the pixel depth (8bbp - 16 bytes, 16 bpp - 32 bytes, 32 bpp - 64 bytes)*/
- /*in orthogonal mode (underlay pipe), the data read from the dmifv buffer is fixed at 16 bytes.*/
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if (surface_type[i] == bw_def_display_write_back420_luma || surface_type[i] == bw_def_display_write_back420_chroma) {
- data->pixels_per_data_fifo_entry[i] = bw_int_to_fixed(16);
- }
- else if (surface_type[i] == bw_def_graphics) {
- data->pixels_per_data_fifo_entry[i] = bw_div(bw_int_to_fixed(64), bw_int_to_fixed(data->bytes_per_pixel[i]));
- }
- else if (data->orthogonal_rotation[i] == 0) {
- data->pixels_per_data_fifo_entry[i] = bw_int_to_fixed(16);
- }
- else {
- data->pixels_per_data_fifo_entry[i] = bw_div(bw_int_to_fixed(16), bw_int_to_fixed(data->bytes_per_pixel[i]));
- }
- }
- }
- data->min_pixels_per_data_fifo_entry = bw_int_to_fixed(9999);
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if (bw_mtn(data->min_pixels_per_data_fifo_entry, data->pixels_per_data_fifo_entry[i])) {
- data->min_pixels_per_data_fifo_entry = data->pixels_per_data_fifo_entry[i];
- }
- }
- }
- data->sclk_deep_sleep = bw_max2(bw_div(bw_mul(data->dispclk, bw_frc_to_fixed(115, 100)), data->min_pixels_per_data_fifo_entry), data->total_read_request_bandwidth);
- /*urgent, stutter and nb-p_state watermark*/
- /*the urgent watermark is the maximum of the urgent trip time plus the pixel transfer time, the urgent trip times to get data for the first pixel, and the urgent trip times to get data for the last pixel.*/
- /*the stutter exit watermark is the self refresh exit time plus the maximum of the data burst time plus the pixel transfer time, the data burst times to get data for the first pixel, and the data burst times to get data for the last pixel. it does not apply to the writeback.*/
- /*the nb p-state change watermark is the dram speed/p-state change time plus the maximum of the data burst time plus the pixel transfer time, the data burst times to get data for the first pixel, and the data burst times to get data for the last pixel.*/
- /*the pixel transfer time is the maximum of the time to transfer the source pixels required for the first output pixel, and the time to transfer the pixels for the last output pixel minus the active line time.*/
- /*blackout_duration is added to the urgent watermark*/
- data->chunk_request_time = bw_int_to_fixed(0);
- data->cursor_request_time = bw_int_to_fixed(0);
- /*compute total time to request one chunk from each active display pipe*/
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- data->chunk_request_time = bw_add(data->chunk_request_time, (bw_div((bw_div(bw_int_to_fixed(pixels_per_chunk * data->bytes_per_pixel[i]), data->useful_bytes_per_request[i])), bw_min2(sclk[data->sclk_level], bw_div(data->dispclk, bw_int_to_fixed(2))))));
- }
- }
- /*compute total time to request cursor data*/
- data->cursor_request_time = (bw_div(data->cursor_total_data, (bw_mul(bw_int_to_fixed(32), sclk[data->sclk_level]))));
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- data->line_source_pixels_transfer_time = bw_max2(bw_div(bw_div(data->src_pixels_for_first_output_pixel[i], dceip->lb_write_pixels_per_dispclk), (bw_div(data->dispclk, dceip->display_pipe_throughput_factor))), bw_sub(bw_div(bw_div(data->src_pixels_for_last_output_pixel[i], dceip->lb_write_pixels_per_dispclk), (bw_div(data->dispclk, dceip->display_pipe_throughput_factor))), data->active_time[i]));
- if (surface_type[i] != bw_def_display_write_back420_luma && surface_type[i] != bw_def_display_write_back420_chroma) {
- data->urgent_watermark[i] = bw_add(bw_add(bw_add(bw_add(bw_add(data->total_dmifmc_urgent_latency, data->dmif_burst_time[data->y_clk_level][data->sclk_level]), bw_max2(data->line_source_pixels_transfer_time, data->line_source_transfer_time[i][data->y_clk_level][data->sclk_level])), vbios->blackout_duration), data->chunk_request_time), data->cursor_request_time);
- data->stutter_exit_watermark[i] = bw_add(bw_sub(vbios->stutter_self_refresh_exit_latency, data->total_dmifmc_urgent_latency), data->urgent_watermark[i]);
- data->stutter_entry_watermark[i] = bw_add(bw_sub(bw_add(vbios->stutter_self_refresh_exit_latency, vbios->stutter_self_refresh_entry_latency), data->total_dmifmc_urgent_latency), data->urgent_watermark[i]);
- /*unconditionally remove black out time from the nb p_state watermark*/
- if (data->display_pstate_change_enable[i] == 1) {
- data->nbp_state_change_watermark[i] = bw_add(bw_add(vbios->nbp_state_change_latency, data->dmif_burst_time[data->y_clk_level][data->sclk_level]), bw_max2(data->line_source_pixels_transfer_time, data->dram_speed_change_line_source_transfer_time[i][data->y_clk_level][data->sclk_level]));
- }
- else {
- /*maximize the watermark to force the switch in the vb_lank region of the frame*/
- data->nbp_state_change_watermark[i] = bw_int_to_fixed(131000);
- }
- }
- else {
- data->urgent_watermark[i] = bw_add(bw_add(bw_add(bw_add(bw_add(vbios->mcifwrmc_urgent_latency, data->mcifwr_burst_time[data->y_clk_level][data->sclk_level]), bw_max2(data->line_source_pixels_transfer_time, data->line_source_transfer_time[i][data->y_clk_level][data->sclk_level])), vbios->blackout_duration), data->chunk_request_time), data->cursor_request_time);
- data->stutter_exit_watermark[i] = bw_int_to_fixed(0);
- data->stutter_entry_watermark[i] = bw_int_to_fixed(0);
- if (data->display_pstate_change_enable[i] == 1) {
- data->nbp_state_change_watermark[i] = bw_add(bw_add(vbios->nbp_state_change_latency, data->mcifwr_burst_time[data->y_clk_level][data->sclk_level]), bw_max2(data->line_source_pixels_transfer_time, data->dram_speed_change_line_source_transfer_time[i][data->y_clk_level][data->sclk_level]));
- }
- else {
- /*maximize the watermark to force the switch in the vb_lank region of the frame*/
- data->nbp_state_change_watermark[i] = bw_int_to_fixed(131000);
- }
- }
- }
- }
- /*stutter mode enable*/
- /*in the multi-display case the stutter exit or entry watermark cannot exceed the minimum latency hiding capabilities of the*/
- /*display pipe.*/
- data->stutter_mode_enable = data->cpuc_state_change_enable;
- if (data->number_of_displays > 1) {
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if ((bw_mtn(data->stutter_exit_watermark[i], data->minimum_latency_hiding[i]) || bw_mtn(data->stutter_entry_watermark[i], data->minimum_latency_hiding[i]))) {
- data->stutter_mode_enable = bw_def_no;
- }
- }
- }
- }
- /*performance metrics*/
- /* display read access efficiency (%)*/
- /* display write back access efficiency (%)*/
- /* stutter efficiency (%)*/
- /* extra underlay pitch recommended for efficiency (pixels)*/
- /* immediate flip time (us)*/
- /* latency for other clients due to urgent display read (us)*/
- /* latency for other clients due to urgent display write (us)*/
- /* average bandwidth consumed by display (no compression) (gb/s)*/
- /* required dram bandwidth (gb/s)*/
- /* required sclk (m_hz)*/
- /* required rd urgent latency (us)*/
- /* nb p-state change margin (us)*/
- /*dmif and mcifwr dram access efficiency*/
- /*is the ratio between the ideal dram access time (which is the data buffer size in memory divided by the dram bandwidth), and the actual time which is the total page close-open time. but it cannot exceed the dram efficiency provided by the memory subsystem*/
- data->dmifdram_access_efficiency = bw_min2(bw_div(bw_div(data->total_display_reads_required_dram_access_data, data->dram_bandwidth), data->dmif_total_page_close_open_time), bw_int_to_fixed(1));
- if (bw_mtn(data->total_display_writes_required_dram_access_data, bw_int_to_fixed(0))) {
- data->mcifwrdram_access_efficiency = bw_min2(bw_div(bw_div(data->total_display_writes_required_dram_access_data, data->dram_bandwidth), data->mcifwr_total_page_close_open_time), bw_int_to_fixed(1));
- }
- else {
- data->mcifwrdram_access_efficiency = bw_int_to_fixed(0);
- }
- /*stutter efficiency*/
- /*the stutter efficiency is the frame-average time in self-refresh divided by the frame-average stutter cycle duration. only applies if the display write-back is not enabled.*/
- /*the frame-average stutter cycle used is the minimum for all pipes of the frame-average data buffer size in time, times the compression rate*/
- /*the frame-average time in self-refresh is the stutter cycle minus the self refresh exit latency and the burst time*/
- /*the stutter cycle is the dmif buffer size reduced by the excess of the stutter exit watermark over the lb size in time.*/
- /*the burst time is the data needed during the stutter cycle divided by the available bandwidth*/
- /*compute the time read all the data from the dmif buffer to the lb (dram refresh period)*/
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- data->stutter_refresh_duration[i] = bw_sub(bw_mul(bw_div(bw_div(bw_mul(bw_div(bw_div(data->adjusted_data_buffer_size[i], bw_int_to_fixed(data->bytes_per_pixel[i])), data->source_width_rounded_up_to_chunks[i]), data->h_total[i]), data->vsr[i]), data->pixel_rate[i]), data->compression_rate[i]), bw_max2(bw_int_to_fixed(0), bw_sub(data->stutter_exit_watermark[i], bw_div(bw_mul((bw_sub(data->lb_partitions[i], bw_int_to_fixed(1))), data->h_total[i]), data->pixel_rate[i]))));
- data->stutter_dmif_buffer_size[i] = bw_div(bw_mul(bw_mul(bw_div(bw_mul(bw_mul(data->stutter_refresh_duration[i], bw_int_to_fixed(data->bytes_per_pixel[i])), data->source_width_rounded_up_to_chunks[i]), data->h_total[i]), data->vsr[i]), data->pixel_rate[i]), data->compression_rate[i]);
- }
- }
- data->min_stutter_refresh_duration = bw_int_to_fixed(9999);
- data->total_stutter_dmif_buffer_size = 0;
- data->total_bytes_requested = 0;
- data->min_stutter_dmif_buffer_size = 9999;
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- if (bw_mtn(data->min_stutter_refresh_duration, data->stutter_refresh_duration[i])) {
- data->min_stutter_refresh_duration = data->stutter_refresh_duration[i];
- data->total_bytes_requested = bw_fixed_to_int(bw_add(bw_int_to_fixed(data->total_bytes_requested), (bw_mul(bw_mul(data->source_height_rounded_up_to_chunks[i], data->source_width_rounded_up_to_chunks[i]), bw_int_to_fixed(data->bytes_per_pixel[i])))));
- data->min_stutter_dmif_buffer_size = bw_fixed_to_int(data->stutter_dmif_buffer_size[i]);
- }
- data->total_stutter_dmif_buffer_size = bw_fixed_to_int(bw_add(data->stutter_dmif_buffer_size[i], bw_int_to_fixed(data->total_stutter_dmif_buffer_size)));
- }
- }
- data->stutter_burst_time = bw_div(bw_int_to_fixed(data->total_stutter_dmif_buffer_size), bw_mul(sclk[data->sclk_level], vbios->data_return_bus_width));
- data->num_stutter_bursts = data->total_bytes_requested / data->min_stutter_dmif_buffer_size;
- data->total_stutter_cycle_duration = bw_add(bw_add(data->min_stutter_refresh_duration, vbios->stutter_self_refresh_exit_latency), data->stutter_burst_time);
- data->time_in_self_refresh = data->min_stutter_refresh_duration;
- if (data->d1_display_write_back_dwb_enable == 1) {
- data->stutter_efficiency = bw_int_to_fixed(0);
- }
- else if (bw_ltn(data->time_in_self_refresh, bw_int_to_fixed(0))) {
- data->stutter_efficiency = bw_int_to_fixed(0);
- }
- else {
- /*compute stutter efficiency assuming 60 hz refresh rate*/
- data->stutter_efficiency = bw_max2(bw_int_to_fixed(0), bw_mul((bw_sub(bw_int_to_fixed(1), (bw_div(bw_mul((bw_add(vbios->stutter_self_refresh_exit_latency, data->stutter_burst_time)), bw_int_to_fixed(data->num_stutter_bursts)), bw_frc_to_fixed(166666667, 10000))))), bw_int_to_fixed(100)));
- }
- /*immediate flip time*/
- /*if scatter gather is enabled, the immediate flip takes a number of urgent memory trips equivalent to the pte requests in a row divided by the pte request limit.*/
- /*otherwise, it may take just one urgenr memory trip*/
- data->worst_number_of_trips_to_memory = bw_int_to_fixed(1);
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i] && data->scatter_gather_enable_for_pipe[i] == 1) {
- data->number_of_trips_to_memory_for_getting_apte_row[i] = bw_ceil2(bw_div(data->scatter_gather_pte_requests_in_row[i], data->scatter_gather_pte_request_limit[i]), bw_int_to_fixed(1));
- if (bw_ltn(data->worst_number_of_trips_to_memory, data->number_of_trips_to_memory_for_getting_apte_row[i])) {
- data->worst_number_of_trips_to_memory = data->number_of_trips_to_memory_for_getting_apte_row[i];
- }
- }
- }
- data->immediate_flip_time = bw_mul(data->worst_number_of_trips_to_memory, data->total_dmifmc_urgent_latency);
- /*worst latency for other clients*/
- /*it is the urgent latency plus the urgent burst time*/
- data->latency_for_non_dmif_clients = bw_add(data->total_dmifmc_urgent_latency, data->dmif_burst_time[data->y_clk_level][data->sclk_level]);
- if (data->d1_display_write_back_dwb_enable == 1) {
- data->latency_for_non_mcifwr_clients = bw_add(vbios->mcifwrmc_urgent_latency, dceip->mcifwr_all_surfaces_burst_time);
- }
- else {
- data->latency_for_non_mcifwr_clients = bw_int_to_fixed(0);
- }
- /*dmif mc urgent latency supported in high sclk and yclk*/
- data->dmifmc_urgent_latency_supported_in_high_sclk_and_yclk = bw_div((bw_sub(data->min_read_buffer_size_in_time, data->dmif_burst_time[high][s_high])), data->total_dmifmc_urgent_trips);
- /*dram speed/p-state change margin*/
- /*in the multi-display case the nb p-state change watermark cannot exceed the average lb size plus the dmif size or the cursor dcp buffer size*/
- data->v_blank_nbp_state_dram_speed_change_latency_supported = bw_int_to_fixed(99999);
- data->nbp_state_dram_speed_change_latency_supported = bw_int_to_fixed(99999);
- for (i = 0; i <= maximum_number_of_surfaces - 1; i++) {
- if (data->enable[i]) {
- data->nbp_state_dram_speed_change_latency_supported = bw_min2(data->nbp_state_dram_speed_change_latency_supported, bw_add(bw_sub(data->maximum_latency_hiding_with_cursor[i], data->nbp_state_change_watermark[i]), vbios->nbp_state_change_latency));
- data->v_blank_nbp_state_dram_speed_change_latency_supported = bw_min2(data->v_blank_nbp_state_dram_speed_change_latency_supported, bw_add(bw_sub(bw_div(bw_mul((bw_sub(data->v_total[i], bw_sub(bw_div(data->src_height[i], data->v_scale_ratio[i]), bw_int_to_fixed(4)))), data->h_total[i]), data->pixel_rate[i]), data->nbp_state_change_watermark[i]), vbios->nbp_state_change_latency));
- }
- }
- /*sclk required vs urgent latency*/
- for (i = 1; i <= 5; i++) {
- data->display_reads_time_for_data_transfer_and_urgent_latency = bw_sub(data->min_read_buffer_size_in_time, bw_mul(data->total_dmifmc_urgent_trips, bw_int_to_fixed(i)));
- if (pipe_check == bw_def_ok && (bw_mtn(data->display_reads_time_for_data_transfer_and_urgent_latency, data->dmif_total_page_close_open_time))) {
- data->dmif_required_sclk_for_urgent_latency[i] = bw_div(bw_div(data->total_display_reads_required_data, data->display_reads_time_for_data_transfer_and_urgent_latency), (bw_mul(vbios->data_return_bus_width, bw_frc_to_fixed(dceip->percent_of_ideal_port_bw_received_after_urgent_latency, 100))));
- }
- else {
- data->dmif_required_sclk_for_urgent_latency[i] = bw_int_to_fixed(bw_def_na);
- }
- }
- /*output link bit per pixel supported*/
- for (k = 0; k <= maximum_number_of_surfaces - 1; k++) {
- data->output_bpphdmi[k] = bw_def_na;
- data->output_bppdp4_lane_hbr[k] = bw_def_na;
- data->output_bppdp4_lane_hbr2[k] = bw_def_na;
- data->output_bppdp4_lane_hbr3[k] = bw_def_na;
- if (data->enable[k]) {
- data->output_bpphdmi[k] = bw_fixed_to_int(bw_mul(bw_div(bw_min2(bw_int_to_fixed(600), data->max_phyclk), data->pixel_rate[k]), bw_int_to_fixed(24)));
- if (bw_meq(data->max_phyclk, bw_int_to_fixed(270))) {
- data->output_bppdp4_lane_hbr[k] = bw_fixed_to_int(bw_mul(bw_div(bw_mul(bw_int_to_fixed(270), bw_int_to_fixed(4)), data->pixel_rate[k]), bw_int_to_fixed(8)));
- }
- if (bw_meq(data->max_phyclk, bw_int_to_fixed(540))) {
- data->output_bppdp4_lane_hbr2[k] = bw_fixed_to_int(bw_mul(bw_div(bw_mul(bw_int_to_fixed(540), bw_int_to_fixed(4)), data->pixel_rate[k]), bw_int_to_fixed(8)));
- }
- if (bw_meq(data->max_phyclk, bw_int_to_fixed(810))) {
- data->output_bppdp4_lane_hbr3[k] = bw_fixed_to_int(bw_mul(bw_div(bw_mul(bw_int_to_fixed(810), bw_int_to_fixed(4)), data->pixel_rate[k]), bw_int_to_fixed(8)));
- }
- }
- }
-
- kfree(surface_type);
-free_tiling_mode:
- kfree(tiling_mode);
-free_sclk:
- kfree(sclk);
-free_yclk:
- kfree(yclk);
-}
-
-/*******************************************************************************
- * Public functions
- ******************************************************************************/
-void bw_calcs_init(struct bw_calcs_dceip *bw_dceip,
- struct bw_calcs_vbios *bw_vbios,
- struct hw_asic_id asic_id)
-{
- struct bw_calcs_dceip *dceip;
- struct bw_calcs_vbios *vbios;
-
- enum bw_calcs_version version = bw_calcs_version_from_asic_id(asic_id);
-
- dceip = kzalloc(sizeof(*dceip), GFP_KERNEL);
- if (!dceip)
- return;
-
- vbios = kzalloc(sizeof(*vbios), GFP_KERNEL);
- if (!vbios) {
- kfree(dceip);
- return;
- }
-
- dceip->version = version;
-
- switch (version) {
- case BW_CALCS_VERSION_CARRIZO:
- vbios->memory_type = bw_def_gddr5;
- vbios->dram_channel_width_in_bits = 64;
- vbios->number_of_dram_channels = asic_id.vram_width / vbios->dram_channel_width_in_bits;
- vbios->number_of_dram_banks = 8;
- vbios->high_yclk = bw_int_to_fixed(1600);
- vbios->mid_yclk = bw_int_to_fixed(1600);
- vbios->low_yclk = bw_frc_to_fixed(66666, 100);
- vbios->low_sclk = bw_int_to_fixed(200);
- vbios->mid1_sclk = bw_int_to_fixed(300);
- vbios->mid2_sclk = bw_int_to_fixed(300);
- vbios->mid3_sclk = bw_int_to_fixed(300);
- vbios->mid4_sclk = bw_int_to_fixed(300);
- vbios->mid5_sclk = bw_int_to_fixed(300);
- vbios->mid6_sclk = bw_int_to_fixed(300);
- vbios->high_sclk = bw_frc_to_fixed(62609, 100);
- vbios->low_voltage_max_dispclk = bw_int_to_fixed(352);
- vbios->mid_voltage_max_dispclk = bw_int_to_fixed(467);
- vbios->high_voltage_max_dispclk = bw_int_to_fixed(643);
- vbios->low_voltage_max_phyclk = bw_int_to_fixed(540);
- vbios->mid_voltage_max_phyclk = bw_int_to_fixed(810);
- vbios->high_voltage_max_phyclk = bw_int_to_fixed(810);
- vbios->data_return_bus_width = bw_int_to_fixed(32);
- vbios->trc = bw_int_to_fixed(50);
- vbios->dmifmc_urgent_latency = bw_int_to_fixed(4);
- vbios->stutter_self_refresh_exit_latency = bw_frc_to_fixed(153, 10);
- vbios->stutter_self_refresh_entry_latency = bw_int_to_fixed(0);
- vbios->nbp_state_change_latency = bw_frc_to_fixed(19649, 1000);
- vbios->mcifwrmc_urgent_latency = bw_int_to_fixed(10);
- vbios->scatter_gather_enable = true;
- vbios->down_spread_percentage = bw_frc_to_fixed(5, 10);
- vbios->cursor_width = 32;
- vbios->average_compression_rate = 4;
- vbios->number_of_request_slots_gmc_reserves_for_dmif_per_channel = 256;
- vbios->blackout_duration = bw_int_to_fixed(0); /* us */
- vbios->maximum_blackout_recovery_time = bw_int_to_fixed(0);
-
- dceip->max_average_percent_of_ideal_port_bw_display_can_use_in_normal_system_operation = 100;
- dceip->max_average_percent_of_ideal_drambw_display_can_use_in_normal_system_operation = 100;
- dceip->percent_of_ideal_port_bw_received_after_urgent_latency = 100;
- dceip->large_cursor = false;
- dceip->dmif_request_buffer_size = bw_int_to_fixed(768);
- dceip->dmif_pipe_en_fbc_chunk_tracker = false;
- dceip->cursor_max_outstanding_group_num = 1;
- dceip->lines_interleaved_into_lb = 2;
- dceip->chunk_width = 256;
- dceip->number_of_graphics_pipes = 3;
- dceip->number_of_underlay_pipes = 1;
- dceip->low_power_tiling_mode = 0;
- dceip->display_write_back_supported = false;
- dceip->argb_compression_support = false;
- dceip->underlay_vscaler_efficiency6_bit_per_component =
- bw_frc_to_fixed(35556, 10000);
- dceip->underlay_vscaler_efficiency8_bit_per_component =
- bw_frc_to_fixed(34286, 10000);
- dceip->underlay_vscaler_efficiency10_bit_per_component =
- bw_frc_to_fixed(32, 10);
- dceip->underlay_vscaler_efficiency12_bit_per_component =
- bw_int_to_fixed(3);
- dceip->graphics_vscaler_efficiency6_bit_per_component =
- bw_frc_to_fixed(35, 10);
- dceip->graphics_vscaler_efficiency8_bit_per_component =
- bw_frc_to_fixed(34286, 10000);
- dceip->graphics_vscaler_efficiency10_bit_per_component =
- bw_frc_to_fixed(32, 10);
- dceip->graphics_vscaler_efficiency12_bit_per_component =
- bw_int_to_fixed(3);
- dceip->alpha_vscaler_efficiency = bw_int_to_fixed(3);
- dceip->max_dmif_buffer_allocated = 2;
- dceip->graphics_dmif_size = 12288;
- dceip->underlay_luma_dmif_size = 19456;
- dceip->underlay_chroma_dmif_size = 23552;
- dceip->pre_downscaler_enabled = true;
- dceip->underlay_downscale_prefetch_enabled = true;
- dceip->lb_write_pixels_per_dispclk = bw_int_to_fixed(1);
- dceip->lb_size_per_component444 = bw_int_to_fixed(82176);
- dceip->graphics_lb_nodownscaling_multi_line_prefetching = false;
- dceip->stutter_and_dram_clock_state_change_gated_before_cursor =
- bw_int_to_fixed(0);
- dceip->underlay420_luma_lb_size_per_component = bw_int_to_fixed(
- 82176);
- dceip->underlay420_chroma_lb_size_per_component =
- bw_int_to_fixed(164352);
- dceip->underlay422_lb_size_per_component = bw_int_to_fixed(
- 82176);
- dceip->cursor_chunk_width = bw_int_to_fixed(64);
- dceip->cursor_dcp_buffer_lines = bw_int_to_fixed(4);
- dceip->underlay_maximum_width_efficient_for_tiling =
- bw_int_to_fixed(1920);
- dceip->underlay_maximum_height_efficient_for_tiling =
- bw_int_to_fixed(1080);
- dceip->peak_pte_request_to_eviction_ratio_limiting_multiple_displays_or_single_rotated_display =
- bw_frc_to_fixed(3, 10);
- dceip->peak_pte_request_to_eviction_ratio_limiting_single_display_no_rotation =
- bw_int_to_fixed(25);
- dceip->minimum_outstanding_pte_request_limit = bw_int_to_fixed(
- 2);
- dceip->maximum_total_outstanding_pte_requests_allowed_by_saw =
- bw_int_to_fixed(128);
- dceip->limit_excessive_outstanding_dmif_requests = true;
- dceip->linear_mode_line_request_alternation_slice =
- bw_int_to_fixed(64);
- dceip->scatter_gather_lines_of_pte_prefetching_in_linear_mode =
- 32;
- dceip->display_write_back420_luma_mcifwr_buffer_size = 12288;
- dceip->display_write_back420_chroma_mcifwr_buffer_size = 8192;
- dceip->request_efficiency = bw_frc_to_fixed(8, 10);
- dceip->dispclk_per_request = bw_int_to_fixed(2);
- dceip->dispclk_ramping_factor = bw_frc_to_fixed(105, 100);
- dceip->display_pipe_throughput_factor = bw_frc_to_fixed(105, 100);
- dceip->scatter_gather_pte_request_rows_in_tiling_mode = 2;
- dceip->mcifwr_all_surfaces_burst_time = bw_int_to_fixed(0); /* todo: this is a bug*/
- break;
- case BW_CALCS_VERSION_POLARIS10:
- /* TODO: Treat VEGAM the same as P10 for now
- * Need to tune the para for VEGAM if needed */
- case BW_CALCS_VERSION_VEGAM:
- vbios->memory_type = bw_def_gddr5;
- vbios->dram_channel_width_in_bits = 32;
- vbios->number_of_dram_channels = asic_id.vram_width / vbios->dram_channel_width_in_bits;
- vbios->number_of_dram_banks = 8;
- vbios->high_yclk = bw_int_to_fixed(6000);
- vbios->mid_yclk = bw_int_to_fixed(3200);
- vbios->low_yclk = bw_int_to_fixed(1000);
- vbios->low_sclk = bw_int_to_fixed(300);
- vbios->mid1_sclk = bw_int_to_fixed(400);
- vbios->mid2_sclk = bw_int_to_fixed(500);
- vbios->mid3_sclk = bw_int_to_fixed(600);
- vbios->mid4_sclk = bw_int_to_fixed(700);
- vbios->mid5_sclk = bw_int_to_fixed(800);
- vbios->mid6_sclk = bw_int_to_fixed(974);
- vbios->high_sclk = bw_int_to_fixed(1154);
- vbios->low_voltage_max_dispclk = bw_int_to_fixed(459);
- vbios->mid_voltage_max_dispclk = bw_int_to_fixed(654);
- vbios->high_voltage_max_dispclk = bw_int_to_fixed(1108);
- vbios->low_voltage_max_phyclk = bw_int_to_fixed(540);
- vbios->mid_voltage_max_phyclk = bw_int_to_fixed(810);
- vbios->high_voltage_max_phyclk = bw_int_to_fixed(810);
- vbios->data_return_bus_width = bw_int_to_fixed(32);
- vbios->trc = bw_int_to_fixed(48);
- vbios->dmifmc_urgent_latency = bw_int_to_fixed(3);
- vbios->stutter_self_refresh_exit_latency = bw_int_to_fixed(5);
- vbios->stutter_self_refresh_entry_latency = bw_int_to_fixed(0);
- vbios->nbp_state_change_latency = bw_int_to_fixed(45);
- vbios->mcifwrmc_urgent_latency = bw_int_to_fixed(10);
- vbios->scatter_gather_enable = true;
- vbios->down_spread_percentage = bw_frc_to_fixed(5, 10);
- vbios->cursor_width = 32;
- vbios->average_compression_rate = 4;
- vbios->number_of_request_slots_gmc_reserves_for_dmif_per_channel = 256;
- vbios->blackout_duration = bw_int_to_fixed(0); /* us */
- vbios->maximum_blackout_recovery_time = bw_int_to_fixed(0);
-
- dceip->max_average_percent_of_ideal_port_bw_display_can_use_in_normal_system_operation = 100;
- dceip->max_average_percent_of_ideal_drambw_display_can_use_in_normal_system_operation = 100;
- dceip->percent_of_ideal_port_bw_received_after_urgent_latency = 100;
- dceip->large_cursor = false;
- dceip->dmif_request_buffer_size = bw_int_to_fixed(768);
- dceip->dmif_pipe_en_fbc_chunk_tracker = false;
- dceip->cursor_max_outstanding_group_num = 1;
- dceip->lines_interleaved_into_lb = 2;
- dceip->chunk_width = 256;
- dceip->number_of_graphics_pipes = 6;
- dceip->number_of_underlay_pipes = 0;
- dceip->low_power_tiling_mode = 0;
- dceip->display_write_back_supported = false;
- dceip->argb_compression_support = true;
- dceip->underlay_vscaler_efficiency6_bit_per_component =
- bw_frc_to_fixed(35556, 10000);
- dceip->underlay_vscaler_efficiency8_bit_per_component =
- bw_frc_to_fixed(34286, 10000);
- dceip->underlay_vscaler_efficiency10_bit_per_component =
- bw_frc_to_fixed(32, 10);
- dceip->underlay_vscaler_efficiency12_bit_per_component =
- bw_int_to_fixed(3);
- dceip->graphics_vscaler_efficiency6_bit_per_component =
- bw_frc_to_fixed(35, 10);
- dceip->graphics_vscaler_efficiency8_bit_per_component =
- bw_frc_to_fixed(34286, 10000);
- dceip->graphics_vscaler_efficiency10_bit_per_component =
- bw_frc_to_fixed(32, 10);
- dceip->graphics_vscaler_efficiency12_bit_per_component =
- bw_int_to_fixed(3);
- dceip->alpha_vscaler_efficiency = bw_int_to_fixed(3);
- dceip->max_dmif_buffer_allocated = 4;
- dceip->graphics_dmif_size = 12288;
- dceip->underlay_luma_dmif_size = 19456;
- dceip->underlay_chroma_dmif_size = 23552;
- dceip->pre_downscaler_enabled = true;
- dceip->underlay_downscale_prefetch_enabled = true;
- dceip->lb_write_pixels_per_dispclk = bw_int_to_fixed(1);
- dceip->lb_size_per_component444 = bw_int_to_fixed(245952);
- dceip->graphics_lb_nodownscaling_multi_line_prefetching = true;
- dceip->stutter_and_dram_clock_state_change_gated_before_cursor =
- bw_int_to_fixed(1);
- dceip->underlay420_luma_lb_size_per_component = bw_int_to_fixed(
- 82176);
- dceip->underlay420_chroma_lb_size_per_component =
- bw_int_to_fixed(164352);
- dceip->underlay422_lb_size_per_component = bw_int_to_fixed(
- 82176);
- dceip->cursor_chunk_width = bw_int_to_fixed(64);
- dceip->cursor_dcp_buffer_lines = bw_int_to_fixed(4);
- dceip->underlay_maximum_width_efficient_for_tiling =
- bw_int_to_fixed(1920);
- dceip->underlay_maximum_height_efficient_for_tiling =
- bw_int_to_fixed(1080);
- dceip->peak_pte_request_to_eviction_ratio_limiting_multiple_displays_or_single_rotated_display =
- bw_frc_to_fixed(3, 10);
- dceip->peak_pte_request_to_eviction_ratio_limiting_single_display_no_rotation =
- bw_int_to_fixed(25);
- dceip->minimum_outstanding_pte_request_limit = bw_int_to_fixed(
- 2);
- dceip->maximum_total_outstanding_pte_requests_allowed_by_saw =
- bw_int_to_fixed(128);
- dceip->limit_excessive_outstanding_dmif_requests = true;
- dceip->linear_mode_line_request_alternation_slice =
- bw_int_to_fixed(64);
- dceip->scatter_gather_lines_of_pte_prefetching_in_linear_mode =
- 32;
- dceip->display_write_back420_luma_mcifwr_buffer_size = 12288;
- dceip->display_write_back420_chroma_mcifwr_buffer_size = 8192;
- dceip->request_efficiency = bw_frc_to_fixed(8, 10);
- dceip->dispclk_per_request = bw_int_to_fixed(2);
- dceip->dispclk_ramping_factor = bw_frc_to_fixed(105, 100);
- dceip->display_pipe_throughput_factor = bw_frc_to_fixed(105, 100);
- dceip->scatter_gather_pte_request_rows_in_tiling_mode = 2;
- dceip->mcifwr_all_surfaces_burst_time = bw_int_to_fixed(0);
- break;
- case BW_CALCS_VERSION_POLARIS11:
- vbios->memory_type = bw_def_gddr5;
- vbios->dram_channel_width_in_bits = 32;
- vbios->number_of_dram_channels = asic_id.vram_width / vbios->dram_channel_width_in_bits;
- vbios->number_of_dram_banks = 8;
- vbios->high_yclk = bw_int_to_fixed(6000);
- vbios->mid_yclk = bw_int_to_fixed(3200);
- vbios->low_yclk = bw_int_to_fixed(1000);
- vbios->low_sclk = bw_int_to_fixed(300);
- vbios->mid1_sclk = bw_int_to_fixed(400);
- vbios->mid2_sclk = bw_int_to_fixed(500);
- vbios->mid3_sclk = bw_int_to_fixed(600);
- vbios->mid4_sclk = bw_int_to_fixed(700);
- vbios->mid5_sclk = bw_int_to_fixed(800);
- vbios->mid6_sclk = bw_int_to_fixed(974);
- vbios->high_sclk = bw_int_to_fixed(1154);
- vbios->low_voltage_max_dispclk = bw_int_to_fixed(459);
- vbios->mid_voltage_max_dispclk = bw_int_to_fixed(654);
- vbios->high_voltage_max_dispclk = bw_int_to_fixed(1108);
- vbios->low_voltage_max_phyclk = bw_int_to_fixed(540);
- vbios->mid_voltage_max_phyclk = bw_int_to_fixed(810);
- vbios->high_voltage_max_phyclk = bw_int_to_fixed(810);
- vbios->data_return_bus_width = bw_int_to_fixed(32);
- vbios->trc = bw_int_to_fixed(48);
- if (vbios->number_of_dram_channels == 2) // 64-bit
- vbios->dmifmc_urgent_latency = bw_int_to_fixed(4);
- else
- vbios->dmifmc_urgent_latency = bw_int_to_fixed(3);
- vbios->stutter_self_refresh_exit_latency = bw_int_to_fixed(5);
- vbios->stutter_self_refresh_entry_latency = bw_int_to_fixed(0);
- vbios->nbp_state_change_latency = bw_int_to_fixed(45);
- vbios->mcifwrmc_urgent_latency = bw_int_to_fixed(10);
- vbios->scatter_gather_enable = true;
- vbios->down_spread_percentage = bw_frc_to_fixed(5, 10);
- vbios->cursor_width = 32;
- vbios->average_compression_rate = 4;
- vbios->number_of_request_slots_gmc_reserves_for_dmif_per_channel = 256;
- vbios->blackout_duration = bw_int_to_fixed(0); /* us */
- vbios->maximum_blackout_recovery_time = bw_int_to_fixed(0);
-
- dceip->max_average_percent_of_ideal_port_bw_display_can_use_in_normal_system_operation = 100;
- dceip->max_average_percent_of_ideal_drambw_display_can_use_in_normal_system_operation = 100;
- dceip->percent_of_ideal_port_bw_received_after_urgent_latency = 100;
- dceip->large_cursor = false;
- dceip->dmif_request_buffer_size = bw_int_to_fixed(768);
- dceip->dmif_pipe_en_fbc_chunk_tracker = false;
- dceip->cursor_max_outstanding_group_num = 1;
- dceip->lines_interleaved_into_lb = 2;
- dceip->chunk_width = 256;
- dceip->number_of_graphics_pipes = 5;
- dceip->number_of_underlay_pipes = 0;
- dceip->low_power_tiling_mode = 0;
- dceip->display_write_back_supported = false;
- dceip->argb_compression_support = true;
- dceip->underlay_vscaler_efficiency6_bit_per_component =
- bw_frc_to_fixed(35556, 10000);
- dceip->underlay_vscaler_efficiency8_bit_per_component =
- bw_frc_to_fixed(34286, 10000);
- dceip->underlay_vscaler_efficiency10_bit_per_component =
- bw_frc_to_fixed(32, 10);
- dceip->underlay_vscaler_efficiency12_bit_per_component =
- bw_int_to_fixed(3);
- dceip->graphics_vscaler_efficiency6_bit_per_component =
- bw_frc_to_fixed(35, 10);
- dceip->graphics_vscaler_efficiency8_bit_per_component =
- bw_frc_to_fixed(34286, 10000);
- dceip->graphics_vscaler_efficiency10_bit_per_component =
- bw_frc_to_fixed(32, 10);
- dceip->graphics_vscaler_efficiency12_bit_per_component =
- bw_int_to_fixed(3);
- dceip->alpha_vscaler_efficiency = bw_int_to_fixed(3);
- dceip->max_dmif_buffer_allocated = 4;
- dceip->graphics_dmif_size = 12288;
- dceip->underlay_luma_dmif_size = 19456;
- dceip->underlay_chroma_dmif_size = 23552;
- dceip->pre_downscaler_enabled = true;
- dceip->underlay_downscale_prefetch_enabled = true;
- dceip->lb_write_pixels_per_dispclk = bw_int_to_fixed(1);
- dceip->lb_size_per_component444 = bw_int_to_fixed(245952);
- dceip->graphics_lb_nodownscaling_multi_line_prefetching = true;
- dceip->stutter_and_dram_clock_state_change_gated_before_cursor =
- bw_int_to_fixed(1);
- dceip->underlay420_luma_lb_size_per_component = bw_int_to_fixed(
- 82176);
- dceip->underlay420_chroma_lb_size_per_component =
- bw_int_to_fixed(164352);
- dceip->underlay422_lb_size_per_component = bw_int_to_fixed(
- 82176);
- dceip->cursor_chunk_width = bw_int_to_fixed(64);
- dceip->cursor_dcp_buffer_lines = bw_int_to_fixed(4);
- dceip->underlay_maximum_width_efficient_for_tiling =
- bw_int_to_fixed(1920);
- dceip->underlay_maximum_height_efficient_for_tiling =
- bw_int_to_fixed(1080);
- dceip->peak_pte_request_to_eviction_ratio_limiting_multiple_displays_or_single_rotated_display =
- bw_frc_to_fixed(3, 10);
- dceip->peak_pte_request_to_eviction_ratio_limiting_single_display_no_rotation =
- bw_int_to_fixed(25);
- dceip->minimum_outstanding_pte_request_limit = bw_int_to_fixed(
- 2);
- dceip->maximum_total_outstanding_pte_requests_allowed_by_saw =
- bw_int_to_fixed(128);
- dceip->limit_excessive_outstanding_dmif_requests = true;
- dceip->linear_mode_line_request_alternation_slice =
- bw_int_to_fixed(64);
- dceip->scatter_gather_lines_of_pte_prefetching_in_linear_mode =
- 32;
- dceip->display_write_back420_luma_mcifwr_buffer_size = 12288;
- dceip->display_write_back420_chroma_mcifwr_buffer_size = 8192;
- dceip->request_efficiency = bw_frc_to_fixed(8, 10);
- dceip->dispclk_per_request = bw_int_to_fixed(2);
- dceip->dispclk_ramping_factor = bw_frc_to_fixed(105, 100);
- dceip->display_pipe_throughput_factor = bw_frc_to_fixed(105, 100);
- dceip->scatter_gather_pte_request_rows_in_tiling_mode = 2;
- dceip->mcifwr_all_surfaces_burst_time = bw_int_to_fixed(0);
- break;
- case BW_CALCS_VERSION_POLARIS12:
- vbios->memory_type = bw_def_gddr5;
- vbios->dram_channel_width_in_bits = 32;
- vbios->number_of_dram_channels = asic_id.vram_width / vbios->dram_channel_width_in_bits;
- vbios->number_of_dram_banks = 8;
- vbios->high_yclk = bw_int_to_fixed(6000);
- vbios->mid_yclk = bw_int_to_fixed(3200);
- vbios->low_yclk = bw_int_to_fixed(1000);
- vbios->low_sclk = bw_int_to_fixed(678);
- vbios->mid1_sclk = bw_int_to_fixed(864);
- vbios->mid2_sclk = bw_int_to_fixed(900);
- vbios->mid3_sclk = bw_int_to_fixed(920);
- vbios->mid4_sclk = bw_int_to_fixed(940);
- vbios->mid5_sclk = bw_int_to_fixed(960);
- vbios->mid6_sclk = bw_int_to_fixed(980);
- vbios->high_sclk = bw_int_to_fixed(1049);
- vbios->low_voltage_max_dispclk = bw_int_to_fixed(459);
- vbios->mid_voltage_max_dispclk = bw_int_to_fixed(654);
- vbios->high_voltage_max_dispclk = bw_int_to_fixed(1108);
- vbios->low_voltage_max_phyclk = bw_int_to_fixed(540);
- vbios->mid_voltage_max_phyclk = bw_int_to_fixed(810);
- vbios->high_voltage_max_phyclk = bw_int_to_fixed(810);
- vbios->data_return_bus_width = bw_int_to_fixed(32);
- vbios->trc = bw_int_to_fixed(48);
- if (vbios->number_of_dram_channels == 2) // 64-bit
- vbios->dmifmc_urgent_latency = bw_int_to_fixed(4);
- else
- vbios->dmifmc_urgent_latency = bw_int_to_fixed(3);
- vbios->stutter_self_refresh_exit_latency = bw_int_to_fixed(5);
- vbios->stutter_self_refresh_entry_latency = bw_int_to_fixed(0);
- vbios->nbp_state_change_latency = bw_int_to_fixed(250);
- vbios->mcifwrmc_urgent_latency = bw_int_to_fixed(10);
- vbios->scatter_gather_enable = false;
- vbios->down_spread_percentage = bw_frc_to_fixed(5, 10);
- vbios->cursor_width = 32;
- vbios->average_compression_rate = 4;
- vbios->number_of_request_slots_gmc_reserves_for_dmif_per_channel = 256;
- vbios->blackout_duration = bw_int_to_fixed(0); /* us */
- vbios->maximum_blackout_recovery_time = bw_int_to_fixed(0);
-
- dceip->max_average_percent_of_ideal_port_bw_display_can_use_in_normal_system_operation = 100;
- dceip->max_average_percent_of_ideal_drambw_display_can_use_in_normal_system_operation = 100;
- dceip->percent_of_ideal_port_bw_received_after_urgent_latency = 100;
- dceip->large_cursor = false;
- dceip->dmif_request_buffer_size = bw_int_to_fixed(768);
- dceip->dmif_pipe_en_fbc_chunk_tracker = false;
- dceip->cursor_max_outstanding_group_num = 1;
- dceip->lines_interleaved_into_lb = 2;
- dceip->chunk_width = 256;
- dceip->number_of_graphics_pipes = 5;
- dceip->number_of_underlay_pipes = 0;
- dceip->low_power_tiling_mode = 0;
- dceip->display_write_back_supported = true;
- dceip->argb_compression_support = true;
- dceip->underlay_vscaler_efficiency6_bit_per_component =
- bw_frc_to_fixed(35556, 10000);
- dceip->underlay_vscaler_efficiency8_bit_per_component =
- bw_frc_to_fixed(34286, 10000);
- dceip->underlay_vscaler_efficiency10_bit_per_component =
- bw_frc_to_fixed(32, 10);
- dceip->underlay_vscaler_efficiency12_bit_per_component =
- bw_int_to_fixed(3);
- dceip->graphics_vscaler_efficiency6_bit_per_component =
- bw_frc_to_fixed(35, 10);
- dceip->graphics_vscaler_efficiency8_bit_per_component =
- bw_frc_to_fixed(34286, 10000);
- dceip->graphics_vscaler_efficiency10_bit_per_component =
- bw_frc_to_fixed(32, 10);
- dceip->graphics_vscaler_efficiency12_bit_per_component =
- bw_int_to_fixed(3);
- dceip->alpha_vscaler_efficiency = bw_int_to_fixed(3);
- dceip->max_dmif_buffer_allocated = 4;
- dceip->graphics_dmif_size = 12288;
- dceip->underlay_luma_dmif_size = 19456;
- dceip->underlay_chroma_dmif_size = 23552;
- dceip->pre_downscaler_enabled = true;
- dceip->underlay_downscale_prefetch_enabled = true;
- dceip->lb_write_pixels_per_dispclk = bw_int_to_fixed(1);
- dceip->lb_size_per_component444 = bw_int_to_fixed(245952);
- dceip->graphics_lb_nodownscaling_multi_line_prefetching = true;
- dceip->stutter_and_dram_clock_state_change_gated_before_cursor =
- bw_int_to_fixed(1);
- dceip->underlay420_luma_lb_size_per_component = bw_int_to_fixed(
- 82176);
- dceip->underlay420_chroma_lb_size_per_component =
- bw_int_to_fixed(164352);
- dceip->underlay422_lb_size_per_component = bw_int_to_fixed(
- 82176);
- dceip->cursor_chunk_width = bw_int_to_fixed(64);
- dceip->cursor_dcp_buffer_lines = bw_int_to_fixed(4);
- dceip->underlay_maximum_width_efficient_for_tiling =
- bw_int_to_fixed(1920);
- dceip->underlay_maximum_height_efficient_for_tiling =
- bw_int_to_fixed(1080);
- dceip->peak_pte_request_to_eviction_ratio_limiting_multiple_displays_or_single_rotated_display =
- bw_frc_to_fixed(3, 10);
- dceip->peak_pte_request_to_eviction_ratio_limiting_single_display_no_rotation =
- bw_int_to_fixed(25);
- dceip->minimum_outstanding_pte_request_limit = bw_int_to_fixed(
- 2);
- dceip->maximum_total_outstanding_pte_requests_allowed_by_saw =
- bw_int_to_fixed(128);
- dceip->limit_excessive_outstanding_dmif_requests = true;
- dceip->linear_mode_line_request_alternation_slice =
- bw_int_to_fixed(64);
- dceip->scatter_gather_lines_of_pte_prefetching_in_linear_mode =
- 32;
- dceip->display_write_back420_luma_mcifwr_buffer_size = 12288;
- dceip->display_write_back420_chroma_mcifwr_buffer_size = 8192;
- dceip->request_efficiency = bw_frc_to_fixed(8, 10);
- dceip->dispclk_per_request = bw_int_to_fixed(2);
- dceip->dispclk_ramping_factor = bw_frc_to_fixed(105, 100);
- dceip->display_pipe_throughput_factor = bw_frc_to_fixed(105, 100);
- dceip->scatter_gather_pte_request_rows_in_tiling_mode = 2;
- dceip->mcifwr_all_surfaces_burst_time = bw_int_to_fixed(0);
- break;
- case BW_CALCS_VERSION_STONEY:
- vbios->memory_type = bw_def_gddr5;
- vbios->dram_channel_width_in_bits = 64;
- vbios->number_of_dram_channels = asic_id.vram_width / vbios->dram_channel_width_in_bits;
- vbios->number_of_dram_banks = 8;
- vbios->high_yclk = bw_int_to_fixed(1866);
- vbios->mid_yclk = bw_int_to_fixed(1866);
- vbios->low_yclk = bw_int_to_fixed(1333);
- vbios->low_sclk = bw_int_to_fixed(200);
- vbios->mid1_sclk = bw_int_to_fixed(600);
- vbios->mid2_sclk = bw_int_to_fixed(600);
- vbios->mid3_sclk = bw_int_to_fixed(600);
- vbios->mid4_sclk = bw_int_to_fixed(600);
- vbios->mid5_sclk = bw_int_to_fixed(600);
- vbios->mid6_sclk = bw_int_to_fixed(600);
- vbios->high_sclk = bw_int_to_fixed(800);
- vbios->low_voltage_max_dispclk = bw_int_to_fixed(352);
- vbios->mid_voltage_max_dispclk = bw_int_to_fixed(467);
- vbios->high_voltage_max_dispclk = bw_int_to_fixed(643);
- vbios->low_voltage_max_phyclk = bw_int_to_fixed(540);
- vbios->mid_voltage_max_phyclk = bw_int_to_fixed(810);
- vbios->high_voltage_max_phyclk = bw_int_to_fixed(810);
- vbios->data_return_bus_width = bw_int_to_fixed(32);
- vbios->trc = bw_int_to_fixed(50);
- vbios->dmifmc_urgent_latency = bw_int_to_fixed(4);
- vbios->stutter_self_refresh_exit_latency = bw_frc_to_fixed(158, 10);
- vbios->stutter_self_refresh_entry_latency = bw_int_to_fixed(0);
- vbios->nbp_state_change_latency = bw_frc_to_fixed(2008, 100);
- vbios->mcifwrmc_urgent_latency = bw_int_to_fixed(10);
- vbios->scatter_gather_enable = true;
- vbios->down_spread_percentage = bw_frc_to_fixed(5, 10);
- vbios->cursor_width = 32;
- vbios->average_compression_rate = 4;
- vbios->number_of_request_slots_gmc_reserves_for_dmif_per_channel = 256;
- vbios->blackout_duration = bw_int_to_fixed(0); /* us */
- vbios->maximum_blackout_recovery_time = bw_int_to_fixed(0);
-
- dceip->max_average_percent_of_ideal_port_bw_display_can_use_in_normal_system_operation = 100;
- dceip->max_average_percent_of_ideal_drambw_display_can_use_in_normal_system_operation = 100;
- dceip->percent_of_ideal_port_bw_received_after_urgent_latency = 100;
- dceip->large_cursor = false;
- dceip->dmif_request_buffer_size = bw_int_to_fixed(768);
- dceip->dmif_pipe_en_fbc_chunk_tracker = false;
- dceip->cursor_max_outstanding_group_num = 1;
- dceip->lines_interleaved_into_lb = 2;
- dceip->chunk_width = 256;
- dceip->number_of_graphics_pipes = 2;
- dceip->number_of_underlay_pipes = 1;
- dceip->low_power_tiling_mode = 0;
- dceip->display_write_back_supported = false;
- dceip->argb_compression_support = true;
- dceip->underlay_vscaler_efficiency6_bit_per_component =
- bw_frc_to_fixed(35556, 10000);
- dceip->underlay_vscaler_efficiency8_bit_per_component =
- bw_frc_to_fixed(34286, 10000);
- dceip->underlay_vscaler_efficiency10_bit_per_component =
- bw_frc_to_fixed(32, 10);
- dceip->underlay_vscaler_efficiency12_bit_per_component =
- bw_int_to_fixed(3);
- dceip->graphics_vscaler_efficiency6_bit_per_component =
- bw_frc_to_fixed(35, 10);
- dceip->graphics_vscaler_efficiency8_bit_per_component =
- bw_frc_to_fixed(34286, 10000);
- dceip->graphics_vscaler_efficiency10_bit_per_component =
- bw_frc_to_fixed(32, 10);
- dceip->graphics_vscaler_efficiency12_bit_per_component =
- bw_int_to_fixed(3);
- dceip->alpha_vscaler_efficiency = bw_int_to_fixed(3);
- dceip->max_dmif_buffer_allocated = 2;
- dceip->graphics_dmif_size = 12288;
- dceip->underlay_luma_dmif_size = 19456;
- dceip->underlay_chroma_dmif_size = 23552;
- dceip->pre_downscaler_enabled = true;
- dceip->underlay_downscale_prefetch_enabled = true;
- dceip->lb_write_pixels_per_dispclk = bw_int_to_fixed(1);
- dceip->lb_size_per_component444 = bw_int_to_fixed(82176);
- dceip->graphics_lb_nodownscaling_multi_line_prefetching = false;
- dceip->stutter_and_dram_clock_state_change_gated_before_cursor =
- bw_int_to_fixed(0);
- dceip->underlay420_luma_lb_size_per_component = bw_int_to_fixed(
- 82176);
- dceip->underlay420_chroma_lb_size_per_component =
- bw_int_to_fixed(164352);
- dceip->underlay422_lb_size_per_component = bw_int_to_fixed(
- 82176);
- dceip->cursor_chunk_width = bw_int_to_fixed(64);
- dceip->cursor_dcp_buffer_lines = bw_int_to_fixed(4);
- dceip->underlay_maximum_width_efficient_for_tiling =
- bw_int_to_fixed(1920);
- dceip->underlay_maximum_height_efficient_for_tiling =
- bw_int_to_fixed(1080);
- dceip->peak_pte_request_to_eviction_ratio_limiting_multiple_displays_or_single_rotated_display =
- bw_frc_to_fixed(3, 10);
- dceip->peak_pte_request_to_eviction_ratio_limiting_single_display_no_rotation =
- bw_int_to_fixed(25);
- dceip->minimum_outstanding_pte_request_limit = bw_int_to_fixed(
- 2);
- dceip->maximum_total_outstanding_pte_requests_allowed_by_saw =
- bw_int_to_fixed(128);
- dceip->limit_excessive_outstanding_dmif_requests = true;
- dceip->linear_mode_line_request_alternation_slice =
- bw_int_to_fixed(64);
- dceip->scatter_gather_lines_of_pte_prefetching_in_linear_mode =
- 32;
- dceip->display_write_back420_luma_mcifwr_buffer_size = 12288;
- dceip->display_write_back420_chroma_mcifwr_buffer_size = 8192;
- dceip->request_efficiency = bw_frc_to_fixed(8, 10);
- dceip->dispclk_per_request = bw_int_to_fixed(2);
- dceip->dispclk_ramping_factor = bw_frc_to_fixed(105, 100);
- dceip->display_pipe_throughput_factor = bw_frc_to_fixed(105, 100);
- dceip->scatter_gather_pte_request_rows_in_tiling_mode = 2;
- dceip->mcifwr_all_surfaces_burst_time = bw_int_to_fixed(0);
- break;
- case BW_CALCS_VERSION_VEGA10:
- vbios->memory_type = bw_def_hbm;
- vbios->dram_channel_width_in_bits = 128;
- vbios->number_of_dram_channels = asic_id.vram_width / vbios->dram_channel_width_in_bits;
- vbios->number_of_dram_banks = 16;
- vbios->high_yclk = bw_int_to_fixed(2400);
- vbios->mid_yclk = bw_int_to_fixed(1700);
- vbios->low_yclk = bw_int_to_fixed(1000);
- vbios->low_sclk = bw_int_to_fixed(300);
- vbios->mid1_sclk = bw_int_to_fixed(350);
- vbios->mid2_sclk = bw_int_to_fixed(400);
- vbios->mid3_sclk = bw_int_to_fixed(500);
- vbios->mid4_sclk = bw_int_to_fixed(600);
- vbios->mid5_sclk = bw_int_to_fixed(700);
- vbios->mid6_sclk = bw_int_to_fixed(760);
- vbios->high_sclk = bw_int_to_fixed(776);
- vbios->low_voltage_max_dispclk = bw_int_to_fixed(460);
- vbios->mid_voltage_max_dispclk = bw_int_to_fixed(670);
- vbios->high_voltage_max_dispclk = bw_int_to_fixed(1133);
- vbios->low_voltage_max_phyclk = bw_int_to_fixed(540);
- vbios->mid_voltage_max_phyclk = bw_int_to_fixed(810);
- vbios->high_voltage_max_phyclk = bw_int_to_fixed(810);
- vbios->data_return_bus_width = bw_int_to_fixed(32);
- vbios->trc = bw_int_to_fixed(48);
- vbios->dmifmc_urgent_latency = bw_int_to_fixed(3);
- vbios->stutter_self_refresh_exit_latency = bw_frc_to_fixed(75, 10);
- vbios->stutter_self_refresh_entry_latency = bw_frc_to_fixed(19, 10);
- vbios->nbp_state_change_latency = bw_int_to_fixed(39);
- vbios->mcifwrmc_urgent_latency = bw_int_to_fixed(10);
- vbios->scatter_gather_enable = false;
- vbios->down_spread_percentage = bw_frc_to_fixed(5, 10);
- vbios->cursor_width = 32;
- vbios->average_compression_rate = 4;
- vbios->number_of_request_slots_gmc_reserves_for_dmif_per_channel = 8;
- vbios->blackout_duration = bw_int_to_fixed(0); /* us */
- vbios->maximum_blackout_recovery_time = bw_int_to_fixed(0);
-
- dceip->max_average_percent_of_ideal_port_bw_display_can_use_in_normal_system_operation = 100;
- dceip->max_average_percent_of_ideal_drambw_display_can_use_in_normal_system_operation = 100;
- dceip->percent_of_ideal_port_bw_received_after_urgent_latency = 100;
- dceip->large_cursor = false;
- dceip->dmif_request_buffer_size = bw_int_to_fixed(2304);
- dceip->dmif_pipe_en_fbc_chunk_tracker = true;
- dceip->cursor_max_outstanding_group_num = 1;
- dceip->lines_interleaved_into_lb = 2;
- dceip->chunk_width = 256;
- dceip->number_of_graphics_pipes = 6;
- dceip->number_of_underlay_pipes = 0;
- dceip->low_power_tiling_mode = 0;
- dceip->display_write_back_supported = true;
- dceip->argb_compression_support = true;
- dceip->underlay_vscaler_efficiency6_bit_per_component =
- bw_frc_to_fixed(35556, 10000);
- dceip->underlay_vscaler_efficiency8_bit_per_component =
- bw_frc_to_fixed(34286, 10000);
- dceip->underlay_vscaler_efficiency10_bit_per_component =
- bw_frc_to_fixed(32, 10);
- dceip->underlay_vscaler_efficiency12_bit_per_component =
- bw_int_to_fixed(3);
- dceip->graphics_vscaler_efficiency6_bit_per_component =
- bw_frc_to_fixed(35, 10);
- dceip->graphics_vscaler_efficiency8_bit_per_component =
- bw_frc_to_fixed(34286, 10000);
- dceip->graphics_vscaler_efficiency10_bit_per_component =
- bw_frc_to_fixed(32, 10);
- dceip->graphics_vscaler_efficiency12_bit_per_component =
- bw_int_to_fixed(3);
- dceip->alpha_vscaler_efficiency = bw_int_to_fixed(3);
- dceip->max_dmif_buffer_allocated = 4;
- dceip->graphics_dmif_size = 24576;
- dceip->underlay_luma_dmif_size = 19456;
- dceip->underlay_chroma_dmif_size = 23552;
- dceip->pre_downscaler_enabled = true;
- dceip->underlay_downscale_prefetch_enabled = false;
- dceip->lb_write_pixels_per_dispclk = bw_int_to_fixed(1);
- dceip->lb_size_per_component444 = bw_int_to_fixed(245952);
- dceip->graphics_lb_nodownscaling_multi_line_prefetching = true;
- dceip->stutter_and_dram_clock_state_change_gated_before_cursor =
- bw_int_to_fixed(1);
- dceip->underlay420_luma_lb_size_per_component = bw_int_to_fixed(
- 82176);
- dceip->underlay420_chroma_lb_size_per_component =
- bw_int_to_fixed(164352);
- dceip->underlay422_lb_size_per_component = bw_int_to_fixed(
- 82176);
- dceip->cursor_chunk_width = bw_int_to_fixed(64);
- dceip->cursor_dcp_buffer_lines = bw_int_to_fixed(4);
- dceip->underlay_maximum_width_efficient_for_tiling =
- bw_int_to_fixed(1920);
- dceip->underlay_maximum_height_efficient_for_tiling =
- bw_int_to_fixed(1080);
- dceip->peak_pte_request_to_eviction_ratio_limiting_multiple_displays_or_single_rotated_display =
- bw_frc_to_fixed(3, 10);
- dceip->peak_pte_request_to_eviction_ratio_limiting_single_display_no_rotation =
- bw_int_to_fixed(25);
- dceip->minimum_outstanding_pte_request_limit = bw_int_to_fixed(
- 2);
- dceip->maximum_total_outstanding_pte_requests_allowed_by_saw =
- bw_int_to_fixed(128);
- dceip->limit_excessive_outstanding_dmif_requests = true;
- dceip->linear_mode_line_request_alternation_slice =
- bw_int_to_fixed(64);
- dceip->scatter_gather_lines_of_pte_prefetching_in_linear_mode =
- 32;
- dceip->display_write_back420_luma_mcifwr_buffer_size = 12288;
- dceip->display_write_back420_chroma_mcifwr_buffer_size = 8192;
- dceip->request_efficiency = bw_frc_to_fixed(8, 10);
- dceip->dispclk_per_request = bw_int_to_fixed(2);
- dceip->dispclk_ramping_factor = bw_frc_to_fixed(105, 100);
- dceip->display_pipe_throughput_factor = bw_frc_to_fixed(105, 100);
- dceip->scatter_gather_pte_request_rows_in_tiling_mode = 2;
- dceip->mcifwr_all_surfaces_burst_time = bw_int_to_fixed(0);
- break;
- default:
- break;
- }
- *bw_dceip = *dceip;
- *bw_vbios = *vbios;
-
- kfree(dceip);
- kfree(vbios);
-}
-
-/*
- * Compare calculated (required) clocks against the clocks available at
- * maximum voltage (max Performance Level).
- */
-static bool is_display_configuration_supported(
- const struct bw_calcs_vbios *vbios,
- const struct dce_bw_output *calcs_output)
-{
- uint32_t int_max_clk;
-
- int_max_clk = bw_fixed_to_int(vbios->high_voltage_max_dispclk);
- int_max_clk *= 1000; /* MHz to kHz */
- if (calcs_output->dispclk_khz > int_max_clk)
- return false;
-
- int_max_clk = bw_fixed_to_int(vbios->high_sclk);
- int_max_clk *= 1000; /* MHz to kHz */
- if (calcs_output->sclk_khz > int_max_clk)
- return false;
-
- return true;
-}
-
-static void populate_initial_data(
- const struct pipe_ctx pipe[], int pipe_count, struct bw_calcs_data *data)
-{
- int i, j;
- int num_displays = 0;
-
- data->underlay_surface_type = bw_def_420;
- data->panning_and_bezel_adjustment = bw_def_none;
- data->graphics_lb_bpc = 10;
- data->underlay_lb_bpc = 8;
- data->underlay_tiling_mode = bw_def_tiled;
- data->graphics_tiling_mode = bw_def_tiled;
- data->underlay_micro_tile_mode = bw_def_display_micro_tiling;
- data->graphics_micro_tile_mode = bw_def_display_micro_tiling;
- data->increase_voltage_to_support_mclk_switch = true;
-
- /* Pipes with underlay first */
- for (i = 0; i < pipe_count; i++) {
- if (!pipe[i].stream || !pipe[i].bottom_pipe)
- continue;
-
- ASSERT(pipe[i].plane_state);
-
- if (num_displays == 0) {
- if (!pipe[i].plane_state->visible)
- data->d0_underlay_mode = bw_def_underlay_only;
- else
- data->d0_underlay_mode = bw_def_blend;
- } else {
- if (!pipe[i].plane_state->visible)
- data->d1_underlay_mode = bw_def_underlay_only;
- else
- data->d1_underlay_mode = bw_def_blend;
- }
-
- data->fbc_en[num_displays + 4] = false;
- data->lpt_en[num_displays + 4] = false;
- data->h_total[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->timing.h_total);
- data->v_total[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->timing.v_total);
- data->pixel_rate[num_displays + 4] = bw_frc_to_fixed(pipe[i].stream->timing.pix_clk_100hz, 10000);
- data->src_width[num_displays + 4] = bw_int_to_fixed(pipe[i].plane_res.scl_data.viewport.width);
- data->pitch_in_pixels[num_displays + 4] = data->src_width[num_displays + 4];
- data->src_height[num_displays + 4] = bw_int_to_fixed(pipe[i].plane_res.scl_data.viewport.height);
- data->h_taps[num_displays + 4] = bw_int_to_fixed(pipe[i].plane_res.scl_data.taps.h_taps);
- data->v_taps[num_displays + 4] = bw_int_to_fixed(pipe[i].plane_res.scl_data.taps.v_taps);
- data->h_scale_ratio[num_displays + 4] = fixed31_32_to_bw_fixed(pipe[i].plane_res.scl_data.ratios.horz.value);
- data->v_scale_ratio[num_displays + 4] = fixed31_32_to_bw_fixed(pipe[i].plane_res.scl_data.ratios.vert.value);
- switch (pipe[i].plane_state->rotation) {
- case ROTATION_ANGLE_0:
- data->rotation_angle[num_displays + 4] = bw_int_to_fixed(0);
- break;
- case ROTATION_ANGLE_90:
- data->rotation_angle[num_displays + 4] = bw_int_to_fixed(90);
- break;
- case ROTATION_ANGLE_180:
- data->rotation_angle[num_displays + 4] = bw_int_to_fixed(180);
- break;
- case ROTATION_ANGLE_270:
- data->rotation_angle[num_displays + 4] = bw_int_to_fixed(270);
- break;
- default:
- break;
- }
- switch (pipe[i].plane_state->format) {
- case SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr:
- case SURFACE_PIXEL_FORMAT_GRPH_ARGB1555:
- case SURFACE_PIXEL_FORMAT_GRPH_RGB565:
- data->bytes_per_pixel[num_displays + 4] = 2;
- break;
- case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888:
- case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
- case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
- case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
- case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010_XR_BIAS:
- case SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCbCr:
- case SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCrCb:
- data->bytes_per_pixel[num_displays + 4] = 4;
- break;
- case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616:
- case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616:
- case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F:
- data->bytes_per_pixel[num_displays + 4] = 8;
- break;
- default:
- data->bytes_per_pixel[num_displays + 4] = 4;
- break;
- }
- data->interlace_mode[num_displays + 4] = false;
- data->stereo_mode[num_displays + 4] = bw_def_mono;
-
-
- for (j = 0; j < 2; j++) {
- data->fbc_en[num_displays * 2 + j] = false;
- data->lpt_en[num_displays * 2 + j] = false;
-
- data->src_height[num_displays * 2 + j] = bw_int_to_fixed(pipe[i].bottom_pipe->plane_res.scl_data.viewport.height);
- data->src_width[num_displays * 2 + j] = bw_int_to_fixed(pipe[i].bottom_pipe->plane_res.scl_data.viewport.width);
- data->pitch_in_pixels[num_displays * 2 + j] = bw_int_to_fixed(
- pipe[i].bottom_pipe->plane_state->plane_size.surface_pitch);
- data->h_taps[num_displays * 2 + j] = bw_int_to_fixed(pipe[i].bottom_pipe->plane_res.scl_data.taps.h_taps);
- data->v_taps[num_displays * 2 + j] = bw_int_to_fixed(pipe[i].bottom_pipe->plane_res.scl_data.taps.v_taps);
- data->h_scale_ratio[num_displays * 2 + j] = fixed31_32_to_bw_fixed(
- pipe[i].bottom_pipe->plane_res.scl_data.ratios.horz.value);
- data->v_scale_ratio[num_displays * 2 + j] = fixed31_32_to_bw_fixed(
- pipe[i].bottom_pipe->plane_res.scl_data.ratios.vert.value);
- switch (pipe[i].bottom_pipe->plane_state->rotation) {
- case ROTATION_ANGLE_0:
- data->rotation_angle[num_displays * 2 + j] = bw_int_to_fixed(0);
- break;
- case ROTATION_ANGLE_90:
- data->rotation_angle[num_displays * 2 + j] = bw_int_to_fixed(90);
- break;
- case ROTATION_ANGLE_180:
- data->rotation_angle[num_displays * 2 + j] = bw_int_to_fixed(180);
- break;
- case ROTATION_ANGLE_270:
- data->rotation_angle[num_displays * 2 + j] = bw_int_to_fixed(270);
- break;
- default:
- break;
- }
- data->stereo_mode[num_displays * 2 + j] = bw_def_mono;
- }
-
- num_displays++;
- }
-
- /* Pipes without underlay after */
- for (i = 0; i < pipe_count; i++) {
- unsigned int pixel_clock_100hz;
- if (!pipe[i].stream || pipe[i].bottom_pipe)
- continue;
-
-
- data->fbc_en[num_displays + 4] = false;
- data->lpt_en[num_displays + 4] = false;
- data->h_total[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->timing.h_total);
- data->v_total[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->timing.v_total);
- pixel_clock_100hz = pipe[i].stream->timing.pix_clk_100hz;
- if (pipe[i].stream->timing.timing_3d_format == TIMING_3D_FORMAT_HW_FRAME_PACKING)
- pixel_clock_100hz *= 2;
- data->pixel_rate[num_displays + 4] = bw_frc_to_fixed(pixel_clock_100hz, 10000);
- if (pipe[i].plane_state) {
- data->src_width[num_displays + 4] = bw_int_to_fixed(pipe[i].plane_res.scl_data.viewport.width);
- data->pitch_in_pixels[num_displays + 4] = data->src_width[num_displays + 4];
- data->src_height[num_displays + 4] = bw_int_to_fixed(pipe[i].plane_res.scl_data.viewport.height);
- data->h_taps[num_displays + 4] = bw_int_to_fixed(pipe[i].plane_res.scl_data.taps.h_taps);
- data->v_taps[num_displays + 4] = bw_int_to_fixed(pipe[i].plane_res.scl_data.taps.v_taps);
- data->h_scale_ratio[num_displays + 4] = fixed31_32_to_bw_fixed(pipe[i].plane_res.scl_data.ratios.horz.value);
- data->v_scale_ratio[num_displays + 4] = fixed31_32_to_bw_fixed(pipe[i].plane_res.scl_data.ratios.vert.value);
- switch (pipe[i].plane_state->rotation) {
- case ROTATION_ANGLE_0:
- data->rotation_angle[num_displays + 4] = bw_int_to_fixed(0);
- break;
- case ROTATION_ANGLE_90:
- data->rotation_angle[num_displays + 4] = bw_int_to_fixed(90);
- break;
- case ROTATION_ANGLE_180:
- data->rotation_angle[num_displays + 4] = bw_int_to_fixed(180);
- break;
- case ROTATION_ANGLE_270:
- data->rotation_angle[num_displays + 4] = bw_int_to_fixed(270);
- break;
- default:
- break;
- }
- switch (pipe[i].plane_state->format) {
- case SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr:
- case SURFACE_PIXEL_FORMAT_VIDEO_420_YCrCb:
- case SURFACE_PIXEL_FORMAT_GRPH_ARGB1555:
- case SURFACE_PIXEL_FORMAT_GRPH_RGB565:
- data->bytes_per_pixel[num_displays + 4] = 2;
- break;
- case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888:
- case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888:
- case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010:
- case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010:
- case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010_XR_BIAS:
- case SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCbCr:
- case SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCrCb:
- data->bytes_per_pixel[num_displays + 4] = 4;
- break;
- case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616:
- case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616:
- case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F:
- data->bytes_per_pixel[num_displays + 4] = 8;
- break;
- default:
- data->bytes_per_pixel[num_displays + 4] = 4;
- break;
- }
- } else if (pipe[i].stream->dst.width != 0 &&
- pipe[i].stream->dst.height != 0 &&
- pipe[i].stream->src.width != 0 &&
- pipe[i].stream->src.height != 0) {
- data->src_width[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->src.width);
- data->pitch_in_pixels[num_displays + 4] = data->src_width[num_displays + 4];
- data->src_height[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->src.height);
- data->h_taps[num_displays + 4] = pipe[i].stream->src.width == pipe[i].stream->dst.width ? bw_int_to_fixed(1) : bw_int_to_fixed(2);
- data->v_taps[num_displays + 4] = pipe[i].stream->src.height == pipe[i].stream->dst.height ? bw_int_to_fixed(1) : bw_int_to_fixed(2);
- data->h_scale_ratio[num_displays + 4] = bw_frc_to_fixed(pipe[i].stream->src.width, pipe[i].stream->dst.width);
- data->v_scale_ratio[num_displays + 4] = bw_frc_to_fixed(pipe[i].stream->src.height, pipe[i].stream->dst.height);
- data->rotation_angle[num_displays + 4] = bw_int_to_fixed(0);
- data->bytes_per_pixel[num_displays + 4] = 4;
- } else {
- data->src_width[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->timing.h_addressable);
- data->pitch_in_pixels[num_displays + 4] = data->src_width[num_displays + 4];
- data->src_height[num_displays + 4] = bw_int_to_fixed(pipe[i].stream->timing.v_addressable);
- data->h_taps[num_displays + 4] = bw_int_to_fixed(1);
- data->v_taps[num_displays + 4] = bw_int_to_fixed(1);
- data->h_scale_ratio[num_displays + 4] = bw_int_to_fixed(1);
- data->v_scale_ratio[num_displays + 4] = bw_int_to_fixed(1);
- data->rotation_angle[num_displays + 4] = bw_int_to_fixed(0);
- data->bytes_per_pixel[num_displays + 4] = 4;
- }
-
- data->interlace_mode[num_displays + 4] = false;
- data->stereo_mode[num_displays + 4] = bw_def_mono;
- num_displays++;
- }
-
- data->number_of_displays = num_displays;
-}
-
-static bool all_displays_in_sync(const struct pipe_ctx pipe[],
- int pipe_count)
-{
- const struct pipe_ctx *active_pipes[MAX_PIPES];
- int i, num_active_pipes = 0;
-
- for (i = 0; i < pipe_count; i++) {
- if (!resource_is_pipe_type(&pipe[i], OPP_HEAD))
- continue;
-
- active_pipes[num_active_pipes++] = &pipe[i];
- }
-
- if (!num_active_pipes)
- return false;
-
- for (i = 1; i < num_active_pipes; ++i) {
- if (!resource_are_streams_timing_synchronizable(
- active_pipes[0]->stream, active_pipes[i]->stream)) {
- return false;
- }
- }
-
- return true;
-}
-
-/*
- * Return:
- * true - Display(s) configuration supported.
- * In this case 'calcs_output' contains data for HW programming
- * false - Display(s) configuration not supported (not enough bandwidth).
- */
-bool bw_calcs(struct dc_context *ctx,
- const struct bw_calcs_dceip *dceip,
- const struct bw_calcs_vbios *vbios,
- const struct pipe_ctx pipe[],
- int pipe_count,
- struct dce_bw_output *calcs_output)
-{
- struct bw_calcs_data *data = kzalloc(sizeof(struct bw_calcs_data),
- GFP_KERNEL);
- if (!data)
- return false;
-
- populate_initial_data(pipe, pipe_count, data);
-
- if (ctx->dc->config.multi_mon_pp_mclk_switch)
- calcs_output->all_displays_in_sync = all_displays_in_sync(pipe, pipe_count);
- else
- calcs_output->all_displays_in_sync = false;
-
- if (data->number_of_displays != 0) {
- uint8_t yclk_lvl;
- struct bw_fixed high_sclk = vbios->high_sclk;
- struct bw_fixed mid1_sclk = vbios->mid1_sclk;
- struct bw_fixed mid2_sclk = vbios->mid2_sclk;
- struct bw_fixed mid3_sclk = vbios->mid3_sclk;
- struct bw_fixed mid4_sclk = vbios->mid4_sclk;
- struct bw_fixed mid5_sclk = vbios->mid5_sclk;
- struct bw_fixed mid6_sclk = vbios->mid6_sclk;
- struct bw_fixed low_sclk = vbios->low_sclk;
- struct bw_fixed high_yclk = vbios->high_yclk;
- struct bw_fixed mid_yclk = vbios->mid_yclk;
- struct bw_fixed low_yclk = vbios->low_yclk;
-
- if (ctx->dc->debug.bandwidth_calcs_trace) {
- print_bw_calcs_dceip(ctx, dceip);
- print_bw_calcs_vbios(ctx, vbios);
- print_bw_calcs_data(ctx, data);
- }
- calculate_bandwidth(dceip, vbios, data);
-
- yclk_lvl = data->y_clk_level;
-
- calcs_output->nbp_state_change_enable =
- data->nbp_state_change_enable;
- calcs_output->cpuc_state_change_enable =
- data->cpuc_state_change_enable;
- calcs_output->cpup_state_change_enable =
- data->cpup_state_change_enable;
- calcs_output->stutter_mode_enable =
- data->stutter_mode_enable;
- calcs_output->dispclk_khz =
- bw_fixed_to_int(bw_mul(data->dispclk,
- bw_int_to_fixed(1000)));
- calcs_output->blackout_recovery_time_us =
- bw_fixed_to_int(data->blackout_recovery_time);
- calcs_output->sclk_khz =
- bw_fixed_to_int(bw_mul(data->required_sclk,
- bw_int_to_fixed(1000)));
- calcs_output->sclk_deep_sleep_khz =
- bw_fixed_to_int(bw_mul(data->sclk_deep_sleep,
- bw_int_to_fixed(1000)));
- if (yclk_lvl == 0)
- calcs_output->yclk_khz = bw_fixed_to_int(
- bw_mul(low_yclk, bw_int_to_fixed(1000)));
- else if (yclk_lvl == 1)
- calcs_output->yclk_khz = bw_fixed_to_int(
- bw_mul(mid_yclk, bw_int_to_fixed(1000)));
- else
- calcs_output->yclk_khz = bw_fixed_to_int(
- bw_mul(high_yclk, bw_int_to_fixed(1000)));
-
- /* units: nanosecond, 16bit storage. */
-
- calcs_output->nbp_state_change_wm_ns[0].a_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[4], bw_int_to_fixed(1000)));
- calcs_output->nbp_state_change_wm_ns[1].a_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[5], bw_int_to_fixed(1000)));
- calcs_output->nbp_state_change_wm_ns[2].a_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[6], bw_int_to_fixed(1000)));
-
- if (ctx->dc->caps.max_slave_planes) {
- calcs_output->nbp_state_change_wm_ns[3].a_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[0], bw_int_to_fixed(1000)));
- calcs_output->nbp_state_change_wm_ns[4].a_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[1], bw_int_to_fixed(1000)));
- } else {
- calcs_output->nbp_state_change_wm_ns[3].a_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[7], bw_int_to_fixed(1000)));
- calcs_output->nbp_state_change_wm_ns[4].a_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[8], bw_int_to_fixed(1000)));
- }
- calcs_output->nbp_state_change_wm_ns[5].a_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[9], bw_int_to_fixed(1000)));
-
-
-
- calcs_output->stutter_exit_wm_ns[0].a_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[4], bw_int_to_fixed(1000)));
- calcs_output->stutter_exit_wm_ns[1].a_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[5], bw_int_to_fixed(1000)));
- calcs_output->stutter_exit_wm_ns[2].a_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[6], bw_int_to_fixed(1000)));
- if (ctx->dc->caps.max_slave_planes) {
- calcs_output->stutter_exit_wm_ns[3].a_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[0], bw_int_to_fixed(1000)));
- calcs_output->stutter_exit_wm_ns[4].a_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[1], bw_int_to_fixed(1000)));
- } else {
- calcs_output->stutter_exit_wm_ns[3].a_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[7], bw_int_to_fixed(1000)));
- calcs_output->stutter_exit_wm_ns[4].a_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[8], bw_int_to_fixed(1000)));
- }
- calcs_output->stutter_exit_wm_ns[5].a_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[9], bw_int_to_fixed(1000)));
-
- calcs_output->stutter_entry_wm_ns[0].a_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[4], bw_int_to_fixed(1000)));
- calcs_output->stutter_entry_wm_ns[1].a_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[5], bw_int_to_fixed(1000)));
- calcs_output->stutter_entry_wm_ns[2].a_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[6], bw_int_to_fixed(1000)));
- if (ctx->dc->caps.max_slave_planes) {
- calcs_output->stutter_entry_wm_ns[3].a_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[0], bw_int_to_fixed(1000)));
- calcs_output->stutter_entry_wm_ns[4].a_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[1], bw_int_to_fixed(1000)));
- } else {
- calcs_output->stutter_entry_wm_ns[3].a_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[7], bw_int_to_fixed(1000)));
- calcs_output->stutter_entry_wm_ns[4].a_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[8], bw_int_to_fixed(1000)));
- }
- calcs_output->stutter_entry_wm_ns[5].a_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[9], bw_int_to_fixed(1000)));
-
- calcs_output->urgent_wm_ns[0].a_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[4], bw_int_to_fixed(1000)));
- calcs_output->urgent_wm_ns[1].a_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[5], bw_int_to_fixed(1000)));
- calcs_output->urgent_wm_ns[2].a_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[6], bw_int_to_fixed(1000)));
- if (ctx->dc->caps.max_slave_planes) {
- calcs_output->urgent_wm_ns[3].a_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[0], bw_int_to_fixed(1000)));
- calcs_output->urgent_wm_ns[4].a_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[1], bw_int_to_fixed(1000)));
- } else {
- calcs_output->urgent_wm_ns[3].a_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[7], bw_int_to_fixed(1000)));
- calcs_output->urgent_wm_ns[4].a_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[8], bw_int_to_fixed(1000)));
- }
- calcs_output->urgent_wm_ns[5].a_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[9], bw_int_to_fixed(1000)));
-
- if (dceip->version != BW_CALCS_VERSION_CARRIZO) {
- ((struct bw_calcs_vbios *)vbios)->low_sclk = mid3_sclk;
- ((struct bw_calcs_vbios *)vbios)->mid1_sclk = mid3_sclk;
- ((struct bw_calcs_vbios *)vbios)->mid2_sclk = mid3_sclk;
- calculate_bandwidth(dceip, vbios, data);
-
- calcs_output->nbp_state_change_wm_ns[0].b_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[4],bw_int_to_fixed(1000)));
- calcs_output->nbp_state_change_wm_ns[1].b_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[5], bw_int_to_fixed(1000)));
- calcs_output->nbp_state_change_wm_ns[2].b_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[6], bw_int_to_fixed(1000)));
-
- if (ctx->dc->caps.max_slave_planes) {
- calcs_output->nbp_state_change_wm_ns[3].b_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[0], bw_int_to_fixed(1000)));
- calcs_output->nbp_state_change_wm_ns[4].b_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[1], bw_int_to_fixed(1000)));
- } else {
- calcs_output->nbp_state_change_wm_ns[3].b_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[7], bw_int_to_fixed(1000)));
- calcs_output->nbp_state_change_wm_ns[4].b_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[8], bw_int_to_fixed(1000)));
- }
- calcs_output->nbp_state_change_wm_ns[5].b_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[9], bw_int_to_fixed(1000)));
-
-
-
- calcs_output->stutter_exit_wm_ns[0].b_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[4], bw_int_to_fixed(1000)));
- calcs_output->stutter_exit_wm_ns[1].b_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[5], bw_int_to_fixed(1000)));
- calcs_output->stutter_exit_wm_ns[2].b_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[6], bw_int_to_fixed(1000)));
- if (ctx->dc->caps.max_slave_planes) {
- calcs_output->stutter_exit_wm_ns[3].b_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[0], bw_int_to_fixed(1000)));
- calcs_output->stutter_exit_wm_ns[4].b_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[1], bw_int_to_fixed(1000)));
- } else {
- calcs_output->stutter_exit_wm_ns[3].b_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[7], bw_int_to_fixed(1000)));
- calcs_output->stutter_exit_wm_ns[4].b_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[8], bw_int_to_fixed(1000)));
- }
- calcs_output->stutter_exit_wm_ns[5].b_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[9], bw_int_to_fixed(1000)));
-
- calcs_output->stutter_entry_wm_ns[0].b_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[4], bw_int_to_fixed(1000)));
- calcs_output->stutter_entry_wm_ns[1].b_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[5], bw_int_to_fixed(1000)));
- calcs_output->stutter_entry_wm_ns[2].b_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[6], bw_int_to_fixed(1000)));
- if (ctx->dc->caps.max_slave_planes) {
- calcs_output->stutter_entry_wm_ns[3].b_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[0], bw_int_to_fixed(1000)));
- calcs_output->stutter_entry_wm_ns[4].b_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[1], bw_int_to_fixed(1000)));
- } else {
- calcs_output->stutter_entry_wm_ns[3].b_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[7], bw_int_to_fixed(1000)));
- calcs_output->stutter_entry_wm_ns[4].b_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[8], bw_int_to_fixed(1000)));
- }
- calcs_output->stutter_entry_wm_ns[5].b_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[9], bw_int_to_fixed(1000)));
-
- calcs_output->urgent_wm_ns[0].b_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[4], bw_int_to_fixed(1000)));
- calcs_output->urgent_wm_ns[1].b_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[5], bw_int_to_fixed(1000)));
- calcs_output->urgent_wm_ns[2].b_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[6], bw_int_to_fixed(1000)));
- if (ctx->dc->caps.max_slave_planes) {
- calcs_output->urgent_wm_ns[3].b_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[0], bw_int_to_fixed(1000)));
- calcs_output->urgent_wm_ns[4].b_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[1], bw_int_to_fixed(1000)));
- } else {
- calcs_output->urgent_wm_ns[3].b_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[7], bw_int_to_fixed(1000)));
- calcs_output->urgent_wm_ns[4].b_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[8], bw_int_to_fixed(1000)));
- }
- calcs_output->urgent_wm_ns[5].b_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[9], bw_int_to_fixed(1000)));
-
- ((struct bw_calcs_vbios *)vbios)->low_sclk = low_sclk;
- ((struct bw_calcs_vbios *)vbios)->mid1_sclk = mid1_sclk;
- ((struct bw_calcs_vbios *)vbios)->mid2_sclk = mid2_sclk;
- ((struct bw_calcs_vbios *)vbios)->low_yclk = mid_yclk;
- calculate_bandwidth(dceip, vbios, data);
-
- calcs_output->nbp_state_change_wm_ns[0].c_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[4], bw_int_to_fixed(1000)));
- calcs_output->nbp_state_change_wm_ns[1].c_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[5], bw_int_to_fixed(1000)));
- calcs_output->nbp_state_change_wm_ns[2].c_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[6], bw_int_to_fixed(1000)));
- if (ctx->dc->caps.max_slave_planes) {
- calcs_output->nbp_state_change_wm_ns[3].c_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[0], bw_int_to_fixed(1000)));
- calcs_output->nbp_state_change_wm_ns[4].c_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[1], bw_int_to_fixed(1000)));
- } else {
- calcs_output->nbp_state_change_wm_ns[3].c_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[7], bw_int_to_fixed(1000)));
- calcs_output->nbp_state_change_wm_ns[4].c_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[8], bw_int_to_fixed(1000)));
- }
- calcs_output->nbp_state_change_wm_ns[5].c_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[9], bw_int_to_fixed(1000)));
-
-
- calcs_output->stutter_exit_wm_ns[0].c_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[4], bw_int_to_fixed(1000)));
- calcs_output->stutter_exit_wm_ns[1].c_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[5], bw_int_to_fixed(1000)));
- calcs_output->stutter_exit_wm_ns[2].c_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[6], bw_int_to_fixed(1000)));
- if (ctx->dc->caps.max_slave_planes) {
- calcs_output->stutter_exit_wm_ns[3].c_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[0], bw_int_to_fixed(1000)));
- calcs_output->stutter_exit_wm_ns[4].c_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[1], bw_int_to_fixed(1000)));
- } else {
- calcs_output->stutter_exit_wm_ns[3].c_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[7], bw_int_to_fixed(1000)));
- calcs_output->stutter_exit_wm_ns[4].c_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[8], bw_int_to_fixed(1000)));
- }
- calcs_output->stutter_exit_wm_ns[5].c_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[9], bw_int_to_fixed(1000)));
- calcs_output->stutter_entry_wm_ns[0].c_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[4], bw_int_to_fixed(1000)));
- calcs_output->stutter_entry_wm_ns[1].c_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[5], bw_int_to_fixed(1000)));
- calcs_output->stutter_entry_wm_ns[2].c_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[6], bw_int_to_fixed(1000)));
- if (ctx->dc->caps.max_slave_planes) {
- calcs_output->stutter_entry_wm_ns[3].c_mark =
- bw_fixed_to_int(bw_mul(data->stutter_entry_watermark[0],
- bw_int_to_fixed(1000)));
- calcs_output->stutter_entry_wm_ns[4].c_mark =
- bw_fixed_to_int(bw_mul(data->stutter_entry_watermark[1],
- bw_int_to_fixed(1000)));
- } else {
- calcs_output->stutter_entry_wm_ns[3].c_mark =
- bw_fixed_to_int(bw_mul(data->stutter_entry_watermark[7],
- bw_int_to_fixed(1000)));
- calcs_output->stutter_entry_wm_ns[4].c_mark =
- bw_fixed_to_int(bw_mul(data->stutter_entry_watermark[8],
- bw_int_to_fixed(1000)));
- }
- calcs_output->stutter_entry_wm_ns[5].c_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[9], bw_int_to_fixed(1000)));
- calcs_output->urgent_wm_ns[0].c_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[4], bw_int_to_fixed(1000)));
- calcs_output->urgent_wm_ns[1].c_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[5], bw_int_to_fixed(1000)));
- calcs_output->urgent_wm_ns[2].c_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[6], bw_int_to_fixed(1000)));
- if (ctx->dc->caps.max_slave_planes) {
- calcs_output->urgent_wm_ns[3].c_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[0], bw_int_to_fixed(1000)));
- calcs_output->urgent_wm_ns[4].c_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[1], bw_int_to_fixed(1000)));
- } else {
- calcs_output->urgent_wm_ns[3].c_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[7], bw_int_to_fixed(1000)));
- calcs_output->urgent_wm_ns[4].c_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[8], bw_int_to_fixed(1000)));
- }
- calcs_output->urgent_wm_ns[5].c_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[9], bw_int_to_fixed(1000)));
- }
-
- if (dceip->version == BW_CALCS_VERSION_CARRIZO) {
- ((struct bw_calcs_vbios *)vbios)->low_yclk = high_yclk;
- ((struct bw_calcs_vbios *)vbios)->mid_yclk = high_yclk;
- ((struct bw_calcs_vbios *)vbios)->low_sclk = high_sclk;
- ((struct bw_calcs_vbios *)vbios)->mid1_sclk = high_sclk;
- ((struct bw_calcs_vbios *)vbios)->mid2_sclk = high_sclk;
- ((struct bw_calcs_vbios *)vbios)->mid3_sclk = high_sclk;
- ((struct bw_calcs_vbios *)vbios)->mid4_sclk = high_sclk;
- ((struct bw_calcs_vbios *)vbios)->mid5_sclk = high_sclk;
- ((struct bw_calcs_vbios *)vbios)->mid6_sclk = high_sclk;
- } else {
- ((struct bw_calcs_vbios *)vbios)->low_yclk = mid_yclk;
- ((struct bw_calcs_vbios *)vbios)->low_sclk = mid3_sclk;
- ((struct bw_calcs_vbios *)vbios)->mid1_sclk = mid3_sclk;
- ((struct bw_calcs_vbios *)vbios)->mid2_sclk = mid3_sclk;
- }
-
- calculate_bandwidth(dceip, vbios, data);
-
- calcs_output->nbp_state_change_wm_ns[0].d_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[4], bw_int_to_fixed(1000)));
- calcs_output->nbp_state_change_wm_ns[1].d_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[5], bw_int_to_fixed(1000)));
- calcs_output->nbp_state_change_wm_ns[2].d_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[6], bw_int_to_fixed(1000)));
- if (ctx->dc->caps.max_slave_planes) {
- calcs_output->nbp_state_change_wm_ns[3].d_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[0], bw_int_to_fixed(1000)));
- calcs_output->nbp_state_change_wm_ns[4].d_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[1], bw_int_to_fixed(1000)));
- } else {
- calcs_output->nbp_state_change_wm_ns[3].d_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[7], bw_int_to_fixed(1000)));
- calcs_output->nbp_state_change_wm_ns[4].d_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[8], bw_int_to_fixed(1000)));
- }
- calcs_output->nbp_state_change_wm_ns[5].d_mark =
- bw_fixed_to_int(bw_mul(data->
- nbp_state_change_watermark[9], bw_int_to_fixed(1000)));
-
- calcs_output->stutter_exit_wm_ns[0].d_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[4], bw_int_to_fixed(1000)));
- calcs_output->stutter_exit_wm_ns[1].d_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[5], bw_int_to_fixed(1000)));
- calcs_output->stutter_exit_wm_ns[2].d_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[6], bw_int_to_fixed(1000)));
- if (ctx->dc->caps.max_slave_planes) {
- calcs_output->stutter_exit_wm_ns[3].d_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[0], bw_int_to_fixed(1000)));
- calcs_output->stutter_exit_wm_ns[4].d_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[1], bw_int_to_fixed(1000)));
- } else {
- calcs_output->stutter_exit_wm_ns[3].d_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[7], bw_int_to_fixed(1000)));
- calcs_output->stutter_exit_wm_ns[4].d_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[8], bw_int_to_fixed(1000)));
- }
- calcs_output->stutter_exit_wm_ns[5].d_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_exit_watermark[9], bw_int_to_fixed(1000)));
-
- calcs_output->stutter_entry_wm_ns[0].d_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[4], bw_int_to_fixed(1000)));
- calcs_output->stutter_entry_wm_ns[1].d_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[5], bw_int_to_fixed(1000)));
- calcs_output->stutter_entry_wm_ns[2].d_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[6], bw_int_to_fixed(1000)));
- if (ctx->dc->caps.max_slave_planes) {
- calcs_output->stutter_entry_wm_ns[3].d_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[0], bw_int_to_fixed(1000)));
- calcs_output->stutter_entry_wm_ns[4].d_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[1], bw_int_to_fixed(1000)));
- } else {
- calcs_output->stutter_entry_wm_ns[3].d_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[7], bw_int_to_fixed(1000)));
- calcs_output->stutter_entry_wm_ns[4].d_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[8], bw_int_to_fixed(1000)));
- }
- calcs_output->stutter_entry_wm_ns[5].d_mark =
- bw_fixed_to_int(bw_mul(data->
- stutter_entry_watermark[9], bw_int_to_fixed(1000)));
-
- calcs_output->urgent_wm_ns[0].d_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[4], bw_int_to_fixed(1000)));
- calcs_output->urgent_wm_ns[1].d_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[5], bw_int_to_fixed(1000)));
- calcs_output->urgent_wm_ns[2].d_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[6], bw_int_to_fixed(1000)));
- if (ctx->dc->caps.max_slave_planes) {
- calcs_output->urgent_wm_ns[3].d_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[0], bw_int_to_fixed(1000)));
- calcs_output->urgent_wm_ns[4].d_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[1], bw_int_to_fixed(1000)));
- } else {
- calcs_output->urgent_wm_ns[3].d_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[7], bw_int_to_fixed(1000)));
- calcs_output->urgent_wm_ns[4].d_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[8], bw_int_to_fixed(1000)));
- }
- calcs_output->urgent_wm_ns[5].d_mark =
- bw_fixed_to_int(bw_mul(data->
- urgent_watermark[9], bw_int_to_fixed(1000)));
-
- ((struct bw_calcs_vbios *)vbios)->low_yclk = low_yclk;
- ((struct bw_calcs_vbios *)vbios)->mid_yclk = mid_yclk;
- ((struct bw_calcs_vbios *)vbios)->low_sclk = low_sclk;
- ((struct bw_calcs_vbios *)vbios)->mid1_sclk = mid1_sclk;
- ((struct bw_calcs_vbios *)vbios)->mid2_sclk = mid2_sclk;
- ((struct bw_calcs_vbios *)vbios)->mid3_sclk = mid3_sclk;
- ((struct bw_calcs_vbios *)vbios)->mid4_sclk = mid4_sclk;
- ((struct bw_calcs_vbios *)vbios)->mid5_sclk = mid5_sclk;
- ((struct bw_calcs_vbios *)vbios)->mid6_sclk = mid6_sclk;
- ((struct bw_calcs_vbios *)vbios)->high_sclk = high_sclk;
- } else {
- calcs_output->nbp_state_change_enable = true;
- calcs_output->cpuc_state_change_enable = true;
- calcs_output->cpup_state_change_enable = true;
- calcs_output->stutter_mode_enable = true;
- calcs_output->dispclk_khz = 0;
- calcs_output->sclk_khz = 0;
- }
-
- kfree(data);
-
- return is_display_configuration_supported(vbios, calcs_output);
-}
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c b/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c
index 8a5a038fd..d2271e308 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c
@@ -34,6 +34,8 @@
#include "link.h"
#include "dcn20_fpu.h"
+#define DC_LOGGER \
+ dc->ctx->logger
#define DC_LOGGER_INIT(logger)
#ifndef MAX
@@ -1405,11 +1407,11 @@ int dcn20_populate_dml_pipes_from_context(struct dc *dc,
pipes[pipe_cnt].dout.is_virtual = 0;
pipes[pipe_cnt].pipe.dest.vtotal_min = res_ctx->pipe_ctx[i].stream->adjust.v_total_min;
pipes[pipe_cnt].pipe.dest.vtotal_max = res_ctx->pipe_ctx[i].stream->adjust.v_total_max;
- switch (resource_get_num_odm_splits(&res_ctx->pipe_ctx[i])) {
- case 1:
+ switch (resource_get_odm_slice_count(&res_ctx->pipe_ctx[i])) {
+ case 2:
pipes[pipe_cnt].pipe.dest.odm_combine = dm_odm_combine_mode_2to1;
break;
- case 3:
+ case 4:
pipes[pipe_cnt].pipe.dest.odm_combine = dm_odm_combine_mode_4to1;
break;
default:
@@ -2018,7 +2020,7 @@ void dcn20_patch_bounding_box(struct dc *dc, struct _vcs_dpi_soc_bounding_box_st
}
static bool dcn20_validate_bandwidth_internal(struct dc *dc, struct dc_state *context,
- bool fast_validate)
+ bool fast_validate, display_e2e_pipe_params_st *pipes)
{
bool out = false;
@@ -2027,7 +2029,6 @@ static bool dcn20_validate_bandwidth_internal(struct dc *dc, struct dc_state *co
int vlevel = 0;
int pipe_split_from[MAX_PIPES];
int pipe_cnt = 0;
- display_e2e_pipe_params_st *pipes = kzalloc(dc->res_pool->pipe_count * sizeof(display_e2e_pipe_params_st), GFP_ATOMIC);
DC_LOGGER_INIT(dc->ctx->logger);
BW_VAL_TRACE_COUNT();
@@ -2062,16 +2063,14 @@ validate_fail:
out = false;
validate_out:
- kfree(pipes);
BW_VAL_TRACE_FINISH();
return out;
}
-bool dcn20_validate_bandwidth_fp(struct dc *dc,
- struct dc_state *context,
- bool fast_validate)
+bool dcn20_validate_bandwidth_fp(struct dc *dc, struct dc_state *context,
+ bool fast_validate, display_e2e_pipe_params_st *pipes)
{
bool voltage_supported = false;
bool full_pstate_supported = false;
@@ -2090,11 +2089,11 @@ bool dcn20_validate_bandwidth_fp(struct dc *dc,
ASSERT(context != dc->current_state);
if (fast_validate) {
- return dcn20_validate_bandwidth_internal(dc, context, true);
+ return dcn20_validate_bandwidth_internal(dc, context, true, pipes);
}
// Best case, we support full UCLK switch latency
- voltage_supported = dcn20_validate_bandwidth_internal(dc, context, false);
+ voltage_supported = dcn20_validate_bandwidth_internal(dc, context, false, pipes);
full_pstate_supported = context->bw_ctx.bw.dcn.clk.p_state_change_support;
if (context->bw_ctx.dml.soc.dummy_pstate_latency_us == 0 ||
@@ -2106,7 +2105,8 @@ bool dcn20_validate_bandwidth_fp(struct dc *dc,
// Fallback: Try to only support G6 temperature read latency
context->bw_ctx.dml.soc.dram_clock_change_latency_us = context->bw_ctx.dml.soc.dummy_pstate_latency_us;
- voltage_supported = dcn20_validate_bandwidth_internal(dc, context, false);
+ memset(pipes, 0, dc->res_pool->pipe_count * sizeof(display_e2e_pipe_params_st));
+ voltage_supported = dcn20_validate_bandwidth_internal(dc, context, false, pipes);
dummy_pstate_supported = context->bw_ctx.bw.dcn.clk.p_state_change_support;
if (voltage_supported && (dummy_pstate_supported || !(context->stream_count))) {
@@ -2311,9 +2311,8 @@ static void dcn21_calculate_wm(struct dc *dc, struct dc_state *context,
&context->bw_ctx.dml, pipes, pipe_cnt);
}
-bool dcn21_validate_bandwidth_fp(struct dc *dc,
- struct dc_state *context,
- bool fast_validate)
+bool dcn21_validate_bandwidth_fp(struct dc *dc, struct dc_state *context,
+ bool fast_validate, display_e2e_pipe_params_st *pipes)
{
bool out = false;
@@ -2322,7 +2321,6 @@ bool dcn21_validate_bandwidth_fp(struct dc *dc,
int vlevel = 0;
int pipe_split_from[MAX_PIPES];
int pipe_cnt = 0;
- display_e2e_pipe_params_st *pipes = kzalloc(dc->res_pool->pipe_count * sizeof(display_e2e_pipe_params_st), GFP_ATOMIC);
DC_LOGGER_INIT(dc->ctx->logger);
BW_VAL_TRACE_COUNT();
@@ -2362,7 +2360,6 @@ validate_fail:
out = false;
validate_out:
- kfree(pipes);
BW_VAL_TRACE_FINISH();
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.h b/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.h
index c51badf7b..b6c34198d 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.h
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.h
@@ -61,9 +61,8 @@ void dcn20_update_bounding_box(struct dc *dc,
unsigned int num_states);
void dcn20_patch_bounding_box(struct dc *dc,
struct _vcs_dpi_soc_bounding_box_st *bb);
-bool dcn20_validate_bandwidth_fp(struct dc *dc,
- struct dc_state *context,
- bool fast_validate);
+bool dcn20_validate_bandwidth_fp(struct dc *dc, struct dc_state *context,
+ bool fast_validate, display_e2e_pipe_params_st *pipes);
void dcn20_fpu_set_wm_ranges(int i,
struct pp_smu_wm_range_sets *ranges,
struct _vcs_dpi_soc_bounding_box_st *loaded_bb);
@@ -77,9 +76,8 @@ int dcn21_populate_dml_pipes_from_context(struct dc *dc,
struct dc_state *context,
display_e2e_pipe_params_st *pipes,
bool fast_validate);
-bool dcn21_validate_bandwidth_fp(struct dc *dc,
- struct dc_state *context,
- bool fast_validate);
+bool dcn21_validate_bandwidth_fp(struct dc *dc, struct dc_state *context, bool
+ fast_validate, display_e2e_pipe_params_st *pipes);
void dcn21_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_params);
void dcn21_clk_mgr_set_bw_params_wm_table(struct clk_bw_params *bw_params);
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
index ad741a723..3686f1e7d 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
@@ -5128,7 +5128,7 @@ void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
ViewportExceedsSurface = true;
if (v->SourcePixelFormat[k] != dm_444_64 && v->SourcePixelFormat[k] != dm_444_32 && v->SourcePixelFormat[k] != dm_444_16
- && v->SourcePixelFormat[k] != dm_444_16 && v->SourcePixelFormat[k] != dm_444_8 && v->SourcePixelFormat[k] != dm_rgbe) {
+ && v->SourcePixelFormat[k] != dm_444_8 && v->SourcePixelFormat[k] != dm_rgbe) {
if (v->ViewportWidthChroma[k] > v->SurfaceWidthC[k] || v->ViewportHeightChroma[k] > v->SurfaceHeightC[k]) {
ViewportExceedsSurface = true;
}
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
index a94aa0f21..88e56889a 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
@@ -2311,6 +2311,7 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
v->OutputFormat[k],
v->Output[k]) + dscComputeDelay(v->OutputFormat[k], v->Output[k]));
}
+ v->DSCDelay[k] = v->DSCDelay[k] + (v->HTotal[k] - v->HActive[k]) * dml_ceil((double) v->DSCDelay[k] / v->HActive[k], 1);
v->DSCDelay[k] = v->DSCDelay[k] * v->PixelClock[k] / v->PixelClockBackEnd[k];
} else {
v->DSCDelay[k] = 0;
@@ -4719,6 +4720,7 @@ void dml314_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
v->OutputFormat[k],
v->Output[k]) + dscComputeDelay(v->OutputFormat[k], v->Output[k]));
}
+ v->DSCDelayPerState[i][k] = v->DSCDelayPerState[i][k] + (v->HTotal[k] - v->HActive[k]) * dml_ceil((double) v->DSCDelayPerState[i][k] / v->HActive[k], 1.0);
v->DSCDelayPerState[i][k] = v->DSCDelayPerState[i][k] * v->PixelClock[k] / v->PixelClockBackEnd[k];
} else {
v->DSCDelayPerState[i][k] = 0.0;
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c b/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c
index cf3b400c8..fe2b67d74 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c
@@ -41,7 +41,8 @@ static const struct subvp_high_refresh_list subvp_high_refresh_list = {
.res = {
{.width = 3840, .height = 2160, },
{.width = 3440, .height = 1440, },
- {.width = 2560, .height = 1440, }},
+ {.width = 2560, .height = 1440, },
+ {.width = 1920, .height = 1080, }},
};
struct _vcs_dpi_ip_params_st dcn3_2_ip = {
@@ -347,90 +348,6 @@ void dcn32_helper_populate_phantom_dlg_params(struct dc *dc,
}
}
-/**
- * dcn32_predict_pipe_split - Predict if pipe split will occur for a given DML pipe
- * @context: [in] New DC state to be programmed
- * @pipe_e2e: [in] DML pipe end to end context
- *
- * This function takes in a DML pipe (pipe_e2e) and predicts if pipe split is required (both
- * ODM and MPC). For pipe split, ODM combine is determined by the ODM mode, and MPC combine is
- * determined by DPPClk requirements
- *
- * This function follows the same policy as DML:
- * - Check for ODM combine requirements / policy first
- * - MPC combine is only chosen if there is no ODM combine requirements / policy in place, and
- * MPC is required
- *
- * Return: Number of splits expected (1 for 2:1 split, 3 for 4:1 split, 0 for no splits).
- */
-uint8_t dcn32_predict_pipe_split(struct dc_state *context,
- display_e2e_pipe_params_st *pipe_e2e)
-{
- double pscl_throughput;
- double pscl_throughput_chroma;
- double dpp_clk_single_dpp, clock;
- double clk_frequency = 0.0;
- double vco_speed = context->bw_ctx.dml.soc.dispclk_dppclk_vco_speed_mhz;
- bool total_available_pipes_support = false;
- uint32_t number_of_dpp = 0;
- enum odm_combine_mode odm_mode = dm_odm_combine_mode_disabled;
- double req_dispclk_per_surface = 0;
- uint8_t num_splits = 0;
-
- dc_assert_fp_enabled();
-
- dml32_CalculateODMMode(context->bw_ctx.dml.ip.maximum_pixels_per_line_per_dsc_unit,
- pipe_e2e->pipe.dest.hactive,
- pipe_e2e->dout.output_format,
- pipe_e2e->dout.output_type,
- pipe_e2e->pipe.dest.odm_combine_policy,
- context->bw_ctx.dml.soc.clock_limits[context->bw_ctx.dml.soc.num_states - 1].dispclk_mhz,
- context->bw_ctx.dml.soc.clock_limits[context->bw_ctx.dml.soc.num_states - 1].dispclk_mhz,
- pipe_e2e->dout.dsc_enable != 0,
- 0, /* TotalNumberOfActiveDPP can be 0 since we're predicting pipe split requirement */
- context->bw_ctx.dml.ip.max_num_dpp,
- pipe_e2e->pipe.dest.pixel_rate_mhz,
- context->bw_ctx.dml.soc.dcn_downspread_percent,
- context->bw_ctx.dml.ip.dispclk_ramp_margin_percent,
- context->bw_ctx.dml.soc.dispclk_dppclk_vco_speed_mhz,
- pipe_e2e->dout.dsc_slices,
- /* Output */
- &total_available_pipes_support,
- &number_of_dpp,
- &odm_mode,
- &req_dispclk_per_surface);
-
- dml32_CalculateSinglePipeDPPCLKAndSCLThroughput(pipe_e2e->pipe.scale_ratio_depth.hscl_ratio,
- pipe_e2e->pipe.scale_ratio_depth.hscl_ratio_c,
- pipe_e2e->pipe.scale_ratio_depth.vscl_ratio,
- pipe_e2e->pipe.scale_ratio_depth.vscl_ratio_c,
- context->bw_ctx.dml.ip.max_dchub_pscl_bw_pix_per_clk,
- context->bw_ctx.dml.ip.max_pscl_lb_bw_pix_per_clk,
- pipe_e2e->pipe.dest.pixel_rate_mhz,
- pipe_e2e->pipe.src.source_format,
- pipe_e2e->pipe.scale_taps.htaps,
- pipe_e2e->pipe.scale_taps.htaps_c,
- pipe_e2e->pipe.scale_taps.vtaps,
- pipe_e2e->pipe.scale_taps.vtaps_c,
- /* Output */
- &pscl_throughput, &pscl_throughput_chroma,
- &dpp_clk_single_dpp);
-
- clock = dpp_clk_single_dpp * (1 + context->bw_ctx.dml.soc.dcn_downspread_percent / 100);
-
- if (clock > 0)
- clk_frequency = vco_speed * 4.0 / ((int)(vco_speed * 4.0) / clock);
-
- if (odm_mode == dm_odm_combine_mode_2to1)
- num_splits = 1;
- else if (odm_mode == dm_odm_combine_mode_4to1)
- num_splits = 3;
- else if (clk_frequency > context->bw_ctx.dml.soc.clock_limits[context->bw_ctx.dml.soc.num_states - 1].dppclk_mhz)
- num_splits = 1;
-
- return num_splits;
-}
-
static float calculate_net_bw_in_kbytes_sec(struct _vcs_dpi_voltage_scaling_st *entry)
{
float memory_bw_kbytes_sec;
@@ -905,7 +822,7 @@ static bool subvp_drr_schedulable(struct dc *dc, struct dc_state *context)
continue;
if (drr_pipe->stream->mall_stream_config.type == SUBVP_NONE && drr_pipe->stream->ignore_msa_timing_param &&
- (drr_pipe->stream->allow_freesync || drr_pipe->stream->vrr_active_variable))
+ (drr_pipe->stream->allow_freesync || drr_pipe->stream->vrr_active_variable || drr_pipe->stream->vrr_active_fixed))
break;
}
@@ -1144,6 +1061,341 @@ static bool subvp_validate_static_schedulability(struct dc *dc,
return schedulable;
}
+static void assign_subvp_index(struct dc *dc, struct dc_state *context)
+{
+ int i;
+ int index = 0;
+
+ for (i = 0; i < dc->res_pool->pipe_count; i++) {
+ struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
+
+ if (resource_is_pipe_type(pipe_ctx, OTG_MASTER) &&
+ pipe_ctx->stream->mall_stream_config.type == SUBVP_MAIN) {
+ pipe_ctx->subvp_index = index++;
+ } else {
+ pipe_ctx->subvp_index = 0;
+ }
+ }
+}
+
+struct pipe_slice_table {
+ struct {
+ struct dc_stream_state *stream;
+ int slice_count;
+ } odm_combines[MAX_STREAMS];
+ int odm_combine_count;
+
+ struct {
+ struct pipe_ctx *pri_pipe;
+ struct dc_plane_state *plane;
+ int slice_count;
+ } mpc_combines[MAX_PLANES];
+ int mpc_combine_count;
+};
+
+
+static void update_slice_table_for_stream(struct pipe_slice_table *table,
+ struct dc_stream_state *stream, int diff)
+{
+ int i;
+
+ for (i = 0; i < table->odm_combine_count; i++) {
+ if (table->odm_combines[i].stream == stream) {
+ table->odm_combines[i].slice_count += diff;
+ break;
+ }
+ }
+
+ if (i == table->odm_combine_count) {
+ table->odm_combine_count++;
+ table->odm_combines[i].stream = stream;
+ table->odm_combines[i].slice_count = diff;
+ }
+}
+
+static void update_slice_table_for_plane(struct pipe_slice_table *table,
+ struct pipe_ctx *dpp_pipe, struct dc_plane_state *plane, int diff)
+{
+ int i;
+ struct pipe_ctx *pri_dpp_pipe = resource_get_primary_dpp_pipe(dpp_pipe);
+
+ for (i = 0; i < table->mpc_combine_count; i++) {
+ if (table->mpc_combines[i].plane == plane &&
+ table->mpc_combines[i].pri_pipe == pri_dpp_pipe) {
+ table->mpc_combines[i].slice_count += diff;
+ break;
+ }
+ }
+
+ if (i == table->mpc_combine_count) {
+ table->mpc_combine_count++;
+ table->mpc_combines[i].plane = plane;
+ table->mpc_combines[i].pri_pipe = pri_dpp_pipe;
+ table->mpc_combines[i].slice_count = diff;
+ }
+}
+
+static void init_pipe_slice_table_from_context(
+ struct pipe_slice_table *table,
+ struct dc_state *context)
+{
+ int i, j;
+ struct pipe_ctx *otg_master;
+ struct pipe_ctx *dpp_pipes[MAX_PIPES];
+ struct dc_stream_state *stream;
+ int count;
+
+ memset(table, 0, sizeof(*table));
+
+ for (i = 0; i < context->stream_count; i++) {
+ stream = context->streams[i];
+ otg_master = resource_get_otg_master_for_stream(
+ &context->res_ctx, stream);
+ count = resource_get_odm_slice_count(otg_master);
+ update_slice_table_for_stream(table, stream, count);
+
+ count = resource_get_dpp_pipes_for_opp_head(otg_master,
+ &context->res_ctx, dpp_pipes);
+ for (j = 0; j < count; j++)
+ if (dpp_pipes[j]->plane_state)
+ update_slice_table_for_plane(table, dpp_pipes[j],
+ dpp_pipes[j]->plane_state, 1);
+ }
+}
+
+static bool update_pipe_slice_table_with_split_flags(
+ struct pipe_slice_table *table,
+ struct dc *dc,
+ struct dc_state *context,
+ struct vba_vars_st *vba,
+ int split[MAX_PIPES],
+ bool merge[MAX_PIPES])
+{
+ /* NOTE: we are deprecating the support for the concept of pipe splitting
+ * or pipe merging. Instead we append slices to the end and remove
+ * slices from the end. The following code converts a pipe split or
+ * merge to an append or remove operation.
+ *
+ * For example:
+ * When split flags describe the following pipe connection transition
+ *
+ * from:
+ * pipe 0 (split=2) -> pipe 1 (split=2)
+ * to: (old behavior)
+ * pipe 0 -> pipe 2 -> pipe 1 -> pipe 3
+ *
+ * the code below actually does:
+ * pipe 0 -> pipe 1 -> pipe 2 -> pipe 3
+ *
+ * This is the new intended behavior and for future DCNs we will retire
+ * the old concept completely.
+ */
+ struct pipe_ctx *pipe;
+ bool odm;
+ int dc_pipe_idx, dml_pipe_idx = 0;
+ bool updated = false;
+
+ for (dc_pipe_idx = 0;
+ dc_pipe_idx < dc->res_pool->pipe_count; dc_pipe_idx++) {
+ pipe = &context->res_ctx.pipe_ctx[dc_pipe_idx];
+ if (resource_is_pipe_type(pipe, FREE_PIPE))
+ continue;
+
+ if (merge[dc_pipe_idx]) {
+ if (resource_is_pipe_type(pipe, OPP_HEAD))
+ /* merging OPP head means reducing ODM slice
+ * count by 1
+ */
+ update_slice_table_for_stream(table, pipe->stream, -1);
+ else if (resource_is_pipe_type(pipe, DPP_PIPE) &&
+ resource_get_odm_slice_index(resource_get_opp_head(pipe)) == 0)
+ /* merging DPP pipe of the first ODM slice means
+ * reducing MPC slice count by 1
+ */
+ update_slice_table_for_plane(table, pipe, pipe->plane_state, -1);
+ updated = true;
+ }
+
+ if (split[dc_pipe_idx]) {
+ odm = vba->ODMCombineEnabled[vba->pipe_plane[dml_pipe_idx]] !=
+ dm_odm_combine_mode_disabled;
+ if (odm && resource_is_pipe_type(pipe, OPP_HEAD))
+ update_slice_table_for_stream(
+ table, pipe->stream, split[dc_pipe_idx] - 1);
+ else if (!odm && resource_is_pipe_type(pipe, DPP_PIPE))
+ update_slice_table_for_plane(table, pipe,
+ pipe->plane_state, split[dc_pipe_idx] - 1);
+ updated = true;
+ }
+ dml_pipe_idx++;
+ }
+ return updated;
+}
+
+static void update_pipes_with_slice_table(struct dc *dc, struct dc_state *context,
+ struct pipe_slice_table *table)
+{
+ int i;
+
+ for (i = 0; i < table->odm_combine_count; i++)
+ resource_update_pipes_for_stream_with_slice_count(context,
+ dc->current_state, dc->res_pool,
+ table->odm_combines[i].stream,
+ table->odm_combines[i].slice_count);
+
+ for (i = 0; i < table->mpc_combine_count; i++)
+ resource_update_pipes_for_plane_with_slice_count(context,
+ dc->current_state, dc->res_pool,
+ table->mpc_combines[i].plane,
+ table->mpc_combines[i].slice_count);
+}
+
+static bool update_pipes_with_split_flags(struct dc *dc, struct dc_state *context,
+ struct vba_vars_st *vba, int split[MAX_PIPES],
+ bool merge[MAX_PIPES])
+{
+ struct pipe_slice_table slice_table;
+ bool updated;
+
+ init_pipe_slice_table_from_context(&slice_table, context);
+ updated = update_pipe_slice_table_with_split_flags(
+ &slice_table, dc, context, vba,
+ split, merge);
+ update_pipes_with_slice_table(dc, context, &slice_table);
+ return updated;
+}
+
+static bool should_allow_odm_power_optimization(struct dc *dc,
+ struct dc_state *context, struct vba_vars_st *v, int *split,
+ bool *merge)
+{
+ struct dc_stream_state *stream = context->streams[0];
+ struct pipe_slice_table slice_table;
+ int i;
+
+ /*
+ * this debug flag allows us to disable ODM power optimization feature
+ * unconditionally. we force the feature off if this is set to false.
+ */
+ if (!dc->debug.enable_single_display_2to1_odm_policy)
+ return false;
+
+ /* current design and test coverage is only limited to allow ODM power
+ * optimization for single stream. Supporting it for multiple streams
+ * use case would require additional algorithm to decide how to
+ * optimize power consumption when there are not enough free pipes to
+ * allocate for all the streams. This level of optimization would
+ * require multiple attempts of revalidation to make an optimized
+ * decision. Unfortunately We do not support revalidation flow in
+ * current version of DML.
+ */
+ if (context->stream_count != 1)
+ return false;
+
+ /*
+ * Our hardware doesn't support ODM for HDMI TMDS
+ */
+ if (dc_is_hdmi_signal(stream->signal))
+ return false;
+
+ /*
+ * ODM Combine 2:1 requires horizontal timing divisible by 2 so each
+ * ODM segment has the same size.
+ */
+ if (!is_h_timing_divisible_by_2(stream))
+ return false;
+
+ /*
+ * No power benefits if the timing's pixel clock is not high enough to
+ * raise display clock from minimum power state.
+ */
+ if (stream->timing.pix_clk_100hz * 100 <= DCN3_2_VMIN_DISPCLK_HZ)
+ return false;
+
+ if (dc->config.enable_windowed_mpo_odm) {
+ /*
+ * ODM power optimization should only be allowed if the feature
+ * can be seamlessly toggled off within an update. This would
+ * require that the feature is applied on top of a minimal
+ * state. A minimal state is defined as a state validated
+ * without the need of pipe split. Therefore, when transition to
+ * toggle the feature off, the same stream and plane
+ * configuration can be supported by the pipe resource in the
+ * first ODM slice alone without the need to acquire extra
+ * resources.
+ */
+ init_pipe_slice_table_from_context(&slice_table, context);
+ update_pipe_slice_table_with_split_flags(
+ &slice_table, dc, context, v,
+ split, merge);
+ for (i = 0; i < slice_table.mpc_combine_count; i++)
+ if (slice_table.mpc_combines[i].slice_count > 1)
+ return false;
+
+ for (i = 0; i < slice_table.odm_combine_count; i++)
+ if (slice_table.odm_combines[i].slice_count > 1)
+ return false;
+ } else {
+ /*
+ * the new ODM power optimization feature reduces software
+ * design limitation and allows ODM power optimization to be
+ * supported even with presence of overlay planes. The new
+ * feature is enabled based on enable_windowed_mpo_odm flag. If
+ * the flag is not set, we limit our feature scope due to
+ * previous software design limitation
+ */
+ if (context->stream_status[0].plane_count != 1)
+ return false;
+
+ if (memcmp(&context->stream_status[0].plane_states[0]->clip_rect,
+ &stream->src, sizeof(struct rect)) != 0)
+ return false;
+
+ if (stream->src.width >= 5120 &&
+ stream->src.width > stream->dst.width)
+ return false;
+ }
+ return true;
+}
+
+static void try_odm_power_optimization_and_revalidate(
+ struct dc *dc,
+ struct dc_state *context,
+ display_e2e_pipe_params_st *pipes,
+ int *split,
+ bool *merge,
+ unsigned int *vlevel,
+ int pipe_cnt)
+{
+ int i;
+ unsigned int new_vlevel;
+
+ for (i = 0; i < pipe_cnt; i++)
+ pipes[i].pipe.dest.odm_combine_policy = dm_odm_combine_policy_2to1;
+
+ new_vlevel = dml_get_voltage_level(&context->bw_ctx.dml, pipes, pipe_cnt);
+
+ if (new_vlevel < context->bw_ctx.dml.soc.num_states) {
+ memset(split, 0, MAX_PIPES * sizeof(int));
+ memset(merge, 0, MAX_PIPES * sizeof(bool));
+ *vlevel = dcn20_validate_apply_pipe_split_flags(dc, context, new_vlevel, split, merge);
+ context->bw_ctx.dml.vba.VoltageLevel = *vlevel;
+ }
+}
+
+static bool is_test_pattern_enabled(
+ struct dc_state *context)
+{
+ int i;
+
+ for (i = 0; i < context->stream_count; i++) {
+ if (context->streams[i]->test_pattern.type != DP_TEST_PATTERN_VIDEO_MODE)
+ return true;
+ }
+
+ return false;
+}
+
static void dcn32_full_validate_bw_helper(struct dc *dc,
struct dc_state *context,
display_e2e_pipe_params_st *pipes,
@@ -1187,7 +1439,7 @@ static void dcn32_full_validate_bw_helper(struct dc *dc,
* 5. (Config doesn't support MCLK in VACTIVE/VBLANK || dc->debug.force_subvp_mclk_switch)
*/
if (!dc->debug.force_disable_subvp && !dc->caps.dmub_caps.gecc_enable && dcn32_all_pipes_have_stream_and_plane(dc, context) &&
- !dcn32_mpo_in_use(context) && !dcn32_any_surfaces_rotated(dc, context) &&
+ !dcn32_mpo_in_use(context) && !dcn32_any_surfaces_rotated(dc, context) && !is_test_pattern_enabled(context) &&
(*vlevel == context->bw_ctx.dml.soc.num_states ||
vba->DRAMClockChangeSupport[*vlevel][vba->maxMpcComb] == dm_dram_clock_change_unsupported ||
dc->debug.force_subvp_mclk_switch)) {
@@ -1294,8 +1546,14 @@ static void dcn32_full_validate_bw_helper(struct dc *dc,
vba->VoltageLevel = *vlevel;
// Note: We can't apply the phantom pipes to hardware at this time. We have to wait
// until driver has acquired the DMCUB lock to do it safely.
+ assign_subvp_index(dc, context);
}
}
+
+ if (should_allow_odm_power_optimization(dc, context, vba, split, merge))
+ try_odm_power_optimization_and_revalidate(
+ dc, context, pipes, split, merge, vlevel, *pipe_cnt);
+
}
static bool is_dtbclk_required(struct dc *dc, struct dc_state *context)
@@ -1730,173 +1988,181 @@ bool dcn32_internal_validate_bw(struct dc *dc,
pipe_idx++;
}
- /* merge pipes if necessary */
- for (i = 0; i < dc->res_pool->pipe_count; i++) {
- struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
+ if (dc->config.enable_windowed_mpo_odm) {
+ repopulate_pipes = update_pipes_with_split_flags(
+ dc, context, vba, split, merge);
+ } else {
+ /* the code below will be removed once windowed mpo odm is fully
+ * enabled.
+ */
+ /* merge pipes if necessary */
+ for (i = 0; i < dc->res_pool->pipe_count; i++) {
+ struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
- /*skip pipes that don't need merging*/
- if (!merge[i])
- continue;
+ /*skip pipes that don't need merging*/
+ if (!merge[i])
+ continue;
- /* if ODM merge we ignore mpc tree, mpo pipes will have their own flags */
- if (pipe->prev_odm_pipe) {
- /*split off odm pipe*/
- pipe->prev_odm_pipe->next_odm_pipe = pipe->next_odm_pipe;
- if (pipe->next_odm_pipe)
- pipe->next_odm_pipe->prev_odm_pipe = pipe->prev_odm_pipe;
-
- /*2:1ODM+MPC Split MPO to Single Pipe + MPC Split MPO*/
- if (pipe->bottom_pipe) {
- if (pipe->bottom_pipe->prev_odm_pipe || pipe->bottom_pipe->next_odm_pipe) {
- /*MPC split rules will handle this case*/
- pipe->bottom_pipe->top_pipe = NULL;
- } else {
- /* when merging an ODM pipes, the bottom MPC pipe must now point to
- * the previous ODM pipe and its associated stream assets
- */
- if (pipe->prev_odm_pipe->bottom_pipe) {
- /* 3 plane MPO*/
- pipe->bottom_pipe->top_pipe = pipe->prev_odm_pipe->bottom_pipe;
- pipe->prev_odm_pipe->bottom_pipe->bottom_pipe = pipe->bottom_pipe;
+ /* if ODM merge we ignore mpc tree, mpo pipes will have their own flags */
+ if (pipe->prev_odm_pipe) {
+ /*split off odm pipe*/
+ pipe->prev_odm_pipe->next_odm_pipe = pipe->next_odm_pipe;
+ if (pipe->next_odm_pipe)
+ pipe->next_odm_pipe->prev_odm_pipe = pipe->prev_odm_pipe;
+
+ /*2:1ODM+MPC Split MPO to Single Pipe + MPC Split MPO*/
+ if (pipe->bottom_pipe) {
+ if (pipe->bottom_pipe->prev_odm_pipe || pipe->bottom_pipe->next_odm_pipe) {
+ /*MPC split rules will handle this case*/
+ pipe->bottom_pipe->top_pipe = NULL;
} else {
- /* 2 plane MPO*/
- pipe->bottom_pipe->top_pipe = pipe->prev_odm_pipe;
- pipe->prev_odm_pipe->bottom_pipe = pipe->bottom_pipe;
+ /* when merging an ODM pipes, the bottom MPC pipe must now point to
+ * the previous ODM pipe and its associated stream assets
+ */
+ if (pipe->prev_odm_pipe->bottom_pipe) {
+ /* 3 plane MPO*/
+ pipe->bottom_pipe->top_pipe = pipe->prev_odm_pipe->bottom_pipe;
+ pipe->prev_odm_pipe->bottom_pipe->bottom_pipe = pipe->bottom_pipe;
+ } else {
+ /* 2 plane MPO*/
+ pipe->bottom_pipe->top_pipe = pipe->prev_odm_pipe;
+ pipe->prev_odm_pipe->bottom_pipe = pipe->bottom_pipe;
+ }
+
+ memcpy(&pipe->bottom_pipe->stream_res, &pipe->bottom_pipe->top_pipe->stream_res, sizeof(struct stream_resource));
}
+ }
- memcpy(&pipe->bottom_pipe->stream_res, &pipe->bottom_pipe->top_pipe->stream_res, sizeof(struct stream_resource));
+ if (pipe->top_pipe) {
+ pipe->top_pipe->bottom_pipe = NULL;
}
- }
- if (pipe->top_pipe) {
- pipe->top_pipe->bottom_pipe = NULL;
- }
+ pipe->bottom_pipe = NULL;
+ pipe->next_odm_pipe = NULL;
+ pipe->plane_state = NULL;
+ pipe->stream = NULL;
+ pipe->top_pipe = NULL;
+ pipe->prev_odm_pipe = NULL;
+ if (pipe->stream_res.dsc)
+ dcn20_release_dsc(&context->res_ctx, dc->res_pool, &pipe->stream_res.dsc);
+ memset(&pipe->plane_res, 0, sizeof(pipe->plane_res));
+ memset(&pipe->stream_res, 0, sizeof(pipe->stream_res));
+ memset(&pipe->link_res, 0, sizeof(pipe->link_res));
+ repopulate_pipes = true;
+ } else if (pipe->top_pipe && pipe->top_pipe->plane_state == pipe->plane_state) {
+ struct pipe_ctx *top_pipe = pipe->top_pipe;
+ struct pipe_ctx *bottom_pipe = pipe->bottom_pipe;
+
+ top_pipe->bottom_pipe = bottom_pipe;
+ if (bottom_pipe)
+ bottom_pipe->top_pipe = top_pipe;
+
+ pipe->top_pipe = NULL;
+ pipe->bottom_pipe = NULL;
+ pipe->plane_state = NULL;
+ pipe->stream = NULL;
+ memset(&pipe->plane_res, 0, sizeof(pipe->plane_res));
+ memset(&pipe->stream_res, 0, sizeof(pipe->stream_res));
+ memset(&pipe->link_res, 0, sizeof(pipe->link_res));
+ repopulate_pipes = true;
+ } else
+ ASSERT(0); /* Should never try to merge master pipe */
- pipe->bottom_pipe = NULL;
- pipe->next_odm_pipe = NULL;
- pipe->plane_state = NULL;
- pipe->stream = NULL;
- pipe->top_pipe = NULL;
- pipe->prev_odm_pipe = NULL;
- if (pipe->stream_res.dsc)
- dcn20_release_dsc(&context->res_ctx, dc->res_pool, &pipe->stream_res.dsc);
- memset(&pipe->plane_res, 0, sizeof(pipe->plane_res));
- memset(&pipe->stream_res, 0, sizeof(pipe->stream_res));
- memset(&pipe->link_res, 0, sizeof(pipe->link_res));
- repopulate_pipes = true;
- } else if (pipe->top_pipe && pipe->top_pipe->plane_state == pipe->plane_state) {
- struct pipe_ctx *top_pipe = pipe->top_pipe;
- struct pipe_ctx *bottom_pipe = pipe->bottom_pipe;
-
- top_pipe->bottom_pipe = bottom_pipe;
- if (bottom_pipe)
- bottom_pipe->top_pipe = top_pipe;
-
- pipe->top_pipe = NULL;
- pipe->bottom_pipe = NULL;
- pipe->plane_state = NULL;
- pipe->stream = NULL;
- memset(&pipe->plane_res, 0, sizeof(pipe->plane_res));
- memset(&pipe->stream_res, 0, sizeof(pipe->stream_res));
- memset(&pipe->link_res, 0, sizeof(pipe->link_res));
- repopulate_pipes = true;
- } else
- ASSERT(0); /* Should never try to merge master pipe */
-
- }
-
- for (i = 0, pipe_idx = -1; i < dc->res_pool->pipe_count; i++) {
- struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
- struct pipe_ctx *old_pipe = &dc->current_state->res_ctx.pipe_ctx[i];
- struct pipe_ctx *hsplit_pipe = NULL;
- bool odm;
- int old_index = -1;
+ }
- if (!pipe->stream || newly_split[i])
- continue;
+ for (i = 0, pipe_idx = -1; i < dc->res_pool->pipe_count; i++) {
+ struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
+ struct pipe_ctx *old_pipe = &dc->current_state->res_ctx.pipe_ctx[i];
+ struct pipe_ctx *hsplit_pipe = NULL;
+ bool odm;
+ int old_index = -1;
- pipe_idx++;
- odm = vba->ODMCombineEnabled[vba->pipe_plane[pipe_idx]] != dm_odm_combine_mode_disabled;
+ if (!pipe->stream || newly_split[i])
+ continue;
- if (!pipe->plane_state && !odm)
- continue;
+ pipe_idx++;
+ odm = vba->ODMCombineEnabled[vba->pipe_plane[pipe_idx]] != dm_odm_combine_mode_disabled;
- if (split[i]) {
- if (odm) {
- if (split[i] == 4 && old_pipe->next_odm_pipe && old_pipe->next_odm_pipe->next_odm_pipe)
- old_index = old_pipe->next_odm_pipe->next_odm_pipe->pipe_idx;
- else if (old_pipe->next_odm_pipe)
+ if (!pipe->plane_state && !odm)
+ continue;
+
+ if (split[i]) {
+ if (odm) {
+ if (split[i] == 4 && old_pipe->next_odm_pipe && old_pipe->next_odm_pipe->next_odm_pipe)
+ old_index = old_pipe->next_odm_pipe->next_odm_pipe->pipe_idx;
+ else if (old_pipe->next_odm_pipe)
+ old_index = old_pipe->next_odm_pipe->pipe_idx;
+ } else {
+ if (split[i] == 4 && old_pipe->bottom_pipe && old_pipe->bottom_pipe->bottom_pipe &&
+ old_pipe->bottom_pipe->bottom_pipe->plane_state == old_pipe->plane_state)
+ old_index = old_pipe->bottom_pipe->bottom_pipe->pipe_idx;
+ else if (old_pipe->bottom_pipe &&
+ old_pipe->bottom_pipe->plane_state == old_pipe->plane_state)
+ old_index = old_pipe->bottom_pipe->pipe_idx;
+ }
+ hsplit_pipe = dcn32_find_split_pipe(dc, context, old_index);
+ ASSERT(hsplit_pipe);
+ if (!hsplit_pipe)
+ goto validate_fail;
+
+ if (!dcn32_split_stream_for_mpc_or_odm(
+ dc, &context->res_ctx,
+ pipe, hsplit_pipe, odm))
+ goto validate_fail;
+
+ newly_split[hsplit_pipe->pipe_idx] = true;
+ repopulate_pipes = true;
+ }
+ if (split[i] == 4) {
+ struct pipe_ctx *pipe_4to1;
+
+ if (odm && old_pipe->next_odm_pipe)
old_index = old_pipe->next_odm_pipe->pipe_idx;
- } else {
- if (split[i] == 4 && old_pipe->bottom_pipe && old_pipe->bottom_pipe->bottom_pipe &&
- old_pipe->bottom_pipe->bottom_pipe->plane_state == old_pipe->plane_state)
- old_index = old_pipe->bottom_pipe->bottom_pipe->pipe_idx;
- else if (old_pipe->bottom_pipe &&
- old_pipe->bottom_pipe->plane_state == old_pipe->plane_state)
+ else if (!odm && old_pipe->bottom_pipe &&
+ old_pipe->bottom_pipe->plane_state == old_pipe->plane_state)
old_index = old_pipe->bottom_pipe->pipe_idx;
+ else
+ old_index = -1;
+ pipe_4to1 = dcn32_find_split_pipe(dc, context, old_index);
+ ASSERT(pipe_4to1);
+ if (!pipe_4to1)
+ goto validate_fail;
+ if (!dcn32_split_stream_for_mpc_or_odm(
+ dc, &context->res_ctx,
+ pipe, pipe_4to1, odm))
+ goto validate_fail;
+ newly_split[pipe_4to1->pipe_idx] = true;
+
+ if (odm && old_pipe->next_odm_pipe && old_pipe->next_odm_pipe->next_odm_pipe
+ && old_pipe->next_odm_pipe->next_odm_pipe->next_odm_pipe)
+ old_index = old_pipe->next_odm_pipe->next_odm_pipe->next_odm_pipe->pipe_idx;
+ else if (!odm && old_pipe->bottom_pipe && old_pipe->bottom_pipe->bottom_pipe &&
+ old_pipe->bottom_pipe->bottom_pipe->bottom_pipe &&
+ old_pipe->bottom_pipe->bottom_pipe->bottom_pipe->plane_state == old_pipe->plane_state)
+ old_index = old_pipe->bottom_pipe->bottom_pipe->bottom_pipe->pipe_idx;
+ else
+ old_index = -1;
+ pipe_4to1 = dcn32_find_split_pipe(dc, context, old_index);
+ ASSERT(pipe_4to1);
+ if (!pipe_4to1)
+ goto validate_fail;
+ if (!dcn32_split_stream_for_mpc_or_odm(
+ dc, &context->res_ctx,
+ hsplit_pipe, pipe_4to1, odm))
+ goto validate_fail;
+ newly_split[pipe_4to1->pipe_idx] = true;
}
- hsplit_pipe = dcn32_find_split_pipe(dc, context, old_index);
- ASSERT(hsplit_pipe);
- if (!hsplit_pipe)
- goto validate_fail;
-
- if (!dcn32_split_stream_for_mpc_or_odm(
- dc, &context->res_ctx,
- pipe, hsplit_pipe, odm))
- goto validate_fail;
-
- newly_split[hsplit_pipe->pipe_idx] = true;
- repopulate_pipes = true;
- }
- if (split[i] == 4) {
- struct pipe_ctx *pipe_4to1;
-
- if (odm && old_pipe->next_odm_pipe)
- old_index = old_pipe->next_odm_pipe->pipe_idx;
- else if (!odm && old_pipe->bottom_pipe &&
- old_pipe->bottom_pipe->plane_state == old_pipe->plane_state)
- old_index = old_pipe->bottom_pipe->pipe_idx;
- else
- old_index = -1;
- pipe_4to1 = dcn32_find_split_pipe(dc, context, old_index);
- ASSERT(pipe_4to1);
- if (!pipe_4to1)
- goto validate_fail;
- if (!dcn32_split_stream_for_mpc_or_odm(
- dc, &context->res_ctx,
- pipe, pipe_4to1, odm))
- goto validate_fail;
- newly_split[pipe_4to1->pipe_idx] = true;
-
- if (odm && old_pipe->next_odm_pipe && old_pipe->next_odm_pipe->next_odm_pipe
- && old_pipe->next_odm_pipe->next_odm_pipe->next_odm_pipe)
- old_index = old_pipe->next_odm_pipe->next_odm_pipe->next_odm_pipe->pipe_idx;
- else if (!odm && old_pipe->bottom_pipe && old_pipe->bottom_pipe->bottom_pipe &&
- old_pipe->bottom_pipe->bottom_pipe->bottom_pipe &&
- old_pipe->bottom_pipe->bottom_pipe->bottom_pipe->plane_state == old_pipe->plane_state)
- old_index = old_pipe->bottom_pipe->bottom_pipe->bottom_pipe->pipe_idx;
- else
- old_index = -1;
- pipe_4to1 = dcn32_find_split_pipe(dc, context, old_index);
- ASSERT(pipe_4to1);
- if (!pipe_4to1)
- goto validate_fail;
- if (!dcn32_split_stream_for_mpc_or_odm(
- dc, &context->res_ctx,
- hsplit_pipe, pipe_4to1, odm))
- goto validate_fail;
- newly_split[pipe_4to1->pipe_idx] = true;
+ if (odm)
+ dcn20_build_mapped_resource(dc, context, pipe->stream);
}
- if (odm)
- dcn20_build_mapped_resource(dc, context, pipe->stream);
- }
- for (i = 0; i < dc->res_pool->pipe_count; i++) {
- struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
+ for (i = 0; i < dc->res_pool->pipe_count; i++) {
+ struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
- if (pipe->plane_state) {
- if (!resource_build_scaling_params(pipe))
- goto validate_fail;
+ if (pipe->plane_state) {
+ if (!resource_build_scaling_params(pipe))
+ goto validate_fail;
+ }
}
}
@@ -1934,6 +2200,7 @@ bool dcn32_internal_validate_bw(struct dc *dc,
vba->VoltageLevel = i;
vlevel = i;
flags_valid = true;
+ break;
}
}
@@ -2704,12 +2971,14 @@ void dcn32_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_pa
/* Override from passed dc->bb_overrides if available*/
if ((int)(dcn3_2_soc.sr_exit_time_us * 1000) != dc->bb_overrides.sr_exit_time_ns
&& dc->bb_overrides.sr_exit_time_ns) {
+ dc->dml2_options.bbox_overrides.sr_exit_latency_us =
dcn3_2_soc.sr_exit_time_us = dc->bb_overrides.sr_exit_time_ns / 1000.0;
}
if ((int)(dcn3_2_soc.sr_enter_plus_exit_time_us * 1000)
!= dc->bb_overrides.sr_enter_plus_exit_time_ns
&& dc->bb_overrides.sr_enter_plus_exit_time_ns) {
+ dc->dml2_options.bbox_overrides.sr_enter_plus_exit_latency_us =
dcn3_2_soc.sr_enter_plus_exit_time_us =
dc->bb_overrides.sr_enter_plus_exit_time_ns / 1000.0;
}
@@ -2717,12 +2986,14 @@ void dcn32_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_pa
if ((int)(dcn3_2_soc.urgent_latency_us * 1000) != dc->bb_overrides.urgent_latency_ns
&& dc->bb_overrides.urgent_latency_ns) {
dcn3_2_soc.urgent_latency_us = dc->bb_overrides.urgent_latency_ns / 1000.0;
+ dc->dml2_options.bbox_overrides.urgent_latency_us =
dcn3_2_soc.urgent_latency_pixel_data_only_us = dc->bb_overrides.urgent_latency_ns / 1000.0;
}
if ((int)(dcn3_2_soc.dram_clock_change_latency_us * 1000)
!= dc->bb_overrides.dram_clock_change_latency_ns
&& dc->bb_overrides.dram_clock_change_latency_ns) {
+ dc->dml2_options.bbox_overrides.dram_clock_change_latency_us =
dcn3_2_soc.dram_clock_change_latency_us =
dc->bb_overrides.dram_clock_change_latency_ns / 1000.0;
}
@@ -2730,6 +3001,7 @@ void dcn32_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_pa
if ((int)(dcn3_2_soc.fclk_change_latency_us * 1000)
!= dc->bb_overrides.fclk_clock_change_latency_ns
&& dc->bb_overrides.fclk_clock_change_latency_ns) {
+ dc->dml2_options.bbox_overrides.fclk_change_latency_us =
dcn3_2_soc.fclk_change_latency_us =
dc->bb_overrides.fclk_clock_change_latency_ns / 1000;
}
@@ -2747,14 +3019,17 @@ void dcn32_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_pa
if (dc->ctx->dc_bios->funcs->get_soc_bb_info(dc->ctx->dc_bios, &bb_info) == BP_RESULT_OK) {
if (bb_info.dram_clock_change_latency_100ns > 0)
+ dc->dml2_options.bbox_overrides.dram_clock_change_latency_us =
dcn3_2_soc.dram_clock_change_latency_us =
bb_info.dram_clock_change_latency_100ns * 10;
if (bb_info.dram_sr_enter_exit_latency_100ns > 0)
+ dc->dml2_options.bbox_overrides.sr_enter_plus_exit_latency_us =
dcn3_2_soc.sr_enter_plus_exit_time_us =
bb_info.dram_sr_enter_exit_latency_100ns * 10;
if (bb_info.dram_sr_exit_latency_100ns > 0)
+ dc->dml2_options.bbox_overrides.sr_exit_latency_us =
dcn3_2_soc.sr_exit_time_us =
bb_info.dram_sr_exit_latency_100ns * 10;
}
@@ -2762,12 +3037,14 @@ void dcn32_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_pa
/* Override from VBIOS for num_chan */
if (dc->ctx->dc_bios->vram_info.num_chans) {
+ dc->dml2_options.bbox_overrides.dram_num_chan =
dcn3_2_soc.num_chans = dc->ctx->dc_bios->vram_info.num_chans;
dcn3_2_soc.mall_allocated_for_dcn_mbytes = (double)(dcn32_calc_num_avail_chans_for_mall(dc,
dc->ctx->dc_bios->vram_info.num_chans) * dc->caps.mall_size_per_mem_channel);
}
if (dc->ctx->dc_bios->vram_info.dram_channel_width_bytes)
+ dc->dml2_options.bbox_overrides.dram_chanel_width_bytes =
dcn3_2_soc.dram_channel_width_bytes = dc->ctx->dc_bios->vram_info.dram_channel_width_bytes;
/* DML DSC delay factor workaround */
@@ -2778,6 +3055,10 @@ void dcn32_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_pa
/* Override dispclk_dppclk_vco_speed_mhz from Clk Mgr */
dcn3_2_soc.dispclk_dppclk_vco_speed_mhz = dc->clk_mgr->dentist_vco_freq_khz / 1000.0;
dc->dml.soc.dispclk_dppclk_vco_speed_mhz = dc->clk_mgr->dentist_vco_freq_khz / 1000.0;
+ dc->dml2_options.bbox_overrides.disp_pll_vco_speed_mhz = dc->clk_mgr->dentist_vco_freq_khz / 1000.0;
+ dc->dml2_options.bbox_overrides.xtalclk_mhz = dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency / 1000.0;
+ dc->dml2_options.bbox_overrides.dchub_refclk_mhz = dc->res_pool->ref_clocks.dchub_ref_clock_inKhz / 1000.0;
+ dc->dml2_options.bbox_overrides.dprefclk_mhz = dc->clk_mgr->dprefclk_khz / 1000.0;
/* Overrides Clock levelsfrom CLK Mgr table entries as reported by PM FW */
if (bw_params->clk_table.entries[0].memclk_mhz) {
@@ -2933,6 +3214,72 @@ void dcn32_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_pa
if (dc->current_state)
dml_init_instance(&dc->current_state->bw_ctx.dml, &dcn3_2_soc, &dcn3_2_ip, DML_PROJECT_DCN32);
}
+
+ if (dc->clk_mgr->bw_params->clk_table.num_entries > 1) {
+ unsigned int i = 0;
+
+ dc->dml2_options.bbox_overrides.clks_table.num_states = dc->clk_mgr->bw_params->clk_table.num_entries;
+
+ dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_dcfclk_levels =
+ dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_dcfclk_levels;
+
+ dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_fclk_levels =
+ dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_fclk_levels;
+
+ dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_memclk_levels =
+ dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_memclk_levels;
+
+ dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_socclk_levels =
+ dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_socclk_levels;
+
+ dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_dtbclk_levels =
+ dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_dtbclk_levels;
+
+ dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_dispclk_levels =
+ dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_dispclk_levels;
+
+ dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_dppclk_levels =
+ dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_dppclk_levels;
+
+ for (i = 0; i < dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_dcfclk_levels; i++) {
+ if (dc->clk_mgr->bw_params->clk_table.entries[i].dcfclk_mhz)
+ dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].dcfclk_mhz =
+ dc->clk_mgr->bw_params->clk_table.entries[i].dcfclk_mhz;
+ }
+
+ for (i = 0; i < dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_fclk_levels; i++) {
+ if (dc->clk_mgr->bw_params->clk_table.entries[i].fclk_mhz)
+ dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].fclk_mhz =
+ dc->clk_mgr->bw_params->clk_table.entries[i].fclk_mhz;
+ }
+
+ for (i = 0; i < dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_memclk_levels; i++) {
+ if (dc->clk_mgr->bw_params->clk_table.entries[i].memclk_mhz)
+ dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].memclk_mhz =
+ dc->clk_mgr->bw_params->clk_table.entries[i].memclk_mhz;
+ }
+
+ for (i = 0; i < dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_socclk_levels; i++) {
+ if (dc->clk_mgr->bw_params->clk_table.entries[i].socclk_mhz)
+ dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].socclk_mhz =
+ dc->clk_mgr->bw_params->clk_table.entries[i].socclk_mhz;
+ }
+
+ for (i = 0; i < dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_dtbclk_levels; i++) {
+ if (dc->clk_mgr->bw_params->clk_table.entries[i].dtbclk_mhz)
+ dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].dtbclk_mhz =
+ dc->clk_mgr->bw_params->clk_table.entries[i].dtbclk_mhz;
+ }
+
+ for (i = 0; i < dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_dispclk_levels; i++) {
+ if (dc->clk_mgr->bw_params->clk_table.entries[i].dispclk_mhz) {
+ dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].dispclk_mhz =
+ dc->clk_mgr->bw_params->clk_table.entries[i].dispclk_mhz;
+ dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].dppclk_mhz =
+ dc->clk_mgr->bw_params->clk_table.entries[i].dispclk_mhz;
+ }
+ }
+ }
}
void dcn32_zero_pipe_dcc_fraction(display_e2e_pipe_params_st *pipes,
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.h b/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.h
index defbee866..d25c3f730 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.h
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.h
@@ -36,9 +36,6 @@ void dcn32_helper_populate_phantom_dlg_params(struct dc *dc,
display_e2e_pipe_params_st *pipes,
int pipe_cnt);
-uint8_t dcn32_predict_pipe_split(struct dc_state *context,
- display_e2e_pipe_params_st *pipe_e2e);
-
void dcn32_set_phantom_stream_timing(struct dc *dc,
struct dc_state *context,
struct pipe_ctx *ref_pipe,
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
index cbdfb762c..6c84b0fa4 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
@@ -813,6 +813,8 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
(v->DRAMSpeedPerState[mode_lib->vba.VoltageLevel] <= MEM_STROBE_FREQ_MHZ ||
v->DCFCLKPerState[mode_lib->vba.VoltageLevel] <= DCFCLK_FREQ_EXTRA_PREFETCH_REQ_MHZ) ?
mode_lib->vba.ip.min_prefetch_in_strobe_us : 0,
+ mode_lib->vba.PrefetchModePerState[mode_lib->vba.VoltageLevel][mode_lib->vba.maxMpcComb] > 0 || mode_lib->vba.DRAMClockChangeRequirementFinal == false,
+
/* Output */
&v->DSTXAfterScaler[k],
&v->DSTYAfterScaler[k],
@@ -3317,6 +3319,7 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
v->SwathHeightCThisState[k], v->TWait,
(v->DRAMSpeedPerState[i] <= MEM_STROBE_FREQ_MHZ || v->DCFCLKState[i][j] <= DCFCLK_FREQ_EXTRA_PREFETCH_REQ_MHZ) ?
mode_lib->vba.ip.min_prefetch_in_strobe_us : 0,
+ mode_lib->vba.PrefetchModePerState[i][j] > 0 || mode_lib->vba.DRAMClockChangeRequirementFinal == false,
/* Output */
&v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTXAfterScaler[k],
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
index ecea008f1..80fccd499 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
@@ -3423,6 +3423,7 @@ bool dml32_CalculatePrefetchSchedule(
unsigned int SwathHeightC,
double TWait,
double TPreReq,
+ bool ExtendPrefetchIfPossible,
/* Output */
double *DSTXAfterScaler,
double *DSTYAfterScaler,
@@ -3892,12 +3893,32 @@ bool dml32_CalculatePrefetchSchedule(
/* Clamp to oto for bandwidth calculation */
LinesForPrefetchBandwidth = dst_y_prefetch_oto;
} else {
- *DestinationLinesForPrefetch = dst_y_prefetch_equ;
- TimeForFetchingMetaPTE = Tvm_equ;
- TimeForFetchingRowInVBlank = Tr0_equ;
- *PrefetchBandwidth = prefetch_bw_equ;
- /* Clamp to equ for bandwidth calculation */
- LinesForPrefetchBandwidth = dst_y_prefetch_equ;
+ /* For mode programming we want to extend the prefetch as much as possible
+ * (up to oto, or as long as we can for equ) if we're not already applying
+ * the 60us prefetch requirement. This is to avoid intermittent underflow
+ * issues during prefetch.
+ *
+ * The prefetch extension is applied under the following scenarios:
+ * 1. We're in prefetch mode > 0 (i.e. we don't support MCLK switch in blank)
+ * 2. We're using subvp or drr methods of p-state switch, in which case we
+ * we don't care if prefetch takes up more of the blanking time
+ *
+ * Mode programming typically chooses the smallest prefetch time possible
+ * (i.e. highest bandwidth during prefetch) presumably to create margin between
+ * p-states / c-states that happen in vblank and prefetch. Therefore we only
+ * apply this prefetch extension when p-state in vblank is not required (UCLK
+ * p-states take up the most vblank time).
+ */
+ if (ExtendPrefetchIfPossible && TPreReq == 0 && VStartup < MaxVStartup) {
+ MyError = true;
+ } else {
+ *DestinationLinesForPrefetch = dst_y_prefetch_equ;
+ TimeForFetchingMetaPTE = Tvm_equ;
+ TimeForFetchingRowInVBlank = Tr0_equ;
+ *PrefetchBandwidth = prefetch_bw_equ;
+ /* Clamp to equ for bandwidth calculation */
+ LinesForPrefetchBandwidth = dst_y_prefetch_equ;
+ }
}
*DestinationLinesToRequestVMInVBlank = dml_ceil(4.0 * TimeForFetchingMetaPTE / LineTime, 1.0) / 4.0;
@@ -4661,10 +4682,6 @@ void dml32_CalculateMinAndMaxPrefetchMode(
} else if (AllowForPStateChangeOrStutterInVBlankFinal == dm_prefetch_support_uclk_fclk_and_stutter) {
*MinPrefetchMode = 0;
*MaxPrefetchMode = 0;
- } else if (AllowForPStateChangeOrStutterInVBlankFinal ==
- dm_prefetch_support_uclk_fclk_and_stutter_if_possible) {
- *MinPrefetchMode = 0;
- *MaxPrefetchMode = 3;
} else {
*MinPrefetchMode = 0;
*MaxPrefetchMode = 3;
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h
index 592d174df..5d34735df 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h
@@ -747,6 +747,7 @@ bool dml32_CalculatePrefetchSchedule(
unsigned int SwathHeightC,
double TWait,
double TPreReq,
+ bool ExtendPrefetchIfPossible,
/* Output */
double *DSTXAfterScaler,
double *DSTYAfterScaler,
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn321/dcn321_fpu.c b/drivers/gpu/drm/amd/display/dc/dml/dcn321/dcn321_fpu.c
index b26fcf860..ff4d795c7 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn321/dcn321_fpu.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn321/dcn321_fpu.c
@@ -616,12 +616,14 @@ void dcn321_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_p
/* Override from passed dc->bb_overrides if available*/
if ((int)(dcn3_21_soc.sr_exit_time_us * 1000) != dc->bb_overrides.sr_exit_time_ns
&& dc->bb_overrides.sr_exit_time_ns) {
+ dc->dml2_options.bbox_overrides.sr_exit_latency_us =
dcn3_21_soc.sr_exit_time_us = dc->bb_overrides.sr_exit_time_ns / 1000.0;
}
if ((int)(dcn3_21_soc.sr_enter_plus_exit_time_us * 1000)
!= dc->bb_overrides.sr_enter_plus_exit_time_ns
&& dc->bb_overrides.sr_enter_plus_exit_time_ns) {
+ dc->dml2_options.bbox_overrides.sr_enter_plus_exit_latency_us =
dcn3_21_soc.sr_enter_plus_exit_time_us =
dc->bb_overrides.sr_enter_plus_exit_time_ns / 1000.0;
}
@@ -629,12 +631,14 @@ void dcn321_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_p
if ((int)(dcn3_21_soc.urgent_latency_us * 1000) != dc->bb_overrides.urgent_latency_ns
&& dc->bb_overrides.urgent_latency_ns) {
dcn3_21_soc.urgent_latency_us = dc->bb_overrides.urgent_latency_ns / 1000.0;
+ dc->dml2_options.bbox_overrides.urgent_latency_us =
dcn3_21_soc.urgent_latency_pixel_data_only_us = dc->bb_overrides.urgent_latency_ns / 1000.0;
}
if ((int)(dcn3_21_soc.dram_clock_change_latency_us * 1000)
!= dc->bb_overrides.dram_clock_change_latency_ns
&& dc->bb_overrides.dram_clock_change_latency_ns) {
+ dc->dml2_options.bbox_overrides.dram_clock_change_latency_us =
dcn3_21_soc.dram_clock_change_latency_us =
dc->bb_overrides.dram_clock_change_latency_ns / 1000.0;
}
@@ -642,6 +646,7 @@ void dcn321_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_p
if ((int)(dcn3_21_soc.fclk_change_latency_us * 1000)
!= dc->bb_overrides.fclk_clock_change_latency_ns
&& dc->bb_overrides.fclk_clock_change_latency_ns) {
+ dc->dml2_options.bbox_overrides.fclk_change_latency_us =
dcn3_21_soc.fclk_change_latency_us =
dc->bb_overrides.fclk_clock_change_latency_ns / 1000;
}
@@ -659,14 +664,17 @@ void dcn321_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_p
if (dc->ctx->dc_bios->funcs->get_soc_bb_info(dc->ctx->dc_bios, &bb_info) == BP_RESULT_OK) {
if (bb_info.dram_clock_change_latency_100ns > 0)
+ dc->dml2_options.bbox_overrides.dram_clock_change_latency_us =
dcn3_21_soc.dram_clock_change_latency_us =
bb_info.dram_clock_change_latency_100ns * 10;
if (bb_info.dram_sr_enter_exit_latency_100ns > 0)
+ dc->dml2_options.bbox_overrides.sr_enter_plus_exit_latency_us =
dcn3_21_soc.sr_enter_plus_exit_time_us =
bb_info.dram_sr_enter_exit_latency_100ns * 10;
if (bb_info.dram_sr_exit_latency_100ns > 0)
+ dc->dml2_options.bbox_overrides.sr_exit_latency_us =
dcn3_21_soc.sr_exit_time_us =
bb_info.dram_sr_exit_latency_100ns * 10;
}
@@ -674,12 +682,14 @@ void dcn321_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_p
/* Override from VBIOS for num_chan */
if (dc->ctx->dc_bios->vram_info.num_chans) {
+ dc->dml2_options.bbox_overrides.dram_num_chan =
dcn3_21_soc.num_chans = dc->ctx->dc_bios->vram_info.num_chans;
dcn3_21_soc.mall_allocated_for_dcn_mbytes = (double)(dcn32_calc_num_avail_chans_for_mall(dc,
dc->ctx->dc_bios->vram_info.num_chans) * dc->caps.mall_size_per_mem_channel);
}
if (dc->ctx->dc_bios->vram_info.dram_channel_width_bytes)
+ dc->dml2_options.bbox_overrides.dram_chanel_width_bytes =
dcn3_21_soc.dram_channel_width_bytes = dc->ctx->dc_bios->vram_info.dram_channel_width_bytes;
/* DML DSC delay factor workaround */
@@ -690,6 +700,10 @@ void dcn321_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_p
/* Override dispclk_dppclk_vco_speed_mhz from Clk Mgr */
dcn3_21_soc.dispclk_dppclk_vco_speed_mhz = dc->clk_mgr->dentist_vco_freq_khz / 1000.0;
dc->dml.soc.dispclk_dppclk_vco_speed_mhz = dc->clk_mgr->dentist_vco_freq_khz / 1000.0;
+ dc->dml2_options.bbox_overrides.disp_pll_vco_speed_mhz = dc->clk_mgr->dentist_vco_freq_khz / 1000.0;
+ dc->dml2_options.bbox_overrides.xtalclk_mhz = dc->ctx->dc_bios->fw_info.pll_info.crystal_frequency / 1000.0;
+ dc->dml2_options.bbox_overrides.dchub_refclk_mhz = dc->res_pool->ref_clocks.dchub_ref_clock_inKhz / 1000.0;
+ dc->dml2_options.bbox_overrides.dprefclk_mhz = dc->clk_mgr->dprefclk_khz / 1000.0;
/* Overrides Clock levelsfrom CLK Mgr table entries as reported by PM FW */
if (dc->debug.use_legacy_soc_bb_mechanism) {
@@ -836,5 +850,72 @@ void dcn321_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_p
dml_init_instance(&dc->dml, &dcn3_21_soc, &dcn3_21_ip, DML_PROJECT_DCN32);
if (dc->current_state)
dml_init_instance(&dc->current_state->bw_ctx.dml, &dcn3_21_soc, &dcn3_21_ip, DML_PROJECT_DCN32);
+
+ if (dc->clk_mgr->bw_params->clk_table.num_entries > 1) {
+ unsigned int i = 0;
+
+ dc->dml2_options.bbox_overrides.clks_table.num_states = dc->clk_mgr->bw_params->clk_table.num_entries;
+
+ dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_dcfclk_levels =
+ dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_dcfclk_levels;
+
+ dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_fclk_levels =
+ dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_fclk_levels;
+
+ dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_memclk_levels =
+ dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_memclk_levels;
+
+ dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_socclk_levels =
+ dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_socclk_levels;
+
+ dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_dtbclk_levels =
+ dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_dtbclk_levels;
+
+ dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_dispclk_levels =
+ dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_dispclk_levels;
+
+ dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_dppclk_levels =
+ dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_dppclk_levels;
+
+
+ for (i = 0; i < dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_dcfclk_levels; i++) {
+ if (dc->clk_mgr->bw_params->clk_table.entries[i].dcfclk_mhz)
+ dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].dcfclk_mhz =
+ dc->clk_mgr->bw_params->clk_table.entries[i].dcfclk_mhz;
+ }
+
+ for (i = 0; i < dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_fclk_levels; i++) {
+ if (dc->clk_mgr->bw_params->clk_table.entries[i].fclk_mhz)
+ dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].fclk_mhz =
+ dc->clk_mgr->bw_params->clk_table.entries[i].fclk_mhz;
+ }
+
+ for (i = 0; i < dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_memclk_levels; i++) {
+ if (dc->clk_mgr->bw_params->clk_table.entries[i].memclk_mhz)
+ dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].memclk_mhz =
+ dc->clk_mgr->bw_params->clk_table.entries[i].memclk_mhz;
+ }
+
+ for (i = 0; i < dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_socclk_levels; i++) {
+ if (dc->clk_mgr->bw_params->clk_table.entries[i].socclk_mhz)
+ dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].socclk_mhz =
+ dc->clk_mgr->bw_params->clk_table.entries[i].socclk_mhz;
+ }
+
+ for (i = 0; i < dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_dtbclk_levels; i++) {
+ if (dc->clk_mgr->bw_params->clk_table.entries[i].dtbclk_mhz)
+ dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].dtbclk_mhz =
+ dc->clk_mgr->bw_params->clk_table.entries[i].dtbclk_mhz;
+ }
+
+ for (i = 0; i < dc->clk_mgr->bw_params->clk_table.num_entries_per_clk.num_dispclk_levels; i++) {
+ if (dc->clk_mgr->bw_params->clk_table.entries[i].dispclk_mhz) {
+ dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].dispclk_mhz =
+ dc->clk_mgr->bw_params->clk_table.entries[i].dispclk_mhz;
+ dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].dppclk_mhz =
+ dc->clk_mgr->bw_params->clk_table.entries[i].dispclk_mhz;
+ }
+ }
+ }
}
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.c b/drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.c
new file mode 100644
index 000000000..f154a3eb1
--- /dev/null
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.c
@@ -0,0 +1,589 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright 2023 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 "resource.h"
+#include "dcn35_fpu.h"
+#include "dcn31/dcn31_resource.h"
+#include "dcn32/dcn32_resource.h"
+#include "dcn35/dcn35_resource.h"
+#include "dml/dcn31/dcn31_fpu.h"
+#include "dml/dml_inline_defs.h"
+
+#include "link.h"
+
+#define DC_LOGGER_INIT(logger)
+
+struct _vcs_dpi_ip_params_st dcn3_5_ip = {
+ .VBlankNomDefaultUS = 668,
+ .gpuvm_enable = 1,
+ .gpuvm_max_page_table_levels = 1,
+ .hostvm_enable = 1,
+ .hostvm_max_page_table_levels = 2,
+ .rob_buffer_size_kbytes = 64,
+ .det_buffer_size_kbytes = 1536,
+ .config_return_buffer_size_in_kbytes = 1792,
+ .compressed_buffer_segment_size_in_kbytes = 64,
+ .meta_fifo_size_in_kentries = 32,
+ .zero_size_buffer_entries = 512,
+ .compbuf_reserved_space_64b = 256,
+ .compbuf_reserved_space_zs = 64,
+ .dpp_output_buffer_pixels = 2560,/*not used*/
+ .opp_output_buffer_lines = 1,/*not used*/
+ .pixel_chunk_size_kbytes = 8,
+ //.alpha_pixel_chunk_size_kbytes = 4;/*new*/
+ //.min_pixel_chunk_size_bytes = 1024;/*new*/
+ .meta_chunk_size_kbytes = 2,
+ .min_meta_chunk_size_bytes = 256,
+ .writeback_chunk_size_kbytes = 8,
+ .ptoi_supported = false,
+ .num_dsc = 4,
+ .maximum_dsc_bits_per_component = 12,/*delta from 10*/
+ .dsc422_native_support = true,/*delta from false*/
+ .is_line_buffer_bpp_fixed = true,/*new*/
+ .line_buffer_fixed_bpp = 32,/*delta from 48*/
+ .line_buffer_size_bits = 986880,/*delta from 789504*/
+ .max_line_buffer_lines = 32,/*delta from 12*/
+ .writeback_interface_buffer_size_kbytes = 90,
+ .max_num_dpp = 4,
+ .max_num_otg = 4,
+ .max_num_hdmi_frl_outputs = 1,
+ .max_num_wb = 1,
+ /*.max_num_hdmi_frl_outputs = 1; new in dml2*/
+ /*.max_num_dp2p0_outputs = 2; new in dml2*/
+ /*.max_num_dp2p0_streams = 4; new in dml2*/
+ .max_dchub_pscl_bw_pix_per_clk = 4,
+ .max_pscl_lb_bw_pix_per_clk = 2,
+ .max_lb_vscl_bw_pix_per_clk = 4,
+ .max_vscl_hscl_bw_pix_per_clk = 4,
+ .max_hscl_ratio = 6,
+ .max_vscl_ratio = 6,
+ .max_hscl_taps = 8,
+ .max_vscl_taps = 8,
+ .dpte_buffer_size_in_pte_reqs_luma = 68,/*changed from 64,*/
+ .dpte_buffer_size_in_pte_reqs_chroma = 36,/*changed from 34*/
+ /*.dcc_meta_buffer_size_bytes = 6272; new to dml2*/
+ .dispclk_ramp_margin_percent = 1.11,/*delta from 1*/
+ /*.dppclk_delay_subtotal = 47;
+ .dppclk_delay_scl = 50;
+ .dppclk_delay_scl_lb_only = 16;
+ .dppclk_delay_cnvc_formatter = 28;
+ .dppclk_delay_cnvc_cursor = 6;
+ .dispclk_delay_subtotal = 125;*/ /*new to dml2*/
+ .max_inter_dcn_tile_repeaters = 8,
+ .cursor_buffer_size = 16,
+ .cursor_chunk_size = 2,
+ .writeback_line_buffer_buffer_size = 0,
+ .writeback_min_hscl_ratio = 1,
+ .writeback_min_vscl_ratio = 1,
+ .writeback_max_hscl_ratio = 1,
+ .writeback_max_vscl_ratio = 1,
+ .writeback_max_hscl_taps = 1,
+ .writeback_max_vscl_taps = 1,
+ .dppclk_delay_subtotal = 47, /* changed from 46,*/
+ .dppclk_delay_scl = 50,
+ .dppclk_delay_scl_lb_only = 16,
+ .dppclk_delay_cnvc_formatter = 28,/*changed from 27,*/
+ .dppclk_delay_cnvc_cursor = 6,
+ .dispclk_delay_subtotal = 125, /*changed from 119,*/
+ .dynamic_metadata_vm_enabled = false,
+ .odm_combine_4to1_supported = false,
+ .dcc_supported = true,
+// .config_return_buffer_segment_size_in_kbytes = 64;/*required, hard coded in dml2_translate_ip_params*/
+
+};
+
+struct _vcs_dpi_soc_bounding_box_st dcn3_5_soc = {
+ /*TODO: correct dispclk/dppclk voltage level determination*/
+ .clock_limits = {
+ {
+ .state = 0,
+ .dispclk_mhz = 1200.0,
+ .dppclk_mhz = 1200.0,
+ .phyclk_mhz = 600.0,
+ .phyclk_d18_mhz = 667.0,
+ .dscclk_mhz = 186.0,
+ .dtbclk_mhz = 600.0,
+ },
+ {
+ .state = 1,
+ .dispclk_mhz = 1200.0,
+ .dppclk_mhz = 1200.0,
+ .phyclk_mhz = 810.0,
+ .phyclk_d18_mhz = 667.0,
+ .dscclk_mhz = 209.0,
+ .dtbclk_mhz = 600.0,
+ },
+ {
+ .state = 2,
+ .dispclk_mhz = 1200.0,
+ .dppclk_mhz = 1200.0,
+ .phyclk_mhz = 810.0,
+ .phyclk_d18_mhz = 667.0,
+ .dscclk_mhz = 209.0,
+ .dtbclk_mhz = 600.0,
+ },
+ {
+ .state = 3,
+ .dispclk_mhz = 1200.0,
+ .dppclk_mhz = 1200.0,
+ .phyclk_mhz = 810.0,
+ .phyclk_d18_mhz = 667.0,
+ .dscclk_mhz = 371.0,
+ .dtbclk_mhz = 600.0,
+ },
+ {
+ .state = 4,
+ .dispclk_mhz = 1200.0,
+ .dppclk_mhz = 1200.0,
+ .phyclk_mhz = 810.0,
+ .phyclk_d18_mhz = 667.0,
+ .dscclk_mhz = 417.0,
+ .dtbclk_mhz = 600.0,
+ },
+ },
+ .num_states = 5,
+ .sr_exit_time_us = 14.0,
+ .sr_enter_plus_exit_time_us = 16.0,
+ .sr_exit_z8_time_us = 525.0,
+ .sr_enter_plus_exit_z8_time_us = 715.0,
+ .fclk_change_latency_us = 20.0,
+ .usr_retraining_latency_us = 2,
+ .writeback_latency_us = 12.0,
+
+ .dram_channel_width_bytes = 4,/*not exist in dml2*/
+ .round_trip_ping_latency_dcfclk_cycles = 106,/*not exist in dml2*/
+ .urgent_latency_pixel_data_only_us = 4.0,
+ .urgent_latency_pixel_mixed_with_vm_data_us = 4.0,
+ .urgent_latency_vm_data_only_us = 4.0,
+ .dram_clock_change_latency_us = 11.72,
+ .urgent_out_of_order_return_per_channel_pixel_only_bytes = 4096,
+ .urgent_out_of_order_return_per_channel_pixel_and_vm_bytes = 4096,
+ .urgent_out_of_order_return_per_channel_vm_only_bytes = 4096,
+
+ .pct_ideal_sdp_bw_after_urgent = 80.0,
+ .pct_ideal_fabric_bw_after_urgent = 80.0, /*new to dml2*/
+ .pct_ideal_dram_sdp_bw_after_urgent_pixel_only = 65.0,
+ .pct_ideal_dram_sdp_bw_after_urgent_pixel_and_vm = 60.0,
+ .pct_ideal_dram_sdp_bw_after_urgent_vm_only = 30.0,
+ .max_avg_sdp_bw_use_normal_percent = 60.0,
+ .max_avg_dram_bw_use_normal_percent = 60.0,
+ .fabric_datapath_to_dcn_data_return_bytes = 32,
+ .return_bus_width_bytes = 64,
+ .downspread_percent = 0.38,
+ .dcn_downspread_percent = 0.5,
+ .gpuvm_min_page_size_bytes = 4096,
+ .hostvm_min_page_size_bytes = 4096,
+ .do_urgent_latency_adjustment = 0,
+ .urgent_latency_adjustment_fabric_clock_component_us = 0,
+ .urgent_latency_adjustment_fabric_clock_reference_mhz = 0,
+};
+
+void dcn35_build_wm_range_table_fpu(struct clk_mgr *clk_mgr)
+{
+ //TODO
+}
+
+
+/*
+ * dcn35_update_bw_bounding_box
+ *
+ * This would override some dcn3_5 ip_or_soc initial parameters hardcoded from
+ * spreadsheet with actual values as per dGPU SKU:
+ * - with passed few options from dc->config
+ * - with dentist_vco_frequency from Clk Mgr (currently hardcoded, but might
+ * need to get it from PM FW)
+ * - with passed latency values (passed in ns units) in dc-> bb override for
+ * debugging purposes
+ * - with passed latencies from VBIOS (in 100_ns units) if available for
+ * certain dGPU SKU
+ * - with number of DRAM channels from VBIOS (which differ for certain dGPU SKU
+ * of the same ASIC)
+ * - clocks levels with passed clk_table entries from Clk Mgr as reported by PM
+ * FW for different clocks (which might differ for certain dGPU SKU of the
+ * same ASIC)
+ */
+void dcn35_update_bw_bounding_box_fpu(struct dc *dc,
+ struct clk_bw_params *bw_params)
+{
+ unsigned int i, closest_clk_lvl;
+ int j;
+ struct clk_limit_table *clk_table = &bw_params->clk_table;
+ struct _vcs_dpi_voltage_scaling_st *clock_limits =
+ dc->scratch.update_bw_bounding_box.clock_limits;
+ int max_dispclk_mhz = 0, max_dppclk_mhz = 0;
+
+ dc_assert_fp_enabled();
+
+ dcn3_5_ip.max_num_otg =
+ dc->res_pool->res_cap->num_timing_generator;
+ dcn3_5_ip.max_num_dpp = dc->res_pool->pipe_count;
+ dcn3_5_soc.num_chans = bw_params->num_channels;
+
+ ASSERT(clk_table->num_entries);
+
+ /* Prepass to find max clocks independent of voltage level. */
+ for (i = 0; i < clk_table->num_entries; ++i) {
+ if (clk_table->entries[i].dispclk_mhz > max_dispclk_mhz)
+ max_dispclk_mhz = clk_table->entries[i].dispclk_mhz;
+ if (clk_table->entries[i].dppclk_mhz > max_dppclk_mhz)
+ max_dppclk_mhz = clk_table->entries[i].dppclk_mhz;
+ }
+
+ for (i = 0; i < clk_table->num_entries; i++) {
+ /* loop backwards*/
+ for (closest_clk_lvl = 0, j = dcn3_5_soc.num_states - 1;
+ j >= 0; j--) {
+ if (dcn3_5_soc.clock_limits[j].dcfclk_mhz <=
+ clk_table->entries[i].dcfclk_mhz) {
+ closest_clk_lvl = j;
+ break;
+ }
+ }
+ if (clk_table->num_entries == 1) {
+ /*smu gives one DPM level, let's take the highest one*/
+ closest_clk_lvl = dcn3_5_soc.num_states - 1;
+ }
+
+ clock_limits[i].state = i;
+
+ /* Clocks dependent on voltage level. */
+ clock_limits[i].dcfclk_mhz = clk_table->entries[i].dcfclk_mhz;
+ if (clk_table->num_entries == 1 &&
+ clock_limits[i].dcfclk_mhz <
+ dcn3_5_soc.clock_limits[closest_clk_lvl].dcfclk_mhz) {
+ /*SMU fix not released yet*/
+ clock_limits[i].dcfclk_mhz =
+ dcn3_5_soc.clock_limits[closest_clk_lvl].dcfclk_mhz;
+ }
+
+ clock_limits[i].fabricclk_mhz =
+ clk_table->entries[i].fclk_mhz;
+ clock_limits[i].socclk_mhz =
+ clk_table->entries[i].socclk_mhz;
+
+ if (clk_table->entries[i].memclk_mhz &&
+ clk_table->entries[i].wck_ratio)
+ clock_limits[i].dram_speed_mts =
+ clk_table->entries[i].memclk_mhz * 2 *
+ clk_table->entries[i].wck_ratio;
+
+ /* Clocks independent of voltage level. */
+ clock_limits[i].dispclk_mhz = max_dispclk_mhz ?
+ max_dispclk_mhz :
+ dcn3_5_soc.clock_limits[closest_clk_lvl].dispclk_mhz;
+
+ clock_limits[i].dppclk_mhz = max_dppclk_mhz ?
+ max_dppclk_mhz :
+ dcn3_5_soc.clock_limits[closest_clk_lvl].dppclk_mhz;
+
+ clock_limits[i].dram_bw_per_chan_gbps =
+ dcn3_5_soc.clock_limits[closest_clk_lvl].dram_bw_per_chan_gbps;
+ clock_limits[i].dscclk_mhz =
+ dcn3_5_soc.clock_limits[closest_clk_lvl].dscclk_mhz;
+ clock_limits[i].dtbclk_mhz =
+ dcn3_5_soc.clock_limits[closest_clk_lvl].dtbclk_mhz;
+ clock_limits[i].phyclk_d18_mhz =
+ dcn3_5_soc.clock_limits[closest_clk_lvl].phyclk_d18_mhz;
+ clock_limits[i].phyclk_mhz =
+ dcn3_5_soc.clock_limits[closest_clk_lvl].phyclk_mhz;
+ }
+
+ memcpy(dcn3_5_soc.clock_limits, clock_limits,
+ sizeof(dcn3_5_soc.clock_limits));
+
+ if (clk_table->num_entries)
+ dcn3_5_soc.num_states = clk_table->num_entries;
+
+ if (max_dispclk_mhz) {
+ dcn3_5_soc.dispclk_dppclk_vco_speed_mhz = max_dispclk_mhz * 2;
+ dc->dml.soc.dispclk_dppclk_vco_speed_mhz = max_dispclk_mhz * 2;
+ }
+ if ((int)(dcn3_5_soc.dram_clock_change_latency_us * 1000)
+ != dc->debug.dram_clock_change_latency_ns
+ && dc->debug.dram_clock_change_latency_ns) {
+ dcn3_5_soc.dram_clock_change_latency_us =
+ dc->debug.dram_clock_change_latency_ns / 1000.0;
+ }
+ /*temp till dml2 fully work without dml1*/
+ dml_init_instance(&dc->dml, &dcn3_5_soc, &dcn3_5_ip,
+ DML_PROJECT_DCN31);
+
+ /*copy to dml2, before dml2_create*/
+ if (clk_table->num_entries > 2) {
+
+ for (i = 0; i < clk_table->num_entries; i++) {
+ dc->dml2_options.bbox_overrides.clks_table.num_states =
+ clk_table->num_entries;
+ dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].dcfclk_mhz =
+ clock_limits[i].dcfclk_mhz;
+ dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].fclk_mhz =
+ clock_limits[i].fabricclk_mhz;
+ dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].dispclk_mhz =
+ clock_limits[i].dispclk_mhz;
+ dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].dppclk_mhz =
+ clock_limits[i].dppclk_mhz;
+ dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].socclk_mhz =
+ clock_limits[i].socclk_mhz;
+ dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].memclk_mhz =
+ clk_table->entries[i].memclk_mhz * clk_table->entries[i].wck_ratio;
+ dc->dml2_options.bbox_overrides.clks_table.clk_entries[i].dtbclk_mhz =
+ clock_limits[i].dtbclk_mhz;
+ dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_dcfclk_levels =
+ clk_table->num_entries;
+ dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_fclk_levels =
+ clk_table->num_entries;
+ dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_dispclk_levels =
+ clk_table->num_entries;
+ dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_dppclk_levels =
+ clk_table->num_entries;
+ dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_socclk_levels =
+ clk_table->num_entries;
+ dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_memclk_levels =
+ clk_table->num_entries;
+ dc->dml2_options.bbox_overrides.clks_table.num_entries_per_clk.num_dtbclk_levels =
+ clk_table->num_entries;
+ }
+ }
+
+ /* Update latency values */
+ dc->dml2_options.bbox_overrides.dram_clock_change_latency_us = dcn3_5_soc.dram_clock_change_latency_us;
+
+ dc->dml2_options.bbox_overrides.sr_exit_latency_us = dcn3_5_soc.sr_exit_time_us;
+ dc->dml2_options.bbox_overrides.sr_enter_plus_exit_latency_us = dcn3_5_soc.sr_enter_plus_exit_time_us;
+
+ dc->dml2_options.bbox_overrides.sr_exit_z8_time_us = dcn3_5_soc.sr_exit_z8_time_us;
+ dc->dml2_options.bbox_overrides.sr_enter_plus_exit_z8_time_us = dcn3_5_soc.sr_enter_plus_exit_z8_time_us;
+}
+
+static bool is_dual_plane(enum surface_pixel_format format)
+{
+ return format >= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN ||
+ format == SURFACE_PIXEL_FORMAT_GRPH_RGBE_ALPHA;
+}
+
+/*
+ * micro_sec_to_vert_lines () - converts time to number of vertical lines for a given timing
+ *
+ * @param: num_us: number of microseconds
+ * @return: number of vertical lines. If exact number of vertical lines is not found then
+ * it will round up to next number of lines to guarantee num_us
+ */
+static unsigned int micro_sec_to_vert_lines(unsigned int num_us, struct dc_crtc_timing *timing)
+{
+ unsigned int num_lines = 0;
+ unsigned int lines_time_in_ns = 1000.0 *
+ (((float)timing->h_total * 1000.0) /
+ ((float)timing->pix_clk_100hz / 10.0));
+
+ num_lines = dml_ceil(1000.0 * num_us / lines_time_in_ns, 1.0);
+
+ return num_lines;
+}
+
+static unsigned int get_vertical_back_porch(struct dc_crtc_timing *timing)
+{
+ unsigned int v_active = 0, v_blank = 0, v_back_porch = 0;
+
+ v_active = timing->v_border_top + timing->v_addressable + timing->v_border_bottom;
+ v_blank = timing->v_total - v_active;
+ v_back_porch = v_blank - timing->v_front_porch - timing->v_sync_width;
+
+ return v_back_porch;
+}
+
+int dcn35_populate_dml_pipes_from_context_fpu(struct dc *dc,
+ struct dc_state *context,
+ display_e2e_pipe_params_st *pipes,
+ bool fast_validate)
+{
+ int i, pipe_cnt;
+ struct resource_context *res_ctx = &context->res_ctx;
+ struct pipe_ctx *pipe;
+ bool upscaled = false;
+ const unsigned int max_allowed_vblank_nom = 1023;
+
+ dcn31_populate_dml_pipes_from_context(dc, context, pipes,
+ fast_validate);
+
+ for (i = 0, pipe_cnt = 0; i < dc->res_pool->pipe_count; i++) {
+ struct dc_crtc_timing *timing;
+ unsigned int num_lines = 0;
+ unsigned int v_back_porch = 0;
+
+ if (!res_ctx->pipe_ctx[i].stream)
+ continue;
+
+ pipe = &res_ctx->pipe_ctx[i];
+ timing = &pipe->stream->timing;
+
+ num_lines = micro_sec_to_vert_lines(dcn3_5_ip.VBlankNomDefaultUS, timing);
+ v_back_porch = get_vertical_back_porch(timing);
+
+ if (pipe->stream->adjust.v_total_max ==
+ pipe->stream->adjust.v_total_min &&
+ pipe->stream->adjust.v_total_min > timing->v_total) {
+ pipes[pipe_cnt].pipe.dest.vtotal =
+ pipe->stream->adjust.v_total_min;
+ pipes[pipe_cnt].pipe.dest.vblank_nom = timing->v_total -
+ pipes[pipe_cnt].pipe.dest.vactive;
+ }
+
+ pipes[pipe_cnt].pipe.dest.vblank_nom = timing->v_total - pipes[pipe_cnt].pipe.dest.vactive;
+ pipes[pipe_cnt].pipe.dest.vblank_nom = min(pipes[pipe_cnt].pipe.dest.vblank_nom, num_lines);
+ // vblank_nom should not smaller than (VSync (timing->v_sync_width + v_back_porch) + 2)
+ // + 2 is because
+ // 1 -> VStartup_start should be 1 line before VSync
+ // 1 -> always reserve 1 line between start of vblank to vstartup signal
+ pipes[pipe_cnt].pipe.dest.vblank_nom =
+ max(pipes[pipe_cnt].pipe.dest.vblank_nom, timing->v_sync_width + v_back_porch + 2);
+ pipes[pipe_cnt].pipe.dest.vblank_nom = min(pipes[pipe_cnt].pipe.dest.vblank_nom, max_allowed_vblank_nom);
+
+ if (pipe->plane_state &&
+ (pipe->plane_state->src_rect.height <
+ pipe->plane_state->dst_rect.height ||
+ pipe->plane_state->src_rect.width <
+ pipe->plane_state->dst_rect.width))
+ upscaled = true;
+
+ /*
+ * Immediate flip can be set dynamically after enabling the
+ * plane. We need to require support for immediate flip or
+ * underflow can be intermittently experienced depending on peak
+ * b/w requirements.
+ */
+ pipes[pipe_cnt].pipe.src.immediate_flip = true;
+
+ pipes[pipe_cnt].pipe.src.unbounded_req_mode = false;
+
+ DC_FP_START();
+ dcn31_zero_pipe_dcc_fraction(pipes, pipe_cnt);
+ DC_FP_END();
+
+ pipes[pipe_cnt].pipe.dest.vfront_porch = timing->v_front_porch;
+ pipes[pipe_cnt].pipe.src.dcc_rate = 3;
+ pipes[pipe_cnt].dout.dsc_input_bpc = 0;
+ pipes[pipe_cnt].pipe.src.gpuvm_min_page_size_kbytes = 256;
+
+ if (pipes[pipe_cnt].dout.dsc_enable) {
+ switch (timing->display_color_depth) {
+ case COLOR_DEPTH_888:
+ pipes[pipe_cnt].dout.dsc_input_bpc = 8;
+ break;
+ case COLOR_DEPTH_101010:
+ pipes[pipe_cnt].dout.dsc_input_bpc = 10;
+ break;
+ case COLOR_DEPTH_121212:
+ pipes[pipe_cnt].dout.dsc_input_bpc = 12;
+ break;
+ default:
+ ASSERT(0);
+ break;
+ }
+ }
+
+ pipe_cnt++;
+ }
+
+ context->bw_ctx.dml.ip.det_buffer_size_kbytes = 384;/*per guide*/
+ dc->config.enable_4to1MPC = false;
+
+ if (pipe_cnt == 1 && pipe->plane_state && !dc->debug.disable_z9_mpc) {
+ if (is_dual_plane(pipe->plane_state->format)
+ && pipe->plane_state->src_rect.width <= 1920 &&
+ pipe->plane_state->src_rect.height <= 1080) {
+ dc->config.enable_4to1MPC = true;
+ } else if (!is_dual_plane(pipe->plane_state->format) &&
+ pipe->plane_state->src_rect.width <= 5120) {
+ /*
+ * Limit to 5k max to avoid forced pipe split when there
+ * is not enough detile for swath
+ */
+ context->bw_ctx.dml.ip.det_buffer_size_kbytes = 192;
+ pipes[0].pipe.src.unbounded_req_mode = true;
+ }
+ } else if (context->stream_count >=
+ dc->debug.crb_alloc_policy_min_disp_count &&
+ dc->debug.crb_alloc_policy > DET_SIZE_DEFAULT) {
+ context->bw_ctx.dml.ip.det_buffer_size_kbytes =
+ dc->debug.crb_alloc_policy * 64;
+ } else if (context->stream_count >= 3 && upscaled) {
+ context->bw_ctx.dml.ip.det_buffer_size_kbytes = 192;
+ }
+
+ for (i = 0; i < dc->res_pool->pipe_count; i++) {
+ struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
+
+ if (!pipe->stream)
+ continue;
+
+ if (pipe->stream->signal == SIGNAL_TYPE_EDP &&
+ dc->debug.seamless_boot_odm_combine &&
+ pipe->stream->apply_seamless_boot_optimization) {
+
+ if (pipe->stream->apply_boot_odm_mode ==
+ dm_odm_combine_policy_2to1) {
+ context->bw_ctx.dml.vba.ODMCombinePolicy =
+ dm_odm_combine_policy_2to1;
+ break;
+ }
+ }
+ }
+
+ return pipe_cnt;
+}
+
+void dcn35_decide_zstate_support(struct dc *dc, struct dc_state *context)
+{
+ enum dcn_zstate_support_state support = DCN_ZSTATE_SUPPORT_DISALLOW;
+ unsigned int i, plane_count = 0;
+
+ for (i = 0; i < dc->res_pool->pipe_count; i++) {
+ if (context->res_ctx.pipe_ctx[i].plane_state)
+ plane_count++;
+ }
+
+ if (plane_count == 0) {
+ support = DCN_ZSTATE_SUPPORT_ALLOW;
+ } else if (plane_count == 1 && context->stream_count == 1 && context->streams[0]->signal == SIGNAL_TYPE_EDP) {
+ struct dc_link *link = context->streams[0]->sink->link;
+ bool is_pwrseq0 = link && link->link_index == 0;
+ bool is_psr1 = link && link->psr_settings.psr_version == DC_PSR_VERSION_1 && !link->panel_config.psr.disable_psr;
+ int minmum_z8_residency =
+ dc->debug.minimum_z8_residency_time > 0 ? dc->debug.minimum_z8_residency_time : 1000;
+ bool allow_z8 = context->bw_ctx.dml.vba.StutterPeriod > (double)minmum_z8_residency;
+ int minmum_z10_residency =
+ dc->debug.minimum_z10_residency_time > 0 ? dc->debug.minimum_z10_residency_time : 5000;
+ bool allow_z10 = context->bw_ctx.dml.vba.StutterPeriod > (double)minmum_z10_residency;
+
+ if (is_pwrseq0 && allow_z10)
+ support = DCN_ZSTATE_SUPPORT_ALLOW;
+ else if (is_pwrseq0 && is_psr1)
+ support = allow_z8 ? DCN_ZSTATE_SUPPORT_ALLOW_Z8_Z10_ONLY : DCN_ZSTATE_SUPPORT_ALLOW_Z10_ONLY;
+ else if (allow_z8)
+ support = DCN_ZSTATE_SUPPORT_ALLOW_Z8_ONLY;
+ }
+
+ context->bw_ctx.bw.dcn.clk.zstate_support = support;
+}
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.h b/drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.h
new file mode 100644
index 000000000..067480fc3
--- /dev/null
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.h
@@ -0,0 +1,44 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright 2023 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 __DCN35_FPU_H__
+#define __DCN35_FPU_H__
+
+#include "clk_mgr.h"
+
+void dcn35_build_wm_range_table_fpu(struct clk_mgr *clk_mgr);
+
+void dcn35_update_bw_bounding_box_fpu(struct dc *dc,
+ struct clk_bw_params *bw_params);
+
+int dcn35_populate_dml_pipes_from_context_fpu(struct dc *dc,
+ struct dc_state *context,
+ display_e2e_pipe_params_st *pipes,
+ bool fast_validate);
+
+void dcn35_decide_zstate_support(struct dc *dc, struct dc_state *context);
+
+#endif