forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/gpu/drm/i915/i915_sw_fence.h
....@@ -1,29 +1,28 @@
11 /*
2
+ * SPDX-License-Identifier: MIT
3
+ *
24 * i915_sw_fence.h - library routines for N:M synchronisation points
35 *
46 * Copyright (C) 2016 Intel Corporation
5
- *
6
- * This file is released under the GPLv2.
7
- *
87 */
98
109 #ifndef _I915_SW_FENCE_H_
1110 #define _I915_SW_FENCE_H_
1211
12
+#include <linux/dma-fence.h>
1313 #include <linux/gfp.h>
1414 #include <linux/kref.h>
1515 #include <linux/notifier.h> /* for NOTIFY_DONE */
1616 #include <linux/wait.h>
1717
1818 struct completion;
19
-struct dma_fence;
20
-struct dma_fence_ops;
21
-struct reservation_object;
19
+struct dma_resv;
2220
2321 struct i915_sw_fence {
2422 wait_queue_head_t wait;
2523 unsigned long flags;
2624 atomic_t pending;
25
+ int error;
2726 };
2827
2928 #define I915_SW_FENCE_CHECKED_BIT 0 /* used internally for DAG checking */
....@@ -55,6 +54,8 @@
5554 __i915_sw_fence_init((fence), (fn), NULL, NULL)
5655 #endif
5756
57
+void i915_sw_fence_reinit(struct i915_sw_fence *fence);
58
+
5859 #ifdef CONFIG_DRM_I915_SW_FENCE_DEBUG_OBJECTS
5960 void i915_sw_fence_fini(struct i915_sw_fence *fence);
6061 #else
....@@ -69,16 +70,29 @@
6970 int i915_sw_fence_await_sw_fence_gfp(struct i915_sw_fence *fence,
7071 struct i915_sw_fence *after,
7172 gfp_t gfp);
73
+
74
+struct i915_sw_dma_fence_cb {
75
+ struct dma_fence_cb base;
76
+ struct i915_sw_fence *fence;
77
+};
78
+
79
+int __i915_sw_fence_await_dma_fence(struct i915_sw_fence *fence,
80
+ struct dma_fence *dma,
81
+ struct i915_sw_dma_fence_cb *cb);
7282 int i915_sw_fence_await_dma_fence(struct i915_sw_fence *fence,
7383 struct dma_fence *dma,
7484 unsigned long timeout,
7585 gfp_t gfp);
86
+
7687 int i915_sw_fence_await_reservation(struct i915_sw_fence *fence,
77
- struct reservation_object *resv,
88
+ struct dma_resv *resv,
7889 const struct dma_fence_ops *exclude,
7990 bool write,
8091 unsigned long timeout,
8192 gfp_t gfp);
93
+
94
+bool i915_sw_fence_await(struct i915_sw_fence *fence);
95
+void i915_sw_fence_complete(struct i915_sw_fence *fence);
8296
8397 static inline bool i915_sw_fence_signaled(const struct i915_sw_fence *fence)
8498 {
....@@ -95,4 +109,11 @@
95109 wait_event(fence->wait, i915_sw_fence_done(fence));
96110 }
97111
112
+static inline void
113
+i915_sw_fence_set_error_once(struct i915_sw_fence *fence, int error)
114
+{
115
+ if (unlikely(error))
116
+ cmpxchg(&fence->error, 0, error);
117
+}
118
+
98119 #endif /* _I915_SW_FENCE_H_ */