RK3588 GPU 使用教程
Table of Contents
1. RK3588 GPU 简介
RK3588 集成了嵌入式 ARM Mali G610 3D GPU,支持 OpenGLES 1.1、2.0、3.2,OpenCL 2.2 和 Vulkan 1.2。 并带有 MMU 的特殊 2D 硬件引擎将最大限度的提高显示性能,并提供非常平稳的操作。
2. 设备端使能 GPU
2.1. 内核驱动
CONFIG_MALI_BIFROST=y CONFIG_MALI_PLATFORM_NAME=rk CONFIG_MALI_CSF_SUPPORT=y
2.2. 设备树
gpu: gpu@fb000000 {
compatible = "arm,mali-bifrost";
...
};
&gpu {
mali-supply = <&vdd_gpu_s0>;
mem-supply = <&vdd_gpu_mem_s0>;
status = "okay";
};
2.3. 验证
dmesg | grep mali # [ 29.339559] mali fb000000.gpu: Kernel DDK version g21p0-01eac0 # ... # [ 29.431217] mali fb000000.gpu: Probed as mali0 # [17098.340510] mali fb000000.gpu: Loading Mali firmware 0x1010000 # [17098.342175] mali fb000000.gpu: Mali firmware git_sha: 935af7024ac4bfdc31651dccbabd3467e749c51b
3. 用户空间使用 GPU
3.1. 下载编译
libmali 中包含 OpenGLES、OpenCL、Vulkan 等库的具体实现
git clone https://github.com/JeffyCN/mirrors.git # libmali 库 meson -Darch=aarch64 -Dgpu=valhall-g610 -Dversion=g24p0 -Dopencl-icd=false # 编译 clinfo git clone https://github.com/Oblomov/clinfo.git # 编译之前需要修改 Makefile ,让其连接 libmali ,而不是连接 OpenCL make
3.2. 验证
clinfo # Number of platforms 1 # arm_release_ver: g24p0-00eac0, rk_so_ver: 8 # Platform Name ARM Platform # Platform Vendor ARM # Platform Version OpenCL 3.0 v1.g24p0-00eac0.071111a8920e863c7ed9b7ffed7fc78e # Platform Profile FULL_PROFILE # Platform 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 clr # Platform Extensions with Version cl_khr_global_int32_base_atomics 0x400000 (1.0.0)
4. 查看 GPU 运行信息
cat /sys/devices/platform/fb000000.gpu/devfreq/fb000000.gpu/load # 0@300000000Hz # @ 前表示 GPU 使用率