diff options
author | Felix Kuehling <fxkuehl@gmx.de> | 2005-01-30 22:17:15 +0000 |
---|---|---|
committer | Felix Kuehling <fxkuehl@gmx.de> | 2005-01-30 22:17:15 +0000 |
commit | 565d77fe6e5d5357a04ac5612a1d25aa1194cad9 (patch) | |
tree | fa0922f810203b1aaadad73679ff58003d19d2ce | |
parent | cb406770d1b88ecda3e7dba14f21b2cf90449a93 (diff) |
Added two new options "DmaType" and "ForcePCIMode".
-rw-r--r-- | src/savage_dri.c | 65 | ||||
-rw-r--r-- | src/savage_driver.c | 41 | ||||
-rw-r--r-- | src/savage_driver.h | 3 |
3 files changed, 75 insertions, 34 deletions
diff --git a/src/savage_dri.c b/src/savage_dri.c index 9af6780..85c4a99 100644 --- a/src/savage_dri.c +++ b/src/savage_dri.c @@ -742,8 +742,10 @@ static Bool SAVAGEDRIAgpInit(ScreenPtr pScreen) pSAVAGEDRIServer->agp.size = psav->agpSize * 1024 * 1024; pSAVAGEDRIServer->agp.offset = pSAVAGEDRIServer->agp.size; /* ? */ - pSAVAGEDRIServer->buffers.offset = 0; - pSAVAGEDRIServer->buffers.size = SAVAGE_NUM_BUFFERS * SAVAGE_BUFFER_SIZE; + if (psav->AgpDMA) { + pSAVAGEDRIServer->buffers.offset = 0; + pSAVAGEDRIServer->buffers.size = SAVAGE_NUM_BUFFERS * SAVAGE_BUFFER_SIZE; + } pSAVAGEDRIServer->agpTextures.offset = pSAVAGEDRIServer->buffers.size; pSAVAGEDRIServer->agpTextures.size = (pSAVAGEDRIServer->agp.size - @@ -804,31 +806,33 @@ static Bool SAVAGEDRIAgpInit(ScreenPtr pScreen) /* DMA buffers */ - if ( drmAddMap( psav->drmFD, - pSAVAGEDRIServer->buffers.offset, - pSAVAGEDRIServer->buffers.size, - DRM_AGP, 0, - &pSAVAGEDRIServer->buffers.handle ) < 0 ) { - xf86DrvMsg( pScreen->myNum, X_ERROR, - "[agp] Could not add DMA buffers mapping\n" ); - return FALSE; - } - xf86DrvMsg( pScreen->myNum, X_INFO, - "[agp] DMA buffers handle = 0x%08lx\n", - pSAVAGEDRIServer->buffers.handle ); - /* not needed in the server - if ( drmMap( psav->drmFD, - pSAVAGEDRIServer->buffers.handle, - pSAVAGEDRIServer->buffers.size, - &pSAVAGEDRIServer->buffers.map ) < 0 ) { - xf86DrvMsg( pScreen->myNum, X_ERROR, - "[agp] Could not map DMA buffers\n" ); - return FALSE; + if ( psav->AgpDMA ) { + if ( drmAddMap( psav->drmFD, + pSAVAGEDRIServer->buffers.offset, + pSAVAGEDRIServer->buffers.size, + DRM_AGP, 0, + &pSAVAGEDRIServer->buffers.handle ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[agp] Could not add DMA buffers mapping\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] DMA buffers handle = 0x%08lx\n", + pSAVAGEDRIServer->buffers.handle ); + /* not needed in the server + if ( drmMap( psav->drmFD, + pSAVAGEDRIServer->buffers.handle, + pSAVAGEDRIServer->buffers.size, + &pSAVAGEDRIServer->buffers.map ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[agp] Could not map DMA buffers\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] DMA buffers mapped at 0x%08lx\n", + (unsigned long)pSAVAGEDRIServer->buffers.map ); + */ } - xf86DrvMsg( pScreen->myNum, X_INFO, - "[agp] DMA buffers mapped at 0x%08lx\n", - (unsigned long)pSAVAGEDRIServer->buffers.map ); - */ /* AGP textures */ @@ -971,14 +975,14 @@ static Bool SAVAGEDRIBuffersInit( ScreenPtr pScreen ) SAVAGEDRIServerPrivatePtr pSAVAGEDRIServer = psav->DRIServerInfo; int count; - if ( psav->IsPCI ) { + if ( psav->AgpDMA ) { count = drmAddBufs( psav->drmFD, SAVAGE_NUM_BUFFERS, SAVAGE_BUFFER_SIZE, - 0, 0 ); + DRM_AGP_BUFFER, pSAVAGEDRIServer->buffers.offset ); } else { count = drmAddBufs( psav->drmFD, SAVAGE_NUM_BUFFERS, SAVAGE_BUFFER_SIZE, - DRM_AGP_BUFFER, pSAVAGEDRIServer->buffers.offset ); + 0, 0 ); } if ( count <= 0 ) { xf86DrvMsg( pScrn->scrnIndex, X_INFO, @@ -1021,7 +1025,7 @@ static Bool SAVAGEDRIKernelInit( ScreenPtr pScreen ) init.cob_size = psav->cobSize/4; /* size in 32-bit entries */ init.bci_threshold_lo = psav->bciThresholdLo; init.bci_threshold_hi = psav->bciThresholdHi; - init.dma_type = psav->IsPCI ? SAVAGE_DMA_PCI : SAVAGE_DMA_AGP; + init.dma_type = psav->AgpDMA ? SAVAGE_DMA_AGP : SAVAGE_DMA_PCI; init.fb_bpp = pScrn->bitsPerPixel; init.front_offset = pSAVAGEDRIServer->frontOffset; @@ -1284,6 +1288,7 @@ Bool SAVAGEDRIScreenInit( ScreenPtr pScreen ) return FALSE; */ psav->IsPCI = TRUE; + psav->AgpDMA = FALSE; xf86DrvMsg( pScrn->scrnIndex, X_WARNING, "[agp] AGP failed to initialize -- falling back to PCI mode.\n"); xf86DrvMsg( pScrn->scrnIndex, X_WARNING, diff --git a/src/savage_driver.c b/src/savage_driver.c index d854729..3d9ba39 100644 --- a/src/savage_driver.c +++ b/src/savage_driver.c @@ -207,9 +207,11 @@ typedef enum { ,OPTION_DISABLE_TILE ,OPTION_DISABLE_COB ,OPTION_BCI_FOR_XV + ,OPTION_DVI + ,OPTION_FORCE_PCI + ,OPTION_DMA_TYPE ,OPTION_AGP_MODE ,OPTION_AGP_SIZE - ,OPTION_DVI } SavageOpts; @@ -234,9 +236,13 @@ static const OptionInfoRec SavageOptions[] = { OPTION_DISABLE_TILE, "DisableTile", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_DISABLE_COB, "DisableCOB", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_BCI_FOR_XV, "BCIforXv", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_AGP_MODE, "AGPMode", OPTV_INTEGER, {0}, FALSE }, - { OPTION_AGP_SIZE, "AGPSize", OPTV_INTEGER, {0}, FALSE }, { OPTION_DVI, "DVI", OPTV_BOOLEAN, {0}, FALSE }, +#ifdef XF86DRI + { OPTION_FORCE_PCI, "ForcePCIMode", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_DMA_TYPE, "DmaType", OPTV_ANYSTR, {0}, FALSE }, + { OPTION_AGP_MODE, "AGPMode", OPTV_INTEGER, {0}, FALSE }, + { OPTION_AGP_SIZE, "AGPSize", OPTV_INTEGER, {0}, FALSE }, +#endif { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -1359,6 +1365,11 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s card detected\n", (psav->IsPCI) ? "PCI" : "AGP"); + if (xf86ReturnOptValBool(psav->Options, OPTION_FORCE_PCI, FALSE)) { + psav->IsPCI = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Forced into PCI-only mode\n"); + } + if (!psav->IsPCI) { from = X_DEFAULT; psav->agpMode = SAVAGE_DEFAULT_AGP_MODE; @@ -1408,6 +1419,30 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) psav->agpSize = 0; } + psav->AgpDMA = !psav->IsPCI; + if ((s = xf86GetOptValString(psav->Options, OPTION_DMA_TYPE))) { + if (strcmp(s, "AGP") == 0) { + if (psav->IsPCI) { + psav->AgpDMA = FALSE; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "AGP DMA not available on PCI card, using PCI DMA\n"); + } else { + psav->AgpDMA = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using AGP DMA\n"); + } + } else if (strcmp(s, "PCI") == 0) { + psav->AgpDMA = FALSE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using PCI DMA\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Invalid DmaType option, using %s DMA\n", + psav->AgpDMA ? "AGP" : "PCI"); + } + } else { + xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, + "Using %s DMA\n", psav->AgpDMA ? "AGP" : "PCI"); + } + #endif /* we can use Option "DisableTile TRUE" to disable tile mode */ diff --git a/src/savage_driver.h b/src/savage_driver.h index 760faf0..cd1d71f 100644 --- a/src/savage_driver.h +++ b/src/savage_driver.h @@ -263,7 +263,6 @@ typedef struct _Savage { int Chipset; int ChipId; int ChipRev; - int IsPCI; vbeInfoPtr pVbe; int EntityIndex; int ShadowCounter; @@ -335,6 +334,8 @@ typedef struct _Savage { void (*GetQuiescence)(ScrnInfoPtr pScrn); #endif + Bool IsPCI; + Bool AgpDMA; int agpMode; drmSize agpSize; FBLinearPtr reserved; |