Notes for Mesa
Overview
Mesa 包含了各种 GPU/CPU 的 OpenGL, OpenCL, Vulkan 实现(Usermode Driver), 也包括 GLX, EGL, GBM 等协议的实现。
- Vulkan 驱动
codename | directories | platforms |
---|---|---|
anv | src/intel/vulkan, src/intel/vulkan_hasvk | Alder Lake-P |
asahi | src/asahi/vulkan | Apple M1, M2 |
lpv | src/gallium/drivers/llvmpipe | CPU |
panvk | src/panfrost/vulkan | RK3399 |
v3dv | src/broadcom/vulkan | Raspberry Pi |
Build
Build Dependencies (since mesa-25.0.0)
dep | apt-get | version required | yet another install | |
---|---|---|---|---|
/usr/bin/glslangValidator | glslang-tools | https://github.com/KhronosGroup/glslang | ||
/usr/bin/rustc | rustc | 1.78.0 or newer | `curl --proto ‘=https’ --tlsv1.2 -sSf https://sh.rustup.rs | |
bindgen (rust package) | cargo | 0.65 or newer | cargo install bindgen-cli |
|
libclc-dev | libclc-17-dev | not required if -Dmesa-clc=auto | ||
+ | libdrm | libdrm-dev | 2.4.121(120 ok2.0) | https://gitlab.freedesktop.org/mesa/drm |
llvm | llvm-17-dev | (17.0.6 ok2.0) | https://github.com/llvm/llvm-project | |
libLLVMSPIRVLib.so.17 | llvm-spirv-17 | (17.0.0 ok2.0) | https://github.com/KhronosGroup/SPIRV-LLVM-Translator | |
+ | LLVMSPIRVLib.h | llvmspirvlib-17-dev | (absent ok2.0) | https://github.com/KhronosGroup/SPIRV-LLVM-Translator |
clang-cpp | libclang-cpp17-dev | (17.0.6 ok2.0) | not required if -Dmesa-clc=auto | |
* | clang-dev | libclang-17-dev | Debian package issue | |
xshmfence | libxshmfence-dev | (1.3 ok2.0) | required if -Dplatforms=x11 | |
xxf86vm | libxxf86vm-dev | (1.1.4 ok2.0) | required since -Dglx-direct=true by default | |
xrandr | libxrandr-dev | (1.5.2 ok2.0) | required since -Dxlib-lease=true | |
cbindgen (rust package) | cargo | 0.28.0 | cargo install cbindgen ; required if -Dgallium-drivers=nouveau |
NOTE:
-
(*) 表示本来不需要的依赖
-
(+) 在 OpenKylin 2.0 的源里没有,需要源码构建
-
Ubuntu 22.04
书到用时方恨少,包要装时不好找
1 | sudo apt install -y cmake ninja-build bison flex g++ git pkg-config python3-setuptools python3-lz4 \ |
1 | meson build -Dprefix=/usr/local -Dlibdir=lib/x86_64-linux-gnu -Dplatforms=x11 -Dgallium-drivers=nouveau |
-Dprefix=/usr/local
避免覆盖系统原来的libGL*
-Dlibdir=lib/x86_64-linux-gnu
设置库的安装路径为/etc/ld.so.conf.d/x86_64-linux-gnu.conf
中搜索第一顺位的路径- 其他默认就好, 出现的依赖在 OpenKylin 2.0 上 apt-get 基本都能解决
1 | Build targets in project: 437 |