Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm2/linux Rename fence -> dma_fence, step ...
details: https://anonhg.NetBSD.org/src/rev/8a79cc34af46
branches: trunk
changeset: 1027769:8a79cc34af46
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 00:27:17 2021 +0000
description:
Rename fence -> dma_fence, step 3 of 3: code.
diffstat:
sys/external/bsd/drm2/include/linux/dma-fence.h | 149 +++++++-------
sys/external/bsd/drm2/linux/linux_dma_fence.c | 236 ++++++++++++-----------
2 files changed, 195 insertions(+), 190 deletions(-)
diffs (truncated from 863 to 300 lines):
diff -r d1fe60ef2ea4 -r 8a79cc34af46 sys/external/bsd/drm2/include/linux/dma-fence.h
--- a/sys/external/bsd/drm2/include/linux/dma-fence.h Sun Dec 19 00:27:09 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/dma-fence.h Sun Dec 19 00:27:17 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dma-fence.h,v 1.1 2021/12/19 00:27:01 riastradh Exp $ */
+/* $NetBSD: dma-fence.h,v 1.2 2021/12/19 00:27:17 riastradh Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -29,8 +29,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef _LINUX_FENCE_H_
-#define _LINUX_FENCE_H_
+#ifndef _LINUX_DMA_FENCE_H_
+#define _LINUX_DMA_FENCE_H_
#include <sys/types.h>
#include <sys/condvar.h>
@@ -41,98 +41,99 @@
#include <linux/rcupdate.h>
#include <linux/spinlock.h>
-struct fence_cb;
+struct dma_fence_cb;
-struct fence {
- struct kref refcount;
- spinlock_t *lock;
- volatile unsigned long flags;
- unsigned context;
- unsigned seqno;
- const struct fence_ops *ops;
+struct dma_fence {
+ struct kref refcount;
+ spinlock_t *lock;
+ volatile unsigned long flags;
+ unsigned context;
+ unsigned seqno;
+ const struct dma_fence_ops *ops;
- TAILQ_HEAD(, fence_cb) f_callbacks;
- kcondvar_t f_cv;
- struct rcu_head f_rcu;
+ TAILQ_HEAD(, dma_fence_cb) f_callbacks;
+ kcondvar_t f_cv;
+ struct rcu_head f_rcu;
};
-#define FENCE_FLAG_ENABLE_SIGNAL_BIT 0
-#define FENCE_FLAG_SIGNALED_BIT 1
-#define FENCE_FLAG_USER_BITS 2
+#define DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT 0
+#define DMA_FENCE_FLAG_SIGNALED_BIT 1
+#define DMA_FENCE_FLAG_USER_BITS 2
-struct fence_ops {
- const char *(*get_driver_name)(struct fence *);
- const char *(*get_timeline_name)(struct fence *);
- bool (*enable_signaling)(struct fence *);
- bool (*signaled)(struct fence *);
- long (*wait)(struct fence *, bool, long);
- void (*release)(struct fence *);
+struct dma_fence_ops {
+ const char *(*get_driver_name)(struct dma_fence *);
+ const char *(*get_timeline_name)(struct dma_fence *);
+ bool (*enable_signaling)(struct dma_fence *);
+ bool (*signaled)(struct dma_fence *);
+ long (*wait)(struct dma_fence *, bool, long);
+ void (*release)(struct dma_fence *);
};
-typedef void (*fence_func_t)(struct fence *, struct fence_cb *);
+typedef void (*dma_fence_func_t)(struct dma_fence *, struct dma_fence_cb *);
-struct fence_cb {
- fence_func_t fcb_func;
- TAILQ_ENTRY(fence_cb) fcb_entry;
- bool fcb_onqueue;
+struct dma_fence_cb {
+ dma_fence_func_t fcb_func;
+ TAILQ_ENTRY(dma_fence_cb) fcb_entry;
+ bool fcb_onqueue;
};
-#define fence_add_callback linux_fence_add_callback
-#define fence_context_alloc linux_fence_context_alloc
-#define fence_default_wait linux_fence_default_wait
-#define fence_destroy linux_fence_destroy
-#define fence_enable_sw_signaling linux_fence_enable_sw_signaling
-#define fence_free linux_fence_free
-#define fence_get linux_fence_get
-#define fence_get_rcu linux_fence_get_rcu
-#define fence_init linux_fence_init
-#define fence_is_later linux_fence_is_later
-#define fence_is_signaled linux_fence_is_signaled
-#define fence_is_signaled_locked linux_fence_is_signaled_locked
-#define fence_put linux_fence_put
-#define fence_remove_callback linux_fence_remove_callback
-#define fence_signal linux_fence_signal
-#define fence_signal_locked linux_fence_signal_locked
-#define fence_wait linux_fence_wait
-#define fence_wait_any_timeout linux_fence_wait_any_timeout
-#define fence_wait_timeout linux_fence_wait_timeout
+#define dma_fence_add_callback linux_dma_fence_add_callback
+#define dma_fence_context_alloc linux_dma_fence_context_alloc
+#define dma_fence_default_wait linux_dma_fence_default_wait
+#define dma_fence_destroy linux_dma_fence_destroy
+#define dma_fence_enable_sw_signaling linux_dma_fence_enable_sw_signaling
+#define dma_fence_free linux_dma_fence_free
+#define dma_fence_get linux_dma_fence_get
+#define dma_fence_get_rcu linux_dma_fence_get_rcu
+#define dma_fence_init linux_dma_fence_init
+#define dma_fence_is_later linux_dma_fence_is_later
+#define dma_fence_is_signaled linux_dma_fence_is_signaled
+#define dma_fence_is_signaled_locked linux_dma_fence_is_signaled_locked
+#define dma_fence_put linux_dma_fence_put
+#define dma_fence_remove_callback linux_dma_fence_remove_callback
+#define dma_fence_signal linux_dma_fence_signal
+#define dma_fence_signal_locked linux_dma_fence_signal_locked
+#define dma_fence_wait linux_dma_fence_wait
+#define dma_fence_wait_any_timeout linux_dma_fence_wait_any_timeout
+#define dma_fence_wait_timeout linux_dma_fence_wait_timeout
-extern int linux_fence_trace;
+extern int linux_dma_fence_trace;
-void fence_init(struct fence *, const struct fence_ops *, spinlock_t *,
- unsigned, unsigned);
-void fence_destroy(struct fence *);
-void fence_free(struct fence *);
+void dma_fence_init(struct dma_fence *, const struct dma_fence_ops *,
+ spinlock_t *, unsigned, unsigned);
+void dma_fence_destroy(struct dma_fence *);
+void dma_fence_free(struct dma_fence *);
unsigned
- fence_context_alloc(unsigned);
-bool fence_is_later(struct fence *, struct fence *);
+ dma_fence_context_alloc(unsigned);
+bool dma_fence_is_later(struct dma_fence *, struct dma_fence *);
-struct fence *
- fence_get(struct fence *);
-struct fence *
- fence_get_rcu(struct fence *);
-void fence_put(struct fence *);
+struct dma_fence *
+ dma_fence_get(struct dma_fence *);
+struct dma_fence *
+ dma_fence_get_rcu(struct dma_fence *);
+void dma_fence_put(struct dma_fence *);
-int fence_add_callback(struct fence *, struct fence_cb *, fence_func_t);
-bool fence_remove_callback(struct fence *, struct fence_cb *);
-void fence_enable_sw_signaling(struct fence *);
+int dma_fence_add_callback(struct dma_fence *, struct dma_fence_cb *,
+ dma_fence_func_t);
+bool dma_fence_remove_callback(struct dma_fence *, struct dma_fence_cb *);
+void dma_fence_enable_sw_signaling(struct dma_fence *);
-bool fence_is_signaled(struct fence *);
-bool fence_is_signaled_locked(struct fence *);
-int fence_signal(struct fence *);
-int fence_signal_locked(struct fence *);
-long fence_default_wait(struct fence *, bool, long);
-long fence_wait(struct fence *, bool);
-long fence_wait_any_timeout(struct fence **, uint32_t, bool, long);
-long fence_wait_timeout(struct fence *, bool, long);
+bool dma_fence_is_signaled(struct dma_fence *);
+bool dma_fence_is_signaled_locked(struct dma_fence *);
+int dma_fence_signal(struct dma_fence *);
+int dma_fence_signal_locked(struct dma_fence *);
+long dma_fence_default_wait(struct dma_fence *, bool, long);
+long dma_fence_wait(struct dma_fence *, bool);
+long dma_fence_wait_any_timeout(struct dma_fence **, uint32_t, bool, long);
+long dma_fence_wait_timeout(struct dma_fence *, bool, long);
static inline void __printflike(2, 3)
-FENCE_TRACE(struct fence *f, const char *fmt, ...)
+DMA_FENCE_TRACE(struct dma_fence *f, const char *fmt, ...)
{
va_list va;
- if (__predict_false(linux_fence_trace)) {
+ if (__predict_false(linux_dma_fence_trace)) {
va_start(va, fmt);
printf("fence %u@%u: ", f->context, f->seqno);
vprintf(fmt, va);
@@ -140,4 +141,4 @@
}
}
-#endif /* _LINUX_FENCE_H_ */
+#endif /* _LINUX_DMA_FENCE_H_ */
diff -r d1fe60ef2ea4 -r 8a79cc34af46 sys/external/bsd/drm2/linux/linux_dma_fence.c
--- a/sys/external/bsd/drm2/linux/linux_dma_fence.c Sun Dec 19 00:27:09 2021 +0000
+++ b/sys/external/bsd/drm2/linux/linux_dma_fence.c Sun Dec 19 00:27:17 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_dma_fence.c,v 1.1 2021/12/19 00:27:01 riastradh Exp $ */
+/* $NetBSD: linux_dma_fence.c,v 1.2 2021/12/19 00:27:17 riastradh Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,50 +30,51 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_dma_fence.c,v 1.1 2021/12/19 00:27:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_dma_fence.c,v 1.2 2021/12/19 00:27:17 riastradh Exp $");
#include <sys/atomic.h>
#include <sys/condvar.h>
#include <sys/queue.h>
#include <linux/atomic.h>
+#include <linux/dma-fence.h>
#include <linux/errno.h>
#include <linux/kref.h>
-#include <linux/fence.h>
#include <linux/sched.h>
#include <linux/spinlock.h>
/*
- * linux_fence_trace
+ * linux_dma_fence_trace
*
- * True if we print FENCE_TRACE messages, false if not. These are
- * extremely noisy, too much even for AB_VERBOSE and AB_DEBUG in
- * boothowto.
+ * True if we print DMA_FENCE_TRACE messages, false if not. These
+ * are extremely noisy, too much even for AB_VERBOSE and AB_DEBUG
+ * in boothowto.
*/
-int linux_fence_trace = 0;
+int linux_dma_fence_trace = 0;
/*
- * fence_referenced_p(fence)
+ * dma_fence_referenced_p(fence)
*
* True if fence has a positive reference count. True after
- * fence_init; after the last fence_put, this becomes false.
+ * dma_fence_init; after the last dma_fence_put, this becomes
+ * false.
*/
static inline bool __diagused
-fence_referenced_p(struct fence *fence)
+dma_fence_referenced_p(struct dma_fence *fence)
{
return kref_referenced_p(&fence->refcount);
}
/*
- * fence_init(fence, ops, lock, context, seqno)
+ * dma_fence_init(fence, ops, lock, context, seqno)
*
- * Initialize fence. Caller should call fence_destroy when done,
- * after all references have been released.
+ * Initialize fence. Caller should call dma_fence_destroy when
+ * done, after all references have been released.
*/
void
-fence_init(struct fence *fence, const struct fence_ops *ops, spinlock_t *lock,
- unsigned context, unsigned seqno)
+dma_fence_init(struct dma_fence *fence, const struct dma_fence_ops *ops,
+ spinlock_t *lock, unsigned context, unsigned seqno)
{
kref_init(&fence->refcount);
@@ -83,38 +84,38 @@
fence->seqno = seqno;
fence->ops = ops;
TAILQ_INIT(&fence->f_callbacks);
- cv_init(&fence->f_cv, "fence");
+ cv_init(&fence->f_cv, "dmafence");
}
/*
- * fence_destroy(fence)
+ * dma_fence_destroy(fence)
*
- * Clean up memory initialized with fence_init. This is meant to
- * be used after a fence release callback.
+ * Clean up memory initialized with dma_fence_init. This is meant
+ * to be used after a fence release callback.
*/
void
-fence_destroy(struct fence *fence)
+dma_fence_destroy(struct dma_fence *fence)
{
- KASSERT(!fence_referenced_p(fence));
+ KASSERT(!dma_fence_referenced_p(fence));
KASSERT(TAILQ_EMPTY(&fence->f_callbacks));
cv_destroy(&fence->f_cv);
}
Home |
Main Index |
Thread Index |
Old Index