Commit 15992a04 authored by Fei Wang's avatar Fei Wang Committed by Haihao Xiang

lavu/hwcontext_vaapi: sync surface before export its DRM handle

According to description of vaExportSurfaceHandle in libva, vaSyncSurface
must be called if the contents of the surface will be read.

Fixes ticket #9967.
Reviewed-by: 's avatarZhao Zhili <zhilizhao@tencent.com>
Signed-off-by: 's avatarFei Wang <fei.w.wang@intel.com>
parent 0825b461
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment