Fix #143653: Add use of Quality of Service (QoS) API on Windows

This PR adds code for setting the Quality of Service (QoS) level of the
process on Windows. This can, e.g., make sure that on hybrid systems
P-cores are utilized even when the app window is out of focus.

In the following cases, it is adjusted from the default behavior:
- In wm_jobs.cc the QoS level is raised while a priority job is running.
- The command line option `--qos [high|eco|default]` can be used to
  change the QoS level of the process.
- By default, the QoS level is raised for the EEVEE performance tests,
  as they check viewport rendering performance and would otherwise be
  reliant on never going out of focus to not get a downgraded QoS level.
  By default, they are created with an out of focus window at the time
  of landing this PR. This PR makes sure that they actually measure the
  animation replay performance attainable during real-world use.

Pull Request: https://projects.blender.org/blender/blender/pulls/144224
This commit is contained in:
Christoph Neuhauser
2025-09-01 11:19:17 +02:00
parent 13329ad984
commit 1e523e2f5d
6 changed files with 175 additions and 0 deletions

View File

@@ -244,6 +244,10 @@ class TestEnvironment:
def call_blender(self, args: list[str], foreground=False) -> list[str]:
# Execute Blender command with arguments.
common_args = ['--factory-startup', '-noaudio', '--enable-autoexec', '--python-exit-code', '1']
if sys.platform == 'win32':
# Set HighQoS level on Windows to avoid reduced performance when the window is out of focus.
# See: https://learn.microsoft.com/en-us/windows/win32/procthread/quality-of-service
common_args += ['--qos', 'high']
if foreground:
common_args += ['--no-window-focus', '--window-geometry', '0', '0', '1024', '768', '--gpu-vsync', 'off']
else: