[igt-dev] [PATCH i-g-t 02/31] i915/perf: Define a default engine for OA

Umesh Nerlige Ramappa umesh.nerlige.ramappa at intel.com
Wed Feb 15 00:46:19 UTC 2023


Use a helper to set the default engine for use with OA.

Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
---
 tests/i915/perf.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tests/i915/perf.c b/tests/i915/perf.c
index c74434fe..15ffb50e 100644
--- a/tests/i915/perf.c
+++ b/tests/i915/perf.c
@@ -228,6 +228,7 @@ static int sysfs = -1;
 static int pm_fd = -1;
 static int stream_fd = -1;
 static uint32_t devid;
+static struct intel_execution_engine2 default_e2;
 
 static uint64_t gt_max_freq_mhz = 0;
 static struct intel_perf *intel_perf = NULL;
@@ -5097,8 +5098,19 @@ static bool has_class_instance(int i915, uint16_t class, uint16_t instance)
 	return false;
 }
 
+static void set_default_engine(const intel_ctx_t *ctx)
+{
+	const struct intel_execution_engine2 *e;
+
+	for_each_ctx_engine(drm_fd, ctx, e)
+		if (e->class == I915_ENGINE_CLASS_RENDER && e->instance == 0)
+			default_e2 = *e;
+}
+
 igt_main
 {
+	const intel_ctx_t *ctx;
+
 	igt_fixture {
 		struct stat sb;
 
@@ -5136,6 +5148,8 @@ igt_main
 
 		igt_require(init_sys_info());
 
+		ctx = intel_ctx_create_all_physical(drm_fd);
+		set_default_engine(ctx);
 		write_u64_file("/proc/sys/dev/i915/perf_stream_paranoid", 1);
 		write_u64_file("/proc/sys/dev/i915/oa_max_sample_rate", 100000);
 
@@ -5323,6 +5337,7 @@ igt_main
 		if (intel_perf)
 			intel_perf_free(intel_perf);
 
+		intel_ctx_destroy(drm_fd, ctx);
 		close(drm_fd);
 	}
 }
-- 
2.36.1



More information about the igt-dev mailing list