Skip to content

Commit 340ce50

Browse files
ndufresnemchehab
authored andcommitted
media: hantro: Enable HOLD_CAPTURE_BUF for H.264
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>
1 parent 11442b7 commit 340ce50

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

drivers/staging/media/hantro/hantro_v4l2.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,30 @@ hantro_update_requires_request(struct hantro_ctx *ctx, u32 fourcc)
408408
}
409409
}
410410

411+
static void
412+
hantro_update_requires_hold_capture_buf(struct hantro_ctx *ctx, u32 fourcc)
413+
{
414+
struct vb2_queue *vq;
415+
416+
vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx,
417+
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
418+
419+
switch (fourcc) {
420+
case V4L2_PIX_FMT_JPEG:
421+
case V4L2_PIX_FMT_MPEG2_SLICE:
422+
case V4L2_PIX_FMT_VP8_FRAME:
423+
case V4L2_PIX_FMT_HEVC_SLICE:
424+
case V4L2_PIX_FMT_VP9_FRAME:
425+
vq->subsystem_flags &= ~(VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF);
426+
break;
427+
case V4L2_PIX_FMT_H264_SLICE:
428+
vq->subsystem_flags |= VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF;
429+
break;
430+
default:
431+
break;
432+
}
433+
}
434+
411435
static int hantro_set_fmt_out(struct hantro_ctx *ctx,
412436
struct v4l2_pix_format_mplane *pix_mp)
413437
{
@@ -471,6 +495,7 @@ static int hantro_set_fmt_out(struct hantro_ctx *ctx,
471495
ctx->dst_fmt.quantization = pix_mp->quantization;
472496

473497
hantro_update_requires_request(ctx, pix_mp->pixelformat);
498+
hantro_update_requires_hold_capture_buf(ctx, pix_mp->pixelformat);
474499

475500
vpu_debug(0, "OUTPUT codec mode: %d\n", ctx->vpu_src_fmt->codec_mode);
476501
vpu_debug(0, "fmt - w: %d, h: %d\n",

0 commit comments

Comments
 (0)