[igt-dev] [i-g-t 5/5] lib/igt_kms: Cache xe_device info for kms tests

Bhanuprakash Modem bhanuprakash.modem at intel.com
Tue Mar 14 10:54:52 UTC 2023


Create or get xe_device data from Cache, so that all KMS tests
will utilize.

Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
 lib/igt_kms.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 84091d5ce..d88863a90 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -59,6 +59,7 @@
 #include "igt_device.h"
 #include "igt_sysfs.h"
 #include "sw_sync.h"
+#include "xe/xe_query.h"
 #ifdef HAVE_CHAMELIUM
 #include "igt_chamelium.h"
 #endif
@@ -2541,6 +2542,9 @@ void igt_display_require(igt_display_t *display, int drm_fd)
 	}
 #endif
 
+	if (is_xe_device(drm_fd))
+		xe_device_get(drm_fd);
+
 	/*
 	 * With non-contiguous pipes display, crtc mapping is not always same
 	 * as pipe mapping, In i915 pipe is enum id of i915's crtc object.
@@ -2889,6 +2893,10 @@ static void igt_output_fini(igt_output_t *output)
 void igt_display_fini(igt_display_t *display)
 {
 	int i;
+	int drm_fd = display->drm_fd;
+
+	if (is_xe_device(drm_fd))
+		xe_device_put(drm_fd);
 
 	for (i = 0; i < display->n_planes; ++i) {
 		igt_plane_t *plane = &display->planes[i];
-- 
2.39.1



More information about the igt-dev mailing list