mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Tomasz Figa <tfiga@chromium.org>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Subject: [PATCH v2 4/8] vicodec: Use vb2_find_buffer
Date: Mon, 11 Jul 2022 18:11:37 -0300	[thread overview]
Message-ID: <20220711211141.349902-5-ezequiel@vanguardiasur.com.ar> (raw)
In-Reply-To: <20220711211141.349902-1-ezequiel@vanguardiasur.com.ar>

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

Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Acked-by: Tomasz Figa <tfiga@chromium.org>
---
 drivers/media/test-drivers/vicodec/vicodec-core.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/media/test-drivers/vicodec/vicodec-core.c b/drivers/media/test-drivers/vicodec/vicodec-core.c
index be43f7d32df9..1d1bee111732 100644
--- a/drivers/media/test-drivers/vicodec/vicodec-core.c
+++ b/drivers/media/test-drivers/vicodec/vicodec-core.c
@@ -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 =
-- 
2.34.3


  parent reply	other threads:[~2022-07-11 21:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-11 21:11 [PATCH v2 0/8] videobuf2: Replace vb2_find_timestamp() with vb2_find_buffer() Ezequiel Garcia
2022-07-11 21:11 ` [PATCH v2 1/8] videobuf2: Introduce vb2_find_buffer() Ezequiel Garcia
2022-07-12  7:03   ` Philipp Zabel
2022-07-11 21:11 ` [PATCH v2 2/8] mediatek: vcodec: Use vb2_find_buffer Ezequiel Garcia
2022-07-11 21:11 ` [PATCH v2 3/8] tegra-vde: " Ezequiel Garcia
2022-07-14 18:56   ` Dmitry Osipenko
2022-07-11 21:11 ` Ezequiel Garcia [this message]
2022-07-11 21:11 ` [PATCH v2 5/8] hantro: " Ezequiel Garcia
2022-07-12  7:03   ` Philipp Zabel
2022-07-11 21:11 ` [PATCH v2 6/8] rkvdec: " Ezequiel Garcia
2022-07-11 21:11 ` [PATCH v2 7/8] cedrus: " Ezequiel Garcia
2022-07-12  7:27   ` Paul Kocialkowski
2022-07-14 19:26   ` Nicolas Dufresne
2022-07-15 11:48     ` Ezequiel Garcia
2022-07-16 12:36       ` Jernej Škrabec
2022-07-16 14:55         ` Ezequiel Garcia
2022-07-18 15:56           ` Nicolas Dufresne
2022-07-11 21:11 ` [PATCH v2 8/8] videobuf2: Remove vb2_find_timestamp() Ezequiel Garcia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220711211141.349902-5-ezequiel@vanguardiasur.com.ar \
    --to=ezequiel@vanguardiasur.com.ar \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=tfiga@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®