xref: /linux/drivers/gpu/drm/i915/i915_active_types.h (revision 0be3ff0c)
1 /*
2  * SPDX-License-Identifier: MIT
3  *
4  * Copyright © 2019 Intel Corporation
5  */
6 
7 #ifndef _I915_ACTIVE_TYPES_H_
8 #define _I915_ACTIVE_TYPES_H_
9 
10 #include <linux/atomic.h>
11 #include <linux/dma-fence.h>
12 #include <linux/llist.h>
13 #include <linux/mutex.h>
14 #include <linux/rbtree.h>
15 #include <linux/rcupdate.h>
16 #include <linux/workqueue.h>
17 
18 struct i915_active_fence {
19 	struct dma_fence __rcu *fence;
20 	struct dma_fence_cb cb;
21 };
22 
23 struct active_node;
24 
25 struct i915_active {
26 	atomic_t count;
27 	struct mutex mutex;
28 
29 	spinlock_t tree_lock;
30 	struct active_node *cache;
31 	struct rb_root tree;
32 
33 	/* Preallocated "exclusive" node */
34 	struct i915_active_fence excl;
35 
36 	unsigned long flags;
37 #define I915_ACTIVE_RETIRE_SLEEPS BIT(0)
38 
39 	int (*active)(struct i915_active *ref);
40 	void (*retire)(struct i915_active *ref);
41 
42 	struct work_struct work;
43 
44 	struct llist_head preallocated_barriers;
45 };
46 
47 #endif /* _I915_ACTIVE_TYPES_H_ */
48