]> asedeno.scripts.mit.edu Git - linux.git/blob - drivers/gpu/drm/i915/intel_context_types.h
68b4ca1611e0cb68d3a88e7ecf848f32ea70fdc0
[linux.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
18 struct i915_gem_context;
19 struct i915_vma;
20 struct intel_context;
21 struct intel_ring;
22
23 struct intel_context_ops {
24         int (*pin)(struct intel_context *ce);
25         void (*unpin)(struct intel_context *ce);
26
27         void (*reset)(struct intel_context *ce);
28         void (*destroy)(struct kref *kref);
29 };
30
31 /*
32  * Powergating configuration for a particular (context,engine).
33  */
34 struct intel_sseu {
35         u8 slice_mask;
36         u8 subslice_mask;
37         u8 min_eus_per_subslice;
38         u8 max_eus_per_subslice;
39 };
40
41 struct intel_context {
42         struct kref ref;
43
44         struct i915_gem_context *gem_context;
45         struct intel_engine_cs *engine;
46         struct intel_engine_cs *active;
47
48         struct list_head active_link;
49         struct list_head signal_link;
50         struct list_head signals;
51
52         struct i915_vma *state;
53         struct intel_ring *ring;
54
55         u32 *lrc_reg_state;
56         u64 lrc_desc;
57
58         atomic_t pin_count;
59         struct mutex pin_mutex; /* guards pinning and associated on-gpuing */
60
61         /**
62          * active_tracker: Active tracker for the external rq activity
63          * on this intel_context object.
64          */
65         struct i915_active_request active_tracker;
66
67         const struct intel_context_ops *ops;
68         struct rb_node node;
69
70         /** sseu: Control eu/slice partitioning */
71         struct intel_sseu sseu;
72 };
73
74 #endif /* __INTEL_CONTEXT_TYPES__ */