SoC | Rockchip RK3399 |
CPU | Cortex A53 4Core+A72 2.0GHz 2Core |
GPU | Mali-T860 MP4 Quad-Core |
Memory | 2GB Dual-Channel DDR3 |
スペック †
- CPU:Cortex-A53 Quad core 1.5GHz + Cortex-A72 Dual core 2.0GHz
- Architecture:Armv8
- cpuinfo
firefly@firefly:~$ cat /proc/cpuinfo
processor : 0
BogoMIPS : 48.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4
processor : 1
BogoMIPS : 48.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4
processor : 2
BogoMIPS : 48.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4
processor : 3
BogoMIPS : 48.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4
processor : 4
BogoMIPS : 48.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 2
processor : 5
BogoMIPS : 48.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 2
Serial : 0000000000000000
- auxv
0000000000000021 0000007f9e6fd000
0000000000000010 00000000000000ff
0000000000000006 0000000000001000
0000000000000011 0000000000000064
0000000000000003 0000005585fa5040
0000000000000004 0000000000000038
0000000000000005 0000000000000008
0000000000000007 0000007f9e6d2000
0000000000000008 0000000000000000
0000000000000009 0000005585fa73d8
000000000000000b 00000000000003e8
000000000000000c 00000000000003e8
000000000000000d 00000000000003e8
000000000000000e 00000000000003e8
0000000000000017 0000000000000000
0000000000000019 0000007ffc3b9988
000000000000001f 0000007ffc3bafeb
000000000000000f 0000007ffc3b9998
0000000000000000 0000000000000000
- lscpu
$ lscpu
Architecture: aarch64
Byte Order: Little Endian
CPU(s): 6
On-line CPU(s) list: 0-5
Thread(s) per core: 1
Core(s) per socket: 3
Socket(s): 2
CPU max MHz: 1512.0000
CPU min MHz: 408.0000
Hypervisor vendor: (null)
Virtualization type: full
- cpufreq
$ sudo cat /sys/bus/cpu/devices/cpu*/cpufreq/cpuinfo_max_freq
1512000
1512000
1512000
1512000
1992000
1992000
- kernel
firefly@firefly:~$ uname -a
Linux firefly 4.4.16 #960 SMP PREEMPT Thu Feb 23 10:11:32 CST 2017 aarch64 aarch64 aarch64 GNU/Linux
- OS
firefly@firefly:~$ lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 16.04.1 LTS
Release: 16.04
Codename: xenial
- gcc
firefly@firefly:~$ gcc --version
gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- UART Debug console
- Firefly RK3399
その他情報 †
セットアップ †
タイムゾーン †
$ sudo dpkg-reconfigure tzdata
秘密鍵/公開鍵 †
OpenCL対応 †
- OpenCL対応
- 発売と同時に焼きこまれたイメージには、OpenCL対応のドライバが入ってない
- で、公式っぽいアカウントから出てる身元不明のドライバを入れてみる(自己責任でね!良い子は真似しちゃダメだよ!)
$ git clone git@github.com:rockchip-linux/libmali.git
$ cd libmali
$ cmake .
$ make
$ sudo make instal
- 全部インストールするのは怖かったので、libOpenCL.soだけ差し替えてみた(自己責任でね!良い子は真似しちゃダメだよ!)
$ git clone git@github.com:rockchip-linux/libmali.git
$ sudo rm /usr/lib/aarch64-linux-gnu/libOpenCL.so
$ sudo cp -p libmali/lib/aarch64-linux-gnu/libmali-midgard-t86x-r13p0-wayland.so /usr/lib/aarch64-linux-gnu/
$ cd /usr/lib/aarch64-linux-gnu/
$ sudo ln -s libmali-midgard-t86x-r13p0.so libOpenCL.so
- soだけ差し替えればOpenCLは動く
- ただし、手元でビルドするためには、openclのヘッダやpcファイルが事実上必須
$ sudo apt install opencl-headers ocl-icd-opencl-dev
Firefly の libmali を使っても、ERROR: The DDK is not compatible とかエラーメッセージが出た場合の対処 †
- どうやら、インストールしただけでは/dev/mali0のパーミッションの問題でGPUにアクセスできなくなるらしい。
- もともと使えなかった
- →libmaliを差し替え
- →使える
- →再起動
- →使えなくなる
- という流れだった。
- 使えたときは、OpenCVのテストプログラムの表示が
Parallel framework: pthreads
CPU features: neon fp16
[ INFO:0] Initialize OpenCL runtime...
OpenCL Platforms:
ARM Platform
iGPU: Mali-T860 (OpenCL 1.2 v1.r13p0-00rel0-git(a4271c9).04dadb82d3612c978f88c00109101694)
Current OpenCL device:
Type = iGPU
Name = Mali-T860
Version = OpenCL 1.2 v1.r13p0-00rel0-git(a4271c9).04dadb82d3612c978f88c00109101694
Driver version = 1.2
Address bits = 64
Compute units = 4
Max work group size = 256
Local memory size = 32 KB
Max memory allocation size = 494 MB 34 KB
Double support = Yes
Host unified memory = Yes
Device extensions:
cl_khr_global_int32_base_atomics
cl_khr_global_int32_extended_atomics
cl_khr_local_int32_base_atomics
cl_khr_local_int32_extended_atomics
cl_khr_byte_addressable_store
cl_khr_3d_image_writes
cl_khr_fp64
cl_khr_int64_base_atomics
cl_khr_int64_extended_atomics
cl_khr_fp16
cl_khr_gl_sharing
cl_khr_icd
cl_khr_egl_event
cl_khr_egl_image
cl_khr_image2d_from_buffer
cl_arm_core_id
cl_arm_printf
cl_arm_thread_limit_hint
cl_arm_non_uniform_work_group_size
cl_arm_import_memory
Has AMD Blas = No
Has AMD Fft = No
Preferred vector width char = 16
Preferred vector width short = 8
Preferred vector width int = 4
Preferred vector width long = 2
Preferred vector width float = 4
Preferred vector width double = 2
だったのに、
Build type: release
Parallel framework: pthreads
CPU features: neon fp16
ERROR: The DDK is not compatible with any of the Mali GPUs on the system.
The DDK was built for 0x860 r2p0 status range [0..15], but none of the GPUs matched:
[ INFO:0] Initialize OpenCL runtime...
OpenCL is disabled
- という具合に変わってしまった。
- デレがツンになってしまった。
- で、調べると、どうも/dev/mali0にアクセスしたのちに諦めているっぽい。
$ strace ./bin/opencv_test_imgproc --gtest_filter=slkfjdslfkjdslfsd > stracelog.txt 2>&1
$ tail -20 stracelog.txt
openat(AT_FDCWD, "./.mali_config", O_RDONLY) = -1 ENOENT (No such file or directory)
brk(0x1031000) = 0x1031000
openat(AT_FDCWD, "/dev/mali0", O_RDWR|O_NONBLOCK|O_CLOEXEC) = -1 EACCES (Permission denied)
write(2, "ERROR: The DDK is not compatible"..., 159ERROR: The DDK is not compatible with any of the Mali GPUs on the system.
The DDK was built for 0x860 r2p0 status range [0..15], but none of the GPUs matched:
) = 159
openat(AT_FDCWD, "/dev/mali0", O_RDWR|O_NONBLOCK|O_CLOEXEC) = -1 EACCES (Permission denied)
munmap(0x7fa2385000, 200704) = 0
write(1, "[ INFO:0] Initialize OpenCL runt"..., 58[ INFO:0] Initialize OpenCL runtime...
OpenCL is disabled
) = 58
ioctl(1, TCGETS, 0x7fca4e7648) = -1 ENOTTY (Inappropriate ioctl for device)
write(1, "Note: Google Test filter = slkfj"..., 93Note: Google Test filter = slkfjdslfkjdslfsd
[==========] Running 0 tests from 0 test cases.
) = 93
write(1, "[==========] 0 tests from 0 test"..., 79[==========] 0 tests from 0 test cases ran. (2 ms total)
[ PASSED ] 0 tests.
) = 79
exit_group(0) = ?
+++ exited with 0 +++
- で、調べたら、インストール用のスクリプトを公開している人がいた*4
- 要は /etc/udev/rules.d/99-mali.rules を作り、その中に
KERNEL=="mali0",SUBSYSTEM=="misc",MODE="0777"
- と書いて再起動すれば良いらしい
$ sudo vim /etc/udev/rules.d/99-mali.rules
$ sudo reboot
- 他のライブラリの配置も追々追従しよう
Arm