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

xserver-xorg-video-openchrome: Changes to 'debian-experimental'



 ChangeLog                                      |   66 ++++
 debian/changelog                               |    9 
 debian/patches/01_gen_pci_ids.diff             |    2 
 debian/patches/disable_ARGB_cursor_VM800.patch |   10 
 debian/patches/vt_fix.patch                    |    8 
 src/via_accel.c                                |  348 +++++++++++++++++--------
 src/via_bandwidth.c                            |   23 +
 src/via_crtc.c                                 |   28 +-
 src/via_cursor.c                               |   18 -
 src/via_driver.c                               |   17 -
 src/via_driver.h                               |    1 
 src/via_id.c                                   |    3 
 src/via_id.h                                   |    2 
 src/via_mode.c                                 |   12 
 src/via_mode.h                                 |    2 
 src/via_panel.c                                |    2 
 src/via_regs.h                                 |   32 ++
 src/via_swov.c                                 |   14 +
 src/via_video.c                                |    3 
 19 files changed, 468 insertions(+), 132 deletions(-)

New commits:
commit 69e3c4f05a0b1c35fce63a4b3c62238e46de893e
Author: Raphael Geissert <atomo64@gmail.com>
Date:   Sat Nov 8 19:57:23 2008 -0600

    massaged patches so they still apply

diff --git a/debian/changelog b/debian/changelog
index a4135e4..ab59f8f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ xserver-xorg-video-openchrome (1:0.2.903+svn685-1) UNRELEASED; urgency=low
   * New upstream snapshot
     + 682-685: Initial VX800 chipsets support
     + 682: via_cursor.c: register corrections
+  * debian/patches: massaged so they still apply
 
  -- Raphael Geissert <atomo64@gmail.com>  Sat, 08 Nov 2008 18:06:50 -0600
 
diff --git a/debian/patches/01_gen_pci_ids.diff b/debian/patches/01_gen_pci_ids.diff
index 9318c90..7485fe3 100644
--- a/debian/patches/01_gen_pci_ids.diff
+++ b/debian/patches/01_gen_pci_ids.diff
@@ -3,7 +3,7 @@ Index: xserver-xorg-video-openchrome/src/Makefile.am
 ===================================================================
 --- xserver-xorg-video-openchrome.orig/src/Makefile.am
 +++ xserver-xorg-video-openchrome/src/Makefile.am
-@@ -86,6 +86,12 @@ EXTRA_DIST += \
+@@ -92,6 +92,12 @@ EXTRA_DIST += \
  endif
  
  
diff --git a/debian/patches/disable_ARGB_cursor_VM800.patch b/debian/patches/disable_ARGB_cursor_VM800.patch
index 5d80b53..562d3a4 100644
--- a/debian/patches/disable_ARGB_cursor_VM800.patch
+++ b/debian/patches/disable_ARGB_cursor_VM800.patch
@@ -1,12 +1,12 @@
-Index: xserver-xorg-video-openchrome-0.2.902+svn579/src/via_cursor.c
+Index: xserver-xorg-video-openchrome/src/via_cursor.c
 ===================================================================
---- xserver-xorg-video-openchrome-0.2.902+svn579.orig/src/via_cursor.c
-+++ xserver-xorg-video-openchrome-0.2.902+svn579/src/via_cursor.c
-@@ -545,6 +545,7 @@ viaCursorRecInit(ScrnInfoPtr pScrn)
+--- xserver-xorg-video-openchrome.orig/src/via_cursor.c
++++ xserver-xorg-video-openchrome/src/via_cursor.c
+@@ -552,6 +552,7 @@ viaCursorRecInit(ScrnInfoPtr pScrn)
              case VIA_CLE266:
              case VIA_KM400:
              case VIA_K8M800:
 +            case VIA_VM800:
-             case VIA_K8M890:
                  cursor->isARGBSupported = FALSE;
                  cursor->isARGBEnabled = FALSE;
+                 cursor->maxWidth = 32;
diff --git a/debian/patches/vt_fix.patch b/debian/patches/vt_fix.patch
index 8c30b59..21049ac 100644
--- a/debian/patches/vt_fix.patch
+++ b/debian/patches/vt_fix.patch
@@ -1,8 +1,8 @@
-Index: xserver-xorg-video-openchrome-0.2.902+svn579/src/via_mode.c
+Index: xserver-xorg-video-openchrome/src/via_mode.c
 ===================================================================
---- xserver-xorg-video-openchrome-0.2.902+svn579.orig/src/via_mode.c
-+++ xserver-xorg-video-openchrome-0.2.902+svn579/src/via_mode.c
-@@ -2026,10 +2026,13 @@ ViaLCDPower(ScrnInfoPtr pScrn, Bool On)
+--- xserver-xorg-video-openchrome.orig/src/via_mode.c
++++ xserver-xorg-video-openchrome/src/via_mode.c
+@@ -1410,10 +1410,13 @@ ViaLCDPower(ScrnInfoPtr pScrn, Bool On)
  #endif
  
      /* Enable LCD */

commit 736bef210d7377e5c44fd4bb0a71fdfe9217db51
Author: Raphael Geissert <atomo64@gmail.com>
Date:   Sat Nov 8 19:54:25 2008 -0600

    Add new changelog entry to reflect changes by upstream

diff --git a/debian/changelog b/debian/changelog
index f7d7977..a4135e4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+xserver-xorg-video-openchrome (1:0.2.903+svn685-1) UNRELEASED; urgency=low
+
+  * New upstream snapshot
+    + 682-685: Initial VX800 chipsets support
+    + 682: via_cursor.c: register corrections
+
+ -- Raphael Geissert <atomo64@gmail.com>  Sat, 08 Nov 2008 18:06:50 -0600
+
 xserver-xorg-video-openchrome (1:0.2.903+svn599-1) experimental; urgency=low
 
   [ Raphael Geissert ]

commit 74ad89c47148dd0261413f7e82535f76fad6c660
Author: jnettlet <jnettlet@e8d65cb0-85f4-0310-8831-c60e2a5ce829>
Date:   Tue Nov 4 17:14:15 2008 +0000

    fixed VX800 so ActiveDevice is no longer needed
    
    git-svn-id: http://svn.openchrome.org/svn/trunk@685 e8d65cb0-85f4-0310-8831-c60e2a5ce829

diff --git a/ChangeLog b/ChangeLog
index 046a0fc..ffee4e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-11-04  Jon Nettleton  <jon.nettleton@gmail.com>
+
+	* src/via_crtc.c: (ViaFirstCRTCSetMode), (ViaSecondCRTCSetMode):
+
+	Found needed register writes that are needed so VX800 doesn't
+	crash when CRT is not enabled.  I also removed NEEDS FIXING
+        comments from them as they are obviously needed.
+
 2008-11-03  Jon Nettleton  <jon.nettleton@gmail.com>
 
 	* src/via_accel.c: (viaSubsequentMono8x8PatternFillRect),
diff --git a/src/via_crtc.c b/src/via_crtc.c
index 3cf6e21..6b8a385 100644
--- a/src/via_crtc.c
+++ b/src/via_crtc.c
@@ -146,7 +146,6 @@ ViaFirstCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
             break;
     }
 
-    /* FIXME: check if this is really necessary here */
     switch (pVia->ChipId) {
         case VIA_K8M890:
         case VIA_CX700:
@@ -282,7 +281,6 @@ ViaFirstCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
     hwp->writeSeq(hwp, 0x1C, (temp >> 1) & 0xFF);
     ViaSeqMask(hwp, 0x1D, temp >> 9, 0x03);
 
-    /* FIXME: check if this is really necessary here */
     switch (pVia->ChipId) {
         case VIA_K8M890:
         case VIA_CX700:
@@ -405,6 +403,19 @@ ViaSecondCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
             break;
     }
 
+    switch (pVia->ChipId) {
+        case VIA_K8M890:
+        case VIA_CX700:
+        case VIA_P4M900:
+            break;
+        default:
+            ViaSeqMask(hwp, 0x16, 0x08, 0xBF);
+            ViaSeqMask(hwp, 0x17, 0x1F, 0xFF);
+            ViaSeqMask(hwp, 0x18, 0x4E, 0xFF);
+            ViaSeqMask(hwp, 0x1A, 0x08, 0xFD);
+            break;
+    }
+
     /* Crtc registers */
     /* horizontal total : 4096 */
     temp = mode->CrtcHTotal - 1;
@@ -474,6 +485,19 @@ ViaSecondCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
     temp = mode->CrtcVSyncEnd;
     ViaCrtcMask(hwp, 0x5F, temp, 0x1F);
 
+    switch (pVia->ChipId) {
+        case VIA_K8M890:
+        case VIA_CX700:
+        case VIA_P4M900:
+            break;
+        default:
+            /* some leftovers */
+            hwp->writeCrtc(hwp, 0x08, 0x00);
+            ViaCrtcMask(hwp, 0x32, 0, 0xFF);  /* ? */
+            ViaCrtcMask(hwp, 0x33, 0, 0xC8);
+            break;
+    }
+
     ViaSecondCRTCHorizontalOffset(pScrn);
     ViaSecondCRTCHorizontalQWCount(pScrn, mode->CrtcHDisplay);
 

commit f4745295ba579cab7d5a463259ab19f03e61902f
Author: jnettlet <jnettlet@e8d65cb0-85f4-0310-8831-c60e2a5ce829>
Date:   Tue Nov 4 02:53:37 2008 +0000

    finish acceleration changes for the VX800 chipsets
    
    git-svn-id: http://svn.openchrome.org/svn/trunk@684 e8d65cb0-85f4-0310-8831-c60e2a5ce829

diff --git a/ChangeLog b/ChangeLog
index ad9b010..046a0fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-11-03  Jon Nettleton  <jon.nettleton@gmail.com>
+
+	* src/via_accel.c: (viaSubsequentMono8x8PatternFillRect),
+	(viaSetupForSolidLine), (viaSubsequentSolidHorVertLine),
+	(viaSetupForDashedLine), (viaAccelMarkSync):
+
+	A few more acceleration tweaks for the VX800.  
+	This should fix all the XAA rendering issues.
+	This should also allow 800x480 Panels to work without
+	custom modelines.
+
 2008-11-02  Jon Nettleton  <jon.nettleton@gmail.com>
 
 	* src/via_accel.c: (viaFlushPCI), (viaDisableVQ),
diff --git a/src/via_accel.c b/src/via_accel.c
index 7eee90c..47fe9da 100644
--- a/src/via_accel.c
+++ b/src/via_accel.c
@@ -77,7 +77,8 @@ enum VIA_2D_Regs {
 	MONOPAT0,
 	MONOPAT1,
 	COLORPAT,
-	MONOPATFGC
+	MONOPATFGC,
+	MONOPATBGC
 };
 
 /* register offsets for old 2D core */
@@ -104,7 +105,8 @@ static const unsigned via_2d_regs[] = {
     [MONOPAT0]          = VIA_REG_MONOPAT0,
     [MONOPAT1]          = VIA_REG_MONOPAT1,
     [COLORPAT]          = VIA_REG_COLORPAT,
-    [MONOPATFGC]        = VIA_REG_FGCOLOR
+    [MONOPATFGC]        = VIA_REG_FGCOLOR,
+    [MONOPATBGC]        = VIA_REG_BGCOLOR
 };
 
 /* register offsets for new 2D core (M1 in VT3353 == VX800) */
@@ -131,7 +133,8 @@ static const unsigned via_2d_regs_m1[] = {
     [MONOPAT0]          = VIA_REG_MONOPAT0_M1,
     [MONOPAT1]          = VIA_REG_MONOPAT1_M1,
     [COLORPAT]          = VIA_REG_COLORPAT_M1,
-    [MONOPATFGC]        = VIA_REG_MONOPATFGC_M1
+    [MONOPATFGC]        = VIA_REG_MONOPATFGC_M1,
+    [MONOPATBGC]        = VIA_REG_MONOPATBGC_M1
 };
 
 #define VIA_REG(pVia, name)	(pVia)->TwodRegs[name]
@@ -861,8 +864,8 @@ viaSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patOffx,
     OUT_RING_H1(VIA_REG(pVia, DSTPOS), ((y - sub) << 16) | (x & 0xFFFF));
     OUT_RING_H1(VIA_REG(pVia, DIMENSION), (((h - 1) << 16) | (w - 1)));
     OUT_RING_H1(VIA_REG(pVia, PATADDR), patOffset);
-    OUT_RING_H1(VIA_REG(pVia, FGCOLOR), tdc->fgColor);
-    OUT_RING_H1(VIA_REG(pVia, BGCOLOR), tdc->bgColor);
+    OUT_RING_H1(VIA_REG(pVia, MONOPATFGC), tdc->fgColor);
+    OUT_RING_H1(VIA_REG(pVia, MONOPATBGC), tdc->bgColor);
     OUT_RING_H1(VIA_REG(pVia, MONOPAT0), tdc->pattern0);
     OUT_RING_H1(VIA_REG(pVia, MONOPAT1), tdc->pattern1);
     OUT_RING_H1(VIA_REG(pVia, GECMD), tdc->cmd);
@@ -1032,7 +1035,7 @@ viaSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop,
     BEGIN_RING(6);
     OUT_RING_H1(VIA_REG(pVia, GEMODE), tdc->mode);
     OUT_RING_H1(VIA_REG(pVia, MONOPAT0), 0xFF);
-    OUT_RING_H1(VIA_REG(pVia, FGCOLOR), tdc->fgColor);
+    OUT_RING_H1(VIA_REG(pVia, MONOPATFGC), tdc->fgColor);
 }
 
 static void
@@ -1113,17 +1116,17 @@ viaSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, int x, int y, int len, int dir)
     dstBase = pScrn->fbOffset + sub * pVia->Bpl;
 
     BEGIN_RING(10);
-    OUT_RING_H1(VIA_REG_DSTBASE, dstBase >> 3);
+    OUT_RING_H1(VIA_REG(pVia, DSTBASE), dstBase >> 3);
     viaPitchHelper(pVia, pVia->Bpl, 0);
 
     if (dir == DEGREES_0) {
-        OUT_RING_H1(VIA_REG_DSTPOS, ((y - sub) << 16) | (x & 0xFFFF));
-        OUT_RING_H1(VIA_REG_DIMENSION, (len - 1));
-        OUT_RING_H1(VIA_REG_GECMD, tdc->cmd | VIA_GEC_BLT);
+        OUT_RING_H1(VIA_REG(pVia, DSTPOS), ((y - sub) << 16) | (x & 0xFFFF));
+        OUT_RING_H1(VIA_REG(pVia, DIMENSION), (len - 1));
+        OUT_RING_H1(VIA_REG(pVia, GECMD), tdc->cmd | VIA_GEC_BLT);
     } else {
-        OUT_RING_H1(VIA_REG_DSTPOS, ((y - sub) << 16) | (x & 0xFFFF));
-        OUT_RING_H1(VIA_REG_DIMENSION, ((len - 1) << 16));
-        OUT_RING_H1(VIA_REG_GECMD, tdc->cmd | VIA_GEC_BLT);
+        OUT_RING_H1(VIA_REG(pVia, DSTPOS), ((y - sub) << 16) | (x & 0xFFFF));
+        OUT_RING_H1(VIA_REG(pVia, DIMENSION), ((len - 1) << 16));
+        OUT_RING_H1(VIA_REG(pVia, GECMD), tdc->cmd | VIA_GEC_BLT);
     }
     ADVANCE_RING;
 }
@@ -1166,10 +1169,10 @@ viaSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop,
     tdc->dashed = TRUE;
 
     BEGIN_RING(8);
-    OUT_RING_H1(VIA_REG_GEMODE, tdc->mode);
-    OUT_RING_H1(VIA_REG_FGCOLOR, tdc->fgColor);
-    OUT_RING_H1(VIA_REG_BGCOLOR, tdc->bgColor);
-    OUT_RING_H1(VIA_REG_MONOPAT0, tdc->pattern0);
+    OUT_RING_H1(VIA_REG(pVia, GEMODE), tdc->mode);
+    OUT_RING_H1(VIA_REG(pVia, MONOPATFGC), tdc->fgColor);
+    OUT_RING_H1(VIA_REG(pVia, MONOPATBGC), tdc->bgColor);
+    OUT_RING_H1(VIA_REG(pVia, MONOPAT0), tdc->pattern0);
 }
 
 static void
@@ -1308,7 +1311,7 @@ viaAccelMarkSync(ScreenPtr pScreen)
 
     if (pVia->agpDMA) {
         BEGIN_RING(2);
-        OUT_RING_H1(VIA_REG_KEYCONTROL, 0x00);
+        OUT_RING_H1(VIA_REG(pVia, KEYCONTROL), 0x00);
         viaAccelSolidHelper(pVia, 0, 0, 1, 1, pVia->markerOffset,
                             VIA_GEM_32bpp, 4, pVia->curMarker,
                             (0xF0 << 24) | VIA_GEC_BLT | VIA_GEC_FIXCOLOR_PAT);

commit e8d8aa3617941bc79e2f89fc05bcfe989ad7ddda
Author: schlobinux <schlobinux@e8d65cb0-85f4-0310-8831-c60e2a5ce829>
Date:   Mon Nov 3 11:13:18 2008 +0000

    redo a couple changes lost in initial VX800 support commit
    
    git-svn-id: http://svn.openchrome.org/svn/trunk@683 e8d65cb0-85f4-0310-8831-c60e2a5ce829

diff --git a/src/via_accel.c b/src/via_accel.c
index 0bf9390..7eee90c 100644
--- a/src/via_accel.c
+++ b/src/via_accel.c
@@ -1275,7 +1275,7 @@ viaInitXAA(ScreenPtr pScreen)
 
     if (pVia->Chipset != VIA_K8M800 &&
         pVia->Chipset != VIA_K8M890 &&
-        pVia->Chipset != VIA_P4M900) 
+        pVia->Chipset != VIA_P4M900)
         xaaptr->ImageWriteFlags |= NO_GXCOPY;
 
     xaaptr->SetupForImageWrite = viaSetupForImageWrite;
diff --git a/src/via_driver.c b/src/via_driver.c
index 07078d0..c73893e 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -1223,7 +1223,7 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
             } else {
                 from = X_DEFAULT;
                 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-                           "No memory-detection done.  Use VideoRAM option.\n");
+                           "No memory-detection done. Use VideoRAM option.\n");
             }
     }
 
diff --git a/src/via_id.c b/src/via_id.c
index 5b4c7d4..374f988 100644
--- a/src/via_id.c
+++ b/src/via_id.c
@@ -87,6 +87,7 @@ static struct ViaCardIdStruct ViaCardId[] = {
     {"Asustek K8V-MX",                        VIA_K8M800,  0x1043, 0x8129, VIA_DEVICE_CRT},
     {"Mitac 8399",                            VIA_K8M800,  0x1071, 0x8399, VIA_DEVICE_CRT | VIA_DEVICE_LCD | VIA_DEVICE_TV}, /* aka "Pogolinux Konabook 3100" */
     {"Mitac 8889",                            VIA_K8M800,  0x1071, 0x8889, VIA_DEVICE_CRT | VIA_DEVICE_LCD | VIA_DEVICE_TV},
+    {"MSI K8M Neo-V (broken pci id)",         VIA_K8M800,  0x1106, 0x0204, VIA_DEVICE_CRT},
     {"VIA VT3108 (K8M800)",                   VIA_K8M800,  0x1106, 0x3108, VIA_DEVICE_CRT}, /* borrowed by Asustek A8V-MX */ 
     {"Shuttle FX21",                          VIA_K8M800,  0x1297, 0x3052, VIA_DEVICE_CRT},
     {"Shuttle FX83",                          VIA_K8M800,  0x1297, 0xF683, VIA_DEVICE_CRT | VIA_DEVICE_TV},
@@ -191,7 +192,7 @@ static struct ViaCardIdStruct ViaCardId[] = {
     {"ASRock P4VM900-SATA2",                  VIA_P4M900,  0x1849, 0x3371, VIA_DEVICE_CRT},
 
     /*** CX700 ***/
-    {"VIA VT8454B",                           VIA_CX700,   0x0908, 0x1975, VIA_DEVICE_CRT}, /* Evaluation board, reference possibly wrong */
+    {"VIA VT8454B",                           VIA_CX700,   0x0908, 0x1975, VIA_DEVICE_CRT | VIA_DEVICE_LCD}, /* Evaluation board, reference possibly wrong */
     {"VIA VT3324 (CX700)",                    VIA_CX700,   0x1106, 0x3157, VIA_DEVICE_CRT},
     {"MSI Fuzzy CX700/CX700D",                VIA_CX700,   0x1462, 0x8020, VIA_DEVICE_CRT | VIA_DEVICE_LCD | VIA_DEVICE_TV},
     {"Samsung Q1B",                           VIA_CX700,   0x144D, 0xC02C, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
diff --git a/src/via_mode.h b/src/via_mode.h
index 5290e02..eb98f49 100644
--- a/src/via_mode.h
+++ b/src/via_mode.h
@@ -32,7 +32,7 @@
  */
 #define VIA_BW_MIN       74000000 /* > 640x480@60Hz@32bpp */
 #define VIA_BW_DDR200   394000000
-#define VIA_BW_DDR400   461000000
+#define VIA_BW_DDR400   498000000 /* > 1920x1080@60Hz@32bpp */
 #define VIA_BW_DDR667   922000000
 
     

commit cc7dfe3ab5ce9e667dd0a3cb92967e5558beecbc
Author: jnettlet <jnettlet@e8d65cb0-85f4-0310-8831-c60e2a5ce829>
Date:   Mon Nov 3 04:37:00 2008 +0000

    Initial VX800 support thanks to work mostly done by Xavier and Harald
    
    git-svn-id: http://svn.openchrome.org/svn/trunk@682 e8d65cb0-85f4-0310-8831-c60e2a5ce829

diff --git a/ChangeLog b/ChangeLog
index 2b44e61..ad9b010 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,50 @@
+2008-11-02  Jon Nettleton  <jon.nettleton@gmail.com>
+
+	* src/via_accel.c: (viaFlushPCI), (viaDisableVQ),
+	(viaInitialize2DEngine), (viaAccelSync), (viaPitchHelper),
+	(viaAccelClippingHelper), (viaAccelSolidHelper),
+	(viaAccelTransparentHelper), (viaAccelCopyHelper),
+	(viaSetupForScreenToScreenCopy), (viaSubsequentScreenToScreenCopy),
+	(viaSetupForSolidFill), (viaSubsequentSolidFillRect),
+	(viaSetupForMono8x8PatternFill),
+	(viaSubsequentMono8x8PatternFillRect),
+	(viaSetupForColor8x8PatternFill),
+	(viaSubsequentColor8x8PatternFillRect),
+	(viaSetupForCPUToScreenColorExpandFill),
+	(viaSubsequentScanlineCPUToScreenColorExpandFill),
+	(viaSetupForImageWrite), (viaSubsequentImageWriteRect),
+	(viaSetupForSolidLine), (viaSubsequentSolidTwoPointLine),
+	(viaSubsequentSolidHorVertLine), (viaSetupForDashedLine),
+	(viaInitXAA), (viaAccelMarkSync), (viaExaPrepareSolid),
+	(viaExaSolid), (viaExaPrepareCopy), (viaExaCopy):
+	* src/via_bandwidth.c: (ViaSetPrimaryFIFO), (ViaSetSecondaryFIFO):
+	* src/via_cursor.c: (viaCursorARGBInit), (viaCursorARGBShow),
+	(viaCursorARGBHide), (viaCursorARGBSetPosition),
+	(viaCursorRecInit):
+	* src/via_driver.c: (VIASetupDefaultOptions), (VIAPreInit),
+	(VIALeaveVT), (VIACloseScreen):
+	* src/via_driver.h:
+	* src/via_id.c:
+	* src/via_id.h:
+	* src/via_mode.c: (ViaOutputsSelect), (VIAGetPanelSize),
+	(ViaPanelGetIndex):
+	* src/via_mode.h:
+	* src/via_panel.c: (ViaPanelPreInit):
+	* src/via_regs.h:
+	* src/via_swov.c: (VIAVidHWDiffInit), (viaCalculateVideoColor),
+	(viaSetColorSpace), (ViaInitVideoStatusFlag), (ViaSetVidCtl),
+	(SetFIFO_V3_64or32or32), (SetFIFO_V3_64or32or16):
+	* src/via_video.c: (viaInitVideo):
+
+        Initial support for the VX800 chipset.  This is based off the
+        Basic chipset support work of Xavier Bachelot and the inital
+        Acceleration work done by Harald Welte.  I verified the changes
+        based off the most recent VIA codebaase and fixed a couple of
+        rendering issues.
+
+        Still needs more work on EXA ( font rendering glitches ) and
+        XVideo.
+
 2008-05-26  Gabriel Mansi <gabriel.mansi@gmail.com>
 
 	* src/Makefile.am:
diff --git a/src/via_accel.c b/src/via_accel.c
index e4bd815..0bf9390 100644
--- a/src/via_accel.c
+++ b/src/via_accel.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
+ * Copyright 1998-2008 VIA Technologies, Inc. All Rights Reserved.
  * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
  * Copyright 2006 Thomas Hellström. All Rights Reserved.
  *
@@ -52,6 +52,90 @@
 #define VIAACCELCOPYROP(vRop) (XAACopyROP[vRop] << 24)
 #endif
 
+enum VIA_2D_Regs {
+	GECMD,
+	GEMODE,
+	GESTATUS,
+	SRCPOS,
+	DSTPOS,
+	LINE_K1K2,
+	LINE_XY,
+	DIMENSION,
+	PATADDR,
+	FGCOLOR,
+	DSTCOLORKEY,
+	BGCOLOR,
+	SRCCOLORKEY,
+	CLIPTL,
+	CLIPBR,
+	OFFSET,
+	LINE_ERROR,
+	KEYCONTROL,
+	SRCBASE,
+	DSTBASE,
+	PITCH,
+	MONOPAT0,
+	MONOPAT1,
+	COLORPAT,
+	MONOPATFGC
+};
+
+/* register offsets for old 2D core */
+static const unsigned via_2d_regs[] = {
+    [GECMD]             = VIA_REG_GECMD,
+    [GEMODE]            = VIA_REG_GEMODE,
+    [GESTATUS]          = VIA_REG_GESTATUS,
+    [SRCPOS]            = VIA_REG_SRCPOS,
+    [DSTPOS]            = VIA_REG_DSTPOS,
+    [LINE_K1K2]         = VIA_REG_LINE_K1K2,
+    [LINE_XY]           = VIA_REG_LINE_XY,
+    [DIMENSION]         = VIA_REG_DIMENSION,
+    [PATADDR]           = VIA_REG_PATADDR,
+    [FGCOLOR]           = VIA_REG_FGCOLOR,
+    [DSTCOLORKEY]       = VIA_REG_DSTCOLORKEY,
+    [BGCOLOR]           = VIA_REG_BGCOLOR,
+    [SRCCOLORKEY]       = VIA_REG_SRCCOLORKEY,
+    [CLIPTL]            = VIA_REG_CLIPTL,
+    [CLIPBR]            = VIA_REG_CLIPBR,
+    [KEYCONTROL]        = VIA_REG_KEYCONTROL,
+    [SRCBASE]           = VIA_REG_SRCBASE,
+    [DSTBASE]           = VIA_REG_DSTBASE,
+    [PITCH]             = VIA_REG_PITCH,
+    [MONOPAT0]          = VIA_REG_MONOPAT0,
+    [MONOPAT1]          = VIA_REG_MONOPAT1,
+    [COLORPAT]          = VIA_REG_COLORPAT,
+    [MONOPATFGC]        = VIA_REG_FGCOLOR
+};
+
+/* register offsets for new 2D core (M1 in VT3353 == VX800) */
+static const unsigned via_2d_regs_m1[] = {
+    [GECMD]             = VIA_REG_GECMD_M1,
+    [GEMODE]            = VIA_REG_GEMODE_M1,
+    [GESTATUS]          = VIA_REG_GESTATUS_M1,
+    [SRCPOS]            = VIA_REG_SRCPOS_M1,
+    [DSTPOS]            = VIA_REG_DSTPOS_M1,
+    [LINE_K1K2]         = VIA_REG_LINE_K1K2_M1,
+    [LINE_XY]           = VIA_REG_LINE_XY_M1,
+    [DIMENSION]         = VIA_REG_DIMENSION_M1,
+    [PATADDR]           = VIA_REG_PATADDR_M1,
+    [FGCOLOR]           = VIA_REG_FGCOLOR_M1,
+    [DSTCOLORKEY]       = VIA_REG_DSTCOLORKEY_M1,
+    [BGCOLOR]           = VIA_REG_BGCOLOR_M1,
+    [SRCCOLORKEY]       = VIA_REG_SRCCOLORKEY_M1,
+    [CLIPTL]            = VIA_REG_CLIPTL_M1,
+    [CLIPBR]            = VIA_REG_CLIPBR_M1,
+    [KEYCONTROL]        = VIA_REG_KEYCONTROL_M1,
+    [SRCBASE]           = VIA_REG_SRCBASE_M1,
+    [DSTBASE]           = VIA_REG_DSTBASE_M1,
+    [PITCH]             = VIA_REG_PITCH_M1,
+    [MONOPAT0]          = VIA_REG_MONOPAT0_M1,
+    [MONOPAT1]          = VIA_REG_MONOPAT1_M1,
+    [COLORPAT]          = VIA_REG_COLORPAT_M1,
+    [MONOPATFGC]        = VIA_REG_MONOPATFGC_M1
+};
+
+#define VIA_REG(pVia, name)	(pVia)->TwodRegs[name]
+
 /*
  * Use PCI MMIO to flush the command buffer when AGP DMA is not available.
  */
@@ -106,7 +190,8 @@ viaFlushPCI(ViaCommandBuffer * buf)
                      */
                     if (pVia->Chipset != VIA_P4M890 &&
                         pVia->Chipset != VIA_K8M890 &&
-                        pVia->Chipset != VIA_P4M900) {
+                        pVia->Chipset != VIA_P4M900 &&
+                        pVia->Chipset != VIA_VX800) {
                         while (!(VIAGETREG(VIA_REG_STATUS) & VIA_VR_QUEUE_BUSY)
                                && (loop++ < MAXLOOP)) ;
                     }
@@ -316,6 +401,7 @@ viaDisableVQ(ScrnInfoPtr pScrn)
     switch (pVia->Chipset) {
         case VIA_P4M890:
         case VIA_K8M890:
+        case VIA_VX800:
             VIASETREG(0x41c, 0x00100000);
             VIASETREG(0x420, 0x74301000);
             break;
@@ -367,10 +453,26 @@ viaInitialize2DEngine(ScrnInfoPtr pScrn)
     int i;
 
     /* Initialize the 2D engine registers to reset the 2D engine. */
-    for (i = 0x04; i < 0x44; i += 4) {
+    for (i = 0x04; i < 0x40; i += 4) {
         VIASETREG(i, 0x0);
     }
 
+    if (pVia->Chipset != VIA_VX800) {
+        for (i = 0x44; i < 0x5c; i += 4) {
+            VIASETREG(i, 0x0);
+        }
+    }
+
+    /* Make the VIA_REG() macro magic work */
+    switch (pVia->Chipset) {
+    case VIA_VX800:
+        pVia->TwodRegs = via_2d_regs_m1;
+        break;
+    default:
+        pVia->TwodRegs = via_2d_regs;
+        break;
+    }
+
     switch (pVia->Chipset) {
         case VIA_K8M890:
             viaInitPCIe(pVia);
@@ -408,6 +510,11 @@ viaAccelSync(ScrnInfoPtr pScrn)
     mem_barrier();
 
     switch (pVia->Chipset) {
+        case VIA_VX800:
+            while ((VIAGETREG(VIA_REG_STATUS) &
+                    (VIA_CMD_RGTR_BUSY_H5 | VIA_2D_ENG_BUSY_H5 | VIA_3D_ENG_BUSY_H5))
+                   && (loop++ < MAXLOOP)) ;
+            break;
         case VIA_P4M890:
         case VIA_K8M890:
         case VIA_P4M900:
@@ -455,18 +562,40 @@ viaDisableClipping(ScrnInfoPtr pScrn)
 }
 
 /*
+ * This is a small helper to wrap around a PITCH register write
+ * to deal with the sublte differences of M1 and old 2D engine
+ */
+static void
+viaPitchHelper(VIAPtr pVia, unsigned dstPitch, unsigned srcPitch)
+{
+    unsigned val = (dstPitch >> 3) << 16 | (srcPitch >> 3);
+    RING_VARS;
+
+    if (pVia->Chipset != VIA_VX800) {
+        val |= VIA_PITCH_ENABLE;
+    }
+    OUT_RING_H1(VIA_REG(pVia, PITCH), val);
+}
+
+/*
  * Emit clipping borders to the command buffer and update the 2D context
  * current command with clipping info.
  */
 static int
-viaAccelClippingHelper(ViaCommandBuffer * cb, int refY, ViaTwodContext * tdc)
+viaAccelClippingHelper(VIAPtr pVia, int refY)
 {
+    ViaTwodContext *tdc = &pVia->td;
+
+    RING_VARS;
+
     if (tdc->clipping) {
         refY = (refY < tdc->clipY1) ? refY : tdc->clipY1;
         tdc->cmd |= VIA_GEC_CLIP_ENABLE;
         BEGIN_RING(4);
-        OUT_RING_H1(VIA_REG_CLIPTL, ((tdc->clipY1 - refY) << 16) | tdc->clipX1);
-        OUT_RING_H1(VIA_REG_CLIPBR, ((tdc->clipY2 - refY) << 16) | tdc->clipX2);
+        OUT_RING_H1(VIA_REG(pVia, CLIPTL),
+                    ((tdc->clipY1 - refY) << 16) | tdc->clipX1);
+        OUT_RING_H1(VIA_REG(pVia, CLIPBR),
+		    ((tdc->clipY2 - refY) << 16) | tdc->clipX2);
     } else {
         tdc->cmd &= ~VIA_GEC_CLIP_ENABLE;
     }
@@ -477,18 +606,20 @@ viaAccelClippingHelper(ViaCommandBuffer * cb, int refY, ViaTwodContext * tdc)
  * Emit a solid blit operation to the command buffer. 
  */
 static void
-viaAccelSolidHelper(ViaCommandBuffer * cb, int x, int y, int w, int h,
+viaAccelSolidHelper(VIAPtr pVia, int x, int y, int w, int h,
                     unsigned fbBase, CARD32 mode, unsigned pitch,
                     CARD32 fg, CARD32 cmd)
 {
+    RING_VARS;
+
     BEGIN_RING(14);
-    OUT_RING_H1(VIA_REG_GEMODE, mode);
-    OUT_RING_H1(VIA_REG_DSTBASE, fbBase >> 3);
-    OUT_RING_H1(VIA_REG_PITCH, VIA_PITCH_ENABLE | (pitch >> 3) << 16);
-    OUT_RING_H1(VIA_REG_DSTPOS, (y << 16) | (x & 0xFFFF));
-    OUT_RING_H1(VIA_REG_DIMENSION, ((h - 1) << 16) | (w - 1));
-    OUT_RING_H1(VIA_REG_FGCOLOR, fg);
-    OUT_RING_H1(VIA_REG_GECMD, cmd);
+    OUT_RING_H1(VIA_REG(pVia, GEMODE), mode);
+    OUT_RING_H1(VIA_REG(pVia, DSTBASE), fbBase >> 3);
+    viaPitchHelper(pVia, pitch, 0);
+    OUT_RING_H1(VIA_REG(pVia, DSTPOS), (y << 16) | (x & 0xFFFF));
+    OUT_RING_H1(VIA_REG(pVia, DIMENSION), ((h - 1) << 16) | (w - 1));
+    OUT_RING_H1(VIA_REG(pVia, MONOPATFGC), fg);
+    OUT_RING_H1(VIA_REG(pVia, GECMD), cmd);
 }
 
 /*
@@ -534,16 +665,19 @@ viaAccelPlaneMaskHelper(ViaTwodContext * tdc, CARD32 planeMask)
  * Emit transparency state and color to the command buffer.
  */
 static void
-viaAccelTransparentHelper(ViaTwodContext * tdc, ViaCommandBuffer * cb,
-                          CARD32 keyControl, CARD32 transColor,
-                          Bool usePlaneMask)
+viaAccelTransparentHelper(VIAPtr pVia, CARD32 keyControl,
+                          CARD32 transColor, Bool usePlaneMask)
 {
+    ViaTwodContext *tdc = &pVia->td;
+
+    RING_VARS;
+
     tdc->keyControl &= ((usePlaneMask) ? 0xF0000000 : 0x00000000);
     tdc->keyControl |= (keyControl & 0x0FFFFFFF);
     BEGIN_RING(4);
-    OUT_RING_H1(VIA_REG_KEYCONTROL, tdc->keyControl);
+    OUT_RING_H1(VIA_REG(pVia, KEYCONTROL), tdc->keyControl);
     if (keyControl) {
-        OUT_RING_H1(VIA_REG_SRCCOLORKEY, transColor);
+        OUT_RING_H1(VIA_REG(pVia, SRCCOLORKEY), transColor);
     }
 }
 
@@ -551,11 +685,13 @@ viaAccelTransparentHelper(ViaTwodContext * tdc, ViaCommandBuffer * cb,
  * Emit a copy blit operation to the command buffer.
  */
 static void
-viaAccelCopyHelper(ViaCommandBuffer * cb, int xs, int ys, int xd, int yd,
+viaAccelCopyHelper(VIAPtr pVia, int xs, int ys, int xd, int yd,
                    int w, int h, unsigned srcFbBase, unsigned dstFbBase,
                    CARD32 mode, unsigned srcPitch, unsigned dstPitch,
                    CARD32 cmd)
 {
+    RING_VARS;
+
     if (cmd & VIA_GEC_DECY) {
         ys += h - 1;
         yd += h - 1;
@@ -567,15 +703,14 @@ viaAccelCopyHelper(ViaCommandBuffer * cb, int xs, int ys, int xd, int yd,
     }
 
     BEGIN_RING(16);
-    OUT_RING_H1(VIA_REG_GEMODE, mode);
-    OUT_RING_H1(VIA_REG_SRCBASE, srcFbBase >> 3);
-    OUT_RING_H1(VIA_REG_DSTBASE, dstFbBase >> 3);
-    OUT_RING_H1(VIA_REG_PITCH, VIA_PITCH_ENABLE |
-                ((dstPitch >> 3) << 16) | (srcPitch >> 3));
-    OUT_RING_H1(VIA_REG_SRCPOS, (ys << 16) | (xs & 0xFFFF));
-    OUT_RING_H1(VIA_REG_DSTPOS, (yd << 16) | (xd & 0xFFFF));
-    OUT_RING_H1(VIA_REG_DIMENSION, ((h - 1) << 16) | (w - 1));
-    OUT_RING_H1(VIA_REG_GECMD, cmd);
+    OUT_RING_H1(VIA_REG(pVia, GEMODE), mode);
+    OUT_RING_H1(VIA_REG(pVia, SRCBASE), srcFbBase >> 3);
+    OUT_RING_H1(VIA_REG(pVia, DSTBASE), dstFbBase >> 3);
+    viaPitchHelper(pVia, dstPitch, srcPitch);
+    OUT_RING_H1(VIA_REG(pVia, SRCPOS), (ys << 16) | (xs & 0xFFFF));
+    OUT_RING_H1(VIA_REG(pVia, DSTPOS), (yd << 16) | (xd & 0xFFFF));
+    OUT_RING_H1(VIA_REG(pVia, DIMENSION), ((h - 1) << 16) | (w - 1));
+    OUT_RING_H1(VIA_REG(pVia, GECMD), cmd);
 }
 
 /*
@@ -603,7 +738,7 @@ viaSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop,
         cmd |= VIA_GEC_DECY;
 
     tdc->cmd = cmd;
-    viaAccelTransparentHelper(tdc, cb, (trans_color != -1) ? 0x4000 : 0x0000,
+    viaAccelTransparentHelper(pVia, (trans_color != -1) ? 0x4000 : 0x0000,
                               trans_color, FALSE);
 }
 
@@ -620,8 +755,8 @@ viaSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1,
     if (!w || !h)
         return;
 
-    sub = viaAccelClippingHelper(cb, y2, tdc);
-    viaAccelCopyHelper(cb, x1, 0, x2, y2 - sub, w, h,
+    sub = viaAccelClippingHelper(pVia, y2);
+    viaAccelCopyHelper(pVia, x1, 0, x2, y2 - sub, w, h,
                        pScrn->fbOffset + pVia->Bpl * y1,
                        pScrn->fbOffset + pVia->Bpl * sub,
                        tdc->mode, pVia->Bpl, pVia->Bpl, tdc->cmd);
@@ -641,7 +776,7 @@ viaSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, unsigned planemask)
 
     tdc->cmd = VIA_GEC_BLT | VIA_GEC_FIXCOLOR_PAT | VIAACCELPATTERNROP(rop);
     tdc->fgColor = color;
-    viaAccelTransparentHelper(tdc, cb, 0x00, 0x00, FALSE);
+    viaAccelTransparentHelper(pVia, 0x00, 0x00, FALSE);
 }
 
 static void
@@ -656,8 +791,8 @@ viaSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h)
     if (!w || !h)
         return;
 
-    sub = viaAccelClippingHelper(cb, y, tdc);
-    viaAccelSolidHelper(cb, x, y - sub, w, h,
+    sub = viaAccelClippingHelper(pVia, y);
+    viaAccelSolidHelper(pVia, x, y - sub, w, h,
                         pScrn->fbOffset + pVia->Bpl * sub, tdc->mode, pVia->Bpl,
                         tdc->fgColor, tdc->cmd);
     ADVANCE_RING;
@@ -697,7 +832,7 @@ viaSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int pattern0, int pattern1,
     tdc->bgColor = bg;
     tdc->pattern0 = pattern0;
     tdc->pattern1 = pattern1;
-    viaAccelTransparentHelper(tdc, cb, 0x00, 0x00, FALSE);
+    viaAccelTransparentHelper(pVia, 0x00, 0x00, FALSE);
 }
 
 static void
@@ -716,21 +851,21 @@ viaSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patOffx,
         return;
 
     patOffset = ((patOffy & 0x7) << 29) | ((patOffx & 0x7) << 26);
-    sub = viaAccelClippingHelper(cb, y, tdc);
+    sub = viaAccelClippingHelper(pVia, y);
     dstBase = pScrn->fbOffset + sub * pVia->Bpl;
 
     BEGIN_RING(22);
-    OUT_RING_H1(VIA_REG_GEMODE, tdc->mode);
-    OUT_RING_H1(VIA_REG_DSTBASE, dstBase >> 3);
-    OUT_RING_H1(VIA_REG_PITCH, VIA_PITCH_ENABLE | ((pVia->Bpl >> 3) << 16));
-    OUT_RING_H1(VIA_REG_DSTPOS, ((y - sub) << 16) | (x & 0xFFFF));
-    OUT_RING_H1(VIA_REG_DIMENSION, (((h - 1) << 16) | (w - 1)));
-    OUT_RING_H1(VIA_REG_PATADDR, patOffset);
-    OUT_RING_H1(VIA_REG_FGCOLOR, tdc->fgColor);
-    OUT_RING_H1(VIA_REG_BGCOLOR, tdc->bgColor);
-    OUT_RING_H1(VIA_REG_MONOPAT0, tdc->pattern0);
-    OUT_RING_H1(VIA_REG_MONOPAT1, tdc->pattern1);
-    OUT_RING_H1(VIA_REG_GECMD, tdc->cmd);
+    OUT_RING_H1(VIA_REG(pVia, GEMODE), tdc->mode);
+    OUT_RING_H1(VIA_REG(pVia, DSTBASE), dstBase >> 3);
+    viaPitchHelper(pVia, pVia->Bpl, 0);
+    OUT_RING_H1(VIA_REG(pVia, DSTPOS), ((y - sub) << 16) | (x & 0xFFFF));
+    OUT_RING_H1(VIA_REG(pVia, DIMENSION), (((h - 1) << 16) | (w - 1)));
+    OUT_RING_H1(VIA_REG(pVia, PATADDR), patOffset);
+    OUT_RING_H1(VIA_REG(pVia, FGCOLOR), tdc->fgColor);
+    OUT_RING_H1(VIA_REG(pVia, BGCOLOR), tdc->bgColor);
+    OUT_RING_H1(VIA_REG(pVia, MONOPAT0), tdc->pattern0);
+    OUT_RING_H1(VIA_REG(pVia, MONOPAT1), tdc->pattern1);
+    OUT_RING_H1(VIA_REG(pVia, GECMD), tdc->cmd);
     ADVANCE_RING;
 }
 
@@ -745,7 +880,7 @@ viaSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny,
 
     tdc->cmd = VIA_GEC_BLT | VIAACCELPATTERNROP(rop);
     tdc->patternAddr = (patternx * pVia->Bpp + patterny * pVia->Bpl);
-    viaAccelTransparentHelper(tdc, cb, (trans_color != -1) ? 0x4000 : 0x0000,
+    viaAccelTransparentHelper(pVia, (trans_color != -1) ? 0x4000 : 0x0000,
                               trans_color, FALSE);
 }
 
@@ -766,17 +901,17 @@ viaSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patOffx,
 
     patAddr = (tdc->patternAddr >> 3) |
             ((patOffy & 0x7) << 29) | ((patOffx & 0x7) << 26);
-    sub = viaAccelClippingHelper(cb, y, tdc);
+    sub = viaAccelClippingHelper(pVia, y);
     dstBase = pScrn->fbOffset + sub * pVia->Bpl;
 
     BEGIN_RING(14);
-    OUT_RING_H1(VIA_REG_GEMODE, tdc->mode);
-    OUT_RING_H1(VIA_REG_DSTBASE, dstBase >> 3);
-    OUT_RING_H1(VIA_REG_PITCH, VIA_PITCH_ENABLE | ((pVia->Bpl >> 3) << 16));
-    OUT_RING_H1(VIA_REG_DSTPOS, ((y - sub) << 16) | (x & 0xFFFF));
-    OUT_RING_H1(VIA_REG_DIMENSION, (((h - 1) << 16) | (w - 1)));
-    OUT_RING_H1(VIA_REG_PATADDR, patAddr);
-    OUT_RING_H1(VIA_REG_GECMD, tdc->cmd);
+    OUT_RING_H1(VIA_REG(pVia, GEMODE), tdc->mode);
+    OUT_RING_H1(VIA_REG(pVia, DSTBASE), dstBase >> 3);
+    viaPitchHelper(pVia, pVia->Bpl, 0);
+    OUT_RING_H1(VIA_REG(pVia, DSTPOS), ((y - sub) << 16) | (x & 0xFFFF));
+    OUT_RING_H1(VIA_REG(pVia, DIMENSION), (((h - 1) << 16) | (w - 1)));
+    OUT_RING_H1(VIA_REG(pVia, PATADDR), patAddr);
+    OUT_RING_H1(VIA_REG(pVia, GECMD), tdc->cmd);
     ADVANCE_RING;
 }
 
@@ -810,7 +945,7 @@ viaSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg,
 
     ADVANCE_RING;
 
-    viaAccelTransparentHelper(tdc, cb, 0x0, 0x0, FALSE);
+    viaAccelTransparentHelper(pVia, 0x0, 0x0, FALSE);
 }
 
 static void
@@ -829,11 +964,11 @@ viaSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x,
                                 (y + h - 1));
     }
 
-    sub = viaAccelClippingHelper(cb, y, tdc);
+    sub = viaAccelClippingHelper(pVia, y);
     BEGIN_RING(4);
-    OUT_RING_H1(VIA_REG_BGCOLOR, tdc->bgColor);
-    OUT_RING_H1(VIA_REG_FGCOLOR, tdc->fgColor);
-    viaAccelCopyHelper(cb, 0, 0, x, y - sub, w, h, 0,
+    OUT_RING_H1(VIA_REG(pVia, BGCOLOR), tdc->bgColor);
+    OUT_RING_H1(VIA_REG(pVia, FGCOLOR), tdc->fgColor);
+    viaAccelCopyHelper(pVia, 0, 0, x, y - sub, w, h, 0,
                        pScrn->fbOffset + sub * pVia->Bpl, tdc->mode,
                        pVia->Bpl, pVia->Bpl, tdc->cmd);
 
@@ -852,7 +987,7 @@ viaSetupForImageWrite(ScrnInfoPtr pScrn, int rop, unsigned planemask,
 
     tdc->cmd = VIA_GEC_BLT | VIA_GEC_SRC_SYS | VIAACCELCOPYROP(rop);
     ADVANCE_RING;
-    viaAccelTransparentHelper(tdc, cb, (trans_color != -1) ? 0x4000 : 0x0000,
+    viaAccelTransparentHelper(pVia, (trans_color != -1) ? 0x4000 : 0x0000,
                               trans_color, FALSE);
 }
 
@@ -871,8 +1006,8 @@ viaSubsequentImageWriteRect(ScrnInfoPtr pScrn, int x, int y, int w, int h,
                                 (y + h - 1));
     }
 
-    sub = viaAccelClippingHelper(cb, y, tdc);
-    viaAccelCopyHelper(cb, 0, 0, x, y - sub, w, h, 0,
+    sub = viaAccelClippingHelper(pVia, y);
+    viaAccelCopyHelper(pVia, 0, 0, x, y - sub, w, h, 0,
                        pScrn->fbOffset + pVia->Bpl * sub, tdc->mode,
                        pVia->Bpl, pVia->Bpl, tdc->cmd);
 
@@ -889,15 +1024,15 @@ viaSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop,
 
     RING_VARS;
 
-    viaAccelTransparentHelper(tdc, cb, 0x00, 0x00, FALSE);
+    viaAccelTransparentHelper(pVia, 0x00, 0x00, FALSE);
     tdc->cmd = VIA_GEC_FIXCOLOR_PAT | VIAACCELPATTERNROP(rop);
     tdc->fgColor = color;
     tdc->dashed = FALSE;
 
     BEGIN_RING(6);
-    OUT_RING_H1(VIA_REG_GEMODE, tdc->mode);
-    OUT_RING_H1(VIA_REG_MONOPAT0, 0xFF);
-    OUT_RING_H1(VIA_REG_FGCOLOR, tdc->fgColor);
+    OUT_RING_H1(VIA_REG(pVia, GEMODE), tdc->mode);
+    OUT_RING_H1(VIA_REG(pVia, MONOPAT0), 0xFF);
+    OUT_RING_H1(VIA_REG(pVia, FGCOLOR), tdc->fgColor);
 }
 
 static void
@@ -912,7 +1047,7 @@ viaSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1,
 
     RING_VARS;
 
-    sub = viaAccelClippingHelper(cb, (y1 < y2) ? y1 : y2, tdc);
+    sub = viaAccelClippingHelper(pVia, (y1 < y2) ? y1 : y2);
     cmd = tdc->cmd | VIA_GEC_LINE;
 
     dx = x2 - x1;
@@ -944,8 +1079,8 @@ viaSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1,
     y2 -= sub;
 
     BEGIN_RING(14);
-    OUT_RING_H1(VIA_REG_DSTBASE, dstBase >> 3);
-    OUT_RING_H1(VIA_REG_PITCH, VIA_PITCH_ENABLE | ((pVia->Bpl >> 3) << 16));
+    OUT_RING_H1(VIA_REG(pVia, DSTBASE), dstBase >> 3);
+    viaPitchHelper(pVia, pVia->Bpl, 0);
 
     /*
      * major = 2*dmaj, minor = 2*dmin, err = -dmaj - ((bias >> octant) & 1) 
@@ -953,14 +1088,14 @@ viaSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1,
      * Error Term = (StartX<EndX) ? (2*dmin - dmax - 1) : (2*(dmin - dmax)) 
      */
 
-    OUT_RING_H1(VIA_REG_LINE_K1K2,
+    OUT_RING_H1(VIA_REG(pVia, LINE_K1K2),
                 ((((dy << 1) & 0x3fff) << 16) | (((dy - dx) << 1) & 0x3fff)));
-    OUT_RING_H1(VIA_REG_LINE_XY, ((y1 << 16) | (x1 & 0xFFFF)));
-    OUT_RING_H1(VIA_REG_DIMENSION, dx);
-    OUT_RING_H1(VIA_REG_LINE_ERROR,
+    OUT_RING_H1(VIA_REG(pVia, LINE_XY), ((y1 << 16) | (x1 & 0xFFFF)));
+    OUT_RING_H1(VIA_REG(pVia, DIMENSION), dx);
+    OUT_RING_H1(VIA_REG(pVia, LINE_ERROR),
                 (((dy << 1) - dx - error) & 0x3fff) |
                 ((tdc->dashed) ? 0xFF0000 : 0));
-    OUT_RING_H1(VIA_REG_GECMD, cmd);
+    OUT_RING_H1(VIA_REG(pVia, GECMD), cmd);
     ADVANCE_RING;
 }
 
@@ -974,12 +1109,12 @@ viaSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, int x, int y, int len, int dir)
 
     RING_VARS;
 
-    sub = viaAccelClippingHelper(cb, y, tdc);
+    sub = viaAccelClippingHelper(pVia, y);
     dstBase = pScrn->fbOffset + sub * pVia->Bpl;
 
     BEGIN_RING(10);
     OUT_RING_H1(VIA_REG_DSTBASE, dstBase >> 3);
-    OUT_RING_H1(VIA_REG_PITCH, VIA_PITCH_ENABLE | ((pVia->Bpl >> 3) << 16));
+    viaPitchHelper(pVia, pVia->Bpl, 0);
 
     if (dir == DEGREES_0) {
         OUT_RING_H1(VIA_REG_DSTPOS, ((y - sub) << 16) | (x & 0xFFFF));
@@ -1005,7 +1140,7 @@ viaSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop,


Reply to: