Commit 229d7d27 authored by Daniel Vetter's avatar Daniel Vetter Committed by Petri Latvala

lib/kms: Add for_each_pipe_static

for_each_pipe cannot be used for enumerating testcases, so provide
something that can.
Signed-off-by: Daniel Vetter's avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Petri Latvala's avatarPetri Latvala <petri.latvala@intel.com>
parent 2459b80b
......@@ -461,12 +461,28 @@ static inline bool igt_output_is_connected(igt_output_t *output)
for_each_if (((output = &(display)->outputs[i__]), \
igt_output_is_connected(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++)
......
......@@ -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 {
......
......@@ -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);
}
......
......@@ -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 {
......
......@@ -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);
......
......@@ -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 {
......
......@@ -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 {
......
......@@ -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);
}
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment