diff -urp -x '*~' -x '*.orig' src/mga_driver.c src/mga_driver.c
--- src/mga_driver.c Fri Jul 15 13:01:36 2011
+++ src/mga_driver.c Fri Jul 15 13:11:48 2011
@@ -3290,15 +3290,72 @@
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;
@@ -4362,13 +4419,23 @@
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;