diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2010-07-07 23:15:05 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2010-07-12 20:13:44 -0400 |
commit | 816544b21b020bdb9dcb9a5003fe3e1f109e8698 (patch) | |
tree | 9900fe739b77e0025da23b4a694a1f40d453f857 /drivers/gpu/drm/nouveau/nv20_graph.c | |
parent | ec91db269e6a3c7f45b96169ccf5dbd1fde8fce8 (diff) |
drm/nouveau: allocate fixed amount of PRAMIN per channel on all chipsets
Previously only done on nv50+
This commit also switches unknown NV2x/NV3x chipsets to noaccel mode.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv20_graph.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nv20_graph.c | 58 |
1 files changed, 42 insertions, 16 deletions
diff --git a/drivers/gpu/drm/nouveau/nv20_graph.c b/drivers/gpu/drm/nouveau/nv20_graph.c index f3e6dd70d22e..0c776ee81e85 100644 --- a/drivers/gpu/drm/nouveau/nv20_graph.c +++ b/drivers/gpu/drm/nouveau/nv20_graph.c | |||
@@ -370,53 +370,42 @@ nv20_graph_create_context(struct nouveau_channel *chan) | |||
370 | { | 370 | { |
371 | struct drm_device *dev = chan->dev; | 371 | struct drm_device *dev = chan->dev; |
372 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 372 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
373 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; | ||
373 | void (*ctx_init)(struct drm_device *, struct nouveau_gpuobj *); | 374 | void (*ctx_init)(struct drm_device *, struct nouveau_gpuobj *); |
374 | unsigned int ctx_size; | ||
375 | unsigned int idoffs = 0x28/4; | 375 | unsigned int idoffs = 0x28/4; |
376 | int ret; | 376 | int ret; |
377 | 377 | ||
378 | switch (dev_priv->chipset) { | 378 | switch (dev_priv->chipset) { |
379 | case 0x20: | 379 | case 0x20: |
380 | ctx_size = NV20_GRCTX_SIZE; | ||
381 | ctx_init = nv20_graph_context_init; | 380 | ctx_init = nv20_graph_context_init; |
382 | idoffs = 0; | 381 | idoffs = 0; |
383 | break; | 382 | break; |
384 | case 0x25: | 383 | case 0x25: |
385 | case 0x28: | 384 | case 0x28: |
386 | ctx_size = NV25_GRCTX_SIZE; | ||
387 | ctx_init = nv25_graph_context_init; | 385 | ctx_init = nv25_graph_context_init; |
388 | break; | 386 | break; |
389 | case 0x2a: | 387 | case 0x2a: |
390 | ctx_size = NV2A_GRCTX_SIZE; | ||
391 | ctx_init = nv2a_graph_context_init; | 388 | ctx_init = nv2a_graph_context_init; |
392 | idoffs = 0; | 389 | idoffs = 0; |
393 | break; | 390 | break; |
394 | case 0x30: | 391 | case 0x30: |
395 | case 0x31: | 392 | case 0x31: |
396 | ctx_size = NV30_31_GRCTX_SIZE; | ||
397 | ctx_init = nv30_31_graph_context_init; | 393 | ctx_init = nv30_31_graph_context_init; |
398 | break; | 394 | break; |
399 | case 0x34: | 395 | case 0x34: |
400 | ctx_size = NV34_GRCTX_SIZE; | ||
401 | ctx_init = nv34_graph_context_init; | 396 | ctx_init = nv34_graph_context_init; |
402 | break; | 397 | break; |
403 | case 0x35: | 398 | case 0x35: |
404 | case 0x36: | 399 | case 0x36: |
405 | ctx_size = NV35_36_GRCTX_SIZE; | ||
406 | ctx_init = nv35_36_graph_context_init; | 400 | ctx_init = nv35_36_graph_context_init; |
407 | break; | 401 | break; |
408 | default: | 402 | default: |
409 | ctx_size = 0; | 403 | BUG_ON(1); |
410 | ctx_init = nv35_36_graph_context_init; | ||
411 | NV_ERROR(dev, "Please contact the devs if you want your NV%x" | ||
412 | " card to work\n", dev_priv->chipset); | ||
413 | return -ENOSYS; | ||
414 | break; | ||
415 | } | 404 | } |
416 | 405 | ||
417 | ret = nouveau_gpuobj_new_ref(dev, chan, NULL, 0, ctx_size, 16, | 406 | ret = nouveau_gpuobj_new_ref(dev, chan, NULL, 0, pgraph->grctx_size, |
418 | NVOBJ_FLAG_ZERO_ALLOC, | 407 | 16, NVOBJ_FLAG_ZERO_ALLOC, |
419 | &chan->ramin_grctx); | 408 | &chan->ramin_grctx); |
420 | if (ret) | 409 | if (ret) |
421 | return ret; | 410 | return ret; |
422 | 411 | ||
@@ -535,9 +524,27 @@ nv20_graph_init(struct drm_device *dev) | |||
535 | { | 524 | { |
536 | struct drm_nouveau_private *dev_priv = | 525 | struct drm_nouveau_private *dev_priv = |
537 | (struct drm_nouveau_private *)dev->dev_private; | 526 | (struct drm_nouveau_private *)dev->dev_private; |
527 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; | ||
538 | uint32_t tmp, vramsz; | 528 | uint32_t tmp, vramsz; |
539 | int ret, i; | 529 | int ret, i; |
540 | 530 | ||
531 | switch (dev_priv->chipset) { | ||
532 | case 0x20: | ||
533 | pgraph->grctx_size = NV20_GRCTX_SIZE; | ||
534 | break; | ||
535 | case 0x25: | ||
536 | case 0x28: | ||
537 | pgraph->grctx_size = NV25_GRCTX_SIZE; | ||
538 | break; | ||
539 | case 0x2a: | ||
540 | pgraph->grctx_size = NV2A_GRCTX_SIZE; | ||
541 | break; | ||
542 | default: | ||
543 | NV_ERROR(dev, "unknown chipset, disabling acceleration\n"); | ||
544 | pgraph->accel_blocked = true; | ||
545 | return 0; | ||
546 | } | ||
547 | |||
541 | nv_wr32(dev, NV03_PMC_ENABLE, | 548 | nv_wr32(dev, NV03_PMC_ENABLE, |
542 | nv_rd32(dev, NV03_PMC_ENABLE) & ~NV_PMC_ENABLE_PGRAPH); | 549 | nv_rd32(dev, NV03_PMC_ENABLE) & ~NV_PMC_ENABLE_PGRAPH); |
543 | nv_wr32(dev, NV03_PMC_ENABLE, | 550 | nv_wr32(dev, NV03_PMC_ENABLE, |
@@ -647,8 +654,27 @@ int | |||
647 | nv30_graph_init(struct drm_device *dev) | 654 | nv30_graph_init(struct drm_device *dev) |
648 | { | 655 | { |
649 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 656 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
657 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; | ||
650 | int ret, i; | 658 | int ret, i; |
651 | 659 | ||
660 | switch (dev_priv->chipset) { | ||
661 | case 0x30: | ||
662 | case 0x31: | ||
663 | pgraph->grctx_size = NV30_31_GRCTX_SIZE; | ||
664 | break; | ||
665 | case 0x34: | ||
666 | pgraph->grctx_size = NV34_GRCTX_SIZE; | ||
667 | break; | ||
668 | case 0x35: | ||
669 | case 0x36: | ||
670 | pgraph->grctx_size = NV35_36_GRCTX_SIZE; | ||
671 | break; | ||
672 | default: | ||
673 | NV_ERROR(dev, "unknown chipset, disabling acceleration\n"); | ||
674 | pgraph->accel_blocked = true; | ||
675 | return 0; | ||
676 | } | ||
677 | |||
652 | nv_wr32(dev, NV03_PMC_ENABLE, | 678 | nv_wr32(dev, NV03_PMC_ENABLE, |
653 | nv_rd32(dev, NV03_PMC_ENABLE) & ~NV_PMC_ENABLE_PGRAPH); | 679 | nv_rd32(dev, NV03_PMC_ENABLE) & ~NV_PMC_ENABLE_PGRAPH); |
654 | nv_wr32(dev, NV03_PMC_ENABLE, | 680 | nv_wr32(dev, NV03_PMC_ENABLE, |