1 /* 2 * Copyright (c) 2021-2022, Intel Corporation 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included 12 * in all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 * OTHER DEALINGS IN THE SOFTWARE. 21 */ 22 //! 23 //! \file media_libva_caps_next.h 24 //! \brief Header file of media caps next class on linux 25 //! 26 27 #ifndef __MEDIA_LIBVA_CAPS_NEXT_H__ 28 #define __MEDIA_LIBVA_CAPS_NEXT_H__ 29 30 #include "media_capstable_specific.h" 31 #include "media_libva_common_next.h" 32 33 class MediaLibvaCapsNext 34 { 35 public: 36 MediaLibvaCapsNext(DDI_MEDIA_CONTEXT *mediaCtx); 37 38 ~MediaLibvaCapsNext(); 39 40 //! 41 //! \brief Create CapsNext 42 //! 43 //! \return MediaLibvaCapsNext* 44 //! 45 static MediaLibvaCapsNext* CreateCaps(DDI_MEDIA_CONTEXT *mediaCtx); 46 47 //! 48 //! \brief Init MediaLibvaCapsNext 49 //! 50 //! \return VAStatus 51 //! VA_STATUS_SUCCESS if success 52 //! 53 VAStatus Init(); 54 55 //! 56 //! \brief Get configlist for create configs 57 //! 58 //! \return All supported ConfigLinuxList 59 //! 60 ConfigList* GetConfigList(); 61 62 //! 63 //! \brief Get Attrib Value 64 //! 65 //! \param [in] profile 66 //! VA profile 67 //! 68 //! \param [in] entrypoint 69 //! VA entrypoint 70 //! 71 //! \param [in] type 72 //! VA ConfigAttribType 73 //! 74 //! \param [out] value 75 //! Pointer to returned AttribType 76 //! 77 //! \return VAStatus 78 //! VA_STATUS_SUCCESS if success 79 //! 80 VAStatus GetAttribValue( 81 VAProfile profile, 82 VAEntrypoint entrypoint, 83 VAConfigAttribType type, 84 uint32_t *value); 85 86 //! 87 //! \brief Return the maxinum number of supported image formats for current platform ipVersion 88 //! 89 //! \return The maxinum number of supported image formats for current platform ipVersion 90 //! 91 uint32_t GetImageFormatsMaxNum(); 92 93 //! 94 //! \brief Query supported profiles 95 //! 96 //! \param [in] profileList 97 //! Pointer to VAProfile array that can hold at least vaMaxNumProfile() entries 98 //! 99 //! \param [out] numProfiles 100 //! Pointer to int32_t. It returns the actual number of supported profiles. 101 //! 102 //! \return VAStatus 103 //! VA_STATUS_SUCCESS if success 104 //! 105 VAStatus QueryConfigProfiles( 106 VAProfile *profileList, 107 int32_t *profilesNum); 108 109 //! 110 //! \brief Query all attributes for a given configuration 111 //! 112 //! \param [in] configId 113 //! VA configuration 114 //! 115 //! \param [in,out] profile 116 //! Pointer to VAProfile of the configuration 117 //! 118 //! \param [in,out] entrypoint 119 //! Pointer to VAEntrypoint of the configuration 120 //! 121 //! \param [in,out] attribList 122 //! Pointer to VAConfigAttrib array that can hold at least 123 //! vaMaxNumConfigAttributes() entries. 124 //! 125 //! \param [in,out] numAttribs 126 //! The actual number of VAConfigAttrib returned in the array attribList 127 //! 128 //! \return VAStatus 129 //! VA_STATUS_SUCCESS if success 130 //! 131 VAStatus QueryConfigAttributes( 132 VAConfigID configId, 133 VAProfile *profile, 134 VAEntrypoint *entrypoint, 135 VAConfigAttrib *attribList, 136 int32_t *numAttribs); 137 138 //! 139 //! 140 //! \brief Create a configuration 141 //! \details It passes in the attribute list that specifies the attributes it 142 //! cares about, with the rest taking default values. 143 //! 144 //! \param [in] profile 145 //! VA profile 146 //! 147 //! \param [in] entrypoint 148 //! VA entrypoint 149 //! 150 //! \param [in] attribList 151 //! Pointer to VAConfigAttrib array that specifies the attributes 152 //! 153 //! \param [in] numAttribs 154 //! Number of VAConfigAttrib in the array attribList 155 //! 156 //! \param [out] configId 157 //! Pointer to returned VAConfigID if success 158 //! 159 //! \return VAStatus 160 //! VA_STATUS_SUCCESS if success 161 //! 162 VAStatus CreateConfig( 163 VAProfile profile, 164 VAEntrypoint entrypoint, 165 VAConfigAttrib *attribList, 166 int32_t numAttribs, 167 VAConfigID *configId); 168 169 //! 170 //! \brief Destory the VAConfigID 171 //! 172 //! \param [in] configId 173 //! Specify the VAConfigID 174 //! 175 //! \return VAStatus 176 //! VA_STATUS_SUCCESS if succeed 177 //! VA_STATUS_ERROR_INVALID_CONFIG if the conifgId is invalid 178 //! 179 VAStatus DestroyConfig(VAConfigID configId); 180 181 //! 182 //! \brief Get attributes for a given profile/entrypoint pair 183 //! \details The caller must provide an "attribList" with all attributes to be 184 //! retrieved. Upon return, the attributes in "attribList" have been 185 //! updated with their value. Unknown attributes or attributes that are 186 //! not supported for the given profile/entrypoint pair will have their 187 //! value set to VA_ATTRIB_NOT_SUPPORTED. 188 //! 189 //! \param [in] profile 190 //! VA profile 191 //! 192 //! \param [in] entrypoint 193 //! VA entrypoint 194 //! 195 //! \param [in,out] attribList 196 //! Pointer to VAConfigAttrib array. The attribute type is set by caller and 197 //! attribute value is set by this function. 198 //! 199 //! \param [in] numAttribs 200 //! Number of VAConfigAttrib in the array attribList 201 //! 202 //! \return VAStatus 203 //! VA_STATUS_SUCCESS if success 204 //! 205 VAStatus GetConfigAttributes( 206 VAProfile profile, 207 VAEntrypoint entrypoint, 208 VAConfigAttrib *attribList, 209 int32_t numAttribs); 210 211 //! \brief Get the general attribute 212 //! 213 //! \param [in,out] attrib 214 //! Pointer to the CAConfigAttrib 215 //! 216 //! \return VAStatus 217 //! VA_STATUS_SUCCESS if success 218 //! 219 VAStatus GetGeneralConfigAttrib(VAConfigAttrib *attrib); 220 221 //! 222 //! \brief Query supported entrypoints for a given profile 223 //! 224 //! \param [in] profile 225 //! VA profile 226 //! 227 //! \param [in] entrypointList 228 //! Pointer to VAEntrypoint array that can hold at least vaMaxNumEntrypoints() entries 229 //! 230 //! \param [out] numEntryPoints 231 //! It returns the actual number of supported VAEntrypoints. 232 //! 233 //! \return VAStatus 234 //! VA_STATUS_SUCCESS if success 235 //! 236 VAStatus QueryConfigEntrypoints( 237 VAProfile profile, 238 VAEntrypoint *entrypointList, 239 int32_t *entrypointNum); 240 241 //! 242 //! \brief Get surface attributes for a given config ID 243 //! 244 //! \param [in] configId 245 //! VA configuration 246 //! 247 //! \param [in,out] attribList 248 //! Pointer to VASurfaceAttrib array. It returns 249 //! the supported surface attributes 250 //! 251 //! \param [in,out] numAttribs 252 //! The number of elements allocated on input 253 //! Return the number of elements actually filled in output 254 //! 255 //! \return VAStatus 256 //! VA_STATUS_SUCCESS if success 257 //! VA_STATUS_ERROR_MAX_NUM_EXCEEDED if size of attribList is too small 258 //! 259 VAStatus QuerySurfaceAttributes( 260 VAConfigID configId, 261 VASurfaceAttrib *attribList, 262 uint32_t *numAttribs); 263 264 //! 265 //! \brief Query the suppported image formats 266 //! 267 //! \param [in,out] formatList 268 //! Pointer to a VAImageFormat array. The array size shouldn't be less than vaMaxNumImageFormats 269 //! It will return the supported image formats. 270 //! 271 //! \param [in,out] num_formats 272 //! Pointer to a integer that will return the real size of formatList. 273 //! 274 //! \return VAStatus 275 //! VA_STATUS_SUCCESS if succeed 276 //! 277 VAStatus QueryImageFormats( 278 VAImageFormat *formatList, 279 int32_t *numFormats); 280 281 //! 282 //! \brief Populate the color masks info 283 //! 284 //! \param [in,out] Image format 285 //! Pointer to a VAImageFormat array. Color masks information will be populated to this 286 //! structure. 287 //! 288 //! \return VAStatus 289 //! VA_STATUS_SUCCESS if succeed 290 //! 291 VAStatus PopulateColorMaskInfo(VAImageFormat *vaImgFmt); 292 293 //! 294 //! \brief Query display attributes 295 //! 296 //! \param [in] attrList 297 //! VA display attribute 298 //! \param [in] attributesNum 299 //! Number of attributes 300 //! 301 //! \return VAStatus 302 //! VA_STATUS_SUCCESS if success, else fail reason 303 //! 304 VAStatus QueryDisplayAttributes( 305 VADisplayAttribute *attrList, 306 int32_t *attributesNum); 307 308 //! 309 //! \brief Get display attributes 310 //! \details This function returns the current attribute values in "attr_list". 311 //! Only attributes returned with VA_DISPLAY_ATTRIB_GETTABLE set in the "flags" field 312 //! from vaQueryDisplayAttributes() can have their values retrieved. 313 //! 314 //! \param [in] attrList 315 //! VA display attribute 316 //! \param [in] attributesNum 317 //! Number of attributes 318 //! 319 //! \return VAStatus 320 //! VA_STATUS_ERROR_UNIMPLEMENTED 321 //! 322 VAStatus GetDisplayAttributes( 323 VADisplayAttribute *attrList, 324 int32_t attributesNum); 325 326 MediaCapsTableSpecific *m_capsTable = nullptr; 327 328 protected: 329 DDI_MEDIA_CONTEXT *m_mediaCtx = nullptr; 330 331 //! 332 //! \brief Check attrib when create a configuration 333 //! 334 //! \param [in] profile 335 //! VA profile 336 //! 337 //! \param [in] entrypoint 338 //! VA entrypoint 339 //! 340 //! \param [in] attrib 341 //! Pointer to VAConfigAttrib array that specifies the attributes 342 //! 343 //! \param [in] numAttribs 344 //! Number of VAConfigAttrib in the array attribList 345 //! 346 //! \return VAStatus 347 //! VA_STATUS_SUCCESS if success 348 //! 349 VAStatus CheckAttribList( 350 VAProfile profile, 351 VAEntrypoint entrypoint, 352 VAConfigAttrib *attrib, 353 int32_t numAttribs); 354 MEDIA_CLASS_DEFINE_END(MediaLibvaCapsNext) 355 }; 356 357 #endif //__MEDIA_LIBVA_CAPS_NEXT_H__ 358