msmb_pproc.h revision 620bee93bd09aaa9343d4d09043f711c16bd2a37
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#include <media/msmb_generic_buf_mgr.h> 10 11/* Should be same as VIDEO_MAX_PLANES in videodev2.h */ 12#define MAX_PLANES VIDEO_MAX_PLANES 13 14#define MAX_NUM_CPP_STRIPS 8 15#define MSM_CPP_MAX_NUM_PLANES 3 16#define MSM_CPP_MAX_FRAME_LENGTH 1024 17#define MSM_CPP_MAX_FW_NAME_LEN 32 18#define MAX_FREQ_TBL 10 19 20enum msm_cpp_frame_type { 21 MSM_CPP_OFFLINE_FRAME, 22 MSM_CPP_REALTIME_FRAME, 23}; 24 25enum msm_vpe_frame_type { 26 MSM_VPE_OFFLINE_FRAME, 27 MSM_VPE_REALTIME_FRAME, 28}; 29 30struct msm_cpp_frame_strip_info { 31 uint32_t scale_v_en; 32 uint32_t scale_h_en; 33 34 uint32_t upscale_v_en; 35 uint32_t upscale_h_en; 36 37 int32_t src_start_x; 38 uint32_t src_end_x; 39 int32_t src_start_y; 40 uint32_t src_end_y; 41 42 int32_t temporal_src_start_x; 43 uint32_t temporal_src_end_x; 44 int32_t temporal_src_start_y; 45 uint32_t temporal_src_end_y; 46 47 /* Padding is required for upscaler because it does not 48 * pad internally like other blocks, also needed for rotation 49 * rotation expects all the blocks in the stripe to be the same size 50 * Padding is done such that all the extra padded pixels 51 * are on the right and bottom 52 */ 53 uint32_t pad_bottom; 54 uint32_t pad_top; 55 uint32_t pad_right; 56 uint32_t pad_left; 57 58 uint32_t v_init_phase; 59 uint32_t h_init_phase; 60 uint32_t h_phase_step; 61 uint32_t v_phase_step; 62 63 uint32_t spatial_denoise_crop_width_first_pixel; 64 uint32_t spatial_denoise_crop_width_last_pixel; 65 uint32_t spatial_denoise_crop_height_first_line; 66 uint32_t spatial_denoise_crop_height_last_line; 67 68 uint32_t sharpen_crop_height_first_line; 69 uint32_t sharpen_crop_height_last_line; 70 uint32_t sharpen_crop_width_first_pixel; 71 uint32_t sharpen_crop_width_last_pixel; 72 73 uint32_t temporal_denoise_crop_width_first_pixel; 74 uint32_t temporal_denoise_crop_width_last_pixel; 75 uint32_t temporal_denoise_crop_height_first_line; 76 uint32_t temporal_denoise_crop_height_last_line; 77 78 uint32_t prescaler_spatial_denoise_crop_width_first_pixel; 79 uint32_t prescaler_spatial_denoise_crop_width_last_pixel; 80 uint32_t prescaler_spatial_denoise_crop_height_first_line; 81 uint32_t prescaler_spatial_denoise_crop_height_last_line; 82 83 uint32_t state_crop_width_first_pixel; 84 uint32_t state_crop_width_last_pixel; 85 uint32_t state_crop_height_first_line; 86 uint32_t state_crop_height_last_line; 87 88 int32_t dst_start_x; 89 uint32_t dst_end_x; 90 int32_t dst_start_y; 91 uint32_t dst_end_y; 92 93 int32_t temporal_dst_start_x; 94 uint32_t temporal_dst_end_x; 95 int32_t temporal_dst_start_y; 96 uint32_t temporal_dst_end_y; 97 98 uint32_t input_bytes_per_pixel; 99 uint32_t output_bytes_per_pixel; 100 uint32_t temporal_bytes_per_pixel; 101 102 unsigned int source_address[2]; 103 unsigned int destination_address[2]; 104 /* source_address[1] is used for CbCR planar 105 * to CbCr interleaved conversion 106 */ 107 unsigned int temporal_source_address[2]; 108 /* destination_address[1] is used for CbCr interleved 109 * to CbCr planar conversion 110 */ 111 unsigned int temporal_destination_address[2]; 112 unsigned int src_stride; 113 unsigned int dst_stride; 114 uint32_t rotate_270; 115 uint32_t horizontal_flip; 116 uint32_t vertical_flip; 117 uint32_t scale_output_width; 118 uint32_t scale_output_height; 119 uint32_t spatial_denoise_crop_en; 120 uint32_t sharpen_crop_en; 121 uint32_t temporal_denoise_crop_en; 122 uint32_t prescaler_spatial_denoise_crop_en; 123 uint32_t state_crop_en; 124}; 125 126struct msm_cpp_buffer_info_t { 127 int fd; 128 uint32_t index; 129 uint32_t offset; 130 uint8_t native_buff; 131 uint8_t processed_divert; 132 uint32_t identity; 133}; 134 135struct msm_cpp_stream_buff_info_t { 136 uint32_t identity; 137 uint32_t num_buffs; 138 struct msm_cpp_buffer_info_t *buffer_info; 139}; 140 141struct msm_cpp_frame_info_t { 142 int32_t frame_id; 143 struct timeval timestamp; 144 uint32_t inst_id; 145 uint32_t identity; 146 uint32_t client_id; 147 enum msm_cpp_frame_type frame_type; 148 uint32_t num_strips; 149 struct msm_cpp_frame_strip_info *strip_info; 150 uint32_t msg_len; 151 uint32_t *cpp_cmd_msg; 152 int src_fd; 153 int dst_fd; 154 struct ion_handle *src_ion_handle; 155 struct ion_handle *dest_ion_handle; 156 struct timeval in_time, out_time; 157 void *cookie; 158 int32_t *status; 159 int32_t duplicate_output; 160 uint32_t duplicate_identity; 161 struct msm_cpp_buffer_info_t input_buffer_info; 162 struct msm_cpp_buffer_info_t output_buffer_info[2]; 163}; 164 165struct cpp_hw_info { 166 uint32_t cpp_hw_version; 167 uint32_t cpp_hw_caps; 168 unsigned long freq_tbl[MAX_FREQ_TBL]; 169 uint32_t freq_tbl_count; 170}; 171 172struct msm_vpe_frame_strip_info { 173 uint32_t src_w; 174 uint32_t src_h; 175 uint32_t dst_w; 176 uint32_t dst_h; 177 uint32_t src_x; 178 uint32_t src_y; 179 uint32_t phase_step_x; 180 uint32_t phase_step_y; 181 uint32_t phase_init_x; 182 uint32_t phase_init_y; 183}; 184 185struct msm_vpe_buffer_info_t { 186 int fd; 187 uint32_t index; 188 uint32_t offset; 189 uint8_t native_buff; 190 uint8_t processed_divert; 191}; 192 193struct msm_vpe_stream_buff_info_t { 194 uint32_t identity; 195 uint32_t num_buffs; 196 struct msm_vpe_buffer_info_t *buffer_info; 197}; 198 199struct msm_vpe_frame_info_t { 200 int32_t frame_id; 201 struct timeval timestamp; 202 uint32_t inst_id; 203 uint32_t identity; 204 uint32_t client_id; 205 enum msm_vpe_frame_type frame_type; 206 struct msm_vpe_frame_strip_info strip_info; 207 int src_fd; 208 int dst_fd; 209 struct ion_handle *src_ion_handle; 210 struct ion_handle *dest_ion_handle; 211 unsigned long src_phyaddr; 212 unsigned long dest_phyaddr; 213 unsigned long src_chroma_plane_offset; 214 unsigned long dest_chroma_plane_offset; 215 struct timeval in_time, out_time; 216 void *cookie; 217 218 struct msm_vpe_buffer_info_t input_buffer_info; 219 struct msm_vpe_buffer_info_t output_buffer_info; 220}; 221 222struct msm_pproc_queue_buf_info { 223 struct msm_buf_mngr_info buff_mgr_info; 224 uint8_t is_buf_dirty; 225}; 226 227#define VIDIOC_MSM_CPP_CFG \ 228 _IOWR('V', BASE_VIDIOC_PRIVATE, struct msm_camera_v4l2_ioctl_t) 229 230#define VIDIOC_MSM_CPP_GET_EVENTPAYLOAD \ 231 _IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct msm_camera_v4l2_ioctl_t) 232 233#define VIDIOC_MSM_CPP_GET_INST_INFO \ 234 _IOWR('V', BASE_VIDIOC_PRIVATE + 2, struct msm_camera_v4l2_ioctl_t) 235 236#define VIDIOC_MSM_CPP_LOAD_FIRMWARE \ 237 _IOWR('V', BASE_VIDIOC_PRIVATE + 3, struct msm_camera_v4l2_ioctl_t) 238 239#define VIDIOC_MSM_CPP_GET_HW_INFO \ 240 _IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct msm_camera_v4l2_ioctl_t) 241 242#define VIDIOC_MSM_CPP_FLUSH_QUEUE \ 243 _IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct msm_camera_v4l2_ioctl_t) 244 245#define VIDIOC_MSM_CPP_ENQUEUE_STREAM_BUFF_INFO \ 246 _IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct msm_camera_v4l2_ioctl_t) 247 248#define VIDIOC_MSM_CPP_DEQUEUE_STREAM_BUFF_INFO \ 249 _IOWR('V', BASE_VIDIOC_PRIVATE + 7, struct msm_camera_v4l2_ioctl_t) 250 251 252#define VIDIOC_MSM_VPE_CFG \ 253 _IOWR('V', BASE_VIDIOC_PRIVATE + 8, struct msm_camera_v4l2_ioctl_t) 254 255#define VIDIOC_MSM_VPE_TRANSACTION_SETUP \ 256 _IOWR('V', BASE_VIDIOC_PRIVATE + 9, struct msm_camera_v4l2_ioctl_t) 257 258#define VIDIOC_MSM_VPE_GET_EVENTPAYLOAD \ 259 _IOWR('V', BASE_VIDIOC_PRIVATE + 10, struct msm_camera_v4l2_ioctl_t) 260 261#define VIDIOC_MSM_VPE_GET_INST_INFO \ 262 _IOWR('V', BASE_VIDIOC_PRIVATE + 11, struct msm_camera_v4l2_ioctl_t) 263 264#define VIDIOC_MSM_VPE_ENQUEUE_STREAM_BUFF_INFO \ 265 _IOWR('V', BASE_VIDIOC_PRIVATE + 12, struct msm_camera_v4l2_ioctl_t) 266 267#define VIDIOC_MSM_VPE_DEQUEUE_STREAM_BUFF_INFO \ 268 _IOWR('V', BASE_VIDIOC_PRIVATE + 13, struct msm_camera_v4l2_ioctl_t) 269 270#define VIDIOC_MSM_CPP_QUEUE_BUF \ 271 _IOWR('V', BASE_VIDIOC_PRIVATE + 14, struct msm_camera_v4l2_ioctl_t) 272 273#define VIDIOC_MSM_CPP_APPEND_STREAM_BUFF_INFO \ 274 _IOWR('V', BASE_VIDIOC_PRIVATE + 15, struct msm_camera_v4l2_ioctl_t) 275 276#define VIDIOC_MSM_CPP_SET_CLOCK \ 277 _IOWR('V', BASE_VIDIOC_PRIVATE + 16, struct msm_camera_v4l2_ioctl_t) 278 279#define VIDIOC_MSM_CPP_POP_STREAM_BUFFER \ 280 _IOWR('V', BASE_VIDIOC_PRIVATE + 17, struct msm_camera_v4l2_ioctl_t) 281 282#define VIDIOC_MSM_CPP_IOMMU_ATTACH \ 283 _IOWR('V', BASE_VIDIOC_PRIVATE + 18, struct msm_camera_v4l2_ioctl_t) 284 285#define VIDIOC_MSM_CPP_IOMMU_DETACH \ 286 _IOWR('V', BASE_VIDIOC_PRIVATE + 19, struct msm_camera_v4l2_ioctl_t) 287 288#define VIDIOC_MSM_CPP_DELETE_STREAM_BUFF\ 289 _IOWR('V', BASE_VIDIOC_PRIVATE + 20, struct msm_camera_v4l2_ioctl_t) 290 291 292#define V4L2_EVENT_CPP_FRAME_DONE (V4L2_EVENT_PRIVATE_START + 0) 293#define V4L2_EVENT_VPE_FRAME_DONE (V4L2_EVENT_PRIVATE_START + 1) 294 295struct msm_camera_v4l2_ioctl_t { 296 uint32_t id; 297 uint32_t len; 298 int32_t trans_code; 299 void __user *ioctl_ptr; 300}; 301 302#ifdef CONFIG_COMPAT 303struct msm_cpp_frame_info32_t { 304 int32_t frame_id; 305 struct compat_timeval timestamp; 306 uint32_t inst_id; 307 uint32_t identity; 308 uint32_t client_id; 309 enum msm_cpp_frame_type frame_type; 310 uint32_t num_strips; 311 compat_caddr_t strip_info; 312 uint32_t msg_len; 313 compat_uint_t cpp_cmd_msg; 314 int src_fd; 315 int dst_fd; 316 struct compat_timeval in_time, out_time; 317 compat_caddr_t cookie; 318 compat_int_t status; 319 int32_t duplicate_output; 320 uint32_t duplicate_identity; 321 struct msm_cpp_buffer_info_t input_buffer_info; 322 struct msm_cpp_buffer_info_t output_buffer_info[2]; 323 struct msm_cpp_buffer_info_t tnr_scratch_buffer_info[2]; 324}; 325 326struct msm_cpp_stream_buff_info32_t { 327 uint32_t identity; 328 uint32_t num_buffs; 329 compat_caddr_t buffer_info; 330}; 331 332struct msm_pproc_queue_buf_info32_t { 333 struct msm_buf_mngr_info32_t buff_mgr_info; 334 uint8_t is_buf_dirty; 335}; 336 337#define VIDIOC_MSM_CPP_CFG32 \ 338 _IOWR('V', BASE_VIDIOC_PRIVATE, struct msm_camera_v4l2_ioctl32_t) 339 340#define VIDIOC_MSM_CPP_GET_EVENTPAYLOAD32 \ 341 _IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct msm_camera_v4l2_ioctl32_t) 342 343#define VIDIOC_MSM_CPP_GET_INST_INFO32 \ 344 _IOWR('V', BASE_VIDIOC_PRIVATE + 2, struct msm_camera_v4l2_ioctl32_t) 345 346#define VIDIOC_MSM_CPP_LOAD_FIRMWARE32 \ 347 _IOWR('V', BASE_VIDIOC_PRIVATE + 3, struct msm_camera_v4l2_ioctl32_t) 348 349#define VIDIOC_MSM_CPP_GET_HW_INFO32 \ 350 _IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct msm_camera_v4l2_ioctl32_t) 351 352#define VIDIOC_MSM_CPP_FLUSH_QUEUE32 \ 353 _IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct msm_camera_v4l2_ioctl32_t) 354 355#define VIDIOC_MSM_CPP_ENQUEUE_STREAM_BUFF_INFO32 \ 356 _IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct msm_camera_v4l2_ioctl32_t) 357 358#define VIDIOC_MSM_CPP_DEQUEUE_STREAM_BUFF_INFO32 \ 359 _IOWR('V', BASE_VIDIOC_PRIVATE + 7, struct msm_camera_v4l2_ioctl32_t) 360 361#define VIDIOC_MSM_VPE_CFG32 \ 362 _IOWR('V', BASE_VIDIOC_PRIVATE + 8, struct msm_camera_v4l2_ioctl32_t) 363 364#define VIDIOC_MSM_VPE_TRANSACTION_SETUP32 \ 365 _IOWR('V', BASE_VIDIOC_PRIVATE + 9, struct msm_camera_v4l2_ioctl32_t) 366 367#define VIDIOC_MSM_VPE_GET_EVENTPAYLOAD32 \ 368 _IOWR('V', BASE_VIDIOC_PRIVATE + 10, struct msm_camera_v4l2_ioctl32_t) 369 370#define VIDIOC_MSM_VPE_GET_INST_INFO32 \ 371 _IOWR('V', BASE_VIDIOC_PRIVATE + 11, struct msm_camera_v4l2_ioctl32_t) 372 373#define VIDIOC_MSM_VPE_ENQUEUE_STREAM_BUFF_INFO32 \ 374 _IOWR('V', BASE_VIDIOC_PRIVATE + 12, struct msm_camera_v4l2_ioctl32_t) 375 376#define VIDIOC_MSM_VPE_DEQUEUE_STREAM_BUFF_INFO32 \ 377 _IOWR('V', BASE_VIDIOC_PRIVATE + 13, struct msm_camera_v4l2_ioctl32_t) 378 379#define VIDIOC_MSM_CPP_QUEUE_BUF32 \ 380 _IOWR('V', BASE_VIDIOC_PRIVATE + 14, struct msm_camera_v4l2_ioctl32_t) 381 382#define VIDIOC_MSM_CPP_SET_CLOCK32 \ 383 _IOWR('V', BASE_VIDIOC_PRIVATE + 16, struct msm_camera_v4l2_ioctl32_t) 384 385#define VIDIOC_MSM_CPP_POP_STREAM_BUFFER32 \ 386 _IOWR('V', BASE_VIDIOC_PRIVATE + 17, struct msm_camera_v4l2_ioctl32_t) 387 388#define VIDIOC_MSM_CPP_IOMMU_ATTACH32 \ 389 _IOWR('V', BASE_VIDIOC_PRIVATE + 18, struct msm_camera_v4l2_ioctl32_t) 390 391#define VIDIOC_MSM_CPP_IOMMU_DETACH32 \ 392 _IOWR('V', BASE_VIDIOC_PRIVATE + 19, struct msm_camera_v4l2_ioctl32_t) 393 394#define VIDIOC_MSM_CPP_DELETE_STREAM_BUFF32\ 395 _IOWR('V', BASE_VIDIOC_PRIVATE + 20, struct msm_camera_v4l2_ioctl_t) 396 397struct msm_camera_v4l2_ioctl32_t { 398 uint32_t id; 399 uint32_t len; 400 int32_t trans_code; 401 compat_caddr_t ioctl_ptr; 402}; 403#endif 404 405#endif /* __MSMB_PPROC_H */ 406