diff --git a/.travis.yml b/.travis.yml index b8d9e6bfa..6f29b7082 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ before_install: - sudo apt-get install -y autoconf - sudo apt-get install -y automake - sudo apt-get install -y libtool - - sudo apt-get install -y m4 + - sudo apt-get install -y m4 - sudo apt-get install -y lcov - sudo apt-get install -y perl - sudo apt-get install -y pkg-config @@ -57,6 +57,12 @@ script: echo "Don't build on coverty_scan branch."; exit 0; fi + - if [[ -n "$(find -name '*.[ch]' -executable)" ]]; + then + echo "Error, a source code file(s) has the execute bit set:" >&2; + find -name '*.[ch]' -executable; + exit 1; + fi - ./autogen.sh - ./configure --prefix=/usr - make -j4 ; sudo make install diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0be523787..c17b6c3a7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -53,7 +53,7 @@ Please mail to secure-opensource@intel.com directly for security issue If you have a problem, please let us know. IRC is a perfectly fine place to quickly informally bring something up, if you get a response. The -[mailing list](https://lists.01.org/mailman/listinfo/intel-vaapi-media) +[mailing list](https://lists.01.org/postorius/lists/intel-vaapi-media.lists.01.org) is a more durable communication channel. If it's a bug not already documented, by all means please [open an diff --git a/NEWS b/NEWS index 08cf6a501..3b08a442b 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,38 @@ -libva NEWS -- summary of user visible changes. 2019-12-25 -Copyright (C) 2009-2019 Intel Corporation +libva NEWS -- summary of user visible changes. 2020-06-18 +Copyright (C) 2009-2020 Intel Corporation + +version 2.8.0 - 18.Jun.2020 +* trace: enable return value trace for successful function call +* trace: divide va_TraceEndPicture to two seperate function +* trace: add support for VAProfileHEVCSccMain444_10 +* fix:Fixes file descriptor leak +* add fourcc code for P012 format +* travis: Add a test that code files don't have the exec bit set +* Remove the execute bit from all source code files +* meson: Allow for libdir and includedir to be absolute paths +* trace: Fix format string warnings +* fix:Fix clang warning (reading garbage) +* add definition to enforce both reflist not empty +* trace: List correct field names in va_TraceVAPictureParameterBufferHEVC +* change the return value to be UNIMPLEMENTED when the function pointer is NULL +* remove check of vaPutSurface implementation +* Add new slice structure flag for CAPS reporting +* VA/X11: VAAPI driver mapping for iris DRI driver +* VA/X11: enable driver candidate selection for DRI2 +* Add SCC flags to enable/disable features +* fix: Fix HDR10 MaxCLL and MaxFALL documentation +* Add VAProfileHEVCSccMain444_10 for HEVC +* change the compatible list to be dynamic one +* trace:Convert VAProfileAV1Profile0 VAProfileAV1Profile1 to string + +version 2.7.0 - 26.Mar.2020 +* trace: av1 decode buffers trace +* trace: Add HEVC REXT and SCC trace for decoding. +* Add av1 decode interfaces +* Fix crashes on system without supported hardware by PR #369. +* Add 2 FourCC for 10bit RGB(without Alpha) format: X2R10G10B10 and X2B10G10R10. +* Fix android build issue #365 and remove some trailing whitespace +* Adjust call sequence to ensure authenticate operation is executed to fix #355 version 2.6.0 - 15.Dec.2019 * enable the mutiple driver selection logic and enable it for DRM. diff --git a/README.md b/README.md index 80056edc4..e92c7317a 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ be accessed directly through [github pages libva](http://intel.github.io/libva/) The libva development team can be reached via our [mailing -list](https://lists.01.org/mailman/listinfo/intel-vaapi-media) and on IRC +list](https://lists.01.org/postorius/lists/intel-vaapi-media.lists.01.org) and on IRC in channel ##intel-media on [Freenode](https://freenode.net/kb/answer/chat). We also use [#Slack](https://slack.com) and host [VAAPI Media Slack diff --git a/configure.ac b/configure.ac index acb4c7998..c3956012b 100644 --- a/configure.ac +++ b/configure.ac @@ -27,7 +27,7 @@ # - reset micro version to zero when minor version is incremented # - reset minor version to zero when major version is incremented m4_define([va_api_major_version], [1]) -m4_define([va_api_minor_version], [6]) +m4_define([va_api_minor_version], [9]) m4_define([va_api_micro_version], [0]) m4_define([va_api_version], diff --git a/meson.build b/meson.build index aabae7b88..11787d96b 100644 --- a/meson.build +++ b/meson.build @@ -7,7 +7,7 @@ # - reset micro version to zero when VA-API major or minor version is changed project( 'libva', 'c', - version : '2.6.0.1', + version : '2.9.0.1', meson_version : '>= 0.37.0', default_options : [ 'warning_level=1', 'buildtype=debugoptimized' ]) @@ -19,7 +19,7 @@ project( # - reset micro version to zero when minor version is incremented # - reset minor version to zero when major version is incremented va_api_major_version = 1 -va_api_minor_version = 6 +va_api_minor_version = 9 va_api_micro_version = 0 va_api_version = '@0@.@1@.@2@'.format(va_api_major_version, @@ -65,7 +65,7 @@ libva_lt_version = '@0@.@1@.@2@'.format(libva_lt_current, driverdir = get_option('driverdir') if driverdir == '' - driverdir = '@0@/@1@/@2@'.format(get_option('prefix'), get_option('libdir'), 'dri') + driverdir = join_paths(get_option('prefix'), get_option('libdir'), 'dri') endif configinc = include_directories('.') diff --git a/pkgconfig/meson.build b/pkgconfig/meson.build index b7f701530..ca344cee1 100644 --- a/pkgconfig/meson.build +++ b/pkgconfig/meson.build @@ -2,8 +2,8 @@ pkgconf = configuration_data() pkgconf.set('prefix', get_option('prefix')) pkgconf.set('exec_prefix', '${prefix}') -pkgconf.set('libdir', '${prefix}/@0@'.format(get_option('libdir'))) -pkgconf.set('includedir', '${prefix}/@0@'.format(get_option('includedir'))) +pkgconf.set('libdir', join_paths(get_option('prefix'), get_option('libdir'))) +pkgconf.set('includedir', join_paths(get_option('prefix'), get_option('includedir'))) pkgconf.set('LIBVA_VERSION', libva_version) pkgconf.set('VA_API_VERSION', va_api_version) pkgconf.set('LIBVA_DRIVERS_PATH', driverdir) diff --git a/test.txt b/test.txt new file mode 100644 index 000000000..802992c42 --- /dev/null +++ b/test.txt @@ -0,0 +1 @@ +Hello world diff --git a/va/Makefile.am b/va/Makefile.am index c0b0cfd3d..e67c588ca 100644 --- a/va/Makefile.am +++ b/va/Makefile.am @@ -42,6 +42,7 @@ libva_source_h = \ va_backend.h \ va_backend_vpp.h \ va_compat.h \ + va_dec_av1.h \ va_dec_hevc.h \ va_dec_jpeg.h \ va_dec_vp8.h \ diff --git a/va/android/va_android.cpp b/va/android/va_android.cpp index 4b5d81e71..370adb9c8 100644 --- a/va/android/va_android.cpp +++ b/va/android/va_android.cpp @@ -100,7 +100,6 @@ static void va_DisplayContextDestroy ( free(pDisplayContext); } -} static VAStatus va_DisplayContextGetNumCandidates( VADisplayContextP pDisplayContext, int *num_candidates diff --git a/va/drm/va_drm_utils.c b/va/drm/va_drm_utils.c index 905ccdde5..1bd68ef0e 100644 --- a/va/drm/va_drm_utils.c +++ b/va/drm/va_drm_utils.c @@ -54,7 +54,7 @@ VA_DRM_GetNumCandidates(VADriverContextP ctx, int * num_candidates) { struct drm_state * const drm_state = ctx->drm_state; drmVersionPtr drm_version; - int num_of_candidate = 0; + int count = 0; const struct driver_name_map *m = NULL; if (!drm_state || drm_state->fd < 0) return VA_STATUS_ERROR_INVALID_DISPLAY; @@ -64,12 +64,12 @@ VA_DRM_GetNumCandidates(VADriverContextP ctx, int * num_candidates) for (m = g_driver_name_map; m->key != NULL; m++) { if (drm_version->name_len >= m->key_len && strncmp(drm_version->name, m->key, m->key_len) == 0) { - num_of_candidate ++; + count ++; } } drmFreeVersion(drm_version); - *num_candidates = num_of_candidate; - return VA_STATUS_SUCCESS; + *num_candidates = count; + return count ? VA_STATUS_SUCCESS : VA_STATUS_ERROR_UNKNOWN; } /* Returns the VA driver name for the active display */ diff --git a/va/glx/va_glx_impl.c b/va/glx/va_glx_impl.c index 23ea27007..a3c769727 100644 --- a/va/glx/va_glx_impl.c +++ b/va/glx/va_glx_impl.c @@ -939,7 +939,7 @@ static VAStatus vaDestroySurfaceGLX_impl_libva(VADriverContextP ctx, void *gl_surface) { VASurfaceGLXP pSurfaceGLX; - struct OpenGLContextState old_cs, *new_cs; + struct OpenGLContextState old_cs = {0}, *new_cs; INIT_SURFACE(pSurfaceGLX, gl_surface); @@ -1072,7 +1072,7 @@ vaCopySurfaceGLX_impl_libva( { VASurfaceGLXP pSurfaceGLX; VAStatus status; - struct OpenGLContextState old_cs; + struct OpenGLContextState old_cs = {0}; INIT_SURFACE(pSurfaceGLX, gl_surface); diff --git a/va/meson.build b/va/meson.build index 8c9d03627..45707b6db 100644 --- a/va/meson.build +++ b/va/meson.build @@ -26,6 +26,7 @@ libva_headers = [ 'va_dec_jpeg.h', 'va_dec_vp8.h', 'va_dec_vp9.h', + 'va_dec_av1.h', 'va_drmcommon.h', 'va_egl.h', 'va_enc_hevc.h', diff --git a/va/va.c b/va/va.c index 7f014a15a..4f06a34fc 100644 --- a/va/va.c +++ b/va/va.c @@ -52,7 +52,7 @@ #define DRIVER_EXTENSION "_drv_video.so" #define ASSERT assert -#define CHECK_VTABLE(s, ctx, func) if (!va_checkVtable(dpy, ctx->vtable->va##func, #func)) s = VA_STATUS_ERROR_UNKNOWN; +#define CHECK_VTABLE(s, ctx, func) if (!va_checkVtable(dpy, ctx->vtable->va##func, #func)) s = VA_STATUS_ERROR_UNIMPLEMENTED; #define CHECK_MAXIMUM(s, ctx, var) if (!va_checkMaximum(dpy, ctx->max_##var, #var)) s = VA_STATUS_ERROR_UNKNOWN; #define CHECK_STRING(s, ctx, var) if (!va_checkString(dpy, ctx->str_##var, #var)) s = VA_STATUS_ERROR_UNKNOWN; @@ -378,7 +378,7 @@ static VAStatus va_getDriverNameByIndex(VADisplay dpy, char **driver_name, int c status = pDisplayContext->vaGetDriverName(pDisplayContext, driver_name); else status = VA_STATUS_ERROR_INVALID_PARAMETER; - } + } driver_name_env = getenv("LIBVA_DRIVER_NAME"); /*if user set driver name by vaSetDriverName */ if (ctx->override_driver_name){ @@ -398,7 +398,7 @@ static VAStatus va_getDriverNameByIndex(VADisplay dpy, char **driver_name, int c *driver_name = strdup(driver_name_env); va_infoMessage(dpy, "User environment variable requested driver '%s'\n", *driver_name); return VA_STATUS_SUCCESS; - } + } return status; } @@ -465,19 +465,16 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name) char init_func_s[256]; int i; - static const struct { + struct { int major; int minor; - } compatible_versions[] = { - { VA_MAJOR_VERSION, VA_MINOR_VERSION }, - { VA_MAJOR_VERSION, 5 }, - { VA_MAJOR_VERSION, 4 }, - { VA_MAJOR_VERSION, 3 }, - { VA_MAJOR_VERSION, 2 }, - { VA_MAJOR_VERSION, 1 }, - { VA_MAJOR_VERSION, 0 }, - { -1, -1} - }; + } compatible_versions[VA_MINOR_VERSION + 2]; + for (i = 0; i <= VA_MINOR_VERSION; i ++) { + compatible_versions[i].major = VA_MAJOR_VERSION; + compatible_versions[i].minor = VA_MINOR_VERSION - i; + } + compatible_versions[i].major = -1; + compatible_versions[i].minor = -1; for (i = 0; compatible_versions[i].major >= 0; i++) { if (va_getDriverInitName(init_func_s, sizeof(init_func_s), @@ -547,7 +544,6 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name) CHECK_VTABLE(vaStatus, ctx, EndPicture); CHECK_VTABLE(vaStatus, ctx, SyncSurface); CHECK_VTABLE(vaStatus, ctx, QuerySurfaceStatus); - CHECK_VTABLE(vaStatus, ctx, PutSurface); CHECK_VTABLE(vaStatus, ctx, QueryImageFormats); CHECK_VTABLE(vaStatus, ctx, CreateImage); CHECK_VTABLE(vaStatus, ctx, DeriveImage); @@ -744,7 +740,7 @@ VAStatus vaInitialize ( if (vaStatus == VA_STATUS_SUCCESS) { break; } - + } *major_version = VA_MAJOR_VERSION; @@ -1616,12 +1612,11 @@ VAStatus vaEndPicture ( ctx = CTX(dpy); VA_FOOL_FUNC(va_FoolCheckContinuity, dpy); - + VA_TRACE_ALL(va_TraceEndPicture, dpy, context, 0); va_status = ctx->vtable->vaEndPicture( ctx, context ); - - /* dump surface content */ - VA_TRACE_ALL(va_TraceEndPicture, dpy, context, 1); VA_TRACE_RET(dpy, va_status); + /* dump surface content */ + VA_TRACE_ALL(va_TraceEndPictureExt, dpy, context, 1); return va_status; } @@ -1644,6 +1639,28 @@ VAStatus vaSyncSurface ( return va_status; } +VAStatus vaSyncSurface2 ( + VADisplay dpy, + VASurfaceID surface, + uint64_t timeout_ns +) +{ + VAStatus va_status; + VADriverContextP ctx; + + CHECK_DISPLAY(dpy); + ctx = CTX(dpy); + + if (ctx->vtable->vaSyncSurface2) + va_status = ctx->vtable->vaSyncSurface2( ctx, surface, timeout_ns ); + else + va_status = VA_STATUS_ERROR_UNIMPLEMENTED; + VA_TRACE_LOG(va_TraceSyncSurface2, dpy, surface, timeout_ns); + VA_TRACE_RET(dpy, va_status); + + return va_status; +} + VAStatus vaQuerySurfaceStatus ( VADisplay dpy, VASurfaceID render_target, @@ -1683,6 +1700,29 @@ VAStatus vaQuerySurfaceError ( return va_status; } +VAStatus vaSyncBuffer ( + VADisplay dpy, + VABufferID buf_id, + uint64_t timeout_ns +) +{ + VAStatus va_status; + VADriverContextP ctx; + + CHECK_DISPLAY(dpy); + ctx = CTX(dpy); + + VA_TRACE_LOG(va_TraceSyncBuffer, dpy, buf_id, timeout_ns); + + if (ctx->vtable->vaSyncBuffer) + va_status = ctx->vtable->vaSyncBuffer( ctx, buf_id, timeout_ns ); + else + va_status = VA_STATUS_ERROR_UNIMPLEMENTED; + VA_TRACE_RET(dpy, va_status); + + return va_status; +} + /* Get maximum number of image formats supported by the implementation */ int vaMaxNumImageFormats ( VADisplay dpy diff --git a/va/va.h b/va/va.h old mode 100755 new mode 100644 index 5863ac775..6577cf54f --- a/va/va.h +++ b/va/va.h @@ -119,11 +119,12 @@ extern "C" { * - \ref api_enc_mpeg2 * - \ref api_enc_vp8 * - \ref api_enc_vp9 - * - Decoder (HEVC, JPEG, VP8, VP9) + * - Decoder (HEVC, JPEG, VP8, VP9, AV1) * - \ref api_dec_hevc * - \ref api_dec_jpeg * - \ref api_dec_vp8 * - \ref api_dec_vp9 + * - \ref api_dec_av1 * - \ref api_vpp * - FEI (H264, HEVC) * - \ref api_fei @@ -212,6 +213,8 @@ typedef int VAStatus; /** Return status type from functions */ #define VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE 0x00000024 /** \brief Indicate allocated buffer size is not enough for input or output. */ #define VA_STATUS_ERROR_NOT_ENOUGH_BUFFER 0x00000025 +/** \brief Indicate an operation isn't completed because time-out interval elapsed. */ +#define VA_STATUS_ERROR_TIMEDOUT 0x00000026 #define VA_STATUS_ERROR_UNKNOWN 0xFFFFFFFF /** @@ -255,6 +258,13 @@ typedef int VAStatus; /** Return status type from functions */ #define VA_FILTER_SCALING_NL_ANAMORPHIC 0x00000300 #define VA_FILTER_SCALING_MASK 0x00000f00 +/** Interpolation method for scaling */ +#define VA_FILTER_INTERPOLATION_DEFAULT 0x00000000 +#define VA_FILTER_INTERPOLATION_NEAREST_NEIGHBOR 0x00001000 +#define VA_FILTER_INTERPOLATION_BILINEAR 0x00002000 +#define VA_FILTER_INTERPOLATION_ADVANCED 0x00003000 +#define VA_FILTER_INTERPOLATION_MASK 0x0000f000 + /** Padding size in 4-bytes */ #define VA_PADDING_LOW 4 #define VA_PADDING_MEDIUM 8 @@ -392,7 +402,10 @@ typedef enum VAProfileHEVCMain444_12 = 28, VAProfileHEVCSccMain = 29, VAProfileHEVCSccMain10 = 30, - VAProfileHEVCSccMain444 = 31 + VAProfileHEVCSccMain444 = 31, + VAProfileAV1Profile0 = 32, + VAProfileAV1Profile1 = 33, + VAProfileHEVCSccMain444_10 = 34 } VAProfile; /** @@ -777,6 +790,10 @@ typedef enum * implementation, multiple frames encode/decode can improve HW concurrency */ VAConfigAttribMultipleFrame = 40, + /** \brief priority setting for the context. Read-Write + * attribute value is \c VAConfigAttribValContextPriority + */ + VAConfigAttribContextPriority = 41, /**@}*/ VAConfigAttribTypeMax } VAConfigAttribType; @@ -953,12 +970,16 @@ typedef union _VAConfigAttribValDecJPEG { #define VA_ENC_SLICE_STRUCTURE_POWER_OF_TWO_ROWS 0x00000001 /** \brief Driver supports an arbitrary number of macroblocks per slice. */ #define VA_ENC_SLICE_STRUCTURE_ARBITRARY_MACROBLOCKS 0x00000002 -/** \brief Dirver support 1 rows per slice */ +/** \brief Driver support 1 row per slice */ #define VA_ENC_SLICE_STRUCTURE_EQUAL_ROWS 0x00000004 -/** \brief Dirver support max encoded slice size per slice */ +/** \brief Driver support max encoded slice size per slice */ #define VA_ENC_SLICE_STRUCTURE_MAX_SLICE_SIZE 0x00000008 /** \brief Driver supports an arbitrary number of rows per slice. */ #define VA_ENC_SLICE_STRUCTURE_ARBITRARY_ROWS 0x00000010 +/** \brief Driver supports any number of rows per slice but they must be the same +* for all slices except for the last one, which must be equal or smaller +* to the previous slices. */ +#define VA_ENC_SLICE_STRUCTURE_EQUAL_MULTI_ROWS 0x00000020 /**@}*/ /** \brief Attribute value for VAConfigAttribMaxFrameSize */ @@ -1016,6 +1037,8 @@ typedef union _VAConfigAttribValEncJPEG { #define VA_PREDICTION_DIRECTION_PREVIOUS 0x00000001 /** \brief Driver support backward prediction frame/slice */ #define VA_PREDICTION_DIRECTION_FUTURE 0x00000002 +/** \brief Dirver require both reference list must be not empty for inter frame */ +#define VA_PREDICTION_DIRECTION_BI_NOT_EMPTY 0x00000004 /**@}*/ /** @name Attribute values for VAConfigAttribEncIntraRefresh */ @@ -1129,6 +1152,18 @@ typedef union _VAConfigAttribValMultipleFrame { uint32_t value; }VAConfigAttribValMultipleFrame; +/** brief Attribute value VAConfigAttribValContestPriority */ +typedef union _VAConfigAttribValContextPriority{ + struct{ + /** \brief the priority , for the Query operation (read) it represents highest priority + * for the set operation (write), value should be [0~highest priority] , 0 is lowest priority*/ + uint32_t priority :16; + /** \brief reserved bits for future, must be zero*/ + uint32_t reserved :16; + }bits; + uint32_t value; +}VAConfigAttribValContextPriority; + /** @name Attribute values for VAConfigAttribProcessingRate. */ /**@{*/ /** \brief Driver does not support processing rate report */ @@ -3714,6 +3749,35 @@ VAStatus vaSyncSurface ( VASurfaceID render_target ); +/** \brief Indicates an infinite timeout. */ +#define VA_TIMEOUT_INFINITE 0xFFFFFFFFFFFFFFFF + +/** + * \brief Synchronizes pending operations associated with the supplied surface. + * + * This function blocks during specified timeout (in nanoseconds) until + * all pending operations on the render target have been completed. + * If timeout is zero, the function returns immediately. + * + * Possible errors: + * - \ref VA_STATUS_ERROR_UNIMPLEMENTED: the VA driver implementation + * does not support this interface + * - \ref VA_STATUS_ERROR_INVALID_DISPLAY: an invalid display was supplied + * - \ref VA_STATUS_ERROR_INVALID_SURFACE: an invalid surface was supplied + * - \ref VA_STATUS_ERROR_TIMEDOUT: synchronization is still in progress, + * client should call the function again to complete synchronization + * + * @param[in] dpy the VA display + * @param[in] surface the surface for which synchronization is performed + * @param[in] timeout_ns the timeout in nanoseconds + * + */ +VAStatus vaSyncSurface2 ( + VADisplay dpy, + VASurfaceID surface, + uint64_t timeout_ns +); + typedef enum { VASurfaceRendering = 1, /* Rendering in progress */ @@ -3769,6 +3833,46 @@ VAStatus vaQuerySurfaceError( void **error_info ); +/** + * \brief Synchronizes pending operations associated with the supplied buffer. + * + * This function blocks during specified timeout (in nanoseconds) until + * all pending operations on the supplied buffer have been completed. + * If timeout is zero, the function returns immediately. + * + * Possible errors: + * - \ref VA_STATUS_ERROR_UNIMPLEMENTED: the VA driver implementation + * does not support this interface + * - \ref VA_STATUS_ERROR_INVALID_DISPLAY: an invalid display was supplied + * - \ref VA_STATUS_ERROR_INVALID_BUFFER: an invalid buffer was supplied + * - \ref VA_STATUS_ERROR_TIMEDOUT: synchronization is still in progress, + * client should call the function again to complete synchronization + * + * @param[in] dpy the VA display + * @param[in] buf_id the buffer for which synchronization is performed + * @param[in] timeout_ns the timeout in nanoseconds + * + */ +VAStatus vaSyncBuffer( + VADisplay dpy, + VABufferID buf_id, + uint64_t timeout_ns +); + +/** + * Notes about synchronization interfaces: + * vaSyncSurface: + * 1. Allows to synchronize output surface (i.e. from decoding or VP) + * 2. Allows to synchronize all bitstreams being encoded from the given input surface (1->N pipelines). + * + * vaSyncSurface2: + * 1. The same as vaSyncSurface but allows to specify a timeout + * + * vaSyncBuffer: + * 1. Allows to synchronize output buffer (e.g. bitstream from encoding). + * Comparing to vaSyncSurface this function synchronizes given bitstream only. + */ + /** * Images and Subpictures * VAImage is used to either get the surface data to client memory, or @@ -3948,6 +4052,12 @@ VAStatus vaQuerySurfaceError( * with the bottom six bits ignored. The samples are in the order Y, U, Y, V. */ #define VA_FOURCC_Y210 0x30313259 +/** Y212: packed 12-bit YUV 4:2:2. + * + * Eight bytes represent a pair of pixels. Each sample is a two-byte little-endian value. + * The samples are in the order Y, U, Y, V. + */ +#define VA_FOURCC_Y212 0x32313259 /** Y216: packed 16-bit YUV 4:2:2. * * Eight bytes represent a pair of pixels. Each sample is a two-byte little-endian value. @@ -3960,6 +4070,12 @@ VAStatus vaQuerySurfaceError( * A, V, Y, U are found in bits 31:30, 29:20, 19:10, 9:0 respectively. */ #define VA_FOURCC_Y410 0x30313459 +/** Y412 packed 12-bit YUVA 4:4:4. + * + * Each pixel is a set of four samples, each of which is a two-byte little-endian value. + * The samples are in the order A, V, Y, U. + */ +#define VA_FOURCC_Y412 0x32313459 /** Y416: packed 16-bit YUVA 4:4:4. * * Each pixel is a set of four samples, each of which is a two-byte little-endian value. @@ -3978,6 +4094,12 @@ VAStatus vaQuerySurfaceError( * The first plane contains Y, the second plane contains U and V in pairs of samples. */ #define VA_FOURCC_P010 0x30313050 +/** P012: two-plane 12-bit YUV 4:2:0. + * + * Each sample is a two-byte little-endian value with the bottom four bits ignored. + * The first plane contains Y, the second plane contains U and V in pairs of samples. + */ +#define VA_FOURCC_P012 0x32313050 /** P016: two-plane 16-bit YUV 4:2:0. * * Each sample is a two-byte little-endian value. The first plane contains Y, the second @@ -4005,6 +4127,14 @@ VAStatus vaQuerySurfaceError( * 10-bit Pixel BGR formats. */ #define VA_FOURCC_A2B10G10R10 0x30334241 /* VA_FOURCC('A','B','3','0') */ +/** + * 10-bit Pixel RGB formats without alpha. + */ +#define VA_FOURCC_X2R10G10B10 0x30335258 /* VA_FOURCC('X','R','3','0') */ +/** + * 10-bit Pixel BGR formats without alpha. + */ +#define VA_FOURCC_X2B10G10R10 0x30334258 /* VA_FOURCC('X','B','3','0') */ /** Y8: 8-bit greyscale. * @@ -4616,6 +4746,7 @@ typedef struct _VAPictureHEVC #include #include #include +#include #include #include #include diff --git a/va/va_backend.h b/va/va_backend.h index f2cd7b0f3..5ab8f6abb 100644 --- a/va/va_backend.h +++ b/va/va_backend.h @@ -485,8 +485,20 @@ struct VADriverVTable void *descriptor /* out */ ); + VAStatus (*vaSyncSurface2) ( + VADriverContextP ctx, + VASurfaceID surface, + uint64_t timeout_ns + ); + + VAStatus (*vaSyncBuffer) ( + VADriverContextP ctx, + VABufferID buf_id, + uint64_t timeout_ns + ); + /** \brief Reserved bytes for future use, must be zero */ - unsigned long reserved[57]; + unsigned long reserved[55]; }; struct VADriverContext diff --git a/va/va_dec_av1.h b/va/va_dec_av1.h new file mode 100644 index 000000000..6122f1a14 --- /dev/null +++ b/va/va_dec_av1.h @@ -0,0 +1,665 @@ +/* + * Copyright (c) 2019 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_av1.h + * \brief The AV1 decoding API + * + * This file contains the \ref api_dec_av1 "AV1 decoding API". + */ + +#ifndef VA_DEC_AV1_H +#define VA_DEC_AV1_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief AV1 Decoding Picture Parameter Buffer Structure + * + * This structure conveys picture level parameters. + * App should send a surface with this data structure down to VAAPI once + * per frame. + * + */ + +/** \brief Segmentation Information + */ +typedef struct _VASegmentationStructAV1 { + union { + struct { + /** Indicates whether segmentation map related syntax elements + * are present or not for current frame. If equal to 0, + * the segmentation map related syntax elements are + * not present for the current frame and the control flags of + * segmentation map related tables feature_data[][], and + * feature_mask[] are not valid and shall be ignored by accelerator. + */ + uint32_t enabled : 1; + /** Value 1 indicates that the segmentation map are updated + * during the decoding of this frame. + * Value 0 means that the segmentation map from the previous + * frame is used. + */ + uint32_t update_map : 1; + /** Value 1 indicates that the updates to the segmentation map + * are coded relative to the existing segmentation map. + * Value 0 indicates that the new segmentation map is coded + * without reference to the existing segmentation map. + */ + uint32_t temporal_update : 1; + /** Value 1 indicates that new parameters are about to be + * specified for each segment. + * Value 0 indicates that the segmentation parameters + * should keep their existing values. + */ + uint32_t update_data : 1; + + /** \brief Reserved bytes for future use, must be zero */ + uint32_t reserved : 28; + } bits; + uint32_t value; + } segment_info_fields; + + /** \brief Segmentation parameters for current frame. + * feature_data[segment_id][feature_id] + * where segment_id has value range [0..7] indicating the segment id. + * and feature_id is defined as + typedef enum { + SEG_LVL_ALT_Q, // Use alternate Quantizer .... + SEG_LVL_ALT_LF_Y_V, // Use alternate loop filter value on y plane vertical + SEG_LVL_ALT_LF_Y_H, // Use alternate loop filter value on y plane horizontal + SEG_LVL_ALT_LF_U, // Use alternate loop filter value on u plane + SEG_LVL_ALT_LF_V, // Use alternate loop filter value on v plane + SEG_LVL_REF_FRAME, // Optional Segment reference frame + SEG_LVL_SKIP, // Optional Segment (0,0) + skip mode + SEG_LVL_GLOBALMV, + SEG_LVL_MAX + } SEG_LVL_FEATURES; + * feature_data[][] is equivalent to variable FeatureData[][] in spec, + * which is after clip3() operation. + * Clip3(x, y, z) = (z < x)? x : ((z > y)? y : z); + * The limit is defined in Segmentation_Feature_Max[ SEG_LVL_MAX ] = { + * 255, MAX_LOOP_FILTER, MAX_LOOP_FILTER, MAX_LOOP_FILTER, MAX_LOOP_FILTER, 7, 0, 0 } + */ + int16_t feature_data[8][8]; + + /** \brief indicates if a feature is enabled or not. + * Each bit field itself is the feature_id. Index is segment_id. + * feature_mask[segment_id] & (1 << feature_id) equal to 1 specify that the feature of + * feature_id for segment of segment_id is enabled, otherwise disabled. + */ + uint8_t feature_mask[8]; + + /** \brief Reserved bytes for future use, must be zero */ + uint32_t va_reserved[VA_PADDING_LOW]; + +} VASegmentationStructAV1; + +/** \brief Film Grain Information + */ +typedef struct _VAFilmGrainStructAV1 { + union { + struct { + /** \brief Specify whether or not film grain is applied on current frame. + * If set to 0, all the rest parameters should be set to zero + * and ignored. + */ + uint32_t apply_grain : 1; + uint32_t chroma_scaling_from_luma : 1; + uint32_t grain_scaling_minus_8 : 2; + uint32_t ar_coeff_lag : 2; + uint32_t ar_coeff_shift_minus_6 : 2; + uint32_t grain_scale_shift : 2; + uint32_t overlap_flag : 1; + uint32_t clip_to_restricted_range : 1; + /** \brief Reserved bytes for future use, must be zero */ + uint32_t reserved : 20; + } bits; + uint32_t value; + } film_grain_info_fields; + + uint16_t grain_seed; + /* value range [0..14] */ + uint8_t num_y_points; + uint8_t point_y_value[14]; + uint8_t point_y_scaling[14]; + /* value range [0..10] */ + uint8_t num_cb_points; + uint8_t point_cb_value[10]; + uint8_t point_cb_scaling[10]; + /* value range [0..10] */ + uint8_t num_cr_points; + uint8_t point_cr_value[10]; + uint8_t point_cr_scaling[10]; + /* value range [-128..127] */ + int8_t ar_coeffs_y[24]; + int8_t ar_coeffs_cb[25]; + int8_t ar_coeffs_cr[25]; + uint8_t cb_mult; + uint8_t cb_luma_mult; + uint16_t cb_offset; + uint8_t cr_mult; + uint8_t cr_luma_mult; + uint16_t cr_offset; + + /** \brief Reserved bytes for future use, must be zero */ + uint32_t va_reserved[VA_PADDING_LOW]; + +} VAFilmGrainStructAV1; + +typedef enum { + /** identity transformation, 0-parameter */ + VAAV1TransformationIdentity = 0, + /** translational motion, 2-parameter */ + VAAV1TransformationTranslation = 1, + /** simplified affine with rotation + zoom only, 4-parameter */ + VAAV1TransformationRotzoom = 2, + /** affine, 6-parameter */ + VAAV1TransformationAffine = 3, + /** transformation count */ + VAAV1TransformationCount +} VAAV1TransformationType; + +typedef struct _VAWarpedMotionParamsAV1{ + + /** \brief Specify the type of warped motion */ + VAAV1TransformationType wmtype; + + /** \brief Specify warp motion parameters + * wm.wmmat[] corresponds to gm_params[][] in spec. + * Details in AV1 spec section 5.9.24 or refer to libaom code + * https://aomedia.googlesource.com/aom/+/refs/heads/master/av1/decoder/decodeframe.c + */ + int32_t wmmat[8]; + + /* valid or invalid on affine set */ + uint8_t invalid; + + /** \brief Reserved bytes for future use, must be zero */ + uint32_t va_reserved[VA_PADDING_LOW]; + +} VAWarpedMotionParamsAV1; + +/** + * \brief AV1 Decoding Picture Parameter Buffer Structure + * + * This structure conveys picture level parameters and should be sent once + * per frame. + * + */ +typedef struct _VADecPictureParameterBufferAV1 +{ + /**@{*/ + + /** \brief sequence level information + */ + + /** \brief AV1 bit stream profile + */ + uint8_t profile; + + uint8_t order_hint_bits_minus_1; + + /** \brief bit depth index + * value range [0..2] + * 0 - bit depth 8; + * 1 - bit depth 10; + * 2 - bit depth 12; + */ + uint8_t bit_depth_idx; + + /** \brief corresponds to AV1 spec variable of the same name. */ + uint8_t matrix_coefficients; + + union { + struct { + uint32_t still_picture : 1; + uint32_t use_128x128_superblock : 1; + uint32_t enable_filter_intra : 1; + uint32_t enable_intra_edge_filter : 1; + + /** read_compound_tools */ + uint32_t enable_interintra_compound : 1; + uint32_t enable_masked_compound : 1; + + uint32_t enable_dual_filter : 1; + uint32_t enable_order_hint : 1; + uint32_t enable_jnt_comp : 1; + uint32_t enable_cdef : 1; + uint32_t mono_chrome : 1; + uint32_t color_range : 1; + uint32_t subsampling_x : 1; + uint32_t subsampling_y : 1; + uint32_t chroma_sample_position : 1; + uint32_t film_grain_params_present : 1; + /** \brief Reserved bytes for future use, must be zero */ + uint32_t reserved : 16; + } fields; + uint32_t value; + } seq_info_fields; + + /** \brief Picture level information + */ + + /** \brief buffer description of decoded current picture + */ + VASurfaceID current_frame; + + /** \brief display buffer of current picture + * Used for film grain applied decoded picture. + * Valid only when apply_grain equals 1. + */ + VASurfaceID current_display_picture; + + /** \brief number of anchor frames for large scale tile + * This parameter gives the number of entries of anchor_frames_list[]. + * Value range [0..128]. + */ + uint8_t anchor_frames_num; + + /** \brief anchor frame list for large scale tile + * For large scale tile applications, the anchor frames could come from + * previously decoded frames in current sequence (aka. internal), or + * from external sources. + * For external anchor frames, application should call API + * vaCreateBuffer() to generate frame buffers and populate them with + * pixel frames. And this process may happen multiple times. + * The array anchor_frames_list[] is used to register all the available + * anchor frames from both external and internal, up to the current + * frame instance. If a previously registerred anchor frame is no longer + * needed, it should be removed from the list. But it does not prevent + * applications from relacing the frame buffer with new anchor frames. + * Please note that the internal anchor frames may not still be present + * in the current DPB buffer. But if it is in the anchor_frames_list[], + * it should not be replaced with other frames or removed from memory + * until it is not shown in the list. + * This number of entries of the list is given by parameter anchor_frames_num. + */ + VASurfaceID *anchor_frames_list; + + /** \brief Picture resolution minus 1 + * Picture original resolution. If SuperRes is enabled, + * this is the upscaled resolution. + * The value may not be multiple of 8. + * value range [0..65535] + */ + uint16_t frame_width_minus1; + uint16_t frame_height_minus1; + + /** \brief Output frame buffer size in unit of tiles + * Valid only when large_scale_tile equals 1. + * value range [0..65535] + */ + uint16_t output_frame_width_in_tiles_minus_1; + uint16_t output_frame_height_in_tiles_minus_1; + + /** \brief Surface indices of reference frames in DPB. + * + * Contains a list of uncompressed frame buffer surface indices as references. + * Application needs to make sure all the entries point to valid frames + * except for the key frame by checking ref_frame_id[]. If missing frame + * is identified, application may choose to perform error recovery by + * pointing problematic index to an alternative frame buffer. + * Driver is not responsible to validate reference frames' id. + */ + VASurfaceID ref_frame_map[8]; + + /** \brief Reference frame indices. + * + * Contains a list of indices into ref_frame_map[8]. + * It specifies the reference frame correspondence. + * The indices of the array are defined as [LAST_FRAME – LAST_FRAME, + * LAST2_FRAME – LAST_FRAME, …, ALTREF2_FRAME – LAST_FRAME], where each + * symbol is defined as: + * enum{INTRA_FRAME = 0, LAST_FRAME, LAST2_FRAME, LAST3_FRAME, GOLDEN_FRAME, + * BWDREF_FRAME, ALTREF_FRAME}; + */ + uint8_t ref_frame_idx[7]; + + /** \brief primary reference frame index + * Index into ref_frame_idx[], specifying which reference frame contains + * propagated info that should be loaded at the start of the frame. + * When value equals PRIMARY_REF_NONE (7), it indicates there is + * no primary reference frame. + * value range [0..7] + */ + uint8_t primary_ref_frame; + + uint8_t order_hint; + + VASegmentationStructAV1 seg_info; + VAFilmGrainStructAV1 film_grain_info; + + /** \brief tile structure + * When uniform_tile_spacing_flag == 1, the value of tile_cols and + * tile_rows need to be power of 2, and width_in_sbs_minus_1[] and + * height_in_sbs_minus_1[] should be ignored, which will be generated + * by driver based on tile_cols and tile_rows. + */ + uint8_t tile_cols; + uint8_t tile_rows; + + /* The width/height of a tile minus 1 in units of superblocks. Though the + * maximum number of tiles is 64, since ones of the last tile are computed + * from ones of the other tiles and frame_width/height, they are not + * necessarily specified. + */ + uint16_t width_in_sbs_minus_1[63]; + uint16_t height_in_sbs_minus_1[63]; + + /** \brief number of tiles minus 1 in large scale tile list + * Same as AV1 semantic element. + * Valid only when large_scale_tiles == 1. + */ + uint16_t tile_count_minus_1; + + /* specify the tile index for context updating */ + uint16_t context_update_tile_id; + + union + { + struct + { + /** \brief flags for current picture + * same syntax and semantic as those in AV1 code + */ + + /** \brief Frame Type + * 0: KEY_FRAME; + * 1: INTER_FRAME; + * 2: INTRA_ONLY_FRAME; + * 3: SWITCH_FRAME + * For SWITCH_FRAME, application shall set error_resilient_mode = 1, + * refresh_frame_flags, etc. appropriately. And driver will convert it + * to INTER_FRAME. + */ + uint32_t frame_type : 2; + uint32_t show_frame : 1; + uint32_t showable_frame : 1; + uint32_t error_resilient_mode : 1; + uint32_t disable_cdf_update : 1; + uint32_t allow_screen_content_tools : 1; + uint32_t force_integer_mv : 1; + uint32_t allow_intrabc : 1; + uint32_t use_superres : 1; + uint32_t allow_high_precision_mv : 1; + uint32_t is_motion_mode_switchable : 1; + uint32_t use_ref_frame_mvs : 1; + /* disable_frame_end_update_cdf is coded as refresh_frame_context. */ + uint32_t disable_frame_end_update_cdf : 1; + uint32_t uniform_tile_spacing_flag : 1; + uint32_t allow_warped_motion : 1; + /** \brief indicate if current frame in large scale tile mode */ + uint32_t large_scale_tile : 1; + + /** \brief Reserved bytes for future use, must be zero */ + uint32_t reserved : 15; + } bits; + uint32_t value; + } pic_info_fields; + + /** \brief Supper resolution scale denominator. + * value range [9..16] + */ + uint8_t superres_scale_denominator; + + /** \brief Interpolation filter. + * value range [0..4] + */ + uint8_t interp_filter; + + /** \brief luma loop filter levels. + * value range [0..63]. + */ + uint8_t filter_level[2]; + + /** \brief chroma loop filter levels. + * value range [0..63]. + */ + uint8_t filter_level_u; + uint8_t filter_level_v; + + union + { + struct + { + /** \brief flags for reference pictures + * same syntax and semantic as those in AV1 code + */ + uint8_t sharpness_level : 3; + uint8_t mode_ref_delta_enabled : 1; + uint8_t mode_ref_delta_update : 1; + + /** \brief Reserved bytes for future use, must be zero */ + uint8_t reserved : 3; + } bits; + uint8_t value; + } loop_filter_info_fields; + + /** \brief The adjustment needed for the filter level based on + * the chosen reference frame. + * value range [-63..63]. + */ + int8_t ref_deltas[8]; + + /** \brief The adjustment needed for the filter level based on + * the chosen mode. + * value range [-63..63]. + */ + int8_t mode_deltas[2]; + + /** \brief quantization + */ + /** \brief Y AC index + * value range [0..255] + */ + uint8_t base_qindex; + /** \brief Y DC delta from Y AC + * value range [-63..63] + */ + int8_t y_dc_delta_q; + /** \brief U DC delta from Y AC + * value range [-63..63] + */ + int8_t u_dc_delta_q; + /** \brief U AC delta from Y AC + * value range [-63..63] + */ + int8_t u_ac_delta_q; + /** \brief V DC delta from Y AC + * value range [-63..63] + */ + int8_t v_dc_delta_q; + /** \brief V AC delta from Y AC + * value range [-63..63] + */ + int8_t v_ac_delta_q; + + /** \brief quantization_matrix + */ + union + { + struct + { + uint16_t using_qmatrix : 1; + /** \brief qm level + * value range [0..15] + * Invalid if using_qmatrix equals 0. + */ + uint16_t qm_y : 4; + uint16_t qm_u : 4; + uint16_t qm_v : 4; + + /** \brief Reserved bytes for future use, must be zero */ + uint16_t reserved : 3; + } bits; + uint16_t value; + } qmatrix_fields; + + union + { + struct + { + /** \brief delta_q parameters + */ + uint32_t delta_q_present_flag : 1; + uint32_t log2_delta_q_res : 2; + + /** \brief delta_lf parameters + */ + uint32_t delta_lf_present_flag : 1; + uint32_t log2_delta_lf_res : 2; + + /** \brief CONFIG_LOOPFILTER_LEVEL + */ + uint32_t delta_lf_multi : 1; + + /** \brief read_tx_mode + * value range [0..2] + */ + uint32_t tx_mode : 2; + + /* AV1 frame reference mode semantic */ + uint32_t reference_select : 1; + + uint32_t reduced_tx_set_used : 1; + + uint32_t skip_mode_present : 1; + + /** \brief Reserved bytes for future use, must be zero */ + uint32_t reserved : 20; + } bits; + uint32_t value; + } mode_control_fields; + + /** \brief CDEF parameters + */ + /* value range [0..3] */ + uint8_t cdef_damping_minus_3; + /* value range [0..3] */ + uint8_t cdef_bits; + /* value range [0..63] */ + uint8_t cdef_y_strengths[8]; + /* value range [0..63] */ + uint8_t cdef_uv_strengths[8]; + + /** \brief loop restoration parameters + */ + union + { + struct + { + uint16_t yframe_restoration_type : 2; + uint16_t cbframe_restoration_type : 2; + uint16_t crframe_restoration_type : 2; + uint16_t lr_unit_shift : 2; + uint16_t lr_uv_shift : 1; + + /** \brief Reserved bytes for future use, must be zero */ + uint16_t reserved : 7; + } bits; + uint16_t value; + } loop_restoration_fields; + + /** \brief global motion + */ + VAWarpedMotionParamsAV1 wm[7]; + + /**@}*/ + + /** \brief Reserved bytes for future use, must be zero */ + uint32_t va_reserved[VA_PADDING_MEDIUM]; +} VADecPictureParameterBufferAV1; + + +/** + * \brief AV1 Slice Parameter Buffer Structure + * + * This structure conveys parameters related to bit stream data and should be + * sent once per tile. + * + * It uses the name VASliceParameterBufferAV1 to be consistent with other codec, + * but actually means VATileParameterBufferAV1. + * + * Slice data buffer of VASliceDataBufferType is used + * to send the bitstream. + * + * Please note that host decoder is responsible to parse out the + * per tile information. And the bit stream in sent to driver in per + * tile granularity. + */ +typedef struct _VASliceParameterBufferAV1 +{ + /**@{*/ + /** \brief The byte count of current tile in the bitstream buffer, + * starting from first byte of the buffer. + * It uses the name slice_data_size to be consistent with other codec, + * but actually means tile_data_size. + */ + uint32_t slice_data_size; + /** + * offset to the first byte of the data buffer. + */ + uint32_t slice_data_offset; + /** + * see VA_SLICE_DATA_FLAG_XXX definitions + */ + uint32_t slice_data_flag; + + uint16_t tile_row; + uint16_t tile_column; + + uint16_t tg_start; // Deprecated + uint16_t tg_end; // Deprecated + /** \brief anchor frame index for large scale tile. + * index into an array AnchorFrames of the frames that the tile uses + * for prediction. + * valid only when large_scale_tile equals 1. + */ + uint8_t anchor_frame_idx; + + /** \brief tile index in the tile list. + * Valid only when large_scale_tile is enabled. + * Driver uses this field to decide the tile output location. + */ + uint16_t tile_idx_in_tile_list; + + /**@}*/ + + /** \brief Reserved bytes for future use, must be zero */ + uint32_t va_reserved[VA_PADDING_LOW]; +} VASliceParameterBufferAV1; + + +/**@}*/ + +#ifdef __cplusplus +} +#endif + +#endif /* VA_DEC_AV1_H */ diff --git a/va/va_enc_hevc.h b/va/va_enc_hevc.h index 6db03c8b7..0d5337fd8 100644 --- a/va/va_enc_hevc.h +++ b/va/va_enc_hevc.h @@ -327,8 +327,19 @@ typedef struct _VAEncSequenceParameterBufferHEVC { uint8_t max_bytes_per_pic_denom; /** \brief Same as the HEVC bitstream syntax element. */ uint8_t max_bits_per_min_cu_denom; + + /** \brief SCC flags to enable/disable features, including IBC and palette mode at present.*/ + union { + struct { + /** \brief Same as the HEVC bitstream syntax element. */ + uint32_t palette_mode_enabled_flag : 1; + /** \brief Reserved bits for future use, must be zero */ + uint32_t reserved : 31; + } bits; + uint32_t value; + } scc_fields; /** \brief Reserved bytes for future use, must be zero */ - uint32_t va_reserved[VA_PADDING_MEDIUM]; + uint32_t va_reserved[VA_PADDING_MEDIUM - 1]; /**@}*/ } VAEncSequenceParameterBufferHEVC; @@ -538,7 +549,17 @@ typedef struct _VAEncPictureParameterBufferHEVC { */ uint8_t hierarchical_level_plus1; /** \brief Reserved bytes for future use, must be zero */ - uint8_t va_byte_reserved[3]; + uint8_t va_byte_reserved; + /** \brief SCC flags to enable/disable feature, only IBC at present.*/ + union { + struct { + /** \brief Same as the HEVC bitstream syntax element. */ + uint16_t pps_curr_pic_ref_enabled_flag : 1; + /** \brief Reserved bits for future use, must be zero */ + uint16_t reserved : 15; + } bits; + uint16_t value; + } scc_fields; /** \brief Reserved bytes for future use, must be zero */ uint32_t va_reserved[VA_PADDING_HIGH - 1]; } VAEncPictureParameterBufferHEVC; diff --git a/va/va_str.c b/va/va_str.c index 6b2212585..4b631cadc 100644 --- a/va/va_str.c +++ b/va/va_str.c @@ -61,6 +61,9 @@ const char *vaProfileStr(VAProfile profile) TOSTR(VAProfileHEVCSccMain); TOSTR(VAProfileHEVCSccMain10); TOSTR(VAProfileHEVCSccMain444); + TOSTR(VAProfileAV1Profile0); + TOSTR(VAProfileAV1Profile1); + TOSTR(VAProfileHEVCSccMain444_10); default: break; } return ""; @@ -126,6 +129,7 @@ const char *vaConfigAttribTypeStr(VAConfigAttribType configAttribType) TOSTR(VAConfigAttribMaxFrameSize); TOSTR(VAConfigAttribPredictionDirection); TOSTR(VAConfigAttribMultipleFrame); + TOSTR(VAConfigAttribContextPriority); case VAConfigAttribTypeMax: break; } return ""; diff --git a/va/va_trace.c b/va/va_trace.c old mode 100755 new mode 100644 index d34fc4059..0fa53979e --- a/va/va_trace.c +++ b/va/va_trace.c @@ -989,7 +989,7 @@ static void va_TraceSurface(VADisplay dpy, VAContextID context) vaUnlockSurface(dpy, trace_ctx->trace_rendertarget); return; } - va_TraceMsg(trace_ctx, "\tbuffer location = 0x%08x\n", buffer); + va_TraceMsg(trace_ctx, "\tbuffer location = 0x%p\n", buffer); va_TraceMsg(trace_ctx, NULL); Y_data = (unsigned char*)buffer; @@ -1661,7 +1661,7 @@ void va_TraceMapBuffer ( va_TraceMsg(trace_ctx, "\t bit_offset = %u\n", buf_list->bit_offset); va_TraceMsg(trace_ctx, "\t status = 0x%08x\n", buf_list->status); va_TraceMsg(trace_ctx, "\t reserved = 0x%08x\n", buf_list->reserved); - va_TraceMsg(trace_ctx, "\t buf = 0x%08x\n", buf_list->buf); + va_TraceMsg(trace_ctx, "\t buf = 0x%p\n", buf_list->buf); if (trace_ctx->trace_fp_codedbuf) { va_TraceMsg(trace_ctx, "\tDump the content to file\n"); @@ -1773,10 +1773,10 @@ static void va_TraceVAIQMatrixBufferMPEG2( va_TraceMsg(trace_ctx,"\tload_non_intra_quantiser_matrix = %d\n", p->load_non_intra_quantiser_matrix); va_TraceMsg(trace_ctx,"\tload_chroma_intra_quantiser_matrix = %d\n", p->load_chroma_intra_quantiser_matrix); va_TraceMsg(trace_ctx,"\tload_chroma_non_intra_quantiser_matrix = %d\n", p->load_chroma_non_intra_quantiser_matrix); - va_TraceMsg(trace_ctx,"\tintra_quantiser_matrix = %d\n", p->intra_quantiser_matrix); - va_TraceMsg(trace_ctx,"\tnon_intra_quantiser_matrix = %d\n", p->non_intra_quantiser_matrix); - va_TraceMsg(trace_ctx,"\tchroma_intra_quantiser_matrix = %d\n", p->chroma_intra_quantiser_matrix); - va_TraceMsg(trace_ctx,"\tchroma_non_intra_quantiser_matrix = %d\n", p->chroma_non_intra_quantiser_matrix); + va_TraceMsg(trace_ctx,"\tintra_quantiser_matrix = %p\n", p->intra_quantiser_matrix); + va_TraceMsg(trace_ctx,"\tnon_intra_quantiser_matrix = %p\n", p->non_intra_quantiser_matrix); + va_TraceMsg(trace_ctx,"\tchroma_intra_quantiser_matrix = %p\n", p->chroma_intra_quantiser_matrix); + va_TraceMsg(trace_ctx,"\tchroma_non_intra_quantiser_matrix = %p\n", p->chroma_non_intra_quantiser_matrix); va_TraceMsg(trace_ctx, NULL); return; @@ -2047,7 +2047,7 @@ static void va_TraceVAEncSequenceParameterBufferMPEG2( va_TraceMsg(trace_ctx, "\tintra_period = %d\n", p->intra_period); va_TraceMsg(trace_ctx, "\tbits_per_second = %d\n", p->bits_per_second); - va_TraceMsg(trace_ctx, "\tframe_rate = %d\n", p->frame_rate); + va_TraceMsg(trace_ctx, "\tframe_rate = %f\n", p->frame_rate); va_TraceMsg(trace_ctx, "\tvbv_buffer_size = %d\n", p->vbv_buffer_size); va_TraceMsg(trace_ctx, NULL); @@ -2153,6 +2153,43 @@ static inline void va_TraceFlagIfNotZero( } } +static inline void va_TraceIsRextProfile( + VADisplay dpy, + VAContextID context, + bool *isRext /* out */ +) +{ + DPY2TRACECTX(dpy, context, VA_INVALID_ID); + + *isRext = (\ + trace_ctx->trace_profile == VAProfileHEVCMain12 || \ + trace_ctx->trace_profile == VAProfileHEVCMain422_10 || \ + trace_ctx->trace_profile == VAProfileHEVCMain422_12 || \ + trace_ctx->trace_profile == VAProfileHEVCMain444 || \ + trace_ctx->trace_profile == VAProfileHEVCMain444_10 || \ + trace_ctx->trace_profile == VAProfileHEVCMain444_12 || \ + trace_ctx->trace_profile == VAProfileHEVCSccMain || \ + trace_ctx->trace_profile == VAProfileHEVCSccMain10 || \ + trace_ctx->trace_profile == VAProfileHEVCSccMain444 || \ + trace_ctx->trace_profile == VAProfileHEVCSccMain444_10 \ + ); +} + +static inline void va_TraceIsSccProfile( + VADisplay dpy, + VAContextID context, + bool *isScc /* out */ +) +{ + DPY2TRACECTX(dpy, context, VA_INVALID_ID); + + *isScc = (\ + trace_ctx->trace_profile == VAProfileHEVCSccMain || \ + trace_ctx->trace_profile == VAProfileHEVCSccMain10 || \ + trace_ctx->trace_profile == VAProfileHEVCSccMain444 || \ + trace_ctx->trace_profile == VAProfileHEVCSccMain444_10 \ + ); +} static void va_TraceVAPictureParameterBufferHEVC( VADisplay dpy, @@ -2163,8 +2200,24 @@ static void va_TraceVAPictureParameterBufferHEVC( unsigned int num_elements, void *data) { - int i; - VAPictureParameterBufferHEVC *p = (VAPictureParameterBufferHEVC*)data; + int i, j; + bool isRext = false; + bool isScc = false; + VAPictureParameterBufferHEVC *p = NULL; + VAPictureParameterBufferHEVCRext *pRext = NULL; + VAPictureParameterBufferHEVCScc *pScc = NULL; + + va_TraceIsRextProfile(dpy, context, &isRext); + va_TraceIsSccProfile(dpy, context, &isScc); + + if (isRext) { + p = &((VAPictureParameterBufferHEVCExtension*)data)->base; + pRext = &((VAPictureParameterBufferHEVCExtension*)data)->rext; + + if (isScc) + pScc = &((VAPictureParameterBufferHEVCExtension*)data)->scc; + } else + p = (VAPictureParameterBufferHEVC*)data; DPY2TRACECTX(dpy, context, VA_INVALID_ID); @@ -2174,7 +2227,7 @@ static void va_TraceVAPictureParameterBufferHEVC( va_TraceMsg(trace_ctx, "\tCurrPic.frame_idx = %d\n", p->CurrPic.pic_order_cnt); va_TraceMsg(trace_ctx, "\tCurrPic.flags = %d\n", p->CurrPic.flags); - va_TraceMsg(trace_ctx, "\tReferenceFrames (TopFieldOrderCnt-BottomFieldOrderCnt-picture_id-frame_idx-flags:\n"); + va_TraceMsg(trace_ctx, "\tReferenceFrames (picture_id-pic_order_cnt-flags:\n"); for (i = 0; i < 15; i++) { if ((p->ReferenceFrames[i].picture_id != VA_INVALID_SURFACE) && @@ -2279,6 +2332,71 @@ static void va_TraceVAPictureParameterBufferHEVC( va_TraceMsg(trace_ctx, "\tnum_extra_slice_header_bits = %d\n", p->num_extra_slice_header_bits); va_TraceMsg(trace_ctx, "\tst_rps_bits = %d\n", p->st_rps_bits); + if (isRext && pRext) { + va_TraceMsg(trace_ctx, "\trange_extension_pic_fields = %d\n", pRext->range_extension_pic_fields.value); + va_TraceMsg(trace_ctx, "\ttransform_skip_rotation_enabled_flag = %d\n", pRext->range_extension_pic_fields.bits.transform_skip_rotation_enabled_flag); + va_TraceMsg(trace_ctx, "\ttransform_skip_context_enabled_flag = %d\n", pRext->range_extension_pic_fields.bits.transform_skip_context_enabled_flag); + va_TraceMsg(trace_ctx, "\timplicit_rdpcm_enabled_flag = %d\n", pRext->range_extension_pic_fields.bits.implicit_rdpcm_enabled_flag); + va_TraceMsg(trace_ctx, "\texplicit_rdpcm_enabled_flag = %d\n", pRext->range_extension_pic_fields.bits.explicit_rdpcm_enabled_flag); + va_TraceMsg(trace_ctx, "\textended_precision_processing_flag = %d\n", pRext->range_extension_pic_fields.bits.extended_precision_processing_flag); + va_TraceMsg(trace_ctx, "\tintra_smoothing_disabled_flag = %d\n", pRext->range_extension_pic_fields.bits.intra_smoothing_disabled_flag); + va_TraceMsg(trace_ctx, "\thigh_precision_offsets_enabled_flag = %d\n", pRext->range_extension_pic_fields.bits.high_precision_offsets_enabled_flag); + va_TraceMsg(trace_ctx, "\tpersistent_rice_adaptation_enabled_flag = %d\n", pRext->range_extension_pic_fields.bits.persistent_rice_adaptation_enabled_flag); + va_TraceMsg(trace_ctx, "\tcabac_bypass_alignment_enabled_flag = %d\n", pRext->range_extension_pic_fields.bits.cabac_bypass_alignment_enabled_flag); + va_TraceMsg(trace_ctx, "\tcross_component_prediction_enabled_flag = %d\n", pRext->range_extension_pic_fields.bits.cross_component_prediction_enabled_flag); + va_TraceMsg(trace_ctx, "\tchroma_qp_offset_list_enabled_flag = %d\n", pRext->range_extension_pic_fields.bits.chroma_qp_offset_list_enabled_flag); + va_TraceMsg(trace_ctx, "\treserved = %d\n", pRext->range_extension_pic_fields.bits.reserved); + + va_TraceMsg(trace_ctx, "\tdiff_cu_chroma_qp_offset_depth = %d\n", pRext->diff_cu_chroma_qp_offset_depth); + va_TraceMsg(trace_ctx, "\tchroma_qp_offset_list_len_minus1 = %d\n", pRext->chroma_qp_offset_list_len_minus1); + va_TraceMsg(trace_ctx, "\tlog2_sao_offset_scale_luma = %d\n", pRext->log2_sao_offset_scale_luma); + va_TraceMsg(trace_ctx, "\tlog2_sao_offset_scale_chroma = %d\n", pRext->log2_sao_offset_scale_chroma); + va_TraceMsg(trace_ctx, "\tlog2_max_transform_skip_block_size_minus2 = %d\n", pRext->log2_max_transform_skip_block_size_minus2); + + va_TraceMsg(trace_ctx, "\tcb_qp_offset_list[6] = \n"); + va_TraceMsg(trace_ctx, ""); + for (i = 0; i < 6; i++) + va_TracePrint(trace_ctx, "\t%d", pRext->cb_qp_offset_list[i]); + va_TracePrint(trace_ctx, "\n"); + + va_TraceMsg(trace_ctx, "\tcr_qp_offset_list[] = \n"); + va_TraceMsg(trace_ctx, ""); + for (i = 0; i < 6; i++) + va_TracePrint(trace_ctx, "\t%d", pRext->cr_qp_offset_list[i]); + va_TracePrint(trace_ctx, "\n"); + } + + if (isScc && pScc) { + va_TraceMsg(trace_ctx, "\tscreen_content_pic_fields = %d\n", pScc->screen_content_pic_fields.value); + va_TraceMsg(trace_ctx, "\tpps_curr_pic_ref_enabled_flag = %d\n", pScc->screen_content_pic_fields.bits.pps_curr_pic_ref_enabled_flag); + va_TraceMsg(trace_ctx, "\tpalette_mode_enabled_flag = %d\n", pScc->screen_content_pic_fields.bits.palette_mode_enabled_flag); + va_TraceMsg(trace_ctx, "\tmotion_vector_resolution_control_idc = %d\n", pScc->screen_content_pic_fields.bits.motion_vector_resolution_control_idc); + va_TraceMsg(trace_ctx, "\tintra_boundary_filtering_disabled_flag = %d\n", pScc->screen_content_pic_fields.bits.intra_boundary_filtering_disabled_flag); + va_TraceMsg(trace_ctx, "\tresidual_adaptive_colour_transform_enabled_flag = %d\n", pScc->screen_content_pic_fields.bits.residual_adaptive_colour_transform_enabled_flag); + va_TraceMsg(trace_ctx, "\tpps_slice_act_qp_offsets_present_flag = %d\n", pScc->screen_content_pic_fields.bits.pps_slice_act_qp_offsets_present_flag); + va_TraceMsg(trace_ctx, "\treserved = %d\n", pScc->screen_content_pic_fields.bits.reserved); + + va_TraceMsg(trace_ctx, "\tpalette_max_size = %d\n", pScc->palette_max_size); + va_TraceMsg(trace_ctx, "\tdelta_palette_max_predictor_size = %d\n", pScc->delta_palette_max_predictor_size); + va_TraceMsg(trace_ctx, "\tpredictor_palette_size = %d\n", pScc->predictor_palette_size); + + va_TraceMsg(trace_ctx, "\tpredictor_palette_entries[3][128] = \n"); + va_TraceMsg(trace_ctx, ""); + for (i = 0; i < 3; i++) { + for (j = 0; j < 128; j++) { + va_TracePrint(trace_ctx, "\t%d", pScc->predictor_palette_entries[i][j]); + if ((j + 1) % 8 == 0) + TRACE_NEWLINE(); + } + TRACE_NEWLINE(); + } + va_TracePrint(trace_ctx, "\n"); + + va_TraceMsg(trace_ctx, "\tpps_act_y_qp_offset_plus5 = %d\n", pScc->pps_act_y_qp_offset_plus5); + va_TraceMsg(trace_ctx, "\tpps_act_cb_qp_offset_plus5 = %d\n", pScc->pps_act_cb_qp_offset_plus5); + va_TraceMsg(trace_ctx, "\tpps_act_cr_qp_offset_plus3 = %d\n", pScc->pps_act_cr_qp_offset_plus3); + } + return; } @@ -2292,7 +2410,16 @@ static void va_TraceVASliceParameterBufferHEVC( void *data) { int i,j; - VASliceParameterBufferHEVC* p = (VASliceParameterBufferHEVC*)data; + bool isRext = false; + VASliceParameterBufferHEVC* p = NULL; + VASliceParameterBufferHEVCRext *pRext = NULL; + + va_TraceIsRextProfile(dpy, context, &isRext); + if (isRext) { + p = &((VASliceParameterBufferHEVCExtension*)data)->base; + pRext = &((VASliceParameterBufferHEVCExtension*)data)->rext; + } else + p = (VASliceParameterBufferHEVC*)data; DPY2TRACECTX(dpy, context, VA_INVALID_ID); @@ -2366,6 +2493,59 @@ static void va_TraceVASliceParameterBufferHEVC( va_TraceMsg(trace_ctx, "\tfive_minus_max_num_merge_cand = %d\n", p->five_minus_max_num_merge_cand); + va_TraceMsg(trace_ctx, "\tnum_entry_point_offsets = %d\n", p->num_entry_point_offsets); + va_TraceMsg(trace_ctx, "\tentry_offset_to_subset_array = %d\n", p->entry_offset_to_subset_array); + va_TraceMsg(trace_ctx, "\tslice_data_num_emu_prevn_bytes = %d\n", p->slice_data_num_emu_prevn_bytes); + + if (isRext && pRext) { + va_TraceMsg(trace_ctx, "\tluma_offset_l0[15] = \n"); + va_TraceMsg(trace_ctx, ""); + for (i = 0; i < 15; i++) { + va_TracePrint(trace_ctx, "\t%d", pRext->luma_offset_l0[i]); + if ((i + 1) % 8 == 0) + TRACE_NEWLINE(); + } + va_TracePrint(trace_ctx, "\n"); + + va_TraceMsg(trace_ctx, "\tChromaOffsetL0[15][2] = \n"); + va_TraceMsg(trace_ctx, ""); + for (i = 0; i < 15; i++) { + for (j = 0; j < 2; j++) { + va_TracePrint(trace_ctx, "\t%d", pRext->ChromaOffsetL0[i][j]); + } + TRACE_NEWLINE(); + } + va_TracePrint(trace_ctx, "\n"); + + va_TraceMsg(trace_ctx, "\tluma_offset_l1[15] = \n"); + va_TraceMsg(trace_ctx, ""); + for (i = 0; i < 15; i++) { + va_TracePrint(trace_ctx, "\t%d", pRext->luma_offset_l1[i]); + if ((i + 1) % 8 == 0) + TRACE_NEWLINE(); + } + va_TracePrint(trace_ctx, "\n"); + + va_TraceMsg(trace_ctx, "\tChromaOffsetL1[15][2] = \n"); + va_TraceMsg(trace_ctx, ""); + for (i = 0; i < 15; i++) { + for (j = 0; j < 2; j++) { + va_TracePrint(trace_ctx, "\t%d", pRext->ChromaOffsetL1[i][j]); + } + TRACE_NEWLINE(); + } + va_TracePrint(trace_ctx, "\n"); + + va_TraceMsg(trace_ctx, "\tslice_ext_flags = %d\n", pRext->slice_ext_flags.value); + va_TraceMsg(trace_ctx, "\tcu_chroma_qp_offset_enabled_flag = %d\n", pRext->slice_ext_flags.bits.cu_chroma_qp_offset_enabled_flag); + va_TraceMsg(trace_ctx, "\tuse_integer_mv_flag = %d\n", pRext->slice_ext_flags.bits.use_integer_mv_flag); + va_TraceMsg(trace_ctx, "\treserved = %d\n", pRext->slice_ext_flags.bits.reserved); + + va_TraceMsg(trace_ctx, "\tslice_act_y_qp_offset = %d\n", pRext->slice_act_y_qp_offset); + va_TraceMsg(trace_ctx, "\tslice_act_cb_qp_offset = %d\n", pRext->slice_act_cb_qp_offset); + va_TraceMsg(trace_ctx, "\tslice_act_cr_qp_offset = %d\n", pRext->slice_act_cr_qp_offset); + } + va_TraceMsg(trace_ctx, NULL); } @@ -2510,6 +2690,8 @@ static void va_TraceVAEncSequenceParameterBufferHEVC( va_TraceMsg(trace_ctx, "\tmin_spatial_segmentation_idc = %d\n", p->min_spatial_segmentation_idc); va_TraceMsg(trace_ctx, "\tmax_bytes_per_pic_denom = %d\n", p->max_bytes_per_pic_denom); va_TraceMsg(trace_ctx, "\tmax_bits_per_min_cu_denom = %d\n", p->max_bits_per_min_cu_denom); + va_TraceMsg(trace_ctx, "\tpalette_mode_enabled_flag = %d\n", p->scc_fields.bits.palette_mode_enabled_flag); + va_TraceMsg(trace_ctx, "\treserved = %d\n", p->scc_fields.bits.reserved); return; } @@ -2590,6 +2772,10 @@ static void va_TraceVAEncPictureParameterBufferHEVC( va_TraceMsg(trace_ctx, "\tenable_gpu_weighted_prediction = %d\n", p->pic_fields.bits.enable_gpu_weighted_prediction); va_TraceMsg(trace_ctx, "\tno_output_of_prior_pics_flag = %d\n", p->pic_fields.bits.no_output_of_prior_pics_flag); va_TraceMsg(trace_ctx, "\treserved = %d\n", p->pic_fields.bits.reserved); + va_TraceMsg(trace_ctx, "\thierarchical_level_plus1 = %d\n", p->hierarchical_level_plus1); + va_TraceMsg(trace_ctx, "\tva_byte_reserved = %d\n", p->va_byte_reserved); + va_TraceMsg(trace_ctx, "\tpps_curr_pic_ref_enabled_flag = %d\n", p->scc_fields.bits.pps_curr_pic_ref_enabled_flag); + va_TraceMsg(trace_ctx, "\treserved = %d\n", p->scc_fields.bits.reserved); return; } @@ -3030,9 +3216,8 @@ static void va_TraceVAEncSliceParameterBuffer( { VAEncSliceParameterBuffer* p = (VAEncSliceParameterBuffer*)data; DPY2TRACECTX(dpy, context, VA_INVALID_ID); - + va_TraceMsg(trace_ctx, "\t--VAEncSliceParameterBuffer\n"); - va_TraceMsg(trace_ctx, "\tstart_row_number = %d\n", p->start_row_number); va_TraceMsg(trace_ctx, "\tslice_height = %d\n", p->slice_height); va_TraceMsg(trace_ctx, "\tslice_flags.is_intra = %d\n", p->slice_flags.bits.is_intra); @@ -3797,6 +3982,119 @@ static void va_TraceVAPictureParameterBufferVP9( return; } +static void va_TraceVAPictureParameterBufferAV1( + VADisplay dpy, + VAContextID context, + VABufferID buffer, + VABufferType type, + unsigned int size, + unsigned int num_elements, + void *data) +{ + VADecPictureParameterBufferAV1 *p = (VADecPictureParameterBufferAV1 *)data; + DPY2TRACECTX(dpy, context, VA_INVALID_ID); + int i; + + va_TraceMsg(trace_ctx, "\t--VAPictureParameterBufferAV1\n"); + + va_TraceMsg(trace_ctx, "\tprofile = %d\n", p->profile); + + va_TraceMsg(trace_ctx, "\tframe_width_minus_1 = %d\n", p->frame_width_minus1); + va_TraceMsg(trace_ctx, "\tframe_height_minus_1 = %d\n", p->frame_height_minus1); + + va_TraceMsg(trace_ctx, "\toutput_frame_width_in_tiles_minus_1 = %d\n", p->output_frame_width_in_tiles_minus_1); + va_TraceMsg(trace_ctx, "\toutput_frame_height_in_tiles_minus_1 = %d\n", p->output_frame_height_in_tiles_minus_1); + + va_TraceMsg(trace_ctx, "\tbit_depth_idx = %d\n", p->bit_depth_idx); + va_TraceMsg(trace_ctx, "\tseq_info_fields = %X\n", p->seq_info_fields.value); + + va_TraceMsg(trace_ctx, "\t\tseq_info_fields.still_picture = %d\n", p->seq_info_fields.fields.still_picture); + va_TraceMsg(trace_ctx, "\t\tseq_info_fields.use_128x128_superblock = %d\n", p->seq_info_fields.fields.use_128x128_superblock); + va_TraceMsg(trace_ctx, "\t\tseq_info_fields.enable_filter_intra = %d\n", p->seq_info_fields.fields.enable_filter_intra); + va_TraceMsg(trace_ctx, "\t\tseq_info_fields.enable_intra_edge_filter = %d\n", p->seq_info_fields.fields.enable_intra_edge_filter); + va_TraceMsg(trace_ctx, "\t\tseq_info_fields.enable_interintra_compound = %d\n", p->seq_info_fields.fields.enable_interintra_compound); + va_TraceMsg(trace_ctx, "\t\tseq_info_fields.enable_masked_compound = %d\n", p->seq_info_fields.fields.enable_masked_compound); + va_TraceMsg(trace_ctx, "\t\tseq_info_fields.enable_dual_filter = %d\n", p->seq_info_fields.fields.enable_dual_filter); + va_TraceMsg(trace_ctx, "\t\tseq_info_fields.enable_order_hint = %d\n", p->seq_info_fields.fields.enable_order_hint); + va_TraceMsg(trace_ctx, "\t\tseq_info_fields.enable_jnt_comp = %d\n", p->seq_info_fields.fields.enable_jnt_comp); + va_TraceMsg(trace_ctx, "\t\tseq_info_fields.enable_cdef = %d\n", p->seq_info_fields.fields.enable_cdef); + va_TraceMsg(trace_ctx, "\t\tseq_info_fields.mono_chrome = %d\n", p->seq_info_fields.fields.mono_chrome); + va_TraceMsg(trace_ctx, "\t\tseq_info_fields.color_range = %d\n", p->seq_info_fields.fields.color_range); + va_TraceMsg(trace_ctx, "\t\tseq_info_fields.subsampling_x = %d\n", p->seq_info_fields.fields.subsampling_x); + va_TraceMsg(trace_ctx, "\t\tseq_info_fields.subsampling_y = %d\n", p->seq_info_fields.fields.subsampling_y); + va_TraceMsg(trace_ctx, "\t\tseq_info_fields.chroma_sample_position = %d\n", p->seq_info_fields.fields.chroma_sample_position); + va_TraceMsg(trace_ctx, "\t\tseq_info_fields.film_grain_params_present = %d\n", p->seq_info_fields.fields.film_grain_params_present); + + va_TraceMsg(trace_ctx, "\tpic_info_fields = %X\n", p->pic_info_fields.value); + va_TraceMsg(trace_ctx, "\t\tpic_info_fields.frame_type = %d\n", p->pic_info_fields.bits.frame_type); + va_TraceMsg(trace_ctx, "\t\tpic_info_fields.show_frame = %d\n", p->pic_info_fields.bits.show_frame); + va_TraceMsg(trace_ctx, "\t\tpic_info_fields.showable_frame = %d\n", p->pic_info_fields.bits.showable_frame); + va_TraceMsg(trace_ctx, "\t\tpic_info_fields.error_resilient_mode = %d\n", p->pic_info_fields.bits.error_resilient_mode); + va_TraceMsg(trace_ctx, "\t\tpic_info_fields.disable_cdf_update = %d\n", p->pic_info_fields.bits.disable_cdf_update); + va_TraceMsg(trace_ctx, "\t\tpic_info_fields.allow_screen_content_tools = %d\n", p->pic_info_fields.bits.allow_screen_content_tools); + va_TraceMsg(trace_ctx, "\t\tpic_info_fields.force_integer_mv = %d\n", p->pic_info_fields.bits.force_integer_mv); + va_TraceMsg(trace_ctx, "\t\tpic_info_fields.allow_intrabc = %d\n", p->pic_info_fields.bits.allow_intrabc); + va_TraceMsg(trace_ctx, "\t\tpic_info_fields.use_superres = %d\n", p->pic_info_fields.bits.use_superres); + va_TraceMsg(trace_ctx, "\t\tpic_info_fields.allow_high_precision_mv = %d\n", p->pic_info_fields.bits.allow_high_precision_mv); + va_TraceMsg(trace_ctx, "\t\tpic_info_fields.is_motion_mode_switchable = %d\n", p->pic_info_fields.bits.is_motion_mode_switchable); + va_TraceMsg(trace_ctx, "\t\tpic_info_fields.use_ref_frame_mvs = %d\n", p->pic_info_fields.bits.use_ref_frame_mvs); + va_TraceMsg(trace_ctx, "\t\tpic_info_fields.disable_frame_end_update_cdf = %d\n", p->pic_info_fields.bits.disable_frame_end_update_cdf); + va_TraceMsg(trace_ctx, "\t\tpic_info_fields.uniform_tile_spacing_flag = %d\n", p->pic_info_fields.bits.uniform_tile_spacing_flag); + va_TraceMsg(trace_ctx, "\t\tpic_info_fields.allow_warped_motion = %d\n", p->pic_info_fields.bits.allow_warped_motion); + va_TraceMsg(trace_ctx, "\t\tpic_info_fields.large_scale_tile = %d\n", p->pic_info_fields.bits.large_scale_tile); + + va_TraceMsg(trace_ctx, "\tloop_filter_info_fields = %X\n", p->loop_filter_info_fields.value); + va_TraceMsg(trace_ctx, "\t\tloop_filter_info_fields.bits.sharpness_level = %d\n", p->loop_filter_info_fields.bits.sharpness_level); + va_TraceMsg(trace_ctx, "\t\tloop_filter_info_fields.bits.mode_ref_delta_enabled = %d\n", p->loop_filter_info_fields.bits.mode_ref_delta_enabled); + va_TraceMsg(trace_ctx, "\t\tloop_filter_info_fields.bits.mode_ref_delta_update = %d\n", p->loop_filter_info_fields.bits.mode_ref_delta_update); + + va_TraceMsg(trace_ctx, "\tcurrent_frame = %X\n", p->current_frame); + va_TraceMsg(trace_ctx, "\tcurrent_display_picture = %X\n", p->current_display_picture); + + va_TraceMsg(trace_ctx, "\ttile_cols = %d\n", p->tile_cols); + va_TraceMsg(trace_ctx, "\ttile_rows = %d\n", p->tile_rows); + va_TraceMsg(trace_ctx, "\ttile_count_minus_1 = %d\n", p->tile_count_minus_1); + va_TraceMsg(trace_ctx, "\tcontext_update_tile_id = %d\n", p->context_update_tile_id); + + va_TraceMsg(trace_ctx, "\tprimary_ref_frame = %d\n", p->primary_ref_frame); + for (i=0;i<8;i++) + va_TraceMsg(trace_ctx, "\tref_frame_map[%d] = %X\n", i, p->ref_frame_map[i]); + + for (i=0;i<7;i++) + va_TraceMsg(trace_ctx, "\tref_frame_idx[%d] = %d\n", i, p->ref_frame_idx[i]); + + va_TraceMsg(trace_ctx, "\torder_hint = %d\n", p->order_hint); + + va_TraceMsg(trace_ctx, "\tanchor_frames_num = %d\n", p->anchor_frames_num); + for (i=0;ianchor_frames_num;i++) + va_TraceMsg(trace_ctx, "\t\tanchor_frames_list[%d] = %X\n", i, p->anchor_frames_list[i]); + + va_TraceMsg(trace_ctx, "\tsuperres_scale_denominator = %d\n", p->superres_scale_denominator); + va_TraceMsg(trace_ctx, "\tinterp_filter = %d\n", p->interp_filter); + va_TraceMsg(trace_ctx, "\tfilter_level[0] = %d\n", p->filter_level[0]); + va_TraceMsg(trace_ctx, "\tfilter_level[1] = %d\n", p->filter_level[1]); + va_TraceMsg(trace_ctx, "\tfilter_level_u = %d\n", p->filter_level_u); + va_TraceMsg(trace_ctx, "\tfilter_level_v = %d\n", p->filter_level_v); + + va_TraceMsg(trace_ctx, "\tmode_control_fields = %X\n", p->mode_control_fields.value); + va_TraceMsg(trace_ctx, "\t\tmode_control_fields.delta_q_present_flag = %d\n", p->mode_control_fields.bits.delta_q_present_flag); + va_TraceMsg(trace_ctx, "\t\tmode_control_fields.log2_delta_q_res = %d\n", p->mode_control_fields.bits.log2_delta_q_res); + va_TraceMsg(trace_ctx, "\t\tmode_control_fields.delta_lf_present_flag = %d\n", p->mode_control_fields.bits.delta_lf_present_flag); + va_TraceMsg(trace_ctx, "\t\tmode_control_fields.log2_delta_lf_res = %d\n", p->mode_control_fields.bits.log2_delta_lf_res); + va_TraceMsg(trace_ctx, "\t\tmode_control_fields.delta_lf_multi = %d\n", p->mode_control_fields.bits.delta_lf_multi); + va_TraceMsg(trace_ctx, "\t\tmode_control_fields.tx_mode = %d\n", p->mode_control_fields.bits.tx_mode); + va_TraceMsg(trace_ctx, "\t\tmode_control_fields.reference_select = %d\n", p->mode_control_fields.bits.reference_select); + va_TraceMsg(trace_ctx, "\t\tmode_control_fields.reduced_tx_set_used = %d\n", p->mode_control_fields.bits.reduced_tx_set_used); + va_TraceMsg(trace_ctx, "\t\tmode_control_fields.skip_mode_present = %d\n", p->mode_control_fields.bits.skip_mode_present); + va_TraceMsg(trace_ctx, "\t\tmode_control_fields.skip_mode_present = %d\n", p->mode_control_fields.bits.skip_mode_present); + + va_TraceMsg(trace_ctx, "\tloop_filter_info_fields = %X\n", p->loop_filter_info_fields.value); + + va_TraceMsg(trace_ctx, NULL); + + return; +} + static void va_TraceVAEncPictureParameterBufferVP8( VADisplay dpy, VAContextID context, @@ -3995,6 +4293,39 @@ static void va_TraceVASliceParameterBufferVP9( return; } +static void va_TraceVASliceParameterBufferAV1( + VADisplay dpy, + VAContextID context, + VABufferID buffer, + VABufferType type, + unsigned int size, + unsigned int num_elements, + void *data) +{ + + VASliceParameterBufferAV1 *p = (VASliceParameterBufferAV1 *)data; + DPY2TRACECTX(dpy, context, VA_INVALID_ID); + + va_TraceMsg(trace_ctx, "\t--VASliceParameterBufferAV1\n"); + + va_TraceMsg(trace_ctx, "\tslice_data_size = %d\n", p->slice_data_size); + va_TraceMsg(trace_ctx, "\tslice_data_offset = %d\n", p->slice_data_offset); + va_TraceMsg(trace_ctx, "\tslice_data_flag = %d\n", p->slice_data_flag); + + va_TraceMsg(trace_ctx, "\ttile_row = %d\n", p->tile_row); + va_TraceMsg(trace_ctx, "\ttile_column = %d\n", p->tile_column); + + va_TraceMsg(trace_ctx, "\ttg_start = %d\n", p->tg_start); + va_TraceMsg(trace_ctx, "\ttg_end = %d\n", p->tg_end); + + va_TraceMsg(trace_ctx, "\tanchor_frame_idx = %d\n", p->anchor_frame_idx); + va_TraceMsg(trace_ctx, "\ttile_idx_in_tile_list = %d\n", p->tile_idx_in_tile_list); + + va_TraceMsg(trace_ctx, NULL); + + return; +} + void va_TraceBeginPicture( VADisplay dpy, VAContextID context, @@ -4621,6 +4952,30 @@ static void va_TraceVP9Buf( } } +static void va_TraceAV1Buf( + VADisplay dpy, + VAContextID context, + VABufferID buffer, + VABufferType type, + unsigned int size, + unsigned int num_elements, + void *pbuf +) +{ + DPY2TRACECTX(dpy, context, VA_INVALID_ID); + + switch (type) { + case VAPictureParameterBufferType: + va_TraceVAPictureParameterBufferAV1(dpy, context, buffer, type, size, num_elements, pbuf); + break; + case VASliceParameterBufferType: + va_TraceVASliceParameterBufferAV1(dpy, context, buffer, type, size, num_elements, pbuf); + break; + default: + va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf); + break; + } +} static void va_TraceVC1Buf( VADisplay dpy, VAContextID context, @@ -5012,6 +5367,10 @@ void va_TraceRenderPicture( case VAProfileHEVCMain444_12: case VAProfileHEVCMain: case VAProfileHEVCMain10: + case VAProfileHEVCSccMain: + case VAProfileHEVCSccMain10: + case VAProfileHEVCSccMain444: + case VAProfileHEVCSccMain444_10: for (j=0; jtrace_rendertarget); + va_TraceMsg(trace_ctx, NULL); +} +void va_TraceEndPictureExt( + VADisplay dpy, + VAContextID context, + int endpic_done +) +{ + int encode, decode, jpeg; + DPY2TRACECTX(dpy, context, VA_INVALID_ID); /* avoid to create so many empty files */ encode = (trace_ctx->trace_entrypoint == VAEntrypointEncSlice); decode = (trace_ctx->trace_entrypoint == VAEntrypointVLD); @@ -5067,9 +5443,7 @@ void va_TraceEndPicture( vaSyncSurface(dpy, trace_ctx->trace_rendertarget); va_TraceSurface(dpy, context); } - - va_TraceMsg(trace_ctx, NULL); -} + } void va_TraceSyncSurface( @@ -5087,6 +5461,23 @@ void va_TraceSyncSurface( DPY2TRACE_VIRCTX_EXIT(pva_trace); } +void va_TraceSyncSurface2( + VADisplay dpy, + VASurfaceID surface, + uint64_t timeout_ns +) +{ + DPY2TRACE_VIRCTX(dpy); + + TRACE_FUNCNAME(idx); + + va_TraceMsg(trace_ctx, "\tsurface = 0x%08x\n", surface); + va_TraceMsg(trace_ctx, "\ttimeout_ns = %d\n", timeout_ns); + va_TraceMsg(trace_ctx, NULL); + + DPY2TRACE_VIRCTX_EXIT(pva_trace); +} + void va_TraceQuerySurfaceAttributes( VADisplay dpy, VAConfigID config, @@ -5151,6 +5542,23 @@ void va_TraceQuerySurfaceError( DPY2TRACE_VIRCTX_EXIT(pva_trace); } +void va_TraceSyncBuffer( + VADisplay dpy, + VABufferID buf_id, + uint64_t timeout_ns +) +{ + DPY2TRACE_VIRCTX(dpy); + + TRACE_FUNCNAME(idx); + + va_TraceMsg(trace_ctx, "\tbuf_id = 0x%08x\n", buf_id); + va_TraceMsg(trace_ctx, "\ttimeout_ns = %d\n", timeout_ns); + va_TraceMsg(trace_ctx, NULL); + + DPY2TRACE_VIRCTX_EXIT(pva_trace); +} + void va_TraceMaxNumDisplayAttributes ( VADisplay dpy, int number @@ -5274,7 +5682,7 @@ void va_TracePutSurface ( TRACE_FUNCNAME(idx); va_TraceMsg(trace_ctx, "\tsurface = 0x%08x\n", surface); - va_TraceMsg(trace_ctx, "\tdraw = 0x%08x\n", draw); + va_TraceMsg(trace_ctx, "\tdraw = 0x%p\n", draw); va_TraceMsg(trace_ctx, "\tsrcx = %d\n", srcx); va_TraceMsg(trace_ctx, "\tsrcy = %d\n", srcy); va_TraceMsg(trace_ctx, "\tsrcw = %d\n", srcw); @@ -5283,7 +5691,7 @@ void va_TracePutSurface ( va_TraceMsg(trace_ctx, "\tdesty = %d\n", desty); va_TraceMsg(trace_ctx, "\tdestw = %d\n", destw); va_TraceMsg(trace_ctx, "\tdesth = %d\n", desth); - va_TraceMsg(trace_ctx, "\tcliprects = 0x%08x\n", cliprects); + va_TraceMsg(trace_ctx, "\tcliprects = 0x%p\n", cliprects); va_TraceMsg(trace_ctx, "\tnumber_cliprects = %d\n", number_cliprects); va_TraceMsg(trace_ctx, "\tflags = 0x%08x\n", flags); va_TraceMsg(trace_ctx, NULL); @@ -5293,9 +5701,6 @@ void va_TracePutSurface ( void va_TraceStatus(VADisplay dpy, const char * funcName, VAStatus status) { - if(status == VA_STATUS_SUCCESS) - return; - DPY2TRACE_VIRCTX(dpy); va_TraceMsg(trace_ctx, "=========%s ret = %s, %s \n",funcName, vaStatusStr(status), vaErrorStr(status)); diff --git a/va/va_trace.h b/va/va_trace.h index 4c67472eb..536044315 100644 --- a/va/va_trace.h +++ b/va/va_trace.h @@ -199,12 +199,26 @@ void va_TraceEndPicture( int endpic_done ); +DLL_HIDDEN +void va_TraceEndPictureExt( + VADisplay dpy, + VAContextID context, + int endpic_done +); + DLL_HIDDEN void va_TraceSyncSurface( VADisplay dpy, VASurfaceID render_target ); +DLL_HIDDEN +void va_TraceSyncSurface2( + VADisplay dpy, + VASurfaceID surface, + uint64_t timeout_ns +); + DLL_HIDDEN void va_TraceQuerySurfaceAttributes( VADisplay dpy, @@ -228,6 +242,12 @@ void va_TraceQuerySurfaceError( void **error_info /*out*/ ); +DLL_HIDDEN +void va_TraceSyncBuffer( + VADisplay dpy, + VABufferID buf_id, + uint64_t timeout_ns +); DLL_HIDDEN void va_TraceMaxNumDisplayAttributes ( diff --git a/va/va_vpp.h b/va/va_vpp.h old mode 100755 new mode 100644 index bdf1f7ed9..9096ea6b9 --- a/va/va_vpp.h +++ b/va/va_vpp.h @@ -805,15 +805,15 @@ typedef struct _VAHdrMetaDataHDR10 */ uint32_t min_display_mastering_luminance; /** - * \brief The maximum content light level. + * \brief The maximum content light level (MaxCLL). * - * The value is in units of 0.0001 candelas per square metre. + * The value is in units of 1 candelas per square metre. */ uint16_t max_content_light_level; /** - * \brief The maximum picture average light level. + * \brief The maximum picture average light level (MaxFALL). * - * The value is in units of 0.0001 candelas per square metre. + * The value is in units of 1 candelas per square metre. */ uint16_t max_pic_average_light_level; /** Resevered */ @@ -969,6 +969,9 @@ typedef struct _VAProcPipelineParameterBuffer { * \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. + * - Interpolation Method: \c VA_FILTER_INTERPOLATION_DEFAULT, + * \c VA_FILTER_INTERPOLATION_NEAREST_NEIGHBOR, + * \c VA_FILTER_INTERPOLATION_BILINEAR, \c VA_FILTER_INTERPOLATION_ADVANCED. */ uint32_t filter_flags; /** diff --git a/va/x11/dri2_util.c b/va/x11/dri2_util.c index e383db1bd..2218adff2 100644 --- a/va/x11/dri2_util.c +++ b/va/x11/dri2_util.c @@ -182,8 +182,7 @@ va_isDRI2Connected(VADriverContextP ctx, char **driver_name) char *device_name = NULL; drm_magic_t magic; *driver_name = NULL; - dri_state->base.fd = -1; - dri_state->base.auth_type = VA_NONE; + if (!VA_DRI2QueryExtension(ctx->native_dpy, &event_base, &error_base)) goto err_out; @@ -195,6 +194,9 @@ va_isDRI2Connected(VADriverContextP ctx, char **driver_name) driver_name, &device_name)) goto err_out; + if ((dri_state->base.fd != -1) && (dri_state->base.auth_type != VA_NONE)) + goto success_out; + dri_state->base.fd = open(device_name, O_RDWR); if (dri_state->base.fd < 0) @@ -215,6 +217,7 @@ va_isDRI2Connected(VADriverContextP ctx, char **driver_name) dri_state->close = dri2Close; gsDRI2SwapAvailable = (minor >= 2); +success_out: Xfree(device_name); return True; diff --git a/va/x11/va_x11.c b/va/x11/va_x11.c index c40c8c4d2..453ed4621 100644 --- a/va/x11/va_x11.c +++ b/va/x11/va_x11.c @@ -44,6 +44,20 @@ #include #include +struct driver_name_map { + const char *key; + int key_len; + const char *name; +}; + +static const struct driver_name_map g_dri2_driver_name_map[] = { + { "i965", 4, "iHD" }, // Intel iHD VAAPI driver with i965 DRI driver + { "i965", 4, "i965" }, // Intel i965 VAAPI driver with i965 DRI driver + { "iris", 4, "iHD" }, // Intel iHD VAAPI driver with iris DRI driver + { "iris", 4, "i965" }, // Intel i965 VAAPI driver with iris DRI driver + { NULL, 0, NULL } +}; + static int va_DisplayContextIsValid ( VADisplayContextP pDisplayContext ) @@ -73,29 +87,93 @@ static void va_DisplayContextDestroy ( free(pDisplayContext); } +static VAStatus va_DRI2_GetNumCandidates ( + VADisplayContextP pDisplayContext, + int *num_candidates +) +{ + char *driver_name = NULL; + const struct driver_name_map *m = NULL; + VADriverContextP ctx = pDisplayContext->pDriverContext; + + *num_candidates = 0; + + if (!(va_isDRI2Connected(ctx, &driver_name) && driver_name)) + return VA_STATUS_ERROR_UNKNOWN; + + for (m = g_dri2_driver_name_map; m->key != NULL; m++) { + if (strlen(driver_name) >= m->key_len && + strncmp(driver_name, m->key, m->key_len) == 0) { + (*num_candidates)++; + } + } -static VAStatus va_DRI2GetDriverName ( + free(driver_name); + + /* + * If the dri2 driver name does not have a mapped vaapi driver name, then + * assume they have the same name. + */ + if (*num_candidates == 0) + *num_candidates = 1; + + return VA_STATUS_SUCCESS; +} + +static VAStatus va_DRI2_GetDriverName ( VADisplayContextP pDisplayContext, - char **driver_name + char **driver_name_ptr, + int candidate_index ) { + const struct driver_name_map *m = NULL; + int current_index = 0; VADriverContextP ctx = pDisplayContext->pDriverContext; - if (!va_isDRI2Connected(ctx, driver_name)) + *driver_name_ptr = NULL; + + if (!(va_isDRI2Connected(ctx, driver_name_ptr) && *driver_name_ptr)) return VA_STATUS_ERROR_UNKNOWN; + for (m = g_dri2_driver_name_map; m->key != NULL; m++) { + if (strlen(*driver_name_ptr) >= m->key_len && + strncmp(*driver_name_ptr, m->key, m->key_len) == 0) { + if (current_index == candidate_index) { + break; + } + current_index++; + } + } + + /* + * If the dri2 driver name does not have a mapped vaapi driver name, then + * assume they have the same name. + */ + if (!m->name) + return VA_STATUS_SUCCESS; + + /* Use the mapped vaapi driver name */ + free(*driver_name_ptr); + *driver_name_ptr = strdup(m->name); + if (!*driver_name_ptr) + return VA_STATUS_ERROR_ALLOCATION_FAILED; + return VA_STATUS_SUCCESS; } static VAStatus va_NVCTRL_GetDriverName ( VADisplayContextP pDisplayContext, - char **driver_name + char **driver_name, + int candidate_index ) { VADriverContextP ctx = pDisplayContext->pDriverContext; int direct_capable, driver_major, driver_minor, driver_patch; Bool result; + if (candidate_index != 0) + return VA_STATUS_ERROR_INVALID_PARAMETER; + result = VA_NVCTRLQueryDirectRenderingCapable(ctx->native_dpy, ctx->x11_screen, &direct_capable); if (!result || !direct_capable) @@ -112,13 +190,17 @@ static VAStatus va_NVCTRL_GetDriverName ( static VAStatus va_FGLRX_GetDriverName ( VADisplayContextP pDisplayContext, - char **driver_name + char **driver_name, + int candidate_index ) { VADriverContextP ctx = pDisplayContext->pDriverContext; int driver_major, driver_minor, driver_patch; Bool result; + if (candidate_index != 0) + return VA_STATUS_ERROR_INVALID_PARAMETER; + result = VA_FGLRXGetClientDriverName(ctx->native_dpy, ctx->x11_screen, &driver_major, &driver_minor, &driver_patch, driver_name); @@ -130,24 +212,43 @@ static VAStatus va_FGLRX_GetDriverName ( static VAStatus va_DisplayContextGetDriverName ( VADisplayContextP pDisplayContext, - char **driver_name + char **driver_name, int candidate_index ) { VAStatus vaStatus; if (driver_name) - *driver_name = NULL; + *driver_name = NULL; else return VA_STATUS_ERROR_UNKNOWN; - - vaStatus = va_DRI2GetDriverName(pDisplayContext, driver_name); + + vaStatus = va_DRI2_GetDriverName(pDisplayContext, driver_name, candidate_index); if (vaStatus != VA_STATUS_SUCCESS) - vaStatus = va_NVCTRL_GetDriverName(pDisplayContext, driver_name); + vaStatus = va_NVCTRL_GetDriverName(pDisplayContext, driver_name, candidate_index); if (vaStatus != VA_STATUS_SUCCESS) - vaStatus = va_FGLRX_GetDriverName(pDisplayContext, driver_name); + vaStatus = va_FGLRX_GetDriverName(pDisplayContext, driver_name, candidate_index); + return vaStatus; } +static VAStatus va_DisplayContextGetNumCandidates ( + VADisplayContextP pDisplayContext, + int *num_candidates +) +{ + VAStatus vaStatus; + + vaStatus = va_DRI2_GetNumCandidates(pDisplayContext, num_candidates); + + /* A call to va_DisplayContextGetDriverName will fallback to other + * methods (i.e. NVCTRL, FGLRX) when DRI2 is unsuccessful. All of those + * fallbacks only have 1 candidate driver. + */ + if (vaStatus != VA_STATUS_SUCCESS) + *num_candidates = 1; + + return VA_STATUS_SUCCESS; +} VADisplay vaGetDisplay ( Display *native_dpy /* implementation specific */ @@ -166,7 +267,8 @@ VADisplay vaGetDisplay ( pDisplayContext->vaIsValid = va_DisplayContextIsValid; pDisplayContext->vaDestroy = va_DisplayContextDestroy; - pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName; + pDisplayContext->vaGetNumCandidates = va_DisplayContextGetNumCandidates; + pDisplayContext->vaGetDriverNameByIndex = va_DisplayContextGetDriverName; pDriverContext = va_newDriverContext(pDisplayContext); if (!pDriverContext) { @@ -185,12 +287,14 @@ VADisplay vaGetDisplay ( return NULL; } + dri_state->base.fd = -1; + dri_state->base.auth_type = VA_NONE; + pDriverContext->drm_state = dri_state; return (VADisplay)pDisplayContext; } - void va_TracePutSurface ( VADisplay dpy, VASurfaceID surface, @@ -208,7 +312,6 @@ void va_TracePutSurface ( unsigned int flags /* de-interlacing flags */ ); - VAStatus vaPutSurface ( VADisplay dpy, VASurfaceID surface,