Recommended Posts

So here is the final release of the RK3288 media testing script. Basically, the script provides the following functionality:

Installing all the libraries and system configurations necessary for GPU accelerated X desktop, Chromium WebGL, full VPU video play acceleration up to 4k@30 HEVC (the maximum supported by the SoC), and GLES 3.1 / OpenCL 1.2 support.

Three video players supporting full VPU acceleration (RKMPP) and KMS display (GBM or a X11 DRM "hack", as described by the authors), namely: MPV, Gstreamer and Kodi 18.0 alpha preview.

Two example programs using the OpenCL functionality: Examples form the Arm Compute Library, and a GPU crypto miner (an old version, but small and simple).

A library that will act as an OpenGL to OpenGL-ES wrapper, allowing you to run programs that use OpenGL 1.5-2.0.

Two additional small packages, that have no big interest from the developer prospective, but I find them interesting to play with: Support libraries for commercial web video streaming (tested with Netflix), and a simple Pulseaudio GTK equalizer using LADSPA.

Here is a more thorough documentation:

Version 2.0 (Bionic):

Spoiler

ARMBIAN UNOFFICIAL RK3288 MEDIA TESTING SCRIPT
----------------------------------------------
v2.0 Bionic - 2018/10/22
This script will install several multimedia-related software pieces in a
RK3288 Ubuntu Bionic Armbian desktop default image (kernel 4.4.y).
Currently it only supports the installation of the features, while
uninstall must be performed manually.
The script must be run in a command line from the same directory it was
unpacked (./media-rk3288.sh), and will ask for superuser privileges if
not launched with "sudo". Each subfolder contains, in addition to the
packages needed for installation, a text file with information about the
sources for those packages.
The script will present the user with a menu where they can select the
features to be installed. Here is a brief description of each option:
- System: This option will install the base libraries, X server packages
and system files configuration. It must be run at least once
before installing any of the other features, or after any
system upgrade that modified X or Chromium configuration.
Enabling system config will also present the user with the
choice of two different versions of the Rockchip X server:
· Stable: The standard version that you can download from
Rockchip repos.
. Experimental: This version is taken from some PR that
didn't make it into the release version, and is supposed
to give better performance. More info here:
https://github.com/rockchip-linux/xserver/pull/10
- Devel: When this option is enabled, the script will install the
development libraries for every other option that is selected.
So, for example, if in your first run of the script you keep
this option disabled and enable the rest, it will install all
the features but without any devel lib. If eventually you need,
e.g., to compile some app requiring Gstreamer development libs,
then you can run again the script, and select only "Devel" and
"Gstreamer", so in that run it will only install Gstreamer with
the development libraries, without touching the rest.
- MPV: This is a RKMPP accelerated version of MPV. In order to use the
hardware acceleration, it needs to make use of KMS for display,
which means that it will ignore the X server if it is running,
and play video in a full-screen overlay, using keyboard or LIRC
to control the player. Type "man mpv" for a list of keyboard
controls (tip: shift+Q will save position and exit).
Alternatively, you can also use software decoding, and output to
a X window with mouse support. It will still have some display
acceleration through X11/EGL, though not as efficient as GBM/KMS.
· To use the X, non-RKMPP version, just type "mpv <file>" in
the console, or use the launcher labeled simply "MPV".
. To use the GBM+RKMPP version, type "mpv-gbm <file>", or use
the "MPV (GBM)" launcher.
· You can use the player even in a console-only session.
- Gstreamer: These are the Rockchip Gstreamer plugins for media playback
and capture.
Notice that the Gstreamer plugin is the only method that
allows full RKMMP+KMS acceleration associated to a X
window.
· To play a video in a X session, use the launcher "Rock-
chip Gst Player".
. From the command line, in a X session, type:
"gst-play-1.0 --videosink=rkximagesink <file>"
. From a console-only session, type:
"gst-play-1.0 --videosink=kmssink <file>"
- CLSamples: A couple of simple programs to test OpenCL capabilities:
· Compiled examples from the Arm Compute Library
. An old GPU crypto miner (cgminer) with support for
extra algorythms like Skein.
They are installed under ~/clsamples, where you can find
a readme.txt file with instructions.
- GL4ES: An Opengl-ES wrapper library that will allow you to use OpenGL
1.5-2.0 compatible programs with hardware acceleration.
More info: https://github.com/ptitSeb/gl4es.
· In order to make it easier to use the library, we have
included a script called "glrun", that will set the proper
environment variables. Launch your OpenGL program like this:
"glrun <command>"
- Streaming: This will install the Widevine and Pepper-Flash libraries
for Chrome, enabling you to stream videos from sites such
as Netflix (tested) or Hulu (untested).
It will also install the h264ify addon, which will force
all Youtube videos to use the H.264 codec.
- Equalizer: A GTK-based equalizer for PulseAudio, using LADSPA. You
need to enable it through the menu entry, and select the
desired preset or tweak your own settings. The "Boosted"
preset is recommended for everyday use.
This package is old and unmaintained, but I still find it
useful.
- Kodi: Kodi 18.0 Leia beta 3. This version is supposed to be stable
enough for normal use. But the main purpose of including Kodi in
the script is to test the new RKMPP+KMS implementation. We don't
intend to offer a full-fledged distribution of Kodi. For that, I
recommend using LibreELEC.
It cannot be launched from an active X session, you need to
switch to a virtual terminal first.
· The "Kodi" desktop launcher will switch you to VT1, launch
Kodi and then bring you back to VT7.
· From the command line, in a X session, type:
"kodi-gbm-wrapper" for the same effect.
· If you are already in a console-only session, you can just
type "kodi".
All the RKMPP accelerated players can handle up to 4K@30 HEVC with
perfect smoothness.
Please report bugs and suggestions in the thread dedicated to this
script at the Armbian Forum. Enjoy!
JMCC.

Version 1.0 (Xenial):

Spoiler

ARMBIAN UNOFFICIAL RK3288 MEDIA TESTING SCRIPT
----------------------------------------------
v1.0 Xenial - 2018/05/16
This script will install several multimedia-related software pieces in a
RK3288 Ubuntu Xenial Armbian desktop default image (kernel 4.4.y).
Currently it only supports the installation of the features, while
uninstall must be performed manually.
The script must be run in a command line from the same directory it was
unpacked (./media-rk3288.sh), and will ask for superuser privileges if
not launched with "sudo". Each subfolder contains, in addition to the
packages needed for installation, a text file with information about the
sources for those packages.
The script will present the user with a menu where they can select the
features to be installed. Here is a brief description of each option:
- System: This option will install the base libraries, X server packages
and system files configuration. It must be run at least once
before installing any of the other features, or after any
system upgrade that modified X or Chromium configuration.
Enabling system config will also present the user with the
choice of two different versions of the Rockchip X server:
· An older version that replaces the standard 1.18.y server
bundled with Xenial, and therefore doesn't need to install
a backported version of the X server.
. The most recent version from the Rockchip Git. It is based
on X server versiojn 1.19.y, so it requires the
installation of a backported X server.
The older version does not have proper video Vsync, so it is
not too recommended for multimedia use. It might also be less
stable, more testing is needed to tell. On the other hand, it
offers the possibility of enabling window manager compositing
and gives a snappier desktop experience.
- Devel: When this option is enabled, the script will install the
development libraries for every other option that is enabled.
So, for example, if in your first run of the script you keep
this option disabled and enable the rest, it will install all
the features but without any devel lib. If eventually you need,
e.g., to compile some app requiring Gstreamer development libs,
then you can run again the script, and select only "Devel" and
"Gstreamer", so in that run it will only install Gstreamer with
the development libraries, without touching the rest.
- MPV: This is a RKMPP accelerated version of MPV. In order to use the
hardware acceleration, it needs to make use of KMS for display,
which means that it will ignore the X server if it is running,
and play video in a full-screen overlay, using keyboard or LIRC
to control the player. Type "man mpv" for a list of keyboard
controls (tip: shift+Q will save position and exit).
Alternatively, you can also use software decoding, and output to
a X window with mouse support. It will still have some display
acceleration through X11/EGL, though not as efficient as GBM/KMS.
· To use the X, non-RKMPP version, just type "mpv <file>" in
the console, or use the launcher labeled simply "MPV".
. To use the GBM+RKMPP version, type "mpv-gbm <file>", or use
the "MPV (GBM)" launcher.
· You can use the player even in a console-only session.
- Gstreamer: These are the Rockchip Gstreamer plugins for media playback
and capture. The plugins themselves are just a few small
libs, but since the version shipped with Xenial is so old,
we need to install also a full Gstreamer 1.12 backport.
It will also install a demo Qt5 player.
Notice that the Gstreamer plugin is the only method that
allows full RKMMP+KMS acceleration associated to a X
window.
· To play a video in a X session, use the launcher "Rock-
chip Gst Player".
. From the command line, in a X session, type:
"gst-play-1.0 --videosink=rkximagesink <file>"
. From a console-only session, type:
"gst-play-1.0 --videosink=kmssink <file>"
- CLSamples: A couple of simple programs to test OpenCL capabilities:
· Compiled examples from the Arm Compute Library
. An old GPU crypto miner (cgminer) with support for
extra algorythms like Skein.
They are installed under ~/clsamples, where you can find
a readme.txt file with instructions.
- Streaming: This will install the Widevine and Pepper-Flash libraries
for Chrome, enabling you to stream videos from sites such
as Netflix (tested) or Hulu (untested).
It will also install the h264ify addon, which will force
all Youtube videos to use the H.264 codec.
- Equalizer: A GTK-based equalizer for PulseAudio, using LADSPA. You
need to enable it through the menu entry, and select the
desired preset or tweak your own settings. The "Boosted"
preset is recommended for everyday use.
This package is old and unmaintained, but I still find it
useful.
- Kodi: A preview of Kodi 18.0 Leia. Since it is still in alpha state,
it is not recommended for regular use, but you can test the
quality of the new RKMPP+KMS implementation that is being
added to this version. It will crash when trying to open a file
from USB sticks or Samba share, so please copy them to the
SD card before testing.
It cannot be launched from an active X session, you need to
switch to a virtual terminal first.
· The "Kodi" desktop launcher will switch you to VT1, launch
Kodi and then bring you back to VT7.
· From the command line, in a X session, type:
"kodi-gbm-wrapper" for the same effect.
· If you are already in a console-only session, you can just
type "kodi".
All the RKMPP accelerated players can handle up to 4K@30 HEVC with
perfect smoothness.
Please report bugs and suggestions in the thread dedicated to this
script at the Armbian Forum. Enjoy!
JMCC.

This script is not officially supported by the Armbian project. It is just a community effort to help the development of the main build, by experimenting with a possible implementation of the media capabilities of this particular SoC.

Therefore, questions about the script should not be laid out as support requests, but as commentaries or community peer-to-peer assistance.

That being said, all commentaries/suggestions/corrections are very welcome. In the same way, I will do my best to help solve any difficulty that may arise regarding the script.

Share this post

Link to post

Share on other sites

@Igor@zador.blood.stained : I packaged the main debs in a way that they don't interfere with the mainstream Ubuntu ones, but at the same time can replace them. E.g.: the X server is called now "xserver-xorg-core-rockchip", but it provides the same version of the upstream "xserver-xorg-core", and therefore does not break anything when replaces it. I didn't care to do that with other packages that are clearly not going to become part of the Armbian build (e.g. Kodi).

Share this post

Link to post

Share on other sites

"kodi-gbm-wrapper" for the same effect.
· If you are already in a console-only session, you can just
type "kodi".

All the RKMPP accelerated players can handle up to 4K@30 HEVC with
perfect smoothness.

Please report bugs and suggestions in the thread dedicated to this
script at the Armbian Forum. Enjoy!

JMCC.

Couldn't get kodi to play any video without crashing... it crashed as soon as attempt to enter video folder.﻿ I've test v18 Leia under LibreELEC and Android without such a problem.

Are you trying to open a video from a USB drive? If you read the docs, it says that the program crashes when trying to open a video from a USB, you must copy them to the SD card. I know it is a hassle, but that is why I say that it is only a preview, not suitable for regular use.

28 minutes ago, Samson said:

I've test v18 Leia under LibreELEC and Android without such a problem.

Was it a RKMPP accelerated version? I am not aware that there is a relesed version of Kodi18 in LibreElec or Android with RKMPP. In other words: if it is a Rockchip device, and you can play smoothly 4k videos, then it uses RKMPP, otherwise it doesn't.

I know Kodi 18 can be more or less stable in some devices. But the RKMPP+GBM implementation is one of the latest incorporations and, according to the docs, it is not stable yet. So it is perfectly normal that you had a better experience with other implementations not using this new and experimental feature.

In case i am wrong, and your Kodi 18 build indeed uses RKMPP+GBM, please tell me the exact version number and I will build it (you can find it in ~/.kodi/temp/kodi.log).

and for Android version I just downloaded the 09 Apr night build from the official site. LibreELEC version is less stable but the Android version I am actually using it in a daily basis with TinkerOS_Android V13.13.0.74, not a single crash. I attempted to switch away from Android because my Air Mouse does not behave well under Android but works well under Linux/Windows.

Share this post

Link to post

Share on other sites

Then we'll need to add that source to the list of ones causing a crash . For now, since it is a testing version, let us stick with videos in the SD card. It is possible that Libreelec has some workaround to prevent that crash. In any case, I don't think it is worth caring much about it, until there is some release (even if it is a beta, but not just a nightly) that supports a stable RKMPP. If it doesn't work then, we'll worry about it.

Also, we must remember that our goal here, for the time being, is not to create a working Kodi desktop, but just to test the RKMPP imprementation under Armbian. We'll let the Kodi developers do their job, and when they finish, we'll try to port it here.

[EDIT: I updated the documentation, to reflect that Samba shares also cause a crash]

Also, it is interesting to see that RK3288 has Mali T760 4-core@600 Mhz, while Exynos 5422 has Mali T628 6-core@600 Mhz. Well, the TB performs at 1 Mh/s, and XU4 at 1.5 Mh/s. Performance/Mhz/core seems to be about the same in Mali T6xx and Mali T7xx.

Share this post

Link to post

Share on other sites

Well, the integrated Intel HD4600 of my desktop PC gives me about 6 Mh/s with the Skein algo, so the performance/consumption ratio of the little Mali is not near bad. Of course, in the pools most guys show above 50 Mh/s, some of them around the 1Gh, but they must have rigs with several Nvidia cards consuming at least hundreds of watts...

Share this post

Link to post

Share on other sites

is it a bug or just a temporary Problem of this solution, for the time being until RK comes up with "the solution".

That said, I wouldn't spend time in minor things, as long as it overall works.﻿

You're right. After all, I think sooner or later the best choice will be to start trying Wayland, once we get a stable Bionic desktop. It is very common to say that Wayland is the future for Linux desktops, but it is even more true in the case of SBC's since, from what I have read, EGL works much better in Wayland than in X11 .

Share this post

Link to post

Share on other sites

I wonder if someone tried the script on mainline kernel. I tried on Armbian Xubuntu 5.46 with mainline kernel 4.14.50.

I choose the "new" X.org way, and at the moment I get 1.19.3. The desktop is plenty fast and I'm using a special Firefox 59 build (download it here, referred from here). I have to say that this setup is surprisingly fast and very usable.

But looking into Xorg.0.log I see that glamor is failing to initialize EGL, also es2_info fails too, so everything seems to be done without any gpu acceleration.

Share this post

Link to post

Share on other sites

It used to work on mainline, but I'm afraid recently kernel driver has been updated, and the r14p0 library we are shipping in this package does not work with mainline anymore. Can you post the output of

Share this post

Link to post

Share on other sites

It used to work on mainline, but I'm afraid recently kernel driver has been updated, and the r14p0 library we are shipping in this package does not work with mainline anymore. Can you post the output of

Share this post

Link to post

Share on other sites

Here is the Xorg.0.log, you can see that modesetting driver is complaining about being unable to initialize EGL.

I tried also to start from a brand new image, installed manually the libmali libaries, tried all flavours of them (fbdev, gdm, X11) except wayland, but none of them was able to get past the eglInitialize(), so I guess there's some incompatibility against the kernel driver

Executed as root from a simple terminal (CTRL+ALT+F1 or chvt 1 from SSH)

Ok freshly compiled glmark2 with drm-glesv2 and x11-glesv2 flavours. Running over GBM libmali this way: # LD_LIBRARY_PATH=/opt/libmali-gbm/ strace glmark2-es2-drm from a real virtual terminal with no X11 running, these are the last 50 lines of the strace:

I also report the full strace running # strace glmark2-es2-drm without enforcing the LD_LIBRARY_PATH variable (which is empty) to use the system libmali for X11 installed by JMCC script

As a side note, I also swapped the kernel with a legacy 4.4.126 on the same installation. X11 starts with EGL acceleration enabled (no error in Xorg.0.log) and es2gears works without complaints.

edit:

another test with a slightly older mainline kernel (4.14.39) produces a successful result: glmark2-es2-drm against GBM libmali works wonderfully from a virtual terminal, glmark2-es2 against X11 libmali works wonderfully inside a desktop environment.

The 4.14.39 kernel still works fine even if used against the device tree from the 4.14.50 non-working kernel, so the source of problems is not the device tree.

Doing a diff over the two kernel configurations reports only some RTC drivers which have been compiled as modules in the newer kernel, but nothing directly related to GPU stuff.

lsmod reports a difference: with the working kernel mali_kbase module has 2 dependencies, instead with non-working kernel it has 0 dependencies.

As stated by @Myy in another thread, CMA memory reservation is not needed at all for the GPU acceleration: the working kernel has 0 kbytes reserved and works fine.