[PATCH i-g-t 1/2] tests/kms_rmfb: Fix support for xe

Lucas De Marchi lucas.demarchi at intel.com
Thu Sep 19 19:32:49 UTC 2024


Make sure to hold a drm fd open while running the test so we can check
for fb_id == 0 after either removing the fb or closing the previous fd.
With i915 this is guaranteed by holding on to an fd to be used in an
exit handler in drm_open_driver().

Cc: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
Cc: Swati Sharma <swati2.sharma at intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
 tests/kms_rmfb.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/kms_rmfb.c b/tests/kms_rmfb.c
index 0ea689d60..e4203bdd4 100644
--- a/tests/kms_rmfb.c
+++ b/tests/kms_rmfb.c
@@ -206,10 +206,15 @@ igt_main
 				    "it" },
 	};
 	struct rmfb_data data = {};
-	int i;
+	int i, other_fd;
 
 	igt_fixture {
 		data.drm_fd = drm_open_driver_master(DRIVER_ANY);
+		/*
+		 * Prevent fb from changing underneath so we can check by
+		 * fb_id == 0 after removing the fb
+		 */
+		other_fd = drm_reopen_driver(data.drm_fd);
 
 		kmstest_set_vt_graphics_mode();
 
@@ -227,5 +232,6 @@ igt_main
 	igt_fixture {
 		igt_display_fini(&data.display);
 		drm_close_driver(data.drm_fd);
+		drm_close_driver(other_fd);
 	}
 }
-- 
2.46.1



More information about the igt-dev mailing list