From: Ezequiel Garcia <ezequiel@collabora.com>
To: linux-media@vger.kernel.org, Hans Verkuil <hans.verkuil@cisco.com>
Cc: kernel@collabora.com,
Boris Brezillon <boris.brezillon@collabora.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Pawel Osciak <pawel@osciak.com>,
Ezequiel Garcia <ezequiel@collabora.com>,
Tiffany Lin <tiffany.lin@mediatek.com>,
Andrew-CT Chen <andrew-ct.chen@mediatek.com>
Subject: [PATCH v2 3/5] media: mtk-vcodec: Use vb2_get_buffer
Date: Mon, 10 Jun 2019 17:55:24 -0300 [thread overview]
Message-ID: <20190610205526.2629-4-ezequiel@collabora.com> (raw)
In-Reply-To: <20190610205526.2629-1-ezequiel@collabora.com>
Use the newly introduced vb2_get_buffer API and avoid
accessing buffers in the queue directly.
Cc: Tiffany Lin <tiffany.lin@mediatek.com>
Cc: Andrew-CT Chen <andrew-ct.chen@mediatek.com>
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
---
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
index 67e8a023ef41..5198912a1996 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
@@ -860,11 +860,17 @@ static int vb2ops_venc_start_streaming(struct vb2_queue *q, unsigned int count)
err_set_param:
for (i = 0; i < q->num_buffers; ++i) {
- if (q->bufs[i]->state == VB2_BUF_STATE_ACTIVE) {
+ struct vb2_buffer *buf = vb2_get_buffer(q, i);
+
+ /*
+ * FIXME: This check is not needed as only active buffers
+ * can be marked as done.
+ */
+ if (buf->state == VB2_BUF_STATE_ACTIVE) {
mtk_v4l2_debug(0, "[%d] id=%d, type=%d, %d -> VB2_BUF_STATE_QUEUED",
ctx->id, i, q->type,
- (int)q->bufs[i]->state);
- v4l2_m2m_buf_done(to_vb2_v4l2_buffer(q->bufs[i]),
+ (int)buf->state);
+ v4l2_m2m_buf_done(to_vb2_v4l2_buffer(buf),
VB2_BUF_STATE_QUEUED);
}
}
--
2.20.1
next prev parent reply other threads:[~2019-06-10 20:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-10 20:55 [PATCH v2 0/5] media: Access videobuf2 buffers via an accessor Ezequiel Garcia
2019-06-10 20:55 ` [PATCH v2 1/5] media: vb2: Introduce a vb2_get_buffer accessor Ezequiel Garcia
2019-06-11 12:27 ` Marek Szyprowski
2019-06-10 20:55 ` [PATCH v2 2/5] media: mtk-jpeg: Use vb2_get_buffer Ezequiel Garcia
2019-06-10 20:55 ` Ezequiel Garcia [this message]
2019-06-10 20:55 ` [PATCH v2 4/5] media: sti: " Ezequiel Garcia
2019-06-10 20:55 ` [PATCH v2 5/5] media: rockchip: " Ezequiel Garcia
2019-06-14 7:40 ` Hans Verkuil
2019-06-18 23:12 ` [PATCH] media: hantro: " Ezequiel Garcia
2019-06-21 21:03 ` kbuild test robot
2019-06-22 4:14 ` kbuild test robot
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=20190610205526.2629-4-ezequiel@collabora.com \
--to=ezequiel@collabora.com \
--cc=andrew-ct.chen@mediatek.com \
--cc=boris.brezillon@collabora.com \
--cc=hans.verkuil@cisco.com \
--cc=kernel@collabora.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-media@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=pawel@osciak.com \
--cc=tiffany.lin@mediatek.com \
/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