xref: /linux/drivers/gpu/drm/i915/gem/selftests/igt_gem_utils.h (revision 6599e683db1bf22fee74302c47e31b9a42a1c3d2)
1 /*
2  * SPDX-License-Identifier: MIT
3  *
4  * Copyright © 2018 Intel Corporation
5  */
6 
7 #ifndef __IGT_GEM_UTILS_H__
8 #define __IGT_GEM_UTILS_H__
9 
10 #include <linux/types.h>
11 
12 #include "i915_vma.h"
13 
14 struct i915_request;
15 struct i915_gem_context;
16 struct i915_vma;
17 
18 struct intel_context;
19 struct intel_engine_cs;
20 
21 struct i915_request *
22 igt_request_alloc(struct i915_gem_context *ctx, struct intel_engine_cs *engine);
23 
24 struct i915_vma *
25 igt_emit_store_dw(struct i915_vma *vma,
26 		  u64 offset,
27 		  unsigned long count,
28 		  u32 val);
29 
30 int igt_gpu_fill_dw(struct intel_context *ce,
31 		    struct i915_vma *vma, u64 offset,
32 		    unsigned long count, u32 val);
33 
34 static inline int __must_check
35 igt_vma_move_to_active_unlocked(struct i915_vma *vma, struct i915_request *rq,
36 				unsigned int flags)
37 {
38 	int err;
39 
40 	i915_vma_lock(vma);
41 	err = _i915_vma_move_to_active(vma, rq, &rq->fence, flags);
42 	i915_vma_unlock(vma);
43 	return err;
44 }
45 
46 #endif /* __IGT_GEM_UTILS_H__ */
47