media: vicodec: Use vb2_find_buffer

Use the newly introduced vb2_find_buffer API to get a vb2_buffer
given a buffer timestamp.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Acked-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
Ezequiel Garcia 2022-07-11 22:11:37 +01:00 committed by Mauro Carvalho Chehab
parent 6c6d3eaefe
commit 5b25e5432b
1 changed files with 2 additions and 6 deletions

View File

@ -280,17 +280,13 @@ static int device_process(struct vicodec_ctx *ctx,
*/
if (!(ntohl(ctx->state.header.flags) & V4L2_FWHT_FL_I_FRAME)) {
struct vb2_buffer *ref_vb2_buf;
int ref_buf_idx;
struct vb2_queue *vq_cap =
v4l2_m2m_get_vq(ctx->fh.m2m_ctx,
V4L2_BUF_TYPE_VIDEO_CAPTURE);
ref_buf_idx = vb2_find_timestamp(vq_cap,
ctx->state.ref_frame_ts, 0);
if (ref_buf_idx < 0)
ref_vb2_buf = vb2_find_buffer(vq_cap, ctx->state.ref_frame_ts);
if (!ref_vb2_buf)
return -EINVAL;
ref_vb2_buf = vq_cap->bufs[ref_buf_idx];
if (ref_vb2_buf->state == VB2_BUF_STATE_ERROR)
ret = -EINVAL;
ctx->state.ref_frame.buf =