From 8e041e30c927e1d3d8776a20dee9c42514582fd9 Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Mon, 31 Mar 2025 13:21:40 +0100 Subject: [PATCH] check-va-api: Add an option to do all checks We cannot know whether we expect the VA-API implementation to support H264, MPEG or only postprocessing, so when called from Steam's diagnostic tools we only require one success, and stop after the first success. However, during development and debugging it's helpful to be able to try all of the possible code paths. Signed-off-by: Simon McVittie <smcv@collabora.com> --- helpers/check-va-api.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/helpers/check-va-api.c b/helpers/check-va-api.c index 671c7c82..befb1bb4 100644 --- a/helpers/check-va-api.c +++ b/helpers/check-va-api.c @@ -67,6 +67,7 @@ clear_surfaces (VADisplay va_display, enum { OPTION_HELP = 1, + OPTION_ALL, OPTION_VERBOSE, OPTION_VERSION, }; @@ -74,6 +75,7 @@ enum struct option long_options[] = { { "help", no_argument, NULL, OPTION_HELP }, + { "all", no_argument, NULL, OPTION_ALL }, { "verbose", no_argument, NULL, OPTION_VERBOSE }, { "version", no_argument, NULL, OPTION_VERSION }, { NULL, 0, NULL, 0 } @@ -550,6 +552,7 @@ main (int argc, #define do_vaapi_or_exit(expr) if (! _do_vaapi (#expr, expr)) goto out; + bool try_all = false; bool verbose = false; int opt; int surfaces_count = 2; @@ -575,6 +578,10 @@ main (int argc, usage (0); break; + case OPTION_ALL: + try_all = true; + break; + case OPTION_VERBOSE: verbose = true; break; @@ -650,14 +657,19 @@ main (int argc, /* We assume to have at least one of VAProfileH264Main, VAProfileMPEG2Simple * or VAProfileNone */ - if (test_decode_capability (va_display, VAProfileH264Main, width, height, - input_region, output_region, surfaces, surfaces_count)) + if ((ret != 0 || try_all) + && test_decode_capability (va_display, VAProfileH264Main, width, height, + input_region, output_region, surfaces, surfaces_count)) ret = 0; - else if (test_decode_capability (va_display, VAProfileMPEG2Simple, width, height, - input_region, output_region, surfaces, surfaces_count)) + + if ((ret != 0 || try_all) + && test_decode_capability (va_display, VAProfileMPEG2Simple, width, height, + input_region, output_region, surfaces, surfaces_count)) ret = 0; - else if (test_pp_capability (va_display, width, height, input_region, - output_region, surfaces, surfaces_count)) + + if ((ret != 0 || try_all) + && test_pp_capability (va_display, width, height, input_region, + output_region, surfaces, surfaces_count)) ret = 0; out: -- GitLab