[FFmpeg-devel] [PATCH v6 1/2] configure, lavu, lavc, lavfi: Remove libva 1.x support

fei.w.wang at intel.com fei.w.wang at intel.com
Tue Oct 15 11:23:22 EEST 2024


From: Mark Thompson <sw at jkqxz.net>

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.

Signed-off-by: Fei Wang <fei.w.wang at intel.com>
---
Fixes comments in v5:
https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=12062

 configure                      | 29 ++++---------
 libavcodec/vaapi_decode.c      | 39 ++---------------
 libavcodec/vaapi_encode.c      | 78 ++++++----------------------------
 libavcodec/vaapi_encode.h      | 20 +++++----
 libavcodec/vaapi_encode_h264.c | 21 ---------
 libavcodec/vaapi_encode_h265.c |  2 -
 libavfilter/vaapi_vpp.c        | 22 ++++------
 libavutil/hwcontext_vaapi.c    | 22 ----------
 8 files changed, 42 insertions(+), 191 deletions(-)

diff --git a/configure b/configure
index 8803148ab7..39bb890b14 100755
--- a/configure
+++ b/configure
@@ -2636,7 +2636,6 @@ CONFIG_EXTRA="
     texturedsp
     texturedspenc
     tpeldsp
-    vaapi_1
     vaapi_encode
     vc1dsp
     videodsp
@@ -3211,7 +3210,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"
@@ -3283,7 +3282,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"
@@ -3393,7 +3392,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_vulkan_encoder_select="atsc_a53 cbs_h265 vulkan_encode"
 hevc_v4l2m2m_decoder_deps="v4l2_m2m hevc_v4l2_m2m"
@@ -3403,7 +3401,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"
 mp3_mediacodec_decoder_deps="mediacodec"
@@ -3434,7 +3431,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"
@@ -3443,7 +3439,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"
@@ -3996,17 +3991,17 @@ 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"
 vstack_qsv_filter_select="qsvvpp"
 xstack_qsv_filter_deps="libmfx"
 xstack_qsv_filter_select="qsvvpp"
-pad_vaapi_filter_deps="vaapi_1"
-drawbox_vaapi_filter_deps="vaapi_1"
+pad_vaapi_filter_deps="vaapi"
+drawbox_vaapi_filter_deps="vaapi VAProcPipelineCaps_blend_flags"
 
 # examples
 avio_http_serve_files_deps="avformat avutil fork"
@@ -7289,7 +7284,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
@@ -7305,18 +7300,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 a59194340f..9a46b5c90e 100644
--- a/libavcodec/vaapi_decode.c
+++ b/libavcodec/vaapi_decode.c
@@ -198,16 +198,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;
@@ -220,7 +214,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;
@@ -413,12 +406,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 ),
@@ -436,14 +427,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),
@@ -606,27 +593,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 16a9a364f0..551d2301ca 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -522,7 +522,6 @@ static int vaapi_encode_issue(AVCodecContext *avctx,
         }
     }
 
-#if VA_CHECK_VERSION(1, 0, 0)
     sd = av_frame_get_side_data(base_pic->input_image,
                                 AV_FRAME_DATA_REGIONS_OF_INTEREST);
     if (sd && base_ctx->roi_allowed) {
@@ -585,7 +584,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);
@@ -610,26 +608,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.
         }
     }
 
@@ -644,7 +633,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);
@@ -912,25 +900,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)
 {
@@ -949,13 +931,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;
     }
@@ -1006,11 +982,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)
@@ -1069,11 +1041,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);
 
@@ -1190,16 +1158,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++) {
@@ -1427,11 +1389,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
         };
     }
 
@@ -1464,9 +1422,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,
@@ -1502,12 +1458,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;
 }
@@ -1679,11 +1633,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);
@@ -1908,7 +1860,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 };
@@ -1945,17 +1896,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)
     FFHWBaseEncodeContext *base_ctx = avctx->priv_data;
     VAAPIEncodeContext         *ctx = avctx->priv_data;
     VAStatus vas;
@@ -1983,7 +1929,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 c4f85397a2..472aa22766 100644
--- a/libavcodec/vaapi_encode.h
+++ b/libavcodec/vaapi_encode.h
@@ -22,10 +22,7 @@
 #include <stdint.h>
 
 #include <va/va.h>
-
-#if VA_CHECK_VERSION(1, 0, 0)
 #include <va/va_str.h>
-#endif
 
 #include "libavutil/hwcontext.h"
 #include "libavutil/hwcontext_vaapi.h"
@@ -63,12 +60,19 @@ typedef struct VAAPIEncodeSlice {
 } VAAPIEncodeSlice;
 
 typedef struct VAAPIEncodePicture {
-#if VA_CHECK_VERSION(1, 0, 0)
+    struct VAAPIEncodePicture *next;
+
+    int64_t         display_order;
+    int64_t         encode_order;
+    int64_t         pts;
+    int64_t         duration;
+    int             force_idr;
+
+    void           *opaque;
+    AVBufferRef    *opaque_ref;
+
     // ROI regions.
     VAEncROI       *roi;
-#else
-    void           *roi;
-#endif
 
     VASurfaceID     input_surface;
     VASurfaceID     recon_surface;
@@ -216,9 +220,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 ed20b9cd24..7deaa7816c 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -103,7 +103,6 @@ typedef struct VAAPIEncodeH264Context {
 
     int aud_needed;
     int sei_needed;
-    int sei_cbr_workaround_needed;
 } VAAPIEncodeH264Context;
 
 
@@ -268,19 +267,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;
     }
@@ -406,9 +392,6 @@ static int vaapi_encode_h264_init_picture_params(AVCodecContext *avctx,
                                                  FFHWBaseEncodePicture *pic)
 {
     FFHWBaseEncodeContext       *base_ctx = avctx->priv_data;
-#if !CONFIG_VAAPI_1
-    VAAPIEncodeContext               *ctx = avctx->priv_data;
-#endif
     VAAPIEncodeH264Context          *priv = avctx->priv_data;
     VAAPIEncodePicture         *vaapi_pic = pic->priv;
     VAAPIEncodeH264Picture          *hpic = pic->codec_priv;
@@ -469,10 +452,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 2283bcc0b4..f36d6cc1e8 100644
--- a/libavcodec/vaapi_encode_h265.c
+++ b/libavcodec/vaapi_encode_h265.c
@@ -1007,10 +1007,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 9be076fadb..452aeae9b4 100644
--- a/libavfilter/vaapi_vpp.c
+++ b/libavfilter/vaapi_vpp.c
@@ -203,12 +203,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;
 
@@ -676,15 +673,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 95aa38d9d2..c1a67a36c7 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;
 
@@ -1948,7 +1931,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) {
@@ -1957,10 +1939,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);
-- 
2.34.1



More information about the ffmpeg-devel mailing list