hmlendea / gfn-electron

Linux Desktop client for Nvidia's GeForce NOW game streaming service
GNU General Public License v3.0
531 stars 64 forks source link

Input lag and performance issues #31

Closed goofyseeker311 closed 3 years ago

goofyseeker311 commented 3 years ago

quake II rtx and scrap mechanic, while fully working in windows, in the linux version has major unplayable input lag, maybe a minor video lag, tested on windows 8.1, same hardware

maciejmrozinski commented 3 years ago

I've observed the same issue on many other games when using Geforce Now inside Electron (previously with Lutris web runner) and when tried to play in Chrome with changed UserAgent to ChromeOS (to be able to launch geforce now). I have constantly growing input and video lag after launching game menus or inside missions. This is probably some issue with Linux libs, but I don't have any clue what could be wrong.

hmlendea commented 3 years ago

Firstly, could you please provide the distro, GPU model and drivers you're using?

Secondly, does GFN work well when using it directly through any browser, and if so, how well? (Preferably without using a custom CrOS UserAgent)

goofyseeker311 commented 3 years ago

ubuntu 20.04.1 LTS, 610M, tried both X and meta-nvidia

i have not tried with a web browser, just the snap

hmlendea commented 3 years ago

I also have a 610M, but I'm on Arch Linux.

Would you try the non-snap version? (e.g. the zip version, or deb since you're on Ubuntu) Let's see if this one works better

goofyseeker311 commented 3 years ago

sorry, i don't have it installed anymore

pe 8. tammik. 2021 klo 16.23 Horațiu Mlendea (notifications@github.com) kirjoitti:

I also have a 610M, but I'm on Arch Linux.

Would you try the non-snap version? (e.g. the zip version, or deb since you're on Ubuntu) Let's see if this one works better

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hmlendea/geforcenow-electron/issues/31#issuecomment-756780692, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEX7K7SHDMXDCUMHIOBBVN3SY4INLANCNFSM4VRZQVWA .

tosziro commented 3 years ago

I have same problem on Ubuntu 20.04, while using both, browser and electron app (deb version). On same machine works well with original GeForce NOW app on Windows.

psywolf85 commented 3 years ago

Using Wayland (Mate in Mint) fixed it for me.

tosziro commented 3 years ago

Using Wayland (Mate in Mint) fixed it for me.

Thank you for this tip. I changed Ubuntu session to Wayland and yeah, it works better now.

MirceaMx commented 3 years ago

Manjaro - KDE. Intel GPU. Laptop. The SNAP version by another developer does not seem to do this even though it's full-screen implementation is that with borders all-around so I suspect its the full-screen implementation here. Sure hope the developer finds the solution. Till then: back to Windows.

hmlendea commented 3 years ago

Could you guys also point the specific games that you have tried? And also, on a high level, how bad the lag is for each one of you?

For example for me in Black Mesa the lag is slight, but since it's a first-person shooter, it's unenjoyable (but "playable"). In Crusader Kings 3 it's all good since it's a strategy game.

I'm interested to know if for any of you the lag is so huge that nothing's usable.

@MirceaMx If you run GFN directly through a web browser (specifically Chrome/Chromium) how does it perform? Also, on Windows, is there a difference in performance between running it through a browser or the native app, and between running it on Windows and on Linux?

MirceaMx commented 3 years ago

I am playing The Witcher 3 - GOTY. In Chrome on Windows and Linux runs great no problems. Actually thanks on Linux the extension for Chrome runs better than your app and it does not have borders.

Edit: upon further testing it appears that it does cause lag with the extension on chrome.

Edit2: lag also in Wayland. This does not happen in Windows be it the native app or the extension.

Uninstalled linux from dual-boot. I was sorry to do that but this os has no chance.

seitbekir commented 3 years ago

Uninstalled linux from dual-boot. I was sorry to do that but this os has no chance. linux OS

Let me ask, have you payed for Windows you are using? Did you install video drivers? Do you know meaning of "OS"?

Related to lag, I had same problems before using macOS with "native" application. So it is issue on GFN side. To fix that you may increase app priority if it is set to low. This helps a lot.

MirceaMx commented 3 years ago

"Let me ask, have you payed for Windows you are using?" My Laptop has the key integrated in BIOS so in a way yes.

Did you install video drivers? I tried that but since I'm using Manjaro and have a newer Intel GPU I foun out they are already installed.

Do you know meaning of "OS"? OS means Operating System.

goofyseeker311 commented 3 years ago

I use what I use but I got mine as gift

----- Alkuperäinen viesti ----- Lähettäjä: "MirceaMx" notifications@github.com Lähetetty: ‎2.‎2.‎2021 19:05 Vastaanottaja: "hmlendea/geforcenow-electron" geforcenow-electron@noreply.github.com Kopio: "goofyseeker311" goofyseeker311@gmail.com; "Author" author@noreply.github.com Aihe: Re: [hmlendea/geforcenow-electron] Input lag is yuge (#31)

"Let me ask, have you payed for Windows you are using?" My Laptop has the key integrated in BIOS so in a way yes. Did you install video drivers? I tried that but since I'm using Manjaro and have a newer Intel GPU I foun out they are already installed. Do you know meaning of "OS"? OS means Operating System. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

seitbekir commented 3 years ago

So, after I've played for 2h. 1 hour on Mac (native app) and 1 hour on Linux I have a conclusion. Linux performs better. Seems, it is because I have Ryzen 3400G (playing on the integrated Graphics). Also, it played fine via gamepad DS4 on both machines. As using 4K OLED TV I found it is very poor quality for playing, but the traffic was not as high I've expected (I've allowed maximum). The only input lag issue I found it was because of poor connection messages (once in ~5 mins). I believe it is an issue on GFN side only.

Using Manjaro with Gnome and Wayland.

ilovespicynoodles commented 3 years ago

I'm having the same issue. I've tried Manjaro, PopOS, Debian and Ubuntu. With both free and non-free drivers and integrated graphics card and my Geforce GPU through prime. The issue persists. Both Wayland and xorg too. I have also tried through google chrome and chromium, this app and through lutris but it keeps happening. I really wonder why this happens. Do others that have this issue also run it on a laptop with both integrated intel gpu and a geforce gpu?

maciejmrozinski commented 3 years ago

I tried it (World of Tanks, but also experiencing lags in other games) on integrated Intel® HD Graphics 5500 and such variations:

hmlendea commented 3 years ago

So far it seems to universally affect Linux users regardless whether they use this app or not, so it is a more general issue that I am unable to fix as part of this application.

MirceaMx commented 3 years ago

Agree. It is a general issue!

On Sat, 20 Feb 2021, 11:59 Horațiu Mlendea, notifications@github.com wrote:

So far it seems to universally affect Linux users regardless whether they use this app or not, so it is a more general issue that I am unable to fix.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hmlendea/geforcenow-electron/issues/31#issuecomment-782598489, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJXNYV2VQII3JNKBWLKTU63S76BX5ANCNFSM4VRZQVWA .

dubigrasu commented 3 years ago

It may be the lack of video hardware accelerated decoding. Could be something else as well, but video decoding is the most problematic.

While in game press Shift+Ctrl+Alt+F6 to bring up the stats. Pay attention to the third line and note:

rtd: round trip delay from client to server
d: decoding time

So rtd is basically caused by the distance from you to the Nvidia servers, and there's nothing you can do about it. You can change the server from settings, but the one closest to you is already chosen, so likely it won't do any good. I personally have an rtd of 28 to 47ms (depending on the time of the day) and around 30ms is playable.

The d value represent how much time your system spends decoding the frames that are incoming, the lower, the better. The decoding can be done in Software (CPU) or hardware (GPU). Which one does the decoding doesn't really matter as long is done fast. However, you do need a fairly powerful CPU to do this in Software mode. On lower CPU systems is preferable to have Hardware decoding enabled and actually working. On my hardware accelerated enabled Chromium I have a d of 2.5ms, which gives me a fairly enjoyable experience. Above 5ms (with my already rtd of 30ms) the lag starts to be very noticeable, and the gameplay is affected.

In this particular case, geforcenow-electron doesn't seem to have Hardware decoding enabled, and it relies only on the CPU to do the job.

TL;DR: Enable the stats as descried above and post the rtd and d values

goofyseeker311 commented 3 years ago

If you have windows working and Linux not, it's not that

----- Alkuperäinen viesti ----- Lähettäjä: "dubigrasu" notifications@github.com Lähetetty: ‎21.‎2.‎2021 15:48 Vastaanottaja: "hmlendea/geforcenow-electron" geforcenow-electron@noreply.github.com Kopio: "goofyseeker311" goofyseeker311@gmail.com; "Author" author@noreply.github.com Aihe: Re: [hmlendea/geforcenow-electron] Input lag is huge (#31)

It may be the lack of video hardware accelerated decoding. Could be something else as well, but video decoding is the most problematic. While in game press Shift+Ctrl+Alt+F6 to bring up the stats. Pay attention to the third line and note: rtd: round trip delay from client to server d: decoding time So rtd is basically caused by the distance from you to the Nvidia servers, and there's nothing you can do about it. You can change the server from settings, but the one closest to you is already chosen for you, so likely it won't do any good. I personally have an rtd of 28 to 47ms (depending on the time of the day) and around 30ms is playable. The d value represent how much time your systems spends decoding the frames that are incoming, the lower, the better. The decoding can be done in Software (CPU) or hardware (GPU). Which one does the decoding doesn't really matter as long is done fast. However, you do need a fairly powerful CPU to do this in Software mode. On lower CPU systems is preferable to have Hardware decoding enabled and actually working. On my hardware accelerated enabled Chromium I have a d of 2.5ms, which gives me a fairly enjoyable experience. Above 5ms (with my already rtd of 30ms) ) the lag starts to be very noticeable, and the gameplay is affected. In this particular case, geforcenow-electron doesn't seem to have Hardware decoding enabled, and it relies only on the CPU to do the job. TL;DR: Enable the stats as descried above and post the rtd and d values — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

dubigrasu commented 3 years ago

If you have windows working and Linux not, it's not that

On Windows hardware video decoding support is not a problem, unfortunately it still is on Linux. While in Windows HW decoding can be easily enabled in your browser (or may be already enabled), on Linux you must go through some hoops. For regular browsers you can try: https://www.linuxuprising.com/2021/01/how-to-enable-hardware-accelerated.html But like I said geforcenow-electron does not have hardware decoding support.

ghost commented 3 years ago

I am still a little bit new to the Linux system, and need help on how to use Wayland! Please help!

I am using Linux Mint 20.1

ilovespicynoodles commented 3 years ago

I've been very busy with it and i think i MIGHT have found a solution. I'm running Manjaro using xorg. NOT wayland. What i did is i installed the "intel-media-driver" through the repository and then started chromium using this command: chromium --enable-gpu-rasterization --enable-oop-rasterization --enable-zero-copy --ignore-gpu-blocklist --use-gl=desktop --enable-accelerated-video-decode

When chrome starts, go to 'chrome://gpu' and see if everything is enabled like here: (Vulkan is not important for this.) image

If you don't use a intel integrated gpu, check here for what you need to enable hardware acceleration for your gpu. https://wiki.archlinux.org/index.php/Hardware_video_acceleration

I tried btw to use my nvidia gpu but when i use optimus' prime-run to launch chromium using those commands, it kinda bugs out. https://wiki.archlinux.org/index.php/NVIDIA_Optimus

The screen will look a little bit dark but it seems to work perfect now if you play through the browser.

I know this solution isn't for the geforcenow-electron app but i still wanted to give the info, hoping maybe there is a way to get this working in the app. I haven't developed anything using electron before so maybe one of the developers knows more?

It seems like hardware acceleration is not automatically enabled for some users and/or they don't have the needed packages installed.

maciejmrozinski commented 3 years ago

@ilovespicynoodles Tried the same thing on both X11 and Wayland (Ubuntu 20.04) and still have a lag issues. chrome://gpu tab shows exactly the same output as yours (I'm using Chrome 88.0.4324.182).

Sad, but I think GeForce Now just doesn't like Linux users... :(

dubigrasu commented 3 years ago

@ilovespicynoodles Tried the same thing on both X11 and Wayland (Ubuntu 20.04) and still have a lag issues. chrome://gpu tab shows exactly the same output as yours (I'm using Chrome 88.0.4324.182).

Sad, but I think GeForce Now just doesn't like Linux users... :(

The thing is, just because you have the same output as in the screenshot posted, that doesn't mean you actually have the hardware acceleration working. If your browser itself is not hardware acceleration enabled, no amount of tweaking will make it work, regardless what chrome://gpu shows. Geforce Now works just fine on Linux if you have all the necessary bits working.

ilovespicynoodles commented 3 years ago

@ilovespicynoodles Tried the same thing on both X11 and Wayland (Ubuntu 20.04) and still have a lag issues. chrome://gpu tab shows exactly the same output as yours (I'm using Chrome 88.0.4324.182). Sad, but I think GeForce Now just doesn't like Linux users... :(

The thing is, just because you have the same output as in the screenshot posted, that doesn't mean you actually have the hardware acceleration working. If your browser itself is not hardware acceleration enabled, no amount of tweaking will make it work, regardless what chrome://gpu shows. Geforce Now works just fine on Linux if you have all the necessary bits working.

You're correct.

@maciejmrozinski i really recommend reading https://wiki.archlinux.org/index.php/Hardware_video_acceleration and making sure you cover every section. For example in the beginning using the command $ mpv --hwdec=auto video_filename showed it was using hw acceleration, But the browser did not work correctly. Make sure you read the wiki page thoroughly.

dubigrasu commented 3 years ago

There is a (rather convoluted, but precise) way to check if the stream you're receiving in your browser is hardware decoded or not. Is a bit off topic here, but it might be useful nevertheless:

And if we speak about latency, your browser itself might cause a bit, go to: https://basro.github.io/input-lag-measuring-tool/, or better yet: https://www.vsynctester.com/ and take a look. Your mouse should closely follow the inner dot/point. You can improve the response time by starting Chrome with the --disable-frame-rate-limit flag. This will cause higher CPU usage though, be aware.

pcworld commented 3 years ago

It seems it would be possible to enable hardware video decoding in Electron: https://github.com/electron/electron/issues/18942#issuecomment-793855814

ghost commented 3 years ago

It seems it would be possible to enable hardware video decoding in Electron: electron/electron#18942 (comment)

Can the hw decoding only be enabled when compiling an electron app?

@hmlendea Do you see support as viable?

hmlendea commented 3 years ago

Version 1.1.0 released (#43) with the hardware acceleration patches and upgraded electron (v12).

On my end I can see a clear improvement in performance, let me know how it behaves in your cases.

gloeglm commented 3 years ago

Video lag for me seems to be almost gone now (before I had multi-second hangs regularly). There is however still slight lag (both input and video) in comparison to the windows native client on the same connection. Enough to make playing not really enjoyable. :(

pcworld commented 3 years ago

Would it be possible to add a log message that outputs whether hardware acceleration is actually used in playback? For me the decode times (Ctrl-Alt-Shift-F6, d value) seem to be about the same as before. However I'm using the snap package, and it may be possible that hardware decoding doesn't work there yet (with the current packaging), perhaps similar as to how the Chromium snap package does not support hardware decoding yet.

hmlendea commented 3 years ago

@pcworld unfortunately I cannot provide assistance with snap as I have next to no idea how it works and someone else is supporting it for me. However, in order to take advantage of hardware acceleration, your system must have a VAAPI driver installed (libva must be present).

e.g. for me, when I use the regular (non-snap) version, I have libva and intel-media-driver installed (that's the packages are named on Arch Linux at least).

@gloeglm Yes, unfortunately the native Windows desktop version seems to be the best performing one. This app here uses electron which means it's limited to how well GFN can run on Chrome/Chromium - which is not as well as the Windows desktop one, unforunately.

pcworld commented 3 years ago

Regarding snap and AppImage, it seems that electron-builder does not package the required libraries currently, I've opened an issue upstream: https://github.com/electron-userland/electron-builder/issues/5788

ghost commented 3 years ago

Has anyone verified if the Flatpak version can run with hw accel? I already deleted my Nvidia account due to general frustration with the Nvidia's Linux support, but if the Flatpak release is acceleration-capable I'd return for sure!

EDIT: see my comment below

ghost commented 3 years ago

^ @hmlendea Could you update the app on Flathub (v1.0.8) as you appear to be the maintainer?

hmlendea commented 3 years ago

@07416 I'm not the maintainer there, I'm just stated as the developer. I have no experience at all with flat nor snap and someone else is taking care of those packages.

hmlendea commented 3 years ago

I'm going to close this, as the performance issues have been solved.

If the problem resurfaces, feel free to reopen.

dubigrasu commented 3 years ago

I can definitely see the hardware acceleration (the Unified Video Decoder line) working with my AMD GPU:

Screenshot from 2021-04-16 09-46-23

Nice job.

ExperiBass commented 3 years ago

Coming to report the same issue on my friends all-in-one, lag only starts when geforcenow-electron is open and running a game (tested with space engineers)

https://linux-hardware.org/?probe=56c6d48f6e

E: tried in Chrome, it appears to be a issue with either chromium or the site, im leaning towards the site because the lag only starts when running a game