diff options
author | Gabriel Mansi <gabriel.mansi@gmail.com> | 2007-09-07 19:09:41 +0000 |
---|---|---|
committer | Gabriel Mansi <gabriel.mansi@gmail.com> | 2007-09-07 19:09:41 +0000 |
commit | a84b99489c3d03aa1e34ff0bac607943e83b944f (patch) | |
tree | d721b3e5b3c99760b4ef61e51877a5cbf4167ce3 | |
parent | 8611ac0b55c2f2d27b679e39bc6c5de9858e8c99 (diff) |
Merged vn896_branch from revision 361 to 391
-rw-r--r-- | ChangeLog | 47 | ||||
-rw-r--r-- | libxvmc/viaLowLevel.c | 2 | ||||
-rw-r--r-- | libxvmc/viaLowLevel.h | 1 | ||||
-rw-r--r-- | libxvmc/viaLowLevelPro.c | 2 | ||||
-rw-r--r-- | unichrome/via.h | 2 | ||||
-rw-r--r-- | unichrome/via_driver.c | 89 | ||||
-rw-r--r-- | unichrome/via_driver.h | 3 | ||||
-rw-r--r-- | unichrome/via_mode.c | 27 | ||||
-rw-r--r-- | unichrome/via_swov.c | 4 | ||||
-rw-r--r-- | unichrome/via_vbe.c | 229 | ||||
-rw-r--r-- | unichrome/via_xvmc.c | 3 |
11 files changed, 312 insertions, 97 deletions
@@ -1,3 +1,50 @@ +2007-09-07 Gabiel Mansi <gabriel-dot-mansi-at-gmail-dot-com> + + * libxvmc/viaLowLevel.c: (initXvMCLowLevel): + * libxvmc/viaLowLevel.h: + * libxvmc/viaLowLevelPro.c: (initXvMCLowLevel): + * unichrome/via.h: + * unichrome/via_driver.c: (VIASetupDefaultOptions), (VIAPreInit), + (VIASave), (VIARestore), (VIALoadPalette): + * unichrome/via_driver.h: + * unichrome/via_mode.c: (ViaOutputsDetect): + * unichrome/via_swov.c: (Upd_Video): + * unichrome/via_vbe.c: (ViaVbeInitInt10), + (ViaVbeGetRefreshRateIndex), (ViaVbeGetActiveDevices), + (ViaVbeSetActiveDevices), (ViaVbeSetPanelExpansion), + (ViaVbeSetRefresh), (ViaVbeSetMode), (ViaVbeSaveRestore), + (ViaVbeModePreInit): + * unichrome/via_xvmc.c: (ViaInitXVMC), (ViaXvMCCreateContext): + + Merged vn896_branch from revision 361 to 391 + +2007-09-07 Gabriel Mansi <gabriel-dot-mansi-at-gmail-dot-com> + + * unichrome/via_driver.c: (VIAPreInit): + * unichrome/via_mode.c: (ViaOutputsDetect): + * unichrome/via_vbe.c: (ViaVbeSetActiveDevices): + + Disabled TV detection for P4M900 + +2007-09-07 Gabriel Mansi <gabriel-dot-mansi-at-gmail-dot-com> + + * unichrome/via_driver.h: + * unichrome/via_vbe.c: (ViaVbeInitInt10), + (ViaVbeGetRefreshRateIndex), (ViaVbeGetActiveDevices), + (ViaVbeSetActiveDevices), (ViaVbeSetPanelExpansion), + (ViaVbeSetRefresh), (ViaVbeSetMode), (ViaVbeModePreInit): + + VBE code clean up + +2007-09-02 Gabriel Mansi <gabriel-dot-mansi-at-gmail-dot-com> + + * unichrome/via_driver.c: (VIASetupDefaultOptions), (VIASave), + (VIARestore): + * unichrome/via_vbe.c: (ViaVbeSetMode): + + Disabled XvDMA for P4M900 + Modified VBE functions calling order + 2007-08-18 Gabriel Mansi <gabriel-dot-mansi-at-gmail-dot-com> * unichrome/via_driver.c: (VIASetupDefaultOptions): diff --git a/libxvmc/viaLowLevel.c b/libxvmc/viaLowLevel.c index fde0959..2d90f80 100644 --- a/libxvmc/viaLowLevel.c +++ b/libxvmc/viaLowLevel.c @@ -1006,7 +1006,7 @@ initXvMCLowLevel(int fd, drm_context_t * ctx, int ret; XvMCLowLevel *xl; - if (chipId == PCI_CHIP_VT3259) { + if (chipId == PCI_CHIP_VT3259 || chipId == PCI_CHIP_VT3364) { fprintf(stderr, "You are using an XvMC driver for the wrong chip.\n"); fprintf(stderr, "Chipid is 0x%04x.\n", chipId); return NULL; diff --git a/libxvmc/viaLowLevel.h b/libxvmc/viaLowLevel.h index e56b399..59171d7 100644 --- a/libxvmc/viaLowLevel.h +++ b/libxvmc/viaLowLevel.h @@ -136,5 +136,6 @@ extern void viaVideoSubPictureOffLocked(void *xlp); #define PCI_CHIP_CLE3122 0x3122 /* CLE266 */ #define PCI_CHIP_VT3205 0x7205 /* KM400 */ #define PCI_CHIP_VT3327 0x3343 /* P4M890 */ +#define PCI_CHIP_VT3364 0x3371 /* P4M900 */ #endif diff --git a/libxvmc/viaLowLevelPro.c b/libxvmc/viaLowLevelPro.c index aff4d5a..8c97e28 100644 --- a/libxvmc/viaLowLevelPro.c +++ b/libxvmc/viaLowLevelPro.c @@ -1516,7 +1516,7 @@ initXvMCLowLevel(int fd, drm_context_t * ctx, { XvMCLowLevel *xl; - if (chipId != PCI_CHIP_VT3259) { + if (chipId != PCI_CHIP_VT3259 && chipId != PCI_CHIP_VT3364) { fprintf(stderr, "You are using an XvMC driver for the wrong chip.\n"); fprintf(stderr, "Chipid is 0x%04x.\n", chipId); return NULL; diff --git a/unichrome/via.h b/unichrome/via.h index 028fccb..9e9c105 100644 --- a/unichrome/via.h +++ b/unichrome/via.h @@ -662,6 +662,6 @@ #define MPG_SLICE_LENGTH 0x9C #define MPG_SLICE_DATA 0xA0 - +#define VBE_DEFAULT_REFRESH 6000 #endif /* _VIA_H_ */ diff --git a/unichrome/via_driver.c b/unichrome/via_driver.c index 9fd6137..9be0779 100644 --- a/unichrome/via_driver.c +++ b/unichrome/via_driver.c @@ -716,6 +716,7 @@ static Bool VIASetupDefaultOptions(ScrnInfoPtr pScrn) #endif pVia->swov.maxWInterp = 800 ; pVia->swov.maxHInterp = 600 ; + pVia->useLegacyVBE = TRUE; switch (pVia->Chipset) { @@ -725,8 +726,12 @@ static Bool VIASetupDefaultOptions(ScrnInfoPtr pScrn) case VIA_K8M800: pVia->DRIIrqEnable = FALSE; break; - case VIA_K8M890: case VIA_P4M900: + pVia->useLegacyVBE = FALSE; + /* FIXME: It needs to be tested */ + pVia->dmaXV = FALSE; + /* no break here */ + case VIA_K8M890: pVia->VideoEngine = VIDEO_ENGINE_CME; pVia->agpEnable = FALSE; break; @@ -1502,16 +1507,20 @@ static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } - if (pBIOSInfo->PanelActive && ((pVia->Chipset == VIA_K8M800) || - (pVia->Chipset == VIA_PM800) || - (pVia->Chipset == VIA_VM800) || - (pVia->Chipset == VIA_P4M890) || - (pVia->Chipset == VIA_K8M890) || - (pVia->Chipset == VIA_P4M900))) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Panel on K8M800, PM800 ,VM800, P4M890, K8M890 or P4M900 is" - " currently not supported.\n"); + if (pBIOSInfo->PanelActive && + ((pVia->Chipset == VIA_K8M800) || + (pVia->Chipset == VIA_PM800) || + (pVia->Chipset == VIA_VM800) || + (pVia->Chipset == VIA_P4M890) || + (pVia->Chipset == VIA_K8M890) || + (pVia->Chipset == VIA_P4M900))) { + + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Panel on K8M800, PM800, VM800, P4M890, K8M890 or P4M900 is" + " currently not supported.\n"); xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Using VBE to set modes to" " work around this.\n"); + pVia->useVBEModes = TRUE; } @@ -1610,7 +1619,6 @@ static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags) /* Set up screen parameters. */ pVia->Bpp = pScrn->bitsPerPixel >> 3; pVia->Bpl = pScrn->displayWidth * pVia->Bpp; - xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V); pScrn->currentMode = pScrn->modes; xf86PrintModes(pScrn); @@ -1883,29 +1891,25 @@ VIASave(ScrnInfoPtr pScrn) Regs->SR2A = hwp->readSeq(hwp, 0x2A); Regs->SR2B = hwp->readSeq(hwp, 0x2B); - Regs->SR2E = hwp->readSeq(hwp, 0x2E); + Regs->SR2E = hwp->readSeq(hwp, 0x2E); + + Regs->SR44 = hwp->readSeq(hwp, 0x44); + Regs->SR45 = hwp->readSeq(hwp, 0x45); + Regs->SR46 = hwp->readSeq(hwp, 0x46); + Regs->SR47 = hwp->readSeq(hwp, 0x47); switch (pVia->Chipset) { case VIA_CLE266: case VIA_KM400: - Regs->SR44 = hwp->readSeq(hwp, 0x44); - Regs->SR45 = hwp->readSeq(hwp, 0x45); - Regs->SR46 = hwp->readSeq(hwp, 0x46); - Regs->SR47 = hwp->readSeq(hwp, 0x47); break; default: - Regs->SR44 = hwp->readSeq(hwp, 0x44); - Regs->SR45 = hwp->readSeq(hwp, 0x45); - Regs->SR46 = hwp->readSeq(hwp, 0x46); - Regs->SR47 = hwp->readSeq(hwp, 0x47); - /*Regs->SR4A = hwp->readSeq(hwp, 0x4a); - Regs->SR4B = hwp->readSeq(hwp, 0x4b); - Regs->SR4C = hwp->readSeq(hwp, 0x4c);*/ + Regs->SR4A = hwp->readSeq(hwp, 0x4A); + Regs->SR4B = hwp->readSeq(hwp, 0x4B); + Regs->SR4C = hwp->readSeq(hwp, 0x4C); break; } - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Crtc...\n")); Regs->CR13 = hwp->readCrtc(hwp, 0x13); @@ -1916,6 +1920,8 @@ VIASave(ScrnInfoPtr pScrn) Regs->CR35 = hwp->readCrtc(hwp, 0x35); Regs->CR36 = hwp->readCrtc(hwp, 0x36); + Regs->CR49 = hwp->readCrtc(hwp, 0x49); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "TVSave...\n")); if (pBIOSInfo->TVI2CDev) ViaTVSave(pScrn); @@ -1924,6 +1930,15 @@ VIASave(ScrnInfoPtr pScrn) for (i = 0; i < 68; i++) Regs->CRTCRegs[i] = hwp->readCrtc(hwp, i + 0x50); + Regs->CRA0 = hwp->readCrtc(hwp, 0xA0); + Regs->CRA1 = hwp->readCrtc(hwp, 0xA1); + Regs->CRA2 = hwp->readCrtc(hwp, 0xA2); + + Regs->CR97 = hwp->readCrtc(hwp, 0x97); + Regs->CR99 = hwp->readCrtc(hwp, 0x99); + Regs->CR9B = hwp->readCrtc(hwp, 0x9B); + Regs->CR9F = hwp->readCrtc(hwp, 0x9F); + vgaHWProtect(pScrn, FALSE); } } @@ -1950,7 +1965,7 @@ VIARestore(ScrnInfoPtr pScrn) hwp->writeCrtc(hwp, 0x6A, 0x00); hwp->writeCrtc(hwp, 0x6B, 0x00); hwp->writeCrtc(hwp, 0x6C, 0x00); - + if (pBIOSInfo->TVI2CDev) ViaTVRestore(pScrn); @@ -1992,6 +2007,18 @@ VIARestore(ScrnInfoPtr pScrn) hwp->writeSeq(hwp, 0x46, Regs->SR46); hwp->writeSeq(hwp, 0x47, Regs->SR47); + switch (pVia->Chipset) + { + case VIA_CLE266: + case VIA_KM400: + break; + default: + hwp->writeSeq(hwp, 0x4A, Regs->SR4A); + hwp->writeSeq(hwp, 0x4B, Regs->SR4B); + hwp->writeSeq(hwp, 0x4C, Regs->SR4C); + break; + } + /* Reset dotclocks */ ViaSeqMask(hwp, 0x40, 0x06, 0x06); ViaSeqMask(hwp, 0x40, 0x00, 0x06); @@ -2003,10 +2030,21 @@ VIARestore(ScrnInfoPtr pScrn) hwp->writeCrtc(hwp, 0x35, Regs->CR35); hwp->writeCrtc(hwp, 0x36, Regs->CR36); + hwp->writeCrtc(hwp, 0x49, Regs->CR49); + /* Restore LCD control regs */ for (i = 0; i < 68; i++) hwp->writeCrtc(hwp, i + 0x50, Regs->CRTCRegs[i]); + hwp->writeCrtc(hwp, 0xA0, Regs->CRA0); + hwp->writeCrtc(hwp, 0xA1, Regs->CRA1); + hwp->writeCrtc(hwp, 0xA2, Regs->CRA2); +/* + hwp->writeCrtc(hwp, 0x97, Regs->CR97); + hwp->writeCrtc(hwp, 0x99, Regs->CR99); + hwp->writeCrtc(hwp, 0x9B, Regs->CR9B); + hwp->writeCrtc(hwp, 0x9F, Regs->CR9F); +*/ if (pBIOSInfo->PanelActive) ViaLCDPower(pScrn, TRUE); @@ -2235,6 +2273,9 @@ VIALoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, case VIA_KM400: ViaSeqMask(hwp, 0x16, 0x80, 0x80); break; + case VIA_P4M900: + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "VIALoadPalette: Function not implemented for this chipset.\n"); + return; default: ViaCrtcMask(hwp, 0x33, 0x80, 0x80); break; diff --git a/unichrome/via_driver.h b/unichrome/via_driver.h index c8acd45..7046ba3 100644 --- a/unichrome/via_driver.h +++ b/unichrome/via_driver.h @@ -117,11 +117,13 @@ typedef struct { CARD8 SR27, SR28, SR29, SR2A,SR2B,SR2C,SR2D,SR2E; CARD8 SR2F, SR30, SR31, SR32,SR33,SR34,SR40,SR41; CARD8 SR42, SR43, SR44, SR45,SR46,SR47; + CARD8 SR4A, SR4B, SR4C; /* extended CRTC registers */ CARD8 CR13, CR30, CR31, CR32, CR33, CR34, CR35, CR36; CARD8 CR37, CR38, CR39, CR3A, CR40, CR41, CR42, CR43; CARD8 CR44, CR45, CR46, CR47, CR48, CR49, CR4A; + CARD8 CR97, CR99, CR9B, CR9F, CRA0, CRA1, CRA2; CARD8 CRTCRegs[68]; /* CARD8 LCDRegs[0x40];*/ } VIARegRec, *VIARegPtr; @@ -243,6 +245,7 @@ typedef struct _VIA { vbeInfoPtr pVbe; ViaVbeModeInfo vbeMode; Bool useVBEModes; + Bool useLegacyVBE; /* Support for shadowFB and rotation */ unsigned char* ShadowPtr; diff --git a/unichrome/via_mode.c b/unichrome/via_mode.c index 155211d..c183957 100644 --- a/unichrome/via_mode.c +++ b/unichrome/via_mode.c @@ -276,14 +276,25 @@ ViaOutputsDetect(ScrnInfoPtr pScrn) pBIOSInfo->CrtPresent = TRUE; } - /* TV encoder */ - if (ViaTVDetect(pScrn) && ViaTVInit(pScrn)) { - if (!pBIOSInfo->TVOutput) /* Config might've set this already */ - ViaTVDACSense(pScrn); - } else if (pVia->Id && (pVia->Id->Outputs & VIA_DEVICE_TV)) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "This device is supposed to have a" - " TV encoder but we are unable to detect it (support missing?).\n"); - pBIOSInfo->TVOutput = 0; + /* + * FIXME: xf86I2CProbeAddress(pVia->pI2CBus3, 0x40) + * disables the panel on P4M900 + * See ViaTVDetect. + */ + if (pVia->Chipset == VIA_P4M900 && pBIOSInfo->PanelPresent) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Will not try to detect TV encoder." ); + } else { + /* TV encoder */ + if (ViaTVDetect(pScrn) && ViaTVInit(pScrn)) { + if (!pBIOSInfo->TVOutput) /* Config might've set this already */ + ViaTVDACSense(pScrn); + } else if (pVia->Id && (pVia->Id->Outputs & VIA_DEVICE_TV)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "This device is supposed to have a" + " TV encoder but we are unable to detect it (support missing?).\n"); + pBIOSInfo->TVOutput = 0; + } } } diff --git a/unichrome/via_swov.c b/unichrome/via_swov.c index afd5b21..2a4d301 100644 --- a/unichrome/via_swov.c +++ b/unichrome/via_swov.c @@ -1719,6 +1719,10 @@ Upd_Video(ScrnInfoPtr pScrn, unsigned long videoFlag, vidCtl |= V1_PREFETCH_ON_3336; } + if (pVia->pBIOSInfo->PanelActive) { + vidCtl |= 0x80000000; + } + viaOverlayGetV1V3Format(pVia, (videoFlag & VIDEO_1_INUSE) ? 1 : 3, videoFlag, &vidCtl, &hqvCtl); diff --git a/unichrome/via_vbe.c b/unichrome/via_vbe.c index f50186d..e7ce88c 100644 --- a/unichrome/via_vbe.c +++ b/unichrome/via_vbe.c @@ -49,50 +49,131 @@ ViaVbeAdjustFrame(int scrnIndex, int x, int y, int flags) VBESetDisplayStart(pVia->pVbe, x, y, TRUE); } +/* + * Default values for pInt10 + */ +static void ViaVbeInitInt10(vbeInfoPtr pVbe) { - -static Bool -ViaVbeSetRefresh(ScrnInfoPtr pScrn, int maxRefresh) -{ - VIAPtr pVia = VIAPTR(pScrn); - VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; - int RealOff; - pointer page = NULL; - vbeInfoPtr pVbe = pVia->pVbe; - - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVbeSetRefresh\n")); - page = xf86Int10AllocPages(pVbe->pInt10, 1, &RealOff); - if (!page) - return FALSE; pVbe->pInt10->ax = 0x4F14; - pVbe->pInt10->bx = 0x0001; pVbe->pInt10->cx = 0; pVbe->pInt10->dx = 0; pVbe->pInt10->di = 0; pVbe->pInt10->num = 0x10; +} - /* Set Active Device and Translate BIOS byte definition */ - if (pBIOSInfo->CrtActive) - pVbe->pInt10->cx = 0x01; - if (pBIOSInfo->PanelActive) - pVbe->pInt10->cx |= 0x02; - if (pBIOSInfo->TVActive) - pVbe->pInt10->cx |= 0x04; +static int ViaVbeGetRefreshRateIndex(int maxRefresh) { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Active Device: %d\n", - pVbe->pInt10->cx)); + int rri ; + rri = 0 ; if (maxRefresh >= 120) { - pVbe->pInt10->di = 10; + rri = 10; } else if (maxRefresh >= 100) { - pVbe->pInt10->di = 9; + rri = 9; } else if (maxRefresh >= 85) { - pVbe->pInt10->di = 7; + rri = 7; } else if (maxRefresh >= 75) { - pVbe->pInt10->di = 5; + rri = 5; } else { - pVbe->pInt10->di = 0; + rri = 0; } + + return rri ; +} + +/* + * + */ +static int ViaVbeGetActiveDevices(ScrnInfoPtr pScrn) { + + VIAPtr pVia = VIAPTR(pScrn); + VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; + + int activeDevices; + activeDevices = 0 ; + + /* Set Active Device and Translate BIOS byte definition */ + if (pBIOSInfo->CrtActive) + activeDevices = 0x01; + if (pBIOSInfo->PanelActive) + activeDevices |= 0x02; + if (pBIOSInfo->TVActive) + activeDevices |= 0x04; + + /* TODO: Add others devices */ + + return activeDevices ; + +} + +/* + * Sets the requested mode, refresh rate and active devices + */ +static Bool ViaVbeSetActiveDevices( ScrnInfoPtr pScrn, int mode, int refresh ) { + + VIAPtr pVia = VIAPTR(pScrn); + VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; + vbeInfoPtr pVbe = pVia->pVbe; + + ViaVbeInitInt10(pVbe); + pVbe->pInt10->bx = 0x8003; + pVbe->pInt10->cx = ViaVbeGetActiveDevices(pScrn); + pVbe->pInt10->dx = mode & 0x1FF; + pVbe->pInt10->di = ViaVbeGetRefreshRateIndex(refresh); + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "ViaVbeSetActiveDevices mode: %x, refresh: %d active devices: 0x%2x\n", + mode, refresh, pVbe->pInt10->cx )); + + xf86ExecX86int10(pVbe->pInt10); + if (pVbe->pInt10->ax != 0x4F) + return FALSE ; + + return TRUE; +} + +/* + * Sets the panel expansion mode + */ +static Bool ViaVbeSetPanelExpansion(ScrnInfoPtr pScrn, Bool expanded) { + + VIAPtr pVia = VIAPTR(pScrn); + VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; + vbeInfoPtr pVbe = pVia->pVbe; + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVbeSetPanelExpansion\n")); + + ViaVbeInitInt10(pVbe); + pVbe->pInt10->ax = 0x4F14; + pVbe->pInt10->bx = 0x0306; + pVbe->pInt10->cx = 0x80 | expanded; + + xf86ExecX86int10(pVbe->pInt10); + + if (pVbe->pInt10->ax != 0x4F) + return FALSE; + + return TRUE; +} + +static Bool +ViaVbeSetRefresh(ScrnInfoPtr pScrn, int maxRefresh) +{ + VIAPtr pVia = VIAPTR(pScrn); + VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaVbeSetRefresh\n")); + vbeInfoPtr pVbe = pVia->pVbe; + + ViaVbeInitInt10(pVbe); + pVbe->pInt10->bx = 0x0001; + pVbe->pInt10->cx = ViaVbeGetActiveDevices(pScrn); + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Active Device: %d\n", + pVbe->pInt10->cx)); + + pVbe->pInt10->di = ViaVbeGetRefreshRateIndex(maxRefresh); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Refresh Rate Index: %d\n", pVbe->pInt10->di)); @@ -100,16 +181,7 @@ ViaVbeSetRefresh(ScrnInfoPtr pScrn, int maxRefresh) xf86ExecX86int10(pVbe->pInt10); if (pVbe->pInt10->ax != 0x4F) - { - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Via BIOS Set Device Refresh Rate fail!\n")); - if (page) - xf86Int10FreePages(pVbe->pInt10, page, 1); return FALSE; - } - - if (page) - xf86Int10FreePages(pVbe->pInt10, page, 1); return TRUE; } @@ -119,11 +191,11 @@ ViaVbeSetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) { VIAPtr pVia; VbeModeInfoData *data; + pVia = VIAPTR(pScrn); + VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; int mode; int refreshRate; - pVia = VIAPTR(pScrn); - pVia->OverlaySupported = FALSE; data = (VbeModeInfoData*)pMode->Private; @@ -134,12 +206,12 @@ ViaVbeSetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) mode |= 1 << 14; if (data->block) { - refreshRate = data->block->RefreshRate ; + refreshRate = data->block->RefreshRate; } else { - refreshRate = 6000 ; + refreshRate = VBE_DEFAULT_REFRESH; xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Unable to determine the refresh rate, using %.2f. " - "Please check your configuration.\n", refreshRate/100. ) ; + "Please check your configuration.\n", refreshRate/100.); } xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Trying VBE Mode %dx%d (0x%x) Refresh %.2f:\n", @@ -147,20 +219,42 @@ ViaVbeSetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) (int) data->data->YResolution, mode & ~(1 << 11), (float) refreshRate/100.); - ViaVbeSetRefresh(pScrn, refreshRate/100); + if (pVia->useLegacyVBE) { + + ViaVbeSetRefresh(pScrn, refreshRate/100); + + if (VBESetVBEMode(pVia->pVbe, mode, data->block) == FALSE) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VBESetVBEMode failed"); + if ((data->block || (data->mode & (1 << 11))) && + VBESetVBEMode(pVia->pVbe, (mode & ~(1 << 11)), NULL) == TRUE) { + /* Some cards do not like setting the clock. + */ + xf86ErrorF("...but worked OK without customized refresh and dotclock.\n"); + xfree(data->block); + data->block = NULL; + data->mode &= ~(1 << 11); + } + else { + ErrorF("\n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Set VBE Mode failed!\n"); + return (FALSE); + } + } + } else { + if (pBIOSInfo->PanelActive && !pVia->useLegacyVBE) { + if (!ViaVbeSetPanelExpansion(pScrn, !pBIOSInfo->Center)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Unable to set the panel expansion.\n"); + } + } - if (VBESetVBEMode(pVia->pVbe, mode, data->block) == FALSE) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VBESetVBEMode failed"); - if ((data->block || (data->mode & (1 << 11))) && - VBESetVBEMode(pVia->pVbe, (mode & ~(1 << 11)), NULL) == TRUE) { - /* Some cards do not like setting the clock. - */ - xf86ErrorF("...but worked OK without customized refresh and dotclock.\n"); - data->mode &= ~(1 << 11); + data->mode &= ~(1 << 11); + if (VBESetVBEMode(pVia->pVbe, data->mode, NULL) == FALSE) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Set VBE Mode failed.\n"); + return (FALSE); } - else { - ErrorF("\n"); - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Set VBE Mode failed!\n"); + + if (!ViaVbeSetActiveDevices(pScrn, data->mode, refreshRate/100)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unable to set the active devices.\n"); return (FALSE); } } @@ -170,13 +264,17 @@ ViaVbeSetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) pScrn->vtSema = TRUE; +/* + pVia->Bpp = data->data->BitsPerPixel >> 3; + pVia->Bpl = data->data->XResolution * pVia->Bpp; +*/ + if (!pVia->NoAccel) { #ifdef XF86DRI || defined(VIA_HAVE_EXA) VIAInitialize3DEngine(pScrn); #endif viaInitialize2DEngine(pScrn); } - ViaVbeAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); return (TRUE); @@ -188,6 +286,8 @@ ViaVbeSaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function) VIAPtr pVia = VIAPTR(pScrn); vgaHWPtr hwp = VGAHWPTR(pScrn); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,"ViaVbeSaveRestore\n")); + if ((MODE_QUERY < 0) || (function > MODE_RESTORE)) return (FALSE); @@ -207,8 +307,10 @@ ViaVbeSaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function) if (!VBESaveRestore(pVia->pVbe, function, (pointer) &(pVia->vbeMode.state), &(pVia->vbeMode.stateSize), - &(pVia->vbeMode.statePage))) + &(pVia->vbeMode.statePage))) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING,"VBESaveRestore failed\n"); return FALSE; + } } } @@ -234,7 +336,9 @@ ViaVbeSaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function) } if (function == MODE_RESTORE) { - VBESetVBEMode(pVia->pVbe, pVia->vbeMode.stateMode, NULL); + if (!VBESetVBEMode(pVia->pVbe, pVia->vbeMode.stateMode, NULL)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING,"VBESetVBEMode failed\n"); + } } if (!retval) @@ -261,6 +365,8 @@ ViaVbeModePreInit(ScrnInfoPtr pScrn) "Searching for matching VESA mode(s):\n"); if ((vbe = VBEGetVBEInfo(pVia->pVbe)) == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "VBEGetVBEInfo failed\n"); return FALSE; } @@ -288,14 +394,15 @@ ViaVbeModePreInit(ScrnInfoPtr pScrn) } VBESetModeParameters(pScrn, pVia->pVbe); - xf86PruneDriverModes(pScrn); + xf86PruneDriverModes(pScrn); +/* pMode = pScrn->modes; do { vbeMode = ((VbeModeInfoData*)pMode->Private)->data; pMode = pMode->next; - } while (pMode != pScrn->modes); - + } while (pMode != NULL && pMode != pScrn->modes); +*/ return TRUE; } diff --git a/unichrome/via_xvmc.c b/unichrome/via_xvmc.c index 768426c..230ddaf 100644 --- a/unichrome/via_xvmc.c +++ b/unichrome/via_xvmc.c @@ -379,7 +379,7 @@ ViaInitXVMC(ScreenPtr pScreen) { DRIInfoPtr pDRIInfo = pVia->pDRIInfo; - if (pVia->ChipId != PCI_CHIP_VT3259) { + if (pVia->ChipId != PCI_CHIP_VT3259 && pVia->ChipId != PCI_CHIP_VT3364) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[XvMC] Registering viaXvMC.\n"); xf86XvMCRegisterDRInfo(pScreen, "viaXvMC", pDRIInfo->busIdString, @@ -504,6 +504,7 @@ ViaXvMCCreateContext(ScrnInfoPtr pScrn, XvMCContextPtr pContext, contextRec->useAGP = pViaDRI->ringBufActive && ((pVia->Chipset == VIA_CLE266) || (pVia->Chipset == VIA_KM400) || + (pVia->Chipset == VIA_P4M900) || (pVia->Chipset == VIA_PM800)); contextRec->chipId = pVia->ChipId; contextRec->screen = pScrn->pScreen->myNum; |