aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2010-12-06 00:28:54 -0500
committerBen Skeggs <bskeggs@redhat.com>2010-12-07 22:48:20 -0500
commit60d2a88ae896ae51c76f8b15c2f4b762d5b00864 (patch)
treee136aee905d35f8936036fd01af1ca29526fcc67
parent34cf01bc4b8021cef62cbd79224577c13d01b106 (diff)
drm/nouveau: kick vram functions out into an "engine"
NVC0 will be able to share some of nv50's paths this way. This also makes it the card-specific vram code responsible for deciding if a given set of tile_flags is valid, rather than duplicating the allowed types in nv50_vram.c and nouveau_gem.c Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.h12
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_gem.c30
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_mem.c47
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_mm.h1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_state.c16
-rw-r--r--drivers/gpu/drm/nouveau/nv50_instmem.c9
-rw-r--r--drivers/gpu/drm/nouveau/nv50_vram.c10
7 files changed, 74 insertions, 51 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index 2cd87e6b54b7..f8931b2d129b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -501,6 +501,15 @@ struct nouveau_crypt_engine {
501 void (*tlb_flush)(struct drm_device *dev); 501 void (*tlb_flush)(struct drm_device *dev);
502}; 502};
503 503
504struct nouveau_vram_engine {
505 int (*init)(struct drm_device *);
506 int (*get)(struct drm_device *, u64, u32 align, u32 size_nc,
507 u32 type, struct nouveau_vram **);
508 void (*put)(struct drm_device *, struct nouveau_vram **);
509
510 bool (*flags_valid)(struct drm_device *, u32 tile_flags);
511};
512
504struct nouveau_engine { 513struct nouveau_engine {
505 struct nouveau_instmem_engine instmem; 514 struct nouveau_instmem_engine instmem;
506 struct nouveau_mc_engine mc; 515 struct nouveau_mc_engine mc;
@@ -512,6 +521,7 @@ struct nouveau_engine {
512 struct nouveau_gpio_engine gpio; 521 struct nouveau_gpio_engine gpio;
513 struct nouveau_pm_engine pm; 522 struct nouveau_pm_engine pm;
514 struct nouveau_crypt_engine crypt; 523 struct nouveau_crypt_engine crypt;
524 struct nouveau_vram_engine vram;
515}; 525};
516 526
517struct nouveau_pll_vals { 527struct nouveau_pll_vals {
@@ -821,6 +831,8 @@ extern void nouveau_mem_gart_fini(struct drm_device *);
821extern int nouveau_mem_init_agp(struct drm_device *); 831extern int nouveau_mem_init_agp(struct drm_device *);
822extern int nouveau_mem_reset_agp(struct drm_device *); 832extern int nouveau_mem_reset_agp(struct drm_device *);
823extern void nouveau_mem_close(struct drm_device *); 833extern void nouveau_mem_close(struct drm_device *);
834extern int nouveau_mem_detect(struct drm_device *);
835extern bool nouveau_mem_flags_valid(struct drm_device *, u32 tile_flags);
824extern struct nouveau_tile_reg *nv10_mem_set_tiling( 836extern struct nouveau_tile_reg *nv10_mem_set_tiling(
825 struct drm_device *dev, uint32_t addr, uint32_t size, 837 struct drm_device *dev, uint32_t addr, uint32_t size,
826 uint32_t pitch, uint32_t flags); 838 uint32_t pitch, uint32_t flags);
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
index 0adb2a85c143..506c508b7eda 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -103,32 +103,6 @@ nouveau_gem_info(struct drm_gem_object *gem, struct drm_nouveau_gem_info *rep)
103 return 0; 103 return 0;
104} 104}
105 105
106static bool
107nouveau_gem_tile_flags_valid(struct drm_device *dev, uint32_t tile_flags)
108{
109 struct drm_nouveau_private *dev_priv = dev->dev_private;
110
111 if (dev_priv->card_type >= NV_50) {
112 switch (tile_flags & NOUVEAU_GEM_TILE_LAYOUT_MASK) {
113 case 0x0000:
114 case 0x1800:
115 case 0x2800:
116 case 0x4800:
117 case 0x7000:
118 case 0x7400:
119 case 0x7a00:
120 case 0xe000:
121 return true;
122 }
123 } else {
124 if (!(tile_flags & NOUVEAU_GEM_TILE_LAYOUT_MASK))
125 return true;
126 }
127
128 NV_ERROR(dev, "bad page flags: 0x%08x\n", tile_flags);
129 return false;
130}
131
132int 106int
133nouveau_gem_ioctl_new(struct drm_device *dev, void *data, 107nouveau_gem_ioctl_new(struct drm_device *dev, void *data,
134 struct drm_file *file_priv) 108 struct drm_file *file_priv)
@@ -150,8 +124,10 @@ nouveau_gem_ioctl_new(struct drm_device *dev, void *data,
150 if (!flags || req->info.domain & NOUVEAU_GEM_DOMAIN_CPU) 124 if (!flags || req->info.domain & NOUVEAU_GEM_DOMAIN_CPU)
151 flags |= TTM_PL_FLAG_SYSTEM; 125 flags |= TTM_PL_FLAG_SYSTEM;
152 126
153 if (!nouveau_gem_tile_flags_valid(dev, req->info.tile_flags)) 127 if (!dev_priv->engine.vram.flags_valid(dev, req->info.tile_flags)) {
128 NV_ERROR(dev, "bad page flags: 0x%08x\n", req->info.tile_flags);
154 return -EINVAL; 129 return -EINVAL;
130 }
155 131
156 if (req->channel_hint) { 132 if (req->channel_hint) {
157 chan = nouveau_channel_get(dev, file_priv, req->channel_hint); 133 chan = nouveau_channel_get(dev, file_priv, req->channel_hint);
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c
index 5a1809480388..224181193a1f 100644
--- a/drivers/gpu/drm/nouveau/nouveau_mem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_mem.c
@@ -241,7 +241,7 @@ nouveau_mem_detect_nforce(struct drm_device *dev)
241 return 0; 241 return 0;
242} 242}
243 243
244static int 244int
245nouveau_mem_detect(struct drm_device *dev) 245nouveau_mem_detect(struct drm_device *dev)
246{ 246{
247 struct drm_nouveau_private *dev_priv = dev->dev_private; 247 struct drm_nouveau_private *dev_priv = dev->dev_private;
@@ -255,26 +255,25 @@ nouveau_mem_detect(struct drm_device *dev)
255 if (dev_priv->card_type < NV_50) { 255 if (dev_priv->card_type < NV_50) {
256 dev_priv->vram_size = nv_rd32(dev, NV04_PFB_FIFO_DATA); 256 dev_priv->vram_size = nv_rd32(dev, NV04_PFB_FIFO_DATA);
257 dev_priv->vram_size &= NV10_PFB_FIFO_DATA_RAM_AMOUNT_MB_MASK; 257 dev_priv->vram_size &= NV10_PFB_FIFO_DATA_RAM_AMOUNT_MB_MASK;
258 } else
259 if (dev_priv->card_type < NV_C0) {
260 if (nv50_vram_init(dev))
261 return -ENOMEM;
262 } else { 258 } else {
263 dev_priv->vram_size = nv_rd32(dev, 0x10f20c) << 20; 259 dev_priv->vram_size = nv_rd32(dev, 0x10f20c) << 20;
264 dev_priv->vram_size *= nv_rd32(dev, 0x121c74); 260 dev_priv->vram_size *= nv_rd32(dev, 0x121c74);
265 } 261 }
266 262
267 NV_INFO(dev, "Detected %dMiB VRAM\n", (int)(dev_priv->vram_size >> 20));
268 if (dev_priv->vram_sys_base) {
269 NV_INFO(dev, "Stolen system memory at: 0x%010llx\n",
270 dev_priv->vram_sys_base);
271 }
272
273 if (dev_priv->vram_size) 263 if (dev_priv->vram_size)
274 return 0; 264 return 0;
275 return -ENOMEM; 265 return -ENOMEM;
276} 266}
277 267
268bool
269nouveau_mem_flags_valid(struct drm_device *dev, u32 tile_flags)
270{
271 if (!(tile_flags & NOUVEAU_GEM_TILE_LAYOUT_MASK))
272 return true;
273
274 return false;
275}
276
278#if __OS_HAS_AGP 277#if __OS_HAS_AGP
279static unsigned long 278static unsigned long
280get_agp_mode(struct drm_device *dev, unsigned long mode) 279get_agp_mode(struct drm_device *dev, unsigned long mode)
@@ -432,11 +431,16 @@ nouveau_mem_vram_init(struct drm_device *dev)
432 else 431 else
433 dev_priv->ramin_rsvd_vram = (512 * 1024); 432 dev_priv->ramin_rsvd_vram = (512 * 1024);
434 433
435 /* initialise gpu-specific vram backend */ 434 ret = dev_priv->engine.vram.init(dev);
436 ret = nouveau_mem_detect(dev);
437 if (ret) 435 if (ret)
438 return ret; 436 return ret;
439 437
438 NV_INFO(dev, "Detected %dMiB VRAM\n", (int)(dev_priv->vram_size >> 20));
439 if (dev_priv->vram_sys_base) {
440 NV_INFO(dev, "Stolen system memory at: 0x%010llx\n",
441 dev_priv->vram_sys_base);
442 }
443
440 dev_priv->fb_available_size = dev_priv->vram_size; 444 dev_priv->fb_available_size = dev_priv->vram_size;
441 dev_priv->fb_mappable_pages = dev_priv->fb_available_size; 445 dev_priv->fb_mappable_pages = dev_priv->fb_available_size;
442 if (dev_priv->fb_mappable_pages > pci_resource_len(dev->pdev, 1)) 446 if (dev_priv->fb_mappable_pages > pci_resource_len(dev->pdev, 1))
@@ -698,9 +702,10 @@ nouveau_vram_manager_del(struct ttm_mem_type_manager *man,
698 struct ttm_mem_reg *mem) 702 struct ttm_mem_reg *mem)
699{ 703{
700 struct drm_nouveau_private *dev_priv = nouveau_bdev(man->bdev); 704 struct drm_nouveau_private *dev_priv = nouveau_bdev(man->bdev);
705 struct nouveau_vram_engine *vram = &dev_priv->engine.vram;
701 struct drm_device *dev = dev_priv->dev; 706 struct drm_device *dev = dev_priv->dev;
702 707
703 nv50_vram_del(dev, (struct nouveau_vram **)&mem->mm_node); 708 vram->put(dev, (struct nouveau_vram **)&mem->mm_node);
704} 709}
705 710
706static int 711static int
@@ -710,30 +715,30 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man,
710 struct ttm_mem_reg *mem) 715 struct ttm_mem_reg *mem)
711{ 716{
712 struct drm_nouveau_private *dev_priv = nouveau_bdev(man->bdev); 717 struct drm_nouveau_private *dev_priv = nouveau_bdev(man->bdev);
718 struct nouveau_vram_engine *vram = &dev_priv->engine.vram;
713 struct drm_device *dev = dev_priv->dev; 719 struct drm_device *dev = dev_priv->dev;
714 struct nouveau_bo *nvbo = nouveau_bo(bo); 720 struct nouveau_bo *nvbo = nouveau_bo(bo);
715 struct nouveau_vram *vram; 721 struct nouveau_vram *node;
716 u32 size_nc = 0; 722 u32 size_nc = 0;
717 int ret; 723 int ret;
718 724
719 if (nvbo->tile_flags & NOUVEAU_GEM_TILE_NONCONTIG) 725 if (nvbo->tile_flags & NOUVEAU_GEM_TILE_NONCONTIG)
720 size_nc = 1 << nvbo->vma.node->type; 726 size_nc = 1 << nvbo->vma.node->type;
721 727
722 ret = nv50_vram_new(dev, mem->num_pages << PAGE_SHIFT, 728 ret = vram->get(dev, mem->num_pages << PAGE_SHIFT,
723 mem->page_alignment << PAGE_SHIFT, size_nc, 729 mem->page_alignment << PAGE_SHIFT, size_nc,
724 (nvbo->tile_flags >> 8) & 0x7f, &vram); 730 (nvbo->tile_flags >> 8) & 0xff, &node);
725 if (ret) 731 if (ret)
726 return ret; 732 return ret;
727 733
728 mem->mm_node = vram; 734 mem->mm_node = node;
729 mem->start = vram->offset >> PAGE_SHIFT; 735 mem->start = node->offset >> PAGE_SHIFT;
730 return 0; 736 return 0;
731} 737}
732 738
733void 739void
734nouveau_vram_manager_debug(struct ttm_mem_type_manager *man, const char *prefix) 740nouveau_vram_manager_debug(struct ttm_mem_type_manager *man, const char *prefix)
735{ 741{
736 struct ttm_bo_global *glob = man->bdev->glob;
737 struct nouveau_mm *mm = man->priv; 742 struct nouveau_mm *mm = man->priv;
738 struct nouveau_mm_node *r; 743 struct nouveau_mm_node *r;
739 u64 total = 0, ttotal[3] = {}, tused[3] = {}, tfree[3] = {}; 744 u64 total = 0, ttotal[3] = {}, tused[3] = {}, tfree[3] = {};
diff --git a/drivers/gpu/drm/nouveau/nouveau_mm.h b/drivers/gpu/drm/nouveau/nouveau_mm.h
index 7e8f8bd86d47..250e642de0a7 100644
--- a/drivers/gpu/drm/nouveau/nouveau_mm.h
+++ b/drivers/gpu/drm/nouveau/nouveau_mm.h
@@ -57,5 +57,6 @@ int nv50_vram_init(struct drm_device *);
57int nv50_vram_new(struct drm_device *, u64 size, u32 align, u32 size_nc, 57int nv50_vram_new(struct drm_device *, u64 size, u32 align, u32 size_nc,
58 u32 memtype, struct nouveau_vram **); 58 u32 memtype, struct nouveau_vram **);
59void nv50_vram_del(struct drm_device *, struct nouveau_vram **); 59void nv50_vram_del(struct drm_device *, struct nouveau_vram **);
60bool nv50_vram_flags_valid(struct drm_device *, u32 tile_flags);
60 61
61#endif 62#endif
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
index e0811f93243d..8eac943e8fd2 100644
--- a/drivers/gpu/drm/nouveau/nouveau_state.c
+++ b/drivers/gpu/drm/nouveau/nouveau_state.c
@@ -100,6 +100,8 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev)
100 engine->pm.clock_set = nv04_pm_clock_set; 100 engine->pm.clock_set = nv04_pm_clock_set;
101 engine->crypt.init = nouveau_stub_init; 101 engine->crypt.init = nouveau_stub_init;
102 engine->crypt.takedown = nouveau_stub_takedown; 102 engine->crypt.takedown = nouveau_stub_takedown;
103 engine->vram.init = nouveau_mem_detect;
104 engine->vram.flags_valid = nouveau_mem_flags_valid;
103 break; 105 break;
104 case 0x10: 106 case 0x10:
105 engine->instmem.init = nv04_instmem_init; 107 engine->instmem.init = nv04_instmem_init;
@@ -157,6 +159,8 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev)
157 engine->pm.clock_set = nv04_pm_clock_set; 159 engine->pm.clock_set = nv04_pm_clock_set;
158 engine->crypt.init = nouveau_stub_init; 160 engine->crypt.init = nouveau_stub_init;
159 engine->crypt.takedown = nouveau_stub_takedown; 161 engine->crypt.takedown = nouveau_stub_takedown;
162 engine->vram.init = nouveau_mem_detect;
163 engine->vram.flags_valid = nouveau_mem_flags_valid;
160 break; 164 break;
161 case 0x20: 165 case 0x20:
162 engine->instmem.init = nv04_instmem_init; 166 engine->instmem.init = nv04_instmem_init;
@@ -214,6 +218,8 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev)
214 engine->pm.clock_set = nv04_pm_clock_set; 218 engine->pm.clock_set = nv04_pm_clock_set;
215 engine->crypt.init = nouveau_stub_init; 219 engine->crypt.init = nouveau_stub_init;
216 engine->crypt.takedown = nouveau_stub_takedown; 220 engine->crypt.takedown = nouveau_stub_takedown;
221 engine->vram.init = nouveau_mem_detect;
222 engine->vram.flags_valid = nouveau_mem_flags_valid;
217 break; 223 break;
218 case 0x30: 224 case 0x30:
219 engine->instmem.init = nv04_instmem_init; 225 engine->instmem.init = nv04_instmem_init;
@@ -273,6 +279,8 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev)
273 engine->pm.voltage_set = nouveau_voltage_gpio_set; 279 engine->pm.voltage_set = nouveau_voltage_gpio_set;
274 engine->crypt.init = nouveau_stub_init; 280 engine->crypt.init = nouveau_stub_init;
275 engine->crypt.takedown = nouveau_stub_takedown; 281 engine->crypt.takedown = nouveau_stub_takedown;
282 engine->vram.init = nouveau_mem_detect;
283 engine->vram.flags_valid = nouveau_mem_flags_valid;
276 break; 284 break;
277 case 0x40: 285 case 0x40:
278 case 0x60: 286 case 0x60:
@@ -334,6 +342,8 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev)
334 engine->pm.temp_get = nv40_temp_get; 342 engine->pm.temp_get = nv40_temp_get;
335 engine->crypt.init = nouveau_stub_init; 343 engine->crypt.init = nouveau_stub_init;
336 engine->crypt.takedown = nouveau_stub_takedown; 344 engine->crypt.takedown = nouveau_stub_takedown;
345 engine->vram.init = nouveau_mem_detect;
346 engine->vram.flags_valid = nouveau_mem_flags_valid;
337 break; 347 break;
338 case 0x50: 348 case 0x50:
339 case 0x80: /* gotta love NVIDIA's consistency.. */ 349 case 0x80: /* gotta love NVIDIA's consistency.. */
@@ -444,6 +454,10 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev)
444 engine->crypt.takedown = nouveau_stub_takedown; 454 engine->crypt.takedown = nouveau_stub_takedown;
445 break; 455 break;
446 } 456 }
457 engine->vram.init = nv50_vram_init;
458 engine->vram.get = nv50_vram_new;
459 engine->vram.put = nv50_vram_del;
460 engine->vram.flags_valid = nv50_vram_flags_valid;
447 break; 461 break;
448 case 0xC0: 462 case 0xC0:
449 engine->instmem.init = nvc0_instmem_init; 463 engine->instmem.init = nvc0_instmem_init;
@@ -495,6 +509,8 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev)
495 engine->gpio.irq_enable = nv50_gpio_irq_enable; 509 engine->gpio.irq_enable = nv50_gpio_irq_enable;
496 engine->crypt.init = nouveau_stub_init; 510 engine->crypt.init = nouveau_stub_init;
497 engine->crypt.takedown = nouveau_stub_takedown; 511 engine->crypt.takedown = nouveau_stub_takedown;
512 engine->vram.init = nouveau_mem_detect;
513 engine->vram.flags_valid = nouveau_mem_flags_valid;
498 break; 514 break;
499 default: 515 default:
500 NV_ERROR(dev, "NV%02x unsupported\n", dev_priv->chipset); 516 NV_ERROR(dev, "NV%02x unsupported\n", dev_priv->chipset);
diff --git a/drivers/gpu/drm/nouveau/nv50_instmem.c b/drivers/gpu/drm/nouveau/nv50_instmem.c
index e2efd6f22ffb..38f30270cb9f 100644
--- a/drivers/gpu/drm/nouveau/nv50_instmem.c
+++ b/drivers/gpu/drm/nouveau/nv50_instmem.c
@@ -312,6 +312,7 @@ nv50_instmem_get(struct nouveau_gpuobj *gpuobj, u32 size, u32 align)
312{ 312{
313 struct drm_device *dev = gpuobj->dev; 313 struct drm_device *dev = gpuobj->dev;
314 struct drm_nouveau_private *dev_priv = dev->dev_private; 314 struct drm_nouveau_private *dev_priv = dev->dev_private;
315 struct nouveau_vram_engine *vram = &dev_priv->engine.vram;
315 struct nv50_gpuobj_node *node = NULL; 316 struct nv50_gpuobj_node *node = NULL;
316 int ret; 317 int ret;
317 318
@@ -323,7 +324,7 @@ nv50_instmem_get(struct nouveau_gpuobj *gpuobj, u32 size, u32 align)
323 size = (size + 4095) & ~4095; 324 size = (size + 4095) & ~4095;
324 align = max(align, (u32)4096); 325 align = max(align, (u32)4096);
325 326
326 ret = nv50_vram_new(dev, size, align, 0, 0, &node->vram); 327 ret = vram->get(dev, size, align, 0, 0, &node->vram);
327 if (ret) { 328 if (ret) {
328 kfree(node); 329 kfree(node);
329 return ret; 330 return ret;
@@ -336,7 +337,7 @@ nv50_instmem_get(struct nouveau_gpuobj *gpuobj, u32 size, u32 align)
336 NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS, 337 NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS,
337 &node->chan_vma); 338 &node->chan_vma);
338 if (ret) { 339 if (ret) {
339 nv50_vram_del(dev, &node->vram); 340 vram->put(dev, &node->vram);
340 kfree(node); 341 kfree(node);
341 return ret; 342 return ret;
342 } 343 }
@@ -354,6 +355,8 @@ void
354nv50_instmem_put(struct nouveau_gpuobj *gpuobj) 355nv50_instmem_put(struct nouveau_gpuobj *gpuobj)
355{ 356{
356 struct drm_device *dev = gpuobj->dev; 357 struct drm_device *dev = gpuobj->dev;
358 struct drm_nouveau_private *dev_priv = dev->dev_private;
359 struct nouveau_vram_engine *vram = &dev_priv->engine.vram;
357 struct nv50_gpuobj_node *node; 360 struct nv50_gpuobj_node *node;
358 361
359 node = gpuobj->node; 362 node = gpuobj->node;
@@ -363,7 +366,7 @@ nv50_instmem_put(struct nouveau_gpuobj *gpuobj)
363 nouveau_vm_unmap(&node->chan_vma); 366 nouveau_vm_unmap(&node->chan_vma);
364 nouveau_vm_put(&node->chan_vma); 367 nouveau_vm_put(&node->chan_vma);
365 } 368 }
366 nv50_vram_del(dev, &node->vram); 369 vram->put(dev, &node->vram);
367 kfree(node); 370 kfree(node);
368} 371}
369 372
diff --git a/drivers/gpu/drm/nouveau/nv50_vram.c b/drivers/gpu/drm/nouveau/nv50_vram.c
index 6e753356cd94..47489ed0a5a8 100644
--- a/drivers/gpu/drm/nouveau/nv50_vram.c
+++ b/drivers/gpu/drm/nouveau/nv50_vram.c
@@ -37,6 +37,16 @@ static int types[0x80] = {
37 1, 0, 2, 0, 1, 0, 2, 0, 1, 1, 2, 2, 1, 1, 0, 0 37 1, 0, 2, 0, 1, 0, 2, 0, 1, 1, 2, 2, 1, 1, 0, 0
38}; 38};
39 39
40bool
41nv50_vram_flags_valid(struct drm_device *dev, u32 tile_flags)
42{
43 int type = (tile_flags & NOUVEAU_GEM_TILE_LAYOUT_MASK) >> 8;
44
45 if (likely(type < sizeof(types) && types[type]))
46 return true;
47 return false;
48}
49
40void 50void
41nv50_vram_del(struct drm_device *dev, struct nouveau_vram **pvram) 51nv50_vram_del(struct drm_device *dev, struct nouveau_vram **pvram)
42{ 52{