hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/gpu/drm/nouveau/dispnv50/head507d.c
....@@ -22,111 +22,141 @@
2222 #include "head.h"
2323 #include "core.h"
2424
25
-void
25
+#include <nvif/push507c.h>
26
+
27
+#include <nvhw/class/cl507d.h>
28
+
29
+int
2630 head507d_procamp(struct nv50_head *head, struct nv50_head_atom *asyh)
2731 {
28
- struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
29
- u32 *push;
30
- if ((push = evo_wait(core, 2))) {
31
- evo_mthd(push, 0x08a8 + (head->base.index * 0x400), 1);
32
- evo_data(push, asyh->procamp.sat.sin << 20 |
33
- asyh->procamp.sat.cos << 8);
34
- evo_kick(push, core);
35
- }
32
+ struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
33
+ const int i = head->base.index;
34
+ int ret;
35
+
36
+ if ((ret = PUSH_WAIT(push, 2)))
37
+ return ret;
38
+
39
+ PUSH_MTHD(push, NV507D, HEAD_SET_PROCAMP(i),
40
+ NVDEF(NV507D, HEAD_SET_PROCAMP, COLOR_SPACE, RGB) |
41
+ NVDEF(NV507D, HEAD_SET_PROCAMP, CHROMA_LPF, AUTO) |
42
+ NVVAL(NV507D, HEAD_SET_PROCAMP, SAT_COS, asyh->procamp.sat.cos) |
43
+ NVVAL(NV507D, HEAD_SET_PROCAMP, SAT_SINE, asyh->procamp.sat.sin) |
44
+ NVDEF(NV507D, HEAD_SET_PROCAMP, TRANSITION, HARD));
45
+ return 0;
3646 }
3747
38
-void
48
+int
3949 head507d_dither(struct nv50_head *head, struct nv50_head_atom *asyh)
4050 {
41
- struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
42
- u32 *push;
43
- if ((push = evo_wait(core, 2))) {
44
- evo_mthd(push, 0x08a0 + (head->base.index * 0x0400), 1);
45
- evo_data(push, asyh->dither.mode << 3 |
46
- asyh->dither.bits << 1 |
47
- asyh->dither.enable);
48
- evo_kick(push, core);
49
- }
51
+ struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
52
+ const int i = head->base.index;
53
+ int ret;
54
+
55
+ if ((ret = PUSH_WAIT(push, 2)))
56
+ return ret;
57
+
58
+ PUSH_MTHD(push, NV507D, HEAD_SET_DITHER_CONTROL(i),
59
+ NVVAL(NV507D, HEAD_SET_DITHER_CONTROL, ENABLE, asyh->dither.enable) |
60
+ NVVAL(NV507D, HEAD_SET_DITHER_CONTROL, BITS, asyh->dither.bits) |
61
+ NVVAL(NV507D, HEAD_SET_DITHER_CONTROL, MODE, asyh->dither.mode) |
62
+ NVVAL(NV507D, HEAD_SET_DITHER_CONTROL, PHASE, 0));
63
+ return 0;
5064 }
5165
52
-void
66
+int
5367 head507d_ovly(struct nv50_head *head, struct nv50_head_atom *asyh)
5468 {
55
- struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
69
+ struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
70
+ const int i = head->base.index;
5671 u32 bounds = 0;
57
- u32 *push;
72
+ int ret;
5873
5974 if (asyh->ovly.cpp) {
6075 switch (asyh->ovly.cpp) {
61
- case 4: bounds |= 0x00000300; break;
62
- case 2: bounds |= 0x00000100; break;
76
+ case 4: bounds |= NVDEF(NV507D, HEAD_SET_BASE_CHANNEL_USAGE_BOUNDS, PIXEL_DEPTH, BPP_32); break;
77
+ case 2: bounds |= NVDEF(NV507D, HEAD_SET_BASE_CHANNEL_USAGE_BOUNDS, PIXEL_DEPTH, BPP_16); break;
6378 default:
6479 WARN_ON(1);
6580 break;
6681 }
67
- bounds |= 0x00000001;
82
+ bounds |= NVDEF(NV507D, HEAD_SET_BASE_CHANNEL_USAGE_BOUNDS, USABLE, TRUE);
6883 } else {
69
- bounds |= 0x00000100;
84
+ bounds |= NVDEF(NV507D, HEAD_SET_BASE_CHANNEL_USAGE_BOUNDS, PIXEL_DEPTH, BPP_16);
7085 }
7186
72
- if ((push = evo_wait(core, 2))) {
73
- evo_mthd(push, 0x0904 + head->base.index * 0x400, 1);
74
- evo_data(push, bounds);
75
- evo_kick(push, core);
76
- }
87
+ if ((ret = PUSH_WAIT(push, 2)))
88
+ return ret;
89
+
90
+ PUSH_MTHD(push, NV507D, HEAD_SET_BASE_CHANNEL_USAGE_BOUNDS(i), bounds);
91
+ return 0;
7792 }
7893
79
-void
94
+int
8095 head507d_base(struct nv50_head *head, struct nv50_head_atom *asyh)
8196 {
82
- struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
97
+ struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
98
+ const int i = head->base.index;
8399 u32 bounds = 0;
84
- u32 *push;
100
+ int ret;
85101
86102 if (asyh->base.cpp) {
87103 switch (asyh->base.cpp) {
88
- case 8: bounds |= 0x00000500; break;
89
- case 4: bounds |= 0x00000300; break;
90
- case 2: bounds |= 0x00000100; break;
91
- case 1: bounds |= 0x00000000; break;
104
+ case 8: bounds |= NVDEF(NV507D, HEAD_SET_BASE_CHANNEL_USAGE_BOUNDS, PIXEL_DEPTH, BPP_64); break;
105
+ case 4: bounds |= NVDEF(NV507D, HEAD_SET_BASE_CHANNEL_USAGE_BOUNDS, PIXEL_DEPTH, BPP_32); break;
106
+ case 2: bounds |= NVDEF(NV507D, HEAD_SET_BASE_CHANNEL_USAGE_BOUNDS, PIXEL_DEPTH, BPP_16); break;
107
+ case 1: bounds |= NVDEF(NV507D, HEAD_SET_BASE_CHANNEL_USAGE_BOUNDS, PIXEL_DEPTH, BPP_8); break;
92108 default:
93109 WARN_ON(1);
94110 break;
95111 }
96
- bounds |= 0x00000001;
112
+ bounds |= NVDEF(NV507D, HEAD_SET_BASE_CHANNEL_USAGE_BOUNDS, USABLE, TRUE);
97113 }
98114
99
- if ((push = evo_wait(core, 2))) {
100
- evo_mthd(push, 0x0900 + head->base.index * 0x400, 1);
101
- evo_data(push, bounds);
102
- evo_kick(push, core);
103
- }
115
+ if ((ret = PUSH_WAIT(push, 2)))
116
+ return ret;
117
+
118
+ PUSH_MTHD(push, NV507D, HEAD_SET_BASE_CHANNEL_USAGE_BOUNDS(i), bounds);
119
+ return 0;
104120 }
105121
106
-static void
122
+static int
107123 head507d_curs_clr(struct nv50_head *head)
108124 {
109
- struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
110
- u32 *push;
111
- if ((push = evo_wait(core, 2))) {
112
- evo_mthd(push, 0x0880 + head->base.index * 0x400, 1);
113
- evo_data(push, 0x05000000);
114
- evo_kick(push, core);
115
- }
125
+ struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
126
+ const int i = head->base.index;
127
+ int ret;
128
+
129
+ if ((ret = PUSH_WAIT(push, 2)))
130
+ return ret;
131
+
132
+ PUSH_MTHD(push, NV507D, HEAD_SET_CONTROL_CURSOR(i),
133
+ NVDEF(NV507D, HEAD_SET_CONTROL_CURSOR, ENABLE, DISABLE) |
134
+ NVDEF(NV507D, HEAD_SET_CONTROL_CURSOR, FORMAT, A8R8G8B8) |
135
+ NVDEF(NV507D, HEAD_SET_CONTROL_CURSOR, SIZE, W64_H64));
136
+ return 0;
116137 }
117138
118
-static void
139
+static int
119140 head507d_curs_set(struct nv50_head *head, struct nv50_head_atom *asyh)
120141 {
121
- struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
122
- u32 *push;
123
- if ((push = evo_wait(core, 3))) {
124
- evo_mthd(push, 0x0880 + head->base.index * 0x400, 2);
125
- evo_data(push, 0x80000000 | asyh->curs.layout << 26 |
126
- asyh->curs.format << 24);
127
- evo_data(push, asyh->curs.offset >> 8);
128
- evo_kick(push, core);
129
- }
142
+ struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
143
+ const int i = head->base.index;
144
+ int ret;
145
+
146
+ if ((ret = PUSH_WAIT(push, 3)))
147
+ return ret;
148
+
149
+ PUSH_MTHD(push, NV507D, HEAD_SET_CONTROL_CURSOR(i),
150
+ NVDEF(NV507D, HEAD_SET_CONTROL_CURSOR, ENABLE, ENABLE) |
151
+ NVVAL(NV507D, HEAD_SET_CONTROL_CURSOR, FORMAT, asyh->curs.format) |
152
+ NVVAL(NV507D, HEAD_SET_CONTROL_CURSOR, SIZE, asyh->curs.layout) |
153
+ NVVAL(NV507D, HEAD_SET_CONTROL_CURSOR, HOT_SPOT_X, 0) |
154
+ NVVAL(NV507D, HEAD_SET_CONTROL_CURSOR, HOT_SPOT_Y, 0) |
155
+ NVDEF(NV507D, HEAD_SET_CONTROL_CURSOR, COMPOSITION, ALPHA_BLEND) |
156
+ NVDEF(NV507D, HEAD_SET_CONTROL_CURSOR, SUB_OWNER, NONE),
157
+
158
+ HEAD_SET_OFFSET_CURSOR(i), asyh->curs.offset >> 8);
159
+ return 0;
130160 }
131161
132162 int
....@@ -134,7 +164,7 @@
134164 struct nv50_head_atom *asyh)
135165 {
136166 switch (asyw->image.format) {
137
- case 0xcf: asyh->curs.format = 1; break;
167
+ case 0xcf: asyh->curs.format = NV507D_HEAD_SET_CONTROL_CURSOR_FORMAT_A8R8G8B8; break;
138168 default:
139169 WARN_ON(1);
140170 return -EINVAL;
....@@ -147,54 +177,70 @@
147177 struct nv50_head_atom *asyh)
148178 {
149179 switch (asyw->image.w) {
150
- case 32: asyh->curs.layout = 0; break;
151
- case 64: asyh->curs.layout = 1; break;
180
+ case 32: asyh->curs.layout = NV507D_HEAD_SET_CONTROL_CURSOR_SIZE_W32_H32; break;
181
+ case 64: asyh->curs.layout = NV507D_HEAD_SET_CONTROL_CURSOR_SIZE_W64_H64; break;
152182 default:
153183 return -EINVAL;
154184 }
155185 return 0;
156186 }
157187
158
-void
188
+int
159189 head507d_core_clr(struct nv50_head *head)
160190 {
161
- struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
162
- u32 *push;
163
- if ((push = evo_wait(core, 2))) {
164
- evo_mthd(push, 0x0874 + head->base.index * 0x400, 1);
165
- evo_data(push, 0x00000000);
166
- evo_kick(push, core);
167
- }
191
+ struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
192
+ const int i = head->base.index;
193
+ int ret;
194
+
195
+ if ((ret = PUSH_WAIT(push, 2)))
196
+ return ret;
197
+
198
+ PUSH_MTHD(push, NV507D, HEAD_SET_CONTEXT_DMA_ISO(i), 0x00000000);
199
+ return 0;
168200 }
169201
170
-static void
202
+static int
171203 head507d_core_set(struct nv50_head *head, struct nv50_head_atom *asyh)
172204 {
173
- struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
174
- u32 *push;
175
- if ((push = evo_wait(core, 9))) {
176
- evo_mthd(push, 0x0860 + head->base.index * 0x400, 1);
177
- evo_data(push, asyh->core.offset >> 8);
178
- evo_mthd(push, 0x0868 + head->base.index * 0x400, 4);
179
- evo_data(push, asyh->core.h << 16 | asyh->core.w);
180
- evo_data(push, asyh->core.layout << 20 |
181
- (asyh->core.pitch >> 8) << 8 |
182
- asyh->core.blocks << 8 |
183
- asyh->core.blockh);
184
- evo_data(push, asyh->core.kind << 16 |
185
- asyh->core.format << 8);
186
- evo_data(push, asyh->core.handle);
187
- evo_mthd(push, 0x08c0 + head->base.index * 0x400, 1);
188
- evo_data(push, asyh->core.y << 16 | asyh->core.x);
189
- evo_kick(push, core);
205
+ struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
206
+ const int i = head->base.index;
207
+ int ret;
190208
191
- /* EVO will complain with INVALID_STATE if we have an
192
- * active cursor and (re)specify HeadSetContextDmaIso
193
- * without also updating HeadSetOffsetCursor.
194
- */
195
- asyh->set.curs = asyh->curs.visible;
196
- asyh->set.olut = asyh->olut.handle != 0;
197
- }
209
+ if ((ret = PUSH_WAIT(push, 9)))
210
+ return ret;
211
+
212
+ PUSH_MTHD(push, NV507D, HEAD_SET_OFFSET(i, 0),
213
+ NVVAL(NV507D, HEAD_SET_OFFSET, ORIGIN, asyh->core.offset >> 8));
214
+
215
+ PUSH_MTHD(push, NV507D, HEAD_SET_SIZE(i),
216
+ NVVAL(NV507D, HEAD_SET_SIZE, WIDTH, asyh->core.w) |
217
+ NVVAL(NV507D, HEAD_SET_SIZE, HEIGHT, asyh->core.h),
218
+
219
+ HEAD_SET_STORAGE(i),
220
+ NVVAL(NV507D, HEAD_SET_STORAGE, BLOCK_HEIGHT, asyh->core.blockh) |
221
+ NVVAL(NV507D, HEAD_SET_STORAGE, PITCH, asyh->core.pitch >> 8) |
222
+ NVVAL(NV507D, HEAD_SET_STORAGE, PITCH, asyh->core.blocks) |
223
+ NVVAL(NV507D, HEAD_SET_STORAGE, MEMORY_LAYOUT, asyh->core.layout),
224
+
225
+ HEAD_SET_PARAMS(i),
226
+ NVVAL(NV507D, HEAD_SET_PARAMS, FORMAT, asyh->core.format) |
227
+ NVVAL(NV507D, HEAD_SET_PARAMS, KIND, asyh->core.kind) |
228
+ NVDEF(NV507D, HEAD_SET_PARAMS, PART_STRIDE, PARTSTRIDE_256),
229
+
230
+ HEAD_SET_CONTEXT_DMA_ISO(i),
231
+ NVVAL(NV507D, HEAD_SET_CONTEXT_DMA_ISO, HANDLE, asyh->core.handle));
232
+
233
+ PUSH_MTHD(push, NV507D, HEAD_SET_VIEWPORT_POINT_IN(i, 0),
234
+ NVVAL(NV507D, HEAD_SET_VIEWPORT_POINT_IN, X, asyh->core.x) |
235
+ NVVAL(NV507D, HEAD_SET_VIEWPORT_POINT_IN, Y, asyh->core.y));
236
+
237
+ /* EVO will complain with INVALID_STATE if we have an
238
+ * active cursor and (re)specify HeadSetContextDmaIso
239
+ * without also updating HeadSetOffsetCursor.
240
+ */
241
+ asyh->set.curs = asyh->curs.visible;
242
+ asyh->set.olut = asyh->olut.handle != 0;
243
+ return 0;
198244 }
199245
200246 void
....@@ -221,87 +267,164 @@
221267 }
222268 asyh->core.handle = disp->core->chan.vram.handle;
223269 asyh->core.offset = 0;
224
- asyh->core.format = 0xcf;
225
- asyh->core.kind = 0;
226
- asyh->core.layout = 1;
227
- asyh->core.blockh = 0;
270
+ asyh->core.format = NV507D_HEAD_SET_PARAMS_FORMAT_A8R8G8B8;
271
+ asyh->core.kind = NV507D_HEAD_SET_PARAMS_KIND_KIND_PITCH;
272
+ asyh->core.layout = NV507D_HEAD_SET_STORAGE_MEMORY_LAYOUT_PITCH;
273
+ asyh->core.blockh = NV507D_HEAD_SET_STORAGE_BLOCK_HEIGHT_ONE_GOB;
228274 asyh->core.blocks = 0;
229275 asyh->core.pitch = ALIGN(asyh->core.w, 64) * 4;
230276 }
231277
232
-static void
278
+static int
233279 head507d_olut_clr(struct nv50_head *head)
234280 {
235
- struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
236
- u32 *push;
237
- if ((push = evo_wait(core, 2))) {
238
- evo_mthd(push, 0x0840 + (head->base.index * 0x400), 1);
239
- evo_data(push, 0x00000000);
240
- evo_kick(push, core);
241
- }
281
+ struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
282
+ const int i = head->base.index;
283
+ int ret;
284
+
285
+ if ((ret = PUSH_WAIT(push, 2)))
286
+ return ret;
287
+
288
+ PUSH_MTHD(push, NV507D, HEAD_SET_BASE_LUT_LO(i),
289
+ NVDEF(NV507D, HEAD_SET_BASE_LUT_LO, ENABLE, DISABLE));
290
+ return 0;
291
+}
292
+
293
+static int
294
+head507d_olut_set(struct nv50_head *head, struct nv50_head_atom *asyh)
295
+{
296
+ struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
297
+ const int i = head->base.index;
298
+ int ret;
299
+
300
+ if ((ret = PUSH_WAIT(push, 3)))
301
+ return ret;
302
+
303
+ PUSH_MTHD(push, NV507D, HEAD_SET_BASE_LUT_LO(i),
304
+ NVDEF(NV507D, HEAD_SET_BASE_LUT_LO, ENABLE, ENABLE) |
305
+ NVVAL(NV507D, HEAD_SET_BASE_LUT_LO, MODE, asyh->olut.mode) |
306
+ NVVAL(NV507D, HEAD_SET_BASE_LUT_LO, ORIGIN, 0),
307
+
308
+ HEAD_SET_BASE_LUT_HI(i),
309
+ NVVAL(NV507D, HEAD_SET_BASE_LUT_HI, ORIGIN, asyh->olut.offset >> 8));
310
+ return 0;
242311 }
243312
244313 static void
245
-head507d_olut_set(struct nv50_head *head, struct nv50_head_atom *asyh)
314
+head507d_olut_load(struct drm_color_lut *in, int size, void __iomem *mem)
246315 {
247
- struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
248
- u32 *push;
249
- if ((push = evo_wait(core, 3))) {
250
- evo_mthd(push, 0x0840 + (head->base.index * 0x400), 2);
251
- evo_data(push, 0x80000000 | asyh->olut.mode << 30);
252
- evo_data(push, asyh->olut.offset >> 8);
253
- evo_kick(push, core);
316
+ for (; size--; in++, mem += 8) {
317
+ writew(drm_color_lut_extract(in-> red, 11) << 3, mem + 0);
318
+ writew(drm_color_lut_extract(in->green, 11) << 3, mem + 2);
319
+ writew(drm_color_lut_extract(in-> blue, 11) << 3, mem + 4);
254320 }
321
+
322
+ /* INTERPOLATE modes require a "next" entry to interpolate with,
323
+ * so we replicate the last entry to deal with this for now.
324
+ */
325
+ writew(readw(mem - 8), mem + 0);
326
+ writew(readw(mem - 6), mem + 2);
327
+ writew(readw(mem - 4), mem + 4);
255328 }
256329
257
-void
258
-head507d_olut(struct nv50_head *head, struct nv50_head_atom *asyh)
330
+bool
331
+head507d_olut(struct nv50_head *head, struct nv50_head_atom *asyh, int size)
259332 {
333
+ if (size != 256)
334
+ return false;
335
+
260336 if (asyh->base.cpp == 1)
261
- asyh->olut.mode = 0;
337
+ asyh->olut.mode = NV507D_HEAD_SET_BASE_LUT_LO_MODE_LORES;
262338 else
263
- asyh->olut.mode = 1;
339
+ asyh->olut.mode = NV507D_HEAD_SET_BASE_LUT_LO_MODE_HIRES;
340
+
341
+ asyh->olut.load = head507d_olut_load;
342
+ return true;
264343 }
265344
266
-void
345
+int
267346 head507d_mode(struct nv50_head *head, struct nv50_head_atom *asyh)
268347 {
269
- struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
348
+ struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
270349 struct nv50_head_mode *m = &asyh->mode;
271
- u32 *push;
272
- if ((push = evo_wait(core, 13))) {
273
- evo_mthd(push, 0x0804 + (head->base.index * 0x400), 2);
274
- evo_data(push, 0x00800000 | m->clock);
275
- evo_data(push, m->interlace ? 0x00000002 : 0x00000000);
276
- evo_mthd(push, 0x0810 + (head->base.index * 0x400), 7);
277
- evo_data(push, 0x00000000);
278
- evo_data(push, m->v.active << 16 | m->h.active );
279
- evo_data(push, m->v.synce << 16 | m->h.synce );
280
- evo_data(push, m->v.blanke << 16 | m->h.blanke );
281
- evo_data(push, m->v.blanks << 16 | m->h.blanks );
282
- evo_data(push, m->v.blank2e << 16 | m->v.blank2s);
283
- evo_data(push, asyh->mode.v.blankus);
284
- evo_mthd(push, 0x082c + (head->base.index * 0x400), 1);
285
- evo_data(push, 0x00000000);
286
- evo_kick(push, core);
287
- }
350
+ const int i = head->base.index;
351
+ int ret;
352
+
353
+ if ((ret = PUSH_WAIT(push, 13)))
354
+ return ret;
355
+
356
+ PUSH_MTHD(push, NV507D, HEAD_SET_PIXEL_CLOCK(i),
357
+ NVVAL(NV507D, HEAD_SET_PIXEL_CLOCK, FREQUENCY, m->clock) |
358
+ NVDEF(NV507D, HEAD_SET_PIXEL_CLOCK, MODE, CLK_CUSTOM) |
359
+ NVDEF(NV507D, HEAD_SET_PIXEL_CLOCK, ADJ1000DIV1001, FALSE) |
360
+ NVDEF(NV507D, HEAD_SET_PIXEL_CLOCK, NOT_DRIVER, FALSE),
361
+
362
+ HEAD_SET_CONTROL(i),
363
+ NVVAL(NV507D, HEAD_SET_CONTROL, STRUCTURE, m->interlace));
364
+
365
+ PUSH_MTHD(push, NV507D, HEAD_SET_OVERSCAN_COLOR(i),
366
+ NVVAL(NV507D, HEAD_SET_OVERSCAN_COLOR, RED, 0) |
367
+ NVVAL(NV507D, HEAD_SET_OVERSCAN_COLOR, GRN, 0) |
368
+ NVVAL(NV507D, HEAD_SET_OVERSCAN_COLOR, BLU, 0),
369
+
370
+ HEAD_SET_RASTER_SIZE(i),
371
+ NVVAL(NV507D, HEAD_SET_RASTER_SIZE, WIDTH, m->h.active) |
372
+ NVVAL(NV507D, HEAD_SET_RASTER_SIZE, HEIGHT, m->v.active),
373
+
374
+ HEAD_SET_RASTER_SYNC_END(i),
375
+ NVVAL(NV507D, HEAD_SET_RASTER_SYNC_END, X, m->h.synce) |
376
+ NVVAL(NV507D, HEAD_SET_RASTER_SYNC_END, Y, m->v.synce),
377
+
378
+ HEAD_SET_RASTER_BLANK_END(i),
379
+ NVVAL(NV507D, HEAD_SET_RASTER_BLANK_END, X, m->h.blanke) |
380
+ NVVAL(NV507D, HEAD_SET_RASTER_BLANK_END, Y, m->v.blanke),
381
+
382
+ HEAD_SET_RASTER_BLANK_START(i),
383
+ NVVAL(NV507D, HEAD_SET_RASTER_BLANK_START, X, m->h.blanks) |
384
+ NVVAL(NV507D, HEAD_SET_RASTER_BLANK_START, Y, m->v.blanks),
385
+
386
+ HEAD_SET_RASTER_VERT_BLANK2(i),
387
+ NVVAL(NV507D, HEAD_SET_RASTER_VERT_BLANK2, YSTART, m->v.blank2s) |
388
+ NVVAL(NV507D, HEAD_SET_RASTER_VERT_BLANK2, YEND, m->v.blank2e),
389
+
390
+ HEAD_SET_RASTER_VERT_BLANK_DMI(i),
391
+ NVVAL(NV507D, HEAD_SET_RASTER_VERT_BLANK_DMI, DURATION, m->v.blankus));
392
+
393
+ PUSH_MTHD(push, NV507D, HEAD_SET_DEFAULT_BASE_COLOR(i),
394
+ NVVAL(NV507D, HEAD_SET_DEFAULT_BASE_COLOR, RED, 0) |
395
+ NVVAL(NV507D, HEAD_SET_DEFAULT_BASE_COLOR, GREEN, 0) |
396
+ NVVAL(NV507D, HEAD_SET_DEFAULT_BASE_COLOR, BLUE, 0));
397
+ return 0;
288398 }
289399
290
-void
400
+int
291401 head507d_view(struct nv50_head *head, struct nv50_head_atom *asyh)
292402 {
293
- struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
294
- u32 *push;
295
- if ((push = evo_wait(core, 7))) {
296
- evo_mthd(push, 0x08a4 + (head->base.index * 0x400), 1);
297
- evo_data(push, 0x00000000);
298
- evo_mthd(push, 0x08c8 + (head->base.index * 0x400), 1);
299
- evo_data(push, asyh->view.iH << 16 | asyh->view.iW);
300
- evo_mthd(push, 0x08d8 + (head->base.index * 0x400), 2);
301
- evo_data(push, asyh->view.oH << 16 | asyh->view.oW);
302
- evo_data(push, asyh->view.oH << 16 | asyh->view.oW);
303
- evo_kick(push, core);
304
- }
403
+ struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
404
+ const int i = head->base.index;
405
+ int ret;
406
+
407
+ if ((ret = PUSH_WAIT(push, 7)))
408
+ return ret;
409
+
410
+ PUSH_MTHD(push, NV507D, HEAD_SET_CONTROL_OUTPUT_SCALER(i),
411
+ NVDEF(NV507D, HEAD_SET_CONTROL_OUTPUT_SCALER, VERTICAL_TAPS, TAPS_1) |
412
+ NVDEF(NV507D, HEAD_SET_CONTROL_OUTPUT_SCALER, HORIZONTAL_TAPS, TAPS_1) |
413
+ NVVAL(NV507D, HEAD_SET_CONTROL_OUTPUT_SCALER, HRESPONSE_BIAS, 0) |
414
+ NVVAL(NV507D, HEAD_SET_CONTROL_OUTPUT_SCALER, VRESPONSE_BIAS, 0));
415
+
416
+ PUSH_MTHD(push, NV507D, HEAD_SET_VIEWPORT_SIZE_IN(i),
417
+ NVVAL(NV507D, HEAD_SET_VIEWPORT_SIZE_IN, WIDTH, asyh->view.iW) |
418
+ NVVAL(NV507D, HEAD_SET_VIEWPORT_SIZE_IN, HEIGHT, asyh->view.iH));
419
+
420
+ PUSH_MTHD(push, NV507D, HEAD_SET_VIEWPORT_SIZE_OUT(i),
421
+ NVVAL(NV507D, HEAD_SET_VIEWPORT_SIZE_OUT, WIDTH, asyh->view.oW) |
422
+ NVVAL(NV507D, HEAD_SET_VIEWPORT_SIZE_OUT, HEIGHT, asyh->view.oH),
423
+
424
+ HEAD_SET_VIEWPORT_SIZE_OUT_MIN(i),
425
+ NVVAL(NV507D, HEAD_SET_VIEWPORT_SIZE_OUT_MIN, WIDTH, asyh->view.oW) |
426
+ NVVAL(NV507D, HEAD_SET_VIEWPORT_SIZE_OUT_MIN, HEIGHT, asyh->view.oH));
427
+ return 0;
305428 }
306429
307430 const struct nv50_head_func
....@@ -309,6 +432,7 @@
309432 .view = head507d_view,
310433 .mode = head507d_mode,
311434 .olut = head507d_olut,
435
+ .olut_size = 256,
312436 .olut_set = head507d_olut_set,
313437 .olut_clr = head507d_olut_clr,
314438 .core_calc = head507d_core_calc,