This source file includes following definitions.
- mmhubbub2_config_mcif_buf
- mmhubbub2_config_mcif_arb
- mmhubbub2_config_mcif_irq
- mmhubbub2_enable_mcif
- mmhubbub2_disable_mcif
- mcifwb2_dump_frame
- dcn20_mmhubbub_construct
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 #include "reg_helper.h"
28 #include "resource.h"
29 #include "mcif_wb.h"
30 #include "dcn20_mmhubbub.h"
31
32
33 #define REG(reg)\
34 mcif_wb20->mcif_wb_regs->reg
35
36 #define CTX \
37 mcif_wb20->base.ctx
38
39 #undef FN
40 #define FN(reg_name, field_name) \
41 mcif_wb20->mcif_wb_shift->field_name, mcif_wb20->mcif_wb_mask->field_name
42
43 #define MCIF_ADDR(addr) (((unsigned long long)addr & 0xffffffffff) + 0xFE) >> 8
44 #define MCIF_ADDR_HIGH(addr) (unsigned long long)addr >> 40
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76 static void mmhubbub2_config_mcif_buf(struct mcif_wb *mcif_wb,
77 struct mcif_buf_params *params,
78 unsigned int dest_height)
79 {
80 struct dcn20_mmhubbub *mcif_wb20 = TO_DCN20_MMHUBBUB(mcif_wb);
81
82
83 REG_UPDATE(MCIF_WB_BUFMGR_SW_CONTROL, MCIF_WB_BUFMGR_SW_LOCK, params->swlock);
84
85
86 REG_UPDATE(MCIF_WB_BUF_1_ADDR_Y, MCIF_WB_BUF_1_ADDR_Y, MCIF_ADDR(params->luma_address[0]));
87 REG_UPDATE(MCIF_WB_BUF_1_ADDR_Y_HIGH, MCIF_WB_BUF_1_ADDR_Y_HIGH, MCIF_ADDR_HIGH(params->luma_address[0]));
88
89 REG_UPDATE(MCIF_WB_BUF_1_ADDR_Y_OFFSET, MCIF_WB_BUF_1_ADDR_Y_OFFSET, 0);
90
91
92 REG_UPDATE(MCIF_WB_BUF_1_ADDR_C, MCIF_WB_BUF_1_ADDR_C, MCIF_ADDR(params->chroma_address[0]));
93 REG_UPDATE(MCIF_WB_BUF_1_ADDR_C_HIGH, MCIF_WB_BUF_1_ADDR_C_HIGH, MCIF_ADDR_HIGH(params->chroma_address[0]));
94
95 REG_UPDATE(MCIF_WB_BUF_1_ADDR_C_OFFSET, MCIF_WB_BUF_1_ADDR_C_OFFSET, 0);
96
97
98 REG_UPDATE(MCIF_WB_BUF_2_ADDR_Y, MCIF_WB_BUF_2_ADDR_Y, MCIF_ADDR(params->luma_address[1]));
99 REG_UPDATE(MCIF_WB_BUF_2_ADDR_Y_HIGH, MCIF_WB_BUF_2_ADDR_Y_HIGH, MCIF_ADDR_HIGH(params->luma_address[1]));
100
101 REG_UPDATE(MCIF_WB_BUF_2_ADDR_Y_OFFSET, MCIF_WB_BUF_2_ADDR_Y_OFFSET, 0);
102
103
104 REG_UPDATE(MCIF_WB_BUF_2_ADDR_C, MCIF_WB_BUF_2_ADDR_C, MCIF_ADDR(params->chroma_address[1]));
105 REG_UPDATE(MCIF_WB_BUF_2_ADDR_C_HIGH, MCIF_WB_BUF_2_ADDR_C_HIGH, MCIF_ADDR_HIGH(params->chroma_address[1]));
106
107 REG_UPDATE(MCIF_WB_BUF_2_ADDR_C_OFFSET, MCIF_WB_BUF_2_ADDR_C_OFFSET, 0);
108
109
110 REG_UPDATE(MCIF_WB_BUF_3_ADDR_Y, MCIF_WB_BUF_3_ADDR_Y, MCIF_ADDR(params->luma_address[2]));
111 REG_UPDATE(MCIF_WB_BUF_3_ADDR_Y_HIGH, MCIF_WB_BUF_3_ADDR_Y_HIGH, MCIF_ADDR_HIGH(params->luma_address[2]));
112
113 REG_UPDATE(MCIF_WB_BUF_3_ADDR_Y_OFFSET, MCIF_WB_BUF_3_ADDR_Y_OFFSET, 0);
114
115
116 REG_UPDATE(MCIF_WB_BUF_3_ADDR_C, MCIF_WB_BUF_3_ADDR_C, MCIF_ADDR(params->chroma_address[2]));
117 REG_UPDATE(MCIF_WB_BUF_3_ADDR_C_HIGH, MCIF_WB_BUF_3_ADDR_C_HIGH, MCIF_ADDR_HIGH(params->chroma_address[2]));
118
119 REG_UPDATE(MCIF_WB_BUF_3_ADDR_C_OFFSET, MCIF_WB_BUF_3_ADDR_C_OFFSET, 0);
120
121
122 REG_UPDATE(MCIF_WB_BUF_4_ADDR_Y, MCIF_WB_BUF_4_ADDR_Y, MCIF_ADDR(params->luma_address[3]));
123 REG_UPDATE(MCIF_WB_BUF_4_ADDR_Y_HIGH, MCIF_WB_BUF_4_ADDR_Y_HIGH, MCIF_ADDR_HIGH(params->luma_address[3]));
124
125 REG_UPDATE(MCIF_WB_BUF_4_ADDR_Y_OFFSET, MCIF_WB_BUF_4_ADDR_Y_OFFSET, 0);
126
127
128 REG_UPDATE(MCIF_WB_BUF_4_ADDR_C, MCIF_WB_BUF_4_ADDR_C, MCIF_ADDR(params->chroma_address[3]));
129 REG_UPDATE(MCIF_WB_BUF_4_ADDR_C_HIGH, MCIF_WB_BUF_4_ADDR_C_HIGH, MCIF_ADDR_HIGH(params->chroma_address[3]));
130
131 REG_UPDATE(MCIF_WB_BUF_4_ADDR_C_OFFSET, MCIF_WB_BUF_4_ADDR_C_OFFSET, 0);
132
133
134
135
136
137 REG_UPDATE(MCIF_WB_BUF_LUMA_SIZE, MCIF_WB_BUF_LUMA_SIZE, (params->luma_pitch>>8) * dest_height);
138 REG_UPDATE(MCIF_WB_BUF_CHROMA_SIZE, MCIF_WB_BUF_CHROMA_SIZE, (params->chroma_pitch>>8) * dest_height);
139
140
141 REG_UPDATE(MCIF_WB_BUFMGR_SW_CONTROL, MCIF_WB_BUF_ADDR_FENCE_EN, 1);
142
143
144 REG_UPDATE_2(MCIF_WB_BUF_PITCH, MCIF_WB_BUF_LUMA_PITCH, params->luma_pitch >> 8,
145 MCIF_WB_BUF_CHROMA_PITCH, params->chroma_pitch >> 8);
146
147
148
149
150 REG_UPDATE(MCIF_WB_WARM_UP_CNTL, MCIF_WB_PITCH_SIZE_WARMUP, params->warmup_pitch);
151 }
152
153 static void mmhubbub2_config_mcif_arb(struct mcif_wb *mcif_wb,
154 struct mcif_arb_params *params)
155 {
156 struct dcn20_mmhubbub *mcif_wb20 = TO_DCN20_MMHUBBUB(mcif_wb);
157
158
159 REG_UPDATE(MCIF_WB_ARBITRATION_CONTROL, MCIF_WB_TIME_PER_PIXEL, params->time_per_pixel);
160
161
162
163
164 REG_UPDATE(MCIF_WB_SCLK_CHANGE, MCIF_WB_CLI_WATERMARK_MASK, 0x0);
165
166 REG_UPDATE(MCIF_WB_WATERMARK, MCIF_WB_CLI_WATERMARK, params->cli_watermark[0]);
167 REG_UPDATE(MCIF_WB_SCLK_CHANGE, MCIF_WB_CLI_WATERMARK_MASK, 0x1);
168
169 REG_UPDATE(MCIF_WB_WATERMARK, MCIF_WB_CLI_WATERMARK, params->cli_watermark[1]);
170 REG_UPDATE(MCIF_WB_SCLK_CHANGE, MCIF_WB_CLI_WATERMARK_MASK, 0x2);
171
172 REG_UPDATE(MCIF_WB_WATERMARK, MCIF_WB_CLI_WATERMARK, params->cli_watermark[2]);
173 REG_UPDATE(MCIF_WB_SCLK_CHANGE, MCIF_WB_CLI_WATERMARK_MASK, 0x3);
174
175 REG_UPDATE(MCIF_WB_WATERMARK, MCIF_WB_CLI_WATERMARK, params->cli_watermark[3]);
176
177
178
179 REG_UPDATE(MCIF_WB_NB_PSTATE_CONTROL, NB_PSTATE_CHANGE_WATERMARK_MASK, 0x0);
180 REG_UPDATE(MCIF_WB_NB_PSTATE_LATENCY_WATERMARK,
181 NB_PSTATE_CHANGE_REFRESH_WATERMARK, params->pstate_watermark[0]);
182
183 REG_UPDATE(MCIF_WB_NB_PSTATE_CONTROL, NB_PSTATE_CHANGE_WATERMARK_MASK, 0x1);
184 REG_UPDATE(MCIF_WB_NB_PSTATE_LATENCY_WATERMARK,
185 NB_PSTATE_CHANGE_REFRESH_WATERMARK, params->pstate_watermark[1]);
186
187 REG_UPDATE(MCIF_WB_NB_PSTATE_CONTROL, NB_PSTATE_CHANGE_WATERMARK_MASK, 0x2);
188 REG_UPDATE(MCIF_WB_NB_PSTATE_LATENCY_WATERMARK,
189 NB_PSTATE_CHANGE_REFRESH_WATERMARK, params->pstate_watermark[2]);
190
191 REG_UPDATE(MCIF_WB_NB_PSTATE_CONTROL, NB_PSTATE_CHANGE_WATERMARK_MASK, 0x3);
192 REG_UPDATE(MCIF_WB_NB_PSTATE_LATENCY_WATERMARK,
193 NB_PSTATE_CHANGE_REFRESH_WATERMARK, params->pstate_watermark[3]);
194
195
196 REG_UPDATE(MULTI_LEVEL_QOS_CTRL, MAX_SCALED_TIME_TO_URGENT, params->max_scaled_time);
197
198
199 REG_UPDATE(MCIF_WB_BUFMGR_VCE_CONTROL, MCIF_WB_BUFMGR_SLICE_SIZE, params->slice_lines-1);
200
201
202
203
204 REG_UPDATE(MCIF_WB_ARBITRATION_CONTROL, MCIF_WB_CLIENT_ARBITRATION_SLICE, params->arbitration_slice);
205 }
206
207 void mmhubbub2_config_mcif_irq(struct mcif_wb *mcif_wb,
208 struct mcif_irq_params *params)
209 {
210 struct dcn20_mmhubbub *mcif_wb20 = TO_DCN20_MMHUBBUB(mcif_wb);
211
212
213 REG_UPDATE(MCIF_WB_BUFMGR_SW_CONTROL, MCIF_WB_BUFMGR_SW_INT_EN, params->sw_int_en);
214 REG_UPDATE(MCIF_WB_BUFMGR_SW_CONTROL, MCIF_WB_BUFMGR_SW_SLICE_INT_EN, params->sw_slice_int_en);
215 REG_UPDATE(MCIF_WB_BUFMGR_SW_CONTROL, MCIF_WB_BUFMGR_SW_OVERRUN_INT_EN, params->sw_overrun_int_en);
216
217 REG_UPDATE(MCIF_WB_BUFMGR_VCE_CONTROL, MCIF_WB_BUFMGR_VCE_INT_EN, params->vce_int_en);
218 REG_UPDATE(MCIF_WB_BUFMGR_VCE_CONTROL, MCIF_WB_BUFMGR_VCE_SLICE_INT_EN, params->vce_slice_int_en);
219 }
220
221 void mmhubbub2_enable_mcif(struct mcif_wb *mcif_wb)
222 {
223 struct dcn20_mmhubbub *mcif_wb20 = TO_DCN20_MMHUBBUB(mcif_wb);
224
225
226 REG_UPDATE(MCIF_WB_BUFMGR_SW_CONTROL, MCIF_WB_BUFMGR_ENABLE, 1);
227 }
228
229 void mmhubbub2_disable_mcif(struct mcif_wb *mcif_wb)
230 {
231 struct dcn20_mmhubbub *mcif_wb20 = TO_DCN20_MMHUBBUB(mcif_wb);
232
233
234 REG_UPDATE(MCIF_WB_BUFMGR_SW_CONTROL, MCIF_WB_BUFMGR_ENABLE, 0);
235 }
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271 void mcifwb2_dump_frame(struct mcif_wb *mcif_wb,
272 struct mcif_buf_params *mcif_params,
273 enum dwb_scaler_mode out_format,
274 unsigned int dest_width,
275 unsigned int dest_height,
276 struct mcif_wb_frame_dump_info *dump_info,
277 unsigned char *luma_buffer,
278 unsigned char *chroma_buffer,
279 unsigned char *dest_luma_buffer,
280 unsigned char *dest_chroma_buffer)
281 {
282 struct dcn20_mmhubbub *mcif_wb20 = TO_DCN20_MMHUBBUB(mcif_wb);
283
284 REG_UPDATE(MCIF_WB_BUFMGR_SW_CONTROL, MCIF_WB_BUFMGR_SW_LOCK, 0xf);
285
286 memcpy(dest_luma_buffer, luma_buffer, mcif_params->luma_pitch * dest_height);
287 memcpy(dest_chroma_buffer, chroma_buffer, mcif_params->chroma_pitch * dest_height / 2);
288
289 REG_UPDATE(MCIF_WB_BUFMGR_SW_CONTROL, MCIF_WB_BUFMGR_SW_LOCK, 0x0);
290
291 dump_info->format = out_format;
292 dump_info->width = dest_width;
293 dump_info->height = dest_height;
294 dump_info->luma_pitch = mcif_params->luma_pitch;
295 dump_info->chroma_pitch = mcif_params->chroma_pitch;
296 dump_info->size = dest_height * (mcif_params->luma_pitch + mcif_params->chroma_pitch);
297 }
298
299 const struct mcif_wb_funcs dcn20_mmhubbub_funcs = {
300 .enable_mcif = mmhubbub2_enable_mcif,
301 .disable_mcif = mmhubbub2_disable_mcif,
302 .config_mcif_buf = mmhubbub2_config_mcif_buf,
303 .config_mcif_arb = mmhubbub2_config_mcif_arb,
304 .config_mcif_irq = mmhubbub2_config_mcif_irq,
305 .dump_frame = mcifwb2_dump_frame,
306 };
307
308 void dcn20_mmhubbub_construct(struct dcn20_mmhubbub *mcif_wb20,
309 struct dc_context *ctx,
310 const struct dcn20_mmhubbub_registers *mcif_wb_regs,
311 const struct dcn20_mmhubbub_shift *mcif_wb_shift,
312 const struct dcn20_mmhubbub_mask *mcif_wb_mask,
313 int inst)
314 {
315 mcif_wb20->base.ctx = ctx;
316
317 mcif_wb20->base.inst = inst;
318 mcif_wb20->base.funcs = &dcn20_mmhubbub_funcs;
319
320 mcif_wb20->mcif_wb_regs = mcif_wb_regs;
321 mcif_wb20->mcif_wb_shift = mcif_wb_shift;
322 mcif_wb20->mcif_wb_mask = mcif_wb_mask;
323 }