OSDN Git Service

va.h: fix comments error for arbitrary number of MBs per slice.
[android-x86/hardware-intel-common-libva.git] / va / va.h
diff --git a/va/va.h b/va/va.h
index 20d4ef8..a0eb02f 100644 (file)
--- a/va/va.h
+++ b/va/va.h
@@ -78,6 +78,8 @@
 #ifndef _VA_H_
 #define _VA_H_
 
+#include <stddef.h>
+#include <stdint.h>
 #include <va/va_version.h>
 
 #ifdef __cplusplus
@@ -97,7 +99,6 @@ extern "C" {
  *
  * VA-API is split into several modules:
  * - \ref api_core
- * - \ref api_enc_core
  * - \ref api_enc_h264
  * - \ref api_vpp
  */
@@ -108,7 +109,7 @@ extern "C" {
  * @{
  */
 
-/* 
+/**
 Overview 
 
 The VA API is intended to provide an interface between a video decode/encode/display
@@ -138,8 +139,8 @@ Initialization & Configuration Management
 
 typedef void* VADisplay;       /* window system dependent */
 
-typedef int VAStatus;  /* Return status type from functions */
-/* Values for the return status */
+typedef int VAStatus;  /** Return status type from functions */
+/** Values for the return status */
 #define VA_STATUS_SUCCESS                      0x00000000
 #define VA_STATUS_ERROR_OPERATION_FAILED       0x00000001
 #define VA_STATUS_ERROR_ALLOCATION_FAILED      0x00000002
@@ -178,15 +179,17 @@ typedef int VAStatus;     /* Return status type from functions */
 /** \brief An invalid filter chain was supplied. */
 #define VA_STATUS_ERROR_INVALID_FILTER_CHAIN    0x00000021
 /** \brief Indicate HW busy (e.g. run multiple encoding simultaneously). */
-#define VA_STATUS_ERROR_HW_BUSY                 0x00000022
+#define VA_STATUS_ERROR_HW_BUSY                        0x00000022
+/** \brief An unsupported memory type was supplied. */
+#define VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE 0x00000024
 #define VA_STATUS_ERROR_UNKNOWN                        0xFFFFFFFF
 
-/* De-interlacing flags for vaPutSurface() */
+/** De-interlacing flags for vaPutSurface() */
 #define VA_FRAME_PICTURE        0x00000000 
 #define VA_TOP_FIELD            0x00000001
 #define VA_BOTTOM_FIELD         0x00000002
 
-/*
+/**
  * Enabled the positioning/cropping/blending feature:
  * 1, specify the video playback position in the isurface
  * 2, specify the cropping info for video playback
@@ -194,31 +197,55 @@ typedef int VAStatus;     /* Return status type from functions */
  */
 #define VA_ENABLE_BLEND         0x00000004 /* video area blend with the constant color */ 
     
-/*
+/**
  * Clears the drawable with background color.
  * for hardware overlay based implementation this flag
  * can be used to turn off the overlay
  */
 #define VA_CLEAR_DRAWABLE       0x00000008
 
-/* Color space conversion flags for vaPutSurface() */
+/** Color space conversion flags for vaPutSurface() */
+#define VA_SRC_COLOR_MASK       0x000000f0
 #define VA_SRC_BT601            0x00000010
 #define VA_SRC_BT709            0x00000020
 #define VA_SRC_SMPTE_240        0x00000040
 
-/* Scaling flags for vaPutSurface() */
+/** Scaling flags for vaPutSurface() */
 #define VA_FILTER_SCALING_DEFAULT       0x00000000
 #define VA_FILTER_SCALING_FAST          0x00000100
 #define VA_FILTER_SCALING_HQ            0x00000200
 #define VA_FILTER_SCALING_NL_ANAMORPHIC 0x00000300
 #define VA_FILTER_SCALING_MASK          0x00000f00
 
-/*
+/**
  * Returns a short english description of error_status
  */
 const char *vaErrorStr(VAStatus error_status);
 
-/*
+typedef struct _VARectangle
+{
+    short x;
+    short y;
+    unsigned short width;
+    unsigned short height;
+} VARectangle;
+
+/** Type of a message callback, used for both error and info log. */
+typedef void (*vaMessageCallback)(const char *message);
+
+/**
+ * Set the callback for error messages, or NULL for no logging.
+ * Returns the previous one, or NULL if it was disabled.
+ */
+vaMessageCallback vaSetErrorCallback(vaMessageCallback);
+
+/**
+ * Set the callback for info messages, or NULL for no logging.
+ * Returns the previous one, or NULL if it was disabled.
+ */
+vaMessageCallback vaSetInfoCallback(vaMessageCallback);
+
+/**
  * Initialization:
  * A display must be obtained by calling vaGetDisplay() before calling
  * vaInitialize() and other functions. This connects the API to the 
@@ -228,8 +255,15 @@ const char *vaErrorStr(VAStatus error_status);
 typedef void* VANativeDisplay; /* window system dependent */
 
 int vaDisplayIsValid(VADisplay dpy);
-    
-/*
+
+/**
+ *  Set the override driver name instead of queried driver driver.
+ */
+VAStatus vaSetDriverName(VADisplay dpy,
+                         char *driver_name
+);
+
+/**
  * Initialize the library 
  */
 VAStatus vaInitialize (
@@ -238,14 +272,14 @@ VAStatus vaInitialize (
     int *minor_version          /* out */
 );
 
-/*
+/**
  * After this call, all library internal resources will be cleaned up
  */ 
 VAStatus vaTerminate (
     VADisplay dpy
 );
 
-/*
+/**
  * vaQueryVendorString returns a pointer to a zero-terminated string
  * describing some aspects of the VA implemenation on a specific    
  * hardware accelerator. The format of the returned string is vendor
@@ -257,9 +291,9 @@ const char *vaQueryVendorString (
     VADisplay dpy
 );
 
-typedef int (*VAPrivFunc)();
+typedef int (*VAPrivFunc)(void);
 
-/*
+/**
  * Return a function pointer given a function name in the library.
  * This allows private interfaces into the library
  */ 
@@ -268,7 +302,7 @@ VAPrivFunc vaGetLibFunc (
     const char *func
 );
 
-/* Currently defined profiles */
+/** Currently defined profiles */
 typedef enum
 {
     /** \brief Profile ID used for video processing. */
@@ -286,10 +320,19 @@ typedef enum
     VAProfileVC1Advanced               = 10,
     VAProfileH263Baseline              = 11,
     VAProfileJPEGBaseline               = 12,
-    VAProfileH264ConstrainedBaseline = 13
+    VAProfileH264ConstrainedBaseline    = 13,
+    VAProfileVP8Version0_3              = 14,
+    VAProfileH264MultiviewHigh          = 15,
+    VAProfileH264StereoHigh             = 16,
+    VAProfileHEVCMain                   = 17,
+    VAProfileHEVCMain10                 = 18,
+    VAProfileVP9Profile0                = 19,
+    VAProfileVP9Profile1                = 20,
+    VAProfileVP9Profile2                = 21,
+    VAProfileVP9Profile3                = 22
 } VAProfile;
 
-/* 
+/**
  *  Currently defined entrypoints 
  */
 typedef enum
@@ -301,11 +344,19 @@ typedef enum
     VAEntrypointDeblocking     = 5,
     VAEntrypointEncSlice       = 6,    /* slice level encode */
     VAEntrypointEncPicture     = 7,    /* pictuer encode, JPEG, etc */
+    /*
+     * For an implementation that supports a low power/high performance variant
+     * for slice level encode, it can choose to expose the
+     * VAEntrypointEncSliceLP entrypoint. Certain encoding tools may not be
+     * available with this entrypoint (e.g. interlace, MBAFF) and the
+     * application can query the encoding configuration attributes to find
+     * out more details if this entrypoint is supported.
+     */
+    VAEntrypointEncSliceLP     = 8,
     VAEntrypointVideoProc       = 10,   /**< Video pre/post-processing. */
-    VAEntrypointMax
 } VAEntrypoint;
 
-/* Currently defined configuration attribute types */
+/** Currently defined configuration attribute types */
 typedef enum
 {
     VAConfigAttribRTFormat             = 0,
@@ -315,6 +366,21 @@ typedef enum
     VAConfigAttribEncryption           = 4,
     VAConfigAttribRateControl          = 5,
 
+    /** @name Attributes for decoding */
+    /**@{*/
+    /**
+     * \brief Slice Decoding mode. Read/write.
+     *
+     * This attribute determines what mode the driver supports for slice
+     * decoding, through vaGetConfigAttributes(); and what mode the user
+     * will be providing to the driver, through vaCreateConfig(), if the
+     * driver supports those. If this attribute is not set by the user then
+     * it is assumed that VA_DEC_SLICE_MODE_NORMAL mode is used.
+     *
+     * See \c VA_DEC_SLICE_MODE_xxx for the list of slice decoding modes.
+     */
+    VAConfigAttribDecSliceMode         = 6,
+
     /** @name Attributes for encoding */
     /**@{*/
     /**
@@ -384,11 +450,56 @@ typedef enum
      * through VAEncSliceParameterBufferH264::macroblock_info.
      */
     VAConfigAttribEncMacroblockInfo     = 16,
+    /**
+     * \brief JPEG encoding attribute. Read-only.
+     *
+     * This attribute exposes a number of capabilities of the underlying
+     * JPEG implementation. The attribute value is partitioned into fields as defined in the 
+     * VAConfigAttribValEncJPEG union.
+     */
+    VAConfigAttribEncJPEG             = 20,
+    /**
+     * \brief Encoding quality range attribute. Read-only.
+     *
+     * This attribute conveys whether the driver supports different quality level settings
+     * for encoding. A value less than or equal to 1 means that the encoder only has a single
+     * quality setting, and a value greater than 1 represents the number of quality levels 
+     * that can be configured. e.g. a value of 2 means there are two distinct quality levels. 
+     */
+    VAConfigAttribEncQualityRange     = 21,
+    /**
+     * \brief Encoding skip frame attribute. Read-only.
+     *
+     * This attribute conveys whether the driver supports sending skip frame parameters 
+     * (VAEncMiscParameterTypeSkipFrame) to the encoder's rate control, when the user has 
+     * externally skipped frames. 
+     */
+    VAConfigAttribEncSkipFrame        = 24,
+    /**
+     * \brief Encoding region-of-interest (ROI) attribute. Read-only.
+     *
+     * This attribute conveys whether the driver supports region-of-interest (ROI) encoding,
+     * based on user provided ROI rectangles.  The attribute value is partitioned into fields
+     * as defined in the VAConfigAttribValEncROI union.
+     *
+     * If ROI encoding is supported, the ROI information is passed to the driver using
+     * VAEncMiscParameterTypeROI.
+     */
+    VAConfigAttribEncROI              = 25,
+    /**
+     * \brief Encoding extended rate control attribute. Read-only.
+     *
+     * This attribute conveys whether the driver supports any extended rate control features
+     * The attribute value is partitioned into fields as defined in the
+     * VAConfigAttribValEncRateControlExt union.
+     */
+    VAConfigAttribEncRateControlExt   = 26,
+
     /**@}*/
     VAConfigAttribTypeMax
 } VAConfigAttribType;
 
-/*
+/**
  * Configuration attributes
  * If there is more than one value for an attribute, a default
  * value will be assigned to the attribute if the client does not
@@ -399,12 +510,15 @@ typedef struct _VAConfigAttrib {
     unsigned int value; /* OR'd flags (bits) for this attribute */
 } VAConfigAttrib;
 
-/* attribute value for VAConfigAttribRTFormat */
+/** attribute value for VAConfigAttribRTFormat */
 #define VA_RT_FORMAT_YUV420    0x00000001      
 #define VA_RT_FORMAT_YUV422    0x00000002
 #define VA_RT_FORMAT_YUV444    0x00000004
 #define VA_RT_FORMAT_YUV411    0x00000008
 #define VA_RT_FORMAT_YUV400    0x00000010
+/** YUV formats with more than 8 bpp */
+#define VA_RT_FORMAT_YUV420_10BPP      0x00000100
+/** RGB formats */
 #define VA_RT_FORMAT_RGB16     0x00010000
 #define VA_RT_FORMAT_RGB32     0x00020000
 /* RGBP covers RGBP and BGRP fourcc */ 
@@ -425,6 +539,18 @@ typedef struct _VAConfigAttrib {
 #define VA_RC_CQP                       0x00000010
 /** \brief Variable bitrate with peak rate higher than average bitrate. */
 #define VA_RC_VBR_CONSTRAINED           0x00000020
+/** \brief Macroblock based rate control.  Per MB control is decided
+ *  internally in the encoder. It may be combined with other RC modes, except CQP. */
+#define VA_RC_MB                        0x00000080
+
+/**@}*/
+
+/** @name Attribute values for VAConfigAttribDecSliceMode */
+/**@{*/
+/** \brief Driver supports normal mode for slice decoding */
+#define VA_DEC_SLICE_MODE_NORMAL       0x00000001
+/** \brief Driver supports base mode for slice decoding */
+#define VA_DEC_SLICE_MODE_BASE         0x00000002
 /**@}*/
 
 /** @name Attribute values for VAConfigAttribEncPackedHeaders */
@@ -440,7 +566,7 @@ typedef struct _VAConfigAttrib {
 /** \brief Driver supports misc packed headers. e.g. SEI for H.264. */
 #define VA_ENC_PACKED_HEADER_MISC       0x00000008
 /** \brief Driver supports raw packed header, see VAEncPackedHeaderRawData */
-#define VA_ENC_PACKED_HEADER_RAW_DATA   0x0000000C
+#define VA_ENC_PACKED_HEADER_RAW_DATA   0x00000010
 /**@}*/
 
 /** @name Attribute values for VAConfigAttribEncInterlaced */
@@ -463,32 +589,126 @@ typedef struct _VAConfigAttrib {
 #define VA_ENC_SLICE_STRUCTURE_ARBITRARY_ROWS           0x00000000
 /** \brief Driver supports a power-of-two number of rows per slice. */
 #define VA_ENC_SLICE_STRUCTURE_POWER_OF_TWO_ROWS        0x00000001
-/** \brief Driver supports an arbitrary number of rows per slice. */
+/** \brief Driver supports an arbitrary number of macroblocks per slice. */
 #define VA_ENC_SLICE_STRUCTURE_ARBITRARY_MACROBLOCKS    0x00000002
 /**@}*/
 
-/*
+/** \brief Attribute value for VAConfigAttribEncJPEG */
+typedef union _VAConfigAttribValEncJPEG {
+    struct {
+        /** \brief set to 1 for arithmatic coding. */
+        unsigned int arithmatic_coding_mode : 1;
+        /** \brief set to 1 for progressive dct. */
+        unsigned int progressive_dct_mode : 1;
+        /** \brief set to 1 for non-interleaved. */
+        unsigned int non_interleaved_mode : 1;
+        /** \brief set to 1 for differential. */
+        unsigned int differential_mode : 1;
+        unsigned int max_num_components : 3;
+        unsigned int max_num_scans : 4;
+        unsigned int max_num_huffman_tables : 3;
+        unsigned int max_num_quantization_tables : 3;
+    } bits;
+    unsigned int value;
+} VAConfigAttribValEncJPEG;
+
+/** \brief Attribute value for VAConfigAttribEncROI */
+typedef union _VAConfigAttribValEncROI {
+    struct {
+        /** \brief The number of ROI regions supported, 0 if ROI is not supported. */
+        unsigned int num_roi_regions           : 8;
+        /**
+         * \brief A flag indicates whether ROI priority is supported
+         *
+         * \ref roi_rc_priority_support equal to 1 specifies the underlying driver supports
+         * ROI priority when VAConfigAttribRateControl != VA_RC_CQP, user can use \c roi_value
+         * in #VAEncROI to set ROI priority. \ref roi_rc_priority_support equal to 0 specifies
+         * the underlying driver doesn't support ROI priority.
+         *
+         * User should ignore \ref roi_rc_priority_support when VAConfigAttribRateControl == VA_RC_CQP
+         * because ROI delta QP is always required when VAConfigAttribRateControl == VA_RC_CQP.
+         */
+        unsigned int roi_rc_priority_support   : 1;
+        /**
+         * \brief A flag indicates whether ROI delta QP is supported
+         *
+         * \ref roi_rc_qp_delat_support equal to 1 specifies the underlying driver supports
+         * ROI delta QP when VAConfigAttribRateControl != VA_RC_CQP, user can use \c roi_value
+         * in #VAEncROI to set ROI delta QP. \ref roi_rc_qp_delat_support equal to 0 specifies
+         * the underlying driver doesn't support ROI delta QP.
+         *
+         * User should ignore \ref roi_rc_qp_delat_support when VAConfigAttribRateControl == VA_RC_CQP
+         * because ROI delta QP is always required when VAConfigAttribRateControl == VA_RC_CQP.
+         */
+        unsigned int roi_rc_qp_delat_support    : 1;
+        unsigned int reserved                   : 22;
+     } bits;
+     unsigned int value;
+} VAConfigAttribValEncROI;
+
+/** \brief Attribute value for VAConfigAttribEncRateControlExt */
+typedef union _VAConfigAttribValEncRateControlExt {
+    struct {
+        /**
+         * \brief The maximum number of temporal layers minus 1
+         *
+         * \ref max_num_temporal_layers_minus1 plus 1 specifies the maximum number of temporal
+         * layers that supported by the underlying driver. \ref max_num_temporal_layers_minus1
+         * equal to 0 implies the underlying driver doesn't support encoding with temporal layer.
+         */
+        unsigned int max_num_temporal_layers_minus1      : 8;
+
+        /**
+         * /brief support temporal layer bit-rate control flag
+         *
+         * \ref temporal_layer_bitrate_control_flag equal to 1 specifies the underlying driver
+         * can support bit-rate control per temporal layer when (#VAConfigAttribRateControl == #VA_RC_CBR ||
+         * #VAConfigAttribRateControl == #VA_RC_VBR).
+         *
+         * The underlying driver must set \ref temporal_layer_bitrate_control_flag to 0 when
+         * \c max_num_temporal_layers_minus1 is equal to 0
+         *
+         * To use bit-rate control per temporal layer, an application must send the right layer
+         * structure via #VAEncMiscParameterTemporalLayerStructure at the beginning of a coded sequence
+         * and then followed by #VAEncMiscParameterRateControl and #VAEncMiscParameterFrameRate structures
+         * for each layer, using the \c temporal_id field as the layer identifier. Otherwise
+         * the driver doesn't use bitrate control per temporal layer if an application doesn't send the
+         * layer structure via #VAEncMiscParameterTemporalLayerStructure to the driver. The driver returns
+         * VA_STATUS_ERROR_INVALID_PARAMETER if an application sends a wrong layer structure or doesn't send
+         * #VAEncMiscParameterRateControl and #VAEncMiscParameterFrameRate for each layer.
+         *
+         * The driver will ignore #VAEncMiscParameterTemporalLayerStructure and the \c temporal_id field
+         * in #VAEncMiscParameterRateControl and #VAEncMiscParameterFrameRate if
+         * \ref temporal_layer_bitrate_control_flag is equal to 0 or #VAConfigAttribRateControl == #VA_RC_CQP
+         */
+        unsigned int temporal_layer_bitrate_control_flag : 1;
+        unsigned int reserved                            : 23;
+    } bits;
+    unsigned int value;
+} VAConfigAttribValEncRateControlExt;
+
+/**
  * if an attribute is not applicable for a given
  * profile/entrypoint pair, then set the value to the following 
  */
 #define VA_ATTRIB_NOT_SUPPORTED 0x80000000
 
-/* Get maximum number of profiles supported by the implementation */
+/** Get maximum number of profiles supported by the implementation */
 int vaMaxNumProfiles (
     VADisplay dpy
 );
 
-/* Get maximum number of entrypoints supported by the implementation */
+/** Get maximum number of entrypoints supported by the implementation */
 int vaMaxNumEntrypoints (
     VADisplay dpy
 );
 
-/* Get maximum number of attributs supported by the implementation */
+/** Get maximum number of attributs supported by the implementation */
 int vaMaxNumConfigAttributes (
     VADisplay dpy
 );
 
-/* 
+/**
  * Query supported profiles 
  * The caller must provide a "profile_list" array that can hold at
  * least vaMaxNumProfile() entries. The actual number of profiles
@@ -500,7 +720,7 @@ VAStatus vaQueryConfigProfiles (
     int *num_profiles          /* out */
 );
 
-/* 
+/**
  * Query supported entrypoints for a given profile 
  * The caller must provide an "entrypoint_list" array that can hold at
  * least vaMaxNumEntrypoints() entries. The actual number of entrypoints 
@@ -513,7 +733,7 @@ VAStatus vaQueryConfigEntrypoints (
     int *num_entrypoints               /* out */
 );
 
-/* 
+/**
  * Get attributes for a given profile/entrypoint pair 
  * The caller must provide an "attrib_list" with all attributes to be 
  * retrieved.  Upon return, the attributes in "attrib_list" have been 
@@ -529,12 +749,12 @@ VAStatus vaGetConfigAttributes (
     int num_attribs
 );
 
-/* Generic ID type, can be re-typed for specific implementation */
+/** Generic ID type, can be re-typed for specific implementation */
 typedef unsigned int VAGenericID;
 
 typedef VAGenericID VAConfigID;
 
-/* 
+/**
  * Create a configuration for the decode pipeline 
  * it passes in the attribute list that specifies the attributes it cares 
  * about, with the rest taking default values.  
@@ -548,7 +768,7 @@ VAStatus vaCreateConfig (
     VAConfigID *config_id /* out */
 );
 
-/* 
+/**
  * Free resources associdated with a given config 
  */
 VAStatus vaDestroyConfig (
@@ -556,7 +776,7 @@ VAStatus vaDestroyConfig (
     VAConfigID config_id
 );
 
-/* 
+/**
  * Query all attributes for a given configuration 
  * The profile of the configuration is returned in "profile"
  * The entrypoint of the configuration is returned in "entrypoint"
@@ -574,7 +794,7 @@ VAStatus vaQueryConfigAttributes (
 );
 
 
-/*
+/**
  * Contexts and Surfaces
  *
  * Context represents a "virtual" video decode pipeline. Surfaces are render 
@@ -661,6 +881,9 @@ typedef enum {
     VASurfaceAttribMemoryType,
     /** \brief External buffer descriptor (pointer, write). */
     VASurfaceAttribExternalBufferDescriptor,
+    /** \brief Surface usage hint, gives the driver a hint of intended usage 
+     *  to optimize allocation (e.g. tiling) (int, read/write). */
+    VASurfaceAttribUsageHint,
     /** \brief Number of surface attributes. */
     VASurfaceAttribCount
 } VASurfaceAttribType;
@@ -732,40 +955,66 @@ typedef struct _VASurfaceAttribExternalBuffers {
 /** \brief Memory is protected */
 #define VA_SURFACE_EXTBUF_DESC_PROTECTED        0x80000000
 
+/** @name VASurfaceAttribUsageHint attribute usage hint flags */
+/**@{*/
+/** \brief Surface usage not indicated. */
+#define VA_SURFACE_ATTRIB_USAGE_HINT_GENERIC   0x00000000
+/** \brief Surface used by video decoder. */
+#define VA_SURFACE_ATTRIB_USAGE_HINT_DECODER   0x00000001
+/** \brief Surface used by video encoder. */
+#define VA_SURFACE_ATTRIB_USAGE_HINT_ENCODER   0x00000002
+/** \brief Surface read by video post-processing. */
+#define VA_SURFACE_ATTRIB_USAGE_HINT_VPP_READ  0x00000004
+/** \brief Surface written by video post-processing. */
+#define VA_SURFACE_ATTRIB_USAGE_HINT_VPP_WRITE         0x00000008
+/** \brief Surface used for display. */
+#define VA_SURFACE_ATTRIB_USAGE_HINT_DISPLAY   0x00000010
+
 /**@}*/
 
 /**
- * \brief Get surface attributes for the supplied config.
+ * \brief Queries surface attributes for the supplied config.
  *
- * This function retrieves the surface attributes matching the supplied
- * config. The caller shall provide an \c attrib_list with all attributes
- * to be retrieved. Upon successful return, the attributes in \c attrib_list
- * are updated with the requested value. Unknown attributes or attributes
- * that are not supported for the given config will have their \c flags
- * field set to \c VA_SURFACE_ATTRIB_NOT_SUPPORTED.
+ * Unlike vaGetSurfaceAttributes(), this function queries for all
+ * supported attributes for the supplied VA @config. In particular, if
+ * the underlying hardware supports the creation of VA surfaces in
+ * various formats, then this function will enumerate all pixel
+ * formats that are supported.
+ *
+ * The \c attrib_list array is allocated by the user and \c
+ * num_attribs shall be initialized to the number of allocated
+ * elements in that array. Upon successful return, the actual number
+ * of attributes will be overwritten into \c num_attribs. Otherwise,
+ * \c VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned and \c num_attribs
+ * is adjusted to the number of elements that would be returned if
+ * enough space was available.
+ *
+ * Note: it is perfectly valid to pass NULL to the \c attrib_list
+ * argument when vaQuerySurfaceAttributes() is used to determine the
+ * actual number of elements that need to be allocated.
  *
  * @param[in] dpy               the VA display
  * @param[in] config            the config identifying a codec or a video
  *     processing pipeline
- * @param[in,out] attrib_list   the list of attributes on input, with at
- *     least \c type fields filled in, and possibly \c value fields whenever
- *     necessary. The updated list of attributes and flags on output
- * @param[in] num_attribs       the number of attributes supplied in the
- *     \c attrib_list array
+ * @param[out] attrib_list      the output array of #VASurfaceAttrib elements
+ * @param[in,out] num_attribs   the number of elements allocated on
+ *      input, the number of elements actually filled in output
  */
 VAStatus
-vaGetSurfaceAttributes(
+vaQuerySurfaceAttributes(
     VADisplay           dpy,
     VAConfigID          config,
     VASurfaceAttrib    *attrib_list,
-    unsigned int        num_attribs
+    unsigned int       *num_attribs
 );
 
 /**
  * \brief Creates an array of surfaces
  *
  * Creates an array of surfaces. The optional list of attributes shall
- * be constructed and verified through vaGetSurfaceAttributes().
+ * be constructed and validated through vaGetSurfaceAttributes() or
+ * constructed based based on what the underlying hardware could
+ * expose through vaQuerySurfaceAttributes().
  *
  * @param[in] dpy               the VA display
  * @param[in] format            the desired surface format. See \c VA_RT_FORMAT_*
@@ -789,7 +1038,7 @@ vaCreateSurfaces(
     unsigned int        num_attribs
 );
     
-/*
+/**
  * vaDestroySurfaces - Destroy resources associated with surfaces. 
  *  Surfaces can only be destroyed after the context associated has been 
  *  destroyed.  
@@ -804,7 +1053,7 @@ VAStatus vaDestroySurfaces (
 );
 
 #define VA_PROGRESSIVE 0x1
-/*
+/**
  * vaCreateContext - Create a context
  *  dpy: display
  *  config_id: configuration for the context
@@ -827,7 +1076,7 @@ VAStatus vaCreateContext (
     VAContextID *context               /* out */
 );
 
-/*
+/**
  * vaDestroyContext - Destroy a context 
  *  dpy: display
  *  context: context to be destroyed
@@ -837,7 +1086,7 @@ VAStatus vaDestroyContext (
     VAContextID context
 );
 
-/*
+/**
  * Buffers 
  * Buffers are used to pass various types of data from the
  * client to the server. The server maintains a data store
@@ -862,6 +1111,7 @@ typedef enum
     VAProtectedSliceDataBufferType     = 10,
     VAQMatrixBufferType                 = 11,
     VAHuffmanTableBufferType            = 12,
+    VAProbabilityBufferType             = 13,
 
 /* Following are encode buffer types */
     VAEncCodedBufferType               = 21,
@@ -872,6 +1122,7 @@ typedef enum
     VAEncPackedHeaderDataBufferType     = 26,
     VAEncMiscParameterBufferType       = 27,
     VAEncMacroblockParameterBufferType = 28,
+    VAEncMacroblockMapBufferType        = 29,
 /* Following are video processing buffer types */
     /**
      * \brief Video processing pipeline parameter buffer.
@@ -906,6 +1157,14 @@ typedef enum
     VAEncMiscParameterTypeMaxFrameSize  = 4,
     /** \brief Buffer type used for HRD parameters. */
     VAEncMiscParameterTypeHRD           = 5,
+    VAEncMiscParameterTypeQualityLevel  = 6,
+    /** \brief Buffer type used for sending skip frame parameters to the encoder's
+      * rate control, when the user has externally skipped frames. */
+    VAEncMiscParameterTypeSkipFrame     = 9,
+    /** \brief Buffer type used for region-of-interest (ROI) parameters. */
+    VAEncMiscParameterTypeROI           = 10,
+    /** \brief Buffer type used for temporal layer structure */
+    VAEncMiscParameterTypeTemporalLayerStructure   = 12,
 } VAEncMiscParameterType;
 
 /** \brief Packed header type. */
@@ -939,7 +1198,7 @@ typedef struct _VAEncPackedHeaderParameterBuffer {
     unsigned char               has_emulation_bytes;
 } VAEncPackedHeaderParameterBuffer;
 
-/*
+/**
  *  For application, e.g. set a new bitrate
  *    VABufferID buf_id;
  *    VAEncMiscParameterBuffer *misc_param;
@@ -962,6 +1221,22 @@ typedef struct _VAEncMiscParameterBuffer
     unsigned int data[0];
 } VAEncMiscParameterBuffer;
 
+/** \brief Temporal layer Structure*/
+typedef struct _VAEncMiscParameterTemporalLayerStructure
+{
+    /** \brief The number of temporal layers */
+    unsigned int number_of_layers;
+    /** \brief The length of the array defining frame layer membership. Should be 1-32 */
+    unsigned int periodicity;
+    /**
+     * \brief The array indicating the layer id for each frame
+     *
+     * The layer id for the first frame in a coded sequence is always 0, so layer_id[] specifies the layer
+     * ids for frames starting from the 2nd frame.
+     */
+    unsigned int layer_id[32];
+} VAEncMiscParameterTemporalLayerStructure;
+
 
 /** \brief Rate control parameters */
 typedef struct _VAEncMiscParameterRateControl
@@ -988,6 +1263,12 @@ typedef struct _VAEncMiscParameterRateControl
             unsigned int reset : 1;
             unsigned int disable_frame_skip : 1; /* Disable frame skip in rate control mode */
             unsigned int disable_bit_stuffing : 1; /* Disable bit stuffing in rate control mode */
+            unsigned int mb_rate_control : 4; /* Control VA_RC_MB 0: default, 1: enable, 2: disable, other: reserved*/
+            /*
+             * The temporal layer that the rate control parameters are specified for.
+             */
+            unsigned int temporal_id : 8;
+            unsigned int reserved : 17;
         } bits;
         unsigned int value;
     } rc_flags;
@@ -995,10 +1276,40 @@ typedef struct _VAEncMiscParameterRateControl
 
 typedef struct _VAEncMiscParameterFrameRate
 {
+    /*
+     * The framerate is specified as a number of frames per second, as a
+     * fraction.  The denominator of the fraction is given in the top half
+     * (the high two bytes) of the framerate field, and the numerator is
+     * given in the bottom half (the low two bytes).
+     *
+     * That is:
+     * denominator = framerate >> 16 & 0xffff;
+     * numerator   = framerate & 0xffff;
+     * fps         = numerator / denominator;
+     *
+     * For example, if framerate is set to (100 << 16 | 750), this is
+     * 750 / 100, hence 7.5fps.
+     *
+     * If the denominator is zero (the high two bytes are both zero) then
+     * it takes the value one instead, so the framerate is just the integer
+     * in the low 2 bytes.
+     */
     unsigned int framerate;
+    union
+    {
+        struct
+        {
+            /*
+             * The temporal id the framerate parameters are specified for.
+             */
+            unsigned int temporal_id : 8;
+            unsigned int reserved : 24;
+         } bits;
+         unsigned int value;
+     } framerate_flags;
 } VAEncMiscParameterFrameRate;
 
-/*
+/**
  * Allow a maximum slice size to be specified (in bits).
  * The encoder will attempt to make sure that individual slices do not exceed this size
  * Or to signal applicate if the slice size exceed this size, see "status" of VACodedBufferSegment
@@ -1037,7 +1348,119 @@ typedef struct _VAEncMiscParameterBufferMaxFrameSize {
     unsigned int                max_frame_size;
 } VAEncMiscParameterBufferMaxFrameSize;
 
-/* 
+/**
+ * \brief Encoding quality level.
+ *
+ * The encoding quality could be set through this structure, if the implementation  
+ * supports multiple quality levels. The quality level set through this structure is 
+ * persistent over the entire coded sequence, or until a new structure is being sent.
+ * The quality level range can be queried through the VAConfigAttribEncQualityRange 
+ * attribute. A lower value means higher quality, and a value of 1 represents the highest 
+ * quality. The quality level setting is used as a trade-off between quality and speed/power 
+ * consumption, with higher quality corresponds to lower speed and higher power consumption. 
+ */
+typedef struct _VAEncMiscParameterBufferQualityLevel {
+    /** \brief Encoding quality level setting. When set to 0, default quality
+     * level is used.
+     */
+    unsigned int                quality_level;
+} VAEncMiscParameterBufferQualityLevel;
+
+/**
+ * \brief Encoding skip frame.
+ *
+ * The application may choose to skip frames externally to the encoder (e.g. drop completely or 
+ * code as all skip's). For rate control purposes the encoder will need to know the size and number 
+ * of skipped frames.  Skip frame(s) indicated through this structure is applicable only to the 
+ * current frame.  It is allowed for the application to still send in packed headers for the driver to 
+ * pack, although no frame will be encoded (e.g. for HW to encrypt the frame).  
+ */
+typedef struct _VAEncMiscParameterSkipFrame {
+    /** \brief Indicates skip frames as below.
+      * 0: Encode as normal, no skip.
+      * 1: One or more frames were skipped prior to the current frame, encode the current frame as normal.  
+      * 2: The current frame is to be skipped, do not encode it but pack/encrypt the packed header contents
+      *    (all except VAEncPackedHeaderSlice) which could contain actual frame contents (e.g. pack the frame 
+      *    in VAEncPackedHeaderPicture).  */
+    unsigned char               skip_frame_flag;
+    /** \brief The number of frames skipped prior to the current frame.  Valid when skip_frame_flag = 1. */
+    unsigned char               num_skip_frames;
+    /** \brief When skip_frame_flag = 1, the size of the skipped frames in bits.   When skip_frame_flag = 2, 
+      * the size of the current skipped frame that is to be packed/encrypted in bits. */
+    unsigned int                size_skip_frames;
+} VAEncMiscParameterSkipFrame;
+
+/**
+ * \brief Encoding region-of-interest (ROI).
+ *
+ * The encoding ROI can be set through VAEncMiscParameterBufferROI, if the implementation
+ * supports ROI input. The ROI set through this structure is applicable only to the
+ * current frame or field, so must be sent every frame or field to be applied.  The number of
+ * supported ROIs can be queried through the VAConfigAttribEncROI.  The encoder will use the
+ * ROI information to adjust the QP values of the MB's that fall within the ROIs.
+ */
+typedef struct _VAEncROI
+{
+        /** \brief Defines the ROI boundary in pixels, the driver will map it to appropriate
+         *  codec coding units.  It is relative to frame coordinates for the frame case and
+         *  to field coordinates for the field case. */
+        VARectangle     roi_rectangle;
+        /**
+         * \brief ROI value
+         *
+         * \ref roi_value specifies ROI delta QP or ROI priority.
+         * --  ROI delta QP is the value that will be added on top of the frame level QP.
+         * --  ROI priority specifies the priority of a region, it can be positive (more important)
+         * or negative (less important) values and is compared with non-ROI region (taken as value 0),
+         * E.g. ROI region with \ref roi_value -3 is less important than the non-ROI region (\ref roi_value
+         * implied to be 0) which is less important than ROI region with roi_value +2. For overlapping
+         * regions, the roi_value that is first in the ROI array will have priority.
+         *
+         * \ref roi_value always specifes ROI delta QP when VAConfigAttribRateControl == VA_RC_CQP, no matter
+         * the value of \c roi_value_is_qp_delta in #VAEncMiscParameterBufferROI.
+         *
+         * \ref roi_value depends on \c roi_value_is_qp_delta in #VAEncMiscParameterBufferROI when
+         * VAConfigAttribRateControl != VA_RC_CQP. \ref roi_value specifies ROI_delta QP if \c roi_value_is_qp_delta
+         * in VAEncMiscParameterBufferROI is 1, otherwise \ref roi_value specifies ROI priority.
+         */
+        char            roi_value;
+} VAEncROI;
+
+typedef struct _VAEncMiscParameterBufferROI {
+    /** \brief Number of ROIs being sent.*/
+    unsigned int        num_roi;
+
+    /** \brief Valid when VAConfigAttribRateControl != VA_RC_CQP, then the encoder's
+     *  rate control will determine actual delta QPs.  Specifies the max/min allowed delta
+     *  QPs. */
+    char                max_delta_qp;
+    char                min_delta_qp;
+
+   /** \brief Pointer to a VAEncROI array with num_roi elements.  It is relative to frame
+     *  coordinates for the frame case and to field coordinates for the field case.*/
+    VAEncROI            *roi;
+    union {
+        struct {
+            /**
+             * \brief An indication for roi value.
+             *
+             * \ref roi_value_is_qp_delta equal to 1 indicates \c roi_value in #VAEncROI should
+             * be used as ROI delta QP. \ref roi_value_is_qp_delta equal to 0 indicates \c roi_value
+             * in #VAEncROI should be used as ROI priority.
+             *
+             * \ref roi_value_is_qp_delta is only available when VAConfigAttribRateControl != VA_RC_CQP,
+             * the setting must comply with \c roi_rc_priority_support and \c roi_rc_qp_delat_support in
+             * #VAConfigAttribValEncROI. The underlying driver should ignore this field
+             * when VAConfigAttribRateControl == VA_RC_CQP.
+             */
+            uint32_t  roi_value_is_qp_delta    : 1;
+            uint32_t  reserved                 : 31;
+        } bits;
+        uint32_t value;
+    } roi_flags;
+} VAEncMiscParameterBufferROI;
+
+/**
  * There will be cases where the bitstream buffer will not have enough room to hold
  * the data for the entire slice, and the following flags will be used in the slice
  * parameter to signal to the server for the possible cases.
@@ -1058,27 +1481,44 @@ typedef struct _VASliceParameterBufferBase
     unsigned int slice_data_flag;      /* see VA_SLICE_DATA_FLAG_XXX definitions */
 } VASliceParameterBufferBase;
 
-
-/****************************
- * JEPG data structure
- ***************************/
-typedef struct _VAQMatrixBufferJPEG
-{
-    int load_lum_quantiser_matrix;
-    int load_chroma_quantiser_matrix;
-    unsigned char lum_quantiser_matrix[64];
-    unsigned char chroma_quantiser_matrix[64];
-} VAQMatrixBufferJPEG;
-
-typedef struct _VAEncPictureParameterBufferJPEG
-{
-    VASurfaceID reconstructed_picture;
-    unsigned short picture_width;
-    unsigned short picture_height;
-    VABufferID coded_buf;
-} VAEncPictureParameterBufferJPEG;
-
-#include <va/va_dec_jpeg.h>
+/**********************************
+ * JPEG common  data structures
+ **********************************/
+/**
+ * \brief Huffman table for JPEG decoding.
+ *
+ * This structure holds the complete Huffman tables. This is an
+ * aggregation of all Huffman table (DHT) segments maintained by the
+ * application. i.e. up to 2 Huffman tables are stored in there for
+ * baseline profile.
+ *
+ * The #load_huffman_table array can be used as a hint to notify the
+ * VA driver implementation about which table(s) actually changed
+ * since the last submission of this buffer.
+ */
+typedef struct _VAHuffmanTableBufferJPEGBaseline {
+    /** \brief Specifies which #huffman_table is valid. */
+    unsigned char       load_huffman_table[2];
+    /** \brief Huffman tables indexed by table identifier (Th). */
+    struct {
+        /** @name DC table (up to 12 categories) */
+        /**@{*/
+        /** \brief Number of Huffman codes of length i + 1 (Li). */
+        unsigned char   num_dc_codes[16];
+        /** \brief Value associated with each Huffman code (Vij). */
+        unsigned char   dc_values[12];
+        /**@}*/
+        /** @name AC table (2 special codes + up to 16 * 10 codes) */
+        /**@{*/
+        /** \brief Number of Huffman codes of length i + 1 (Li). */
+        unsigned char   num_ac_codes[16];
+        /** \brief Value associated with each Huffman code (Vij). */
+        unsigned char   ac_values[162];
+        /** \brief Padding to 4-byte boundaries. Must be set to zero. */
+        unsigned char   pad[2];
+        /**@}*/
+    }                   huffman_table[2];
+} VAHuffmanTableBufferJPEGBaseline;
 
 /****************************
  * MPEG-2 data structures
@@ -1118,20 +1558,28 @@ typedef struct _VAPictureParameterBufferMPEG2
     } picture_coding_extension;
 } VAPictureParameterBufferMPEG2;
 
-/* MPEG-2 Inverse Quantization Matrix Buffer */
+/** MPEG-2 Inverse Quantization Matrix Buffer */
 typedef struct _VAIQMatrixBufferMPEG2
 {
+    /** \brief Same as the MPEG-2 bitstream syntax element. */
     int load_intra_quantiser_matrix;
+    /** \brief Same as the MPEG-2 bitstream syntax element. */
     int load_non_intra_quantiser_matrix;
+    /** \brief Same as the MPEG-2 bitstream syntax element. */
     int load_chroma_intra_quantiser_matrix;
+    /** \brief Same as the MPEG-2 bitstream syntax element. */
     int load_chroma_non_intra_quantiser_matrix;
+    /** \brief Luminance intra matrix, in zig-zag scan order. */
     unsigned char intra_quantiser_matrix[64];
+    /** \brief Luminance non-intra matrix, in zig-zag scan order. */
     unsigned char non_intra_quantiser_matrix[64];
+    /** \brief Chroma intra matrix, in zig-zag scan order. */
     unsigned char chroma_intra_quantiser_matrix[64];
+    /** \brief Chroma non-intra matrix, in zig-zag scan order. */
     unsigned char chroma_non_intra_quantiser_matrix[64];
 } VAIQMatrixBufferMPEG2;
 
-/* MPEG-2 Slice Parameter Buffer */
+/** MPEG-2 Slice Parameter Buffer */
 typedef struct _VASliceParameterBufferMPEG2
 {
     unsigned int slice_data_size;/* number of bytes in the slice data buffer for this slice */
@@ -1144,7 +1592,7 @@ typedef struct _VASliceParameterBufferMPEG2
     int intra_slice_flag;
 } VASliceParameterBufferMPEG2;
 
-/* MPEG-2 Macroblock Parameter Buffer */
+/** MPEG-2 Macroblock Parameter Buffer */
 typedef struct _VAMacroblockParameterBufferMPEG2
 {
     unsigned short macroblock_address;
@@ -1191,7 +1639,7 @@ typedef struct _VAMacroblockParameterBufferMPEG2
 #define VA_MB_TYPE_MOTION_PATTERN      0x08
 #define VA_MB_TYPE_MOTION_INTRA                0x10
 
-/* 
+/**
  * MPEG-2 Residual Data Buffer 
  * For each macroblock, there wil be 64 shorts (16-bit) in the 
  * residual data buffer
@@ -1254,16 +1702,20 @@ typedef struct _VAPictureParameterBufferMPEG4
     short TRD;
 } VAPictureParameterBufferMPEG4;
 
-/* MPEG-4 Inverse Quantization Matrix Buffer */
+/** MPEG-4 Inverse Quantization Matrix Buffer */
 typedef struct _VAIQMatrixBufferMPEG4
 {
+    /** Same as the MPEG-4:2 bitstream syntax element. */
     int load_intra_quant_mat;
+    /** Same as the MPEG-4:2 bitstream syntax element. */
     int load_non_intra_quant_mat;
+    /** The matrix for intra blocks, in zig-zag scan order. */
     unsigned char intra_quant_mat[64];
+    /** The matrix for non-intra blocks, in zig-zag scan order. */
     unsigned char non_intra_quant_mat[64];
 } VAIQMatrixBufferMPEG4;
 
-/* MPEG-4 Slice Parameter Buffer */
+/** MPEG-4 Slice Parameter Buffer */
 typedef struct _VASliceParameterBufferMPEG4
 {
     unsigned int slice_data_size;/* number of bytes in the slice data buffer for this slice */
@@ -1274,7 +1726,7 @@ typedef struct _VASliceParameterBufferMPEG4
     int quant_scale;
 } VASliceParameterBufferMPEG4;
 
-/*
+/**
  VC-1 data structures
 */
 
@@ -1287,7 +1739,7 @@ typedef enum   /* see 7.1.1.32 */
     VAMvModeIntensityCompensation      = 4 
 } VAMvModeVC1;
 
-/* VC-1 Picture Parameter Buffer */
+/** VC-1 Picture Parameter Buffer */
 /* 
  * For each picture, and before any slice data, a picture parameter
  * buffer must be send. Multiple picture parameter buffers may be
@@ -1446,7 +1898,7 @@ typedef struct _VAPictureParameterBufferVC1
     } transform_fields;
 } VAPictureParameterBufferVC1;
 
-/* VC-1 Bitplane Buffer 
+/** VC-1 Bitplane Buffer
 There will be at most three bitplanes coded in any picture header. To send 
 the bitplane data more efficiently, each byte is divided in two nibbles, with
 each nibble carrying three bitplanes for one macroblock.  The following table
@@ -1498,7 +1950,7 @@ typedef struct _VAPictureH264
 #define VA_PICTURE_H264_SHORT_TERM_REFERENCE   0x00000008
 #define VA_PICTURE_H264_LONG_TERM_REFERENCE    0x00000010
 
-/* H.264 Picture Parameter Buffer */
+/** H.264 Picture Parameter Buffer */
 /* 
  * For each picture, and before any slice data, a single
  * picture parameter buffer must be send.
@@ -1553,14 +2005,16 @@ typedef struct _VAPictureParameterBufferH264
     unsigned short frame_num;
 } VAPictureParameterBufferH264;
 
-/* H.264 Inverse Quantization Matrix Buffer */
+/** H.264 Inverse Quantization Matrix Buffer */
 typedef struct _VAIQMatrixBufferH264
 {
+    /** \brief 4x4 scaling list, in raster scan order. */
     unsigned char ScalingList4x4[6][16];
+    /** \brief 8x8 scaling list, in raster scan order. */
     unsigned char ScalingList8x8[2][64];
 } VAIQMatrixBufferH264;
 
-/* 
+/**
  * H.264 Slice Group Map Buffer 
  * When VAPictureParameterBufferH264::num_slice_group_minus1 is not equal to 0,
  * A slice group map buffer should be sent for each picture if required. The buffer
@@ -1570,7 +2024,7 @@ typedef struct _VAIQMatrixBufferH264
  * in raster scan order
  */ 
 
-/* H.264 Slice Parameter Buffer */
+/** H.264 Slice Parameter Buffer */
 typedef struct _VASliceParameterBufferH264
 {
     unsigned int slice_data_size;/* number of bytes in the slice data buffer for this slice */
@@ -1699,9 +2153,9 @@ typedef struct _VAEncPictureParameterBufferMPEG4
 
 
 
-/* Buffer functions */
+/** Buffer functions */
 
-/*
+/**
  * Creates a buffer for "num_elements" elements of "size" bytes and 
  * initalize with "data".
  * if "data" is null, then the contents of the buffer data store
@@ -1712,6 +2166,7 @@ typedef struct _VAEncPictureParameterBufferMPEG4
  * eliminates this copy is to pass null as "data" when calling vaCreateBuffer(),
  * and then use vaMapBuffer() to map the data store from the server side to the
  * client address space for access.
+ * The user must call vaDestroyBuffer() to destroy a buffer.
  *  Note: image buffers are created by the library, not the client. Please see 
  *        vaCreateImage on how image buffers are managed.
  */
@@ -1725,7 +2180,7 @@ VAStatus vaCreateBuffer (
     VABufferID *buf_id /* out */
 );
 
-/*
+/**
  * Convey to the server how many valid elements are in the buffer. 
  * e.g. if multiple slice parameters are being held in a single buffer,
  * this will communicate to the server the number of slice parameters
@@ -1738,7 +2193,7 @@ VAStatus vaBufferSetNumElements (
 );
 
 
-/*
+/**
  * device independent data structure for codedbuffer
  */
 
@@ -1806,7 +2261,7 @@ typedef  struct _VACodedBufferSegment  {
     void               *next;
 } VACodedBufferSegment;
      
-/*
+/**
  * Map data store of the buffer into the client's address space
  * vaCreateBuffer() needs to be called with "data" set to NULL before
  * calling vaMapBuffer()
@@ -1820,7 +2275,7 @@ VAStatus vaMapBuffer (
     void **pbuf        /* out */
 );
 
-/*
+/**
  * After client making changes to a mapped data store, it needs to
  * "Unmap" it to let the server know that the data is ready to be
  * consumed by the server
@@ -1830,15 +2285,122 @@ VAStatus vaUnmapBuffer (
     VABufferID buf_id  /* in */
 );
 
-/*
+/**
  * After this call, the buffer is deleted and this buffer_id is no longer valid
- * Only call this if the buffer is not going to be passed to vaRenderBuffer
+ *
+ * A buffer can be re-used and sent to the server by another Begin/Render/End
+ * sequence if vaDestroyBuffer() is not called with this buffer.
+ *
+ * Note re-using a shared buffer (e.g. a slice data buffer) between the host and the
+ * hardware accelerator can result in performance dropping.
  */
 VAStatus vaDestroyBuffer (
     VADisplay dpy,
     VABufferID buffer_id
 );
 
+/** \brief VA buffer information */
+typedef struct {
+    /** \brief Buffer handle */
+    uintptr_t           handle;
+    /** \brief Buffer type (See \ref VABufferType). */
+    uint32_t            type;
+    /**
+     * \brief Buffer memory type (See \ref VASurfaceAttribMemoryType).
+     *
+     * On input to vaAcquireBufferHandle(), this field can serve as a hint
+     * to specify the set of memory types the caller is interested in.
+     * On successful return from vaAcquireBufferHandle(), the field is
+     * updated with the best matching memory type.
+     */
+    uint32_t            mem_type;
+    /** \brief Size of the underlying buffer. */
+    size_t              mem_size;
+} VABufferInfo;
+
+/**
+ * \brief Acquires buffer handle for external API usage
+ *
+ * Locks the VA buffer object \ref buf_id for external API usage like
+ * EGL or OpenCL (OCL). This function is a synchronization point. This
+ * means that any pending operation is guaranteed to be completed
+ * prior to returning from the function.
+ *
+ * If the referenced VA buffer object is the backing store of a VA
+ * surface, then this function acts as if vaSyncSurface() on the
+ * parent surface was called first.
+ *
+ * The \ref VABufferInfo argument shall be zero'ed on input. On
+ * successful output, the data structure is filled in with all the
+ * necessary buffer level implementation details like handle, type,
+ * memory type and memory size.
+ *
+ * Note: the external API implementation, or the application, can
+ * express the memory types it is interested in by filling in the \ref
+ * mem_type field accordingly. On successful output, the memory type
+ * that fits best the request and that was used is updated in the \ref
+ * VABufferInfo data structure. If none of the supplied memory types
+ * is supported, then a \ref VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE
+ * error is returned.
+ *
+ * The \ref VABufferInfo data is valid until vaReleaseBufferHandle()
+ * is called. Besides, no additional operation is allowed on any of
+ * the buffer parent object until vaReleaseBufferHandle() is called.
+ * e.g. decoding into a VA surface backed with the supplied VA buffer
+ * object \ref buf_id would fail with a \ref VA_STATUS_ERROR_SURFACE_BUSY
+ * error.
+ *
+ * Possible errors:
+ * - \ref VA_STATUS_ERROR_UNIMPLEMENTED: the VA driver implementation
+ *   does not support this interface
+ * - \ref VA_STATUS_ERROR_INVALID_DISPLAY: an invalid display was supplied
+ * - \ref VA_STATUS_ERROR_INVALID_BUFFER: an invalid buffer was supplied
+ * - \ref VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE: the implementation
+ *   does not support exporting buffers of the specified type
+ * - \ref VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE: none of the requested
+ *   memory types in \ref VABufferInfo.mem_type was supported
+ *
+ * @param[in] dpy               the VA display
+ * @param[in] buf_id            the VA buffer
+ * @param[in,out] buf_info      the associated VA buffer information
+ * @return VA_STATUS_SUCCESS if successful
+ */
+VAStatus
+vaAcquireBufferHandle(VADisplay dpy, VABufferID buf_id, VABufferInfo *buf_info);
+
+/**
+ * \brief Releases buffer after usage from external API
+ *
+ * Unlocks the VA buffer object \ref buf_id from external API usage like
+ * EGL or OpenCL (OCL). This function is a synchronization point. This
+ * means that any pending operation is guaranteed to be completed
+ * prior to returning from the function.
+ *
+ * The \ref VABufferInfo argument shall point to the original data
+ * structure that was obtained from vaAcquireBufferHandle(), unaltered.
+ * This is necessary so that the VA driver implementation could
+ * deallocate any resources that were needed.
+ *
+ * In any case, returning from this function invalidates any contents
+ * in \ref VABufferInfo. i.e. the underlyng buffer handle is no longer
+ * valid. Therefore, VA driver implementations are free to reset this
+ * data structure to safe defaults.
+ *
+ * Possible errors:
+ * - \ref VA_STATUS_ERROR_UNIMPLEMENTED: the VA driver implementation
+ *   does not support this interface
+ * - \ref VA_STATUS_ERROR_INVALID_DISPLAY: an invalid display was supplied
+ * - \ref VA_STATUS_ERROR_INVALID_BUFFER: an invalid buffer was supplied
+ * - \ref VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE: the implementation
+ *   does not support exporting buffers of the specified type
+ *
+ * @param[in] dpy               the VA display
+ * @param[in] buf_id            the VA buffer
+ * @return VA_STATUS_SUCCESS if successful
+ */
+VAStatus
+vaReleaseBufferHandle(VADisplay dpy, VABufferID buf_id);
+
 /*
 Render (Decode) Pictures
 
@@ -1847,7 +2409,7 @@ A picture represents either a frame or a field.
 The Begin/Render/End sequence sends the decode buffers to the server
 */
 
-/*
+/**
  * Get ready to decode a picture to a target surface
  */
 VAStatus vaBeginPicture (
@@ -1856,9 +2418,8 @@ VAStatus vaBeginPicture (
     VASurfaceID render_target
 );
 
-/* 
+/**
  * Send decode buffers to the server.
- * Buffers are automatically destroyed afterwards
  */
 VAStatus vaRenderPicture (
     VADisplay dpy,
@@ -1867,7 +2428,7 @@ VAStatus vaRenderPicture (
     int num_buffers
 );
 
-/* 
+/**
  * Make the end of rendering for a picture. 
  * The server should start processing all pending operations for this 
  * surface. This call is non-blocking. The client can start another 
@@ -1884,7 +2445,7 @@ Synchronization
 
 */
 
-/* 
+/**
  * This function blocks until all pending operations on the render target
  * have been completed.  Upon return it is safe to use the render target for a 
  * different picture. 
@@ -1904,7 +2465,7 @@ typedef enum
     VASurfaceSkipped   = 8  /* Indicate a skipped frame during encode */
 } VASurfaceStatus;
 
-/*
+/**
  * Find out any pending ops on the render target 
  */
 VAStatus vaQuerySurfaceStatus (
@@ -1919,7 +2480,7 @@ typedef enum
     VADecodeMBError                 = 1,
 } VADecodeErrorType;
 
-/*
+/**
  * Client calls vaQuerySurfaceError with VA_STATUS_ERROR_DECODING_ERROR, server side returns
  * an array of structure VASurfaceDecodeMBErrors, and the array is terminated by setting status=-1
 */
@@ -1931,7 +2492,7 @@ typedef struct _VASurfaceDecodeMBErrors
     VADecodeErrorType decode_error_type;
 } VASurfaceDecodeMBErrors;
 
-/*
+/**
  * After the application gets VA_STATUS_ERROR_DECODING_ERROR after calling vaSyncSurface(),
  * it can call vaQuerySurfaceError to find out further details on the particular error.
  * VA_STATUS_ERROR_DECODING_ERROR should be passed in as "error_status",
@@ -1946,7 +2507,7 @@ VAStatus vaQuerySurfaceError(
     void **error_info
 );
 
-/*
+/**
  * Images and Subpictures
  * VAImage is used to either get the surface data to client memory, or 
  * to copy image data in client memory to a surface. 
@@ -1968,6 +2529,8 @@ VAStatus vaQuerySurfaceError(
 #define VA_FOURCC_BGRX         0x58524742
 #define VA_FOURCC_ARGB         0x42475241
 #define VA_FOURCC_XRGB         0x42475258
+#define VA_FOURCC_ABGR          0x52474241
+#define VA_FOURCC_XBGR          0x52474258
 #define VA_FOURCC_UYVY          0x59565955
 #define VA_FOURCC_YUY2          0x32595559
 #define VA_FOURCC_AYUV          0x56555941
@@ -1986,6 +2549,21 @@ VAStatus vaQuerySurfaceError(
 #define VA_FOURCC_RGBP          0x50424752
 #define VA_FOURCC_BGRP          0x50524742
 #define VA_FOURCC_411R          0x52313134 /* rotated 411P */
+/**
+ * Planar YUV 4:2:2.
+ * 8-bit Y plane, followed by 8-bit 2x1 subsampled V and U planes
+ */
+#define VA_FOURCC_YV16          0x36315659
+/**
+ * 10-bit and 16-bit Planar YUV 4:2:0. 
+ */
+#define VA_FOURCC_P010          0x30313050
+#define VA_FOURCC_P016          0x36313050
+
+/**
+ * 10-bit Planar YUV 420 and occupy the lower 10-bit.
+ */
+#define VA_FOURCC_I010          0x30313049
 
 /* byte order */
 #define VA_LSB_FIRST           1
@@ -2047,12 +2625,12 @@ typedef struct _VAImage
     char component_order[4];
 } VAImage;
 
-/* Get maximum number of image formats supported by the implementation */
+/** Get maximum number of image formats supported by the implementation */
 int vaMaxNumImageFormats (
     VADisplay dpy
 );
 
-/* 
+/**
  * Query supported image formats 
  * The caller must provide a "format_list" array that can hold at
  * least vaMaxNumImageFormats() entries. The actual number of formats
@@ -2064,7 +2642,7 @@ VAStatus vaQueryImageFormats (
     int *num_formats           /* out */
 );
 
-/* 
+/**
  * Create a VAImage structure
  * The width and height fields returned in the VAImage structure may get 
  * enlarged for some YUV formats. Upon return from this function, 
@@ -2079,7 +2657,7 @@ VAStatus vaCreateImage (
     VAImage *image     /* out */
 );
 
-/*
+/**
  * Should call DestroyImage before destroying the surface it is bound to
  */
 VAStatus vaDestroyImage (
@@ -2098,7 +2676,7 @@ VAStatus vaSetImagePalette (
     unsigned char *palette 
 );
 
-/*
+/**
  * Retrive surface data into a VAImage
  * Image must be in a format supported by the implementation
  */
@@ -2112,7 +2690,7 @@ VAStatus vaGetImage (
     VAImageID image
 );
 
-/*
+/**
  * Copy data from a VAImage to a surface
  * Image must be in a format supported by the implementation
  * Returns a VA_STATUS_ERROR_SURFACE_BUSY if the surface
@@ -2132,7 +2710,7 @@ VAStatus vaPutImage (
     unsigned int dest_height
 );
 
-/*
+/**
  * Derive an VAImage from an existing surface.
  * This interface will derive a VAImage and corresponding image buffer from
  * an existing VA Surface. The image buffer can then be mapped/unmapped for
@@ -2169,7 +2747,7 @@ VAStatus vaDeriveImage (
     VAImage *image     /* out */
 );
 
-/*
+/**
  * Subpictures 
  * Subpicture is a special type of image that can be blended 
  * with a surface during vaPutSurface(). Subpicture can be used to render
@@ -2178,16 +2756,16 @@ VAStatus vaDeriveImage (
 
 typedef VAGenericID VASubpictureID;
 
-/* Get maximum number of subpicture formats supported by the implementation */
+/** Get maximum number of subpicture formats supported by the implementation */
 int vaMaxNumSubpictureFormats (
     VADisplay dpy
 );
 
-/* flags for subpictures */
+/** flags for subpictures */
 #define VA_SUBPICTURE_CHROMA_KEYING                    0x0001
 #define VA_SUBPICTURE_GLOBAL_ALPHA                     0x0002
 #define VA_SUBPICTURE_DESTINATION_IS_SCREEN_COORD      0x0004
-/* 
+/**
  * Query supported subpicture formats 
  * The caller must provide a "format_list" array that can hold at
  * least vaMaxNumSubpictureFormats() entries. The flags arrary holds the flag 
@@ -2206,7 +2784,7 @@ VAStatus vaQuerySubpictureFormats (
     unsigned int *num_formats  /* out */
 );
 
-/* 
+/**
  * Subpictures are created with an image associated. 
  */
 VAStatus vaCreateSubpicture (
@@ -2215,7 +2793,7 @@ VAStatus vaCreateSubpicture (
     VASubpictureID *subpicture /* out */
 );
 
-/*
+/**
  * Destroy the subpicture before destroying the image it is assocated to
  */
 VAStatus vaDestroySubpicture (
@@ -2223,7 +2801,7 @@ VAStatus vaDestroySubpicture (
     VASubpictureID subpicture
 );
 
-/* 
+/**
  * Bind an image to the subpicture. This image will now be associated with 
  * the subpicture instead of the one at creation.
  */
@@ -2233,7 +2811,7 @@ VAStatus vaSetSubpictureImage (
     VAImageID image
 );
 
-/*
+/**
  * If chromakey is enabled, then the area where the source value falls within
  * the chromakey [min, max] range is transparent
  * The chromakey component format is the following:
@@ -2250,7 +2828,7 @@ VAStatus vaSetSubpictureChromakey (
     unsigned int chromakey_mask
 );
 
-/*
+/**
  * Global alpha value is between 0 and 1. A value of 1 means fully opaque and 
  * a value of 0 means fully transparent. If per-pixel alpha is also specified then
  * the overall alpha is per-pixel alpha multiplied by the global alpha
@@ -2261,7 +2839,7 @@ VAStatus vaSetSubpictureGlobalAlpha (
     float global_alpha 
 );
 
-/*
+/**
  * vaAssociateSubpicture associates the subpicture with target_surfaces.
  * It defines the region mapping between the subpicture and the target  
  * surfaces through source and destination rectangles (with the same width and height).
@@ -2288,7 +2866,7 @@ VAStatus vaAssociateSubpicture (
     unsigned int flags
 );
 
-/*
+/**
  * vaDeassociateSubpicture removes the association of the subpicture with target_surfaces.
  */
 VAStatus vaDeassociateSubpicture (
@@ -2298,15 +2876,7 @@ VAStatus vaDeassociateSubpicture (
     int num_surfaces
 );
 
-typedef struct _VARectangle
-{
-    short x;
-    short y;
-    unsigned short width;
-    unsigned short height;
-} VARectangle;
-
-/*
+/**
  * Display attributes
  * Display attributes are used to control things such as contrast, hue, saturation,
  * brightness etc. in the rendering process.  The application can query what
@@ -2323,29 +2893,29 @@ typedef enum
     VADISPLAYATTRIB_BLE_NONE,
 } VADisplayAttribBLEMode;
 
-/* attribute value for VADisplayAttribRotation   */
+/** attribute value for VADisplayAttribRotation   */
 #define VA_ROTATION_NONE        0x00000000
 #define VA_ROTATION_90          0x00000001
 #define VA_ROTATION_180         0x00000002
 #define VA_ROTATION_270         0x00000003
 
-/* attribute value for VADisplayAttribOutOfLoopDeblock */
+/** attribute value for VADisplayAttribOutOfLoopDeblock */
 #define VA_OOL_DEBLOCKING_FALSE 0x00000000
 #define VA_OOL_DEBLOCKING_TRUE  0x00000001
 
-/* Render mode */
+/** Render mode */
 #define VA_RENDER_MODE_UNDEFINED           0
 #define VA_RENDER_MODE_LOCAL_OVERLAY       1
 #define VA_RENDER_MODE_LOCAL_GPU           2
 #define VA_RENDER_MODE_EXTERNAL_OVERLAY    4
 #define VA_RENDER_MODE_EXTERNAL_GPU        8
 
-/* Render device */
+/** Render device */
 #define VA_RENDER_DEVICE_UNDEFINED  0
 #define VA_RENDER_DEVICE_LOCAL      1
 #define VA_RENDER_DEVICE_EXTERNAL   2
 
-/* Currently defined display attribute types */
+/** Currently defined display attribute types */
 typedef enum
 {
     VADisplayAttribBrightness          = 0,
@@ -2434,12 +3004,12 @@ typedef struct _VADisplayAttribute
     unsigned int flags;
 } VADisplayAttribute;
 
-/* Get maximum number of display attributs supported by the implementation */
+/** Get maximum number of display attributs supported by the implementation */
 int vaMaxNumDisplayAttributes (
     VADisplay dpy
 );
 
-/* 
+/**
  * Query display attributes 
  * The caller must provide a "attr_list" array that can hold at
  * least vaMaxNumDisplayAttributes() entries. The actual number of attributes
@@ -2451,7 +3021,7 @@ VAStatus vaQueryDisplayAttributes (
     int *num_attributes                        /* out */
 );
 
-/* 
+/**
  * Get display attributes 
  * This function returns the current attribute values in "attr_list".
  * Only attributes returned with VA_DISPLAY_ATTRIB_GETTABLE set in the "flags" field
@@ -2463,7 +3033,7 @@ VAStatus vaGetDisplayAttributes (
     int num_attributes
 );
 
-/* 
+/**
  * Set display attributes 
  * Only attributes returned with VA_DISPLAY_ATTRIB_SETTABLE set in the "flags" field
  * from vaQueryDisplayAttributes() can be set.  If the attribute is not settable or 
@@ -2475,6 +3045,84 @@ VAStatus vaSetDisplayAttributes (
     int num_attributes
 );
 
+/****************************
+ * HEVC data structures
+ ****************************/
+/** 
+ * \brief Description of picture properties of those in DPB surfaces.
+ *
+ * If only progressive scan is supported, each surface contains one whole 
+ * frame picture.
+ * Otherwise, each surface contains two fields of whole picture.
+ * In this case, two entries of ReferenceFrames[] may share same picture_id
+ * value.
+ */
+typedef struct _VAPictureHEVC
+{
+    /** \brief reconstructed picture buffer surface index 
+     * invalid when taking value VA_INVALID_SURFACE.
+     */
+    VASurfaceID             picture_id;
+    /** \brief picture order count. 
+     * in HEVC, POCs for top and bottom fields of same picture should
+     * take different values.
+     */
+    int32_t                 pic_order_cnt;
+    /* described below */
+    uint32_t                flags;
+} VAPictureHEVC;
+
+/* flags in VAPictureHEVC could be OR of the following */
+#define VA_PICTURE_HEVC_INVALID                 0x00000001
+/** \brief indication of interlace scan picture. 
+ * should take same value for all the pictures in sequence.
+ */ 
+#define VA_PICTURE_HEVC_FIELD_PIC               0x00000002
+/** \brief polarity of the field picture.
+ * top field takes even lines of buffer surface.
+ * bottom field takes odd lines of buffer surface.
+ */
+#define VA_PICTURE_HEVC_BOTTOM_FIELD            0x00000004
+/** \brief Long term reference picture */
+#define VA_PICTURE_HEVC_LONG_TERM_REFERENCE     0x00000008
+/**
+ * VA_PICTURE_HEVC_RPS_ST_CURR_BEFORE, VA_PICTURE_HEVC_RPS_ST_CURR_AFTER
+ * and VA_PICTURE_HEVC_RPS_LT_CURR of any picture in ReferenceFrames[] should 
+ * be exclusive. No more than one of them can be set for any picture.
+ * Sum of NumPocStCurrBefore, NumPocStCurrAfter and NumPocLtCurr
+ * equals NumPocTotalCurr, which should be equal to or smaller than 8.
+ * Application should provide valid values for both short format and long format.
+ * The pictures in DPB with any of these three flags turned on are referred by
+ * the current picture.
+ */
+/** \brief RefPicSetStCurrBefore of HEVC spec variable 
+ * Number of ReferenceFrames[] entries with this bit set equals 
+ * NumPocStCurrBefore.
+ */
+#define VA_PICTURE_HEVC_RPS_ST_CURR_BEFORE      0x00000010
+/** \brief RefPicSetStCurrAfter of HEVC spec variable
+ * Number of ReferenceFrames[] entries with this bit set equals 
+ * NumPocStCurrAfter.
+ */
+#define VA_PICTURE_HEVC_RPS_ST_CURR_AFTER       0x00000020
+/** \brief RefPicSetLtCurr of HEVC spec variable
+ * Number of ReferenceFrames[] entries with this bit set equals 
+ * NumPocLtCurr.
+ */
+#define VA_PICTURE_HEVC_RPS_LT_CURR             0x00000040
+
+#include <va/va_dec_hevc.h>
+#include <va/va_dec_jpeg.h>
+#include <va/va_dec_vp8.h>
+#include <va/va_dec_vp9.h>
+#include <va/va_enc_hevc.h>
+#include <va/va_enc_h264.h>
+#include <va/va_enc_jpeg.h>
+#include <va/va_enc_mpeg2.h>
+#include <va/va_enc_vp8.h>
+#include <va/va_enc_vp9.h>
+#include <va/va_vpp.h>
+
 /**@}*/
 
 #ifdef __cplusplus