diff -Nru libva-2.14.0/configure.ac libva-2.15.0/configure.ac --- libva-2.14.0/configure.ac 2022-02-16 15:26:40.000000000 +0000 +++ libva-2.15.0/configure.ac 2022-06-28 12:39:46.000000000 +0000 @@ -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], [14]) +m4_define([va_api_minor_version], [15]) m4_define([va_api_micro_version], [0]) m4_define([va_api_version], @@ -214,21 +214,46 @@ AC_MSG_ERROR([unable to find the dlopen() function]) ]) -# Check for -fstack-protector -ssp_cc=yes +# Check for -fstack-protector and -fstack-protector-strong +SSP_CC_FLAG="" if test "X$CC-cc" != "X"; then - AC_MSG_CHECKING([whether ${CC-cc} accepts -fstack-protector]) + # Do not duplicate options in CFLAGS + ssp_sp_set=no + ssp_sps_set=no + for ssp_x in $CFLAGS; do + case "X$ssp_x" in + X-fstack-protector) ssp_sp_set=yes ;; + X-fstack-protector-strong) ssp_sps_set=yes ;; + esac + done ssp_old_cflags="$CFLAGS" - CFLAGS="$CFLAGS -fstack-protector" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[alloca(100);]])], [], [ssp_cc=no]) + # Prefer -fstack-protector-strong over -fstack-protector + if test "X$ssp_sps_set" = "Xno"; then + SSP_CC_FLAG="-fstack-protector-strong" + fi + AC_MSG_CHECKING([whether ${CC-cc} accepts -fstack-protector-strong]) + CFLAGS="$ssp_old_cflags $SSP_CC_FLAG" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[alloca(100);]])], [ssp_cc=yes], [ssp_cc=no]) AC_MSG_RESULT([$ssp_cc]) if test "X$ssp_cc" = "Xno"; then - CFLAGS="$ssp_old_cflags" - else + # Fallback to -fstack-protector + if test "X$ssp_sp_set" = "Xno"; then + SSP_CC_FLAG="-fstack-protector" + fi + AC_MSG_CHECKING([whether ${CC-cc} accepts -fstack-protector]) + CFLAGS="$ssp_old_cflags $SSP_CC_FLAG" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[alloca(100);]])], [ssp_cc=yes], [ssp_cc=no]) + AC_MSG_RESULT([$ssp_cc]) + if test "X$ssp_cc" = "Xno"; then + SSP_CC_FLAG="" + fi + fi + CFLAGS="$ssp_old_cflags $SSP_CC_FLAG" + if test "X$ssp_cc" = "Xyes"; then AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.]) fi fi -AM_CONDITIONAL(USE_SSP, test "$ssp_cc" = "yes") +AC_SUBST(SSP_CC_FLAG) # Check for DRM (mandatory) LIBDRM_VERSION=libdrm_version diff -Nru libva-2.14.0/debian/changelog libva-2.15.0/debian/changelog --- libva-2.14.0/debian/changelog 2022-02-22 23:20:39.000000000 +0000 +++ libva-2.15.0/debian/changelog 2022-07-06 18:23:19.000000000 +0000 @@ -1,3 +1,21 @@ +libva (2.15.0-1~bpo22.04.1~ppa1) jammy; urgency=medium + + * No-change backport to jammy. + + -- Nico Onorata Wed, 06 Jul 2022 20:23:19 +0200 + +libva (2.15.0-1) unstable; urgency=medium + + * New upstream version 2.15.0 + * debian/control: + - Bump Standards-Version + - Add Provides for new driver ABI + * debian/libva-x11-2.symbols: Add new symbols + * debian/libva2.symbols: Remove va_fool symbols + They are not used by any reverse dependency in the archive. + + -- Sebastian Ramacher Tue, 05 Jul 2022 23:56:04 +0200 + libva (2.14.0-1) unstable; urgency=medium [ Debian Janitor ] diff -Nru libva-2.14.0/debian/control libva-2.15.0/debian/control --- libva-2.14.0/debian/control 2022-02-22 23:18:00.000000000 +0000 +++ libva-2.15.0/debian/control 2022-07-05 21:51:42.000000000 +0000 @@ -15,7 +15,7 @@ libxfixes-dev, pkg-config, perl:any -Standards-Version: 4.6.0 +Standards-Version: 4.6.1 Homepage: https://01.org/linuxmedia/vaapi Vcs-Git: https://salsa.debian.org/multimedia-team/libva.git Vcs-Browser: https://salsa.debian.org/multimedia-team/libva @@ -71,7 +71,8 @@ libva-driver-abi-1.11, libva-driver-abi-1.12, libva-driver-abi-1.13, - libva-driver-abi-1.14 + libva-driver-abi-1.14, + libva-driver-abi-1.15, Description: Video Acceleration (VA) API for Linux -- runtime Video Acceleration API (VA API) is a library ("libVA") and API specification which enables and provides access to graphics hardware (GPU) acceleration for diff -Nru libva-2.14.0/debian/libva2.symbols libva-2.15.0/debian/libva2.symbols --- libva-2.14.0/debian/libva2.symbols 2021-03-25 21:06:20.000000000 +0000 +++ libva-2.15.0/debian/libva2.symbols 2022-07-05 21:54:17.000000000 +0000 @@ -86,18 +86,9 @@ vaTerminate@Base 1.0.3 vaUnlockSurface@Base 2.0.0 vaUnmapBuffer@Base 1.0.3 - va_FoolBufferInfo@Base 2.0.0 - va_FoolCheckContinuity@Base 2.0.0 - va_FoolCreateBuffer@Base 2.0.0 - va_FoolCreateConfig@Base 2.0.0 - va_FoolEnd@Base 2.0.0 - va_FoolInit@Base 2.0.0 - va_FoolMapBuffer@Base 2.0.0 (optional|internal)va_TracePutSurface@Base 1.0.6 va_TraceStatus@Base 2.5.0 va_errorMessage@Base 2.0.0 - va_fool_codec@Base 2.0.0 - va_fool_postp@Base 2.0.0 va_infoMessage@Base 2.0.0 va_newDisplayContext@Base 2.0.0 va_newDriverContext@Base 2.1.0 diff -Nru libva-2.14.0/debian/libva-x11-2.symbols libva-2.15.0/debian/libva-x11-2.symbols --- libva-2.14.0/debian/libva-x11-2.symbols 2017-11-08 20:00:02.000000000 +0000 +++ libva-2.15.0/debian/libva-x11-2.symbols 2022-07-05 21:56:04.000000000 +0000 @@ -17,3 +17,4 @@ va_dri_get_rendering_buffer@Base 2.0.0 va_dri_swap_buffer@Base 2.0.0 va_isDRI2Connected@Base 2.0.0 + va_isRenderNodeFd@Base 2.15.0 diff -Nru libva-2.14.0/meson.build libva-2.15.0/meson.build --- libva-2.14.0/meson.build 2022-02-16 15:26:40.000000000 +0000 +++ libva-2.15.0/meson.build 2022-06-28 12:39:46.000000000 +0000 @@ -7,7 +7,7 @@ # - reset micro version to zero when VA-API major or minor version is changed project( 'libva', 'c', - version : '2.14.0', + version : '2.15.0', meson_version : '>= 0.53.0', default_options : [ 'warning_level=1', 'buildtype=debugoptimized' ]) @@ -19,7 +19,7 @@ # - 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 = 14 +va_api_minor_version = 15 va_api_micro_version = 0 va_api_version = '@0@.@1@.@2@'.format(va_api_major_version, diff -Nru libva-2.14.0/NEWS libva-2.15.0/NEWS --- libva-2.14.0/NEWS 2022-02-16 15:26:40.000000000 +0000 +++ libva-2.15.0/NEWS 2022-06-28 12:39:46.000000000 +0000 @@ -1,6 +1,19 @@ -libva NEWS -- summary of user visible changes. 2022-02-16 +libva NEWS -- summary of user visible changes. 2022-06-28 Copyright (C) 2009-2022 Intel Corporation +version 2.15.0 - 28.Jun.2022 +* Add: new display HW attribute to report PCI ID +* Add: sample depth related parameters for AV1e +* Add: refresh_frame_flags for AV1e +* Add: missing fields in va_TraceVAEncSequenceParameterBufferHEVC. +* Add: nvidia-drm to the drm driver map +* Add: type and buffer for delta qp per block +* Deprecation: remove the va_fool support +* Fix:Correct the version of meson build on master branch +* Fix:X11 DRI2: check if device is a render node +* Build:Use also strong stack protection if supported +* Trace:print the string for profile/entrypoint/configattrib + version 2.14.0 - 16.Feb.2022 * add: Add av1 encode interfaces * add: VA/X11 VAAPI driver mapping for crocus DRI driver diff -Nru libva-2.14.0/va/drm/va_drm_utils.c libva-2.15.0/va/drm/va_drm_utils.c --- libva-2.14.0/va/drm/va_drm_utils.c 2022-02-16 15:26:40.000000000 +0000 +++ libva-2.15.0/va/drm/va_drm_utils.c 2022-06-28 12:39:46.000000000 +0000 @@ -45,6 +45,7 @@ { "nouveau", 7, "nouveau" }, // Mesa Gallium driver { "radeon", 6, "r600" }, // Mesa Gallium driver { "amdgpu", 6, "radeonsi" }, // Mesa Gallium driver + { "nvidia-drm",10, "nvidia" }, // NVIDIA driver { NULL, 0, NULL } }; diff -Nru libva-2.14.0/va/Makefile.am libva-2.15.0/va/Makefile.am --- libva-2.14.0/va/Makefile.am 2022-02-16 15:26:40.000000000 +0000 +++ libva-2.15.0/va/Makefile.am 2022-06-28 12:39:46.000000000 +0000 @@ -33,7 +33,6 @@ libva_source_c = \ va.c \ va_compat.c \ - va_fool.c \ va_str.c \ va_trace.c \ $(NULL) @@ -70,7 +69,6 @@ libva_source_h_priv = \ sysdeps.h \ - va_fool.h \ va_internal.h \ va_trace.h \ $(NULL) @@ -84,9 +82,7 @@ -Wall \ $(NULL) -if USE_SSP -libva_cflags += -fstack-protector -endif +libva_cflags += $(SSP_CC_FLAG) lib_LTLIBRARIES = libva.la libvaincludedir = ${includedir}/va diff -Nru libva-2.14.0/va/meson.build libva-2.15.0/va/meson.build --- libva-2.14.0/va/meson.build 2022-02-16 15:26:40.000000000 +0000 +++ libva-2.15.0/va/meson.build 2022-06-28 12:39:46.000000000 +0000 @@ -12,7 +12,6 @@ libva_sources = [ 'va.c', 'va_compat.c', - 'va_fool.c', 'va_str.c', 'va_trace.c', ] @@ -52,7 +51,6 @@ libva_headers_priv = [ 'sysdeps.h', - 'va_fool.h', 'va_internal.h', 'va_trace.h', ] diff -Nru libva-2.14.0/va/va.c libva-2.15.0/va/va.c --- libva-2.14.0/va/va.c 2022-02-16 15:26:40.000000000 +0000 +++ libva-2.15.0/va/va.c 2022-06-28 12:39:46.000000000 +0000 @@ -30,7 +30,6 @@ #include "va_backend_vpp.h" #include "va_internal.h" #include "va_trace.h" -#include "va_fool.h" #include #include @@ -724,8 +723,6 @@ va_TraceInit(dpy); - va_FoolInit(dpy); - va_MessagingInit(); va_infoMessage(dpy, "VA-API version %s\n", VA_VERSION_S); @@ -800,8 +797,6 @@ va_TraceEnd(dpy); - va_FoolEnd(dpy); - if (VA_STATUS_SUCCESS == vaStatus) pDisplayContext->vaDestroy(pDisplayContext); @@ -931,7 +926,6 @@ /* record the current entrypoint for further trace/fool determination */ VA_TRACE_ALL(va_TraceCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id); - VA_FOOL_FUNC(va_FoolCreateConfig, dpy, profile, entrypoint, attrib_list, num_attribs, config_id); VA_TRACE_RET(dpy, vaStatus); return vaStatus; } @@ -1369,8 +1363,6 @@ CHECK_DISPLAY(dpy); ctx = CTX(dpy); - VA_FOOL_FUNC(va_FoolCreateBuffer, dpy, context, type, size, num_elements, data, buf_id); - vaStatus = ctx->vtable->vaCreateBuffer(ctx, context, type, size, num_elements, data, buf_id); VA_TRACE_LOG(va_TraceCreateBuffer, @@ -1419,8 +1411,6 @@ CHECK_DISPLAY(dpy); ctx = CTX(dpy); - VA_FOOL_FUNC(va_FoolCheckContinuity, dpy); - vaStatus = ctx->vtable->vaBufferSetNumElements(ctx, buf_id, num_elements); VA_TRACE_RET(dpy, vaStatus); return vaStatus; @@ -1439,8 +1429,6 @@ CHECK_DISPLAY(dpy); ctx = CTX(dpy); - VA_FOOL_FUNC(va_FoolMapBuffer, dpy, buf_id, pbuf); - va_status = ctx->vtable->vaMapBuffer(ctx, buf_id, pbuf); VA_TRACE_ALL(va_TraceMapBuffer, dpy, buf_id, pbuf); @@ -1459,8 +1447,6 @@ CHECK_DISPLAY(dpy); ctx = CTX(dpy); - VA_FOOL_FUNC(va_FoolCheckContinuity, dpy); - vaStatus = ctx->vtable->vaUnmapBuffer(ctx, buf_id); VA_TRACE_RET(dpy, vaStatus); return vaStatus; @@ -1476,8 +1462,6 @@ CHECK_DISPLAY(dpy); ctx = CTX(dpy); - VA_FOOL_FUNC(va_FoolCheckContinuity, dpy); - VA_TRACE_LOG(va_TraceDestroyBuffer, dpy, buffer_id); @@ -1501,8 +1485,6 @@ CHECK_DISPLAY(dpy); ctx = CTX(dpy); - VA_FOOL_FUNC(va_FoolBufferInfo, dpy, buf_id, type, size, num_elements); - vaStatus = ctx->vtable->vaBufferInfo(ctx, buf_id, type, size, num_elements); VA_TRACE_RET(dpy, vaStatus); return vaStatus; @@ -1578,7 +1560,6 @@ ctx = CTX(dpy); VA_TRACE_ALL(va_TraceBeginPicture, dpy, context, render_target); - VA_FOOL_FUNC(va_FoolCheckContinuity, dpy); va_status = ctx->vtable->vaBeginPicture(ctx, context, render_target); VA_TRACE_RET(dpy, va_status); @@ -1600,7 +1581,6 @@ ctx = CTX(dpy); VA_TRACE_LOG(va_TraceRenderPicture, dpy, context, buffers, num_buffers); - VA_FOOL_FUNC(va_FoolCheckContinuity, dpy); vaStatus = ctx->vtable->vaRenderPicture(ctx, context, buffers, num_buffers); VA_TRACE_RET(dpy, vaStatus); @@ -1618,7 +1598,6 @@ CHECK_DISPLAY(dpy); ctx = CTX(dpy); - VA_FOOL_FUNC(va_FoolCheckContinuity, dpy); VA_TRACE_ALL(va_TraceEndPicture, dpy, context, 0); va_status = ctx->vtable->vaEndPicture(ctx, context); VA_TRACE_RET(dpy, va_status); diff -Nru libva-2.14.0/va/va_enc_av1.h libva-2.15.0/va/va_enc_av1.h --- libva-2.14.0/va/va_enc_av1.h 2022-02-16 15:26:40.000000000 +0000 +++ libva-2.15.0/va/va_enc_av1.h 2022-06-28 12:39:46.000000000 +0000 @@ -305,8 +305,14 @@ uint32_t enable_cdef : 1; /** \brief Corresponds to AV1 syntax element of the same name. */ uint32_t enable_restoration : 1; + /** \brief Sepcify number of bits for every channel(Y, U or V). */ + uint32_t bit_depth_minus8 : 3; + /** \brief Corresponds to AV1 syntax element of the same name. */ + uint32_t subsampling_x : 1; + /** \brief Corresponds to AV1 syntax element of the same name. */ + uint32_t subsampling_y : 1; /** \brief Reserved bytes for future use, must be zero. */ - uint32_t reserved_bits : 18; + uint32_t reserved_bits : 13; } bits; uint32_t value; } seq_fields; @@ -588,7 +594,10 @@ /** \brief Corresponds to AV1 syntax element of the same name. */ uint8_t order_hint; - uint16_t reserved16bits0; + /** \brief Corresponds to AV1 syntax element of the same name. */ + uint8_t refresh_frame_flags; + + uint8_t reserved8bits1; /** \brief Suggest which frames to be used as references. * see struct #VARefFrameCtrl for details. diff -Nru libva-2.14.0/va/va_fool.c libva-2.15.0/va/va_fool.c --- libva-2.14.0/va/va_fool.c 2022-02-16 15:26:40.000000000 +0000 +++ libva-2.15.0/va/va_fool.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,385 +0,0 @@ -/* - * Copyright (c) 2009 Intel Corporation. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#define _GNU_SOURCE 1 -#include "sysdeps.h" -#include "va.h" -#include "va_backend.h" -#include "va_internal.h" -#include "va_trace.h" -#include "va_fool.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * Do dummy decode/encode, ignore the input data - * In order to debug memory leak or low performance issues, we need to isolate driver problems - * We export env "VA_FOOL", with which, we can do fake decode/encode: - * - * LIBVA_FOOL_DECODE: - * . if set, decode does nothing - * LIBVA_FOOL_ENCODE=: - * . if set, encode does nothing, but fill in the coded buffer from the content of files with - * name framename.0,framename.1,..., framename.N, framename.0,..., framename.N,...repeatly - * Use file name to determine h264 or vp8 - * LIBVA_FOOL_JPEG=:fill the content of filename to codedbuf for jpeg encoding - * LIBVA_FOOL_POSTP: - * . if set, do nothing for vaPutSurface - */ - - -/* global settings */ -int va_fool_codec = 0; -int va_fool_postp = 0; - -#define FOOL_BUFID_MAGIC 0x12345600 -#define FOOL_BUFID_MASK 0xffffff00 - -struct fool_context { - int enabled; /* va_fool_codec is global, and it is for concurent encode/decode */ - char *fn_enc;/* file pattern with codedbuf content for encode */ - char *segbuf_enc; /* the segment buffer of coded buffer, load frome fn_enc */ - int file_count; - - char *fn_jpg;/* file name of JPEG fool with codedbuf content */ - char *segbuf_jpg; /* the segment buffer of coded buffer, load frome fn_jpg */ - - VAEntrypoint entrypoint; /* current entrypoint */ - - /* all buffers with same type share one malloc-ed memory - * bufferID = (buffer numbers with the same type << 8) || type - * the malloc-ed memory can be find by fool_buf[bufferID & 0xff] - * the size is ignored here - */ - char *fool_buf[VABufferTypeMax]; /* memory of fool buffers */ - unsigned int fool_buf_size[VABufferTypeMax]; /* size of memory of fool buffers */ - unsigned int fool_buf_element[VABufferTypeMax]; /* element count of created buffers */ - unsigned int fool_buf_count[VABufferTypeMax]; /* count of created buffers */ - VAContextID context; -}; - -#define FOOL_CTX(dpy) ((struct fool_context *)((VADisplayContextP)dpy)->vafool) - -#define DPY2FOOLCTX(dpy) \ - struct fool_context *fool_ctx = FOOL_CTX(dpy); \ - if (fool_ctx == NULL) \ - return 0; /* no fool for the context */ \ - -#define DPY2FOOLCTX_CHK(dpy) \ - struct fool_context *fool_ctx = FOOL_CTX(dpy); \ - if ((fool_ctx == NULL) || (fool_ctx->enabled == 0)) \ - return 0; /* no fool for the context */ \ - - -void va_FoolInit(VADisplay dpy) -{ - char env_value[1024]; - - struct fool_context *fool_ctx = calloc(sizeof(struct fool_context), 1); - - if (fool_ctx == NULL) - return; - - if (va_parseConfig("LIBVA_FOOL_POSTP", NULL) == 0) { - va_fool_postp = 1; - va_infoMessage(dpy, "LIBVA_FOOL_POSTP is on, dummy vaPutSurface\n"); - } - - if (va_parseConfig("LIBVA_FOOL_DECODE", NULL) == 0) { - va_fool_codec |= VA_FOOL_FLAG_DECODE; - va_infoMessage(dpy, "LIBVA_FOOL_DECODE is on, dummy decode\n"); - } - if (va_parseConfig("LIBVA_FOOL_ENCODE", &env_value[0]) == 0) { - va_fool_codec |= VA_FOOL_FLAG_ENCODE; - fool_ctx->fn_enc = strdup(env_value); - va_infoMessage(dpy, "LIBVA_FOOL_ENCODE is on, load encode data from file with patten %s\n", - fool_ctx->fn_enc); - } - if (va_parseConfig("LIBVA_FOOL_JPEG", &env_value[0]) == 0) { - va_fool_codec |= VA_FOOL_FLAG_JPEG; - fool_ctx->fn_jpg = strdup(env_value); - va_infoMessage(dpy, "LIBVA_FOOL_JPEG is on, load encode data from file with patten %s\n", - fool_ctx->fn_jpg); - } - - ((VADisplayContextP)dpy)->vafool = fool_ctx; -} - - -int va_FoolEnd(VADisplay dpy) -{ - int i; - DPY2FOOLCTX(dpy); - - for (i = 0; i < VABufferTypeMax; i++) {/* free memory */ - if (fool_ctx->fool_buf[i]) - free(fool_ctx->fool_buf[i]); - } - if (fool_ctx->segbuf_enc) - free(fool_ctx->segbuf_enc); - if (fool_ctx->segbuf_jpg) - free(fool_ctx->segbuf_jpg); - if (fool_ctx->fn_enc) - free(fool_ctx->fn_enc); - if (fool_ctx->fn_jpg) - free(fool_ctx->fn_jpg); - - free(fool_ctx); - ((VADisplayContextP)dpy)->vafool = NULL; - - return 0; -} - -int va_FoolCreateConfig( - VADisplay dpy, - VAProfile profile, - VAEntrypoint entrypoint, - VAConfigAttrib *attrib_list, - int num_attribs, - VAConfigID *config_id /* out */ -) -{ - DPY2FOOLCTX(dpy); - - fool_ctx->entrypoint = entrypoint; - - /* - * check va_fool_codec to align with current context - * e.g. va_fool_codec = decode then for encode, the - * vaBegin/vaRender/vaEnd also run into fool path - * which is not desired - */ - if (((va_fool_codec & VA_FOOL_FLAG_DECODE) && (entrypoint == VAEntrypointVLD)) || - ((va_fool_codec & VA_FOOL_FLAG_JPEG) && (entrypoint == VAEntrypointEncPicture))) - fool_ctx->enabled = 1; - else if ((va_fool_codec & VA_FOOL_FLAG_ENCODE) && (entrypoint == VAEntrypointEncSlice)) { - /* H264 is desired */ - if (((profile == VAProfileH264Main || - profile == VAProfileH264High || - profile == VAProfileH264ConstrainedBaseline)) && - strstr(fool_ctx->fn_enc, "h264")) - fool_ctx->enabled = 1; - - /* vp8 is desired */ - if ((profile == VAProfileVP8Version0_3) && - strstr(fool_ctx->fn_enc, "vp8")) - fool_ctx->enabled = 1; - } - if (fool_ctx->enabled) - va_infoMessage(dpy, "FOOL is enabled for this context\n"); - else - va_infoMessage(dpy, "FOOL is not enabled for this context\n"); - - - return 0; /* continue */ -} - - -VAStatus va_FoolCreateBuffer( - VADisplay dpy, - VAContextID context, /* in */ - VABufferType type, /* in */ - unsigned int size, /* in */ - unsigned int num_elements, /* in */ - void *data, /* in */ - VABufferID *buf_id /* out */ -) -{ - unsigned int new_size = size * num_elements; - unsigned int old_size; - DPY2FOOLCTX_CHK(dpy); - - old_size = fool_ctx->fool_buf_size[type] * fool_ctx->fool_buf_element[type]; - - if (old_size < new_size) - fool_ctx->fool_buf[type] = realloc(fool_ctx->fool_buf[type], new_size); - - fool_ctx->fool_buf_size[type] = size; - fool_ctx->fool_buf_element[type] = num_elements; - fool_ctx->fool_buf_count[type]++; - /* because we ignore the vaRenderPicture, - * all buffers with same type share same real memory - * bufferID = (magic number) | type - */ - *buf_id = FOOL_BUFID_MAGIC | type; - - return 1; /* don't call into driver */ -} - -VAStatus va_FoolBufferInfo( - VADisplay dpy, - VABufferID buf_id, /* in */ - VABufferType *type, /* out */ - unsigned int *size, /* out */ - unsigned int *num_elements /* out */ -) -{ - unsigned int magic; - - DPY2FOOLCTX_CHK(dpy); - - magic = buf_id & FOOL_BUFID_MASK; - if (magic != FOOL_BUFID_MAGIC) - return 0; /* could be VAImageBufferType from vaDeriveImage */ - - *type = buf_id & 0xff; - *size = fool_ctx->fool_buf_size[*type]; - *num_elements = fool_ctx->fool_buf_element[*type];; - - return 1; /* fool is valid */ -} - -static int va_FoolFillCodedBufEnc(VADisplay dpy, struct fool_context *fool_ctx) -{ - char file_name[1024]; - struct stat file_stat = {}; - VACodedBufferSegment *codedbuf; - int i, fd = -1; - ssize_t ret; - - /* try file_name.file_count, if fail, try file_name.file_count-- */ - for (i = 0; i <= 1; i++) { - snprintf(file_name, 1024, "%s.%d", - fool_ctx->fn_enc, - fool_ctx->file_count); - - if ((fd = open(file_name, O_RDONLY)) != -1) { - if (fstat(fd, &file_stat) != -1) { - fool_ctx->file_count++; /* open next file */ - break; - } - va_errorMessage(dpy, "Identify file %s failed:%s\n", - file_name, strerror(errno)); - close(fd); - fd = -1; - } - /* fall back to the first file file */ - fool_ctx->file_count = 0; - } - if (fd != -1) { - fool_ctx->segbuf_enc = realloc(fool_ctx->segbuf_enc, file_stat.st_size); - ret = read(fd, fool_ctx->segbuf_enc, file_stat.st_size); - if (ret < file_stat.st_size) - va_errorMessage(dpy, "Reading file %s failed.\n", file_name); - close(fd); - } else - va_errorMessage(dpy, "Open file %s failed:%s\n", file_name, strerror(errno)); - - codedbuf = (VACodedBufferSegment *)fool_ctx->fool_buf[VAEncCodedBufferType]; - codedbuf->size = file_stat.st_size; - codedbuf->bit_offset = 0; - codedbuf->status = 0; - codedbuf->reserved = 0; - codedbuf->buf = fool_ctx->segbuf_enc; - codedbuf->next = NULL; - - return 0; -} - -static int va_FoolFillCodedBufJPG(VADisplay dpy, struct fool_context *fool_ctx) -{ - struct stat file_stat = {}; - VACodedBufferSegment *codedbuf; - int fd = -1; - ssize_t ret; - - if ((fd = open(fool_ctx->fn_jpg, O_RDONLY)) != -1) { - if (fstat(fd, &file_stat) != -1) { - fool_ctx->segbuf_jpg = realloc(fool_ctx->segbuf_jpg, file_stat.st_size); - ret = read(fd, fool_ctx->segbuf_jpg, file_stat.st_size); - if (ret < file_stat.st_size) - va_errorMessage(dpy, "Reading file %s failed.\n", fool_ctx->fn_jpg); - } else { - va_errorMessage(dpy, "Identify file %s failed:%s\n", - fool_ctx->fn_jpg, strerror(errno)); - } - close(fd); - } else - va_errorMessage(dpy, "Open file %s failed:%s\n", fool_ctx->fn_jpg, strerror(errno)); - - codedbuf = (VACodedBufferSegment *)fool_ctx->fool_buf[VAEncCodedBufferType]; - codedbuf->size = file_stat.st_size; - codedbuf->bit_offset = 0; - codedbuf->status = 0; - codedbuf->reserved = 0; - codedbuf->buf = fool_ctx->segbuf_jpg; - codedbuf->next = NULL; - - return 0; -} - - -static int va_FoolFillCodedBuf(VADisplay dpy, struct fool_context *fool_ctx) -{ - if (fool_ctx->entrypoint == VAEntrypointEncSlice) - va_FoolFillCodedBufEnc(dpy, fool_ctx); - else if (fool_ctx->entrypoint == VAEntrypointEncPicture) - va_FoolFillCodedBufJPG(dpy, fool_ctx); - - return 0; -} - - -VAStatus va_FoolMapBuffer( - VADisplay dpy, - VABufferID buf_id, /* in */ - void **pbuf /* out */ -) -{ - unsigned int magic, buftype; - DPY2FOOLCTX_CHK(dpy); - - magic = buf_id & FOOL_BUFID_MASK; - if (magic != FOOL_BUFID_MAGIC) - return 0; /* could be VAImageBufferType from vaDeriveImage */ - - buftype = buf_id & 0xff; - *pbuf = fool_ctx->fool_buf[buftype]; - - /* it is coded buffer, fill coded segment from file */ - if (*pbuf && (buftype == VAEncCodedBufferType)) - va_FoolFillCodedBuf(dpy, fool_ctx); - - return 1; /* fool is valid */ -} - -VAStatus va_FoolCheckContinuity(VADisplay dpy) -{ - DPY2FOOLCTX_CHK(dpy); - - return 1; /* fool is valid */ -} - diff -Nru libva-2.14.0/va/va_fool.h libva-2.15.0/va/va_fool.h --- libva-2.14.0/va/va_fool.h 2022-02-16 15:26:40.000000000 +0000 +++ libva-2.15.0/va/va_fool.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2009 Intel Corporation. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -#ifndef VA_FOOL_H -#define VA_FOOL_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -extern int va_fool_codec; -extern int va_fool_postp; - -#define VA_FOOL_FLAG_DECODE 0x1 -#define VA_FOOL_FLAG_ENCODE 0x2 -#define VA_FOOL_FLAG_JPEG 0x4 - -#define VA_FOOL_FUNC(fool_func,...) \ - if (va_fool_codec) { \ - if (fool_func(__VA_ARGS__)) \ - return VA_STATUS_SUCCESS; \ - } - -void va_FoolInit(VADisplay dpy); -int va_FoolEnd(VADisplay dpy); - -int va_FoolCreateConfig( - VADisplay dpy, - VAProfile profile, - VAEntrypoint entrypoint, - VAConfigAttrib *attrib_list, - int num_attribs, - VAConfigID *config_id /* out */ -); - - -VAStatus va_FoolCreateBuffer( - VADisplay dpy, - VAContextID context, /* in */ - VABufferType type, /* in */ - unsigned int size, /* in */ - unsigned int num_elements, /* in */ - void *data, /* in */ - VABufferID *buf_id /* out */ -); - -VAStatus va_FoolMapBuffer( - VADisplay dpy, - VABufferID buf_id, /* in */ - void **pbuf /* out */ -); - -VAStatus va_FoolBufferInfo( - VADisplay dpy, - VABufferID buf_id, /* in */ - VABufferType *type, /* out */ - unsigned int *size, /* out */ - unsigned int *num_elements /* out */ -); - -VAStatus va_FoolCheckContinuity(VADisplay dpy); - -#ifdef __cplusplus -} -#endif - -#endif diff -Nru libva-2.14.0/va/va.h libva-2.15.0/va/va.h --- libva-2.14.0/va/va.h 2022-02-16 15:26:40.000000000 +0000 +++ libva-2.15.0/va/va.h 2022-06-28 12:39:46.000000000 +0000 @@ -1021,6 +1021,13 @@ * VAConfigAttribValEncAV1Ext2 union. */ VAConfigAttribEncAV1Ext2 = 54, + /** \brief Settings per block attribute for Encoding. Read-only. + * + * This attribute describes whether to support delta qp per block, + * the supported size of delta qp block and the size of delta QP in bytes. + * The value returned uses the VAConfigAttribValEncPerBlockControl type. + */ + VAConfigAttribEncPerBlockControl = 55, /**@}*/ VAConfigAttribTypeMax } VAConfigAttribType; @@ -1401,6 +1408,21 @@ uint32_t value; } VAConfigAttribValContextPriority; +/** brief Attribute value VAConfigAttribEncPerBlockControl */ +typedef union _VAConfigAttribValEncPerBlockControl { + struct { + /** \brief whether to support dela qp per block */ + uint32_t delta_qp_support : 1; + /** \brief supported size of delta qp block */ + uint32_t log2_delta_qp_block_size : 4; + /** \brief size of delta qp per block in bytes*/ + uint32_t delta_qp_size_in_bytes : 3; + /** \brief reserved bit for future, must be zero */ + uint32_t reserved : 24; + } bits; + uint32_t value; +} VAConfigAttribValEncPerBlockControl; + /** @name Attribute values for VAConfigAttribProtectedContentCipherAlgorithm */ /** \brief AES cipher */ #define VA_PC_CIPHER_AES 0x00000001 @@ -2069,6 +2091,17 @@ */ VAEncryptionParameterBufferType = 60, + /** + * \brief Encoding delta QP per block buffer + * + * This buffer only could be created and accepted + * when \c VAConfigAttribValEncPerBlockControl delta_qp_support == 1. + * This input buffer contains delta QP per block for encoding. + * The supported size of delta QP block and the size of delta QP + * must be quried from \c VAConfigAttribValEncPerBlockControl. + */ + VAEncDeltaQpPerBlockBufferType = 61, + VABufferTypeMax } VABufferType; @@ -5036,6 +5069,11 @@ * modes of vaCopy */ VADisplayAttribCopy = 20, + /* + * HW attribute. read only. retrieve the device information from backend driver + * the value should be combined with vendor ID << 16 | device ID + */ + VADisplayPCIID = 21, } VADisplayAttribType; /* flags for VADisplayAttribute */ diff -Nru libva-2.14.0/va/va_str.c libva-2.15.0/va/va_str.c --- libva-2.14.0/va/va_str.c 2022-02-16 15:26:40.000000000 +0000 +++ libva-2.15.0/va/va_str.c 2022-06-28 12:39:46.000000000 +0000 @@ -147,6 +147,7 @@ TOSTR(VAConfigAttribEncAV1); TOSTR(VAConfigAttribEncAV1Ext1); TOSTR(VAConfigAttribEncAV1Ext2); + TOSTR(VAConfigAttribEncPerBlockControl); case VAConfigAttribTypeMax: break; } @@ -200,6 +201,7 @@ TOSTR(VAContextParameterUpdateBufferType); TOSTR(VAProtectedSessionExecuteBufferType); TOSTR(VAEncryptionParameterBufferType); + TOSTR(VAEncDeltaQpPerBlockBufferType); case VABufferTypeMax: break; } diff -Nru libva-2.14.0/va/va_trace.c libva-2.15.0/va/va_trace.c --- libva-2.14.0/va/va_trace.c 2022-02-16 15:26:40.000000000 +0000 +++ libva-2.15.0/va/va_trace.c 2022-06-28 12:39:46.000000000 +0000 @@ -1091,12 +1091,12 @@ TRACE_FUNCNAME(idx); - va_TraceMsg(trace_ctx, "\tprofile = %d\n", profile); - va_TraceMsg(trace_ctx, "\tentrypoint = %d\n", entrypoint); + va_TraceMsg(trace_ctx, "\tprofile = %d, %s\n", profile, vaProfileStr(profile)); + va_TraceMsg(trace_ctx, "\tentrypoint = %d, %s\n", entrypoint, vaEntrypointStr(entrypoint)); va_TraceMsg(trace_ctx, "\tnum_attribs = %d\n", num_attribs); if (attrib_list) { for (i = 0; i < num_attribs; i++) { - va_TraceMsg(trace_ctx, "\t\tattrib_list[%d].type = 0x%08x\n", i, attrib_list[i].type); + va_TraceMsg(trace_ctx, "\t\tattrib_list[%d].type = 0x%08x, %s\n", i, attrib_list[i].type, vaConfigAttribTypeStr(attrib_list[i].type)); va_TraceMsg(trace_ctx, "\t\tattrib_list[%d].value = 0x%08x\n", i, attrib_list[i].value); } } @@ -1377,8 +1377,9 @@ trace_ctx->trace_context = *context; TRACE_FUNCNAME(idx); va_TraceMsg(trace_ctx, "\tcontext = 0x%08x va_trace_flag 0x%x\n", *context, va_trace_flag); - va_TraceMsg(trace_ctx, "\tprofile = %d entrypoint = %d\n", trace_ctx->trace_profile, - trace_ctx->trace_entrypoint); + va_TraceMsg(trace_ctx, "\tprofile = %d,%s entrypoint = %d,%s\n",trace_ctx->trace_profile, + vaProfileStr(trace_ctx->trace_profile),trace_ctx->trace_entrypoint, + vaEntrypointStr(trace_ctx->trace_entrypoint)); va_TraceMsg(trace_ctx, "\tconfig = 0x%08x\n", config_id); va_TraceMsg(trace_ctx, "\twidth = %d\n", picture_width); va_TraceMsg(trace_ctx, "\theight = %d\n", picture_height); @@ -2727,6 +2728,8 @@ va_TraceMsg(trace_ctx, "\tpcm_enabled_flag = %d\n", p->seq_fields.bits.pcm_enabled_flag); va_TraceMsg(trace_ctx, "\tpcm_loop_filter_disabled_flag = %d\n", p->seq_fields.bits.pcm_loop_filter_disabled_flag); va_TraceMsg(trace_ctx, "\tsps_temporal_mvp_enabled_flag = %d\n", p->seq_fields.bits.sps_temporal_mvp_enabled_flag); + va_TraceMsg(trace_ctx, "\tlow_delay_seq = %d\n", p->seq_fields.bits.low_delay_seq); + va_TraceMsg(trace_ctx, "\thierachical_flag = %d\n", p->seq_fields.bits.hierachical_flag); va_TraceMsg(trace_ctx, "\treserved_bits = %d\n", p->seq_fields.bits.reserved_bits); va_TraceMsg(trace_ctx, "\tlog2_min_luma_coding_block_size_minus3 = %d\n", p->log2_min_luma_coding_block_size_minus3); va_TraceMsg(trace_ctx, "\tlog2_diff_max_min_luma_coding_block_size = %d\n", p->log2_diff_max_min_luma_coding_block_size); diff -Nru libva-2.14.0/va/x11/dri2_util.c libva-2.15.0/va/x11/dri2_util.c --- libva-2.14.0/va/x11/dri2_util.c 2022-02-16 15:26:40.000000000 +0000 +++ libva-2.15.0/va/x11/dri2_util.c 2022-06-28 12:39:46.000000000 +0000 @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -171,6 +172,29 @@ close(dri_state->base.fd); } +int +va_isRenderNodeFd(int fd) +{ + struct stat st; + char *name; + + /* Check by device node */ + if (fstat(fd, &st) == 0) + return S_ISCHR(st.st_mode) && (st.st_rdev & 0x80); + + /* Check by device name */ + name = drmGetDeviceNameFromFd(fd); + if (name) { + /* drmGetDeviceNameFromFd returns a strdup'ed string */ + int r = (strncmp(name, "/dev/dri/renderD", 16) == 0); + drmFree(name); + return r; + } + + /* Unrecoverable error */ + return -1; +} + Bool va_isDRI2Connected(VADriverContextP ctx, char **driver_name) { @@ -179,6 +203,7 @@ int error_base; int event_base; char *device_name = NULL; + int is_render_nodes; drm_magic_t magic; *driver_name = NULL; @@ -198,16 +223,17 @@ dri_state->base.fd = open(device_name, O_RDWR); - if (dri_state->base.fd < 0) + if (dri_state->base.fd < 0 || (is_render_nodes = va_isRenderNodeFd(dri_state->base.fd)) < 0) goto err_out; - if (drmGetMagic(dri_state->base.fd, &magic)) - goto err_out; - - if (!VA_DRI2Authenticate(ctx->native_dpy, RootWindow(ctx->native_dpy, ctx->x11_screen), - magic)) - goto err_out; + if (!is_render_nodes) { + if (drmGetMagic(dri_state->base.fd, &magic)) + goto err_out; + if (!VA_DRI2Authenticate(ctx->native_dpy, RootWindow(ctx->native_dpy, ctx->x11_screen), + magic)) + goto err_out; + } dri_state->base.auth_type = VA_DRI2; dri_state->createDrawable = dri2CreateDrawable; dri_state->destroyDrawable = dri2DestroyDrawable; diff -Nru libva-2.14.0/va/x11/va_x11.c libva-2.15.0/va/x11/va_x11.c --- libva-2.14.0/va/x11/va_x11.c 2022-02-16 15:26:40.000000000 +0000 +++ libva-2.15.0/va/x11/va_x11.c 2022-06-28 12:39:46.000000000 +0000 @@ -28,7 +28,6 @@ #include "va_backend.h" #include "va_internal.h" #include "va_trace.h" -#include "va_fool.h" #include "va_x11.h" #include "va_dri2.h" #include "va_dricommon.h" @@ -332,9 +331,6 @@ { VADriverContextP ctx; - if (va_fool_postp) - return VA_STATUS_SUCCESS; - CHECK_DISPLAY(dpy); ctx = CTX(dpy);