libva-v4l2-request: RK3588 VDPU381 VP9 decode (fork)
Hi all,
Now that the PM runtime teardown cleanup [1] has made stateless VP9 decode usable on RK3588 VDPU381, I would like to announce a small fork of bootlin's libva-v4l2-request that adds the userspace side. VP9 Profile 0 output on this hardware is pixel-identical with libvpx, verified frame by frame against the software reference with ffmpeg framemd5 on a 1080p59.94 reference clip (3000 consecutive frames, all matching).
Source : https://github.com/dongioia/libva-v4l2-request
branch rk3588-vp9
Kernel : Linux 7.1-rc2 + [1] (queued for stable) Tested : Radxa Rock 5B+, mpv --hwdec=vaapi-copy on 1080p VP9.
CPU drops from ~113 % software to ~56 % with hardware decode and NV12 readback (Cortex-A76 @ 2.4 GHz).
The substantive change against bootlin's tree is a port of FFmpeg's range-coded VP9 compressed-header parser (vpx_rac + read_prob_delta + fill_compressed_hdr equivalent), with the interp_filter probability read gated on FILTER_SWITCHABLE per VP9 spec § 6.3.10. That gate alone is the difference between "green chroma after the first alt-ref" and pixel-identical output on this hardware.
A second change moves the V4L2 OUTPUT / CAPTURE format setup, REQBUFS and STREAMON out of RequestCreateContext into a helper that is also called eagerly from vaCreateSurfaces. It keeps probe-pattern clients (mpv --hwdec=vaapi, VLC's glconv_vaapi) from failing fast on vaDeriveImage before any decode has happened.
Known limits, for full disclosure:
- VLC and Chromium's native VAAPI path are not yet usable through this driver. Both import the V4L2 CAPTURE dmabuf into a GL texture via EGL_EXT_image_dma_buf_import_modifiers, and on Mali Valhall
+ Mesa panthor the imported texture does not refresh between frames for the linear NV12 layout exported here. The descriptor is structurally valid; the broken surface is downstream. mpv --hwdec=vaapi-copy (CPU readback) is the supported path for now.
- H.264 and HEVC entrypoints are advertised but unverified on RK3588 in this fork.
- VP9 Profile 2 (10-bit / HDR) is exposed but not tested with the current kernel patch set.
The bootlin tree carries the same architecture, so the same eager-init refactor would presumably help there once VLC's vaPutSurface and the Mesa panthor side are in place.
I am happy to send the work as a series for review against bootlin's tree, or to keep it as a distribution PKGBUILD first while review catches up — whichever is more useful. A PKGBUILD against this fork is up at beryllium-org/sbc-pkgbuilds#4 [2].
[1] https://lore.kernel.org/all/[email protected]
[2] https://github.com/beryllium-org/sbc-pkgbuilds/pull/4
Thanks,
Francesco Saverio Pavone
Hi Francesco,
Le mercredi 20 mai 2026 à 14:07 +0200, Francesco Saverio Pavone a écrit :
Quoted 11 lines
Hi all,
Now that the PM runtime teardown cleanup [1] has made stateless VP9 decode usable on RK3588 VDPU381, I would like to announce a small fork of bootlin's libva-v4l2-request that adds the userspace side. VP9 Profile 0 output on this hardware is pixel-identical with libvpx, verified frame by frame against the software reference with
ffmpeg framemd5on a 1080p59.94 reference clip (3000 consecutive frames, all matching).
For me this approach is deprecated and should not be used. There is several gaps in the VA API that forces deep parsing in the VA driver, which adds yet another layer of parsing and security vulnerability surface. I'm actively working with Vulkan Video group to fill the remaining gaps, and will likely encourage looking toward Vulkan Video instead for cross-platform codec abstraction layer. It was also attempted to improve the VA API in the past, but this was a dead-end, the API is closed by now.
Meanwhile, native implementation exists for GStreamer and Chromium (with VP9 probabilities that got re-added few weeks ago), and being worked on for ffmpeg.
regards,
Nicolas
Quoted 48 lines
branch rk3588-vp9
Kernel : Linux 7.1-rc2 + [1] (queued for stable) Tested : Radxa Rock 5B+, mpv --hwdec=vaapi-copy on 1080p VP9. CPU drops from ~113 % software to ~56 % with hardware decode and NV12 readback (Cortex-A76 @ 2.4 GHz).The substantive change against bootlin's tree is a port of FFmpeg's range-coded VP9 compressed-header parser (
vpx_rac+read_prob_delta+fill_compressed_hdrequivalent), with theinterp_filterprobability read gated onFILTER_SWITCHABLEper VP9 spec § 6.3.10. That gate alone is the difference between "green chroma after the first alt-ref" and pixel-identical output on this hardware.A second change moves the V4L2 OUTPUT / CAPTURE format setup, REQBUFS and STREAMON out of RequestCreateContext into a helper that is also called eagerly from vaCreateSurfaces. It keeps probe-pattern clients (mpv --hwdec=vaapi, VLC's
glconv_vaapi) from failing fast on vaDeriveImage before any decode has happened.Known limits, for full disclosure:
- VLC and Chromium's native VAAPI path are not yet usable through this driver. Both import the V4L2 CAPTURE dmabuf into a GL texture via
EGL_EXT_image_dma_buf_import_modifiers, and on Mali Valhall
+ Mesa panthor the imported texture does not refresh between frames for the linear NV12 layout exported here. The descriptor is structurally valid; the broken surface is downstream. mpv --hwdec=vaapi-copy (CPU readback) is the supported path for now.
- H.264 and HEVC entrypoints are advertised but unverified on RK3588 in this fork.
- VP9 Profile 2 (10-bit / HDR) is exposed but not tested with the current kernel patch set.The bootlin tree carries the same architecture, so the same eager-init refactor would presumably help there once VLC's vaPutSurface and the Mesa panthor side are in place.
I am happy to send the work as a series for review against bootlin's tree, or to keep it as a distribution PKGBUILD first while review catches up — whichever is more useful. A PKGBUILD against this fork is up at beryllium-org/sbc-pkgbuilds#4 [2].
[1]
https://lore.kernel.org/all/[email protected]
[2] https://github.com/beryllium-org/sbc-pkgbuilds/pull/4Thanks,
Francesco Saverio Pavone