media: videobuf2: fix buffer management issues
authorBryan Wu <pengw@nvidia.com>
Tue, 23 Apr 2013 22:27:40 +0000 (15:27 -0700)
committerMatthew Pedro <mapedro@nvidia.com>
Wed, 16 Oct 2013 21:34:15 +0000 (14:34 -0700)
commit15814ccc8a511c57182ba3396a1b16af2c648b14
treea979f254acfefb1de2553f2478ae6fa4ffe67984
parent6ff867b97f89fa562ab419a4afd2076d8eaf8a13
media: videobuf2: fix buffer management issues

Use right buffer flag NVMAP_HANDLE_WRITE_COMBINE to allocate buffer,
which can be shared by VI/CSI and CPU. Don't use NVMAP_HEAP_SYSMEM.
It is validated to old T20 silicon and can't support big buffers. By
default, our nvmap_alloc() will use IOVMM to allocate buffers.

nvmap_pin() gives us IOVA for hardware engines like VI/CSI module
with IOMMU enabled in kernel. nvmap_mmap() gives us VA for CPU
read/write operations. So we need to convert VA address to physical
address of the buffer and map that buffer to user space processor's
memory space "page by page".

Bug 1369083

Change-Id: I4629eebe206c7640adf63551968fd89260dd0082
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/279984
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Allen Martin <amartin@nvidia.com>
Reviewed-by: Matthew Pedro <mapedro@nvidia.com>
Tested-by: Matthew Pedro <mapedro@nvidia.com>
drivers/media/video/videobuf2-dma-nvmap.c