]> git.baikalelectronics.ru Git - kernel.git/commitdiff
media: hantro: Enable HOLD_CAPTURE_BUF for H.264
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Fri, 13 May 2022 20:29:22 +0000 (22:29 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Tue, 17 May 2022 08:11:19 +0000 (10:11 +0200)
This is needed to optimize field decoding. Each field will be
decoded into the same capture buffer. To be able to queue multiple
buffers, we need to be able to ask the driver to hold the capture
buffer.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/staging/media/hantro/hantro_v4l2.c

index ed458866257a7a66390a7c24ee99789619eb5b54..22ad182ee972cabba94f148e943e5b1aa58c2d0e 100644 (file)
@@ -408,6 +408,30 @@ hantro_update_requires_request(struct hantro_ctx *ctx, u32 fourcc)
        }
 }
 
+static void
+hantro_update_requires_hold_capture_buf(struct hantro_ctx *ctx, u32 fourcc)
+{
+       struct vb2_queue *vq;
+
+       vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx,
+                            V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
+
+       switch (fourcc) {
+       case V4L2_PIX_FMT_JPEG:
+       case V4L2_PIX_FMT_MPEG2_SLICE:
+       case V4L2_PIX_FMT_VP8_FRAME:
+       case V4L2_PIX_FMT_HEVC_SLICE:
+       case V4L2_PIX_FMT_VP9_FRAME:
+               vq->subsystem_flags &= ~(VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF);
+               break;
+       case V4L2_PIX_FMT_H264_SLICE:
+               vq->subsystem_flags |= VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF;
+               break;
+       default:
+               break;
+       }
+}
+
 static int hantro_set_fmt_out(struct hantro_ctx *ctx,
                              struct v4l2_pix_format_mplane *pix_mp)
 {
@@ -471,6 +495,7 @@ static int hantro_set_fmt_out(struct hantro_ctx *ctx,
        ctx->dst_fmt.quantization = pix_mp->quantization;
 
        hantro_update_requires_request(ctx, pix_mp->pixelformat);
+       hantro_update_requires_hold_capture_buf(ctx, pix_mp->pixelformat);
 
        vpu_debug(0, "OUTPUT codec mode: %d\n", ctx->vpu_src_fmt->codec_mode);
        vpu_debug(0, "fmt - w: %d, h: %d\n",