Debian Codegraph @

va/va.h

raw
1 /*
2 * Copyright (c) 2007-2009 Intel Corporation. All Rights Reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sub license, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
14 * of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19 * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24 /*
25 * Video Acceleration (VA) API Specification
26 *
27 * Rev. 0.30
28 * <[email protected]>
29 *
30 * Revision History:
31 * rev 0.10 (12/10/2006 Jonathan Bian) - Initial draft
32 * rev 0.11 (12/15/2006 Jonathan Bian) - Fixed some errors
33 * rev 0.12 (02/05/2007 Jonathan Bian) - Added VC-1 data structures for slice level decode
34 * rev 0.13 (02/28/2007 Jonathan Bian) - Added GetDisplay()
35 * rev 0.14 (04/13/2007 Jonathan Bian) - Fixed MPEG-2 PictureParameter structure, cleaned up a few funcs.
36 * rev 0.15 (04/20/2007 Jonathan Bian) - Overhauled buffer management
37 * rev 0.16 (05/02/2007 Jonathan Bian) - Added error codes and fixed some issues with configuration
38 * rev 0.17 (05/07/2007 Jonathan Bian) - Added H.264/AVC data structures for slice level decode.
39 * rev 0.18 (05/14/2007 Jonathan Bian) - Added data structures for MPEG-4 slice level decode
40 * and MPEG-2 motion compensation.
41 * rev 0.19 (08/06/2007 Jonathan Bian) - Removed extra type for bitplane data.
42 * rev 0.20 (08/08/2007 Jonathan Bian) - Added missing fields to VC-1 PictureParameter structure.
43 * rev 0.21 (08/20/2007 Jonathan Bian) - Added image and subpicture support.
44 * rev 0.22 (08/27/2007 Jonathan Bian) - Added support for chroma-keying and global alpha.
45 * rev 0.23 (09/11/2007 Jonathan Bian) - Fixed some issues with images and subpictures.
46 * rev 0.24 (09/18/2007 Jonathan Bian) - Added display attributes.
47 * rev 0.25 (10/18/2007 Jonathan Bian) - Changed to use IDs only for some types.
48 * rev 0.26 (11/07/2007 Waldo Bastian) - Change vaCreateBuffer semantics
49 * rev 0.27 (11/19/2007 Matt Sottek) - Added DeriveImage
50 * rev 0.28 (12/06/2007 Jonathan Bian) - Added new versions of PutImage and AssociateSubpicture
51 * to enable scaling
52 * rev 0.29 (02/07/2008 Jonathan Bian) - VC1 parameter fixes,
53 * added VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED
54 * rev 0.30 (03/01/2009 Jonathan Bian) - Added encoding support for H.264 BP and MPEG-4 SP and fixes
55 * for ISO C conformance.
56 * rev 0.31 (09/02/2009 Gwenole Beauchesne) - VC-1/H264 fields change for VDPAU and XvBA backend
57 * Application needs to relink with the new library.
58 *
59 * rev 0.31.1 (03/29/2009) - Data structure for JPEG encode
60 * rev 0.31.2 (01/13/2011 Anthony Pabon)- Added a flag to indicate Subpicture coordinates are screen
61 * screen relative rather than source video relative.
62 * rev 0.32.0 (01/13/2011 Xiang Haihao) - Add profile into VAPictureParameterBufferVC1
63 * update VAAPI to 0.32.0
64 *
65 * Acknowledgements:
66 * Some concepts borrowed from XvMC and XvImage.
67 * Waldo Bastian (Intel), Matt Sottek (Intel), Austin Yuan (Intel), and Gwenole Beauchesne (SDS)
68 * contributed to various aspects of the API.
69 */
70
71 /**
72 * \file va.h
73 * \brief The Core API
74 *
75 * This file contains the \ref api_core "Core API".
76 */
77
78 #ifndef _VA_H_
79 #define _VA_H_
80
81 #include <stddef.h>
82 #include <stdint.h>
83 #include <va/va_version.h>
84
85 #ifdef __cplusplus
86 extern "C" {
87 #endif
88
89 #if defined(__GNUC__) && !defined(__COVERITY__)
90 #define va_deprecated __attribute__((deprecated))
91 #if __GNUC__ >= 6
92 #define va_deprecated_enum va_deprecated
93 #else
94 #define va_deprecated_enum
95 #endif
96 #else
97 #define va_deprecated
98 #define va_deprecated_enum
99 #endif
100
101 /**
102 * \mainpage Video Acceleration (VA) API
103 *
104 * \section intro Introduction
105 *
106 * The main motivation for VA-API (Video Acceleration API) is to
107 * enable hardware accelerated video decode and encode at various
108 * entry-points (VLD, IDCT, Motion Compensation etc.) for the
109 * prevailing coding standards today (MPEG-2, MPEG-4 ASP/H.263, MPEG-4
110 * AVC/H.264, VC-1/VMW3, and JPEG, HEVC/H265, VP8, VP9) and video pre/post
111 * processing
112 *
113 * VA-API is split into several modules:
114 * - \ref api_core
115 * - Encoder (H264, HEVC, JPEG, MPEG2, VP8, VP9)
116 * - \ref api_enc_h264
117 * - \ref api_enc_hevc
118 * - \ref api_enc_jpeg
119 * - \ref api_enc_mpeg2
120 * - \ref api_enc_vp8
121 * - \ref api_enc_vp9
122 * - \ref api_enc_av1
123 * - Decoder (HEVC, JPEG, VP8, VP9, AV1, VVC)
124 * - \ref api_dec_hevc
125 * - \ref api_dec_jpeg
126 * - \ref api_dec_vp8
127 * - \ref api_dec_vp9
128 * - \ref api_dec_av1
129 * - \ref api_dec_vvc
130 * - \ref api_vpp
131 * - \ref api_prot
132 * - FEI (H264, HEVC)
133 * - \ref api_fei
134 * - \ref api_fei_h264
135 * - \ref api_fei_hevc
136 *
137 * \section threading Multithreading Guide
138 * All VAAPI functions implemented in libva are thread-safe. For any VAAPI
139 * function that requires the implementation of a backend (e.g. hardware driver),
140 * the backend must ensure that its implementation is also thread-safe. If the
141 * backend implementation of a VAAPI function is not thread-safe then this should
142 * be considered as a bug against the backend implementation.
143 *
144 * It is assumed that none of the VAAPI functions will be called from signal
145 * handlers.
146 *
147 * Thread-safety in this context means that when VAAPI is being called by multiple
148 * concurrent threads, it will not crash or hang the OS, and VAAPI internal
149 * data structures will not be corrupted. When multiple threads are operating on
150 * the same VAAPI objects, it is the application's responsibility to synchronize
151 * these operations in order to generate the expected results. For example, using
152 * a single VAContext from multiple threads may generate unexpected results.
153 *
154 * Following pseudo code illustrates a multithreaded transcoding scenario, where
155 * one thread is handling the decoding operation and another thread is handling
156 * the encoding operation, while synchronizing the use of a common pool of
157 * surfaces.
158 *
159 * \code
160 * // Initialization
161 * dpy = vaGetDisplayDRM(fd);
162 * vaInitialize(dpy, ...);
163 *
164 * // Create surfaces required for decoding and subsequence encoding
165 * vaCreateSurfaces(dpy, VA_RT_FORMAT_YUV420, width, height, &surfaces[0], ...);
166 *
167 * // Set up a queue for the surfaces shared between decode and encode threads
168 * surface_queue = queue_create();
169 *
170 * // Create decode_thread
171 * pthread_create(&decode_thread, NULL, decode, ...);
172 *
173 * // Create encode_thread
174 * pthread_create(&encode_thread, NULL, encode, ...);
175 *
176 * // Decode thread function
177 * decode() {
178 * // Find the decode entrypoint for H.264
179 * vaQueryConfigEntrypoints(dpy, h264_profile, entrypoints, ...);
180 *
181 * // Create a config for H.264 decode
182 * vaCreateConfig(dpy, h264_profile, VAEntrypointVLD, ...);
183 *
184 * // Create a context for decode
185 * vaCreateContext(dpy, config, width, height, VA_PROGRESSIVE, surfaces,
186 * num_surfaces, &decode_context);
187 *
188 * // Decode frames in the bitstream
189 * for (;;) {
190 * // Parse one frame and decode
191 * vaBeginPicture(dpy, decode_context, surfaces[surface_index]);
192 * vaRenderPicture(dpy, decode_context, buf, ...);
193 * vaEndPicture(dpy, decode_context);
194 * // Poll the decoding status and enqueue the surface in display order after
195 * // decoding is complete
196 * vaQuerySurfaceStatus();
197 * enqueue(surface_queue, surface_index);
198 * }
199 * }
200 *
201 * // Encode thread function
202 * encode() {
203 * // Find the encode entrypoint for HEVC
204 * vaQueryConfigEntrypoints(dpy, hevc_profile, entrypoints, ...);
205 *
206 * // Create a config for HEVC encode
207 * vaCreateConfig(dpy, hevc_profile, VAEntrypointEncSlice, ...);
208 *
209 * // Create a context for encode
210 * vaCreateContext(dpy, config, width, height, VA_PROGRESSIVE, surfaces,
211 * num_surfaces, &encode_context);
212 *
213 * // Encode frames produced by the decoder
214 * for (;;) {
215 * // Dequeue the surface enqueued by the decoder
216 * surface_index = dequeue(surface_queue);
217 * // Encode using this surface as the source
218 * vaBeginPicture(dpy, encode_context, surfaces[surface_index]);
219 * vaRenderPicture(dpy, encode_context, buf, ...);
220 * vaEndPicture(dpy, encode_context);
221 * }
222 * }
223 * \endcode
224 */
225
226 /**
227 * \defgroup api_core Core API
228 *
229 * @{
230 */
231
232 /**
233 Overview
234
235 The VA API is intended to provide an interface between a video decode/encode/processing
236 application (client) and a hardware accelerator (server), to off-load
237 video decode/encode/processing operations from the host to the hardware accelerator at various
238 entry-points.
239
240 The basic operation steps are:
241
242 - Negotiate a mutually acceptable configuration with the server to lock
243 down profile, entrypoints, and other attributes that will not change on
244 a frame-by-frame basis.
245 - Create a video decode, encode or processing context which represents a
246 "virtualized" hardware device
247 - Get and fill the render buffers with the corresponding data (depending on
248 profiles and entrypoints)
249 - Pass the render buffers to the server to handle the current frame
250
251 Initialization & Configuration Management
252
253 - Find out supported profiles
254 - Find out entrypoints for a given profile
255 - Find out configuration attributes for a given profile/entrypoint pair
256 - Create a configuration for use by the application
257
258 */
259
260 typedef void* VADisplay; /* window system dependent */
261
262 typedef int VAStatus; /** Return status type from functions */
263 /** Values for the return status */
264 #define VA_STATUS_SUCCESS 0x00000000
265 #define VA_STATUS_ERROR_OPERATION_FAILED 0x00000001
266 #define VA_STATUS_ERROR_ALLOCATION_FAILED 0x00000002
267 #define VA_STATUS_ERROR_INVALID_DISPLAY 0x00000003
268 #define VA_STATUS_ERROR_INVALID_CONFIG 0x00000004
269 #define VA_STATUS_ERROR_INVALID_CONTEXT 0x00000005
270 #define VA_STATUS_ERROR_INVALID_SURFACE 0x00000006
271 #define VA_STATUS_ERROR_INVALID_BUFFER 0x00000007
272 #define VA_STATUS_ERROR_INVALID_IMAGE 0x00000008
273 #define VA_STATUS_ERROR_INVALID_SUBPICTURE 0x00000009
274 #define VA_STATUS_ERROR_ATTR_NOT_SUPPORTED 0x0000000a
275 #define VA_STATUS_ERROR_MAX_NUM_EXCEEDED 0x0000000b
276 #define VA_STATUS_ERROR_UNSUPPORTED_PROFILE 0x0000000c
277 #define VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT 0x0000000d
278 #define VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT 0x0000000e
279 #define VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE 0x0000000f
280 #define VA_STATUS_ERROR_SURFACE_BUSY 0x00000010
281 #define VA_STATUS_ERROR_FLAG_NOT_SUPPORTED 0x00000011
282 #define VA_STATUS_ERROR_INVALID_PARAMETER 0x00000012
283 #define VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED 0x00000013
284 #define VA_STATUS_ERROR_UNIMPLEMENTED 0x00000014
285 #define VA_STATUS_ERROR_SURFACE_IN_DISPLAYING 0x00000015
286 #define VA_STATUS_ERROR_INVALID_IMAGE_FORMAT 0x00000016
287 #define VA_STATUS_ERROR_DECODING_ERROR 0x00000017
288 #define VA_STATUS_ERROR_ENCODING_ERROR 0x00000018
289 /**
290 * \brief An invalid/unsupported value was supplied.
291 *
292 * This is a catch-all error code for invalid or unsupported values.
293 * e.g. value exceeding the valid range, invalid type in the context
294 * of generic attribute values.
295 */
296 #define VA_STATUS_ERROR_INVALID_VALUE 0x00000019
297 /** \brief An unsupported filter was supplied. */
298 #define VA_STATUS_ERROR_UNSUPPORTED_FILTER 0x00000020
299 /** \brief An invalid filter chain was supplied. */
300 #define VA_STATUS_ERROR_INVALID_FILTER_CHAIN 0x00000021
301 /** \brief Indicate HW busy (e.g. run multiple encoding simultaneously). */
302 #define VA_STATUS_ERROR_HW_BUSY 0x00000022
303 /** \brief An unsupported memory type was supplied. */
304 #define VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE 0x00000024
305 /** \brief Indicate allocated buffer size is not enough for input or output. */
306 #define VA_STATUS_ERROR_NOT_ENOUGH_BUFFER 0x00000025
307 /** \brief Indicate an operation isn't completed because time-out interval elapsed. */
308 #define VA_STATUS_ERROR_TIMEDOUT 0x00000026
309 #define VA_STATUS_ERROR_UNKNOWN 0xFFFFFFFF
310
311 /**
312 * 1. De-interlacing flags for vaPutSurface()
313 * 2. Surface sample type for input/output surface flag
314 * - Progressive: VA_FRAME_PICTURE
315 * - Interleaved: VA_TOP_FIELD_FIRST, VA_BOTTOM_FIELD_FIRST
316 * - Field: VA_TOP_FIELD, VA_BOTTOM_FIELD
317 */
318 #define VA_FRAME_PICTURE 0x00000000
319 #define VA_TOP_FIELD 0x00000001
320 #define VA_BOTTOM_FIELD 0x00000002
321 #define VA_TOP_FIELD_FIRST 0x00000004
322 #define VA_BOTTOM_FIELD_FIRST 0x00000008
323
324 /**
325 * Enabled the positioning/cropping/blending feature:
326 * 1, specify the video playback position in the isurface
327 * 2, specify the cropping info for video playback
328 * 3, encoded video will blend with background color
329 */
330 #define VA_ENABLE_BLEND 0x00000004 /* video area blend with the constant color */
331
332 /**
333 * Clears the drawable with background color.
334 * for hardware overlay based implementation this flag
335 * can be used to turn off the overlay
336 */
337 #define VA_CLEAR_DRAWABLE 0x00000008
338
339 /** Color space conversion flags for vaPutSurface() */
340 #define VA_SRC_COLOR_MASK 0x000000f0
341 #define VA_SRC_BT601 0x00000010
342 #define VA_SRC_BT709 0x00000020
343 #define VA_SRC_SMPTE_240 0x00000040
344
345 /** Scaling flags for vaPutSurface() */
346 #define VA_FILTER_SCALING_DEFAULT 0x00000000
347 #define VA_FILTER_SCALING_FAST 0x00000100
348 #define VA_FILTER_SCALING_HQ 0x00000200
349 #define VA_FILTER_SCALING_NL_ANAMORPHIC 0x00000300
350 #define VA_FILTER_SCALING_MASK 0x00000f00
351
352 /** Interpolation method for scaling */
353 #define VA_FILTER_INTERPOLATION_DEFAULT 0x00000000
354 #define VA_FILTER_INTERPOLATION_NEAREST_NEIGHBOR 0x00001000
355 #define VA_FILTER_INTERPOLATION_BILINEAR 0x00002000
356 #define VA_FILTER_INTERPOLATION_ADVANCED 0x00003000
357 #define VA_FILTER_INTERPOLATION_MASK 0x0000f000
358
359 /** Padding size in 4-bytes */
360 #define VA_PADDING_LOW 4
361 #define VA_PADDING_MEDIUM 8
362 #define VA_PADDING_HIGH 16
363 #define VA_PADDING_LARGE 32
364
365 /** operation options */
366 /** synchronization, block call, output should be ready after execution function return*/
367 #define VA_EXEC_SYNC 0x0
368 /** asynchronization,application should call additonal sync operation to access output */
369 #define VA_EXEC_ASYNC 0x1
370
371 /** operation mode */
372 #define VA_EXEC_MODE_DEFAULT 0x0
373 #define VA_EXEC_MODE_POWER_SAVING 0x1
374 #define VA_EXEC_MODE_PERFORMANCE 0x2
375
376 /* Values used to describe device features. */
377 /** The feature is not supported by the device.
378 *
379 * Any corresponding feature flag must not be set.
380 */
381 #define VA_FEATURE_NOT_SUPPORTED 0
382 /** The feature is supported by the device.
383 *
384 * The user may decide whether or not to use this feature.
385 *
386 * Note that support for a feature only indicates that the hardware
387 * is able to use it; whether it is actually a positive change to
388 * enable it in a given situation will depend on other factors
389 * including the input provided by the user.
390 */
391 #define VA_FEATURE_SUPPORTED 1
392 /** The feature is required by the device.
393 *
394 * The device does not support not enabling this feature, so any
395 * corresponding feature flag must be set and any additional
396 * configuration needed by the feature must be supplied.
397 */
398 #define VA_FEATURE_REQUIRED 2
399
400 /**
401 * Returns a short english description of error_status
402 */
403 const char *vaErrorStr(VAStatus error_status);
404
405 /** \brief Structure to describe rectangle. */
406 typedef struct _VARectangle {
407 int16_t x;
408 int16_t y;
409 uint16_t width;
410 uint16_t height;
411 } VARectangle;
412
413 /** \brief Generic motion vector data structure. */
414 typedef struct _VAMotionVector {
415 /** \brief Past reference
416 *
417 * - \c [0]: horizontal motion vector for past reference
418 * - \c [1]: vertical motion vector for past reference
419 */
420 int16_t mv0[2];
421 /** \brief Future reference
422 *
423 * - \c [0]: horizontal motion vector for future reference
424 * - \c [1]: vertical motion vector for future reference
425 */
426 int16_t mv1[2];
427 } VAMotionVector;
428
429 /** Type of a message callback, used for both error and info log. */
430 typedef void (*VAMessageCallback)(void *user_context, const char *message);
431
432 /**
433 * Set the callback for error messages, or NULL for no logging.
434 * Returns the previous one, or NULL if it was disabled.
435 */
436 VAMessageCallback vaSetErrorCallback(VADisplay dpy, VAMessageCallback callback, void *user_context);
437
438 /**
439 * Set the callback for info messages, or NULL for no logging.
440 * Returns the previous one, or NULL if it was disabled.
441 */
442 VAMessageCallback vaSetInfoCallback(VADisplay dpy, VAMessageCallback callback, void *user_context);
443
444 /**
445 * Initialization:
446 * A display must be obtained by calling vaGetDisplay() before calling
447 * vaInitialize() and other functions. This connects the API to the
448 * native window system.
449 * For X Windows, native_dpy would be from XOpenDisplay()
450 */
451 typedef void* VANativeDisplay; /* window system dependent */
452
453 int vaDisplayIsValid(VADisplay dpy);
454
455 /**
456 * Set the override driver name instead of queried driver driver.
457 */
458 VAStatus vaSetDriverName(VADisplay dpy,
459 char *driver_name
460 );
461
462 /**
463 * Initialize the library
464 */
465 VAStatus vaInitialize(
466 VADisplay dpy,
467 int *major_version, /* out */
468 int *minor_version /* out */
469 );
470
471 /**
472 * After this call, all library internal resources will be cleaned up
473 */
474 VAStatus vaTerminate(
475 VADisplay dpy
476 );
477
478 /**
479 * vaQueryVendorString returns a pointer to a zero-terminated string
480 * describing some aspects of the VA implemenation on a specific
481 * hardware accelerator. The format of the returned string is vendor
482 * specific and at the discretion of the implementer.
483 * e.g. for the Intel GMA500 implementation, an example would be:
484 * "Intel GMA500 - 2.0.0.32L.0005"
485 */
486 const char *vaQueryVendorString(
487 VADisplay dpy
488 );
489
490 typedef int (*VAPrivFunc)(void);
491
492 /**
493 * Return a function pointer given a function name in the library.
494 * This allows private interfaces into the library
495 */
496 VAPrivFunc vaGetLibFunc(
497 VADisplay dpy,
498 const char *func
499 );
500
501 /** Currently defined profiles */
502 typedef enum {
503 /** \brief Profile ID used for video processing. */
504 VAProfileNone = -1,
505 VAProfileMPEG2Simple = 0,
506 VAProfileMPEG2Main = 1,
507 VAProfileMPEG4Simple = 2,
508 VAProfileMPEG4AdvancedSimple = 3,
509 VAProfileMPEG4Main = 4,
510 VAProfileH264Baseline va_deprecated_enum = 5,
511 VAProfileH264Main = 6,
512 VAProfileH264High = 7,
513 VAProfileVC1Simple = 8,
514 VAProfileVC1Main = 9,
515 VAProfileVC1Advanced = 10,
516 VAProfileH263Baseline = 11,
517 VAProfileJPEGBaseline = 12,
518 VAProfileH264ConstrainedBaseline = 13,
519 VAProfileVP8Version0_3 = 14,
520 VAProfileH264MultiviewHigh = 15,
521 VAProfileH264StereoHigh = 16,
522 VAProfileHEVCMain = 17,
523 VAProfileHEVCMain10 = 18,
524 VAProfileVP9Profile0 = 19,
525 VAProfileVP9Profile1 = 20,
526 VAProfileVP9Profile2 = 21,
527 VAProfileVP9Profile3 = 22,
528 VAProfileHEVCMain12 = 23,
529 VAProfileHEVCMain422_10 = 24,
530 VAProfileHEVCMain422_12 = 25,
531 VAProfileHEVCMain444 = 26,
532 VAProfileHEVCMain444_10 = 27,
533 VAProfileHEVCMain444_12 = 28,
534 VAProfileHEVCSccMain = 29,
535 VAProfileHEVCSccMain10 = 30,
536 VAProfileHEVCSccMain444 = 31,
537 VAProfileAV1Profile0 = 32,
538 VAProfileAV1Profile1 = 33,
539 VAProfileHEVCSccMain444_10 = 34,
540 /** \brief Profile ID used for protected video playback. */
541 VAProfileProtected = 35,
542 VAProfileH264High10 = 36,
543 VAProfileVVCMain10 = 37,
544 VAProfileVVCMultilayerMain10 = 38,
545 VAProfileAV1Profile2 = 39,
546 VAProfileH264High422 = 40
547 } VAProfile;
548
549 /**
550 * Currently defined entrypoints
551 */
552 typedef enum {
553 VAEntrypointVLD = 1,
554 VAEntrypointIZZ = 2,
555 VAEntrypointIDCT = 3,
556 VAEntrypointMoComp = 4,
557 VAEntrypointDeblocking = 5,
558 VAEntrypointEncSlice = 6, /* slice level encode */
559 VAEntrypointEncPicture = 7, /* pictuer encode, JPEG, etc */
560 /*
561 * For an implementation that supports a low power/high performance variant
562 * for slice level encode, it can choose to expose the
563 * VAEntrypointEncSliceLP entrypoint. Certain encoding tools may not be
564 * available with this entrypoint (e.g. interlace, MBAFF) and the
565 * application can query the encoding configuration attributes to find
566 * out more details if this entrypoint is supported.
567 */
568 VAEntrypointEncSliceLP = 8,
569 VAEntrypointVideoProc = 10, /**< Video pre/post-processing. */
570 /**
571 * \brief VAEntrypointFEI
572 *
573 * The purpose of FEI (Flexible Encoding Infrastructure) is to allow applications to
574 * have more controls and trade off quality for speed with their own IPs.
575 * The application can optionally provide input to ENC for extra encode control
576 * and get the output from ENC. Application can chose to modify the ENC
577 * output/PAK input during encoding, but the performance impact is significant.
578 *
579 * On top of the existing buffers for normal encode, there will be
580 * one extra input buffer (VAEncMiscParameterFEIFrameControl) and
581 * three extra output buffers (VAEncFEIMVBufferType, VAEncFEIMBModeBufferType
582 * and VAEncFEIDistortionBufferType) for VAEntrypointFEI entry function.
583 * If separate PAK is set, two extra input buffers
584 * (VAEncFEIMVBufferType, VAEncFEIMBModeBufferType) are needed for PAK input.
585 **/
586 VAEntrypointFEI = 11,
587 /**
588 * \brief VAEntrypointStats
589 *
590 * A pre-processing function for getting some statistics and motion vectors is added,
591 * and some extra controls for Encode pipeline are provided. The application can
592 * optionally call the statistics function to get motion vectors and statistics like
593 * variances, distortions before calling Encode function via this entry point.
594 *
595 * Checking whether Statistics is supported can be performed with vaQueryConfigEntrypoints().
596 * If Statistics entry point is supported, then the list of returned entry-points will
597 * include #VAEntrypointStats. Supported pixel format, maximum resolution and statistics
598 * specific attributes can be obtained via normal attribute query. One input buffer
599 * (VAStatsStatisticsParameterBufferType) and one or two output buffers
600 * (VAStatsStatisticsBufferType, VAStatsStatisticsBottomFieldBufferType (for interlace only)
601 * and VAStatsMVBufferType) are needed for this entry point.
602 **/
603 VAEntrypointStats = 12,
604 /**
605 * \brief VAEntrypointProtectedTEEComm
606 *
607 * A function for communicating with TEE (Trusted Execution Environment).
608 **/
609 VAEntrypointProtectedTEEComm = 13,
610 /**
611 * \brief VAEntrypointProtectedContent
612 *
613 * A function for protected content to decrypt encrypted content.
614 **/
615 VAEntrypointProtectedContent = 14,
616 } VAEntrypoint;
617
618 /** Currently defined configuration attribute types */
619 typedef enum {
620 VAConfigAttribRTFormat = 0,
621 VAConfigAttribSpatialResidual = 1,
622 VAConfigAttribSpatialClipping = 2,
623 VAConfigAttribIntraResidual = 3,
624 VAConfigAttribEncryption = 4,
625 VAConfigAttribRateControl = 5,
626
627 /** @name Attributes for decoding */
628 /**@{*/
629 /**
630 * \brief Slice Decoding mode. Read/write.
631 *
632 * This attribute determines what mode the driver supports for slice
633 * decoding, through vaGetConfigAttributes(); and what mode the user
634 * will be providing to the driver, through vaCreateConfig(), if the
635 * driver supports those. If this attribute is not set by the user then
636 * it is assumed that VA_DEC_SLICE_MODE_NORMAL mode is used.
637 *
638 * See \c VA_DEC_SLICE_MODE_xxx for the list of slice decoding modes.
639 */
640 VAConfigAttribDecSliceMode = 6,
641 /**
642 * \brief JPEG decoding attribute. Read-only.
643 *
644 * This attribute exposes a number of capabilities of the underlying
645 * JPEG implementation. The attribute value is partitioned into fields as defined in the
646 * VAConfigAttribValDecJPEG union.
647 */
648 VAConfigAttribDecJPEG = 7,
649 /**
650 * \brief Decode processing support. Read/write.
651 *
652 * This attribute determines if the driver supports video processing
653 * with decoding using the decoding context in a single call, through
654 * vaGetConfigAttributes(); and if the user may use this feature,
655 * through vaCreateConfig(), if the driver supports the user scenario.
656 * The user will essentially create a regular decode VAContext. Therefore,
657 * the parameters of vaCreateContext() such as picture_width, picture_height
658 * and render_targets are in relation to the decode output parameters
659 * (not processing output parameters) as normal.
660 * If this attribute is not set by the user then it is assumed that no
661 * extra processing is done after decoding for this decode context.
662 *
663 * Since essentially the application is creating a decoder config and context,
664 * all function calls that take in the config (e.g. vaQuerySurfaceAttributes())
665 * or context are in relation to the decoder, except those video processing
666 * function specified in the next paragraph.
667 *
668 * Once the decode config and context are created, the user must further
669 * query the supported processing filters using vaQueryVideoProcFilters(),
670 * vaQueryVideoProcFilterCaps(), vaQueryVideoProcPipelineCaps() by specifying
671 * the created decode context. The user must provide processing information
672 * and extra processing output surfaces as "additional_outputs" to the driver
673 * through VAProcPipelineParameterBufferType. The render_target specified
674 * at vaBeginPicture() time refers to the decode output surface. The
675 * target surface for the output of processing needs to be a different
676 * surface since the decode process requires the original reconstructed buffer.
677 * The "surface" member of VAProcPipelineParameterBuffer should be set to the
678 * same as "render_target" set in vaBeginPicture(), but the driver may choose
679 * to ignore this parameter.
680 */
681 VAConfigAttribDecProcessing = 8,
682 /** @name Attributes for encoding */
683 /**@{*/
684 /**
685 * \brief Packed headers mode. Read/write.
686 *
687 * This attribute determines what packed headers the driver supports,
688 * through vaGetConfigAttributes(); and what packed headers the user
689 * will be providing to the driver, through vaCreateConfig(), if the
690 * driver supports those.
691 *
692 * See \c VA_ENC_PACKED_HEADER_xxx for the list of packed headers.
693 */
694 VAConfigAttribEncPackedHeaders = 10,
695 /**
696 * \brief Interlaced mode. Read/write.
697 *
698 * This attribute determines what kind of interlaced encoding mode
699 * the driver supports.
700 *
701 * See \c VA_ENC_INTERLACED_xxx for the list of interlaced modes.
702 */
703 VAConfigAttribEncInterlaced = 11,
704 /**
705 * \brief Maximum number of reference frames. Read-only.
706 *
707 * This attribute determines the maximum number of reference
708 * frames supported for encoding.
709 *
710 * Note: for H.264 encoding, the value represents the maximum number
711 * of reference frames for both the reference picture list 0 (bottom
712 * 16 bits) and the reference picture list 1 (top 16 bits).
713 */
714 VAConfigAttribEncMaxRefFrames = 13,
715 /**
716 * \brief Maximum number of slices per frame. Read-only.
717 *
718 * This attribute determines the maximum number of slices the
719 * driver can support to encode a single frame.
720 */
721 VAConfigAttribEncMaxSlices = 14,
722 /**
723 * \brief Slice structure. Read-only.
724 *
725 * This attribute determines slice structures supported by the
726 * driver for encoding. This attribute is a hint to the user so
727 * that he can choose a suitable surface size and how to arrange
728 * the encoding process of multiple slices per frame.
729 *
730 * More specifically, for H.264 encoding, this attribute
731 * determines the range of accepted values to
732 * VAEncSliceParameterBufferH264::macroblock_address and
733 * VAEncSliceParameterBufferH264::num_macroblocks.
734 *
735 * See \c VA_ENC_SLICE_STRUCTURE_xxx for the supported slice
736 * structure types.
737 */
738 VAConfigAttribEncSliceStructure = 15,
739 /**
740 * \brief Macroblock information. Read-only.
741 *
742 * This attribute determines whether the driver supports extra
743 * encoding information per-macroblock. e.g. QP.
744 *
745 * More specifically, for H.264 encoding, if the driver returns a non-zero
746 * value for this attribute, this means the application can create
747 * additional #VAEncMacroblockParameterBufferH264 buffers referenced
748 * through VAEncSliceParameterBufferH264::macroblock_info.
749 */
750 VAConfigAttribEncMacroblockInfo = 16,
751 /**
752 * \brief Maximum picture width. Read-only.
753 *
754 * This attribute determines the maximum picture width the driver supports
755 * for a given configuration.
756 */
757 VAConfigAttribMaxPictureWidth = 18,
758 /**
759 * \brief Maximum picture height. Read-only.
760 *
761 * This attribute determines the maximum picture height the driver supports
762 * for a given configuration.
763 */
764 VAConfigAttribMaxPictureHeight = 19,
765 /**
766 * \brief JPEG encoding attribute. Read-only.
767 *
768 * This attribute exposes a number of capabilities of the underlying
769 * JPEG implementation. The attribute value is partitioned into fields as defined in the
770 * VAConfigAttribValEncJPEG union.
771 */
772 VAConfigAttribEncJPEG = 20,
773 /**
774 * \brief Encoding quality range attribute. Read-only.
775 *
776 * This attribute conveys whether the driver supports different quality level settings
777 * for encoding. A value less than or equal to 1 means that the encoder only has a single
778 * quality setting, and a value greater than 1 represents the number of quality levels
779 * that can be configured. e.g. a value of 2 means there are two distinct quality levels.
780 */
781 VAConfigAttribEncQualityRange = 21,
782 /**
783 * \brief Encoding quantization attribute. Read-only.
784 *
785 * This attribute conveys whether the driver supports certain types of quantization methods
786 * for encoding (e.g. trellis). See \c VA_ENC_QUANTIZATION_xxx for the list of quantization methods
787 */
788 VAConfigAttribEncQuantization = 22,
789 /**
790 * \brief Encoding intra refresh attribute. Read-only.
791 *
792 * This attribute conveys whether the driver supports certain types of intra refresh methods
793 * for encoding (e.g. adaptive intra refresh or rolling intra refresh).
794 * See \c VA_ENC_INTRA_REFRESH_xxx for intra refresh methods
795 */
796 VAConfigAttribEncIntraRefresh = 23,
797 /**
798 * \brief Encoding skip frame attribute. Read-only.
799 *
800 * This attribute conveys whether the driver supports sending skip frame parameters
801 * (VAEncMiscParameterTypeSkipFrame) to the encoder's rate control, when the user has
802 * externally skipped frames.
803 */
804 VAConfigAttribEncSkipFrame = 24,
805 /**
806 * \brief Encoding region-of-interest (ROI) attribute. Read-only.
807 *
808 * This attribute conveys whether the driver supports region-of-interest (ROI) encoding,
809 * based on user provided ROI rectangles. The attribute value is partitioned into fields
810 * as defined in the VAConfigAttribValEncROI union.
811 *
812 * If ROI encoding is supported, the ROI information is passed to the driver using
813 * VAEncMiscParameterTypeROI.
814 */
815 VAConfigAttribEncROI = 25,
816 /**
817 * \brief Encoding extended rate control attribute. Read-only.
818 *
819 * This attribute conveys whether the driver supports any extended rate control features
820 * The attribute value is partitioned into fields as defined in the
821 * VAConfigAttribValEncRateControlExt union.
822 */
823 VAConfigAttribEncRateControlExt = 26,
824 /**
825 * \brief Processing rate reporting attribute. Read-only.
826 *
827 * This attribute conveys whether the driver supports reporting of
828 * encode/decode processing rate based on certain set of parameters
829 * (i.e. levels, I frame internvals) for a given configuration.
830 * If this is supported, vaQueryProcessingRate() can be used to get
831 * encode or decode processing rate.
832 * See \c VA_PROCESSING_RATE_xxx for encode/decode processing rate
833 */
834 VAConfigAttribProcessingRate = 27,
835 /**
836 * \brief Encoding dirty rectangle. Read-only.
837 *
838 * This attribute conveys whether the driver supports dirty rectangle.
839 * encoding, based on user provided ROI rectangles which indicate the rectangular areas
840 * where the content has changed as compared to the previous picture. The regions of the
841 * picture that are not covered by dirty rect rectangles are assumed to have not changed
842 * compared to the previous picture. The encoder may do some optimizations based on
843 * this information. The attribute value returned indicates the number of regions that
844 * are supported. e.g. A value of 0 means dirty rect encoding is not supported. If dirty
845 * rect encoding is supported, the ROI information is passed to the driver using
846 * VAEncMiscParameterTypeDirtyRect.
847 */
848 VAConfigAttribEncDirtyRect = 28,
849 /**
850 * \brief Parallel Rate Control (hierachical B) attribute. Read-only.
851 *
852 * This attribute conveys whether the encoder supports parallel rate control.
853 * It is a integer value 0 - unsupported, > 0 - maximum layer supported.
854 * This is the way when hireachical B frames are encoded, multiple independent B frames
855 * on the same layer may be processed at same time. If supported, app may enable it by
856 * setting enable_parallel_brc in VAEncMiscParameterRateControl,and the number of B frames
857 * per layer per GOP will be passed to driver through VAEncMiscParameterParallelRateControl
858 * structure.Currently three layers are defined.
859 */
860 VAConfigAttribEncParallelRateControl = 29,
861 /**
862 * \brief Dynamic Scaling Attribute. Read-only.
863 *
864 * This attribute conveys whether encoder is capable to determine dynamic frame
865 * resolutions adaptive to bandwidth utilization and processing power, etc.
866 * It is a boolean value 0 - unsupported, 1 - supported.
867 * If it is supported,for VP9, suggested frame resolution can be retrieved from VACodedBufferVP9Status.
868 */
869 VAConfigAttribEncDynamicScaling = 30,
870 /**
871 * \brief frame size tolerance support
872 * it indicates the tolerance of frame size
873 */
874 VAConfigAttribFrameSizeToleranceSupport = 31,
875 /**
876 * \brief Encode function type for FEI.
877 *
878 * This attribute conveys whether the driver supports different function types for encode.
879 * It can be VA_FEI_FUNCTION_ENC, VA_FEI_FUNCTION_PAK, or VA_FEI_FUNCTION_ENC_PAK. Currently
880 * it is for FEI entry point only.
881 * Default is VA_FEI_FUNCTION_ENC_PAK.
882 */
883 VAConfigAttribFEIFunctionType = 32,
884 /**
885 * \brief Maximum number of FEI MV predictors. Read-only.
886 *
887 * This attribute determines the maximum number of MV predictors the driver
888 * can support to encode a single frame. 0 means no MV predictor is supported.
889 * Currently it is for FEI entry point only.
890 */
891 VAConfigAttribFEIMVPredictors = 33,
892 /**
893 * \brief Statistics attribute. Read-only.
894 *
895 * This attribute exposes a number of capabilities of the VAEntrypointStats entry
896 * point. The attribute value is partitioned into fields as defined in the
897 * VAConfigAttribValStats union. Currently it is for VAEntrypointStats only.
898 */
899 VAConfigAttribStats = 34,
900 /**
901 * \brief Tile Support Attribute. Read-only.
902 *
903 * This attribute conveys whether encoder is capable to support tiles.
904 * If not supported, the tile related parameters sent to encoder, such as
905 * tiling structure, should be ignored. 0 - unsupported, 1 - supported.
906 */
907 VAConfigAttribEncTileSupport = 35,
908 /**
909 * \brief whether accept rouding setting from application. Read-only.
910 * This attribute is for encode quality, if it is report,
911 * application can change the rounding setting by VAEncMiscParameterTypeCustomRoundingControl
912 */
913 VAConfigAttribCustomRoundingControl = 36,
914 /**
915 * \brief Encoding QP info block size attribute. Read-only.
916 * This attribute conveys the block sizes that underlying driver
917 * support for QP info for buffer #VAEncQpBuffer.
918 */
919 VAConfigAttribQPBlockSize = 37,
920 /**
921 * \brief encode max frame size attribute. Read-only
922 * attribute value \c VAConfigAttribValMaxFrameSize represent max frame size support
923 */
924 VAConfigAttribMaxFrameSize = 38,
925 /** \brief inter frame prediction directrion attribute. Read-only.
926 * this attribute conveys the prediction direction (backward or forword) for specific config
927 * the value could be VA_PREDICTION_DIRECTION_XXXX. it can be combined with VAConfigAttribEncMaxRefFrames
928 * to describe reference list , and the prediction direction. if this attrib is not present,both direction
929 * should be supported, no restriction.
930 * for example: normal HEVC encoding , maximum reference frame number in reflist 0 and reflist 1 is deduced
931 * by VAConfigAttribEncMaxRefFrames. so there are typical P frame, B frame,
932 * if VAConfigAttribPredictionDirection is also present. it will stipulate prediction direction in both
933 * reference list. if only one prediction direction present(such as PREVIOUS),all reference frame should be
934 * previous frame (PoC < current).
935 */
936 VAConfigAttribPredictionDirection = 39,
937 /** \brief combined submission of multiple frames from different streams, it is optimization for different HW
938 * implementation, multiple frames encode/decode can improve HW concurrency
939 */
940 VAConfigAttribMultipleFrame = 40,
941 /** \brief priority setting for the context. Read-Write
942 * attribute value is \c VAConfigAttribValContextPriority
943 * this setting also could be update by \c VAContextParameterUpdateBuffer
944 */
945 VAConfigAttribContextPriority = 41,
946 /** \brief AV1 decoding features. Read-only.
947 *
948 * This attribute describes the supported features of an
949 * AV1 decoder configuration. The value returned uses the
950 * VAConfigAttribValDecAV1Features type.
951 */
952 VAConfigAttribDecAV1Features = 42,
953 /** \brief TEE could be any HW secure device. Read-only */
954 VAConfigAttribTEEType = 43,
955 /** \brief TEE type client is a specific module supporting specific functions in TEE. Read-only*/
956 VAConfigAttribTEETypeClient = 44,
957 /**
958 * \brief Cipher algorithm of the protected content session.
959 *
960 * This attribute specifies the cipher algorithm of the protected content session. It
961 * could be \c VA_PC_CIPHER_AES, etc....
962 */
963 VAConfigAttribProtectedContentCipherAlgorithm = 45,
964 /**
965 * \brief Cipher block size of the protected content session.
966 *
967 * This attribute specifies the block size of the protected content session. It could be
968 * \c VA_PC_BLOCK_SIZE_128, \c VA_PC_BLOCK_SIZE_192, or \c VA_PC_BLOCK_SIZE_256, etc....
969 */
970 VAConfigAttribProtectedContentCipherBlockSize = 46,
971 /**
972 * \brief Cipher mode of the protected content session.
973 *
974 * This attribute specifies the cipher mode of the protected content session. It could
975 * be \c VA_PC_CIPHER_MODE_ECB, \c VA_PC_CIPHER_MODE_CBC, \c VA_PC_CIPHER_MODE_CTR, etc...
976 */
977 VAConfigAttribProtectedContentCipherMode = 47,
978 /**
979 * \brief Decryption sample type of the protected content session.
980 *
981 * This attribute specifies the decryption sample type of the protected content session.
982 * It could be \c VA_PC_SAMPLE_TYPE_FULLSAMPLE or \c VA_PC_SAMPLE_TYPE_SUBSAMPLE.
983 */
984 VAConfigAttribProtectedContentCipherSampleType = 48,
985 /**
986 * \brief Special usage attribute of the protected session.
987 *
988 * The attribute specifies the flow for the protected session could be used. For
989 * example, it could be \c VA_PC_USAGE_DEFAULT, \c VA_PC_USAGE_WIDEVINE, etc....
990 */
991 VAConfigAttribProtectedContentUsage = 49,
992
993 /** \brief HEVC/H.265 encoding features. Read-only.
994 *
995 * This attribute describes the supported features of an
996 * HEVC/H.265 encoder configuration. The value returned uses the
997 * VAConfigAttribValEncHEVCFeatures type.
998 *
999 * If this attribute is supported by a driver then it must also
1000 * support the VAConfigAttribEncHEVCBlockSizes attribute.
1001 */
1002 VAConfigAttribEncHEVCFeatures = 50,
1003 /** \brief HEVC/H.265 encoding block sizes. Read-only.
1004 *
1005 * This attribute describes the supported coding tree and transform
1006 * block sizes of an HEVC/H.265 encoder configuration. The value
1007 * returned uses the VAConfigAttribValEncHEVCBlockSizes type.
1008 *
1009 * If this attribute is supported by a driver then it must also
1010 * support the VAConfigAttribEncHEVCFeatures attribute.
1011 */
1012 VAConfigAttribEncHEVCBlockSizes = 51,
1013 /**
1014 * \brief AV1 encoding attribute. Read-only.
1015 *
1016 * This attribute exposes a number of capabilities of the underlying
1017 * AV1 implementation. The attribute value is partitioned into fields as defined in the
1018 * VAConfigAttribValEncAV1 union.
1019 */
1020 VAConfigAttribEncAV1 = 52,
1021 /**
1022 * \brief AV1 encoding attribute extend1. Read-only.
1023 *
1024 * This attribute exposes a number of capabilities of the underlying
1025 * AV1 implementation. The attribute value is partitioned into fields as defined in the
1026 * VAConfigAttribValEncAV1Ext1 union.
1027 */
1028 VAConfigAttribEncAV1Ext1 = 53,
1029 /**
1030 * \brief AV1 encoding attribute extend2. Read-only.
1031 *
1032 * This attribute exposes a number of capabilities of the underlying
1033 * AV1 implementation. The attribute value is partitioned into fields as defined in the
1034 * VAConfigAttribValEncAV1Ext2 union.
1035 */
1036 VAConfigAttribEncAV1Ext2 = 54,
1037 /** \brief Settings per block attribute for Encoding. Read-only.
1038 *
1039 * This attribute describes whether to support delta qp per block,
1040 * the supported size of delta qp block and the size of delta QP in bytes.
1041 * The value returned uses the VAConfigAttribValEncPerBlockControl type.
1042 */
1043 VAConfigAttribEncPerBlockControl = 55,
1044 /**
1045 * \brief Maximum number of tile rows. Read-only.
1046 *
1047 * This attribute determines the maximum number of tile
1048 * rows supported for encoding with tile support.
1049 */
1050 VAConfigAttribEncMaxTileRows = 56,
1051 /**
1052 * \brief Maximum number of tile cols. Read-only.
1053 *
1054 * This attribute determines the maximum number of tile
1055 * columns supported for encoding with tile support.
1056 */
1057 VAConfigAttribEncMaxTileCols = 57,
1058 /**
1059 * \brief VP9 encoding attribute. Read-only.
1060 *
1061 * This attribute exposes a number of capabilities of the underlying
1062 * VP9 implementation. The attribute value is partitioned into fields as defined in the
1063 * VAConfigAttribValEncVP9 union.
1064 */
1065 VAConfigAttribEncVP9 = 58,
1066 /**@}*/
1067 VAConfigAttribTypeMax
1068 } VAConfigAttribType;
1069
1070 /**
1071 * Configuration attributes
1072 * If there is more than one value for an attribute, a default
1073 * value will be assigned to the attribute if the client does not
1074 * specify the attribute when creating a configuration
1075 */
1076 typedef struct _VAConfigAttrib {
1077 VAConfigAttribType type;
1078 uint32_t value; /* OR'd flags (bits) for this attribute */
1079 } VAConfigAttrib;
1080
1081 /* Attribute values for VAConfigAttribRTFormat. */
1082
1083 #define VA_RT_FORMAT_YUV420 0x00000001 ///< YUV 4:2:0 8-bit.
1084 #define VA_RT_FORMAT_YUV422 0x00000002 ///< YUV 4:2:2 8-bit.
1085 #define VA_RT_FORMAT_YUV444 0x00000004 ///< YUV 4:4:4 8-bit.
1086 #define VA_RT_FORMAT_YUV411 0x00000008 ///< YUV 4:1:1 8-bit.
1087 #define VA_RT_FORMAT_YUV400 0x00000010 ///< Greyscale 8-bit.
1088 #define VA_RT_FORMAT_YUV420_10 0x00000100 ///< YUV 4:2:0 10-bit.
1089 #define VA_RT_FORMAT_YUV422_10 0x00000200 ///< YUV 4:2:2 10-bit.
1090 #define VA_RT_FORMAT_YUV444_10 0x00000400 ///< YUV 4:4:4 10-bit.
1091 #define VA_RT_FORMAT_YUV420_12 0x00001000 ///< YUV 4:2:0 12-bit.
1092 #define VA_RT_FORMAT_YUV422_12 0x00002000 ///< YUV 4:2:2 12-bit.
1093 #define VA_RT_FORMAT_YUV444_12 0x00004000 ///< YUV 4:4:4 12-bit.
1094
1095 #define VA_RT_FORMAT_RGB16 0x00010000 ///< Packed RGB, 16 bits per pixel.
1096 #define VA_RT_FORMAT_RGB32 0x00020000 ///< Packed RGB, 32 bits per pixel, 8 bits per colour sample.
1097 #define VA_RT_FORMAT_RGBP 0x00100000 ///< Planar RGB, 8 bits per sample.
1098 #define VA_RT_FORMAT_RGB32_10 0x00200000 ///< Packed RGB, 32 bits per pixel, 10 bits per colour sample.
1099
1100 #define VA_RT_FORMAT_PROTECTED 0x80000000
1101
1102 #define VA_RT_FORMAT_RGB32_10BPP VA_RT_FORMAT_RGB32_10 ///< @deprecated use VA_RT_FORMAT_RGB32_10 instead.
1103 #define VA_RT_FORMAT_YUV420_10BPP VA_RT_FORMAT_YUV420_10 ///< @deprecated use VA_RT_FORMAT_YUV420_10 instead.
1104
1105 /** @name Attribute values for VAConfigAttribRateControl */
1106 /**@{*/
1107 /** \brief Driver does not support any form of rate control. */
1108 #define VA_RC_NONE 0x00000001
1109 /** \brief Constant bitrate. */
1110 #define VA_RC_CBR 0x00000002
1111 /** \brief Variable bitrate. */
1112 #define VA_RC_VBR 0x00000004
1113 /** \brief Video conference mode. */
1114 #define VA_RC_VCM 0x00000008
1115 /** \brief Constant QP. */
1116 #define VA_RC_CQP 0x00000010
1117 /** \brief Variable bitrate with peak rate higher than average bitrate. */
1118 #define VA_RC_VBR_CONSTRAINED 0x00000020
1119 /** \brief Intelligent Constant Quality. Provided an initial ICQ_quality_factor,
1120 * adjusts QP at a frame and MB level based on motion to improve subjective quality. */
1121 #define VA_RC_ICQ 0x00000040
1122 /** \brief Macroblock based rate control. Per MB control is decided
1123 * internally in the encoder. It may be combined with other RC modes, except CQP. */
1124 #define VA_RC_MB 0x00000080
1125 /** \brief Constant Frame Size, it is used for small tolerent */
1126 #define VA_RC_CFS 0x00000100
1127 /** \brief Parallel BRC, for hierachical B.
1128 *
1129 * For hierachical B, B frames can be refered by other B frames.
1130 * Currently three layers of hierachy are defined:
1131 * B0 - regular B, no reference to other B frames.
1132 * B1 - reference to only I, P and regular B0 frames.
1133 * B2 - reference to any other frames, including B1.
1134 * In Hierachical B structure, B frames on the same layer can be processed
1135 * simultaneously. And BRC would adjust accordingly. This is so called
1136 * Parallel BRC. */
1137 #define VA_RC_PARALLEL 0x00000200
1138 /** \brief Quality defined VBR
1139 * Use Quality factor to determine the good enough QP for each MB such that
1140 * good enough quality can be obtained without waste of bits
1141 * for this BRC mode, you must set all legacy VBR parameters
1142 * and reuse quality_factor in \c VAEncMiscParameterRateControl
1143 * */
1144 #define VA_RC_QVBR 0x00000400
1145 /** \brief Average VBR
1146 * Average variable bitrate control algorithm focuses on overall encoding
1147 * quality while meeting the specified target bitrate, within the accuracy
1148 * range, after a convergence period.
1149 * bits_per_second in VAEncMiscParameterRateControl is target bitrate for AVBR.
1150 * Convergence is specified in the unit of frame.
1151 * window_size in VAEncMiscParameterRateControl is equal to convergence for AVBR.
1152 * Accuracy is in the range of [1,100], 1 means one percent, and so on.
1153 * target_percentage in VAEncMiscParameterRateControl is equal to accuracy for AVBR.
1154 * */
1155 #define VA_RC_AVBR 0x00000800
1156 /** \brief Transport Controlled BRC
1157 * Specific bitrate control for real time streaming.
1158 * TCBRC can instantly react to channel change to remove or significantly reduce the delay.
1159 * Application (transport) provides channel feedback to driver through TargetFrameSize.
1160 * When channel condition is very good (almost no constraint on instant frame size),
1161 * the app should set target frame size as zero. Otherwise, channel capacity divided by fps
1162 * should be used.
1163 * */
1164 #define VA_RC_TCBRC 0x00001000
1165
1166 /**@}*/
1167
1168 /** @name Attribute values for VAConfigAttribDecSliceMode */
1169 /**@{*/
1170 /** \brief Driver supports normal mode for slice decoding */
1171 #define VA_DEC_SLICE_MODE_NORMAL 0x00000001
1172 /** \brief Driver supports base mode for slice decoding */
1173 #define VA_DEC_SLICE_MODE_BASE 0x00000002
1174
1175 /** @name Attribute values for VAConfigAttribDecJPEG */
1176 /**@{*/
1177 typedef union _VAConfigAttribValDecJPEG {
1178 struct {
1179 /** \brief Set to (1 << VA_ROTATION_xxx) for supported rotation angles. */
1180 uint32_t rotation : 4;
1181 /** \brief set to 1 for crop and partial decode support, 0 if not supported */
1182 uint32_t crop : 1;
1183 /** \brief Reserved for future use. */
1184 uint32_t reserved : 27;
1185 } bits;
1186 uint32_t value;
1187 } VAConfigAttribValDecJPEG;
1188 /** @name Attribute values for VAConfigAttribDecProcessing */
1189 /**@{*/
1190 /** \brief No decoding + processing in a single decoding call. */
1191 #define VA_DEC_PROCESSING_NONE 0x00000000
1192 /** \brief Decode + processing in a single decoding call. */
1193 #define VA_DEC_PROCESSING 0x00000001
1194 /**@}*/
1195
1196 /** @name Attribute values for VAConfigAttribEncPackedHeaders */
1197 /**@{*/
1198 /** \brief Driver does not support any packed headers mode. */
1199 #define VA_ENC_PACKED_HEADER_NONE 0x00000000
1200 /**
1201 * \brief Driver supports packed sequence headers. e.g. SPS for H.264.
1202 *
1203 * Application must provide it to driver once this flag is returned through
1204 * vaGetConfigAttributes()
1205 */
1206 #define VA_ENC_PACKED_HEADER_SEQUENCE 0x00000001
1207 /**
1208 * \brief Driver supports packed picture headers. e.g. PPS for H.264.
1209 *
1210 * Application must provide it to driver once this falg is returned through
1211 * vaGetConfigAttributes()
1212 */
1213 #define VA_ENC_PACKED_HEADER_PICTURE 0x00000002
1214 /**
1215 * \brief Driver supports packed slice headers. e.g. slice_header() for H.264.
1216 *
1217 * Application must provide it to driver once this flag is returned through
1218 * vaGetConfigAttributes()
1219 */
1220 #define VA_ENC_PACKED_HEADER_SLICE 0x00000004
1221 /**
1222 * \brief Driver supports misc packed headers. e.g. SEI for H.264.
1223 *
1224 * @deprecated
1225 * This is a deprecated packed header flag, All applications can use
1226 * \c VA_ENC_PACKED_HEADER_RAW_DATA to pass the corresponding packed
1227 * header data buffer to the driver
1228 */
1229 #define VA_ENC_PACKED_HEADER_MISC 0x00000008
1230 /** \brief Driver supports raw packed header, see VAEncPackedHeaderRawData */
1231 #define VA_ENC_PACKED_HEADER_RAW_DATA 0x00000010
1232 /**@}*/
1233
1234 /** @name Attribute values for VAConfigAttribEncInterlaced */
1235 /**@{*/
1236 /** \brief Driver does not support interlaced coding. */
1237 #define VA_ENC_INTERLACED_NONE 0x00000000
1238 /** \brief Driver supports interlaced frame coding. */
1239 #define VA_ENC_INTERLACED_FRAME 0x00000001
1240 /** \brief Driver supports interlaced field coding. */
1241 #define VA_ENC_INTERLACED_FIELD 0x00000002
1242 /** \brief Driver supports macroblock adaptive frame field coding. */
1243 #define VA_ENC_INTERLACED_MBAFF 0x00000004
1244 /** \brief Driver supports picture adaptive frame field coding. */
1245 #define VA_ENC_INTERLACED_PAFF 0x00000008
1246 /**@}*/
1247
1248 /** @name Attribute values for VAConfigAttribEncSliceStructure */
1249 /**@{*/
1250 /** \brief Driver supports a power-of-two number of rows per slice. */
1251 #define VA_ENC_SLICE_STRUCTURE_POWER_OF_TWO_ROWS 0x00000001
1252 /** \brief Driver supports an arbitrary number of macroblocks per slice. */
1253 #define VA_ENC_SLICE_STRUCTURE_ARBITRARY_MACROBLOCKS 0x00000002
1254 /** \brief Driver support 1 row per slice */
1255 #define VA_ENC_SLICE_STRUCTURE_EQUAL_ROWS 0x00000004
1256 /** \brief Driver support max encoded slice size per slice */
1257 #define VA_ENC_SLICE_STRUCTURE_MAX_SLICE_SIZE 0x00000008
1258 /** \brief Driver supports an arbitrary number of rows per slice. */
1259 #define VA_ENC_SLICE_STRUCTURE_ARBITRARY_ROWS 0x00000010
1260 /** \brief Driver supports any number of rows per slice but they must be the same
1261 * for all slices except for the last one, which must be equal or smaller
1262 * to the previous slices. */
1263 #define VA_ENC_SLICE_STRUCTURE_EQUAL_MULTI_ROWS 0x00000020
1264 /**@}*/
1265
1266 /** \brief Attribute value for VAConfigAttribMaxFrameSize */
1267 typedef union _VAConfigAttribValMaxFrameSize {
1268 struct {
1269 /** \brief support max frame size
1270 * if max_frame_size == 1, VAEncMiscParameterTypeMaxFrameSize/VAEncMiscParameterBufferMaxFrameSize
1271 * could be used to set the frame size, if multiple_pass also equal 1, VAEncMiscParameterTypeMultiPassFrameSize
1272 * VAEncMiscParameterBufferMultiPassFrameSize could be used to set frame size and pass information
1273 */
1274 uint32_t max_frame_size : 1;
1275 /** \brief multiple_pass support */
1276 uint32_t multiple_pass : 1;
1277 /** \brief reserved bits for future, must be zero*/
1278 uint32_t reserved : 30;
1279 } bits;
1280 uint32_t value;
1281 } VAConfigAttribValMaxFrameSize;
1282
1283 /** \brief Attribute value for VAConfigAttribEncJPEG */
1284 typedef union _VAConfigAttribValEncJPEG {
1285 struct {
1286 /** \brief set to 1 for arithmatic coding. */
1287 uint32_t arithmatic_coding_mode : 1;
1288 /** \brief set to 1 for progressive dct. */
1289 uint32_t progressive_dct_mode : 1;
1290 /** \brief set to 1 for non-interleaved. */
1291 uint32_t non_interleaved_mode : 1;
1292 /** \brief set to 1 for differential. */
1293 uint32_t differential_mode : 1;
1294 uint32_t max_num_components : 3;
1295 uint32_t max_num_scans : 4;
1296 uint32_t max_num_huffman_tables : 3;
1297 uint32_t max_num_quantization_tables : 3;
1298 } bits;
1299 uint32_t value;
1300 } VAConfigAttribValEncJPEG;
1301
1302 /** @name Attribute values for VAConfigAttribEncQuantization */
1303 /**@{*/
1304 /** \brief Driver does not support special types of quantization */
1305 #define VA_ENC_QUANTIZATION_NONE 0x00000000
1306 /** \brief Driver supports trellis quantization */
1307 #define VA_ENC_QUANTIZATION_TRELLIS_SUPPORTED 0x00000001
1308 /**@}*/
1309
1310 /** @name Attribute values for VAConfigAttribPredictionDirection */
1311 /**@{*/
1312 /** \brief Driver support forward reference frame (inter frame for vpx, P frame for H26x MPEG)
1313 * can work with the VAConfigAttribEncMaxRefFrames. for example: low delay B frame of HEVC.
1314 * these value can be OR'd together. typical value should be VA_PREDICTION_DIRECTION_PREVIOUS
1315 * or VA_PREDICTION_DIRECTION_PREVIOUS | VA_PREDICTION_DIRECTION_FUTURE, theoretically, there
1316 * are no stream only include future reference frame.
1317 */
1318 #define VA_PREDICTION_DIRECTION_PREVIOUS 0x00000001
1319 /** \brief Driver support backward prediction frame/slice */
1320 #define VA_PREDICTION_DIRECTION_FUTURE 0x00000002
1321 /** \brief Dirver require both reference list must be not empty for inter frame */
1322 #define VA_PREDICTION_DIRECTION_BI_NOT_EMPTY 0x00000004
1323 /**@}*/
1324
1325 /** @name Attribute values for VAConfigAttribEncIntraRefresh */
1326 /**@{*/
1327 /** \brief Driver does not support intra refresh */
1328 #define VA_ENC_INTRA_REFRESH_NONE 0x00000000
1329 /** \brief Driver supports column based rolling intra refresh */
1330 #define VA_ENC_INTRA_REFRESH_ROLLING_COLUMN 0x00000001
1331 /** \brief Driver supports row based rolling intra refresh */
1332 #define VA_ENC_INTRA_REFRESH_ROLLING_ROW 0x00000002
1333 /** \brief Driver supports adaptive intra refresh */
1334 #define VA_ENC_INTRA_REFRESH_ADAPTIVE 0x00000010
1335 /** \brief Driver supports cyclic intra refresh */
1336 #define VA_ENC_INTRA_REFRESH_CYCLIC 0x00000020
1337 /** \brief Driver supports intra refresh of P frame*/
1338 #define VA_ENC_INTRA_REFRESH_P_FRAME 0x00010000
1339 /** \brief Driver supports intra refresh of B frame */
1340 #define VA_ENC_INTRA_REFRESH_B_FRAME 0x00020000
1341 /** \brief Driver supports intra refresh of multiple reference encoder */
1342 #define VA_ENC_INTRA_REFRESH_MULTI_REF 0x00040000
1343
1344 /**@}*/
1345
1346 /** \brief Attribute value for VAConfigAttribEncROI */
1347 typedef union _VAConfigAttribValEncROI {
1348 struct {
1349 /** \brief The number of ROI regions supported, 0 if ROI is not supported. */
1350 uint32_t num_roi_regions : 8;
1351 /**
1352 * \brief A flag indicates whether ROI priority is supported
1353 *
1354 * \ref roi_rc_priority_support equal to 1 specifies the underlying driver supports
1355 * ROI priority when VAConfigAttribRateControl != VA_RC_CQP, user can use \c roi_value
1356 * in #VAEncROI to set ROI priority. \ref roi_rc_priority_support equal to 0 specifies
1357 * the underlying driver doesn't support ROI priority.
1358 *
1359 * User should ignore \ref roi_rc_priority_support when VAConfigAttribRateControl == VA_RC_CQP
1360 * because ROI delta QP is always required when VAConfigAttribRateControl == VA_RC_CQP.
1361 */
1362 uint32_t roi_rc_priority_support : 1;
1363 /**
1364 * \brief A flag indicates whether ROI delta QP is supported
1365 *
1366 * \ref roi_rc_qp_delta_support equal to 1 specifies the underlying driver supports
1367 * ROI delta QP when VAConfigAttribRateControl != VA_RC_CQP, user can use \c roi_value
1368 * in #VAEncROI to set ROI delta QP. \ref roi_rc_qp_delta_support equal to 0 specifies
1369 * the underlying driver doesn't support ROI delta QP.
1370 *
1371 * User should ignore \ref roi_rc_qp_delta_support when VAConfigAttribRateControl == VA_RC_CQP
1372 * because ROI delta QP is always required when VAConfigAttribRateControl == VA_RC_CQP.
1373 */
1374 uint32_t roi_rc_qp_delta_support : 1;
1375 uint32_t reserved : 22;
1376 } bits;
1377 uint32_t value;
1378 } VAConfigAttribValEncROI;
1379
1380 /** \brief Attribute value for VAConfigAttribEncRateControlExt */
1381 typedef union _VAConfigAttribValEncRateControlExt {
1382 struct {
1383 /**
1384 * \brief The maximum number of temporal layers minus 1
1385 *
1386 * \ref max_num_temporal_layers_minus1 plus 1 specifies the maximum number of temporal
1387 * layers that supported by the underlying driver. \ref max_num_temporal_layers_minus1
1388 * equal to 0 implies the underlying driver doesn't support encoding with temporal layer.
1389 */
1390 uint32_t max_num_temporal_layers_minus1 : 8;
1391
1392 /**
1393 * /brief support temporal layer bit-rate control flag
1394 *
1395 * \ref temporal_layer_bitrate_control_flag equal to 1 specifies the underlying driver
1396 * can support bit-rate control per temporal layer when (#VAConfigAttribRateControl == #VA_RC_CBR ||
1397 * #VAConfigAttribRateControl == #VA_RC_VBR).
1398 *
1399 * The underlying driver must set \ref temporal_layer_bitrate_control_flag to 0 when
1400 * \c max_num_temporal_layers_minus1 is equal to 0
1401 *
1402 * To use bit-rate control per temporal layer, an application must send the right layer
1403 * structure via #VAEncMiscParameterTemporalLayerStructure at the beginning of a coded sequence
1404 * and then followed by #VAEncMiscParameterRateControl and #VAEncMiscParameterFrameRate structures
1405 * for each layer, using the \c temporal_id field as the layer identifier. Otherwise
1406 * the driver doesn't use bitrate control per temporal layer if an application doesn't send the
1407 * layer structure via #VAEncMiscParameterTemporalLayerStructure to the driver. The driver returns
1408 * VA_STATUS_ERROR_INVALID_PARAMETER if an application sends a wrong layer structure or doesn't send
1409 * #VAEncMiscParameterRateControl and #VAEncMiscParameterFrameRate for each layer.
1410 *
1411 * The driver will ignore #VAEncMiscParameterTemporalLayerStructure and the \c temporal_id field
1412 * in #VAEncMiscParameterRateControl and #VAEncMiscParameterFrameRate if
1413 * \ref temporal_layer_bitrate_control_flag is equal to 0 or #VAConfigAttribRateControl == #VA_RC_CQP
1414 */
1415 uint32_t temporal_layer_bitrate_control_flag : 1;
1416 uint32_t reserved : 23;
1417 } bits;
1418 uint32_t value;
1419 } VAConfigAttribValEncRateControlExt;
1420
1421 /** \brief Attribute value for VAConfigAttribMultipleFrame*/
1422 typedef union _VAConfigAttribValMultipleFrame {
1423 struct {
1424 /** \brief max num of concurrent frames from different stream */
1425 uint32_t max_num_concurrent_frames : 8;
1426 /** \brief indicate whether all stream must support same quality level
1427 * if mixed_quality_level == 0, same quality level setting for multple streams is required
1428 * if mixed_quality_level == 1, different stream can have different quality level*/
1429 uint32_t mixed_quality_level : 1;
1430 /** \brief reserved bit for future, must be zero */
1431 uint32_t reserved : 23;
1432 } bits;
1433 uint32_t value;
1434 } VAConfigAttribValMultipleFrame;
1435
1436 /** brief Attribute value VAConfigAttribValContextPriority */
1437 typedef union _VAConfigAttribValContextPriority {
1438 struct {
1439 /** \brief the priority , for the Query operation (read) it represents highest priority
1440 * for the set operation (write), value should be [0~highest priority] , 0 is lowest priority*/
1441 uint32_t priority : 16;
1442 /** \brief reserved bits for future, must be zero*/
1443 uint32_t reserved : 16;
1444 } bits;
1445 uint32_t value;
1446 } VAConfigAttribValContextPriority;
1447
1448 /** brief Attribute value VAConfigAttribEncPerBlockControl */
1449 typedef union _VAConfigAttribValEncPerBlockControl {
1450 struct {
1451 /** \brief whether to support dela qp per block */
1452 uint32_t delta_qp_support : 1;
1453 /** \brief supported size of delta qp block */
1454 uint32_t log2_delta_qp_block_size : 4;
1455 /** \brief size of delta qp per block in bytes*/
1456 uint32_t delta_qp_size_in_bytes : 3;
1457 /** \brief reserved bit for future, must be zero */
1458 uint32_t reserved : 24;
1459 } bits;
1460 uint32_t value;
1461 } VAConfigAttribValEncPerBlockControl;
1462
1463 /** @name Attribute values for VAConfigAttribProtectedContentCipherAlgorithm */
1464 /** \brief AES cipher */
1465 #define VA_PC_CIPHER_AES 0x00000001
1466
1467 /** @name Attribute values for VAConfigAttribProtectedContentCipherBlockSize */
1468 /** \brief 128 bits block size */
1469 #define VA_PC_BLOCK_SIZE_128 0x00000001
1470 /** \brief 192 bits block size */
1471 #define VA_PC_BLOCK_SIZE_192 0x00000002
1472 /** \brief 256 bits block size */
1473 #define VA_PC_BLOCK_SIZE_256 0x00000004
1474
1475 /** @name Attribute values for VAConfigAttribProtectedContentCipherMode */
1476 /** \brief AES ECB */
1477 #define VA_PC_CIPHER_MODE_ECB 0x00000001
1478 /** \brief AES CBC */
1479 #define VA_PC_CIPHER_MODE_CBC 0x00000002
1480 /** \brief AES CTR */
1481 #define VA_PC_CIPHER_MODE_CTR 0x00000004
1482
1483 /** @name Attribute values for VAConfigAttribProtectedContentCipherSampleType */
1484 /** \brief Full sample */
1485 #define VA_PC_SAMPLE_TYPE_FULLSAMPLE 0x00000001
1486 /** \brief Sub sample */
1487 #define VA_PC_SAMPLE_TYPE_SUBSAMPLE 0x00000002
1488
1489 /** @name Attribute values for VAConfigAttribProtectedContentUsage */
1490 /** \brief Default usage */
1491 #define VA_PC_USAGE_DEFAULT 0x00000000
1492 /** \brief Widevine */
1493 #define VA_PC_USAGE_WIDEVINE 0x00000001
1494
1495 /** @name Attribute values for VAConfigAttribProcessingRate. */
1496 /**@{*/
1497 /** \brief Driver does not support processing rate report */
1498 #define VA_PROCESSING_RATE_NONE 0x00000000
1499 /** \brief Driver supports encode processing rate report */
1500 #define VA_PROCESSING_RATE_ENCODE 0x00000001
1501 /** \brief Driver supports decode processing rate report */
1502 #define VA_PROCESSING_RATE_DECODE 0x00000002
1503 /**@}*/
1504
1505 /** @name segment ID map block size */
1506 /**@{*/
1507 /** \brief each segmentID represent a 16x16 block */
1508 #define VA_SEGID_BLOCK_16X16 0
1509 /** \brief each segmentID represent a 32x32 block */
1510 #define VA_SEGID_BLOCK_32X32 1
1511 /** \brief each segmentID represent a 64x64 block */
1512 #define VA_SEGID_BLOCK_64X64 2
1513 /** \brief each segmentID represent a 8x8 block */
1514 #define VA_SEGID_BLOCK_8X8 3
1515 /**@}*/
1516
1517 /**
1518 * if an attribute is not applicable for a given
1519 * profile/entrypoint pair, then set the value to the following
1520 */
1521 #define VA_ATTRIB_NOT_SUPPORTED 0x80000000
1522
1523 /** Get maximum number of profiles supported by the implementation */
1524 int vaMaxNumProfiles(
1525 VADisplay dpy
1526 );
1527
1528 /** Get maximum number of entrypoints supported by the implementation */
1529 int vaMaxNumEntrypoints(
1530 VADisplay dpy
1531 );
1532
1533 /** Get maximum number of attributs supported by the implementation */
1534 int vaMaxNumConfigAttributes(
1535 VADisplay dpy
1536 );
1537
1538 /**
1539 * Query supported profiles
1540 * The caller must provide a "profile_list" array that can hold at
1541 * least vaMaxNumProfile() entries. The actual number of profiles
1542 * returned in "profile_list" is returned in "num_profile".
1543 */
1544 VAStatus vaQueryConfigProfiles(
1545 VADisplay dpy,
1546 VAProfile *profile_list, /* out */
1547 int *num_profiles /* out */
1548 );
1549
1550 /**
1551 * Query supported entrypoints for a given profile
1552 * The caller must provide an "entrypoint_list" array that can hold at
1553 * least vaMaxNumEntrypoints() entries. The actual number of entrypoints
1554 * returned in "entrypoint_list" is returned in "num_entrypoints".
1555 */
1556 VAStatus vaQueryConfigEntrypoints(
1557 VADisplay dpy,
1558 VAProfile profile,
1559 VAEntrypoint *entrypoint_list, /* out */
1560 int *num_entrypoints /* out */
1561 );
1562
1563 /**
1564 * Get attributes for a given profile/entrypoint pair
1565 * The caller must provide an "attrib_list" with all attributes to be
1566 * retrieved. Upon return, the attributes in "attrib_list" have been
1567 * updated with their value. Unknown attributes or attributes that are
1568 * not supported for the given profile/entrypoint pair will have their
1569 * value set to VA_ATTRIB_NOT_SUPPORTED
1570 */
1571 VAStatus vaGetConfigAttributes(
1572 VADisplay dpy,
1573 VAProfile profile,
1574 VAEntrypoint entrypoint,
1575 VAConfigAttrib *attrib_list, /* in/out */
1576 int num_attribs
1577 );
1578
1579 /** Generic ID type, can be re-typed for specific implementation */
1580 typedef unsigned int VAGenericID;
1581
1582 typedef VAGenericID VAConfigID;
1583
1584 /**
1585 * Create a configuration for the video decode/encode/processing pipeline
1586 * it passes in the attribute list that specifies the attributes it cares
1587 * about, with the rest taking default values.
1588 */
1589 VAStatus vaCreateConfig(
1590 VADisplay dpy,
1591 VAProfile profile,
1592 VAEntrypoint entrypoint,
1593 VAConfigAttrib *attrib_list,
1594 int num_attribs,
1595 VAConfigID *config_id /* out */
1596 );
1597
1598 /**
1599 * Free resources associdated with a given config
1600 */
1601 VAStatus vaDestroyConfig(
1602 VADisplay dpy,
1603 VAConfigID config_id
1604 );
1605
1606 /**
1607 * Query all attributes for a given configuration
1608 * The profile of the configuration is returned in "profile"
1609 * The entrypoint of the configuration is returned in "entrypoint"
1610 * The caller must provide an "attrib_list" array that can hold at least
1611 * vaMaxNumConfigAttributes() entries. The actual number of attributes
1612 * returned in "attrib_list" is returned in "num_attribs"
1613 */
1614 VAStatus vaQueryConfigAttributes(
1615 VADisplay dpy,
1616 VAConfigID config_id,
1617 VAProfile *profile, /* out */
1618 VAEntrypoint *entrypoint, /* out */
1619 VAConfigAttrib *attrib_list,/* out */
1620 int *num_attribs /* out */
1621 );
1622
1623
1624 /**
1625 * Contexts and Surfaces
1626 *
1627 * Context represents a "virtual" video decode, encode or video processing
1628 * pipeline. Surfaces are render targets for a given context. The data in the
1629 * surfaces are not accessible to the client except if derived image is supported
1630 * and the internal data format of the surface is implementation specific.
1631 *
1632 * Surfaces are provided as a hint of what surfaces will be used when the context
1633 * is created through vaCreateContext(). A surface may be used by different contexts
1634 * at the same time as soon as application can make sure the operations are synchronized
1635 * between different contexts, e.g. a surface is used as the output of a decode context
1636 * and the input of a video process context. Surfaces can only be destroyed after all
1637 * contexts using these surfaces have been destroyed.
1638 *
1639 * Both contexts and surfaces are identified by unique IDs and its
1640 * implementation specific internals are kept opaque to the clients
1641 */
1642
1643 typedef VAGenericID VAContextID;
1644
1645 typedef VAGenericID VASurfaceID;
1646
1647 #define VA_INVALID_ID 0xffffffff
1648 #define VA_INVALID_SURFACE VA_INVALID_ID
1649
1650 /** \brief Generic value types. */
1651 typedef enum {
1652 VAGenericValueTypeInteger = 1, /**< 32-bit signed integer. */
1653 VAGenericValueTypeFloat, /**< 32-bit floating-point value. */
1654 VAGenericValueTypePointer, /**< Generic pointer type */
1655 VAGenericValueTypeFunc /**< Pointer to function */
1656 } VAGenericValueType;
1657
1658 /** \brief Generic function type. */
1659 typedef void (*VAGenericFunc)(void);
1660
1661 /** \brief Generic value. */
1662 typedef struct _VAGenericValue {
1663 /** \brief Value type. See #VAGenericValueType. */
1664 VAGenericValueType type;
1665 /** \brief Value holder. */
1666 union {
1667 /** \brief 32-bit signed integer. */
1668 int32_t i;
1669 /** \brief 32-bit float. */
1670 float f;
1671 /** \brief Generic pointer. */
1672 void *p;
1673 /** \brief Pointer to function. */
1674 VAGenericFunc fn;
1675 } value;
1676 } VAGenericValue;
1677
1678 /** @name Surface attribute flags */
1679 /**@{*/
1680 /** \brief Surface attribute is not supported. */
1681 #define VA_SURFACE_ATTRIB_NOT_SUPPORTED 0x00000000
1682 /** \brief Surface attribute can be got through vaQuerySurfaceAttributes(). */
1683 #define VA_SURFACE_ATTRIB_GETTABLE 0x00000001
1684 /** \brief Surface attribute can be set through vaCreateSurfaces(). */
1685 #define VA_SURFACE_ATTRIB_SETTABLE 0x00000002
1686 /**@}*/
1687
1688 /** \brief Surface attribute types. */
1689 typedef enum {
1690 VASurfaceAttribNone = 0,
1691 /**
1692 * \brief Pixel format as a FOURCC (int, read/write).
1693 *
1694 * When vaQuerySurfaceAttributes() is called, the driver will return one
1695 * PixelFormat attribute per supported pixel format.
1696 *
1697 * When provided as an input to vaCreateSurfaces(), the driver will
1698 * allocate a surface with the provided pixel format.
1699 */
1700 VASurfaceAttribPixelFormat,
1701 /** \brief Minimal width in pixels (int, read-only). */
1702 VASurfaceAttribMinWidth,
1703 /** \brief Maximal width in pixels (int, read-only). */
1704 VASurfaceAttribMaxWidth,
1705 /** \brief Minimal height in pixels (int, read-only). */
1706 VASurfaceAttribMinHeight,
1707 /** \brief Maximal height in pixels (int, read-only). */
1708 VASurfaceAttribMaxHeight,
1709 /** \brief Surface memory type expressed in bit fields (int, read/write). */
1710 VASurfaceAttribMemoryType,
1711 /** \brief External buffer descriptor (pointer, write).
1712 *
1713 * Refer to the documentation for the memory type being created to
1714 * determine what descriptor structure to pass here. If not otherwise
1715 * stated, the common VASurfaceAttribExternalBuffers should be used.
1716 */
1717 VASurfaceAttribExternalBufferDescriptor,
1718 /** \brief Surface usage hint, gives the driver a hint of intended usage
1719 * to optimize allocation (e.g. tiling) (int, read/write). */
1720 VASurfaceAttribUsageHint,
1721 /** \brief List of possible DRM format modifiers (pointer, write).
1722 *
1723 * The value must be a pointer to a VADRMFormatModifierList. This can only
1724 * be used when allocating a new buffer, it's invalid to use this attribute
1725 * when importing an existing buffer.
1726 */
1727 VASurfaceAttribDRMFormatModifiers,
1728 /** \brief width and height log2 aligment in pixels (int, read-only)
1729 *
1730 * For special HW requirement used in some codecs, if
1731 * VASurfaceAttribAlignmentSize is not implemented in the driver, then
1732 * the surface_width and surface_height should keep the original logic
1733 * without any modification, this is an add-on requirement to
1734 * surface_width and surface_height.
1735 */
1736 VASurfaceAttribAlignmentSize,
1737 /** \brief Number of surface attributes. */
1738 VASurfaceAttribCount
1739 } VASurfaceAttribType;
1740
1741 /** \brief Surface attribute. */
1742 typedef struct _VASurfaceAttrib {
1743 /** \brief Type. */
1744 VASurfaceAttribType type;
1745 /** \brief Flags. See "Surface attribute flags". */
1746 uint32_t flags;
1747 /** \brief Value. See "Surface attribute types" for the expected types. */
1748 VAGenericValue value;
1749 } VASurfaceAttrib;
1750
1751 /**
1752 * @name VASurfaceAttribMemoryType values in bit fields.
1753 * Bits 0:7 are reserved for generic types. Bits 31:28 are reserved for
1754 * Linux DRM. Bits 23:20 are reserved for Android. Bits 19:16 are reserved for Win32.
1755 * DRM, Android and Win32 specific types are defined in respective va_*.h header files.
1756 */
1757 /**@{*/
1758 /** \brief VA memory type (default) is supported. */
1759 #define VA_SURFACE_ATTRIB_MEM_TYPE_VA 0x00000001
1760 /** \brief V4L2 buffer memory type is supported. */
1761 #define VA_SURFACE_ATTRIB_MEM_TYPE_V4L2 0x00000002
1762 /** \brief User pointer memory type is supported. */
1763 #define VA_SURFACE_ATTRIB_MEM_TYPE_USER_PTR 0x00000004
1764 /**@}*/
1765 /**
1766 * \brief VASurfaceAttribAlignmentStruct structure for
1767 * the VASurfaceAttribAlignmentSize attribute.
1768 */
1769 typedef union _VASurfaceAttribAlignmentStruct {
1770 struct {
1771 /** \brief log2 width aligment */
1772 uint32_t log2_width_alignment : 4;
1773 /** \brief log2 height aligment */
1774 uint32_t log2_height_alignment : 4;
1775 uint32_t reserved : 24;
1776 } bits;
1777 uint32_t value;
1778 } VASurfaceAttribAlignmentStruct;
1779
1780 /**
1781 * \brief VASurfaceAttribExternalBuffers structure for
1782 * the VASurfaceAttribExternalBufferDescriptor attribute.
1783 */
1784 typedef struct _VASurfaceAttribExternalBuffers {
1785 /** \brief pixel format in fourcc. */
1786 uint32_t pixel_format;
1787 /** \brief width in pixels. */
1788 uint32_t width;
1789 /** \brief height in pixels. */
1790 uint32_t height;
1791 /** \brief total size of the buffer in bytes. */
1792 uint32_t data_size;
1793 /** \brief number of planes for planar layout */
1794 uint32_t num_planes;
1795 /** \brief pitch for each plane in bytes */
1796 uint32_t pitches[4];
1797 /** \brief offset for each plane in bytes */
1798 uint32_t offsets[4];
1799 /** \brief buffer handles or user pointers */
1800 uintptr_t *buffers;
1801 /** \brief number of elements in the "buffers" array */
1802 uint32_t num_buffers;
1803 /** \brief flags. See "Surface external buffer descriptor flags". */
1804 uint32_t flags;
1805 /** \brief reserved for passing private data */
1806 void *private_data;
1807 } VASurfaceAttribExternalBuffers;
1808
1809 /** @name VASurfaceAttribExternalBuffers flags */
1810 /**@{*/
1811 /** \brief Enable memory tiling */
1812 #define VA_SURFACE_EXTBUF_DESC_ENABLE_TILING 0x00000001
1813 /** \brief Memory is cacheable */
1814 #define VA_SURFACE_EXTBUF_DESC_CACHED 0x00000002
1815 /** \brief Memory is non-cacheable */
1816 #define VA_SURFACE_EXTBUF_DESC_UNCACHED 0x00000004
1817 /** \brief Memory is write-combined */
1818 #define VA_SURFACE_EXTBUF_DESC_WC 0x00000008
1819 /** \brief Memory is protected */
1820 #define VA_SURFACE_EXTBUF_DESC_PROTECTED 0x80000000
1821
1822 /** @name VASurfaceAttribUsageHint attribute usage hint flags */
1823 /**@{*/
1824 /** \brief Surface usage not indicated. */
1825 #define VA_SURFACE_ATTRIB_USAGE_HINT_GENERIC 0x00000000
1826 /** \brief Surface used by video decoder. */
1827 #define VA_SURFACE_ATTRIB_USAGE_HINT_DECODER 0x00000001
1828 /** \brief Surface used by video encoder. */
1829 #define VA_SURFACE_ATTRIB_USAGE_HINT_ENCODER 0x00000002
1830 /** \brief Surface read by video post-processing. */
1831 #define VA_SURFACE_ATTRIB_USAGE_HINT_VPP_READ 0x00000004
1832 /** \brief Surface written by video post-processing. */
1833 #define VA_SURFACE_ATTRIB_USAGE_HINT_VPP_WRITE 0x00000008
1834 /** \brief Surface used for display. */
1835 #define VA_SURFACE_ATTRIB_USAGE_HINT_DISPLAY 0x00000010
1836 /** \brief Surface used for export to third-party APIs, e.g. via
1837 * vaExportSurfaceHandle(). */
1838 #define VA_SURFACE_ATTRIB_USAGE_HINT_EXPORT 0x00000020
1839
1840 /**@}*/
1841
1842 /**
1843 * \brief Queries surface attributes for the supplied config.
1844 *
1845 * This function queries for all supported attributes for the
1846 * supplied VA \c config. In particular, if the underlying hardware
1847 * supports the creation of VA surfaces in various formats, then
1848 * this function will enumerate all pixel formats that are supported.
1849 *
1850 * The \c attrib_list array is allocated by the user and \c
1851 * num_attribs shall be initialized to the number of allocated
1852 * elements in that array. Upon successful return, the actual number
1853 * of attributes will be overwritten into \c num_attribs. Otherwise,
1854 * \c VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned and \c num_attribs
1855 * is adjusted to the number of elements that would be returned if
1856 * enough space was available.
1857 *
1858 * Note: it is perfectly valid to pass NULL to the \c attrib_list
1859 * argument when vaQuerySurfaceAttributes() is used to determine the
1860 * actual number of elements that need to be allocated.
1861 *
1862 * @param[in] dpy the VA display
1863 * @param[in] config the config identifying a codec or a video
1864 * processing pipeline
1865 * @param[out] attrib_list the output array of #VASurfaceAttrib elements
1866 * @param[in,out] num_attribs the number of elements allocated on
1867 * input, the number of elements actually filled in output
1868 */
1869 VAStatus
1870 vaQuerySurfaceAttributes(
1871 VADisplay dpy,
1872 VAConfigID config,
1873 VASurfaceAttrib *attrib_list,
1874 unsigned int *num_attribs
1875 );
1876
1877 /**
1878 * \brief Creates an array of surfaces
1879 *
1880 * Creates an array of surfaces. The optional list of attributes shall
1881 * be constructed based on what the underlying hardware could expose
1882 * through vaQuerySurfaceAttributes().
1883 *
1884 * @param[in] dpy the VA display
1885 * @param[in] format the desired surface format. See \c VA_RT_FORMAT_*
1886 * @param[in] width the surface width
1887 * @param[in] height the surface height
1888 * @param[out] surfaces the array of newly created surfaces
1889 * @param[in] num_surfaces the number of surfaces to create
1890 * @param[in] attrib_list the list of (optional) attributes, or \c NULL
1891 * @param[in] num_attribs the number of attributes supplied in
1892 * \c attrib_list, or zero
1893 */
1894 VAStatus
1895 vaCreateSurfaces(
1896 VADisplay dpy,
1897 unsigned int format,
1898 unsigned int width,
1899 unsigned int height,
1900 VASurfaceID *surfaces,
1901 unsigned int num_surfaces,
1902 VASurfaceAttrib *attrib_list,
1903 unsigned int num_attribs
1904 );
1905
1906 /**
1907 * vaDestroySurfaces - Destroy resources associated with surfaces.
1908 * Surfaces can only be destroyed after all contexts using these surfaces have been
1909 * destroyed.
1910 * dpy: display
1911 * surfaces: array of surfaces to destroy
1912 * num_surfaces: number of surfaces in the array to be destroyed.
1913 */
1914 VAStatus vaDestroySurfaces(
1915 VADisplay dpy,
1916 VASurfaceID *surfaces,
1917 int num_surfaces
1918 );
1919
1920 #define VA_PROGRESSIVE 0x1
1921 /**
1922 * vaCreateContext - Create a context
1923 * dpy: display
1924 * config_id: configuration for the context
1925 * picture_width: coded picture width
1926 * picture_height: coded picture height
1927 * flag: any combination of the following:
1928 * VA_PROGRESSIVE (only progressive frame pictures in the sequence when set)
1929 * render_targets: a hint for render targets (surfaces) tied to the context
1930 * num_render_targets: number of render targets in the above array
1931 * context: created context id upon return
1932 */
1933 VAStatus vaCreateContext(
1934 VADisplay dpy,
1935 VAConfigID config_id,
1936 int picture_width,
1937 int picture_height,
1938 int flag,
1939 VASurfaceID *render_targets,
1940 int num_render_targets,
1941 VAContextID *context /* out */
1942 );
1943
1944 /**
1945 * vaDestroyContext - Destroy a context
1946 * dpy: display
1947 * context: context to be destroyed
1948 */
1949 VAStatus vaDestroyContext(
1950 VADisplay dpy,
1951 VAContextID context
1952 );
1953
1954 //Multi-frame context
1955 typedef VAGenericID VAMFContextID;
1956 /**
1957 * vaCreateMFContext - Create a multi-frame context
1958 * interface encapsulating common for all streams memory objects and structures
1959 * required for single GPU task submission from several VAContextID's.
1960 * Allocation: This call only creates an instance, doesn't allocate any additional memory.
1961 * Support identification: Application can identify multi-frame feature support by ability
1962 * to create multi-frame context. If driver supports multi-frame - call successful,
1963 * mf_context != NULL and VAStatus = VA_STATUS_SUCCESS, otherwise if multi-frame processing
1964 * not supported driver returns VA_STATUS_ERROR_UNIMPLEMENTED and mf_context = NULL.
1965 * return values:
1966 * VA_STATUS_SUCCESS - operation successful.
1967 * VA_STATUS_ERROR_UNIMPLEMENTED - no support for multi-frame.
1968 * dpy: display adapter.
1969 * mf_context: Multi-Frame context encapsulating all associated context
1970 * for multi-frame submission.
1971 */
1972 VAStatus vaCreateMFContext(
1973 VADisplay dpy,
1974 VAMFContextID *mf_context /* out */
1975 );
1976
1977 /**
1978 * vaMFAddContext - Provide ability to associate each context used for
1979 * Multi-Frame submission and common Multi-Frame context.
1980 * Try to add context to understand if it is supported.
1981 * Allocation: this call allocates and/or reallocates all memory objects
1982 * common for all contexts associated with particular Multi-Frame context.
1983 * All memory required for each context(pixel buffers, internal driver
1984 * buffers required for processing) allocated during standard vaCreateContext call for each context.
1985 * Runtime dependency - if current implementation doesn't allow to run different entry points/profile,
1986 * first context added will set entry point/profile for whole Multi-Frame context,
1987 * all other entry points and profiles can be rejected to be added.
1988 * Return values:
1989 * VA_STATUS_SUCCESS - operation successful, context was added.
1990 * VA_STATUS_ERROR_OPERATION_FAILED - something unexpected happened - application have to close
1991 * current mf_context and associated contexts and start working with new ones.
1992 * VA_STATUS_ERROR_INVALID_CONTEXT - ContextID is invalid, means:
1993 * 1 - mf_context is not valid context or
1994 * 2 - driver can't suport different VAEntrypoint or VAProfile simultaneosly
1995 * and current context contradicts with previously added, application can continue with current mf_context
1996 * and other contexts passed this call, rejected context can continue work in stand-alone
1997 * mode or other mf_context.
1998 * VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT - particular context being added was created with with
1999 * unsupported VAEntrypoint. Application can continue with current mf_context
2000 * and other contexts passed this call, rejected context can continue work in stand-alone
2001 * mode.
2002 * VA_STATUS_ERROR_UNSUPPORTED_PROFILE - Current context with Particular VAEntrypoint is supported
2003 * but VAProfile is not supported. Application can continue with current mf_context
2004 * and other contexts passed this call, rejected context can continue work in stand-alone
2005 * mode.
2006 * dpy: display adapter.
2007 * context: context being associated with Multi-Frame context.
2008 * mf_context: - multi-frame context used to associate contexts for multi-frame submission.
2009 */
2010 VAStatus vaMFAddContext(
2011 VADisplay dpy,
2012 VAMFContextID mf_context,
2013 VAContextID context
2014 );
2015
2016 /**
2017 * vaMFReleaseContext - Removes context from multi-frame and
2018 * association with multi-frame context.
2019 * After association removed vaEndPicture will submit tasks, but not vaMFSubmit.
2020 * Return values:
2021 * VA_STATUS_SUCCESS - operation successful, context was removed.
2022 * VA_STATUS_ERROR_OPERATION_FAILED - something unexpected happened.
2023 * application need to destroy this VAMFContextID and all assotiated VAContextID
2024 * dpy: display
2025 * mf_context: VAMFContextID where context is added
2026 * context: VAContextID to be added
2027 */
2028 VAStatus vaMFReleaseContext(
2029 VADisplay dpy,
2030 VAMFContextID mf_context,
2031 VAContextID context
2032 );
2033
2034 /**
2035 * Buffers
2036 * Buffers are used to pass various types of data from the
2037 * client to the server. The server maintains a data store
2038 * for each buffer created, and the client idenfies a buffer
2039 * through a unique buffer id assigned by the server.
2040 */
2041
2042 typedef VAGenericID VABufferID;
2043
2044 typedef enum {
2045 VAPictureParameterBufferType = 0,
2046 VAIQMatrixBufferType = 1,
2047 VABitPlaneBufferType = 2,
2048 VASliceGroupMapBufferType = 3,
2049 VASliceParameterBufferType = 4,
2050 VASliceDataBufferType = 5,
2051 VAMacroblockParameterBufferType = 6,
2052 VAResidualDataBufferType = 7,
2053 VADeblockingParameterBufferType = 8,
2054 VAImageBufferType = 9,
2055 VAProtectedSliceDataBufferType = 10,
2056 VAQMatrixBufferType = 11,
2057 VAHuffmanTableBufferType = 12,
2058 VAProbabilityBufferType = 13,
2059
2060 /* Following are encode buffer types */
2061 VAEncCodedBufferType = 21,
2062 VAEncSequenceParameterBufferType = 22,
2063 VAEncPictureParameterBufferType = 23,
2064 VAEncSliceParameterBufferType = 24,
2065 VAEncPackedHeaderParameterBufferType = 25,
2066 VAEncPackedHeaderDataBufferType = 26,
2067 VAEncMiscParameterBufferType = 27,
2068 VAEncMacroblockParameterBufferType = 28,
2069 VAEncMacroblockMapBufferType = 29,
2070
2071 /**
2072 * \brief Encoding QP buffer
2073 *
2074 * This buffer contains QP per MB for encoding. Currently
2075 * VAEncQPBufferH264 is defined for H.264 encoding, see
2076 * #VAEncQPBufferH264 for details
2077 */
2078 VAEncQPBufferType = 30,
2079 /* Following are video processing buffer types */
2080 /**
2081 * \brief Video processing pipeline parameter buffer.
2082 *
2083 * This buffer describes the video processing pipeline. See
2084 * #VAProcPipelineParameterBuffer for details.
2085 */
2086 VAProcPipelineParameterBufferType = 41,
2087 /**
2088 * \brief Video filter parameter buffer.
2089 *
2090 * This buffer describes the video filter parameters. All buffers
2091 * inherit from #VAProcFilterParameterBufferBase, thus including
2092 * a unique filter buffer type.
2093 *
2094 * The default buffer used by most filters is #VAProcFilterParameterBuffer.
2095 * Filters requiring advanced parameters include, but are not limited to,
2096 * deinterlacing (#VAProcFilterParameterBufferDeinterlacing),
2097 * color balance (#VAProcFilterParameterBufferColorBalance), etc.
2098 */
2099 VAProcFilterParameterBufferType = 42,
2100 /**
2101 * \brief FEI specific buffer types
2102 */
2103 VAEncFEIMVBufferType = 43,
2104 VAEncFEIMBCodeBufferType = 44,
2105 VAEncFEIDistortionBufferType = 45,
2106 VAEncFEIMBControlBufferType = 46,
2107 VAEncFEIMVPredictorBufferType = 47,
2108 VAStatsStatisticsParameterBufferType = 48,
2109 /** \brief Statistics output for VAEntrypointStats progressive and top field of interlaced case*/
2110 VAStatsStatisticsBufferType = 49,
2111 /** \brief Statistics output for VAEntrypointStats bottom field of interlaced case*/
2112 VAStatsStatisticsBottomFieldBufferType = 50,
2113 VAStatsMVBufferType = 51,
2114 VAStatsMVPredictorBufferType = 52,
2115 /** Force MB's to be non skip for encode.it's per-mb control buffer, The width of the MB map
2116 * Surface is (width of the Picture in MB unit) * 1 byte, multiple of 64 bytes.
2117 * The height is (height of the picture in MB unit). The picture is either
2118 * frame or non-interleaved top or bottom field. If the application provides this
2119 *surface, it will override the "skipCheckDisable" setting in VAEncMiscParameterEncQuality.
2120 */
2121 VAEncMacroblockDisableSkipMapBufferType = 53,
2122 /**
2123 * \brief HEVC FEI CTB level cmd buffer
2124 * it is CTB level information for future usage.
2125 */
2126 VAEncFEICTBCmdBufferType = 54,
2127 /**
2128 * \brief HEVC FEI CU level data buffer
2129 * it's CTB level information for future usage
2130 */
2131 VAEncFEICURecordBufferType = 55,
2132 /** decode stream out buffer, intermedia data of decode, it may include MV, MB mode etc.
2133 * it can be used to detect motion and analyze the frame contain */
2134 VADecodeStreamoutBufferType = 56,
2135
2136 /** \brief HEVC Decoding Subset Parameter buffer type
2137 *
2138 * The subsets parameter buffer is concatenation with one or multiple
2139 * subset entry point offsets. All the offset values are layed out one
2140 * by one according to slice order with first slice segment first, second
2141 * slice segment second, etc... The entry number is indicated by parameter
2142 * \ref num_entry_point_offsets. And the first entry position of the entry
2143 * point offsets for any slice segment is indicated by parameter
2144 * entry_offset_to_subset_array in VAPictureParameterBufferHEVC data structure.
2145 */
2146 VASubsetsParameterBufferType = 57,
2147 /** \brief adjust context parameters dynamically
2148 *
2149 * this parameter is used to update context parameters, detail parameter is in
2150 * \c VAContextParameterUpdateBuffer
2151 */
2152 VAContextParameterUpdateBufferType = 58,
2153 /**
2154 * \brief Protected session execution buffer type
2155 *
2156 * It's for TEE execution usage (vaProtectedSessionExecute()). The buffer structure is in
2157 * \c VAProtectedSessionExecuteBuffer
2158 */
2159 VAProtectedSessionExecuteBufferType = 59,
2160
2161 /** \brief Encryption parameters buffer for protected content session.
2162 *
2163 * Refer to \c VAEncryptionParameters
2164 */
2165 VAEncryptionParameterBufferType = 60,
2166
2167 /**
2168 * \brief Encoding delta QP per block buffer
2169 *
2170 * This buffer only could be created and accepted
2171 * when \c VAConfigAttribValEncPerBlockControl delta_qp_support == 1.
2172 * This input buffer contains delta QP per block for encoding.
2173 * The supported size of delta QP block and the size of delta QP
2174 * must be quried from \c VAConfigAttribValEncPerBlockControl.
2175 */
2176 VAEncDeltaQpPerBlockBufferType = 61,
2177
2178 /**
2179 * \brief VVC ALF data buffer
2180 *
2181 * Refer to \c VAAlfDataVVC
2182 */
2183 VAAlfBufferType = 62,
2184 /**
2185 * \brief VVC LMCS data buffer
2186 *
2187 * Refer to \c VALmcsDataVVC
2188 */
2189 VALmcsBufferType = 63,
2190 /**
2191 * \brief VVC SubPic data buffer
2192 *
2193 * Refer to \c VASubPicVVC
2194 */
2195 VASubPicBufferType = 64,
2196 /**
2197 * \brief VVC Tile Dimension data buffer
2198 *
2199 * Data buffer of tile widths and heights, with each element formatted as uint16_t
2200 */
2201 VATileBufferType = 65,
2202 /**
2203 * \brief VVC Slice Structure data buffer
2204 *
2205 * Refer to \c VASliceStructVVC
2206 */
2207 VASliceStructBufferType = 66,
2208
2209 VABufferTypeMax
2210 } VABufferType;
2211
2212 /** \brief update the context parameter
2213 * this structure is used to update context parameters, such as priority of the context
2214 * backend driver should keep the parameter unchanged if there no new
2215 * parameter updated.
2216 */
2217 typedef struct _VAContextParameterUpdateBuffer {
2218 union {
2219 struct {
2220 /** \brief indicate whether context priority changed */
2221 uint32_t context_priority_update : 1;
2222 /** \brief Reserved bits for future use, must be zero */
2223 uint32_t reserved : 31;
2224 } bits;
2225 uint32_t value;
2226 } flags;
2227 /** \brief task/context priority */
2228 VAConfigAttribValContextPriority context_priority;
2229 /** \brief Reserved bytes for future use, must be zero */
2230 uint32_t reserved[VA_PADDING_MEDIUM];
2231 } VAContextParameterUpdateBuffer;
2232
2233 /**
2234 * These ENCRYPTION_TYPEs are used for the attribute values for
2235 * \c VAConfigAttribEncryption and for encryption_type in
2236 * VAEncryptionParameters.
2237 *
2238 * When used for \c VAConfigAttribEncryption, it be used via
2239 * vaQueryConfigEntrypoints to check which type are supported for specific
2240 * profile or not.
2241 *
2242 * When used for encryption_type in VAEncryptionParameters, it tells driver
2243 * the parameters in VAEncryptionParameters are used for which encryption type.
2244 */
2245 #define VA_ENCRYPTION_TYPE_FULLSAMPLE_CTR 0x00000001 /* AES CTR fullsample */
2246 #define VA_ENCRYPTION_TYPE_FULLSAMPLE_CBC 0x00000002 /* AES CBC fullsample */
2247 #define VA_ENCRYPTION_TYPE_SUBSAMPLE_CTR 0x00000004 /* AES CTR fullsample */
2248 #define VA_ENCRYPTION_TYPE_SUBSAMPLE_CBC 0x00000008 /* AES CBC fullsample */
2249
2250 /** \brief structure for encrypted segment info. */
2251 typedef struct _VAEncryptionSegmentInfo {
2252 /** \brief The offset relative to the start of the bitstream input in
2253 * bytes of the start of the segment */
2254 uint32_t segment_start_offset;
2255 /** \brief The length of the segments in bytes */
2256 uint32_t segment_length;
2257 /** \brief The length in bytes of the remainder of an incomplete block
2258 * from a previous segment*/
2259 uint32_t partial_aes_block_size;
2260 /** \brief The length in bytes of the initial clear data */
2261 uint32_t init_byte_length;
2262 /** \brief This will be AES counter for secure decode and secure encode
2263 * when numSegments equals 1, valid size is specified by
2264 * \c key_blob_size */
2265 uint8_t aes_cbc_iv_or_ctr[64];
2266 /** \brief Reserved bytes for future use, must be zero */
2267 uint32_t va_reserved[VA_PADDING_MEDIUM];
2268 } VAEncryptionSegmentInfo;
2269
2270 /** \brief Encryption parameters buffer for VAEncryptionParameterBufferType */
2271 typedef struct _VAEncryptionParameters {
2272 /** \brief Encryption type, refer to \c VA_ENCRYPTION_TYPE_FULLSAMPLE_CTR,
2273 * \c VA_ENCRYPTION_TYPE_FULLSAMPLE_CBC, \c VA_ENCRYPTION_TYPE_SUBSAMPLE_CTR,
2274 * or \c VA_ENCRYPTION_TYPE_SUBSAMPLE_CBC */
2275 uint32_t encryption_type;
2276 /** \brief The number of sengments */
2277 uint32_t num_segments;
2278 /** \brief Pointer of segments */
2279 VAEncryptionSegmentInfo *segment_info;
2280 /** \brief The status report index reserved for CENC fullsample workload.
2281 * The related structures and definitions are vendor specific.
2282 */
2283 uint32_t status_report_index;
2284 /** \brief CENC counter length */
2285 uint32_t size_of_length;
2286 /** \brief Wrapped decrypt blob (Snd)kb, valid size is specified by
2287 * \c key_blob_size */
2288 uint8_t wrapped_decrypt_blob[64];
2289 /** \brief Wrapped Key blob info (Sne)kb, valid size is specified by
2290 * \c key_blob_size */
2291 uint8_t wrapped_encrypt_blob[64];
2292 /** \brief key blob size
2293 * It could be \c VA_PC_BLOCK_SIZE_128, \c VA_PC_BLOCK_SIZE_192, or
2294 * \c VA_PC_BLOCK_SIZE_256
2295 */
2296 uint32_t key_blob_size;
2297 /** \brief Indicates the number of 16-byte BLOCKS that are encrypted in any
2298 * given encrypted region of segments.
2299 * If this value is zero:
2300 * 1. All bytes in encrypted region of segments are encrypted, i.e. the
2301 * CENC or CBC1 scheme is being used
2302 * 2. blocks_stripe_clear must also be zero.
2303 * If this value is non-zero, blocks_stripe_clear must also be non-zero.
2304 */
2305 uint32_t blocks_stripe_encrypted;
2306 /** \brief Indicates the number of 16-byte BLOCKS that are clear in any given
2307 * encrypted region of segments, as defined by the CENS and CBCS schemes in
2308 * the common encryption spec.
2309 * If this value is zero, all bytes in encrypted region of segments are
2310 * encrypted, i.e. the CENC or CBC1 scheme is being used.
2311 */
2312 uint32_t blocks_stripe_clear;
2313 /** \brief Reserved bytes for future use, must be zero */
2314 uint32_t va_reserved[VA_PADDING_MEDIUM];
2315 } VAEncryptionParameters;
2316
2317 /**
2318 * Processing rate parameter for encode.
2319 */
2320 typedef struct _VAProcessingRateParameterEnc {
2321 /** \brief Profile level */
2322 uint8_t level_idc;
2323 uint8_t reserved[3];
2324 /** \brief quality level. When set to 0, default quality
2325 * level is used.
2326 */
2327 uint32_t quality_level;
2328 /** \brief Period between I frames. */
2329 uint32_t intra_period;
2330 /** \brief Period between I/P frames. */
2331 uint32_t ip_period;
2332 } VAProcessingRateParameterEnc;
2333
2334 /**
2335 * Processing rate parameter for decode.
2336 */
2337 typedef struct _VAProcessingRateParameterDec {
2338 /** \brief Profile level */
2339 uint8_t level_idc;
2340 uint8_t reserved0[3];
2341 uint32_t reserved;
2342 } VAProcessingRateParameterDec;
2343
2344 typedef struct _VAProcessingRateParameter {
2345 union {
2346 VAProcessingRateParameterEnc proc_buf_enc;
2347 VAProcessingRateParameterDec proc_buf_dec;
2348 };
2349 } VAProcessingRateParameter;
2350
2351 /**
2352 * \brief Queries processing rate for the supplied config.
2353 *
2354 * This function queries the processing rate based on parameters in
2355 * \c proc_buf for the given \c config. Upon successful return, the processing
2356 * rate value will be stored in \c processing_rate. Processing rate is
2357 * specified as the number of macroblocks/CTU per second.
2358 *
2359 * If NULL is passed to the \c proc_buf, the default processing rate for the
2360 * given configuration will be returned.
2361 *
2362 * @param[in] dpy the VA display
2363 * @param[in] config the config identifying a codec or a video
2364 * processing pipeline
2365 * @param[in] proc_buf the buffer that contains the parameters for
2366 either the encode or decode processing rate
2367 * @param[out] processing_rate processing rate in number of macroblocks per
2368 second constrained by parameters specified in proc_buf
2369 *
2370 */
2371 VAStatus
2372 vaQueryProcessingRate(
2373 VADisplay dpy,
2374 VAConfigID config,
2375 VAProcessingRateParameter *proc_buf,
2376 unsigned int *processing_rate
2377 );
2378
2379 typedef enum {
2380 VAEncMiscParameterTypeFrameRate = 0,
2381 VAEncMiscParameterTypeRateControl = 1,
2382 VAEncMiscParameterTypeMaxSliceSize = 2,
2383 VAEncMiscParameterTypeAIR = 3,
2384 /** \brief Buffer type used to express a maximum frame size (in bits). */
2385 VAEncMiscParameterTypeMaxFrameSize = 4,
2386 /** \brief Buffer type used for HRD parameters. */
2387 VAEncMiscParameterTypeHRD = 5,
2388 VAEncMiscParameterTypeQualityLevel = 6,
2389 /** \brief Buffer type used for Rolling intra refresh */
2390 VAEncMiscParameterTypeRIR = 7,
2391 /** \brief Buffer type used for quantization parameters, it's per-sequence parameter*/
2392 VAEncMiscParameterTypeQuantization = 8,
2393 /** \brief Buffer type used for sending skip frame parameters to the encoder's
2394 * rate control, when the user has externally skipped frames. */
2395 VAEncMiscParameterTypeSkipFrame = 9,
2396 /** \brief Buffer type used for region-of-interest (ROI) parameters. */
2397 VAEncMiscParameterTypeROI = 10,
2398 /** \brief Buffer type used to express a maximum frame size (in bytes) settings for multiple pass. */
2399 VAEncMiscParameterTypeMultiPassFrameSize = 11,
2400 /** \brief Buffer type used for temporal layer structure */
2401 VAEncMiscParameterTypeTemporalLayerStructure = 12,
2402 /** \brief Buffer type used for dirty region-of-interest (ROI) parameters. */
2403 VAEncMiscParameterTypeDirtyRect = 13,
2404 /** \brief Buffer type used for parallel BRC parameters. */
2405 VAEncMiscParameterTypeParallelBRC = 14,
2406 /** \brief Set MB partion mode mask and Half-pel/Quant-pel motion search */
2407 VAEncMiscParameterTypeSubMbPartPel = 15,
2408 /** \brief set encode quality tuning */
2409 VAEncMiscParameterTypeEncQuality = 16,
2410 /** \brief Buffer type used for encoder rounding offset parameters. */
2411 VAEncMiscParameterTypeCustomRoundingControl = 17,
2412 /** \brief Buffer type used for FEI input frame level parameters */
2413 VAEncMiscParameterTypeFEIFrameControl = 18,
2414 /** \brief encode extension buffer, ect. MPEG2 Sequence extenstion data */
2415 VAEncMiscParameterTypeExtensionData = 19
2416 } VAEncMiscParameterType;
2417
2418 /** \brief Packed header type. */
2419 typedef enum {
2420 /** \brief Packed sequence header. */
2421 VAEncPackedHeaderSequence = 1,
2422 /** \brief Packed picture header. */
2423 VAEncPackedHeaderPicture = 2,
2424 /** \brief Packed slice header. */
2425 VAEncPackedHeaderSlice = 3,
2426 /**
2427 * \brief Packed raw header.
2428 *
2429 * Packed raw data header can be used by the client to insert a header
2430 * into the bitstream data buffer at the point it is passed, the driver
2431 * will handle the raw packed header based on "has_emulation_bytes" field
2432 * in the packed header parameter structure.
2433 */
2434 VAEncPackedHeaderRawData = 4,
2435 /**
2436 * \brief Misc packed header. See codec-specific definitions.
2437 *
2438 * @deprecated
2439 * This is a deprecated packed header type. All applications can use
2440 * \c VAEncPackedHeaderRawData to insert a codec-specific packed header
2441 */
2442 VAEncPackedHeaderMiscMask va_deprecated_enum = 0x80000000,
2443 } VAEncPackedHeaderType;
2444
2445 /** \brief Packed header parameter. */
2446 typedef struct _VAEncPackedHeaderParameterBuffer {
2447 /** Type of the packed header buffer. See #VAEncPackedHeaderType. */
2448 uint32_t type;
2449 /** \brief Size of the #VAEncPackedHeaderDataBuffer in bits. */
2450 uint32_t bit_length;
2451 /** \brief Flag: buffer contains start code emulation prevention bytes? */
2452 uint8_t has_emulation_bytes;
2453
2454 /** \brief Reserved bytes for future use, must be zero */
2455 uint32_t va_reserved[VA_PADDING_LOW];
2456 } VAEncPackedHeaderParameterBuffer;
2457
2458 /**
2459 * For application, e.g. set a new bitrate
2460 * VABufferID buf_id;
2461 * VAEncMiscParameterBuffer *misc_param;
2462 * VAEncMiscParameterRateControl *misc_rate_ctrl;
2463 *
2464 * vaCreateBuffer(dpy, context, VAEncMiscParameterBufferType,
2465 * sizeof(VAEncMiscParameterBuffer) + sizeof(VAEncMiscParameterRateControl),
2466 * 1, NULL, &buf_id);
2467 *
2468 * vaMapBuffer(dpy,buf_id,(void **)&misc_param);
2469 * misc_param->type = VAEncMiscParameterTypeRateControl;
2470 * misc_rate_ctrl= (VAEncMiscParameterRateControl *)misc_param->data;
2471 * misc_rate_ctrl->bits_per_second = 6400000;
2472 * vaUnmapBuffer(dpy, buf_id);
2473 * vaRenderPicture(dpy, context, &buf_id, 1);
2474 */
2475 typedef struct _VAEncMiscParameterBuffer {
2476 VAEncMiscParameterType type;
2477 uint32_t data[];
2478 } VAEncMiscParameterBuffer;
2479
2480 /** \brief Temporal layer Structure*/
2481 typedef struct _VAEncMiscParameterTemporalLayerStructure {
2482 /** \brief The number of temporal layers */
2483 uint32_t number_of_layers;
2484 /** \brief The length of the array defining frame layer membership. Should be 1-32 */
2485 uint32_t periodicity;
2486 /**
2487 * \brief The array indicating the layer id for each frame
2488 *
2489 * The layer id for the first frame in a coded sequence is always 0, so layer_id[] specifies the layer
2490 * ids for frames starting from the 2nd frame.
2491 */
2492 uint32_t layer_id[32];
2493
2494 /** \brief Reserved bytes for future use, must be zero */
2495 uint32_t va_reserved[VA_PADDING_LOW];
2496 } VAEncMiscParameterTemporalLayerStructure;
2497
2498
2499 /** \brief Rate control parameters */
2500 typedef struct _VAEncMiscParameterRateControl {
2501 /** The maximum bit-rate which the the rate controller should generate. */
2502 uint32_t bits_per_second;
2503 /** The target bit-rate which the rate controller should generate, as a percentage of the
2504 * maximum bit-rate.
2505 *
2506 * In CBR mode this value is ignored (treated as 100%).
2507 */
2508 uint32_t target_percentage;
2509 /** Rate control window size in milliseconds.
2510 *
2511 * The rate controller will attempt to guarantee that the target and maximum bit-rates are
2512 * correct over this window.
2513 */
2514 uint32_t window_size;
2515 /** Initial quantiser value used at the start of the stream.
2516 *
2517 * Ignored if set to zero.
2518 */
2519 uint32_t initial_qp;
2520 /** Minimum quantiser value to use.
2521 *
2522 * The quantiser will not go below the value - if this limit is hit, the output bitrate may
2523 * be lower than the target. Ignored if set to zero.
2524 */
2525 uint32_t min_qp;
2526 /** Basic unit size.
2527 *
2528 * Only used by some drivers - see driver documentation for details. Set to zero if unused.
2529 */
2530 uint32_t basic_unit_size;
2531 union {
2532 struct {
2533 /** Force rate controller reset.
2534 *
2535 * The next frame will be treated as the start of a new stream, with all rate
2536 * controller state reset to its initial values.
2537 */
2538 uint32_t reset : 1;
2539 /** Disable frame skip in rate control mode. */
2540 uint32_t disable_frame_skip : 1;
2541 /** Disable bit stuffing in rate control mode. */
2542 uint32_t disable_bit_stuffing : 1;
2543 /** Macroblock-level rate control.
2544 *
2545 * 0: use default, 1: always enable, 2: always disable, other: reserved.
2546 *
2547 * This feature is only available if VAConfigAttribRateControl has the
2548 * \ref VA_RC_MB bit set.
2549 */
2550 uint32_t mb_rate_control : 4;
2551 /** The temporal layer that these rate control parameters apply to. */
2552 uint32_t temporal_id : 8;
2553 /** Ensure that intra frames also conform to the constant frame size. */
2554 uint32_t cfs_I_frames : 1;
2555 /** Enable parallel rate control for hierarchical B frames.
2556 *
2557 * See \ref VA_RC_PARALLEL.
2558 */
2559 uint32_t enable_parallel_brc : 1;
2560 uint32_t enable_dynamic_scaling : 1;
2561 /** Frame tolerance mode.
2562 *
2563 * Indicates the tolerance the application has to variations in the frame size.
2564 * For example, wireless display scenarios may require very steady bit rate to
2565 * reduce buffering time. It affects the rate control algorithm used,
2566 * but may or may not have an effect based on the combination of other BRC
2567 * parameters. Only valid when the driver reports support for
2568 * #VAConfigAttribFrameSizeToleranceSupport.
2569 *
2570 * equals 0 -- normal mode;
2571 * equals 1 -- maps to sliding window;
2572 * equals 2 -- maps to low delay mode;
2573 * other -- invalid.
2574 */
2575 uint32_t frame_tolerance_mode : 2;
2576 /** Reserved for future use, must be zero. */
2577 uint32_t reserved : 12;
2578 } bits;
2579 uint32_t value;
2580 } rc_flags;
2581 /** Initial quality factor used in ICQ mode.
2582 *
2583 * This value must be between 1 and 51.
2584 * this value will be deprecated in future, to use quality_factor instead of it.
2585 */
2586 uint32_t ICQ_quality_factor;
2587 /** Maximum quantiser value to use.
2588 *
2589 * The quantiser will not go above this value - if this limit is hit, the output bitrate
2590 * may exceed the target. Ignored if set to zero.
2591 */
2592 uint32_t max_qp;
2593 /** Quality factor
2594 *
2595 * the range will be different for different codec
2596 */
2597 uint32_t quality_factor;
2598 /** Target frame size
2599 *
2600 * Desired frame size in bytes.
2601 * This parameter can be used in some RC modes (like Transport Controlled BRC)
2602 * where feedback from the app is required.
2603 * Zero value means no limits.
2604 *
2605 */
2606 uint32_t target_frame_size;
2607 /** Reserved bytes for future use, must be zero. */
2608 uint32_t va_reserved[VA_PADDING_LOW];
2609 } VAEncMiscParameterRateControl;
2610
2611 /** Encode framerate parameters.
2612 *
2613 * Sets the encode framerate used by the rate controller. This should be
2614 * provided in all modes using a bitrate target (variable framerate is not
2615 * supported).
2616 */
2617 typedef struct _VAEncMiscParameterFrameRate {
2618 /** Encode framerate.
2619 *
2620 * The framerate is specified as a number of frames per second, as a
2621 * fraction. The denominator of the fraction is given in the top half
2622 * (the high two bytes) of the framerate field, and the numerator is
2623 * given in the bottom half (the low two bytes).
2624 *
2625 * That is:
2626 * denominator = framerate >> 16 & 0xffff;
2627 * numerator = framerate & 0xffff;
2628 * fps = numerator / denominator;
2629 *
2630 * For example, if framerate is set to (100 << 16 | 750), this is
2631 * 750 / 100, hence 7.5fps.
2632 *
2633 * If the denominator is zero (the high two bytes are both zero) then
2634 * it takes the value one instead, so the framerate is just the integer
2635 * in the low 2 bytes.
2636 */
2637 uint32_t framerate;
2638 union {
2639 struct {
2640 /** The temporal layer that these framerate parameters apply to. */
2641 uint32_t temporal_id : 8;
2642 /** Reserved for future use, must be zero. */
2643 uint32_t reserved : 24;
2644 } bits;
2645 uint32_t value;
2646 } framerate_flags;
2647
2648 /** \brief Reserved bytes for future use, must be zero */
2649 uint32_t va_reserved[VA_PADDING_LOW];
2650 } VAEncMiscParameterFrameRate;
2651
2652 /**
2653 * Allow a maximum slice size to be specified (in bits).
2654 * The encoder will attempt to make sure that individual slices do not exceed this size
2655 * Or to signal applicate if the slice size exceed this size, see "status" of VACodedBufferSegment
2656 */
2657 typedef struct _VAEncMiscParameterMaxSliceSize {
2658 uint32_t max_slice_size;
2659
2660 /** \brief Reserved bytes for future use, must be zero */
2661 uint32_t va_reserved[VA_PADDING_LOW];
2662 } VAEncMiscParameterMaxSliceSize;
2663
2664 typedef struct _VAEncMiscParameterAIR {
2665 uint32_t air_num_mbs;
2666 uint32_t air_threshold;
2667 uint32_t air_auto; /* if set to 1 then hardware auto-tune the AIR threshold */
2668
2669 /** \brief Reserved bytes for future use, must be zero */
2670 uint32_t va_reserved[VA_PADDING_LOW];
2671 } VAEncMiscParameterAIR;
2672
2673 /*
2674 * \brief Rolling intra refresh data structure for encoding.
2675 */
2676 typedef struct _VAEncMiscParameterRIR {
2677 union {
2678 struct
2679 /**
2680 * \brief Indicate if intra refresh is enabled in column/row.
2681 *
2682 * App should query VAConfigAttribEncIntraRefresh to confirm RIR support
2683 * by the driver before sending this structure.
2684 */
2685 {
2686 /* \brief enable RIR in column */
2687 uint32_t enable_rir_column : 1;
2688 /* \brief enable RIR in row */
2689 uint32_t enable_rir_row : 1;
2690 uint32_t reserved : 30;
2691 } bits;
2692 uint32_t value;
2693 } rir_flags;
2694 /**
2695 * \brief Indicates the column or row location in MB. It is ignored if
2696 * rir_flags is 0.
2697 */
2698 uint16_t intra_insertion_location;
2699 /**
2700 * \brief Indicates the number of columns or rows in MB. It is ignored if
2701 * rir_flags is 0.
2702 */
2703 uint16_t intra_insert_size;
2704 /**
2705 * \brief indicates the Qp difference for inserted intra columns or rows.
2706 * App can use this to adjust intra Qp based on bitrate & max frame size.
2707 */
2708 uint8_t qp_delta_for_inserted_intra;
2709 /** \brief Reserved bytes for future use, must be zero */
2710 uint32_t va_reserved[VA_PADDING_LOW];
2711 } VAEncMiscParameterRIR;
2712
2713 /** HRD / VBV buffering parameters for encoding.
2714 *
2715 * This sets the HRD / VBV parameters which will be used by the rate
2716 * controller for encoding. It should be specified in modes using a bitrate
2717 * target when the buffering of the output stream needs to be constrained.
2718 *
2719 * If not provided, the encoder may use arbitrary amounts of buffering.
2720 */
2721 typedef struct _VAEncMiscParameterHRD {
2722 /** The initial fullness of the HRD coded picture buffer, in bits.
2723 *
2724 * This sets how full the CPB is when encoding begins - that is, how much
2725 * buffering will happen on the decoder side before the first frame.
2726 * The CPB fullness will be reset to this value after any rate control
2727 * reset (a change in parameters or an explicit reset).
2728 *
2729 * For H.264, it should match the value of initial_cpb_removal_delay in
2730 * buffering_period SEI messages.
2731 */
2732 uint32_t initial_buffer_fullness;
2733 /** The HRD coded picture buffer size, in bits.
2734 *
2735 * For H.264, it should match the value of cpb_size_value_minus1 in the VUI
2736 * parameters.
2737 */
2738 uint32_t buffer_size;
2739
2740 /** \brief Reserved bytes for future use, must be zero */
2741 uint32_t va_reserved[VA_PADDING_LOW];
2742 } VAEncMiscParameterHRD;
2743
2744 /**
2745 * \brief Defines a maximum frame size (in bits).
2746 *
2747 * This misc parameter buffer defines the maximum size of a frame (in
2748 * bits). The encoder will try to make sure that each frame does not
2749 * exceed this size. Otherwise, if the frame size exceeds this size,
2750 * the \c status flag of #VACodedBufferSegment will contain
2751 * #VA_CODED_BUF_STATUS_FRAME_SIZE_OVERFLOW.
2752 */
2753 typedef struct _VAEncMiscParameterBufferMaxFrameSize {
2754 /** \brief Type. Shall be set to #VAEncMiscParameterTypeMaxFrameSize. */
2755 /** duplicated with VAEncMiscParameterBuffer, should be deprecated*/
2756 va_deprecated VAEncMiscParameterType type;
2757 /** \brief Maximum size of a frame (in bits). */
2758 uint32_t max_frame_size;
2759
2760 /** \brief Reserved bytes for future use, must be zero */
2761 uint32_t va_reserved[VA_PADDING_LOW];
2762 } VAEncMiscParameterBufferMaxFrameSize;
2763
2764 /**
2765 * \brief Maximum frame size (in bytes) settings for multiple pass.
2766 *
2767 * This misc parameter buffer defines the maximum size of a frame (in
2768 * bytes) settings for multiple pass. currently only AVC encoder can
2769 * support this settings in multiple pass case. If the frame size exceeds
2770 * this size, the encoder will do more pak passes to adjust the QP value
2771 * to control the frame size.
2772 */
2773 typedef struct _VAEncMiscParameterBufferMultiPassFrameSize {
2774 /** \brief Type. Shall be set to #VAEncMiscParameterTypeMultiPassMaxFrameSize. */
2775 /** duplicated with VAEncMiscParameterBuffer, should be deprecated*/
2776 va_deprecated VAEncMiscParameterType type;
2777 /** \brief Maximum size of a frame (in byte) */
2778 uint32_t max_frame_size;
2779 /** \brief Reserved bytes for future use, must be zero */
2780 uint32_t reserved;
2781 /** \brief number of passes, every pass has different QP, currently AVC encoder can support up to 4 passes */
2782 uint8_t num_passes;
2783 /** \brief delta QP list for every pass */
2784 uint8_t *delta_qp;
2785
2786 /** \brief Reserved bytes for future use, must be zero */
2787 unsigned long va_reserved[VA_PADDING_LOW];
2788 } VAEncMiscParameterBufferMultiPassFrameSize;
2789
2790 /**
2791 * \brief Encoding quality level.
2792 *
2793 * The encoding quality could be set through this structure, if the implementation
2794 * supports multiple quality levels. The quality level set through this structure is
2795 * persistent over the entire coded sequence, or until a new structure is being sent.
2796 * The quality level range can be queried through the VAConfigAttribEncQualityRange
2797 * attribute. A lower value means higher quality, and a value of 1 represents the highest
2798 * quality. The quality level setting is used as a trade-off between quality and speed/power
2799 * consumption, with higher quality corresponds to lower speed and higher power consumption.
2800 */
2801 typedef struct _VAEncMiscParameterBufferQualityLevel {
2802 /** \brief Encoding quality level setting. When set to 0, default quality
2803 * level is used.
2804 */
2805 uint32_t quality_level;
2806
2807 /** \brief Reserved bytes for future use, must be zero */
2808 uint32_t va_reserved[VA_PADDING_LOW];
2809 } VAEncMiscParameterBufferQualityLevel;
2810
2811 /**
2812 * \brief Quantization settings for encoding.
2813 *
2814 * Some encoders support special types of quantization such as trellis, and this structure
2815 * can be used by the app to control these special types of quantization by the encoder.
2816 */
2817 typedef struct _VAEncMiscParameterQuantization {
2818 union {
2819 /* if no flags is set then quantization is determined by the driver */
2820 struct {
2821 /* \brief disable trellis for all frames/fields */
2822 uint32_t disable_trellis : 1;
2823 /* \brief enable trellis for I frames/fields */
2824 uint32_t enable_trellis_I : 1;
2825 /* \brief enable trellis for P frames/fields */
2826 uint32_t enable_trellis_P : 1;
2827 /* \brief enable trellis for B frames/fields */
2828 uint32_t enable_trellis_B : 1;
2829 uint32_t reserved : 28;
2830 } bits;
2831 uint32_t value;
2832 } quantization_flags;
2833 uint32_t va_reserved;
2834 } VAEncMiscParameterQuantization;
2835
2836 /**
2837 * \brief Encoding skip frame.
2838 *
2839 * The application may choose to skip frames externally to the encoder (e.g. drop completely or
2840 * code as all skip's). For rate control purposes the encoder will need to know the size and number
2841 * of skipped frames. Skip frame(s) indicated through this structure is applicable only to the
2842 * current frame. It is allowed for the application to still send in packed headers for the driver to
2843 * pack, although no frame will be encoded (e.g. for HW to encrypt the frame).
2844 */
2845 typedef struct _VAEncMiscParameterSkipFrame {
2846 /** \brief Indicates skip frames as below.
2847 * 0: Encode as normal, no skip.
2848 * 1: One or more frames were skipped prior to the current frame, encode the current frame as normal.
2849 * 2: The current frame is to be skipped, do not encode it but pack/encrypt the packed header contents
2850 * (all except VAEncPackedHeaderSlice) which could contain actual frame contents (e.g. pack the frame
2851 * in VAEncPackedHeaderPicture). */
2852 uint8_t skip_frame_flag;
2853 /** \brief The number of frames skipped prior to the current frame. Valid when skip_frame_flag = 1. */
2854 uint8_t num_skip_frames;
2855 /** \brief When skip_frame_flag = 1, the size of the skipped frames in bits. When skip_frame_flag = 2,
2856 * the size of the current skipped frame that is to be packed/encrypted in bits. */
2857 uint32_t size_skip_frames;
2858
2859 /** \brief Reserved bytes for future use, must be zero */
2860 uint32_t va_reserved[VA_PADDING_LOW];
2861 } VAEncMiscParameterSkipFrame;
2862
2863 /**
2864 * \brief Encoding region-of-interest (ROI).
2865 *
2866 * The encoding ROI can be set through VAEncMiscParameterBufferROI, if the implementation
2867 * supports ROI input. The ROI set through this structure is applicable only to the
2868 * current frame or field, so must be sent every frame or field to be applied. The number of
2869 * supported ROIs can be queried through the VAConfigAttribEncROI. The encoder will use the
2870 * ROI information to adjust the QP values of the MB's that fall within the ROIs.
2871 */
2872 typedef struct _VAEncROI {
2873 /** \brief Defines the ROI boundary in pixels, the driver will map it to appropriate
2874 * codec coding units. It is relative to frame coordinates for the frame case and
2875 * to field coordinates for the field case. */
2876 VARectangle roi_rectangle;
2877 /**
2878 * \brief ROI value
2879 *
2880 * \ref roi_value specifies ROI delta QP or ROI priority.
2881 * -- ROI delta QP is the value that will be added on top of the frame level QP.
2882 * -- ROI priority specifies the priority of a region, it can be positive (more important)
2883 * or negative (less important) values and is compared with non-ROI region (taken as value 0),
2884 * E.g. ROI region with \ref roi_value -3 is less important than the non-ROI region (\ref roi_value
2885 * implied to be 0) which is less important than ROI region with roi_value +2. For overlapping
2886 * regions, the roi_value that is first in the ROI array will have priority.
2887 *
2888 * \ref roi_value always specifes ROI delta QP when VAConfigAttribRateControl == VA_RC_CQP, no matter
2889 * the value of \c roi_value_is_qp_delta in #VAEncMiscParameterBufferROI.
2890 *
2891 * \ref roi_value depends on \c roi_value_is_qp_delta in #VAEncMiscParameterBufferROI when
2892 * VAConfigAttribRateControl != VA_RC_CQP. \ref roi_value specifies ROI_delta QP if \c roi_value_is_qp_delta
2893 * in VAEncMiscParameterBufferROI is 1, otherwise \ref roi_value specifies ROI priority.
2894 */
2895 int8_t roi_value;
2896 } VAEncROI;
2897
2898 typedef struct _VAEncMiscParameterBufferROI {
2899 /** \brief Number of ROIs being sent.*/
2900 uint32_t num_roi;
2901
2902 /** \brief Valid when VAConfigAttribRateControl != VA_RC_CQP, then the encoder's
2903 * rate control will determine actual delta QPs. Specifies the max/min allowed delta
2904 * QPs. */
2905 int8_t max_delta_qp;
2906 int8_t min_delta_qp;
2907
2908 /** \brief Pointer to a VAEncROI array with num_roi elements. It is relative to frame
2909 * coordinates for the frame case and to field coordinates for the field case.*/
2910 VAEncROI *roi;
2911 union {
2912 struct {
2913 /**
2914 * \brief An indication for roi value.
2915 *
2916 * \ref roi_value_is_qp_delta equal to 1 indicates \c roi_value in #VAEncROI should
2917 * be used as ROI delta QP. \ref roi_value_is_qp_delta equal to 0 indicates \c roi_value
2918 * in #VAEncROI should be used as ROI priority.
2919 *
2920 * \ref roi_value_is_qp_delta is only available when VAConfigAttribRateControl != VA_RC_CQP,
2921 * the setting must comply with \c roi_rc_priority_support and \c roi_rc_qp_delta_support in
2922 * #VAConfigAttribValEncROI. The underlying driver should ignore this field
2923 * when VAConfigAttribRateControl == VA_RC_CQP.
2924 */
2925 uint32_t roi_value_is_qp_delta : 1;
2926 uint32_t reserved : 31;
2927 } bits;
2928 uint32_t value;
2929 } roi_flags;
2930
2931 /** \brief Reserved bytes for future use, must be zero */
2932 uint32_t va_reserved[VA_PADDING_LOW];
2933 } VAEncMiscParameterBufferROI;
2934 /*
2935 * \brief Dirty rectangle data structure for encoding.
2936 *
2937 * The encoding dirty rect can be set through VAEncMiscParameterBufferDirtyRect, if the
2938 * implementation supports dirty rect input. The rect set through this structure is applicable
2939 * only to the current frame or field, so must be sent every frame or field to be applied.
2940 * The number of supported rects can be queried through the VAConfigAttribEncDirtyRect. The
2941 * encoder will use the rect information to know those rectangle areas have changed while the
2942 * areas not covered by dirty rect rectangles are assumed to have not changed compared to the
2943 * previous picture. The encoder may do some internal optimizations.
2944 */
2945 typedef struct _VAEncMiscParameterBufferDirtyRect {
2946 /** \brief Number of Rectangle being sent.*/
2947 uint32_t num_roi_rectangle;
2948
2949 /** \brief Pointer to a VARectangle array with num_roi_rectangle elements.*/
2950 VARectangle *roi_rectangle;
2951 } VAEncMiscParameterBufferDirtyRect;
2952
2953 /** \brief Attribute value for VAConfigAttribEncParallelRateControl */
2954 typedef struct _VAEncMiscParameterParallelRateControl {
2955 /** brief Number of layers*/
2956 uint32_t num_layers;
2957 /** brief Number of B frames per layer per GOP.
2958 *
2959 * it should be allocated by application, and the is num_layers.
2960 * num_b_in_gop[0] is the number of regular B which refers to only I or P frames. */
2961 uint32_t *num_b_in_gop;
2962 } VAEncMiscParameterParallelRateControl;
2963
2964 /** per frame encoder quality controls, once set they will persist for all future frames
2965 *till it is updated again. */
2966 typedef struct _VAEncMiscParameterEncQuality {
2967 union {
2968 struct {
2969 /** Use raw frames for reference instead of reconstructed frames.
2970 * it only impact motion estimation (ME) stage, and will not impact MC stage
2971 * so the reconstruct picture will can match with decode side */
2972 uint32_t useRawPicForRef : 1;
2973 /** Disables skip check for ME stage, it will increase the bistream size
2974 * but will improve the qulity */
2975 uint32_t skipCheckDisable : 1;
2976 /** Indicates app will override default driver FTQ settings using FTQEnable.
2977 * FTQ is forward transform quantization */
2978 uint32_t FTQOverride : 1;
2979 /** Enables/disables FTQ. */
2980 uint32_t FTQEnable : 1;
2981 /** Indicates the app will provide the Skip Threshold LUT to use when FTQ is
2982 * enabled (FTQSkipThresholdLUT), else default driver thresholds will be used. */
2983 uint32_t FTQSkipThresholdLUTInput : 1;
2984 /** Indicates the app will provide the Skip Threshold LUT to use when FTQ is
2985 * disabled (NonFTQSkipThresholdLUT), else default driver thresholds will be used. */
2986 uint32_t NonFTQSkipThresholdLUTInput : 1;
2987 uint32_t ReservedBit : 1;
2988 /** Control to enable the ME mode decision algorithm to bias to fewer B Direct/Skip types.
2989 * Applies only to B frames, all other frames will ignore this setting. */
2990 uint32_t directBiasAdjustmentEnable : 1;
2991 /** Enables global motion bias. global motion also is called HME (Heirarchical Motion Estimation )
2992 * HME is used to handle large motions and avoiding local minima in the video encoding process
2993 * down scaled the input and reference picture, then do ME. the result will be a predictor to next level HME or ME
2994 * current interface divide the HME to 3 level. UltraHME , SuperHME, and HME, result of UltraHME will be input of SurperHME,
2995 * result of superHME will be a input for HME. HME result will be input of ME. it is a switch for HMEMVCostScalingFactor
2996 * can change the HME bias inside RDO stage*/
2997 uint32_t globalMotionBiasAdjustmentEnable : 1;
2998 /** MV cost scaling ratio for HME ( predictors. It is used when
2999 * globalMotionBiasAdjustmentEnable == 1, else it is ignored. Values are:
3000 * 0: set MV cost to be 0 for HME predictor.
3001 * 1: scale MV cost to be 1/2 of the default value for HME predictor.
3002 * 2: scale MV cost to be 1/4 of the default value for HME predictor.
3003 * 3: scale MV cost to be 1/8 of the default value for HME predictor. */
3004 uint32_t HMEMVCostScalingFactor : 2;
3005 /**disable HME, if it is disabled. Super*ultraHME should also be disabled */
3006 uint32_t HMEDisable : 1;
3007 /**disable Super HME, if it is disabled, ultraHME should be disabled */
3008 uint32_t SuperHMEDisable : 1;
3009 /** disable Ultra HME */
3010 uint32_t UltraHMEDisable : 1;
3011 /** disable panic mode. Panic mode happened when there are extreme BRC (bit rate control) requirement
3012 * frame size cant achieve the target of BRC. when Panic mode is triggered, Coefficients will
3013 * be set to zero. disable panic mode will improve quality but will impact BRC */
3014 uint32_t PanicModeDisable : 1;
3015 /** Force RepartitionCheck
3016 * 0: DEFAULT - follow driver default settings.
3017 * 1: FORCE_ENABLE - enable this feature totally for all cases.
3018 * 2: FORCE_DISABLE - disable this feature totally for all cases. */
3019 uint32_t ForceRepartitionCheck : 2;
3020
3021 };
3022 uint32_t encControls;
3023 };
3024
3025 /** Maps QP to skip thresholds when FTQ is enabled. Valid range is 0-255. */
3026 uint8_t FTQSkipThresholdLUT[52];
3027 /** Maps QP to skip thresholds when FTQ is disabled. Valid range is 0-65535. */
3028 uint16_t NonFTQSkipThresholdLUT[52];
3029
3030 uint32_t reserved[VA_PADDING_HIGH]; // Reserved for future use.
3031
3032 } VAEncMiscParameterEncQuality;
3033
3034 /**
3035 * \brief Custom Encoder Rounding Offset Control.
3036 * Application may use this structure to set customized rounding
3037 * offset parameters for quantization.
3038 * Valid when \c VAConfigAttribCustomRoundingControl equals 1.
3039 */
3040 typedef struct _VAEncMiscParameterCustomRoundingControl {
3041 union {
3042 struct {
3043 /** \brief Enable customized rounding offset for intra blocks.
3044 * If 0, default value would be taken by driver for intra
3045 * rounding offset.
3046 */
3047 uint32_t enable_custom_rouding_intra : 1 ;
3048
3049 /** \brief Intra rounding offset
3050 * Ignored if \c enable_custom_rouding_intra equals 0.
3051 */
3052 uint32_t rounding_offset_intra : 7;
3053
3054 /** \brief Enable customized rounding offset for inter blocks.
3055 * If 0, default value would be taken by driver for inter
3056 * rounding offset.
3057 */
3058 uint32_t enable_custom_rounding_inter : 1 ;
3059
3060 /** \brief Inter rounding offset
3061 * Ignored if \c enable_custom_rouding_inter equals 0.
3062 */
3063 uint32_t rounding_offset_inter : 7;
3064
3065 /* Reserved */
3066 uint32_t reserved : 16;
3067 } bits;
3068 uint32_t value;
3069 } rounding_offset_setting;
3070 } VAEncMiscParameterCustomRoundingControl;
3071
3072 /**
3073 * There will be cases where the bitstream buffer will not have enough room to hold
3074 * the data for the entire slice, and the following flags will be used in the slice
3075 * parameter to signal to the server for the possible cases.
3076 * If a slice parameter buffer and slice data buffer pair is sent to the server with
3077 * the slice data partially in the slice data buffer (BEGIN and MIDDLE cases below),
3078 * then a slice parameter and data buffer needs to be sent again to complete this slice.
3079 */
3080 #define VA_SLICE_DATA_FLAG_ALL 0x00 /* whole slice is in the buffer */
3081 #define VA_SLICE_DATA_FLAG_BEGIN 0x01 /* The beginning of the slice is in the buffer but the end if not */
3082 #define VA_SLICE_DATA_FLAG_MIDDLE 0x02 /* Neither beginning nor end of the slice is in the buffer */
3083 #define VA_SLICE_DATA_FLAG_END 0x04 /* end of the slice is in the buffer */
3084
3085 /* Codec-independent Slice Parameter Buffer base */
3086 typedef struct _VASliceParameterBufferBase {
3087 uint32_t slice_data_size; /* number of bytes in the slice data buffer for this slice */
3088 uint32_t slice_data_offset; /* the offset to the first byte of slice data */
3089 uint32_t slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX definitions */
3090 } VASliceParameterBufferBase;
3091
3092 /**********************************
3093 * JPEG common data structures
3094 **********************************/
3095 /**
3096 * \brief Huffman table for JPEG decoding.
3097 *
3098 * This structure holds the complete Huffman tables. This is an
3099 * aggregation of all Huffman table (DHT) segments maintained by the
3100 * application. i.e. up to 2 Huffman tables are stored in there for
3101 * baseline profile.
3102 *
3103 * The #load_huffman_table array can be used as a hint to notify the
3104 * VA driver implementation about which table(s) actually changed
3105 * since the last submission of this buffer.
3106 */
3107 typedef struct _VAHuffmanTableBufferJPEGBaseline {
3108 /** \brief Specifies which #huffman_table is valid. */
3109 uint8_t load_huffman_table[2];
3110 /** \brief Huffman tables indexed by table identifier (Th). */
3111 struct {
3112 /** @name DC table (up to 12 categories) */
3113 /**@{*/
3114 /** \brief Number of Huffman codes of length i + 1 (Li). */
3115 uint8_t num_dc_codes[16];
3116 /** \brief Value associated with each Huffman code (Vij). */
3117 uint8_t dc_values[12];
3118 /**@}*/
3119 /** @name AC table (2 special codes + up to 16 * 10 codes) */
3120 /**@{*/
3121 /** \brief Number of Huffman codes of length i + 1 (Li). */
3122 uint8_t num_ac_codes[16];
3123 /** \brief Value associated with each Huffman code (Vij). */
3124 uint8_t ac_values[162];
3125 /** \brief Padding to 4-byte boundaries. Must be set to zero. */
3126 uint8_t pad[2];
3127 /**@}*/
3128 } huffman_table[2];
3129
3130 /** \brief Reserved bytes for future use, must be zero */
3131 uint32_t va_reserved[VA_PADDING_LOW];
3132 } VAHuffmanTableBufferJPEGBaseline;
3133
3134 /****************************
3135 * MPEG-2 data structures
3136 ****************************/
3137
3138 /* MPEG-2 Picture Parameter Buffer */
3139 /*
3140 * For each frame or field, and before any slice data, a single
3141 * picture parameter buffer must be send.
3142 */
3143 typedef struct _VAPictureParameterBufferMPEG2 {
3144 uint16_t horizontal_size;
3145 uint16_t vertical_size;
3146 VASurfaceID forward_reference_picture;
3147 VASurfaceID backward_reference_picture;
3148 /* meanings of the following fields are the same as in the standard */
3149 int32_t picture_coding_type;
3150 int32_t f_code; /* pack all four fcode into this */
3151 union {
3152 struct {
3153 uint32_t intra_dc_precision : 2;
3154 uint32_t picture_structure : 2;
3155 uint32_t top_field_first : 1;
3156 uint32_t frame_pred_frame_dct : 1;
3157 uint32_t concealment_motion_vectors : 1;
3158 uint32_t q_scale_type : 1;
3159 uint32_t intra_vlc_format : 1;
3160 uint32_t alternate_scan : 1;
3161 uint32_t repeat_first_field : 1;
3162 uint32_t progressive_frame : 1;
3163 uint32_t is_first_field : 1; /* indicate whether the current field
3164 * is the first field for field picture
3165 */
3166 } bits;
3167 uint32_t value;
3168 } picture_coding_extension;
3169
3170 /** \brief Reserved bytes for future use, must be zero */
3171 uint32_t va_reserved[VA_PADDING_LOW];
3172 } VAPictureParameterBufferMPEG2;
3173
3174 /** MPEG-2 Inverse Quantization Matrix Buffer */
3175 typedef struct _VAIQMatrixBufferMPEG2 {
3176 /** \brief Same as the MPEG-2 bitstream syntax element. */
3177 int32_t load_intra_quantiser_matrix;
3178 /** \brief Same as the MPEG-2 bitstream syntax element. */
3179 int32_t load_non_intra_quantiser_matrix;
3180 /** \brief Same as the MPEG-2 bitstream syntax element. */
3181 int32_t load_chroma_intra_quantiser_matrix;
3182 /** \brief Same as the MPEG-2 bitstream syntax element. */
3183 int32_t load_chroma_non_intra_quantiser_matrix;
3184 /** \brief Luminance intra matrix, in zig-zag scan order. */
3185 uint8_t intra_quantiser_matrix[64];
3186 /** \brief Luminance non-intra matrix, in zig-zag scan order. */
3187 uint8_t non_intra_quantiser_matrix[64];
3188 /** \brief Chroma intra matrix, in zig-zag scan order. */
3189 uint8_t chroma_intra_quantiser_matrix[64];
3190 /** \brief Chroma non-intra matrix, in zig-zag scan order. */
3191 uint8_t chroma_non_intra_quantiser_matrix[64];
3192
3193 /** \brief Reserved bytes for future use, must be zero */
3194 uint32_t va_reserved[VA_PADDING_LOW];
3195 } VAIQMatrixBufferMPEG2;
3196
3197 /** MPEG-2 Slice Parameter Buffer */
3198 typedef struct _VASliceParameterBufferMPEG2 {
3199 uint32_t slice_data_size;/* number of bytes in the slice data buffer for this slice */
3200 uint32_t slice_data_offset;/* the offset to the first byte of slice data */
3201 uint32_t slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
3202 uint32_t macroblock_offset;/* the offset to the first bit of MB from the first byte of slice data */
3203 uint32_t slice_horizontal_position;
3204 uint32_t slice_vertical_position;
3205 int32_t quantiser_scale_code;
3206 int32_t intra_slice_flag;
3207
3208 /** \brief Reserved bytes for future use, must be zero */
3209 uint32_t va_reserved[VA_PADDING_LOW];
3210 } VASliceParameterBufferMPEG2;
3211
3212 /** MPEG-2 Macroblock Parameter Buffer */
3213 typedef struct _VAMacroblockParameterBufferMPEG2 {
3214 uint16_t macroblock_address;
3215 /*
3216 * macroblock_address (in raster scan order)
3217 * top-left: 0
3218 * bottom-right: picture-height-in-mb*picture-width-in-mb - 1
3219 */
3220 uint8_t macroblock_type; /* see definition below */
3221 union {
3222 struct {
3223 uint32_t frame_motion_type : 2;
3224 uint32_t field_motion_type : 2;
3225 uint32_t dct_type : 1;
3226 } bits;
3227 uint32_t value;
3228 } macroblock_modes;
3229 uint8_t motion_vertical_field_select;
3230 /*
3231 * motion_vertical_field_select:
3232 * see section 6.3.17.2 in the spec
3233 * only the lower 4 bits are used
3234 * bit 0: first vector forward
3235 * bit 1: first vector backward
3236 * bit 2: second vector forward
3237 * bit 3: second vector backward
3238 */
3239 int16_t PMV[2][2][2]; /* see Table 7-7 in the spec */
3240 uint16_t coded_block_pattern;
3241 /*
3242 * The bitplanes for coded_block_pattern are described
3243 * in Figure 6.10-12 in the spec
3244 */
3245
3246 /* Number of skipped macroblocks after this macroblock */
3247 uint16_t num_skipped_macroblocks;
3248
3249 /** \brief Reserved bytes for future use, must be zero */
3250 uint32_t va_reserved[VA_PADDING_LOW];
3251 } VAMacroblockParameterBufferMPEG2;
3252
3253 /*
3254 * OR'd flags for macroblock_type (section 6.3.17.1 in the spec)
3255 */
3256 #define VA_MB_TYPE_MOTION_FORWARD 0x02
3257 #define VA_MB_TYPE_MOTION_BACKWARD 0x04
3258 #define VA_MB_TYPE_MOTION_PATTERN 0x08
3259 #define VA_MB_TYPE_MOTION_INTRA 0x10
3260
3261 /**
3262 * MPEG-2 Residual Data Buffer
3263 * For each macroblock, there wil be 64 shorts (16-bit) in the
3264 * residual data buffer
3265 */
3266
3267 /****************************
3268 * MPEG-4 Part 2 data structures
3269 ****************************/
3270
3271 /* MPEG-4 Picture Parameter Buffer */
3272 /*
3273 * For each frame or field, and before any slice data, a single
3274 * picture parameter buffer must be send.
3275 */
3276 typedef struct _VAPictureParameterBufferMPEG4 {
3277 uint16_t vop_width;
3278 uint16_t vop_height;
3279 VASurfaceID forward_reference_picture;
3280 VASurfaceID backward_reference_picture;
3281 union {
3282 struct {
3283 uint32_t short_video_header : 1;
3284 uint32_t chroma_format : 2;
3285 uint32_t interlaced : 1;
3286 uint32_t obmc_disable : 1;
3287 uint32_t sprite_enable : 2;
3288 uint32_t sprite_warping_accuracy : 2;
3289 uint32_t quant_type : 1;
3290 uint32_t quarter_sample : 1;
3291 uint32_t data_partitioned : 1;
3292 uint32_t reversible_vlc : 1;
3293 uint32_t resync_marker_disable : 1;
3294 } bits;
3295 uint32_t value;
3296 } vol_fields;
3297 uint8_t no_of_sprite_warping_points;
3298 int16_t sprite_trajectory_du[3];
3299 int16_t sprite_trajectory_dv[3];
3300 uint8_t quant_precision;
3301 union {
3302 struct {
3303 uint32_t vop_coding_type : 2;
3304 uint32_t backward_reference_vop_coding_type : 2;
3305 uint32_t vop_rounding_type : 1;
3306 uint32_t intra_dc_vlc_thr : 3;
3307 uint32_t top_field_first : 1;
3308 uint32_t alternate_vertical_scan_flag : 1;
3309 } bits;
3310 uint32_t value;
3311 } vop_fields;
3312 uint8_t vop_fcode_forward;
3313 uint8_t vop_fcode_backward;
3314 uint16_t vop_time_increment_resolution;
3315 /* short header related */
3316 uint8_t num_gobs_in_vop;
3317 uint8_t num_macroblocks_in_gob;
3318 /* for direct mode prediction */
3319 int16_t TRB;
3320 int16_t TRD;
3321
3322 /** \brief Reserved bytes for future use, must be zero */
3323 uint32_t va_reserved[VA_PADDING_LOW];
3324 } VAPictureParameterBufferMPEG4;
3325
3326 /** MPEG-4 Inverse Quantization Matrix Buffer */
3327 typedef struct _VAIQMatrixBufferMPEG4 {
3328 /** Same as the MPEG-4:2 bitstream syntax element. */
3329 int32_t load_intra_quant_mat;
3330 /** Same as the MPEG-4:2 bitstream syntax element. */
3331 int32_t load_non_intra_quant_mat;
3332 /** The matrix for intra blocks, in zig-zag scan order. */
3333 uint8_t intra_quant_mat[64];
3334 /** The matrix for non-intra blocks, in zig-zag scan order. */
3335 uint8_t non_intra_quant_mat[64];
3336
3337 /** \brief Reserved bytes for future use, must be zero */
3338 uint32_t va_reserved[VA_PADDING_LOW];
3339 } VAIQMatrixBufferMPEG4;
3340
3341 /** MPEG-4 Slice Parameter Buffer */
3342 typedef struct _VASliceParameterBufferMPEG4 {
3343 uint32_t slice_data_size;/* number of bytes in the slice data buffer for this slice */
3344 uint32_t slice_data_offset;/* the offset to the first byte of slice data */
3345 uint32_t slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
3346 uint32_t macroblock_offset;/* the offset to the first bit of MB from the first byte of slice data */
3347 uint32_t macroblock_number;
3348 int32_t quant_scale;
3349
3350 /** \brief Reserved bytes for future use, must be zero */
3351 uint32_t va_reserved[VA_PADDING_LOW];
3352 } VASliceParameterBufferMPEG4;
3353
3354 /**
3355 VC-1 data structures
3356 */
3357
3358 typedef enum /* see 7.1.1.32 */
3359 {
3360 VAMvMode1Mv = 0,
3361 VAMvMode1MvHalfPel = 1,
3362 VAMvMode1MvHalfPelBilinear = 2,
3363 VAMvModeMixedMv = 3,
3364 VAMvModeIntensityCompensation = 4
3365 } VAMvModeVC1;
3366
3367 /** VC-1 Picture Parameter Buffer */
3368 /*
3369 * For each picture, and before any slice data, a picture parameter
3370 * buffer must be send. Multiple picture parameter buffers may be
3371 * sent for a single picture. In that case picture parameters will
3372 * apply to all slice data that follow it until a new picture
3373 * parameter buffer is sent.
3374 *
3375 * Notes:
3376 * pic_quantizer_type should be set to the applicable quantizer
3377 * type as defined by QUANTIZER (J.1.19) and either
3378 * PQUANTIZER (7.1.1.8) or PQINDEX (7.1.1.6)
3379 */
3380 typedef struct _VAPictureParameterBufferVC1 {
3381 VASurfaceID forward_reference_picture;
3382 VASurfaceID backward_reference_picture;
3383 /* if out-of-loop post-processing is done on the render
3384 target, then we need to keep the in-loop decoded
3385 picture as a reference picture */
3386 VASurfaceID inloop_decoded_picture;
3387
3388 /* sequence layer for AP or meta data for SP and MP */
3389 union {
3390 struct {
3391 uint32_t pulldown : 1; /* SEQUENCE_LAYER::PULLDOWN */
3392 uint32_t interlace : 1; /* SEQUENCE_LAYER::INTERLACE */
3393 uint32_t tfcntrflag : 1; /* SEQUENCE_LAYER::TFCNTRFLAG */
3394 uint32_t finterpflag : 1; /* SEQUENCE_LAYER::FINTERPFLAG */
3395 uint32_t psf : 1; /* SEQUENCE_LAYER::PSF */
3396 uint32_t multires : 1; /* METADATA::MULTIRES */
3397 uint32_t overlap : 1; /* METADATA::OVERLAP */
3398 uint32_t syncmarker : 1; /* METADATA::SYNCMARKER */
3399 uint32_t rangered : 1; /* METADATA::RANGERED */
3400 uint32_t max_b_frames : 3; /* METADATA::MAXBFRAMES */
3401 uint32_t profile : 2; /* SEQUENCE_LAYER::PROFILE or The MSB of METADATA::PROFILE */
3402 } bits;
3403 uint32_t value;
3404 } sequence_fields;
3405
3406 uint16_t coded_width; /* ENTRY_POINT_LAYER::CODED_WIDTH */
3407 uint16_t coded_height; /* ENTRY_POINT_LAYER::CODED_HEIGHT */
3408 union {
3409 struct {
3410 uint32_t broken_link : 1; /* ENTRY_POINT_LAYER::BROKEN_LINK */
3411 uint32_t closed_entry : 1; /* ENTRY_POINT_LAYER::CLOSED_ENTRY */
3412 uint32_t panscan_flag : 1; /* ENTRY_POINT_LAYER::PANSCAN_FLAG */
3413 uint32_t loopfilter : 1; /* ENTRY_POINT_LAYER::LOOPFILTER */
3414 } bits;
3415 uint32_t value;
3416 } entrypoint_fields;
3417 uint8_t conditional_overlap_flag; /* ENTRY_POINT_LAYER::CONDOVER */
3418 uint8_t fast_uvmc_flag; /* ENTRY_POINT_LAYER::FASTUVMC */
3419 union {
3420 struct {
3421 uint32_t luma_flag : 1; /* ENTRY_POINT_LAYER::RANGE_MAPY_FLAG */
3422 uint32_t luma : 3; /* ENTRY_POINT_LAYER::RANGE_MAPY */
3423 uint32_t chroma_flag : 1; /* ENTRY_POINT_LAYER::RANGE_MAPUV_FLAG */
3424 uint32_t chroma : 3; /* ENTRY_POINT_LAYER::RANGE_MAPUV */
3425 } bits;
3426 uint32_t value;
3427 } range_mapping_fields;
3428
3429 uint8_t b_picture_fraction; /* Index for PICTURE_LAYER::BFRACTION value in Table 40 (7.1.1.14) */
3430 uint8_t cbp_table; /* PICTURE_LAYER::CBPTAB/ICBPTAB */
3431 uint8_t mb_mode_table; /* PICTURE_LAYER::MBMODETAB */
3432 uint8_t range_reduction_frame;/* PICTURE_LAYER::RANGEREDFRM */
3433 uint8_t rounding_control; /* PICTURE_LAYER::RNDCTRL */
3434 uint8_t post_processing; /* PICTURE_LAYER::POSTPROC */
3435 uint8_t picture_resolution_index; /* PICTURE_LAYER::RESPIC */
3436 uint8_t luma_scale; /* PICTURE_LAYER::LUMSCALE */
3437 uint8_t luma_shift; /* PICTURE_LAYER::LUMSHIFT */
3438
3439 union {
3440 struct {
3441 uint32_t picture_type : 3; /* PICTURE_LAYER::PTYPE */
3442 uint32_t frame_coding_mode : 3; /* PICTURE_LAYER::FCM */
3443 uint32_t top_field_first : 1; /* PICTURE_LAYER::TFF */
3444 uint32_t is_first_field : 1; /* set to 1 if it is the first field */
3445 uint32_t intensity_compensation : 1; /* PICTURE_LAYER::INTCOMP */
3446 } bits;
3447 uint32_t value;
3448 } picture_fields;
3449 union {
3450 struct {
3451 uint32_t mv_type_mb : 1; /* PICTURE::MVTYPEMB */
3452 uint32_t direct_mb : 1; /* PICTURE::DIRECTMB */
3453 uint32_t skip_mb : 1; /* PICTURE::SKIPMB */
3454 uint32_t field_tx : 1; /* PICTURE::FIELDTX */
3455 uint32_t forward_mb : 1; /* PICTURE::FORWARDMB */
3456 uint32_t ac_pred : 1; /* PICTURE::ACPRED */
3457 uint32_t overflags : 1; /* PICTURE::OVERFLAGS */
3458 } flags;
3459 uint32_t value;
3460 } raw_coding;
3461 union {
3462 struct {
3463 uint32_t bp_mv_type_mb : 1; /* PICTURE::MVTYPEMB */
3464 uint32_t bp_direct_mb : 1; /* PICTURE::DIRECTMB */
3465 uint32_t bp_skip_mb : 1; /* PICTURE::SKIPMB */
3466 uint32_t bp_field_tx : 1; /* PICTURE::FIELDTX */
3467 uint32_t bp_forward_mb : 1; /* PICTURE::FORWARDMB */
3468 uint32_t bp_ac_pred : 1; /* PICTURE::ACPRED */
3469 uint32_t bp_overflags : 1; /* PICTURE::OVERFLAGS */
3470 } flags;
3471 uint32_t value;
3472 } bitplane_present; /* signal what bitplane is being passed via the bitplane buffer */
3473 union {
3474 struct {
3475 uint32_t reference_distance_flag : 1;/* PICTURE_LAYER::REFDIST_FLAG */
3476 uint32_t reference_distance : 5;/* PICTURE_LAYER::REFDIST */
3477 uint32_t num_reference_pictures: 1;/* PICTURE_LAYER::NUMREF */
3478 uint32_t reference_field_pic_indicator : 1;/* PICTURE_LAYER::REFFIELD */
3479 } bits;
3480 uint32_t value;
3481 } reference_fields;
3482 union {
3483 struct {
3484 uint32_t mv_mode : 3; /* PICTURE_LAYER::MVMODE */
3485 uint32_t mv_mode2 : 3; /* PICTURE_LAYER::MVMODE2 */
3486 uint32_t mv_table : 3; /* PICTURE_LAYER::MVTAB/IMVTAB */
3487 uint32_t two_mv_block_pattern_table: 2; /* PICTURE_LAYER::2MVBPTAB */
3488 uint32_t four_mv_switch : 1; /* PICTURE_LAYER::4MVSWITCH */
3489 uint32_t four_mv_block_pattern_table : 2; /* PICTURE_LAYER::4MVBPTAB */
3490 uint32_t extended_mv_flag : 1; /* ENTRY_POINT_LAYER::EXTENDED_MV */
3491 uint32_t extended_mv_range : 2; /* PICTURE_LAYER::MVRANGE */
3492 uint32_t extended_dmv_flag : 1; /* ENTRY_POINT_LAYER::EXTENDED_DMV */
3493 uint32_t extended_dmv_range : 2; /* PICTURE_LAYER::DMVRANGE */
3494 } bits;
3495 uint32_t value;
3496 } mv_fields;
3497 union {
3498 struct {
3499 uint32_t dquant : 2; /* ENTRY_POINT_LAYER::DQUANT */
3500 uint32_t quantizer : 2; /* ENTRY_POINT_LAYER::QUANTIZER */
3501 uint32_t half_qp : 1; /* PICTURE_LAYER::HALFQP */
3502 uint32_t pic_quantizer_scale : 5;/* PICTURE_LAYER::PQUANT */
3503 uint32_t pic_quantizer_type : 1;/* PICTURE_LAYER::PQUANTIZER */
3504 uint32_t dq_frame : 1; /* VOPDQUANT::DQUANTFRM */
3505 uint32_t dq_profile : 2; /* VOPDQUANT::DQPROFILE */
3506 uint32_t dq_sb_edge : 2; /* VOPDQUANT::DQSBEDGE */
3507 uint32_t dq_db_edge : 2; /* VOPDQUANT::DQDBEDGE */
3508 uint32_t dq_binary_level : 1; /* VOPDQUANT::DQBILEVEL */
3509 uint32_t alt_pic_quantizer : 5;/* VOPDQUANT::ALTPQUANT */
3510 } bits;
3511 uint32_t value;
3512 } pic_quantizer_fields;
3513 union {
3514 struct {
3515 uint32_t variable_sized_transform_flag : 1;/* ENTRY_POINT_LAYER::VSTRANSFORM */
3516 uint32_t mb_level_transform_type_flag : 1;/* PICTURE_LAYER::TTMBF */
3517 uint32_t frame_level_transform_type : 2;/* PICTURE_LAYER::TTFRM */
3518 uint32_t transform_ac_codingset_idx1 : 2;/* PICTURE_LAYER::TRANSACFRM */
3519 uint32_t transform_ac_codingset_idx2 : 2;/* PICTURE_LAYER::TRANSACFRM2 */
3520 uint32_t intra_transform_dc_table : 1;/* PICTURE_LAYER::TRANSDCTAB */
3521 } bits;
3522 uint32_t value;
3523 } transform_fields;
3524
3525 uint8_t luma_scale2; /* PICTURE_LAYER::LUMSCALE2 */
3526 uint8_t luma_shift2; /* PICTURE_LAYER::LUMSHIFT2 */
3527 uint8_t intensity_compensation_field; /* Index for PICTURE_LAYER::INTCOMPFIELD value in Table 109 (9.1.1.48) */
3528
3529 /** \brief Reserved bytes for future use, must be zero */
3530 uint32_t va_reserved[VA_PADDING_MEDIUM - 1];
3531 } VAPictureParameterBufferVC1;
3532
3533 /** VC-1 Bitplane Buffer
3534 There will be at most three bitplanes coded in any picture header. To send
3535 the bitplane data more efficiently, each byte is divided in two nibbles, with
3536 each nibble carrying three bitplanes for one macroblock. The following table
3537 shows the bitplane data arrangement within each nibble based on the picture
3538 type.
3539
3540 Picture Type Bit3 Bit2 Bit1 Bit0
3541 I or BI OVERFLAGS ACPRED FIELDTX
3542 P MYTYPEMB SKIPMB DIRECTMB
3543 B FORWARDMB SKIPMB DIRECTMB
3544
3545 Within each byte, the lower nibble is for the first MB and the upper nibble is
3546 for the second MB. E.g. the lower nibble of the first byte in the bitplane
3547 buffer is for Macroblock #1 and the upper nibble of the first byte is for
3548 Macroblock #2 in the first row.
3549 */
3550
3551 /* VC-1 Slice Parameter Buffer */
3552 typedef struct _VASliceParameterBufferVC1 {
3553 uint32_t slice_data_size;/* number of bytes in the slice data buffer for this slice */
3554 uint32_t slice_data_offset;/* the offset to the first byte of slice data */
3555 uint32_t slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
3556 uint32_t macroblock_offset;/* the offset to the first bit of MB from the first byte of slice data */
3557 uint32_t slice_vertical_position;
3558
3559 /** \brief Reserved bytes for future use, must be zero */
3560 uint32_t va_reserved[VA_PADDING_LOW];
3561 } VASliceParameterBufferVC1;
3562
3563 /* VC-1 Slice Data Buffer */
3564 /*
3565 This is simplely a buffer containing raw bit-stream bytes
3566 */
3567
3568 /****************************
3569 * H.264/AVC data structures
3570 ****************************/
3571
3572 typedef struct _VAPictureH264 {
3573 VASurfaceID picture_id;
3574 uint32_t frame_idx;
3575 uint32_t flags;
3576 int32_t TopFieldOrderCnt;
3577 int32_t BottomFieldOrderCnt;
3578
3579 /** \brief Reserved bytes for future use, must be zero */
3580 uint32_t va_reserved[VA_PADDING_LOW];
3581 } VAPictureH264;
3582 /* flags in VAPictureH264 could be OR of the following */
3583 #define VA_PICTURE_H264_INVALID 0x00000001
3584 #define VA_PICTURE_H264_TOP_FIELD 0x00000002
3585 #define VA_PICTURE_H264_BOTTOM_FIELD 0x00000004
3586 #define VA_PICTURE_H264_SHORT_TERM_REFERENCE 0x00000008
3587 #define VA_PICTURE_H264_LONG_TERM_REFERENCE 0x00000010
3588
3589 /** H.264 Picture Parameter Buffer */
3590 /*
3591 * For each picture, and before any slice data, a single
3592 * picture parameter buffer must be send.
3593 */
3594 typedef struct _VAPictureParameterBufferH264 {
3595 VAPictureH264 CurrPic;
3596 VAPictureH264 ReferenceFrames[16]; /* in DPB */
3597 uint16_t picture_width_in_mbs_minus1;
3598 uint16_t picture_height_in_mbs_minus1;
3599 uint8_t bit_depth_luma_minus8;
3600 uint8_t bit_depth_chroma_minus8;
3601 uint8_t num_ref_frames;
3602 union {
3603 struct {
3604 uint32_t chroma_format_idc : 2;
3605 uint32_t residual_colour_transform_flag : 1; /* Renamed to separate_colour_plane_flag in newer standard versions. */
3606 uint32_t gaps_in_frame_num_value_allowed_flag : 1;
3607 uint32_t frame_mbs_only_flag : 1;
3608 uint32_t mb_adaptive_frame_field_flag : 1;
3609 uint32_t direct_8x8_inference_flag : 1;
3610 uint32_t MinLumaBiPredSize8x8 : 1; /* see A.3.3.2 */
3611 uint32_t log2_max_frame_num_minus4 : 4;
3612 uint32_t pic_order_cnt_type : 2;
3613 uint32_t log2_max_pic_order_cnt_lsb_minus4 : 4;
3614 uint32_t delta_pic_order_always_zero_flag : 1;
3615 } bits;
3616 uint32_t value;
3617 } seq_fields;
3618 // FMO is not supported.
3619 va_deprecated uint8_t num_slice_groups_minus1;
3620 va_deprecated uint8_t slice_group_map_type;
3621 va_deprecated uint16_t slice_group_change_rate_minus1;
3622 int8_t pic_init_qp_minus26;
3623 int8_t pic_init_qs_minus26;
3624 int8_t chroma_qp_index_offset;
3625 int8_t second_chroma_qp_index_offset;
3626 union {
3627 struct {
3628 uint32_t entropy_coding_mode_flag : 1;
3629 uint32_t weighted_pred_flag : 1;
3630 uint32_t weighted_bipred_idc : 2;
3631 uint32_t transform_8x8_mode_flag : 1;
3632 uint32_t field_pic_flag : 1;
3633 uint32_t constrained_intra_pred_flag : 1;
3634 uint32_t pic_order_present_flag : 1; /* Renamed to bottom_field_pic_order_in_frame_present_flag in newer standard versions. */
3635 uint32_t deblocking_filter_control_present_flag : 1;
3636 uint32_t redundant_pic_cnt_present_flag : 1;
3637 uint32_t reference_pic_flag : 1; /* nal_ref_idc != 0 */
3638 } bits;
3639 uint32_t value;
3640 } pic_fields;
3641 uint16_t frame_num;
3642
3643 /** \brief Reserved bytes for future use, must be zero */
3644 uint32_t va_reserved[VA_PADDING_MEDIUM];
3645 } VAPictureParameterBufferH264;
3646
3647 /** H.264 Inverse Quantization Matrix Buffer */
3648 typedef struct _VAIQMatrixBufferH264 {
3649 /** \brief 4x4 scaling list, in raster scan order. */
3650 uint8_t ScalingList4x4[6][16];
3651 /** \brief 8x8 scaling list, in raster scan order. */
3652 uint8_t ScalingList8x8[2][64];
3653
3654 /** \brief Reserved bytes for future use, must be zero */
3655 uint32_t va_reserved[VA_PADDING_LOW];
3656 } VAIQMatrixBufferH264;
3657
3658 /** H.264 Slice Parameter Buffer */
3659 typedef struct _VASliceParameterBufferH264 {
3660 uint32_t slice_data_size;/* number of bytes in the slice data buffer for this slice */
3661 /** \brief Byte offset to the NAL Header Unit for this slice. */
3662 uint32_t slice_data_offset;
3663 uint32_t slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
3664 /**
3665 * \brief Bit offset from NAL Header Unit to the begining of slice_data().
3666 *
3667 * This bit offset is relative to and includes the NAL unit byte
3668 * and represents the number of bits parsed in the slice_header()
3669 * after the removal of any emulation prevention bytes in
3670 * there. However, the slice data buffer passed to the hardware is
3671 * the original bitstream, thus including any emulation prevention
3672 * bytes.
3673 */
3674 uint16_t slice_data_bit_offset;
3675 uint16_t first_mb_in_slice;
3676 uint8_t slice_type;
3677 uint8_t direct_spatial_mv_pred_flag;
3678 /**
3679 * H264/AVC syntax element
3680 *
3681 * if num_ref_idx_active_override_flag equals 0, host decoder should
3682 * set its value to num_ref_idx_l0_default_active_minus1.
3683 */
3684 uint8_t num_ref_idx_l0_active_minus1;
3685 /**
3686 * H264/AVC syntax element
3687 *
3688 * if num_ref_idx_active_override_flag equals 0, host decoder should
3689 * set its value to num_ref_idx_l1_default_active_minus1.
3690 */
3691 uint8_t num_ref_idx_l1_active_minus1;
3692 uint8_t cabac_init_idc;
3693 int8_t slice_qp_delta;
3694 uint8_t disable_deblocking_filter_idc;
3695 int8_t slice_alpha_c0_offset_div2;
3696 int8_t slice_beta_offset_div2;
3697 VAPictureH264 RefPicList0[32]; /* See 8.2.4.2 */
3698 VAPictureH264 RefPicList1[32]; /* See 8.2.4.2 */
3699 uint8_t luma_log2_weight_denom;
3700 uint8_t chroma_log2_weight_denom;
3701 uint8_t luma_weight_l0_flag;
3702 int16_t luma_weight_l0[32];
3703 int16_t luma_offset_l0[32];
3704 uint8_t chroma_weight_l0_flag;
3705 int16_t chroma_weight_l0[32][2];
3706 int16_t chroma_offset_l0[32][2];
3707 uint8_t luma_weight_l1_flag;
3708 int16_t luma_weight_l1[32];
3709 int16_t luma_offset_l1[32];
3710 uint8_t chroma_weight_l1_flag;
3711 int16_t chroma_weight_l1[32][2];
3712 int16_t chroma_offset_l1[32][2];
3713
3714 /** \brief Reserved bytes for future use, must be zero */
3715 uint32_t va_reserved[VA_PADDING_LOW];
3716 } VASliceParameterBufferH264;
3717
3718 /****************************
3719 * Common encode data structures
3720 ****************************/
3721 typedef enum {
3722 VAEncPictureTypeIntra = 0,
3723 VAEncPictureTypePredictive = 1,
3724 VAEncPictureTypeBidirectional = 2,
3725 } VAEncPictureType;
3726
3727 /**
3728 * \brief Encode Slice Parameter Buffer.
3729 *
3730 * @deprecated
3731 * This is a deprecated encode slice parameter buffer, All applications
3732 * \c can use VAEncSliceParameterBufferXXX (XXX = MPEG2, HEVC, H264, JPEG)
3733 */
3734 typedef struct _VAEncSliceParameterBuffer {
3735 uint32_t start_row_number; /* starting MB row number for this slice */
3736 uint32_t slice_height; /* slice height measured in MB */
3737 union {
3738 struct {
3739 uint32_t is_intra : 1;
3740 uint32_t disable_deblocking_filter_idc : 2;
3741 uint32_t uses_long_term_ref : 1;
3742 uint32_t is_long_term_ref : 1;
3743 } bits;
3744 uint32_t value;
3745 } slice_flags;
3746
3747 /** \brief Reserved bytes for future use, must be zero */
3748 uint32_t va_reserved[VA_PADDING_LOW];
3749 } VAEncSliceParameterBuffer;
3750
3751
3752 /****************************
3753 * H.263 specific encode data structures
3754 ****************************/
3755
3756 typedef struct _VAEncSequenceParameterBufferH263 {
3757 uint32_t intra_period;
3758 uint32_t bits_per_second;
3759 uint32_t frame_rate;
3760 uint32_t initial_qp;
3761 uint32_t min_qp;
3762
3763 /** \brief Reserved bytes for future use, must be zero */
3764 uint32_t va_reserved[VA_PADDING_LOW];
3765 } VAEncSequenceParameterBufferH263;
3766
3767 typedef struct _VAEncPictureParameterBufferH263 {
3768 VASurfaceID reference_picture;
3769 VASurfaceID reconstructed_picture;
3770 VABufferID coded_buf;
3771 uint16_t picture_width;
3772 uint16_t picture_height;
3773 VAEncPictureType picture_type;
3774
3775 /** \brief Reserved bytes for future use, must be zero */
3776 uint32_t va_reserved[VA_PADDING_LOW];
3777 } VAEncPictureParameterBufferH263;
3778
3779 /****************************
3780 * MPEG-4 specific encode data structures
3781 ****************************/
3782
3783 typedef struct _VAEncSequenceParameterBufferMPEG4 {
3784 uint8_t profile_and_level_indication;
3785 uint32_t intra_period;
3786 uint32_t video_object_layer_width;
3787 uint32_t video_object_layer_height;
3788 uint32_t vop_time_increment_resolution;
3789 uint32_t fixed_vop_rate;
3790 uint32_t fixed_vop_time_increment;
3791 uint32_t bits_per_second;
3792 uint32_t frame_rate;
3793 uint32_t initial_qp;
3794 uint32_t min_qp;
3795
3796 /** \brief Reserved bytes for future use, must be zero */
3797 uint32_t va_reserved[VA_PADDING_LOW];
3798 } VAEncSequenceParameterBufferMPEG4;
3799
3800 typedef struct _VAEncPictureParameterBufferMPEG4 {
3801 VASurfaceID reference_picture;
3802 VASurfaceID reconstructed_picture;
3803 VABufferID coded_buf;
3804 uint16_t picture_width;
3805 uint16_t picture_height;
3806 uint32_t modulo_time_base; /* number of 1s */
3807 uint32_t vop_time_increment;
3808 VAEncPictureType picture_type;
3809
3810 /** \brief Reserved bytes for future use, must be zero */
3811 uint32_t va_reserved[VA_PADDING_LOW];
3812 } VAEncPictureParameterBufferMPEG4;
3813
3814
3815
3816 /** Buffer functions */
3817
3818 /**
3819 * Creates a buffer for "num_elements" elements of "size" bytes and
3820 * initalize with "data".
3821 * if "data" is null, then the contents of the buffer data store
3822 * are undefined.
3823 * Basically there are two ways to get buffer data to the server side. One is
3824 * to call vaCreateBuffer() with a non-null "data", which results the data being
3825 * copied to the data store on the server side. A different method that
3826 * eliminates this copy is to pass null as "data" when calling vaCreateBuffer(),
3827 * and then use vaMapBuffer() to map the data store from the server side to the
3828 * client address space for access.
3829 * The user must call vaDestroyBuffer() to destroy a buffer.
3830 * Note: image buffers are created by the library, not the client. Please see
3831 * vaCreateImage on how image buffers are managed.
3832 */
3833 VAStatus vaCreateBuffer(
3834 VADisplay dpy,
3835 VAContextID context,
3836 VABufferType type, /* in */
3837 unsigned int size, /* in */
3838 unsigned int num_elements, /* in */
3839 void *data, /* in */
3840 VABufferID *buf_id /* out */
3841 );
3842
3843 /**
3844 * Create a buffer for given width & height get unit_size, pitch, buf_id for 2D buffer
3845 * for permb qp buffer, it will return unit_size for one MB or LCU and the pitch for alignments
3846 * can call vaMapBuffer with this Buffer ID to get virtual address.
3847 * e.g. AVC 1080P encode, 1920x1088, the size in MB is 120x68,but inside driver,
3848 * maybe it should align with 256, and one byte present one Qp.so, call the function.
3849 * then get unit_size = 1, pitch = 256. call vaMapBuffer to get the virtual address (pBuf).
3850 * then read write the memory like 2D. the size is 256x68, application can only use 120x68
3851 * pBuf + 256 is the start of next line.
3852 * different driver implementation maybe return different unit_size and pitch
3853 */
3854 VAStatus vaCreateBuffer2(
3855 VADisplay dpy,
3856 VAContextID context,
3857 VABufferType type,
3858 unsigned int width,
3859 unsigned int height,
3860 unsigned int *unit_size,
3861 unsigned int *pitch,
3862 VABufferID *buf_id
3863 );
3864
3865 /**
3866 * Convey to the server how many valid elements are in the buffer.
3867 * e.g. if multiple slice parameters are being held in a single buffer,
3868 * this will communicate to the server the number of slice parameters
3869 * that are valid in the buffer.
3870 */
3871 VAStatus vaBufferSetNumElements(
3872 VADisplay dpy,
3873 VABufferID buf_id, /* in */
3874 unsigned int num_elements /* in */
3875 );
3876
3877
3878 /**
3879 * device independent data structure for codedbuffer
3880 */
3881
3882 /*
3883 * FICTURE_AVE_QP(bit7-0): The average Qp value used during this frame
3884 * LARGE_SLICE(bit8):At least one slice in the current frame was large
3885 * enough for the encoder to attempt to limit its size.
3886 * SLICE_OVERFLOW(bit9): At least one slice in the current frame has
3887 * exceeded the maximum slice size specified.
3888 * BITRATE_OVERFLOW(bit10): The peak bitrate was exceeded for this frame.
3889 * BITRATE_HIGH(bit11): The frame size got within the safety margin of the maximum size (VCM only)
3890 * AIR_MB_OVER_THRESHOLD: the number of MBs adapted to Intra MB
3891 */
3892 #define VA_CODED_BUF_STATUS_PICTURE_AVE_QP_MASK 0xff
3893 #define VA_CODED_BUF_STATUS_LARGE_SLICE_MASK 0x100
3894 #define VA_CODED_BUF_STATUS_SLICE_OVERFLOW_MASK 0x200
3895 #define VA_CODED_BUF_STATUS_BITRATE_OVERFLOW 0x400
3896 #define VA_CODED_BUF_STATUS_BITRATE_HIGH 0x800
3897 /**
3898 * \brief The frame has exceeded the maximum requested size.
3899 *
3900 * This flag indicates that the encoded frame size exceeds the value
3901 * specified through a misc parameter buffer of type
3902 * #VAEncMiscParameterTypeMaxFrameSize.
3903 */
3904 #define VA_CODED_BUF_STATUS_FRAME_SIZE_OVERFLOW 0x1000
3905 /**
3906 * \brief the bitstream is bad or corrupt.
3907 */
3908 #define VA_CODED_BUF_STATUS_BAD_BITSTREAM 0x8000
3909 #define VA_CODED_BUF_STATUS_AIR_MB_OVER_THRESHOLD 0xff0000
3910
3911 /**
3912 * \brief The coded buffer segment status contains frame encoding passes number
3913 *
3914 * This is the mask to get the number of encoding passes from the coded
3915 * buffer segment status.
3916 * NUMBER_PASS(bit24~bit27): the number for encoding passes executed for the coded frame.
3917 *
3918 */
3919 #define VA_CODED_BUF_STATUS_NUMBER_PASSES_MASK 0xf000000
3920
3921 /**
3922 * \brief The coded buffer segment contains a single NAL unit.
3923 *
3924 * This flag indicates that the coded buffer segment contains a
3925 * single NAL unit. This flag might be useful to the user for
3926 * processing the coded buffer.
3927 */
3928 #define VA_CODED_BUF_STATUS_SINGLE_NALU 0x10000000
3929
3930 /**
3931 * \brief Coded buffer segment.
3932 *
3933 * #VACodedBufferSegment is an element of a linked list describing
3934 * some information on the coded buffer. The coded buffer segment
3935 * could contain either a single NAL unit, or more than one NAL unit.
3936 * It is recommended (but not required) to return a single NAL unit
3937 * in a coded buffer segment, and the implementation should set the
3938 * VA_CODED_BUF_STATUS_SINGLE_NALU status flag if that is the case.
3939 */
3940 typedef struct _VACodedBufferSegment {
3941 /**
3942 * \brief Size of the data buffer in this segment (in bytes).
3943 */
3944 uint32_t size;
3945 /** \brief Bit offset into the data buffer where the video data starts. */
3946 uint32_t bit_offset;
3947 /** \brief Status set by the driver. See \c VA_CODED_BUF_STATUS_*. */
3948 uint32_t status;
3949 /** \brief Reserved for future use. */
3950 uint32_t reserved;
3951 /** \brief Pointer to the start of the data buffer. */
3952 void *buf;
3953 /**
3954 * \brief Pointer to the next #VACodedBufferSegment element,
3955 * or \c NULL if there is none.
3956 */
3957 void *next;
3958
3959 /** \brief Reserved bytes for future use, must be zero */
3960 uint32_t va_reserved[VA_PADDING_LOW];
3961 } VACodedBufferSegment;
3962
3963 /**
3964 * Map data store of the buffer into the client's address space
3965 * vaCreateBuffer() needs to be called with "data" set to NULL before
3966 * calling vaMapBuffer()
3967 *
3968 * if buffer type is VAEncCodedBufferType, pbuf points to link-list of
3969 * VACodedBufferSegment, and the list is terminated if "next" is NULL
3970 */
3971 VAStatus vaMapBuffer(
3972 VADisplay dpy,
3973 VABufferID buf_id, /* in */
3974 void **pbuf /* out */
3975 );
3976
3977 /**
3978 * Map data store of the buffer into the client's address space
3979 * this interface could be used to convey the operation hint
3980 * backend driver could use these hint to optimize the implementations
3981 */
3982
3983 /** \brief VA_MAPBUFFER_FLAG_DEFAULT is used when there are no flag specified
3984 * same as VA_MAPBUFFER_FLAG_READ | VA_MAPBUFFER_FLAG_WRITE.
3985 */
3986 #define VA_MAPBUFFER_FLAG_DEFAULT 0
3987 /** \brief application will read the surface after map */
3988 #define VA_MAPBUFFER_FLAG_READ 1
3989 /** \brief application will write the surface after map */
3990 #define VA_MAPBUFFER_FLAG_WRITE 2
3991
3992 VAStatus vaMapBuffer2(
3993 VADisplay dpy,
3994 VABufferID buf_id, /* in */
3995 void **pbuf, /* out */
3996 uint32_t flags /* in */
3997 );
3998
3999 /**
4000 * After client making changes to a mapped data store, it needs to
4001 * "Unmap" it to let the server know that the data is ready to be
4002 * consumed by the server
4003 */
4004 VAStatus vaUnmapBuffer(
4005 VADisplay dpy,
4006 VABufferID buf_id /* in */
4007 );
4008
4009 /**
4010 * After this call, the buffer is deleted and this buffer_id is no longer valid
4011 *
4012 * A buffer can be re-used and sent to the server by another Begin/Render/End
4013 * sequence if vaDestroyBuffer() is not called with this buffer.
4014 *
4015 * Note re-using a shared buffer (e.g. a slice data buffer) between the host and the
4016 * hardware accelerator can result in performance dropping.
4017 */
4018 VAStatus vaDestroyBuffer(
4019 VADisplay dpy,
4020 VABufferID buffer_id
4021 );
4022
4023 /** \brief VA buffer information */
4024 typedef struct {
4025 /** \brief Buffer handle */
4026 uintptr_t handle;
4027 /** \brief Buffer type (See \ref VABufferType). */
4028 uint32_t type;
4029 /**
4030 * \brief Buffer memory type (See \ref VASurfaceAttribMemoryType).
4031 *
4032 * On input to vaAcquireBufferHandle(), this field can serve as a hint
4033 * to specify the set of memory types the caller is interested in.
4034 * On successful return from vaAcquireBufferHandle(), the field is
4035 * updated with the best matching memory type.
4036 */
4037 uint32_t mem_type;
4038 /** \brief Size of the underlying buffer. */
4039 size_t mem_size;
4040
4041 /** \brief Reserved bytes for future use, must be zero */
4042 uint32_t va_reserved[VA_PADDING_LOW];
4043 } VABufferInfo;
4044
4045 /**
4046 * \brief Acquires buffer handle for external API usage
4047 *
4048 * Locks the VA buffer object \ref buf_id for external API usage like
4049 * EGL or OpenCL (OCL). This function is a synchronization point. This
4050 * means that any pending operation is guaranteed to be completed
4051 * prior to returning from the function.
4052 *
4053 * If the referenced VA buffer object is the backing store of a VA
4054 * surface, then this function acts as if vaSyncSurface() on the
4055 * parent surface was called first.
4056 *
4057 * The \ref VABufferInfo argument shall be zero'ed on input. On
4058 * successful output, the data structure is filled in with all the
4059 * necessary buffer level implementation details like handle, type,
4060 * memory type and memory size.
4061 *
4062 * Note: the external API implementation, or the application, can
4063 * express the memory types it is interested in by filling in the \ref
4064 * mem_type field accordingly. On successful output, the memory type
4065 * that fits best the request and that was used is updated in the \ref
4066 * VABufferInfo data structure. If none of the supplied memory types
4067 * is supported, then a \ref VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE
4068 * error is returned.
4069 *
4070 * The \ref VABufferInfo data is valid until vaReleaseBufferHandle()
4071 * is called. Besides, no additional operation is allowed on any of
4072 * the buffer parent object until vaReleaseBufferHandle() is called.
4073 * e.g. decoding into a VA surface backed with the supplied VA buffer
4074 * object \ref buf_id would fail with a \ref VA_STATUS_ERROR_SURFACE_BUSY
4075 * error.
4076 *
4077 * Possible errors:
4078 * - \ref VA_STATUS_ERROR_UNIMPLEMENTED: the VA driver implementation
4079 * does not support this interface
4080 * - \ref VA_STATUS_ERROR_INVALID_DISPLAY: an invalid display was supplied
4081 * - \ref VA_STATUS_ERROR_INVALID_BUFFER: an invalid buffer was supplied
4082 * - \ref VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE: the implementation
4083 * does not support exporting buffers of the specified type
4084 * - \ref VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE: none of the requested
4085 * memory types in \ref VABufferInfo.mem_type was supported
4086 *
4087 * @param[in] dpy the VA display
4088 * @param[in] buf_id the VA buffer
4089 * @param[in,out] buf_info the associated VA buffer information
4090 * @return VA_STATUS_SUCCESS if successful
4091 */
4092 VAStatus
4093 vaAcquireBufferHandle(VADisplay dpy, VABufferID buf_id, VABufferInfo *buf_info);
4094
4095 /**
4096 * \brief Releases buffer after usage from external API
4097 *
4098 * Unlocks the VA buffer object \ref buf_id from external API usage like
4099 * EGL or OpenCL (OCL). This function is a synchronization point. This
4100 * means that any pending operation is guaranteed to be completed
4101 * prior to returning from the function.
4102 *
4103 * The \ref VABufferInfo argument shall point to the original data
4104 * structure that was obtained from vaAcquireBufferHandle(), unaltered.
4105 * This is necessary so that the VA driver implementation could
4106 * deallocate any resources that were needed.
4107 *
4108 * In any case, returning from this function invalidates any contents
4109 * in \ref VABufferInfo. i.e. the underlyng buffer handle is no longer
4110 * valid. Therefore, VA driver implementations are free to reset this
4111 * data structure to safe defaults.
4112 *
4113 * Possible errors:
4114 * - \ref VA_STATUS_ERROR_UNIMPLEMENTED: the VA driver implementation
4115 * does not support this interface
4116 * - \ref VA_STATUS_ERROR_INVALID_DISPLAY: an invalid display was supplied
4117 * - \ref VA_STATUS_ERROR_INVALID_BUFFER: an invalid buffer was supplied
4118 * - \ref VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE: the implementation
4119 * does not support exporting buffers of the specified type
4120 *
4121 * @param[in] dpy the VA display
4122 * @param[in] buf_id the VA buffer
4123 * @return VA_STATUS_SUCCESS if successful
4124 */
4125 VAStatus
4126 vaReleaseBufferHandle(VADisplay dpy, VABufferID buf_id);
4127
4128 /** @name vaExportSurfaceHandle() flags
4129 *
4130 * @{
4131 */
4132 /** Export surface to be read by external API. */
4133 #define VA_EXPORT_SURFACE_READ_ONLY 0x0001
4134 /** Export surface to be written by external API. */
4135 #define VA_EXPORT_SURFACE_WRITE_ONLY 0x0002
4136 /** Export surface to be both read and written by external API. */
4137 #define VA_EXPORT_SURFACE_READ_WRITE 0x0003
4138 /** Export surface with separate layers.
4139 *
4140 * For example, NV12 surfaces should be exported as two separate
4141 * planes for luma and chroma.
4142 */
4143 #define VA_EXPORT_SURFACE_SEPARATE_LAYERS 0x0004
4144 /** Export surface with composed layers.
4145 *
4146 * For example, NV12 surfaces should be exported as a single NV12
4147 * composed object.
4148 */
4149 #define VA_EXPORT_SURFACE_COMPOSED_LAYERS 0x0008
4150
4151 /** @} */
4152
4153 /**
4154 * \brief Export a handle to a surface for use with an external API
4155 *
4156 * The exported handles are owned by the caller, and the caller is
4157 * responsible for freeing them when no longer needed (e.g. by closing
4158 * DRM PRIME file descriptors).
4159 *
4160 * This does not perform any synchronisation. If the contents of the
4161 * surface will be read, vaSyncSurface() must be called before doing so.
4162 * If the contents of the surface are written, then all operations must
4163 * be completed externally before using the surface again by via VA-API
4164 * functions.
4165 *
4166 * @param[in] dpy VA display.
4167 * @param[in] surface_id Surface to export.
4168 * @param[in] mem_type Memory type to export to.
4169 * @param[in] flags Combination of flags to apply
4170 * (VA_EXPORT_SURFACE_*).
4171 * @param[out] descriptor Pointer to the descriptor structure to fill
4172 * with the handle details. The type of this structure depends on
4173 * the value of mem_type.
4174 *
4175 * @return Status code:
4176 * - VA_STATUS_SUCCESS: Success.
4177 * - VA_STATUS_ERROR_INVALID_DISPLAY: The display is not valid.
4178 * - VA_STATUS_ERROR_UNIMPLEMENTED: The driver does not implement
4179 * this interface.
4180 * - VA_STATUS_ERROR_INVALID_SURFACE: The surface is not valid, or
4181 * the surface is not exportable in the specified way.
4182 * - VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE: The driver does not
4183 * support exporting surfaces to the specified memory type.
4184 */
4185 VAStatus vaExportSurfaceHandle(VADisplay dpy,
4186 VASurfaceID surface_id,
4187 uint32_t mem_type, uint32_t flags,
4188 void *descriptor);
4189
4190 /**
4191 * Render (Video Decode/Encode/Processing) Pictures
4192 *
4193 * A picture represents either a frame or a field.
4194 *
4195 * The Begin/Render/End sequence sends the video decode/encode/processing buffers
4196 * to the server
4197 */
4198
4199 /**
4200 * Get ready for a video pipeline
4201 * - decode a picture to a target surface
4202 * - encode a picture from a target surface
4203 * - process a picture to a target surface
4204 */
4205 VAStatus vaBeginPicture(
4206 VADisplay dpy,
4207 VAContextID context,
4208 VASurfaceID render_target
4209 );
4210
4211 /**
4212 * Send video decode, encode or processing buffers to the server.
4213 */
4214 VAStatus vaRenderPicture(
4215 VADisplay dpy,
4216 VAContextID context,
4217 VABufferID *buffers,
4218 int num_buffers
4219 );
4220
4221 /**
4222 * Make the end of rendering for a picture.
4223 * The server should start processing all pending operations for this
4224 * surface. This call is non-blocking. The client can start another
4225 * Begin/Render/End sequence on a different render target.
4226 * if VAContextID used in this function previously successfully passed
4227 * vaMFAddContext call, real processing will be started during vaMFSubmit
4228 */
4229 VAStatus vaEndPicture(
4230 VADisplay dpy,
4231 VAContextID context
4232 );
4233
4234 /**
4235 * Make the end of rendering for a pictures in contexts passed with submission.
4236 * The server should start processing all pending operations for contexts.
4237 * All contexts passed should be associated through vaMFAddContext
4238 * and call sequence Begin/Render/End performed.
4239 * This call is non-blocking. The client can start another
4240 * Begin/Render/End/vaMFSubmit sequence on a different render targets.
4241 * Return values:
4242 * VA_STATUS_SUCCESS - operation successful, context was removed.
4243 * VA_STATUS_ERROR_INVALID_CONTEXT - mf_context or one of contexts are invalid
4244 * due to mf_context not created or one of contexts not assotiated with mf_context
4245 * through vaAddContext.
4246 * VA_STATUS_ERROR_INVALID_PARAMETER - one of context has not submitted it's frame
4247 * through vaBeginPicture vaRenderPicture vaEndPicture call sequence.
4248 * dpy: display
4249 * mf_context: Multi-Frame context
4250 * contexts: list of contexts submitting their tasks for multi-frame operation.
4251 * num_contexts: number of passed contexts.
4252 */
4253 VAStatus vaMFSubmit(
4254 VADisplay dpy,
4255 VAMFContextID mf_context,
4256 VAContextID * contexts,
4257 int num_contexts
4258 );
4259
4260 /*
4261
4262 Synchronization
4263
4264 */
4265
4266 /**
4267 * This function blocks until all pending operations on the render target
4268 * have been completed. Upon return it is safe to use the render target for a
4269 * different picture.
4270 */
4271 VAStatus vaSyncSurface(
4272 VADisplay dpy,
4273 VASurfaceID render_target
4274 );
4275
4276 /** \brief Indicates an infinite timeout. */
4277 #define VA_TIMEOUT_INFINITE 0xFFFFFFFFFFFFFFFF
4278
4279 /**
4280 * \brief Synchronizes pending operations associated with the supplied surface.
4281 *
4282 * This function blocks during specified timeout (in nanoseconds) until
4283 * all pending operations on the render target have been completed.
4284 * If timeout is zero, the function returns immediately.
4285 *
4286 * Possible errors:
4287 * - \ref VA_STATUS_ERROR_UNIMPLEMENTED: the VA driver implementation
4288 * does not support this interface
4289 * - \ref VA_STATUS_ERROR_INVALID_DISPLAY: an invalid display was supplied
4290 * - \ref VA_STATUS_ERROR_INVALID_SURFACE: an invalid surface was supplied
4291 * - \ref VA_STATUS_ERROR_TIMEDOUT: synchronization is still in progress,
4292 * client should call the function again to complete synchronization
4293 *
4294 * @param[in] dpy the VA display
4295 * @param[in] surface the surface for which synchronization is performed
4296 * @param[in] timeout_ns the timeout in nanoseconds
4297 *
4298 */
4299 VAStatus vaSyncSurface2(
4300 VADisplay dpy,
4301 VASurfaceID surface,
4302 uint64_t timeout_ns
4303 );
4304
4305 typedef enum {
4306 VASurfaceRendering = 1, /* Rendering in progress */
4307 VASurfaceDisplaying = 2, /* Displaying in progress (not safe to render into it) */
4308 /* this status is useful if surface is used as the source */
4309 /* of an overlay */
4310 VASurfaceReady = 4, /* not being rendered or displayed */
4311 VASurfaceSkipped = 8 /* Indicate a skipped frame during encode */
4312 } VASurfaceStatus;
4313
4314 /**
4315 * Find out any pending ops on the render target
4316 */
4317 VAStatus vaQuerySurfaceStatus(
4318 VADisplay dpy,
4319 VASurfaceID render_target,
4320 VASurfaceStatus *status /* out */
4321 );
4322
4323 typedef enum {
4324 VADecodeSliceMissing = 0,
4325 VADecodeMBError = 1,
4326 VADecodeReset = 2,
4327 } VADecodeErrorType;
4328
4329 /**
4330 * Client calls vaQuerySurfaceError with VA_STATUS_ERROR_DECODING_ERROR, server side returns
4331 * an array of structure VASurfaceDecodeMBErrors, and the array is terminated by setting status=-1
4332 */
4333 typedef struct _VASurfaceDecodeMBErrors {
4334 int32_t status; /* 1 if hardware has returned detailed info below, -1 means this record is invalid */
4335 uint32_t start_mb; /* start mb address with errors */
4336 uint32_t end_mb; /* end mb address with errors */
4337 VADecodeErrorType decode_error_type;
4338 uint32_t num_mb; /* number of mbs with errors */
4339 /** \brief Reserved bytes for future use, must be zero */
4340 uint32_t va_reserved[VA_PADDING_LOW - 1];
4341 } VASurfaceDecodeMBErrors;
4342
4343 /**
4344 * After the application gets VA_STATUS_ERROR_DECODING_ERROR after calling vaSyncSurface(),
4345 * it can call vaQuerySurfaceError to find out further details on the particular error.
4346 * VA_STATUS_ERROR_DECODING_ERROR should be passed in as "error_status".
4347 *
4348 * After the applications get VA_STATUS_HW_BUSY or VA_STATUS_SUCCESSFULL from vaSyncSurface(),
4349 * it still can call vaQuerySurfaceError to find out further details to know if has real hw reset
4350 * happened on this surface since umd and kmd could recover the context from reset with success in sometimes.
4351 * VA_STATUS_HW_BUSY or VA_STATUS_SUCCESSFULL also could be passed in as "error_status".
4352 *
4353 * Upon the return, error_info will point to an array of _VASurfaceDecodeMBErrors structure,
4354 * which is allocated and filled by libVA with detailed information on the VADecodeErrorType.
4355 * The array is terminated if "status==-1" is detected.
4356 */
4357 VAStatus vaQuerySurfaceError(
4358 VADisplay dpy,
4359 VASurfaceID surface,
4360 VAStatus error_status,
4361 void **error_info
4362 );
4363
4364 /**
4365 * \brief Synchronizes pending operations associated with the supplied buffer.
4366 *
4367 * This function blocks during specified timeout (in nanoseconds) until
4368 * all pending operations on the supplied buffer have been completed.
4369 * If timeout is zero, the function returns immediately.
4370 *
4371 * Possible errors:
4372 * - \ref VA_STATUS_ERROR_UNIMPLEMENTED: the VA driver implementation
4373 * does not support this interface
4374 * - \ref VA_STATUS_ERROR_INVALID_DISPLAY: an invalid display was supplied
4375 * - \ref VA_STATUS_ERROR_INVALID_BUFFER: an invalid buffer was supplied
4376 * - \ref VA_STATUS_ERROR_TIMEDOUT: synchronization is still in progress,
4377 * client should call the function again to complete synchronization
4378 *
4379 * @param[in] dpy the VA display
4380 * @param[in] buf_id the buffer for which synchronization is performed
4381 * @param[in] timeout_ns the timeout in nanoseconds
4382 *
4383 */
4384 VAStatus vaSyncBuffer(
4385 VADisplay dpy,
4386 VABufferID buf_id,
4387 uint64_t timeout_ns
4388 );
4389
4390 /**
4391 * Notes about synchronization interfaces:
4392 * vaSyncSurface:
4393 * 1. Allows to synchronize output surface (i.e. from decoding or VP)
4394 * 2. Allows to synchronize all bitstreams being encoded from the given input surface (1->N pipelines).
4395 *
4396 * vaSyncSurface2:
4397 * 1. The same as vaSyncSurface but allows to specify a timeout
4398 *
4399 * vaSyncBuffer:
4400 * 1. Allows to synchronize output buffer (e.g. bitstream from encoding).
4401 * Comparing to vaSyncSurface this function synchronizes given bitstream only.
4402 */
4403
4404 /**
4405 * Images and Subpictures
4406 * VAImage is used to either get the surface data to client memory, or
4407 * to copy image data in client memory to a surface.
4408 * Both images, subpictures and surfaces follow the same 2D coordinate system where origin
4409 * is at the upper left corner with positive X to the right and positive Y down
4410 */
4411 #define VA_FOURCC(ch0, ch1, ch2, ch3) \
4412 ((unsigned long)(unsigned char) (ch0) | ((unsigned long)(unsigned char) (ch1) << 8) | \
4413 ((unsigned long)(unsigned char) (ch2) << 16) | ((unsigned long)(unsigned char) (ch3) << 24 ))
4414
4415 /* Pre-defined fourcc codes. */
4416
4417 /** NV12: two-plane 8-bit YUV 4:2:0.
4418 * The first plane contains Y, the second plane contains U and V in pairs of bytes.
4419 */
4420 #define VA_FOURCC_NV12 0x3231564E
4421 /** NV21: two-plane 8-bit YUV 4:2:0.
4422 * Same as NV12, but with U and V swapped.
4423 */
4424 #define VA_FOURCC_NV21 0x3132564E
4425
4426 /** AI44: packed 4-bit YA.
4427 *
4428 * The bottom half of each byte contains luma, the top half contains alpha.
4429 */
4430 #define VA_FOURCC_AI44 0x34344149
4431
4432 /** RGBA: packed 8-bit RGBA.
4433 *
4434 * Four bytes per pixel: red, green, blue, alpha.
4435 */
4436 #define VA_FOURCC_RGBA 0x41424752
4437 /** RGBX: packed 8-bit RGB.
4438 *
4439 * Four bytes per pixel: red, green, blue, unspecified.
4440 */
4441 #define VA_FOURCC_RGBX 0x58424752
4442 /** BGRA: packed 8-bit RGBA.
4443 *
4444 * Four bytes per pixel: blue, green, red, alpha.
4445 */
4446 #define VA_FOURCC_BGRA 0x41524742
4447 /** BGRX: packed 8-bit RGB.
4448 *
4449 * Four bytes per pixel: blue, green, red, unspecified.
4450 */
4451 #define VA_FOURCC_BGRX 0x58524742
4452 /** ARGB: packed 8-bit RGBA.
4453 *
4454 * Four bytes per pixel: alpha, red, green, blue.
4455 */
4456 #define VA_FOURCC_ARGB 0x42475241
4457 /** XRGB: packed 8-bit RGB.
4458 *
4459 * Four bytes per pixel: unspecified, red, green, blue.
4460 */
4461 #define VA_FOURCC_XRGB 0x42475258
4462 /** ABGR: packed 8-bit RGBA.
4463 *
4464 * Four bytes per pixel: alpha, blue, green, red.
4465 */
4466 #define VA_FOURCC_ABGR 0x52474241
4467 /** XBGR: packed 8-bit RGB.
4468 *
4469 * Four bytes per pixel: unspecified, blue, green, red.
4470 */
4471 #define VA_FOURCC_XBGR 0x52474258
4472
4473 /** UYUV: packed 8-bit YUV 4:2:2.
4474 *
4475 * Four bytes per pair of pixels: U, Y, U, V.
4476 */
4477 #define VA_FOURCC_UYVY 0x59565955
4478 /** YUY2: packed 8-bit YUV 4:2:2.
4479 *
4480 * Four bytes per pair of pixels: Y, U, Y, V.
4481 */
4482 #define VA_FOURCC_YUY2 0x32595559
4483 /** AYUV: packed 8-bit YUVA 4:4:4.
4484 *
4485 * Four bytes per pixel: A, Y, U, V.
4486 */
4487 #define VA_FOURCC_AYUV 0x56555941
4488 /** NV11: two-plane 8-bit YUV 4:1:1.
4489 *
4490 * The first plane contains Y, the second plane contains U and V in pairs of bytes.
4491 */
4492 #define VA_FOURCC_NV11 0x3131564e
4493 /** YV12: three-plane 8-bit YUV 4:2:0.
4494 *
4495 * The three planes contain Y, V and U respectively.
4496 */
4497 #define VA_FOURCC_YV12 0x32315659
4498 /** P208: two-plane 8-bit YUV 4:2:2.
4499 *
4500 * The first plane contains Y, the second plane contains U and V in pairs of bytes.
4501 */
4502 #define VA_FOURCC_P208 0x38303250
4503 /** I420: three-plane 8-bit YUV 4:2:0.
4504 *
4505 * The three planes contain Y, U and V respectively.
4506 */
4507 #define VA_FOURCC_I420 0x30323449
4508 /** YV24: three-plane 8-bit YUV 4:4:4.
4509 *
4510 * The three planes contain Y, V and U respectively.
4511 */
4512 #define VA_FOURCC_YV24 0x34325659
4513 /** YV32: four-plane 8-bit YUVA 4:4:4
4514 *
4515 * The four planes contain Y, V, U and A respectively.
4516 */
4517 #define VA_FOURCC_YV32 0x32335659
4518 /** Y800: 8-bit greyscale.
4519 */
4520 #define VA_FOURCC_Y800 0x30303859
4521 /** IMC3: three-plane 8-bit YUV 4:2:0.
4522 *
4523 * Equivalent to YV12, but with the additional constraint that the pitch of all three planes
4524 * must be the same.
4525 */
4526 #define VA_FOURCC_IMC3 0x33434D49
4527 /** 411P: three-plane 8-bit YUV 4:1:1.
4528 *
4529 * The three planes contain Y, U and V respectively.
4530 */
4531 #define VA_FOURCC_411P 0x50313134
4532 /** 411R: three-plane 8-bit YUV.
4533 *
4534 * The subsampling is the transpose of 4:1:1 - full chroma appears on every fourth line.
4535 * The three planes contain Y, U and V respectively.
4536 */
4537 #define VA_FOURCC_411R 0x52313134
4538 /** 422H: three-plane 8-bit YUV 4:2:2.
4539 *
4540 * The three planes contain Y, U and V respectively.
4541 */
4542 #define VA_FOURCC_422H 0x48323234
4543 /** 422V: three-plane 8-bit YUV 4:4:0.
4544 *
4545 * The three planes contain Y, U and V respectively.
4546 */
4547 #define VA_FOURCC_422V 0x56323234
4548 /** 444P: three-plane 8-bit YUV 4:4:4.
4549 *
4550 * The three planes contain Y, U and V respectively.
4551 */
4552 #define VA_FOURCC_444P 0x50343434
4553
4554 /** RGBP: three-plane 8-bit RGB.
4555 *
4556 * The three planes contain red, green and blue respectively.
4557 */
4558 #define VA_FOURCC_RGBP 0x50424752
4559 /** BGRP: three-plane 8-bit RGB.
4560 *
4561 * The three planes contain blue, green and red respectively.
4562 */
4563 #define VA_FOURCC_BGRP 0x50524742
4564 /** RG16: packed 5/6-bit RGB.
4565 *
4566 * Each pixel is a two-byte little-endian value.
4567 * Red, green and blue are found in bits 15:11, 10:5, 4:0 respectively.
4568 */
4569 #define VA_FOURCC_RGB565 0x36314752
4570 /** BG16: packed 5/6-bit RGB.
4571 *
4572 * Each pixel is a two-byte little-endian value.
4573 * Blue, green and red are found in bits 15:11, 10:5, 4:0 respectively.
4574 */
4575 #define VA_FOURCC_BGR565 0x36314742
4576
4577 /** Y210: packed 10-bit YUV 4:2:2.
4578 *
4579 * Eight bytes represent a pair of pixels. Each sample is a two-byte little-endian value,
4580 * with the bottom six bits ignored. The samples are in the order Y, U, Y, V.
4581 */
4582 #define VA_FOURCC_Y210 0x30313259
4583 /** Y212: packed 12-bit YUV 4:2:2.
4584 *
4585 * Eight bytes represent a pair of pixels. Each sample is a two-byte little-endian value.
4586 * The samples are in the order Y, U, Y, V.
4587 */
4588 #define VA_FOURCC_Y212 0x32313259
4589 /** Y216: packed 16-bit YUV 4:2:2.
4590 *
4591 * Eight bytes represent a pair of pixels. Each sample is a two-byte little-endian value.
4592 * The samples are in the order Y, U, Y, V.
4593 */
4594 #define VA_FOURCC_Y216 0x36313259
4595 /** Y410: packed 10-bit YUVA 4:4:4.
4596 *
4597 * Each pixel is a four-byte little-endian value.
4598 * A, V, Y, U are found in bits 31:30, 29:20, 19:10, 9:0 respectively.
4599 */
4600 #define VA_FOURCC_Y410 0x30313459
4601 /** Y412 packed 12-bit YUVA 4:4:4.
4602 *
4603 * Each pixel is a set of four samples, each of which is a two-byte little-endian value.
4604 * The samples are in the order A, V, Y, U.
4605 */
4606 #define VA_FOURCC_Y412 0x32313459
4607 /** Y416: packed 16-bit YUVA 4:4:4.
4608 *
4609 * Each pixel is a set of four samples, each of which is a two-byte little-endian value.
4610 * The samples are in the order A, V, Y, U.
4611 */
4612 #define VA_FOURCC_Y416 0x36313459
4613
4614 /** YV16: three-plane 8-bit YUV 4:2:2.
4615 *
4616 * The three planes contain Y, V and U respectively.
4617 */
4618 #define VA_FOURCC_YV16 0x36315659
4619 /** P010: two-plane 10-bit YUV 4:2:0.
4620 *
4621 * Each sample is a two-byte little-endian value with the bottom six bits ignored.
4622 * The first plane contains Y, the second plane contains U and V in pairs of samples.
4623 */
4624 #define VA_FOURCC_P010 0x30313050
4625 /** P012: two-plane 12-bit YUV 4:2:0.
4626 *
4627 * Each sample is a two-byte little-endian value with the bottom four bits ignored.
4628 * The first plane contains Y, the second plane contains U and V in pairs of samples.
4629 */
4630 #define VA_FOURCC_P012 0x32313050
4631 /** P016: two-plane 16-bit YUV 4:2:0.
4632 *
4633 * Each sample is a two-byte little-endian value. The first plane contains Y, the second
4634 * plane contains U and V in pairs of samples.
4635 */
4636 #define VA_FOURCC_P016 0x36313050
4637
4638 /** I010: three-plane 10-bit YUV 4:2:0.
4639 *
4640 * Each sample is a two-byte little-endian value with the top six bits ignored.
4641 * The three planes contain Y, V and U respectively.
4642 */
4643 #define VA_FOURCC_I010 0x30313049
4644
4645 /** IYUV: three-plane 8-bit YUV 4:2:0.
4646 *
4647 * @deprecated Use I420 instead.
4648 */
4649 #define VA_FOURCC_IYUV 0x56555949
4650 /**
4651 * 10-bit Pixel RGB formats.
4652 */
4653 #define VA_FOURCC_A2R10G10B10 0x30335241 /* VA_FOURCC('A','R','3','0') */
4654 /**
4655 * 10-bit Pixel BGR formats.
4656 */
4657 #define VA_FOURCC_A2B10G10R10 0x30334241 /* VA_FOURCC('A','B','3','0') */
4658 /**
4659 * 10-bit Pixel RGB formats without alpha.
4660 */
4661 #define VA_FOURCC_X2R10G10B10 0x30335258 /* VA_FOURCC('X','R','3','0') */
4662 /**
4663 * 10-bit Pixel BGR formats without alpha.
4664 */
4665 #define VA_FOURCC_X2B10G10R10 0x30334258 /* VA_FOURCC('X','B','3','0') */
4666
4667 /** Y8: 8-bit greyscale.
4668 *
4669 * Only a single sample, 8 bit Y plane for monochrome images
4670 */
4671 #define VA_FOURCC_Y8 0x20203859
4672 /** Y16: 16-bit greyscale.
4673 *
4674 * Only a single sample, 16 bit Y plane for monochrome images
4675 */
4676 #define VA_FOURCC_Y16 0x20363159
4677 /** VYUV: packed 8-bit YUV 4:2:2.
4678 *
4679 * Four bytes per pair of pixels: V, Y, U, V.
4680 */
4681 #define VA_FOURCC_VYUY 0x59555956
4682 /** YVYU: packed 8-bit YUV 4:2:2.
4683 *
4684 * Four bytes per pair of pixels: Y, V, Y, U.
4685 */
4686 #define VA_FOURCC_YVYU 0x55595659
4687 /** AGRB64: three-plane 16-bit ARGB 16:16:16:16
4688 *
4689 * The four planes contain: alpha, red, green, blue respectively.
4690 */
4691 #define VA_FOURCC_ARGB64 0x34475241
4692 /** ABGR64: three-plane 16-bit ABGR 16:16:16:16
4693 *
4694 * The four planes contain: alpha, blue, green, red respectively.
4695 */
4696 #define VA_FOURCC_ABGR64 0x34474241
4697 /** XYUV: packed 8-bit YUVX 4:4:4.
4698 *
4699 * Four bytes per pixel: X, Y, U, V.
4700 */
4701 #define VA_FOURCC_XYUV 0x56555958
4702 /** Q416: three-plane 16-bit YUV 4:4:4.
4703 *
4704 * The three planes contain Y, U and V respectively.
4705 */
4706 #define VA_FOURCC_Q416 0x36313451
4707
4708 /* byte order */
4709 #define VA_LSB_FIRST 1
4710 #define VA_MSB_FIRST 2
4711
4712 typedef struct _VAImageFormat {
4713 uint32_t fourcc;
4714 uint32_t byte_order; /* VA_LSB_FIRST, VA_MSB_FIRST */
4715 uint32_t bits_per_pixel;
4716 /* for RGB formats */
4717 uint32_t depth; /* significant bits per pixel */
4718 uint32_t red_mask;
4719 uint32_t green_mask;
4720 uint32_t blue_mask;
4721 uint32_t alpha_mask;
4722
4723 /** \brief Reserved bytes for future use, must be zero */
4724 uint32_t va_reserved[VA_PADDING_LOW];
4725 } VAImageFormat;
4726
4727 typedef VAGenericID VAImageID;
4728
4729 typedef struct _VAImage {
4730 VAImageID image_id; /* uniquely identify this image */
4731 VAImageFormat format;
4732 VABufferID buf; /* image data buffer */
4733 /*
4734 * Image data will be stored in a buffer of type VAImageBufferType to facilitate
4735 * data store on the server side for optimal performance. The buffer will be
4736 * created by the CreateImage function, and proper storage allocated based on the image
4737 * size and format. This buffer is managed by the library implementation, and
4738 * accessed by the client through the buffer Map/Unmap functions.
4739 */
4740 uint16_t width;
4741 uint16_t height;
4742 uint32_t data_size;
4743 uint32_t num_planes; /* can not be greater than 3 */
4744 /*
4745 * An array indicating the scanline pitch in bytes for each plane.
4746 * Each plane may have a different pitch. Maximum 3 planes for planar formats
4747 */
4748 uint32_t pitches[3];
4749 /*
4750 * An array indicating the byte offset from the beginning of the image data
4751 * to the start of each plane.
4752 */
4753 uint32_t offsets[3];
4754
4755 /* The following fields are only needed for paletted formats */
4756 int32_t num_palette_entries; /* set to zero for non-palette images */
4757 /*
4758 * Each component is one byte and entry_bytes indicates the number of components in
4759 * each entry (eg. 3 for YUV palette entries). set to zero for non-palette images
4760 */
4761 int32_t entry_bytes;
4762 /*
4763 * An array of ascii characters describing the order of the components within the bytes.
4764 * Only entry_bytes characters of the string are used.
4765 */
4766 int8_t component_order[4];
4767
4768 /** \brief Reserved bytes for future use, must be zero */
4769 uint32_t va_reserved[VA_PADDING_LOW];
4770 } VAImage;
4771
4772 /** Get maximum number of image formats supported by the implementation */
4773 int vaMaxNumImageFormats(
4774 VADisplay dpy
4775 );
4776
4777 /**
4778 * Query supported image formats
4779 * The caller must provide a "format_list" array that can hold at
4780 * least vaMaxNumImageFormats() entries. The actual number of formats
4781 * returned in "format_list" is returned in "num_formats".
4782 */
4783 VAStatus vaQueryImageFormats(
4784 VADisplay dpy,
4785 VAImageFormat *format_list, /* out */
4786 int *num_formats /* out */
4787 );
4788
4789 /**
4790 * Create a VAImage structure
4791 * The width and height fields returned in the VAImage structure may get
4792 * enlarged for some YUV formats. Upon return from this function,
4793 * image->buf has been created and proper storage allocated by the library.
4794 * The client can access the image through the Map/Unmap calls.
4795 */
4796 VAStatus vaCreateImage(
4797 VADisplay dpy,
4798 VAImageFormat *format,
4799 int width,
4800 int height,
4801 VAImage *image /* out */
4802 );
4803
4804 /**
4805 * Should call DestroyImage before destroying the surface it is bound to
4806 */
4807 VAStatus vaDestroyImage(
4808 VADisplay dpy,
4809 VAImageID image
4810 );
4811
4812 VAStatus vaSetImagePalette(
4813 VADisplay dpy,
4814 VAImageID image,
4815 /*
4816 * pointer to an array holding the palette data. The size of the array is
4817 * num_palette_entries * entry_bytes in size. The order of the components
4818 * in the palette is described by the component_order in VAImage struct
4819 */
4820 unsigned char *palette
4821 );
4822
4823 /**
4824 * Retrive surface data into a VAImage
4825 * Image must be in a format supported by the implementation
4826 */
4827 VAStatus vaGetImage(
4828 VADisplay dpy,
4829 VASurfaceID surface,
4830 int x, /* coordinates of the upper left source pixel */
4831 int y,
4832 unsigned int width, /* width and height of the region */
4833 unsigned int height,
4834 VAImageID image
4835 );
4836
4837 /**
4838 * Copy data from a VAImage to a surface
4839 * Image must be in a format supported by the implementation
4840 * Returns a VA_STATUS_ERROR_SURFACE_BUSY if the surface
4841 * shouldn't be rendered into when this is called
4842 */
4843 VAStatus vaPutImage(
4844 VADisplay dpy,
4845 VASurfaceID surface,
4846 VAImageID image,
4847 int src_x,
4848 int src_y,
4849 unsigned int src_width,
4850 unsigned int src_height,
4851 int dest_x,
4852 int dest_y,
4853 unsigned int dest_width,
4854 unsigned int dest_height
4855 );
4856
4857 /**
4858 * Derive an VAImage from an existing surface.
4859 * This interface will derive a VAImage and corresponding image buffer from
4860 * an existing VA Surface. The image buffer can then be mapped/unmapped for
4861 * direct CPU access. This operation is only possible on implementations with
4862 * direct rendering capabilities and internal surface formats that can be
4863 * represented with a VAImage. When the operation is not possible this interface
4864 * will return VA_STATUS_ERROR_OPERATION_FAILED. Clients should then fall back
4865 * to using vaCreateImage + vaPutImage to accomplish the same task in an
4866 * indirect manner.
4867 *
4868 * Implementations should only return success when the resulting image buffer
4869 * would be useable with vaMap/Unmap.
4870 *
4871 * When directly accessing a surface special care must be taken to insure
4872 * proper synchronization with the graphics hardware. Clients should call
4873 * vaQuerySurfaceStatus to insure that a surface is not the target of concurrent
4874 * rendering or currently being displayed by an overlay.
4875 *
4876 * Additionally nothing about the contents of a surface should be assumed
4877 * following a vaPutSurface. Implementations are free to modify the surface for
4878 * scaling or subpicture blending within a call to vaPutImage.
4879 *
4880 * Calls to vaPutImage or vaGetImage using the same surface from which the image
4881 * has been derived will return VA_STATUS_ERROR_SURFACE_BUSY. vaPutImage or
4882 * vaGetImage with other surfaces is supported.
4883 *
4884 * An image created with vaDeriveImage should be freed with vaDestroyImage. The
4885 * image and image buffer structures will be destroyed; however, the underlying
4886 * surface will remain unchanged until freed with vaDestroySurfaces.
4887 */
4888 VAStatus vaDeriveImage(
4889 VADisplay dpy,
4890 VASurfaceID surface,
4891 VAImage *image /* out */
4892 );
4893
4894 /**
4895 * Subpictures
4896 * Subpicture is a special type of image that can be blended
4897 * with a surface during vaPutSurface(). Subpicture can be used to render
4898 * DVD sub-titles or closed captioning text etc.
4899 */
4900
4901 typedef VAGenericID VASubpictureID;
4902
4903 /** Get maximum number of subpicture formats supported by the implementation */
4904 int vaMaxNumSubpictureFormats(
4905 VADisplay dpy
4906 );
4907
4908 /** flags for subpictures */
4909 #define VA_SUBPICTURE_CHROMA_KEYING 0x0001
4910 #define VA_SUBPICTURE_GLOBAL_ALPHA 0x0002
4911 #define VA_SUBPICTURE_DESTINATION_IS_SCREEN_COORD 0x0004
4912 /**
4913 * Query supported subpicture formats
4914 * The caller must provide a "format_list" array that can hold at
4915 * least vaMaxNumSubpictureFormats() entries. The flags arrary holds the flag
4916 * for each format to indicate additional capabilities for that format. The actual
4917 * number of formats returned in "format_list" is returned in "num_formats".
4918 * flags: returned value to indicate addtional capabilities
4919 * VA_SUBPICTURE_CHROMA_KEYING - supports chroma-keying
4920 * VA_SUBPICTURE_GLOBAL_ALPHA - supports global alpha
4921 * VA_SUBPICTURE_DESTINATION_IS_SCREEN_COORD - supports unscaled screen relative subpictures for On Screen Display
4922 */
4923
4924 VAStatus vaQuerySubpictureFormats(
4925 VADisplay dpy,
4926 VAImageFormat *format_list, /* out */
4927 unsigned int *flags, /* out */
4928 unsigned int *num_formats /* out */
4929 );
4930
4931 /**
4932 * Subpictures are created with an image associated.
4933 */
4934 VAStatus vaCreateSubpicture(
4935 VADisplay dpy,
4936 VAImageID image,
4937 VASubpictureID *subpicture /* out */
4938 );
4939
4940 /**
4941 * Destroy the subpicture before destroying the image it is assocated to
4942 */
4943 VAStatus vaDestroySubpicture(
4944 VADisplay dpy,
4945 VASubpictureID subpicture
4946 );
4947
4948 /**
4949 * Bind an image to the subpicture. This image will now be associated with
4950 * the subpicture instead of the one at creation.
4951 */
4952 VAStatus vaSetSubpictureImage(
4953 VADisplay dpy,
4954 VASubpictureID subpicture,
4955 VAImageID image
4956 );
4957
4958 /**
4959 * If chromakey is enabled, then the area where the source value falls within
4960 * the chromakey [min, max] range is transparent
4961 * The chromakey component format is the following:
4962 * For RGB: [0:7] Red [8:15] Blue [16:23] Green
4963 * For YUV: [0:7] V [8:15] U [16:23] Y
4964 * The chromakey mask can be used to mask out certain components for chromakey
4965 * comparision
4966 */
4967 VAStatus vaSetSubpictureChromakey(
4968 VADisplay dpy,
4969 VASubpictureID subpicture,
4970 unsigned int chromakey_min,
4971 unsigned int chromakey_max,
4972 unsigned int chromakey_mask
4973 );
4974
4975 /**
4976 * Global alpha value is between 0 and 1. A value of 1 means fully opaque and
4977 * a value of 0 means fully transparent. If per-pixel alpha is also specified then
4978 * the overall alpha is per-pixel alpha multiplied by the global alpha
4979 */
4980 VAStatus vaSetSubpictureGlobalAlpha(
4981 VADisplay dpy,
4982 VASubpictureID subpicture,
4983 float global_alpha
4984 );
4985
4986 /**
4987 * vaAssociateSubpicture associates the subpicture with target_surfaces.
4988 * It defines the region mapping between the subpicture and the target
4989 * surfaces through source and destination rectangles (with the same width and height).
4990 * Both will be displayed at the next call to vaPutSurface. Additional
4991 * associations before the call to vaPutSurface simply overrides the association.
4992 */
4993 VAStatus vaAssociateSubpicture(
4994 VADisplay dpy,
4995 VASubpictureID subpicture,
4996 VASurfaceID *target_surfaces,
4997 int num_surfaces,
4998 int16_t src_x, /* upper left offset in subpicture */
4999 int16_t src_y,
5000 uint16_t src_width,
5001 uint16_t src_height,
5002 int16_t dest_x, /* upper left offset in surface */
5003 int16_t dest_y,
5004 uint16_t dest_width,
5005 uint16_t dest_height,
5006 /*
5007 * whether to enable chroma-keying, global-alpha, or screen relative mode
5008 * see VA_SUBPICTURE_XXX values
5009 */
5010 uint32_t flags
5011 );
5012
5013 /**
5014 * vaDeassociateSubpicture removes the association of the subpicture with target_surfaces.
5015 */
5016 VAStatus vaDeassociateSubpicture(
5017 VADisplay dpy,
5018 VASubpictureID subpicture,
5019 VASurfaceID *target_surfaces,
5020 int num_surfaces
5021 );
5022
5023 /**
5024 * Display attributes
5025 * Display attributes are used to control things such as contrast, hue, saturation,
5026 * brightness etc. in the rendering process. The application can query what
5027 * attributes are supported by the driver, and then set the appropriate attributes
5028 * before calling vaPutSurface()
5029 *
5030 * Display attributes can also be used to query/set platform or display adaptor (vaDisplay)
5031 * related information. These attributes do not depend on vaConfig, and could not be used
5032 * for vaPutSurface. Application can use vaQueryDisplayAttributes/vaGetDisplayAttributes
5033 * at anytime after vaInitialize, but (for settable attributes) vaSetDisplayAttributes should be
5034 * called after vaInitialize and before any other function call.
5035 *
5036 * To distinguish these two types of display attributes, display adaptor related attributes
5037 * should be marked as "HW attribute" in the description.
5038 */
5039
5040 /* PowerVR IEP Lite attributes */
5041 typedef enum {
5042 VADISPLAYATTRIB_BLE_OFF = 0x00,
5043 VADISPLAYATTRIB_BLE_LOW,
5044 VADISPLAYATTRIB_BLE_MEDIUM,
5045 VADISPLAYATTRIB_BLE_HIGH,
5046 VADISPLAYATTRIB_BLE_NONE,
5047 } VADisplayAttribBLEMode;
5048
5049 /** attribute value for VADisplayAttribRotation */
5050 #define VA_ROTATION_NONE 0x00000000
5051 #define VA_ROTATION_90 0x00000001
5052 #define VA_ROTATION_180 0x00000002
5053 #define VA_ROTATION_270 0x00000003
5054 /**@}*/
5055
5056 /**
5057 * @name Mirroring directions
5058 *
5059 * Those values could be used for VADisplayAttribMirror attribute or
5060 * VAProcPipelineParameterBuffer::mirror_state.
5061
5062 */
5063 /**@{*/
5064 /** \brief No Mirroring. */
5065 #define VA_MIRROR_NONE 0x00000000
5066 /** \brief Horizontal Mirroring. */
5067 #define VA_MIRROR_HORIZONTAL 0x00000001
5068 /** \brief Vertical Mirroring. */
5069 #define VA_MIRROR_VERTICAL 0x00000002
5070 /**@}*/
5071
5072 /** attribute value for VADisplayAttribOutOfLoopDeblock */
5073 #define VA_OOL_DEBLOCKING_FALSE 0x00000000
5074 #define VA_OOL_DEBLOCKING_TRUE 0x00000001
5075
5076 /** Render mode */
5077 #define VA_RENDER_MODE_UNDEFINED 0
5078 #define VA_RENDER_MODE_LOCAL_OVERLAY 1
5079 #define VA_RENDER_MODE_LOCAL_GPU 2
5080 #define VA_RENDER_MODE_EXTERNAL_OVERLAY 4
5081 #define VA_RENDER_MODE_EXTERNAL_GPU 8
5082
5083 /** Render device */
5084 #define VA_RENDER_DEVICE_UNDEFINED 0
5085 #define VA_RENDER_DEVICE_LOCAL 1
5086 #define VA_RENDER_DEVICE_EXTERNAL 2
5087
5088 /**\brief sub device info
5089 * Sub-device is the concept basing on the "device" behind "vaDisplay".
5090 * If a device could be divided to several sub devices, the task of
5091 * decode/encode/vpp could be assigned on one sub-device. So, application
5092 * could choose the sub device before any other operations. After that,
5093 * all of the task execution/resource allocation will be dispatched to
5094 * the sub device. If application does not choose the sub device, driver
5095 * will assign one as default.
5096 *
5097 * If the value == VA_ATTRIB_NOT_SUPPORTED, it mean that the attribute
5098 * is unsupport or UNKNOWN.
5099 */
5100
5101 typedef union _VADisplayAttribValSubDevice {
5102 struct {
5103 /** \brief current sub device index, read - write */
5104 uint32_t current_sub_device : 4;
5105 /** \brief sub devices count, read - only */
5106 uint32_t sub_device_count : 4;
5107 /** \brief reserved bits for future, must be zero*/
5108 uint32_t reserved : 8;
5109 /** \brief bit mask to indicate which sub_device is available, read only
5110 * \code
5111 * VADisplayAttribValSubDevice reg;
5112 * VADisplayAttribute reg_attr;
5113 * reg_attr.type = VADisplayAttribSubDevice;
5114 * vaGetDisplayAttributes(dpy, &reg_attr, 1);
5115 * reg.value = reg_attr.value;
5116 *
5117 * for(int i = 0; i < reg.bits.sub_device_count; i ++ ){
5118 * if((1<<i) & reg.bits.sub_device_mask){
5119 * printf("sub device %d can be selected", i);
5120 * }
5121 *}
5122 * \endcode
5123 */
5124 uint32_t sub_device_mask : 16;
5125 } bits;
5126 uint32_t value;
5127 } VADisplayAttribValSubDevice;
5128
5129 /** Currently defined display attribute types */
5130 typedef enum {
5131 VADisplayAttribBrightness = 0,
5132 VADisplayAttribContrast = 1,
5133 VADisplayAttribHue = 2,
5134 VADisplayAttribSaturation = 3,
5135 /* client can specifiy a background color for the target window
5136 * the new feature of video conference,
5137 * the uncovered area of the surface is filled by this color
5138 * also it will blend with the decoded video color
5139 */
5140 VADisplayAttribBackgroundColor = 4,
5141 /*
5142 * this is a gettable only attribute. For some implementations that use the
5143 * hardware overlay, after PutSurface is called, the surface can not be
5144 * re-used until after the subsequent PutSurface call. If this is the case
5145 * then the value for this attribute will be set to 1 so that the client
5146 * will not attempt to re-use the surface right after returning from a call
5147 * to PutSurface.
5148 *
5149 * Don't use it, use flag VASurfaceDisplaying of vaQuerySurfaceStatus since
5150 * driver may use overlay or GPU alternatively
5151 */
5152 VADisplayAttribDirectSurface = 5,
5153 VADisplayAttribRotation = 6,
5154 VADisplayAttribOutofLoopDeblock = 7,
5155
5156 /* PowerVR IEP Lite specific attributes */
5157 VADisplayAttribBLEBlackMode = 8,
5158 VADisplayAttribBLEWhiteMode = 9,
5159 VADisplayAttribBlueStretch = 10,
5160 VADisplayAttribSkinColorCorrection = 11,
5161 /*
5162 * For type VADisplayAttribCSCMatrix, "value" field is a pointer to the color
5163 * conversion matrix. Each element in the matrix is float-point
5164 */
5165 VADisplayAttribCSCMatrix = 12,
5166 /* specify the constant color used to blend with video surface
5167 * Cd = Cv*Cc*Ac + Cb *(1 - Ac) C means the constant RGB
5168 * d: the final color to overwrite into the frame buffer
5169 * v: decoded video after color conversion,
5170 * c: video color specified by VADisplayAttribBlendColor
5171 * b: background color of the drawable
5172 */
5173 VADisplayAttribBlendColor = 13,
5174 /*
5175 * Indicate driver to skip painting color key or not.
5176 * only applicable if the render is overlay
5177 */
5178 VADisplayAttribOverlayAutoPaintColorKey = 14,
5179 /*
5180 * customized overlay color key, the format is RGB888
5181 * [23:16] = Red, [15:08] = Green, [07:00] = Blue.
5182 */
5183 VADisplayAttribOverlayColorKey = 15,
5184 /*
5185 * The hint for the implementation of vaPutSurface
5186 * normally, the driver could use an overlay or GPU to render the surface on the screen
5187 * this flag provides APP the flexibity to switch the render dynamically
5188 */
5189 VADisplayAttribRenderMode = 16,
5190 /*
5191 * specify if vaPutSurface needs to render into specified monitors
5192 * one example is that one external monitor (e.g. HDMI) is enabled,
5193 * but the window manager is not aware of it, and there is no associated drawable
5194 */
5195 VADisplayAttribRenderDevice = 17,
5196 /*
5197 * specify vaPutSurface render area if there is no drawable on the monitor
5198 */
5199 VADisplayAttribRenderRect = 18,
5200 /*
5201 * HW attribute, read/write, specify the sub device configure
5202 */
5203 VADisplayAttribSubDevice = 19,
5204 /*
5205 * HW attribute. read only. specify whether vaCopy support on current HW
5206 * The value of each bit should equal to 1 << VA_EXEC_MODE_XXX to represent
5207 * modes of vaCopy
5208 */
5209 VADisplayAttribCopy = 20,
5210 /*
5211 * HW attribute. read only. retrieve the device information from backend driver
5212 * the value should be combined with vendor ID << 16 | device ID
5213 */
5214 VADisplayPCIID = 21,
5215 } VADisplayAttribType;
5216
5217 /* flags for VADisplayAttribute */
5218 #define VA_DISPLAY_ATTRIB_NOT_SUPPORTED 0x0000
5219 #define VA_DISPLAY_ATTRIB_GETTABLE 0x0001
5220 #define VA_DISPLAY_ATTRIB_SETTABLE 0x0002
5221
5222 typedef struct _VADisplayAttribute {
5223 VADisplayAttribType type;
5224 int32_t min_value;
5225 int32_t max_value;
5226 int32_t value; /* used by the set/get attribute functions */
5227 /* flags can be VA_DISPLAY_ATTRIB_GETTABLE or VA_DISPLAY_ATTRIB_SETTABLE or OR'd together */
5228 uint32_t flags;
5229
5230 /** \brief Reserved bytes for future use, must be zero */
5231 uint32_t va_reserved[VA_PADDING_LOW];
5232 } VADisplayAttribute;
5233
5234 /** Get maximum number of display attributs supported by the implementation */
5235 int vaMaxNumDisplayAttributes(
5236 VADisplay dpy
5237 );
5238
5239 /**
5240 * Query display attributes
5241 * The caller must provide a "attr_list" array that can hold at
5242 * least vaMaxNumDisplayAttributes() entries. The actual number of attributes
5243 * returned in "attr_list" is returned in "num_attributes".
5244 */
5245 VAStatus vaQueryDisplayAttributes(
5246 VADisplay dpy,
5247 VADisplayAttribute *attr_list, /* out */
5248 int *num_attributes /* out */
5249 );
5250
5251 /**
5252 * Get display attributes
5253 * This function returns the current attribute values in "attr_list".
5254 * Only attributes returned with VA_DISPLAY_ATTRIB_GETTABLE set in the "flags" field
5255 * from vaQueryDisplayAttributes() can have their values retrieved.
5256 */
5257 VAStatus vaGetDisplayAttributes(
5258 VADisplay dpy,
5259 VADisplayAttribute *attr_list, /* in/out */
5260 int num_attributes
5261 );
5262
5263 /**
5264 * Set display attributes
5265 * Only attributes returned with VA_DISPLAY_ATTRIB_SETTABLE set in the "flags" field
5266 * from vaQueryDisplayAttributes() can be set. If the attribute is not settable or
5267 * the value is out of range, the function returns VA_STATUS_ERROR_ATTR_NOT_SUPPORTED
5268 */
5269 VAStatus vaSetDisplayAttributes(
5270 VADisplay dpy,
5271 VADisplayAttribute *attr_list,
5272 int num_attributes
5273 );
5274
5275 /****************************
5276 * HEVC data structures
5277 ****************************/
5278 /**
5279 * \brief Description of picture properties of those in DPB surfaces.
5280 *
5281 * If only progressive scan is supported, each surface contains one whole
5282 * frame picture.
5283 * Otherwise, each surface contains two fields of whole picture.
5284 * In this case, two entries of ReferenceFrames[] may share same picture_id
5285 * value.
5286 */
5287 typedef struct _VAPictureHEVC {
5288 /** \brief reconstructed picture buffer surface index
5289 * invalid when taking value VA_INVALID_SURFACE.
5290 */
5291 VASurfaceID picture_id;
5292 /** \brief picture order count.
5293 * in HEVC, POCs for top and bottom fields of same picture should
5294 * take different values.
5295 */
5296 int32_t pic_order_cnt;
5297 /* described below */
5298 uint32_t flags;
5299
5300 /** \brief Reserved bytes for future use, must be zero */
5301 uint32_t va_reserved[VA_PADDING_LOW];
5302 } VAPictureHEVC;
5303
5304 /* flags in VAPictureHEVC could be OR of the following */
5305 #define VA_PICTURE_HEVC_INVALID 0x00000001
5306 /** \brief indication of interlace scan picture.
5307 * should take same value for all the pictures in sequence.
5308 */
5309 #define VA_PICTURE_HEVC_FIELD_PIC 0x00000002
5310 /** \brief polarity of the field picture.
5311 * top field takes even lines of buffer surface.
5312 * bottom field takes odd lines of buffer surface.
5313 */
5314 #define VA_PICTURE_HEVC_BOTTOM_FIELD 0x00000004
5315 /** \brief Long term reference picture */
5316 #define VA_PICTURE_HEVC_LONG_TERM_REFERENCE 0x00000008
5317 /**
5318 * VA_PICTURE_HEVC_RPS_ST_CURR_BEFORE, VA_PICTURE_HEVC_RPS_ST_CURR_AFTER
5319 * and VA_PICTURE_HEVC_RPS_LT_CURR of any picture in ReferenceFrames[] should
5320 * be exclusive. No more than one of them can be set for any picture.
5321 * Sum of NumPocStCurrBefore, NumPocStCurrAfter and NumPocLtCurr
5322 * equals NumPocTotalCurr, which should be equal to or smaller than 8.
5323 * Application should provide valid values for both short format and long format.
5324 * The pictures in DPB with any of these three flags turned on are referred by
5325 * the current picture.
5326 */
5327 /** \brief RefPicSetStCurrBefore of HEVC spec variable
5328 * Number of ReferenceFrames[] entries with this bit set equals
5329 * NumPocStCurrBefore.
5330 */
5331 #define VA_PICTURE_HEVC_RPS_ST_CURR_BEFORE 0x00000010
5332 /** \brief RefPicSetStCurrAfter of HEVC spec variable
5333 * Number of ReferenceFrames[] entries with this bit set equals
5334 * NumPocStCurrAfter.
5335 */
5336 #define VA_PICTURE_HEVC_RPS_ST_CURR_AFTER 0x00000020
5337 /** \brief RefPicSetLtCurr of HEVC spec variable
5338 * Number of ReferenceFrames[] entries with this bit set equals
5339 * NumPocLtCurr.
5340 */
5341 #define VA_PICTURE_HEVC_RPS_LT_CURR 0x00000040
5342
5343 /****************************
5344 * VVC data structures
5345 ****************************/
5346 /**
5347 * \brief Description of picture properties of those in DPB surfaces.
5348 *
5349 * Only progressive scan is supported, each surface contains one whole
5350 * frame picture.
5351 */
5352
5353 typedef struct _VAPictureVVC {
5354 /** \brief reconstructed picture buffer surface index
5355 * invalid when taking value VA_INVALID_SURFACE.
5356 */
5357 VASurfaceID picture_id;
5358
5359 /** \brief picture order count. */
5360 int32_t pic_order_cnt;
5361
5362 /* described below */
5363 uint32_t flags;
5364
5365 /** \brief Reserved bytes for future use, must be zero */
5366 uint32_t va_reserved[VA_PADDING_LOW];
5367 } VAPictureVVC;
5368
5369 /* flags in VAPictureVVC could be OR of the following */
5370 #define VA_PICTURE_VVC_INVALID 0x00000001
5371 /** \brief Long term reference picture */
5372 #define VA_PICTURE_VVC_LONG_TERM_REFERENCE 0x00000002
5373 /** \brief Unavailable reference picture
5374 * This flag indicates the situation that the process of
5375 * "generating unavailable reference pictures" (spec section 8.3.4)
5376 * is required.
5377 */
5378 #define VA_PICTURE_VVC_UNAVAILABLE_REFERENCE 0x00000004
5379
5380 typedef enum {
5381 VACopyObjectSurface = 0,
5382 VACopyObjectBuffer = 1,
5383 } VACopyObjectType;
5384
5385 typedef struct _VACopyObject {
5386 VACopyObjectType obj_type; // type of object.
5387 union {
5388 VASurfaceID surface_id;
5389 VABufferID buffer_id;
5390 } object;
5391
5392 uint32_t va_reserved[VA_PADDING_MEDIUM];
5393 } VACopyObject;
5394
5395 typedef union _VACopyOption {
5396 struct {
5397 /** \brief va copy synchronization, the value should be /c VA_EXEC_SYNC or /c VA_EXEC_ASYNC */
5398 uint32_t va_copy_sync : 2;
5399 /** \brief va copy mode, the value should be VA_EXEC_MODE_XXX */
5400 uint32_t va_copy_mode : 4;
5401 uint32_t reserved : 26;
5402 } bits;
5403 uint32_t value;
5404 } VACopyOption;
5405
5406 /** \brief Copies an object.
5407 *
5408 * Copies specified object (surface or buffer). If non-blocking copy
5409 * is requested (VA_COPY_NONBLOCK), then need vaSyncBuffer or vaSyncSurface/vaSyncSurface2
5410 * to sync the destination object.
5411 *
5412 * @param[in] dpy the VA display
5413 * @param[in] dst Destination object to copy to
5414 * @param[in] src Source object to copy from
5415 * @param[in] option VA copy option
5416 * @return VA_STATUS_SUCCESS if successful
5417 */
5418 VAStatus vaCopy(VADisplay dpy, VACopyObject * dst, VACopyObject * src, VACopyOption option);
5419
5420 #include <va/va_dec_hevc.h>
5421 #include <va/va_dec_jpeg.h>
5422 #include <va/va_dec_vp8.h>
5423 #include <va/va_dec_vp9.h>
5424 #include <va/va_dec_av1.h>
5425 #include <va/va_dec_vvc.h>
5426 #include <va/va_enc_hevc.h>
5427 #include <va/va_fei_hevc.h>
5428 #include <va/va_enc_h264.h>
5429 #include <va/va_enc_jpeg.h>
5430 #include <va/va_enc_mpeg2.h>
5431 #include <va/va_enc_vp8.h>
5432 #include <va/va_enc_vp9.h>
5433 #include <va/va_enc_av1.h>
5434 #include <va/va_fei.h>
5435 #include <va/va_fei_h264.h>
5436 #include <va/va_vpp.h>
5437 #include <va/va_prot.h>
5438
5439 /**@}*/
5440
5441 #ifdef __cplusplus
5442 }
5443 #endif
5444
5445 #endif /* _VA_H_ */