Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Hao Chen <chenhao@loongson.cn>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH v4 1/2] libavcodec/vaapi_encode: Add new API adaption to vaapi_encode
Date: Fri, 18 Feb 2022 11:02:31 +0800
Message-ID: <524db6dc-b884-e64c-0044-5ca4c2fe3d70@loongson.cn> (raw)
In-Reply-To: <20220218020757.834409-1-wenbin.chen@intel.com>

Hey, there are some make errors, pasted as follows:

libavcodec/vaapi_encode.c:2552:1: note: in expansion of macro 'av_cold'
  av_cold int ff_vaapi_encode_close(AVCodecContext *avctx)
  ^~~~~~~
libavcodec/vaapi_encode.c:2589:1: error: expected declaration or statement at end of input
  }
  ^
libavcodec/vaapi_encode.c:2589:1: error: control reaches end of non-void function [-Werror=return-type]
  }
  ^
At top level:
libavcodec/vaapi_encode.c:2552:13: warning: 'ff_vaapi_encode_close' defined but not used [-Wunused-function]
  av_cold int ff_vaapi_encode_close(AVCodecContext *avctx)
              ^~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

在 2022/2/18 上午10:07, Wenbin Chen 写道:
> From: Wenbin Chen <wenbin.chen-at-intel.com@ffmpeg.org>
>
> Add vaSyncBuffer to VAAPI encoder. Old version API vaSyncSurface wait
> surface to complete. When surface is used for multiple operation, it
> waits all operations to finish. vaSyncBuffer only wait one channel to
> finish.
>
> Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
> ---
>   libavcodec/vaapi_encode.c | 31 ++++++++++++++++++++++++++-----
>   libavcodec/vaapi_encode.h |  3 +++
>   2 files changed, 29 insertions(+), 5 deletions(-)
>
> diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
> index 3bf379b1a0..335a8e450a 100644
> --- a/libavcodec/vaapi_encode.c
> +++ b/libavcodec/vaapi_encode.c
> @@ -150,11 +150,25 @@ static int vaapi_encode_wait(AVCodecContext *avctx,
>              "(input surface %#x).\n", pic->display_order,
>              pic->encode_order, pic->input_surface);
>   
> -    vas = vaSyncSurface(ctx->hwctx->display, pic->input_surface);
> -    if (vas != VA_STATUS_SUCCESS) {
> -        av_log(avctx, AV_LOG_ERROR, "Failed to sync to picture completion: "
> -               "%d (%s).\n", vas, vaErrorStr(vas));
> -        return AVERROR(EIO);
> +#if VA_CHECK_VERSION(1, 9, 0)
> +    if (ctx->has_sync_buffer_func) {
> +        vas = vaSyncBuffer(ctx->hwctx->display,
> +                           pic->output_buffer,
> +                           VA_TIMEOUT_INFINITE);
> +        if (vas != VA_STATUS_SUCCESS) {
> +            av_log(avctx, AV_LOG_ERROR, "Failed to sync to output buffer completion: "
> +                   "%d (%s).\n", vas, vaErrorStr(vas));
> +            return AVERROR(EIO);
> +        }
> +    } else
> +#endif
> +    { // If vaSyncBuffer is not implemented, try old version API.
> +        vas = vaSyncSurface(ctx->hwctx->display, pic->input_surface);
> +        if (vas != VA_STATUS_SUCCESS) {
> +            av_log(avctx, AV_LOG_ERROR, "Failed to sync to picture completion: "
> +                "%d (%s).\n", vas, vaErrorStr(vas));
> +            return AVERROR(EIO);
> +        }
>       }
>   
>       // Input is definitely finished with now.
> @@ -2522,6 +2536,13 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
>           }
>       }
>   
> +#if VA_CHECK_VERSION(1, 9, 0)
> +    // check vaSyncBuffer function
> +    vas = vaSyncBuffer(ctx->hwctx->display, VA_INVALID_ID, 0);
> +    if (vas != VA_STATUS_ERROR_UNIMPLEMENTED) {
> +        ctx->has_sync_buffer_func = 1;
> +#endif
> +
>       return 0;
>   
>   fail:
> diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h
> index b41604a883..29d9e9b91c 100644
> --- a/libavcodec/vaapi_encode.h
> +++ b/libavcodec/vaapi_encode.h
> @@ -345,6 +345,9 @@ typedef struct VAAPIEncodeContext {
>       int             roi_warned;
>   
>       AVFrame         *frame;
> +
> +    // Whether the driver support vaSyncBuffer
> +    int             has_sync_buffer_func;
>   } VAAPIEncodeContext;
>   
>   enum {
_______________________________________________
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".

      parent reply	other threads:[~2022-02-18  3:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-18  2:07 Wenbin Chen
2022-02-18  2:07 ` [FFmpeg-devel] [PATCH v4 2/2] libavcodec/vaapi_encode: Add async_depth to vaapi_encoder to increase performance Wenbin Chen
2022-02-18  3:02 ` Hao Chen [this message]

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=524db6dc-b884-e64c-0044-5ca4c2fe3d70@loongson.cn \
    --to=chenhao@loongson.cn \
    --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