原文链接:https://www.cnblogs.com/zyly/p/17459196.html#_label0_1_0
----------------------------------------------------------------------------------------------------------------------------
开发板 :
显示屏 :
----------------------------------------------------------------------------------------------------------------------------
需要注意的是:本篇博客是以
一、图像界面卡顿问题
在前面的文章我们已经移植了在
1.1 图像卡顿原因
造成这种情况一般由两个原因:
- 开发板上主控
SoC 的性能比较弱,没有带3D 图形加速(即GPU )功能; - 开发板上的
SoC 带了GPU ,但是没有用起来;
第一个原因基本是无解的,如果你选的
也有很多人被卡在了第二个关卡,
- 一小部分在
linux 内核中; - 另外一大部分在
userspace ,在userspace 的部分向下操作内核中的驱动,向上对应用层提供标准的OpenGL 接口,这样各种图形显示相关的应用才能通过标准的OpenGL API 进行图形渲染加速。
1.2 ARM Mail GPU
看到这里,也许你就想骂
面对这种状况,很多人为了能够利用
如果想跑
但是也有一部分黑客们不满于这种封锁,他们勇于探索,积极尝试,逆向了
- 针对
Mali-400/Mali-450 的驱动叫做Lima ,针对Mali-T6xx / Mali-T7xx / Mali-T8xx GPU 和GXX 系列的叫做Panfrost ; Usersacpe 部分的开源库叫做mesa ,对Mali GPU 的支持从mesa 19.2 开始,这个我们在介绍OpenGL 的实现的时候已经提及到了;
这里我们将学习如何在运行
1.2.1 Panfrost
Product | Architecture | OpenGL ES | OpenGL |
---|---|---|---|
Mali T620 | Midgard (v4) | 2.0 | 2.1 |
Mali T720 | Midgard (v4) | 2.0 | 2.1 |
Mali T760 | Midgard (v5) | 3.1 | 3.1 |
Mali T820 | Midgard (v5) | 3.1 | 3.1 |
Mali T830 | Midgard (v5) | 3.1 | 3.1 |
Mali T860 | Midgard (v5) | 3.1 | 3.1 |
Mali T880 | Midgard (v5) | 3.1 | 3.1 |
Mali G72 | Bifrost (v6) | 3.1 | 3.1 |
Mali G31 | Bifrost (v7) | 3.1 | 3.1 |
Mali G51 | Bifrost (v7) | 3.1 | 3.1 |
Mali G52 | Bifrost (v7) | 3.1 | 3.1 |
Mali G76 | Bifrost (v7) | 3.1 | 3.1 |
Mali G57 | Valhall (v9) | 3.1 | 3.1 |
目前,
对于基于
另外,当前版本的
在支持
OpenGL 指令解析和翻译:Panfrost 驱动程序需要解析应用程序发送的OpenGL 指令,并将其翻译成适用于Mali GPU 的底层指令,这包括顶点处理、片段处理、纹理映射、着色器处理等;OpenGL 状态管理: 驱动程序需要管理OpenGL 中的状态机,确保正确地跟踪和应用OpenGL 中的状态变化,以便正确地渲染图形;OpenGL 内存管理: 驱动程序需要管理GPU 内存,确保OpenGL 中的图形数据被正确地加载到GPU 内存中,并在需要时被释放;OpenGL 渲染管线控制: 驱动程序需要控制GPU 的渲染管线,确保正确地处理顶点数据、执行着色器程序、进行光栅化等操作;OpenGL 版本兼容性: 驱动程序需要确保对OpenGL 标准的不同版本提供兼容性支持,以便能够正确地处理来自应用程序的不同版本的OpenGL 指令。
注意:以上内容来自
1.2.2 mesa
1.2.3 架构图
总的来说,
二、图形API
既然上面提到了
2.1 OpenGL
2.1.1 OpenGL 简介
通过遵循
2.1.2 OpenGL ES 简介
2.1.3 WebGL 简介
- 它通过
HTML 脚本本身实现Web 交互式三维动画的制作,无需任何浏览器插件支持; - 它利用底层的图形硬件加速功能进行的图形渲染,是通过统一的、标准的、跨平台的
OpenGL 接口实现的。
2.1.4 OpenGL 实现
不同的
以下是一些常见的
Microsoft Windows 上的OpenGL 实现:windows 操作系统通常使用由各个显卡供应商提供的OpenGL 实现。例如,NVIDIA 提供了针对其显卡的OpenGL 驱动程序,而AMD 和Intel 也提供了相应的驱动程序;macOS 上的OpenGL 实现:macOS 使用苹果自己的OpenGL 实现,称为Apple OpenGL 或macOS OpenGL 。这是基于OpenGL 规范的实现,与苹果的硬件和操作系统紧密集成;Linux 上的OpenGL 实现:Linux 上有多个供应商提供的OpenGL 实现,包括开源的mesa 3D 项目。mesa 提供了一个开源的OpenGL 实现,可以在许多Linux 发行版上使用。此外,显卡供应商如NVIDIA 、AMD 和Intel 也提供了针对Linux 的专有OpenGL 驱动程序;- 移动平台上的
OpenGL ES 实现:OpenGL ES (OpenGL for Embedded Systems )是针对移动设备和嵌入式系统的精简版OpenGL 。针对Android 设备,Google 提供了OpenGL ES 的实现,而对于iOS 设备,苹果提供了Metal API ,它可以用于绘制2D 和3D 图形。
2.2 OpenCL
2.2.1 平台&设备
一个
OpenCL 平台可以有一个或多个设备;- 相同的设备可以具有来自不同供应商的一个或多个
OpenCL 实现。换句话说,OpenCL 设备不仅可以属于一个平台。; - 该平台的
OpenCL 版本不一定与设备的OpenCL 版本相同;
2.2.2 ICD &ICD Loader
从
- 它与
OpenCL 应用程序相关联,并作为ICD 的占位符; - 应用程序调用
ICD 加载程序库导出的函数。然而,ICD 加载器根据所选的OpenCL 平台决定要重定向到哪个ICD ; ICD 加载机制是必需的,因为供应商的OpenCL 实现通常只支持该供应商的硬件,但您可能希望在同一个OpenCL 应用程序中使用来自不同供应商的多个设备。
简单的说,这个
注意:一台机器可以有几个
在
OpenCL 头文件:CL/cl.h ;ICD Loader 库文件:libOpenCL.so ;ICD 定义文件,一般位于/etc/OpenCL/vendors/ ,在该目录下存放OpenCL 实现的厂商特定文件;在这个目录中,通常会有一个或多个.icd 文件,用于指定可用的OpenCL 平台,这些文件包含OpenCL 实现的信息,包括库文件路径;当系统加载OpenCL 时,它会检查该目录下的.icd 文件,并根据文件中的内容确定可用的OpenCL 平台,每个.icd 文件通常包含一个供应商库文件的路径;ICD :由设备制造商提供,针对某个特定设备的专门的OpenCL 实现;
2.3 VulKan
三、配置Panfrost 驱动
关于
3.1 配置内核
3.1.1 Panfrost GPU 驱动
在
Device Drivers ---> Graphics support ---> <*> Panfrost (DRM support for ARM Mali Midgard/Bifrost GPUs)
默认编译到内核中或者以模块的形式加载都可以。
3.1.2 驱动代码
驱动位于
root@zhengyang:/work/sambashare/rk3399/linux-6.3# ll drivers/gpu/drm/panfrost/ 总用量 1720 drwxrwxr-x 2 root root 4096 Jun 5 20:58 ./ drwxrwxr-x 64 root root 16384 Jun 5 20:22 ../-rw-rw-r-- 1 root root 472 Aug 9 2019 Kconfig -rw-rw-r-- 1 root root 225 Aug 9 2019 Makefile-rw-rw-r-- 1 root root 5934 Aug 9 2019 panfrost_devfreq.c -rw-rw-r-- 1 root root 441 Aug 9 2019 panfrost_devfreq.h-rw-rw-r-- 1 root root 6427 Aug 9 2019 panfrost_device.c -rw-rw-r-- 1 root root 2678 Aug 9 2019 panfrost_device.h-rw-rw-r-- 1 root root 11971 Aug 9 2019 panfrost_drv.c-rw-rw-r-- 1 root root 11398 Aug 9 2019 panfrost_features.h -rw-rw-r-- 1 root root 2353 Aug 9 2019 panfrost_gem.c -rw-rw-r-- 1 root root 785 Aug 9 2019 panfrost_gem.h-rw-rw-r-- 1 root root 10974 Aug 9 2019 panfrost_gpu.c -rw-rw-r-- 1 root root 586 Aug 9 2019 panfrost_gpu.h-rw-rw-r-- 1 root root 3944 Aug 9 2019 panfrost_issues.h -rw-rw-r-- 1 root root 13584 Aug 9 2019 panfrost_job.c -rw-rw-r-- 1 root root 1428 Aug 9 2019 panfrost_job.h-rw-rw-r-- 1 root root 9752 Aug 9 2019 panfrost_mmu.c -rw-rw-r-- 1 root root 486 Aug 9 2019 panfrost_mmu.h-rw-rw-r-- 1 root root 14759 Aug 9 2019 panfrost_regs.h -rw-rw-r-- 1 root root 880 Aug 9 2019 TODO
驱动入口文件在
static const struct of_device_id dt_match[] = { { .compatible = "amlogic,meson-gxm-mali", .data = &amlogic_data, }, { .compatible = "amlogic,meson-g12a-mali", .data = &amlogic_data, }, { .compatible = "arm,mali-t604", .data = &default_data, }, { .compatible = "arm,mali-t624", .data = &default_data, }, { .compatible = "arm,mali-t628", .data = &default_data, }, { .compatible = "arm,mali-t720", .data = &default_data, }, { .compatible = "arm,mali-t760", .data = &default_data, }, { .compatible = "arm,mali-t820", .data = &default_data, }, { .compatible = "arm,mali-t830", .data = &default_data, }, { .compatible = "arm,mali-t860", .data = &default_data, }, { .compatible = "arm,mali-t880", .data = &default_data, }, { .compatible = "arm,mali-bifrost", .data = &default_data, }, { .compatible = "arm,mali-valhall-jm", .data = &default_data, }, { .compatible = "mediatek,mt8183-mali", .data = &mediatek_mt8183_data }, {} }; MODULE_DEVICE_TABLE(of, dt_match); static struct platform_driver panfrost_driver = { .probe = panfrost_probe, .remove = panfrost_remove, .driver = { .name = "panfrost", .pm = pm_ptr(&panfrost_pm_ops), .of_match_table = dt_match, }, }; module_platform_driver(panfrost_driver);
3.2 gpu 设备节点
我们可以在
gpu: gpu@ff9a0000 { compatible = "rockchip,rk3399-mali", "arm,mali-t860"; reg = <0x0 0xff9a0000 0x0 0x10000>; interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH 0>, <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH 0>, <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH 0>; interrupt-names = "job", "mmu", "gpu"; clocks = <&cru ACLK_GPU>; #cooling-cells = <2>; power-domains = <&power RK3399_PD_GPU>; status = "disabled"; };
其中:
compatible :说明了设备兼容的驱动名称,即"rockchip,rk3399-mali "和"arm,mali-t860 ";可以看到arm,mali-t860 是和panfrost 驱动相匹配的,因此会执行驱动的.probe 函数,这里就不深入研究了;reg :指定了寄存器的基地址和大小,即基地址0xff9a0000 ,大小为0x10000 ;interrupts 和interrupt-names :分别指定了该设备所使用的中断号和中断的名称;clocks :指定了使用哪个时钟控制器(CRU )提供GPU 时钟;power-domains :用于指定设备所属的电源域,即RK3399_PD_GPU ;status :设置为"disabled "表示GPU 设备当前处于禁用状态,无法使用;
3.2.1 设备节点gpu 新增属性
我们需要在
&gpu { mali-supply = <&vdd_gpu>; status = "okay"; };
其中:
-
mali-supply :指定了GPU 设备使用的电源管脚; -
status :指定GPU 设备的状态(“okay ” 表示设备正常工作);
3.2.2 GPU 电源接线原理图
我们看一下
从图中可以看到
- 最大输出电流可达
6A ; - 宽输入电压范围:
2.6V 至5.5V ; - 集成主开关和同步开关,具有非常低的导通损耗(即
R DS(ON) 值很低); - 输出电压可以通过
I2C 接口编程,范围从0.7125V 到1.5V ;
通过
SYR838PKC | RK3399 | 描述 |
---|---|---|
SCL | I2C_SCL_PMIC(GPIO1_C0/SPI3_TXD/I2C0_SCL) | I2C串行时钟线 |
SDA | I2C_SDA_PMIC(GPIO1_B7/SPI3_RXD/I2C0_SDA) | I2C串行数据线 |
VSEL | GPU_SLEEP(GPIO1_B6/PWM3B_IR) | 电压选择引脚; |
低电平时,该芯片将根据VSEL0寄存器的值来设置输出电压VOUT; | ||
高电平时,该芯片将根据VSEL1寄存器的值来设置输出电压VOUT。 | ||
VIN | VCC3V3_SYS | 输入电压 |
VOUT | VDDGPU(GPU_VDD1~20) | 输出电压 |
需要注意的是:以上内容来自SYR838PKC datasheet,更多细节请自己查看手册。
3.2.3 设备节点vdd_gpu
vdd_gpu: regulator@41 { compatible = "silergy,syr828"; reg = <0x41>; fcs,suspend-voltage-selector = <1>; pinctrl-names = "default"; pinctrl-0 = <&gpu_sleep>; regulator-always-on; regulator-boot-on; regulator-min-microvolt = <712500>; regulator-max-microvolt = <1500000>; regulator-name = "vdd_gpu"; regulator-ramp-delay = <1000>; vin-supply = <&vcc3v3_sys>; regulator-state-mem { regulator-off-in-suspend; }; };
这个稳压管的配置信息包括:
compatible :指定了稳压管使用的驱动程序类型和版本信息;reg :指定了I2C 设备的地址;fcs,suspend-voltage-selector :指定了稳压管在睡眠模式下的工作电压;pinctrl-names :设置了引脚的默认状态,引脚配置设置为gpu_sleep ;pinctrl-0 :指定了default 状态的对应的引脚配置,即gpu_sleep ;regulator-always-on :表示稳压管始终处于开启状态;regulator-boot-on :表示稳压管在启动时自动开启;regulator-min-microvolt :指定了稳压管的最小输出电压;regulator-max-microvolt :指定了稳压管的最大输出电压;regulator-name :指定了稳压管在的名称。regulator-ramp-delay :指定了稳压管从关闭到开启时的延迟时间;vin-supply :指定了稳压管的输入电源,VCC3V3_SYS 是由电源输入的12V 电源经过稳压管NB680GD 输出得到的;
既然我们已经看到这里了,不妨继续看一下引脚配置节点
pmic { cpu_b_sleep: cpu-b-sleep { rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; }; gpu_sleep: gpu-sleep { rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; }; pmic_int_l: pmic-int-l { rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>; }; };
可以看到这里配置
至于设备
vcc3v3_sys: vcc3v3-sys { compatible = "regulator-fixed"; regulator-always-on; regulator-boot-on; regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; regulator-name = "vcc3v3_sys"; };
3.3 保存配置
配置完内核之后记得保存配置:
存档:
root@zhengyang:/work/sambashare/rk3399/linux-6.3# mv rk3399_defconfig ./arch/arm64/configs/
重新配置内核:
root@zhengyang:/work/sambashare/rk3399/linux-6.3# make rk3399_defconfig
3.4 编译并烧录
3.4.1 编译内核
在
root@zhengyang:/work/sambashare/rk3399/linux-6.3# make -j8
root@zhengyang:/work/sambashare/rk3399/linux-6.3# cp ../u-boot-2023.04/tools/mkimage ./ root@zhengyang:/work/sambashare/rk3399/linux-6.3# ./mkimage -f kernel.its kernel.itb
需要注意的是这里一定不能指定-E参数,不然
3.4.2 通过tftp 烧录内核
给开发板上电,同时连接上网线,进入
root@zhengyang:/work/sambashare/rk3399/linux-6.3# cp kernel.itb /work/tftpboot/
接着通过
=> tftp 0x10000000 kernel.itb
通过
=> mmc erase 0x8000 0xA000 => mmc write 0x10000000 0x8000 0xA000
3.4.3 启动内核
我们重新启动开发板,如果
[ 1.605438] panfrost ff9a0000.gpu: clock rate = 500000000 [ 1.611515] panfrost ff9a0000.gpu: failed to get regulator: -517 [ 1.618246] panfrost ff9a0000.gpu: regulator init failed -517 ...... [ 4.576304] panfrost ff9a0000.gpu: clock rate = 500000000 [ 4.583134] panfrost ff9a0000.gpu: mali-t860 id 0x860 major 0x2 minor 0x0 status 0x0 [ 4.591970] panfrost ff9a0000.gpu: features: 00000000,100e77bf, issues: 00000000,24040400 [ 4.601269] panfrost ff9a0000.gpu: Features: L2:0x07120206 Shader:0x00000000 Tiler:0x00000809 Mem:0x1 MMU:0x00002830 AS:0xff JS:0x7 [ 4.614692] panfrost ff9a0000.gpu: shader_present=0xf l2_present=0x1 [ 4.623663] [drm] Initialized panfrost 1.0.0 20180908 for ff9a0000.gpu on minor 1
我们通过
root@rk3399:~# cat /proc/interrupts CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 18: 0 0 0 0 0 0 GICv3 25 Level vgic 20: 0 0 0 0 0 0 GICv3 27 Level kvm guest vtimer 23: 7017 6076 5976 5599 11979 19022 GICv3 30 Level arch_timer 25: 1788 1798 1450 1230 929 773 GICv3 113 Level rk_timer 31: 0 0 0 0 0 0 GICv3-23 0 Level arm-pmu 32: 0 0 0 0 0 0 GICv3-23 1 Level arm-pmu 33: 1 0 0 0 0 0 GICv3 59 Level rockchip_usb2phy 34: 1 0 0 0 0 0 GICv3 63 Level rockchip_usb2phy 35: 0 0 0 0 0 0 GICv3 37 Level ff6d0000.dma-controller 36: 0 0 0 0 0 0 GICv3 38 Level ff6d0000.dma-controller 37: 0 0 0 0 0 0 GICv3 39 Level ff6e0000.dma-controller 38: 0 0 0 0 0 0 GICv3 40 Level ff6e0000.dma-controller 39: 354 0 0 0 0 0 GICv3 132 Level ttyS2 40: 0 0 0 0 0 0 GICv3 147 Level ff650800.iommu 41: 0 0 0 0 0 0 GICv3 149 Level ff660480.iommu 42: 2452 0 0 0 0 0 GICv3 151 Level ff8f3f00.iommu, ff8f0000.vop 43: 0 0 0 0 0 0 GICv3 150 Level ff903f00.iommu, ff900000.vop 44: 0 0 0 0 0 0 GICv3 75 Level ff914000.iommu 45: 0 0 0 0 0 0 GICv3 76 Level ff924000.iommu 46: 43 0 0 0 0 0 GICv3 44 Level eth0 47: 2 0 0 0 0 0 GICv3 58 Level ehci_hcd:usb2 48: 2 0 0 0 0 0 GICv3 62 Level ehci_hcd:usb1 49: 47 0 0 0 0 0 GICv3 64 Level ohci_hcd:usb4 50: 33 0 0 0 0 0 GICv3 60 Level ohci_hcd:usb3 51: 111 0 0 0 0 0 GICv3 68 Level ff160000.i2c 52: 222 0 0 0 0 0 GICv3 89 Level ff3c0000.i2c 53: 0 0 0 0 0 0 rockchip_gpio_irq 21 Level rk808 63: 0 0 0 0 0 0 GICv3 152 Edge ff848000.watchdog 64: 8295 0 0 0 0 0 GICv3 96 Level dw-mci 65: 10042 0 0 0 0 0 GICv3 43 Level mmc0 66: 1 0 0 0 0 0 rockchip_gpio_irq 4 Edge 67: 1 0 0 0 0 0 GICv3 55 Level ff940000.hdmi 68: 86 0 0 0 0 0 GICv3 51 Level panfrost-gpu 69: 0 0 0 0 0 0 GICv3 53 Level panfrost-mmu 70: 2106 0 0 0 0 0 GICv3 52 Level panfrost-job IPI0: 588 537 590 570 334 427 Rescheduling interrupts IPI1: 9858 10924 13311 12477 13037 12794 Function call interrupts IPI2: 0 0 0 0 0 0 CPU stop interrupts IPI3: 0 0 0 0 0 0 CPU stop (for crash dump) interrupts IPI4: 737 1128 1132 1122 851 779 Timer broadcast interrupts IPI5: 2 0 0 0 0 0 IRQ work interrupts IPI6: 0 0 0 0 0 0 CPU wake-up interrupts
四、安装mesa
4.1 安装依赖
我们首先安装一些常见的工具包:
root@rk3399:~$ sudo apt install cmake git build-essential meson python3-pip
其中:
cmake : 用于构建C++ 项目的跨平台构建工具;git : 版本控制系统,用于管理代码库;meson : 构建系统,用于自动化项目的构建过程;python3-pip :Python 包管理器,用于安装和管理Python 包。
对于一个包是否已经安装,我们可以通过如下命令来判定,执行类似如下命令从本地仓库中查找指定的包名,支持通配符;
root@rk3399:/# apt list weston Listing... Done weston/focal 8.0.0-1 arm64
可以看到本地仓库中有
root@rk3399:/# apt list weston Listing... Done weston/focal,now 8.0.0-1 arm64 [installed]
4.1.1 安装mesa-utils
首先我们需要先安装
roott@rk3399:/test# apt install mesa-utils
以下是
glxinfo :该工具提供了有关系统上安装的OpenGL 实现的详细信息。您可以使用glxinfo 命令查看OpenGL 版本、支持的扩展、渲染器信息等。例如,运行glxinfo | grep "OpenGL version" 可以查看系统上安装的OpenGL 版本;glxgears : 这是一个简单的测试工具,用于检测系统对OpenGL 的支持情况。它会显示一个旋转的齿轮动画,并报告每秒渲染的帧数;glxheads : 这个工具可以列出当前系统中可用的X11 窗口和OpenGL 上下文,并提供有关它们的详细信息;
注意:
4.1.2 安装mesa
如果需要开发
root@rk3399:~$ apt install libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev
其中:
libgl1-mesa-dev : 用于编译和链接OpenGL 应用程序;OpenGL 是一套用于渲染2D 和3D 图形的API ,它支持广泛的硬件和操作系统平台,是mesa 图形库的核心部分;libgl1-mesa-dev 包含了OpenGL 的开发头文件和库,可以在开发环境中使用OpenGL 来编写和运行应用程序;libgles2-mesa-dev : 用于编译和链接OpenGL ES 2.0 应用程序;penGL ES 是面向嵌入式系统和移动设备的精简版OpenGL ,它提供了一套用于渲染2D 和3D 图形的API ;libgles2-mesa-dev 包含了GLES2 的开发头文件和库,可以在开发环境中使用GLES2 来编写和运行应用程序。libegl1-mesa-dev : 用于编译和链接EGL 应用程序;EGL 是一个用于管理原生窗口系统和图形渲染上下文的接口,它与底层图形系统进行交互,实现了跨平台和设备的图形渲染;libegl1-mesa-dev 包含了EGL 的开发头文件和库,可以在开发环境中使用EGL 来创建和管理窗口系统的集成。
4.1.3 安装opencl
root@rk3399:~$ apt install opencl-headers ocl-icd-libopencl1 ocl-icd-opencl-dev
安装
root@rk3399:~$ apt install mesa-opencl-icd
我们可以查看
root@rk3399:~$ ls -l /etc/OpenCL/vendors/ -rw-r--r-- 1 root root 19 Jan 20 19:50 mesa.icd root@rk3399:~$ cat /etc/OpenCL/vendors/mesa.icd libMesaOpenCL.so.1
4.1.4 查看头文件和库文件
安装完
root@rk3399:/opt# find /usr | grep lib.*GL.*.so # OpenGL等库 /usr/lib/libreoffice/program/libOGLTranslo.so /usr/lib/aarch64-linux-gnu/libOpenGL.so.0 /usr/lib/aarch64-linux-gnu/libGLU.so.1.3.1 /usr/lib/aarch64-linux-gnu/libEGL.so /usr/lib/aarch64-linux-gnu/libEGL.so.1 /usr/lib/aarch64-linux-gnu/libOpenGL.so.0.0.0 /usr/lib/aarch64-linux-gnu/libGLX_mesa.so.0.0.0 /usr/lib/aarch64-linux-gnu/libGL.so /usr/lib/aarch64-linux-gnu/libGLdispatch.so.0 /usr/lib/aarch64-linux-gnu/libGL.so.1.7.0 /usr/lib/aarch64-linux-gnu/libGLU.so.1 /usr/lib/aarch64-linux-gnu/libGLESv1_CM.so.1 /usr/lib/aarch64-linux-gnu/libGLESv1_CM.so /usr/lib/aarch64-linux-gnu/libEGL.so.1.1.0 /usr/lib/aarch64-linux-gnu/libGLdispatch.so /usr/lib/aarch64-linux-gnu/libGLESv2.so.2.1.0 /usr/lib/aarch64-linux-gnu/libGLESv2.so /usr/lib/aarch64-linux-gnu/libGL.so.1 /usr/lib/aarch64-linux-gnu/libEGL_mesa.so.0.0.0 /usr/lib/aarch64-linux-gnu/libGLX.so /usr/lib/aarch64-linux-gnu/libOpenGL.so /usr/lib/aarch64-linux-gnu/libGLX.so.0.0.0 /usr/lib/aarch64-linux-gnu/libGLX_indirect.so.0 /usr/lib/aarch64-linux-gnu/libEGL_mesa.so.0 /usr/lib/aarch64-linux-gnu/libGLdispatch.so.0.0.0 /usr/lib/aarch64-linux-gnu/libGLESv2.so.2 /usr/lib/aarch64-linux-gnu/libGLX.so.0 /usr/lib/aarch64-linux-gnu/libGLX_mesa.so.0 /usr/lib/aarch64-linux-gnu/libGLESv1_CM.so.1.2.0 root@rk3399:/opt# ls -l /usr/lib/aarch64-linux-gnu/dri/ # dri库 -rw-r--r-- 38 root root 23619952 Mar 9 2022 armada-drm_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 d3d12_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 etnaviv_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 exynos_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 hx8357d_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 ili9225_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 ili9341_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 imx-dcss_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 imx-drm_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 ingenic-drm_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 kgsl_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 kms_swrast_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 lima_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 mali-dp_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 mcde_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 mediatek_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 meson_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 mi0283qt_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 msm_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 mxsfb-drm_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 nouveau_dri.so -rw-r--r-- 3 root root 5796048 Mar 9 2022 nouveau_vieux_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 panfrost_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 pl111_dri.so -rw-r--r-- 3 root root 5796048 Mar 9 2022 r200_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 r300_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 r600_dri.so -rw-r--r-- 3 root root 5796048 Mar 9 2022 radeon_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 radeonsi_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 repaper_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 rockchip_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 st7586_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 st7735r_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 stm_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 sun4i-drm_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 swrast_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 tegra_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 v3d_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 vc4_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 virtio_gpu_dri.so -rw-r--r-- 38 root root 23619952 Mar 9 2022 zink_dri.so root@rk3399:/opt/mesa-22.0.0# ls -l /usr/lib/aarch64-linux-gnu/*OpenCL* # OpenCL库 #ocl-icd-opencl-dev包安装 lrwxrwxrwx 1 root root 18 Apr 5 2017 /usr/lib/aarch64-linux-gnu/libOpenCL.so -> libOpenCL.so.1.0.0 #ocl-icd-libopencl1包安装 lrwxrwxrwx 1 root root 18 Apr 5 2017 /usr/lib/aarch64-linux-gnu/libOpenCL.so.1 -> libOpenCL.so.1.0.0 -rw-r--r-- 1 root root 34808 Apr 5 2017 /usr/lib/aarch64-linux-gnu/libOpenCL.so.1.0.0 #mesa-opencl-icd包安装 lrwxrwxrwx 1 root root 18 Mar 9 2022 /usr/lib/aarch64-linux-gnu/libMesaOpenCL.so -> libMesaOpenCL.so.1 lrwxrwxrwx 1 root root 22 Mar 9 2022 /usr/lib/aarch64-linux-gnu/libMesaOpenCL.so.1 -> libMesaOpenCL.so.1.0.0 -rw-r--r-- 1 root root 1372512 Mar 9 2022 /usr/lib/aarch64-linux-gnu/libMesaOpenCL.so.1.0.0 root@rk3399:/opt# ls /usr/include | grep GL EGL GL GLES GLES2 GLES3 root@rk3399:/opt# ls -l /usr/include/EGL/ -rw-r--r-- 1 root root 20345 Jun 26 2020 egl.h -rw-r--r-- 1 root root 68048 Jun 26 2020 eglext.h -rw-r--r-- 1 root root 3192 Nov 25 2021 eglextchromium.h -rw-r--r-- 1 root root 2129 Nov 25 2021 eglmesaext.h -rw-r--r-- 1 root root 6049 Jun 26 2020 eglplatform.h root@rk3399:/opt# ls -l /usr/include/GL -rw-r--r-- 1 root root 80393 Jun 26 2020 gl.h -rw-r--r-- 1 root root 421339 Jun 26 2020 glcorearb.h -rw-r--r-- 1 root root 848032 Jun 26 2020 glext.h -rw-r--r-- 1 root root 16906 Jun 26 2020 glx.h -rw-r--r-- 1 root root 48370 Jun 26 2020 glxext.h -rw-r--r-- 1 root root 4695 Mar 9 2020 glxint.h -rw-r--r-- 1 root root 2085 Mar 9 2020 glxmd.h -rw-r--r-- 1 root root 78531 Mar 9 2020 glxproto.h -rw-r--r-- 1 root root 11429 Mar 9 2020 glxtokens.h drwxr-xr-x 2 root root 4096 Nov 13 13:22 root@rk3399:/opt# ls -l /usr/include/GLES -rw-r--r-- 1 root root 922 Jun 26 2020 egl.h -rw-r--r-- 1 root root 31669 Jun 26 2020 gl.h -rw-r--r-- 1 root root 53780 Jun 26 2020 glext.h -rw-r--r-- 1 root root 1152 Jun 26 2020 glplatform.h root@rk3399:/opt# ls -l /usr/include/GLES2 -rw-r--r-- 1 root root 43996 Jun 26 2020 gl2.h -rw-r--r-- 1 root root 231362 Jun 26 2020 gl2ext.h -rw-r--r-- 1 root root 1160 Jun 26 2020 gl2platform.h root@rk3399:/opt# ls -l /usr/include/GLES3 -rw-r--r-- 1 root root 82674 Jun 26 2020 gl3.h -rw-r--r-- 1 root root 107463 Jun 26 2020 gl31.h -rw-r--r-- 1 root root 128343 Jun 26 2020 gl32.h -rw-r--r-- 1 root root 166 Jun 26 2020 gl3ext.h -rw-r--r-- 1 root root 1160 Jun 26 2020 gl3platform.h
4.2 测试GPU
4.2.1 glxinfo
进入桌面后,打开一个终端,使用
roott@rk3399:/test# export DISPLAY=:0.0; glxinfo -B name of display: :0.0 display: :0 screen: 0 direct rendering: Yes Extended renderer info (GLX_MESA_query_renderer): Vendor: Panfrost (0xffffffff) Device: Mali T860 (Panfrost) (0xffffffff) Version: 21.2.6 Accelerated: yes Video memory: 3874MB Unified memory: yes Preferred profile: core (0x1) Max core profile version: 3.1 Max compat profile version: 3.1 Max GLES1 profile version: 1.1 Max GLES[23] profile version: 3.1 OpenGL vendor string: Panfrost OpenGL renderer string: Mali T860 (Panfrost) OpenGL core profile version string: 3.1 mesa 21.2.6 OpenGL core profile shading language version string: 1.40 OpenGL core profile context flags: (none) OpenGL version string: 3.1 mesa 21.2.6 OpenGL shading language version string: 1.40 OpenGL context flags: (none) OpenGL ES profile version string: OpenGL ES 3.1 mesa 21.2.6 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
前面有讲到,
我们在输出的信息中可以看到如下信息,这说明
OpenGL version string: 3.1 mesa 21.2.6
4.2.2 screenfetch
使用
root@rk3399:/test# sudo apt install screenfetch root@rk3399:/test# screenfetch Failed to init libxfconf: The connection is closed. Failed to init libxfconf: The connection is closed. ./+o+- zhengyang@rk3399 yyyyy- -yyyyyy+ OS: Ubuntu 20.04 focal ://+//-yyyyyyo Kernel: aarch64 Linux 5.2.8 .++ .:/++++++/-.+sss/` Uptime: 18m .:++o: /++++++++/:--:/- Packages: 1815 o:+o+:++.`..```.-/oo+++++/ Shell: bash 5.0.17 .:+o:+o/. `+sssoo+/ Resolution: 1920x1080 .++/+:+oo+o:` /sssooo. DE: Xfce /+++//+:`oo+o /::--:. WM: Xfwm4 +/+o+++`o++o ++. WM Theme: .++.o+++oo+:` /dddhhh. Font: Not Identified .+.o+oo:. `oddhhhh+ Disk: 6.6G / 17G (42%) +.++o+o``-````.:ohdhhhhh+ CPU: 6x Unknown `:o+++ `ohhhhhhhhyo++os: GPU: Mali T860 (Panfrost) .o:`.syhhhhhhh/.oo++o` RAM: 971MiB / 3874MiB /osyyyyyyo++ooo+++/ `````+oo+++o: `oo++.
4.2.3 GPU 工作情况
其实到这里,因为
cat /proc/interrupts 查看jpu 和job 产生的中断数量,如果GPU 在工作,会频繁产生中断;- 运行
top 命令,观察cpu 利用率,如果GPU 没工作,所有的图像渲染靠CPU ,CPU 占用率会高;
再次在
后来查阅资料判定可能是以下原因:
4.2.4 glmark2 测试
root@rk3399:~# sudo apt-get install glmark2
在桌面环境终端运行
root@rk3399:/test# glmark2 ======================================================= glmark2 2021.02 ======================================================= OpenGL Information GL_VENDOR: Panfrost GL_RENDERER: Mali T860 (Panfrost) GL_VERSION: 3.1 mesa 21.2.6 ======================================================= [build] use-vbo=false: FPS: 557 FrameTime: 1.795 ms [build] use-vbo=true: FPS: 612 FrameTime: 1.634 ms [texture] texture-filter=nearest: FPS: 674 FrameTime: 1.484 ms [texture] texture-filter=linear: FPS: 677 FrameTime: 1.477 ms [texture] texture-filter=mipmap: FPS: 672 FrameTime: 1.488 ms [shading] shading=gouraud: FPS: 518 FrameTime: 1.931 ms [shading] shading=blinn-phong-inf: FPS: 511 FrameTime: 1.957 ms [shading] shading=phong: FPS: 457 FrameTime: 2.188 ms [shading] shading=cel: FPS: 457 FrameTime: 2.188 ms [bump] bump-render=high-poly: FPS: 283 FrameTime: 3.534 ms [bump] bump-render=normals: FPS: 652 FrameTime: 1.534 ms [bump] bump-render=height: FPS: 634 FrameTime: 1.577 ms [effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 419 FrameTime: 2.387 ms [effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 196 FrameTime: 5.102 ms [pulsar] light=false:quads=5:texture=false: FPS: 677 FrameTime: 1.477 ms [desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 146 FrameTime: 6.849 ms [desktop] effect=shadow:windows=4: FPS: 556 FrameTime: 1.799 ms [buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 122 FrameTime: 8.197 ms [buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 23 FrameTime: 43.478 ms [buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 159 FrameTime: 6.289 ms [ideas] speed=duration: FPS: 356 FrameTime: 2.809 ms [jellyfish] <default>: FPS: 307 FrameTime: 3.257 ms [terrain] <default>: FPS: 19 FrameTime: 52.632 ms [shadow] <default>: FPS: 298 FrameTime: 3.356 ms [refract] <default>: FPS: 62 FrameTime: 16.129 ms [conditionals] fragment-steps=0:vertex-steps=0: FPS: 591 FrameTime: 1.692 ms [conditionals] fragment-steps=5:vertex-steps=0: FPS: 419 FrameTime: 2.387 ms [conditionals] fragment-steps=0:vertex-steps=5: FPS: 611 FrameTime: 1.637 ms [function] fragment-complexity=low:fragment-steps=5: FPS: 492 FrameTime: 2.033 ms [function] fragment-complexity=medium:fragment-steps=5: FPS: 368 FrameTime: 2.717 ms [loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 490 FrameTime: 2.041 ms [loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 491 FrameTime: 2.037 ms [loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 399 FrameTime: 2.506 ms ======================================================= glmark2 Score: 421 =======================================================
4.2.5 clinfo
通过
root@rk3399:/opt# apt install clinfo root@rk3399:/opt/mesa-22.0.0# clinfo Number of platforms 1 Platform Name Clover Platform Vendor Mesa Platform Version OpenCL 1.1 Mesa 21.2.6 Platform Profile FULL_PROFILE Platform Extensions cl_khr_icd Platform Extensions function suffix MESA Platform Name Clover Number of devices 0 NULL platform behavior clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) Clover clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) clCreateContext(NULL, ...) [default] No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT) No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR) No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM) No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL) No devices found in platform ICD loader properties ICD loader Name OpenCL ICD Loader ICD loader Vendor OCL Icd free software ICD loader Version 2.2.11 ICD loader Profile OpenCL 2.1 0
可以看出系统中安装了
4.3 Chromium 开启GPU
4.3.1 安装Chromium
运行以下命令以安装
root@rk3399:/opt# sudo apt-get install dialog root@rk3399:/opt# sudo apt install chromium-browser
这样,您就成功在
root@rk3399:/opt# export DISPLAY=:0.0; chromium-browser --no-sandbox --user-data-dir
4.3.2 GPU支持情况
安装的
硬件加速:
WebGL:Hardware accelerated ;WebGL2:Hardware accelerated 。
4.3.3 查看CPU 利用率
在
可以看到
五、编译安装mesa
接下来我们介绍一下
如果想在开发板上进行编译安装,必须首先安装
编译内核头文件章节:
root@zhengyang:/work/sambashare/rk3399/linux-6.3# make -j8 bindeb-pkgmkae bindeb-pkg
当执行
编译过程将包括编译内核、生成模块、创建
root@zhengyang:/work/sambashare/rk3399/linux-6.3# ll debian/ -rw-r--r-- 1 root root 6 Sep 23 20:58 arch -rw-r--r-- 1 root root 136 Sep 23 20:58 changelog -rw-r--r-- 1 root root 1239 Sep 23 20:58 control -rw-r--r-- 1 root root 691 Sep 23 20:58 copyright -rw-r--r-- 1 root root 264 Sep 23 21:05 files drwxr-xr-x 5 root root 4096 Sep 23 21:05 linux-headers/ drwxr-xr-x 7 root root 4096 Sep 23 21:04 linux-image/ drwxr-xr-x 4 root root 4096 Sep 23 21:05 linux-image-dbg/ drwxr-xr-x 4 root root 4096 Sep 23 21:05 linux-libc-dev/ -rwxr-xr-x 1 root root 486 Sep 23 20:58 rules*
同时会在内核上一级目录下生成如下
linux-image-<version>.deb :内核镜像文件,用于安装和引导新的内核;linux-headers-<version>.deb :内核头文件,用于开发其他软件或编译内核模块;linux-libc-dev_<version>.deb :用于构建用户空间软件的头文件和静态库;
这些生成的
将我们编译的头文件拷贝到开发板
root@rk3399:~# cd /opt root@rk3399:/opt# scp [email protected]:/work/sambashare/rk3399/linux-headers-6.3.0.deb /opt/ root@rk3399:/opt# sudo dpkg -i /opt/linux-headers-*.deb
安装完成后,我们可以看一下
root@rk3399:/opt$ ll /usr/src/ drwxr-xr-x 5 root root 4096 Nov 13 00:35 linux-headers-6.3.0 root@rk3399:/opt# ll /usr/src/linux-headers-6.3.0/ total 1400 drwxr-xr-x 5 root root 4096 Nov 13 00:35 ./ drwxr-xr-x 3 root root 4096 Nov 13 00:35 ../ -rw-r--r-- 1 root root 264166 Sep 23 20:58 .config -rw-r--r-- 1 root root 71751 Jun 12 2023 Makefile -rw-r--r-- 1 root root 1064676 Sep 23 20:58 Module.symvers drwxr-xr-x 3 root root 4096 Nov 13 00:35 arch/ drwxr-xr-x 33 root root 4096 Nov 13 00:35 include/ drwxr-xr-x 17 root root 12288 Nov 13 00:35 scripts/
5.2 下载mesa
root@rk3399:/opt# wget https://archive.mesa3d.org/mesa-22.0.0.tar.xz root@rk3399:/opt# tar -xvf mesa-22.0.0.tar.xz root@rk3399:/opt# cd mesa-22.0.0
5.2.1 升级meson
root@rk3399:/opt# sudo apt install python3-pip root@rk3399:/opt# pip3 install meson==0.63 root@rk3399:/opt/mesa-22.0.0# cp /usr/local/bin/meson /usr/bin/
备注:
5.2.2 升级cmake
root@rk3399:/opt# sudo apt remove cmake # 移除低版本cmake 3.16.3 root@rk3399:/opt# wget https://521github.com/extdomains/github.com/Kitware/CMake/releases/download/v3.28.0/cmake-3.28.0-linux-aarch64.tar.gz root@rk3399:/opt# tar -xzvf cmake-3.28.0-linux-aarch64.tar.gz root@rk3399:/opt# mv cmake-3.28.0-linux-aarch64 cmake-3.28.0 root@rk3399:/opt# ln -sf /opt/cmake-3.28.0/bin/* /usr/bin/ root@rk3399:/opt# cmake --version cmake version 3.28.0 CMake suite maintained and supported by Kitware (kitware.com/cmake). root@rk3399:/opt# vim /etc/profile export PATH=$PATH:/opt/cmake-3.28.0/bin root@rk3399:/opt# source /etc/profile
5.3 安装依赖
5.3.1 安装glslang
安装
root@rk3399:/opt# wget https://521github.com/extdomains/github.com/KhronosGroup/glslang/archive/refs/tags/14.0.0.tar.gz root@rk3399:/opt# tar -xvf 14.0.0.tar.gz root@rk3399:/opt# cd glslang-14.0.0 root@rk3399:/opt/glslang-14.0.0# ./update_glslang_sources.py # 如果下载慢,github修改镜像 root@rk3399:/opt/glslang-14.0.0# cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$(pwd)/install" . root@rk3399:/opt/glslang-14.0.0# make -j4 install root@rk3399:/opt/glslang-14.0.0# mv install/bin/* /usr/local/bin/ root@rk3399:/opt/glslang-14.0.0# mv install/lib/* /usr/local/lib/ root@rk3399:/opt/glslang-14.0.0# mv install/include/* /usr/local/include/ root@rk3399:/opt/glslang-14.0.0# cd .. root@rk3399:/opt# rm -rf glslang-14.0.0*
5.3.2 安装libdrm
下载源码:
root@rk3399:/opt# get https://dri.freedesktop.org/libdrm/libdrm-2.4.118.tar.xz root@rk3399:/opt# tar -xvf libdrm-2.4.118.tar.xz root@rk3399:/opt# mv libdrm-2.4.118 drm
在编译和安装
root@rk3399:/opt# apt install autoconf libtool pkg-config libpciaccess-dev
编译和安装:
root@rk3399:/opt# cd drm root@rk3399:/opt/drm# meson build root@rk3399:/opt/drm# ninja -C build root@rk3399:/opt/drm# ninja -C build install ninja: Entering directory `build' [0/1] Installing files. Installing libdrm.so.2.4.0 to /usr/local/lib/aarch64-linux-gnu Installing nouveau/libdrm_nouveau.so.2.0.0 to /usr/local/lib/aarch64-linux-gnu Installing radeon/libdrm_radeon.so.1.0.1 to /usr/local/lib/aarch64-linux-gnu Installing amdgpu/libdrm_amdgpu.so.1.0.0 to /usr/local/lib/aarch64-linux-gnu Installing freedreno/libdrm_freedreno.so.1.0.0 to /usr/local/lib/aarch64-linux-gnu Installing etnaviv/libdrm_etnaviv.so.1.0.0 to /usr/local/lib/aarch64-linux-gnu Installing /opt/drm/libsync.h to /usr/local/include Installing /opt/drm/xf86drm.h to /usr/local/include Installing /opt/drm/xf86drmMode.h to /usr/local/include Installing /opt/drm/include/drm/drm.h to /usr/local/include/libdrm Installing /opt/drm/include/drm/drm_fourcc.h to /usr/local/include/libdrm Installing /opt/drm/include/drm/drm_mode.h to /usr/local/include/libdrm Installing /opt/drm/include/drm/drm_sarea.h to /usr/local/include/libdrm Installing /opt/drm/include/drm/i915_drm.h to /usr/local/include/libdrm Installing /opt/drm/include/drm/mach64_drm.h to /usr/local/include/libdrm Installing /opt/drm/include/drm/mga_drm.h to /usr/local/include/libdrm Installing /opt/drm/include/drm/msm_drm.h to /usr/local/include/libdrm Installing /opt/drm/include/drm/nouveau_drm.h to /usr/local/include/libdrm Installing /opt/drm/include/drm/qxl_drm.h to /usr/local/include/libdrm Installing /opt/drm/include/drm/r128_drm.h to /usr/local/include/libdrm ...... root@rk3399:/opt/drm# cd .. root@rk3399:/opt# rm -rf libdrm-2.4.118.tar.xz root@rk3399:/opt# rm -rf drm
头文件安装到
root@rk3399:/opt/mesa-22.0.0 libdrm_tegra.so.0 (libc6,AArch64) => /lib/aarch64-linux-gnu/libdrm_tegra.so.0 libdrm_tegra.so (libc6,AArch64) => /lib/aarch64-linux-gnu/libdrm_tegra.so libdrm_radeon.so.1 (libc6,AArch64) => /usr/local/lib/aarch64-linux-gnu/libdrm_radeon.so.1 libdrm_radeon.so.1 (libc6,AArch64) => /lib/aarch64-linux-gnu/libdrm_radeon.so.1 libdrm_radeon.so (libc6,AArch64) => /usr/local/lib/aarch64-linux-gnu/libdrm_radeon.so libdrm_radeon.so (libc6,AArch64) => /lib/aarch64-linux-gnu/libdrm_radeon.so libdrm_nouveau.so.2 (libc6,AArch64) => /usr/local/lib/aarch64-linux-gnu/libdrm_nouveau.so.2 libdrm_nouveau.so.2 (libc6,AArch64) => /lib/aarch64-linux-gnu/libdrm_nouveau.so.2 libdrm_nouveau.so (libc6,AArch64) => /usr/local/lib/aarch64-linux-gnu/libdrm_nouveau.so libdrm_nouveau.so (libc6,AArch64) => /lib/aarch64-linux-gnu/libdrm_nouveau.so libdrm_freedreno.so.1 (libc6,AArch64) => /usr/local/lib/aarch64-linux-gnu/libdrm_freedreno.so.1 libdrm_freedreno.so.1 (libc6,AArch64) => /lib/aarch64-linux-gnu/libdrm_freedreno.so.1 libdrm_freedreno.so (libc6,AArch64) => /usr/local/lib/aarch64-linux-gnu/libdrm_freedreno.so libdrm_freedreno.so (libc6,AArch64) => /lib/aarch64-linux-gnu/libdrm_freedreno.so libdrm_etnaviv.so.1 (libc6,AArch64) => /lib/aarch64-linux-gnu/libdrm_etnaviv.so.1 libdrm_etnaviv.so (libc6,AArch64) => /lib/aarch64-linux-gnu/libdrm_etnaviv.so libdrm_amdgpu.so.1 (libc6,AArch64) => /usr/local/lib/aarch64-linux-gnu/libdrm_amdgpu.so.1 libdrm_amdgpu.so.1 (libc6,AArch64) => /lib/aarch64-linux-gnu/libdrm_amdgpu.so.1 libdrm_amdgpu.so (libc6,AArch64) => /usr/local/lib/aarch64-linux-gnu/libdrm_amdgpu.so libdrm_amdgpu.so (libc6,AArch64) => /lib/aarch64-linux-gnu/libdrm_amdgpu.so libdrm.so.2 (libc6,AArch64) => /usr/local/lib/aarch64-linux-gnu/libdrm.so.2 libdrm.so.2 (libc6,AArch64) => /lib/aarch64-linux-gnu/libdrm.so.2 libdrm.so (libc6,AArch64) => /usr/local/lib/aarch64-linux-gnu/libdrm.so libdrm.so (libc6,AArch64) => /lib/aarch64-linux-gnu/libdrm.so
5.3.3 安装llvm
root@rk3399:/opt# apt install llvm-11 clang-11 root@rk3399:/opt# cd /usr/bin root@rk3399:/usr/bin# rm -rf /usr/bin/llvm-config root@rk3399:/usr/bin# ln -s ../lib/llvm-11/bin/llvm-config /usr/bin/llvm-config root@rk3399:/usr/bin# ls -l /usr/bin/llvm-config* lrwxrwxrwx 1 root root 30 Jan 20 17:24 /usr/bin/llvm-config -> ../lib/llvm-11/bin/llvm-config lrwxrwxrwx 1 root root 30 Apr 20 2020 /usr/bin/llvm-config-10 -> ../lib/llvm-10/bin/llvm-config lrwxrwxrwx 1 root root 30 Oct 30 2020 /usr/bin/llvm-config-11 -> ../lib/llvm-11/bin/llvm-config lrwxrwxrwx 1 root root 29 Mar 19 2020 /usr/bin/llvm-config-8 -> ../lib/llvm-8/bin/llvm-config root@rk3399:/usr/bin# llvm-config --version 11.0.0 root@rk3399:/usr/bin# llvm-config --libdir /usr/lib/llvm-11/lib
5.3.4 安装其它依赖
root@rk3399:/opt# apt install flex bison python3-mako libwayland-egl-backend-dev libxcb-dri3-dev libxcb-dri2-0-dev libxcb-glx0-dev ibxcb-shm0-dev libx11-xcb-dev libxcb-present-dev libxcb-sync-dev libxxf86vm-dev libxshmfence-dev libxrandr-dev libwayland-dev libxdamage-dev libxext-dev libxfixes-dev x11proto-dri2-dev x11proto-dri3-dev x11proto-present-dev x11proto-gl-dev x11proto-xf86vidmode-dev libexpat1-dev libudev-dev gettext xutils-dev libpthread-stubs0-dev bc valgrind llvm llvm-8-dev zlib1g-dev wayland-protocols libelf-dev
5.4 编译mesa
编译
5.4.1 配置
执行如下命令在
root@rk3399:/opt/mesa-22.0.0# meson -Dplatforms=x11 -Dvulkan-drivers=panfrost -Dgallium-drivers=panfrost -Dgallium-opencl=icd -Dlibunwind=disabled -Dprefix=/opt/mesa builddir/ The Meson build system Version: 0.63.0 Source dir: /opt/mesa-22.0.0 Build dir: /opt/mesa-22.0.0/builddir Build type: native build Program python3 found: YES (/usr/bin/python3) Project name: mesa Project version: 22.0.0 ...... Message: Configuration summary: prefix: /opt/mesa libdir: lib/aarch64-linux-gnu includedir: include OpenGL: yes (ES1: yes ES2: yes) OSMesa: no DRI platform: drm DRI drivers: no DRI driver dir: /opt/mesa/lib/aarch64-linux-gnu/dri GLX: DRI-based EGL: yes EGL drivers: builtin:egl_dri2 builtin:egl_dri3 EGL/Vulkan/VL platforms: x11 surfaceless drm xcb GBM: yes GBM backends path: /opt/mesa/lib/aarch64-linux-gnu/gbm Vulkan drivers: panfrost Vulkan ICD dir: share/vulkan/icd.d llvm: yes llvm-version: 11.0.0 Gallium drivers: panfrost Gallium st: mesa clover HUD lmsensors: no Shared-glapi: yes Perfetto: no Perfetto ds: auto Build targets in project: 178 NOTICE: Future-deprecated features used: * 0.55.0: {'ExternalProgram.path'} * 0.56.0: {'meson.source_root'} mesa 22.0.0 User defined options prefix : /opt/mesa gallium-drivers: panfrost gallium-opencl : icd libunwind : disabled platforms : x11 vulkan-drivers : panfrost
其中:
-Dplatforms=x11 :设置要支持的窗口系统为x11 ;-Dvulkan-drivers=panfrost 指定要构建的Vulkan 驱动程序列表;-Dgallium-drivers=panfrost :指定要构建的gallium 驱动程序列表;-Dgallium-opencl=icd :build gallium "clover" OpenCL frontend ;-Dlibunwind=false :禁用libunwind 来获取堆栈跟踪信息;-Dprefix=/opt/mesa :指定安装目录;如果不指定,默认安装到/usr ;
更多配置选项可以参考当前目录下
5.4.2 编译
编译项目:
root@rk3399:/opt/mesa-22.0.0# ninja -C builddir/ -j6
5.4.3 安装到/opt/mesa
最后一步进行安装:
root@rk3399:/opt/mesa-22.0.0# ninja -C builddir/ install ninja: Entering directory `builddir/' [1/2] Installing files. Installing src/mapi/shared-glapi/libglapi.so.0.0.0 to /opt/mesa/lib/aarch64-linux-gnu Installing src/mapi/es1api/libGLESv1_CM.so.1.1.0 to /opt/mesa/lib/aarch64-linux-gnu Installing src/mapi/es2api/libGLESv2.so.2.0.0 to /opt/mesa/lib/aarch64-linux-gnu Installing src/panfrost/vulkan/libvulkan_panfrost.so to /opt/mesa/lib/aarch64-linux-gnu Installing src/panfrost/vulkan/panfrost_icd.aarch64.json to /opt/mesa/share/vulkan/icd.d Installing src/gbm/libgbm.so.1.0.0 to /opt/mesa/lib/aarch64-linux-gnu Installing src/gallium/targets/pipe-loader/pipe_kmsro.so to /opt/mesa/lib/aarch64-linux-gnu/gallium-pipe Installing src/gallium/targets/opencl/libMesaOpenCL.so.1.0.0 to /opt/mesa/lib/aarch64-linux-gnu Installing src/gallium/targets/dri/libgallium_dri.so to /opt/mesa/lib/aarch64-linux-gnu/dri Installing src/glx/libGL.so.1.2.0 to /opt/mesa/lib/aarch64-linux-gnu Installing src/egl/libEGL.so.1.0.0 to /opt/mesa/lib/aarch64-linux-gnu Installing /opt/mesa-22.0.0/include/KHR/khrplatform.h to /opt/mesa/include/KHR/ Installing /opt/mesa-22.0.0/include/GLES/egl.h to /opt/mesa/include/GLES/ Installing /opt/mesa-22.0.0/include/GLES/gl.h to /opt/mesa/include/GLES/ Installing /opt/mesa-22.0.0/include/GLES/glext.h to /opt/mesa/include/GLES/ Installing /opt/mesa-22.0.0/include/GLES/glplatform.h to /opt/mesa/include/GLES/ Installing /opt/mesa-22.0.0/include/GLES2/gl2.h to /opt/mesa/include/GLES2/ Installing /opt/mesa-22.0.0/include/GLES2/gl2ext.h to /opt/mesa/include/GLES2/ Installing /opt/mesa-22.0.0/include/GLES2/gl2platform.h to /opt/mesa/include/GLES2/ Installing /opt/mesa-22.0.0/include/GLES3/gl3.h to /opt/mesa/include/GLES3/ Installing /opt/mesa-22.0.0/include/GLES3/gl31.h to /opt/mesa/include/GLES3/ Installing /opt/mesa-22.0.0/include/GLES3/gl32.h to /opt/mesa/include/GLES3/ Installing /opt/mesa-22.0.0/include/GLES3/gl3ext.h to /opt/mesa/include/GLES3/ Installing /opt/mesa-22.0.0/include/GLES3/gl3platform.h to /opt/mesa/include/GLES3/ Installing /opt/mesa-22.0.0/include/GL/gl.h to /opt/mesa/include/GL/ Installing /opt/mesa-22.0.0/include/GL/glcorearb.h to /opt/mesa/include/GL/ Installing /opt/mesa-22.0.0/include/GL/glext.h to /opt/mesa/include/GL/ Installing /opt/mesa-22.0.0/include/GL/glx.h to /opt/mesa/include/GL/ Installing /opt/mesa-22.0.0/include/GL/glxext.h to /opt/mesa/include/GL/ Installing /opt/mesa-22.0.0/include/EGL/egl.h to /opt/mesa/include/EGL/ Installing /opt/mesa-22.0.0/include/EGL/eglext.h to /opt/mesa/include/EGL/ Installing /opt/mesa-22.0.0/include/EGL/eglplatform.h to /opt/mesa/include/EGL/ Installing /opt/mesa-22.0.0/include/EGL/eglmesaext.h to /opt/mesa/include/EGL/ Installing /opt/mesa-22.0.0/include/EGL/eglextchromium.h to /opt/mesa/include/EGL/ Installing /opt/mesa-22.0.0/include/GL/internal/dri_interface.h to /opt/mesa/include/GL/internal/ Installing /opt/mesa-22.0.0/src/gbm/main/gbm.h to /opt/mesa/include/ Installing /opt/mesa-22.0.0/src/util/00-mesa-defaults.conf to /opt/mesa/share/drirc.d Installing /opt/mesa-22.0.0/builddir/meson-private/glesv1_cm.pc to /opt/mesa/lib/aarch64-linux-gnu/pkgconfig Installing /opt/mesa-22.0.0/builddir/meson-private/glesv2.pc to /opt/mesa/lib/aarch64-linux-gnu/pkgconfig Installing /opt/mesa-22.0.0/builddir/meson-private/gbm.pc to /opt/mesa/lib/aarch64-linux-gnu/pkgconfig Installing /opt/mesa-22.0.0/builddir/src/gallium/targets/opencl/mesa.icd to /opt/mesa/etc/OpenCL/vendors Installing /opt/mesa-22.0.0/builddir/meson-private/dri.pc to /opt/mesa/lib/aarch64-linux-gnu/pkgconfig Installing /opt/mesa-22.0.0/builddir/meson-private/egl.pc to /opt/mesa/lib/aarch64-linux-gnu/pkgconfig Installing /opt/mesa-22.0.0/builddir/meson-private/gl.pc to /opt/mesa/lib/aarch64-linux-gnu/pkgconfig Installing symlink pointing to libglapi.so.0.0.0 to /opt/mesa/lib/aarch64-linux-gnu/libglapi.so.0 Installing symlink pointing to libglapi.so.0 to /opt/mesa/lib/aarch64-linux-gnu/libglapi.so Installing symlink pointing to libGLESv1_CM.so.1.1.0 to /opt/mesa/lib/aarch64-linux-gnu/libGLESv1_CM.so.1 Installing symlink pointing to libGLESv1_CM.so.1 to /opt/mesa/lib/aarch64-linux-gnu/libGLESv1_CM.so Installing symlink pointing to libGLESv2.so.2.0.0 to /opt/mesa/lib/aarch64-linux-gnu/libGLESv2.so.2 Installing symlink pointing to libGLESv2.so.2 to /opt/mesa/lib/aarch64-linux-gnu/libGLESv2.so Installing symlink pointing to libgbm.so.1.0.0 to /opt/mesa/lib/aarch64-linux-gnu/libgbm.so.1 Installing symlink pointing to libgbm.so.1 to /opt/mesa/lib/aarch64-linux-gnu/libgbm.so Installing symlink pointing to libMesaOpenCL.so.1.0.0 to /opt/mesa/lib/aarch64-linux-gnu/libMesaOpenCL.so.1 Installing symlink pointing to libMesaOpenCL.so.1 to /opt/mesa/lib/aarch64-linux-gnu/libMesaOpenCL.so Installing symlink pointing to libGL.so.1.2.0 to /opt/mesa/lib/aarch64-linux-gnu/libGL.so.1 Installing symlink pointing to libGL.so.1 to /opt/mesa/lib/aarch64-linux-gnu/libGL.so Installing symlink pointing to libEGL.so.1.0.0 to /opt/mesa/lib/aarch64-linux-gnu/libEGL.so.1 Installing symlink pointing to libEGL.so.1 to /opt/mesa/lib/aarch64-linux-gnu/libEGL.so Running custom install script '/usr/bin/python3 /opt/mesa-22.0.0/bin/install_megadrivers.py /opt/mesa-22.0.0/builddir/src/gallium/targets/dri/libgallium_dri.so /opt/mesa/lib/aarch64-linux-gnu/dri armada-drm_dri.so exynos_dri.so hx8357d_dri.so ili9225_dri.so ili9341_dri.so imx-drm_dri.so imx-dcss_dri.so ingenic-drm_dri.so kirin_dri.so komeda_dri.so mali-dp_dri.so mcde_dri.so mediatek_dri.so meson_dri.so mi0283qt_dri.so mxsfb-drm_dri.so pl111_dri.so rcar-du_dri.so repaper_dri.so rockchip_dri.so st7586_dri.so st7735r_dri.so stm_dri.so sun4i-drm_dri.so panfrost_dri.so'
root@rk3399:/opt/mesa-22.0.0# ll /opt/mesa drwxr-xr-x 3 root root 4096 Jan 20 20:29 etc/ drwxr-xr-x 8 root root 4096 Jan 20 20:29 include/ drwxr-xr-x 3 root root 4096 Jan 20 20:29 lib/ drwxr-xr-x 4 root root 4096 Jan 20 20:29 share/ root@rk3399:/opt/mesa-22.0.0# ll /opt/mesa/include # 头文件 ├── EGL │ ├── egl.h │ ├── eglext.h │ ├── eglextchromium.h │ ├── eglmesaext.h │ ├── eglplatform.h ├── GL │ ├── gl.h │ ├── glcorearb.h │ ├── glext.h │ ├── glx.h │ ├── glxext.h │ ├── internal │ ├── dri_interface.h ├── GLES │ ├── egl.h │ ├── gl.h │ ├── glext.h │ ├── glplatform.h ├── GLES2 │ ├── gl2.h │ ├── gl2ext.h │ ├── gl2platform.h ├── GLES3 │ ├── gl3.h │ ├── gl31.h │ ├── gl32.h │ ├── gl3ext.h │ ├── gl3platform.h ├── KHR │ ├── khrplatform.h gbm.h root@rk3399:/opt/mesa-22.0.0# ll /opt/mesa/lib # 库文件 drwxr-xr-x 5 root root 4096 Jan 20 20:29 aarch64-linux-gnu/ root@rk3399:/opt/mesa-22.0.0# ll /opt/mesa/lib/aarch64-linux-gnu ├── dri │ ├── armada-drm_dri.so │ ├── exynos_dri.so │ ├── hx8357d_dri.so │ ├── ili9225_dri.so │ ├── ili9341_dri.so │ ├── imx-dcss_dri.so │ ├── imx-drm_dri.so │ ├── ingenic-drm_dri.so │ ├── kirin_dri.so │ ├── komeda_dri.so │ ├── mali-dp_dri.so │ ├── mcde_dri.so │ ├── mediatek_dri.so │ ├── meson_dri.so │ ├── mi0283qt_dri.so │ ├── mxsfb-drm_dri.so │ ├── panfrost_dri.so │ ├── pl111_dri.so │ ├── rcar-du_dri.so │ ├── repaper_dri.so │ ├── rockchip_dri.so │ ├── st7586_dri.so │ ├── st7735r_dri.so │ ├── stm_dri.so │ ├── sun4i-drm_dri.so ├── libEGL.so -> libEGL.so.1 ├── libEGL.so.1 -> libEGL.so.1.0.0 ├── libEGL.so.1.0.0 ├── libGL.so -> libGL.so.1 ├── libGL.so.1 -> libGL.so.1.2.0 ├── libGL.so.1.2.0 ├── libGLESv1_CM.so -> libGLESv1_CM.so.1 ├── libGLESv1_CM.so.1 -> libGLESv1_CM.so.1.1.0 ├── libGLESv1_CM.so.1.1.0 ├── libGLESv2.so -> libGLESv2.so.2 ├── libGLESv2.so.2 -> libGLESv2.so.2.0.0 ├── libGLESv2.so.2.0.0 ├── libMesaOpenCL.so -> libMesaOpenCL.so.1 ├── libMesaOpenCL.so.1 -> libMesaOpenCL.so.1.0.0 ├── libMesaOpenCL.so.1.0.0 ├── libgbm.so -> libgbm.so.1 ├── libgbm.so.1 -> libgbm.so.1.0.0 ├── libgbm.so.1.0.0 ├── libglapi.so -> libglapi.so.0 ├── libglapi.so.0 -> libglapi.so.0.0.0 ├── libglapi.so.0.0.0 ├── libvulkan_panfrost.so └── pkgconfig
这里
ili9225 是intel 的;panfrost 是mali 的;
之后将编译出来的库文件放到开发板对应位置就可以使用了。当然这里
4.4.4 安装到默认路径
我们卸载之前通过
root@rk3399:/opt/mesa-22.0.0# apt remove libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev mesa-opencl-icd root@rk3399:/opt/mesa-22.0.0# rm -rf /usr/lib/aarch64-linux-gnu/dri /usr/include/EGL /usr/include/GLES /usr/include/GLES2 /usr/include/GLE3
修改
root@rk3399:/opt/mesa-22.0.0
重新安装:
root@rk3399:/opt/mesa-22.0.0# ninja -C builddir/ install ninja: Entering directory `builddir/' [0/1] Regenerating build files. The Meson build system Version: 0.63.0 Source dir: /opt/mesa-22.0.0 Build dir: /opt/mesa-22.0.0/builddir Build type: native build Program python3 found: YES (/usr/bin/python3) Project name: mesa Project version: 22.0.0 C compiler for the host machine: cc (gcc 9.4.0 "cc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0") C linker for the host machine: cc ld.bfd 2.34 C++ compiler for the host machine: c++ (gcc 9.4.0 "c++ (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0") C++ linker for the host machine: c++ ld.bfd 2.34 Host machine cpu family: aarch64 Host machine cpu: aarch64 Checking if "-mtls-dialect=gnu2" runs: DID NOT COMPILE Dependency libclc found: YES 0.2.0 (cached) Program python3 found: YES (/usr/bin/python3) Fetching value of define "ETIME" : 62 (cached) Checking for function "bswap32" : YES (cached) Checking for function "bswap64" : YES (cached) Checking for function "clz" : YES (cached) ..... Checking for function "dlopen" : NO (cached) Library dl found: YES Checking for function "dladdr" with dependency -ldl: YES (cached) Checking for function "dl_iterate_phdr" : YES (cached) Checking for function "clock_gettime" : YES (cached) Dependency zlib found: YES 1.2.11 (cached) Found pkg-config: /usr/bin/pkg-config (0.29.1) Found CMake: /usr/bin/cmake (3.28.0) Run-time dependency libzstd found: NO (tried pkgconfig and cmake) Dependency threads found: YES unknown (cached) Checking for function "pthread_setaffinity_np" with dependency threads: YES (cached) Dependency expat found: YES 2.2.9 (cached) Library m found: YES Dependency libdrm found: YES 2.4.118 (cached) Dependency libudev found: YES 245 (cached) WARNING: Optional LLVM module all-targets was not found WARNING: CMake: Dependency z for LLVM was not found WARNING: CMake: Dependency rt for LLVM was not found ...... WARNING: Ignoring LLVM CMake dependency because dynamic was requested llvm-config found: YES (/usr/bin/llvm-config) 11.0.0 Run-time dependency LLVM (modules: bitwriter, core, coverage, engine, executionengine, instcombine, instrumentation, ipo, irreader, linker, lto, mcdisassembler, mcjit, objc arcopts, option, profiledata, scalaropts, transformutils, all-targets, coroutines, frontendopenmp) found: YES 11.0.0 Dependency libelf found: YES 0.176 (cached) Dependency valgrind found: YES 3.15.0 (cached) Program bison found: YES (/usr/bin/bison) Program bison found: YES 3.5.1 (/usr/bin/bison) Program flex found: YES (/usr/bin/flex) Dependency x11 found: YES 1.6.9 (cached) Dependency xext found: YES 1.3.4 (cached) Dependency xfixes found: YES 5.0.3 (cached) Dependency xcb-glx found: YES 1.14 (cached) Dependency xcb-shm found: YES 1.14 (cached) Dependency xcb found: YES 1.14 (cached) Dependency x11-xcb found: YES 1.6.9 (cached) Dependency xcb-dri2 found: YES 1.14 (cached) Dependency xcb-dri3 found: YES 1.14 (cached) Dependency xcb-present found: YES 1.14 (cached) Dependency xcb-shm found: YES 1.14 (cached) Dependency xcb-sync found: YES 1.14 (cached) Dependency xshmfence found: YES 1.3 (cached) Dependency glproto found: YES 1.4.17 (cached) Dependency dri2proto found: YES 2.8 (cached) Dependency xxf86vm found: YES 1.1.4 (cached) Dependency xcb-xfixes found: YES 1.14 (cached) Dependency xcb-randr found: YES 1.14 (cached) Dependency xrandr found: YES 1.5.2 (cached) Library sensors found: NO Program nm found: YES (/usr/bin/nm) Program symbols-check.py found: YES (/usr/bin/python3 /opt/mesa-22.0.0/bin/symbols-check.py) Program install_megadrivers.py found: YES (/usr/bin/python3 /opt/mesa-22.0.0/bin/install_megadrivers.py) WARNING: Library target 'GLESv1_CM' has 'name_prefix' set. Compilers may not find it from its '-lGLESv1_CM' linker flag in the 'glesv1_cm.pc' pkg-config file. WARNING: Library target 'GLESv1_CM' has 'name_prefix' set. Compilers may not find it from its '-lGLESv1_CM' linker flag in the 'glesv1_cm-uninstalled.pc' pkg-config file. WARNING: Library target 'GLESv2' has 'name_prefix' set. Compilers may not find it from its '-lGLESv2' linker flag in the 'glesv2.pc' pkg-config file. WARNING: Library target 'GLESv2' has 'name_prefix' set. Compilers may not find it from its '-lGLESv2' linker flag in the 'glesv2-uninstalled.pc' pkg-config file. Checking for function "mmap" : YES (cached) Program decode.py found: YES (/opt/mesa-22.0.0/src/compiler/isaspec/decode.py) Program encode.py found: YES (/opt/mesa-22.0.0/src/compiler/isaspec/encode.py) Compiler for C++ supports arguments -Wno-ignored-attributes: YES (cached) Library Polly found: YES Library PollyISL found: YES Library clang-cpp found: YES Compiler for C++ supports link arguments -Wl,--rpath=/usr/lib/llvm-11/lib: YES (cached) Checking if "dep-clang-usable" with dependencies LLVM, -lclang-cpp, threads runs: YES Configuring mesa.icd using configuration Checking for function "mincore" : YES (cached) WARNING: Library target 'EGL' has 'name_prefix' set. Compilers may not find it from its '-lEGL' linker flag in the 'egl.pc' pkg-config file. WARNING: Library target 'EGL' has 'name_prefix' set. Compilers may not find it from its '-lEGL' linker flag in the 'egl-uninstalled.pc' pkg-config file. Message: Configuration summary: prefix: /usr libdir: lib/aarch64-linux-gnu includedir: include OpenGL: yes (ES1: yes ES2: yes) OSMesa: no DRI platform: drm DRI drivers: no DRI driver dir: /usr/lib/aarch64-linux-gnu/dri GLX: DRI-based EGL: yes EGL drivers: builtin:egl_dri2 builtin:egl_dri3 EGL/Vulkan/VL platforms: x11 surfaceless drm xcb GBM: yes GBM backends path: /usr/lib/aarch64-linux-gnu/gbm Vulkan drivers: panfrost Vulkan ICD dir: share/vulkan/icd.d llvm: yes llvm-version: 11.0.0 Gallium drivers: panfrost Gallium st: mesa clover HUD lmsensors: no Shared-glapi: yes Perfetto: no Perfetto ds: auto Build targets in project: 178 NOTICE: Future-deprecated features used: * 0.55.0: {'ExternalProgram.path'} * 0.56.0: {'meson.source_root'} mesa 22.0.0 User defined options backend : ninja prefix : /usr gallium-drivers: panfrost gallium-opencl : icd libunwind : disabled platforms : x11 vulkan-drivers : panfrost Found ninja-1.10.0 at /usr/bin/ninja Cleaning... 0 files. [21/22] Installing files. Installing src/mapi/shared-glapi/libglapi.so.0.0.0 to /usr/lib/aarch64-linux-gnu Installing src/mapi/es1api/libGLESv1_CM.so.1.1.0 to /usr/lib/aarch64-linux-gnu Installing src/mapi/es2api/libGLESv2.so.2.0.0 to /usr/lib/aarch64-linux-gnu Installing src/panfrost/vulkan/libvulkan_panfrost.so to /usr/lib/aarch64-linux-gnu Installing src/panfrost/vulkan/panfrost_icd.aarch64.json to /usr/share/vulkan/icd.d Installing src/gbm/libgbm.so.1.0.0 to /usr/lib/aarch64-linux-gnu Installing src/gallium/targets/pipe-loader/pipe_kmsro.so to /usr/lib/aarch64-linux-gnu/gallium-pipe Installing src/gallium/targets/opencl/libMesaOpenCL.so.1.0.0 to /usr/lib/aarch64-linux-gnu Installing src/gallium/targets/dri/libgallium_dri.so to /usr/lib/aarch64-linux-gnu/dri Installing src/glx/libGL.so.1.2.0 to /usr/lib/aarch64-linux-gnu Installing src/egl/libEGL.so.1.0.0 to /usr/lib/aarch64-linux-gnu Installing /opt/mesa-22.0.0/include/KHR/khrplatform.h to /usr/include/KHR Installing /opt/mesa-22.0.0/include/GLES/egl.h to /usr/include/GLES Installing /opt/mesa-22.0.0/include/GLES/gl.h to /usr/include/GLES Installing /opt/mesa-22.0.0/include/GLES/glext.h to /usr/include/GLES Installing /opt/mesa-22.0.0/include/GLES/glplatform.h to /usr/include/GLES Installing /opt/mesa-22.0.0/include/GLES2/gl2.h to /usr/include/GLES2 Installing /opt/mesa-22.0.0/include/GLES2/gl2ext.h to /usr/include/GLES2 Installing /opt/mesa-22.0.0/include/GLES2/gl2platform.h to /usr/include/GLES2 Installing /opt/mesa-22.0.0/include/GLES3/gl3.h to /usr/include/GLES3 Installing /opt/mesa-22.0.0/include/GLES3/gl31.h to /usr/include/GLES3 Installing /opt/mesa-22.0.0/include/GLES3/gl32.h to /usr/include/GLES3 Installing /opt/mesa-22.0.0/include/GLES3/gl3ext.h to /usr/include/GLES3 Installing /opt/mesa-22.0.0/include/GLES3/gl3platform.h to /usr/include/GLES3 Installing /opt/mesa-22.0.0/include/GL/gl.h to /usr/include/GL Installing /opt/mesa-22.0.0/include/GL/glcorearb.h to /usr/include/GL Installing /opt/mesa-22.0.0/include/GL/glext.h to /usr/include/GL Installing /opt/mesa-22.0.0/include/GL/glx.h to /usr/include/GL Installing /opt/mesa-22.0.0/include/GL/glxext.h to /usr/include/GL Installing /opt/mesa-22.0.0/include/EGL/egl.h to /usr/include/EGL Installing /opt/mesa-22.0.0/include/EGL/eglext.h to /usr/include/EGL Installing /opt/mesa-22.0.0/include/EGL/eglplatform.h to /usr/include/EGL Installing /opt/mesa-22.0.0/include/EGL/eglmesaext.h to /usr/include/EGL/ Installing /opt/mesa-22.0.0/include/EGL/eglextchromium.h to /usr/include/EGL/ Installing /opt/mesa-22.0.0/include/GL/internal/dri_interface.h to /usr/include/GL/internal Installing /opt/mesa-22.0.0/src/gbm/main/gbm.h to /usr/include/ Installing /opt/mesa-22.0.0/src/util/00-mesa-defaults.conf to /usr/share/drirc.d Installing /opt/mesa-22.0.0/builddir/meson-private/glesv1_cm.pc to /usr/lib/aarch64-linux-gnu/pkgconfig Installing /opt/mesa-22.0.0/builddir/meson-private/glesv2.pc to /usr/lib/aarch64-linux-gnu/pkgconfig Installing /opt/mesa-22.0.0/builddir/meson-private/gbm.pc to /usr/lib/aarch64-linux-gnu/pkgconfig Installing /opt/mesa-22.0.0/builddir/src/gallium/targets/opencl/mesa.icd to /etc/OpenCL/vendors Installing /opt/mesa-22.0.0/builddir/meson-private/dri.pc to /usr/lib/aarch64-linux-gnu/pkgconfig Installing /opt/mesa-22.0.0/builddir/meson-private/egl.pc to /usr/lib/aarch64-linux-gnu/pkgconfig Installing /opt/mesa-22.0.0/builddir/meson-private/gl.pc to /usr/lib/aarch64-linux-gnu/pkgconfig Installing symlink pointing to libglapi.so.0.0.0 to /usr/lib/aarch64-linux-gnu/libglapi.so.0 Installing symlink pointing to libglapi.so.0 to /usr/lib/aarch64-linux-gnu/libglapi.so Installing symlink pointing to libGLESv1_CM.so.1.1.0 to /usr/lib/aarch64-linux-gnu/libGLESv1_CM.so.1 Installing symlink pointing to libGLESv1_CM.so.1 to /usr/lib/aarch64-linux-gnu/libGLESv1_CM.so Installing symlink pointing to libGLESv2.so.2.0.0 to /usr/lib/aarch64-linux-gnu/libGLESv2.so.2 Installing symlink pointing to libGLESv2.so.2 to /usr/lib/aarch64-linux-gnu/libGLESv2.so Installing symlink pointing to libgbm.so.1.0.0 to /usr/lib/aarch64-linux-gnu/libgbm.so.1 Installing symlink pointing to libgbm.so.1 to /usr/lib/aarch64-linux-gnu/libgbm.so Installing symlink pointing to libMesaOpenCL.so.1.0.0 to /usr/lib/aarch64-linux-gnu/libMesaOpenCL.so.1 Installing symlink pointing to libMesaOpenCL.so.1 to /usr/lib/aarch64-linux-gnu/libMesaOpenCL.so Installing symlink pointing to libGL.so.1.2.0 to /usr/lib/aarch64-linux-gnu/libGL.so.1 Installing symlink pointing to libGL.so.1 to /usr/lib/aarch64-linux-gnu/libGL.so Installing symlink pointing to libEGL.so.1.0.0 to /usr/lib/aarch64-linux-gnu/libEGL.so.1 Installing symlink pointing to libEGL.so.1 to /usr/lib/aarch64-linux-gnu/libEGL.so Running custom install script '/usr/bin/python3 /opt/mesa-22.0.0/bin/install_megadrivers.py /opt/mesa-22.0.0/builddir/src/gallium/targets/dri/libgallium_dri.so /usr/lib/aar ch64-linux-gnu/dri armada-drm_dri.so exynos_dri.so hx8357d_dri.so ili9225_dri.so ili9341_dri.so imx-drm_dri.so imx-dcss_dri.so ingenic-drm_dri.so kirin_dri.so komeda_dri.so mali-dp_dri.so mcde_dri.so mediatek_dri.so meson_dri.so mi0283qt_dri.so mxsfb-drm_dri.so pl111_dri.so rcar-du_dri.so repaper_dri.so rockchip_dri.so st7586_dri.so st7735r_d ri.so stm_dri.so sun4i-drm_dri.so panfrost_dri.so'
5.4.5 glxinfo
使用
root@rk3399:/opt# export DISPLAY=:0.0; glxinfo -B name of display: :0.0 display: :0 screen: 0 direct rendering: Yes Extended renderer info (GLX_MESA_query_renderer): Vendor: Panfrost (0xffffffff) Device: Mali-T860 (Panfrost) (0xffffffff) Version: 22.0.0 Accelerated: yes Video memory: 3851MB Unified memory: yes Preferred profile: core (0x1) Max core profile version: 3.1 Max compat profile version: 3.1 Max GLES1 profile version: 1.1 Max GLES[23] profile version: 3.1 OpenGL vendor string: Panfrost OpenGL renderer string: Mali-T860 (Panfrost) OpenGL core profile version string: 3.1 Mesa 22.0.0 OpenGL core profile shading language version string: 1.40 OpenGL core profile context flags: (none) OpenGL version string: 3.1 Mesa 22.0.0 OpenGL shading language version string: 1.40 OpenGL context flags: (none) OpenGL ES profile version string: OpenGL ES 3.1 Mesa 22.0.0 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
以看到驱动为
5.4.6 clinfo
root@rk3399:/opt# clinfo Number of platforms 1 Platform Name Clover Platform Vendor Mesa Platform Version OpenCL 1.1 Mesa 22.0.0 Platform Profile FULL_PROFILE Platform Extensions cl_khr_icd Platform Extensions function suffix MESA Platform Name Clover Number of devices 0 NULL platform behavior clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) Clover clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) clCreateContext(NULL, ...) [default] No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT) No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR) No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM) No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL) No devices found in platform ICD loader properties ICD loader Name OpenCL ICD Loader ICD loader Vendor OCL Icd free software ICD loader Version 2.2.11 ICD loader Profile OpenCL 2.1
5.5 源码目录结构
参考文章
[1] 在
[2]
[3]
[4]
[5] 播放
[6] [
[7]
[8]
[9]
[10]
[11]
[12]