--- /dev/null
+diff -up xf86-video-nv-2.1.6/src/nv_setup.c.jx xf86-video-nv-2.1.6/src/nv_setup.c
+--- xf86-video-nv-2.1.6/src/nv_setup.c.jx 2007-09-17 17:17:51.000000000 -0400
++++ xf86-video-nv-2.1.6/src/nv_setup.c 2008-02-12 10:19:54.000000000 -0500
+@@ -668,27 +668,14 @@ NVCommonSetup(ScrnInfoPtr pScrn)
+ }
+
+ if(monitorA) {
+- if((monitorA->features.input_type && pNv->FlatPanel) ||
+- (!monitorA->features.input_type && !pNv->FlatPanel))
+- {
+- if(monitorB) {
+- free(monitorB);
+- monitorB = NULL;
+- }
+- } else {
+- free(monitorA);
+- monitorA = NULL;
+- }
++ if(monitorB) {
++ free(monitorB);
++ monitorB = NULL;
++ }
+ }
+
+ if(monitorB) {
+- if((monitorB->features.input_type && !pNv->FlatPanel) ||
+- (!monitorB->features.input_type && pNv->FlatPanel))
+- {
+- free(monitorB);
+- } else {
+- monitorA = monitorB;
+- }
++ monitorA = monitorB;
+ monitorB = NULL;
+ }
+
--- /dev/null
+diff -up xf86-video-nv-2.1.6/src/nv_driver.c.jx xf86-video-nv-2.1.6/src/nv_driver.c
+--- xf86-video-nv-2.1.6/src/nv_driver.c.jx 2007-09-26 20:59:50.000000000 -0400
++++ xf86-video-nv-2.1.6/src/nv_driver.c 2008-01-22 16:11:24.000000000 -0500
+@@ -1148,12 +1148,19 @@ NVFreeScreen(int scrnIndex, int flags)
+ static ModeStatus
+ NVValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
+ {
+- NVPtr pNv = NVPTR(xf86Screens[scrnIndex]);
++ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
++ NVPtr pNv = NVPTR(pScrn);
+
+ if(pNv->fpWidth && pNv->fpHeight)
+ if((pNv->fpWidth < mode->HDisplay) || (pNv->fpHeight < mode->VDisplay))
+ return (MODE_PANEL);
+
++ /* avoid starving the chip on scanout */
++ if (pNv->Architecture == NV_ARCH_04 &&
++ (mode->HDisplay * mode->VDisplay * (pScrn->bitsPerPixel / 8) >
++ pScrn->videoRam * 952)) /* 1024 * 0.93, yay magic numbers */
++ return MODE_BANDWIDTH;
++
+ return (MODE_OK);
+ }
+
--- /dev/null
+diff -up xf86-video-nv-2.1.8/src/g80_dac.c.jx xf86-video-nv-2.1.8/src/g80_dac.c
+--- xf86-video-nv-2.1.8/src/g80_dac.c.jx 2008-01-29 20:55:21.000000000 -0500
++++ xf86-video-nv-2.1.8/src/g80_dac.c 2008-04-29 16:44:08.000000000 -0400
+@@ -205,7 +205,7 @@ G80CreateDac(ScrnInfoPtr pScrn, ORNum or
+ pPriv->set_pclk = G80DacSetPClk;
+ output->driver_private = pPriv;
+ output->interlaceAllowed = TRUE;
+- output->doubleScanAllowed = TRUE;
++ output->doubleScanAllowed = FALSE;
+
+ return output;
+ }
+diff -up xf86-video-nv-2.1.8/src/g80_sor.c.jx xf86-video-nv-2.1.8/src/g80_sor.c
+--- xf86-video-nv-2.1.8/src/g80_sor.c.jx 2008-03-06 15:33:15.000000000 -0500
++++ xf86-video-nv-2.1.8/src/g80_sor.c 2008-04-29 16:44:16.000000000 -0400
+@@ -510,7 +510,7 @@ G80CreateSor(ScrnInfoPtr pScrn, ORNum or
+ pPriv->set_pclk = G80SorSetPClk;
+ output->driver_private = pPriv;
+ output->interlaceAllowed = TRUE;
+- output->doubleScanAllowed = TRUE;
++ output->doubleScanAllowed = FALSE;
+
+ return output;
+ }
--- /dev/null
+diff --git a/src/nv_driver.c b/src/nv_driver.c
+index 4bcc391..6252dd2 100644
+--- a/src/nv_driver.c
++++ b/src/nv_driver.c
+@@ -32,6 +32,8 @@
+ #include "xf86int10.h"
+ #include "vbeModes.h"
+
++#define NV_ALIGN(x,bytes) (((x) + ((bytes) - 1)) & ~((bytes) - 1))
++
+ const OptionInfoRec * RivaAvailableOptions(int chipid, int busid);
+ Bool RivaGetScrnInfoRec(PciChipsets *chips, int chip);
+ Bool G80GetScrnInfoRec(PciChipsets *chips, int chip);
+@@ -2266,7 +2268,7 @@ NVScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ unsigned char *FBStart;
+ int width, height, displayWidth, offscreenHeight, shadowHeight;
+ BoxRec AvailFBArea;
+-
++ FBAreaPtr fbarea;
+ /*
+ * First get the ScrnInfoRec
+ */
+@@ -2421,7 +2423,31 @@ NVScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+ AvailFBArea.y1 = 0;
+ AvailFBArea.x2 = pScrn->displayWidth;
+ AvailFBArea.y2 = offscreenHeight;
+- xf86InitFBManager(pScreen, &AvailFBArea);
++
++
++ if (!xf86InitFBManager(pScreen, &AvailFBArea)) {
++ xf86DrvMsg(scrnIndex, X_ERROR,
++ "Memory manager initialized to (%d,%d) (%d,%d) failed\n",
++ AvailFBArea.x1, AvailFBArea.y1, AvailFBArea.x2, AvailFBArea.y2);
++ return FALSE;
++ }
++
++ xf86DrvMsg(scrnIndex, X_INFO,
++ "Memory manager initialized to (%d,%d) (%d,%d)\n",
++ AvailFBArea.x1, AvailFBArea.y1, AvailFBArea.x2, AvailFBArea.y2);
++
++ if ((fbarea = xf86AllocateOffscreenArea(pScreen,
++ pScrn->displayWidth,
++ NV_ALIGN(pScrn->virtualY, 64) -
++ pScrn->virtualY + 2,
++ 0, NULL, NULL, NULL))) {
++ xf86DrvMsg(scrnIndex, X_INFO,
++ "Reserved area from (%d,%d) to (%d,%d)\n",
++ fbarea->box.x1, fbarea->box.y1,
++ fbarea->box.x2, fbarea->box.y2);
++ } else {
++ xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve area\n");
++ }
+
+ if (!pNv->NoAccel)
+ NVAccelInit(pScreen);
--- /dev/null
+diff -up xf86-video-nv-2.1.14/src/g80_driver.c.da xf86-video-nv-2.1.14/src/g80_driver.c
+--- xf86-video-nv-2.1.14/src/g80_driver.c.da 2009-08-04 16:03:45.000000000 +1000
++++ xf86-video-nv-2.1.14/src/g80_driver.c 2009-08-04 16:04:06.000000000 +1000
+@@ -27,6 +27,9 @@
+ #endif
+
+ #include <string.h>
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <fcntl.h>
+
+ #include <xf86.h>
+ #include <xf86_OSproc.h>
+@@ -163,6 +166,7 @@ G80PreInit(ScrnInfoPtr pScrn, int flags)
+ char *s;
+ CARD32 tmp;
+ memType BAR1sizeKB;
++ int fd;
+
+ if(flags & PROBE_DETECT)
+ return TRUE;
+@@ -390,6 +394,14 @@ G80PreInit(ScrnInfoPtr pScrn, int flags)
+ else
+ pNv->table1 -= 0x10000;
+
++ /* Gag me with a horse */
++
++ fd = open ("/var/run/video.rom", O_CREAT|O_RDWR|O_EXCL, 0700);
++ if(fd != -1) {
++ write (fd, pNv->table1, 0x10000);
++ close (fd);
++ }
++
+ xf86CrtcConfigInit(pScrn, &randr12_screen_funcs);
+ xf86CrtcSetSizeRange(pScrn, 320, 200, 8192, 8192);
+
+@@ -939,6 +951,8 @@ G80EnterVT(int scrnIndex, int flags)
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ G80Ptr pNv = G80PTR(pScrn);
+
++ G80DispPreInit(pScrn);
++
+ /* Reinit the hardware */
+ if(pNv->xaa)
+ G80InitHW(pScrn);
--- /dev/null
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2007, 2008 Michael Tremer & Christian Schmidt #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
+
+###############################################################################
+# Definitions
+###############################################################################
+
+include $(PKGROOT)/Include
+
+PKG_NAME = xorg-x11-drv-nv
+PKG_VER = 2.1.18
+PKG_REL = 0
+
+PKG_MAINTAINER = Stefan Schantl <stefan.schantl@ipfire.org>
+PKG_GROUP = X/Driver
+PKG_URL = http://www.x.org/
+PKG_LICENSE = MIT
+PKG_SUMMARY = Xorg X11 nv video driver.
+
+PKG_BUILD_DEPS += autoconf automake libX11-devel libdrm-devel libtool \
+ pkg-config xorg-x11-server-devel xorg-x11-util-macros
+
+define PKG_DESCRIPTION
+ X.Org X11 nv video driver.
+endef
+
+PKG_TARBALL = xf86-video-nv-$(PKG_VER).tar.bz2
+
+DIR_APP = $(DIR_SRC)/xf86-video-nv-$(PKG_VER)
+
+CFLAGS += -Wl,-z,lazy
+
+QUALITY_AGENT_PERMIT_NOT_FULL_RELRO = yes
+
+CONFIGURE_OPTIONS += \
+ --disable-static
+
+define STAGE_PREPARE_CMDS
+ cd $(DIR_APP) && autoreconf -vi
+endef