mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 13:46:49 +00:00
Merge pull request #6165 from heitbaum/ffmpeg
linux (NXP iMX8): update for VP9
This commit is contained in:
commit
39f6f3208b
@ -0,0 +1,42 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ezequiel Garcia <ezequiel@collabora.com>
|
||||
Date: Tue, 16 Nov 2021 15:38:31 +0100
|
||||
Subject: [PATCH] hantro: postproc: Fix motion vector space size
|
||||
|
||||
When the post-processor hardware block is enabled, the driver
|
||||
allocates an internal queue of buffers for the decoder enginer,
|
||||
and uses the vb2 queue for the post-processor engine.
|
||||
|
||||
For instance, on a G1 core, the decoder engine produces NV12 buffers
|
||||
and the post-processor engine can produce YUY2 buffers. The decoder
|
||||
engine expects motion vectors to be appended to the NV12 buffers,
|
||||
but this is only required for CODECs that need motion vectors,
|
||||
such as H.264.
|
||||
|
||||
Fix the post-processor logic accordingly.
|
||||
|
||||
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
|
||||
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
---
|
||||
drivers/staging/media/hantro/hantro_postproc.c | 7 ++++---
|
||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/hantro_postproc.c b/drivers/staging/media/hantro/hantro_postproc.c
|
||||
index ed8916c950a4..07842152003f 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_postproc.c
|
||||
+++ b/drivers/staging/media/hantro/hantro_postproc.c
|
||||
@@ -132,9 +132,10 @@ 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 +
|
||||
- hantro_h264_mv_size(ctx->dst_fmt.width,
|
||||
- ctx->dst_fmt.height);
|
||||
+ buf_size = ctx->dst_fmt.plane_fmt[0].sizeimage;
|
||||
+ if (ctx->vpu_src_fmt->fourcc == V4L2_PIX_FMT_H264_SLICE)
|
||||
+ buf_size += 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];
|
@ -0,0 +1,229 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ezequiel Garcia <ezequiel@collabora.com>
|
||||
Date: Tue, 16 Nov 2021 15:38:32 +0100
|
||||
Subject: [PATCH] hantro: postproc: Introduce struct hantro_postproc_ops
|
||||
|
||||
Turns out the post-processor block on the G2 core is substantially
|
||||
different from the one on the G1 core. Introduce hantro_postproc_ops
|
||||
with .enable and .disable methods, which will allow to support
|
||||
the G2 post-processor cleanly.
|
||||
|
||||
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
|
||||
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
|
||||
Reviewed-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
---
|
||||
drivers/staging/media/hantro/hantro.h | 5 +--
|
||||
drivers/staging/media/hantro/hantro_hw.h | 13 ++++++-
|
||||
.../staging/media/hantro/hantro_postproc.c | 35 +++++++++++++------
|
||||
drivers/staging/media/hantro/imx8m_vpu_hw.c | 2 +-
|
||||
.../staging/media/hantro/rockchip_vpu_hw.c | 6 ++--
|
||||
.../staging/media/hantro/sama5d4_vdec_hw.c | 2 +-
|
||||
6 files changed, 45 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h
|
||||
index c2e2dca38628..c2e01959dc00 100644
|
||||
--- a/drivers/staging/media/hantro/hantro.h
|
||||
+++ b/drivers/staging/media/hantro/hantro.h
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
struct hantro_ctx;
|
||||
struct hantro_codec_ops;
|
||||
+struct hantro_postproc_ops;
|
||||
|
||||
#define HANTRO_JPEG_ENCODER BIT(0)
|
||||
#define HANTRO_ENCODERS 0x0000ffff
|
||||
@@ -59,6 +60,7 @@ struct hantro_irq {
|
||||
* @num_dec_fmts: Number of decoder formats.
|
||||
* @postproc_fmts: Post-processor formats.
|
||||
* @num_postproc_fmts: Number of post-processor formats.
|
||||
+ * @postproc_ops: Post-processor ops.
|
||||
* @codec: Supported codecs
|
||||
* @codec_ops: Codec ops.
|
||||
* @init: Initialize hardware, optional.
|
||||
@@ -69,7 +71,6 @@ struct hantro_irq {
|
||||
* @num_clocks: number of clocks in the array
|
||||
* @reg_names: array of register range names
|
||||
* @num_regs: number of register range names in the array
|
||||
- * @postproc_regs: &struct hantro_postproc_regs pointer
|
||||
*/
|
||||
struct hantro_variant {
|
||||
unsigned int enc_offset;
|
||||
@@ -80,6 +81,7 @@ struct hantro_variant {
|
||||
unsigned int num_dec_fmts;
|
||||
const struct hantro_fmt *postproc_fmts;
|
||||
unsigned int num_postproc_fmts;
|
||||
+ const struct hantro_postproc_ops *postproc_ops;
|
||||
unsigned int codec;
|
||||
const struct hantro_codec_ops *codec_ops;
|
||||
int (*init)(struct hantro_dev *vpu);
|
||||
@@ -90,7 +92,6 @@ struct hantro_variant {
|
||||
int num_clocks;
|
||||
const char * const *reg_names;
|
||||
int num_regs;
|
||||
- const struct hantro_postproc_regs *postproc_regs;
|
||||
};
|
||||
|
||||
/**
|
||||
diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h
|
||||
index 267a6d33a47b..2f85430682d8 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_hw.h
|
||||
+++ b/drivers/staging/media/hantro/hantro_hw.h
|
||||
@@ -174,6 +174,17 @@ struct hantro_postproc_ctx {
|
||||
struct hantro_aux_buf dec_q[VB2_MAX_FRAME];
|
||||
};
|
||||
|
||||
+/**
|
||||
+ * struct hantro_postproc_ops - post-processor operations
|
||||
+ *
|
||||
+ * @enable: Enable the post-processor block. Optional.
|
||||
+ * @disable: Disable the post-processor block. Optional.
|
||||
+ */
|
||||
+struct hantro_postproc_ops {
|
||||
+ void (*enable)(struct hantro_ctx *ctx);
|
||||
+ void (*disable)(struct hantro_ctx *ctx);
|
||||
+};
|
||||
+
|
||||
/**
|
||||
* struct hantro_codec_ops - codec mode specific operations
|
||||
*
|
||||
@@ -221,7 +232,7 @@ extern const struct hantro_variant rk3328_vpu_variant;
|
||||
extern const struct hantro_variant rk3399_vpu_variant;
|
||||
extern const struct hantro_variant sama5d4_vdec_variant;
|
||||
|
||||
-extern const struct hantro_postproc_regs hantro_g1_postproc_regs;
|
||||
+extern const struct hantro_postproc_ops hantro_g1_postproc_ops;
|
||||
|
||||
extern const u32 hantro_vp8_dec_mc_filter[8][6];
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/hantro_postproc.c b/drivers/staging/media/hantro/hantro_postproc.c
|
||||
index 07842152003f..882fb8bc5ddd 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_postproc.c
|
||||
+++ b/drivers/staging/media/hantro/hantro_postproc.c
|
||||
@@ -15,14 +15,14 @@
|
||||
#define HANTRO_PP_REG_WRITE(vpu, reg_name, val) \
|
||||
{ \
|
||||
hantro_reg_write(vpu, \
|
||||
- &(vpu)->variant->postproc_regs->reg_name, \
|
||||
+ &hantro_g1_postproc_regs.reg_name, \
|
||||
val); \
|
||||
}
|
||||
|
||||
#define HANTRO_PP_REG_WRITE_S(vpu, reg_name, val) \
|
||||
{ \
|
||||
hantro_reg_write_s(vpu, \
|
||||
- &(vpu)->variant->postproc_regs->reg_name, \
|
||||
+ &hantro_g1_postproc_regs.reg_name, \
|
||||
val); \
|
||||
}
|
||||
|
||||
@@ -64,16 +64,13 @@ bool hantro_needs_postproc(const struct hantro_ctx *ctx,
|
||||
return fmt->fourcc != V4L2_PIX_FMT_NV12;
|
||||
}
|
||||
|
||||
-void hantro_postproc_enable(struct hantro_ctx *ctx)
|
||||
+static void hantro_postproc_g1_enable(struct hantro_ctx *ctx)
|
||||
{
|
||||
struct hantro_dev *vpu = ctx->dev;
|
||||
struct vb2_v4l2_buffer *dst_buf;
|
||||
u32 src_pp_fmt, dst_pp_fmt;
|
||||
dma_addr_t dst_dma;
|
||||
|
||||
- if (!vpu->variant->postproc_regs)
|
||||
- return;
|
||||
-
|
||||
/* Turn on pipeline mode. Must be done first. */
|
||||
HANTRO_PP_REG_WRITE_S(vpu, pipeline_en, 0x1);
|
||||
|
||||
@@ -154,12 +151,30 @@ int hantro_postproc_alloc(struct hantro_ctx *ctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-void hantro_postproc_disable(struct hantro_ctx *ctx)
|
||||
+static void hantro_postproc_g1_disable(struct hantro_ctx *ctx)
|
||||
{
|
||||
struct hantro_dev *vpu = ctx->dev;
|
||||
|
||||
- if (!vpu->variant->postproc_regs)
|
||||
- return;
|
||||
-
|
||||
HANTRO_PP_REG_WRITE_S(vpu, pipeline_en, 0x0);
|
||||
}
|
||||
+
|
||||
+void hantro_postproc_disable(struct hantro_ctx *ctx)
|
||||
+{
|
||||
+ struct hantro_dev *vpu = ctx->dev;
|
||||
+
|
||||
+ if (vpu->variant->postproc_ops && vpu->variant->postproc_ops->disable)
|
||||
+ vpu->variant->postproc_ops->disable(ctx);
|
||||
+}
|
||||
+
|
||||
+void hantro_postproc_enable(struct hantro_ctx *ctx)
|
||||
+{
|
||||
+ struct hantro_dev *vpu = ctx->dev;
|
||||
+
|
||||
+ if (vpu->variant->postproc_ops && vpu->variant->postproc_ops->enable)
|
||||
+ vpu->variant->postproc_ops->enable(ctx);
|
||||
+}
|
||||
+
|
||||
+const struct hantro_postproc_ops hantro_g1_postproc_ops = {
|
||||
+ .enable = hantro_postproc_g1_enable,
|
||||
+ .disable = hantro_postproc_g1_disable,
|
||||
+};
|
||||
diff --git a/drivers/staging/media/hantro/imx8m_vpu_hw.c b/drivers/staging/media/hantro/imx8m_vpu_hw.c
|
||||
index ea919bfb9891..22fa7d2f3b64 100644
|
||||
--- a/drivers/staging/media/hantro/imx8m_vpu_hw.c
|
||||
+++ b/drivers/staging/media/hantro/imx8m_vpu_hw.c
|
||||
@@ -262,7 +262,7 @@ const struct hantro_variant imx8mq_vpu_variant = {
|
||||
.num_dec_fmts = ARRAY_SIZE(imx8m_vpu_dec_fmts),
|
||||
.postproc_fmts = imx8m_vpu_postproc_fmts,
|
||||
.num_postproc_fmts = ARRAY_SIZE(imx8m_vpu_postproc_fmts),
|
||||
- .postproc_regs = &hantro_g1_postproc_regs,
|
||||
+ .postproc_ops = &hantro_g1_postproc_ops,
|
||||
.codec = HANTRO_MPEG2_DECODER | HANTRO_VP8_DECODER |
|
||||
HANTRO_H264_DECODER,
|
||||
.codec_ops = imx8mq_vpu_codec_ops,
|
||||
diff --git a/drivers/staging/media/hantro/rockchip_vpu_hw.c b/drivers/staging/media/hantro/rockchip_vpu_hw.c
|
||||
index d4f52957cc53..6c1ad5534ce5 100644
|
||||
--- a/drivers/staging/media/hantro/rockchip_vpu_hw.c
|
||||
+++ b/drivers/staging/media/hantro/rockchip_vpu_hw.c
|
||||
@@ -460,7 +460,7 @@ const struct hantro_variant rk3036_vpu_variant = {
|
||||
.num_dec_fmts = ARRAY_SIZE(rk3066_vpu_dec_fmts),
|
||||
.postproc_fmts = rockchip_vpu1_postproc_fmts,
|
||||
.num_postproc_fmts = ARRAY_SIZE(rockchip_vpu1_postproc_fmts),
|
||||
- .postproc_regs = &hantro_g1_postproc_regs,
|
||||
+ .postproc_ops = &hantro_g1_postproc_ops,
|
||||
.codec = HANTRO_MPEG2_DECODER | HANTRO_VP8_DECODER |
|
||||
HANTRO_H264_DECODER,
|
||||
.codec_ops = rk3036_vpu_codec_ops,
|
||||
@@ -485,7 +485,7 @@ const struct hantro_variant rk3066_vpu_variant = {
|
||||
.num_dec_fmts = ARRAY_SIZE(rk3066_vpu_dec_fmts),
|
||||
.postproc_fmts = rockchip_vpu1_postproc_fmts,
|
||||
.num_postproc_fmts = ARRAY_SIZE(rockchip_vpu1_postproc_fmts),
|
||||
- .postproc_regs = &hantro_g1_postproc_regs,
|
||||
+ .postproc_ops = &hantro_g1_postproc_ops,
|
||||
.codec = HANTRO_JPEG_ENCODER | HANTRO_MPEG2_DECODER |
|
||||
HANTRO_VP8_DECODER | HANTRO_H264_DECODER,
|
||||
.codec_ops = rk3066_vpu_codec_ops,
|
||||
@@ -505,7 +505,7 @@ const struct hantro_variant rk3288_vpu_variant = {
|
||||
.num_dec_fmts = ARRAY_SIZE(rk3288_vpu_dec_fmts),
|
||||
.postproc_fmts = rockchip_vpu1_postproc_fmts,
|
||||
.num_postproc_fmts = ARRAY_SIZE(rockchip_vpu1_postproc_fmts),
|
||||
- .postproc_regs = &hantro_g1_postproc_regs,
|
||||
+ .postproc_ops = &hantro_g1_postproc_ops,
|
||||
.codec = HANTRO_JPEG_ENCODER | HANTRO_MPEG2_DECODER |
|
||||
HANTRO_VP8_DECODER | HANTRO_H264_DECODER,
|
||||
.codec_ops = rk3288_vpu_codec_ops,
|
||||
diff --git a/drivers/staging/media/hantro/sama5d4_vdec_hw.c b/drivers/staging/media/hantro/sama5d4_vdec_hw.c
|
||||
index 9c3b8cd0b239..f3fecc7248c4 100644
|
||||
--- a/drivers/staging/media/hantro/sama5d4_vdec_hw.c
|
||||
+++ b/drivers/staging/media/hantro/sama5d4_vdec_hw.c
|
||||
@@ -100,7 +100,7 @@ const struct hantro_variant sama5d4_vdec_variant = {
|
||||
.num_dec_fmts = ARRAY_SIZE(sama5d4_vdec_fmts),
|
||||
.postproc_fmts = sama5d4_vdec_postproc_fmts,
|
||||
.num_postproc_fmts = ARRAY_SIZE(sama5d4_vdec_postproc_fmts),
|
||||
- .postproc_regs = &hantro_g1_postproc_regs,
|
||||
+ .postproc_ops = &hantro_g1_postproc_ops,
|
||||
.codec = HANTRO_MPEG2_DECODER | HANTRO_VP8_DECODER |
|
||||
HANTRO_H264_DECODER,
|
||||
.codec_ops = sama5d4_vdec_codec_ops,
|
@ -0,0 +1,97 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ezequiel Garcia <ezequiel@collabora.com>
|
||||
Date: Tue, 16 Nov 2021 15:38:33 +0100
|
||||
Subject: [PATCH] hantro: Simplify postprocessor
|
||||
|
||||
Add a 'postprocessed' boolean property to struct hantro_fmt
|
||||
to signal that a format is produced by the post-processor.
|
||||
This will allow to introduce the G2 post-processor in a simple way.
|
||||
|
||||
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
|
||||
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
---
|
||||
drivers/staging/media/hantro/hantro.h | 2 ++
|
||||
drivers/staging/media/hantro/hantro_postproc.c | 8 +-------
|
||||
drivers/staging/media/hantro/imx8m_vpu_hw.c | 1 +
|
||||
drivers/staging/media/hantro/rockchip_vpu_hw.c | 1 +
|
||||
drivers/staging/media/hantro/sama5d4_vdec_hw.c | 1 +
|
||||
5 files changed, 6 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h
|
||||
index c2e01959dc00..dd5e56765d4e 100644
|
||||
--- a/drivers/staging/media/hantro/hantro.h
|
||||
+++ b/drivers/staging/media/hantro/hantro.h
|
||||
@@ -263,6 +263,7 @@ struct hantro_ctx {
|
||||
* @max_depth: Maximum depth, for bitstream formats
|
||||
* @enc_fmt: Format identifier for encoder registers.
|
||||
* @frmsize: Supported range of frame sizes (only for bitstream formats).
|
||||
+ * @postprocessed: Indicates if this format needs the post-processor.
|
||||
*/
|
||||
struct hantro_fmt {
|
||||
char *name;
|
||||
@@ -272,6 +273,7 @@ struct hantro_fmt {
|
||||
int max_depth;
|
||||
enum hantro_enc_fmt enc_fmt;
|
||||
struct v4l2_frmsize_stepwise frmsize;
|
||||
+ bool postprocessed;
|
||||
};
|
||||
|
||||
struct hantro_reg {
|
||||
diff --git a/drivers/staging/media/hantro/hantro_postproc.c b/drivers/staging/media/hantro/hantro_postproc.c
|
||||
index 882fb8bc5ddd..4549aec08feb 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_postproc.c
|
||||
+++ b/drivers/staging/media/hantro/hantro_postproc.c
|
||||
@@ -53,15 +53,9 @@ const struct hantro_postproc_regs hantro_g1_postproc_regs = {
|
||||
bool hantro_needs_postproc(const struct hantro_ctx *ctx,
|
||||
const struct hantro_fmt *fmt)
|
||||
{
|
||||
- struct hantro_dev *vpu = ctx->dev;
|
||||
-
|
||||
if (ctx->is_encoder)
|
||||
return false;
|
||||
-
|
||||
- if (!vpu->variant->postproc_fmts)
|
||||
- return false;
|
||||
-
|
||||
- return fmt->fourcc != V4L2_PIX_FMT_NV12;
|
||||
+ return fmt->postprocessed;
|
||||
}
|
||||
|
||||
static void hantro_postproc_g1_enable(struct hantro_ctx *ctx)
|
||||
diff --git a/drivers/staging/media/hantro/imx8m_vpu_hw.c b/drivers/staging/media/hantro/imx8m_vpu_hw.c
|
||||
index 22fa7d2f3b64..02e61438220a 100644
|
||||
--- a/drivers/staging/media/hantro/imx8m_vpu_hw.c
|
||||
+++ b/drivers/staging/media/hantro/imx8m_vpu_hw.c
|
||||
@@ -82,6 +82,7 @@ static const struct hantro_fmt imx8m_vpu_postproc_fmts[] = {
|
||||
{
|
||||
.fourcc = V4L2_PIX_FMT_YUYV,
|
||||
.codec_mode = HANTRO_MODE_NONE,
|
||||
+ .postprocessed = true,
|
||||
},
|
||||
};
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/rockchip_vpu_hw.c b/drivers/staging/media/hantro/rockchip_vpu_hw.c
|
||||
index 6c1ad5534ce5..f372f767d4ff 100644
|
||||
--- a/drivers/staging/media/hantro/rockchip_vpu_hw.c
|
||||
+++ b/drivers/staging/media/hantro/rockchip_vpu_hw.c
|
||||
@@ -62,6 +62,7 @@ static const struct hantro_fmt rockchip_vpu1_postproc_fmts[] = {
|
||||
{
|
||||
.fourcc = V4L2_PIX_FMT_YUYV,
|
||||
.codec_mode = HANTRO_MODE_NONE,
|
||||
+ .postprocessed = true,
|
||||
},
|
||||
};
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/sama5d4_vdec_hw.c b/drivers/staging/media/hantro/sama5d4_vdec_hw.c
|
||||
index f3fecc7248c4..b2fc1c5613e1 100644
|
||||
--- a/drivers/staging/media/hantro/sama5d4_vdec_hw.c
|
||||
+++ b/drivers/staging/media/hantro/sama5d4_vdec_hw.c
|
||||
@@ -15,6 +15,7 @@ static const struct hantro_fmt sama5d4_vdec_postproc_fmts[] = {
|
||||
{
|
||||
.fourcc = V4L2_PIX_FMT_YUYV,
|
||||
.codec_mode = HANTRO_MODE_NONE,
|
||||
+ .postprocessed = true,
|
||||
},
|
||||
};
|
||||
|
@ -0,0 +1,65 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ezequiel Garcia <ezequiel@collabora.com>
|
||||
Date: Tue, 16 Nov 2021 15:38:34 +0100
|
||||
Subject: [PATCH] hantro: Add quirk for NV12/NV12_4L4 capture format
|
||||
|
||||
The G2 core decoder engine produces NV12_4L4 format,
|
||||
which is a simple NV12 4x4 tiled format. The driver currently
|
||||
hides this format by always enabling the post-processor engine,
|
||||
and therefore offering NV12 directly.
|
||||
|
||||
This is done without using the logic in hantro_postproc.c
|
||||
and therefore makes it difficult to add VP9 cleanly.
|
||||
|
||||
Since fixing this is not easy, add a small quirk to force
|
||||
NV12 if HEVC was configured, but otherwise declare NV12_4L4
|
||||
as the pixel format in imx8mq_vpu_g2_variant.dec_fmts.
|
||||
|
||||
This will be used by the VP9 decoder which will be added soon.
|
||||
|
||||
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
|
||||
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
---
|
||||
drivers/staging/media/hantro/hantro_v4l2.c | 14 ++++++++++++++
|
||||
drivers/staging/media/hantro/imx8m_vpu_hw.c | 2 +-
|
||||
2 files changed, 15 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/media/hantro/hantro_v4l2.c
|
||||
index bcb0bdff4a9a..d1f060c55fed 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_v4l2.c
|
||||
+++ b/drivers/staging/media/hantro/hantro_v4l2.c
|
||||
@@ -150,6 +150,20 @@ static int vidioc_enum_fmt(struct file *file, void *priv,
|
||||
unsigned int num_fmts, i, j = 0;
|
||||
bool skip_mode_none;
|
||||
|
||||
+ /*
|
||||
+ * The HEVC decoder on the G2 core needs a little quirk to offer NV12
|
||||
+ * only on the capture side. Once the post-processor logic is used,
|
||||
+ * we will be able to expose NV12_4L4 and NV12 as the other cases,
|
||||
+ * and therefore remove this quirk.
|
||||
+ */
|
||||
+ if (capture && ctx->vpu_src_fmt->fourcc == V4L2_PIX_FMT_HEVC_SLICE) {
|
||||
+ if (f->index == 0) {
|
||||
+ f->pixelformat = V4L2_PIX_FMT_NV12;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
/*
|
||||
* When dealing with an encoder:
|
||||
* - on the capture side we want to filter out all MODE_NONE formats.
|
||||
diff --git a/drivers/staging/media/hantro/imx8m_vpu_hw.c b/drivers/staging/media/hantro/imx8m_vpu_hw.c
|
||||
index 02e61438220a..a40b161e5956 100644
|
||||
--- a/drivers/staging/media/hantro/imx8m_vpu_hw.c
|
||||
+++ b/drivers/staging/media/hantro/imx8m_vpu_hw.c
|
||||
@@ -134,7 +134,7 @@ static const struct hantro_fmt imx8m_vpu_dec_fmts[] = {
|
||||
|
||||
static const struct hantro_fmt imx8m_vpu_g2_dec_fmts[] = {
|
||||
{
|
||||
- .fourcc = V4L2_PIX_FMT_NV12,
|
||||
+ .fourcc = V4L2_PIX_FMT_NV12_4L4,
|
||||
.codec_mode = HANTRO_MODE_NONE,
|
||||
},
|
||||
{
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,138 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
|
||||
Date: Tue, 16 Nov 2021 15:38:38 +0100
|
||||
Subject: [PATCH] media: hantro: Rename registers
|
||||
|
||||
Add more consistency in the way registers are named.
|
||||
|
||||
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
|
||||
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
---
|
||||
.../staging/media/hantro/hantro_g2_hevc_dec.c | 40 +++++++++----------
|
||||
drivers/staging/media/hantro/hantro_g2_regs.h | 28 ++++++-------
|
||||
2 files changed, 34 insertions(+), 34 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/hantro_g2_hevc_dec.c b/drivers/staging/media/hantro/hantro_g2_hevc_dec.c
|
||||
index 76a921163b9a..abae36f9b418 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_g2_hevc_dec.c
|
||||
+++ b/drivers/staging/media/hantro/hantro_g2_hevc_dec.c
|
||||
@@ -448,9 +448,9 @@ static int set_ref(struct hantro_ctx *ctx)
|
||||
if (dpb[i].rps == V4L2_HEVC_DPB_ENTRY_RPS_LT_CURR)
|
||||
dpb_longterm_e |= BIT(V4L2_HEVC_DPB_ENTRIES_NUM_MAX - 1 - i);
|
||||
|
||||
- hantro_write_addr(vpu, G2_REG_ADDR_REF(i), luma_addr);
|
||||
- hantro_write_addr(vpu, G2_REG_CHR_REF(i), chroma_addr);
|
||||
- hantro_write_addr(vpu, G2_REG_DMV_REF(i), mv_addr);
|
||||
+ hantro_write_addr(vpu, G2_REF_LUMA_ADDR(i), luma_addr);
|
||||
+ hantro_write_addr(vpu, G2_REF_CHROMA_ADDR(i), chroma_addr);
|
||||
+ hantro_write_addr(vpu, G2_REF_MV_ADDR(i), mv_addr);
|
||||
}
|
||||
|
||||
luma_addr = hantro_hevc_get_ref_buf(ctx, decode_params->pic_order_cnt_val);
|
||||
@@ -460,20 +460,20 @@ static int set_ref(struct hantro_ctx *ctx)
|
||||
chroma_addr = luma_addr + cr_offset;
|
||||
mv_addr = luma_addr + mv_offset;
|
||||
|
||||
- hantro_write_addr(vpu, G2_REG_ADDR_REF(i), luma_addr);
|
||||
- hantro_write_addr(vpu, G2_REG_CHR_REF(i), chroma_addr);
|
||||
- hantro_write_addr(vpu, G2_REG_DMV_REF(i++), mv_addr);
|
||||
+ hantro_write_addr(vpu, G2_REF_LUMA_ADDR(i), luma_addr);
|
||||
+ hantro_write_addr(vpu, G2_REF_CHROMA_ADDR(i), chroma_addr);
|
||||
+ hantro_write_addr(vpu, G2_REF_MV_ADDR(i++), mv_addr);
|
||||
|
||||
- hantro_write_addr(vpu, G2_ADDR_DST, luma_addr);
|
||||
- hantro_write_addr(vpu, G2_ADDR_DST_CHR, chroma_addr);
|
||||
- hantro_write_addr(vpu, G2_ADDR_DST_MV, mv_addr);
|
||||
+ hantro_write_addr(vpu, G2_OUT_LUMA_ADDR, luma_addr);
|
||||
+ hantro_write_addr(vpu, G2_OUT_CHROMA_ADDR, chroma_addr);
|
||||
+ hantro_write_addr(vpu, G2_OUT_MV_ADDR, mv_addr);
|
||||
|
||||
hantro_hevc_ref_remove_unused(ctx);
|
||||
|
||||
for (; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
|
||||
- hantro_write_addr(vpu, G2_REG_ADDR_REF(i), 0);
|
||||
- hantro_write_addr(vpu, G2_REG_CHR_REF(i), 0);
|
||||
- hantro_write_addr(vpu, G2_REG_DMV_REF(i), 0);
|
||||
+ hantro_write_addr(vpu, G2_REF_LUMA_ADDR(i), 0);
|
||||
+ hantro_write_addr(vpu, G2_REF_CHROMA_ADDR(i), 0);
|
||||
+ hantro_write_addr(vpu, G2_REF_MV_ADDR(i), 0);
|
||||
}
|
||||
|
||||
hantro_reg_write(vpu, &g2_refer_lterm_e, dpb_longterm_e);
|
||||
@@ -499,7 +499,7 @@ static void set_buffers(struct hantro_ctx *ctx)
|
||||
src_len = vb2_get_plane_payload(&src_buf->vb2_buf, 0);
|
||||
src_buf_len = vb2_plane_size(&src_buf->vb2_buf, 0);
|
||||
|
||||
- hantro_write_addr(vpu, G2_ADDR_STR, src_dma);
|
||||
+ hantro_write_addr(vpu, G2_STREAM_ADDR, src_dma);
|
||||
hantro_reg_write(vpu, &g2_stream_len, src_len);
|
||||
hantro_reg_write(vpu, &g2_strm_buffer_len, src_buf_len);
|
||||
hantro_reg_write(vpu, &g2_strm_start_offset, 0);
|
||||
@@ -508,12 +508,12 @@ static void set_buffers(struct hantro_ctx *ctx)
|
||||
/* Destination (decoded frame) buffer. */
|
||||
dst_dma = hantro_get_dec_buf_addr(ctx, &dst_buf->vb2_buf);
|
||||
|
||||
- hantro_write_addr(vpu, G2_RASTER_SCAN, dst_dma);
|
||||
- hantro_write_addr(vpu, G2_RASTER_SCAN_CHR, dst_dma + cr_offset);
|
||||
- hantro_write_addr(vpu, G2_ADDR_TILE_SIZE, ctx->hevc_dec.tile_sizes.dma);
|
||||
- hantro_write_addr(vpu, G2_TILE_FILTER, ctx->hevc_dec.tile_filter.dma);
|
||||
- hantro_write_addr(vpu, G2_TILE_SAO, ctx->hevc_dec.tile_sao.dma);
|
||||
- hantro_write_addr(vpu, G2_TILE_BSD, ctx->hevc_dec.tile_bsd.dma);
|
||||
+ hantro_write_addr(vpu, G2_RS_OUT_LUMA_ADDR, dst_dma);
|
||||
+ hantro_write_addr(vpu, G2_RS_OUT_CHROMA_ADDR, dst_dma + cr_offset);
|
||||
+ hantro_write_addr(vpu, G2_TILE_SIZES_ADDR, ctx->hevc_dec.tile_sizes.dma);
|
||||
+ hantro_write_addr(vpu, G2_TILE_FILTER_ADDR, ctx->hevc_dec.tile_filter.dma);
|
||||
+ hantro_write_addr(vpu, G2_TILE_SAO_ADDR, ctx->hevc_dec.tile_sao.dma);
|
||||
+ hantro_write_addr(vpu, G2_TILE_BSD_ADDR, ctx->hevc_dec.tile_bsd.dma);
|
||||
}
|
||||
|
||||
static void prepare_scaling_list_buffer(struct hantro_ctx *ctx)
|
||||
@@ -563,7 +563,7 @@ static void prepare_scaling_list_buffer(struct hantro_ctx *ctx)
|
||||
for (k = 0; k < 8; k++)
|
||||
*p++ = sc->scaling_list_32x32[i][8 * k + j];
|
||||
|
||||
- hantro_write_addr(vpu, HEVC_SCALING_LIST, ctx->hevc_dec.scaling_lists.dma);
|
||||
+ hantro_write_addr(vpu, G2_HEVC_SCALING_LIST_ADDR, ctx->hevc_dec.scaling_lists.dma);
|
||||
}
|
||||
|
||||
static void hantro_g2_check_idle(struct hantro_dev *vpu)
|
||||
diff --git a/drivers/staging/media/hantro/hantro_g2_regs.h b/drivers/staging/media/hantro/hantro_g2_regs.h
|
||||
index bb22fa921914..24b18f839ff8 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_g2_regs.h
|
||||
+++ b/drivers/staging/media/hantro/hantro_g2_regs.h
|
||||
@@ -177,20 +177,20 @@
|
||||
#define G2_REG_CONFIG_DEC_CLK_GATE_E BIT(16)
|
||||
#define G2_REG_CONFIG_DEC_CLK_GATE_IDLE_E BIT(17)
|
||||
|
||||
-#define G2_ADDR_DST (G2_SWREG(65))
|
||||
-#define G2_REG_ADDR_REF(i) (G2_SWREG(67) + ((i) * 0x8))
|
||||
-#define G2_ADDR_DST_CHR (G2_SWREG(99))
|
||||
-#define G2_REG_CHR_REF(i) (G2_SWREG(101) + ((i) * 0x8))
|
||||
-#define G2_ADDR_DST_MV (G2_SWREG(133))
|
||||
-#define G2_REG_DMV_REF(i) (G2_SWREG(135) + ((i) * 0x8))
|
||||
-#define G2_ADDR_TILE_SIZE (G2_SWREG(167))
|
||||
-#define G2_ADDR_STR (G2_SWREG(169))
|
||||
-#define HEVC_SCALING_LIST (G2_SWREG(171))
|
||||
-#define G2_RASTER_SCAN (G2_SWREG(175))
|
||||
-#define G2_RASTER_SCAN_CHR (G2_SWREG(177))
|
||||
-#define G2_TILE_FILTER (G2_SWREG(179))
|
||||
-#define G2_TILE_SAO (G2_SWREG(181))
|
||||
-#define G2_TILE_BSD (G2_SWREG(183))
|
||||
+#define G2_OUT_LUMA_ADDR (G2_SWREG(65))
|
||||
+#define G2_REF_LUMA_ADDR(i) (G2_SWREG(67) + ((i) * 0x8))
|
||||
+#define G2_OUT_CHROMA_ADDR (G2_SWREG(99))
|
||||
+#define G2_REF_CHROMA_ADDR(i) (G2_SWREG(101) + ((i) * 0x8))
|
||||
+#define G2_OUT_MV_ADDR (G2_SWREG(133))
|
||||
+#define G2_REF_MV_ADDR(i) (G2_SWREG(135) + ((i) * 0x8))
|
||||
+#define G2_TILE_SIZES_ADDR (G2_SWREG(167))
|
||||
+#define G2_STREAM_ADDR (G2_SWREG(169))
|
||||
+#define G2_HEVC_SCALING_LIST_ADDR (G2_SWREG(171))
|
||||
+#define G2_RS_OUT_LUMA_ADDR (G2_SWREG(175))
|
||||
+#define G2_RS_OUT_CHROMA_ADDR (G2_SWREG(177))
|
||||
+#define G2_TILE_FILTER_ADDR (G2_SWREG(179))
|
||||
+#define G2_TILE_SAO_ADDR (G2_SWREG(181))
|
||||
+#define G2_TILE_BSD_ADDR (G2_SWREG(183))
|
||||
|
||||
#define g2_strm_buffer_len G2_DEC_REG(258, 0, 0xffffffff)
|
||||
#define g2_strm_start_offset G2_DEC_REG(259, 0, 0xffffffff)
|
@ -0,0 +1,178 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
|
||||
Date: Tue, 16 Nov 2021 15:38:39 +0100
|
||||
Subject: [PATCH] media: hantro: Prepare for other G2 codecs
|
||||
|
||||
VeriSilicon Hantro G2 core supports other codecs besides hevc.
|
||||
Factor out some common code in preparation for vp9 support.
|
||||
|
||||
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
|
||||
Reviewed-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
---
|
||||
drivers/staging/media/hantro/Makefile | 1 +
|
||||
drivers/staging/media/hantro/hantro.h | 7 +++++
|
||||
drivers/staging/media/hantro/hantro_drv.c | 5 +++
|
||||
drivers/staging/media/hantro/hantro_g2.c | 26 ++++++++++++++++
|
||||
.../staging/media/hantro/hantro_g2_hevc_dec.c | 31 -------------------
|
||||
drivers/staging/media/hantro/hantro_g2_regs.h | 7 +++++
|
||||
drivers/staging/media/hantro/hantro_hw.h | 2 ++
|
||||
7 files changed, 48 insertions(+), 31 deletions(-)
|
||||
create mode 100644 drivers/staging/media/hantro/hantro_g2.c
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/Makefile b/drivers/staging/media/hantro/Makefile
|
||||
index 90036831fec4..fe6d84871d07 100644
|
||||
--- a/drivers/staging/media/hantro/Makefile
|
||||
+++ b/drivers/staging/media/hantro/Makefile
|
||||
@@ -12,6 +12,7 @@ hantro-vpu-y += \
|
||||
hantro_g1_mpeg2_dec.o \
|
||||
hantro_g2_hevc_dec.o \
|
||||
hantro_g1_vp8_dec.o \
|
||||
+ hantro_g2.o \
|
||||
rockchip_vpu2_hw_jpeg_enc.o \
|
||||
rockchip_vpu2_hw_h264_dec.o \
|
||||
rockchip_vpu2_hw_mpeg2_dec.o \
|
||||
diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h
|
||||
index dd5e56765d4e..d91eb2b1c509 100644
|
||||
--- a/drivers/staging/media/hantro/hantro.h
|
||||
+++ b/drivers/staging/media/hantro/hantro.h
|
||||
@@ -369,6 +369,13 @@ static inline void vdpu_write(struct hantro_dev *vpu, u32 val, u32 reg)
|
||||
writel(val, vpu->dec_base + reg);
|
||||
}
|
||||
|
||||
+static inline void hantro_write_addr(struct hantro_dev *vpu,
|
||||
+ unsigned long offset,
|
||||
+ dma_addr_t addr)
|
||||
+{
|
||||
+ vdpu_write(vpu, addr & 0xffffffff, offset);
|
||||
+}
|
||||
+
|
||||
static inline u32 vdpu_read(struct hantro_dev *vpu, u32 reg)
|
||||
{
|
||||
u32 val = readl(vpu->dec_base + reg);
|
||||
diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c
|
||||
index fb82b9297a2b..bb72e5e208b7 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_drv.c
|
||||
+++ b/drivers/staging/media/hantro/hantro_drv.c
|
||||
@@ -907,6 +907,11 @@ static int hantro_probe(struct platform_device *pdev)
|
||||
vpu->enc_base = vpu->reg_bases[0] + vpu->variant->enc_offset;
|
||||
vpu->dec_base = vpu->reg_bases[0] + vpu->variant->dec_offset;
|
||||
|
||||
+ /**
|
||||
+ * TODO: Eventually allow taking advantage of full 64-bit address space.
|
||||
+ * Until then we assume the MSB portion of buffers' base addresses is
|
||||
+ * always 0 due to this masking operation.
|
||||
+ */
|
||||
ret = dma_set_coherent_mask(vpu->dev, DMA_BIT_MASK(32));
|
||||
if (ret) {
|
||||
dev_err(vpu->dev, "Could not set DMA coherent mask.\n");
|
||||
diff --git a/drivers/staging/media/hantro/hantro_g2.c b/drivers/staging/media/hantro/hantro_g2.c
|
||||
new file mode 100644
|
||||
index 000000000000..6f3e1f797f83
|
||||
--- /dev/null
|
||||
+++ b/drivers/staging/media/hantro/hantro_g2.c
|
||||
@@ -0,0 +1,26 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Hantro VPU codec driver
|
||||
+ *
|
||||
+ * Copyright (C) 2021 Collabora Ltd, Andrzej Pietrasiewicz <andrzej.p@collabora.com>
|
||||
+ */
|
||||
+
|
||||
+#include "hantro_hw.h"
|
||||
+#include "hantro_g2_regs.h"
|
||||
+
|
||||
+void hantro_g2_check_idle(struct hantro_dev *vpu)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < 3; i++) {
|
||||
+ u32 status;
|
||||
+
|
||||
+ /* Make sure the VPU is idle */
|
||||
+ status = vdpu_read(vpu, G2_REG_INTERRUPT);
|
||||
+ if (status & G2_REG_INTERRUPT_DEC_E) {
|
||||
+ dev_warn(vpu->dev, "device still running, aborting");
|
||||
+ status |= G2_REG_INTERRUPT_DEC_ABORT_E | G2_REG_INTERRUPT_DEC_IRQ_DIS;
|
||||
+ vdpu_write(vpu, status, G2_REG_INTERRUPT);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/drivers/staging/media/hantro/hantro_g2_hevc_dec.c b/drivers/staging/media/hantro/hantro_g2_hevc_dec.c
|
||||
index abae36f9b418..f62608b0b408 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_g2_hevc_dec.c
|
||||
+++ b/drivers/staging/media/hantro/hantro_g2_hevc_dec.c
|
||||
@@ -8,20 +8,6 @@
|
||||
#include "hantro_hw.h"
|
||||
#include "hantro_g2_regs.h"
|
||||
|
||||
-#define HEVC_DEC_MODE 0xC
|
||||
-
|
||||
-#define BUS_WIDTH_32 0
|
||||
-#define BUS_WIDTH_64 1
|
||||
-#define BUS_WIDTH_128 2
|
||||
-#define BUS_WIDTH_256 3
|
||||
-
|
||||
-static inline void hantro_write_addr(struct hantro_dev *vpu,
|
||||
- unsigned long offset,
|
||||
- dma_addr_t addr)
|
||||
-{
|
||||
- vdpu_write(vpu, addr & 0xffffffff, offset);
|
||||
-}
|
||||
-
|
||||
static void prepare_tile_info_buffer(struct hantro_ctx *ctx)
|
||||
{
|
||||
struct hantro_dev *vpu = ctx->dev;
|
||||
@@ -566,23 +552,6 @@ static void prepare_scaling_list_buffer(struct hantro_ctx *ctx)
|
||||
hantro_write_addr(vpu, G2_HEVC_SCALING_LIST_ADDR, ctx->hevc_dec.scaling_lists.dma);
|
||||
}
|
||||
|
||||
-static void hantro_g2_check_idle(struct hantro_dev *vpu)
|
||||
-{
|
||||
- int i;
|
||||
-
|
||||
- for (i = 0; i < 3; i++) {
|
||||
- u32 status;
|
||||
-
|
||||
- /* Make sure the VPU is idle */
|
||||
- status = vdpu_read(vpu, G2_REG_INTERRUPT);
|
||||
- if (status & G2_REG_INTERRUPT_DEC_E) {
|
||||
- dev_warn(vpu->dev, "device still running, aborting");
|
||||
- status |= G2_REG_INTERRUPT_DEC_ABORT_E | G2_REG_INTERRUPT_DEC_IRQ_DIS;
|
||||
- vdpu_write(vpu, status, G2_REG_INTERRUPT);
|
||||
- }
|
||||
- }
|
||||
-}
|
||||
-
|
||||
int hantro_g2_hevc_dec_run(struct hantro_ctx *ctx)
|
||||
{
|
||||
struct hantro_dev *vpu = ctx->dev;
|
||||
diff --git a/drivers/staging/media/hantro/hantro_g2_regs.h b/drivers/staging/media/hantro/hantro_g2_regs.h
|
||||
index 24b18f839ff8..136ba6d98a1f 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_g2_regs.h
|
||||
+++ b/drivers/staging/media/hantro/hantro_g2_regs.h
|
||||
@@ -27,6 +27,13 @@
|
||||
#define G2_REG_INTERRUPT_DEC_IRQ_DIS BIT(4)
|
||||
#define G2_REG_INTERRUPT_DEC_E BIT(0)
|
||||
|
||||
+#define HEVC_DEC_MODE 0xc
|
||||
+
|
||||
+#define BUS_WIDTH_32 0
|
||||
+#define BUS_WIDTH_64 1
|
||||
+#define BUS_WIDTH_128 2
|
||||
+#define BUS_WIDTH_256 3
|
||||
+
|
||||
#define g2_strm_swap G2_DEC_REG(2, 28, 0xf)
|
||||
#define g2_dirmv_swap G2_DEC_REG(2, 20, 0xf)
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h
|
||||
index 2f85430682d8..1d869abf90b2 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_hw.h
|
||||
+++ b/drivers/staging/media/hantro/hantro_hw.h
|
||||
@@ -312,4 +312,6 @@ void hantro_vp8_dec_exit(struct hantro_ctx *ctx);
|
||||
void hantro_vp8_prob_update(struct hantro_ctx *ctx,
|
||||
const struct v4l2_ctrl_vp8_frame *hdr);
|
||||
|
||||
+void hantro_g2_check_idle(struct hantro_dev *vpu);
|
||||
+
|
||||
#endif /* HANTRO_HW_H_ */
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,27 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
|
||||
Date: Tue, 16 Nov 2021 15:38:41 +0100
|
||||
Subject: [PATCH] media: hantro: Staticize a struct in postprocessor code
|
||||
|
||||
The struct is not used outside this file, so it can be static.
|
||||
|
||||
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
|
||||
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
---
|
||||
drivers/staging/media/hantro/hantro_postproc.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/hantro_postproc.c b/drivers/staging/media/hantro/hantro_postproc.c
|
||||
index 4549aec08feb..89de43021779 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_postproc.c
|
||||
+++ b/drivers/staging/media/hantro/hantro_postproc.c
|
||||
@@ -33,7 +33,7 @@
|
||||
#define VPU_PP_OUT_RGB 0x0
|
||||
#define VPU_PP_OUT_YUYV 0x3
|
||||
|
||||
-const struct hantro_postproc_regs hantro_g1_postproc_regs = {
|
||||
+static const struct hantro_postproc_regs hantro_g1_postproc_regs = {
|
||||
.pipeline_en = {G1_REG_PP_INTERRUPT, 1, 0x1},
|
||||
.max_burst = {G1_REG_PP_DEV_CONFIG, 0, 0x1f},
|
||||
.clk_gate = {G1_REG_PP_DEV_CONFIG, 1, 0x1},
|
@ -0,0 +1,161 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
|
||||
Date: Tue, 16 Nov 2021 15:38:42 +0100
|
||||
Subject: [PATCH] media: hantro: Support NV12 on the G2 core
|
||||
|
||||
The G2 decoder block produces NV12 4x4 tiled format (NV12_4L4).
|
||||
Enable the G2 post-processor block, in order to produce regular NV12.
|
||||
|
||||
The logic in hantro_postproc.c is leveraged to take care of allocating
|
||||
the extra buffers and configure the post-processor, which is
|
||||
significantly simpler than the one on the G1.
|
||||
|
||||
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
|
||||
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
---
|
||||
.../staging/media/hantro/hantro_g2_vp9_dec.c | 6 ++--
|
||||
drivers/staging/media/hantro/hantro_hw.h | 1 +
|
||||
.../staging/media/hantro/hantro_postproc.c | 31 +++++++++++++++++++
|
||||
drivers/staging/media/hantro/imx8m_vpu_hw.c | 11 +++++++
|
||||
4 files changed, 46 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/hantro_g2_vp9_dec.c b/drivers/staging/media/hantro/hantro_g2_vp9_dec.c
|
||||
index fc55b03a8004..e04242d10fa2 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_g2_vp9_dec.c
|
||||
+++ b/drivers/staging/media/hantro/hantro_g2_vp9_dec.c
|
||||
@@ -152,7 +152,7 @@ static void config_output(struct hantro_ctx *ctx,
|
||||
hantro_reg_write(ctx->dev, &g2_out_dis, 0);
|
||||
hantro_reg_write(ctx->dev, &g2_output_format, 0);
|
||||
|
||||
- luma_addr = vb2_dma_contig_plane_dma_addr(&dst->base.vb.vb2_buf, 0);
|
||||
+ luma_addr = hantro_get_dec_buf_addr(ctx, &dst->base.vb.vb2_buf);
|
||||
hantro_write_addr(ctx->dev, G2_OUT_LUMA_ADDR, luma_addr);
|
||||
|
||||
chroma_addr = luma_addr + chroma_offset(ctx, dec_params);
|
||||
@@ -191,7 +191,7 @@ static void config_ref(struct hantro_ctx *ctx,
|
||||
hantro_reg_write(ctx->dev, &ref_reg->hor_scale, (refw << 14) / dst->vp9.width);
|
||||
hantro_reg_write(ctx->dev, &ref_reg->ver_scale, (refh << 14) / dst->vp9.height);
|
||||
|
||||
- luma_addr = vb2_dma_contig_plane_dma_addr(&buf->base.vb.vb2_buf, 0);
|
||||
+ luma_addr = hantro_get_dec_buf_addr(ctx, &buf->base.vb.vb2_buf);
|
||||
hantro_write_addr(ctx->dev, ref_reg->y_base, luma_addr);
|
||||
|
||||
chroma_addr = luma_addr + chroma_offset(ctx, dec_params);
|
||||
@@ -236,7 +236,7 @@ static void config_ref_registers(struct hantro_ctx *ctx,
|
||||
config_ref(ctx, dst, &ref_regs[1], dec_params, dec_params->golden_frame_ts);
|
||||
config_ref(ctx, dst, &ref_regs[2], dec_params, dec_params->alt_frame_ts);
|
||||
|
||||
- mv_addr = vb2_dma_contig_plane_dma_addr(&mv_ref->base.vb.vb2_buf, 0) +
|
||||
+ mv_addr = hantro_get_dec_buf_addr(ctx, &mv_ref->base.vb.vb2_buf) +
|
||||
mv_offset(ctx, dec_params);
|
||||
hantro_write_addr(ctx->dev, G2_REF_MV_ADDR(0), mv_addr);
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h
|
||||
index fe5b51046d33..dbe51303724b 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_hw.h
|
||||
+++ b/drivers/staging/media/hantro/hantro_hw.h
|
||||
@@ -310,6 +310,7 @@ extern const struct hantro_variant rk3399_vpu_variant;
|
||||
extern const struct hantro_variant sama5d4_vdec_variant;
|
||||
|
||||
extern const struct hantro_postproc_ops hantro_g1_postproc_ops;
|
||||
+extern const struct hantro_postproc_ops hantro_g2_postproc_ops;
|
||||
|
||||
extern const u32 hantro_vp8_dec_mc_filter[8][6];
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/hantro_postproc.c b/drivers/staging/media/hantro/hantro_postproc.c
|
||||
index 89de43021779..a7774ad4c445 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_postproc.c
|
||||
+++ b/drivers/staging/media/hantro/hantro_postproc.c
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "hantro.h"
|
||||
#include "hantro_hw.h"
|
||||
#include "hantro_g1_regs.h"
|
||||
+#include "hantro_g2_regs.h"
|
||||
|
||||
#define HANTRO_PP_REG_WRITE(vpu, reg_name, val) \
|
||||
{ \
|
||||
@@ -99,6 +100,21 @@ static void hantro_postproc_g1_enable(struct hantro_ctx *ctx)
|
||||
HANTRO_PP_REG_WRITE(vpu, display_width, ctx->dst_fmt.width);
|
||||
}
|
||||
|
||||
+static void hantro_postproc_g2_enable(struct hantro_ctx *ctx)
|
||||
+{
|
||||
+ struct hantro_dev *vpu = ctx->dev;
|
||||
+ struct vb2_v4l2_buffer *dst_buf;
|
||||
+ size_t chroma_offset = ctx->dst_fmt.width * ctx->dst_fmt.height;
|
||||
+ dma_addr_t dst_dma;
|
||||
+
|
||||
+ dst_buf = hantro_get_dst_buf(ctx);
|
||||
+ dst_dma = vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0);
|
||||
+
|
||||
+ hantro_write_addr(vpu, G2_RS_OUT_LUMA_ADDR, dst_dma);
|
||||
+ hantro_write_addr(vpu, G2_RS_OUT_CHROMA_ADDR, dst_dma + chroma_offset);
|
||||
+ hantro_reg_write(vpu, &g2_out_rs_e, 1);
|
||||
+}
|
||||
+
|
||||
void hantro_postproc_free(struct hantro_ctx *ctx)
|
||||
{
|
||||
struct hantro_dev *vpu = ctx->dev;
|
||||
@@ -127,6 +143,9 @@ int hantro_postproc_alloc(struct hantro_ctx *ctx)
|
||||
if (ctx->vpu_src_fmt->fourcc == V4L2_PIX_FMT_H264_SLICE)
|
||||
buf_size += hantro_h264_mv_size(ctx->dst_fmt.width,
|
||||
ctx->dst_fmt.height);
|
||||
+ else if (ctx->vpu_src_fmt->fourcc == V4L2_PIX_FMT_VP9_FRAME)
|
||||
+ buf_size += hantro_vp9_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];
|
||||
@@ -152,6 +171,13 @@ static void hantro_postproc_g1_disable(struct hantro_ctx *ctx)
|
||||
HANTRO_PP_REG_WRITE_S(vpu, pipeline_en, 0x0);
|
||||
}
|
||||
|
||||
+static void hantro_postproc_g2_disable(struct hantro_ctx *ctx)
|
||||
+{
|
||||
+ struct hantro_dev *vpu = ctx->dev;
|
||||
+
|
||||
+ hantro_reg_write(vpu, &g2_out_rs_e, 0);
|
||||
+}
|
||||
+
|
||||
void hantro_postproc_disable(struct hantro_ctx *ctx)
|
||||
{
|
||||
struct hantro_dev *vpu = ctx->dev;
|
||||
@@ -172,3 +198,8 @@ const struct hantro_postproc_ops hantro_g1_postproc_ops = {
|
||||
.enable = hantro_postproc_g1_enable,
|
||||
.disable = hantro_postproc_g1_disable,
|
||||
};
|
||||
+
|
||||
+const struct hantro_postproc_ops hantro_g2_postproc_ops = {
|
||||
+ .enable = hantro_postproc_g2_enable,
|
||||
+ .disable = hantro_postproc_g2_disable,
|
||||
+};
|
||||
diff --git a/drivers/staging/media/hantro/imx8m_vpu_hw.c b/drivers/staging/media/hantro/imx8m_vpu_hw.c
|
||||
index 455a107ffb02..1a43f6fceef9 100644
|
||||
--- a/drivers/staging/media/hantro/imx8m_vpu_hw.c
|
||||
+++ b/drivers/staging/media/hantro/imx8m_vpu_hw.c
|
||||
@@ -132,6 +132,14 @@ static const struct hantro_fmt imx8m_vpu_dec_fmts[] = {
|
||||
},
|
||||
};
|
||||
|
||||
+static const struct hantro_fmt imx8m_vpu_g2_postproc_fmts[] = {
|
||||
+ {
|
||||
+ .fourcc = V4L2_PIX_FMT_NV12,
|
||||
+ .codec_mode = HANTRO_MODE_NONE,
|
||||
+ .postprocessed = true,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
static const struct hantro_fmt imx8m_vpu_g2_dec_fmts[] = {
|
||||
{
|
||||
.fourcc = V4L2_PIX_FMT_NV12_4L4,
|
||||
@@ -301,6 +309,9 @@ const struct hantro_variant imx8mq_vpu_g2_variant = {
|
||||
.dec_offset = 0x0,
|
||||
.dec_fmts = imx8m_vpu_g2_dec_fmts,
|
||||
.num_dec_fmts = ARRAY_SIZE(imx8m_vpu_g2_dec_fmts),
|
||||
+ .postproc_fmts = imx8m_vpu_g2_postproc_fmts,
|
||||
+ .num_postproc_fmts = ARRAY_SIZE(imx8m_vpu_g2_postproc_fmts),
|
||||
+ .postproc_ops = &hantro_g2_postproc_ops,
|
||||
.codec = HANTRO_HEVC_DECODER | HANTRO_VP9_DECODER,
|
||||
.codec_ops = imx8mq_vpu_g2_codec_ops,
|
||||
.init = imx8mq_vpu_hw_init,
|
@ -0,0 +1,39 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
Date: Mon, 29 Nov 2021 18:31:35 +0100
|
||||
Subject: [PATCH] media: hantro: Fix probe func error path
|
||||
|
||||
If clocks for some reason couldn't be enabled, probe function returns
|
||||
immediately, without disabling PM. This obviously leaves PM ref counters
|
||||
unbalanced.
|
||||
|
||||
Fix that by jumping to appropriate error path, so effects of PM functions
|
||||
are reversed.
|
||||
|
||||
Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver")
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
---
|
||||
drivers/staging/media/hantro/hantro_drv.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c
|
||||
index ab2467998d29..3d3107a39dae 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_drv.c
|
||||
+++ b/drivers/staging/media/hantro/hantro_drv.c
|
||||
@@ -981,7 +981,7 @@ static int hantro_probe(struct platform_device *pdev)
|
||||
ret = clk_bulk_prepare(vpu->variant->num_clocks, vpu->clocks);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Failed to prepare clocks\n");
|
||||
- return ret;
|
||||
+ goto err_pm_disable;
|
||||
}
|
||||
|
||||
ret = v4l2_device_register(&pdev->dev, &vpu->v4l2_dev);
|
||||
@@ -1037,6 +1037,7 @@ static int hantro_probe(struct platform_device *pdev)
|
||||
v4l2_device_unregister(&vpu->v4l2_dev);
|
||||
err_clk_unprepare:
|
||||
clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
|
||||
+err_pm_disable:
|
||||
pm_runtime_dont_use_autosuspend(vpu->dev);
|
||||
pm_runtime_disable(vpu->dev);
|
||||
return ret;
|
@ -0,0 +1,92 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
Date: Sat, 7 Aug 2021 17:29:11 +0200
|
||||
Subject: [PATCH] media: hantro: add support for reset lines
|
||||
|
||||
Some SoCs like Allwinner H6 use reset lines for resetting Hantro G2. Add
|
||||
support for them.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
---
|
||||
drivers/staging/media/hantro/hantro.h | 3 +++
|
||||
drivers/staging/media/hantro/hantro_drv.c | 15 ++++++++++++++-
|
||||
2 files changed, 17 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h
|
||||
index 7da23f7f207a..33eb3e092cc1 100644
|
||||
--- a/drivers/staging/media/hantro/hantro.h
|
||||
+++ b/drivers/staging/media/hantro/hantro.h
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <linux/videodev2.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/clk.h>
|
||||
+#include <linux/reset.h>
|
||||
|
||||
#include <media/v4l2-ctrls.h>
|
||||
#include <media/v4l2-device.h>
|
||||
@@ -171,6 +172,7 @@ hantro_vdev_to_func(struct video_device *vdev)
|
||||
* @dev: Pointer to device for convenient logging using
|
||||
* dev_ macros.
|
||||
* @clocks: Array of clock handles.
|
||||
+ * @resets: Array of reset handles.
|
||||
* @reg_bases: Mapped addresses of VPU registers.
|
||||
* @enc_base: Mapped address of VPU encoder register for convenience.
|
||||
* @dec_base: Mapped address of VPU decoder register for convenience.
|
||||
@@ -190,6 +192,7 @@ struct hantro_dev {
|
||||
struct platform_device *pdev;
|
||||
struct device *dev;
|
||||
struct clk_bulk_data *clocks;
|
||||
+ struct reset_control *resets;
|
||||
void __iomem **reg_bases;
|
||||
void __iomem *enc_base;
|
||||
void __iomem *dec_base;
|
||||
diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c
|
||||
index 3d3107a39dae..770f4ce71d29 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_drv.c
|
||||
+++ b/drivers/staging/media/hantro/hantro_drv.c
|
||||
@@ -905,6 +905,10 @@ static int hantro_probe(struct platform_device *pdev)
|
||||
return PTR_ERR(vpu->clocks[0].clk);
|
||||
}
|
||||
|
||||
+ vpu->resets = devm_reset_control_array_get(&pdev->dev, false, true);
|
||||
+ if (IS_ERR(vpu->resets))
|
||||
+ return PTR_ERR(vpu->resets);
|
||||
+
|
||||
num_bases = vpu->variant->num_regs ?: 1;
|
||||
vpu->reg_bases = devm_kcalloc(&pdev->dev, num_bases,
|
||||
sizeof(*vpu->reg_bases), GFP_KERNEL);
|
||||
@@ -978,10 +982,16 @@ static int hantro_probe(struct platform_device *pdev)
|
||||
pm_runtime_use_autosuspend(vpu->dev);
|
||||
pm_runtime_enable(vpu->dev);
|
||||
|
||||
+ ret = reset_control_deassert(vpu->resets);
|
||||
+ if (ret) {
|
||||
+ dev_err(&pdev->dev, "Failed to deassert resets\n");
|
||||
+ goto err_pm_disable;
|
||||
+ }
|
||||
+
|
||||
ret = clk_bulk_prepare(vpu->variant->num_clocks, vpu->clocks);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Failed to prepare clocks\n");
|
||||
- goto err_pm_disable;
|
||||
+ goto err_rst_assert;
|
||||
}
|
||||
|
||||
ret = v4l2_device_register(&pdev->dev, &vpu->v4l2_dev);
|
||||
@@ -1037,6 +1047,8 @@ static int hantro_probe(struct platform_device *pdev)
|
||||
v4l2_device_unregister(&vpu->v4l2_dev);
|
||||
err_clk_unprepare:
|
||||
clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
|
||||
+err_rst_assert:
|
||||
+ reset_control_assert(vpu->resets);
|
||||
err_pm_disable:
|
||||
pm_runtime_dont_use_autosuspend(vpu->dev);
|
||||
pm_runtime_disable(vpu->dev);
|
||||
@@ -1056,6 +1068,7 @@ static int hantro_remove(struct platform_device *pdev)
|
||||
v4l2_m2m_release(vpu->m2m_dev);
|
||||
v4l2_device_unregister(&vpu->v4l2_dev);
|
||||
clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
|
||||
+ reset_control_assert(vpu->resets);
|
||||
pm_runtime_dont_use_autosuspend(vpu->dev);
|
||||
pm_runtime_disable(vpu->dev);
|
||||
return 0;
|
@ -0,0 +1,63 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
Date: Sun, 21 Nov 2021 20:39:11 +0100
|
||||
Subject: [PATCH] media: hantro: vp9: use double buffering if needed
|
||||
|
||||
Some G2 variants need double buffering to be enabled in order to work
|
||||
correctly, like that found in Allwinner H6 SoC.
|
||||
|
||||
Add platform quirk for that.
|
||||
|
||||
Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
---
|
||||
drivers/staging/media/hantro/hantro.h | 2 ++
|
||||
drivers/staging/media/hantro/hantro_g2_regs.h | 1 +
|
||||
drivers/staging/media/hantro/hantro_g2_vp9_dec.c | 2 ++
|
||||
3 files changed, 5 insertions(+)
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h
|
||||
index 33eb3e092cc1..d03824fa3222 100644
|
||||
--- a/drivers/staging/media/hantro/hantro.h
|
||||
+++ b/drivers/staging/media/hantro/hantro.h
|
||||
@@ -73,6 +73,7 @@ struct hantro_irq {
|
||||
* @num_clocks: number of clocks in the array
|
||||
* @reg_names: array of register range names
|
||||
* @num_regs: number of register range names in the array
|
||||
+ * @double_buffer: core needs double buffering
|
||||
*/
|
||||
struct hantro_variant {
|
||||
unsigned int enc_offset;
|
||||
@@ -94,6 +95,7 @@ struct hantro_variant {
|
||||
int num_clocks;
|
||||
const char * const *reg_names;
|
||||
int num_regs;
|
||||
+ unsigned int double_buffer : 1;
|
||||
};
|
||||
|
||||
/**
|
||||
diff --git a/drivers/staging/media/hantro/hantro_g2_regs.h b/drivers/staging/media/hantro/hantro_g2_regs.h
|
||||
index 9c857dd1ad9b..15a391a4650e 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_g2_regs.h
|
||||
+++ b/drivers/staging/media/hantro/hantro_g2_regs.h
|
||||
@@ -270,6 +270,7 @@
|
||||
#define g2_apf_threshold G2_DEC_REG(55, 0, 0xffff)
|
||||
|
||||
#define g2_clk_gate_e G2_DEC_REG(58, 16, 0x1)
|
||||
+#define g2_double_buffer_e G2_DEC_REG(58, 15, 0x1)
|
||||
#define g2_buswidth G2_DEC_REG(58, 8, 0x7)
|
||||
#define g2_max_burst G2_DEC_REG(58, 0, 0xff)
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/hantro_g2_vp9_dec.c b/drivers/staging/media/hantro/hantro_g2_vp9_dec.c
|
||||
index e04242d10fa2..d4fc649a4da1 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_g2_vp9_dec.c
|
||||
+++ b/drivers/staging/media/hantro/hantro_g2_vp9_dec.c
|
||||
@@ -847,6 +847,8 @@ config_registers(struct hantro_ctx *ctx, const struct v4l2_ctrl_vp9_frame *dec_p
|
||||
hantro_reg_write(ctx->dev, &g2_clk_gate_e, 1);
|
||||
hantro_reg_write(ctx->dev, &g2_max_cb_size, 6);
|
||||
hantro_reg_write(ctx->dev, &g2_min_cb_size, 3);
|
||||
+ if (ctx->dev->variant->double_buffer)
|
||||
+ hantro_reg_write(ctx->dev, &g2_double_buffer_e, 1);
|
||||
|
||||
config_output(ctx, dst, dec_params);
|
||||
|
@ -0,0 +1,242 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
Date: Sun, 26 Sep 2021 19:47:03 +0200
|
||||
Subject: [PATCH] media: hantro: vp9: add support for legacy register set
|
||||
|
||||
Some older G2 cores uses slightly different register set for HEVC and
|
||||
VP9. Since vast majority of registers and logic is the same, it doesn't
|
||||
make sense to introduce another drivers.
|
||||
|
||||
Add legacy_regs quirk and implement only VP9 changes for now. HEVC
|
||||
changes will be introduced later, if needed.
|
||||
|
||||
Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
---
|
||||
drivers/staging/media/hantro/hantro.h | 2 +
|
||||
drivers/staging/media/hantro/hantro_g2_regs.h | 16 ++++
|
||||
.../staging/media/hantro/hantro_g2_vp9_dec.c | 74 ++++++++++++++-----
|
||||
3 files changed, 75 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h
|
||||
index d03824fa3222..83ed25d9657b 100644
|
||||
--- a/drivers/staging/media/hantro/hantro.h
|
||||
+++ b/drivers/staging/media/hantro/hantro.h
|
||||
@@ -74,6 +74,7 @@ struct hantro_irq {
|
||||
* @reg_names: array of register range names
|
||||
* @num_regs: number of register range names in the array
|
||||
* @double_buffer: core needs double buffering
|
||||
+ * @legacy_regs: core uses legacy register set
|
||||
*/
|
||||
struct hantro_variant {
|
||||
unsigned int enc_offset;
|
||||
@@ -96,6 +97,7 @@ struct hantro_variant {
|
||||
const char * const *reg_names;
|
||||
int num_regs;
|
||||
unsigned int double_buffer : 1;
|
||||
+ unsigned int legacy_regs : 1;
|
||||
};
|
||||
|
||||
/**
|
||||
diff --git a/drivers/staging/media/hantro/hantro_g2_regs.h b/drivers/staging/media/hantro/hantro_g2_regs.h
|
||||
index 15a391a4650e..b7c6f9877b9d 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_g2_regs.h
|
||||
+++ b/drivers/staging/media/hantro/hantro_g2_regs.h
|
||||
@@ -36,7 +36,13 @@
|
||||
#define BUS_WIDTH_256 3
|
||||
|
||||
#define g2_strm_swap G2_DEC_REG(2, 28, 0xf)
|
||||
+#define g2_strm_swap_old G2_DEC_REG(2, 27, 0x1f)
|
||||
+#define g2_pic_swap G2_DEC_REG(2, 22, 0x1f)
|
||||
#define g2_dirmv_swap G2_DEC_REG(2, 20, 0xf)
|
||||
+#define g2_dirmv_swap_old G2_DEC_REG(2, 17, 0x1f)
|
||||
+#define g2_tab0_swap_old G2_DEC_REG(2, 12, 0x1f)
|
||||
+#define g2_tab1_swap_old G2_DEC_REG(2, 7, 0x1f)
|
||||
+#define g2_tab2_swap_old G2_DEC_REG(2, 2, 0x1f)
|
||||
|
||||
#define g2_mode G2_DEC_REG(3, 27, 0x1f)
|
||||
#define g2_compress_swap G2_DEC_REG(3, 20, 0xf)
|
||||
@@ -45,6 +51,8 @@
|
||||
#define g2_out_dis G2_DEC_REG(3, 15, 0x1)
|
||||
#define g2_out_filtering_dis G2_DEC_REG(3, 14, 0x1)
|
||||
#define g2_write_mvs_e G2_DEC_REG(3, 12, 0x1)
|
||||
+#define g2_tab3_swap_old G2_DEC_REG(3, 7, 0x1f)
|
||||
+#define g2_rscan_swap G2_DEC_REG(3, 2, 0x1f)
|
||||
|
||||
#define g2_pic_width_in_cbs G2_DEC_REG(4, 19, 0x1fff)
|
||||
#define g2_pic_height_in_cbs G2_DEC_REG(4, 6, 0x1fff)
|
||||
@@ -58,6 +66,7 @@
|
||||
#define g2_tempor_mvp_e G2_DEC_REG(5, 11, 0x1)
|
||||
#define g2_max_cu_qpd_depth G2_DEC_REG(5, 5, 0x3f)
|
||||
#define g2_cu_qpd_e G2_DEC_REG(5, 4, 0x1)
|
||||
+#define g2_pix_shift G2_DEC_REG(5, 0, 0xf)
|
||||
|
||||
#define g2_stream_len G2_DEC_REG(6, 0, 0xffffffff)
|
||||
|
||||
@@ -80,21 +89,28 @@
|
||||
|
||||
#define g2_const_intra_e G2_DEC_REG(8, 31, 0x1)
|
||||
#define g2_filt_ctrl_pres G2_DEC_REG(8, 30, 0x1)
|
||||
+#define g2_bit_depth_y G2_DEC_REG(8, 21, 0xf)
|
||||
+#define g2_bit_depth_c G2_DEC_REG(8, 17, 0xf)
|
||||
#define g2_idr_pic_e G2_DEC_REG(8, 16, 0x1)
|
||||
#define g2_bit_depth_pcm_y G2_DEC_REG(8, 12, 0xf)
|
||||
#define g2_bit_depth_pcm_c G2_DEC_REG(8, 8, 0xf)
|
||||
#define g2_bit_depth_y_minus8 G2_DEC_REG(8, 6, 0x3)
|
||||
#define g2_bit_depth_c_minus8 G2_DEC_REG(8, 4, 0x3)
|
||||
+#define g2_rs_out_bit_depth G2_DEC_REG(8, 4, 0xf)
|
||||
#define g2_output_8_bits G2_DEC_REG(8, 3, 0x1)
|
||||
#define g2_output_format G2_DEC_REG(8, 0, 0x7)
|
||||
+#define g2_pp_pix_shift G2_DEC_REG(8, 0, 0xf)
|
||||
|
||||
#define g2_refidx1_active G2_DEC_REG(9, 19, 0x1f)
|
||||
#define g2_refidx0_active G2_DEC_REG(9, 14, 0x1f)
|
||||
#define g2_hdr_skip_length G2_DEC_REG(9, 0, 0x3fff)
|
||||
|
||||
#define g2_start_code_e G2_DEC_REG(10, 31, 0x1)
|
||||
+#define g2_init_qp_old G2_DEC_REG(10, 25, 0x3f)
|
||||
#define g2_init_qp G2_DEC_REG(10, 24, 0x3f)
|
||||
+#define g2_num_tile_cols_old G2_DEC_REG(10, 20, 0x1f)
|
||||
#define g2_num_tile_cols G2_DEC_REG(10, 19, 0x1f)
|
||||
+#define g2_num_tile_rows_old G2_DEC_REG(10, 15, 0x1f)
|
||||
#define g2_num_tile_rows G2_DEC_REG(10, 14, 0x1f)
|
||||
#define g2_tile_e G2_DEC_REG(10, 1, 0x1)
|
||||
#define g2_entropy_sync_e G2_DEC_REG(10, 0, 0x1)
|
||||
diff --git a/drivers/staging/media/hantro/hantro_g2_vp9_dec.c b/drivers/staging/media/hantro/hantro_g2_vp9_dec.c
|
||||
index d4fc649a4da1..91c21b634fab 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_g2_vp9_dec.c
|
||||
+++ b/drivers/staging/media/hantro/hantro_g2_vp9_dec.c
|
||||
@@ -150,7 +150,8 @@ static void config_output(struct hantro_ctx *ctx,
|
||||
dma_addr_t luma_addr, chroma_addr, mv_addr;
|
||||
|
||||
hantro_reg_write(ctx->dev, &g2_out_dis, 0);
|
||||
- hantro_reg_write(ctx->dev, &g2_output_format, 0);
|
||||
+ if (!ctx->dev->variant->legacy_regs)
|
||||
+ hantro_reg_write(ctx->dev, &g2_output_format, 0);
|
||||
|
||||
luma_addr = hantro_get_dec_buf_addr(ctx, &dst->base.vb.vb2_buf);
|
||||
hantro_write_addr(ctx->dev, G2_OUT_LUMA_ADDR, luma_addr);
|
||||
@@ -327,6 +328,7 @@ config_tiles(struct hantro_ctx *ctx,
|
||||
struct hantro_aux_buf *tile_edge = &vp9_ctx->tile_edge;
|
||||
dma_addr_t addr;
|
||||
unsigned short *tile_mem;
|
||||
+ unsigned int rows, cols;
|
||||
|
||||
addr = misc->dma + vp9_ctx->tile_info_offset;
|
||||
hantro_write_addr(ctx->dev, G2_TILE_SIZES_ADDR, addr);
|
||||
@@ -344,17 +346,24 @@ config_tiles(struct hantro_ctx *ctx,
|
||||
|
||||
fill_tile_info(ctx, tile_r, tile_c, sbs_r, sbs_c, tile_mem);
|
||||
|
||||
+ cols = tile_c;
|
||||
+ rows = tile_r;
|
||||
hantro_reg_write(ctx->dev, &g2_tile_e, 1);
|
||||
- hantro_reg_write(ctx->dev, &g2_num_tile_cols, tile_c);
|
||||
- hantro_reg_write(ctx->dev, &g2_num_tile_rows, tile_r);
|
||||
-
|
||||
} else {
|
||||
tile_mem[0] = hantro_vp9_num_sbs(dst->vp9.width);
|
||||
tile_mem[1] = hantro_vp9_num_sbs(dst->vp9.height);
|
||||
|
||||
+ cols = 1;
|
||||
+ rows = 1;
|
||||
hantro_reg_write(ctx->dev, &g2_tile_e, 0);
|
||||
- hantro_reg_write(ctx->dev, &g2_num_tile_cols, 1);
|
||||
- hantro_reg_write(ctx->dev, &g2_num_tile_rows, 1);
|
||||
+ }
|
||||
+
|
||||
+ if (ctx->dev->variant->legacy_regs) {
|
||||
+ hantro_reg_write(ctx->dev, &g2_num_tile_cols_old, cols);
|
||||
+ hantro_reg_write(ctx->dev, &g2_num_tile_rows_old, rows);
|
||||
+ } else {
|
||||
+ hantro_reg_write(ctx->dev, &g2_num_tile_cols, cols);
|
||||
+ hantro_reg_write(ctx->dev, &g2_num_tile_rows, rows);
|
||||
}
|
||||
|
||||
/* provide aux buffers even if no tiles are used */
|
||||
@@ -505,8 +514,22 @@ static void config_picture_dimensions(struct hantro_ctx *ctx, struct hantro_deco
|
||||
static void
|
||||
config_bit_depth(struct hantro_ctx *ctx, const struct v4l2_ctrl_vp9_frame *dec_params)
|
||||
{
|
||||
- hantro_reg_write(ctx->dev, &g2_bit_depth_y_minus8, dec_params->bit_depth - 8);
|
||||
- hantro_reg_write(ctx->dev, &g2_bit_depth_c_minus8, dec_params->bit_depth - 8);
|
||||
+ if (ctx->dev->variant->legacy_regs) {
|
||||
+ u8 pp_shift = 0;
|
||||
+
|
||||
+ hantro_reg_write(ctx->dev, &g2_bit_depth_y, dec_params->bit_depth);
|
||||
+ hantro_reg_write(ctx->dev, &g2_bit_depth_c, dec_params->bit_depth);
|
||||
+ hantro_reg_write(ctx->dev, &g2_rs_out_bit_depth, dec_params->bit_depth);
|
||||
+
|
||||
+ if (dec_params->bit_depth > 8)
|
||||
+ pp_shift = 16 - dec_params->bit_depth;
|
||||
+
|
||||
+ hantro_reg_write(ctx->dev, &g2_pp_pix_shift, pp_shift);
|
||||
+ hantro_reg_write(ctx->dev, &g2_pix_shift, 0);
|
||||
+ } else {
|
||||
+ hantro_reg_write(ctx->dev, &g2_bit_depth_y_minus8, dec_params->bit_depth - 8);
|
||||
+ hantro_reg_write(ctx->dev, &g2_bit_depth_c_minus8, dec_params->bit_depth - 8);
|
||||
+ }
|
||||
}
|
||||
|
||||
static inline bool is_lossless(const struct v4l2_vp9_quantization *quant)
|
||||
@@ -784,9 +807,13 @@ config_source(struct hantro_ctx *ctx, const struct v4l2_ctrl_vp9_frame *dec_para
|
||||
+ dec_params->compressed_header_size;
|
||||
|
||||
stream_base = vb2_dma_contig_plane_dma_addr(&vb2_src->vb2_buf, 0);
|
||||
- hantro_write_addr(ctx->dev, G2_STREAM_ADDR, stream_base);
|
||||
|
||||
tmp_addr = stream_base + headres_size;
|
||||
+ if (ctx->dev->variant->legacy_regs)
|
||||
+ hantro_write_addr(ctx->dev, G2_STREAM_ADDR, (tmp_addr & ~0xf));
|
||||
+ else
|
||||
+ hantro_write_addr(ctx->dev, G2_STREAM_ADDR, stream_base);
|
||||
+
|
||||
start_bit = (tmp_addr & 0xf) * 8;
|
||||
hantro_reg_write(ctx->dev, &g2_start_bit, start_bit);
|
||||
|
||||
@@ -794,10 +821,12 @@ config_source(struct hantro_ctx *ctx, const struct v4l2_ctrl_vp9_frame *dec_para
|
||||
src_len += start_bit / 8 - headres_size;
|
||||
hantro_reg_write(ctx->dev, &g2_stream_len, src_len);
|
||||
|
||||
- tmp_addr &= ~0xf;
|
||||
- hantro_reg_write(ctx->dev, &g2_strm_start_offset, tmp_addr - stream_base);
|
||||
- src_buf_len = vb2_plane_size(&vb2_src->vb2_buf, 0);
|
||||
- hantro_reg_write(ctx->dev, &g2_strm_buffer_len, src_buf_len);
|
||||
+ if (!ctx->dev->variant->legacy_regs) {
|
||||
+ tmp_addr &= ~0xf;
|
||||
+ hantro_reg_write(ctx->dev, &g2_strm_start_offset, tmp_addr - stream_base);
|
||||
+ src_buf_len = vb2_plane_size(&vb2_src->vb2_buf, 0);
|
||||
+ hantro_reg_write(ctx->dev, &g2_strm_buffer_len, src_buf_len);
|
||||
+ }
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -837,13 +866,24 @@ config_registers(struct hantro_ctx *ctx, const struct v4l2_ctrl_vp9_frame *dec_p
|
||||
|
||||
/* configure basic registers */
|
||||
hantro_reg_write(ctx->dev, &g2_mode, VP9_DEC_MODE);
|
||||
- hantro_reg_write(ctx->dev, &g2_strm_swap, 0xf);
|
||||
- hantro_reg_write(ctx->dev, &g2_dirmv_swap, 0xf);
|
||||
- hantro_reg_write(ctx->dev, &g2_compress_swap, 0xf);
|
||||
+ if (!ctx->dev->variant->legacy_regs) {
|
||||
+ hantro_reg_write(ctx->dev, &g2_strm_swap, 0xf);
|
||||
+ hantro_reg_write(ctx->dev, &g2_dirmv_swap, 0xf);
|
||||
+ hantro_reg_write(ctx->dev, &g2_compress_swap, 0xf);
|
||||
+ hantro_reg_write(ctx->dev, &g2_ref_compress_bypass, 1);
|
||||
+ } else {
|
||||
+ hantro_reg_write(ctx->dev, &g2_strm_swap_old, 0x1f);
|
||||
+ hantro_reg_write(ctx->dev, &g2_pic_swap, 0x10);
|
||||
+ hantro_reg_write(ctx->dev, &g2_dirmv_swap_old, 0x10);
|
||||
+ hantro_reg_write(ctx->dev, &g2_tab0_swap_old, 0x10);
|
||||
+ hantro_reg_write(ctx->dev, &g2_tab1_swap_old, 0x10);
|
||||
+ hantro_reg_write(ctx->dev, &g2_tab2_swap_old, 0x10);
|
||||
+ hantro_reg_write(ctx->dev, &g2_tab3_swap_old, 0x10);
|
||||
+ hantro_reg_write(ctx->dev, &g2_rscan_swap, 0x10);
|
||||
+ }
|
||||
hantro_reg_write(ctx->dev, &g2_buswidth, BUS_WIDTH_128);
|
||||
hantro_reg_write(ctx->dev, &g2_max_burst, 16);
|
||||
hantro_reg_write(ctx->dev, &g2_apf_threshold, 8);
|
||||
- hantro_reg_write(ctx->dev, &g2_ref_compress_bypass, 1);
|
||||
hantro_reg_write(ctx->dev, &g2_clk_gate_e, 1);
|
||||
hantro_reg_write(ctx->dev, &g2_max_cb_size, 6);
|
||||
hantro_reg_write(ctx->dev, &g2_min_cb_size, 3);
|
@ -0,0 +1,62 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
Date: Mon, 22 Nov 2021 18:33:14 +0100
|
||||
Subject: [PATCH] media: hantro: move postproc enablement for old cores
|
||||
|
||||
Older G2 cores, like that in Allwinner H6, seem to have issue with
|
||||
latching postproc register values if this is first thing done in job.
|
||||
Moving that to the end solves the issue.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
---
|
||||
drivers/staging/media/hantro/hantro.h | 2 ++
|
||||
drivers/staging/media/hantro/hantro_drv.c | 9 ++++++++-
|
||||
2 files changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h
|
||||
index 83ed25d9657b..06d0f3597694 100644
|
||||
--- a/drivers/staging/media/hantro/hantro.h
|
||||
+++ b/drivers/staging/media/hantro/hantro.h
|
||||
@@ -75,6 +75,7 @@ struct hantro_irq {
|
||||
* @num_regs: number of register range names in the array
|
||||
* @double_buffer: core needs double buffering
|
||||
* @legacy_regs: core uses legacy register set
|
||||
+ * @late_postproc: postproc must be set up at the end of the job
|
||||
*/
|
||||
struct hantro_variant {
|
||||
unsigned int enc_offset;
|
||||
@@ -98,6 +99,7 @@ struct hantro_variant {
|
||||
int num_regs;
|
||||
unsigned int double_buffer : 1;
|
||||
unsigned int legacy_regs : 1;
|
||||
+ unsigned int late_postproc : 1;
|
||||
};
|
||||
|
||||
/**
|
||||
diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c
|
||||
index 770f4ce71d29..33bf78be145b 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_drv.c
|
||||
+++ b/drivers/staging/media/hantro/hantro_drv.c
|
||||
@@ -130,7 +130,7 @@ void hantro_start_prepare_run(struct hantro_ctx *ctx)
|
||||
v4l2_ctrl_request_setup(src_buf->vb2_buf.req_obj.req,
|
||||
&ctx->ctrl_handler);
|
||||
|
||||
- if (!ctx->is_encoder) {
|
||||
+ if (!ctx->is_encoder && !ctx->dev->variant->late_postproc) {
|
||||
if (hantro_needs_postproc(ctx, ctx->vpu_dst_fmt))
|
||||
hantro_postproc_enable(ctx);
|
||||
else
|
||||
@@ -142,6 +142,13 @@ void hantro_end_prepare_run(struct hantro_ctx *ctx)
|
||||
{
|
||||
struct vb2_v4l2_buffer *src_buf;
|
||||
|
||||
+ if (!ctx->is_encoder && ctx->dev->variant->late_postproc) {
|
||||
+ if (hantro_needs_postproc(ctx, ctx->vpu_dst_fmt))
|
||||
+ hantro_postproc_enable(ctx);
|
||||
+ else
|
||||
+ hantro_postproc_disable(ctx);
|
||||
+ }
|
||||
+
|
||||
src_buf = hantro_get_src_buf(ctx);
|
||||
v4l2_ctrl_request_complete(src_buf->vb2_buf.req_obj.req,
|
||||
&ctx->ctrl_handler);
|
@ -0,0 +1,92 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
Date: Mon, 29 Nov 2021 19:02:17 +0100
|
||||
Subject: [PATCH] media: hantro: Convert imx8m_vpu_g2_irq to helper
|
||||
|
||||
It turns out that imx8m_vpu_g2_irq() doesn't depend on any platform
|
||||
specifics and can be used with other G2 platform drivers too.
|
||||
|
||||
Move it to common code.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
---
|
||||
drivers/staging/media/hantro/hantro_g2.c | 18 ++++++++++++++++++
|
||||
drivers/staging/media/hantro/hantro_hw.h | 1 +
|
||||
drivers/staging/media/hantro/imx8m_vpu_hw.c | 20 +-------------------
|
||||
3 files changed, 20 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/hantro/hantro_g2.c b/drivers/staging/media/hantro/hantro_g2.c
|
||||
index 6f3e1f797f83..ee5f14c5f8f2 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_g2.c
|
||||
+++ b/drivers/staging/media/hantro/hantro_g2.c
|
||||
@@ -24,3 +24,21 @@ void hantro_g2_check_idle(struct hantro_dev *vpu)
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+irqreturn_t hantro_g2_irq(int irq, void *dev_id)
|
||||
+{
|
||||
+ struct hantro_dev *vpu = dev_id;
|
||||
+ enum vb2_buffer_state state;
|
||||
+ u32 status;
|
||||
+
|
||||
+ status = vdpu_read(vpu, G2_REG_INTERRUPT);
|
||||
+ state = (status & G2_REG_INTERRUPT_DEC_RDY_INT) ?
|
||||
+ VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR;
|
||||
+
|
||||
+ vdpu_write(vpu, 0, G2_REG_INTERRUPT);
|
||||
+ vdpu_write(vpu, G2_REG_CONFIG_DEC_CLK_GATE_E, G2_REG_CONFIG);
|
||||
+
|
||||
+ hantro_irq_done(vpu, state);
|
||||
+
|
||||
+ return IRQ_HANDLED;
|
||||
+}
|
||||
diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h
|
||||
index dbe51303724b..c33b1f5df37b 100644
|
||||
--- a/drivers/staging/media/hantro/hantro_hw.h
|
||||
+++ b/drivers/staging/media/hantro/hantro_hw.h
|
||||
@@ -413,5 +413,6 @@ void hantro_g2_vp9_dec_done(struct hantro_ctx *ctx);
|
||||
int hantro_vp9_dec_init(struct hantro_ctx *ctx);
|
||||
void hantro_vp9_dec_exit(struct hantro_ctx *ctx);
|
||||
void hantro_g2_check_idle(struct hantro_dev *vpu);
|
||||
+irqreturn_t hantro_g2_irq(int irq, void *dev_id);
|
||||
|
||||
#endif /* HANTRO_HW_H_ */
|
||||
diff --git a/drivers/staging/media/hantro/imx8m_vpu_hw.c b/drivers/staging/media/hantro/imx8m_vpu_hw.c
|
||||
index 1a43f6fceef9..f5991b8e553a 100644
|
||||
--- a/drivers/staging/media/hantro/imx8m_vpu_hw.c
|
||||
+++ b/drivers/staging/media/hantro/imx8m_vpu_hw.c
|
||||
@@ -191,24 +191,6 @@ static irqreturn_t imx8m_vpu_g1_irq(int irq, void *dev_id)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
-static irqreturn_t imx8m_vpu_g2_irq(int irq, void *dev_id)
|
||||
-{
|
||||
- struct hantro_dev *vpu = dev_id;
|
||||
- enum vb2_buffer_state state;
|
||||
- u32 status;
|
||||
-
|
||||
- status = vdpu_read(vpu, G2_REG_INTERRUPT);
|
||||
- state = (status & G2_REG_INTERRUPT_DEC_RDY_INT) ?
|
||||
- VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR;
|
||||
-
|
||||
- vdpu_write(vpu, 0, G2_REG_INTERRUPT);
|
||||
- vdpu_write(vpu, G2_REG_CONFIG_DEC_CLK_GATE_E, G2_REG_CONFIG);
|
||||
-
|
||||
- hantro_irq_done(vpu, state);
|
||||
-
|
||||
- return IRQ_HANDLED;
|
||||
-}
|
||||
-
|
||||
static int imx8mq_vpu_hw_init(struct hantro_dev *vpu)
|
||||
{
|
||||
vpu->ctrl_base = vpu->reg_bases[vpu->variant->num_regs - 1];
|
||||
@@ -280,7 +262,7 @@ static const struct hantro_irq imx8mq_irqs[] = {
|
||||
};
|
||||
|
||||
static const struct hantro_irq imx8mq_g2_irqs[] = {
|
||||
- { "g2", imx8m_vpu_g2_irq },
|
||||
+ { "g2", hantro_g2_irq },
|
||||
};
|
||||
|
||||
static const char * const imx8mq_clk_names[] = { "g1", "g2", "bus" };
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user