summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXavier Bachelot <xavier@bachelot.org>2007-09-11 21:34:41 +0000
committerXavier Bachelot <xavier@bachelot.org>2007-09-11 21:34:41 +0000
commit4005c48c5944d2141854ce40899fcb4f744a6c94 (patch)
tree14201da44e0647e670d59dd47511ed4c5acbc056 /src
parent20bd8bbcff63a376f187cde148f76750b0bd3a3a (diff)
sync with experimental_branch
Diffstat (limited to 'src')
-rw-r--r--src/via.h4
-rw-r--r--src/via_accel.c4
-rw-r--r--src/via_bandwidth.c5
-rw-r--r--src/via_driver.c95
-rw-r--r--src/via_driver.h3
-rw-r--r--src/via_id.c2
-rw-r--r--src/via_mode.c27
-rw-r--r--src/via_priv.h4
-rw-r--r--src/via_swov.c16
-rw-r--r--src/via_vbe.c229
-rw-r--r--src/via_xvmc.c3
11 files changed, 289 insertions, 103 deletions
diff --git a/src/via.h b/src/via.h
index 594ddd887d91..9e9c105ac6ae 100644
--- a/src/via.h
+++ b/src/via.h
@@ -31,7 +31,7 @@
#include <string.h>
#include <stdio.h>
#include <math.h>
-#include <assert.h>
+#include <assert.h>
#include <stdlib.h>
/* Video Engines */
@@ -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/src/via_accel.c b/src/via_accel.c
index 90a485d1df26..7150ab41de78 100644
--- a/src/via_accel.c
+++ b/src/via_accel.c
@@ -2196,8 +2196,8 @@ viaInitExa(ScreenPtr pScreen)
pExa->offScreenBase = pScrn->virtualY * pVia->Bpl;
pExa->pixmapOffsetAlign = 32;
pExa->pixmapPitchAlign = 16;
- /* This needs to be fixed upstream for now it just causes hangs*/
- pExa->flags = EXA_OFFSCREEN_PIXMAPS | EXA_OFFSCREEN_ALIGN_POT;
+ pExa->flags = EXA_OFFSCREEN_PIXMAPS |
+ (pVia->nPOT[1] ? 0 : EXA_OFFSCREEN_ALIGN_POT);
pExa->maxX = 2047;
pExa->maxY = 2047;
pExa->WaitMarker = viaAccelWaitMarker;
diff --git a/src/via_bandwidth.c b/src/via_bandwidth.c
index 672b2b16d417..e09ca192d0ff 100644
--- a/src/via_bandwidth.c
+++ b/src/via_bandwidth.c
@@ -233,7 +233,12 @@ ViaSetPrimaryFIFO(ScrnInfoPtr pScrn, DisplayModePtr mode)
hwp->writeSeq(hwp, 0x18, 0x8A);
break;
case VIA_P4M890:
+ break;
case VIA_CX700:
+ hwp->writeSeq(hwp, 0x16, 0x26);
+ hwp->writeSeq(hwp, 0x17, 0x5F);
+ hwp->writeSeq(hwp, 0x18, 0x66);
+ hwp->writeSeq(hwp, 0x22, 0x1F);
break;
default:
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ViaSetPrimaryFIFO:"
diff --git a/src/via_driver.c b/src/via_driver.c
index ba7ee0b504a6..af67b4f326cf 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -714,6 +714,9 @@ static Bool VIASetupDefaultOptions(ScrnInfoPtr pScrn)
#ifdef HAVE_DEBUG
pVia->PrintVGARegs = FALSE;
#endif
+ pVia->swov.maxWInterp = 800 ;
+ pVia->swov.maxHInterp = 600 ;
+ pVia->useLegacyVBE = TRUE;
switch (pVia->Chipset)
{
@@ -723,13 +726,21 @@ 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;
case VIA_PM800:
case VIA_CX700:
+ pVia->VideoEngine = VIDEO_ENGINE_CME;
+ pVia->swov.maxWInterp = 1920 ;
+ pVia->swov.maxHInterp = 1080 ;
+ break;
case VIA_P4M890:
pVia->VideoEngine = VIDEO_ENGINE_CME;
break;
@@ -1496,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;
}
@@ -1604,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);
@@ -1877,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);
@@ -1910,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);
@@ -1918,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);
}
}
@@ -1944,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);
@@ -1986,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);
@@ -1997,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);
@@ -2229,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/src/via_driver.h b/src/via_driver.h
index cbbe7990e0cb..bc02ebc51bd1 100644
--- a/src/via_driver.h
+++ b/src/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/src/via_id.c b/src/via_id.c
index fd0b42268d97..da5dc039879a 100644
--- a/src/via_id.c
+++ b/src/via_id.c
@@ -198,6 +198,7 @@ static struct ViaCardIdStruct ViaCardId[] = {
/* P4M900 */
{"Asustek P5VD2-VM", VIA_P4M900, 0x1043, 0x81CE, VIA_DEVICE_CRT},
{"VIA VT3364 (P4M900)", VIA_P4M900, 0x1106, 0x3371, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
+ {"Gigabyte GA-VM900M", VIA_P4M900, 0x1458, 0xD000, VIA_DEVICE_CRT},
{"Everex NC1501/NC1503", VIA_P4M900, 0x1509, 0x1E30, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
{"Clevo M660SE", VIA_P4M900, 0x1558, 0x0664, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
{"Fujitsu/Siemens Amilo Pro V3515", VIA_P4M900, 0x1734, 0x10CB, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
@@ -206,6 +207,7 @@ static struct ViaCardIdStruct ViaCardId[] = {
{"VIA VT8454B", VIA_CX700, 0x0908, 0x1975, VIA_DEVICE_CRT}, /* Evaluation board, reference possibly wrong */
{"VIA VT3324 (CX700)", VIA_CX700, 0x1106, 0x3157, VIA_DEVICE_CRT},
/* P4M890 */
+ {"PCChips P29G", VIA_P4M890, 0x1019, 0x1629, VIA_DEVICE_CRT},
{"Asustek P5V-VM ULTRA", VIA_P4M890, 0x1043, 0x81B5, VIA_DEVICE_CRT},
{"Asustek P5V-VM DH", VIA_P4M890, 0x1043, 0x81CE, VIA_DEVICE_CRT},
{"Mitac 8615", VIA_P4M890, 0x1071, 0x8615, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
diff --git a/src/via_mode.c b/src/via_mode.c
index 155211d2ad70..c1839570ff8e 100644
--- a/src/via_mode.c
+++ b/src/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/src/via_priv.h b/src/via_priv.h
index c510d6ce2782..4d0fbaad430b 100644
--- a/src/via_priv.h
+++ b/src/via_priv.h
@@ -165,6 +165,10 @@ typedef struct {
int oldPanningX;
int oldPanningY;
+/* Maximum resolution with interpolation */
+ unsigned long maxWInterp;
+ unsigned long maxHInterp;
+
} swovRec, *swovPtr;
#endif /* _VIA_PRIV_H_ */
diff --git a/src/via_swov.c b/src/via_swov.c
index 5e2ceb01e797..2a4d3018b07a 100644
--- a/src/via_swov.c
+++ b/src/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);
@@ -1922,17 +1926,19 @@ Upd_Video(ScrnInfoPtr pScrn, unsigned long videoFlag,
if (haveHQVzoomH) {
miniCtl = V1_X_INTERPOLY;
+ /* Disable X interpolation if the height exceeds
+ * the maximum supported by the hardware */
+ if (srcHeight >= pVia->swov.maxHInterp)
+ miniCtl &= ~V1_X_INTERPOLY;
tmp = zoomCtl & 0xffff0000;
}
if (haveHQVzoomV) {
miniCtl |= V1_Y_INTERPOLY | V1_YCBCR_INTERPOLY;
- if (srcWidth >= 800 &&
- (pVia->ChipId == PCI_CHIP_VT3327 || pVia->ChipId == PCI_CHIP_VT3336 ||
- pVia->ChipId == PCI_CHIP_VT3324 || pVia->ChipId == PCI_CHIP_VT3364 ||
- pVia->ChipId == PCI_CHIP_VT3205 || pVia->ChipId == PCI_CHIP_VT3314)) {
+ /* Disable Y interpolation if the width exceeds
+ * the maximum supported by the hardware */
+ if (srcWidth >= pVia->swov.maxWInterp)
miniCtl &= ~V1_Y_INTERPOLY;
- }
tmp |= zoomCtl & 0x0000ffff;
hqvFilterCtl &= 0xfffdffff;
}
diff --git a/src/via_vbe.c b/src/via_vbe.c
index f50186ddb981..e7ce88c74deb 100644
--- a/src/via_vbe.c
+++ b/src/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/src/via_xvmc.c b/src/via_xvmc.c
index 18448bfd8715..310b24c1d708 100644
--- a/src/via_xvmc.c
+++ b/src/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 chromeXvMC.\n");
xf86XvMCRegisterDRInfo(pScreen, "chromeXvMC", 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;