File xf86-video-nv-bug519261-increase-virtual.diff of Package xf86-video-nv

Index: xf86-video-nv-2.1.17/src/g80_driver.c
===================================================================
--- xf86-video-nv-2.1.17.orig/src/g80_driver.c
+++ xf86-video-nv-2.1.17/src/g80_driver.c
@@ -402,6 +402,22 @@ G80PreInit(ScrnInfoPtr pScrn, int flags)
     /* Create the crtcs */
     G80DispCreateCrtcs(pScrn);
 
+    /* Unless we're able to shrink/enlarge FB on the fly (GEM etc.), allocate
+     * large enough (TM) virtual size */
+    if (  (!pScrn->display->virtualX || !pScrn->display->virtualY) &&
+	! (pNv->NoAccel || pNv->AccelMethod == EXA)) {
+	/* No need to accomodate for 3D buffers - no DRI anyway... */
+	if (2 * 1920*1920 * (pScrn->bitsPerPixel/8) <= pScrn->videoRam * 1024) {
+	    /* Fits on 32MB and up */
+	    pScrn->display->virtualX = 2 * 1920;
+	    pScrn->display->virtualY = 1920;
+	} else if (2 * 1680*1280 * (pScrn->bitsPerPixel/8) <= pScrn->videoRam * 1024) {
+	    /* Fits on 16MB and up */
+	    pScrn->display->virtualX = 2 * 1680;
+	    pScrn->display->virtualY = 1280;
+	}
+    }
+
     /* We can grow the desktop if XAA is disabled */
     if(!xf86InitialConfiguration(pScrn, pNv->NoAccel || pNv->AccelMethod == EXA)) {
         xf86DrvMsg(pScrn->scrnIndex, X_ERROR,