From 4d0920216bfbfe96a95c62eb6b04190c72aedeab Mon Sep 17 00:00:00 2001 From: Mika Kahola Date: Wed, 23 May 2018 14:47:37 +0300 Subject: tests: Move wait_for_pageflip as library function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two tests uses the very same wait_for_pageflip() routine. These tests are 'kms_rotation_crc' and 'kms_flip_tiling'. In order to decrease code repetition, let's move this function as part of kms function collection in igt_kms. No functional changes. Signed-off-by: Mika Kahola Reviewed-by: Ville Syrjälä --- tests/kms_rotation_crc.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'tests/kms_rotation_crc.c') diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c index 0cd5c6e5..6cb5858a 100644 --- a/tests/kms_rotation_crc.c +++ b/tests/kms_rotation_crc.c @@ -284,23 +284,6 @@ static void prepare_fbs(data_t *data, igt_output_t *output, igt_plane_set_position(plane, data->pos_x, data->pos_y); } -static void wait_for_pageflip(int fd) -{ - drmEventContext evctx = { .version = 2 }; - struct timeval timeout = { .tv_sec = 0, .tv_usec = 50000 }; - fd_set fds; - int ret; - - /* Wait for pageflip completion, then consume event on fd */ - FD_ZERO(&fds); - FD_SET(fd, &fds); - do { - ret = select(fd + 1, &fds, NULL, NULL, &timeout); - } while (ret < 0 && errno == EINTR); - igt_assert_eq(ret, 1); - igt_assert(drmHandleEvent(fd, &evctx) == 0); -} - static void test_single_case(data_t *data, enum pipe pipe, igt_output_t *output, igt_plane_t *plane, enum rectangle_type rect, @@ -350,7 +333,7 @@ static void test_single_case(data_t *data, enum pipe pipe, NULL); igt_assert_eq(ret, 0); } - wait_for_pageflip(data->gfx_fd); + kmstest_wait_for_pageflip(data->gfx_fd); igt_pipe_crc_drain(data->pipe_crc); igt_pipe_crc_get_single(data->pipe_crc, &crc_output); igt_assert_crc_equal(&data->flip_crc, -- cgit v1.2.3