]> git.ipfire.org Git - thirdparty/linux.git/blame - drivers/gpu/drm/i915/i915_scheduler.h
Merge tag 'io_uring-5.7-2020-05-22' of git://git.kernel.dk/linux-block
[thirdparty/linux.git] / drivers / gpu / drm / i915 / i915_scheduler.h
CommitLineData
98ff5c78
CW
1/*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright © 2018 Intel Corporation
5 */
6
7#ifndef _I915_SCHEDULER_H_
8#define _I915_SCHEDULER_H_
9
10#include <linux/bitops.h>
3a891a62 11#include <linux/list.h>
e2f3496e 12#include <linux/kernel.h>
98ff5c78 13
3a891a62 14#include "i915_scheduler_types.h"
32eb6bcf
CW
15
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)
19
20#define priolist_for_each_request_consume(it, n, plist, idx) \
bd5d6781
CW
21 for (; \
22 (plist)->used ? (idx = __ffs((plist)->used)), 1 : 0; \
23 (plist)->used &= ~BIT(idx)) \
32eb6bcf 24 list_for_each_entry_safe(it, n, \
bd5d6781 25 &(plist)->requests[idx], \
32eb6bcf
CW
26 sched.link)
27
e2f3496e 28void i915_sched_node_init(struct i915_sched_node *node);
67a3acaa 29void i915_sched_node_reinit(struct i915_sched_node *node);
e2f3496e
CW
30
31bool __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);
35
32eb6bcf 36int i915_sched_node_add_dependency(struct i915_sched_node *node,
a9d094dc
CW
37 struct i915_sched_node *signal,
38 unsigned long flags);
e2f3496e 39
32eb6bcf 40void i915_sched_node_fini(struct i915_sched_node *node);
e2f3496e
CW
41
42void i915_schedule(struct i915_request *request,
43 const struct i915_sched_attr *attr);
44
e9eaf82d
CW
45void i915_schedule_bump_priority(struct i915_request *rq, unsigned int bump);
46
e2f3496e
CW
47struct list_head *
48i915_sched_lookup_priolist(struct intel_engine_cs *engine, int prio);
49
32eb6bcf
CW
50void __i915_priolist_free(struct i915_priolist *p);
51static inline void i915_priolist_free(struct i915_priolist *p)
52{
53 if (p->priority != I915_PRIORITY_NORMAL)
54 __i915_priolist_free(p);
55}
56
98ff5c78 57#endif /* _I915_SCHEDULER_H_ */