I'm rehashing an old thread from xpert, http://marc.theaimsgroup.com/?t=97722090500003&r=1&w=2 and propose the following patch, derived from how mga_vid.c (kernel module for Matrox BES from mplayer) programs the card. It basically disables that 'accelerated 2x horizontal zoom' thing which causes the problem. (With this option on, it looks like information from only every other pixel is used.)

It also turns back on 'chroma upsampling' (which was only turned off in a failed attempt to solve the issue, see quoted thread) and changes the vsync position to 2 (a la mga_vid.c, seems as good a constant as what was used before but is simpler).

A good example for testing is http://cox.iwr.uni-heidelberg.de/~ug/films/stefan.mov

-Michael

Index: programs/Xserver/hw/xfree86/drivers/mga/mga_video.c
===================================================================
RCS file: /cvs/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c,v
retrieving revision 1.34
diff -u -r1.34 mga_video.c
--- programs/Xserver/hw/xfree86/drivers/mga/mga_video.c 20 Feb 2004 16:59:49 -0000     
 1.34
+++ programs/Xserver/hw/xfree86/drivers/mga/mga_video.c 15 Apr 2004 12:35:35 -0000
@@ -578,48 +578,29 @@
     short src_w, short src_h,
     short drw_w, short drw_h
 ){
+#define VSYNC_POS 2
+
     MGAPtr pMga = MGAPTR(pScrn);
-    int tmp, hzoom, intrep;
-    int maxOverlayClock;
+    int tmp, intrep;
 
     CHECK_DMA_QUIESCENT(pMga, pScrn);
 
-    /* got 48 scanlines to do it in */
-    tmp = INREG(MGAREG_VCOUNT) + 48;
-    /* FIXME always change it in vertical retrace use CrtcV ?*/
-    if(tmp > pScrn->currentMode->CrtcVTotal)
-       tmp -= 49; /* too bad */
-    else
-        tmp = pScrn->currentMode->CrtcVTotal -1;
-
-    tmp = pScrn->currentMode->VDisplay +1;
-    /* enable accelerated 2x horizontal zoom when pixelclock >135MHz */
-
-    if ((pMga->ChipRev >= 0x80) || (pMga->Chipset == PCI_CHIP_MGAG550)) {
-       /* G450, G550 */
-       maxOverlayClock = 234000;
-    } else {
-       maxOverlayClock = 135000;
-    }
-
-    hzoom = (pScrn->currentMode->Clock > maxOverlayClock) ? 1 : 0;
-
     switch(id) {
     case FOURCC_UYVY:
-       OUTREG(MGAREG_BESGLOBCTL, 0x000000c0 | (3 * hzoom) | (tmp << 16));
+       OUTREG(MGAREG_BESGLOBCTL, 0x000000c0 | (VSYNC_POS << 16));
        break;
     case FOURCC_YUY2:
     default:
-       OUTREG(MGAREG_BESGLOBCTL, 0x00000080 | (3 * hzoom) | (tmp << 16));
+       OUTREG(MGAREG_BESGLOBCTL, 0x00000080 | (VSYNC_POS << 16));
        break;
     }
 
     OUTREG(MGAREG_BESA1ORG, offset);
 
     if(y1 & 0x00010000)
-       OUTREG(MGAREG_BESCTL, 0x00040c41);
+       OUTREG(MGAREG_BESCTL, 0x00050c41);
     else 
-       OUTREG(MGAREG_BESCTL, 0x00040c01);
+       OUTREG(MGAREG_BESCTL, 0x00050c01);
  
     OUTREG(MGAREG_BESHCOORD, (dstBox->x1 << 16) | (dstBox->x2 - 1));
     OUTREG(MGAREG_BESVCOORD, (dstBox->y1 << 16) | (dstBox->y2 - 1));
@@ -640,7 +621,7 @@
     OUTREG(MGAREG_BESVISCAL, tmp & 0x001ffffc);
 
     intrep = ((drw_w == src_w) || (drw_w < 2)) ? 0 : 1;
-    tmp = (((src_w - intrep) << 16)/(drw_w - intrep)) << hzoom;
+    tmp = (((src_w - intrep) << 16)/(drw_w - intrep));
     if(tmp >= (32 << 16))
        tmp = (32 << 16) - 1;
     OUTREG(MGAREG_BESHISCAL, tmp & 0x001ffffc);

Reply via email to