Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | #ifndef __VIDC_HFI_API_H__ |
| 15 | #define __VIDC_HFI_API_H__ |
| 16 | |
| 17 | #include <linux/log2.h> |
| 18 | #include <linux/platform_device.h> |
| 19 | #include <linux/types.h> |
Maheshwar Ajja | c6407c0 | 2017-06-09 18:53:20 -0700 | [diff] [blame] | 20 | #include <linux/errno.h> |
| 21 | #include <linux/hash.h> |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 22 | #include <media/msm_vidc.h> |
| 23 | #include "msm_vidc_resources.h" |
| 24 | |
Chinmay Sawarkar | cbd3f59 | 2017-04-10 15:42:30 -0700 | [diff] [blame] | 25 | #define CONTAINS(__a, __sz, __t) (\ |
| 26 | (__t >= __a) && \ |
| 27 | (__t < __a + __sz) \ |
| 28 | ) |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 29 | |
Chinmay Sawarkar | cbd3f59 | 2017-04-10 15:42:30 -0700 | [diff] [blame] | 30 | #define OVERLAPS(__t, __tsz, __a, __asz) (\ |
| 31 | (__t <= __a) && \ |
| 32 | (__t + __tsz >= __a + __asz) \ |
| 33 | ) |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 34 | |
| 35 | #define HAL_BUFFERFLAG_EOS 0x00000001 |
| 36 | #define HAL_BUFFERFLAG_STARTTIME 0x00000002 |
| 37 | #define HAL_BUFFERFLAG_DECODEONLY 0x00000004 |
| 38 | #define HAL_BUFFERFLAG_DATACORRUPT 0x00000008 |
| 39 | #define HAL_BUFFERFLAG_ENDOFFRAME 0x00000010 |
| 40 | #define HAL_BUFFERFLAG_SYNCFRAME 0x00000020 |
| 41 | #define HAL_BUFFERFLAG_EXTRADATA 0x00000040 |
| 42 | #define HAL_BUFFERFLAG_CODECCONFIG 0x00000080 |
| 43 | #define HAL_BUFFERFLAG_TIMESTAMPINVALID 0x00000100 |
| 44 | #define HAL_BUFFERFLAG_READONLY 0x00000200 |
| 45 | #define HAL_BUFFERFLAG_ENDOFSUBFRAME 0x00000400 |
| 46 | #define HAL_BUFFERFLAG_EOSEQ 0x00200000 |
| 47 | #define HAL_BUFFERFLAG_MBAFF 0x08000000 |
| 48 | #define HAL_BUFFERFLAG_YUV_601_709_CSC_CLAMP 0x10000000 |
| 49 | #define HAL_BUFFERFLAG_DROP_FRAME 0x20000000 |
| 50 | #define HAL_BUFFERFLAG_TS_DISCONTINUITY 0x40000000 |
| 51 | #define HAL_BUFFERFLAG_TS_ERROR 0x80000000 |
| 52 | |
| 53 | |
| 54 | |
| 55 | #define HAL_DEBUG_MSG_LOW 0x00000001 |
| 56 | #define HAL_DEBUG_MSG_MEDIUM 0x00000002 |
| 57 | #define HAL_DEBUG_MSG_HIGH 0x00000004 |
| 58 | #define HAL_DEBUG_MSG_ERROR 0x00000008 |
| 59 | #define HAL_DEBUG_MSG_FATAL 0x00000010 |
| 60 | #define MAX_PROFILE_COUNT 16 |
| 61 | |
| 62 | #define HAL_MAX_MATRIX_COEFFS 9 |
| 63 | #define HAL_MAX_BIAS_COEFFS 3 |
| 64 | #define HAL_MAX_LIMIT_COEFFS 6 |
| 65 | #define VENUS_VERSION_LENGTH 128 |
| 66 | |
| 67 | /* 16 encoder and 16 decoder sessions */ |
| 68 | #define VIDC_MAX_SESSIONS 32 |
| 69 | |
| 70 | enum vidc_status { |
| 71 | VIDC_ERR_NONE = 0x0, |
| 72 | VIDC_ERR_FAIL = 0x80000000, |
| 73 | VIDC_ERR_ALLOC_FAIL, |
| 74 | VIDC_ERR_ILLEGAL_OP, |
| 75 | VIDC_ERR_BAD_PARAM, |
| 76 | VIDC_ERR_BAD_HANDLE, |
| 77 | VIDC_ERR_NOT_SUPPORTED, |
| 78 | VIDC_ERR_BAD_STATE, |
| 79 | VIDC_ERR_MAX_CLIENTS, |
| 80 | VIDC_ERR_IFRAME_EXPECTED, |
| 81 | VIDC_ERR_HW_FATAL, |
| 82 | VIDC_ERR_BITSTREAM_ERR, |
| 83 | VIDC_ERR_INDEX_NOMORE, |
| 84 | VIDC_ERR_SEQHDR_PARSE_FAIL, |
| 85 | VIDC_ERR_INSUFFICIENT_BUFFER, |
| 86 | VIDC_ERR_BAD_POWER_STATE, |
| 87 | VIDC_ERR_NO_VALID_SESSION, |
| 88 | VIDC_ERR_TIMEOUT, |
| 89 | VIDC_ERR_CMDQFULL, |
| 90 | VIDC_ERR_START_CODE_NOT_FOUND, |
| 91 | VIDC_ERR_CLIENT_PRESENT = 0x90000001, |
| 92 | VIDC_ERR_CLIENT_FATAL, |
| 93 | VIDC_ERR_CMD_QUEUE_FULL, |
| 94 | VIDC_ERR_UNUSED = 0x10000000 |
| 95 | }; |
| 96 | |
| 97 | enum hal_extradata_id { |
| 98 | HAL_EXTRADATA_NONE, |
| 99 | HAL_EXTRADATA_MB_QUANTIZATION, |
| 100 | HAL_EXTRADATA_INTERLACE_VIDEO, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 101 | HAL_EXTRADATA_TIMESTAMP, |
| 102 | HAL_EXTRADATA_S3D_FRAME_PACKING, |
| 103 | HAL_EXTRADATA_FRAME_RATE, |
| 104 | HAL_EXTRADATA_PANSCAN_WINDOW, |
| 105 | HAL_EXTRADATA_RECOVERY_POINT_SEI, |
| 106 | HAL_EXTRADATA_MULTISLICE_INFO, |
| 107 | HAL_EXTRADATA_INDEX, |
| 108 | HAL_EXTRADATA_NUM_CONCEALED_MB, |
| 109 | HAL_EXTRADATA_METADATA_FILLER, |
| 110 | HAL_EXTRADATA_ASPECT_RATIO, |
| 111 | HAL_EXTRADATA_MPEG2_SEQDISP, |
| 112 | HAL_EXTRADATA_STREAM_USERDATA, |
| 113 | HAL_EXTRADATA_FRAME_QP, |
| 114 | HAL_EXTRADATA_FRAME_BITS_INFO, |
| 115 | HAL_EXTRADATA_INPUT_CROP, |
| 116 | HAL_EXTRADATA_DIGITAL_ZOOM, |
| 117 | HAL_EXTRADATA_LTR_INFO, |
| 118 | HAL_EXTRADATA_METADATA_MBI, |
| 119 | HAL_EXTRADATA_VQZIP_SEI, |
| 120 | HAL_EXTRADATA_YUV_STATS, |
| 121 | HAL_EXTRADATA_ROI_QP, |
| 122 | HAL_EXTRADATA_OUTPUT_CROP, |
| 123 | HAL_EXTRADATA_MASTERING_DISPLAY_COLOUR_SEI, |
| 124 | HAL_EXTRADATA_CONTENT_LIGHT_LEVEL_SEI, |
| 125 | HAL_EXTRADATA_PQ_INFO, |
| 126 | HAL_EXTRADATA_VUI_DISPLAY_INFO, |
| 127 | HAL_EXTRADATA_VPX_COLORSPACE, |
Praneeth Paladugu | a51b2c4 | 2017-06-23 12:48:06 -0700 | [diff] [blame] | 128 | HAL_EXTRADATA_UBWC_CR_STATS_INFO, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 129 | }; |
| 130 | |
| 131 | enum hal_property { |
| 132 | HAL_CONFIG_FRAME_RATE = 0x04000001, |
| 133 | HAL_PARAM_UNCOMPRESSED_FORMAT_SELECT, |
| 134 | HAL_PARAM_UNCOMPRESSED_PLANE_ACTUAL_CONSTRAINTS_INFO, |
| 135 | HAL_PARAM_UNCOMPRESSED_PLANE_ACTUAL_INFO, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 136 | HAL_PARAM_INDEX_EXTRADATA, |
| 137 | HAL_PARAM_FRAME_SIZE, |
| 138 | HAL_CONFIG_REALTIME, |
| 139 | HAL_PARAM_BUFFER_COUNT_ACTUAL, |
| 140 | HAL_PARAM_BUFFER_SIZE_MINIMUM, |
| 141 | HAL_PARAM_NAL_STREAM_FORMAT_SELECT, |
| 142 | HAL_PARAM_VDEC_OUTPUT_ORDER, |
| 143 | HAL_PARAM_VDEC_PICTURE_TYPE_DECODE, |
| 144 | HAL_PARAM_VDEC_OUTPUT2_KEEP_ASPECT_RATIO, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 145 | HAL_PARAM_VDEC_MULTI_STREAM, |
| 146 | HAL_PARAM_VDEC_DISPLAY_PICTURE_BUFFER_COUNT, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 147 | HAL_CONFIG_VDEC_MB_ERROR_MAP_REPORTING, |
| 148 | HAL_PARAM_VDEC_CONTINUE_DATA_TRANSFER, |
| 149 | HAL_CONFIG_VDEC_MB_ERROR_MAP, |
| 150 | HAL_CONFIG_VENC_REQUEST_IFRAME, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 151 | HAL_CONFIG_VENC_TARGET_BITRATE, |
| 152 | HAL_PARAM_PROFILE_LEVEL_CURRENT, |
| 153 | HAL_PARAM_VENC_H264_ENTROPY_CONTROL, |
| 154 | HAL_PARAM_VENC_RATE_CONTROL, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 155 | HAL_PARAM_VENC_H264_DEBLOCK_CONTROL, |
| 156 | HAL_PARAM_VENC_TEMPORAL_SPATIAL_TRADEOFF, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 157 | HAL_PARAM_VENC_SESSION_QP_RANGE, |
| 158 | HAL_CONFIG_VENC_INTRA_PERIOD, |
| 159 | HAL_CONFIG_VENC_IDR_PERIOD, |
Chinmay Sawarkar | 582c72a | 2017-05-24 14:29:12 -0700 | [diff] [blame] | 160 | HAL_PARAM_VPE_ROTATION, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 161 | HAL_PARAM_VENC_INTRA_REFRESH, |
| 162 | HAL_PARAM_VENC_MULTI_SLICE_CONTROL, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 163 | HAL_SYS_DEBUG_CONFIG, |
| 164 | HAL_CONFIG_BUFFER_REQUIREMENTS, |
| 165 | HAL_CONFIG_PRIORITY, |
| 166 | HAL_CONFIG_BATCH_INFO, |
| 167 | HAL_PARAM_METADATA_PASS_THROUGH, |
| 168 | HAL_SYS_IDLE_INDICATOR, |
| 169 | HAL_PARAM_UNCOMPRESSED_FORMAT_SUPPORTED, |
| 170 | HAL_PARAM_INTERLACE_FORMAT_SUPPORTED, |
| 171 | HAL_PARAM_CHROMA_SITE, |
| 172 | HAL_PARAM_PROPERTIES_SUPPORTED, |
| 173 | HAL_PARAM_PROFILE_LEVEL_SUPPORTED, |
| 174 | HAL_PARAM_CAPABILITY_SUPPORTED, |
| 175 | HAL_PARAM_NAL_STREAM_FORMAT_SUPPORTED, |
| 176 | HAL_PARAM_MULTI_VIEW_FORMAT, |
| 177 | HAL_PARAM_MAX_SEQUENCE_HEADER_SIZE, |
| 178 | HAL_PARAM_CODEC_SUPPORTED, |
| 179 | HAL_PARAM_VDEC_MULTI_VIEW_SELECT, |
| 180 | HAL_PARAM_VDEC_MB_QUANTIZATION, |
| 181 | HAL_PARAM_VDEC_NUM_CONCEALED_MB, |
| 182 | HAL_PARAM_VDEC_H264_ENTROPY_SWITCHING, |
| 183 | HAL_PARAM_VENC_SLICE_DELIVERY_MODE, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 184 | HAL_CONFIG_BUFFER_COUNT_ACTUAL, |
| 185 | HAL_CONFIG_VDEC_MULTI_STREAM, |
| 186 | HAL_PARAM_VENC_MULTI_SLICE_INFO, |
| 187 | HAL_CONFIG_VENC_TIMESTAMP_SCALE, |
| 188 | HAL_PARAM_VENC_SYNC_FRAME_SEQUENCE_HEADER, |
| 189 | HAL_PARAM_VDEC_SYNC_FRAME_DECODE, |
| 190 | HAL_PARAM_VENC_H264_ENTROPY_CABAC_MODEL, |
| 191 | HAL_CONFIG_VENC_MAX_BITRATE, |
Chinmay Sawarkar | d005462 | 2017-05-04 13:50:59 -0700 | [diff] [blame] | 192 | HAL_PARAM_VENC_VUI_TIMING_INFO, |
Umesh Pandey | 7fce7ee | 2017-03-13 17:59:48 -0700 | [diff] [blame] | 193 | HAL_PARAM_VENC_GENERATE_AUDNAL, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 194 | HAL_PARAM_BUFFER_ALLOC_MODE, |
| 195 | HAL_PARAM_VDEC_FRAME_ASSEMBLY, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 196 | HAL_PARAM_VENC_PRESERVE_TEXT_QUALITY, |
| 197 | HAL_PARAM_VDEC_CONCEAL_COLOR, |
| 198 | HAL_PARAM_VDEC_SCS_THRESHOLD, |
| 199 | HAL_PARAM_GET_BUFFER_REQUIREMENTS, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 200 | HAL_PARAM_VENC_LTRMODE, |
| 201 | HAL_CONFIG_VENC_MARKLTRFRAME, |
| 202 | HAL_CONFIG_VENC_USELTRFRAME, |
| 203 | HAL_CONFIG_VENC_LTRPERIOD, |
| 204 | HAL_CONFIG_VENC_HIER_P_NUM_FRAMES, |
| 205 | HAL_PARAM_VENC_HIER_P_MAX_ENH_LAYERS, |
| 206 | HAL_PARAM_VENC_DISABLE_RC_TIMESTAMP, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 207 | HAL_PARAM_VENC_SEARCH_RANGE, |
| 208 | HAL_PARAM_VPE_COLOR_SPACE_CONVERSION, |
| 209 | HAL_PARAM_VENC_VPX_ERROR_RESILIENCE_MODE, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 210 | HAL_CONFIG_VENC_PERF_MODE, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 211 | HAL_PARAM_VDEC_NON_SECURE_OUTPUT2, |
| 212 | HAL_PARAM_VENC_HIER_P_HYBRID_MODE, |
| 213 | HAL_PARAM_VENC_MBI_STATISTICS_MODE, |
| 214 | HAL_PARAM_SYNC_BASED_INTERRUPT, |
| 215 | HAL_CONFIG_VENC_FRAME_QP, |
| 216 | HAL_CONFIG_VENC_BASELAYER_PRIORITYID, |
| 217 | HAL_PARAM_VENC_VQZIP_SEI, |
| 218 | HAL_PROPERTY_PARAM_VENC_ASPECT_RATIO, |
| 219 | HAL_CONFIG_VDEC_ENTROPY, |
| 220 | HAL_PARAM_VENC_BITRATE_TYPE, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 221 | HAL_PARAM_VENC_LOW_LATENCY, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 222 | HAL_CONFIG_VENC_BLUR_RESOLUTION, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 223 | HAL_PARAM_VENC_H264_TRANSFORM_8x8, |
| 224 | HAL_PARAM_VENC_VIDEO_SIGNAL_INFO, |
| 225 | HAL_PARAM_VENC_IFRAMESIZE_TYPE, |
Praneeth Paladugu | 238977b | 2016-12-06 12:51:26 -0800 | [diff] [blame] | 226 | HAL_PARAM_VIDEO_CORES_USAGE, |
| 227 | HAL_PARAM_VIDEO_WORK_MODE, |
Karthikeyan Periasamy | a0e4bad | 2017-04-26 12:51:10 -0700 | [diff] [blame] | 228 | HAL_PARAM_SECURE, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 229 | }; |
| 230 | |
| 231 | enum hal_domain { |
| 232 | HAL_VIDEO_DOMAIN_VPE, |
| 233 | HAL_VIDEO_DOMAIN_ENCODER, |
| 234 | HAL_VIDEO_DOMAIN_DECODER, |
| 235 | HAL_UNUSED_DOMAIN = 0x10000000, |
| 236 | }; |
| 237 | |
| 238 | enum multi_stream { |
| 239 | HAL_VIDEO_DECODER_NONE = 0x00000000, |
| 240 | HAL_VIDEO_DECODER_PRIMARY = 0x00000001, |
| 241 | HAL_VIDEO_DECODER_SECONDARY = 0x00000002, |
| 242 | HAL_VIDEO_DECODER_BOTH_OUTPUTS = 0x00000004, |
| 243 | HAL_VIDEO_UNUSED_OUTPUTS = 0x10000000, |
| 244 | }; |
| 245 | |
| 246 | enum hal_core_capabilities { |
| 247 | HAL_VIDEO_ENCODER_ROTATION_CAPABILITY = 0x00000001, |
| 248 | HAL_VIDEO_ENCODER_SCALING_CAPABILITY = 0x00000002, |
| 249 | HAL_VIDEO_ENCODER_DEINTERLACE_CAPABILITY = 0x00000004, |
| 250 | HAL_VIDEO_DECODER_MULTI_STREAM_CAPABILITY = 0x00000008, |
| 251 | HAL_VIDEO_UNUSED_CAPABILITY = 0x10000000, |
| 252 | }; |
| 253 | |
| 254 | enum hal_default_properties { |
| 255 | HAL_VIDEO_DYNAMIC_BUF_MODE = 0x00000001, |
| 256 | HAL_VIDEO_CONTINUE_DATA_TRANSFER = 0x00000002, |
| 257 | }; |
| 258 | |
| 259 | enum hal_video_codec { |
| 260 | HAL_VIDEO_CODEC_UNKNOWN = 0x00000000, |
| 261 | HAL_VIDEO_CODEC_MVC = 0x00000001, |
| 262 | HAL_VIDEO_CODEC_H264 = 0x00000002, |
| 263 | HAL_VIDEO_CODEC_H263 = 0x00000004, |
| 264 | HAL_VIDEO_CODEC_MPEG1 = 0x00000008, |
| 265 | HAL_VIDEO_CODEC_MPEG2 = 0x00000010, |
| 266 | HAL_VIDEO_CODEC_MPEG4 = 0x00000020, |
| 267 | HAL_VIDEO_CODEC_DIVX_311 = 0x00000040, |
| 268 | HAL_VIDEO_CODEC_DIVX = 0x00000080, |
| 269 | HAL_VIDEO_CODEC_VC1 = 0x00000100, |
| 270 | HAL_VIDEO_CODEC_SPARK = 0x00000200, |
| 271 | HAL_VIDEO_CODEC_VP6 = 0x00000400, |
| 272 | HAL_VIDEO_CODEC_VP7 = 0x00000800, |
| 273 | HAL_VIDEO_CODEC_VP8 = 0x00001000, |
| 274 | HAL_VIDEO_CODEC_HEVC = 0x00002000, |
| 275 | HAL_VIDEO_CODEC_VP9 = 0x00004000, |
Surajit Podder | e502daa | 2017-05-30 19:17:45 +0530 | [diff] [blame] | 276 | HAL_VIDEO_CODEC_TME = 0x00008000, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 277 | HAL_VIDEO_CODEC_HEVC_HYBRID = 0x80000000, |
| 278 | HAL_UNUSED_CODEC = 0x10000000, |
| 279 | }; |
| 280 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 281 | enum hal_mpeg2_profile { |
Vaibhav Deshu Venkatesh | 0ad53f0 | 2017-08-07 13:21:47 -0700 | [diff] [blame] | 282 | HAL_UNUSED_MPEG2_PROFILE = 0x00000000, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 283 | HAL_MPEG2_PROFILE_SIMPLE = 0x00000001, |
| 284 | HAL_MPEG2_PROFILE_MAIN = 0x00000002, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 285 | }; |
| 286 | |
| 287 | enum hal_mpeg2_level { |
Vaibhav Deshu Venkatesh | 0ad53f0 | 2017-08-07 13:21:47 -0700 | [diff] [blame] | 288 | HAL_UNUSED_MEPG2_LEVEL = 0x00000000, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 289 | HAL_MPEG2_LEVEL_LL = 0x00000001, |
| 290 | HAL_MPEG2_LEVEL_ML = 0x00000002, |
Vaibhav Deshu Venkatesh | 0ad53f0 | 2017-08-07 13:21:47 -0700 | [diff] [blame] | 291 | HAL_MPEG2_LEVEL_HL = 0x00000004, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 292 | }; |
| 293 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 294 | enum hal_h264_profile { |
Vaibhav Deshu Venkatesh | 0ad53f0 | 2017-08-07 13:21:47 -0700 | [diff] [blame] | 295 | HAL_UNUSED_H264_PROFILE = 0x00000000, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 296 | HAL_H264_PROFILE_BASELINE = 0x00000001, |
| 297 | HAL_H264_PROFILE_MAIN = 0x00000002, |
| 298 | HAL_H264_PROFILE_HIGH = 0x00000004, |
Vaibhav Deshu Venkatesh | 0ad53f0 | 2017-08-07 13:21:47 -0700 | [diff] [blame] | 299 | HAL_H264_PROFILE_STEREO_HIGH = 0x00000008, |
| 300 | HAL_H264_PROFILE_MULTIVIEW_HIGH = 0x00000010, |
| 301 | HAL_H264_PROFILE_CONSTRAINED_BASE = 0x00000020, |
| 302 | HAL_H264_PROFILE_CONSTRAINED_HIGH = 0x00000040, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 303 | }; |
| 304 | |
| 305 | enum hal_h264_level { |
Vaibhav Deshu Venkatesh | 234b4dc | 2017-03-21 16:54:28 -0700 | [diff] [blame] | 306 | HAL_H264_LEVEL_UNKNOWN = 0x00000000, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 307 | HAL_H264_LEVEL_1 = 0x00000001, |
| 308 | HAL_H264_LEVEL_1b = 0x00000002, |
| 309 | HAL_H264_LEVEL_11 = 0x00000004, |
| 310 | HAL_H264_LEVEL_12 = 0x00000008, |
| 311 | HAL_H264_LEVEL_13 = 0x00000010, |
| 312 | HAL_H264_LEVEL_2 = 0x00000020, |
| 313 | HAL_H264_LEVEL_21 = 0x00000040, |
| 314 | HAL_H264_LEVEL_22 = 0x00000080, |
| 315 | HAL_H264_LEVEL_3 = 0x00000100, |
| 316 | HAL_H264_LEVEL_31 = 0x00000200, |
| 317 | HAL_H264_LEVEL_32 = 0x00000400, |
| 318 | HAL_H264_LEVEL_4 = 0x00000800, |
| 319 | HAL_H264_LEVEL_41 = 0x00001000, |
| 320 | HAL_H264_LEVEL_42 = 0x00002000, |
| 321 | HAL_H264_LEVEL_5 = 0x00004000, |
| 322 | HAL_H264_LEVEL_51 = 0x00008000, |
| 323 | HAL_H264_LEVEL_52 = 0x00010000, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 324 | }; |
| 325 | |
| 326 | enum hal_hevc_profile { |
Vaibhav Deshu Venkatesh | 0ad53f0 | 2017-08-07 13:21:47 -0700 | [diff] [blame] | 327 | HAL_UNUSED_HEVC_PROFILE = 0x00000000, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 328 | HAL_HEVC_PROFILE_MAIN = 0x00000001, |
| 329 | HAL_HEVC_PROFILE_MAIN10 = 0x00000002, |
| 330 | HAL_HEVC_PROFILE_MAIN_STILL_PIC = 0x00000004, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 331 | }; |
| 332 | |
| 333 | enum hal_hevc_level { |
Vaibhav Deshu Venkatesh | 234b4dc | 2017-03-21 16:54:28 -0700 | [diff] [blame] | 334 | HAL_HEVC_TIER_LEVEL_UNKNOWN = 0x00000000, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 335 | HAL_HEVC_MAIN_TIER_LEVEL_1 = 0x10000001, |
| 336 | HAL_HEVC_MAIN_TIER_LEVEL_2 = 0x10000002, |
| 337 | HAL_HEVC_MAIN_TIER_LEVEL_2_1 = 0x10000004, |
| 338 | HAL_HEVC_MAIN_TIER_LEVEL_3 = 0x10000008, |
| 339 | HAL_HEVC_MAIN_TIER_LEVEL_3_1 = 0x10000010, |
| 340 | HAL_HEVC_MAIN_TIER_LEVEL_4 = 0x10000020, |
| 341 | HAL_HEVC_MAIN_TIER_LEVEL_4_1 = 0x10000040, |
| 342 | HAL_HEVC_MAIN_TIER_LEVEL_5 = 0x10000080, |
| 343 | HAL_HEVC_MAIN_TIER_LEVEL_5_1 = 0x10000100, |
| 344 | HAL_HEVC_MAIN_TIER_LEVEL_5_2 = 0x10000200, |
| 345 | HAL_HEVC_MAIN_TIER_LEVEL_6 = 0x10000400, |
| 346 | HAL_HEVC_MAIN_TIER_LEVEL_6_1 = 0x10000800, |
| 347 | HAL_HEVC_MAIN_TIER_LEVEL_6_2 = 0x10001000, |
| 348 | HAL_HEVC_HIGH_TIER_LEVEL_1 = 0x20000001, |
| 349 | HAL_HEVC_HIGH_TIER_LEVEL_2 = 0x20000002, |
| 350 | HAL_HEVC_HIGH_TIER_LEVEL_2_1 = 0x20000004, |
| 351 | HAL_HEVC_HIGH_TIER_LEVEL_3 = 0x20000008, |
| 352 | HAL_HEVC_HIGH_TIER_LEVEL_3_1 = 0x20000010, |
| 353 | HAL_HEVC_HIGH_TIER_LEVEL_4 = 0x20000020, |
| 354 | HAL_HEVC_HIGH_TIER_LEVEL_4_1 = 0x20000040, |
| 355 | HAL_HEVC_HIGH_TIER_LEVEL_5 = 0x20000080, |
| 356 | HAL_HEVC_HIGH_TIER_LEVEL_5_1 = 0x20000100, |
| 357 | HAL_HEVC_HIGH_TIER_LEVEL_5_2 = 0x20000200, |
| 358 | HAL_HEVC_HIGH_TIER_LEVEL_6 = 0x20000400, |
| 359 | HAL_HEVC_HIGH_TIER_LEVEL_6_1 = 0x20000800, |
| 360 | HAL_HEVC_HIGH_TIER_LEVEL_6_2 = 0x20001000, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 361 | }; |
| 362 | |
| 363 | enum hal_hevc_tier { |
| 364 | HAL_HEVC_TIER_MAIN = 0x00000001, |
| 365 | HAL_HEVC_TIER_HIGH = 0x00000002, |
| 366 | HAL_UNUSED_HEVC_TIER = 0x10000000, |
| 367 | }; |
| 368 | |
Vaibhav Deshu Venkatesh | 0ad53f0 | 2017-08-07 13:21:47 -0700 | [diff] [blame] | 369 | enum hal_vp8_profile { |
| 370 | HAL_VP8_PROFILE_UNUSED = 0x00000000, |
| 371 | HAL_VP8_PROFILE_MAIN = 0x00000001, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 372 | }; |
| 373 | |
Vaibhav Deshu Venkatesh | 0ad53f0 | 2017-08-07 13:21:47 -0700 | [diff] [blame] | 374 | enum hal_vp8_level { |
| 375 | HAL_VP8_LEVEL_UNUSED = 0x00000000, |
| 376 | HAL_VP8_LEVEL_VERSION_0 = 0x00000001, |
| 377 | HAL_VP8_LEVEL_VERSION_1 = 0x00000002, |
| 378 | HAL_VP8_LEVEL_VERSION_2 = 0x00000004, |
| 379 | HAL_VP8_LEVEL_VERSION_3 = 0x00000008, |
Chinmay Sawarkar | 7f1cc15 | 2017-05-05 18:16:36 -0700 | [diff] [blame] | 380 | }; |
| 381 | |
Surajit Podder | e502daa | 2017-05-30 19:17:45 +0530 | [diff] [blame] | 382 | enum hal_tme_profile { |
| 383 | HAL_TME_PROFILE_0 = 0x00000001, |
| 384 | HAL_TME_PROFILE_1 = 0x00000002, |
| 385 | HAL_TME_PROFILE_2 = 0x00000004, |
| 386 | HAL_TME_PROFILE_3 = 0x00000008, |
| 387 | }; |
| 388 | |
| 389 | enum hal_tme_level { |
| 390 | HAL_TME_LEVEL_INTEGER = 0x00000001, |
| 391 | }; |
| 392 | |
Vaibhav Deshu Venkatesh | b69518e | 2017-08-21 12:22:49 -0700 | [diff] [blame] | 393 | enum hal_vp9_profile { |
| 394 | HAL_VP9_PROFILE_UNUSED = 0x00000000, |
| 395 | HAL_VP9_PROFILE_P0 = 0x00000001, |
Vaibhav Deshu Venkatesh | a76c435 | 2017-08-28 12:39:13 -0700 | [diff] [blame] | 396 | HAL_VP9_PROFILE_P2_10 = 0x00000004, |
Vaibhav Deshu Venkatesh | b69518e | 2017-08-21 12:22:49 -0700 | [diff] [blame] | 397 | }; |
| 398 | |
| 399 | enum hal_vp9_level { |
| 400 | HAL_VP9_LEVEL_UNUSED = 0x00000000, |
| 401 | HAL_VP9_LEVEL_1 = 0x00000001, |
| 402 | HAL_VP9_LEVEL_11 = 0x00000002, |
| 403 | HAL_VP9_LEVEL_2 = 0x00000004, |
| 404 | HAL_VP9_LEVEL_21 = 0x00000008, |
| 405 | HAL_VP9_LEVEL_3 = 0x00000010, |
| 406 | HAL_VP9_LEVEL_31 = 0x00000020, |
| 407 | HAL_VP9_LEVEL_4 = 0x00000040, |
| 408 | HAL_VP9_LEVEL_41 = 0x00000080, |
| 409 | HAL_VP9_LEVEL_5 = 0x00000100, |
| 410 | HAL_VP9_LEVEL_51 = 0x00000200, |
| 411 | }; |
| 412 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 413 | struct hal_frame_rate { |
| 414 | enum hal_buffer buffer_type; |
| 415 | u32 frame_rate; |
| 416 | }; |
| 417 | |
| 418 | enum hal_uncompressed_format { |
| 419 | HAL_COLOR_FORMAT_MONOCHROME = 0x00000001, |
| 420 | HAL_COLOR_FORMAT_NV12 = 0x00000002, |
| 421 | HAL_COLOR_FORMAT_NV21 = 0x00000004, |
| 422 | HAL_COLOR_FORMAT_NV12_4x4TILE = 0x00000008, |
| 423 | HAL_COLOR_FORMAT_NV21_4x4TILE = 0x00000010, |
| 424 | HAL_COLOR_FORMAT_YUYV = 0x00000020, |
| 425 | HAL_COLOR_FORMAT_YVYU = 0x00000040, |
| 426 | HAL_COLOR_FORMAT_UYVY = 0x00000080, |
| 427 | HAL_COLOR_FORMAT_VYUY = 0x00000100, |
| 428 | HAL_COLOR_FORMAT_RGB565 = 0x00000200, |
| 429 | HAL_COLOR_FORMAT_BGR565 = 0x00000400, |
| 430 | HAL_COLOR_FORMAT_RGB888 = 0x00000800, |
| 431 | HAL_COLOR_FORMAT_BGR888 = 0x00001000, |
| 432 | HAL_COLOR_FORMAT_NV12_UBWC = 0x00002000, |
| 433 | HAL_COLOR_FORMAT_NV12_TP10_UBWC = 0x00004000, |
| 434 | HAL_COLOR_FORMAT_RGBA8888 = 0x00008000, |
| 435 | HAL_COLOR_FORMAT_RGBA8888_UBWC = 0x00010000, |
| 436 | HAL_UNUSED_COLOR = 0x10000000, |
| 437 | }; |
| 438 | |
| 439 | enum hal_statistics_mode_type { |
| 440 | HAL_STATISTICS_MODE_DEFAULT = 0x00000001, |
| 441 | HAL_STATISTICS_MODE_1 = 0x00000002, |
| 442 | HAL_STATISTICS_MODE_2 = 0x00000004, |
| 443 | HAL_STATISTICS_MODE_3 = 0x00000008, |
| 444 | }; |
| 445 | |
| 446 | enum hal_ssr_trigger_type { |
| 447 | SSR_ERR_FATAL = 1, |
| 448 | SSR_SW_DIV_BY_ZERO, |
| 449 | SSR_HW_WDOG_IRQ, |
| 450 | }; |
| 451 | |
| 452 | struct hal_uncompressed_format_select { |
| 453 | enum hal_buffer buffer_type; |
| 454 | enum hal_uncompressed_format format; |
| 455 | }; |
| 456 | |
| 457 | struct hal_uncompressed_plane_actual { |
| 458 | int actual_stride; |
| 459 | u32 actual_plane_buffer_height; |
| 460 | }; |
| 461 | |
| 462 | struct hal_uncompressed_plane_actual_info { |
| 463 | enum hal_buffer buffer_type; |
| 464 | u32 num_planes; |
| 465 | struct hal_uncompressed_plane_actual rg_plane_format[1]; |
| 466 | }; |
| 467 | |
| 468 | struct hal_uncompressed_plane_constraints { |
| 469 | u32 stride_multiples; |
| 470 | u32 max_stride; |
| 471 | u32 min_plane_buffer_height_multiple; |
| 472 | u32 buffer_alignment; |
| 473 | }; |
| 474 | |
| 475 | struct hal_uncompressed_plane_actual_constraints_info { |
| 476 | enum hal_buffer buffer_type; |
| 477 | u32 num_planes; |
| 478 | struct hal_uncompressed_plane_constraints rg_plane_format[1]; |
| 479 | }; |
| 480 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 481 | struct hal_frame_size { |
| 482 | enum hal_buffer buffer_type; |
| 483 | u32 width; |
| 484 | u32 height; |
| 485 | }; |
| 486 | |
| 487 | struct hal_enable { |
| 488 | bool enable; |
| 489 | }; |
| 490 | |
| 491 | struct hal_buffer_count_actual { |
| 492 | enum hal_buffer buffer_type; |
| 493 | u32 buffer_count_actual; |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 494 | u32 buffer_count_min_host; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 495 | }; |
| 496 | |
| 497 | struct hal_buffer_size_minimum { |
| 498 | enum hal_buffer buffer_type; |
| 499 | u32 buffer_size; |
| 500 | }; |
| 501 | |
| 502 | struct hal_buffer_display_hold_count_actual { |
| 503 | enum hal_buffer buffer_type; |
| 504 | u32 hold_count; |
| 505 | }; |
| 506 | |
| 507 | enum hal_nal_stream_format { |
| 508 | HAL_NAL_FORMAT_STARTCODES = 0x00000001, |
| 509 | HAL_NAL_FORMAT_ONE_NAL_PER_BUFFER = 0x00000002, |
| 510 | HAL_NAL_FORMAT_ONE_BYTE_LENGTH = 0x00000004, |
| 511 | HAL_NAL_FORMAT_TWO_BYTE_LENGTH = 0x00000008, |
| 512 | HAL_NAL_FORMAT_FOUR_BYTE_LENGTH = 0x00000010, |
| 513 | }; |
| 514 | |
| 515 | enum hal_output_order { |
| 516 | HAL_OUTPUT_ORDER_DISPLAY, |
| 517 | HAL_OUTPUT_ORDER_DECODE, |
| 518 | HAL_UNUSED_OUTPUT = 0x10000000, |
| 519 | }; |
| 520 | |
| 521 | enum hal_picture { |
| 522 | HAL_PICTURE_I = 0x01, |
| 523 | HAL_PICTURE_P = 0x02, |
| 524 | HAL_PICTURE_B = 0x04, |
| 525 | HAL_PICTURE_IDR = 0x08, |
| 526 | HAL_PICTURE_CRA = 0x10, |
| 527 | HAL_FRAME_NOTCODED = 0x7F002000, |
| 528 | HAL_FRAME_YUV = 0x7F004000, |
| 529 | HAL_UNUSED_PICT = 0x10000000, |
| 530 | }; |
| 531 | |
| 532 | struct hal_extradata_enable { |
| 533 | u32 enable; |
| 534 | enum hal_extradata_id index; |
| 535 | }; |
| 536 | |
| 537 | struct hal_enable_picture { |
| 538 | u32 picture_type; |
| 539 | }; |
| 540 | |
| 541 | struct hal_multi_stream { |
| 542 | enum hal_buffer buffer_type; |
| 543 | u32 enable; |
| 544 | u32 width; |
| 545 | u32 height; |
| 546 | }; |
| 547 | |
| 548 | struct hal_display_picture_buffer_count { |
| 549 | u32 enable; |
| 550 | u32 count; |
| 551 | }; |
| 552 | |
| 553 | struct hal_mb_error_map { |
| 554 | u32 error_map_size; |
| 555 | u8 rg_error_map[1]; |
| 556 | }; |
| 557 | |
| 558 | struct hal_request_iframe { |
| 559 | u32 enable; |
| 560 | }; |
| 561 | |
| 562 | struct hal_bitrate { |
| 563 | u32 bit_rate; |
| 564 | u32 layer_id; |
| 565 | }; |
| 566 | |
| 567 | struct hal_profile_level { |
| 568 | u32 profile; |
| 569 | u32 level; |
| 570 | }; |
| 571 | |
| 572 | struct hal_profile_level_supported { |
| 573 | u32 profile_count; |
| 574 | struct hal_profile_level profile_level[MAX_PROFILE_COUNT]; |
| 575 | }; |
| 576 | |
| 577 | enum hal_h264_entropy { |
| 578 | HAL_H264_ENTROPY_CAVLC = 1, |
| 579 | HAL_H264_ENTROPY_CABAC = 2, |
| 580 | HAL_UNUSED_ENTROPY = 0x10000000, |
| 581 | }; |
| 582 | |
| 583 | enum hal_h264_cabac_model { |
| 584 | HAL_H264_CABAC_MODEL_0 = 1, |
| 585 | HAL_H264_CABAC_MODEL_1 = 2, |
| 586 | HAL_H264_CABAC_MODEL_2 = 4, |
| 587 | HAL_UNUSED_CABAC = 0x10000000, |
| 588 | }; |
| 589 | |
| 590 | struct hal_h264_entropy_control { |
| 591 | enum hal_h264_entropy entropy_mode; |
| 592 | enum hal_h264_cabac_model cabac_model; |
| 593 | }; |
| 594 | |
| 595 | enum hal_rate_control { |
| 596 | HAL_RATE_CONTROL_OFF, |
| 597 | HAL_RATE_CONTROL_VBR_VFR, |
| 598 | HAL_RATE_CONTROL_VBR_CFR, |
| 599 | HAL_RATE_CONTROL_CBR_VFR, |
| 600 | HAL_RATE_CONTROL_CBR_CFR, |
| 601 | HAL_RATE_CONTROL_MBR_CFR, |
| 602 | HAL_RATE_CONTROL_MBR_VFR, |
| 603 | HAL_UNUSED_RC = 0x10000000, |
| 604 | }; |
| 605 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 606 | enum hal_h264_db_mode { |
| 607 | HAL_H264_DB_MODE_DISABLE, |
| 608 | HAL_H264_DB_MODE_SKIP_SLICE_BOUNDARY, |
| 609 | HAL_H264_DB_MODE_ALL_BOUNDARY, |
| 610 | HAL_UNUSED_H264_DB = 0x10000000, |
| 611 | }; |
| 612 | |
| 613 | struct hal_h264_db_control { |
| 614 | enum hal_h264_db_mode mode; |
| 615 | int slice_alpha_offset; |
| 616 | int slice_beta_offset; |
| 617 | }; |
| 618 | |
| 619 | struct hal_temporal_spatial_tradeoff { |
| 620 | u32 ts_factor; |
| 621 | }; |
| 622 | |
| 623 | struct hal_quantization { |
| 624 | u32 qpi; |
| 625 | u32 qpp; |
| 626 | u32 qpb; |
| 627 | u32 layer_id; |
Vaibhav Deshu Venkatesh | 3a14716 | 2017-04-27 16:21:12 -0700 | [diff] [blame] | 628 | u32 enable; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 629 | }; |
| 630 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 631 | struct hal_quantization_range { |
Praneeth Paladugu | 7fbd279 | 2017-01-27 13:39:03 -0800 | [diff] [blame] | 632 | u32 qpi_min; |
| 633 | u32 qpp_min; |
| 634 | u32 qpb_min; |
| 635 | u32 qpi_max; |
| 636 | u32 qpp_max; |
| 637 | u32 qpb_max; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 638 | u32 layer_id; |
| 639 | }; |
| 640 | |
| 641 | struct hal_intra_period { |
| 642 | u32 pframes; |
| 643 | u32 bframes; |
| 644 | }; |
| 645 | |
| 646 | struct hal_idr_period { |
| 647 | u32 idr_period; |
| 648 | }; |
| 649 | |
| 650 | enum hal_rotate { |
| 651 | HAL_ROTATE_NONE, |
| 652 | HAL_ROTATE_90, |
| 653 | HAL_ROTATE_180, |
| 654 | HAL_ROTATE_270, |
| 655 | HAL_UNUSED_ROTATE = 0x10000000, |
| 656 | }; |
| 657 | |
| 658 | enum hal_flip { |
| 659 | HAL_FLIP_NONE, |
| 660 | HAL_FLIP_HORIZONTAL, |
| 661 | HAL_FLIP_VERTICAL, |
Chinmay Sawarkar | 8775427 | 2017-09-01 14:50:10 -0700 | [diff] [blame^] | 662 | HAL_FLIP_BOTH, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 663 | HAL_UNUSED_FLIP = 0x10000000, |
| 664 | }; |
| 665 | |
Chinmay Sawarkar | 582c72a | 2017-05-24 14:29:12 -0700 | [diff] [blame] | 666 | struct hal_vpe_rotation { |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 667 | enum hal_rotate rotate; |
| 668 | enum hal_flip flip; |
| 669 | }; |
| 670 | |
| 671 | enum hal_intra_refresh_mode { |
| 672 | HAL_INTRA_REFRESH_NONE, |
| 673 | HAL_INTRA_REFRESH_CYCLIC, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 674 | HAL_INTRA_REFRESH_RANDOM, |
| 675 | HAL_UNUSED_INTRA = 0x10000000, |
| 676 | }; |
| 677 | |
| 678 | struct hal_intra_refresh { |
| 679 | enum hal_intra_refresh_mode mode; |
Saurabh Kothawade | abed16c | 2017-03-22 17:06:40 -0700 | [diff] [blame] | 680 | u32 ir_mbs; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 681 | }; |
| 682 | |
| 683 | enum hal_multi_slice { |
| 684 | HAL_MULTI_SLICE_OFF, |
| 685 | HAL_MULTI_SLICE_BY_MB_COUNT, |
| 686 | HAL_MULTI_SLICE_BY_BYTE_COUNT, |
| 687 | HAL_MULTI_SLICE_GOB, |
| 688 | HAL_UNUSED_SLICE = 0x10000000, |
| 689 | }; |
| 690 | |
| 691 | struct hal_multi_slice_control { |
| 692 | enum hal_multi_slice multi_slice; |
| 693 | u32 slice_size; |
| 694 | }; |
| 695 | |
| 696 | struct hal_debug_config { |
| 697 | u32 debug_config; |
| 698 | }; |
| 699 | |
| 700 | struct hal_buffer_requirements { |
| 701 | enum hal_buffer buffer_type; |
| 702 | u32 buffer_size; |
| 703 | u32 buffer_region_size; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 704 | u32 buffer_count_min; |
Praneeth Paladugu | defea4e | 2017-02-09 23:44:08 -0800 | [diff] [blame] | 705 | u32 buffer_count_min_host; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 706 | u32 buffer_count_actual; |
| 707 | u32 contiguous; |
| 708 | u32 buffer_alignment; |
| 709 | }; |
| 710 | |
| 711 | enum hal_priority {/* Priority increases with number */ |
| 712 | HAL_PRIORITY_LOW = 10, |
| 713 | HAL_PRIOIRTY_MEDIUM = 20, |
| 714 | HAL_PRIORITY_HIGH = 30, |
| 715 | HAL_UNUSED_PRIORITY = 0x10000000, |
| 716 | }; |
| 717 | |
| 718 | struct hal_batch_info { |
| 719 | u32 input_batch_count; |
| 720 | u32 output_batch_count; |
| 721 | }; |
| 722 | |
| 723 | struct hal_metadata_pass_through { |
| 724 | u32 enable; |
| 725 | u32 size; |
| 726 | }; |
| 727 | |
| 728 | struct hal_uncompressed_format_supported { |
| 729 | enum hal_buffer buffer_type; |
| 730 | u32 format_entries; |
| 731 | u32 rg_format_info[1]; |
| 732 | }; |
| 733 | |
| 734 | enum hal_interlace_format { |
| 735 | HAL_INTERLACE_FRAME_PROGRESSIVE = 0x01, |
| 736 | HAL_INTERLACE_INTERLEAVE_FRAME_TOPFIELDFIRST = 0x02, |
| 737 | HAL_INTERLACE_INTERLEAVE_FRAME_BOTTOMFIELDFIRST = 0x04, |
| 738 | HAL_INTERLACE_FRAME_TOPFIELDFIRST = 0x08, |
| 739 | HAL_INTERLACE_FRAME_BOTTOMFIELDFIRST = 0x10, |
| 740 | HAL_UNUSED_INTERLACE = 0x10000000, |
| 741 | }; |
| 742 | |
| 743 | struct hal_interlace_format_supported { |
| 744 | enum hal_buffer buffer_type; |
| 745 | enum hal_interlace_format format; |
| 746 | }; |
| 747 | |
| 748 | enum hal_chroma_site { |
| 749 | HAL_CHROMA_SITE_0, |
| 750 | HAL_CHROMA_SITE_1, |
| 751 | HAL_UNUSED_CHROMA = 0x10000000, |
| 752 | }; |
| 753 | |
| 754 | struct hal_properties_supported { |
| 755 | u32 num_properties; |
| 756 | u32 rg_properties[1]; |
| 757 | }; |
| 758 | |
| 759 | enum hal_capability { |
| 760 | HAL_CAPABILITY_FRAME_WIDTH = 0x1, |
| 761 | HAL_CAPABILITY_FRAME_HEIGHT, |
| 762 | HAL_CAPABILITY_MBS_PER_FRAME, |
| 763 | HAL_CAPABILITY_MBS_PER_SECOND, |
| 764 | HAL_CAPABILITY_FRAMERATE, |
| 765 | HAL_CAPABILITY_SCALE_X, |
| 766 | HAL_CAPABILITY_SCALE_Y, |
| 767 | HAL_CAPABILITY_BITRATE, |
| 768 | HAL_CAPABILITY_BFRAME, |
| 769 | HAL_CAPABILITY_PEAKBITRATE, |
| 770 | HAL_CAPABILITY_HIER_P_NUM_ENH_LAYERS, |
| 771 | HAL_CAPABILITY_ENC_LTR_COUNT, |
| 772 | HAL_CAPABILITY_SECURE_OUTPUT2_THRESHOLD, |
| 773 | HAL_CAPABILITY_HIER_B_NUM_ENH_LAYERS, |
| 774 | HAL_CAPABILITY_LCU_SIZE, |
| 775 | HAL_CAPABILITY_HIER_P_HYBRID_NUM_ENH_LAYERS, |
| 776 | HAL_CAPABILITY_MBS_PER_SECOND_POWER_SAVE, |
Praneeth Paladugu | 520c759 | 2017-01-26 13:53:14 -0800 | [diff] [blame] | 777 | HAL_CAPABILITY_EXTRADATA, |
| 778 | HAL_CAPABILITY_PROFILE, |
| 779 | HAL_CAPABILITY_LEVEL, |
| 780 | HAL_CAPABILITY_I_FRAME_QP, |
| 781 | HAL_CAPABILITY_P_FRAME_QP, |
| 782 | HAL_CAPABILITY_B_FRAME_QP, |
| 783 | HAL_CAPABILITY_RATE_CONTROL_MODES, |
| 784 | HAL_CAPABILITY_BLUR_WIDTH, |
| 785 | HAL_CAPABILITY_BLUR_HEIGHT, |
| 786 | HAL_CAPABILITY_SLICE_DELIVERY_MODES, |
| 787 | HAL_CAPABILITY_SLICE_BYTE, |
| 788 | HAL_CAPABILITY_SLICE_MB, |
| 789 | HAL_CAPABILITY_SECURE, |
| 790 | HAL_CAPABILITY_MAX_NUM_B_FRAMES, |
| 791 | HAL_CAPABILITY_MAX_VIDEOCORES, |
| 792 | HAL_CAPABILITY_MAX_WORKMODES, |
| 793 | HAL_CAPABILITY_UBWC_CR_STATS, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 794 | HAL_UNUSED_CAPABILITY = 0x10000000, |
| 795 | }; |
| 796 | |
| 797 | struct hal_capability_supported { |
| 798 | enum hal_capability capability_type; |
| 799 | u32 min; |
| 800 | u32 max; |
| 801 | u32 step_size; |
| 802 | }; |
| 803 | |
| 804 | struct hal_capability_supported_info { |
| 805 | u32 num_capabilities; |
| 806 | struct hal_capability_supported rg_data[1]; |
| 807 | }; |
| 808 | |
| 809 | struct hal_nal_stream_format_supported { |
| 810 | u32 nal_stream_format_supported; |
| 811 | }; |
| 812 | |
| 813 | struct hal_nal_stream_format_select { |
| 814 | u32 nal_stream_format_select; |
| 815 | }; |
| 816 | |
| 817 | struct hal_multi_view_format { |
| 818 | u32 views; |
| 819 | u32 rg_view_order[1]; |
| 820 | }; |
| 821 | |
| 822 | enum hal_buffer_layout_type { |
| 823 | HAL_BUFFER_LAYOUT_TOP_BOTTOM, |
| 824 | HAL_BUFFER_LAYOUT_SEQ, |
| 825 | HAL_UNUSED_BUFFER_LAYOUT = 0x10000000, |
| 826 | }; |
| 827 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 828 | struct hal_aspect_ratio { |
| 829 | u32 aspect_width; |
| 830 | u32 aspect_height; |
| 831 | }; |
| 832 | |
| 833 | struct hal_codec_supported { |
| 834 | u32 decoder_codec_supported; |
| 835 | u32 encoder_codec_supported; |
| 836 | }; |
| 837 | |
| 838 | struct hal_multi_view_select { |
| 839 | u32 view_index; |
| 840 | }; |
| 841 | |
| 842 | struct hal_timestamp_scale { |
| 843 | u32 time_stamp_scale; |
| 844 | }; |
| 845 | |
| 846 | |
Chinmay Sawarkar | d005462 | 2017-05-04 13:50:59 -0700 | [diff] [blame] | 847 | struct hal_vui_timing_info { |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 848 | u32 enable; |
| 849 | u32 fixed_frame_rate; |
| 850 | u32 time_scale; |
| 851 | }; |
| 852 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 853 | struct hal_preserve_text_quality { |
| 854 | u32 enable; |
| 855 | }; |
| 856 | |
Praneeth Paladugu | 238977b | 2016-12-06 12:51:26 -0800 | [diff] [blame] | 857 | enum hal_core_id { |
| 858 | VIDC_CORE_ID_DEFAULT = 0, |
| 859 | VIDC_CORE_ID_1 = 1, /* 0b01 */ |
| 860 | VIDC_CORE_ID_2 = 2, /* 0b10 */ |
| 861 | VIDC_CORE_ID_3 = 3, /* 0b11 */ |
| 862 | VIDC_CORE_ID_UNUSED = 0x10000000, |
| 863 | }; |
| 864 | |
| 865 | struct hal_videocores_usage_info { |
| 866 | u32 video_core_enable_mask; |
| 867 | }; |
| 868 | |
| 869 | enum hal_work_mode { |
| 870 | VIDC_WORK_MODE_1, |
| 871 | VIDC_WORK_MODE_2, |
| 872 | VIDC_WORK_MODE_UNUSED = 0x10000000, |
| 873 | }; |
| 874 | |
| 875 | struct hal_video_work_mode { |
| 876 | u32 video_work_mode; |
| 877 | }; |
| 878 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 879 | struct hal_vpe_color_space_conversion { |
Chinmay Sawarkar | ddd1d97 | 2017-08-15 10:10:06 -0700 | [diff] [blame] | 880 | u32 input_color_primaries; |
| 881 | u32 custom_matrix_enabled; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 882 | u32 csc_matrix[HAL_MAX_MATRIX_COEFFS]; |
| 883 | u32 csc_bias[HAL_MAX_BIAS_COEFFS]; |
| 884 | u32 csc_limit[HAL_MAX_LIMIT_COEFFS]; |
| 885 | }; |
| 886 | |
| 887 | struct hal_video_signal_info { |
| 888 | u32 color_space; |
| 889 | u32 transfer_chars; |
| 890 | u32 matrix_coeffs; |
| 891 | bool full_range; |
| 892 | }; |
| 893 | |
| 894 | enum hal_iframesize_type { |
| 895 | HAL_IFRAMESIZE_TYPE_DEFAULT, |
| 896 | HAL_IFRAMESIZE_TYPE_MEDIUM, |
| 897 | HAL_IFRAMESIZE_TYPE_HUGE, |
| 898 | HAL_IFRAMESIZE_TYPE_UNLIMITED, |
| 899 | }; |
| 900 | |
| 901 | enum vidc_resource_id { |
| 902 | VIDC_RESOURCE_NONE, |
Shivendra Kakrania | c1f60e0 | 2017-04-13 00:07:26 -0700 | [diff] [blame] | 903 | VIDC_RESOURCE_SYSCACHE, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 904 | VIDC_UNUSED_RESOURCE = 0x10000000, |
| 905 | }; |
| 906 | |
| 907 | struct vidc_resource_hdr { |
| 908 | enum vidc_resource_id resource_id; |
| 909 | void *resource_handle; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 910 | }; |
| 911 | |
| 912 | struct vidc_buffer_addr_info { |
| 913 | enum hal_buffer buffer_type; |
| 914 | u32 buffer_size; |
| 915 | u32 num_buffers; |
Maheshwar Ajja | c6407c0 | 2017-06-09 18:53:20 -0700 | [diff] [blame] | 916 | u32 align_device_addr; |
| 917 | u32 extradata_addr; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 918 | u32 extradata_size; |
| 919 | u32 response_required; |
| 920 | }; |
| 921 | |
| 922 | /* Needs to be exactly the same as hfi_buffer_info */ |
| 923 | struct hal_buffer_info { |
| 924 | u32 buffer_addr; |
| 925 | u32 extra_data_addr; |
| 926 | }; |
| 927 | |
| 928 | struct vidc_frame_plane_config { |
| 929 | u32 left; |
| 930 | u32 top; |
| 931 | u32 width; |
| 932 | u32 height; |
| 933 | u32 stride; |
| 934 | u32 scan_lines; |
| 935 | }; |
| 936 | |
| 937 | struct vidc_uncompressed_frame_config { |
| 938 | struct vidc_frame_plane_config luma_plane; |
| 939 | struct vidc_frame_plane_config chroma_plane; |
| 940 | }; |
| 941 | |
| 942 | struct vidc_frame_data { |
| 943 | enum hal_buffer buffer_type; |
Maheshwar Ajja | c6407c0 | 2017-06-09 18:53:20 -0700 | [diff] [blame] | 944 | u32 device_addr; |
| 945 | u32 extradata_addr; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 946 | int64_t timestamp; |
| 947 | u32 flags; |
| 948 | u32 offset; |
| 949 | u32 alloc_len; |
| 950 | u32 filled_len; |
| 951 | u32 mark_target; |
| 952 | u32 mark_data; |
| 953 | u32 clnt_data; |
| 954 | u32 extradata_size; |
| 955 | }; |
| 956 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 957 | struct hal_fw_info { |
| 958 | char version[VENUS_VERSION_LENGTH]; |
| 959 | phys_addr_t base_addr; |
| 960 | int register_base; |
| 961 | int register_size; |
| 962 | int irq; |
| 963 | }; |
| 964 | |
| 965 | enum hal_flush { |
| 966 | HAL_FLUSH_INPUT, |
| 967 | HAL_FLUSH_OUTPUT, |
| 968 | HAL_FLUSH_ALL, |
| 969 | HAL_UNUSED_FLUSH = 0x10000000, |
| 970 | }; |
| 971 | |
| 972 | enum hal_event_type { |
| 973 | HAL_EVENT_SEQ_CHANGED_SUFFICIENT_RESOURCES, |
| 974 | HAL_EVENT_SEQ_CHANGED_INSUFFICIENT_RESOURCES, |
| 975 | HAL_EVENT_RELEASE_BUFFER_REFERENCE, |
| 976 | HAL_UNUSED_SEQCHG = 0x10000000, |
| 977 | }; |
| 978 | |
| 979 | enum buffer_mode_type { |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 980 | HAL_BUFFER_MODE_DYNAMIC = 0x100, |
Chinmay Sawarkar | 2de3f77 | 2017-02-07 12:03:44 -0800 | [diff] [blame] | 981 | HAL_BUFFER_MODE_STATIC = 0x001, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 982 | }; |
| 983 | |
| 984 | struct hal_buffer_alloc_mode { |
| 985 | enum hal_buffer buffer_type; |
| 986 | enum buffer_mode_type buffer_mode; |
| 987 | }; |
| 988 | |
| 989 | enum ltr_mode { |
| 990 | HAL_LTR_MODE_DISABLE, |
| 991 | HAL_LTR_MODE_MANUAL, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 992 | }; |
| 993 | |
| 994 | struct hal_ltr_mode { |
| 995 | enum ltr_mode mode; |
| 996 | u32 count; |
| 997 | u32 trust_mode; |
| 998 | }; |
| 999 | |
| 1000 | struct hal_ltr_use { |
| 1001 | u32 ref_ltr; |
| 1002 | u32 use_constraint; |
| 1003 | u32 frames; |
| 1004 | }; |
| 1005 | |
| 1006 | struct hal_ltr_mark { |
| 1007 | u32 mark_frame; |
| 1008 | }; |
| 1009 | |
| 1010 | enum hal_perf_mode { |
| 1011 | HAL_PERF_MODE_POWER_SAVE, |
| 1012 | HAL_PERF_MODE_POWER_MAX_QUALITY, |
| 1013 | }; |
| 1014 | |
| 1015 | struct hal_hybrid_hierp { |
| 1016 | u32 layers; |
| 1017 | }; |
| 1018 | |
| 1019 | struct hal_scs_threshold { |
| 1020 | u32 threshold_value; |
| 1021 | }; |
| 1022 | |
| 1023 | struct buffer_requirements { |
| 1024 | struct hal_buffer_requirements buffer[HAL_BUFFER_MAX]; |
| 1025 | }; |
| 1026 | |
Umesh Pandey | 42313a7 | 2017-07-05 18:20:06 -0700 | [diff] [blame] | 1027 | struct hal_conceal_color { |
| 1028 | u32 conceal_color_8bit; |
| 1029 | u32 conceal_color_10bit; |
| 1030 | }; |
| 1031 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1032 | union hal_get_property { |
| 1033 | struct hal_frame_rate frame_rate; |
| 1034 | struct hal_uncompressed_format_select format_select; |
| 1035 | struct hal_uncompressed_plane_actual plane_actual; |
| 1036 | struct hal_uncompressed_plane_actual_info plane_actual_info; |
| 1037 | struct hal_uncompressed_plane_constraints plane_constraints; |
| 1038 | struct hal_uncompressed_plane_actual_constraints_info |
| 1039 | plane_constraints_info; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1040 | struct hal_frame_size frame_size; |
| 1041 | struct hal_enable enable; |
| 1042 | struct hal_buffer_count_actual buffer_count_actual; |
| 1043 | struct hal_extradata_enable extradata_enable; |
| 1044 | struct hal_enable_picture enable_picture; |
| 1045 | struct hal_multi_stream multi_stream; |
| 1046 | struct hal_display_picture_buffer_count display_picture_buffer_count; |
| 1047 | struct hal_mb_error_map mb_error_map; |
| 1048 | struct hal_request_iframe request_iframe; |
| 1049 | struct hal_bitrate bitrate; |
| 1050 | struct hal_profile_level profile_level; |
| 1051 | struct hal_profile_level_supported profile_level_supported; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1052 | struct hal_h264_db_control h264_db_control; |
| 1053 | struct hal_temporal_spatial_tradeoff temporal_spatial_tradeoff; |
| 1054 | struct hal_quantization quantization; |
| 1055 | struct hal_quantization_range quantization_range; |
| 1056 | struct hal_intra_period intra_period; |
| 1057 | struct hal_idr_period idr_period; |
Chinmay Sawarkar | 582c72a | 2017-05-24 14:29:12 -0700 | [diff] [blame] | 1058 | struct hal_vpe_rotation vpe_rotation; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1059 | struct hal_intra_refresh intra_refresh; |
| 1060 | struct hal_multi_slice_control multi_slice_control; |
| 1061 | struct hal_debug_config debug_config; |
| 1062 | struct hal_batch_info batch_info; |
| 1063 | struct hal_metadata_pass_through metadata_pass_through; |
| 1064 | struct hal_uncompressed_format_supported uncompressed_format_supported; |
| 1065 | struct hal_interlace_format_supported interlace_format_supported; |
| 1066 | struct hal_properties_supported properties_supported; |
| 1067 | struct hal_capability_supported capability_supported; |
| 1068 | struct hal_capability_supported_info capability_supported_info; |
| 1069 | struct hal_nal_stream_format_supported nal_stream_format_supported; |
| 1070 | struct hal_nal_stream_format_select nal_stream_format_select; |
| 1071 | struct hal_multi_view_format multi_view_format; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1072 | struct hal_codec_supported codec_supported; |
| 1073 | struct hal_multi_view_select multi_view_select; |
| 1074 | struct hal_timestamp_scale timestamp_scale; |
Chinmay Sawarkar | d005462 | 2017-05-04 13:50:59 -0700 | [diff] [blame] | 1075 | struct hal_vui_timing_info vui_timing_info; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1076 | struct hal_preserve_text_quality preserve_text_quality; |
| 1077 | struct hal_buffer_info buffer_info; |
| 1078 | struct hal_buffer_alloc_mode buffer_alloc_mode; |
| 1079 | struct buffer_requirements buf_req; |
| 1080 | enum hal_h264_entropy h264_entropy; |
Umesh Pandey | 42313a7 | 2017-07-05 18:20:06 -0700 | [diff] [blame] | 1081 | struct hal_conceal_color conceal_color; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1082 | }; |
| 1083 | |
| 1084 | /* HAL Response */ |
| 1085 | #define IS_HAL_SYS_CMD(cmd) ((cmd) >= HAL_SYS_INIT_DONE && \ |
| 1086 | (cmd) <= HAL_SYS_ERROR) |
| 1087 | #define IS_HAL_SESSION_CMD(cmd) ((cmd) >= HAL_SESSION_EVENT_CHANGE && \ |
| 1088 | (cmd) <= HAL_SESSION_ERROR) |
| 1089 | enum hal_command_response { |
| 1090 | /* SYSTEM COMMANDS_DONE*/ |
| 1091 | HAL_SYS_INIT_DONE, |
| 1092 | HAL_SYS_SET_RESOURCE_DONE, |
| 1093 | HAL_SYS_RELEASE_RESOURCE_DONE, |
| 1094 | HAL_SYS_PING_ACK_DONE, |
| 1095 | HAL_SYS_PC_PREP_DONE, |
| 1096 | HAL_SYS_IDLE, |
| 1097 | HAL_SYS_DEBUG, |
| 1098 | HAL_SYS_WATCHDOG_TIMEOUT, |
| 1099 | HAL_SYS_ERROR, |
| 1100 | /* SESSION COMMANDS_DONE */ |
| 1101 | HAL_SESSION_EVENT_CHANGE, |
| 1102 | HAL_SESSION_LOAD_RESOURCE_DONE, |
| 1103 | HAL_SESSION_INIT_DONE, |
| 1104 | HAL_SESSION_END_DONE, |
| 1105 | HAL_SESSION_ABORT_DONE, |
| 1106 | HAL_SESSION_START_DONE, |
| 1107 | HAL_SESSION_STOP_DONE, |
| 1108 | HAL_SESSION_ETB_DONE, |
| 1109 | HAL_SESSION_FTB_DONE, |
| 1110 | HAL_SESSION_FLUSH_DONE, |
| 1111 | HAL_SESSION_SUSPEND_DONE, |
| 1112 | HAL_SESSION_RESUME_DONE, |
| 1113 | HAL_SESSION_SET_PROP_DONE, |
| 1114 | HAL_SESSION_GET_PROP_DONE, |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1115 | HAL_SESSION_RELEASE_BUFFER_DONE, |
| 1116 | HAL_SESSION_RELEASE_RESOURCE_DONE, |
| 1117 | HAL_SESSION_PROPERTY_INFO, |
| 1118 | HAL_SESSION_ERROR, |
| 1119 | HAL_RESPONSE_UNUSED = 0x10000000, |
| 1120 | }; |
| 1121 | |
Praneeth Paladugu | 319e792 | 2017-03-16 11:09:06 -0700 | [diff] [blame] | 1122 | struct ubwc_cr_stats_info_type { |
| 1123 | u32 cr_stats_info0; |
| 1124 | u32 cr_stats_info1; |
| 1125 | u32 cr_stats_info2; |
| 1126 | u32 cr_stats_info3; |
| 1127 | u32 cr_stats_info4; |
| 1128 | u32 cr_stats_info5; |
| 1129 | u32 cr_stats_info6; |
| 1130 | }; |
| 1131 | |
| 1132 | struct recon_stats_type { |
| 1133 | u32 buffer_index; |
| 1134 | u32 complexity_number; |
| 1135 | struct ubwc_cr_stats_info_type ubwc_stats_info; |
| 1136 | }; |
| 1137 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1138 | struct vidc_hal_ebd { |
| 1139 | u32 timestamp_hi; |
| 1140 | u32 timestamp_lo; |
| 1141 | u32 flags; |
| 1142 | enum vidc_status status; |
| 1143 | u32 mark_target; |
| 1144 | u32 mark_data; |
| 1145 | u32 stats; |
| 1146 | u32 offset; |
| 1147 | u32 alloc_len; |
| 1148 | u32 filled_len; |
| 1149 | enum hal_picture picture_type; |
Praneeth Paladugu | 319e792 | 2017-03-16 11:09:06 -0700 | [diff] [blame] | 1150 | struct recon_stats_type recon_stats; |
Maheshwar Ajja | c6407c0 | 2017-06-09 18:53:20 -0700 | [diff] [blame] | 1151 | u32 packet_buffer; |
| 1152 | u32 extra_data_buffer; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1153 | }; |
| 1154 | |
| 1155 | struct vidc_hal_fbd { |
| 1156 | u32 stream_id; |
| 1157 | u32 view_id; |
| 1158 | u32 timestamp_hi; |
| 1159 | u32 timestamp_lo; |
| 1160 | u32 flags1; |
| 1161 | u32 mark_target; |
| 1162 | u32 mark_data; |
| 1163 | u32 stats; |
| 1164 | u32 alloc_len1; |
| 1165 | u32 filled_len1; |
| 1166 | u32 offset1; |
| 1167 | u32 frame_width; |
| 1168 | u32 frame_height; |
| 1169 | u32 start_x_coord; |
| 1170 | u32 start_y_coord; |
| 1171 | u32 input_tag; |
| 1172 | u32 input_tag1; |
| 1173 | enum hal_picture picture_type; |
Maheshwar Ajja | c6407c0 | 2017-06-09 18:53:20 -0700 | [diff] [blame] | 1174 | u32 packet_buffer1; |
| 1175 | u32 extra_data_buffer; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1176 | u32 flags2; |
| 1177 | u32 alloc_len2; |
| 1178 | u32 filled_len2; |
| 1179 | u32 offset2; |
Maheshwar Ajja | c6407c0 | 2017-06-09 18:53:20 -0700 | [diff] [blame] | 1180 | u32 packet_buffer2; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1181 | u32 flags3; |
| 1182 | u32 alloc_len3; |
| 1183 | u32 filled_len3; |
| 1184 | u32 offset3; |
Maheshwar Ajja | c6407c0 | 2017-06-09 18:53:20 -0700 | [diff] [blame] | 1185 | u32 packet_buffer3; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1186 | enum hal_buffer buffer_type; |
| 1187 | }; |
| 1188 | |
| 1189 | struct msm_vidc_capability { |
| 1190 | enum hal_domain domain; |
| 1191 | enum hal_video_codec codec; |
| 1192 | struct hal_capability_supported width; |
| 1193 | struct hal_capability_supported height; |
| 1194 | struct hal_capability_supported mbs_per_frame; |
| 1195 | struct hal_capability_supported mbs_per_sec; |
| 1196 | struct hal_capability_supported frame_rate; |
| 1197 | struct hal_capability_supported scale_x; |
| 1198 | struct hal_capability_supported scale_y; |
| 1199 | struct hal_capability_supported bitrate; |
| 1200 | struct hal_capability_supported bframe; |
| 1201 | struct hal_capability_supported peakbitrate; |
| 1202 | struct hal_capability_supported hier_p; |
| 1203 | struct hal_capability_supported ltr_count; |
| 1204 | struct hal_capability_supported secure_output2_threshold; |
| 1205 | struct hal_capability_supported hier_b; |
| 1206 | struct hal_capability_supported lcu_size; |
| 1207 | struct hal_capability_supported hier_p_hybrid; |
| 1208 | struct hal_capability_supported mbs_per_sec_power_save; |
Praneeth Paladugu | 520c759 | 2017-01-26 13:53:14 -0800 | [diff] [blame] | 1209 | struct hal_capability_supported extradata; |
| 1210 | struct hal_capability_supported profile; |
| 1211 | struct hal_capability_supported level; |
| 1212 | struct hal_capability_supported i_qp; |
| 1213 | struct hal_capability_supported p_qp; |
| 1214 | struct hal_capability_supported b_qp; |
| 1215 | struct hal_capability_supported rc_modes; |
| 1216 | struct hal_capability_supported blur_width; |
| 1217 | struct hal_capability_supported blur_height; |
| 1218 | struct hal_capability_supported slice_delivery_mode; |
| 1219 | struct hal_capability_supported slice_bytes; |
| 1220 | struct hal_capability_supported slice_mbs; |
| 1221 | struct hal_capability_supported secure; |
| 1222 | struct hal_capability_supported max_num_b_frames; |
| 1223 | struct hal_capability_supported max_video_cores; |
| 1224 | struct hal_capability_supported max_work_modes; |
| 1225 | struct hal_capability_supported ubwc_cr_stats; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1226 | struct hal_profile_level_supported profile_level; |
| 1227 | struct hal_uncompressed_format_supported uncomp_format; |
| 1228 | struct hal_interlace_format_supported HAL_format; |
| 1229 | struct hal_nal_stream_format_supported nal_stream_format; |
| 1230 | struct hal_intra_refresh intra_refresh; |
| 1231 | enum buffer_mode_type alloc_mode_out; |
| 1232 | enum buffer_mode_type alloc_mode_in; |
| 1233 | u32 pixelprocess_capabilities; |
Surajit Podder | e502daa | 2017-05-30 19:17:45 +0530 | [diff] [blame] | 1234 | u32 tme_version; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1235 | }; |
| 1236 | |
| 1237 | struct vidc_hal_sys_init_done { |
| 1238 | u32 dec_codec_supported; |
| 1239 | u32 enc_codec_supported; |
| 1240 | u32 codec_count; |
| 1241 | struct msm_vidc_capability *capabilities; |
| 1242 | u32 max_sessions_supported; |
| 1243 | }; |
| 1244 | |
| 1245 | struct vidc_hal_session_init_done { |
| 1246 | struct msm_vidc_capability capability; |
| 1247 | }; |
| 1248 | |
| 1249 | struct msm_vidc_cb_cmd_done { |
| 1250 | u32 device_id; |
| 1251 | void *session_id; |
| 1252 | enum vidc_status status; |
| 1253 | u32 size; |
| 1254 | union { |
| 1255 | struct vidc_resource_hdr resource_hdr; |
| 1256 | struct vidc_buffer_addr_info buffer_addr_info; |
| 1257 | struct vidc_frame_plane_config frame_plane_config; |
| 1258 | struct vidc_uncompressed_frame_config uncompressed_frame_config; |
| 1259 | struct vidc_frame_data frame_data; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1260 | struct vidc_hal_ebd ebd; |
| 1261 | struct vidc_hal_fbd fbd; |
| 1262 | struct vidc_hal_sys_init_done sys_init_done; |
| 1263 | struct vidc_hal_session_init_done session_init_done; |
| 1264 | struct hal_buffer_info buffer_info; |
| 1265 | union hal_get_property property; |
| 1266 | enum hal_flush flush_type; |
| 1267 | } data; |
| 1268 | }; |
| 1269 | |
Praneeth Paladugu | 520e9b2 | 2017-05-31 13:25:18 -0700 | [diff] [blame] | 1270 | struct hal_index_extradata_input_crop_payload { |
| 1271 | u32 size; |
| 1272 | u32 version; |
| 1273 | u32 port_index; |
| 1274 | u32 left; |
| 1275 | u32 top; |
| 1276 | u32 width; |
| 1277 | u32 height; |
| 1278 | }; |
| 1279 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1280 | struct msm_vidc_cb_event { |
| 1281 | u32 device_id; |
| 1282 | void *session_id; |
| 1283 | enum vidc_status status; |
| 1284 | u32 height; |
| 1285 | u32 width; |
| 1286 | enum msm_vidc_pixel_depth bit_depth; |
| 1287 | u32 hal_event_type; |
Maheshwar Ajja | c6407c0 | 2017-06-09 18:53:20 -0700 | [diff] [blame] | 1288 | u32 packet_buffer; |
| 1289 | u32 extra_data_buffer; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1290 | u32 pic_struct; |
| 1291 | u32 colour_space; |
Chinmay Sawarkar | b3c6ccb | 2017-02-23 18:01:32 -0800 | [diff] [blame] | 1292 | u32 profile; |
| 1293 | u32 level; |
| 1294 | u32 entropy_mode; |
Praneeth Paladugu | 520e9b2 | 2017-05-31 13:25:18 -0700 | [diff] [blame] | 1295 | u32 capture_buf_count; |
| 1296 | struct hal_index_extradata_input_crop_payload crop_data; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1297 | }; |
| 1298 | |
| 1299 | struct msm_vidc_cb_data_done { |
| 1300 | u32 device_id; |
| 1301 | void *session_id; |
| 1302 | enum vidc_status status; |
| 1303 | u32 size; |
| 1304 | u32 clnt_data; |
| 1305 | union { |
| 1306 | struct vidc_hal_ebd input_done; |
| 1307 | struct vidc_hal_fbd output_done; |
| 1308 | }; |
| 1309 | }; |
| 1310 | |
| 1311 | struct msm_vidc_cb_info { |
| 1312 | enum hal_command_response response_type; |
| 1313 | union { |
| 1314 | struct msm_vidc_cb_cmd_done cmd; |
| 1315 | struct msm_vidc_cb_event event; |
| 1316 | struct msm_vidc_cb_data_done data; |
| 1317 | } response; |
| 1318 | }; |
| 1319 | |
| 1320 | enum msm_vidc_hfi_type { |
| 1321 | VIDC_HFI_VENUS, |
| 1322 | }; |
| 1323 | |
| 1324 | enum msm_vidc_thermal_level { |
| 1325 | VIDC_THERMAL_NORMAL = 0, |
| 1326 | VIDC_THERMAL_LOW, |
| 1327 | VIDC_THERMAL_HIGH, |
| 1328 | VIDC_THERMAL_CRITICAL |
| 1329 | }; |
| 1330 | |
| 1331 | enum vidc_vote_data_session { |
| 1332 | VIDC_BUS_VOTE_DATA_SESSION_INVALID = 0, |
| 1333 | /* |
| 1334 | * No declarations exist. Values generated by VIDC_VOTE_DATA_SESSION_VAL |
| 1335 | * describe the enumerations e.g.: |
| 1336 | * |
| 1337 | * enum vidc_bus_vote_data_session_type h264_decoder_session = |
| 1338 | * VIDC_VOTE_DATA_SESSION_VAL(HAL_VIDEO_CODEC_H264, |
| 1339 | * HAL_VIDEO_DOMAIN_DECODER); |
| 1340 | */ |
| 1341 | }; |
| 1342 | |
| 1343 | /* |
| 1344 | * Careful modifying VIDC_VOTE_DATA_SESSION_VAL(). |
| 1345 | * |
| 1346 | * This macro assigns two bits to each codec: the lower bit denoting the codec |
| 1347 | * type, and the higher bit denoting session type. |
| 1348 | */ |
| 1349 | static inline enum vidc_vote_data_session VIDC_VOTE_DATA_SESSION_VAL( |
| 1350 | enum hal_video_codec c, enum hal_domain d) { |
| 1351 | if (d != HAL_VIDEO_DOMAIN_ENCODER && d != HAL_VIDEO_DOMAIN_DECODER) |
| 1352 | return VIDC_BUS_VOTE_DATA_SESSION_INVALID; |
| 1353 | |
| 1354 | return (1 << ilog2(c) * 2) | ((d - 1) << (ilog2(c) * 2 + 1)); |
| 1355 | } |
| 1356 | |
| 1357 | struct msm_vidc_gov_data { |
| 1358 | struct vidc_bus_vote_data *data; |
| 1359 | u32 data_count; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1360 | }; |
| 1361 | |
| 1362 | enum msm_vidc_power_mode { |
| 1363 | VIDC_POWER_NORMAL = 0, |
| 1364 | VIDC_POWER_LOW, |
| 1365 | VIDC_POWER_TURBO |
| 1366 | }; |
| 1367 | |
| 1368 | struct vidc_bus_vote_data { |
| 1369 | enum hal_domain domain; |
| 1370 | enum hal_video_codec codec; |
| 1371 | enum hal_uncompressed_format color_formats[2]; |
| 1372 | int num_formats; /* 1 = DPB-OPB unified; 2 = split */ |
Praneeth Paladugu | 319e792 | 2017-03-16 11:09:06 -0700 | [diff] [blame] | 1373 | int input_height, input_width, fps; |
| 1374 | int output_height, output_width; |
| 1375 | int compression_ratio; |
| 1376 | int complexity_factor; |
Praneeth Paladugu | 7722b4e | 2017-07-07 11:01:56 -0700 | [diff] [blame] | 1377 | int input_cr; |
Praneeth Paladugu | 04e7772 | 2017-06-21 11:38:31 -0700 | [diff] [blame] | 1378 | bool use_dpb_read; |
Praneeth Paladugu | 319e792 | 2017-03-16 11:09:06 -0700 | [diff] [blame] | 1379 | unsigned int lcu_size; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1380 | enum msm_vidc_power_mode power_mode; |
Praneeth Paladugu | 319e792 | 2017-03-16 11:09:06 -0700 | [diff] [blame] | 1381 | enum hal_work_mode work_mode; |
Shivendra Kakrania | ac170f9 | 2017-05-22 13:08:09 -0700 | [diff] [blame] | 1382 | bool use_sys_cache; |
Praneeth Paladugu | 7722b4e | 2017-07-07 11:01:56 -0700 | [diff] [blame] | 1383 | bool b_frames_enabled; |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1384 | }; |
| 1385 | |
| 1386 | struct vidc_clk_scale_data { |
| 1387 | enum vidc_vote_data_session session[VIDC_MAX_SESSIONS]; |
| 1388 | enum msm_vidc_power_mode power_mode[VIDC_MAX_SESSIONS]; |
| 1389 | u32 load[VIDC_MAX_SESSIONS]; |
| 1390 | int num_sessions; |
| 1391 | }; |
| 1392 | |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1393 | struct hal_cmd_sys_get_property_packet { |
| 1394 | u32 size; |
| 1395 | u32 packet_type; |
| 1396 | u32 num_properties; |
| 1397 | u32 rg_property_data[1]; |
| 1398 | }; |
| 1399 | |
| 1400 | #define call_hfi_op(q, op, args...) \ |
| 1401 | (((q) && (q)->op) ? ((q)->op(args)) : 0) |
| 1402 | |
| 1403 | struct hfi_device { |
| 1404 | void *hfi_device_data; |
| 1405 | |
| 1406 | /*Add function pointers for all the hfi functions below*/ |
| 1407 | int (*core_init)(void *device); |
| 1408 | int (*core_release)(void *device); |
| 1409 | int (*core_ping)(void *device); |
| 1410 | int (*core_trigger_ssr)(void *device, enum hal_ssr_trigger_type); |
| 1411 | int (*session_init)(void *device, void *session_id, |
| 1412 | enum hal_domain session_type, enum hal_video_codec codec_type, |
| 1413 | void **new_session); |
| 1414 | int (*session_end)(void *session); |
| 1415 | int (*session_abort)(void *session); |
| 1416 | int (*session_set_buffers)(void *sess, |
| 1417 | struct vidc_buffer_addr_info *buffer_info); |
| 1418 | int (*session_release_buffers)(void *sess, |
| 1419 | struct vidc_buffer_addr_info *buffer_info); |
| 1420 | int (*session_load_res)(void *sess); |
| 1421 | int (*session_release_res)(void *sess); |
| 1422 | int (*session_start)(void *sess); |
| 1423 | int (*session_continue)(void *sess); |
| 1424 | int (*session_stop)(void *sess); |
| 1425 | int (*session_etb)(void *sess, struct vidc_frame_data *input_frame); |
| 1426 | int (*session_ftb)(void *sess, struct vidc_frame_data *output_frame); |
| 1427 | int (*session_process_batch)(void *sess, |
| 1428 | int num_etbs, struct vidc_frame_data etbs[], |
| 1429 | int num_ftbs, struct vidc_frame_data ftbs[]); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1430 | int (*session_get_buf_req)(void *sess); |
| 1431 | int (*session_flush)(void *sess, enum hal_flush flush_mode); |
| 1432 | int (*session_set_property)(void *sess, enum hal_property ptype, |
| 1433 | void *pdata); |
| 1434 | int (*session_get_property)(void *sess, enum hal_property ptype); |
Praneeth Paladugu | b71968b | 2015-08-19 20:47:57 -0700 | [diff] [blame] | 1435 | int (*scale_clocks)(void *dev, u32 freq); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1436 | int (*vote_bus)(void *dev, struct vidc_bus_vote_data *data, |
| 1437 | int num_data); |
| 1438 | int (*get_fw_info)(void *dev, struct hal_fw_info *fw_info); |
| 1439 | int (*session_clean)(void *sess); |
| 1440 | int (*get_core_capabilities)(void *dev); |
| 1441 | int (*suspend)(void *dev); |
| 1442 | int (*flush_debug_queue)(void *dev); |
Maheshwar Ajja | 9ff81a2 | 2017-08-05 13:25:55 -0700 | [diff] [blame] | 1443 | int (*noc_error_info)(void *dev); |
Praneeth Paladugu | 6e6fbdb | 2017-01-16 15:43:01 -0800 | [diff] [blame] | 1444 | enum hal_default_properties (*get_default_properties)(void *dev); |
| 1445 | }; |
| 1446 | |
| 1447 | typedef void (*hfi_cmd_response_callback) (enum hal_command_response cmd, |
| 1448 | void *data); |
| 1449 | typedef void (*msm_vidc_callback) (u32 response, void *callback); |
| 1450 | |
| 1451 | struct hfi_device *vidc_hfi_initialize(enum msm_vidc_hfi_type hfi_type, |
| 1452 | u32 device_id, struct msm_vidc_platform_resources *res, |
| 1453 | hfi_cmd_response_callback callback); |
| 1454 | void vidc_hfi_deinitialize(enum msm_vidc_hfi_type hfi_type, |
| 1455 | struct hfi_device *hdev); |
| 1456 | u32 vidc_get_hfi_domain(enum hal_domain hal_domain); |
| 1457 | u32 vidc_get_hfi_codec(enum hal_video_codec hal_codec); |
| 1458 | enum hal_domain vidc_get_hal_domain(u32 hfi_domain); |
| 1459 | enum hal_video_codec vidc_get_hal_codec(u32 hfi_codec); |
| 1460 | |
| 1461 | #endif /*__VIDC_HFI_API_H__ */ |