hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h
....@@ -1,15 +1,6 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License version 2 and
6
- * only version 2 as published by the Free Software Foundation.
7
- *
8
- * This program is distributed in the hope that it will be useful,
9
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- * GNU General Public License for more details.
12
- *
134 */
145
156 #ifndef __DPU_RM_H__
....@@ -20,78 +11,26 @@
2011 #include "msm_kms.h"
2112 #include "dpu_hw_top.h"
2213
23
-/**
24
- * enum dpu_rm_topology_name - HW resource use case in use by connector
25
- * @DPU_RM_TOPOLOGY_NONE: No topology in use currently
26
- * @DPU_RM_TOPOLOGY_SINGLEPIPE: 1 LM, 1 PP, 1 INTF/WB
27
- * @DPU_RM_TOPOLOGY_DUALPIPE: 2 LM, 2 PP, 2 INTF/WB
28
- * @DPU_RM_TOPOLOGY_DUALPIPE_3DMERGE: 2 LM, 2 PP, 3DMux, 1 INTF/WB
29
- */
30
-enum dpu_rm_topology_name {
31
- DPU_RM_TOPOLOGY_NONE = 0,
32
- DPU_RM_TOPOLOGY_SINGLEPIPE,
33
- DPU_RM_TOPOLOGY_DUALPIPE,
34
- DPU_RM_TOPOLOGY_DUALPIPE_3DMERGE,
35
- DPU_RM_TOPOLOGY_MAX,
36
-};
37
-
38
-/**
39
- * enum dpu_rm_topology_control - HW resource use case in use by connector
40
- * @DPU_RM_TOPCTL_RESERVE_LOCK: If set, in AtomicTest phase, after a successful
41
- * test, reserve the resources for this display.
42
- * Normal behavior would not impact the reservation
43
- * list during the AtomicTest phase.
44
- * @DPU_RM_TOPCTL_RESERVE_CLEAR: If set, in AtomicTest phase, before testing,
45
- * release any reservation held by this display.
46
- * Normal behavior would not impact the
47
- * reservation list during the AtomicTest phase.
48
- * @DPU_RM_TOPCTL_DS : Require layer mixers with DS capabilities
49
- */
50
-enum dpu_rm_topology_control {
51
- DPU_RM_TOPCTL_RESERVE_LOCK,
52
- DPU_RM_TOPCTL_RESERVE_CLEAR,
53
- DPU_RM_TOPCTL_DS,
54
-};
14
+struct dpu_global_state;
5515
5616 /**
5717 * struct dpu_rm - DPU dynamic hardware resource manager
58
- * @dev: device handle for event logging purposes
59
- * @rsvps: list of hardware reservations by each crtc->encoder->connector
60
- * @hw_blks: array of lists of hardware resources present in the system, one
61
- * list per type of hardware block
62
- * @hw_mdp: hardware object for mdp_top
18
+ * @pingpong_blks: array of pingpong hardware resources
19
+ * @mixer_blks: array of layer mixer hardware resources
20
+ * @ctl_blks: array of ctl hardware resources
21
+ * @intf_blks: array of intf hardware resources
22
+ * @dspp_blks: array of dspp hardware resources
6323 * @lm_max_width: cached layer mixer maximum width
64
- * @rsvp_next_seq: sequence number for next reservation for debugging purposes
6524 * @rm_lock: resource manager mutex
6625 */
6726 struct dpu_rm {
68
- struct drm_device *dev;
69
- struct list_head rsvps;
70
- struct list_head hw_blks[DPU_HW_BLK_MAX];
71
- struct dpu_hw_mdp *hw_mdp;
27
+ struct dpu_hw_blk *pingpong_blks[PINGPONG_MAX - PINGPONG_0];
28
+ struct dpu_hw_blk *mixer_blks[LM_MAX - LM_0];
29
+ struct dpu_hw_blk *ctl_blks[CTL_MAX - CTL_0];
30
+ struct dpu_hw_blk *intf_blks[INTF_MAX - INTF_0];
31
+ struct dpu_hw_blk *dspp_blks[DSPP_MAX - DSPP_0];
32
+
7233 uint32_t lm_max_width;
73
- uint32_t rsvp_next_seq;
74
- struct mutex rm_lock;
75
-};
76
-
77
-/**
78
- * struct dpu_rm_hw_blk - resource manager internal structure
79
- * forward declaration for single iterator definition without void pointer
80
- */
81
-struct dpu_rm_hw_blk;
82
-
83
-/**
84
- * struct dpu_rm_hw_iter - iterator for use with dpu_rm
85
- * @hw: dpu_hw object requested, or NULL on failure
86
- * @blk: dpu_rm internal block representation. Clients ignore. Used as iterator.
87
- * @enc_id: DRM ID of Encoder client wishes to search for, or 0 for Any Encoder
88
- * @type: Hardware Block Type client wishes to search for.
89
- */
90
-struct dpu_rm_hw_iter {
91
- void *hw;
92
- struct dpu_rm_hw_blk *blk;
93
- uint32_t enc_id;
94
- enum dpu_hw_blk_type type;
9534 };
9635
9736 /**
....@@ -100,13 +39,11 @@
10039 * @rm: DPU Resource Manager handle
10140 * @cat: Pointer to hardware catalog
10241 * @mmio: mapped register io address of MDP
103
- * @dev: device handle for event logging purposes
10442 * @Return: 0 on Success otherwise -ERROR
10543 */
10644 int dpu_rm_init(struct dpu_rm *rm,
10745 struct dpu_mdss_cfg *cat,
108
- void __iomem *mmio,
109
- struct drm_device *dev);
46
+ void __iomem *mmio);
11047
11148 /**
11249 * dpu_rm_destroy - Free all memory allocated by dpu_rm_init
....@@ -125,17 +62,14 @@
12562 * @rm: DPU Resource Manager handle
12663 * @drm_enc: DRM Encoder handle
12764 * @crtc_state: Proposed Atomic DRM CRTC State handle
128
- * @conn_state: Proposed Atomic DRM Connector State handle
12965 * @topology: Pointer to topology info for the display
130
- * @test_only: Atomic-Test phase, discard results (unless property overrides)
13166 * @Return: 0 on Success otherwise -ERROR
13267 */
13368 int dpu_rm_reserve(struct dpu_rm *rm,
69
+ struct dpu_global_state *global_state,
13470 struct drm_encoder *drm_enc,
13571 struct drm_crtc_state *crtc_state,
136
- struct drm_connector_state *conn_state,
137
- struct msm_display_topology topology,
138
- bool test_only);
72
+ struct msm_display_topology topology);
13973
14074 /**
14175 * dpu_rm_reserve - Given the encoder for the display chain, release any
....@@ -144,56 +78,14 @@
14478 * @enc: DRM Encoder handle
14579 * @Return: 0 on Success otherwise -ERROR
14680 */
147
-void dpu_rm_release(struct dpu_rm *rm, struct drm_encoder *enc);
81
+void dpu_rm_release(struct dpu_global_state *global_state,
82
+ struct drm_encoder *enc);
14883
14984 /**
150
- * dpu_rm_get_mdp - Retrieve HW block for MDP TOP.
151
- * This is never reserved, and is usable by any display.
152
- * @rm: DPU Resource Manager handle
153
- * @Return: Pointer to hw block or NULL
85
+ * Get hw resources of the given type that are assigned to this encoder.
15486 */
155
-struct dpu_hw_mdp *dpu_rm_get_mdp(struct dpu_rm *rm);
156
-
157
-/**
158
- * dpu_rm_init_hw_iter - setup given iterator for new iteration over hw list
159
- * using dpu_rm_get_hw
160
- * @iter: iter object to initialize
161
- * @enc_id: DRM ID of Encoder client wishes to search for, or 0 for Any Encoder
162
- * @type: Hardware Block Type client wishes to search for.
163
- */
164
-void dpu_rm_init_hw_iter(
165
- struct dpu_rm_hw_iter *iter,
166
- uint32_t enc_id,
167
- enum dpu_hw_blk_type type);
168
-/**
169
- * dpu_rm_get_hw - retrieve reserved hw object given encoder and hw type
170
- * Meant to do a single pass through the hardware list to iteratively
171
- * retrieve hardware blocks of a given type for a given encoder.
172
- * Initialize an iterator object.
173
- * Set hw block type of interest. Set encoder id of interest, 0 for any.
174
- * Function returns first hw of type for that encoder.
175
- * Subsequent calls will return the next reserved hw of that type in-order.
176
- * Iterator HW pointer will be null on failure to find hw.
177
- * @rm: DPU Resource Manager handle
178
- * @iter: iterator object
179
- * @Return: true on match found, false on no match found
180
- */
181
-bool dpu_rm_get_hw(struct dpu_rm *rm, struct dpu_rm_hw_iter *iter);
182
-
183
-/**
184
- * dpu_rm_check_property_topctl - validate property bitmask before it is set
185
- * @val: user's proposed topology control bitmask
186
- * @Return: 0 on success or error
187
- */
188
-int dpu_rm_check_property_topctl(uint64_t val);
189
-
190
-/**
191
- * dpu_rm_get_topology_name - returns the name of the the given topology
192
- * definition
193
- * @topology: topology definition
194
- * @Return: name of the topology
195
- */
196
-enum dpu_rm_topology_name
197
-dpu_rm_get_topology_name(struct msm_display_topology topology);
198
-
87
+int dpu_rm_get_assigned_resources(struct dpu_rm *rm,
88
+ struct dpu_global_state *global_state, uint32_t enc_id,
89
+ enum dpu_hw_blk_type type, struct dpu_hw_blk **blks, int blks_size);
19990 #endif /* __DPU_RM_H__ */
91
+