[igt-dev] [PATCH 23/30] i915/perf: Run non-zero-reason on media engines as well

Umesh Nerlige Ramappa umesh.nerlige.ramappa at intel.com
Tue Feb 14 21:00:00 UTC 2023


Enable non-zero-reason test to run on media engines as well.

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

diff --git a/tests/i915/perf.c b/tests/i915/perf.c
index 02835602..5b536034 100644
--- a/tests/i915/perf.c
+++ b/tests/i915/perf.c
@@ -2906,18 +2906,23 @@ test_buffer_fill(const struct intel_execution_engine2 *e)
 }
 
 static void
-test_non_zero_reason(void)
+test_non_zero_reason(const struct intel_execution_engine2 *e)
 {
 	/* ~20 micro second period */
 	int oa_exponent = max_oa_exponent_for_period_lte(20000);
+	struct intel_perf_metric_set *test_set = metric_set(e);
+	uint64_t fmt = test_set->perf_oa_format;
+	size_t report_size = get_oa_format(fmt).size;
 	uint64_t properties[] = {
 		/* Include OA reports in samples */
 		DRM_I915_PERF_PROP_SAMPLE_OA, true,
 
 		/* OA unit configuration */
-		DRM_I915_PERF_PROP_OA_METRICS_SET, default_test_set->perf_oa_metrics_set,
-		DRM_I915_PERF_PROP_OA_FORMAT, default_test_set->perf_oa_format,
+		DRM_I915_PERF_PROP_OA_METRICS_SET, test_set->perf_oa_metrics_set,
+		DRM_I915_PERF_PROP_OA_FORMAT, fmt,
 		DRM_I915_PERF_PROP_OA_EXPONENT, oa_exponent,
+		DRM_I915_PERF_PROP_OA_ENGINE_CLASS, e->class,
+		DRM_I915_PERF_PROP_OA_ENGINE_INSTANCE, e->instance,
 	};
 	struct drm_i915_perf_open_param param = {
 		.flags = I915_PERF_FLAG_FD_CLOEXEC,
@@ -2925,7 +2930,7 @@ test_non_zero_reason(void)
 		.properties_ptr = to_user_pointer(properties),
 	};
 	struct drm_i915_perf_record_header *header;
-	uint32_t buf_size = 3 * 65536 * (256 + sizeof(struct drm_i915_perf_record_header));
+	uint32_t buf_size = 3 * 65536 * (report_size + sizeof(struct drm_i915_perf_record_header));
 	uint8_t *buf = malloc(buf_size);
 	uint32_t total_len = 0, reports_lost;
 	const uint32_t *last_report;
@@ -2970,10 +2975,9 @@ test_non_zero_reason(void)
 
 			igt_assert_neq(reason, 0);
 
-			if (last_report) {
-				sanity_check_reports(last_report, report,
-						     default_test_set->perf_oa_format);
-			}
+			if (last_report)
+				sanity_check_reports(last_report, report, fmt);
+
 			last_report = report;
 			break;
 		}
@@ -5795,10 +5799,11 @@ igt_main
 			test_buffer_fill(e);
 
 	igt_describe("Test that reason field in OA reports is never 0 on Gen8+");
-	igt_subtest("non-zero-reason") {
+	igt_subtest_with_dynamic("non-zero-reason") {
 		/* Reason field is only available on Gen8+ */
 		igt_require(intel_gen(devid) >= 8);
-		test_non_zero_reason();
+		__for_random_engine_in_each_group(perf_oa_groups, ctx, e)
+			test_non_zero_reason(e);
 	}
 
 	igt_subtest("disabled-read-error")
-- 
2.36.1



More information about the igt-dev mailing list