msm: vidc: Optimize enc scratch and scratch_2 buffer sizes

Optimize scratch and scratch_2 internal buffer size
calculators for encoder.

Change-Id: Idfaf7df13a427788cbb983a17fc2137be154bce8
Signed-off-by: Priyanka Gujjula <pgujjula@codeaurora.org>
This commit is contained in:
Priyanka Gujjula 2020-09-01 21:42:08 +05:30
commit 541b40c072

View file

@ -1410,7 +1410,9 @@ static inline u32 calculate_enc_scratch_size(struct msm_vidc_inst *inst,
bitstream_size = aligned_width * aligned_height * 3;
bitbin_size = ALIGN(bitstream_size, VENUS_DMA_ALIGNMENT);
}
if (num_vpp_pipes > 2)
if (aligned_width * aligned_height >= 3840 * 2160)
size_singlePipe = bitbin_size / 4;
else if (num_vpp_pipes > 2)
size_singlePipe = bitbin_size / 2;
else
size_singlePipe = bitbin_size;
@ -1814,7 +1816,7 @@ static inline u32 calculate_enc_scratch2_size(struct msm_vidc_inst *inst,
metadata_stride, meta_buf_height);
size = (aligned_height + chroma_height) * aligned_width +
meta_size_y + meta_size_c;
size = (size * (num_ref+3)) + 4096;
size = (size * (num_ref + 2)) + 4096;
} else {
ref_buf_height = (height + (HFI_VENUS_HEIGHT_ALIGNMENT - 1))
& (~(HFI_VENUS_HEIGHT_ALIGNMENT - 1));
@ -1847,7 +1849,7 @@ static inline u32 calculate_enc_scratch2_size(struct msm_vidc_inst *inst,
meta_size_c = hfi_ubwc_metadata_plane_buffer_size(
metadata_stride, meta_buf_height);
size = ref_buf_size + meta_size_y + meta_size_c;
size = (size * (num_ref+3)) + 4096;
size = (size * (num_ref + 2)) + 4096;
}
return size;
}