All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
To: Jernej Skrabec <jernej.skrabec@gmail.com>
Cc: p.zabel@pengutronix.de, mchehab@kernel.org, nicolas@ndufresne.ca,
	hverkuil-cisco@xs4all.nl, gregkh@linuxfoundation.org,
	wens@csie.org, samuel@sholland.org, linux-media@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org,
	linux-staging@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev
Subject: Re: [RFC PATCH 4/8] media: hantro: postproc: Fix buffer size calculation
Date: Sun, 3 Apr 2022 21:16:23 -0300	[thread overview]
Message-ID: <Yko41wsU2r7ScL1c@eze-laptop> (raw)
In-Reply-To: <20220227144926.3006585-5-jernej.skrabec@gmail.com>

Hi Jernej,

On Sun, Feb 27, 2022 at 03:49:22PM +0100, Jernej Skrabec wrote:
> When allocating aux buffers for postprocessing, it's assumed that base
> buffer size is the same as that of output. Coincidentally, that's true
> most of the time, but not always. 10-bit source also needs aux buffer
> size which is appropriate for 10-bit native format, even if the output
> format is 8-bit. Similarly, mv sizes and other extra buffer size also
> depends on source width/height, not destination.
> 
> Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
> ---
>  .../staging/media/hantro/hantro_postproc.c    | 24 +++++++++++++------
>  drivers/staging/media/hantro/hantro_v4l2.c    |  2 +-
>  drivers/staging/media/hantro/hantro_v4l2.h    |  2 ++
>  3 files changed, 20 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/media/hantro/hantro_postproc.c b/drivers/staging/media/hantro/hantro_postproc.c
> index 248abe5423f0..1a76628d5754 100644
> --- a/drivers/staging/media/hantro/hantro_postproc.c
> +++ b/drivers/staging/media/hantro/hantro_postproc.c
> @@ -12,6 +12,7 @@
>  #include "hantro_hw.h"
>  #include "hantro_g1_regs.h"
>  #include "hantro_g2_regs.h"
> +#include "hantro_v4l2.h"
>  
>  #define HANTRO_PP_REG_WRITE(vpu, reg_name, val) \
>  { \
> @@ -137,18 +138,27 @@ int hantro_postproc_alloc(struct hantro_ctx *ctx)
>  	struct v4l2_m2m_ctx *m2m_ctx = ctx->fh.m2m_ctx;
>  	struct vb2_queue *cap_queue = &m2m_ctx->cap_q_ctx.q;
>  	unsigned int num_buffers = cap_queue->num_buffers;
> +	struct v4l2_pix_format_mplane pix_mp;
> +	const struct hantro_fmt *fmt;
>  	unsigned int i, buf_size;
>  
> -	buf_size = ctx->dst_fmt.plane_fmt[0].sizeimage;
> +	/* this should always pick native format */
> +	fmt = hantro_get_default_fmt(ctx, false);
> +	if (!fmt)
> +		return -EINVAL;
> +	v4l2_fill_pixfmt_mp(&pix_mp, fmt->fourcc, ctx->src_fmt.width,
> +			    ctx->src_fmt.height);
> +
> +	buf_size = pix_mp.plane_fmt[0].sizeimage;

Took me a while to see that the main change is taking buf_size
from pix_mp, which now takes into account the bit-depth :)

To me this makes sense.

Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>

Thanks,
Ezequiel

WARNING: multiple messages have this Message-ID (diff)
From: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
To: Jernej Skrabec <jernej.skrabec@gmail.com>
Cc: p.zabel@pengutronix.de, mchehab@kernel.org, nicolas@ndufresne.ca,
	hverkuil-cisco@xs4all.nl, gregkh@linuxfoundation.org,
	wens@csie.org, samuel@sholland.org, linux-media@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org,
	linux-staging@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev
Subject: Re: [RFC PATCH 4/8] media: hantro: postproc: Fix buffer size calculation
Date: Sun, 3 Apr 2022 21:16:23 -0300	[thread overview]
Message-ID: <Yko41wsU2r7ScL1c@eze-laptop> (raw)
In-Reply-To: <20220227144926.3006585-5-jernej.skrabec@gmail.com>

Hi Jernej,

On Sun, Feb 27, 2022 at 03:49:22PM +0100, Jernej Skrabec wrote:
> When allocating aux buffers for postprocessing, it's assumed that base
> buffer size is the same as that of output. Coincidentally, that's true
> most of the time, but not always. 10-bit source also needs aux buffer
> size which is appropriate for 10-bit native format, even if the output
> format is 8-bit. Similarly, mv sizes and other extra buffer size also
> depends on source width/height, not destination.
> 
> Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
> ---
>  .../staging/media/hantro/hantro_postproc.c    | 24 +++++++++++++------
>  drivers/staging/media/hantro/hantro_v4l2.c    |  2 +-
>  drivers/staging/media/hantro/hantro_v4l2.h    |  2 ++
>  3 files changed, 20 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/media/hantro/hantro_postproc.c b/drivers/staging/media/hantro/hantro_postproc.c
> index 248abe5423f0..1a76628d5754 100644
> --- a/drivers/staging/media/hantro/hantro_postproc.c
> +++ b/drivers/staging/media/hantro/hantro_postproc.c
> @@ -12,6 +12,7 @@
>  #include "hantro_hw.h"
>  #include "hantro_g1_regs.h"
>  #include "hantro_g2_regs.h"
> +#include "hantro_v4l2.h"
>  
>  #define HANTRO_PP_REG_WRITE(vpu, reg_name, val) \
>  { \
> @@ -137,18 +138,27 @@ int hantro_postproc_alloc(struct hantro_ctx *ctx)
>  	struct v4l2_m2m_ctx *m2m_ctx = ctx->fh.m2m_ctx;
>  	struct vb2_queue *cap_queue = &m2m_ctx->cap_q_ctx.q;
>  	unsigned int num_buffers = cap_queue->num_buffers;
> +	struct v4l2_pix_format_mplane pix_mp;
> +	const struct hantro_fmt *fmt;
>  	unsigned int i, buf_size;
>  
> -	buf_size = ctx->dst_fmt.plane_fmt[0].sizeimage;
> +	/* this should always pick native format */
> +	fmt = hantro_get_default_fmt(ctx, false);
> +	if (!fmt)
> +		return -EINVAL;
> +	v4l2_fill_pixfmt_mp(&pix_mp, fmt->fourcc, ctx->src_fmt.width,
> +			    ctx->src_fmt.height);
> +
> +	buf_size = pix_mp.plane_fmt[0].sizeimage;

Took me a while to see that the main change is taking buf_size
from pix_mp, which now takes into account the bit-depth :)

To me this makes sense.

Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>

Thanks,
Ezequiel

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

WARNING: multiple messages have this Message-ID (diff)
From: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
To: Jernej Skrabec <jernej.skrabec@gmail.com>
Cc: p.zabel@pengutronix.de, mchehab@kernel.org, nicolas@ndufresne.ca,
	hverkuil-cisco@xs4all.nl, gregkh@linuxfoundation.org,
	wens@csie.org, samuel@sholland.org, linux-media@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org,
	linux-staging@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev
Subject: Re: [RFC PATCH 4/8] media: hantro: postproc: Fix buffer size calculation
Date: Sun, 3 Apr 2022 21:16:23 -0300	[thread overview]
Message-ID: <Yko41wsU2r7ScL1c@eze-laptop> (raw)
In-Reply-To: <20220227144926.3006585-5-jernej.skrabec@gmail.com>

Hi Jernej,

On Sun, Feb 27, 2022 at 03:49:22PM +0100, Jernej Skrabec wrote:
> When allocating aux buffers for postprocessing, it's assumed that base
> buffer size is the same as that of output. Coincidentally, that's true
> most of the time, but not always. 10-bit source also needs aux buffer
> size which is appropriate for 10-bit native format, even if the output
> format is 8-bit. Similarly, mv sizes and other extra buffer size also
> depends on source width/height, not destination.
> 
> Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
> ---
>  .../staging/media/hantro/hantro_postproc.c    | 24 +++++++++++++------
>  drivers/staging/media/hantro/hantro_v4l2.c    |  2 +-
>  drivers/staging/media/hantro/hantro_v4l2.h    |  2 ++
>  3 files changed, 20 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/media/hantro/hantro_postproc.c b/drivers/staging/media/hantro/hantro_postproc.c
> index 248abe5423f0..1a76628d5754 100644
> --- a/drivers/staging/media/hantro/hantro_postproc.c
> +++ b/drivers/staging/media/hantro/hantro_postproc.c
> @@ -12,6 +12,7 @@
>  #include "hantro_hw.h"
>  #include "hantro_g1_regs.h"
>  #include "hantro_g2_regs.h"
> +#include "hantro_v4l2.h"
>  
>  #define HANTRO_PP_REG_WRITE(vpu, reg_name, val) \
>  { \
> @@ -137,18 +138,27 @@ int hantro_postproc_alloc(struct hantro_ctx *ctx)
>  	struct v4l2_m2m_ctx *m2m_ctx = ctx->fh.m2m_ctx;
>  	struct vb2_queue *cap_queue = &m2m_ctx->cap_q_ctx.q;
>  	unsigned int num_buffers = cap_queue->num_buffers;
> +	struct v4l2_pix_format_mplane pix_mp;
> +	const struct hantro_fmt *fmt;
>  	unsigned int i, buf_size;
>  
> -	buf_size = ctx->dst_fmt.plane_fmt[0].sizeimage;
> +	/* this should always pick native format */
> +	fmt = hantro_get_default_fmt(ctx, false);
> +	if (!fmt)
> +		return -EINVAL;
> +	v4l2_fill_pixfmt_mp(&pix_mp, fmt->fourcc, ctx->src_fmt.width,
> +			    ctx->src_fmt.height);
> +
> +	buf_size = pix_mp.plane_fmt[0].sizeimage;

Took me a while to see that the main change is taking buf_size
from pix_mp, which now takes into account the bit-depth :)

To me this makes sense.

Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>

Thanks,
Ezequiel

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-04-04  0:16 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-27 14:49 [RFC PATCH 0/8] media: hantro: Add 10-bit support Jernej Skrabec
2022-02-27 14:49 ` Jernej Skrabec
2022-02-27 14:49 ` Jernej Skrabec
2022-02-27 14:49 ` [RFC PATCH 1/8] media: Add P010 tiled format Jernej Skrabec
2022-02-27 14:49   ` Jernej Skrabec
2022-02-27 14:49   ` Jernej Skrabec
2022-02-27 14:49 ` [RFC PATCH 2/8] media: Add P010 format Jernej Skrabec
2022-02-27 14:49   ` Jernej Skrabec
2022-02-27 14:49   ` Jernej Skrabec
2022-02-28 12:48   ` Nicolas Dufresne
2022-02-28 12:48     ` Nicolas Dufresne
2022-02-28 12:48     ` Nicolas Dufresne
2022-02-28 16:32     ` Jernej Škrabec
2022-02-28 16:32       ` Jernej Škrabec
2022-02-28 16:32       ` Jernej Škrabec
2022-02-28 17:02       ` Nicolas Dufresne
2022-02-28 17:02         ` Nicolas Dufresne
2022-02-28 17:02         ` Nicolas Dufresne
2022-04-04  0:04     ` Ezequiel Garcia
2022-04-04  0:04       ` Ezequiel Garcia
2022-04-04  0:04       ` Ezequiel Garcia
2022-04-04  9:02       ` Benjamin Gaignard
2022-04-04  9:02         ` Benjamin Gaignard
2022-04-04  9:02         ` Benjamin Gaignard
2022-02-27 14:49 ` [RFC PATCH 3/8] media: hantro: Support format filtering by depth Jernej Skrabec
2022-02-27 14:49   ` Jernej Skrabec
2022-02-27 14:49   ` Jernej Skrabec
2022-04-05 16:09   ` Benjamin Gaignard
2022-04-05 16:09     ` Benjamin Gaignard
2022-04-05 16:09     ` Benjamin Gaignard
2022-04-05 18:41     ` Jernej Škrabec
2022-04-05 18:41       ` Jernej Škrabec
2022-04-05 18:41       ` Jernej Škrabec
2022-02-27 14:49 ` [RFC PATCH 4/8] media: hantro: postproc: Fix buffer size calculation Jernej Skrabec
2022-02-27 14:49   ` Jernej Skrabec
2022-02-27 14:49   ` Jernej Skrabec
2022-04-04  0:16   ` Ezequiel Garcia [this message]
2022-04-04  0:16     ` Ezequiel Garcia
2022-04-04  0:16     ` Ezequiel Garcia
2022-02-27 14:49 ` [RFC PATCH 5/8] media: hantro: postproc: Fix legacy regs configuration Jernej Skrabec
2022-02-27 14:49   ` Jernej Skrabec
2022-02-27 14:49   ` Jernej Skrabec
2022-04-04  0:24   ` Ezequiel Garcia
2022-04-04  0:24     ` Ezequiel Garcia
2022-04-04  0:24     ` Ezequiel Garcia
2022-02-27 14:49 ` [RFC PATCH 6/8] media: hantro: Store VP9 bit depth in context Jernej Skrabec
2022-02-27 14:49   ` Jernej Skrabec
2022-02-27 14:49   ` Jernej Skrabec
2022-02-27 14:49 ` [RFC PATCH 7/8] media: hantro: sunxi: Enable 10-bit decoding Jernej Skrabec
2022-02-27 14:49   ` Jernej Skrabec
2022-02-27 14:49   ` Jernej Skrabec
2022-02-27 14:49 ` [RFC PATCH 8/8] media: hantro: sunxi: Increase frequency Jernej Skrabec
2022-02-27 14:49   ` Jernej Skrabec
2022-02-27 14:49   ` Jernej Skrabec
2022-02-27 17:03 ` [RFC PATCH 0/8] media: hantro: Add 10-bit support Jernej Škrabec
2022-02-27 17:03   ` Jernej Škrabec
2022-02-27 17:03   ` Jernej Škrabec
2022-04-05 16:07 ` Benjamin Gaignard
2022-04-05 16:07   ` Benjamin Gaignard
2022-04-05 16:07   ` Benjamin Gaignard
2022-04-05 18:40   ` Jernej Škrabec
2022-04-05 18:40     ` Jernej Škrabec
2022-04-05 18:40     ` Jernej Škrabec
2022-04-06  6:54     ` Benjamin Gaignard
2022-04-06  6:54       ` Benjamin Gaignard
2022-04-06  6:54       ` Benjamin Gaignard
2022-04-06 17:21       ` Jernej Škrabec
2022-04-06 17:21         ` Jernej Škrabec
2022-04-06 17:21         ` Jernej Škrabec
2022-04-06 17:50         ` Nicolas Dufresne
2022-04-06 17:50           ` Nicolas Dufresne
2022-04-06 17:50           ` Nicolas Dufresne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yko41wsU2r7ScL1c@eze-laptop \
    --to=ezequiel@vanguardiasur.com.ar \
    --cc=gregkh@linuxfoundation.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jernej.skrabec@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=mchehab@kernel.org \
    --cc=nicolas@ndufresne.ca \
    --cc=p.zabel@pengutronix.de \
    --cc=samuel@sholland.org \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.