Lines Matching refs:pSiS

316     SISPtr pSiS = SISPTR(pScrn);
322 if(!pSiS) return;
325 pSiSEnt = pSiS->entityPrivate;
328 if(pSiS->pstate) free(pSiS->pstate);
329 pSiS->pstate = NULL;
330 if(pSiS->fonts) free(pSiS->fonts);
331 pSiS->fonts = NULL;
335 if(!pSiS->SecondHead) {
342 pSiSEnt->BIOS = pSiS->BIOS = NULL;
344 pSiSEnt->SiS_Pr = pSiS->SiS_Pr = NULL;
346 pSiSEnt->RenderAccelArray = pSiS->RenderAccelArray = NULL;
349 pSiS->BIOS = NULL;
350 pSiS->SiS_Pr = NULL;
351 pSiS->RenderAccelArray = NULL;
356 if(pSiS->BIOS) free(pSiS->BIOS);
357 pSiS->BIOS = NULL;
358 if(pSiS->SiS_Pr) free(pSiS->SiS_Pr);
359 pSiS->SiS_Pr = NULL;
360 if(pSiS->RenderAccelArray) free(pSiS->RenderAccelArray);
361 pSiS->RenderAccelArray = NULL;
366 if(pSiS->CRT2HSync) free(pSiS->CRT2HSync);
367 pSiS->CRT2HSync = NULL;
368 if(pSiS->CRT2VRefresh) free(pSiS->CRT2VRefresh);
369 pSiS->CRT2VRefresh = NULL;
370 if(pSiS->MetaModes) free(pSiS->MetaModes);
371 pSiS->MetaModes = NULL;
372 if(pSiS->CRT2pScrn) {
373 if(pSiS->CRT2pScrn->modes) {
374 while(pSiS->CRT2pScrn->modes)
375 xf86DeleteMode(&pSiS->CRT2pScrn->modes, pSiS->CRT2pScrn->modes);
377 if(pSiS->CRT2pScrn->monitor) {
378 if(pSiS->CRT2pScrn->monitor->Modes) {
379 while(pSiS->CRT2pScrn->monitor->Modes)
380 xf86DeleteMode(&pSiS->CRT2pScrn->monitor->Modes, pSiS->CRT2pScrn->monitor->Modes);
382 if(pSiS->CRT2pScrn->monitor->DDC) free(pSiS->CRT2pScrn->monitor->DDC);
383 free(pSiS->CRT2pScrn->monitor);
385 free(pSiS->CRT2pScrn);
386 pSiS->CRT2pScrn = NULL;
388 if(pSiS->CRT1Modes) {
389 if(pSiS->CRT1Modes != pScrn->modes) {
400 pScrn->currentMode = pSiS->CRT1CurrentMode;
401 pScrn->modes = pSiS->CRT1Modes;
402 pSiS->CRT1CurrentMode = NULL;
403 pSiS->CRT1Modes = NULL;
407 while(pSiS->SISVESAModeList) {
408 sisModeInfoPtr mp = pSiS->SISVESAModeList->next;
409 free(pSiS->SISVESAModeList);
410 pSiS->SISVESAModeList = mp;
412 if(pSiS->pVbe) vbeFree(pSiS->pVbe);
413 pSiS->pVbe = NULL;
416 if(pSiS->sisdevportopen) close(sisdevport);
445 SISPtr pSiS = SISPTR(pScrn);
449 if(!pSiS->sisfbfound) return;
450 if(!pSiS->sisfb_havelock) return;
452 if((fd = open(pSiS->sisfbdevname, O_RDONLY)) != -1) {
654 SISPtr pSiS = SISPTR(pScrn);
660 if(!(pSiS->SiS_SD3_Flags & SiS_SD3_OLDGAMMAINUSE)) {
663 gamma_max[0] = (float)pSiS->GammaBriR / 1000;
664 gamma_max[1] = (float)pSiS->GammaBriG / 1000;
665 gamma_max[2] = (float)pSiS->GammaBriB / 1000;
687 bri = pSiS->NewGammaBriR;
688 con = pSiS->NewGammaConR;
691 bri = pSiS->NewGammaBriG;
692 con = pSiS->NewGammaConG;
695 bri = pSiS->NewGammaBriB;
696 con = pSiS->NewGammaConB;
744 SISPtr pSiS = SISPTR(pScrn);
753 invgamma1 = 1. / pSiS->GammaR2;
754 invgamma2 = 1. / pSiS->GammaG2;
755 invgamma3 = 1. / pSiS->GammaB2;
757 if(!(pSiS->SiS_SD3_Flags & SiS_SD3_OLDGAMMAINUSE)) {
759 for(i = 0; i < pSiS->CRT2ColNum; i++) {
760 pSiS->crt2gcolortable[i].red = calcgammaval(i, pSiS->CRT2ColNum, invgamma1,
761 pSiS->NewGammaBriR2, pSiS->NewGammaConR2) >> myshift;
762 pSiS->crt2gcolortable[i].green = calcgammaval(i, pSiS->CRT2ColNum, invgamma2,
763 pSiS->NewGammaBriG2, pSiS->NewGammaConG2) >> myshift;
764 pSiS->crt2gcolortable[i].blue = calcgammaval(i, pSiS->CRT2ColNum, invgamma3,
765 pSiS->NewGammaBriB2, pSiS->NewGammaConB2) >> myshift;
770 int fullscale1 = 65536 * (float)pSiS->GammaBriR2 / 1000;
771 int fullscale2 = 65536 * (float)pSiS->GammaBriG2 / 1000;
772 int fullscale3 = 65536 * (float)pSiS->GammaBriB2 / 1000;
774 float dramp = 1. / (pSiS->CRT2ColNum - 1);
776 for(i = 0; i < pSiS->CRT2ColNum; i++) {
781 pSiS->crt2gcolortable[i].red = ((UShort)v) >> myshift;
786 pSiS->crt2gcolortable[i].green = ((UShort)v) >> myshift;
791 pSiS->crt2gcolortable[i].blue = ((UShort)v) >> myshift;
796 for(i = 0; i < pSiS->CRT2ColNum; i++) {
797 pSiS->crt2colors[i].red =
798 pSiS->crt2gcolortable[i * maxvalue / reds].red;
799 pSiS->crt2colors[i].green =
800 pSiS->crt2gcolortable[i * maxvalue / greens].green;
801 pSiS->crt2colors[i].blue =
802 pSiS->crt2gcolortable[i * maxvalue / blues].blue;
948 SiSAllowSyncOverride(SISPtr pSiS, Bool fromDDC)
950 if(!(pSiS->VBFlags2 & VB2_VIDEOBRIDGE)) return FALSE;
953 if(pSiS->DualHeadMode) {
954 if(pSiS->SecondHead) {
955 if((pSiS->VBFlags & CRT1_LCDA) && (!fromDDC)) return TRUE;
957 if((pSiS->VBFlags & CRT2_TV) ||
958 ((pSiS->VBFlags & CRT2_LCD) && (!fromDDC))) return TRUE;
965 if(pSiS->MergedFB) {
966 if((pSiS->VBFlags & CRT1_LCDA) && (!fromDDC)) return TRUE;
971 if(!(pSiS->VBFlags & DISPTYPE_CRT1)) {
972 if( (pSiS->VBFlags & CRT2_TV) ||
973 ((pSiS->VBFlags & CRT2_LCD) && (!fromDDC)) ) return TRUE;
974 } else if((pSiS->VBFlags & CRT1_LCDA) && (!fromDDC)) return TRUE;
1160 SISPtr pSiS = SISPTR(pScrn);
1245 if( ((mode->HDisplay * ((pScrn->bitsPerPixel + 7) / 8) * mode->VDisplay) > pSiS->maxxfbmem) ||
1260 pSiS->AtLeastOneNonClone = TRUE;
1390 SISPtr pSiS = SISPTR(pScrn);
1399 pSiS->AtLeastOneNonClone = FALSE;
1438 if(mode3 && mode4 && !pSiS->NonRect) {
1466 SISPtr pSiS = SISPTR(pScrn);
1479 pSiS->AtLeastOneNonClone = FALSE;
1583 SISPtr pSiS = SISPTR(pScrn);
1591 (pSiS->NonRect ?
1602 SISPtr pSiS = SISPTR(pScrn);
1616 maxh += pSiS->CRT1XOffs + pSiS->CRT2XOffs;
1617 maxv += pSiS->CRT1YOffs + pSiS->CRT2YOffs;
1623 pSiS->CRT1XOffs = pSiS->CRT2XOffs = 0;
1624 maxh -= (pSiS->CRT1XOffs + pSiS->CRT2XOffs);
1632 pSiS->CRT1XOffs = pSiS->CRT2XOffs = 0;
1642 pSiS->CRT1YOffs = pSiS->CRT2YOffs = 0;
1650 SISPtr pSiS = SISPTR(pScrn1);
1723 } else if(pSiS->MergedFBXDPI) {
1726 pScrn1->xDpi = pSiS->MergedFBXDPI;
1727 pScrn1->yDpi = pSiS->MergedFBYDPI;
1781 SISPtr pSiS = SISPTR(pScrn1);
1787 Bool usenonrect = pSiS->NonRect;
1790 pSiS->MBXNR1XMAX = pSiS->MBXNR1YMAX = pSiS->MBXNR2XMAX = pSiS->MBXNR2YMAX = 65536;
1791 pSiS->HaveNonRect = pSiS->HaveOffsRegions = FALSE;
1793 if(!pSiS->MergedFB) return;
1799 if(pSiS->CRT2IsScrn0) {
1812 realvirtX = pScrn1->virtualX - pSiS->CRT1XOffs - pSiS->CRT2XOffs;
1813 realvirtY = pScrn1->virtualY - pSiS->CRT1YOffs - pSiS->CRT2YOffs;
1815 if((pSiS->SiSXineramaVX != pScrn1->virtualX) || (pSiS->SiSXineramaVY != pScrn1->virtualY)) {
1819 pSiS->maxCRT1_X1 = pSiS->maxCRT1_X2 = 0;
1820 pSiS->maxCRT1_Y1 = pSiS->maxCRT1_Y2 = 0;
1821 pSiS->maxCRT2_X1 = pSiS->maxCRT2_X2 = 0;
1822 pSiS->maxCRT2_Y1 = pSiS->maxCRT2_Y2 = 0;
1823 pSiS->maxClone_X1 = pSiS->maxClone_X2 = 0;
1824 pSiS->maxClone_Y1 = pSiS->maxClone_Y2 = 0;
1840 if(pSiS->maxCRT1_X1 == i->HDisplay) {
1841 if(pSiS->maxCRT1_X2 < j->HDisplay) {
1842 pSiS->maxCRT1_X2 = j->HDisplay; /* Widest CRT2 mode displayed with widest CRT1 mode */
1844 } else if(pSiS->maxCRT1_X1 < i->HDisplay) {
1845 pSiS->maxCRT1_X1 = i->HDisplay; /* Widest CRT1 mode */
1846 pSiS->maxCRT1_X2 = j->HDisplay;
1848 if(pSiS->maxCRT2_X2 == j->HDisplay) {
1849 if(pSiS->maxCRT2_X1 < i->HDisplay) {
1850 pSiS->maxCRT2_X1 = i->HDisplay; /* Widest CRT1 mode displayed with widest CRT2 mode */
1852 } else if(pSiS->maxCRT2_X2 < j->HDisplay) {
1853 pSiS->maxCRT2_X2 = j->HDisplay; /* Widest CRT2 mode */
1854 pSiS->maxCRT2_X1 = i->HDisplay;
1856 if(pSiS->maxCRT1_Y1 == i->VDisplay) { /* Same as above, but tallest instead of widest */
1857 if(pSiS->maxCRT1_Y2 < j->VDisplay) {
1858 pSiS->maxCRT1_Y2 = j->VDisplay;
1860 } else if(pSiS->maxCRT1_Y1 < i->VDisplay) {
1861 pSiS->maxCRT1_Y1 = i->VDisplay;
1862 pSiS->maxCRT1_Y2 = j->VDisplay;
1864 if(pSiS->maxCRT2_Y2 == j->VDisplay) {
1865 if(pSiS->maxCRT2_Y1 < i->VDisplay) {
1866 pSiS->maxCRT2_Y1 = i->VDisplay;
1868 } else if(pSiS->maxCRT2_Y2 < j->VDisplay) {
1869 pSiS->maxCRT2_Y2 = j->VDisplay;
1870 pSiS->maxCRT2_Y1 = i->VDisplay;
1873 if(pSiS->maxClone_X1 < i->HDisplay) {
1874 pSiS->maxClone_X1 = i->HDisplay;
1876 if(pSiS->maxClone_X2 < j->HDisplay) {
1877 pSiS->maxClone_X2 = j->HDisplay;
1879 if(pSiS->maxClone_Y1 < i->VDisplay) {
1880 pSiS->maxClone_Y1 = i->VDisplay;
1882 if(pSiS->maxClone_Y2 < j->VDisplay) {
1883 pSiS->maxClone_Y2 = j->VDisplay;
1891 pSiS->SiSXineramaVX = pScrn1->virtualX;
1892 pSiS->SiSXineramaVY = pScrn1->virtualY;
1897 if((usenonrect) && (pSiS->CRT2Position != sisClone) && pSiS->maxCRT1_X1) {
1898 switch(pSiS->CRT2Position) {
1901 if((pSiS->maxCRT1_Y1 != realvirtY) && (pSiS->maxCRT2_Y2 != realvirtY)) {
1907 if((pSiS->maxCRT1_X1 != realvirtX) && (pSiS->maxCRT2_X2 != realvirtX)) {
1927 if(pSiS->maxCRT1_X1) { /* Means we have at least one non-clone mode */
1928 switch(pSiS->CRT2Position) {
1930 x1 = min(pSiS->maxCRT1_X2, pScrn1->virtualX - pSiS->maxCRT1_X1);
1932 y1 = pSiS->CRT1YOffs;
1935 if((usenonrect) && (pSiS->maxCRT1_Y1 != realvirtY)) {
1936 h1 = pSiS->MBXNR1YMAX = pSiS->maxCRT1_Y1;
1937 pSiS->NonRectDead.x0 = x1;
1938 pSiS->NonRectDead.x1 = x1 + w1 - 1;
1939 pSiS->NonRectDead.y0 = y1 + h1;
1940 pSiS->NonRectDead.y1 = pScrn1->virtualY - 1;
1941 pSiS->HaveNonRect = TRUE;
1944 y2 = pSiS->CRT2YOffs;
1945 w2 = max(pSiS->maxCRT2_X2, pScrn1->virtualX - pSiS->maxCRT2_X1);
1948 if((usenonrect) && (pSiS->maxCRT2_Y2 != realvirtY)) {
1949 h2 = pSiS->MBXNR2YMAX = pSiS->maxCRT2_Y2;
1950 pSiS->NonRectDead.x0 = x2;
1951 pSiS->NonRectDead.x1 = x2 + w2 - 1;
1952 pSiS->NonRectDead.y0 = y2 + h2;
1953 pSiS->NonRectDead.y1 = pScrn1->virtualY - 1;
1954 pSiS->HaveNonRect = TRUE;
1959 y1 = pSiS->CRT1YOffs;
1960 w1 = max(pSiS->maxCRT1_X1, pScrn1->virtualX - pSiS->maxCRT1_X2);
1963 if((usenonrect) && (pSiS->maxCRT1_Y1 != realvirtY)) {
1964 h1 = pSiS->MBXNR1YMAX = pSiS->maxCRT1_Y1;
1965 pSiS->NonRectDead.x0 = x1;
1966 pSiS->NonRectDead.x1 = x1 + w1 - 1;
1967 pSiS->NonRectDead.y0 = y1 + h1;
1968 pSiS->NonRectDead.y1 = pScrn1->virtualY - 1;
1969 pSiS->HaveNonRect = TRUE;
1971 x2 = min(pSiS->maxCRT2_X1, pScrn1->virtualX - pSiS->maxCRT2_X2);
1973 y2 = pSiS->CRT2YOffs;
1976 if((usenonrect) && (pSiS->maxCRT2_Y2 != realvirtY)) {
1977 h2 = pSiS->MBXNR2YMAX = pSiS->maxCRT2_Y2;
1978 pSiS->NonRectDead.x0 = x2;
1979 pSiS->NonRectDead.x1 = x2 + w2 - 1;
1980 pSiS->NonRectDead.y0 = y2 + h2;
1981 pSiS->NonRectDead.y1 = pScrn1->virtualY - 1;
1982 pSiS->HaveNonRect = TRUE;
1986 x1 = pSiS->CRT1XOffs;
1987 y1 = min(pSiS->maxCRT1_Y2, pScrn1->virtualY - pSiS->maxCRT1_Y1);
1991 if((usenonrect) && (pSiS->maxCRT1_X1 != realvirtX)) {
1992 w1 = pSiS->MBXNR1XMAX = pSiS->maxCRT1_X1;
1993 pSiS->NonRectDead.x0 = x1 + w1;
1994 pSiS->NonRectDead.x1 = pScrn1->virtualX - 1;
1995 pSiS->NonRectDead.y0 = y1;
1996 pSiS->NonRectDead.y1 = y1 + h1 - 1;
1997 pSiS->HaveNonRect = TRUE;
1999 x2 = pSiS->CRT2XOffs;
2002 h2 = max(pSiS->maxCRT2_Y2, pScrn1->virtualY - pSiS->maxCRT2_Y1);
2004 if((usenonrect) && (pSiS->maxCRT2_X2 != realvirtX)) {
2005 w2 = pSiS->MBXNR2XMAX = pSiS->maxCRT2_X2;
2006 pSiS->NonRectDead.x0 = x2 + w2;
2007 pSiS->NonRectDead.x1 = pScrn1->virtualX - 1;
2008 pSiS->NonRectDead.y0 = y2;
2009 pSiS->NonRectDead.y1 = y2 + h2 - 1;
2010 pSiS->HaveNonRect = TRUE;
2014 x1 = pSiS->CRT1XOffs;
2017 h1 = max(pSiS->maxCRT1_Y1, pScrn1->virtualY - pSiS->maxCRT1_Y2);
2019 if((usenonrect) && (pSiS->maxCRT1_X1 != realvirtX)) {
2020 w1 = pSiS->MBXNR1XMAX = pSiS->maxCRT1_X1;
2021 pSiS->NonRectDead.x0 = x1 + w1;
2022 pSiS->NonRectDead.x1 = pScrn1->virtualX - 1;
2023 pSiS->NonRectDead.y0 = y1;
2024 pSiS->NonRectDead.y1 = y1 + h1 - 1;
2025 pSiS->HaveNonRect = TRUE;
2027 x2 = pSiS->CRT2XOffs;
2028 y2 = min(pSiS->maxCRT2_Y1, pScrn1->virtualY - pSiS->maxCRT2_Y2);
2032 if((usenonrect) && (pSiS->maxCRT2_X2 != realvirtX)) {
2033 w2 = pSiS->MBXNR2XMAX = pSiS->maxCRT2_X2;
2034 pSiS->NonRectDead.x0 = x2 + w2;
2035 pSiS->NonRectDead.x1 = pScrn1->virtualX - 1;
2036 pSiS->NonRectDead.y0 = y2;
2037 pSiS->NonRectDead.y1 = y2 + h2 - 1;
2038 pSiS->HaveNonRect = TRUE;
2044 switch(pSiS->CRT2Position) {
2047 if(pSiS->CRT1YOffs) {
2048 pSiS->OffDead1.x0 = x1;
2049 pSiS->OffDead1.x1 = x1 + w1 - 1;
2050 pSiS->OffDead1.y0 = 0;
2051 pSiS->OffDead1.y1 = y1 - 1;
2052 pSiS->OffDead2.x0 = x2;
2053 pSiS->OffDead2.x1 = x2 + w2 - 1;
2054 pSiS->OffDead2.y0 = y2 + h2;
2055 pSiS->OffDead2.y1 = pScrn1->virtualY - 1;
2056 pSiS->HaveOffsRegions = TRUE;
2057 } else if(pSiS->CRT2YOffs) {
2058 pSiS->OffDead1.x0 = x2;
2059 pSiS->OffDead1.x1 = x2 + w2 - 1;
2060 pSiS->OffDead1.y0 = 0;
2061 pSiS->OffDead1.y1 = y2 - 1;
2062 pSiS->OffDead2.x0 = x1;
2063 pSiS->OffDead2.x1 = x1 + w1 - 1;
2064 pSiS->OffDead2.y0 = y1 + h1;
2065 pSiS->OffDead2.y1 = pScrn1->virtualY - 1;
2066 pSiS->HaveOffsRegions = TRUE;
2071 if(pSiS->CRT1XOffs) {
2072 pSiS->OffDead1.x0 = x2 + w2;
2073 pSiS->OffDead1.x1 = pScrn1->virtualX - 1;
2074 pSiS->OffDead1.y0 = y2;
2075 pSiS->OffDead1.y1 = y2 + h2 - 1;
2076 pSiS->OffDead2.x0 = 0;
2077 pSiS->OffDead2.x1 = x1 - 1;
2078 pSiS->OffDead2.y0 = y1;
2079 pSiS->OffDead2.y1 = y1 + h1 - 1;
2080 pSiS->HaveOffsRegions = TRUE;
2081 } else if(pSiS->CRT2XOffs) {
2082 pSiS->OffDead1.x0 = x1 + w1;
2083 pSiS->OffDead1.x1 = pScrn1->virtualX - 1;
2084 pSiS->OffDead1.y0 = y1;
2085 pSiS->OffDead1.y1 = y1 + h1 - 1;
2086 pSiS->OffDead2.x0 = 0;
2087 pSiS->OffDead2.x1 = x2 - 1;
2088 pSiS->OffDead2.y0 = y2;
2089 pSiS->OffDead2.y1 = y2 + h2 - 1;
2090 pSiS->HaveOffsRegions = TRUE;
2100 w1 = w2 = max(pSiS->maxClone_X1, pSiS->maxClone_X2);
2101 h1 = h2 = max(pSiS->maxClone_Y1, pSiS->maxClone_Y2);
2121 if(pSiS->HaveNonRect) {
2124 pSiS->NonRectDead.x0, pSiS->NonRectDead.y0,
2125 pSiS->NonRectDead.x1, pSiS->NonRectDead.y1);
2127 if(pSiS->HaveOffsRegions) {
2130 pSiS->OffDead1.x0, pSiS->OffDead1.y0,
2131 pSiS->OffDead1.x1, pSiS->OffDead1.y1);
2134 pSiS->OffDead2.x0, pSiS->OffDead2.y0,
2135 pSiS->OffDead2.x1, pSiS->OffDead2.y1);
2137 if(pSiS->HaveNonRect || pSiS->HaveOffsRegions) {
2140 pSiS->MouseRestrictions ? "enabled" : "disabled");
2456 SISPtr pSiS = SISPTR(pScrn);
2461 if(!pSiS->MergedFB) {
2463 pSiS->MouseRestrictions = FALSE;
2472 pSiS->MouseRestrictions = FALSE;
2480 pSiS->MouseRestrictions = FALSE;
2484 if(pSiS->CRT2Position == sisClone) {
2488 pSiS->MouseRestrictions = FALSE;
2492 if(!(pSiS->AtLeastOneNonClone)) {
2496 pSiS->MouseRestrictions = FALSE;
2504 pSiS->XineramaExtEntry = AddExtension(PANORAMIX_PROTOCOL_NAME, 0,0,
2510 if(!pSiS->XineramaExtEntry) break;
2522 pSiS->MouseRestrictions = FALSE;
2529 pSiS->SiSXineramaVX = 0;
2530 pSiS->SiSXineramaVY = 0;
2540 SiSFreeCRT2Structs(SISPtr pSiS)
2542 if(pSiS->CRT2pScrn) {
2543 if(pSiS->CRT2pScrn->modes) {
2544 while(pSiS->CRT2pScrn->modes)
2545 xf86DeleteMode(&pSiS->CRT2pScrn->modes, pSiS->CRT2pScrn->modes);
2547 if(pSiS->CRT2pScrn->monitor) {
2548 if(pSiS->CRT2pScrn->monitor->Modes) {
2549 while(pSiS->CRT2pScrn->monitor->Modes)
2550 xf86DeleteMode(&pSiS->CRT2pScrn->monitor->Modes, pSiS->CRT2pScrn->monitor->Modes);
2552 if(pSiS->CRT2pScrn->monitor->DDC) free(pSiS->CRT2pScrn->monitor->DDC);
2553 free(pSiS->CRT2pScrn->monitor);
2555 free(pSiS->CRT2pScrn);
2556 pSiS->CRT2pScrn = NULL;
2565 SISPtr pSiS = SISPTR(pScrn);
2571 if((pSiS->CRT1off) && (!crtno)) return NULL;
2574 if(pSiS->VBFlags & CRT2_LCD) realcrtno = 1;
2575 else if(pSiS->VBFlags & CRT2_VGA) realcrtno = 2;
2577 if(pSiS->SiS_Pr->DDCPortMixup) realcrtno = 0;
2580 if(pSiS->VBFlags & CRT1_LCDA) {
2581 if(pSiS->VBFlags2 & VB2_SISTMDSLCDABRIDGE) realcrtno = 1;
2588 temp1 = SiS_HandleDDC(pSiS->SiS_Pr, pSiS->VBFlags, pSiS->VGAEngine,
2589 realcrtno, 0, &buffer[0], pSiS->VBFlags2);
2603 temp = SiS_HandleDDC(pSiS->SiS_Pr, pSiS->VBFlags, pSiS->VGAEngine,
2604 realcrtno, 1, &buffer[0], pSiS->VBFlags2);
2615 if(tempvgagamma) pSiS->CRT1VGAMonitorGamma = tempvgagamma;
2618 if(tempvgagamma) pSiS->CRT2VGAMonitorGamma = tempvgagamma;
2619 if(templcdgamma) pSiS->CRT2LCDMonitorGamma = templcdgamma;
2649 SISPtr pSiS = SISPTR(pScrn);
2652 if(pSiS->DualHeadMode) {
2653 if(pSiS->SecondHead) {
2662 if((pSiS->CRT1off) || (!pSiS->CRT1Detected)) {
2674 SISPtr pSiS = SISPTR(pScrn);
2679 if((pSiS->VGAEngine == SIS_315_VGA) && (!DIGITAL(pMonitor->features.input_type))) {
2702 if((crtnum == 1) && (pSiS->SiS_Pr->SiS_UseWide == -1)) {
2703 pSiS->SiS_Pr->SiS_UseWide = UseWide;
2704 } else if((crtnum == 2) && (pSiS->SiS_Pr->SiS_UseWideCRT2 == -1)) {
2705 pSiS->SiS_Pr->SiS_UseWideCRT2 = UseWide;
2815 SISPtr pSiS = SISPTR(pScrn);
2817 if( ((pSiS->ChipType == SIS_650) ||
2818 (pSiS->ChipType == SIS_315PRO) ||
2819 (pSiS->ChipType >= SIS_661)) &&
2820 (pSiS->ChipType != XGI_20) &&
2821 (pSiS->VBFlags2 & VB2_SISLCDABRIDGE) &&
2822 (pSiS->VESA != 1) ) {
2830 SISPtr pSiS = SISPTR(pScrn);
2832 pSiS->detectedCRT2Devices = pSiS->VBFlags & (CRT2_LCD|CRT2_TV|CRT2_VGA|TV_AVIDEO|TV_SVIDEO|
2837 SISCheckBIOS(SISPtr pSiS, UShort mypciid, UShort mypcivendor, int biossize)
2841 if(!pSiS->BIOS) return FALSE;
2843 if((pSiS->BIOS[0] != 0x55) || (pSiS->BIOS[1] != 0xaa)) return FALSE;
2845 romptr = pSiS->BIOS[0x18] | (pSiS->BIOS[0x19] << 8);
2847 if((pSiS->BIOS[romptr] != 'P') || (pSiS->BIOS[romptr+1] != 'C') ||
2848 (pSiS->BIOS[romptr+2] != 'I') || (pSiS->BIOS[romptr+3] != 'R')) return FALSE;
2850 pciid = pSiS->BIOS[romptr+4] | (pSiS->BIOS[romptr+5] << 8);
2853 pciid = pSiS->BIOS[romptr+6] | (pSiS->BIOS[romptr+7] << 8);
2862 SISPtr pSiS = SISPTR(pScrn);
2873 if( !pSiS->Primary &&
2874 pSiS->sisfbcardposted)
2877 if(pSiS->pVbe) return;
2881 pSiS->pVbe = VBEInit(pSiS->pInt, pSiS->pEnt->index);
2883 pSiS->pVbe = VBEExtendedInit(pSiS->pInt, pSiS->pEnt->index,
2888 if(!pSiS->pVbe) {
2898 SISPtr pSiS = SISPTR(pScrn);
2901 pSiS->VGAMapSize = 0x10000;
2902 pSiS->VGAMapPhys = 0; /* Default */
2903 if((!pSiS->Primary) || (!pSiS->VGADecodingEnabled)) {
2907 pSiS->VGAMapPhys = PCI_REGION_BASE(pSiS->PciInfo, 0, REGION_MEM);
2912 pSiS->VGAMapPhys);
2920 SISPtr pSiS = SISPTR(pScrn);
2926 pSiS->donttrustpdc = FALSE;
2927 pSiS->sisfbpdc = 0xff;
2928 pSiS->sisfbpdca = 0xff;
2929 pSiS->sisfblcda = 0xff;
2930 pSiS->sisfbscalelcd = -1;
2931 pSiS->sisfbspecialtiming = CUT_NONE;
2932 pSiS->sisfb_haveemi = FALSE;
2933 pSiS->sisfbfound = FALSE;
2934 pSiS->sisfb_tvposvalid = FALSE;
2935 pSiS->sisfbdevname[0] = 0;
2936 pSiS->sisfb_havelock = FALSE;
2937 pSiS->sisfbHaveNewHeapDef = FALSE;
2938 pSiS->sisfbHeapSize = 0;
2939 pSiS->sisfbVideoOffset = 0;
2940 pSiS->sisfbxSTN = FALSE;
2941 pSiS->sisfbcanpost = FALSE; /* (Old) sisfb can't POST card */
2942 pSiS->sisfbcardposted = TRUE; /* If (old) sisfb is running, card must have been POSTed */
2943 pSiS->sisfbprimary = FALSE; /* (Old) sisfb doesn't know */
2945 if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) {
2994 if((mysisfbinfo->sisfb_pcibus == pSiS->PciBus) &&
2995 (mysisfbinfo->sisfb_pcislot == pSiS->PciDevice) &&
2996 (mysisfbinfo->sisfb_pcifunc == pSiS->PciFunc)) {
2997 pSiS->sisfbfound = TRUE;
2999 } else pSiS->sisfbfound = TRUE;
3001 if(pSiS->sisfbfound) {
3008 pSiS->PciBus,
3009 pSiS->PciDevice,
3010 pSiS->PciFunc);
3018 pSiS->donttrustpdc = TRUE;
3019 pSiS->sisfbHeapStart = mysisfbinfo->heapstart;
3022 pSiS->sisfbHeapSize = mysisfbinfo->sisfb_heapsize;
3023 pSiS->sisfbVideoOffset = mysisfbinfo->sisfb_videooffset;
3024 pSiS->sisfbHaveNewHeapDef = TRUE;
3025 pSiS->sisfbFSTN = mysisfbinfo->sisfb_curfstn;
3026 pSiS->sisfbDSTN = mysisfbinfo->sisfb_curdstn;
3027 pSiS->sisfbxSTN = TRUE;
3030 (int)pSiS->sisfbHeapStart, (int)pSiS->sisfbHeapSize,
3031 (int)pSiS->sisfbVideoOffset/1024);
3034 "sisfb: memory heap at %dKB\n", (int)pSiS->sisfbHeapStart);
3038 pSiS->OldMode = mysisfbinfo->fbvidmode;
3051 if(pSiS->VGAEngine == SIS_300_VGA) pSiS->donttrustpdc = FALSE;
3054 if(pSiS->VGAEngine == SIS_300_VGA) {
3056 pSiS->sisfbpdc = mysisfbinfo->sisfb_lcdpdc;
3057 if(!pSiS->sisfbpdc) pSiS->sisfbpdc = 0xff;
3061 if(pSiS->VGAEngine == SIS_315_VGA) {
3062 pSiS->sisfblcda = mysisfbinfo->sisfb_lcda;
3066 pSiS->sisfbscalelcd = mysisfbinfo->sisfb_scalelcd;
3067 pSiS->sisfbspecialtiming = mysisfbinfo->sisfb_specialtiming;
3070 if(pSiS->VGAEngine == SIS_315_VGA) {
3071 pSiS->donttrustpdc = FALSE;
3072 pSiS->sisfbpdc = mysisfbinfo->sisfb_lcdpdc;
3074 pSiS->sisfb_haveemi = mysisfbinfo->sisfb_haveemi ? TRUE : FALSE;
3075 pSiS->sisfb_haveemilcd = TRUE; /* will match most cases */
3076 pSiS->sisfb_emi30 = mysisfbinfo->sisfb_emi30;
3077 pSiS->sisfb_emi31 = mysisfbinfo->sisfb_emi31;
3078 pSiS->sisfb_emi32 = mysisfbinfo->sisfb_emi32;
3079 pSiS->sisfb_emi33 = mysisfbinfo->sisfb_emi33;
3082 pSiS->sisfb_haveemilcd = mysisfbinfo->sisfb_haveemilcd ? TRUE : FALSE;
3085 pSiS->sisfbpdca = mysisfbinfo->sisfb_lcdpdca;
3087 if(pSiS->sisfbpdc) {
3088 pSiS->sisfbpdca = (pSiS->sisfbpdc & 0xf0) >> 3;
3089 pSiS->sisfbpdc = (pSiS->sisfbpdc & 0x0f) << 1;
3091 pSiS->sisfbpdca = pSiS->sisfbpdc = 0xff;
3097 pSiS->sisfb_havelock = TRUE;
3099 pSiS->sisfb_tvxpos = mysisfbinfo->sisfb_tvxpos;
3100 pSiS->sisfb_tvypos = mysisfbinfo->sisfb_tvypos;
3101 pSiS->sisfb_tvposvalid = TRUE;
3105 pSiS->sisfbcanpost = (mysisfbinfo->sisfb_can_post) ? TRUE : FALSE;
3106 pSiS->sisfbcardposted = (mysisfbinfo->sisfb_card_posted) ? TRUE : FALSE;
3107 pSiS->sisfbprimary = (mysisfbinfo->sisfb_was_boot_device) ? TRUE : FALSE;
3109 if(!pSiS->sisfbcardposted) {
3110 pSiS->sisfbprimary = FALSE;
3121 } while((i <= 15) && (!pSiS->sisfbfound));
3123 if(pSiS->sisfbfound) {
3124 strncpy(pSiS->sisfbdevname, name, 15);
3130 if(!pSiS->sisfbfound) {
3131 pSiS->sisfbcardposted = FALSE;
3147 SISPtr pSiS;
3266 SISErrorLog(pScrn, "Could not allocate memory for pSiS private\n");
3269 pSiS = SISPTR(pScrn);
3270 pSiS->pScrn = pScrn;
3272 pSiS->pInt = NULL;
3276 pSiS->IODBase = 0;
3278 pSiS->IODBase = pScrn->domainIOBase;
3282 pSiS->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
3283 if(pSiS->pEnt->location.type != BUS_PCI) {
3292 pSiS->entityPrivate = pSiSEnt;
3303 pSiS->PciInfo = xf86GetPciInfoForEntity(pSiS->pEnt->index);
3304 pSiS->PciBus = PCI_CFG_BUS(pSiS->PciInfo); /*SIS_PCI_BUS(pSiS->PciInfo);*/
3305 pSiS->PciDevice = PCI_CFG_DEV(pSiS->PciInfo); /*SIS_PCI_DEVICE(pSiS->PciInfo);*/
3306 pSiS->PciFunc = PCI_CFG_FUNC(pSiS->PciInfo); /*SIS_PCI_FUNC(pSiS->PciInfo);*/
3309 pSiS->PciTag = pciTag(PCI_DEV_BUS(pSiS->PciInfo),
3310 PCI_DEV_DEV(pSiS->PciInfo),
3311 PCI_DEV_FUNC(pSiS->PciInfo));
3332 pSiS->IOPAddress = pSiS->IODBase + pSiS->PciInfo->ioBase[2];
3334 SISErrorLog(pScrn, "Could not map I/O port area at 0x%x\n", pSiS->IOPAddress);
3337 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "I/O port area mapped to %p, size 128\n", pSiS->IOPBase);
3341 IOPortBase = (unsigned int)pSiS->IOPBase;
3352 pSiS->sisdevportopen = TRUE;
3362 if(PCI_DEV_VENDOR_ID(pSiS->PciInfo) == PCI_VENDOR_XGI) {
3366 if(pSiS->pEnt->device->chipset && *pSiS->pEnt->device->chipset) {
3368 pScrn->chipset = pSiS->pEnt->device->chipset;
3369 pSiS->Chipset = xf86StringToToken(myChipsets, pScrn->chipset);
3371 } else if(pSiS->pEnt->device->chipID >= 0) {
3373 pSiS->Chipset = pSiS->pEnt->device->chipID;
3374 pScrn->chipset = (char *)xf86TokenToString(myChipsets, pSiS->Chipset);
3377 pSiS->Chipset);
3380 pSiS->Chipset = PCI_DEV_DEVICE_ID(pSiS->PciInfo);
3381 pScrn->chipset = (char *)xf86TokenToString(myChipsets, pSiS->Chipset);
3386 if(pSiS->pEnt->device->chipRev >= 0) {
3388 pSiS->ChipRev = pSiS->pEnt->device->chipRev;
3390 pSiS->ChipRev);
3393 pSiS->ChipRev = PCI_DEV_REVISION(pSiS->PciInfo);
3402 SISErrorLog(pScrn, "ChipID 0x%04X is not recognised\n", pSiS->Chipset);
3405 if(pSiS->Chipset < 0) {
3410 pSiS->SiS6326Flags = 0;
3413 switch(pSiS->Chipset) {
3417 pSiS->VGAEngine = SIS_300_VGA;
3429 pSiS->VGAEngine = SIS_315_VGA;
3432 pSiS->VGAEngine = SIS_530_VGA;
3443 (pSiS->ChipRev == 0xaf) ? "(Ax)" :
3444 ((pSiS->ChipRev == 0x0a) ? "AGP (G0)" :
3445 ((pSiS->ChipRev == 0x0b) ? "AGP (H0)" :
3446 (((pSiS->ChipRev & 0xf0) == 0xd0) ? "DVD (Dx/H0)" :
3447 (((pSiS->ChipRev & 0xf0) == 0x90) ? "(9x)" :
3448 (((pSiS->ChipRev & 0xf0) == 0xc0) ? "(Cx)" :
3450 pSiS->ChipRev);
3451 if((pSiS->ChipRev != 0x0a) && (pSiS->ChipRev != 0x0b)) {
3452 pSiS->SiS6326Flags |= SIS6326_HASTV;
3456 pSiS->VGAEngine = SIS_OLD_VGA;
3460 pSiS->OldMode = 0;
3476 if(!(pSiS->Primary = xf86IsPrimaryPci(pSiS->PciInfo))) {
3483 * sisfb_* entries in pSiS regardless of the chipset.
3525 if(!pSiS->Primary && pSiS->sisfbprimary) {
3528 pSiS->Primary = TRUE;
3555 if(!pSiS->Primary) {
3556 if(!pSiS->sisfbcardposted) {
3560 pSiS->pInt = xf86InitInt10(pSiS->pEnt->index);
3576 pSiS->RelIO = (SISIOADDRESS)(PCI_REGION_BASE(pSiS->PciInfo, 2, REGION_IO) + pSiS->IODBase);
3578 (ULong)pSiS->RelIO);
3581 sisSaveUnlockExtRegisterLock(pSiS, &srlockReg, &crlockReg);
3584 pSiS->VGADecodingEnabled = TRUE;
3585 switch(pSiS->VGAEngine) {
3591 if(tempreg & 0x04) pSiS->VGADecodingEnabled = FALSE;
3596 if(tempreg & 0x04) pSiS->VGADecodingEnabled = FALSE;
3600 if(!pSiS->VGADecodingEnabled) {
3625 xf86SetOperatingState(resVgaMem, pSiS->pEnt->index, ResUnusedOpr);
3636 xf86SetOperatingState(resVgaIo, pSiS->pEnt->index, ResUnusedOpr);
3656 pSiS->SiSFastVidCopy = SiSVidCopyGetDefault();
3657 pSiS->SiSFastMemCopy = SiSVidCopyGetDefault();
3658 pSiS->SiSFastVidCopyFrom = SiSVidCopyGetDefault();
3659 pSiS->SiSFastMemCopyFrom = SiSVidCopyGetDefault();
3660 pSiS->SiSFastVidCopyDone = FALSE;
3662 pSiS->RenderCallback = NULL;
3665 pSiS->ExaRenderCallback = NULL;
3667 pSiS->InitAccel = SiSPseudo;
3668 pSiS->SyncAccel = SiSPseudo;
3669 pSiS->FillRect = NULL;
3670 pSiS->BlitRect = NULL;
3673 pSiS->skipswitchcheck = FALSE;
3676 pSiS->ChipFlags = 0;
3677 pSiS->SiS_SD_Flags = pSiS->SiS_SD2_Flags = 0;
3678 pSiS->SiS_SD3_Flags = pSiS->SiS_SD4_Flags = 0;
3679 pSiS->HWCursorMBufNum = pSiS->HWCursorCBufNum = 0;
3680 pSiS->NeedFlush = FALSE;
3681 pSiS->NewCRLayout = FALSE;
3682 pSiS->mmioSize = 64;
3684 switch(pSiS->Chipset) {
3686 pSiS->ChipType = SIS_530;
3689 pSiS->ChipType = SIS_300;
3690 pSiS->SiS_SD_Flags |= SiS_SD_IS300SERIES;
3693 pSiS->ChipType = SIS_540;
3694 pSiS->SiS_SD_Flags |= SiS_SD_IS300SERIES;
3697 pSiS->ChipType = SIS_630;
3699 pSiS->ChipType = SIS_730;
3701 pSiS->SiS_SD_Flags |= SiS_SD_IS300SERIES;
3704 pSiS->ChipType = SIS_315H;
3705 pSiS->ChipFlags |= (SiSCF_315Core | SiSCF_MMIOPalette);
3706 pSiS->SiS_SD_Flags |= SiS_SD_IS315SERIES;
3707 pSiS->SiS_SD2_Flags |= SiS_SD2_SUPPORTXVHUESAT;
3708 pSiS->myCR63 = 0x63;
3712 pSiS->Chipset = PCI_CHIP_SIS315H;
3713 pSiS->ChipType = SIS_315;
3714 pSiS->ChipFlags |= (SiSCF_315Core | SiSCF_MMIOPalette);
3715 pSiS->SiS_SD_Flags |= SiS_SD_IS315SERIES;
3716 pSiS->SiS_SD2_Flags |= SiS_SD2_SUPPORTXVHUESAT;
3717 pSiS->myCR63 = 0x63;
3721 pSiS->Chipset = PCI_CHIP_SIS315H;
3722 pSiS->ChipType = SIS_315PRO;
3723 pSiS->ChipFlags |= (SiSCF_315Core | SiSCF_MMIOPalette);
3724 pSiS->SiS_SD_Flags |= SiS_SD_IS315SERIES;
3725 pSiS->SiS_SD2_Flags |= SiS_SD2_SUPPORTXVHUESAT;
3726 pSiS->myCR63 = 0x63;
3729 pSiS->ChipType = SIS_550;
3730 pSiS->ChipFlags |= (SiSCF_Integrated | SiSCF_MMIOPalette);
3731 pSiS->SiS_SD_Flags |= SiS_SD_IS315SERIES;
3732 pSiS->SiS_SD2_Flags |= SiS_SD2_SUPPORTXVHUESAT;
3733 pSiS->myCR63 = 0x63;
3736 pSiS->ChipType = SIS_650;
3738 pSiS->ChipType = SIS_740;
3740 pSiS->ChipFlags |= (SiSCF_Integrated | SiSCF_Real256ECore | SiSCF_MMIOPalette);
3741 pSiS->SiS_SD_Flags |= SiS_SD_IS315SERIES;
3742 pSiS->SiS_SD2_Flags |= SiS_SD2_SUPPORTXVHUESAT;
3743 pSiS->myCR63 = 0x63;
3746 pSiS->ChipType = SIS_330;
3747 pSiS->ChipFlags |= (SiSCF_XabreCore | SiSCF_MMIOPalette);
3748 pSiS->SiS_SD_Flags |= SiS_SD_IS330SERIES;
3749 pSiS->SiS_SD2_Flags |= SiS_SD2_SUPPORTXVHUESAT;
3750 pSiS->SiS_SD3_Flags |= SiS_SD3_CRT1SATGAIN; /* FIXME ? */
3751 pSiS->myCR63 = 0x53; /* sic! */
3758 pSiS->ChipType = SIS_660;
3759 pSiS->ChipFlags |= SiSCF_Ultra256Core;
3760 pSiS->NeedFlush = TRUE;
3763 pSiS->ChipType = SIS_760;
3764 pSiS->ChipFlags |= SiSCF_Ultra256Core;
3765 pSiS->NeedFlush = TRUE;
3768 pSiS->ChipType = SIS_761;
3769 pSiS->ChipFlags |= SiSCF_Ultra256Core;
3770 pSiS->NeedFlush = TRUE;
3773 pSiS->ChipType = SIS_770;
3774 pSiS->ChipFlags |= SiSCF_Ultra256Core;
3775 pSiS->NeedFlush = TRUE;
3778 pSiS->ChipType = SIS_741;
3779 pSiS->ChipFlags |= SiSCF_Real256ECore;
3783 pSiS->ChipType = SIS_661;
3784 pSiS->ChipFlags |= SiSCF_Real256ECore;
3787 pSiS->ChipType = SIS_670;
3788 pSiS->ChipFlags |= SiSCF_Real256ECore;
3796 pSiS->ChipFlags |= (SiSCF_Integrated | SiSCF_MMIOPalette);
3797 pSiS->SiS_SD_Flags |= SiS_SD_IS330SERIES;
3798 pSiS->SiS_SD2_Flags |= SiS_SD2_SUPPORTXVHUESAT;
3799 pSiS->SiS_SD3_Flags |= SiS_SD3_CRT1SATGAIN;
3800 pSiS->myCR63 = 0x53; /* sic! */
3801 pSiS->NewCRLayout = TRUE;
3805 pSiS->ChipType = SIS_340;
3806 pSiS->ChipFlags |= (SiSCF_XabreCore | SiSCF_MMIOPalette);
3807 pSiS->SiS_SD_Flags |= SiS_SD_IS340SERIES;
3808 pSiS->SiS_SD2_Flags |= SiS_SD2_SUPPORTXVHUESAT;
3809 pSiS->SiS_SD3_Flags |= SiS_SD3_CRT1SATGAIN;
3810 pSiS->myCR63 = 0x53;
3811 pSiS->NewCRLayout = TRUE;
3814 pSiS->ChipType = XGI_20;
3815 pSiS->ChipFlags |= (SiSCF_XabreCore | SiSCF_MMIOPalette | SiSCF_IsXGI);
3816 pSiS->SiS_SD2_Flags |= (SiS_SD2_NOOVERLAY | SiS_SD2_ISXGI);
3817 pSiS->myCR63 = 0x53;
3818 pSiS->NewCRLayout = TRUE;
3821 pSiS->ChipType = XGI_40;
3822 pSiS->ChipFlags |= (SiSCF_XabreCore | SiSCF_MMIOPalette | SiSCF_IsXGI);
3823 pSiS->SiS_SD2_Flags |= (SiS_SD2_SUPPORTXVHUESAT | SiS_SD2_ISXGI);
3824 pSiS->SiS_SD3_Flags |= SiS_SD3_CRT1SATGAIN;
3825 pSiS->myCR63 = 0x53;
3826 pSiS->NewCRLayout = TRUE;
3827 if(pSiS->ChipRev == 2) pSiS->ChipFlags |= SiSCF_IsXGIV3;
3830 pSiS->ChipType = SIS_OLD;
3840 switch(pSiS->VGAEngine) {
3842 pSiS->CursorSize = 4096;
3846 pSiS->CursorSize = 16384;
3850 pSiS->CursorSize = 2048;
3856 pSiS->CursorSize = 2048;
3874 pSiS->SecondHead = FALSE;
3878 pSiS->DualHeadMode = TRUE;
3889 pSiS->SecondHead = TRUE;
3891 pSiS->DualHeadMode = TRUE;
3895 pSiS->SecondHead = FALSE;
3896 pSiS->DualHeadMode = FALSE;
3901 pSiS->SecondHead = FALSE;
3902 pSiS->DualHeadMode = FALSE;
3913 strncpy(&pSiS->devsectname[0], device->identifier, 31);
3915 pSiS->devsectname[ttt] = 0;
3918 pSiS->ForceCursorOff = FALSE;
3921 pSiS->SiS_Pr = NULL;
3924 if(pSiSEnt->SiS_Pr) pSiS->SiS_Pr = pSiSEnt->SiS_Pr;
3927 if(!pSiS->SiS_Pr) {
3928 if(!(pSiS->SiS_Pr = xnfcalloc(sizeof(struct SiS_Private), 1))) {
3933 if(pSiSEnt) pSiSEnt->SiS_Pr = pSiS->SiS_Pr;
3935 memset(pSiS->SiS_Pr, 0, sizeof(struct SiS_Private));
3937 pSiS->SiS_Pr->PciTag = pSiS->PciTag;
3939 pSiS->SiS_Pr->ChipType = pSiS->ChipType;
3940 pSiS->SiS_Pr->ChipRevision = pSiS->ChipRev;
3941 pSiS->SiS_Pr->SiS_Backup70xx = 0xff;
3942 pSiS->SiS_Pr->SiS_CHOverScan = -1;
3943 pSiS->SiS_Pr->SiS_ChSW = FALSE;
3944 pSiS->SiS_Pr->SiS_CustomT = CUT_NONE;
3945 pSiS->SiS_Pr->SiS_UseWide = -1;
3946 pSiS->SiS_Pr->SiS_UseWideCRT2 = -1;
3947 pSiS->SiS_Pr->SiS_TVBlue = -1;
3948 pSiS->SiS_Pr->PanelSelfDetected = FALSE;
3949 pSiS->SiS_Pr->UsePanelScaler = -1;
3950 pSiS->SiS_Pr->CenterScreen = -1;
3951 pSiS->SiS_Pr->CRT1UsesCustomMode = FALSE;
3952 pSiS->SiS_Pr->PDC = pSiS->SiS_Pr->PDCA = -1;
3953 pSiS->SiS_Pr->LVDSHL = -1;
3954 pSiS->SiS_Pr->HaveEMI = FALSE;
3955 pSiS->SiS_Pr->HaveEMILCD = FALSE;
3956 pSiS->SiS_Pr->OverruleEMI = FALSE;
3957 pSiS->SiS_Pr->SiS_SensibleSR11 = FALSE;
3958 if(pSiS->ChipType >= SIS_661) {
3959 pSiS->SiS_Pr->SiS_SensibleSR11 = TRUE;
3961 pSiS->SiS_Pr->SiS_MyCR63 = pSiS->myCR63;
3962 pSiS->SiS_Pr->DDCPortMixup = FALSE;
3968 pSiS->SiS_Pr->IOAddress = (SISIOADDRESS)(pSiS->RelIO + 0x30);
3969 SiSRegInit(pSiS->SiS_Pr, pSiS->RelIO + 0x30);
3977 if(pSiS->VGAEngine == SIS_OLD_VGA || pSiS->VGAEngine == SIS_530_VGA) {
3978 switch(pSiS->Chipset) {
3980 pSiS->oldChipset = OC_SIS86201; break;
3982 pSiS->oldChipset = OC_SIS86202; break;
3985 if(tempreg & 0x80) pSiS->oldChipset = OC_SIS6205B;
3986 else pSiS->oldChipset = (pSiS->ChipRev == 0x11) ?
3990 pSiS->oldChipset = OC_SIS82204; break;
3992 pSiS->oldChipset = OC_SIS6225; break;
3994 pSiS->oldChipset = OC_SIS5597; break;
3996 pSiS->oldChipset = OC_SIS6326; break;
3999 pSiS->oldChipset = OC_SIS620;
4001 if((pSiS->ChipRev & 0x0f) < 0x0a)
4002 pSiS->oldChipset = OC_SIS530A;
4003 else pSiS->oldChipset = OC_SIS530B;
4007 pSiS->oldChipset = OC_UNKNOWN;
4024 if((pSiS->VGAEngine == SIS_300_VGA) ||
4025 (pSiS->VGAEngine == SIS_315_VGA)) {
4042 if( (((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) &&
4044 ((pSiS->VGAEngine == SIS_OLD_VGA) && (pScrn->bitsPerPixel == 32)) ) {
4096 pSiS->CurrentLayout.bitsPerPixel = pScrn->bitsPerPixel;
4097 pSiS->CurrentLayout.depth = pScrn->depth;
4115 if((pSiS->DualHeadMode) && (pScrn->bitsPerPixel <= 8)) {
4123 pSiS->SiS_Pr->VirtualRomBase = NULL;
4124 pSiS->BIOS = NULL;
4125 pSiS->SiS_Pr->UseROM = FALSE;
4126 pSiS->ROM661New = FALSE;
4127 pSiS->HaveXGIBIOS = FALSE;
4129 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
4133 pSiS->BIOS = pSiSEnt->BIOS;
4134 pSiS->SiS_Pr->VirtualRomBase = pSiS->BIOS;
4135 pSiS->ROM661New = pSiSEnt->ROM661New;
4136 pSiS->HaveXGIBIOS = pSiSEnt->HaveXGIBIOS;
4140 if(!pSiS->BIOS) {
4141 if(!(pSiS->BIOS = calloc(1, BIOS_SIZE))) {
4145 UShort mypciid = pSiS->Chipset;
4146 UShort mypcivendor = (pSiS->ChipFlags & SiSCF_IsXGI) ? PCI_VENDOR_XGI : PCI_VENDOR_SIS;
4150 switch(pSiS->ChipType) {
4171 pSiS->PciInfo->rom_size = biossize;
4172 pci_device_read_rom(pSiS->PciInfo, pSiS->BIOS);
4173 if(SISCheckBIOS(pSiS, mypciid, mypcivendor, biossize)) {
4179 xf86ReadPciBIOS(0, pSiS->PciTag, 0, pSiS->BIOS, biossize);
4180 if(SISCheckBIOS(pSiS, mypciid, mypcivendor, biossize)) {
4190 if(xf86ReadBIOS(segstart, 0, pSiS->BIOS, biossize) != biossize) continue;
4192 if(xf86ReadDomainMemory(pSiS->PciTag, segstart, biossize, pSiS->BIOS) != biossize) continue;
4195 if(!SISCheckBIOS(pSiS, mypciid, mypcivendor, biossize)) continue;
4203 UShort romptr = pSiS->BIOS[0x16] | (pSiS->BIOS[0x17] << 8);
4204 pSiS->SiS_Pr->VirtualRomBase = pSiS->BIOS;
4205 if(pSiS->ChipFlags & SiSCF_IsXGI) {
4206 pSiS->HaveXGIBIOS = pSiS->SiS_Pr->SiS_XGIROM = TRUE;
4207 pSiS->SiS_Pr->UseROM = FALSE;
4208 if(pSiS->ChipFlags & SiSCF_IsXGIV3) {
4209 if(!(pSiS->BIOS[0x1d1] & 0x01)) {
4210 pSiS->SiS_Pr->DDCPortMixup = TRUE;
4214 pSiS->ROM661New = SiSDetermineROMLayout661(pSiS->SiS_Pr);
4218 &pSiS->BIOS[romptr], pSiS->ROM661New ? "new SiS" :
4219 (pSiS->HaveXGIBIOS ? "XGI" : "old SiS"));
4220 if(pSiS->SiS_Pr->DDCPortMixup) {
4228 pSiSEnt->BIOS = pSiS->BIOS;
4229 pSiSEnt->ROM661New = pSiS->ROM661New;
4230 pSiSEnt->HaveXGIBIOS = pSiS->HaveXGIBIOS;
4236 free(pSiS->BIOS);
4237 pSiS->BIOS = NULL;
4242 if(!(pSiS->ChipFlags & SiSCF_IsXGI)) {
4243 if(pSiS->BIOS) pSiS->SiS_Pr->UseROM = TRUE;
4244 else pSiS->SiS_Pr->UseROM = FALSE;
4253 if((pSiS->MergedFB) && (pScrn->bitsPerPixel <= 8)) {
4256 pSiS->MergedFB = pSiS->MergedFBAuto = FALSE;
4262 if(pSiS->DualHeadMode) {
4263 pSiS->CPUFlags = pSiSEnt->CPUFlags;
4266 if(!pSiS->CPUFlags) {
4267 pSiS->CPUFlags = SiSGetCPUFlags(pScrn);
4268 pSiS->CPUFlags |= SIS_CPUFL_FLAG;
4270 if(pSiS->DualHeadMode) pSiSEnt->CPUFlags = pSiS->CPUFlags;
4281 if(pSiS->DualHeadMode) {
4282 if(!pSiS->SecondHead) {
4284 pSiSEnt->HWCursor = pSiS->HWCursor;
4285 pSiSEnt->NoAccel = pSiS->NoAccel;
4286 pSiSEnt->useEXA = pSiS->useEXA;
4287 pSiSEnt->restorebyset = pSiS->restorebyset;
4288 pSiSEnt->OptROMUsage = pSiS->OptROMUsage;
4289 pSiSEnt->OptUseOEM = pSiS->OptUseOEM;
4290 pSiSEnt->TurboQueue = pSiS->TurboQueue;
4291 pSiSEnt->forceCRT1 = pSiS->forceCRT1;
4292 pSiSEnt->ForceCRT1Type = pSiS->ForceCRT1Type;
4293 pSiSEnt->CRT1TypeForced = pSiS->CRT1TypeForced;
4294 pSiSEnt->ForceCRT2Type = pSiS->ForceCRT2Type;
4295 pSiSEnt->ForceTVType = pSiS->ForceTVType;
4296 pSiSEnt->ForceYPbPrType = pSiS->ForceYPbPrType;
4297 pSiSEnt->ForceYPbPrAR = pSiS->ForceYPbPrAR;
4298 pSiSEnt->UsePanelScaler = pSiS->UsePanelScaler;
4299 pSiSEnt->CenterLCD = pSiS->CenterLCD;
4300 pSiSEnt->DSTN = pSiS->DSTN;
4301 pSiSEnt->FSTN = pSiS->FSTN;
4302 pSiSEnt->OptTVStand = pSiS->OptTVStand;
4303 pSiSEnt->NonDefaultPAL = pSiS->NonDefaultPAL;
4304 pSiSEnt->NonDefaultNTSC = pSiS->NonDefaultNTSC;
4305 pSiSEnt->chtvtype = pSiS->chtvtype;
4306 pSiSEnt->OptTVOver = pSiS->OptTVOver;
4307 pSiSEnt->OptTVSOver = pSiS->OptTVSOver;
4308 pSiSEnt->chtvlumabandwidthcvbs = pSiS->chtvlumabandwidthcvbs;
4309 pSiSEnt->chtvlumabandwidthsvideo = pSiS->chtvlumabandwidthsvideo;
4310 pSiSEnt->chtvlumaflickerfilter = pSiS->chtvlumaflickerfilter;
4311 pSiSEnt->chtvchromabandwidth = pSiS->chtvchromabandwidth;
4312 pSiSEnt->chtvchromaflickerfilter = pSiS->chtvchromaflickerfilter;
4313 pSiSEnt->chtvtextenhance = pSiS->chtvtextenhance;
4314 pSiSEnt->chtvcontrast = pSiS->chtvcontrast;
4315 pSiSEnt->chtvcvbscolor = pSiS->chtvcvbscolor;
4316 pSiSEnt->sistvedgeenhance = pSiS->sistvedgeenhance;
4317 pSiSEnt->sistvantiflicker = pSiS->sistvantiflicker;
4318 pSiSEnt->sistvsaturation = pSiS->sistvsaturation;
4319 pSiSEnt->sistvcfilter = pSiS->sistvcfilter;
4320 pSiSEnt->sistvyfilter = pSiS->sistvyfilter;
4321 pSiSEnt->sistvcolcalibc = pSiS->sistvcolcalibc;
4322 pSiSEnt->sistvcolcalibf = pSiS->sistvcolcalibf;
4323 pSiSEnt->tvxpos = pSiS->tvxpos;
4324 pSiSEnt->tvypos = pSiS->tvypos;
4325 pSiSEnt->tvxscale = pSiS->tvxscale;
4326 pSiSEnt->tvyscale = pSiS->tvyscale;
4327 pSiSEnt->siscrt1satgain = pSiS->siscrt1satgain;
4328 pSiSEnt->crt1satgaingiven = pSiS->crt1satgaingiven;
4329 pSiSEnt->CRT1gamma = pSiS->CRT1gamma;
4330 pSiSEnt->CRT1gammaGiven = pSiS->CRT1gammaGiven;
4331 pSiSEnt->XvGammaRed = pSiS->XvGammaRed;
4332 pSiSEnt->XvGammaGreen = pSiS->XvGammaGreen;
4333 pSiSEnt->XvGammaBlue = pSiS->XvGammaBlue;
4334 pSiSEnt->XvGamma = pSiS->XvGamma;
4335 pSiSEnt->XvGammaGiven = pSiS->XvGammaGiven;
4336 pSiSEnt->CRT2gamma = pSiS->CRT2gamma;
4337 pSiSEnt->XvOnCRT2 = pSiS->XvOnCRT2;
4338 pSiSEnt->AllowHotkey = pSiS->AllowHotkey;
4339 pSiSEnt->enablesisctrl = pSiS->enablesisctrl;
4340 pSiSEnt->SenseYPbPr = pSiS->SenseYPbPr;
4341 pSiSEnt->XvUseMemcpy = pSiS->XvUseMemcpy;
4342 pSiSEnt->BenchMemCpy = pSiS->BenchMemCpy;
4348 pSiS->HWCursor = pSiSEnt->HWCursor;
4350 pSiS->NoAccel = pSiSEnt->NoAccel;
4351 pSiS->useEXA = pSiSEnt->useEXA;
4352 pSiS->TurboQueue = pSiSEnt->TurboQueue;
4353 pSiS->restorebyset = pSiSEnt->restorebyset;
4354 pSiS->AllowHotkey = pSiS->AllowHotkey;
4355 pSiS->OptROMUsage = pSiSEnt->OptROMUsage;
4356 pSiS->OptUseOEM = pSiSEnt->OptUseOEM;
4357 pSiS->forceCRT1 = pSiSEnt->forceCRT1;
4358 pSiS->nocrt2ddcdetection = FALSE;
4359 pSiS->forcecrt2redetection = FALSE;
4360 pSiS->ForceCRT1Type = pSiSEnt->ForceCRT1Type;
4361 pSiS->ForceCRT2Type = pSiSEnt->ForceCRT2Type;
4362 pSiS->CRT1TypeForced = pSiSEnt->CRT1TypeForced;
4363 pSiS->UsePanelScaler = pSiSEnt->UsePanelScaler;
4364 pSiS->CenterLCD = pSiSEnt->CenterLCD;
4365 pSiS->DSTN = pSiSEnt->DSTN;
4366 pSiS->FSTN = pSiSEnt->FSTN;
4367 pSiS->OptTVStand = pSiSEnt->OptTVStand;
4368 pSiS->NonDefaultPAL = pSiSEnt->NonDefaultPAL;
4369 pSiS->NonDefaultNTSC = pSiSEnt->NonDefaultNTSC;
4370 pSiS->chtvtype = pSiSEnt->chtvtype;
4371 pSiS->ForceTVType = pSiSEnt->ForceTVType;
4372 pSiS->ForceYPbPrType = pSiSEnt->ForceYPbPrType;
4373 pSiS->ForceYPbPrAR = pSiSEnt->ForceYPbPrAR;
4374 pSiS->OptTVOver = pSiSEnt->OptTVOver;
4375 pSiS->OptTVSOver = pSiSEnt->OptTVSOver;
4376 pSiS->chtvlumabandwidthcvbs = pSiSEnt->chtvlumabandwidthcvbs;
4377 pSiS->chtvlumabandwidthsvideo = pSiSEnt->chtvlumabandwidthsvideo;
4378 pSiS->chtvlumaflickerfilter = pSiSEnt->chtvlumaflickerfilter;
4379 pSiS->chtvchromabandwidth = pSiSEnt->chtvchromabandwidth;
4380 pSiS->chtvchromaflickerfilter = pSiSEnt->chtvchromaflickerfilter;
4381 pSiS->chtvcvbscolor = pSiSEnt->chtvcvbscolor;
4382 pSiS->chtvtextenhance = pSiSEnt->chtvtextenhance;
4383 pSiS->chtvcontrast = pSiSEnt->chtvcontrast;
4384 pSiS->sistvedgeenhance = pSiSEnt->sistvedgeenhance;
4385 pSiS->sistvantiflicker = pSiSEnt->sistvantiflicker;
4386 pSiS->sistvsaturation = pSiSEnt->sistvsaturation;
4387 pSiS->sistvcfilter = pSiSEnt->sistvcfilter;
4388 pSiS->sistvyfilter = pSiSEnt->sistvyfilter;
4389 pSiS->sistvcolcalibc = pSiSEnt->sistvcolcalibc;
4390 pSiS->sistvcolcalibf = pSiSEnt->sistvcolcalibf;
4391 pSiS->tvxpos = pSiSEnt->tvxpos;
4392 pSiS->tvypos = pSiSEnt->tvypos;
4393 pSiS->tvxscale = pSiSEnt->tvxscale;
4394 pSiS->tvyscale = pSiSEnt->tvyscale;
4395 pSiS->SenseYPbPr = pSiSEnt->SenseYPbPr;
4396 if(!pSiS->CRT1gammaGiven) {
4398 pSiS->CRT1gamma = pSiSEnt->CRT1gamma;
4400 pSiS->CRT2gamma = pSiSEnt->CRT2gamma;
4401 if(!pSiS->XvGammaGiven) {
4403 pSiS->XvGamma = pSiSEnt->XvGamma;
4404 pSiS->XvGammaRed = pSiS->XvGammaRedDef = pSiSEnt->XvGammaRed;
4405 pSiS->XvGammaGreen = pSiS->XvGammaGreenDef = pSiSEnt->XvGammaGreen;
4406 pSiS->XvGammaBlue = pSiS->XvGammaBlueDef = pSiSEnt->XvGammaBlue;
4409 if(!pSiS->crt1satgaingiven) {
4411 pSiS->siscrt1satgain = pSiSEnt->siscrt1satgain;
4413 pSiS->XvOnCRT2 = pSiSEnt->XvOnCRT2;
4414 pSiS->enablesisctrl = pSiSEnt->enablesisctrl;
4415 pSiS->XvUseMemcpy = pSiSEnt->XvUseMemcpy;
4416 pSiS->BenchMemCpy = pSiSEnt->BenchMemCpy;
4418 pSiSEnt->GammaBriR = pSiS->GammaBriR;
4419 pSiSEnt->GammaBriG = pSiS->GammaBriG;
4420 pSiSEnt->GammaBriB = pSiS->GammaBriB;
4421 pSiSEnt->NewGammaBriR = pSiS->NewGammaBriR;
4422 pSiSEnt->NewGammaBriG = pSiS->NewGammaBriG;
4423 pSiSEnt->NewGammaBriB = pSiS->NewGammaBriB;
4424 pSiSEnt->NewGammaConR = pSiS->NewGammaConR;
4425 pSiSEnt->NewGammaConG = pSiS->NewGammaConG;
4426 pSiSEnt->NewGammaConB = pSiS->NewGammaConB;
4435 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
4437 if(pSiS->OptROMUsage == 0) {
4438 pSiS->SiS_Pr->UseROM = FALSE;
4443 if(!pSiS->OptUseOEM) {
4447 pSiS->SiS_Pr->UsePanelScaler = pSiS->UsePanelScaler;
4448 pSiS->SiS_Pr->CenterScreen = pSiS->CenterLCD;
4455 if(pSiS->pEnt->device->MemBase != 0) {
4460 pSiS->FbAddress = pSiS->pEnt->device->MemBase;
4463 pSiS->FbAddress = PCI_REGION_BASE(pSiS->PciInfo, 0, REGION_MEM) & 0xFFFFFFF0;
4468 if(pSiS->DualHeadMode)
4470 (ULong)pSiS->FbAddress);
4474 (ULong)pSiS->FbAddress);
4476 pSiS->realFbAddress = pSiS->FbAddress;
4479 if(pSiS->pEnt->device->IOBase != 0) {
4484 pSiS->IOAddress = pSiS->pEnt->device->IOBase;
4487 pSiS->IOAddress = PCI_REGION_BASE(pSiS->PciInfo, 1, REGION_MEM) & 0xFFFFFFF0;
4491 (ULong)pSiS->IOAddress, pSiS->mmioSize);
4495 if(xf86RegisterResources(pSiS->pEnt->index, NULL, ResExclusive)) {
4500 sisRestoreExtRegisterLock(pSiS,srlockReg,crlockReg);
4501 if(pSiS->pInt) xf86FreeInt10(pSiS->pInt);
4508 if(pSiS->pEnt->device->videoRam != 0) {
4509 if(pSiS->Chipset == PCI_CHIP_SIS6326) {
4510 pScrn->videoRam = pSiS->pEnt->device->videoRam;
4518 pSiS->RealVideoRam = pScrn->videoRam;
4520 if((pSiS->Chipset == PCI_CHIP_SIS6326) &&
4526 pSiS->RealVideoRam, pScrn->videoRam);
4531 if((pSiS->Chipset == PCI_CHIP_SIS6326) &&
4537 pSiS->TurboQueue = FALSE;
4538 pSiS->HWCursor = FALSE;
4539 pSiS->NoXvideo = TRUE;
4540 pSiS->NoAccel = TRUE;
4543 pSiS->FbMapSize = pSiS->availMem = pScrn->videoRam * 1024;
4549 pSiS->cursorOffset = 0;
4550 pSiS->CurARGBDest = NULL;
4551 pSiS->CurMonoSrc = NULL;
4552 pSiS->CurFGCol = pSiS->CurBGCol = 0;
4553 pSiS->FbBaseOffset = 0;
4555 switch(pSiS->VGAEngine) {
4558 pSiS->TurboQueueLen = 512;
4559 if(pSiS->TurboQueue) {
4560 pSiS->availMem -= (pSiS->TurboQueueLen*1024);
4561 pSiS->cursorOffset = 512;
4563 if(pSiS->HWCursor) {
4564 pSiS->availMem -= pSiS->CursorSize;
4565 if(pSiS->OptUseColorCursor) pSiS->availMem -= pSiS->CursorSize;
4567 pSiS->CmdQueLenMask = 0xFFFF;
4568 pSiS->CmdQueLenFix = 0;
4569 pSiS->cursorBufferNum = 0;
4577 pSiS->cmdQueueSizeMask = pSiS->cmdQueueSize - 1; /* VRAM Command Queue is variable (in therory) */
4578 pSiS->cmdQueueOffset = (pScrn->videoRam * 1024) - pSiS->cmdQueueSize;
4579 pSiS->cmdQueueLen = 0;
4580 pSiS->cmdQueueSize_div2 = pSiS->cmdQueueSize / 2;
4581 pSiS->cmdQueueSize_div4 = pSiS->cmdQueueSize / 4;
4582 pSiS->cmdQueueSize_4_3 = (pSiS->cmdQueueSize / 4) * 3;
4583 pSiS->availMem -= pSiS->cmdQueueSize;
4584 pSiS->cursorOffset = (pSiS->cmdQueueSize / 1024);
4588 if(pSiS->DualHeadMode)
4589 pSiS->cmdQ_SharedWritePort = &(pSiSEnt->cmdQ_SharedWritePort_2D);
4592 pSiS->cmdQ_SharedWritePort = &(pSiS->cmdQ_SharedWritePort_2D);
4596 if(pSiS->TurboQueue) {
4597 pSiS->availMem -= (512*1024); /* MMIO Command Queue is 512k (variable in theory) */
4598 pSiS->cursorOffset = 512;
4601 if(pSiS->HWCursor) {
4602 pSiS->availMem -= (pSiS->CursorSize * 2);
4603 if(pSiS->OptUseColorCursor) pSiS->availMem -= (pSiS->CursorSize * 2);
4605 pSiS->cursorBufferNum = 0;
4610 if((pSiS->SiS76xLFBSize) && (pSiS->SiS76xUMASize)) {
4611 pSiS->availMem -= pSiS->SiS76xUMASize;
4612 pSiS->FbBaseOffset = pSiS->SiS76xUMASize;
4630 if(pSiS->RealVideoRam < 3072) {
4631 if(pSiS->TurboQueue) {
4634 pSiS->TurboQueue = FALSE;
4637 pSiS->CmdQueMaxLen = 32;
4638 if(pSiS->TurboQueue) {
4639 pSiS->availMem -= (64*1024);
4640 pSiS->CmdQueMaxLen = 900; /* To make sure; should be 992 */
4641 } else if(pSiS->HWCursor) {
4642 pSiS->availMem -= pSiS->CursorSize;
4644 if(pSiS->Chipset == PCI_CHIP_SIS530) {
4647 if(!(tempreg & 0x04)) pSiS->availMem -= pSiS->CursorSize;
4650 pSiS->CmdQueLenMask = (pSiS->TurboQueue) ? 0x1FFF : 0x00FF;
4660 pSiS->CmdQueLenMask = (pSiS->TurboQueue) ? 0x7FFF : 0x003F;
4666 pSiS->CmdQueLenFix = (pSiS->TurboQueue) ? 32 : 0;
4675 if(pSiS->DualHeadMode) pSiS->availMem &= 0xFFFFE000;
4680 if(pSiS->DualHeadMode) {
4684 if(pSiS->maxxfbmem) {
4688 pSiS->maxxfbmem = pSiS->availMem;
4691 if((pSiS->sisfbHeapStart) || (pSiS->sisfbHaveNewHeapDef)) {
4696 if(pSiS->maxxfbmem) {
4700 if((pSiS->FbBaseOffset) && (!pSiS->sisfbHaveNewHeapDef)) {
4703 pSiS->loadDRI = FALSE;
4704 pSiS->maxxfbmem = pSiS->availMem;
4706 if(pSiS->FbBaseOffset) {
4708 pSiS->availMem += pSiS->FbBaseOffset;
4709 pSiS->FbBaseOffset = 0;
4711 if(pSiS->sisfbVideoOffset) {
4713 pSiS->FbBaseOffset = pSiS->sisfbVideoOffset;
4714 pSiS->availMem -= pSiS->FbBaseOffset;
4715 pSiS->maxxfbmem = pSiS->availMem;
4718 if(pSiS->availMem < (pSiS->sisfbHeapStart * 1024)) {
4721 pSiS->loadDRI = FALSE;
4722 pSiS->maxxfbmem = pSiS->availMem;
4724 pSiS->maxxfbmem = pSiS->sisfbHeapStart * 1024;
4729 } else if(pSiS->maxxfbmem) {
4734 if(pSiS->FbBaseOffset) {
4736 if(pSiS->maxxfbmem > (pSiS->availMem + pSiS->FbBaseOffset - pSiS->SiS76xUMASize)) {
4739 pSiS->maxxfbmem = pSiS->availMem;
4742 pSiS->availMem += pSiS->FbBaseOffset;
4744 pSiS->FbBaseOffset = pSiS->availMem - pSiS->maxxfbmem;
4745 pSiS->availMem -= pSiS->FbBaseOffset;
4749 if(pSiS->maxxfbmem > pSiS->availMem) {
4752 pSiS->maxxfbmem = pSiS->availMem;
4761 pSiS->maxxfbmem = pSiS->availMem;
4768 if(pSiS->loadDRI) {
4769 if(pSiS->FbBaseOffset) {
4777 unsigned long total = (pSiS->SiS76xLFBSize + pSiS->SiS76xUMASize) / 1024;
4789 if(pSiS->availMem > mymax) {
4791 pSiS->maxxfbmem = mymax;
4793 pSiS->availMem += pSiS->FbBaseOffset;
4795 pSiS->FbBaseOffset = pSiS->availMem - pSiS->maxxfbmem;
4796 pSiS->availMem -= pSiS->FbBaseOffset;
4806 pSiS->loadDRI = FALSE;
4808 pSiS->maxxfbmem = 4096 * 1024;
4810 pSiS->maxxfbmem = 8192 * 1024;
4812 else if(pSiS->MergedFB) {
4814 pSiS->maxxfbmem = 16384 * 1024; /* If MergedFB and <=64MB, use 16MB for X */
4816 pSiS->maxxfbmem = 20 * 1024 * 1024; /* If MergedFB and > 64MB, use 20MB for X */
4819 else if(pSiS->VGAEngine == SIS_315_VGA) {
4821 pSiS->maxxfbmem = 16384 * 1024; /* On >=315 series and <=64MB, use 16MB */
4823 pSiS->maxxfbmem = 20 * 1024 * 1024; /* On >=315 series and > 64MB, use 20MB */
4825 pSiS->maxxfbmem = 12288 * 1024; /* On <315 series, use 12MB */
4828 if(pSiS->maxxfbmem > pSiS->availMem) {
4829 pSiS->maxxfbmem = pSiS->availMem;
4830 pSiS->loadDRI = FALSE;
4838 pSiS->maxxfbmem / 1024, pSiS->FbBaseOffset / 1024);
4843 if(pSiS->VGAEngine == SIS_300_VGA ||
4844 pSiS->VGAEngine == SIS_315_VGA ||
4845 pSiS->Chipset == PCI_CHIP_SIS530 ||
4846 pSiS->Chipset == PCI_CHIP_SIS6326 ||
4847 pSiS->Chipset == PCI_CHIP_SIS5597) {
4848 pSiS->hasTwoOverlays = FALSE;
4849 switch(pSiS->Chipset) {
4854 pSiS->hasTwoOverlays = TRUE;
4855 pSiS->SiS_SD_Flags |= SiS_SD_SUPPORT2OVL;
4858 pSiS->ChipFlags |= SiSCF_LARGEOVERLAY;
4861 pSiS->ChipFlags |= (SiSCF_CRT2HWCKaputt | SiSCF_LARGEOVERLAY);
4865 pSiS->ChipFlags |= SiSCF_LARGEOVERLAY;
4876 pSiS->ChipFlags |= SiSCF_LARGEOVERLAY;
4877 if(pSiS->ChipType == SIS_650) {
4890 pSiS->hasTwoOverlays = TRUE; /* M650 or 651 */
4891 pSiS->SiS_SD_Flags |= SiS_SD_SUPPORT2OVL;
4897 pSiS->ChipFlags |= SiSCF_Is651;
4902 pSiS->ChipFlags |= SiSCF_IsM650;
4906 pSiS->hasTwoOverlays = TRUE;
4907 pSiS->SiS_SD_Flags |= SiS_SD_SUPPORT2OVL;
4914 pSiS->ChipFlags |= SiSCF_IsM652;
4919 pSiS->ChipFlags |= SiSCF_IsM653;
4924 pSiS->ChipFlags |= SiSCF_IsM650;
4931 pSiS->ChipFlags |= SiSCF_Is652;
4936 pSiS->ChipFlags |= SiSCF_IsM650;
4947 pSiS->ChipFlags |= SiSCF_LARGEOVERLAY;
4948 pSiS->hasTwoOverlays = TRUE;
4949 pSiS->SiS_SD_Flags |= SiS_SD_SUPPORT2OVL;
4962 if(!(pSiS->SiS_SD2_Flags & SiS_SD2_NOOVERLAY)) {
4965 pSiS->hasTwoOverlays ? "two" : "one",
4966 pSiS->hasTwoOverlays ? "s" : "");
4969 if(pSiS->SiS_SD2_Flags & SiS_SD2_SUPPORT760OO) {
4982 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
4983 inSISIDXREG(SISSR, 0x1f, pSiS->oldSR1F);
4984 inSISIDXREG(SISCR, 0x17, pSiS->oldCR17);
4985 inSISIDXREG(SISCR, 0x32, pSiS->oldCR32);
4986 inSISIDXREG(SISCR, 0x36, pSiS->oldCR36);
4987 inSISIDXREG(SISCR, 0x37, pSiS->oldCR37);
4988 if(pSiS->VGAEngine == SIS_315_VGA) {
4989 inSISIDXREG(SISCR, pSiS->myCR63, pSiS->oldCR63);
4992 pSiS->postVBCR32 = pSiS->oldCR32;
5003 pSiS->SiS_Pr->SiS_ChSW = FALSE;
5004 if(pSiS->Chipset == PCI_CHIP_SIS630) {
5007 if(mychswtable[i].subsysVendor == PCI_SUB_VENDOR_ID(pSiS->PciInfo) &&
5008 mychswtable[i].subsysCard == PCI_SUB_DEVICE_ID(pSiS->PciInfo)) {
5015 PCI_SUB_DEVICE_ID(pSiS->PciInfo));
5016 pSiS->SiS_Pr->SiS_ChSW = TRUE;
5023 if(pSiS->SiS_Pr->SiS_CustomT == CUT_NONE) {
5029 if(pSiS->SiS_Pr->UseROM) {
5030 bversptr = pSiS->BIOS[0x16] | (pSiS->BIOS[0x17] << 8);
5031 for(i=0; i<32768; i++) chksum += pSiS->BIOS[i];
5036 if( (SiS_customttable[i].chipID == pSiS->ChipType) &&
5038 (pSiS->SiS_Pr->UseROM &&
5039 (!strncmp(SiS_customttable[i].biosversion, (char *)&pSiS->BIOS[bversptr],
5042 (pSiS->SiS_Pr->UseROM &&
5043 (!strncmp(SiS_customttable[i].biosdate, (char *)&pSiS->BIOS[0x2c],
5046 (pSiS->SiS_Pr->UseROM &&
5048 (SiS_customttable[i].pcisubsysvendor == PCI_SUB_VENDOR_ID(pSiS->PciInfo)) &&
5049 (SiS_customttable[i].pcisubsyscard == PCI_SUB_DEVICE_ID(pSiS->PciInfo)) ) {
5053 if(pSiS->SiS_Pr->UseROM) {
5054 if(pSiS->BIOS[SiS_customttable[i].biosFootprintAddr[j]] !=
5064 pSiS->SiS_Pr->SiS_CustomT = SiS_customttable[i].SpecialID;
5073 if(pSiS->forceCRT1 != -1) {
5074 if(pSiS->forceCRT1) pSiS->CRT1off = 0;
5075 else pSiS->CRT1off = 1;
5076 } else pSiS->CRT1off = -1;
5088 if(pSiS->ForceCRT1Type == CRT1_LCDA) {
5092 pSiS->ForceCRT1Type = CRT1_VGA;
5093 } else if(!(pSiS->VBFlags & CRT2_LCD)) {
5096 pSiS->ForceCRT1Type = CRT1_VGA;
5101 pSiS->SiS_SD_Flags |= SiS_SD_ADDLSUPFLAG;
5103 pSiS->SiS_SD2_Flags |= SiS_SD2_MERGEDUCLOCK;
5104 pSiS->SiS_SD2_Flags |= SiS_SD2_USEVBFLAGS2;
5105 pSiS->SiS_SD2_Flags |= SiS_SD2_VBINVB2ONLY;
5106 pSiS->SiS_SD2_Flags |= SiS_SD2_HAVESD34;
5107 pSiS->SiS_SD2_Flags |= SiS_SD2_NEWGAMMABRICON;
5109 pSiS->SiS_SD3_Flags |= SiS_SD3_MFBALLOWOFFCL;
5111 if(pSiS->VBFlags2 & VB2_VIDEOBRIDGE) {
5112 pSiS->SiS_SD2_Flags |= SiS_SD2_VIDEOBRIDGE;
5113 if(pSiS->VBFlags2 & VB2_SISBRIDGE) {
5114 pSiS->SiS_SD2_Flags |= ( SiS_SD2_SISBRIDGE |
5116 if(pSiS->VBFlags2 & VB2_SISLVDSBRIDGE) {
5117 pSiS->SiS_SD2_Flags |= ( SiS_SD2_LCDLVDS |
5119 } else if(pSiS->VBFlags2 & VB2_SISTMDSBRIDGE) {
5120 if(!(pSiS->VBFlags2 & VB2_30xBDH)) {
5121 pSiS->SiS_SD2_Flags |= ( SiS_SD2_LCDTMDS |
5123 } else if(pSiS->VBFlags & CRT2_LCD) {
5124 pSiS->SiS_SD2_Flags |= ( SiS_SD2_THIRDPARTYLVDS |
5128 } else if(pSiS->VBFlags2 & VB2_LVDS) {
5129 pSiS->SiS_SD2_Flags |= ( SiS_SD2_THIRDPARTYLVDS |
5133 if(pSiS->VBFlags2 & (VB2_SISTVBRIDGE | VB2_CHRONTEL)) {
5134 pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTTV;
5135 if(pSiS->VBFlags2 & VB2_SISBRIDGE) {
5136 pSiS->SiS_SD2_Flags |= ( SiS_SD2_SUPPORTTVTYPE |
5138 if(!(pSiS->VBFlags2 & VB2_301)) {
5139 pSiS->SiS_SD2_Flags |= SiS_SD2_SUPPTVSAT;
5141 pSiS->SiS_SD2_Flags |= SiS_SD2_SUPPTVEDGE;
5148 if((pSiS->VGAEngine == SIS_315_VGA) &&
5149 (pSiS->VBFlags2 & VB2_SISYPBPRBRIDGE)) {
5150 pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTYPBPR;
5151 pSiS->SiS_SD2_Flags |= SiS_SD2_SUPPORT625I;
5152 pSiS->SiS_SD2_Flags |= SiS_SD2_SUPPORT625P;
5153 if(pSiS->VBFlags2 & VB2_SISYPBPRARBRIDGE) {
5154 pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTYPBPRAR;
5157 if(pSiS->VBFlags2 & VB2_SISHIVISIONBRIDGE) {
5158 pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTHIVISION;
5162 if((pSiS->VGAEngine != SIS_300_VGA) || (!(pSiS->VBFlags2 & VB2_TRUMPION))) {
5163 pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTSCALE;
5164 if((pSiS->VBFlags2 & VB2_SISTMDSBRIDGE) &&
5165 (!(pSiS->VBFlags2 & VB2_30xBDH))) {
5166 pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTCENTER;
5171 if(!pSiS->DualHeadMode) {
5172 pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTREDETECT;
5177 pSiS->SiS_SD2_Flags |= SiS_SD2_NEEDUSESSE;
5181 pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTYPBPRAR;
5194 if(!(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPR)) {
5195 if((pSiS->ForceTVType != -1) && (pSiS->ForceTVType & TV_YPBPR)) {
5196 pSiS->ForceTVType = -1;
5201 if(!(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTHIVISION)) {
5202 if((pSiS->ForceTVType != -1) && (pSiS->ForceTVType & TV_HIVISION)) {
5203 pSiS->ForceTVType = -1;
5208 if((pSiS->VBFlags2 & VB2_SISTVBRIDGE) ||
5209 ((pSiS->VBFlags2 & VB2_CHRONTEL) && (pSiS->ChrontelType == CHRONTEL_701x))) {
5210 pSiS->SiS_SD_Flags |= (SiS_SD_SUPPORTPALMN | SiS_SD_SUPPORTNTSCJ);
5212 if((pSiS->VBFlags2 & VB2_SISTVBRIDGE) ||
5213 ((pSiS->VBFlags2 & VB2_CHRONTEL) && (pSiS->ChrontelType == CHRONTEL_700x))) {
5214 pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTTVPOS;
5216 if(pSiS->VBFlags2 & VB2_SISVGA2BRIDGE) {
5217 pSiS->SiS_SD_Flags |= (SiS_SD_SUPPORTSCART | SiS_SD_SUPPORTVGA2);
5219 if(pSiS->VBFlags2 & VB2_CHRONTEL) {
5220 pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTOVERSCAN;
5221 pSiS->SiS_SD2_Flags |= SiS_SD2_CHRONTEL;
5222 if(pSiS->ChrontelType == CHRONTEL_700x) {
5223 pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTSOVER;
5228 pSiS->SiS_SD_Flags &= ~SiS_SD_SUPPORTLCDA;
5230 pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTLCDA;
5244 if((pSiS->SiS_SD_Flags & SiS_SD_SUPPORTLCDA) &&
5245 (pSiS->VBFlags & CRT2_LCD) &&
5246 (pSiS->SiS_Pr->SiS_CustomT != CUT_UNKNOWNLCD)) {
5247 if((!pSiS->CRT1TypeForced) && (pSiS->ForceCRT2Type == CRT2_DEFAULT)) {
5248 if(pSiS->VBFlags & CRT2_TV) {
5250 pSiS->ForceCRT1Type = CRT1_LCDA;
5251 pSiS->ForceCRT2Type = CRT2_TV;
5252 } else if(pSiS->LCDwidth > 1600) {
5256 if(pSiS->DualHeadMode) NeedCRT1VGA = TRUE;
5259 if(pSiS->MergedFB &&
5260 (!pSiS->MergedFBAuto || pSiS->CRT1Detected)) NeedCRT1VGA = TRUE;
5263 pSiS->ForceCRT1Type = CRT1_LCDA;
5270 if(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTLCDA) {
5271 if(pSiS->ForceCRT1Type == CRT1_LCDA) {
5272 if(pSiS->VBFlags2 & VB2_SISTMDSLCDABRIDGE) {
5273 if(!(pSiS->VBLCDFlags)) {
5275 pSiS->detectedCRT2Devices |= CRT2_LCD;
5277 } else if(!(pSiS->VBLCDFlags)) {
5278 pSiS->ForceCRT1Type = CRT1_VGA;
5282 pSiS->ForceCRT1Type = CRT1_VGA;
5285 pSiS->VBFlags |= pSiS->ForceCRT1Type;
5288 xf86DrvMsg(0, X_INFO, "SDFlags %lx\n", pSiS->SiS_SD_Flags);
5296 if(pSiS->ForceCRT2Type == CRT2_DEFAULT) {
5297 if((pSiS->VBFlags & CRT2_TV) && (!((pSiS->VBFlags2 & VB2_CHRONTEL) && (pSiS->VGAEngine == SIS_300_VGA))))
5298 pSiS->ForceCRT2Type = CRT2_TV;
5299 else if((pSiS->VBFlags & CRT2_LCD) && (pSiS->ForceCRT1Type == CRT1_VGA))
5300 pSiS->ForceCRT2Type = CRT2_LCD;
5301 else if(pSiS->VBFlags & CRT2_TV)
5302 pSiS->ForceCRT2Type = CRT2_TV;
5303 else if((pSiS->VBFlags & CRT2_VGA) && (pSiS->ForceCRT1Type == CRT1_VGA))
5304 pSiS->ForceCRT2Type = CRT2_VGA;
5307 switch(pSiS->ForceCRT2Type) {
5309 pSiS->VBFlags &= ~(CRT2_LCD | CRT2_VGA);
5310 if(pSiS->VBFlags2 & (VB2_SISTVBRIDGE | VB2_CHRONTEL)) {
5311 pSiS->VBFlags |= CRT2_TV;
5313 pSiS->VBFlags &= ~(CRT2_TV);
5319 pSiS->VBFlags &= ~(CRT2_TV | CRT2_VGA);
5320 if((pSiS->VBFlags2 & VB2_VIDEOBRIDGE) && (pSiS->VBLCDFlags)) {
5321 pSiS->VBFlags |= CRT2_LCD;
5322 } else if((pSiS->VBFlags2 & VB2_SISTMDSBRIDGE) && (!(pSiS->VBFlags2 & VB2_30xBDH))) {
5324 pSiS->detectedCRT2Devices |= CRT2_LCD;
5326 pSiS->VBFlags &= ~(CRT2_LCD);
5332 pSiS->VBFlags &= ~(CRT2_TV | CRT2_LCD);
5333 if(pSiS->VBFlags2 & VB2_SISVGA2BRIDGE) {
5334 pSiS->VBFlags |= CRT2_VGA;
5336 pSiS->VBFlags &= ~(CRT2_VGA);
5342 pSiS->VBFlags &= ~(CRT2_TV | CRT2_LCD | CRT2_VGA);
5353 if((!pSiS->DualHeadMode) || (pSiS->SecondHead)) {
5355 xf86DrvMsg(pScrn->scrnIndex, pSiS->CRT1gammaGiven ? X_CONFIG : X_INFO,
5357 (pSiS->VBFlags2 & VB2_VIDEOBRIDGE) ? "CRT1 g" : "G",
5358 pSiS->CRT1gamma ? "enabled" : "disabled");
5360 if((pSiS->VGAEngine == SIS_315_VGA) &&
5361 (!(pSiS->NoXvideo)) &&
5362 (!(pSiS->SiS_SD2_Flags & SiS_SD2_NOOVERLAY))) {
5363 xf86DrvMsg(pScrn->scrnIndex, pSiS->XvGammaGiven ? X_CONFIG : X_INFO,
5365 (pSiS->VBFlags2 & VB2_VIDEOBRIDGE) ? "for CRT1 " : "",
5366 pSiS->XvGamma ? "enabled" : "disabled");
5367 if(pSiS->XvGamma) {
5368 xf86DrvMsg(pScrn->scrnIndex, pSiS->XvGammaGiven ? X_CONFIG : X_INFO,
5370 (float)((float)pSiS->XvGammaRed / 1000),
5371 (float)((float)pSiS->XvGammaGreen / 1000),
5372 (float)((float)pSiS->XvGammaBlue / 1000));
5373 if(!pSiS->CRT1gamma) {
5376 (pSiS->VBFlags2 & VB2_VIDEOBRIDGE) ? "CRT1 g" : "G");
5385 if(pSiS->DualHeadMode) pSiS->CRT2SepGamma = FALSE;
5389 if((!pSiS->DualHeadMode) || (!pSiS->SecondHead))
5393 if(pSiS->CRT2gamma) {
5394 if( ((pSiS->VGAEngine != SIS_300_VGA) && (pSiS->VGAEngine != SIS_315_VGA)) ||
5395 (!(pSiS->VBFlags2 & VB2_SISBRIDGE)) ) {
5396 if(pSiS->VBFlags2 & VB2_VIDEOBRIDGE) {
5400 pSiS->CRT2gamma = pSiS->CRT2SepGamma = FALSE;
5401 } else if((pSiS->VBFlags2 & VB2_30xBDH) && (pSiS->VBFlags & CRT2_LCD)) {
5408 if(pSiS->VBFlags2 & VB2_SISBRIDGE) {
5410 pSiS->CRT2gamma ? "enabled" : "disabled",
5412 pSiS->CRT2SepGamma ? " (separate from CRT1)" : "");
5417 if(pSiS->VBFlags2 & VB2_SISTVBRIDGE) {
5418 if(pSiS->ForceTVType != -1) {
5419 pSiS->VBFlags &= ~(TV_INTERFACE);
5420 if(!(pSiS->VBFlags2 & VB2_CHRONTEL)) {
5421 pSiS->VBFlags &= ~(TV_CHSCART | TV_CHYPBPR525I);
5423 pSiS->VBFlags |= pSiS->ForceTVType;
5424 if(pSiS->VBFlags & TV_YPBPR) {
5425 pSiS->VBFlags &= ~(TV_STANDARD);
5426 pSiS->VBFlags &= ~(TV_YPBPRAR);
5427 pSiS->VBFlags |= pSiS->ForceYPbPrType;
5428 pSiS->VBFlags |= pSiS->ForceYPbPrAR;
5434 pSiS->CRT1changed = FALSE;
5435 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
5436 usScratchCR17 = pSiS->oldCR17;
5437 usScratchCR63 = pSiS->oldCR63;
5438 usScratchSR1F = pSiS->oldSR1F;
5439 usScratchCR32 = pSiS->postVBCR32;
5440 if(pSiS->VESA != 1) {
5444 if( (pSiS->forceCRT1 != -1) &&
5445 (!(pSiS->DualHeadMode && pSiS->SecondHead)) ) {
5447 if(pSiS->forceCRT1 != -1) {
5451 if(pSiS->forceCRT1) {
5452 pSiS->CRT1off = 0;
5453 if(pSiS->VGAEngine == SIS_300_VGA) {
5454 if(!(usScratchCR17 & 0x80)) pSiS->CRT1changed = TRUE;
5456 if(usScratchCR63 & 0x40) pSiS->CRT1changed = TRUE;
5464 ( (pSiS->VBFlags2 & (VB2_LVDS | VB2_CHRONTEL)) ||
5465 ((pSiS->VBFlags2 & VB2_30xBDH) && (pSiS->VBFlags & CRT2_LCD)) ) ) ) {
5466 pSiS->CRT1off = 1;
5467 if(pSiS->VGAEngine == SIS_300_VGA) {
5468 if(usScratchCR17 & 0x80) pSiS->CRT1changed = TRUE;
5470 if(!(usScratchCR63 & 0x40)) pSiS->CRT1changed = TRUE;
5480 if(pSiS->VGAEngine == SIS_315_VGA) {
5481 outSISIDXREG(SISCR, pSiS->myCR63, usScratchCR63);
5484 if(pSiS->CRT1changed) {
5495 pSiS->newCR32 = usScratchCR32;
5499 if(pSiS->VBFlags2 & VB2_VIDEOBRIDGE) {
5504 if( (!(pSiS->VBFlags & (CRT2_VGA | CRT2_LCD | CRT2_TV))) ||
5506 ( (pSiS->VBFlags2 & (VB2_LVDS | VB2_CHRONTEL)) ||
5507 ((pSiS->VBFlags2 & VB2_30xBDH) && (pSiS->VBFlags & CRT2_LCD)) ) ) ) {
5508 pSiS->CRT1off = 0;
5511 if(!(pSiS->VBFlags & (CRT2_VGA | CRT2_LCD | CRT2_TV))) {
5512 pSiS->XvOnCRT2 = FALSE;
5517 pSiS->CRT1off = 0;
5519 pSiS->XvOnCRT2 = FALSE;
5523 if(pSiS->VBFlags & CRT1_LCDA) pSiS->CRT1off = 0;
5526 if((pSiS->NonDefaultPAL != -1) || (pSiS->NonDefaultNTSC != -1)) {
5527 if( (!(pSiS->VBFlags2 & VB2_SISTVBRIDGE)) &&
5528 (!((pSiS->VBFlags2 & VB2_CHRONTEL)) && (pSiS->ChrontelType == CHRONTEL_701x)) ) {
5531 pSiS->NonDefaultPAL = pSiS->NonDefaultNTSC = -1;
5532 pSiS->VBFlags &= ~(TV_PALN | TV_PALM | TV_NTSCJ);
5533 pSiS->SiS_SD_Flags &= ~(SiS_SD_SUPPORTPALMN | SiS_SD_SUPPORTNTSCJ);
5536 if(pSiS->OptTVStand != -1) {
5537 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
5538 if( (!((pSiS->VBFlags2 & VB2_CHRONTEL) && (pSiS->VBFlags & (TV_CHSCART | TV_CHYPBPR525I)))) &&
5539 (!(pSiS->VBFlags & (TV_HIVISION | TV_YPBPR))) ) {
5540 pSiS->VBFlags &= ~(TV_PAL | TV_NTSC | TV_PALN | TV_PALM | TV_NTSCJ);
5541 if(pSiS->OptTVStand) {
5542 pSiS->VBFlags |= TV_PAL;
5543 if(pSiS->NonDefaultPAL == 1) pSiS->VBFlags |= TV_PALM;
5544 else if(!pSiS->NonDefaultPAL) pSiS->VBFlags |= TV_PALN;
5546 pSiS->VBFlags |= TV_NTSC;
5547 if(pSiS->NonDefaultNTSC == 1) pSiS->VBFlags |= TV_NTSCJ;
5550 pSiS->OptTVStand = pSiS->NonDefaultPAL = -1;
5554 } else if(pSiS->Chipset == PCI_CHIP_SIS6326) {
5555 pSiS->SiS6326Flags &= ~SIS6326_TVPAL;
5556 if(pSiS->OptTVStand) pSiS->SiS6326Flags |= SIS6326_TVPAL;
5560 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
5562 if(pSiS->VBFlags & (TV_SVIDEO | TV_AVIDEO)) {
5563 if(!(pSiS->VBFlags & (TV_PAL | TV_NTSC))) {
5564 pSiS->VBFlags &= ~(TV_PAL | TV_NTSC | TV_PALN | TV_PALM | TV_NTSCJ);
5565 pSiS->VBFlags |= TV_PAL;
5569 if((pSiS->VBFlags2 & VB2_SISBRIDGE) && (pSiS->VBFlags & TV_SCART)) {
5570 pSiS->VBFlags &= ~(TV_NTSC | TV_PALN | TV_PALM | TV_NTSCJ);
5571 pSiS->VBFlags |= TV_PAL;
5572 pSiS->OptTVStand = 1;
5573 pSiS->NonDefaultPAL = pSiS->NonDefaultNTSC = -1;
5581 if((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV)) {
5582 if(pSiS->sis6326tvplug != -1) {
5583 pSiS->SiS6326Flags &= ~(SIS6326_TVSVIDEO | SIS6326_TVCVBS);
5584 pSiS->SiS6326Flags |= SIS6326_TVDETECTED;
5585 if(pSiS->sis6326tvplug == 1) pSiS->SiS6326Flags |= SIS6326_TVCVBS;
5586 else pSiS->SiS6326Flags |= SIS6326_TVSVIDEO;
5589 (pSiS->SiS6326Flags & SIS6326_TVCVBS) ? "COMPOSITE" : "SVIDEO");
5594 if(pSiS->OptTVOver != -1) {
5595 if(pSiS->VBFlags2 & VB2_CHRONTEL) {
5596 pSiS->UseCHOverScan = pSiS->OptTVOver;
5600 pSiS->UseCHOverScan = -1;
5602 } else pSiS->UseCHOverScan = -1;
5604 if(pSiS->sistvedgeenhance != -1) {
5605 if(!(pSiS->VBFlags2 & VB2_301)) {
5608 pSiS->sistvedgeenhance = -1;
5611 if(pSiS->sistvsaturation != -1) {
5612 if(pSiS->VBFlags2 & VB2_301) {
5615 pSiS->sistvsaturation = -1;
5621 if(pSiS->MergedFB) {
5622 pSiS->CRT2pScrn = malloc(sizeof(ScrnInfoRec));
5623 if(!pSiS->CRT2pScrn) {
5625 pSiS->MergedFB = FALSE;
5627 memcpy(pSiS->CRT2pScrn, pScrn, sizeof(ScrnInfoRec));
5638 if(pSiS->VBFlags & DISPTYPE_DISP2) {
5639 if(pSiS->CRT1off) { /* CRT2 only ------------------------------- */
5641 if(pSiS->DualHeadMode) {
5649 if(pSiS->MergedFB) {
5650 if(pSiS->MergedFBAuto) {
5655 if(pSiS->CRT2pScrn) free(pSiS->CRT2pScrn);
5656 pSiS->CRT2pScrn = NULL;
5657 pSiS->MergedFB = FALSE;
5660 pSiS->VBFlags |= VB_DISPMODE_SINGLE;
5662 pSiS->XvOnCRT2 = TRUE;
5665 if(pSiS->DualHeadMode) {
5666 pSiS->VBFlags |= (VB_DISPMODE_DUAL | DISPTYPE_CRT1);
5667 if(pSiS->VESA != -1) {
5672 pSiS->VESA = 0;
5676 if(pSiS->MergedFB) {
5677 pSiS->VBFlags |= (VB_DISPMODE_MIRROR | DISPTYPE_CRT1);
5678 if(pSiS->VESA != -1) {
5682 pSiS->VESA = 0;
5685 pSiS->VBFlags |= (VB_DISPMODE_MIRROR | DISPTYPE_CRT1);
5688 if(pSiS->DualHeadMode) {
5696 if(pSiS->MergedFB) {
5697 if(pSiS->MergedFBAuto) {
5702 if(pSiS->CRT2pScrn) free(pSiS->CRT2pScrn);
5703 pSiS->CRT2pScrn = NULL;
5704 pSiS->MergedFB = FALSE;
5707 pSiS->VBFlags |= (VB_DISPMODE_SINGLE | DISPTYPE_CRT1);
5710 if((pSiS->VGAEngine == SIS_315_VGA) || (pSiS->VGAEngine == SIS_300_VGA)) {
5711 if((!pSiS->NoXvideo) &&
5712 (!pSiS->hasTwoOverlays) &&
5713 (!(pSiS->SiS_SD2_Flags & SiS_SD2_NOOVERLAY))) {
5716 pSiS->XvOnCRT2 ? 2 : 1);
5726 pSiS->VBFlags_backup = pSiS->VBFlags;
5729 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
5730 inSISIDXREG(SISCR,0x32,pSiS->myCR32);
5731 inSISIDXREG(SISCR,0x36,pSiS->myCR36);
5732 inSISIDXREG(SISCR,0x37,pSiS->myCR37);
5737 if((!pSiS->DualHeadMode) || (!pSiS->SecondHead)) {
5739 if(pSiS->VGAEngine == SIS_300_VGA) {
5741 if(pSiS->VBFlags2 & (VB2_LVDS | VB2_30xBDH)) {
5749 if(pSiS->sisfbpdc != 0xff) {
5750 pSiS->SiS_Pr->PDC = pSiS->sisfbpdc;
5752 if(!(pSiS->donttrustpdc)) {
5756 inSISIDXREG(SISPART1, 0x13, pSiS->SiS_Pr->PDC);
5766 if(pSiS->SiS_Pr->PDC != -1) {
5767 pSiS->SiS_Pr->PDC &= 0x3c;
5770 pSiS->SiS_Pr->PDC);
5774 if(pSiS->SiS_Pr->PDC == -1) {
5777 if(mypdctable[i].subsysVendor == PCI_SUB_VENDOR_ID(pSiS->PciInfo) &&
5778 mypdctable[i].subsysCard == PCI_SUB_DEVICE_ID(pSiS->PciInfo)) {
5784 PCI_SUB_DEVICE_ID(pSiS->PciInfo), mypdctable[i].pdc);
5785 if(pSiS->PDC == -1) {
5786 pSiS->PDC = mypdctable[i].pdc;
5797 if(pSiS->PDC != -1) {
5798 if(pSiS->BIOS) {
5799 if(pSiS->VBFlags2 & VB2_LVDS) {
5800 if(pSiS->BIOS[0x220] & 0x80) {
5803 pSiS->BIOS[0x220] & 0x3c);
5804 pSiS->BIOS[0x220] &= 0x7f;
5807 if(pSiS->VBFlags2 & (VB2_301B | VB2_302B)) {
5808 if(pSiS->BIOS[0x220] & 0x80) {
5811 ( (pSiS->VBLCDFlags & VB_LCD_1280x1024) ?
5812 pSiS->BIOS[0x223] : pSiS->BIOS[0x224] ) & 0x3c);
5813 pSiS->BIOS[0x220] &= 0x7f;
5817 pSiS->SiS_Pr->PDC = (pSiS->PDC & 0x3c);
5819 "Using LCD Panel Delay Compensation 0x%02x\n", pSiS->SiS_Pr->PDC);
5825 if(pSiS->VGAEngine == SIS_315_VGA) {
5831 if(pSiS->VBFlags2 & VB2_SISLVDSBRIDGE) {
5833 if(pSiS->sisfbpdc != 0xff) {
5834 pSiS->SiS_Pr->PDC = pSiS->sisfbpdc;
5836 if(pSiS->sisfbpdca != 0xff) {
5837 pSiS->SiS_Pr->PDCA = pSiS->sisfbpdca;
5840 if(!pSiS->donttrustpdc) {
5841 if((pSiS->sisfbpdc == 0xff) && (pSiS->sisfbpdca == 0xff)) {
5851 if(!pSiS->ROM661New) {
5853 pSiS->SiS_Pr->PDCA = tempa;
5854 pSiS->SiS_Pr->PDC = tempb;
5861 pSiS->SiS_Pr->PDCA = tempa;
5863 pSiS->SiS_Pr->PDC = tempb;
5874 if(pSiS->SiS_Pr->PDC != -1) {
5877 pSiS->SiS_Pr->PDC);
5879 if(pSiS->SiS_Pr->PDCA != -1) {
5882 pSiS->SiS_Pr->PDCA);
5887 if(pSiS->VBFlags2 & VB2_30xBLV) {
5888 if(pSiS->PDC != -1) {
5889 pSiS->SiS_Pr->PDC = pSiS->PDC & 0x1f;
5892 pSiS->SiS_Pr->PDC);
5894 if(pSiS->PDCA != -1) {
5895 pSiS->SiS_Pr->PDCA = pSiS->PDCA & 0x1f;
5898 pSiS->SiS_Pr->PDCA);
5903 if(pSiS->VBFlags2 & VB2_SISEMIBRIDGE) {
5905 if(pSiS->EMI != -1) {
5906 pSiS->SiS_Pr->EMI_30 = (pSiS->EMI >> 24) & 0x60;
5907 pSiS->SiS_Pr->EMI_31 = (pSiS->EMI >> 16) & 0xff;
5908 pSiS->SiS_Pr->EMI_32 = (pSiS->EMI >> 8) & 0xff;
5909 pSiS->SiS_Pr->EMI_33 = pSiS->EMI & 0xff;
5910 pSiS->SiS_Pr->HaveEMI = pSiS->SiS_Pr->HaveEMILCD = TRUE;
5911 pSiS->SiS_Pr->OverruleEMI = TRUE;
5913 } else if((pSiS->sisfbfound) && (pSiS->sisfb_haveemi)) {
5914 pSiS->SiS_Pr->EMI_30 = pSiS->sisfb_emi30;
5915 pSiS->SiS_Pr->EMI_31 = pSiS->sisfb_emi31;
5916 pSiS->SiS_Pr->EMI_32 = pSiS->sisfb_emi32;
5917 pSiS->SiS_Pr->EMI_33 = pSiS->sisfb_emi33;
5918 pSiS->SiS_Pr->HaveEMI = TRUE;
5919 if(pSiS->sisfb_haveemilcd) pSiS->SiS_Pr->HaveEMILCD = TRUE;
5920 pSiS->SiS_Pr->OverruleEMI = FALSE;
5922 inSISIDXREG(SISPART4, 0x30, pSiS->SiS_Pr->EMI_30);
5923 inSISIDXREG(SISPART4, 0x31, pSiS->SiS_Pr->EMI_31);
5924 inSISIDXREG(SISPART4, 0x32, pSiS->SiS_Pr->EMI_32);
5925 inSISIDXREG(SISPART4, 0x33, pSiS->SiS_Pr->EMI_33);
5926 pSiS->SiS_Pr->HaveEMI = TRUE;
5927 if(tmp & 0x20) pSiS->SiS_Pr->HaveEMILCD = TRUE;
5928 pSiS->SiS_Pr->OverruleEMI = FALSE;
5932 pSiS->SiS_Pr->EMI_30,pSiS->SiS_Pr->EMI_31,
5933 pSiS->SiS_Pr->EMI_32,pSiS->SiS_Pr->EMI_33,
5934 pSiS->SiS_Pr->HaveEMILCD ? " (LCD)" : "");
5951 pSiS->dhmOffset = pSiS->FbBaseOffset;
5952 pSiS->FbAddress += pSiS->dhmOffset;
5955 if(pSiS->DualHeadMode) {
5956 pSiS->FbAddress = pSiS->realFbAddress;
5957 if(!pSiS->SecondHead) {
5960 pSiS->maxxfbmem /= 2;
5962 pSiS->FbAddress += pSiS->dhmOffset;
5965 pSiS->maxxfbmem/1024, pSiS->FbAddress);
5969 pSiS->maxxfbmem /= 2;
5971 pSiS->dhmOffset += pSiS->maxxfbmem;
5973 pSiS->FbAddress += pSiS->dhmOffset;
5976 pSiS->maxxfbmem/1024, pSiS->FbAddress);
5986 if(pSiS->FbBaseOffset) {
5990 pSiS->DRIheapstart = 16;
5991 pSiS->DRIheapend = pSiS->FbBaseOffset;
5993 pSiS->DRIheapstart = pSiS->maxxfbmem;
5994 pSiS->DRIheapend = pSiS->availMem;
5997 if(pSiS->DualHeadMode) {
5998 pSiS->DRIheapstart = pSiS->DRIheapend = 0;
6001 if(pSiS->DRIheapstart >= pSiS->DRIheapend) {
6007 pSiS->DRIheapstart = pSiS->DRIheapend = 0;
6018 pSiS->pVbe = NULL;
6021 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
6039 if((pSiS->DualHeadMode) && (!didddc2) && (!pSiS->SecondHead)) {
6046 if((pSiS->CRT1off) || (pSiS->VBFlags & CRT1_LCDA)) {
6059 if(pSiS->pVbe) {
6060 if((pMonitor = vbeDoEDID(pSiS->pVbe,NULL))) {
6078 if(pSiS->MergedFB) {
6079 pSiS->CRT2pScrn->monitor = malloc(sizeof(MonRec));
6080 if(pSiS->CRT2pScrn->monitor) {
6082 memcpy(pSiS->CRT2pScrn->monitor, pScrn->monitor, sizeof(MonRec));
6083 pSiS->CRT2pScrn->monitor->DDC = NULL;
6084 pSiS->CRT2pScrn->monitor->Modes = NULL;
6085 pSiS->CRT2pScrn->monitor->id = (char *)crt2monname;
6095 if(!pSiS->CRT2pScrn->monitor->Modes) pSiS->CRT2pScrn->monitor->Modes = newm;
6103 if(pSiS->CRT2HSync) {
6104 pSiS->CRT2pScrn->monitor->nHsync =
6105 SiSStrToRanges(pSiS->CRT2pScrn->monitor->hsync, pSiS->CRT2HSync, MAX_HSYNC);
6107 if(pSiS->CRT2VRefresh) {
6108 pSiS->CRT2pScrn->monitor->nVrefresh =
6109 SiSStrToRanges(pSiS->CRT2pScrn->monitor->vrefresh, pSiS->CRT2VRefresh, MAX_VREFRESH);
6111 if((pMonitor = SiSInternalDDC(pSiS->CRT2pScrn, 1))) {
6114 xf86SetDDCproperties(pSiS->CRT2pScrn, pMonitor);
6115 pSiS->CRT2pScrn->monitor->DDC = pMonitor;
6120 if(!pSiS->CRT2HSync) {
6121 pSiS->CRT2pScrn->monitor->nHsync = 0;
6123 if(!pSiS->CRT2VRefresh) {
6124 pSiS->CRT2pScrn->monitor->nVrefresh = 0;
6133 if(pSiS->CRT2pScrn) free(pSiS->CRT2pScrn);
6134 pSiS->CRT2pScrn = NULL;
6135 pSiS->MergedFB = FALSE;
6144 if(pSiS->DualHeadMode) {
6145 if(!pSiS->SecondHead) {
6147 pSiSEnt->CRT2VGAMonitorGamma = pSiS->CRT2VGAMonitorGamma;
6150 pSiSEnt->CRT1VGAMonitorGamma = pSiS->CRT1VGAMonitorGamma;
6152 if(pSiS->CRT2LCDMonitorGamma) pSiSEnt->CRT2LCDMonitorGamma = pSiS->CRT2LCDMonitorGamma;
6161 if(pSiS->MergedFB) xf86DrvMsg(pScrn->scrnIndex, X_INFO, crtsetupstr, 1);
6165 pSiS->MinClock = 5000;
6166 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
6167 pSiS->MinClock = 10000;
6170 pSiS->MinClock / 1000);
6176 if(pSiS->pEnt->device->dacSpeeds[0]) {
6179 case 8: speed = pSiS->pEnt->device->dacSpeeds[DAC_BPP8];
6181 case 16: speed = pSiS->pEnt->device->dacSpeeds[DAC_BPP16];
6183 case 24: speed = pSiS->pEnt->device->dacSpeeds[DAC_BPP24];
6185 case 32: speed = pSiS->pEnt->device->dacSpeeds[DAC_BPP32];
6188 if(speed == 0) pSiS->MaxClock = pSiS->pEnt->device->dacSpeeds[0];
6189 else pSiS->MaxClock = speed;
6193 pSiS->MaxClock / 1000);
6201 clockRanges->minClock = pSiS->MinClock;
6202 clockRanges->maxClock = pSiS->MaxClock;
6216 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
6217 if(!(pSiS->noInternalModes)) {
6222 if(pSiS->UseVESA) {
6227 if(pSiS->DualHeadMode) {
6228 if(!pSiS->SecondHead) { /* CRT2: */
6229 if(pSiS->VBFlags2 & VB2_SISTMDSBRIDGE) {
6230 if(!(pSiS->VBFlags2 & VB2_30xBDH)) {
6231 if(!(pSiS->VBFlags & (CRT2_LCD|CRT2_VGA))) includelcdmodes = FALSE;
6232 if(pSiS->VBFlags & CRT2_LCD) isfordvi = TRUE;
6233 if(pSiS->VBFlags & CRT2_TV) acceptcustommodes = FALSE;
6235 if(pSiS->VBFlags & (CRT2_TV|CRT2_LCD)) {
6247 if(pSiS->VBFlags & CRT1_LCDA) {
6248 if(!(pSiS->VBFlags2 & VB2_SISTMDSLCDABRIDGE)) {
6264 if(pSiS->MergedFB) {
6265 if(pSiS->VBFlags & CRT1_LCDA) {
6266 if(!(pSiS->VBFlags2 & VB2_SISTMDSLCDABRIDGE)) {
6280 if(pSiS->VBFlags2 & VB2_SISTMDSBRIDGE) {
6281 if(!(pSiS->VBFlags2 & VB2_30xBDH)) {
6282 if(!(pSiS->VBFlags2 & VB2_SISTMDSLCDABRIDGE)) {
6283 if(!(pSiS->VBFlags & (CRT2_LCD|CRT2_VGA))) includelcdmodes = FALSE;
6284 if(pSiS->VBFlags & CRT2_LCD) isfordvi = TRUE;
6286 if(!(pSiS->VBFlags & (CRT2_LCD|CRT2_VGA|CRT1_LCDA))) includelcdmodes = FALSE;
6287 if(pSiS->VBFlags & (CRT2_LCD|CRT1_LCDA)) isfordvi = TRUE;
6289 if((!(pSiS->VBFlags & DISPTYPE_CRT1)) && (!(pSiS->VBFlags & CRT1_LCDA))) {
6300 if(pSiS->VBFlags & (CRT2_TV|CRT2_LCD)) {
6303 if(!(pSiS->VBFlags & DISPTYPE_CRT1)) {
6308 } else if(pSiS->VBFlags & (CRT2_ENABLE | CRT1_LCDA)) {
6311 if((pSiS->VBFlags & CRT1_LCDA) || (!(pSiS->VBFlags & DISPTYPE_CRT1))) {
6319 pSiS->HaveCustomModes = FALSE;
6321 isfordvi, &pSiS->HaveCustomModes, FALSE, IsForCRT2)) {
6324 pSiS->HaveCustomModes ? "default" : "entire");
6325 if(pSiS->VGAEngine == SIS_315_VGA) {
6326 int UseWide = pSiS->SiS_Pr->SiS_UseWide;
6327 if(IsForCRT2) UseWide = pSiS->SiS_Pr->SiS_UseWideCRT2;
6328 if((!IsForCRT2) || (pSiS->VBFlags2 & VB2_SISVGA2BRIDGE)) {
6347 pSiS->HaveCustomModes = TRUE;
6352 if(pSiS->Chipset == PCI_CHIP_SIS6326) {
6365 if((pSiS->SiS6326Flags & SIS6326_HASTV) &&
6366 (pSiS->SiS6326Flags & SIS6326_TVDETECTED)) {
6369 (pSiS->SiS6326Flags & SIS6326_TVPAL) ? "PAL" : "NTSC");
6370 if(pSiS->SiS6326Flags & SIS6326_TVPAL) {
6400 if((pScrn->monitor->nHsync <= 0) || (pSiS->OverruleRanges)) {
6406 pSiS->DualHeadMode ? (pSiS->SecondHead ? 1 : 2) :
6408 pSiS->CRT1off ? 2 : 1);
6412 if((pScrn->monitor->nHsync <= 0) || (pSiS->OverruleRanges)) {
6413 if(SiSAllowSyncOverride(pSiS, fromDDC)) {
6422 pSiS->DualHeadMode ? (pSiS->SecondHead ? 1 : 2) :
6424 pSiS->CRT1off ? 2 : 1);
6431 if((pScrn->monitor->nVrefresh <= 0) || (pSiS->OverruleRanges)) {
6437 pSiS->DualHeadMode ? (pSiS->SecondHead ? 1 : 2) :
6439 pSiS->CRT1off ? 2 : 1);
6443 if((pScrn->monitor->nVrefresh <= 0) || (pSiS->OverruleRanges)) {
6444 if(SiSAllowSyncOverride(pSiS, fromDDC)) {
6451 pSiS->DualHeadMode ? (pSiS->SecondHead ? 1 : 2) :
6453 pSiS->CRT1off ? 2 : 1);
6459 if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) {
6483 switch(pSiS->VGAEngine) {
6501 pSiS->CheckForCRT2 = FALSE;
6514 pSiS->maxxfbmem,
6529 if(memreq > pSiS->maxxfbmem) {
6532 memreq/1024, pSiS->maxxfbmem/1024);
6543 if((pSiS->DualHeadMode) && (!pSiS->SecondHead)) {
6556 if( (pSiS->VGAEngine == SIS_300_VGA) &&
6595 pSiS->CurrentLayout.mode = pScrn->currentMode;
6596 pSiS->CurrentLayout.displayWidth = pScrn->displayWidth;
6597 pSiS->CurrentLayout.displayHeight = pScrn->virtualY;
6600 if(pSiS->MergedFB) {
6610 if(pSiS->DualHeadMode) {
6611 if(pSiS->SecondHead) {
6612 if(pSiS->VBFlags & CRT1_LCDA) usemyprint = TRUE;
6614 if(pSiS->VBFlags & (CRT2_LCD | CRT2_TV)) usemyprint = TRUE;
6619 if(pSiS->MergedFB) {
6620 if(pSiS->VBFlags & CRT1_LCDA) usemyprint = TRUE;
6624 if( (pSiS->VBFlags & (CRT2_LCD | CRT2_TV)) &&
6625 (!(pSiS->VBFlags & DISPTYPE_DISP1)) )
6637 if(pSiS->MergedFB) {
6645 clockRanges->minClock = pSiS->MinClock;
6646 clockRanges->maxClock = SiSMemBandWidth(pSiS->CRT2pScrn, TRUE);
6650 if(pSiS->VGAEngine == SIS_315_VGA) {
6659 if(pSiS->VBFlags2 & VB2_SISTMDSBRIDGE) {
6660 if(!(pSiS->VBFlags2 & VB2_30xBDH)) {
6661 if(!(pSiS->VBFlags & (CRT2_LCD|CRT2_VGA))) includelcdmodes = FALSE;
6662 if(pSiS->VBFlags & CRT2_LCD) isfordvi = TRUE;
6665 if(pSiS->VBFlags & (CRT2_LCD|CRT2_TV)) {
6675 pSiS->HaveCustomModes2 = FALSE;
6676 if(!SiSMakeOwnModeList(pSiS->CRT2pScrn, acceptcustommodes, includelcdmodes,
6677 isfordvi, &pSiS->HaveCustomModes2, FALSE, TRUE )) {
6681 SiSFreeCRT2Structs(pSiS);
6682 pSiS->MergedFB = FALSE;
6687 pSiS->HaveCustomModes2 ? "default" : "entire");
6688 if((pSiS->VGAEngine == SIS_315_VGA) && (pSiS->VBFlags2 & VB2_SISVGA2BRIDGE)) {
6691 pSiS->SiS_Pr->SiS_UseWideCRT2 ? "real" : "fake");
6692 } else pSiS->SiS_Pr->SiS_UseWideCRT2 = 0;
6697 if(pSiS->MergedFB) {
6704 if((pSiS->CRT2pScrn->monitor->nHsync <= 0) || (pSiS->OverruleRanges)) {
6705 if((pSiS->CRT2pScrn->monitor->nHsync <= 0) && (pSiS->CRT2pScrn->monitor->DDC)) {
6706 SiSSetSyncRangeFromEdid(pSiS->CRT2pScrn, 1);
6707 if(pSiS->CRT2pScrn->monitor->nHsync > 0) {
6712 if((pSiS->CRT2pScrn->monitor->nHsync <= 0) || (pSiS->OverruleRanges)) {
6713 if( (pSiS->VBFlags & CRT2_TV) ||
6714 ((pSiS->VBFlags & CRT2_LCD) && (!fromDDC)) ) {
6715 Bool HaveNoRanges = (pSiS->CRT2pScrn->monitor->nHsync <= 0);
6717 if((crt2freqoverruled = CheckAndOverruleH(pScrn, pSiS->CRT2pScrn->monitor))) {
6726 if((pSiS->CRT2pScrn->monitor->nVrefresh <= 0) || (pSiS->OverruleRanges)) {
6727 if((pSiS->CRT2pScrn->monitor->nVrefresh <= 0) && (pSiS->CRT2pScrn->monitor->DDC)) {
6728 SiSSetSyncRangeFromEdid(pSiS->CRT2pScrn, 0);
6729 if(pSiS->CRT2pScrn->monitor->nVrefresh > 0) {
6734 if((pSiS->CRT2pScrn->monitor->nVrefresh <= 0) || (pSiS->OverruleRanges)) {
6735 if( (pSiS->VBFlags & CRT2_TV) ||
6736 ((pSiS->VBFlags & CRT2_LCD) && (!fromDDC)) ) {
6737 Bool HaveNoRanges = (pSiS->CRT2pScrn->monitor->nVrefresh <= 0);
6739 if((crt2freqoverruled = CheckAndOverruleV(pScrn, pSiS->CRT2pScrn->monitor))) {
6747 backupddc = pSiS->CRT2pScrn->monitor->DDC;
6750 if(crt2freqoverruled) pSiS->CRT2pScrn->monitor->DDC = NULL;
6752 pSiS->CheckForCRT2 = TRUE;
6754 i = xf86ValidateModes(pSiS->CRT2pScrn, pSiS->CRT2pScrn->monitor->Modes,
6755 pSiS->CRT2pScrn->display->modes, clockRanges,
6757 pSiS->CRT2pScrn->bitsPerPixel * 8, 128, 4096,
6760 pSiS->maxxfbmem,
6763 pSiS->CheckForCRT2 = FALSE;
6764 pSiS->CRT2pScrn->monitor->DDC = backupddc;
6768 SiSFreeCRT2Structs(pSiS);
6769 pSiS->MergedFB = FALSE;
6774 if(pSiS->MergedFB) {
6776 if((p = first = pSiS->CRT2pScrn->modes)) {
6779 if( (pSiS->VGAEngine == SIS_300_VGA) &&
6792 xf86PruneDriverModes(pSiS->CRT2pScrn);
6794 if(i == 0 || pSiS->CRT2pScrn->modes == NULL) {
6796 SiSFreeCRT2Structs(pSiS);
6797 pSiS->MergedFB = FALSE;
6802 if(pSiS->MergedFB) {
6804 xf86SetCrtcForModes(pSiS->CRT2pScrn, INTERLACE_HALVE_V);
6808 if(pSiS->VBFlags & (CRT2_LCD | CRT2_TV)) {
6809 SiSPrintModes(pSiS->CRT2pScrn);
6811 xf86PrintModes(pSiS->CRT2pScrn);
6814 pSiS->CRT1Modes = pScrn->modes;
6815 pSiS->CRT1CurrentMode = pScrn->currentMode;
6819 pScrn->modes = SiSGenerateModeList(pScrn, pSiS->MetaModes,
6820 pSiS->CRT1Modes, pSiS->CRT2pScrn->modes,
6821 pSiS->CRT2Position);
6827 SiSFreeCRT2Structs(pSiS);
6828 pScrn->modes = pSiS->CRT1Modes;
6829 pSiS->CRT1Modes = NULL;
6830 pSiS->MergedFB = FALSE;
6836 if(pSiS->MergedFB) {
6848 pSiS->CurrentLayout.mode = pScrn->currentMode;
6849 pSiS->CurrentLayout.displayWidth = pScrn->displayWidth;
6850 pSiS->CurrentLayout.displayHeight = pScrn->virtualY;
6857 if(pSiS->MergedFB) {
6858 SiSMergedFBSetDpi(pScrn, pSiS->CRT2pScrn, pSiS->CRT2Position);
6880 if(!pSiS->NoAccel) {
6882 if(!pSiS->useEXA) {
6886 pSiS->NoAccel = 1;
6887 pSiS->ShadowFB = 1;
6892 if(pSiS->useEXA) {
6909 if(pSiS->ShadowFB) {
6918 if(pSiS->loadDRI) {
6928 pSiS->UseVESA = 0;
6929 if(pSiS->VESA == 1) {
6931 if(pSiS->pVbe) {
6933 if((vbe = VBEGetVBEInfo(pSiS->pVbe))) {
6934 pSiS->vesamajor = (unsigned)(vbe->VESAVersion >> 8);
6935 pSiS->vesaminor = vbe->VESAVersion & 0xff;
6936 SiSBuildVesaModeList(pScrn, pSiS->pVbe, vbe);
6938 pSiS->UseVESA = 1;
6944 if(pSiS->UseVESA == 0) {
6950 if(pSiS->pVbe) {
6951 vbeFree(pSiS->pVbe);
6952 pSiS->pVbe = NULL;
6959 sisRestoreExtRegisterLock(pSiS,srlockReg,crlockReg);
6961 if(pSiS->pInt) xf86FreeInt10(pSiS->pInt);
6962 pSiS->pInt = NULL;
6964 if(pSiS->VGAEngine == SIS_315_VGA) {
6965 pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTXVGAMMA1;
6969 if(pSiS->DualHeadMode) {
6970 pSiS->SiS_SD_Flags |= SiS_SD_ISDUALHEAD;
6971 if(pSiS->SecondHead) pSiS->SiS_SD_Flags |= SiS_SD_ISDHSECONDHEAD;
6972 else pSiS->SiS_SD_Flags &= ~(SiS_SD_SUPPORTXVGAMMA1);
6975 pSiS->SiS_SD_Flags |= SiS_SD_ISDHXINERAMA;
6976 /* pSiS->SiS_SD_Flags &= ~(SiS_SD_SUPPORTXVGAMMA1); */
6983 if(pSiS->MergedFB) pSiS->SiS_SD_Flags |= SiS_SD_ISMERGEDFB;
6988 pSiS->SiS_SD2_Flags |= SiS_SD2_SUPPLTFLAG;
6989 pSiS->SiS_SD2_Flags &= ~SiS_SD2_ISLAPTOP;
6990 if(pSiS->detectedCRT2Devices & CRT2_LCD) {
6991 if(pSiS->VBFlags2 & (VB2_SISLVDSBRIDGE | VB2_LVDS | VB2_30xBDH)) {
6997 if((pSiS->SiS_Pr->SiS_CustomT != CUT_BARCO1366) &&
6998 (pSiS->SiS_Pr->SiS_CustomT != CUT_BARCO1024) &&
6999 (pSiS->SiS_Pr->SiS_CustomT != CUT_PANEL848) &&
7000 (pSiS->SiS_Pr->SiS_CustomT != CUT_PANEL856) &&
7001 (pSiS->SiS_Pr->SiS_CustomT != CUT_AOP8060) &&
7002 ( (pSiS->ChipType != SIS_550) ||
7003 (!pSiS->DSTN && !pSiS->FSTN) ) ) {
7004 pSiS->SiS_SD2_Flags |= SiS_SD2_ISLAPTOP;
7006 } else if((pSiS->VBFlags2 & (VB2_301 | VB2_301C)) &&
7007 (pSiS->VBLCDFlags & (VB_LCD_1280x960 |
7015 pSiS->SiS_SD2_Flags |= SiS_SD2_ISLAPTOP;
7019 if(pSiS->enablesisctrl) pSiS->SiS_SD_Flags |= SiS_SD_ENABLED;
7021 pSiS->currentModeLast = pScrn->currentMode;
7022 pSiS->VBFlagsInit = pSiS->VBFlags;
7029 sisRestoreExtRegisterLock(pSiS, srlockReg, crlockReg);
7034 if(pSiS->pInt) xf86FreeInt10(pSiS->pInt);
7035 pSiS->pInt = NULL;
7047 SISPtr pSiS = SISPTR(pScrn);
7049 SISEntPtr pSiSEnt = pSiS->entityPrivate;
7051 if(pSiS->DualHeadMode) {
7057 pSiS->PciTag, pSiS->IOPAddress, 128);
7061 int err = pci_device_map_range(pSiS->PciInfo,
7062 pSiS->IOPAddress,
7075 pSiS->IOPBase = pSiSEnt->IOPBase;
7079 pSiS->IOPBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO,
7080 pSiS->PciTag, pSiS->IOPAddress, 128);
7083 void **result = (void **)&pSiS->IOPBase;
7084 int err = pci_device_map_range(pSiS->PciInfo,
7085 pSiS->IOPAddress,
7097 if(pSiS->IOPBase == NULL) {
7108 SISPtr pSiS = SISPTR(pScrn);
7110 SISEntPtr pSiSEnt = pSiS->entityPrivate;;
7117 if(pSiS->DualHeadMode) {
7126 pSiS->IOPBase = NULL;
7130 xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOPBase, 2048);
7131 pSiS->IOPBase = NULL;
7146 SISPtr pSiS = SISPTR(pScrn);
7151 SISEntPtr pSiSEnt = pSiS->entityPrivate;
7166 if(pSiS->DualHeadMode) {
7172 pSiS->PciTag, pSiS->IOAddress, (pSiS->mmioSize * 1024));
7175 int err = pci_device_map_range(pSiS->PciInfo,
7176 pSiS->IOAddress,
7177 (pSiS->mmioSize * 1024),
7188 pSiS->IOBase = pSiSEnt->IOBase;
7192 pSiS->IOBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags,
7193 pSiS->PciTag, pSiS->IOAddress, (pSiS->mmioSize * 1024));
7196 void **result = (void **)&pSiS->IOBase;
7197 int err = pci_device_map_range(pSiS->PciInfo,
7198 pSiS->IOAddress,
7199 (pSiS->mmioSize * 1024),
7211 if(pSiS->IOBase == NULL) {
7222 if(pSiS->DualHeadMode) {
7228 pSiS->PciTag, pSiS->IOAddress, (pSiS->mmioSize * 1024));
7231 int err = pci_device_map_range(pSiS->PciInfo,
7232 pSiS->IOAddress,
7233 (pSiS->mmioSize * 1024),
7244 pSiS->IOBaseDense = pSiSEnt->IOBaseDense;
7248 pSiS->IOBaseDense = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO,
7249 pSiS->PciTag, pSiS->IOAddress, (pSiS->mmioSize * 1024));
7251 void **result = (void **)&pSiS->IOBaseDense;
7252 int err = pci_device_map_range(pSiS->PciInfo,
7253 pSiS->IOAddress,
7254 (pSiS->mmioSize * 1024),
7267 if(pSiS->IOBaseDense == NULL) {
7274 if(pSiS->DualHeadMode) {
7281 pSiS->PciTag, (ULong)pSiS->realFbAddress,
7282 pSiS->FbMapSize);
7284 int err = pci_device_map_range(pSiS->PciInfo,
7285 (ULong)pSiS->realFbAddress,
7286 pSiS->FbMapSize,
7299 pSiS->FbBase = pSiS->RealFbBase = pSiSEnt->FbBase;
7301 pSiS->FbBase += pSiS->dhmOffset;
7306 pSiS->FbBase = pSiS->RealFbBase =
7308 pSiS->PciTag, (ULong)pSiS->realFbAddress,
7309 pSiS->FbMapSize);
7311 int err = pci_device_map_range(pSiS->PciInfo,
7312 (ULong)pSiS->realFbAddress,
7313 pSiS->FbMapSize,
7316 (void *)&pSiS->FbBase);
7323 pSiS->RealFbBase = pSiS->FbBase;
7325 pSiS->FbBase += pSiS->dhmOffset;
7331 if(pSiS->FbBase == NULL) {
7337 xf86DrvMsg(0, 0, "Framebuffer mapped to %p\n", pSiS->FbBase);
7351 SISPtr pSiS = SISPTR(pScrn);
7353 SISEntPtr pSiSEnt = pSiS->entityPrivate;
7360 if(pSiS->DualHeadMode) {
7365 xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOBase, (pSiS->mmioSize * 1024));
7367 pci_device_unmap_range(pSiS->PciInfo, pSiSEnt->IOBase, (pSiS->mmioSize * 1024));
7373 pSiS->IOBase = NULL;
7380 xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOBaseDense, (pSiS->mmioSize * 1024));
7382 pci_device_unmap_range(pSiS->PciInfo, (pointer)pSiSEnt->IOBaseDense, (pSiS->mmioSize * 1024));
7388 pSiS->IOBaseDense = NULL;
7395 xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->RealFbBase, pSiS->FbMapSize);
7397 pci_device_unmap_range(pSiS->PciInfo, (pointer)pSiSEnt->RealFbBase, pSiS->FbMapSize);
7404 pSiS->FbBase = pSiS->RealFbBase = NULL;
7409 xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOBase, (pSiS->mmioSize * 1024));
7411 pci_device_unmap_range(pSiS->PciInfo, (pointer)pSiS->IOBase, (pSiS->mmioSize * 1024));
7413 pSiS->IOBase = NULL;
7416 xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOBaseDense, (pSiS->mmioSize * 1024));
7418 pci_device_unmap_range(pSiS->PciInfo, (pointer)pSiS->IOBaseDense, (pSiS->mmioSize * 1024));
7420 pSiS->IOBaseDense = NULL;
7423 xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->RealFbBase, pSiS->FbMapSize);
7425 pci_device_unmap_range(pSiS->PciInfo, (pointer)pSiS->RealFbBase, pSiS->FbMapSize);
7427 pSiS->FbBase = pSiS->RealFbBase = NULL;
7440 SISPtr pSiS = SISPTR(pScrn);
7446 if(pSiS->DualHeadMode && pSiS->SecondHead) return;
7449 sisReg = &pSiS->SavedReg;
7451 if( ((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) &&
7452 ((pSiS->VBFlags2 & VB2_VIDEOBRIDGE) && (SiSBridgeIsInSlaveMode(pScrn))) ) {
7455 if(pSiS->VGAMemBase) {
7456 SiSRegInit(pSiS->SiS_Pr, pSiS->RelIO+0x30);
7457 SiSSetLVDSetc(pSiS->SiS_Pr);
7458 SiS_GetVBType(pSiS->SiS_Pr);
7459 SiS_DisableBridge(pSiS->SiS_Pr);
7461 SiS_EnableBridge(pSiS->SiS_Pr);
7467 if(pSiS->VGAMemBase) flags |= SISVGA_SR_FONTS;
7472 sisSaveUnlockExtRegisterLock(pSiS, &sisReg->sisRegs3C4[0x05], &sisReg->sisRegs3D4[0x80]);
7474 (*pSiS->SiSSave)(pScrn, sisReg);
7476 if(pSiS->UseVESA) SISVESASaveRestore(pScrn, MODE_SAVE);
7479 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
7480 sisReg->sisRegs3C4[0x1f] = pSiS->oldSR1F;
7481 sisReg->sisRegs3D4[0x17] = pSiS->oldCR17;
7482 sisReg->sisRegs3D4[0x32] = pSiS->oldCR32;
7483 sisReg->sisRegs3D4[0x36] = pSiS->oldCR36;
7484 sisReg->sisRegs3D4[0x37] = pSiS->oldCR37;
7485 if(pSiS->VGAEngine == SIS_315_VGA) {
7486 sisReg->sisRegs3D4[pSiS->myCR63] = pSiS->oldCR63;
7495 SISPtr pSiS = SISPTR(pScrn);
7499 (function == MODE_SAVE && pSiS->state == NULL)) {
7502 (void)VBEGetVBEMode(pSiS->pVbe, &pSiS->stateMode);
7505 if(pSiS->vesamajor > 1) {
7506 if(!VBESaveRestore(pSiS->pVbe, function, (pointer)&pSiS->state,
7507 &pSiS->stateSize, &pSiS->statePage)) {
7516 if(pSiS->vesamajor > 1) {
7518 memcpy(pSiS->state, pSiS->pstate, pSiS->stateSize);
7521 if(VBESaveRestore(pSiS->pVbe,function,(pointer)&pSiS->state,
7522 &pSiS->stateSize,&pSiS->statePage) &&
7525 if(!pSiS->pstate) {
7526 pSiS->pstate = malloc(pSiS->stateSize);
7528 memcpy(pSiS->pstate, pSiS->state, pSiS->stateSize);
7533 VBESetVBEMode(pSiS->pVbe, pSiS->stateMode, NULL);
7550 SISPtr pSiS = SISPTR(pScrn);
7560 if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) {
7561 SiSRegInit(pSiS->SiS_Pr, pSiS->RelIO+0x30);
7564 if(pSiS->UseVESA) { /* With VESA: */
7568 if(pSiS->SecondHead) return TRUE;
7582 if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) {
7589 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
7590 if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) {
7592 SiSPostSetMode(pScrn, &pSiS->ModeReg);
7598 if(!(*pSiS->ModeInit)(pScrn, mode)) {
7604 (*pSiS->SiSRestore)(pScrn, &pSiS->ModeReg);
7610 if(pSiS->DualHeadMode) {
7612 if(!(*pSiS->ModeInit)(pScrn, mode)) {
7619 pSiSEnt = pSiS->entityPrivate;
7621 if(!(pSiS->SecondHead)) {
7624 if(!SiSBIOSSetModeCRT2(pSiS->SiS_Pr, pScrn, mode, pSiS->IsCustom)) {
7628 SiSPostSetMode(pScrn, &pSiS->ModeReg);
7637 if(!SiSBIOSSetModeCRT1(pSiS->SiS_Pr, pScrn, mode, pSiS->IsCustom)) {
7641 SiSPostSetMode(pScrn, &pSiS->ModeReg);
7652 if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) {
7654 if(!(*pSiS->ModeInit)(pScrn, mode)) {
7662 if(pSiS->MergedFB) {
7669 if(!SiSBIOSSetModeCRT1(pSiS->SiS_Pr, pScrn,
7671 pSiS->IsCustom)) {
7678 if(!SiSBIOSSetModeCRT2(pSiS->SiS_Pr, pScrn,
7680 pSiS->IsCustom)) {
7688 if((pSiS->VBFlags & CRT1_LCDA) || (!(mode->type & M_T_DEFAULT))) {
7692 if(!SiSBIOSSetModeCRT1(pSiS->SiS_Pr, pScrn,
7693 mode, pSiS->IsCustom)) {
7700 if(!SiSBIOSSetModeCRT2(pSiS->SiS_Pr, pScrn,
7701 mode, pSiS->IsCustom)) {
7710 if(!SiSBIOSSetMode(pSiS->SiS_Pr, pScrn,
7711 mode, pSiS->IsCustom)) {
7722 SiSPostSetMode(pScrn, &pSiS->ModeReg);
7725 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VBFlags %lx\n", pSiS->VBFlags);
7728 (*pSiS->ModeInit)(pScrn, mode);
7736 if(!(*pSiS->ModeInit)(pScrn, mode)) {
7745 sisReg = &pSiS->ModeReg;
7754 (*pSiS->SiSRestore)(pScrn, sisReg);
7756 if((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV)) {
7757 SiS6326PostSetMode(pScrn, &pSiS->ModeReg);
7763 (*pSiS->ModeInit)(pScrn, mode);
7776 pSiS->CurrentLayout.mode = pSiS->currentModeLast = mode;
7784 SISPtr pSiS;
7787 pSiS = SISPTR(pScrn);
7794 if(VBESetVBEMode(pSiS->pVbe, mode, NULL) == FALSE) {
7801 VBESetLogicalScanline(pSiS->pVbe, pScrn->virtualX);
7814 SISPtr pSiS = SISPTR(pScrn);
7815 SISRegPtr sisReg = &pSiS->SavedReg;
7833 if(!(pSiS->ChipFlags & SiSCF_Is65x)) return;
7839 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
7842 SiS_UnLockCRT2(pSiS->SiS_Pr);
7854 if(!(pSiS->ChipFlags & SiSCF_Is651)) return;
7855 if(!(pSiS->VBFlags2 & VB2_SISBRIDGE)) return;
7882 SISPtr pSiS = SISPTR(pScrn);
7886 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
7889 if(pSiS->ChipType >= SIS_661) {
7909 SISPtr pSiS = SISPTR(pScrn);
7913 if(!pSiS->sisfbfound) return;
7914 if(!pSiS->sisfb_tvposvalid) return;
7915 if(!(pSiS->sisfbdevname[0])) return;
7917 if((fd = open(pSiS->sisfbdevname, O_RDONLY)) != -1) {
7918 parm = (CARD32)((pSiS->sisfb_tvxpos << 16) | (pSiS->sisfb_tvypos & 0xffff));
7930 SISPtr pSiS = SISPTR(pScrn);
7931 SISRegPtr sisReg = &pSiS->SavedReg;
7942 (*pSiS->SyncAccel)(pScrn);
7948 if(pSiS->VGAMemBase) flags |= SISVGA_SR_FONTS;
7951 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
7955 if(pSiS->DualHeadMode && pSiS->SecondHead) return;
7959 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
7968 outSISIDXREG(SISCR, 0x32, pSiS->oldCR32);
7969 if(!(pSiS->oldCR17 & 0x80)) { /* CRT1 was off */
7980 outSISIDXREG(SISCR, 0x17, pSiS->oldCR17);
7982 if(pSiS->VGAEngine == SIS_315_VGA) {
7983 outSISIDXREG(SISCR, pSiS->myCR63, pSiS->oldCR63);
7986 outSISIDXREG(SISSR, 0x1f, pSiS->oldSR1F);
7994 if( ( (pSiS->restorebyset) ||
7995 (pSiS->VBFlags2 & VB2_30xBLV) ||
7996 ((pSiS->ChipType == SIS_730) && (pSiS->VBFlags2 & VB2_LVDS)) ) &&
7997 (pSiS->OldMode) ) {
8002 "Restoring by setting old mode 0x%02x\n", pSiS->OldMode);
8004 if(((pSiS->OldMode <= 0x13) || (!pSiS->sisfbfound)) && (pSiS->pVbe)) {
8005 int vmode = SiSTranslateToVESA(pScrn, pSiS->OldMode);
8008 if(VBESetVBEMode(pSiS->pVbe, vmode, NULL) == TRUE) {
8010 SiS_GetSetModeID(pScrn,pSiS->OldMode);
8014 "VBE failed to restore mode 0x%x\n", pSiS->OldMode);
8018 "Can't identify VESA mode number for mode 0x%x\n", pSiS->OldMode);
8024 int backupscaler = pSiS->SiS_Pr->UsePanelScaler;
8025 int backupcenter = pSiS->SiS_Pr->CenterScreen;
8026 ULong backupspecialtiming = pSiS->SiS_Pr->SiS_CustomT;
8027 int mymode = pSiS->OldMode;
8029 if((pSiS->VGAEngine == SIS_315_VGA) &&
8030 ((pSiS->ROM661New) || (pSiS->ChipFlags & SiSCF_IsXGI)) &&
8031 (!pSiS->sisfbfound)) {
8036 if((pSiS->VBFlags2 & VB2_30xBLV)) {
8052 pSiS->SiS_Pr->UseCustomMode = FALSE;
8053 pSiS->SiS_Pr->CRT1UsesCustomMode = FALSE;
8054 pSiS->SiS_Pr->CenterScreen = 0;
8055 if(pSiS->sisfbfound) {
8056 pSiS->SiS_Pr->UsePanelScaler = pSiS->sisfbscalelcd;
8057 pSiS->SiS_Pr->SiS_CustomT = pSiS->sisfbspecialtiming;
8059 pSiS->SiS_Pr->UsePanelScaler = -1;
8062 SiS_SetEnableDstn(pSiS->SiS_Pr, FALSE);
8063 SiS_SetEnableFstn(pSiS->SiS_Pr, FALSE);
8064 if((pSiS->ChipType == SIS_550) && (pSiS->sisfbfound)) {
8065 if(pSiS->sisfbxSTN) {
8066 SiS_SetEnableDstn(pSiS->SiS_Pr, pSiS->sisfbDSTN);
8067 SiS_SetEnableFstn(pSiS->SiS_Pr, pSiS->sisfbFSTN);
8069 SiS_SetEnableFstn(pSiS->SiS_Pr, TRUE);
8072 SiSSetMode(pSiS->SiS_Pr, pScrn, mymode, FALSE);
8077 SiS_GetSetModeID(pScrn, pSiS->OldMode); /* NOT mymode! */
8078 pSiS->SiS_Pr->UsePanelScaler = backupscaler;
8079 pSiS->SiS_Pr->CenterScreen = backupcenter;
8080 pSiS->SiS_Pr->SiS_CustomT = backupspecialtiming;
8088 if(pSiS->VGAEngine == SIS_315_VGA) {
8089 outSISIDXREG(SISCR, pSiS->myCR63, pSiS->oldCR63);
8091 outSISIDXREG(SISSR, 0x1f, pSiS->oldSR1F);
8096 SiSRestoreQueueMode(pSiS, sisReg);
8101 if(pSiS->VBFlags2 & VB2_VIDEOBRIDGE) {
8113 (*pSiS->SiSRestore)(pScrn, sisReg);
8118 outSISIDXREG(SISCR, 0x17, pSiS->oldCR17);
8123 if((pSiS->VBFlags2 & VB2_VIDEOBRIDGE) && (SiSBridgeIsInSlaveMode(pScrn))) {
8132 SiSRegInit(pSiS->SiS_Pr, pSiS->RelIO+0x30);
8133 SiSSetLVDSetc(pSiS->SiS_Pr);
8134 SiS_GetVBType(pSiS->SiS_Pr);
8135 SiS_DisableBridge(pSiS->SiS_Pr);
8143 SiS_EnableBridge(pSiS->SiS_Pr);
8159 SISRegPtr pReg = &pSiS->ModeReg;
8162 (*pSiS->SiSSave)(pScrn, pReg);
8166 sisRestoreExtRegisterLock(pSiS,sisReg->sisRegs3C4[0x05],sisReg->sisRegs3D4[0x80]);
8173 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
8176 (*pSiS->SiSRestore)(pScrn, sisReg);
8185 if((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV)) {
8214 sisRestoreExtRegisterLock(pSiS,sisReg->sisRegs3C4[5],sisReg->sisRegs3D4[0x80]);
8223 SISPtr pSiS = SISPTR(pScrn);
8225 SISRegPtr sisReg = &pSiS->SavedReg;
8228 if(pSiS->UseVESA) {
8233 SiSRestoreQueueMode(pSiS, sisReg);
8242 SISPtr pSiS = SISPTR(pScrn);
8246 if(pSiS->DualHeadMode && pSiS->SecondHead) return;
8249 if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) {
8250 SiSRestoreBridge(pScrn, &pSiS->SavedReg);
8260 SISPtr pSiS = SISPTR(pScrn);
8262 pScreen->BlockHandler = pSiS->BlockHandler;
8267 if(pSiS->NeedCopyFastVidCpy) {
8268 SISEntPtr pSiSEnt = pSiS->entityPrivate;
8270 pSiS->NeedCopyFastVidCpy = FALSE;
8271 pSiS->SiSFastVidCopy = pSiSEnt->SiSFastVidCopy;
8272 pSiS->SiSFastMemCopy = pSiSEnt->SiSFastMemCopy;
8273 pSiS->SiSFastVidCopyFrom = pSiSEnt->SiSFastVidCopyFrom;
8274 pSiS->SiSFastMemCopyFrom = pSiSEnt->SiSFastMemCopyFrom;
8279 if(pSiS->VideoTimerCallback) {
8280 (*pSiS->VideoTimerCallback)(pScrn, currentTime.milliseconds);
8284 if(pSiS->RenderCallback) {
8285 (*pSiS->RenderCallback)(pScrn);
8289 if(pSiS->ExaRenderCallback) {
8290 (*pSiS->ExaRenderCallback)(pScrn);
8303 SiSHandleBackLight(SISPtr pSiS, Bool blon)
8305 UChar sr11mask = (pSiS->SiS_Pr->SiS_SensibleSR11) ? 0x03 : 0xf3;
8307 if(pSiS->VBFlags2 & VB2_SISLVDSBRIDGE) {
8310 SiS_SiS30xBLOff(pSiS->SiS_Pr);
8312 SiS_SiS30xBLOn(pSiS->SiS_Pr);
8315 } else if( ((pSiS->VGAEngine == SIS_300_VGA) &&
8316 (pSiS->VBFlags2 & (VB2_LVDS | VB2_30xBDH))) ||
8317 ((pSiS->VGAEngine == SIS_315_VGA) &&
8318 ((pSiS->VBFlags2 & (VB2_LVDS | VB2_CHRONTEL)) == VB2_LVDS)) ) {
8326 } else if((pSiS->VGAEngine == SIS_315_VGA) &&
8327 (pSiS->VBFlags2 & VB2_CHRONTEL)) {
8330 SiS_Chrontel701xBLOff(pSiS->SiS_Pr);
8332 SiS_Chrontel701xBLOn(pSiS->SiS_Pr);
8342 SISPtr pSiS;
8347 pSiS = SISPTR(pScrn);
8350 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
8353 if(pSiS->VBFlags & (CRT2_LCD | CRT1_LCDA)) {
8354 SiSHandleBackLight(pSiS, IsUnblank);
8370 SISPtr pSiS;
8375 pSiS = SISPTR(pScrn);
8377 if( (pSiS->SecondHead) &&
8378 ((!(pSiS->VBFlags & CRT1_LCDA)) || (pSiS->VBFlags2 & VB2_SISTMDSLCDABRIDGE)) ) {
8390 if(pSiS->VBFlags & (CRT2_LCD|CRT1_LCDA)) {
8393 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
8395 SiSHandleBackLight(pSiS, IsUnblank);
8407 SISPtr pSiS = SISPTR(pScrn);
8418 if(pSiS->DualHeadMode) {
8419 if(pSiS->SecondHead) docrt2 = FALSE;
8435 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
8490 if((docrt2 && (pSiS->VBFlags & CRT2_LCD)) ||
8491 (docrt1 && (pSiS->VBFlags & CRT1_LCDA))) {
8492 SiSHandleBackLight(pSiS, backlight);
8496 switch(pSiS->VGAEngine) {
8505 if( (!pSiS->CRT1off) &&
8506 ((!(pSiS->VBFlags & CRT1_LCDA)) || (pSiS->VBFlags2 & VB2_SISTMDSLCDABRIDGE)) ) {
8507 setSISIDXREG(SISCR, pSiS->myCR63, 0xbf, cr63);
8515 if((!(pSiS->VBFlags & CRT1_LCDA)) || (pSiS->VBFlags2 & VB2_SISTMDSLCDABRIDGE)) {
8517 if((!pSiS->CRT1off) && (!SiSBridgeIsInSlaveMode(pScrn))) {
8526 if(pSiS->VBFlags & CRT2_LCD) {
8527 if((pSiS->VBFlags2 & VB2_SISBRIDGE) &&
8528 (!(pSiS->VBFlags2 & VB2_30xBDH))) {
8529 if(pSiS->VGAEngine == SIS_300_VGA) {
8530 SiS_UnLockCRT2(pSiS->SiS_Pr);
8533 if(pSiS->VBFlags2 & VB2_SISLVDSBRIDGE) p2_0 |= 0x20;
8536 } else if(pSiS->VBFlags & (CRT2_VGA | CRT2_TV)) {
8537 if(pSiS->VBFlags2 & VB2_SISBRIDGE) {
8545 ((!(pSiS->VBFlags & CRT1_LCDA)) || (pSiS->VBFlags2 & VB2_SISTMDSLCDABRIDGE)) ) {
8564 SISPtr pSiS = SISPTR(pScrn);
8574 if((!pSiS->DualHeadMode) || (!pSiS->SecondHead)) {
8582 if(pSiS->DualHeadMode) {
8583 pSiSEnt = pSiS->entityPrivate;
8602 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
8611 if(pSiS->UseVESA) {
8613 if(pSiS->VGAEngine != SIS_315_VGA)
8621 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
8623 if(!pSiS->OldMode) {
8642 inSISIDXREG(SISCR, 0x34, pSiS->OldMode);
8647 if(pSiS->OldMode != myoldmode) {
8649 if( (!(pSiS->VBFlags2 & VB2_VIDEOBRIDGE)) ||
8650 (pSiS->OldMode == 0) ||
8653 pSiS->OldMode = myoldmode;
8664 if(pSiS->OldMode > 0x7f) {
8665 pSiS->OldMode = myoldmode;
8669 if(pSiS->DualHeadMode) {
8670 if(!pSiS->SecondHead) pSiSEnt->OldMode = pSiS->OldMode;
8671 else pSiS->OldMode = pSiSEnt->OldMode;
8681 if(pScrn->currentMode != pSiS->currentModeLast) {
8682 pSiS->VBFlags = pSiS->VBFlags_backup = pSiS->VBFlagsInit;
8689 if(pSiS->DualHeadMode) {
8690 if(!pSiS->SecondHead) {
8692 pSiS->CRT1VGAMonitorGamma = pSiSEnt->CRT1VGAMonitorGamma;
8695 pSiS->CRT2VGAMonitorGamma = pSiSEnt->CRT2VGAMonitorGamma;
8697 if(!pSiS->CRT2LCDMonitorGamma) pSiS->CRT2LCDMonitorGamma = pSiSEnt->CRT2LCDMonitorGamma;
8740 if(pSiS->Rotate) {
8745 if(pSiS->ShadowFB) {
8746 pSiS->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width);
8747 pSiS->ShadowPtr = malloc(pSiS->ShadowPitch * height);
8748 displayWidth = pSiS->ShadowPitch / (pScrn->bitsPerPixel >> 3);
8749 FBStart = pSiS->ShadowPtr;
8751 pSiS->ShadowPtr = NULL;
8752 FBStart = pSiS->FbBase;
8767 if(pSiS->SecondHead)
8768 pSiS->cmdQueueLenPtr = &(SISPTR(pSiSEnt->pScrn_1)->cmdQueueLen);
8771 pSiS->cmdQueueLenPtr = &(pSiS->cmdQueueLen);
8773 pSiS->cmdQueueLen = 0; /* Force an EngineIdle() at start */
8776 if(pSiS->loadDRI) {
8779 if(pSiS->DualHeadMode) {
8780 pSiS->directRenderingEnabled = FALSE;
8785 if(pSiS->VGAEngine != SIS_315_VGA) {
8787 pSiS->directRenderingEnabled = SISDRIScreenInit(pScreen);
8791 pSiS->directRenderingEnabled = FALSE;
8801 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
8843 if(!pSiS->ShadowFB) SISDGAInit(pScreen);
8848 switch(pSiS->VGAEngine) {
8861 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CPUFlags %x\n", pSiS->CPUFlags);
8866 pSiS->NeedCopyFastVidCpy = FALSE;
8867 if(!pSiS->SiSFastVidCopyDone) {
8869 if(pSiS->DualHeadMode) {
8870 if(pSiS->SecondHead) {
8875 if(pSiS->useEXA) {
8880 pSiS->SiSFastVidCopy = pSiSEnt->SiSFastVidCopy;
8881 pSiS->SiSFastMemCopy = pSiSEnt->SiSFastMemCopy;
8882 pSiS->SiSFastVidCopyFrom = pSiSEnt->SiSFastVidCopyFrom;
8883 pSiS->SiSFastMemCopyFrom = pSiSEnt->SiSFastMemCopyFrom;
8885 pSiS->NeedCopyFastVidCpy = TRUE;
8889 pSiS->SiSFastVidCopy = SiSVidCopyInit(pScreen, &pSiS->SiSFastMemCopy, FALSE);
8890 pSiS->SiSFastVidCopyFrom = SiSVidCopyGetDefault();
8891 pSiS->SiSFastMemCopyFrom = SiSVidCopyGetDefault();
8893 if(pSiS->useEXA) {
8894 pSiS->SiSFastVidCopyFrom = SiSVidCopyInit(pScreen, &pSiS->SiSFastMemCopyFrom, TRUE);
8901 pSiS->SiSFastVidCopyDone = TRUE;
8909 if(pSiS->HWCursor) {
8914 if(!pSiS->DualHeadMode) {
8916 if((pSiS->VBFlags2 & VB2_SISBRIDGE) && (pScrn->depth > 8)) {
8918 pSiS->CRT2ColNum = 1 << pScrn->rgbBits;
8920 if((pSiS->crt2gcolortable = malloc(pSiS->CRT2ColNum * 2 * sizeof(LOCO)))) {
8921 pSiS->crt2colors = &pSiS->crt2gcolortable[pSiS->CRT2ColNum];
8922 if((pSiS->crt2cindices = malloc(256 * sizeof(int)))) {
8923 int i = pSiS->CRT2ColNum;
8925 while(i--) pSiS->crt2cindices[i] = i;
8927 free(pSiS->crt2gcolortable);
8928 pSiS->crt2gcolortable = NULL;
8929 pSiS->CRT2SepGamma = FALSE;
8932 pSiS->CRT2SepGamma = FALSE;
8935 if(!pSiS->crt2cindices) {
8942 } else pSiS->CRT2SepGamma = FALSE;
8962 if((pSiS->GammaBriR != 1000) ||
8963 (pSiS->GammaBriB != 1000) ||
8964 (pSiS->GammaBriG != 1000) ||
8965 (pSiS->NewGammaBriR != 0.0) ||
8966 (pSiS->NewGammaBriG != 0.0) ||
8967 (pSiS->NewGammaBriB != 0.0) ||
8968 (pSiS->NewGammaConR != 0.0) ||
8969 (pSiS->NewGammaConG != 0.0) ||
8970 (pSiS->NewGammaConB != 0.0)) {
8976 if(pSiS->ShadowFB) {
8979 if(pSiS->Rotate) {
8980 if(!pSiS->PointerMoved) pSiS->PointerMoved = pScrn->PointerMoved;
8993 } else if(pSiS->Reflect) {
8998 if(!pSiS->PointerMoved) pSiS->PointerMoved = pScrn->PointerMoved;
9019 pScrn->memPhysBase = pSiS->FbAddress;
9023 pSiS->ResetXv = pSiS->ResetXvGamma = pSiS->ResetXvDisplay = NULL;
9025 if((!pSiS->NoXvideo) && (!(pSiS->SiS_SD2_Flags & SiS_SD2_NOOVERLAY))) {
9027 if((pSiS->VGAEngine == SIS_300_VGA) ||
9028 (pSiS->VGAEngine == SIS_315_VGA)) {
9033 if(pSiS->DualHeadMode) {
9035 "%s on CRT%d\n", using, (pSiS->SecondHead ? 1 : 2));
9036 if(!pSiS->hasTwoOverlays) {
9037 if( (pSiS->XvOnCRT2 && pSiS->SecondHead) ||
9038 (!pSiS->XvOnCRT2 && !pSiS->SecondHead) ) {
9041 pSiS->XvOnCRT2 ? 2 : 1);
9046 if(pSiS->hasTwoOverlays) {
9050 using, (pSiS->XvOnCRT2 ? 2 : 1));
9058 if(pSiS->blitadaptor) {
9061 pSiS->XvDefAdaptorBlit ? "Blitter" : "Overlay");
9064 } else if(pSiS->Chipset == PCI_CHIP_SIS530 ||
9065 pSiS->Chipset == PCI_CHIP_SIS6326 ||
9066 pSiS->Chipset == PCI_CHIP_SIS5597) {
9088 if(pSiS->loadDRI) {
9089 if(pSiS->directRenderingEnabled) {
9093 pSiS->directRenderingEnabled = SISDRIFinishScreenInit(pScreen);
9096 pSiS->directRenderingEnabled ? "enabled" : "disabled");
9098 /* if(pSiS->directRenderingEnabled) SISSetLFBConfig(pSiS); */
9104 pSiS->SiS_SD_Flags &= ~(SiS_SD_PSEUDOXINERAMA);
9106 if(pSiS->MergedFB) {
9107 pSiS->PointerMoved = pScrn->PointerMoved;
9109 pSiS->Rotate = 0;
9110 pSiS->Reflect = 0;
9111 pSiS->ShadowFB = FALSE;
9113 if(pSiS->CRT1XOffs || pSiS->CRT1YOffs || pSiS->CRT2XOffs || pSiS->CRT2YOffs) {
9120 if(pSiS->UseSiSXinerama) {
9124 pSiS->SiS_SD_Flags |= SiS_SD_PSEUDOXINERAMA;
9125 if(pSiS->HaveNonRect) {
9131 pSiS->MouseRestrictions = FALSE;
9138 pSiS->CloseScreen = pScreen->CloseScreen;
9141 if(pSiS->DualHeadMode)
9148 pSiS->BlockHandler = pScreen->BlockHandler;
9170 if(pSiS->DualHeadMode) {
9171 if(pSiS->SecondHead) {
9172 sisclearvram(pSiS->FbBase, OnScreenSize);
9176 pSiSEnt->FbBase1 = pSiS->FbBase;
9182 sisclearvram(pSiS->FbBase, OnScreenSize);
9187 pSiS->SiS_SD_Flags &= ~SiS_SD_SUPPORTSGRCRT2;
9189 if(!pSiS->DualHeadMode) {
9191 if(pSiS->VBFlags2 & VB2_SISBRIDGE) {
9192 if((pSiS->crt2cindices) && (pSiS->crt2gcolortable)) {
9193 pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTSGRCRT2;
9200 pSiS->SiS_SD_Flags &= ~SiS_SD_ISDEPTH8;
9201 if(pSiS->CurrentLayout.bitsPerPixel == 8) {
9202 pSiS->SiS_SD_Flags |= SiS_SD_ISDEPTH8;
9203 pSiS->SiS_SD_Flags &= ~SiS_SD_SUPPORTXVGAMMA1;
9204 pSiS->SiS_SD_Flags &= ~SiS_SD_SUPPORTSGRCRT2;
9208 pSiS->SiS_SD_Flags |= SiS_SD_CANSETGAMMA;
9210 pSiS->SiS_SD_Flags &= ~SiS_SD_CANSETGAMMA;
9223 SISPtr pSiS = SISPTR(pScrn);
9225 if(!pSiS->skipswitchcheck) {
9231 (*pSiS->SyncAccel)(pScrn);
9240 if(pSiS->MergedFB) {
9249 SISSetStartAddressCRT1(SISPtr pSiS, ULong base)
9258 if(pSiS->VGAEngine == SIS_315_VGA) {
9266 SISSetStartAddressCRT2(SISPtr pSiS, ULong base)
9268 SiS_UnLockCRT2(pSiS->SiS_Pr);
9272 if(pSiS->VGAEngine == SIS_315_VGA) {
9275 SiS_LockCRT2(pSiS->SiS_Pr);
9288 SISPtr pSiS = SISPTR(pScrn);
9291 base = y * pSiS->CurrentLayout.displayWidth + x;
9292 switch(pSiS->CurrentLayout.bitsPerPixel) {
9297 base += (pSiS->dhmOffset/4);
9298 SISSetStartAddressCRT1(pSiS, base);
9304 SISPtr pSiS = SISPTR(pScrn);
9307 base = y * pSiS->CurrentLayout.displayWidth + x;
9308 switch(pSiS->CurrentLayout.bitsPerPixel) {
9313 base += (pSiS->dhmOffset/4);
9314 SISSetStartAddressCRT2(pSiS, base);
9322 SISPtr pSiS = SISPTR(pScrn1);
9323 ScrnInfoPtr pScrn2 = pSiS->CRT2pScrn;
9335 SiSScrn2Rel srel = ((SiSMergedDisplayModePtr)pSiS->CurrentLayout.mode->Private)->CRT2Position;
9337 if(pSiS->DGAactive) {
9341 /* HVirt = pSiS->CurrentLayout.displayWidth;
9342 VVirt = pSiS->CurrentLayout.displayHeight;
9343 BOUND(x, pSiS->CurrentLayout.DGAViewportX, HVirt);
9344 BOUND(y, pSiS->CurrentLayout.DGAViewportY, VVirt); */
9346 CRT1XOffs = pSiS->CRT1XOffs;
9347 CRT1YOffs = pSiS->CRT1YOffs;
9348 CRT2XOffs = pSiS->CRT2XOffs;
9349 CRT2YOffs = pSiS->CRT2YOffs;
9350 HaveNonRect = pSiS->HaveNonRect;
9351 HaveOffsRegions = pSiS->HaveOffsRegions;
9355 if((pSiS->MouseRestrictions) && (srel != sisClone) && !SiSnoPanoramiXExtension) {
9357 if(InRegion(x, y, pSiS->NonRectDead)) {
9360 case sisRightOf: y = pSiS->NonRectDead.y0 - 1;
9364 case sisBelow: x = pSiS->NonRectDead.x0 - 1;
9371 if(InRegion(x, y, pSiS->OffDead1)) {
9374 case sisRightOf: y = pSiS->OffDead1.y1;
9378 case sisBelow: x = pSiS->OffDead1.x1;
9382 } else if(InRegion(x, y, pSiS->OffDead2)) {
9385 case sisRightOf: y = pSiS->OffDead2.y0 - 1;
9389 case sisBelow: x = pSiS->OffDead2.x0 - 1;
9419 f1.x0 = old1x0 = pSiS->CRT1frameX0;
9420 f1.x1 = pSiS->CRT1frameX1;
9421 f1.y0 = old1y0 = pSiS->CRT1frameY0;
9422 f1.y1 = pSiS->CRT1frameY1;
9533 pSiS->CRT1frameX0 = f1.x0;
9534 pSiS->CRT1frameY0 = f1.y0;
9542 if(pSiS->CRT1frameY0 != old1y0) {
9543 if(pSiS->CRT1frameY0 < CRT1YOffs)
9544 pSiS->CRT1frameY0 = CRT1YOffs;
9546 temp1 = pSiS->CRT1frameY0 + CDMPTR->CRT1->VDisplay;
9547 temp2 = min((VVirt - CRT2YOffs), (CRT1YOffs + pSiS->MBXNR1YMAX));
9549 pSiS->CRT1frameY0 -= (temp1 - temp2);
9556 temp2 = min((VVirt - CRT1YOffs), (CRT2YOffs + pSiS->MBXNR2YMAX));
9565 if(pSiS->CRT1frameX0 != old1x0) {
9566 if(pSiS->CRT1frameX0 < CRT1XOffs)
9567 pSiS->CRT1frameX0 = CRT1XOffs;
9569 temp1 = pSiS->CRT1frameX0 + CDMPTR->CRT1->HDisplay;
9570 temp2 = min((HVirt - CRT2XOffs), (CRT1XOffs + pSiS->MBXNR1XMAX));
9572 pSiS->CRT1frameX0 -= (temp1 - temp2);
9579 temp2 = min((HVirt - CRT1XOffs), (CRT2XOffs + pSiS->MBXNR2XMAX));
9589 pSiS->CRT1frameX1 = pSiS->CRT1frameX0 + CDMPTR->CRT1->HDisplay - 1;
9590 pSiS->CRT1frameY1 = pSiS->CRT1frameY0 + CDMPTR->CRT1->VDisplay - 1;
9596 SISAdjustFrameHW_CRT1(pScrn1, pSiS->CRT1frameX0, pSiS->CRT1frameY0);
9606 SISPtr pSiS = SISPTR(pScrn1);
9607 ScrnInfoPtr pScrn2 = pSiS->CRT2pScrn;
9608 int HTotal = pSiS->CurrentLayout.mode->HDisplay;
9609 int VTotal = pSiS->CurrentLayout.mode->VDisplay;
9619 if(pSiS->DGAactive) {
9620 HVirt = pSiS->CurrentLayout.displayWidth;
9621 VVirt = pSiS->CurrentLayout.displayHeight;
9623 CRT1XOffs = pSiS->CRT1XOffs;
9624 CRT1YOffs = pSiS->CRT1YOffs;
9625 CRT2XOffs = pSiS->CRT2XOffs;
9626 CRT2YOffs = pSiS->CRT2YOffs;
9627 MBXNR1XMAX = pSiS->MBXNR1XMAX;
9628 MBXNR1YMAX = pSiS->MBXNR1YMAX;
9629 MBXNR2XMAX = pSiS->MBXNR2XMAX;
9630 MBXNR2YMAX = pSiS->MBXNR2YMAX;
9646 pSiS->CRT1frameX0 = x1 + CDMPTR->CRT2->HDisplay;
9647 BOUND(pSiS->CRT1frameY0, y1, y1 + min(VMax, MBXNR1YMAX) - CDMPTR->CRT1->VDisplay);
9650 pSiS->CRT1frameX0 = x1;
9651 BOUND(pSiS->CRT1frameY0, y1, y1 + min(VMax, MBXNR1YMAX) - CDMPTR->CRT1->VDisplay);
9658 BOUND(pSiS->CRT1frameX0, x1, x1 + min(HMax, MBXNR1XMAX) - CDMPTR->CRT1->HDisplay);
9659 pSiS->CRT1frameY0 = y1 + CDMPTR->CRT2->VDisplay;
9662 BOUND(pSiS->CRT1frameX0, x1, x1 + min(HMax, MBXNR1XMAX) - CDMPTR->CRT1->HDisplay);
9663 pSiS->CRT1frameY0 = y1;
9668 BOUND(pSiS->CRT1frameX0, x, x + HMax - CDMPTR->CRT1->HDisplay);
9669 BOUND(pSiS->CRT1frameY0, y, y + VMax - CDMPTR->CRT1->VDisplay);
9675 BOUND(pSiS->CRT1frameX0, 0, HVirt - CDMPTR->CRT1->HDisplay);
9676 BOUND(pSiS->CRT1frameY0, 0, VVirt - CDMPTR->CRT1->VDisplay);
9683 pSiS->CRT1frameX1 = pSiS->CRT1frameX0 + CDMPTR->CRT1->HDisplay - 1;
9684 pSiS->CRT1frameY1 = pSiS->CRT1frameY0 + CDMPTR->CRT1->VDisplay - 1;
9688 pScrn1->frameX1 = pScrn1->frameX0 + pSiS->CurrentLayout.mode->HDisplay - 1;
9689 pScrn1->frameY1 = pScrn1->frameY0 + pSiS->CurrentLayout.mode->VDisplay - 1;
9695 SISAdjustFrameHW_CRT1(pScrn1, pSiS->CRT1frameX0, pSiS->CRT1frameY0);
9710 SISPtr pSiS = SISPTR(pScrn);
9715 if(pSiS->MergedFB) {
9721 if(pSiS->UseVESA) {
9722 VBESetDisplayStart(pSiS->pVbe, x, y, TRUE);
9727 base = (y * pSiS->CurrentLayout.displayWidth + x + 3) >> 3;
9729 base = y * pSiS->CurrentLayout.displayWidth + x;
9732 switch(pSiS->CurrentLayout.bitsPerPixel) {
9749 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
9752 base += (pSiS->dhmOffset/4);
9756 x, y, pSiS->CurrentLayout.bitsPerPixel, pSiS->CurrentLayout.displayWidth, base, pSiS->dhmOffset);
9760 if(pSiS->DualHeadMode) {
9761 if(!pSiS->SecondHead) {
9763 SISSetStartAddressCRT2(pSiS, base);
9766 SISSetStartAddressCRT1(pSiS, base);
9770 switch(pSiS->VGAEngine) {
9773 SISSetStartAddressCRT1(pSiS, base);
9774 if(pSiS->VBFlags & CRT2_ENABLE) {
9776 SISSetStartAddressCRT2(pSiS, base);
9808 SISPtr pSiS = SISPTR(pScrn);
9812 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
9814 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
9815 outSISIDXREG(SISCR,0x32,pSiS->myCR32);
9816 outSISIDXREG(SISCR,0x36,pSiS->myCR36);
9817 outSISIDXREG(SISCR,0x37,pSiS->myCR37);
9828 if(pSiS->directRenderingEnabled) {
9834 if((!pSiS->DualHeadMode) || (!pSiS->SecondHead))
9836 if(pSiS->ResetXv) {
9837 (pSiS->ResetXv)(pScrn);
9852 SISPtr pSiS = SISPTR(pScrn);
9856 if(pSiS->directRenderingEnabled) {
9863 if(pSiS->DualHeadMode && pSiS->SecondHead) return;
9866 if(pSiS->CursorInfoPtr) {
9868 if(pSiS->DualHeadMode) {
9869 if(!pSiS->SecondHead) {
9870 pSiS->ForceCursorOff = TRUE;
9871 pSiS->CursorInfoPtr->HideCursor(pScrn);
9873 pSiS->ForceCursorOff = FALSE;
9877 pSiS->CursorInfoPtr->HideCursor(pScrn);
9886 if(pSiS->UseVESA) {
9893 if((pSiS->VBFlags2 & VB2_VIDEOBRIDGE) && (!(pSiS->VBFlags & DISPTYPE_DISP2)))
9894 VBESetVBEMode(pSiS->pVbe, (pSiS->SISVESAModeList->n) | 0xc000, NULL);
9909 if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) {
9913 SISVGALock(pSiS);
9928 SISPtr pSiS = SISPTR(pScrn);
9930 SISEntPtr pSiSEnt = pSiS->entityPrivate;
9933 if(pSiS->SiSCtrlExtEntry) {
9934 SiSCtrlExtUnregister(pSiS, pScrn->scrnIndex);
9938 if(pSiS->directRenderingEnabled) {
9940 pSiS->directRenderingEnabled = FALSE;
9946 if(pSiS->CursorInfoPtr) {
9948 if(pSiS->DualHeadMode) {
9949 if(!pSiS->SecondHead) {
9950 pSiS->ForceCursorOff = TRUE;
9951 pSiS->CursorInfoPtr->HideCursor(pScrn);
9953 pSiS->ForceCursorOff = FALSE;
9957 pSiS->CursorInfoPtr->HideCursor(pScrn);
9966 if(pSiS->UseVESA) {
9973 if((pSiS->VBFlags2 & VB2_VIDEOBRIDGE) && (!(pSiS->VBFlags & DISPTYPE_DISP2)))
9974 VBESetVBEMode(pSiS->pVbe, (pSiS->SISVESAModeList->n) | 0xc000, NULL);
9984 SISVGALock(pSiS);
10003 if(pSiS->DualHeadMode) {
10004 pSiSEnt = pSiS->entityPrivate;
10009 if(pSiS->pInt) {
10010 xf86FreeInt10(pSiS->pInt);
10011 pSiS->pInt = NULL;
10015 if(!pSiS->useEXA) {
10016 if(pSiS->AccelLinearScratch) {
10017 xf86FreeOffscreenLinear(pSiS->AccelLinearScratch);
10018 pSiS->AccelLinearScratch = NULL;
10020 if(pSiS->AccelInfoPtr) {
10021 XAADestroyInfoRec(pSiS->AccelInfoPtr);
10022 pSiS->AccelInfoPtr = NULL;
10028 if(pSiS->useEXA) {
10029 if(pSiS->EXADriverPtr) {
10031 free(pSiS->EXADriverPtr);
10032 pSiS->EXADriverPtr = NULL;
10033 pSiS->exa_scratch = NULL;
10038 if(pSiS->CursorInfoPtr) {
10039 xf86DestroyCursorInfoRec(pSiS->CursorInfoPtr);
10040 pSiS->CursorInfoPtr = NULL;
10043 if(pSiS->ShadowPtr) {
10044 free(pSiS->ShadowPtr);
10045 pSiS->ShadowPtr = NULL;
10048 if(pSiS->DGAModes) {
10049 free(pSiS->DGAModes);
10050 pSiS->DGAModes = NULL;
10053 if(pSiS->adaptor) {
10054 free(pSiS->adaptor);
10055 pSiS->adaptor = NULL;
10056 pSiS->ResetXv = pSiS->ResetXvGamma = pSiS->ResetXvDisplay = NULL;
10059 if(pSiS->blitadaptor) {
10060 free(pSiS->blitadaptor);
10061 pSiS->blitadaptor = NULL;
10064 if(pSiS->crt2gcolortable) {
10065 free(pSiS->crt2gcolortable);
10066 pSiS->crt2gcolortable = NULL;
10069 if(pSiS->crt2cindices) {
10070 free(pSiS->crt2cindices);
10071 pSiS->crt2cindices = NULL;
10077 pScreen->BlockHandler = pSiS->BlockHandler;
10079 pScreen->CloseScreen = pSiS->CloseScreen;
10093 SISPtr pSiS = SISPTR(pScrn);
10095 if(pSiS) {
10097 SISEntPtr pSiSEnt = pSiS->entityPrivate;
10116 SISPtr pSiS = SISPTR(pScrn);
10118 if(pSiS->UseVESA) {
10125 if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) {
10127 if(pSiS->DualHeadMode) {
10128 if(pSiS->SecondHead) {
10129 if(SiS_CheckModeCRT1(pScrn, mode, pSiS->VBFlags, pSiS->HaveCustomModes) < 0x14)
10132 if(SiS_CheckModeCRT2(pScrn, mode, pSiS->VBFlags, pSiS->HaveCustomModes) < 0x14)
10138 if(pSiS->MergedFB) {
10140 if(!pSiS->CheckForCRT2) {
10141 if(SiS_CheckModeCRT1(pScrn, mode, pSiS->VBFlags, pSiS->HaveCustomModes) < 0x14)
10144 if(SiS_CheckModeCRT2(pScrn, mode, pSiS->VBFlags, pSiS->HaveCustomModes2) < 0x14)
10149 pSiS->VBFlags, pSiS->HaveCustomModes) < 0x14)
10153 pSiS->VBFlags, pSiS->HaveCustomModes2) < 0x14)
10159 if(SiS_CheckModeCRT1(pScrn, mode, pSiS->VBFlags, pSiS->HaveCustomModes) < 0x14)
10162 if(SiS_CheckModeCRT2(pScrn, mode, pSiS->VBFlags, pSiS->HaveCustomModes) < 0x14)
10210 SISPtr pSiS = SISPTR(pScrn);
10214 switch(pSiS->VGAEngine) {
10216 if((!pSiS->NoAccel) && (pSiS->TurboQueue)) {
10229 if(!pSiS->NoAccel) {
10262 SIS_MMIO_OUT32(pSiS->IOBase, 0x85c4, 0);
10264 if(pSiS->ChipType == XGI_20) {
10268 switch(pSiS->cmdQueueSize) {
10273 pSiS->cmdQueueSize = 512 * 1024;
10280 *(pSiS->cmdQ_SharedWritePort) = (unsigned int)(SIS_MMIO_IN32(pSiS->IOBase, 0x85c8));
10281 SIS_MMIO_OUT32(pSiS->IOBase, 0x85c4, (CARD32)(*(pSiS->cmdQ_SharedWritePort)));
10282 SIS_MMIO_OUT32(pSiS->IOBase, 0x85C0, pSiS->cmdQueueOffset);
10283 temp = (ULong)pSiS->RealFbBase;
10285 if(pSiS->DualHeadMode) {
10286 SISEntPtr pSiSEnt = pSiS->entityPrivate;
10290 temp += pSiS->cmdQueueOffset;
10291 pSiS->cmdQueueBase = (unsigned int *)temp;
10295 pSiS->cmdQueueOffset, pSiS->cmdQueueBase, *(pSiS->cmdQ_SharedWritePort),
10296 SIS_MMIO_IN32(pSiS->IOBase, 0x85cc), (ULong *)temp);
10305 temp = SIS_MMIO_IN32(pSiS->IOBase, 0x85C8);
10306 SIS_MMIO_OUT32(pSiS->IOBase, 0x85C4, temp);
10315 SIS_MMIO_OUT32(pSiS->IOBase, 0x85C0, temp);
10326 SiSRestoreQueueMode(SISPtr pSiS, SISRegPtr sisReg)
10330 if(pSiS->VGAEngine == SIS_315_VGA) {
10334 SIS_MMIO_OUT32(pSiS->IOBase, 0x85c4, 0);
10337 SIS_MMIO_OUT32(pSiS->IOBase, 0x85C0, sisReg->sisMMIO85C0);
10348 SISPtr pSiS = SISPTR(pScrn);
10354 ULong vbflag = pSiS->VBFlags;
10355 Bool hcm = pSiS->HaveCustomModes;
10358 pSiS->IsCustom = FALSE;
10365 if(pSiS->MergedFB) {
10372 hcm = pSiS->HaveCustomModes2;
10380 pSiS->IsCustom = TRUE;
10386 pSiS->IsCustom = TRUE;
10391 pSiS->IsCustom = TRUE;
10397 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); /* Unlock Registers */
10402 CR32 = pSiS->newCR32;
10405 if(pSiS->NewCRLayout) {
10419 if(pSiS->Chipset != PCI_CHIP_SIS300) {
10420 switch(pSiS->VGAEngine) {
10426 if(pSiS->VGAEngine == SIS_315_VGA) {
10437 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, SISVERBLEVEL, "VBFlags=0x%x\n", pSiS->VBFlags);
10444 if(!pSiS->NewCRLayout) {
10445 if(!pSiS->AllowHotkey) {
10451 SiS_SetEnableDstn(pSiS->SiS_Pr, FALSE);
10452 SiS_SetEnableFstn(pSiS->SiS_Pr, FALSE);
10466 if((pSiS->VBFlags2 & VB2_CHRONTEL) && (vbflag & TV_CHSCART)) { /* Chrontel */
10471 } else if((pSiS->VBFlags2 & VB2_CHRONTEL) && (vbflag & TV_CHYPBPR525I)) { /* Chrontel */
10476 if(pSiS->NewCRLayout) {
10481 if(pSiS->VGAEngine == SIS_315_VGA) {
10482 if(pSiS->VBFlags2 & VB2_SISYPBPRBRIDGE) {
10490 if(pSiS->NewCRLayout) {
10508 } else if(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPR) {
10518 if(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPRAR) {
10535 if( (pSiS->VBFlags2 & VB2_SISBRIDGE) ||
10536 ((pSiS->VBFlags2 & VB2_CHRONTEL) && (pSiS->ChrontelType == CHRONTEL_701x)) ) {
10560 pSiS->SiS_Pr->SiS_CHOverScan = pSiS->UseCHOverScan;
10561 if((pSiS->OptTVSOver == 1) && (pSiS->ChrontelType == CHRONTEL_700x)) {
10562 pSiS->SiS_Pr->SiS_CHSOverScan = TRUE;
10564 pSiS->SiS_Pr->SiS_CHSOverScan = FALSE;
10573 SiS_SetEnableDstn(pSiS->SiS_Pr, pSiS->DSTN);
10574 SiS_SetEnableFstn(pSiS->SiS_Pr, pSiS->FSTN);
10584 if(pSiS->UseVESA) {
10617 if(pSiS->UseVESA) {
10627 if(!pSiS->IsCustom) {
10656 if((!pSiS->UseVESA) && (vbflag & CRT2_ENABLE)) {
10657 if(pSiS->CRT1off) CR33 &= 0xf0;
10660 if(pSiS->NewCRLayout) {
10683 if(pSiS->VGAEngine == SIS_315_VGA) {
10693 pSiS->SiS_Pr->SiS_UseOEM = pSiS->OptUseOEM;
10697 if(pSiS->VGAEngine != SIS_315_VGA)
10701 if((!pSiS->UseVESA) && (pSiS->VBFlags & CRT2_ENABLE)) {
10748 SISPtr pSiS = SISPTR(pScrn);
10750 SISEntPtr pSiSEnt = pSiS->entityPrivate;
10753 pSiS->chtvlumabandwidthcvbs = val;
10758 if(!(pSiS->VBFlags & CRT2_TV)) return;
10759 if(!(pSiS->VBFlags2 & VB2_CHRONTEL)) return;
10762 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
10765 switch(pSiS->ChrontelType) {
10769 SiS_SetCH70xxANDOR(pSiS->SiS_Pr, 0x03, val, 0xFE);
10775 SiS_SetCH70xxANDOR(pSiS->SiS_Pr, 0x02, val, 0xFC);
10783 SISPtr pSiS = SISPTR(pScrn);
10785 SISEntPtr pSiSEnt = pSiS->entityPrivate;
10788 if(!((pSiS->VBFlags2 & VB2_CHRONTEL) && (pSiS->VBFlags & CRT2_TV))) {
10790 if(pSiSEnt && pSiS->DualHeadMode)
10794 return (int)pSiS->chtvlumabandwidthcvbs;
10797 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
10799 switch(pSiS->ChrontelType) {
10801 return (int)((SiS_GetCH70xx(pSiS->SiS_Pr, 0x03) & 0x01) * 8);
10803 return (int)((SiS_GetCH70xx(pSiS->SiS_Pr, 0x02) & 0x03) * 4);
10805 return (int)pSiS->chtvlumabandwidthcvbs;
10812 SISPtr pSiS = SISPTR(pScrn);
10814 SISEntPtr pSiSEnt = pSiS->entityPrivate;
10817 pSiS->chtvlumabandwidthsvideo = val;
10822 if(!(pSiS->VBFlags & CRT2_TV)) return;
10823 if(!(pSiS->VBFlags2 & VB2_CHRONTEL)) return;
10826 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
10829 switch(pSiS->ChrontelType) {
10833 SiS_SetCH70xxANDOR(pSiS->SiS_Pr, 0x03, (val << 1), 0xF9);
10839 SiS_SetCH70xxANDOR(pSiS->SiS_Pr, 0x02, (val << 2), 0xF3);
10847 SISPtr pSiS = SISPTR(pScrn);
10849 SISEntPtr pSiSEnt = pSiS->entityPrivate;
10852 if(!((pSiS->VBFlags2 & VB2_CHRONTEL) && (pSiS->VBFlags & CRT2_TV))) {
10854 if(pSiSEnt && pSiS->DualHeadMode)
10858 return (int)pSiS->chtvlumabandwidthsvideo;
10861 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
10863 switch(pSiS->ChrontelType) {
10865 return (int)(((SiS_GetCH70xx(pSiS->SiS_Pr, 0x03) & 0x06) >> 1) * 6);
10867 return (int)(((SiS_GetCH70xx(pSiS->SiS_Pr, 0x02) & 0x0c) >> 2) * 4);
10869 return (int)pSiS->chtvlumabandwidthsvideo;
10876 SISPtr pSiS = SISPTR(pScrn);
10878 SISEntPtr pSiSEnt = pSiS->entityPrivate;
10881 pSiS->chtvlumaflickerfilter = val;
10886 if(!(pSiS->VBFlags & CRT2_TV)) return;
10887 if(!(pSiS->VBFlags2 & VB2_CHRONTEL)) return;
10890 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
10893 switch(pSiS->ChrontelType) {
10898 reg = SiS_GetCH70xx(pSiS->SiS_Pr, 0x01);
10900 SiS_SetCH70xx(pSiS->SiS_Pr, 0x01, reg);
10906 SiS_SetCH70xxANDOR(pSiS->SiS_Pr, 0x01, (val << 2), 0xF3);
10914 SISPtr pSiS = SISPTR(pScrn);
10916 SISEntPtr pSiSEnt = pSiS->entityPrivate;
10919 if(!((pSiS->VBFlags2 & VB2_CHRONTEL) && (pSiS->VBFlags & CRT2_TV))) {
10921 if(pSiSEnt && pSiS->DualHeadMode)
10925 return (int)pSiS->chtvlumaflickerfilter;
10928 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
10930 switch(pSiS->ChrontelType) {
10932 return (int)((SiS_GetCH70xx(pSiS->SiS_Pr, 0x01) & 0x03) * 6);
10934 return (int)(((SiS_GetCH70xx(pSiS->SiS_Pr, 0x01) & 0x0c) >> 2) * 4);
10936 return (int)pSiS->chtvlumaflickerfilter;
10943 SISPtr pSiS = SISPTR(pScrn);
10945 SISEntPtr pSiSEnt = pSiS->entityPrivate;
10948 pSiS->chtvchromabandwidth = val;
10953 if(!(pSiS->VBFlags & CRT2_TV)) return;
10954 if(!(pSiS->VBFlags2 & VB2_CHRONTEL)) return;
10957 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
10960 switch(pSiS->ChrontelType) {
10964 SiS_SetCH70xxANDOR(pSiS->SiS_Pr, 0x03, (val << 4), 0xCF);
10970 SiS_SetCH70xxANDOR(pSiS->SiS_Pr, 0x02, (val << 4), 0xEF);
10978 SISPtr pSiS = SISPTR(pScrn);
10980 SISEntPtr pSiSEnt = pSiS->entityPrivate;
10983 if(!((pSiS->VBFlags2 & VB2_CHRONTEL) && (pSiS->VBFlags & CRT2_TV))) {
10985 if(pSiSEnt && pSiS->DualHeadMode)
10989 return (int)pSiS->chtvchromabandwidth;
10992 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
10994 switch(pSiS->ChrontelType) {
10996 return (int)(((SiS_GetCH70xx(pSiS->SiS_Pr, 0x03) & 0x30) >> 4) * 4);
10998 return (int)(((SiS_GetCH70xx(pSiS->SiS_Pr, 0x02) & 0x10) >> 4) * 8);
11000 return (int)pSiS->chtvchromabandwidth;
11007 SISPtr pSiS = SISPTR(pScrn);
11009 SISEntPtr pSiSEnt = pSiS->entityPrivate;
11012 pSiS->chtvchromaflickerfilter = val;
11017 if(!(pSiS->VBFlags & CRT2_TV)) return;
11018 if(!(pSiS->VBFlags2 & VB2_CHRONTEL)) return;
11021 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11024 switch(pSiS->ChrontelType) {
11029 reg = SiS_GetCH70xx(pSiS->SiS_Pr, 0x01);
11031 SiS_SetCH70xx(pSiS->SiS_Pr, 0x01, reg);
11037 SiS_SetCH70xxANDOR(pSiS->SiS_Pr, 0x01, (val << 4), 0xCF);
11045 SISPtr pSiS = SISPTR(pScrn);
11047 SISEntPtr pSiSEnt = pSiS->entityPrivate;
11050 if(!((pSiS->VBFlags2 & VB2_CHRONTEL) && (pSiS->VBFlags & CRT2_TV))) {
11052 if(pSiSEnt && pSiS->DualHeadMode)
11056 return (int)pSiS->chtvchromaflickerfilter;
11059 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11061 switch(pSiS->ChrontelType) {
11063 return (int)(((SiS_GetCH70xx(pSiS->SiS_Pr, 0x01) & 0x30) >> 4) * 6);
11065 return (int)(((SiS_GetCH70xx(pSiS->SiS_Pr, 0x01) & 0x30) >> 4) * 4);
11067 return (int)pSiS->chtvchromaflickerfilter;
11074 SISPtr pSiS = SISPTR(pScrn);
11076 SISEntPtr pSiSEnt = pSiS->entityPrivate;
11079 pSiS->chtvcvbscolor = val ? 1 : 0;
11081 if(pSiSEnt) pSiSEnt->chtvcvbscolor = pSiS->chtvcvbscolor;
11084 if(!(pSiS->VBFlags & CRT2_TV)) return;
11085 if(!(pSiS->VBFlags2 & VB2_CHRONTEL)) return;
11088 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11091 switch(pSiS->ChrontelType) {
11093 if(!val) SiS_SetCH70xxANDOR(pSiS->SiS_Pr, 0x03, 0x40, 0x00);
11094 else SiS_SetCH70xxANDOR(pSiS->SiS_Pr, 0x03, 0x00, ~0x40);
11097 if(!val) SiS_SetCH70xxANDOR(pSiS->SiS_Pr, 0x02, 0x00, ~0x20);
11098 else SiS_SetCH70xxANDOR(pSiS->SiS_Pr, 0x02, 0x20, 0x00);
11105 SISPtr pSiS = SISPTR(pScrn);
11107 SISEntPtr pSiSEnt = pSiS->entityPrivate;
11110 if(!((pSiS->VBFlags2 & VB2_CHRONTEL) && (pSiS->VBFlags & CRT2_TV))) {
11112 if(pSiSEnt && pSiS->DualHeadMode)
11116 return (int)pSiS->chtvcvbscolor;
11119 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11121 switch(pSiS->ChrontelType) {
11123 return (int)(((SiS_GetCH70xx(pSiS->SiS_Pr, 0x03) & 0x40) >> 6) ^ 0x01);
11125 return (int)(((SiS_GetCH70xx(pSiS->SiS_Pr, 0x02) & 0x20) >> 5) ^ 0x01);
11127 return (int)pSiS->chtvcvbscolor;
11134 SISPtr pSiS = SISPTR(pScrn);
11136 SISEntPtr pSiSEnt = pSiS->entityPrivate;
11139 pSiS->chtvtextenhance = val;
11144 if(!(pSiS->VBFlags & CRT2_TV)) return;
11145 if(!(pSiS->VBFlags2 & VB2_CHRONTEL)) return;
11148 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11151 switch(pSiS->ChrontelType) {
11156 reg = SiS_GetCH70xx(pSiS->SiS_Pr, 0x01);
11158 SiS_SetCH70xx(pSiS->SiS_Pr, 0x01, reg);
11164 SiS_SetCH70xxANDOR(pSiS->SiS_Pr, 0x03, val, 0xF8);
11172 SISPtr pSiS = SISPTR(pScrn);
11174 SISEntPtr pSiSEnt = pSiS->entityPrivate;
11177 if(!((pSiS->VBFlags2 & VB2_CHRONTEL) && (pSiS->VBFlags & CRT2_TV))) {
11179 if(pSiSEnt && pSiS->DualHeadMode)
11183 return (int)pSiS->chtvtextenhance;
11186 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11188 switch(pSiS->ChrontelType) {
11190 return (int)(((SiS_GetCH70xx(pSiS->SiS_Pr, 0x01) & 0x0c) >> 2) * 6);
11192 return (int)((SiS_GetCH70xx(pSiS->SiS_Pr, 0x03) & 0x07) * 2);
11194 return (int)pSiS->chtvtextenhance;
11201 SISPtr pSiS = SISPTR(pScrn);
11203 SISEntPtr pSiSEnt = pSiS->entityPrivate;
11206 pSiS->chtvcontrast = val;
11211 if(!(pSiS->VBFlags & CRT2_TV)) return;
11212 if(!(pSiS->VBFlags2 & VB2_CHRONTEL)) return;
11215 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11220 switch(pSiS->ChrontelType) {
11222 SiS_SetCH70xxANDOR(pSiS->SiS_Pr, 0x11, val, 0xF8);
11225 SiS_SetCH70xxANDOR(pSiS->SiS_Pr, 0x08, val, 0xF8);
11228 SiS_DDC2Delay(pSiS->SiS_Pr, 1000);
11234 SISPtr pSiS = SISPTR(pScrn);
11236 SISEntPtr pSiSEnt = pSiS->entityPrivate;
11239 if(!((pSiS->VBFlags2 & VB2_CHRONTEL) && (pSiS->VBFlags & CRT2_TV))) {
11241 if(pSiSEnt && pSiS->DualHeadMode)
11245 return (int)pSiS->chtvcontrast;
11248 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11250 switch(pSiS->ChrontelType) {
11252 return (int)((SiS_GetCH70xx(pSiS->SiS_Pr, 0x11) & 0x07) * 2);
11254 return (int)((SiS_GetCH70xx(pSiS->SiS_Pr, 0x08) & 0x07) * 2);
11256 return (int)pSiS->chtvcontrast;
11263 SISPtr pSiS = SISPTR(pScrn);
11265 SISEntPtr pSiSEnt = pSiS->entityPrivate;
11268 pSiS->sistvedgeenhance = val;
11273 if(!(pSiS->VBFlags2 & VB2_301)) return;
11274 if(!(pSiS->VBFlags & CRT2_TV)) return;
11277 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11288 SISPtr pSiS = SISPTR(pScrn);
11289 int result = pSiS->sistvedgeenhance;
11292 SISEntPtr pSiSEnt = pSiS->entityPrivate;
11294 if(pSiSEnt && pSiS->DualHeadMode) result = pSiSEnt->sistvedgeenhance;
11297 if(!(pSiS->VBFlags2 & VB2_301)) return result;
11298 if(!(pSiS->VBFlags & CRT2_TV)) return result;
11301 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11309 SISPtr pSiS = SISPTR(pScrn);
11311 SISEntPtr pSiSEnt = pSiS->entityPrivate;
11314 pSiS->sistvantiflicker = val;
11319 if(!(pSiS->VBFlags & CRT2_TV)) return;
11320 if(!(pSiS->VBFlags2 & VB2_SISBRIDGE)) return;
11321 if(pSiS->VBFlags & TV_HIVISION) return;
11322 if((pSiS->VBFlags & TV_YPBPR) &&
11323 (pSiS->VBFlags & (TV_YPBPR525P | TV_YPBPR625P | TV_YPBPR750P | TV_YPBPR1080I))) return;
11326 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11337 SISPtr pSiS = SISPTR(pScrn);
11338 int result = pSiS->sistvantiflicker;
11341 SISEntPtr pSiSEnt = pSiS->entityPrivate;
11343 if(pSiSEnt && pSiS->DualHeadMode) result = pSiSEnt->sistvantiflicker;
11346 if(!(pSiS->VBFlags2 & VB2_SISBRIDGE)) return result;
11347 if(!(pSiS->VBFlags & CRT2_TV)) return result;
11348 if(pSiS->VBFlags & TV_HIVISION) return result;
11349 if((pSiS->VBFlags & TV_YPBPR) &&
11350 (pSiS->VBFlags & (TV_YPBPR525P | TV_YPBPR625P | TV_YPBPR750P | TV_YPBPR1080I))) return result;
11353 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11361 SISPtr pSiS = SISPTR(pScrn);
11363 SISEntPtr pSiSEnt = pSiS->entityPrivate;
11366 pSiS->sistvsaturation = val;
11371 if(!(pSiS->VBFlags & CRT2_TV)) return;
11372 if(!(pSiS->VBFlags2 & VB2_SISBRIDGE)) return;
11373 if(pSiS->VBFlags2 & VB2_301) return;
11376 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11387 SISPtr pSiS = SISPTR(pScrn);
11388 int result = pSiS->sistvsaturation;
11391 SISEntPtr pSiSEnt = pSiS->entityPrivate;
11393 if(pSiSEnt && pSiS->DualHeadMode) result = pSiSEnt->sistvsaturation;
11396 if(!(pSiS->VBFlags2 & VB2_SISBRIDGE)) return result;
11397 if(pSiS->VBFlags2 & VB2_301) return result;
11398 if(!(pSiS->VBFlags & CRT2_TV)) return result;
11401 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11409 SISPtr pSiS = SISPTR(pScrn);
11411 SISEntPtr pSiSEnt = pSiS->entityPrivate;
11413 int ccoarse, cfine, cbase = pSiS->sistvccbase;
11417 if(pSiSEnt && pSiS->DualHeadMode) cbase = pSiSEnt->sistvccbase;
11421 pSiS->sistvcolcalibc = ccoarse = val;
11422 cfine = pSiS->sistvcolcalibf;
11426 if(pSiS->DualHeadMode) cfine = pSiSEnt->sistvcolcalibf;
11430 pSiS->sistvcolcalibf = cfine = val;
11431 ccoarse = pSiS->sistvcolcalibc;
11435 if(pSiS->DualHeadMode) ccoarse = pSiSEnt->sistvcolcalibc;
11440 if(!(pSiS->VBFlags & CRT2_TV)) return;
11441 if(!(pSiS->VBFlags2 & VB2_SISBRIDGE)) return;
11442 if(pSiS->VBFlags & (TV_HIVISION | TV_YPBPR)) return;
11445 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11454 if(pSiS->VBFlags & TV_NTSC) finalcc += 0x21ed8620;
11455 else if(pSiS->VBFlags & TV_PALM) finalcc += ?;
11456 else if(pSiS->VBFlags & TV_PALM) finalcc += ?;
11469 SISPtr pSiS = SISPTR(pScrn);
11471 SISEntPtr pSiSEnt = pSiS->entityPrivate;
11473 if(pSiSEnt && pSiS->DualHeadMode)
11478 if(coarse) return (int)pSiS->sistvcolcalibc;
11479 else return (int)pSiS->sistvcolcalibf;
11484 SISPtr pSiS = SISPTR(pScrn);
11486 SISEntPtr pSiSEnt = pSiS->entityPrivate;
11489 pSiS->sistvcfilter = val ? 1 : 0;
11491 if(pSiSEnt) pSiSEnt->sistvcfilter = pSiS->sistvcfilter;
11494 if(!(pSiS->VBFlags & CRT2_TV)) return;
11495 if(!(pSiS->VBFlags2 & VB2_SISBRIDGE)) return;
11496 if(pSiS->VBFlags & (TV_HIVISION | TV_YPBPR)) return;
11499 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11502 setSISIDXREG(SISPART2,0x30,~0x10,((pSiS->sistvcfilter << 4) & 0x10));
11507 SISPtr pSiS = SISPTR(pScrn);
11508 int result = pSiS->sistvcfilter;
11511 SISEntPtr pSiSEnt = pSiS->entityPrivate;
11513 if(pSiSEnt && pSiS->DualHeadMode) result = pSiSEnt->sistvcfilter;
11516 if(!(pSiS->VBFlags2 & VB2_SISBRIDGE)) return result;
11517 if(!(pSiS->VBFlags & CRT2_TV)) return result;
11518 if(pSiS->VBFlags & (TV_HIVISION | TV_YPBPR)) return result;
11521 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11529 SISPtr pSiS = SISPTR(pScrn);
11531 SISEntPtr pSiSEnt = pSiS->entityPrivate;
11536 pSiS->sistvyfilter = val;
11538 if(pSiSEnt) pSiSEnt->sistvyfilter = pSiS->sistvyfilter;
11541 if(!(pSiS->VBFlags & CRT2_TV)) return;
11542 if(!(pSiS->VBFlags2 & VB2_SISBRIDGE)) return;
11543 if(pSiS->VBFlags & (TV_HIVISION | TV_YPBPR)) return;
11545 p35 = pSiS->p2_35; p36 = pSiS->p2_36;
11546 p37 = pSiS->p2_37; p38 = pSiS->p2_38;
11547 p48 = pSiS->p2_48; p49 = pSiS->p2_49;
11548 p4a = pSiS->p2_4a; p30 = pSiS->p2_30;
11550 if(pSiSEnt && pSiS->DualHeadMode) {
11560 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11563 switch(pSiS->sistvyfilter) {
11572 if(!(pSiS->VBFlags2 & VB2_301)) {
11586 if(!(pSiS->VBFlags & (TV_PALM | TV_PALN | TV_NTSCJ))) {
11599 yindex301 = (pSiS->VBFlags & TV_NTSC) ? 0 : 4;
11607 yindex301 = (pSiS->VBFlags & TV_NTSC) ? 1 : 5;
11608 yindex301B = (pSiS->VBFlags & TV_NTSC) ? 0 : 4;
11619 yindex301 = (pSiS->VBFlags & TV_NTSC) ? 2 : 6;
11620 yindex301B = (pSiS->VBFlags & TV_NTSC) ? 1 : 5;
11628 yindex301 = (pSiS->VBFlags & TV_NTSC) ? 3 : 7;
11629 yindex301B = (pSiS->VBFlags & TV_NTSC) ? 2 : 6;
11637 yindex301B = (pSiS->VBFlags & TV_NTSC) ? 3 : 7;
11640 if(pSiS->VBFlags2 & VB2_301) {
11643 outSISIDXREG(SISPART2,j,(SiSTVFilter301[yindex301].filter[pSiS->sistvyfilter-2][i]));
11649 outSISIDXREG(SISPART2,j,(SiSTVFilter301B[yindex301B].filter[pSiS->sistvyfilter-2][i]));
11652 outSISIDXREG(SISPART2,j,(SiSTVFilter301B[yindex301B].filter[pSiS->sistvyfilter-2][i]));
11663 SISPtr pSiS = SISPTR(pScrn);
11665 SISEntPtr pSiSEnt = pSiS->entityPrivate;
11667 if(pSiSEnt && pSiS->DualHeadMode)
11671 return (int)pSiS->sistvyfilter;
11676 SISPtr pSiS = SISPTR(pScrn);
11679 pSiS->sistvantiflicker = val;
11681 if(!(pSiS->SiS6326Flags & SIS6326_TVDETECTED)) return;
11684 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11700 SISPtr pSiS = SISPTR(pScrn);
11703 if(!(pSiS->SiS6326Flags & SIS6326_TVDETECTED)) {
11704 return (int)pSiS->sistvantiflicker;
11708 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11713 return (int)pSiS->sistvantiflicker;
11721 SISPtr pSiS = SISPTR(pScrn);
11725 pSiS->sis6326enableyfilter = val;
11727 if(!(pSiS->SiS6326Flags & SIS6326_TVDETECTED)) return;
11730 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11744 SISPtr pSiS = SISPTR(pScrn);
11747 if(!(pSiS->SiS6326Flags & SIS6326_TVDETECTED)) {
11748 return (int)pSiS->sis6326enableyfilter;
11752 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11757 return (int)pSiS->sis6326enableyfilter;
11766 SISPtr pSiS = SISPTR(pScrn);
11770 pSiS->sis6326yfilterstrong = val;
11772 if(!(pSiS->SiS6326Flags & SIS6326_TVDETECTED)) return;
11775 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11791 SISPtr pSiS = SISPTR(pScrn);
11794 if(!(pSiS->SiS6326Flags & SIS6326_TVDETECTED)) {
11795 return (int)pSiS->sis6326yfilterstrong;
11799 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11804 return (int)pSiS->sis6326yfilterstrong;
11808 return (int)pSiS->sis6326yfilterstrong;
11817 SISPtr pSiS = SISPTR(pScrn);
11819 SISEntPtr pSiSEnt = pSiS->entityPrivate;
11823 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11826 pSiS->tvxpos = val;
11831 if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) {
11833 if(pSiS->VBFlags & CRT2_TV) {
11835 if(pSiS->VBFlags2 & VB2_CHRONTEL) {
11837 int x = pSiS->tvx;
11839 if(pSiSEnt && pSiS->DualHeadMode) x = pSiSEnt->tvx;
11841 switch(pSiS->ChrontelType) {
11846 SiS_SetCH700x(pSiS->SiS_Pr, 0x0a, (x & 0xff));
11847 SiS_SetCH70xxANDOR(pSiS->SiS_Pr, 0x08, ((x & 0x0100) >> 7), 0xFD);
11855 } else if(pSiS->VBFlags2 & VB2_SISBRIDGE) {
11863 p2_1f = pSiS->p2_1f;
11864 p2_20 = pSiS->p2_20;
11865 p2_2b = pSiS->p2_2b;
11866 p2_42 = pSiS->p2_42;
11867 p2_43 = pSiS->p2_43;
11869 if(pSiSEnt && pSiS->DualHeadMode) {
11878 if(pSiS->VBFlags & TV_YPBPR) {
11879 if(pSiS->VBFlags & (TV_YPBPR1080I | TV_YPBPR750P)) {
11903 } else if(pSiS->Chipset == PCI_CHIP_SIS6326) {
11905 if(pSiS->SiS6326Flags & SIS6326_TVDETECTED) {
11913 temp1 = pSiS->tvx1;
11914 temp2 = pSiS->tvx2;
11915 temp3 = pSiS->tvx3;
11954 SISPtr pSiS = SISPTR(pScrn);
11956 SISEntPtr pSiSEnt = pSiS->entityPrivate;
11958 if(pSiSEnt && pSiS->DualHeadMode)
11962 return (int)pSiS->tvxpos;
11967 SISPtr pSiS = SISPTR(pScrn);
11969 SISEntPtr pSiSEnt = pSiS->entityPrivate;
11973 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
11976 pSiS->tvypos = val;
11981 if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) {
11983 if(pSiS->VBFlags & CRT2_TV) {
11985 if(pSiS->VBFlags2 & VB2_CHRONTEL) {
11987 int y = pSiS->tvy;
11989 if(pSiSEnt && pSiS->DualHeadMode) y = pSiSEnt->tvy;
11991 switch(pSiS->ChrontelType) {
11996 SiS_SetCH700x(pSiS->SiS_Pr, 0x0b, (y & 0xff));
11997 SiS_SetCH70xxANDOR(pSiS->SiS_Pr, 0x08, ((y & 0x0100) >> 8), 0xFE);
12005 } else if(pSiS->VBFlags2 & VB2_SISBRIDGE) {
12010 if( (pSiS->VBFlags & TV_HIVISION) ||
12011 ((pSiS->VBFlags & TV_YPBPR) && (pSiS->VBFlags & (TV_YPBPR1080I|TV_YPBPR750P))) ) {
12017 p2_01 = pSiS->p2_01;
12018 p2_02 = pSiS->p2_02;
12020 if(pSiSEnt && pSiS->DualHeadMode) {
12027 if(!(pSiS->VBFlags & (TV_YPBPR | TV_HIVISION))) {
12032 } else if((pSiS->VBFlags & TV_YPBPR) && (pSiS->VBFlags & TV_YPBPR1080I)) {
12037 } else if((pSiS->VBFlags & TV_YPBPR) && (pSiS->VBFlags & TV_YPBPR750P)) {
12052 } else if(pSiS->Chipset == PCI_CHIP_SIS6326) {
12054 if(pSiS->SiS6326Flags & SIS6326_TVDETECTED) {
12063 temp1 = (UShort)pSiS->tvy1;
12064 limit = (pSiS->SiS6326Flags & SIS6326_TVPAL) ? 625 : 525;
12080 if(pSiS->SiS6326Flags & SIS6326_TVPAL) {
12099 SISPtr pSiS = SISPTR(pScrn);
12101 SISEntPtr pSiSEnt = pSiS->entityPrivate;
12103 if(pSiSEnt && pSiS->DualHeadMode)
12107 return (int)pSiS->tvypos;
12112 SISPtr pSiS = SISPTR(pScrn);
12114 SISEntPtr pSiSEnt = pSiS->entityPrivate;
12118 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
12121 pSiS->tvxscale = val;
12126 if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) {
12128 if((pSiS->VBFlags & CRT2_TV) && (pSiS->VBFlags2 & VB2_SISBRIDGE)) {
12135 p2_44 = pSiS->p2_44;
12136 p2_45 = pSiS->p2_45 & 0x3f;
12137 p2_46 = pSiS->p2_46 & 0x07;
12139 if(pSiSEnt && pSiS->DualHeadMode) {
12148 if(pSiS->VBFlags & TV_YPBPR) {
12149 if(pSiS->VBFlags & TV_YPBPR1080I) {
12151 } else if(pSiS->VBFlags & TV_YPBPR750P) {
12154 } else if(pSiS->VBFlags & TV_HIVISION) {
12176 if(!(pSiS->VBFlags2 & VB2_301)) {
12189 SISPtr pSiS = SISPTR(pScrn);
12191 SISEntPtr pSiSEnt = pSiS->entityPrivate;
12193 if(pSiSEnt && pSiS->DualHeadMode)
12197 return (int)pSiS->tvxscale;
12202 SISPtr pSiS = SISPTR(pScrn);
12204 SISEntPtr pSiSEnt = pSiS->entityPrivate;
12208 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
12214 pSiS->tvyscale = val;
12219 if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) {
12221 if((pSiS->VBFlags & CRT2_TV) && (pSiS->VBFlags2 & VB2_SISBRIDGE)) {
12232 SiS_UnLockCRT2(pSiS->SiS_Pr);
12234 if((pSiS->VBFlags & TV_YPBPR) && (pSiS->VBFlags & TV_YPBPR525P)) {
12238 } else if((pSiS->VBFlags & TV_YPBPR) && (pSiS->VBFlags & TV_YPBPR625P)) {
12241 } else if((pSiS->VBFlags & TV_YPBPR) && (pSiS->VBFlags & TV_YPBPR750P)) {
12245 } else if(((pSiS->VBFlags & TV_YPBPR) && (pSiS->VBFlags & TV_YPBPR1080I)) ||
12246 (pSiS->VBFlags & TV_HIVISION)) {
12251 if( ((pSiS->VBFlags & TV_YPBPR) && (pSiS->VBFlags & TV_YPBPR525I)) ||
12252 ((!(pSiS->VBFlags & TV_YPBPR)) && (pSiS->VBFlags & (TV_NTSC | TV_PALM))) ) {
12341 if(pSiS->VGAEngine == SIS_315_VGA && is1080i) {
12396 if(pSiS->tvyscale != 0) {
12399 if(SiSTVVScale[srindex+i].sindex == pSiS->tvyscale) {
12405 if(pSiS->tvyscale > 0) pSiS->tvyscale--;
12406 else pSiS->tvyscale++;
12411 if(pSiSEnt) pSiSEnt->tvyscale = pSiS->tvyscale;
12414 if(pSiS->tvyscale == 0) {
12415 UChar p2_0a = pSiS->p2_0a;
12416 UChar p2_2f = pSiS->p2_2f;
12417 UChar p2_30 = pSiS->p2_30;
12418 UChar p2_46 = pSiS->p2_46;
12419 UChar p2_47 = pSiS->p2_47;
12424 p1scaling[i] = pSiS->scalingp1[i];
12425 p4scaling[i] = pSiS->scalingp4[i];
12427 p2scaling = &pSiS->scalingp2[0];
12430 if(pSiSEnt && pSiS->DualHeadMode) {
12444 if(pSiS->VBFlags2 & VB2_SISTAP4SCALER) {
12459 if(!(pSiS->VBFlags2 & VB2_301)) {
12482 myypos = pSiS->tvypos - 1;
12484 if(pSiSEnt && pSiS->DualHeadMode) myypos = pSiSEnt->tvypos - 1;
12492 if(pSiS->VBFlags2 & VB2_SISTAP4SCALER) {
12493 SiS_CalcXTapScaler(pSiS->SiS_Pr, realvde, newvde, 4, FALSE);
12496 if(!(pSiS->VBFlags2 & VB2_301)) {
12505 if(pSiS->VGAEngine == SIS_300_VGA) {
12514 if((pSiS->VGAEngine == SIS_315_VGA) && hdclk) temp1 >>= 1;
12520 if(pSiS->VGAEngine == SIS_300_VGA) {
12539 if(pSiS->VGAEngine == SIS_315_VGA) temp1--;
12542 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->ChipType >= SIS_661)) {
12597 SISPtr pSiS = SISPTR(pScrn);
12599 SISEntPtr pSiSEnt = pSiS->entityPrivate;
12601 if(pSiSEnt && pSiS->DualHeadMode)
12605 return (int)pSiS->tvyscale;
12610 SISPtr pSiS = SISPTR(pScrn);
12612 SISEntPtr pSiSEnt = pSiS->entityPrivate;
12615 pSiS->siscrt1satgain = val;
12620 if(!(pSiS->SiS_SD3_Flags & SiS_SD3_CRT1SATGAIN)) return;
12623 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
12633 SISPtr pSiS = SISPTR(pScrn);
12634 int result = pSiS->siscrt1satgain;
12637 SISEntPtr pSiSEnt = pSiS->entityPrivate;
12639 if(pSiSEnt && pSiS->DualHeadMode) result = pSiSEnt->siscrt1satgain;
12642 if(!(pSiS->SiS_SD3_Flags & SiS_SD3_CRT1SATGAIN)) return result;
12645 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
12670 SiS_SetDHFlags(SISPtr pSiS, unsigned int misc, unsigned int sd2)
12672 SISEntPtr pSiSEnt = pSiS->entityPrivate;
12674 if(pSiS->DualHeadMode) {
12699 SISPtr pSiS = SISPTR(pScrn);
12701 SISEntPtr pSiSEnt = pSiS->entityPrivate;
12711 "CRT1off is %d\n", pSiS->CRT1off);
12713 pSiS->CRT1isoff = pSiS->CRT1off;
12716 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
12723 if((!pSiS->UseVESA) && (pSiS->VBFlags & CRT2_ENABLE)) {
12725 if(pSiS->VBFlags != pSiS->VBFlags_backup) {
12726 pSiS->VBFlags = pSiS->VBFlags_backup;
12728 "VBFlags restored to %0x\n", pSiS->VBFlags);
12736 if(!pSiS->DualHeadMode) {
12740 temp = pSiS->VBFlags;
12741 pSiS->VBFlags &= (~VB_DISPMODE_SINGLE);
12742 pSiS->VBFlags |= (VB_DISPMODE_MIRROR | DISPTYPE_DISP1);
12743 if(temp != pSiS->VBFlags) {
12745 "VBFlags changed to 0x%0x\n", pSiS->VBFlags);
12752 if(pSiS->VGAEngine == SIS_315_VGA) {
12754 if((pSiS->CRT1off) && (doit)) {
12755 orSISIDXREG(SISCR,pSiS->myCR63,0x40);
12767 andSISIDXREG(SISCR,pSiS->myCR63,0xBF);
12776 if(pSiS->CRT1off) {
12804 if(!pSiS->DualHeadMode) {
12806 if((pSiS->VGAEngine == SIS_315_VGA) && (pSiS->VBFlags2 & VB2_SISLCDABRIDGE)) {
12807 if((!pSiS->UseVESA) && (!(pSiS->VBFlags & CRT2_ENABLE)) && (pSiS->VBFlags & CRT1_LCDA)) {
12818 pSiS->MiscFlags &= ~( MISC_CRT1OVERLAY |
12826 pSiS->SiS_SD2_Flags &= ~SiS_SD2_SIS760ONEOVL;
12829 if(pSiS->DualHeadMode) {
12854 if(!pSiS->NoXvideo) {
12871 if((!IsInSlaveMode) && (pSiS->VBFlags & CRT2_ENABLE)) {
12872 if(pSiS->VBFlags2 & VB2_SISBRIDGE) {
12890 switch(pSiS->ChipType) {
12915 if(pSiS->ChipFlags & SiSCF_760LFB) { /* LFB only or hybrid */
12920 if(pSiS->SiS_SD2_Flags & SiS_SD2_SUPPORT760OO) { /* UMA only */
12925 if(pSiS->VBFlags & DISPTYPE_CRT1) dotclocksum += myclock1;
12926 if((!IsInSlaveMode) && (pSiS->VBFlags & CRT2_ENABLE)) dotclocksum += myclock2;
12936 if( (pSiS->VBFlags & DISPTYPE_CRT1) &&
12937 (pSiS->VBFlags & CRT2_ENABLE) &&
12946 } else if(pSiS->MemClock < 150000) {
12953 } else if(pSiS->MemClock < 170000) {
12956 switch(pSiS->CurrentLayout.bitsPerPixel) {
12965 } else if(pSiS->MemClock < 210000) {
12968 switch(pSiS->CurrentLayout.bitsPerPixel) {
12987 pSiS->MiscFlags |= tmpflags;
12989 pSiS->MiscFlags |= MISC_SIS760ONEOVERLAY;
12990 pSiS->SiS_SD2_Flags |= SiS_SD2_SIS760ONEOVL;
12992 SiS_SetDHFlags(pSiS, (tmpflags | MISC_SIS760ONEOVERLAY), SiS_SD2_SIS760ONEOVL);
12999 NoOverlay ? "no" : ((pSiS->MiscFlags & MISC_SIS760ONEOVERLAY) ? "one" : "two"));
13003 pSiS->MemClock, myclock1, mycoldepth1,
13004 myclock2, mycoldepth2, dotclocksum, pSiS->SiS_SD2_Flags);
13011 if(pSiS->ChipFlags & SiSCF_760LFB) { /* LFB only */
13038 pSiS->MiscFlags |= tmpflags;
13040 SiS_SetDHFlags(pSiS, tmpflags, 0);
13042 if(!(pSiS->MiscFlags & MISC_CRT1OVERLAY)) {
13044 if((!pSiS->DualHeadMode) || (pSiS->SecondHead))
13050 if((pSiS->VBFlags & CRT2_ENABLE) && (!(pSiS->MiscFlags & MISC_CRT2OVERLAY))) {
13052 if((!pSiS->DualHeadMode) || (!pSiS->SecondHead))
13064 if(pSiS->VBFlags & (CRT2_LCD | CRT1_LCDA)) {
13066 if(pSiS->VGAEngine == SIS_300_VGA) {
13067 if(pSiS->VBFlags2 & (VB2_LVDS | VB2_30xBDH)) {
13073 if((pSiS->VBFlags2 & (VB2_LVDS | VB2_30xBDH)) || (pSiS->VBFlags & CRT1_LCDA)) {
13079 pSiS->MiscFlags |= tmpflags;
13081 SiS_SetDHFlags(pSiS, tmpflags, 0);
13086 if(pSiS->ChipType == SIS_550) {
13087 if((pSiS->VBFlags & CRT2_LCD) && (pSiS->FSTN || pSiS->DSTN)) {
13091 pSiS->MiscFlags |= MISC_STNMODE;
13093 SiS_SetDHFlags(pSiS, MISC_STNMODE, 0);
13100 if((pSiS->VBFlags2 & VB2_SISBRIDGE) && (pSiS->VBFlags & CRT2_TV) && (!(pSiS->VBFlags & TV_HIVISION))) {
13101 if( ((pSiS->VBFlags & TV_YPBPR) && (pSiS->VBFlags & TV_YPBPR525I)) ||
13102 ((!(pSiS->VBFlags & TV_YPBPR)) && (pSiS->VBFlags & (TV_NTSC | TV_PALM))) ) {
13106 pSiS->MiscFlags |= MISC_TVNTSC1024;
13108 SiS_SetDHFlags(pSiS, MISC_TVNTSC1024, 0);
13114 if(pSiS->VGAEngine == SIS_315_VGA) {
13122 pSiS->HWCursorBackup[i] = SIS_MMIO_IN32(pSiS->IOBase, 0x8500 + (i << 2));
13124 if(pSiS->ChipType >= SIS_330) {
13132 if(!pSiS->NoAccel) {
13133 if(pSiS->InitAccel) {
13134 (pSiS->InitAccel)(pScrn);
13139 if(pSiS->VBFlags & CRT1_LCDA)
13140 pSiS->CRT1MonGamma = pSiS->CRT2LCDMonitorGamma;
13142 pSiS->CRT1MonGamma = pSiS->CRT1VGAMonitorGamma;
13144 if(pSiS->VBFlags & CRT2_LCD)
13145 pSiS->CRT2MonGamma = pSiS->CRT2LCDMonitorGamma;
13146 else if(pSiS->VBFlags & CRT2_TV) {
13147 if(pSiS->VBFlags & TV_YPBPR)
13148 pSiS->CRT2MonGamma = 2200; /* */
13149 else if(pSiS->VBFlags & TV_HIVISION)
13150 pSiS->CRT2MonGamma = 2200; /* ? */
13151 else if(pSiS->VBFlags & TV_NTSC)
13152 pSiS->CRT2MonGamma = 2200; /* NTSC */
13154 pSiS->CRT2MonGamma = 2800; /* All PAL modes? */
13155 } else if(pSiS->VBFlags & CRT2_VGA)
13156 pSiS->CRT2MonGamma = pSiS->CRT2VGAMonitorGamma;
13158 pSiS->CRT2MonGamma = 0; /* Unknown */
13163 if(pSiS->DualHeadMode) {
13168 SISPTR(pSiSEnt->pScrn_1)->CRT1MonGamma = pSiS->CRT1MonGamma;
13169 SISPTR(pSiSEnt->pScrn_1)->CRT2MonGamma = pSiS->CRT2MonGamma;
13175 SISPTR(pSiSEnt->pScrn_2)->CRT1MonGamma = pSiS->CRT1MonGamma;
13176 SISPTR(pSiSEnt->pScrn_2)->CRT2MonGamma = pSiS->CRT2MonGamma;
13180 if(pSiS->ResetXvDisplay) {
13181 (pSiS->ResetXvDisplay)(pScrn);
13188 if(pSiS->ResetXvGamma) {
13189 (pSiS->ResetXvGamma)(pScrn);
13194 int val = pSiS->siscrt1satgain;
13196 if(pSiS->DualHeadMode && pSiSEnt) val = pSiSEnt->siscrt1satgain;
13208 if(pSiS->VBFlags & CRT2_TV) {
13210 if(pSiS->VBFlags2 & VB2_CHRONTEL) {
13211 int mychtvlumabandwidthcvbs = pSiS->chtvlumabandwidthcvbs;
13212 int mychtvlumabandwidthsvideo = pSiS->chtvlumabandwidthsvideo;
13213 int mychtvlumaflickerfilter = pSiS->chtvlumaflickerfilter;
13214 int mychtvchromabandwidth = pSiS->chtvchromabandwidth;
13215 int mychtvchromaflickerfilter = pSiS->chtvchromaflickerfilter;
13216 int mychtvcvbscolor = pSiS->chtvcvbscolor;
13217 int mychtvtextenhance = pSiS->chtvtextenhance;
13218 int mychtvcontrast = pSiS->chtvcontrast;
13219 int mytvxpos = pSiS->tvxpos;
13220 int mytvypos = pSiS->tvypos;
13222 if(pSiSEnt && pSiS->DualHeadMode) {
13260 switch(pSiS->ChrontelType) {
13262 pSiS->tvx = SiS_GetCH700x(pSiS->SiS_Pr, 0x0a);
13263 pSiS->tvx |= (((SiS_GetCH700x(pSiS->SiS_Pr, 0x08) & 0x02) >> 1) << 8);
13264 pSiS->tvy = SiS_GetCH700x(pSiS->SiS_Pr, 0x0b);
13265 pSiS->tvy |= ((SiS_GetCH700x(pSiS->SiS_Pr, 0x08) & 0x01) << 8);
13268 pSiSEnt->tvx = pSiS->tvx;
13269 pSiSEnt->tvy = pSiS->tvy;
13284 if(pSiS->VBFlags2 & VB2_301) {
13285 int mysistvedgeenhance = pSiS->sistvedgeenhance;
13287 if(pSiSEnt && pSiS->DualHeadMode) {
13295 if(pSiS->VBFlags2 & VB2_SISBRIDGE) {
13296 int mysistvantiflicker = pSiS->sistvantiflicker;
13297 int mysistvsaturation = pSiS->sistvsaturation;
13298 int mysistvcolcalibf = pSiS->sistvcolcalibf;
13299 int mysistvcolcalibc = pSiS->sistvcolcalibc;
13300 int mysistvcfilter = pSiS->sistvcfilter;
13301 int mysistvyfilter = pSiS->sistvyfilter;
13302 int mytvxpos = pSiS->tvxpos;
13303 int mytvypos = pSiS->tvypos;
13304 int mytvxscale = pSiS->tvxscale;
13305 int mytvyscale = pSiS->tvyscale;
13310 if(pSiSEnt && pSiS->DualHeadMode) {
13324 inSISIDXREG(SISPART2,0x1f,pSiS->p2_1f);
13325 inSISIDXREG(SISPART2,0x20,pSiS->p2_20);
13326 inSISIDXREG(SISPART2,0x2b,pSiS->p2_2b);
13327 inSISIDXREG(SISPART2,0x42,pSiS->p2_42);
13328 inSISIDXREG(SISPART2,0x43,pSiS->p2_43);
13329 inSISIDXREG(SISPART2,0x01,pSiS->p2_01);
13330 inSISIDXREG(SISPART2,0x02,pSiS->p2_02);
13331 inSISIDXREG(SISPART2,0x44,pSiS->p2_44);
13332 inSISIDXREG(SISPART2,0x45,pSiS->p2_45);
13333 if(!(pSiS->VBFlags2 & VB2_301)) {
13334 inSISIDXREG(SISPART2,0x46,pSiS->p2_46);
13336 pSiS->p2_46 = 0;
13338 inSISIDXREG(SISPART2,0x0a,pSiS->p2_0a);
13346 pSiS->sistvccbase = (cbase | ctemp);
13347 inSISIDXREG(SISPART2,0x35,pSiS->p2_35);
13348 inSISIDXREG(SISPART2,0x36,pSiS->p2_36);
13349 inSISIDXREG(SISPART2,0x37,pSiS->p2_37);
13350 inSISIDXREG(SISPART2,0x38,pSiS->p2_38);
13351 if(!(pSiS->VBFlags2 & VB2_301)) {
13352 inSISIDXREG(SISPART2,0x47,pSiS->p2_47);
13353 inSISIDXREG(SISPART2,0x48,pSiS->p2_48);
13354 inSISIDXREG(SISPART2,0x49,pSiS->p2_49);
13355 inSISIDXREG(SISPART2,0x4a,pSiS->p2_4a);
13357 inSISIDXREG(SISPART2,0x2f,pSiS->p2_2f);
13358 inSISIDXREG(SISPART2,0x30,pSiS->p2_30);
13360 inSISIDXREG(SISPART1,SiSScalingP1Regs[i],pSiS->scalingp1[i]);
13363 inSISIDXREG(SISPART4,SiSScalingP4Regs[i],pSiS->scalingp4[i]);
13365 if(pSiS->VBFlags2 & VB2_SISTAP4SCALER) {
13367 inSISIDXREG(SISPART2,(0xc0 + i),pSiS->scalingp2[i]);
13372 pSiSEnt->p2_1f = pSiS->p2_1f; pSiSEnt->p2_20 = pSiS->p2_20;
13373 pSiSEnt->p2_42 = pSiS->p2_42; pSiSEnt->p2_43 = pSiS->p2_43;
13374 pSiSEnt->p2_2b = pSiS->p2_2b;
13375 pSiSEnt->p2_01 = pSiS->p2_01; pSiSEnt->p2_02 = pSiS->p2_02;
13376 pSiSEnt->p2_44 = pSiS->p2_44; pSiSEnt->p2_45 = pSiS->p2_45;
13377 pSiSEnt->p2_46 = pSiS->p2_46; pSiSEnt->p2_0a = pSiS->p2_0a;
13378 pSiSEnt->sistvccbase = pSiS->sistvccbase;
13379 pSiSEnt->p2_35 = pSiS->p2_35; pSiSEnt->p2_36 = pSiS->p2_36;
13380 pSiSEnt->p2_37 = pSiS->p2_37; pSiSEnt->p2_38 = pSiS->p2_38;
13381 pSiSEnt->p2_48 = pSiS->p2_48; pSiSEnt->p2_49 = pSiS->p2_49;
13382 pSiSEnt->p2_4a = pSiS->p2_4a; pSiSEnt->p2_2f = pSiS->p2_2f;
13383 pSiSEnt->p2_30 = pSiS->p2_30; pSiSEnt->p2_47 = pSiS->p2_47;
13385 pSiSEnt->scalingp1[i] = pSiS->scalingp1[i];
13388 pSiSEnt->scalingp4[i] = pSiS->scalingp4[i];
13390 if(pSiS->VBFlags2 & VB2_SISTAP4SCALER) {
13392 pSiSEnt->scalingp2[i] = pSiS->scalingp2[i];
13436 SISPtr pSiS = SISPTR(pScrn);
13440 if(!(pSiS->SiS6326Flags & SIS6326_TVDETECTED)) return;
13443 sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
13447 pSiS->tvx1 = SiS6326GetTVReg(pScrn,0x3a);
13448 pSiS->tvx1 |= ((SiS6326GetTVReg(pScrn,0x3c) & 0x0f) << 8);
13449 pSiS->tvx2 = SiS6326GetTVReg(pScrn,0x26);
13450 pSiS->tvx2 |= ((SiS6326GetTVReg(pScrn,0x27) & 0xf0) << 4);
13451 pSiS->tvx3 = SiS6326GetTVReg(pScrn,0x12);
13452 pSiS->tvx3 |= ((SiS6326GetTVReg(pScrn,0x13) & 0xC0) << 2);
13453 pSiS->tvy1 = SiS6326GetTVReg(pScrn,0x11);
13454 pSiS->tvy1 |= ((SiS6326GetTVReg(pScrn,0x13) & 0x30) << 4);
13457 if((val = pSiS->tvxpos) != 0) {
13460 if((val = pSiS->tvypos) != 0) {
13467 if(pSiS->SiS6326Flags & SIS6326_TVON) {
13495 if((val = pSiS->sistvantiflicker) != -1) {
13498 if((val = pSiS->sis6326enableyfilter) != -1) {
13501 if((val = pSiS->sis6326yfilterstrong) != -1) {
13511 SISPtr pSiS = SISPTR(pScrn);
13514 if(!(pSiS->VBFlags2 & VB2_VIDEOBRIDGE)) return FALSE;
13517 if( ((pSiS->VGAEngine == SIS_300_VGA) && (usScrP1_00 & 0xa0) == 0x20) ||
13518 ((pSiS->VGAEngine == SIS_315_VGA) && (usScrP1_00 & 0x50) == 0x10) ) {
13529 SISPtr pSiS = SISPTR(pScrn);
13550 m->next = pSiS->SISVESAModeList;
13552 pSiS->SISVESAModeList = m;
13566 SISPtr pSiS = SISPTR(pScrn);
13567 sisModeInfoPtr m = pSiS->SISVESAModeList;
13584 if(!pSiS->ROM661New) { /* VESA numbers changed! */
13608 SISPtr pSiS = SISPTR(pScrn);
13609 UShort i = (pSiS->CurrentLayout.bitsPerPixel+7)/8 - 1;
13610 BOOLEAN FSTN = pSiS->FSTN ? TRUE : FALSE;
13613 if(pSiS->DualHeadMode && pSiS->SecondHead) FSTN = FALSE;
13616 return(SiS_GetModeID(pSiS->VGAEngine, VBFlags, mode->HDisplay, mode->VDisplay,
13617 i, FSTN, pSiS->LCDwidth, pSiS->LCDheight));
13621 SiSValidLCDUserMode(SISPtr pSiS, unsigned int VBFlags, DisplayModePtr mode, Bool isforlcda)
13628 if(pSiS->VBFlags2 & VB2_LCD162MHZBRIDGE) {
13638 xf86DrvMsg(pSiS->pScrn->scrnIndex, X_WARNING,
13650 SiSValidVGA2UserMode(SISPtr pSiS, unsigned int VBFlags, DisplayModePtr mode)
13657 if(pSiS->VBFlags2 & VB2_RAMDAC202MHZBRIDGE) {
13659 } else if(pSiS->VBFlags2 & VB2_30xBLV) {
13671 SISPtr pSiS = SISPTR(pScrn);
13672 UShort i = (pSiS->CurrentLayout.bitsPerPixel+7)/8 - 1;
13681 } else if(pSiS->VBFlags2 & VB2_SISTMDSLCDABRIDGE) {
13683 if(pSiS->ChipType < SIS_661) { /* < 661 only? */
13690 if(pSiS->SiS_Pr->CP_HaveCustomData) {
13692 if((pSiS->SiS_Pr->CP_DataValid[j]) &&
13693 (mode->HDisplay == pSiS->SiS_Pr->CP_HDisplay[j]) &&
13694 (mode->VDisplay == pSiS->SiS_Pr->CP_VDisplay[j]) &&
13700 if((pSiS->AddedPlasmaModes) && (mode->type & M_T_BUILTIN))
13704 (pSiS->LCDwidth) && /* = test if LCD present */
13706 (SiSValidLCDUserMode(pSiS, VBFlags, mode, TRUE)))
13709 if((mode->HDisplay > pSiS->LCDwidth) ||
13710 (mode->VDisplay > pSiS->LCDheight)) {
13716 if((mode->HDisplay > pSiS->LCDwidth) ||
13717 (mode->VDisplay > pSiS->LCDheight)) {
13723 return(SiS_GetModeID(pSiS->VGAEngine, VBFlags, mode->HDisplay, mode->VDisplay,
13724 i, pSiS->FSTN, pSiS->LCDwidth, pSiS->LCDheight));
13730 SISPtr pSiS = SISPTR(pScrn);
13731 UShort i = (pSiS->CurrentLayout.bitsPerPixel+7)/8 - 1;
13742 if((pSiS->VBFlags2 & VB2_SISTMDSBRIDGE) && (!(pSiS->VBFlags2 & VB2_30xBDH))) {
13744 if(pSiS->SiS_Pr->CP_HaveCustomData) {
13746 if((pSiS->SiS_Pr->CP_DataValid[j]) &&
13747 (mode->HDisplay == pSiS->SiS_Pr->CP_HDisplay[j]) &&
13748 (mode->VDisplay == pSiS->SiS_Pr->CP_VDisplay[j]) &&
13758 if((pSiS->AddedPlasmaModes) && (mode->type & M_T_BUILTIN))
13762 (pSiS->LCDwidth) && /* = test if LCD present */
13764 (SiSValidLCDUserMode(pSiS, VBFlags, mode, FALSE)))
13769 if( ((mode->HDisplay <= pSiS->LCDwidth) &&
13770 (mode->VDisplay <= pSiS->LCDheight)) ||
13771 ((pSiS->SiS_Pr->SiS_CustomT == CUT_PANEL848) &&
13775 ((pSiS->SiS_Pr->SiS_CustomT == CUT_PANEL856) &&
13779 ModeIndex = SiS_GetModeID_LCD(pSiS->VGAEngine, VBFlags, mode->HDisplay, mode->VDisplay, i,
13780 pSiS->FSTN, pSiS->SiS_Pr->SiS_CustomT, pSiS->LCDwidth, pSiS->LCDheight,
13781 pSiS->VBFlags2);
13787 ModeIndex = SiS_GetModeID_TV(pSiS->VGAEngine, VBFlags, mode->HDisplay, mode->VDisplay, i,
13788 pSiS->VBFlags2);
13792 if((pSiS->AddedPlasmaModes) && (mode->type & M_T_BUILTIN))
13797 (SiSValidVGA2UserMode(pSiS, VBFlags, mode)))
13800 ModeIndex = SiS_GetModeID_VGA2(pSiS->VGAEngine, VBFlags, mode->HDisplay, mode->VDisplay, i,
13801 pSiS->VBFlags2);
13854 SISPtr pSiS = SISPTR(pScrn);
13867 if( (pSiS->ChipType == SIS_730) &&
13868 (pSiS->VBFlags2 & VB2_VIDEOBRIDGE) &&
13869 (pSiS->CurrentLayout.bitsPerPixel == 32) ) {
13871 if(pSiS->DualHeadMode) {
13872 if(pSiS->SecondHead) {
13877 if((!pSiS->UseVESA) && (pSiS->VBFlags & CRT2_ENABLE) && (!pSiS->CRT1off)) {
13927 SISPtr pSiS = SISPTR(pScrn);
13946 SISPtr pSiS = SISPTR(pScrn);
13955 switch(pSiS->VGAEngine) {
13981 SISPtr pSiS = SISPTR(pScrn);
13983 if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
13985 if(pSiS->DualHeadMode) {
13986 if(pSiS->SecondHead)
13992 if(pSiS->VBFlags & DISPTYPE_DISP1) {
13995 if(pSiS->VBFlags & DISPTYPE_DISP2) {
14070 SiSMemCopyToVideoRam(SISPtr pSiS, UChar *to, UChar *from, int size)
14072 if((ULong)to & 15) (*pSiS->SiSFastMemCopy)(to, from, size);
14073 else (*pSiS->SiSFastVidCopy)(to, from, size);
14077 SiSMemCopyFromVideoRam(SISPtr pSiS, UChar *to, UChar *from, int size)
14079 if((ULong)to & 15) (*pSiS->SiSFastMemCopyFrom)(to, from, size);
14080 else (*pSiS->SiSFastVidCopyFrom)(to, from, size);
14084 sisSaveUnlockExtRegisterLock(SISPtr pSiS, UChar *reg1, UChar *reg2)
14093 pSiS->lockcalls++;
14094 mylockcalls = pSiS->lockcalls;
14112 xf86DrvMsg(pSiS->pScrn->scrnIndex, X_WARNING,
14119 xf86DrvMsg(pSiS->pScrn->scrnIndex, X_INFO,
14126 switch(pSiS->VGAEngine) {
14141 SISErrorLog(pSiS->pScrn,
14143 (void *)pSiS, (ULong)pSiS->RelIO, val, mylockcalls);
14148 if((pSiS->VGAEngine == SIS_OLD_VGA) || (pSiS->VGAEngine == SIS_530_VGA)) {
14156 SISErrorLog(pSiS->pScrn,
14158 (void *)pSiS, (ULong)pSiS->RelIO, val);
14165 sisRestoreExtRegisterLock(SISPtr pSiS, UChar reg1, UChar reg2)
14170 if((pSiS->VGAEngine == SIS_OLD_VGA) || (pSiS->VGAEngine == SIS_530_VGA)) {