[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220706182657.210650-6-ezequiel@vanguardiasur.com.ar>
Date: Wed, 6 Jul 2022 15:26:54 -0300
From: Ezequiel Garcia <ezequiel@...guardiasur.com.ar>
To: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Hans Verkuil <hverkuil-cisco@...all.nl>,
Tomasz Figa <tfiga@...omium.org>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Ezequiel Garcia <ezequiel@...guardiasur.com.ar>,
Philipp Zabel <p.zabel@...gutronix.de>
Subject: [PATCH 5/8] hantro: Use vb2_find_buffer
Use the newly introduced vb2_find_buffer API to get a vb2_buffer
given a buffer timestamp.
Cc: Philipp Zabel <p.zabel@...gutronix.de>
Signed-off-by: Ezequiel Garcia <ezequiel@...guardiasur.com.ar>
---
drivers/staging/media/hantro/hantro_drv.c | 6 ++----
drivers/staging/media/hantro/hantro_g2_vp9_dec.c | 10 +++++-----
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c
index 01d33dcb0467..8cb5cf53e5e7 100644
--- a/drivers/staging/media/hantro/hantro_drv.c
+++ b/drivers/staging/media/hantro/hantro_drv.c
@@ -47,12 +47,10 @@ dma_addr_t hantro_get_ref(struct hantro_ctx *ctx, u64 ts)
{
struct vb2_queue *q = v4l2_m2m_get_dst_vq(ctx->fh.m2m_ctx);
struct vb2_buffer *buf;
- int index;
- index = vb2_find_timestamp(q, ts, 0);
- if (index < 0)
+ buf = vb2_find_buffer(q, ts);
+ if (!buf)
return 0;
- buf = vb2_get_buffer(q, index);
return hantro_get_dec_buf_addr(ctx, buf);
}
diff --git a/drivers/staging/media/hantro/hantro_g2_vp9_dec.c b/drivers/staging/media/hantro/hantro_g2_vp9_dec.c
index 91c21b634fab..6d452c779633 100644
--- a/drivers/staging/media/hantro/hantro_g2_vp9_dec.c
+++ b/drivers/staging/media/hantro/hantro_g2_vp9_dec.c
@@ -111,17 +111,17 @@ get_ref_buf(struct hantro_ctx *ctx, struct vb2_v4l2_buffer *dst, u64 timestamp)
{
struct v4l2_m2m_ctx *m2m_ctx = ctx->fh.m2m_ctx;
struct vb2_queue *cap_q = &m2m_ctx->cap_q_ctx.q;
- int buf_idx;
+ struct vb2_buffer *buf;
/*
* If a ref is unused or invalid, address of current destination
* buffer is returned.
*/
- buf_idx = vb2_find_timestamp(cap_q, timestamp, 0);
- if (buf_idx < 0)
- return vb2_to_hantro_decoded_buf(&dst->vb2_buf);
+ buf = vb2_find_buffer(cap_q, timestamp);
+ if (!buf)
+ buf = &dst->vb2_buf;
- return vb2_to_hantro_decoded_buf(vb2_get_buffer(cap_q, buf_idx));
+ return vb2_to_hantro_decoded_buf(buf);
}
static void update_dec_buf_info(struct hantro_decoded_buffer *buf,
--
2.34.3
Powered by blists - more mailing lists