|
12 | 12 | #include "dml21_translation_helper.h" |
13 | 13 | #include "dml2_dc_resource_mgmt.h" |
14 | 14 |
|
| 15 | +#define INVALID -1 |
| 16 | + |
15 | 17 | static bool dml21_allocate_memory(struct dml2_context **dml_ctx) |
16 | 18 | { |
17 | 19 | *dml_ctx = vzalloc(sizeof(struct dml2_context)); |
@@ -208,10 +210,40 @@ static void dml21_calculate_rq_and_dlg_params(const struct dc *dc, struct dc_sta |
208 | 210 | } |
209 | 211 | } |
210 | 212 |
|
| 213 | +static void dml21_prepare_mcache_params(struct dml2_context *dml_ctx, struct dc_state *context, struct dc_mcache_params *mcache_params) |
| 214 | +{ |
| 215 | + int dc_plane_idx = 0; |
| 216 | + int dml_prog_idx, stream_idx, plane_idx; |
| 217 | + struct dml2_per_plane_programming *pln_prog = NULL; |
| 218 | + |
| 219 | + for (stream_idx = 0; stream_idx < context->stream_count; stream_idx++) { |
| 220 | + for (plane_idx = 0; plane_idx < context->stream_status[stream_idx].plane_count; plane_idx++) { |
| 221 | + dml_prog_idx = map_plane_to_dml21_display_cfg(dml_ctx, context->streams[stream_idx]->stream_id, context->stream_status[stream_idx].plane_states[plane_idx], context); |
| 222 | + if (dml_prog_idx == INVALID) { |
| 223 | + continue; |
| 224 | + } |
| 225 | + pln_prog = &dml_ctx->v21.mode_programming.programming->plane_programming[dml_prog_idx]; |
| 226 | + mcache_params[dc_plane_idx].valid = pln_prog->mcache_allocation.valid; |
| 227 | + mcache_params[dc_plane_idx].num_mcaches_plane0 = pln_prog->mcache_allocation.num_mcaches_plane0; |
| 228 | + mcache_params[dc_plane_idx].num_mcaches_plane1 = pln_prog->mcache_allocation.num_mcaches_plane1; |
| 229 | + mcache_params[dc_plane_idx].requires_dedicated_mall_mcache = pln_prog->mcache_allocation.requires_dedicated_mall_mcache; |
| 230 | + mcache_params[dc_plane_idx].last_slice_sharing.plane0_plane1 = pln_prog->mcache_allocation.last_slice_sharing.plane0_plane1; |
| 231 | + memcpy(mcache_params[dc_plane_idx].mcache_x_offsets_plane0, |
| 232 | + pln_prog->mcache_allocation.mcache_x_offsets_plane0, |
| 233 | + sizeof(int) * (DML2_MAX_MCACHES + 1)); |
| 234 | + memcpy(mcache_params[dc_plane_idx].mcache_x_offsets_plane1, |
| 235 | + pln_prog->mcache_allocation.mcache_x_offsets_plane1, |
| 236 | + sizeof(int) * (DML2_MAX_MCACHES + 1)); |
| 237 | + dc_plane_idx++; |
| 238 | + } |
| 239 | + } |
| 240 | +} |
| 241 | + |
211 | 242 | static bool dml21_mode_check_and_programming(const struct dc *in_dc, struct dc_state *context, struct dml2_context *dml_ctx) |
212 | 243 | { |
213 | 244 | bool result = false; |
214 | 245 | struct dml2_build_mode_programming_in_out *mode_programming = &dml_ctx->v21.mode_programming; |
| 246 | + struct dc_mcache_params mcache_params[MAX_PLANES] = {0}; |
215 | 247 |
|
216 | 248 | memset(&dml_ctx->v21.display_config, 0, sizeof(struct dml2_display_cfg)); |
217 | 249 | memset(&dml_ctx->v21.dml_to_dc_pipe_mapping, 0, sizeof(struct dml2_dml_to_dc_pipe_mapping)); |
@@ -246,6 +278,14 @@ static bool dml21_mode_check_and_programming(const struct dc *in_dc, struct dc_s |
246 | 278 | dml2_map_dc_pipes(dml_ctx, context, NULL, &dml_ctx->v21.dml_to_dc_pipe_mapping, in_dc->current_state); |
247 | 279 | /* if subvp phantoms are present, expand them into dc context */ |
248 | 280 | dml21_handle_phantom_streams_planes(in_dc, context, dml_ctx); |
| 281 | + |
| 282 | + if (in_dc->res_pool->funcs->program_mcache_pipe_config) { |
| 283 | + //Prepare mcache params for each plane based on mcache output from DML |
| 284 | + dml21_prepare_mcache_params(dml_ctx, context, mcache_params); |
| 285 | + |
| 286 | + //populate mcache regs to each pipe |
| 287 | + dml_ctx->config.callbacks.allocate_mcache(context, mcache_params); |
| 288 | + } |
249 | 289 | } |
250 | 290 |
|
251 | 291 | /* Copy DML CLK, WM and REG outputs to bandwidth context */ |
|
0 commit comments