summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellström <thomas@shipmail.org>2006-01-27 19:55:35 +0000
committerThomas Hellström <thomas@shipmail.org>2006-01-27 19:55:35 +0000
commitfcc307ea75404d8a7be7d7fae02eebf89ee2fc7a (patch)
tree9c51bd32ef18fd401237614ad6d367ddc8362453
parent6971ad4fc83187110d0e60cc2ee7a607f8f686ea (diff)
- Options - Planemask - and manual fixes.
-rw-r--r--ChangeLog11
-rw-r--r--unichrome/via.man10
-rw-r--r--unichrome/via_3d.c4
-rw-r--r--unichrome/via_accel.c51
-rw-r--r--unichrome/via_driver.c19
-rw-r--r--unichrome/via_driver.h1
6 files changed, 79 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 413c6d1..6f34aa2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2006-01-27 Thomas Hellström <thomas-at-tungstengraphics-dot-com>
+
+ * unichrome/via.man:
+ * unichrome/via_3d.c:
+ * unichrome/via_accel.c: (viaAccelPlaneMaskHelper), (viaInitExa),
+ (viaExitAccel), (viaFinishInitAccel):
+ * unichrome/via_driver.c: (VIAPreInit):
+ * unichrome/via_driver.h:
+
+ - Options - Planemask - and manual fixes.
+
2006-01-12 Thomas Hellström <unichrome-at-shipmail-dot-org>
* unichrome/via_accel.c: (viaExaDownloadFromScreen),
diff --git a/unichrome/via.man b/unichrome/via.man
index a1bee7f..2d6985f 100644
--- a/unichrome/via.man
+++ b/unichrome/via.man
@@ -119,6 +119,16 @@ make use of this on the CLE266 to consume much less CPU.
.TP
.BI "Option \*qNoAGPFor2D\*q \*q" boolean \*q
With this option on, 2D acceleration will not use AGP DMA even if it is enabled.
+.TP
+.BI "Option \*qAccelMethod\*q \*q" string \*q
+The driver supports \*qXAA\*q and \*EXA\* acceleration methods. The default method is
+XAA, since EXA is still experimental. Contrary to XAA. EXA implements acceleration for
+screen uploads and downlads (if DRI is enabled) and the Render / Composite extension.
+.TP
+.BI "Option \*qEXANoComposite\*q \*q" boolean \*q
+If Exa is enabled using the above option, Don't accelerate composite. Since EXA, and in
+particular, it's composite acceleration is still experimental, This is a way to disable
+exa composite acceleration.
.SH "Supported TV Encoders"
Unichromes tend to be paired with several different TV Encoders.
diff --git a/unichrome/via_3d.c b/unichrome/via_3d.c
index b1746ed..54fb360 100644
--- a/unichrome/via_3d.c
+++ b/unichrome/via_3d.c
@@ -50,7 +50,7 @@ static Via3DFormat via3DFormats[256];
#define VIA_NUM_3D_FORMATS 15
#define VIA_FMT_HASH(arg) (((((arg) >> 1) + (arg)) >> 8) & 0xFF)
-static CARD32 viaOpCodes[VIA_NUM_3D_OPCODES][5] = {
+static const CARD32 viaOpCodes[VIA_NUM_3D_OPCODES][5] = {
{PictOpClear, 0x05, 0x45, 0x40, 0x80},
{PictOpSrc, 0x15, 0x45, 0x50, 0x80},
{PictOpDst, 0x05, 0x55, 0x40, 0x90},
@@ -72,7 +72,7 @@ static CARD32 viaOpCodes[VIA_NUM_3D_OPCODES][5] = {
{PictOpConjointDst, 0x05, 0x55, 0x40, 0x90}
};
-static CARD32 viaFormats[VIA_NUM_3D_FORMATS][5] = {
+static const CARD32 viaFormats[VIA_NUM_3D_FORMATS][5] = {
{PICT_x1r5g5b5, HC_HDBFM_RGB555, HC_HTXnFM_RGB555, 1, 1},
{PICT_r5g6b5, HC_HDBFM_RGB565, HC_HTXnFM_RGB565, 1, 1},
{PICT_a4r4g4b4, HC_HDBFM_ARGB4444, HC_HTXnFM_ARGB4444, 1, 1},
diff --git a/unichrome/via_accel.c b/unichrome/via_accel.c
index fdaa94f..65a6670 100644
--- a/unichrome/via_accel.c
+++ b/unichrome/via_accel.c
@@ -465,7 +465,7 @@ viaAccelPlaneMaskHelper(ViaTwodContext * tdc, CARD32 planeMask)
* Masking doesn't work in 8bpp.
*/
- if (modeMask == 0x0F) {
+ if (modeMask == 0xFF) {
tdc->keyControl &= 0x0FFFFFFF;
return FALSE;
}
@@ -475,7 +475,7 @@ viaAccelPlaneMaskHelper(ViaTwodContext * tdc, CARD32 planeMask)
*/
for (i = 0; i < (1 << tdc->bytesPPShift); ++i) {
- curByteMask = (0xFF << i);
+ curByteMask = (0xFF << (i << 3));
if ((planeMask & curByteMask) == 0) {
curMask |= (1 << i);
@@ -2121,10 +2121,14 @@ viaInitExa(ScreenPtr pScreen)
#endif
pExa->accel.UploadToScratch = viaExaUploadToScratch;
- pExa->accel.CheckComposite = viaExaCheckComposite;
- pExa->accel.PrepareComposite = viaExaPrepareComposite;
- pExa->accel.Composite = viaExaComposite;
- pExa->accel.DoneComposite = viaExaDoneSolidCopy;
+
+ if (!pVia->noComposite) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,"[EXA] Disabling EXA accelerated composite.\n");
+ pExa->accel.CheckComposite = viaExaCheckComposite;
+ pExa->accel.PrepareComposite = viaExaPrepareComposite;
+ pExa->accel.Composite = viaExaComposite;
+ pExa->accel.DoneComposite = viaExaDoneSolidCopy;
+ }
if (!exaDriverInit(pScreen, pExa)) {
xfree(pExa);
@@ -2197,6 +2201,7 @@ viaInitAccel(ScreenPtr pScreen)
if (pVia->driSize > (16 * 1024 * 1024))
pVia->driSize = 16 * 1024 * 1024;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,"[EXA] Enabled EXA acceleration.\n");
return TRUE;
}
#endif
@@ -2249,15 +2254,10 @@ viaExitAccel(ScreenPtr pScreen)
VIAPtr pVia = VIAPTR(pScrn);
viaAccelSync(pScrn);
+ viaTearDownCBuffer(&pVia->cb);
#ifdef VIA_HAVE_EXA
if (pVia->useEXA) {
- if (pVia->exaDriverPtr) {
- exaDriverFini(pScreen);
- }
- xfree(pVia->exaDriverPtr);
- pVia->exaDriverPtr = NULL;
- viaTearDownCBuffer(&pVia->cb);
#ifdef XF86DRI
if (pVia->directRenderingEnabled) {
if (pVia->texAddr) {
@@ -2265,7 +2265,9 @@ viaExitAccel(ScreenPtr pScreen)
&pVia->texAGPBuffer, sizeof(drm_via_mem_t));
pVia->texAddr = NULL;
}
- if (pVia->scratchAddr) {
+ if (pVia->scratchAddr && !pVia->IsPCI &&
+ ((unsigned long)pVia->scratchAddr -
+ (unsigned long)pVia->agpMappedAddr == pVia->scratchOffset)) {
drmCommandWrite(pVia->drmFD, DRM_VIA_FREEMEM,
&pVia->scratchAGPBuffer, sizeof(drm_via_mem_t));
pVia->scratchAddr = NULL;
@@ -2278,16 +2280,28 @@ viaExitAccel(ScreenPtr pScreen)
exaOffscreenFree(pScreen, pVia->scratchFBBuffer);
pVia->scratchAddr = NULL;
}
+ if (pVia->exaDriverPtr) {
+ exaDriverFini(pScreen);
+ }
+ xfree(pVia->exaDriverPtr);
+ pVia->exaDriverPtr = NULL;
return;
}
#endif
if (pVia->AccelInfoRec) {
XAADestroyInfoRec(pVia->AccelInfoRec);
pVia->AccelInfoRec = NULL;
- viaTearDownCBuffer(&pVia->cb);
}
}
+
+/*
+ * Allocate command buffer and
+ * buffers for accelerated upload, download and
+ * the EXA scratch area. The Scratch area resides primarily in
+ * AGP memory but reverts to FB if AGP is not available.
+ */
+
void
viaFinishInitAccel(ScreenPtr pScreen)
{
@@ -2299,7 +2313,9 @@ viaFinishInitAccel(ScreenPtr pScreen)
int size, ret;
if (pVia->directRenderingEnabled && pVia->useEXA) {
+
pVia->dBounce = xcalloc(VIA_DMA_DL_SIZE * 2, 1);
+
if (!pVia->IsPCI) {
/*
@@ -2308,6 +2324,7 @@ viaFinishInitAccel(ScreenPtr pScreen)
if (pVia->exaDriverPtr->accel.UploadToScreen ==
viaExaTexUploadToScreen) {
+
size = VIA_AGP_UPL_SIZE * 2 + 32;
pVia->texAGPBuffer.context = 1;
pVia->texAGPBuffer.size = size;
@@ -2315,6 +2332,7 @@ viaFinishInitAccel(ScreenPtr pScreen)
ret =
drmCommandWriteRead(pVia->drmFD, DRM_VIA_ALLOCMEM,
&pVia->texAGPBuffer, sizeof(drm_via_mem_t));
+
if (ret || size != pVia->texAGPBuffer.size) {
pVia->texAGPBuffer.size = 0;
} else {
@@ -2325,7 +2343,9 @@ viaFinishInitAccel(ScreenPtr pScreen)
pVia->texAddr =
(char *)pVia->agpMappedAddr + pVia->texOffset;
}
+
}
+
size = VIA_SCRATCH_SIZE + 32;
pVia->scratchAGPBuffer.context = 1;
pVia->scratchAGPBuffer.size = size;
@@ -2344,10 +2364,12 @@ viaFinishInitAccel(ScreenPtr pScreen)
pVia->scratchAddr =
(char *)pVia->agpMappedAddr + pVia->scratchOffset;
}
+
}
}
#endif
if (!pVia->scratchAddr && pVia->useEXA) {
+
pVia->scratchFBBuffer =
exaOffscreenAlloc(pScreen, VIA_SCRATCH_SIZE, 32, TRUE, NULL,
NULL);
@@ -2358,6 +2380,7 @@ viaFinishInitAccel(ScreenPtr pScreen)
pVia->scratchOffset = pVia->scratchFBBuffer->offset;
pVia->scratchAddr = (char *)pVia->FBBase + pVia->scratchOffset;
}
+
}
#endif
if (Success != viaSetupCBuffer(pScrn, &pVia->cb, 0)) {
diff --git a/unichrome/via_driver.c b/unichrome/via_driver.c
index 33e664f..f0859da 100644
--- a/unichrome/via_driver.c
+++ b/unichrome/via_driver.c
@@ -146,7 +146,8 @@ typedef enum {
OPTION_INSECUREDRI,
OPTION_TVDEFLICKER,
OPTION_AGP_DMA,
- OPTION_2D_DMA
+ OPTION_2D_DMA,
+ OPTION_EXA_NOCOMPOSITE
} VIAOpts;
@@ -183,6 +184,7 @@ static OptionInfoRec VIAOptions[] =
{OPTION_DISABLEIRQ, "DisableIRQ", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_AGP_DMA, "EnableAGPDMA", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_2D_DMA, "NoAGPFor2D", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_EXA_NOCOMPOSITE, "ExaNoComposite", OPTV_BOOLEAN, {0}, FALSE},
{-1, NULL, OPTV_NONE, {0}, FALSE}
};
@@ -284,6 +286,7 @@ static const char *exaSymbols[] = {
"exaOffscreenFree",
"exaGetPixmapPitch",
"exaGetPixmapOffset",
+ "exaWaitSync",
NULL
};
#endif
@@ -908,6 +911,19 @@ static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags)
}
xf86DrvMsg(pScrn->scrnIndex, from, "Using %s acceleration architecture\n",
pVia->useEXA ? "EXA" : "XAA");
+
+ pVia->noComposite = FALSE;
+ if (pVia->useEXA) {
+ if (xf86ReturnOptValBool(VIAOptions, OPTION_EXA_NOCOMPOSITE, FALSE)) {
+ pVia->noComposite = TRUE;
+ if (pVia->agpEnable) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Option: ExaNoComposite - Disable Composite acceleration for EXA\n");
+ }
+ } else {
+ pVia->noComposite = FALSE;
+ }
+ }
}
#endif /* VIA_HAVE_EXA */
@@ -983,6 +999,7 @@ static Bool VIAPreInit(ScrnInfoPtr pScrn, int flags)
pVia->dma2d = TRUE;
}
+
#ifdef HAVE_DEBUG
if (xf86ReturnOptValBool(VIAOptions, OPTION_VBEMODES, FALSE)) {
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
diff --git a/unichrome/via_driver.h b/unichrome/via_driver.h
index 9cffd8a..fad3de1 100644
--- a/unichrome/via_driver.h
+++ b/unichrome/via_driver.h
@@ -265,6 +265,7 @@ typedef struct _VIA {
ExaOffscreenArea *scratchFBBuffer;
unsigned scratchOffset;
char * scratchAddr;
+ Bool noComposite;
#ifdef XF86DRI
drm_via_mem_t scratchAGPBuffer;
drm_via_mem_t texAGPBuffer;