Skip to content

Instantly share code, notes, and snippets.

@rplacd
Last active January 29, 2024 10:34
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save rplacd/39b5ab0791fe63fa27f5 to your computer and use it in GitHub Desktop.
Save rplacd/39b5ab0791fe63fa27f5 to your computer and use it in GitHub Desktop.
Enabling Optimus on your desktop Nvidia GPU.

Enabling Optimus support for your desktop GPU

Windows 10 users: you won't need this guide. NVidia has made signed drivers available with the modifications outlined here, although it's been said you'll have to get them from third-party vendors - distributing them like they do with notebook GPU drivers. I use drivers bundled with the Razer Core enclosure.

A screenshot should be here; GitHub may have sanitised it out.

This guide...

is based on adaptation (of another adaptation) of a guide posted by Nando on the T|I forums.

It’s been tested with a MacBookPro 11,3 (“Mid-2014 Retina MacBook Pro”) with an Iris Pro, a 750M and a GTX 960. GeForce driver version 361.75 was modified.

...and its limitations

The technique’s a bit indirect: modify an INF, and the installer reads it. Why not just do what the installer does? Someone who knows RE can get this done.

A quick guide: if you’ve modded INFs before...

Find the the INF and the exact DDInstall section the nVidia installer uses to install your GPU’s drivers (enable nVidia installer logging to find out.) Add the INF directives

NVOptimusHCloneDisabled = 1
NVSupportOptimus = 1
NvSupportMSHybrid = 1

to the DDInstall section; of course, modifying the INF requires you to delete the CatalogFile directive - your driver can no longer be signed, and you’ll have to enable test mode.

Then install normally with the nVidia installer: these INF directives aren’t actually processed by Windows during driver installation, but by (so the log indicates) DisplayDriverExt.dll.

An extended guide

First verify that Optimus is disabled, but that your desktop GPU is otherwise connected to (or installed in) your computer:

  • When plugged in without a monitor,

    • You should be able to see the GPU within GeForce Experience (implying the NVAPI is detecting it)
    • But opening the Control Panel should fail with a message of the form “You are not currently using a display attached to an NVIDIA GPU.”
  • When plugged in with a monitor

    • Everything including display on the monitor should work as expected. If nothing is being displayed on the monitor, that’s Optimus.
    • You shouldn’t see, though, the options in the Control Panel for the Optimus context menu.

Now the steps begin.

  1. Enable nVidia driver logging.

    Use the files attached at http://nvidia.custhelp.com/app/answers/detail/a_id/3171/~/how-to-enable-nvidia-graphics-driver-and-geforce-experience-installer-logging.

  2. Turn off Windows’ driver signing enforcement.

  3. Find the Device ID of your graphics card.

    Look in the Device Manager - the properties pane of your GPU, under "Hardware ID". Take the code that looks like

    PCI\VEN_10DE&DEV_####, where #### is a four-letter code unique to your GPU model.

    I have PCI\VEN_10DE&DEV_1401 for my GTX 960, for example.

  4. Find the INF and INF section in your Nvidia drivers that the installer uses. To do this, install the Nvidia drivers once and read C:\NvidiaLogging\LOG.setup.exe.log.

    For example, I see the following for my hardware ID, and my hardware ID only:

	8.797 |    DEBUG: [ExtensionsLib.DevicesINFHandler] 94@CDevicesINFHandler::PerformINFActionOnSupportedDevices : Best driver found for "PCI\VEN_10DE&DEV_1401&SUBSYS_36AC1458&REV_A1\8&28F108EC&0&001800180009". 
	8.797 |    DEBUG: [DisplayDriver.DisplayDriverExtSite] 1006@CDisplayDriverExtSite::MapINFFlagsToProperties : Checking c:\nvidia\displaydriver\361.75\win8_winvista_win7_64\international\display.driver\nvami.inf section "Section205" for feature flags.

And so conclude that [Section205] in nvami.inf is the one I have to modify. You’ll do something similar.

  1. Add feature flags in the INF file to the corresponding INF section.

    These feature flags are

   NVOptimusHCloneDisabled = 1
   NVSupportOptimus = 1
   NvSupportMSHybrid = 1

In my case:

	[Section2015]
	... items elided ...
	FeatureScore = E6
	NVSupport3DVisionForOEM = 1
	NVSupportDisplayUpdate = 1
	NVSupportGFExperienceExtendedOptions = 1
	NVSupportGFExperienceUDA = 1
	NVSupportPhysx = 1
	RegisterDLLs = nv_common_registerdll__01
	... the flags are added below ... 
	NVOptimusHCloneDisabled = 1
	NVSupportOptimus = 1
	NvSupportMSHybrid = 1
  1. Delete the CatalogFile directive from your INF.

    Before,

	[Version]
	... items elided ...
	CatalogFile = NV_DISP.CAT

and after,

	[Version]
	... just the items that were there before ...
  1. Install the driver using the Nvidia installer.

    Why not just install the INF? It’s because these flags aren’t actual INF directives - Windows (that is, the SetupAPI) ignores them. The Nvidia installer, on the other hand, is happy to process them.

  2. Verify!

    In the installer log, you should see - in my case:

      8.797 |    DEBUG: [ExtensionsLib.DevicesINFHandler] 94@CDevicesINFHandler::PerformINFActionOnSupportedDevices : Best driver found for "PCI\VEN_10DE&DEV_1401&SUBSYS_36AC1458&REV_A1\8&28F108EC&0&001800180009". 
      8.797 |    DEBUG: [DisplayDriver.DisplayDriverExtSite] 1006@CDisplayDriverExtSite::MapINFFlagsToProperties : Checking c:\nvidia\displaydriver\361.75\win8_winvista_win7_64\international\display.driver\nvami.inf section "Section205" for feature flags. 
      8.938 |    DEBUG: [DisplayDriver.DisplayDriverExtSite] 1065@CDisplayDriverExtSite::MapINFFlagsToProperties : Found NVSupportPhysx -> Feature.Physx. 
      8.939 |    DEBUG: [DisplayDriver.DisplayDriverExtSite] 1102@CDisplayDriverExtSite::MapINFFlagsToProperties : Value 0 would be used for NV3DVisionDisallow. 
      8.939 |    DEBUG: [DisplayDriver.DisplayDriverExtSite] 1145@CDisplayDriverExtSite::MapINFFlagsToProperties : Value 0 would be used for NVIR3DDriverDisallow. 
      8.939 |    DEBUG: [DisplayDriver.DisplayDriverExtSite] 1167@CDisplayDriverExtSite::MapINFFlagsToProperties : Found NVSupportDisplayUpdate -> Feature.DisplayUpdate. 
      8.939 |    DEBUG: [DisplayDriver.DisplayDriverExtSite] 1197@CDisplayDriverExtSite::MapINFFlagsToProperties : Found NVSupportMSHybrid -> Feature.MSHybrid. 
      8.939 |    DEBUG: [DisplayDriver.DisplayDriverExtSite] 3778@CDisplayDriverExtSite::SetDisplayOptimusFeature : Setting Feature.DisplayOptimus as well.
  1. And turn on driver signing enforcement again.
@pmdevita
Copy link

This no longer appears to work, it seems to activate after install due to something else. Does anyone have a new guide?

@juanmiguel431
Copy link

I tried to do this and it does not work at least on my desktop PC.

@minch-dev
Copy link

There is an option to choose which gpu to use in app settings now, but only nvidia gpu is available. Similarly with windows settings - only integrated intel gpu is available. Stable Diffusion though works perfectly well and is using the dedicated gpu, althought it worked that way with DCH driver as well.
At the end of the day we don't choose anything (i.e. we don't have full control over our hardware) and this is somehow okay by the manufacturer's standards. This happens over and over again, when perfectly working functionality gets butchered because stupid gamers have their stupid problems with corrupt settings and profiles. So instead of fixing the problem they remove "problematic" functionality entirely with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment