for_each_pipe cannot be used for enumerating testcases, so provide something that can. Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxx> --- lib/igt_kms.h | 16 ++++++++++++++++ tests/kms_busy.c | 3 ++- tests/kms_concurrent.c | 3 ++- tests/kms_cursor_legacy.c | 3 ++- tests/kms_pipe_color.c | 3 ++- tests/kms_plane.c | 3 ++- tests/kms_plane_lowres.c | 4 +++- tests/kms_plane_multiple.c | 3 ++- tests/kms_universal_plane.c | 4 +++- 9 files changed, 34 insertions(+), 8 deletions(-) diff --git a/lib/igt_kms.h b/lib/igt_kms.h index 35428f3e9675..b28fe8c564c5 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -463,10 +463,26 @@ static inline bool igt_output_is_connected(igt_output_t *output) /** * for_each_pipe: + * @pipe: The pipe to iterate. + * + * This for loop iterates over all pipes supported by IGT libraries. + * + * This should be used to enumerate per-pipe subtests since it has no runtime + * depencies. + */ +#define for_each_pipe_static(pipe) \ + for (pipe = 0; pipe < IGT_MAX_PIPES; pipe++) + +/** + * for_each_pipe: * @display: a pointer to an #igt_display_t structure * @pipe: The pipe to iterate. * * This for loop iterates over all pipes. + * + * Note that this cannot be used to enumerate per-pipe subtest names since it + * depends upon runtime probing of the actual kms driver that is being tested. + * Used #for_each_pipe_static instead. */ #define for_each_pipe(display, pipe) \ for (pipe = 0; pipe < igt_display_get_n_pipes(display); pipe++) diff --git a/tests/kms_busy.c b/tests/kms_busy.c index dc0021405a06..ecf0b2eb3fd3 100644 --- a/tests/kms_busy.c +++ b/tests/kms_busy.c @@ -311,6 +311,7 @@ igt_main igt_display_t display = { .drm_fd = -1, .n_pipes = IGT_MAX_PIPES }; /* we only test on render */ const struct intel_execution_engine *e = &intel_execution_engines[1]; + enum pipe n; igt_skip_on_simulation(); @@ -327,7 +328,7 @@ igt_main /* XXX Extend to cover atomic rendering tests to all planes + legacy */ - for (int n = 0; n < IGT_MAX_PIPES; n++) { + for_each_pipe_static(n) { errno = 0; igt_fixture { diff --git a/tests/kms_concurrent.c b/tests/kms_concurrent.c index e2cde4ee8745..5d1e0bc5ad19 100644 --- a/tests/kms_concurrent.c +++ b/tests/kms_concurrent.c @@ -401,6 +401,7 @@ int main(int argc, char *argv[]) { "seed", required_argument, NULL, 's'}, { 0, 0, 0, 0 } }; + enum pipe pipe; igt_subtest_init_parse_opts(&argc, argv, "", long_options, help_str, opt_handler, NULL); @@ -415,7 +416,7 @@ int main(int argc, char *argv[]) igt_require(data.display.is_atomic); } - for (int pipe = 0; pipe < IGT_MAX_PIPES; pipe++) { + for_each_pipe_static(pipe) { igt_subtest_group run_tests_for_pipe(&data, pipe); } diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c index 15208f8b0e4f..bdb66f3b51b7 100644 --- a/tests/kms_cursor_legacy.c +++ b/tests/kms_cursor_legacy.c @@ -1425,7 +1425,8 @@ igt_main } igt_subtest_group { - for (int n = 0; n < IGT_MAX_PIPES; n++) { + enum pipe n; + for_each_pipe_static(n) { errno = 0; igt_fixture { diff --git a/tests/kms_pipe_color.c b/tests/kms_pipe_color.c index 12400686075c..ccfc08e6be15 100644 --- a/tests/kms_pipe_color.c +++ b/tests/kms_pipe_color.c @@ -1189,6 +1189,7 @@ invalid_ctm_matrix_sizes(data_t *data) igt_main { data_t data = {}; + enum pipe pipe; igt_skip_on_simulation(); @@ -1200,7 +1201,7 @@ igt_main igt_display_init(&data.display, data.drm_fd); } - for (int pipe = 0; pipe < IGT_MAX_PIPES; pipe++) + for_each_pipe_static(pipe) igt_subtest_group run_tests_for_pipe(&data, pipe); diff --git a/tests/kms_plane.c b/tests/kms_plane.c index 1d92a62bd51c..927d5d37fece 100644 --- a/tests/kms_plane.c +++ b/tests/kms_plane.c @@ -424,6 +424,7 @@ static data_t data; igt_main { + enum pipe pipe; igt_skip_on_simulation(); @@ -436,7 +437,7 @@ igt_main igt_display_init(&data.display, data.drm_fd); } - for (int pipe = 0; pipe < IGT_MAX_PIPES; pipe++) + for_each_pipe_static(pipe) run_tests_for_pipe_plane(&data, pipe); igt_fixture { diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c index ee39759cb0bc..b16c8cd433b2 100644 --- a/tests/kms_plane_lowres.c +++ b/tests/kms_plane_lowres.c @@ -339,6 +339,8 @@ static data_t data; igt_main { + enum pipe pipe; + igt_skip_on_simulation(); igt_fixture { @@ -350,7 +352,7 @@ igt_main igt_display_init(&data.display, data.drm_fd); } - for (int pipe = 0; pipe < IGT_MAX_PIPES; pipe++) + for_each_pipe_static(pipe) run_tests_for_pipe(&data, pipe); igt_fixture { diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c index 4bc26b73de97..aea59df84d76 100644 --- a/tests/kms_plane_multiple.c +++ b/tests/kms_plane_multiple.c @@ -492,6 +492,7 @@ int main(int argc, char *argv[]) { "seed", required_argument, NULL, 's'}, { 0, 0, 0, 0 } }; + enum pipe pipe; igt_subtest_init_parse_opts(&argc, argv, "", long_options, help_str, opt_handler, NULL); @@ -506,7 +507,7 @@ int main(int argc, char *argv[]) igt_require(data.display.n_pipes > 0); } - for (int pipe = 0; pipe < IGT_MAX_PIPES; pipe++) { + for_each_pipe_static(pipe) { igt_subtest_group run_tests_for_pipe(&data, pipe); } diff --git a/tests/kms_universal_plane.c b/tests/kms_universal_plane.c index 31f07804b887..58f329e684c4 100644 --- a/tests/kms_universal_plane.c +++ b/tests/kms_universal_plane.c @@ -787,6 +787,8 @@ static data_t data; igt_main { + enum pipe pipe; + igt_skip_on_simulation(); igt_fixture { @@ -799,7 +801,7 @@ igt_main igt_display_init(&data.display, data.drm_fd); } - for (int pipe = 0; pipe < IGT_MAX_PIPES; pipe++) { + for_each_pipe_static(pipe) { igt_subtest_group run_tests_for_pipe(&data, pipe); } -- 2.5.5 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx