|
46 | 46 | uint32_t dcn32_helper_calculate_num_ways_for_subvp(struct dc *dc, struct dc_state *context)
|
47 | 47 | {
|
48 | 48 | uint32_t num_ways = 0;
|
49 |
| - uint32_t mall_region_pixels = 0; |
50 | 49 | uint32_t bytes_per_pixel = 0;
|
51 | 50 | uint32_t cache_lines_used = 0;
|
52 | 51 | uint32_t lines_per_way = 0;
|
53 | 52 | uint32_t total_cache_lines = 0;
|
54 | 53 | uint32_t bytes_in_mall = 0;
|
55 | 54 | uint32_t num_mblks = 0;
|
56 | 55 | uint32_t cache_lines_per_plane = 0;
|
57 |
| - uint32_t i = 0; |
| 56 | + uint32_t i = 0, j = 0; |
| 57 | + uint32_t mblk_width = 0; |
| 58 | + uint32_t mblk_height = 0; |
| 59 | + uint32_t full_vp_width_blk_aligned = 0; |
| 60 | + uint32_t full_vp_height_blk_aligned = 0; |
| 61 | + uint32_t mall_alloc_width_blk_aligned = 0; |
| 62 | + uint32_t mall_alloc_height_blk_aligned = 0; |
| 63 | + uint32_t full_vp_height = 0; |
58 | 64 |
|
59 | 65 | for (i = 0; i < dc->res_pool->pipe_count; i++) {
|
60 | 66 | struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
|
61 | 67 |
|
62 | 68 | // Find the phantom pipes
|
63 |
| - if (pipe->stream && pipe->plane_state && !pipe->top_pipe && |
| 69 | + if (pipe->stream && pipe->plane_state && !pipe->top_pipe && !pipe->prev_odm_pipe && |
64 | 70 | pipe->stream->mall_stream_config.type == SUBVP_PHANTOM) {
|
65 |
| - bytes_per_pixel = pipe->plane_state->format >= SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616 ? 8 : 4; |
66 |
| - mall_region_pixels = pipe->plane_state->plane_size.surface_pitch * pipe->stream->timing.v_addressable; |
| 71 | + struct pipe_ctx *main_pipe = NULL; |
| 72 | + |
| 73 | + /* Get full viewport height from main pipe (required for MBLK calculation) */ |
| 74 | + for (j = 0; j < dc->res_pool->pipe_count; j++) { |
| 75 | + main_pipe = &context->res_ctx.pipe_ctx[j]; |
| 76 | + if (main_pipe->stream == pipe->stream->mall_stream_config.paired_stream) { |
| 77 | + full_vp_height = main_pipe->plane_res.scl_data.viewport.height; |
| 78 | + break; |
| 79 | + } |
| 80 | + } |
67 | 81 |
|
68 |
| - // For bytes required in MALL, calculate based on number of MBlks required |
69 |
| - num_mblks = (mall_region_pixels * bytes_per_pixel + |
70 |
| - DCN3_2_MALL_MBLK_SIZE_BYTES - 1) / DCN3_2_MALL_MBLK_SIZE_BYTES; |
| 82 | + bytes_per_pixel = pipe->plane_state->format >= SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616 ? 8 : 4; |
| 83 | + mblk_width = DCN3_2_MBLK_WIDTH; |
| 84 | + mblk_height = bytes_per_pixel == 4 ? DCN3_2_MBLK_HEIGHT_4BPE : DCN3_2_MBLK_HEIGHT_8BPE; |
| 85 | + |
| 86 | + /* full_vp_width_blk_aligned = FLOOR(vp_x_start + full_vp_width + blk_width - 1, blk_width) - |
| 87 | + * FLOOR(vp_x_start, blk_width) |
| 88 | + */ |
| 89 | + full_vp_width_blk_aligned = ((pipe->plane_res.scl_data.viewport.x + |
| 90 | + pipe->plane_res.scl_data.viewport.width + mblk_width - 1) / mblk_width * mblk_width) + |
| 91 | + (pipe->plane_res.scl_data.viewport.x / mblk_width * mblk_width); |
| 92 | + |
| 93 | + /* full_vp_height_blk_aligned = FLOOR(vp_y_start + full_vp_height + blk_height - 1, blk_height) - |
| 94 | + * FLOOR(vp_y_start, blk_height) |
| 95 | + */ |
| 96 | + full_vp_height_blk_aligned = ((pipe->plane_res.scl_data.viewport.y + |
| 97 | + full_vp_height + mblk_height - 1) / mblk_height * mblk_height) + |
| 98 | + (pipe->plane_res.scl_data.viewport.y / mblk_height * mblk_height); |
| 99 | + |
| 100 | + /* mall_alloc_width_blk_aligned_l/c = full_vp_width_blk_aligned_l/c */ |
| 101 | + mall_alloc_width_blk_aligned = full_vp_width_blk_aligned; |
| 102 | + |
| 103 | + /* mall_alloc_height_blk_aligned_l/c = CEILING(sub_vp_height_l/c - 1, blk_height_l/c) + blk_height_l/c */ |
| 104 | + mall_alloc_height_blk_aligned = (pipe->stream->timing.v_addressable - 1 + mblk_height - 1) / |
| 105 | + mblk_height * mblk_height + mblk_height; |
| 106 | + |
| 107 | + /* full_mblk_width_ub_l/c = mall_alloc_width_blk_aligned_l/c; |
| 108 | + * full_mblk_height_ub_l/c = mall_alloc_height_blk_aligned_l/c; |
| 109 | + * num_mblk_l/c = (full_mblk_width_ub_l/c / mblk_width_l/c) * (full_mblk_height_ub_l/c / mblk_height_l/c); |
| 110 | + * (Should be divisible, but round up if not) |
| 111 | + */ |
| 112 | + num_mblks = ((mall_alloc_width_blk_aligned + mblk_width - 1) / mblk_width) * |
| 113 | + ((mall_alloc_height_blk_aligned + mblk_height - 1) / mblk_height); |
71 | 114 | bytes_in_mall = num_mblks * DCN3_2_MALL_MBLK_SIZE_BYTES;
|
72 | 115 | // cache lines used is total bytes / cache_line size. Add +2 for worst case alignment
|
73 | 116 | // (MALL is 64-byte aligned)
|
|
0 commit comments