aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2011-03-07 23:47:53 -0500
committerBen Skeggs <bskeggs@redhat.com>2011-03-14 02:35:16 -0400
commit459ca7e5283914845d7139905ff58824d2b0cc85 (patch)
treebd54b1201351f7fc5742f5b0b024ac2866cd3a3f /drivers/gpu
parent6fdb383e81a644a244299d635de5eb30ed401278 (diff)
drm/nv40: attempt to reserve just enough vram for all 32 channels
This also makes the fact we're giving 512MiB of GART space to all PCIE boards explicit, although the vast majority (if not all) of them will now have a ramin_rsvd_vram larger than 2MiB anyway. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_mem.c34
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_sgdma.c3
2 files changed, 27 insertions, 10 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c
index 63b9040b5f3..02b48d183f4 100644
--- a/drivers/gpu/drm/nouveau/nouveau_mem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_mem.c
@@ -424,14 +424,32 @@ nouveau_mem_vram_init(struct drm_device *dev)
424 } 424 }
425 425
426 /* reserve space at end of VRAM for PRAMIN */ 426 /* reserve space at end of VRAM for PRAMIN */
427 if (dev_priv->chipset == 0x40 || dev_priv->chipset == 0x47 || 427 if (dev_priv->card_type >= NV_50) {
428 dev_priv->chipset == 0x49 || dev_priv->chipset == 0x4b) 428 dev_priv->ramin_rsvd_vram = 1 * 1024 * 1024;
429 dev_priv->ramin_rsvd_vram = (2 * 1024 * 1024); 429 } else
430 else 430 if (dev_priv->card_type >= NV_40) {
431 if (dev_priv->card_type >= NV_40) 431 u32 vs = hweight8((nv_rd32(dev, 0x001540) & 0x0000ff00) >> 8);
432 dev_priv->ramin_rsvd_vram = (1 * 1024 * 1024); 432 u32 rsvd;
433 else 433
434 dev_priv->ramin_rsvd_vram = (512 * 1024); 434 /* estimate grctx size, the magics come from nv40_grctx.c */
435 if (dev_priv->chipset == 0x40) rsvd = 0x6aa0 * vs;
436 else if (dev_priv->chipset < 0x43) rsvd = 0x4f00 * vs;
437 else if (nv44_graph_class(dev)) rsvd = 0x4980 * vs;
438 else rsvd = 0x4a40 * vs;
439 rsvd += 16 * 1024;
440 rsvd *= dev_priv->engine.fifo.channels;
441
442 /* pciegart table */
443 if (drm_pci_device_is_pcie(dev))
444 rsvd += 512 * 1024;
445
446 /* object storage */
447 rsvd += 512 * 1024;
448
449 dev_priv->ramin_rsvd_vram = round_up(rsvd, 4096);
450 } else {
451 dev_priv->ramin_rsvd_vram = 512 * 1024;
452 }
435 453
436 ret = dev_priv->engine.vram.init(dev); 454 ret = dev_priv->engine.vram.init(dev);
437 if (ret) 455 if (ret)
diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
index 1205f0f345b..a33fe401928 100644
--- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c
+++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c
@@ -427,8 +427,7 @@ nouveau_sgdma_init(struct drm_device *dev)
427 u32 aper_size, align; 427 u32 aper_size, align;
428 int ret; 428 int ret;
429 429
430 if (dev_priv->card_type >= NV_50 || 430 if (dev_priv->card_type >= NV_50 || drm_pci_device_is_pcie(dev))
431 dev_priv->ramin_rsvd_vram >= 2 * 1024 * 1024)
432 aper_size = 512 * 1024 * 1024; 431 aper_size = 512 * 1024 * 1024;
433 else 432 else
434 aper_size = 64 * 1024 * 1024; 433 aper_size = 64 * 1024 * 1024;