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: Fix dma fence stub fix so t...



details:   https://anonhg.NetBSD.org/src/rev/7dead46a8d42
branches:  trunk
changeset: 369790:7dead46a8d42
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Sep 01 09:37:06 2022 +0000

description:
drm: Fix dma fence stub fix so the lock is actually initialized.

Tested but forgot to amend change before exporting to CVS again.

diffstat:

 sys/external/bsd/drm2/linux/linux_dma_fence.c |  26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diffs (79 lines):

diff -r 63f848858589 -r 7dead46a8d42 sys/external/bsd/drm2/linux/linux_dma_fence.c
--- a/sys/external/bsd/drm2/linux/linux_dma_fence.c     Thu Sep 01 06:10:58 2022 +0000
+++ b/sys/external/bsd/drm2/linux/linux_dma_fence.c     Thu Sep 01 09:37:06 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_dma_fence.c,v 1.41 2022/09/01 01:54:38 riastradh Exp $   */
+/*     $NetBSD: linux_dma_fence.c,v 1.42 2022/09/01 09:37:06 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.41 2022/09/01 01:54:38 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_dma_fence.c,v 1.42 2022/09/01 09:37:06 riastradh Exp $");
 
 #include <sys/atomic.h>
 #include <sys/condvar.h>
@@ -95,13 +95,15 @@
  */
 int    linux_dma_fence_trace = 0;
 
-static spinlock_t dma_fence_stub_lock;
-static struct dma_fence dma_fence_stub;
+static struct {
+       spinlock_t              lock;
+       struct dma_fence        fence;
+} dma_fence_stub __cacheline_aligned;
 
 static const char *dma_fence_stub_name(struct dma_fence *f)
 {
 
-       KASSERT(f == &dma_fence_stub);
+       KASSERT(f == &dma_fence_stub.fence);
        return "stub";
 }
 
@@ -109,7 +111,7 @@
 dma_fence_stub_release(struct dma_fence *f)
 {
 
-       KASSERT(f == &dma_fence_stub);
+       KASSERT(f == &dma_fence_stub.fence);
        dma_fence_destroy(f);
 }
 
@@ -129,9 +131,10 @@
 {
        int error __diagused;
 
-       dma_fence_init(&dma_fence_stub, &dma_fence_stub_ops,
-           &dma_fence_stub_lock, /*context*/0, /*seqno*/0);
-       error = dma_fence_signal(&dma_fence_stub);
+       spin_lock_init(&dma_fence_stub.lock);
+       dma_fence_init(&dma_fence_stub.fence, &dma_fence_stub_ops,
+           &dma_fence_stub.lock, /*context*/0, /*seqno*/0);
+       error = dma_fence_signal(&dma_fence_stub.fence);
        KASSERTMSG(error == 0, "error=%d", error);
 }
 
@@ -139,7 +142,8 @@
 linux_dma_fences_fini(void)
 {
 
-       dma_fence_put(&dma_fence_stub);
+       dma_fence_put(&dma_fence_stub.fence);
+       spin_lock_destroy(&dma_fence_stub.lock);
 }
 
 /*
@@ -361,7 +365,7 @@
 dma_fence_get_stub(void)
 {
 
-       return dma_fence_get(&dma_fence_stub);
+       return dma_fence_get(&dma_fence_stub.fence);
 }
 
 /*



Home | Main Index | Thread Index | Old Index