alvr-org / ALVR

Stream VR games from your PC to your headset via Wi-Fi
MIT License
5.24k stars 473 forks source link

Poor encoding latency with Nvidia 4090 on Linux #1320

Closed gareth-anthony-hulse closed 1 year ago

gareth-anthony-hulse commented 1 year ago

Description

Getting 40-100ms latency from encoding with the new Nvidia 4090. Using my older AMD Radeon 6900 XT decreases encoding latency to 10-25ms. Its enough of a problem that the resolution needs to be decreased to 75% of what the Meta Quest 2 supports, as well as setting the bit rate to 30Mbps or lower in order for it to be playable. If you allow for a variable bit rate it ends up looking like a 144p video. I am using Nvidia DKMS as the driver, not Nouveau. Non-VR game frame rates are excellent, well exceeding 100 FPS at 4K max settings, even when using Proton. But, the AMD GPU with Mesa drivers provides a better experience with VR currently, despite having worse render latency.

General Troubleshooting

Environment

Hardware

note: had the AMD Radeon RX 6900 XT installed at the time of running hw-probe -all -upload, but the issue is with the Nvidia 4090. https://linux-hardware.org/?probe=0ca6dca505

Installation

ALVR Version: 19.0.0

SteamVR Version: 1.24.6

Install Type:

OS Name and Version: Antergos Linux

gareth-anthony-hulse commented 1 year ago

1263 and #1260 seem to be similar issues.

urbenlegend commented 1 year ago

I am getting similar latency issues. My encoder latency is constantly 30ms and above, while I've seen others (especially AMD users) have sub 10ms. Is this an ALVR bug or NVENC related?

Vixea commented 1 year ago

limitations of the nvenc's linux interface, we have to use a less then optimal format and do cpu to gpu transfers which is slow (pretty sure something something buffer formats not being supported but its been awhile so don't quote me on it) it should be improved in the latest nighties but its probably never going to match a encoding on a amd card on linux while these limitations exist

urbenlegend commented 1 year ago

Ah bummer, thanks for the clarification. Hopefully NVENC will be less problematic in the future.

hetake2 commented 1 year ago

limitations of the nvenc's linux interface, we have to use a less then optimal format and do cpu to gpu transfers which is slow (pretty sure something something buffer formats not being supported but its been awhile so don't quote me on it) it should be improved in the latest nighties but its probably never going to match a encoding on a amd card on linux while these limitations exist

Arch user here. My encoder latency on RTX 3080 is 3 ms. Total latency is 60 ms.

urbenlegend commented 1 year ago

@hetake2 How were you able to achieve that?

st-alx commented 1 year ago

confirm, on arch with latest nightly encoder latency reduced from 30 to 3-5 average. 2 moments: 1) in steamvr home toal latency about 60-70 ms (3-5 enc), in HL Alyx - average latency 70-100 (5-20 enc). 2) latest nightly does not start in my envoriment when server builded with -gpl flag. When remove this flag server starts streaming with some strange latency spikes from point 1.

may be i have some issues with system or hw setup, but it really better than was on 03-dev bulds.

env for info ryzen 5800x, rtx3070ti, archlinux

svsdval commented 1 year ago

Arch user here. My encoder latency on RTX 3080 is 3 ms. Total latency is 60 ms.

@hetake2, can you send your alvr settings and system settings & package versions ?

gareth-anthony-hulse commented 1 year ago

I installed the app image version of v20.0.0-dev07+nightly.2023.02.03, using this config: session.zip. The improvement is night and day, now with encoding latency being under 10ms.

I was going to try out Blade & Sorcery, but it is effected by a very weird issue which prevents quite a few games from starting while SteamVR is open. In fact, even uninstalling while SteamVR is running is not possible. Can't see it being the fault of ALVR because the same happens with the stable release, which worked fine before. H3VR works fine though, when "AVProVideo" DLLs are removed.

Edit: Managed to get games working by right clicking on the Steam icon in the system tray. Very odd.