| .. | .. |
|---|
| 25 | 25 | #include "dm_services.h" |
|---|
| 26 | 26 | #include "dc.h" |
|---|
| 27 | 27 | #include "core_types.h" |
|---|
| 28 | | -#include "hw_sequencer.h" |
|---|
| 28 | +#include "clk_mgr.h" |
|---|
| 29 | 29 | #include "dce100_hw_sequencer.h" |
|---|
| 30 | 30 | #include "resource.h" |
|---|
| 31 | 31 | |
|---|
| .. | .. |
|---|
| 105 | 105 | return false; |
|---|
| 106 | 106 | } |
|---|
| 107 | 107 | |
|---|
| 108 | | -static void dce100_pplib_apply_display_requirements( |
|---|
| 109 | | - struct dc *dc, |
|---|
| 110 | | - struct dc_state *context) |
|---|
| 111 | | -{ |
|---|
| 112 | | - struct dm_pp_display_configuration *pp_display_cfg = &context->pp_display_cfg; |
|---|
| 113 | | - |
|---|
| 114 | | - pp_display_cfg->avail_mclk_switch_time_us = |
|---|
| 115 | | - dce110_get_min_vblank_time_us(context); |
|---|
| 116 | | - /*pp_display_cfg->min_memory_clock_khz = context->bw.dce.yclk_khz |
|---|
| 117 | | - / MEMORY_TYPE_MULTIPLIER;*/ |
|---|
| 118 | | - |
|---|
| 119 | | - dce110_fill_display_configs(context, pp_display_cfg); |
|---|
| 120 | | - |
|---|
| 121 | | - if (memcmp(&dc->prev_display_config, pp_display_cfg, sizeof( |
|---|
| 122 | | - struct dm_pp_display_configuration)) != 0) |
|---|
| 123 | | - dm_pp_apply_display_requirements(dc->ctx, pp_display_cfg); |
|---|
| 124 | | - |
|---|
| 125 | | - dc->prev_display_config = *pp_display_cfg; |
|---|
| 126 | | -} |
|---|
| 127 | | - |
|---|
| 128 | | -/* unit: in_khz before mode set, get pixel clock from context. ASIC register |
|---|
| 129 | | - * may not be programmed yet |
|---|
| 130 | | - */ |
|---|
| 131 | | -static uint32_t get_max_pixel_clock_for_all_paths( |
|---|
| 132 | | - struct dc *dc, |
|---|
| 133 | | - struct dc_state *context) |
|---|
| 134 | | -{ |
|---|
| 135 | | - uint32_t max_pix_clk = 0; |
|---|
| 136 | | - int i; |
|---|
| 137 | | - |
|---|
| 138 | | - for (i = 0; i < MAX_PIPES; i++) { |
|---|
| 139 | | - struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i]; |
|---|
| 140 | | - |
|---|
| 141 | | - if (pipe_ctx->stream == NULL) |
|---|
| 142 | | - continue; |
|---|
| 143 | | - |
|---|
| 144 | | - /* do not check under lay */ |
|---|
| 145 | | - if (pipe_ctx->top_pipe) |
|---|
| 146 | | - continue; |
|---|
| 147 | | - |
|---|
| 148 | | - if (pipe_ctx->stream_res.pix_clk_params.requested_pix_clk > max_pix_clk) |
|---|
| 149 | | - max_pix_clk = |
|---|
| 150 | | - pipe_ctx->stream_res.pix_clk_params.requested_pix_clk; |
|---|
| 151 | | - } |
|---|
| 152 | | - return max_pix_clk; |
|---|
| 153 | | -} |
|---|
| 154 | | - |
|---|
| 155 | | -void dce100_set_bandwidth( |
|---|
| 108 | +void dce100_prepare_bandwidth( |
|---|
| 156 | 109 | struct dc *dc, |
|---|
| 157 | | - struct dc_state *context, |
|---|
| 158 | | - bool decrease_allowed) |
|---|
| 110 | + struct dc_state *context) |
|---|
| 159 | 111 | { |
|---|
| 160 | | - struct dc_clocks req_clks; |
|---|
| 161 | | - |
|---|
| 162 | | - req_clks.dispclk_khz = context->bw.dce.dispclk_khz * 115 / 100; |
|---|
| 163 | | - req_clks.phyclk_khz = get_max_pixel_clock_for_all_paths(dc, context); |
|---|
| 164 | | - |
|---|
| 165 | 112 | dce110_set_safe_displaymarks(&context->res_ctx, dc->res_pool); |
|---|
| 166 | 113 | |
|---|
| 167 | | - dc->res_pool->dccg->funcs->update_clocks( |
|---|
| 168 | | - dc->res_pool->dccg, |
|---|
| 169 | | - &req_clks, |
|---|
| 170 | | - decrease_allowed); |
|---|
| 171 | | - |
|---|
| 172 | | - dce100_pplib_apply_display_requirements(dc, context); |
|---|
| 114 | + dc->clk_mgr->funcs->update_clocks( |
|---|
| 115 | + dc->clk_mgr, |
|---|
| 116 | + context, |
|---|
| 117 | + false); |
|---|
| 173 | 118 | } |
|---|
| 174 | 119 | |
|---|
| 120 | +void dce100_optimize_bandwidth( |
|---|
| 121 | + struct dc *dc, |
|---|
| 122 | + struct dc_state *context) |
|---|
| 123 | +{ |
|---|
| 124 | + dce110_set_safe_displaymarks(&context->res_ctx, dc->res_pool); |
|---|
| 125 | + |
|---|
| 126 | + dc->clk_mgr->funcs->update_clocks( |
|---|
| 127 | + dc->clk_mgr, |
|---|
| 128 | + context, |
|---|
| 129 | + true); |
|---|
| 130 | +} |
|---|
| 175 | 131 | |
|---|
| 176 | 132 | /**************************************************************************/ |
|---|
| 177 | 133 | |
|---|
| .. | .. |
|---|
| 179 | 135 | { |
|---|
| 180 | 136 | dce110_hw_sequencer_construct(dc); |
|---|
| 181 | 137 | |
|---|
| 182 | | - dc->hwss.enable_display_power_gating = dce100_enable_display_power_gating; |
|---|
| 183 | | - dc->hwss.set_bandwidth = dce100_set_bandwidth; |
|---|
| 184 | | - dc->hwss.pplib_apply_display_requirements = |
|---|
| 185 | | - dce100_pplib_apply_display_requirements; |
|---|
| 138 | + dc->hwseq->funcs.enable_display_power_gating = dce100_enable_display_power_gating; |
|---|
| 139 | + dc->hwss.prepare_bandwidth = dce100_prepare_bandwidth; |
|---|
| 140 | + dc->hwss.optimize_bandwidth = dce100_optimize_bandwidth; |
|---|
| 186 | 141 | } |
|---|
| 187 | 142 | |
|---|