test/kms: Add support for display with non-contiguous pipes
cover test/kms: Add support for display with non-contiguous pipes
add support for display with non-contiguous pipes.
Mohammed Khajapasha (2):
lib/igt_kms: Set pipe enum name to a pipe from drm pipe test/kms: In static iteration skip the testcases for disable pipes
lib/igt_core.h | 22 ++++++++++++++++++++++ lib/igt_kms.c | 13 +++++++++---- tests/kms_color.c | 2 +- tests/kms_color_chamelium.c | 2 +- tests/kms_concurrent.c | 2 +- tests/kms_cursor_legacy.c | 2 +- tests/kms_pipe_crc_basic.c | 2 +- tests/kms_plane.c | 2 +- tests/kms_plane_cursor.c | 3 +++ tests/kms_plane_lowres.c | 2 +- tests/kms_plane_multiple.c | 2 +- tests/kms_universal_plane.c | 2 +- 12 files changed, 43 insertions(+), 13 deletions(-)
Signature · 6 lines
2.24.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 1/2 lib/igt_kms: Set pipe enum name to a pipe from drm pipe
set the pipe enum name to igt pipe from drm pipe,
in case of non-contiguous pipes in display, the igt pipes cann't be same as enabled pipes in kernel.
Signed-off-by Mohammed Khajapasha <[email protected]>
--- lib/igt_kms.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
lib/igt_kms.c +7 -1
@@ -1958,10 +1958,16 @@ void igt_display_require(igt_display_t *display, int drm_fd)int p =1 ;int j, type;uint8_t last_plane =0 , n_planes =0 ; +struct drm_i915_get_pipe_from_crtc_id get_pipe; pipe->crtc_id = resources->crtcs[i]; pipe->display = display; - pipe->pipe = i; +/* Get right pipe enum from kernel for a pipe */ + get_pipe.pipe =0 ; + get_pipe.crtc_id = pipe->crtc_id; +do_ioctl (display->drm_fd, +DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID , &get_pipe); + pipe->pipe = get_pipe.pipe; pipe->plane_cursor =-1 ; pipe->plane_primary =-1 ; pipe->planes =NULL ;
Signature · 6 lines
2.24.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 2/2 test/kms: In static iteration skip the testcases for disable pipes
In reply to Mohammed KhajapashaIn non-contiguous display pipes, the static iteration of pipes in the testcases can cause iteration over disabled pipes and segmentation fault, hence skip the testcase for disable pipes.
Signed-off-by Mohammed Khajapasha <[email protected]>
--- lib/igt_core.h | 22 ++++++++++++++++++++++ lib/igt_kms.c | 5 ++--- tests/kms_color.c | 2 +- tests/kms_color_chamelium.c | 2 +- tests/kms_concurrent.c | 2 +- tests/kms_cursor_legacy.c | 2 +- tests/kms_pipe_crc_basic.c | 2 +- tests/kms_plane.c | 2 +- tests/kms_plane_cursor.c | 3 +++ tests/kms_plane_lowres.c | 2 +- tests/kms_plane_multiple.c | 2 +- tests/kms_universal_plane.c | 2 +- 12 files changed, 36 insertions(+), 12 deletions(-)
lib/igt_core.h +22 -0
@@ -987,6 +987,28 @@ void igt_describe_f(const char *fmt, ...); else igt_debug("Test requirement passed: %s\n", #expr); \ } while (0) +/** +* igt_require_pipe: +* @display: pointer to igt_display_t +* @pipe: pipe which need to check +* +* Skip a (sub-)test if the pipe not enabled. +* +* Should be used everywhere where a test checks pipe and skip +* test when pipe is not enabled. +*/ +#define igt_require_pipe (display, p) \ + do { \ + bool expr = 0; \ + for (int n = 0; n < igt_display_get_n_pipes(display); n++) { \ + if (((display)->pipes[(n)].pipe) == p) { \ + expr = true; \ + break; \ + } \ + } \ + igt_skip_on_f(!expr, "Pipe %s does not exist.\n", kmstest_pipe_name(p)); \ + } while (0) +/** * igt_skip_on: * @expr: condition to test
lib/igt_kms.c +2 -3
@@ -2136,8 +2136,7 @@ void igt_display_require_output_on_pipe(igt_display_t *display, enum pipe pipe) {igt_output_t *output; -igt_skip_on_f (pipe >=igt_display_get_n_pipes (display), -"Pipe %s does not exist.\n" ,kmstest_pipe_name (pipe)); +igt_require_pipe (display, pipe);for_each_valid_output_on_pipe (display, pipe, output)return ;
@@ -2486,7 +2485,7 @@ igt_output_t *igt_get_single_output_for_pipe(igt_display_t *display, enum pipe pigt_output_t *chosen_outputs[display->n_pipes];igt_assert (pipe !=PIPE_NONE ); -igt_require (pipe < display->n_pipes); +igt_require_pipe (display, pipe);__igt_pipe_populate_outputs (display, chosen_outputs);
tests/kms_color.c +1 -1
@@ -628,7 +628,7 @@ run_tests_for_pipe(data_t *data, enum pipe p) igt_fixture {igt_require_pipe_crc (data->drm_fd); -igt_require (p < data->display.n_pipes); +igt_require_pipe (&data->display, p); pipe = &data->display.pipes[p];igt_require (pipe->n_planes >=0 );
tests/kms_color_chamelium.c +1 -1
@@ -519,7 +519,7 @@ run_tests_for_pipe(data_t *data, enum pipe p) igt_fixture { -igt_require (p < data->display.n_pipes); +igt_require_pipe (&data->display, p); pipe = &data->display.pipes[p];igt_require (pipe->n_planes >=0 );
tests/kms_concurrent.c +1 -1
@@ -320,7 +320,7 @@ run_tests_for_pipe(data_t *data, enum pipe pipe) igt_fixture {int valid_tests =0 ; -igt_skip_on (pipe >= data->display.n_pipes); +igt_require_pipe (&data->display, pipe);igt_require (data->display.pipes[pipe].n_planes >0 );for_each_valid_output_on_pipe (&data->display, pipe, output)
tests/kms_cursor_legacy.c +1 -1
@@ -1389,7 +1389,7 @@ igt_main errno =0 ; igt_fixture { -igt_skip_on (n >= display.n_pipes); +igt_require_pipe (&display, n); }igt_subtest_f ("pipe-%s-single-bo" ,kmstest_pipe_name (n))
tests/kms_pipe_crc_basic.c +1 -1
@@ -71,7 +71,7 @@ static void test_read_crc(data_t *data, enum pipe pipe, unsigned flags)igt_crc_t *crcs =NULL ;int c, j; -igt_skip_on (pipe >= data->display.n_pipes); +igt_require_pipe (display, pipe);igt_require_f (output,"No connector found for pipe %s\n" ,kmstest_pipe_name (pipe));
tests/kms_plane.c +1 -1
@@ -940,7 +940,7 @@ static void run_tests_for_pipe_plane(data_t *data, enum pipe pipe) { igt_fixture { -igt_skip_on (pipe >= data->display.n_pipes); +igt_require_pipe (&data->display, pipe);igt_require (data->display.pipes[pipe].n_planes >0 ); }
tests/kms_plane_cursor.c +3 -0
@@ -317,6 +317,9 @@ igt_main }for_each_pipe_static (pipe) + igt_fixture { +igt_require_pipe (&data.display, pipe); + }for (i =0 ; i <ARRAY_SIZE (cursor_sizes); ++i) {int size = cursor_sizes[i];
tests/kms_plane_lowres.c +1 -1
@@ -259,7 +259,7 @@ test_planes_on_pipe(data_t *data, uint64_t modifier)igt_plane_t *plane;unsigned tested =0 ; -igt_skip_on (data->pipe >= data->display.n_pipes); +igt_require_pipe (&data->display, data->pipe);igt_display_require_output_on_pipe (&data->display, data->pipe);igt_skip_on (!igt_display_has_format_mod (&data->display,DRM_FORMAT_XRGB8888 , modifier));
tests/kms_plane_multiple.c +1 -1
@@ -378,7 +378,7 @@ static void run_tests_for_pipe(data_t *data, enum pipe pipe) { igt_fixture { -igt_skip_on (pipe >= data->display.n_pipes); +igt_require_pipe (&data->display, pipe);igt_require (data->display.pipes[pipe].n_planes >0 ); }
tests/kms_universal_plane.c +1 -1
@@ -750,7 +750,7 @@ run_tests_for_pipe(data_t *data, enum pipe pipe) igt_fixture {int valid_tests =0 ; -igt_skip_on (pipe >= data->display.n_pipes); +igt_require_pipe (&data->display, pipe);for_each_valid_output_on_pipe (&data->display, pipe, output) valid_tests++;
Signature · 6 lines
2.24.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev