dm_free(dc->ctx);
dc->ctx = NULL;
+
+ dm_free(dc->bw_vbios);
+ dc->bw_vbios = NULL;
+
+ dm_free(dc->bw_dceip);
+ dc->bw_dceip = NULL;
+
}
static bool construct(struct core_dc *dc,
{
struct dal_logger *logger;
struct dc_context *dc_ctx = dm_alloc(sizeof(*dc_ctx));
+ struct bw_calcs_dceip *dc_dceip = dm_alloc(sizeof(*dc_dceip));
+ struct bw_calcs_vbios *dc_vbios = dm_alloc(sizeof(*dc_vbios));
+
enum dce_version dc_version = DCE_VERSION_UNKNOWN;
+ if (!dc_dceip) {
+ dm_error("%s: failed to create dceip\n", __func__);
+ goto dceip_fail;
+ }
+
+ dc->bw_dceip = dc_dceip;
+
+ if (!dc_vbios) {
+ dm_error("%s: failed to create vbios\n", __func__);
+ goto vbios_fail;
+ }
+
+ dc->bw_vbios = dc_vbios;
+
if (!dc_ctx) {
dm_error("%s: failed to create ctx\n", __func__);
goto ctx_fail;
logger_fail:
val_ctx_fail:
ctx_fail:
+dceip_fail:
+vbios_fail:
destruct(dc);
return false;
}
continue;
total_dest_line_time_ns = compute_pstate_blackout_duration(
- dc->bw_vbios.blackout_duration, pipe_ctx->stream);
+ dc->bw_vbios->blackout_duration, pipe_ctx->stream);
pipe_ctx->plane_res.mi->funcs->mem_input_program_display_marks(
pipe_ctx->plane_res.mi,
context->bw.dce.nbp_state_change_wm_ns[num_pipes],
if (bw_calcs(
dc->ctx,
- &dc->bw_dceip,
- &dc->bw_vbios,
+ dc->bw_dceip,
+ dc->bw_vbios,
context->res_ctx.pipe_ctx,
dc->res_pool->pipe_count,
&context->bw.dce))
DM_PP_CLOCK_TYPE_ENGINE_CLK,
&clks);
/* convert all the clock fro kHz to fix point mHz */
- dc->bw_vbios.high_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->high_sclk = bw_frc_to_fixed(
clks.clocks_in_khz[clks.num_levels-1], 1000);
- dc->bw_vbios.mid1_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid1_sclk = bw_frc_to_fixed(
clks.clocks_in_khz[clks.num_levels/8], 1000);
- dc->bw_vbios.mid2_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid2_sclk = bw_frc_to_fixed(
clks.clocks_in_khz[clks.num_levels*2/8], 1000);
- dc->bw_vbios.mid3_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid3_sclk = bw_frc_to_fixed(
clks.clocks_in_khz[clks.num_levels*3/8], 1000);
- dc->bw_vbios.mid4_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid4_sclk = bw_frc_to_fixed(
clks.clocks_in_khz[clks.num_levels*4/8], 1000);
- dc->bw_vbios.mid5_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid5_sclk = bw_frc_to_fixed(
clks.clocks_in_khz[clks.num_levels*5/8], 1000);
- dc->bw_vbios.mid6_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid6_sclk = bw_frc_to_fixed(
clks.clocks_in_khz[clks.num_levels*6/8], 1000);
- dc->bw_vbios.low_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->low_sclk = bw_frc_to_fixed(
clks.clocks_in_khz[0], 1000);
dc->sclk_lvls = clks;
dc->ctx,
DM_PP_CLOCK_TYPE_DISPLAY_CLK,
&clks);
- dc->bw_vbios.high_voltage_max_dispclk = bw_frc_to_fixed(
+ dc->bw_vbios->high_voltage_max_dispclk = bw_frc_to_fixed(
clks.clocks_in_khz[clks.num_levels-1], 1000);
- dc->bw_vbios.mid_voltage_max_dispclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid_voltage_max_dispclk = bw_frc_to_fixed(
clks.clocks_in_khz[clks.num_levels>>1], 1000);
- dc->bw_vbios.low_voltage_max_dispclk = bw_frc_to_fixed(
+ dc->bw_vbios->low_voltage_max_dispclk = bw_frc_to_fixed(
clks.clocks_in_khz[0], 1000);
/*do memory clock*/
DM_PP_CLOCK_TYPE_MEMORY_CLK,
&clks);
- dc->bw_vbios.low_yclk = bw_frc_to_fixed(
+ dc->bw_vbios->low_yclk = bw_frc_to_fixed(
clks.clocks_in_khz[0] * MEMORY_TYPE_MULTIPLIER, 1000);
- dc->bw_vbios.mid_yclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid_yclk = bw_frc_to_fixed(
clks.clocks_in_khz[clks.num_levels>>1] * MEMORY_TYPE_MULTIPLIER,
1000);
- dc->bw_vbios.high_yclk = bw_frc_to_fixed(
+ dc->bw_vbios->high_yclk = bw_frc_to_fixed(
clks.clocks_in_khz[clks.num_levels-1] * MEMORY_TYPE_MULTIPLIER,
1000);
}
dc->public.caps.max_planes = pool->base.pipe_count;
- bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios, dc->ctx->asic_id);
+ bw_calcs_init(dc->bw_dceip, dc->bw_vbios, dc->ctx->asic_id);
bw_calcs_data_update_from_pplib(dc);
if (bw_calcs(
dc->ctx,
- &dc->bw_dceip,
- &dc->bw_vbios,
+ dc->bw_dceip,
+ dc->bw_vbios,
context->res_ctx.pipe_ctx,
dc->res_pool->pipe_count,
&context->bw.dce))
DM_PP_CLOCK_TYPE_ENGINE_CLK,
&clks);
/* convert all the clock fro kHz to fix point mHz */
- dc->bw_vbios.high_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->high_sclk = bw_frc_to_fixed(
clks.clocks_in_khz[clks.num_levels-1], 1000);
- dc->bw_vbios.mid1_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid1_sclk = bw_frc_to_fixed(
clks.clocks_in_khz[clks.num_levels/8], 1000);
- dc->bw_vbios.mid2_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid2_sclk = bw_frc_to_fixed(
clks.clocks_in_khz[clks.num_levels*2/8], 1000);
- dc->bw_vbios.mid3_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid3_sclk = bw_frc_to_fixed(
clks.clocks_in_khz[clks.num_levels*3/8], 1000);
- dc->bw_vbios.mid4_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid4_sclk = bw_frc_to_fixed(
clks.clocks_in_khz[clks.num_levels*4/8], 1000);
- dc->bw_vbios.mid5_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid5_sclk = bw_frc_to_fixed(
clks.clocks_in_khz[clks.num_levels*5/8], 1000);
- dc->bw_vbios.mid6_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid6_sclk = bw_frc_to_fixed(
clks.clocks_in_khz[clks.num_levels*6/8], 1000);
- dc->bw_vbios.low_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->low_sclk = bw_frc_to_fixed(
clks.clocks_in_khz[0], 1000);
/*do memory clock*/
DM_PP_CLOCK_TYPE_MEMORY_CLK,
&clks);
- dc->bw_vbios.low_yclk = bw_frc_to_fixed(
+ dc->bw_vbios->low_yclk = bw_frc_to_fixed(
clks.clocks_in_khz[0] * MEMORY_TYPE_MULTIPLIER, 1000);
- dc->bw_vbios.mid_yclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid_yclk = bw_frc_to_fixed(
clks.clocks_in_khz[clks.num_levels>>1] * MEMORY_TYPE_MULTIPLIER,
1000);
- dc->bw_vbios.high_yclk = bw_frc_to_fixed(
+ dc->bw_vbios->high_yclk = bw_frc_to_fixed(
clks.clocks_in_khz[clks.num_levels-1] * MEMORY_TYPE_MULTIPLIER,
1000);
}
/* convert all the clock fro kHz to fix point mHz TODO: wloop data */
- dc->bw_vbios.high_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->high_sclk = bw_frc_to_fixed(
eng_clks.data[eng_clks.num_levels-1].clocks_in_khz, 1000);
- dc->bw_vbios.mid1_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid1_sclk = bw_frc_to_fixed(
eng_clks.data[eng_clks.num_levels/8].clocks_in_khz, 1000);
- dc->bw_vbios.mid2_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid2_sclk = bw_frc_to_fixed(
eng_clks.data[eng_clks.num_levels*2/8].clocks_in_khz, 1000);
- dc->bw_vbios.mid3_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid3_sclk = bw_frc_to_fixed(
eng_clks.data[eng_clks.num_levels*3/8].clocks_in_khz, 1000);
- dc->bw_vbios.mid4_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid4_sclk = bw_frc_to_fixed(
eng_clks.data[eng_clks.num_levels*4/8].clocks_in_khz, 1000);
- dc->bw_vbios.mid5_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid5_sclk = bw_frc_to_fixed(
eng_clks.data[eng_clks.num_levels*5/8].clocks_in_khz, 1000);
- dc->bw_vbios.mid6_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid6_sclk = bw_frc_to_fixed(
eng_clks.data[eng_clks.num_levels*6/8].clocks_in_khz, 1000);
- dc->bw_vbios.low_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->low_sclk = bw_frc_to_fixed(
eng_clks.data[0].clocks_in_khz, 1000);
/*do memory clock*/
* ALSO always convert UMA clock (from PPLIB) to YCLK (HW formula):
* YCLK = UMACLK*m_memoryTypeMultiplier
*/
- dc->bw_vbios.low_yclk = bw_frc_to_fixed(
+ dc->bw_vbios->low_yclk = bw_frc_to_fixed(
mem_clks.data[0].clocks_in_khz * MEMORY_TYPE_MULTIPLIER, 1000);
- dc->bw_vbios.mid_yclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid_yclk = bw_frc_to_fixed(
mem_clks.data[mem_clks.num_levels>>1].clocks_in_khz * MEMORY_TYPE_MULTIPLIER,
1000);
- dc->bw_vbios.high_yclk = bw_frc_to_fixed(
+ dc->bw_vbios->high_yclk = bw_frc_to_fixed(
mem_clks.data[mem_clks.num_levels-1].clocks_in_khz * MEMORY_TYPE_MULTIPLIER,
1000);
if (!dce112_hw_sequencer_construct(dc))
goto res_create_fail;
- bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios, dc->ctx->asic_id);
+ bw_calcs_init(dc->bw_dceip, dc->bw_vbios, dc->ctx->asic_id);
bw_calcs_data_update_from_pplib(dc);
}
/* convert all the clock fro kHz to fix point mHz TODO: wloop data */
- dc->bw_vbios.high_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->high_sclk = bw_frc_to_fixed(
eng_clks.data[eng_clks.num_levels-1].clocks_in_khz, 1000);
- dc->bw_vbios.mid1_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid1_sclk = bw_frc_to_fixed(
eng_clks.data[eng_clks.num_levels/8].clocks_in_khz, 1000);
- dc->bw_vbios.mid2_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid2_sclk = bw_frc_to_fixed(
eng_clks.data[eng_clks.num_levels*2/8].clocks_in_khz, 1000);
- dc->bw_vbios.mid3_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid3_sclk = bw_frc_to_fixed(
eng_clks.data[eng_clks.num_levels*3/8].clocks_in_khz, 1000);
- dc->bw_vbios.mid4_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid4_sclk = bw_frc_to_fixed(
eng_clks.data[eng_clks.num_levels*4/8].clocks_in_khz, 1000);
- dc->bw_vbios.mid5_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid5_sclk = bw_frc_to_fixed(
eng_clks.data[eng_clks.num_levels*5/8].clocks_in_khz, 1000);
- dc->bw_vbios.mid6_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid6_sclk = bw_frc_to_fixed(
eng_clks.data[eng_clks.num_levels*6/8].clocks_in_khz, 1000);
- dc->bw_vbios.low_sclk = bw_frc_to_fixed(
+ dc->bw_vbios->low_sclk = bw_frc_to_fixed(
eng_clks.data[0].clocks_in_khz, 1000);
/*do memory clock*/
* ALSO always convert UMA clock (from PPLIB) to YCLK (HW formula):
* YCLK = UMACLK*m_memoryTypeMultiplier
*/
- dc->bw_vbios.low_yclk = bw_frc_to_fixed(
+ dc->bw_vbios->low_yclk = bw_frc_to_fixed(
mem_clks.data[0].clocks_in_khz * MEMORY_TYPE_MULTIPLIER, 1000);
- dc->bw_vbios.mid_yclk = bw_frc_to_fixed(
+ dc->bw_vbios->mid_yclk = bw_frc_to_fixed(
mem_clks.data[mem_clks.num_levels>>1].clocks_in_khz * MEMORY_TYPE_MULTIPLIER,
1000);
- dc->bw_vbios.high_yclk = bw_frc_to_fixed(
+ dc->bw_vbios->high_yclk = bw_frc_to_fixed(
mem_clks.data[mem_clks.num_levels-1].clocks_in_khz * MEMORY_TYPE_MULTIPLIER,
1000);
dc->public.caps.max_planes = pool->base.pipe_count;
- bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios, dc->ctx->asic_id);
+ bw_calcs_init(dc->bw_dceip, dc->bw_vbios, dc->ctx->asic_id);
bw_calcs_data_update_from_pplib(dc);
struct dm_pp_clock_levels sclk_lvls;
/* Inputs into BW and WM calculations. */
- struct bw_calcs_dceip bw_dceip;
- struct bw_calcs_vbios bw_vbios;
+ struct bw_calcs_dceip *bw_dceip;
+ struct bw_calcs_vbios *bw_vbios;
#ifdef CONFIG_DRM_AMD_DC_DCN1_0
struct dcn_soc_bounding_box dcn_soc;
struct dcn_ip_params dcn_ip;