A V4L2 plugin that wraps rockchip-mpp for the chromium's V4L2 VDA/VEA (requires custom patches to enable those features).
The original idea comes from v4l-gst.
- v4l-utils - with this patch:
0001-libv4l2-Support-mmap-to-libv4l-plugin.patch - rockchip-mpp
- linux-rga
$ meson build
$ meson compile -C build
-
Install libv4l-rkmpp.so into /usr/lib/libv4l/plugins/
-
Create dummy V4L2 device files for chromium VDA/VEA in boot service:
# echo dec > /dev/video-dec0
# chmod 666 /dev/video-dec0
# echo enc > /dev/video-enc0
# chmod 666 /dev/video-enc0
-
Configure codec capabilities
The codec capabilities (depends on chip spec) are configurable in device files:
# cat /dev/video-dec0
log-fps=1
log-level=2
type=dec
codecs=VP8:VP9:H.264:H.265:AV1
max-height=1920
max-width=1080
-
Run chromium's VDA/VEA
The VDA's thumbnail tests would fail, which is harmless since we are not in the md5 checksum list
The VEA's CacheLineUnalignedInputTest test might crash, which is due to VEA buffer managing issue.
-
Run with chromium browser:
export XDG_RUNTIME_DIR=/run/user/0
chromium --no-sandbox --gpu-sandbox-start-early --ignore-gpu-blacklist
This plugin is tested with custom chromium on rk3399
-
There're a lot of chromium related hacks in it, might not work for other apps.
For proper decoding usage, there's a ffmpeg solution with a few extra buffer copies.
-
MPP reports errors?
Try the newest MPP release branch or develop branch or the commit with the closest commit date.
Also test with the mpi_dec_test to check if the MPP works:
# mpi_dec_test -t 7 -i test-25fps.h264
-
The plugin complaining about "ERR: failed to init rga"?
Make sure "/dev/rga" exists and accessable by the chromium.
-
How to get more verbose logs?
For chromium, use these command line flags to change the log level: --enable-logging --vmodule=/media/gpu=4
For libv4l-rkmpp, set the "LIBV4L_RKMPP_LOG_LEVEL" environment variable to change the log level. And set "LIBV4L_RKMPP_LOG_FPS" to enable logging fps.
For MPP, set the environment variable "mpp_debug", "rkv_h264d_debug", "mpp_dec_debug", "mpi_debug", etc. to change the modules' log levels.
For vpu driver, write verbose log level to "/sys/module/rk_vcodec/parameters/debug".
-
What about the performance?
The performance should be much the same as other MPP based decoders/encoders (e.g. mpi_dec_test and gstreamer MPP plugin).
And the performance would mostly related to the video's attributes (e.g. resolution and bitrate) and the vpu clock rates.
- Jeffy Chen
<jeffy.chen@rock-chips.com>