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/dist/drm/amd/scheduler Don't abuse str...



details:   https://anonhg.NetBSD.org/src/rev/6385791a12b8
branches:  trunk
changeset: 992928:6385791a12b8
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 14:03:10 2018 +0000

description:
Don't abuse struct fence internals for irreverent dolphins.

diffstat:

 sys/external/bsd/drm2/dist/drm/amd/scheduler/gpu_scheduler.c |  20 +++++++----
 sys/external/bsd/drm2/dist/drm/amd/scheduler/gpu_scheduler.h |   5 ++-
 sys/external/bsd/drm2/dist/drm/amd/scheduler/sched_fence.c   |  10 +++---
 3 files changed, 22 insertions(+), 13 deletions(-)

diffs (104 lines):

diff -r 159c10ac3812 -r 6385791a12b8 sys/external/bsd/drm2/dist/drm/amd/scheduler/gpu_scheduler.c
--- a/sys/external/bsd/drm2/dist/drm/amd/scheduler/gpu_scheduler.c      Mon Aug 27 14:02:52 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/scheduler/gpu_scheduler.c      Mon Aug 27 14:03:10 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gpu_scheduler.c,v 1.2 2018/08/27 04:58:23 riastradh Exp $      */
+/*     $NetBSD: gpu_scheduler.c,v 1.3 2018/08/27 14:03:10 riastradh Exp $      */
 
 /*
  * Copyright 2015 Advanced Micro Devices, Inc.
@@ -24,7 +24,7 @@
  *
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gpu_scheduler.c,v 1.2 2018/08/27 04:58:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gpu_scheduler.c,v 1.3 2018/08/27 14:03:10 riastradh Exp $");
 
 #include <linux/kthread.h>
 #include <linux/wait.h>
@@ -224,13 +224,19 @@
        kfifo_free(&entity->job_queue);
 }
 
+static void amd_sched_entity_wakeup_cb(struct fence *f,
+    struct amd_sched_entity *entity)
+{
+       entity->dependency = NULL;
+       fence_put(f);
+       amd_sched_wakeup(entity->sched);
+}
+
 static void amd_sched_entity_wakeup(struct fence *f, struct fence_cb *cb)
 {
        struct amd_sched_entity *entity =
                container_of(cb, struct amd_sched_entity, cb);
-       entity->dependency = NULL;
-       fence_put(f);
-       amd_sched_wakeup(entity->sched);
+       amd_sched_entity_wakeup_cb(f, entity);
 }
 
 static bool amd_sched_entity_add_dependency_cb(struct amd_sched_entity *entity)
@@ -255,8 +261,8 @@
                }
 
                /* Wait for fence to be scheduled */
-               entity->cb.func = amd_sched_entity_wakeup;
-               list_add_tail(&entity->cb.node, &s_fence->scheduled_cb);
+               entity->func = amd_sched_entity_wakeup_cb;
+               list_add_tail(&entity->entry, &s_fence->scheduled_cb);
                return true;
        }
 
diff -r 159c10ac3812 -r 6385791a12b8 sys/external/bsd/drm2/dist/drm/amd/scheduler/gpu_scheduler.h
--- a/sys/external/bsd/drm2/dist/drm/amd/scheduler/gpu_scheduler.h      Mon Aug 27 14:02:52 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/scheduler/gpu_scheduler.h      Mon Aug 27 14:03:10 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gpu_scheduler.h,v 1.2 2018/08/27 04:58:23 riastradh Exp $      */
+/*     $NetBSD: gpu_scheduler.h,v 1.3 2018/08/27 14:03:10 riastradh Exp $      */
 
 /*
  * Copyright 2015 Advanced Micro Devices, Inc.
@@ -56,6 +56,9 @@
 
        struct fence                    *dependency;
        struct fence_cb                 cb;
+       void                            (*func)(struct fence *,
+                                           struct amd_sched_entity *);
+       struct list_head                entry;
 };
 
 /**
diff -r 159c10ac3812 -r 6385791a12b8 sys/external/bsd/drm2/dist/drm/amd/scheduler/sched_fence.c
--- a/sys/external/bsd/drm2/dist/drm/amd/scheduler/sched_fence.c        Mon Aug 27 14:02:52 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/scheduler/sched_fence.c        Mon Aug 27 14:03:10 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sched_fence.c,v 1.2 2018/08/27 04:58:23 riastradh Exp $        */
+/*     $NetBSD: sched_fence.c,v 1.3 2018/08/27 14:03:10 riastradh Exp $        */
 
 /*
  * Copyright 2015 Advanced Micro Devices, Inc.
@@ -24,7 +24,7 @@
  *
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sched_fence.c,v 1.2 2018/08/27 04:58:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sched_fence.c,v 1.3 2018/08/27 14:03:10 riastradh Exp $");
 
 #include <linux/kthread.h>
 #include <linux/wait.h>
@@ -64,11 +64,11 @@
 
 void amd_sched_fence_scheduled(struct amd_sched_fence *s_fence)
 {
-       struct fence_cb *cur, *tmp;
+       struct amd_sched_entity *cur, *tmp;
 
        set_bit(AMD_SCHED_FENCE_SCHEDULED_BIT, &s_fence->base.flags);
-       list_for_each_entry_safe(cur, tmp, &s_fence->scheduled_cb, node) {
-               list_del_init(&cur->node);
+       list_for_each_entry_safe(cur, tmp, &s_fence->scheduled_cb, entry) {
+               list_del_init(&cur->entry);
                cur->func(&s_fence->base, cur);
        }
 }



Home | Main Index | Thread Index | Old Index