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.
Unified · Split
| @@ -263,6 +263,7 @@ struct hantro_ctx { · 262 unmodified lines | ||
| 263 | 263 | * @max_depth: Maximum depth, for bitstream formats |
| 264 | 264 | * @enc_fmt: Format identifier for encoder registers. |
| 265 | 265 | * @frmsize: Supported range of frame sizes (only for bitstream formats). |
| 266 | + * @postprocessed: Indicates if this format needs the post-processor. | |
| 266 | 267 | */ |
| 267 | 268 | struct hantro_fmt { |
| 268 | 269 | char *name; |
| @@ -272,6 +273,7 @@ struct hantro_fmt { · 3 unmodified lines | ||
| 272 | 273 | int max_depth; |
| 273 | 274 | enum hantro_enc_fmt enc_fmt; |
| 274 | 275 | struct v4l2_frmsize_stepwise frmsize; |
| 276 | + bool postprocessed; | |
| 275 | 277 | }; |
| 276 | 278 | |
| 277 | 279 | struct hantro_reg { |
| @@ -53,15 +53,9 @@ const struct hantro_postproc_regs hantro_g1_postproc_regs = { · 52 unmodified lines | ||
| 53 | 53 | bool hantro_needs_postproc(const struct hantro_ctx *ctx, |
| 54 | 54 | const struct hantro_fmt *fmt) |
| 55 | 55 | { |
| 56 | − struct hantro_dev *vpu = ctx->dev; | |
| 57 | − | |
| 58 | 56 | if (ctx->is_encoder) |
| 59 | 57 | return false; |
| 60 | − | |
| 61 | − if (!vpu->variant->postproc_fmts) | |
| 62 | − return false; | |
| 63 | − | |
| 64 | − return fmt->fourcc != V4L2_PIX_FMT_NV12; | |
| 58 | + return fmt->postprocessed; | |
| 65 | 59 | } |
| 66 | 60 | |
| 67 | 61 | static void hantro_postproc_g1_enable(struct hantro_ctx *ctx) |
| @@ -82,6 +82,7 @@ static const struct hantro_fmt imx8m_vpu_postproc_fmts[] = { · 81 unmodified lines | ||
| 82 | 82 | { |
| 83 | 83 | .fourcc = V4L2_PIX_FMT_YUYV, |
| 84 | 84 | .codec_mode = HANTRO_MODE_NONE, |
| 85 | + .postprocessed = true, | |
| 85 | 86 | }, |
| 86 | 87 | }; |
| 87 | 88 | |
| @@ -62,6 +62,7 @@ static const struct hantro_fmt rockchip_vpu1_postproc_fmts[] = { · 61 unmodified lines | ||
| 62 | 62 | { |
| 63 | 63 | .fourcc = V4L2_PIX_FMT_YUYV, |
| 64 | 64 | .codec_mode = HANTRO_MODE_NONE, |
| 65 | + .postprocessed = true, | |
| 65 | 66 | }, |
| 66 | 67 | }; |
| 67 | 68 | |
| @@ -15,6 +15,7 @@ static const struct hantro_fmt sama5d4_vdec_postproc_fmts[] = { · 14 unmodified lines | ||
| 15 | 15 | { |
| 16 | 16 | .fourcc = V4L2_PIX_FMT_YUYV, |
| 17 | 17 | .codec_mode = HANTRO_MODE_NONE, |
| 18 | + .postprocessed = true, | |
| 18 | 19 | }, |
| 19 | 20 | }; |
| 20 | 21 | |