xref: /linux/drivers/gpu/drm/i915/selftests/igt_live_test.h (revision 41c177cf354126a22443b5c80cec9fdd313e67e1)
1e4a8c813SChris Wilson /*
2e4a8c813SChris Wilson  * SPDX-License-Identifier: MIT
3e4a8c813SChris Wilson  *
4e4a8c813SChris Wilson  * Copyright © 2019 Intel Corporation
5e4a8c813SChris Wilson  */
6e4a8c813SChris Wilson 
7e4a8c813SChris Wilson #ifndef IGT_LIVE_TEST_H
8e4a8c813SChris Wilson #define IGT_LIVE_TEST_H
9e4a8c813SChris Wilson 
10*7c7c863bSTvrtko Ursulin #include "gt/intel_gt_defines.h" /* for I915_MAX_GT */
11b2fcaac9SChris Wilson #include "gt/intel_engine.h" /* for I915_NUM_ENGINES */
12e4a8c813SChris Wilson 
13e4a8c813SChris Wilson struct drm_i915_private;
14e4a8c813SChris Wilson 
15e4a8c813SChris Wilson struct igt_live_test {
16e4a8c813SChris Wilson 	struct drm_i915_private *i915;
17e4a8c813SChris Wilson 	const char *func;
18e4a8c813SChris Wilson 	const char *name;
19e4a8c813SChris Wilson 
20e4a8c813SChris Wilson 	unsigned int reset_global;
21*7c7c863bSTvrtko Ursulin 	unsigned int reset_engine[I915_MAX_GT][I915_NUM_ENGINES];
22e4a8c813SChris Wilson };
23e4a8c813SChris Wilson 
24e4a8c813SChris Wilson /*
25e4a8c813SChris Wilson  * Flush the GPU state before and after the test to ensure that no residual
26e4a8c813SChris Wilson  * code is running on the GPU that may affect this test. Also compare the
27e4a8c813SChris Wilson  * state before and after the test and alert if it unexpectedly changes,
28e4a8c813SChris Wilson  * e.g. if the GPU was reset.
29e4a8c813SChris Wilson  */
30e4a8c813SChris Wilson int igt_live_test_begin(struct igt_live_test *t,
31e4a8c813SChris Wilson 			struct drm_i915_private *i915,
32e4a8c813SChris Wilson 			const char *func,
33e4a8c813SChris Wilson 			const char *name);
34e4a8c813SChris Wilson int igt_live_test_end(struct igt_live_test *t);
35e4a8c813SChris Wilson 
36e4a8c813SChris Wilson #endif /* IGT_LIVE_TEST_H */
37