aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bo.c36
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
36static void 38static void
37nouveau_bo_del_ttm(struct ttm_buffer_object *bo) 39nouveau_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: