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 drm: Rework enable-signal logic ...
details: https://anonhg.NetBSD.org/src/rev/dc3e73810da1
branches: trunk
changeset: 1028815:dc3e73810da1
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 12:07:38 2021 +0000
description:
drm: Rework enable-signal logic to match Linux.
diffstat:
sys/external/bsd/drm2/linux/linux_dma_fence.c | 30 +++++++++++++++-----------
1 files changed, 17 insertions(+), 13 deletions(-)
diffs (61 lines):
diff -r afef3ac176b6 -r dc3e73810da1 sys/external/bsd/drm2/linux/linux_dma_fence.c
--- a/sys/external/bsd/drm2/linux/linux_dma_fence.c Sun Dec 19 12:07:29 2021 +0000
+++ b/sys/external/bsd/drm2/linux/linux_dma_fence.c Sun Dec 19 12:07:38 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_dma_fence.c,v 1.19 2021/12/19 12:02:40 riastradh Exp $ */
+/* $NetBSD: linux_dma_fence.c,v 1.20 2021/12/19 12:07:38 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.19 2021/12/19 12:02:40 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_dma_fence.c,v 1.20 2021/12/19 12:07:38 riastradh Exp $");
#include <sys/atomic.h>
#include <sys/condvar.h>
@@ -344,27 +344,31 @@
static int
dma_fence_ensure_signal_enabled(struct dma_fence *fence)
{
+ bool already_enabled;
KASSERT(dma_fence_referenced_p(fence));
KASSERT(spin_is_locked(fence->lock));
+ /* Determine whether signalling was enabled, and enable it. */
+ already_enabled = test_and_set_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT,
+ &fence->flags);
+
/* If the fence was already signalled, fail with -ENOENT. */
if (fence->flags & (1u << DMA_FENCE_FLAG_SIGNALED_BIT))
return -ENOENT;
/*
- * If the enable signaling callback has been called, success.
- * Otherwise, set the bit indicating it.
+ * Otherwise, if it wasn't enabled yet, try to enable
+ * signalling, or fail if the fence doesn't support that.
*/
- if (test_and_set_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &fence->flags))
- return 0;
-
- /* Otherwise, note that we've called it and call it. */
- KASSERT(fence->ops->enable_signaling);
- if (!(*fence->ops->enable_signaling)(fence)) {
- /* If it failed, signal and return -ENOENT. */
- dma_fence_signal_locked(fence);
- return -ENOENT;
+ if (!already_enabled) {
+ if (fence->ops->enable_signaling == NULL)
+ return -ENOENT;
+ if (!(*fence->ops->enable_signaling)(fence)) {
+ /* If it failed, signal and return -ENOENT. */
+ dma_fence_signal_locked(fence);
+ return -ENOENT;
+ }
}
/* Success! */
Home |
Main Index |
Thread Index |
Old Index