diff options
Diffstat (limited to 'src/ativga.c')
-rw-r--r-- | src/ativga.c | 259 |
1 files changed, 0 insertions, 259 deletions
diff --git a/src/ativga.c b/src/ativga.c index 5678c6e3..7332431c 100644 --- a/src/ativga.c +++ b/src/ativga.c @@ -164,265 +164,6 @@ ATIVGASave } /* - * ATIVGACalculate -- - * - * This function fills in the VGA portion of an ATIHWRec. - */ -void -ATIVGACalculate -( - ATIPtr pATI, - ATIHWPtr pATIHW, - DisplayModePtr pMode -) -{ - int Index, VDisplay; - - /* If not already done, adjust horizontal timings */ - if (!pMode->CrtcHAdjusted) - { - pMode->CrtcHAdjusted = TRUE; - pMode->CrtcHDisplay = (pMode->HDisplay >> 3) - 1; - pMode->CrtcHBlankStart = (pMode->HDisplay >> 3); - if ((pATI->Chip == ATI_CHIP_18800_1) || - (pATI->Chip >= ATI_CHIP_264CT)) - pMode->CrtcHBlankStart--; - pMode->CrtcHSyncStart = pMode->HSyncStart >> 3; - if (pATI->LCDPanelID >= 0) - pMode->CrtcHSyncStart--; - pMode->CrtcHSyncEnd = pMode->HSyncEnd >> 3; - if (pATI->LCDPanelID >= 0) - pMode->CrtcHSyncEnd--; - pMode->CrtcHBlankEnd = (pMode->HTotal >> 3) - 1; - pMode->CrtcHTotal = (pMode->HTotal >> 3) - 5; - pMode->CrtcHSkew = pMode->HSkew; - - /* Check sync pulse width */ - Index = pMode->CrtcHSyncEnd - pMode->CrtcHSyncStart - 0x1F; - if (Index > 0) - { - pMode->CrtcHSyncStart += Index / 2; - pMode->CrtcHSyncEnd = pMode->CrtcHSyncStart + 0x1F; - } - - /* Check blank pulse width */ - Index = pMode->CrtcHBlankEnd - pMode->CrtcHBlankStart - 0x3F; - if (Index > 0) - { - if ((pMode->CrtcHBlankEnd - Index) > pMode->CrtcHSyncEnd) - { - pMode->CrtcHBlankStart += Index / 2; - if (pMode->CrtcHBlankStart >= pMode->CrtcHSyncStart) - pMode->CrtcHBlankStart = pMode->CrtcHSyncStart - 1; - pMode->CrtcHBlankEnd = pMode->CrtcHBlankStart + 0x3F; - } - else - { - Index -= 0x40; - if (Index > 0) - { - pMode->CrtcHBlankStart += Index / 2; - if (pMode->CrtcHBlankStart >= pMode->CrtcHSyncStart) - pMode->CrtcHBlankStart = pMode->CrtcHSyncStart - 1; - pMode->CrtcHBlankEnd = pMode->CrtcHBlankStart + 0x7F; - } - } - } - } - - /* - * Because of the use of CRTC[23] bit 0x04's for vertical doubling, it is - * necessary to always re-adjust vertical timings here. - */ - pMode->CrtcVDisplay = pMode->VDisplay; - pMode->CrtcVBlankStart = pMode->VDisplay; - pMode->CrtcVSyncStart = pMode->VSyncStart; - pMode->CrtcVSyncEnd = pMode->VSyncEnd; - pMode->CrtcVBlankEnd = pMode->VTotal; - pMode->CrtcVTotal = pMode->VTotal; - - /* Adjust for doublescanned modes */ - if (pMode->Flags & V_DBLSCAN) - { - pMode->CrtcVDisplay <<= 1; - pMode->CrtcVBlankStart <<= 1; - pMode->CrtcVSyncStart <<= 1; - pMode->CrtcVSyncEnd <<= 1; - pMode->CrtcVBlankEnd <<= 1; - pMode->CrtcVTotal <<= 1; - } - - /* Adjust for multiscanned modes */ - if (pMode->VScan > 1) - { - pMode->CrtcVDisplay *= pMode->VScan; - pMode->CrtcVBlankStart *= pMode->VScan; - pMode->CrtcVSyncStart *= pMode->VScan; - pMode->CrtcVSyncEnd *= pMode->VScan; - pMode->CrtcVBlankEnd *= pMode->VScan; - pMode->CrtcVTotal *= pMode->VScan; - } - - /* Set up miscellaneous output register value */ - pATIHW->genmo = 0x23U; - if ((pMode->Flags & (V_PHSYNC | V_NHSYNC)) && - (pMode->Flags & (V_PVSYNC | V_NVSYNC))) - { - if (pMode->Flags & V_NHSYNC) - pATIHW->genmo |= 0x40U; - if (pMode->Flags & V_NVSYNC) - pATIHW->genmo |= 0x80U; - } - else - { - pMode->Flags &= ~(V_PHSYNC | V_NHSYNC | V_PVSYNC | V_NVSYNC); - - if (pATI->OptionPanelDisplay && (pATI->LCDPanelID >= 0)) - VDisplay = pATI->LCDVertical; - else - VDisplay = pMode->CrtcVDisplay; - - if (VDisplay < 400) - { - pMode->Flags |= V_PHSYNC | V_NVSYNC; - pATIHW->genmo |= 0x80U; - } - else if (VDisplay < 480) - { - pMode->Flags |= V_NHSYNC | V_PVSYNC; - pATIHW->genmo |= 0x40U; - } - else if (VDisplay < 768) - { - pMode->Flags |= V_NHSYNC | V_NVSYNC; - pATIHW->genmo |= 0xC0U; - } - else - { - pMode->Flags |= V_PHSYNC | V_PVSYNC; - } - } - - /* Adjust for interlaced modes */ - if ((pMode->Flags & V_INTERLACE) && (pATI->Chip < ATI_CHIP_264CT)) - { - pMode->CrtcVDisplay >>= 1; - pMode->CrtcVBlankStart >>= 1; - pMode->CrtcVSyncStart >>= 1; - pMode->CrtcVSyncEnd >>= 1; - pMode->CrtcVBlankEnd >>= 1; - pMode->CrtcVTotal >>= 1; - } - - if (pMode->CrtcVTotal > 1024) - { - pATIHW->crt[23] |= 0x04U; - pMode->CrtcVDisplay >>= 1; - pMode->CrtcVBlankStart >>= 1; - pMode->CrtcVSyncStart >>= 1; - pMode->CrtcVSyncEnd >>= 1; - pMode->CrtcVBlankEnd >>= 1; - pMode->CrtcVTotal >>= 1; - } - else - { - pATIHW->crt[23] &= ~0x04U; - } - - pMode->CrtcVDisplay--; - if (pATI->Chip == ATI_CHIP_18800) - pMode->CrtcVBlankStart++; - else - pMode->CrtcVBlankStart--; - if (pATI->LCDPanelID >= 0) - { - pMode->CrtcVSyncStart--; - pMode->CrtcVSyncEnd--; - } - pMode->CrtcVBlankEnd--; - if (pATI->Chip < ATI_CHIP_264CT) - pMode->CrtcVBlankEnd--; - pMode->CrtcVTotal -= 2; - pMode->CrtcVAdjusted = TRUE; /* Redundant */ - - /* Check sync pulse width */ - Index = pMode->CrtcVSyncEnd - pMode->CrtcVSyncStart - 0x0F; - if (Index > 0) - { - pMode->CrtcVSyncStart += Index / 2; - pMode->CrtcVSyncEnd = pMode->CrtcVSyncStart + 0x0F; - } - - /* Check blank pulse width */ - Index = pMode->CrtcVBlankEnd - pMode->CrtcVBlankStart - 0x00FF; - if (Index > 0) - { - if ((pMode->CrtcVBlankEnd - Index) > pMode->CrtcVSyncEnd) - { - pMode->CrtcVBlankStart += Index / 2; - if (pMode->CrtcVBlankStart >= pMode->CrtcVSyncStart) - pMode->CrtcVBlankStart = pMode->CrtcVSyncStart - 1; - pMode->CrtcVBlankEnd = pMode->CrtcVBlankStart + 0x00FF; - } - else - { - Index -= 0x0100; - if (Index > 0) - { - pMode->CrtcVBlankStart += Index / 2; - if (pMode->CrtcVBlankStart >= pMode->CrtcVSyncStart) - pMode->CrtcVBlankStart = pMode->CrtcVSyncStart - 1; - pMode->CrtcVBlankEnd = pMode->CrtcVBlankStart + 0x01FF; - } - } - } - - /* Set up sequencer register values */ - if (pMode->Flags & V_CLKDIV2) - pATIHW->seq[1] = 0x09U; - else - pATIHW->seq[1] = 0x01U; - - /* Set up CRTC register values */ - pATIHW->crt[0] = pMode->CrtcHTotal; - pATIHW->crt[1] = pMode->CrtcHDisplay; - pATIHW->crt[2] = pMode->CrtcHBlankStart; - pATIHW->crt[3] = (pMode->CrtcHBlankEnd & 0x1FU) | 0x80U; - Index = ((pMode->CrtcHSkew << 2) + 0x10U) & ~0x1FU; - if (Index < 0x0080) - pATIHW->crt[3] |= Index; - pATIHW->crt[4] = pMode->CrtcHSyncStart; - pATIHW->crt[5] = ((pMode->CrtcHBlankEnd & 0x20U) << 2) | - ((pMode->CrtcHSyncEnd & 0x1FU) ); - pATIHW->crt[6] = pMode->CrtcVTotal & 0xFFU; - pATIHW->crt[7] = ((pMode->CrtcVTotal & 0x0100U) >> 8) | - ((pMode->CrtcVDisplay & 0x0100U) >> 7) | - ((pMode->CrtcVSyncStart & 0x0100U) >> 6) | - ((pMode->CrtcVBlankStart & 0x0100U) >> 5) | - 0x10U | - ((pMode->CrtcVTotal & 0x0200U) >> 4) | - ((pMode->CrtcVDisplay & 0x0200U) >> 3) | - ((pMode->CrtcVSyncStart & 0x0200U) >> 2); - pATIHW->crt[9] = ((pMode->CrtcVBlankStart & 0x0200U) >> 4) | 0x40U; - /* - * Doublescanned modes are missing the top scanline. Convert - * doublescanning to multiscanning, using the doublescan bit only as a last - * resort. - */ - if ((Index = pMode->VScan) <= 0) - Index = 1; - if (pMode->Flags & V_DBLSCAN) - Index <<= 1; - Index--; - pATIHW->crt[9] |= (Index & 0x1FU) | ((Index & 0x20U) << 2); - pATIHW->crt[16] = pMode->CrtcVSyncStart & 0xFFU; - pATIHW->crt[17] = (pMode->CrtcVSyncEnd & 0x0FU) | 0x20U; - pATIHW->crt[18] = pMode->CrtcVDisplay & 0xFFU; - pATIHW->crt[21] = pMode->CrtcVBlankStart & 0xFFU; - pATIHW->crt[22] = pMode->CrtcVBlankEnd & 0xFFU; -} - -/* * ATIVGASet -- * * This function is called to load the VGA portion of a video state. |