mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-01 06:04:48 -04:00
media: imx: Stop direct calls to queue num_buffers field
Use vb2_get_num_buffers() to avoid using queue num_buffers field directly. This allows us to change how the number of buffers is computed in the future. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> CC: Steve Longerbeam <slongerbeam@gmail.com> CC: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
committed by
Mauro Carvalho Chehab
parent
46cbe0cd4c
commit
9d5ffd498d
@@ -605,6 +605,7 @@ static int capture_queue_setup(struct vb2_queue *vq,
|
||||
{
|
||||
struct capture_priv *priv = vb2_get_drv_priv(vq);
|
||||
struct v4l2_pix_format *pix = &priv->vdev.fmt;
|
||||
unsigned int q_num_bufs = vb2_get_num_buffers(vq);
|
||||
unsigned int count = *nbuffers;
|
||||
|
||||
if (vq->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
|
||||
@@ -613,14 +614,14 @@ static int capture_queue_setup(struct vb2_queue *vq,
|
||||
if (*nplanes) {
|
||||
if (*nplanes != 1 || sizes[0] < pix->sizeimage)
|
||||
return -EINVAL;
|
||||
count += vq->num_buffers;
|
||||
count += q_num_bufs;
|
||||
}
|
||||
|
||||
count = min_t(__u32, VID_MEM_LIMIT / pix->sizeimage, count);
|
||||
|
||||
if (*nplanes)
|
||||
*nbuffers = (count < vq->num_buffers) ? 0 :
|
||||
count - vq->num_buffers;
|
||||
*nbuffers = (count < q_num_bufs) ? 0 :
|
||||
count - q_num_bufs;
|
||||
else
|
||||
*nbuffers = count;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user