1 /* 2 * Copyright (c) 2009-2021, 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.h 24 //! \brief libva(and its extension) interface head file 25 //! 26 27 #ifndef __MEDIA_LIBVA_H__ 28 #define __MEDIA_LIBVA_H__ 29 30 #include <va/va.h> 31 #include <va/va_backend.h> 32 #include "va/va_dec_vp8.h" 33 #include <va/va_enc_h264.h> 34 #include <va/va_enc_mpeg2.h> 35 #include <va/va_enc_jpeg.h> 36 #include <va/va_dec_jpeg.h> 37 #include <va/va_enc_vp8.h> 38 #include <va/va_dec_vp9.h> 39 #include <va/va_enc_hevc.h> 40 #include <va/va_vpp.h> 41 #include <va/va_backend_vpp.h> 42 #if VA_CHECK_VERSION(1,11,0) 43 #include <va/va_backend_prot.h> 44 #endif 45 #ifdef ANDROID 46 #if VA_MAJOR_VERSION < 1 47 #include "va_internal_android.h" 48 #endif 49 #endif // ANDROID 50 #include <va/va_dec_hevc.h> 51 #include "codechal.h" 52 #include "codechal_decoder.h" 53 #include "codechal_encoder_base.h" 54 #include "media_libva_common.h" 55 56 #define DDI_CODEC_GEN_MAX_PROFILES 31 // the number of va profiles, some profiles in va_private.h 57 #define DDI_CODEC_GEN_MAX_ENTRYPOINTS 7 // VAEntrypointVLD, VAEntrypointEncSlice, VAEntrypointEncSliceLP, VAEntrypointVideoProc 58 59 #define DDI_CODEC_GEN_MAX_IMAGE_FORMATS 2 // NV12 and P010 60 #define DDI_CODEC_GEN_MAX_SUBPIC_FORMATS 4 // no sub-pic blending support, still set to 4 for further implementation 61 #if VA_MAJOR_VERSION < 1 62 #define DDI_MEDIA_GEN_MAX_DISPLAY_ATTRIBUTES 4 63 #else 64 #define DDI_MEDIA_GEN_MAX_DISPLAY_ATTRIBUTES 1 65 #endif 66 #define DDI_CODEC_GEN_MAX_ATTRIBS_TYPE 4 //VAConfigAttribRTFormat, VAConfigAttribRateControl, VAConfigAttribDecSliceMode, VAConfigAttribEncPackedHeaders 67 68 #define DDI_CODEC_GEN_MAX_SURFACE_ATTRIBUTES 27 69 #define DDI_CODEC_GEN_STR_VENDOR "Intel iHD driver for Intel(R) Gen Graphics - " MEDIA_VERSION " (" MEDIA_VERSION_DETAILS ")" 70 71 #define DDI_CODEC_GET_VTABLE(ctx) (ctx->vtable) 72 #define DDI_CODEC_GET_VTABLE_VPP(ctx) (ctx->vtable_vpp) 73 #if VA_CHECK_VERSION(1,11,0) 74 #define DDI_CODEC_GET_VTABLE_PROT(ctx) (ctx->vtable_prot) 75 #endif 76 #define DDI_CODEC_GET_VTABLE_TPI(ctx) (ctx->vtable_tpi) 77 78 #define DDI_CODEC_BATCH_BUFFER_SIZE 0x80000 79 #define DDI_CODEC_LEFT_SHIFT_FOR_REFLIST1 16 80 81 /* Number of supported input color formats */ 82 #define DDI_VP_NUM_INPUT_COLOR_STD 6 83 /* Number of supported output color formats */ 84 #define DDI_VP_NUM_OUT_COLOR_STD 6 85 /* Number of forward references */ 86 #define DDI_CODEC_NUM_FWD_REF 0 87 /* Number of backward references */ 88 #define DDI_CODEC_NUM_BK_REF 0 89 /* Number of vp surface attributes */ 90 #define DDI_CODEC_NUM_QUERY_ATTR_VP 9 91 92 #define DDI_CODEC_MAX_BITSTREAM_BUFFER 16 93 #define DDI_CODEC_MAX_BITSTREAM_BUFFER_MINUS1 (DDI_CODEC_MAX_BITSTREAM_BUFFER - 1) 94 #define DDI_CODEC_BITSTREAM_BUFFER_INDEX_BITS 4 //the bitstream buffer index is 4 bits length 95 #define DDI_CODEC_MAX_BITSTREAM_BUFFER_INDEX 0xF // the maximum bitstream buffer index is 0xF 96 #define DDI_CODEC_INVALID_BUFFER_INDEX -1 97 #define DDI_CODEC_VP8_MAX_REF_FRAMES 5 98 #define DDI_CODEC_MIN_VALUE_OF_MAX_BS_SIZE 10240 99 #define DDI_CODEC_VDENC_MAX_L0_REF_FRAMES 3 100 #define DDI_CODEC_VDENC_MAX_L1_REF_FRAMES 0 101 102 #define DDI_CODEC_VDENC_MAX_L0_REF_FRAMES_LDB 3 103 #define DDI_CODEC_VDENC_MAX_L1_REF_FRAMES_LDB 3 104 105 #define DDI_CODEC_FEI_MAX_NUM_MVPREDICTOR 4 106 #define DDI_CODEC_FEI_MAX_INTERFACE_REVISION 1000 107 #define DDI_CODEC_FEI_CTB_CMD_SIZE_SKL 16 108 #define DDI_CODEC_FEI_CU_RECORD_SIZE_SKL_KBL 64 109 #define DDI_CODEC_STATS_MAX_NUM_PAST_REFS 1 110 #define DDI_CODEC_STATS_MAX_NUM_FUTURE_REFS 1 111 #define DDI_CODEC_STATS_MAX_NUM_OUTPUTS 3 112 #define DDI_CODEC_STATS_INTERLACED_SUPPORT 1 113 114 #define DDI_CODEC_GEN_CONFIG_ATTRIBUTES_DEC_BASE 0 // Dec config_id starts at this value 115 116 #define DDI_CODEC_GEN_CONFIG_ATTRIBUTES_ENC_BASE 1024 // Enc config_id starts at this value 117 118 /* Some filters in va_private.h */ 119 #define DDI_VP_MAX_NUM_FILTERS VAProcFilterCount 120 121 #define DDI_VP_GEN_CONFIG_ATTRIBUTES_BASE 2048 // VP config_id starts at this value 122 #define DDI_CP_GEN_CONFIG_ATTRIBUTES_BASE 4092 // CP config_id starts at this value 123 #define DDI_CP_ENCRYPT_TYPES_NUM 5 // CP encryption types number 124 125 // Enable unlimited output buffer, delete this build option (remove multiple output buffer) when it is verified 126 #define ENABLE_ENC_UNLIMITED_OUTPUT 127 128 // Max timeout for i915 bo_wait 129 #define DDI_BO_MAX_TIMEOUT (~(0x8000000000000000)) 130 // Negative value for infinite timeout for i915 bo_wait 131 #define DDI_BO_INFINITE_TIMEOUT (-1) 132 133 typedef struct _DDI_CODEC_VC1BITPLANE_OBJECT 134 { 135 uint8_t *pBitPlaneBase; 136 bool bUsed; 137 } DDI_CODEC_VC1BITPLANE_OBJECT; 138 139 typedef struct _DDI_CODEC_BITSTREAM_BUFFER_INFO 140 { 141 uint8_t *pBaseAddress; // For JPEG it is a memory address when allocate slice data from CPU. 142 uint32_t uiOffset; 143 uint32_t uiLength; 144 VABufferID vaBufferId; 145 bool bRendered; // whether this slice data will be rendered. 146 PDDI_MEDIA_BUFFER pMappedGPUBuffer; // the GPU mapping for this buffer. 147 bool bIsUseExtBuf; 148 uint8_t *pSliceBuf; 149 } DDI_CODEC_BITSTREAM_BUFFER_INFO; 150 151 typedef struct _DDI_CODEC_BUFFER_PARAM_H264 152 { 153 // slice control buffer 154 VASliceParameterBufferH264 *pVASliceParaBufH264; 155 VASliceParameterBufferBase *pVASliceParaBufH264Base; 156 157 // one picture buffer 158 VAPictureParameterBufferH264 PicParam264; 159 160 // one IQ buffer 161 VAIQMatrixBufferH264 IQm264; 162 } DDI_CODEC_BUFFER_PARAM_H264; 163 164 typedef struct _DDI_CODEC_BUFFER_PARAM_MPEG2 165 { 166 // slice control buffer 167 VASliceParameterBufferMPEG2 *pVASliceParaBufMPEG2; 168 169 // one picture buffer 170 VAPictureParameterBufferMPEG2 PicParamMPEG2; 171 172 // one IQ buffer 173 VAIQMatrixBufferMPEG2 IQmMPEG2; 174 } DDI_CODEC_BUFFER_PARAM_MPEG2; 175 176 typedef struct _DDI_CODEC_BUFFER_PARAM_VC1 177 { 178 // slice control buffer 179 VASliceParameterBufferVC1 *pVASliceParaBufVC1; 180 181 // one picture buffer 182 VAPictureParameterBufferVC1 PicParamVC1; 183 uint8_t *pBitPlaneBuffer; 184 DDI_MEDIA_BUFFER *pVC1BitPlaneBuffObject[DDI_CODEC_MAX_BITSTREAM_BUFFER]; 185 DDI_CODEC_VC1BITPLANE_OBJECT VC1BitPlane[DDI_CODEC_MAX_BITSTREAM_BUFFER]; 186 uint32_t dwVC1BitPlaneIndex; 187 MOS_RESOURCE resBitPlaneBuffer; 188 } DDI_CODEC_BUFFER_PARAM_VC1; 189 190 typedef struct _DDI_CODEC_BUFFER_PARAM_JPEG 191 { 192 // slice parameter buffer 193 VASliceParameterBufferJPEGBaseline *pVASliceParaBufJPEG; 194 195 // picture parameter buffer 196 VAPictureParameterBufferJPEGBaseline PicParamJPEG; 197 198 //IQ Matrix Buffer 199 VAIQMatrixBufferJPEGBaseline IQmJPEG; 200 } DDI_CODEC_BUFFER_PARAM_JPEG; 201 202 typedef struct _DDI_CODEC_BUFFER_PARAM_VP8 203 { 204 // slice control buffer 205 VASliceParameterBufferVP8 *pVASliceParaBufVP8; 206 207 // one picture buffer 208 VAPictureParameterBufferVP8 PicParamVP8; 209 210 // one IQ buffer 211 VAIQMatrixBufferVP8 IQmVP8; 212 213 // Probability data 214 DDI_MEDIA_BUFFER *pVP8ProbabilityDataBuffObject; 215 MOS_RESOURCE resProbabilityDataBuffer; 216 uint8_t *pProbabilityDataBase; 217 VAProbabilityDataBufferVP8 ProbabilityDataVP8; 218 219 // Reference frames 220 DDI_MEDIA_SURFACE *pReferenceFrames[DDI_CODEC_VP8_MAX_REF_FRAMES]; 221 } DDI_CODEC_BUFFER_PARAM_VP8; 222 223 typedef struct _DDI_CODEC_BUFFER_PARAM_HEVC 224 { 225 // slice control buffer 226 VASliceParameterBufferHEVC *pVASliceParaBufHEVC; 227 VASliceParameterBufferBase *pVASliceParaBufBaseHEVC; 228 //slice control buffe for range extension 229 VASliceParameterBufferHEVCExtension *pVASliceParaBufHEVCRext; 230 231 // one picture buffer 232 VAPictureParameterBufferHEVC PicParamHEVC; 233 234 //one picture buffer for range extension 235 VAPictureParameterBufferHEVCExtension PicParamHEVCRext; 236 237 // one IQ buffer 238 VAIQMatrixBufferHEVC IQmHEVC; 239 } DDI_CODEC_BUFFER_PARAM_HEVC; 240 241 typedef struct _DDI_CODEC_BUFFER_PARAM_VP9 242 { 243 // one picture buffer 244 VADecPictureParameterBufferVP9 PicParamVP9; 245 246 // slice control buffer: 8 * sizeof(VASegmentParameterVP9) 247 VASliceParameterBufferVP9 *pVASliceParaBufVP9; 248 } DDI_CODEC_BUFFER_PARAM_VP9; 249 250 typedef struct _DDI_CODEC_COM_BUFFER_MGR 251 { 252 // bitstream buffer 253 DDI_MEDIA_BUFFER *pBitStreamBuffObject[DDI_CODEC_MAX_BITSTREAM_BUFFER]; 254 uint8_t *pBitStreamBase[DDI_CODEC_MAX_BITSTREAM_BUFFER]; 255 uint32_t dwBitstreamIndex; //indicating which bitstream buffer is used now 256 uint64_t ui64BitstreamOrder; //save bitstream buffer index used by previous 15 frames and current frame. the MSB is the oldest one, the LSB is current one. 257 MOS_RESOURCE resBitstreamBuffer; 258 uint8_t *pBitstreamBuffer; 259 DDI_CODEC_BITSTREAM_BUFFER_INFO *pSliceData; 260 uint32_t m_maxNumSliceData; 261 uint32_t dwNumSliceData; 262 uint32_t dwNumSliceControl; 263 uint32_t dwMaxBsSize; 264 265 uint32_t dwSizeOfRenderedSliceData; // Size of all the rendered slice data buffer 266 uint32_t dwNumOfRenderedSliceData; // how many slice data buffers will be rendered. 267 uint32_t dwNumOfRenderedSlicePara; // how many slice parameters buffers will be rendered. 268 int32_t *pNumOfRenderedSliceParaForOneBuffer; // how many slice headers in one slice parameter buffer. 269 int32_t *pRenderedOrder; // a array to keep record the sequence when slice data rendered. 270 bool bIsSliceOverSize; 271 //decode parameters 272 union 273 { 274 DDI_CODEC_BUFFER_PARAM_H264 Codec_Param_H264; 275 DDI_CODEC_BUFFER_PARAM_MPEG2 Codec_Param_MPEG2; 276 DDI_CODEC_BUFFER_PARAM_VC1 Codec_Param_VC1; 277 DDI_CODEC_BUFFER_PARAM_JPEG Codec_Param_JPEG; 278 DDI_CODEC_BUFFER_PARAM_VP8 Codec_Param_VP8; 279 DDI_CODEC_BUFFER_PARAM_HEVC Codec_Param_HEVC; 280 DDI_CODEC_BUFFER_PARAM_VP9 Codec_Param_VP9; 281 } Codec_Param; 282 283 uint32_t dwEncodeNumSliceControl; 284 285 void *pHDCP2ParameterBuffer; 286 287 VACodedBufferSegment *pCodedBufferSegment; // For bitstream output 288 VAProcPipelineParameterBuffer ProcPipelineParamBuffer; 289 VAProcFilterParameterBuffer ProcFilterParamBuffer; 290 VACodedBufferSegment *pCodedBufferSegmentForStatusReport; // for extended Status report such as long-term reference for VP8-F encode 291 void *pCodecParamReserved; 292 void *pCodecSlcParamReserved; 293 294 // for External decode StreamOut Buffer 295 MOS_RESOURCE resExternalStreamOutBuffer; 296 } DDI_CODEC_COM_BUFFER_MGR; 297 298 typedef struct _DDI_CODEC_RENDER_TARGET_TABLE 299 { 300 int32_t iNumRenderTargets; 301 DDI_MEDIA_SURFACE *pCurrentRT; // raw input for encode 302 DDI_MEDIA_SURFACE *pCurrentReconTarget; // recon surface for encode 303 DDI_MEDIA_SURFACE *pRT[DDI_MEDIA_MAX_SURFACE_NUMBER_CONTEXT]; 304 uint8_t ucRTFlag[DDI_MEDIA_MAX_SURFACE_NUMBER_CONTEXT]; 305 } DDI_CODEC_RENDER_TARGET_TABLE, *PDDI_CODEC_RENDER_TARGET_TABLE; 306 307 #define DDI_CODEC_INVALID_FRAME_INDEX 0xffffffff 308 #define DDI_CODEC_NUM_MAX_REF_FRAME 16 309 310 #define DDI_CODEC_NUM_MACROBLOCKS_WIDTH(dwWidth) ((dwWidth + (CODECHAL_MACROBLOCK_WIDTH - 1)) / CODECHAL_MACROBLOCK_WIDTH) 311 #define DDI_CODEC_NUM_MACROBLOCKS_HEIGHT(dwHeight) ((dwHeight + (CODECHAL_MACROBLOCK_HEIGHT - 1)) / CODECHAL_MACROBLOCK_HEIGHT) 312 313 //! 314 //! \brief Get Device FD 315 //! 316 //! \param [in] ctx 317 //! Pointer to VA driver context 318 //! \param [out] pDevicefd 319 //! device fd 320 //! 321 //! \return VAStatus 322 //! VA_STATUS_SUCCESS if success, else fail reason 323 //! 324 VAStatus DdiMedia_GetDeviceFD ( 325 VADriverContextP ctx, 326 int32_t *pDevicefd 327 ); 328 329 //! 330 //! \brief Load DDI function 331 //! 332 //! \param [in] ctx 333 //! Pointer to VA driver context 334 //! 335 //! \return VAStatus 336 //! VA_STATUS_SUCCESS if success, else fail reason 337 //! 338 VAStatus DdiMedia_LoadFuncion (VADriverContextP ctx); 339 340 //! 341 //! \brief Initialize 342 //! 343 //! \param [in] ctx 344 //! Pointer to VA driver context 345 //! \param [out] major_version 346 //! Major version 347 //! \param [out] minor_version 348 //! Minor version 349 //! 350 //! \return VAStatus 351 //! VA_STATUS_SUCCESS if success, else fail reason 352 //! 353 VAStatus DdiMedia__Initialize ( 354 VADriverContextP ctx, 355 int32_t *major_version, /* out */ 356 int32_t *minor_version /* out */ 357 ); 358 359 //! 360 //! \brief Initialize Media Context 361 //! 362 //! \param [in] ctx 363 //! Pointer to VA driver context 364 //! \param [in] devicefd 365 //! Devoce fd 366 //! \param [out] major_version 367 //! Major version 368 //! \param [out] minor_version 369 //! Minor version 370 //! \param [in] apoDdiEnabled 371 //! If apo ddi enabled 372 //! 373 //! \return VAStatus 374 //! VA_STATUS_SUCCESS if success, else fail reason 375 //! 376 VAStatus DdiMedia_InitMediaContext ( 377 VADriverContextP ctx, 378 int32_t devicefd, 379 int32_t *major_version, /* out */ 380 int32_t *minor_version, /* out */ 381 bool apoDdiEnabled 382 ); 383 384 //! 385 //! \brief clean up casp/caps next/complist/hwinfo 386 //! 387 //! \param [in] mediaCtx 388 //! Pointer to media context 389 //! 390 //! \return VAStatus 391 //! VA_STATUS_SUCCESS if success, else fail reason 392 //! 393 VAStatus DdiMedia_CleanUp(PDDI_MEDIA_CONTEXT mediaCtx); 394 395 //! 396 //! \brief clean up all library internal resources 397 //! 398 //! \param [in] ctx 399 //! Pointer to VA driver context 400 //! 401 //! \return VAStatus 402 //! VA_STATUS_SUCCESS if success, else fail reason 403 //! 404 VAStatus DdiMedia_Terminate(VADriverContextP ctx); 405 406 //! 407 //! \brief Query supported entrypoints for a given profile 408 //! \details The caller must provide an "entrypoint_list" array that can hold at 409 //! least vaMaxNumEntrypoints() entries. The actual number of entrypoints 410 //! returned in "entrypoint_list" is returned in "num_entrypoints". 411 //! 412 //! \param [in] ctx 413 //! Pointer to VA driver context 414 //! \param [in] profile 415 //! VA profile 416 //! \param [out] entrypoint_list 417 //! VA entrypoints 418 //! \param [out] num_entrypoints 419 //! Number of entrypoints 420 //! 421 //! \return VAStatus 422 //! VA_STATUS_SUCCESS if success, else fail reason 423 //! 424 VAStatus DdiMedia_QueryConfigEntrypoints ( 425 VADriverContextP ctx, 426 VAProfile profile, 427 VAEntrypoint *entrypoint_list, 428 int32_t *num_entrypoints 429 ); 430 431 //! 432 //! \brief Query supported profiles 433 //! \details The caller must provide a "profile_list" array that can hold at 434 //! least vaMaxNumProfile() entries. The actual number of profiles 435 //! returned in "profile_list" is returned in "num_profile". 436 //! 437 //! \param [in] ctx 438 //! Pointer to VA driver context 439 //! \param [out] profile_list 440 //! VA profiles 441 //! \param [out] num_profiles 442 //! Number of profiles 443 //! 444 //! \return VAStatus 445 //! VA_STATUS_SUCCESS if success, else fail reason 446 //! 447 VAStatus DdiMedia_QueryConfigProfiles ( 448 VADriverContextP ctx, 449 VAProfile *profile_list, 450 int32_t *num_profiles 451 ); 452 453 //! 454 //! \brief Query all attributes for a given configuration 455 //! \details The profile of the configuration is returned in "profile" 456 //! The entrypoint of the configuration is returned in "entrypoint" 457 //! The caller must provide an "attrib_list" array that can hold at least 458 //! vaMaxNumConfigAttributes() entries. The actual number of attributes 459 //! returned in "attrib_list" is returned in "num_attribs" 460 //! 461 //! \param [in] ctx 462 //! Pointer to VA driver context 463 //! \param [in] config_id 464 //! VA config id 465 //! \param [out] profile 466 //! VA profile of configuration 467 //! \param [out] entrypoint 468 //! VA entrypoint of configuration 469 //! \param [out] attrib_list 470 //! VA attrib list 471 //! \param [out] num_attribs 472 //! Number of attribs 473 //! 474 //! \return VAStatus 475 //! VA_STATUS_SUCCESS if success, else fail reason 476 //! 477 VAStatus DdiMedia_QueryConfigAttributes ( 478 VADriverContextP ctx, 479 VAConfigID config_id, 480 VAProfile *profile, 481 VAEntrypoint *entrypoint, 482 VAConfigAttrib *attrib_list, 483 int32_t *num_attribs 484 ); 485 486 //! 487 //! \brief Create a configuration for the encode/decode/vp pipeline 488 //! \details it passes in the attribute list that specifies the attributes it cares 489 //! about, with the rest taking default values. 490 //! 491 //! \param [in] ctx 492 //! Pointer to VA driver context 493 //! \param [in] profile 494 //! VA profile of configuration 495 //! \param [in] entrypoint 496 //! VA entrypoint of configuration 497 //! \param [out] attrib_list 498 //! VA attrib list 499 //! \param [out] num_attribs 500 //! Number of attribs 501 //! \param [out] config_id 502 //! VA config id 503 //! 504 //! \return VAStatus 505 //! VA_STATUS_SUCCESS if success, else fail reason 506 //! 507 VAStatus DdiMedia_CreateConfig ( 508 VADriverContextP ctx, 509 VAProfile profile, 510 VAEntrypoint entrypoint, 511 VAConfigAttrib *attrib_list, 512 int32_t num_attribs, 513 VAConfigID *config_id 514 ); 515 516 //! 517 //! \brief Free resources associated with a given config 518 //! 519 //! \param [in] ctx 520 //! Pointer to VA driver context 521 //! \param [in] config_id 522 //! VA config id 523 //! 524 //! \return VAStatus 525 //! VA_STATUS_SUCCESS if success, else fail reason 526 //! 527 VAStatus DdiMedia_DestroyConfig ( 528 VADriverContextP ctx, 529 VAConfigID config_id 530 ); 531 532 //! 533 //! \brief Get attributes for a given profile/entrypoint pair 534 //! \details The caller must provide an "attrib_list" with all attributes to be 535 //! retrieved. Upon return, the attributes in "attrib_list" have been 536 //! updated with their value. Unknown attributes or attributes that are 537 //! not supported for the given profile/entrypoint pair will have their 538 //! value set to VA_ATTRIB_NOT_SUPPORTED 539 //! 540 //! \param [in] ctx 541 //! Pointer to VA driver context 542 //! \param [in] profile 543 //! VA profile of configuration 544 //! \param [in] entrypoint 545 //! VA entrypoint of configuration 546 //! \param [out] attrib_list 547 //! VA attrib list 548 //! \param [in] num_attribs 549 //! Number of attribs 550 //! 551 //! \return VAStatus 552 //! VA_STATUS_SUCCESS if success, else fail reason 553 //! 554 VAStatus DdiMedia_GetConfigAttributes ( 555 VADriverContextP ctx, 556 VAProfile profile, 557 VAEntrypoint entrypoint, 558 VAConfigAttrib *attrib_list, 559 int32_t num_attribs 560 ); 561 562 //! 563 //! \brief Create surfaces 564 //! 565 //! \param [in] ctx 566 //! Pointer to VA driver context 567 //! \param [in] width 568 //! Surface width 569 //! \param [in] height 570 //! Surface height 571 //! \param [in] format 572 //! Surface format 573 //! \param [in] num_surfaces 574 //! Number of surfaces 575 //! \param [out] surfaces 576 //! VA created surfaces 577 //! 578 //! \return VAStatus 579 //! VA_STATUS_SUCCESS if success, else fail reason 580 //! 581 VAStatus DdiMedia_CreateSurfaces ( 582 VADriverContextP ctx, 583 int32_t width, 584 int32_t height, 585 int32_t format, 586 int32_t num_surfaces, 587 VASurfaceID *surfaces 588 ); 589 590 //! 591 //! \brief Destroy resources associated with surfaces. 592 //! \details Surfaces can only be destroyed after the context associated has been 593 //! destroyed 594 //! 595 //! \param [in] ctx 596 //! Pointer to VA driver context 597 //! \param [in] surfaces 598 //! VA array of surfaces to destroy 599 //! \param [in] num_surfaces 600 //! Number of surfaces in the array to be destroyed 601 //! 602 //! \return VAStatus 603 //! VA_STATUS_SUCCESS if success, else fail reason 604 //! 605 VAStatus DdiMedia_DestroySurfaces ( 606 VADriverContextP ctx, 607 VASurfaceID *surfaces, 608 int32_t num_surfaces 609 ); 610 611 //! 612 //! \brief Create surfaces2 613 //! 614 //! \param [in] ctx 615 //! Pointer to VA driver context 616 //! \param [in] format 617 //! Surface format 618 //! \param [in] width 619 //! Surface width 620 //! \param [in] height 621 //! Surface height 622 //! \param [out] surfaces 623 //! VA created surfaces 624 //! \param [in] num_surfaces 625 //! Number of surfaces 626 //! \param [out] attrib_list 627 //! VA attrib list 628 //! \param [in] num_attribs 629 //! Number of attribs 630 //! 631 //! \return VAStatus 632 //! VA_STATUS_SUCCESS if success, else fail reason 633 //! 634 VAStatus DdiMedia_CreateSurfaces2 ( 635 VADriverContextP ctx, 636 uint32_t format, 637 uint32_t width, 638 uint32_t height, 639 VASurfaceID *surfaces, 640 uint32_t num_surfaces, 641 VASurfaceAttrib *attrib_list, 642 uint32_t num_attribs 643 ); 644 645 //! 646 //! \brief Create context 647 //! 648 //! \param [in] ctx 649 //! Pointer to VA driver context 650 //! \param [in] config_id 651 //! VA config id 652 //! \param [in] picture_width 653 //! Picture width 654 //! \param [in] picture_height 655 //! Picture height 656 //! \param [out] flag 657 //! Create flag 658 //! \param [in] render_targets 659 //! VA render traget 660 //! \param [in] num_render_targets 661 //! Number of render targets 662 //! \param [out] context 663 //! VA created context 664 //! 665 //! \return VAStatus 666 //! VA_STATUS_SUCCESS if success, else fail reason 667 //! 668 VAStatus DdiMedia_CreateContext ( 669 VADriverContextP ctx, 670 VAConfigID config_id, 671 int32_t picture_width, 672 int32_t picture_height, 673 int32_t flag, 674 VASurfaceID *render_targets, 675 int32_t num_render_targets, 676 VAContextID *context 677 ); 678 679 //! 680 //! \brief Destroy context 681 //! 682 //! \param [in] ctx 683 //! Pointer to VA driver context 684 //! \param [in] context 685 //! VA context to destroy 686 //! 687 //! \return VAStatus 688 //! VA_STATUS_SUCCESS if success, else fail reason 689 //! 690 VAStatus DdiMedia_DestroyContext ( 691 VADriverContextP ctx, 692 VAContextID context 693 ); 694 695 //! 696 //! \brief Create buffer 697 //! 698 //! \param [in] ctx 699 //! Pointer to VA driver context 700 //! \param [in] context 701 //! VA context id 702 //! \param [in] type 703 //! VA buffer type 704 //! \param [in] size 705 //! Buffer size 706 //! \param [out] num_elements 707 //! Number of elements 708 //! \param [in] data 709 //! Buffer data 710 //! \param [out] bufId 711 //! VA buffer id 712 //! 713 //! \return VAStatus 714 //! VA_STATUS_SUCCESS if success, else fail reason 715 //! 716 VAStatus DdiMedia_CreateBuffer ( 717 VADriverContextP ctx, 718 VAContextID context, 719 VABufferType type, 720 uint32_t size, 721 uint32_t num_elements, 722 void *data, 723 VABufferID *bufId 724 ); 725 726 //! 727 //! \brief Convey to the server how many valid elements are in the buffer 728 //! \details e.g. if multiple slice parameters are being held in a single buffer, 729 //! this will communicate to the server the number of slice parameters 730 //! that are valid in the buffer. 731 //! 732 //! \param [in] ctx 733 //! Pointer to VA driver context 734 //! \param [in] buf_id 735 //! VA buffer id 736 //! \param [in] num_elements 737 //! Number of elements in buffer 738 //! 739 //! \return VAStatus 740 //! VA_STATUS_SUCCESS if success, else fail reason 741 //! 742 VAStatus DdiMedia_BufferSetNumElements ( 743 VADriverContextP ctx, 744 VABufferID buf_id, 745 uint32_t num_elements 746 ); 747 748 //! \brief Map buffer 749 //! 750 //! \param [in] ctx 751 //! Pointer to VA driver context 752 //! \param [in] buf_id 753 //! VA buffer ID 754 //! \param [out] pbuf 755 //! Pointer to buffer 756 //! 757 //! \return VAStatus 758 //! VA_STATUS_SUCCESS if success, else fail reason 759 //! 760 VAStatus DdiMedia_MapBuffer ( 761 VADriverContextP ctx, 762 VABufferID buf_id, 763 void **pbuf 764 ); 765 766 //! \brief Unmap buffer 767 //! 768 //! \param [in] ctx 769 //! Pointer to VA driver context 770 //! \param [in] buf_id 771 //! VA buffer ID 772 //! 773 //! \return VAStatus 774 //! VA_STATUS_SUCCESS if success, else fail reason 775 //! 776 VAStatus DdiMedia_UnmapBuffer ( 777 VADriverContextP ctx, 778 VABufferID buf_id 779 ); 780 781 //! 782 //! \brief Destroy buffer 783 //! 784 //! \param [in] ctx 785 //! Pointer to VA driver context 786 //! \param [in] buffer_id 787 //! VA buffer ID 788 //! 789 //! \return VAStatus 790 //! VA_STATUS_SUCCESS if success, else fail reason 791 //! 792 VAStatus DdiMedia_DestroyBuffer ( 793 VADriverContextP ctx, 794 VABufferID buffer_id 795 ); 796 797 //! 798 //! \brief Get ready to decode a picture to a target surface 799 //! 800 //! \param [in] ctx 801 //! Pointer to VA driver context 802 //! \param [in] context 803 //! VA context id 804 //! \param [in] render_target 805 //! VA render target surface 806 //! 807 //! \return VAStatus 808 //! VA_STATUS_SUCCESS if success, else fail reason 809 //! 810 VAStatus DdiMedia_BeginPicture ( 811 VADriverContextP ctx, 812 VAContextID context, 813 VASurfaceID render_target 814 ); 815 816 //! 817 //! \brief Send decode buffers to the server 818 //! \details Buffers are automatically destroyed afterwards 819 //! \param [in] ctx 820 //! Pointer to VA driver context 821 //! \param [in] context 822 //! VA buffer id 823 //! \param [in] buffer 824 //! Pointer to VA buffer id 825 //! \param [in] num_buffers 826 //! number of buffers 827 //! 828 //! \return VAStatus 829 //! VA_STATUS_SUCCESS if success, else fail reason 830 //! 831 VAStatus DdiMedia_RenderPicture ( 832 VADriverContextP ctx, 833 VAContextID context, 834 VABufferID *buffers, 835 int32_t num_buffers 836 ); 837 838 //! 839 //! \brief Make the end of rendering for a picture 840 //! \details The server should start processing all pending operations for this 841 //! surface. This call is non-blocking. The client can start another 842 //! Begin/Render/End sequence on a different render target 843 //! \param [in] ctx 844 //! Pointer to VA driver context 845 //! \param [in] context 846 //! VA buffer id 847 //! 848 //! \return VAStatus 849 //! VA_STATUS_SUCCESS if success, else fail reason 850 //! 851 VAStatus DdiMedia_EndPicture ( 852 VADriverContextP ctx, 853 VAContextID context 854 ); 855 856 //! 857 //! \brief Sync surface 858 //! \details This function blocks until all pending operations on the render target 859 //! have been completed. Upon return it is safe to use the render target for a 860 //! different picture 861 //! \param [in] ctx 862 //! Pointer to VA driver context 863 //! \param [in] render_target 864 //! VA render target surface id 865 //! 866 //! \return VAStatus 867 //! VA_STATUS_SUCCESS if success, else fail reason 868 //! 869 VAStatus DdiMedia_SyncSurface ( 870 VADriverContextP ctx, 871 VASurfaceID render_target 872 ); 873 874 #if VA_CHECK_VERSION(1, 9, 0) 875 //! 876 //! \brief Sync surface 877 //! \details This function blocks until all pending operations on the render target 878 //! have been completed. Upon return it is safe to use the render target for a 879 //! different picture 880 //! \param [in] ctx 881 //! Pointer to VA driver context 882 //! \param [in] surface_id 883 //! VA render target surface id 884 //! \param [in] timeout_ns 885 //! time out period 886 //! 887 //! \return VAStatus 888 //! VA_STATUS_SUCCESS if success, else fail reason 889 //! 890 VAStatus DdiMedia_SyncSurface2 ( 891 VADriverContextP ctx, 892 VASurfaceID surface_id, 893 uint64_t timeout_ns 894 ); 895 896 //! 897 //! \brief Sync buffer 898 //! \details This function blocks until all pending operations on the render target 899 //! have been completed. Upon return it is safe to use the render target for a 900 //! different picture 901 //! \param [in] ctx 902 //! Pointer to VA driver context 903 //! \param [in] buf_id 904 //! VA buffer id 905 //! \param [in] timeout_ns 906 //! time out period 907 //! 908 //! \return VAStatus 909 //! VA_STATUS_SUCCESS if success, else fail reason 910 //! 911 VAStatus DdiMedia_SyncBuffer ( 912 VADriverContextP ctx, 913 VABufferID buf_id, 914 uint64_t timeout_ns 915 ); 916 #endif 917 918 //! 919 //! \brief Query surface status 920 //! 921 //! \param [in] ctx 922 //! Pointer to VA driver context 923 //! \param [in] render_target 924 //! VA surface ID 925 //! \param [out] status 926 //! VA surface status 927 //! 928 //! \return VAStatus 929 //! VA_STATUS_SUCCESS if success, else fail reason 930 //! 931 VAStatus DdiMedia_QuerySurfaceStatus ( 932 VADriverContextP ctx, 933 VASurfaceID render_target, 934 VASurfaceStatus *status 935 ); 936 937 //! 938 //! \brief Report MB error info 939 //! 940 //! \param [in] ctx 941 //! Pointer to VA driver context 942 //! \param [in] render_target 943 //! VA surface ID 944 //! \param [in] error_status 945 //! Error status 946 //! \param [out] error_info 947 //! Information on error 948 //! 949 //! \return VAStatus 950 //! VA_STATUS_SUCCESS if success, else fail reason 951 //! 952 VAStatus DdiMedia_QuerySurfaceError ( 953 VADriverContextP ctx, 954 VASurfaceID render_target, 955 VAStatus error_status, 956 void **error_info /*out*/ 957 ); 958 959 //! 960 //! \brief Query surface attributes for the supplied config 961 //! 962 //! \param [in] ctx 963 //! Pointer to VA driver context 964 //! \param [in] config_id 965 //! VA config id 966 //! \param [out] attrib_list 967 //! VA surface attrib 968 //! \param [out] num_attribs 969 //! Number of attribs 970 //! 971 //! \return VAStatus 972 //! VA_STATUS_SUCCESS if success, else fail reason 973 //! 974 VAStatus DdiMedia_QuerySurfaceAttributes ( 975 VADriverContextP ctx, 976 VAConfigID config_id, 977 VASurfaceAttrib *attrib_list, 978 uint32_t *num_attribs 979 ); 980 981 //! 982 //! \brief Put surface 983 //! 984 //! \param [in] ctx 985 //! Pointer to VA driver context 986 //! \param [in] surface 987 //! VA surface ID 988 //! \param [in] draw 989 //! Drawable of window system 990 //! \param [in] srcx 991 //! X offset of src image 992 //! \param [in] srcy 993 //! Y offset of src image 994 //! \param [in] srcw 995 //! Width offset of src image 996 //! \param [in] srch 997 //! Height offset of src image 998 //! \param [in] destx 999 //! X offset of dst image 1000 //! \param [in] desty 1001 //! Y offset of dst image 1002 //! \param [in] destw 1003 //! Width offset of dst image 1004 //! \param [in] desth 1005 //! Height offset of dst image 1006 //! \param [in] cliprects 1007 //! Client supplied clip list 1008 //! \param [in] number_cliprects 1009 //! Number of clip rects in the clip list 1010 //! \param [in] flags 1011 //! de-interlacing flags 1012 //! 1013 //! \return VAStatus 1014 //! VA_STATUS_SUCCESS if success, else fail reason 1015 //! 1016 VAStatus DdiMedia_PutSurface ( 1017 VADriverContextP ctx, 1018 VASurfaceID surface, 1019 void* draw, /* Drawable of window system */ 1020 int16_t srcx, 1021 int16_t srcy, 1022 uint16_t srcw, 1023 uint16_t srch, 1024 int16_t destx, 1025 int16_t desty, 1026 uint16_t destw, 1027 uint16_t desth, 1028 VARectangle *cliprects, /* client supplied clip list */ 1029 uint32_t number_cliprects, /* number of clip rects in the clip list */ 1030 uint32_t flags /* de-interlacing flags */ 1031 ); 1032 1033 //! 1034 //! \brief Query supported image formats 1035 //! \details The caller must provide a "format_list" array that can hold at 1036 //! least vaMaxNumImageFormats() entries. The actual number of formats 1037 //! returned in "format_list" is returned in "num_formats" 1038 //! 1039 //! \param [in] ctx 1040 //! Driver context 1041 //! \param [out] format_list 1042 //! The format of image 1043 //! \param [out] num_formats 1044 //! The number of the formats 1045 //! 1046 //! \return VAStatus 1047 //! VA_STATUS_SUCCESS if success, else fail reason 1048 //! 1049 VAStatus DdiMedia_QueryImageFormats ( 1050 VADriverContextP ctx, 1051 VAImageFormat *format_list, 1052 int32_t *num_formats 1053 ); 1054 1055 //! 1056 //! \brief Create an image 1057 //! 1058 //! \param [in] ctx 1059 //! Driver context 1060 //! \param [in] format 1061 //! The format of image 1062 //! \param [in] width 1063 //! The width of the image 1064 //! \param [in] height 1065 //! The height of the image 1066 //! \param [out] image 1067 //! The generated image 1068 //! 1069 //! \return VAStatus 1070 //! VA_STATUS_SUCCESS if success, else fail reason 1071 //! 1072 VAStatus DdiMedia_CreateImage ( 1073 VADriverContextP ctx, 1074 VAImageFormat *format, 1075 int32_t width, 1076 int32_t height, 1077 VAImage *image /* out */ 1078 ); 1079 1080 //! 1081 //! \brief Derive image 1082 //! 1083 //! \param [in] ctx 1084 //! Pointer to VA driver context 1085 //! \param [in] surface 1086 //! VA surface ID 1087 //! \param [in] image 1088 //! VA image 1089 //! 1090 //! \return VAStatus 1091 //! VA_STATUS_SUCCESS if success, else fail reason 1092 //! 1093 VAStatus DdiMedia_DeriveImage ( 1094 VADriverContextP ctx, 1095 VASurfaceID surface, 1096 VAImage *image 1097 ); 1098 1099 //! 1100 //! \brief Free allocated surfaceheap elements 1101 //! 1102 //! \param [in] ctx 1103 //! Pointer to VA driver context 1104 //! \param [in] image 1105 //! VA image ID 1106 //! 1107 //! \return VAStatus 1108 //! VA_STATUS_SUCCESS if success, else fail reason 1109 //! 1110 VAStatus DdiMedia_DestroyImage ( 1111 VADriverContextP ctx, 1112 VAImageID image 1113 ); 1114 1115 //! 1116 //! \brief Set image palette 1117 //! 1118 //! \param [in] ctx 1119 //! Pointer to VA driver context 1120 //! \param [in] image 1121 //! VA image ID 1122 //! \param [in] palette 1123 //! Palette 1124 //! 1125 //! \return VAStatus 1126 //! VA_STATUS_ERROR_UNIMPLEMENTED if call success, else fail reason 1127 //! 1128 VAStatus DdiMedia_SetImagePalette ( 1129 VADriverContextP ctx, 1130 VAImageID image, 1131 unsigned char *palette 1132 ); 1133 1134 //! 1135 //! \brief Retrive surface data into a VAImage 1136 //! \details Image must be in a format supported by the implementation 1137 //! 1138 //! \param [in] ctx 1139 //! Input driver context 1140 //! \param [in] surface 1141 //! Input surface ID of source 1142 //! \param [in] x 1143 //! X offset of the wanted region 1144 //! \param [in] y 1145 //! Y offset of the wanted region 1146 //! \param [in] width 1147 //! Width of the wanted region 1148 //! \param [in] height 1149 //! Height of the wanted region 1150 //! \param [in] image 1151 //! The image ID of the source image 1152 //! 1153 //! \return VAStatus 1154 //! VA_STATUS_SUCCESS if success, else fail reason 1155 //! 1156 VAStatus DdiMedia_GetImage ( 1157 VADriverContextP ctx, 1158 VASurfaceID surface, 1159 int32_t x, /* coordinates of the upper left source pixel */ 1160 int32_t y, 1161 uint32_t width, /* width and height of the region */ 1162 uint32_t height, 1163 VAImageID image 1164 ); 1165 1166 //! 1167 //! \brief Copy data from a VAImage to a surface 1168 //! \details Image must be in a format supported by the implementation 1169 //! 1170 //! \param [in] ctx 1171 //! Input driver context 1172 //! \param [in] surface 1173 //! Surface ID of destination 1174 //! \param [in] image 1175 //! The image ID of the destination image 1176 //! \param [in] src_x 1177 //! Source x offset of the image region 1178 //! \param [in] src_y 1179 //! Source y offset of the image region 1180 //! \param [in] src_width 1181 //! Source width offset of the image region 1182 //! \param [in] src_height 1183 //! Source height offset of the image region 1184 //! \param [in] dest_x 1185 //! Destination x offset of the surface region 1186 //! \param [in] dest_y 1187 //! Destination y offset of the surface region 1188 //! \param [in] dest_width 1189 //! Destination width offset of the surface region 1190 //! \param [in] dest_height 1191 //! Destination height offset of the surface region 1192 //! 1193 //! \return VAStatus 1194 //! VA_STATUS_SUCCESS if success, else fail reason 1195 //! 1196 VAStatus DdiMedia_PutImage ( 1197 VADriverContextP ctx, 1198 VASurfaceID surface, 1199 VAImageID image, 1200 int32_t src_x, 1201 int32_t src_y, 1202 uint32_t src_width, 1203 uint32_t src_height, 1204 int32_t dest_x, 1205 int32_t dest_y, 1206 uint32_t dest_width, 1207 uint32_t dest_height 1208 ); 1209 1210 //! 1211 //! \brief Query subpicture formats 1212 //! 1213 //! \param [in] ctx 1214 //! Pointer to VA driver context 1215 //! \param [in] format_list 1216 //! VA image format 1217 //! \param [in] flags 1218 //! Flags 1219 //! \param [in] num_formats 1220 //! Number of formats 1221 //! 1222 //! \return VAStatus 1223 //! VA_STATUS_SUCCESS if success, else fail reason 1224 //! 1225 VAStatus DdiMedia_QuerySubpictureFormats ( 1226 VADriverContextP ctx, 1227 VAImageFormat *format_list, 1228 uint32_t *flags, 1229 uint32_t *num_formats 1230 ); 1231 1232 //! 1233 //! \brief Create subpicture 1234 //! 1235 //! \param [in] ctx 1236 //! Pointer to VA driver context 1237 //! \param [in] image 1238 //! VA image ID 1239 //! \param [out] subpicture 1240 //! VA subpicture ID 1241 //! 1242 //! \return VAStatus 1243 //! VA_STATUS_ERROR_UNIMPLEMENTED 1244 //! 1245 VAStatus DdiMedia_CreateSubpicture ( 1246 VADriverContextP ctx, 1247 VAImageID image, 1248 VASubpictureID *subpicture /* out */ 1249 ); 1250 1251 //! 1252 //! \brief Destroy subpicture 1253 //! 1254 //! \param [in] ctx 1255 //! Pointer to VA driver context 1256 //! \param [in] subpicture 1257 //! VA subpicture ID 1258 //! 1259 //! \return VAStatus 1260 //! VA_STATUS_ERROR_UNIMPLEMENTED 1261 //! 1262 VAStatus DdiMedia_DestroySubpicture ( 1263 VADriverContextP ctx, 1264 VASubpictureID subpicture 1265 ); 1266 1267 //! 1268 //! \brief Set subpicture image 1269 //! 1270 //! \param [in] ctx 1271 //! Pointer to VA driver context 1272 //! \param [in] subpicture 1273 //! VA subpicture ID 1274 //! \param [in] image 1275 //! VA image ID 1276 //! 1277 //! \return VAStatus 1278 //! VA_STATUS_ERROR_UNIMPLEMENTED 1279 //! 1280 VAStatus DdiMedia_SetSubpictureImage ( 1281 VADriverContextP ctx, 1282 VASubpictureID subpicture, 1283 VAImageID image 1284 ); 1285 1286 //! 1287 //! \brief Set subpicture chrome key 1288 //! 1289 //! \param [in] ctx 1290 //! Pointer to VA driver context 1291 //! \param [in] subpicture 1292 //! VA subpicture ID 1293 //! \param [in] chromakey_min 1294 //! Minimum chroma key 1295 //! \param [in] chromakey_max 1296 //! Maximum chroma key 1297 //! \param [in] chromakey_mask 1298 //! Chromakey mask 1299 //! 1300 //! \return VAStatus 1301 //! VA_STATUS_ERROR_UNIMPLEMENTED 1302 //! 1303 VAStatus DdiMedia_SetSubpictureChromakey ( 1304 VADriverContextP ctx, 1305 VASubpictureID subpicture, 1306 uint32_t chromakey_min, 1307 uint32_t chromakey_max, 1308 uint32_t chromakey_mask 1309 ); 1310 1311 //! 1312 //! \brief set subpicture global alpha 1313 //! 1314 //! \param [in] ctx 1315 //! Pointer to VA driver context 1316 //! \param [in] subpicture 1317 //! VA subpicture ID 1318 //! \param [in] global_alpha 1319 //! Global alpha 1320 //! 1321 //! \return VAStatus 1322 //! VA_STATUS_ERROR_UNIMPLEMENTED 1323 VAStatus DdiMedia_SetSubpictureGlobalAlpha ( 1324 VADriverContextP ctx, 1325 VASubpictureID subpicture, 1326 float global_alpha 1327 ); 1328 1329 //! 1330 //! \brief Associate subpicture 1331 //! 1332 //! \param [in] ctx 1333 //! Pointer to VA driver context 1334 //! \param [in] subpicture 1335 //! VA subpicture ID 1336 //! \param [in] target_surfaces 1337 //! VA surface ID 1338 //! \param [in] num_surfaces 1339 //! Number of surfaces 1340 //! \param [in] src_x 1341 //! Source x of the region 1342 //! \param [in] src_y 1343 //! Source y of the region 1344 //! \param [in] src_width 1345 //! Source width of the region 1346 //! \param [in] src_height 1347 //! Source height of the region 1348 //! \param [in] dest_x 1349 //! Destination x 1350 //! \param [in] dest_y 1351 //! Destination y 1352 //! \param [in] dest_width 1353 //! Destination width 1354 //! \param [in] dest_height 1355 //! Destination height 1356 //! \param [in] flags 1357 //! Flags 1358 //! 1359 //! \return VAStatus 1360 //! VA_STATUS_ERROR_UNIMPLEMENTED 1361 //! 1362 VAStatus DdiMedia_AssociateSubpicture ( 1363 VADriverContextP ctx, 1364 VASubpictureID subpicture, 1365 VASurfaceID *target_surfaces, 1366 int32_t num_surfaces, 1367 int16_t src_x, /* upper left offset in subpicture */ 1368 int16_t src_y, 1369 uint16_t src_width, 1370 uint16_t src_height, 1371 int16_t dest_x, /* upper left offset in surface */ 1372 int16_t dest_y, 1373 uint16_t dest_width, 1374 uint16_t dest_height, 1375 /* 1376 * whether to enable chroma-keying or global-alpha 1377 * see VA_SUBPICTURE_XXX values 1378 */ 1379 uint32_t flags 1380 ); 1381 1382 //! 1383 //! \brief Deassociate subpicture 1384 //! 1385 //! \param [in] ctx 1386 //! Pointer to VA driver context 1387 //! \param [in] subpicture 1388 //! VA subpicture ID 1389 //! \param [in] target_surfaces 1390 //! VA surface ID 1391 //! \param [in] num_surfaces 1392 //! Number of surfaces 1393 //! 1394 //! \return VAStatus 1395 //! VA_STATUS_ERROR_UNIMPLEMENTED 1396 //! 1397 VAStatus DdiMedia_DeassociateSubpicture ( 1398 VADriverContextP ctx, 1399 VASubpictureID subpicture, 1400 VASurfaceID *target_surfaces, 1401 int32_t num_surfaces 1402 ); 1403 1404 //! 1405 //! \brief Query display attributes 1406 //! 1407 //! \param [in] ctx 1408 //! Pointer to VA driver context 1409 //! \param [in] attr_list 1410 //! VA display attribute 1411 //! \param [in] num_attributes 1412 //! Number of attributes 1413 //! 1414 //! \return VAStatus 1415 //! VA_STATUS_SUCCESS if success, else fail reason 1416 //! 1417 VAStatus DdiMedia_QueryDisplayAttributes ( 1418 VADriverContextP ctx, 1419 VADisplayAttribute *attr_list, 1420 int32_t *num_attributes 1421 ); 1422 1423 //! 1424 //! \brief Get display attributes 1425 //! \details This function returns the current attribute values in "attr_list". 1426 //! Only attributes returned with VA_DISPLAY_ATTRIB_GETTABLE set in the "flags" field 1427 //! from vaQueryDisplayAttributes() can have their values retrieved. 1428 //! 1429 //! \param [in] ctx 1430 //! Pointer to VA driver context 1431 //! \param [in] attr_list 1432 //! VA display attribute 1433 //! \param [in] num_attributes 1434 //! Number of attributes 1435 //! 1436 //! \return VAStatus 1437 //! VA_STATUS_ERROR_UNIMPLEMENTED 1438 //! 1439 VAStatus DdiMedia_GetDisplayAttributes ( 1440 VADriverContextP ctx, 1441 VADisplayAttribute *attr_list, 1442 int32_t num_attributes 1443 ); 1444 1445 //! 1446 //! \brief Set display attributes 1447 //! \details Only attributes returned with VA_DISPLAY_ATTRIB_SETTABLE set in the "flags" field 1448 //! from vaQueryDisplayAttributes() can be set. If the attribute is not settable or 1449 //! the value is out of range, the function returns VA_STATUS_ERROR_ATTR_NOT_SUPPORTED 1450 //! 1451 //! \param [in] ctx 1452 //! Pointer to VA driver context 1453 //! \param [in] attr_list 1454 //! VA display attribute 1455 //! \param [in] num_attributes 1456 //! Number of attributes 1457 //! 1458 //! \return VAStatus 1459 //! VA_STATUS_ERROR_UNIMPLEMENTED 1460 //! 1461 VAStatus DdiMedia_SetDisplayAttributes ( 1462 VADriverContextP ctx, 1463 VADisplayAttribute *attr_list, 1464 int32_t num_attributes 1465 ); 1466 1467 //! 1468 //! \brief Query processing rate 1469 //! 1470 //! \param [in] ctx 1471 //! Pointer to VA driver context 1472 //! \param [in] config_id 1473 //! VA configuration ID 1474 //! \param [in] proc_buf 1475 //! VA processing rate parameter 1476 //! \param [out] processing_rate 1477 //! Processing rate 1478 //! 1479 //! \return VAStatus 1480 //! VA_STATUS_SUCCESS if success, else fail reason 1481 //! 1482 VAStatus DdiMedia_QueryProcessingRate ( 1483 VADriverContextP ctx, 1484 VAConfigID config_id, 1485 VAProcessingRateParameter *proc_buf, 1486 uint32_t *processing_rate /* output parameter */ 1487 ); 1488 1489 #if VA_CHECK_VERSION(1,10,0) 1490 //! 1491 //! \brief media copy 1492 //! 1493 //! \param [in] ctx 1494 //! Pointer to VA driver context 1495 //! \param [in] dst_obj 1496 //! VA copy object dst. 1497 //! \param [in] src_obj 1498 //! VA copy object src. 1499 //! \param [in] option 1500 //! VA copy option, copy mode. 1501 //! \param [in] sync_handle 1502 //! VA copy sync handle 1503 //! 1504 //! \return VAStatus 1505 //! VA_STATUS_SUCCESS if success, else fail reason 1506 //! 1507 VAStatus DdiMedia_Copy ( 1508 VADriverContextP ctx, 1509 VACopyObject *dst_obj, 1510 VACopyObject *src_obj, 1511 VACopyOption option 1512 ); 1513 #endif //VA_CHECK_VERSION(1,10,0) 1514 1515 //! 1516 //! \brief Check for buffer info 1517 //! 1518 //! \param [in] ctx 1519 //! Pointer to VA driver context 1520 //! \param [in] buf_id 1521 //! VA buffer ID 1522 //! \param [out] type 1523 //! VA buffer type 1524 //! \param [out] size 1525 //! Size 1526 //! \param [out] num_elements 1527 //! Number of elements 1528 //! 1529 //! \return VAStatus 1530 //! VA_STATUS_SUCCESS if success, else fail reason 1531 //! 1532 VAStatus DdiMedia_BufferInfo ( 1533 VADriverContextP ctx, 1534 VABufferID buf_id, 1535 VABufferType *type, 1536 uint32_t *size, 1537 uint32_t *num_elements 1538 ); 1539 1540 //! 1541 //! \brief Lock surface 1542 //! 1543 //! \param [in] ctx 1544 //! Pointer to VA driver context 1545 //! \param [in] surface 1546 //! VA surface ID 1547 //! \param [out] fourcc 1548 //! FourCC 1549 //! \param [out] luma_stride 1550 //! Luma stride 1551 //! \param [out] chroma_u_stride 1552 //! Chroma U stride 1553 //! \param [out] chroma_v_stride 1554 //! Chroma V stride 1555 //! \param [out] luma_offset 1556 //! Luma offset 1557 //! \param [out] chroma_u_offset 1558 //! Chroma U offset 1559 //! \param [out] chroma_v_offset 1560 //! Chroma V offset 1561 //! \param [out] buffer_name 1562 //! Buffer name 1563 //! \param [out] buffer 1564 //! Buffer 1565 //! 1566 //! \return VAStatus 1567 //! VA_STATUS_SUCCESS if success, else fail reason 1568 //! 1569 VAStatus DdiMedia_LockSurface ( 1570 VADriverContextP ctx, 1571 VASurfaceID surface, 1572 uint32_t *fourcc, 1573 uint32_t *luma_stride, 1574 uint32_t *chroma_u_stride, 1575 uint32_t *chroma_v_stride, 1576 uint32_t *luma_offset, 1577 uint32_t *chroma_u_offset, 1578 uint32_t *chroma_v_offset, 1579 uint32_t *buffer_name, 1580 void **buffer 1581 ); 1582 1583 //! 1584 //! \brief Unlock surface 1585 //! 1586 //! \param [in] ctx 1587 //! Pointer to VA driver context 1588 //! \param [in] surface 1589 //! VA surface ID 1590 //! 1591 //! \return VAStatus 1592 //! VA_STATUS_SUCCESS if success, else fail reason 1593 //! 1594 VAStatus DdiMedia_UnlockSurface ( 1595 VADriverContextP ctx, 1596 VASurfaceID surface 1597 ); 1598 1599 //! 1600 //! \brief Query video proc filters 1601 //! 1602 //! \param [in] ctx 1603 //! Pointer to VA driver context 1604 //! \param [in] context 1605 //! VA context ID 1606 //! \param [in] filters 1607 //! VA proc filter type 1608 //! \param [in] num_filters 1609 //! Number of filters 1610 //! 1611 //! \return VAStatus 1612 //! VA_STATUS_SUCCESS if success, else fail reason 1613 //! 1614 VAStatus DdiMedia_QueryVideoProcFilters ( 1615 VADriverContextP ctx, 1616 VAContextID context, 1617 VAProcFilterType *filters, 1618 uint32_t *num_filters 1619 ); 1620 1621 //! 1622 //! \brief Query video processing filter capabilities. 1623 //! The real implementation is in media_libva_vp.c, since it needs to use some definitions in vphal.h. 1624 //! 1625 //! \param [in] ctx 1626 //! Pointer to VA driver context 1627 //! \param [in] context 1628 //! VA context ID 1629 //! \param [in] type 1630 //! VA proc filter type 1631 //! \param [inout] filter_caps 1632 //! FIlter caps 1633 //! \param [inout] num_filter_caps 1634 //! Number of filter caps 1635 //! 1636 //! \return VAStatus 1637 //! VA_STATUS_SUCCESS if success, else fail reason 1638 //! 1639 VAStatus DdiMedia_QueryVideoProcFilterCaps ( 1640 VADriverContextP ctx, 1641 VAContextID context, 1642 VAProcFilterType type, 1643 void *filter_caps, 1644 uint32_t *num_filter_caps 1645 ); 1646 1647 //! 1648 //! \brief Query video proc pipeline caps 1649 //! 1650 //! \param [in] ctx 1651 //! Pointer to VA driver context 1652 //! \param [in] context 1653 //! VA context ID 1654 //! \param [in] filters 1655 //! VA buffer ID 1656 //! \param [in] num_filters 1657 //! Number of filters 1658 //! \param [in] pipeline_caps 1659 //! VA proc pipeline caps 1660 //! 1661 //! \return VAStatus 1662 //! VA_STATUS_SUCCESS if success, else fail reason 1663 //! 1664 VAStatus DdiMedia_QueryVideoProcPipelineCaps ( 1665 VADriverContextP ctx, 1666 VAContextID context, 1667 VABufferID *filters, 1668 uint32_t num_filters, 1669 VAProcPipelineCaps *pipeline_caps 1670 ); 1671 1672 //! 1673 //! \brief Get surface attributes for the supplied config 1674 //! \details This function retrieves the surface attributes matching the supplied config. 1675 //! 1676 //! \param [in] ctx 1677 //! VA display 1678 //! \param [in] config 1679 //! Config identifying a codec or a video processing pipeline 1680 //! \param [out] attrib_list 1681 //! List of attributes on output 1682 //! \param [in] num_attributes 1683 //! Number of attributes 1684 //! 1685 //! \return VAStatus 1686 //! VA_STATUS_ERROR_UNIMPLEMENTED 1687 //! 1688 VAStatus DdiMedia_GetSurfaceAttributes ( 1689 VADriverContextP ctx, 1690 VAConfigID config, 1691 VASurfaceAttrib *attrib_list, 1692 uint32_t num_attribs 1693 ); 1694 1695 //! 1696 //! \brief Aquire buffer handle 1697 //! 1698 //! \param [in] ctx 1699 //! Pointer to VA driver context 1700 //! \param [in] buf_id 1701 //! VA buffer ID 1702 //! \param [in] buf_info 1703 //! VA buffer Info 1704 //! 1705 //! \return VAStatus 1706 //! VA_STATUS_SUCCESS if success, else fail reason 1707 //! 1708 VAStatus DdiMedia_AcquireBufferHandle ( 1709 VADriverContextP ctx, 1710 VABufferID buf_id, 1711 VABufferInfo *buf_info 1712 ); 1713 1714 //! 1715 //! \brief Release buffer handle 1716 //! 1717 //! \param [in] ctx 1718 //! Pointer to VA driver context 1719 //! \param [in] buf_id 1720 //! VA bufferID 1721 //! 1722 //! \return VAStatus 1723 //! VA_STATUS_SUCCESS if success, else fail reason 1724 //! 1725 VAStatus DdiMedia_ReleaseBufferHandle ( 1726 VADriverContextP ctx, 1727 VABufferID buf_id 1728 ); 1729 1730 //! 1731 //! \brief API for export surface handle to other component 1732 //! 1733 //! \param [in] dpy 1734 //! VA display. 1735 //! \param [in] surface_id 1736 //! Surface to export. 1737 //! \param [in] mem_type 1738 //! Memory type to export to. 1739 //! \param [in] flags 1740 //! Combination of flags to apply 1741 //!\param [out] descriptor 1742 //!Pointer to the descriptor structure to fill 1743 //!with the handle details. The type of this structure depends on 1744 //!the value of mem_type. 1745 //! \return VAStatus 1746 //! VA_STATUS_SUCCESS if success, else fail reason 1747 //! 1748 VAStatus DdiMedia_ExportSurfaceHandle ( 1749 VADriverContextP ctx, 1750 VASurfaceID surface_id, 1751 uint32_t mem_type, 1752 uint32_t flags, 1753 void *descriptor); 1754 1755 #ifndef ANDROID 1756 //! 1757 //! \brief Create Mfe Context 1758 //! 1759 //! \param [in] ctx 1760 //! Pointer to VA driver context 1761 //! \param [out] mfe_context 1762 //! VA MF context ID 1763 //! 1764 //! \return VAStatus 1765 //! VA_STATUS_SUCCESS if success, else fail reason 1766 //! 1767 VAStatus DdiMedia_CreateMfeContextInternal ( 1768 VADriverContextP ctx, 1769 VAMFContextID *mfe_context 1770 ); 1771 1772 //! 1773 //! \brief Add context 1774 //! 1775 //! \param [in] ctx 1776 //! Pointer to VA driver context 1777 //! \param [in] contexts 1778 //! VA context ID 1779 //! \param [in] mfe_context 1780 //! VA MF context ID 1781 //! 1782 //! \return VAStatus 1783 //! VA_STATUS_SUCCESS if success, else fail reason 1784 //! 1785 VAStatus DdiMedia_AddContextInternal ( 1786 VADriverContextP ctx, 1787 VAContextID context, 1788 VAMFContextID mfe_context 1789 ); 1790 1791 //! 1792 //! \brief Release context 1793 //! 1794 //! \param [in] ctx 1795 //! Pointer to VA driver context 1796 //! \param [in] contexts 1797 //! VA context ID 1798 //! \param [in] mfe_context 1799 //! VA MF context ID 1800 //! 1801 //! \return VAStatus 1802 //! VA_STATUS_SUCCESS if success, else fail reason 1803 //! 1804 VAStatus DdiMedia_ReleaseContextInternal ( 1805 VADriverContextP ctx, 1806 VAContextID context, 1807 VAMFContextID mfe_context 1808 ); 1809 1810 #endif // ANDROID 1811 1812 #ifdef __cplusplus 1813 extern "C" { 1814 #endif 1815 1816 //! \brief Hybrid query buffer attributes 1817 //! 1818 //! \param [in] dpy 1819 //! VA display 1820 //! \param [in] context 1821 //! VA context ID 1822 //! \param [in] bufferType 1823 //! VA buffer type 1824 //! \param [out] outputData 1825 //! Output data 1826 //! \param [out] outputDataLen 1827 //! Length of output data 1828 //! 1829 //! \return VAStatus 1830 //! VA_STATUS_SUCCESS if success, else fail reason 1831 //! 1832 MEDIAAPI_EXPORT VAStatus DdiMedia_HybridQueryBufferAttributes( 1833 VADisplay dpy, 1834 VAContextID context, 1835 VABufferType bufferType, 1836 void *outputData, 1837 uint32_t *outputDataLen); 1838 1839 //! \brief Set frame ID 1840 //! 1841 //! \param [in] ctx 1842 //! Pointer to VA driver context 1843 //! \param [in] surface 1844 //! VA surface ID 1845 //! \param [in] frame_id 1846 //! Frame ID 1847 //! 1848 //! \return VAStatus 1849 //! VA_STATUS_SUCCESS if success, else fail reason 1850 //! 1851 VAStatus DdiMedia_SetFrameID( 1852 VADriverContextP ctx, 1853 VASurfaceID surface, 1854 uint32_t frame_id); 1855 1856 #ifdef __cplusplus 1857 } 1858 #endif 1859 1860 #endif // __MEDIA_LIBVA_H__ 1861 1862