summaryrefslogtreecommitdiffstats
path: root/third_party
diff options
context:
space:
mode:
Diffstat (limited to 'third_party')
-rw-r--r--third_party/libva/README.chromium2
-rw-r--r--third_party/libva/va/android/drmtest.h40
-rw-r--r--third_party/libva/va/drm/va_drm.h61
-rw-r--r--third_party/libva/va/drm/va_drm_auth.h (renamed from third_party/libva/va/egl/va_egl_impl.h)24
-rw-r--r--third_party/libva/va/drm/va_drm_auth_x11.h35
-rw-r--r--third_party/libva/va/drm/va_drm_utils.h73
-rw-r--r--third_party/libva/va/egl/va_backend_egl.h51
-rw-r--r--third_party/libva/va/egl/va_egl_private.h98
-rw-r--r--third_party/libva/va/sysdeps.h35
-rw-r--r--third_party/libva/va/va.h719
-rw-r--r--third_party/libva/va/va_android.h5
-rw-r--r--third_party/libva/va/va_backend.h96
-rw-r--r--third_party/libva/va/va_backend_tpi.h93
-rw-r--r--third_party/libva/va/va_backend_vpp.h71
-rw-r--r--third_party/libva/va/va_compat.h116
-rw-r--r--third_party/libva/va/va_dec_jpeg.h176
-rw-r--r--third_party/libva/va/va_drmcommon.h76
-rw-r--r--third_party/libva/va/va_egl.h202
-rw-r--r--third_party/libva/va/va_enc_h264.h592
-rw-r--r--third_party/libva/va/va_enc_mpeg2.h287
-rw-r--r--third_party/libva/va/va_tpi.h98
-rw-r--r--third_party/libva/va/va_trace.h32
-rw-r--r--third_party/libva/va/va_version.h6
-rw-r--r--third_party/libva/va/va_vpp.h748
-rw-r--r--third_party/libva/va/wayland/va_backend_wayland.h65
-rw-r--r--third_party/libva/va/wayland/va_wayland.h131
-rw-r--r--third_party/libva/va/wayland/va_wayland_drm.h52
-rw-r--r--third_party/libva/va/wayland/va_wayland_emgd.h52
-rw-r--r--third_party/libva/va/wayland/va_wayland_private.h44
-rw-r--r--third_party/libva/va/x11/va_dricommon.h16
30 files changed, 3372 insertions, 724 deletions
diff --git a/third_party/libva/README.chromium b/third_party/libva/README.chromium
index 649a818..019558f 100644
--- a/third_party/libva/README.chromium
+++ b/third_party/libva/README.chromium
@@ -2,7 +2,7 @@ Name: libva
URL: http://freedesktop.org/wiki/Software/vaapi
Source: git clone git://anongit.freedesktop.org/git/libva
Version: unknown
-RealVersion: git tip-of-tree as of 20120629
+RealVersion: git tag libva-1.2.1
License: MIT
License File: COPYING
Security Critical: no
diff --git a/third_party/libva/va/android/drmtest.h b/third_party/libva/va/android/drmtest.h
deleted file mode 100644
index 5f10f08..0000000
--- a/third_party/libva/va/android/drmtest.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright © 2007 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- *
- * Authors:
- * Eric Anholt <eric@anholt.net>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <assert.h>
-#include <errno.h>
-
-#include "xf86drm.h"
-
-#define DRM_TEST_MASTER 0x01
-
-int drm_open_any(int *vendor_id, int *device_id);
-int drm_open_any_master(void);
-int drm_open_matching(const char *pci_glob, int flags, int *vendor_id, int *device_id);
diff --git a/third_party/libva/va/drm/va_drm.h b/third_party/libva/va/drm/va_drm.h
new file mode 100644
index 0000000..9af3cc8
--- /dev/null
+++ b/third_party/libva/va/drm/va_drm.h
@@ -0,0 +1,61 @@
+/*
+ * va_drm.h - Raw DRM API
+ *
+ * Copyright (c) 2012 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef VA_DRM_H
+#define VA_DRM_H
+
+#include <va/va.h>
+
+/**
+ * \file va_drm.h
+ * \brief The raw DRM API
+ *
+ * This file contains the \ref api_drm "Raw DRM API".
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Returns a VA display derived from the specified DRM connection.
+ *
+ * This function returns a (possibly cached) VA display from the
+ * specified DRM connection @fd.
+ *
+ * @param[in] fd the DRM connection descriptor
+ * @return the VA display
+ */
+VADisplay
+vaGetDisplayDRM(int fd);
+
+/**@}*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* VA_DRM_H */
diff --git a/third_party/libva/va/egl/va_egl_impl.h b/third_party/libva/va/drm/va_drm_auth.h
index 8b6fb91..1aa6989 100644
--- a/third_party/libva/va/egl/va_egl_impl.h
+++ b/third_party/libva/va/drm/va_drm_auth.h
@@ -21,19 +21,19 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#ifndef _VA_EGL_IMPL_H_
-#define _VA_EGL_IMPL_H_
-#define IMPL_MAX_EGL_SURFACE_TARGETS 4
-#define IMPL_MAX_EGL_SURFACE_ATTRIBUTES 8
+#ifndef VA_DRM_AUTH_H
+#define VA_DRM_AUTH_H
+#include <stdint.h>
+#include <stdbool.h>
-/**
- * Initialize EGL driver context
- *
- * @param[in] dpy the VA Display
- * @return VA_STATUS_SUCCESS if successful
- */
-VAStatus va_egl_init_context(VADisplay dpy);
+DLL_HIDDEN
+bool
+va_drm_is_authenticated(int fd);
+
+DLL_HIDDEN
+bool
+va_drm_authenticate(int fd, uint32_t magic);
-#endif /* _VA_GLX_IMPL_H_ */
+#endif /* VA_DRM_AUTH_H */
diff --git a/third_party/libva/va/drm/va_drm_auth_x11.h b/third_party/libva/va/drm/va_drm_auth_x11.h
new file mode 100644
index 0000000..530eeed
--- /dev/null
+++ b/third_party/libva/va/drm/va_drm_auth_x11.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2012 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef VA_DRM_AUTH_X11_H
+#define VA_DRM_AUTH_X11_H
+
+#include <stdint.h>
+#include <stdbool.h>
+
+DLL_HIDDEN
+bool
+va_drm_authenticate_x11(int fd, uint32_t magic);
+
+#endif /* VA_DRM_AUTH_X11_H */
diff --git a/third_party/libva/va/drm/va_drm_utils.h b/third_party/libva/va/drm/va_drm_utils.h
new file mode 100644
index 0000000..0cb361e
--- /dev/null
+++ b/third_party/libva/va/drm/va_drm_utils.h
@@ -0,0 +1,73 @@
+/*
+ * va_drm_utils.h - VA/DRM Utilities
+ *
+ * Copyright (c) 2012 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef VA_DRM_UTILS_H
+#define VA_DRM_UTILS_H
+
+#include <va/va_backend.h>
+
+/**
+ * \file va_drm_utils.h
+ * \brief VA/DRM Utilities
+ *
+ * This file contains VA/DRM utility functions. The API herein defined is
+ * internal to libva. Users include the VA/DRM API itself or VA/Android,
+ * should it be based on DRM.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Returns the VA driver name for the active display.
+ *
+ * This functions returns a newly allocated buffer in @driver_name_ptr that
+ * contains the VA driver name for the active display. Active display means
+ * the display obtained with any of the vaGetDisplay*() functions.
+ *
+ * The VADriverContext.drm_state structure must be valid, i.e. allocated
+ * and containing an open DRM connection descriptor. The DRM connection
+ * does *not* need to be authenticated as it only performs a call to
+ * drmGetVersion().
+ *
+ * @param[in] ctx the pointer to a VADriverContext
+ * @param[out] driver_name_ptr the newly allocated buffer containing
+ * the VA driver name
+ * @return VA_STATUS_SUCCESS if operation is successful, or another
+ * #VAStatus value otherwise.
+ */
+DLL_HIDDEN
+VAStatus
+VA_DRM_GetDriverName(VADriverContextP ctx, char **driver_name_ptr);
+
+/**@}*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* VA_DRM_UTILS_H */
diff --git a/third_party/libva/va/egl/va_backend_egl.h b/third_party/libva/va/egl/va_backend_egl.h
index bd0538c..925d933 100644
--- a/third_party/libva/va/egl/va_backend_egl.h
+++ b/third_party/libva/va/egl/va_backend_egl.h
@@ -25,7 +25,7 @@
#ifndef VA_BACKEND_EGL_H
#define VA_BACKEND_EGL_H
-#include <va/va_egl.h>
+#include <va/va.h>
#include <va/va_backend.h>
struct VADriverVTableEGL {
@@ -35,56 +35,7 @@ struct VADriverVTableEGL {
VASurfaceID surface,
void **buffer
);
-
/* TBD: more APIs for EGL */
- int max_egl_surface_targets;
- int max_egl_surface_attributes;
-
- VAStatus (*vaQuerySurfaceTargetsEGL)(
- VADriverContextP ctx,
- EGLenum *target_list, /* out */
- int *num_targets /* out */
- );
-
- VAStatus (*vaCreateSurfaceEGL)(
- VADriverContextP ctx,
- EGLenum target,
- unsigned int width,
- unsigned int height,
- VASurfaceEGL *gl_surface
- );
-
- /* Optional: destroy a VA/EGL surface */
- VAStatus (*vaDestroySurfaceEGL)(
- VADriverContextP ctx,
- VASurfaceEGL egl_surface
- );
-
- VAStatus (*vaAssociateSurfaceEGL)(
- VADriverContextP ctx,
- VASurfaceEGL egl_surface,
- VASurfaceID surface,
- unsigned int flags
- );
-
- VAStatus (*vaSyncSurfaceEGL)(
- VADriverContextP ctx,
- VASurfaceEGL egl_surface
- );
-
- VAStatus (*vaGetSurfaceInfoEGL)(
- VADisplay dpy,
- VASurfaceEGL egl_surface,
- EGLenum *target,
- EGLClientBuffer *buffer,
- EGLint *attrib_list,
- int *num_attribs
- );
-
- VAStatus (*vaDeassociateSurfaceEGL)(
- VADriverContextP ctx,
- VASurfaceEGL egl_surface
- );
};
#endif /* VA_BACKEND_EGL_H */
diff --git a/third_party/libva/va/egl/va_egl_private.h b/third_party/libva/va/egl/va_egl_private.h
deleted file mode 100644
index 7c2ba65..0000000
--- a/third_party/libva/va/egl/va_egl_private.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2012 Intel Corporation. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#ifndef _VA_EGL_PRIVATE_H_
-#define _VA_EGL_PRIVATE_H_
-
-#include "va.h"
-#include "va_backend.h"
-#include "va_egl.h"
-#include "va_backend_egl.h"
-
-typedef struct VADisplayContextEGL *VADisplayContextEGLP;
-typedef struct VADriverContextEGL *VADriverContextEGLP;
-typedef struct VASurfaceImplEGL *VASurfaceImplEGLP;
-typedef struct VADriverVTableEGL *VADriverVTableEGLP;
-typedef struct VADriverVTablePrivEGL *VADriverVTablePrivEGLP;
-typedef void (*vaDestroyFunc)(VADisplayContextP);
-
-struct VADisplayContextEGL {
- vaDestroyFunc vaDestroy;
-};
-
-#define VA_DRIVER_CONTEXT_EGL(ctx) ((VADriverContextEGLP)((ctx)->egl))
-
-struct VADriverVTablePrivEGL {
- VAStatus (*vaQuerySurfaceTargetsEGL)(
- VADisplay dpy,
- EGLenum *target_list, /* out */
- int *num_targets /* out */
- );
-
- VAStatus (*vaCreateSurfaceEGL)(
- VADisplay dpy,
- EGLenum target,
- unsigned int width,
- unsigned int height,
- VASurfaceEGL *gl_surface
- );
-
- VAStatus (*vaDestroySurfaceEGL)(
- VADisplay dpy,
- VASurfaceEGL egl_surface
- );
-
- VAStatus (*vaAssociateSurfaceEGL)(
- VADisplay dpy,
- VASurfaceEGL egl_surface,
- VASurfaceID surface,
- unsigned int flags
- );
-
- VAStatus (*vaSyncSurfaceEGL)(
- VADisplay dpy,
- VASurfaceEGL egl_surface
- );
-
- VAStatus (*vaGetSurfaceInfoEGL)(
- VADisplay dpy,
- VASurfaceEGL egl_surface,
- EGLenum *target,
- EGLClientBuffer *buffer,
- EGLint *attrib_list,
- int *num_attribs
- );
-
- VAStatus (*vaDeassociateSurfaceEGL)(
- VADisplay dpy,
- VASurfaceEGL egl_surface
- );
-};
-
-struct VADriverContextEGL {
- struct VADriverVTablePrivEGL vtable;
- unsigned int is_initialized : 1;
- EGLDisplay egl_display;
-};
-
-#endif /* _VA_EGL_PRIVATE_H_ */
diff --git a/third_party/libva/va/sysdeps.h b/third_party/libva/va/sysdeps.h
index 0752b17..4de764d 100644
--- a/third_party/libva/va/sysdeps.h
+++ b/third_party/libva/va/sysdeps.h
@@ -31,6 +31,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <string.h>
#include <stdint.h>
#include <assert.h>
@@ -39,6 +40,40 @@
# define Bool int
# define True 1
# define False 0
+
+/* Macros generated from configure */
+# define LIBVA_VERSION_S "1.1.0"
+
+/* Android logging utilities */
+# include <utils/Log.h>
+
+# ifdef ANDROID_ALOG
+# define va_log_error(buffer) do { ALOGE("%s", buffer); } while (0)
+# define va_log_info(buffer) do { ALOGI("%s", buffer); } while (0)
+# elif ANDROID_LOG
+# define va_log_error(buffer) do { LOGE("%s", buffer); } while (0)
+# define va_log_info(buffer) do { LOGI("%s", buffer); } while (0)
+# endif
+#endif
+
+#ifndef va_log_error
+#define va_log_error(buffer) do { \
+ fprintf(stderr, "libva error: %s", buffer); \
+ } while (0)
+#endif
+
+#ifndef va_log_info
+#define va_log_info(buffer) do { \
+ fprintf(stderr, "libva info: %s", buffer); \
+ } while (0)
+#endif
+
+#if defined __GNUC__ && defined HAVE_GNUC_VISIBILITY_ATTRIBUTE
+# define DLL_HIDDEN __attribute__((visibility("hidden")))
+# define DLL_EXPORT __attribute__((visibility("default")))
+#else
+# define DLL_HIDDEN
+# define DLL_EXPORT
#endif
#endif /* SYSDEPS_H */
diff --git a/third_party/libva/va/va.h b/third_party/libva/va/va.h
index 471004e..0eceea7 100644
--- a/third_party/libva/va/va.h
+++ b/third_party/libva/va/va.h
@@ -68,6 +68,13 @@
* contributed to various aspects of the API.
*/
+/**
+ * \file va.h
+ * \brief The Core API
+ *
+ * This file contains the \ref api_core "Core API".
+ */
+
#ifndef _VA_H_
#define _VA_H_
@@ -77,6 +84,30 @@
extern "C" {
#endif
+/**
+ * \mainpage Video Acceleration (VA) API
+ *
+ * \section intro Introduction
+ *
+ * The main motivation for VA-API (Video Acceleration API) is to
+ * enable hardware accelerated video decode and encode at various
+ * entry-points (VLD, IDCT, Motion Compensation etc.) for the
+ * prevailing coding standards today (MPEG-2, MPEG-4 ASP/H.263, MPEG-4
+ * AVC/H.264, VC-1/VMW3, and JPEG).
+ *
+ * VA-API is split into several modules:
+ * - \ref api_core
+ * - \ref api_enc_core
+ * - \ref api_enc_h264
+ * - \ref api_vpp
+ */
+
+/**
+ * \defgroup api_core Core API
+ *
+ * @{
+ */
+
/*
Overview
@@ -134,6 +165,20 @@ typedef int VAStatus; /* Return status type from functions */
#define VA_STATUS_ERROR_INVALID_IMAGE_FORMAT 0x00000016
#define VA_STATUS_ERROR_DECODING_ERROR 0x00000017
#define VA_STATUS_ERROR_ENCODING_ERROR 0x00000018
+/**
+ * \brief An invalid/unsupported value was supplied.
+ *
+ * This is a catch-all error code for invalid or unsupported values.
+ * e.g. value exceeding the valid range, invalid type in the context
+ * of generic attribute values.
+ */
+#define VA_STATUS_ERROR_INVALID_VALUE 0x00000019
+/** \brief An unsupported filter was supplied. */
+#define VA_STATUS_ERROR_UNSUPPORTED_FILTER 0x00000020
+/** \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_UNKNOWN 0xFFFFFFFF
/* De-interlacing flags for vaPutSurface() */
@@ -226,6 +271,8 @@ VAPrivFunc vaGetLibFunc (
/* Currently defined profiles */
typedef enum
{
+ /** \brief Profile ID used for video processing. */
+ VAProfileNone = -1,
VAProfileMPEG2Simple = 0,
VAProfileMPEG2Main = 1,
VAProfileMPEG4Simple = 2,
@@ -253,7 +300,9 @@ typedef enum
VAEntrypointMoComp = 4,
VAEntrypointDeblocking = 5,
VAEntrypointEncSlice = 6, /* slice level encode */
- VAEntrypointEncPicture = 7 /* pictuer encode, JPEG, etc */
+ VAEntrypointEncPicture = 7, /* pictuer encode, JPEG, etc */
+ VAEntrypointVideoProc = 10, /**< Video pre/post-processing. */
+ VAEntrypointMax
} VAEntrypoint;
/* Currently defined configuration attribute types */
@@ -264,7 +313,79 @@ typedef enum
VAConfigAttribSpatialClipping = 2,
VAConfigAttribIntraResidual = 3,
VAConfigAttribEncryption = 4,
- VAConfigAttribRateControl = 5
+ VAConfigAttribRateControl = 5,
+
+ /** @name Attributes for encoding */
+ /**@{*/
+ /**
+ * \brief Packed headers mode. Read/write.
+ *
+ * This attribute determines what packed headers the driver supports,
+ * through vaGetConfigAttributes(); and what packed headers the user
+ * will be providing to the driver, through vaCreateConfig(), if the
+ * driver supports those.
+ *
+ * See \c VA_ENC_PACKED_HEADER_xxx for the list of packed headers.
+ */
+ VAConfigAttribEncPackedHeaders = 10,
+ /**
+ * \brief Interlaced mode. Read/write.
+ *
+ * This attribute determines what kind of interlaced encoding mode
+ * the driver supports.
+ *
+ * See \c VA_ENC_INTERLACED_xxx for the list of interlaced modes.
+ */
+ VAConfigAttribEncInterlaced = 11,
+ /**
+ * \brief Maximum number of reference frames. Read-only.
+ *
+ * This attribute determines the maximum number of reference
+ * frames supported for encoding.
+ *
+ * Note: for H.264 encoding, the value represents the maximum number
+ * of reference frames for both the reference picture list 0 (bottom
+ * 16 bits) and the reference picture list 1 (top 16 bits).
+ */
+ VAConfigAttribEncMaxRefFrames = 13,
+ /**
+ * \brief Maximum number of slices per frame. Read-only.
+ *
+ * This attribute determines the maximum number of slices the
+ * driver can support to encode a single frame.
+ */
+ VAConfigAttribEncMaxSlices = 14,
+ /**
+ * \brief Slice structure. Read-only.
+ *
+ * This attribute determines slice structures supported by the
+ * driver for encoding. This attribute is a hint to the user so
+ * that he can choose a suitable surface size and how to arrange
+ * the encoding process of multiple slices per frame.
+ *
+ * More specifically, for H.264 encoding, this attribute
+ * determines the range of accepted values to
+ * VAEncSliceParameterBufferH264::macroblock_address and
+ * VAEncSliceParameterBufferH264::num_macroblocks.
+ *
+ * See \c VA_ENC_SLICE_STRUCTURE_xxx for the supported slice
+ * structure types.
+ */
+ VAConfigAttribEncSliceStructure = 15,
+ /**
+ * \brief Macroblock information. Read-only.
+ *
+ * This attribute determines whether the driver supports extra
+ * encoding information per-macroblock. e.g. QP.
+ *
+ * More specifically, for H.264 encoding, if the driver returns a non-zero
+ * value for this attribute, this means the application can create
+ * additional #VAEncMacroblockParameterBufferH264 buffers referenced
+ * through VAEncSliceParameterBufferH264::macroblock_info.
+ */
+ VAConfigAttribEncMacroblockInfo = 16,
+ /**@}*/
+ VAConfigAttribTypeMax
} VAConfigAttribType;
/*
@@ -282,13 +403,69 @@ typedef struct _VAConfigAttrib {
#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
+#define VA_RT_FORMAT_RGB16 0x00010000
+#define VA_RT_FORMAT_RGB32 0x00020000
+/* RGBP covers RGBP and BGRP fourcc */
+#define VA_RT_FORMAT_RGBP 0x00100000
#define VA_RT_FORMAT_PROTECTED 0x80000000
-/* attribute value for VAConfigAttribRateControl */
-#define VA_RC_NONE 0x00000001
-#define VA_RC_CBR 0x00000002
-#define VA_RC_VBR 0x00000004
-#define VA_RC_VCM 0x00000008 /* video conference mode */
+/** @name Attribute values for VAConfigAttribRateControl */
+/**@{*/
+/** \brief Driver does not support any form of rate control. */
+#define VA_RC_NONE 0x00000001
+/** \brief Constant bitrate. */
+#define VA_RC_CBR 0x00000002
+/** \brief Variable bitrate. */
+#define VA_RC_VBR 0x00000004
+/** \brief Video conference mode. */
+#define VA_RC_VCM 0x00000008
+/** \brief Constant QP. */
+#define VA_RC_CQP 0x00000010
+/** \brief Variable bitrate with peak rate higher than average bitrate. */
+#define VA_RC_VBR_CONSTRAINED 0x00000020
+/**@}*/
+
+/** @name Attribute values for VAConfigAttribEncPackedHeaders */
+/**@{*/
+/** \brief Driver does not support any packed headers mode. */
+#define VA_ENC_PACKED_HEADER_NONE 0x00000000
+/** \brief Driver supports packed sequence headers. e.g. SPS for H.264. */
+#define VA_ENC_PACKED_HEADER_SEQUENCE 0x00000001
+/** \brief Driver supports packed picture headers. e.g. PPS for H.264. */
+#define VA_ENC_PACKED_HEADER_PICTURE 0x00000002
+/** \brief Driver supports packed slice headers. e.g. \c slice_header() for H.264. */
+#define VA_ENC_PACKED_HEADER_SLICE 0x00000004
+/** \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
+/**@}*/
+
+/** @name Attribute values for VAConfigAttribEncInterlaced */
+/**@{*/
+/** \brief Driver does not support interlaced coding. */
+#define VA_ENC_INTERLACED_NONE 0x00000000
+/** \brief Driver supports interlaced frame coding. */
+#define VA_ENC_INTERLACED_FRAME 0x00000001
+/** \brief Driver supports interlaced field coding. */
+#define VA_ENC_INTERLACED_FIELD 0x00000002
+/** \brief Driver supports macroblock adaptive frame field coding. */
+#define VA_ENC_INTERLACED_MBAFF 0x00000004
+/** \brief Driver supports picture adaptive frame field coding. */
+#define VA_ENC_INTERLACED_PAFF 0x00000008
+/**@}*/
+
+/** @name Attribute values for VAConfigAttribEncSliceStructure */
+/**@{*/
+/** \brief Driver supports an arbitrary number of rows per slice. */
+#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. */
+#define VA_ENC_SLICE_STRUCTURE_ARBITRARY_MACROBLOCKS 0x00000002
+/**@}*/
/*
* if an attribute is not applicable for a given
@@ -420,24 +597,208 @@ typedef VAGenericID VASurfaceID;
#define VA_INVALID_ID 0xffffffff
#define VA_INVALID_SURFACE VA_INVALID_ID
-/*
- * vaCreateSurfaces - Create an array of surfaces used for decode and display
- * dpy: display
- * width: surface width
- * height: surface height
- * format: VA_RT_FORMAT_YUV420, VA_RT_FORMAT_YUV422 or VA_RT_FORMAT_YUV444
- * num_surfaces: number of surfaces to be created
- * surfaces: array of surfaces created upon return
- */
-VAStatus vaCreateSurfaces (
- VADisplay dpy,
- int width,
- int height,
- int format,
- int num_surfaces,
- VASurfaceID *surfaces /* out */
+/** \brief Generic value types. */
+typedef enum {
+ VAGenericValueTypeInteger = 1, /**< 32-bit signed integer. */
+ VAGenericValueTypeFloat, /**< 32-bit floating-point value. */
+ VAGenericValueTypePointer, /**< Generic pointer type */
+ VAGenericValueTypeFunc /**< Pointer to function */
+} VAGenericValueType;
+
+/** \brief Generic function type. */
+typedef void (*VAGenericFunc)(void);
+
+/** \brief Generic value. */
+typedef struct _VAGenericValue {
+ /** \brief Value type. See #VAGenericValueType. */
+ VAGenericValueType type;
+ /** \brief Value holder. */
+ union {
+ /** \brief 32-bit signed integer. */
+ int i;
+ /** \brief 32-bit float. */
+ float f;
+ /** \brief Generic pointer. */
+ void *p;
+ /** \brief Pointer to function. */
+ VAGenericFunc fn;
+ } value;
+} VAGenericValue;
+
+/** @name Surface attribute flags */
+/**@{*/
+/** \brief Surface attribute is not supported. */
+#define VA_SURFACE_ATTRIB_NOT_SUPPORTED 0x00000000
+/** \brief Surface attribute can be got through vaQuerySurfaceAttributes(). */
+#define VA_SURFACE_ATTRIB_GETTABLE 0x00000001
+/** \brief Surface attribute can be set through vaCreateSurfaces(). */
+#define VA_SURFACE_ATTRIB_SETTABLE 0x00000002
+/**@}*/
+
+/** \brief Surface attribute types. */
+typedef enum {
+ VASurfaceAttribNone = 0,
+ /**
+ * \brief Pixel format (fourcc).
+ *
+ * The value is meaningful as input to vaQuerySurfaceAttributes().
+ * If zero, the driver returns the optimal pixel format for the
+ * specified config. Otherwise, if non-zero, the value represents
+ * a pixel format (FOURCC) that is kept as is on output, if the
+ * driver supports it. Otherwise, the driver sets the value to
+ * zero and drops the \c VA_SURFACE_ATTRIB_SETTABLE flag.
+ */
+ VASurfaceAttribPixelFormat,
+ /** \brief Minimal width in pixels (int, read-only). */
+ VASurfaceAttribMinWidth,
+ /** \brief Maximal width in pixels (int, read-only). */
+ VASurfaceAttribMaxWidth,
+ /** \brief Minimal height in pixels (int, read-only). */
+ VASurfaceAttribMinHeight,
+ /** \brief Maximal height in pixels (int, read-only). */
+ VASurfaceAttribMaxHeight,
+ /** \brief Surface memory type expressed in bit fields (int, read/write). */
+ VASurfaceAttribMemoryType,
+ /** \brief External buffer descriptor (pointer, write). */
+ VASurfaceAttribExternalBufferDescriptor,
+ /** \brief Number of surface attributes. */
+ VASurfaceAttribCount
+} VASurfaceAttribType;
+
+/** \brief Surface attribute. */
+typedef struct _VASurfaceAttrib {
+ /** \brief Type. */
+ VASurfaceAttribType type;
+ /** \brief Flags. See "Surface attribute flags". */
+ unsigned int flags;
+ /** \brief Value. See "Surface attribute types" for the expected types. */
+ VAGenericValue value;
+} VASurfaceAttrib;
+
+/**
+ * @name VASurfaceAttribMemoryType values in bit fields.
+ * Bit 0:7 are reserved for generic types, Bit 31:28 are reserved for
+ * Linux DRM, Bit 23:20 are reserved for Android. DRM and Android specific
+ * types are defined in DRM and Android header files.
+ */
+/**@{*/
+/** \brief VA memory type (default) is supported. */
+#define VA_SURFACE_ATTRIB_MEM_TYPE_VA 0x00000001
+/** \brief V4L2 buffer memory type is supported. */
+#define VA_SURFACE_ATTRIB_MEM_TYPE_V4L2 0x00000002
+/** \brief User pointer memory type is supported. */
+#define VA_SURFACE_ATTRIB_MEM_TYPE_USER_PTR 0x00000004
+/**@}*/
+
+/**
+ * \brief VASurfaceAttribExternalBuffers structure for
+ * the VASurfaceAttribExternalBufferDescriptor attribute.
+ */
+typedef struct _VASurfaceAttribExternalBuffers {
+ /** \brief pixel format in fourcc. */
+ unsigned int pixel_format;
+ /** \brief width in pixels. */
+ unsigned int width;
+ /** \brief height in pixels. */
+ unsigned int height;
+ /** \brief total size of the buffer in bytes. */
+ unsigned int data_size;
+ /** \brief number of planes for planar layout */
+ unsigned int num_planes;
+ /** \brief pitch for each plane in bytes */
+ unsigned int pitches[4];
+ /** \brief offset for each plane in bytes */
+ unsigned int offsets[4];
+ /** \brief buffer handles or user pointers */
+ unsigned long *buffers;
+ /** \brief number of elements in the "buffers" array */
+ unsigned int num_buffers;
+ /** \brief flags. See "Surface external buffer descriptor flags". */
+ unsigned int flags;
+ /** \brief reserved for passing private data */
+ void *private_data;
+} VASurfaceAttribExternalBuffers;
+
+/** @name VASurfaceAttribExternalBuffers flags */
+/**@{*/
+/** \brief Enable memory tiling */
+#define VA_SURFACE_EXTBUF_DESC_ENABLE_TILING 0x00000001
+/** \brief Memory is cacheable */
+#define VA_SURFACE_EXTBUF_DESC_CACHED 0x00000002
+/** \brief Memory is non-cacheable */
+#define VA_SURFACE_EXTBUF_DESC_UNCACHED 0x00000004
+/** \brief Memory is write-combined */
+#define VA_SURFACE_EXTBUF_DESC_WC 0x00000008
+/** \brief Memory is protected */
+#define VA_SURFACE_EXTBUF_DESC_PROTECTED 0x80000000
+
+/**@}*/
+
+/**
+ * \brief Queries surface attributes for the supplied config.
+ *
+ * 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[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
+vaQuerySurfaceAttributes(
+ VADisplay dpy,
+ VAConfigID config,
+ VASurfaceAttrib *attrib_list,
+ unsigned int *num_attribs
);
+/**
+ * \brief Creates an array of surfaces
+ *
+ * Creates an array of surfaces. The optional list of attributes shall
+ * 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_*
+ * @param[in] width the surface width
+ * @param[in] height the surface height
+ * @param[out] surfaces the array of newly created surfaces
+ * @param[in] num_surfaces the number of surfaces to create
+ * @param[in] attrib_list the list of (optional) attributes, or \c NULL
+ * @param[in] num_attribs the number of attributes supplied in
+ * \c attrib_list, or zero
+ */
+VAStatus
+vaCreateSurfaces(
+ VADisplay dpy,
+ unsigned int format,
+ unsigned int width,
+ unsigned int height,
+ VASurfaceID *surfaces,
+ unsigned int num_surfaces,
+ VASurfaceAttrib *attrib_list,
+ unsigned int num_attribs
+);
/*
* vaDestroySurfaces - Destroy resources associated with surfaces.
@@ -518,10 +879,32 @@ typedef enum
VAEncSequenceParameterBufferType = 22,
VAEncPictureParameterBufferType = 23,
VAEncSliceParameterBufferType = 24,
- VAEncH264VUIBufferType = 25,
- VAEncH264SEIBufferType = 26,
+ VAEncPackedHeaderParameterBufferType = 25,
+ VAEncPackedHeaderDataBufferType = 26,
VAEncMiscParameterBufferType = 27,
- VABufferTypeMax = 0xff
+ VAEncMacroblockParameterBufferType = 28,
+/* Following are video processing buffer types */
+ /**
+ * \brief Video processing pipeline parameter buffer.
+ *
+ * This buffer describes the video processing pipeline. See
+ * #VAProcPipelineParameterBuffer for details.
+ */
+ VAProcPipelineParameterBufferType = 41,
+ /**
+ * \brief Video filter parameter buffer.
+ *
+ * This buffer describes the video filter parameters. All buffers
+ * inherit from #VAProcFilterParameterBufferBase, thus including
+ * a unique filter buffer type.
+ *
+ * The default buffer used by most filters is #VAProcFilterParameterBuffer.
+ * Filters requiring advanced parameters include, but are not limited to,
+ * deinterlacing (#VAProcFilterParameterBufferDeinterlacing),
+ * color balance (#VAProcFilterParameterBufferColorBalance), etc.
+ */
+ VAProcFilterParameterBufferType = 42,
+ VABufferTypeMax
} VABufferType;
typedef enum
@@ -530,8 +913,43 @@ typedef enum
VAEncMiscParameterTypeRateControl = 1,
VAEncMiscParameterTypeMaxSliceSize = 2,
VAEncMiscParameterTypeAIR = 3,
+ /** \brief Buffer type used to express a maximum frame size (in bits). */
+ VAEncMiscParameterTypeMaxFrameSize = 4,
+ /** \brief Buffer type used for HRD parameters. */
+ VAEncMiscParameterTypeHRD = 5,
} VAEncMiscParameterType;
+/** \brief Packed header type. */
+typedef enum {
+ /** \brief Packed sequence header. */
+ VAEncPackedHeaderSequence = 1,
+ /** \brief Packed picture header. */
+ VAEncPackedHeaderPicture = 2,
+ /** \brief Packed slice header. */
+ VAEncPackedHeaderSlice = 3,
+ /**
+ * \brief Packed raw header.
+ *
+ * Packed raw data header can be used by the client to insert a header
+ * into the bitstream data buffer at the point it is passed, the driver
+ * will handle the raw packed header based on "has_emulation_bytes" field
+ * in the packed header parameter structure.
+ */
+ VAEncPackedHeaderRawData = 4,
+ /** \brief Misc packed header. See codec-specific definitions. */
+ VAEncPackedHeaderMiscMask = 0x80000000,
+} VAEncPackedHeaderType;
+
+/** \brief Packed header parameter. */
+typedef struct _VAEncPackedHeaderParameterBuffer {
+ /** Type of the packed header buffer. See #VAEncPackedHeaderType. */
+ unsigned int type;
+ /** \brief Size of the #VAEncPackedHeaderDataBuffer in bits. */
+ unsigned int bit_length;
+ /** \brief Flag: buffer contains start code emulation prevention bytes? */
+ unsigned char has_emulation_bytes;
+} VAEncPackedHeaderParameterBuffer;
+
/*
* For application, e.g. set a new bitrate
* VABufferID buf_id;
@@ -555,16 +973,35 @@ typedef struct _VAEncMiscParameterBuffer
unsigned int data[0];
} VAEncMiscParameterBuffer;
+
+/** \brief Rate control parameters */
typedef struct _VAEncMiscParameterRateControl
{
- unsigned int bits_per_second; /* this is the maximum bit-rate to be constrained by the rate control implementation */
- unsigned int target_percentage; /* this is the bit-rate the rate control is targeting, as a percentage of the maximum bit-rate */
- /* for example if target_percentage is 95 then the rate control will target a bit-rate that is */
- /* 95% of the maximum bit-rate */
- unsigned int window_size; /* windows size in milliseconds. For example if this is set to 500, then the rate control will guarantee the */
- /* target bit-rate over a 500 ms window */
- unsigned int initial_qp; /* initial QP at I frames */
- unsigned int min_qp;
+ /* this is the maximum bit-rate to be constrained by the rate control implementation */
+ unsigned int bits_per_second;
+ /* this is the bit-rate the rate control is targeting, as a percentage of the maximum
+ * bit-rate for example if target_percentage is 95 then the rate control will target
+ * a bit-rate that is 95% of the maximum bit-rate
+ */
+ unsigned int target_percentage;
+ /* windows size in milliseconds. For example if this is set to 500,
+ * then the rate control will guarantee the target bit-rate over a 500 ms window
+ */
+ unsigned int window_size;
+ /* initial QP at I frames */
+ unsigned int initial_qp;
+ unsigned int min_qp;
+ unsigned int basic_unit_size;
+ union
+ {
+ struct
+ {
+ 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 */
+ } bits;
+ unsigned int value;
+ } rc_flags;
} VAEncMiscParameterRateControl;
typedef struct _VAEncMiscParameterFrameRate
@@ -589,6 +1026,27 @@ typedef struct _VAEncMiscParameterAIR
unsigned int air_auto; /* if set to 1 then hardware auto-tune the AIR threshold */
} VAEncMiscParameterAIR;
+typedef struct _VAEncMiscParameterHRD
+{
+ unsigned int initial_buffer_fullness; /* in bits */
+ unsigned int buffer_size; /* in bits */
+} VAEncMiscParameterHRD;
+
+/**
+ * \brief Defines a maximum frame size (in bits).
+ *
+ * This misc parameter buffer defines the maximum size of a frame (in
+ * bits). The encoder will try to make sure that each frame does not
+ * exceed this size. Otherwise, if the frame size exceeds this size,
+ * the \c status flag of #VACodedBufferSegment will contain
+ * #VA_CODED_BUF_STATUS_FRAME_SIZE_OVERFLOW.
+ */
+typedef struct _VAEncMiscParameterBufferMaxFrameSize {
+ /** \brief Type. Shall be set to #VAEncMiscParameterTypeMaxFrameSize. */
+ VAEncMiscParameterType type;
+ /** \brief Maximum size of a frame (in bits). */
+ unsigned int max_frame_size;
+} VAEncMiscParameterBufferMaxFrameSize;
/*
* There will be cases where the bitstream buffer will not have enough room to hold
@@ -631,94 +1089,7 @@ typedef struct _VAEncPictureParameterBufferJPEG
VABufferID coded_buf;
} VAEncPictureParameterBufferJPEG;
-/* data struct for JPEG decoding */
-
-/* Quantization table */
-typedef struct _VAIQMatrixBufferJPEG
-{
- int precision[4]; /* valid value: 0(8-bits) , 1(16-bits), precision[Tq](Tq=0,1,2,3)
- * specifies precision for destination Tq
- */
- unsigned char quantiser_matrix[4][128]; /* quantiser_matrix[Tq](Tq=0,1,2,3) specifies a
- * quantization table for destination Tq in zig-zag
- * scan order. Only the first 64 bytes are valid for each
- * table if precision is 0(8-bits).
- */
-} VAIQMatrixBufferJPEG;
-
-#define VA_JPEG_SOF0 0xC0
-#define VA_JPEG_SOF1 0xC1
-#define VA_JPEG_SOF2 0xC2
-#define VA_JPEG_SOF3 0xC3
-#define VA_JPEG_SOF5 0xC5
-#define VA_JPEG_SOF6 0xC6
-#define VA_JPEG_SOF7 0xC7
-#define VA_JPEG_SOF9 0xC9
-#define VA_JPEG_SOF10 0xCA
-#define VA_JPEG_SOF11 0xCB
-#define VA_JPEG_SOF13 0xCD
-#define VA_JPEG_SOF14 0xCE
-
-/* JPEG Picture Parameter Buffer */
-typedef struct _VAPictureParameterBufferJPEG
-{
- unsigned int type; /* SOFn */
- unsigned int sample_precision;
- unsigned int image_width;
- unsigned int image_height;
- unsigned int num_components;
- struct {
- unsigned char component_id; /* Ci, the range is 0-255, see B.2.2 */
- unsigned char h_sampling_factor;
- unsigned char v_sampling_factor;
- unsigned char quantiser_table_selector; /* Tqi, quantization table destination selector */
- } components[4];
-
- /* ROI (region of interest), for JPEG2000 */
- struct {
- int enabled;
- int start_x;
- int start_y;
- int end_x;
- int end_y;
- } roi;
-
- int rotation;
-} VAPictureParameterBufferJPEG;
-
-typedef struct _VAHuffmanTableBufferJPEG
-{
- struct {
- unsigned char dc_bits[16]; /* Number of Huffman codes of length i for DC */
- unsigned char dc_huffval[20]; /* Value associated with each Huffman code for DC */
- unsigned char ac_bits[16]; /* Number of Huffman codes of length i for AC */
- unsigned char ac_huffval[256]; /* Value associated with each Huffman code for AC */
- } huffman_table[4]; /* Up to 4 huffman tables, huffman_table[Th](Th=0,1,2,3)
- * specifies a buffman table for destination Th.
- */
-
-} VAHuffmanTableBufferJPEG;
-
-/* JPEG Scan Parameter Buffer, The Scan of is similar to
- * the Slice of other codecs */
-typedef struct _VASliceParameterBufferJPEG
-{
- unsigned int slice_data_size; /* number of bytes in the slice data buffer for this slice */
- unsigned int slice_data_offset; /* the offset to the first byte of slice data */
- unsigned int slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX definitions */
- unsigned int slice_horizontal_position;
- unsigned int slice_vertical_position;
-
- unsigned int num_components;
- struct {
- int component_id; /* Csj, it must match one of component_ids specified in VAPictureParameterBufferJPEG */
- int dc_selector; /* Tdj(0,1,2,3) */
- int ac_selector; /* Taj(0,1,2,3) */
- } components[4];
-
- int restart_interval; /* specifies the number of MCUs in restart interval, defined in DRI marker */
- int num_mcus; /* indicates the number of MCUs in a scan */
-} VASliceParameterBufferJPEG;
+#include <va/va_dec_jpeg.h>
/****************************
* MPEG-2 data structures
@@ -1282,38 +1653,6 @@ typedef struct _VAEncSliceParameterBuffer
} slice_flags;
} VAEncSliceParameterBuffer;
-/****************************
- * H.264 specific encode data structures
- ****************************/
-
-typedef struct _VAEncSequenceParameterBufferH264
-{
- unsigned char seq_parameter_set_id;
- unsigned char level_idc;
- unsigned int intra_period;
- unsigned int intra_idr_period;
- unsigned int max_num_ref_frames;
- unsigned int picture_width_in_mbs;
- unsigned int picture_height_in_mbs;
- unsigned int bits_per_second;
- unsigned int frame_rate;
- unsigned int initial_qp;
- unsigned int min_qp;
- unsigned int basic_unit_size;
- unsigned char vui_flag;
-} VAEncSequenceParameterBufferH264;
-
-#define H264_LAST_PICTURE_EOSEQ 0x01 /* the last picture in the sequence */
-#define H264_LAST_PICTURE_EOSTREAM 0x02 /* the last picture in the stream */
-typedef struct _VAEncPictureParameterBufferH264
-{
- VASurfaceID reference_picture;
- VASurfaceID reconstructed_picture;
- VABufferID coded_buf;
- unsigned short picture_width;
- unsigned short picture_height;
- unsigned char last_picture;
-} VAEncPictureParameterBufferH264;
/****************************
* H.263 specific encode data structures
@@ -1429,18 +1768,53 @@ VAStatus vaBufferSetNumElements (
#define VA_CODED_BUF_STATUS_SLICE_OVERFLOW_MASK 0x200
#define VA_CODED_BUF_STATUS_BITRATE_OVERFLOW 0x400
#define VA_CODED_BUF_STATUS_BITRATE_HIGH 0x800
+/**
+ * \brief The frame has exceeded the maximum requested size.
+ *
+ * This flag indicates that the encoded frame size exceeds the value
+ * specified through a misc parameter buffer of type
+ * #VAEncMiscParameterTypeMaxFrameSize.
+ */
+#define VA_CODED_BUF_STATUS_FRAME_SIZE_OVERFLOW 0x1000
#define VA_CODED_BUF_STATUS_AIR_MB_OVER_THRESHOLD 0xff0000
-/*
- * device independent data structure for codedbuffer
+/**
+ * \brief The coded buffer segment contains a single NAL unit.
+ *
+ * This flag indicates that the coded buffer segment contains a
+ * single NAL unit. This flag might be useful to the user for
+ * processing the coded buffer.
+ */
+#define VA_CODED_BUF_STATUS_SINGLE_NALU 0x10000000
+
+/**
+ * \brief Coded buffer segment.
+ *
+ * #VACodedBufferSegment is an element of a linked list describing
+ * some information on the coded buffer. The coded buffer segment
+ * could contain either a single NAL unit, or more than one NAL unit.
+ * It is recommended (but not required) to return a single NAL unit
+ * in a coded buffer segment, and the implementation should set the
+ * VA_CODED_BUF_STATUS_SINGLE_NALU status flag if that is the case.
*/
typedef struct _VACodedBufferSegment {
- unsigned int size;/* size of the data buffer in the coded buffer segment, in bytes */
- unsigned int bit_offset; /* bit offset into the data buffer where valid bitstream data begins */
- unsigned int status; /* status set by the driver on the coded buffer*/
- unsigned int reserved; /* for future use */
- void *buf; /* pointer to the beginning of the data buffer in the coded buffer segment */
- void *next; /* pointer to the next VACodedBufferSegment */
+ /**
+ * \brief Size of the data buffer in this segment (in bytes).
+ */
+ unsigned int size;
+ /** \brief Bit offset into the data buffer where the video data starts. */
+ unsigned int bit_offset;
+ /** \brief Status set by the driver. See \c VA_CODED_BUF_STATUS_*. */
+ unsigned int status;
+ /** \brief Reserved for future use. */
+ unsigned int reserved;
+ /** \brief Pointer to the start of the data buffer. */
+ void *buf;
+ /**
+ * \brief Pointer to the next #VACodedBufferSegment element,
+ * or \c NULL if there is none.
+ */
+ void *next;
} VACodedBufferSegment;
/*
@@ -1594,11 +1968,17 @@ VAStatus vaQuerySurfaceError(
((unsigned long)(unsigned char) (ch0) | ((unsigned long)(unsigned char) (ch1) << 8) | \
((unsigned long)(unsigned char) (ch2) << 16) | ((unsigned long)(unsigned char) (ch3) << 24 ))
-/* a few common FourCCs */
+/*
+ * Pre-defined fourcc codes
+ */
#define VA_FOURCC_NV12 0x3231564E
#define VA_FOURCC_AI44 0x34344149
#define VA_FOURCC_RGBA 0x41424752
+#define VA_FOURCC_RGBX 0x58424752
#define VA_FOURCC_BGRA 0x41524742
+#define VA_FOURCC_BGRX 0x58524742
+#define VA_FOURCC_ARGB 0x42475241
+#define VA_FOURCC_XRGB 0x42475258
#define VA_FOURCC_UYVY 0x59565955
#define VA_FOURCC_YUY2 0x32595559
#define VA_FOURCC_AYUV 0x56555941
@@ -1606,6 +1986,17 @@ VAStatus vaQuerySurfaceError(
#define VA_FOURCC_YV12 0x32315659
#define VA_FOURCC_P208 0x38303250
#define VA_FOURCC_IYUV 0x56555949
+#define VA_FOURCC_YV24 0x34325659
+#define VA_FOURCC_YV32 0x32335659
+#define VA_FOURCC_Y800 0x30303859
+#define VA_FOURCC_IMC3 0x33434D49
+#define VA_FOURCC_411P 0x50313134
+#define VA_FOURCC_422H 0x48323234
+#define VA_FOURCC_422V 0x56323234
+#define VA_FOURCC_444P 0x50343434
+#define VA_FOURCC_RGBP 0x50424752
+#define VA_FOURCC_BGRP 0x50524742
+#define VA_FOURCC_411R 0x52313134 /* rotated 411P */
/* byte order */
#define VA_LSB_FIRST 1
@@ -2095,6 +2486,8 @@ VAStatus vaSetDisplayAttributes (
int num_attributes
);
+/**@}*/
+
#ifdef __cplusplus
}
#endif
diff --git a/third_party/libva/va/va_android.h b/third_party/libva/va/va_android.h
index ca73b84..796ab63 100644
--- a/third_party/libva/va/va_android.h
+++ b/third_party/libva/va/va_android.h
@@ -26,6 +26,11 @@
#include <va/va.h>
+/** \brief Android Gralloc buffer memory type. */
+#define VA_SURFACE_ATTRIB_MEM_TYPE_ANDROID_GRALLOC 0x00100000
+/** \brief Android ION buffer memory type. */
+#define VA_SURFACE_ATTRIB_MEM_TYPE_ANDROID_ION 0x00200000
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/third_party/libva/va/va_backend.h b/third_party/libva/va/va_backend.h
index 47ca719..9fe3dcf 100644
--- a/third_party/libva/va/va_backend.h
+++ b/third_party/libva/va/va_backend.h
@@ -35,6 +35,23 @@
typedef struct VADriverContext *VADriverContextP;
typedef struct VADisplayContext *VADisplayContextP;
+/** \brief VA display types. */
+enum {
+ /** \brief Mask to major identifier for VA display type. */
+ VA_DISPLAY_MAJOR_MASK = 0xf0,
+
+ /** \brief VA/X11 API is used, through vaGetDisplay() entry-point. */
+ VA_DISPLAY_X11 = 0x10,
+ /** \brief VA/GLX API is used, through vaGetDisplayGLX() entry-point. */
+ VA_DISPLAY_GLX = (VA_DISPLAY_X11 | (1 << 0)),
+ /** \brief VA/Android API is used, through vaGetDisplay() entry-point. */
+ VA_DISPLAY_ANDROID = 0x20,
+ /** \brief VA/DRM API is used, through vaGetDisplayDRM() entry-point. */
+ VA_DISPLAY_DRM = 0x30,
+ /** \brief VA/Wayland API is used, through vaGetDisplayWl() entry-point. */
+ VA_DISPLAY_WAYLAND = 0x40,
+};
+
struct VADriverVTable
{
VAStatus (*vaTerminate) ( VADriverContextP ctx );
@@ -374,6 +391,35 @@ struct VADriverVTable
VADriverContextP ctx,
VASurfaceID surface
);
+
+ /* DEPRECATED */
+ VAStatus
+ (*vaGetSurfaceAttributes)(
+ VADriverContextP dpy,
+ VAConfigID config,
+ VASurfaceAttrib *attrib_list,
+ unsigned int num_attribs
+ );
+
+ VAStatus
+ (*vaCreateSurfaces2)(
+ VADriverContextP ctx,
+ unsigned int format,
+ unsigned int width,
+ unsigned int height,
+ VASurfaceID *surfaces,
+ unsigned int num_surfaces,
+ VASurfaceAttrib *attrib_list,
+ unsigned int num_attribs
+ );
+
+ VAStatus
+ (*vaQuerySurfaceAttributes)(
+ VADriverContextP dpy,
+ VAConfigID config,
+ VASurfaceAttrib *attrib_list,
+ unsigned int *num_attribs
+ );
};
struct VADriverContext
@@ -427,11 +473,43 @@ struct VADriverContext
const char *str_vendor;
void *handle; /* dlopen handle */
-
- void *dri_state;
+
+ /**
+ * \brief DRM state.
+ *
+ * This field holds driver specific data for DRM-based
+ * drivers. This structure is allocated from libva with
+ * calloc(). Do not deallocate from within VA driver
+ * implementations.
+ *
+ * All structures shall be derived from struct drm_state. So, for
+ * instance, this field holds a dri_state structure for VA/X11
+ * drivers that use the DRM protocol.
+ */
+ void *drm_state;
+
void *glx; /* opaque for GLX code */
- void *egl;
- unsigned long reserved[44]; /* reserve for future add-ins, decrease the subscript accordingly */
+
+ /** \brief VA display type. */
+ unsigned long display_type;
+
+ /**
+ * The VA/Wayland implementation hooks.
+ *
+ * This structure is intended for drivers that implement the
+ * VA/Wayland API. libVA allocates this structure with calloc()
+ * and owns the resulting memory.
+ */
+ struct VADriverVTableWayland *vtable_wayland;
+
+ /**
+ * \brief The VA/VPP implementation hooks.
+ *
+ * This structure is allocated from libva with calloc().
+ */
+ struct VADriverVTableVPP *vtable_vpp;
+
+ unsigned long reserved[42]; /* reserve for future add-ins, decrease the subscript accordingly */
};
#define VA_DISPLAY_MAGIC 0x56414430 /* VAD0 */
@@ -456,16 +534,6 @@ struct VADisplayContext
);
void *opaque; /* opaque for display extensions (e.g. GLX) */
-
- VAStatus (*vaCreateNativePixmap) (
- VADisplayContextP pDisplayContext,
- unsigned int width,
- unsigned int height,
- void **native_pixmap);
-
- VAStatus (*vaFreeNativePixmap) (
- VADisplayContextP pDisplayContext,
- void *native_pixmap);
};
typedef VAStatus (*VADriverInit) (
diff --git a/third_party/libva/va/va_backend_tpi.h b/third_party/libva/va/va_backend_tpi.h
index 56998de..141eb75 100644
--- a/third_party/libva/va/va_backend_tpi.h
+++ b/third_party/libva/va/va_backend_tpi.h
@@ -31,77 +31,38 @@
#include <va/va.h>
#include <va/va_backend.h>
-
-#include <linux/videodev2.h>
+#include <va/va_tpi.h>
struct VADriverVTableTPI
{
- /* device specific */
- VAStatus (*vaCreateSurfaceFromCIFrame) (
- VADriverContextP ctx,
- unsigned long frame_id,
- VASurfaceID *surface /* out */
- );
-
- VAStatus (*vaCreateSurfaceFromV4L2Buf) (
- VADriverContextP ctx,
- int v4l2_fd, /* file descriptor of V4L2 device */
- struct v4l2_format *v4l2_fmt, /* format of V4L2 */
- struct v4l2_buffer *v4l2_buf, /* V4L2 buffer */
- VASurfaceID *surface /* out */
+ VAStatus (*vaCreateSurfacesWithAttribute) (
+ VADisplay dpy,
+ int width,
+ int height,
+ int format,
+ int num_surfaces,
+ VASurfaceID *surfaces, /* out */
+ VASurfaceAttributeTPI *attribute_tpi
);
+
- VAStatus (*vaCreateSurfacesForUserPtr)(
- VADriverContextP ctx,
- int width,
- int height,
- int format,
- int num_surfaces,
- VASurfaceID *surfaces, /* out */
- unsigned size, /* total buffer size need to be allocated */
- unsigned int fourcc, /* expected fourcc */
- unsigned int luma_stride, /* luma stride, could be width aligned with a special value */
- unsigned int chroma_u_stride, /* chroma stride */
- unsigned int chroma_v_stride,
- unsigned int luma_offset, /* could be 0 */
- unsigned int chroma_u_offset, /* UV offset from the beginning of the memory */
- unsigned int chroma_v_offset
- );
-
- VAStatus (*vaCreateSurfaceFromKBuf)(
- VADriverContextP ctx,
- int width,
- int height,
- int format,
- VASurfaceID *surface, /* out */
- unsigned int kbuf_handle, /* kernel buffer handle*/
- unsigned size, /* kernel buffer size */
- unsigned int kBuf_fourcc, /* expected fourcc */
- unsigned int luma_stride, /* luma stride, could be width aligned with a special value */
- unsigned int chroma_u_stride, /* chroma stride */
- unsigned int chroma_v_stride,
- unsigned int luma_offset, /* could be 0 */
- unsigned int chroma_u_offset, /* UV offset from the beginning of the memory */
- unsigned int chroma_v_offset
- );
-
- VAStatus (*vaPutSurfaceBuf) (
- VADriverContextP ctx,
- VASurfaceID surface,
- unsigned char* data,
- int* data_len,
- short srcx,
- short srcy,
- unsigned short srcw,
- unsigned short srch,
- short destx,
- short desty,
- unsigned short destw,
- unsigned short desth,
- VARectangle *cliprects, /* client supplied clip list */
- unsigned int number_cliprects, /* number of clip rects in the clip list */
- unsigned int flags /* de-interlacing flags */
- );
+ VAStatus (*vaPutSurfaceBuf) (
+ VADriverContextP ctx,
+ VASurfaceID surface,
+ unsigned char* data,
+ int* data_len,
+ short srcx,
+ short srcy,
+ unsigned short srcw,
+ unsigned short srch,
+ short destx,
+ short desty,
+ unsigned short destw,
+ unsigned short desth,
+ VARectangle *cliprects, /* client supplied clip list */
+ unsigned int number_cliprects, /* number of clip rects in the clip list */
+ unsigned int flags /* de-interlacing flags */
+ );
};
diff --git a/third_party/libva/va/va_backend_vpp.h b/third_party/libva/va/va_backend_vpp.h
new file mode 100644
index 0000000..b776ef6
--- /dev/null
+++ b/third_party/libva/va/va_backend_vpp.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2007-2011 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef VA_BACKEND_VPP_H
+#define VA_BACKEND_VPP_H
+
+#include <va/va_vpp.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** \brief VTable version for VA/VPP hooks. */
+#define VA_DRIVER_VTABLE_VPP_VERSION 1
+
+struct VADriverVTableVPP {
+ unsigned int version;
+
+ VAStatus
+ (*vaQueryVideoProcFilters)(
+ VADriverContextP ctx,
+ VAContextID context,
+ VAProcFilterType *filters,
+ unsigned int *num_filters
+ );
+
+ VAStatus
+ (*vaQueryVideoProcFilterCaps)(
+ VADriverContextP ctx,
+ VAContextID context,
+ VAProcFilterType type,
+ void *filter_caps,
+ unsigned int *num_filter_caps
+ );
+
+ VAStatus
+ (*vaQueryVideoProcPipelineCaps)(
+ VADriverContextP ctx,
+ VAContextID context,
+ VABufferID *filters,
+ unsigned int num_filters,
+ VAProcPipelineCaps *pipeline_caps
+ );
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* VA_BACKEND_VPP_H */
diff --git a/third_party/libva/va/va_compat.h b/third_party/libva/va/va_compat.h
new file mode 100644
index 0000000..41a3f73
--- /dev/null
+++ b/third_party/libva/va/va_compat.h
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2007-2011 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file va_compat.h
+ * \brief The Compatibility API
+ *
+ * This file contains the \ref api_compat "Compatibility API".
+ */
+
+#ifndef VA_COMPAT_H
+#define VA_COMPAT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup api_compat Compatibility API
+ *
+ * The Compatibility API allows older programs that are not ported to
+ * the current API to still build and run correctly. In particular,
+ * this exposes older API to allow for backwards source compatibility.
+ *
+ * @{
+ */
+
+/**
+ * Makes a string literal out of the macro argument
+ */
+#define VA_CPP_HELPER_STRINGIFY(x) \
+ VA_CPP_HELPER_STRINGIFY_(x)
+#define VA_CPP_HELPER_STRINGIFY_(x) \
+ #x
+
+/**
+ * Concatenates two macro arguments at preprocessing time.
+ */
+#define VA_CPP_HELPER_CONCAT(a, b) \
+ VA_CPP_HELPER_CONCAT_(a, b)
+#define VA_CPP_HELPER_CONCAT_(a, b) \
+ a ## b
+
+/**
+ * Generates the number of macro arguments at preprocessing time.
+ * <http://groups.google.com/group/comp.std.c/browse_thread/thread/77ee8c8f92e4a3fb/346fc464319b1ee5>
+ *
+ * Note: this doesn't work for macros with no arguments
+ */
+#define VA_CPP_HELPER_N_ARGS(...) \
+ VA_CPP_HELPER_N_ARGS_(__VA_ARGS__, VA_CPP_HELPER_N_ARGS_LIST_REV())
+#define VA_CPP_HELPER_N_ARGS_(...) \
+ VA_CPP_HELPER_N_ARGS_LIST(__VA_ARGS__)
+#define VA_CPP_HELPER_N_ARGS_LIST(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a12, a13, a14, a15, a16, N, ...) N
+#define VA_CPP_HELPER_N_ARGS_LIST_REV() \
+ 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
+
+/**
+ * Generates a versioned function alias.
+ *
+ * VA_CPP_HELPER_ALIAS(vaSomeFunction, 0,32,0) will generate
+ * .symber vaSomeFunction_0_32_0, vaSomeFunction@VA_API_0.32.0
+ */
+#define VA_CPP_HELPER_ALIAS(func, major, minor, micro) \
+ VA_CPP_HELPER_ALIAS_(func, major, minor, micro, "@")
+#define VA_CPP_HELPER_ALIAS_DEFAULT(func, major, minor, micro) \
+ VA_CPP_HELPER_ALIAS_(func, major, minor, micro, "@@")
+#define VA_CPP_HELPER_ALIAS_(func, major, minor, micro, binding) \
+ asm(".symver " #func "_" #major "_" #minor "_" #micro ", " \
+ #func binding "VA_API_" #major "." #minor "." #micro)
+
+/* vaCreateSurfaces() */
+
+#ifndef VA_COMPAT_DISABLED
+#define vaCreateSurfaces(dpy, ...) \
+ VA_CPP_HELPER_CONCAT(vaCreateSurfaces, \
+ VA_CPP_HELPER_N_ARGS(dpy, __VA_ARGS__)) \
+ (dpy, __VA_ARGS__)
+#endif
+
+#define vaCreateSurfaces6(dpy, width, height, format, num_surfaces, surfaces) \
+ (vaCreateSurfaces)(dpy, format, width, height, surfaces, num_surfaces, \
+ NULL, 0)
+
+#define vaCreateSurfaces8(dpy, format, width, height, surfaces, num_surfaces, attribs, num_attribs) \
+ (vaCreateSurfaces)(dpy, format, width, height, surfaces, num_surfaces, \
+ attribs, num_attribs)
+
+/*@}*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* VA_COMPAT_H */
diff --git a/third_party/libva/va/va_dec_jpeg.h b/third_party/libva/va/va_dec_jpeg.h
new file mode 100644
index 0000000..9936692
--- /dev/null
+++ b/third_party/libva/va/va_dec_jpeg.h
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2007-2012 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file va_dec_jpeg.h
+ * \brief The JPEG decoding API
+ *
+ * This file contains the \ref api_dec_jpeg "JPEG decoding API".
+ */
+
+#ifndef VA_DEC_JPEG_H
+#define VA_DEC_JPEG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <va/va.h>
+
+/**
+ * \defgroup api_dec_jpeg JPEG decoding API
+ *
+ * This JPEG decoding API supports Baseline profile only.
+ *
+ * @{
+ */
+
+/**
+ * \brief Picture parameter for JPEG decoding.
+ *
+ * This structure holds information from the frame header, along with
+ * definitions from additional segments.
+ */
+typedef struct _VAPictureParameterBufferJPEGBaseline {
+ /** \brief Picture width in pixels. */
+ unsigned short picture_width;
+ /** \brief Picture height in pixels. */
+ unsigned short picture_height;
+
+ struct {
+ /** \brief Component identifier (Ci). */
+ unsigned char component_id;
+ /** \brief Horizontal sampling factor (Hi). */
+ unsigned char h_sampling_factor;
+ /** \brief Vertical sampling factor (Vi). */
+ unsigned char v_sampling_factor;
+ /* \brief Quantization table selector (Tqi). */
+ unsigned char quantiser_table_selector;
+ } components[255];
+ /** \brief Number of components in frame (Nf). */
+ unsigned char num_components;
+} VAPictureParameterBufferJPEGBaseline;
+
+/**
+ * \brief Quantization table for JPEG decoding.
+ *
+ * This structure holds the complete quantization tables. This is an
+ * aggregation of all quantization table (DQT) segments maintained by
+ * the application. i.e. up to 4 quantization tables are stored in
+ * there for baseline profile.
+ *
+ * The #load_quantization_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 _VAIQMatrixBufferJPEGBaseline {
+ /** \brief Specifies which #quantiser_table is valid. */
+ unsigned char load_quantiser_table[4];
+ /** \brief Quanziation tables indexed by table identifier (Tqi). */
+ unsigned char quantiser_table[4][64];
+} VAIQMatrixBufferJPEGBaseline;
+
+/**
+ * \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;
+
+/**
+ * \brief Slice parameter for JPEG decoding.
+ *
+ * This structure holds information from the scan header, along with
+ * definitions from additional segments. The associated slice data
+ * buffer holds all entropy coded segments (ECS) in the scan.
+ */
+typedef struct _VASliceParameterBufferJPEGBaseline {
+ /** @name Codec-independent Slice Parameter Buffer base. */
+ /**@{*/
+ /** \brief Number of bytes in the slice data buffer for this slice. */
+ unsigned int slice_data_size;
+ /** \brief The offset to the first byte of the first MCU. */
+ unsigned int slice_data_offset;
+ /** \brief Slice data buffer flags. See \c VA_SLICE_DATA_FLAG_xxx. */
+ unsigned int slice_data_flag;
+ /**@}*/
+
+ /** \brief Scan horizontal position. */
+ unsigned int slice_horizontal_position;
+ /** \brief Scan vertical position. */
+ unsigned int slice_vertical_position;
+
+ struct {
+ /** \brief Scan component selector (Csj). */
+ unsigned char component_selector;
+ /** \brief DC entropy coding table selector (Tdj). */
+ unsigned char dc_table_selector;
+ /** \brief AC entropy coding table selector (Taj). */
+ unsigned char ac_table_selector;
+ } components[4];
+ /** \brief Number of components in scan (Ns). */
+ unsigned char num_components;
+
+ /** \brief Restart interval definition (Ri). */
+ unsigned short restart_interval;
+ /** \brief Number of MCUs in a scan. */
+ unsigned int num_mcus;
+} VASliceParameterBufferJPEGBaseline;
+
+/**@}*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* VA_DEC_JPEG_H */
diff --git a/third_party/libva/va/va_drmcommon.h b/third_party/libva/va/va_drmcommon.h
new file mode 100644
index 0000000..76820a3
--- /dev/null
+++ b/third_party/libva/va/va_drmcommon.h
@@ -0,0 +1,76 @@
+/*
+ * va_drmcommon.h - Common utilities for DRM-based drivers
+ *
+ * Copyright (c) 2012 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef VA_DRM_COMMON_H
+#define VA_DRM_COMMON_H
+
+/** \brief DRM authentication type. */
+enum {
+ /** \brief Disconnected. */
+ VA_DRM_AUTH_NONE = 0,
+ /**
+ * \brief Connected. Authenticated with DRI1 protocol.
+ *
+ * @deprecated
+ * This is a deprecated authentication type. All DRI-based drivers have
+ * been migrated to use the DRI2 protocol. Newly written drivers shall
+ * use DRI2 protocol only, or a custom authentication means. e.g. opt
+ * for authenticating on the VA driver side, instead of libva side.
+ */
+ VA_DRM_AUTH_DRI1 = 1,
+ /**
+ * \brief Connected. Authenticated with DRI2 protocol.
+ *
+ * This is only useful to VA/X11 drivers. The libva-x11 library provides
+ * a helper function VA_DRI2Authenticate() for authenticating the
+ * connection. However, DRI2 conformant drivers don't need to call that
+ * function since authentication happens on the libva side, implicitly.
+ */
+ VA_DRM_AUTH_DRI2 = 2,
+ /**
+ * \brief Connected. Authenticated with some alternate raw protocol.
+ *
+ * This authentication mode is mainly used in non-VA/X11 drivers.
+ * Authentication happens through some alternative method, at the
+ * discretion of the VA driver implementation.
+ */
+ VA_DRM_AUTH_CUSTOM = 3
+};
+
+/** \brief Base DRM state. */
+struct drm_state {
+ /** \brief DRM connection descriptor. */
+ int fd;
+ /** \brief DRM authentication type. */
+ int auth_type;
+};
+
+/** \brief Kernel DRM buffer memory type. */
+#define VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM 0x10000000
+/** \brief DRM PRIME memory type. */
+#define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME 0x20000000
+
+#endif /* VA_DRM_COMMON_H */
diff --git a/third_party/libva/va/va_egl.h b/third_party/libva/va/va_egl.h
deleted file mode 100644
index 06afe21..0000000
--- a/third_party/libva/va/va_egl.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright (c) 2012 Intel Corporation. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-#ifndef _VA_EGL_H_
-#define _VA_EGL_H_
-
-#include <va/va.h>
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void *VASurfaceEGL;
-
-/*This function is used to get EGLClientBuffer
- * (lower 16bits is buffer index, upper 16bits
- * is BC device id.) from surface id. Application
- * should maintain EGLClientBuffer itself.*/
-
-VAStatus vaGetEGLClientBufferFromSurface (
- VADisplay dpy,
- VASurfaceID surface,
- EGLClientBuffer *buffer /* out*/
-);
-
-/**
- * Return a suitable VADisplay for VA API
- *
- * @param[in] native_dpy the native display
- * @param[in] egl_dpy the EGL display
- * @return a VADisplay
- */
-VADisplay vaGetDisplayEGL(
- VANativeDisplay native_dpy,
- EGLDisplay egl_dpy
-);
-
-/**
- * Return maximum number of EGL targets supported by the implementation
- *
- * @param[in] dpy the VADisplay
- * @return the maximum number of EGL Target
- */
-int vaMaxNumSurfaceTargetsEGL(
- VADisplay dpy
-);
-
-/**
- * Return maximum number of EGL surface attributes supported by the implementation
- *
- * @param[in] dpy the VADisplay
- * @return the maximum number of EGL surface attributes
- */
-int vaMaxNumSurfaceAttributesEGL(
- VADisplay dpy
-);
-
-/**
- * Query supported EGL targets for eglCreateImageKHR().
- *
- * The caller must provide a "target_list" array that can hold at
- * least vaMaxNumSurfaceTargetsEGL() entries. The actual number of
- * targets returned in "target_list" is returned in "num_targets".
- *
- * @param[in]] dpy the VADisplay
- * @param[out] target_list the array to hold target entries
- * @param[out] num_targets the actual number of targets
- * @return VA_STATUS_SUCCESS if successful
- */
-VAStatus vaQuerySurfaceTargetsEGL(
- VADisplay dpy,
- EGLenum *target_list, /* out */
- int *num_targets /* out */
-);
-
-/**
- * Creates a VA/EGL surface with the specified target
- *
- * If target is 0, this means the best efficient target by default.
- *
- * @param[in] dpy the VADisplay
- * @param[in] target the specified EGL target
- * @param[in] width the surface width
- * @param[in] height the surface height
- * @param[out] gl_surface the VA/EGL surface
- * @return VA_STATUS_SUCCESS if successful
- */
-VAStatus vaCreateSurfaceEGL(
- VADisplay dpy,
- EGLenum target,
- unsigned int width,
- unsigned int height,
- VASurfaceEGL *gl_surface
-);
-
-/**
- * Destroy a VA/EGL surface
- *
- * The application shall maintain the live EGL context itself.
- *
- * @param[in] dpy the VA display
- * @param[in] gl_surface the VA surface
- * @return VA_STATUS_SUCCESS if successful
- */
-VAStatus vaDestroySurfaceEGL(
- VADisplay dpy,
- VASurfaceEGL gl_surface
-);
-
-/**
- * Associate a EGL surface with a VA surface
- *
- * @param[in] dpy the VA display
- * @param[in] egl_surface the VA/EGL destination surface
- * @param[in] surface the VA surface
- * @param[in] flags the flags to PutSurface
- * @return VA_STATUS_SUCCESS if successful
- */
-VAStatus vaAssociateSurfaceEGL(
- VADisplay dpy,
- VASurfaceEGL egl_surface,
- VASurfaceID surface,
- unsigned int flags
-);
-
-/**
- * Update the content of a VA/EGL surface
- *
- * Changes to VA surface are committed to VA/EGL surface at this point.
- *
- * @param[in] dpy the VA display
- * @param[in] egl_surface the VA/EGL surface that has been associated with a VA surface
- * @return VA_STATUS_SUCCESS if successful
- */
-VAStatus vaSyncSurfaceEGL(
- VADisplay dpy,
- VASurfaceEGL egl_surface
-);
-
-/**
- * Get the necessary information for eglCreateImageKHR()
- *
- * The caller must provide a "attrib_list" array that can hold at
- * least (2 * vaMaxNumSurfaceAttributesEGL()) entries. The last attribute
- * specified in attrib_list must be EGL_NONE
- *
- * @param[in] dpy the VA display
- * @param[in] egl_surface the VA/EGL surface that has been associated with a VA surface
- * @param[out] target the type of <buffer> for eglCreateImageKHR()
- * @param[out] buffer the EGLClientBuffer for eglCreateImageKHR()
- * @param[out] attrib_list the list of attribute-value pairs for eglCreateImageKHR()
- * @param[in/out] num_attribs input: the number of allocated attribute-value pairs in attrib_list; output: the actual number of attribute-value pairs
- * @return VA_STATUS_SUCCESS if successful
- */
-VAStatus vaGetSurfaceInfoEGL(
- VADisplay dpy,
- VASurfaceEGL egl_surface,
- EGLenum *target, /* out, the type of <buffer> */
- EGLClientBuffer *buffer, /* out */
- EGLint *attrib_list, /* out, the last attribute must be EGL_NONE */
- int *num_attribs /* in/out, the number of attribute-value pairs */
-);
-
-/**
- * Deassociate a EGL surface
- *
- * @param[in] dpy the VA display
- * @param[in] egl_surface the VA/EGL destination surface
- * @return VA_STATUS_SUCCESS if successful
- */
-VAStatus vaDeassociateSurfaceEGL(
- VADisplay dpy,
- VASurfaceEGL egl_surface
-);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _VA_EGL_H_ */
diff --git a/third_party/libva/va/va_enc_h264.h b/third_party/libva/va/va_enc_h264.h
new file mode 100644
index 0000000..604877f
--- /dev/null
+++ b/third_party/libva/va/va_enc_h264.h
@@ -0,0 +1,592 @@
+/*
+ * Copyright (c) 2007-2011 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file va_enc_h264.h
+ * \brief The H.264 encoding API
+ *
+ * This file contains the \ref api_enc_h264 "H.264 encoding API".
+ */
+
+#ifndef VA_ENC_H264_H
+#define VA_ENC_H264_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup api_enc_h264 H.264 encoding API
+ *
+ * @{
+ */
+
+/**
+ * @name Picture flags
+ *
+ * Those flags flags are meant to signal when a picture marks the end
+ * of a sequence, a stream, or even both at once.
+ *
+ * @{
+ */
+/**
+ * \brief Marks the last picture in the sequence.
+ *
+ * i.e. the driver appends \c end_of_seq() NAL unit to the encoded frame.
+ */
+#define H264_LAST_PICTURE_EOSEQ 0x01
+/**
+ * \brief Marks the last picture in the stream.
+ *
+ * i.e. the driver appends \c end_of_stream() NAL unit to the encoded frame.
+ */
+#define H264_LAST_PICTURE_EOSTREAM 0x02
+/**@}*/
+
+/**
+ * \brief Packed header types specific to H.264 encoding.
+ *
+ * Types of packed headers generally used for H.264 encoding. Each
+ * associated packed header data buffer shall contain the start code
+ * prefix 0x000001 followed by the complete NAL unit, thus also
+ * including the \c nal_unit_type.
+ *
+ * Note: the start code prefix can contain an arbitrary number of leading
+ * zeros. The driver will skip them for emulation prevention bytes insertion,
+ * if necessary.
+ */
+typedef enum {
+ /**
+ * \brief Packed Sequence Parameter Set (SPS).
+ *
+ * The corresponding packed header data buffer shall contain the
+ * complete seq_parameter_set_rbsp() syntax element.
+ *
+ * Note: packed \c nal_unit_type shall be equal to 7.
+ */
+ VAEncPackedHeaderH264_SPS = VAEncPackedHeaderSequence,
+ /**
+ * \brief Packed Picture Parameter Set (PPS).
+ *
+ * The corresponding packed header data buffer shall contain the
+ * complete pic_parameter_set_rbsp() syntax element.
+ *
+ * Note: packed \c nal_unit_type shall be equal to 8.
+ */
+ VAEncPackedHeaderH264_PPS = VAEncPackedHeaderPicture,
+ /**
+ * \brief Packed slice header.
+ *
+ * The corresponding packed header data buffer shall contain the
+ * \c slice_header() syntax element only, along with any start
+ * code prefix and NAL unit type preceeding it. i.e. this means
+ * that the buffer does not contain any of the \c slice_data() or
+ * the \c rbsp_slice_trailing_bits().
+ *
+ * Note: packed \c nal_unit_type shall be equal to 1 (non-IDR
+ * picture), or 5 (IDR picture).
+ */
+ VAEncPackedHeaderH264_Slice = VAEncPackedHeaderSlice,
+ /**
+ * \brief Packed Supplemental Enhancement Information (SEI).
+ *
+ * The corresponding packed header data buffer shall contain the
+ * complete sei_rbsp() syntax element, thus including several
+ * sei_message() elements if necessary.
+ *
+ * Note: packed \c nal_unit_type shall be equal to 6.
+ */
+ VAEncPackedHeaderH264_SEI = (VAEncPackedHeaderMiscMask | 1),
+} VAEncPackedHeaderTypeH264;
+
+/**
+ * \brief Sequence parameter for H.264 encoding in baseline, main & high
+ * profiles.
+ *
+ * This structure holds information for \c seq_parameter_set_data() as
+ * defined by the H.264 specification.
+ *
+ * If packed sequence headers mode is used, i.e. if the encoding
+ * pipeline was configured with the #VA_ENC_PACKED_HEADER_SEQUENCE
+ * flag, then the driver expects two more buffers to be provided to
+ * the same \c vaRenderPicture() as this buffer:
+ * - a #VAEncPackedHeaderParameterBuffer with type set to
+ * VAEncPackedHeaderType::VAEncPackedHeaderSequence ;
+ * - a #VAEncPackedHeaderDataBuffer which holds the actual packed
+ * header data.
+ *
+ * If \c seq_scaling_matrix_present_flag is set to \c 1, then a
+ * #VAIQMatrixBufferH264 buffer shall also be provided within the same
+ * \c vaRenderPicture() call as this sequence parameter buffer.
+ */
+typedef struct _VAEncSequenceParameterBufferH264 {
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned char seq_parameter_set_id;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned char level_idc;
+ /** \brief Period between I frames. */
+ unsigned int intra_period;
+ /** \brief Period between IDR frames. */
+ unsigned int intra_idr_period;
+ /** \brief Period between I/P frames. */
+ unsigned int ip_period;
+ /**
+ * \brief Initial bitrate set for this sequence in CBR or VBR modes.
+ *
+ * This field represents the initial bitrate value for this
+ * sequence if CBR or VBR mode is used, i.e. if the encoder
+ * pipeline was created with a #VAConfigAttribRateControl
+ * attribute set to either \ref VA_RC_CBR or \ref VA_RC_VBR.
+ *
+ * The bitrate can be modified later on through
+ * #VAEncMiscParameterRateControl buffers.
+ */
+ unsigned int bits_per_second;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int max_num_ref_frames;
+ /** \brief Picture width in macroblocks. */
+ unsigned short picture_width_in_mbs;
+ /** \brief Picture height in macroblocks. */
+ unsigned short picture_height_in_mbs;
+
+ union {
+ struct {
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int chroma_format_idc : 2;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int frame_mbs_only_flag : 1;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int mb_adaptive_frame_field_flag : 1;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int seq_scaling_matrix_present_flag : 1;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int direct_8x8_inference_flag : 1;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int log2_max_frame_num_minus4 : 4;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int pic_order_cnt_type : 2;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int log2_max_pic_order_cnt_lsb_minus4 : 4;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int delta_pic_order_always_zero_flag : 1;
+ } bits;
+ unsigned int value;
+ } seq_fields;
+
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned char bit_depth_luma_minus8;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned char bit_depth_chroma_minus8;
+
+ /** if pic_order_cnt_type == 1 */
+ /**@{*/
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned char num_ref_frames_in_pic_order_cnt_cycle;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ int offset_for_non_ref_pic;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ int offset_for_top_to_bottom_field;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ int offset_for_ref_frame[256];
+ /**@}*/
+
+ /** @name Cropping (optional) */
+ /**@{*/
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned char frame_cropping_flag;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int frame_crop_left_offset;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int frame_crop_right_offset;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int frame_crop_top_offset;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int frame_crop_bottom_offset;
+ /**@}*/
+
+ /** @name VUI parameters (optional) */
+ /**@{*/
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned char vui_parameters_present_flag;
+ union {
+ struct {
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int aspect_ratio_info_present_flag : 1;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int timing_info_present_flag : 1;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int bitstream_restriction_flag : 1;
+ /** \brief Range: 0 to 16, inclusive. */
+ unsigned int log2_max_mv_length_horizontal : 5;
+ /** \brief Range: 0 to 16, inclusive. */
+ unsigned int log2_max_mv_length_vertical : 5;
+ } bits;
+ unsigned int value;
+ } vui_fields;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned char aspect_ratio_idc;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int sar_width;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int sar_height;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int num_units_in_tick;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int time_scale;
+ /**@}*/
+} VAEncSequenceParameterBufferH264;
+
+/**
+ * \brief Picture parameter for H.264 encoding in baseline, main & high
+ * profiles.
+ *
+ * This structure holds information for \c pic_parameter_set_rbsp() as
+ * defined by the H.264 specification.
+ *
+ * If packed picture headers mode is used, i.e. if the encoding
+ * pipeline was configured with the #VA_ENC_PACKED_HEADER_PICTURE
+ * flag, then the driver expects two more buffers to be provided to
+ * the same \c vaRenderPicture() as this buffer:
+ * - a #VAEncPackedHeaderParameterBuffer with type set to
+ * VAEncPackedHeaderType::VAEncPackedHeaderPicture ;
+ * - a #VAEncPackedHeaderDataBuffer which holds the actual packed
+ * header data.
+ *
+ * If \c pic_scaling_matrix_present_flag is set to \c 1, then a
+ * #VAIQMatrixBufferH264 buffer shall also be provided within the same
+ * \c vaRenderPicture() call as this picture parameter buffer.
+ */
+typedef struct _VAEncPictureParameterBufferH264 {
+ /**
+ * \brief Information about the picture to be encoded.
+ *
+ * See #VAPictureH264 for further description of each field.
+ * Note that CurrPic.picture_id represents the reconstructed
+ * (decoded) picture. User provides a scratch VA surface ID here.
+ */
+ VAPictureH264 CurrPic;
+ /**
+ * \brief Decoded Picture Buffer (DPB).
+ *
+ * This array represents the list of reconstructed (decoded)
+ * frames used as reference. It is important to keep track of
+ * reconstructed frames so that they can be used later on as
+ * reference for P or B-frames encoding.
+ */
+ VAPictureH264 ReferenceFrames[16];
+ /**
+ * \brief Output encoded bitstream.
+ *
+ * \ref coded_buf has type #VAEncCodedBufferType. It should be
+ * large enough to hold the compressed NAL slice and possibly SPS
+ * and PPS NAL units.
+ */
+ VABufferID coded_buf;
+
+ /** \brief The picture parameter set referred to in the slice header. */
+ unsigned char pic_parameter_set_id;
+ /** \brief The active sequence parameter set. Range: 0 to 31, inclusive. */
+ unsigned char seq_parameter_set_id;
+
+ /**
+ * \brief OR'd flags describing whether the picture is the last one or not.
+ *
+ * This fields holds 0 if the picture to be encoded is not the last
+ * one in the stream or sequence. Otherwise, it is a combination of
+ * \ref H264_LAST_PICTURE_EOSEQ or \ref H264_LAST_PICTURE_EOSTREAM.
+ */
+ unsigned char last_picture;
+
+ /** \brief The picture identifier.
+ * Range: 0 to \f$2^{log2\_max\_frame\_num\_minus4 + 4} - 1\f$, inclusive.
+ */
+ unsigned short frame_num;
+
+ /** \brief \c pic_init_qp_minus26 + 26. */
+ unsigned char pic_init_qp;
+ /** \brief Maximum reference index for reference picture list 0.
+ * Range: 0 to 31, inclusive.
+ */
+ unsigned char num_ref_idx_l0_active_minus1;
+ /** \brief Maximum reference index for reference picture list 1.
+ * Range: 0 to 31, inclusive.
+ */
+ unsigned char num_ref_idx_l1_active_minus1;
+
+ /** \brief Range: -12 to 12, inclusive. */
+ signed char chroma_qp_index_offset;
+ /** \brief Range: -12 to 12, inclusive. */
+ signed char second_chroma_qp_index_offset;
+
+ union {
+ struct {
+ /** \brief Is picture an IDR picture? */
+ unsigned int idr_pic_flag : 1;
+ /** \brief Is picture a reference picture? */
+ unsigned int reference_pic_flag : 2;
+ /** \brief Selects CAVLC (0) or CABAC (1) entropy coding mode. */
+ unsigned int entropy_coding_mode_flag : 1;
+ /** \brief Is weighted prediction applied to P slices? */
+ unsigned int weighted_pred_flag : 1;
+ /** \brief Range: 0 to 2, inclusive. */
+ unsigned int weighted_bipred_idc : 2;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int constrained_intra_pred_flag : 1;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int transform_8x8_mode_flag : 1;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int deblocking_filter_control_present_flag : 1;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int redundant_pic_cnt_present_flag : 1;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int pic_order_present_flag : 1;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned int pic_scaling_matrix_present_flag : 1;
+ } bits;
+ unsigned int value;
+ } pic_fields;
+} VAEncPictureParameterBufferH264;
+
+/**
+ * \brief Slice parameter for H.264 encoding in baseline, main & high profiles.
+ *
+ * This structure holds information for \c
+ * slice_layer_without_partitioning_rbsp() as defined by the H.264
+ * specification.
+ *
+ * If packed slice headers mode is used, i.e. if the encoding
+ * pipeline was configured with the #VA_ENC_PACKED_HEADER_SLICE
+ * flag, then the driver expects two more buffers to be provided to
+ * the same \c vaRenderPicture() as this buffer:
+ * - a #VAEncPackedHeaderParameterBuffer with type set to
+ * VAEncPackedHeaderType::VAEncPackedHeaderSlice ;
+ * - a #VAEncPackedHeaderDataBuffer which holds the actual packed
+ * header data.
+ *
+ * If per-macroblock encoder configuration is needed, \c macroblock_info
+ * references a buffer of type #VAEncMacroblockParameterBufferH264. This
+ * buffer is not passed to vaRenderPicture(). i.e. it is not destroyed
+ * by subsequent calls to vaRenderPicture() and then can be re-used
+ * without re-allocating the whole buffer.
+ */
+typedef struct _VAEncSliceParameterBufferH264 {
+ /** \brief Starting MB address for this slice. */
+ unsigned int macroblock_address;
+ /** \brief Number of macroblocks in this slice. */
+ unsigned int num_macroblocks;
+ /**
+ * \brief Per-MB encoder configuration buffer, or \c VA_INVALID_ID.
+ *
+ * If per-MB encoder configuration is needed, then \ref macroblock_info
+ * references a buffer of type #VAEncMacroblockParameterBufferH264
+ * (\c VAEncMacroblockParameterBufferType). Otherwise, buffer id
+ * is set to \c VA_INVALID_ID and per-MB configuration is derived
+ * from this slice parameter.
+ *
+ * The \c macroblock_info buffer must hold \ref num_macroblocks
+ * elements.
+ */
+ VABufferID macroblock_info;
+ /** \brief Slice type.
+ * Range: 0..2, 5..7, i.e. no switching slices.
+ */
+ unsigned char slice_type;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned char pic_parameter_set_id;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned short idr_pic_id;
+
+ /** @name If pic_order_cnt_type == 0 */
+ /**@{*/
+ /** \brief The picture order count modulo MaxPicOrderCntLsb. */
+ unsigned short pic_order_cnt_lsb;
+ /** \brief Valid if \c pic_order_present_flag and this is a bottom field. */
+ int delta_pic_order_cnt_bottom;
+ /**@}*/
+ /** @name If pic_order_cnt_type == 1 && !delta_pic_order_always_zero_flag */
+ /**@{*/
+ /** \brief [0]: top, [1]: bottom. */
+ int delta_pic_order_cnt[2];
+ /**@}*/
+
+ /** @name If slice_type == B */
+ /**@{*/
+ unsigned char direct_spatial_mv_pred_flag;
+ /**@}*/
+
+ /** @name If slice_type == P */
+ /**@{*/
+ /** \brief Specifies if
+ * \ref _VAEncPictureParameterBufferH264::num_ref_idx_l0_active_minus1 or
+ * \ref _VAEncPictureParameterBufferH264::num_ref_idx_l1_active_minus1 are
+ * overriden by the values for this slice.
+ */
+ unsigned char num_ref_idx_active_override_flag;
+ /** \brief Maximum reference index for reference picture list 0.
+ * Range: 0 to 31, inclusive.
+ */
+ unsigned char num_ref_idx_l0_active_minus1;
+ /** \brief Maximum reference index for reference picture list 1.
+ * Range: 0 to 31, inclusive.
+ */
+ unsigned char num_ref_idx_l1_active_minus1;
+ /** \brief Reference picture list 0 (for P slices). */
+ VAPictureH264 RefPicList0[32];
+ /** \brief Reference picture list 1 (for B slices). */
+ VAPictureH264 RefPicList1[32];
+ /**@}*/
+
+ /** @name pred_weight_table() */
+ /**@{*/
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned char luma_log2_weight_denom;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned char chroma_log2_weight_denom;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned char luma_weight_l0_flag;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ signed short luma_weight_l0[32];
+ /** \brief Same as the H.264 bitstream syntax element. */
+ signed short luma_offset_l0[32];
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned char chroma_weight_l0_flag;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ signed short chroma_weight_l0[32][2];
+ /** \brief Same as the H.264 bitstream syntax element. */
+ signed short chroma_offset_l0[32][2];
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned char luma_weight_l1_flag;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ signed short luma_weight_l1[32];
+ /** \brief Same as the H.264 bitstream syntax element. */
+ signed short luma_offset_l1[32];
+ /** \brief Same as the H.264 bitstream syntax element. */
+ unsigned char chroma_weight_l1_flag;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ signed short chroma_weight_l1[32][2];
+ /** \brief Same as the H.264 bitstream syntax element. */
+ signed short chroma_offset_l1[32][2];
+ /**@}*/
+
+ /** \brief Range: 0 to 2, inclusive. */
+ unsigned char cabac_init_idc;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ signed char slice_qp_delta;
+ /** @name If deblocking_filter_control_present_flag */
+ /**@{*/
+ /** \brief Range: 0 to 2, inclusive. */
+ unsigned char disable_deblocking_filter_idc;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ signed char slice_alpha_c0_offset_div2;
+ /** \brief Same as the H.264 bitstream syntax element. */
+ signed char slice_beta_offset_div2;
+ /**@}*/
+} VAEncSliceParameterBufferH264;
+
+/**
+ * @name Macroblock neighbour availability bits
+ *
+ * \anchor api_enc_h264_mb_pred_avail_bits
+ * Definitions for macroblock neighbour availability bits used in
+ * intra prediction mode (non MBAFF only).
+ *
+ * @{
+ */
+/** \brief References macroblock in the top-left corner. */
+#define VA_MB_PRED_AVAIL_TOP_LEFT (1 << 2)
+/** \brief References macroblock above the current macroblock. */
+#define VA_MB_PRED_AVAIL_TOP (1 << 4)
+/** \brief References macroblock in the top-right corner. */
+#define VA_MB_PRED_AVAIL_TOP_RIGHT (1 << 3)
+/** \brief References macroblock on the left of the current macroblock. */
+#define VA_MB_PRED_AVAIL_LEFT (1 << 6)
+/**@}*/
+
+/**
+ * \brief Macroblock parameter for H.264 encoding in baseline, main & high
+ * profiles.
+ *
+ * This structure holds per-macroblock information. The buffer must be
+ * allocated with as many elements (macroblocks) as necessary to fit
+ * the slice to be encoded. Besides, the per-macroblock records must
+ * be written in a strict raster order and with no gap. i.e. every
+ * macroblock, regardless of its type, shall have an entry.
+ */
+typedef struct _VAEncMacroblockParameterBufferH264 {
+ /**
+ * \brief Quantization parameter.
+ *
+ * Requested quantization parameter. Range: 0 to 51, inclusive.
+ * If \ref qp is set to 0xff, then the actual value is derived
+ * from the slice-level value: \c pic_init_qp + \c slice_qp_delta.
+ */
+ unsigned char qp;
+
+ union {
+ /** @name Data for intra macroblock */
+ /**@{*/
+ struct {
+ union {
+ /**
+ * \brief Flag specified to override MB neighbour
+ * availability bits from VME stage.
+ *
+ * This flag specifies that macroblock neighbour
+ * availability bits from the VME stage are overriden
+ * by the \ref pred_avail_flags hereunder.
+ */
+ unsigned int pred_avail_override_flag : 1;
+ /**
+ * \brief Bitwise representation of which macroblocks
+ * are available for intra prediction.
+ *
+ * If the slice is intra-coded, this field represents
+ * the macroblocks available for intra prediction.
+ * See \ref api_enc_h264_mb_pred_avail_bits
+ * "macroblock neighbour availability" bit definitions.
+ */
+ unsigned int pred_avail_flags : 8;
+ } bits;
+ unsigned int value;
+ } intra_fields;
+ /**@}*/
+
+ /** @name Data for inter macroblock */
+ /**@{*/
+ struct {
+ union {
+ } bits;
+ unsigned int value;
+ } inter_fields;
+ /**@}*/
+ } info;
+} VAEncMacroblockParameterBufferH264;
+
+/**@}*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* VA_ENC_H264_H */
diff --git a/third_party/libva/va/va_enc_mpeg2.h b/third_party/libva/va/va_enc_mpeg2.h
new file mode 100644
index 0000000..c12c8de
--- /dev/null
+++ b/third_party/libva/va/va_enc_mpeg2.h
@@ -0,0 +1,287 @@
+/*
+ * Copyright (c) 2012 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file va_enc_mpeg2.h
+ * \brief The MPEG-2 encoding API
+ *
+ * This file contains the \ref api_enc_mpeg2 "MPEG-2 encoding API".
+ */
+
+#ifndef _VA_ENC_MPEG2_H_
+#define _VA_ENC_MPEG2_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup api_enc_mpeg2 MPEG-2 encoding API
+ *
+ * @{
+ */
+
+/**
+ * \brief MPEG-2 Quantization Matrix Buffer
+ *
+ */
+typedef VAIQMatrixBufferMPEG2 VAQMatrixBufferMPEG2;
+
+/**
+ * \brief Packed header types specific to MPEG-2 encoding.
+ *
+ * Types of packed headers generally used for MPEG-2 encoding.
+ */
+typedef enum {
+ /**
+ * \brief Packed Sequence Parameter Set (SPS).
+ *
+ */
+ VAEncPackedHeaderMPEG2_SPS = VAEncPackedHeaderSequence,
+ /**
+ * \brief Packed Picture Parameter Set (PPS).
+ *
+ */
+ VAEncPackedHeaderMPEG2_PPS = VAEncPackedHeaderPicture,
+ /**
+ * \brief Packed slice header.
+ *
+ */
+ VAEncPackedHeaderMPEG2_Slice = VAEncPackedHeaderSlice,
+} VAEncPackedHeaderTypeMPEG2;
+
+/**
+ * \brief Sequence parameter for MPEG-2 encoding
+ *
+ * This structure holds information for \c sequence_header() and
+ * sequence_extension().
+ *
+ * If packed sequence headers mode is used, i.e. if the encoding
+ * pipeline was configured with the #VA_ENC_PACKED_HEADER_SEQUENCE
+ * flag, then the driver expects two more buffers to be provided to
+ * the same \c vaRenderPicture() as this buffer:
+ * - a #VAEncPackedHeaderParameterBuffer with type set to
+ * VAEncPackedHeaderType::VAEncPackedHeaderSequence ;
+ * - a #VAEncPackedHeaderDataBuffer which holds the actual packed
+ * header data.
+ *
+ */
+typedef struct _VAEncSequenceParameterBufferMPEG2 {
+ /** \brief Period between I frames. */
+ unsigned int intra_period;
+ /** \brief Period between I/P frames. */
+ unsigned int ip_period;
+ /** \brief Picture width.
+ *
+ * A 14bits unsigned inter, the lower 12bits
+ * is horizontal_size_value, and the upper
+ * 2bits is \c horizontal_size_extension
+ *
+ */
+ unsigned short picture_width;
+ /** \brief Picture height.
+ *
+ * A 14bits unsigned inter, the lower 12bits
+ * is vertical_size_value, and the upper 2bits is
+ * vertical_size_size_extension
+ *
+ */
+ unsigned short picture_height;
+ /**
+ * \brief Initial bitrate set for this sequence in CBR or VBR modes.
+ *
+ * This field represents the initial bitrate value for this
+ * sequence if CBR or VBR mode is used, i.e. if the encoder
+ * pipeline was created with a #VAConfigAttribRateControl
+ * attribute set to either \ref VA_RC_CBR or \ref VA_RC_VBR.
+ *
+ * bits_per_second may be derived from bit_rate.
+ *
+ */
+ unsigned int bits_per_second;
+ /**
+ * \brief Frame rate
+ *
+ * Derived from frame_rate_value, frame_rate_extension_n and
+ * frame_rate_extension_d
+ *
+ */
+ float frame_rate;
+ /** \brief Same as the element in sequence_header() */
+ unsigned short aspect_ratio_information;
+ /** \brief Define the size of VBV */
+ unsigned int vbv_buffer_size;
+
+ union {
+ struct {
+ /** \brief Same as the element in Sequence extension() */
+ unsigned int profile_and_level_indication : 8;
+ /** \brief Same as the element in Sequence extension() */
+ unsigned int progressive_sequence : 1;
+ /** \brief Same as the element in Sequence extension() */
+ unsigned int chroma_format : 2;
+ /** \brief Same as the element in Sequence extension() */
+ unsigned int low_delay : 1;
+ /** \brief Same as the element in Sequence extension() */
+ unsigned int frame_rate_extension_n : 2;
+ /** \brief Same as the element in Sequence extension() */
+ unsigned int frame_rate_extension_d : 5;
+ } bits;
+ unsigned int value;
+ } sequence_extension;
+
+ /** \brief Flag to indicate the following GOP header are being updated */
+ unsigned int new_gop_header;
+
+ union {
+ struct {
+ /** \brief Time code */
+ unsigned int time_code : 25;
+ /** \brief Same as the element in GOP header */
+ unsigned int closed_gop : 1;
+ /** \brief SAme as the element in GOP header */
+ unsigned int broken_link : 1;
+ } bits;
+ unsigned int value;
+ } gop_header;
+} VAEncSequenceParameterBufferMPEG2;
+
+/**
+ * \brief Picture parameter for MPEG-2 encoding
+ *
+ * This structure holds information for picture_header() and
+ * picture_coding_extension()
+ *
+ * If packed picture headers mode is used, i.e. if the encoding
+ * pipeline was configured with the #VA_ENC_PACKED_HEADER_PICTURE
+ * flag, then the driver expects two more buffers to be provided to
+ * the same \c vaRenderPicture() as this buffer:
+ * - a #VAEncPackedHeaderParameterBuffer with type set to
+ * VAEncPackedHeaderType::VAEncPackedHeaderPicture ;
+ * - a #VAEncPackedHeaderDataBuffer which holds the actual packed
+ * header data.
+ *
+ */
+typedef struct _VAEncPictureParameterBufferMPEG2 {
+ /** \brief Forward reference picture */
+ VASurfaceID forward_reference_picture;
+ /** \brief Backward reference picture */
+ VASurfaceID backward_reference_picture;
+ /** \brief Reconstructed(decoded) picture */
+ VASurfaceID reconstructed_picture;
+ /**
+ * \brief Output encoded bitstream.
+ *
+ * \ref coded_buf has type #VAEncCodedBufferType. It should be
+ * large enough to hold the compressed NAL slice and possibly SPS
+ * and PPS NAL units.
+ */
+ VABufferID coded_buf;
+ /**
+ * \brief Flag to indicate the picture is the last one or not.
+ *
+ * This fields holds 0 if the picture to be encoded is not
+ * the last one in the stream. Otherwise, it
+ * is \ref MPEG2_LAST_PICTURE_EOSTREAM.
+ */
+ unsigned char last_picture;
+ /** \brief Picture type */
+ VAEncPictureType picture_type;
+ /** \brief Same as the element in picture_header() */
+ unsigned int temporal_reference;
+ /** \brief Same as the element in picture_header() */
+ unsigned int vbv_delay;
+ /** \brief Same as the element in Picture coding extension */
+ unsigned char f_code[2][2];
+ union {
+ struct {
+ /** \brief Same as the element in Picture coding extension */
+ unsigned int intra_dc_precision : 2;
+ /** \brief Same as the element in Picture coding extension */
+ unsigned int picture_structure : 2;
+ /** \brief Same as the element in Picture coding extension */
+ unsigned int top_field_first : 1;
+ /** \brief Same as the element in Picture coding extension */
+ unsigned int frame_pred_frame_dct : 1;
+ /** \brief Same as the element in Picture coding extension */
+ unsigned int concealment_motion_vectors : 1;
+ /** \brief Same as the element in Picture coding extension */
+ unsigned int q_scale_type : 1;
+ /** \brief Same as the element in Picture coding extension */
+ unsigned int intra_vlc_format : 1;
+ /** \brief Same as the element in Picture coding extension */
+ unsigned int alternate_scan : 1;
+ /** \brief Same as the element in Picture coding extension */
+ unsigned int repeat_first_field : 1;
+ /** \brief Same as the element in Picture coding extension */
+ unsigned int progressive_frame : 1;
+ /** \brief Same as the element in Picture coding extension */
+ unsigned int composite_display_flag : 1;
+ } bits;
+ unsigned int value;
+ } picture_coding_extension;
+
+ /* \brief Parameters for composite display
+ *
+ * Valid only when omposite_display_flag is 1
+ */
+ union {
+ struct {
+ /** \brief Same as the element in Picture coding extension */
+ unsigned int v_axis : 1;
+ /** \brief Same as the element in Picture coding extension */
+ unsigned int field_sequence : 3;
+ /** \brief Same as the element in Picture coding extension */
+ unsigned int sub_carrier : 1;
+ /** \brief Same as the element in Picture coding extension */
+ unsigned int burst_amplitude : 7;
+ /** \brief Same as the element in Picture coding extension */
+ unsigned int sub_carrier_phase : 8;
+ } bits;
+ unsigned int value;
+ } composite_display;
+} VAEncPictureParameterBufferMPEG2;
+
+/**
+ * \brief Slice parameter for MPEG-2 encoding
+ *
+ */
+typedef struct _VAEncSliceParameterBufferMPEG2 {
+ /** \brief Starting MB address for this slice. */
+ unsigned int macroblock_address;
+ /** \brief Number of macroblocks in this slice. */
+ unsigned int num_macroblocks;
+ /** \brief Same as the element in slice() */
+ int quantiser_scale_code;
+ /** \brief Flag to indicate intra slice */
+ int is_intra_slice;
+} VAEncSliceParameterBufferMPEG2;
+
+/**@}*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _VA_ENC_MPEG2_H_ */
diff --git a/third_party/libva/va/va_tpi.h b/third_party/libva/va/va_tpi.h
index 921c8fe..d4a9d06 100644
--- a/third_party/libva/va/va_tpi.h
+++ b/third_party/libva/va/va_tpi.h
@@ -21,34 +21,51 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#ifndef _VA_TPI_H_
+#define _VA_TPI_H_
-/* Wrap a CI (camera imaging) frame as a VA surface to share captured video between camear
- * and VA encode. With frame_id, VA driver need to call CI interfaces to get the information
- * of the frame, and to determine if the frame can be wrapped as a VA surface
- *
- * Application should make sure the frame is idle before the frame is passed into VA stack
- * and also a vaSyncSurface should be called before application tries to access the frame
- * from CI stack
- */
#include <va/va.h>
#ifdef __cplusplus
extern "C" {
#endif
-VAStatus vaCreateSurfaceFromCIFrame (
- VADisplay dpy,
- unsigned long frame_id,
- VASurfaceID *surface /* out */
-);
-VAStatus vaCreateSurfaceFromV4L2Buf(
- VADisplay dpy,
- int v4l2_fd, /* file descriptor of V4L2 device */
- struct v4l2_format *v4l2_fmt, /* format of V4L2 */
- struct v4l2_buffer *v4l2_buf, /* V4L2 buffer */
- VASurfaceID *surface /* out */
-);
+typedef enum {
+ VAExternalMemoryNULL, /* it is not external buffer, but requires the implementation allocates
+ * the surface with the input attribute
+ */
+ VAExternalMemoryV4L2Buffer,
+ VAExternalMemoryCIFrame, /* the memory is from camera frames and buffers points the frame ID list */
+ VAExternalMemoryUserPointer, /* the memory is malloc-ed and buffers points to the buffers */
+ VAExternalMemoryKernelDRMBufffer, /* the memory is from kernel DRM buffers and buffers points the
+ * DRM buffer handle list
+ */
+ VAExternalMemoryAndroidGrallocBuffer, /* the memory is from Android Gralloc memory, and buffers points
+ * the gralloc native_handle_t list
+ */
+} VASurfaceMemoryType;
+
+typedef struct _VASurfaceAttributeTPI {
+ VASurfaceMemoryType type;
+ unsigned int width;
+ unsigned int height;
+ unsigned int size;
+ unsigned int pixel_format; /* buffer format */
+ unsigned int tiling; /* the memory is tiling or not */
+ unsigned int luma_stride; /* luma stride, could be width aligned with a special value */
+ unsigned int chroma_u_stride; /* chroma stride */
+ unsigned int chroma_v_stride;
+ unsigned int luma_offset; /* could be 0 */
+ unsigned int chroma_u_offset; /* U offset from the beginning of the memory */
+ unsigned int chroma_v_offset; /* V offset from the beginning of the memory */
+ unsigned int count; /* buffer count for surface creation */
+ unsigned int *buffers; /* buffer handles or user pointers */
+ unsigned int reserved[4]; /* used to pass additional information, like
+ * Android native window pointer
+ */
+} VASurfaceAttributeTPI;
+
VAStatus vaPutSurfaceBuf (
VADisplay dpy,
@@ -69,51 +86,18 @@ VAStatus vaPutSurfaceBuf (
);
-/*
- * The surfaces could be shared and accessed with extern devices
- * which has special requirements, e.g. stride alignment
- * This API is used to force libVA video surfaces are allocated
- * according to these external requirements
- * Special API for V4L2 user pointer support
- */
-VAStatus vaCreateSurfacesForUserPtr(
+VAStatus vaCreateSurfacesWithAttribute (
VADisplay dpy,
int width,
int height,
int format,
int num_surfaces,
VASurfaceID *surfaces, /* out */
- unsigned size, /* total buffer size need to be allocated */
- unsigned int fourcc, /* expected fourcc */
- unsigned int luma_stride, /* luma stride, could be width aligned with a special value */
- unsigned int chroma_u_stride, /* chroma stride */
- unsigned int chroma_v_stride,
- unsigned int luma_offset, /* could be 0 */
- unsigned int chroma_u_offset, /* UV offset from the beginning of the memory */
- unsigned int chroma_v_offset
+ VASurfaceAttributeTPI *attribute_tpi
);
-/*
- * Create surface from the Kernel buffer
- */
-VAStatus vaCreateSurfaceFromKBuf(
- VADisplay dpy,
- int width,
- int height,
- int format,
- VASurfaceID *surface, /* out */
- unsigned int kbuf_handle, /* kernel buffer handle*/
- unsigned size, /* kernel buffer size */
- unsigned int kBuf_fourcc, /* expected fourcc */
- unsigned int luma_stride, /* luma stride, could be width aligned with a special value */
- unsigned int chroma_u_stride, /* chroma stride */
- unsigned int chroma_v_stride,
- unsigned int luma_offset, /* could be 0 */
- unsigned int chroma_u_offset, /* UV offset from the beginning of the memory */
- unsigned int chroma_v_offset
-);
-
-
#ifdef __cplusplus
}
#endif
+
+#endif
diff --git a/third_party/libva/va/va_trace.h b/third_party/libva/va/va_trace.h
index 43b9fb8..70c3847 100644
--- a/third_party/libva/va/va_trace.h
+++ b/third_party/libva/va/va_trace.h
@@ -41,17 +41,13 @@ extern int trace_flag;
VA_TRACE_FLAG_SURFACE_ENCODE | \
VA_TRACE_FLAG_SURFACE_JPEG)
-#define VA_TRACE_FUNC(trace_func,...) \
- if (trace_flag) { \
- trace_func(__VA_ARGS__); \
- }
#define VA_TRACE_LOG(trace_func,...) \
- if (trace_flag & VA_TRACE_FLAG_LOG) { \
+ if (trace_flag & VA_TRACE_FLAG_LOG) { \
trace_func(__VA_ARGS__); \
}
-#define VA_TRACE_SURFACE(trace_func,...) \
- if (trace_flag & (VA_TRACE_FLAG_SURFACE | VA_TRACE_FLAG_CODEDBUF)) { \
- trace_func(__VA_ARGS__); \
+#define VA_TRACE_SURFACE(trace_func,...) \
+ if (trace_flag & (VA_TRACE_FLAG_SURFACE | VA_TRACE_FLAG_CODEDBUF)) { \
+ trace_func(__VA_ARGS__); \
}
void va_TraceInit(VADisplay dpy);
@@ -78,13 +74,15 @@ void va_TraceCreateConfig(
VAConfigID *config_id /* out */
);
-void va_TraceCreateSurface(
+void va_TraceCreateSurfaces(
VADisplay dpy,
int width,
int height,
int format,
int num_surfaces,
- VASurfaceID *surfaces /* out */
+ VASurfaceID *surfaces, /* out */
+ VASurfaceAttrib *attrib_list,
+ unsigned int num_attribs
);
void va_TraceCreateContext(
@@ -98,6 +96,20 @@ void va_TraceCreateContext(
VAContextID *context /* out */
);
+void va_TraceCreateBuffer (
+ VADisplay dpy,
+ VAContextID context, /* in */
+ VABufferType type, /* in */
+ unsigned int size, /* in */
+ unsigned int num_elements, /* in */
+ void *data, /* in */
+ VABufferID *buf_id /* out */
+);
+
+void va_TraceDestroyBuffer (
+ VADisplay dpy,
+ VABufferID buf_id /* in */
+);
void va_TraceMapBuffer (
VADisplay dpy,
diff --git a/third_party/libva/va/va_version.h b/third_party/libva/va/va_version.h
index 469e599..8fd2315 100644
--- a/third_party/libva/va/va_version.h
+++ b/third_party/libva/va/va_version.h
@@ -37,7 +37,7 @@
*
* The minor version of VA-API (2, if %VA_VERSION is 1.2.3)
*/
-#define VA_MINOR_VERSION 33
+#define VA_MINOR_VERSION 34
/**
* VA_MICRO_VERSION:
@@ -51,7 +51,7 @@
*
* The full version of VA-API, like 1.2.3
*/
-#define VA_VERSION 0.33.0
+#define VA_VERSION 0.34.0
/**
* VA_VERSION_S:
@@ -59,7 +59,7 @@
* The full version of VA-API, in string form (suited for string
* concatenation)
*/
-#define VA_VERSION_S "0.33.0"
+#define VA_VERSION_S "0.34.0"
/**
* VA_VERSION_HEX:
diff --git a/third_party/libva/va/va_vpp.h b/third_party/libva/va/va_vpp.h
new file mode 100644
index 0000000..1fdb530
--- /dev/null
+++ b/third_party/libva/va/va_vpp.h
@@ -0,0 +1,748 @@
+/*
+ * Copyright (c) 2007-2011 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file va_vpp.h
+ * \brief The video processing API
+ *
+ * This file contains the \ref api_vpp "Video processing API".
+ */
+
+#ifndef VA_VPP_H
+#define VA_VPP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup api_vpp Video processing API
+ *
+ * @{
+ *
+ * The video processing API uses the same paradigm as for decoding:
+ * - Query for supported filters;
+ * - Set up a video processing pipeline;
+ * - Send video processing parameters through VA buffers.
+ *
+ * \section api_vpp_caps Query for supported filters
+ *
+ * Checking whether video processing is supported can be performed
+ * with vaQueryConfigEntrypoints() and the profile argument set to
+ * #VAProfileNone. If video processing is supported, then the list of
+ * returned entry-points will include #VAEntrypointVideoProc.
+ *
+ * \code
+ * VAEntrypoint *entrypoints;
+ * int i, num_entrypoints, supportsVideoProcessing = 0;
+ *
+ * num_entrypoints = vaMaxNumEntrypoints();
+ * entrypoints = malloc(num_entrypoints * sizeof(entrypoints[0]);
+ * vaQueryConfigEntrypoints(va_dpy, VAProfileNone,
+ * entrypoints, &num_entrypoints);
+ *
+ * for (i = 0; !supportsVideoProcessing && i < num_entrypoints; i++) {
+ * if (entrypoints[i] == VAEntrypointVideoProc)
+ * supportsVideoProcessing = 1;
+ * }
+ * \endcode
+ *
+ * Then, the vaQueryVideoProcFilters() function is used to query the
+ * list of video processing filters.
+ *
+ * \code
+ * VAProcFilterType filters[VAProcFilterCount];
+ * unsigned int num_filters = VAProcFilterCount;
+ *
+ * // num_filters shall be initialized to the length of the array
+ * vaQueryVideoProcFilters(va_dpy, vpp_ctx, &filters, &num_filters);
+ * \endcode
+ *
+ * Finally, individual filter capabilities can be checked with
+ * vaQueryVideoProcFilterCaps().
+ *
+ * \code
+ * VAProcFilterCap denoise_caps;
+ * unsigned int num_denoise_caps = 1;
+ * vaQueryVideoProcFilterCaps(va_dpy, vpp_ctx,
+ * VAProcFilterNoiseReduction,
+ * &denoise_caps, &num_denoise_caps
+ * );
+ *
+ * VAProcFilterCapDeinterlacing deinterlacing_caps[VAProcDeinterlacingCount];
+ * unsigned int num_deinterlacing_caps = VAProcDeinterlacingCount;
+ * vaQueryVideoProcFilterCaps(va_dpy, vpp_ctx,
+ * VAProcFilterDeinterlacing,
+ * &deinterlacing_caps, &num_deinterlacing_caps
+ * );
+ * \endcode
+ *
+ * \section api_vpp_setup Set up a video processing pipeline
+ *
+ * A video processing pipeline buffer is created for each source
+ * surface we want to process. However, buffers holding filter
+ * parameters can be created once and for all. Rationale is to avoid
+ * multiple creation/destruction chains of filter buffers and also
+ * because filter parameters generally won't change frame after
+ * frame. e.g. this makes it possible to implement a checkerboard of
+ * videos where the same filters are applied to each video source.
+ *
+ * The general control flow is demonstrated by the following pseudo-code:
+ * \code
+ * // Create filters
+ * VABufferID denoise_filter, deint_filter;
+ * VABufferID filter_bufs[VAProcFilterCount];
+ * unsigned int num_filter_bufs;
+ *
+ * for (i = 0; i < num_filters; i++) {
+ * switch (filters[i]) {
+ * case VAProcFilterNoiseReduction: { // Noise reduction filter
+ * VAProcFilterParameterBuffer denoise;
+ * denoise.type = VAProcFilterNoiseReduction;
+ * denoise.value = 0.5;
+ * vaCreateBuffer(va_dpy, vpp_ctx,
+ * VAProcFilterParameterBufferType, sizeof(denoise), 1,
+ * &denoise, &denoise_filter
+ * );
+ * filter_bufs[num_filter_bufs++] = denoise_filter;
+ * break;
+ * }
+ *
+ * case VAProcFilterDeinterlacing: // Motion-adaptive deinterlacing
+ * for (j = 0; j < num_deinterlacing_caps; j++) {
+ * VAProcFilterCapDeinterlacing * const cap = &deinterlacing_caps[j];
+ * if (cap->type != VAProcDeinterlacingMotionAdaptive)
+ * continue;
+ *
+ * VAProcFilterParameterBufferDeinterlacing deint;
+ * deint.type = VAProcFilterDeinterlacing;
+ * deint.algorithm = VAProcDeinterlacingMotionAdaptive;
+ * vaCreateBuffer(va_dpy, vpp_ctx,
+ * VAProcFilterParameterBufferType, sizeof(deint), 1,
+ * &deint, &deint_filter
+ * );
+ * filter_bufs[num_filter_bufs++] = deint_filter;
+ * }
+ * }
+ * }
+ * \endcode
+ *
+ * Once the video processing pipeline is set up, the caller shall check the
+ * implied capabilities and requirements with vaQueryVideoProcPipelineCaps().
+ * This function can be used to validate the number of reference frames are
+ * needed by the specified deinterlacing algorithm, the supported color
+ * primaries, etc.
+ * \code
+ * // Create filters
+ * VAProcPipelineCaps pipeline_caps;
+ * VASurfaceID *forward_references;
+ * unsigned int num_forward_references;
+ * VASurfaceID *backward_references;
+ * unsigned int num_backward_references;
+ * VAProcColorStandardType in_color_standards[VAProcColorStandardCount];
+ * VAProcColorStandardType out_color_standards[VAProcColorStandardCount];
+ *
+ * pipeline_caps.input_color_standards = NULL;
+ * pipeline_caps.num_input_color_standards = ARRAY_ELEMS(in_color_standards);
+ * pipeline_caps.output_color_standards = NULL;
+ * pipeline_caps.num_output_color_standards = ARRAY_ELEMS(out_color_standards);
+ * vaQueryVideoProcPipelineCaps(va_dpy, vpp_ctx,
+ * filter_bufs, num_filter_bufs,
+ * &pipeline_caps
+ * );
+ *
+ * num_forward_references = pipeline_caps.num_forward_references;
+ * forward_references =
+ * malloc(num__forward_references * sizeof(VASurfaceID));
+ * num_backward_references = pipeline_caps.num_backward_references;
+ * backward_references =
+ * malloc(num_backward_references * sizeof(VASurfaceID));
+ * \endcode
+ *
+ * \section api_vpp_submit Send video processing parameters through VA buffers
+ *
+ * Video processing pipeline parameters are submitted for each source
+ * surface to process. Video filter parameters can also change, per-surface.
+ * e.g. the list of reference frames used for deinterlacing.
+ *
+ * \code
+ * foreach (iteration) {
+ * vaBeginPicture(va_dpy, vpp_ctx, vpp_surface);
+ * foreach (surface) {
+ * VARectangle output_region;
+ * VABufferID pipeline_buf;
+ * VAProcPipelineParameterBuffer *pipeline_param;
+ *
+ * vaCreateBuffer(va_dpy, vpp_ctx,
+ * VAProcPipelineParameterBuffer, sizeof(*pipeline_param), 1,
+ * NULL, &pipeline_buf
+ * );
+ *
+ * // Setup output region for this surface
+ * // e.g. upper left corner for the first surface
+ * output_region.x = BORDER;
+ * output_region.y = BORDER;
+ * output_region.width =
+ * (vpp_surface_width - (Nx_surfaces + 1) * BORDER) / Nx_surfaces;
+ * output_region.height =
+ * (vpp_surface_height - (Ny_surfaces + 1) * BORDER) / Ny_surfaces;
+ *
+ * vaMapBuffer(va_dpy, pipeline_buf, &pipeline_param);
+ * pipeline_param->surface = surface;
+ * pipeline_param->surface_region = NULL;
+ * pipeline_param->output_region = &output_region;
+ * pipeline_param->output_background_color = 0;
+ * if (first surface to render)
+ * pipeline_param->output_background_color = 0xff000000; // black
+ * pipeline_param->filter_flags = VA_FILTER_SCALING_HQ;
+ * pipeline_param->filters = filter_bufs;
+ * pipeline_param->num_filters = num_filter_bufs;
+ * vaUnmapBuffer(va_dpy, pipeline_buf);
+ *
+ * // Update reference frames for deinterlacing, if necessary
+ * pipeline_param->forward_references = forward_references;
+ * pipeline_param->num_forward_references = num_forward_references_used;
+ * pipeline_param->backward_references = backward_references;
+ * pipeline_param->num_backward_references = num_bacward_references_used;
+ *
+ * // Apply filters
+ * vaRenderPicture(va_dpy, vpp_ctx, &pipeline_buf, 1);
+ * }
+ * vaEndPicture(va_dpy, vpp_ctx);
+ * }
+ * \endcode
+ */
+
+/** \brief Video filter types. */
+typedef enum _VAProcFilterType {
+ VAProcFilterNone = 0,
+ /** \brief Noise reduction filter. */
+ VAProcFilterNoiseReduction,
+ /** \brief Deinterlacing filter. */
+ VAProcFilterDeinterlacing,
+ /** \brief Sharpening filter. */
+ VAProcFilterSharpening,
+ /** \brief Color balance parameters. */
+ VAProcFilterColorBalance,
+ VAProcFilterCount
+} VAProcFilterType;
+
+/** \brief Deinterlacing types. */
+typedef enum _VAProcDeinterlacingType {
+ VAProcDeinterlacingNone = 0,
+ /** \brief Bob deinterlacing algorithm. */
+ VAProcDeinterlacingBob,
+ /** \brief Weave deinterlacing algorithm. */
+ VAProcDeinterlacingWeave,
+ /** \brief Motion adaptive deinterlacing algorithm. */
+ VAProcDeinterlacingMotionAdaptive,
+ /** \brief Motion compensated deinterlacing algorithm. */
+ VAProcDeinterlacingMotionCompensated,
+ /** \brief Number of deinterlacing algorithms. */
+ VAProcDeinterlacingCount
+} VAProcDeinterlacingType;
+
+/** \brief Color balance types. */
+typedef enum _VAProcColorBalanceType {
+ VAProcColorBalanceNone = 0,
+ /** \brief Hue. */
+ VAProcColorBalanceHue,
+ /** \brief Saturation. */
+ VAProcColorBalanceSaturation,
+ /** \brief Brightness. */
+ VAProcColorBalanceBrightness,
+ /** \brief Contrast. */
+ VAProcColorBalanceContrast,
+ /** \brief Automatically adjusted saturation. */
+ VAProcColorBalanceAutoSaturation,
+ /** \brief Automatically adjusted brightness. */
+ VAProcColorBalanceAutoBrightness,
+ /** \brief Automatically adjusted contrast. */
+ VAProcColorBalanceAutoContrast,
+ /** \brief Number of color balance attributes. */
+ VAProcColorBalanceCount
+} VAProcColorBalanceType;
+
+/** \brief Color standard types. */
+typedef enum _VAProcColorStandardType {
+ VAProcColorStandardNone = 0,
+ /** \brief ITU-R BT.601. */
+ VAProcColorStandardBT601,
+ /** \brief ITU-R BT.709. */
+ VAProcColorStandardBT709,
+ /** \brief ITU-R BT.470-2 System M. */
+ VAProcColorStandardBT470M,
+ /** \brief ITU-R BT.470-2 System B, G. */
+ VAProcColorStandardBT470BG,
+ /** \brief SMPTE-170M. */
+ VAProcColorStandardSMPTE170M,
+ /** \brief SMPTE-240M. */
+ VAProcColorStandardSMPTE240M,
+ /** \brief Generic film. */
+ VAProcColorStandardGenericFilm,
+ /** \brief Number of color standards. */
+ VAProcColorStandardCount
+} VAProcColorStandardType;
+
+/** @name Video pipeline flags */
+/**@{*/
+/** \brief Specifies whether to apply subpictures when processing a surface. */
+#define VA_PROC_PIPELINE_SUBPICTURES 0x00000001
+/**
+ * \brief Specifies whether to apply power or performance
+ * optimizations to a pipeline.
+ *
+ * When processing several surfaces, it may be necessary to prioritize
+ * more certain pipelines than others. This flag is only a hint to the
+ * video processor so that it can omit certain filters to save power
+ * for example. Typically, this flag could be used with video surfaces
+ * decoded from a secondary bitstream.
+ */
+#define VA_PROC_PIPELINE_FAST 0x00000002
+/**@}*/
+
+/** @name Video filter flags */
+/**@{*/
+/** \brief Specifies whether the filter shall be present in the pipeline. */
+#define VA_PROC_FILTER_MANDATORY 0x00000001
+/**@}*/
+
+/** @name Pipeline end flags */
+/**@{*/
+/** \brief Specifies the pipeline is the last. */
+#define VA_PIPELINE_FLAG_END 0x00000004
+/**@}*/
+
+/** \brief Video processing pipeline capabilities. */
+typedef struct _VAProcPipelineCaps {
+ /** \brief Pipeline flags. See VAProcPipelineParameterBuffer::pipeline_flags. */
+ unsigned int pipeline_flags;
+ /** \brief Extra filter flags. See VAProcPipelineParameterBuffer::filter_flags. */
+ unsigned int filter_flags;
+ /** \brief Number of forward reference frames that are needed. */
+ unsigned int num_forward_references;
+ /** \brief Number of backward reference frames that are needed. */
+ unsigned int num_backward_references;
+ /** \brief List of color standards supported on input. */
+ VAProcColorStandardType *input_color_standards;
+ /** \brief Number of elements in \ref input_color_standards array. */
+ unsigned int num_input_color_standards;
+ /** \brief List of color standards supported on output. */
+ VAProcColorStandardType *output_color_standards;
+ /** \brief Number of elements in \ref output_color_standards array. */
+ unsigned int num_output_color_standards;
+} VAProcPipelineCaps;
+
+/** \brief Specification of values supported by the filter. */
+typedef struct _VAProcFilterValueRange {
+ /** \brief Minimum value supported, inclusive. */
+ float min_value;
+ /** \brief Maximum value supported, inclusive. */
+ float max_value;
+ /** \brief Default value. */
+ float default_value;
+ /** \brief Step value that alters the filter behaviour in a sensible way. */
+ float step;
+} VAProcFilterValueRange;
+
+/**
+ * \brief Video processing pipeline configuration.
+ *
+ * This buffer defines a video processing pipeline. As for any buffer
+ * passed to \c vaRenderPicture(), this is a one-time usage model.
+ * However, the actual filters to be applied are provided in the
+ * \c filters field, so they can be re-used in other processing
+ * pipelines.
+ *
+ * The target surface is specified by the \c render_target argument of
+ * \c vaBeginPicture(). The general usage model is described as follows:
+ * - \c vaBeginPicture(): specify the target surface that receives the
+ * processed output;
+ * - \c vaRenderPicture(): specify a surface to be processed and composed
+ * into the \c render_target. Use as many \c vaRenderPicture() calls as
+ * necessary surfaces to compose ;
+ * - \c vaEndPicture(): tell the driver to start processing the surfaces
+ * with the requested filters.
+ *
+ * If a filter (e.g. noise reduction) needs to be applied with different
+ * values for multiple surfaces, the application needs to create as many
+ * filter parameter buffers as necessary. i.e. the filter parameters shall
+ * not change between two calls to \c vaRenderPicture().
+ *
+ * For composition usage models, the first surface to process will generally
+ * use an opaque background color, i.e. \c output_background_color set with
+ * the most significant byte set to \c 0xff. For instance, \c 0xff000000 for
+ * a black background. Then, subsequent surfaces would use a transparent
+ * background color.
+ */
+typedef struct _VAProcPipelineParameterBuffer {
+ /**
+ * \brief Source surface ID.
+ *
+ * ID of the source surface to process. If subpictures are associated
+ * with the video surfaces then they shall be rendered to the target
+ * surface, if the #VA_PROC_PIPELINE_SUBPICTURES pipeline flag is set.
+ */
+ VASurfaceID surface;
+ /**
+ * \brief Region within the source surface to be processed.
+ *
+ * Pointer to a #VARectangle defining the region within the source
+ * surface to be processed. If NULL, \c surface_region implies the
+ * whole surface.
+ */
+ const VARectangle *surface_region;
+ /**
+ * \brief Requested input color primaries.
+ *
+ * Color primaries are implicitly converted throughout the processing
+ * pipeline. The video processor chooses the best moment to apply
+ * this conversion. The set of supported color primaries primaries
+ * for input shall be queried with vaQueryVideoProcPipelineCaps().
+ */
+ VAProcColorStandardType surface_color_standard;
+ /**
+ * \brief Region within the output surface.
+ *
+ * Pointer to a #VARectangle defining the region within the output
+ * surface that receives the processed pixels. If NULL, \c output_region
+ * implies the whole surface.
+ *
+ * Note that any pixels residing outside the specified region will
+ * be filled in with the \ref output_background_color.
+ */
+ const VARectangle *output_region;
+ /**
+ * \brief Background color.
+ *
+ * Background color used to fill in pixels that reside outside of the
+ * specified \ref output_region. The color is specified in ARGB format:
+ * [31:24] alpha, [23:16] red, [15:8] green, [7:0] blue.
+ *
+ * Unless the alpha value is zero or the \ref output_region represents
+ * the whole target surface size, implementations shall not render the
+ * source surface to the target surface directly. Rather, in order to
+ * maintain the exact semantics of \ref output_background_color, the
+ * driver shall use a temporary surface and fill it in with the
+ * appropriate background color. Next, the driver will blend this
+ * temporary surface into the target surface.
+ */
+ unsigned int output_background_color;
+ /**
+ * \brief Requested output color primaries.
+ */
+ VAProcColorStandardType output_color_standard;
+ /**
+ * \brief Pipeline filters. See video pipeline flags.
+ *
+ * Flags to control the pipeline, like whether to apply subpictures
+ * or not, notify the driver that it can opt for power optimizations,
+ * should this be needed.
+ */
+ unsigned int pipeline_flags;
+ /**
+ * \brief Extra filter flags. See vaPutSurface() flags.
+ *
+ * Filter flags are used as a fast path, wherever possible, to use
+ * vaPutSurface() flags instead of explicit filter parameter buffers.
+ *
+ * Allowed filter flags API-wise. Use vaQueryVideoProcPipelineCaps()
+ * to check for implementation details:
+ * - Bob-deinterlacing: \c VA_FRAME_PICTURE, \c VA_TOP_FIELD,
+ * \c VA_BOTTOM_FIELD. Note that any deinterlacing filter
+ * (#VAProcFilterDeinterlacing) will override those flags.
+ * - Color space conversion: \c VA_SRC_BT601, \c VA_SRC_BT709,
+ * \c VA_SRC_SMPTE_240.
+ * - Scaling: \c VA_FILTER_SCALING_DEFAULT, \c VA_FILTER_SCALING_FAST,
+ * \c VA_FILTER_SCALING_HQ, \c VA_FILTER_SCALING_NL_ANAMORPHIC.
+ */
+ unsigned int filter_flags;
+ /**
+ * \brief Array of filters to apply to the surface.
+ *
+ * The list of filters shall be ordered in the same way the driver expects
+ * them. i.e. as was returned from vaQueryVideoProcFilters().
+ * Otherwise, a #VA_STATUS_ERROR_INVALID_FILTER_CHAIN is returned
+ * from vaRenderPicture() with this buffer.
+ *
+ * #VA_STATUS_ERROR_UNSUPPORTED_FILTER is returned if the list
+ * contains an unsupported filter.
+ *
+ * Note: no filter buffer is destroyed after a call to vaRenderPicture(),
+ * only this pipeline buffer will be destroyed as per the core API
+ * specification. This allows for flexibility in re-using the filter for
+ * other surfaces to be processed.
+ */
+ VABufferID *filters;
+ /** \brief Actual number of filters. */
+ unsigned int num_filters;
+ /** \brief Array of forward reference frames. */
+ VASurfaceID *forward_references;
+ /** \brief Number of forward reference frames that were supplied. */
+ unsigned int num_forward_references;
+ /** \brief Array of backward reference frames. */
+ VASurfaceID *backward_references;
+ /** \brief Number of backward reference frames that were supplied. */
+ unsigned int num_backward_references;
+} VAProcPipelineParameterBuffer;
+
+/**
+ * \brief Filter parameter buffer base.
+ *
+ * This is a helper structure used by driver implementations only.
+ * Users are not supposed to allocate filter parameter buffers of this
+ * type.
+ */
+typedef struct _VAProcFilterParameterBufferBase {
+ /** \brief Filter type. */
+ VAProcFilterType type;
+} VAProcFilterParameterBufferBase;
+
+/**
+ * \brief Default filter parametrization.
+ *
+ * Unless there is a filter-specific parameter buffer,
+ * #VAProcFilterParameterBuffer is the default type to use.
+ */
+typedef struct _VAProcFilterParameterBuffer {
+ /** \brief Filter type. */
+ VAProcFilterType type;
+ /** \brief Value. */
+ float value;
+} VAProcFilterParameterBuffer;
+
+/** @name De-interlacing flags */
+/**@{*/
+/**
+ * \brief Bottom field first in the input frame.
+ * if this is not set then assumes top field first.
+ */
+#define VA_DEINTERLACING_BOTTOM_FIELD_FIRST 0x0001
+/**
+ * \brief Bottom field used in deinterlacing.
+ * if this is not set then assumes top field is used.
+ */
+#define VA_DEINTERLACING_BOTTOM_FIELD 0x0002
+/**
+ * \brief A single field is stored in the input frame.
+ * if this is not set then assumes the frame contains two interleaved fields.
+ */
+#define VA_DEINTERLACING_ONE_FIELD 0x0004
+/**@}*/
+
+/** \brief Deinterlacing filter parametrization. */
+typedef struct _VAProcFilterParameterBufferDeinterlacing {
+ /** \brief Filter type. Shall be set to #VAProcFilterDeinterlacing. */
+ VAProcFilterType type;
+ /** \brief Deinterlacing algorithm. */
+ VAProcDeinterlacingType algorithm;
+ /** \brief Deinterlacing flags. */
+ unsigned int flags;
+} VAProcFilterParameterBufferDeinterlacing;
+
+/**
+ * \brief Color balance filter parametrization.
+ *
+ * This buffer defines color balance attributes. A VA buffer can hold
+ * several color balance attributes by creating a VA buffer of desired
+ * number of elements. This can be achieved by the following pseudo-code:
+ *
+ * \code
+ * enum { kHue, kSaturation, kBrightness, kContrast };
+ *
+ * // Initial color balance parameters
+ * static const VAProcFilterParameterBufferColorBalance colorBalanceParams[4] =
+ * {
+ * [kHue] =
+ * { VAProcFilterColorBalance, VAProcColorBalanceHue, 0.5 },
+ * [kSaturation] =
+ * { VAProcFilterColorBalance, VAProcColorBalanceSaturation, 0.5 },
+ * [kBrightness] =
+ * { VAProcFilterColorBalance, VAProcColorBalanceBrightness, 0.5 },
+ * [kSaturation] =
+ * { VAProcFilterColorBalance, VAProcColorBalanceSaturation, 0.5 }
+ * };
+ *
+ * // Create buffer
+ * VABufferID colorBalanceBuffer;
+ * vaCreateBuffer(va_dpy, vpp_ctx,
+ * VAProcFilterParameterBufferType, sizeof(*pColorBalanceParam), 4,
+ * colorBalanceParams,
+ * &colorBalanceBuffer
+ * );
+ *
+ * VAProcFilterParameterBufferColorBalance *pColorBalanceParam;
+ * vaMapBuffer(va_dpy, colorBalanceBuffer, &pColorBalanceParam);
+ * {
+ * // Change brightness only
+ * pColorBalanceBuffer[kBrightness].value = 0.75;
+ * }
+ * vaUnmapBuffer(va_dpy, colorBalanceBuffer);
+ * \endcode
+ */
+typedef struct _VAProcFilterParameterBufferColorBalance {
+ /** \brief Filter type. Shall be set to #VAProcFilterColorBalance. */
+ VAProcFilterType type;
+ /** \brief Color balance attribute. */
+ VAProcColorBalanceType attrib;
+ /**
+ * \brief Color balance value.
+ *
+ * Special case for automatically adjusted attributes. e.g.
+ * #VAProcColorBalanceAutoSaturation,
+ * #VAProcColorBalanceAutoBrightness,
+ * #VAProcColorBalanceAutoContrast.
+ * - If \ref value is \c 1.0 +/- \c FLT_EPSILON, the attribute is
+ * automatically adjusted and overrides any other attribute of
+ * the same type that would have been set explicitly;
+ * - If \ref value is \c 0.0 +/- \c FLT_EPSILON, the attribute is
+ * disabled and other attribute of the same type is used instead.
+ */
+ float value;
+} VAProcFilterParameterBufferColorBalance;
+
+/**
+ * \brief Default filter cap specification (single range value).
+ *
+ * Unless there is a filter-specific cap structure, #VAProcFilterCap is the
+ * default type to use for output caps from vaQueryVideoProcFilterCaps().
+ */
+typedef struct _VAProcFilterCap {
+ /** \brief Range of supported values for the filter. */
+ VAProcFilterValueRange range;
+} VAProcFilterCap;
+
+/** \brief Capabilities specification for the deinterlacing filter. */
+typedef struct _VAProcFilterCapDeinterlacing {
+ /** \brief Deinterlacing algorithm. */
+ VAProcDeinterlacingType type;
+} VAProcFilterCapDeinterlacing;
+
+/** \brief Capabilities specification for the color balance filter. */
+typedef struct _VAProcFilterCapColorBalance {
+ /** \brief Color balance operation. */
+ VAProcColorBalanceType type;
+ /** \brief Range of supported values for the specified operation. */
+ VAProcFilterValueRange range;
+} VAProcFilterCapColorBalance;
+
+/**
+ * \brief Queries video processing filters.
+ *
+ * This function returns the list of video processing filters supported
+ * by the driver. The \c filters array is allocated by the user and
+ * \c num_filters shall be initialized to the number of allocated
+ * elements in that array. Upon successful return, the actual number
+ * of filters will be overwritten into \c num_filters. Otherwise,
+ * \c VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned and \c num_filters
+ * is adjusted to the number of elements that would be returned if enough
+ * space was available.
+ *
+ * The list of video processing filters supported by the driver shall
+ * be ordered in the way they can be iteratively applied. This is needed
+ * for both correctness, i.e. some filters would not mean anything if
+ * applied at the beginning of the pipeline; but also for performance
+ * since some filters can be applied in a single pass (e.g. noise
+ * reduction + deinterlacing).
+ *
+ * @param[in] dpy the VA display
+ * @param[in] context the video processing context
+ * @param[out] filters the output array of #VAProcFilterType elements
+ * @param[in,out] num_filters the number of elements allocated on input,
+ * the number of elements actually filled in on output
+ */
+VAStatus
+vaQueryVideoProcFilters(
+ VADisplay dpy,
+ VAContextID context,
+ VAProcFilterType *filters,
+ unsigned int *num_filters
+);
+
+/**
+ * \brief Queries video filter capabilities.
+ *
+ * This function returns the list of capabilities supported by the driver
+ * for a specific video filter. The \c filter_caps array is allocated by
+ * the user and \c num_filter_caps shall be initialized to the number
+ * of allocated elements in that array. Upon successful return, the
+ * actual number of filters will be overwritten into \c num_filter_caps.
+ * Otherwise, \c VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned and
+ * \c num_filter_caps is adjusted to the number of elements that would be
+ * returned if enough space was available.
+ *
+ * @param[in] dpy the VA display
+ * @param[in] context the video processing context
+ * @param[in] type the video filter type
+ * @param[out] filter_caps the output array of #VAProcFilterCap elements
+ * @param[in,out] num_filter_caps the number of elements allocated on input,
+ * the number of elements actually filled in output
+ */
+VAStatus
+vaQueryVideoProcFilterCaps(
+ VADisplay dpy,
+ VAContextID context,
+ VAProcFilterType type,
+ void *filter_caps,
+ unsigned int *num_filter_caps
+);
+
+/**
+ * \brief Queries video processing pipeline capabilities.
+ *
+ * This function returns the video processing pipeline capabilities. The
+ * \c filters array defines the video processing pipeline and is an array
+ * of buffers holding filter parameters.
+ *
+ * Note: the #VAProcPipelineCaps structure contains user-provided arrays.
+ * If non-NULL, the corresponding \c num_* fields shall be filled in on
+ * input with the number of elements allocated. Upon successful return,
+ * the actual number of elements will be overwritten into the \c num_*
+ * fields. Otherwise, \c VA_STATUS_ERROR_MAX_NUM_EXCEEDED is returned
+ * and \c num_* fields are adjusted to the number of elements that would
+ * be returned if enough space was available.
+ *
+ * @param[in] dpy the VA display
+ * @param[in] context the video processing context
+ * @param[in] filters the array of VA buffers defining the video
+ * processing pipeline
+ * @param[in] num_filters the number of elements in filters
+ * @param[in,out] pipeline_caps the video processing pipeline capabilities
+ */
+VAStatus
+vaQueryVideoProcPipelineCaps(
+ VADisplay dpy,
+ VAContextID context,
+ VABufferID *filters,
+ unsigned int num_filters,
+ VAProcPipelineCaps *pipeline_caps
+);
+
+/**@}*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* VA_VPP_H */
diff --git a/third_party/libva/va/wayland/va_backend_wayland.h b/third_party/libva/va/wayland/va_backend_wayland.h
new file mode 100644
index 0000000..b33e3a1
--- /dev/null
+++ b/third_party/libva/va/wayland/va_backend_wayland.h
@@ -0,0 +1,65 @@
+/*
+ * va_backend_wayland.h - VA driver implementation hooks for Wayland
+ *
+ * Copyright (c) 2012 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef VA_BACKEND_WAYLAND_H
+#define VA_BACKEND_WAYLAND_H
+
+#include <va/va.h>
+#include <wayland-client.h>
+
+/** \brief VA/Wayland API version. */
+#define VA_WAYLAND_API_VERSION (0x574c4400) /* WLD0 */
+
+/* Forward declarations */
+struct VADriverContext;
+
+/** \brief VA/Wayland implementation hooks. */
+struct VADriverVTableWayland {
+ /**
+ * \brief Interface version.
+ *
+ * Implementations shall set this field to \ref VA_WAYLAND_API_VERSION.
+ */
+ unsigned int version;
+
+ /** \brief Hook to return Wayland buffer associated with the VA surface. */
+ VAStatus (*vaGetSurfaceBufferWl)(
+ struct VADriverContext *ctx,
+ VASurfaceID surface,
+ unsigned int flags,
+ struct wl_buffer **out_buffer
+ );
+
+ /** \brief Hook to return Wayland buffer associated with the VA image. */
+ VAStatus (*vaGetImageBufferWl)(
+ struct VADriverContext *ctx,
+ VAImageID image,
+ unsigned int flags,
+ struct wl_buffer **out_buffer
+ );
+};
+
+#endif /* VA_BACKEND_WAYLAND_H */
diff --git a/third_party/libva/va/wayland/va_wayland.h b/third_party/libva/va/wayland/va_wayland.h
new file mode 100644
index 0000000..46fbf2c
--- /dev/null
+++ b/third_party/libva/va/wayland/va_wayland.h
@@ -0,0 +1,131 @@
+/*
+ * va_wayland.h - Wayland API
+ *
+ * Copyright (c) 2012 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef VA_WAYLAND_H
+#define VA_WAYLAND_H
+
+#include <va/va.h>
+#include <wayland-client.h>
+
+/**
+ * \file va_wayland.h
+ * \brief The Wayland rendering API
+ *
+ * This file contains the \ref api_wayland "Wayland rendering API".
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \defgroup api_wayland Wayland rendering API
+ *
+ * @{
+ *
+ * Theory of operations:
+ * - Create a VA display for an active Wayland display ;
+ * - Perform normal VA-API operations, e.g. decode to a VA surface ;
+ * - Get wl_buffer associated to the VA surface ;
+ * - Attach wl_buffer to wl_surface ;
+ */
+
+/**
+ * \brief Returns a VA display wrapping the specified Wayland display.
+ *
+ * This functions returns a (possibly cached) VA display from the
+ * specified Wayland @display.
+ *
+ * @param[in] display the native Wayland display
+ * @return the VA display
+ */
+VADisplay
+vaGetDisplayWl(struct wl_display *display);
+
+/**
+ * \brief Returns the Wayland buffer associated with a VA surface.
+ *
+ * This function returns a wl_buffer handle that can be used as an
+ * argument to wl_surface_attach(). This buffer references the
+ * underlying VA @surface. As such, the VA @surface and Wayland
+ * @out_buffer have the same size and color format. Should specific
+ * color conversion be needed, then VA/VPP API can fulfill this
+ * purpose.
+ *
+ * The @flags describe the desired picture structure. This is useful
+ * to expose a de-interlaced buffer. If the VA driver does not support
+ * any of the supplied flags, then #VA_STATUS_ERROR_FLAG_NOT_SUPPORTED
+ * is returned. The following flags are allowed: \c VA_FRAME_PICTURE,
+ * \c VA_TOP_FIELD, \c VA_BOTTOM_FIELD.
+ *
+ * @param[in] dpy the VA display
+ * @param[in] surface the VA surface
+ * @param[in] flags the deinterlacing flags
+ * @param[out] out_buffer a wl_buffer wrapping the VA @surface
+ * @return VA_STATUS_SUCCESS if successful
+ */
+VAStatus
+vaGetSurfaceBufferWl(
+ VADisplay dpy,
+ VASurfaceID surface,
+ unsigned int flags,
+ struct wl_buffer **out_buffer
+);
+
+/**
+ * \brief Returns the Wayland buffer associated with a VA image.
+ *
+ * This function returns a wl_buffer handle that can be used as an
+ * argument to wl_surface_attach(). This buffer references the
+ * underlying VA @image. As such, the VA @image and Wayland
+ * @out_buffer have the same size and color format. Should specific
+ * color conversion be needed, then VA/VPP API can fulfill this
+ * purpose.
+ *
+ * The @flags describe the desired picture structure. See
+ * vaGetSurfaceBufferWl() description for more details.
+ *
+ * @param[in] dpy the VA display
+ * @param[in] image the VA image
+ * @param[in] flags the deinterlacing flags
+ * @param[out] out_buffer a wl_buffer wrapping the VA @image
+ * @return VA_STATUS_SUCCESS if successful
+ */
+VAStatus
+vaGetImageBufferWl(
+ VADisplay dpy,
+ VAImageID image,
+ unsigned int flags,
+ struct wl_buffer **out_buffer
+);
+
+/**@}*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* VA_WAYLAND_H */
diff --git a/third_party/libva/va/wayland/va_wayland_drm.h b/third_party/libva/va/wayland/va_wayland_drm.h
new file mode 100644
index 0000000..6fb8f52
--- /dev/null
+++ b/third_party/libva/va/wayland/va_wayland_drm.h
@@ -0,0 +1,52 @@
+/*
+ * va_wayland_drm.h - Wayland/DRM helpers
+ *
+ * Copyright (c) 2012 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef VA_WAYLAND_DRM_H
+#define VA_WAYLAND_DRM_H
+
+#include <stdbool.h>
+#include "va_wayland.h"
+#include "va_backend.h"
+#include "va_backend_wayland.h"
+
+/**
+ * \brief Initializes Wayland/DRM layer.
+ *
+ * This is an internal function used to initialize the VA/DRM subsystem
+ * if the application is running on a DRM-based server.
+ *
+ * @param[in] pDisplayContext the VA display context
+ * @return true if successful
+ */
+DLL_HIDDEN
+bool
+va_wayland_drm_create(VADisplayContextP pDisplayContext);
+
+DLL_HIDDEN
+void
+va_wayland_drm_destroy(VADisplayContextP pDisplayContext);
+
+#endif /* VA_WAYLAND_DRM_H */
diff --git a/third_party/libva/va/wayland/va_wayland_emgd.h b/third_party/libva/va/wayland/va_wayland_emgd.h
new file mode 100644
index 0000000..053b6b4
--- /dev/null
+++ b/third_party/libva/va/wayland/va_wayland_emgd.h
@@ -0,0 +1,52 @@
+/*
+ * va_wayland_emgd.h - Wayland/EMGD helpers
+ *
+ * Copyright (c) 2012 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef VA_WAYLAND_EMGD_H
+#define VA_WAYLAND_EMGD_H
+
+#include <stdbool.h>
+#include "va_wayland.h"
+#include "va_backend.h"
+#include "va_backend_wayland.h"
+
+/**
+ * \brief Initializes Wayland/EMGD layer.
+ *
+ * This is an internal function used to initialize the VA/EMGD subsystem
+ * if the application is running on an EMGD-based server.
+ *
+ * @param[in] pDisplayContext the VA display context
+ * @return true if successful
+ */
+DLL_HIDDEN
+bool
+va_wayland_emgd_create(VADisplayContextP pDisplayContext);
+
+DLL_HIDDEN
+void
+va_wayland_emgd_destroy(VADisplayContextP pDisplayContext);
+
+#endif /* VA_WAYLAND_EMGD_H */
diff --git a/third_party/libva/va/wayland/va_wayland_private.h b/third_party/libva/va/wayland/va_wayland_private.h
new file mode 100644
index 0000000..f09f4b7
--- /dev/null
+++ b/third_party/libva/va/wayland/va_wayland_private.h
@@ -0,0 +1,44 @@
+/*
+ * va_wayland_private.h - Wayland private API
+ *
+ * Copyright (c) 2012 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef VA_WAYLAND_PRIVATE_H
+#define VA_WAYLAND_PRIVATE_H
+
+struct va_wayland_context;
+
+typedef bool (*VADisplayContextCreateFunc)(VADisplayContextP pDisplayContext);
+typedef void (*VADisplayContextDestroyFunc)(VADisplayContextP pDisplayContext);
+
+/* VA/Wayland base display context */
+typedef struct va_wayland_context {
+ VADisplayContextDestroyFunc destroy;
+} VADisplayContextWayland, *VADisplayContextWaylandP;
+
+DLL_HIDDEN
+void
+va_wayland_error(const char *format, ...);
+
+#endif /* VA_WAYLAND_PRIVATE_H */
diff --git a/third_party/libva/va/x11/va_dricommon.h b/third_party/libva/va/x11/va_dricommon.h
index 4d6e3aa..eb6ddad 100644
--- a/third_party/libva/va/x11/va_dricommon.h
+++ b/third_party/libva/va/x11/va_dricommon.h
@@ -32,18 +32,19 @@
#endif
#include <va/va_backend.h>
+#include <va/va_drmcommon.h>
#ifdef ANDROID
#define XID unsigned int
#define Bool int
#endif
-enum
-{
- VA_NONE = 0,
- VA_DRI1 = 1,
- VA_DRI2 = 2,
- VA_DUMMY = 3
+enum {
+ /* Compatibility. Do not use for newly-written code. */
+ VA_NONE = VA_DRM_AUTH_NONE,
+ VA_DRI1 = VA_DRM_AUTH_DRI1,
+ VA_DRI2 = VA_DRM_AUTH_DRI2,
+ VA_DUMMY = VA_DRM_AUTH_CUSTOM
};
union dri_buffer
@@ -71,8 +72,7 @@ struct dri_drawable
#define DRAWABLE_HASH_SZ 32
struct dri_state
{
- int fd;
- int driConnectedFlag; /* 0: disconnected, 1: DRI, 2: DRI2 */
+ struct drm_state base;
#ifndef ANDROID
struct dri_drawable *drawable_hash[DRAWABLE_HASH_SZ];