1 /* $NetBSD: i915_scheduler.h,v 1.3 2021/12/19 11:37:50 riastradh Exp $ */ 2 3 /* 4 * SPDX-License-Identifier: MIT 5 * 6 * Copyright 2018 Intel Corporation 7 */ 8 9 #ifndef _I915_SCHEDULER_H_ 10 #define _I915_SCHEDULER_H_ 11 12 #include <linux/bitops.h> 13 #include <linux/list.h> 14 #include <linux/kernel.h> 15 16 #include "i915_scheduler_types.h" 17 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) 21 22 #define priolist_for_each_request_consume(it, n, plist, idx) \ 23 for (; \ 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], \ 28 sched.link) 29 30 void i915_sched_node_init(struct i915_sched_node *node); 31 void i915_sched_node_reinit(struct i915_sched_node *node); 32 33 bool __i915_sched_node_add_dependency(struct i915_sched_node *node, 34 struct i915_sched_node *signal, 35 struct i915_dependency *dep, 36 unsigned long flags); 37 38 int i915_sched_node_add_dependency(struct i915_sched_node *node, 39 struct i915_sched_node *signal); 40 41 void i915_sched_node_fini(struct i915_sched_node *node); 42 43 void i915_schedule(struct i915_request *request, 44 const struct i915_sched_attr *attr); 45 46 void i915_schedule_bump_priority(struct i915_request *rq, unsigned int bump); 47 48 struct list_head * 49 i915_sched_lookup_priolist(struct intel_engine_cs *engine, int prio); 50 51 void __i915_priolist_free(struct i915_priolist *p); 52 static inline void i915_priolist_free(struct i915_priolist *p) 53 { 54 if (p->priority != I915_PRIORITY_NORMAL) 55 __i915_priolist_free(p); 56 } 57 58 void i915_sched_init(struct intel_engine_execlists *); 59 60 #endif /* _I915_SCHEDULER_H_ */ 61