Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(linux, steamvr-launcher): Improve logging for gpu checks, add more checks, update wiki #2648

Merged
merged 7 commits into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 105 additions & 44 deletions alvr/dashboard/src/steamvr_launcher/linux_steamvr.rs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we specify the full command everywhere then I think we have to include some section about merging them in case multiple things apply to a user. Tho I'm not sure if providing the full thing doesn't actually make it harder than providing a short guide on how to concatonate things with examples.

Also why are people too stupid to concatonate simple strings???

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

less things to to do for user - the better imo
alvr uses wide variety of users, from someone who has no idea what software is, to someone who writes code - and even they can be confused

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

giving them full guide how to concatenate multiple strings in specific way just because something has to be aligned like that is a way to make newbie user frustrated already

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I just want to ensure that we don't cause more issues in case someone needs to apply more than one fix at a time. Because if you just tell them to "paste this" every time they'll either overwrite the other things or end up with multiple %command%s at once.

Copy link
Collaborator

@The-personified-devil The-personified-devil Jan 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I accidentally put this on the wrong file, oops, what I said should go for the wiki, not for the checking in code

Original file line number Diff line number Diff line change
Expand Up @@ -76,59 +76,121 @@ pub fn linux_hardware_checks() {
adapter.get_info().device_type == wgpu::DeviceType::DiscreteGpu
|| adapter.get_info().device_type == wgpu::DeviceType::IntegratedGpu
})
.map(|adapter| match adapter.get_info().vendor {
0x10de => DeviceInfo::Nvidia,
0x1002 => DeviceInfo::Amd {
device_type: adapter.get_info().device_type,
},
0x8086 => DeviceInfo::Intel {
device_type: adapter.get_info().device_type,
},
_ => DeviceInfo::Unknown,
.map(|adapter| {
let vendor = match adapter.get_info().vendor {
0x10de => DeviceInfo::Nvidia,
0x1002 => DeviceInfo::Amd {
device_type: adapter.get_info().device_type,
},
0x8086 => DeviceInfo::Intel {
device_type: adapter.get_info().device_type,
},
_ => DeviceInfo::Unknown,
};

(adapter, vendor)
})
.collect::<Vec<_>>();
linux_hybrid_gpu_checks(&device_infos);
linux_gpu_checks(&device_infos);
linux_encoder_checks(&device_infos);
}

fn linux_hybrid_gpu_checks(device_infos: &[DeviceInfo]) {
let have_igpu = device_infos.iter().any(|gpu| {
gpu == &DeviceInfo::Amd {
device_type: wgpu::DeviceType::IntegratedGpu,
} || gpu
== &DeviceInfo::Intel {
fn linux_gpu_checks(device_infos: &[(&wgpu::Adapter, DeviceInfo)]) {
let have_intel_igpu = device_infos.iter().any(|gpu| {
gpu.1
== DeviceInfo::Intel {
device_type: wgpu::DeviceType::IntegratedGpu,
}
});
debug!("have_intel_igpu: {}", have_intel_igpu);
let have_amd_igpu = device_infos.iter().any(|gpu| {
gpu.1
== DeviceInfo::Amd {
device_type: wgpu::DeviceType::IntegratedGpu,
}
});
debug!("have_amd_igpu: {}", have_amd_igpu);

let have_igpu = have_intel_igpu || have_amd_igpu;
debug!("have_igpu: {}", have_igpu);
let have_nvidia_dgpu = device_infos.iter().any(|gpu| gpu == &DeviceInfo::Nvidia);

let have_nvidia_dgpu = device_infos.iter().any(|gpu| gpu.1 == DeviceInfo::Nvidia);
debug!("have_nvidia_dgpu: {}", have_nvidia_dgpu);

let have_amd_dgpu = device_infos.iter().any(|gpu| {
gpu == &DeviceInfo::Amd {
device_type: wgpu::DeviceType::DiscreteGpu,
}
gpu.1
== DeviceInfo::Amd {
device_type: wgpu::DeviceType::DiscreteGpu,
}
});
debug!("have_amd_dgpu: {}", have_amd_dgpu);
let have_intel_dgpu = device_infos.iter().any(|gpu| {
gpu == &DeviceInfo::Intel {
device_type: wgpu::DeviceType::DiscreteGpu,

if have_amd_igpu || have_amd_dgpu {
let is_any_amd_driver_invalid = device_infos.iter().any(|gpu| {
info!("Driver name: {}", gpu.0.get_info().driver);
match gpu.0.get_info().driver.as_str() {
"AMD proprietary driver" | "AMD open-source driver" => true, // AMDGPU-Pro | AMDVLK
_ => false,
}
});
if is_any_amd_driver_invalid {
error!("Amdvlk or amdgpu-pro vulkan drivers detected, SteamVR may not function properly. \
Please remove them or make them unavailable for SteamVR and games you're trying to launch.\n\
For more detailed info visit the wiki: \
https://github.com/alvr-org/ALVR/wiki/Linux-Troubleshooting#artifacting-no-steamvr-overlay-or-graphical-glitches-in-streaming-view")
}
}

let have_intel_dgpu = device_infos.iter().any(|gpu| {
gpu.1
== DeviceInfo::Intel {
device_type: wgpu::DeviceType::DiscreteGpu,
}
});
debug!("have_intel_dgpu: {}", have_intel_dgpu);

let vrmonitor_path_string = alvr_server_io::steamvr_root_dir()
.unwrap()
.join("bin")
.join("vrmonitor.sh")
.into_os_string()
.into_string()
.unwrap();
debug!("vrmonitor_path: {}", vrmonitor_path_string);

let steamvr_opts = "For functioning VR you need to put the following line into SteamVR's launch options and restart it:";
let game_opts = "And this similar line to the launch options of ALL games that you're trying to launch from steam:";

let mut vrmonitor_path_written = false;
if have_igpu {
if have_nvidia_dgpu {
warn!("For functioning VR you need insert following into SteamVR and ALL (!) games commandline options:");
warn!("__GLX_VENDOR_LIBRARY_NAME=nvidia __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only \
VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json %command%")
let nv_options = "__GLX_VENDOR_LIBRARY_NAME=nvidia __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only \
VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json";

warn!("{steamvr_opts}\n{nv_options} {vrmonitor_path_string} %command%");
warn!("{game_opts}\n{nv_options} %command%");

vrmonitor_path_written = true;
} else if have_intel_dgpu || have_amd_dgpu {
warn!("For functioning VR you need insert following into SteamVR and ALL (!) games commandline options:");
warn!("DRI_PRIME=1 %command%")
warn!("{steamvr_opts}\nDRI_PRIME=1 {vrmonitor_path_string} %command%");
warn!("{game_opts}\nDRI_PRIME=1 %command%");
vrmonitor_path_written = true;
} else {
warn!("Beware, using just integrated graphics might lead to very poor performance in SteamVR and VR games.");
warn!("For more information, please refer to the wiki: https://github.com/alvr-org/ALVR/wiki/Linux-Troubleshooting")
}
}
if !vrmonitor_path_written {
warn!(
"Make sure you have put the following line in your SteamVR launch options and restart it:\n\
{vrmonitor_path_string} %command%"
)
}
}
fn linux_encoder_checks(device_infos: &[DeviceInfo]) {

fn linux_encoder_checks(device_infos: &[(&wgpu::Adapter, DeviceInfo)]) {
for device_info in device_infos {
match device_info {
match device_info.1 {
DeviceInfo::Nvidia => {
match nvml_wrapper::Nvml::init() {
Ok(nvml) => {
Expand Down Expand Up @@ -191,7 +253,9 @@ fn linux_encoder_checks(device_infos: &[DeviceInfo]) {
"Couldn't find VA-API runtime on system, \
you unlikely to have hardware encoding. \
Please install VA-API runtime for your distribution \
and make sure it works (Manjaro, Fedora).",
and make sure it works (Manjaro, Fedora affected). \
For detailed advice, check wiki: \
https://github.com/alvr-org/ALVR/wiki/Linux-Troubleshooting#failed-to-create-vaapi-encoder",
);
}
}
Expand Down Expand Up @@ -231,31 +295,28 @@ fn probe_libva_encoder_profile(
let profile_probe = libva_display.query_config_entrypoints(profile_type);
let mut message = String::new();
if profile_probe.is_err() {
message = format!(
"Couldn't find {} profile. You unlikely to have hardware encoding for it.",
profile_name
);
message = format!("Couldn't find {} encoder.", profile_name);
} else if let Ok(profile) = profile_probe {
if profile.is_empty() {
message = format!(
"{} profile entrypoint is empty. \
You unlikely to have hardware encoding for it.",
profile_name
);
message = format!("{} profile entrypoint is empty.", profile_name);
}
if !profile.contains(&libva::VAEntrypoint::VAEntrypointEncSlice) {
message = format!(
"{} profile does not contain encoding entrypoint. \
You unlikely to have hardware encoding for it.",
"{} profile does not contain encoding entrypoint.",
profile_name
);
}
}
if !message.is_empty() {
if is_critical {
error!("{}", message);
error!("{} Your gpu may not suport encoding with this.", message);
} else {
info!("{}", message);
info!(
"{}
Your gpu may not suport encoding with this. \
If you're not using this encoder, ignore this message.",
message
);
}
}
}
11 changes: 8 additions & 3 deletions wiki/Linux-Troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ Install at least the required versions of the driver and ensure you have CUDA in

If an error saying CUDA was not detected persists, try using the latest alvr nightly release.

## Using ALVR with only integrated graphics

Beware that using **only** integrated graphics for running ALVR is highly inadvisable as in most cases it will lead to very poor performance (even on more powerful devices like Steam Deck, it's still very slow).
Don't expect things to work perfectly in this case too, as some older integrated graphics simply might not have the best vulkan support and might fail to work at all.

## Hybrid graphics advices

### General advise
Expand All @@ -76,18 +81,18 @@ If you're on laptop and it doesn't allow disabling integrated graphics (in most

### Amd/Intel integrated gpu + Amd/Intel discrete gpu

Put `DRI_PRIME=1 %command%` into SteamVR's commandline options and in those of all VR games you intend to play with ALVR.
Put `DRI_PRIME=1 ~/.local/share/Steam/steamapps/common/SteamVR/bin/vrmonitor.sh %command%` (adjust vrmonitor path to your distro) into SteamVR's commandline options and in those of all VR games you intend to play with ALVR.

### Amd/Intel integrated gpu + Nvidia discrete gpu

Put `__NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia %command%` into SteamVR's commandline options and in those of all VR games you intend to play with ALVR.
Put `__NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia ~/.local/share/Steam/steamapps/common/SteamVR/bin/vrmonitor.sh %command%` (adjust vrmonitor path to your distro) into SteamVR's commandline options and in those of all VR games you intend to play with ALVR.

### SteamVR Dashboard not rendering in VR on Nvidia discrete GPU
If you encounter issues with the SteamVR dashboard not rendering in VR you may need to run the entire steam client itself via PRIME render offload. First close the steam client completey if you have it open already, you can do so by clicking the Steam dropdown in the top left and choosing exit. Then from a terminal run: `__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia steam-runtime`

## Wayland

When using old Gnome (< 47 version) under Wayland you might need to put `WAYLAND_DISPLAY='' %command%` into the SteamVR commandline options to force XWayland on SteamVR. This fixes issue with drm leasing not being available.
When using old Gnome (< 47 version) under Wayland you might need to put `WAYLAND_DISPLAY='' ~/.local/share/Steam/steamapps/common/SteamVR/bin/vrmonitor.sh %command%` (adjust vrmonitor path to your distro) into the SteamVR commandline options to force XWayland on SteamVR. This fixes issue with drm leasing not being available.

## The view shakes

Expand Down
Loading