diff options
-rw-r--r-- | src/ct_driver.c | 22 | ||||
-rw-r--r-- | src/ct_video.c | 42 |
2 files changed, 38 insertions, 26 deletions
diff --git a/src/ct_driver.c b/src/ct_driver.c index bae029a..ddbe17b 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); @@ -4700,7 +4701,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 +4782,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 +4803,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 +4844,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 +4869,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 +5386,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); } @@ -5993,7 +5995,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); } @@ -6235,7 +6237,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); } 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; } |