[Mesa-dev] [PATCH] st/va: Fix vaSyncSurface with no outstanding operation

Andy Furniss adf.lists at gmail.com
Mon Sep 26 23:49:05 UTC 2016


Mark Thompson wrote:
> ---
> A simple fix to the problem described here: <https://lists.freedesktop.org/archives/mesa-dev/2016-September/128076.html>.
>
> With this applied, the driver no longer hangs/crashes when vaSyncSurface() is called in places other than for the first time after an encode operation (including a second call on the same surface).

Once I could get ffmpeg (patched) or avconv to roughly work (before the 
dual instance commit), but I can't get either to work now = produces 
unreadable file.

Testing with git avconv I am trying -

./avconv -vaapi_device :0 -f rawvideo -framerate 50 -s 2560x1440 
-pix_fmt nv12 -i /mnt/ramdisk/trees-1440p50.nv12 -vframes 5 -vf 
'hwupload' -c:v h264_vaapi -profile:v 66 -b:v 40M  -bf 0 -g 30  -f h264 
-y /mnt/ramdisk/out.264

but debugging printfs show refs = 2 and bframes enabled (I also notice 
with your baseline patch that -profile:v 66 fails).

Do you have an example that works for you with avconv + this patch?

TIA

>
> Thanks,
>
> - Mark
>
>
>   src/gallium/state_trackers/va/surface.c | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/src/gallium/state_trackers/va/surface.c b/src/gallium/state_trackers/va/surface.c
> index 75db650..5e92980 100644
> --- a/src/gallium/state_trackers/va/surface.c
> +++ b/src/gallium/state_trackers/va/surface.c
> @@ -111,6 +111,12 @@ vlVaSyncSurface(VADriverContextP ctx, VASurfaceID render_target)
>         return VA_STATUS_ERROR_INVALID_SURFACE;
>      }
>
> +   if (!surf->feedback) {
> +      // No outstanding operation: nothing to do.
> +      pipe_mutex_unlock(drv->mutex);
> +      return VA_STATUS_SUCCESS;
> +   }
> +
>      context = handle_table_get(drv->htab, surf->ctx);
>      if (!context) {
>         pipe_mutex_unlock(drv->mutex);
> @@ -126,6 +132,7 @@ vlVaSyncSurface(VADriverContextP ctx, VASurfaceID render_target)
>         if (frame_diff < 2)
>            context->decoder->flush(context->decoder);
>         context->decoder->get_feedback(context->decoder, surf->feedback, &(surf->coded_buf->coded_size));
> +      surf->feedback = NULL;
>      }
>      pipe_mutex_unlock(drv->mutex);
>      return VA_STATUS_SUCCESS;
>



More information about the mesa-dev mailing list