linux/drivers/staging
Hans Verkuil b3379c6201 [media] vb2: only call start_streaming if sufficient buffers are queued
In commit 02f142ecd2 support was added to
start_streaming to return -ENOBUFS if insufficient buffers were queued
for the DMA engine to start. The vb2 core would attempt calling
start_streaming again if another buffer would be queued up.

Later analysis uncovered problems with the queue management if start_streaming
would return an error: the buffers are enqueued to the driver before the
start_streaming op is called, so after an error they are never returned to
the vb2 core. The solution for this is to let the driver return them to
the vb2 core in case of an error while starting the DMA engine. However,
in the case of -ENOBUFS that would be weird: it is not a real error, it
just says that more buffers are needed. Requiring start_streaming to give
them back only to have them requeued again the next time the application
calls QBUF is inefficient.

This patch changes this mechanism: it adds a 'min_buffers_needed' field
to vb2_queue that drivers can set with the minimum number of buffers
required to start the DMA engine. The start_streaming op is only called
if enough buffers are queued. The -ENOBUFS handling has been dropped in
favor of this new method.

Drivers are expected to return buffers back to vb2 core with state QUEUED
if start_streaming would return an error. The vb2 core checks for this
and produces a warning if that didn't happen and it will forcefully
reclaim such buffers to ensure that the internal vb2 core state remains
consistent and all buffer-related resources have been correctly freed
and all op calls have been balanced.

__reqbufs() has been updated to check that at least min_buffers_needed
buffers could be allocated. If fewer buffers were allocated then __reqbufs
will free what was allocated and return -ENOMEM. Based on a suggestion from
Pawel Osciak.

__create_bufs() doesn't do that check, since the use of __create_bufs
assumes some advance scenario where the user might want more control.
Instead streamon will check if enough buffers were allocated to prevent
streaming with fewer than the minimum required number of buffers.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:41 -03:00
..
android staging: binder: Fix death notifications 2014-02-21 12:30:54 -08:00
bcm netdevice: add queue selection fallback handler for ndo_select_queue 2014-02-17 00:36:34 -05:00
ced1401 staging: delete non-required instances of include <linux/init.h> 2013-12-17 10:08:14 -08:00
comedi staging: comedi: usbduxsigma: fix unaligned dereferences 2014-02-07 11:08:46 -08:00
cptm1217
crystalhd staging: delete non-required instances of include <linux/init.h> 2013-12-17 10:08:14 -08:00
cxt1e1 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-01-25 11:17:34 -08:00
dgap Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-01-25 11:17:34 -08:00
dgnc drivers: dgnc: Include appropriate header file in dgnc_trace.c 2014-01-08 15:47:35 -08:00
dgrp Revert "Staging: dgrp: Refactor the function dgrp_receive() in drrp_net_ops.c" 2014-02-07 09:16:38 -08:00
echo
et131x staging: delete non-required instances of include <linux/init.h> 2013-12-17 10:08:14 -08:00
frontier staging: delete non-required instances of include <linux/init.h> 2013-12-17 10:08:14 -08:00
ft1000 staging: delete non-required instances of include <linux/init.h> 2013-12-17 10:08:14 -08:00
fwserial staging/fwserial: Add Kconfig options for max ports 2013-12-08 17:03:03 -08:00
gdm72xx staging: gdm72xx: fix leaks at failure path in gdm_usb_probe() 2014-02-07 09:19:30 -08:00
gdm724x staging: delete non-required instances of include <linux/init.h> 2013-12-17 10:08:14 -08:00
goldfish staging: delete non-required instances of include <linux/init.h> 2013-12-17 10:08:14 -08:00
iio staging:iio:adc:MXS:LRADC: fix touchscreen statemachine 2014-02-24 21:55:50 +00:00
imx-drm staging: imx-drm: Fix build error 2014-02-05 12:02:18 -08:00
keucr staging: keucr: Fix typo in keucr driver 2013-12-17 13:10:40 -08:00
line6 staging: line6: Add support for POD HD400 to line6usb driver 2013-12-21 16:03:34 -08:00
lustre staging: lustre: fix quotactl permission denied (LU-4530) 2014-02-07 09:53:12 -08:00
media [media] vb2: only call start_streaming if sufficient buffers are queued 2014-03-11 06:56:41 -03:00
mt29f_spinand
netlogic Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2014-02-18 15:52:43 -08:00
nvec ARM: SoC cleanups for 3.14 2014-01-23 18:36:55 -08:00
octeon staging: delete non-required instances of include <linux/init.h> 2013-12-17 10:08:14 -08:00
octeon-usb staging: octeon-usb: Probe via device tree populated platform device. 2014-02-07 09:11:28 -08:00
olpc_dcon
ozwpan Staging: ozwpan: Fix null dereference 2014-02-07 09:15:35 -08:00
panel staging: panel: fix interruptible_sleep_on race 2014-01-09 10:41:44 -08:00
phison staging: delete non-required instances of include <linux/init.h> 2013-12-17 10:08:14 -08:00
quickstart ACPI: Clean up inclusions of ACPI header files 2013-12-07 01:03:14 +01:00
rtl8187se Staging: rtl8187se: ieee80211: ieee80211_softmac.c: mark symbols as static 2014-01-11 12:37:58 -08:00
rtl8188eu staging: r8188eu: Add new device ID 2014-02-24 17:02:31 -08:00
rtl8192e Staging rtl8192e: Correcting wrong usage of macro in r8192E_phy.c and removing corresponding warning in rtllib_debug.h 2014-01-09 10:32:18 -08:00
rtl8192u staging: delete non-required instances of include <linux/init.h> 2013-12-17 10:08:14 -08:00
rtl8712 staging: r8712u: Set device type to wlan 2014-01-09 10:35:25 -08:00
rtl8821ae staging/rtl8821ae: fix build, depends on MAC80211 2014-02-11 15:57:40 -08:00
rts5139 Staging: rts5139: rts51x_card: fixed style issues 2014-01-13 15:24:18 -08:00
rts5208 staging: delete non-required instances of include <linux/init.h> 2013-12-17 10:08:14 -08:00
sb105x staging: delete non-required instances of include <linux/init.h> 2013-12-17 10:08:14 -08:00
sbe-2t3e3 drivers: sbe-2t3e3: Mark functions as static in ctrl.c 2014-01-08 15:45:24 -08:00
sep staging: sep: add missing destroy_workqueue() in sep_crypto.c 2013-12-20 11:45:09 -08:00
serqt_usb2 staging: serqt_usb2: don't use sleep_on 2014-01-09 10:41:44 -08:00
silicom Staging: silicom: fix sparse non static symbol warnings 2014-01-09 10:28:15 -08:00
slicoss staging: slicoss: Remove last reference to compare_ether_addr 2013-12-06 12:57:15 -08:00
sm7xxfb drivers: sm7xxfb: Mark function as static in sm7xxfb.c 2014-01-08 15:45:24 -08:00
speakup
ste_rmi4
tidspbridge staging: tidspbridge: adjust error return code (bugfix) 2014-01-13 15:24:18 -08:00
usbip usbip/userspace/libsrc/names.c: memory leak 2014-02-07 11:08:46 -08:00
vme vme_user: Use __u64 and __u32 in userspace structs 2013-12-18 16:20:13 -08:00
vt6655 staging: vt6655: Fix memory leak in wpa_ioctl() 2014-01-13 15:19:41 -08:00
vt6656 staging: vt6656: sparse fixes: iwctl_giwgenie use memcpy. 2014-01-13 15:46:19 -08:00
winbond Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-01-25 11:17:34 -08:00
wlags49_h2 wlags49_h2: Fix overflow in wireless_set_essid() 2014-02-07 11:10:08 -08:00
wlags49_h25
wlan-ng staging: wlan-ng: fix leaks on failure paths in prism2sta_probe_usb() 2014-01-11 12:52:42 -08:00
xgifb staging: remove DEFINE_PCI_DEVICE_TABLE macro 2013-12-02 22:32:35 -08:00
xillybus staging: xillybus: Open Firmware driver supporting coherent DMA 2014-01-09 10:42:36 -08:00
Kconfig Staging wireless driver for 3.14-rc1 2014-02-01 10:29:59 -08:00
Makefile Staging wireless driver for 3.14-rc1 2014-02-01 10:29:59 -08:00
staging.c