Skip to content

Commit d5bec40

Browse files
Dillon Varonealexdeucher
authored andcommitted
drm/amd/display: Use DCC meta pitch for MALL allocation requirements
[Description] Calculations for determining DCC meta size should be pitch*height*bpp/256. Reviewed-by: Alvin Lee <[email protected]> Acked-by: Jasdeep Dhillon <[email protected]> Signed-off-by: Dillon Varone <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 359bcc9 commit d5bec40

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,11 @@ static uint32_t dcn32_calculate_cab_allocation(struct dc *dc, struct dc_state *c
262262
num_mblks = ((mall_alloc_width_blk_aligned + mblk_width - 1) / mblk_width) *
263263
((mall_alloc_height_blk_aligned + mblk_height - 1) / mblk_height);
264264

265-
/* For DCC:
266-
* meta_num_mblk = CEILING(full_mblk_width_ub_l*full_mblk_height_ub_l*Bpe/256/mblk_bytes, 1)
265+
/*For DCC:
266+
* meta_num_mblk = CEILING(meta_pitch*full_vp_height*Bpe/256/mblk_bytes, 1)
267267
*/
268268
if (pipe->plane_state->dcc.enable)
269-
num_mblks += (mall_alloc_width_blk_aligned * mall_alloc_width_blk_aligned * bytes_per_pixel +
269+
num_mblks += (pipe->plane_state->dcc.meta_pitch * pipe->plane_res.scl_data.viewport.height * bytes_per_pixel +
270270
(256 * DCN3_2_MALL_MBLK_SIZE_BYTES) - 1) / (256 * DCN3_2_MALL_MBLK_SIZE_BYTES);
271271

272272
bytes_in_mall = num_mblks * DCN3_2_MALL_MBLK_SIZE_BYTES;

drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,19 @@ uint32_t dcn32_helper_calculate_num_ways_for_subvp(struct dc *dc, struct dc_stat
121121
*/
122122
num_mblks = ((mall_alloc_width_blk_aligned + mblk_width - 1) / mblk_width) *
123123
((mall_alloc_height_blk_aligned + mblk_height - 1) / mblk_height);
124+
125+
/*For DCC:
126+
* meta_num_mblk = CEILING(meta_pitch*full_vp_height*Bpe/256/mblk_bytes, 1)
127+
*/
128+
if (pipe->plane_state->dcc.enable)
129+
num_mblks += (pipe->plane_state->dcc.meta_pitch * pipe->plane_res.scl_data.viewport.height * bytes_per_pixel +
130+
(256 * DCN3_2_MALL_MBLK_SIZE_BYTES) - 1) / (256 * DCN3_2_MALL_MBLK_SIZE_BYTES);
131+
124132
bytes_in_mall = num_mblks * DCN3_2_MALL_MBLK_SIZE_BYTES;
125133
// cache lines used is total bytes / cache_line size. Add +2 for worst case alignment
126134
// (MALL is 64-byte aligned)
127135
cache_lines_per_plane = bytes_in_mall / dc->caps.cache_line_size + 2;
128136

129-
/* For DCC divide by 256 */
130-
if (pipe->plane_state->dcc.enable)
131-
cache_lines_per_plane = cache_lines_per_plane + (cache_lines_per_plane / 256) + 1;
132137
cache_lines_used += cache_lines_per_plane;
133138
}
134139
}

0 commit comments

Comments
 (0)