Hacker News new | past | comments | ask | show | jobs | submit login
Fixing a 3 year old bug in Nvidia GeForce Experience (details-of-note.blogspot.com)
229 points by dsafonov on Dec 6, 2020 | hide | past | favorite | 56 comments



"I changed this byte in the library to fix the problem" is the ultimate triumph of being in control of your device imo. If your CPU can do a thing, you can (in principle) always find out why it does that thing and make it do something else if you want. It's just bytes all the way down.

The corollary is that fixing any such problem is only a matter of how efficiently you can do the necessary detective work to narrow down where those important bytes are. Onlookers are often puzzled how you did something that seems impossible to them, but the key is the realization that "it's possible" was never in question. It's only a matter of finding the path to make your computer do what you want - just like programming.

(Yes, there are fundamental limits like CPU bugs, web requests or homeomorphic encryption. Normally one can be quite sure which of these are relevant in the first place though. And of course, you can't fix software that is a complete mess in the first place, but working around specific bugs is often practical.)


Nice writeup! I probably would've kept unplugging my joystick for years. Impressive how good of a job Ghidra's decompiler did on libcef - this is almost on par with HexRays.

Chromium is open source, so we can take a look at the source code:

https://source.chromium.org/chromium/chromium/src/+/master:d...

(it's actually the wrong function - StopMonitor - but it references the same DeviceUsages constant that StartMonitor uses so it still worked)

Nvidia probably uses the Gamepad API in whatever they use CEF for:

https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API...

A more stable patching approach would be to find the JS sources and patch that.


The real function of interest was GetRawInputDevices (https://source.chromium.org/chromium/chromium/src/+/master:d...), not either of its two call sites. ;-)


Somewhat more retro, all that stops current nvidia drivers working on Xfree86 4.8 (from 2008, though we're working with an earlier version) is a single missing call, put this in a preloaded library:-

  int miIsSolidAlpha(void)
  {
      /* fprintf(stderr,"miIsSolidAlpha called\n"); */
      return 0;
  }
I'm not sure if this is an argument for progress or not (we use embedded development systems, and it's really common to 'export DISPLAY=someothercomputer:0') this trivial hack means Eclipse/segger/other random IDE's run perfectly on systems some of which are 22 years old now.

Edit (requested build info):-

  gcc -shared -Wl,-soname,nvtweak.so.1 -o nvtweak.so.1.0  nvtweak.c


With how much of the X server the NVIDIA driver outright replaces, I’m not surprised. It also has a ridiculously huge back-support for X ABIs. They don’t remove the old ones, and compatibility code is all baked into one driver instead of separate drivers.


This kind of thing makes me happy and also sad. Happy that we can do this. Sad that we must.


This dude is amazing. My guess is that he had something more important to do and was applying the principles of structured procrastination. He had to solve every less important task before he could move onto his #1 priority.


Don't miss the link (in the middle of TFA) to a similar (but simpler) story about the Radeon software suite: https://www.techpowerup.com/274967/psa-amds-graphics-driver-...

Both posts ask at the end something like "why/how did they mess this up" but it's pretty obvious to me as a developer ... when software systems get big, teams and timelines get big, pressure for new features and fixes for more critical problems crowd out minor cleanups and quality-of-life refinements, and that helps perpetuate the cycle. I think it is kind of important to have a reminder of how the biggest, wealthiest, and most prestigious companies can have numerous small dumb bugs hidden randomly throughout their huge software suites, and not have the motivation to fix ones that have been reported for years. But one random but smart person outside the org can take a couple of days and figure it out.


It's hard to prioritize (and convince) "let PC sleep". The negative impact+workaround make it too easy to justify putting off.

The other fun part: what will making this change break?


Great writing skills are what really drive humanity forward.

This amazing work could have been done quietly for the benefit of the ONE.

Now the MANY benefit from the fix and more importantly the process, the challenges, the failures. Writing the post doubled the work required and likely required longer than fixing the original problem.

IF YOU DON'T WRITE IT DOWN, IT NEVER HAPPENED.

There should be a Presidential award for posts like this this


Amazing sleuthing.

Though I'm also amazed people install Geforce Experience, see that you need to create an account to log into it (supports Facebook login even) for something you're ostensibly using to manage local Nvidia drivers, and then proceed with the installation process.


IIRC it's needed for recording, streaming (both game streaming and outputting to Twitch), fps overlays, Ansel, and Filters.


I believe other programs like OpenBroadcast (OBS) can use NVENC so there are less user-hostile (and buggy) alternatives.


yes but that does not cover everything geforce experience offers


Other than picking up the FPS (which I don't believe requires Experience specifically) what is missing?

All Experience adds to Ansel is "easier sharing" of the screenshots: https://developer.nvidia.com/Ansel


It also serves as the server-side component of Nvidia GameStream, which lets you play games (streamed) from another device on the local network.

(https://moonlight-stream.org/ is a fantastic open-source implementation of the client side part)


anything requiring overlay actually requires experience install (lol). i cannot figure out a way to take an ansel without experience installed so i am convinced its not actually there too


What I'm getting at is that other software can do overlays too, looking it up I notice Windows even has it built in now: https://asapguide.com/fps-game-bar/

MSI Afterburner is another one I've seen mentioned but I've not tested it.


Yes, other software can do most of what GeForce Experience can do. Not everyone wants to install and run 5 different things when the one included with their graphics driver can do them all.


Nobody is denying the convenience, just the claim that there is no alternative.


on the flip side, geforce experience requires enabling telemetry to use any of its features. you can see the breakdown in nvcleanstall


I agree that it should not act like a game launcher and make you login. But IMO Ansel and shadow play make it worth while.


IIRC every time I've manually downloaded the latest game driver for my card its installer has tried to get me to install Experience too.


https://github.com/Moyster/BaiGfe this was working fine for me when i had nvidia gpu


There are many services letting you generate fake valid email addresses on the fly, I use them all the time for this kind of programs.


I only have it installed to stream via moonlight. Now that steam link is on iOS though, I haven't used it in a long time.


Geforce Experience is such a honking piece of shit.


Reminds me when I managed to figure out what was causing hard display freezes on my system in weird 500ms patterns.

It was GeForce Experience.

Sadly I didn't go down the rabbit hole of actually debugging it, thus I uninstalled it and went on with my life.

I do love seeing Ghidra and x64dbg being used though, as it's been useful to me for other projects.


Excellent writeup. Of particular note were the x64dbg Windows program debugging tool, and the Ghidra reverse engineering tool developed by the NSA. I wasn't familiar with either one before.

x64bg: https://x64dbg.com/#start

Ghidra: https://ghidra-sre.org/


Jesus, this kind of people makes you feel small


There's always a bigger fish. Some people think I'm smart because I can make an app, but I'm just a mere mortal code monkey compared to these true geniuses


Do you do this kind of work? Sometimes we are awed by what people can do just because we have no experience in that particular discipline.


I don't usually do low-level apart from hobby projects. I've done some x86 assembly trying to patch an exe and such this and it seems hard enough.


Related pro-tip: Use this to carve out most of the crap from the nvidia driver installer.

https://www.techpowerup.com/download/techpowerup-nvcleanstal...

I wish someone would make something equal for the AMD drivers.


>I wish someone would make something equal for the AMD drivers.

AFAIK amd's driver installer allows you to select the driver only, and the radeon control panel won't be installed


That was true in the past. Today you get gigabytes of garbage and you better like it, because you have no choice.


Very impressive work!

I remember that Joystick dialogue box from years ago -- maybe even Windows 98 days. Surprised it's not been updated, but I suppose it serves it's purpose.


Came with Windows 95, still remember using it to test a Sidewinder 3d Pro with it :)


>Enabling raw input either as a system-wide input sink (dwFlags = RIDEV_INPUTSINK 0x100) or only on foreground focus (default, dwFlags = 0x0) causes devices to flood the HWND's message queue with WM_INPUTs, and prevents the system from becoming idle

> [...]

>Changing the 0x04 to a 0x06 means that instead of trying to get raw input from joysticks, they get it from the keyboard instead

Why does changing the usage id fix the issue? The prior paragraph suggests the issue is with the api itself, not with a particular usage id.


As i understood it, using raw input keeps the system awake and that may be working as intended (hence they suggest that Microsoft better document that//reflect it in powercfg /requests). The issue is that GeForce experience was requesting raw input when it wasn't necessary.


He changed ID to instead receive events from keyboard, which presumably doesn't generate cyclic events. (but only on keypresses)


I believe his issue was that I'd was poorly documented, and that NVIDIA needed to use a more exclusive id. Presumably, it's not clear in the documentation that the input class NVIDIA chose also included the controller input too.


When nVidia launched ShadowPlay eons ago I gave it a try. But few hours in I decided it's too annoying and resumed to use OBS for my streaming/game recording activities hence ShadowPlay is always disabled. When I fresh install a new Windows it's on the checklist - disable ShadowPlay


check out nvcleanstall


Fantastic article, thank you for sharing!


Several months later Nvidia QA are going to close the bug without neither a comment nor a fix.


I'm curious whether the author sent the link to the blog post to Nvidia...


Very impressive. And interesting to see just how many systems were involved.


The Ghidra decompiler is particularly impressive.


Now if only someone can fix the bug with ShadowPlay that records your screen in the wrong aspect ratio event though you tell it to output in 1080p and play in 1080p with dual monitor


There's also a bug in geforce experience that will render the application useless if your username is not a valid regular expression. That's been in there for years too.


Why do people install GeForce Experience in the first place?


Some of the features are genuinely useful. The screen recording stuff built-in is fast, high quality, and easy to use. I have OBS set up and know how to use it but I usually use Shadowplay instead


Yeah OBS is less buggy and more reliable, but it tanks my FPS much more than nVidia. And FPS is king when you're gaming.


Sure, up to the point where you've reached your screen's refresh rate. I manage to maintain a solid 60 FPS everywhere with OBS recording and doing full-software encoding, with mid-tier hardware. By the way, you can use nvenc in OBS without GeForce Experience running.


I mean of course nvidia includes chromium embedded framework, why not... every single stupid program needs that /s




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: