diff options
author | Thomas Winischhofer <thomas@winischhofer.net> | 2004-06-23 21:35:45 +0000 |
---|---|---|
committer | Thomas Winischhofer <thomas@winischhofer.net> | 2004-06-23 21:35:45 +0000 |
commit | f112c72223b4964b0f8f2a510e323fee55742d3e (patch) | |
tree | 587dacfcd67331b2e3107bf03a98bb037a4f9d3a | |
parent | a8ea3115164f845246e9b3f935238499b1b62531 (diff) |
SiS driver:
- Use sane HSync/VRefresh ranges for LCD and TV if the user didn't specify
any in xorg.conf
- Use PAL by default of TV output forced (and TV not detected)
-rw-r--r-- | src/sis.h | 2 | ||||
-rw-r--r-- | src/sis_dri.c | 52 | ||||
-rw-r--r-- | src/sis_driver.c | 137 |
3 files changed, 156 insertions, 35 deletions
@@ -40,7 +40,7 @@ #define SISDRIVERVERSIONYEAR 4 #define SISDRIVERVERSIONMONTH 6 -#define SISDRIVERVERSIONDAY 20 +#define SISDRIVERVERSIONDAY 23 #define SISDRIVERREVISION 1 #define SISDRIVERIVERSION (SISDRIVERVERSIONYEAR << 16) | \ diff --git a/src/sis_dri.c b/src/sis_dri.c index d654e5d..352e30e 100644 --- a/src/sis_dri.c +++ b/src/sis_dri.c @@ -48,9 +48,24 @@ #include "GL/glxtokens.h" #include "sis.h" -#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,0,0) -#include "xf86drmCompat.h" + +#undef SISHAVECOMPATLAYER +#ifdef XORG_VERSION_CURRENT +#define SISHAVECOMPATLAYER +#else +# if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,4,99,7,0) +# define SISHAVECOMPATLAYER +# endif +#endif + +#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0) +extern Bool drmSiSAgpInit(int driSubFD, int offset, int size); +#else +# ifdef SISHAVECOMPATLAYER +# include "xf86drmCompat.h" +# endif #endif + #if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0) #include "sis_common.h" #endif @@ -94,10 +109,8 @@ static void SISDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index); static void SISDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 index); -#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0) -extern Bool drmSiSAgpInit(int driSubFD, int offset, int size); -#endif - +extern char *DRICreatePCIBusID(pciVideoPtr PciInfo); + static Bool SISInitVisualConfigs(ScreenPtr pScreen) { @@ -280,19 +293,16 @@ Bool SISDRIScreenInit(ScreenPtr pScreen) pDRIInfo->drmDriverName = SISKernelDriverName; pDRIInfo->clientDriverName = SISClientDriverName; -#if 0 /* Wait for DRI update */ + if(xf86LoaderCheckSymbol("DRICreatePCIBusID")) { pDRIInfo->busIdString = DRICreatePCIBusID(pSIS->PciInfo); } else { -#endif pDRIInfo->busIdString = xalloc(64); sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d", ((pciConfigPtr)pSIS->PciInfo->thisCard)->busnum, ((pciConfigPtr)pSIS->PciInfo->thisCard)->devnum, - ((pciConfigPtr)pSIS->PciInfo->thisCard)->funcnum); -#if 0 + ((pciConfigPtr)pSIS->PciInfo->thisCard)->funcnum); } -#endif /* Hack to keep old DRI working -- checked for major==1 and * minor==1. @@ -524,7 +534,17 @@ Bool SISDRIScreenInit(ScreenPtr pScreen) pSISDRI->AGPVtxBufOffset = pSIS->agpVtxBufAddr - pSIS->agpAddr; pSISDRI->AGPVtxBufSize = pSIS->agpVtxBufSize; +#ifdef SISHAVECOMPATLAYER drmSiSAgpInit(pSIS->drmSubFD, AGP_VTXBUF_SIZE,(pSIS->agpSize - AGP_VTXBUF_SIZE)); +#else + { + drm_sis_agp_t agp; + + agp.offset = AGP_VTXBUF_SIZE; + agp.size = pSIS->agpSize - AGP_VTXBUF_SIZE; + drmCommandWrite(pSIS->drmSubFD, DRM_SIS_AGP_INIT, &agp, sizeof(agp)); + } +#endif #endif } else { @@ -536,7 +556,17 @@ Bool SISDRIScreenInit(ScreenPtr pScreen) pSISDRI->AGPCmdBufOffset = pSIS->agpCmdBufAddr - pSIS->agpAddr; pSISDRI->AGPCmdBufSize = pSIS->agpCmdBufSize; +#ifdef SISHAVECOMPATLAYER drmSiSAgpInit(pSIS->drmSubFD, AGP_CMDBUF_SIZE,(pSIS->agpSize - AGP_CMDBUF_SIZE)); +#else + { + drm_sis_agp_t agp; + + agp.offset = AGP_CMDBUF_SIZE; + agp.size = pSIS->agpSize - AGP_CMDBUF_SIZE; + drmCommandWrite(pSIS->drmSubFD, DRM_SIS_AGP_INIT, &agp, sizeof(agp)); + } +#endif } } while(0); diff --git a/src/sis_driver.c b/src/sis_driver.c index d1127c4..6068ced 100644 --- a/src/sis_driver.c +++ b/src/sis_driver.c @@ -285,13 +285,15 @@ static const char *driSymbols[] = { "DRILock", "DRIQueryVersion", "DRIScreenInit", - "DRIUnlock", -#if 0 /* Wait for DRI update */ - "DRICreatePCIBusID", -#endif + "DRIUnlock", "GlxSetVisualConfigs", NULL }; + +static const char *driRefSymbols[] = { + "DRICreatePCIBusID", /* not REQUIRED */ + NULL +}; #endif #ifdef XFree86LOADER @@ -330,7 +332,7 @@ sisSetup(pointer module, pointer opts, int *errmaj, int *errmin) shadowSymbols, ramdacSymbols, vbeSymbols, int10Symbols, #ifdef XF86DRI - drmSymbols, driSymbols, + drmSymbols, driSymbols, driRefSymbols, #endif NULL); return (pointer)TRUE; @@ -1052,6 +1054,37 @@ SiSSetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag) } #endif +static BOOLEAN +SiSAllowSyncOverride(SISPtr pSiS) +{ +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + if(pSiS->SecondHead) { + if(pSiS->VBFlags & CRT1_LCDA) return TRUE; + } else { + if(pSiS->VBFlags & (CRT2_LCD | CRT2_TV)) return TRUE; + } + return FALSE; + } else +#endif +#ifdef SISMERGED + if(pSiS->MergedFB) { + if(pSiS->VBFlags & CRT1_LCDA) return TRUE; + return FALSE; + } +#endif + + if(!(pSiS->VBFlags & DISPTYPE_CRT1)) { + if(pSiS->VBFlags & (CRT2_LCD | CRT2_TV)) { + return TRUE; + } + } else if(pSiS->VBFlags & CRT1_LCDA) { + return TRUE; + } + + return FALSE; +} + /* Some helper functions for MergedFB mode */ #ifdef SISMERGED @@ -2351,6 +2384,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) static const char *subshstr = "Substituting missing CRT%d monitor HSync data by DDC data\n"; static const char *subsvstr = "Substituting missing CRT%d monitor VRefresh data by DDC data\n"; #endif + static const char *saneh = "Substituting missing monitor HSync range by suitable data\n"; + static const char *sanev = "Substituting missing monitor VRefresh range by suitable data\n"; #ifdef SISMERGED static const char *mergednocrt1 = "CRT1 not detected or forced off. %s.\n"; static const char *mergednocrt2 = "No CRT2 output selected or no bridge detected. %s.\n"; @@ -4427,8 +4462,16 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } } - /* SCART only supported for PAL */ + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + /* Default to PAL */ + if(pSiS->VBFlags & (TV_SVIDEO | TV_AVIDEO)) { + if(!(pSiS->VBFlags & (TV_PAL | TV_NTSC))) { + pSiS->VBFlags &= ~(TV_PAL | TV_NTSC | TV_PALN | TV_PALM | TV_NTSCJ); + pSiS->VBFlags |= TV_PAL; + } + } + /* SCART only supported for PAL */ if((pSiS->VBFlags & VB_SISBRIDGE) && (pSiS->VBFlags & TV_SCART)) { pSiS->VBFlags &= ~(TV_NTSC | TV_PALN | TV_PALM | TV_NTSCJ); pSiS->VBFlags |= TV_PAL; @@ -5008,45 +5051,93 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } #endif - /* If there is no HSync or VRefresh data for the monitor, - * derive it from DDC data. Done by common layer since - * 4.3.99.14. - */ + /* If there is no HSync or VRefresh data for the monitor, + * derive it from DDC data. Done by common layer since + * 4.3.99.14. + */ + if(pScrn->monitor->nHsync <= 0) { #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,14,0) - if(pScrn->monitor->DDC) { - if(pScrn->monitor->nHsync <= 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, subshstr, + if(pScrn->monitor->DDC) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, subshstr, #ifdef SISDUALHEAD pSiS->DualHeadMode ? (pSiS->SecondHead ? 1 : 2) : #endif pSiS->CRT1off ? 2 : 1); - SiSSetSyncRangeFromEdid(pScrn, 1); + SiSSetSyncRangeFromEdid(pScrn, 1); } - if(pScrn->monitor->nVrefresh <= 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, subsvstr, +#endif + if(pScrn->monitor->nHsync <= 0) { + if(SiSAllowSyncOverride(pSiS)) { + /* Set sane ranges for LCD and TV + * (our strict checking will filter out invalid ones anyway) + */ + pScrn->monitor->nHsync = 1; + pScrn->monitor->hsync[0].lo = 28; + pScrn->monitor->hsync[0].hi = 80; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, saneh); + } + } + } + + if(pScrn->monitor->nVrefresh <= 0) { +#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,14,0) + if(pScrn->monitor->DDC) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, subsvstr, #ifdef SISDUALHEAD pSiS->DualHeadMode ? (pSiS->SecondHead ? 1 : 2) : #endif pSiS->CRT1off ? 2 : 1); - SiSSetSyncRangeFromEdid(pScrn, 0); + SiSSetSyncRangeFromEdid(pScrn, 0); + } +#endif + if(pScrn->monitor->nVrefresh <= 0) { + if(SiSAllowSyncOverride(pSiS)) { + /* Set sane ranges for LCD and TV */ + pScrn->monitor->nVrefresh = 1; + pScrn->monitor->vrefresh[0].lo = 59; + pScrn->monitor->vrefresh[0].hi = 71; /* 71 for 640x400 */ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, sanev); + } } } -#endif + #ifdef SISMERGED if(pSiS->MergedFB) { + if(pSiS->CRT2pScrn->monitor->nHsync <= 0) { #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,14,0) - if(pSiS->CRT2pScrn->monitor->DDC) { - if(pSiS->CRT2pScrn->monitor->nHsync <= 0) { + if(pSiS->CRT2pScrn->monitor->DDC) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, subshstr, 2); SiSSetSyncRangeFromEdid(pSiS->CRT2pScrn, 1); } - if(pSiS->CRT2pScrn->monitor->nVrefresh <= 0) { +#endif + if(pSiS->CRT2pScrn->monitor->nHsync <= 0) { + if(pSiS->VBFlags & (CRT2_TV | CRT2_LCD)) { + /* Set sane ranges for LCD and TV */ + pSiS->CRT2pScrn->monitor->nHsync = 1; + pSiS->CRT2pScrn->monitor->hsync[0].lo = 28; + pSiS->CRT2pScrn->monitor->hsync[0].hi = 80; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, saneh); + } + } + } + if(pSiS->CRT2pScrn->monitor->nVrefresh <= 0) { +#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,14,0) + if(pSiS->CRT2pScrn->monitor->DDC) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, subsvstr, 2); SiSSetSyncRangeFromEdid(pSiS->CRT2pScrn, 0); } +#endif + if(pSiS->CRT2pScrn->monitor->nVrefresh <= 0) { + if(pSiS->VBFlags & (CRT2_TV | CRT2_LCD)) { + /* Set sane ranges for LCD and TV */ + pSiS->CRT2pScrn->monitor->nVrefresh = 1; + pSiS->CRT2pScrn->monitor->vrefresh[0].lo = 59; + pSiS->CRT2pScrn->monitor->vrefresh[0].hi = 71; /* 71 for 640x400 */ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, sanev); + } + } } -#endif xf86DrvMsg(pScrn->scrnIndex, X_INFO, crtsetupstr, 1); } @@ -5354,7 +5445,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) xf86PruneDriverModes(pScrn); if(i == 0 || pScrn->modes == NULL) { - SISErrorLog(pScrn, "No valid modes found\n"); + SISErrorLog(pScrn, "No valid modes found - check VertRefresh/HorizSync\n"); #ifdef SISDUALHEAD if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE; #endif |