Message ID | 20231017144756.34719-23-benjamin.gaignard@collabora.com |
---|---|
State | New |
Headers | show |
Series | Add DELETE_BUF ioctl | expand |
On 17/10/2023 16:47, Benjamin Gaignard wrote: > vb2 queue_setup checks for a minimum number of buffers so set > min_buffers_needed to 3 and remove the useless check in > tw686x_queue_setup(). > > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> > CC: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> > --- > drivers/media/pci/tw686x/tw686x-video.c | 13 +++++-------- > 1 file changed, 5 insertions(+), 8 deletions(-) > > diff --git a/drivers/media/pci/tw686x/tw686x-video.c b/drivers/media/pci/tw686x/tw686x-video.c > index 3ebf7a2c95f0..74cd864365aa 100644 > --- a/drivers/media/pci/tw686x/tw686x-video.c > +++ b/drivers/media/pci/tw686x/tw686x-video.c > @@ -426,13 +426,6 @@ static int tw686x_queue_setup(struct vb2_queue *vq, > unsigned int szimage = > (vc->width * vc->height * vc->format->depth) >> 3; > > - /* > - * Let's request at least three buffers: two for the > - * DMA engine and one for userspace. > - */ > - if (vq->num_buffers + *nbuffers < 3) > - *nbuffers = 3 - vq->num_buffers; > - > if (*nplanes) { > if (*nplanes != 1 || sizes[0] < szimage) > return -EINVAL; > @@ -1221,7 +1214,11 @@ int tw686x_video_init(struct tw686x_dev *dev) > vc->vidq.ops = &tw686x_video_qops; > vc->vidq.mem_ops = dev->dma_ops->mem_ops; > vc->vidq.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; > - vc->vidq.min_buffers_needed = 2; > + /* > + * Let's request at least three buffers: two for the > + * DMA engine and one for userspace. > + */ > + vc->vidq.min_buffers_needed = 3; Don't touch min_buffers_needed, just keep the current check in queue_setup. Regards, Hans > vc->vidq.lock = &vc->vb_mutex; > vc->vidq.gfp_flags = dev->dma_mode != TW686X_DMA_MODE_MEMCPY ? > GFP_DMA32 : 0;
diff --git a/drivers/media/pci/tw686x/tw686x-video.c b/drivers/media/pci/tw686x/tw686x-video.c index 3ebf7a2c95f0..74cd864365aa 100644 --- a/drivers/media/pci/tw686x/tw686x-video.c +++ b/drivers/media/pci/tw686x/tw686x-video.c @@ -426,13 +426,6 @@ static int tw686x_queue_setup(struct vb2_queue *vq, unsigned int szimage = (vc->width * vc->height * vc->format->depth) >> 3; - /* - * Let's request at least three buffers: two for the - * DMA engine and one for userspace. - */ - if (vq->num_buffers + *nbuffers < 3) - *nbuffers = 3 - vq->num_buffers; - if (*nplanes) { if (*nplanes != 1 || sizes[0] < szimage) return -EINVAL; @@ -1221,7 +1214,11 @@ int tw686x_video_init(struct tw686x_dev *dev) vc->vidq.ops = &tw686x_video_qops; vc->vidq.mem_ops = dev->dma_ops->mem_ops; vc->vidq.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; - vc->vidq.min_buffers_needed = 2; + /* + * Let's request at least three buffers: two for the + * DMA engine and one for userspace. + */ + vc->vidq.min_buffers_needed = 3; vc->vidq.lock = &vc->vb_mutex; vc->vidq.gfp_flags = dev->dma_mode != TW686X_DMA_MODE_MEMCPY ? GFP_DMA32 : 0;
vb2 queue_setup checks for a minimum number of buffers so set min_buffers_needed to 3 and remove the useless check in tw686x_queue_setup(). Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> CC: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> --- drivers/media/pci/tw686x/tw686x-video.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)