From 3b1a470a1504c06c664c22207f31c6fc751c3a6f Mon Sep 17 00:00:00 2001 From: Mika Kuoppala Date: Wed, 7 May 2014 15:36:54 +0300 Subject: [PATCH] lib/drmtest: don't open exit fds in advance When we open any drm device, we open also filedescriptors for the exit handlers at the same time. Some tests observe object counts across (sub)testcase and the above makes device object counts assymmetric. The fix is not to preallocate at exit file descriptors. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77867 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77875 Signed-off-by: Mika Kuoppala --- lib/drmtest.c | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/lib/drmtest.c b/lib/drmtest.c index bd72e49..fe8ef00 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -258,29 +258,14 @@ static int __drm_open_any_render(void) return fd; } -static int at_exit_drm_fd = -1; -static int at_exit_drm_render_fd = -1; - static void quiescent_gpu_at_exit(int sig) { - if (at_exit_drm_fd < 0) - return; - - check_stop_rings(); - gem_quiescent_gpu(at_exit_drm_fd); - close(at_exit_drm_fd); - at_exit_drm_fd = -1; -} - -static void quiescent_gpu_at_exit_render(int sig) -{ - if (at_exit_drm_render_fd < 0) - return; + int fd; check_stop_rings(); - gem_quiescent_gpu(at_exit_drm_render_fd); - close(at_exit_drm_render_fd); - at_exit_drm_render_fd = -1; + fd = __drm_open_any(); + gem_quiescent_gpu(fd); + close(fd); } /** @@ -302,7 +287,6 @@ int drm_open_any(void) return fd; gem_quiescent_gpu(fd); - at_exit_drm_fd = __drm_open_any(); igt_install_exit_handler(quiescent_gpu_at_exit); return fd; @@ -328,9 +312,8 @@ int drm_open_any_render(void) if (__sync_fetch_and_add(&open_count, 1)) return fd; - at_exit_drm_render_fd = __drm_open_any(); gem_quiescent_gpu(fd); - igt_install_exit_handler(quiescent_gpu_at_exit_render); + igt_install_exit_handler(quiescent_gpu_at_exit); return fd; } -- 1.7.9.5