Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "\"zhilizhao(赵志立)\"" <quinkblack@foxmail.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH v1] lavu/hwcontext_vaapi: sync surface before export its DRM handle
Date: Fri, 24 Feb 2023 14:47:43 +0800
Message-ID: <tencent_383899162E4D1C200BCDA44FA4D569277A07@qq.com> (raw)
In-Reply-To: <20230224054549.863132-1-fei.w.wang@intel.com>



> On Feb 24, 2023, at 13:45, Fei Wang <fei.w.wang-at-intel.com@ffmpeg.org> wrote:
> 
> According to description of vaExportSurfaceHandle in libva, vaSyncSurface
> must be called if the contents of the surface will be read.
> 
> Fixes ticket #9967.
> 
> Signed-off-by: Fei Wang <fei.w.wang@intel.com>
> ---
> libavutil/hwcontext_vaapi.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
> index 938bd5447d..90c2c191d9 100644
> --- a/libavutil/hwcontext_vaapi.c
> +++ b/libavutil/hwcontext_vaapi.c
> @@ -1319,8 +1319,17 @@ static int vaapi_map_to_drm_esh(AVHWFramesContext *hwfc, AVFrame *dst,
>     surface_id = (VASurfaceID)(uintptr_t)src->data[3];
> 
>     export_flags = VA_EXPORT_SURFACE_SEPARATE_LAYERS;
> -    if (flags & AV_HWFRAME_MAP_READ)
> +    if (flags & AV_HWFRAME_MAP_READ) {
>         export_flags |= VA_EXPORT_SURFACE_READ_ONLY;
> +
> +        vas = vaSyncSurface(hwctx->display, surface_id);
> +        if (vas != VA_STATUS_SUCCESS) {
> +            av_log(hwfc, AV_LOG_ERROR, "Failed to sync surface "
> +                   "%#x: %d (%s).\n", surface_id, vas, vaErrorStr(vas));
> +            return AVERROR(EIO);
> +        }
> +    }
> +
>     if (flags & AV_HWFRAME_MAP_WRITE)
>         export_flags |= VA_EXPORT_SURFACE_WRITE_ONLY;

LGTM.

> 
> -- 
> 2.25.1
> 
> _______________________________________________
> 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".

_______________________________________________
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:[~2023-02-24  6:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24  5:45 Fei Wang
2023-02-24  6:47 ` "zhilizhao(赵志立)" [this message]
2023-02-27  5:57   ` Xiang, Haihao

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=tencent_383899162E4D1C200BCDA44FA4D569277A07@qq.com \
    --to=quinkblack@foxmail.com \
    --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