diff mbox series

[v2,2/2] hantro: postproc: Fix motion vector space allocation

Message ID 20200727170538.32894-3-ezequiel@collabora.com (mailing list archive)
State New, archived
Headers show
Series hantro: postproc related fixes | expand

Commit Message

Ezequiel Garcia July 27, 2020, 5:05 p.m. UTC
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>
---
 drivers/staging/media/hantro/hantro_postproc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Philipp Zabel July 28, 2020, 7:29 a.m. UTC | #1
On Mon, 2020-07-27 at 14:05 -0300, Ezequiel Garcia wrote:
> 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>
> ---
>  drivers/staging/media/hantro/hantro_postproc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/hantro/hantro_postproc.c b/drivers/staging/media/hantro/hantro_postproc.c
> index 44062ffceaea..6d2a8f2a8f0b 100644
> --- a/drivers/staging/media/hantro/hantro_postproc.c
> +++ b/drivers/staging/media/hantro/hantro_postproc.c
> @@ -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];

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp
diff mbox series

Patch

diff --git a/drivers/staging/media/hantro/hantro_postproc.c b/drivers/staging/media/hantro/hantro_postproc.c
index 44062ffceaea..6d2a8f2a8f0b 100644
--- a/drivers/staging/media/hantro/hantro_postproc.c
+++ b/drivers/staging/media/hantro/hantro_postproc.c
@@ -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];