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 dma_fence_get_status



details:   https://anonhg.NetBSD.org/src/rev/f84ded478918
branches:  trunk
changeset: 1028372:f84ded478918
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 10:50:03 2021 +0000

description:
dma_fence_get_status

diffstat:

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

diffs (76 lines):

diff -r edbe4f30dd52 -r f84ded478918 sys/external/bsd/drm2/include/linux/dma-fence.h
--- a/sys/external/bsd/drm2/include/linux/dma-fence.h   Sun Dec 19 10:49:55 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/dma-fence.h   Sun Dec 19 10:50:03 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dma-fence.h,v 1.9 2021/12/19 10:40:12 riastradh Exp $  */
+/*     $NetBSD: dma-fence.h,v 1.10 2021/12/19 10:50:03 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -89,6 +89,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_status            linux_dma_fence_get_status
 #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
@@ -133,6 +134,7 @@
 bool   dma_fence_is_signaled(struct dma_fence *);
 bool   dma_fence_is_signaled_locked(struct dma_fence *);
 void   dma_fence_set_error(struct dma_fence *, int);
+int    dma_fence_get_status(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);
diff -r edbe4f30dd52 -r f84ded478918 sys/external/bsd/drm2/linux/linux_dma_fence.c
--- a/sys/external/bsd/drm2/linux/linux_dma_fence.c     Sun Dec 19 10:49:55 2021 +0000
+++ b/sys/external/bsd/drm2/linux/linux_dma_fence.c     Sun Dec 19 10:50:03 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_dma_fence.c,v 1.9 2021/12/19 10:38:46 riastradh Exp $    */
+/*     $NetBSD: linux_dma_fence.c,v 1.10 2021/12/19 10:50:03 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.9 2021/12/19 10:38:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_dma_fence.c,v 1.10 2021/12/19 10:50:03 riastradh Exp $");
 
 #include <sys/atomic.h>
 #include <sys/condvar.h>
@@ -503,6 +503,32 @@
 }
 
 /*
+ * dma_fence_get_status(fence)
+ *
+ *     Return 0 if fence has yet to be signalled, 1 if it has been
+ *     signalled without error, or negative error code if
+ *     dma_fence_set_error was used.
+ */
+int
+dma_fence_get_status(struct dma_fence *fence)
+{
+       int ret;
+
+       spin_lock(fence->lock);
+       if (!dma_fence_is_signaled_locked(fence)) {
+               ret = 0;
+       } else if (fence->error) {
+               ret = fence->error;
+               KASSERTMSG(ret < 0, "%d", ret);
+       } else {
+               ret = 1;
+       }
+       spin_unlock(fence->lock);
+
+       return ret;
+}
+
+/*
  * dma_fence_signal(fence)
  *
  *     Signal the fence.  If it has already been signalled, return



Home | Main Index | Thread Index | Old Index