[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xserver-xorg-video-nouveau: Changes to 'ubuntu-jaunty'



 .gitignore                                      |    1 
 debian/changelog                                |  127 ++++-
 debian/control                                  |    3 
 debian/patches/0001-Fix-with-kms-no-build.patch |   32 -
 debian/patches/01_include_snapshot_date         |   13 
 debian/patches/series                           |    2 
 debian/rules                                    |    3 
 src/drmmode_display.c                           |   21 
 src/nouveau_bios.h                              |   11 
 src/nouveau_xv.c                                |   16 
 src/nv10_xv_ovl.c                               |    6 
 src/nv50_connector.c                            |    4 
 src/nv50_randr.c                                |    4 
 src/nv_bios.c                                   |  105 ++--
 src/nv_crtc.c                                   |  401 +++++++++---------
 src/nv_cursor.c                                 |    8 
 src/nv_dac.c                                    |   14 
 src/nv_dri.c                                    |   15 
 src/nv_driver.c                                 |   53 +-
 src/nv_hw.c                                     |   94 ++--
 src/nv_output.c                                 |   91 ++--
 src/nv_proto.h                                  |    1 
 src/nv_setup.c                                  |   52 +-
 src/nv_type.h                                   |   51 +-
 src/nvreg.h                                     |  521 +++++++++++-------------
 25 files changed, 848 insertions(+), 801 deletions(-)

New commits:
commit 0190d14466eebdddfc6389d4f4bab9756d5cf720
Author: Christopher James Halse Rogers <chris@CowboyLaputopu.(none)>
Date:   Fri Mar 27 21:26:30 2009 +1100

    Add stampdir to .gitignore, so git-buildpackage stops having screaming hissy fits

diff --git a/.gitignore b/.gitignore
index 4ff1108..5636e09 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,3 +20,4 @@ ltmain.sh
 missing
 stamp-h1
 ChangeLog
+stampdir
\ No newline at end of file

commit 619bc1b834a68b695aab9952526722906740d18a
Author: Christopher James Halse Rogers <chris@CowboyLaputopu.(none)>
Date:   Fri Mar 27 20:48:43 2009 +1100

    Really delete no longer necessary no-kms buildfix patch

diff --git a/debian/patches/0001-Fix-with-kms-no-build.patch b/debian/patches/0001-Fix-with-kms-no-build.patch
deleted file mode 100644
index 1b21516..0000000
--- a/debian/patches/0001-Fix-with-kms-no-build.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 45a5c55a318cb28ea44d7bfb19d9160da4eee855 Mon Sep 17 00:00:00 2001
-From: Christopher James Halse Rogers <raof@ubuntu.com>
-Date: Tue, 24 Mar 2009 17:28:39 +1100
-Subject: [PATCH] Fix --with-kms=no build.
-
-Commit 98c9e4edb58374f18249e5c9c53b392fb8b4a1d1 introduced some unguarded pNv->allow_dpms usage, but this is only defined when XF86MODE is defined
----
- src/nv_driver.c |    4 ++++
- 1 files changed, 4 insertions(+), 0 deletions(-)
-
-diff --git a/src/nv_driver.c b/src/nv_driver.c
-index ec4577f..f7915a8 100644
---- a/src/nv_driver.c
-+++ b/src/nv_driver.c
-@@ -684,10 +684,14 @@ NVEnterVT(int scrnIndex, int flags)
- 			return FALSE;
- 		NVAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
- 	} else {
-+#ifdef XF86DRM_MODE
- 		pNv->allow_dpms = FALSE;
-+#endif
- 		if (!xf86SetDesiredModes(pScrn))
- 			return FALSE;
-+#ifdef XF86DRM_MODE
- 		pNv->allow_dpms = TRUE;
-+#endif
- 	}
- 
- 	if (pNv->overlayAdaptor && pNv->Architecture != NV_ARCH_04)
--- 
-1.6.0.4
-

commit e2323fecef460c2056ad31341fa96710b402d9e4
Author: Christopher James Halse Rogers <chris@CowboyLaputopu.(none)>
Date:   Fri Mar 27 20:47:31 2009 +1100

    Remove reference to drm-modules-source from long description

diff --git a/debian/changelog b/debian/changelog
index a186266..dd0ddfa 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -164,6 +164,10 @@ xserver-xorg-video-nouveau (1:0.0.10~git+20090327+f1907dc-0ubuntu1) jaunty; urge
   * debian/patches/01_include_snapshot_date
     + Generate snapshot-date in get-orig-source, and use it rather than
       git log to define NV_DRIVER_DATE
+  * debian/control
+    + Remove reference to drm-modules-source package from long description.
+      Ubuntu ships a DKMS-ified nouveau-kernel-source package, which makes
+      this unnecessary.
 
  -- Christopher James Halse Rogers <raof@ubuntu.com>  Fri, 27 Mar 2009 20:41:22 +1100
 
diff --git a/debian/control b/debian/control
index 3872c0d..8715ab1 100644
--- a/debian/control
+++ b/debian/control
@@ -27,6 +27,3 @@ Description: X.Org X server -- Nouveau display driver (experimental)
  use the non-free "nvidia" driver.
  .
  This package is built from the FreeDesktop.org xf86-video-nouveau driver.
- .
- Users wishing to install these drivers should first use module-assistant to
- build the drm kernel modules (via ``module-assistant auto-install drm'').

commit 5cd4ac83dc033d1162df182ab07d2afec0858ad9
Author: Christopher James Halse Rogers <chris@CowboyLaputopu.(none)>
Date:   Fri Mar 27 20:43:36 2009 +1100

    Update snapshot
    Add NV_DRIVER_DATE patch
    Remove --with-kms=no (upstream now builds correctly)

diff --git a/debian/changelog b/debian/changelog
index b4e6771..a186266 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,35 @@
-xserver-xorg-video-nouveau (1:0.0.10~git+20090322+3e7fa97-0ubuntu1) jaunty; urgency=low
+xserver-xorg-video-nouveau (1:0.0.10~git+20090327+f1907dc-0ubuntu1) jaunty; urgency=low
 
   * New upstream snapshot
+    - f1907dc... nv50: add default modes to mode pool for LVDS panel
+    - 7da6fdb... kms: fix bug which prevented getting edid from the kernel
+    - f431e20... randr: fix crash when rotation requested
+    - 36dedd0... kms: check for mm_enabled as an additional test for kms
+      presence
+    - 01cee29... nv50: call NVSync() in CloseScreen() before restoring
+      video mode
+    - aa7c037... kms: implement AdjustFrame, should fix crash in fdo#24236
+    - 61879b8... kms: drm_mode_modeinfo struct changed names at some point
+    - 79306fc... dri: fail harder
+    - da1ba93... device close doesn't belong in DRI close, can have DRM
+      without DRI
+    - 56b11c7... Fix mouse cursor disappearing when near top/left edge of
+      screen.
+    - 4067ab4... another ppc fix
+    - 862dba8... more ppc..
+    - 3063486... fix ppc build
+    - d80fe78... Fix nouveau_hw_decode_pll on NV30/35.
+    - 62aa81d... Some laptop mode finding fixes resulting from rh#487456
+    - aa6edfa... randr12: name VGA CRTC fields
+    - 7b7c44c... randr12: rename reg state members to follow reg names
+    - 4ae6c22... randr12: name some FP flags, move some unrelated stuff
+      out from nvreg.h
+    - b50b49f... pre-nv50: use nvidia's names for PRAMDAC regs where known
+    - a9df304... pre-nv50: use nvidia's names for PCRTC regs where known
+    - 2c0710d... Separate maximum limits for encoder devices and i2c
+      records, DCB_ prefixes
+    - 0db27a6... Add DCB 1.5 entry from a GeForce2 Go reported by Martin
+      Ketzer on the ML
     - 3e7fa97... dri: pass object handle instead of offset if using real mm
     - 88efe40... dri2: initial implementation, only with driver pixmaps
     - 675126e... kms: support framebuffer resize if driver pixmaps enabled
@@ -12,58 +41,76 @@ xserver-xorg-video-nouveau (1:0.0.10~git+20090322+3e7fa97-0ubuntu1) jaunty; urge
     - a3dbc06... randr12: cull old unused pll code
     - 71c821b... Don't pointlessly overallocate cursor storage
     - 7284c07... randr12: nv10 hw cursor fixes/changes
-    - bcc3a14... randr12: use nv0x cursor colour expansion funcs on later cards, unify argb paths
+    - bcc3a14... randr12: use nv0x cursor colour expansion funcs on later
+      cards, unify argb paths
     - b21c807... randr12: store nv0x hw cursor image in VRAM
     - 3ea4b19... Kill pre-randr12 hwcursor code, and tidy randr12 hwcursor code
-    - b988160... Remove calls to load ddc and i2c modules -- they're built-in since server 1.3
-    - d5893ec... Hack around missing display table in rdivacky's GeForce 7050 PV/nForce 630a
+    - b988160... Remove calls to load ddc and i2c modules -- they're
+      built-in since server 1.3
+    - d5893ec... Hack around missing display table in rdivacky's GeForce
+      7050 PV/nForce 630a
     - 369e1ef... Fix xserver shutdown for randr12 off
-    - 8343d6b... Remove bios lvds parsing pxclk test; ddc_permitted is a sufficient condition
+    - 8343d6b... Remove bios lvds parsing pxclk test; ddc_permitted is a
+      sufficient condition
     - 8b56c69... Name some regs/values and reduce crtc reg struct size
     - 79d23d8... improve drm/dri initialisation code
     - bd14482... kms: cleanup set_property
     - 7a45592... kms: get current values for output properties on startup
     - 7095e89... kms: work around some xserver stupidity with DPMS
     - 8f9a580... Another DCB 1.5 entry (seen in rh#455194)
-    - 9a71990... randr12: add output properties for digital vibrance and image sharpening
+    - 9a71990... randr12: add output properties for digital vibrance and
+      image sharpening
     - 678ddc2... randr12: functionate output properties creation
-    - ed9bd88... kms: remove early-exit from gamma_set, the kernel side works now
+    - ed9bd88... kms: remove early-exit from gamma_set, the kernel side
+      works now
     - 98c9e4e... kms: work around some bong hits with dpms
     - 88ae2c9... kms: implement dpms
     - 5269cc8... randr12: make props code slightly less awful to behold
     - 0b87c49... More robust PLL upclocking for old cards
     - cb237a3... bios/randr12: mode validation fixes (includes fix for #20298)
     - 9cfccd7... Handle failure to calculate pll values better
-    - 1e99440... xv: return BadAlloc if destination pixmap is not put into EXA offscreen (#15792)
+    - 1e99440... xv: return BadAlloc if destination pixmap is not put into
+      EXA offscreen (#15792)
     - 77347da... Remove duplicated DCB parsing
     - 1b6cabe... Remove VBIOS access in parse_dcb_entry
-    - 72fd0ae... randr12: no need to re-detect edid for lvds, it's not going away
+    - 72fd0ae... randr12: no need to re-detect edid for lvds, it's not
+      going away
     - ae981a8... nv50: some minor modesetting changes
     - 42f99e6... nv30/xv: restore original viewport/clipping after putimage
-    - 56bb8f8... Allow parse_fp_mode_table for x86 cards that find themselves on ppc
-    - 1c2f33e... Don't rely on the bios mobile feature bit for BMP biosen (#19986)
-    - e436c7e... randr12: make treatment of CR4B more closely resemble blob's behaviour
+    - 56bb8f8... Allow parse_fp_mode_table for x86 cards that find
+      themselves on ppc
+    - 1c2f33e... Don't rely on the bios mobile feature bit for BMP biosen
+      (#19986)
+    - e436c7e... randr12: make treatment of CR4B more closely resemble
+      blob's behaviour
     - c61102b... Parse bios fp mode during modesetting, removing extra alloc
-    - 631e15a... Get dual_link and dithering bios info through lvds table parsing function
-    - 2d43771... Call parse_lvds_manufacturer_table during modesetting only (#19986 partial fix)
+    - 631e15a... Get dual_link and dithering bios info through lvds table
+      parsing function
+    - 2d43771... Call parse_lvds_manufacturer_table during modesetting
+      only (#19986 partial fix)
     - ce8f5d7... Variety of LVDS script changes
     - 071d537... Read embedded bios edid only on demand
     - f04689c... move memset of fb after NVSave(), hopefully fix lost VGA fonts
     - 6961efb... kms: fix check for xf86drmMode.h
-    - 76fa656... Detypedef bios_t, rename bios io functions, group various helper functions
-    - 39c9d02... Move parsed DCB to bios structs, split into public and private parts
-    - 275daaf... Split bios struct into struct for nv_bios.c, and exported public info struct
+    - 76fa656... Detypedef bios_t, rename bios io functions, group various
+      helper functions
+    - 39c9d02... Move parsed DCB to bios structs, split into public and
+      private parts
+    - 275daaf... Split bios struct into struct for nv_bios.c, and exported
+      public info struct
     - 8b3e966... Remove never updated bios opcodes 0x31, 0x5A and 0x73
     - ce9eb05... Trivial bios convenience variable changes
     - cfeef11... exa: forgot to check if EXA_SUPPORTS_PREPARE_AUX was defined
     - 37a85dc... exa: we support PREPARE_AUX
     - 1249fd2... Revert exa: support major version 3
-    - 1c4a284... Rework PLL decoding in terms of pll_vals, save/restore pll_vals on vt switch
+    - 1c4a284... Rework PLL decoding in terms of pll_vals, save/restore
+      pll_vals on vt switch
     - 81b4732... New common struct for pll values
     - adf2e35... Check whether NV_RAMDAC_580 has changed when setting PLLs
     - b7f99ae... exa: support major version 3
     - d91fc78... kms: fix resize func
-    - 535498b... clear the scanout buffer on statup to avoid seeing garbage on-screen
+    - 535498b... clear the scanout buffer on statup to avoid seeing
+      garbage on-screen
     - 0227673... nv50/exa: properly align offset for mem_tile ioctl
     - e09f50e... bios/randr12: fix dual link TMDS (#20006)
     - b968db7... Return of bios: fix create_i2c_device for g80
@@ -73,13 +120,15 @@ xserver-xorg-video-nouveau (1:0.0.10~git+20090322+3e7fa97-0ubuntu1) jaunty; urge
     - 9179c66... Variety of DCB enhancements
     - 317ca47... Revert bios: fix create_i2c_device for g80
     - 7b25a30... nv04: unbreak copy
-    - 60c8bb1... default to autodetecting whether to enable the driver's kms paths
+    - 60c8bb1... default to autodetecting whether to enable the driver's
+      kms paths
     - a31b1d0... exa: reimplement driver-controlled pixmaps
     - d97e993... exa: preparation for reintroducing driver-controlled pixmaps
     - 1e00c7d... shadowfb: clip copied regions to frontbuffer size.
     - efe2796... nv50: correct a poorly written comment
     - 2573c06... exa: remove exaWaitSync() call in nouveau_exa_pixmap_map()
-    - 5000535... exa: don't need exaMarkSync on DFS, the operation will be done already
+    - 5000535... exa: don't need exaMarkSync on DFS, the operation will be
+      done already
     - a7e7c55... xv: remove notifier usage
     - 8ecb8d5... exa: remove notifier waits in UTS/DFS
     - cfb884b... bios: add some more valid regs
@@ -90,21 +139,33 @@ xserver-xorg-video-nouveau (1:0.0.10~git+20090322+3e7fa97-0ubuntu1) jaunty; urge
     - 17e9d4b... randr12: use bios PLL setting routines for modesetting
     - e444e0e... Readability improvements for nv_hw.c and nvreg.h
     - f5ea66c... Pull in extras from CRTC PLL code to bios routines
-    - 4166365... Pull out ramdac580 setting and powerctrl_1 shift code to separate functions
+    - 4166365... Pull out ramdac580 setting and powerctrl_1 shift code to
+      separate functions
     - 8b70418... Miscellaneous fixes to bios PLL code
-    - 01bb4c1... Make PROM score badly, out of available bios images, if checksum bad
-    - 30848dd... randr12: bodge-in continuous timings when the scaler is in use (#19203)
-    - 0387ac3... Allow reading of PROM and PCI rom on PPC (for people using x86 cards)
-    - 6ad66c0... bios/randr12: be strict about when to use modes from bios vs modes from ddc
-    - b5391eb... Simplify FP strapping semantics and trust bios parsing of use_straps_for_mode
-    - 34c2b15... bios/randr12: misc (mainly lvds related) clarifications and cleanups
+    - 01bb4c1... Make PROM score badly, out of available bios images, if
+      checksum bad
+    - 30848dd... randr12: bodge-in continuous timings when the scaler is
+      in use (#19203)
+    - 0387ac3... Allow reading of PROM and PCI rom on PPC (for people
+      using x86 cards)
+    - 6ad66c0... bios/randr12: be strict about when to use modes from bios
+      vs modes from ddc
+    - b5391eb... Simplify FP strapping semantics and trust bios parsing of
+      use_straps_for_mode
+    - 34c2b15... bios/randr12: misc (mainly lvds related) clarifications
+      and cleanups
     - 98b8cad... Always allocate 2 hw cursors.
     - f109981... Fix a few warnings.
     - 691589d... Fix some cursor fallout, mostly in legacy code.
     - 945f0cb... kms: update drmmode_display
-    - ba1f897... keep resources around after leavevt, far too problematic currently
-
- -- Christopher James Halse Rogers <raof@ubuntu.com>  Sun, 22 Mar 2009 17:39:00 +1100
+    - ba1f897... keep resources around after leavevt, far too problematic
+    currently
+  * debian/rules
+  * debian/patches/01_include_snapshot_date
+    + Generate snapshot-date in get-orig-source, and use it rather than
+      git log to define NV_DRIVER_DATE
+
+ -- Christopher James Halse Rogers <raof@ubuntu.com>  Fri, 27 Mar 2009 20:41:22 +1100
 
 xserver-xorg-video-nouveau (1:0.0.10~git+20090205+4dfd0b1-1) experimental; urgency=low
 
diff --git a/debian/patches/01_include_snapshot_date b/debian/patches/01_include_snapshot_date
new file mode 100644
index 0000000..7821f17
--- /dev/null
+++ b/debian/patches/01_include_snapshot_date
@@ -0,0 +1,13 @@
+Index: xserver-xorg-video-nouveau/configure
+===================================================================
+--- xserver-xorg-video-nouveau.orig/configure	2009-03-27 19:14:01.435615848 +1100
++++ xserver-xorg-video-nouveau/configure	2009-03-27 19:14:27.175615987 +1100
+@@ -2084,7 +2084,7 @@
+ 
+ 
+ cat >>confdefs.h <<_ACEOF
+-#define NV_DRIVER_DATE $(echo -n \";git log |head -3|tail -1|tr -d '\n';echo -n \")
++#define NV_DRIVER_DATE $(echo -n \";cat snapshot-date;echo -n \")
+ _ACEOF
+ 
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 47d72f7..ee1bce7 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1 @@
-0001-Fix-with-kms-no-build.patch
+01_include_snapshot_date
diff --git a/debian/rules b/debian/rules
index 55ce9b3..3240999 100755
--- a/debian/rules
+++ b/debian/rules
@@ -29,6 +29,7 @@ confflags += --disable-static
 get-orig-source:
 	git clone git://anongit.freedesktop.org/git/nouveau/xf86-video-nouveau && \
 	cd xf86-video-nouveau && autoreconf -v --install && \
+	git log |head -3|tail -1|tr -d '\n' > snapshot-date && \
 	REVISION=$$(git show --pretty=format:"%h" HEAD | head -n1) && cd .. && \
 	PREFIX=xserver-xorg-video-nouveau_0.0.10~git+$$(date +%Y%m%d)+$$REVISION && \
 	rm -rf xf86-video-nouveau/.git && \
@@ -42,7 +43,7 @@ build-stamp:
 	cd obj-$(DEB_BUILD_GNU_TYPE) && \
 	../configure --prefix=/usr --mandir=\$${prefix}/share/man \
 	             --infodir=\$${prefix}/share/info $(confflags) \
-	             CFLAGS="$(CFLAGS)" --with-kms=no
+	             CFLAGS="$(CFLAGS)"
 	cd obj-$(DEB_BUILD_GNU_TYPE) && $(MAKE)
 	touch $@
 

commit 01cee2906686897c4b795d308270b3b69a3e286e
Author: Ben Skeggs <skeggsb@gmail.com>
Date:   Thu Mar 26 11:43:09 2009 +1000

    nv50: call NVSync() in CloseScreen() before restoring video mode
    
    Without this, if accel is still being done to the front buffer (usually at
    offset 0), we'll restore the video mode and then the engine will clobber
    the text mode fonts right afterwards leaving a messed up console.

diff --git a/src/nv_driver.c b/src/nv_driver.c
index ef1d74f..220a88e 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -719,12 +719,10 @@ NVLeaveVT(int scrnIndex, int flags)
 	NVSync(pScrn);
 
 	if (!pNv->kms_enable) {
-		if (pNv->Architecture == NV_ARCH_50) {
+		if (pNv->Architecture < NV_ARCH_50)
+			NVRestore(pScrn);
+		else
 			NV50ReleaseDisplay(pScrn);
-			return;
-		}
-
-		NVRestore(pScrn);
 	}
 }
 
@@ -767,19 +765,8 @@ NVCloseScreen(int scrnIndex, ScreenPtr pScreen)
 	NVPtr pNv = NVPTR(pScrn);
 
 	if (pScrn->vtSema) {
-#ifdef XF86DRM_MODE
-		if (pNv->kms_enable) {
-			NVSync(pScrn);
-		} else
-#endif
-		if (pNv->Architecture == NV_ARCH_50) {
-			NV50ReleaseDisplay(pScrn);
-		} else {
-			if (pNv->randr12_enable)
-				xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NVCloseScreen is called.\n");
-			NVSync(pScrn);
-			NVRestore(pScrn);
-		}
+		NVLeaveVT(scrnIndex, 0);
+		pScrn->vtSema = FALSE;
 	}
 
 	NVAccelFree(pScrn);

commit aa7c0375b51d813be54de5e19b96e958ac183f17
Author: Ben Skeggs <skeggsb@gmail.com>
Date:   Thu Mar 26 06:36:17 2009 +1000

    kms: implement AdjustFrame, should fix crash in fdo#24236

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 42c0704..7341392 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1064,4 +1064,17 @@ Bool drmmode_is_rotate_pixmap(ScrnInfoPtr pScrn, pointer pPixData,
 	return FALSE;
 }
 
+void
+drmmode_adjust_frame(ScrnInfoPtr scrn, int x, int y, int flags)
+{
+	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
+	xf86OutputPtr output = config->output[config->compat_output];
+	xf86CrtcPtr crtc = output->crtc;
+
+	if (!crtc || !crtc->enabled)
+		return;
+
+	drmmode_set_mode_major(crtc, &crtc->mode, crtc->rotation, x, y);
+}
+
 #endif
diff --git a/src/nv_driver.c b/src/nv_driver.c
index 1cd5457..ef1d74f 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -596,6 +596,9 @@ NVAdjustFrame(int scrnIndex, int x, int y, int flags)
 	ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
 	NVPtr pNv = NVPTR(pScrn);
 
+	if (pNv->kms_enable) {
+		drmmode_adjust_frame(pScrn, x, y, flags);
+	} else
 	if (pNv->randr12_enable) {
 		xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
 		xf86CrtcPtr crtc = config->output[config->compat_output]->crtc;
diff --git a/src/nv_proto.h b/src/nv_proto.h
index af888d0..1d00e1a 100644
--- a/src/nv_proto.h
+++ b/src/nv_proto.h
@@ -7,6 +7,7 @@
 Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp);
 Bool drmmode_is_rotate_pixmap(ScrnInfoPtr pScrn, pointer pPixData,
 			      struct nouveau_bo **);
+void drmmode_adjust_frame(ScrnInfoPtr pScrn, int x, int y, int flags);
 
 /* in nv_accel_common.c */
 Bool NVAccelCommonInit(ScrnInfoPtr pScrn);

commit 61879b8079bee1caeedc0bd9c11061423ff27b4a
Author: Ben Skeggs <skeggsb@gmail.com>
Date:   Wed Mar 25 10:09:39 2009 +1000

    kms: drm_mode_modeinfo struct changed names at some point

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 850c9be..42c0704 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -67,8 +67,7 @@ typedef struct {
 static void drmmode_output_dpms(xf86OutputPtr output, int mode);
 
 static void
-drmmode_ConvertFromKMode(ScrnInfoPtr scrn,
-			 struct drm_mode_modeinfo *kmode,
+drmmode_ConvertFromKMode(ScrnInfoPtr scrn, drmModeModeInfo *kmode,
 			 DisplayModePtr	mode)
 {
 	memset(mode, 0, sizeof(DisplayModeRec));
@@ -99,8 +98,7 @@ drmmode_ConvertFromKMode(ScrnInfoPtr scrn,
 }
 
 static void
-drmmode_ConvertToKMode(ScrnInfoPtr scrn,
-		       struct drm_mode_modeinfo *kmode,
+drmmode_ConvertToKMode(ScrnInfoPtr scrn, drmModeModeInfo *kmode,
 		       DisplayModePtr mode)
 {
 	memset(kmode, 0, sizeof(*kmode));
@@ -232,7 +230,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
 	int ret = TRUE;
 	int i;
 	int fb_id;
-	struct drm_mode_modeinfo kmode;
+	drmModeModeInfo kmode;
 
 	if (drmmode->fb_id == 0) {
 		unsigned int pitch =

commit 79306fc29f6b27fd61fe51855bad5489fc4fd986
Author: Ben Skeggs <skeggsb@gmail.com>
Date:   Wed Mar 25 08:15:41 2009 +1000

    dri: fail harder

diff --git a/src/nv_dri.c b/src/nv_dri.c
index 664feb3..bd3e5a9 100644
--- a/src/nv_dri.c
+++ b/src/nv_dri.c
@@ -289,6 +289,8 @@ Bool NVDRIScreenInit(ScrnInfoPtr pScrn)
 	pDRIInfo->createDummyCtx     = FALSE;
 	pDRIInfo->createDummyCtxPriv = FALSE;
 
+	pDRIInfo->keepFDOpen = TRUE;
+
 	if (!DRIScreenInit(pScreen, pDRIInfo, &nouveau_device(pNv->dev)->fd)) {
 		xf86DrvMsg(pScreen->myNum, X_ERROR,
 				"[dri] DRIScreenInit failed.  Disabling DRI.\n");
@@ -320,7 +322,10 @@ Bool NVDRIFinishScreenInit(ScrnInfoPtr pScrn)
 	NOUVEAUDRIPtr  pNOUVEAUDRI;
 	int ret;
 
-	if (!pNv->pDRIInfo || !DRIFinishScreenInit(pScreen))
+	if (!pNv->pDRIInfo)
+		return TRUE;
+
+	if (!DRIFinishScreenInit(pScreen))
 		return FALSE;
 
 	pNOUVEAUDRI 			= (NOUVEAUDRIPtr)pNv->pDRIInfo->devPrivate;
diff --git a/src/nv_driver.c b/src/nv_driver.c
index bd0eb01..1cd5457 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -959,7 +959,7 @@ NVPreInitDRM(ScrnInfoPtr pScrn)
 	}
 
 	/* Initialise libdrm_nouveau */
-	ret = nouveau_device_open_existing(&pNv->dev, 0, DRIMasterFD(pScrn), 0);
+	ret = nouveau_device_open_existing(&pNv->dev, 1, DRIMasterFD(pScrn), 0);
 	if (ret) {
 		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 			   "[drm] error creating device, setting NoAccel\n");
@@ -2182,7 +2182,11 @@ NVScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 	xf86SetSilkenMouse(pScreen);
 
 	/* Finish DRI init */
-	NVDRIFinishScreenInit(pScrn);
+	if (!NVDRIFinishScreenInit(pScrn)) {
+		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+			   "[dri] NVDRIFinishScreenInit failed, disbling DRI\n");
+		NVDRICloseScreen(pScrn);
+	}
 
 	/* 
 	 * Initialize software cursor.

commit da1ba93f1dc2b02615e4f0366450872659176799
Author: Ben Skeggs <skeggsb@gmail.com>
Date:   Wed Mar 25 08:12:26 2009 +1000

    device close doesn't belong in DRI close, can have DRM without DRI

diff --git a/src/nv_dri.c b/src/nv_dri.c
index 37538f0..664feb3 100644
--- a/src/nv_dri.c
+++ b/src/nv_dri.c
@@ -359,16 +359,8 @@ void NVDRICloseScreen(ScrnInfoPtr pScrn)
 	if (pNv->NoAccel)
 		return;
 
-	nouveau_device_close(&pNv->dev);
-
 	DRICloseScreen(pScreen);
 
-	/* The channel should have been removed from the drm side, that still leaves a memory leak though. */
-	if (pNv->chan) {
-		free(pNv->chan);
-		pNv->chan = NULL;
-	}
-
 	if (pNv->pDRIInfo) {
 		if (pNv->pDRIInfo->devPrivate) {
 			xfree(pNv->pDRIInfo->devPrivate);
diff --git a/src/nv_driver.c b/src/nv_driver.c
index ec4577f..bd0eb01 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -44,6 +44,7 @@ static Bool    NVEnterVT(int scrnIndex, int flags);
 static void    NVLeaveVT(int scrnIndex, int flags);
 static Bool    NVCloseScreen(int scrnIndex, ScreenPtr pScreen);
 static Bool    NVSaveScreen(ScreenPtr pScreen, int mode);
+static void    NVCloseDRM(ScrnInfoPtr);
 
 /* Optional functions */
 static Bool    NVSwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
@@ -792,6 +793,8 @@ NVCloseScreen(int scrnIndex, ScreenPtr pScreen)
 		nouveau_dri2_fini(pScreen);
 #endif
 
+	NVCloseDRM(pScrn);
+
 	if (pNv->randr12_enable)
 		xf86_cursors_fini(pScreen);
 	if (pNv->ShadowPtr) {
@@ -908,6 +911,14 @@ static const xf86CrtcConfigFuncsRec nv_xf86crtc_config_funcs = {
 	return FALSE;                                                       \
 } while(0)
 
+static void
+NVCloseDRM(ScrnInfoPtr pScrn)
+{
+	NVPtr pNv = NVPTR(pScrn);
+
+	nouveau_device_close(&pNv->dev);
+}
+
 static Bool
 NVPreInitDRM(ScrnInfoPtr pScrn)
 {

commit 56b11c773ac9392069c6a589f4f87c5cc79e020e
Author: Younes Manton <younes.m@gmail.com>
Date:   Tue Mar 24 14:27:40 2009 -0400

    Fix mouse cursor disappearing when near top/left edge of screen.

diff --git a/src/nvreg.h b/src/nvreg.h
index 9544c18..6f142b3 100644
--- a/src/nvreg.h
+++ b/src/nvreg.h
@@ -304,8 +304,8 @@
 #define NV_PRMCIO_INP0__COLOR		0x006013da
 
 #define NV_PRAMDAC_CU_START_POS				0x00680300
-#	define NV_PRAMDAC_CU_START_POS_X			11:0
-#	define NV_PRAMDAC_CU_START_POS_Y			27:16
+#	define NV_PRAMDAC_CU_START_POS_X			15:0
+#	define NV_PRAMDAC_CU_START_POS_Y			31:16
 #define NV_RAMDAC_NV10_CURSYNC				0x00680404
 
 #define NV_PRAMDAC_NVPLL_COEFF				0x00680500

commit 4067ab466fe3aa817e0323959f70c7dd3494de0a
Author: Ben Skeggs <skeggsb@gmail.com>
Date:   Mon Mar 23 14:43:22 2009 +1000

    another ppc fix

diff --git a/src/nv_crtc.c b/src/nv_crtc.c
index d9c1a32..43bc531 100644
--- a/src/nv_crtc.c
+++ b/src/nv_crtc.c
@@ -854,7 +854,7 @@ nv_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode,
 	/* turn on LFB swapping */
 	{
 		uint8_t tmp = NVReadVgaCrtc(pNv, nv_crtc->head, NV_CIO_CRE_RCR);
-		tmp |= NV_CIO_CRE_RCR_ENDIAN_BIG;
+		tmp |= MASK(NV_CIO_CRE_RCR_ENDIAN_BIG);
 		NVWriteVgaCrtc(pNv, nv_crtc->head, NV_CIO_CRE_RCR, tmp);
 	}
 #endif

commit 862dba8b6ca6354d915f2430826a5581f41d1002
Author: Ben Skeggs <skeggsb@gmail.com>
Date:   Mon Mar 23 14:22:15 2009 +1000

    more ppc..

diff --git a/src/nv_driver.c b/src/nv_driver.c
index 0776083..ec4577f 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -1936,13 +1936,13 @@ static void NVBacklightEnable(NVPtr pNv,  Bool on)
        /* NV17,18,34 Apple iMac, iBook, PowerBook */
       CARD32 tmp_pmc, tmp_pcrt;
       tmp_pmc = nvReadMC(pNv, NV_PBUS_DEBUG_DUALHEAD_CTL) & 0x7FFFFFFF;
-      tmp_pcrt = NVReadCRTC(pNv, 0, NV_CRTC_GPIO_EXT) & 0xFFFFFFFC;
+      tmp_pcrt = NVReadCRTC(pNv, 0, NV_PCRTC_GPIO_EXT) & 0xFFFFFFFC;
       if(on) {
           tmp_pmc |= (1 << 31);
           tmp_pcrt |= 0x1;
       }
       nvWriteMC(pNv, NV_PBUS_DEBUG_DUALHEAD_CTL, tmp_pmc);
-      NVWriteCRTC(pNv, 0, NV_CRTC_GPIO_EXT, tmp_pcrt);
+      NVWriteCRTC(pNv, 0, NV_PCRTC_GPIO_EXT, tmp_pcrt);
     }
 #endif
     

commit 30634865617737171835f6ac9437df597e5a8951
Author: Ben Skeggs <skeggsb@gmail.com>
Date:   Mon Mar 23 13:57:52 2009 +1000

    fix ppc build

diff --git a/src/nv_bios.c b/src/nv_bios.c
index 6934cf1..2aded0c 100644
--- a/src/nv_bios.c
+++ b/src/nv_bios.c
@@ -3021,11 +3021,11 @@ static int call_lvds_manufacturer_script(ScrnInfoPtr pScrn, struct dcb_entry *dc
 	if ((pNv->Chipset & 0xffff) == 0x0179 || (pNv->Chipset & 0xffff) == 0x0189 || (pNv->Chipset & 0xffff) == 0x0329) {
 		if (script == LVDS_PANEL_ON) {
 			bios_wr32(pScrn, NV_PBUS_DEBUG_DUALHEAD_CTL, bios_rd32(pScrn, NV_PBUS_DEBUG_DUALHEAD_CTL) | (1 << 31));
-			bios_wr32(pScrn, NV_CRTC_GPIO_EXT, bios_rd32(pScrn, NV_CRTC_GPIO_EXT) | 1);
+			bios_wr32(pScrn, NV_PCRTC_GPIO_EXT, bios_rd32(pScrn, NV_PCRTC_GPIO_EXT) | 1);
 		}
 		if (script == LVDS_PANEL_OFF) {
 			bios_wr32(pScrn, NV_PBUS_DEBUG_DUALHEAD_CTL, bios_rd32(pScrn, NV_PBUS_DEBUG_DUALHEAD_CTL) & ~(1 << 31));
-			bios_wr32(pScrn, NV_CRTC_GPIO_EXT, bios_rd32(pScrn, NV_CRTC_GPIO_EXT) & ~3);
+			bios_wr32(pScrn, NV_PCRTC_GPIO_EXT, bios_rd32(pScrn, NV_PCRTC_GPIO_EXT) & ~3);
 		}
 	}
 #endif

commit d80fe7878379aefd3345746a149f2b46d3a84805
Author: Francisco Jerez <currojerez@riseup.net>
Date:   Mon Mar 23 03:27:16 2009 +0100

    Fix nouveau_hw_decode_pll on NV30/35.

diff --git a/src/nv_hw.c b/src/nv_hw.c
index 0804f86..e49e084 100644
--- a/src/nv_hw.c
+++ b/src/nv_hw.c
@@ -375,8 +375,8 @@ static void nouveau_hw_decode_pll(NVPtr pNv, uint32_t reg1,
 			pllvals->M1 &= 0xf; /* only 4 bits */
 			if (pll1 & NV30_RAMDAC_ENABLE_VCO2) {
 				pllvals->M2 = (pll1 >> 4) & 0x7;
-				pllvals->N2 = ((pll2 >> 21) & 0x18) |
-					      ((pll2 >> 19) & 0x7);
+				pllvals->N2 = ((pll1 >> 21) & 0x18) |
+					      ((pll1 >> 19) & 0x7);
 			}
 		}
 	}

commit 62aa81deca5c63d30407872c0e2b784f5084acb3
Author: Stuart Bennett <stuart@freedesktop.org>
Date:   Sat Mar 21 01:43:14 2009 +0000

    Some laptop mode finding fixes resulting from rh#487456
    
    On closer inspection, it seems BMP laptops only depend on
    use_straps_for_mode to ban DDC.  Therefore use pxclk alone to determine
    EDID case in parse_lvds_table, and invert sense of fp ddc flag to get a
    default of "false"

diff --git a/src/nouveau_bios.h b/src/nouveau_bios.h
index 1fba4a3..4e3db73 100644
--- a/src/nouveau_bios.h
+++ b/src/nouveau_bios.h
@@ -133,7 +133,7 @@ struct nouveau_bios_info {
 
 	uint32_t dactestval;
 	uint8_t digital_min_front_porch;
-	bool fp_ddc_permitted;
+	bool fp_no_ddc;
 };
 
 struct nvbios {
diff --git a/src/nv_bios.c b/src/nv_bios.c
index c25a801..6934cf1 100644
--- a/src/nv_bios.c
+++ b/src/nv_bios.c
@@ -3231,18 +3231,13 @@ static int parse_fp_mode_table(ScrnInfoPtr pScrn, struct nvbios *bios)
 	struct lvdstableheader lth;
 
 	if (bios->fp.fptablepointer == 0x0) {
-#ifdef __powerpc__
 		/* Apple cards don't have the fp table; the laptops use DDC */
-		bios->pub.fp_ddc_permitted = true;
-		goto missingok;
-#else
+#ifndef __powerpc__
 		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 			   "Pointer to flat panel table invalid\n");
-		if (bios->chip_version == 0x67)	/* sigh, IGPs */
-			goto missingok;
-		return -EINVAL;
+		if (bios->chip_version != 0x67)	/* sigh, IGPs */
+			return -EINVAL;
 #endif
-missingok:
 		bios->pub.digital_min_front_porch = 0x4b;
 		return 0;
 	}
@@ -3335,12 +3330,9 @@ missingok:
 		return -ENOENT;
 	}
 
-	/* a strap value of 0xf is sufficient to indicate DDC use on BMP era
-	 * cards; nv4x cards need an fpindex of 0xf too
-	 */
-	if (fpstrapping == 0xf &&
-	    (lth.lvds_ver == 0x0a || fpindex == 0xf))
-		bios->pub.fp_ddc_permitted = true;
+	/* nv4x cards need both a strap value and fpindex of 0xf to use DDC */
+	if (lth.lvds_ver > 0x10)
+		bios->pub.fp_no_ddc = fpstrapping != 0xf || fpindex != 0xf;
 
 	/* if either the strap or xlated fpindex value are 0xf there is no
 	 * panel using a strap-derived bios mode present.  this condition
@@ -3436,7 +3428,7 @@ int nouveau_bios_parse_lvds_table(ScrnInfoPtr pScrn, int pxclk, bool *dl, bool *
 		lvdsmanufacturerindex = bios->data[bios->fp.fpxlatemanufacturertableptr + fpstrapping];
 
 		/* we're done if this isn't the EDID panel case */
-		if (!bios->pub.fp_ddc_permitted)
+		if (!pxclk)
 			break;
 
 		/* change in behaviour guessed at nv30; see datapoints below */
@@ -3506,7 +3498,7 @@ int nouveau_bios_parse_lvds_table(ScrnInfoPtr pScrn, int pxclk, bool *dl, bool *
 	}
 
 	/* set dual_link flag for EDID case */
-	if (bios->pub.fp_ddc_permitted)
+	if (pxclk)
 		bios->fp.dual_link = (pxclk >= bios->fp.duallink_transition_clk);
 
 	*dl = bios->fp.dual_link;
diff --git a/src/nv_output.c b/src/nv_output.c
index 1172f4a..42ef7d1 100644
--- a/src/nv_output.c
+++ b/src/nv_output.c
@@ -210,7 +210,7 @@ nv_output_detect(xf86OutputPtr output)
 		if (det_encoder->dcb->lvdsconf.use_straps_for_mode) {
 			if (nouveau_bios_fp_mode(pScrn, NULL))
 				ret = XF86OutputStatusConnected;
-		} else if (pNv->vbios->fp_ddc_permitted &&
+		} else if (!pNv->vbios->fp_no_ddc &&
 			   nouveau_bios_embedded_edid(pScrn)) {
 			nv_connector->edid = xf86InterpretEDID(pScrn->scrnIndex,
 							       nouveau_bios_embedded_edid(pScrn));
@@ -312,6 +312,7 @@ nv_lvds_output_get_modes(xf86OutputPtr output)
 	struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder;
 	ScrnInfoPtr pScrn = output->scrn;
 	DisplayModeRec mode, *ret_mode = NULL;
+	int clock = 0;	/* needs to be zero for straps case */
 	bool dl, if_is_24bit = false;
 
 	/* panels only have one mode, and it doesn't change */
@@ -328,11 +329,12 @@ nv_lvds_output_get_modes(xf86OutputPtr output)
 
 		nv_encoder->native_mode = xf86DuplicateMode(&mode);
 		ret_mode = xf86DuplicateMode(&mode);
-	} else
+	} else {
 		ret_mode = nv_output_get_edid_modes(output);
+		clock = nv_encoder->native_mode->Clock;
+	}
 
-	if (nouveau_bios_parse_lvds_table(pScrn, nv_encoder->native_mode->Clock,
-					  &dl, &if_is_24bit))
+	if (nouveau_bios_parse_lvds_table(pScrn, clock, &dl, &if_is_24bit))
 		return NULL;
 
 	/* because of the pre-existing native mode exit above, this will only
@@ -1022,7 +1024,7 @@ void NvSetupOutputs(ScrnInfoPtr pScrn)
 			funcs = &nv_lvds_output_funcs;
 			/* don't create i2c adapter when lvds ddc not allowed */
 			if (dcbent->lvdsconf.use_straps_for_mode ||
-			    !pNv->vbios->fp_ddc_permitted)
+			    pNv->vbios->fp_no_ddc)
 				i2c_index = 0xf;
 			break;
 		default:

commit aa6edfaf1c32432b07c298c42b68f2d93f3b337c
Author: Stuart Bennett <stuart@freedesktop.org>
Date:   Sun Mar 15 15:18:16 2009 +0000

    randr12: name VGA CRTC fields
    
    Now with added consistent indentation
    Use fields in a couple of other cases while we're about it

diff --git a/src/nv_crtc.c b/src/nv_crtc.c
index 57c6320..d9c1a32 100644
--- a/src/nv_crtc.c
+++ b/src/nv_crtc.c
@@ -132,11 +132,13 @@ static void nv_crtc_cursor_set(xf86CrtcPtr crtc)
 	uint32_t cursor_start = head ? pNv->Cursor2->offset :
 				       pNv->Cursor->offset;
 
-	regp->CRTC[NV_CIO_CRE_HCUR_ADDR0_INDEX] = NV_CIO_CRE_HCUR_ASI |
-						  (cursor_start >> 17);
-	regp->CRTC[NV_CIO_CRE_HCUR_ADDR1_INDEX] = (cursor_start >> 11) << 2;
+	regp->CRTC[NV_CIO_CRE_HCUR_ADDR0_INDEX] = MASK(NV_CIO_CRE_HCUR_ASI) |
+						  XLATE(cursor_start, 17,
+							NV_CIO_CRE_HCUR_ADDR0_ADR);
+	regp->CRTC[NV_CIO_CRE_HCUR_ADDR1_INDEX] = XLATE(cursor_start, 11,
+							NV_CIO_CRE_HCUR_ADDR1_ADR);
 	if (crtc->mode.Flags & V_DBLSCAN)
-		regp->CRTC[NV_CIO_CRE_HCUR_ADDR1_INDEX] |= NV_CIO_CRE_HCUR_ADDR1_CUR_DBL;
+		regp->CRTC[NV_CIO_CRE_HCUR_ADDR1_INDEX] |= MASK(NV_CIO_CRE_HCUR_ADDR1_CUR_DBL);
 	regp->CRTC[NV_CIO_CRE_HCUR_ADDR2_INDEX] = cursor_start >> 24;
 
 	crtc_wr_cio_state(crtc, regp, NV_CIO_CRE_HCUR_ADDR0_INDEX);
@@ -375,8 +377,8 @@ nv_crtc_mode_set_vga(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr adjus
 	regp->MiscOutReg |= (mode->ClockIndex & 0x03) << 2;
 
 	/*
-	* Time Sequencer
-	*/
+	 * Time Sequencer
+	 */
 	regp->Sequencer[NV_VIO_SR_RESET_INDEX] = 0x00;
 	/* 0x20 disables the sequencer */
 	if (mode->Flags & V_CLKDIV2)
@@ -388,44 +390,43 @@ nv_crtc_mode_set_vga(xf86CrtcPtr crtc, DisplayModePtr mode, DisplayModePtr adjus
 	regp->Sequencer[NV_VIO_SR_MEM_MODE_INDEX] = 0x0E;
 
 	/*
-	* CRTC Controller
-	*/
-	regp->CRTC[NV_CIO_CR_HDT_INDEX]  = Set8Bits(horizTotal);
-	regp->CRTC[NV_CIO_CR_HDE_INDEX]  = Set8Bits(horizDisplay);
-	regp->CRTC[NV_CIO_CR_HBS_INDEX]  = Set8Bits(horizBlankStart);
-	regp->CRTC[NV_CIO_CR_HBE_INDEX]  = SetBitField(horizBlankEnd,4:0,4:0)
-				| SetBit(7);
-	regp->CRTC[NV_CIO_CR_HRS_INDEX]  = Set8Bits(horizStart);
-	regp->CRTC[NV_CIO_CR_HRE_INDEX]  = SetBitField(horizBlankEnd,5:5,7:7)
-				| SetBitField(horizEnd,4:0,4:0);
-	regp->CRTC[NV_CIO_CR_VDT_INDEX]  = SetBitField(vertTotal,7:0,7:0);
-	regp->CRTC[NV_CIO_CR_OVL_INDEX]  = SetBitField(vertTotal,8:8,0:0)
-				| SetBitField(vertDisplay,8:8,1:1)
-				| SetBitField(vertStart,8:8,2:2)
-				| SetBitField(vertBlankStart,8:8,3:3)
-				| SetBit(4)
-				| SetBitField(vertTotal,9:9,5:5)
-				| SetBitField(vertDisplay,9:9,6:6)
-				| SetBitField(vertStart,9:9,7:7);
-	regp->CRTC[NV_CIO_CR_RSAL_INDEX]  = 0x00;
-	regp->CRTC[NV_CIO_CR_CELL_HT_INDEX]  = SetBitField(vertBlankStart,9:9,5:5)
-				| SetBit(6)
-				| ((mode->Flags & V_DBLSCAN) ? NV_CIO_CR_CELL_HT_SCANDBL : 0);
+	 * CRTC
+	 */
+	regp->CRTC[NV_CIO_CR_HDT_INDEX] = horizTotal;
+	regp->CRTC[NV_CIO_CR_HDE_INDEX] = horizDisplay;
+	regp->CRTC[NV_CIO_CR_HBS_INDEX] = horizBlankStart;
+	regp->CRTC[NV_CIO_CR_HBE_INDEX] = (1 << 7) |
+					  XLATE(horizBlankEnd, 0, NV_CIO_CR_HBE_4_0);
+	regp->CRTC[NV_CIO_CR_HRS_INDEX] = horizStart;
+	regp->CRTC[NV_CIO_CR_HRE_INDEX] = XLATE(horizBlankEnd, 5, NV_CIO_CR_HRE_HBE_5) |
+					  XLATE(horizEnd, 0, NV_CIO_CR_HRE_4_0);
+	regp->CRTC[NV_CIO_CR_VDT_INDEX] = vertTotal;
+	regp->CRTC[NV_CIO_CR_OVL_INDEX] = XLATE(vertStart, 9, NV_CIO_CR_OVL_VRS_9) |
+					  XLATE(vertDisplay, 9, NV_CIO_CR_OVL_VDE_9) |
+					  XLATE(vertTotal, 9, NV_CIO_CR_OVL_VDT_9) |
+					  (1 << 4) |
+					  XLATE(vertBlankStart, 8, NV_CIO_CR_OVL_VBS_8) |
+					  XLATE(vertStart, 8, NV_CIO_CR_OVL_VRS_8) |
+					  XLATE(vertDisplay, 8, NV_CIO_CR_OVL_VDE_8) |
+					  XLATE(vertTotal, 8, NV_CIO_CR_OVL_VDT_8);
+	regp->CRTC[NV_CIO_CR_RSAL_INDEX] = 0x00;
+	regp->CRTC[NV_CIO_CR_CELL_HT_INDEX] = ((mode->Flags & V_DBLSCAN) ? MASK(NV_CIO_CR_CELL_HT_SCANDBL) : 0) |
+					      1 << 6 |
+					      XLATE(vertBlankStart, 9, NV_CIO_CR_CELL_HT_VBS_9);
 	regp->CRTC[NV_CIO_CR_CURS_ST_INDEX] = 0x00;
 	regp->CRTC[NV_CIO_CR_CURS_END_INDEX] = 0x00;
 	regp->CRTC[NV_CIO_CR_SA_HI_INDEX] = 0x00;
 	regp->CRTC[NV_CIO_CR_SA_LO_INDEX] = 0x00;
 	regp->CRTC[NV_CIO_CR_TCOFF_HI_INDEX] = 0x00;
 	regp->CRTC[NV_CIO_CR_TCOFF_LO_INDEX] = 0x00;
-	regp->CRTC[NV_CIO_CR_VRS_INDEX] = Set8Bits(vertStart);
-	/* What is the meaning of bit5, it is empty in the vga spec. */
-	regp->CRTC[NV_CIO_CR_VRE_INDEX] = SetBitField(vertEnd,3:0,3:0) | SetBit(5);
-	regp->CRTC[NV_CIO_CR_VDE_INDEX] = Set8Bits(vertDisplay);
+	regp->CRTC[NV_CIO_CR_VRS_INDEX] = vertStart;
+	regp->CRTC[NV_CIO_CR_VRE_INDEX] = 1 << 5 | XLATE(vertEnd, 0, NV_CIO_CR_VRE_3_0);
+	regp->CRTC[NV_CIO_CR_VDE_INDEX] = vertDisplay;
 	/* framebuffer can be larger than crtc scanout area. */


Reply to: