Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 838190 - media-libs/mesa ignores 'vulkan' USE flag for 'amdgpu' VIDEO_CARDS flag
Summary: media-libs/mesa ignores 'vulkan' USE flag for 'amdgpu' VIDEO_CARDS flag
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal minor
Assignee: Gentoo X packagers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-13 07:53 UTC by Héctor Barreras
Modified: 2022-04-14 19:29 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Héctor Barreras 2022-04-13 07:53:15 UTC
Hi everyone,

currently trying to install media-libs/mesa with Vulkan support. I have an AMD RX480 GPU (Artic Islands family) and use the Linux open-source amdgpu driver for it. My system-wide VIDEO_CARDS setting is "amdgpu" alone, but when emerging mesa I get the following warning message:

```
>>> Messages generated by process 4606 on 2022-04-12 23:40:44 CEST for package media-libs/mesa-21.3.7:

WARN: pretend
Ignoring USE=vulkan     since VIDEO_CARDS does not contain freedreno, i965, iris, radeonsi, or v3d
```

Running `equery u mesa` reveals `video_cards_amdgpu` is not considered as a USE flag, and ignoring (yet recording as enabled) the `vulkan` flag implies packages `media-libs/vulkan-loader` and `dev-util/vulkan-tools` have their dependendencies satisfied and emerge correctly.

However, since mesa was not -really- built with Vulkan support, vulkaninfo spits out an error:

```
Cannot create Vulkan instance.
This problem is often caused by a faulty installation of the Vulkan driver or attempting to use a GPU that does not support Vulkan.
ERROR at /var/tmp/portage/dev-util/vulkan-tools-1.2.198/work/Vulkan-Tools-sdk-1.2.198.0/vulkaninfo/vulkaninfo.h:693:vkCreateInstance failed with ERROR_INCOMPATIBLE_DRIVER
```

Adding the `video_cards_radeonsi` USE flag to media-libs/mesa for that ebuild only and emerging again is enough to get Vulkan support and `vulkaninfo` to output proper information. `vkcube` from dev-util/vulkan-tools also properly displays the rotating cube (after enabling DRI3 in my X.org Device settings).

The package maintainers probably know better than me, but is it possible it is just the case to add video_cards_amdgpu as a USE flag to the package and have it not ignore the `vulkan` flag? Everything seems to work other than that (though I admit I have not really benchmarked anything yet).

Reproducible: Always




Output from `emerge --info`:
```
Portage 3.0.30 (python 3.9.9-final-0, default/linux/amd64/17.1/desktop/plasma, gcc-11.2.1, glibc-2.34-r10, 5.15.32-gentoo-r1 x86_64)
=================================================================
System uname: Linux-5.15.32-gentoo-r1-x86_64-AMD_Ryzen_7_3700X_8-Core_Processor-with-glibc2.34
KiB Mem:    32810220 total,  27656556 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Tue, 12 Apr 2022 20:00:01 +0000
Head commit of repository gentoo: 1d927a7a7e8d737d48b6af32b1617c20d13fa06a
sh bash 5.1_p16
ld GNU ld (Gentoo 2.37_p1 p2) 2.37
app-misc/pax-utils:        1.3.3::gentoo
app-shells/bash:           5.1_p16::gentoo
dev-lang/perl:             5.34.0-r6::gentoo
dev-lang/python:           3.9.9-r1::gentoo, 3.10.2_p1::gentoo
dev-lang/rust:             1.58.1::gentoo
dev-util/cmake:            3.22.2::gentoo
dev-util/meson:            0.60.3::gentoo
sys-apps/baselayout:       2.7-r3::gentoo
sys-apps/openrc:           0.44.10::gentoo
sys-apps/sandbox:          2.29::gentoo
sys-devel/autoconf:        2.13-r1::gentoo, 2.71-r1::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.37_p1-r2::gentoo
sys-devel/binutils-config: 5.4.1::gentoo
sys-devel/gcc:             11.2.1_p20220115::gentoo
sys-devel/gcc-config:      2.5-r1::gentoo
sys-devel/libtool:         2.4.6-r6::gentoo
sys-devel/llvm:            13.0.1::gentoo
sys-devel/make:            4.3::gentoo
sys-kernel/linux-headers:  5.15-r3::gentoo (virtual/os-headers)
sys-libs/glibc:            2.34-r10::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes
    sync-rsync-extra-opts: 

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="https://ftp.rnl.tecnico.ulisboa.pt/pub/gentoo/gentoo-distfiles/ https://mirrors.ircam.fr/pub/gentoo-distfiles/ https://mirrors.soeasyto.com/distfiles.gentoo.org/ https://mirror.leaseweb.com/gentoo/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j16"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="X a52 aac acl acpi activities alsa amd64 branding bzip2 cairo cdda cdr cli crypt cups dbus declarative dri dts dvd dvdr elogind encode exif flac fortran gdbm gif gpm gtk gui iconv icu ipv6 jpeg kde kwallet lcms libglvnd libnotify libtirpc mad mng mp3 mp4 mpeg multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf plasma png policykit ppds pulseaudio qml qt5 readline sdl seccomp semantic-desktop spell split-usr ssl startup-notification svg tiff truetype udev udisks unicode upower usb vorbis vulkan widgets wxwidgets x264 xattr xcb xml xv xvid zlib" ABI_X86="64" ADA_TARGET="gnat_2020" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_9" RUBY_TARGETS="ruby26 ruby27" USERLAND="GNU" VIDEO_CARDS="amdgpu" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
```
Comment 1 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2022-04-13 08:36:32 UTC
You should really enable "video_cards_radeonsi" for mesa in order to get amdgpu support as mentioned in our Wiki:

https://wiki.gentoo.org/wiki/AMDGPU#Feature_support
Comment 2 Héctor Barreras 2022-04-14 16:44:48 UTC
Thanks Lars... I remember reading this at the time and thinking "why?". The Wiki definitely states so, but is there any compelling reason why radeonsi -should- be added to VIDEO_CARDS if one does not have a Southern Islands family card? 

I appreciate this is not necessarily related to `media-libs/mesa` alone, but I had no issues using `amdgpu` as the only VIDEO_CARDS flag until I tried to install Vulkan support through it. Apologies if I am wasting your time here, I would just like to understand this.
Comment 3 Matt Turner gentoo-dev 2022-04-14 18:32:17 UTC
The problem is that the hardware supported the radeonsi driver in Mesa doesn't match exactly with either the radeon or amdgpu VIDEO_CARD options in libdrm. Or restated: depending on the GPU the radeonsi Mesa driver needs either the radeon libdrm code or the amdgpu libdrm code.

The radeonsi OpenGL driver's hardware support corresponds... at least better with the radv driver's support, so we use VIDEO_CARDS=radeonsi to control both drivers. (I don't remember verifying this exactly).
Comment 4 Héctor Barreras 2022-04-14 19:00:59 UTC
Thank you for the explanation Matt, between your comment and the current Mesa documentation I think I begin to understand how this works now. 

I suppose I do find a bit confusing that the value of the VIDEO_CARDS option reflects the name of the Mesa driver for the HW instead of the underlying kernel driver, especially considering the flag is recommended to be enabled system-wide by the Wiki, though I imagine that may be due to other ebuilds interacting with the GPU through Mesa rather than directly.
Comment 5 Matt Turner gentoo-dev 2022-04-14 19:29:53 UTC
(In reply to Héctor Barreras from comment #4)
> Thank you for the explanation Matt, between your comment and the current
> Mesa documentation I think I begin to understand how this works now. 
> 
> I suppose I do find a bit confusing that the value of the VIDEO_CARDS option
> reflects the name of the Mesa driver for the HW instead of the underlying
> kernel driver, especially considering the flag is recommended to be enabled
> system-wide by the Wiki, though I imagine that may be due to other ebuilds
> interacting with the GPU through Mesa rather than directly.

It is definitely confusing :(

To that end, in mesa-22 I've combined VIDEO_CARDS="i915 crocus iris" into just VIDEO_CARDS="intel". This was made somewhat more easy because the "classic" i965 and i915 drivers were removed (to live on in the "Amber") branch.

I'd be interested in doing the same thing with radeon, but it's a little bit harder because of the llvm requirements.