[igt-dev] [PATCH i-g-t] tests/kms_plane_multiple: Drain pipe before reading CRC
Mika Kahola
mika.kahola at intel.com
Fri Feb 23 11:07:28 UTC 2018
In CI runs we every now and then fail to read correct CRC yielding an error
when comparing reference and grabbed CRC's. Let's first fix the test so that
we drain the pipe first and then read the correct CRC. While at it, let's
simplify the test by combining legacy and atomic tests into a one common
function.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103166
Signed-off-by: Mika Kahola <mika.kahola at intel.com>
---
tests/kms_plane_multiple.c | 115 ++++++++-------------------------------------
1 file changed, 20 insertions(+), 95 deletions(-)
diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c
index 95b7138..1e8ffe3 100644
--- a/tests/kms_plane_multiple.c
+++ b/tests/kms_plane_multiple.c
@@ -46,6 +46,7 @@ typedef struct {
typedef struct {
int drm_fd;
igt_display_t display;
+ igt_crc_t ref_crc;
igt_pipe_crc_t *pipe_crc;
igt_plane_t **plane;
struct igt_fb *fb;
@@ -101,11 +102,11 @@ static void test_fini(data_t *data, igt_output_t *output, int n_planes)
static void
test_grab_crc(data_t *data, igt_output_t *output, enum pipe pipe, bool atomic,
- color_t *color, uint64_t tiling, igt_crc_t **crc /* out */)
+ color_t *color, uint64_t tiling)
{
drmModeModeInfo *mode;
igt_plane_t *primary;
- int ret, n;
+ int ret;
igt_output_set_pipe(output, pipe);
@@ -127,8 +128,8 @@ test_grab_crc(data_t *data, igt_output_t *output, enum pipe pipe, bool atomic,
igt_skip_on(ret != 0);
igt_pipe_crc_start(data->pipe_crc);
- n = igt_pipe_crc_get_crcs(data->pipe_crc, 1, crc);
- igt_assert_eq(n, 1);
+ igt_pipe_crc_drain(data->pipe_crc);
+ igt_pipe_crc_get_single(data->pipe_crc, &data->ref_crc);
}
/*
@@ -239,17 +240,13 @@ prepare_planes(data_t *data, enum pipe pipe_id, color_t *color,
}
static void
-test_atomic_plane_position_with_output(data_t *data, enum pipe pipe,
- igt_output_t *output, int n_planes,
- uint64_t tiling)
+test_plane_position_with_output(data_t *data, enum pipe pipe,
+ igt_output_t *output, int n_planes,
+ uint64_t tiling, int commit)
{
- char buf[256];
- struct drm_event *e = (void *)buf;
color_t blue = { 0.0f, 0.0f, 1.0f };
- igt_crc_t *ref = NULL;
- igt_crc_t *crc = NULL;
- unsigned int vblank_start, vblank_stop;
- int i, n, ret;
+ igt_crc_t crc;
+ int i;
int iterations = opt.iterations < 1 ? 1 : opt.iterations;
bool loop_forever;
char info[256];
@@ -269,84 +266,18 @@ test_atomic_plane_position_with_output(data_t *data, enum pipe pipe,
test_init(data, pipe, n_planes);
- test_grab_crc(data, output, pipe, true, &blue, tiling, &ref);
+ test_grab_crc(data, output, pipe, false, &blue, tiling);
i = 0;
while (i < iterations || loop_forever) {
prepare_planes(data, pipe, &blue, tiling, n_planes, output);
- vblank_start = kmstest_get_vblank(data->display.drm_fd, pipe,
- DRM_VBLANK_NEXTONMISS);
+ igt_display_commit2(&data->display, commit);
- igt_display_commit_atomic(&data->display,
- DRM_MODE_PAGE_FLIP_EVENT,
- &data->display);
+ igt_pipe_crc_drain(data->pipe_crc);
+ igt_pipe_crc_get_single(data->pipe_crc, &crc);
- igt_set_timeout(1, "Stuck on page flip");
-
- ret = read(data->display.drm_fd, buf, sizeof(buf));
- igt_assert(ret >= 0);
-
- vblank_stop = kmstest_get_vblank(data->display.drm_fd, pipe, 0);
- igt_assert_eq(e->type, DRM_EVENT_FLIP_COMPLETE);
- igt_reset_timeout();
-
- n = igt_pipe_crc_get_crcs(data->pipe_crc, vblank_stop - vblank_start, &crc);
-
- igt_assert(vblank_stop - vblank_start <= MAX_CRCS);
- igt_assert_eq(n, vblank_stop - vblank_start);
-
- igt_assert_crc_equal(ref, crc);
-
- i++;
- }
-
- igt_pipe_crc_stop(data->pipe_crc);
-
- test_fini(data, output, n_planes);
-}
-
-static void
-test_legacy_plane_position_with_output(data_t *data, enum pipe pipe,
- igt_output_t *output, int n_planes,
- uint64_t tiling)
-{
- color_t blue = { 0.0f, 0.0f, 1.0f };
- igt_crc_t *ref = NULL;
- igt_crc_t *crc = NULL;
- int i, n;
- int iterations = opt.iterations < 1 ? 1 : opt.iterations;
- bool loop_forever;
- char info[256];
-
- if (opt.iterations == LOOP_FOREVER) {
- loop_forever = true;
- sprintf(info, "forever");
- } else {
- loop_forever = false;
- sprintf(info, "for %d %s",
- iterations, iterations > 1 ? "iterations" : "iteration");
- }
-
- igt_info("Testing connector %s using pipe %s with %d planes %s with seed %d\n",
- igt_output_name(output), kmstest_pipe_name(pipe), n_planes,
- info, opt.seed);
-
- test_init(data, pipe, n_planes);
-
- test_grab_crc(data, output, pipe, false, &blue, tiling, &ref);
-
- i = 0;
- while (i < iterations || loop_forever) {
- prepare_planes(data, pipe, &blue, tiling, n_planes, output);
-
- igt_display_commit2(&data->display, COMMIT_LEGACY);
-
- n = igt_pipe_crc_get_crcs(data->pipe_crc, MAX_CRCS, &crc);
-
- igt_assert_eq(n, MAX_CRCS);
-
- igt_assert_crc_equal(ref, crc);
+ igt_assert_crc_equal(&data->ref_crc, &crc);
i++;
}
@@ -378,17 +309,11 @@ test_plane_position(data_t *data, enum pipe pipe, bool atomic, uint64_t tiling)
connected_outs = 0;
for_each_valid_output_on_pipe(&data->display, pipe, output) {
- if (atomic)
- test_atomic_plane_position_with_output(data, pipe,
- output,
- n_planes,
- tiling);
- else
- test_legacy_plane_position_with_output(data, pipe,
- output,
- n_planes,
- tiling);
-
+ test_plane_position_with_output(data, pipe,
+ output,
+ n_planes,
+ tiling,
+ atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
connected_outs++;
}
--
2.7.4
More information about the igt-dev
mailing list