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

xserver-xorg-video-siliconmotion: Changes to 'upstream-experimental'



 .cvsignore            |   19 
 .gitignore            |   20 
 configure.ac          |    2 
 man/siliconmotion.man |   24 
 src/Makefile.am       |    2 
 src/regsmi.h          |  190 -
 src/smi.h             |  359 +--
 src/smi_accel.c       | 1116 ----------
 src/smi_dac.c         |  108 
 src/smi_dga.c         |  327 +-
 src/smi_driver.c      | 5504 +++++++++++++++++++++++---------------------------
 src/smi_exa.c         |  540 ++++
 src/smi_hwcurs.c      |  515 ++--
 src/smi_i2c.c         |   80 
 src/smi_shadow.c      |  528 ++--
 src/smi_video.c       | 2062 ++++++++----------
 src/smi_video.h       |   21 
 src/smi_xaa.c         |  844 +++++++
 18 files changed, 6118 insertions(+), 6143 deletions(-)

New commits:
commit 1a803a8f91a931c00106f9d3d41cfa5d74c19f55
Author: Alex Deucher <alex@botch2.com>
Date:   Tue Mar 20 21:08:38 2007 -0400

    minor fixup

diff --git a/src/smi_exa.c b/src/smi_exa.c
index a7cb25f..575ab65 100644
--- a/src/smi_exa.c
+++ b/src/smi_exa.c
@@ -514,7 +514,7 @@ SMI_UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
     /* Drawing engine data format */
     WRITE_DPR(pSmi, 0x1C, SMI_DEDataFormat(pDst));
     /* Source and Destination Base Address (offset) */
-    WRITE_DPR(pSmi, 0x44, 0);
+    WRITE_DPR(pSmi, 0x40, 0);
     WRITE_DPR(pSmi, 0x44, dst_offset);
 
     WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd);

commit 503027d38dab759277c0a67746ac205a1dfa9277
Author: Dennis De Winter <dennis.de.winter@gmail.com>
Date:   Fri Mar 16 21:29:19 2007 -0400

    Fix UTS issues with flash
    
    Also remove safety padding on memory manager calculation

diff --git a/src/smi_exa.c b/src/smi_exa.c
index 2c902be..a7cb25f 100644
--- a/src/smi_exa.c
+++ b/src/smi_exa.c
@@ -77,8 +77,8 @@ SMI_EXAInit(ScreenPtr pScreen)
 
     /* Memory Manager */
     pSmi->EXADriverPtr->memoryBase = pSmi->FBBase + pSmi->FBOffset;
-    pSmi->EXADriverPtr->memorySize = pSmi->FBReserved - 1024;
-    pSmi->EXADriverPtr->offScreenBase = pSmi->width * pSmi->height * pSmi->Bpp + 1024;
+    pSmi->EXADriverPtr->memorySize = pSmi->FBReserved;
+    pSmi->EXADriverPtr->offScreenBase = pSmi->width * pSmi->height * pSmi->Bpp;
 
     /* Flags */
     pSmi->EXADriverPtr->flags = EXA_TWO_BITBLT_DIRECTIONS;
@@ -485,7 +485,7 @@ SMI_UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
 
     /* calculate pitch in pixel unit */
     dst_pitch  = exaGetPixmapPitch(pDst) / (pDst->drawable.bitsPerPixel >> 3);
-    source_pitch = aligned_pitch / (pDst->drawable.bitsPerPixel >> 3);
+    source_pitch = src_pitch / (pDst->drawable.bitsPerPixel >> 3);
     /* calculate offset in 8 byte (64 bit) unit */
     dst_offset = exaGetPixmapOffset(pDst) >> 3;
 

commit fe4114033f2853e2df8d37c490deba26bf0366e8
Author: Alex Deucher <alex@botch2.com>
Date:   Thu Mar 15 02:11:24 2007 -0400

    hostdata blit UTS works, but SW is faster
    
    UTS is working, but SW is faster so leave it disabled

diff --git a/src/smi_exa.c b/src/smi_exa.c
index da3e36b..2c902be 100644
--- a/src/smi_exa.c
+++ b/src/smi_exa.c
@@ -96,6 +96,14 @@ SMI_EXAInit(ScreenPtr pScreen)
     pSmi->EXADriverPtr->maxX = 4096;
     pSmi->EXADriverPtr->maxY = 4096;
 
+    if (pScrn->bitsPerPixel == 24) {
+	pSmi->EXADriverPtr->maxX = 4096 / 3;
+
+	if (pSmi->Chipset == SMI_LYNX) {
+	    pSmi->EXADriverPtr->maxY = 4096 / 3;
+	}
+    }
+
     pSmi->EXADriverPtr->pixmapPitchAlign  = 16;
     pSmi->EXADriverPtr->pixmapOffsetAlign = 8;
 
@@ -112,8 +120,8 @@ SMI_EXAInit(ScreenPtr pScreen)
     pSmi->EXADriverPtr->Solid = SMI_Solid;
     pSmi->EXADriverPtr->DoneSolid = SMI_DoneSolid;
 
-    /* DFS & UTS */
 #if 0
+    /* DFS & UTS */
     pSmi->EXADriverPtr->UploadToScreen = SMI_UploadToScreen;
     pSmi->EXADriverPtr->DownloadFromScreen = SMI_DownloadFromScreen;
 #endif
@@ -460,30 +468,37 @@ SMI_UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
 {
     ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
     SMIPtr pSmi = SMIPTR(pScrn);
-    int i, j, dwords, Bpp, queue, dst_pitch;
-    CARD32 *srcp, *dataport;
+    int dst_pitch, source_pitch, align, aligned_pitch;
     unsigned long dst_offset;
 
     ENTER_PROC("SMI_UploadToScreen");
     DEBUG((VERBLEV, "x=%d y=%d w=%d h=%d src=%d src_pitch=%d\n",
 	   x, y, w, h, src, src_pitch));
 
+    if (pDst->drawable.bitsPerPixel == 24) {
+	align = 16;
+    } else {
+	align = 128 / pDst->drawable.bitsPerPixel;
+    }
+
+    aligned_pitch = (src_pitch + align - 1) & ~(align - 1);
+
     /* calculate pitch in pixel unit */
     dst_pitch  = exaGetPixmapPitch(pDst) / (pDst->drawable.bitsPerPixel >> 3);
+    source_pitch = aligned_pitch / (pDst->drawable.bitsPerPixel >> 3);
     /* calculate offset in 8 byte (64 bit) unit */
     dst_offset = exaGetPixmapOffset(pDst) >> 3;
 
-    Bpp = pDst->drawable.bitsPerPixel / 8;
-    dwords = (((w * Bpp) + 3) >> 2) * h;
-
     pSmi->AccelCmd = 0xCC /* GXcopy */
 		   | SMI_HOSTBLT_WRITE
 		   | SMI_QUICK_START;
 
+    /* set clipping */
+    SMI_SetClippingRectangle(pScrn, x, y, x+w, y+h);
 
-    WaitQueue(1);
-    /* Destination Window Width */
-    WRITE_DPR(pSmi, 0x3C, (dst_pitch << 16));
+    WaitQueue(7);
+    /* Destination and Source Window Widths */
+    WRITE_DPR(pSmi, 0x3C, (dst_pitch << 16) | (source_pitch & 0xFFFF));
 
     if (pDst->drawable.bitsPerPixel == 24) {
 	x *= 3;
@@ -494,43 +509,27 @@ SMI_UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
 	}
     }
 
-    WaitQueue(9);
-    /* Destination Row Pitch */
-    WRITE_DPR(pSmi, 0x10, (dst_pitch << 16));
+    /* Source and Destination Row Pitch */
+    WRITE_DPR(pSmi, 0x10, (dst_pitch << 16) | (source_pitch & 0xFFFF));
     /* Drawing engine data format */
     WRITE_DPR(pSmi, 0x1C, SMI_DEDataFormat(pDst));
-    /* Destination Base Address (offset) */
+    /* Source and Destination Base Address (offset) */
+    WRITE_DPR(pSmi, 0x44, 0);
     WRITE_DPR(pSmi, 0x44, dst_offset);
 
-    /* set l/r clipping */
-    WRITE_DPR(pSmi, 0x2C, (0xFFFF0000 | x | 0x2000));
-    WRITE_DPR(pSmi, 0x30, (0xFFFF0000 | (x + w)));
-
     WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd);
     WRITE_DPR(pSmi, 0x00, 0);
     WRITE_DPR(pSmi, 0x04, (x << 16) | (y * 0xFFFF));
     WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF));
 
-
-    srcp = (CARD32 *)src;
-    dataport = (CARD32 *)pSmi->DataPortBase;
-    queue = pSmi->DataPortSize;
-    while (dwords) {
-	if (queue < 4) {
-	    /* XXX: check if the hw is ok with this */
-	    dataport = (CARD32 *)pSmi->DataPortBase;
-	    queue = pSmi->DataPortSize;
-	}
-	memcpy(dataport, srcp, 4);
-	queue -= 4;
-	dwords--;
-	srcp++;
-	dataport++;
+    while (h--) {
+	WaitQueue(aligned_pitch);
+	memcpy(pSmi->DataPortBase, src, aligned_pitch);
+	src += src_pitch;
     }
 
-    WaitQueue(1);
     /* disable clipping */
-    WRITE_DPR(pSmi, 0x2C, 0);
+    SMI_DisableClipping(pScrn);
 
     exaWaitSync(pDst->drawable.pScreen);
 

commit 62442ce9e62b484e4f2067e3c52c153cd356be2c
Author: Alex Deucher <alex@botch2.com>
Date:   Wed Mar 14 20:13:28 2007 -0400

    more clock fixes

diff --git a/src/smi_driver.c b/src/smi_driver.c
index 9b2ff4b..5c7124f 100644
--- a/src/smi_driver.c
+++ b/src/smi_driver.c
@@ -2563,7 +2563,7 @@ SMI_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
 
     if (pSmi->MCLK > 0) {
 	SMI_CommonCalcClock(pScrn->scrnIndex, pSmi->MCLK,
-			    1, 1, 63, 0, 2,
+			    1, 1, 63, 0, 0,
                             pScrn->clockRanges->minClock,
                             pScrn->clockRanges->maxClock,
                             &new->SR6A, &new->SR6B);
@@ -2588,7 +2588,7 @@ SMI_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
     vclk = mode->Clock;
     if (SMI_LYNX_SERIES(pSmi->Chipset)) {
         SMI_CommonCalcClock(pScrn->scrnIndex, vclk,
-			1, 1, 63, 0, 2,
+			1, 1, 63, 0, 3,
                         pScrn->clockRanges->minClock,
                         pScrn->clockRanges->maxClock,
                         &new->SR6C, &new->SR6D);

commit 6ff1241636e25d2c0f20bd14e92c8585f209aeb0
Author: Alex Deucher <alex@botch2.com>
Date:   Tue Mar 13 02:32:52 2007 -0400

    bump to 1.5.1

diff --git a/configure.ac b/configure.ac
index 67698cc..a5fde7a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@
 
 AC_PREREQ(2.57)
 AC_INIT([xf86-video-siliconmotion],
-        1.5.0,
+        1.5.1,
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         xf86-video-siliconmotion)
 

commit b53db3bc5ba7648d392dc630ef47e57fb8a0afb4
Author: Alex Deucher <alex@botch2.com>
Date:   Tue Mar 13 02:31:30 2007 -0400

    fix clk calculation on older lynx chips

diff --git a/src/regsmi.h b/src/regsmi.h
index c325571..8319d5b 100644
--- a/src/regsmi.h
+++ b/src/regsmi.h
@@ -40,13 +40,13 @@ authorization from the XFree86 Project and SIlicon Motion.
 /* Chip tags */
 #define PCI_SMI_VENDOR_ID	PCI_VENDOR_SMI
 #define SMI_UNKNOWN			0
-#define SMI_LYNX			PCI_CHIP_SMI910
-#define SMI_LYNXE			PCI_CHIP_SMI810
-#define SMI_LYNX3D			PCI_CHIP_SMI820
-#define SMI_LYNXEM			PCI_CHIP_SMI710
+#define SMI_LYNX		PCI_CHIP_SMI910
+#define SMI_LYNXE		PCI_CHIP_SMI810
+#define SMI_LYNX3D		PCI_CHIP_SMI820
+#define SMI_LYNXEM		PCI_CHIP_SMI710
 #define SMI_LYNXEMplus		PCI_CHIP_SMI712
-#define SMI_LYNX3DM			PCI_CHIP_SMI720
-#define SMI_COUGAR3DR       PCI_CHIP_SMI731
+#define SMI_LYNX3DM		PCI_CHIP_SMI720
+#define SMI_COUGAR3DR           PCI_CHIP_SMI731
 
 /* I/O Functions */
 static __inline__ CARD8
diff --git a/src/smi_dac.c b/src/smi_dac.c
index 9fda7fa..ac73323 100644
--- a/src/smi_dac.c
+++ b/src/smi_dac.c
@@ -41,6 +41,8 @@ SMI_CommonCalcClock(int scrnIndex, long freq, int min_m, int min_n1,
 		    int max_n1, int min_n2, int max_n2, long freq_min, 
 		    long freq_max, unsigned char *mdiv, unsigned char *ndiv)
 {
+    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+    SMIPtr pSmi = SMIPTR(pScrn);
     double div, diff, best_diff;
     unsigned int m;
     unsigned char n1, n2;
@@ -90,7 +92,14 @@ SMI_CommonCalcClock(int scrnIndex, long freq, int min_m, int min_n1,
 	 ((double)(best_m) / (double)(best_n1) / (1 << best_n2)) * BASE_FREQ,
 	 best_m, best_n1, best_n2));
 
-    *ndiv = best_n1 | (best_n2 << 7);
+    if (SMI_LYNX_SERIES(pSmi->Chipset)) {
+	*ndiv = best_n1 | (best_n2 << 6);
+    } else {
+	*ndiv = best_n1 | (best_n2 << 7);
+	if (freq > 120000)
+	    *ndiv |= 1 << 6;
+    }
+
     *mdiv = best_m;
 }
 
diff --git a/src/smi_driver.c b/src/smi_driver.c
index 45eae6a..9b2ff4b 100644
--- a/src/smi_driver.c
+++ b/src/smi_driver.c
@@ -2563,7 +2563,7 @@ SMI_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
 
     if (pSmi->MCLK > 0) {
 	SMI_CommonCalcClock(pScrn->scrnIndex, pSmi->MCLK,
-			    1, 1, 31, 0, 2,
+			    1, 1, 63, 0, 2,
                             pScrn->clockRanges->minClock,
                             pScrn->clockRanges->maxClock,
                             &new->SR6A, &new->SR6B);
@@ -2586,11 +2586,20 @@ SMI_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
 
     /* calculate vclk1 */
     vclk = mode->Clock;
-    SMI_CommonCalcClock(pScrn->scrnIndex, vclk,
-			1, 1, 31, 0, 2,
+    if (SMI_LYNX_SERIES(pSmi->Chipset)) {
+        SMI_CommonCalcClock(pScrn->scrnIndex, vclk,
+			1, 1, 63, 0, 2,
                         pScrn->clockRanges->minClock,
                         pScrn->clockRanges->maxClock,
                         &new->SR6C, &new->SR6D);
+    } else {
+        SMI_CommonCalcClock(pScrn->scrnIndex, vclk,
+			1, 1, 63, 0, 1,
+                        pScrn->clockRanges->minClock,
+                        pScrn->clockRanges->maxClock,
+                        &new->SR6C, &new->SR6D);
+    }
+
     /* use vclk1 */
     new->SR68 = 0x54;
 

commit 7d1392be291e99fd3dde2292b82423b5f78d3a21
Author: Alex Deucher <alex@botch2.com>
Date:   Tue Mar 13 00:44:29 2007 -0400

    bump to 1.5.0

diff --git a/configure.ac b/configure.ac
index b92f99e..67698cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@
 
 AC_PREREQ(2.57)
 AC_INIT([xf86-video-siliconmotion],
-        1.4.2,
+        1.5.0,
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         xf86-video-siliconmotion)
 

commit 449fedec0e38289d10d75799bbf995b0e7189911
Author: Alex Deucher <alex@botch2.com>
Date:   Tue Mar 13 00:13:35 2007 -0400

    fix Solid()
    
    Unforunately, for 32 bpp solid fills the HW ignores alpha.

diff --git a/src/smi_exa.c b/src/smi_exa.c
index 07bcc97..da3e36b 100644
--- a/src/smi_exa.c
+++ b/src/smi_exa.c
@@ -332,6 +332,10 @@ SMI_PrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
     ENTER_PROC("SMI_PrepareSolid");
     DEBUG((VERBLEV, "alu=%02X\n", alu));
 
+    /* HW ignores alpha */
+    if (pPixmap->drawable.bitsPerPixel == 32)
+	return FALSE;
+
     /* Bit Mask not supported > 16 bpp */
     if ((pPixmap->drawable.bitsPerPixel > 16) && 
 	(!EXA_PM_IS_SOLID(&pPixmap->drawable, planemask))) {

commit 6d40f87d6cddde2d88f25be686b6392449cdecf1
Author: Alex Deucher <alex@botch2.com>
Date:   Mon Mar 12 23:58:41 2007 -0400

    remove spurious waitqueue() line

diff --git a/src/smi_exa.c b/src/smi_exa.c
index 33461a7..07bcc97 100644
--- a/src/smi_exa.c
+++ b/src/smi_exa.c
@@ -226,7 +226,6 @@ SMI_PrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, int ydir,
     if (pDstPixmap->drawable.bitsPerPixel == 24) {
 	src_pitch *= 3;
 	dst_pitch *= 3;
-	WaitQueue(3);
     }
 
     /* Bit Mask (planemask) - 16 bit only */

commit 452cabd6e3870b832cb19c8ad8a1fce27eef9c48
Author: Alex Deucher <alex@botch2.com>
Date:   Mon Mar 12 01:11:16 2007 -0400

    Update copyright.

diff --git a/src/smi_exa.c b/src/smi_exa.c
index 8c3c234..33461a7 100644
--- a/src/smi_exa.c
+++ b/src/smi_exa.c
@@ -1,5 +1,6 @@
 /*
 Copyright (C) 2006 Dennis De Winter  All Rights Reserved.
+Copyright (C) 2007 Alex Deucher  All Rights Reserved.
 
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal in

commit 55266778ac693582131acae80def32211e09f18f
Author: Alex Deucher <alex@botch2.com>
Date:   Mon Mar 12 01:02:53 2007 -0400

    switch the engine to quick start mode
    
    Rather than writing to the engine command register for every
    operation, set quick start mode, and the operation executes
    automatically when the width register is written.

diff --git a/src/smi_exa.c b/src/smi_exa.c
index d51c9e8..8c3c234 100644
--- a/src/smi_exa.c
+++ b/src/smi_exa.c
@@ -212,13 +212,13 @@ SMI_PrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, int ydir,
 
     pSmi->AccelCmd = SMI_BltRop[alu]
 		   | SMI_BITBLT
-		   | SMI_START_ENGINE;
+		   | SMI_QUICK_START;
 
     if (xdir < 0 || (ydir < 0)) {
 	pSmi->AccelCmd |= SMI_RIGHT_TO_LEFT;
     }
 
-    WaitQueue(6);
+    WaitQueue(7);
     /* Destination and Source Window Widths */
     WRITE_DPR(pSmi, 0x3C, (dst_pitch << 16) | (src_pitch & 0xFFFF));
 
@@ -243,6 +243,8 @@ SMI_PrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, int ydir,
     WRITE_DPR(pSmi, 0x40, src_offset);
     WRITE_DPR(pSmi, 0x44, dst_offset);
 
+    WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd);
+
     LEAVE_PROC("SMI_PrepareCopy");
     return TRUE;
 }
@@ -281,11 +283,10 @@ SMI_Copy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX,
 	}
     }
 
-    WaitQueue(4);
+    WaitQueue(3);
     WRITE_DPR(pSmi, 0x00, (srcX  << 16) + (srcY & 0xFFFF));
     WRITE_DPR(pSmi, 0x04, (dstX  << 16) + (dstY & 0xFFFF));
     WRITE_DPR(pSmi, 0x08, (width << 16) + (height & 0xFFFF));
-    WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd);
 
     LEAVE_PROC("SMI_Copy");
 }
@@ -345,9 +346,9 @@ SMI_PrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
 
     pSmi->AccelCmd = SMI_SolidRop[alu]
 		   | SMI_BITBLT
-		   | SMI_START_ENGINE;
+		   | SMI_QUICK_START;
 
-    WaitQueue(9);
+    WaitQueue(10);
     /* Destination Window Width */
     WRITE_DPR(pSmi, 0x3C, (dst_pitch << 16) | (dst_pitch & 0xFFFF));
 
@@ -375,6 +376,8 @@ SMI_PrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
     WRITE_DPR(pSmi, 0x34, 0xFFFFFFFF);
     WRITE_DPR(pSmi, 0x38, 0xFFFFFFFF);
 
+    WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd);
+
     LEAVE_PROC("SMI_PrepareSolid");
     return TRUE;
 }
@@ -401,10 +404,9 @@ SMI_Solid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
 	}
     }
 
-    WaitQueue(3);
+    WaitQueue(2);
     WRITE_DPR(pSmi, 0x04, (x1 << 16) | (y1 & 0xFFFF));
     WRITE_DPR(pSmi, 0x08, (w  << 16) | (h  & 0xFFFF));
-    WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd);
 
     LEAVE_PROC("SMI_Solid");
 }
@@ -472,7 +474,7 @@ SMI_UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
 
     pSmi->AccelCmd = 0xCC /* GXcopy */
 		   | SMI_HOSTBLT_WRITE
-		   | SMI_START_ENGINE;
+		   | SMI_QUICK_START;
 
 
     WaitQueue(1);
@@ -500,10 +502,11 @@ SMI_UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
     WRITE_DPR(pSmi, 0x2C, (0xFFFF0000 | x | 0x2000));
     WRITE_DPR(pSmi, 0x30, (0xFFFF0000 | (x + w)));
 
+    WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd);
     WRITE_DPR(pSmi, 0x00, 0);
     WRITE_DPR(pSmi, 0x04, (x << 16) | (y * 0xFFFF));
     WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF));
-    WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd);
+
 
     srcp = (CARD32 *)src;
     dataport = (CARD32 *)pSmi->DataPortBase;

commit 4b37b514907da4a567261569eaebcc5a35aff6db
Author: Alex Deucher <alex@botch2.com>
Date:   Mon Mar 12 00:12:23 2007 -0400

    fixup waitqueue slots

diff --git a/src/smi_exa.c b/src/smi_exa.c
index 09d1de5..d51c9e8 100644
--- a/src/smi_exa.c
+++ b/src/smi_exa.c
@@ -347,7 +347,7 @@ SMI_PrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
 		   | SMI_BITBLT
 		   | SMI_START_ENGINE;
 
-    WaitQueue(8);
+    WaitQueue(9);
     /* Destination Window Width */
     WRITE_DPR(pSmi, 0x3C, (dst_pitch << 16) | (dst_pitch & 0xFFFF));
 

commit 493c93de288437501fd898800bce45300379ebc3
Author: Alex Deucher <alex@botch2.com>
Date:   Sun Mar 11 18:49:48 2007 -0400

    more exa fixups, disable UTS for now.

diff --git a/src/smi_exa.c b/src/smi_exa.c
index 2f13983..09d1de5 100644
--- a/src/smi_exa.c
+++ b/src/smi_exa.c
@@ -112,8 +112,10 @@ SMI_EXAInit(ScreenPtr pScreen)
     pSmi->EXADriverPtr->DoneSolid = SMI_DoneSolid;
 
     /* DFS & UTS */
+#if 0
     pSmi->EXADriverPtr->UploadToScreen = SMI_UploadToScreen;
     pSmi->EXADriverPtr->DownloadFromScreen = SMI_DownloadFromScreen;
+#endif
 
     if(!exaDriverInit(pScreen, pSmi->EXADriverPtr)) {
 	xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "exaDriverInit failed.\n");
@@ -216,7 +218,7 @@ SMI_PrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, int ydir,
 	pSmi->AccelCmd |= SMI_RIGHT_TO_LEFT;
     }
 
-    WaitQueue(1);
+    WaitQueue(6);
     /* Destination and Source Window Widths */
     WRITE_DPR(pSmi, 0x3C, (dst_pitch << 16) | (src_pitch & 0xFFFF));
 
@@ -224,11 +226,15 @@ SMI_PrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, int ydir,
 	src_pitch *= 3;
 	dst_pitch *= 3;
 	WaitQueue(3);
-    } else {
-	WaitQueue(4);
-	/* Bit Mask (planemask) - 16 bit only */
+    }
+
+    /* Bit Mask (planemask) - 16 bit only */
+    if (pSrcPixmap->drawable.bitsPerPixel == 16) {
 	WRITE_DPR(pSmi, 0x28, planemask | 0xFFFF0000);
+    } else {
+	WRITE_DPR(pSmi, 0x28, 0xFFFFFFFF);
     }
+
     /* Destination and Source Row Pitch */
     WRITE_DPR(pSmi, 0x10, (dst_pitch << 16) | (src_pitch & 0xFFFF));
     /* Drawing engine data format */
@@ -341,23 +347,27 @@ SMI_PrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
 		   | SMI_BITBLT
 		   | SMI_START_ENGINE;
 
-    WaitQueue(1);
+    WaitQueue(8);
     /* Destination Window Width */
-    WRITE_DPR(pSmi, 0x3C, (dst_pitch << 16));
+    WRITE_DPR(pSmi, 0x3C, (dst_pitch << 16) | (dst_pitch & 0xFFFF));
 
     if (pPixmap->drawable.bitsPerPixel == 24) {
 	dst_pitch *= 3;
-	WaitQueue(5);
-    } else {
-	WaitQueue(6);
-	/* Bit Mask (planemask) - 16 bit only */
+    }
+
+    /* Bit Mask (planemask) - 16 bit only */
+    if (pPixmap->drawable.bitsPerPixel == 16) {
 	WRITE_DPR(pSmi, 0x28, planemask | 0xFFFF0000);
+    } else {
+	WRITE_DPR(pSmi, 0x28, 0xFFFFFFFF);
     }
+
     /* Destination Row Pitch */
-    WRITE_DPR(pSmi, 0x10, (dst_pitch << 16));
+    WRITE_DPR(pSmi, 0x10, (dst_pitch << 16) | (dst_pitch & 0xFFFF));
     /* Drawing engine data format */
     WRITE_DPR(pSmi, 0x1C, SMI_DEDataFormat(pPixmap));
-    /* Destination Base Address (offset) */
+    /* Source and Destination Base Address (offset) */
+    WRITE_DPR(pSmi, 0x40, dst_offset);
     WRITE_DPR(pSmi, 0x44, dst_offset);
     /* Foreground Color */
     WRITE_DPR(pSmi, 0x14, fg);

commit c1d6373624428c8c52e4d1d295b1d77ed75391a0
Author: Alex Deucher <alex@botch2.com>
Date:   Sun Mar 11 16:22:05 2007 -0400

    engine likes to use blit command for solid fills

diff --git a/src/smi_exa.c b/src/smi_exa.c
index 947714c..2f13983 100644
--- a/src/smi_exa.c
+++ b/src/smi_exa.c
@@ -338,7 +338,7 @@ SMI_PrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
     dst_offset = exaGetPixmapOffset(pPixmap) >> 3;
 
     pSmi->AccelCmd = SMI_SolidRop[alu]
-		   | SMI_RECT_FILL /* SMI_BITBLT */
+		   | SMI_BITBLT
 		   | SMI_START_ENGINE;
 
     WaitQueue(1);

commit 9db380c99decdb9ab7fbf481788a5b63a84cd6e0
Author: Alex Deucher <alex@botch2.com>
Date:   Sun Mar 11 15:53:29 2007 -0400

    fix postscalar shift

diff --git a/src/smi_dac.c b/src/smi_dac.c
index 1df1cbf..9fda7fa 100644
--- a/src/smi_dac.c
+++ b/src/smi_dac.c
@@ -90,7 +90,7 @@ SMI_CommonCalcClock(int scrnIndex, long freq, int min_m, int min_n1,
 	 ((double)(best_m) / (double)(best_n1) / (1 << best_n2)) * BASE_FREQ,
 	 best_m, best_n1, best_n2));
 
-    *ndiv = best_n1 | (best_n2 << 6);
+    *ndiv = best_n1 | (best_n2 << 7);
     *mdiv = best_m;
 }
 

commit b6082e628289221864e96ebc41ce93d8efe2d2ce
Author: Alex Deucher <alex@botch2.com>
Date:   Sun Mar 11 14:09:45 2007 -0400

    support 32 bpp

diff --git a/src/smi_driver.c b/src/smi_driver.c
index ebc2287..45eae6a 100644
--- a/src/smi_driver.c
+++ b/src/smi_driver.c
@@ -555,9 +555,8 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags)
 
     /*
      * The first thing we should figure out is the depth, bpp, etc.
-     * We support only 24bpp layouts, so indicate that.
      */
-    if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support24bppFb)) {
+    if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support32bppFb)) {
 	LEAVE_PROC("SMI_PreInit");
 	return FALSE;
     }

commit 3ebbc2e55a1584e01949ec760501ac4a3c086b04
Author: Alex Deucher <alex@botch2.com>
Date:   Sun Mar 11 13:40:06 2007 -0400

    fix up vclk1 setup

diff --git a/src/smi_driver.c b/src/smi_driver.c
index 9226c02..ebc2287 100644
--- a/src/smi_driver.c
+++ b/src/smi_driver.c
@@ -1331,6 +1331,12 @@ SMI_Save(ScrnInfoPtr pScrn)
     save->SR81 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81);
     save->SRA0 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0xA0);
 
+    /* vclk1 */
+    save->SR6C = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x6C);
+    save->SR6D = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x6D);
+    /* vclk1 control */
+    save->SR68 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x68);
+
     if (pSmi->Dualhead) {
 	/* dualhead stuff */
 	save->SR22 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x22);
@@ -1345,11 +1351,8 @@ SMI_Save(ScrnInfoPtr pScrn)
 	save->SR4A = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x4A);
 	save->SR4B = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x4B);
 	save->SR4C = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x4C);
-	/* PLL stuff */
-	save->SR68 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x68);
+	/* PLL2 stuff */
 	save->SR69 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x69);
-	save->SR6C = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x6C);
-	save->SR6D = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x6D);
 	save->SR6E = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x6E);
 	save->SR6F = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x6F);
     }
@@ -1578,6 +1581,7 @@ SMI_WriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, SMIRegPtr restore)
 	}
 
 	/* vclk1 */
+	VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x68, restore->SR68);
 	VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x6C, restore->SR6C);
 	VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x6D, restore->SR6D);
 
@@ -1588,12 +1592,9 @@ SMI_WriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, SMIRegPtr restore)
 	 * -- AGD
 	 */
 
-	    /* PLL regs */
-	    VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x68, restore->SR68);
-	    VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x69, restore->SR69);
+	    /* PLL2 regs */
 
-	    VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x6C, restore->SR6C);
-	    VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x6D, restore->SR6D);
+	    VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x69, restore->SR69);
 
 	    VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x6E, restore->SR6E);
 	    VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x6F, restore->SR6F);
@@ -2591,12 +2592,12 @@ SMI_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
                         pScrn->clockRanges->minClock,
                         pScrn->clockRanges->maxClock,
                         &new->SR6C, &new->SR6D);
+    /* use vclk1 */
+    new->SR68 = 0x54;
 
     /* dualhead */
     if (pSmi->Dualhead) {
 	/* PLL controls */
-	/* set CRT to vclk */
-	new->SR68 = 0x54;
 	/* set LCD to vclk2 */
 	new->SR69 = 0x04;
 

commit 3e62ec8736ea9ea64a2c0c5c41df9c6d742397ca
Author: Alex Deucher <alex@botch2.com>
Date:   Tue Mar 6 02:42:52 2007 -0500

    revert the last commit.
    
    FBBase already take the register offset into account.

diff --git a/src/smi_exa.c b/src/smi_exa.c
index 2d9b1b2..947714c 100644
--- a/src/smi_exa.c
+++ b/src/smi_exa.c
@@ -75,7 +75,7 @@ SMI_EXAInit(ScreenPtr pScreen)
     SMI_EngineReset(pScrn);
 
     /* Memory Manager */
-    pSmi->EXADriverPtr->memoryBase = pSmi->FBBase + pScrn->fbOffset;
+    pSmi->EXADriverPtr->memoryBase = pSmi->FBBase + pSmi->FBOffset;
     pSmi->EXADriverPtr->memorySize = pSmi->FBReserved - 1024;
     pSmi->EXADriverPtr->offScreenBase = pSmi->width * pSmi->height * pSmi->Bpp + 1024;
 

commit 7da75a99159f80f215ee409377128f7dcbc4064d
Author: Alex Deucher <alex@botch2.com>
Date:   Tue Mar 6 02:38:02 2007 -0500

    fix memoryBase
    
    pSmi->FBOffset is the offset from the start of the framebuffer
    pScrn->fbOffset is the aperture offset where the framebuffer
    starts

diff --git a/src/smi_exa.c b/src/smi_exa.c
index 947714c..2d9b1b2 100644
--- a/src/smi_exa.c
+++ b/src/smi_exa.c
@@ -75,7 +75,7 @@ SMI_EXAInit(ScreenPtr pScreen)
     SMI_EngineReset(pScrn);
 
     /* Memory Manager */
-    pSmi->EXADriverPtr->memoryBase = pSmi->FBBase + pSmi->FBOffset;
+    pSmi->EXADriverPtr->memoryBase = pSmi->FBBase + pScrn->fbOffset;
     pSmi->EXADriverPtr->memorySize = pSmi->FBReserved - 1024;
     pSmi->EXADriverPtr->offScreenBase = pSmi->width * pSmi->height * pSmi->Bpp + 1024;
 

commit ba0b2492269ea81e91f7ce4fb8da618187a3997f
Author: Alex Deucher <alex@botch2.com>
Date:   Tue Mar 6 02:24:08 2007 -0500

    first pass at UTS

diff --git a/src/smi_exa.c b/src/smi_exa.c
index 759f145..947714c 100644
--- a/src/smi_exa.c
+++ b/src/smi_exa.c
@@ -444,26 +444,81 @@ SMI_UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
 {
     ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
     SMIPtr pSmi = SMIPTR(pScrn);
+    int i, j, dwords, Bpp, queue, dst_pitch;
+    CARD32 *srcp, *dataport;
+    unsigned long dst_offset;
 
     ENTER_PROC("SMI_UploadToScreen");
     DEBUG((VERBLEV, "x=%d y=%d w=%d h=%d src=%d src_pitch=%d\n",
 	   x, y, w, h, src, src_pitch));
 
-    char *dst = pDst->devPrivate.ptr;
-    int dst_pitch = exaGetPixmapPitch(pDst);
+    /* calculate pitch in pixel unit */
+    dst_pitch  = exaGetPixmapPitch(pDst) / (pDst->drawable.bitsPerPixel >> 3);
+    /* calculate offset in 8 byte (64 bit) unit */
+    dst_offset = exaGetPixmapOffset(pDst) >> 3;
 
-    exaWaitSync(pDst->drawable.pScreen);
+    Bpp = pDst->drawable.bitsPerPixel / 8;
+    dwords = (((w * Bpp) + 3) >> 2) * h;
 
-    dst += (y * dst_pitch) + (x * pSmi->Bpp);
-    w   *= pSmi->Bpp;
+    pSmi->AccelCmd = 0xCC /* GXcopy */
+		   | SMI_HOSTBLT_WRITE
+		   | SMI_START_ENGINE;
 
-    while (h--) {
-	memcpy(dst, src, w);
-	src += src_pitch;
-	dst += dst_pitch;
+
+    WaitQueue(1);
+    /* Destination Window Width */
+    WRITE_DPR(pSmi, 0x3C, (dst_pitch << 16));
+
+    if (pDst->drawable.bitsPerPixel == 24) {
+	x *= 3;
+	w *= 3;
+	dst_pitch *= 3;
+	if (pSmi->Chipset == SMI_LYNX) {
+	    y *= 3;
+	}
     }
 
-    return TRUE;
+    WaitQueue(9);
+    /* Destination Row Pitch */
+    WRITE_DPR(pSmi, 0x10, (dst_pitch << 16));
+    /* Drawing engine data format */
+    WRITE_DPR(pSmi, 0x1C, SMI_DEDataFormat(pDst));
+    /* Destination Base Address (offset) */
+    WRITE_DPR(pSmi, 0x44, dst_offset);
+
+    /* set l/r clipping */
+    WRITE_DPR(pSmi, 0x2C, (0xFFFF0000 | x | 0x2000));
+    WRITE_DPR(pSmi, 0x30, (0xFFFF0000 | (x + w)));
+
+    WRITE_DPR(pSmi, 0x00, 0);
+    WRITE_DPR(pSmi, 0x04, (x << 16) | (y * 0xFFFF));
+    WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF));
+    WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd);
+
+    srcp = (CARD32 *)src;
+    dataport = (CARD32 *)pSmi->DataPortBase;
+    queue = pSmi->DataPortSize;
+    while (dwords) {
+	if (queue < 4) {
+	    /* XXX: check if the hw is ok with this */
+	    dataport = (CARD32 *)pSmi->DataPortBase;
+	    queue = pSmi->DataPortSize;
+	}
+	memcpy(dataport, srcp, 4);
+	queue -= 4;
+	dwords--;
+	srcp++;
+	dataport++;
+    }
+
+    WaitQueue(1);
+    /* disable clipping */
+    WRITE_DPR(pSmi, 0x2C, 0);
+
+    exaWaitSync(pDst->drawable.pScreen);
+
     LEAVE_PROC("SMI_UploadToScreen");
+
+    return TRUE;
 }
 

commit e650ca36da5cf7614e4f1a0a524eadb46b1cc21d
Author: Alex Deucher <alex@botch2.com>
Date:   Mon Mar 5 23:58:25 2007 -0500

    fix up EXA code

diff --git a/src/smi.h b/src/smi.h
index ba44a03..88aa65a 100644
--- a/src/smi.h
+++ b/src/smi.h
@@ -185,7 +185,6 @@ typedef struct
     /* EXA */
     ExaDriverPtr	EXADriverPtr;
     Bool		useEXA;	/* enable exa acceleration */
-    int			depth;	/* Pixmap color depth in bytes */
 
     pciVideoPtr		PciInfo;	/* PCI info vars */
     PCITAG		PciTag;
diff --git a/src/smi_driver.c b/src/smi_driver.c
index 5f14264..9226c02 100644
--- a/src/smi_driver.c
+++ b/src/smi_driver.c
@@ -2262,8 +2262,9 @@ SMI_InternalScreenInit(int scrnIndex, ScreenPtr pScreen)
     case 8:
     case 16:
     case 24:
+    case 32:
 	ret = fbScreenInit(pScreen, pSmi->FBBase, width, height, xDpi,
-			   yDpi, displayWidth,pScrn->bitsPerPixel);
+			   yDpi, displayWidth, pScrn->bitsPerPixel);
 	break;
     default:
 	xf86DrvMsg(scrnIndex, X_ERROR, "Internal error: invalid bpp (%d) "
diff --git a/src/smi_exa.c b/src/smi_exa.c
index 0718709..759f145 100644
--- a/src/smi_exa.c
+++ b/src/smi_exa.c
@@ -82,6 +82,7 @@ SMI_EXAInit(ScreenPtr pScreen)
     /* Flags */
     pSmi->EXADriverPtr->flags = EXA_TWO_BITBLT_DIRECTIONS;
     if (pSmi->EXADriverPtr->memorySize > pSmi->EXADriverPtr->offScreenBase) {
+	/* Offscreen Pixmaps */
 	pSmi->EXADriverPtr->flags |= EXA_OFFSCREEN_PIXMAPS;
 	xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 			"EXA offscreen memory manager enabled.\n");
@@ -90,20 +91,12 @@ SMI_EXAInit(ScreenPtr pScreen)
 		   "Not enough video RAM for EXA offscreen memory manager.\n");
     }
 
-    /* Offscreen Pixmaps */
-    if (pScrn->bitsPerPixel == 24) {
-	pSmi->EXADriverPtr->maxX = 4096 / 3;
-
-	if (pSmi->Chipset == SMI_LYNX) {
-	    pSmi->EXADriverPtr->maxY = 4096 / 3;
-	}
-    } else {
-	pSmi->EXADriverPtr->maxX = 4096;
-	pSmi->EXADriverPtr->maxY = 4096;
-    }
+    /* 12 bit coordinates */
+    pSmi->EXADriverPtr->maxX = 4096;
+    pSmi->EXADriverPtr->maxY = 4096;



Reply to: