Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | #ifndef _MSM_VDEC_H_ |
| 2 | #define _MSM_VDEC_H_ |
| 3 | |
| 4 | #include <linux/types.h> |
| 5 | |
| 6 | #define VDEC_IOCTL_MAGIC 'v' |
| 7 | |
| 8 | #define VDEC_IOCTL_INITIALIZE _IOWR(VDEC_IOCTL_MAGIC, 1, struct vdec_init) |
| 9 | #define VDEC_IOCTL_SETBUFFERS _IOW(VDEC_IOCTL_MAGIC, 2, struct vdec_buffer) |
| 10 | #define VDEC_IOCTL_QUEUE _IOWR(VDEC_IOCTL_MAGIC, 3, \ |
| 11 | struct vdec_input_buf) |
| 12 | #define VDEC_IOCTL_REUSEFRAMEBUFFER _IOW(VDEC_IOCTL_MAGIC, 4, unsigned int) |
| 13 | #define VDEC_IOCTL_FLUSH _IOW(VDEC_IOCTL_MAGIC, 5, unsigned int) |
| 14 | #define VDEC_IOCTL_EOS _IO(VDEC_IOCTL_MAGIC, 6) |
| 15 | #define VDEC_IOCTL_GETMSG _IOR(VDEC_IOCTL_MAGIC, 7, struct vdec_msg) |
| 16 | #define VDEC_IOCTL_CLOSE _IO(VDEC_IOCTL_MAGIC, 8) |
| 17 | #define VDEC_IOCTL_FREEBUFFERS _IOW(VDEC_IOCTL_MAGIC, 9, struct vdec_buf_info) |
| 18 | #define VDEC_IOCTL_GETDECATTRIBUTES _IOR(VDEC_IOCTL_MAGIC, 10, \ |
| 19 | struct vdec_dec_attributes) |
| 20 | #define VDEC_IOCTL_GETVERSION _IOR(VDEC_IOCTL_MAGIC, 11, struct vdec_version) |
| 21 | #define VDEC_IOCTL_SETPROPERTY _IOW \ |
| 22 | (VDEC_IOCTL_MAGIC, 12, struct vdec_property_info) |
| 23 | #define VDEC_IOCTL_GETPROPERTY _IOR \ |
| 24 | (VDEC_IOCTL_MAGIC, 13, struct vdec_property_info) |
| 25 | #define VDEC_IOCTL_PERFORMANCE_CHANGE_REQ _IOW(VDEC_IOCTL_MAGIC, 14, \ |
| 26 | unsigned int) |
| 27 | |
| 28 | enum { |
| 29 | VDEC_FRAME_DECODE_OK, |
| 30 | VDEC_FRAME_DECODE_ERR, |
| 31 | VDEC_FATAL_ERR, |
| 32 | VDEC_FLUSH_FINISH, |
| 33 | VDEC_EOS, |
| 34 | VDEC_FRAME_FLUSH, |
| 35 | VDEC_STREAM_SWITCH, |
| 36 | VDEC_SUSPEND_FINISH, |
| 37 | VDEC_BUFFER_CONSUMED |
| 38 | }; |
| 39 | |
| 40 | enum { |
| 41 | VDEC_FLUSH_INPUT, |
| 42 | VDEC_FLUSH_OUTPUT, |
| 43 | VDEC_FLUSH_ALL |
| 44 | }; |
| 45 | |
| 46 | enum { |
| 47 | VDEC_BUFFER_TYPE_INPUT, |
| 48 | VDEC_BUFFER_TYPE_OUTPUT, |
| 49 | VDEC_BUFFER_TYPE_INTERNAL1, |
| 50 | VDEC_BUFFER_TYPE_INTERNAL2, |
| 51 | }; |
| 52 | |
| 53 | enum { |
| 54 | VDEC_QUEUE_SUCCESS, |
| 55 | VDEC_QUEUE_FAILED, |
| 56 | VDEC_QUEUE_BADSTATE, |
| 57 | }; |
| 58 | |
| 59 | enum { |
| 60 | VDEC_COLOR_FORMAT_NV21 = 0x01, |
| 61 | VDEC_COLOR_FORMAT_NV21_YAMOTO = 0x02 |
| 62 | }; |
| 63 | |
| 64 | enum vdec_property_id { |
| 65 | VDEC_FOURCC, |
| 66 | VDEC_PROFILE, |
| 67 | VDEC_LEVEL, |
| 68 | VDEC_DIMENSIONS, |
| 69 | VDEC_CWIN, |
| 70 | VDEC_INPUT_BUF_REQ, |
| 71 | VDEC_OUTPUT_BUF_REQ, |
| 72 | VDEC_LUMA_CHROMA_STRIDE, |
| 73 | VDEC_NUM_DAL_PORTS, |
| 74 | VDEC_PRIORITY, |
| 75 | VDEC_FRAME_ALIGNMENT |
| 76 | }; |
| 77 | |
| 78 | enum { |
| 79 | PERF_REQUEST_SET_MIN = 0, |
| 80 | PERF_REQUEST_LOWER, |
| 81 | PERF_REQUEST_RAISE, |
| 82 | PERF_REQUEST_SET_MAX |
| 83 | }; |
| 84 | |
| 85 | struct vdec_input_buf_info { |
| 86 | u32 offset; |
| 87 | u32 data; |
| 88 | u32 size; |
| 89 | int timestamp_lo; |
| 90 | int timestamp_hi; |
| 91 | int avsync_state; |
| 92 | u32 flags; |
| 93 | }; |
| 94 | |
| 95 | struct vdec_buf_desc { |
| 96 | u32 bufsize; |
| 97 | u32 num_min_buffers; |
| 98 | u32 num_max_buffers; |
| 99 | }; |
| 100 | |
| 101 | struct vdec_buf_req { |
| 102 | u32 max_input_queue_size; |
| 103 | struct vdec_buf_desc input; |
| 104 | struct vdec_buf_desc output; |
| 105 | struct vdec_buf_desc dec_req1; |
| 106 | struct vdec_buf_desc dec_req2; |
| 107 | }; |
| 108 | |
| 109 | struct vdec_region_info { |
| 110 | u32 src_id; |
| 111 | u32 offset; |
| 112 | u32 size; |
| 113 | }; |
| 114 | |
| 115 | struct vdec_config { |
| 116 | u32 fourcc; /* video format */ |
| 117 | u32 width; /* source width */ |
| 118 | u32 height; /* source height */ |
| 119 | u32 order; /* render decoder order */ |
| 120 | u32 notify_enable; /* enable notify input buffer done event */ |
| 121 | u32 vc1_rowbase; |
| 122 | u32 h264_startcode_detect; |
| 123 | u32 h264_nal_len_size; |
| 124 | u32 postproc_flag; |
| 125 | u32 fruc_enable; |
| 126 | u32 color_format; /* used to set YUV color format */ |
| 127 | }; |
| 128 | |
| 129 | struct vdec_vc1_panscan_regions { |
| 130 | int num; |
| 131 | int width[4]; |
| 132 | int height[4]; |
| 133 | int xoffset[4]; |
| 134 | int yoffset[4]; |
| 135 | }; |
| 136 | |
| 137 | struct vdec_cropping_window { |
| 138 | u32 x1; |
| 139 | u32 y1; |
| 140 | u32 x2; |
| 141 | u32 y2; |
| 142 | }; |
| 143 | |
| 144 | struct vdec_frame_info { |
| 145 | u32 status; /* video decode status */ |
| 146 | u32 offset; /* buffer offset */ |
| 147 | u32 data1; /* user data field 1 */ |
| 148 | u32 data2; /* user data field 2 */ |
| 149 | int timestamp_lo; /* lower 32 bits timestamp, in msec */ |
| 150 | int timestamp_hi; /* higher 32 bits timestamp, in msec */ |
| 151 | int cal_timestamp_lo; /* lower 32 bits cal timestamp, in msec */ |
| 152 | int cal_timestamp_hi; /* higher 32 bits cal timestamp, in msec */ |
| 153 | u32 dec_width; /* frame roi width */ |
| 154 | u32 dec_height; /* frame roi height */ |
| 155 | struct vdec_cropping_window cwin; /* The frame cropping window */ |
| 156 | u32 picture_type[2]; /* picture coding type */ |
| 157 | u32 picture_format; /* picture coding format */ |
| 158 | u32 vc1_rangeY; /* luma range mapping */ |
| 159 | u32 vc1_rangeUV; /* chroma range mapping */ |
| 160 | u32 picture_resolution; /* scaling factor */ |
| 161 | u32 frame_disp_repeat; /* how often repeated by disp */ |
| 162 | u32 repeat_first_field; /* repeat 1st field after 2nd */ |
| 163 | u32 top_field_first; /* top field displayed first */ |
| 164 | u32 interframe_interp; /* not for inter-frame interp */ |
| 165 | struct vdec_vc1_panscan_regions panscan; /* pan region */ |
| 166 | u32 concealed_macblk_num; /* number of concealed macro blk */ |
| 167 | u32 flags; /* input flags */ |
| 168 | u32 performance_stats; /* performance statistics returned by decoder */ |
| 169 | u32 data3; /* user data field 3 */ |
| 170 | }; |
| 171 | |
| 172 | struct vdec_buf_info { |
| 173 | u32 buf_type; |
| 174 | struct vdec_region_info region; |
| 175 | u32 num_buf; |
| 176 | u32 islast; |
| 177 | }; |
| 178 | |
| 179 | struct vdec_buffer { |
| 180 | u32 pmem_id; |
| 181 | struct vdec_buf_info buf; |
| 182 | }; |
| 183 | |
| 184 | struct vdec_sequence { |
| 185 | u8 *header; |
| 186 | u32 len; |
| 187 | }; |
| 188 | |
| 189 | struct vdec_config_sps { |
| 190 | struct vdec_config cfg; |
| 191 | struct vdec_sequence seq; |
| 192 | }; |
| 193 | |
| 194 | #define VDEC_MSG_REUSEINPUTBUFFER 1 |
| 195 | #define VDEC_MSG_FRAMEDONE 2 |
| 196 | |
| 197 | struct vdec_msg { |
| 198 | u32 id; |
| 199 | |
| 200 | union { |
| 201 | /* id = VDEC_MSG_REUSEINPUTBUFFER */ |
| 202 | u32 buf_id; |
| 203 | /* id = VDEC_MSG_FRAMEDONE */ |
| 204 | struct vdec_frame_info vfr_info; |
| 205 | }; |
| 206 | }; |
| 207 | |
| 208 | struct vdec_init { |
| 209 | struct vdec_config_sps sps_cfg; |
| 210 | struct vdec_buf_req *buf_req; |
| 211 | }; |
| 212 | |
| 213 | struct vdec_input_buf { |
| 214 | u32 pmem_id; |
| 215 | struct vdec_input_buf_info buffer; |
| 216 | struct vdec_queue_status *queue_status; |
| 217 | }; |
| 218 | |
| 219 | struct vdec_queue_status { |
| 220 | u32 status; |
| 221 | }; |
| 222 | |
| 223 | struct vdec_dec_attributes { |
| 224 | u32 fourcc; |
| 225 | u32 profile; |
| 226 | u32 level; |
| 227 | u32 dec_pic_width; |
| 228 | u32 dec_pic_height; |
| 229 | struct vdec_buf_desc input; |
| 230 | struct vdec_buf_desc output; |
| 231 | struct vdec_buf_desc dec_req1; |
| 232 | struct vdec_buf_desc dec_req2; |
| 233 | }; |
| 234 | |
| 235 | struct vdec_version { |
| 236 | u32 major; |
| 237 | u32 minor; |
| 238 | }; |
| 239 | |
| 240 | struct dal_vdec_rectangle { |
| 241 | u32 width; |
| 242 | u32 height; |
| 243 | }; |
| 244 | |
| 245 | struct stride_type { |
| 246 | u32 luma; |
| 247 | u32 chroma; |
| 248 | }; |
| 249 | |
| 250 | struct frame_alignment_type { |
| 251 | u32 luma_width; |
| 252 | u32 luma_height; |
| 253 | u32 chroma_width; |
| 254 | u32 chroma_height; |
| 255 | u32 chroma_offset; |
| 256 | }; |
| 257 | |
| 258 | union vdec_property { |
| 259 | u32 fourcc; |
| 260 | u32 profile; |
| 261 | u32 level; |
| 262 | struct dal_vdec_rectangle dim; |
| 263 | struct vdec_cropping_window cw; |
| 264 | struct vdec_buf_desc input_req; |
| 265 | struct vdec_buf_desc output_req; |
| 266 | struct stride_type stride; |
| 267 | u32 num_dal_ports; |
| 268 | u32 priority; |
| 269 | struct frame_alignment_type frame_alignment; |
| 270 | u32 def_type; |
| 271 | }; |
| 272 | |
| 273 | struct vdec_property_info { |
| 274 | enum vdec_property_id id; |
| 275 | union vdec_property property; |
| 276 | }; |
| 277 | #endif /* _MSM_VDEC_H_ */ |