a3a44534003f78e02751e70d6f2a825cf5dfb47b
[linux-2.6-microblaze.git] / drivers / gpu / drm / xe / xe_engine.h
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2021 Intel Corporation
4  */
5
6 #ifndef _XE_ENGINE_H_
7 #define _XE_ENGINE_H_
8
9 #include "xe_engine_types.h"
10 #include "xe_vm_types.h"
11
12 struct drm_device;
13 struct drm_file;
14 struct xe_device;
15 struct xe_file;
16
17 struct xe_engine *xe_engine_create(struct xe_device *xe, struct xe_vm *vm,
18                                    u32 logical_mask, u16 width,
19                                    struct xe_hw_engine *hw_engine, u32 flags);
20 struct xe_engine *xe_engine_create_class(struct xe_device *xe, struct xe_gt *gt,
21                                          struct xe_vm *vm,
22                                          enum xe_engine_class class, u32 flags);
23
24 void xe_engine_fini(struct xe_engine *e);
25 void xe_engine_destroy(struct kref *ref);
26
27 struct xe_engine *xe_engine_lookup(struct xe_file *xef, u32 id);
28
29 static inline struct xe_engine *xe_engine_get(struct xe_engine *engine)
30 {
31         kref_get(&engine->refcount);
32         return engine;
33 }
34
35 static inline void xe_engine_put(struct xe_engine *engine)
36 {
37         kref_put(&engine->refcount, xe_engine_destroy);
38 }
39
40 static inline bool xe_engine_is_parallel(struct xe_engine *engine)
41 {
42         return engine->width > 1;
43 }
44
45 void xe_engine_kill(struct xe_engine *e);
46
47 int xe_engine_create_ioctl(struct drm_device *dev, void *data,
48                            struct drm_file *file);
49 int xe_engine_destroy_ioctl(struct drm_device *dev, void *data,
50                             struct drm_file *file);
51 int xe_engine_set_property_ioctl(struct drm_device *dev, void *data,
52                                  struct drm_file *file);
53 int xe_engine_get_property_ioctl(struct drm_device *dev, void *data,
54                                  struct drm_file *file);
55
56 #endif