* [PATCH] media: videobuf2: num_buffers should record the number of all buffers
@ 2021-03-29 0:59 Dianlong Li
2021-04-06 8:42 ` Hans Verkuil
0 siblings, 1 reply; 2+ messages in thread
From: Dianlong Li @ 2021-03-29 0:59 UTC (permalink / raw)
To: mchehab+huawei; +Cc: linux-media, Dianlong Li
The variable q->num_buffers records the number of buffers previously
applied for, and the variable allocated_buffers records the number of
buffers applied for this time, so the total number should be the sum
of these two buffers.
Signed-off-by: Dianlong Li <dianlong_lee@163.com>
---
drivers/media/common/videobuf2/videobuf2-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c
index 4eab6d81cce1..2716c4138655 100644
--- a/drivers/media/common/videobuf2/videobuf2-core.c
+++ b/drivers/media/common/videobuf2/videobuf2-core.c
@@ -836,7 +836,7 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
}
mutex_lock(&q->mmap_lock);
- q->num_buffers = allocated_buffers;
+ q->num_buffers += allocated_buffers;
if (ret < 0) {
/*
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] media: videobuf2: num_buffers should record the number of all buffers
2021-03-29 0:59 [PATCH] media: videobuf2: num_buffers should record the number of all buffers Dianlong Li
@ 2021-04-06 8:42 ` Hans Verkuil
0 siblings, 0 replies; 2+ messages in thread
From: Hans Verkuil @ 2021-04-06 8:42 UTC (permalink / raw)
To: Dianlong Li, mchehab+huawei; +Cc: linux-media
On 29/03/2021 02:59, Dianlong Li wrote:
> The variable q->num_buffers records the number of buffers previously
> applied for, and the variable allocated_buffers records the number of
> buffers applied for this time, so the total number should be the sum
> of these two buffers.
>
> Signed-off-by: Dianlong Li <dianlong_lee@163.com>
> ---
> drivers/media/common/videobuf2/videobuf2-core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c
> index 4eab6d81cce1..2716c4138655 100644
> --- a/drivers/media/common/videobuf2/videobuf2-core.c
> +++ b/drivers/media/common/videobuf2/videobuf2-core.c
> @@ -836,7 +836,7 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
> }
>
> mutex_lock(&q->mmap_lock);
> - q->num_buffers = allocated_buffers;
> + q->num_buffers += allocated_buffers;
>
> if (ret < 0) {
> /*
>
Nacked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
The VIDIOC_REQBUFS ioctl releases all existing buffers (if any) and allocates new buffers.
So the existing code is correct.
Regards,
Hans
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-06 8:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29 0:59 [PATCH] media: videobuf2: num_buffers should record the number of all buffers Dianlong Li
2021-04-06 8:42 ` Hans Verkuil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).