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