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
igt_vma_move_to_active_unlocked(struct i915_vma * vma,struct i915_request * rq,unsigned int flags)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, flags);
42 i915_vma_unlock(vma);
43 return err;
44 }
45
46 #endif /* __IGT_GEM_UTILS_H__ */
47