1 | /* SPDX-License-Identifier: MIT */ |
---|---|
2 | /* |
3 | * Copyright © 2019 Intel Corporation |
4 | */ |
5 | |
6 | #ifndef __INTEL_BREADCRUMBS__ |
7 | #define __INTEL_BREADCRUMBS__ |
8 | |
9 | #include <linux/atomic.h> |
10 | #include <linux/irq_work.h> |
11 | |
12 | #include "intel_breadcrumbs_types.h" |
13 | |
14 | struct drm_printer; |
15 | struct i915_request; |
16 | struct intel_breadcrumbs; |
17 | |
18 | struct intel_breadcrumbs * |
19 | intel_breadcrumbs_create(struct intel_engine_cs *irq_engine); |
20 | void intel_breadcrumbs_free(struct kref *kref); |
21 | |
22 | void intel_breadcrumbs_reset(struct intel_breadcrumbs *b); |
23 | void __intel_breadcrumbs_park(struct intel_breadcrumbs *b); |
24 | |
25 | static inline void intel_breadcrumbs_unpark(struct intel_breadcrumbs *b) |
26 | { |
27 | atomic_inc(v: &b->active); |
28 | } |
29 | |
30 | static inline void intel_breadcrumbs_park(struct intel_breadcrumbs *b) |
31 | { |
32 | if (atomic_dec_and_test(v: &b->active)) |
33 | __intel_breadcrumbs_park(b); |
34 | } |
35 | |
36 | static inline void |
37 | intel_engine_signal_breadcrumbs(struct intel_engine_cs *engine) |
38 | { |
39 | irq_work_queue(work: &engine->breadcrumbs->irq_work); |
40 | } |
41 | |
42 | void intel_engine_print_breadcrumbs(struct intel_engine_cs *engine, |
43 | struct drm_printer *p); |
44 | |
45 | bool i915_request_enable_breadcrumb(struct i915_request *request); |
46 | void i915_request_cancel_breadcrumb(struct i915_request *request); |
47 | |
48 | void intel_context_remove_breadcrumbs(struct intel_context *ce, |
49 | struct intel_breadcrumbs *b); |
50 | |
51 | static inline struct intel_breadcrumbs * |
52 | intel_breadcrumbs_get(struct intel_breadcrumbs *b) |
53 | { |
54 | kref_get(kref: &b->ref); |
55 | return b; |
56 | } |
57 | |
58 | static inline void intel_breadcrumbs_put(struct intel_breadcrumbs *b) |
59 | { |
60 | kref_put(kref: &b->ref, release: intel_breadcrumbs_free); |
61 | } |
62 | |
63 | #endif /* __INTEL_BREADCRUMBS__ */ |
64 |