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:
@@ -818,6 +818,7 @@ static void print_help(bArgs *ba, bool all)
|
||||
BLI_args_print_arg_doc(ba, "--register-allusers");
|
||||
BLI_args_print_arg_doc(ba, "--unregister");
|
||||
BLI_args_print_arg_doc(ba, "--unregister-allusers");
|
||||
BLI_args_print_arg_doc(ba, "--qos");
|
||||
|
||||
BLI_args_print_arg_doc(ba, "--version");
|
||||
|
||||
@@ -1980,6 +1981,42 @@ static int arg_handle_unregister_extension_all(int argc, const char **argv, void
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char arg_handle_qos_set_doc[] =
|
||||
"<level>\n"
|
||||
"\tSet the Quality of Service (QoS) mode for hybrid CPU architectures (Windows only).\n"
|
||||
"\n"
|
||||
"\tdefault: Uses the default behavior of the OS.\n"
|
||||
"\thigh: Always makes use of performance cores.\n"
|
||||
"\teco: Schedules Blender threads exclusively to efficiency cores.";
|
||||
static int arg_handle_qos_set(int argc, const char **argv, void * /*data*/)
|
||||
{
|
||||
const char *arg_id = "--qos";
|
||||
if (argc > 1) {
|
||||
# ifdef _WIN32
|
||||
QoSMode qos_mode;
|
||||
if (STRCASEEQ(argv[1], "default")) {
|
||||
qos_mode = QoSMode::DEFAULT;
|
||||
}
|
||||
else if (STRCASEEQ(argv[1], "high")) {
|
||||
qos_mode = QoSMode::HIGH;
|
||||
}
|
||||
else if (STRCASEEQ(argv[1], "eco")) {
|
||||
qos_mode = QoSMode::ECO;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "\nError: Invalid QoS level '%s %s'.\n", arg_id, argv[1]);
|
||||
return 1;
|
||||
}
|
||||
BLI_windows_process_set_qos(qos_mode, QoSPrecedence::CMDLINE_ARG);
|
||||
# else
|
||||
fprintf(stderr, "\nError: '%s' is Windows only.\n", arg_id);
|
||||
# endif
|
||||
return 1;
|
||||
}
|
||||
fprintf(stderr, "\nError: '%s' no args given.\n", arg_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char arg_handle_audio_disable_doc[] =
|
||||
"\n\t"
|
||||
"Force sound system to None.";
|
||||
@@ -2835,6 +2872,8 @@ void main_args_setup(bContext *C, bArgs *ba, bool all)
|
||||
/* Command implies background mode (defers execution). */
|
||||
BLI_args_add(ba, "-c", "--command", CB(arg_handle_command_set), C);
|
||||
|
||||
BLI_args_add(ba, nullptr, "--qos", CB(arg_handle_qos_set), nullptr);
|
||||
|
||||
BLI_args_add(ba,
|
||||
nullptr,
|
||||
"--disable-depsgraph-on-file-load",
|
||||
|
||||
Reference in New Issue
Block a user