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 #include "i915_utils.h" 19 20 struct i915_active_fence { 21 struct dma_fence __rcu *fence; 22 struct dma_fence_cb cb; 23 }; 24 25 struct active_node; 26 27 struct i915_active { 28 atomic_t count; 29 struct mutex mutex; 30 31 spinlock_t tree_lock; 32 struct active_node *cache; 33 struct rb_root tree; 34 35 /* Preallocated "exclusive" node */ 36 struct i915_active_fence excl; 37 38 unsigned long flags; 39 #define I915_ACTIVE_RETIRE_SLEEPS BIT(0) 40 41 int (*active)(struct i915_active *ref); 42 void (*retire)(struct i915_active *ref); 43 44 struct work_struct work; 45 46 struct llist_head preallocated_barriers; 47 }; 48 49 #endif /* _I915_ACTIVE_TYPES_H_ */ 50