Skip to content

Windows: prefer discrete GPU on hybrid laptops (NVIDIA Optimus / AMD PowerXpress) #1921

Description

@ten9876

Problem

On Windows hybrid-GPU laptops (Intel iGPU + discrete NVIDIA/AMD), AetherSDR launches on the integrated Intel GPU by default. The Intel D3D11 user-mode driver has a stack-buffer-overrun bug that triggers during QRhiWidget reparenting — pop-out of a panadapter reliably crashes the application with STATUS_STACK_BUFFER_OVERRUN (0xC0000409).

Crash signature

Confirmed via WinDbg analysis of the dump:

00 AetherSDR!__report_gsfailure+0x1d                              ← stack canary failed
01 AetherSDR!__GSHandlerCheck_EH4+0x38
05 igd10um64xe+0x20576                                            ← Intel iGPU D3D11 UMD
06 igd10um64xe+0x9acca
08 igd10um64xe!OpenAdapter10_2+0x10706a
09 d3d11!CContext::TID3D11DeviceContext_UpdateSubresource_<1>+0x1d1
0c Qt6Gui!QRhi::endOffscreenFrame+0x58
0d Qt6Widgets!QRhiWidget::paintEvent+0xfb
13 Qt6Widgets!QRhiWidget::resizeEvent+0x73
14 AetherSDR!AetherSDR::SpectrumWidget::resizeEvent+0x18
1c AetherSDR!AetherSDR::PanadapterStack::floatPanadapter::__l2::<lambda_1>

__report_gsfailure ⇒ Windows detected a corrupted stack canary. The frame doing the corruption is inside igd10um64xe.dll (Intel D3D11 driver) on the UpdateSubresource path that QRhi takes during endOffscreenFrame. This is an Intel driver bug, but its trigger condition (rapid swap-chain teardown/recreate during widget reparenting) is reliably hit by AetherSDR's pop-out flow.

Hardware: Intel UHD Graphics + NVIDIA RTX 4090 Laptop GPU. Reproduces every pop-out attempt while running on Intel.

Fix

Add the standard Optimus/PowerXpress exports to src/main.cpp so the discrete-GPU driver binds at process startup. This is the same mechanism Qt Quick apps use; Qt Widget apps don't get it for free.

#ifdef _WIN32
#include <windows.h>
extern "C" __declspec(dllexport) DWORD NvOptimusEnablement = 1;
extern "C" __declspec(dllexport) int   AmdPowerXpressRequestHighPerformance = 1;
#endif

Verified locally: with this change, AetherSDR launches on the RTX 4090 instead of Intel UHD. The pop-out crash should not reproduce on the NVIDIA path.

Notes

  • This does not by itself fix the underlying Intel driver bug — users on Intel-only hardware (no dGPU) will still hit it. A separate workaround for that path (e.g., reviewing the double resetGpuResources() call in PanadapterStack::floatPanadapterrefreshAfterReparent()) is probably warranted.
  • The exports are no-ops on non-hybrid systems and on non-Windows builds.

Environment

  • Windows 10, MSVC 14.44, Qt 6.8.3 (msvc2022_64), QRhi backend D3D11
  • Branch: claude/frameless-popouts at 890cbb9

Metadata

Metadata

Assignees

Labels

GUIUser interfaceWindowsWindows-specific issueaetherclaude-eligibleIssue approved for AetherClaude automated agentbugSomething isn't workingmaintainer-reviewRequires maintainer review before any action is takenpriority: highHigh priorityspectrumPanadapter and waterfall

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions