[media] vb2: add a dev field to use for the default allocation context

The allocation context is nothing more than a per-plane device pointer
to use when allocating buffers. So just provide a dev pointer in vb2_queue
for that purpose and drivers can skip allocating/releasing/filling in
the allocation context unless they require different per-plane device
pointers as used by some Samsung SoCs.

Signed-off-by: Hans Verkuil <[email protected]>
Reviewed-by: Laurent Pinchart <[email protected]>
Cc: Sakari Ailus <[email protected]>
Cc: Florian Echtler <[email protected]>
Cc: Federico Vaga <[email protected]>
Cc: "Lad, Prabhakar" <[email protected]>
Cc: Scott Jiang <[email protected]>
Acked-by: Philipp Zabel <[email protected]>
Cc: Fabien Dessenne <[email protected]>
Acked-by: Benoit Parrot <[email protected]>
Cc: Mikhail Ulyanov <[email protected]>
Cc: Guennadi Liakhovetski <[email protected]>
Cc: Jonathan Corbet <[email protected]>
Cc: Ludovic Desroches <[email protected]>
Cc: Sergei Shtylyov <[email protected]>
Cc: Kyungmin Park <[email protected]>
Cc: Sylwester Nawrocki <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
This commit is contained in:
Hans Verkuil 2015-12-16 08:30:43 -02:00 • committed by Mauro Carvalho Chehab
commit 20be7ab8db
2 changed files with 11 additions and 6 deletions

View file

@ -400,6 +400,8 @@ struct vb2_buf_ops {
* caller. For example, for V4L2, it should match
* the V4L2_BUF_TYPE_* in include/uapi/linux/videodev2.h
* @io_modes: supported io methods (see vb2_io_modes enum)
* @dev: device to use for the default allocation context if the driver
* doesn't fill in the @alloc_ctx array.
* @dma_attrs: DMA attributes to use for the DMA. May be NULL.
* @fileio_read_once: report EOF after reading the first buffer
* @fileio_write_immediately: queue buffer after each write() call
@ -467,6 +469,7 @@ struct vb2_buf_ops {
struct vb2_queue {
unsigned int type;
unsigned int io_modes;
struct device *dev;
const struct dma_attrs *dma_attrs;
unsigned fileio_read_once:1;
unsigned fileio_write_immediately:1;