Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #568.
Background
On Windows 11 (especially on hybrid P/E-core CPUs), hiding
SettingsWindowto the system tray leaves Prismatik without visible top-level windows. Windows treats background windowless processes as eligible for EcoQoS execution-speed throttling (PROCESS_POWER_THROTTLING_EXECUTION_SPEED) and timer-resolution throttling (PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION), which can degrade grabber loop cadence and frame updates when running behind fullscreen/heavy games.Changes
Software/src/WindowsPowerThrottling.hpp(registered inSoftware/src/src.proandSoftware/tests/tests.pro):WindowsPowerThrottling::disablePowerThrottling,WindowsPowerThrottling::logPowerThrottlingResult) using fixed-width types and an injectableSetProcessInformationFncallback.#ifdef Q_OS_WIN,WindowsPowerThrottling::disableWindowsPowerThrottling()dynamically resolvesSetProcessInformationfromkernel32.dllviaGetModuleHandleW+GetProcAddress(with-Wcast-function-typeguarded for Clang/GCC) for compatibility across Windows 7+ and different Windows SDK / MinGW / MSVC toolchains.ProcessPowerThrottlingdirectly whenPROCESS_POWER_THROTTLING_CURRENT_VERSIONis defined by the Windows SDK and enforces ABI alignment at compile time withstatic_assertchecks againstProcessPowerThrottling,PROCESS_POWER_THROTTLING_CURRENT_VERSION,PROCESS_POWER_THROTTLING_EXECUTION_SPEED,PROCESS_POWER_THROTTLING_IGNORE_TIMER_RESOLUTION, andsizeof(NativePowerThrottlingState).ControlMask = 0x1 | 0x4,StateMask = 0); falls back to disabling execution-speed throttling only (ControlMask = 0x1,StateMask = 0) when the combined call fails (e.g., Windows 10 RS3+ returningERROR_INVALID_PARAMETERforIGNORE_TIMER_RESOLUTION).ERROR_INVALID_PARAMETER(87) on both the initial and fallback calls (e.g., Windows 8 / 8.1 / pre-RS3 Windows 10) asStatus::Unsupportedlogged viaqDebug(), while retainingqWarning()(Status::Failed) for unexpected errors such asERROR_ACCESS_DENIED.Software/src/main.cppunder#ifdef Q_OS_WINto invokeWindowsPowerThrottling::disableWindowsPowerThrottling()during startup (mirroring macOS'sNSActivityLatencyCriticalopt-out) and log the result viaWindowsPowerThrottling::logPowerThrottlingResult()onceLogWriterhas initialized.Software/tests/WindowsPowerThrottlingTest.hppandSoftware/tests/WindowsPowerThrottlingTest.cpp(registered inSoftware/tests/TestsMain.cppandSoftware/tests/tests.pro) coveringDisabledAll,DisabledExecutionSpeedOnly,Unavailable,Unsupported,Failederror combinations, log severity (qDebugvsqWarning), and state layout/constants across all platforms.Verification
PrismatikandLightpackTestson Linux (qmake6 -r && make -j2) and ranQT_QPA_PLATFORM=offscreen ./bin/LightpackTests(all 9 test suites passed,0 failed,0 skipped, includingWindowsPowerThrottlingTest: 8 passed).#ifdef Q_OS_WINWindows 11, Windows 10 RS3, and legacy Windows SDK scenarios withg++ -std=c++17 -Wall -Wextra -Wsign-compare -Wcast-function-type -Werror.