[VAAPI][radeonsi][Raven/Picasso] The CS has been cancelled because the context is lost.
Hello!
When I try to encode two or more videos simultaneously using the h264_vaapi / hevc_vaapi
encoder in ffmpeg
, the amdgpu
driver will reset and the display will be lost. I tried kernel versions from 5.4 to 5.7 and mesa 19 and mesa 20 with no luck.
I found error messages about drm
and amdgpu
in the logs of dmesg
and ffmpeg
. It should be noted that the same ffmpeg command runs fine on my Vega 64 and Intel iGPU, and will only fail on the 3400G with VCN and cause the driver to reset.
Since Vega 64 and Vega 11 are in the same series but the former has UVD/VCE and the latter has a newer VCN, I read the relevant source code and found that the kernel drivers of the two are quite different, which may be the cause of this error.
- CPU: Ryzen5 3400G/Ryzen3 2200G
- GPU: Vega 11/Vega 8
- VRAM: 4096M
- OS: Manjaro GNOME
- Kernel: 5.7
- Mesa: 20.2-devel
Similar issues have been fixed in VCE:
https://lists.freedesktop.org/archives/amd-gfx/2017-November/016226.html
https://bugs.freedesktop.org/show_bug.cgi?id=102296
dmesg and ffmpeg logs:
[drm:amdgpu_job_timedout [amdgpu]] *ERROR* ring vcn_enc0 timeout, signaled seq=22931, emitted seq=22933
[drm:amdgpu_job_timedout [amdgpu]] *ERROR* Process information: process ffmpeg pid 7250 thread ffmpeg:cs0 pid 7251
amdgpu 0000:04:00.0: GPU reset begin!
amdgpu: amdgpu_cs_query_fence_status failed.
amdgpu: The CS has been cancelled because the context is lost.