[FFmpeg-user] Intel kmsgrab VAAPI interop assertions

Marton Balint cus at passwd.hu
Thu Sep 19 21:42:59 EEST 2019


Hi,

I made some tests with kmsgrab (I have used the vaapi interop) and it 
seems to me that sometimes if an app (e.g.: ffplay) is in fullscreen it 
does not capture a fully drawn framebuffer but the one which is being 
drawn to and which has not been presented to the user.

Also sometimes the capture stops with errors like this:

ffmpeg: ../intel/intel_bufmgr_gem.c:1409: drm_intel_gem_bo_unreference: 
Assertion `atomic_read(&bo_gem->refcount) > 0' failed.

or like this:

[AVHWFramesContext @ 0x556a74d116c0] Failed to create surface from DRM 
object: 18 (invalid parameter).

Example command (using a 4k framebuffer). Tested on Ubuntu 18.04 with 
kernel from hwe (5.0). Also tried updating xorg/drm packages from 19.04, 
but it does not seem to make a difference.

ffmpeg -vsync vfr -vaapi_device /dev/dri/renderD128 \
   -y -f kmsgrab -framerate 50 -i none \
   -vf 'hwmap=derive_device=vaapi,scale_vaapi=3840:2160:nv12' \
   -codec:v mjpeg_vaapi -f image2 -update 1 -atomic_writing 1 "${OUTFILE}.jpg"

Output:

ffmpeg version 4.1.3-0ubuntu1 Copyright (c) 2000-2019 the FFmpeg 
developers
   built with gcc 8 (Ubuntu 8.3.0-6ubuntu1)
   configuration: --prefix=/usr --extra-version=0ubuntu1 
--toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu 
--incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl 
--disable-stripping --enable-avresample --disable-filter=resample 
--enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom 
--enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca 
--enable-libcdio --enable-libcodec2 --enable-libflite 
--enable-libfontconfig --enable-libfreetype --enable-libfribidi 
--enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame 
--enable-libmysofa --enable-libopenjpeg --enable-libopenmpt 
--enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband 
--enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex 
--enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab 
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp 
--enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq 
--enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl 
--enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 
--enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
   libavutil      56. 22.100 / 56. 22.100
   libavcodec     58. 35.100 / 58. 35.100
   libavformat    58. 20.100 / 58. 20.100
   libavdevice    58.  5.100 / 58.  5.100
   libavfilter     7. 40.101 /  7. 40.101
   libavresample   4.  0.  0 /  4.  0.  0
   libswscale      5.  3.100 /  5.  3.100
   libswresample   3.  3.100 /  3.  3.100
   libpostproc    55.  3.100 / 55.  3.100
[kmsgrab @ 0x556135cefcc0] Using plane 30 to locate framebuffers.
[kmsgrab @ 0x556135cefcc0] Template framebuffer is 143: 3840x2160 32bpp 
24b depth.
Input #0, kmsgrab, from 'none':
   Duration: N/A, start: 1568913476.535418, bitrate: N/A
     Stream #0:0: Video: wrapped_avframe, drm_prime, 3840x2160, 50 tbr, 
1000k tbn, 1000k tbc
Stream mapping:
   Stream #0:0 -> #0:0 (wrapped_avframe (native) -> mjpeg (mjpeg_vaapi))
Press [q] to stop, [?] for help
Output #0, image2, to '/mnt/compliance/out.jpg':
   Metadata:
     encoder         : Lavf58.20.100
     Stream #0:0: Video: mjpeg (mjpeg_vaapi), vaapi_vld, 3840x2160, q=2-31, 
50 fps, 50 tbn, 50 tbc
     Metadata:
       encoder         : Lavc58.35.100 mjpeg_vaapi
ffmpeg: ../intel/intel_bufmgr_gem.c:1409: drm_intel_gem_bo_unreference: 
Assertion `atomic_read(&bo_gem->refcount) > 0' failed.
Aborted

Until the app is in a window, everything seems to work. If I switch it to 
fullscreen, it will fail sooner or later. Happens with a 4.2 release as 
well. I used the lightweight nodm window manager for testing. Happens with 
ICEWM as well.

Any ideas?

Thanks,
Marton


More information about the ffmpeg-user mailing list