Commit 33033884 authored by Felix Kühling's avatar Felix Kühling

- Support for the new DRM version 2.4 with command DMA.

- Added an option "DmaMode" to choose between vertex and command DMA.
- Allow ShadowStatus to be explicitly disabled even with DRI enabled.
- Updated the man page.
parent 21bf4905
......@@ -127,11 +127,13 @@ Default: on (use the BIOS).
Enables the use of a shadow status register. There is a chip bug in the
Savage graphics engine that can cause a bus lock when reading the engine
status register under heavy load, such as when scrolling text or dragging
windows. The bug affects about 4% of all Savage users. If your system
windows. The bug affects about 4% of all Savage users without DRI and
a large fraction of users with DRI. If your system
hangs regularly while scrolling text or dragging windows, try turning this
option on. This uses an alternate method of reading the engine status
which is slightly more expensive, but avoids the problem. Default: off
(use normal status register).
which is slightly more expensive, but avoids the problem. When DRI is
enabled then the default is \*qon\*q (use shadow status), otherwise
the default is \*qoff\*q (use normal status register).
.TP
.BI "Option \*qDisableCOB\*q \*q" boolean \*q
Disables the COB (Command Overflow Buffer) on savage4 and newer chips.
......@@ -164,6 +166,23 @@ The amount of AGP memory that will allocated for DMA and textures in
MB. Valid sizes are 4, 8, 16, 32, 64, 128 and 256. The default is
16MB.
.TP
.BI "Option \*qDmaMode\*q \*q" string \*q
This option influences in which way DMA (direct memory access) is used
by the kernel and 3D drivers.
.br
Any \-\- Try command DMA first, then vertex DMA (default)
.br
Command \-\- Only use command DMA or don't use DMA at all
.br
Vertex \-\- Only use vertex DMA or don't use DMA at all
.br
None \-\- Disable DMA
.br
Command and vertex DMA cannot be enabled at the same time. Which DMA
mode is actually used in the end also depends on the DRM version (only
>= 2.4.0 supports command DMA) and the hardware (Savage3D/MX/IX
doesn't support command DMA).
.TP
.BI "Option \*qDmaType\*q \*q" string \*q
The type of memory that will be used by the 3D driver for DMA (direct
memory access).
......
This diff is collapsed.
......@@ -34,6 +34,8 @@
#define SAVAGE_NUM_BUFFERS 32
#define SAVAGE_BUFFER_SIZE (1 << 16) /* 64k */
#define SAVAGE_CMDDMA_SIZE 0x100000 /* 1MB */
#define SAVAGE_DEFAULT_AGP_MODE 1
#define SAVAGE_MAX_AGP_MODE 4
......@@ -101,6 +103,9 @@ typedef struct _server{
drmRegion agpTextures;
int logAgpTextureGranularity;
/* command DMA */
drmRegion cmdDma;
#if 0
drmBufMapPtr drmBuffers;
#endif
......
......@@ -213,6 +213,7 @@ typedef enum {
,OPTION_DVI
,OPTION_BUS_TYPE
,OPTION_DMA_TYPE
,OPTION_DMA_MODE
,OPTION_AGP_MODE
,OPTION_AGP_SIZE
} SavageOpts;
......@@ -243,6 +244,7 @@ static const OptionInfoRec SavageOptions[] =
#ifdef XF86DRI
{ OPTION_BUS_TYPE, "BusType", OPTV_ANYSTR, {0}, FALSE },
{ OPTION_DMA_TYPE, "DmaType", OPTV_ANYSTR, {0}, FALSE },
{ OPTION_DMA_MODE, "DmaMode", OPTV_ANYSTR, {0}, FALSE },
{ OPTION_AGP_MODE, "AGPMode", OPTV_INTEGER, {0}, FALSE },
{ OPTION_AGP_SIZE, "AGPSize", OPTV_INTEGER, {0}, FALSE },
#endif
......@@ -1223,9 +1225,12 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg( pScrn->scrnIndex, X_CONFIG,
"Option: LCDClock %1.2f MHz\n", psav->LCDClock );
if( xf86GetOptValBool( psav->Options, OPTION_SHADOW_STATUS, &psav->ShadowStatus))
if( xf86GetOptValBool( psav->Options, OPTION_SHADOW_STATUS, &psav->ShadowStatus)) {
xf86DrvMsg( pScrn->scrnIndex, X_CONFIG,
"Option: ShadowStatus enabled\n" );
"Option: ShadowStatus %sabled\n", psav->ShadowStatus ? "en" : "dis" );
psav->ForceShadowStatus = TRUE;
} else
psav->ForceShadowStatus = FALSE;
/* If ShadowStatus is off it will be automatically enabled for DRI.
* If DRI initialization fails fall back to ConfigShadowStatus. */
psav->ConfigShadowStatus = psav->ShadowStatus;
......@@ -1427,6 +1432,36 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags)
"Using %s DMA\n", psav->AgpDMA ? "AGP" : "PCI");
}
psav->CommandDMA = TRUE;
psav->VertexDMA = TRUE;
from = X_DEFAULT;
if ((s = xf86GetOptValString(psav->Options, OPTION_DMA_MODE))) {
from = X_CONFIG;
if (strcmp(s, "Command") == 0)
psav->VertexDMA = FALSE;
else if (strcmp(s, "Vertex") == 0)
psav->CommandDMA = FALSE;
else if (strcmp(s, "None") == 0)
psav->VertexDMA = psav->CommandDMA = FALSE;
else if (strcmp(s, "Any") != 0) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Invalid DmaMode option\n");
from = X_DEFAULT;
}
}
psav->CommandDMA = (psav->CommandDMA && !S3_SAVAGE3D_SERIES(psav->Chipset));
if (psav->CommandDMA && psav->VertexDMA)
xf86DrvMsg(pScrn->scrnIndex, from,
"Will try command and vertex DMA mode\n");
else if (psav->CommandDMA && !psav->VertexDMA)
xf86DrvMsg(pScrn->scrnIndex, from,
"Will try only command DMA mode\n");
else if (!psav->CommandDMA && psav->VertexDMA)
xf86DrvMsg(pScrn->scrnIndex, from,
"Will try only vertex DMA mode\n");
else
xf86DrvMsg(pScrn->scrnIndex, from,
"DMA disabled\n");
if (!psav->IsPCI) {
from = X_DEFAULT;
psav->agpMode = SAVAGE_DEFAULT_AGP_MODE;
......@@ -3026,13 +3061,14 @@ static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen,
/* Setup DRI after visuals have been established */
psav->directRenderingEnabled = SAVAGEDRIScreenInit(pScreen);
/* If DRI init failed, reset shadow status. */
if (!psav->directRenderingEnabled) {
if (!psav->directRenderingEnabled &&
psav->ShadowStatus != psav->ConfigShadowStatus) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Resetting ShadowStatus.\n");
SavageInitShadowStatus(pScrn);
}
/* If shadow status was enabled for DRI, hook up the shadow
* waiting functions now. */
else if (!psav->ConfigShadowStatus) {
else if (psav->ShadowStatus && !psav->ConfigShadowStatus) {
psav->WaitQueue = ShadowWaitQueue;
psav->WaitIdle = ShadowWait;
psav->WaitIdleEmpty = ShadowWait;
......@@ -3211,7 +3247,8 @@ static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen,
psav->directRenderingEnabled = SAVAGEDRIFinishScreenInit(pScreen);
/* If DRI initialization failed, reset shadow status and
* reinitialize 2D engine. */
if (!psav->directRenderingEnabled) {
if (!psav->directRenderingEnabled &&
psav->ShadowStatus != psav->ConfigShadowStatus) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Resetting ShadowStatus.\n");
SavageInitShadowStatus(pScrn);
SavageInitialize2DEngine(pScrn);
......
......@@ -234,6 +234,7 @@ typedef struct _Savage {
double LCDClock;
Bool ConfigShadowStatus; /* from the config */
Bool ShadowStatus; /* automatically enabled with DRI */
Bool ForceShadowStatus; /* true if explicitly set in conf */
Bool CrtOnly;
Bool TvOn;
Bool PAL;
......@@ -340,6 +341,8 @@ typedef struct _Savage {
Bool IsPCI;
Bool AgpDMA;
Bool VertexDMA;
Bool CommandDMA;
int agpMode;
drmSize agpSize;
FBLinearPtr reserved;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment