summaryrefslogtreecommitdiff
path: root/sys/external/bsd/drm2/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'sys/external/bsd/drm2/include/linux')
-rw-r--r--sys/external/bsd/drm2/include/linux/fence.h29
-rw-r--r--sys/external/bsd/drm2/include/linux/reservation.h86
2 files changed, 52 insertions, 63 deletions
diff --git a/sys/external/bsd/drm2/include/linux/fence.h b/sys/external/bsd/drm2/include/linux/fence.h
index 08e6a02ed08..f8219c9f597 100644
--- a/sys/external/bsd/drm2/include/linux/fence.h
+++ b/sys/external/bsd/drm2/include/linux/fence.h
@@ -1,4 +1,4 @@
-/* $NetBSD: fence.h,v 1.10 2018/08/27 07:53:05 riastradh Exp $ */
+/* $NetBSD: fence.h,v 1.11 2018/08/27 13:33:59 riastradh Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -33,9 +33,13 @@
#define _LINUX_FENCE_H_
#include <sys/types.h>
+#include <sys/condvar.h>
+#include <sys/kernel.h>
+#include <sys/queue.h>
-#include <linux/mutex.h>
+#include <linux/kref.h>
#include <linux/rcupdate.h>
+#include <linux/spinlock.h>
struct fence_cb;
@@ -46,10 +50,15 @@ struct fence {
unsigned context;
unsigned seqno;
const struct fence_ops *ops;
+
+ TAILQ_HEAD(, fence_cb) f_callbacks;
+ kcondvar_t f_cv;
+ struct rcu_head f_rcu;
};
-#define FENCE_FLAG_SIGNALED_BIT __BIT(0)
-#define FENCE_FLAG_USER_BITS __BIT(1)
+#define FENCE_FLAG_ENABLE_SIGNAL_BIT 0
+#define FENCE_FLAG_SIGNALED_BIT 1
+#define FENCE_FLAG_USER_BITS 2
struct fence_ops {
const char *(*get_driver_name)(struct fence *);
@@ -63,14 +72,19 @@ struct fence_ops {
typedef void (*fence_func_t)(struct fence *, struct fence_cb *);
struct fence_cb {
- fence_func_t fcb_func;
+ fence_func_t fcb_func;
+ TAILQ_ENTRY(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_destroy linux_fence_destroy
#define fence_enable_sw_signaling linux_fence_enable_sw_signaling
#define fence_get linux_fence_get
#define fence_init linux_fence_init
+#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
@@ -80,6 +94,7 @@ struct fence_cb {
void fence_init(struct fence *, const struct fence_ops *, spinlock_t *,
unsigned, unsigned);
+void fence_destroy(struct fence *);
void fence_free(struct fence *);
unsigned
@@ -87,6 +102,8 @@ unsigned
struct fence *
fence_get(struct fence *);
+struct fence *
+ fence_get_rcu(struct fence *);
void fence_put(struct fence *);
int fence_add_callback(struct fence *, struct fence_cb *, fence_func_t);
@@ -99,7 +116,7 @@ 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_timeout(struct fence *, bool, int);
+long fence_wait_timeout(struct fence *, bool, long);
static inline void
FENCE_TRACE(struct fence *f, const char *fmt, ...)
diff --git a/sys/external/bsd/drm2/include/linux/reservation.h b/sys/external/bsd/drm2/include/linux/reservation.h
index b74c70be708..53761b23dc1 100644
--- a/sys/external/bsd/drm2/include/linux/reservation.h
+++ b/sys/external/bsd/drm2/include/linux/reservation.h
@@ -1,7 +1,7 @@
-/* $NetBSD: reservation.h,v 1.4 2018/08/27 07:34:41 riastradh Exp $ */
+/* $NetBSD: reservation.h,v 1.5 2018/08/27 13:33:59 riastradh Exp $ */
/*-
- * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -29,89 +29,61 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef _LINUX_RESERVATION_H_
-#define _LINUX_RESERVATION_H_
-
-#include <sys/atomic.h>
+#ifndef _LINUX_RESERVATION_H_
+#define _LINUX_RESERVATION_H_
#include <linux/rcupdate.h>
#include <linux/ww_mutex.h>
struct fence;
-extern struct ww_class reservation_ww_class;
-
struct reservation_object {
struct ww_mutex lock;
- struct reservation_object_list __rcu *robj_objlist;
- struct fence __rcu *robj_fence_excl;
+ unsigned robj_version;
+ struct fence __rcu *robj_fence;
+ struct reservation_object_list __rcu *robj_list;
+ struct reservation_object_list __rcu *robj_prealloc;
+ uint32_t robj_nreserved;
};
struct reservation_object_list {
+ struct rcu_head rol_rcu;
+
uint32_t shared_count;
+ uint32_t shared_max;
struct fence __rcu *shared[];
};
#define reservation_object_add_excl_fence linux_reservation_object_add_excl_fence
#define reservation_object_add_shared_fence linux_reservation_object_add_shared_fence
+#define reservation_object_fini linux_reservation_object_fini
+#define reservation_object_get_excl linux_reservation_object_get_excl
+#define reservation_object_get_list linux_reservation_object_get_list
+#define reservation_object_held linux_reservation_object_held
+#define reservation_object_init linux_reservation_object_init
#define reservation_object_reserve_shared linux_reservation_object_reserve_shared
#define reservation_object_test_signaled_rcu linux_reservation_object_test_signaled_rcu
#define reservation_object_wait_timeout_rcu linux_reservation_object_wait_timeout_rcu
+#define reservation_ww_class linux_reservation_ww_class
+
+extern struct ww_class reservation_ww_class;
+void reservation_object_init(struct reservation_object *);
+void reservation_object_fini(struct reservation_object *);
+bool reservation_object_held(struct reservation_object *);
+struct fence *
+ reservation_object_get_excl(struct reservation_object *);
+struct reservation_object_list *
+ reservation_object_get_list(struct reservation_object *);
+int reservation_object_reserve_shared(struct reservation_object *);
void reservation_object_add_excl_fence(struct reservation_object *,
struct fence *);
void reservation_object_add_shared_fence(struct reservation_object *,
struct fence *);
-int reservation_object_reserve_shared(struct reservation_object *);
bool reservation_object_test_signaled_rcu(struct reservation_object *,
bool);
long reservation_object_wait_timeout_rcu(struct reservation_object *,
bool, bool, unsigned long);
-static inline void
-reservation_object_init(struct reservation_object *reservation)
-{
-
- ww_mutex_init(&reservation->lock, &reservation_ww_class);
-}
-
-static inline void
-reservation_object_fini(struct reservation_object *reservation)
-{
-
- ww_mutex_destroy(&reservation->lock);
-}
-
-static inline bool
-reservation_object_held(struct reservation_object *reservation)
-{
-
- return ww_mutex_is_locked(&reservation->lock);
-}
-
-static inline struct fence *
-reservation_object_get_excl(struct reservation_object *reservation)
-{
- struct fence *fence;
-
- KASSERT(reservation_object_held(reservation));
- fence = reservation->robj_fence_excl;
- membar_datadep_consumer();
-
- return fence;
-}
-
-static inline struct reservation_object_list *
-reservation_object_get_list(struct reservation_object *reservation)
-{
- struct reservation_object_list *objlist;
-
- KASSERT(reservation_object_held(reservation));
- objlist = reservation->robj_objlist;
- membar_datadep_consumer();
-
- return objlist;
-}
-
-#endif /* _LINUX_RESERVATION_H_ */
+#endif /* _LINUX_RESERVATION_H_ */