1 #ifndef _MSM_VIDC_H_ 2 #define _MSM_VIDC_H_ 3 4 #ifdef __KERNEL__ 5 6 #include <linux/poll.h> 7 #include <linux/videodev2.h> 8 9 enum core_id { 10 MSM_VIDC_CORE_0 = 0, 11 MSM_VIDC_CORE_1, /* for Q6 core */ 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 21 void *msm_vidc_open(int core_id, int session_type); 22 int msm_vidc_close(void *instance); 23 int msm_vidc_querycap(void *instance, struct v4l2_capability *cap); 24 int msm_vidc_enum_fmt(void *instance, struct v4l2_fmtdesc *f); 25 int msm_vidc_s_fmt(void *instance, struct v4l2_format *f); 26 int msm_vidc_g_fmt(void *instance, struct v4l2_format *f); 27 int msm_vidc_s_ctrl(void *instance, struct v4l2_control *a); 28 int msm_vidc_s_ext_ctrl(void *instance, struct v4l2_ext_controls *a); 29 int msm_vidc_g_ctrl(void *instance, struct v4l2_control *a); 30 int msm_vidc_reqbufs(void *instance, struct v4l2_requestbuffers *b); 31 int msm_vidc_prepare_buf(void *instance, struct v4l2_buffer *b); 32 int msm_vidc_release_buffers(void *instance, int buffer_type); 33 int msm_vidc_qbuf(void *instance, struct v4l2_buffer *b); 34 int msm_vidc_dqbuf(void *instance, struct v4l2_buffer *b); 35 int msm_vidc_streamon(void *instance, enum v4l2_buf_type i); 36 int msm_vidc_streamoff(void *instance, enum v4l2_buf_type i); 37 int msm_vidc_decoder_cmd(void *instance, struct v4l2_decoder_cmd *dec); 38 int msm_vidc_encoder_cmd(void *instance, struct v4l2_encoder_cmd *enc); 39 int msm_vidc_poll(void *instance, struct file *filp, 40 struct poll_table_struct *pt); 41 int msm_vidc_get_iommu_domain_partition(void *instance, u32 flags, 42 enum v4l2_buf_type, int *domain, int *partition); 43 int msm_vidc_subscribe_event(void *instance, 44 struct v4l2_event_subscription *sub); 45 int msm_vidc_unsubscribe_event(void *instance, 46 struct v4l2_event_subscription *sub); 47 int msm_vidc_dqevent(void *instance, struct v4l2_event *event); 48 int msm_vidc_wait(void *instance); 49 int msm_vidc_s_parm(void *instance, struct v4l2_streamparm *a); 50 int msm_vidc_enum_framesizes(void *instance, struct v4l2_frmsizeenum *fsize); 51 #endif 52 struct msm_vidc_extradata_header { 53 unsigned int size; 54 unsigned int:32; /** Keeping binary compatibility */ 55 unsigned int:32; /* with firmware and OpenMAX IL **/ 56 unsigned int type; /* msm_vidc_extradata_type */ 57 unsigned int data_size; 58 unsigned char data[1]; 59 }; 60 struct msm_vidc_interlace_payload { 61 unsigned int format; 62 }; 63 struct msm_vidc_framerate_payload { 64 unsigned int frame_rate; 65 }; 66 struct msm_vidc_ts_payload { 67 unsigned int timestamp_lo; 68 unsigned int timestamp_hi; 69 }; 70 struct msm_vidc_concealmb_payload { 71 unsigned int num_mbs; 72 }; 73 struct msm_vidc_recoverysei_payload { 74 unsigned int flags; 75 }; 76 struct msm_vidc_aspect_ratio_payload { 77 unsigned int size; 78 unsigned int version; 79 unsigned int port_index; 80 unsigned int aspect_width; 81 unsigned int aspect_height; 82 }; 83 struct msm_vidc_mpeg2_seqdisp_payload { 84 unsigned int video_format; 85 bool color_descp; 86 unsigned int color_primaries; 87 unsigned int transfer_char; 88 unsigned int matrix_coeffs; 89 unsigned int disp_width; 90 unsigned int disp_height; 91 }; 92 struct msm_vidc_input_crop_payload { 93 unsigned int size; 94 unsigned int version; 95 unsigned int port_index; 96 unsigned int left; 97 unsigned int top; 98 unsigned int width; 99 unsigned int height; 100 }; 101 struct msm_vidc_digital_zoom_payload { 102 unsigned int size; 103 unsigned int version; 104 unsigned int port_index; 105 unsigned int zoom_width; 106 unsigned int zoom_height; 107 }; 108 struct msm_vidc_extradata_index { 109 unsigned int type; 110 union { 111 struct msm_vidc_input_crop_payload input_crop; 112 struct msm_vidc_digital_zoom_payload digital_zoom; 113 struct msm_vidc_aspect_ratio_payload aspect_ratio; 114 }; 115 }; 116 struct msm_vidc_panscan_window { 117 unsigned int panscan_height_offset; 118 unsigned int panscan_width_offset; 119 unsigned int panscan_window_width; 120 unsigned int panscan_window_height; 121 }; 122 struct msm_vidc_panscan_window_payload { 123 unsigned int num_panscan_windows; 124 struct msm_vidc_panscan_window wnd[1]; 125 }; 126 struct msm_vidc_stream_userdata_payload { 127 unsigned int type; 128 unsigned int data[1]; 129 }; 130 struct msm_vidc_frame_qp_payload { 131 unsigned int frame_qp; 132 }; 133 struct msm_vidc_frame_bits_info_payload { 134 unsigned int frame_bits; 135 unsigned int header_bits; 136 }; 137 struct msm_vidc_s3d_frame_packing_payload { 138 unsigned int fpa_id; 139 unsigned int cancel_flag; 140 unsigned int fpa_type; 141 unsigned int quin_cunx_flag; 142 unsigned int content_interprtation_type; 143 unsigned int spatial_flipping_flag; 144 unsigned int frame0_flipped_flag; 145 unsigned int field_views_flag; 146 unsigned int current_frame_is_frame0_flag; 147 unsigned int frame0_self_contained_flag; 148 unsigned int frame1_self_contained_flag; 149 unsigned int frame0_graid_pos_x; 150 unsigned int frame0_graid_pos_y; 151 unsigned int frame1_graid_pos_x; 152 unsigned int frame1_graid_pos_y; 153 unsigned int fpa_reserved_byte; 154 unsigned int fpa_repetition_period; 155 unsigned int fpa_extension_flag; 156 }; 157 158 struct msm_vidc_vui_display_info_payload { 159 unsigned int video_signal_present_flag; 160 unsigned int video_format; 161 unsigned int bit_depth_y; 162 unsigned int bit_depth_c; 163 unsigned int video_full_range_flag; 164 unsigned int color_description_present_flag; 165 unsigned int color_primaries; 166 unsigned int transfer_characteristics; 167 unsigned int matrix_coefficients; 168 unsigned int chroma_location_info_present_flag; 169 unsigned int chroma_format_idc; 170 unsigned int separate_color_plane_flag; 171 unsigned int chroma_sample_loc_type_top_field; 172 unsigned int chroma_sample_loc_type_bottom_field; 173 }; 174 175 176 enum msm_vidc_extradata_type { 177 MSM_VIDC_EXTRADATA_NONE = 0x00000000, 178 MSM_VIDC_EXTRADATA_MB_QUANTIZATION = 0x00000001, 179 MSM_VIDC_EXTRADATA_INTERLACE_VIDEO = 0x00000002, 180 MSM_VIDC_EXTRADATA_VC1_FRAMEDISP = 0x00000003, 181 MSM_VIDC_EXTRADATA_VC1_SEQDISP = 0x00000004, 182 MSM_VIDC_EXTRADATA_TIMESTAMP = 0x00000005, 183 MSM_VIDC_EXTRADATA_S3D_FRAME_PACKING = 0x00000006, 184 MSM_VIDC_EXTRADATA_FRAME_RATE = 0x00000007, 185 MSM_VIDC_EXTRADATA_PANSCAN_WINDOW = 0x00000008, 186 MSM_VIDC_EXTRADATA_RECOVERY_POINT_SEI = 0x00000009, 187 MSM_VIDC_EXTRADATA_MPEG2_SEQDISP = 0x0000000D, 188 MSM_VIDC_EXTRADATA_STREAM_USERDATA = 0x0000000E, 189 MSM_VIDC_EXTRADATA_FRAME_QP = 0x0000000F, 190 MSM_VIDC_EXTRADATA_FRAME_BITS_INFO = 0x00000010, 191 MSM_VIDC_EXTRADATA_INPUT_CROP = 0x0700000E, 192 MSM_VIDC_EXTRADATA_DIGITAL_ZOOM = 0x07000010, 193 MSM_VIDC_EXTRADATA_MULTISLICE_INFO = 0x7F100000, 194 MSM_VIDC_EXTRADATA_NUM_CONCEALED_MB = 0x7F100001, 195 MSM_VIDC_EXTRADATA_INDEX = 0x7F100002, 196 MSM_VIDC_EXTRADATA_ASPECT_RATIO = 0x7F100003, 197 MSM_VIDC_EXTRADATA_METADATA_LTR = 0x7F100004, 198 MSM_VIDC_EXTRADATA_METADATA_FILLER = 0x7FE00002, 199 MSM_VIDC_EXTRADATA_METADATA_MBI = 0x7F100005, 200 MSM_VIDC_EXTRADATA_VUI_DISPLAY_INFO = 0x7F100006, 201 }; 202 enum msm_vidc_interlace_type { 203 MSM_VIDC_INTERLACE_FRAME_PROGRESSIVE = 0x01, 204 MSM_VIDC_INTERLACE_INTERLEAVE_FRAME_TOPFIELDFIRST = 0x02, 205 MSM_VIDC_INTERLACE_INTERLEAVE_FRAME_BOTTOMFIELDFIRST = 0x04, 206 MSM_VIDC_INTERLACE_FRAME_TOPFIELDFIRST = 0x08, 207 MSM_VIDC_INTERLACE_FRAME_BOTTOMFIELDFIRST = 0x10, 208 }; 209 enum msm_vidc_recovery_sei { 210 MSM_VIDC_FRAME_RECONSTRUCTION_INCORRECT = 0x0, 211 MSM_VIDC_FRAME_RECONSTRUCTION_CORRECT = 0x01, 212 MSM_VIDC_FRAME_RECONSTRUCTION_APPROXIMATELY_CORRECT = 0x02, 213 }; 214 enum msm_vidc_userdata_type { 215 MSM_VIDC_USERDATA_TYPE_FRAME = 0x1, 216 MSM_VIDC_USERDATA_TYPE_TOP_FIELD = 0x2, 217 MSM_VIDC_USERDATA_TYPE_BOTTOM_FIELD = 0x3, 218 }; 219 220 #endif 221