blob: 412979352c3586082d7a96b06593193a2382de2f [file] [log] [blame]
Ben Skeggs6ee73862009-12-11 19:24:15 +10001/*
2 * Copyright 2007 Stephane Marchesin
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25#include "drmP.h"
26#include "drm.h"
27#include "nouveau_drm.h"
28#include "nouveau_drv.h"
Francisco Jerez332b2422010-10-20 23:35:40 +020029#include "nouveau_hw.h"
Ben Skeggs274fec92010-11-03 13:16:18 +100030#include "nouveau_util.h"
Ben Skeggs4ea52f82011-03-31 13:44:16 +100031#include "nouveau_ramht.h"
Ben Skeggs6ee73862009-12-11 19:24:15 +100032
Ben Skeggs49769862011-04-01 13:03:56 +100033struct nv04_graph_engine {
34 struct nouveau_exec_engine base;
35};
Ben Skeggsb8c157d2010-10-20 10:39:35 +100036
Ben Skeggs6ee73862009-12-11 19:24:15 +100037static uint32_t nv04_graph_ctx_regs[] = {
Francisco Jerezea911a12009-12-26 14:39:46 +010038 0x0040053c,
39 0x00400544,
40 0x00400540,
41 0x00400548,
Ben Skeggs6ee73862009-12-11 19:24:15 +100042 NV04_PGRAPH_CTX_SWITCH1,
43 NV04_PGRAPH_CTX_SWITCH2,
44 NV04_PGRAPH_CTX_SWITCH3,
45 NV04_PGRAPH_CTX_SWITCH4,
46 NV04_PGRAPH_CTX_CACHE1,
47 NV04_PGRAPH_CTX_CACHE2,
48 NV04_PGRAPH_CTX_CACHE3,
49 NV04_PGRAPH_CTX_CACHE4,
50 0x00400184,
51 0x004001a4,
52 0x004001c4,
53 0x004001e4,
54 0x00400188,
55 0x004001a8,
56 0x004001c8,
57 0x004001e8,
58 0x0040018c,
59 0x004001ac,
60 0x004001cc,
61 0x004001ec,
62 0x00400190,
63 0x004001b0,
64 0x004001d0,
65 0x004001f0,
66 0x00400194,
67 0x004001b4,
68 0x004001d4,
69 0x004001f4,
70 0x00400198,
71 0x004001b8,
72 0x004001d8,
73 0x004001f8,
74 0x0040019c,
75 0x004001bc,
76 0x004001dc,
77 0x004001fc,
78 0x00400174,
79 NV04_PGRAPH_DMA_START_0,
80 NV04_PGRAPH_DMA_START_1,
81 NV04_PGRAPH_DMA_LENGTH,
82 NV04_PGRAPH_DMA_MISC,
83 NV04_PGRAPH_DMA_PITCH,
84 NV04_PGRAPH_BOFFSET0,
85 NV04_PGRAPH_BBASE0,
86 NV04_PGRAPH_BLIMIT0,
87 NV04_PGRAPH_BOFFSET1,
88 NV04_PGRAPH_BBASE1,
89 NV04_PGRAPH_BLIMIT1,
90 NV04_PGRAPH_BOFFSET2,
91 NV04_PGRAPH_BBASE2,
92 NV04_PGRAPH_BLIMIT2,
93 NV04_PGRAPH_BOFFSET3,
94 NV04_PGRAPH_BBASE3,
95 NV04_PGRAPH_BLIMIT3,
96 NV04_PGRAPH_BOFFSET4,
97 NV04_PGRAPH_BBASE4,
98 NV04_PGRAPH_BLIMIT4,
99 NV04_PGRAPH_BOFFSET5,
100 NV04_PGRAPH_BBASE5,
101 NV04_PGRAPH_BLIMIT5,
102 NV04_PGRAPH_BPITCH0,
103 NV04_PGRAPH_BPITCH1,
104 NV04_PGRAPH_BPITCH2,
105 NV04_PGRAPH_BPITCH3,
106 NV04_PGRAPH_BPITCH4,
107 NV04_PGRAPH_SURFACE,
108 NV04_PGRAPH_STATE,
109 NV04_PGRAPH_BSWIZZLE2,
110 NV04_PGRAPH_BSWIZZLE5,
111 NV04_PGRAPH_BPIXEL,
112 NV04_PGRAPH_NOTIFY,
113 NV04_PGRAPH_PATT_COLOR0,
114 NV04_PGRAPH_PATT_COLOR1,
115 NV04_PGRAPH_PATT_COLORRAM+0x00,
Ben Skeggs6ee73862009-12-11 19:24:15 +1000116 NV04_PGRAPH_PATT_COLORRAM+0x04,
Ben Skeggs6ee73862009-12-11 19:24:15 +1000117 NV04_PGRAPH_PATT_COLORRAM+0x08,
Francisco Jerezea911a12009-12-26 14:39:46 +0100118 NV04_PGRAPH_PATT_COLORRAM+0x0c,
Ben Skeggs6ee73862009-12-11 19:24:15 +1000119 NV04_PGRAPH_PATT_COLORRAM+0x10,
Ben Skeggs6ee73862009-12-11 19:24:15 +1000120 NV04_PGRAPH_PATT_COLORRAM+0x14,
Ben Skeggs6ee73862009-12-11 19:24:15 +1000121 NV04_PGRAPH_PATT_COLORRAM+0x18,
Francisco Jerezea911a12009-12-26 14:39:46 +0100122 NV04_PGRAPH_PATT_COLORRAM+0x1c,
Ben Skeggs6ee73862009-12-11 19:24:15 +1000123 NV04_PGRAPH_PATT_COLORRAM+0x20,
Ben Skeggs6ee73862009-12-11 19:24:15 +1000124 NV04_PGRAPH_PATT_COLORRAM+0x24,
Ben Skeggs6ee73862009-12-11 19:24:15 +1000125 NV04_PGRAPH_PATT_COLORRAM+0x28,
Francisco Jerezea911a12009-12-26 14:39:46 +0100126 NV04_PGRAPH_PATT_COLORRAM+0x2c,
Ben Skeggs6ee73862009-12-11 19:24:15 +1000127 NV04_PGRAPH_PATT_COLORRAM+0x30,
Ben Skeggs6ee73862009-12-11 19:24:15 +1000128 NV04_PGRAPH_PATT_COLORRAM+0x34,
Ben Skeggs6ee73862009-12-11 19:24:15 +1000129 NV04_PGRAPH_PATT_COLORRAM+0x38,
Francisco Jerezea911a12009-12-26 14:39:46 +0100130 NV04_PGRAPH_PATT_COLORRAM+0x3c,
131 NV04_PGRAPH_PATT_COLORRAM+0x40,
132 NV04_PGRAPH_PATT_COLORRAM+0x44,
133 NV04_PGRAPH_PATT_COLORRAM+0x48,
134 NV04_PGRAPH_PATT_COLORRAM+0x4c,
135 NV04_PGRAPH_PATT_COLORRAM+0x50,
136 NV04_PGRAPH_PATT_COLORRAM+0x54,
137 NV04_PGRAPH_PATT_COLORRAM+0x58,
138 NV04_PGRAPH_PATT_COLORRAM+0x5c,
139 NV04_PGRAPH_PATT_COLORRAM+0x60,
140 NV04_PGRAPH_PATT_COLORRAM+0x64,
141 NV04_PGRAPH_PATT_COLORRAM+0x68,
142 NV04_PGRAPH_PATT_COLORRAM+0x6c,
143 NV04_PGRAPH_PATT_COLORRAM+0x70,
144 NV04_PGRAPH_PATT_COLORRAM+0x74,
145 NV04_PGRAPH_PATT_COLORRAM+0x78,
146 NV04_PGRAPH_PATT_COLORRAM+0x7c,
147 NV04_PGRAPH_PATT_COLORRAM+0x80,
148 NV04_PGRAPH_PATT_COLORRAM+0x84,
149 NV04_PGRAPH_PATT_COLORRAM+0x88,
150 NV04_PGRAPH_PATT_COLORRAM+0x8c,
151 NV04_PGRAPH_PATT_COLORRAM+0x90,
152 NV04_PGRAPH_PATT_COLORRAM+0x94,
153 NV04_PGRAPH_PATT_COLORRAM+0x98,
154 NV04_PGRAPH_PATT_COLORRAM+0x9c,
155 NV04_PGRAPH_PATT_COLORRAM+0xa0,
156 NV04_PGRAPH_PATT_COLORRAM+0xa4,
157 NV04_PGRAPH_PATT_COLORRAM+0xa8,
158 NV04_PGRAPH_PATT_COLORRAM+0xac,
159 NV04_PGRAPH_PATT_COLORRAM+0xb0,
160 NV04_PGRAPH_PATT_COLORRAM+0xb4,
161 NV04_PGRAPH_PATT_COLORRAM+0xb8,
162 NV04_PGRAPH_PATT_COLORRAM+0xbc,
163 NV04_PGRAPH_PATT_COLORRAM+0xc0,
164 NV04_PGRAPH_PATT_COLORRAM+0xc4,
165 NV04_PGRAPH_PATT_COLORRAM+0xc8,
166 NV04_PGRAPH_PATT_COLORRAM+0xcc,
167 NV04_PGRAPH_PATT_COLORRAM+0xd0,
168 NV04_PGRAPH_PATT_COLORRAM+0xd4,
169 NV04_PGRAPH_PATT_COLORRAM+0xd8,
170 NV04_PGRAPH_PATT_COLORRAM+0xdc,
171 NV04_PGRAPH_PATT_COLORRAM+0xe0,
172 NV04_PGRAPH_PATT_COLORRAM+0xe4,
173 NV04_PGRAPH_PATT_COLORRAM+0xe8,
174 NV04_PGRAPH_PATT_COLORRAM+0xec,
175 NV04_PGRAPH_PATT_COLORRAM+0xf0,
176 NV04_PGRAPH_PATT_COLORRAM+0xf4,
177 NV04_PGRAPH_PATT_COLORRAM+0xf8,
178 NV04_PGRAPH_PATT_COLORRAM+0xfc,
Ben Skeggs6ee73862009-12-11 19:24:15 +1000179 NV04_PGRAPH_PATTERN,
180 0x0040080c,
181 NV04_PGRAPH_PATTERN_SHAPE,
182 0x00400600,
183 NV04_PGRAPH_ROP3,
184 NV04_PGRAPH_CHROMA,
185 NV04_PGRAPH_BETA_AND,
186 NV04_PGRAPH_BETA_PREMULT,
187 NV04_PGRAPH_CONTROL0,
188 NV04_PGRAPH_CONTROL1,
189 NV04_PGRAPH_CONTROL2,
190 NV04_PGRAPH_BLEND,
191 NV04_PGRAPH_STORED_FMT,
192 NV04_PGRAPH_SOURCE_COLOR,
193 0x00400560,
194 0x00400568,
195 0x00400564,
196 0x0040056c,
197 0x00400400,
198 0x00400480,
199 0x00400404,
200 0x00400484,
201 0x00400408,
202 0x00400488,
203 0x0040040c,
204 0x0040048c,
205 0x00400410,
206 0x00400490,
207 0x00400414,
208 0x00400494,
209 0x00400418,
210 0x00400498,
211 0x0040041c,
212 0x0040049c,
213 0x00400420,
214 0x004004a0,
215 0x00400424,
216 0x004004a4,
217 0x00400428,
218 0x004004a8,
219 0x0040042c,
220 0x004004ac,
221 0x00400430,
222 0x004004b0,
223 0x00400434,
224 0x004004b4,
225 0x00400438,
226 0x004004b8,
227 0x0040043c,
228 0x004004bc,
229 0x00400440,
230 0x004004c0,
231 0x00400444,
232 0x004004c4,
233 0x00400448,
234 0x004004c8,
235 0x0040044c,
236 0x004004cc,
237 0x00400450,
238 0x004004d0,
239 0x00400454,
240 0x004004d4,
241 0x00400458,
242 0x004004d8,
243 0x0040045c,
244 0x004004dc,
245 0x00400460,
246 0x004004e0,
247 0x00400464,
248 0x004004e4,
249 0x00400468,
250 0x004004e8,
251 0x0040046c,
252 0x004004ec,
253 0x00400470,
254 0x004004f0,
255 0x00400474,
256 0x004004f4,
257 0x00400478,
258 0x004004f8,
259 0x0040047c,
260 0x004004fc,
Ben Skeggs6ee73862009-12-11 19:24:15 +1000261 0x00400534,
262 0x00400538,
263 0x00400514,
264 0x00400518,
265 0x0040051c,
266 0x00400520,
267 0x00400524,
268 0x00400528,
269 0x0040052c,
270 0x00400530,
271 0x00400d00,
272 0x00400d40,
273 0x00400d80,
274 0x00400d04,
275 0x00400d44,
276 0x00400d84,
277 0x00400d08,
278 0x00400d48,
279 0x00400d88,
280 0x00400d0c,
281 0x00400d4c,
282 0x00400d8c,
283 0x00400d10,
284 0x00400d50,
285 0x00400d90,
286 0x00400d14,
287 0x00400d54,
288 0x00400d94,
289 0x00400d18,
290 0x00400d58,
291 0x00400d98,
292 0x00400d1c,
293 0x00400d5c,
294 0x00400d9c,
295 0x00400d20,
296 0x00400d60,
297 0x00400da0,
298 0x00400d24,
299 0x00400d64,
300 0x00400da4,
301 0x00400d28,
302 0x00400d68,
303 0x00400da8,
304 0x00400d2c,
305 0x00400d6c,
306 0x00400dac,
307 0x00400d30,
308 0x00400d70,
309 0x00400db0,
310 0x00400d34,
311 0x00400d74,
312 0x00400db4,
313 0x00400d38,
314 0x00400d78,
315 0x00400db8,
316 0x00400d3c,
317 0x00400d7c,
318 0x00400dbc,
319 0x00400590,
320 0x00400594,
321 0x00400598,
322 0x0040059c,
323 0x004005a8,
324 0x004005ac,
325 0x004005b0,
326 0x004005b4,
327 0x004005c0,
328 0x004005c4,
329 0x004005c8,
330 0x004005cc,
331 0x004005d0,
332 0x004005d4,
333 0x004005d8,
334 0x004005dc,
335 0x004005e0,
336 NV04_PGRAPH_PASSTHRU_0,
337 NV04_PGRAPH_PASSTHRU_1,
338 NV04_PGRAPH_PASSTHRU_2,
339 NV04_PGRAPH_DVD_COLORFMT,
340 NV04_PGRAPH_SCALED_FORMAT,
341 NV04_PGRAPH_MISC24_0,
342 NV04_PGRAPH_MISC24_1,
343 NV04_PGRAPH_MISC24_2,
344 0x00400500,
345 0x00400504,
346 NV04_PGRAPH_VALID1,
Francisco Jerezea911a12009-12-26 14:39:46 +0100347 NV04_PGRAPH_VALID2,
348 NV04_PGRAPH_DEBUG_3
Ben Skeggs6ee73862009-12-11 19:24:15 +1000349};
350
351struct graph_state {
Francisco Jerez6e86e042010-07-03 18:36:39 +0200352 uint32_t nv04[ARRAY_SIZE(nv04_graph_ctx_regs)];
Ben Skeggs6ee73862009-12-11 19:24:15 +1000353};
354
Ben Skeggs49769862011-04-01 13:03:56 +1000355static struct nouveau_channel *
Ben Skeggs6ee73862009-12-11 19:24:15 +1000356nv04_graph_channel(struct drm_device *dev)
357{
358 struct drm_nouveau_private *dev_priv = dev->dev_private;
359 int chid = dev_priv->engine.fifo.channels;
360
361 if (nv_rd32(dev, NV04_PGRAPH_CTX_CONTROL) & 0x00010000)
362 chid = nv_rd32(dev, NV04_PGRAPH_CTX_USER) >> 24;
363
364 if (chid >= dev_priv->engine.fifo.channels)
365 return NULL;
366
Ben Skeggscff5c132010-10-06 16:16:59 +1000367 return dev_priv->channels.ptr[chid];
Ben Skeggs6ee73862009-12-11 19:24:15 +1000368}
369
Francisco Jerezea911a12009-12-26 14:39:46 +0100370static uint32_t *ctx_reg(struct graph_state *ctx, uint32_t reg)
371{
372 int i;
373
374 for (i = 0; i < ARRAY_SIZE(nv04_graph_ctx_regs); i++) {
375 if (nv04_graph_ctx_regs[i] == reg)
376 return &ctx->nv04[i];
377 }
378
379 return NULL;
380}
381
Ben Skeggs49769862011-04-01 13:03:56 +1000382static int
383nv04_graph_load_context(struct nouveau_channel *chan)
Ben Skeggs6ee73862009-12-11 19:24:15 +1000384{
Ben Skeggs49769862011-04-01 13:03:56 +1000385 struct graph_state *pgraph_ctx = chan->engctx[NVOBJ_ENGINE_GR];
Francisco Jerez3945e472010-10-18 03:53:39 +0200386 struct drm_device *dev = chan->dev;
Ben Skeggs6ee73862009-12-11 19:24:15 +1000387 uint32_t tmp;
388 int i;
389
390 for (i = 0; i < ARRAY_SIZE(nv04_graph_ctx_regs); i++)
391 nv_wr32(dev, nv04_graph_ctx_regs[i], pgraph_ctx->nv04[i]);
392
393 nv_wr32(dev, NV04_PGRAPH_CTX_CONTROL, 0x10010100);
Francisco Jerezea911a12009-12-26 14:39:46 +0100394
395 tmp = nv_rd32(dev, NV04_PGRAPH_CTX_USER) & 0x00ffffff;
396 nv_wr32(dev, NV04_PGRAPH_CTX_USER, tmp | chan->id << 24);
397
Ben Skeggs6ee73862009-12-11 19:24:15 +1000398 tmp = nv_rd32(dev, NV04_PGRAPH_FFINTFC_ST2);
399 nv_wr32(dev, NV04_PGRAPH_FFINTFC_ST2, tmp & 0x000fffff);
Francisco Jerezea911a12009-12-26 14:39:46 +0100400
Ben Skeggs6ee73862009-12-11 19:24:15 +1000401 return 0;
402}
403
Ben Skeggs49769862011-04-01 13:03:56 +1000404static int
Ben Skeggs6ee73862009-12-11 19:24:15 +1000405nv04_graph_unload_context(struct drm_device *dev)
406{
407 struct drm_nouveau_private *dev_priv = dev->dev_private;
Ben Skeggs6ee73862009-12-11 19:24:15 +1000408 struct nouveau_channel *chan = NULL;
409 struct graph_state *ctx;
410 uint32_t tmp;
411 int i;
412
Ben Skeggs49769862011-04-01 13:03:56 +1000413 chan = nv04_graph_channel(dev);
Ben Skeggs6ee73862009-12-11 19:24:15 +1000414 if (!chan)
415 return 0;
Ben Skeggs49769862011-04-01 13:03:56 +1000416 ctx = chan->engctx[NVOBJ_ENGINE_GR];
Ben Skeggs6ee73862009-12-11 19:24:15 +1000417
418 for (i = 0; i < ARRAY_SIZE(nv04_graph_ctx_regs); i++)
419 ctx->nv04[i] = nv_rd32(dev, nv04_graph_ctx_regs[i]);
420
421 nv_wr32(dev, NV04_PGRAPH_CTX_CONTROL, 0x10000000);
422 tmp = nv_rd32(dev, NV04_PGRAPH_CTX_USER) & 0x00ffffff;
423 tmp |= (dev_priv->engine.fifo.channels - 1) << 24;
424 nv_wr32(dev, NV04_PGRAPH_CTX_USER, tmp);
425 return 0;
426}
427
Ben Skeggs49769862011-04-01 13:03:56 +1000428static int
429nv04_graph_context_new(struct nouveau_channel *chan, int engine)
430{
431 struct graph_state *pgraph_ctx;
432 NV_DEBUG(chan->dev, "nv04_graph_context_create %d\n", chan->id);
433
434 pgraph_ctx = kzalloc(sizeof(*pgraph_ctx), GFP_KERNEL);
435 if (pgraph_ctx == NULL)
436 return -ENOMEM;
437
438 *ctx_reg(pgraph_ctx, NV04_PGRAPH_DEBUG_3) = 0xfad4ff31;
439
440 chan->engctx[engine] = pgraph_ctx;
441 return 0;
442}
443
444static void
445nv04_graph_context_del(struct nouveau_channel *chan, int engine)
446{
447 struct drm_device *dev = chan->dev;
448 struct drm_nouveau_private *dev_priv = dev->dev_private;
449 struct graph_state *pgraph_ctx = chan->engctx[engine];
450 unsigned long flags;
451
452 spin_lock_irqsave(&dev_priv->context_switch_lock, flags);
Ben Skeggs70ad25a2011-07-20 11:04:46 +1000453 nv_mask(dev, NV04_PGRAPH_FIFO, 0x00000001, 0x00000000);
Ben Skeggs49769862011-04-01 13:03:56 +1000454
455 /* Unload the context if it's the currently active one */
456 if (nv04_graph_channel(dev) == chan)
457 nv04_graph_unload_context(dev);
458
Ben Skeggs70ad25a2011-07-20 11:04:46 +1000459 nv_mask(dev, NV04_PGRAPH_FIFO, 0x00000001, 0x00000001);
Ben Skeggs49769862011-04-01 13:03:56 +1000460 spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags);
461
462 /* Free the context resources */
463 kfree(pgraph_ctx);
464 chan->engctx[engine] = NULL;
465}
466
Ben Skeggs4ea52f82011-03-31 13:44:16 +1000467int
Ben Skeggs49769862011-04-01 13:03:56 +1000468nv04_graph_object_new(struct nouveau_channel *chan, int engine,
469 u32 handle, u16 class)
Ben Skeggs4ea52f82011-03-31 13:44:16 +1000470{
471 struct drm_device *dev = chan->dev;
472 struct nouveau_gpuobj *obj = NULL;
473 int ret;
474
475 ret = nouveau_gpuobj_new(dev, chan, 16, 16, NVOBJ_FLAG_ZERO_FREE, &obj);
476 if (ret)
477 return ret;
478 obj->engine = 1;
479 obj->class = class;
480
481#ifdef __BIG_ENDIAN
482 nv_wo32(obj, 0x00, 0x00080000 | class);
483#else
484 nv_wo32(obj, 0x00, class);
485#endif
486 nv_wo32(obj, 0x04, 0x00000000);
487 nv_wo32(obj, 0x08, 0x00000000);
488 nv_wo32(obj, 0x0c, 0x00000000);
489
490 ret = nouveau_ramht_insert(chan, handle, obj);
491 nouveau_gpuobj_ref(NULL, &obj);
492 return ret;
493}
494
Ben Skeggs49769862011-04-01 13:03:56 +1000495static int
496nv04_graph_init(struct drm_device *dev, int engine)
Ben Skeggs6ee73862009-12-11 19:24:15 +1000497{
498 struct drm_nouveau_private *dev_priv = dev->dev_private;
499 uint32_t tmp;
500
501 nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) &
502 ~NV_PMC_ENABLE_PGRAPH);
503 nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) |
504 NV_PMC_ENABLE_PGRAPH);
505
506 /* Enable PGRAPH interrupts */
507 nv_wr32(dev, NV03_PGRAPH_INTR, 0xFFFFFFFF);
508 nv_wr32(dev, NV03_PGRAPH_INTR_EN, 0xFFFFFFFF);
509
510 nv_wr32(dev, NV04_PGRAPH_VALID1, 0);
511 nv_wr32(dev, NV04_PGRAPH_VALID2, 0);
512 /*nv_wr32(dev, NV04_PGRAPH_DEBUG_0, 0x000001FF);
513 nv_wr32(dev, NV04_PGRAPH_DEBUG_0, 0x001FFFFF);*/
514 nv_wr32(dev, NV04_PGRAPH_DEBUG_0, 0x1231c000);
515 /*1231C000 blob, 001 haiku*/
Emil Velikovf2129492011-03-19 23:31:52 +0000516 /*V_WRITE(NV04_PGRAPH_DEBUG_1, 0xf2d91100);*/
Ben Skeggs6ee73862009-12-11 19:24:15 +1000517 nv_wr32(dev, NV04_PGRAPH_DEBUG_1, 0x72111100);
518 /*0x72111100 blob , 01 haiku*/
519 /*nv_wr32(dev, NV04_PGRAPH_DEBUG_2, 0x11d5f870);*/
520 nv_wr32(dev, NV04_PGRAPH_DEBUG_2, 0x11d5f071);
521 /*haiku same*/
522
523 /*nv_wr32(dev, NV04_PGRAPH_DEBUG_3, 0xfad4ff31);*/
524 nv_wr32(dev, NV04_PGRAPH_DEBUG_3, 0xf0d4ff31);
525 /*haiku and blob 10d4*/
526
527 nv_wr32(dev, NV04_PGRAPH_STATE , 0xFFFFFFFF);
528 nv_wr32(dev, NV04_PGRAPH_CTX_CONTROL , 0x10000100);
529 tmp = nv_rd32(dev, NV04_PGRAPH_CTX_USER) & 0x00ffffff;
Francisco Jerezea911a12009-12-26 14:39:46 +0100530 tmp |= (dev_priv->engine.fifo.channels - 1) << 24;
Ben Skeggs6ee73862009-12-11 19:24:15 +1000531 nv_wr32(dev, NV04_PGRAPH_CTX_USER, tmp);
532
533 /* These don't belong here, they're part of a per-channel context */
534 nv_wr32(dev, NV04_PGRAPH_PATTERN_SHAPE, 0x00000000);
535 nv_wr32(dev, NV04_PGRAPH_BETA_AND , 0xFFFFFFFF);
536
537 return 0;
538}
539
Ben Skeggs49769862011-04-01 13:03:56 +1000540static int
541nv04_graph_fini(struct drm_device *dev, int engine)
Ben Skeggs6ee73862009-12-11 19:24:15 +1000542{
Ben Skeggs49769862011-04-01 13:03:56 +1000543 nv04_graph_unload_context(dev);
Ben Skeggs274fec92010-11-03 13:16:18 +1000544 nv_wr32(dev, NV03_PGRAPH_INTR_EN, 0x00000000);
Ben Skeggs49769862011-04-01 13:03:56 +1000545 return 0;
Ben Skeggs6ee73862009-12-11 19:24:15 +1000546}
547
Ben Skeggs6ee73862009-12-11 19:24:15 +1000548static int
Ben Skeggsb8c157d2010-10-20 10:39:35 +1000549nv04_graph_mthd_set_ref(struct nouveau_channel *chan,
550 u32 class, u32 mthd, u32 data)
Ben Skeggs6ee73862009-12-11 19:24:15 +1000551{
Ben Skeggs047d1d32010-05-31 12:00:43 +1000552 atomic_set(&chan->fence.last_sequence_irq, data);
Ben Skeggs6ee73862009-12-11 19:24:15 +1000553 return 0;
554}
555
Francisco Jerez332b2422010-10-20 23:35:40 +0200556int
557nv04_graph_mthd_page_flip(struct nouveau_channel *chan,
558 u32 class, u32 mthd, u32 data)
559{
560 struct drm_device *dev = chan->dev;
561 struct nouveau_page_flip_state s;
562
563 if (!nouveau_finish_page_flip(chan, &s))
564 nv_set_crtc_base(dev, s.crtc,
565 s.offset + s.y * s.pitch + s.x * s.bpp / 8);
566
567 return 0;
568}
569
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +0000570/*
571 * Software methods, why they are needed, and how they all work:
572 *
573 * NV04 and NV05 keep most of the state in PGRAPH context itself, but some
574 * 2d engine settings are kept inside the grobjs themselves. The grobjs are
575 * 3 words long on both. grobj format on NV04 is:
576 *
577 * word 0:
578 * - bits 0-7: class
579 * - bit 12: color key active
580 * - bit 13: clip rect active
581 * - bit 14: if set, destination surface is swizzled and taken from buffer 5
582 * [set by NV04_SWIZZLED_SURFACE], otherwise it's linear and taken
583 * from buffer 0 [set by NV04_CONTEXT_SURFACES_2D or
584 * NV03_CONTEXT_SURFACE_DST].
585 * - bits 15-17: 2d operation [aka patch config]
586 * - bit 24: patch valid [enables rendering using this object]
587 * - bit 25: surf3d valid [for tex_tri and multitex_tri only]
588 * word 1:
589 * - bits 0-1: mono format
590 * - bits 8-13: color format
591 * - bits 16-31: DMA_NOTIFY instance
592 * word 2:
593 * - bits 0-15: DMA_A instance
594 * - bits 16-31: DMA_B instance
595 *
596 * On NV05 it's:
597 *
598 * word 0:
599 * - bits 0-7: class
600 * - bit 12: color key active
601 * - bit 13: clip rect active
602 * - bit 14: if set, destination surface is swizzled and taken from buffer 5
603 * [set by NV04_SWIZZLED_SURFACE], otherwise it's linear and taken
604 * from buffer 0 [set by NV04_CONTEXT_SURFACES_2D or
605 * NV03_CONTEXT_SURFACE_DST].
606 * - bits 15-17: 2d operation [aka patch config]
607 * - bits 20-22: dither mode
608 * - bit 24: patch valid [enables rendering using this object]
609 * - bit 25: surface_dst/surface_color/surf2d/surf3d valid
610 * - bit 26: surface_src/surface_zeta valid
611 * - bit 27: pattern valid
612 * - bit 28: rop valid
613 * - bit 29: beta1 valid
614 * - bit 30: beta4 valid
615 * word 1:
616 * - bits 0-1: mono format
617 * - bits 8-13: color format
618 * - bits 16-31: DMA_NOTIFY instance
619 * word 2:
620 * - bits 0-15: DMA_A instance
621 * - bits 16-31: DMA_B instance
622 *
623 * NV05 will set/unset the relevant valid bits when you poke the relevant
624 * object-binding methods with object of the proper type, or with the NULL
625 * type. It'll only allow rendering using the grobj if all needed objects
626 * are bound. The needed set of objects depends on selected operation: for
627 * example rop object is needed by ROP_AND, but not by SRCCOPY_AND.
628 *
629 * NV04 doesn't have these methods implemented at all, and doesn't have the
630 * relevant bits in grobj. Instead, it'll allow rendering whenever bit 24
631 * is set. So we have to emulate them in software, internally keeping the
632 * same bits as NV05 does. Since grobjs are aligned to 16 bytes on nv04,
633 * but the last word isn't actually used for anything, we abuse it for this
634 * purpose.
635 *
636 * Actually, NV05 can optionally check bit 24 too, but we disable this since
637 * there's no use for it.
638 *
639 * For unknown reasons, NV04 implements surf3d binding in hardware as an
640 * exception. Also for unknown reasons, NV04 doesn't implement the clipping
641 * methods on the surf3d object, so we have to emulate them too.
642 */
643
644static void
Ben Skeggsb8c157d2010-10-20 10:39:35 +1000645nv04_graph_set_ctx1(struct nouveau_channel *chan, u32 mask, u32 value)
Ben Skeggs6ee73862009-12-11 19:24:15 +1000646{
647 struct drm_device *dev = chan->dev;
Ben Skeggsb8c157d2010-10-20 10:39:35 +1000648 u32 instance = (nv_rd32(dev, NV04_PGRAPH_CTX_SWITCH4) & 0xffff) << 4;
Ben Skeggs6ee73862009-12-11 19:24:15 +1000649 int subc = (nv_rd32(dev, NV04_PGRAPH_TRAPPED_ADDR) >> 13) & 0x7;
Ben Skeggsb8c157d2010-10-20 10:39:35 +1000650 u32 tmp;
Ben Skeggs6ee73862009-12-11 19:24:15 +1000651
652 tmp = nv_ri32(dev, instance);
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +0000653 tmp &= ~mask;
654 tmp |= value;
Ben Skeggs6ee73862009-12-11 19:24:15 +1000655
656 nv_wi32(dev, instance, tmp);
657 nv_wr32(dev, NV04_PGRAPH_CTX_SWITCH1, tmp);
Marcin Kościelnicki13c54432009-12-14 20:38:17 +0000658 nv_wr32(dev, NV04_PGRAPH_CTX_CACHE1 + (subc<<2), tmp);
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +0000659}
660
661static void
Ben Skeggsb8c157d2010-10-20 10:39:35 +1000662nv04_graph_set_ctx_val(struct nouveau_channel *chan, u32 mask, u32 value)
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +0000663{
664 struct drm_device *dev = chan->dev;
Ben Skeggsb8c157d2010-10-20 10:39:35 +1000665 u32 instance = (nv_rd32(dev, NV04_PGRAPH_CTX_SWITCH4) & 0xffff) << 4;
666 u32 tmp, ctx1;
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +0000667 int class, op, valid = 1;
668
669 ctx1 = nv_ri32(dev, instance);
670 class = ctx1 & 0xff;
671 op = (ctx1 >> 15) & 7;
672 tmp = nv_ri32(dev, instance + 0xc);
673 tmp &= ~mask;
674 tmp |= value;
675 nv_wi32(dev, instance + 0xc, tmp);
676
677 /* check for valid surf2d/surf_dst/surf_color */
678 if (!(tmp & 0x02000000))
679 valid = 0;
680 /* check for valid surf_src/surf_zeta */
681 if ((class == 0x1f || class == 0x48) && !(tmp & 0x04000000))
682 valid = 0;
683
684 switch (op) {
685 /* SRCCOPY_AND, SRCCOPY: no extra objects required */
686 case 0:
687 case 3:
688 break;
689 /* ROP_AND: requires pattern and rop */
690 case 1:
691 if (!(tmp & 0x18000000))
692 valid = 0;
693 break;
694 /* BLEND_AND: requires beta1 */
695 case 2:
696 if (!(tmp & 0x20000000))
697 valid = 0;
698 break;
699 /* SRCCOPY_PREMULT, BLEND_PREMULT: beta4 required */
700 case 4:
701 case 5:
702 if (!(tmp & 0x40000000))
703 valid = 0;
704 break;
705 }
706
707 nv04_graph_set_ctx1(chan, 0x01000000, valid << 24);
708}
709
710static int
Ben Skeggsb8c157d2010-10-20 10:39:35 +1000711nv04_graph_mthd_set_operation(struct nouveau_channel *chan,
712 u32 class, u32 mthd, u32 data)
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +0000713{
714 if (data > 5)
715 return 1;
716 /* Old versions of the objects only accept first three operations. */
Ben Skeggsb8c157d2010-10-20 10:39:35 +1000717 if (data > 2 && class < 0x40)
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +0000718 return 1;
719 nv04_graph_set_ctx1(chan, 0x00038000, data << 15);
720 /* changing operation changes set of objects needed for validation */
721 nv04_graph_set_ctx_val(chan, 0, 0);
Ben Skeggs6ee73862009-12-11 19:24:15 +1000722 return 0;
723}
724
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +0000725static int
Ben Skeggsb8c157d2010-10-20 10:39:35 +1000726nv04_graph_mthd_surf3d_clip_h(struct nouveau_channel *chan,
727 u32 class, u32 mthd, u32 data)
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +0000728{
729 uint32_t min = data & 0xffff, max;
730 uint32_t w = data >> 16;
731 if (min & 0x8000)
732 /* too large */
733 return 1;
734 if (w & 0x8000)
735 /* yes, it accepts negative for some reason. */
736 w |= 0xffff0000;
737 max = min + w;
738 max &= 0x3ffff;
739 nv_wr32(chan->dev, 0x40053c, min);
740 nv_wr32(chan->dev, 0x400544, max);
741 return 0;
742}
743
744static int
Ben Skeggsb8c157d2010-10-20 10:39:35 +1000745nv04_graph_mthd_surf3d_clip_v(struct nouveau_channel *chan,
746 u32 class, u32 mthd, u32 data)
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +0000747{
748 uint32_t min = data & 0xffff, max;
749 uint32_t w = data >> 16;
750 if (min & 0x8000)
751 /* too large */
752 return 1;
753 if (w & 0x8000)
754 /* yes, it accepts negative for some reason. */
755 w |= 0xffff0000;
756 max = min + w;
757 max &= 0x3ffff;
758 nv_wr32(chan->dev, 0x400540, min);
759 nv_wr32(chan->dev, 0x400548, max);
760 return 0;
761}
762
763static int
Ben Skeggsb8c157d2010-10-20 10:39:35 +1000764nv04_graph_mthd_bind_surf2d(struct nouveau_channel *chan,
765 u32 class, u32 mthd, u32 data)
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +0000766{
767 switch (nv_ri32(chan->dev, data << 4) & 0xff) {
768 case 0x30:
769 nv04_graph_set_ctx1(chan, 0x00004000, 0);
770 nv04_graph_set_ctx_val(chan, 0x02000000, 0);
771 return 0;
772 case 0x42:
773 nv04_graph_set_ctx1(chan, 0x00004000, 0);
774 nv04_graph_set_ctx_val(chan, 0x02000000, 0x02000000);
775 return 0;
776 }
777 return 1;
778}
779
780static int
Ben Skeggsb8c157d2010-10-20 10:39:35 +1000781nv04_graph_mthd_bind_surf2d_swzsurf(struct nouveau_channel *chan,
782 u32 class, u32 mthd, u32 data)
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +0000783{
784 switch (nv_ri32(chan->dev, data << 4) & 0xff) {
785 case 0x30:
786 nv04_graph_set_ctx1(chan, 0x00004000, 0);
787 nv04_graph_set_ctx_val(chan, 0x02000000, 0);
788 return 0;
789 case 0x42:
790 nv04_graph_set_ctx1(chan, 0x00004000, 0);
791 nv04_graph_set_ctx_val(chan, 0x02000000, 0x02000000);
792 return 0;
793 case 0x52:
794 nv04_graph_set_ctx1(chan, 0x00004000, 0x00004000);
795 nv04_graph_set_ctx_val(chan, 0x02000000, 0x02000000);
796 return 0;
797 }
798 return 1;
799}
800
801static int
Ben Skeggsb8c157d2010-10-20 10:39:35 +1000802nv04_graph_mthd_bind_nv01_patt(struct nouveau_channel *chan,
803 u32 class, u32 mthd, u32 data)
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +0000804{
805 switch (nv_ri32(chan->dev, data << 4) & 0xff) {
806 case 0x30:
807 nv04_graph_set_ctx_val(chan, 0x08000000, 0);
808 return 0;
809 case 0x18:
810 nv04_graph_set_ctx_val(chan, 0x08000000, 0x08000000);
811 return 0;
812 }
813 return 1;
814}
815
816static int
Ben Skeggsb8c157d2010-10-20 10:39:35 +1000817nv04_graph_mthd_bind_nv04_patt(struct nouveau_channel *chan,
818 u32 class, u32 mthd, u32 data)
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +0000819{
820 switch (nv_ri32(chan->dev, data << 4) & 0xff) {
821 case 0x30:
822 nv04_graph_set_ctx_val(chan, 0x08000000, 0);
823 return 0;
824 case 0x44:
825 nv04_graph_set_ctx_val(chan, 0x08000000, 0x08000000);
826 return 0;
827 }
828 return 1;
829}
830
831static int
Ben Skeggsb8c157d2010-10-20 10:39:35 +1000832nv04_graph_mthd_bind_rop(struct nouveau_channel *chan,
833 u32 class, u32 mthd, u32 data)
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +0000834{
835 switch (nv_ri32(chan->dev, data << 4) & 0xff) {
836 case 0x30:
837 nv04_graph_set_ctx_val(chan, 0x10000000, 0);
838 return 0;
839 case 0x43:
840 nv04_graph_set_ctx_val(chan, 0x10000000, 0x10000000);
841 return 0;
842 }
843 return 1;
844}
845
846static int
Ben Skeggsb8c157d2010-10-20 10:39:35 +1000847nv04_graph_mthd_bind_beta1(struct nouveau_channel *chan,
848 u32 class, u32 mthd, u32 data)
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +0000849{
850 switch (nv_ri32(chan->dev, data << 4) & 0xff) {
851 case 0x30:
852 nv04_graph_set_ctx_val(chan, 0x20000000, 0);
853 return 0;
854 case 0x12:
855 nv04_graph_set_ctx_val(chan, 0x20000000, 0x20000000);
856 return 0;
857 }
858 return 1;
859}
860
861static int
Ben Skeggsb8c157d2010-10-20 10:39:35 +1000862nv04_graph_mthd_bind_beta4(struct nouveau_channel *chan,
863 u32 class, u32 mthd, u32 data)
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +0000864{
865 switch (nv_ri32(chan->dev, data << 4) & 0xff) {
866 case 0x30:
867 nv04_graph_set_ctx_val(chan, 0x40000000, 0);
868 return 0;
869 case 0x72:
870 nv04_graph_set_ctx_val(chan, 0x40000000, 0x40000000);
871 return 0;
872 }
873 return 1;
874}
875
876static int
Ben Skeggsb8c157d2010-10-20 10:39:35 +1000877nv04_graph_mthd_bind_surf_dst(struct nouveau_channel *chan,
878 u32 class, u32 mthd, u32 data)
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +0000879{
880 switch (nv_ri32(chan->dev, data << 4) & 0xff) {
881 case 0x30:
882 nv04_graph_set_ctx_val(chan, 0x02000000, 0);
883 return 0;
884 case 0x58:
885 nv04_graph_set_ctx_val(chan, 0x02000000, 0x02000000);
886 return 0;
887 }
888 return 1;
889}
890
891static int
Ben Skeggsb8c157d2010-10-20 10:39:35 +1000892nv04_graph_mthd_bind_surf_src(struct nouveau_channel *chan,
893 u32 class, u32 mthd, u32 data)
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +0000894{
895 switch (nv_ri32(chan->dev, data << 4) & 0xff) {
896 case 0x30:
897 nv04_graph_set_ctx_val(chan, 0x04000000, 0);
898 return 0;
899 case 0x59:
900 nv04_graph_set_ctx_val(chan, 0x04000000, 0x04000000);
901 return 0;
902 }
903 return 1;
904}
905
906static int
Ben Skeggsb8c157d2010-10-20 10:39:35 +1000907nv04_graph_mthd_bind_surf_color(struct nouveau_channel *chan,
908 u32 class, u32 mthd, u32 data)
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +0000909{
910 switch (nv_ri32(chan->dev, data << 4) & 0xff) {
911 case 0x30:
912 nv04_graph_set_ctx_val(chan, 0x02000000, 0);
913 return 0;
914 case 0x5a:
915 nv04_graph_set_ctx_val(chan, 0x02000000, 0x02000000);
916 return 0;
917 }
918 return 1;
919}
920
921static int
Ben Skeggsb8c157d2010-10-20 10:39:35 +1000922nv04_graph_mthd_bind_surf_zeta(struct nouveau_channel *chan,
923 u32 class, u32 mthd, u32 data)
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +0000924{
925 switch (nv_ri32(chan->dev, data << 4) & 0xff) {
926 case 0x30:
927 nv04_graph_set_ctx_val(chan, 0x04000000, 0);
928 return 0;
929 case 0x5b:
930 nv04_graph_set_ctx_val(chan, 0x04000000, 0x04000000);
931 return 0;
932 }
933 return 1;
934}
935
936static int
Ben Skeggsb8c157d2010-10-20 10:39:35 +1000937nv04_graph_mthd_bind_clip(struct nouveau_channel *chan,
938 u32 class, u32 mthd, u32 data)
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +0000939{
940 switch (nv_ri32(chan->dev, data << 4) & 0xff) {
941 case 0x30:
942 nv04_graph_set_ctx1(chan, 0x2000, 0);
943 return 0;
944 case 0x19:
945 nv04_graph_set_ctx1(chan, 0x2000, 0x2000);
946 return 0;
947 }
948 return 1;
949}
950
951static int
Ben Skeggsb8c157d2010-10-20 10:39:35 +1000952nv04_graph_mthd_bind_chroma(struct nouveau_channel *chan,
953 u32 class, u32 mthd, u32 data)
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +0000954{
955 switch (nv_ri32(chan->dev, data << 4) & 0xff) {
956 case 0x30:
957 nv04_graph_set_ctx1(chan, 0x1000, 0);
958 return 0;
959 /* Yes, for some reason even the old versions of objects
960 * accept 0x57 and not 0x17. Consistency be damned.
961 */
962 case 0x57:
963 nv04_graph_set_ctx1(chan, 0x1000, 0x1000);
964 return 0;
965 }
966 return 1;
967}
968
Ben Skeggs49769862011-04-01 13:03:56 +1000969static struct nouveau_bitfield nv04_graph_intr[] = {
970 { NV_PGRAPH_INTR_NOTIFY, "NOTIFY" },
971 {}
972};
973
974static struct nouveau_bitfield nv04_graph_nstatus[] = {
975 { NV04_PGRAPH_NSTATUS_STATE_IN_USE, "STATE_IN_USE" },
976 { NV04_PGRAPH_NSTATUS_INVALID_STATE, "INVALID_STATE" },
977 { NV04_PGRAPH_NSTATUS_BAD_ARGUMENT, "BAD_ARGUMENT" },
978 { NV04_PGRAPH_NSTATUS_PROTECTION_FAULT, "PROTECTION_FAULT" },
979 {}
980};
981
982struct nouveau_bitfield nv04_graph_nsource[] = {
983 { NV03_PGRAPH_NSOURCE_NOTIFICATION, "NOTIFICATION" },
984 { NV03_PGRAPH_NSOURCE_DATA_ERROR, "DATA_ERROR" },
985 { NV03_PGRAPH_NSOURCE_PROTECTION_ERROR, "PROTECTION_ERROR" },
986 { NV03_PGRAPH_NSOURCE_RANGE_EXCEPTION, "RANGE_EXCEPTION" },
987 { NV03_PGRAPH_NSOURCE_LIMIT_COLOR, "LIMIT_COLOR" },
988 { NV03_PGRAPH_NSOURCE_LIMIT_ZETA, "LIMIT_ZETA" },
989 { NV03_PGRAPH_NSOURCE_ILLEGAL_MTHD, "ILLEGAL_MTHD" },
990 { NV03_PGRAPH_NSOURCE_DMA_R_PROTECTION, "DMA_R_PROTECTION" },
991 { NV03_PGRAPH_NSOURCE_DMA_W_PROTECTION, "DMA_W_PROTECTION" },
992 { NV03_PGRAPH_NSOURCE_FORMAT_EXCEPTION, "FORMAT_EXCEPTION" },
993 { NV03_PGRAPH_NSOURCE_PATCH_EXCEPTION, "PATCH_EXCEPTION" },
994 { NV03_PGRAPH_NSOURCE_STATE_INVALID, "STATE_INVALID" },
995 { NV03_PGRAPH_NSOURCE_DOUBLE_NOTIFY, "DOUBLE_NOTIFY" },
996 { NV03_PGRAPH_NSOURCE_NOTIFY_IN_USE, "NOTIFY_IN_USE" },
997 { NV03_PGRAPH_NSOURCE_METHOD_CNT, "METHOD_CNT" },
998 { NV03_PGRAPH_NSOURCE_BFR_NOTIFICATION, "BFR_NOTIFICATION" },
999 { NV03_PGRAPH_NSOURCE_DMA_VTX_PROTECTION, "DMA_VTX_PROTECTION" },
1000 { NV03_PGRAPH_NSOURCE_DMA_WIDTH_A, "DMA_WIDTH_A" },
1001 { NV03_PGRAPH_NSOURCE_DMA_WIDTH_B, "DMA_WIDTH_B" },
1002 {}
1003};
1004
1005static void
1006nv04_graph_context_switch(struct drm_device *dev)
Ben Skeggsb8c157d2010-10-20 10:39:35 +10001007{
1008 struct drm_nouveau_private *dev_priv = dev->dev_private;
Ben Skeggs49769862011-04-01 13:03:56 +10001009 struct nouveau_channel *chan = NULL;
1010 int chid;
Ben Skeggs6ee73862009-12-11 19:24:15 +10001011
Ben Skeggs49769862011-04-01 13:03:56 +10001012 nouveau_wait_for_idle(dev);
1013
1014 /* If previous context is valid, we need to save it */
1015 nv04_graph_unload_context(dev);
1016
1017 /* Load context for next channel */
1018 chid = dev_priv->engine.fifo.channel_id(dev);
1019 chan = dev_priv->channels.ptr[chid];
1020 if (chan)
1021 nv04_graph_load_context(chan);
1022}
1023
1024static void
1025nv04_graph_isr(struct drm_device *dev)
1026{
1027 u32 stat;
1028
1029 while ((stat = nv_rd32(dev, NV03_PGRAPH_INTR))) {
1030 u32 nsource = nv_rd32(dev, NV03_PGRAPH_NSOURCE);
1031 u32 nstatus = nv_rd32(dev, NV03_PGRAPH_NSTATUS);
1032 u32 addr = nv_rd32(dev, NV04_PGRAPH_TRAPPED_ADDR);
1033 u32 chid = (addr & 0x0f000000) >> 24;
1034 u32 subc = (addr & 0x0000e000) >> 13;
1035 u32 mthd = (addr & 0x00001ffc);
1036 u32 data = nv_rd32(dev, NV04_PGRAPH_TRAPPED_DATA);
1037 u32 class = nv_rd32(dev, 0x400180 + subc * 4) & 0xff;
1038 u32 show = stat;
1039
1040 if (stat & NV_PGRAPH_INTR_NOTIFY) {
1041 if (nsource & NV03_PGRAPH_NSOURCE_ILLEGAL_MTHD) {
1042 if (!nouveau_gpuobj_mthd_call2(dev, chid, class, mthd, data))
1043 show &= ~NV_PGRAPH_INTR_NOTIFY;
1044 }
1045 }
1046
1047 if (stat & NV_PGRAPH_INTR_CONTEXT_SWITCH) {
1048 nv_wr32(dev, NV03_PGRAPH_INTR, NV_PGRAPH_INTR_CONTEXT_SWITCH);
1049 stat &= ~NV_PGRAPH_INTR_CONTEXT_SWITCH;
1050 show &= ~NV_PGRAPH_INTR_CONTEXT_SWITCH;
1051 nv04_graph_context_switch(dev);
1052 }
1053
1054 nv_wr32(dev, NV03_PGRAPH_INTR, stat);
1055 nv_wr32(dev, NV04_PGRAPH_FIFO, 0x00000001);
1056
1057 if (show && nouveau_ratelimit()) {
1058 NV_INFO(dev, "PGRAPH -");
1059 nouveau_bitfield_print(nv04_graph_intr, show);
1060 printk(" nsource:");
1061 nouveau_bitfield_print(nv04_graph_nsource, nsource);
1062 printk(" nstatus:");
1063 nouveau_bitfield_print(nv04_graph_nstatus, nstatus);
1064 printk("\n");
1065 NV_INFO(dev, "PGRAPH - ch %d/%d class 0x%04x "
1066 "mthd 0x%04x data 0x%08x\n",
1067 chid, subc, class, mthd, data);
1068 }
1069 }
1070}
1071
1072static void
1073nv04_graph_destroy(struct drm_device *dev, int engine)
1074{
1075 struct nv04_graph_engine *pgraph = nv_engine(dev, engine);
1076
1077 nouveau_irq_unregister(dev, 12);
1078
1079 NVOBJ_ENGINE_DEL(dev, GR);
1080 kfree(pgraph);
1081}
1082
1083int
1084nv04_graph_create(struct drm_device *dev)
1085{
1086 struct nv04_graph_engine *pgraph;
1087
1088 pgraph = kzalloc(sizeof(*pgraph), GFP_KERNEL);
1089 if (!pgraph)
1090 return -ENOMEM;
1091
1092 pgraph->base.destroy = nv04_graph_destroy;
1093 pgraph->base.init = nv04_graph_init;
1094 pgraph->base.fini = nv04_graph_fini;
1095 pgraph->base.context_new = nv04_graph_context_new;
1096 pgraph->base.context_del = nv04_graph_context_del;
1097 pgraph->base.object_new = nv04_graph_object_new;
1098
1099 NVOBJ_ENGINE_ADD(dev, GR, &pgraph->base);
1100 nouveau_irq_register(dev, 12, nv04_graph_isr);
Ben Skeggs6ee73862009-12-11 19:24:15 +10001101
Ben Skeggsb8c157d2010-10-20 10:39:35 +10001102 /* dvd subpicture */
1103 NVOBJ_CLASS(dev, 0x0038, GR);
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +00001104
Ben Skeggsb8c157d2010-10-20 10:39:35 +10001105 /* m2mf */
1106 NVOBJ_CLASS(dev, 0x0039, GR);
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +00001107
Ben Skeggsb8c157d2010-10-20 10:39:35 +10001108 /* nv03 gdirect */
1109 NVOBJ_CLASS(dev, 0x004b, GR);
1110 NVOBJ_MTHD (dev, 0x004b, 0x0184, nv04_graph_mthd_bind_nv01_patt);
1111 NVOBJ_MTHD (dev, 0x004b, 0x0188, nv04_graph_mthd_bind_rop);
1112 NVOBJ_MTHD (dev, 0x004b, 0x018c, nv04_graph_mthd_bind_beta1);
1113 NVOBJ_MTHD (dev, 0x004b, 0x0190, nv04_graph_mthd_bind_surf_dst);
1114 NVOBJ_MTHD (dev, 0x004b, 0x02fc, nv04_graph_mthd_set_operation);
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +00001115
Ben Skeggsb8c157d2010-10-20 10:39:35 +10001116 /* nv04 gdirect */
1117 NVOBJ_CLASS(dev, 0x004a, GR);
1118 NVOBJ_MTHD (dev, 0x004a, 0x0188, nv04_graph_mthd_bind_nv04_patt);
1119 NVOBJ_MTHD (dev, 0x004a, 0x018c, nv04_graph_mthd_bind_rop);
1120 NVOBJ_MTHD (dev, 0x004a, 0x0190, nv04_graph_mthd_bind_beta1);
1121 NVOBJ_MTHD (dev, 0x004a, 0x0194, nv04_graph_mthd_bind_beta4);
1122 NVOBJ_MTHD (dev, 0x004a, 0x0198, nv04_graph_mthd_bind_surf2d);
1123 NVOBJ_MTHD (dev, 0x004a, 0x02fc, nv04_graph_mthd_set_operation);
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +00001124
Ben Skeggsb8c157d2010-10-20 10:39:35 +10001125 /* nv01 imageblit */
1126 NVOBJ_CLASS(dev, 0x001f, GR);
1127 NVOBJ_MTHD (dev, 0x001f, 0x0184, nv04_graph_mthd_bind_chroma);
1128 NVOBJ_MTHD (dev, 0x001f, 0x0188, nv04_graph_mthd_bind_clip);
1129 NVOBJ_MTHD (dev, 0x001f, 0x018c, nv04_graph_mthd_bind_nv01_patt);
1130 NVOBJ_MTHD (dev, 0x001f, 0x0190, nv04_graph_mthd_bind_rop);
1131 NVOBJ_MTHD (dev, 0x001f, 0x0194, nv04_graph_mthd_bind_beta1);
1132 NVOBJ_MTHD (dev, 0x001f, 0x0198, nv04_graph_mthd_bind_surf_dst);
1133 NVOBJ_MTHD (dev, 0x001f, 0x019c, nv04_graph_mthd_bind_surf_src);
1134 NVOBJ_MTHD (dev, 0x001f, 0x02fc, nv04_graph_mthd_set_operation);
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +00001135
Ben Skeggsb8c157d2010-10-20 10:39:35 +10001136 /* nv04 imageblit */
1137 NVOBJ_CLASS(dev, 0x005f, GR);
1138 NVOBJ_MTHD (dev, 0x005f, 0x0184, nv04_graph_mthd_bind_chroma);
1139 NVOBJ_MTHD (dev, 0x005f, 0x0188, nv04_graph_mthd_bind_clip);
1140 NVOBJ_MTHD (dev, 0x005f, 0x018c, nv04_graph_mthd_bind_nv04_patt);
1141 NVOBJ_MTHD (dev, 0x005f, 0x0190, nv04_graph_mthd_bind_rop);
1142 NVOBJ_MTHD (dev, 0x005f, 0x0194, nv04_graph_mthd_bind_beta1);
1143 NVOBJ_MTHD (dev, 0x005f, 0x0198, nv04_graph_mthd_bind_beta4);
1144 NVOBJ_MTHD (dev, 0x005f, 0x019c, nv04_graph_mthd_bind_surf2d);
1145 NVOBJ_MTHD (dev, 0x005f, 0x02fc, nv04_graph_mthd_set_operation);
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +00001146
Ben Skeggsb8c157d2010-10-20 10:39:35 +10001147 /* nv04 iifc */
1148 NVOBJ_CLASS(dev, 0x0060, GR);
1149 NVOBJ_MTHD (dev, 0x0060, 0x0188, nv04_graph_mthd_bind_chroma);
1150 NVOBJ_MTHD (dev, 0x0060, 0x018c, nv04_graph_mthd_bind_clip);
1151 NVOBJ_MTHD (dev, 0x0060, 0x0190, nv04_graph_mthd_bind_nv04_patt);
1152 NVOBJ_MTHD (dev, 0x0060, 0x0194, nv04_graph_mthd_bind_rop);
1153 NVOBJ_MTHD (dev, 0x0060, 0x0198, nv04_graph_mthd_bind_beta1);
1154 NVOBJ_MTHD (dev, 0x0060, 0x019c, nv04_graph_mthd_bind_beta4);
1155 NVOBJ_MTHD (dev, 0x0060, 0x01a0, nv04_graph_mthd_bind_surf2d_swzsurf);
1156 NVOBJ_MTHD (dev, 0x0060, 0x03e4, nv04_graph_mthd_set_operation);
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +00001157
Ben Skeggsb8c157d2010-10-20 10:39:35 +10001158 /* nv05 iifc */
1159 NVOBJ_CLASS(dev, 0x0064, GR);
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +00001160
Ben Skeggsb8c157d2010-10-20 10:39:35 +10001161 /* nv01 ifc */
1162 NVOBJ_CLASS(dev, 0x0021, GR);
1163 NVOBJ_MTHD (dev, 0x0021, 0x0184, nv04_graph_mthd_bind_chroma);
1164 NVOBJ_MTHD (dev, 0x0021, 0x0188, nv04_graph_mthd_bind_clip);
1165 NVOBJ_MTHD (dev, 0x0021, 0x018c, nv04_graph_mthd_bind_nv01_patt);
1166 NVOBJ_MTHD (dev, 0x0021, 0x0190, nv04_graph_mthd_bind_rop);
1167 NVOBJ_MTHD (dev, 0x0021, 0x0194, nv04_graph_mthd_bind_beta1);
1168 NVOBJ_MTHD (dev, 0x0021, 0x0198, nv04_graph_mthd_bind_surf_dst);
1169 NVOBJ_MTHD (dev, 0x0021, 0x02fc, nv04_graph_mthd_set_operation);
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +00001170
Ben Skeggsb8c157d2010-10-20 10:39:35 +10001171 /* nv04 ifc */
1172 NVOBJ_CLASS(dev, 0x0061, GR);
1173 NVOBJ_MTHD (dev, 0x0061, 0x0184, nv04_graph_mthd_bind_chroma);
1174 NVOBJ_MTHD (dev, 0x0061, 0x0188, nv04_graph_mthd_bind_clip);
1175 NVOBJ_MTHD (dev, 0x0061, 0x018c, nv04_graph_mthd_bind_nv04_patt);
1176 NVOBJ_MTHD (dev, 0x0061, 0x0190, nv04_graph_mthd_bind_rop);
1177 NVOBJ_MTHD (dev, 0x0061, 0x0194, nv04_graph_mthd_bind_beta1);
1178 NVOBJ_MTHD (dev, 0x0061, 0x0198, nv04_graph_mthd_bind_beta4);
1179 NVOBJ_MTHD (dev, 0x0061, 0x019c, nv04_graph_mthd_bind_surf2d);
1180 NVOBJ_MTHD (dev, 0x0061, 0x02fc, nv04_graph_mthd_set_operation);
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +00001181
Ben Skeggsb8c157d2010-10-20 10:39:35 +10001182 /* nv05 ifc */
1183 NVOBJ_CLASS(dev, 0x0065, GR);
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +00001184
Ben Skeggsb8c157d2010-10-20 10:39:35 +10001185 /* nv03 sifc */
1186 NVOBJ_CLASS(dev, 0x0036, GR);
1187 NVOBJ_MTHD (dev, 0x0036, 0x0184, nv04_graph_mthd_bind_chroma);
1188 NVOBJ_MTHD (dev, 0x0036, 0x0188, nv04_graph_mthd_bind_nv01_patt);
1189 NVOBJ_MTHD (dev, 0x0036, 0x018c, nv04_graph_mthd_bind_rop);
1190 NVOBJ_MTHD (dev, 0x0036, 0x0190, nv04_graph_mthd_bind_beta1);
1191 NVOBJ_MTHD (dev, 0x0036, 0x0194, nv04_graph_mthd_bind_surf_dst);
1192 NVOBJ_MTHD (dev, 0x0036, 0x02fc, nv04_graph_mthd_set_operation);
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +00001193
Ben Skeggsb8c157d2010-10-20 10:39:35 +10001194 /* nv04 sifc */
1195 NVOBJ_CLASS(dev, 0x0076, GR);
1196 NVOBJ_MTHD (dev, 0x0076, 0x0184, nv04_graph_mthd_bind_chroma);
1197 NVOBJ_MTHD (dev, 0x0076, 0x0188, nv04_graph_mthd_bind_nv04_patt);
1198 NVOBJ_MTHD (dev, 0x0076, 0x018c, nv04_graph_mthd_bind_rop);
1199 NVOBJ_MTHD (dev, 0x0076, 0x0190, nv04_graph_mthd_bind_beta1);
1200 NVOBJ_MTHD (dev, 0x0076, 0x0194, nv04_graph_mthd_bind_beta4);
1201 NVOBJ_MTHD (dev, 0x0076, 0x0198, nv04_graph_mthd_bind_surf2d);
1202 NVOBJ_MTHD (dev, 0x0076, 0x02fc, nv04_graph_mthd_set_operation);
Marcin Kościelnickif23d4cf2010-04-11 18:41:38 +00001203
Ben Skeggsb8c157d2010-10-20 10:39:35 +10001204 /* nv05 sifc */
1205 NVOBJ_CLASS(dev, 0x0066, GR);
Ben Skeggs6ee73862009-12-11 19:24:15 +10001206
Ben Skeggsb8c157d2010-10-20 10:39:35 +10001207 /* nv03 sifm */
1208 NVOBJ_CLASS(dev, 0x0037, GR);
1209 NVOBJ_MTHD (dev, 0x0037, 0x0188, nv04_graph_mthd_bind_nv01_patt);
1210 NVOBJ_MTHD (dev, 0x0037, 0x018c, nv04_graph_mthd_bind_rop);
1211 NVOBJ_MTHD (dev, 0x0037, 0x0190, nv04_graph_mthd_bind_beta1);
1212 NVOBJ_MTHD (dev, 0x0037, 0x0194, nv04_graph_mthd_bind_surf_dst);
1213 NVOBJ_MTHD (dev, 0x0037, 0x0304, nv04_graph_mthd_set_operation);
1214
1215 /* nv04 sifm */
1216 NVOBJ_CLASS(dev, 0x0077, GR);
1217 NVOBJ_MTHD (dev, 0x0077, 0x0188, nv04_graph_mthd_bind_nv04_patt);
1218 NVOBJ_MTHD (dev, 0x0077, 0x018c, nv04_graph_mthd_bind_rop);
1219 NVOBJ_MTHD (dev, 0x0077, 0x0190, nv04_graph_mthd_bind_beta1);
1220 NVOBJ_MTHD (dev, 0x0077, 0x0194, nv04_graph_mthd_bind_beta4);
1221 NVOBJ_MTHD (dev, 0x0077, 0x0198, nv04_graph_mthd_bind_surf2d_swzsurf);
1222 NVOBJ_MTHD (dev, 0x0077, 0x0304, nv04_graph_mthd_set_operation);
1223
1224 /* null */
1225 NVOBJ_CLASS(dev, 0x0030, GR);
1226
1227 /* surf2d */
1228 NVOBJ_CLASS(dev, 0x0042, GR);
1229
1230 /* rop */
1231 NVOBJ_CLASS(dev, 0x0043, GR);
1232
1233 /* beta1 */
1234 NVOBJ_CLASS(dev, 0x0012, GR);
1235
1236 /* beta4 */
1237 NVOBJ_CLASS(dev, 0x0072, GR);
1238
1239 /* cliprect */
1240 NVOBJ_CLASS(dev, 0x0019, GR);
1241
1242 /* nv01 pattern */
1243 NVOBJ_CLASS(dev, 0x0018, GR);
1244
1245 /* nv04 pattern */
1246 NVOBJ_CLASS(dev, 0x0044, GR);
1247
1248 /* swzsurf */
1249 NVOBJ_CLASS(dev, 0x0052, GR);
1250
1251 /* surf3d */
1252 NVOBJ_CLASS(dev, 0x0053, GR);
1253 NVOBJ_MTHD (dev, 0x0053, 0x02f8, nv04_graph_mthd_surf3d_clip_h);
1254 NVOBJ_MTHD (dev, 0x0053, 0x02fc, nv04_graph_mthd_surf3d_clip_v);
1255
1256 /* nv03 tex_tri */
1257 NVOBJ_CLASS(dev, 0x0048, GR);
1258 NVOBJ_MTHD (dev, 0x0048, 0x0188, nv04_graph_mthd_bind_clip);
1259 NVOBJ_MTHD (dev, 0x0048, 0x018c, nv04_graph_mthd_bind_surf_color);
1260 NVOBJ_MTHD (dev, 0x0048, 0x0190, nv04_graph_mthd_bind_surf_zeta);
1261
1262 /* tex_tri */
1263 NVOBJ_CLASS(dev, 0x0054, GR);
1264
1265 /* multitex_tri */
1266 NVOBJ_CLASS(dev, 0x0055, GR);
1267
1268 /* nv01 chroma */
1269 NVOBJ_CLASS(dev, 0x0017, GR);
1270
1271 /* nv04 chroma */
1272 NVOBJ_CLASS(dev, 0x0057, GR);
1273
1274 /* surf_dst */
1275 NVOBJ_CLASS(dev, 0x0058, GR);
1276
1277 /* surf_src */
1278 NVOBJ_CLASS(dev, 0x0059, GR);
1279
1280 /* surf_color */
1281 NVOBJ_CLASS(dev, 0x005a, GR);
1282
1283 /* surf_zeta */
1284 NVOBJ_CLASS(dev, 0x005b, GR);
1285
1286 /* nv01 line */
1287 NVOBJ_CLASS(dev, 0x001c, GR);
1288 NVOBJ_MTHD (dev, 0x001c, 0x0184, nv04_graph_mthd_bind_clip);
1289 NVOBJ_MTHD (dev, 0x001c, 0x0188, nv04_graph_mthd_bind_nv01_patt);
1290 NVOBJ_MTHD (dev, 0x001c, 0x018c, nv04_graph_mthd_bind_rop);
1291 NVOBJ_MTHD (dev, 0x001c, 0x0190, nv04_graph_mthd_bind_beta1);
1292 NVOBJ_MTHD (dev, 0x001c, 0x0194, nv04_graph_mthd_bind_surf_dst);
1293 NVOBJ_MTHD (dev, 0x001c, 0x02fc, nv04_graph_mthd_set_operation);
1294
1295 /* nv04 line */
1296 NVOBJ_CLASS(dev, 0x005c, GR);
1297 NVOBJ_MTHD (dev, 0x005c, 0x0184, nv04_graph_mthd_bind_clip);
1298 NVOBJ_MTHD (dev, 0x005c, 0x0188, nv04_graph_mthd_bind_nv04_patt);
1299 NVOBJ_MTHD (dev, 0x005c, 0x018c, nv04_graph_mthd_bind_rop);
1300 NVOBJ_MTHD (dev, 0x005c, 0x0190, nv04_graph_mthd_bind_beta1);
1301 NVOBJ_MTHD (dev, 0x005c, 0x0194, nv04_graph_mthd_bind_beta4);
1302 NVOBJ_MTHD (dev, 0x005c, 0x0198, nv04_graph_mthd_bind_surf2d);
1303 NVOBJ_MTHD (dev, 0x005c, 0x02fc, nv04_graph_mthd_set_operation);
1304
1305 /* nv01 tri */
1306 NVOBJ_CLASS(dev, 0x001d, GR);
1307 NVOBJ_MTHD (dev, 0x001d, 0x0184, nv04_graph_mthd_bind_clip);
1308 NVOBJ_MTHD (dev, 0x001d, 0x0188, nv04_graph_mthd_bind_nv01_patt);
1309 NVOBJ_MTHD (dev, 0x001d, 0x018c, nv04_graph_mthd_bind_rop);
1310 NVOBJ_MTHD (dev, 0x001d, 0x0190, nv04_graph_mthd_bind_beta1);
1311 NVOBJ_MTHD (dev, 0x001d, 0x0194, nv04_graph_mthd_bind_surf_dst);
1312 NVOBJ_MTHD (dev, 0x001d, 0x02fc, nv04_graph_mthd_set_operation);
1313
1314 /* nv04 tri */
1315 NVOBJ_CLASS(dev, 0x005d, GR);
1316 NVOBJ_MTHD (dev, 0x005d, 0x0184, nv04_graph_mthd_bind_clip);
1317 NVOBJ_MTHD (dev, 0x005d, 0x0188, nv04_graph_mthd_bind_nv04_patt);
1318 NVOBJ_MTHD (dev, 0x005d, 0x018c, nv04_graph_mthd_bind_rop);
1319 NVOBJ_MTHD (dev, 0x005d, 0x0190, nv04_graph_mthd_bind_beta1);
1320 NVOBJ_MTHD (dev, 0x005d, 0x0194, nv04_graph_mthd_bind_beta4);
1321 NVOBJ_MTHD (dev, 0x005d, 0x0198, nv04_graph_mthd_bind_surf2d);
1322 NVOBJ_MTHD (dev, 0x005d, 0x02fc, nv04_graph_mthd_set_operation);
1323
1324 /* nv01 rect */
1325 NVOBJ_CLASS(dev, 0x001e, GR);
1326 NVOBJ_MTHD (dev, 0x001e, 0x0184, nv04_graph_mthd_bind_clip);
1327 NVOBJ_MTHD (dev, 0x001e, 0x0188, nv04_graph_mthd_bind_nv01_patt);
1328 NVOBJ_MTHD (dev, 0x001e, 0x018c, nv04_graph_mthd_bind_rop);
1329 NVOBJ_MTHD (dev, 0x001e, 0x0190, nv04_graph_mthd_bind_beta1);
1330 NVOBJ_MTHD (dev, 0x001e, 0x0194, nv04_graph_mthd_bind_surf_dst);
1331 NVOBJ_MTHD (dev, 0x001e, 0x02fc, nv04_graph_mthd_set_operation);
1332
1333 /* nv04 rect */
1334 NVOBJ_CLASS(dev, 0x005e, GR);
1335 NVOBJ_MTHD (dev, 0x005e, 0x0184, nv04_graph_mthd_bind_clip);
1336 NVOBJ_MTHD (dev, 0x005e, 0x0188, nv04_graph_mthd_bind_nv04_patt);
1337 NVOBJ_MTHD (dev, 0x005e, 0x018c, nv04_graph_mthd_bind_rop);
1338 NVOBJ_MTHD (dev, 0x005e, 0x0190, nv04_graph_mthd_bind_beta1);
1339 NVOBJ_MTHD (dev, 0x005e, 0x0194, nv04_graph_mthd_bind_beta4);
1340 NVOBJ_MTHD (dev, 0x005e, 0x0198, nv04_graph_mthd_bind_surf2d);
1341 NVOBJ_MTHD (dev, 0x005e, 0x02fc, nv04_graph_mthd_set_operation);
1342
1343 /* nvsw */
1344 NVOBJ_CLASS(dev, 0x506e, SW);
1345 NVOBJ_MTHD (dev, 0x506e, 0x0150, nv04_graph_mthd_set_ref);
Francisco Jerez332b2422010-10-20 23:35:40 +02001346 NVOBJ_MTHD (dev, 0x506e, 0x0500, nv04_graph_mthd_page_flip);
Ben Skeggsb8c157d2010-10-20 10:39:35 +10001347 return 0;
Ben Skeggs274fec92010-11-03 13:16:18 +10001348}