[FFmpeg-trac] #9967(avutil:new): [vaapi] av_hwframe_map with AV_PIX_FMT_PRIME_FD calls vaExportSurfaceHandle, but not vaSyncSurface

FFmpeg trac at avcodec.org
Fri Feb 24 02:53:48 EET 2023


#9967: [vaapi] av_hwframe_map with AV_PIX_FMT_PRIME_FD calls
vaExportSurfaceHandle, but not vaSyncSurface
-------------------------------------+----------------------------------
             Reporter:  goffioul     |                    Owner:  (none)
                 Type:  enhancement  |                   Status:  new
             Priority:  normal       |                Component:  avutil
              Version:  unspecified  |               Resolution:
             Keywords:  vaapi        |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+----------------------------------
Comment (by wangfei):

 Replying to [comment:3 goffioul]:
 > @wangfei: I'm sorry, I won't be able to confirm, my client code has
 moved on too much and is not mapping anymore the VA-API frame to a prime
 fd. I can however confirm that at the time I submitted this bug, I was
 using the following patch locally, which effectively avoided the tearing
 artefact. While not being identical, it should be functionally equivalent.
 The main difference is that `vaSynSurface` was called
 '''after'''`vaExportSurfaceHandle`.
 >
 > {{{
 > diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
 > index 01ac91c33b..e2d0217fe1 100644
 > --- a/libavutil/hwcontext_vaapi.c
 > +++ b/libavutil/hwcontext_vaapi.c
 > @@ -1306,6 +1306,7 @@ static int vaapi_map_to_drm_esh(AVHWFramesContext
 *hwfc, AVFrame *dst,
 >                 "%d (%s).\n", surface_id, vas, vaErrorStr(vas));
 >          return AVERROR(EIO);
 >      }
 > +    vaSyncSurface(hwctx->display, surface_id);
 >
 >      drm_desc = av_mallocz(sizeof(*drm_desc));
 >      if (!drm_desc) {
 > }}}

 Hi @goffioul, It should have same effect to sync surface before or after
 export its dma fd. Prefer to follow the description in libva to add it
 before export. I will submit my patch into ML. And thanks for your
 information.
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9967#comment:4>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list