aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/nvidia/nvidia.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
index 3a6555a8aaa2..47733f58153b 100644
--- a/drivers/video/nvidia/nvidia.c
+++ b/drivers/video/nvidia/nvidia.c
@@ -408,6 +408,7 @@ static int hwcur __devinitdata = 0;
408static int noaccel __devinitdata = 0; 408static int noaccel __devinitdata = 0;
409static int noscale __devinitdata = 0; 409static int noscale __devinitdata = 0;
410static int paneltweak __devinitdata = 0; 410static int paneltweak __devinitdata = 0;
411static int vram __devinitdata = 0;
411#ifdef CONFIG_MTRR 412#ifdef CONFIG_MTRR
412static int nomtrr __devinitdata = 0; 413static int nomtrr __devinitdata = 0;
413#endif 414#endif
@@ -1180,7 +1181,7 @@ static int nvidiafb_check_var(struct fb_var_screeninfo *var,
1180 1181
1181 var->xres_virtual = (var->xres_virtual + 63) & ~63; 1182 var->xres_virtual = (var->xres_virtual + 63) & ~63;
1182 1183
1183 vramlen = info->fix.smem_len; 1184 vramlen = info->screen_size;
1184 pitch = ((var->xres_virtual * var->bits_per_pixel) + 7) / 8; 1185 pitch = ((var->xres_virtual * var->bits_per_pixel) + 7) / 8;
1185 memlen = pitch * var->yres_virtual; 1186 memlen = pitch * var->yres_virtual;
1186 1187
@@ -1343,7 +1344,7 @@ static int __devinit nvidia_set_fbinfo(struct fb_info *info)
1343 /* maximize virtual vertical length */ 1344 /* maximize virtual vertical length */
1344 lpitch = info->var.xres_virtual * 1345 lpitch = info->var.xres_virtual *
1345 ((info->var.bits_per_pixel + 7) >> 3); 1346 ((info->var.bits_per_pixel + 7) >> 3);
1346 info->var.yres_virtual = info->fix.smem_len / lpitch; 1347 info->var.yres_virtual = info->screen_size / lpitch;
1347 1348
1348 info->pixmap.scan_align = 4; 1349 info->pixmap.scan_align = 4;
1349 info->pixmap.buf_align = 4; 1350 info->pixmap.buf_align = 4;
@@ -1507,12 +1508,20 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd,
1507 1508
1508 par->FbAddress = nvidiafb_fix.smem_start; 1509 par->FbAddress = nvidiafb_fix.smem_start;
1509 par->FbMapSize = par->RamAmountKBytes * 1024; 1510 par->FbMapSize = par->RamAmountKBytes * 1024;
1511 if (vram && vram * 1024 * 1024 < par->FbMapSize)
1512 par->FbMapSize = vram * 1024 * 1024;
1513
1514 /* Limit amount of vram to 64 MB */
1515 if (par->FbMapSize > 64 * 1024 * 1024)
1516 par->FbMapSize = 64 * 1024 * 1024;
1517
1510 par->FbUsableSize = par->FbMapSize - (128 * 1024); 1518 par->FbUsableSize = par->FbMapSize - (128 * 1024);
1511 par->ScratchBufferSize = (par->Architecture < NV_ARCH_10) ? 8 * 1024 : 1519 par->ScratchBufferSize = (par->Architecture < NV_ARCH_10) ? 8 * 1024 :
1512 16 * 1024; 1520 16 * 1024;
1513 par->ScratchBufferStart = par->FbUsableSize - par->ScratchBufferSize; 1521 par->ScratchBufferStart = par->FbUsableSize - par->ScratchBufferSize;
1514 info->screen_base = ioremap(nvidiafb_fix.smem_start, par->FbMapSize); 1522 info->screen_base = ioremap(nvidiafb_fix.smem_start, par->FbMapSize);
1515 nvidiafb_fix.smem_len = par->FbUsableSize; 1523 info->screen_size = par->FbUsableSize;
1524 nvidiafb_fix.smem_len = par->RamAmountKBytes * 1024;
1516 1525
1517 if (!info->screen_base) { 1526 if (!info->screen_base) {
1518 printk(KERN_ERR PFX "cannot ioremap FB base\n"); 1527 printk(KERN_ERR PFX "cannot ioremap FB base\n");
@@ -1524,7 +1533,8 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd,
1524#ifdef CONFIG_MTRR 1533#ifdef CONFIG_MTRR
1525 if (!nomtrr) { 1534 if (!nomtrr) {
1526 par->mtrr.vram = mtrr_add(nvidiafb_fix.smem_start, 1535 par->mtrr.vram = mtrr_add(nvidiafb_fix.smem_start,
1527 par->FbMapSize, MTRR_TYPE_WRCOMB, 1); 1536 par->RamAmountKBytes * 1024,
1537 MTRR_TYPE_WRCOMB, 1);
1528 if (par->mtrr.vram < 0) { 1538 if (par->mtrr.vram < 0) {
1529 printk(KERN_ERR PFX "unable to setup MTRR\n"); 1539 printk(KERN_ERR PFX "unable to setup MTRR\n");
1530 } else { 1540 } else {
@@ -1566,9 +1576,9 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd,
1566 1576
1567 err_out_iounmap_fb: 1577 err_out_iounmap_fb:
1568 iounmap(info->screen_base); 1578 iounmap(info->screen_base);
1579 err_out_free_base1:
1569 fb_destroy_modedb(info->monspecs.modedb); 1580 fb_destroy_modedb(info->monspecs.modedb);
1570 nvidia_delete_i2c_busses(par); 1581 nvidia_delete_i2c_busses(par);
1571 err_out_free_base1:
1572 iounmap(par->REGS); 1582 iounmap(par->REGS);
1573 err_out_free_base0: 1583 err_out_free_base0:
1574 pci_release_regions(pd); 1584 pci_release_regions(pd);
@@ -1645,6 +1655,8 @@ static int __devinit nvidiafb_setup(char *options)
1645 noscale = 1; 1655 noscale = 1;
1646 } else if (!strncmp(this_opt, "paneltweak:", 11)) { 1656 } else if (!strncmp(this_opt, "paneltweak:", 11)) {
1647 paneltweak = simple_strtoul(this_opt+11, NULL, 0); 1657 paneltweak = simple_strtoul(this_opt+11, NULL, 0);
1658 } else if (!strncmp(this_opt, "vram:", 5)) {
1659 vram = simple_strtoul(this_opt+5, NULL, 0);
1648#ifdef CONFIG_MTRR 1660#ifdef CONFIG_MTRR
1649 } else if (!strncmp(this_opt, "nomtrr", 6)) { 1661 } else if (!strncmp(this_opt, "nomtrr", 6)) {
1650 nomtrr = 1; 1662 nomtrr = 1;
@@ -1716,6 +1728,10 @@ module_param(forceCRTC, int, 0);
1716MODULE_PARM_DESC(forceCRTC, 1728MODULE_PARM_DESC(forceCRTC,
1717 "Forces usage of a particular CRTC in case autodetection " 1729 "Forces usage of a particular CRTC in case autodetection "
1718 "fails. (0 or 1) (default=autodetect)"); 1730 "fails. (0 or 1) (default=autodetect)");
1731module_param(vram, int, 0);
1732MODULE_PARM_DESC(vram,
1733 "amount of framebuffer memory to remap in MiB"
1734 "(default=0 - remap entire memory)");
1719#ifdef CONFIG_MTRR 1735#ifdef CONFIG_MTRR
1720module_param(nomtrr, bool, 0); 1736module_param(nomtrr, bool, 0);
1721MODULE_PARM_DESC(nomtrr, "Disables MTRR support (0 or 1=disabled) " 1737MODULE_PARM_DESC(nomtrr, "Disables MTRR support (0 or 1=disabled) "