编译环境
下载源码
我是从yocto的bb文件中得到的下载TAR包的链接:
https://mesa.freedesktop.org/archive/mesa-23.0.3.tar.xz
也可以将整个仓库git clone下来:
git clone https://gitlab.freedesktop.org/mesa/mesa.git
安装依赖包
sudo apt install meson
sudo apt install glslang-tools
sudo apt install llvm
sudo apt install cmake
sudo apt install libwayland-bin
sudo aptinstall pkgconf
sudo apt install pkgconf
sudo apt-get install libdrm-dev libxxf86vm-dev libxt-dev xutils-dev flex bison xcb libx11-xcb-dev libxcb-glx0 libxcb-glx0-dev xorg-dev libxcb-dri2-0-dev libxcb-xfixes0 libxcb-xfixes0-dev libxcb-dri3-0 libxcb-present0 libpciaccess0 libpng-dev libxcb-keysyms1-dev libxcb-dri3-dev libx11-dev libxcb-present-dev libxshmfence-dev llvm
sudo apt-get install libxcb-shm0-dev
sudo apt-get install libwayland-dev
sudo apt-get install libwayland-*
sudo apt-get install wayland-protocols
sudo apt-get install libwayland-egl-backend-dev
配置
$ meson setup build/ -D platforms=x11,wayland
编译
$ cd build
$ sudo ninja install
查看编译结果
安装后,不需要重新启动系统,glxinfo|grep OpenGL将会发现系统的MESA驱动已经被更换。
重启后使用的仍然是新编译的MESA驱动
参考文档
Compilation and Installation Using Meson — The Mesa 3D Graphics Library latest documentation
WSL2下安装MESA / OSMESA驱动_thinszx的博客-CSDN博客