diff options
author | Maarten Maathuis <madman2003@gmail.com> | 2009-12-26 15:46:36 -0500 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2010-01-10 18:06:37 -0500 |
commit | a510604df9444a2a1bdecafc048749e0f35816b5 (patch) | |
tree | c6eaff0a78854d4603393768149eacbf884cacc7 | |
parent | 1c7059e4f36e76c72cefbb6c9bd2bcf45c12e777 (diff) |
drm/nv50: make the blocksize depend on vram size
- This should be better than what we have now.
- I'm less sure about the non power of two path.
Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bo.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index a0c9e00e7062..e342a418d434 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
@@ -33,6 +33,8 @@ | |||
33 | #include "nouveau_drv.h" | 33 | #include "nouveau_drv.h" |
34 | #include "nouveau_dma.h" | 34 | #include "nouveau_dma.h" |
35 | 35 | ||
36 | #include <linux/log2.h> | ||
37 | |||
36 | static void | 38 | static void |
37 | nouveau_bo_del_ttm(struct ttm_buffer_object *bo) | 39 | nouveau_bo_del_ttm(struct ttm_buffer_object *bo) |
38 | { | 40 | { |
@@ -67,29 +69,29 @@ nouveau_bo_fixup_align(struct drm_device *dev, | |||
67 | * avoid corruption of other buffer objects. | 69 | * avoid corruption of other buffer objects. |
68 | */ | 70 | */ |
69 | if (dev_priv->card_type == NV_50) { | 71 | if (dev_priv->card_type == NV_50) { |
72 | uint32_t block_size = nouveau_mem_fb_amount(dev) >> 15; | ||
73 | int i; | ||
74 | |||
70 | switch (tile_flags) { | 75 | switch (tile_flags) { |
71 | case 0x1800: | 76 | case 0x1800: |
72 | case 0x2800: | 77 | case 0x2800: |
73 | case 0x4800: | 78 | case 0x4800: |
74 | case 0x7a00: | 79 | case 0x7a00: |
75 | if (dev_priv->chipset >= 0xA0) { | 80 | *size = roundup(*size, block_size); |
76 | *size = roundup(*size, 28672); | 81 | if (is_power_of_2(block_size)) { |
77 | /* This is based on high end cards with 448 bits | 82 | *size += 3 * block_size; |
78 | * memory bus, could be different elsewhere.*/ | 83 | for (i = 1; i < 10; i++) { |
79 | *size += 6 * 28672; | 84 | *align = 12 * i * block_size; |
80 | /* 8 * 28672 is the actual alignment requirement | 85 | if (!(*align % 65536)) |
81 | * but we must also align to page size. */ | 86 | break; |
82 | *align = 2 * 8 * 28672; | 87 | } |
83 | } else if (dev_priv->chipset >= 0x90) { | ||
84 | *size = roundup(*size, 16384); | ||
85 | *size += 3 * 16384; | ||
86 | *align = 12 * 16384; | ||
87 | } else { | 88 | } else { |
88 | *size = roundup(*size, 8192); | 89 | *size += 6 * block_size; |
89 | *size += 3 * 8192; | 90 | for (i = 1; i < 10; i++) { |
90 | /* 12 * 8192 is the actual alignment requirement | 91 | *align = 8 * i * block_size; |
91 | * but we must also align to page size. */ | 92 | if (!(*align % 65536)) |
92 | *align = 2 * 12 * 8192; | 93 | break; |
94 | } | ||
93 | } | 95 | } |
94 | break; | 96 | break; |
95 | default: | 97 | default: |