feat: nvgpu, make test timeout parameter optional (#328)

10 seconds is what the nvidia control panel also
has for the test timeout. Can still be changed if
shorter or longer timeouts are desired, but 10
seconds should be a general fine timeout value
to have this optional.

Co-authored-by: icex2 <djh.icex2@gmail.com>
This commit is contained in:
icex2 2025-02-13 14:51:02 +01:00 committed by GitHub
parent d07b2094e9
commit 233df32372
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 7 deletions

View File

@ -40,7 +40,7 @@ micro stuttering.
first
* For example, for IIDX 31 which runs in native 1920x1080 with a monitor also having that as its native resolution,
having the monitor id `0x12345678` and the monitor check yielding a value of ~`59.9345`, run
`nvgpu display custom-resolution-test 1920 1080 59.9345 10`
`nvgpu display custom-resolution-test 1920 1080 59.9345`
* Observe if the test is successful and the display doesn't turn blank or displays a glitched image for ~10 seconds
* Run `nvgpu display custom-resolution-set` with the previously tested settings to apply the custom display mode
* For example, `nvgpu display custom-resolution-set 0x12345678 1920 1080 59.9345`
@ -72,7 +72,7 @@ micro stuttering.
first
* For example, for IIDX 31 which runs in native 1920x1080 with a monitor also having that as its native resolution,
having the monitor id `0x12345678` and the monitor check yielding a value of ~`59.9345`, run
`nvgpu display custom-resolution-test 1920 1080 59.9345 10`
`nvgpu display custom-resolution-test 1920 1080 59.9345`
* Observe if the test is successful and the display doesn't turn blank or displays a glitched image for ~10 seconds
* Run `nvgpu display custom-resolution-set` with the previously tested settings to apply the custom display mode
* For example, `nvgpu display custom-resolution-set 0x12345678 1920 1080 59.9345`

View File

@ -1055,8 +1055,9 @@ static void _print_synopsis()
printfln_err(" config-get [display_id] Get the current display configurations. Optionally, specify a display ID to get the configuration of that display only");
printfln_err(" custom-resolution-set <display_id> <screen_width> <screen_height> <screen_refresh_rate>");
printfln_err(" Set a custom display mode with the given parameters for the given display ID. The settings are persisted immediately. Ensure you tested these before with the custom-display-test command.");
printfln_err(" custom-resolution-test <display_id> <screen_width> <screen_height> <screen_refresh_rate> <test_seconds>");
printfln_err(" custom-resolution-test <display_id> <screen_width> <screen_height> <screen_refresh_rate> [--test-timeout-secs n]");
printfln_err(" Test a custom display mode for a limited amount of time. This will revert the display mode after the given amount of seconds and not persist the changes.");
printfln_err(" test-timeout-secs: Optional. Number of seconds to test the custom display mode for. Default is 10 seconds.");
}
static bool _cmd_nv_info(const nv_api_t *nv_api)
@ -1220,11 +1221,24 @@ static bool _cmd_custom_resolution_test(const nv_api_t *nv_api, int argc, char *
screen_width = atoi(argv[1]);
screen_height = atoi(argv[2]);
screen_refresh_rate = atof(argv[3]);
test_only_timeout_sec = atoi(argv[4]);
if (test_only_timeout_sec == 0) {
printfln_err("ERROR: Time out parameter must be greater than 0");
return false;
// Sane defaults for optional parameters
test_only_timeout_sec = 10;
for (int i = 4; i < argc; i++) {
if (!strcmp(argv[i], "--test-timeout-secs")) {
if (i + 1 < argc) {
test_only_timeout_sec = atoi(argv[++i]);
if (test_only_timeout_sec == 0) {
printfln_err("ERROR: Time out parameter must be greater than 0");
return false;
}
} else {
printfln_err("ERROR: Missing argument for --test-timeout-secs");
return false;
}
}
}
printf_err("Testing custom resolution for display ID %u: %dx%d@%f, timeout %d seconds\n", display_id, screen_width, screen_height, screen_refresh_rate, test_only_timeout_sec);