xf86-video-nv: .gitignore src/nv_cursor.c src/nv_dac.c src/nv_dga.c src/nv_dma.h src/nv_driver.c src/nv_hw.c src/nv_local.h src/nv_setup.c src/nv_shadow.c src/nv_video.c src/nv_xaa.c src/riva_cursor.c src/riva_dac.c src/riva_dga.c src/riva_driver.c src/riva_hw.c src/riva_hw.h src/riva_local.h src/riva_setup.c src/riva_shadow.c src/riva_xaa.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Aug 20 23:37:24 UTC 2025


 .gitignore        |    4 -
 src/nv_cursor.c   |   22 +++---
 src/nv_dac.c      |   34 ++++-----
 src/nv_dga.c      |   68 +++++++++----------
 src/nv_dma.h      |    4 -
 src/nv_driver.c   |  124 ++++++++++++++++++------------------
 src/nv_hw.c       |  112 ++++++++++++++++----------------
 src/nv_local.h    |    2 
 src/nv_setup.c    |   40 +++++------
 src/nv_shadow.c   |   36 +++++-----
 src/nv_video.c    |  184 +++++++++++++++++++++++++++---------------------------
 src/nv_xaa.c      |   84 ++++++++++++------------
 src/riva_cursor.c |   16 ++--
 src/riva_dac.c    |   18 ++---
 src/riva_dga.c    |   64 +++++++++---------
 src/riva_driver.c |   86 ++++++++++++-------------
 src/riva_hw.c     |   44 ++++++------
 src/riva_hw.h     |    2 
 src/riva_local.h  |    2 
 src/riva_setup.c  |    8 +-
 src/riva_shadow.c |   36 +++++-----
 src/riva_xaa.c    |   48 +++++++-------
 22 files changed, 519 insertions(+), 519 deletions(-)

New commits:
commit c5f14b4a0718ee5b019f44427cee582ff03ea355
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Wed Aug 20 16:31:32 2025 -0700

    Strip trailing whitespace from source files
    
    Performed with: `git ls-files | xargs perl -i -p -e 's{[ \t]+$}{}'`
    
    `git diff -w` & `git diff -b` show no diffs from this change
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-video-nv/-/merge_requests/29>

diff --git a/.gitignore b/.gitignore
index 4317914..1324642 100644
--- a/.gitignore
+++ b/.gitignore
@@ -71,8 +71,8 @@ core
 *.tar.bz2
 *.tar.gz
 #
-#		Add & Override patterns for xf86-video-nv 
+#		Add & Override patterns for xf86-video-nv
 #
 #		Edit the following section as needed
 # For example, !report.pc overrides *.pc. See 'man gitignore'
-# 
+#
diff --git a/src/nv_cursor.c b/src/nv_cursor.c
index d15f754..241a80c 100644
--- a/src/nv_cursor.c
+++ b/src/nv_cursor.c
@@ -48,12 +48,12 @@
                          ((c & 0xff) << 24)
 
 
-static void 
+static void
 ConvertCursor1555(NVPtr pNv, CARD32 *src, CARD16 *dst)
 {
     CARD32 b, m;
     int i, j;
-    
+
     for ( i = 0; i < 32; i++ ) {
         b = *src++;
         m = *src++;
@@ -84,7 +84,7 @@ ConvertCursor8888(NVPtr pNv, CARD32 *src, CARD32 *dst)
 {
     CARD32 b, m;
     int i, j;
-   
+
     for ( i = 0; i < 128; i++ ) {
         b = *src++;
         m = *src++;
@@ -181,13 +181,13 @@ NVSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
     if ((pNv->curFg != fore) || (pNv->curBg != back)) {
         pNv->curFg = fore;
         pNv->curBg = back;
-            
+
         TransformCursor(pNv);
     }
 }
 
 
-static void 
+static void
 NVShowCursor(ScrnInfoPtr pScrn)
 {
     NVPtr pNv = NVPTR(pScrn);
@@ -203,14 +203,14 @@ NVHideCursor(ScrnInfoPtr pScrn)
     NVShowHideCursor(pNv, 0);
 }
 
-static Bool 
+static Bool
 NVUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
 {
     return TRUE;
 }
 
 #ifdef ARGB_CURSOR
-static Bool 
+static Bool
 NVUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs)
 {
     if((pCurs->bits->width <= 64) && (pCurs->bits->height <= 64))
@@ -241,7 +241,7 @@ NVLoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
                 tmp = (alpha << 24) |
                          (((*image & 0xff) * alpha) / 255) |
                         ((((*image & 0xff00) * alpha) / 255) & 0xff00) |
-                       ((((*image & 0xff0000) * alpha) / 255) & 0xff0000); 
+                       ((((*image & 0xff0000) * alpha) / 255) & 0xff0000);
              }
              image++;
 #if X_BYTE_ORDER == X_BIG_ENDIAN
@@ -267,7 +267,7 @@ NVLoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
 }
 #endif
 
-Bool 
+Bool
 NVCursorInit(ScreenPtr pScreen)
 {
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
@@ -276,7 +276,7 @@ NVCursorInit(ScreenPtr pScreen)
 
     infoPtr = xf86CreateCursorInfoRec();
     if(!infoPtr) return FALSE;
-    
+
     pNv->CursorInfoRec = infoPtr;
 
     if(pNv->alphaCursor)
@@ -285,7 +285,7 @@ NVCursorInit(ScreenPtr pScreen)
        infoPtr->MaxWidth = infoPtr->MaxHeight = 32;
 
     infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
-                     HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32; 
+                     HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32;
     infoPtr->SetCursorColors = NVSetCursorColors;
     infoPtr->SetCursorPosition = NVSetCursorPosition;
     infoPtr->LoadCursorImage = NVLoadCursorImage;
diff --git a/src/nv_dac.c b/src/nv_dac.c
index c7a0f01..1ac04bc 100644
--- a/src/nv_dac.c
+++ b/src/nv_dac.c
@@ -84,7 +84,7 @@ NVDACInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
     int vertTotal       =  mode->CrtcVTotal        - 2;
     int vertBlankStart  =  mode->CrtcVDisplay      - 1;
     int vertBlankEnd    =  mode->CrtcVTotal        - 1;
-   
+
     NVPtr pNv = NVPTR(pScrn);
     NVRegPtr nvReg = &pNv->ModeReg;
     NVFBLayout *pLayout = &pNv->CurrentLayout;
@@ -104,15 +104,15 @@ NVDACInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
      * Set all CRTC values.
      */
 
-    if(mode->Flags & V_INTERLACE) 
+    if(mode->Flags & V_INTERLACE)
         vertTotal |= 1;
 
     if(pNv->FlatPanel == 1) {
-       vertStart = vertTotal - 3;  
+       vertStart = vertTotal - 3;
        vertEnd = vertTotal - 2;
        vertBlankStart = vertStart;
        horizStart = horizTotal - 5;
-       horizEnd = horizTotal - 2;   
+       horizEnd = horizTotal - 2;
        horizBlankEnd = horizTotal + 4;
        if(pNv->Architecture == NV_ARCH_30)
            horizTotal += 2;
@@ -121,7 +121,7 @@ NVDACInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
     pVga->CRTC[0x0]  = NV_Set8Bits(horizTotal);
     pVga->CRTC[0x1]  = NV_Set8Bits(horizDisplay);
     pVga->CRTC[0x2]  = NV_Set8Bits(horizBlankStart);
-    pVga->CRTC[0x3]  = NV_SetBitField(horizBlankEnd,4:0,4:0) 
+    pVga->CRTC[0x3]  = NV_SetBitField(horizBlankEnd,4:0,4:0)
                        | NV_SetBit(7);
     pVga->CRTC[0x4]  = NV_Set8Bits(horizStart);
     pVga->CRTC[0x5]  = NV_SetBitField(horizBlankEnd,5:5,7:7)
@@ -156,7 +156,7 @@ NVDACInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
                   | NV_SetBitField(vertDisplay,10:10,1:1)
                   | NV_SetBitField(vertTotal,10:10,0:0);
 
-    nvReg->horiz  = NV_SetBitField(horizTotal,8:8,0:0) 
+    nvReg->horiz  = NV_SetBitField(horizTotal,8:8,0:0)
                   | NV_SetBitField(horizDisplay,8:8,1:1)
                   | NV_SetBitField(horizBlankStart,8:8,2:2)
                   | NV_SetBitField(horizStart,8:8,3:3);
@@ -187,19 +187,19 @@ NVDACInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
             pVga->DAC[(i*3)+2] = i;
         }
     }
-    
+
     /*
      * Calculate the extended registers.
      */
 
-    if(pLayout->depth < 24) 
+    if(pLayout->depth < 24)
 	i = pLayout->depth;
     else i = 32;
 
     if(pNv->Architecture >= NV_ARCH_10)
 	pNv->CURSOR = (U032 *)(pNv->FbStart + pNv->CursorStart);
 
-    NVCalcStateExt(pNv, 
+    NVCalcStateExt(pNv,
                     nvReg,
                     i,
                     pLayout->displayWidth,
@@ -235,15 +235,15 @@ NVDACInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
        nvReg->crtcOwner = 3;
        nvReg->pllsel |= 0x20000800;
        nvReg->vpll = pNv->PRAMDAC0[0x0508/4];
-       if(pNv->twoStagePLL) 
+       if(pNv->twoStagePLL)
           nvReg->vpllB = pNv->PRAMDAC0[0x0578/4];
-    } else 
+    } else
     if(pNv->twoHeads) {
        nvReg->head  =  pNv->PCRTC0[0x00000860/4] | 0x00001000;
        nvReg->head2 =  pNv->PCRTC0[0x00002860/4] & ~0x00001000;
        nvReg->crtcOwner = 0;
        nvReg->vpll2 = pNv->PRAMDAC0[0x0520/4];
-       if(pNv->twoStagePLL) 
+       if(pNv->twoStagePLL)
           nvReg->vpll2B = pNv->PRAMDAC0[0x057C/4];
     }
 
@@ -251,7 +251,7 @@ NVDACInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
     if(mode->Flags & V_DBLSCAN)
        nvReg->cursorConfig |= (1 << 4);
     if(pNv->alphaCursor) {
-        if((pNv->Chipset & 0x0ff0) != 0x0110) 
+        if((pNv->Chipset & 0x0ff0) != 0x0110)
            nvReg->cursorConfig |= 0x04011000;
         else
            nvReg->cursorConfig |= 0x14011000;
@@ -268,7 +268,7 @@ NVDACInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
            nvReg->dither = pNv->PRAMDAC[0x083C/4] & ~1;
            if(pNv->FPDither)
               nvReg->dither |= 1;
-        } 
+        }
     }
 
     nvReg->timingH = 0;
@@ -278,7 +278,7 @@ NVDACInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
     return (TRUE);
 }
 
-void 
+void
 NVDACRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, NVRegPtr nvReg,
              Bool primary)
 {
@@ -308,12 +308,12 @@ NVDACSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, NVRegPtr nvReg,
     saveFonts = FALSE;
 #endif
 
-    vgaHWSave(pScrn, vgaReg, VGA_SR_CMAP | VGA_SR_MODE | 
+    vgaHWSave(pScrn, vgaReg, VGA_SR_CMAP | VGA_SR_MODE |
                              (saveFonts? VGA_SR_FONTS : 0));
     NVUnloadStateExt(pNv, nvReg);
 
     /* can't read this reliably on NV11 */
-    if((pNv->Chipset & 0x0ff0) == 0x0110) 
+    if((pNv->Chipset & 0x0ff0) == 0x0110)
        nvReg->crtcOwner = pNv->CRTCnumber;
 }
 
diff --git a/src/nv_dga.c b/src/nv_dga.c
index 3c9ad11..d6ed749 100644
--- a/src/nv_dga.c
+++ b/src/nv_dga.c
@@ -12,7 +12,7 @@
 #include "dgaproc.h"
 
 
-static Bool NV_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, 
+static Bool NV_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **,
 					int *, int *, int *);
 static Bool NV_SetMode(ScrnInfoPtr, DGAModePtr);
 static int  NV_GetViewport(ScrnInfoPtr);
@@ -20,7 +20,7 @@ static void NV_SetViewport(ScrnInfoPtr, int, int, int);
 #ifdef HAVE_XAA_H
 static void NV_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long);
 static void NV_BlitRect(ScrnInfoPtr, int, int, int, int, int, int);
-static void NV_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, 
+static void NV_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int,
 					unsigned long);
 #endif
 
@@ -75,7 +75,7 @@ SECOND_PASS:
 		(size <= pNv->ScratchBufferStart)) {
 
 	    if(secondPitch)
-		pitch = secondPitch; 
+		pitch = secondPitch;
 
 	    if(!(newmodes = realloc(modes, (*num + 1) * sizeof(DGAModeRec))))
 		break;
@@ -112,8 +112,8 @@ SECOND_PASS:
 	    mode->address = pNv->FbStart;
 	    mode->bytesPerScanline = pitch * Bpp;
 	    mode->imageWidth = pitch;
-	    mode->imageHeight =  pNv->ScratchBufferStart / 
-                                 mode->bytesPerScanline; 
+	    mode->imageHeight =  pNv->ScratchBufferStart /
+                                 mode->bytesPerScanline;
 	    mode->pixmapWidth = mode->imageWidth;
 	    mode->pixmapHeight = mode->imageHeight;
 	    mode->maxViewportX = mode->imageWidth - mode->viewportWidth;
@@ -137,32 +137,32 @@ SECOND_PASS:
 
 Bool
 NVDGAInit(ScreenPtr pScreen)
-{   
+{
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
    NVPtr pNv = NVPTR(pScrn);
    DGAModePtr modes = NULL;
    int num = 0;
 
    /* 8 */
-   modes = NVSetupDGAMode (pScrn, modes, &num, 8, 8, 
+   modes = NVSetupDGAMode (pScrn, modes, &num, 8, 8,
 		(pScrn->bitsPerPixel == 8),
 		(pScrn->bitsPerPixel != 8) ? 0 : pScrn->displayWidth,
 		0, 0, 0, PseudoColor);
 
    /* 15 */
-   modes = NVSetupDGAMode (pScrn, modes, &num, 16, 15, 
+   modes = NVSetupDGAMode (pScrn, modes, &num, 16, 15,
 		(pScrn->bitsPerPixel == 16),
 		(pScrn->depth != 15) ? 0 : pScrn->displayWidth,
 		0x7c00, 0x03e0, 0x001f, TrueColor);
 
    /* 16 */
-   modes = NVSetupDGAMode (pScrn, modes, &num, 16, 16, 
+   modes = NVSetupDGAMode (pScrn, modes, &num, 16, 16,
 		(pScrn->bitsPerPixel == 16),
 		(pScrn->depth != 16) ? 0 : pScrn->displayWidth,
 		0xf800, 0x07e0, 0x001f, TrueColor);
 
    /* 32 */
-   modes = NVSetupDGAMode (pScrn, modes, &num, 32, 24, 
+   modes = NVSetupDGAMode (pScrn, modes, &num, 32, 24,
 		(pScrn->bitsPerPixel == 32),
 		(pScrn->bitsPerPixel != 32) ? 0 : pScrn->displayWidth,
 		0xff0000, 0x00ff00, 0x0000ff, TrueColor);
@@ -170,18 +170,18 @@ NVDGAInit(ScreenPtr pScreen)
    pNv->numDGAModes = num;
    pNv->DGAModes = modes;
 
-   return DGAInit(pScreen, &NV_DGAFuncs, modes, num);  
+   return DGAInit(pScreen, &NV_DGAFuncs, modes, num);
 }
 
 
-static int 
+static int
 BitsSet(unsigned long data)
 {
    unsigned long mask;
    int set = 0;
 
    for(mask = 1; mask; mask <<= 1)
-        if(mask & data) set++;   
+        if(mask & data) set++;
 
    return set;
 }
@@ -199,7 +199,7 @@ NV_SetMode(
    if(!pMode) { /* restore the original mode */
       if(pNv->DGAactive)
         memcpy(&pNv->CurrentLayout, &SavedLayouts[index], sizeof(NVFBLayout));
-                
+
       pScrn->currentMode = pNv->CurrentLayout.mode;
       NVSwitchMode(SWITCH_MODE_ARGS(pScrn, pScrn->currentMode));
       NVAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
@@ -213,7 +213,7 @@ NV_SetMode(
       /* update CurrentLayout */
       pNv->CurrentLayout.bitsPerPixel = pMode->bitsPerPixel;
       pNv->CurrentLayout.depth = pMode->depth;
-      pNv->CurrentLayout.displayWidth = pMode->bytesPerScanline / 
+      pNv->CurrentLayout.displayWidth = pMode->bytesPerScanline /
                               (pMode->bitsPerPixel >> 3);
       pNv->CurrentLayout.weight.red = BitsSet(pMode->red_mask);
       pNv->CurrentLayout.weight.green = BitsSet(pMode->green_mask);
@@ -221,13 +221,13 @@ NV_SetMode(
       /* NVModeInit() will set the mode field */
       NVSwitchMode(SWITCH_MODE_ARGS(pScrn, pMode->mode));
    }
-   
+
    return TRUE;
 }
 
 
 
-static int  
+static int
 NV_GetViewport(
   ScrnInfoPtr pScrn
 ){
@@ -236,10 +236,10 @@ NV_GetViewport(
     return pNv->DGAViewportStatus;
 }
 
-static void 
+static void
 NV_SetViewport(
-   ScrnInfoPtr pScrn, 
-   int x, int y, 
+   ScrnInfoPtr pScrn,
+   int x, int y,
    int flags
 ){
    NVPtr pNv = NVPTR(pScrn);
@@ -249,14 +249,14 @@ NV_SetViewport(
    while(VGA_RD08(pNv->PCIO, 0x3da) & 0x08);
    while(!(VGA_RD08(pNv->PCIO, 0x3da) & 0x08));
 
-   pNv->DGAViewportStatus = 0;  
+   pNv->DGAViewportStatus = 0;
 }
 
 #ifdef HAVE_XAA_H
-static void 
+static void
 NV_FillRect (
-   ScrnInfoPtr pScrn, 
-   int x, int y, int w, int h, 
+   ScrnInfoPtr pScrn,
+   int x, int y, int w, int h,
    unsigned long color
 ){
     NVPtr pNv = NVPTR(pScrn);
@@ -269,11 +269,11 @@ NV_FillRect (
     SET_SYNC_FLAG(pNv->AccelInfoRec);
 }
 
-static void 
+static void
 NV_BlitRect(
-   ScrnInfoPtr pScrn, 
-   int srcx, int srcy, 
-   int w, int h, 
+   ScrnInfoPtr pScrn,
+   int srcx, int srcy,
+   int w, int h,
    int dstx, int dsty
 ){
     NVPtr pNv = NVPTR(pScrn);
@@ -292,11 +292,11 @@ NV_BlitRect(
 }
 
 
-static void 
+static void
 NV_BlitTransRect(
-   ScrnInfoPtr pScrn, 
-   int srcx, int srcy, 
-   int w, int h, 
+   ScrnInfoPtr pScrn,
+   int srcx, int srcy,
+   int w, int h,
    int dstx, int dsty,
    unsigned long color
 ){
@@ -304,9 +304,9 @@ NV_BlitTransRect(
 }
 #endif
 
-static Bool 
+static Bool
 NV_OpenFramebuffer(
-   ScrnInfoPtr pScrn, 
+   ScrnInfoPtr pScrn,
    char **name,
    unsigned char **mem,
    int *size,
diff --git a/src/nv_dma.h b/src/nv_dma.h
index fbd72e1..71f36f0 100644
--- a/src/nv_dma.h
+++ b/src/nv_dma.h
@@ -59,7 +59,7 @@
 #define LINE_LINES(i)                                               0x00008400\
                                                                     +(i)*8
 #define LINE_LINES_POINT0_X                                         15:0
-#define LINE_LINES_POINT0_Y                                         31:16 
+#define LINE_LINES_POINT0_Y                                         31:16
 #define LINE_LINES_POINT1_X                                         47:32
 #define LINE_LINES_POINT1_Y                                         63:48
 
@@ -136,7 +136,7 @@
 #define STRETCH_BLIT_OPERATION_COPY                                 0x00000003
 #define STRETCH_BLIT_OPERATION_BLEND                                0x00000002
 #define STRETCH_BLIT_CLIP_POINT                                     0x0000E308
-#define STRETCH_BLIT_CLIP_POINT_X                                   15:0 
+#define STRETCH_BLIT_CLIP_POINT_X                                   15:0
 #define STRETCH_BLIT_CLIP_POINT_Y                                   31:16
 #define STRETCH_BLIT_CLIP_POINT                                     0x0000E308
 #define STRETCH_BLIT_CLIP_SIZE                                      0x0000E30C
diff --git a/src/nv_driver.c b/src/nv_driver.c
index 7400b26..91cb572 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -750,7 +750,7 @@ NVAvailableOptions(int chipid, int busid)
     if(chipid == 0x12D20018) {
         return RivaAvailableOptions(chipid, busid);
     }
-    
+
     return NVOptions;
 }
 
@@ -795,7 +795,7 @@ NVGetScrnInfoRec(PciChipsets *chips, int chip)
 #define MAX_CHIPS MAXSCREENS
 
 
-static CARD32 
+static CARD32
 #ifdef XSERVER_LIBPCIACCESS
 NVGetPCIXpressChip (struct pci_device *dev)
 #else
@@ -824,7 +824,7 @@ NVGetPCIXpressChip (pciVideoPtr pVideo)
 
     pcicmd = pciReadLong(Tag, PCI_CMD_STAT_REG);
     pciWriteLong(Tag, PCI_CMD_STAT_REG, pcicmd | PCI_CMD_MEM_ENABLE);
-    
+
     regs = xf86MapPciMem(-1, VIDMEM_MMIO, Tag, pVideo->memBase[0], 0x2000);
 
     pciid = regs[0x1800/4];
@@ -834,9 +834,9 @@ NVGetPCIXpressChip (pciVideoPtr pVideo)
     pciWriteLong(Tag, PCI_CMD_STAT_REG, pcicmd);
 #endif
 
-    if((pciid & 0x0000ffff) == 0x000010DE) 
+    if((pciid & 0x0000ffff) == 0x000010DE)
        pciid = 0x10DE0000 | (pciid >> 16);
-    else 
+    else
     if((pciid & 0xffff0000) == 0xDE100000) /* wrong endian */
        pciid = 0x10DE0000 | ((pciid << 8) & 0x0000ff00) |
                             ((pciid >> 8) & 0x000000ff);
@@ -981,18 +981,18 @@ NVProbe(DriverPtr drv, int flags)
     Bool foundScreen = FALSE;
 
 
-    if ((numDevSections = xf86MatchDevice(NV_DRIVER_NAME, &devSections)) <= 0) 
+    if ((numDevSections = xf86MatchDevice(NV_DRIVER_NAME, &devSections)) <= 0)
         return FALSE;  /* no matching device section */
 
-    if (!(ppPci = xf86GetPciVideoInfo())) 
+    if (!(ppPci = xf86GetPciVideoInfo()))
         return FALSE;  /* no PCI cards found */
 
     numUsed = 0;
 
     /* Create the NVChipsets and NVPciChipsets from found devices */
     while (*ppPci && (numUsed < MAX_CHIPS)) {
-        if(((*ppPci)->vendor == PCI_VENDOR_NVIDIA_SGS) || 
-           ((*ppPci)->vendor == PCI_VENDOR_NVIDIA)) 
+        if(((*ppPci)->vendor == PCI_VENDOR_NVIDIA_SGS) ||
+           ((*ppPci)->vendor == PCI_VENDOR_NVIDIA))
         {
             SymTabRec *nvchips = NVKnownChipsets;
             int pciid = ((*ppPci)->vendor << 16) | (*ppPci)->chipType;
@@ -1026,7 +1026,7 @@ NVProbe(DriverPtr drv, int flags)
 
     /* terminate the list */
     NVChipsets[numUsed].token = -1;
-    NVChipsets[numUsed].name = NULL; 
+    NVChipsets[numUsed].name = NULL;
     NVPciChipsets[numUsed].numChipset = -1;
     NVPciChipsets[numUsed].PCIid = -1;
     NVPciChipsets[numUsed].resList = RES_UNDEFINED;
@@ -1034,8 +1034,8 @@ NVProbe(DriverPtr drv, int flags)
     numUsed = xf86MatchPciInstances(NV_NAME, 0, NVChipsets, NVPciChipsets,
                                     devSections, numDevSections, drv,
                                     &usedChips);
-                        
-    if (numUsed <= 0) 
+
+    if (numUsed <= 0)
         return FALSE;
 
     if (flags & PROBE_DETECT)
@@ -1051,9 +1051,9 @@ NVProbe(DriverPtr drv, int flags)
             if(G80GetScrnInfoRec(NVPciChipsets, usedChips[i]))
                 foundScreen = TRUE;
         } else {
-            if(NVGetScrnInfoRec(NVPciChipsets, usedChips[i])) 
+            if(NVGetScrnInfoRec(NVPciChipsets, usedChips[i]))
 	        foundScreen = TRUE;
-	}    
+	}
     }
 
     free(devSections);
@@ -1099,7 +1099,7 @@ NVSwitchModeVBE(SWITCH_MODE_ARGS_DECL)
  * displayed location in the video memory.
  */
 /* Usually mandatory */
-void 
+void
 NVAdjustFrame(ADJUST_FRAME_ARGS_DECL)
 {
     SCRN_INFO_PTR(arg);
@@ -1182,7 +1182,7 @@ NVLeaveVTVBE(VT_FUNC_ARGS_DECL)
     NVSaveRestoreVBE(pScrn, MODE_RESTORE);
 }
 
-static void 
+static void
 NVBlockHandler (BLOCKHANDLER_ARGS_DECL)
 {
     SCREEN_PTR(arg);
@@ -1191,12 +1191,12 @@ NVBlockHandler (BLOCKHANDLER_ARGS_DECL)
 
     if (pNv->DMAKickoffCallback)
         (*pNv->DMAKickoffCallback)(pScrnInfo);
-    
+
     pScreen->BlockHandler = pNv->BlockHandler;
     (*pScreen->BlockHandler) (BLOCKHANDLER_ARGS);
     pScreen->BlockHandler = NVBlockHandler;
 
-    if (pNv->VideoTimerCallback) 
+    if (pNv->VideoTimerCallback)
         (*pNv->VideoTimerCallback)(pScrnInfo, currentTime.milliseconds);
 
 }
@@ -1317,7 +1317,7 @@ Bool NVI2CInit(ScrnInfoPtr pScrn)
         mod = "ddc";
         if(xf86LoadSubModule(pScrn, mod)) {
             return NVDACi2cInit(pScrn);
-        } 
+        }
     }
 
     xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
@@ -1343,7 +1343,7 @@ NVModesAdd(DisplayModePtr Modes, DisplayModePtr Additions)
 
         while (Mode->next)
             Mode = Mode->next;
-        
+
         Mode->next = Additions;
         Additions->prev = Mode;
     }
@@ -1380,7 +1380,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
      * not at the start of each server generation.  This means that
      * only things that are persistent across server generations can
      * be initialised here.  xf86Screens[] is (pScrn is a pointer to one
-     * of these).  Privates allocated using xf86AllocateScrnInfoPrivateIndex()  
+     * of these).  Privates allocated using xf86AllocateScrnInfoPrivateIndex()
      * are too, and should be used for data that must persist across
      * server generations.
      *
@@ -1402,7 +1402,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
     pNv->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
     if (pNv->pEnt->location.type != BUS_PCI)
 	return FALSE;
- 
+
     /* Find the PCI info for this screen */
     pNv->PciInfo = xf86GetPciInfoForEntity(pNv->pEnt->index);
 #ifndef XSERVER_LIBPCIACCESS
@@ -1419,7 +1419,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
         pNv->pInt = xf86InitInt10(pNv->pEnt->index);
 #endif
     }
-   
+
 #ifndef XSERVER_LIBPCIACCESS
     xf86SetOperatingState(resVgaIo, pNv->pEnt->index, ResUnusedOpr);
     xf86SetOperatingState(resVgaMem, pNv->pEnt->index, ResDisableOpr);
@@ -1438,7 +1438,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
         from = X_CONFIG;
     } else if (pNv->pEnt->device->chipID >= 0) {
 	pNv->Chipset = pNv->pEnt->device->chipID;
-	pScrn->chipset = (char *)xf86TokenToString(NVKnownChipsets, 
+	pScrn->chipset = (char *)xf86TokenToString(NVKnownChipsets,
                                                    pNv->Chipset);
 	from = X_CONFIG;
 	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipID override: 0x%04X\n",
@@ -1453,7 +1453,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
             pNv->Chipset = NVGetPCIXpressChip(pNv->PciInfo);
         }
 
-	pScrn->chipset = (char *)xf86TokenToString(NVKnownChipsets, 
+	pScrn->chipset = (char *)xf86TokenToString(NVKnownChipsets,
                                                    pNv->Chipset);
         if(!pScrn->chipset)
           pScrn->chipset = "Unknown NVIDIA chipset";
@@ -1550,7 +1550,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
 	xf86FreeInt10(pNv->pInt);
 	return FALSE;
     }
-    
+
     /*
      * Allocate a vgaHWRec
      */
@@ -1563,7 +1563,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
 #else
     vgaHWSetStdFuncs(VGAHWPTR(pScrn));
 #endif
-    
+
     /* We use a programmable clock */
     pScrn->progClock = TRUE;
 
@@ -1609,12 +1609,12 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
     if (xf86ReturnOptValBool(pNv->Options, OPTION_SHADOW_FB, FALSE)) {
 	pNv->ShadowFB = TRUE;
 	pNv->NoAccel = TRUE;
-	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, 
+	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
 		"Using \"Shadow Framebuffer\" - acceleration disabled\n");
     }
     if (xf86ReturnOptValBool(pNv->Options, OPTION_FBDEV, FALSE)) {
 	pNv->FBDev = TRUE;
-	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, 
+	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
 		"Using framebuffer device\n");
     }
     if (pNv->FBDev) {
@@ -1623,7 +1623,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
 	    xf86FreeInt10(pNv->pInt);
 	    return FALSE;
 	}
-	
+
 	if (!fbdevHWInit(pScrn, pNv->PciInfo, NULL)) {
 	    xf86FreeInt10(pNv->pInt);
 	    return FALSE;
@@ -1642,7 +1642,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
 	pNv->NoAccel = TRUE;
 	pNv->HWCursor = FALSE;
 	pNv->Rotate = 1;
-	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, 
+	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
 		"Rotating screen clockwise - acceleration disabled\n");
       } else
       if(!xf86NameCmp(s, "CCW")) {
@@ -1650,7 +1650,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
 	pNv->NoAccel = TRUE;
 	pNv->HWCursor = FALSE;
 	pNv->Rotate = -1;
-	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, 
+	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
 		"Rotating screen counter clockwise - acceleration disabled\n");
       } else
       if(!xf86NameCmp(s, "RandR")) {
@@ -1668,9 +1668,9 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
 		"\"RandR\"'.\n");
 #endif
       } else {
-	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, 
+	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
 		"\"%s\" is not a valid value for Option \"Rotate\"\n", s);
-	xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
+	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 		"Valid options are \"CW\", \"CCW\", and \"RandR\"\n");
       }
     }
@@ -1679,9 +1679,9 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
         xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n",
                                 pNv->videoKey);
     } else {
-        pNv->videoKey =  (1 << pScrn->offset.red) | 
+        pNv->videoKey =  (1 << pScrn->offset.red) |
                           (1 << pScrn->offset.green) |
-        (((pScrn->mask.blue >> pScrn->offset.blue) - 1) << pScrn->offset.blue); 
+        (((pScrn->mask.blue >> pScrn->offset.blue) - 1) << pScrn->offset.blue);
     }
 
     if (xf86GetOptValBool(pNv->Options, OPTION_FLAT_PANEL, &(pNv->FlatPanel))) {
@@ -1692,15 +1692,15 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
     }
 
     pNv->FPDither = FALSE;
-    if (xf86GetOptValBool(pNv->Options, OPTION_FP_DITHER, &(pNv->FPDither))) 
+    if (xf86GetOptValBool(pNv->Options, OPTION_FP_DITHER, &(pNv->FPDither)))
         xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "enabling flat panel dither\n");
 
     if (xf86GetOptValInteger(pNv->Options, OPTION_CRTC_NUMBER,
-                             &pNv->CRTCnumber)) 
+                             &pNv->CRTCnumber))
     {
 	if((pNv->CRTCnumber < 0) || (pNv->CRTCnumber > 1)) {
            pNv->CRTCnumber = -1;
-           xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, 
+           xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
                       "Invalid CRTC number.  Must be 0 or 1\n");
         }
     } else {
@@ -1708,7 +1708,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
     }
 
 
-    if (xf86GetOptValInteger(pNv->Options, OPTION_FP_TWEAK, 
+    if (xf86GetOptValInteger(pNv->Options, OPTION_FP_TWEAK,
                              &pNv->PanelTweak))
     {
         pNv->usePanelTweak = TRUE;
@@ -1804,7 +1804,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
     }
     xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX\n",
 	       (unsigned long)pNv->IOAddress);
-     
+
 #ifndef XSERVER_LIBPCIACCESS
     if (xf86RegisterResources(pNv->pEnt->index, NULL, ResExclusive)) {
 	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -1884,7 +1884,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
     pNv->alphaCursor = (pNv->Architecture >= NV_ARCH_10) &&
                        ((pNv->Chipset & 0x0ff0) != 0x0100);
 
-    if ((pScrn->monitor->nHsync == 0) && 
+    if ((pScrn->monitor->nHsync == 0) &&
 	(pScrn->monitor->nVrefresh == 0))
 	config_mon_rates = FALSE;
     else
@@ -1899,7 +1899,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
     }
     xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VideoRAM: %d kBytes\n",
                pScrn->videoRam);
-	
+
     pNv->FbMapSize = pScrn->videoRam * 1024;
 
     /*
@@ -1936,7 +1936,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags)
     clockRanges->clockIndex = -1;		/* programmable */
     clockRanges->doubleScanAllowed = TRUE;
     if((pNv->Architecture == NV_ARCH_20) ||
-         ((pNv->Architecture == NV_ARCH_10) && 
+         ((pNv->Architecture == NV_ARCH_10) &&
            ((pNv->Chipset & 0x0ff0) != 0x0100) &&
            ((pNv->Chipset & 0x0ff0) != 0x0150)))
     {
@@ -2186,7 +2186,7 @@ static Bool
 NVUnmapMem(ScrnInfoPtr pScrn)
 {
     NVPtr pNv;
-    
+
     pNv = NVPTR(pScrn);
 
 #ifdef XSERVER_LIBPCIACCESS
@@ -2202,7 +2202,7 @@ NVUnmapMem(ScrnInfoPtr pScrn)
 
 
 /*
- * Initialise a new mode. 
+ * Initialise a new mode.
  */
 
 static Bool
@@ -2286,7 +2286,7 @@ NVSetModeVBE(ScrnInfoPtr pScrn, DisplayModePtr pMode)
 /*
  * Restore the initial (text) mode.
  */
-static void 
+static void
 NVRestore(ScrnInfoPtr pScrn)
 {
     vgaHWPtr hwp = VGAHWPTR(pScrn);
@@ -2322,8 +2322,8 @@ static void NVBacklightEnable(NVPtr pNv,  Bool on)
        define the ones we know for sure. */
 
 #if defined(__powerpc__)
-    if((pNv->Chipset == 0x10DE0179) || 
-       (pNv->Chipset == 0x10DE0189) || 
+    if((pNv->Chipset == 0x10DE0179) ||
+       (pNv->Chipset == 0x10DE0189) ||
        (pNv->Chipset == 0x10DE0329))
     {
        /* NV17,18,34 Apple iMac, iBook, PowerBook */
@@ -2338,7 +2338,7 @@ static void NVBacklightEnable(NVPtr pNv,  Bool on)
       pNv->PCRTC0[0x081C/4] = tmp_pcrt;
     }
 #endif
-    
+
     if(pNv->LVDS) {
        if(pNv->twoHeads) {
            if((pNv->Chipset & 0x0ff0) != 0x0110) {
@@ -2474,7 +2474,7 @@ NVScreenInit(SCREEN_INIT_ARGS_DECL)
     int width, height, displayWidth, offscreenHeight, shadowHeight;
     BoxRec AvailFBArea;
 
-    /* 
+    /*
      * First get the ScrnInfoRec
      */
     pScrn = xf86ScreenToScrn(pScreen);
@@ -2539,7 +2539,7 @@ NVScreenInit(SCREEN_INIT_ARGS_DECL)
 
     /* Setup the visuals we support. */
 
-    if (!miSetVisualTypes(pScrn->depth, 
+    if (!miSetVisualTypes(pScrn->depth,
                           miGetDefaultVisualMask(pScrn->depth), 8,
                           pScrn->defaultVisual))
 	  return FALSE;
@@ -2613,7 +2613,7 @@ NVScreenInit(SCREEN_INIT_ARGS_DECL)
     }
 
     fbPictureInit (pScreen, 0, 0);
-    
+
     xf86SetBlackWhitePixels(pScreen);
 
     if(!pNv->ShadowFB) /* hardware cursor needs to wrap this layer */
@@ -2629,22 +2629,22 @@ NVScreenInit(SCREEN_INIT_ARGS_DECL)
     AvailFBArea.x2 = pScrn->displayWidth;
     AvailFBArea.y2 = offscreenHeight;
     xf86InitFBManager(pScreen, &AvailFBArea);
-    
+
     if (!pNv->NoAccel)
 	NVAccelInit(pScreen);
-    
+
     xf86SetBackingStore(pScreen);
     xf86SetSilkenMouse(pScreen);
 
-    /* Initialize software cursor.  
+    /* Initialize software cursor.
 	Must precede creation of the default colormap */
     miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
 
-    /* Initialize HW cursor layer. 
+    /* Initialize HW cursor layer.
 	Must follow software cursor initialization*/
-    if (pNv->HWCursor) { 
+    if (pNv->HWCursor) {
 	if(!NVCursorInit(pScreen))
-	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR, 
+	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		"Hardware cursor initialization failed\n");
     }
 
@@ -2652,10 +2652,10 @@ NVScreenInit(SCREEN_INIT_ARGS_DECL)
     if (!miCreateDefColormap(pScreen))
 	return FALSE;
 
-    /* Initialize colormap layer.  
+    /* Initialize colormap layer.
 	Must follow initialization of the default colormap */
     if(!xf86HandleColormaps(pScreen, 256, 8,
-	(pNv->FBDev ? fbdevHWLoadPaletteWeak() : NVDACLoadPalette), 
+	(pNv->FBDev ? fbdevHWLoadPaletteWeak() : NVDACLoadPalette),
 	NULL, CMAP_RELOAD_ON_MODE_SWITCH | CMAP_PALETTED_TRUECOLOR))
 	return FALSE;
 
@@ -2691,7 +2691,7 @@ NVScreenInit(SCREEN_INIT_ARGS_DECL)
        xf86DPMSInit(pScreen, NVDPMSSetLCD, 0);
     else
        xf86DPMSInit(pScreen, NVDPMSSet, 0);
-    
+
     pScrn->memPhysBase = pNv->FbAddress;
     pScrn->fbOffset = 0;
 
diff --git a/src/nv_hw.c b/src/nv_hw.c
index c013220..11a489a 100644
--- a/src/nv_hw.c
+++ b/src/nv_hw.c
@@ -143,7 +143,7 @@ static void nvGetClocks(NVPtr pNv, unsigned int *MClk, unsigned int *NVClk)
        *MClk = ((N * NB * pNv->CrystalFreqKHz) / (M * MB)) >> P;
 
        pll = pNv->PMC[0x4000/4];
-       P = (pll >> 16) & 0x07;  
+       P = (pll >> 16) & 0x07;
        pll = pNv->PMC[0x4004/4];
        M = pll & 0xFF;
        N = (pll >> 8) & 0xFF;
@@ -154,12 +154,12 @@ static void nvGetClocks(NVPtr pNv, unsigned int *MClk, unsigned int *NVClk)
     } else
     if(pNv->twoStagePLL) {
        pll = pNv->PRAMDAC0[0x0504/4];
-       M = pll & 0xFF; 
-       N = (pll >> 8) & 0xFF; 
+       M = pll & 0xFF;
+       N = (pll >> 8) & 0xFF;
        P = (pll >> 16) & 0x0F;
        pll = pNv->PRAMDAC0[0x0574/4];
        if(pll & 0x80000000) {
-           MB = pll & 0xFF; 
+           MB = pll & 0xFF;
            NB = (pll >> 8) & 0xFF;
        } else {
            MB = 1;
@@ -168,8 +168,8 @@ static void nvGetClocks(NVPtr pNv, unsigned int *MClk, unsigned int *NVClk)
        *MClk = ((N * NB * pNv->CrystalFreqKHz) / (M * MB)) >> P;
 
        pll = pNv->PRAMDAC0[0x0500/4];
-       M = pll & 0xFF; 
-       N = (pll >> 8) & 0xFF; 
+       M = pll & 0xFF;
+       N = (pll >> 8) & 0xFF;
        P = (pll >> 16) & 0x0F;
        pll = pNv->PRAMDAC0[0x0570/4];
        if(pll & 0x80000000) {
@@ -180,16 +180,16 @@ static void nvGetClocks(NVPtr pNv, unsigned int *MClk, unsigned int *NVClk)
            NB = 1;
        }
        *NVClk = ((N * NB * pNv->CrystalFreqKHz) / (M * MB)) >> P;
-    } else 
+    } else
     if(((pNv->Chipset & 0x0ff0) == 0x0300) ||
        ((pNv->Chipset & 0x0ff0) == 0x0330))
     {
        pll = pNv->PRAMDAC0[0x0504/4];
-       M = pll & 0x0F; 
+       M = pll & 0x0F;
        N = (pll >> 8) & 0xFF;
        P = (pll >> 16) & 0x07;
        if(pll & 0x00000080) {
-           MB = (pll >> 4) & 0x07;     
+           MB = (pll >> 4) & 0x07;
            NB = (pll >> 19) & 0x1f;
        } else {
            MB = 1;
@@ -211,14 +211,14 @@ static void nvGetClocks(NVPtr pNv, unsigned int *MClk, unsigned int *NVClk)
        *NVClk = ((N * NB * pNv->CrystalFreqKHz) / (M * MB)) >> P;
     } else {
        pll = pNv->PRAMDAC0[0x0504/4];
-       M = pll & 0xFF; 
-       N = (pll >> 8) & 0xFF; 
+       M = pll & 0xFF;
+       N = (pll >> 8) & 0xFF;
        P = (pll >> 16) & 0x0F;
        *MClk = (N * pNv->CrystalFreqKHz / M) >> P;
 
        pll = pNv->PRAMDAC0[0x0500/4];
-       M = pll & 0xFF; 
-       N = (pll >> 8) & 0xFF; 
+       M = pll & 0xFF;
+       N = (pll >> 8) & 0xFF;
        P = (pll >> 16) & 0x0F;
        *NVClk = (N * pNv->CrystalFreqKHz / M) >> P;
     }
@@ -369,8 +369,8 @@ static void nv4CalcArbitration (
 }
 
 static void nv4UpdateArbitrationSettings (
-    unsigned      VClk, 
-    unsigned      pixelDepth, 
+    unsigned      VClk,
+    unsigned      pixelDepth,
     unsigned     *burst,
     unsigned     *lwm,
     NVPtr        pNv
@@ -462,7 +462,7 @@ static void nv10CalcArbitration (
         mclks += 1;
 
     if ((!video_enable) && (arb->memory_width == 128))
-    {  
+    {
       mclk_extra = (bpp == 32) ? 31 : 42; /* Margin of error */
       min_mclk_extra = 17;
     }
@@ -560,7 +560,7 @@ static void nv10CalcArbitration (
       m2us = us_pipe_min + us_min_mclk_extra;
 
       /* pclk cycles to drain */
-      p1clk = m2us * pclk_freq/(1000*1000); 
+      p1clk = m2us * pclk_freq/(1000*1000);
       p2 = p1clk * bpp / 8; /* bytes drained. */
 
       if((p2 < m1) && (m1 > 0)) {
@@ -579,9 +579,9 @@ static void nv10CalcArbitration (
         if (clwm > 1023){ /* Have some margin */
           fifo->valid = 0;
           found = 0;
-          if(min_mclk_extra == 0)   
+          if(min_mclk_extra == 0)
               found = 1; /* Can't adjust anymore! */
-          else 
+          else
               min_mclk_extra--;
         }
       }
@@ -596,8 +596,8 @@ static void nv10CalcArbitration (
 }
 
 static void nv10UpdateArbitrationSettings (
-    unsigned      VClk, 
-    unsigned      pixelDepth, 
+    unsigned      VClk,
+    unsigned      pixelDepth,
     unsigned     *burst,
     unsigned     *lwm,
     NVPtr        pNv
@@ -636,7 +636,7 @@ static void nv30UpdateArbitrationSettings (
     NVPtr        pNv,
     unsigned     *burst,
     unsigned     *lwm
-)   
+)
 {
     unsigned int MClk, NVClk;
     unsigned int fifo_size, burst_size, graphics_lwm;
@@ -646,7 +646,7 @@ static void nv30UpdateArbitrationSettings (
     graphics_lwm = fifo_size - burst_size;
 
     nvGetClocks(pNv, &MClk, &NVClk);
-    
+
     *burst = 0;
     burst_size >>= 5;
     while(burst_size >>= 1) (*burst)++;
@@ -687,7 +687,7 @@ static void nForceUpdateArbitrationSettings (
        unsigned int uMClkPostDiv;
 
        uMClkPostDiv = (READ_LONG(3, 0x6C) >> 8) & 0xf;
-       if(!uMClkPostDiv) uMClkPostDiv = 4; 
+       if(!uMClkPostDiv) uMClkPostDiv = 4;
        MClk = 400000 / uMClkPostDiv;
     } else {
        MClk = READ_LONG(5, 0x4C) / 1000;
@@ -714,7 +714,7 @@ static void nForceUpdateArbitrationSettings (
         if((dimm[0] + dimm[1]) != dimm[2]) {
              ErrorF("WARNING: "
               "your nForce DIMMs are not arranged in optimal banks!\n");
-        } 
+        }
     }
 
     sim_data.mem_latency    = 3;
@@ -757,11 +757,11 @@ static void CalcVClock (
     unsigned DeltaNew, DeltaOld;
     unsigned VClk, Freq;
     unsigned M, N, P;
-    
+
     DeltaOld = 0xFFFFFFFF;
 
     VClk = (unsigned)clockIn;
-    
+
     if (pNv->CrystalFreqKHz == 13500) {
         lowM  = 7;
         highM = 13;
@@ -833,7 +833,7 @@ static void CalcVClock2Stage (
 }
 
 /*
- * Calculate extended mode parameters (SVGA) and save in a 
+ * Calculate extended mode parameters (SVGA) and save in a
  * mode state structure.
  */
 void NVCalcStateExt (
@@ -844,7 +844,7 @@ void NVCalcStateExt (
     int            hDisplaySize,
     int            height,
     int            dotClock,
-    int		   flags 
+    int		   flags
 )
 {
     int pixelDepth, VClk = 0;
@@ -866,8 +866,8 @@ void NVCalcStateExt (
     switch (pNv->Architecture)
     {
         case NV_ARCH_04:
-            nv4UpdateArbitrationSettings(VClk, 
-                                         pixelDepth * 8, 
+            nv4UpdateArbitrationSettings(VClk,
+                                         pixelDepth * 8,
                                         &(state->arbitration0),
                                         &(state->arbitration1),
                                          pNv);
@@ -893,8 +893,8 @@ void NVCalcStateExt (
                ((pNv->Chipset & 0xfff0) == 0x03D0) ||
                ((pNv->Chipset & 0xfff0) == 0x0530))
             {
-                state->arbitration0 = 128; 
-                state->arbitration1 = 0x0480; 
+                state->arbitration0 = 128;
+                state->arbitration1 = 0x0480;
             } else
             if(((pNv->Chipset & 0xffff) == 0x01A0) ||
                ((pNv->Chipset & 0xffff) == 0x01f0))
@@ -905,8 +905,8 @@ void NVCalcStateExt (
                                          &(state->arbitration1),
                                           pNv);
             } else if(pNv->Architecture < NV_ARCH_30) {
-                nv10UpdateArbitrationSettings(VClk, 
-                                          pixelDepth * 8, 
+                nv10UpdateArbitrationSettings(VClk,
+                                          pixelDepth * 8,
                                          &(state->arbitration0),
                                          &(state->arbitration1),
                                           pNv);
@@ -918,7 +918,7 @@ void NVCalcStateExt (
             state->cursor0  = 0x80 | (pNv->CursorStart >> 17);
             state->cursor1  = (pNv->CursorStart >> 11) << 2;
 	    state->cursor2  = pNv->CursorStart >> 24;
-	    if (flags & V_DBLSCAN) 
+	    if (flags & V_DBLSCAN)
 		state->cursor1 |= 2;
             state->pllsel   = 0x10000700;
             state->config   = pNv->PFB[0x00000200/4];
@@ -954,7 +954,7 @@ void NVLoadStateExt (
     if(pNv->Architecture == NV_ARCH_04) {
         if (state)
             pNv->PFB[0x0200/4] = state->config;
-    } else 
+    } else
     if((pNv->Architecture < NV_ARCH_40) ||
        ((pNv->Chipset & 0xfff0) == 0x0040))
     {
@@ -973,7 +973,7 @@ void NVLoadStateExt (
         {
            regions = 15;
         }
- 
+
        for(i = 0; i < regions; i++) {
           pNv->PFB[(0x0600 + (i * 0x10))/4] = 0;
           pNv->PFB[(0x0604 + (i * 0x10))/4] = pNv->FbMapSize - 1;
@@ -1060,15 +1060,15 @@ void NVLoadStateExt (
        pNv->PRAMIN[0x082A] |= 0x01000000;
        pNv->PRAMIN[0x0832] |= 0x01000000;
        pNv->PRAMIN[0x083A] |= 0x01000000;
-       pNv->PRAMIN[0x0842] |= 0x01000000;  
+       pNv->PRAMIN[0x0842] |= 0x01000000;
        pNv->PRAMIN[0x0819] = 0x01000000;
        pNv->PRAMIN[0x0839] = 0x01000000;
 #endif
     } else {
        pNv->PRAMIN[0x0000] = 0x80000010;
-       pNv->PRAMIN[0x0001] = 0x80011201;  
+       pNv->PRAMIN[0x0001] = 0x80011201;
        pNv->PRAMIN[0x0002] = 0x80000011;
-       pNv->PRAMIN[0x0003] = 0x80011202; 
+       pNv->PRAMIN[0x0003] = 0x80011202;
        pNv->PRAMIN[0x0004] = 0x80000012;
        pNv->PRAMIN[0x0005] = 0x80011203;
        pNv->PRAMIN[0x0006] = 0x80000013;
@@ -1161,7 +1161,7 @@ void NVLoadStateExt (
        pNv->PGRAPH[0x0720/4] = 0x00000001;
 
        pNv->PGRAPH[0x0810/4] = 0x00000000;
-       pNv->PGRAPH[0x0608/4] = 0xFFFFFFFF; 
+       pNv->PGRAPH[0x0608/4] = 0xFFFFFFFF;
     } else {
        pNv->PGRAPH[0x0080/4] = 0xFFFFFFFF;
        pNv->PGRAPH[0x0080/4] = 0x00000000;
@@ -1258,7 +1258,7 @@ void NVLoadStateExt (
 
               pNv->PGRAPH[0x0b38/4] = 0x2ffff800;
               pNv->PGRAPH[0x0b3c/4] = 0x00006000;
-              pNv->PGRAPH[0x032C/4] = 0x01000000; 
+              pNv->PGRAPH[0x032C/4] = 0x01000000;
               pNv->PGRAPH[0x0220/4] = 0x00001200;
            } else
            if(pNv->Architecture == NV_ARCH_30) {
@@ -1277,15 +1277,15 @@ void NVLoadStateExt (
 
               if((pNv->Chipset & 0x0ff0) >= 0x0250) {
                  pNv->PGRAPH[0x0890/4] = 0x00080000;
-                 pNv->PGRAPH[0x0610/4] = 0x304B1FB6; 
-                 pNv->PGRAPH[0x0B80/4] = 0x18B82880; 
-                 pNv->PGRAPH[0x0B84/4] = 0x44000000; 
-                 pNv->PGRAPH[0x0098/4] = 0x40000080; 
-                 pNv->PGRAPH[0x0B88/4] = 0x000000ff; 
+                 pNv->PGRAPH[0x0610/4] = 0x304B1FB6;
+                 pNv->PGRAPH[0x0B80/4] = 0x18B82880;
+                 pNv->PGRAPH[0x0B84/4] = 0x44000000;
+                 pNv->PGRAPH[0x0098/4] = 0x40000080;
+                 pNv->PGRAPH[0x0B88/4] = 0x000000ff;
               } else {
                  pNv->PGRAPH[0x0880/4] = 0x00080000;
                  pNv->PGRAPH[0x0094/4] = 0x00000005;
-                 pNv->PGRAPH[0x0B80/4] = 0x45CAA208; 
+                 pNv->PGRAPH[0x0B80/4] = 0x45CAA208;
                  pNv->PGRAPH[0x0B84/4] = 0x24000000;
                  pNv->PGRAPH[0x0098/4] = 0x00000040;
                  pNv->PGRAPH[0x0750/4] = 0x00E00038;
@@ -1296,7 +1296,7 @@ void NVLoadStateExt (
            }
 
            if((pNv->Architecture < NV_ARCH_40) ||
-              ((pNv->Chipset & 0xfff0) == 0x0040)) 
+              ((pNv->Chipset & 0xfff0) == 0x0040))
            {
               for(i = 0; i < 32; i++) {
                 pNv->PGRAPH[(0x0900/4) + i] = pNv->PFB[(0x0240/4) + i];
@@ -1342,7 +1342,7 @@ void NVLoadStateExt (
                  if(((pNv->Chipset & 0xfff0) == 0x0090) ||
                     ((pNv->Chipset & 0xfff0) == 0x01D0) ||
                     ((pNv->Chipset & 0xfff0) == 0x0290) ||
-                    ((pNv->Chipset & 0xfff0) == 0x0390)) 
+                    ((pNv->Chipset & 0xfff0) == 0x0390))
                  {
                     pNv->PGRAPH[0x0DF0/4] = pNv->PFB[0x0200/4];
                     pNv->PGRAPH[0x0DF4/4] = pNv->PFB[0x0204/4];
@@ -1429,7 +1429,7 @@ void NVLoadStateExt (
            pNv->PCRTC0[0x2860/4] = state->head2;
         }
         pNv->PRAMDAC[0x0404/4] |= (1 << 25);
-    
+
         pNv->PMC[0x8704/4] = 1;
         pNv->PMC[0x8140/4] = 0;
         pNv->PMC[0x8920/4] = 0;
@@ -1441,15 +1441,15 @@ void NVLoadStateExt (
         pNv->PCRTC[0x0810/4] = state->cursorConfig;
         pNv->PCRTC[0x0830/4] = state->displayV - 3;
         pNv->PCRTC[0x0834/4] = state->displayV - 1;
-    
+
         if(pNv->FlatPanel) {
            if((pNv->Chipset & 0x0ff0) == 0x0110) {
                pNv->PRAMDAC[0x0528/4] = state->dither;
-           } else 
+           } else
            if(pNv->twoHeads) {
                pNv->PRAMDAC[0x083C/4] = state->dither;
            }
-    
+
            VGA_WR08(pNv->PCIO, 0x03D4, 0x53);
            VGA_WR08(pNv->PCIO, 0x03D5, state->timingH);
            VGA_WR08(pNv->PCIO, 0x03D4, 0x54);
@@ -1580,7 +1580,7 @@ void NVUnloadStateExt
 
         if((pNv->Chipset & 0x0ff0) == 0x0110) {
            state->dither = pNv->PRAMDAC[0x0528/4];
-        } else 
+        } else
         if(pNv->twoHeads) {
             state->dither = pNv->PRAMDAC[0x083C/4];
         }
diff --git a/src/nv_local.h b/src/nv_local.h
index 8ff8aa1..cc2c50c 100644
--- a/src/nv_local.h
+++ b/src/nv_local.h
@@ -28,7 +28,7 @@
  * This file includes any environment or machine specific values to access the
  * HW.  Put all affected includes, typdefs, etc. here so the riva_hw.* files
  * can stay generic in nature.
- */ 
+ */
 #include "compiler.h"
 #include "xf86_OSproc.h"
 
diff --git a/src/nv_setup.c b/src/nv_setup.c
index 77f6c4a..616aa9d 100644
--- a/src/nv_setup.c
+++ b/src/nv_setup.c
@@ -159,7 +159,7 @@ static CARD8 NVReadDacData(vgaHWPtr pVga)
     return (VGA_RD08(pNv->PDIO, VGA_DAC_DATA));
 }
 
-static Bool 
+static Bool
 NVIsConnected (ScrnInfoPtr pScrn, int output)
 {
     NVPtr pNv = NVPTR(pScrn);
@@ -168,7 +168,7 @@ NVIsConnected (ScrnInfoPtr pScrn, int output)
     Bool present;
 
     xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-               "Probing for analog device on output %s...\n", 
+               "Probing for analog device on output %s...\n",
                 output ? "B" : "A");
 
     if(output) {
@@ -224,7 +224,7 @@ NVSelectHeadRegisters(ScrnInfoPtr pScrn, int head)
     }
 }
 
-static xf86MonPtr 
+static xf86MonPtr
 NVProbeDDC (ScrnInfoPtr pScrn, int bus)
 {
     NVPtr pNv = NVPTR(pScrn);
@@ -234,7 +234,7 @@ NVProbeDDC (ScrnInfoPtr pScrn, int bus)
 
     pNv->DDCBase = bus ? 0x36 : 0x3e;
 
-    xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
+    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                "Probing for EDID on I2C bus %s...\n", bus ? "B" : "A");
 
 #ifdef EDID_COMPLETE_RAWDATA
@@ -268,7 +268,7 @@ NVProbeDDC (ScrnInfoPtr pScrn, int bus)
                   "DFP" : "CRT");
        xf86PrintEDID( MonInfo );
     } else {
-       xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
+       xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                   "  ... none found\n");
     }
 
@@ -348,7 +348,7 @@ static void nv10GetConfig (NVPtr pNv)
         pNv->RamAmountKBytes = 256*1024;
 
     pNv->CrystalFreqKHz = (pNv->PEXTDEV[0x0000/4] & (1 << 6)) ? 14318 : 13500;
-    
+
     if(pNv->twoHeads && (implementation != 0x0110))
     {
        if(pNv->PEXTDEV[0x0000/4] & (1 << 22))
@@ -533,7 +533,7 @@ NVCommonSetup(ScrnInfoPtr pScrn)
            VGA_WR08(pNv->PCIO, 0x03D4, 0x28);
            if(VGA_RD08(pNv->PCIO, 0x03D5) & 0x80) {
               VGA_WR08(pNv->PCIO, 0x03D4, 0x33);
-              if(!(VGA_RD08(pNv->PCIO, 0x03D5) & 0x01)) 
+              if(!(VGA_RD08(pNv->PCIO, 0x03D5) & 0x01))
                  Television = TRUE;
               FlatPanel = 1;
            } else {
@@ -542,14 +542,14 @@ NVCommonSetup(ScrnInfoPtr pScrn)
            xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
                          "HW is currently programmed for %s\n",
                           FlatPanel ? (Television ? "TV" : "DFP") : "CRT");
-       } 
+       }
 
        if(pNv->FlatPanel == -1) {
            pNv->FlatPanel = FlatPanel;
            pNv->Television = Television;
        } else {
            xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
-                      "Forcing display type to %s as specified\n", 
+                      "Forcing display type to %s as specified\n",
                        pNv->FlatPanel ? "DFP" : "CRT");
        }
     } else {
@@ -559,11 +559,11 @@ NVCommonSetup(ScrnInfoPtr pScrn)
        Bool analog_on_A, analog_on_B;
        CARD32 oldhead;
        CARD8 cr44;
-      
+
        if(implementation != 0x0110) {
            if(pNv->PRAMDAC0[0x0000052C/4] & 0x100)
                outputAfromCRTC = 1;
-           else            
+           else
                outputAfromCRTC = 0;
            if(pNv->PRAMDAC0[0x0000252C/4] & 0x100)
                outputBfromCRTC = 1;
@@ -598,7 +598,7 @@ NVCommonSetup(ScrnInfoPtr pScrn)
        NVLockUnlock(pNv, 0);
 
        VGA_WR08(pNv->PCIO, 0x03D4, 0x28);
-       slaved_on_A = VGA_RD08(pNv->PCIO, 0x03D5) & 0x80; 
+       slaved_on_A = VGA_RD08(pNv->PCIO, 0x03D5) & 0x80;
        if(slaved_on_A) {
            VGA_WR08(pNv->PCIO, 0x03D4, 0x33);
            tvA = !(VGA_RD08(pNv->PCIO, 0x03D5) & 0x01);
@@ -615,7 +615,7 @@ NVCommonSetup(ScrnInfoPtr pScrn)
           FlatPanel = 1;
           xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
                     "CRTC 0 is currently programmed for DFP\n");
-       } else 
+       } else
        if(slaved_on_B && !tvB) {
           CRTCnumber = 1;
           FlatPanel = 1;
@@ -650,7 +650,7 @@ NVCommonSetup(ScrnInfoPtr pScrn)
        } else
        if(monitorA) {
            FlatPanel = monitorA->features.input_type ? 1 : 0;
-       } else 
+       } else
        if(monitorB) {
            FlatPanel = monitorB->features.input_type ? 1 : 0;
        }
@@ -674,7 +674,7 @@ NVCommonSetup(ScrnInfoPtr pScrn)
           }
        } else {
            xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
-                      "Forcing display type to %s as specified\n", 
+                      "Forcing display type to %s as specified\n",
                        pNv->FlatPanel ? "DFP" : "CRT");
        }
 
@@ -692,12 +692,12 @@ NVCommonSetup(ScrnInfoPtr pScrn)
            xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
                       "Forcing CRTCNumber %i as specified\n", pNv->CRTCnumber);
        }
-     
+
        if(monitorA) {
            if((monitorA->features.input_type && pNv->FlatPanel) ||
               (!monitorA->features.input_type && !pNv->FlatPanel))
            {
-               if(monitorB) { 
+               if(monitorB) {
                   free(monitorB);
                   monitorB = NULL;
                }
@@ -709,7 +709,7 @@ NVCommonSetup(ScrnInfoPtr pScrn)
 
        if(monitorB) {
            if((monitorB->features.input_type && !pNv->FlatPanel) ||
-              (!monitorB->features.input_type && pNv->FlatPanel)) 
+              (!monitorB->features.input_type && pNv->FlatPanel))
            {
               free(monitorB);
            } else {
@@ -730,7 +730,7 @@ NVCommonSetup(ScrnInfoPtr pScrn)
 
     xf86DrvMsg(pScrn->scrnIndex, X_INFO,
               "Using %s on CRTC %i\n",
-              pNv->FlatPanel ? (pNv->Television ? "TV" : "DFP") : "CRT", 
+              pNv->FlatPanel ? (pNv->Television ? "TV" : "DFP") : "CRT",
               pNv->CRTCnumber);
 
     if(pNv->FlatPanel && !pNv->Television) {
@@ -757,7 +757,7 @@ NVCommonSetup(ScrnInfoPtr pScrn)
         pNv->PRAMDAC0[0x08B0/4] = 0x00010004;
         if(pNv->PRAMDAC0[0x08B4/4] & 1)
            pNv->LVDS = TRUE;
-        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel is %s\n", 
+        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel is %s\n",
                    pNv->LVDS ? "LVDS" : "TMDS");
     }
 }
diff --git a/src/nv_shadow.c b/src/nv_shadow.c
index 58db331..a9f791b 100644
--- a/src/nv_shadow.c
+++ b/src/nv_shadow.c
@@ -1,5 +1,5 @@
 /*
-   Copyright (c) 1999,  The XFree86 Project Inc. 
+   Copyright (c) 1999,  The XFree86 Project Inc.
    Written by Mark Vojkovich <markv at valinux.com>
 */
 
@@ -31,14 +31,14 @@ NVRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
     NVPtr pNv = NVPTR(pScrn);
     int width, height, Bpp, FBPitch;
     unsigned char *src, *dst;
-   
+
     Bpp = pScrn->bitsPerPixel >> 3;
     FBPitch = BitmapBytePad(pScrn->displayWidth * pScrn->bitsPerPixel);
 
     while(num--) {
 	width = (pbox->x2 - pbox->x1) * Bpp;
 	height = pbox->y2 - pbox->y1;
-	src = pNv->ShadowPtr + (pbox->y1 * pNv->ShadowPitch) + 
+	src = pNv->ShadowPtr + (pbox->y1 * pNv->ShadowPitch) +
 						(pbox->x1 * Bpp);
 	dst = pNv->FbStart + (pbox->y1 * FBPitch) + (pbox->x1 * Bpp);
 
@@ -47,10 +47,10 @@ NVRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
 	    dst += FBPitch;
 	    src += pNv->ShadowPitch;
 	}
-	
+
 	pbox++;
     }
-} 
+}
 
 void
 NVPointerMoved(SCRN_ARG_TYPE arg, int x, int y)
@@ -93,11 +93,11 @@ NVRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
 	height = (y2 - y1) >> 2;  /* in dwords */
 
 	if(pNv->Rotate == 1) {
-	    dstPtr = pNv->FbStart + 
+	    dstPtr = pNv->FbStart +
 			(pbox->x1 * dstPitch) + pScrn->virtualX - y2;
 	    srcPtr = pNv->ShadowPtr + ((1 - y2) * srcPitch) + pbox->x1;
 	} else {
-	    dstPtr = pNv->FbStart + 
+	    dstPtr = pNv->FbStart +
 			((pScrn->virtualY - pbox->x2) * dstPitch) + y1;
 	    srcPtr = pNv->ShadowPtr + (y1 * srcPitch) + pbox->x2 - 1;
 	}
@@ -107,8 +107,8 @@ NVRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
 	    dst = (CARD32*)dstPtr;
 	    count = height;
 	    while(count--) {
-		*(dst++) = src[0] | (src[srcPitch] << 8) | 
-					(src[srcPitch * 2] << 16) | 
+		*(dst++) = src[0] | (src[srcPitch] << 8) |
+					(src[srcPitch * 2] << 16) |
 					(src[srcPitch * 3] << 24);
 		src += srcPitch * 4;
 	    }
@@ -118,7 +118,7 @@ NVRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
 
 	pbox++;
     }
-} 
+}
 
 
 void
@@ -144,14 +144,14 @@ NVRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
 	height = (y2 - y1) >> 1;  /* in dwords */
 
 	if(pNv->Rotate == 1) {
-	    dstPtr = (CARD16*)pNv->FbStart + 
+	    dstPtr = (CARD16*)pNv->FbStart +
 			(pbox->x1 * dstPitch) + pScrn->virtualX - y2;
-	    srcPtr = (CARD16*)pNv->ShadowPtr + 
+	    srcPtr = (CARD16*)pNv->ShadowPtr +
 			((1 - y2) * srcPitch) + pbox->x1;
 	} else {
-	    dstPtr = (CARD16*)pNv->FbStart + 
+	    dstPtr = (CARD16*)pNv->FbStart +
 			((pScrn->virtualY - pbox->x2) * dstPitch) + y1;
-	    srcPtr = (CARD16*)pNv->ShadowPtr + 
+	    srcPtr = (CARD16*)pNv->ShadowPtr +
 			(y1 * srcPitch) + pbox->x2 - 1;
 	}
 
@@ -192,14 +192,14 @@ NVRefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
 	height = pbox->y2 - pbox->y1;
 
 	if(pNv->Rotate == 1) {
-	    dstPtr = (CARD32*)pNv->FbStart + 
+	    dstPtr = (CARD32*)pNv->FbStart +
 			(pbox->x1 * dstPitch) + pScrn->virtualX - pbox->y2;
-	    srcPtr = (CARD32*)pNv->ShadowPtr + 
+	    srcPtr = (CARD32*)pNv->ShadowPtr +
 			((1 - pbox->y2) * srcPitch) + pbox->x1;
 	} else {
-	    dstPtr = (CARD32*)pNv->FbStart + 
+	    dstPtr = (CARD32*)pNv->FbStart +
 			((pScrn->virtualY - pbox->x2) * dstPitch) + pbox->y1;
-	    srcPtr = (CARD32*)pNv->ShadowPtr + 
+	    srcPtr = (CARD32*)pNv->ShadowPtr +
 			(pbox->y1 * srcPitch) + pbox->x2 - 1;
 	}
 
diff --git a/src/nv_video.c b/src/nv_video.c
index 6600aa7..664cf71 100644
--- a/src/nv_video.c
+++ b/src/nv_video.c
@@ -93,13 +93,13 @@ static void NVInitOffscreenImages (ScreenPtr pScreen);
 
 #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
 
-static Atom xvBrightness, xvContrast, xvColorKey, xvSaturation, 
+static Atom xvBrightness, xvContrast, xvColorKey, xvSaturation,
             xvHue, xvAutopaintColorKey, xvSetDefaults, xvDoubleBuffer,
             xvITURBT709, xvSyncToVBlank;
 
 /* client libraries expect an encoding */
 static XF86VideoEncodingRec DummyEncoding =
-{ 
+{
    0,
    "XV_IMAGE",
    2046, 2046,
@@ -108,7 +108,7 @@ static XF86VideoEncodingRec DummyEncoding =
 
 #define NUM_FORMATS_ALL 6
 
-XF86VideoFormatRec NVFormats[NUM_FORMATS_ALL] = 
+XF86VideoFormatRec NVFormats[NUM_FORMATS_ALL] =
 {
    {15, TrueColor}, {16, TrueColor}, {24, TrueColor},
    {15, DirectColor}, {16, DirectColor}, {24, DirectColor}
@@ -168,7 +168,7 @@ static XF86ImageRec NVImages[NUM_IMAGES_ALL] =
     XVIMAGE_RGB
 };
 
-static void 
+static void
 NVSetPortDefaults (ScrnInfoPtr pScrnInfo, NVPortPrivPtr pPriv)
 {
     NVPtr pNv = NVPTR(pScrnInfo);
@@ -184,23 +184,23 @@ NVSetPortDefaults (ScrnInfoPtr pScrnInfo, NVPortPrivPtr pPriv)
 }
 
 
-void 
+void
 NVResetVideo (ScrnInfoPtr pScrnInfo)
 {
     NVPtr          pNv     = NVPTR(pScrnInfo);
     NVPortPrivPtr  pPriv   = GET_OVERLAY_PRIVATE(pNv);
     int            satSine, satCosine;
     double         angle;
-    
+
     angle = (double)pPriv->hue * 3.1415927 / 180.0;
-    
+
     satSine = pPriv->saturation * sin(angle);
     if (satSine < -1024)
         satSine = -1024;
     satCosine = pPriv->saturation * cos(angle);
     if (satCosine < -1024)
         satCosine = -1024;
-    
+
     pNv->PMC[0x8910/4] = (pPriv->brightness << 16) | pPriv->contrast;
     pNv->PMC[0x8914/4] = (pPriv->brightness << 16) | pPriv->contrast;
     pNv->PMC[0x8918/4] = (satSine << 16) | (satCosine & 0xffff);
@@ -210,7 +210,7 @@ NVResetVideo (ScrnInfoPtr pScrnInfo)
 
 
 
-static void 
+static void
 NVStopOverlay (ScrnInfoPtr pScrnInfo)
 {
     NVPtr          pNv     = NVPTR(pScrnInfo);
@@ -228,9 +228,9 @@ NVAllocateOverlayMemory(
    FBLinearPtr new_linear;
 
    if(linear) {
-        if(linear->size >= size) 
+        if(linear->size >= size)
            return linear;
-        
+
         if(xf86ResizeOffscreenLinear(linear, size))
            return linear;
 
@@ -239,20 +239,20 @@ NVAllocateOverlayMemory(
 
    pScreen = xf86ScrnToScreen(pScrn);
 
-   new_linear = xf86AllocateOffscreenLinear(pScreen, size, 32, 
+   new_linear = xf86AllocateOffscreenLinear(pScreen, size, 32,
                                                 NULL, NULL, NULL);
 
    if(!new_linear) {
         int max_size;
 
-        xf86QueryLargestOffscreenLinear(pScreen, &max_size, 32, 
+        xf86QueryLargestOffscreenLinear(pScreen, &max_size, 32,
                                                 PRIORITY_EXTREME);
-        
+
         if(max_size < size)
            return NULL;
 
         xf86PurgeUnlockedOffscreenAreas(pScreen);
-        new_linear = xf86AllocateOffscreenLinear(pScreen, size, 32, 
+        new_linear = xf86AllocateOffscreenLinear(pScreen, size, 32,
                                                 NULL, NULL, NULL);
    }
 
@@ -293,11 +293,11 @@ void NVInitVideo (ScreenPtr pScreen)
     int 		num_adaptors;
 
     if((pScrn->bitsPerPixel != 8) && (pNv->Architecture >= NV_ARCH_10) &&
-         ((pNv->Architecture <= NV_ARCH_30) || 
+         ((pNv->Architecture <= NV_ARCH_30) ||
             ((pNv->Chipset & 0xfff0) == 0x0040)))
     {
 	overlayAdaptor = NVSetupOverlayVideo(pScreen);
-  
+
 	if(overlayAdaptor)
 	    NVInitOffscreenImages(pScreen);
     }
@@ -306,7 +306,7 @@ void NVInitVideo (ScreenPtr pScreen)
         blitAdaptor = NVSetupBlitVideo(pScreen);
 
     num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors);
-    
+
     if(blitAdaptor || overlayAdaptor) {
         int size = num_adaptors;
 
@@ -334,7 +334,7 @@ void NVInitVideo (ScreenPtr pScreen)
         xf86XVScreenInit(pScreen, adaptors, num_adaptors);
 
     if (newAdaptors)
-	free(newAdaptors);    
+	free(newAdaptors);
 }
 
 
@@ -401,20 +401,20 @@ NVSetupBlitVideo (ScreenPtr pScreen)
     return adapt;
 }
 
-static XF86VideoAdaptorPtr 
+static XF86VideoAdaptorPtr
 NVSetupOverlayVideo (ScreenPtr pScreen)
 {
     ScrnInfoPtr pScrnInfo = xf86ScreenToScrn(pScreen);
     NVPtr       pNv       = NVPTR(pScrnInfo);
     XF86VideoAdaptorPtr adapt;
     NVPortPrivPtr       pPriv;
-    
+
     if (!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) +
-                             sizeof(NVPortPrivRec) + 
+                             sizeof(NVPortPrivRec) +
                              sizeof(DevUnion))))
     {
         return NULL;
-    } 
+    }
 
     adapt->type                 = XvWindowMask | XvInputMask | XvImageMask;
     adapt->flags                = VIDEO_OVERLAID_IMAGES|VIDEO_CLIP_TO_VIEWPORT;
@@ -441,19 +441,19 @@ NVSetupOverlayVideo (ScreenPtr pScreen)
     adapt->QueryBestSize        = NVQueryBestSize;
     adapt->PutImage             = NVPutImage;
     adapt->QueryImageAttributes = NVQueryImageAttributes;
-    
+
     pPriv->videoStatus		= 0;
     pPriv->currentBuffer	= 0;
     pPriv->grabbedByV4L		= FALSE;
     pPriv->blitter              = FALSE;
 
     NVSetPortDefaults (pScrnInfo, pPriv);
-    
+
     /* gotta uninit this someplace */
     REGION_NULL(pScreen, &pPriv->clip);
-    
+
     pNv->overlayAdaptor		= adapt;
-    
+
     xvBrightness        = MAKE_ATOM("XV_BRIGHTNESS");
     xvDoubleBuffer      = MAKE_ATOM("XV_DOUBLE_BUFFER");
     xvContrast          = MAKE_ATOM("XV_CONTRAST");
@@ -494,7 +494,7 @@ NVPutOverlayImage (
     int buffer = pPriv->currentBuffer;
 
     /* paint the color key */
-    if(pPriv->autopaintColorKey && 
+    if(pPriv->autopaintColorKey &&
        (pPriv->grabbedByV4L ||
 	!REGION_EQUAL(pScrnInfo->pScreen, &pPriv->clip, clipBoxes)))
     {
@@ -608,7 +608,7 @@ NVPutBlitImage (
        NVDmaNext (pNv, 0);
 
        NVDmaStart(pNv, STRETCH_BLIT_CLIP_POINT, 6);
-       NVDmaNext (pNv, (pbox->y1 << 16) | pbox->x1); 
+       NVDmaNext (pNv, (pbox->y1 << 16) | pbox->x1);
        NVDmaNext (pNv, ((pbox->y2 - pbox->y1) << 16) | (pbox->x2 - pbox->x1));
        NVDmaNext (pNv, point);
        NVDmaNext (pNv, size);
@@ -651,18 +651,18 @@ static void NVStopOverlayVideo
     NVPortPrivPtr pPriv = (NVPortPrivPtr)data;
 
     if(pPriv->grabbedByV4L) return;
-    
-    REGION_EMPTY(pScrnInfo->pScreen, &pPriv->clip);   
+
+    REGION_EMPTY(pScrnInfo->pScreen, &pPriv->clip);
 
     if(Exit) {
-	if(pPriv->videoStatus & CLIENT_VIDEO_ON) 
+	if(pPriv->videoStatus & CLIENT_VIDEO_ON)
             NVStopOverlay(pScrnInfo);
 	NVFreeOverlayMemory(pScrnInfo);
 	pPriv->videoStatus = 0;
-    } else { 
+    } else {
 	if(pPriv->videoStatus & CLIENT_VIDEO_ON) {
 	    pPriv->videoStatus = OFF_TIMER | CLIENT_VIDEO_ON;
-	    pPriv->videoTime = currentTime.milliseconds + OFF_DELAY; 
+	    pPriv->videoTime = currentTime.milliseconds + OFF_DELAY;
 	    pNv->VideoTimerCallback = NVVideoTimerCallback;
 	}
     }
@@ -679,14 +679,14 @@ static void NVStopBlitVideo
 
 static int NVSetOverlayPortAttribute
 (
-    ScrnInfoPtr pScrnInfo, 
+    ScrnInfoPtr pScrnInfo,
     Atom        attribute,
-    INT32       value, 
+    INT32       value,
     pointer     data
 )
 {
     NVPortPrivPtr pPriv = (NVPortPrivPtr)data;
-    
+
     if (attribute == xvBrightness)
     {
         if ((value < -512) || (value > 512))
@@ -721,7 +721,7 @@ static int NVSetOverlayPortAttribute
     else if (attribute == xvColorKey)
     {
         pPriv->colorKey = value;
-        REGION_EMPTY(pScrnInfo->pScreen, &pPriv->clip);   
+        REGION_EMPTY(pScrnInfo->pScreen, &pPriv->clip);
     }
     else if (attribute == xvAutopaintColorKey)
     {
@@ -741,7 +741,7 @@ static int NVSetOverlayPortAttribute
     }
     else
         return BadMatch;
-    
+
     NVResetVideo(pScrnInfo);
     return Success;
 }
@@ -749,14 +749,14 @@ static int NVSetOverlayPortAttribute
 
 static int NVGetOverlayPortAttribute
 (
-    ScrnInfoPtr  pScrnInfo, 
+    ScrnInfoPtr  pScrnInfo,
     Atom         attribute,
-    INT32       *value, 
+    INT32       *value,
     pointer      data
 )
 {
     NVPortPrivPtr pPriv = (NVPortPrivPtr)data;
-    
+
     if (attribute == xvBrightness)
         *value = pPriv->brightness;
     else if (attribute == xvDoubleBuffer)
@@ -775,7 +775,7 @@ static int NVGetOverlayPortAttribute
         *value = (pPriv->iturbt_709) ? 1 : 0;
     else
         return BadMatch;
-    
+
     return Success;
 }
 
@@ -789,7 +789,7 @@ static int NVSetBlitPortAttribute
 {
     NVPortPrivPtr pPriv = (NVPortPrivPtr)data;
     NVPtr pNv = NVPTR(pScrnInfo);
-    
+
     if ((attribute == xvSyncToVBlank) && pNv->WaitVSyncPossible) {
         if ((value < 0) || (value > 1))
             return BadValue;
@@ -827,14 +827,14 @@ static int NVGetBlitPortAttribute
  */
 static void NVQueryBestSize
 (
-    ScrnInfoPtr   pScrnInfo, 
+    ScrnInfoPtr   pScrnInfo,
     Bool          motion,
     short         vid_w,
-    short         vid_h, 
+    short         vid_h,
     short         drw_w,
-    short         drw_h, 
+    short         drw_h,
     unsigned int *p_w,
-    unsigned int *p_h, 
+    unsigned int *p_h,
     pointer       data
 )
 {
@@ -844,7 +844,7 @@ static void NVQueryBestSize
 	drw_h = vid_h >> 3;
 
     *p_w = drw_w;
-    *p_h = drw_h; 
+    *p_h = drw_h;
 }
 
 static void NVCopyData420
@@ -985,20 +985,20 @@ static void NVCopyDataRGB
  * PutImage
  */
 static int NVPutImage
-( 
-    ScrnInfoPtr  pScrnInfo, 
+(
+    ScrnInfoPtr  pScrnInfo,
     short        src_x,
-    short        src_y, 
+    short        src_y,
     short        drw_x,
     short        drw_y,
     short        src_w,
-    short        src_h, 
+    short        src_h,
     short        drw_w,
     short        drw_h,
     int          id,
-    unsigned char *buf, 
+    unsigned char *buf,
     short        width,
-    short        height, 
+    short        height,
     Bool         Sync,
     RegionPtr    clipBoxes,
     pointer      data,
@@ -1031,7 +1031,7 @@ static int NVPutImage
 
     /* make the compiler happy */
     s2offset = s3offset = srcPitch2 = 0;
-    
+
     if(!pPriv->blitter) {
        if(src_w > (drw_w << 3))
           drw_w = src_w >> 3;
@@ -1044,16 +1044,16 @@ static int NVPutImage
     xb = src_x + src_w;
     ya = src_y;
     yb = src_y + src_h;
-    
+
     dstBox.x1 = drw_x;
     dstBox.x2 = drw_x + drw_w;
     dstBox.y1 = drw_y;
     dstBox.y2 = drw_y + drw_h;
-    
-    if(!xf86XVClipVideoHelper(&dstBox, &xa, &xb, &ya, &yb, clipBoxes, 
+
+    if(!xf86XVClipVideoHelper(&dstBox, &xa, &xb, &ya, &yb, clipBoxes,
                               width, height))
     	return Success;
-    
+
     if(!pPriv->blitter) {
         dstBox.x1 -= pScrnInfo->frameX0;
         dstBox.x2 -= pScrnInfo->frameX0;
@@ -1090,8 +1090,8 @@ static int NVPutImage
     if(pPriv->doubleBuffer)
 	newSize <<= 1;
 
-    pPriv->linear = NVAllocateOverlayMemory(pScrnInfo, 
-					    pPriv->linear, 
+    pPriv->linear = NVAllocateOverlayMemory(pScrnInfo,
+					    pPriv->linear,
 					    newSize);
 
     if(!pPriv->linear) return BadAlloc;
@@ -1110,15 +1110,15 @@ static int NVPutImage
            if(!pPriv->currentBuffer)
               offset += (newSize * bpp) >> 1;
            skip = TRUE;
-        } else 
+        } else
 #endif
         if(pPriv->currentBuffer)
             offset += (newSize * bpp) >> 1;
     }
 
     dst_start = pNv->FbStart + offset;
-        
-    /* We need to enlarge the copied rectangle by a pixel so the HW 
+
+    /* We need to enlarge the copied rectangle by a pixel so the HW
        filtering doesn't pick up junk laying outside of the source */
 
     left = (xa - 0x00010000) >> 16;
@@ -1159,7 +1159,7 @@ static int NVPutImage
         left &= ~1;
         npixels = ((right + 1) & ~1) - left;
         nlines = bottom - top;
-        
+
         left <<= 1;
         buf += (top * srcPitch) + left;
         dst_start += left + (top * dstPitch);
@@ -1187,13 +1187,13 @@ static int NVPutImage
                            width, height, src_w, src_h, drw_w, drw_h,
                            clipBoxes);
        } else {
-            NVPutOverlayImage(pScrnInfo, offset, id, dstPitch, &dstBox, 
+            NVPutOverlayImage(pScrnInfo, offset, id, dstPitch, &dstBox,
                              xa, ya, xb, yb,
-                             width, height, src_w, src_h, drw_w, drw_h, 
+                             width, height, src_w, src_h, drw_w, drw_h,
                              clipBoxes);
             pPriv->currentBuffer ^= 1;
        }
-    } 
+    }
 
     return Success;
 }
@@ -1202,25 +1202,25 @@ static int NVPutImage
  */
 static int NVQueryImageAttributes
 (
-    ScrnInfoPtr pScrnInfo, 
-    int         id, 
+    ScrnInfoPtr pScrnInfo,
+    int         id,
     unsigned short *w,
-    unsigned short *h, 
+    unsigned short *h,
     int         *pitches,
     int         *offsets
 )
 {
     int size, tmp;
-    
+
     if(*w > 2046)
         *w = 2046;
     if(*h > 2046)
         *h = 2046;
-    
+
     *w = (*w + 1) & ~1;
     if (offsets)
         offsets[0] = 0;
-    
+
     switch (id)
     {
         case FOURCC_YV12:
@@ -1261,7 +1261,7 @@ static int NVQueryImageAttributes
     return size;
 }
 
-static void NVVideoTimerCallback 
+static void NVVideoTimerCallback
 (
     ScrnInfoPtr pScrnInfo,
     Time currentTime
@@ -1272,7 +1272,7 @@ static void NVVideoTimerCallback
     NVPortPrivPtr pBlitPriv = NULL;
     Bool needCallback = FALSE;
 
-    if(!pScrnInfo->vtSema) return; 
+    if(!pScrnInfo->vtSema) return;
 
     if(pNv->overlayAdaptor) {
 	pOverPriv = GET_OVERLAY_PRIVATE(pNv);
@@ -1285,7 +1285,7 @@ static void NVVideoTimerCallback
         if(!pBlitPriv->videoStatus)
            pBlitPriv = NULL;
     }
-   
+
     if(pOverPriv) {
          if(pOverPriv->videoTime < currentTime) {
 	    if(pOverPriv->videoStatus & OFF_TIMER) {
@@ -1297,7 +1297,7 @@ static void NVVideoTimerCallback
             if(pOverPriv->videoStatus & FREE_TIMER) {
 		NVFreeOverlayMemory(pScrnInfo);
 		pOverPriv->videoStatus = 0;
-	    }	
+	    }
 	 } else {
             needCallback = TRUE;
          }
@@ -1306,7 +1306,7 @@ static void NVVideoTimerCallback
     if(pBlitPriv) {
         if(pBlitPriv->videoTime < currentTime) {
             NVFreeBlitMemory(pScrnInfo);
-            pBlitPriv->videoStatus = 0;              
+            pBlitPriv->videoStatus = 0;
         } else {
             needCallback = TRUE;
         }
@@ -1323,13 +1323,13 @@ static int
 NVAllocSurface (
     ScrnInfoPtr pScrnInfo,
     int id,
-    unsigned short w,   
+    unsigned short w,
     unsigned short h,
     XF86SurfacePtr surface
 )
 {
     NVPtr pNv = NVPTR(pScrnInfo);
-    NVPortPrivPtr pPriv = GET_OVERLAY_PRIVATE(pNv); 
+    NVPortPrivPtr pPriv = GET_OVERLAY_PRIVATE(pNv);
     int size, bpp;
 
     bpp = pScrnInfo->bitsPerPixel >> 3;
@@ -1352,7 +1352,7 @@ NVAllocSurface (
     surface->width = w;
     surface->height = h;
     surface->pScrn = pScrnInfo;
-    surface->pitches = &pPriv->pitch; 
+    surface->pitches = &pPriv->pitch;
     surface->offsets = &pPriv->offset;
     surface->devPrivate.ptr = (pointer)pPriv;
     surface->id = id;
@@ -1379,7 +1379,7 @@ NVStopSurface (XF86SurfacePtr surface)
     return Success;
 }
 
-static int 
+static int
 NVFreeSurface (XF86SurfacePtr surface)
 {
     NVPortPrivPtr pPriv = (NVPortPrivPtr)(surface->devPrivate.ptr);
@@ -1402,7 +1402,7 @@ NVGetSurfaceAttribute (
 {
     NVPtr pNv = NVPTR(pScrnInfo);
     NVPortPrivPtr pPriv = GET_OVERLAY_PRIVATE(pNv);
-    
+
     return NVGetOverlayPortAttribute(pScrnInfo, attribute, value, (pointer)pPriv);
 }
 
@@ -1415,16 +1415,16 @@ NVSetSurfaceAttribute(
 {
     NVPtr pNv = NVPTR(pScrnInfo);
     NVPortPrivPtr pPriv = GET_OVERLAY_PRIVATE(pNv);
-   
+
     return NVSetOverlayPortAttribute(pScrnInfo, attribute, value, (pointer)pPriv);
 }
 
 static int
 NVDisplaySurface (
     XF86SurfacePtr surface,
-    short src_x, short src_y, 
+    short src_x, short src_y,
     short drw_x, short drw_y,
-    short src_w, short src_h, 
+    short src_w, short src_h,
     short drw_w, short drw_h,
     RegionPtr clipBoxes
 )
@@ -1446,18 +1446,18 @@ NVDisplaySurface (
     xb = src_x + src_w;
     ya = src_y;
     yb = src_y + src_h;
-    
+
     dstBox.x1 = drw_x;
     dstBox.x2 = drw_x + drw_w;
     dstBox.y1 = drw_y;
     dstBox.y2 = drw_y + drw_h;
-    
-    if(!xf86XVClipVideoHelper(&dstBox, &xa, &xb, &ya, &yb, clipBoxes, 
+
+    if(!xf86XVClipVideoHelper(&dstBox, &xa, &xb, &ya, &yb, clipBoxes,
 		    surface->width, surface->height))
     {
         return Success;
     }
-    
+
     dstBox.x1 -= pScrnInfo->frameX0;
     dstBox.x2 -= pScrnInfo->frameX0;
     dstBox.y1 -= pScrnInfo->frameY0;
diff --git a/src/nv_xaa.c b/src/nv_xaa.c
index 76f8ae4..1df9605 100644
--- a/src/nv_xaa.c
+++ b/src/nv_xaa.c
@@ -110,7 +110,7 @@ NVDmaKickoff(NVPtr pNv)
    to solve this problem */
 #define SKIPS  8
 
-void 
+void
 NVDmaWait (
    NVPtr pNv,
    int size
@@ -136,7 +136,7 @@ NVDmaWait (
                pNv->dmaCurrent = pNv->dmaPut = SKIPS;
                pNv->dmaFree = dmaGet - (SKIPS + 1);
            }
-       } else 
+       } else
            pNv->dmaFree = dmaGet - pNv->dmaCurrent - 1;
     }
 }
@@ -154,13 +154,13 @@ NVWaitVSync(NVPtr pNv)
     NVDmaNext (pNv, 0);
 }
 
-/* 
+/*
   currentRop =  0-15  solid fill
                16-31  8x8 pattern fill
-               32-47  solid fill with planemask 
+               32-47  solid fill with planemask
 */
 
-static void 
+static void
 NVSetPattern(
    ScrnInfoPtr pScrn,
    CARD32 clr0,
@@ -178,7 +178,7 @@ NVSetPattern(
     NVDmaNext (pNv, pat1);
 }
 
-static void 
+static void
 NVSetRopSolid(ScrnInfoPtr pScrn, CARD32 rop, CARD32 planemask)
 {
     NVPtr pNv = NVPTR(pScrn);
@@ -190,7 +190,7 @@ NVSetRopSolid(ScrnInfoPtr pScrn, CARD32 rop, CARD32 planemask)
            NVDmaNext (pNv, NVCopyROP_PM[rop]);
            pNv->currentRop = rop + 32;
         }
-    } else 
+    } else
     if (pNv->currentRop != rop) {
         if(pNv->currentRop >= 16)
              NVSetPattern(pScrn, ~0, ~0, ~0, ~0);
@@ -208,7 +208,7 @@ void NVResetGraphics(ScrnInfoPtr pScrn)
 
     if(pNv->NoAccel) return;
 
-    pitch = pNv->CurrentLayout.displayWidth * 
+    pitch = pNv->CurrentLayout.displayWidth *
             (pNv->CurrentLayout.bitsPerPixel >> 3);
 
     pNv->dmaBase = (CARD32*)(&pNv->FbStart[pNv->FbUsableSize]);
@@ -305,10 +305,10 @@ NVDMAKickoffCallback (ScrnInfoPtr pScrn)
 
 static void
 NVSetupForScreenToScreenCopy(
-   ScrnInfoPtr pScrn, 
-   int xdir, int ydir, 
+   ScrnInfoPtr pScrn,
+   int xdir, int ydir,
    int rop,
-   unsigned planemask, 
+   unsigned planemask,
    int transparency_color
 )
 {
@@ -323,9 +323,9 @@ NVSetupForScreenToScreenCopy(
 
 static void
 NVSubsequentScreenToScreenCopy(
-   ScrnInfoPtr pScrn, 
+   ScrnInfoPtr pScrn,
    int x1, int y1,
-   int x2, int y2, 
+   int x2, int y2,
    int w, int h
 )
 {
@@ -337,13 +337,13 @@ NVSubsequentScreenToScreenCopy(
     NVDmaNext (pNv, (h  << 16) | w);
 
     if((w * h) >= 512)
-       NVDmaKickoff(pNv); 
+       NVDmaKickoff(pNv);
 }
 
 static void
 NVSetupForSolidFill(
-   ScrnInfoPtr pScrn, 
-   int color, 
+   ScrnInfoPtr pScrn,
+   int color,
    int rop,
    unsigned planemask
 )
@@ -374,10 +374,10 @@ NVSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h)
 
 static void
 NVSetupForMono8x8PatternFill (
-   ScrnInfoPtr pScrn, 
+   ScrnInfoPtr pScrn,
    int patternx, int patterny,
-   int fg, int bg, 
-   int rop, 
+   int fg, int bg,
+   int rop,
    unsigned planemask
 )
 {
@@ -406,7 +406,7 @@ static void
 NVSubsequentMono8x8PatternFillRect(
    ScrnInfoPtr pScrn,
    int patternx, int patterny,
-   int x, int y, 
+   int x, int y,
    int w, int h
 )
 {
@@ -455,7 +455,7 @@ NVSetupForScanlineCPUToScreenColorExpandFill (
 
 static void
 NVSubsequentScanlineCPUToScreenColorExpandFill (
-    ScrnInfoPtr pScrn, 
+    ScrnInfoPtr pScrn,
     int x, int y,
     int w, int h,
     int skipleft
@@ -484,7 +484,7 @@ NVSubsequentScanlineCPUToScreenColorExpandFill (
       NVDmaNext (pNv, (h << 16) | bw);
       NVDmaNext (pNv, (h << 16) | bw);
       NVDmaNext (pNv, (y << 16) | (x & 0xFFFF));
-      _color_expand_offset = RECT_EXPAND_TWO_COLOR_DATA(0); 
+      _color_expand_offset = RECT_EXPAND_TWO_COLOR_DATA(0);
    }
 
    NVDmaStart(pNv, _color_expand_offset, _color_expand_dwords);
@@ -509,11 +509,11 @@ NVSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
    }
 }
 
-static void 
+static void
 NVSetupForScanlineImageWrite(
-   ScrnInfoPtr pScrn, int rop, 
-   unsigned int planemask, 
-   int trans_color, 
+   ScrnInfoPtr pScrn, int rop,
+   unsigned int planemask,
+   int trans_color,
    int bpp, int depth
 )
 {
@@ -529,11 +529,11 @@ static CARD32 _image_srcpoint;
 static CARD32 _image_dstpoint;
 static CARD32 _image_dstpitch;
 
-static void 
+static void
 NVSubsequentScanlineImageWriteRect(
-   ScrnInfoPtr pScrn, 
-   int x, int y, 
-   int w, int h, 
+   ScrnInfoPtr pScrn,
+   int x, int y,
+   int w, int h,
    int skipleft
 )
 {
@@ -590,7 +590,7 @@ NVSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned planemask)
     pNv->DMAKickoffCallback = NVDMAKickoffCallback;
 }
 
-static void 
+static void
 NVSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, int x, int y, int len, int dir)
 {
     NVPtr pNv = NVPTR(pScrn);
@@ -606,11 +606,11 @@ NVSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, int x, int y, int len, int dir)
     }
 }
 
-static void 
+static void
 NVSubsequentSolidTwoPointLine(
-   ScrnInfoPtr pScrn, 
+   ScrnInfoPtr pScrn,
    int x1, int y1,
-   int x2, int y2, 
+   int x2, int y2,
    int flags
 )
 {
@@ -636,7 +636,7 @@ NVSetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2)
     int w = x2 - x1 + 1;
 
     NVDmaStart(pNv, CLIP_POINT, 2);
-    NVDmaNext (pNv, (y1 << 16) | x1); 
+    NVDmaNext (pNv, (y1 << 16) | x1);
     NVDmaNext (pNv, (h << 16) | w);
 }
 
@@ -646,7 +646,7 @@ NVDisableClipping(ScrnInfoPtr pScrn)
     NVPtr pNv = NVPTR(pScrn);
 
     NVDmaStart(pNv, CLIP_POINT, 2);
-    NVDmaNext (pNv, 0);              
+    NVDmaNext (pNv, 0);
     NVDmaNext (pNv, 0x7FFF7FFF);
 }
 
@@ -654,7 +654,7 @@ NVDisableClipping(ScrnInfoPtr pScrn)
 
 /* Initialize XAA acceleration info */
 Bool
-NVAccelInit(ScreenPtr pScreen) 
+NVAccelInit(ScreenPtr pScreen)
 {
 #ifdef HAVE_XAA_H
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
@@ -681,17 +681,17 @@ NVAccelInit(ScreenPtr pScreen)
    accel->SetupForMono8x8PatternFill = NVSetupForMono8x8PatternFill;
    accel->SubsequentMono8x8PatternFillRect = NVSubsequentMono8x8PatternFillRect;
 
-   accel->ScanlineCPUToScreenColorExpandFillFlags = 
+   accel->ScanlineCPUToScreenColorExpandFillFlags =
                                     BIT_ORDER_IN_BYTE_LSBFIRST |
                                     CPU_TRANSFER_PAD_DWORD |
                                     LEFT_EDGE_CLIPPING |
                                     LEFT_EDGE_CLIPPING_NEGATIVE_X;
    accel->NumScanlineColorExpandBuffers = 1;
-   accel->SetupForScanlineCPUToScreenColorExpandFill = 
+   accel->SetupForScanlineCPUToScreenColorExpandFill =
             NVSetupForScanlineCPUToScreenColorExpandFill;
-   accel->SubsequentScanlineCPUToScreenColorExpandFill = 
+   accel->SubsequentScanlineCPUToScreenColorExpandFill =
             NVSubsequentScanlineCPUToScreenColorExpandFill;
-   accel->SubsequentColorExpandScanline = 
+   accel->SubsequentColorExpandScanline =
             NVSubsequentColorExpandScanline;
    accel->ScanlineColorExpandBuffers = _storage_buffer;
 
@@ -712,7 +712,7 @@ NVAccelInit(ScreenPtr pScreen)
    accel->SetClippingRectangle = NVSetClippingRectangle;
    accel->DisableClipping = NVDisableClipping;
    accel->ClippingFlags = HARDWARE_CLIP_SOLID_LINE;
-   
+
    miSetZeroLineBias(pScreen, OCTANT1 | OCTANT3 | OCTANT4 | OCTANT6);
 
    return (XAAInit(pScreen, accel));
diff --git a/src/riva_cursor.c b/src/riva_cursor.c
index f8dcae1..5c9dd73 100644
--- a/src/riva_cursor.c
+++ b/src/riva_cursor.c
@@ -43,12 +43,12 @@
 (((c & 0xf80000) >> 9 ) | ((c & 0xf800) >> 6 ) | ((c & 0xf8) >> 3 ) | 0x8000)
 
 
-static void 
+static void
 RivaConvertCursor1555(RivaPtr pRiva, CARD32 *src, CARD16 *dst)
 {
     CARD32 b, m;
     int i, j;
-    
+
     for ( i = 0; i < 32; i++ ) {
         b = *src++;
         m = *src++;
@@ -112,13 +112,13 @@ RivaSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
     if ((pRiva->curFg != fore) || (pRiva->curBg != back)) {
         pRiva->curFg = fore;
         pRiva->curBg = back;
-            
+
         RivaTransformCursor(pRiva);
     }
 }
 
 
-static void 
+static void
 RivaShowCursor(ScrnInfoPtr pScrn)
 {
     RivaPtr pRiva = RivaPTR(pScrn);
@@ -134,14 +134,14 @@ RivaHideCursor(ScrnInfoPtr pScrn)
     pRiva->riva.ShowHideCursor(&pRiva->riva, 0);
 }
 
-static Bool 
+static Bool
 RivaUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
 {
     return TRUE;
 }
 
 
-Bool 
+Bool
 RivaCursorInit(ScreenPtr pScreen)
 {
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
@@ -150,12 +150,12 @@ RivaCursorInit(ScreenPtr pScreen)
 
     infoPtr = xf86CreateCursorInfoRec();
     if(!infoPtr) return FALSE;
-    
+
     pRiva->CursorInfoRec = infoPtr;
 
     infoPtr->MaxWidth = infoPtr->MaxHeight = 32;
     infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
-                     HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32; 
+                     HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32;
     infoPtr->SetCursorColors = RivaSetCursorColors;
     infoPtr->SetCursorPosition = RivaSetCursorPosition;
     infoPtr->LoadCursorImage = RivaLoadCursorImage;
diff --git a/src/riva_dac.c b/src/riva_dac.c
index 440aa42..85f0dcd 100644
--- a/src/riva_dac.c
+++ b/src/riva_dac.c
@@ -45,7 +45,7 @@ RivaDACInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
     int vertTotal       =  mode->CrtcVTotal        - 2;
     int vertBlankStart  =  mode->CrtcVDisplay      - 1;
     int vertBlankEnd    =  mode->CrtcVTotal        - 1;
-   
+
 
     RivaPtr pRiva = RivaPTR(pScrn);
     RivaRegPtr rivaReg = &pRiva->ModeReg;
@@ -64,13 +64,13 @@ RivaDACInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
      * Set all CRTC values.
      */
 
-    if(mode->Flags & V_INTERLACE) 
+    if(mode->Flags & V_INTERLACE)
         vertTotal |= 1;
 
     pVga->CRTC[0x0]  = RIVA_Set8Bits(horizTotal);
     pVga->CRTC[0x1]  = RIVA_Set8Bits(horizDisplay);
     pVga->CRTC[0x2]  = RIVA_Set8Bits(horizBlankStart);
-    pVga->CRTC[0x3]  = RIVA_SetBitField(horizBlankEnd,4:0,4:0) 
+    pVga->CRTC[0x3]  = RIVA_SetBitField(horizBlankEnd,4:0,4:0)
                        | RIVA_SetBit(7);
     pVga->CRTC[0x4]  = RIVA_Set8Bits(horizStart);
     pVga->CRTC[0x5]  = RIVA_SetBitField(horizBlankEnd,5:5,7:7)
@@ -102,7 +102,7 @@ RivaDACInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
                   | RIVA_SetBitField(vertDisplay,10:10,1:1)
                   | RIVA_SetBitField(vertTotal,10:10,0:0);
 
-    rivaReg->horiz  = RIVA_SetBitField(horizTotal,8:8,0:0) 
+    rivaReg->horiz  = RIVA_SetBitField(horizTotal,8:8,0:0)
                   | RIVA_SetBitField(horizDisplay,8:8,1:1)
                   | RIVA_SetBitField(horizBlankStart,8:8,2:2)
                   | RIVA_SetBitField(horizStart,8:8,3:3);
@@ -132,16 +132,16 @@ RivaDACInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
             pVga->DAC[(i*3)+2] = i;
         }
     }
-    
+
     /*
      * Calculate the extended registers.
      */
 
-    if(pLayout->depth < 24) 
+    if(pLayout->depth < 24)
 	i = pLayout->depth;
     else i = 32;
 
-    pRiva->riva.CalcStateExt(&pRiva->riva, 
+    pRiva->riva.CalcStateExt(&pRiva->riva,
                            rivaReg,
                            i,
                            pLayout->displayWidth,
@@ -157,7 +157,7 @@ RivaDACInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
     return (TRUE);
 }
 
-void 
+void
 RivaDACRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, RivaRegPtr rivaReg,
              Bool primary)
 {
@@ -182,7 +182,7 @@ RivaDACSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, RivaRegPtr rivaReg,
 
     pRiva->riva.LockUnlock(&pRiva->riva, 0);
 
-    vgaHWSave(pScrn, vgaReg, VGA_SR_CMAP | VGA_SR_MODE | 
+    vgaHWSave(pScrn, vgaReg, VGA_SR_CMAP | VGA_SR_MODE |
                              (saveFonts? VGA_SR_FONTS : 0));
     pRiva->riva.UnloadStateExt(&pRiva->riva, rivaReg);
 }
diff --git a/src/riva_dga.c b/src/riva_dga.c
index cbad39f..4c9bd37 100644
--- a/src/riva_dga.c
+++ b/src/riva_dga.c
@@ -11,7 +11,7 @@
 #endif
 #include "dgaproc.h"
 
-static Bool Riva_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, 
+static Bool Riva_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **,
 					int *, int *, int *);
 static Bool Riva_SetMode(ScrnInfoPtr, DGAModePtr);
 static int  Riva_GetViewport(ScrnInfoPtr);
@@ -19,7 +19,7 @@ static void Riva_SetViewport(ScrnInfoPtr, int, int, int);
 #ifdef HAVE_XAA_H
 static void Riva_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long);
 static void Riva_BlitRect(ScrnInfoPtr, int, int, int, int, int, int);
-static void Riva_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, 
+static void Riva_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int,
 					unsigned long);
 #endif
 
@@ -74,7 +74,7 @@ SECOND_PASS:
 		(size <= pRiva->FbUsableSize)) {
 
 	    if(secondPitch)
-		pitch = secondPitch; 
+		pitch = secondPitch;
 
 	    if(!(newmodes = realloc(modes, (*num + 1) * sizeof(DGAModeRec))))
 		break;
@@ -111,7 +111,7 @@ SECOND_PASS:
 	    mode->address = pRiva->FbStart;
 	    mode->bytesPerScanline = pitch * Bpp;
 	    mode->imageWidth = pitch;
-	    mode->imageHeight =  pRiva->FbUsableSize / mode->bytesPerScanline; 
+	    mode->imageHeight =  pRiva->FbUsableSize / mode->bytesPerScanline;
 	    mode->pixmapWidth = mode->imageWidth;
 	    mode->pixmapHeight = mode->imageHeight;
 	    mode->maxViewportX = mode->imageWidth - mode->viewportWidth;
@@ -135,26 +135,26 @@ SECOND_PASS:
 
 Bool
 RivaDGAInit(ScreenPtr pScreen)
-{   
+{
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
    RivaPtr pRiva = RivaPTR(pScrn);
    DGAModePtr modes = NULL;
    int num = 0;
 
    /* 8 */
-   modes = RivaSetupDGAMode (pScrn, modes, &num, 8, 8, 
+   modes = RivaSetupDGAMode (pScrn, modes, &num, 8, 8,
 		(pScrn->bitsPerPixel == 8),
 		(pScrn->bitsPerPixel != 8) ? 0 : pScrn->displayWidth,
 		0, 0, 0, PseudoColor);
 
    /* 15 */
-   modes = RivaSetupDGAMode (pScrn, modes, &num, 16, 15, 
+   modes = RivaSetupDGAMode (pScrn, modes, &num, 16, 15,
 		(pScrn->bitsPerPixel == 16),
 		(pScrn->depth != 15) ? 0 : pScrn->displayWidth,
 		0x7c00, 0x03e0, 0x001f, TrueColor);
 
    /* 32 */
-   modes = RivaSetupDGAMode (pScrn, modes, &num, 32, 24, 
+   modes = RivaSetupDGAMode (pScrn, modes, &num, 32, 24,
 		(pScrn->bitsPerPixel == 32),
 		(pScrn->bitsPerPixel != 32) ? 0 : pScrn->displayWidth,
 		0xff0000, 0x00ff00, 0x0000ff, TrueColor);
@@ -162,18 +162,18 @@ RivaDGAInit(ScreenPtr pScreen)
    pRiva->numDGAModes = num;
    pRiva->DGAModes = modes;
 
-   return DGAInit(pScreen, &Riva_DGAFuncs, modes, num);  
+   return DGAInit(pScreen, &Riva_DGAFuncs, modes, num);
 }
 
 
-static int 
+static int
 BitsSet(unsigned long data)
 {
    unsigned long mask;
    int set = 0;
 
    for(mask = 1; mask; mask <<= 1)
-        if(mask & data) set++;   
+        if(mask & data) set++;
 
    return set;
 }
@@ -191,7 +191,7 @@ Riva_SetMode(
    if(!pMode) { /* restore the original mode */
       if(pRiva->DGAactive)
         memcpy(&pRiva->CurrentLayout, &SavedLayouts[index], sizeof(RivaFBLayout));
-                
+
       pScrn->currentMode = pRiva->CurrentLayout.mode;
       RivaSwitchMode(SWITCH_MODE_ARGS(pScrn, pScrn->currentMode));
       RivaAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
@@ -205,7 +205,7 @@ Riva_SetMode(
       /* update CurrentLayout */
       pRiva->CurrentLayout.bitsPerPixel = pMode->bitsPerPixel;
       pRiva->CurrentLayout.depth = pMode->depth;
-      pRiva->CurrentLayout.displayWidth = pMode->bytesPerScanline / 
+      pRiva->CurrentLayout.displayWidth = pMode->bytesPerScanline /
                               (pMode->bitsPerPixel >> 3);
       pRiva->CurrentLayout.weight.red = BitsSet(pMode->red_mask);
       pRiva->CurrentLayout.weight.green = BitsSet(pMode->green_mask);
@@ -213,13 +213,13 @@ Riva_SetMode(
       /* RivaModeInit() will set the mode field */
       RivaSwitchMode(SWITCH_MODE_ARGS(pScrn, pMode->mode));
    }
-   
+
    return TRUE;
 }
 
 
 
-static int  
+static int
 Riva_GetViewport(
   ScrnInfoPtr pScrn
 ){
@@ -228,10 +228,10 @@ Riva_GetViewport(
     return pRiva->DGAViewportStatus;
 }
 
-static void 
+static void
 Riva_SetViewport(
-   ScrnInfoPtr pScrn, 
-   int x, int y, 
+   ScrnInfoPtr pScrn,
+   int x, int y,
    int flags
 ){
    RivaPtr pRiva = RivaPTR(pScrn);
@@ -241,14 +241,14 @@ Riva_SetViewport(
    while(VGA_RD08(pRiva->riva.PCIO, 0x3da) & 0x08);
    while(!(VGA_RD08(pRiva->riva.PCIO, 0x3da) & 0x08));
 
-   pRiva->DGAViewportStatus = 0;  
+   pRiva->DGAViewportStatus = 0;
 }
 
 #ifdef HAVE_XAA_H
-static void 
+static void
 Riva_FillRect (
-   ScrnInfoPtr pScrn, 
-   int x, int y, int w, int h, 
+   ScrnInfoPtr pScrn,
+   int x, int y, int w, int h,
    unsigned long color
 ){
     RivaPtr pRiva = RivaPTR(pScrn);
@@ -261,11 +261,11 @@ Riva_FillRect (
     SET_SYNC_FLAG(pRiva->AccelInfoRec);
 }
 
-static void 
+static void
 Riva_BlitRect(
-   ScrnInfoPtr pScrn, 
-   int srcx, int srcy, 
-   int w, int h, 
+   ScrnInfoPtr pScrn,
+   int srcx, int srcy,
+   int w, int h,
    int dstx, int dsty
 ){
     RivaPtr pRiva = RivaPTR(pScrn);
@@ -284,11 +284,11 @@ Riva_BlitRect(
 }
 
 
-static void 
+static void
 Riva_BlitTransRect(
-   ScrnInfoPtr pScrn, 
-   int srcx, int srcy, 
-   int w, int h, 
+   ScrnInfoPtr pScrn,
+   int srcx, int srcy,
+   int w, int h,
    int dstx, int dsty,
    unsigned long color
 ){
@@ -296,9 +296,9 @@ Riva_BlitTransRect(
 }
 #endif
 
-static Bool 
+static Bool
 Riva_OpenFramebuffer(
-   ScrnInfoPtr pScrn, 
+   ScrnInfoPtr pScrn,
    char **name,
    unsigned char **mem,
    int *size,
diff --git a/src/riva_driver.c b/src/riva_driver.c
index 70adf26..b2f2368 100644
--- a/src/riva_driver.c
+++ b/src/riva_driver.c
@@ -87,13 +87,13 @@ static const OptionInfoRec RivaOptions[] = {
  */
 static int pix24bpp = 0;
 
-/* 
+/*
  * ramdac info structure initialization
  */
 static RivaRamdacRec DacInit = {
         FALSE, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL,
         0, NULL, NULL, NULL, NULL
-}; 
+};
 
 
 
@@ -172,7 +172,7 @@ RivaSwitchMode(SWITCH_MODE_ARGS_DECL)
  * displayed location in the video memory.
  */
 /* Usually mandatory */
-void 
+void
 RivaAdjustFrame(ADJUST_FRAME_ARGS_DECL)
 {
     SCRN_INFO_PTR(arg);
@@ -180,8 +180,8 @@ RivaAdjustFrame(ADJUST_FRAME_ARGS_DECL)
     RivaPtr pRiva = RivaPTR(pScrn);
     RivaFBLayout *pLayout = &pRiva->CurrentLayout;
 
-    if(pRiva->ShowCache && y && pScrn->vtSema) 
-	y += pScrn->virtualY - 1;	
+    if(pRiva->ShowCache && y && pScrn->vtSema)
+	y += pScrn->virtualY - 1;
 
     startAddr = (((y*pLayout->displayWidth)+x)*(pLayout->bitsPerPixel/8));
     pRiva->riva.SetStartAddress(&pRiva->riva, startAddr);
@@ -323,7 +323,7 @@ Bool RivaI2CInit(ScrnInfoPtr pScrn)
         mod = "ddc";
         if(xf86LoadSubModule(pScrn, mod)) {
             return RivaDACi2cInit(pScrn);
-        } 
+        }
     }
 
     xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
@@ -360,7 +360,7 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags)
      * not at the start of each server generation.  This means that
      * only things that are persistent across server generations can
      * be initialised here.  xf86Screens[] is (pScrn is a pointer to one
-     * of these).  Privates allocated using xf86AllocateScrnInfoPrivateIndex()  
+     * of these).  Privates allocated using xf86AllocateScrnInfoPrivateIndex()
      * are too, and should be used for data that must persist across
      * server generations.
      *
@@ -382,7 +382,7 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags)
     pRiva->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
     if (pRiva->pEnt->location.type != BUS_PCI)
 	return FALSE;
- 
+
     /* Find the PCI info for this screen */
     pRiva->PciInfo = xf86GetPciInfoForEntity(pRiva->pEnt->index);
 #ifndef XSERVER_LIBPCIACCESS
@@ -394,12 +394,12 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags)
 
     /* Initialize the card through int10 interface if needed */
     if (xf86LoadSubModule(pScrn, "int10")) {
-#if !defined(__alpha__) 
+#if !defined(__alpha__)
         xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing int10\n");
         pRiva->pInt = xf86InitInt10(pRiva->pEnt->index);
 #endif
     }
-   
+
 #ifndef XSERVER_LIBPCIACCESS
     xf86SetOperatingState(resVgaIo, pRiva->pEnt->index, ResUnusedOpr);
     xf86SetOperatingState(resVgaMem, pRiva->pEnt->index, ResDisableOpr);
@@ -480,7 +480,7 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags)
 	xf86FreeInt10(pRiva->pInt);
 	return FALSE;
     }
-    
+
     /*
      * Allocate a vgaHWRec
      */
@@ -489,7 +489,7 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags)
 	return FALSE;
     }
     vgaHWSetStdFuncs(VGAHWPTR(pScrn));
-    
+
     /* We use a programmable clock */
     pScrn->progClock = TRUE;
 
@@ -533,12 +533,12 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags)
     if (xf86ReturnOptValBool(pRiva->Options, OPTION_SHADOW_FB, FALSE)) {
 	pRiva->ShadowFB = TRUE;
 	pRiva->NoAccel = TRUE;
-	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, 
+	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
 		"Using \"Shadow Framebuffer\" - acceleration disabled\n");
     }
     if (xf86ReturnOptValBool(pRiva->Options, OPTION_FBDEV, FALSE)) {
 	pRiva->FBDev = TRUE;
-	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, 
+	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
 		"Using framebuffer device\n");
     }
     if (pRiva->FBDev) {
@@ -547,7 +547,7 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags)
 	    xf86FreeInt10(pRiva->pInt);
 	    return FALSE;
 	}
-	
+
 	if (!fbdevHWInit(pScrn, pRiva->PciInfo, NULL)) {
 	    xf86FreeInt10(pRiva->pInt);
 	    return FALSE;
@@ -565,7 +565,7 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags)
 	pRiva->NoAccel = TRUE;
 	pRiva->HWCursor = FALSE;
 	pRiva->Rotate = 1;
-	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, 
+	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
 		"Rotating screen clockwise - acceleration disabled\n");
       } else
       if(!xf86NameCmp(s, "CCW")) {
@@ -573,12 +573,12 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags)
 	pRiva->NoAccel = TRUE;
 	pRiva->HWCursor = FALSE;
 	pRiva->Rotate = -1;
-	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, 
+	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
 		"Rotating screen counter clockwise - acceleration disabled\n");
       } else {
-	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, 
+	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
 		"\"%s\" is not a valid value for Option \"Rotate\"\n", s);
-	xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
+	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 		"Valid options are \"CW\" or \"CCW\"\n");
       }
     }
@@ -639,7 +639,7 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags)
     }
     xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX\n",
 	       (unsigned long)pRiva->IOAddress);
-     
+
 #ifndef XSERVER_LIBPCIACCESS
     if (xf86RegisterResources(pRiva->pEnt->index, NULL, ResExclusive)) {
 	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -668,7 +668,7 @@ RivaPreInit(ScrnInfoPtr pScrn, int flags)
     }
     xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d kBytes\n",
                pScrn->videoRam);
-	
+
     pRiva->FbMapSize = pScrn->videoRam * 1024;
 
     /*
@@ -824,7 +824,7 @@ RivaMapMem(ScrnInfoPtr pScrn)
 
     /*
      * Map IO registers to virtual address space
-     */ 
+     */
 #ifdef XSERVER_LIBPCIACCESS
     void *tmp;
 
@@ -884,12 +884,12 @@ static Bool
 RivaUnmapMem(ScrnInfoPtr pScrn)
 {
     RivaPtr pRiva;
-    
+
     pRiva = RivaPTR(pScrn);
 
     /*
      * Unmap IO registers to virtual address space
-     */ 
+     */
 #ifdef XSERVER_LIBPCIACCESS
     pci_device_unmap_range(pRiva->PciInfo, pRiva->IOBase, 0x1000000);
     pci_device_unmap_range(pRiva->PciInfo, pRiva->FbBase, pRiva->FbMapSize);
@@ -907,7 +907,7 @@ RivaUnmapMem(ScrnInfoPtr pScrn)
 
 
 /*
- * Initialise a new mode. 
+ * Initialise a new mode.
  */
 
 static Bool
@@ -918,7 +918,7 @@ RivaModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
     RivaPtr pRiva = RivaPTR(pScrn);
     RivaRegPtr rivaReg;
 
-    
+
     /* Initialise the ModeReg values */
     if (!vgaHWInit(pScrn, mode))
 	return FALSE;
@@ -949,7 +949,7 @@ RivaModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
 /*
  * Restore the initial (text) mode.
  */
-static void 
+static void
 RivaRestore(ScrnInfoPtr pScrn)
 {
     vgaHWPtr hwp = VGAHWPTR(pScrn);
@@ -1015,7 +1015,7 @@ RivaScreenInit(SCREEN_INIT_ARGS_DECL)
     int width, height, displayWidth;
     BoxRec AvailFBArea;
 
-    /* 
+    /*
      * First get the ScrnInfoRec
      */
     pScrn = xf86ScreenToScrn(pScreen);
@@ -1033,7 +1033,7 @@ RivaScreenInit(SCREEN_INIT_ARGS_DECL)
 	if (!RivaMapMem(pScrn))
 	    return FALSE;
     }
-    
+
     /* Map the VGA memory when the primary video */
     if (pRiva->Primary && !pRiva->FBDev) {
 	hwp->MapSize = 0x10000;
@@ -1083,7 +1083,7 @@ RivaScreenInit(SCREEN_INIT_ARGS_DECL)
                                 pScrn->defaultVisual))
               return FALSE;
     } else {
-          if (!miSetVisualTypes(pScrn->depth, 
+          if (!miSetVisualTypes(pScrn->depth,
                                 miGetDefaultVisualMask(pScrn->depth), 8,
                                 pScrn->defaultVisual))
 	  return FALSE;
@@ -1151,7 +1151,7 @@ RivaScreenInit(SCREEN_INIT_ARGS_DECL)
     }
 
     fbPictureInit (pScreen, 0, 0);
-    
+
     xf86SetBlackWhitePixels(pScreen);
 
 
@@ -1161,27 +1161,27 @@ RivaScreenInit(SCREEN_INIT_ARGS_DECL)
     AvailFBArea.x1 = 0;
     AvailFBArea.y1 = 0;
     AvailFBArea.x2 = pScrn->displayWidth;
-    AvailFBArea.y2 = (min(pRiva->FbUsableSize, 32*1024*1024)) / 
+    AvailFBArea.y2 = (min(pRiva->FbUsableSize, 32*1024*1024)) /
                      (pScrn->displayWidth * pScrn->bitsPerPixel / 8);
     xf86InitFBManager(pScreen, &AvailFBArea);
-    
+
     if (!pRiva->NoAccel)
 	RivaAccelInit(pScreen);
-    
+
     xf86SetBackingStore(pScreen);
     xf86SetSilkenMouse(pScreen);
 
 
-    /* Initialize software cursor.  
+    /* Initialize software cursor.
 	Must precede creation of the default colormap */
     miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
 
 
-    /* Initialize HW cursor layer. 
+    /* Initialize HW cursor layer.
 	Must follow software cursor initialization*/
-    if (pRiva->HWCursor) { 
+    if (pRiva->HWCursor) {
 	if(!RivaCursorInit(pScreen))
-	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR, 
+	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		"Hardware cursor initialization failed\n");
     }
 
@@ -1189,15 +1189,15 @@ RivaScreenInit(SCREEN_INIT_ARGS_DECL)
     if (!miCreateDefColormap(pScreen))
 	return FALSE;
 
-    
-    /* Initialize colormap layer.  
+
+    /* Initialize colormap layer.
 	Must follow initialization of the default colormap */
     if(!xf86HandleColormaps(pScreen, 256, 8,
-	(pRiva->FBDev ? fbdevHWLoadPaletteWeak() : Rivadac->LoadPalette), 
+	(pRiva->FBDev ? fbdevHWLoadPaletteWeak() : Rivadac->LoadPalette),
 	NULL, CMAP_RELOAD_ON_MODE_SWITCH | CMAP_PALETTED_TRUECOLOR))
 	return FALSE;
 
-    
+
     if(pRiva->ShadowFB) {
 	RefreshAreaFuncPtr refreshArea = RivaRefreshArea;
 
@@ -1225,7 +1225,7 @@ RivaScreenInit(SCREEN_INIT_ARGS_DECL)
 
     xf86DPMSInit(pScreen, RivaDPMSSet, 0);
 
-    
+
     pScrn->memPhysBase = pRiva->FbAddress;
     pScrn->fbOffset = 0;
 
diff --git a/src/riva_hw.c b/src/riva_hw.c
index 9903625..97ad8cd 100644
--- a/src/riva_hw.c
+++ b/src/riva_hw.c
@@ -245,7 +245,7 @@ static int nv3_iterate(nv3_fifo_info *res_info, nv3_sim_state * state, nv3_arb_i
                 ainfo->first_vacc = 0;
                 if (last!=cur)
                 {
-                    ns =  1000000 * (vmisses*state->mem_page_miss + state->mem_latency)/state->mclk_khz; 
+                    ns =  1000000 * (vmisses*state->mem_page_miss + state->mem_latency)/state->mclk_khz;
                     vlwm = ns * ainfo->vdrain_rate/ 1000000;
                     vlwm = ainfo->vocc - vlwm;
                 }
@@ -332,7 +332,7 @@ static int nv3_iterate(nv3_fifo_info *res_info, nv3_sim_state * state, nv3_arb_i
         }
     }
 }
-static char nv3_arb(nv3_fifo_info * res_info, nv3_sim_state * state,  nv3_arb_info *ainfo) 
+static char nv3_arb(nv3_fifo_info * res_info, nv3_sim_state * state,  nv3_arb_info *ainfo)
 {
     long ens, vns, mns, gns;
     int mmisses, gmisses, vmisses, eburst_size, mburst_size;
@@ -442,7 +442,7 @@ static char nv3_arb(nv3_fifo_info * res_info, nv3_sim_state * state,  nv3_arb_in
 static char nv3_get_param(nv3_fifo_info *res_info, nv3_sim_state * state, nv3_arb_info *ainfo)
 {
     int done, g,v, p;
-    
+
     done = 0;
     for (p=0; p < 2; p++)
     {
@@ -451,7 +451,7 @@ static char nv3_get_param(nv3_fifo_info *res_info, nv3_sim_state * state, nv3_ar
             for (v=128; v >=32; v = v>> 1)
             {
                 ainfo->priority = p;
-                ainfo->gburst_size = g;     
+                ainfo->gburst_size = g;
                 ainfo->vburst_size = v;
                 done = nv3_arb(res_info, state,ainfo);
                 if (done && (g==128))
@@ -466,7 +466,7 @@ static char nv3_get_param(nv3_fifo_info *res_info, nv3_sim_state * state, nv3_ar
  Done:
     return done;
 }
-static void nv3CalcArbitration 
+static void nv3CalcArbitration
 (
     nv3_fifo_info * res_info,
     nv3_sim_state * state
@@ -516,8 +516,8 @@ static void nv3CalcArbitration
 }
 static void nv3UpdateArbitrationSettings
 (
-    unsigned      VClk, 
-    unsigned      pixelDepth, 
+    unsigned      VClk,
+    unsigned      pixelDepth,
     unsigned     *burst,
     unsigned     *lwm,
     RIVA_HW_INST *chip
@@ -526,7 +526,7 @@ static void nv3UpdateArbitrationSettings
     nv3_fifo_info fifo_data;
     nv3_sim_state sim_data;
     unsigned int M, N, P, pll, MClk;
-    
+
     pll = chip->PRAMDAC[0x00000504/4];
     M = (pll >> 0) & 0xFF; N = (pll >> 8) & 0xFF; P = (pll >> 16) & 0x0F;
     MClk = (N * chip->CrystalFreqKHz / M) >> P;
@@ -581,16 +581,16 @@ static int CalcVClock
     unsigned DeltaNew, DeltaOld;
     unsigned VClk, Freq;
     unsigned M, N, P;
-    
+
     DeltaOld = 0xFFFFFFFF;
 
     VClk     = (unsigned)clockIn;
-    
+
     if (chip->CrystalFreqKHz == 13500)
     {
         lowM  = 7;
         highM = 12;
-    }                      
+    }
     else
     {
         lowM  = 8;
@@ -627,7 +627,7 @@ static int CalcVClock
     return (DeltaOld != 0xFFFFFFFF);
 }
 /*
- * Calculate extended mode parameters (SVGA) and save in a 
+ * Calculate extended mode parameters (SVGA) and save in a
  * mode state structure.
  */
 static void CalcStateExt
@@ -639,7 +639,7 @@ static void CalcStateExt
     int            hDisplaySize,
     int            height,
     int            dotClock,
-    int		   flags 
+    int		   flags
 )
 {
     int pixelDepth, VClk = 0, m = 0, n = 0, p = 0;
@@ -655,8 +655,8 @@ static void CalcStateExt
     pixelDepth = (bpp + 1)/8;
     CalcVClock(dotClock, &VClk, &m, &n, &p, chip);
 
-    nv3UpdateArbitrationSettings(VClk, 
-                                 pixelDepth * 8, 
+    nv3UpdateArbitrationSettings(VClk,
+                                 pixelDepth * 8,
                                  &(state->arbitration0),
                                  &(state->arbitration1),
                                  chip);
@@ -792,7 +792,7 @@ static void LoadStateExt
     chip->PCRTC[0x00000100/4] = chip->VBlankBit;
     /*
      * Set interrupt enable.
-     */    
+     */
     chip->PMC[0x00000140/4]  = chip->EnableIRQ & 0x01;
     /*
      * Set current state pointer.
@@ -803,7 +803,7 @@ static void LoadStateExt
      */
     chip->FifoFreeCount  = 0;
     /* Free count from first subchannel */
-    chip->FifoEmptyCount = chip->Rop->FifoFree; 
+    chip->FifoEmptyCount = chip->Rop->FifoFree;
 }
 
 static void UnloadStateExt
@@ -895,7 +895,7 @@ static void nv3GetConfig
     {
         if (((chip->PMC[0x00000000/4] & 0xF0) == 0x20)
          && ((chip->PMC[0x00000000/4] & 0x0F) >= 0x02))
-        {        
+        {
             /*
              * SDRAM 128 ZX.
              */
@@ -912,12 +912,12 @@ static void nv3GetConfig
                     chip->RamAmountKBytes = 1024 * 8;
                     break;
             }
-        }            
-        else            
+        }
+        else
         {
             chip->RamBandwidthKBytesPerSec = 1000000;
             chip->RamAmountKBytes          = 1024 * 8;
-        }            
+        }
     }
     else
     {
@@ -937,7 +937,7 @@ static void nv3GetConfig
                 chip->RamAmountKBytes = 1024 * 2;
                 break;
         }
-    }        
+    }
     chip->CrystalFreqKHz   = (chip->PEXTDEV[0x00000000/4] & 0x00000040) ? 14318 : 13500;
     chip->CURSOR           = &(chip->PRAMIN[0x00008000/4 - 0x0800/4]);
     chip->VBlankBit        = 0x00000100;
diff --git a/src/riva_hw.h b/src/riva_hw.h
index 61692cf..b9d0b38 100644
--- a/src/riva_hw.h
+++ b/src/riva_hw.h
@@ -227,7 +227,7 @@ typedef volatile struct
     U032 RenderBufferOffset;
     U032 ZBufferOffset;
 } RivaSurface3D;
-    
+
 /***************************************************************************\
 *                                                                           *
 *                        Virtualized RIVA H/W interface.                    *
diff --git a/src/riva_local.h b/src/riva_local.h
index a826bdc..e795c9c 100644
--- a/src/riva_local.h
+++ b/src/riva_local.h
@@ -28,7 +28,7 @@
  * This file includes any environment or machine specific values to access the
  * HW.  Put all affected includes, typdefs, etc. here so the riva_hw.* files
  * can stay generic in nature.
- */ 
+ */
 #include "compiler.h"
 #include "xf86_OSproc.h"
 
diff --git a/src/riva_setup.c b/src/riva_setup.c
index badc088..bf2ad98 100644
--- a/src/riva_setup.c
+++ b/src/riva_setup.c
@@ -155,7 +155,7 @@ static CARD8 RivaReadDacData(vgaHWPtr pVga)
 
 
 
-static xf86MonPtr 
+static xf86MonPtr
 RivaProbeDDC (ScrnInfoPtr pScrn)
 {
     RivaPtr pRiva = RivaPTR(pScrn);
@@ -177,7 +177,7 @@ RivaProbeDDC (ScrnInfoPtr pScrn)
                   "  ... found one\n");
        xf86PrintEDID( MonInfo );
     } else {
-       xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
+       xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                   "  ... none found\n");
     }
 
@@ -192,7 +192,7 @@ Riva3Setup(ScrnInfoPtr pScrn)
     CARD32 regBase = pRiva->IOAddress;
     CARD32 frameBase = pRiva->FbAddress;
     xf86MonPtr monitor;
-    
+
     pRiva->Save = RivaDACSave;
     pRiva->Restore = RivaDACRestore;
     pRiva->ModeInit = RivaDACInit;
@@ -226,7 +226,7 @@ Riva3Setup(ScrnInfoPtr pScrn)
      */
     pVga->MMIOBase   = (CARD8 *)pRiva;
     pVga->MMIOOffset = 0;
-    
+
     /*
      * No IRQ in use.
      */
diff --git a/src/riva_shadow.c b/src/riva_shadow.c
index 91398f1..b933852 100644
--- a/src/riva_shadow.c
+++ b/src/riva_shadow.c
@@ -1,5 +1,5 @@
 /*
-   Copyright (c) 1999,  The XFree86 Project Inc. 
+   Copyright (c) 1999,  The XFree86 Project Inc.
    Written by Mark Vojkovich <markv at valinux.com>
 */
 
@@ -20,14 +20,14 @@ RivaRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
     RivaPtr pRiva = RivaPTR(pScrn);
     int width, height, Bpp, FBPitch;
     unsigned char *src, *dst;
-   
+
     Bpp = pScrn->bitsPerPixel >> 3;
     FBPitch = BitmapBytePad(pScrn->displayWidth * pScrn->bitsPerPixel);
 
     while(num--) {
 	width = (pbox->x2 - pbox->x1) * Bpp;
 	height = pbox->y2 - pbox->y1;
-	src = pRiva->ShadowPtr + (pbox->y1 * pRiva->ShadowPitch) + 
+	src = pRiva->ShadowPtr + (pbox->y1 * pRiva->ShadowPitch) +
 						(pbox->x1 * Bpp);
 	dst = pRiva->FbStart + (pbox->y1 * FBPitch) + (pbox->x1 * Bpp);
 
@@ -36,10 +36,10 @@ RivaRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
 	    dst += FBPitch;
 	    src += pRiva->ShadowPitch;
 	}
-	
+
 	pbox++;
     }
-} 
+}
 
 void
 RivaPointerMoved(SCRN_ARG_TYPE arg, int x, int y)
@@ -77,11 +77,11 @@ RivaRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
 	height = (y2 - y1) >> 2;  /* in dwords */
 
 	if(pRiva->Rotate == 1) {
-	    dstPtr = pRiva->FbStart + 
+	    dstPtr = pRiva->FbStart +
 			(pbox->x1 * dstPitch) + pScrn->virtualX - y2;
 	    srcPtr = pRiva->ShadowPtr + ((1 - y2) * srcPitch) + pbox->x1;
 	} else {
-	    dstPtr = pRiva->FbStart + 
+	    dstPtr = pRiva->FbStart +
 			((pScrn->virtualY - pbox->x2) * dstPitch) + y1;
 	    srcPtr = pRiva->ShadowPtr + (y1 * srcPitch) + pbox->x2 - 1;
 	}
@@ -91,8 +91,8 @@ RivaRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
 	    dst = (CARD32*)dstPtr;
 	    count = height;
 	    while(count--) {
-		*(dst++) = src[0] | (src[srcPitch] << 8) | 
-					(src[srcPitch * 2] << 16) | 
+		*(dst++) = src[0] | (src[srcPitch] << 8) |
+					(src[srcPitch * 2] << 16) |
 					(src[srcPitch * 3] << 24);
 		src += srcPitch * 4;
 	    }
@@ -102,7 +102,7 @@ RivaRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
 
 	pbox++;
     }
-} 
+}
 
 
 void
@@ -123,14 +123,14 @@ RivaRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
 	height = (y2 - y1) >> 1;  /* in dwords */
 
 	if(pRiva->Rotate == 1) {
-	    dstPtr = (CARD16*)pRiva->FbStart + 
+	    dstPtr = (CARD16*)pRiva->FbStart +
 			(pbox->x1 * dstPitch) + pScrn->virtualX - y2;
-	    srcPtr = (CARD16*)pRiva->ShadowPtr + 
+	    srcPtr = (CARD16*)pRiva->ShadowPtr +
 			((1 - y2) * srcPitch) + pbox->x1;
 	} else {
-	    dstPtr = (CARD16*)pRiva->FbStart + 
+	    dstPtr = (CARD16*)pRiva->FbStart +
 			((pScrn->virtualY - pbox->x2) * dstPitch) + y1;
-	    srcPtr = (CARD16*)pRiva->ShadowPtr + 
+	    srcPtr = (CARD16*)pRiva->ShadowPtr +
 			(y1 * srcPitch) + pbox->x2 - 1;
 	}
 
@@ -166,14 +166,14 @@ RivaRefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
 	height = pbox->y2 - pbox->y1;
 
 	if(pRiva->Rotate == 1) {
-	    dstPtr = (CARD32*)pRiva->FbStart + 
+	    dstPtr = (CARD32*)pRiva->FbStart +
 			(pbox->x1 * dstPitch) + pScrn->virtualX - pbox->y2;
-	    srcPtr = (CARD32*)pRiva->ShadowPtr + 
+	    srcPtr = (CARD32*)pRiva->ShadowPtr +
 			((1 - pbox->y2) * srcPitch) + pbox->x1;
 	} else {
-	    dstPtr = (CARD32*)pRiva->FbStart + 
+	    dstPtr = (CARD32*)pRiva->FbStart +
 			((pScrn->virtualY - pbox->x2) * dstPitch) + pbox->y1;
-	    srcPtr = (CARD32*)pRiva->ShadowPtr + 
+	    srcPtr = (CARD32*)pRiva->ShadowPtr +
 			(pbox->y1 * srcPitch) + pbox->x2 - 1;
 	}
 
diff --git a/src/riva_xaa.c b/src/riva_xaa.c
index d0a9b50..3642d47 100644
--- a/src/riva_xaa.c
+++ b/src/riva_xaa.c
@@ -73,7 +73,7 @@ RivaSetPattern(RivaPtr pRiva, int clr0, int clr1, int pat0, int pat1)
  */
 static void
 RivaSetRopSolid(RivaPtr pRiva, int rop)
-{    
+{
     if (pRiva->currentRop != rop) {
         if (pRiva->currentRop >= 16)
             RivaSetPattern(pRiva, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
@@ -114,9 +114,9 @@ static void
 RivaSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h)
 {
     RivaPtr pRiva = RivaPTR(pScrn);
-    
+
     RIVA_FIFO_FREE(pRiva->riva, Bitmap, 2);
-    pRiva->riva.Bitmap->UnclippedRectangle[0].TopLeft     = (x << 16) | y; 
+    pRiva->riva.Bitmap->UnclippedRectangle[0].TopLeft     = (x << 16) | y;
     write_mem_barrier();
     pRiva->riva.Bitmap->UnclippedRectangle[0].WidthHeight = (w << 16) | h;
     write_mem_barrier();
@@ -206,7 +206,7 @@ RivaResetGraphics(ScrnInfoPtr pScrn)
     if(pRiva->NoAccel) return;
 
     RIVA_FIFO_FREE(pRiva->riva, Patt, 1);
-    pRiva->riva.Patt->Shape = 0; 
+    pRiva->riva.Patt->Shape = 0;
     RivaDisableClipping(pScrn);
     pRiva->currentRop = 16;  /* to force RivaSetRopSolid to reset the pattern */
     RivaSetRopSolid(pRiva, GXcopy);
@@ -228,7 +228,7 @@ void RivaSync(ScrnInfoPtr pScrn)
 /* Color expansion */
 static void
 RivaSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
-                                             int fg, int bg, int rop, 
+                                             int fg, int bg, int rop,
                                              unsigned int planemask)
 {
     RivaPtr pRiva = RivaPTR(pScrn);
@@ -268,8 +268,8 @@ RivaSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
     int t = pRiva->expandWidth;
     CARD32 *pbits = (CARD32*)pRiva->expandBuffer;
     CARD32 *d = (CARD32*)pRiva->expandFifo;
-    
-    while(t >= 16) 
+
+    while(t >= 16)
     {
 	RIVA_FIFO_FREE(pRiva->riva, Bitmap, 16);
 	d[0]  = pbits[0];
@@ -292,7 +292,7 @@ RivaSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
     }
     if(t) {
 	RIVA_FIFO_FREE(pRiva->riva, Bitmap, t);
-	while(t >= 4) 
+	while(t >= 4)
 	{
 	    d[0]  = pbits[0];
 	    d[1]  = pbits[1];
@@ -300,8 +300,8 @@ RivaSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
 	    d[3]  = pbits[3];
 	    t -= 4; pbits += 4;
 	}
-	while(t--) 
-	    *(d++) = *(pbits++); 
+	while(t--)
+	    *(d++) = *(pbits++);
     }
 
     if (!(--pRiva->expandRows)) { /* hardware bug workaround */
@@ -334,7 +334,7 @@ RivaSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x,
 {
     int bw;
     RivaPtr pRiva = RivaPTR(pScrn);
-    
+
     bw = (w + 31) & ~31;
     pRiva->expandWidth = bw >> 5;
 
@@ -371,11 +371,11 @@ RivaSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x,
 
     if(pRiva->expandWidth > (pRiva->riva.FifoEmptyCount >> 2)) {
 	pRiva->AccelInfoRec->ScanlineColorExpandBuffers = &pRiva->expandBuffer;
-	pRiva->AccelInfoRec->SubsequentColorExpandScanline = 
+	pRiva->AccelInfoRec->SubsequentColorExpandScanline =
 				RivaSubsequentColorExpandScanline;
     } else {
 	pRiva->AccelInfoRec->ScanlineColorExpandBuffers = &pRiva->expandFifo;
-	pRiva->AccelInfoRec->SubsequentColorExpandScanline = 
+	pRiva->AccelInfoRec->SubsequentColorExpandScanline =
 				RivaSubsequentColorExpandScanlineFifo;
 	RIVA_FIFO_FREE(pRiva->riva, Bitmap, pRiva->expandWidth);
     }
@@ -390,7 +390,7 @@ RivaSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned planemask)
     pRiva->FgColor = color;
 }
 
-static void 
+static void
 RivaSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, int x, int y, int len, int dir)
 {
     RivaPtr pRiva = RivaPTR(pScrn);
@@ -406,7 +406,7 @@ RivaSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, int x, int y, int len, int dir
     write_mem_barrier();
 }
 
-static void 
+static void
 RivaSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1,
                               int x2, int y2, int flags)
 {
@@ -436,7 +436,7 @@ RivaValidatePolyArc(
 ){
    if(pGC->planemask != ~0) return;
 
-   if(!pGC->lineWidth && 
+   if(!pGC->lineWidth &&
 	((pGC->alu != GXcopy) || (pGC->lineStyle != LineSolid)))
    {
         pGC->ops->PolyArc = miZeroPolyArc;
@@ -460,7 +460,7 @@ RivaValidatePolyPoint(
 
 /* Initialize XAA acceleration info */
 Bool
-RivaAccelInit(ScreenPtr pScreen) 
+RivaAccelInit(ScreenPtr pScreen)
 {
 #ifdef HAVE_XAA_H
     XAAInfoRecPtr infoPtr;
@@ -501,21 +501,21 @@ RivaAccelInit(ScreenPtr pScreen)
 
     /* Color expansion */
     infoPtr->ScanlineCPUToScreenColorExpandFillFlags =
-				BIT_ORDER_IN_BYTE_LSBFIRST | 
-				NO_PLANEMASK | 
+				BIT_ORDER_IN_BYTE_LSBFIRST |
+				NO_PLANEMASK |
 				CPU_TRANSFER_PAD_DWORD |
-				LEFT_EDGE_CLIPPING | 		
+				LEFT_EDGE_CLIPPING |
 				LEFT_EDGE_CLIPPING_NEGATIVE_X;
 
     infoPtr->NumScanlineColorExpandBuffers = 1;
 
     infoPtr->SetupForScanlineCPUToScreenColorExpandFill =
         RivaSetupForScanlineCPUToScreenColorExpandFill;
-    infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = 
+    infoPtr->SubsequentScanlineCPUToScreenColorExpandFill =
         RivaSubsequentScanlineCPUToScreenColorExpandFill;
 
     pRiva->expandFifo = (unsigned char*)&pRiva->riva.Bitmap->MonochromeData01E;
-    
+
     /* Allocate buffer for color expansion and also image writes in the
        future */
     pRiva->expandBuffer = XNFalloc(((pScrn->virtualX*pScrn->bitsPerPixel)/8) + 8);
@@ -528,7 +528,7 @@ RivaAccelInit(ScreenPtr pScreen)
     infoPtr->SetupForSolidLine = RivaSetupForSolidLine;
     infoPtr->SubsequentSolidHorVertLine =
 		RivaSubsequentSolidHorVertLine;
-    infoPtr->SubsequentSolidTwoPointLine = 
+    infoPtr->SubsequentSolidTwoPointLine =
 		RivaSubsequentSolidTwoPointLine;
     infoPtr->SetClippingRectangle = RivaSetClippingRectangle;
     infoPtr->DisableClipping = RivaDisableClipping;
@@ -539,7 +539,7 @@ RivaAccelInit(ScreenPtr pScreen)
     infoPtr->PolyArcMask = GCFunction | GCLineWidth | GCPlaneMask;
     infoPtr->ValidatePolyPoint = RivaValidatePolyPoint;
     infoPtr->PolyPointMask = GCFunction | GCPlaneMask;
-   
+
     RivaResetGraphics(pScrn);
 
     return(XAAInit(pScreen, infoPtr));


More information about the xorg-commit mailing list