All pastes #754547 Raw Copy code Copy link Edit

Miscellany

public unlisted text v1 · immutable
#754547 ·published 2007-10-30 02:12 UTC
rendered paste body
diff --git a/src/s3_accel.c b/src/s3_accel.c
index af94816..e5dab94 100644
--- a/src/s3_accel.c
+++ b/src/s3_accel.c
@@ -68,9 +68,9 @@ static void S3SetupForSolidFill(ScrnInfo
 static void S3SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y,
 				      int w, int h)
 {
-#ifdef S3_NEWMMIO
+// #ifdef S3_NEWMMIO
 	S3Ptr pS3 = S3PTR(pScrn);
-#endif
+// #endif
 
 	WaitQueue(5);
 	SET_CURPT((short)x, (short)y);
@@ -143,6 +143,7 @@ static void S3SubsequentScreenToScreenCo
 }
 
 
+#if  0
 static void S3SetupForColor8x8PatternFill(ScrnInfoPtr pScrn,
 					  int patx, int paty,
 					  int rop, unsigned int planemask,
@@ -184,6 +185,7 @@ static void S3SubsequentColor8x8PatternF
 		SET_MULT_MISC(CMD_REG_WIDTH);
 	}
 }
+#endif
 
 #ifdef S3_NEWMMIO
 static void S3SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
@@ -550,7 +552,8 @@ #endif
 	ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
 	S3Ptr pS3 = S3PTR(pScrn);
 	XAAInfoRecPtr pXAA;
-
+	BoxRec AvailFBArea;
+	
 	if (pS3->Chipset == PCI_CHIP_968)
 		pS3->ColorExpandBug = TRUE;
 	else
@@ -571,10 +574,10 @@ #endif
 
 	pXAA->SetupForScreenToScreenCopy = S3SetupForScreenToScreenCopy;
 	pXAA->SubsequentScreenToScreenCopy = S3SubsequentScreenToScreenCopy;
-
+#if 0
 	pXAA->SetupForColor8x8PatternFill = S3SetupForColor8x8PatternFill;
 	pXAA->SubsequentColor8x8PatternFillRect = S3SubsequentColor8x8PatternFillRect;
-
+#endif
 #ifdef S3_NEWMMIO
 	pXAA->SetupForCPUToScreenColorExpandFill =
 		S3SetupForCPUToScreenColorExpandFill;
@@ -612,5 +615,17 @@ #if 0
 	pXAA->DashPatternMaxLength = MAX_LINE_PATTERN_LENGTH;
 #endif
 
+	AvailFBArea.x1 = 0;
+	AvailFBArea.y1 = 0;
+	AvailFBArea.x2 = pScrn->displayWidth;
+	AvailFBArea.y2 = (pScrn->videoRam * 1024 ) / (pScrn->displayWidth * pScrn->bitsPerPixel / 8);
+	
+	 if (xf86InitFBManager(pScreen, &AvailFBArea)) {
+	xf86DrvMsg (0, X_INFO, "using %i scanlines of offscreen memory \n", AvailFBArea.y2 - pScrn->virtualY);
+	} 
+
+
+
+
 	return XAAInit(pScreen, pXAA);
 }
diff --git a/src/s3_driver.c b/src/s3_driver.c
index 5dc07df..06fa68f 100644
--- a/src/s3_driver.c
+++ b/src/s3_driver.c
@@ -522,7 +522,7 @@ static Bool S3PreInit(ScrnInfoPtr pScrn,
 	case PCI_CHIP_964_1:
 	case PCI_CHIP_TRIO:
 	case PCI_CHIP_AURORA64VP:		/* ??? */
-		pS3->S3NewMMIO = FALSE;
+		pS3->S3NewMMIO = TRUE; /* was false, giant hack for my 64v+ */
 		break;
 	case PCI_CHIP_TRIO64V2_DXGX:
 	case PCI_CHIP_TRIO64UVP:
@@ -762,7 +762,7 @@ static Bool S3ScreenInit(int scrnIndex, 
 
 	if (!S3ModeInit(pScrn, pScrn->currentMode))
 		return FALSE;
-#if 0
+#if 1
 	S3Regdump(pScrn);
 #endif
 	pScrn->vtSema = TRUE;
@@ -868,7 +868,7 @@ #endif
 	pScrn->racIoFlags = pScrn->racMemFlags = RAC_COLORMAP
 	    | RAC_FB | RAC_VIEWPORT | RAC_CURSOR;
 
-#if 0
+#if 1
 	S3InitVideo(pScreen);
 #endif
 	
@@ -1409,12 +1409,12 @@ static Bool S3ModeInit(ScrnInfoPtr pScrn
 		outb(vgaCRReg, new->cr42);
 	}
 
-	if (pS3->Chipset == PCI_CHIP_968) {
+	if (pS3->Chipset == PCI_CHIP_968) { 
 		unsigned char a;
 
 		outb(vgaCRIndex, 0x67);
 		a = inb(vgaCRReg) & 0xfe;
-#if 0
+#if 1
 		switch (pScrn->depth) {
 			case 8:
 				break;
@@ -1435,7 +1435,7 @@ #endif
 
 		outb(vgaCRIndex, 0x6d);
 		outb(vgaCRReg, 0x00);
-	}
+	} 
 
 	if ((pS3->Chipset == PCI_CHIP_964_0) ||
 	    (pS3->Chipset == PCI_CHIP_964_1)) {
@@ -1511,7 +1511,7 @@ #endif
 			outb(vgaCRReg, tmp | 0x08);	/* 2-cycle EDO */
 	}
 
-	if (pS3->Chipset == PCI_CHIP_AURORA64VP) {
+	if (pS3->Chipset == PCI_CHIP_AURORA64VP) { 
 		outb(0x3c4, 0x08);
 		outb(0x3c5, 0x06);
 #if 0
@@ -1523,7 +1523,7 @@ #if 0
 		outb(0x3c5, 0x1c);
 		outb(0x3c4, 0x57);
 		outb(0x3c5, 0x00);
-#else
+#else 
 		outb(0x3c4, 0x54);
 		outb(0x3c5, 0x1f);
 		outb(0x3c4, 0x55);
@@ -1531,12 +1531,12 @@ #else
 		outb(0x3c4, 0x56);
 		outb(0x3c5, 0x1f);
 		outb(0x3c4, 0x57);
-		outb(0x3c5, 0x1f);
+		outb(0x3c5, 0x1f); 
 #endif
 
 		outb(0x3c4, 0x08);
 		outb(0x3c5, 0x00);
-	}
+	} 
 
 	pScrn->AdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
 
@@ -1573,6 +1573,7 @@ #endif
 	    (pS3->Chipset == PCI_CHIP_964_1))
 		new->cr58 |= 0x40;
 
+		new->cr58 |= 0x10;
 	outb(vgaCRIndex, 0x59);
 	outb(vgaCRReg, new->cr59);
 	outb(vgaCRIndex, 0x5a);
@@ -1585,10 +1586,33 @@ #endif
 
 	outb(vgaCRIndex, 0x6f);
 
-#if 0
+#if 1
 	if (((pScrn->bitsPerPixel == 16) || 
 	     (pScrn->bitsPerPixel == 24)) && (pS3->S3NewMMIO))
-		S3InitStreams(pScrn, mode);
+	     xf86DrvMsg(0, X_INFO, "init streams ...\n");
+	         /* S3Regdump(pScrn);
+		// > 256 k acces enabled
+		outb(vgaCRIndex, 0x31);
+		tmp = inb(vgaCRReg) | 0x08;
+		//tmp | = 0x08;
+		outb(vgaCRReg, tmp);
+		//echanded reg enabled
+		outb(vgaCRIndex, 0x40);
+		tmp = inb(vgaCRReg) | 0x01;
+		//tmp | = 0x01;
+		outb(vgaCRReg, tmp);
+		// open MMIO regs
+		outb(vgaCRIndex, 0x53);
+		tmp = inb(vgaCRReg) | 0x08;
+		// tmp | = 0x08;
+		outb(vgaCRReg, tmp);
+		
+		new->cr67 = 0x0c;
+	        outb(vgaCRIndex, 0x67);
+	        outb(vgaCRReg, new->cr67);
+		S3Regdump(pScrn);
+		S3InitStreams(pScrn, mode); */
+	    xf86DrvMsg(0, X_INFO, "init streams done...\n");		
 #endif
 
 	return TRUE;
diff --git a/src/s3_video.c b/src/s3_video.c
index 8189fdf..bb52715 100644
--- a/src/s3_video.c
+++ b/src/s3_video.c
@@ -30,8 +30,6 @@ #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#define S3_NEWMMIO	/* previously defined in Imakefile in monolith */
-
 #include "xf86.h"
 #include "xf86_OSproc.h"
 
@@ -291,7 +289,7 @@ static FBAreaPtr S3AllocateMemory(ScrnIn
      
         xf86FreeOffscreenArea(area);
    }
-      
+      xf86DrvMsg(0, X_INFO, "S3 mem allocate: numlines = %p\n", numlines);
    pScreen = screenInfo.screens[pScrn->scrnIndex];
   
    new_area = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth,
@@ -302,7 +300,7 @@ static FBAreaPtr S3AllocateMemory(ScrnIn
 
         xf86QueryLargestOffscreenArea(pScreen, &max_w, &max_h, 0,
                         FAVOR_WIDTH_THEN_AREA, PRIORITY_EXTREME);
-           
+           xf86DrvMsg (0, X_INFO, "max_width = %p\n", max_w);
         if((max_w < pScrn->displayWidth) || (max_h < numlines))
            return NULL;
 
@@ -330,22 +328,31 @@ static void S3DisplayVideoOverlay(ScrnIn
 		tmp = 0;
 	else
 		tmp = 2;
-
-	SET_SSTREAM_CNTL(tmp << 28 | 0x01000000 |
+	
+	xf86DrvMsg(0, X_INFO, "s3 overlay programming start\n");
+	
+	 SET_SSTREAM_CNTL(tmp << 28 | 0x01000000 |
 			 ((((src_w-1)<<1)-(drw_w-1)) & 0xfff));
+	
+	xf86DrvMsg(0, X_INFO, "s3 overlay sstretch programming start\n");		 
 	SET_SSTRETCH(((src_w - 1) & 0x7ff) | (((src_w-drw_w) & 0x7ff) << 16));
+	xf86DrvMsg(0, X_INFO, "s3 overlay blend programming start\n");
 	SET_BLEND_CNTL(0x05000000);
+	xf86DrvMsg(0, X_INFO, "s3 overlay sstream fbaddr programming start\n");
 	SET_SSTREAM_FBADDR(offset & 0x3fffff);
 	SET_SSTREAM_STRIDE(pitch & 0xfff);
 
+	xf86DrvMsg(0, X_INFO, "s3 scaler programming start\n");
 	SET_K1_VSCALE(src_h - 1);
 	SET_K2_VSCALE((src_h - drw_h) & 0x7ff);
 
 	SET_DDA_VERT((((~drw_h)-1)) & 0xfff);
-
+	
+	xf86DrvMsg(0, X_INFO, "s3 secondary stream programming start\n");
 	SET_SSTREAM_START(((dstBox->x1 +1) << 16) | (dstBox->y1 +1));
 	SET_SSTREAM_WIND(( ((drw_w-1) << 16) | (drw_h ) ) & 0x7ff07ff);
 
+	xf86DrvMsg(0, X_INFO, "s3 chroma key programming start\n");
 	SET_CHROMA_KEY(0x10000000 |
 		       ((pScrn->weight.red-1) << 24) |
 		       ((pPriv->colorKey & pScrn->mask.red) >> pScrn->offset.red) <<
@@ -415,7 +422,10 @@ static int S3PutImage(ScrnInfoPtr pScrn,
    }
    
    if(!(pPriv->area = S3AllocateMemory(pScrn, pPriv->area, new_h)))
+	{
+	xf86DrvMsg(0, X_INFO, "Memory alloc failed!\n");
         return BadAlloc;
+	}
    
     /* copy data */
     top = y1 >> 16;
@@ -511,16 +521,22 @@ void S3InitStreams(ScrnInfoPtr pScrn, Di
         S3Ptr pS3 = S3PTR(pScrn);
         unsigned int pst_wind = (mode->HDisplay-1) << 16 | (mode->VDisplay);
         
-        SET_PSTREAM_CNTL(0x05000000 & 0x77000000);
-        SET_CHROMA_KEY(0x00);
-        SET_SSTREAM_CNTL(0x03000000);
-        SET_BLEND_CNTL(0x01000000);
-        SET_PSTREAM_STRIDE((pScrn->displayWidth * 2) & 0x0fff);
-        SET_SSTREAM_STRIDE(0x01);
-        SET_OPAQUE_OVERLAY(0x40000000);
-        SET_PSTREAM_START(0x00010001);
-        SET_PSTREAM_WIND(pst_wind & 0x07ff07ff);
-        SET_SSTREAM_START(0x07ff07ff);
-        SET_SSTREAM_WIND(0x00010001);
+        //SET_PSTREAM_CNTL(0x05000000 & 0x77000000); 
+	SET_PSTREAM_CNTL(0x05000000);
+	SET_PSTREAM_FBADDR(0x0);
+        //SET_CHROMA_KEY(0x00);
+        //SET_SSTREAM_CNTL(0x03000000);
+         //SET_BLEND_CNTL(0x01000000);
+	/* SET_BLEND_CNTL(0x00000000);*/
+        //SET_PSTREAM_STRIDE((pScrn->displayWidth * 2) & 0x0fff);
+	SET_PSTREAM_STRIDE(0x500);
+        //SET_SSTREAM_STRIDE(0x01);
+        //SET_OPAQUE_OVERLAY(0x40000000);
+        //SET_PSTREAM_START(0x00010001);
+	SET_PSTREAM_START(1 << 16 | 1 );
+        //SET_PSTREAM_WIND(pst_wind & 0x07ff07ff);
+	SET_PSTREAM_WIND(0x280 << 16 | 0x1e0);
+        //SET_SSTREAM_START(0x07ff07ff);
+        //SET_SSTREAM_WIND(0x00010001);
 }