From patchwork Wed Jun 5 20:13:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 49600 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:9185:0:b0:460:55fa:d5ed with SMTP id s5csp5240vqg; Wed, 5 Jun 2024 13:12:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW8Awn6MH4DcyYsHVmcxKRItDDpcduE7fHvQ3sdhP0WNfzd2tbD1j+8kdIuxeal6pEYU95xWJCWma+jWeerR1ubxBzpQdv/MsiDRg== X-Google-Smtp-Source: AGHT+IEeaem5pcm+xrvSzEs+xe9txqthzZCGntwK/OEYr29pWuaVtwDqeo+R9oRv6RObju97Kkc2 X-Received: by 2002:a2e:b0f7:0:b0:2e6:935f:b6d3 with SMTP id 38308e7fff4ca-2eac7990a6bmr27916051fa.14.1717618373536; Wed, 05 Jun 2024 13:12:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717618373; cv=none; d=google.com; s=arc-20160816; b=dD5eCyVn7x1TB5x2PuQFEYofyP3Wnv/NM6LhRKGfDlV8w8q9MctkfTIEttHDrU5rtT t30LIypcUkINFzIFmqXIryQTp9mH5x5tAU0qfU9+VYOM8u+ldKVeMgLoTUiGXqa8tT1V AKm803wMapc/OS1X+k1S581jV8hyC5a63abjd2LWRcpBm4qhTmkeJQgoW0c84fJHi3Lt K3BDGltNAe3d1UenHr1Y/wa0MhH4EHOKRbRyIjenSvKdKYZCFRrcSZN7sUvbuZeuhfH5 oFMLC/Okf3fPExvEZhtBCv6bi+oXH01nUq62PQexMopio0jvdXH1BnazbarP2MoJ9oB9 heyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=px2EV58VaNGiaq4+V/LeX1XJGf/baS8pKjWbO0PGabM=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=jGmBjA/4yudNgCRGwprAfw4CwH98THkTk5b7ckGUBq0xOzta8SpHMOQqIQ3Eugn8Dz ZgajGmDj5O6oHsiHW0S04nvROOljEIMzYszxoHgxLMDpPANI0j/OHvDvoaPnA4GoD2J8 jNNR0f6v7v8Vd9efuWXYdApC0qakUgg+UBKh4qulQrqizX25T+BzxF58AoUoaNJT3+oN +Z06ja/wZnV3NhU+g3pr/tY8SQnaHlZwz3VFigs32bc6pE57cKnJBU6bQYKOpZEZvbCK rBenSTnoUAs/497SxZYkpqHZOgqBD6jggztp5b2ISkDsjECJggnTzthHeEwpsStMV0AE +C8A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@jkqxz-net.20230601.gappssmtp.com header.s=20230601 header.b=dBZxOM6b; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-57a31b815a7si6370155a12.109.2024.06.05.13.12.53; Wed, 05 Jun 2024 13:12:53 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@jkqxz-net.20230601.gappssmtp.com header.s=20230601 header.b=dBZxOM6b; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B52FB68D6DB; Wed, 5 Jun 2024 23:12:50 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 16DA168D4EF for ; Wed, 5 Jun 2024 23:12:44 +0300 (EEST) Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4214f52b810so3561965e9.1 for ; Wed, 05 Jun 2024 13:12:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jkqxz-net.20230601.gappssmtp.com; s=20230601; t=1717618363; x=1718223163; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=qeZ1pN3GPXW2zSjid0Sah0f7RvmoP2M/lo4L8EIqZ7c=; b=dBZxOM6bBJpCF+8utfbHod5ThbFbPXe3tRd5ddw97BTfE0ZiTHT61L0/b8JR3u25I1 yleNDVakUJ/sgbdCgEYk55byyXlF++q2TB+1nUh8lN+18XvuX9DJKqArcdI7z3Nw5oYy HxHI38nkbJh9lIjqFeKIIL6vDONoPEtmrdjS5qV+twfqZnaof3T4um2dbL2uc3tmeImy Pt3ND2LKad0AsM7YRbr+AiHG8ZonC2TpFUdlHMKPs6zPIcG6p1/jApjEjc97ENMzRMSI z0DrGGlPZtehK3vAaMxIDAaG+foJvIhg3CCjF9krhnPsgG0qDxMDbiOXxxzCb/5RNTJa xiUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717618363; x=1718223163; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qeZ1pN3GPXW2zSjid0Sah0f7RvmoP2M/lo4L8EIqZ7c=; b=HYsZkK4/F2AYISdHZHSo4nm4ZZqU0QAzP2IOrMkkfpWi0eSdKhzp519P80DZ7cf8XK aoWywc0pGJhyMCF1TTmxGGlZhk95LplUp8TIIVXyWG/QthsTbOIbhlf37WjAs/W11yAO stxwI74EvP+BcoIJkDbesGXCRgTCiVKlrGxAyVpA2VX5p++Pz8vXuUTGKldqEbAmsY11 EtUZ0jgpkgbiV/6n9JcKI32Oqy+7rCP9p5yiSFoCJ0F++Ai2DYsfXEj2CyDcBmDOuExJ TeXT48io8H+pUzN9r6IaWQ9f22zFIp8dVmjANHQKgGdgwkd6TUkPPl5dpTBU1dFIYQ6n 3EGg== X-Gm-Message-State: AOJu0YyY4aFmzINk/dsQ22UhR95lKCNlOSearELoKksljuIzU3qY1XMA ROUuNCfNBzaKhcas98oipLc5gm/naLEPJkGLpd46w0Atx7w1Odagip9p8VN+7kWs7iMf5+evKTZ T X-Received: by 2002:a05:600c:4fd0:b0:420:71f7:9752 with SMTP id 5b1f17b1804b1-421562d733fmr34857795e9.18.1717618363009; Wed, 05 Jun 2024 13:12:43 -0700 (PDT) Received: from localhost.localdomain (cpc92302-cmbg19-2-0-cust1183.5-4.cable.virginm.net. [82.1.212.160]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42158101c07sm33361825e9.7.2024.06.05.13.12.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 13:12:42 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Wed, 5 Jun 2024 21:13:03 +0100 Message-ID: <20240605201310.2343779-1-sw@jkqxz.net> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v5 1/2] configure, lavu, lavc, lavfi: Remove libva 1.x support X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: acjB+3m5nkU9 libva 2.0 was released in 2017 and the 2.x versions are included in all supported distributions nowadays. Various features no longer need any configure check after this change, including all codecs except AV1. Note that the libva version is the API version plus one, so this is removing support for VAAPI 0.x and requiring VAAPI 1.x. --- Now squashed. configure | 25 +++-------- libavcodec/vaapi_decode.c | 39 ++--------------- libavcodec/vaapi_encode.c | 78 ++++++---------------------------- libavcodec/vaapi_encode.h | 9 ---- libavcodec/vaapi_encode_h264.c | 18 -------- libavcodec/vaapi_encode_h265.c | 2 - libavfilter/vaapi_vpp.c | 22 ++++------ libavutil/hwcontext_vaapi.c | 22 ---------- 8 files changed, 29 insertions(+), 186 deletions(-) diff --git a/configure b/configure index 6c5b8aab9a..06e6fa22f2 100755 --- a/configure +++ b/configure @@ -2630,7 +2630,6 @@ CONFIG_EXTRA=" texturedsp texturedspenc tpeldsp - vaapi_1 vaapi_encode vc1dsp videodsp @@ -3200,7 +3199,7 @@ hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC" hevc_dxva2_hwaccel_select="hevc_decoder" hevc_nvdec_hwaccel_deps="nvdec" hevc_nvdec_hwaccel_select="hevc_decoder" -hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC" +hevc_vaapi_hwaccel_deps="vaapi" hevc_vaapi_hwaccel_select="hevc_decoder" hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC" hevc_vdpau_hwaccel_select="hevc_decoder" @@ -3272,7 +3271,7 @@ vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9" vp9_dxva2_hwaccel_select="vp9_decoder" vp9_nvdec_hwaccel_deps="nvdec" vp9_nvdec_hwaccel_select="vp9_decoder" -vp9_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferVP9_bit_depth" +vp9_vaapi_hwaccel_deps="vaapi" vp9_vaapi_hwaccel_select="vp9_decoder" vp9_vdpau_hwaccel_deps="vdpau VdpPictureInfoVP9" vp9_vdpau_hwaccel_select="vp9_decoder" @@ -3365,7 +3364,6 @@ hevc_qsv_decoder_select="hevc_mp4toannexb_bsf qsvdec" hevc_qsv_encoder_select="hevcparse qsvenc" hevc_rkmpp_decoder_deps="rkmpp" hevc_rkmpp_decoder_select="hevc_mp4toannexb_bsf" -hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC" hevc_vaapi_encoder_select="atsc_a53 cbs_h265 vaapi_encode" hevc_v4l2m2m_decoder_deps="v4l2_m2m hevc_v4l2_m2m" hevc_v4l2m2m_decoder_select="hevc_mp4toannexb_bsf" @@ -3374,7 +3372,6 @@ mjpeg_cuvid_decoder_deps="cuvid" mjpeg_qsv_decoder_select="qsvdec" mjpeg_qsv_encoder_deps="libmfx" mjpeg_qsv_encoder_select="qsvenc" -mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG" mjpeg_vaapi_encoder_select="cbs_jpeg jpegtables vaapi_encode" mp3_mf_encoder_deps="mediafoundation" mpeg1_cuvid_decoder_deps="cuvid" @@ -3403,7 +3400,6 @@ vp8_mediacodec_decoder_deps="mediacodec" vp8_mediacodec_encoder_deps="mediacodec" vp8_qsv_decoder_select="qsvdec" vp8_rkmpp_decoder_deps="rkmpp" -vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8" vp8_vaapi_encoder_select="vaapi_encode" vp8_v4l2m2m_decoder_deps="v4l2_m2m vp8_v4l2_m2m" vp8_v4l2m2m_encoder_deps="v4l2_m2m vp8_v4l2_m2m" @@ -3412,7 +3408,6 @@ vp9_mediacodec_decoder_deps="mediacodec" vp9_mediacodec_encoder_deps="mediacodec" vp9_qsv_decoder_select="qsvdec" vp9_rkmpp_decoder_deps="rkmpp" -vp9_vaapi_encoder_deps="VAEncPictureParameterBufferVP9" vp9_vaapi_encoder_select="vaapi_encode" vp9_qsv_encoder_deps="libmfx MFX_CODEC_VP9" vp9_qsv_encoder_select="qsvenc" @@ -3966,9 +3961,9 @@ xfade_vulkan_filter_deps="vulkan spirv_compiler" yadif_cuda_filter_deps="ffnvcodec" yadif_cuda_filter_deps_any="cuda_nvcc cuda_llvm" yadif_videotoolbox_filter_deps="metal corevideo videotoolbox" -hstack_vaapi_filter_deps="vaapi_1" -vstack_vaapi_filter_deps="vaapi_1" -xstack_vaapi_filter_deps="vaapi_1" +hstack_vaapi_filter_deps="vaapi" +vstack_vaapi_filter_deps="vaapi" +xstack_vaapi_filter_deps="vaapi" hstack_qsv_filter_deps="libmfx" hstack_qsv_filter_select="qsvvpp" vstack_qsv_filter_deps="libmfx" @@ -7271,7 +7266,7 @@ enabled libdrm && check_pkg_config libdrm_getfb2 libdrm "xf86drmMode.h" drmModeGetFB2 enabled vaapi && - check_pkg_config vaapi "libva >= 0.35.0" "va/va.h" vaInitialize + check_pkg_config vaapi "libva >= 1.0.0" "va/va.h" vaInitialize if enabled vaapi; then case $target_os in @@ -7287,18 +7282,10 @@ if enabled vaapi; then check_pkg_config vaapi_x11 "libva-x11" "va/va_x11.h" vaGetDisplay fi - check_cpp_condition vaapi_1 "va/va.h" "VA_CHECK_VERSION(1, 0, 0)" - - check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC" - check_struct "va/va.h" "VADecPictureParameterBufferVP9" bit_depth check_struct "va/va.h" "VADecPictureParameterBufferAV1" bit_depth_idx check_type "va/va.h va/va_vpp.h" "VAProcFilterParameterBufferHDRToneMapping" check_struct "va/va.h va/va_vpp.h" "VAProcPipelineCaps" rotation_flags check_struct "va/va.h va/va_vpp.h" "VAProcPipelineCaps" blend_flags - check_type "va/va.h va/va_enc_hevc.h" "VAEncPictureParameterBufferHEVC" - check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG" - check_type "va/va.h va/va_enc_vp8.h" "VAEncPictureParameterBufferVP8" - check_type "va/va.h va/va_enc_vp9.h" "VAEncPictureParameterBufferVP9" check_type "va/va.h va/va_enc_av1.h" "VAEncPictureParameterBufferAV1" fi diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c index 7c91d50f7b..9018558b48 100644 --- a/libavcodec/vaapi_decode.c +++ b/libavcodec/vaapi_decode.c @@ -197,16 +197,10 @@ int ff_vaapi_decode_issue(AVCodecContext *avctx, av_log(avctx, AV_LOG_ERROR, "Failed to end picture decode " "issue: %d (%s).\n", vas, vaErrorStr(vas)); err = AVERROR(EIO); - if (CONFIG_VAAPI_1 || ctx->hwctx->driver_quirks & - AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS) - goto fail; - else - goto fail_at_end; + goto fail; } - if (CONFIG_VAAPI_1 || ctx->hwctx->driver_quirks & - AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS) - ff_vaapi_decode_destroy_buffers(avctx, pic); + ff_vaapi_decode_destroy_buffers(avctx, pic); err = 0; goto exit; @@ -219,7 +213,6 @@ fail_with_picture: } fail: ff_vaapi_decode_destroy_buffers(avctx, pic); -fail_at_end: exit: pic->nb_param_buffers = 0; pic->nb_slices = 0; @@ -412,12 +405,10 @@ static const struct { H264ConstrainedBaseline), MAP(H264, H264_MAIN, H264Main ), MAP(H264, H264_HIGH, H264High ), -#if VA_CHECK_VERSION(0, 37, 0) MAP(HEVC, HEVC_MAIN, HEVCMain ), MAP(HEVC, HEVC_MAIN_10, HEVCMain10 ), MAP(HEVC, HEVC_MAIN_STILL_PICTURE, HEVCMain ), -#endif #if VA_CHECK_VERSION(1, 2, 0) && CONFIG_HEVC_VAAPI_HWACCEL MAP(HEVC, HEVC_REXT, None, ff_vaapi_parse_hevc_rext_scc_profile ), @@ -435,14 +426,10 @@ static const struct { MAP(VC1, VC1_COMPLEX, VC1Advanced ), MAP(VC1, VC1_ADVANCED, VC1Advanced ), MAP(VP8, UNKNOWN, VP8Version0_3 ), -#if VA_CHECK_VERSION(0, 38, 0) MAP(VP9, VP9_0, VP9Profile0 ), -#endif -#if VA_CHECK_VERSION(0, 39, 0) MAP(VP9, VP9_1, VP9Profile1 ), MAP(VP9, VP9_2, VP9Profile2 ), MAP(VP9, VP9_3, VP9Profile3 ), -#endif #if VA_CHECK_VERSION(1, 8, 0) MAP(AV1, AV1_MAIN, AV1Profile0), MAP(AV1, AV1_HIGH, AV1Profile1), @@ -605,27 +592,7 @@ static int vaapi_decode_make_config(AVCodecContext *avctx, if (err < 0) goto fail; - if (CONFIG_VAAPI_1) - frames->initial_pool_size = 0; - else { - frames->initial_pool_size = 1; - // Add per-codec number of surfaces used for storing reference frames. - switch (avctx->codec_id) { - case AV_CODEC_ID_H264: - case AV_CODEC_ID_HEVC: - case AV_CODEC_ID_AV1: - frames->initial_pool_size += 16; - break; - case AV_CODEC_ID_VP9: - frames->initial_pool_size += 8; - break; - case AV_CODEC_ID_VP8: - frames->initial_pool_size += 3; - break; - default: - frames->initial_pool_size += 2; - } - } + frames->initial_pool_size = 0; } av_hwframe_constraints_free(&constraints); diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index f54b2579ec..6f062e8277 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -530,7 +530,6 @@ static int vaapi_encode_issue(AVCodecContext *avctx, } } -#if VA_CHECK_VERSION(1, 0, 0) sd = av_frame_get_side_data(pic->input_image, AV_FRAME_DATA_REGIONS_OF_INTEREST); if (sd && ctx->roi_allowed) { @@ -593,7 +592,6 @@ static int vaapi_encode_issue(AVCodecContext *avctx, if (err < 0) goto fail; } -#endif vas = vaBeginPicture(ctx->hwctx->display, ctx->va_context, pic->input_surface); @@ -618,26 +616,17 @@ static int vaapi_encode_issue(AVCodecContext *avctx, av_log(avctx, AV_LOG_ERROR, "Failed to end picture encode issue: " "%d (%s).\n", vas, vaErrorStr(vas)); err = AVERROR(EIO); - // vaRenderPicture() has been called here, so we should not destroy - // the parameter buffers unless separate destruction is required. - if (CONFIG_VAAPI_1 || ctx->hwctx->driver_quirks & - AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS) - goto fail; - else - goto fail_at_end; - } - - if (CONFIG_VAAPI_1 || ctx->hwctx->driver_quirks & - AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS) { - for (i = 0; i < pic->nb_param_buffers; i++) { - vas = vaDestroyBuffer(ctx->hwctx->display, - pic->param_buffers[i]); - if (vas != VA_STATUS_SUCCESS) { - av_log(avctx, AV_LOG_ERROR, "Failed to destroy " - "param buffer %#x: %d (%s).\n", - pic->param_buffers[i], vas, vaErrorStr(vas)); - // And ignore. - } + goto fail; + } + + for (i = 0; i < pic->nb_param_buffers; i++) { + vas = vaDestroyBuffer(ctx->hwctx->display, + pic->param_buffers[i]); + if (vas != VA_STATUS_SUCCESS) { + av_log(avctx, AV_LOG_ERROR, "Failed to destroy " + "param buffer %#x: %d (%s).\n", + pic->param_buffers[i], vas, vaErrorStr(vas)); + // And ignore. } } @@ -654,7 +643,6 @@ fail: for (i = 0; i < pic->nb_slices; i++) av_freep(&pic->slices[i].codec_slice_params); } -fail_at_end: av_freep(&pic->codec_picture_params); av_freep(&pic->param_buffers); av_freep(&pic->slices); @@ -1530,25 +1518,19 @@ static const VAAPIEncodeRTFormat vaapi_encode_rt_formats[] = { { "YUV444", VA_RT_FORMAT_YUV444, 8, 3, 0, 0 }, { "XYUV", VA_RT_FORMAT_YUV444, 8, 3, 0, 0 }, { "YUV411", VA_RT_FORMAT_YUV411, 8, 3, 2, 0 }, -#if VA_CHECK_VERSION(0, 38, 1) { "YUV420_10", VA_RT_FORMAT_YUV420_10BPP, 10, 3, 1, 1 }, -#endif }; static const VAEntrypoint vaapi_encode_entrypoints_normal[] = { VAEntrypointEncSlice, VAEntrypointEncPicture, -#if VA_CHECK_VERSION(0, 39, 2) VAEntrypointEncSliceLP, -#endif 0 }; -#if VA_CHECK_VERSION(0, 39, 2) static const VAEntrypoint vaapi_encode_entrypoints_low_power[] = { VAEntrypointEncSliceLP, 0 }; -#endif static av_cold int vaapi_encode_profile_entrypoint(AVCodecContext *avctx) { @@ -1566,13 +1548,7 @@ static av_cold int vaapi_encode_profile_entrypoint(AVCodecContext *avctx) if (ctx->low_power) { -#if VA_CHECK_VERSION(0, 39, 2) usable_entrypoints = vaapi_encode_entrypoints_low_power; -#else - av_log(avctx, AV_LOG_ERROR, "Low-power encoding is not " - "supported with this VAAPI version.\n"); - return AVERROR(EINVAL); -#endif } else { usable_entrypoints = vaapi_encode_entrypoints_normal; } @@ -1623,11 +1599,7 @@ static av_cold int vaapi_encode_profile_entrypoint(AVCodecContext *avctx) avctx->profile != AV_PROFILE_UNKNOWN) continue; -#if VA_CHECK_VERSION(1, 0, 0) profile_string = vaProfileStr(profile->va_profile); -#else - profile_string = "(no profile names)"; -#endif for (j = 0; j < n; j++) { if (va_profiles[j] == profile->va_profile) @@ -1686,11 +1658,7 @@ static av_cold int vaapi_encode_profile_entrypoint(AVCodecContext *avctx) } ctx->va_entrypoint = va_entrypoints[i]; -#if VA_CHECK_VERSION(1, 0, 0) entrypoint_string = vaEntrypointStr(ctx->va_entrypoint); -#else - entrypoint_string = "(no entrypoint names)"; -#endif av_log(avctx, AV_LOG_VERBOSE, "Using VAAPI entrypoint %s (%d).\n", entrypoint_string, ctx->va_entrypoint); @@ -1807,16 +1775,10 @@ static av_cold int vaapi_encode_init_rate_control(AVCodecContext *avctx) supported_va_rc_modes = rc_attr.value; if (ctx->blbrc) { -#if VA_CHECK_VERSION(0, 39, 2) if (!(supported_va_rc_modes & VA_RC_MB)) { ctx->blbrc = 0; av_log(avctx, AV_LOG_WARNING, "Driver does not support BLBRC.\n"); } -#else - ctx->blbrc = 0; - av_log(avctx, AV_LOG_WARNING, "Please consider to update to VAAPI 0.39.2 " - "or above, which can support BLBRC.\n"); -#endif } for (i = 0; i < FF_ARRAY_ELEMS(vaapi_encode_rc_modes); i++) { @@ -2044,11 +2006,7 @@ rc_mode_found: ctx->config_attributes[ctx->nb_config_attributes++] = (VAConfigAttrib) { .type = VAConfigAttribRateControl, -#if VA_CHECK_VERSION(0, 39, 2) .value = ctx->blbrc ? ctx->va_rc_mode | VA_RC_MB : ctx->va_rc_mode, -#else - .value = ctx->va_rc_mode, -#endif }; } @@ -2081,9 +2039,7 @@ rc_mode_found: #if VA_CHECK_VERSION(1, 3, 0) .quality_factor = rc_quality, #endif -#if VA_CHECK_VERSION(0, 39, 2) .rc_flags.bits.mb_rate_control = ctx->blbrc ? 1 : 2, -#endif }; vaapi_encode_add_global_param(avctx, VAEncMiscParameterTypeRateControl, @@ -2119,12 +2075,10 @@ rc_mode_found: ctx->fr_params = (VAEncMiscParameterFrameRate) { .framerate = (unsigned int)fr_den << 16 | fr_num, }; -#if VA_CHECK_VERSION(0, 40, 0) vaapi_encode_add_global_param(avctx, VAEncMiscParameterTypeFrameRate, &ctx->fr_params, sizeof(ctx->fr_params)); -#endif return 0; } @@ -2338,11 +2292,9 @@ static av_cold int vaapi_encode_init_row_slice_structure(AVCodecContext *avctx, } ctx->nb_slices = (ctx->slice_block_rows + k - 1) / k; ctx->slice_size = k; -#if VA_CHECK_VERSION(1, 0, 0) } else if (slice_structure & VA_ENC_SLICE_STRUCTURE_EQUAL_ROWS) { ctx->nb_slices = ctx->slice_block_rows; ctx->slice_size = 1; -#endif } else { av_log(avctx, AV_LOG_ERROR, "Driver does not support any usable " "slice structure modes (%#x).\n", slice_structure); @@ -2566,7 +2518,6 @@ static av_cold int vaapi_encode_init_packed_headers(AVCodecContext *avctx) static av_cold int vaapi_encode_init_quality(AVCodecContext *avctx) { -#if VA_CHECK_VERSION(0, 36, 0) VAAPIEncodeContext *ctx = avctx->priv_data; VAStatus vas; VAConfigAttrib attr = { VAConfigAttribEncQualityRange }; @@ -2603,17 +2554,12 @@ static av_cold int vaapi_encode_init_quality(AVCodecContext *avctx) &ctx->quality_params, sizeof(ctx->quality_params)); } -#else - av_log(avctx, AV_LOG_WARNING, "The encode quality option is " - "not supported with this VAAPI version.\n"); -#endif return 0; } static av_cold int vaapi_encode_init_roi(AVCodecContext *avctx) { -#if VA_CHECK_VERSION(1, 0, 0) VAAPIEncodeContext *ctx = avctx->priv_data; VAStatus vas; VAConfigAttrib attr = { VAConfigAttribEncROI }; @@ -2640,7 +2586,7 @@ static av_cold int vaapi_encode_init_roi(AVCodecContext *avctx) (ctx->va_rc_mode == VA_RC_CQP || roi.bits.roi_rc_qp_delta_support); } -#endif + return 0; } diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h index 0eed9691ca..43f3b8cf82 100644 --- a/libavcodec/vaapi_encode.h +++ b/libavcodec/vaapi_encode.h @@ -22,10 +22,7 @@ #include #include - -#if VA_CHECK_VERSION(1, 0, 0) #include -#endif #include "libavutil/hwcontext.h" #include "libavutil/hwcontext_vaapi.h" @@ -82,12 +79,8 @@ typedef struct VAAPIEncodePicture { void *opaque; AVBufferRef *opaque_ref; -#if VA_CHECK_VERSION(1, 0, 0) // ROI regions. VAEncROI *roi; -#else - void *roi; -#endif int type; int b_depth; @@ -293,9 +286,7 @@ typedef struct VAAPIEncodeContext { VAEncMiscParameterHRD hrd_params; VAEncMiscParameterFrameRate fr_params; VAEncMiscParameterBufferMaxFrameSize mfs_params; -#if VA_CHECK_VERSION(0, 36, 0) VAEncMiscParameterBufferQualityLevel quality_params; -#endif // Per-sequence parameter structure (VAEncSequenceParameterBuffer*). void *codec_sequence_params; diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c index d656b1020f..bb4c250bb4 100644 --- a/libavcodec/vaapi_encode_h264.c +++ b/libavcodec/vaapi_encode_h264.c @@ -106,7 +106,6 @@ typedef struct VAAPIEncodeH264Context { int aud_needed; int sei_needed; - int sei_cbr_workaround_needed; } VAAPIEncodeH264Context; @@ -271,19 +270,6 @@ static int vaapi_encode_h264_write_extra_header(AVCodecContext *avctx, *type = VAEncPackedHeaderRawData; return 0; - -#if !CONFIG_VAAPI_1 - } else if (priv->sei_cbr_workaround_needed) { - // Insert a zero-length header using the old SEI type. This is - // required to avoid triggering broken behaviour on Intel platforms - // in CBR mode where an invalid SEI message is generated by the - // driver and inserted into the stream. - *data_len = 0; - *type = VAEncPackedHeaderH264_SEI; - priv->sei_cbr_workaround_needed = 0; - return 0; -#endif - } else { return AVERROR_EOF; } @@ -681,10 +667,6 @@ static int vaapi_encode_h264_init_picture_params(AVCodecContext *avctx, if (priv->sei & SEI_IDENTIFIER && pic->encode_order == 0) priv->sei_needed |= SEI_IDENTIFIER; -#if !CONFIG_VAAPI_1 - if (ctx->va_rc_mode == VA_RC_CBR) - priv->sei_cbr_workaround_needed = 1; -#endif if (priv->sei & SEI_TIMING) { priv->sei_pic_timing = (H264RawSEIPicTiming) { diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c index c0dc3fca5f..2252f872cd 100644 --- a/libavcodec/vaapi_encode_h265.c +++ b/libavcodec/vaapi_encode_h265.c @@ -1303,10 +1303,8 @@ static av_cold int vaapi_encode_h265_configure(AVCodecContext *avctx) static const VAAPIEncodeProfile vaapi_encode_h265_profiles[] = { { AV_PROFILE_HEVC_MAIN, 8, 3, 1, 1, VAProfileHEVCMain }, { AV_PROFILE_HEVC_REXT, 8, 3, 1, 1, VAProfileHEVCMain }, -#if VA_CHECK_VERSION(0, 37, 0) { AV_PROFILE_HEVC_MAIN_10, 10, 3, 1, 1, VAProfileHEVCMain10 }, { AV_PROFILE_HEVC_REXT, 10, 3, 1, 1, VAProfileHEVCMain10 }, -#endif #if VA_CHECK_VERSION(1, 2, 0) { AV_PROFILE_HEVC_REXT, 12, 3, 1, 1, VAProfileHEVCMain12 }, { AV_PROFILE_HEVC_REXT, 8, 3, 1, 0, VAProfileHEVCMain422_10 }, diff --git a/libavfilter/vaapi_vpp.c b/libavfilter/vaapi_vpp.c index 9ef7a289fb..fe14170fee 100644 --- a/libavfilter/vaapi_vpp.c +++ b/libavfilter/vaapi_vpp.c @@ -204,12 +204,9 @@ int ff_vaapi_vpp_config_output(AVFilterLink *outlink) output_frames->width = ctx->output_width; output_frames->height = ctx->output_height; - if (CONFIG_VAAPI_1) - output_frames->initial_pool_size = 0; - else - output_frames->initial_pool_size = 4; + output_frames->initial_pool_size = 0; - err = ff_filter_init_hw_frames(avctx, outlink, 10); + err = ff_filter_init_hw_frames(avctx, outlink, 0); if (err < 0) goto fail; @@ -677,15 +674,12 @@ int ff_vaapi_vpp_render_pictures(AVFilterContext *avctx, goto fail_after_render; } - if (CONFIG_VAAPI_1 || ctx->hwctx->driver_quirks & - AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS) { - for (int i = 0; i < cout && params_ids[i] != VA_INVALID_ID; i++) { - vas = vaDestroyBuffer(ctx->hwctx->display, params_ids[i]); - if (vas != VA_STATUS_SUCCESS) { - av_log(avctx, AV_LOG_ERROR, "Failed to free parameter buffer: " - "%d (%s).\n", vas, vaErrorStr(vas)); - // And ignore. - } + for (int i = 0; i < cout && params_ids[i] != VA_INVALID_ID; i++) { + vas = vaDestroyBuffer(ctx->hwctx->display, params_ids[i]); + if (vas != VA_STATUS_SUCCESS) { + av_log(avctx, AV_LOG_ERROR, "Failed to free parameter buffer: " + "%d (%s).\n", vas, vaErrorStr(vas)); + // And ignore. } } diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index 4cb25dd032..caff43d1ae 100644 --- a/libavutil/hwcontext_vaapi.c +++ b/libavutil/hwcontext_vaapi.c @@ -372,14 +372,6 @@ static const struct { const char *match_string; unsigned int quirks; } vaapi_driver_quirks_table[] = { -#if !VA_CHECK_VERSION(1, 0, 0) - // The i965 driver did not conform before version 2.0. - { - "Intel i965 (Quick Sync)", - "i965", - AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS, - }, -#endif { "Intel iHD", "ubit", @@ -1425,7 +1417,6 @@ fail: } #endif -#if VA_CHECK_VERSION(0, 36, 0) typedef struct VAAPIDRMImageBufferMapping { VAImage image; VABufferInfo buffer_info; @@ -1585,7 +1576,6 @@ fail: av_freep(&mapping); return err; } -#endif static int vaapi_map_to_drm(AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src, int flags) @@ -1596,10 +1586,7 @@ static int vaapi_map_to_drm(AVHWFramesContext *hwfc, AVFrame *dst, if (err != AVERROR(ENOSYS)) return err; #endif -#if VA_CHECK_VERSION(0, 36, 0) return vaapi_map_to_drm_abh(hwfc, dst, src, flags); -#endif - return AVERROR(ENOSYS); } #endif /* CONFIG_LIBDRM */ @@ -1649,7 +1636,6 @@ static void vaapi_device_free(AVHWDeviceContext *ctx) av_freep(&priv); } -#if CONFIG_VAAPI_1 static void vaapi_device_log_error(void *context, const char *message) { AVHWDeviceContext *ctx = context; @@ -1663,7 +1649,6 @@ static void vaapi_device_log_info(void *context, const char *message) av_log(ctx, AV_LOG_VERBOSE, "libva: %s", message); } -#endif static int vaapi_device_connect(AVHWDeviceContext *ctx, VADisplay display) @@ -1672,10 +1657,8 @@ static int vaapi_device_connect(AVHWDeviceContext *ctx, int major, minor; VAStatus vas; -#if CONFIG_VAAPI_1 vaSetErrorCallback(display, &vaapi_device_log_error, ctx); vaSetInfoCallback (display, &vaapi_device_log_info, ctx); -#endif hwctx->display = display; @@ -1919,7 +1902,6 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device, ent = av_dict_get(opts, "driver", NULL, 0); if (ent) { -#if VA_CHECK_VERSION(0, 38, 0) VAStatus vas; vas = vaSetDriverName(display, ent->value); if (vas != VA_STATUS_SUCCESS) { @@ -1928,10 +1910,6 @@ static int vaapi_device_create(AVHWDeviceContext *ctx, const char *device, vaTerminate(display); return AVERROR_EXTERNAL; } -#else - av_log(ctx, AV_LOG_WARNING, "Driver name setting is not " - "supported with this VAAPI version.\n"); -#endif } return vaapi_device_connect(ctx, display); From patchwork Wed Jun 5 20:13:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 49602 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:9185:0:b0:460:55fa:d5ed with SMTP id s5csp5297vqg; Wed, 5 Jun 2024 13:13:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVe0WYwOM9rJS1nJkgONdZl7c0tokj5fNM/k6C6Qi2RDk424gTKxCzmu2Hn/kbt2gw+o1JZnVFD64kE7u97qN6BkeSIppaX0VnqNw== X-Google-Smtp-Source: AGHT+IGDQbfuz02f0tyuJYlEn3MhIPd0qBRqv5J4GP4Yx/PWCvAzccSLAxMlrYHUuhwjs8hj0p50 X-Received: by 2002:a17:907:2918:b0:a62:49ae:cd7b with SMTP id a640c23a62f3a-a6c762bcc38mr50157666b.24.1717618381562; Wed, 05 Jun 2024 13:13:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717618381; cv=none; d=google.com; s=arc-20160816; b=zUI1CRbtgDMjTfOzEeWUM9h6Rzb+IbhU5CcbTfwHxmWtyXxIM0r2W3wH58MOf8hAXI V/Gtxp431ZBpfr8LHg1gXswmtvZY0O5h+KW59t4BDfpLwqGY2Fz+PdChAmjaJ1WoiZBs 9+m8dITfqFL98uvcsav3KNHE5YHjxfQVIGlLWmX0Ci45o9ZmtaUGknJtUcpCltWLpEJs 6VunBhbgv0XVZcLwmvetCqAEUSoXYPGyJHFM2ZUxH1ej9iEeVcTEJ1PwjUK44ECTO0cy 2pTwftvommUMjx1QXHXuQmNiyCpkbicRxNAaddi+87QIzU1sxCfTx9563u0FLDddo3XW ooJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=WSSVS4Z2//nrwR1nd0uOB1pOtHDtCowL173ioU7Pt54=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=jcmF35cX4fakv/iA+97c4QAyh+1TMWvtsj1xr0rnpSCimgglndecRAMo6WD/ZsJvdf MTqM7meIggsfG4k0cMqvRjQBpKgpxoEMdDZA/jpnu6rVOvzlOL/nOfBQgdl7bhK0SLvj Exik09NSIPPLekTbvyBdrqzaIkaWXlN0qQZz1AvwUR77OSWspeJeByuEYuyT2PJqtVhe j/J5Cx7lApJLNi6XKx8T5cLcBBRWSSkGhcYvwkOO15w8jBQGj6do5C2YL0Atd2QwJE6t BsnEnUamg1qOp+VSopXc4mzLaTXZC7YuyRDTizxVLM0AulhPA3JwMtgr1UhXDY3f6IA3 aTfA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@jkqxz-net.20230601.gappssmtp.com header.s=20230601 header.b=k7Kocoeu; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a6b603ed909si79848366b.922.2024.06.05.13.13.01; Wed, 05 Jun 2024 13:13:01 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@jkqxz-net.20230601.gappssmtp.com header.s=20230601 header.b=k7Kocoeu; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EEB0E68D6F3; Wed, 5 Jun 2024 23:12:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3C57A68D4EF for ; Wed, 5 Jun 2024 23:12:44 +0300 (EEST) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4213b94b7e7so1033615e9.0 for ; Wed, 05 Jun 2024 13:12:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jkqxz-net.20230601.gappssmtp.com; s=20230601; t=1717618363; x=1718223163; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=4Y7gsEo/G6c52ERgQd4NaOjZ2TFijUsMTQ9fh06gdTQ=; b=k7KocoeuZ2zc930QnC0fUc0TsHLqdG8xFsVPWC2whU7lfSvvnBoc9LKC4xxbBqRJP0 /UWyHPu7R18iWapFSx1k0gMoSFXtzKKNxXN7lGQdsLi+ZS1JtGLuPxtLNOCiP9pmBlZ2 QS6LZbnT7QqRi0z8+wV3gMrQ/y3r22NSLv85NnfefEEqzjUn/Gcg5JsHN2maxj6stl3A vLr7BKtPJZuQtGJiIJO08vE3BayIgKUKBD6GHZpMU83RpKjwwlTggruA4XMwjFIFcO7E JzoZaaOvMok4rU3QkY2hvbpDFLnjtVQ1+ljaqM3j9sl6zfMcU8E1WOholKFDh3oMrQDO WYTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717618363; x=1718223163; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4Y7gsEo/G6c52ERgQd4NaOjZ2TFijUsMTQ9fh06gdTQ=; b=Y0euEGkB3dBWFcduCzobXWJ5u0efl7d+vPCpxIc6ObAj0xrc8gbq5d3uDVoeM/cS6x GmQczcNhTSVRWoMtXhGyjW0ic1vDw1MyRmG8pdSBInh1LWjbpDIecY7/D2TFwTcPJtXo 530qXueUQGrGfhSUFDYZL2tYWBgNjXok2d/u9g3ylgeLue9GODos78LAbRqvmYhegTeO NXQQEA+DJVyhc0HRiXF6pDKQzI45lr/IO8ykxAKui3WQQI4V/X3H9sc/gWO0Axy18xI9 mB/J9678HAs8MgGGC2YTEMw8e7gc/tbafU75rsVIPGbLitG5qYSJburxgHJ0gvf9W3VR LC1g== X-Gm-Message-State: AOJu0YxBYN+ovX4Jb1YfmWpV1I2L9K58kEhxNmtQRLkk7y9CNoTnE4Tn NU4Nu+pBEBnZUWLLf17UEUdl8kPrRrjz1/oKvkmtYkh4o4SvSO81ZeCl67WAoTfjjH5FuQPMMH4 f X-Received: by 2002:a05:6000:12cc:b0:354:d382:dcb9 with SMTP id ffacd0b85a97d-35ef0d84994mr588219f8f.15.1717618363530; Wed, 05 Jun 2024 13:12:43 -0700 (PDT) Received: from localhost.localdomain (cpc92302-cmbg19-2-0-cust1183.5-4.cable.virginm.net. [82.1.212.160]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42158101c07sm33361825e9.7.2024.06.05.13.12.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 13:12:43 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Wed, 5 Jun 2024 21:13:04 +0100 Message-ID: <20240605201310.2343779-2-sw@jkqxz.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605201310.2343779-1-sw@jkqxz.net> References: <20240605201310.2343779-1-sw@jkqxz.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v5 2/2] hwcontext_vaapi: Deprecate quirks X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: d0RwrfKr2e4P These only apply to obsolete drivers which do not work with the now-required libva 2.x. --- Fixed checkheaders. libavutil/hwcontext_vaapi.c | 123 ++++++++++-------------------------- libavutil/hwcontext_vaapi.h | 17 +++++ 2 files changed, 52 insertions(+), 88 deletions(-) diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index caff43d1ae..8591fb88ac 100644 --- a/libavutil/hwcontext_vaapi.c +++ b/libavutil/hwcontext_vaapi.c @@ -243,8 +243,7 @@ static int vaapi_frames_get_constraints(AVHWDeviceContext *hwdev, unsigned int fourcc; int err, i, j, attr_count, pix_fmt_count; - if (config && - !(hwctx->driver_quirks & AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES)) { + if (config) { attr_count = 0; vas = vaQuerySurfaceAttributes(hwctx->display, config->config_id, 0, &attr_count); @@ -367,23 +366,6 @@ fail: return err; } -static const struct { - const char *friendly_name; - const char *match_string; - unsigned int quirks; -} vaapi_driver_quirks_table[] = { - { - "Intel iHD", - "ubit", - AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE, - }, - { - "VDPAU wrapper", - "Splitted-Desktop Systems VDPAU backend for VA-API", - AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES, - }, -}; - static int vaapi_device_init(AVHWDeviceContext *hwdev) { VAAPIDeviceContext *ctx = hwdev->hwctx; @@ -436,36 +418,6 @@ static int vaapi_device_init(AVHWDeviceContext *hwdev) if (vendor_string) av_log(hwdev, AV_LOG_VERBOSE, "VAAPI driver: %s.\n", vendor_string); - if (hwctx->driver_quirks & AV_VAAPI_DRIVER_QUIRK_USER_SET) { - av_log(hwdev, AV_LOG_VERBOSE, "Using quirks set by user (%#x).\n", - hwctx->driver_quirks); - } else { - // Detect the driver in use and set quirk flags if necessary. - hwctx->driver_quirks = 0; - if (vendor_string) { - for (i = 0; i < FF_ARRAY_ELEMS(vaapi_driver_quirks_table); i++) { - if (strstr(vendor_string, - vaapi_driver_quirks_table[i].match_string)) { - av_log(hwdev, AV_LOG_VERBOSE, "Matched driver string " - "as known nonstandard driver \"%s\", setting " - "quirks (%#x).\n", - vaapi_driver_quirks_table[i].friendly_name, - vaapi_driver_quirks_table[i].quirks); - hwctx->driver_quirks |= - vaapi_driver_quirks_table[i].quirks; - break; - } - } - if (!(i < FF_ARRAY_ELEMS(vaapi_driver_quirks_table))) { - av_log(hwdev, AV_LOG_VERBOSE, "Driver not found in known " - "nonstandard list, using standard behaviour.\n"); - } - } else { - av_log(hwdev, AV_LOG_VERBOSE, "Driver has no vendor string, " - "assuming standard behaviour.\n"); - } - } - av_free(image_list); return 0; fail: @@ -562,48 +514,43 @@ static int vaapi_frames_init(AVHWFramesContext *hwfc) } if (!hwfc->pool) { - if (!(hwctx->driver_quirks & AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES)) { - int need_memory_type = !(hwctx->driver_quirks & AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE); - int need_pixel_format = 1; - for (i = 0; i < avfc->nb_attributes; i++) { - if (avfc->attributes[i].type == VASurfaceAttribMemoryType) - need_memory_type = 0; - if (avfc->attributes[i].type == VASurfaceAttribPixelFormat) - need_pixel_format = 0; - } - ctx->nb_attributes = - avfc->nb_attributes + need_memory_type + need_pixel_format; + int need_memory_type = 1; + int need_pixel_format = 1; + for (i = 0; i < avfc->nb_attributes; i++) { + if (avfc->attributes[i].type == VASurfaceAttribMemoryType) + need_memory_type = 0; + if (avfc->attributes[i].type == VASurfaceAttribPixelFormat) + need_pixel_format = 0; + } + ctx->nb_attributes = + avfc->nb_attributes + need_memory_type + need_pixel_format; - ctx->attributes = av_malloc(ctx->nb_attributes * - sizeof(*ctx->attributes)); - if (!ctx->attributes) { - err = AVERROR(ENOMEM); - goto fail; - } + ctx->attributes = av_malloc(ctx->nb_attributes * + sizeof(*ctx->attributes)); + if (!ctx->attributes) { + err = AVERROR(ENOMEM); + goto fail; + } - for (i = 0; i < avfc->nb_attributes; i++) - ctx->attributes[i] = avfc->attributes[i]; - if (need_memory_type) { - ctx->attributes[i++] = (VASurfaceAttrib) { - .type = VASurfaceAttribMemoryType, - .flags = VA_SURFACE_ATTRIB_SETTABLE, - .value.type = VAGenericValueTypeInteger, - .value.value.i = VA_SURFACE_ATTRIB_MEM_TYPE_VA, - }; - } - if (need_pixel_format) { - ctx->attributes[i++] = (VASurfaceAttrib) { - .type = VASurfaceAttribPixelFormat, - .flags = VA_SURFACE_ATTRIB_SETTABLE, - .value.type = VAGenericValueTypeInteger, - .value.value.i = desc->fourcc, - }; - } - av_assert0(i == ctx->nb_attributes); - } else { - ctx->attributes = NULL; - ctx->nb_attributes = 0; + for (i = 0; i < avfc->nb_attributes; i++) + ctx->attributes[i] = avfc->attributes[i]; + if (need_memory_type) { + ctx->attributes[i++] = (VASurfaceAttrib) { + .type = VASurfaceAttribMemoryType, + .flags = VA_SURFACE_ATTRIB_SETTABLE, + .value.type = VAGenericValueTypeInteger, + .value.value.i = VA_SURFACE_ATTRIB_MEM_TYPE_VA, + }; + } + if (need_pixel_format) { + ctx->attributes[i++] = (VASurfaceAttrib) { + .type = VASurfaceAttribPixelFormat, + .flags = VA_SURFACE_ATTRIB_SETTABLE, + .value.type = VAGenericValueTypeInteger, + .value.value.i = desc->fourcc, + }; } + av_assert0(i == ctx->nb_attributes); ctx->rt_format = desc->rt_format; diff --git a/libavutil/hwcontext_vaapi.h b/libavutil/hwcontext_vaapi.h index 0b2e071cb3..91d13d1f16 100644 --- a/libavutil/hwcontext_vaapi.h +++ b/libavutil/hwcontext_vaapi.h @@ -21,6 +21,8 @@ #include +#include "attributes.h" + /** * @file * API-specific header for AV_HWDEVICE_TYPE_VAAPI. @@ -37,18 +39,24 @@ enum { /** * The quirks field has been set by the user and should not be detected * automatically by av_hwdevice_ctx_init(). + * + * @deprecated Driver quirks are no longer used. */ AV_VAAPI_DRIVER_QUIRK_USER_SET = (1 << 0), /** * The driver does not destroy parameter buffers when they are used by * vaRenderPicture(). Additional code will be required to destroy them * separately afterwards. + * + * @deprecated Driver quirks are no longer used. */ AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS = (1 << 1), /** * The driver does not support the VASurfaceAttribMemoryType attribute, * so the surface allocation code will not try to use it. + * + * @deprecated Driver quirks are no longer used. */ AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE = (1 << 2), @@ -56,6 +64,8 @@ enum { * The driver does not support surface attributes at all. * The surface allocation code will never pass them to surface allocation, * and the results of the vaQuerySurfaceAttributes() call will be faked. + * + * @deprecated Driver quirks are no longer used. */ AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES = (1 << 3), }; @@ -76,7 +86,14 @@ typedef struct AVVAAPIDeviceContext { * AV_VAAPI_DRIVER_QUIRK_USER_SET bit is already present. The user * may need to refer to this field when performing any later * operations using VAAPI with the same VADisplay. + * + * @deprecated This was used with libva before the 2.x to support + * various drivers which had behaviour not fully + * matching the specification. Since libva 2.x this is + * no longer used; setting this field has no effect and + * new code must ignore it. */ + attribute_deprecated unsigned int driver_quirks; } AVVAAPIDeviceContext;