[radeonsi][vaapi][bisected] invalid VASurfaceID when playing interlaced DVB stream in Kodi
VAAPI deinterlacing seem to be broken in currrent Mesa git while it works in Mesa v19.3.3. Playing back interlaced stream on Kodi with Mesa from git makes Kodi complain about invalid VASurfaceID, see the kodi.log below.
kodi.log:
2020-01-26 17:23:22.926 T:771188 NOTICE: Whitelist search for: width: 1920, height: 1080, fps: 50.000, 3D: false
2020-01-26 17:23:22.926 T:771188 NOTICE: Display resolution ADJUST : 1920x1080 @ 50.000000 Hz (29) (weight: 4491904690101528145450749847811391488.000)
2020-01-26 17:23:22.928 T:771188 NOTICE: GL: Selecting YUV 2 RGB shader
2020-01-26 17:23:22.929 T:771188 NOTICE: GL: Using GL_ARB_pixel_buffer_object
2020-01-26 17:23:22.929 T:838192 ERROR: VAAPI/vpp vaRenderPicture error: invalid VASurfaceID (6)
2020-01-26 17:23:22.930 T:838190 ERROR: Previous line repeats 3 times.
2020-01-26 17:23:22.930 T:838190 WARNING: VAAPI::FFGetBuffer - no surface available - dec: 0, render: 0
2020-01-26 17:23:24.952 T:838190 ERROR: VAAPI::Decode - timed out waiting for output message - decoded: 0, proc: 0, has free surface: no
2020-01-26 17:23:24.952 T:838190 WARNING: VAAPI::FFGetBuffer - returning due to awaiting recovery
2020-01-26 17:23:24.953 T:838192 ERROR: VAAPI::COutput::Uninit - not all CPostprcs released
2020-01-26 17:23:24.953 T:838192 NOTICE: COutput::OnExit: Output Thread terminated
2020-01-26 17:23:24.953 T:838190 NOTICE: VAAPI::Close - closing decoder context
2020-01-26 17:23:24.973 T:838269 NOTICE: COutput::OnStartup: Output Thread created
2020-01-26 17:23:25.062 T:838190 NOTICE: Previous line repeats 1 times.
2020-01-26 17:23:25.062 T:838190 WARNING: CVideoSurfaces::ClearReference - surface invalid
2020-01-26 17:23:25.063 T:838190 NOTICE: CDVDVideoCodecFFmpeg::CDropControl: calculated diff time: 120000
2020-01-26 17:23:25.070 T:838270 ERROR: VAAPI/vpp vaRenderPicture error: invalid VASurfaceID (6)
2020-01-26 17:23:25.078 T:838190 ERROR: Previous line repeats 3 times.
2020-01-26 17:23:25.078 T:838190 NOTICE: CDVDVideoCodecFFmpeg::CDropControl: lost diff
2020-01-26 17:23:25.079 T:838270 ERROR: VAAPI/vpp vaRenderPicture error: invalid VASurfaceID (6)
2020-01-26 17:23:25.080 T:838190 ERROR: Previous line repeats 1 times.
2020-01-26 17:23:25.080 T:838190 WARNING: VAAPI::FFGetBuffer - no surface available - dec: 0, render: 0
2020-01-26 17:23:27.101 T:838190 ERROR: VAAPI::Decode - timed out waiting for output message - decoded: 0, proc: 0, has free surface: no
2020-01-26 17:23:27.101 T:838190 WARNING: VAAPI::FFGetBuffer - returning due to awaiting recovery
2020-01-26 17:23:27.103 T:838270 NOTICE: COutput::OnExit: Output Thread terminated
2020-01-26 17:23:27.105 T:838332 NOTICE: COutput::OnStartup: Output Thread created
2020-01-26 17:23:27.194 T:838190 NOTICE: Previous line repeats 1 times.
2020-01-26 17:23:27.194 T:838190 WARNING: CVideoSurfaces::ClearReference - surface invalid
2020-01-26 17:23:27.194 T:838190 NOTICE: VAAPI::Close
2020-01-26 17:23:27.194 T:838332 NOTICE: COutput::OnExit: Output Thread terminated
2020-01-26 17:23:27.466 T:771188 NOTICE: VAAPI::Close
2020-01-26 17:23:27.466 T:838269 ERROR: VAAPI::COutput::Uninit - not all CPostprcs released
2020-01-26 17:23:27.466 T:838269 NOTICE: COutput::OnExit: Output Thread terminated
2020-01-26 17:23:27.466 T:771188 ERROR: VAAPI/vpp vaSyncSurface error: invalid VADisplay (3)
2020-01-26 17:23:27.466 T:771188 ERROR: Previous line repeats 6 times.
This commit seem to be the cause for the above errors
commit 2add63060b51ea2ae432d10e1bd52d6cc0a4dcbb
Author: Thong Thai <thong.thai@amd.com>
Date: Wed Dec 18 17:02:02 2019 -0500
st/va: Convert interlaced NV12 to progressive
In vlVaDeriveImage, convert interlaced NV12 buffers to progressive.
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1193
Signed-off-by: Thong Thai <thong.thai@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3157>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3157>
My ability to read the code is limited at best, but it seems to me that the above commit makes Mesa "deinterlace" always regardless of VAAPI PP settings. Hence I assume Kodi detects that the buffer isn't actually interlaced and reconfigures itself accordingly - which causes 1-2 seconds of "black screen" at the beginning of videostream, and also all those VAAPI/vpp/VASurfaceID errors.
Reverting the above commit "fixes" these "black screens"/error messages and makes VAAPI deinterlacing work again when playing interlaced DVB streams.
Ping @thongthai since he is the author of the above commit
Software versions that I'm using
- Kodi v19 from git
- kernel 5.4.13
- mesa v20 from git
- llvm 9.0.1
My GPU
GL_VENDOR = X.Org
GL_RENDERER = AMD Radeon (TM) RX 460 Graphics (POLARIS11, DRM 3.35.0, 5.4.0-3-amd64, LLVM 9.0.1)
GL_VERSION = 4.6 (Core Profile) Mesa 20.0.0-devel
GL_SHADING_LANGUAGE_VERSION = 4.60