linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] hantro: postproc related fixes
@ 2020-07-27 17:05 Ezequiel Garcia
  2020-07-27 17:05 ` [PATCH v2 1/2] hantro: h264: Get the correct fallback reference buffer Ezequiel Garcia
  2020-07-27 17:05 ` [PATCH v2 2/2] hantro: postproc: Fix motion vector space allocation Ezequiel Garcia
  0 siblings, 2 replies; 5+ messages in thread
From: Ezequiel Garcia @ 2020-07-27 17:05 UTC (permalink / raw)
  To: linux-media
  Cc: Hans Verkuil, Philipp Zabel, Adrian Ratiu, Jonas Karlman,
	Ezequiel Garcia, kernel

Doing some more extended testing, we found a few
issues when the post-processor is enabled (currently
for color conversion).

The two patches below should fix these issues.

Changes from v1:

* Undo the change to the comment about the
  MV and MC layout. As pointed out by Jonas,
  the layout is not generic, and depends on the
  version of the decoder core. For now, let's
  leave it as is.

Ezequiel Garcia (2):
  hantro: h264: Get the correct fallback reference buffer
  hantro: postproc: Fix motion vector space allocation

 drivers/staging/media/hantro/hantro_h264.c     | 2 +-
 drivers/staging/media/hantro/hantro_postproc.c | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

-- 
2.27.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] hantro: h264: Get the correct fallback reference buffer
  2020-07-27 17:05 [PATCH v2 0/2] hantro: postproc related fixes Ezequiel Garcia
@ 2020-07-27 17:05 ` Ezequiel Garcia
  2020-07-28  7:29   ` Philipp Zabel
  2020-07-27 17:05 ` [PATCH v2 2/2] hantro: postproc: Fix motion vector space allocation Ezequiel Garcia
  1 sibling, 1 reply; 5+ messages in thread
From: Ezequiel Garcia @ 2020-07-27 17:05 UTC (permalink / raw)
  To: linux-media
  Cc: Hans Verkuil, Philipp Zabel, Adrian Ratiu, Jonas Karlman,
	Ezequiel Garcia, kernel

If the bitstream and the application are incorrectly configuring
the reference pictures, the hardware will need to fallback
to using some other reference picture.

When the post-processor is enabled, the fallback buffer
should be a shadow buffer (postproc.dec_q), and not a
CAPTURE queue buffer, since the latter is post-processed
and not really the output of the decoder core.

Fixes: 8c2d66b036c77 ("media: hantro: Support color conversion via post-processing")
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
---
 drivers/staging/media/hantro/hantro_h264.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/hantro/hantro_h264.c b/drivers/staging/media/hantro/hantro_h264.c
index 194d05848077..6dcd47bd9ed3 100644
--- a/drivers/staging/media/hantro/hantro_h264.c
+++ b/drivers/staging/media/hantro/hantro_h264.c
@@ -325,7 +325,7 @@ dma_addr_t hantro_h264_get_ref_buf(struct hantro_ctx *ctx,
 		 */
 		dst_buf = hantro_get_dst_buf(ctx);
 		buf = &dst_buf->vb2_buf;
-		dma_addr = vb2_dma_contig_plane_dma_addr(buf, 0);
+		dma_addr = hantro_get_dec_buf_addr(ctx, buf);
 	}
 
 	return dma_addr;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] hantro: postproc: Fix motion vector space allocation
  2020-07-27 17:05 [PATCH v2 0/2] hantro: postproc related fixes Ezequiel Garcia
  2020-07-27 17:05 ` [PATCH v2 1/2] hantro: h264: Get the correct fallback reference buffer Ezequiel Garcia
@ 2020-07-27 17:05 ` Ezequiel Garcia
  2020-07-28  7:29   ` Philipp Zabel
  1 sibling, 1 reply; 5+ messages in thread
From: Ezequiel Garcia @ 2020-07-27 17:05 UTC (permalink / raw)
  To: linux-media
  Cc: Hans Verkuil, Philipp Zabel, Adrian Ratiu, Jonas Karlman,
	Ezequiel Garcia, kernel

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];
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/2] hantro: h264: Get the correct fallback reference buffer
  2020-07-27 17:05 ` [PATCH v2 1/2] hantro: h264: Get the correct fallback reference buffer Ezequiel Garcia
@ 2020-07-28  7:29   ` Philipp Zabel
  0 siblings, 0 replies; 5+ messages in thread
From: Philipp Zabel @ 2020-07-28  7:29 UTC (permalink / raw)
  To: Ezequiel Garcia, linux-media
  Cc: Hans Verkuil, Adrian Ratiu, Jonas Karlman, kernel

On Mon, 2020-07-27 at 14:05 -0300, Ezequiel Garcia wrote:
> If the bitstream and the application are incorrectly configuring
> the reference pictures, the hardware will need to fallback
> to using some other reference picture.
> 
> When the post-processor is enabled, the fallback buffer
> should be a shadow buffer (postproc.dec_q), and not a
> CAPTURE queue buffer, since the latter is post-processed
> and not really the output of the decoder core.
> 
> Fixes: 8c2d66b036c77 ("media: hantro: Support color conversion via post-processing")
> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
> ---
>  drivers/staging/media/hantro/hantro_h264.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/hantro/hantro_h264.c b/drivers/staging/media/hantro/hantro_h264.c
> index 194d05848077..6dcd47bd9ed3 100644
> --- a/drivers/staging/media/hantro/hantro_h264.c
> +++ b/drivers/staging/media/hantro/hantro_h264.c
> @@ -325,7 +325,7 @@ dma_addr_t hantro_h264_get_ref_buf(struct hantro_ctx *ctx,
>  		 */
>  		dst_buf = hantro_get_dst_buf(ctx);
>  		buf = &dst_buf->vb2_buf;
> -		dma_addr = vb2_dma_contig_plane_dma_addr(buf, 0);
> +		dma_addr = hantro_get_dec_buf_addr(ctx, buf);
>  	}
>  
>  	return dma_addr;

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

regards
Philipp

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] hantro: postproc: Fix motion vector space allocation
  2020-07-27 17:05 ` [PATCH v2 2/2] hantro: postproc: Fix motion vector space allocation Ezequiel Garcia
@ 2020-07-28  7:29   ` Philipp Zabel
  0 siblings, 0 replies; 5+ messages in thread
From: Philipp Zabel @ 2020-07-28  7:29 UTC (permalink / raw)
  To: Ezequiel Garcia, linux-media
  Cc: Hans Verkuil, Adrian Ratiu, Jonas Karlman, kernel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-07-28  7:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-27 17:05 [PATCH v2 0/2] hantro: postproc related fixes Ezequiel Garcia
2020-07-27 17:05 ` [PATCH v2 1/2] hantro: h264: Get the correct fallback reference buffer Ezequiel Garcia
2020-07-28  7:29   ` Philipp Zabel
2020-07-27 17:05 ` [PATCH v2 2/2] hantro: postproc: Fix motion vector space allocation Ezequiel Garcia
2020-07-28  7:29   ` Philipp Zabel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).