Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Mark Thompson <sw@jkqxz.net>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH 2/4] lavc: Remove libva 1.x support
Date: Wed, 3 Apr 2024 20:45:15 +0100
Message-ID: <6dcdde27-99b7-454f-a155-0fb02161216d@jkqxz.net> (raw)
In-Reply-To: <15056f44-06c8-40a1-bb78-db3e66b2ee86@jkqxz.net>

libva 2.0 was released in 2017 and the 2.x versions are included in all
supported distributions nowadays.
---
  libavcodec/vaapi_decode.c      | 10 ++--------
  libavcodec/vaapi_encode.c      | 31 +++++++++++--------------------
  libavcodec/vaapi_encode_h264.c | 18 ------------------
  3 files changed, 13 insertions(+), 46 deletions(-)

diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
index 5665639dd7..4e8910ed25 100644
--- a/libavcodec/vaapi_decode.c
+++ b/libavcodec/vaapi_decode.c
@@ -191,16 +191,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;
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index f54b2579ec..0e19281ed4 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -618,26 +618,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.
          }
      }

diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index bf51df0f51..4f4191e23b 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) {
-- 
2.43.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2024-04-03 19:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-03 19:44 [FFmpeg-devel] [PATCH 1/4] lavu: " Mark Thompson
2024-04-03 19:45 ` Mark Thompson [this message]
2024-04-03 19:45 ` [FFmpeg-devel] [PATCH 3/4] lavfi: " Mark Thompson
2024-04-03 19:46 ` [FFmpeg-devel] [PATCH 4/4] configure: " Mark Thompson
2024-04-03 20:09 ` [FFmpeg-devel] [PATCH 1/4] lavu: " Rémi Denis-Courmont
2024-04-03 20:18   ` Mark Thompson
2024-04-03 21:29 ` Michael Niedermayer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6dcdde27-99b7-454f-a155-0fb02161216d@jkqxz.net \
    --to=sw@jkqxz.net \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git