linux/drivers/media/platform/davinci
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
..
ccdc_hw_device.h
dm355_ccdc_regs.h [media] davinci: more gama -> gamma typo fixes 2013-03-19 16:16:23 -03:00
dm355_ccdc.c [media] media: davinci: vpss: enable vpss clocks 2013-04-14 20:08:09 -03:00
dm644x_ccdc_regs.h [media] davinci/dm644x_ccdc: fix compiler warning 2013-03-19 16:16:04 -03:00
dm644x_ccdc.c [media] media: davinci: vpss: enable vpss clocks 2013-04-14 20:08:09 -03:00
isif_regs.h [media] davinci: more gama -> gamma typo fixes 2013-03-19 16:16:23 -03:00
isif.c [media] media: davinci: vpss: enable vpss clocks 2013-04-14 20:08:09 -03:00
Kconfig [media] media: davinci: kconfig: fix incorrect selects 2013-04-14 20:06:36 -03:00
Makefile [media] media: davinci: kconfig: fix incorrect selects 2013-04-14 20:06:36 -03:00
vpbe_display.c [media] vb2: only call start_streaming if sufficient buffers are queued 2014-03-11 06:56:41 -03:00
vpbe_osd_regs.h
vpbe_osd.c [media] media: davinci: vpbe_osd: convert to devm_* api 2013-07-26 13:18:45 -03:00
vpbe_venc_regs.h
vpbe_venc.c [media] media: davinci: vpbe_venc: convert to devm_* api 2013-07-26 13:18:22 -03:00
vpbe.c [media] v4l2: pass std by value to the write-only s_std ioctl 2013-03-24 06:47:00 -03:00
vpfe_capture.c [media] davinci: remove deprecated IRQF_DISABLED 2013-10-03 14:11:18 -03:00
vpif_capture.c [media] vb2: only call start_streaming if sufficient buffers are queued 2014-03-11 06:56:41 -03:00
vpif_capture.h [media] media: davinci: vpif: capture: add V4L2-async support 2013-07-26 13:16:37 -03:00
vpif_display.c [media] vb2: only call start_streaming if sufficient buffers are queued 2014-03-11 06:56:41 -03:00
vpif_display.h [media] media: davinci: vpif: display: add V4L2-async support 2013-07-26 13:17:15 -03:00
vpif.c [media] media: davinci: vpif: remove unnecessary braces around defines 2013-06-21 11:25:33 -03:00
vpif.h [media] davinci: vpif: Fix module build for capture and display 2013-03-23 10:38:10 -03:00
vpss.c [media] media: davinci: vpss: convert to devm* api 2013-07-26 13:19:22 -03:00