void Permedia3LoadPalette( ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual ){ #if 0 GLINTPtr pGlint = GLINTPTR(pScrn); #endif int i, index, shift = 0, j, repeat = 1; if (pScrn->depth == 15) { repeat = 8; shift = 3; } for(i = 0; i < numColors; i++) { index = indices[i]; for (j = 0; j < repeat; j++) { Permedia2WriteAddress(pScrn, (index << shift)+j); Permedia2WriteData(pScrn, colors[index].red); Permedia2WriteData(pScrn, colors[index].green); Permedia2WriteData(pScrn, colors[index].blue); } #if 0 GLINT_SLOW_WRITE_REG(index, PM3LUTIndex); GLINT_SLOW_WRITE_REG((colors[index].red & 0xFF) | ((colors[index].green & 0xFF) << 8) | ((colors[index].blue & 0xFF) << 16), PM3LUTData); #endif } }
/* special one for 565 mode */ void Permedia3LoadPalette16( ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual ){ #if 0 GLINTPtr pGlint = GLINTPTR(pScrn); #endif int i, index, j; for(i = 0; i < numColors; i++) { index = indices[i]; for (j = 0; j < 4; j++) { Permedia2WriteAddress(pScrn, (index << 2)+j); Permedia2WriteData(pScrn, colors[index >> 1].red); Permedia2WriteData(pScrn, colors[index].green); Permedia2WriteData(pScrn, colors[index >> 1].blue); } #if 0 GLINT_SLOW_WRITE_REG(index, PM3LUTIndex); GLINT_SLOW_WRITE_REG((colors[index].red & 0xFF) | ((colors[index].green & 0xFF) << 8) | ((colors[index].blue & 0xFF) << 16), PM3LUTData); #endif if(index <= 31) { for (j = 0; j < 4; j++) { Permedia2WriteAddress(pScrn, (index << 3)+j); Permedia2WriteData(pScrn, colors[index].red); Permedia2WriteData(pScrn, colors[(index << 1) + 1].green); Permedia2WriteData(pScrn, colors[index].blue); } } } }
static void setregs(const unsigned char regs[], int mode) { int i; unsigned int *p = (unsigned int *)(regs+VGA_TOTAL_REGS); const unsigned char *q = regs+188; unlock(); GLINT_SLOW_WRITE_REG(0xFF, PM2DACReadMask); if(chiptype == cPM2V) GLINT_SLOW_WRITE_REG(p[19], ChipConfig); GLINT_SLOW_WRITE_REG(p[0], Aperture0); GLINT_SLOW_WRITE_REG(p[1], Aperture1); GLINT_SLOW_WRITE_REG(p[2], PMFramebufferWriteMask); GLINT_SLOW_WRITE_REG(p[3], PMBypassWriteMask); GLINT_SLOW_WRITE_REG(p[4], DFIFODis); GLINT_SLOW_WRITE_REG(p[5], FIFODis); if(0) GLINT_SLOW_WRITE_REG(p[6], PMMemConfig); GLINT_SLOW_WRITE_REG(p[17], PMVideoControl); GLINT_SLOW_WRITE_REG(p[9], PMHgEnd); GLINT_SLOW_WRITE_REG(p[16], PMScreenBase); GLINT_SLOW_WRITE_REG(p[18], VClkCtl); GLINT_SLOW_WRITE_REG(p[10], PMScreenStride); GLINT_SLOW_WRITE_REG(p[7], PMHTotal); GLINT_SLOW_WRITE_REG(p[8], PMHbEnd); GLINT_SLOW_WRITE_REG(p[24], PMHsStart); GLINT_SLOW_WRITE_REG(p[11], PMHsEnd); GLINT_SLOW_WRITE_REG(p[12], PMVTotal); GLINT_SLOW_WRITE_REG(p[13], PMVbEnd); GLINT_SLOW_WRITE_REG(p[14], PMVsStart); GLINT_SLOW_WRITE_REG(p[15], PMVsEnd); if(chiptype != cPM2V) GLINT_SLOW_WRITE_REG(p[19], ChipConfig); for (i=0;i<768;i++) { Permedia2WriteAddress(i); Permedia2WriteData(regs[VGA_TOTAL_REGS + 128 + i]); } switch(chiptype) { case cPM2: Permedia2OutIndReg(PM2DACIndexMCR, 0x00, p[25]); Permedia2OutIndReg(PM2DACIndexMDCR, 0x00, p[26]); Permedia2OutIndReg(PM2DACIndexCMR, 0x00, p[27]); Permedia2OutIndReg(PM2DACIndexClockAM, 0x00, p[20]); Permedia2OutIndReg(PM2DACIndexClockAN, 0x00, p[21]); Permedia2OutIndReg(PM2DACIndexClockAP, 0x00, p[22]); break; case cPM2V: GLINT_SLOW_WRITE_REG(p[23],PM2VDACRDIndexControl); Permedia2vOutIndReg(PM2VDACRDOverlayKey, 0x00, p[25]); Permedia2vOutIndReg(PM2VDACRDSyncControl, 0x00, p[26]); Permedia2vOutIndReg(PM2VDACRDMiscControl, 0x00, p[27]); Permedia2vOutIndReg(PM2VDACRDDACControl, 0x00, p[28]); Permedia2vOutIndReg(PM2VDACRDPixelSize, 0x00, p[29]); Permedia2vOutIndReg(PM2VDACRDColorFormat, 0x00, p[30]); i = Permedia2vInIndReg(PM2VDACIndexClockControl) & 0xFC; Permedia2vOutIndReg(PM2VDACRDDClk0PreScale, 0x00, p[20]); Permedia2vOutIndReg(PM2VDACRDDClk0FeedbackScale, 0x00, p[21]); Permedia2vOutIndReg(PM2VDACRDDClk0PostScale, 0x00, p[22]); Permedia2vOutIndReg(PM2VDACIndexClockControl, 0x00, i | 0x03); for(i=0;i<6;i++) Permedia2vOutIndReg(PM2VDACRDCursorPalette+i, 0x00, q[i]); Permedia2vOutIndReg(PM2VDACRDCursorHotSpotX, 0x00, q[6]); Permedia2vOutIndReg(PM2VDACRDCursorHotSpotY, 0x00, q[7]); Permedia2vOutIndReg(PM2VDACRDCursorXLow, 0x00, q[8]); Permedia2vOutIndReg(PM2VDACRDCursorXHigh, 0x00, q[9]); Permedia2vOutIndReg(PM2VDACRDCursorYLow, 0x00, q[10]); Permedia2vOutIndReg(PM2VDACRDCursorYHigh, 0x00, q[11]); Permedia2vOutIndReg(PM2DACCursorControl, 0x00, q[12]); Permedia2vOutIndReg(PM2VDACRDCursorMode, 0x00, q[13]); } }
void Permedia3Restore(ScrnInfoPtr pScrn, GLINTRegPtr pReg) { GLINTPtr pGlint = GLINTPTR(pScrn); CARD32 temp; int i; /* We can't rely on the vgahw layer copying the font information * back properly, due to problems with MMIO access to VGA space * so we memcpy the information using the slow routines */ if (pGlint->STATE) xf86SlowBcopy((CARD8*)pGlint->VGAdata, (CARD8*)pGlint->FbBase, 65536); if ((pGlint->numMultiDevices == 2) || (IS_J2000)) { RESTOREREG(GCSRAperture); } if (pGlint->MultiAperture) { RESTOREREG(GMultGLINTAperture); RESTOREREG(GMultGLINT1); RESTOREREG(GMultGLINT2); } /* Permedia 3 memory Timings */ RESTOREREG(PM3MemBypassWriteMask); RESTOREREG(PM3ByAperture1Mode); RESTOREREG(PM3ByAperture2Mode); RESTOREREG(ChipConfig); RESTOREREG(Aperture0); RESTOREREG(Aperture1); RESTOREREG(PM3FifoControl); if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) RESTOREREG(DFIFODis); RESTOREREG(FIFODis); RESTOREREG(PMVideoControl); RESTOREREG(PMHbEnd); RESTOREREG(PMHgEnd); RESTOREREG(PMScreenBase); RESTOREREG(VClkCtl); RESTOREREG(PMScreenStride); RESTOREREG(PMHTotal); RESTOREREG(PMHsStart); RESTOREREG(PMHsEnd); RESTOREREG(PMVTotal); RESTOREREG(PMVbEnd); RESTOREREG(PMVsStart); RESTOREREG(PMVsEnd); if (pGlint->UseFlatPanel) { RESTOREREG(VSConfiguration); RESTOREREG(VSBBase); } RESTOREREG(PM2VDACRDIndexControl); P2VOUT(PM2VDACRDOverlayKey); P2VOUT(PM2VDACRDSyncControl); P2VOUT(PM2VDACRDMiscControl); P2VOUT(PM2VDACRDDACControl); P2VOUT(PM2VDACRDPixelSize); P2VOUT(PM2VDACRDColorFormat); for (i=0;i<768;i++) { Permedia2WriteAddress(pScrn, i); Permedia2WriteData(pScrn, pReg->cmap[i]); } temp = Permedia2vInIndReg(pScrn, PM2VDACIndexClockControl) & 0xFC; P2VOUT(PM2VDACRDDClk0PreScale); P2VOUT(PM2VDACRDDClk0FeedbackScale); P2VOUT(PM2VDACRDDClk0PostScale); Permedia2vOutIndReg(pScrn, PM2VDACIndexClockControl, 0x00, temp|0x03); }