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 1 commit
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
141 changes: 102 additions & 39 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
@@ -1,4 +1,5 @@
use std::fs;
use std::path::PathBuf;

Check warning on line 2 in alvr/dashboard/src/steamvr_launcher/linux_steamvr.rs

View workflow job for this annotation

GitHub Actions / check-linux

warning: unused import: `std::path::PathBuf` --> alvr/dashboard/src/steamvr_launcher/linux_steamvr.rs:2:5 | 2 | use std::path::PathBuf; | ^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default
use std::{env, process::Command};

use alvr_common::anyhow::bail;
Expand Down Expand Up @@ -77,55 +78,118 @@
|| 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,
0x10de => (adapter, DeviceInfo::Nvidia),
0x1002 => (
adapter,
DeviceInfo::Amd {
device_type: adapter.get_info().device_type,
},
),
0x8086 => (
adapter,
DeviceInfo::Intel {
device_type: adapter.get_info().device_type,
},
),
_ => (adapter, DeviceInfo::Unknown),
The-personified-devil marked this conversation as resolved.
Show resolved Hide resolved
})
.collect::<Vec<_>>();
linux_hybrid_gpu_checks(&device_infos);
linux_gpu_checks(&device_infos);
linux_encoder_checks(&device_infos);

Check failure on line 98 in alvr/dashboard/src/steamvr_launcher/linux_steamvr.rs

View workflow job for this annotation

GitHub Actions / check-linux

error[E0308]: mismatched types --> alvr/dashboard/src/steamvr_launcher/linux_steamvr.rs:98:26 | 98 | linux_encoder_checks(&device_infos); | -------------------- ^^^^^^^^^^^^^ expected `&[DeviceInfo]`, found `&Vec<(&Adapter, DeviceInfo)>` | | | arguments to this function are incorrect | = note: expected reference `&[steamvr_launcher::linux_steamvr::DeviceInfo]` found reference `&std::vec::Vec<(&wgpu::Adapter, steamvr_launcher::linux_steamvr::DeviceInfo)>` note: function defined here --> alvr/dashboard/src/steamvr_launcher/linux_steamvr.rs:193:4 | 193 | fn linux_encoder_checks(device_infos: &[DeviceInfo]) { | ^^^^^^^^^^^^^^^^^^^^ ---------------------------
}

fn linux_hybrid_gpu_checks(device_infos: &[DeviceInfo]) {
fn linux_gpu_checks(device_infos: &[(&wgpu::Adapter, DeviceInfo)]) {
let have_igpu = device_infos.iter().any(|gpu| {
gpu == &DeviceInfo::Amd {
device_type: wgpu::DeviceType::IntegratedGpu,
} || gpu
== &DeviceInfo::Intel {
gpu.1
== DeviceInfo::Amd {
device_type: wgpu::DeviceType::IntegratedGpu,
}
|| gpu.1
== DeviceInfo::Intel {
device_type: wgpu::DeviceType::IntegratedGpu,
}
});
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_igpu = device_infos.iter().any(|gpu| {
gpu.1
== DeviceInfo::Amd {
device_type: wgpu::DeviceType::IntegratedGpu,
}
});
debug!("have_amd_igpu: {}", have_amd_igpu);
The-personified-devil marked this conversation as resolved.
Show resolved Hide resolved

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. \
For more detailed info visit 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 = alvr_server_io::steamvr_root_dir()?

Check failure on line 156 in alvr/dashboard/src/steamvr_launcher/linux_steamvr.rs

View workflow job for this annotation

GitHub Actions / check-linux

error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `std::ops::FromResidual`) --> alvr/dashboard/src/steamvr_launcher/linux_steamvr.rs:156:60 | 101 | fn linux_gpu_checks(device_infos: &[(&wgpu::Adapter, DeviceInfo)]) { | ------------------------------------------------------------------ this function should return `Result` or `Option` to accept `?` ... 156 | let vrmonitor_path = alvr_server_io::steamvr_root_dir()? | ^ cannot use the `?` operator in a function that returns `()` | = help: the trait `std::ops::FromResidual<std::result::Result<std::convert::Infallible, alvr_common::anyhow::Error>>` is not implemented for `()` help: consider adding return type | 101 | fn linux_gpu_checks(device_infos: &[(&wgpu::Adapter, DeviceInfo)]) -> Result<(), Box<dyn std::error::Error>> { | +++++++++++++++++++++++++++++++++++++++++
.join("bin")
.join("vrmonitor.sh");
debug!("vrmonitor_path: {}", vrmonitor_path);

Check failure on line 159 in alvr/dashboard/src/steamvr_launcher/linux_steamvr.rs

View workflow job for this annotation

GitHub Actions / check-linux

error[E0277]: `std::path::PathBuf` doesn't implement `std::fmt::Display` --> alvr/dashboard/src/steamvr_launcher/linux_steamvr.rs:159:34 | 159 | debug!("vrmonitor_path: {}", vrmonitor_path); | ^^^^^^^^^^^^^^ `std::path::PathBuf` cannot be formatted with the default formatter; call `.display()` on it | = help: the trait `std::fmt::Display` is not implemented for `std::path::PathBuf` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead = note: call `.display()` or `.to_string_lossy()` to safely print paths, as they may contain non-Unicode data = note: this error originates in the macro `$crate::__private_api::format_args` which comes from the expansion of the macro `debug` (in Nightly builds, run with -Z macro-backtrace for more info)

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!(
"For functioning VR you need to put following line into SteamVR commandline options and restart it:"
);
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%")
VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json {} %command%", vrmonitor_path);

Check failure on line 168 in alvr/dashboard/src/steamvr_launcher/linux_steamvr.rs

View workflow job for this annotation

GitHub Actions / check-linux

error[E0277]: `std::path::PathBuf` doesn't implement `std::fmt::Display` --> alvr/dashboard/src/steamvr_launcher/linux_steamvr.rs:168:85 | 168 | VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json {} %command%", vrmonitor_path); | ^^^^^^^^^^^^^^ `std::path::PathBuf` cannot be formatted with the default formatter; call `.display()` on it | = help: the trait `std::fmt::Display` is not implemented for `std::path::PathBuf` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead = note: call `.display()` or `.to_string_lossy()` to safely print paths, as they may contain non-Unicode data = note: this error originates in the macro `$crate::__private_api::format_args` which comes from the expansion of the macro `warn` (in Nightly builds, run with -Z macro-backtrace for more info)
warn!("And similar commandline to ALL games commandline option you're trying to launch from steam: \
__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%");
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!(
"For functioning VR you need to put following line into SteamVR commandline options and restart it:"
);
warn!("DRI_PRIME=1 {} %command%", vrmonitor_path);

Check failure on line 176 in alvr/dashboard/src/steamvr_launcher/linux_steamvr.rs

View workflow job for this annotation

GitHub Actions / check-linux

error[E0277]: `std::path::PathBuf` doesn't implement `std::fmt::Display` --> alvr/dashboard/src/steamvr_launcher/linux_steamvr.rs:176:47 | 176 | warn!("DRI_PRIME=1 {} %command%", vrmonitor_path); | ^^^^^^^^^^^^^^ `std::path::PathBuf` cannot be formatted with the default formatter; call `.display()` on it | = help: the trait `std::fmt::Display` is not implemented for `std::path::PathBuf` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead = note: call `.display()` or `.to_string_lossy()` to safely print paths, as they may contain non-Unicode data = note: this error originates in the macro `$crate::__private_api::format_args` which comes from the expansion of the macro `warn` (in Nightly builds, run with -Z macro-backtrace for more info)
warn!("And similar commandline to ALL games commandline options you're trying to launch from stean:");
warn!("DRI_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 set following line in your SteamVR commandline options and restart it: {} %command%",
vrmonitor_path

Check failure on line 188 in alvr/dashboard/src/steamvr_launcher/linux_steamvr.rs

View workflow job for this annotation

GitHub Actions / check-linux

error[E0277]: `std::path::PathBuf` doesn't implement `std::fmt::Display` --> alvr/dashboard/src/steamvr_launcher/linux_steamvr.rs:188:13 | 188 | vrmonitor_path | ^^^^^^^^^^^^^^ `std::path::PathBuf` cannot be formatted with the default formatter; call `.display()` on it | = help: the trait `std::fmt::Display` is not implemented for `std::path::PathBuf` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead = note: call `.display()` or `.to_string_lossy()` to safely print paths, as they may contain non-Unicode data = note: this error originates in the macro `$crate::__private_api::format_args` which comes from the expansion of the macro `warn` (in Nightly builds, run with -Z macro-backtrace for more info)
)
}
}

fn linux_encoder_checks(device_infos: &[DeviceInfo]) {
for device_info in device_infos {
match device_info {
Expand Down Expand Up @@ -191,7 +255,9 @@
"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 +297,28 @@
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