From 5ba3f757f0592ca001266b4a6214d0332349909c Mon Sep 17 00:00:00 2001 From: Andrzej Pietrasiewicz Date: Mon, 29 Nov 2010 11:53:34 -0300 Subject: [media] v4l: videobuf2: add DMA scatter/gather allocator Add an implementation of DMA scatter/gather allocator and handling routines for videobuf2. For mmap operation mode it is implemented on top of alloc_page + sg_set_page/_free_page. For userptr operation mode it is implemented on top of get_user_pages + sg_set_page/put_page. Signed-off-by: Andrzej Pietrasiewicz Signed-off-by: Kyungmin Park Signed-off-by: Marek Szyprowski CC: Pawel Osciak Reviewed-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/media/videobuf2-dma-sg.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 include/media/videobuf2-dma-sg.h (limited to 'include/media/videobuf2-dma-sg.h') diff --git a/include/media/videobuf2-dma-sg.h b/include/media/videobuf2-dma-sg.h new file mode 100644 index 000000000000..0038526b8ef7 --- /dev/null +++ b/include/media/videobuf2-dma-sg.h @@ -0,0 +1,32 @@ +/* + * videobuf2-dma-sg.h - DMA scatter/gather memory allocator for videobuf2 + * + * Copyright (C) 2010 Samsung Electronics + * + * Author: Andrzej Pietrasiewicz + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation. + */ + +#ifndef _MEDIA_VIDEOBUF2_DMA_SG_H +#define _MEDIA_VIDEOBUF2_DMA_SG_H + +#include + +struct vb2_dma_sg_desc { + unsigned long size; + unsigned int num_pages; + struct scatterlist *sglist; +}; + +static inline struct vb2_dma_sg_desc *vb2_dma_sg_plane_desc( + struct vb2_buffer *vb, unsigned int plane_no) +{ + return (struct vb2_dma_sg_desc *)vb2_plane_cookie(vb, plane_no); +} + +extern const struct vb2_mem_ops vb2_dma_sg_memops; + +#endif -- cgit v1.2.3