1 /*
2  * SPDX-License-Identifier: MIT
3  *
4  * Copyright © 2018 Intel Corporation
5  */
6 
7 #ifndef __I915_SELFTESTS_IGT_SPINNER_H__
8 #define __I915_SELFTESTS_IGT_SPINNER_H__
9 
10 #include "gem/i915_gem_context.h"
11 #include "gt/intel_engine.h"
12 
13 #include "i915_drv.h"
14 #include "i915_request.h"
15 #include "i915_selftest.h"
16 
17 struct intel_gt;
18 
19 struct igt_spinner {
20 	struct intel_gt *gt;
21 	struct drm_i915_gem_object *hws;
22 	struct drm_i915_gem_object *obj;
23 	struct intel_context *ce;
24 	struct i915_vma *hws_vma, *batch_vma;
25 	u32 *batch;
26 	void *seqno;
27 };
28 
29 int igt_spinner_init(struct igt_spinner *spin, struct intel_gt *gt);
30 int igt_spinner_pin(struct igt_spinner *spin,
31 		    struct intel_context *ce,
32 		    struct i915_gem_ww_ctx *ww);
33 void igt_spinner_fini(struct igt_spinner *spin);
34 
35 struct i915_request *
36 igt_spinner_create_request(struct igt_spinner *spin,
37 			   struct intel_context *ce,
38 			   u32 arbitration_command);
39 void igt_spinner_end(struct igt_spinner *spin);
40 
41 bool igt_wait_for_spinner(struct igt_spinner *spin, struct i915_request *rq);
42 
43 #endif
44