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_set_error



details:   https://anonhg.NetBSD.org/src/rev/8b71dc916f81
branches:  trunk
changeset: 1027985:8b71dc916f81
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 01:25:13 2021 +0000

description:
dma_fence_set_error

diffstat:

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

diffs (75 lines):

diff -r abf2c116ce37 -r 8b71dc916f81 sys/external/bsd/drm2/include/linux/dma-fence.h
--- a/sys/external/bsd/drm2/include/linux/dma-fence.h   Sun Dec 19 01:25:05 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/dma-fence.h   Sun Dec 19 01:25:13 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dma-fence.h,v 1.4 2021/12/19 01:16:05 riastradh Exp $  */
+/*     $NetBSD: dma-fence.h,v 1.5 2021/12/19 01:25:13 riastradh Exp $  */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -50,6 +50,7 @@
        unsigned                        context;
        unsigned                        seqno;
        const struct dma_fence_ops      *ops;
+       int                             error;
 
        TAILQ_HEAD(, dma_fence_cb)      f_callbacks;
        kcondvar_t                      f_cv;
@@ -91,6 +92,7 @@
 #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_set_error             linux_dma_fence_set_error
 #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
@@ -123,6 +125,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_signal(struct dma_fence *);
 int    dma_fence_signal_locked(struct dma_fence *);
 long   dma_fence_default_wait(struct dma_fence *, bool, long);
diff -r abf2c116ce37 -r 8b71dc916f81 sys/external/bsd/drm2/linux/linux_dma_fence.c
--- a/sys/external/bsd/drm2/linux/linux_dma_fence.c     Sun Dec 19 01:25:05 2021 +0000
+++ b/sys/external/bsd/drm2/linux/linux_dma_fence.c     Sun Dec 19 01:25:13 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_dma_fence.c,v 1.4 2021/12/19 01:16:05 riastradh Exp $    */
+/*     $NetBSD: linux_dma_fence.c,v 1.5 2021/12/19 01:25:13 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.4 2021/12/19 01:16:05 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_dma_fence.c,v 1.5 2021/12/19 01:25:13 riastradh Exp $");
 
 #include <sys/atomic.h>
 #include <sys/condvar.h>
@@ -463,6 +463,23 @@
 }
 
 /*
+ * dma_fence_set_error(fence, error)
+ *
+ *     Set an error code prior to dma_fence_signal for use by a
+ *     waiter to learn about success or failure of the fence.
+ */
+void
+dma_fence_set_error(struct dma_fence *fence, int error)
+{
+
+       KASSERT(!(fence->flags & (1u << DMA_FENCE_FLAG_SIGNALED_BIT)));
+       KASSERTMSG(error >= -MAX_ERRNO, "%d", error);
+       KASSERTMSG(error < 0, "%d", error);
+
+       fence->error = error;
+}
+
+/*
  * dma_fence_signal(fence)
  *
  *     Signal the fence.  If it has already been signalled, return



Home | Main Index | Thread Index | Old Index