1244N/Adiff -urp -x '*~' -x '*.orig' src/mga_driver.c src/mga_driver.c
1244N/A--- src/mga_driver.c Fri Jul 15 13:01:36 2011
1244N/A+++ src/mga_driver.c Fri Jul 15 13:11:48 2011
1244N/A@@ -3290,15 +3290,72 @@
1244N/A outb(0xfac, 0x02);
1244N/A }
1244N/A
1244N/A- MGA_NOT_HAL(
1244N/A- if (pMga->is_G200SE) {
1244N/A+ /*
1244N/A+ This function optimize the Priority Request control
1244N/A+ Higher HiPriLvl will reduce drawing performance
1244N/A+ We need to give enough bandwith to crtc to avoid visual artifact
1244N/A+ */
1244N/A+ if (pMga->is_G200SE)
1244N/A+ {
1244N/A+ if (pMga->reg_1e24 >= 0x02)
1244N/A+ {
1244N/A+ /* Calulate CRTC Priority value */
1244N/A+ CARD8 ucHiPriLvl;
1244N/A+ CARD32 ulBitsPerPixel;
1244N/A+ CARD32 ulMemoryBandwidth;
1244N/A+
1244N/A+ /* uiBitsPerPixel can only be 8,16 or32 */
1244N/A+ if (pScrn->bitsPerPixel > 16)
1244N/A+ {
1244N/A+ ulBitsPerPixel = 32;
1244N/A+ }
1244N/A+ else if (pScrn->bitsPerPixel > 8)
1244N/A+ {
1244N/A+ ulBitsPerPixel = 16;
1244N/A+ }
1244N/A+ else
1244N/A+ {
1244N/A+ ulBitsPerPixel = 8;
1244N/A+ }
1244N/A+
1244N/A+
1244N/A+ ulMemoryBandwidth = (mode->Clock * ulBitsPerPixel) / 1000;
1244N/A+
1244N/A+ if (ulMemoryBandwidth > 3100) ucHiPriLvl = 0;
1244N/A+ else if (ulMemoryBandwidth > 2600) ucHiPriLvl = 1;
1244N/A+ else if (ulMemoryBandwidth > 1900) ucHiPriLvl = 2;
1244N/A+ else if (ulMemoryBandwidth > 1160) ucHiPriLvl = 3;
1244N/A+ else if (ulMemoryBandwidth > 440) ucHiPriLvl = 4;
1244N/A+ else ucHiPriLvl = 5;
1244N/A+
1244N/A OUTREG8(0x1FDE, 0x06);
1244N/A- if (pMga->reg_1e24 == 0x01)
1244N/A- OUTREG8(0x1FDF, 0x03);
1244N/A- else
1244N/A- OUTREG8(0x1FDF, 0x14);
1244N/A+ OUTREG8(0x1FDF, ucHiPriLvl);
1244N/A+
1244N/A+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clock == %d\n", mode->Clock);
1244N/A+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BitsPerPixel == %d\n", pScrn->bitsPerPixel);
1244N/A+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "MemoryBandwidth == %d\n", ulMemoryBandwidth);
1244N/A+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "HiPriLvl == %02X\n", ucHiPriLvl);
1244N/A+
1244N/A }
1244N/A- );
1244N/A+ else
1244N/A+ {
1244N/A+ MGA_NOT_HAL(
1244N/A+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clock == %d\n", mode->Clock);
1244N/A+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "BitsPerPixel == %d\n", pScrn->bitsPerPixel);
1244N/A+ OUTREG8(0x1FDE, 0x06);
1244N/A+ if (pMga->reg_1e24 >= 0x01)
1244N/A+ {
1244N/A+ OUTREG8(0x1FDF, 0x03);
1244N/A+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "HiPriLvl == 03\n");
1244N/A+ }
1244N/A+ else
1244N/A+ {
1244N/A+ OUTREG8(0x1FDF, 0x14);
1244N/A+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "HiPriLvl == 14h\n");
1244N/A+ }
1244N/A+ );
1244N/A+ }
1244N/A+ }
1244N/A
1244N/A pMga->CurrentLayout.mode = mode;
1244N/A
1244N/A@@ -4362,13 +4419,23 @@
1244N/A MGAPtr pMga = MGAPTR(pScrn);
1244N/A
1244N/A if (pMga->Chipset == PCI_CHIP_MGAG200_SE_A_PCI) {
1244N/A- if (mode->HDisplay > 1600)
1244N/A- return MODE_VIRTUAL_X;
1244N/A- if (mode->VDisplay > 1200)
1244N/A- return MODE_VIRTUAL_Y;
1244N/A- if (pMga->reg_1e24 == 0x01 &&
1244N/A- xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 244)
1244N/A- return MODE_BANDWIDTH;
1244N/A+ if (pMga->reg_1e24 == 0x01) {
1244N/A+ if (mode->HDisplay > 1600)
1244N/A+ return MODE_VIRTUAL_X;
1244N/A+ if (mode->VDisplay > 1200)
1244N/A+ return MODE_VIRTUAL_Y;
1244N/A+ if (xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 244)
1244N/A+ return MODE_BANDWIDTH;
1244N/A+ } else {
1244N/A+ if (pMga->reg_1e24 >= 0x02) {
1244N/A+ if (mode->HDisplay > 1920)
1244N/A+ return MODE_VIRTUAL_X;
1244N/A+ if (mode->VDisplay > 1200)
1244N/A+ return MODE_VIRTUAL_Y;
1244N/A+ if (xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 301)
1244N/A+ return MODE_BANDWIDTH;
1244N/A+ }
1244N/A+ }
1244N/A } else if (pMga->is_G200WB){
1244N/A if (mode->Flags & V_DBLSCAN)
1244N/A return MODE_NO_DBLESCAN;