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 First approximation of dma_fence...



details:   https://anonhg.NetBSD.org/src/rev/b3faa40b9441
branches:  trunk
changeset: 1028327:b3faa40b9441
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 10:38:46 2021 +0000

description:
First approximation of dma_fence_get_stub.

diffstat:

 sys/external/bsd/drm2/include/linux/dma-fence.h |   6 ++++-
 sys/external/bsd/drm2/linux/linux_dma_fence.c   |  26 +++++++++++++++++++++++-
 2 files changed, 29 insertions(+), 3 deletions(-)

diffs (74 lines):

diff -r e02385b4405a -r b3faa40b9441 sys/external/bsd/drm2/include/linux/dma-fence.h
--- a/sys/external/bsd/drm2/include/linux/dma-fence.h   Sun Dec 19 10:38:38 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/dma-fence.h   Sun Dec 19 10:38:46 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dma-fence.h,v 1.7 2021/12/19 01:48:22 riastradh Exp $  */
+/*     $NetBSD: dma-fence.h,v 1.8 2021/12/19 10:38:46 riastradh Exp $  */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -87,6 +87,7 @@
 #define        dma_fence_get                   linux_dma_fence_get
 #define        dma_fence_get_rcu               linux_dma_fence_get_rcu
 #define        dma_fence_get_rcu_safe          linux_dma_fence_get_rcu_safe
+#define        dma_fence_get_stub              linux_dma_fence_get_stub
 #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
@@ -112,6 +113,9 @@
 bool   dma_fence_is_later(struct dma_fence *, struct dma_fence *);
 
 struct dma_fence *
+       dma_fence_get_stub(void);
+
+struct dma_fence *
        dma_fence_get(struct dma_fence *);
 struct dma_fence *
        dma_fence_get_rcu(struct dma_fence *);
diff -r e02385b4405a -r b3faa40b9441 sys/external/bsd/drm2/linux/linux_dma_fence.c
--- a/sys/external/bsd/drm2/linux/linux_dma_fence.c     Sun Dec 19 10:38:38 2021 +0000
+++ b/sys/external/bsd/drm2/linux/linux_dma_fence.c     Sun Dec 19 10:38:46 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_dma_fence.c,v 1.8 2021/12/19 01:50:40 riastradh Exp $    */
+/*     $NetBSD: linux_dma_fence.c,v 1.9 2021/12/19 10:38:46 riastradh Exp $    */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_dma_fence.c,v 1.8 2021/12/19 01:50:40 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_dma_fence.c,v 1.9 2021/12/19 10:38:46 riastradh Exp $");
 
 #include <sys/atomic.h>
 #include <sys/condvar.h>
@@ -171,6 +171,28 @@
 }
 
 /*
+ * dma_fence_get_stub()
+ *
+ *     Return a dma fence that is always already signalled.
+ */
+struct dma_fence *
+dma_fence_get_stub(void)
+{
+       /*
+        * XXX This probably isn't good enough -- caller may try
+        * operations on this that require the lock, which will
+        * require us to create and destroy the lock on module
+        * load/unload.
+        */
+       static struct dma_fence fence = {
+               .refcount = {1}, /* always referenced */
+               .flags = 1u << DMA_FENCE_FLAG_SIGNALED_BIT,
+       };
+
+       return dma_fence_get(&fence);
+}
+
+/*
  * dma_fence_get(fence)
  *
  *     Acquire a reference to fence.  The fence must not be being



Home | Main Index | Thread Index | Old Index