diff options
Diffstat (limited to 'xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c')
-rw-r--r-- | xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c | 165 |
1 files changed, 107 insertions, 58 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c index f3d4ef3e9..0279a584a 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c @@ -1,5 +1,5 @@ /* - * Copyright 1997,1998 by Alan Hourihane <alanh@fairlite.demon.co.uk> + * Copyright 1997-2001 by Alan Hourihane <alanh@fairlite.demon.co.uk> * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -27,7 +27,7 @@ * this work is sponsored by S.u.S.E. GmbH, Fuerth, Elsa GmbH, Aachen and * Siemens Nixdorf Informationssysteme */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c,v 1.17 2000/09/11 16:58:56 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c,v 1.24 2001/02/07 13:26:20 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -39,40 +39,6 @@ #include "glint_regs.h" #include "glint.h" -static int -Shiftbpp(ScrnInfoPtr pScrn, int value) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - /* shift horizontal timings for 64bit VRAM's or 32bit SGRAMs */ - int logbytesperaccess = 2; - - switch (pScrn->bitsPerPixel) { - case 8: - value >>= logbytesperaccess; - pGlint->BppShift = logbytesperaccess; - break; - case 16: - if (pGlint->DoubleBuffer) { - value >>= (logbytesperaccess-2); - pGlint->BppShift = logbytesperaccess-2; - } else { - value >>= (logbytesperaccess-1); - pGlint->BppShift = logbytesperaccess-1; - } - break; - case 24: - value *= 3; - value >>= logbytesperaccess; - pGlint->BppShift = logbytesperaccess; - break; - case 32: - value >>= (logbytesperaccess-2); - pGlint->BppShift = logbytesperaccess-2; - break; - } - return (value); -} - static unsigned long PM2VDAC_CalculateClock ( @@ -108,11 +74,43 @@ PM2VDAC_CalculateClock return(actualclock); } +void +Permedia2VPreInit(ScrnInfoPtr pScrn) +{ + GLINTPtr pGlint = GLINTPTR(pScrn); + + if (IS_JPRO) { + /* Appian Jeronimo Pro 4x8mb (pm2v version) */ + /* BIOS doesn't initialize the secondary heads, so we need to */ + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Appian Jeronimo Pro 4x8mb board detected and initialized.\n"); + + /* disable MCLK */ + Permedia2vOutIndReg(pScrn, PM2VDACRDMClkControl, 0x00, 0); + + /* boot new mclk values */ + Permedia2vOutIndReg(pScrn, PM2VDACRDMClkPreScale, 0x00, 0x09); + Permedia2vOutIndReg(pScrn, PM2VDACRDMClkFeedbackScale, 0x00, 0x58); + Permedia2vOutIndReg(pScrn, PM2VDACRDMClkPostScale, 0x00, 0x01); + + /* re-enable MCLK */ + Permedia2vOutIndReg(pScrn, PM2VDACRDMClkControl, 0x00, 1); + + /* spin until locked MCLK */ + while ( (Permedia2vInIndReg(pScrn, PM2VDACRDMClkControl) & 0x2) == 0); + + /* Now re-boot the SGRAM's */ + GLINT_SLOW_WRITE_REG(0xe6002021,PMMemConfig); + GLINT_SLOW_WRITE_REG(0x00000020,PMBootAddress); + } +} + Bool Permedia2VInit(ScrnInfoPtr pScrn, DisplayModePtr mode) { GLINTPtr pGlint = GLINTPTR(pScrn); - GLINTRegPtr pReg = &pGlint->ModeReg; + GLINTRegPtr pReg = &pGlint->ModeReg[0]; CARD32 temp1, temp2, temp3, temp4; pReg->glintRegs[Aperture0 >> 3] = 0; @@ -120,13 +118,8 @@ Permedia2VInit(ScrnInfoPtr pScrn, DisplayModePtr mode) pReg->glintRegs[PMFramebufferWriteMask >> 3] = 0xFFFFFFFF; pReg->glintRegs[PMBypassWriteMask >> 3] = 0xFFFFFFFF; - if (pGlint->UsePCIRetry) { - pReg->glintRegs[DFIFODis >> 3] = 1; - pReg->glintRegs[FIFODis >> 3] = 3; - } else { - pReg->glintRegs[DFIFODis >> 3] = 0; - pReg->glintRegs[FIFODis >> 3] = 1; - } + pReg->glintRegs[DFIFODis >> 3] = 0; + pReg->glintRegs[FIFODis >> 3] = 1; if (pGlint->UseBlockWrite) pReg->glintRegs[PMMemConfig >> 3] = GLINT_READ_REG(PMMemConfig) | 1<<21; @@ -192,9 +185,9 @@ Permedia2VInit(ScrnInfoPtr pScrn, DisplayModePtr mode) pReg->DacRegs[PM2VDACRDMiscControl] = 0x00; /* 6bit DAC */ pReg->DacRegs[PM2VDACRDSyncControl] = 0x00; - if (!(mode->Flags & V_PHSYNC)) + if (mode->Flags & V_PHSYNC) pReg->DacRegs[PM2VDACRDSyncControl] |= 0x01; /* invert hsync */ - if (!(mode->Flags & V_PVSYNC)) + if (mode->Flags & V_PVSYNC) pReg->DacRegs[PM2VDACRDSyncControl] |= 0x08; /* invert vsync */ switch (pScrn->bitsPerPixel) @@ -218,7 +211,7 @@ Permedia2VInit(ScrnInfoPtr pScrn, DisplayModePtr mode) pReg->DacRegs[PM2VDACRDPixelSize] = 0x02; pReg->DacRegs[PM2VDACRDColorFormat] = 0x20; if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR) { - pReg->DacRegs[PM2VDACRDMiscControl] |= 0x10; + pReg->DacRegs[PM2VDACRDMiscControl] |= 0x18; pReg->DacRegs[PM2VDACRDOverlayKey] = pScrn->colorKey; } break; @@ -233,6 +226,11 @@ Permedia2VSave(ScrnInfoPtr pScrn, GLINTRegPtr glintReg) GLINTPtr pGlint = GLINTPTR(pScrn); 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 */ + memcpy((CARD8*)pGlint->VGAdata,(CARD8*)pGlint->FbBase, 65536); + glintReg->glintRegs[ChipConfig >> 3] = GLINT_READ_REG(ChipConfig); glintReg->glintRegs[Aperture0 >> 3] = GLINT_READ_REG(Aperture0); glintReg->glintRegs[Aperture1 >> 3] = GLINT_READ_REG(Aperture1); @@ -291,12 +289,11 @@ Permedia2VRestore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg) CARD32 temp; int i; -#if 0 - GLINT_SLOW_WRITE_REG(0, ResetStatus); - while(GLINT_READ_REG(ResetStatus) != 0) { - xf86MsgVerb(X_INFO, 2, "Resetting Engine - Please Wait.\n"); - }; -#endif + /* 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 */ + if (pGlint->STATE) + memcpy((CARD8*)pGlint->FbBase,(CARD8*)pGlint->VGAdata, 65536); GLINT_SLOW_WRITE_REG(glintReg->glintRegs[ChipConfig >> 3], ChipConfig); GLINT_SLOW_WRITE_REG(glintReg->glintRegs[Aperture0 >> 3], Aperture0); @@ -371,15 +368,33 @@ Permedia2vHideCursor(ScrnInfoPtr pScrn) } static void +Permedia2vLoadCursorCallback( + ScrnInfoPtr pScrn +) +{ + GLINTPtr pGlint = GLINTPTR(pScrn); + int i; + + for (i=0; i<1024; i++) + Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPattern+i, 0x00, + pGlint->HardwareCursorPattern[i]); + + pGlint->LoadCursorCallback = NULL; +} + +static void Permedia2vLoadCursorImage( ScrnInfoPtr pScrn, unsigned char *src ) { + GLINTPtr pGlint = GLINTPTR(pScrn); int i; for (i=0; i<1024; i++) - Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPattern+i, 0x00, *(src++)); + pGlint->HardwareCursorPattern[i] = *(src++); + + pGlint->LoadCursorCallback = Permedia2vLoadCursorCallback; } static void @@ -402,12 +417,18 @@ Permedia2vSetCursorPosition( } static void -Permedia2vSetCursorColors( - ScrnInfoPtr pScrn, - int bg, int fg +Permedia2vCursorColorCallback( + ScrnInfoPtr pScrn ) { - /* A 2 color cursor uses last 2 indexes into hardware cursor palette */ + GLINTPtr pGlint = GLINTPTR(pScrn); + int fg = pGlint->FGCursor; + int bg = pGlint->BGCursor; + + if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && + (pGlint->MultiChip == PCI_CHIP_PERMEDIA3)) ) { + /* PM3 uses last 2 indexes into hardware cursor palette fg first...*/ Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+39, 0x00, (fg>>16)&0xff); Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+40, 0x00, (fg>>8)&0xff); Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+41, 0x00, fg & 0xff); @@ -415,6 +436,31 @@ Permedia2vSetCursorColors( Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+42, 0x00, (bg>>16)&0xff); Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+43, 0x00, (bg>>8)&0xff); Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+44, 0x00, bg & 0xff); + } else { + /* PM2v uses first 2 indexes into hardware cursor palette bg first...*/ + Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+0, 0x00, (bg>>16)&0xff); + Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+1, 0x00, (bg>>8)&0xff); + Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+2, 0x00, bg & 0xff); + + Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+3, 0x00, (fg>>16)&0xff); + Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+4, 0x00, (fg>>8)&0xff); + Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+5, 0x00, fg & 0xff); + } + pGlint->CursorColorCallback = NULL; +} + +static void +Permedia2vSetCursorColors( + ScrnInfoPtr pScrn, + int bg, int fg +) +{ + GLINTPtr pGlint = GLINTPTR(pScrn); + + pGlint->FGCursor = fg; + pGlint->BGCursor = bg; + + pGlint->CursorColorCallback = Permedia2vCursorColorCallback; } static Bool @@ -438,6 +484,9 @@ Permedia2vHWCursorInit(ScreenPtr pScreen) infoPtr->MaxWidth = 64; infoPtr->MaxHeight = 64; infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | +#if X_BYTE_ORDER == X_BIG_ENDIAN + HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | +#endif HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1; infoPtr->SetCursorColors = Permedia2vSetCursorColors; infoPtr->SetCursorPosition = Permedia2vSetCursorPosition; |