Module Name:    xsrc
Committed By:   snj
Date:           Fri Oct 16 06:58:54 UTC 2009

Modified Files:
        xsrc/external/mit/xf86-video-newport/dist/src [netbsd-5]:
            newport_cmap.c newport_driver.c newport_regs.c newport_regs.h

Log Message:
Pull up following revision(s) (requested by macallan in ticket #1092):
        external/mit/xf86-video-newport/dist/src/newport_cmap.c: revision 1.2
        external/mit/xf86-video-newport/dist/src/newport_driver.c: revision 1.5
        external/mit/xf86-video-newport/dist/src/newport_regs.c: revision 1.2
        external/mit/xf86-video-newport/dist/src/newport_regs.h: revision 1.2
make this work in the New Order Of Things(tm):
- make Xorg -configure work again
- fix the DCB timing when talking to XMAP9 to the values used by the kernel,
now colours look right on my Indy and all the randomness when starting
X is gone


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.2 -r1.1.1.1.2.3 \
    xsrc/external/mit/xf86-video-newport/dist/src/newport_cmap.c \
    xsrc/external/mit/xf86-video-newport/dist/src/newport_regs.c \
    xsrc/external/mit/xf86-video-newport/dist/src/newport_regs.h
cvs rdiff -u -r1.3.2.3 -r1.3.2.4 \
    xsrc/external/mit/xf86-video-newport/dist/src/newport_driver.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xf86-video-newport/dist/src/newport_cmap.c
diff -u xsrc/external/mit/xf86-video-newport/dist/src/newport_cmap.c:1.1.1.1.2.2 xsrc/external/mit/xf86-video-newport/dist/src/newport_cmap.c:1.1.1.1.2.3
--- xsrc/external/mit/xf86-video-newport/dist/src/newport_cmap.c:1.1.1.1.2.2	Wed Feb 25 21:31:00 2009
+++ xsrc/external/mit/xf86-video-newport/dist/src/newport_cmap.c	Fri Oct 16 06:58:54 2009
@@ -71,7 +71,8 @@
 	}
 #endif
 	for(i = 0; i < 256; i++) {
-		NewportCmapSetRGB(pNewport->pNewportRegs, i, pNewport->txt_colormap[i]);
+		NewportCmapSetRGB(pNewport->pNewportRegs, i, 
+		    pNewport->txt_colormap[i]);
 	}
 }
 
@@ -80,8 +81,8 @@
 static void NewportCmapFifoWait(NewportRegsPtr pNewportRegs)
 {
         while(1) {
-		pNewportRegs->set.dcbmode = (NPORT_DMODE_ACM0 |  NCMAP_PROTOCOL |
-						NCMAP_REGADDR_SREG | NPORT_DMODE_W1);
+		pNewportRegs->set.dcbmode = (NPORT_DMODE_ACM0 | NCMAP_PROTOCOL |
+		    NCMAP_REGADDR_SREG | NPORT_DMODE_W1);
 		if(!(pNewportRegs->set.dcbdata0.bytes.b3 & 4))
 			break;
         }
@@ -91,6 +92,7 @@
 /* set the colormap entry at addr to color */
 void NewportCmapSetRGB( NewportRegsPtr pNewportRegs, unsigned short addr, LOCO color)
 {
+	uint32_t colour;
 	NewportWait(pNewportRegs);	/* this one should not be necessary */
 	NewportBfwait(pNewportRegs);
 	pNewportRegs->set.dcbmode = (NPORT_DMODE_ACMALL | NCMAP_PROTOCOL |
@@ -99,9 +101,9 @@
 	pNewportRegs->set.dcbdata0.hwords.s1 = addr;
 	pNewportRegs->set.dcbmode = (NPORT_DMODE_ACMALL | NCMAP_PROTOCOL |
 				 NCMAP_REGADDR_PBUF | NPORT_DMODE_W3);
-	pNewportRegs->set.dcbdata0.all = (color.red << 24) |
-						(color.green << 16) |
+	colour = (color.red << 24) | (color.green << 16) |
 						(color.blue << 8);
+	pNewportRegs->set.dcbdata0.all = colour;
 }
 
 /* get the colormap entry at addr */
Index: xsrc/external/mit/xf86-video-newport/dist/src/newport_regs.c
diff -u xsrc/external/mit/xf86-video-newport/dist/src/newport_regs.c:1.1.1.1.2.2 xsrc/external/mit/xf86-video-newport/dist/src/newport_regs.c:1.1.1.1.2.3
--- xsrc/external/mit/xf86-video-newport/dist/src/newport_regs.c:1.1.1.1.2.2	Wed Feb 25 21:31:00 2009
+++ xsrc/external/mit/xf86-video-newport/dist/src/newport_regs.c	Fri Oct 16 06:58:54 2009
@@ -14,19 +14,19 @@
 void 
 NewportVc2Set(NewportRegsPtr pNewportRegs, unsigned char vc2Ireg, unsigned short val)
 {
-	pNewportRegs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W3 |
-					NPORT_DMODE_ECINC | VC2_PROTOCOL);
+	pNewportRegs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | 
+	    NPORT_DMODE_W3 | NPORT_DMODE_ECINC | VC2_PROTOCOL);
 	pNewportRegs->set.dcbdata0.all = (vc2Ireg << 24) | (val << 8);
 }
 
 unsigned short 
 NewportVc2Get(NewportRegsPtr pNewportRegs, unsigned char vc2Ireg)
 {
-	pNewportRegs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W1 |
-					NPORT_DMODE_ECINC | VC2_PROTOCOL);
+	pNewportRegs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | 
+	    NPORT_DMODE_W1 | NPORT_DMODE_ECINC | VC2_PROTOCOL);
 	pNewportRegs->set.dcbdata0.bytes.b3 = vc2Ireg;
-	pNewportRegs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_IREG | NPORT_DMODE_W2 |
-					NPORT_DMODE_ECINC | VC2_PROTOCOL);
+	pNewportRegs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_IREG | 
+	    NPORT_DMODE_W2 | NPORT_DMODE_ECINC | VC2_PROTOCOL);
 	return pNewportRegs->set.dcbdata0.hwords.s1;
 }
 
@@ -106,7 +106,7 @@
 	while(1) {
 		NewportBfwait( pNewportRegs);
 		pNewportRegs->set.dcbmode = (xmapChip | R_DCB_XMAP9_PROTOCOL |
-						XM9_CRS_FIFO_AVAIL | NPORT_DMODE_W1);
+		    XM9_CRS_FIFO_AVAIL | NPORT_DMODE_W1);
 		if( (pNewportRegs->set.dcbdata0.bytes.b3) & 7 ) 
 			break;
 	}
Index: xsrc/external/mit/xf86-video-newport/dist/src/newport_regs.h
diff -u xsrc/external/mit/xf86-video-newport/dist/src/newport_regs.h:1.1.1.1.2.2 xsrc/external/mit/xf86-video-newport/dist/src/newport_regs.h:1.1.1.1.2.3
--- xsrc/external/mit/xf86-video-newport/dist/src/newport_regs.h:1.1.1.1.2.2	Wed Feb 25 21:31:01 2009
+++ xsrc/external/mit/xf86-video-newport/dist/src/newport_regs.h	Fri Oct 16 06:58:54 2009
@@ -397,8 +397,8 @@
 #   define XM9_CRS_FIFO_AVAIL        (2 << DCB_CRS_SHIFT)
 #       define XM9_FIFO_0_AVAIL      0
 #       define XM9_FIFO_1_AVAIL      1
-#       define XM9_FIFO_2_AVAIL      3
-#       define XM9_FIFO_3_AVAIL      2
+#       define XM9_FIFO_2_AVAIL      2
+#       define XM9_FIFO_3_AVAIL      3
 #       define XM9_FIFO_FULL         XM9_FIFO_0_AVAIL
 #       define XM9_FIFO_EMPTY        XM9_FIFO_3_AVAIL
 #   define XM9_CRS_CURS_CMAP_MSB     (3 << DCB_CRS_SHIFT)
@@ -412,7 +412,7 @@
 		   (setup << DCB_CSSETUP_SHIFT)|    \
 		   (width << DCB_CSWIDTH_SHIFT))
 
-#define W_DCB_XMAP9_PROTOCOL       DCB_CYCLES (2, 1, 0)
+#define W_DCB_XMAP9_PROTOCOL       DCB_CYCLES (1, 2, 3)
 #define WSLOW_DCB_XMAP9_PROTOCOL   DCB_CYCLES (5, 5, 0)
 #define WAYSLOW_DCB_XMAP9_PROTOCOL DCB_CYCLES (12, 12, 0)
 #define R_DCB_XMAP9_PROTOCOL       DCB_CYCLES (2, 1, 3)

Index: xsrc/external/mit/xf86-video-newport/dist/src/newport_driver.c
diff -u xsrc/external/mit/xf86-video-newport/dist/src/newport_driver.c:1.3.2.3 xsrc/external/mit/xf86-video-newport/dist/src/newport_driver.c:1.3.2.4
--- xsrc/external/mit/xf86-video-newport/dist/src/newport_driver.c:1.3.2.3	Thu Sep 17 03:34:06 2009
+++ xsrc/external/mit/xf86-video-newport/dist/src/newport_driver.c	Fri Oct 16 06:58:54 2009
@@ -246,7 +246,8 @@
 static void
 NewportIdentify(int flags)
 {
-	xf86PrintChipsets( NEWPORT_NAME, "driver for Newport Graphics Card", NewportChipsets);
+	xf86PrintChipsets( NEWPORT_NAME, "driver for Newport Graphics Card", 
+	    NewportChipsets);
 }
 
 static Bool
@@ -266,9 +267,24 @@
 	if ( numUsed <= 0 ) 
 		return FALSE;
 
-	if(flags & PROBE_DETECT) 
+	if ( xf86DoConfigure && xf86DoConfigurePass1 ) {
+		GDevPtr pGDev;
+		for (i = 0; i < numUsed; i++) {
+			pGDev = xf86AddBusDeviceToConfigure(NEWPORT_DRIVER_NAME,
+				BUS_NONE, NULL, 0);
+			if (pGDev) {
+				/*
+				 * XF86Match???Instances() treat chipID and 
+				 * chipRev as overrides, so clobber them here.
+				 */
+				pGDev->chipID = pGDev->chipRev = -1;
+			}
+	    	}
+	}
+
+	if(flags & PROBE_DETECT) {
 		foundScreen = TRUE;
-	else {
+	} else {
 		for (i = 0; i < numDevSections; i++) {
 			dev = devSections[i];
 			busID =  xf86SetIntOption(dev->options, "BusID", 0);
@@ -281,13 +297,15 @@
 					/* This is a hack because don't have the RAC info(and don't want it).  
 					 * Set it as an ISA entity to get the entity field set up right.
 					 */
-					entity = xf86ClaimIsaSlot(drv, 0, dev, TRUE);
+					entity = xf86ClaimFbSlot(drv, 0, dev,
+					    TRUE);
 					base = (NEWPORT_BASE_ADDR0
 						+ busID * NEWPORT_BASE_OFFSET);
-					RANGE(range[0], base, base + sizeof(NewportRegs),\
-							ResExcMemBlock);
-					pScrn = (void *)xf86ConfigIsaEntity(pScrn, 0, entity, NULL, range, \
-							NULL, NULL, NULL, NULL);
+					RANGE(range[0], base, base +
+					    sizeof(NewportRegs), 
+					    ResExcMemBlock);
+					pScrn = (void *)xf86ConfigFbEntity(NULL,
+					    0, entity, NULL, NULL, NULL, NULL);
 					/* Allocate a ScrnInfoRec */
 					pScrn->driverVersion = NEWPORT_VERSION;
 					pScrn->driverName    = NEWPORT_DRIVER_NAME;
@@ -678,7 +696,7 @@
 	if (serverGeneration == 1) {
 		xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
 	}
-	
+	NewportModeInit(pScrn, pScrn->currentMode);
 	return TRUE;
 }
 
@@ -808,9 +826,11 @@
 		    ~(XM9_8_BITPLANES | XM9_PUPMODE);
 		NewportBfwait(pNewport->pNewportRegs);
 		/* set up the mode register for 24bpp */
-		mode = XM9_MREG_PIX_SIZE_24BPP | XM9_MREG_PIX_MODE_RGB1
+		mode = XM9_MREG_PIX_SIZE_24BPP | XM9_MREG_PIX_MODE_RGB2
 				| XM9_MREG_GAMMA_BYPASS;
-		NewportXmap9SetModeRegister( pNewportRegs , 0, mode);
+		for (i = 0; i < 32; i++)
+			NewportXmap9SetModeRegister( pNewportRegs , i, mode);
+
 		/* select the set up mode register */
 		NewportBfwait(pNewport->pNewportRegs);
 		pNewportRegs->set.dcbmode = (DCB_XMAP_ALL | W_DCB_XMAP9_PROTOCOL |
@@ -824,22 +844,29 @@
 					NPORT_DMODE1_RGBMD | 
 					/* turn on 8888 = RGBA pixel packing */
 					NPORT_DMODE1_HD32 | NPORT_DMODE1_RWPCKD;
-		/* After setting up XMAP9 we have to reinitialize the CMAP for
-		 * whatever reason (the docs say nothing about it). RestorePalette()
-		 * is just a lazy way to do this */
-		/*NewportRestorePalette( pScrn );*/
+		/*
+		 * After setting up XMAP9 we have to reinitialize the CMAP for
+		 * whatever reason (the docs say nothing about it). 
+		 */
+
+
 		for (i = 0; i < 256; i++) {
 			col.red = col.green = col.blue = i;
 			NewportCmapSetRGB(NEWPORTREGSPTR(pScrn), i, col);
-			NewportCmapSetRGB(NEWPORTREGSPTR(pScrn), i + 256, col);
-			NewportCmapSetRGB(NEWPORTREGSPTR(pScrn), i + 512, col);
 		}
+		for (i = 0; i < 256; i++) {
+			col.red = col.green = col.blue = i;
+			NewportCmapSetRGB(NEWPORTREGSPTR(pScrn), i + 0x1f00,
+			    col);
+		}
+
 	}
 	/* blank the framebuffer */
 	NewportWait(pNewportRegs);
-	pNewportRegs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_DOSETUP |
-					NPORT_DMODE0_STOPX | NPORT_DMODE0_STOPY |
-					NPORT_DMODE0_BLOCK);
+	pNewportRegs->set.drawmode0 = (NPORT_DMODE0_DRAW |
+				       NPORT_DMODE0_DOSETUP |
+				       NPORT_DMODE0_STOPX | NPORT_DMODE0_STOPY |
+				       NPORT_DMODE0_BLOCK);
 	pNewportRegs->set.drawmode1 = pNewport->drawmode1 |
 					NPORT_DMODE1_FCLR |
 					NPORT_DMODE1_RGBMD;

Reply via email to