Merge drm/drm-next into drm-intel-next-queued
[sfrench/cifs-2.6.git] / drivers / gpu / drm / i915 / i915_active_types.h
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/llist.h>
12 #include <linux/mutex.h>
13 #include <linux/rbtree.h>
14 #include <linux/rcupdate.h>
15
16 struct drm_i915_private;
17 struct i915_active_request;
18 struct i915_request;
19
20 typedef void (*i915_active_retire_fn)(struct i915_active_request *,
21                                       struct i915_request *);
22
23 struct i915_active_request {
24         struct i915_request __rcu *request;
25         struct list_head link;
26         i915_active_retire_fn retire;
27 };
28
29 struct active_node;
30
31 struct i915_active {
32         struct drm_i915_private *i915;
33
34         struct active_node *cache;
35         struct rb_root tree;
36         struct mutex mutex;
37         atomic_t count;
38
39         int (*active)(struct i915_active *ref);
40         void (*retire)(struct i915_active *ref);
41
42         struct llist_head barriers;
43 };
44
45 #endif /* _I915_ACTIVE_TYPES_H_ */