Merge branch 'modesetting-origin' into modesetting

This commit is contained in:
Keith Packard 2006-12-30 21:58:36 -08:00
commit c70e7bc701
2 changed files with 51 additions and 40 deletions

View File

@ -1663,9 +1663,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
pScrn->currentMode = pScrn->modes;
#ifndef USE_PITCHES
#define USE_PITCHES 1
#endif
pI830->disableTiling = FALSE;
/*
@ -1685,18 +1682,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
if (I830IsPrimary(pScrn) && !pI830->directRenderingDisabled) {
int savedDisplayWidth = pScrn->displayWidth;
int memNeeded = 0;
/* Good pitches to allow tiling. Don't care about pitches < 1024. */
static const int pitches[] = {
/*
128 * 2,
128 * 4,
*/
128 * 8,
128 * 16,
128 * 32,
128 * 64,
0
};
Bool tiled = FALSE;
#ifdef I830_XV
/*
@ -1706,16 +1692,28 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
pI830->XvEnabled = !pI830->XvDisabled;
#endif
for (i = 0; pitches[i] != 0; i++) {
#if USE_PITCHES
if (pitches[i] >= pScrn->displayWidth) {
pScrn->displayWidth = pitches[i];
break;
if (IS_I965G(pI830)) {
int tile_pixels = 512 / pI830->cpp;
pScrn->displayWidth = (pScrn->displayWidth + tile_pixels - 1) &
~(tile_pixels - 1);
tiled = TRUE;
} else {
/* Good pitches to allow tiling. Don't care about pitches < 1024. */
static const int pitches[] = {
KB(1),
KB(2),
KB(4),
KB(8),
0
};
for (i = 0; pitches[i] != 0; i++) {
if (pitches[i] >= pScrn->displayWidth) {
pScrn->displayWidth = pitches[i];
tiled = TRUE;
break;
}
}
#else
if (pitches[i] == pScrn->displayWidth)
break;
#endif
}
/*
@ -1723,7 +1721,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
* memory available to enable tiling.
*/
savedMMSize = pI830->mmSize;
if (pScrn->displayWidth == pitches[i]) {
if (tiled) {
retry_dryrun:
I830ResetAllocations(pScrn, 0);
if (I830Allocate2DMemory(pScrn, ALLOCATE_DRY_RUN | ALLOC_INITIAL) &&

View File

@ -438,20 +438,33 @@ AllocateOverlay(ScrnInfoPtr pScrn, int flags)
#endif
static Bool
IsTileable(int pitch)
IsTileable(ScrnInfoPtr pScrn, int pitch)
{
I830Ptr pI830 = I830PTR(pScrn);
if (IS_I965G(pI830)) {
if (pitch / 512 * 512 == pitch && pitch <= KB(128))
return TRUE;
else
return FALSE;
}
/*
* Allow tiling for pitches that are a power of 2 multiple of 128 bytes,
* up to 64 * 128 (= 8192) bytes.
*/
switch (pitch) {
case 128 * 1:
case 128 * 2:
case 128 * 4:
case 128 * 8:
case 128 * 16:
case 128 * 32:
case 128 * 64:
case 128:
case 256:
if (IS_I945G(pI830) || IS_I945GM(pI830))
return TRUE;
else
return FALSE;
case 512:
case KB(1):
case KB(2):
case KB(4):
case KB(8):
return TRUE;
default:
return FALSE;
@ -475,7 +488,7 @@ I830AllocateRotatedBuffer(ScrnInfoPtr pScrn, int flags)
memset(&(pI830->RotatedMem), 0, sizeof(I830MemRange));
pI830->RotatedMem.Key = -1;
tileable = !(flags & ALLOC_NO_TILING) &&
IsTileable(pScrn->displayWidth * pI830->cpp);
IsTileable(pScrn, pScrn->displayWidth * pI830->cpp);
if (tileable) {
/* Make the height a multiple of the tile height (16) */
lines = (height + 15) / 16 * 16;
@ -540,7 +553,7 @@ I830AllocateRotated2Buffer(ScrnInfoPtr pScrn, int flags)
memset(&(pI830->RotatedMem2), 0, sizeof(I830MemRange));
pI830->RotatedMem2.Key = -1;
tileable = !(flags & ALLOC_NO_TILING) &&
IsTileable(pI830Ent->pScrn_2->displayWidth * pI8302->cpp);
IsTileable(pScrn, pI830Ent->pScrn_2->displayWidth * pI8302->cpp);
if (tileable) {
/* Make the height a multiple of the tile height (16) */
lines = (height + 15) / 16 * 16;
@ -699,7 +712,7 @@ I830AllocateFramebuffer(ScrnInfoPtr pScrn, I830Ptr pI830, BoxPtr FbMemBox,
}
tileable = !(flags & ALLOC_NO_TILING) && pI830->allowPageFlip &&
IsTileable(pScrn->displayWidth * pI830->cpp);
IsTileable(pScrn, pScrn->displayWidth * pI830->cpp);
if (tileable) {
if (IS_I9XX(pI830))
align = MB(1);
@ -886,7 +899,7 @@ I830Allocate2DMemory(ScrnInfoPtr pScrn, const int flags)
maxFb / lineSize - pScrn->virtualY);
pI830->FbMemBox.y2 = maxFb / lineSize;
tileable = !(flags & ALLOC_NO_TILING) && pI830->allowPageFlip &&
IsTileable(pScrn->displayWidth * pI830->cpp);
IsTileable(pScrn, pScrn->displayWidth * pI830->cpp);
if (tileable) {
if (IS_I9XX(pI830))
align = MB(1);
@ -1113,7 +1126,7 @@ I830AllocateBackBuffer(ScrnInfoPtr pScrn, const int flags)
memset(&(pI830->BackBuffer), 0, sizeof(pI830->BackBuffer));
pI830->BackBuffer.Key = -1;
tileable = !(flags & ALLOC_NO_TILING) &&
IsTileable(pScrn->displayWidth * pI830->cpp);
IsTileable(pScrn, pScrn->displayWidth * pI830->cpp);
if (tileable) {
/* Make the height a multiple of the tile height (16) */
lines = (height + 15) / 16 * 16;
@ -1176,7 +1189,7 @@ I830AllocateDepthBuffer(ScrnInfoPtr pScrn, const int flags)
memset(&(pI830->DepthBuffer), 0, sizeof(pI830->DepthBuffer));
pI830->DepthBuffer.Key = -1;
tileable = !(flags & ALLOC_NO_TILING) &&
IsTileable(pScrn->displayWidth * pI830->cpp);
IsTileable(pScrn, pScrn->displayWidth * pI830->cpp);
if (tileable) {
/* Make the height a multiple of the tile height (16) */
lines = (height + 15) / 16 * 16;
@ -1714,7 +1727,7 @@ I830SetupMemoryTiling(ScrnInfoPtr pScrn)
if (!pI830->directRenderingEnabled)
return;
if (!IsTileable(pScrn->displayWidth * pI830->cpp)) {
if (!IsTileable(pScrn, pScrn->displayWidth * pI830->cpp)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"I830SetupMemoryTiling: Not tileable 0x%x\n",
pScrn->displayWidth * pI830->cpp);