problem with vaapisink on an AMD GPU when format is I420
While trying to investigate a bit around this bug I submitted to mesa, mesa/mesa#7853 (closed), I noticed a surprising behavior in allocator_configure_surface_info()
in gstvaapivideomemory.c
, that may explain the crash I observe in mesa va implementation in the radeonsi driver.
Here is the relevant debug information:
0:00:00.486535445 64831 0x5555559194c0 INFO vaapisink gstvaapipluginbase.c:510:ensure_sinkpad_allocator:<vaapisink0> enabling direct upload in sink allocator
0:06:30.602682940 64831 0x5555559194c0 DEBUG vaapi gstvaapisurface.c:422:gst_vaapi_surface_new_full: size 320x240, format I420, flags 0x00000000
0:06:30.612541423 64831 0x5555559194c0 DEBUG vaapi gstvaapisurface.c:232:gst_vaapi_surface_init_full: surface 0x1
0:06:36.702221249 64831 0x5555559194c0 DEBUG vaapi gstvaapiutils.c:131:vaapi_check_status: vaDeriveImage(): operation failed
0:06:41.037897599 64831 0x5555559194c0 INFO vaapivideomemory gstvaapivideomemory.c:723:gst_video_info_update_from_surface: Cannot create a VA derived image from surface 0x5555558f9660
0:10:59.040803341 64831 0x5555559194c0 DEBUG vaapi gstvaapisurface.c:76:gst_vaapi_surface_free: surface 0x1
0:12:57.562446094 64831 0x5555559194c0 DEBUG vaapivideomemory gstvaapivideomemory.c:893:allocator_configure_surface_info:<vaapivideoallocator0> success to set the surface format I420 for video format I420 with native uploading
allocator_configure_surface_info()
is called with req_usage_flag=GST_VAAPI_IMAGE_USAGE_FLAG_DIRECT_UPLOAD
, allocation_info->format=GST_VIDEO_FORMAT_I420
.
gst_video_info_update_from_surface()
returns false, because the vaDeriveImage()
fails. However the function allocator_configure_surface_try_specified_format()
return true in that case, which is handled as a success, that prevents trying "Step2" with function allocator_configure_surface_try_other_format()
.
If allocator_configure_surface_try_other_format()
was used then, the surface format would be NV12
, and the crash in mesa would go away. I tested this possibility manually in the debugger, and it seems to work as expected.
I'm not sure if this is the expected behavior?