]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
media: hantro: postproc: Fix motion vector space allocation
authorEzequiel Garcia <ezequiel@collabora.com>
Mon, 27 Jul 2020 17:05:38 +0000 (19:05 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 1 Sep 2020 12:13:25 +0000 (14:13 +0200)
When the post-processor is enabled, the driver allocates
"shadow buffers" which are used for the decoder core,
and exposes the post-processed buffers to userspace.

For this reason, extra motion vector space has to
be allocated on the shadow buffers, which the driver
wasn't doing. Fix it.

This fix should address artifacts on high profile bitstreams.

Fixes: 8c2d66b036c77 ("media: hantro: Support color conversion via post-processing")
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/hantro/hantro_postproc.c

index 44062ffceaea75f760f7ed245642680d72f7c373..6d2a8f2a8f0bbe0ac530afa89b5b852cb1050b37 100644 (file)
@@ -118,7 +118,9 @@ int hantro_postproc_alloc(struct hantro_ctx *ctx)
        unsigned int num_buffers = cap_queue->num_buffers;
        unsigned int i, buf_size;
 
-       buf_size = ctx->dst_fmt.plane_fmt[0].sizeimage;
+       buf_size = ctx->dst_fmt.plane_fmt[0].sizeimage +
+                  hantro_h264_mv_size(ctx->dst_fmt.width,
+                                      ctx->dst_fmt.height);
 
        for (i = 0; i < num_buffers; ++i) {
                struct hantro_aux_buf *priv = &ctx->postproc.dec_q[i];