Merge tag 'drm-misc-next-2019-05-24' of git://anongit.freedesktop.org/drm/drm-misc...
[linux-2.6-microblaze.git] / drivers / gpu / drm / i915 / intel_context_types.h
1 /*
2  * SPDX-License-Identifier: MIT
3  *
4  * Copyright © 2019 Intel Corporation
5  */
6
7 #ifndef __INTEL_CONTEXT_TYPES__
8 #define __INTEL_CONTEXT_TYPES__
9
10 #include <linux/kref.h>
11 #include <linux/list.h>
12 #include <linux/mutex.h>
13 #include <linux/rbtree.h>
14 #include <linux/types.h>
15
16 #include "i915_active_types.h"
17 #include "intel_engine_types.h"
18
19 struct i915_gem_context;
20 struct i915_vma;
21 struct intel_context;
22 struct intel_ring;
23
24 struct intel_context_ops {
25         int (*pin)(struct intel_context *ce);
26         void (*unpin)(struct intel_context *ce);
27
28         void (*reset)(struct intel_context *ce);
29         void (*destroy)(struct kref *kref);
30 };
31
32 /*
33  * Powergating configuration for a particular (context,engine).
34  */
35 struct intel_sseu {
36         u8 slice_mask;
37         u8 subslice_mask;
38         u8 min_eus_per_subslice;
39         u8 max_eus_per_subslice;
40 };
41
42 struct intel_context {
43         struct kref ref;
44
45         struct i915_gem_context *gem_context;
46         struct intel_engine_cs *engine;
47         struct intel_engine_cs *active;
48
49         struct list_head active_link;
50         struct list_head signal_link;
51         struct list_head signals;
52
53         struct i915_vma *state;
54         struct intel_ring *ring;
55
56         u32 *lrc_reg_state;
57         u64 lrc_desc;
58
59         atomic_t pin_count;
60         struct mutex pin_mutex; /* guards pinning and associated on-gpuing */
61
62         intel_engine_mask_t saturated; /* submitting semaphores too late? */
63
64         /**
65          * active_tracker: Active tracker for the external rq activity
66          * on this intel_context object.
67          */
68         struct i915_active_request active_tracker;
69
70         const struct intel_context_ops *ops;
71         struct rb_node node;
72
73         /** sseu: Control eu/slice partitioning */
74         struct intel_sseu sseu;
75 };
76
77 #endif /* __INTEL_CONTEXT_TYPES__ */