From 1f0cf2df85ca3f9d900b21db9c8744a99e8f60a0 Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Thu, 31 Oct 2013 17:02:41 +0100 Subject: [PATCH] lib: make igt_set_vt_graphics_mode never fail All tests agree that this is a letal failure, so no point to pass it back to callers. Also add some igt_require calls for the drm_fd where I've noticed that it's missing. Signed-off-by: Daniel Vetter --- lib/drmtest.c | 7 +++---- lib/drmtest.h | 2 +- tests/debugfs_pipe_crc.c | 4 +++- tests/kms_cursor_crc.c | 4 +++- tests/kms_flip.c | 2 +- tests/kms_render.c | 2 +- tests/kms_setmode.c | 2 +- tests/pc8.c | 2 +- tests/testdisplay.c | 2 +- 9 files changed, 15 insertions(+), 12 deletions(-) diff --git a/lib/drmtest.c b/lib/drmtest.c index f76ef0f..50b5aac 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -2111,10 +2111,9 @@ static void restore_vt_mode_at_exit(int sig) * original mode. */ -int igt_set_vt_graphics_mode(void) +void igt_set_vt_graphics_mode(void) { - if (igt_install_exit_handler(restore_vt_mode_at_exit)) - return -1; + do_or_die(igt_install_exit_handler(restore_vt_mode_at_exit)); igt_disable_exit_handler(); orig_vt_mode = set_vt_mode(KD_GRAPHICS); @@ -2122,7 +2121,7 @@ int igt_set_vt_graphics_mode(void) orig_vt_mode = -1UL; igt_enable_exit_handler(); - return orig_vt_mode < 0 ? -1 : 0; + igt_assert(orig_vt_mode >= 0); } int kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector, diff --git a/lib/drmtest.h b/lib/drmtest.h index f5e2708..6e8b16b 100644 --- a/lib/drmtest.h +++ b/lib/drmtest.h @@ -394,7 +394,7 @@ void igt_enable_exit_handler(void); void igt_disable_exit_handler(void); /* set vt into graphics mode, required to prevent fbcon from interfering */ -int igt_set_vt_graphics_mode(void); +void igt_set_vt_graphics_mode(void); /* prefault disabling, needs the corresponding debugfs interface */ void igt_disable_prefault(void); diff --git a/tests/debugfs_pipe_crc.c b/tests/debugfs_pipe_crc.c index 01cd8b5..debc172 100644 --- a/tests/debugfs_pipe_crc.c +++ b/tests/debugfs_pipe_crc.c @@ -220,7 +220,9 @@ int main(int argc, char **argv) const char *cmd = "pipe A none"; data.drm_fd = drm_open_any(); - do_or_die(igt_set_vt_graphics_mode()); + igt_require(data.drm_fd >= 0); + + igt_set_vt_graphics_mode(); display_init(&data); diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c index c82d3e7..359825c 100644 --- a/tests/kms_cursor_crc.c +++ b/tests/kms_cursor_crc.c @@ -334,7 +334,9 @@ int main(int argc, char **argv) const char *cmd = "pipe A none"; data.drm_fd = drm_open_any(); - do_or_die(igt_set_vt_graphics_mode()); + igt_require(data.drm_fd >= 0); + + igt_set_vt_graphics_mode(); igt_debugfs_init(&data.debugfs); data.ctl = igt_debugfs_fopen(&data.debugfs, diff --git a/tests/kms_flip.c b/tests/kms_flip.c index 58185ef..e8d3e22 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -1493,7 +1493,7 @@ int main(int argc, char **argv) igt_fixture { drm_fd = drm_open_any(); - do_or_die(igt_set_vt_graphics_mode()); + igt_set_vt_graphics_mode(); do_or_die(igt_install_exit_handler(kms_flip_exit_handler)); get_timestamp_format(); diff --git a/tests/kms_render.c b/tests/kms_render.c index 6a41055..26ca8dc 100644 --- a/tests/kms_render.c +++ b/tests/kms_render.c @@ -242,7 +242,7 @@ int main(int argc, char **argv) devid = intel_get_drm_devid(drm_fd); batch = intel_batchbuffer_alloc(bufmgr, devid); - do_or_die(igt_set_vt_graphics_mode()); + igt_set_vt_graphics_mode(); } for (i = 0; i < ARRAY_SIZE(tests); i++) { diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c index 7b22225..6bc7db1 100644 --- a/tests/kms_setmode.c +++ b/tests/kms_setmode.c @@ -702,7 +702,7 @@ int main(int argc, char **argv) igt_fixture { drm_fd = drm_open_any(); if (!dry_run) - do_or_die(igt_set_vt_graphics_mode()); + igt_set_vt_graphics_mode(); drm_resources = drmModeGetResources(drm_fd); assert(drm_resources); diff --git a/tests/pc8.c b/tests/pc8.c index e3d6e33..0ec011e 100644 --- a/tests/pc8.c +++ b/tests/pc8.c @@ -292,7 +292,7 @@ static void init_mode_set_data(struct mode_set_data *data) data->bufmgr = drm_intel_bufmgr_gem_init(drm_fd, 4096); data->devid = intel_get_drm_devid(drm_fd); - do_or_die(igt_set_vt_graphics_mode()); + igt_set_vt_graphics_mode(); drm_intel_bufmgr_gem_enable_reuse(data->bufmgr); } diff --git a/tests/testdisplay.c b/tests/testdisplay.c index a0f43e9..fd172f3 100644 --- a/tests/testdisplay.c +++ b/tests/testdisplay.c @@ -801,7 +801,7 @@ int main(int argc, char **argv) goto out_close; } - do_or_die(igt_set_vt_graphics_mode()); + igt_set_vt_graphics_mode(); mainloop = g_main_loop_new(NULL, FALSE); if (!mainloop) { -- 2.7.4