Mingcheng Zhu | 9812bd3 | 2011-07-22 22:57:11 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
| 12 | * helper functions for physically contiguous PMEM capture buffers |
| 13 | */ |
| 14 | |
| 15 | #ifndef _VIDEOBUF2_PMEM_CONTIG_H |
| 16 | #define _VIDEOBUF2_PMEM_CONTIG_H |
| 17 | |
| 18 | #include <media/videobuf2-core.h> |
Ankit Premrajka | c6864b8 | 2011-07-15 11:43:41 -0700 | [diff] [blame] | 19 | #include <mach/msm_subsystem_map.h> |
Mingcheng Zhu | 9812bd3 | 2011-07-22 22:57:11 -0700 | [diff] [blame] | 20 | |
| 21 | struct videobuf2_mapping { |
| 22 | unsigned int count; |
| 23 | }; |
| 24 | |
Kiran Kumar H N | 5e08d77 | 2011-10-03 10:19:15 -0700 | [diff] [blame] | 25 | enum videobuf2_buffer_type { |
| 26 | VIDEOBUF2_SINGLE_PLANE, |
| 27 | VIDEOBUF2_MULTIPLE_PLANES |
| 28 | }; |
| 29 | |
| 30 | struct videobuf2_sp_offset { |
| 31 | uint32_t y_off; |
| 32 | uint32_t cbcr_off; |
| 33 | }; |
| 34 | |
| 35 | struct videobuf2_msm_offset { |
| 36 | union { |
| 37 | struct videobuf2_sp_offset sp_off; |
| 38 | uint32_t data_offset; |
| 39 | }; |
| 40 | }; |
| 41 | |
Mingcheng Zhu | 9812bd3 | 2011-07-22 22:57:11 -0700 | [diff] [blame] | 42 | struct videobuf2_contig_pmem { |
| 43 | u32 magic; |
| 44 | void *vaddr; |
| 45 | int phyaddr; |
| 46 | unsigned long size; |
| 47 | int is_userptr; |
Kiran Kumar H N | 5e08d77 | 2011-10-03 10:19:15 -0700 | [diff] [blame] | 48 | /* Offset of the plane inside the buffer */ |
| 49 | struct videobuf2_msm_offset offset; |
| 50 | enum videobuf2_buffer_type buffer_type; |
| 51 | int path; |
Mingcheng Zhu | 9812bd3 | 2011-07-22 22:57:11 -0700 | [diff] [blame] | 52 | struct file *file; |
Kiran Kumar H N | 5e08d77 | 2011-10-03 10:19:15 -0700 | [diff] [blame] | 53 | /* Offset of the buffer */ |
Mingcheng Zhu | 9812bd3 | 2011-07-22 22:57:11 -0700 | [diff] [blame] | 54 | uint32_t addr_offset; |
| 55 | int dirty; |
| 56 | unsigned int count; |
| 57 | void *alloc_ctx; |
Ankit Premrajka | c6864b8 | 2011-07-15 11:43:41 -0700 | [diff] [blame] | 58 | struct msm_mapped_buffer *msm_buffer; |
| 59 | int subsys_id; |
Kiran Kumar H N | ceea762 | 2011-08-23 14:01:03 -0700 | [diff] [blame] | 60 | unsigned long mapped_phyaddr; |
Mingcheng Zhu | 9812bd3 | 2011-07-22 22:57:11 -0700 | [diff] [blame] | 61 | }; |
| 62 | void videobuf2_queue_pmem_contig_init(struct vb2_queue *q, |
| 63 | enum v4l2_buf_type type, |
| 64 | const struct vb2_ops *ops, |
| 65 | unsigned int size, |
| 66 | void *priv); |
| 67 | int videobuf2_pmem_contig_mmap_get(struct videobuf2_contig_pmem *mem, |
Kiran Kumar H N | 5e08d77 | 2011-10-03 10:19:15 -0700 | [diff] [blame] | 68 | struct videobuf2_msm_offset *offset, |
| 69 | enum videobuf2_buffer_type, int path); |
Mingcheng Zhu | 9812bd3 | 2011-07-22 22:57:11 -0700 | [diff] [blame] | 70 | int videobuf2_pmem_contig_user_get(struct videobuf2_contig_pmem *mem, |
Kiran Kumar H N | 5e08d77 | 2011-10-03 10:19:15 -0700 | [diff] [blame] | 71 | struct videobuf2_msm_offset *offset, |
| 72 | enum videobuf2_buffer_type, |
Mingcheng Zhu | 9812bd3 | 2011-07-22 22:57:11 -0700 | [diff] [blame] | 73 | uint32_t addr_offset, int path); |
| 74 | void videobuf2_pmem_contig_user_put(struct videobuf2_contig_pmem *mem); |
Ankit Premrajka | c6864b8 | 2011-07-15 11:43:41 -0700 | [diff] [blame] | 75 | unsigned long videobuf2_to_pmem_contig(struct vb2_buffer *buf, |
| 76 | unsigned int plane_no); |
Mingcheng Zhu | 9812bd3 | 2011-07-22 22:57:11 -0700 | [diff] [blame] | 77 | |
| 78 | #endif /* _VIDEOBUF2_PMEM_CONTIG_H */ |