Select specific GPU by LUID?

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Select specific GPU by LUID?

Postby fred2 » Sat Feb 08, 2025 7:43 am

I'm using `OnAcceleratedPaint()` on Windows - this requires that the processes are all running on the same GPU; while the MSDN documentation says the handles can be used for 'multiple devices', this means 'multiple instances of ID3D11Device, referring to the same physical device' except for edge cases like SLI.

My app must run on a specific GPU, identified by LUID by a VR runtime - for physically connected VR headsets, this will be the GPU that the VR headsets is physically connected to. CEF needs to run on the same GPU.

The 'performance' vs 'efficient' preference settings available in the registry or windows are insufficient in some multi-GPU settings, e.g. when there are 2 discrete GPUs *and* an integrated GPU.
fred2
Newbie
 
Posts: 6
Joined: Sat Jan 25, 2025 4:51 pm

Re: Select specific GPU by LUID?

Postby fred2 » Sat Feb 08, 2025 8:09 am

Third attempt at searching/grepping the chromium source turned up results :) This works:

Code: Select all
  void OnBeforeCommandLineProcessing(
    const CefString& process_type,
    CefRefPtr<CefCommandLine> command_line) override {
    const auto luid = 0x14079ui64;

    command_line->AppendSwitch("angle");
    command_line->AppendSwitchWithValue("use-angle", "d3d11");
    command_line->AppendSwitchWithValue(
      "use-adapter-luid",
      std::format(
        "{},{}", luid >> 32, luid & std::numeric_limits<uint32_t>::max()));



While ANGLE+D3D11 is the default for Windows, I'm forcing it as:

- perhaps it will change it in the future
- `use-adapter-luid` is only supported by ANGLE+D3D11

Additionally:

- invalid LUID values will be silently ignored by Chromium
- my LUID value there is an `std::bit_cast<uint64_t>()` of the "Microsoft Basic Render Driver" LUID on my machine for testing; the value will vary between reboots/updates/machines. I'm using this just to test on a single-GPU system: `chrome://gpu` will then show "Software only, hardware acceleration unavailable" for most options
fred2
Newbie
 
Posts: 6
Joined: Sat Jan 25, 2025 4:51 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 88 guests