media: hantro: Simplify postprocessor
authorEzequiel Garcia <ezequiel@collabora.com>
Tue, 16 Nov 2021 14:38:33 +0000 (14:38 +0000)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 22 Nov 2021 07:41:55 +0000 (07:41 +0000)
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>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/hantro/hantro.h
drivers/staging/media/hantro/hantro_postproc.c
drivers/staging/media/hantro/imx8m_vpu_hw.c
drivers/staging/media/hantro/rockchip_vpu_hw.c
drivers/staging/media/hantro/sama5d4_vdec_hw.c

index c2e01959dc005ac6eb3a91461249d8f40d68d57c..dd5e56765d4e8bd58b63bb7dcf8a0e72d9f0db09 100644 (file)
@@ -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 {
index 882fb8bc5dddcf3e0a301f998cad1986c457449a..4549aec08feb3be63a92ea16cdb91bbf3beb515c 100644 (file)
@@ -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)
index 22fa7d2f3b64726d06f6444ca77536a41b8ae6fb..02e61438220a899d4a5f1e2b43a4192bb628143a 100644 (file)
@@ -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,
        },
 };
 
index 6c1ad5534ce5396712026a2a5d892bc38178ce18..f372f767d4ffbb4ab3f8088b16d454b789739efc 100644 (file)
@@ -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,
        },
 };
 
index f3fecc7248c4b7f0f3e845414fb49254490ddafb..b2fc1c5613e19abd6948495040ad70e309538b47 100644 (file)
@@ -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,
        },
 };