diff options
author | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-09-15 16:33:58 +0000 |
---|---|---|
committer | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-09-15 16:33:58 +0000 |
commit | fb08c6f1a8ee5df3bd2d508f5bfbbd670c97c647 (patch) | |
tree | 1ff4c88ac8915330adb96be4b1a39a4e2df4837e | |
parent | 02a2549c8898ec01ed04a094e4daf340d7a12d1c (diff) |
Pull XORG-6_8_0 to CYGWIN branchYGWIN-6_8_1-MERGECYGWIN-6_8_1-MERGECYGWIN-6_8_0-MERGE
-rw-r--r-- | README.sgml | 1 | ||||
-rw-r--r-- | src/ct_BltHiQV.h | 9 | ||||
-rw-r--r-- | src/ct_accel.c | 53 | ||||
-rw-r--r-- | src/ct_cursor.c | 10 | ||||
-rw-r--r-- | src/ct_ddc.c | 2 | ||||
-rw-r--r-- | src/ct_driver.c | 153 | ||||
-rw-r--r-- | src/ct_driver.h | 11 | ||||
-rw-r--r-- | src/ct_video.c | 42 |
8 files changed, 199 insertions, 82 deletions
diff --git a/README.sgml b/README.sgml index 1cacd31..5a08441 100644 --- a/README.sgml +++ b/README.sgml @@ -11,7 +11,6 @@ <date> 1st January 2001 <ident> -$Id$ </ident> <!-- Table of contents --> diff --git a/src/ct_BltHiQV.h b/src/ct_BltHiQV.h index b40df72..775aa54 100644 --- a/src/ct_BltHiQV.h +++ b/src/ct_BltHiQV.h @@ -91,6 +91,13 @@ } \ } +#if X_BYTE_ORDER == X_BIG_ENDIAN +# define TWEAK_24_BE(c) \ + c = ((c & 0xFF0000) >> 16) | (c & 0xFF00) | (( c & 0xFF) << 16) +#else +# define TWEAK_24_BE(c) +#endif + #define ctSETROP(op) \ MMIO_OUT32(cPtr->MMIOBase, BR(0x4), op) @@ -129,6 +136,7 @@ } #define ctSETBGCOLOR24(c) {\ + TWEAK_24_BE(c); \ if ((cAcl->bgColor != (c)) || (cAcl->bgColor == -1)) { \ cAcl->bgColor = (c); \ MMIO_OUT32(cPtr->MMIOBase, BR(0x1), ((c)&0xFFFFFF)); \ @@ -150,6 +158,7 @@ } #define ctSETFGCOLOR24(c) {\ + TWEAK_24_BE(c); \ if ((cAcl->fgColor != (c)) || (cAcl->fgColor == -1)) { \ cAcl->fgColor = (c); \ MMIO_OUT32(cPtr->MMIOBase, BR(0x2), ((c)&0xFFFFFF)); \ diff --git a/src/ct_accel.c b/src/ct_accel.c index 6309074..dc55bcb 100644 --- a/src/ct_accel.c +++ b/src/ct_accel.c @@ -153,7 +153,19 @@ static void CTNAME(ReadPixmap)(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *dst, int dstwidth, int bpp, int depth); #endif #endif - +#if X_BYTE_ORDER == X_BIG_ENDIAN +# define BE_SWAP(pScrn,cPtr,x) \ + if (BE_SWAP_APRETURE(pScrn,cPtr)) { \ + CARD8 XR0A = cPtr->readXR(cPtr,0x0A); \ + cPtr->writeXR(cPtr, 0x0A, (XR0A & 0xcf) | x); \ + } + +# define BE_SWAPON(pScrn,cPtr) BE_SWAP(pScrn,cPtr,0x10) +# define BE_SWAPOFF(pScrn,cPtr) BE_SWAP(pScrn,cPtr,0x0) +#else +# define BE_SWAPON(pScrn,cPtr) +# define BE_SWAPOFF(pScrn,cPtr) +#endif Bool CTNAME(AccelInit)(ScreenPtr pScreen) @@ -277,17 +289,24 @@ CTNAME(AccelInit)(ScreenPtr pScreen) #ifdef CHIPS_HIQV infoPtr->CPUToScreenColorExpandFillFlags = - BIT_ORDER_IN_BYTE_MSBFIRST | CPU_TRANSFER_PAD_QWORD | +# if X_BYTE_ORDER != X_BIG_ENDIAN + BIT_ORDER_IN_BYTE_MSBFIRST | +# endif + CPU_TRANSFER_PAD_QWORD | LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X | ROP_NEEDS_SOURCE; -#ifdef UNDOCUMENTED_FEATURE +# ifdef UNDOCUMENTED_FEATURE infoPtr->ScreenToScreenColorExpandFillFlags = BIT_ORDER_IN_BYTE_MSBFIRST | LEFT_EDGE_CLIPPING; -#endif +# endif if (cAcl->BitsPerPixel == 24) { infoPtr->CPUToScreenColorExpandFillFlags |= NO_PLANEMASK; -#ifdef UNDOCUMENTED_FEATURE +# ifdef UNDOCUMENTED_FEATURE infoPtr->ScreenToScreenColorExpandFillFlags |= NO_PLANEMASK; +# endif +#if X_BYTE_ORDER == X_BIG_ENDIAN + if (BE_SWAP_APRETURE(pScrn,cPtr)) + infoPtr->CPUToScreenColorExpandFillFlags |= SYNC_AFTER_COLOR_EXPAND; #endif } /* The ct65550 has problems with transparency which leads to video @@ -295,11 +314,11 @@ CTNAME(AccelInit)(ScreenPtr pScreen) */ if (!(cPtr->Flags & ChipsColorTransparency)) { infoPtr->CPUToScreenColorExpandFillFlags |= NO_TRANSPARENCY; -#ifdef UNDOCUMENTED_FEATURE +# ifdef UNDOCUMENTED_FEATURE infoPtr->ScreenToScreenColorExpandFillFlags |= NO_TRANSPARENCY; -#endif +# endif } -#else +#else /* CHIPS_HIQV */ infoPtr->CPUToScreenColorExpandFillFlags = BIT_ORDER_IN_BYTE_MSBFIRST | CPU_TRANSFER_PAD_DWORD | ROP_NEEDS_SOURCE; @@ -309,7 +328,7 @@ CTNAME(AccelInit)(ScreenPtr pScreen) if (cAcl->BitsPerPixel == 24) infoPtr->CPUToScreenColorExpandFillFlags |= TRIPLE_BITS_24BPP | RGB_EQUAL | NO_PLANEMASK; -#endif +#endif /* CHIPS_HIQV */ infoPtr->SetupForCPUToScreenColorExpandFill = CTNAME(SetupForCPUToScreenColorExpandFill); @@ -458,6 +477,7 @@ CTNAME(Sync)(ScrnInfoPtr pScrn) CHIPSPtr cPtr = CHIPSPTR(pScrn); DEBUG_P("sync"); ctBLTWAIT; + BE_SWAPON(pScrn,cPtr); } static void @@ -892,6 +912,9 @@ CTNAME(SetupForCPUToScreenColorExpandFill)(ScrnInfoPtr pScrn, int fg, CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); DEBUG_P("SetupForCPUToScreenColorExpandFill"); + + BE_SWAPOFF(pScrn,cPtr); + ctBLTWAIT; cAcl->CommandFlags = 0; if (bg == -1) { @@ -1099,8 +1122,12 @@ CTNAME(CacheMonoStipple)(ScrnInfoPtr pScrn, PixmapPtr pPix) int i, j, max = 0, funcNo, pad, dwords, bpp = cAcl->BitsPerPixel; int *current; StippleScanlineProcPtr StippleFunc; + static StippleScanlineProcPtr *StippleTab = NULL; unsigned char *data, *srcPtr, *dstPtr; + if (!StippleTab) + StippleTab = XAAGetStippleScanlineFuncMSBFirst(); + DEBUG_P("CacheMonoStipple"); if((h <= 128) && (w <= 128 * bpp / 8)) { if(pCachePriv->Info128) { @@ -1153,7 +1180,7 @@ CTNAME(CacheMonoStipple)(ScrnInfoPtr pScrn, PixmapPtr pPix) pad = (((pCache->w * bpp) + 31) >> 5) << 2; dstPtr = data = (unsigned char*)ALLOCATE_LOCAL(pad * pCache->h); srcPtr = (unsigned char*)pPix->devPrivate.ptr; - StippleFunc = XAAStippleScanlineFuncMSBFirst[funcNo]; + StippleFunc = StippleTab[funcNo]; dwords = ((pCache->w * bpp) >> 5) >> 3; cAcl->SlotWidth = dwords << 2; @@ -1703,8 +1730,10 @@ CTNAME(ReadPixmap)(ScrnInfoPtr pScrn, int x, int y, int w, int h, ctSETPITCH(srcpitch, byteWidthDst); ctSETHEIGHTWIDTHGO(h, bytesPerLine); + BE_SWAPOFF(pScrn,cPtr); MoveDataToCPU((unsigned char *)cAcl->BltDataWindow, (unsigned char *)dst, dstwidth, 16384, h, dwords); + BE_SWAPON(pScrn,cPtr); } else { unsigned int vert = h; @@ -1714,8 +1743,10 @@ CTNAME(ReadPixmap)(ScrnInfoPtr pScrn, int x, int y, int w, int h, ctSETPITCH(srcpitch << 1, byteWidthDst << 1); ctSETHEIGHTWIDTHGO(h, bytesPerLine); + BE_SWAPOFF(pScrn,cPtr); MoveDataToCPU((unsigned char *)cAcl->BltDataWindow, (unsigned char *)dst, dstwidth<<1, 16384, h, dwords); + BE_SWAPON(pScrn,cPtr); h = vert >> 1; dst += dstwidth; @@ -1729,8 +1760,10 @@ CTNAME(ReadPixmap)(ScrnInfoPtr pScrn, int x, int y, int w, int h, ctSETSRCADDR(srcaddr); ctSETHEIGHTWIDTHGO(h, bytesPerLine); + BE_SWAPFF(pScrn,cPtr); MoveDataToCPU((unsigned char *)cAcl->BltDataWindow, (unsigned char *)dst, dstwidth<<1, 16384, h, dwords); + BE_SWAPON(pScrn,cPtr); } cPtr->AccelInfoRec->NeedToSync = TRUE; diff --git a/src/ct_cursor.c b/src/ct_cursor.c index 147469c..f88a335 100644 --- a/src/ct_cursor.c +++ b/src/ct_cursor.c @@ -330,9 +330,14 @@ CHIPSLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) if (cPtr->Flags & ChipsLinearSupport) { #if X_BYTE_ORDER == X_BIG_ENDIAN /* On big endian machines we must flip our cursor image around. */ - switch(cAcl->BytesPerPixel) { + switch(pScrn->bitsPerPixel >> 3) { case 4: case 3: +#if 1 + memcpy((unsigned char *)cPtr->FbBase + cAcl->CursorAddress, + src, cPtr->CursorInfoRec->MaxWidth * + cPtr->CursorInfoRec->MaxHeight / 4); +#else for (y = 0; y < 64; y++) { P_SWAP32(d,s); d++; s++; @@ -343,6 +348,7 @@ CHIPSLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) P_SWAP32(d,s); d++; s++; } +#endif break; case 2: for (y = 0; y < 64; y++) { @@ -354,8 +360,6 @@ CHIPSLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) d++; s++; P_SWAP16(d,s); d++; s++; - P_SWAP16(d,s); - d++; s++; } break; default: diff --git a/src/ct_ddc.c b/src/ct_ddc.c index 3cc8dfe..693f325 100644 --- a/src/ct_ddc.c +++ b/src/ct_ddc.c @@ -94,7 +94,7 @@ chips_ddc1(ScrnInfoPtr pScrn) xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "DDC1 found\n"); else return; - xf86PrintEDID(xf86DoEDID_DDC1(pScrn->scrnIndex,vgaHWddc1SetSpeed, + xf86PrintEDID(xf86DoEDID_DDC1(pScrn->scrnIndex, vgaHWddc1SetSpeedWeak(), chips_ddc1Read)); /* restore */ diff --git a/src/ct_driver.c b/src/ct_driver.c index 6d8593c..01570da 100644 --- a/src/ct_driver.c +++ b/src/ct_driver.c @@ -158,7 +158,8 @@ static void chipsLock(ScrnInfoPtr pScrn); static void chipsUnlock(ScrnInfoPtr pScrn); static void chipsClockSave(ScrnInfoPtr pScrn, CHIPSClockPtr Clock); static void chipsClockLoad(ScrnInfoPtr pScrn, CHIPSClockPtr Clock); -static Bool chipsClockFind(ScrnInfoPtr pScrn, int no, CHIPSClockPtr Clock); +static Bool chipsClockFind(ScrnInfoPtr pScrn, DisplayModePtr mode, + int no, CHIPSClockPtr Clock); static void chipsCalcClock(ScrnInfoPtr pScrn, int Clock, unsigned char *vclk); static int chipsGetHWClock(ScrnInfoPtr pScrn); @@ -581,7 +582,7 @@ static const OptionInfoRec Chips655xxOptions[] = { { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_STN, "STN", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_USE_MODELINE, "UseModeline", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_LCD_STRETCH, "NoStretch", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_LCD_STRETCH, "Stretch", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_LCD_CENTER, "LcdCenter", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_MMIO, "MMIO", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SUSPEND_HACK, "SuspendHack", OPTV_BOOLEAN, {0}, FALSE }, @@ -623,7 +624,7 @@ static const OptionInfoRec ChipsHiQVOptions[] = { { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_STN, "STN", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_USE_MODELINE, "UseModeline", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_LCD_STRETCH, "NoStretch", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_LCD_STRETCH, "Stretch", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_LCD_CENTER, "LcdCenter", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_MMIO, "MMIO", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_FULL_MMIO, "FullMMIO", OPTV_BOOLEAN, {0}, FALSE }, @@ -675,7 +676,7 @@ static const char *vgahwSymbols[] = { "vgaHWSave", "vgaHWUnlock", "vgaHWVBlankKGA", - "vgaHWddc1SetSpeed", + "vgaHWddc1SetSpeedWeak", NULL }; @@ -748,7 +749,7 @@ static XF86ModuleVersionInfo chipsVersRec = MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, - XF86_VERSION_CURRENT, + XORG_VERSION_CURRENT, CHIPS_MAJOR_VERSION, CHIPS_MINOR_VERSION, CHIPS_PATCHLEVEL, ABI_CLASS_VIDEODRV, ABI_VIDEODRV_VERSION, @@ -1427,8 +1428,11 @@ chipsPreInitHiQV(ScrnInfoPtr pScrn, int flags) hwp = VGAHWPTR(pScrn); vgaHWGetIOBase(hwp); +#if XF86_VERSION_CURRENT > XF86_VERSION_NUMERIC(4,1,0,0,0) cPtr->PIOBase = hwp->PIOOffset; - +#else + cPtr->PIOBase = 0 ; /* for old version the IO offset is global */ +#endif /* * Must allow ensure that storage for the 2nd set of vga registers is * allocated for dual channel cards @@ -1528,10 +1532,12 @@ chipsPreInitHiQV(ScrnInfoPtr pScrn, int flags) if (cPtr->pEnt->location.type == BUS_PCI) { /* Tack on 0x800000 to access the big-endian aperture? */ #if X_BYTE_ORDER == X_BIG_ENDIAN - cPtr->FbAddress = (cPtr->PciInfo->memBase[0] & 0xff800000) + 0x800000L; -#else - cPtr->FbAddress = cPtr->PciInfo->memBase[0] & 0xff800000; + if (!BE_SWAP_APRETURE(pScrn,cPtr)) + cPtr->FbAddress = (cPtr->PciInfo->memBase[0] & 0xff800000) + 0x800000L; + else #endif + cPtr->FbAddress = cPtr->PciInfo->memBase[0] & 0xff800000; + from = X_PROBED; if (xf86RegisterResources(cPtr->pEnt->index,NULL,ResNone)) cPtr->Flags &= ~ChipsLinearSupport; @@ -1559,7 +1565,15 @@ chipsPreInitHiQV(ScrnInfoPtr pScrn, int flags) "Enabling linear addressing\n"); xf86DrvMsg(pScrn->scrnIndex, from, "base address is set at 0x%lX.\n", cPtr->FbAddress); - cPtr->IOAddress = cPtr->FbAddress + 0x400000L; +#if X_BYTE_ORDER == X_BIG_ENDIAN + if (BE_SWAP_APRETURE(pScrn,cPtr)) + cPtr->IOAddress = cPtr->FbAddress - 0x400000L; + else +#endif + cPtr->IOAddress = cPtr->FbAddress + 0x400000L; + xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, + "IOAddress is set at 0x%lX.\n",cPtr->IOAddress); + } else xf86DrvMsg(pScrn->scrnIndex, from, "Disabling linear addressing\n"); @@ -1613,10 +1627,10 @@ chipsPreInitHiQV(ScrnInfoPtr pScrn, int flags) "PseudoColor overlay enabled.\n"); if (!xf86IsOptionSet(cPtr->Options, OPTION_LCD_STRETCH)) xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - " - Forcing option \"NoStretch\".\n"); + " - Forcing option \"Stretch\" \"ON\".\n"); if (!xf86IsOptionSet(cPtr->Options, OPTION_LCD_CENTER)) xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - " - Forcing option \"LcdCenter\".\n"); + " - Forcing option \"LcdCenter\" \"OFF\".\n"); if (cPtr->Flags & ChipsShadowFB) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, " - Disabling \"Shadow Framebuffer\".\n"); @@ -1834,12 +1848,21 @@ chipsPreInitHiQV(ScrnInfoPtr pScrn, int flags) } } +#if X_BYTE_ORDER == X_BIG_ENDIAN + if (cPtr->pEnt->chipset == CHIPS_CT69030 && (cPtr->readXR(cPtr, 0x71) & 0x2)) + cPtr->dualEndianAp = TRUE; + else + cPtr->dualEndianAp = FALSE; +#endif + if ((cPtr->Flags & ChipsDualChannelSupport) && (xf86IsEntityShared(pScrn->entityList[0]))) { /* * This takes gives either half or the amount of memory specified * with the Crt2Memory option */ + pScrn->memPhysBase = cPtr->FbAddress; + if(cPtr->SecondCrtc == FALSE) { int crt2mem = -1, adjust; @@ -1862,12 +1885,15 @@ chipsPreInitHiQV(ScrnInfoPtr pScrn, int flags) cPtr->FbMapSize = cPtrEnt->masterFbMapSize = pScrn->videoRam * 1024; cPtrEnt->slaveFbMapSize = cPtrEnt->slavevideoRam * 1024; + pScrn->fbOffset = 0; } else { cPtrEnt->slaveFbAddress = cPtr->FbAddress + - cPtrEnt->masterFbAddress; + cPtrEnt->masterFbMapSize; cPtr->FbMapSize = cPtrEnt->slaveFbMapSize; pScrn->videoRam = cPtrEnt->slavevideoRam; + pScrn->fbOffset = cPtrEnt->masterFbMapSize; } + cPtrEnt->refCount++; } else { /* Normal Handling of video ram etc */ @@ -2245,26 +2271,27 @@ chipsPreInitHiQV(ScrnInfoPtr pScrn, int flags) cPtr->ClockMulFactor = 1; - /* Set the min pixel clock */ - cPtr->MinClock = 11000; /* XXX Guess, need to check this */ - xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "Min pixel clock is %7.3f MHz\n", - (float)(cPtr->MinClock / 1000.)); - /* Set the max pixel clock */ + /* Set the min/max pixel clock */ switch (cPtr->Chipset) { case CHIPS_CT69030: + cPtr->MinClock = 3000; cPtr->MaxClock = 170000; break; case CHIPS_CT69000: + cPtr->MinClock = 3000; cPtr->MaxClock = 135000; break; case CHIPS_CT68554: case CHIPS_CT65555: + cPtr->MinClock = 1000; cPtr->MaxClock = 110000; break; case CHIPS_CT65554: + cPtr->MinClock = 1000; cPtr->MaxClock = 95000; break; case CHIPS_CT65550: + cPtr->MinClock = 1000; if (((cPtr->readXR(cPtr, 0x04)) & 0xF) < 6) { if ((cPtr->readFR(cPtr, 0x0A)) & 2) { /*5V Vcc */ @@ -2277,6 +2304,8 @@ chipsPreInitHiQV(ScrnInfoPtr pScrn, int flags) cPtr->MaxClock = 95000; /* Revision B */ break; } + xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "Min pixel clock is %7.3f MHz\n", + (float)(cPtr->MinClock / 1000.)); /* Check if maxClock is limited by the MemClk. Only 70% to allow for */ /* RAS/CAS. Extra byte per memory clock needed if framebuffer used */ @@ -4014,6 +4043,21 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (!ret) return FALSE; +#if X_BYTE_ORDER == X_BIG_ENDIAN + /* TODO : find a better way to do this */ + if (pScrn->depth == 24) { + int dummy ; + /* Fixup RGB ordering in 24 BPP */ + dummy = pScrn->offset.red ; + pScrn->offset.red = pScrn->offset.blue; + pScrn->offset.blue = dummy ; + + dummy = pScrn->mask.red ; + pScrn->mask.red = pScrn->mask.blue; + pScrn->mask.blue = dummy ; + } +#endif + if (pScrn->depth > 8) { /* Fixup RGB ordering */ visual = pScreen->visuals + pScreen->numVisuals; @@ -4345,14 +4389,7 @@ CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (cPtr->Flags & ChipsDPMSSupport) xf86DPMSInit(pScreen, (DPMSSetProcPtr)chipsDisplayPowerManagementSet, 0); - -#if 0 /* #### Shouldn't be needed */ - /* Dual head, needs to fix framebuffer memory address */ - if ((cPtr->Flags & ChipsDualChannelSupport) && - (cPtr->SecondCrtc == TRUE)) - pScrn->memPhysBase = cPtr->FbAddress + cPtrEnt->masterFbMapSize; -#endif - + /* Wrap the current CloseScreen function */ cPtr->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = CHIPSCloseScreen; @@ -4700,7 +4737,7 @@ chipsClockSelect(ScrnInfoPtr pScrn, int no) break; default: - if (!chipsClockFind(pScrn, no, &TmpClock)) + if (!chipsClockFind(pScrn, NULL, no, &TmpClock)) return (FALSE); chipsClockLoad(pScrn, &TmpClock); } @@ -4781,7 +4818,8 @@ chipsClockSave(ScrnInfoPtr pScrn, CHIPSClockPtr Clock) } static Bool -chipsClockFind(ScrnInfoPtr pScrn, int no, CHIPSClockPtr Clock) +chipsClockFind(ScrnInfoPtr pScrn, DisplayModePtr mode, + int no, CHIPSClockPtr Clock ) { vgaHWPtr hwp = VGAHWPTR(pScrn); CHIPSPtr cPtr = CHIPSPTR(pScrn); @@ -4801,9 +4839,9 @@ chipsClockFind(ScrnInfoPtr pScrn, int no, CHIPSClockPtr Clock) case HiQV_STYLE: Clock->msr = cPtr->CRTclkInx << 2; Clock->fr03 = cPtr->FPclkInx << 2; - Clock->Clock = pScrn->currentMode->Clock; + Clock->Clock = mode ? mode->Clock : 0; if (xf86ReturnOptValBool(cPtr->Options, OPTION_USE_MODELINE, FALSE)) { - Clock->FPClock = pScrn->currentMode->Clock; + Clock->FPClock = mode ? mode->Clock : 0; } else Clock->FPClock = cPtr->FPclock; break; @@ -4842,7 +4880,7 @@ chipsClockFind(ScrnInfoPtr pScrn, int no, CHIPSClockPtr Clock) if ((cPtr->PanelType & ChipsLCD) && cPtr->FPclock) Clock->Clock = cPtr->FPclock; else - Clock->Clock = pScrn->currentMode->SynthClock; + Clock->Clock = mode ? mode->SynthClock : 0; } break; case OLD_STYLE: @@ -4867,7 +4905,7 @@ chipsClockFind(ScrnInfoPtr pScrn, int no, CHIPSClockPtr Clock) } else { Clock->msr = 3 << 2; Clock->xr33 = 0; - Clock->Clock = pScrn->currentMode->SynthClock; + Clock->Clock = mode ? mode->SynthClock : 0; } break; } @@ -5384,7 +5422,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode) pScrn->vtSema = TRUE; /* init clock */ - if (!chipsClockFind(pScrn, mode->ClockIndex, &ChipsNew->Clock)) { + if (!chipsClockFind(pScrn, mode, mode->ClockIndex, &ChipsNew->Clock)) { ErrorF("bomb 2\n"); return (FALSE); } @@ -5465,6 +5503,14 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode) if (!(cPtr->Flags & ChipsLinearSupport) || (pScrn->bitsPerPixel < 8)) ChipsNew->XR[0x0A] |= 0x1; +#if X_BYTE_ORDER == X_BIG_ENDIAN + ChipsNew->XR[0x0A] &= 0xCF; + if (pScrn->bitsPerPixel == 16) { + ChipsNew->XR[0x0A] &= 0xCF; + if (cPtr->dualEndianAp) + ChipsNew->XR[0x0A] |= 0x10; + } +#endif ChipsNew->XR[0x09] |= 0x1; /* Enable extended CRT registers */ ChipsNew->XR[0x0E] = 0; /* Single map */ ChipsNew->XR[0x40] |= 0x2; /* Don't wrap at 256kb */ @@ -5592,7 +5638,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode) /* centering/stretching */ if (!xf86ReturnOptValBool(cPtr->Options, OPTION_SUSPEND_HACK, FALSE)) { - if (xf86ReturnOptValBool(cPtr->Options, OPTION_LCD_STRETCH, FALSE) || + if (!xf86ReturnOptValBool(cPtr->Options, OPTION_LCD_STRETCH, FALSE) || (cPtr->Flags & ChipsOverlay8plus16)) { ChipsNew->FR[0x40] &= 0xDF; /* Disable Horizontal stretching */ ChipsNew->FR[0x48] &= 0xFB; /* Disable vertical stretching */ @@ -5613,7 +5659,7 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode) } } - if ((xf86ReturnOptValBool(cPtr->Options, OPTION_LCD_CENTER, FALSE)) + if ((xf86ReturnOptValBool(cPtr->Options, OPTION_LCD_CENTER, TRUE)) || (cPtr->Flags & ChipsOverlay8plus16)) { ChipsNew->FR[0x40] |= 0x3; /* Enable Horizontal centering */ ChipsNew->FR[0x48] |= 0x3; /* Enable Vertical centering */ @@ -5768,12 +5814,16 @@ chipsModeInitHiQV(ScrnInfoPtr pScrn, DisplayModePtr mode) - (ChipsNew->FR[0x31] & 0xF0) - (ChipsNew->FR[0x32] & 0x0F) - ((ChipsNew->FR[0x35] & 0xF0) << 4)); - if (cPtr->PanelSize.HDisplay > mode->CrtcHDisplay) - cPtr->OverlaySkewX += (cPtr->PanelSize.HDisplay - - mode->CrtcHDisplay) / 2; - if (cPtr->PanelSize.VDisplay > mode->CrtcVDisplay) - cPtr->OverlaySkewY += (cPtr->PanelSize.VDisplay - - mode->CrtcVDisplay) / 2; + if (!xf86ReturnOptValBool(cPtr->Options, OPTION_LCD_STRETCH, FALSE) + && xf86ReturnOptValBool(cPtr->Options, OPTION_LCD_CENTER, TRUE)) + { + if (cPtr->PanelSize.HDisplay > mode->CrtcHDisplay) + cPtr->OverlaySkewX += (cPtr->PanelSize.HDisplay - + mode->CrtcHDisplay) / 2; + if (cPtr->PanelSize.VDisplay > mode->CrtcVDisplay) + cPtr->OverlaySkewY += (cPtr->PanelSize.VDisplay - + mode->CrtcVDisplay) / 2; + } } else { cPtr->OverlaySkewX = mode->CrtcHTotal - mode->CrtcHBlankStart - 9; cPtr->OverlaySkewY = mode->CrtcVTotal - mode->CrtcVSyncEnd - 1; @@ -5989,7 +6039,7 @@ chipsModeInitWingine(ScrnInfoPtr pScrn, DisplayModePtr mode) pScrn->vtSema = TRUE; /* init clock */ - if (!chipsClockFind(pScrn, mode->ClockIndex, &ChipsNew->Clock)) { + if (!chipsClockFind(pScrn, mode, mode->ClockIndex, &ChipsNew->Clock)) { ErrorF("bomb 4\n"); return (FALSE); } @@ -6231,7 +6281,7 @@ chipsModeInit655xx(ScrnInfoPtr pScrn, DisplayModePtr mode) pScrn->vtSema = TRUE; /* init clock */ - if (!chipsClockFind(pScrn, mode->ClockIndex, &ChipsNew->Clock)) { + if (!chipsClockFind(pScrn, mode, mode->ClockIndex, &ChipsNew->Clock)) { ErrorF("bomb 6\n"); return (FALSE); } @@ -6441,12 +6491,15 @@ chipsModeInit655xx(ScrnInfoPtr pScrn, DisplayModePtr mode) ChipsNew->XR[0x51] |= 0x40; /* enable FP compensation */ ChipsNew->XR[0x55] |= 0x01; /* enable horiz. compensation */ ChipsNew->XR[0x57] |= 0x01; /* enable horiz. compensation */ - if (xf86ReturnOptValBool(cPtr->Options, OPTION_LCD_STRETCH, + if (!xf86ReturnOptValBool(cPtr->Options, OPTION_LCD_STRETCH, FALSE)) { if (mode->CrtcHDisplay < 1489) /* HWBug */ - ChipsNew->XR[0x55] |= 0x02; /* enable h-centering */ - else if (pScrn->bitsPerPixel == 24) - ChipsNew->XR[0x56] = (lcdHDisplay - CrtcHDisplay) >> 1; + ChipsNew->XR[0x55] |= 0x02; /* enable auto h-centering */ + else { + ChipsNew->XR[0x55] &= 0xFD; /* disable auto h-centering */ + if (pScrn->bitsPerPixel == 24) /* ? */ + ChipsNew->XR[0x56] = (lcdHDisplay - CrtcHDisplay) >> 1; + } } else { ChipsNew->XR[0x55] &= 0xFD; /* disable h-centering */ ChipsNew->XR[0x56] = 0; @@ -6993,7 +7046,7 @@ chipsMapMem(ScrnInfoPtr pScrn) if (cPtr->Flags & ChipsLinearSupport) { if (cPtr->UseMMIO) { if (IS_HiQV(cPtr)) { - if (cPtr->Bus == ChipsPCI) + if (cPtr->pEnt->location.type == BUS_PCI) cPtr->MMIOBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO_32BIT,cPtr->PciTag, cPtr->IOAddress, 0x20000L); @@ -7001,7 +7054,7 @@ chipsMapMem(ScrnInfoPtr pScrn) cPtr->MMIOBase = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_MMIO_32BIT, cPtr->IOAddress, 0x20000L); } else { - if (cPtr->Bus == ChipsPCI) + if (cPtr->pEnt->location.type == BUS_PCI) cPtr->MMIOBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO_32BIT, cPtr->PciTag, cPtr->IOAddress, 0x10000L); @@ -7030,7 +7083,7 @@ chipsMapMem(ScrnInfoPtr pScrn) } } - if (cPtr->Bus == ChipsPCI) + if (cPtr->pEnt->location.type == BUS_PCI) cPtr->FbBase = xf86MapPciMem(pScrn->scrnIndex,VIDMEM_FRAMEBUFFER, cPtr->PciTag, Addr, Map); diff --git a/src/ct_driver.h b/src/ct_driver.h index 293c32f..6c43617 100644 --- a/src/ct_driver.h +++ b/src/ct_driver.h @@ -274,7 +274,11 @@ typedef struct _CHIPSRec { PCITAG PciTag; int Chipset; EntityInfoPtr pEnt; - IOADDRESS PIOBase; +#if XF86_VERSION_CURRENT > XF86_VERSION_NUMERIC(4,1,0,0,0) + IOADDRESS PIOBase; +#else + int PIOBase; /* unused variable : here for compatibility reason with newer version */ +#endif CARD32 IOAddress; unsigned long FbAddress; unsigned int IOBase; @@ -362,6 +366,7 @@ typedef struct _CHIPSRec { chipsWriteIOSSPtr writeIOSS; Bool cursorDelay; unsigned int viewportMask; + Bool dualEndianAp; } CHIPSRec; typedef struct _CHIPSi2c { @@ -431,6 +436,10 @@ void chipsRefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox); void chipsRefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox); void chipsPointerMoved(int index, int x, int y); +#if X_BYTE_ORDER == X_BIG_ENDIAN +# define BE_SWAP_APRETURE(pScrn,cPtr) \ + ((pScrn->bitsPerPixel == 16) && cPtr->dualEndianAp) +#endif /* * Some macros for switching display channels. NOTE... It appears that we diff --git a/src/ct_video.c b/src/ct_video.c index e1704ba..9ff9c13 100644 --- a/src/ct_video.c +++ b/src/ct_video.c @@ -267,7 +267,6 @@ CHIPSSetupImageVideo(ScreenPtr pScreen) pPriv->colorKey = cPtr->videoKey; pPriv->videoStatus = 0; - pPriv->doubleBuffer = TRUE; pPriv->manualDoubleBuffer = FALSE; pPriv->currentBuffer = 0; @@ -533,7 +532,9 @@ CHIPSDisplayVideo( DisplayModePtr mode = pScrn->currentMode; unsigned char tmp, m1f, m1e; int buffer = pPriv->currentBuffer; - + Bool dblscan = (pScrn->currentMode->Flags & V_DBLSCAN) == V_DBLSCAN; + int val; + if (cPtr->Flags & ChipsAccelSupport) CHIPSHiQVSync(pScrn); @@ -571,6 +572,7 @@ CHIPSDisplayVideo( cPtr->writeMR(cPtr, 0x23, ((offset >> 8) & 0xFF)); cPtr->writeMR(cPtr, 0x24, ((offset >> 16) & 0xFF)); } + /* Setup Pointer 2 */ if ((buffer && !pPriv->manualDoubleBuffer) || !pPriv->doubleBuffer) { cPtr->writeMR(cPtr, 0x25, (offset & 0xF8)); @@ -578,7 +580,6 @@ CHIPSDisplayVideo( cPtr->writeMR(cPtr, 0x27, ((offset >> 16) & 0xFF)); } - tmp = cPtr->readMR(cPtr, 0x04); if (pPriv->doubleBuffer && !pPriv->manualDoubleBuffer && triggerBufSwitch) tmp |= 0x18; @@ -586,6 +587,7 @@ CHIPSDisplayVideo( tmp = cPtr->readMR(cPtr, 0x20); tmp &= 0xC3; + if (pPriv->doubleBuffer && !pPriv->manualDoubleBuffer && triggerBufSwitch) tmp |= ((1 << 2 | 1 << 5) | ((buffer) ? (1 << 4) : 0)); cPtr->writeMR(cPtr, 0x20, tmp); @@ -605,14 +607,16 @@ CHIPSDisplayVideo( tmp = (tmp & 0xF8) + (((cPtr->OverlaySkewX + dstBox->x2 - 1) >> 8) & 0x07); cPtr->writeMR(cPtr, 0x2D, tmp); /* Top Edge of Overlay */ - cPtr->writeMR(cPtr, 0x2E, ((cPtr->OverlaySkewY + dstBox->y1) & 0xFF)); + val = cPtr->OverlaySkewY + (dstBox->y1 << (dblscan ? 1 : 0)); + cPtr->writeMR(cPtr, 0x2E, ((val) & 0xFF)); tmp = cPtr->readMR(cPtr, 0x2F); - tmp = (tmp & 0xF8) + (((cPtr->OverlaySkewY + dstBox->y1) >> 8) & 0x07); + tmp = (tmp & 0xF8) + (((val) >> 8) & 0x07); cPtr->writeMR(cPtr, 0x2F, tmp); /* Bottom Edge of Overlay*/ - cPtr->writeMR(cPtr, 0x30, ((cPtr->OverlaySkewY + dstBox->y2 - 1) & 0xFF)); + val = cPtr->OverlaySkewY + (dstBox->y2 << (dblscan ? 1 : 0)); + cPtr->writeMR(cPtr, 0x30, ((val - 1) & 0xFF)); tmp = cPtr->readMR(cPtr, 0x31); - tmp = (tmp & 0xF8) + (((cPtr->OverlaySkewY + dstBox->y2 - 1) >> 8) & 0x07); + tmp = (tmp & 0xF8) + (((val - 1) >> 8) & 0x07); cPtr->writeMR(cPtr, 0x31, tmp); /* Horizontal Zoom */ @@ -624,10 +628,13 @@ CHIPSDisplayVideo( } /* Vertical Zoom */ - if (drw_h > src_h) { + if (drw_h > src_h || dblscan) { m1f = m1f | 0x80; /* set V-interpolation */ - m1e = m1e | 0x08; - tmp = cPtr->VideoZoomMax * src_h / drw_h ; + m1e = m1e | 0x08; + if (dblscan) + tmp = cPtr->VideoZoomMax >> 1; + if (drw_h > src_h) + tmp = tmp * src_h / drw_h; cPtr->writeMR(cPtr, 0x33, tmp); } cPtr->writeMR(cPtr, 0x1F, m1f); @@ -673,7 +680,7 @@ CHIPSPutImage( dstBox.x2 = drw_x + drw_w; dstBox.y1 = drw_y; dstBox.y2 = drw_y + drw_h; - + if (!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, width, height)) return Success; @@ -687,8 +694,11 @@ CHIPSPutImage( dstPitch = ((width << 1) + 15) & ~15; new_size = ((dstPitch * height) + bpp - 1) / bpp; - if (pPriv->doubleBuffer) - new_size <<= 1; + + pPriv->doubleBuffer = (pScrn->currentMode->Flags & V_DBLSCAN) != V_DBLSCAN; + + if (pPriv->doubleBuffer) + new_size <<= 1; switch(id) { case FOURCC_YV12: /* YV12 */ @@ -703,12 +713,12 @@ CHIPSPutImage( } if(!(pPriv->linear = CHIPSAllocateMemory(pScrn, pPriv->linear, new_size))) { - if (pPriv->doubleBuffer && - (pPriv->linear = CHIPSAllocateMemory(pScrn, pPriv->linear, + if (pPriv->doubleBuffer + && (pPriv->linear = CHIPSAllocateMemory(pScrn, pPriv->linear, new_size >> 1))) { new_size >>= 1; pPriv->doubleBuffer = FALSE; - } else + } else return BadAlloc; } |