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

Rework graphics adapter scanning to not use the Windows registry #2498

Closed
jellysquid3 opened this issue May 12, 2024 · 8 comments
Closed

Rework graphics adapter scanning to not use the Windows registry #2498

jellysquid3 opened this issue May 12, 2024 · 8 comments
Labels
A-drivers Area: Driver compatibility P-high Priority: High R-pending-release Resolution: Pending release T-tracking Type: Tracking

Comments

@jellysquid3
Copy link
Member

jellysquid3 commented May 12, 2024

Minecraft 1.20.5 and later now use a newer version of OSHI, which changed the way that graphics adapters are enumerated on the system. Specifically, it now looks at the Windows registry under SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318} instead of querying WMI.

This has a number of problems:

  • The information contained is often out-of-date or incorrect. The registry can contain (many) entries for GPUs that are not installed.
  • The version numbers reported are inconsistent with what we expect. This causes problems like Unable to update Intel graphics driver to 15.33.53.5161 #2432 which are not obvious how to solve.
  • Sometimes, the registry values (specifically the DriverVersion key) are not of an expected type, and trying to query it causes a crash at startup. (see 1.20.6 crash #2450)

In general, it seems the registry is just completely unreliable and is nothing but a trainwreck to interact with. And tragically, this would be typical for anything on Windows.

@jellysquid3 jellysquid3 added P-high Priority: High A-drivers Area: Driver compatibility T-tracking Type: Tracking labels May 12, 2024
@jellysquid3
Copy link
Member Author

We should either revert to using the WMI interface (which is non-trivial, because we'd need to copy a lot of code that interacts with Win32/COM), or we need to find some other way to query the driver information which does not rely on the registry.

@jellysquid3
Copy link
Member Author

We also need to patch Minecraft itself to no longer use the (broken) method, since it tries to enumerate the graphics adapters in the system when producing the crash report, and can fail/abort if that doesn't work.

@jellysquid3
Copy link
Member Author

Regarding the point about the registry keys not getting cleaned up, we've seen ridiculous reports like the following...

image

If you don't fully remove your graphics drivers before installing a different GPU, nothing ever gets invoked to clean up the old registry entries, and then Sodium gets confused because it sees a bunch of GPUs that are not even installed.

@MeeniMc
Copy link
Contributor

MeeniMc commented May 14, 2024

We also need to patch Minecraft itself to no longer use the (broken) method, since it tries to enumerate the graphics adapters in the system when producing the crash report, and can fail/abort if that doesn't work.

Would it make sense to report this to Mojira?

@MuhammedEmirArtan
Copy link

Oh wow. Maybe use some open source libs to get the gpu info?

@IMS212
Copy link
Member

IMS212 commented May 15, 2024

That library is called OSHI.

It’s the one that broke.

@jellysquid3
Copy link
Member Author

There is now a new graphics adapter probe implementation using D3D-KMT on Windows. This should fix the problems described in the issue...

@jellysquid3
Copy link
Member Author

Fixed with 4041519...b1164fb.

@jellysquid3 jellysquid3 added the R-pending-release Resolution: Pending release label May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-drivers Area: Driver compatibility P-high Priority: High R-pending-release Resolution: Pending release T-tracking Type: Tracking
Development

No branches or pull requests

4 participants