Vinay Kalia | 3766b1e | 2012-01-11 18:58:41 -0800 | [diff] [blame] | 1 | #ifndef _MSM_VIDC_H_ |
| 2 | #define _MSM_VIDC_H_ |
| 3 | |
Praneeth Paladugu | f181267 | 2012-12-06 12:19:42 -0800 | [diff] [blame] | 4 | #ifdef __KERNEL__ |
| 5 | |
Vinay Kalia | 3766b1e | 2012-01-11 18:58:41 -0800 | [diff] [blame] | 6 | #include <linux/poll.h> |
Deva Ramasubramanian | 7d12f84 | 2012-07-03 15:10:49 -0700 | [diff] [blame] | 7 | #include <linux/videodev2.h> |
Vinay Kalia | 3766b1e | 2012-01-11 18:58:41 -0800 | [diff] [blame] | 8 | |
| 9 | enum core_id { |
Arun Menon | 6808d41 | 2013-12-30 16:18:35 -0800 | [diff] [blame] | 10 | MSM_VIDC_CORE_VENUS = 0, |
| 11 | MSM_VIDC_CORE_Q6, |
Vinay Kalia | 3766b1e | 2012-01-11 18:58:41 -0800 | [diff] [blame] | 12 | MSM_VIDC_CORES_MAX, |
| 13 | }; |
| 14 | |
| 15 | enum session_type { |
| 16 | MSM_VIDC_ENCODER = 0, |
| 17 | MSM_VIDC_DECODER, |
| 18 | MSM_VIDC_MAX_DEVICES, |
| 19 | }; |
| 20 | |
Arun Menon | 952878b | 2013-11-04 17:34:24 -0800 | [diff] [blame] | 21 | /* NOTE: if you change this enum you MUST update the |
| 22 | * "buffer-type-tz-usage-table" for any affected target |
| 23 | * in arch/arm/boot/dts/<arch>.dtsi |
| 24 | */ |
| 25 | enum hal_buffer { |
| 26 | HAL_BUFFER_INPUT = 0x1, |
| 27 | HAL_BUFFER_OUTPUT = 0x2, |
| 28 | HAL_BUFFER_OUTPUT2 = 0x4, |
| 29 | HAL_BUFFER_EXTRADATA_INPUT = 0x8, |
| 30 | HAL_BUFFER_EXTRADATA_OUTPUT = 0x10, |
| 31 | HAL_BUFFER_EXTRADATA_OUTPUT2 = 0x20, |
| 32 | HAL_BUFFER_INTERNAL_SCRATCH = 0x40, |
| 33 | HAL_BUFFER_INTERNAL_SCRATCH_1 = 0x80, |
| 34 | HAL_BUFFER_INTERNAL_SCRATCH_2 = 0x100, |
| 35 | HAL_BUFFER_INTERNAL_PERSIST = 0x200, |
| 36 | HAL_BUFFER_INTERNAL_PERSIST_1 = 0x400, |
| 37 | HAL_BUFFER_INTERNAL_CMD_QUEUE = 0x800, |
| 38 | }; |
| 39 | |
| 40 | struct msm_smem { |
| 41 | int mem_type; |
| 42 | size_t size; |
| 43 | void *kvaddr; |
| 44 | unsigned long device_addr; |
| 45 | u32 flags; |
| 46 | void *smem_priv; |
| 47 | enum hal_buffer buffer_type; |
| 48 | }; |
| 49 | |
| 50 | enum smem_cache_ops { |
| 51 | SMEM_CACHE_CLEAN, |
| 52 | SMEM_CACHE_INVALIDATE, |
| 53 | SMEM_CACHE_CLEAN_INVALIDATE, |
| 54 | }; |
| 55 | |
Deva Ramasubramanian | 7d12f84 | 2012-07-03 15:10:49 -0700 | [diff] [blame] | 56 | void *msm_vidc_open(int core_id, int session_type); |
Vinay Kalia | 3766b1e | 2012-01-11 18:58:41 -0800 | [diff] [blame] | 57 | int msm_vidc_close(void *instance); |
| 58 | int msm_vidc_querycap(void *instance, struct v4l2_capability *cap); |
| 59 | int msm_vidc_enum_fmt(void *instance, struct v4l2_fmtdesc *f); |
| 60 | int msm_vidc_s_fmt(void *instance, struct v4l2_format *f); |
| 61 | int msm_vidc_g_fmt(void *instance, struct v4l2_format *f); |
| 62 | int msm_vidc_s_ctrl(void *instance, struct v4l2_control *a); |
Ashray Kulkarni | 745bc09 | 2013-11-12 19:04:02 -0800 | [diff] [blame] | 63 | int msm_vidc_s_ext_ctrl(void *instance, struct v4l2_ext_controls *a); |
Vinay Kalia | 3766b1e | 2012-01-11 18:58:41 -0800 | [diff] [blame] | 64 | int msm_vidc_g_ctrl(void *instance, struct v4l2_control *a); |
| 65 | int msm_vidc_reqbufs(void *instance, struct v4l2_requestbuffers *b); |
| 66 | int msm_vidc_prepare_buf(void *instance, struct v4l2_buffer *b); |
Arun Menon | 72a2315 | 2013-07-26 16:50:54 -0700 | [diff] [blame] | 67 | int msm_vidc_release_buffers(void *instance, int buffer_type); |
Vinay Kalia | 3766b1e | 2012-01-11 18:58:41 -0800 | [diff] [blame] | 68 | int msm_vidc_qbuf(void *instance, struct v4l2_buffer *b); |
| 69 | int msm_vidc_dqbuf(void *instance, struct v4l2_buffer *b); |
| 70 | int msm_vidc_streamon(void *instance, enum v4l2_buf_type i); |
| 71 | int msm_vidc_streamoff(void *instance, enum v4l2_buf_type i); |
Praneeth Paladugu | f2acb85 | 2012-05-07 17:44:53 -0700 | [diff] [blame] | 72 | int msm_vidc_decoder_cmd(void *instance, struct v4l2_decoder_cmd *dec); |
Praneeth Paladugu | e541526 | 2012-08-01 16:21:08 -0700 | [diff] [blame] | 73 | int msm_vidc_encoder_cmd(void *instance, struct v4l2_encoder_cmd *enc); |
Vinay Kalia | 3766b1e | 2012-01-11 18:58:41 -0800 | [diff] [blame] | 74 | int msm_vidc_poll(void *instance, struct file *filp, |
| 75 | struct poll_table_struct *pt); |
Shalaj Jain | d4191bc | 2013-03-01 17:33:20 -0800 | [diff] [blame] | 76 | int msm_vidc_get_iommu_domain_partition(void *instance, u32 flags, |
| 77 | enum v4l2_buf_type, int *domain, int *partition); |
Deva Ramasubramanian | 7d12f84 | 2012-07-03 15:10:49 -0700 | [diff] [blame] | 78 | int msm_vidc_subscribe_event(void *instance, |
| 79 | struct v4l2_event_subscription *sub); |
| 80 | int msm_vidc_unsubscribe_event(void *instance, |
| 81 | struct v4l2_event_subscription *sub); |
| 82 | int msm_vidc_dqevent(void *instance, struct v4l2_event *event); |
Deva Ramasubramanian | 106f518 | 2012-07-06 15:08:22 -0700 | [diff] [blame] | 83 | int msm_vidc_wait(void *instance); |
Praneeth Paladugu | 1f0c265 | 2012-10-22 15:47:52 -0700 | [diff] [blame] | 84 | int msm_vidc_s_parm(void *instance, struct v4l2_streamparm *a); |
Arun Menon | 7712081 | 2013-03-11 16:51:30 -0700 | [diff] [blame] | 85 | int msm_vidc_enum_framesizes(void *instance, struct v4l2_frmsizeenum *fsize); |
Arun Menon | 952878b | 2013-11-04 17:34:24 -0800 | [diff] [blame] | 86 | struct msm_smem *msm_vidc_smem_alloc(void *instance, |
| 87 | size_t size, u32 align, u32 flags, |
| 88 | enum hal_buffer buffer_type, int map_kernel); |
| 89 | void msm_vidc_smem_free(void *instance, struct msm_smem *mem); |
| 90 | int msm_vidc_smem_cache_operations(void *instance, |
| 91 | struct msm_smem *mem, enum smem_cache_ops); |
| 92 | struct msm_smem *msm_vidc_smem_user_to_kernel(void *instance, |
| 93 | int fd, u32 offset, enum hal_buffer buffer_type); |
| 94 | int msm_vidc_smem_get_domain_partition(void *instance, |
| 95 | u32 flags, enum hal_buffer buffer_type, |
| 96 | int *domain_num, int *partition_num); |
| 97 | void *msm_vidc_smem_get_client(void *instance); |
Vinay Kalia | 3766b1e | 2012-01-11 18:58:41 -0800 | [diff] [blame] | 98 | #endif |
Deva Ramasubramanian | fbd85b7 | 2014-01-09 18:38:11 -0800 | [diff] [blame] | 99 | |
| 100 | struct msm_vidc_extradata_header { |
| 101 | unsigned int size; |
| 102 | unsigned int:32; /** Keeping binary compatibility */ |
| 103 | unsigned int:32; /* with firmware and OpenMAX IL **/ |
| 104 | unsigned int type; /* msm_vidc_extradata_type */ |
| 105 | unsigned int data_size; |
| 106 | unsigned char data[1]; |
| 107 | }; |
| 108 | |
Praneeth Paladugu | f181267 | 2012-12-06 12:19:42 -0800 | [diff] [blame] | 109 | struct msm_vidc_interlace_payload { |
| 110 | unsigned int format; |
| 111 | }; |
| 112 | struct msm_vidc_framerate_payload { |
| 113 | unsigned int frame_rate; |
| 114 | }; |
| 115 | struct msm_vidc_ts_payload { |
Praneeth Paladugu | f181267 | 2012-12-06 12:19:42 -0800 | [diff] [blame] | 116 | unsigned int timestamp_lo; |
Praneeth Paladugu | 7d7f9d6 | 2013-01-27 17:49:36 -0800 | [diff] [blame] | 117 | unsigned int timestamp_hi; |
Praneeth Paladugu | f181267 | 2012-12-06 12:19:42 -0800 | [diff] [blame] | 118 | }; |
| 119 | struct msm_vidc_concealmb_payload { |
| 120 | unsigned int num_mbs; |
| 121 | }; |
| 122 | struct msm_vidc_recoverysei_payload { |
| 123 | unsigned int flags; |
| 124 | }; |
Praneeth Paladugu | 7d7f9d6 | 2013-01-27 17:49:36 -0800 | [diff] [blame] | 125 | |
| 126 | struct msm_vidc_aspect_ratio_payload { |
| 127 | unsigned int size; |
| 128 | unsigned int version; |
| 129 | unsigned int port_index; |
| 130 | unsigned int aspect_width; |
| 131 | unsigned int aspect_height; |
| 132 | }; |
| 133 | |
Praneeth Paladugu | 8efc273 | 2013-04-23 22:59:21 -0700 | [diff] [blame] | 134 | struct msm_vidc_mpeg2_seqdisp_payload { |
| 135 | unsigned int video_format; |
| 136 | bool color_descp; |
| 137 | unsigned int color_primaries; |
| 138 | unsigned int transfer_char; |
| 139 | unsigned int matrix_coeffs; |
| 140 | unsigned int disp_width; |
| 141 | unsigned int disp_height; |
| 142 | }; |
| 143 | |
Praneeth Paladugu | f181267 | 2012-12-06 12:19:42 -0800 | [diff] [blame] | 144 | struct msm_vidc_panscan_window { |
| 145 | unsigned int panscan_height_offset; |
| 146 | unsigned int panscan_width_offset; |
| 147 | unsigned int panscan_window_width; |
| 148 | unsigned int panscan_window_height; |
| 149 | }; |
| 150 | struct msm_vidc_panscan_window_payload { |
| 151 | unsigned int num_panscan_windows; |
| 152 | struct msm_vidc_panscan_window wnd[1]; |
| 153 | }; |
Maheshwar Ajja | 38062d6 | 2013-10-24 19:12:31 +0530 | [diff] [blame] | 154 | struct msm_vidc_s3d_frame_packing_payload { |
| 155 | unsigned int fpa_id; |
| 156 | unsigned int cancel_flag; |
| 157 | unsigned int fpa_type; |
| 158 | unsigned int quin_cunx_flag; |
| 159 | unsigned int content_interprtation_type; |
| 160 | unsigned int spatial_flipping_flag; |
| 161 | unsigned int frame0_flipped_flag; |
| 162 | unsigned int field_views_flag; |
| 163 | unsigned int current_frame_is_frame0_flag; |
| 164 | unsigned int frame0_self_contained_flag; |
| 165 | unsigned int frame1_self_contained_flag; |
| 166 | unsigned int frame0_graid_pos_x; |
| 167 | unsigned int frame0_graid_pos_y; |
| 168 | unsigned int frame1_graid_pos_x; |
| 169 | unsigned int frame1_graid_pos_y; |
| 170 | unsigned int fpa_reserved_byte; |
| 171 | unsigned int fpa_repetition_period; |
| 172 | unsigned int fpa_extension_flag; |
| 173 | }; |
Jorge Solano Altamirano | be8961e | 2013-11-06 17:14:09 -0800 | [diff] [blame] | 174 | struct msm_vidc_frame_qp_payload { |
| 175 | unsigned int frame_qp; |
| 176 | }; |
Jorge Solano Altamirano | e8d995e | 2013-11-06 17:14:09 -0800 | [diff] [blame] | 177 | struct msm_vidc_frame_bits_info_payload { |
| 178 | unsigned int frame_bits; |
| 179 | unsigned int header_bits; |
| 180 | }; |
Maheshwar Ajja | 38062d6 | 2013-10-24 19:12:31 +0530 | [diff] [blame] | 181 | |
Praneeth Paladugu | f181267 | 2012-12-06 12:19:42 -0800 | [diff] [blame] | 182 | enum msm_vidc_extradata_type { |
| 183 | EXTRADATA_NONE = 0x00000000, |
| 184 | EXTRADATA_MB_QUANTIZATION = 0x00000001, |
| 185 | EXTRADATA_INTERLACE_VIDEO = 0x00000002, |
| 186 | EXTRADATA_VC1_FRAMEDISP = 0x00000003, |
| 187 | EXTRADATA_VC1_SEQDISP = 0x00000004, |
| 188 | EXTRADATA_TIMESTAMP = 0x00000005, |
| 189 | EXTRADATA_S3D_FRAME_PACKING = 0x00000006, |
| 190 | EXTRADATA_FRAME_RATE = 0x00000007, |
| 191 | EXTRADATA_PANSCAN_WINDOW = 0x00000008, |
| 192 | EXTRADATA_RECOVERY_POINT_SEI = 0x00000009, |
Praneeth Paladugu | 8efc273 | 2013-04-23 22:59:21 -0700 | [diff] [blame] | 193 | EXTRADATA_MPEG2_SEQDISP = 0x0000000D, |
Jorge Solano Altamirano | be8961e | 2013-11-06 17:14:09 -0800 | [diff] [blame] | 194 | EXTRADATA_FRAME_QP = 0x0000000F, |
Jorge Solano Altamirano | e8d995e | 2013-11-06 17:14:09 -0800 | [diff] [blame] | 195 | EXTRADATA_FRAME_BITS_INFO = 0x00000010, |
Praneeth Paladugu | f181267 | 2012-12-06 12:19:42 -0800 | [diff] [blame] | 196 | EXTRADATA_MULTISLICE_INFO = 0x7F100000, |
| 197 | EXTRADATA_NUM_CONCEALED_MB = 0x7F100001, |
| 198 | EXTRADATA_INDEX = 0x7F100002, |
Praneeth Paladugu | 7d7f9d6 | 2013-01-27 17:49:36 -0800 | [diff] [blame] | 199 | EXTRADATA_ASPECT_RATIO = 0x7F100003, |
Praneeth Paladugu | f181267 | 2012-12-06 12:19:42 -0800 | [diff] [blame] | 200 | EXTRADATA_METADATA_FILLER = 0x7FE00002, |
Ashray Kulkarni | 637e2a3 | 2014-01-29 21:42:15 -0800 | [diff] [blame] | 201 | MSM_VIDC_EXTRADATA_METADATA_LTR = 0x7F100004, |
Deva Ramasubramanian | fbd85b7 | 2014-01-09 18:38:11 -0800 | [diff] [blame] | 202 | EXTRADATA_METADATA_MBI = 0x7F100005, |
Praneeth Paladugu | f181267 | 2012-12-06 12:19:42 -0800 | [diff] [blame] | 203 | }; |
| 204 | enum msm_vidc_interlace_type { |
| 205 | INTERLACE_FRAME_PROGRESSIVE = 0x01, |
| 206 | INTERLACE_INTERLEAVE_FRAME_TOPFIELDFIRST = 0x02, |
| 207 | INTERLACE_INTERLEAVE_FRAME_BOTTOMFIELDFIRST = 0x04, |
| 208 | INTERLACE_FRAME_TOPFIELDFIRST = 0x08, |
| 209 | INTERLACE_FRAME_BOTTOMFIELDFIRST = 0x10, |
| 210 | }; |
| 211 | enum msm_vidc_recovery_sei { |
| 212 | FRAME_RECONSTRUCTION_INCORRECT = 0x0, |
| 213 | FRAME_RECONSTRUCTION_CORRECT = 0x01, |
| 214 | FRAME_RECONSTRUCTION_APPROXIMATELY_CORRECT = 0x02, |
| 215 | }; |
| 216 | |
| 217 | #endif |