[UPDATE 2018/05/21: I have created a script to configure everything described in this tutorial, plus some more things. There will be no updates to the tutorial from now on. Please refer all the questions and bug reports to the script. It can be found here:]
[UPDATE 2018/03/16: Fixed mpv package]
[UPDATE 2018/03/01: Added OpenCL testing through GPU cryptocurrency mining]
With the new default kernel based on rockchip-linux, boards with RK3288 SoC have now full kernel support for interacting with the GPU and hardware video decoder. Rockchip-linux also provides userspace libraries and other software to make everything work. In this tutorial, you'll learn to set everything up in a current Armbian Xenial default image.
(Note: rockchip-linux uses Debian Stretch as their base distro for all their packages. So we would be better off using the Stretch Armbian image, but it is still not stable enough for production. Therefore, we are going to install a few backports over the Xenial image, to make everything work)
Install all the packages under the "libs" directory, in the file you downloaded and extracted.
3. Install and configure tweaked X server
In order to make graphic acceleration work under X, rockchip-linux developers have created a tweaked X server. To enable it:
You need to disable compositing. In the Xfce menu, navigate to "Settings > Window Manager Tweaks", choose the rightmost tab (Compositor), and uncheck "Enable display compositing".
Install the packages under the "xserver" directory of our downloaded compressed file
Make a backup of the file "/etc/X11/xorg.conf.d/01-armbian-defaults.conf", and replace its content with the following:
Section "Device"
Identifier "Rockchip Graphics"
Driver "modesetting"
Option "AccelMethod" "glamor" ### "glamor" to enable 3D acceleration, "none" to disable
Option "DRI" "2"
# You can disable Vsync for better 3D benchmark score, at the cost of worst video playing. Not recommended.
# Option "Dri2Vsync" "false"
EndSection
Section "Screen"
Identifier "Default Screen"
SubSection "Display"
Depth 24
Modes "1920x1080" "1280x1024" "1024x768" "800x600"
EndSubSection
EndSection
3. Restart X
4. Test 3D acceleration
$ sudo apt install glmark2-es2
$ glmark2-es2
If everything is working, you shoud see a window with rotating 3D objects, and console output shoud start like this:
=======================================================
glmark2 2014.03+git20150611.fa71af2d
=======================================================
OpenGL Information
GL_VENDOR: ARM
GL_RENDERER: Mali-T760
GL_VERSION: OpenGL ES 3.2 v1.r14p0-01rel0-git(966ed26).eedaf0c5244add8e249cecdd3c721329
=======================================================
5. Test video acceleration with MPV
Install the package under the directory "mpv".
When you play a video with this version, it will use GPU EGL accelerated video display, but decoding will still be via software. That means you can play up to 1080p@30fps HVEC quite smoothly, with around 80-90% CPU use. Anything above that resolution/fps will be jerky.
In order to use full acceleration with MPV, you need to be under Wayland. I intend to do some other post on that, God willing.
6. Test video acceleration with Gstreamer
The "official" way of using full HW video acceleration under X is via a special Gstreamer plugin created by the rockchip-linux developers. But we need to install a backported version of Gstreamer, in order for the plugin to work.
Install all the packages in the "gstreamer-backport" directory
Install all the packages in the "gstreamer" folder (these are for the rockchip plugin)
Do "sudo apt -f install" for the unmet dependencies
You can now play a video from command line with either of these commands:
This plugin uses GPU acceleration for display, through a KMS overlay, and also hardware decoding via the rockchip mpp interface. You can play 4k@30fps HEVC with perfect smoothness, while the CPU stays under 15% use. If you don't have any 4k video, you can try with this one: http://www.libde265.org/hevc-bitstreams/sintel-4096x1744-cfg02.mkv
(Notice that if you try to display any subtitle, it will make the plugin crash).
7. Install a Gstreamer demo player
Instead of launching videos through the command line, you can also install a simple video player that will use the rockchip plugin.
2. Create the file "/usr/share/applications/demo-player.desktop" with the following content:
#!/usr/bin/env xdg-open
[Desktop Entry]
Categories=Qt;KDE;AudioVideo;Player;Video;
Comment=A gstreamer base player
Exec=env QT_GSTREAMER_WIDGET_VIDEOSINK=rkximagesink /usr/lib/arm-linux-gnueabihf/qt5/examples/multimediawidgets/player/player --geometry 960x640+0+0
GenericName=Media Player
Icon=/usr/share/icons/gnome/48x48/categories/applications-multimedia.png
Name=Media Player
Type=Application
X-KDE-StartupNotify=false
Keywords=movie;player;media;kde;qt;
X-Ayatana-Desktop-Shortcuts=Screen;Window
Now you will see an entry "Media Player" in the Xfce menu, and you can also choose to play video files with this player by right-clicking on them and choosing "Open with..."
8. Enable acceleration for Chromium
For last, we are going to enable acceleration for Chromium Web Browser
Backup the file "/etc/chromium-browser/default", and modify it to look like this:
# Default settings for chromium-browser. This file is sourced by /bin/sh from
# /usr/bin/chromium-browser
# Options to pass to chromium-browser
# A set of command line flags that we want to set by default.
# Do not hide any extensions in the about:extensions dialog
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --show-component-extension-options"
# Don't use the GPU blacklist (bug #802933)
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --ignore-gpu-blacklist"
# Use EGL acceleration
export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --use-gl=egl"
Launch Chrome, and enter in the address bar "chrome://gpu". If everything is OK, you should see something like this:
Now, go to the Chrome Web Store and install the extension "h264ify". It will force youtube to use H264 instead of VP9, which has no acceleration with RK3288.
Enter Youtube and play any 1080p video. It should play fairly well, dropping frames only when some kind of overlay pops up (like an ad on top of the video, or the controls overlay).
Question
JMCC
[UPDATE 2018/05/21: I have created a script to configure everything described in this tutorial, plus some more things. There will be no updates to the tutorial from now on. Please refer all the questions and bug reports to the script. It can be found here:]
[UPDATE 2018/03/16: Fixed mpv package]
[UPDATE 2018/03/01: Added OpenCL testing through GPU cryptocurrency mining]
With the new default kernel based on rockchip-linux, boards with RK3288 SoC have now full kernel support for interacting with the GPU and hardware video decoder. Rockchip-linux also provides userspace libraries and other software to make everything work. In this tutorial, you'll learn to set everything up in a current Armbian Xenial default image.
(Note: rockchip-linux uses Debian Stretch as their base distro for all their packages. So we would be better off using the Stretch Armbian image, but it is still not stable enough for production. Therefore, we are going to install a few backports over the Xenial image, to make everything work)
Start by downloading and extracting this compressed file: https://mega.nz/#!hrxy0bra!pOD0L_vIaq3wn0DWwRGYGsT2PSUIJG-HZbcyrJ4m6As
It contains all the packages I am going to refer to in the tutorial
1. Install backported X server from the ubuntu repos
$ sudo apt install xserver-xorg-hwe-16.04 xserver-xorg-video-fbdev-hwe-16.04
2. Install libraries
Install all the packages under the "libs" directory, in the file you downloaded and extracted.
3. Install and configure tweaked X server
In order to make graphic acceleration work under X, rockchip-linux developers have created a tweaked X server. To enable it:
Section "Device" Identifier "Rockchip Graphics" Driver "modesetting" Option "AccelMethod" "glamor" ### "glamor" to enable 3D acceleration, "none" to disable Option "DRI" "2" # You can disable Vsync for better 3D benchmark score, at the cost of worst video playing. Not recommended. # Option "Dri2Vsync" "false" EndSection Section "Screen" Identifier "Default Screen" SubSection "Display" Depth 24 Modes "1920x1080" "1280x1024" "1024x768" "800x600" EndSubSection EndSection
3. Restart X
4. Test 3D acceleration
$ sudo apt install glmark2-es2 $ glmark2-es2
If everything is working, you shoud see a window with rotating 3D objects, and console output shoud start like this:
======================================================= glmark2 2014.03+git20150611.fa71af2d ======================================================= OpenGL Information GL_VENDOR: ARM GL_RENDERER: Mali-T760 GL_VERSION: OpenGL ES 3.2 v1.r14p0-01rel0-git(966ed26).eedaf0c5244add8e249cecdd3c721329 =======================================================
5. Test video acceleration with MPV
Install the package under the directory "mpv".
When you play a video with this version, it will use GPU EGL accelerated video display, but decoding will still be via software. That means you can play up to 1080p@30fps HVEC quite smoothly, with around 80-90% CPU use. Anything above that resolution/fps will be jerky.
In order to use full acceleration with MPV, you need to be under Wayland. I intend to do some other post on that, God willing.
6. Test video acceleration with Gstreamer
The "official" way of using full HW video acceleration under X is via a special Gstreamer plugin created by the rockchip-linux developers. But we need to install a backported version of Gstreamer, in order for the plugin to work.
This plugin uses GPU acceleration for display, through a KMS overlay, and also hardware decoding via the rockchip mpp interface. You can play 4k@30fps HEVC with perfect smoothness, while the CPU stays under 15% use. If you don't have any 4k video, you can try with this one: http://www.libde265.org/hevc-bitstreams/sintel-4096x1744-cfg02.mkv
(Notice that if you try to display any subtitle, it will make the plugin crash).
7. Install a Gstreamer demo player
Instead of launching videos through the command line, you can also install a simple video player that will use the rockchip plugin.
$ sudo apt-get install libqt5opengl5 libqt5qml5 libqt5quick5 libqt5widgets5 libqt5gui5 libqt5core5a qml-module-qtquick2 libqt5multimedia5 libqt5multimedia5-plugins libqt5multimediaquick-p5 qtmultimedia5-examples qtmultimedia5-doc-html
2. Create the file "/usr/share/applications/demo-player.desktop" with the following content:
#!/usr/bin/env xdg-open [Desktop Entry] Categories=Qt;KDE;AudioVideo;Player;Video; Comment=A gstreamer base player Exec=env QT_GSTREAMER_WIDGET_VIDEOSINK=rkximagesink /usr/lib/arm-linux-gnueabihf/qt5/examples/multimediawidgets/player/player --geometry 960x640+0+0 GenericName=Media Player Icon=/usr/share/icons/gnome/48x48/categories/applications-multimedia.png Name=Media Player Type=Application X-KDE-StartupNotify=false Keywords=movie;player;media;kde;qt; X-Ayatana-Desktop-Shortcuts=Screen;Window
Now you will see an entry "Media Player" in the Xfce menu, and you can also choose to play video files with this player by right-clicking on them and choosing "Open with..."
8. Enable acceleration for Chromium
For last, we are going to enable acceleration for Chromium Web Browser
# Default settings for chromium-browser. This file is sourced by /bin/sh from # /usr/bin/chromium-browser # Options to pass to chromium-browser # A set of command line flags that we want to set by default. # Do not hide any extensions in the about:extensions dialog export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --show-component-extension-options" # Don't use the GPU blacklist (bug #802933) export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --ignore-gpu-blacklist" # Use EGL acceleration export CHROMIUM_FLAGS="$CHROMIUM_FLAGS --use-gl=egl"
Launch Chrome, and enter in the address bar "chrome://gpu". If everything is OK, you should see something like this:
Now, go to the Chrome Web Store and install the extension "h264ify". It will force youtube to use H264 instead of VP9, which has no acceleration with RK3288.
Enter Youtube and play any 1080p video. It should play fairly well, dropping frames only when some kind of overlay pops up (like an ad on top of the video, or the controls overlay).
Test WebGL, for example with this page: http://webglsamples.org/aquarium/aquarium.html
9. NEW: Testing OpenCL with a GPU cryptocurrency miner
Mining with the skein algorithm:
Please report your experiences and suggestions. Wayland testing stays in the to-do list. Thanks,.
Link to comment
Share on other sites
68 answers to this question
Recommended Posts