2 * SPDX-License-Identifier: MIT
4 * Copyright © 2019 Intel Corporation
7 #ifndef _I915_ACTIVE_TYPES_H_
8 #define _I915_ACTIVE_TYPES_H_
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>
18 #include "i915_utils.h"
20 struct i915_active_fence {
21 struct dma_fence __rcu *fence;
22 struct dma_fence_cb cb;
23 #if IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM)
27 * Updates to the i915_active_request must be serialised under a lock
28 * to ensure that the timeline is ordered. Normally, this is the
29 * timeline->mutex, but another mutex may be used so long as it is
30 * done so consistently.
32 * For lockdep tracking of the above, we store the lock we intend
33 * to always use for updates of this i915_active_request during
34 * construction and assert that is held on every update.
42 #define I915_ACTIVE_MAY_SLEEP BIT(0)
44 #define __i915_active_call __aligned(4)
45 #define i915_active_may_sleep(fn) ptr_pack_bits(&(fn), I915_ACTIVE_MAY_SLEEP, 2)
52 struct active_node *cache;
55 /* Preallocated "exclusive" node */
56 struct i915_active_fence excl;
59 #define I915_ACTIVE_RETIRE_SLEEPS BIT(0)
61 int (*active)(struct i915_active *ref);
62 void (*retire)(struct i915_active *ref);
64 struct work_struct work;
66 struct llist_head preallocated_barriers;
69 #endif /* _I915_ACTIVE_TYPES_H_ */