centos-7.9 mesa-20.3.1 zink

一、安装依赖

# dependencies of mesa
# 1 others
sudo yum-builddep mesa
sudo yum install -y python3-devel.x86_64 meson.noarch vulkan-devel.x86_64
sudo pip3 install mako

# 2 drm
git clone https://gitee.com/cchen/libdrm.git
cd libdrm
meson build
ninja -C build/ install

# 3 gcc
# 见https://www.cnblogs.com/cngpus/p/14224830.html

二、修改配置

2.1.下载mesa

# download mesa
curl -O https://archive.mesa3d.org/mesa-20.3.1.tar.xz
cd mesa-20.3.1

2.2.配置

修改meson_options.txt中的以下内容(注意:以下配置只是为了支持zink):

option(                                                                                                  
  'platforms',                                                                                           
  type : 'array',                                                                                        
  value : ['x11', 'wayland'],                                                                            
  choices : [                                                                                            
    'auto', 'x11', 'wayland', 'haiku', 'android', 'windows',                                             
  ],
  description : 'window systems to support. If this is set to `auto`, all platforms applicable will be enabled.'
)
option(                                                                                                  
  'llvm',                                                                                                
  type : 'combo',
  value : 'disabled',
  choices : ['auto', 'true', 'false', 'enabled', 'disabled'],                                            
  description : 'Build with LLVM support.'                                                               
)
option(                                                                                                  
  'gallium-drivers',                                                                                     
  type : 'array',                                                                                        
  value : ['zink'],                                                                            
  choices : [
    'auto', 'kmsro', 'radeonsi', 'r300', 'r600', 'nouveau', 'freedreno',                                 
    'swrast', 'v3d', 'vc4', 'etnaviv', 'tegra', 'i915', 'svga', 'virgl',                                 
    'swr', 'panfrost', 'iris', 'lima', 'zink'                                                            
  ],    
  description : 'List of gallium drivers to build. If this is set to auto all drivers applicable to the target OS/architecture will be built'
)
option( 
  'vulkan-drivers',                                                                                      
  type : 'array',
  value : ['intel', 'swrast'],
  choices : ['auto', 'amd', 'broadcom', 'freedreno', 'intel', 'swrast'],                                 
  description : 'List of vulkan drivers to build. If this is set to auto all drivers applicable to the target OS/architecture will be built'
)

修改src/util/half_float.h中的以下内容:

#undef USE_X86_64_ASM
#if defined(USE_X86_64_ASM)
#include <immintrin.h>
#endif

三、开始编译

3.1.设置环境变量

由于前面drm默认安装到了/usr/local下,所以需要设置以下环境变量才能找到最新版本的drm。

export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:$PKG_CONFIG_PATH

3.2.编译

meson build
ninja -C build/ install

四、常见错误及其解决方法

4.1. 错误1

错误信息:

src/util/half_float.h:67:7: error: impossible constraint in ‘asm’

解决办法:
编辑src/util/half_float.h

#undef USE_X86_64_ASM
#if defined(USE_X86_64_ASM)
#include <immintrin.h>
#endif

4.2. 错误2

错误信息:

../src/mesa/main/macros.h:774:20: error: ‘signbit’ was not declared in this scope
    return signbit(x) != signbit(y);

解决办法:
升级gcc

4.3. 错误3

错误信息:

meson.build:1426:4: ERROR: Invalid version of dependency, need 'libdrm_intel' ['>=2.4.100'] found '2.4.97'

解决办法:

git clone https://gitee.com/cchen/libdrm.git
cd libdrm
meson build
ninja -C build/ install

4.4. 错误4

错误信息:

meson.build:1550:2: ERROR: Problem encountered: The following drivers require LLVM: Radv, RadeonSI, SWR. One of these is enabled, but LLVM is disabled.

解决办法:
编辑meson_options.txt

option(                                                                                                  
  'gallium-drivers',                                                                                     
  type : 'array',                                                                                        
  value : ['zink'],                                                                            
  choices : [
    'auto', 'kmsro', 'radeonsi', 'r300', 'r600', 'nouveau', 'freedreno',                                 
    'swrast', 'v3d', 'vc4', 'etnaviv', 'tegra', 'i915', 'svga', 'virgl',                                 
    'swr', 'panfrost', 'iris', 'lima', 'zink'                                                            
  ],    
  description : 'List of gallium drivers to build. If this is set to auto all drivers applicable to the target OS/architecture will be built'
)
option( 
  'vulkan-drivers',                                                                                      
  type : 'array',
  value : ['intel', 'swrast'],
  choices : ['auto', 'amd', 'broadcom', 'freedreno', 'intel', 'swrast'],                                 
  description : 'List of vulkan drivers to build. If this is set to auto all drivers applicable to the target OS/architecture will be built'
)
posted @ 2021-01-03 10:12  专注于GPU的程序员  阅读(1787)  评论(0编辑  收藏  举报