DC Linux Patches Jun 26, 2017
Subsystems (3)
cover DC Linux Patches Jun 26, 2017
* Global lock to properly lock DC commits
* Fix single MST support (atomic_get_property missing)
* IGT fix for multi-plane configurations
* Updated DCN bandwidth formula
* Bunch of minor fixes
Andrey Grodzovsky (5):
drm/amd/display: MST atomic_get_property missing. drm/amd/display: Add global lock function. drm/amd/display: Remove check update type function. drm/amd/display: Refine globallock. drm/amd/display: Global lock typos fix.
Charlene Liu (1):
drm/amd/display: w/a no color space info for HDMI when build AVI
Dmytro Laktyushkin (4):
drm/amd/display: use different sr latencies for dpm0 dcn bw calc drm/amd/display: make variable latency into a regkey option drm/amd/display: dcn bw_calc_auto update rev 247 to 250 drm/amd/display: fix bw_calc_auto translation error
Harry Wentland (1):
drm/amd/display: Don't program scaler if we have no surface
Leo (Sunpeng) Li (1):
drm/amd/display: Workaround IGT multiplane restriction
Yongqiang Sun (1):
drm/amd/display: Disable pipe split.
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 +- .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 3 +- .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 149 +- .../gpu/drm/amd/display/dc/calcs/dcn_calc_auto.c | 3535 +++++--------------- drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 23 + drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 3 + drivers/gpu/drm/amd/display/dc/dc.h | 2 + .../amd/display/dc/dce110/dce110_hw_sequencer.c | 8 +- .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 2 +- 9 files changed, 1011 insertions(+), 2728 deletions(-)
Signature · 6 lines
2.11.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20170626205530.25131-1-harry.wentland-5C7GfCeVMHo@public.gmane.org
PATCH 1/13 drm/amd/display: MST atomic_get_property missing.
From: Andrey Grodzovsky <[email protected]>
Missing function implementation was leading to EINVAL in UMD thus not adding MST connector to X topology and hence not getting set mode for it.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +2 -1
@@ -170,7 +170,8 @@ static const struct drm_connector_funcs dm_dp_mst_connector_funcs = { .set_property = drm_atomic_helper_connector_set_property, .atomic_duplicate_state = amdgpu_dm_connector_atomic_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, - .atomic_set_property = amdgpu_dm_connector_atomic_set_property + .atomic_set_property = amdgpu_dm_connector_atomic_set_property, + .atomic_get_property = amdgpu_dm_connector_atomic_get_property };static int dm_dp_mst_get_modes (struct drm_connector *connector)
Signature · 6 lines
2.11.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/13 drm/amd/display: Add global lock function.
In reply to a message not in the archiveFrom: Andrey Grodzovsky <[email protected]>
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 66 ++++++++++++++++------ 1 file changed, 49 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +49 -17
@@ -3021,6 +3021,49 @@ static enum surface_update_type amdgpu_dm_check_surfaces_update_type(return update_type; } +/*` +* Grabs all modesetting locks to serialize against any blocking commits, +* Waits for completion of all non blocking commits. +*/ +static void aquire_global_lock ( +struct drm_device *dev, +struct drm_atomic_state *state) +{ +struct drm_crtc *crtc; +struct drm_crtc_commit *commit; +long ret; + +/* Adding all modeset locks to aquire_ctx will +* ensure that when the framework release it the +* extra locks we are locking here will get released to +*/ +drm_modeset_lock_all_ctx (dev, state->acquire_ctx); + +list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) { +spin_lock (&crtc->commit_lock); + commit =list_first_entry_or_null (&crtc->commit_list, + struct drm_crtc_commit, commit_entry); +if (commit) +drm_crtc_commit_get (commit); +spin_unlock (&crtc->commit_lock); + +if (!commit) +continue ; + +/* Make sure all pending HW programming completed and +* page flips done +*/ + ret =wait_for_completion_timeout (&commit->hw_done, +10 *HZ ); + ret =wait_for_completion_timeout (&commit->flip_done, +10 *HZ ); +if (ret ==0 ) +DRM_ERROR ("[CRTC:%d:%s] hw_done timed out\n" , + crtc->base.id, crtc->name); +drm_crtc_commit_put (commit); + } +} +int amdgpu_dm_atomic_check (struct drm_device *dev,struct drm_atomic_state *state) {
@@ -3277,7 +3320,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, dc, set[i].surfaces, set[i].surface_count, - set[i].stream) > UPDATE_TYPE_MED) { + set[i].stream) > UPDATE_TYPE_FAST) { wait_for_prev_commits = true;break ; }
@@ -3291,25 +3334,14 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,* For full updates case when * removing/adding/updateding streams on once CRTC while flipping * on another CRTC, -* Adding all current active CRTC's states to the atomic commit in -* amdgpu_dm_atomic_check will guarantee that any such full update commit +* acquiring global lock will guarantee that any such full +* update commit * will wait for completion of any outstanding flip using DRMs * synchronization events. */ -if (wait_for_prev_commits) { -list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) { -struct amdgpu_crtc *acrtc =to_amdgpu_crtc (crtc); -struct drm_crtc_state *crtc_state; - -if (acrtc->stream) { - crtc_state =drm_atomic_get_crtc_state (state, crtc); -if (IS_ERR (crtc_state)) { - ret =PTR_ERR (crtc_state); -break ; - } - } - } - } +if (wait_for_prev_commits) +aquire_global_lock (dev, state); + }if (context) {
Signature · 6 lines
2.11.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/13 drm/amd/display: Remove check update type function.
In reply to a message not in the archiveFrom: Andrey Grodzovsky <[email protected]>
Due to using dc_commit_surface_to_stream instead of build stream and surface updates any surface commit today is evlauted to full. Until we fix this and can corretly evluate type of surface update, anything which is not page flip or cursor update will be treted as full update chnage and global lock will be aquired.
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 80 +++------------------- 1 file changed, 8 insertions(+), 72 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +8 -72
@@ -2969,63 +2969,11 @@ static uint32_t remove_from_val_sets(return set_count; } - -static enum surface_update_type amdgpu_dm_check_surfaces_update_type ( -struct dc *dc, -const struct dc_surface **new_surfaces, -uint8_t new_surface_count, -const struct dc_stream *dc_stream) -{ -struct dc_surface_update srf_updates[MAX_SURFACES ]; -struct dc_flip_addrs flip_addr[MAX_SURFACES ]; -struct dc_plane_info plane_info[MAX_SURFACES ]; -struct dc_scaling_info scaling_info[MAX_SURFACES ]; -int i; -const struct dc_stream_status *stream_status = -dc_stream_get_status (dc_stream); -enum surface_update_type update_type; - -memset (srf_updates,0 ,sizeof (srf_updates)); -memset (flip_addr,0 ,sizeof (flip_addr)); -memset (plane_info,0 ,sizeof (plane_info)); -memset (scaling_info,0 ,sizeof (scaling_info)); - -for (i =0 ; i < new_surface_count; i++) { - srf_updates[i].surface = new_surfaces[i]; - srf_updates[i].gamma = - (struct dc_gamma *)new_surfaces[i]->gamma_correction; - flip_addr[i].address = new_surfaces[i]->address; - flip_addr[i].flip_immediate = new_surfaces[i]->flip_immediate; - plane_info[i].color_space = new_surfaces[i]->color_space; - plane_info[i].format = new_surfaces[i]->format; - plane_info[i].plane_size = new_surfaces[i]->plane_size; - plane_info[i].rotation = new_surfaces[i]->rotation; - plane_info[i].horizontal_mirror = new_surfaces[i]->horizontal_mirror; - plane_info[i].stereo_format = new_surfaces[i]->stereo_format; - plane_info[i].tiling_info = new_surfaces[i]->tiling_info; - plane_info[i].visible = new_surfaces[i]->visible; - plane_info[i].dcc = new_surfaces[i]->dcc; - scaling_info[i].scaling_quality = new_surfaces[i]->scaling_quality; - scaling_info[i].src_rect = new_surfaces[i]->src_rect; - scaling_info[i].dst_rect = new_surfaces[i]->dst_rect; - scaling_info[i].clip_rect = new_surfaces[i]->clip_rect; - - srf_updates[i].flip_addr = &flip_addr[i]; - srf_updates[i].plane_info = &plane_info[i]; - srf_updates[i].scaling_info = &scaling_info[i]; - } - - update_type =dc_check_update_surfaces_for_stream ( - dc, srf_updates, new_surface_count,NULL , stream_status); - -return update_type; -} -/*` * Grabs all modesetting locks to serialize against any blocking commits, * Waits for completion of all non blocking commits. */ -static void aquire_global_lock ( +static void do_aquire_global_lock (struct drm_device *dev,struct drm_atomic_state *state) {
@@ -3088,7 +3036,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,* This bool will be set for true for any modeset/reset * or surface update which implies non fast surfae update. */ -bool wait_for_prev_commits = false; +bool aquire_global_lock = false; ret =drm_atomic_helper_check (dev, state);
@@ -3173,7 +3121,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, new_stream_count++; need_to_validate = true; - wait_for_prev_commits = true; + aquire_global_lock = true; }else if (modereset_required (crtc_state)) {
@@ -3183,7 +3131,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, set, set_count, acrtc->stream); - wait_for_prev_commits = true; + aquire_global_lock = true; } }
@@ -3242,7 +3190,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, new_stream_count++; need_to_validate = true; - wait_for_prev_commits = true; + aquire_global_lock = true; }for (i =0 ; i < set_count; i++) {
@@ -3308,25 +3256,13 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, surface); need_to_validate = true; + aquire_global_lock = true; } } } context =dc_get_validate_context (dc, set, set_count); -for (i =0 ; i < set_count; i++) { -for (j =0 ; j < set[i].surface_count; j++) { -if (amdgpu_dm_check_surfaces_update_type ( - dc, - set[i].surfaces, - set[i].surface_count, - set[i].stream) >UPDATE_TYPE_FAST ) { - wait_for_prev_commits = true; -break ; - } - } - } -if (need_to_validate == false || set_count ==0 || context) { ret =0 ;
@@ -3339,8 +3275,8 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,* will wait for completion of any outstanding flip using DRMs * synchronization events. */ -if (wait_for_prev_commits) -aquire_global_lock (dev, state); +if (aquire_global_lock) +do_aquire_global_lock (dev, state); }
Signature · 6 lines
2.11.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/13 drm/amd/display: use different sr latencies for dpm0 dcn bw calc
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
--- drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +18 -0
@@ -906,6 +906,16 @@ bool dcn_validate_bandwidth(scaler_settings_calculation (v);mode_support_and_system_configuration (v); +if (v->voltage_level ==0 ) { +struct core_dc *dc_core =DC_TO_CORE (&dc->public); + + v->sr_enter_plus_exit_time =9.466f ; + v->sr_exit_time =7.849f ; + dc_core->dml.soc.sr_enter_plus_exit_time_us = v->sr_enter_plus_exit_time; + dc_core->dml.soc.sr_exit_time_us = v->sr_exit_time; +mode_support_and_system_configuration (v); + } +if (v->voltage_level !=5 ) {float bw_consumed = v->total_bandwidth_consumed_gbyte_per_second;if (bw_consumed < v->fabric_and_dram_bandwidth_vmin0p65)
@@ -1013,6 +1023,14 @@ bool dcn_validate_bandwidth( &dc->dml, context, pool); } +if (v->voltage_level ==0 ) { +struct core_dc *dc_core =DC_TO_CORE (&dc->public); + + dc_core->dml.soc.sr_enter_plus_exit_time_us = + dc_core->dcn_soc.sr_enter_plus_exit_time; + dc_core->dml.soc.sr_exit_time_us = dc_core->dcn_soc.sr_exit_time; + } +kernel_fpu_end ();return v->voltage_level !=5 ; }
Signature · 6 lines
2.11.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/13 drm/amd/display: make variable latency into a regkey option
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
--- drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 11 ++++++++--- drivers/gpu/drm/amd/display/dc/dc.h | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c +8 -3
@@ -906,11 +906,16 @@ bool dcn_validate_bandwidth(scaler_settings_calculation (v);mode_support_and_system_configuration (v); -if (v->voltage_level ==0 ) { +if (v->voltage_level ==0 && + (dc->public.debug.sr_exit_time_dpm0_ns + || dc->public.debug.sr_enter_plus_exit_time_dpm0_ns)) {struct core_dc *dc_core =DC_TO_CORE (&dc->public); - v->sr_enter_plus_exit_time =9.466f ; - v->sr_exit_time =7.849f ; +if (dc->public.debug.sr_enter_plus_exit_time_dpm0_ns) + v->sr_enter_plus_exit_time = + dc->public.debug.sr_enter_plus_exit_time_dpm0_ns /1000.0f ; +if (dc->public.debug.sr_exit_time_dpm0_ns) + v->sr_exit_time = dc->public.debug.sr_exit_time_dpm0_ns /1000.0f ; dc_core->dml.soc.sr_enter_plus_exit_time_us = v->sr_enter_plus_exit_time; dc_core->dml.soc.sr_exit_time_us = v->sr_exit_time;mode_support_and_system_configuration (v);
drivers/gpu/drm/amd/display/dc/dc.h +2 -0
@@ -171,6 +171,8 @@ struct dc_debug {bool disable_pplib_wm_range;bool use_dml_wm;bool disable_pipe_split; +int sr_exit_time_dpm0_ns; +int sr_enter_plus_exit_time_dpm0_ns;int sr_exit_time_ns;int sr_enter_plus_exit_time_ns;int urgent_latency_ns;
Signature · 6 lines
2.11.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/13 drm/amd/display: dcn bw_calc_auto update rev 247 to 250
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
--- .../gpu/drm/amd/display/dc/calcs/dcn_calc_auto.c | 3535 +++++--------------- 1 file changed, 897 insertions(+), 2638 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.c +897 -2638
@@ -27,32 +27,27 @@#include "dcn_calc_auto.h" #include "dcn_calc_math.h" -/*REVISION#247*/ +/*REVISION#250*/ void scaler_settings_calculation (struct dcn_bw_internal_vars *v) {int k; -/*scaler settings calculation*/ - -/*scale ratio calculation*/ -for (k =0 ; k <= v->number_of_active_planes -1 ; k++) {if (v->allow_different_hratio_vratio == dcn_bw_yes) {if (v->source_scan[k] == dcn_bw_hor) { v->h_ratio[k] = v->viewport_width[k] / v->scaler_rec_out_width[k]; v->v_ratio[k] = v->viewport_height[k] / v->scaler_recout_height[k]; - }else { + } +else { v->h_ratio[k] = v->viewport_height[k] / v->scaler_rec_out_width[k]; v->v_ratio[k] = v->viewport_width[k] / v->scaler_recout_height[k]; } - }else { + } +else {if (v->source_scan[k] == dcn_bw_hor) { - v->h_ratio[k] =dcn_bw_max2 ( - v->viewport_width[k] / v->scaler_rec_out_width[k], - v->viewport_height[k] / v->scaler_recout_height[k]); - }else { - v->h_ratio[k] =dcn_bw_max2 ( - v->viewport_height[k] / v->scaler_rec_out_width[k], - v->viewport_width[k] / v->scaler_recout_height[k]); + v->h_ratio[k] =dcn_bw_max2 (v->viewport_width[k] / v->scaler_rec_out_width[k], v->viewport_height[k] / v->scaler_recout_height[k]); + } +else { + v->h_ratio[k] =dcn_bw_max2 (v->viewport_height[k] / v->scaler_rec_out_width[k], v->viewport_width[k] / v->scaler_recout_height[k]); } v->v_ratio[k] = v->h_ratio[k]; }
@@ -68,66 +63,64 @@ void scaler_settings_calculation(struct dcn_bw_internal_vars *v)for (k =0 ; k <= v->number_of_active_planes -1 ; k++) {if (v->h_ratio[k] >1.0 ) { - v->acceptable_quality_hta_ps =dcn_bw_min2 ( - v->max_hscl_taps, -2.0 *dcn_bw_ceil2 (v->h_ratio[k],1.0 )); - }else if (v->h_ratio[k] <1.0 ) { + v->acceptable_quality_hta_ps =dcn_bw_min2 (v->max_hscl_taps,2.0 *dcn_bw_ceil2 (v->h_ratio[k],1.0 )); + } +else if (v->h_ratio[k] <1.0 ) { v->acceptable_quality_hta_ps =4.0 ; - }else { + } +else { v->acceptable_quality_hta_ps =1.0 ; }if (v->ta_pscalculation == dcn_bw_override) { v->htaps[k] = v->override_hta_ps[k]; - }else { + } +else { v->htaps[k] = v->acceptable_quality_hta_ps; }if (v->v_ratio[k] >1.0 ) { - v->acceptable_quality_vta_ps =dcn_bw_min2 ( - v->max_vscl_taps, -2.0 *dcn_bw_ceil2 (v->v_ratio[k],1.0 )); - }else if (v->v_ratio[k] <1.0 ) { + v->acceptable_quality_vta_ps =dcn_bw_min2 (v->max_vscl_taps,2.0 *dcn_bw_ceil2 (v->v_ratio[k],1.0 )); + } +else if (v->v_ratio[k] <1.0 ) { v->acceptable_quality_vta_ps =4.0 ; - }else { + } +else { v->acceptable_quality_vta_ps =1.0 ; }if (v->ta_pscalculation == dcn_bw_override) { v->vtaps[k] = v->override_vta_ps[k]; - }else { + } +else { v->vtaps[k] = v->acceptable_quality_vta_ps; } -if (v->source_pixel_format[k] == dcn_bw_rgb_sub_64 - || v->source_pixel_format[k] == dcn_bw_rgb_sub_32 - || v->source_pixel_format[k] == dcn_bw_rgb_sub_16) { +if (v->source_pixel_format[k] == dcn_bw_rgb_sub_64 || v->source_pixel_format[k] == dcn_bw_rgb_sub_32 || v->source_pixel_format[k] == dcn_bw_rgb_sub_16) { v->vta_pschroma[k] =0.0 ; v->hta_pschroma[k] =0.0 ; - }else { + } +else {if (v->ta_pscalculation == dcn_bw_override) { v->vta_pschroma[k] = v->override_vta_pschroma[k]; v->hta_pschroma[k] = v->override_hta_pschroma[k]; - }else { + } +else { v->vta_pschroma[k] = v->acceptable_quality_vta_ps; v->hta_pschroma[k] = v->acceptable_quality_hta_ps; } } } } +void mode_support_and_system_configuration (struct dcn_bw_internal_vars *v) { -int i, j, k; +int i; +int j; +int k;/*mode support, voltage state and soc configuration*/ /*scale ratio support check*/ v->scale_ratio_support = dcn_bw_yes;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) { -if (v->h_ratio[k] > v->max_hscl_ratio || v->v_ratio[k] > v->max_vscl_ratio - || v->h_ratio[k] > v->htaps[k] || v->v_ratio[k] > v->vtaps[k] - || (v->source_pixel_format[k] != dcn_bw_rgb_sub_64 - && v->source_pixel_format[k] != dcn_bw_rgb_sub_32 - && v->source_pixel_format[k] != dcn_bw_rgb_sub_16 - && (v->h_ratio[k] /2.0 > v->hta_pschroma[k] - || v->v_ratio[k] /2.0 - > v->vta_pschroma[k]))) { +if (v->h_ratio[k] > v->max_hscl_ratio || v->v_ratio[k] > v->max_vscl_ratio || v->h_ratio[k] > v->htaps[k] || v->v_ratio[k] > v->vtaps[k] || (v->source_pixel_format[k] != dcn_bw_rgb_sub_64 && v->source_pixel_format[k] != dcn_bw_rgb_sub_32 && v->source_pixel_format[k] != dcn_bw_rgb_sub_16 && (v->h_ratio[k] /2.0 > v->hta_pschroma[k] || v->v_ratio[k] /2.0 > v->vta_pschroma[k]))) { v->scale_ratio_support = dcn_bw_no; } }
@@ -135,16 +128,7 @@ void mode_support_and_system_configuration(struct dcn_bw_internal_vars *v) v->source_format_pixel_and_scan_support = dcn_bw_yes;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) { -if ((v->source_surface_mode[k] == dcn_bw_sw_linear - && v->source_scan[k] != dcn_bw_hor) - || ((v->source_surface_mode[k] == dcn_bw_sw_4_kb_d - || v->source_surface_mode[k] == dcn_bw_sw_4_kb_d_x - || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d - || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d_t - || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d_x - || v->source_surface_mode[k] == dcn_bw_sw_var_d - || v->source_surface_mode[k] == dcn_bw_sw_var_d_x) - && v->source_pixel_format[k] != dcn_bw_rgb_sub_64)) { +if ((v->source_surface_mode[k] == dcn_bw_sw_linear && !v->source_scan[k] == dcn_bw_hor) || ((v->source_surface_mode[k] == dcn_bw_sw_4_kb_d || v->source_surface_mode[k] == dcn_bw_sw_4_kb_d_x || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d_t || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d_x || v->source_surface_mode[k] == dcn_bw_sw_var_d || v->source_surface_mode[k] == dcn_bw_sw_var_d_x) && !v->source_pixel_format[k] == dcn_bw_rgb_sub_64)) { v->source_format_pixel_and_scan_support = dcn_bw_no; } }
@@ -153,77 +137,62 @@ void mode_support_and_system_configuration(struct dcn_bw_internal_vars *v)for (k =0 ; k <= v->number_of_active_planes -1 ; k++) {if (v->source_scan[k] == dcn_bw_hor) { v->swath_width_ysingle_dpp[k] = v->viewport_width[k]; - }else { + } +else { v->swath_width_ysingle_dpp[k] = v->viewport_height[k]; }if (v->source_pixel_format[k] == dcn_bw_rgb_sub_64) { v->byte_per_pixel_in_dety[k] =8.0 ; v->byte_per_pixel_in_detc[k] =0.0 ; - }else if (v->source_pixel_format[k] == dcn_bw_rgb_sub_32) { + } +else if (v->source_pixel_format[k] == dcn_bw_rgb_sub_32) { v->byte_per_pixel_in_dety[k] =4.0 ; v->byte_per_pixel_in_detc[k] =0.0 ; - }else if (v->source_pixel_format[k] == dcn_bw_rgb_sub_16) { + } +else if (v->source_pixel_format[k] == dcn_bw_rgb_sub_16) { v->byte_per_pixel_in_dety[k] =2.0 ; v->byte_per_pixel_in_detc[k] =0.0 ; - }else if (v->source_pixel_format[k] == dcn_bw_yuv420_sub_8) { + } +else if (v->source_pixel_format[k] == dcn_bw_yuv420_sub_8) { v->byte_per_pixel_in_dety[k] =1.0 ; v->byte_per_pixel_in_detc[k] =2.0 ; - }else { - v->byte_per_pixel_in_dety[k] =4.0f /3 ; - v->byte_per_pixel_in_detc[k] =8.0f /3 ; + } +else { + v->byte_per_pixel_in_dety[k] =4.0f /3.0f ; + v->byte_per_pixel_in_detc[k] =8.0f /3.0f ; } } v->total_read_bandwidth_consumed_gbyte_per_second =0.0 ;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) { - v->read_bandwidth[k] = v->swath_width_ysingle_dpp[k] - * (dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) * v->v_ratio[k] - +dcn_bw_ceil2 (v->byte_per_pixel_in_detc[k],2.0 ) /2.0 - * v->v_ratio[k] /2 ) - / (v->htotal[k] / v->pixel_clock[k]); + v->read_bandwidth[k] = v->swath_width_ysingle_dpp[k] * (dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) * v->v_ratio[k] +dcn_bw_ceil2 (v->byte_per_pixel_in_detc[k],2.0 ) /2.0 * v->v_ratio[k] /2 ) / (v->htotal[k] / v->pixel_clock[k]);if (v->dcc_enable[k] == dcn_bw_yes) { v->read_bandwidth[k] = v->read_bandwidth[k] * (1 +1 /256 ); } -if (v->pte_enable == dcn_bw_yes && v->source_scan[k] != dcn_bw_hor - && (v->source_surface_mode[k] == dcn_bw_sw_4_kb_s - || v->source_surface_mode[k] == dcn_bw_sw_4_kb_s_x - || v->source_surface_mode[k] == dcn_bw_sw_4_kb_d - || v->source_surface_mode[k] == dcn_bw_sw_4_kb_d_x)) { +if (v->pte_enable == dcn_bw_yes && v->source_scan[k] != dcn_bw_hor && (v->source_surface_mode[k] == dcn_bw_sw_4_kb_s || v->source_surface_mode[k] == dcn_bw_sw_4_kb_s_x || v->source_surface_mode[k] == dcn_bw_sw_4_kb_d || v->source_surface_mode[k] == dcn_bw_sw_4_kb_d_x)) { v->read_bandwidth[k] = v->read_bandwidth[k] * (1 +1 /64 ); - }else if (v->pte_enable == dcn_bw_yes && v->source_scan[k] == dcn_bw_hor - && (v->source_pixel_format[k] == dcn_bw_rgb_sub_64 - || v->source_pixel_format[k] == dcn_bw_rgb_sub_32) - && (v->source_surface_mode[k] == dcn_bw_sw_64_kb_s - || v->source_surface_mode[k] == dcn_bw_sw_64_kb_s_t - || v->source_surface_mode[k] == dcn_bw_sw_64_kb_s_x - || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d - || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d_t - || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d_x)) { + } +else if (v->pte_enable == dcn_bw_yes && v->source_scan[k] == dcn_bw_hor && (v->source_pixel_format[k] == dcn_bw_rgb_sub_64 || v->source_pixel_format[k] == dcn_bw_rgb_sub_32) && (v->source_surface_mode[k] == dcn_bw_sw_64_kb_s || v->source_surface_mode[k] == dcn_bw_sw_64_kb_s_t || v->source_surface_mode[k] == dcn_bw_sw_64_kb_s_x || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d_t || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d_x)) { v->read_bandwidth[k] = v->read_bandwidth[k] * (1 +1 /256 ); - }else if (v->pte_enable == dcn_bw_yes) { + } +else if (v->pte_enable == dcn_bw_yes) { v->read_bandwidth[k] = v->read_bandwidth[k] * (1 +1 /512 ); } - v->total_read_bandwidth_consumed_gbyte_per_second = - v->total_read_bandwidth_consumed_gbyte_per_second - + v->read_bandwidth[k] /1000.0 ; + v->total_read_bandwidth_consumed_gbyte_per_second = v->total_read_bandwidth_consumed_gbyte_per_second + v->read_bandwidth[k] /1000.0 ; } v->total_write_bandwidth_consumed_gbyte_per_second =0.0 ;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) {if (v->output[k] == dcn_bw_writeback && v->output_format[k] == dcn_bw_444) { - v->write_bandwidth[k] = v->scaler_rec_out_width[k] - / (v->htotal[k] / v->pixel_clock[k]) *4.0 ; - }else if (v->output[k] == dcn_bw_writeback) { - v->write_bandwidth[k] = v->scaler_rec_out_width[k] - / (v->htotal[k] / v->pixel_clock[k]) *1.5 ; - }else { + v->write_bandwidth[k] = v->scaler_rec_out_width[k] / (v->htotal[k] / v->pixel_clock[k]) *4.0 ; + } +else if (v->output[k] == dcn_bw_writeback) { + v->write_bandwidth[k] = v->scaler_rec_out_width[k] / (v->htotal[k] / v->pixel_clock[k]) *1.5 ; + } +else { v->write_bandwidth[k] =0.0 ; } - v->total_write_bandwidth_consumed_gbyte_per_second = - v->total_write_bandwidth_consumed_gbyte_per_second - + v->write_bandwidth[k] /1000.0 ; + v->total_write_bandwidth_consumed_gbyte_per_second = v->total_write_bandwidth_consumed_gbyte_per_second + v->write_bandwidth[k] /1000.0 ; } - v->total_bandwidth_consumed_gbyte_per_second = - v->total_read_bandwidth_consumed_gbyte_per_second - + v->total_write_bandwidth_consumed_gbyte_per_second; + v->total_bandwidth_consumed_gbyte_per_second = v->total_read_bandwidth_consumed_gbyte_per_second + v->total_write_bandwidth_consumed_gbyte_per_second; v->dcc_enabled_in_any_plane = dcn_bw_no;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) {if (v->dcc_enable[k] == dcn_bw_yes) {
@@ -231,119 +200,29 @@ void mode_support_and_system_configuration(struct dcn_bw_internal_vars *v) } }for (i =0 ; i <= number_of_states_plus_one; i++) { - v->return_bw_todcn_per_state = -dcn_bw_min2 ( - v->return_bus_width * v->dcfclk_per_state[i], - v->fabric_and_dram_bandwidth_per_state[i] *1000.0 - * v->percent_of_ideal_drambw_received_after_urg_latency - /100.0 ); + v->return_bw_todcn_per_state =dcn_bw_min2 (v->return_bus_width * v->dcfclk_per_state[i], v->fabric_and_dram_bandwidth_per_state[i] *1000.0 * v->percent_of_ideal_drambw_received_after_urg_latency /100.0 ); v->return_bw_per_state[i] = v->return_bw_todcn_per_state; -if (v->dcc_enabled_in_any_plane == dcn_bw_yes - && v->return_bw_todcn_per_state - > v->dcfclk_per_state[i] * v->return_bus_width - /4.0 ) { - v->return_bw_per_state[i] = -dcn_bw_min2 ( - v->return_bw_per_state[i], - v->return_bw_todcn_per_state *4.0 - * (1.0 - - v->urgent_latency - / ((v->rob_buffer_size_in_kbyte - - v->pixel_chunk_size_in_kbyte) - *1024.0 - / (v->return_bw_todcn_per_state - - v->dcfclk_per_state[i] - * v->return_bus_width - /4.0 ) - + v->urgent_latency))); - } - v->critical_point =2.0 * v->return_bus_width * v->dcfclk_per_state[i] - * v->urgent_latency - / (v->return_bw_todcn_per_state * v->urgent_latency - + (v->rob_buffer_size_in_kbyte - - v->pixel_chunk_size_in_kbyte) - *1024.0 ); -if (v->dcc_enabled_in_any_plane == dcn_bw_yes && v->critical_point >1.0 - && v->critical_point <4.0 ) { - v->return_bw_per_state[i] = -dcn_bw_min2 ( - v->return_bw_per_state[i], -dcn_bw_pow ( -4.0 - * v->return_bw_todcn_per_state - * (v->rob_buffer_size_in_kbyte - - v->pixel_chunk_size_in_kbyte) - *1024.0 - * v->return_bus_width - * v->dcfclk_per_state[i] - * v->urgent_latency - / (v->return_bw_todcn_per_state - * v->urgent_latency - + (v->rob_buffer_size_in_kbyte - - v->pixel_chunk_size_in_kbyte) - *1024.0 ), -2 )); - } - v->return_bw_todcn_per_state =dcn_bw_min2 ( - v->return_bus_width * v->dcfclk_per_state[i], - v->fabric_and_dram_bandwidth_per_state[i] *1000.0 ); -if (v->dcc_enabled_in_any_plane == dcn_bw_yes - && v->return_bw_todcn_per_state - > v->dcfclk_per_state[i] * v->return_bus_width - /4.0 ) { - v->return_bw_per_state[i] = -dcn_bw_min2 ( - v->return_bw_per_state[i], - v->return_bw_todcn_per_state *4.0 - * (1.0 - - v->urgent_latency - / ((v->rob_buffer_size_in_kbyte - - v->pixel_chunk_size_in_kbyte) - *1024.0 - / (v->return_bw_todcn_per_state - - v->dcfclk_per_state[i] - * v->return_bus_width - /4.0 ) - + v->urgent_latency))); - } - v->critical_point =2.0 * v->return_bus_width * v->dcfclk_per_state[i] - * v->urgent_latency - / (v->return_bw_todcn_per_state * v->urgent_latency - + (v->rob_buffer_size_in_kbyte - - v->pixel_chunk_size_in_kbyte) - *1024.0 ); -if (v->dcc_enabled_in_any_plane == dcn_bw_yes && v->critical_point >1.0 - && v->critical_point <4.0 ) { - v->return_bw_per_state[i] = -dcn_bw_min2 ( - v->return_bw_per_state[i], -dcn_bw_pow ( -4.0 - * v->return_bw_todcn_per_state - * (v->rob_buffer_size_in_kbyte - - v->pixel_chunk_size_in_kbyte) - *1024.0 - * v->return_bus_width - * v->dcfclk_per_state[i] - * v->urgent_latency - / (v->return_bw_todcn_per_state - * v->urgent_latency - + (v->rob_buffer_size_in_kbyte - - v->pixel_chunk_size_in_kbyte) - *1024.0 ), -2 )); +if (v->dcc_enabled_in_any_plane == dcn_bw_yes && v->return_bw_todcn_per_state > v->dcfclk_per_state[i] * v->return_bus_width /4.0 ) { + v->return_bw_per_state[i] =dcn_bw_min2 (v->return_bw_per_state[i], v->return_bw_todcn_per_state *4.0 * (1.0 - v->urgent_latency / ((v->rob_buffer_size_in_kbyte - v->pixel_chunk_size_in_kbyte) *1024.0 / (v->return_bw_todcn_per_state - v->dcfclk_per_state[i] * v->return_bus_width /4.0 ) + v->urgent_latency))); + } + v->critical_point =2.0 * v->return_bus_width * v->dcfclk_per_state[i] * v->urgent_latency / (v->return_bw_todcn_per_state * v->urgent_latency + (v->rob_buffer_size_in_kbyte - v->pixel_chunk_size_in_kbyte) *1024.0 ); +if (v->dcc_enabled_in_any_plane == dcn_bw_yes && v->critical_point >1.0 && v->critical_point <4.0 ) { + v->return_bw_per_state[i] =dcn_bw_min2 (v->return_bw_per_state[i],dcn_bw_pow (4.0 * v->return_bw_todcn_per_state * (v->rob_buffer_size_in_kbyte - v->pixel_chunk_size_in_kbyte) *1024.0 * v->return_bus_width * v->dcfclk_per_state[i] * v->urgent_latency / (v->return_bw_todcn_per_state * v->urgent_latency + (v->rob_buffer_size_in_kbyte - v->pixel_chunk_size_in_kbyte) *1024.0 ),2 )); + } + v->return_bw_todcn_per_state =dcn_bw_min2 (v->return_bus_width * v->dcfclk_per_state[i], v->fabric_and_dram_bandwidth_per_state[i] *1000.0 ); +if (v->dcc_enabled_in_any_plane == dcn_bw_yes && v->return_bw_todcn_per_state > v->dcfclk_per_state[i] * v->return_bus_width /4.0 ) { + v->return_bw_per_state[i] =dcn_bw_min2 (v->return_bw_per_state[i], v->return_bw_todcn_per_state *4.0 * (1.0 - v->urgent_latency / ((v->rob_buffer_size_in_kbyte - v->pixel_chunk_size_in_kbyte) *1024.0 / (v->return_bw_todcn_per_state - v->dcfclk_per_state[i] * v->return_bus_width /4.0 ) + v->urgent_latency))); + } + v->critical_point =2.0 * v->return_bus_width * v->dcfclk_per_state[i] * v->urgent_latency / (v->return_bw_todcn_per_state * v->urgent_latency + (v->rob_buffer_size_in_kbyte - v->pixel_chunk_size_in_kbyte) *1024.0 ); +if (v->dcc_enabled_in_any_plane == dcn_bw_yes && v->critical_point >1.0 && v->critical_point <4.0 ) { + v->return_bw_per_state[i] =dcn_bw_min2 (v->return_bw_per_state[i],dcn_bw_pow (4.0 * v->return_bw_todcn_per_state * (v->rob_buffer_size_in_kbyte - v->pixel_chunk_size_in_kbyte) *1024.0 * v->return_bus_width * v->dcfclk_per_state[i] * v->urgent_latency / (v->return_bw_todcn_per_state * v->urgent_latency + (v->rob_buffer_size_in_kbyte - v->pixel_chunk_size_in_kbyte) *1024.0 ),2 )); } }for (i =0 ; i <= number_of_states_plus_one; i++) { -if ((v->total_read_bandwidth_consumed_gbyte_per_second *1000.0 - <= v->return_bw_per_state[i]) - && (v->total_bandwidth_consumed_gbyte_per_second *1000.0 - <= v->fabric_and_dram_bandwidth_per_state[i] - *1000.0 - * v->percent_of_ideal_drambw_received_after_urg_latency - /100.0 )) { +if ((v->total_read_bandwidth_consumed_gbyte_per_second *1000.0 <= v->return_bw_per_state[i]) && (v->total_bandwidth_consumed_gbyte_per_second *1000.0 <= v->fabric_and_dram_bandwidth_per_state[i] *1000.0 * v->percent_of_ideal_drambw_received_after_urg_latency /100.0 )) { v->bandwidth_support[i] = dcn_bw_yes; - }else { + } +else { v->bandwidth_support[i] = dcn_bw_no; } }
@@ -351,36 +230,21 @@ void mode_support_and_system_configuration(struct dcn_bw_internal_vars *v) v->writeback_latency_support = dcn_bw_yes;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) { -if (v->output[k] == dcn_bw_writeback && v->output_format[k] == dcn_bw_444 - && v->scaler_rec_out_width[k] / (v->htotal[k] / v->pixel_clock[k]) - *4.0 - > (v->writeback_luma_buffer_size - + v->writeback_chroma_buffer_size) - *1024.0 / v->write_back_latency) { +if (v->output[k] == dcn_bw_writeback && v->output_format[k] == dcn_bw_444 && v->scaler_rec_out_width[k] / (v->htotal[k] / v->pixel_clock[k]) *4.0 > (v->writeback_luma_buffer_size + v->writeback_chroma_buffer_size) *1024.0 / v->write_back_latency) { v->writeback_latency_support = dcn_bw_no; - }else if (v->output[k] == dcn_bw_writeback - && v->scaler_rec_out_width[k] / (v->htotal[k] / v->pixel_clock[k]) - >dcn_bw_min2 ( - v->writeback_luma_buffer_size, -2.0 - * v->writeback_chroma_buffer_size) - *1024.0 / v->write_back_latency) { + } +else if (v->output[k] == dcn_bw_writeback && v->scaler_rec_out_width[k] / (v->htotal[k] / v->pixel_clock[k]) >dcn_bw_min2 (v->writeback_luma_buffer_size,2.0 * v->writeback_chroma_buffer_size) *1024.0 / v->write_back_latency) { v->writeback_latency_support = dcn_bw_no; } }/*re-ordering buffer support check*/ for (i =0 ; i <= number_of_states_plus_one; i++) { - v->urgent_round_trip_and_out_of_order_latency_per_state[i] = - (v->round_trip_ping_latency_cycles +32.0 ) / v->dcfclk_per_state[i] - + v->urgent_out_of_order_return_per_channel - * v->number_of_channels - / v->return_bw_per_state[i]; -if ((v->rob_buffer_size_in_kbyte - v->pixel_chunk_size_in_kbyte) *1024.0 - / v->return_bw_per_state[i] - > v->urgent_round_trip_and_out_of_order_latency_per_state[i]) { + v->urgent_round_trip_and_out_of_order_latency_per_state[i] = (v->round_trip_ping_latency_cycles +32.0 ) / v->dcfclk_per_state[i] + v->urgent_out_of_order_return_per_channel * v->number_of_channels / v->return_bw_per_state[i]; +if ((v->rob_buffer_size_in_kbyte - v->pixel_chunk_size_in_kbyte) *1024.0 / v->return_bw_per_state[i] > v->urgent_round_trip_and_out_of_order_latency_per_state[i]) { v->rob_support[i] = dcn_bw_yes; - }else { + } +else { v->rob_support[i] = dcn_bw_no; } }
@@ -390,28 +254,31 @@ void mode_support_and_system_configuration(struct dcn_bw_internal_vars *v)if (v->output[k] == dcn_bw_dp && v->dsc_capability == dcn_bw_yes) {if (v->output_format[k] == dcn_bw_420) { v->required_output_bw = v->pixel_clock[k] /2.0 ; - }else { + } +else { v->required_output_bw = v->pixel_clock[k]; } - }else if (v->output_format[k] == dcn_bw_420) { + } +else if (v->output_format[k] == dcn_bw_420) { v->required_output_bw = v->pixel_clock[k] *3.0 /2.0 ; - }else { + } +else { v->required_output_bw = v->pixel_clock[k] *3.0 ; }if (v->output[k] == dcn_bw_hdmi) { v->required_phyclk[k] = v->required_output_bw /3.0 ; - }else if (v->output[k] == dcn_bw_dp) { + } +else if (v->output[k] == dcn_bw_dp) { v->required_phyclk[k] = v->required_output_bw /4.0 ; - }else { + } +else { v->required_phyclk[k] =0.0 ; } }for (i =0 ; i <= number_of_states_plus_one; i++) { v->dio_support[i] = dcn_bw_yes;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) { -if (v->required_phyclk[k] > v->phyclk_per_state[i] - || (v->output[k] == dcn_bw_hdmi - && v->required_phyclk[k] >600.0 )) { +if (v->required_phyclk[k] > v->phyclk_per_state[i] || (v->output[k] == dcn_bw_hdmi && v->required_phyclk[k] >600.0 )) { v->dio_support[i] = dcn_bw_no; } }
@@ -421,244 +288,128 @@ void mode_support_and_system_configuration(struct dcn_bw_internal_vars *v) v->total_number_of_active_writeback =0.0 ;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) {if (v->output[k] == dcn_bw_writeback) { - v->total_number_of_active_writeback = v->total_number_of_active_writeback - +1.0 ; + v->total_number_of_active_writeback = v->total_number_of_active_writeback +1.0 ; } }if (v->total_number_of_active_writeback <= v->max_num_writeback) { v->total_available_writeback_support = dcn_bw_yes; - }else { + } +else { v->total_available_writeback_support = dcn_bw_no; }/*maximum dispclk/dppclk support check*/ for (k =0 ; k <= v->number_of_active_planes -1 ; k++) {if (v->h_ratio[k] >1.0 ) { - v->pscl_factor[k] =dcn_bw_min2 ( - v->max_dchub_topscl_throughput, - v->max_pscl_tolb_throughput * v->h_ratio[k] - /dcn_bw_ceil2 (v->htaps[k] /6.0 ,1.0 )); - }else { - v->pscl_factor[k] =dcn_bw_min2 ( - v->max_dchub_topscl_throughput, - v->max_pscl_tolb_throughput); + v->pscl_factor[k] =dcn_bw_min2 (v->max_dchub_topscl_throughput, v->max_pscl_tolb_throughput * v->h_ratio[k] /dcn_bw_ceil2 (v->htaps[k] /6.0 ,1.0 )); + } +else { + v->pscl_factor[k] =dcn_bw_min2 (v->max_dchub_topscl_throughput, v->max_pscl_tolb_throughput); }if (v->byte_per_pixel_in_detc[k] ==0.0 ) { v->pscl_factor_chroma[k] =0.0 ; - v->min_dppclk_using_single_dpp[k] = - v->pixel_clock[k] - *dcn_bw_max3 ( - v->vtaps[k] /6.0 - *dcn_bw_min2 ( -1.0 , - v->h_ratio[k]), - v->h_ratio[k] - * v->v_ratio[k] - / v->pscl_factor[k], -1.0 ); - }else { + v->min_dppclk_using_single_dpp[k] = v->pixel_clock[k] *dcn_bw_max3 (v->vtaps[k] /6.0 *dcn_bw_min2 (1.0 , v->h_ratio[k]), v->h_ratio[k] * v->v_ratio[k] / v->pscl_factor[k],1.0 ); + } +else {if (v->h_ratio[k] /2.0 >1.0 ) { - v->pscl_factor_chroma[k] = -dcn_bw_min2 ( - v->max_dchub_topscl_throughput, - v->max_pscl_tolb_throughput - * v->h_ratio[k] - /2.0 - /dcn_bw_ceil2 ( - v->hta_pschroma[k] - /6.0 , -1.0 )); - }else { - v->pscl_factor_chroma[k] =dcn_bw_min2 ( - v->max_dchub_topscl_throughput, - v->max_pscl_tolb_throughput); - } - v->min_dppclk_using_single_dpp[k] = - v->pixel_clock[k] - *dcn_bw_max5 ( - v->vtaps[k] /6.0 - *dcn_bw_min2 ( -1.0 , - v->h_ratio[k]), - v->h_ratio[k] - * v->v_ratio[k] - / v->pscl_factor[k], - v->vta_pschroma[k] /6.0 - *dcn_bw_min2 ( -1.0 , - v->h_ratio[k] - /2.0 ), - v->h_ratio[k] - * v->v_ratio[k] - /4.0 - / v->pscl_factor_chroma[k], -1.0 ); + v->pscl_factor_chroma[k] =dcn_bw_min2 (v->max_dchub_topscl_throughput, v->max_pscl_tolb_throughput * v->h_ratio[k] /2.0 /dcn_bw_ceil2 (v->hta_pschroma[k] /6.0 ,1.0 )); + } +else { + v->pscl_factor_chroma[k] =dcn_bw_min2 (v->max_dchub_topscl_throughput, v->max_pscl_tolb_throughput); + } + v->min_dppclk_using_single_dpp[k] = v->pixel_clock[k] *dcn_bw_max5 (v->vtaps[k] /6.0 *dcn_bw_min2 (1.0 , v->h_ratio[k]), v->h_ratio[k] * v->v_ratio[k] / v->pscl_factor[k], v->vta_pschroma[k] /6.0 *dcn_bw_min2 (1.0 , v->h_ratio[k] /2.0 ), v->h_ratio[k] * v->v_ratio[k] /4.0 / v->pscl_factor_chroma[k],1.0 ); } }for (k =0 ; k <= v->number_of_active_planes -1 ; k++) { -if ((v->source_pixel_format[k] == dcn_bw_rgb_sub_64 - || v->source_pixel_format[k] == dcn_bw_rgb_sub_32 - || v->source_pixel_format[k] == dcn_bw_rgb_sub_16)) { +if ((v->source_pixel_format[k] == dcn_bw_rgb_sub_64 || v->source_pixel_format[k] == dcn_bw_rgb_sub_32 || v->source_pixel_format[k] == dcn_bw_rgb_sub_16)) {if (v->source_surface_mode[k] == dcn_bw_sw_linear) { v->read256_block_height_y[k] =1.0 ; - }else if (v->source_pixel_format[k] == dcn_bw_rgb_sub_64) { + } +else if (v->source_pixel_format[k] == dcn_bw_rgb_sub_64) { v->read256_block_height_y[k] =4.0 ; - }else { + } +else { v->read256_block_height_y[k] =8.0 ; } - v->read256_block_width_y[k] =256.0 - /dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) - / v->read256_block_height_y[k]; + v->read256_block_width_y[k] =256.0 /dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) / v->read256_block_height_y[k]; v->read256_block_height_c[k] =0.0 ; v->read256_block_width_c[k] =0.0 ; - }else { + } +else {if (v->source_surface_mode[k] == dcn_bw_sw_linear) { v->read256_block_height_y[k] =1.0 ; v->read256_block_height_c[k] =1.0 ; - }else if (v->source_pixel_format[k] == dcn_bw_yuv420_sub_8) { + } +else if (v->source_pixel_format[k] == dcn_bw_yuv420_sub_8) { v->read256_block_height_y[k] =16.0 ; v->read256_block_height_c[k] =8.0 ; - }else { + } +else { v->read256_block_height_y[k] =8.0 ; v->read256_block_height_c[k] =8.0 ; } - v->read256_block_width_y[k] =256.0 - /dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) - / v->read256_block_height_y[k]; - v->read256_block_width_c[k] =256.0 - /dcn_bw_ceil2 (v->byte_per_pixel_in_detc[k],2.0 ) - / v->read256_block_height_c[k]; + v->read256_block_width_y[k] =256.0 /dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) / v->read256_block_height_y[k]; + v->read256_block_width_c[k] =256.0 /dcn_bw_ceil2 (v->byte_per_pixel_in_detc[k],2.0 ) / v->read256_block_height_c[k]; }if (v->source_scan[k] == dcn_bw_hor) { v->max_swath_height_y[k] = v->read256_block_height_y[k]; v->max_swath_height_c[k] = v->read256_block_height_c[k]; - }else { + } +else { v->max_swath_height_y[k] = v->read256_block_width_y[k]; v->max_swath_height_c[k] = v->read256_block_width_c[k]; } -if ((v->source_pixel_format[k] == dcn_bw_rgb_sub_64 - || v->source_pixel_format[k] == dcn_bw_rgb_sub_32 - || v->source_pixel_format[k] == dcn_bw_rgb_sub_16)) { -if (v->source_surface_mode[k] == dcn_bw_sw_linear - || (v->source_pixel_format[k] == dcn_bw_rgb_sub_64 - && (v->source_surface_mode[k] - == dcn_bw_sw_4_kb_s - || v->source_surface_mode[k] - == dcn_bw_sw_4_kb_s_x - || v->source_surface_mode[k] - == dcn_bw_sw_64_kb_s - || v->source_surface_mode[k] - == dcn_bw_sw_64_kb_s_t - || v->source_surface_mode[k] - == dcn_bw_sw_64_kb_s_x - || v->source_surface_mode[k] - == dcn_bw_sw_var_s - || v->source_surface_mode[k] - == dcn_bw_sw_var_s_x) - && v->source_scan[k] == dcn_bw_hor)) { +if ((v->source_pixel_format[k] == dcn_bw_rgb_sub_64 || v->source_pixel_format[k] == dcn_bw_rgb_sub_32 || v->source_pixel_format[k] == dcn_bw_rgb_sub_16)) { +if (v->source_surface_mode[k] == dcn_bw_sw_linear || (v->source_pixel_format[k] == dcn_bw_rgb_sub_64 && (v->source_surface_mode[k] == dcn_bw_sw_4_kb_s || v->source_surface_mode[k] == dcn_bw_sw_4_kb_s_x || v->source_surface_mode[k] == dcn_bw_sw_64_kb_s || v->source_surface_mode[k] == dcn_bw_sw_64_kb_s_t || v->source_surface_mode[k] == dcn_bw_sw_64_kb_s_x || v->source_surface_mode[k] == dcn_bw_sw_var_s || v->source_surface_mode[k] == dcn_bw_sw_var_s_x) && v->source_scan[k] == dcn_bw_hor)) { v->min_swath_height_y[k] = v->max_swath_height_y[k]; - }else { + } +else { v->min_swath_height_y[k] = v->max_swath_height_y[k] /2.0 ; } v->min_swath_height_c[k] = v->max_swath_height_c[k]; - }else { + } +else {if (v->source_surface_mode[k] == dcn_bw_sw_linear) { v->min_swath_height_y[k] = v->max_swath_height_y[k]; v->min_swath_height_c[k] = v->max_swath_height_c[k]; - }else if (v->source_pixel_format[k] == dcn_bw_yuv420_sub_8 - && v->source_scan[k] == dcn_bw_hor) { + } +else if (v->source_pixel_format[k] == dcn_bw_yuv420_sub_8 && v->source_scan[k] == dcn_bw_hor) { v->min_swath_height_y[k] = v->max_swath_height_y[k] /2.0 ; -if (v->bug_forcing_luma_and_chroma_request_to_same_size_fixed - == dcn_bw_yes) { +if (v->bug_forcing_luma_and_chroma_request_to_same_size_fixed == dcn_bw_yes) { v->min_swath_height_c[k] = v->max_swath_height_c[k]; - }else { + } +else { v->min_swath_height_c[k] = v->max_swath_height_c[k] /2.0 ; } - }else if (v->source_pixel_format[k] == dcn_bw_yuv420_sub_10 - && v->source_scan[k] == dcn_bw_hor) { + } +else if (v->source_pixel_format[k] == dcn_bw_yuv420_sub_10 && v->source_scan[k] == dcn_bw_hor) { v->min_swath_height_c[k] = v->max_swath_height_c[k] /2.0 ; -if (v->bug_forcing_luma_and_chroma_request_to_same_size_fixed - == dcn_bw_yes) { +if (v->bug_forcing_luma_and_chroma_request_to_same_size_fixed == dcn_bw_yes) { v->min_swath_height_y[k] = v->max_swath_height_y[k]; - }else { + } +else { v->min_swath_height_y[k] = v->max_swath_height_y[k] /2.0 ; } - }else { + } +else { v->min_swath_height_y[k] = v->max_swath_height_y[k]; v->min_swath_height_c[k] = v->max_swath_height_c[k]; } }if (v->source_surface_mode[k] == dcn_bw_sw_linear) { v->maximum_swath_width =8192.0 ; - }else { + } +else { v->maximum_swath_width =5120.0 ; } - v->number_of_dpp_required_for_det_size = -dcn_bw_ceil2 ( - v->swath_width_ysingle_dpp[k] - /dcn_bw_min2 ( - v->maximum_swath_width, - v->det_buffer_size_in_kbyte - *1024.0 - /2.0 - / (v->byte_per_pixel_in_dety[k] - * v->min_swath_height_y[k] - + v->byte_per_pixel_in_detc[k] - /2.0 - * v->min_swath_height_c[k])), -1.0 ); + v->number_of_dpp_required_for_det_size =dcn_bw_ceil2 (v->swath_width_ysingle_dpp[k] /dcn_bw_min2 (v->maximum_swath_width, v->det_buffer_size_in_kbyte *1024.0 /2.0 / (v->byte_per_pixel_in_dety[k] * v->min_swath_height_y[k] + v->byte_per_pixel_in_detc[k] /2.0 * v->min_swath_height_c[k])),1.0 );if (v->byte_per_pixel_in_detc[k] ==0.0 ) { - v->number_of_dpp_required_for_lb_size =dcn_bw_ceil2 ( - (v->vtaps[k] - +dcn_bw_max2 ( -dcn_bw_ceil2 (v->v_ratio[k],1.0 ) - -2 , -0.0 )) - * v->swath_width_ysingle_dpp[k] - /dcn_bw_max2 (v->h_ratio[k],1.0 ) - * v->lb_bit_per_pixel[k] - / v->line_buffer_size, -1.0 ); - }else { - v->number_of_dpp_required_for_lb_size = -dcn_bw_max2 ( -dcn_bw_ceil2 ( - (v->vtaps[k] - +dcn_bw_max2 ( -dcn_bw_ceil2 ( - v->v_ratio[k], -1.0 ) - -2 , -0.0 )) - * v->swath_width_ysingle_dpp[k] - /dcn_bw_max2 ( - v->h_ratio[k], -1.0 ) - * v->lb_bit_per_pixel[k] - / v->line_buffer_size, -1.0 ), -dcn_bw_ceil2 ( - (v->vta_pschroma[k] - +dcn_bw_max2 ( -dcn_bw_ceil2 ( - v->v_ratio[k] - /2.0 , -1.0 ) - -2 , -0.0 )) - * v->swath_width_ysingle_dpp[k] - /2.0 - /dcn_bw_max2 ( - v->h_ratio[k] - /2.0 , -1.0 ) - * v->lb_bit_per_pixel[k] - / v->line_buffer_size, -1.0 )); - } - v->number_of_dpp_required_for_det_and_lb_size[k] =dcn_bw_max2 ( - v->number_of_dpp_required_for_det_size, - v->number_of_dpp_required_for_lb_size); + v->number_of_dpp_required_for_lb_size =dcn_bw_ceil2 ((v->vtaps[k] +dcn_bw_max2 (dcn_bw_ceil2 (v->v_ratio[k],1.0 ) -2 ,0.0 )) * v->swath_width_ysingle_dpp[k] /dcn_bw_max2 (v->h_ratio[k],1.0 ) * v->lb_bit_per_pixel[k] / v->line_buffer_size,1.0 ); + } +else { + v->number_of_dpp_required_for_lb_size =dcn_bw_max2 (dcn_bw_ceil2 ((v->vtaps[k] +dcn_bw_max2 (dcn_bw_ceil2 (v->v_ratio[k],1.0 ) -2 ,0.0 )) * v->swath_width_ysingle_dpp[k] /dcn_bw_max2 (v->h_ratio[k],1.0 ) * v->lb_bit_per_pixel[k] / v->line_buffer_size,1.0 ),dcn_bw_ceil2 ((v->vta_pschroma[k] +dcn_bw_max2 (dcn_bw_ceil2 (v->v_ratio[k] /2.0 ,1.0 ) -2 ,0.0 )) * v->swath_width_ysingle_dpp[k] /2.0 /dcn_bw_max2 (v->h_ratio[k] /2.0 ,1.0 ) * v->lb_bit_per_pixel[k] / v->line_buffer_size,1.0 )); + } + v->number_of_dpp_required_for_det_and_lb_size[k] =dcn_bw_max2 (v->number_of_dpp_required_for_det_size, v->number_of_dpp_required_for_lb_size); }for (i =0 ; i <= number_of_states_plus_one; i++) {for (j =0 ; j <=1 ; j++) {
@@ -666,119 +417,58 @@ void mode_support_and_system_configuration(struct dcn_bw_internal_vars *v) v->required_dispclk[i][j] =0.0 ; v->dispclk_dppclk_support[i][j] = dcn_bw_yes;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) { - v->min_dispclk_using_single_dpp =dcn_bw_max2 ( - v->pixel_clock[k], - v->min_dppclk_using_single_dpp[k] * (j +1 )) - * (1.0 + v->downspreading /100.0 ); + v->min_dispclk_using_single_dpp =dcn_bw_max2 (v->pixel_clock[k], v->min_dppclk_using_single_dpp[k] * (j +1 )) * (1.0 + v->downspreading /100.0 );if (v->odm_capability == dcn_bw_yes) { - v->min_dispclk_using_dual_dpp =dcn_bw_max2 ( - v->pixel_clock[k] /2.0 , - v->min_dppclk_using_single_dpp[k] /2.0 - * (j +1 )) - * (1.0 + v->downspreading /100.0 ); - }else { - v->min_dispclk_using_dual_dpp =dcn_bw_max2 ( - v->pixel_clock[k], - v->min_dppclk_using_single_dpp[k] /2.0 - * (j +1 )) - * (1.0 + v->downspreading /100.0 ); + v->min_dispclk_using_dual_dpp =dcn_bw_max2 (v->pixel_clock[k] /2.0 , v->min_dppclk_using_single_dpp[k] /2.0 * (j +1 )) * (1.0 + v->downspreading /100.0 ); + } +else { + v->min_dispclk_using_dual_dpp =dcn_bw_max2 (v->pixel_clock[k], v->min_dppclk_using_single_dpp[k] /2.0 * (j +1 )) * (1.0 + v->downspreading /100.0 ); }if (i < number_of_states) { - v->min_dispclk_using_single_dpp = - v->min_dispclk_using_single_dpp - * (1.0 - + v->dispclk_ramping_margin - /100.0 ); - v->min_dispclk_using_dual_dpp = - v->min_dispclk_using_dual_dpp - * (1.0 - + v->dispclk_ramping_margin - /100.0 ); - } -if (v->min_dispclk_using_single_dpp - <=dcn_bw_min2 ( - v->max_dispclk[i], - (j +1 ) * v->max_dppclk[i]) - && v->number_of_dpp_required_for_det_and_lb_size[k] - <=1.0 ) { + v->min_dispclk_using_single_dpp = v->min_dispclk_using_single_dpp * (1.0 + v->dispclk_ramping_margin /100.0 ); + v->min_dispclk_using_dual_dpp = v->min_dispclk_using_dual_dpp * (1.0 + v->dispclk_ramping_margin /100.0 ); + } +if (v->min_dispclk_using_single_dpp <=dcn_bw_min2 (v->max_dispclk[i], (j +1 ) * v->max_dppclk[i]) && v->number_of_dpp_required_for_det_and_lb_size[k] <=1.0 ) { v->no_of_dpp[i][j][k] =1.0 ; - v->required_dispclk[i][j] =dcn_bw_max2 ( - v->required_dispclk[i][j], - v->min_dispclk_using_single_dpp); - }else if (v->min_dispclk_using_dual_dpp - <=dcn_bw_min2 ( - v->max_dispclk[i], - (j +1 ) * v->max_dppclk[i])) { + v->required_dispclk[i][j] =dcn_bw_max2 (v->required_dispclk[i][j], v->min_dispclk_using_single_dpp); + } +else if (v->min_dispclk_using_dual_dpp <=dcn_bw_min2 (v->max_dispclk[i], (j +1 ) * v->max_dppclk[i])) { v->no_of_dpp[i][j][k] =2.0 ; - v->required_dispclk[i][j] =dcn_bw_max2 ( - v->required_dispclk[i][j], - v->min_dispclk_using_dual_dpp); - }else { + v->required_dispclk[i][j] =dcn_bw_max2 (v->required_dispclk[i][j], v->min_dispclk_using_dual_dpp); + } +else { v->no_of_dpp[i][j][k] =2.0 ; - v->required_dispclk[i][j] =dcn_bw_max2 ( - v->required_dispclk[i][j], - v->min_dispclk_using_dual_dpp); + v->required_dispclk[i][j] =dcn_bw_max2 (v->required_dispclk[i][j], v->min_dispclk_using_dual_dpp); v->dispclk_dppclk_support[i][j] = dcn_bw_no; } - v->total_number_of_active_dpp[i][j] = - v->total_number_of_active_dpp[i][j] - + v->no_of_dpp[i][j][k]; + v->total_number_of_active_dpp[i][j] = v->total_number_of_active_dpp[i][j] + v->no_of_dpp[i][j][k]; }if (v->total_number_of_active_dpp[i][j] > v->max_num_dpp) { v->total_number_of_active_dpp[i][j] =0.0 ; v->required_dispclk[i][j] =0.0 ; v->dispclk_dppclk_support[i][j] = dcn_bw_yes;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) { - v->min_dispclk_using_single_dpp =dcn_bw_max2 ( - v->pixel_clock[k], - v->min_dppclk_using_single_dpp[k] * (j +1 )) - * (1.0 + v->downspreading /100.0 ); - v->min_dispclk_using_dual_dpp =dcn_bw_max2 ( - v->pixel_clock[k], - v->min_dppclk_using_single_dpp[k] /2.0 - * (j +1 )) - * (1.0 + v->downspreading /100.0 ); + v->min_dispclk_using_single_dpp =dcn_bw_max2 (v->pixel_clock[k], v->min_dppclk_using_single_dpp[k] * (j +1 )) * (1.0 + v->downspreading /100.0 ); + v->min_dispclk_using_dual_dpp =dcn_bw_max2 (v->pixel_clock[k], v->min_dppclk_using_single_dpp[k] /2.0 * (j +1 )) * (1.0 + v->downspreading /100.0 );if (i < number_of_states) { - v->min_dispclk_using_single_dpp = - v->min_dispclk_using_single_dpp - * (1.0 - + v->dispclk_ramping_margin - /100.0 ); - v->min_dispclk_using_dual_dpp = - v->min_dispclk_using_dual_dpp - * (1.0 - + v->dispclk_ramping_margin - /100.0 ); + v->min_dispclk_using_single_dpp = v->min_dispclk_using_single_dpp * (1.0 + v->dispclk_ramping_margin /100.0 ); + v->min_dispclk_using_dual_dpp = v->min_dispclk_using_dual_dpp * (1.0 + v->dispclk_ramping_margin /100.0 ); } -if (v->number_of_dpp_required_for_det_and_lb_size[k] - <=1.0 ) { +if (v->number_of_dpp_required_for_det_and_lb_size[k] <=1.0 ) { v->no_of_dpp[i][j][k] =1.0 ; - v->required_dispclk[i][j] =dcn_bw_max2 ( - v->required_dispclk[i][j], - v->min_dispclk_using_single_dpp); -if (v->min_dispclk_using_single_dpp - >dcn_bw_min2 ( - v->max_dispclk[i], - (j +1 ) - * v->max_dppclk[i])) { + v->required_dispclk[i][j] =dcn_bw_max2 (v->required_dispclk[i][j], v->min_dispclk_using_single_dpp); +if (v->min_dispclk_using_single_dpp >dcn_bw_min2 (v->max_dispclk[i], (j +1 ) * v->max_dppclk[i])) { v->dispclk_dppclk_support[i][j] = dcn_bw_no; } - }else { + } +else { v->no_of_dpp[i][j][k] =2.0 ; - v->required_dispclk[i][j] =dcn_bw_max2 ( - v->required_dispclk[i][j], - v->min_dispclk_using_dual_dpp); -if (v->min_dispclk_using_dual_dpp - >dcn_bw_min2 ( - v->max_dispclk[i], - (j +1 ) - * v->max_dppclk[i])) { + v->required_dispclk[i][j] =dcn_bw_max2 (v->required_dispclk[i][j], v->min_dispclk_using_dual_dpp); +if (v->min_dispclk_using_dual_dpp >dcn_bw_min2 (v->max_dispclk[i], (j +1 ) * v->max_dppclk[i])) { v->dispclk_dppclk_support[i][j] = dcn_bw_no; } } - v->total_number_of_active_dpp[i][j] = - v->total_number_of_active_dpp[i][j] - + v->no_of_dpp[i][j][k]; + v->total_number_of_active_dpp[i][j] = v->total_number_of_active_dpp[i][j] + v->no_of_dpp[i][j][k]; } } }
@@ -797,7 +487,8 @@ void mode_support_and_system_configuration(struct dcn_bw_internal_vars *v)for (j =0 ; j <=1 ; j++) {if (v->total_number_of_active_dpp[i][j] <= v->max_num_dpp) { v->total_available_pipes_support[i][j] = dcn_bw_yes; - }else { + } +else { v->total_available_pipes_support[i][j] = dcn_bw_no; } }
@@ -807,167 +498,48 @@ void mode_support_and_system_configuration(struct dcn_bw_internal_vars *v)for (k =0 ; k <= v->number_of_active_planes -1 ; k++) {for (i =0 ; i <= number_of_states_plus_one; i++) {for (j =0 ; j <=1 ; j++) { - v->swath_width_yper_state[i][j][k] = v->swath_width_ysingle_dpp[k] - / v->no_of_dpp[i][j][k]; - v->swath_width_granularity_y =256.0 - /dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) - / v->max_swath_height_y[k]; - v->rounded_up_max_swath_size_bytes_y = (dcn_bw_ceil2 ( - v->swath_width_yper_state[i][j][k] -1.0 , - v->swath_width_granularity_y) - + v->swath_width_granularity_y) - * v->byte_per_pixel_in_dety[k] - * v->max_swath_height_y[k]; + v->swath_width_yper_state[i][j][k] = v->swath_width_ysingle_dpp[k] / v->no_of_dpp[i][j][k]; + v->swath_width_granularity_y =256.0 /dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) / v->max_swath_height_y[k]; + v->rounded_up_max_swath_size_bytes_y = (dcn_bw_ceil2 (v->swath_width_yper_state[i][j][k] -1.0 , v->swath_width_granularity_y) + v->swath_width_granularity_y) * v->byte_per_pixel_in_dety[k] * v->max_swath_height_y[k];if (v->source_pixel_format[k] == dcn_bw_yuv420_sub_10) { - v->rounded_up_max_swath_size_bytes_y =dcn_bw_ceil2 ( - v->rounded_up_max_swath_size_bytes_y, -256.0 ) +256 ; + v->rounded_up_max_swath_size_bytes_y =dcn_bw_ceil2 (v->rounded_up_max_swath_size_bytes_y,256.0 ) +256 ; }if (v->max_swath_height_c[k] >0.0 ) { - v->swath_width_granularity_c = -256.0 - /dcn_bw_ceil2 ( - v->byte_per_pixel_in_detc[k], -2.0 ) - / v->max_swath_height_c[k]; - } - v->rounded_up_max_swath_size_bytes_c = (dcn_bw_ceil2 ( - v->swath_width_yper_state[i][j][k] /2.0 -1.0 , - v->swath_width_granularity_c) - + v->swath_width_granularity_c) - * v->byte_per_pixel_in_detc[k] - * v->max_swath_height_c[k]; + v->swath_width_granularity_c =256.0 /dcn_bw_ceil2 (v->byte_per_pixel_in_detc[k],2.0 ) / v->max_swath_height_c[k]; + } + v->rounded_up_max_swath_size_bytes_c = (dcn_bw_ceil2 (v->swath_width_yper_state[i][j][k] /2.0 -1.0 , v->swath_width_granularity_c) + v->swath_width_granularity_c) * v->byte_per_pixel_in_detc[k] * v->max_swath_height_c[k];if (v->source_pixel_format[k] == dcn_bw_yuv420_sub_10) { - v->rounded_up_max_swath_size_bytes_c =dcn_bw_ceil2 ( - v->rounded_up_max_swath_size_bytes_c, -256.0 ) +256 ; - } -if (v->rounded_up_max_swath_size_bytes_y - + v->rounded_up_max_swath_size_bytes_c - <= v->det_buffer_size_in_kbyte *1024.0 /2.0 ) { - v->swath_height_yper_state[i][j][k] = - v->max_swath_height_y[k]; - v->swath_height_cper_state[i][j][k] = - v->max_swath_height_c[k]; - }else { - v->swath_height_yper_state[i][j][k] = - v->min_swath_height_y[k]; - v->swath_height_cper_state[i][j][k] = - v->min_swath_height_c[k]; + v->rounded_up_max_swath_size_bytes_c =dcn_bw_ceil2 (v->rounded_up_max_swath_size_bytes_c,256.0 ) +256 ; + } +if (v->rounded_up_max_swath_size_bytes_y + v->rounded_up_max_swath_size_bytes_c <= v->det_buffer_size_in_kbyte *1024.0 /2.0 ) { + v->swath_height_yper_state[i][j][k] = v->max_swath_height_y[k]; + v->swath_height_cper_state[i][j][k] = v->max_swath_height_c[k]; + } +else { + v->swath_height_yper_state[i][j][k] = v->min_swath_height_y[k]; + v->swath_height_cper_state[i][j][k] = v->min_swath_height_c[k]; }if (v->byte_per_pixel_in_detc[k] ==0.0 ) { - v->lines_in_det_luma = v->det_buffer_size_in_kbyte *1024.0 - / v->byte_per_pixel_in_dety[k] - / v->swath_width_yper_state[i][j][k]; + v->lines_in_det_luma = v->det_buffer_size_in_kbyte *1024.0 / v->byte_per_pixel_in_dety[k] / v->swath_width_yper_state[i][j][k]; v->lines_in_det_chroma =0.0 ; - }else if (v->swath_height_yper_state[i][j][k] - <= v->swath_height_cper_state[i][j][k]) { - v->lines_in_det_luma = v->det_buffer_size_in_kbyte *1024.0 - /2.0 / v->byte_per_pixel_in_dety[k] - / v->swath_width_yper_state[i][j][k]; - v->lines_in_det_chroma = - v->det_buffer_size_in_kbyte *1024.0 /2.0 - / v->byte_per_pixel_in_detc[k] - / (v->swath_width_yper_state[i][j][k] - /2.0 ); - }else { - v->lines_in_det_luma = v->det_buffer_size_in_kbyte *1024.0 - *2.0 /3.0 / v->byte_per_pixel_in_dety[k] - / v->swath_width_yper_state[i][j][k]; - v->lines_in_det_chroma = - v->det_buffer_size_in_kbyte *1024.0 /3.0 - / v->byte_per_pixel_in_dety[k] - / (v->swath_width_yper_state[i][j][k] - /2.0 ); - } - v->effective_lb_latency_hiding_source_lines_luma = -dcn_bw_min2 ( - v->max_line_buffer_lines, -dcn_bw_floor2 ( - v->line_buffer_size - / v->lb_bit_per_pixel[k] - / (v->swath_width_yper_state[i][j][k] - /dcn_bw_max2 ( - v->h_ratio[k], -1.0 )), -1.0 )) - - (v->vtaps[k] -1.0 ); - v->effective_lb_latency_hiding_source_lines_chroma = -dcn_bw_min2 ( - v->max_line_buffer_lines, -dcn_bw_floor2 ( - v->line_buffer_size - / v->lb_bit_per_pixel[k] - / (v->swath_width_yper_state[i][j][k] - /2.0 - /dcn_bw_max2 ( - v->h_ratio[k] - /2.0 , -1.0 )), -1.0 )) - - (v->vta_pschroma[k] -1.0 ); - v->effective_detlb_lines_luma = -dcn_bw_floor2 ( - v->lines_in_det_luma - +dcn_bw_min2 ( - v->lines_in_det_luma - * v->required_dispclk[i][j] - * v->byte_per_pixel_in_dety[k] - * v->pscl_factor[k] - / v->return_bw_per_state[i], - v->effective_lb_latency_hiding_source_lines_luma), - v->swath_height_yper_state[i][j][k]); - v->effective_detlb_lines_chroma = -dcn_bw_floor2 ( - v->lines_in_det_chroma - +dcn_bw_min2 ( - v->lines_in_det_chroma - * v->required_dispclk[i][j] - * v->byte_per_pixel_in_detc[k] - * v->pscl_factor_chroma[k] - / v->return_bw_per_state[i], - v->effective_lb_latency_hiding_source_lines_chroma), - v->swath_height_cper_state[i][j][k]); + } +else if (v->swath_height_yper_state[i][j][k] <= v->swath_height_cper_state[i][j][k]) { + v->lines_in_det_luma = v->det_buffer_size_in_kbyte *1024.0 /2.0 / v->byte_per_pixel_in_dety[k] / v->swath_width_yper_state[i][j][k]; + v->lines_in_det_chroma = v->det_buffer_size_in_kbyte *1024.0 /2.0 / v->byte_per_pixel_in_detc[k] / (v->swath_width_yper_state[i][j][k] /2.0 ); + } +else { + v->lines_in_det_luma = v->det_buffer_size_in_kbyte *1024.0 *2.0 /3.0 / v->byte_per_pixel_in_dety[k] / v->swath_width_yper_state[i][j][k]; + v->lines_in_det_chroma = v->det_buffer_size_in_kbyte *1024.0 /3.0 / v->byte_per_pixel_in_dety[k] / (v->swath_width_yper_state[i][j][k] /2.0 ); + } + v->effective_lb_latency_hiding_source_lines_luma =dcn_bw_min2 (v->max_line_buffer_lines,dcn_bw_floor2 (v->line_buffer_size / v->lb_bit_per_pixel[k] / (v->swath_width_yper_state[i][j][k] /dcn_bw_max2 (v->h_ratio[k],1.0 )),1.0 )) - (v->vtaps[k] -1.0 ); + v->effective_lb_latency_hiding_source_lines_chroma =dcn_bw_min2 (v->max_line_buffer_lines,dcn_bw_floor2 (v->line_buffer_size / v->lb_bit_per_pixel[k] / (v->swath_width_yper_state[i][j][k] /2.0 /dcn_bw_max2 (v->h_ratio[k] /2.0 ,1.0 )),1.0 )) - (v->vta_pschroma[k] -1.0 ); + v->effective_detlb_lines_luma =dcn_bw_floor2 (v->lines_in_det_luma +dcn_bw_min2 (v->lines_in_det_luma * v->required_dispclk[i][j] * v->byte_per_pixel_in_dety[k] * v->pscl_factor[k] / v->return_bw_per_state[i], v->effective_lb_latency_hiding_source_lines_luma), v->swath_height_yper_state[i][j][k]); + v->effective_detlb_lines_chroma =dcn_bw_floor2 (v->lines_in_det_chroma +dcn_bw_min2 (v->lines_in_det_chroma * v->required_dispclk[i][j] * v->byte_per_pixel_in_detc[k] * v->pscl_factor_chroma[k] / v->return_bw_per_state[i], v->effective_lb_latency_hiding_source_lines_chroma), v->swath_height_cper_state[i][j][k]);if (v->byte_per_pixel_in_detc[k] ==0.0 ) { - v->urgent_latency_support_us_per_state[i][j][k] = - v->effective_detlb_lines_luma - * (v->htotal[k] - / v->pixel_clock[k]) - / v->v_ratio[k] - - v->effective_detlb_lines_luma - * v->swath_width_yper_state[i][j][k] - *dcn_bw_ceil2 ( - v->byte_per_pixel_in_dety[k], -1.0 ) - / (v->return_bw_per_state[i] - / v->no_of_dpp[i][j][k]); - }else { - v->urgent_latency_support_us_per_state[i][j][k] = -dcn_bw_min2 ( - v->effective_detlb_lines_luma - * (v->htotal[k] - / v->pixel_clock[k]) - / v->v_ratio[k] - - v->effective_detlb_lines_luma - * v->swath_width_yper_state[i][j][k] - *dcn_bw_ceil2 ( - v->byte_per_pixel_in_dety[k], -1.0 ) - / (v->return_bw_per_state[i] - / v->no_of_dpp[i][j][k]), - v->effective_detlb_lines_chroma - * (v->htotal[k] - / v->pixel_clock[k]) - / (v->v_ratio[k] - /2.0 ) - - v->effective_detlb_lines_chroma - * v->swath_width_yper_state[i][j][k] - /2.0 - *dcn_bw_ceil2 ( - v->byte_per_pixel_in_detc[k], -2.0 ) - / (v->return_bw_per_state[i] - / v->no_of_dpp[i][j][k])); + v->urgent_latency_support_us_per_state[i][j][k] = v->effective_detlb_lines_luma * (v->htotal[k] / v->pixel_clock[k]) / v->v_ratio[k] - v->effective_detlb_lines_luma * v->swath_width_yper_state[i][j][k] *dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) / (v->return_bw_per_state[i] / v->no_of_dpp[i][j][k]); + } +else { + v->urgent_latency_support_us_per_state[i][j][k] =dcn_bw_min2 (v->effective_detlb_lines_luma * (v->htotal[k] / v->pixel_clock[k]) / v->v_ratio[k] - v->effective_detlb_lines_luma * v->swath_width_yper_state[i][j][k] *dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) / (v->return_bw_per_state[i] / v->no_of_dpp[i][j][k]), v->effective_detlb_lines_chroma * (v->htotal[k] / v->pixel_clock[k]) / (v->v_ratio[k] /2.0 ) - v->effective_detlb_lines_chroma * v->swath_width_yper_state[i][j][k] /2.0 *dcn_bw_ceil2 (v->byte_per_pixel_in_detc[k],2.0 ) / (v->return_bw_per_state[i] / v->no_of_dpp[i][j][k])); } } }
@@ -976,8 +548,7 @@ void mode_support_and_system_configuration(struct dcn_bw_internal_vars *v)for (j =0 ; j <=1 ; j++) { v->urgent_latency_support[i][j] = dcn_bw_yes;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) { -if (v->urgent_latency_support_us_per_state[i][j][k] - < v->urgent_latency /1.0 ) { +if (v->urgent_latency_support_us_per_state[i][j][k] < v->urgent_latency /1.0 ) { v->urgent_latency_support[i][j] = dcn_bw_no; } }
@@ -990,9 +561,7 @@ void mode_support_and_system_configuration(struct dcn_bw_internal_vars *v) v->total_number_of_dcc_active_dpp[i][j] =0.0 ;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) {if (v->dcc_enable[k] == dcn_bw_yes) { - v->total_number_of_dcc_active_dpp[i][j] = - v->total_number_of_dcc_active_dpp[i][j] - + v->no_of_dpp[i][j][k]; + v->total_number_of_dcc_active_dpp[i][j] = v->total_number_of_dcc_active_dpp[i][j] + v->no_of_dpp[i][j][k]; } } }
@@ -1001,143 +570,50 @@ void mode_support_and_system_configuration(struct dcn_bw_internal_vars *v)for (j =0 ; j <=1 ; j++) { v->projected_dcfclk_deep_sleep =8.0 ;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) { - v->projected_dcfclk_deep_sleep =dcn_bw_max2 ( - v->projected_dcfclk_deep_sleep, - v->pixel_clock[k] /16.0 ); + v->projected_dcfclk_deep_sleep =dcn_bw_max2 (v->projected_dcfclk_deep_sleep, v->pixel_clock[k] /16.0 );if (v->byte_per_pixel_in_detc[k] ==0.0 ) {if (v->v_ratio[k] <=1.0 ) { - v->projected_dcfclk_deep_sleep = -dcn_bw_max2 ( - v->projected_dcfclk_deep_sleep, -1.1 - *dcn_bw_ceil2 ( - v->byte_per_pixel_in_dety[k], -1.0 ) - /64.0 - * v->h_ratio[k] - * v->pixel_clock[k] - / v->no_of_dpp[i][j][k]); - }else { - v->projected_dcfclk_deep_sleep = -dcn_bw_max2 ( - v->projected_dcfclk_deep_sleep, -1.1 - *dcn_bw_ceil2 ( - v->byte_per_pixel_in_dety[k], -1.0 ) - /64.0 - * v->pscl_factor[k] - * v->required_dispclk[i][j] - / (1 - + j)); + v->projected_dcfclk_deep_sleep =dcn_bw_max2 (v->projected_dcfclk_deep_sleep,1.1 *dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) /64.0 * v->h_ratio[k] * v->pixel_clock[k] / v->no_of_dpp[i][j][k]); + } +else { + v->projected_dcfclk_deep_sleep =dcn_bw_max2 (v->projected_dcfclk_deep_sleep,1.1 *dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) /64.0 * v->pscl_factor[k] * v->required_dispclk[i][j] / (1 + j)); } - }else { + } +else {if (v->v_ratio[k] <=1.0 ) { - v->projected_dcfclk_deep_sleep = -dcn_bw_max2 ( - v->projected_dcfclk_deep_sleep, -1.1 - *dcn_bw_ceil2 ( - v->byte_per_pixel_in_dety[k], -1.0 ) - /32.0 - * v->h_ratio[k] - * v->pixel_clock[k] - / v->no_of_dpp[i][j][k]); - }else { - v->projected_dcfclk_deep_sleep = -dcn_bw_max2 ( - v->projected_dcfclk_deep_sleep, -1.1 - *dcn_bw_ceil2 ( - v->byte_per_pixel_in_dety[k], -1.0 ) - /32.0 - * v->pscl_factor[k] - * v->required_dispclk[i][j] - / (1 - + j)); + v->projected_dcfclk_deep_sleep =dcn_bw_max2 (v->projected_dcfclk_deep_sleep,1.1 *dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) /32.0 * v->h_ratio[k] * v->pixel_clock[k] / v->no_of_dpp[i][j][k]); + } +else { + v->projected_dcfclk_deep_sleep =dcn_bw_max2 (v->projected_dcfclk_deep_sleep,1.1 *dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) /32.0 * v->pscl_factor[k] * v->required_dispclk[i][j] / (1 + j)); }if (v->v_ratio[k] /2.0 <=1.0 ) { - v->projected_dcfclk_deep_sleep = -dcn_bw_max2 ( - v->projected_dcfclk_deep_sleep, -1.1 - *dcn_bw_ceil2 ( - v->byte_per_pixel_in_detc[k], -2.0 ) - /32.0 - * v->h_ratio[k] - /2.0 - * v->pixel_clock[k] - / v->no_of_dpp[i][j][k]); - }else { - v->projected_dcfclk_deep_sleep = -dcn_bw_max2 ( - v->projected_dcfclk_deep_sleep, -1.1 - *dcn_bw_ceil2 ( - v->byte_per_pixel_in_detc[k], -2.0 ) - /32.0 - * v->pscl_factor_chroma[k] - * v->required_dispclk[i][j] - / (1 - + j)); + v->projected_dcfclk_deep_sleep =dcn_bw_max2 (v->projected_dcfclk_deep_sleep,1.1 *dcn_bw_ceil2 (v->byte_per_pixel_in_detc[k],2.0 ) /32.0 * v->h_ratio[k] /2.0 * v->pixel_clock[k] / v->no_of_dpp[i][j][k]); + } +else { + v->projected_dcfclk_deep_sleep =dcn_bw_max2 (v->projected_dcfclk_deep_sleep,1.1 *dcn_bw_ceil2 (v->byte_per_pixel_in_detc[k],2.0 ) /32.0 * v->pscl_factor_chroma[k] * v->required_dispclk[i][j] / (1 + j)); } } }for (k =0 ; k <= v->number_of_active_planes -1 ; k++) {if (v->dcc_enable[k] == dcn_bw_yes) { v->meta_req_height_y =8.0 * v->read256_block_height_y[k]; - v->meta_req_width_y = -64.0 *256.0 - /dcn_bw_ceil2 ( - v->byte_per_pixel_in_dety[k], -1.0 ) - / v->meta_req_height_y; - v->meta_surface_width_y =dcn_bw_ceil2 ( - v->viewport_width[k] / v->no_of_dpp[i][j][k] - -1.0 , - v->meta_req_width_y) + v->meta_req_width_y; - v->meta_surface_height_y =dcn_bw_ceil2 ( - v->viewport_height[k] -1.0 , - v->meta_req_height_y) - + v->meta_req_height_y; + v->meta_req_width_y =64.0 *256.0 /dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) / v->meta_req_height_y; + v->meta_surface_width_y =dcn_bw_ceil2 (v->viewport_width[k] / v->no_of_dpp[i][j][k] -1.0 , v->meta_req_width_y) + v->meta_req_width_y; + v->meta_surface_height_y =dcn_bw_ceil2 (v->viewport_height[k] -1.0 , v->meta_req_height_y) + v->meta_req_height_y;if (v->pte_enable == dcn_bw_yes) { - v->meta_pte_bytes_per_frame_y = - (dcn_bw_ceil2 ( - (v->meta_surface_width_y - * v->meta_surface_height_y - *dcn_bw_ceil2 ( - v->byte_per_pixel_in_dety[k], -1.0 ) - /256.0 - -4096.0 ) - /8.0 - /4096.0 , -1.0 ) +1 ) *64.0 ; - }else { + v->meta_pte_bytes_per_frame_y = (dcn_bw_ceil2 ((v->meta_surface_width_y * v->meta_surface_height_y *dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) /256.0 -4096.0 ) /8.0 /4096.0 ,1.0 ) +1 ) *64.0 ; + } +else { v->meta_pte_bytes_per_frame_y =0.0 ; }if (v->source_scan[k] == dcn_bw_hor) { - v->meta_row_bytes_y = - v->meta_surface_width_y - * v->meta_req_height_y - *dcn_bw_ceil2 ( - v->byte_per_pixel_in_dety[k], -1.0 ) - /256.0 ; - }else { - v->meta_row_bytes_y = - v->meta_surface_height_y - * v->meta_req_width_y - *dcn_bw_ceil2 ( - v->byte_per_pixel_in_dety[k], -1.0 ) - /256.0 ; + v->meta_row_bytes_y = v->meta_surface_width_y * v->meta_req_height_y *dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) /256.0 ; } - }else { +else { + v->meta_row_bytes_y = v->meta_surface_height_y * v->meta_req_width_y *dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) /256.0 ; + } + } +else { v->meta_pte_bytes_per_frame_y =0.0 ; v->meta_row_bytes_y =0.0 ; }
@@ -1145,153 +621,59 @@ void mode_support_and_system_configuration(struct dcn_bw_internal_vars *v)if (v->source_surface_mode[k] == dcn_bw_sw_linear) { v->macro_tile_block_size_bytes_y =256.0 ; v->macro_tile_block_height_y =1.0 ; - }else if (v->source_surface_mode[k] == dcn_bw_sw_4_kb_s - || v->source_surface_mode[k] - == dcn_bw_sw_4_kb_s_x - || v->source_surface_mode[k] - == dcn_bw_sw_4_kb_d - || v->source_surface_mode[k] - == dcn_bw_sw_4_kb_d_x) { + } +else if (v->source_surface_mode[k] == dcn_bw_sw_4_kb_s || v->source_surface_mode[k] == dcn_bw_sw_4_kb_s_x || v->source_surface_mode[k] == dcn_bw_sw_4_kb_d || v->source_surface_mode[k] == dcn_bw_sw_4_kb_d_x) { v->macro_tile_block_size_bytes_y =4096.0 ; - v->macro_tile_block_height_y =4.0 - * v->read256_block_height_y[k]; - }else if (v->source_surface_mode[k] == dcn_bw_sw_64_kb_s - || v->source_surface_mode[k] - == dcn_bw_sw_64_kb_s_t - || v->source_surface_mode[k] - == dcn_bw_sw_64_kb_s_x - || v->source_surface_mode[k] - == dcn_bw_sw_64_kb_d - || v->source_surface_mode[k] - == dcn_bw_sw_64_kb_d_t - || v->source_surface_mode[k] - == dcn_bw_sw_64_kb_d_x) { + v->macro_tile_block_height_y =4.0 * v->read256_block_height_y[k]; + } +else if (v->source_surface_mode[k] == dcn_bw_sw_64_kb_s || v->source_surface_mode[k] == dcn_bw_sw_64_kb_s_t || v->source_surface_mode[k] == dcn_bw_sw_64_kb_s_x || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d_t || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d_x) { v->macro_tile_block_size_bytes_y =64.0 *1024 ; - v->macro_tile_block_height_y =16.0 - * v->read256_block_height_y[k]; - }else { + v->macro_tile_block_height_y =16.0 * v->read256_block_height_y[k]; + } +else { v->macro_tile_block_size_bytes_y =256.0 *1024 ; - v->macro_tile_block_height_y =32.0 - * v->read256_block_height_y[k]; + v->macro_tile_block_height_y =32.0 * v->read256_block_height_y[k]; }if (v->macro_tile_block_size_bytes_y <=65536.0 ) { - v->data_pte_req_height_y = - v->macro_tile_block_height_y; - }else { - v->data_pte_req_height_y =16.0 - * v->read256_block_height_y[k]; + v->data_pte_req_height_y = v->macro_tile_block_height_y; + } +else { + v->data_pte_req_height_y =16.0 * v->read256_block_height_y[k]; } - v->data_pte_req_width_y = -4096.0 - /dcn_bw_ceil2 ( - v->byte_per_pixel_in_dety[k], -1.0 ) - / v->data_pte_req_height_y - *8 ; + v->data_pte_req_width_y =4096.0 /dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) / v->data_pte_req_height_y *8 ;if (v->source_surface_mode[k] == dcn_bw_sw_linear) { - v->dpte_bytes_per_row_y = -64.0 - * (dcn_bw_ceil2 ( - (v->viewport_width[k] - / v->no_of_dpp[i][j][k] - *dcn_bw_min2 ( -128.0 , -dcn_bw_pow ( -2.0 , -dcn_bw_floor2 ( -dcn_bw_log ( - v->pte_buffer_size_in_requests - * v->data_pte_req_width_y - / (v->viewport_width[k] - / v->no_of_dpp[i][j][k]), -2.0 ), -1.0 ))) - -1.0 ) - / v->data_pte_req_width_y, -1.0 ) - +1 ); - }else if (v->source_scan[k] == dcn_bw_hor) { - v->dpte_bytes_per_row_y = -64.0 - * (dcn_bw_ceil2 ( - (v->viewport_width[k] - / v->no_of_dpp[i][j][k] - -1.0 ) - / v->data_pte_req_width_y, -1.0 ) - +1 ); - }else { - v->dpte_bytes_per_row_y = -64.0 - * (dcn_bw_ceil2 ( - (v->viewport_height[k] - -1.0 ) - / v->data_pte_req_height_y, -1.0 ) - +1 ); + v->dpte_bytes_per_row_y =64.0 * (dcn_bw_ceil2 ((v->viewport_width[k] / v->no_of_dpp[i][j][k] *dcn_bw_min2 (128.0 ,dcn_bw_pow (2.0 ,dcn_bw_floor2 (dcn_bw_log (v->pte_buffer_size_in_requests * v->data_pte_req_width_y / (v->viewport_width[k] / v->no_of_dpp[i][j][k]),2.0 ),1.0 ))) -1.0 ) / v->data_pte_req_width_y,1.0 ) +1 ); + } +else if (v->source_scan[k] == dcn_bw_hor) { + v->dpte_bytes_per_row_y =64.0 * (dcn_bw_ceil2 ((v->viewport_width[k] / v->no_of_dpp[i][j][k] -1.0 ) / v->data_pte_req_width_y,1.0 ) +1 ); + } +else { + v->dpte_bytes_per_row_y =64.0 * (dcn_bw_ceil2 ((v->viewport_height[k] -1.0 ) / v->data_pte_req_height_y,1.0 ) +1 ); } - }else { + } +else { v->dpte_bytes_per_row_y =0.0 ; } -if ((v->source_pixel_format[k] != dcn_bw_rgb_sub_64 - && v->source_pixel_format[k] != dcn_bw_rgb_sub_32 - && v->source_pixel_format[k] != dcn_bw_rgb_sub_16)) { +if ((v->source_pixel_format[k] != dcn_bw_rgb_sub_64 && v->source_pixel_format[k] != dcn_bw_rgb_sub_32 && v->source_pixel_format[k] != dcn_bw_rgb_sub_16)) {if (v->dcc_enable[k] == dcn_bw_yes) { - v->meta_req_height_c =8.0 - * v->read256_block_height_c[k]; - v->meta_req_width_c = -64.0 *256.0 - /dcn_bw_ceil2 ( - v->byte_per_pixel_in_detc[k], -2.0 ) - / v->meta_req_height_c; - v->meta_surface_width_c = -dcn_bw_ceil2 ( - v->viewport_width[k] - / v->no_of_dpp[i][j][k] - /2.0 - -1.0 , - v->meta_req_width_c) - + v->meta_req_width_c; - v->meta_surface_height_c =dcn_bw_ceil2 ( - v->viewport_height[k] /2.0 -1.0 , - v->meta_req_height_c) - + v->meta_req_height_c; + v->meta_req_height_c =8.0 * v->read256_block_height_c[k]; + v->meta_req_width_c =64.0 *256.0 /dcn_bw_ceil2 (v->byte_per_pixel_in_detc[k],2.0 ) / v->meta_req_height_c; + v->meta_surface_width_c =dcn_bw_ceil2 (v->viewport_width[k] / v->no_of_dpp[i][j][k] /2.0 -1.0 , v->meta_req_width_c) + v->meta_req_width_c; + v->meta_surface_height_c =dcn_bw_ceil2 (v->viewport_height[k] /2.0 -1.0 , v->meta_req_height_c) + v->meta_req_height_c;if (v->pte_enable == dcn_bw_yes) { - v->meta_pte_bytes_per_frame_c = - (dcn_bw_ceil2 ( - (v->meta_surface_width_c - * v->meta_surface_height_c - *dcn_bw_ceil2 ( - v->byte_per_pixel_in_detc[k], -2.0 ) - /256.0 - -4096.0 ) - /8.0 - /4096.0 , -1.0 ) +1 ) - *64.0 ; - }else { + v->meta_pte_bytes_per_frame_c = (dcn_bw_ceil2 ((v->meta_surface_width_c * v->meta_surface_height_c *dcn_bw_ceil2 (v->byte_per_pixel_in_detc[k],2.0 ) /256.0 -4096.0 ) /8.0 /4096.0 ,1.0 ) +1 ) *64.0 ; + } +else { v->meta_pte_bytes_per_frame_c =0.0 ; }if (v->source_scan[k] == dcn_bw_hor) { - v->meta_row_bytes_c = - v->meta_surface_width_c - * v->meta_req_height_c - *dcn_bw_ceil2 ( - v->byte_per_pixel_in_detc[k], -2.0 ) - /256.0 ; - }else { - v->meta_row_bytes_c = - v->meta_surface_height_c - * v->meta_req_width_c - *dcn_bw_ceil2 ( - v->byte_per_pixel_in_detc[k], -2.0 ) - /256.0 ; + v->meta_row_bytes_c = v->meta_surface_width_c * v->meta_req_height_c *dcn_bw_ceil2 (v->byte_per_pixel_in_detc[k],2.0 ) /256.0 ; } - }else { +else { + v->meta_row_bytes_c = v->meta_surface_height_c * v->meta_req_width_c *dcn_bw_ceil2 (v->byte_per_pixel_in_detc[k],2.0 ) /256.0 ; + } + } +else { v->meta_pte_bytes_per_frame_c =0.0 ; v->meta_row_bytes_c =0.0 ; }
@@ -1299,593 +681,221 @@ void mode_support_and_system_configuration(struct dcn_bw_internal_vars *v)if (v->source_surface_mode[k] == dcn_bw_sw_linear) { v->macro_tile_block_size_bytes_c =256.0 ; v->macro_tile_block_height_c =1.0 ; - }else if (v->source_surface_mode[k] - == dcn_bw_sw_4_kb_s - || v->source_surface_mode[k] - == dcn_bw_sw_4_kb_s_x - || v->source_surface_mode[k] - == dcn_bw_sw_4_kb_d - || v->source_surface_mode[k] - == dcn_bw_sw_4_kb_d_x) { + } +else if (v->source_surface_mode[k] == dcn_bw_sw_4_kb_s || v->source_surface_mode[k] == dcn_bw_sw_4_kb_s_x || v->source_surface_mode[k] == dcn_bw_sw_4_kb_d || v->source_surface_mode[k] == dcn_bw_sw_4_kb_d_x) { v->macro_tile_block_size_bytes_c =4096.0 ; - v->macro_tile_block_height_c = -4.0 - * v->read256_block_height_c[k]; - }else if (v->source_surface_mode[k] - == dcn_bw_sw_64_kb_s - || v->source_surface_mode[k] - == dcn_bw_sw_64_kb_s_t - || v->source_surface_mode[k] - == dcn_bw_sw_64_kb_s_x - || v->source_surface_mode[k] - == dcn_bw_sw_64_kb_d - || v->source_surface_mode[k] - == dcn_bw_sw_64_kb_d_t - || v->source_surface_mode[k] - == dcn_bw_sw_64_kb_d_x) { - v->macro_tile_block_size_bytes_c =64.0 - *1024 ; - v->macro_tile_block_height_c = -16.0 - * v->read256_block_height_c[k]; - }else { - v->macro_tile_block_size_bytes_c =256.0 - *1024 ; - v->macro_tile_block_height_c = -32.0 - * v->read256_block_height_c[k]; + v->macro_tile_block_height_c =4.0 * v->read256_block_height_c[k]; + } +else if (v->source_surface_mode[k] == dcn_bw_sw_64_kb_s || v->source_surface_mode[k] == dcn_bw_sw_64_kb_s_t || v->source_surface_mode[k] == dcn_bw_sw_64_kb_s_x || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d_t || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d_x) { + v->macro_tile_block_size_bytes_c =64.0 *1024 ; + v->macro_tile_block_height_c =16.0 * v->read256_block_height_c[k]; } - v->macro_tile_block_width_c = - v->macro_tile_block_size_bytes_c - /dcn_bw_ceil2 ( - v->byte_per_pixel_in_detc[k], -2.0 ) - / v->macro_tile_block_height_c; +else { + v->macro_tile_block_size_bytes_c =256.0 *1024 ; + v->macro_tile_block_height_c =32.0 * v->read256_block_height_c[k]; + } + v->macro_tile_block_width_c = v->macro_tile_block_size_bytes_c /dcn_bw_ceil2 (v->byte_per_pixel_in_detc[k],2.0 ) / v->macro_tile_block_height_c;if (v->macro_tile_block_size_bytes_c <=65536.0 ) { - v->data_pte_req_height_c = - v->macro_tile_block_height_c; - }else { - v->data_pte_req_height_c = -16.0 - * v->read256_block_height_c[k]; + v->data_pte_req_height_c = v->macro_tile_block_height_c; + } +else { + v->data_pte_req_height_c =16.0 * v->read256_block_height_c[k]; } - v->data_pte_req_width_c = -4096.0 - /dcn_bw_ceil2 ( - v->byte_per_pixel_in_detc[k], -2.0 ) - / v->data_pte_req_height_c - *8 ; + v->data_pte_req_width_c =4096.0 /dcn_bw_ceil2 (v->byte_per_pixel_in_detc[k],2.0 ) / v->data_pte_req_height_c *8 ;if (v->source_surface_mode[k] == dcn_bw_sw_linear) { - v->dpte_bytes_per_row_c = -64.0 - * (dcn_bw_ceil2 ( - (v->viewport_width[k] - / v->no_of_dpp[i][j][k] - /2.0 - *dcn_bw_min2 ( -128.0 , -dcn_bw_pow ( -2.0 , -dcn_bw_floor2 ( -dcn_bw_log ( - v->pte_buffer_size_in_requests - * v->data_pte_req_width_c - / (v->viewport_width[k] - / v->no_of_dpp[i][j][k] - /2.0 ), -2.0 ), -1.0 ))) - -1.0 ) - / v->data_pte_req_width_c, -1.0 ) - +1 ); - }else if (v->source_scan[k] == dcn_bw_hor) { - v->dpte_bytes_per_row_c = -64.0 - * (dcn_bw_ceil2 ( - (v->viewport_width[k] - / v->no_of_dpp[i][j][k] - /2.0 - -1.0 ) - / v->data_pte_req_width_c, -1.0 ) - +1 ); - }else { - v->dpte_bytes_per_row_c = -64.0 - * (dcn_bw_ceil2 ( - (v->viewport_height[k] - /2.0 - -1.0 ) - / v->data_pte_req_height_c, -1.0 ) - +1 ); + v->dpte_bytes_per_row_c =64.0 * (dcn_bw_ceil2 ((v->viewport_width[k] / v->no_of_dpp[i][j][k] /2.0 *dcn_bw_min2 (128.0 ,dcn_bw_pow (2.0 ,dcn_bw_floor2 (dcn_bw_log (v->pte_buffer_size_in_requests * v->data_pte_req_width_c / (v->viewport_width[k] / v->no_of_dpp[i][j][k] /2.0 ),2.0 ),1.0 ))) -1.0 ) / v->data_pte_req_width_c,1.0 ) +1 ); } - }else { +else if (v->source_scan[k] == dcn_bw_hor) { + v->dpte_bytes_per_row_c =64.0 * (dcn_bw_ceil2 ((v->viewport_width[k] / v->no_of_dpp[i][j][k] /2.0 -1.0 ) / v->data_pte_req_width_c,1.0 ) +1 ); + } +else { + v->dpte_bytes_per_row_c =64.0 * (dcn_bw_ceil2 ((v->viewport_height[k] /2.0 -1.0 ) / v->data_pte_req_height_c,1.0 ) +1 ); + } + } +else { v->dpte_bytes_per_row_c =0.0 ; } - }else { + } +else { v->dpte_bytes_per_row_c =0.0 ; v->meta_pte_bytes_per_frame_c =0.0 ; v->meta_row_bytes_c =0.0 ; } - v->dpte_bytes_per_row[k] = v->dpte_bytes_per_row_y - + v->dpte_bytes_per_row_c; - v->meta_pte_bytes_per_frame[k] = v->meta_pte_bytes_per_frame_y - + v->meta_pte_bytes_per_frame_c; + v->dpte_bytes_per_row[k] = v->dpte_bytes_per_row_y + v->dpte_bytes_per_row_c; + v->meta_pte_bytes_per_frame[k] = v->meta_pte_bytes_per_frame_y + v->meta_pte_bytes_per_frame_c; v->meta_row_bytes[k] = v->meta_row_bytes_y + v->meta_row_bytes_c; - v->v_init_y = (v->v_ratio[k] + v->vtaps[k] +1.0 - + v->interlace_output[k] *0.5 * v->v_ratio[k]) - /2.0 ; - v->prefill_y[k] =dcn_bw_floor2 (v->v_init_y,1.0 ); - v->max_num_sw_y[k] = -dcn_bw_ceil2 ( - (v->prefill_y[k] -1.0 ) - / v->swath_height_yper_state[i][j][k], -1.0 ) +1 ; + v->v_init_y = (v->v_ratio[k] + v->vtaps[k] +1.0 + v->interlace_output[k] *0.5 * v->v_ratio[k]) /2.0 ; + v->prefill_y[k] =dcn_bw_floor2 (v->v_init_y,1.0 ); + v->max_num_sw_y[k] =dcn_bw_ceil2 ((v->prefill_y[k] -1.0 ) / v->swath_height_yper_state[i][j][k],1.0 ) +1 ;if (v->prefill_y[k] >1.0 ) { - v->max_partial_sw_y =dcn_bw_mod ( - (v->prefill_y[k] -2.0 ), - v->swath_height_yper_state[i][j][k]); - }else { - v->max_partial_sw_y = -dcn_bw_mod ( - (v->prefill_y[k] - + v->swath_height_yper_state[i][j][k] - -2.0 ), - v->swath_height_yper_state[i][j][k]); - } - v->max_partial_sw_y =dcn_bw_max2 (1.0 , v->max_partial_sw_y); - v->prefetch_lines_y[k] = v->max_num_sw_y[k] - * v->swath_height_yper_state[i][j][k] - + v->max_partial_sw_y; -if ((v->source_pixel_format[k] != dcn_bw_rgb_sub_64 - && v->source_pixel_format[k] != dcn_bw_rgb_sub_32 - && v->source_pixel_format[k] != dcn_bw_rgb_sub_16)) { - v->v_init_c = (v->v_ratio[k] /2.0 + v->vtaps[k] +1.0 - + v->interlace_output[k] *0.5 - * v->v_ratio[k] /2.0 ) - /2.0 ; - v->prefill_c[k] =dcn_bw_floor2 (v->v_init_c,1.0 ); - v->max_num_sw_c[k] = -dcn_bw_ceil2 ( - (v->prefill_c[k] -1.0 ) - / v->swath_height_cper_state[i][j][k], -1.0 ) +1 ; + v->max_partial_sw_y =dcn_bw_mod ((v->prefill_y[k] -2.0 ), v->swath_height_yper_state[i][j][k]); + } +else { + v->max_partial_sw_y =dcn_bw_mod ((v->prefill_y[k] + v->swath_height_yper_state[i][j][k] -2.0 ), v->swath_height_yper_state[i][j][k]); + } + v->max_partial_sw_y =dcn_bw_max2 (1.0 , v->max_partial_sw_y); + v->prefetch_lines_y[k] = v->max_num_sw_y[k] * v->swath_height_yper_state[i][j][k] + v->max_partial_sw_y; +if ((v->source_pixel_format[k] != dcn_bw_rgb_sub_64 && v->source_pixel_format[k] != dcn_bw_rgb_sub_32 && v->source_pixel_format[k] != dcn_bw_rgb_sub_16)) { + v->v_init_c = (v->v_ratio[k] /2.0 + v->vtaps[k] +1.0 + v->interlace_output[k] *0.5 * v->v_ratio[k] /2.0 ) /2.0 ; + v->prefill_c[k] =dcn_bw_floor2 (v->v_init_c,1.0 ); + v->max_num_sw_c[k] =dcn_bw_ceil2 ((v->prefill_c[k] -1.0 ) / v->swath_height_cper_state[i][j][k],1.0 ) +1 ;if (v->prefill_c[k] >1.0 ) { - v->max_partial_sw_c = -dcn_bw_mod ( - (v->prefill_c[k] - -2.0 ), - v->swath_height_cper_state[i][j][k]); - }else { - v->max_partial_sw_c = -dcn_bw_mod ( - (v->prefill_c[k] - + v->swath_height_cper_state[i][j][k] - -2.0 ), - v->swath_height_cper_state[i][j][k]); + v->max_partial_sw_c =dcn_bw_mod ((v->prefill_c[k] -2.0 ), v->swath_height_cper_state[i][j][k]); + } +else { + v->max_partial_sw_c =dcn_bw_mod ((v->prefill_c[k] + v->swath_height_cper_state[i][j][k] -2.0 ), v->swath_height_cper_state[i][j][k]); } - v->max_partial_sw_c =dcn_bw_max2 (1.0 , v->max_partial_sw_c); - v->prefetch_lines_c[k] = v->max_num_sw_c[k] - * v->swath_height_cper_state[i][j][k] - + v->max_partial_sw_c; - }else { + v->max_partial_sw_c =dcn_bw_max2 (1.0 , v->max_partial_sw_c); + v->prefetch_lines_c[k] = v->max_num_sw_c[k] * v->swath_height_cper_state[i][j][k] + v->max_partial_sw_c; + } +else { v->prefetch_lines_c[k] =0.0 ; } - v->dst_x_after_scaler =90.0 * v->pixel_clock[k] - / (v->required_dispclk[i][j] / (j +1 )) - +42.0 * v->pixel_clock[k] - / v->required_dispclk[i][j]; + v->dst_x_after_scaler =90.0 * v->pixel_clock[k] / (v->required_dispclk[i][j] / (j +1 )) +42.0 * v->pixel_clock[k] / v->required_dispclk[i][j];if (v->no_of_dpp[i][j][k] >1.0 ) { - v->dst_x_after_scaler = v->dst_x_after_scaler - + v->scaler_rec_out_width[k] /2.0 ; + v->dst_x_after_scaler = v->dst_x_after_scaler + v->scaler_rec_out_width[k] /2.0 ; }if (v->output_format[k] == dcn_bw_420) { v->dst_y_after_scaler =1.0 ; - }else { + } +else { v->dst_y_after_scaler =0.0 ; } v->time_calc =24.0 / v->projected_dcfclk_deep_sleep; - v->v_update_offset[k] =dcn_bw_ceil2 (v->htotal[k] /4.0 ,1.0 ); - v->total_repeater_delay = v->max_inter_dcn_tile_repeaters - * (2.0 / (v->required_dispclk[i][j] / (j +1 )) - +3.0 / v->required_dispclk[i][j]); - v->v_update_width[k] = (14.0 / v->projected_dcfclk_deep_sleep - +12.0 / (v->required_dispclk[i][j] / (j +1 )) - + v->total_repeater_delay) * v->pixel_clock[k]; - v->v_ready_offset[k] = -dcn_bw_max2 ( -150.0 - / (v->required_dispclk[i][j] - / (j - +1 )), - v->total_repeater_delay - +20.0 - / v->projected_dcfclk_deep_sleep - +10.0 - / (v->required_dispclk[i][j] - / (j - +1 ))) - * v->pixel_clock[k]; - v->time_setup = (v->v_update_offset[k] + v->v_update_width[k] - + v->v_ready_offset[k]) / v->pixel_clock[k]; - v->extra_latency = - v->urgent_round_trip_and_out_of_order_latency_per_state[i] - + (v->total_number_of_active_dpp[i][j] - * v->pixel_chunk_size_in_kbyte - + v->total_number_of_dcc_active_dpp[i][j] - * v->meta_chunk_size) - *1024.0 - / v->return_bw_per_state[i]; + v->v_update_offset[k] =dcn_bw_ceil2 (v->htotal[k] /4.0 ,1.0 ); + v->total_repeater_delay = v->max_inter_dcn_tile_repeaters * (2.0 / (v->required_dispclk[i][j] / (j +1 )) +3.0 / v->required_dispclk[i][j]); + v->v_update_width[k] = (14.0 / v->projected_dcfclk_deep_sleep +12.0 / (v->required_dispclk[i][j] / (j +1 )) + v->total_repeater_delay) * v->pixel_clock[k]; + v->v_ready_offset[k] =dcn_bw_max2 (150.0 / (v->required_dispclk[i][j] / (j +1 )), v->total_repeater_delay +20.0 / v->projected_dcfclk_deep_sleep +10.0 / (v->required_dispclk[i][j] / (j +1 ))) * v->pixel_clock[k]; + v->time_setup = (v->v_update_offset[k] + v->v_update_width[k] + v->v_ready_offset[k]) / v->pixel_clock[k]; + v->extra_latency = v->urgent_round_trip_and_out_of_order_latency_per_state[i] + (v->total_number_of_active_dpp[i][j] * v->pixel_chunk_size_in_kbyte + v->total_number_of_dcc_active_dpp[i][j] * v->meta_chunk_size) *1024.0 / v->return_bw_per_state[i];if (v->pte_enable == dcn_bw_yes) { - v->extra_latency = v->extra_latency - + v->total_number_of_active_dpp[i][j] - * v->pte_chunk_size *1024.0 - / v->return_bw_per_state[i]; + v->extra_latency = v->extra_latency + v->total_number_of_active_dpp[i][j] * v->pte_chunk_size *1024.0 / v->return_bw_per_state[i]; } -if (v->can_vstartup_lines_exceed_vsync_plus_back_porch_lines_minus_one - == dcn_bw_yes) { +if (v->can_vstartup_lines_exceed_vsync_plus_back_porch_lines_minus_one == dcn_bw_yes) { v->maximum_vstartup = v->vtotal[k] - v->vactive[k] -1.0 ; - }else { + } +else { v->maximum_vstartup = v->v_sync_plus_back_porch[k] -1.0 ; } - v->line_times_for_prefetch[k] = v->maximum_vstartup - - v->urgent_latency - / (v->htotal[k] / v->pixel_clock[k]) - - (v->time_calc + v->time_setup) - / (v->htotal[k] / v->pixel_clock[k]) - - (v->dst_y_after_scaler - + v->dst_x_after_scaler - / v->htotal[k]); - v->line_times_for_prefetch[k] =dcn_bw_floor2 ( -4.0 * (v->line_times_for_prefetch[k] +0.125 ), -1.0 ) /4 ; - v->prefetch_bw[k] = - (v->meta_pte_bytes_per_frame[k] - +2.0 * v->meta_row_bytes[k] - +2.0 * v->dpte_bytes_per_row[k] - + v->prefetch_lines_y[k] - * v->swath_width_yper_state[i][j][k] - *dcn_bw_ceil2 ( - v->byte_per_pixel_in_dety[k], -1.0 ) - + v->prefetch_lines_c[k] - * v->swath_width_yper_state[i][j][k] - /2.0 - *dcn_bw_ceil2 ( - v->byte_per_pixel_in_detc[k], -2.0 )) - / (v->line_times_for_prefetch[k] - * v->htotal[k] - / v->pixel_clock[k]); + v->line_times_for_prefetch[k] = v->maximum_vstartup - v->urgent_latency / (v->htotal[k] / v->pixel_clock[k]) - (v->time_calc + v->time_setup) / (v->htotal[k] / v->pixel_clock[k]) - (v->dst_y_after_scaler + v->dst_x_after_scaler / v->htotal[k]); + v->line_times_for_prefetch[k] =dcn_bw_floor2 (4.0 * (v->line_times_for_prefetch[k] +0.125 ),1.0 ) /4 ; + v->prefetch_bw[k] = (v->meta_pte_bytes_per_frame[k] +2.0 * v->meta_row_bytes[k] +2.0 * v->dpte_bytes_per_row[k] + v->prefetch_lines_y[k] * v->swath_width_yper_state[i][j][k] *dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) + v->prefetch_lines_c[k] * v->swath_width_yper_state[i][j][k] /2.0 *dcn_bw_ceil2 (v->byte_per_pixel_in_detc[k],2.0 )) / (v->line_times_for_prefetch[k] * v->htotal[k] / v->pixel_clock[k]); } v->bw_available_for_immediate_flip = v->return_bw_per_state[i];for (k =0 ; k <= v->number_of_active_planes -1 ; k++) { - v->bw_available_for_immediate_flip = - v->bw_available_for_immediate_flip - -dcn_bw_max2 ( - v->read_bandwidth[k], - v->prefetch_bw[k]); + v->bw_available_for_immediate_flip = v->bw_available_for_immediate_flip -dcn_bw_max2 (v->read_bandwidth[k], v->prefetch_bw[k]); } - v->total_immediate_flip_bytes[k] =0.0 ;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) { -if ((v->source_pixel_format[k] != dcn_bw_yuv420_sub_8 - && v->source_pixel_format[k] != dcn_bw_yuv420_sub_10)) { - v->total_immediate_flip_bytes[k] = - v->total_immediate_flip_bytes[k] - + v->meta_pte_bytes_per_frame[k] - + v->meta_row_bytes[k] - + v->dpte_bytes_per_row[k]; + v->total_immediate_flip_bytes[k] =0.0 ; +if ((v->source_pixel_format[k] != dcn_bw_yuv420_sub_8 && v->source_pixel_format[k] != dcn_bw_yuv420_sub_10)) { + v->total_immediate_flip_bytes[k] = v->total_immediate_flip_bytes[k] + v->meta_pte_bytes_per_frame[k] + v->meta_row_bytes[k] + v->dpte_bytes_per_row[k]; } }for (k =0 ; k <= v->number_of_active_planes -1 ; k++) {if (v->pte_enable == dcn_bw_yes && v->dcc_enable[k] == dcn_bw_yes) { - v->time_for_meta_pte_with_immediate_flip = -dcn_bw_max5 ( - v->meta_pte_bytes_per_frame[k] - / v->prefetch_bw[k], - v->meta_pte_bytes_per_frame[k] - * v->total_immediate_flip_bytes[k] - / (v->bw_available_for_immediate_flip - * (v->meta_pte_bytes_per_frame[k] - + v->meta_row_bytes[k] - + v->dpte_bytes_per_row[k])), - v->extra_latency, - v->urgent_latency, - v->htotal[k] - / v->pixel_clock[k] - /4.0 ); - v->time_for_meta_pte_without_immediate_flip =dcn_bw_max3 ( - v->meta_pte_bytes_per_frame[k] - / v->prefetch_bw[k], - v->extra_latency, - v->htotal[k] / v->pixel_clock[k] /4.0 ); - }else { - v->time_for_meta_pte_with_immediate_flip = v->htotal[k] - / v->pixel_clock[k] /4.0 ; - v->time_for_meta_pte_without_immediate_flip = v->htotal[k] - / v->pixel_clock[k] /4.0 ; + v->time_for_meta_pte_with_immediate_flip =dcn_bw_max5 (v->meta_pte_bytes_per_frame[k] / v->prefetch_bw[k], v->meta_pte_bytes_per_frame[k] * v->total_immediate_flip_bytes[k] / (v->bw_available_for_immediate_flip * (v->meta_pte_bytes_per_frame[k] + v->meta_row_bytes[k] + v->dpte_bytes_per_row[k])), v->extra_latency, v->urgent_latency, v->htotal[k] / v->pixel_clock[k] /4.0 ); + v->time_for_meta_pte_without_immediate_flip =dcn_bw_max3 (v->meta_pte_bytes_per_frame[k] / v->prefetch_bw[k], v->extra_latency, v->htotal[k] / v->pixel_clock[k] /4.0 ); + } +else { + v->time_for_meta_pte_with_immediate_flip = v->htotal[k] / v->pixel_clock[k] /4.0 ; + v->time_for_meta_pte_without_immediate_flip = v->htotal[k] / v->pixel_clock[k] /4.0 ; }if (v->pte_enable == dcn_bw_yes || v->dcc_enable[k] == dcn_bw_yes) { - v->time_for_meta_and_dpte_row_with_immediate_flip = -dcn_bw_max5 ( - (v->meta_row_bytes[k] - + v->dpte_bytes_per_row[k]) - / v->prefetch_bw[k], - (v->meta_row_bytes[k] - + v->dpte_bytes_per_row[k]) - * v->total_immediate_flip_bytes[k] - / (v->bw_available_for_immediate_flip - * (v->meta_pte_bytes_per_frame[k] - + v->meta_row_bytes[k] - + v->dpte_bytes_per_row[k])), - v->htotal[k] - / v->pixel_clock[k] - - v->time_for_meta_pte_with_immediate_flip, - v->extra_latency, -2.0 * v->urgent_latency); - v->time_for_meta_and_dpte_row_without_immediate_flip = -dcn_bw_max3 ( - (v->meta_row_bytes[k] - + v->dpte_bytes_per_row[k]) - / v->prefetch_bw[k], - v->htotal[k] - / v->pixel_clock[k] - - v->time_for_meta_pte_without_immediate_flip, - v->extra_latency); - }else { - v->time_for_meta_and_dpte_row_with_immediate_flip = -dcn_bw_max2 ( - v->htotal[k] - / v->pixel_clock[k] - - v->time_for_meta_pte_with_immediate_flip, - v->extra_latency - - v->time_for_meta_pte_with_immediate_flip); - v->time_for_meta_and_dpte_row_without_immediate_flip = -dcn_bw_max2 ( - v->htotal[k] - / v->pixel_clock[k] - - v->time_for_meta_pte_without_immediate_flip, - v->extra_latency - - v->time_for_meta_pte_without_immediate_flip); - } - v->lines_for_meta_pte_with_immediate_flip[k] = -dcn_bw_floor2 ( -4.0 - * (v->time_for_meta_pte_with_immediate_flip - / (v->htotal[k] - / v->pixel_clock[k]) - +0.125 ), -1.0 ) /4 ; - v->lines_for_meta_pte_without_immediate_flip[k] = -dcn_bw_floor2 ( -4.0 - * (v->time_for_meta_pte_without_immediate_flip - / (v->htotal[k] - / v->pixel_clock[k]) - +0.125 ), -1.0 ) /4 ; - v->lines_for_meta_and_dpte_row_with_immediate_flip[k] = -dcn_bw_floor2 ( -4.0 - * (v->time_for_meta_and_dpte_row_with_immediate_flip - / (v->htotal[k] - / v->pixel_clock[k]) - +0.125 ), -1.0 ) /4 ; - v->lines_for_meta_and_dpte_row_without_immediate_flip[k] = -dcn_bw_floor2 ( -4.0 - * (v->time_for_meta_and_dpte_row_without_immediate_flip - / (v->htotal[k] - / v->pixel_clock[k]) - +0.125 ), -1.0 ) /4 ; - v->line_times_to_request_prefetch_pixel_data_with_immediate_flip = - v->line_times_for_prefetch[k] - - v->lines_for_meta_pte_with_immediate_flip[k] - - v->lines_for_meta_and_dpte_row_with_immediate_flip[k]; - v->line_times_to_request_prefetch_pixel_data_without_immediate_flip = - v->line_times_for_prefetch[k] - - v->lines_for_meta_pte_without_immediate_flip[k] - - v->lines_for_meta_and_dpte_row_without_immediate_flip[k]; -if (v->line_times_to_request_prefetch_pixel_data_with_immediate_flip - >0.0 ) { - v->v_ratio_pre_ywith_immediate_flip[i][j][k] = - v->prefetch_lines_y[k] - / v->line_times_to_request_prefetch_pixel_data_with_immediate_flip; + v->time_for_meta_and_dpte_row_with_immediate_flip =dcn_bw_max5 ((v->meta_row_bytes[k] + v->dpte_bytes_per_row[k]) / v->prefetch_bw[k], (v->meta_row_bytes[k] + v->dpte_bytes_per_row[k]) * v->total_immediate_flip_bytes[k] / (v->bw_available_for_immediate_flip * (v->meta_pte_bytes_per_frame[k] + v->meta_row_bytes[k] + v->dpte_bytes_per_row[k])), v->htotal[k] / v->pixel_clock[k] - v->time_for_meta_pte_with_immediate_flip, v->extra_latency,2.0 * v->urgent_latency); + v->time_for_meta_and_dpte_row_without_immediate_flip =dcn_bw_max3 ((v->meta_row_bytes[k] + v->dpte_bytes_per_row[k]) / v->prefetch_bw[k], v->htotal[k] / v->pixel_clock[k] - v->time_for_meta_pte_without_immediate_flip, v->extra_latency); + } +else { + v->time_for_meta_and_dpte_row_with_immediate_flip =dcn_bw_max2 (v->htotal[k] / v->pixel_clock[k] - v->time_for_meta_pte_with_immediate_flip, v->extra_latency - v->time_for_meta_pte_with_immediate_flip); + v->time_for_meta_and_dpte_row_without_immediate_flip =dcn_bw_max2 (v->htotal[k] / v->pixel_clock[k] - v->time_for_meta_pte_without_immediate_flip, v->extra_latency - v->time_for_meta_pte_without_immediate_flip); + } + v->lines_for_meta_pte_with_immediate_flip[k] =dcn_bw_floor2 (4.0 * (v->time_for_meta_pte_with_immediate_flip / (v->htotal[k] / v->pixel_clock[k]) +0.125 ),1.0 ) /4 ; + v->lines_for_meta_pte_without_immediate_flip[k] =dcn_bw_floor2 (4.0 * (v->time_for_meta_pte_without_immediate_flip / (v->htotal[k] / v->pixel_clock[k]) +0.125 ),1.0 ) /4 ; + v->lines_for_meta_and_dpte_row_with_immediate_flip[k] =dcn_bw_floor2 (4.0 * (v->time_for_meta_and_dpte_row_with_immediate_flip / (v->htotal[k] / v->pixel_clock[k]) +0.125 ),1.0 ) /4 ; + v->lines_for_meta_and_dpte_row_without_immediate_flip[k] =dcn_bw_floor2 (4.0 * (v->time_for_meta_and_dpte_row_without_immediate_flip / (v->htotal[k] / v->pixel_clock[k]) +0.125 ),1.0 ) /4 ; + v->line_times_to_request_prefetch_pixel_data_with_immediate_flip = v->line_times_for_prefetch[k] - v->lines_for_meta_pte_with_immediate_flip[k] - v->lines_for_meta_and_dpte_row_with_immediate_flip[k]; + v->line_times_to_request_prefetch_pixel_data_without_immediate_flip = v->line_times_for_prefetch[k] - v->lines_for_meta_pte_without_immediate_flip[k] - v->lines_for_meta_and_dpte_row_without_immediate_flip[k]; +if (v->line_times_to_request_prefetch_pixel_data_with_immediate_flip >0.0 ) { + v->v_ratio_pre_ywith_immediate_flip[i][j][k] = v->prefetch_lines_y[k] / v->line_times_to_request_prefetch_pixel_data_with_immediate_flip;if ((v->swath_height_yper_state[i][j][k] >4.0 )) { -if (v->line_times_to_request_prefetch_pixel_data_with_immediate_flip - - (v->prefill_y[k] -3.0 ) /2.0 - >0.0 ) { - v->v_ratio_pre_ywith_immediate_flip[i][j][k] = -dcn_bw_max2 ( - v->v_ratio_pre_ywith_immediate_flip[i][j][k], - (v->max_num_sw_y[k] - * v->swath_height_yper_state[i][j][k]) - / (v->line_times_to_request_prefetch_pixel_data_with_immediate_flip - - (v->prefill_y[k] - -3.0 ) - /2.0 )); - }else { - v->v_ratio_pre_ywith_immediate_flip[i][j][k] = -999999.0 ; +if (v->line_times_to_request_prefetch_pixel_data_with_immediate_flip - (v->prefill_y[k] -3.0 ) /2.0 >0.0 ) { + v->v_ratio_pre_ywith_immediate_flip[i][j][k] =dcn_bw_max2 (v->v_ratio_pre_ywith_immediate_flip[i][j][k], (v->max_num_sw_y[k] * v->swath_height_yper_state[i][j][k]) / (v->line_times_to_request_prefetch_pixel_data_with_immediate_flip - (v->prefill_y[k] -3.0 ) /2.0 )); + } +else { + v->v_ratio_pre_ywith_immediate_flip[i][j][k] =999999.0 ; } } - v->v_ratio_pre_cwith_immediate_flip[i][j][k] = - v->prefetch_lines_c[k] - / v->line_times_to_request_prefetch_pixel_data_with_immediate_flip; + v->v_ratio_pre_cwith_immediate_flip[i][j][k] = v->prefetch_lines_c[k] / v->line_times_to_request_prefetch_pixel_data_with_immediate_flip;if ((v->swath_height_cper_state[i][j][k] >4.0 )) { -if (v->line_times_to_request_prefetch_pixel_data_with_immediate_flip - - (v->prefill_c[k] -3.0 ) /2.0 - >0.0 ) { - v->v_ratio_pre_cwith_immediate_flip[i][j][k] = -dcn_bw_max2 ( - v->v_ratio_pre_cwith_immediate_flip[i][j][k], - (v->max_num_sw_c[k] - * v->swath_height_cper_state[i][j][k]) - / (v->line_times_to_request_prefetch_pixel_data_with_immediate_flip - - (v->prefill_c[k] - -3.0 ) - /2.0 )); - }else { - v->v_ratio_pre_cwith_immediate_flip[i][j][k] = -999999.0 ; +if (v->line_times_to_request_prefetch_pixel_data_with_immediate_flip - (v->prefill_c[k] -3.0 ) /2.0 >0.0 ) { + v->v_ratio_pre_cwith_immediate_flip[i][j][k] =dcn_bw_max2 (v->v_ratio_pre_cwith_immediate_flip[i][j][k], (v->max_num_sw_c[k] * v->swath_height_cper_state[i][j][k]) / (v->line_times_to_request_prefetch_pixel_data_with_immediate_flip - (v->prefill_c[k] -3.0 ) /2.0 )); + } +else { + v->v_ratio_pre_cwith_immediate_flip[i][j][k] =999999.0 ; } } - v->required_prefetch_pixel_data_bw_with_immediate_flip[i][j][k] = - v->no_of_dpp[i][j][k] - * (v->prefetch_lines_y[k] - / v->line_times_to_request_prefetch_pixel_data_with_immediate_flip - *dcn_bw_ceil2 ( - v->byte_per_pixel_in_dety[k], -1.0 ) - + v->prefetch_lines_c[k] - / v->line_times_to_request_prefetch_pixel_data_with_immediate_flip - *dcn_bw_ceil2 ( - v->byte_per_pixel_in_detc[k], -2.0 ) - /2.0 ) - * v->swath_width_yper_state[i][j][k] - / (v->htotal[k] - / v->pixel_clock[k]); - }else { + v->required_prefetch_pixel_data_bw_with_immediate_flip[i][j][k] = v->no_of_dpp[i][j][k] * (v->prefetch_lines_y[k] / v->line_times_to_request_prefetch_pixel_data_with_immediate_flip *dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) + v->prefetch_lines_c[k] / v->line_times_to_request_prefetch_pixel_data_with_immediate_flip *dcn_bw_ceil2 (v->byte_per_pixel_in_detc[k],2.0 ) /2.0 ) * v->swath_width_yper_state[i][j][k] / (v->htotal[k] / v->pixel_clock[k]); + } +else { v->v_ratio_pre_ywith_immediate_flip[i][j][k] =999999.0 ; v->v_ratio_pre_cwith_immediate_flip[i][j][k] =999999.0 ; - v->required_prefetch_pixel_data_bw_with_immediate_flip[i][j][k] = -999999.0 ; - } -if (v->line_times_to_request_prefetch_pixel_data_without_immediate_flip - >0.0 ) { - v->v_ratio_pre_ywithout_immediate_flip[i][j][k] = - v->prefetch_lines_y[k] - / v->line_times_to_request_prefetch_pixel_data_without_immediate_flip; + v->required_prefetch_pixel_data_bw_with_immediate_flip[i][j][k] =999999.0 ; + } +if (v->line_times_to_request_prefetch_pixel_data_without_immediate_flip >0.0 ) { + v->v_ratio_pre_ywithout_immediate_flip[i][j][k] = v->prefetch_lines_y[k] / v->line_times_to_request_prefetch_pixel_data_without_immediate_flip;if ((v->swath_height_yper_state[i][j][k] >4.0 )) { -if (v->line_times_to_request_prefetch_pixel_data_without_immediate_flip - - (v->prefill_y[k] -3.0 ) /2.0 - >0.0 ) { - v->v_ratio_pre_ywithout_immediate_flip[i][j][k] = -dcn_bw_max2 ( - v->v_ratio_pre_ywithout_immediate_flip[i][j][k], - (v->max_num_sw_y[k] - * v->swath_height_yper_state[i][j][k]) - / (v->line_times_to_request_prefetch_pixel_data_without_immediate_flip - - (v->prefill_y[k] - -3.0 ) - /2.0 )); - }else { - v->v_ratio_pre_ywithout_immediate_flip[i][j][k] = -999999.0 ; +if (v->line_times_to_request_prefetch_pixel_data_without_immediate_flip - (v->prefill_y[k] -3.0 ) /2.0 >0.0 ) { + v->v_ratio_pre_ywithout_immediate_flip[i][j][k] =dcn_bw_max2 (v->v_ratio_pre_ywithout_immediate_flip[i][j][k], (v->max_num_sw_y[k] * v->swath_height_yper_state[i][j][k]) / (v->line_times_to_request_prefetch_pixel_data_without_immediate_flip - (v->prefill_y[k] -3.0 ) /2.0 )); + } +else { + v->v_ratio_pre_ywithout_immediate_flip[i][j][k] =999999.0 ; } } - v->v_ratio_pre_cwithout_immediate_flip[i][j][k] = - v->prefetch_lines_c[k] - / v->line_times_to_request_prefetch_pixel_data_without_immediate_flip; + v->v_ratio_pre_cwithout_immediate_flip[i][j][k] = v->prefetch_lines_c[k] / v->line_times_to_request_prefetch_pixel_data_without_immediate_flip;if ((v->swath_height_cper_state[i][j][k] >4.0 )) { -if (v->line_times_to_request_prefetch_pixel_data_without_immediate_flip - - (v->prefill_c[k] -3.0 ) /2.0 - >0.0 ) { - v->v_ratio_pre_cwithout_immediate_flip[i][j][k] = -dcn_bw_max2 ( - v->v_ratio_pre_cwithout_immediate_flip[i][j][k], - (v->max_num_sw_c[k] - * v->swath_height_cper_state[i][j][k]) - / (v->line_times_to_request_prefetch_pixel_data_without_immediate_flip - - (v->prefill_c[k] - -3.0 ) - /2.0 )); - }else { - v->v_ratio_pre_cwithout_immediate_flip[i][j][k] = -999999.0 ; +if (v->line_times_to_request_prefetch_pixel_data_without_immediate_flip - (v->prefill_c[k] -3.0 ) /2.0 >0.0 ) { + v->v_ratio_pre_cwithout_immediate_flip[i][j][k] =dcn_bw_max2 (v->v_ratio_pre_cwithout_immediate_flip[i][j][k], (v->max_num_sw_c[k] * v->swath_height_cper_state[i][j][k]) / (v->line_times_to_request_prefetch_pixel_data_without_immediate_flip - (v->prefill_c[k] -3.0 ) /2.0 )); + } +else { + v->v_ratio_pre_cwithout_immediate_flip[i][j][k] =999999.0 ; } } - v->required_prefetch_pixel_data_bw_without_immediate_flip[i][j][k] = - v->no_of_dpp[i][j][k] - * (v->prefetch_lines_y[k] - / v->line_times_to_request_prefetch_pixel_data_without_immediate_flip - *dcn_bw_ceil2 ( - v->byte_per_pixel_in_dety[k], -1.0 ) - + v->prefetch_lines_c[k] - / v->line_times_to_request_prefetch_pixel_data_without_immediate_flip - *dcn_bw_ceil2 ( - v->byte_per_pixel_in_detc[k], -2.0 ) - /2.0 ) - * v->swath_width_yper_state[i][j][k] - / (v->htotal[k] - / v->pixel_clock[k]); - }else { + v->required_prefetch_pixel_data_bw_without_immediate_flip[i][j][k] = v->no_of_dpp[i][j][k] * (v->prefetch_lines_y[k] / v->line_times_to_request_prefetch_pixel_data_without_immediate_flip *dcn_bw_ceil2 (v->byte_per_pixel_in_dety[k],1.0 ) + v->prefetch_lines_c[k] / v->line_times_to_request_prefetch_pixel_data_without_immediate_flip *dcn_bw_ceil2 (v->byte_per_pixel_in_detc[k],2.0 ) /2.0 ) * v->swath_width_yper_state[i][j][k] / (v->htotal[k] / v->pixel_clock[k]); + } +else { v->v_ratio_pre_ywithout_immediate_flip[i][j][k] =999999.0 ; v->v_ratio_pre_cwithout_immediate_flip[i][j][k] =999999.0 ; - v->required_prefetch_pixel_data_bw_without_immediate_flip[i][j][k] = -999999.0 ; + v->required_prefetch_pixel_data_bw_without_immediate_flip[i][j][k] =999999.0 ; } } v->maximum_read_bandwidth_with_prefetch_with_immediate_flip =0.0 ;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) { -if ((v->source_pixel_format[k] != dcn_bw_yuv420_sub_8 - && v->source_pixel_format[k] != dcn_bw_yuv420_sub_10)) { - v->maximum_read_bandwidth_with_prefetch_with_immediate_flip = - v->maximum_read_bandwidth_with_prefetch_with_immediate_flip - +dcn_bw_max2 ( - v->read_bandwidth[k], - v->required_prefetch_pixel_data_bw_with_immediate_flip[i][j][k]) - +dcn_bw_max2 ( - v->meta_pte_bytes_per_frame[k] - / (v->lines_for_meta_pte_with_immediate_flip[k] - * v->htotal[k] - / v->pixel_clock[k]), - (v->meta_row_bytes[k] - + v->dpte_bytes_per_row[k]) - / (v->lines_for_meta_and_dpte_row_with_immediate_flip[k] - * v->htotal[k] - / v->pixel_clock[k])); - }else { - v->maximum_read_bandwidth_with_prefetch_with_immediate_flip = - v->maximum_read_bandwidth_with_prefetch_with_immediate_flip - +dcn_bw_max2 ( - v->read_bandwidth[k], - v->required_prefetch_pixel_data_bw_without_immediate_flip[i][j][k]); +if ((v->source_pixel_format[k] != dcn_bw_yuv420_sub_8 && v->source_pixel_format[k] != dcn_bw_yuv420_sub_10)) { + v->maximum_read_bandwidth_with_prefetch_with_immediate_flip = v->maximum_read_bandwidth_with_prefetch_with_immediate_flip +dcn_bw_max2 (v->read_bandwidth[k], v->required_prefetch_pixel_data_bw_with_immediate_flip[i][j][k]) +dcn_bw_max2 (v->meta_pte_bytes_per_frame[k] / (v->lines_for_meta_pte_with_immediate_flip[k] * v->htotal[k] / v->pixel_clock[k]), (v->meta_row_bytes[k] + v->dpte_bytes_per_row[k]) / (v->lines_for_meta_and_dpte_row_with_immediate_flip[k] * v->htotal[k] / v->pixel_clock[k])); + } +else { + v->maximum_read_bandwidth_with_prefetch_with_immediate_flip = v->maximum_read_bandwidth_with_prefetch_with_immediate_flip +dcn_bw_max2 (v->read_bandwidth[k], v->required_prefetch_pixel_data_bw_without_immediate_flip[i][j][k]); } } v->maximum_read_bandwidth_with_prefetch_without_immediate_flip =0.0 ;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) { - v->maximum_read_bandwidth_with_prefetch_without_immediate_flip = - v->maximum_read_bandwidth_with_prefetch_without_immediate_flip - +dcn_bw_max2 ( - v->read_bandwidth[k], - v->required_prefetch_pixel_data_bw_without_immediate_flip[i][j][k]); + v->maximum_read_bandwidth_with_prefetch_without_immediate_flip = v->maximum_read_bandwidth_with_prefetch_without_immediate_flip +dcn_bw_max2 (v->read_bandwidth[k], v->required_prefetch_pixel_data_bw_without_immediate_flip[i][j][k]); } v->prefetch_supported_with_immediate_flip[i][j] = dcn_bw_yes; -if (v->maximum_read_bandwidth_with_prefetch_with_immediate_flip - > v->return_bw_per_state[i]) { +if (v->maximum_read_bandwidth_with_prefetch_with_immediate_flip > v->return_bw_per_state[i]) { v->prefetch_supported_with_immediate_flip[i][j] = dcn_bw_no; }for (k =0 ; k <= v->number_of_active_planes -1 ; k++) { -if (v->line_times_for_prefetch[k] <2.0 - || v->lines_for_meta_pte_with_immediate_flip[k] - >=8.0 - || v->lines_for_meta_and_dpte_row_with_immediate_flip[k] - >=16.0 ) { +if (v->line_times_for_prefetch[k] <2.0 || v->lines_for_meta_pte_with_immediate_flip[k] >=8.0 || v->lines_for_meta_and_dpte_row_with_immediate_flip[k] >=16.0 ) { v->prefetch_supported_with_immediate_flip[i][j] = dcn_bw_no; } } v->prefetch_supported_without_immediate_flip[i][j] = dcn_bw_yes; -if (v->maximum_read_bandwidth_with_prefetch_without_immediate_flip - > v->return_bw_per_state[i]) { +if (v->maximum_read_bandwidth_with_prefetch_without_immediate_flip > v->return_bw_per_state[i]) { v->prefetch_supported_without_immediate_flip[i][j] = dcn_bw_no; }for (k =0 ; k <= v->number_of_active_planes -1 ; k++) { -if (v->line_times_for_prefetch[k] <2.0 - || v->lines_for_meta_pte_without_immediate_flip[k] - >=8.0 - || v->lines_for_meta_and_dpte_row_without_immediate_flip[k] - >=16.0 ) { - v->prefetch_supported_without_immediate_flip[i][j] = - dcn_bw_no; +if (v->line_times_for_prefetch[k] <2.0 || v->lines_for_meta_pte_without_immediate_flip[k] >=8.0 || v->lines_for_meta_and_dpte_row_without_immediate_flip[k] >=16.0 ) { + v->prefetch_supported_without_immediate_flip[i][j] = dcn_bw_no; } } }
@@ -1894,31 +904,14 @@ void mode_support_and_system_configuration(struct dcn_bw_internal_vars *v)for (j =0 ; j <=1 ; j++) { v->v_ratio_in_prefetch_supported_with_immediate_flip[i][j] = dcn_bw_yes;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) { -if ((((v->source_pixel_format[k] != dcn_bw_yuv420_sub_8 - && v->source_pixel_format[k] != dcn_bw_yuv420_sub_10) - && (v->v_ratio_pre_ywith_immediate_flip[i][j][k] - >4.0 - || v->v_ratio_pre_cwith_immediate_flip[i][j][k] - >4.0 )) - || ((v->source_pixel_format[k] - == dcn_bw_yuv420_sub_8 - || v->source_pixel_format[k] - == dcn_bw_yuv420_sub_10) - && (v->v_ratio_pre_ywithout_immediate_flip[i][j][k] - >4.0 - || v->v_ratio_pre_cwithout_immediate_flip[i][j][k] - >4.0 )))) { - v->v_ratio_in_prefetch_supported_with_immediate_flip[i][j] = - dcn_bw_no; +if ((((v->source_pixel_format[k] != dcn_bw_yuv420_sub_8 && v->source_pixel_format[k] != dcn_bw_yuv420_sub_10) && (v->v_ratio_pre_ywith_immediate_flip[i][j][k] >4.0 || v->v_ratio_pre_cwith_immediate_flip[i][j][k] >4.0 )) || ((v->source_pixel_format[k] == dcn_bw_yuv420_sub_8 || v->source_pixel_format[k] == dcn_bw_yuv420_sub_10) && (v->v_ratio_pre_ywithout_immediate_flip[i][j][k] >4.0 || v->v_ratio_pre_cwithout_immediate_flip[i][j][k] >4.0 )))) { + v->v_ratio_in_prefetch_supported_with_immediate_flip[i][j] = dcn_bw_no; } } v->v_ratio_in_prefetch_supported_without_immediate_flip[i][j] = dcn_bw_yes;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) { -if ((v->v_ratio_pre_ywithout_immediate_flip[i][j][k] >4.0 - || v->v_ratio_pre_cwithout_immediate_flip[i][j][k] - >4.0 )) { - v->v_ratio_in_prefetch_supported_without_immediate_flip[i][j] = - dcn_bw_no; +if ((v->v_ratio_pre_ywithout_immediate_flip[i][j][k] >4.0 || v->v_ratio_pre_cwithout_immediate_flip[i][j][k] >4.0 )) { + v->v_ratio_in_prefetch_supported_without_immediate_flip[i][j] = dcn_bw_no; } } }
@@ -1927,57 +920,41 @@ void mode_support_and_system_configuration(struct dcn_bw_internal_vars *v)for (i = number_of_states_plus_one; i >=0 ; i--) {for (j =0 ; j <=1 ; j++) { -if (v->scale_ratio_support == dcn_bw_yes - && v->source_format_pixel_and_scan_support == dcn_bw_yes - && v->viewport_size_support == dcn_bw_yes - && v->bandwidth_support[i] == dcn_bw_yes - && v->dio_support[i] == dcn_bw_yes - && v->urgent_latency_support[i][j] == dcn_bw_yes - && v->rob_support[i] == dcn_bw_yes - && v->dispclk_dppclk_support[i][j] == dcn_bw_yes - && v->total_available_pipes_support[i][j] == dcn_bw_yes - && v->total_available_writeback_support == dcn_bw_yes - && v->writeback_latency_support == dcn_bw_yes) { -if (v->prefetch_supported_with_immediate_flip[i][j] == dcn_bw_yes - && v->v_ratio_in_prefetch_supported_with_immediate_flip[i][j] - == dcn_bw_yes) { +if (v->scale_ratio_support == dcn_bw_yes && v->source_format_pixel_and_scan_support == dcn_bw_yes && v->viewport_size_support == dcn_bw_yes && v->bandwidth_support[i] == dcn_bw_yes && v->dio_support[i] == dcn_bw_yes && v->urgent_latency_support[i][j] == dcn_bw_yes && v->rob_support[i] == dcn_bw_yes && v->dispclk_dppclk_support[i][j] == dcn_bw_yes && v->total_available_pipes_support[i][j] == dcn_bw_yes && v->total_available_writeback_support == dcn_bw_yes && v->writeback_latency_support == dcn_bw_yes) { +if (v->prefetch_supported_with_immediate_flip[i][j] == dcn_bw_yes && v->v_ratio_in_prefetch_supported_with_immediate_flip[i][j] == dcn_bw_yes) { v->mode_support_with_immediate_flip[i][j] = dcn_bw_yes; - }else { + } +else { v->mode_support_with_immediate_flip[i][j] = dcn_bw_no; } -if (v->prefetch_supported_without_immediate_flip[i][j] == dcn_bw_yes - && v->v_ratio_in_prefetch_supported_without_immediate_flip[i][j] - == dcn_bw_yes) { +if (v->prefetch_supported_without_immediate_flip[i][j] == dcn_bw_yes && v->v_ratio_in_prefetch_supported_without_immediate_flip[i][j] == dcn_bw_yes) { v->mode_support_without_immediate_flip[i][j] = dcn_bw_yes; - }else { + } +else { v->mode_support_without_immediate_flip[i][j] = dcn_bw_no; } - }else { + } +else { v->mode_support_with_immediate_flip[i][j] = dcn_bw_no; v->mode_support_without_immediate_flip[i][j] = dcn_bw_no; } } }for (i = number_of_states_plus_one; i >=0 ; i--) { -if ((i == number_of_states_plus_one - || v->mode_support_with_immediate_flip[i][1 ] == dcn_bw_yes - || v->mode_support_with_immediate_flip[i][0 ] == dcn_bw_yes) - && i >= v->voltage_override_level) { +if ((i == number_of_states_plus_one || v->mode_support_with_immediate_flip[i][1 ] == dcn_bw_yes || v->mode_support_with_immediate_flip[i][0 ] == dcn_bw_yes) && i >= v->voltage_override_level) { v->voltage_level_with_immediate_flip = i; } }for (i = number_of_states_plus_one; i >=0 ; i--) { -if ((i == number_of_states_plus_one - || v->mode_support_without_immediate_flip[i][1 ] == dcn_bw_yes - || v->mode_support_without_immediate_flip[i][0 ] == dcn_bw_yes) - && i >= v->voltage_override_level) { +if ((i == number_of_states_plus_one || v->mode_support_without_immediate_flip[i][1 ] == dcn_bw_yes || v->mode_support_without_immediate_flip[i][0 ] == dcn_bw_yes) && i >= v->voltage_override_level) { v->voltage_level_without_immediate_flip = i; } }if (v->voltage_level_with_immediate_flip == number_of_states_plus_one) { v->immediate_flip_supported = dcn_bw_no; v->voltage_level = v->voltage_level_without_immediate_flip; - }else { + } +else { v->immediate_flip_supported = dcn_bw_yes; v->voltage_level = v->voltage_level_with_immediate_flip; }
@@ -1988,38 +965,27 @@ void mode_support_and_system_configuration(struct dcn_bw_internal_vars *v)for (k =0 ; k <= v->number_of_active_planes -1 ; k++) { v->dpp_per_plane_per_ratio[j][k] = v->no_of_dpp[v->voltage_level][j][k]; } - v->dispclk_dppclk_support_per_ratio[j] = - v->dispclk_dppclk_support[v->voltage_level][j]; + v->dispclk_dppclk_support_per_ratio[j] = v->dispclk_dppclk_support[v->voltage_level][j]; } v->max_phyclk = v->phyclk_per_state[v->voltage_level]; }void display_pipe_configuration (struct dcn_bw_internal_vars *v) { -int j, k; +int j; +int k;/*display pipe configuration*/ for (j =0 ; j <=1 ; j++) { v->total_number_of_active_dpp_per_ratio[j] =0.0 ;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) { - v->total_number_of_active_dpp_per_ratio[j] = - v->total_number_of_active_dpp_per_ratio[j] - + v->dpp_per_plane_per_ratio[j][k]; - } - } -if ((v->dispclk_dppclk_support_per_ratio[0 ] == dcn_bw_yes - && v->dispclk_dppclk_support_per_ratio[1 ] == dcn_bw_no) - || (v->dispclk_dppclk_support_per_ratio[0 ] - == v->dispclk_dppclk_support_per_ratio[1 ] - && (v->total_number_of_active_dpp_per_ratio[0 ] - < v->total_number_of_active_dpp_per_ratio[1 ] - || (((v->total_number_of_active_dpp_per_ratio[0 ] - == v->total_number_of_active_dpp_per_ratio[1 ]) - && v->required_dispclk_per_ratio[0 ] - <=0.5 - * v->required_dispclk_per_ratio[1 ]))))) { + v->total_number_of_active_dpp_per_ratio[j] = v->total_number_of_active_dpp_per_ratio[j] + v->dpp_per_plane_per_ratio[j][k]; + } + } +if ((v->dispclk_dppclk_support_per_ratio[0 ] == dcn_bw_yes && v->dispclk_dppclk_support_per_ratio[1 ] == dcn_bw_no) || (v->dispclk_dppclk_support_per_ratio[0 ] == v->dispclk_dppclk_support_per_ratio[1 ] && (v->total_number_of_active_dpp_per_ratio[0 ] < v->total_number_of_active_dpp_per_ratio[1 ] || (((v->total_number_of_active_dpp_per_ratio[0 ] == v->total_number_of_active_dpp_per_ratio[1 ]) && v->required_dispclk_per_ratio[0 ] <=0.5 * v->required_dispclk_per_ratio[1 ]))))) { v->dispclk_dppclk_ratio =1 ; v->final_error_message = v->error_message[0 ]; - }else { + } +else { v->dispclk_dppclk_ratio =2 ; v->final_error_message = v->error_message[1 ]; }
@@ -2030,159 +996,139 @@ void display_pipe_configuration(struct dcn_bw_internal_vars *v)if (v->source_pixel_format[k] == dcn_bw_rgb_sub_64) { v->byte_per_pix_dety =8.0 ; v->byte_per_pix_detc =0.0 ; - }else if (v->source_pixel_format[k] == dcn_bw_rgb_sub_32) { + } +else if (v->source_pixel_format[k] == dcn_bw_rgb_sub_32) { v->byte_per_pix_dety =4.0 ; v->byte_per_pix_detc =0.0 ; - }else if (v->source_pixel_format[k] == dcn_bw_rgb_sub_16) { + } +else if (v->source_pixel_format[k] == dcn_bw_rgb_sub_16) { v->byte_per_pix_dety =2.0 ; v->byte_per_pix_detc =0.0 ; - }else if (v->source_pixel_format[k] == dcn_bw_yuv420_sub_8) { + } +else if (v->source_pixel_format[k] == dcn_bw_yuv420_sub_8) { v->byte_per_pix_dety =1.0 ; v->byte_per_pix_detc =2.0 ; - }else { - v->byte_per_pix_dety =4.0f /3 ; - v->byte_per_pix_detc =8.0f /3 ; } -if ((v->source_pixel_format[k] == dcn_bw_rgb_sub_64 - || v->source_pixel_format[k] == dcn_bw_rgb_sub_32 - || v->source_pixel_format[k] == dcn_bw_rgb_sub_16)) { +else { + v->byte_per_pix_dety =4.0f /3.0f ; + v->byte_per_pix_detc =8.0f /3.0f ; + } +if ((v->source_pixel_format[k] == dcn_bw_rgb_sub_64 || v->source_pixel_format[k] == dcn_bw_rgb_sub_32 || v->source_pixel_format[k] == dcn_bw_rgb_sub_16)) {if (v->source_surface_mode[k] == dcn_bw_sw_linear) { v->read256_bytes_block_height_y =1.0 ; - }else if (v->source_pixel_format[k] == dcn_bw_rgb_sub_64) { + } +else if (v->source_pixel_format[k] == dcn_bw_rgb_sub_64) { v->read256_bytes_block_height_y =4.0 ; - }else { + } +else { v->read256_bytes_block_height_y =8.0 ; } - v->read256_bytes_block_width_y =256.0 /dcn_bw_ceil2 (v->byte_per_pix_dety,1.0 ) - / v->read256_bytes_block_height_y; + v->read256_bytes_block_width_y =256.0 /dcn_bw_ceil2 (v->byte_per_pix_dety,1.0 ) / v->read256_bytes_block_height_y; v->read256_bytes_block_height_c =0.0 ; v->read256_bytes_block_width_c =0.0 ; - }else { + } +else {if (v->source_surface_mode[k] == dcn_bw_sw_linear) { v->read256_bytes_block_height_y =1.0 ; v->read256_bytes_block_height_c =1.0 ; - }else if (v->source_pixel_format[k] == dcn_bw_yuv420_sub_8) { + } +else if (v->source_pixel_format[k] == dcn_bw_yuv420_sub_8) { v->read256_bytes_block_height_y =16.0 ; v->read256_bytes_block_height_c =8.0 ; - }else { + } +else { v->read256_bytes_block_height_y =8.0 ; v->read256_bytes_block_height_c =8.0 ; } - v->read256_bytes_block_width_y =256.0 /dcn_bw_ceil2 (v->byte_per_pix_dety,1.0 ) - / v->read256_bytes_block_height_y; - v->read256_bytes_block_width_c =256.0 /dcn_bw_ceil2 (v->byte_per_pix_detc,2.0 ) - / v->read256_bytes_block_height_c; + v->read256_bytes_block_width_y =256.0 /dcn_bw_ceil2 (v->byte_per_pix_dety,1.0 ) / v->read256_bytes_block_height_y; + v->read256_bytes_block_width_c =256.0 /dcn_bw_ceil2 (v->byte_per_pix_detc,2.0 ) / v->read256_bytes_block_height_c; }if (v->source_scan[k] == dcn_bw_hor) { v->maximum_swath_height_y = v->read256_bytes_block_height_y; v->maximum_swath_height_c = v->read256_bytes_block_height_c; - }else { + } +else { v->maximum_swath_height_y = v->read256_bytes_block_width_y; v->maximum_swath_height_c = v->read256_bytes_block_width_c; } -if ((v->source_pixel_format[k] == dcn_bw_rgb_sub_64 - || v->source_pixel_format[k] == dcn_bw_rgb_sub_32 - || v->source_pixel_format[k] == dcn_bw_rgb_sub_16)) { -if (v->source_surface_mode[k] == dcn_bw_sw_linear - || (v->source_pixel_format[k] == dcn_bw_rgb_sub_64 - && (v->source_surface_mode[k] - == dcn_bw_sw_4_kb_s - || v->source_surface_mode[k] - == dcn_bw_sw_4_kb_s_x - || v->source_surface_mode[k] - == dcn_bw_sw_64_kb_s - || v->source_surface_mode[k] - == dcn_bw_sw_64_kb_s_t - || v->source_surface_mode[k] - == dcn_bw_sw_64_kb_s_x - || v->source_surface_mode[k] - == dcn_bw_sw_var_s - || v->source_surface_mode[k] - == dcn_bw_sw_var_s_x) - && v->source_scan[k] == dcn_bw_hor)) { +if ((v->source_pixel_format[k] == dcn_bw_rgb_sub_64 || v->source_pixel_format[k] == dcn_bw_rgb_sub_32 || v->source_pixel_format[k] == dcn_bw_rgb_sub_16)) { +if (v->source_surface_mode[k] == dcn_bw_sw_linear || (v->source_pixel_format[k] == dcn_bw_rgb_sub_64 && (v->source_surface_mode[k] == dcn_bw_sw_4_kb_s || v->source_surface_mode[k] == dcn_bw_sw_4_kb_s_x || v->source_surface_mode[k] == dcn_bw_sw_64_kb_s || v->source_surface_mode[k] == dcn_bw_sw_64_kb_s_t || v->source_surface_mode[k] == dcn_bw_sw_64_kb_s_x || v->source_surface_mode[k] == dcn_bw_sw_var_s || v->source_surface_mode[k] == dcn_bw_sw_var_s_x) && v->source_scan[k] == dcn_bw_hor)) { v->minimum_swath_height_y = v->maximum_swath_height_y; - }else { + } +else { v->minimum_swath_height_y = v->maximum_swath_height_y /2.0 ; } v->minimum_swath_height_c = v->maximum_swath_height_c; - }else { + } +else {if (v->source_surface_mode[k] == dcn_bw_sw_linear) { v->minimum_swath_height_y = v->maximum_swath_height_y; v->minimum_swath_height_c = v->maximum_swath_height_c; - }else if (v->source_pixel_format[k] == dcn_bw_yuv420_sub_8 - && v->source_scan[k] == dcn_bw_hor) { + } +else if (v->source_pixel_format[k] == dcn_bw_yuv420_sub_8 && v->source_scan[k] == dcn_bw_hor) { v->minimum_swath_height_y = v->maximum_swath_height_y /2.0 ; -if (v->bug_forcing_luma_and_chroma_request_to_same_size_fixed - == dcn_bw_yes) { +if (v->bug_forcing_luma_and_chroma_request_to_same_size_fixed == dcn_bw_yes) { v->minimum_swath_height_c = v->maximum_swath_height_c; - }else { + } +else { v->minimum_swath_height_c = v->maximum_swath_height_c /2.0 ; } - }else if (v->source_pixel_format[k] == dcn_bw_yuv420_sub_10 - && v->source_scan[k] == dcn_bw_hor) { + } +else if (v->source_pixel_format[k] == dcn_bw_yuv420_sub_10 && v->source_scan[k] == dcn_bw_hor) { v->minimum_swath_height_c = v->maximum_swath_height_c /2.0 ; -if (v->bug_forcing_luma_and_chroma_request_to_same_size_fixed - == dcn_bw_yes) { +if (v->bug_forcing_luma_and_chroma_request_to_same_size_fixed == dcn_bw_yes) { v->minimum_swath_height_y = v->maximum_swath_height_y; - }else { + } +else { v->minimum_swath_height_y = v->maximum_swath_height_y /2.0 ; } - }else { + } +else { v->minimum_swath_height_y = v->maximum_swath_height_y; v->minimum_swath_height_c = v->maximum_swath_height_c; } }if (v->source_scan[k] == dcn_bw_hor) { v->swath_width = v->viewport_width[k] / v->dpp_per_plane[k]; - }else { + } +else { v->swath_width = v->viewport_height[k] / v->dpp_per_plane[k]; } - v->swath_width_granularity_y =256.0 /dcn_bw_ceil2 (v->byte_per_pix_dety,1.0 ) - / v->maximum_swath_height_y; - v->rounded_up_max_swath_size_bytes_y = (dcn_bw_ceil2 ( - v->swath_width -1.0 , - v->swath_width_granularity_y) + v->swath_width_granularity_y) - * v->byte_per_pix_dety * v->maximum_swath_height_y; + v->swath_width_granularity_y =256.0 /dcn_bw_ceil2 (v->byte_per_pix_dety,1.0 ) / v->maximum_swath_height_y; + v->rounded_up_max_swath_size_bytes_y = (dcn_bw_ceil2 (v->swath_width -1.0 , v->swath_width_granularity_y) + v->swath_width_granularity_y) * v->byte_per_pix_dety * v->maximum_swath_height_y;if (v->source_pixel_format[k] == dcn_bw_yuv420_sub_10) { - v->rounded_up_max_swath_size_bytes_y =dcn_bw_ceil2 ( - v->rounded_up_max_swath_size_bytes_y, -256.0 ) +256 ; + v->rounded_up_max_swath_size_bytes_y =dcn_bw_ceil2 (v->rounded_up_max_swath_size_bytes_y,256.0 ) +256 ; }if (v->maximum_swath_height_c >0.0 ) { - v->swath_width_granularity_c =256.0 /dcn_bw_ceil2 (v->byte_per_pix_detc,2.0 ) - / v->maximum_swath_height_c; + v->swath_width_granularity_c =256.0 /dcn_bw_ceil2 (v->byte_per_pix_detc,2.0 ) / v->maximum_swath_height_c; } - v->rounded_up_max_swath_size_bytes_c = (dcn_bw_ceil2 ( - v->swath_width /2.0 -1.0 , - v->swath_width_granularity_c) + v->swath_width_granularity_c) - * v->byte_per_pix_detc * v->maximum_swath_height_c; + v->rounded_up_max_swath_size_bytes_c = (dcn_bw_ceil2 (v->swath_width /2.0 -1.0 , v->swath_width_granularity_c) + v->swath_width_granularity_c) * v->byte_per_pix_detc * v->maximum_swath_height_c;if (v->source_pixel_format[k] == dcn_bw_yuv420_sub_10) { - v->rounded_up_max_swath_size_bytes_c =dcn_bw_ceil2 ( - v->rounded_up_max_swath_size_bytes_c, -256.0 ) +256 ; + v->rounded_up_max_swath_size_bytes_c =dcn_bw_ceil2 (v->rounded_up_max_swath_size_bytes_c,256.0 ) +256 ; } -if (v->rounded_up_max_swath_size_bytes_y + v->rounded_up_max_swath_size_bytes_c - <= v->det_buffer_size_in_kbyte *1024.0 /2.0 ) { +if (v->rounded_up_max_swath_size_bytes_y + v->rounded_up_max_swath_size_bytes_c <= v->det_buffer_size_in_kbyte *1024.0 /2.0 ) { v->swath_height_y[k] = v->maximum_swath_height_y; v->swath_height_c[k] = v->maximum_swath_height_c; - }else { + } +else { v->swath_height_y[k] = v->minimum_swath_height_y; v->swath_height_c[k] = v->minimum_swath_height_c; }if (v->swath_height_c[k] ==0.0 ) { v->det_buffer_size_y[k] = v->det_buffer_size_in_kbyte *1024.0 ; v->det_buffer_size_c[k] =0.0 ; - }else if (v->swath_height_y[k] <= v->swath_height_c[k]) { + } +else if (v->swath_height_y[k] <= v->swath_height_c[k]) { v->det_buffer_size_y[k] = v->det_buffer_size_in_kbyte *1024.0 /2.0 ; v->det_buffer_size_c[k] = v->det_buffer_size_in_kbyte *1024.0 /2.0 ; - }else { + } +else { v->det_buffer_size_y[k] = v->det_buffer_size_in_kbyte *1024.0 *2.0 /3.0 ; v->det_buffer_size_c[k] = v->det_buffer_size_in_kbyte *1024.0 /3.0 ; } } } -void dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performance_calculation ( -struct dcn_bw_internal_vars *v) +void dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performance_calculation (struct dcn_bw_internal_vars *v) {int k;/*dispclk and dppclk calculation*/
@@ -2191,123 +1137,48 @@ void dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performan v->dispclk_without_ramping =0.0 ;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) {if (v->h_ratio[k] >1.0 ) { - v->pscl_throughput[k] =dcn_bw_min2 ( - v->max_dchub_topscl_throughput, - v->max_pscl_tolb_throughput * v->h_ratio[k] - /dcn_bw_ceil2 (v->htaps[k] /6.0 ,1.0 )); - }else { - v->pscl_throughput[k] =dcn_bw_min2 ( - v->max_dchub_topscl_throughput, - v->max_pscl_tolb_throughput); - } - v->dppclk_using_single_dpp_luma = v->pixel_clock[k] - *dcn_bw_max3 ( - v->vtaps[k] /6.0 *dcn_bw_min2 (1.0 , v->h_ratio[k]), - v->h_ratio[k] * v->v_ratio[k] - / v->pscl_throughput[k], -1.0 ); -if ((v->source_pixel_format[k] != dcn_bw_yuv420_sub_8 - && v->source_pixel_format[k] != dcn_bw_yuv420_sub_10)) { + v->pscl_throughput[k] =dcn_bw_min2 (v->max_dchub_topscl_throughput, v->max_pscl_tolb_throughput * v->h_ratio[k] /dcn_bw_ceil2 (v->htaps[k] /6.0 ,1.0 )); + } +else { + v->pscl_throughput[k] =dcn_bw_min2 (v->max_dchub_topscl_throughput, v->max_pscl_tolb_throughput); + } + v->dppclk_using_single_dpp_luma = v->pixel_clock[k] *dcn_bw_max3 (v->vtaps[k] /6.0 *dcn_bw_min2 (1.0 , v->h_ratio[k]), v->h_ratio[k] * v->v_ratio[k] / v->pscl_throughput[k],1.0 ); +if ((v->source_pixel_format[k] != dcn_bw_yuv420_sub_8 && v->source_pixel_format[k] != dcn_bw_yuv420_sub_10)) { v->pscl_throughput_chroma[k] =0.0 ; v->dppclk_using_single_dpp = v->dppclk_using_single_dpp_luma; - }else { + } +else {if (v->h_ratio[k] >1.0 ) { - v->pscl_throughput_chroma[k] = -dcn_bw_min2 ( - v->max_dchub_topscl_throughput, - v->max_pscl_tolb_throughput - * v->h_ratio[k] - /2.0 - /dcn_bw_ceil2 ( - v->hta_pschroma[k] - /6.0 , -1.0 )); - }else { - v->pscl_throughput_chroma[k] =dcn_bw_min2 ( - v->max_dchub_topscl_throughput, - v->max_pscl_tolb_throughput); - } - v->dppclk_using_single_dpp_chroma = - v->pixel_clock[k] - *dcn_bw_max3 ( - v->vta_pschroma[k] /6.0 - *dcn_bw_min2 ( -1.0 , - v->h_ratio[k] - /2.0 ), - v->h_ratio[k] - * v->v_ratio[k] - /4.0 - / v->pscl_throughput_chroma[k], -1.0 ); - v->dppclk_using_single_dpp =dcn_bw_max2 ( - v->dppclk_using_single_dpp_luma, - v->dppclk_using_single_dpp_chroma); + v->pscl_throughput_chroma[k] =dcn_bw_min2 (v->max_dchub_topscl_throughput, v->max_pscl_tolb_throughput * v->h_ratio[k] /2.0 /dcn_bw_ceil2 (v->hta_pschroma[k] /6.0 ,1.0 )); + } +else { + v->pscl_throughput_chroma[k] =dcn_bw_min2 (v->max_dchub_topscl_throughput, v->max_pscl_tolb_throughput); + } + v->dppclk_using_single_dpp_chroma = v->pixel_clock[k] *dcn_bw_max3 (v->vta_pschroma[k] /6.0 *dcn_bw_min2 (1.0 , v->h_ratio[k] /2.0 ), v->h_ratio[k] * v->v_ratio[k] /4.0 / v->pscl_throughput_chroma[k],1.0 ); + v->dppclk_using_single_dpp =dcn_bw_max2 (v->dppclk_using_single_dpp_luma, v->dppclk_using_single_dpp_chroma); }if (v->odm_capable == dcn_bw_yes) { - v->dispclk_with_ramping = -dcn_bw_max2 ( - v->dispclk_with_ramping, -dcn_bw_max2 ( - v->dppclk_using_single_dpp - / v->dpp_per_plane[k] - * v->dispclk_dppclk_ratio, - v->pixel_clock[k] - / v->dpp_per_plane[k]) - * (1.0 - + v->downspreading - /100.0 ) - * (1.0 - + v->dispclk_ramping_margin - /100.0 )); - v->dispclk_without_ramping =dcn_bw_max2 ( - v->dispclk_without_ramping, -dcn_bw_max2 ( - v->dppclk_using_single_dpp - / v->dpp_per_plane[k] - * v->dispclk_dppclk_ratio, - v->pixel_clock[k] / v->dpp_per_plane[k]) - * (1.0 + v->downspreading /100.0 )); - }else { - v->dispclk_with_ramping = -dcn_bw_max2 ( - v->dispclk_with_ramping, -dcn_bw_max2 ( - v->dppclk_using_single_dpp - / v->dpp_per_plane[k] - * v->dispclk_dppclk_ratio, - v->pixel_clock[k]) - * (1.0 - + v->downspreading - /100.0 ) - * (1.0 - + v->dispclk_ramping_margin - /100.0 )); - v->dispclk_without_ramping =dcn_bw_max2 ( - v->dispclk_without_ramping, -dcn_bw_max2 ( - v->dppclk_using_single_dpp - / v->dpp_per_plane[k] - * v->dispclk_dppclk_ratio, - v->pixel_clock[k]) - * (1.0 + v->downspreading /100.0 )); + v->dispclk_with_ramping =dcn_bw_max2 (v->dispclk_with_ramping,dcn_bw_max2 (v->dppclk_using_single_dpp / v->dpp_per_plane[k] * v->dispclk_dppclk_ratio, v->pixel_clock[k] / v->dpp_per_plane[k]) * (1.0 + v->downspreading /100.0 ) * (1.0 + v->dispclk_ramping_margin /100.0 )); + v->dispclk_without_ramping =dcn_bw_max2 (v->dispclk_without_ramping,dcn_bw_max2 (v->dppclk_using_single_dpp / v->dpp_per_plane[k] * v->dispclk_dppclk_ratio, v->pixel_clock[k] / v->dpp_per_plane[k]) * (1.0 + v->downspreading /100.0 )); + } +else { + v->dispclk_with_ramping =dcn_bw_max2 (v->dispclk_with_ramping,dcn_bw_max2 (v->dppclk_using_single_dpp / v->dpp_per_plane[k] * v->dispclk_dppclk_ratio, v->pixel_clock[k]) * (1.0 + v->downspreading /100.0 ) * (1.0 + v->dispclk_ramping_margin /100.0 )); + v->dispclk_without_ramping =dcn_bw_max2 (v->dispclk_without_ramping,dcn_bw_max2 (v->dppclk_using_single_dpp / v->dpp_per_plane[k] * v->dispclk_dppclk_ratio, v->pixel_clock[k]) * (1.0 + v->downspreading /100.0 )); } }if (v->dispclk_without_ramping > v->max_dispclk[number_of_states]) { v->dispclk = v->dispclk_without_ramping; - }else if (v->dispclk_with_ramping > v->max_dispclk[number_of_states]) { + } +else if (v->dispclk_with_ramping > v->max_dispclk[number_of_states]) { v->dispclk = v->max_dispclk[number_of_states]; - }else { + } +else { v->dispclk = v->dispclk_with_ramping; } v->dppclk = v->dispclk / v->dispclk_dppclk_ratio;/*urgent watermark*/ - v->return_bandwidth_to_dcn =dcn_bw_min2 ( - v->return_bus_width * v->dcfclk, - v->fabric_and_dram_bandwidth *1000.0 - * v->percent_of_ideal_drambw_received_after_urg_latency - /100.0 ); + v->return_bandwidth_to_dcn =dcn_bw_min2 (v->return_bus_width * v->dcfclk, v->fabric_and_dram_bandwidth *1000.0 * v->percent_of_ideal_drambw_received_after_urg_latency /100.0 ); v->dcc_enabled_any_plane = dcn_bw_no;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) {if (v->dcc_enable[k] == dcn_bw_yes) {
@@ -2315,95 +1186,26 @@ void dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performan } } v->return_bw = v->return_bandwidth_to_dcn; -if (v->dcc_enabled_any_plane == dcn_bw_yes - && v->return_bandwidth_to_dcn > v->dcfclk * v->return_bus_width /4.0 ) { - v->return_bw = -dcn_bw_min2 ( - v->return_bw, - v->return_bandwidth_to_dcn *4.0 - * (1.0 - - v->urgent_latency - / ((v->rob_buffer_size_in_kbyte - - v->pixel_chunk_size_in_kbyte) - *1024.0 - / (v->return_bandwidth_to_dcn - - v->dcfclk - * v->return_bus_width - /4.0 ) - + v->urgent_latency))); - } - v->critical_compression =2.0 * v->return_bus_width * v->dcfclk * v->urgent_latency - / (v->return_bandwidth_to_dcn * v->urgent_latency - + (v->rob_buffer_size_in_kbyte - - v->pixel_chunk_size_in_kbyte) *1024.0 ); -if (v->dcc_enabled_any_plane == dcn_bw_yes && v->critical_compression >1.0 - && v->critical_compression <4.0 ) { - v->return_bw = -dcn_bw_min2 ( - v->return_bw, -dcn_bw_pow ( -4.0 * v->return_bandwidth_to_dcn - * (v->rob_buffer_size_in_kbyte - - v->pixel_chunk_size_in_kbyte) - *1024.0 - * v->return_bus_width - * v->dcfclk - * v->urgent_latency - / (v->return_bandwidth_to_dcn - * v->urgent_latency - + (v->rob_buffer_size_in_kbyte - - v->pixel_chunk_size_in_kbyte) - *1024.0 ), -2 )); - } - v->return_bandwidth_to_dcn =dcn_bw_min2 ( - v->return_bus_width * v->dcfclk, - v->fabric_and_dram_bandwidth *1000.0 ); -if (v->dcc_enabled_any_plane == dcn_bw_yes - && v->return_bandwidth_to_dcn > v->dcfclk * v->return_bus_width /4.0 ) { - v->return_bw = -dcn_bw_min2 ( - v->return_bw, - v->return_bandwidth_to_dcn *4.0 - * (1.0 - - v->urgent_latency - / ((v->rob_buffer_size_in_kbyte - - v->pixel_chunk_size_in_kbyte) - *1024.0 - / (v->return_bandwidth_to_dcn - - v->dcfclk - * v->return_bus_width - /4.0 ) - + v->urgent_latency))); - } - v->critical_compression =2.0 * v->return_bus_width * v->dcfclk * v->urgent_latency - / (v->return_bandwidth_to_dcn * v->urgent_latency - + (v->rob_buffer_size_in_kbyte - - v->pixel_chunk_size_in_kbyte) *1024.0 ); -if (v->dcc_enabled_any_plane == dcn_bw_yes && v->critical_compression >1.0 - && v->critical_compression <4.0 ) { - v->return_bw = -dcn_bw_min2 ( - v->return_bw, -dcn_bw_pow ( -4.0 * v->return_bandwidth_to_dcn - * (v->rob_buffer_size_in_kbyte - - v->pixel_chunk_size_in_kbyte) - *1024.0 - * v->return_bus_width - * v->dcfclk - * v->urgent_latency - / (v->return_bandwidth_to_dcn - * v->urgent_latency - + (v->rob_buffer_size_in_kbyte - - v->pixel_chunk_size_in_kbyte) - *1024.0 ), -2 )); +if (v->dcc_enabled_any_plane == dcn_bw_yes && v->return_bandwidth_to_dcn > v->dcfclk * v->return_bus_width /4.0 ) { + v->return_bw =dcn_bw_min2 (v->return_bw, v->return_bandwidth_to_dcn *4.0 * (1.0 - v->urgent_latency / ((v->rob_buffer_size_in_kbyte - v->pixel_chunk_size_in_kbyte) *1024.0 / (v->return_bandwidth_to_dcn - v->dcfclk * v->return_bus_width /4.0 ) + v->urgent_latency))); + } + v->critical_compression =2.0 * v->return_bus_width * v->dcfclk * v->urgent_latency / (v->return_bandwidth_to_dcn * v->urgent_latency + (v->rob_buffer_size_in_kbyte - v->pixel_chunk_size_in_kbyte) *1024.0 ); +if (v->dcc_enabled_any_plane == dcn_bw_yes && v->critical_compression >1.0 && v->critical_compression <4.0 ) { + v->return_bw =dcn_bw_min2 (v->return_bw,dcn_bw_pow (4.0 * v->return_bandwidth_to_dcn * (v->rob_buffer_size_in_kbyte - v->pixel_chunk_size_in_kbyte) *1024.0 * v->return_bus_width * v->dcfclk * v->urgent_latency / (v->return_bandwidth_to_dcn * v->urgent_latency + (v->rob_buffer_size_in_kbyte - v->pixel_chunk_size_in_kbyte) *1024.0 ),2 )); + } + v->return_bandwidth_to_dcn =dcn_bw_min2 (v->return_bus_width * v->dcfclk, v->fabric_and_dram_bandwidth *1000.0 ); +if (v->dcc_enabled_any_plane == dcn_bw_yes && v->return_bandwidth_to_dcn > v->dcfclk * v->return_bus_width /4.0 ) { + v->return_bw =dcn_bw_min2 (v->return_bw, v->return_bandwidth_to_dcn *4.0 * (1.0 - v->urgent_latency / ((v->rob_buffer_size_in_kbyte - v->pixel_chunk_size_in_kbyte) *1024.0 / (v->return_bandwidth_to_dcn - v->dcfclk * v->return_bus_width /4.0 ) + v->urgent_latency))); + } + v->critical_compression =2.0 * v->return_bus_width * v->dcfclk * v->urgent_latency / (v->return_bandwidth_to_dcn * v->urgent_latency + (v->rob_buffer_size_in_kbyte - v->pixel_chunk_size_in_kbyte) *1024.0 ); +if (v->dcc_enabled_any_plane == dcn_bw_yes && v->critical_compression >1.0 && v->critical_compression <4.0 ) { + v->return_bw =dcn_bw_min2 (v->return_bw,dcn_bw_pow (4.0 * v->return_bandwidth_to_dcn * (v->rob_buffer_size_in_kbyte - v->pixel_chunk_size_in_kbyte) *1024.0 * v->return_bus_width * v->dcfclk * v->urgent_latency / (v->return_bandwidth_to_dcn * v->urgent_latency + (v->rob_buffer_size_in_kbyte - v->pixel_chunk_size_in_kbyte) *1024.0 ),2 )); }for (k =0 ; k <= v->number_of_active_planes -1 ; k++) {if (v->source_scan[k] == dcn_bw_hor) { v->swath_width_y[k] = v->viewport_width[k] / v->dpp_per_plane[k]; - }else { + } +else { v->swath_width_y[k] = v->viewport_height[k] / v->dpp_per_plane[k]; } }
@@ -2411,31 +1213,29 @@ void dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performanif (v->source_pixel_format[k] == dcn_bw_rgb_sub_64) { v->byte_per_pixel_dety[k] =8.0 ; v->byte_per_pixel_detc[k] =0.0 ; - }else if (v->source_pixel_format[k] == dcn_bw_rgb_sub_32) { + } +else if (v->source_pixel_format[k] == dcn_bw_rgb_sub_32) { v->byte_per_pixel_dety[k] =4.0 ; v->byte_per_pixel_detc[k] =0.0 ; - }else if (v->source_pixel_format[k] == dcn_bw_rgb_sub_16) { + } +else if (v->source_pixel_format[k] == dcn_bw_rgb_sub_16) { v->byte_per_pixel_dety[k] =2.0 ; v->byte_per_pixel_detc[k] =0.0 ; - }else if (v->source_pixel_format[k] == dcn_bw_yuv420_sub_8) { + } +else if (v->source_pixel_format[k] == dcn_bw_yuv420_sub_8) { v->byte_per_pixel_dety[k] =1.0 ; v->byte_per_pixel_detc[k] =2.0 ; - }else { - v->byte_per_pixel_dety[k] =4.0f /3 ; - v->byte_per_pixel_detc[k] =8.0f /3 ; + } +else { + v->byte_per_pixel_dety[k] =4.0f /3.0f ; + v->byte_per_pixel_detc[k] =8.0f /3.0f ; } } v->total_data_read_bandwidth =0.0 ;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) { - v->read_bandwidth_plane_luma[k] = v->swath_width_y[k] * v->dpp_per_plane[k] - *dcn_bw_ceil2 (v->byte_per_pixel_dety[k],1.0 ) - / (v->htotal[k] / v->pixel_clock[k]) * v->v_ratio[k]; - v->read_bandwidth_plane_chroma[k] = v->swath_width_y[k] /2.0 * v->dpp_per_plane[k] - *dcn_bw_ceil2 (v->byte_per_pixel_detc[k],2.0 ) - / (v->htotal[k] / v->pixel_clock[k]) * v->v_ratio[k] /2.0 ; - v->total_data_read_bandwidth = v->total_data_read_bandwidth - + v->read_bandwidth_plane_luma[k] - + v->read_bandwidth_plane_chroma[k]; + v->read_bandwidth_plane_luma[k] = v->swath_width_y[k] * v->dpp_per_plane[k] *dcn_bw_ceil2 (v->byte_per_pixel_dety[k],1.0 ) / (v->htotal[k] / v->pixel_clock[k]) * v->v_ratio[k]; + v->read_bandwidth_plane_chroma[k] = v->swath_width_y[k] /2.0 * v->dpp_per_plane[k] *dcn_bw_ceil2 (v->byte_per_pixel_detc[k],2.0 ) / (v->htotal[k] / v->pixel_clock[k]) * v->v_ratio[k] /2.0 ; + v->total_data_read_bandwidth = v->total_data_read_bandwidth + v->read_bandwidth_plane_luma[k] + v->read_bandwidth_plane_chroma[k]; } v->total_active_dpp =0.0 ; v->total_dcc_active_dpp =0.0 ;
@@ -2445,63 +1245,36 @@ void dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performan v->total_dcc_active_dpp = v->total_dcc_active_dpp + v->dpp_per_plane[k]; } } - v->urgent_round_trip_and_out_of_order_latency = (v->round_trip_ping_latency_cycles +32.0 ) - / v->dcfclk - + v->urgent_out_of_order_return_per_channel * v->number_of_channels - / v->return_bw; + v->urgent_round_trip_and_out_of_order_latency = (v->round_trip_ping_latency_cycles +32.0 ) / v->dcfclk + v->urgent_out_of_order_return_per_channel * v->number_of_channels / v->return_bw; v->last_pixel_of_line_extra_watermark =0.0 ;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) {if (v->v_ratio[k] <=1.0 ) { - v->display_pipe_line_delivery_time_luma[k] = v->swath_width_y[k] - * v->dpp_per_plane[k] / v->h_ratio[k] / v->pixel_clock[k]; - }else { - v->display_pipe_line_delivery_time_luma[k] = v->swath_width_y[k] - / v->pscl_throughput[k] / v->dppclk; - } - v->data_fabric_line_delivery_time_luma = - v->swath_width_y[k] * v->swath_height_y[k] - *dcn_bw_ceil2 (v->byte_per_pixel_dety[k],1.0 ) - / (v->return_bw * v->read_bandwidth_plane_luma[k] - / v->dpp_per_plane[k] - / v->total_data_read_bandwidth); - v->last_pixel_of_line_extra_watermark =dcn_bw_max2 ( - v->last_pixel_of_line_extra_watermark, - v->data_fabric_line_delivery_time_luma - - v->display_pipe_line_delivery_time_luma[k]); + v->display_pipe_line_delivery_time_luma[k] = v->swath_width_y[k] * v->dpp_per_plane[k] / v->h_ratio[k] / v->pixel_clock[k]; + } +else { + v->display_pipe_line_delivery_time_luma[k] = v->swath_width_y[k] / v->pscl_throughput[k] / v->dppclk; + } + v->data_fabric_line_delivery_time_luma = v->swath_width_y[k] * v->swath_height_y[k] *dcn_bw_ceil2 (v->byte_per_pixel_dety[k],1.0 ) / (v->return_bw * v->read_bandwidth_plane_luma[k] / v->dpp_per_plane[k] / v->total_data_read_bandwidth); + v->last_pixel_of_line_extra_watermark =dcn_bw_max2 (v->last_pixel_of_line_extra_watermark, v->data_fabric_line_delivery_time_luma - v->display_pipe_line_delivery_time_luma[k]);if (v->byte_per_pixel_detc[k] ==0.0 ) { v->display_pipe_line_delivery_time_chroma[k] =0.0 ; - }else { + } +else {if (v->v_ratio[k] /2.0 <=1.0 ) { - v->display_pipe_line_delivery_time_chroma[k] = v->swath_width_y[k] - /2.0 * v->dpp_per_plane[k] / (v->h_ratio[k] /2.0 ) - / v->pixel_clock[k]; - }else { - v->display_pipe_line_delivery_time_chroma[k] = v->swath_width_y[k] - /2.0 / v->pscl_throughput_chroma[k] / v->dppclk; - } - v->data_fabric_line_delivery_time_chroma = v->swath_width_y[k] /2.0 - * v->swath_height_c[k] - *dcn_bw_ceil2 (v->byte_per_pixel_detc[k],2.0 ) - / (v->return_bw * v->read_bandwidth_plane_chroma[k] - / v->dpp_per_plane[k] - / v->total_data_read_bandwidth); - v->last_pixel_of_line_extra_watermark = -dcn_bw_max2 ( - v->last_pixel_of_line_extra_watermark, - v->data_fabric_line_delivery_time_chroma - - v->display_pipe_line_delivery_time_chroma[k]); - } - } - v->urgent_extra_latency = v->urgent_round_trip_and_out_of_order_latency - + (v->total_active_dpp * v->pixel_chunk_size_in_kbyte - + v->total_dcc_active_dpp * v->meta_chunk_size) *1024.0 - / v->return_bw; + v->display_pipe_line_delivery_time_chroma[k] = v->swath_width_y[k] /2.0 * v->dpp_per_plane[k] / (v->h_ratio[k] /2.0 ) / v->pixel_clock[k]; + } +else { + v->display_pipe_line_delivery_time_chroma[k] = v->swath_width_y[k] /2.0 / v->pscl_throughput_chroma[k] / v->dppclk; + } + v->data_fabric_line_delivery_time_chroma = v->swath_width_y[k] /2.0 * v->swath_height_c[k] *dcn_bw_ceil2 (v->byte_per_pixel_detc[k],2.0 ) / (v->return_bw * v->read_bandwidth_plane_chroma[k] / v->dpp_per_plane[k] / v->total_data_read_bandwidth); + v->last_pixel_of_line_extra_watermark =dcn_bw_max2 (v->last_pixel_of_line_extra_watermark, v->data_fabric_line_delivery_time_chroma - v->display_pipe_line_delivery_time_chroma[k]); + } + } + v->urgent_extra_latency = v->urgent_round_trip_and_out_of_order_latency + (v->total_active_dpp * v->pixel_chunk_size_in_kbyte + v->total_dcc_active_dpp * v->meta_chunk_size) *1024.0 / v->return_bw;if (v->pte_enable == dcn_bw_yes) { - v->urgent_extra_latency = v->urgent_extra_latency - + v->total_active_dpp * v->pte_chunk_size *1024.0 / v->return_bw; + v->urgent_extra_latency = v->urgent_extra_latency + v->total_active_dpp * v->pte_chunk_size *1024.0 / v->return_bw; } - v->urgent_watermark = v->urgent_latency + v->last_pixel_of_line_extra_watermark - + v->urgent_extra_latency; + v->urgent_watermark = v->urgent_latency + v->last_pixel_of_line_extra_watermark + v->urgent_extra_latency;
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
2.11.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Part of the diff is not shown here. View the raw message.
PATCH 7/13 drm/amd/display: Refine globallock.
In reply to a message not in the archiveFrom: Andrey Grodzovsky <[email protected]>
Switch to wait_for_completion_interruptible_timeout wait since the lock is called from IOCTL context and can be interrupted by a signal.
Global lock function might return EDEADLK or EINTR which is not an error and just singals to user mode to restart the call.
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 35 +++++++++++++++------- 1 file changed, 24 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +24 -11
@@ -2973,7 +2973,7 @@ static uint32_t remove_from_val_sets(* Grabs all modesetting locks to serialize against any blocking commits, * Waits for completion of all non blocking commits. */ -static void do_aquire_global_lock ( +static int do_aquire_global_lock (struct drm_device *dev,struct drm_atomic_state *state) {
@@ -2985,7 +2985,9 @@ static void do_aquire_global_lock(* ensure that when the framework release it the * extra locks we are locking here will get released to */ -drm_modeset_lock_all_ctx (dev, state->acquire_ctx); + ret =drm_modeset_lock_all_ctx (dev, state->acquire_ctx); +if (ret) +return ret;list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) {spin_lock (&crtc->commit_lock);
@@ -3001,15 +3003,20 @@ static void do_aquire_global_lock(/* Make sure all pending HW programming completed and * page flips done */ - ret =wait_for_completion_timeout (&commit->hw_done, -10 *HZ ); - ret =wait_for_completion_timeout (&commit->flip_done, -10 *HZ ); + ret =wait_for_completion_interruptible_timeout (&commit->hw_done,10 *HZ ); + +if (ret >0 ) + ret =wait_for_completion_interruptible_timeout ( + &commit->flip_done,10 *HZ ); +if (ret ==0 ) -DRM_ERROR ("[CRTC:%d:%s] hw_done timed out\n" , - crtc->base.id, crtc->name); +DRM_ERROR ("[CRTC:%d:%s] cleanup_done or flip_done " +"timed out\n" , crtc->base.id, crtc->name); +drm_crtc_commit_put (commit); } + +return ret <0 ? ret :0 ; } int amdgpu_dm_atomic_check(struct drm_device *dev,
@@ -3276,7 +3283,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,* synchronization events. */ if (aquire_global_lock) -do_aquire_global_lock (dev, state); + ret =do_aquire_global_lock (dev, state); }
@@ -3292,8 +3299,14 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,for (i =0 ; i < new_stream_count; i++)dc_stream_release (new_streams[i]); -if (ret !=0 ) -DRM_ERROR ("Atomic check failed.\n" ); +if (ret !=0 ) { +if (ret == -EDEADLK ) +DRM_DEBUG_KMS ("Atomic check stopped due to to deadlock, retrying.\n" ); +else if (ret == -EINTR || ret == -EAGAIN || ret == -ERESTARTSYS ) +DRM_DEBUG_KMS ("Atomic check stopped due to to signal, retrying.\n" ); +else +DRM_ERROR ("Atomic check failed.\n" ); + }return ret; }
Signature · 6 lines
2.11.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/13 drm/amd/display: fix bw_calc_auto translation error
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
The compiler was warning about conditions that will never evaluate to true. The problem was that the VBA translater didn't translate the conditions correctly.
--- drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.c +1 -1
@@ -128,7 +128,7 @@ void mode_support_and_system_configuration(struct dcn_bw_internal_vars *v) v->source_format_pixel_and_scan_support = dcn_bw_yes;for (k =0 ; k <= v->number_of_active_planes -1 ; k++) { -if ((v->source_surface_mode[k] == dcn_bw_sw_linear && !v->source_scan[k] == dcn_bw_hor) || ((v->source_surface_mode[k] == dcn_bw_sw_4_kb_d || v->source_surface_mode[k] == dcn_bw_sw_4_kb_d_x || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d_t || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d_x || v->source_surface_mode[k] == dcn_bw_sw_var_d || v->source_surface_mode[k] == dcn_bw_sw_var_d_x) && !v->source_pixel_format[k] == dcn_bw_rgb_sub_64)) { +if ((v->source_surface_mode[k] == dcn_bw_sw_linear && v->source_scan[k] != dcn_bw_hor) || ((v->source_surface_mode[k] == dcn_bw_sw_4_kb_d || v->source_surface_mode[k] == dcn_bw_sw_4_kb_d_x || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d_t || v->source_surface_mode[k] == dcn_bw_sw_64_kb_d_x || v->source_surface_mode[k] == dcn_bw_sw_var_d || v->source_surface_mode[k] == dcn_bw_sw_var_d_x) && v->source_pixel_format[k] != dcn_bw_rgb_sub_64)) { v->source_format_pixel_and_scan_support = dcn_bw_no; } }
Signature · 6 lines
2.11.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 9/13 drm/amd/display: Workaround IGT multiplane restriction
In reply to a message not in the archiveFrom: "Leo (Sunpeng) Li" <[email protected]>
IGT currently does not properly commit changes on planes with multiple possible CRTC's. Set one valid CRTC for each plane for now, plus one underlay plane on Carizzo and Stoney that is valid for all CRTCs.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +13 -1
@@ -1189,6 +1189,7 @@ int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)struct amdgpu_encoder *aencoder =NULL ;struct amdgpu_mode_info *mode_info = &adev->mode_info;uint32_t link_cnt; +unsigned long possible_crtcs; link_cnt = dm->dc->caps.max_links;if (amdgpu_dm_mode_config_init (dm->adev)) {
@@ -1204,7 +1205,18 @@ int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) goto fail_free_planes; } mode_info->planes[i]->base.type = mode_info->plane_type[i]; -if (amdgpu_dm_plane_init (dm, mode_info->planes[i],0xff )) { + +/* +* HACK: IGT tests expect that each plane can only have one +* one possible CRTC. For now, set one CRTC for each +* plane that is not an underlay, but still allow multiple +* CRTCs for underlay planes. +*/ + possible_crtcs =1 << i; +if (i >= dm->dc->caps.max_streams) + possible_crtcs =0xff ; + +if (amdgpu_dm_plane_init (dm, mode_info->planes[i], possible_crtcs)) {DRM_ERROR ("KMS: Failed to initialize plane\n" ); goto fail_free_planes; }
Signature · 6 lines
2.11.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 10/13 drm/amd/display: Global lock typos fix.
In reply to a message not in the archiveFrom: Andrey Grodzovsky <[email protected]>
Fix typos.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +3 -3
@@ -3010,7 +3010,7 @@ static int do_aquire_global_lock( &commit->flip_done, 10*HZ);if (ret ==0 ) -DRM_ERROR ("[CRTC:%d:%s] cleanup_done or flip_done " +DRM_ERROR ("[CRTC:%d:%s] hw_done or flip_done " "timed out\n" , crtc->base.id, crtc->name);drm_crtc_commit_put (commit);
@@ -3301,9 +3301,9 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,if (ret !=0 ) {if (ret == -EDEADLK ) -DRM_DEBUG_KMS ("Atomic check stopped due to to deadlock, retrying.\n" ); +DRM_DEBUG_KMS ("Atomic check stopped due to to deadlock.\n" );else if (ret == -EINTR || ret == -EAGAIN || ret == -ERESTARTSYS ) -DRM_DEBUG_KMS ("Atomic check stopped due to to signal, retrying.\n" ); +DRM_DEBUG_KMS ("Atomic check stopped due to to signal.\n" );else DRM_ERROR ("Atomic check failed.\n" ); }
Signature · 6 lines
2.11.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 11/13 drm/amd/display: Disable pipe split.
In reply to a message not in the archiveFrom: Yongqiang Sun <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +1 -1
@@ -443,7 +443,7 @@ static const struct dc_debug debug_defaults_drv = { .disable_pplib_wm_range = false,#if defined(CONFIG_DRM_AMD_DC_DCN1_0 ) .use_dml_wm = false, - .disable_pipe_split = false + .disable_pipe_split = true#endif };
Signature · 6 lines
2.11.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 12/13 drm/amd/display: Don't program scaler if we have no surface
In reply to a message not in the archiveIf we don't have a surface in dc_commit_streams scl_data won't get populated in resource_build_scaling_params_for_context. In this case we shouldn't attempt to program the scaler.
--- drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +5 -3
@@ -1099,10 +1099,12 @@ static enum dc_status apply_single_controller_ctx_to_hw( pipe_ctx->scl_data.lb_params.alpha_en = pipe_ctx->bottom_pipe !=0 ;/* program_scaler and allocate_mem_input are not new asic */ -if (!pipe_ctx_old ||memcmp (&pipe_ctx_old->scl_data, - &pipe_ctx->scl_data, -sizeof (struct scaler_data )) !=0 ) +if ((!pipe_ctx_old || +memcmp (&pipe_ctx_old->scl_data, &pipe_ctx->scl_data, +sizeof (struct scaler_data )) !=0 ) && + pipe_ctx->surface) {program_scaler (dc, pipe_ctx); + }/* mst support - use total stream count */ #if defined(CONFIG_DRM_AMD_DC_DCN1_0 )
Signature · 6 lines
2.11.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 13/13 drm/amd/display: w/a no color space info for HDMI when build AVI
In reply to a message not in the archiveFrom: Charlene Liu <[email protected]>
--- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +3 -0
@@ -1605,6 +1605,9 @@ static void set_avi_info_frame(union hdmi_info_packet *hdmi_info = &info_frame.avi_info_packet.info_packet_hdmi; color_space = pipe_ctx->stream->public.output_color_space; +if (color_space ==COLOR_SPACE_UNKNOWN ) + color_space = (stream->public.timing.pixel_encoding ==PIXEL_ENCODING_RGB )? +COLOR_SPACE_SRGB :COLOR_SPACE_YCBCR709 ;/* Initialize header */ hdmi_info->bits.header.info_frame_type =HDMI_INFOFRAME_TYPE_AVI ;
Signature · 6 lines
2.11.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx