Force to use integrated (Intel) graphic card on Microsoft Hybrid system
Asked Answered
A

1

5

I use Microsoft Desktop Duplication API and if my code runs on the Integrated (Intel) graphic card then everything works fine. But if I run on the dedicated card, I get an error.

I found that Microsoft does not support this usage on a dedicated card on Microsoft Hybrid system

DXGI_ERROR_UNSUPPORTED

Similar questions without solution for my needs:

The workaround is to launch the program on the Integrated card.

I would like to solve this from code.
I found that NVIDIA / AMD card can be forced from my code

extern "C" { // Hint to Hybrid laptop drivers that our app would really rather use the NVidia/AMD GPU that you've got sitting over there rather than Intel Graphics...
    _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
    _declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}
  1. Is there a similar option for the Intel card?
  2. Or is it possible to change the NVIDIA / AMD card settings from my code to run next time on Integrated GPU? I mean: start my app, which check the NVIDIA / AMD settings, and if it's not forced to use Integrated graphic (when available), then modify this setting and restart my application.
  3. Any other solution to use Integrated card? (not a manual solution)
Adlei answered 18/6, 2019 at 8:47 Comment(11)
You might try to Enum the adapters to decide which one is the integrated one, when creating the Device / DesktopDuplication: learn.microsoft.com/en-us/windows/desktop/api/dxgi/…Olympias
I am already enumerating the adapters with EnumAdapter1(). After that, I am enumerating outputs on every adapter with EnumOutputs learn.microsoft.com/en-us/windows/desktop/api/dxgi/… When I start my process on nvidia card, only nvidia has outputs, where 2 of 3 monitor duplicate return this DXGI_ERROR_UNSUPPORTED error code. When i start my process with Intel GPU, then 2 output found on Intel GPU and 1 on Nvidia (which is correct), and all the DuplicateOutput is working fine.Adlei
I hope this will help then: blogs.msdn.microsoft.com/nativeconcurrency/2012/07/16/…Olympias
In the link You provided, the issue is to force to run on dedicated (Nvidia) GPU instead of Intel. "There is no programmatic way on Optimus systems to affect what accelerator your EXE will run against" But since 310.90, there is this "NvOptimusEnablement" flag, to force Nvidia card. But I want to force the integrated (Intel) graphic card.Adlei
Yes, I understand what you need. The link is to demonstrate that you/users can use the right-click menu to manually select the adapter to run your software on. I'm afraid that there is no programmatic way to achieve this, apart from gracefully error out when the wrong adapter is selected.Olympias
My scenario is: EnumAdapters1 --> EnumOutputs --> D3D11CreateDevice --> QueryInterface for IDXGIOutput1 -> Duplicateoutput When I run this simple app with right click -> run with graphics processor -> Nvidia, then the duplicateoutput failed. with intel, it works fine When I run it with Intel, I get 2 output for my Intel adapter and 1 for Nvidia adapter, and all duplicateoutput works fine When I run it with Nvidia, i get 3 output for Nvidia, and 0 for Intel adapter. DuplicateOutput work only on 1 ID3D11Device, which is originally on Nvidia card, but not on Intel ones.Adlei
So in both scenarios (running on Intel or NVidia) you always have exactly 1 output that DuplicateOutput will succeed with? If that's the case then you don't need to worry which adapter your software is run at, right? You simply try to create the DuplicateOutput on 1 of the outputs.Olympias
Unfortunately not, running my app with Intel GPU, all DuplicateOutput works fine. 2 on Intel IDXGIAdapter1, and 1 on Nvidia IDXGIAdapter1. But when I run my app with Nvidia GPU, then only 1 DuplicateOutput succeeded. 2 return DXGI_ERROR_UNSUPPORTED, and Microsoft said, that the resolution is to "run the application on the integrated GPU instead of on the discrete GPU on a Microsoft Hybrid system". That's why I am looking for a solution to run my process on Intel GPU by default (programatically, and do not depend on right click --> run with GPU or manual nvidia control panel settings)Adlei
There is no way to force iGPU that I am aware of. It has to be done (global or per app preference) manually from OS settings or vendor applet. You can detect if iGPU or dGPU is the currently preferred device (reflected by order of adapter enumeration) but you can't change/affect the behavior.Glycerin
You might want to bump this one to let NVIDIA know you are still interested.Glycerin
Thank you both of you. And thanks for the NVIDIA link, I will bump on it. I will continue search for a solution. Something like: editing NVIDIA's "Manage 3D Settings" list from my code (if it's not in an encoded file) or similar "not supported scenario"Adlei
S
2

Although you can use NVAPI to create an application profile and set a specific flag to make your application run on the integrated chip, newer versions of Windows may override your preference. Thus, the most reliable/easy way to do it is to set a registry value that was introduced in Windows 10 build 17093.

Or is it possible to change the NVIDIA / AMD card settings from my code to run next time on Integrated GPU? I mean: start my app, which check the NVIDIA / AMD settings, and if it's not forced to use Integrated graphic (when available), then modify this setting and restart my application.

You can do this with the registry value, yes. I'm using this approach in practice and wrote an overview of how I chose to do the GPU check. I believe Roman Ryltsov did something similar in his DxgiTakeSnapshot application (he has a bunch of posts on the subject worth reading).

Sanguine answered 20/1, 2021 at 0:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.