Getting open-source multimedia drivers on Arm Linux is one of the most difficult tasks, that’s why there’s no much talk about open-source GPU drivers for 2D & 3D graphics acceleration, but work on video hardware decoding and encoding is also a challenge.
We’ve previously seen Bootlin work on Cedrus open-source driver for Allwinner VPU (Video Processing Unit), but Collabora has been working on open-source drivers for VeriSilicon’s Hantro G1 and G2 VPU found in some Rockchip, NXP, and Microchip processors.
The company previously managed to have Hantro G1 open-source driver for JPEG, MPEG-2, VP8, and H.264 codecs, but H.265/HEVC relies on Hantro G2, and the patch for H.265 hardware video decoding on NXP i.MX 8M Quad has just been submitted to mainline Linux.
Benjamin Gaignard explains more in his commit message:
The IMX8MQ got two VPUs but until now only G1 has been enabled This series aim to add the second VPU (aka G2) and provide basic HEVC decoding support.
To be able to decode HEVC it is needed to add/update some of the structures in the uapi. In addition of them one HANTRO dedicated control is required to inform the driver of the numbre of bits to skip at the beginning of the slice header. The hardware require to allocate few auxiliary buffers to store the references frame, scaling list or tile size data.
The driver has been tested with fluster test suite stream.
For example with this command: ./fluster.py run -ts JCT-VC-HEVC_V1 -d GStreamer-H.265-V4L2SL-Gst1.0
The test application relies on the Gstreamer framework and a V4L2 Hantro driver, and you can check out the details by running the command:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
./v4l2-compliance -m 1 v4l2-compliance 1.21.0-4705, 64 bits, 64-bit time_t v4l2-compliance SHA: 733f7a54f79d 2021-02-03 08:25:49 Compliance test for hantro-vpu device /dev/media1: Media Driver Info: Driver name : hantro-vpu Model : hantro-vpu Serial : Bus info : platform: hantro-vpu Media version : 5.11.0 Hardware revision: 0x00000000 (0) Driver version : 5.11.0 Required ioctls: test MEDIA_IOC_DEVICE_INFO: OK test invalid ioctls: OK Allow for multiple opens: test second /dev/media1 open: OK test MEDIA_IOC_DEVICE_INFO: OK test for unlimited opens: OK Media Controller ioctls: test MEDIA_IOC_G_TOPOLOGY: OK Entities: 3 Interfaces: 1 Pads: 4 Links: 4 test MEDIA_IOC_ENUM_ENTITIES/LINKS: OK test MEDIA_IOC_SETUP_LINK: OK |
For reference, v4l2-compliance is part of v4l-utils package, and in Debian/Ubuntu can be installed with apt:
1 |
sudo apt install v4l-utils |
The “m” option is used to select the /dev/media? node, e.g. /dev/media1.
Benjamin further explains that Hantro G1/G2 are stateless accelerators meaning they do no need firmware to operate, which makes those better suited for open-source implementation in a blog post on Collabora. Specifically, the driver is divided into two parts with a kernel driver (Video4Linux2 Hantro driver), and a userspace component such as GStreamer and FFMPEG.
The open-source Hantro driver is still in the staging directory reserved for WiP code, so further work will be needed to make it a stable API and have it used by userland programs by default. Going forward, Collabora will also work on VP9 decoding and V4L2 hardware-accelerated encoding.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress
Cool!
I’ve asked if this would be applicable to Rockchip processors, and apparently no:
In similar news, Microchip SAMA5D4’s Hantro VPU support have been added to mainline Linux
https://lore.kernel.org/linux-media/d674ef0f-b73d-ca99-6287-66545edc72aa@xs4all.nl/T/#t