aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nv50_fifo.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2010-09-01 01:24:29 -0400
committerBen Skeggs <bskeggs@redhat.com>2010-09-24 02:20:00 -0400
commitb3beb167af0de6d7cb03aed0687eca645cfd06a6 (patch)
tree2699384f75536511e57a862b206c83b4405fa197 /drivers/gpu/drm/nouveau/nv50_fifo.c
parent479dcaea09bf17e8de7005015345e4266723666d (diff)
drm/nouveau: modify object accessors, offset in bytes rather than dwords
Reviewed-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv50_fifo.c')
-rw-r--r--drivers/gpu/drm/nouveau/nv50_fifo.c211
1 files changed, 106 insertions, 105 deletions
diff --git a/drivers/gpu/drm/nouveau/nv50_fifo.c b/drivers/gpu/drm/nouveau/nv50_fifo.c
index fb0281ae8f9..38dbcda8619 100644
--- a/drivers/gpu/drm/nouveau/nv50_fifo.c
+++ b/drivers/gpu/drm/nouveau/nv50_fifo.c
@@ -43,8 +43,10 @@ nv50_fifo_playlist_update(struct drm_device *dev)
43 43
44 /* We never schedule channel 0 or 127 */ 44 /* We never schedule channel 0 or 127 */
45 for (i = 1, nr = 0; i < 127; i++) { 45 for (i = 1, nr = 0; i < 127; i++) {
46 if (dev_priv->fifos[i] && dev_priv->fifos[i]->ramfc) 46 if (dev_priv->fifos[i] && dev_priv->fifos[i]->ramfc) {
47 nv_wo32(dev, cur->gpuobj, nr++, i); 47 nv_wo32(cur->gpuobj, (nr * 4), i);
48 nr++;
49 }
48 } 50 }
49 dev_priv->engine.instmem.flush(dev); 51 dev_priv->engine.instmem.flush(dev);
50 52
@@ -258,27 +260,25 @@ nv50_fifo_create_context(struct nouveau_channel *chan)
258 260
259 spin_lock_irqsave(&dev_priv->context_switch_lock, flags); 261 spin_lock_irqsave(&dev_priv->context_switch_lock, flags);
260 262
261 nv_wo32(dev, ramfc, 0x48/4, chan->pushbuf->instance >> 4); 263 nv_wo32(ramfc, 0x48, chan->pushbuf->instance >> 4);
262 nv_wo32(dev, ramfc, 0x80/4, (0 << 27) /* 4KiB */ | 264 nv_wo32(ramfc, 0x80, (0 << 27) /* 4KiB */ |
263 (4 << 24) /* SEARCH_FULL */ | 265 (4 << 24) /* SEARCH_FULL */ |
264 (chan->ramht->instance >> 4)); 266 (chan->ramht->instance >> 4));
265 nv_wo32(dev, ramfc, 0x44/4, 0x2101ffff); 267 nv_wo32(ramfc, 0x44, 0x2101ffff);
266 nv_wo32(dev, ramfc, 0x60/4, 0x7fffffff); 268 nv_wo32(ramfc, 0x60, 0x7fffffff);
267 nv_wo32(dev, ramfc, 0x40/4, 0x00000000); 269 nv_wo32(ramfc, 0x40, 0x00000000);
268 nv_wo32(dev, ramfc, 0x7c/4, 0x30000001); 270 nv_wo32(ramfc, 0x7c, 0x30000001);
269 nv_wo32(dev, ramfc, 0x78/4, 0x00000000); 271 nv_wo32(ramfc, 0x78, 0x00000000);
270 nv_wo32(dev, ramfc, 0x3c/4, 0x403f6078); 272 nv_wo32(ramfc, 0x3c, 0x403f6078);
271 nv_wo32(dev, ramfc, 0x50/4, chan->pushbuf_base + 273 nv_wo32(ramfc, 0x50, chan->pushbuf_base + chan->dma.ib_base * 4);
272 chan->dma.ib_base * 4); 274 nv_wo32(ramfc, 0x54, drm_order(chan->dma.ib_max + 1) << 16);
273 nv_wo32(dev, ramfc, 0x54/4, drm_order(chan->dma.ib_max + 1) << 16);
274 275
275 if (dev_priv->chipset != 0x50) { 276 if (dev_priv->chipset != 0x50) {
276 nv_wo32(dev, chan->ramin->gpuobj, 0, chan->id); 277 nv_wo32(chan->ramin->gpuobj, 0, chan->id);
277 nv_wo32(dev, chan->ramin->gpuobj, 1, 278 nv_wo32(chan->ramin->gpuobj, 4, chan->ramfc->instance >> 8);
278 chan->ramfc->instance >> 8);
279 279
280 nv_wo32(dev, ramfc, 0x88/4, chan->cache->instance >> 10); 280 nv_wo32(ramfc, 0x88, chan->cache->instance >> 10);
281 nv_wo32(dev, ramfc, 0x98/4, chan->ramin->instance >> 12); 281 nv_wo32(ramfc, 0x98, chan->ramin->instance >> 12);
282 } 282 }
283 283
284 dev_priv->engine.instmem.flush(dev); 284 dev_priv->engine.instmem.flush(dev);
@@ -321,57 +321,57 @@ nv50_fifo_load_context(struct nouveau_channel *chan)
321 321
322 NV_DEBUG(dev, "ch%d\n", chan->id); 322 NV_DEBUG(dev, "ch%d\n", chan->id);
323 323
324 nv_wr32(dev, 0x3330, nv_ro32(dev, ramfc, 0x00/4)); 324 nv_wr32(dev, 0x3330, nv_ro32(ramfc, 0x00));
325 nv_wr32(dev, 0x3334, nv_ro32(dev, ramfc, 0x04/4)); 325 nv_wr32(dev, 0x3334, nv_ro32(ramfc, 0x04));
326 nv_wr32(dev, 0x3240, nv_ro32(dev, ramfc, 0x08/4)); 326 nv_wr32(dev, 0x3240, nv_ro32(ramfc, 0x08));
327 nv_wr32(dev, 0x3320, nv_ro32(dev, ramfc, 0x0c/4)); 327 nv_wr32(dev, 0x3320, nv_ro32(ramfc, 0x0c));
328 nv_wr32(dev, 0x3244, nv_ro32(dev, ramfc, 0x10/4)); 328 nv_wr32(dev, 0x3244, nv_ro32(ramfc, 0x10));
329 nv_wr32(dev, 0x3328, nv_ro32(dev, ramfc, 0x14/4)); 329 nv_wr32(dev, 0x3328, nv_ro32(ramfc, 0x14));
330 nv_wr32(dev, 0x3368, nv_ro32(dev, ramfc, 0x18/4)); 330 nv_wr32(dev, 0x3368, nv_ro32(ramfc, 0x18));
331 nv_wr32(dev, 0x336c, nv_ro32(dev, ramfc, 0x1c/4)); 331 nv_wr32(dev, 0x336c, nv_ro32(ramfc, 0x1c));
332 nv_wr32(dev, 0x3370, nv_ro32(dev, ramfc, 0x20/4)); 332 nv_wr32(dev, 0x3370, nv_ro32(ramfc, 0x20));
333 nv_wr32(dev, 0x3374, nv_ro32(dev, ramfc, 0x24/4)); 333 nv_wr32(dev, 0x3374, nv_ro32(ramfc, 0x24));
334 nv_wr32(dev, 0x3378, nv_ro32(dev, ramfc, 0x28/4)); 334 nv_wr32(dev, 0x3378, nv_ro32(ramfc, 0x28));
335 nv_wr32(dev, 0x337c, nv_ro32(dev, ramfc, 0x2c/4)); 335 nv_wr32(dev, 0x337c, nv_ro32(ramfc, 0x2c));
336 nv_wr32(dev, 0x3228, nv_ro32(dev, ramfc, 0x30/4)); 336 nv_wr32(dev, 0x3228, nv_ro32(ramfc, 0x30));
337 nv_wr32(dev, 0x3364, nv_ro32(dev, ramfc, 0x34/4)); 337 nv_wr32(dev, 0x3364, nv_ro32(ramfc, 0x34));
338 nv_wr32(dev, 0x32a0, nv_ro32(dev, ramfc, 0x38/4)); 338 nv_wr32(dev, 0x32a0, nv_ro32(ramfc, 0x38));
339 nv_wr32(dev, 0x3224, nv_ro32(dev, ramfc, 0x3c/4)); 339 nv_wr32(dev, 0x3224, nv_ro32(ramfc, 0x3c));
340 nv_wr32(dev, 0x324c, nv_ro32(dev, ramfc, 0x40/4)); 340 nv_wr32(dev, 0x324c, nv_ro32(ramfc, 0x40));
341 nv_wr32(dev, 0x2044, nv_ro32(dev, ramfc, 0x44/4)); 341 nv_wr32(dev, 0x2044, nv_ro32(ramfc, 0x44));
342 nv_wr32(dev, 0x322c, nv_ro32(dev, ramfc, 0x48/4)); 342 nv_wr32(dev, 0x322c, nv_ro32(ramfc, 0x48));
343 nv_wr32(dev, 0x3234, nv_ro32(dev, ramfc, 0x4c/4)); 343 nv_wr32(dev, 0x3234, nv_ro32(ramfc, 0x4c));
344 nv_wr32(dev, 0x3340, nv_ro32(dev, ramfc, 0x50/4)); 344 nv_wr32(dev, 0x3340, nv_ro32(ramfc, 0x50));
345 nv_wr32(dev, 0x3344, nv_ro32(dev, ramfc, 0x54/4)); 345 nv_wr32(dev, 0x3344, nv_ro32(ramfc, 0x54));
346 nv_wr32(dev, 0x3280, nv_ro32(dev, ramfc, 0x58/4)); 346 nv_wr32(dev, 0x3280, nv_ro32(ramfc, 0x58));
347 nv_wr32(dev, 0x3254, nv_ro32(dev, ramfc, 0x5c/4)); 347 nv_wr32(dev, 0x3254, nv_ro32(ramfc, 0x5c));
348 nv_wr32(dev, 0x3260, nv_ro32(dev, ramfc, 0x60/4)); 348 nv_wr32(dev, 0x3260, nv_ro32(ramfc, 0x60));
349 nv_wr32(dev, 0x3264, nv_ro32(dev, ramfc, 0x64/4)); 349 nv_wr32(dev, 0x3264, nv_ro32(ramfc, 0x64));
350 nv_wr32(dev, 0x3268, nv_ro32(dev, ramfc, 0x68/4)); 350 nv_wr32(dev, 0x3268, nv_ro32(ramfc, 0x68));
351 nv_wr32(dev, 0x326c, nv_ro32(dev, ramfc, 0x6c/4)); 351 nv_wr32(dev, 0x326c, nv_ro32(ramfc, 0x6c));
352 nv_wr32(dev, 0x32e4, nv_ro32(dev, ramfc, 0x70/4)); 352 nv_wr32(dev, 0x32e4, nv_ro32(ramfc, 0x70));
353 nv_wr32(dev, 0x3248, nv_ro32(dev, ramfc, 0x74/4)); 353 nv_wr32(dev, 0x3248, nv_ro32(ramfc, 0x74));
354 nv_wr32(dev, 0x2088, nv_ro32(dev, ramfc, 0x78/4)); 354 nv_wr32(dev, 0x2088, nv_ro32(ramfc, 0x78));
355 nv_wr32(dev, 0x2058, nv_ro32(dev, ramfc, 0x7c/4)); 355 nv_wr32(dev, 0x2058, nv_ro32(ramfc, 0x7c));
356 nv_wr32(dev, 0x2210, nv_ro32(dev, ramfc, 0x80/4)); 356 nv_wr32(dev, 0x2210, nv_ro32(ramfc, 0x80));
357 357
358 cnt = nv_ro32(dev, ramfc, 0x84/4); 358 cnt = nv_ro32(ramfc, 0x84);
359 for (ptr = 0; ptr < cnt; ptr++) { 359 for (ptr = 0; ptr < cnt; ptr++) {
360 nv_wr32(dev, NV40_PFIFO_CACHE1_METHOD(ptr), 360 nv_wr32(dev, NV40_PFIFO_CACHE1_METHOD(ptr),
361 nv_ro32(dev, cache, (ptr * 2) + 0)); 361 nv_ro32(cache, (ptr * 8) + 0));
362 nv_wr32(dev, NV40_PFIFO_CACHE1_DATA(ptr), 362 nv_wr32(dev, NV40_PFIFO_CACHE1_DATA(ptr),
363 nv_ro32(dev, cache, (ptr * 2) + 1)); 363 nv_ro32(cache, (ptr * 8) + 4));
364 } 364 }
365 nv_wr32(dev, NV03_PFIFO_CACHE1_PUT, cnt << 2); 365 nv_wr32(dev, NV03_PFIFO_CACHE1_PUT, cnt << 2);
366 nv_wr32(dev, NV03_PFIFO_CACHE1_GET, 0); 366 nv_wr32(dev, NV03_PFIFO_CACHE1_GET, 0);
367 367
368 /* guessing that all the 0x34xx regs aren't on NV50 */ 368 /* guessing that all the 0x34xx regs aren't on NV50 */
369 if (dev_priv->chipset != 0x50) { 369 if (dev_priv->chipset != 0x50) {
370 nv_wr32(dev, 0x340c, nv_ro32(dev, ramfc, 0x88/4)); 370 nv_wr32(dev, 0x340c, nv_ro32(ramfc, 0x88));
371 nv_wr32(dev, 0x3400, nv_ro32(dev, ramfc, 0x8c/4)); 371 nv_wr32(dev, 0x3400, nv_ro32(ramfc, 0x8c));
372 nv_wr32(dev, 0x3404, nv_ro32(dev, ramfc, 0x90/4)); 372 nv_wr32(dev, 0x3404, nv_ro32(ramfc, 0x90));
373 nv_wr32(dev, 0x3408, nv_ro32(dev, ramfc, 0x94/4)); 373 nv_wr32(dev, 0x3408, nv_ro32(ramfc, 0x94));
374 nv_wr32(dev, 0x3410, nv_ro32(dev, ramfc, 0x98/4)); 374 nv_wr32(dev, 0x3410, nv_ro32(ramfc, 0x98));
375 } 375 }
376 376
377 nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH1, chan->id | (1<<16)); 377 nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH1, chan->id | (1<<16));
@@ -402,59 +402,60 @@ nv50_fifo_unload_context(struct drm_device *dev)
402 ramfc = chan->ramfc->gpuobj; 402 ramfc = chan->ramfc->gpuobj;
403 cache = chan->cache->gpuobj; 403 cache = chan->cache->gpuobj;
404 404
405 nv_wo32(dev, ramfc, 0x00/4, nv_rd32(dev, 0x3330)); 405 nv_wo32(ramfc, 0x00, nv_rd32(dev, 0x3330));
406 nv_wo32(dev, ramfc, 0x04/4, nv_rd32(dev, 0x3334)); 406 nv_wo32(ramfc, 0x04, nv_rd32(dev, 0x3334));
407 nv_wo32(dev, ramfc, 0x08/4, nv_rd32(dev, 0x3240)); 407 nv_wo32(ramfc, 0x08, nv_rd32(dev, 0x3240));
408 nv_wo32(dev, ramfc, 0x0c/4, nv_rd32(dev, 0x3320)); 408 nv_wo32(ramfc, 0x0c, nv_rd32(dev, 0x3320));
409 nv_wo32(dev, ramfc, 0x10/4, nv_rd32(dev, 0x3244)); 409 nv_wo32(ramfc, 0x10, nv_rd32(dev, 0x3244));
410 nv_wo32(dev, ramfc, 0x14/4, nv_rd32(dev, 0x3328)); 410 nv_wo32(ramfc, 0x14, nv_rd32(dev, 0x3328));
411 nv_wo32(dev, ramfc, 0x18/4, nv_rd32(dev, 0x3368)); 411 nv_wo32(ramfc, 0x18, nv_rd32(dev, 0x3368));
412 nv_wo32(dev, ramfc, 0x1c/4, nv_rd32(dev, 0x336c)); 412 nv_wo32(ramfc, 0x1c, nv_rd32(dev, 0x336c));
413 nv_wo32(dev, ramfc, 0x20/4, nv_rd32(dev, 0x3370)); 413 nv_wo32(ramfc, 0x20, nv_rd32(dev, 0x3370));
414 nv_wo32(dev, ramfc, 0x24/4, nv_rd32(dev, 0x3374)); 414 nv_wo32(ramfc, 0x24, nv_rd32(dev, 0x3374));
415 nv_wo32(dev, ramfc, 0x28/4, nv_rd32(dev, 0x3378)); 415 nv_wo32(ramfc, 0x28, nv_rd32(dev, 0x3378));
416 nv_wo32(dev, ramfc, 0x2c/4, nv_rd32(dev, 0x337c)); 416 nv_wo32(ramfc, 0x2c, nv_rd32(dev, 0x337c));
417 nv_wo32(dev, ramfc, 0x30/4, nv_rd32(dev, 0x3228)); 417 nv_wo32(ramfc, 0x30, nv_rd32(dev, 0x3228));
418 nv_wo32(dev, ramfc, 0x34/4, nv_rd32(dev, 0x3364)); 418 nv_wo32(ramfc, 0x34, nv_rd32(dev, 0x3364));
419 nv_wo32(dev, ramfc, 0x38/4, nv_rd32(dev, 0x32a0)); 419 nv_wo32(ramfc, 0x38, nv_rd32(dev, 0x32a0));
420 nv_wo32(dev, ramfc, 0x3c/4, nv_rd32(dev, 0x3224)); 420 nv_wo32(ramfc, 0x3c, nv_rd32(dev, 0x3224));
421 nv_wo32(dev, ramfc, 0x40/4, nv_rd32(dev, 0x324c)); 421 nv_wo32(ramfc, 0x40, nv_rd32(dev, 0x324c));
422 nv_wo32(dev, ramfc, 0x44/4, nv_rd32(dev, 0x2044)); 422 nv_wo32(ramfc, 0x44, nv_rd32(dev, 0x2044));
423 nv_wo32(dev, ramfc, 0x48/4, nv_rd32(dev, 0x322c)); 423 nv_wo32(ramfc, 0x48, nv_rd32(dev, 0x322c));
424 nv_wo32(dev, ramfc, 0x4c/4, nv_rd32(dev, 0x3234)); 424 nv_wo32(ramfc, 0x4c, nv_rd32(dev, 0x3234));
425 nv_wo32(dev, ramfc, 0x50/4, nv_rd32(dev, 0x3340)); 425 nv_wo32(ramfc, 0x50, nv_rd32(dev, 0x3340));
426 nv_wo32(dev, ramfc, 0x54/4, nv_rd32(dev, 0x3344)); 426 nv_wo32(ramfc, 0x54, nv_rd32(dev, 0x3344));
427 nv_wo32(dev, ramfc, 0x58/4, nv_rd32(dev, 0x3280)); 427 nv_wo32(ramfc, 0x58, nv_rd32(dev, 0x3280));
428 nv_wo32(dev, ramfc, 0x5c/4, nv_rd32(dev, 0x3254)); 428 nv_wo32(ramfc, 0x5c, nv_rd32(dev, 0x3254));
429 nv_wo32(dev, ramfc, 0x60/4, nv_rd32(dev, 0x3260)); 429 nv_wo32(ramfc, 0x60, nv_rd32(dev, 0x3260));
430 nv_wo32(dev, ramfc, 0x64/4, nv_rd32(dev, 0x3264)); 430 nv_wo32(ramfc, 0x64, nv_rd32(dev, 0x3264));
431 nv_wo32(dev, ramfc, 0x68/4, nv_rd32(dev, 0x3268)); 431 nv_wo32(ramfc, 0x68, nv_rd32(dev, 0x3268));
432 nv_wo32(dev, ramfc, 0x6c/4, nv_rd32(dev, 0x326c)); 432 nv_wo32(ramfc, 0x6c, nv_rd32(dev, 0x326c));
433 nv_wo32(dev, ramfc, 0x70/4, nv_rd32(dev, 0x32e4)); 433 nv_wo32(ramfc, 0x70, nv_rd32(dev, 0x32e4));
434 nv_wo32(dev, ramfc, 0x74/4, nv_rd32(dev, 0x3248)); 434 nv_wo32(ramfc, 0x74, nv_rd32(dev, 0x3248));
435 nv_wo32(dev, ramfc, 0x78/4, nv_rd32(dev, 0x2088)); 435 nv_wo32(ramfc, 0x78, nv_rd32(dev, 0x2088));
436 nv_wo32(dev, ramfc, 0x7c/4, nv_rd32(dev, 0x2058)); 436 nv_wo32(ramfc, 0x7c, nv_rd32(dev, 0x2058));
437 nv_wo32(dev, ramfc, 0x80/4, nv_rd32(dev, 0x2210)); 437 nv_wo32(ramfc, 0x80, nv_rd32(dev, 0x2210));
438 438
439 put = (nv_rd32(dev, NV03_PFIFO_CACHE1_PUT) & 0x7ff) >> 2; 439 put = (nv_rd32(dev, NV03_PFIFO_CACHE1_PUT) & 0x7ff) >> 2;
440 get = (nv_rd32(dev, NV03_PFIFO_CACHE1_GET) & 0x7ff) >> 2; 440 get = (nv_rd32(dev, NV03_PFIFO_CACHE1_GET) & 0x7ff) >> 2;
441 ptr = 0; 441 ptr = 0;
442 while (put != get) { 442 while (put != get) {
443 nv_wo32(dev, cache, ptr++, 443 nv_wo32(cache, ptr + 0,
444 nv_rd32(dev, NV40_PFIFO_CACHE1_METHOD(get))); 444 nv_rd32(dev, NV40_PFIFO_CACHE1_METHOD(get)));
445 nv_wo32(dev, cache, ptr++, 445 nv_wo32(cache, ptr + 4,
446 nv_rd32(dev, NV40_PFIFO_CACHE1_DATA(get))); 446 nv_rd32(dev, NV40_PFIFO_CACHE1_DATA(get)));
447 get = (get + 1) & 0x1ff; 447 get = (get + 1) & 0x1ff;
448 ptr += 8;
448 } 449 }
449 450
450 /* guessing that all the 0x34xx regs aren't on NV50 */ 451 /* guessing that all the 0x34xx regs aren't on NV50 */
451 if (dev_priv->chipset != 0x50) { 452 if (dev_priv->chipset != 0x50) {
452 nv_wo32(dev, ramfc, 0x84/4, ptr >> 1); 453 nv_wo32(ramfc, 0x84, ptr >> 3);
453 nv_wo32(dev, ramfc, 0x88/4, nv_rd32(dev, 0x340c)); 454 nv_wo32(ramfc, 0x88, nv_rd32(dev, 0x340c));
454 nv_wo32(dev, ramfc, 0x8c/4, nv_rd32(dev, 0x3400)); 455 nv_wo32(ramfc, 0x8c, nv_rd32(dev, 0x3400));
455 nv_wo32(dev, ramfc, 0x90/4, nv_rd32(dev, 0x3404)); 456 nv_wo32(ramfc, 0x90, nv_rd32(dev, 0x3404));
456 nv_wo32(dev, ramfc, 0x94/4, nv_rd32(dev, 0x3408)); 457 nv_wo32(ramfc, 0x94, nv_rd32(dev, 0x3408));
457 nv_wo32(dev, ramfc, 0x98/4, nv_rd32(dev, 0x3410)); 458 nv_wo32(ramfc, 0x98, nv_rd32(dev, 0x3410));
458 } 459 }
459 460
460 dev_priv->engine.instmem.flush(dev); 461 dev_priv->engine.instmem.flush(dev);