From eb66123f9bf71f3562323f021929dd909e1d4611 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Thu, 5 Jan 2017 14:04:31 +0100 Subject: prime_mmap_kms: Stop looking at output->valid. Use the proper iterator macros to prevent ever having an invalid config. Signed-off-by: Maarten Lankhorst --- tests/prime_mmap_kms.c | 48 ++++++++++++++++++------------------------------ 1 file changed, 18 insertions(+), 30 deletions(-) (limited to 'tests/prime_mmap_kms.c') diff --git a/tests/prime_mmap_kms.c b/tests/prime_mmap_kms.c index 15e310fc..a2f85fa7 100644 --- a/tests/prime_mmap_kms.c +++ b/tests/prime_mmap_kms.c @@ -152,7 +152,7 @@ static void cleanup_crtc(gpu_process_t *gpu) igt_remove_fb(gpu->drm_fd, &gpu->fb); } -static bool prepare_crtc(gpu_process_t *gpu) +static void prepare_crtc(gpu_process_t *gpu) { igt_display_t *display = &gpu->display; igt_output_t *output = gpu->output; @@ -160,13 +160,6 @@ static bool prepare_crtc(gpu_process_t *gpu) /* select the pipe we want to use */ igt_output_set_pipe(output, gpu->pipe); - igt_display_commit(display); - - if (!output->valid) { - igt_output_set_pipe(output, PIPE_ANY); - igt_display_commit(display); - return false; - } mode = igt_output_get_mode(output); @@ -179,8 +172,6 @@ static bool prepare_crtc(gpu_process_t *gpu) igt_plane_set_fb(gpu->primary, &gpu->fb); igt_display_commit(display); - - return true; } /* @@ -197,32 +188,29 @@ static void run_test(gpu_process_t *gpu) enum pipe pipe; int prime_fd; - for_each_connected_output(display, output) { + for_each_pipe_with_valid_output(display, pipe, output) { gpu->output = output; - for_each_pipe(display, pipe) { - gpu->pipe = pipe; + gpu->pipe = pipe; - if (!prepare_crtc(gpu)) - continue; + prepare_crtc(gpu); - prime_fd = prime_handle_to_fd_for_mmap(gpu->drm_fd, - gpu->fb.gem_handle); - igt_skip_on(prime_fd == -1 && errno == EINVAL); + prime_fd = prime_handle_to_fd_for_mmap(gpu->drm_fd, + gpu->fb.gem_handle); + igt_skip_on(prime_fd == -1 && errno == EINVAL); - /* Note that it only shares the dma-buf fd and some - * other basic info */ - igt_fork(renderer_no, 1) { - init_renderer(prime_fd, gpu->fb.size, gpu->fb.width, - gpu->fb.height); - } - igt_waitchildren(); + /* Note that it only shares the dma-buf fd and some + * other basic info */ + igt_fork(renderer_no, 1) { + init_renderer(prime_fd, gpu->fb.size, gpu->fb.width, + gpu->fb.height); + } + igt_waitchildren(); - igt_debug_wait_for_keypress("paint"); - cleanup_crtc(gpu); + igt_debug_wait_for_keypress("paint"); + cleanup_crtc(gpu); - /* once is enough */ - return; - } + /* once is enough */ + return; } igt_skip("no valid crtc/connector combinations found\n"); -- cgit v1.2.3