From 9c511355abea4330e3eaba603f2b2964396bc355 Mon Sep 17 00:00:00 2001 From: xiaominc Date: Mon, 3 Sep 2018 10:56:44 +0800 Subject: [PATCH 01/16] Add new BRC mode AVBR Average variable bitrate control algorithm focuses on overall encoding quality while meeting the specified target bitrate, within the accuracy range, after a convergence period. Change-Id: I048697bd4b40c571a22a551ae56578cc7512e39a Signed-off-by: xiaominc --- va/va.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/va/va.h b/va/va.h index a4e56ca..0f7431a 100644 --- a/va/va.h +++ b/va/va.h @@ -827,6 +827,16 @@ typedef struct _VAConfigAttrib { * and reuse quality_factor in \c VAEncMiscParameterRateControl * */ #define VA_RC_QVBR 0x00000400 +/** \brief Average VBR + * Average variable bitrate control algorithm focuses on overall encoding + * quality while meeting the specified target bitrate, within the accuracy + * range, after a convergence period. + * bits_per_second in VAEncMiscParameterRateControl is target bitrate for AVBR. + * Convergence is specified in the unit of frame. + * window_size in VAEncMiscParameterRateControl is equal to convergence for AVBR. + * Accuracy is in the range of [1,100], 1 means one percent, and so on. + * target_percentage in VAEncMiscParameterRateControl is equal to accuracy for AVBR. */ +#define VA_RC_AVBR 0x00000800 /**@}*/ -- 2.11.0 From 250b3dc8f370bc6d85be767c9722fd98e8b02ebb Mon Sep 17 00:00:00 2001 From: "Wang, Chengwei C" Date: Tue, 4 Sep 2018 11:53:15 +0800 Subject: [PATCH 02/16] Add max frame size parameters for multiple pass case in legacy mode Add new data structure and parameter buffer type for max frame size parameters in multiple pass case. Signed-off-by: Wang, Chengwei C --- va/va.h | 27 +++++++++++++++++++++++++++ va/va_trace.c | 12 ++++++++++++ 2 files changed, 39 insertions(+) diff --git a/va/va.h b/va/va.h index 0f7431a..217d60c 100644 --- a/va/va.h +++ b/va/va.h @@ -1748,6 +1748,8 @@ typedef enum VAEncMiscParameterTypeSkipFrame = 9, /** \brief Buffer type used for region-of-interest (ROI) parameters. */ VAEncMiscParameterTypeROI = 10, + /** \brief Buffer type used to express a maximum frame size (in bytes) settings for multiple pass. */ + VAEncMiscParameterTypeMultiPassFrameSize = 11, /** \brief Buffer type used for temporal layer structure */ VAEncMiscParameterTypeTemporalLayerStructure = 12, /** \brief Buffer type used for dirty region-of-interest (ROI) parameters. */ @@ -2116,6 +2118,31 @@ typedef struct _VAEncMiscParameterBufferMaxFrameSize { } VAEncMiscParameterBufferMaxFrameSize; /** + * \brief Maximum frame size (in bytes) settings for multiple pass. + * + * This misc parameter buffer defines the maximum size of a frame (in + * bytes) settings for multiple pass. currently only AVC encoder can + * support this settings in multiple pass case. If the frame size exceeds + * this size, the encoder will do more pak passes to adjust the QP value + * to control the frame size. + */ +typedef struct _VAEncMiscParameterBufferMultiPassFrameSize { + /** \brief Type. Shall be set to #VAEncMiscParameterTypeMultiPassMaxFrameSize. */ + VAEncMiscParameterType type; + /** \brief Maximum size of a frame (in byte) */ + uint32_t max_frame_size; + /** \brief Reserved bytes for future use, must be zero */ + uint32_t reserved; + /** \brief number of passes, every pass has different QP, currently AVC encoder can support up to 4 passes */ + uint8_t num_passes; + /** \brief delta QP list for every pass */ + uint8_t *delta_qp; + + /** \brief Reserved bytes for future use, must be zero */ + unsigned long va_reserved[VA_PADDING_LOW]; +} VAEncMiscParameterBufferMultiPassFrameSize; + +/** * \brief Encoding quality level. * * The encoding quality could be set through this structure, if the implementation diff --git a/va/va_trace.c b/va/va_trace.c index f0523ea..7c27b73 100644 --- a/va/va_trace.c +++ b/va/va_trace.c @@ -3241,6 +3241,18 @@ static void va_TraceVAEncMiscParameterBuffer( va_TraceMsg(trace_ctx, "\tmax_frame_size = %d\n", p->max_frame_size); break; } + case VAEncMiscParameterTypeMultiPassFrameSize: + { + int i; + VAEncMiscParameterBufferMultiPassFrameSize *p = (VAEncMiscParameterBufferMultiPassFrameSize *)tmp->data; + + va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterTypeMultiPassFrameSize\n"); + va_TraceMsg(trace_ctx, "\tmax_frame_size = %d\n", p->max_frame_size); + va_TraceMsg(trace_ctx, "\tnum_passes = %d\n", p->num_passes); + for(i = 0; inum_passes; ++i) + va_TraceMsg(trace_ctx, "\tdelta_qp[%d] = %d\n", i, p->delta_qp[i]); + break; + } case VAEncMiscParameterTypeQualityLevel: { VAEncMiscParameterBufferQualityLevel *p = (VAEncMiscParameterBufferQualityLevel *)tmp->data; -- 2.11.0 From f0dfe5e762e7f4bc4755f01d83aadde0f53290d5 Mon Sep 17 00:00:00 2001 From: XinfengZhang Date: Sat, 29 Sep 2018 21:46:55 +0800 Subject: [PATCH 03/16] libva 2.3.0 pre1 Bump VA-API version to 1.3.0 pre1 and libva to 2.3.0 Signed-off-by: XinfengZhang --- NEWS | 13 ++++++++++++- configure.ac | 4 ++-- meson.build | 4 ++-- va/va.c | 1 + 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 411e353..e22d4c8 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,17 @@ -libva NEWS -- summary of user visible changes. 2018-07-xx +libva NEWS -- summary of user visible changes. 2018-09-30 Copyright (C) 2009-2018 Intel Corporation +version 2.3.0 - 30.Sep.2018 +* Bump VA-API version to 1.3.0 and libva to 2.3.0 +250b3dc Add max frame size parameters for multiple pass case in legacy mode +9c51135 Add new BRC mode AVBR +30c751f Add new interface for High Dynamic Range tone mapping +b6c50da Add missing enum to string conversions +dd20f1c Add hevc subsets parameters structure +b7a2ff1 Add Customized Noise Reduction (HVS) interfaces +6ae7173 Add new BRC mode definition QVBR +2ff28a1 Add more complete colour properties for use in VPP + Version 2.2.0 - DD.July.2018 * Bump VA-API version to 1.2.0 and libva to 2.2.0 * Add support for hevc range extension decoding diff --git a/configure.ac b/configure.ac index da1908c..18d7b05 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], [2]) +m4_define([va_api_minor_version], [3]) m4_define([va_api_micro_version], [0]) m4_define([va_api_version], @@ -42,7 +42,7 @@ m4_define([va_api_version], # - reset micro version to zero when VA-API major or minor version is changed m4_define([libva_major_version], [m4_eval(va_api_major_version + 1)]) m4_define([libva_minor_version], [m4_eval(va_api_minor_version)]) -m4_define([libva_micro_version], [1]) +m4_define([libva_micro_version], [0]) m4_define([libva_pre_version], [1]) m4_define([libva_version], diff --git a/meson.build b/meson.build index 2ff6d9f..074ea2e 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.2.1.1', + version : '2.3.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 = 2 +va_api_minor_version = 3 va_api_micro_version = 0 va_api_version = '@0@.@1@.@2@'.format(va_api_major_version, diff --git a/va/va.c b/va/va.c index a6a58aa..4d3f628 100644 --- a/va/va.c +++ b/va/va.c @@ -402,6 +402,7 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name) int minor; } compatible_versions[] = { { VA_MAJOR_VERSION, VA_MINOR_VERSION }, + { VA_MAJOR_VERSION, 2 }, { VA_MAJOR_VERSION, 1 }, { VA_MAJOR_VERSION, 0 }, { -1, } -- 2.11.0 From 285267586a3d4db0e721d30d4a5f5f9fe6a3c913 Mon Sep 17 00:00:00 2001 From: XinfengZhang Date: Tue, 23 Oct 2018 05:09:09 +0800 Subject: [PATCH 04/16] libva 2.4.0 pre1 Bump VA-API version to 1.4.0 pre1 and libva to 2.4.0 pre1 Signed-off-by: XinfengZhang --- configure.ac | 2 +- meson.build | 4 ++-- va/va.c | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 18d7b05..535b5b1 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], [3]) +m4_define([va_api_minor_version], [4]) m4_define([va_api_micro_version], [0]) m4_define([va_api_version], diff --git a/meson.build b/meson.build index 074ea2e..0593e86 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.3.0.1', + version : '2.4.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 = 3 +va_api_minor_version = 4 va_api_micro_version = 0 va_api_version = '@0@.@1@.@2@'.format(va_api_major_version, diff --git a/va/va.c b/va/va.c index 4d3f628..774129c 100644 --- a/va/va.c +++ b/va/va.c @@ -402,6 +402,7 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name) int minor; } compatible_versions[] = { { VA_MAJOR_VERSION, VA_MINOR_VERSION }, + { VA_MAJOR_VERSION, 3 }, { VA_MAJOR_VERSION, 2 }, { VA_MAJOR_VERSION, 1 }, { VA_MAJOR_VERSION, 0 }, -- 2.11.0 From b7203fe3b1fa633cece9cd9e5715b6477a708455 Mon Sep 17 00:00:00 2001 From: Mark Thompson Date: Tue, 13 Nov 2018 23:56:13 +0000 Subject: [PATCH 05/16] Remove restrictions on vaSetDriverName() The UID restriction has no effect, since any code capable of calling vaSetDriverName() can also edit the internals of the structure itself. (This check was inherited from the environment variable setting, where it does do something.) The name whitelist prevents loading drivers not currently named on the list, such as the Mesa and V4L2-request drivers. I don't believe there is any reason to prevent loading another driver, and it is already possible via the LIBVA_DRIVER_NAME environment variable. Signed-off-by: Mark Thompson --- va/va.c | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/va/va.c b/va/va.c index 774129c..7801508 100644 --- a/va/va.c +++ b/va/va.c @@ -605,13 +605,6 @@ const char *vaErrorStr(VAStatus error_status) return "unknown libva error / description missing"; } -const static char *prefer_driver_list[4] = { - "i965", - "hybrid", - "pvr", - "iHD", -}; - VAStatus vaSetDriverName( VADisplay dpy, char *driver_name @@ -620,15 +613,8 @@ VAStatus vaSetDriverName( VADriverContextP ctx; VAStatus vaStatus = VA_STATUS_SUCCESS; char *override_driver_name = NULL; - int i, found; ctx = CTX(dpy); - if (geteuid() != getuid()) { - vaStatus = VA_STATUS_ERROR_OPERATION_FAILED; - va_errorMessage(dpy, "no permission to vaSetDriverName\n"); - return vaStatus; - } - if (strlen(driver_name) == 0 || strlen(driver_name) >=256) { vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER; va_errorMessage(dpy, "vaSetDriverName returns %s\n", @@ -636,25 +622,7 @@ VAStatus vaSetDriverName( return vaStatus; } - found = 0; - for (i = 0; i < sizeof(prefer_driver_list) / sizeof(char *); i++) { - if (strlen(prefer_driver_list[i]) != strlen(driver_name)) - continue; - if (!strncmp(prefer_driver_list[i], driver_name, strlen(driver_name))) { - found = 1; - break; - } - } - - if (!found) { - vaStatus = VA_STATUS_ERROR_INVALID_PARAMETER; - va_errorMessage(dpy, "vaSetDriverName returns %s. Incorrect parameter\n", - vaErrorStr(vaStatus)); - return vaStatus; - } - override_driver_name = strdup(driver_name); - if (!override_driver_name) { vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED; va_errorMessage(dpy, "vaSetDriverName returns %s. Out of Memory\n", -- 2.11.0 From cf11abe5e1b9c93ee75cf974076957162c1605b9 Mon Sep 17 00:00:00 2001 From: furongzh Date: Tue, 13 Nov 2018 19:37:55 +0800 Subject: [PATCH 06/16] High Dynamic Range Tone Mapping: Add a new filter for input metadata and some comments. 1. Add comments for HDR10 metadata, it can be used to describe the content which was authoured and the display which will be presented; 2. Add a new filter for metadata, mainly for input surface; Signed-off-by: furongzh --- va/va_vpp.h | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/va/va_vpp.h b/va/va_vpp.h index db1db14..673ddc7 100755 --- a/va/va_vpp.h +++ b/va/va_vpp.h @@ -436,7 +436,9 @@ typedef enum _VAProcTotalColorCorrectionType { typedef enum _VAProcHighDynamicRangeMetadataType { VAProcHighDynamicRangeMetadataNone = 0, /** \brief Metadata type for HDR10. */ - VAProcHighDynamicRangeMetadataHDR10 + VAProcHighDynamicRangeMetadataHDR10, + /** \brief Number of Metadata type. */ + VAProcHighDynamicRangeMetadataTypeCount } VAProcHighDynamicRangeMetadataType; /** \brief Video Processing Mode. */ @@ -703,7 +705,20 @@ typedef struct _VAProcColorProperties { uint8_t reserved[3]; } VAProcColorProperties; -/** \berief Describes High Dynamic Range Meta Data for HDR10. */ +/** \berief Describes High Dynamic Range Meta Data for HDR10. + * + * Specifies the colour volume(the colour primaries, white point and luminance range) of + * a display considered to be the mastering display for the associated video content -e.g., + * the colour volume of a display that was used for viewing while authoring the video content. + * See ITU-T H.265 D.3.27 Mastering display colour volume SEI message semantics. + * + * Specifies upper bounds for the nominal light level of the content. See ITU-T H.265 D.3.35 + * Content light level information SEI message semantics. + * + * This structure can be used to indicate the HDR10 metadata for 1) the content which was authored; + * 2) the display on which the content will be presented. If it is for display, max_content_light_level + * and max_pic_average_light_level are ignored. + */ typedef struct _VAHdrMetaDataHDR10 { /** @@ -1217,6 +1232,22 @@ typedef struct _VAProcFilterParameterBufferHVSNoiseReduction { uint16_t va_reserved[VA_PADDING_HIGH]; } VAProcFilterParameterBufferHVSNoiseReduction; +/** \brief High Dynamic Range(HDR) Tone Mapping filter parametrization. */ +typedef struct _VAProcFilterParameterBufferHDRToneMapping { + /** \brief Filter type. Shall be set to #VAProcFilterHighDynamicRangeToneMapping.*/ + VAProcFilterType type; + /** + * \brief High Dynamic Range metadata, could be HDR10 etc. + * + * This metadata is mainly for the input surface. Given that dynamic metadata is changing + * on frame-by-frame or scene-by-scene basis for HDR10 plus, differentiate the metadata + * for the input and output. + */ + VAHdrMetaData data; + /** \brief Reserved bytes for future use, must be zero */ + uint32_t va_reserved[VA_PADDING_HIGH]; +} VAProcFilterParameterBufferHDRToneMapping; + /** * \brief Default filter cap specification (single range value). * -- 2.11.0 From ef5447c9d75a662393e593757a43bd09baaea168 Mon Sep 17 00:00:00 2001 From: Xu Guangxin Date: Thu, 6 Sep 2018 16:17:19 +0800 Subject: [PATCH 07/16] android: replace utils/Log.h with log/log.h utils/Log.h and ctuils/Log.h replaced by log/log.h on android Change-Id: Icd26ca44cdf7079f43738cd38a511953aaae78c8 --- va/Android.mk | 2 +- va/sysdeps.h | 2 +- va/va.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/va/Android.mk b/va/Android.mk index 22f80c8..b37a3a3 100644 --- a/va/Android.mk +++ b/va/Android.mk @@ -92,6 +92,6 @@ LOCAL_MODULE_TAGS := optional LOCAL_MODULE := libva-android LOCAL_PROPRIETARY_MODULE := true -LOCAL_SHARED_LIBRARIES := libva libdrm +LOCAL_SHARED_LIBRARIES := libva libdrm liblog include $(BUILD_SHARED_LIBRARY) diff --git a/va/sysdeps.h b/va/sysdeps.h index 164a274..d7ee850 100644 --- a/va/sysdeps.h +++ b/va/sysdeps.h @@ -45,7 +45,7 @@ # define LIBVA_VERSION_S "1.1.0" /* Android logging utilities */ -# include +# include #endif #if defined __GNUC__ && defined HAVE_GNUC_VISIBILITY_ATTRIBUTE diff --git a/va/va.c b/va/va.c index 7801508..56fa4da 100644 --- a/va/va.c +++ b/va/va.c @@ -39,7 +39,7 @@ #include #include #ifdef ANDROID -#include +#include /* support versions < JellyBean */ #ifndef ALOGE #define ALOGE LOGE -- 2.11.0 From f48f213c58d119f125ddc48b55166fc13acb4b7c Mon Sep 17 00:00:00 2001 From: Xu Guangxin Date: Thu, 6 Sep 2018 16:25:05 +0800 Subject: [PATCH 08/16] compile: fix sign/unsign compare in va_trace.c Change-Id: I8d38a37dc6a8a1bf190f206ce61f3b26e2f4e887 --- va/va_trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/va/va_trace.c b/va/va_trace.c index 7c27b73..c266afd 100644 --- a/va/va_trace.c +++ b/va/va_trace.c @@ -185,7 +185,7 @@ struct va_trace { #define DPY2TRACECTX(dpy, context, buf_id) \ struct va_trace *pva_trace = NULL; \ struct trace_context *trace_ctx = NULL; \ - int ctx_id = context; \ + VAContextID ctx_id = context; \ \ pva_trace = (struct va_trace *)(((VADisplayContextP)dpy)->vatrace); \ if(!pva_trace) \ -- 2.11.0 From 566a1388b4e5961fb73d0fd03058d50c5965a7f4 Mon Sep 17 00:00:00 2001 From: Xu Guangxin Date: Thu, 6 Sep 2018 16:31:11 +0800 Subject: [PATCH 09/16] android: ignore unimportant compile warnnings Change-Id: Iae80206787fe2d5a35a9d87171db315763249d86 --- va/Android.mk | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/va/Android.mk b/va/Android.mk index b37a3a3..0066558 100644 --- a/va/Android.mk +++ b/va/Android.mk @@ -31,7 +31,12 @@ LIBVA_DRIVERS_PATH_64 := /vendor/lib64/dri include $(CLEAR_VARS) #LIBVA_MINOR_VERSION := 31 -#LIBVA_MAJOR_VERSION := 0 +#LIBVA_MAJOR_VERSION := 0 + +IGNORED_WARNNING = \ + -Wno-sign-compare \ + -Wno-missing-field-initializers \ + -Wno-unused-parameter \ LOCAL_SRC_FILES := \ va.c \ @@ -46,6 +51,7 @@ LOCAL_CFLAGS_64 += \ -DVA_DRIVERS_PATH="\"$(LIBVA_DRIVERS_PATH_64)\"" \ LOCAL_CFLAGS := \ + $(IGNORED_WARNNING) \ $(if $(filter user,$(TARGET_BUILD_VARIANT)),,-DENABLE_VA_MESSAGING) \ -DLOG_TAG=\"libva\" @@ -83,7 +89,8 @@ LOCAL_SRC_FILES := \ drm/va_drm_utils.c LOCAL_CFLAGS += \ - -DLOG_TAG=\"libva-android\" + -DLOG_TAG=\"libva-android\" \ + $(IGNORED_WARNNING) LOCAL_C_INCLUDES += \ $(LOCAL_PATH)/drm -- 2.11.0 From f2ddc03d0b8f6ba3bb143a086687f1ad386046c6 Mon Sep 17 00:00:00 2001 From: Mark Thompson Date: Fri, 17 Aug 2018 00:10:33 +0100 Subject: [PATCH 10/16] Allow import of the DRM PRIME 2 memory type This adds support for import using the VADRMPRIMESurfaceDescriptor structure, which enables use of format modifiers (required for some compressed surfaces). Signed-off-by: Mark Thompson --- va/va.h | 7 ++++++- va/va_drmcommon.h | 19 +++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/va/va.h b/va/va.h index 217d60c..7a96141 100644 --- a/va/va.h +++ b/va/va.h @@ -1260,7 +1260,12 @@ typedef enum { VASurfaceAttribMaxHeight, /** \brief Surface memory type expressed in bit fields (int, read/write). */ VASurfaceAttribMemoryType, - /** \brief External buffer descriptor (pointer, write). */ + /** \brief External buffer descriptor (pointer, write). + * + * Refer to the documentation for the memory type being created to + * determine what descriptor structure to pass here. If not otherwise + * stated, the common VASurfaceAttribExternalBuffers should be used. + */ VASurfaceAttribExternalBufferDescriptor, /** \brief Surface usage hint, gives the driver a hint of intended usage * to optimize allocation (e.g. tiling) (int, read/write). */ diff --git a/va/va_drmcommon.h b/va/va_drmcommon.h index a608bd6..f51b6ba 100644 --- a/va/va_drmcommon.h +++ b/va/va_drmcommon.h @@ -90,8 +90,6 @@ struct drm_state { /** * \brief External buffer descriptor for a DRM PRIME surface. * - * This can currently only be used for export. - * * For export, call vaExportSurfaceHandle() with mem_type set to * VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 and pass a pointer to an * instance of this structure to fill. @@ -101,6 +99,23 @@ struct drm_state { * one of DRM_FORMAT_GR88. * If VA_EXPORT_SURFACE_COMPOSED_LAYERS is specified on export, * there will be exactly one layer. + * + * For import, call vaCreateSurfaces() with the MemoryType attribute + * set to VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 and the + * ExternalBufferDescriptor attribute set to point to an array of + * num_surfaces instances of this structure. + * The number of planes which need to be provided for a given layer + * is dependent on both the format and the format modifier used for + * the objects containing it. For example, the format DRM_FORMAT_RGBA + * normally requires one plane, but with the format modifier + * I915_FORMAT_MOD_Y_TILED_CCS it requires two planes - the first + * being the main data plane and the second containing the color + * control surface. + * Note that a given driver may only support a subset of possible + * representations of a particular format. For example, it may only + * support NV12 surfaces when they are contained within a single DRM + * object, and therefore fail to create such surfaces if the two + * planes are in different DRM objects. */ typedef struct _VADRMPRIMESurfaceDescriptor { /** Pixel format fourcc of the whole surface (VA_FOURCC_*). */ -- 2.11.0 From f804f0ec3a9c06065ec194c0d888039a6083e6c1 Mon Sep 17 00:00:00 2001 From: Badiuzzaman Iskhandar Date: Wed, 12 Sep 2018 13:13:22 +0800 Subject: [PATCH 11/16] Fix compilation warning (uninit and wrong variable types) for Android O MR1 Signed-off-by: Badiuzzaman Iskhandar --- va/drm/va_drm_utils.c | 2 +- va/va.c | 4 ++-- va/va_fool.c | 4 ++-- va/va_trace.c | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) mode change 100644 => 100755 va/va_trace.c diff --git a/va/drm/va_drm_utils.c b/va/drm/va_drm_utils.c index 9510dd9..0fe1a35 100644 --- a/va/drm/va_drm_utils.c +++ b/va/drm/va_drm_utils.c @@ -44,7 +44,7 @@ static const struct driver_name_map g_driver_name_map[] = { { "nouveau", 7, "nouveau" }, // Mesa Gallium driver { "radeon", 6, "r600" }, // Mesa Gallium driver { "amdgpu", 6, "radeonsi" }, // Mesa Gallium driver - { NULL, } + { NULL, 0, NULL } }; /* Returns the VA driver name for the active display */ diff --git a/va/va.c b/va/va.c index 56fa4da..28ebe59 100644 --- a/va/va.c +++ b/va/va.c @@ -406,7 +406,7 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name) { VA_MAJOR_VERSION, 2 }, { VA_MAJOR_VERSION, 1 }, { VA_MAJOR_VERSION, 0 }, - { -1, } + { -1, -1} }; for (i = 0; compatible_versions[i].major >= 0; i++) { @@ -943,7 +943,7 @@ va_impl_query_surface_attributes( { VASurfaceAttribMinHeight, VAGenericValueTypeInteger }, { VASurfaceAttribMaxHeight, VAGenericValueTypeInteger }, { VASurfaceAttribMemoryType, VAGenericValueTypeInteger }, - { VASurfaceAttribNone, } + { VASurfaceAttribNone, VAGenericValueTypeInteger } }; if (!out_attribs || !out_num_attribs_ptr) diff --git a/va/va_fool.c b/va/va_fool.c index 9281129..e2729cc 100644 --- a/va/va_fool.c +++ b/va/va_fool.c @@ -265,7 +265,7 @@ VAStatus va_FoolBufferInfo( static int va_FoolFillCodedBufEnc(VADisplay dpy, struct fool_context *fool_ctx) { char file_name[1024]; - struct stat file_stat = {0}; + struct stat file_stat = {}; VACodedBufferSegment *codedbuf; int i, fd = -1; ssize_t ret; @@ -311,7 +311,7 @@ static int va_FoolFillCodedBufEnc(VADisplay dpy, struct fool_context *fool_ctx) static int va_FoolFillCodedBufJPG(VADisplay dpy, struct fool_context *fool_ctx) { - struct stat file_stat = {0}; + struct stat file_stat = {}; VACodedBufferSegment *codedbuf; int fd = -1; ssize_t ret; diff --git a/va/va_trace.c b/va/va_trace.c old mode 100644 new mode 100755 index c266afd..ff39c8f --- a/va/va_trace.c +++ b/va/va_trace.c @@ -1134,7 +1134,7 @@ static void va_TraceSurfaceAttributes( va_TraceMsg(trace_ctx, "\t\tvalue.value.p = %p\n", p->value.value.p); if ((p->type == VASurfaceAttribExternalBufferDescriptor) && p->value.value.p) { VASurfaceAttribExternalBuffers *tmp = (VASurfaceAttribExternalBuffers *) p->value.value.p; - int j; + uint32_t j; va_TraceMsg(trace_ctx, "\t\t--VASurfaceAttribExternalBufferDescriptor\n"); va_TraceMsg(trace_ctx, "\t\t pixel_format=0x%08x\n", tmp->pixel_format); @@ -4629,7 +4629,7 @@ va_TraceProcFilterParameterBuffer( unsigned int size; unsigned int num_elements; VAProcFilterParameterBufferBase *base_filter = NULL; - int i; + unsigned int i; DPY2TRACECTX(dpy, context, VA_INVALID_ID); @@ -4694,7 +4694,7 @@ va_TraceVAProcPipelineParameterBuffer( ) { VAProcPipelineParameterBuffer *p = (VAProcPipelineParameterBuffer *)data; - int i; + uint32_t i; DPY2TRACECTX(dpy, context, VA_INVALID_ID); -- 2.11.0 From 8e890e3a0a5c91ba921d9fbedc532c596ff46dd1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Fri, 13 Jul 2018 14:07:49 +0200 Subject: [PATCH 12/16] av: avoid driver path truncation Using strncat() and strncpy() may lead to string truncation, which might generate other issues. This patch replaces the usage of strncat() and strncpy() to generate the driver path, with snprintf() safetly. See more information here: https://developers.redhat.com/blog/2018/05/24/detecting-string-truncation-with-gcc-8/ --- va/va.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/va/va.c b/va/va.c index 28ebe59..a950c6a 100644 --- a/va/va.c +++ b/va/va.c @@ -349,6 +349,23 @@ static VAStatus va_getDriverName(VADisplay dpy, char **driver_name) return pDisplayContext->vaGetDriverName(pDisplayContext, driver_name); } +static char *va_getDriverPath(const char *driver_dir, const char *driver_name) +{ + int n = snprintf(0, 0, "%s/%s%s", driver_dir, driver_name, DRIVER_EXTENSION); + if (n < 0) + return NULL; + char *driver_path = (char *) malloc(n + 1); + if (!driver_path) + return NULL; + n = snprintf(driver_path, n + 1, "%s/%s%s", + driver_dir, driver_name, DRIVER_EXTENSION); + if (n < 0) { + free(driver_path); + return NULL; + } + return driver_path; +} + static VAStatus va_openDriver(VADisplay dpy, char *driver_name) { VADriverContextP ctx = CTX(dpy); @@ -367,9 +384,7 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name) driver_dir = strtok_r(search_path, ":", &saveptr); while (driver_dir) { void *handle = NULL; - char *driver_path = (char *) malloc( strlen(driver_dir) + - strlen(driver_name) + - strlen(DRIVER_EXTENSION) + 2 ); + char *driver_path = va_getDriverPath(driver_dir, driver_name); if (!driver_path) { va_errorMessage(dpy, "%s L%d Out of memory!n", __FUNCTION__, __LINE__); @@ -377,11 +392,6 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name) return VA_STATUS_ERROR_ALLOCATION_FAILED; } - strncpy( driver_path, driver_dir, strlen(driver_dir) + 1); - strncat( driver_path, "/", strlen("/") ); - strncat( driver_path, driver_name, strlen(driver_name) ); - strncat( driver_path, DRIVER_EXTENSION, strlen(DRIVER_EXTENSION) ); - va_infoMessage(dpy, "Trying to open %s\n", driver_path); #ifndef ANDROID handle = dlopen( driver_path, RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE ); -- 2.11.0 From e4cd982197a4f0131a6a5a43dd83f69f0a724db7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Fri, 13 Jul 2018 14:14:48 +0200 Subject: [PATCH 13/16] va: fix new line symbol in error message --- va/va.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/va/va.c b/va/va.c index a950c6a..306984f 100644 --- a/va/va.c +++ b/va/va.c @@ -386,7 +386,7 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name) void *handle = NULL; char *driver_path = va_getDriverPath(driver_dir, driver_name); if (!driver_path) { - va_errorMessage(dpy, "%s L%d Out of memory!n", + va_errorMessage(dpy, "%s L%d Out of memory\n", __FUNCTION__, __LINE__); free(search_path); return VA_STATUS_ERROR_ALLOCATION_FAILED; -- 2.11.0 From 62bad1239d8ea1bb269ca69d3469aa267f57cdec Mon Sep 17 00:00:00 2001 From: Haihao Xiang Date: Fri, 7 Dec 2018 13:25:41 +0800 Subject: [PATCH 14/16] Add pointer to struct wl_interface for driver to use See https://github.com/intel/intel-vaapi-driver/issues/419 for the information Note: don't export the interface symbol in case others may reuse it. Signed-off-by: Haihao Xiang --- va/wayland/va_backend_wayland.h | 10 +++++++++- va/wayland/va_wayland_drm.c | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/va/wayland/va_backend_wayland.h b/va/wayland/va_backend_wayland.h index 9e5740a..906d4bf 100644 --- a/va/wayland/va_backend_wayland.h +++ b/va/wayland/va_backend_wayland.h @@ -64,8 +64,16 @@ struct VADriverVTableWayland { /** \brief Indicate whether buffer sharing with prime fd is supported. */ unsigned int has_prime_sharing; + /** + * Pointer to an implementation of struct wl_interface + * + * It is set by libva-wayland when a context is created, then the backend + * driver may reuse it. + */ + const void *wl_interface; + /** \brief Reserved bytes for future use, must be zero */ - unsigned long reserved[8]; + unsigned long reserved[7]; }; #endif /* VA_BACKEND_WAYLAND_H */ diff --git a/va/wayland/va_wayland_drm.c b/va/wayland/va_wayland_drm.c index 8e22695..4cd3f6c 100644 --- a/va/wayland/va_wayland_drm.c +++ b/va/wayland/va_wayland_drm.c @@ -136,6 +136,7 @@ va_wayland_drm_destroy(VADisplayContextP pDisplayContext) struct VADriverVTableWayland *vtable = ctx->vtable_wayland; vtable->has_prime_sharing = 0; + vtable->wl_interface = NULL; wl_drm_ctx->is_authenticated = 0; @@ -222,6 +223,8 @@ va_wayland_drm_create(VADisplayContextP pDisplayContext) struct VADriverVTableWayland *vtable = ctx->vtable_wayland; struct wl_display *wrapped_display = NULL; + vtable->wl_interface = NULL; + wl_drm_ctx = malloc(sizeof(*wl_drm_ctx)); if (!wl_drm_ctx) { va_wayland_error("could not allocate wl_drm_ctx"); @@ -300,6 +303,7 @@ va_wayland_drm_create(VADisplayContextP pDisplayContext) goto end; } + vtable->wl_interface = &wl_drm_interface; result = true; end: -- 2.11.0 From 382acf177ce18c069e0293408afa34c5875296ff Mon Sep 17 00:00:00 2001 From: Linjie Fu Date: Mon, 17 Dec 2018 08:51:13 +0800 Subject: [PATCH 15/16] va/va_trace: add va_TraceSurface support for VA_FOURCC_P010 Add va_TraceSurface support for VA_FOURCC_P010. Currently, va_TraceSurface could only support nv12. Add pixel_byte to indicate the bytes per pixel according to FOURCC. Signed-off-by: Linjie Fu --- va/va_trace.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/va/va_trace.c b/va/va_trace.c index ff39c8f..7a714a5 100755 --- a/va/va_trace.c +++ b/va/va_trace.c @@ -955,6 +955,7 @@ static void va_TraceSurface(VADisplay dpy, VAContextID context) unsigned int buffer_name; void *buffer = NULL; unsigned char *Y_data, *UV_data, *tmp; + unsigned int pixel_byte; VAStatus va_status; DPY2TRACECTX(dpy, context, VA_INVALID_ID); @@ -1001,20 +1002,27 @@ static void va_TraceSurface(VADisplay dpy, VAContextID context) Y_data = (unsigned char*)buffer; UV_data = (unsigned char*)buffer + chroma_u_offset; + if (fourcc == VA_FOURCC_P010) + pixel_byte = 2; + else + pixel_byte = 1; + tmp = Y_data + luma_stride * trace_ctx->trace_surface_yoff; + for (i=0; itrace_surface_height; i++) { fwrite(tmp + trace_ctx->trace_surface_xoff, trace_ctx->trace_surface_width, - 1, trace_ctx->trace_fp_surface); + pixel_byte, trace_ctx->trace_fp_surface); tmp += luma_stride; } + tmp = UV_data + chroma_u_stride * trace_ctx->trace_surface_yoff / 2; - if (fourcc == VA_FOURCC_NV12) { + if (fourcc == VA_FOURCC_NV12 || fourcc == VA_FOURCC_P010) { for (i=0; itrace_surface_height/2; i++) { fwrite(tmp + trace_ctx->trace_surface_xoff, trace_ctx->trace_surface_width, - 1, trace_ctx->trace_fp_surface); + pixel_byte, trace_ctx->trace_fp_surface); tmp += chroma_u_stride; } -- 2.11.0 From 0dc70068e49f9538fbd03f2f0aa1e56a91e986e7 Mon Sep 17 00:00:00 2001 From: intel Date: Fri, 25 Jan 2019 13:35:29 -0500 Subject: [PATCH 16/16] update NEWS for libva 2.4.0 libva 2.4.0 will be branch from this commit master version will be bumped to 2.5.0.pre1 Signed-off-by: intel --- NEWS | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/NEWS b/NEWS index e22d4c8..1d1f67e 100644 --- a/NEWS +++ b/NEWS @@ -1,18 +1,31 @@ -libva NEWS -- summary of user visible changes. 2018-09-30 -Copyright (C) 2009-2018 Intel Corporation +libva NEWS -- summary of user visible changes. 2019-01-25 +Copyright (C) 2009-2019 Intel Corporation + +version 2.4.0 - 25.Jan.2019 +* va_TraceSurface support for VA_FOURCC_P010 +* Add pointer to struct wl_interface for driver to use +* (integrate) va: fix new line symbol in error message +* av: avoid driver path truncation +* Fix compilation warning (uninit and wrong variable types) for Android O MR1 +* Allow import of the DRM PRIME 2 memory type +* android: ignore unimportant compile warnnings +* compile: fix sign/unsign compare in va_trace.c +* android: replace utils/Log.h with log/log.h +* High Dynamic Range Tone Mapping: Add a new filter for input metadata and some comments. +* Remove restrictions on vaSetDriverName() version 2.3.0 - 30.Sep.2018 * Bump VA-API version to 1.3.0 and libva to 2.3.0 -250b3dc Add max frame size parameters for multiple pass case in legacy mode -9c51135 Add new BRC mode AVBR -30c751f Add new interface for High Dynamic Range tone mapping -b6c50da Add missing enum to string conversions -dd20f1c Add hevc subsets parameters structure -b7a2ff1 Add Customized Noise Reduction (HVS) interfaces -6ae7173 Add new BRC mode definition QVBR -2ff28a1 Add more complete colour properties for use in VPP - -Version 2.2.0 - DD.July.2018 +* Add max frame size parameters for multiple pass case in legacy mode +* Add new BRC mode AVBR +* Add new interface for High Dynamic Range tone mapping +* Add missing enum to string conversions +* Add hevc subsets parameters structure +* Add Customized Noise Reduction (HVS) interfaces +* Add new BRC mode definition QVBR +* Add more complete colour properties for use in VPP + +Version 2.2.0 - 12.July.2018 * Bump VA-API version to 1.2.0 and libva to 2.2.0 * Add support for hevc range extension decoding * Add support for fast intra prediction in HEVC FEI -- 2.11.0