summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/igt_kms.c10
-rw-r--r--lib/igt_kms.h1
-rw-r--r--tests/kms_pipe_crc_basic.c35
3 files changed, 27 insertions, 19 deletions
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 8751c97f..e12ed723 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -3020,8 +3020,7 @@ void igt_crtc_set_background(igt_pipe_t *pipe, uint64_t background)
pipe->background_changed = true;
}
-
-void igt_wait_for_vblank(int drm_fd, enum pipe pipe)
+void igt_wait_for_vblank_count(int drm_fd, enum pipe pipe, int count)
{
drmVBlank wait_vbl;
uint32_t pipe_id_flag;
@@ -3031,11 +3030,16 @@ void igt_wait_for_vblank(int drm_fd, enum pipe pipe)
wait_vbl.request.type = DRM_VBLANK_RELATIVE;
wait_vbl.request.type |= pipe_id_flag;
- wait_vbl.request.sequence = 1;
+ wait_vbl.request.sequence = count;
igt_assert(drmWaitVBlank(drm_fd, &wait_vbl) == 0);
}
+void igt_wait_for_vblank(int drm_fd, enum pipe pipe)
+{
+ igt_wait_for_vblank_count(drm_fd, pipe, 1);
+}
+
/**
* igt_enable_connectors:
*
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 6754d00e..f29dfe01 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -415,6 +415,7 @@ void igt_fb_set_size(struct igt_fb *fb, igt_plane_t *plane,
uint32_t w, uint32_t h);
void igt_wait_for_vblank(int drm_fd, enum pipe pipe);
+void igt_wait_for_vblank_count(int drm_fd, enum pipe pipe, int count);
static inline bool igt_output_is_connected(igt_output_t *output)
{
diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
index b0622cfb..79f3747f 100644
--- a/tests/kms_pipe_crc_basic.c
+++ b/tests/kms_pipe_crc_basic.c
@@ -96,7 +96,6 @@ test_read_crc_for_output(data_t *data, int pipe, igt_output_t *output,
igt_display_t *display = &data->display;
igt_plane_t *primary;
drmModeModeInfo *mode;
- igt_pipe_crc_t *pipe_crc;
igt_crc_t *crcs = NULL;
int c, j;
@@ -124,30 +123,35 @@ test_read_crc_for_output(data_t *data, int pipe, igt_output_t *output,
igt_display_commit(display);
- if (flags & TEST_NONBLOCK)
- pipe_crc = igt_pipe_crc_new_nonblock(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
- else
- pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
-
- igt_pipe_crc_start(pipe_crc);
-
/* wait for N_CRCS vblanks and the corresponding N_CRCS CRCs */
if (flags & TEST_NONBLOCK) {
- int i;
+ igt_pipe_crc_t *pipe_crc;
+
+ pipe_crc = igt_pipe_crc_new_nonblock(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
+ igt_wait_for_vblank(data->drm_fd, pipe);
+ igt_pipe_crc_start(pipe_crc);
- for (i = 0; i < N_CRCS; i++)
- igt_wait_for_vblank(data->drm_fd, pipe);
+ igt_wait_for_vblank_count(data->drm_fd, pipe, N_CRCS);
+ n_crcs = igt_pipe_crc_get_crcs(pipe_crc, N_CRCS+1, &crcs);
+ igt_pipe_crc_stop(pipe_crc);
+ igt_pipe_crc_free(pipe_crc);
- n_crcs = igt_pipe_crc_get_crcs(pipe_crc, N_CRCS * 3, &crcs);
/* allow a one frame difference */
- igt_assert_lte(n_crcs, N_CRCS + 1);
- igt_assert_lte(N_CRCS, n_crcs + 1);
+ igt_assert_lte(N_CRCS, n_crcs);
} else {
+ igt_pipe_crc_t *pipe_crc;
+
+ pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
+ igt_pipe_crc_start(pipe_crc);
+
n_crcs = igt_pipe_crc_get_crcs(pipe_crc, N_CRCS, &crcs);
+
+ igt_pipe_crc_stop(pipe_crc);
+ igt_pipe_crc_free(pipe_crc);
+
igt_assert_eq(n_crcs, N_CRCS);
}
- igt_pipe_crc_stop(pipe_crc);
/*
* save the CRC in colors so it can be compared to the CRC of
@@ -168,7 +172,6 @@ test_read_crc_for_output(data_t *data, int pipe, igt_output_t *output,
igt_assert_eq(crcs[j].frame + 1, crcs[j + 1].frame);
free(crcs);
- igt_pipe_crc_free(pipe_crc);
igt_remove_fb(data->drm_fd, &data->fb);
igt_plane_set_fb(primary, NULL);