2 * SPDX-License-Identifier: MIT
4 * Copyright © 2018 Intel Corporation
7 #ifndef _I915_SCHEDULER_H_
8 #define _I915_SCHEDULER_H_
10 #include <linux/bitops.h>
11 #include <linux/list.h>
12 #include <linux/kernel.h>
14 #include "i915_scheduler_types.h"
18 #define priolist_for_each_request(it, plist, idx) \
19 for (idx = 0; idx < ARRAY_SIZE((plist)->requests); idx++) \
20 list_for_each_entry(it, &(plist)->requests[idx], sched.link)
22 #define priolist_for_each_request_consume(it, n, plist, idx) \
24 (plist)->used ? (idx = __ffs((plist)->used)), 1 : 0; \
25 (plist)->used &= ~BIT(idx)) \
26 list_for_each_entry_safe(it, n, \
27 &(plist)->requests[idx], \
30 void i915_sched_node_init(struct i915_sched_node *node);
31 void i915_sched_node_reinit(struct i915_sched_node *node);
33 bool __i915_sched_node_add_dependency(struct i915_sched_node *node,
34 struct i915_sched_node *signal,
35 struct i915_dependency *dep,
38 int i915_sched_node_add_dependency(struct i915_sched_node *node,
39 struct i915_sched_node *signal,
42 void i915_sched_node_fini(struct i915_sched_node *node);
44 void i915_schedule(struct i915_request *request,
45 const struct i915_sched_attr *attr);
47 void i915_schedule_bump_priority(struct i915_request *rq, unsigned int bump);
50 i915_sched_lookup_priolist(struct intel_engine_cs *engine, int prio);
52 void __i915_priolist_free(struct i915_priolist *p);
53 static inline void i915_priolist_free(struct i915_priolist *p)
55 if (p->priority != I915_PRIORITY_NORMAL)
56 __i915_priolist_free(p);
59 void i915_request_show_with_schedule(struct drm_printer *m,
60 const struct i915_request *rq,
64 #endif /* _I915_SCHEDULER_H_ */