Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
vulkan doesn't seem to be working...
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
KShots
Guru
Guru


Joined: 09 Oct 2003
Posts: 595
Location: Florida

PostPosted: Fri Apr 01, 2022 5:42 pm    Post subject: vulkan doesn't seem to be working... Reply with quote

Got a new laptop, fired it up with gentoo, got steam installed... and BAM, no games using wine worked with it. Found a workaround by disabling Vulkan via an environment variable, all the steam stuff works...

Tried to do some unreal engine dev work, BAM - it crashes on startup. Another vulkan issue...

emerged vulkan-tools and tried the 'vkcube' app:
Code:
rich@incubus:~ $ vkcube
Selected GPU 0: NVIDIA GeForce RTX 3080 Laptop GPU, type: 2
Could not find both graphics and present queues
... ok, for one it's not using the correct GPU. Looked at its help:
Code:
rich@incubus:~ $ vkcube --help
Usage:
  vkcube   [--use_staging] [--validate] [--validate-checks-disabled]
   [--break] [--c <framecount>] [--suppress_popups]
   [--incremental_present] [--display_timing]
   [--gpu_number <index of physical device>]
   [--present_mode <present mode enum>]
   [--width <width>] [--height <height>]
   <present_mode_enum>
      VK_PRESENT_MODE_IMMEDIATE_KHR = 0
      VK_PRESENT_MODE_MAILBOX_KHR = 1
      VK_PRESENT_MODE_FIFO_KHR = 2
      VK_PRESENT_MODE_FIFO_RELAXED_KHR = 3
... looks like I can switch GPU index with --gpu_number:
Code:
rich@incubus:~ $ vkcube --gpu_number 1
Selected GPU 1: NVIDIA GeForce RTX 2080 Ti, type: 2
Works fine now... so apparently my default vulkan GPU is not correctly set. How do I set this system-wide so other bits like steam and the unreal engine can pick up on it?
_________________
Life without passion is death in disguise
Back to top
View user's profile Send private message
KShots
Guru
Guru


Joined: 09 Oct 2003
Posts: 595
Location: Florida

PostPosted: Fri Apr 01, 2022 6:16 pm    Post subject: Reply with quote

After a bit of digging... it seems vulkan doesn't support selecting a GPU system-wide. Luckily, I'm not the only one bit by this short-sightedness. Found a github project that writes a "device chooser layer" into the vulkan API that lets you set an environment variable to do this. It's as easy as:
Code:
ENABLE_DEVICE_CHOOSER_LAYER=1 VULKAN_DEVICE_INDEX=1 MyApp
... with this, I got the unreal engine working as well. Now I just need to set those environment variables system-wide and I should be good to go!

EDIT: Hmm... not sure where to put these environment variables so they work system-wide... ${HOME}/.bashrc doesn't do it for gnome. Any suggestions on where to put it?
_________________
Life without passion is death in disguise
Back to top
View user's profile Send private message
ali3nx
l33t
l33t


Joined: 21 Sep 2003
Posts: 730
Location: Winnipeg, Canada

PostPosted: Fri Apr 01, 2022 7:31 pm    Post subject: Reply with quote

There's an undocumented gentoo system configuration "trick" that at least I've been using and recommending others use for several years to ensure support for vulkan with nvidia drivers.

The VIDEO_CARDS config variable if used too literally enforces video processing api restrictions that omit video processing api support at compile time unless certain video card models are included such as

Code:
VIDEO_CARDS="nvidia intel i915 i965"


instead of purely

Code:
VIDEO_CARDS="nvidia"


will permit mesa to be built with vulkan use flag support globally.

Generally the implied gentoo config methodology would be to set the video cards variable literally as specific as possible however due to how the mesa ebuild has been configured for many years that implied methodology in practice has functionality limitations.

Utilizing the vulkan with an "unsupported" gpu userland configuration also fixes lutris moaning about missing vulkan libraries.

If you find yourself looking at this thinking "Hey i don't have an intel gpu.... what gives?"

Whether your pc actually has the graphics hardware configured by the VIDEO_CARDS config variable is mostly irrelevant if the added software feature will provide a benefit.

The mesa and xorg package ebuilds implying conditional restrictions was not a thing until perhaps 2019. Until then anyone was able to include whichever gpu video api's they desired to without being limited by userland gpu configurations.
_________________
Compiling Gentoo since version 1.4
Thousands of Gentoo Installs Completed
Emerged on every continent but Antarctica
Compile long and Prosper!
Back to top
View user's profile Send private message
KShots
Guru
Guru


Joined: 09 Oct 2003
Posts: 595
Location: Florida

PostPosted: Sat Apr 02, 2022 1:08 am    Post subject: Reply with quote

Don't think that's what's going on here - I have a similar VIDEO_CARDS line:
Code:
rich@incubus:~ $ grep VIDEO_CARDS /etc/portage/make.conf
VIDEO_CARDS="intel i965 nvidia nouveau"
Again, vulkan appears to work just fine when the correct card is selected, but vulkan doesn't seem smart enough to auto-select a card that is capable of presenting, and can't normally be told specifically which card to use (at least not without the above hack). I've found I have to start steam itself with the above environment variables - setting them in the launcher properties does not work.
_________________
Life without passion is death in disguise
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2366

PostPosted: Sat Apr 02, 2022 5:13 pm    Post subject: Reply with quote

KShots wrote:
Don't think that's what's going on here - I have a similar VIDEO_CARDS line:
Code:
rich@incubus:~ $ grep VIDEO_CARDS /etc/portage/make.conf
VIDEO_CARDS="intel i965 nvidia nouveau"
Again, vulkan appears to work just fine when the correct card is selected, but vulkan doesn't seem smart enough to auto-select a card that is capable of presenting, and can't normally be told specifically which card to use (at least not without the above hack). I've found I have to start steam itself with the above environment variables - setting them in the launcher properties does not work.


I presume your new laptop is a recent one. As such, nouveau can do nothing for newer nvidia cards, so you don't need it. I don't know, but this might contribute to your issue.

Regards,
Georgi
Back to top
View user's profile Send private message
KShots
Guru
Guru


Joined: 09 Oct 2003
Posts: 595
Location: Florida

PostPosted: Sat Apr 02, 2022 8:28 pm    Post subject: Reply with quote

Not likely an issue - I have it blacklisted via kernel command line (modprobe.blacklist=nouveau), just compiled support in case I want to mess with it later.
_________________
Life without passion is death in disguise
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2366

PostPosted: Sat Apr 02, 2022 8:32 pm    Post subject: Reply with quote

KShots wrote:
Not likely an issue - I have it blacklisted via kernel command line (modprobe.blacklist=nouveau), just compiled support in case I want to mess with it later.


It can currently only power up the GPU, nothing else, your Intel card will perform better as it will use hardware acceleration. My point is if the vulkan driver has no choice it would be forced to choose the right driver, wouldn't it?
Back to top
View user's profile Send private message
KShots
Guru
Guru


Joined: 09 Oct 2003
Posts: 595
Location: Florida

PostPosted: Sat Apr 02, 2022 8:35 pm    Post subject: Reply with quote

It correctly chooses the nvidia driver, but there are two cards that use that driver - and it selects the wrong one.
_________________
Life without passion is death in disguise
Back to top
View user's profile Send private message
jmbreuer
n00b
n00b


Joined: 07 Sep 2011
Posts: 21

PostPosted: Sat Apr 20, 2024 11:23 am    Post subject: Reply with quote

KShots wrote:

EDIT: Hmm... not sure where to put these environment variables so they work system-wide... ${HOME}/.bashrc doesn't do it for gnome. Any suggestions on where to put it?


I guess/hope you'll have found it by now. Such things can go into /etc/env.d/99chooseGraphics (or whatever filename you like, they'll be applied in lexicographic order). After creating that file and putting e.g.

Code:
ENABLE_DEVICE_CHOOSER_LAYER=1
VULKAN_DEVICE_INDEX=1

into it, run env-update and re-login.

(Anyone know a better way to get any of the graphical environments to re-read their profile? The equivalent of "source /etc/profile" in a textual shell?)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum