summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Toutant <ctoutant@matrox.com>2011-08-03 09:45:13 -0400
committerChristian Toutant <ctoutant@matrox.com>2011-08-03 09:45:13 -0400
commitc083bf0a66bef9a4345847f39be5fb895c211f79 (patch)
tree4434618068b3c50dae9ab32ae9d906168bdcbcdf
parent43280e6521815582f219d42821d896093c9c0d5f (diff)
Added support for G200SE Pilot3
Optimize use of bandwidth and increase maximum resolution to 1920x1200 Signed-off-by: Christian Toutant <ctoutant@matrox.com>
-rw-r--r--src/mga_driver.c94
1 files changed, 80 insertions, 14 deletions
diff --git a/src/mga_driver.c b/src/mga_driver.c
index 7232c73..b140013 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -3282,15 +3282,71 @@ MGA_HAL(
outb(0xfac, 0x02);
}
- MGA_NOT_HAL(
- if (pMga->is_G200SE) {
+ /*
+ This function optimize the Priority Request control
+ Higher HiPriLvl will reduce drawing performance
+ We need to give enough bandwith to crtc to avoid visual artifact
+ */
+ if (pMga->is_G200SE)
+ {
+ if (pMga->reg_1e24 >= 0x02)
+ {
+ /* Calulate CRTC Priority value */
+ CARD8 ucHiPriLvl;
+ CARD32 ulBitsPerPixel;
+ CARD32 ulMemoryBandwidth;
+
+ /* uiBitsPerPixel can only be 8,16 or32 */
+ if (pScrn->bitsPerPixel > 16)
+ {
+ ulBitsPerPixel = 32;
+ }
+ else if (pScrn->bitsPerPixel > 8)
+ {
+ ulBitsPerPixel = 16;
+ }
+ else
+ {
+ ulBitsPerPixel = 8;
+ }
+
+
+ ulMemoryBandwidth = (mode->Clock * ulBitsPerPixel) / 1000;
+
+ if (ulMemoryBandwidth > 3100) ucHiPriLvl = 0;
+ else if (ulMemoryBandwidth > 2600) ucHiPriLvl = 1;
+ else if (ulMemoryBandwidth > 1900) ucHiPriLvl = 2;
+ else if (ulMemoryBandwidth > 1160) ucHiPriLvl = 3;
+ else if (ulMemoryBandwidth > 440) ucHiPriLvl = 4;
+ else ucHiPriLvl = 5;
+
OUTREG8(0x1FDE, 0x06);
- if (pMga->reg_1e24 >= 0x01)
- OUTREG8(0x1FDF, 0x03);
- else
- OUTREG8(0x1FDF, 0x14);
+ OUTREG8(0x1FDF, ucHiPriLvl);
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clock == %d\n", mode->Clock);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BitsPerPixel == %d\n", pScrn->bitsPerPixel);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "MemoryBandwidth == %d\n", ulMemoryBandwidth);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "HiPriLvl == %02X\n", ucHiPriLvl);
}
- );
+ else
+ {
+ MGA_NOT_HAL(
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clock == %d\n", mode->Clock);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BitsPerPixel == %d\n", pScrn->bitsPerPixel);
+ OUTREG8(0x1FDE, 0x06);
+ if (pMga->reg_1e24 >= 0x01)
+ {
+ OUTREG8(0x1FDF, 0x03);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "HiPriLvl == 03\n");
+ }
+ else
+ {
+ OUTREG8(0x1FDF, 0x14);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "HiPriLvl == 14h\n");
+ }
+ );
+ }
+ }
pMga->CurrentLayout.mode = mode;
@@ -4354,13 +4410,23 @@ MGAValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
MGAPtr pMga = MGAPTR(pScrn);
if (pMga->Chipset == PCI_CHIP_MGAG200_SE_A_PCI) {
- if (mode->HDisplay > 1600)
- return MODE_VIRTUAL_X;
- if (mode->VDisplay > 1200)
- return MODE_VIRTUAL_Y;
- if (pMga->reg_1e24 >= 0x01 &&
- xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 244)
- return MODE_BANDWIDTH;
+ if (pMga->reg_1e24 == 0x01) {
+ if (mode->HDisplay > 1600)
+ return MODE_VIRTUAL_X;
+ if (mode->VDisplay > 1200)
+ return MODE_VIRTUAL_Y;
+ if (xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 244)
+ return MODE_BANDWIDTH;
+ } else {
+ if (pMga->reg_1e24 >= 0x02) {
+ if (mode->HDisplay > 1920)
+ return MODE_VIRTUAL_X;
+ if (mode->VDisplay > 1200)
+ return MODE_VIRTUAL_Y;
+ if (xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 301)
+ return MODE_BANDWIDTH;
+ }
+ }
} else if (pMga->is_G200WB){
if (mode->Flags & V_DBLSCAN)
return MODE_NO_DBLESCAN;