Ben Skeggs | 6ee7386 | 2009-12-11 19:24:15 +1000 | [diff] [blame] | 1 | #include "drmP.h" |
| 2 | #include "drm.h" |
| 3 | #include "nouveau_drv.h" |
| 4 | #include "nouveau_drm.h" |
| 5 | |
Francisco Jerez | 0d87c10 | 2009-12-16 12:12:27 +0100 | [diff] [blame] | 6 | void |
Francisco Jerez | a5cf68b | 2010-10-24 16:14:41 +0200 | [diff] [blame^] | 7 | nv40_fb_set_tile_region(struct drm_device *dev, int i) |
Francisco Jerez | 0d87c10 | 2009-12-16 12:12:27 +0100 | [diff] [blame] | 8 | { |
| 9 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
Francisco Jerez | a5cf68b | 2010-10-24 16:14:41 +0200 | [diff] [blame^] | 10 | struct nouveau_tile_reg *tile = &dev_priv->tile.reg[i]; |
Francisco Jerez | 0d87c10 | 2009-12-16 12:12:27 +0100 | [diff] [blame] | 11 | |
| 12 | switch (dev_priv->chipset) { |
| 13 | case 0x40: |
Francisco Jerez | a5cf68b | 2010-10-24 16:14:41 +0200 | [diff] [blame^] | 14 | nv_wr32(dev, NV10_PFB_TLIMIT(i), tile->limit); |
| 15 | nv_wr32(dev, NV10_PFB_TSIZE(i), tile->pitch); |
| 16 | nv_wr32(dev, NV10_PFB_TILE(i), tile->addr); |
Francisco Jerez | 0d87c10 | 2009-12-16 12:12:27 +0100 | [diff] [blame] | 17 | break; |
| 18 | |
| 19 | default: |
Francisco Jerez | a5cf68b | 2010-10-24 16:14:41 +0200 | [diff] [blame^] | 20 | nv_wr32(dev, NV40_PFB_TLIMIT(i), tile->limit); |
| 21 | nv_wr32(dev, NV40_PFB_TSIZE(i), tile->pitch); |
| 22 | nv_wr32(dev, NV40_PFB_TILE(i), tile->addr); |
Francisco Jerez | 0d87c10 | 2009-12-16 12:12:27 +0100 | [diff] [blame] | 23 | break; |
| 24 | } |
| 25 | } |
| 26 | |
Ben Skeggs | 6ee7386 | 2009-12-11 19:24:15 +1000 | [diff] [blame] | 27 | int |
| 28 | nv40_fb_init(struct drm_device *dev) |
| 29 | { |
| 30 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
Francisco Jerez | 0d87c10 | 2009-12-16 12:12:27 +0100 | [diff] [blame] | 31 | struct nouveau_fb_engine *pfb = &dev_priv->engine.fb; |
| 32 | uint32_t tmp; |
Ben Skeggs | 6ee7386 | 2009-12-11 19:24:15 +1000 | [diff] [blame] | 33 | int i; |
| 34 | |
| 35 | /* This is strictly a NV4x register (don't know about NV5x). */ |
| 36 | /* The blob sets these to all kinds of values, and they mess up our setup. */ |
| 37 | /* I got value 0x52802 instead. For some cards the blob even sets it back to 0x1. */ |
| 38 | /* Note: the blob doesn't read this value, so i'm pretty sure this is safe for all cards. */ |
| 39 | /* Any idea what this is? */ |
| 40 | nv_wr32(dev, NV40_PFB_UNK_800, 0x1); |
| 41 | |
| 42 | switch (dev_priv->chipset) { |
| 43 | case 0x40: |
| 44 | case 0x45: |
| 45 | tmp = nv_rd32(dev, NV10_PFB_CLOSE_PAGE2); |
| 46 | nv_wr32(dev, NV10_PFB_CLOSE_PAGE2, tmp & ~(1 << 15)); |
Francisco Jerez | 0d87c10 | 2009-12-16 12:12:27 +0100 | [diff] [blame] | 47 | pfb->num_tiles = NV10_PFB_TILE__SIZE; |
Ben Skeggs | 6ee7386 | 2009-12-11 19:24:15 +1000 | [diff] [blame] | 48 | break; |
| 49 | case 0x46: /* G72 */ |
| 50 | case 0x47: /* G70 */ |
| 51 | case 0x49: /* G71 */ |
| 52 | case 0x4b: /* G73 */ |
| 53 | case 0x4c: /* C51 (G7X version) */ |
Francisco Jerez | 0d87c10 | 2009-12-16 12:12:27 +0100 | [diff] [blame] | 54 | pfb->num_tiles = NV40_PFB_TILE__SIZE_1; |
Ben Skeggs | 6ee7386 | 2009-12-11 19:24:15 +1000 | [diff] [blame] | 55 | break; |
| 56 | default: |
Francisco Jerez | 0d87c10 | 2009-12-16 12:12:27 +0100 | [diff] [blame] | 57 | pfb->num_tiles = NV40_PFB_TILE__SIZE_0; |
Ben Skeggs | 6ee7386 | 2009-12-11 19:24:15 +1000 | [diff] [blame] | 58 | break; |
| 59 | } |
| 60 | |
Francisco Jerez | 0d87c10 | 2009-12-16 12:12:27 +0100 | [diff] [blame] | 61 | /* Turn all the tiling regions off. */ |
| 62 | for (i = 0; i < pfb->num_tiles; i++) |
Francisco Jerez | a5cf68b | 2010-10-24 16:14:41 +0200 | [diff] [blame^] | 63 | pfb->set_tile_region(dev, i); |
Ben Skeggs | 6ee7386 | 2009-12-11 19:24:15 +1000 | [diff] [blame] | 64 | |
| 65 | return 0; |
| 66 | } |
| 67 | |
| 68 | void |
| 69 | nv40_fb_takedown(struct drm_device *dev) |
| 70 | { |
| 71 | } |