All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel@collabora.com>
To: linux-media@vger.kernel.org
Cc: kernel@collabora.com, Tomasz Figa <tfiga@chromium.org>,
	linux-rockchip@lists.infradead.org,
	Heiko Stuebner <heiko@sntech.de>, Jonas Karlman <jonas@kwiboo.se>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Boris Brezillon <boris.brezillon@collabora.com>,
	Chris Healy <cphealy@gmail.com>,
	Ezequiel Garcia <ezequiel@collabora.com>
Subject: [PATCH 3/4] media: hantro: Add helper for the H264 motion vectors allocation
Date: Tue,  3 Sep 2019 15:17:10 -0300	[thread overview]
Message-ID: <20190903181711.7559-4-ezequiel@collabora.com> (raw)
In-Reply-To: <20190903181711.7559-1-ezequiel@collabora.com>

Introduce a helper to allow easier enablement of the post-processing
feature. No functional changes intended.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
---
 drivers/staging/media/hantro/hantro.h      | 6 ++++++
 drivers/staging/media/hantro/hantro_v4l2.c | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h
index deb90ae37859..e8872f24e351 100644
--- a/drivers/staging/media/hantro/hantro.h
+++ b/drivers/staging/media/hantro/hantro.h
@@ -381,4 +381,10 @@ hantro_get_dst_buf(struct hantro_ctx *ctx)
 	return v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
 }
 
+static inline unsigned int
+hantro_h264_buffer_extra_size(unsigned int width, unsigned int height)
+{
+	return 128 * MB_WIDTH(width) * MB_HEIGHT(height);
+}
+
 #endif /* HANTRO_H_ */
diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/media/hantro/hantro_v4l2.c
index d48b548842cf..59adecba0e85 100644
--- a/drivers/staging/media/hantro/hantro_v4l2.c
+++ b/drivers/staging/media/hantro/hantro_v4l2.c
@@ -246,8 +246,8 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f,
 		 */
 		if (ctx->vpu_src_fmt->fourcc == V4L2_PIX_FMT_H264_SLICE)
 			pix_mp->plane_fmt[0].sizeimage +=
-				128 * DIV_ROUND_UP(pix_mp->width, 16) *
-				      DIV_ROUND_UP(pix_mp->height, 16);
+				hantro_h264_buffer_extra_size(pix_mp->width,
+							      pix_mp->height);
 	} else if (!pix_mp->plane_fmt[0].sizeimage) {
 		/*
 		 * For coded formats the application can specify
-- 
2.22.0


WARNING: multiple messages have this Message-ID (diff)
From: Ezequiel Garcia <ezequiel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
To: linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>,
	Jonas Karlman <jonas-uIzNG4q0ceqzQB+pC5nmwQ@public.gmane.org>,
	Tomasz Figa <tfiga-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Boris Brezillon
	<boris.brezillon-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>,
	Philipp Zabel <p.zabel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	kernel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org,
	Ezequiel Garcia
	<ezequiel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>,
	Chris Healy <cphealy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [PATCH 3/4] media: hantro: Add helper for the H264 motion vectors allocation
Date: Tue,  3 Sep 2019 15:17:10 -0300	[thread overview]
Message-ID: <20190903181711.7559-4-ezequiel@collabora.com> (raw)
In-Reply-To: <20190903181711.7559-1-ezequiel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>

Introduce a helper to allow easier enablement of the post-processing
feature. No functional changes intended.

Signed-off-by: Ezequiel Garcia <ezequiel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
---
 drivers/staging/media/hantro/hantro.h      | 6 ++++++
 drivers/staging/media/hantro/hantro_v4l2.c | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h
index deb90ae37859..e8872f24e351 100644
--- a/drivers/staging/media/hantro/hantro.h
+++ b/drivers/staging/media/hantro/hantro.h
@@ -381,4 +381,10 @@ hantro_get_dst_buf(struct hantro_ctx *ctx)
 	return v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
 }
 
+static inline unsigned int
+hantro_h264_buffer_extra_size(unsigned int width, unsigned int height)
+{
+	return 128 * MB_WIDTH(width) * MB_HEIGHT(height);
+}
+
 #endif /* HANTRO_H_ */
diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/media/hantro/hantro_v4l2.c
index d48b548842cf..59adecba0e85 100644
--- a/drivers/staging/media/hantro/hantro_v4l2.c
+++ b/drivers/staging/media/hantro/hantro_v4l2.c
@@ -246,8 +246,8 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f,
 		 */
 		if (ctx->vpu_src_fmt->fourcc == V4L2_PIX_FMT_H264_SLICE)
 			pix_mp->plane_fmt[0].sizeimage +=
-				128 * DIV_ROUND_UP(pix_mp->width, 16) *
-				      DIV_ROUND_UP(pix_mp->height, 16);
+				hantro_h264_buffer_extra_size(pix_mp->width,
+							      pix_mp->height);
 	} else if (!pix_mp->plane_fmt[0].sizeimage) {
 		/*
 		 * For coded formats the application can specify
-- 
2.22.0

  parent reply	other threads:[~2019-09-03 18:17 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-03 18:17 [PATCH 0/4] Enable Hantro G1 post-processor Ezequiel Garcia
2019-09-03 18:17 ` Ezequiel Garcia
2019-09-03 18:17 ` [PATCH 1/4] media: hantro: Simplify macroblock macros Ezequiel Garcia
2019-09-03 18:17   ` Ezequiel Garcia
2019-09-04 10:50   ` Philipp Zabel
2019-09-04 10:50     ` Philipp Zabel
2019-09-03 18:17 ` [PATCH 2/4] media: hantro: Simplify buffer helpers Ezequiel Garcia
2019-09-03 18:17   ` Ezequiel Garcia
2019-09-04 10:50   ` Philipp Zabel
2019-09-04 10:50     ` Philipp Zabel
2019-09-03 18:17 ` Ezequiel Garcia [this message]
2019-09-03 18:17   ` [PATCH 3/4] media: hantro: Add helper for the H264 motion vectors allocation Ezequiel Garcia
2019-09-04 10:17   ` Philipp Zabel
2019-09-04 10:17     ` Philipp Zabel
2019-09-04 12:50     ` Ezequiel Garcia
2019-09-04 12:50       ` Ezequiel Garcia
2019-09-03 18:17 ` [PATCH 4/4] media: hantro: Support color conversion via post-processing Ezequiel Garcia
2019-09-03 18:17   ` Ezequiel Garcia
2019-09-09 11:03   ` Hans Verkuil
2019-09-09 11:03     ` Hans Verkuil
2019-09-11  8:34     ` Ezequiel Garcia
2019-09-11  8:34       ` Ezequiel Garcia
2019-09-09  7:07 ` [PATCH 0/4] Enable Hantro G1 post-processor Tomasz Figa
2019-09-09  7:07   ` Tomasz Figa
2019-09-11  8:27   ` Ezequiel Garcia
2019-09-11  8:27     ` Ezequiel Garcia
2019-09-11 19:48     ` Nicolas Dufresne
2019-09-11 19:48       ` Nicolas Dufresne
2019-09-11 19:49     ` Nicolas Dufresne
2019-09-11 19:49       ` Nicolas Dufresne
2019-09-12  5:52       ` Tomasz Figa
2019-09-12  5:52         ` Tomasz Figa
2019-09-12 11:35         ` Ezequiel Garcia
2019-09-12 11:35           ` Ezequiel Garcia
2019-09-16 18:18           ` Helen Koike
2019-09-16 18:18             ` Helen Koike

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=20190903181711.7559-4-ezequiel@collabora.com \
    --to=ezequiel@collabora.com \
    --cc=boris.brezillon@collabora.com \
    --cc=cphealy@gmail.com \
    --cc=heiko@sntech.de \
    --cc=jonas@kwiboo.se \
    --cc=kernel@collabora.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=p.zabel@pengutronix.de \
    --cc=tfiga@chromium.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.