0

I have a full-screen Qt app running on a Raspberry Pi 3 using the "eglfs" platform. It draws using KMS/DRM and the /dev/dri/core0 GPU device. The GPU is a Broadcom VideoCore IV.

I'd like to record the screen and have not been successful. The closest I've got is:

  1. Using ffmpeg and the kmsgrab input device. Unfortunately ffmpeg -f kmsgrab -i - -vf 'hwdownload,format=bgr0' output.mp4 produces garbled video, as shown below.

    Garbled output from ffmpeg

  2. Redirect Qt to the framebuffer. For example: ./my_app -platform linuxfb:fb=/dev/fb0. Then the more straight-forward ffmpeg -f fbdev -i /dev/fb0 output.mp4 works. Unfortunately linuxfb does not render features from Qt5Compat.GraphicalEffects such as layer.effect, so my buttons do not show.

Given the garbled output from ffmpeg seems so close, I've tried passing various format_modifier's from drm_fourcc.h but have not seen any difference. Surely there's a set of hwmap or format_modifier flags that will ensure the output resembles what appears on screen?

For reference I'm using kernel version 5.4.83-v8 and dtoverlay=vc4-fkms-v3d. I could adjust those things if I thought it would make any difference.

3
  • jkqxz in #ffmpeg on IRC kindly identified the distortion as likely to be the Broadcom VC4 "T" format tiling, DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED. Alas, we still don't have a way to decode it. The hwdownload filter can only deal with linear (as documented), the untile video filter does not help, and attempts to use the vulkan device for hwmap result in "Failed to created derived device context: -12. ... Cannot allocate memory". Commented Mar 29, 2022 at 14:36
  • You can change the pixel format of eglfs in a config. See github.com/qt/qtbase/blob/5.15.2/src/plugins/platforms/eglfs/… There doesn't seem to be a way to explicitly disable modifiers, but maybe a different pixel format doesn't support tiling, so it gets disabled. It could also be that eglfs_kms isn't being used. Commented Mar 31, 2022 at 12:38
  • @any1 I tried creating some simple config.json ({"device": "/dev/dri/card0","outputs": [{"name": "DSI","format": "xrgb2101010"}]}) and launching the app with QT_QPA_EGLFS_KMS_CONFIG=config.json. I couldn't detect any difference. Commented Apr 4, 2022 at 11:52

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.