在Centos 8.5上编译amd mesa23.1.3开源驱动

安装meson

git clone https://github.com/mesonbuild/meson.git
cd meson/
python3.8 setup.py install

安装ninja

编译libva

cd libva
git clone https://github.com/intel/libva.git
meson build -Dprefix=/usr -Dlibdir=lib64
ninja -Cbuild
sudo ninja -Cbuild install

编译Wayland

git clone https://gitlab.freedesktop.org/wayland/wayland.git
cd wayland
meson build -Dprefix=/usr -Dlibdir=lib64
ninja -Cbuild
sudo ninja -Cbuild install


编译wayland-protocols

git clone https://gitlab.freedesktop.org/wayland/wayland-protocols.git
cd wayland-protocols
meson build -Dprefix=/usr -Dlibdir=lib64
ninja -Cbuild
sudo ninja -Cbuild install


编译libdrm

git clone https://gitlab.freedesktop.org/mesa/drm.git
执行编译脚本

#!/bin/bash

prefix=${PREFIX:-/usr}
is64bit=enabled
archdir=x86_64-linux-gnu
 
rm -r build$1

set -e

cflags="-fno-omit-frame-pointer"

meson build$1 --prefix $prefix --libdir $prefix/lib64 --buildtype debugoptimized \
        -Dc_args=$cflags -Dc_link_args=$cflags -Dpkg_config_path=$prefix/lib64/pkgconfig \
        -Detnaviv=enabled -Dexynos=enabled -Dfreedreno=enabled -Domap=enabled -Dtegra=enabled -Dvc4=enabled \
        -Dcairo-tests=$is64bit

ninja -Cbuild
sudo ninja -Cbuild install

编译llvm

ccache --max-size=50G
git clone https://github.com/llvm/llvm-project.git
cd llvm-project
git checkout remotes/origin/release/16.x

创建llvm.conf 文件,写入如下内容,
/usr/local/llvm/lib
/usr/local/llvm-i386/lib
然后 sudo cp lvm.conf /etc/ld.so.conf.d/

执行编译脚本

#!/bin/bash

prefix=${PREFIX:-/usr/local}

if test x$1 = x32; then
    # 32-bit build
    rm -rf build32

    set -e

    mkdir build32
    cd build32
    cmake ../llvm -G Ninja \
        -DCMAKE_INSTALL_PREFIX=$prefix/llvm-i386 -DLLVM_TARGETS_TO_BUILD="X86;AMDGPU" -DLLVM_ENABLE_ASSERTIONS=ON \
        -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON -DLLVM_APPEND_VC_REV=OFF \
        -DLLVM_BUILD_32_BITS=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_CCACHE_BUILD=ON -DLLVM_ENABLE_LIBXML2=OFF \
        -DCMAKE_C_FLAGS_RELEASE="-O2 -g1 -fno-omit-frame-pointer" \
        -DCMAKE_CXX_FLAGS_RELEASE="-O2 -g1 -fno-omit-frame-pointer" \
        -DTerminfo_LIBRARIES="/usr/lib/i386-linux-gnu/libtinfo.so" \
        -DZLIB_LIBRARY_RELEASE="/usr/lib/i386-linux-gnu/libz.so" \
        -Dzstd_LIBRARY="/usr/lib/i386-linux-gnu/libzstd.so"

    echo -e "[binaries]\nllvm-config = '$prefix/llvm-i386/bin/llvm-config'\n" > `dirname $0`/llvm_config_i386-linux-gnu.cfg
else
    # 64-bit build
    rm -rf build

    set -e

    mkdir build
    cd build

    cmake ../llvm -G Ninja \
        -DCMAKE_INSTALL_PREFIX=$prefix/llvm -DLLVM_TARGETS_TO_BUILD="X86;AMDGPU" -DLLVM_ENABLE_ASSERTIONS=ON \
        -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON -DLLVM_APPEND_VC_REV=OFF \
        -DLLVM_CCACHE_BUILD=ON -DLLVM_ENABLE_RTTI=ON \
        -DCMAKE_C_FLAGS_RELEASE="-O2 -g1 -fno-omit-frame-pointer" \
        -DCMAKE_CXX_FLAGS_RELEASE="-O2 -g1 -fno-omit-frame-pointer"


    echo -e "[binaries]\nllvm-config = '$prefix/llvm/bin/llvm-config'\n" > `dirname $0`/llvm_config_x86_64-linux-gnu.cfg
fi

cd ..

ninja -Cbuild
sudo ninja -Cbuild install
sudo ldconfig

编译mesa23.1.3

git clone https://gitlab.freedesktop.org/mesa/mesa.git

执行编译脚本

#!/bin/bash

prefix=${PREFIX:-/usr}
#for general development (optimized with assertions)
buildtype=${BUILD_TYPE:-debugoptimized}

if test x$1 = x32; then
    arch=i386-linux-gnu
    va=disabled
    buildtype=release
    profile="-g"

    gallium_drivers=radeonsi
    others="-Dplatforms=x11 -Dgallium-vdpau=disabled -Dpkg_config_path=${prefix}/lib/$arch/pkgconfig" # -Dbuild-tests=true"

    export CC="gcc -m32"
    export CXX="g++ -m32"
else
    arch=x86_64-linux-gnu
    va=enabled

    # comment or uncomment the following settings

    # for benchmarking (fastest, optimized without assertions)
    #buildtype=release; profile="-g"

    # for profiling (second fastest)
    #buildtype=release; profile="-g -fno-omit-frame-pointer"

    # for best debugging (no optimizations)
    #buildtype=debug

    gallium_drivers=radeonsi,swrast # ,r300,r600,crocus,zink,virgl,nouveau,d3d12,svga,etnaviv,freedreno,iris,kmsro,lima,panfrost,tegra,v3d,vc4,asahi,i915

    #vulkandrv=amd #,swrast

    #others="-Dgallium-xa=true -Dgallium-nine=true -Dgallium-omx=bellagio -Dbuild-tests=true -Dtools=glsl,nir"
    #others="-Dbuild-tests=true -Dtools=glsl,nir"
    videocodecs=h264dec,h264enc,h265dec,h265enc
fi

rm -r build$1

set -e

meson build$1 --prefix $prefix --libdir $prefix/lib64 --buildtype $buildtype -Dlibunwind=disabled -Dglvnd=true \
	--native-file `dirname $0`/llvm_config_$arch.cfg \
	-Dgallium-drivers=$gallium_drivers -Dvulkan-drivers=$vulkandrv \
	-Dc_args="$profile" -Dcpp_args="$profile" $repl $others -Dgallium-va=$va -Dvideo-codecs=$videocodecs

ninja -Cbuild
sudo ninja -Cbuild install

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值