linux-sunxi.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/7] Enable 10bits bitstream for Hantro/G2 HEVC codec
@ 2022-08-29 16:21 Benjamin Gaignard
  2022-08-29 16:21 ` [PATCH v3 1/7] media: hantro: Store HEVC bit depth in context Benjamin Gaignard
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Benjamin Gaignard @ 2022-08-29 16:21 UTC (permalink / raw)
  To: mchehab, hverkuil, ezequiel, p.zabel, gregkh, mripard,
	paul.kocialkowski, wens, jernej.skrabec, samuel,
	nicolas.dufresne, andrzej.p
  Cc: linux-media, linux-kernel, linux-rockchip, linux-staging,
	linux-arm-kernel, linux-sunxi, kernel, Benjamin Gaignard

This series add 10bits support for newer hardware blocks (i.e without
legacy regs) and for HEVC codec.

Tested on IMX8MQ with HEVC conformance tests, the result is that all 
10bits bitstreams are OK.

version 3:
- Based on top of Ezequiel's patch "media: destage Hantro VPU driver"

Benjamin Gaignard (7):
  media: hantro: Store HEVC bit depth in context
  media: hantro: HEVC: Fix auxilary buffer size calculation
  media: hantro: HEVC: Fix chroma offset computation
  media: hantro: postproc: Configure output regs to support 10bit
  media: Hantro: HEVC: Allows 10-bit bitstream
  media: hantro: imx8m: Enable 10bit decoding
  media: hantro: Allows luma and chroma depth to be different

 .../media/platform/verisilicon/hantro_drv.c   | 14 ++++++----
 .../platform/verisilicon/hantro_g2_hevc_dec.c |  4 +--
 .../media/platform/verisilicon/hantro_hevc.c  |  4 +--
 .../platform/verisilicon/hantro_postproc.c    |  7 ++++-
 .../media/platform/verisilicon/imx8m_vpu_hw.c | 27 +++++++++++++++++++
 5 files changed, 45 insertions(+), 11 deletions(-)

-- 
2.32.0


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

* [PATCH v3 1/7] media: hantro: Store HEVC bit depth in context
  2022-08-29 16:21 [PATCH v3 0/7] Enable 10bits bitstream for Hantro/G2 HEVC codec Benjamin Gaignard
@ 2022-08-29 16:21 ` Benjamin Gaignard
  2022-08-30 18:17   ` Ezequiel Garcia
  2022-08-29 16:21 ` [PATCH v3 2/7] media: hantro: HEVC: Fix auxilary buffer size calculation Benjamin Gaignard
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 9+ messages in thread
From: Benjamin Gaignard @ 2022-08-29 16:21 UTC (permalink / raw)
  To: mchehab, hverkuil, ezequiel, p.zabel, gregkh, mripard,
	paul.kocialkowski, wens, jernej.skrabec, samuel,
	nicolas.dufresne, andrzej.p
  Cc: linux-media, linux-kernel, linux-rockchip, linux-staging,
	linux-arm-kernel, linux-sunxi, kernel, Benjamin Gaignard

Store HEVC bit depth in context.
Bit depth is equal to hevc sps bit_depth_luma_minus8 + 8.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
---
version 3:
- Based on top of Ezequiel's patch "media: destage Hantro VPU driver"
 drivers/media/platform/verisilicon/hantro_drv.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index 2036f72eeb4a..1dd8312d824c 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -251,6 +251,11 @@ queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq)
 
 static int hantro_try_ctrl(struct v4l2_ctrl *ctrl)
 {
+	struct hantro_ctx *ctx;
+
+	ctx = container_of(ctrl->handler,
+			   struct hantro_ctx, ctrl_handler);
+
 	if (ctrl->id == V4L2_CID_STATELESS_H264_SPS) {
 		const struct v4l2_ctrl_h264_sps *sps = ctrl->p_new.p_h264_sps;
 
@@ -272,6 +277,8 @@ static int hantro_try_ctrl(struct v4l2_ctrl *ctrl)
 		if (sps->bit_depth_luma_minus8 != 0)
 			/* Only 8-bit is supported */
 			return -EINVAL;
+
+		ctx->bit_depth = sps->bit_depth_luma_minus8 + 8;
 	} else if (ctrl->id == V4L2_CID_STATELESS_VP9_FRAME) {
 		const struct v4l2_ctrl_vp9_frame *dec_params = ctrl->p_new.p_vp9_frame;
 
-- 
2.32.0


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

* [PATCH v3 2/7] media: hantro: HEVC: Fix auxilary buffer size calculation
  2022-08-29 16:21 [PATCH v3 0/7] Enable 10bits bitstream for Hantro/G2 HEVC codec Benjamin Gaignard
  2022-08-29 16:21 ` [PATCH v3 1/7] media: hantro: Store HEVC bit depth in context Benjamin Gaignard
@ 2022-08-29 16:21 ` Benjamin Gaignard
  2022-08-29 16:21 ` [PATCH v3 3/7] media: hantro: HEVC: Fix chroma offset computation Benjamin Gaignard
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Benjamin Gaignard @ 2022-08-29 16:21 UTC (permalink / raw)
  To: mchehab, hverkuil, ezequiel, p.zabel, gregkh, mripard,
	paul.kocialkowski, wens, jernej.skrabec, samuel,
	nicolas.dufresne, andrzej.p
  Cc: linux-media, linux-kernel, linux-rockchip, linux-staging,
	linux-arm-kernel, linux-sunxi, kernel, Benjamin Gaignard

SAO and FILTER buffers size depend of the bit depth.
Make sure we have enough space for 10bit bitstreams.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
---
 drivers/media/platform/verisilicon/hantro_hevc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/verisilicon/hantro_hevc.c b/drivers/media/platform/verisilicon/hantro_hevc.c
index b990bc98164c..9383fb7081f6 100644
--- a/drivers/media/platform/verisilicon/hantro_hevc.c
+++ b/drivers/media/platform/verisilicon/hantro_hevc.c
@@ -104,7 +104,7 @@ static int tile_buffer_reallocate(struct hantro_ctx *ctx)
 		hevc_dec->tile_bsd.cpu = NULL;
 	}
 
-	size = VERT_FILTER_RAM_SIZE * height64 * (num_tile_cols - 1);
+	size = (VERT_FILTER_RAM_SIZE * height64 * (num_tile_cols - 1) * ctx->bit_depth) / 8;
 	hevc_dec->tile_filter.cpu = dma_alloc_coherent(vpu->dev, size,
 						       &hevc_dec->tile_filter.dma,
 						       GFP_KERNEL);
@@ -112,7 +112,7 @@ static int tile_buffer_reallocate(struct hantro_ctx *ctx)
 		goto err_free_tile_buffers;
 	hevc_dec->tile_filter.size = size;
 
-	size = VERT_SAO_RAM_SIZE * height64 * (num_tile_cols - 1);
+	size = (VERT_SAO_RAM_SIZE * height64 * (num_tile_cols - 1) * ctx->bit_depth) / 8;
 	hevc_dec->tile_sao.cpu = dma_alloc_coherent(vpu->dev, size,
 						    &hevc_dec->tile_sao.dma,
 						    GFP_KERNEL);
-- 
2.32.0


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

* [PATCH v3 3/7] media: hantro: HEVC: Fix chroma offset computation
  2022-08-29 16:21 [PATCH v3 0/7] Enable 10bits bitstream for Hantro/G2 HEVC codec Benjamin Gaignard
  2022-08-29 16:21 ` [PATCH v3 1/7] media: hantro: Store HEVC bit depth in context Benjamin Gaignard
  2022-08-29 16:21 ` [PATCH v3 2/7] media: hantro: HEVC: Fix auxilary buffer size calculation Benjamin Gaignard
@ 2022-08-29 16:21 ` Benjamin Gaignard
  2022-08-29 16:21 ` [PATCH v3 4/7] media: hantro: postproc: Configure output regs to support 10bit Benjamin Gaignard
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Benjamin Gaignard @ 2022-08-29 16:21 UTC (permalink / raw)
  To: mchehab, hverkuil, ezequiel, p.zabel, gregkh, mripard,
	paul.kocialkowski, wens, jernej.skrabec, samuel,
	nicolas.dufresne, andrzej.p
  Cc: linux-media, linux-kernel, linux-rockchip, linux-staging,
	linux-arm-kernel, linux-sunxi, kernel, Benjamin Gaignard

The chroma offset depends of the bitstream depth.
Make sure that ctx->bit_depth is used to compute it.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
---
 drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c b/drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c
index 233ecd863d5f..a917079a6ed3 100644
--- a/drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c
+++ b/drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c
@@ -12,7 +12,7 @@
 
 static size_t hantro_hevc_chroma_offset(struct hantro_ctx *ctx)
 {
-	return ctx->dst_fmt.width * ctx->dst_fmt.height;
+	return ctx->dst_fmt.width * ctx->dst_fmt.height * ctx->bit_depth / 8;
 }
 
 static size_t hantro_hevc_motion_vectors_offset(struct hantro_ctx *ctx)
-- 
2.32.0


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

* [PATCH v3 4/7] media: hantro: postproc: Configure output regs to support 10bit
  2022-08-29 16:21 [PATCH v3 0/7] Enable 10bits bitstream for Hantro/G2 HEVC codec Benjamin Gaignard
                   ` (2 preceding siblings ...)
  2022-08-29 16:21 ` [PATCH v3 3/7] media: hantro: HEVC: Fix chroma offset computation Benjamin Gaignard
@ 2022-08-29 16:21 ` Benjamin Gaignard
  2022-08-29 16:21 ` [PATCH v3 5/7] media: Hantro: HEVC: Allows 10-bit bitstream Benjamin Gaignard
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Benjamin Gaignard @ 2022-08-29 16:21 UTC (permalink / raw)
  To: mchehab, hverkuil, ezequiel, p.zabel, gregkh, mripard,
	paul.kocialkowski, wens, jernej.skrabec, samuel,
	nicolas.dufresne, andrzej.p
  Cc: linux-media, linux-kernel, linux-rockchip, linux-staging,
	linux-arm-kernel, linux-sunxi, kernel, Benjamin Gaignard

Move output format setting in postproc and make sure that
8/10bit configuration is correctly set.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
---
 drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c | 2 --
 drivers/media/platform/verisilicon/hantro_postproc.c    | 7 ++++++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c b/drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c
index a917079a6ed3..a9d4ac84a8d8 100644
--- a/drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c
+++ b/drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c
@@ -167,8 +167,6 @@ static void set_params(struct hantro_ctx *ctx)
 	hantro_reg_write(vpu, &g2_bit_depth_y_minus8, sps->bit_depth_luma_minus8);
 	hantro_reg_write(vpu, &g2_bit_depth_c_minus8, sps->bit_depth_chroma_minus8);
 
-	hantro_reg_write(vpu, &g2_output_8_bits, 0);
-
 	hantro_reg_write(vpu, &g2_hdr_skip_length, compute_header_skip_length(ctx));
 
 	min_log2_cb_size = sps->log2_min_luma_coding_block_size_minus3 + 3;
diff --git a/drivers/media/platform/verisilicon/hantro_postproc.c b/drivers/media/platform/verisilicon/hantro_postproc.c
index a0928c508434..09d8cf942689 100644
--- a/drivers/media/platform/verisilicon/hantro_postproc.c
+++ b/drivers/media/platform/verisilicon/hantro_postproc.c
@@ -114,6 +114,7 @@ static void hantro_postproc_g2_enable(struct hantro_ctx *ctx)
 	struct hantro_dev *vpu = ctx->dev;
 	struct vb2_v4l2_buffer *dst_buf;
 	int down_scale = down_scale_factor(ctx);
+	int out_depth;
 	size_t chroma_offset;
 	dma_addr_t dst_dma;
 
@@ -132,8 +133,9 @@ static void hantro_postproc_g2_enable(struct hantro_ctx *ctx)
 		hantro_write_addr(vpu, G2_RS_OUT_LUMA_ADDR, dst_dma);
 		hantro_write_addr(vpu, G2_RS_OUT_CHROMA_ADDR, dst_dma + chroma_offset);
 	}
+
+	out_depth = hantro_get_format_depth(ctx->dst_fmt.pixelformat);
 	if (ctx->dev->variant->legacy_regs) {
-		int out_depth = hantro_get_format_depth(ctx->dst_fmt.pixelformat);
 		u8 pp_shift = 0;
 
 		if (out_depth > 8)
@@ -141,6 +143,9 @@ static void hantro_postproc_g2_enable(struct hantro_ctx *ctx)
 
 		hantro_reg_write(ctx->dev, &g2_rs_out_bit_depth, out_depth);
 		hantro_reg_write(ctx->dev, &g2_pp_pix_shift, pp_shift);
+	} else {
+		hantro_reg_write(vpu, &g2_output_8_bits, out_depth > 8 ? 0 : 1);
+		hantro_reg_write(vpu, &g2_output_format, out_depth > 8 ? 1 : 0);
 	}
 	hantro_reg_write(vpu, &g2_out_rs_e, 1);
 }
-- 
2.32.0


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

* [PATCH v3 5/7] media: Hantro: HEVC: Allows 10-bit bitstream
  2022-08-29 16:21 [PATCH v3 0/7] Enable 10bits bitstream for Hantro/G2 HEVC codec Benjamin Gaignard
                   ` (3 preceding siblings ...)
  2022-08-29 16:21 ` [PATCH v3 4/7] media: hantro: postproc: Configure output regs to support 10bit Benjamin Gaignard
@ 2022-08-29 16:21 ` Benjamin Gaignard
  2022-08-29 16:21 ` [PATCH v3 6/7] media: hantro: imx8m: Enable 10bit decoding Benjamin Gaignard
  2022-08-29 16:21 ` [PATCH v3 7/7] media: hantro: Allows luma and chroma depth to be different Benjamin Gaignard
  6 siblings, 0 replies; 9+ messages in thread
From: Benjamin Gaignard @ 2022-08-29 16:21 UTC (permalink / raw)
  To: mchehab, hverkuil, ezequiel, p.zabel, gregkh, mripard,
	paul.kocialkowski, wens, jernej.skrabec, samuel,
	nicolas.dufresne, andrzej.p
  Cc: linux-media, linux-kernel, linux-rockchip, linux-staging,
	linux-arm-kernel, linux-sunxi, kernel, Benjamin Gaignard

Stop limiting HEVC support to 8-bits bitstreams also
accept 10-bits bitstreams.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
---
 drivers/media/platform/verisilicon/hantro_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index 1dd8312d824c..7c75922e2e98 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -274,8 +274,8 @@ static int hantro_try_ctrl(struct v4l2_ctrl *ctrl)
 		if (sps->bit_depth_luma_minus8 != sps->bit_depth_chroma_minus8)
 			/* Luma and chroma bit depth mismatch */
 			return -EINVAL;
-		if (sps->bit_depth_luma_minus8 != 0)
-			/* Only 8-bit is supported */
+		if (sps->bit_depth_luma_minus8 != 0 && sps->bit_depth_luma_minus8 != 2)
+			/* Only 8-bit and 10-bit are supported */
 			return -EINVAL;
 
 		ctx->bit_depth = sps->bit_depth_luma_minus8 + 8;
-- 
2.32.0


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

* [PATCH v3 6/7] media: hantro: imx8m: Enable 10bit decoding
  2022-08-29 16:21 [PATCH v3 0/7] Enable 10bits bitstream for Hantro/G2 HEVC codec Benjamin Gaignard
                   ` (4 preceding siblings ...)
  2022-08-29 16:21 ` [PATCH v3 5/7] media: Hantro: HEVC: Allows 10-bit bitstream Benjamin Gaignard
@ 2022-08-29 16:21 ` Benjamin Gaignard
  2022-08-29 16:21 ` [PATCH v3 7/7] media: hantro: Allows luma and chroma depth to be different Benjamin Gaignard
  6 siblings, 0 replies; 9+ messages in thread
From: Benjamin Gaignard @ 2022-08-29 16:21 UTC (permalink / raw)
  To: mchehab, hverkuil, ezequiel, p.zabel, gregkh, mripard,
	paul.kocialkowski, wens, jernej.skrabec, samuel,
	nicolas.dufresne, andrzej.p
  Cc: linux-media, linux-kernel, linux-rockchip, linux-staging,
	linux-arm-kernel, linux-sunxi, kernel, Benjamin Gaignard

Expose 10bit pixel formats to enable 10bit decoding in IMX8M SoCs.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
---
 .../media/platform/verisilicon/imx8m_vpu_hw.c | 27 +++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/media/platform/verisilicon/imx8m_vpu_hw.c b/drivers/media/platform/verisilicon/imx8m_vpu_hw.c
index 77f574fdfa77..b390228fd3b4 100644
--- a/drivers/media/platform/verisilicon/imx8m_vpu_hw.c
+++ b/drivers/media/platform/verisilicon/imx8m_vpu_hw.c
@@ -162,12 +162,39 @@ static const struct hantro_fmt imx8m_vpu_g2_postproc_fmts[] = {
 			.step_height = MB_DIM,
 		},
 	},
+	{
+		.fourcc = V4L2_PIX_FMT_P010,
+		.codec_mode = HANTRO_MODE_NONE,
+		.postprocessed = true,
+		.frmsize = {
+			.min_width = FMT_MIN_WIDTH,
+			.max_width = FMT_UHD_WIDTH,
+			.step_width = MB_DIM,
+			.min_height = FMT_MIN_HEIGHT,
+			.max_height = FMT_UHD_HEIGHT,
+			.step_height = MB_DIM,
+		},
+	},
 };
 
 static const struct hantro_fmt imx8m_vpu_g2_dec_fmts[] = {
 	{
 		.fourcc = V4L2_PIX_FMT_NV12_4L4,
 		.codec_mode = HANTRO_MODE_NONE,
+		.match_depth = true,
+		.frmsize = {
+			.min_width = FMT_MIN_WIDTH,
+			.max_width = FMT_UHD_WIDTH,
+			.step_width = TILE_MB_DIM,
+			.min_height = FMT_MIN_HEIGHT,
+			.max_height = FMT_UHD_HEIGHT,
+			.step_height = TILE_MB_DIM,
+		},
+	},
+	{
+		.fourcc = V4L2_PIX_FMT_P010_4L4,
+		.codec_mode = HANTRO_MODE_NONE,
+		.match_depth = true,
 		.frmsize = {
 			.min_width = FMT_MIN_WIDTH,
 			.max_width = FMT_UHD_WIDTH,
-- 
2.32.0


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

* [PATCH v3 7/7] media: hantro: Allows luma and chroma depth to be different
  2022-08-29 16:21 [PATCH v3 0/7] Enable 10bits bitstream for Hantro/G2 HEVC codec Benjamin Gaignard
                   ` (5 preceding siblings ...)
  2022-08-29 16:21 ` [PATCH v3 6/7] media: hantro: imx8m: Enable 10bit decoding Benjamin Gaignard
@ 2022-08-29 16:21 ` Benjamin Gaignard
  6 siblings, 0 replies; 9+ messages in thread
From: Benjamin Gaignard @ 2022-08-29 16:21 UTC (permalink / raw)
  To: mchehab, hverkuil, ezequiel, p.zabel, gregkh, mripard,
	paul.kocialkowski, wens, jernej.skrabec, samuel,
	nicolas.dufresne, andrzej.p
  Cc: linux-media, linux-kernel, linux-rockchip, linux-staging,
	linux-arm-kernel, linux-sunxi, kernel, Benjamin Gaignard

Luma and chroma depth are set on different hardware registers.
Even if they aren't identical the bitstream can be compliant
to HEVC specifications and decoded by the hardware.

With this patch TSUNEQBD_A_MAIN10_Technicolor_2 conformance test
is successfully decoded.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
---
 drivers/media/platform/verisilicon/hantro_drv.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index 7c75922e2e98..8cb4a68c9119 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -271,9 +271,6 @@ static int hantro_try_ctrl(struct v4l2_ctrl *ctrl)
 	} else if (ctrl->id == V4L2_CID_STATELESS_HEVC_SPS) {
 		const struct v4l2_ctrl_hevc_sps *sps = ctrl->p_new.p_hevc_sps;
 
-		if (sps->bit_depth_luma_minus8 != sps->bit_depth_chroma_minus8)
-			/* Luma and chroma bit depth mismatch */
-			return -EINVAL;
 		if (sps->bit_depth_luma_minus8 != 0 && sps->bit_depth_luma_minus8 != 2)
 			/* Only 8-bit and 10-bit are supported */
 			return -EINVAL;
-- 
2.32.0


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

* Re: [PATCH v3 1/7] media: hantro: Store HEVC bit depth in context
  2022-08-29 16:21 ` [PATCH v3 1/7] media: hantro: Store HEVC bit depth in context Benjamin Gaignard
@ 2022-08-30 18:17   ` Ezequiel Garcia
  0 siblings, 0 replies; 9+ messages in thread
From: Ezequiel Garcia @ 2022-08-30 18:17 UTC (permalink / raw)
  To: Benjamin Gaignard
  Cc: mchehab, hverkuil, p.zabel, gregkh, mripard, paul.kocialkowski,
	wens, jernej.skrabec, samuel, nicolas.dufresne, andrzej.p,
	linux-media, linux-kernel, linux-rockchip, linux-staging,
	linux-arm-kernel, linux-sunxi, kernel

Hi Benjamin,

On Mon, Aug 29, 2022 at 06:21:53PM +0200, Benjamin Gaignard wrote:
> Store HEVC bit depth in context.
> Bit depth is equal to hevc sps bit_depth_luma_minus8 + 8.
> 
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>

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

Looks good!

I have limited access to the hardware at the moment.

Can you make sure things look good not only for HEVC
but also for the other codecs?

Thanks!
Ezequiel

> ---
> version 3:
> - Based on top of Ezequiel's patch "media: destage Hantro VPU driver"
>  drivers/media/platform/verisilicon/hantro_drv.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
> index 2036f72eeb4a..1dd8312d824c 100644
> --- a/drivers/media/platform/verisilicon/hantro_drv.c
> +++ b/drivers/media/platform/verisilicon/hantro_drv.c
> @@ -251,6 +251,11 @@ queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq)
>  
>  static int hantro_try_ctrl(struct v4l2_ctrl *ctrl)
>  {
> +	struct hantro_ctx *ctx;
> +
> +	ctx = container_of(ctrl->handler,
> +			   struct hantro_ctx, ctrl_handler);
> +
>  	if (ctrl->id == V4L2_CID_STATELESS_H264_SPS) {
>  		const struct v4l2_ctrl_h264_sps *sps = ctrl->p_new.p_h264_sps;
>  
> @@ -272,6 +277,8 @@ static int hantro_try_ctrl(struct v4l2_ctrl *ctrl)
>  		if (sps->bit_depth_luma_minus8 != 0)
>  			/* Only 8-bit is supported */
>  			return -EINVAL;
> +
> +		ctx->bit_depth = sps->bit_depth_luma_minus8 + 8;
>  	} else if (ctrl->id == V4L2_CID_STATELESS_VP9_FRAME) {
>  		const struct v4l2_ctrl_vp9_frame *dec_params = ctrl->p_new.p_vp9_frame;
>  
> -- 
> 2.32.0
> 

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

end of thread, other threads:[~2022-08-30 18:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-29 16:21 [PATCH v3 0/7] Enable 10bits bitstream for Hantro/G2 HEVC codec Benjamin Gaignard
2022-08-29 16:21 ` [PATCH v3 1/7] media: hantro: Store HEVC bit depth in context Benjamin Gaignard
2022-08-30 18:17   ` Ezequiel Garcia
2022-08-29 16:21 ` [PATCH v3 2/7] media: hantro: HEVC: Fix auxilary buffer size calculation Benjamin Gaignard
2022-08-29 16:21 ` [PATCH v3 3/7] media: hantro: HEVC: Fix chroma offset computation Benjamin Gaignard
2022-08-29 16:21 ` [PATCH v3 4/7] media: hantro: postproc: Configure output regs to support 10bit Benjamin Gaignard
2022-08-29 16:21 ` [PATCH v3 5/7] media: Hantro: HEVC: Allows 10-bit bitstream Benjamin Gaignard
2022-08-29 16:21 ` [PATCH v3 6/7] media: hantro: imx8m: Enable 10bit decoding Benjamin Gaignard
2022-08-29 16:21 ` [PATCH v3 7/7] media: hantro: Allows luma and chroma depth to be different Benjamin Gaignard

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).