diff options
author | José Roberto de Souza <jose.souza@intel.com> | 2019-03-27 12:54:11 -0700 |
---|---|---|
committer | José Roberto de Souza <jose.souza@intel.com> | 2019-04-15 12:52:17 -0700 |
commit | cf27a37b867bf31dccbe5f1b3bd84a2e606544f0 (patch) | |
tree | 99d15f4425f6405a7bcdd3e4aec5260cbc9f7a5c /tests/kms_fbcon_fbt.c | |
parent | e03b53c67389a0f6896f468f038522ec32c191bc (diff) |
tests/fbcon_fbt: Do not keep opening debugfs_fd at every setup_drm() call
As debugfs_fd is used even after the teardown_drm(), it is not closed
in this function or in any other place. And then it gets worse as
every call to setup_drm() will open another file descriptor to
debugfs dir.
So lets move the opening of debugfs_fd to setup_environment() and only
open it once and close it before leave the test.
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Diffstat (limited to 'tests/kms_fbcon_fbt.c')
-rw-r--r-- | tests/kms_fbcon_fbt.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/kms_fbcon_fbt.c b/tests/kms_fbcon_fbt.c index 4a149104..acbb6d30 100644 --- a/tests/kms_fbcon_fbt.c +++ b/tests/kms_fbcon_fbt.c @@ -64,7 +64,6 @@ static void setup_drm(struct drm_info *drm) return; drm->fd = drm_open_driver_master(DRIVER_INTEL); - drm->debugfs_fd = igt_debugfs_dir(drm->fd); drm->res = drmModeGetResources(drm->fd); igt_require(drm->res); @@ -299,12 +298,14 @@ static void subtest(struct drm_info *drm, struct feature *feature, bool suspend) } } -static void setup_environment(void) +static void setup_environment(struct drm_info *drm) { int drm_fd; drm_fd = drm_open_driver_master(DRIVER_INTEL); igt_require(drm_fd >= 0); + drm->debugfs_fd = igt_debugfs_dir(drm_fd); + igt_require(drm->debugfs_fd >= 0); igt_assert(close(drm_fd) == 0); /* @@ -319,6 +320,8 @@ static void teardown_environment(struct drm_info *drm) { if (drm->fd >= 0) teardown_drm(drm); + + close(drm->debugfs_fd); } igt_main @@ -326,7 +329,7 @@ igt_main struct drm_info drm = { .fd = -1 }; igt_fixture - setup_environment(); + setup_environment(&drm); igt_subtest("fbc") subtest(&drm, &fbc, false); |