Jump to content
  • 0

[Development] RK3399 media script


JMCC
 Share

Question

THE MEDIA SCRIPT IS DEPRECATED, IN FAVOR OF THE LEGACY MULTIMEDIA INTEGRATION. PLEASE REFER TO THIS TOPIC:

 

So finally we have the first version of:

The UN-official, UN-supported, etc...

RK3399 MEDIA TESTING SCRIPT

 

This is the first release of the RK3399 media testing script. The script provides a functionality similar to its RK3288 equivalent:

  • Installing all the libraries and system configurations necessary for GPU accelerated X desktop, Chromium WebGL, full VPU video play acceleration up to 4k@60 10-bit HEVC (the maximum supported by the SoC), and GLES 3.2 / 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.
  • 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 features, that have no big interest from the Armbian development prospective, but I find them interesting to play with:
    •  Chromium browser with support for Flash and DRM-protected commercial web video streaming (tested with Amazon Prime, should also work with Netflix, Hulu, etc.),
    • and a simple Pulseaudio GTK equalizer using LADSPA.

 

Here is a more thorough documentation:

Spoiler


ARMBIAN UNOFFICIAL RK3399 MEDIA TESTING SCRIPT
----------------------------------------------
v1.0 Bionic - 2019/01/11


This script will install several multimedia-related software pieces in a
RK3399 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-rk3399.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:
            · Glamor: The tweaked X server that you can download from 
              Rockchip repos, with a few additional tweaks. It will use
              Glamor for GPU acceleration, providing good 3D performance
              and complete vsync, but giving a very laggy experience in 
              general desktop usage.
            · Armsoc: An updated version of the xf86 Armsoc driver. It
              only supports fullscreen vsync, but on the other hand the
              overall desktop experience is much snappier.
           
- 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 Chromium with the Widevine DRM and
             Pepper-Flash libraries enabled, allowing you to watch 
             videos from sites such as Netflix, Amazon Prime or Hulu.
             It will also install the h264ify addon, which will force
             all Youtube videos to use the H.264 codec.
             Since those libraries are only available for 32-bit ARM,
             the script will install a whole armhf docker container,
             with a minimal ubuntu and Chromium installation on it. It
             will also install a wrapper for running commands inside the
             docker container called "armhf-run":
               · Type "armhf-run chromium-browser" to launch the 32-bit
                 Chromium in regular mode.
               . Type "armhf-run chromium-streaming" to launch it in
                 streaming mode (may cause problems with non-streaming
                 webpages).
             The script will also install desktop entries for both 
             options.

- 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 rc4. 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 and stop the X server first.
        · The "Kodi" desktop launcher will do the whole process for you.
        · 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@60 10-bit HEVC 
with perfect smoothness. 4K VP9 8-bit is fine, but don't try 
VP9 10-bit or you'll get a green screen and your /var/log partition
filled up in less than ten seconds ;)


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

JMCC.

 

 

>>> DOWNLOAD LINK <<<

 

Prerequisites:

  • You need a fresh Armbian Bionic desktop image with legacy kernel installed.

 

Instructions:

  1. Download the file above
  2. Untar it: tar xvf media-rk3399_*.txz
  3. cd media-script
  4. ./media-rk3399.sh

 

Notes:

  • 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.

 

Enjoy!

Link to comment
Share on other sites

Recommended Posts

  • 0

Wanna add about ubuntu-server that was minimized to xfce4 with minimize && apt-get install xfve4 xfce4-goodies,  startx used from sudo su.

Under this conditions i installed all *.deb from libraries + xserver + kodi + did all changes that was inside .sh script (i.e. edit file inside xorg.init.d) with command dpkg --unpack *.deb (yes, in right folders) and apt-get install -f -y.

After this, Chromium and es2gears see Mali driver, but...Chromium (with h264ify) can't play 1080p60fps (which he can with pure software) (Chromium 32bit fails here too) and after I use command kodi-gbm-wrapper and click enter I may not move mouse or click keyboard for a bit and then everything back to normal, but Kodi still doesn't start up. 

gl4es working, i.e. vcmi (heroes 3) is working with it, but performance is the same as for software, maybe a little bit better 

Link to comment
Share on other sites

Armbian is a community driven open source project. Do you like to contribute your code?

  • 0
10 hours ago, Dante4 said:

Wanna add about ubuntu-server that was minimized to xfce4 with minimize && apt-get install xfve4 xfce4-goodies,  startx used from sudo su.

Under this conditions i installed all *.deb from libraries + xserver + kodi + did all changes that was inside .sh script (i.e. edit file inside xorg.init.d) with command dpkg --unpack *.deb (yes, in right folders) and apt-get install -f -y.

After this, Chromium and es2gears see Mali driver, but...Chromium (with h264ify) can't play 1080p60fps (which he can with pure software) (Chromium 32bit fails here too) and after I use command kodi-gbm-wrapper and click enter I may not move mouse or click keyboard for a bit and then everything back to normal, but Kodi still doesn't start up. 

gl4es working, i.e. vcmi (heroes 3) is working with it, but performance is the same as for software, maybe a little bit better 

Good to see that you like experimenting. As I said, if you use as a base anything other than Armbian Bionic Default image, results can be unpredictable. I invite you to use the build script to make a proper image, or wait until it is publicly released, if you want to take advantage of all the possibilities of the script.

Link to comment
Share on other sites

  • 0

Held on Khadas EDGE (RK3399) advanced tests on 4K TV (resolution of the XFCE desktop environment full 4K). MPV and Gstreamer plays all files all formats (including 4K) without problems in full screen. Separately describe browser. I installed system components, MPV Gstreamer and KODI. The system part is the default armsoc. I use a regular browser (not accelerated versions of 32 bits). Once again,  the desktop Resolution = 4K (XFCE). YouTube through the browser to full screen easily pulls all versions 1080p videos. When you select 4K video, the video is played in "chunks" - 2-3 seconds of smooth playback, then freezes and turns the white circle on the screen, then again 2-3 seconds smoothly and so constantly. I think this is a limitation of my Internet channel (or YouTube itself). Because the video itself (in YouTube 4K mode) shows smoothly and without friezes in the intervals when it works. So if you do "window" display mode,  playable  - "pieces".  Maybe not enough of some buffer settings or anything, I'm not an expert. The conclusion I made for myself. RK3399-perfectly copes with any task of playing full-screen video. For local video (USB SD eMMC) or from a local network with a NAS where there is no bandwidth limit, any video goes without brakes to full screen with 4K scaling. For video from the Internet-no problem running any video for which enough channel. By the way, even the 1080p video on the 4K screen looks very good, I'm impressed.

By the way, the window from the applications, after installing the script are dragged quickly , almost as it was before the installation of the script, there are no protracted movements.

 

I agree with the opinion of @JMCC, for a component to work properly, it is important to have a properly configured system with the right kernel.

 

p.s.

By the way, when the desktop 4K resolution and full - screen video playback in YouTube, there was another problem-it is very difficult to see the mouse cursor, it is very small and have to look for a long time on the screen where it is. :)

But i'm can see much more information (video options or comments) immediately on the screen .... :)

Link to comment
Share on other sites

  • 0
2 hours ago, Lev Lybin said:

ls -l /dev/mali*
ls: cannot access '/dev/mali*': No such file or directory

Thanks for testing. That just confirms my guess, that Rockpro64's kernel is missing the necessary modules for HW accel.

 

2 hours ago, Igor said:

Nightly

My fault, I told users in this post specifically to switch to nightly if it didn't work on stable, to test the changes we were pushing :)

Link to comment
Share on other sites

  • 0
16 hours ago, Dante4 said:

Please, can someone run glmark2-es2 and glmark2-es2 --off-screen and post logs? Because I'm somewhat feel insanity right now. I have glamor initialized, i have GPU detected, but results just too low

Glamor does vsync by default, meaning that it adjusts the maximum frame rate to the screen refresh rate. That's the reason why you are getting scores of approximately 60fps.

 

You can disable vsync just for testing, by editing /etc/X11/xorg.conf.d/01-armbian-defaults.conf (there may be a typo, I am on the go now)

Link to comment
Share on other sites

  • 0
12 minutes ago, JMCC said:

Glamor does vsync by default, meaning that it adjusts the maximum frame rate to the screen refresh rate. That's the reason why you are getting scores of approximately 60fps.

 

You can disable vsync just for testing, by editing /etc/X11/xorg.conf.d/01-armbian-defaults.conf (there may be a typo, I am on the go now)

The problem is - i don't get 60fps (or 30, or anything that could possible be my screen update rate). Logs says that everything is on, but benchmark shows otherwise. I get around 40 fps for most tests.

And for off-screen it shouldn't even matter, but NanoPi T4 gets ~500 score (at least that what i was told) and 59-60 fps in normal test (from screenshot on Friendlyelec wiki). So, i'm getting lost and starting to think that maybe i did something wrong. That's why i need to see results of other rk3399 boards

Edited by Dante4
Small addition
Link to comment
Share on other sites

  • 0
On 1/24/2019 at 3:36 AM, JMCC said:

Thanks for testing. That just confirms my guess, that Rockpro64's kernel is missing the necessary modules for HW accel.

 

I'm running into this same problem on the rockpro64. Script was successful but no /dev/mali*. How can I get the necessary modules for HW accel?

 

From dmesg, I see the following:
 

[    3.831551] I : [File] : drivers/gpu/arm/mali400/mali/linux/mali_kernel_linux.c; [Line] : 417; [Func] : mali_module_init(); svn_rev_string_from_arm of this mali_ko is '', rk_ko_ver is '5', built at '08:13:34', on 'Jan 10 2019'.
[    3.831839] Mali: Mali device driver loaded

 

Thanks!

Edited by xkaiser
Adding information about driver message in dmesg.
Link to comment
Share on other sites

  • 0
7 hours ago, xkaiser said:

I'm running into this same problem on the rockpro64. Script was successful but no /dev/mali*. How can I get the necessary modules for HW accel?

It's a problem with Kernel config. I cannot deal with it now, since I am traveling for some days. When I come back, I plan to open a discussion about the subject, because it will probably require that the RockPro64 is moved to a different kernel if we want it to have 3D HW acceleration.

Link to comment
Share on other sites

  • 0

Hi,

I know that my SBC does not have any armbian support (VAMRS ROCK960) BUT since it uses the RK3399 AND since i am running bionic on it, i am kindly asking for support from here : i am trying to build KODI v18.1 with these three FFmpeg compile options added to its CMakeLists.txt : --enable-version3 --enable-libdrm --enable-rkmpp AND it does not build by throwing me this error : ERROR: rockchip_mpp not found using pkg-config BUT if i launch manually the FFmpeg configure command from inside its directory, it configures without any complaint...

How to make pkg-config to find rockchip_mpp from inside KODI build process ? I have tried to set PKG_CONFIG_PATH into FFmpeg CMakeLists.txt BUT it does not help...

Thanks for any help !

Link to comment
Share on other sites

  • 0
6 hours ago, ne0zone75 said:

Hi,

I know that my SBC does not have any armbian support (VAMRS ROCK960) BUT since it uses the RK3399 AND since i am running bionic on it, i am kindly asking for support from here : i am trying to build KODI v18.1 with these three FFmpeg compile options added to its CMakeLists.txt : --enable-version3 --enable-libdrm --enable-rkmpp AND it does not build by throwing me this error : ERROR: rockchip_mpp not found using pkg-config BUT if i launch manually the FFmpeg configure command from inside its directory, it configures without any complaint...

How to make pkg-config to find rockchip_mpp from inside KODI build process ? I have tried to set PKG_CONFIG_PATH into FFmpeg CMakeLists.txt BUT it does not help...

Thanks for any help !

Well, all I can say is that using the librockchip-mpp-dev package from my script, I have no problem compiling kodi. Have you tried it?

Link to comment
Share on other sites

  • 0
1 hour ago, JMCC said:

Well, all I can say is that using the librockchip-mpp-dev package from my script, I have no problem compiling kodi. Have you tried it?

 

Yes, i installed it a few hours ago AND KODI GBM is compiling right now !

 

I also ran your script and it went fine :thumbup: BUT your KODI GBM does not start sadly and i do not know how to troubleshoot it because i do not know where to look at... if i understood correctly, KODI GBM must be launched from a terminal session without any X server running right ? When i do this, my SBC is freezed and i must AC unplug / replug it. I also tried to launch it though a systemd service and it does not happen anything BUT my SBC does not freeze in that case... you will find it below...

 

[Unit]
Description=kodi-standalone using GBM
Requires=dbus.service
After=systemd-user-sessions.service network.target sound.target network-online.target

[Service]
User=kodi
Group=kodi
Type=simple
SupplementaryGroups=audio input video
PAMName=login
ExecStart=/usr/bin/dbus-launch --exit-with-session /usr/bin/kodi -- --windowing gbm --standalone
StandardInput=tty-force
TTYPath=/dev/tty3
Restart=on-abort

[Install]
WantedBy=multi-user.target

 

Anyway, thanks for your assistance and congratulations for your work, you did very well ! :thumbup:

Link to comment
Share on other sites

  • 0
8 hours ago, ne0zone75 said:

When i do this, my SBC is freezed

Yes, that means Kodi is working :) As a matter of fact, that is caused by a DRM bug in the kernel. Our RK3399 kernel has a patch to work around it. I assume you are not using Armbian, right?

Link to comment
Share on other sites

  • 0
1 hour ago, JMCC said:

Yes, that means Kodi is working :) As a matter of fact, that is caused by a DRM bug in the kernel. Our RK3399 kernel has a patch to work around it. I assume you are not using Armbian, right?

 

No, i am using bionic ARM64 for my SBC. Do you think that i can recompile my kernel with that patch applied on it ?

 

Thanks

Link to comment
Share on other sites

  • 0
1 minute ago, dragonlost said:

After install and reboot in my nanopi-m4 board ( kernel 4.4 Ubuntu Bionic), no have icon on my desktop (ubuntu mate) but when i click in desktop, application run.

As if the icons was there but we can not see them anymore.

is very strange.

 

Is it possible that you have compositing enabled?

Link to comment
Share on other sites

  • 0

@JMCC - testing on rockpro64 with ayufan's bionic here, almost got it .. working on getting the drm_getunqiue patch applied to ayufan's 4.4.167 rock64/rockpro64 kernel now and all should work.  This should get kodi-gbm working with rock64 also.

 

sidenote - was also able to install/boot ayufan's kernel on Armbian rockpro64 bionic.  It has /dev/mali, etc, and should work there also once this patch is applied.


EDIT: new kernel is up with patch applied -- this kernel should work with armbian bionic rockpro64 rk3399 media-script.

https://github.com/ayufan-rock64/linux-kernel/releases

Link to comment
Share on other sites

  • 0

Hi,


I am using friendlycore bionic on a NanoPiM4 and trying to play some videos but they are not playing smoothly. And there are some warnings, please take a look:

 

Quote

X.Org X Server 1.19.3
Release Date: 2017-03-15
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.4.162-rk3399 aarch64 Ubuntu
Current Operating System: Linux NanoPi-M4 4.4.154 #1 SMP Thu Mar 7 18:30:53 CST 2019 aarch64
Kernel command line: earlycon=uart8250,mmio32,0xff1a0000 swiotlb=1 console=ttyFIQ0 rw root=PARTUUID=614e0000-0000 rootfstype=ext4 rootwait root=/dev/mmcblk1p7 rw rootfstype=ext4 mtdparts=rk29xxnand:0x00002000@0x00002000(uboot),0x00002000@0x00004000(trust),0x00002000@0x00006000(misc),0x00006000@0x00008000(resource),0x00010000@0x0000e000(kernel),0x00010000@0x0001e000(boot),-@0x00030000(rootfs) consoleblank=0 storagemedia=emmc uboot_logo=0x02000000@0x7dc00000 loader.timestamp=2018-08-01_14:55:50 SecureBootCheckOk=0 androidboot.mode=emmc
Build Date: 17 December 2018  12:58:34PM
xorg-server 2:1.19.3-1 (https://www.debian.org/support) 
Current version of pixman: 0.34.0
    Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.11.log", Time: Thu Mar 28 11:31:25 2019
(==) Using config directory: "/etc/X11/xorg.conf.d"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
XmbTextListToTextProperty result code -2
XmbTextListToTextProperty result code -2
XmbTextListToTextProperty result code -2
XmbTextListToTextProperty result code -2
XmbTextListToTextProperty result code -2
XmbTextListToTextProperty result code -2
XmbTextListToTextProperty result code -2
XmbTextListToTextProperty result code -2
XmbTextListToTextProperty result code -2
XmbTextListToTextProperty result code -2
XmbTextListToTextProperty result code -2
XmbTextListToTextProperty result code -2
XmbTextListToTextProperty result code -2
XmbTextListToTextProperty result code -2
XmbTextListToTextProperty result code -2
Empty filename passed to function
XmbTextListToTextProperty result code -2
mpi: mpp version: 0b701fe author: Lawrence-Tang DEBIAN: prepare for release_20171218-3
mpp_rt: NOT found ion allocator
mpp_rt: found drm allocator
XmbTextListToTextProperty result code -2
XmbTextListToTextProperty result code -2
QWidget::paintEngine: Should no longer be called
QWidget::paintEngine: Should no longer be called
QWidget::paintEngine: Should no longer be called
QWidget::paintEngine: Should no longer be called
mpp_buffer: mpp_buffer_group_set_listener found NULL pointer
mpp: command 310002 param (nil) ret -3
XmbTextListToTextProperty result code -2
mpi: mpp version: 0b701fe author: Lawrence-Tang DEBIAN: prepare for release_20171218-3
XmbTextListToTextProperty result code -2
mpp_buffer: mpp_buffer_group_set_listener found NULL pointer
mpp: command 310002 param (nil) ret -3
XmbTextListToTextProperty result code -2
mpi: mpp version: 0b701fe author: Lawrence-Tang DEBIAN: prepare for release_20171218-3
XmbTextListToTextProperty result code -2
Warning: "A lot of buffers are being dropped."
mpp_buffer: mpp_buffer_group_set_listener found NULL pointer
mpp: command 310002 param (nil) ret -3
XmbTextListToTextProperty result code -2
mpi: mpp version: 0b701fe author: Lawrence-Tang DEBIAN: prepare for release_20171218-3
XmbTextListToTextProperty result code -2
Warning: "A lot of buffers are being dropped."
Warning: "A lot of buffers are being dropped."
Warning: "A lot of buffers are being dropped."
Warning: "A lot of buffers are being dropped."
Warning: "A lot of buffers are being dropped."
Warning: "A lot of buffers are being dropped."
Warning: "A lot of buffers are being dropped."
Warning: "A lot of buffers are being dropped."
Warning: "A lot of buffers are being dropped."
Warning: "A lot of buffers are being dropped."
Warning: "A lot of buffers are being dropped."
Warning: "A lot of buffers are being dropped."
mpp_buffer: mpp_buffer_group_set_listener found NULL pointer
mpp: command 310002 param (nil) ret -3
 

 

If you have any idea about all errors/warnings (buffer being dropped mainly), please let me know.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...