[igt-dev] [PATCH i-g-t v1 3/5] tests/i915/kms_pwrite_crc.c: cleanup

Kunal Joshi kunal1.joshi at intel.com
Mon Sep 26 18:53:19 UTC 2022


-> Sanitize the state before starting the subtest
-> Kept all the test requirements in igt_fixture
-> clean state with igt_display_fini before exit
-> close drm_fd

Cc: Nidhi Gupta <nidhi1.gupta at intel.com>
Signed-off-by: Kunal Joshi <kunal1.joshi at intel.com>
---
 tests/i915/kms_pwrite_crc.c | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/tests/i915/kms_pwrite_crc.c b/tests/i915/kms_pwrite_crc.c
index 584e6a19..b116bd62 100644
--- a/tests/i915/kms_pwrite_crc.c
+++ b/tests/i915/kms_pwrite_crc.c
@@ -160,6 +160,13 @@ static void run_test(data_t *data)
 	enum pipe pipe;
 
 	for_each_pipe_with_valid_output(display, pipe, output) {
+
+		/*
+		 * Reset basic pipes, connectors and planes on
+		 * @display back to default values.
+		 */
+		igt_display_reset(&data->display);
+
 		data->output = output;
 		data->pipe = pipe;
 
@@ -178,17 +185,18 @@ static data_t data;
 
 igt_simple_main
 {
-	data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
-
-	data.devid = intel_get_drm_devid(data.drm_fd);
-
-	kmstest_set_vt_graphics_mode();
-
-	igt_require_pipe_crc(data.drm_fd);
-
-	igt_display_require(&data.display, data.drm_fd);
+	igt_fixture {
+		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		data.devid = intel_get_drm_devid(data.drm_fd);
+		kmstest_set_vt_graphics_mode();
+		igt_require_pipe_crc(data.drm_fd);
+		igt_display_require(&data.display, data.drm_fd);
+	}
 
 	run_test(&data);
 
-	igt_display_fini(&data.display);
+	igt_fixture {
+		igt_display_fini(&data.display);
+		close(data.drm_fd);
+	}
 }
-- 
2.25.1



More information about the igt-dev mailing list