Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / gpu / drm / i915 / i915_scheduler.h
blob6f0bf00fc5690d361800454029bbea703b393790
1 /*
2 * SPDX-License-Identifier: MIT
4 * Copyright © 2018 Intel Corporation
5 */
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"
16 #define priolist_for_each_request(it, plist, idx) \
17 for (idx = 0; idx < ARRAY_SIZE((plist)->requests); idx++) \
18 list_for_each_entry(it, &(plist)->requests[idx], sched.link)
20 #define priolist_for_each_request_consume(it, n, plist, idx) \
21 for (; \
22 (plist)->used ? (idx = __ffs((plist)->used)), 1 : 0; \
23 (plist)->used &= ~BIT(idx)) \
24 list_for_each_entry_safe(it, n, \
25 &(plist)->requests[idx], \
26 sched.link)
28 void i915_sched_node_init(struct i915_sched_node *node);
29 void i915_sched_node_reinit(struct i915_sched_node *node);
31 bool __i915_sched_node_add_dependency(struct i915_sched_node *node,
32 struct i915_sched_node *signal,
33 struct i915_dependency *dep,
34 unsigned long flags);
36 int i915_sched_node_add_dependency(struct i915_sched_node *node,
37 struct i915_sched_node *signal,
38 unsigned long flags);
40 void i915_sched_node_fini(struct i915_sched_node *node);
42 void i915_schedule(struct i915_request *request,
43 const struct i915_sched_attr *attr);
45 void i915_schedule_bump_priority(struct i915_request *rq, unsigned int bump);
47 struct list_head *
48 i915_sched_lookup_priolist(struct intel_engine_cs *engine, int prio);
50 void __i915_priolist_free(struct i915_priolist *p);
51 static inline void i915_priolist_free(struct i915_priolist *p)
53 if (p->priority != I915_PRIORITY_NORMAL)
54 __i915_priolist_free(p);
57 #endif /* _I915_SCHEDULER_H_ */