pTrident->hsync_rskew = 0; pTrident->vsync_bskew = 0;
tridentFixFrame(ScrnInfoPtr pScrn, int *fixFrame){  TRIDENTPtr pTrident = TRIDENTPTR(pScrn);  int vgaIOBase = VGAHWPTR(pScrn)->IOBase;  int HTotal, HSyncStart;  int VTotal, VSyncStart;  int h_off = 0;  int v_off = 0;  unsigned char CRTC[0x11];  Bool isShadow;  unsigned char shadow = 0;  if ((*fixFrame)++ < 100)     return;    *fixFrame = 0;  isShadow = (pTrident->ModeReg.tridentRegs3CE[CyberControl] & 0x81) == 0x81;    if (isShadow)    SHADOW_ENABLE(shadow);  OUTB(vgaIOBase + 4, 0x0);  CRTC[0x0] = INB(vgaIOBase + 5);  OUTB(vgaIOBase + 4, 0x4);  CRTC[0x4] = INB(vgaIOBase + 5);  OUTB(vgaIOBase + 4, 0x5);  CRTC[0x5] = INB(vgaIOBase + 5);  OUTB(vgaIOBase + 4, 0x6);  CRTC[0x6] = INB(vgaIOBase + 5);  OUTB(vgaIOBase + 4, 0x7);  CRTC[0x7] = INB(vgaIOBase + 5);  OUTB(vgaIOBase + 4, 0x10);  CRTC[0x10] = INB(vgaIOBase + 5);  HTotal = CRTC[0] << 3;  VTotal = CRTC[6]     | ((CRTC[7] & (1<<0)) << 8)    | ((CRTC[7] & (1<<5)) << 4);  HSyncStart = (CRTC[4] 		+ ((CRTC[5] >> 5) & 0x3)) << 3;  VSyncStart = CRTC[0x10]     | ((CRTC[7] & (1<<2)) << 6)    | ((CRTC[7] & (1<<7)) << 2);  if (isShadow) {    SHADOW_RESTORE(shadow);    if (pTrident->lcdMode != 0xff) {      h_off = (LCD[pTrident->lcdMode].display_x 	       - pScrn->currentMode->HDisplay) >> 1;      v_off = (LCD[pTrident->lcdMode].display_y 	       - pScrn->currentMode->VDisplay) >> 1;    }  }   pTrident->hsync = (HTotal - HSyncStart) + 23 + h_off;  pTrident->vsync = (VTotal - VSyncStart) - 2 + v_off;    /*    * HACK !! As awful as this is, it appears to be the only way....Sigh!   * We have XvHsync and XvVsync as options now, which adjust    * at the very end of this function. It'll be helpful for now   * and we can get more data on some of these skew values.   */  switch (pTrident->Chipset) {  case TGUI9680:    /* Furthur tweaking needed */#if 0    pTrident->hsync -= (mode->CrtcHTotal / 16);#endif    pTrident->vsync += 2;    break;  case PROVIDIA9682:    /* Furthur tweaking needed */    pTrident->hsync += 7;    break;  case PROVIDIA9685:    /* Spot on */    break;  case CYBERBLADEXPm8:  case CYBERBLADEXPm16:  case CYBERBLADEXPAI1:    pTrident->hsync -= 15;    pTrident->hsync_rskew = 3;    break;  case BLADE3D:    if (pScrn->depth == 24)      pTrident->hsync -= 8;    else      pTrident->hsync -= 6;    break;  case CYBERBLADEI7:  case CYBERBLADEI7D:  case CYBERBLADEI1:  case CYBERBLADEI1D:    pTrident->hsync -= 8;    break;  case CYBERBLADEAI1:    pTrident->hsync -= 7;    break;  case CYBERBLADEAI1D:      pTrident->vsync += 2;      pTrident->vsync_bskew = -4;      pTrident->hsync -= 5;      break;  case CYBERBLADEE4:    pTrident->hsync -= 8;    break;  }  pTrident->hsync+=pTrident->OverrideHsync;  pTrident->vsync+=pTrident->OverrideVsync;  pTrident->hsync_rskew+=pTrident->OverrideRskew;  pTrident->vsync_bskew+=pTrident->OverrideBskew;}