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/i915 i915: Initialize the rbt...



details:   https://anonhg.NetBSD.org/src/rev/247a9de8bce7
branches:  trunk
changeset: 1028665:247a9de8bce7
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 11:37:50 2021 +0000

description:
i915: Initialize the rbtree.

diffstat:

 sys/external/bsd/drm2/dist/drm/i915/gt/intel_lrc.c   |   6 +-
 sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.c |  48 +++++++++++++++++++-
 sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.h |   4 +-
 3 files changed, 53 insertions(+), 5 deletions(-)

diffs (112 lines):

diff -r 5d504c456319 -r 247a9de8bce7 sys/external/bsd/drm2/dist/drm/i915/gt/intel_lrc.c
--- a/sys/external/bsd/drm2/dist/drm/i915/gt/intel_lrc.c        Sun Dec 19 11:37:41 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/gt/intel_lrc.c        Sun Dec 19 11:37:50 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intel_lrc.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $  */
+/*     $NetBSD: intel_lrc.c,v 1.3 2021/12/19 11:37:50 riastradh Exp $  */
 
 /*
  * Copyright © 2014 Intel Corporation
@@ -134,7 +134,7 @@
  *
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_lrc.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_lrc.c,v 1.3 2021/12/19 11:37:50 riastradh Exp $");
 
 #include <linux/interrupt.h>
 
@@ -4326,6 +4326,8 @@
        struct intel_uncore *uncore = engine->uncore;
        u32 base = engine->mmio_base;
 
+       i915_sched_init(&engine->execlists);
+
        tasklet_init(&engine->execlists.tasklet,
                     execlists_submission_tasklet, (unsigned long)engine);
        timer_setup(&engine->execlists.timer, execlists_timeslice, 0);
diff -r 5d504c456319 -r 247a9de8bce7 sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.c      Sun Dec 19 11:37:41 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.c      Sun Dec 19 11:37:50 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i915_scheduler.c,v 1.4 2021/12/19 11:37:41 riastradh Exp $     */
+/*     $NetBSD: i915_scheduler.c,v 1.5 2021/12/19 11:37:50 riastradh Exp $     */
 
 /*
  * SPDX-License-Identifier: MIT
@@ -7,7 +7,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_scheduler.c,v 1.4 2021/12/19 11:37:41 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_scheduler.c,v 1.5 2021/12/19 11:37:50 riastradh Exp $");
 
 #include <linux/mutex.h>
 
@@ -82,6 +82,50 @@
        }
 }
 
+#ifdef __NetBSD__
+
+static int
+compare_priolists(void *cookie, const void *va, const void *vb)
+{
+       const struct i915_priolist *a = va;
+       const struct i915_priolist *b = vb;
+
+       if (a->priority < b->priority)
+               return -1;
+       if (a->priority > b->priority)
+               return +1;
+       return 0;
+}
+
+static int
+compare_priolist_key(void *cookie, const void *vp, const void *vk)
+{
+       const struct i915_priolist *p = vp;
+       const int *priorityp = vk, priority = *priorityp;
+
+       if (p->priority < priority)
+               return -1;
+       if (p->priority > priority)
+               return -1;
+       return 0;
+}
+
+static const rb_tree_ops_t i915_priolist_rb_ops = {
+       .rbto_compare_nodes = compare_priolists,
+       .rbto_compare_key = compare_priolist_key,
+       .rbto_node_offset = offsetof(struct i915_priolist, node),
+};
+
+void
+i915_sched_init(struct intel_engine_execlists *execlists)
+{
+
+       rb_tree_init(&execlists->queue.rb_root.rbr_tree,
+           &i915_priolist_rb_ops);
+}
+
+#endif
+
 struct list_head *
 i915_sched_lookup_priolist(struct intel_engine_cs *engine, int prio)
 {
diff -r 5d504c456319 -r 247a9de8bce7 sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.h
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.h      Sun Dec 19 11:37:41 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_scheduler.h      Sun Dec 19 11:37:50 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i915_scheduler.h,v 1.2 2021/12/18 23:45:28 riastradh Exp $     */
+/*     $NetBSD: i915_scheduler.h,v 1.3 2021/12/19 11:37:50 riastradh Exp $     */
 
 /*
  * SPDX-License-Identifier: MIT
@@ -55,4 +55,6 @@
                __i915_priolist_free(p);
 }
 
+void i915_sched_init(struct intel_engine_execlists *);
+
 #endif /* _I915_SCHEDULER_H_ */



Home | Main Index | Thread Index | Old Index