1 #ifndef __MSMB_PPROC_H
2 #define __MSMB_PPROC_H
3 
4 #ifdef MSM_CAMERA_BIONIC
5 #include <sys/types.h>
6 #endif
7 #include <linux/videodev2.h>
8 #include <linux/types.h>
9 
10 /* Should be same as VIDEO_MAX_PLANES in videodev2.h */
11 #define MAX_PLANES VIDEO_MAX_PLANES
12 
13 #define MAX_NUM_CPP_STRIPS 8
14 #define MSM_CPP_MAX_NUM_PLANES 3
15 
16 enum msm_cpp_frame_type {
17 	MSM_CPP_OFFLINE_FRAME,
18 	MSM_CPP_REALTIME_FRAME,
19 };
20 
21 struct msm_cpp_frame_strip_info {
22 	int scale_v_en;
23 	int scale_h_en;
24 
25 	int upscale_v_en;
26 	int upscale_h_en;
27 
28 	int src_start_x;
29 	int src_end_x;
30 	int src_start_y;
31 	int src_end_y;
32 
33 	/* Padding is required for upscaler because it does not
34 	 * pad internally like other blocks, also needed for rotation
35 	 * rotation expects all the blocks in the stripe to be the same size
36 	 * Padding is done such that all the extra padded pixels
37 	 * are on the right and bottom
38 	 */
39 	int pad_bottom;
40 	int pad_top;
41 	int pad_right;
42 	int pad_left;
43 
44 	int v_init_phase;
45 	int h_init_phase;
46 	int h_phase_step;
47 	int v_phase_step;
48 
49 	int prescale_crop_width_first_pixel;
50 	int prescale_crop_width_last_pixel;
51 	int prescale_crop_height_first_line;
52 	int prescale_crop_height_last_line;
53 
54 	int postscale_crop_height_first_line;
55 	int postscale_crop_height_last_line;
56 	int postscale_crop_width_first_pixel;
57 	int postscale_crop_width_last_pixel;
58 
59 	int dst_start_x;
60 	int dst_end_x;
61 	int dst_start_y;
62 	int dst_end_y;
63 
64 	int bytes_per_pixel;
65 	unsigned int source_address;
66 	unsigned int destination_address;
67 	unsigned int src_stride;
68 	unsigned int dst_stride;
69 	int rotate_270;
70 	int horizontal_flip;
71 	int vertical_flip;
72 	int scale_output_width;
73 	int scale_output_height;
74 	int prescale_crop_en;
75 	int postscale_crop_en;
76 };
77 
78 struct msm_cpp_buffer_info_t {
79 	int fd;
80 	uint32_t index;
81 	uint32_t offset;
82 	uint8_t native_buff;
83 	uint8_t processed_divert;
84 };
85 
86 struct msm_cpp_stream_buff_info_t {
87 	uint32_t identity;
88 	uint32_t num_buffs;
89 	struct msm_cpp_buffer_info_t *buffer_info;
90 };
91 
92 struct msm_cpp_frame_info_t {
93 	int32_t frame_id;
94 	struct timeval timestamp;
95 	uint32_t inst_id;
96 	uint32_t identity;
97 	uint32_t client_id;
98 	enum msm_cpp_frame_type frame_type;
99 	uint32_t num_strips;
100 	struct msm_cpp_frame_strip_info *strip_info;
101 	uint32_t msg_len;
102 	uint32_t *cpp_cmd_msg;
103 	int src_fd;
104 	int dst_fd;
105 	struct ion_handle *src_ion_handle;
106 	struct ion_handle *dest_ion_handle;
107 	struct timeval in_time, out_time;
108 	void *cookie;
109 	int32_t *status;
110 
111 	struct msm_cpp_buffer_info_t input_buffer_info;
112 	struct msm_cpp_buffer_info_t output_buffer_info;
113 };
114 
115 struct cpp_hw_info {
116 	uint32_t cpp_hw_version;
117 	uint32_t cpp_hw_caps;
118 };
119 
120 #define VIDIOC_MSM_CPP_CFG \
121 	_IOWR('V', BASE_VIDIOC_PRIVATE, struct msm_camera_v4l2_ioctl_t)
122 
123 #define VIDIOC_MSM_CPP_GET_EVENTPAYLOAD \
124 	_IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct msm_camera_v4l2_ioctl_t)
125 
126 #define VIDIOC_MSM_CPP_GET_INST_INFO \
127 	_IOWR('V', BASE_VIDIOC_PRIVATE + 2, struct msm_camera_v4l2_ioctl_t)
128 
129 #define VIDIOC_MSM_CPP_LOAD_FIRMWARE \
130 	_IOWR('V', BASE_VIDIOC_PRIVATE + 3, struct msm_camera_v4l2_ioctl_t)
131 
132 #define VIDIOC_MSM_CPP_GET_HW_INFO \
133 	_IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct msm_camera_v4l2_ioctl_t)
134 
135 #define VIDIOC_MSM_CPP_FLUSH_QUEUE \
136 	_IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct msm_camera_v4l2_ioctl_t)
137 
138 #define VIDIOC_MSM_CPP_ENQUEUE_STREAM_BUFF_INFO \
139 	_IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct msm_camera_v4l2_ioctl_t)
140 
141 #define VIDIOC_MSM_CPP_DEQUEUE_STREAM_BUFF_INFO \
142 	_IOWR('V', BASE_VIDIOC_PRIVATE + 7, struct msm_camera_v4l2_ioctl_t)
143 
144 #define V4L2_EVENT_CPP_FRAME_DONE  (V4L2_EVENT_PRIVATE_START + 0)
145 
146 struct msm_camera_v4l2_ioctl_t {
147 	uint32_t id;
148 	uint32_t len;
149 	int32_t trans_code;
150 	void __user *ioctl_ptr;
151 };
152 
153 #endif /* __MSMB_PPROC_H */
154