Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
[linux-2.6-block.git] / drivers / gpu / drm / i915 / i915_active_types.h
CommitLineData
64d6c500
CW
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
12c255b5 10#include <linux/atomic.h>
2850748e 11#include <linux/dma-fence.h>
ce476c80 12#include <linux/llist.h>
12c255b5 13#include <linux/mutex.h>
64d6c500 14#include <linux/rbtree.h>
21950ee7 15#include <linux/rcupdate.h>
274cbf20
CW
16#include <linux/workqueue.h>
17
b1e3177b
CW
18struct i915_active_fence {
19 struct dma_fence __rcu *fence;
20 struct dma_fence_cb cb;
21950ee7 21};
64d6c500 22
12c255b5
CW
23struct active_node;
24
64d6c500 25struct i915_active {
b1e3177b
CW
26 atomic_t count;
27 struct mutex mutex;
64d6c500 28
c9ad602f 29 spinlock_t tree_lock;
12c255b5 30 struct active_node *cache;
64d6c500 31 struct rb_root tree;
64d6c500 32
2850748e 33 /* Preallocated "exclusive" node */
b1e3177b 34 struct i915_active_fence excl;
2850748e 35
79c7a28e 36 unsigned long flags;
274cbf20 37#define I915_ACTIVE_RETIRE_SLEEPS BIT(0)
79c7a28e 38
12c255b5 39 int (*active)(struct i915_active *ref);
64d6c500 40 void (*retire)(struct i915_active *ref);
ce476c80 41
274cbf20
CW
42 struct work_struct work;
43
d8af05ff 44 struct llist_head preallocated_barriers;
64d6c500
CW
45};
46
47#endif /* _I915_ACTIVE_TYPES_H_ */