diff options
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_mem.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_mem.c | 66 |
1 files changed, 43 insertions, 23 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c index c3e953b08992..2960f583dc38 100644 --- a/drivers/gpu/drm/nouveau/nouveau_mem.c +++ b/drivers/gpu/drm/nouveau/nouveau_mem.c | |||
@@ -51,8 +51,7 @@ nv10_mem_update_tile_region(struct drm_device *dev, | |||
51 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 51 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
52 | struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo; | 52 | struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo; |
53 | struct nouveau_fb_engine *pfb = &dev_priv->engine.fb; | 53 | struct nouveau_fb_engine *pfb = &dev_priv->engine.fb; |
54 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; | 54 | int i = tile - dev_priv->tile.reg, j; |
55 | int i = tile - dev_priv->tile.reg; | ||
56 | unsigned long save; | 55 | unsigned long save; |
57 | 56 | ||
58 | nouveau_fence_unref(&tile->fence); | 57 | nouveau_fence_unref(&tile->fence); |
@@ -70,7 +69,10 @@ nv10_mem_update_tile_region(struct drm_device *dev, | |||
70 | nouveau_wait_for_idle(dev); | 69 | nouveau_wait_for_idle(dev); |
71 | 70 | ||
72 | pfb->set_tile_region(dev, i); | 71 | pfb->set_tile_region(dev, i); |
73 | pgraph->set_tile_region(dev, i); | 72 | for (j = 0; j < NVOBJ_ENGINE_NR; j++) { |
73 | if (dev_priv->eng[j] && dev_priv->eng[j]->set_tile_region) | ||
74 | dev_priv->eng[j]->set_tile_region(dev, i); | ||
75 | } | ||
74 | 76 | ||
75 | pfifo->cache_pull(dev, true); | 77 | pfifo->cache_pull(dev, true); |
76 | pfifo->reassign(dev, true); | 78 | pfifo->reassign(dev, true); |
@@ -595,10 +597,10 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
595 | if (!memtimings->timing) | 597 | if (!memtimings->timing) |
596 | return; | 598 | return; |
597 | 599 | ||
598 | /* Get "some number" from the timing reg for NV_40 | 600 | /* Get "some number" from the timing reg for NV_40 and NV_50 |
599 | * Used in calculations later */ | 601 | * Used in calculations later */ |
600 | if(dev_priv->card_type == NV_40) { | 602 | if (dev_priv->card_type >= NV_40 && dev_priv->chipset < 0x98) { |
601 | magic_number = (nv_rd32(dev,0x100228) & 0x0f000000) >> 24; | 603 | magic_number = (nv_rd32(dev, 0x100228) & 0x0f000000) >> 24; |
602 | } | 604 | } |
603 | 605 | ||
604 | entry = mem + mem[1]; | 606 | entry = mem + mem[1]; |
@@ -641,51 +643,68 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
641 | /* XXX: I don't trust the -1's and +1's... they must come | 643 | /* XXX: I don't trust the -1's and +1's... they must come |
642 | * from somewhere! */ | 644 | * from somewhere! */ |
643 | timing->reg_100224 = (tUNK_0 + tUNK_19 + 1 + magic_number) << 24 | | 645 | timing->reg_100224 = (tUNK_0 + tUNK_19 + 1 + magic_number) << 24 | |
644 | tUNK_18 << 16 | | 646 | max(tUNK_18, (u8) 1) << 16 | |
645 | (tUNK_1 + tUNK_19 + 1 + magic_number) << 8; | 647 | (tUNK_1 + tUNK_19 + 1 + magic_number) << 8; |
646 | if(dev_priv->chipset == 0xa8) { | 648 | if (dev_priv->chipset == 0xa8) { |
647 | timing->reg_100224 |= (tUNK_2 - 1); | 649 | timing->reg_100224 |= (tUNK_2 - 1); |
648 | } else { | 650 | } else { |
649 | timing->reg_100224 |= (tUNK_2 + 2 - magic_number); | 651 | timing->reg_100224 |= (tUNK_2 + 2 - magic_number); |
650 | } | 652 | } |
651 | 653 | ||
652 | timing->reg_100228 = (tUNK_12 << 16 | tUNK_11 << 8 | tUNK_10); | 654 | timing->reg_100228 = (tUNK_12 << 16 | tUNK_11 << 8 | tUNK_10); |
653 | if(dev_priv->chipset >= 0xa3 && dev_priv->chipset < 0xaa) { | 655 | if (dev_priv->chipset >= 0xa3 && dev_priv->chipset < 0xaa) |
654 | timing->reg_100228 |= (tUNK_19 - 1) << 24; | 656 | timing->reg_100228 |= (tUNK_19 - 1) << 24; |
655 | } | 657 | else |
658 | timing->reg_100228 |= magic_number << 24; | ||
656 | 659 | ||
657 | if(dev_priv->card_type == NV_40) { | 660 | if (dev_priv->card_type == NV_40) { |
658 | /* NV40: don't know what the rest of the regs are.. | 661 | /* NV40: don't know what the rest of the regs are.. |
659 | * And don't need to know either */ | 662 | * And don't need to know either */ |
660 | timing->reg_100228 |= 0x20200000 | magic_number << 24; | 663 | timing->reg_100228 |= 0x20200000; |
661 | } else if(dev_priv->card_type >= NV_50) { | 664 | } else if (dev_priv->card_type >= NV_50) { |
662 | /* XXX: reg_10022c */ | 665 | if (dev_priv->chipset < 0x98 || |
663 | timing->reg_10022c = tUNK_2 - 1; | 666 | (dev_priv->chipset == 0x98 && |
667 | dev_priv->stepping <= 0xa1)) { | ||
668 | timing->reg_10022c = (0x14 + tUNK_2) << 24 | | ||
669 | 0x16 << 16 | | ||
670 | (tUNK_2 - 1) << 8 | | ||
671 | (tUNK_2 - 1); | ||
672 | } else { | ||
673 | /* XXX: reg_10022c for recentish cards */ | ||
674 | timing->reg_10022c = tUNK_2 - 1; | ||
675 | } | ||
664 | 676 | ||
665 | timing->reg_100230 = (tUNK_20 << 24 | tUNK_21 << 16 | | 677 | timing->reg_100230 = (tUNK_20 << 24 | tUNK_21 << 16 | |
666 | tUNK_13 << 8 | tUNK_13); | 678 | tUNK_13 << 8 | tUNK_13); |
667 | 679 | ||
668 | timing->reg_100234 = (tRAS << 24 | tRC); | 680 | timing->reg_100234 = (tRAS << 24 | tRC); |
669 | timing->reg_100234 += max(tUNK_10,tUNK_11) << 16; | 681 | timing->reg_100234 += max(tUNK_10, tUNK_11) << 16; |
670 | 682 | ||
671 | if(dev_priv->chipset < 0xa3) { | 683 | if (dev_priv->chipset < 0x98 || |
684 | (dev_priv->chipset == 0x98 && | ||
685 | dev_priv->stepping <= 0xa1)) { | ||
672 | timing->reg_100234 |= (tUNK_2 + 2) << 8; | 686 | timing->reg_100234 |= (tUNK_2 + 2) << 8; |
673 | } else { | 687 | } else { |
674 | /* XXX: +6? */ | 688 | /* XXX: +6? */ |
675 | timing->reg_100234 |= (tUNK_19 + 6) << 8; | 689 | timing->reg_100234 |= (tUNK_19 + 6) << 8; |
676 | } | 690 | } |
677 | 691 | ||
678 | /* XXX; reg_100238, reg_10023c | 692 | /* XXX; reg_100238 |
679 | * reg_100238: 0x00?????? | 693 | * reg_100238: 0x00?????? */ |
680 | * reg_10023c: 0x!!??0202 for NV50+ cards (empirical evidence) */ | ||
681 | timing->reg_10023c = 0x202; | 694 | timing->reg_10023c = 0x202; |
682 | if(dev_priv->chipset < 0xa3) { | 695 | if (dev_priv->chipset < 0x98 || |
696 | (dev_priv->chipset == 0x98 && | ||
697 | dev_priv->stepping <= 0xa1)) { | ||
683 | timing->reg_10023c |= 0x4000000 | (tUNK_2 - 1) << 16; | 698 | timing->reg_10023c |= 0x4000000 | (tUNK_2 - 1) << 16; |
684 | } else { | 699 | } else { |
685 | /* currently unknown | 700 | /* XXX: reg_10023c |
701 | * currently unknown | ||
686 | * 10023c seen as 06xxxxxx, 0bxxxxxx or 0fxxxxxx */ | 702 | * 10023c seen as 06xxxxxx, 0bxxxxxx or 0fxxxxxx */ |
687 | } | 703 | } |
704 | |||
705 | /* XXX: reg_100240? */ | ||
688 | } | 706 | } |
707 | timing->id = i; | ||
689 | 708 | ||
690 | NV_DEBUG(dev, "Entry %d: 220: %08x %08x %08x %08x\n", i, | 709 | NV_DEBUG(dev, "Entry %d: 220: %08x %08x %08x %08x\n", i, |
691 | timing->reg_100220, timing->reg_100224, | 710 | timing->reg_100220, timing->reg_100224, |
@@ -693,10 +712,11 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
693 | NV_DEBUG(dev, " 230: %08x %08x %08x %08x\n", | 712 | NV_DEBUG(dev, " 230: %08x %08x %08x %08x\n", |
694 | timing->reg_100230, timing->reg_100234, | 713 | timing->reg_100230, timing->reg_100234, |
695 | timing->reg_100238, timing->reg_10023c); | 714 | timing->reg_100238, timing->reg_10023c); |
715 | NV_DEBUG(dev, " 240: %08x\n", timing->reg_100240); | ||
696 | } | 716 | } |
697 | 717 | ||
698 | memtimings->nr_timing = entries; | 718 | memtimings->nr_timing = entries; |
699 | memtimings->supported = true; | 719 | memtimings->supported = (dev_priv->chipset <= 0x98); |
700 | } | 720 | } |
701 | 721 | ||
702 | void | 722 | void |