diff options
author | Ezequiel Garcia | 2019-06-10 16:55:24 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab | 2019-06-21 16:23:46 -0400 |
commit | 9e393300167be4d0c6a6d17330de1fba9a675212 (patch) | |
tree | 0704066c54304508ee6942c55d990a971b173df4 /drivers/media/platform/mtk-vcodec | |
parent | 8eebd6150aa5232d4b47b9f0cc33c76b2bf3b06a (diff) |
media: mtk-vcodec: Use vb2_get_buffer
Use the newly introduced vb2_get_buffer API and avoid
accessing buffers in the queue directly.
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil-cisco@xs4all.nl: fixed checkpatch alignment warning]
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/platform/mtk-vcodec')
-rw-r--r-- | drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c index 480cc8fe281a..fd8de027e83e 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c @@ -865,12 +865,18 @@ 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]), - VB2_BUF_STATE_QUEUED); + (int)buf->state); + v4l2_m2m_buf_done(to_vb2_v4l2_buffer(buf), + VB2_BUF_STATE_QUEUED); } } |