OpenCloudOS-Kernel/drivers/media
Hans Verkuil 390a71e361 media: videobuf2: request more buffers for vb2_read
[ Upstream commit 350ab13e1382f2afcc2285041a1e75b80d771c2c ]

The vb2 read support requests 1 buffer, leaving it to the driver
to increase this number to something that works.

Unfortunately, drivers do not deal with this reliably, and in fact
this caused problems for the bttv driver and reading from /dev/vbiX,
causing every other VBI frame to be all 0.

Instead, request as the number of buffers whatever is the maximum of
2 and q->min_buffers_needed+1.

In order to start streaming you need at least q->min_buffers_needed
queued buffers, so add 1 buffer for processing. And if that field
is 0, then choose 2 (again, one buffer is being filled while the
other one is being processed).

This certainly makes more sense than requesting just 1 buffer, and
the VBI bttv support is now working again.

It turns out that the old videobuf1 behavior of bttv was to allocate
8 (video) and 4 (vbi) buffers when used with read(). After the vb2
conversion that changed to 2 for both. With this patch it is 3, which
is really all you need.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Fixes: b7ec3212a7 ("media: bttv: convert to vb2")
Tested-by: Dr. David Alan Gilbert <dave@treblig.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-04-27 17:11:30 +02:00
..
cec media: cec: core: remove length check of Timer Status 2024-04-17 11:19:26 +02:00
common media: videobuf2: request more buffers for vb2_read 2024-04-27 17:11:30 +02:00
dvb-core media: edia: dvbdev: fix a use-after-free 2024-03-26 18:19:45 -04:00
dvb-frontends media: dvb-frontends: avoid stack overflow warnings with clang 2024-03-26 18:19:53 -04:00
firewire media: firewire: firedtv-avc.c: replace BUG with proper, error return 2023-08-10 07:58:37 +02:00
i2c media: i2c: imx290: Fix IMX920 typo 2024-03-26 18:19:51 -04:00
mc media: mc: Expand MUST_CONNECT flag to always require an enabled link 2024-04-03 15:28:17 +02:00
mmc
pci media: sta2x11: fix irq handler cast 2024-04-13 13:07:35 +02:00
platform media: mediatek: vcodec: adding lock to protect encoder context list 2024-04-13 13:07:40 +02:00
radio media: wl128x: Fix spelling mistake "Transfered" -> "Transferred" 2023-07-19 12:57:48 +02:00
rc media: rc: bpf attach/detach requires write permission 2024-02-23 09:25:07 +01:00
spi
test-drivers media: visl: Hook the (TRY_)DECODER_CMD stateless ioctls 2024-01-25 15:35:32 -08:00
tuners media: xc4000: Fix atomicity violation in xc4000_get_frequency 2024-04-03 15:28:17 +02:00
usb media: go7007: fix a memleak in go7007_load_encoder 2024-03-26 18:19:53 -04:00
v4l2-core media: v4l2-mem2mem: fix a memleak in v4l2_m2m_register_entity 2024-03-26 18:19:45 -04:00
Kconfig media: Kconfig: Make DVB_CORE=m possible when MEDIA_SUPPORT=y 2022-12-07 17:58:46 +01:00
Makefile