Skip to content

Commit

Permalink
media: hantro: HEVC: Fix auxilary buffer size calculation
Browse files Browse the repository at this point in the history
[ Upstream commit 8a43858 ]

SAO and FILTER buffers size depend of the bit depth.
Make sure we have enough space for 10bit bitstreams.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Benjamin Gaignard authored and gregkh committed Nov 10, 2022
1 parent ac23374 commit a4a7d28
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/staging/media/hantro/hantro_hevc.c
Expand Up @@ -104,15 +104,15 @@ static int tile_buffer_reallocate(struct hantro_ctx *ctx)
hevc_dec->tile_bsd.cpu = NULL;
}

size = VERT_FILTER_RAM_SIZE * height64 * (num_tile_cols - 1);
size = (VERT_FILTER_RAM_SIZE * height64 * (num_tile_cols - 1) * ctx->bit_depth) / 8;
hevc_dec->tile_filter.cpu = dma_alloc_coherent(vpu->dev, size,
&hevc_dec->tile_filter.dma,
GFP_KERNEL);
if (!hevc_dec->tile_filter.cpu)
goto err_free_tile_buffers;
hevc_dec->tile_filter.size = size;

size = VERT_SAO_RAM_SIZE * height64 * (num_tile_cols - 1);
size = (VERT_SAO_RAM_SIZE * height64 * (num_tile_cols - 1) * ctx->bit_depth) / 8;
hevc_dec->tile_sao.cpu = dma_alloc_coherent(vpu->dev, size,
&hevc_dec->tile_sao.dma,
GFP_KERNEL);
Expand Down

0 comments on commit a4a7d28

Please sign in to comment.