summaryrefslogtreecommitdiff
path: root/src/i830_memory.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2006-11-16 19:47:24 -0800
committerEric Anholt <eric@anholt.net>2006-11-16 19:47:24 -0800
commit9948d8377d70e898260c12210151b952b3fb8bf1 (patch)
tree4b06daa112c4bc053586cfa832837e069d017fa8 /src/i830_memory.c
parent45a27f80e1c783627f570c309e7a853dcc9af0c1 (diff)
parentb649f95ea6fd3555d073fdbf8f2f035dfe1afd33 (diff)
Merge branch 'master' into modesetting
Conflicts: src/i830.h src/i830_cursor.c src/i830_dri.c src/i830_driver.c src/i830_video.c
Diffstat (limited to 'src/i830_memory.c')
-rw-r--r--src/i830_memory.c76
1 files changed, 45 insertions, 31 deletions
diff --git a/src/i830_memory.c b/src/i830_memory.c
index a14027d6..52131775 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -1099,6 +1099,12 @@ I830ResetAllocations(ScrnInfoPtr pScrn, const int flags)
pI830->MemoryAperture.Start = pI830->StolenMemory.End;
pI830->MemoryAperture.End = pI830->FbMapSize;
pI830->MemoryAperture.Size = pI830->FbMapSize - pI830->StolenMemory.Size;
+#ifdef XF86DRI
+ if (!pI830->directRenderingDisabled) {
+ pI830->MemoryAperture.End -= KB(pI830->mmSize);
+ pI830->MemoryAperture.Size -= KB(pI830->mmSize);
+ }
+#endif
pI830->StolenPool.Fixed = pI830->StolenMemory;
pI830->StolenPool.Total = pI830->StolenMemory;
pI830->StolenPool.Free = pI830->StolenPool.Total;
@@ -1271,37 +1277,41 @@ I830AllocateTextureMemory(ScrnInfoPtr pScrn, const int flags)
/* Allocate the remaining space for textures. */
memset(&(pI830->TexMem), 0, sizeof(pI830->TexMem));
pI830->TexMem.Key = -1;
- size = GetFreeSpace(pScrn);
- if (dryrun && (size < MB(1)))
- size = MB(1);
- i = myLog2(size / I830_NR_TEX_REGIONS);
- if (i < I830_LOG_MIN_TEX_REGION_SIZE)
- i = I830_LOG_MIN_TEX_REGION_SIZE;
- pI830->TexGranularity = i;
- /* Truncate size */
- size >>= i;
- size <<= i;
- if (size < KB(512)) {
- if (!dryrun) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Less than 512 kBytes for texture space (real %ld kBytes).\n",
- size / 1024);
+
+ if (pI830->mmModeFlags & I830_KERNEL_TEX) {
+
+ size = GetFreeSpace(pScrn);
+ if (dryrun && (size < MB(1)))
+ size = MB(1);
+ i = myLog2(size / I830_NR_TEX_REGIONS);
+ if (i < I830_LOG_MIN_TEX_REGION_SIZE)
+ i = I830_LOG_MIN_TEX_REGION_SIZE;
+ pI830->TexGranularity = i;
+ /* Truncate size */
+ size >>= i;
+ size <<= i;
+ if (size < KB(512)) {
+ if (!dryrun) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Less than 512 kBytes for texture space (real %ld kBytes).\n",
+ size / 1024);
+ }
+ return FALSE;
}
- return FALSE;
- }
- alloced = I830AllocVidMem(pScrn, &(pI830->TexMem),
- &(pI830->StolenPool), size, GTT_PAGE_SIZE,
- flags | FROM_ANYWHERE | ALLOCATE_AT_TOP);
- if (alloced < size) {
- if (!dryrun) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Failed to allocate texture space.\n");
+ alloced = I830AllocVidMem(pScrn, &(pI830->TexMem),
+ &(pI830->StolenPool), size, GTT_PAGE_SIZE,
+ flags | FROM_ANYWHERE | ALLOCATE_AT_TOP);
+ if (alloced < size) {
+ if (!dryrun) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to allocate texture space.\n");
+ }
+ return FALSE;
}
- return FALSE;
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity,
+ "%sAllocated %ld kB for textures at 0x%lx\n", s,
+ alloced / 1024, pI830->TexMem.Start);
}
- xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verbosity,
- "%sAllocated %ld kB for textures at 0x%lx\n", s,
- alloced / 1024, pI830->TexMem.Start);
return TRUE;
}
@@ -1499,7 +1509,9 @@ I830FixupOffsets(ScrnInfoPtr pScrn)
I830FixOffset(pScrn, &(pI830->ContextMem));
I830FixOffset(pScrn, &(pI830->BackBuffer));
I830FixOffset(pScrn, &(pI830->DepthBuffer));
- I830FixOffset(pScrn, &(pI830->TexMem));
+ if (pI830->mmModeFlags & I830_KERNEL_TEX) {
+ I830FixOffset(pScrn, &(pI830->TexMem));
+ }
}
#endif
return TRUE;
@@ -1898,7 +1910,8 @@ I830BindAGPMemory(ScrnInfoPtr pScrn)
return FALSE;
if (!BindMemRange(pScrn, &(pI830->DepthBuffer)))
return FALSE;
- if (!BindMemRange(pScrn, &(pI830->TexMem)))
+ if ((pI830->mmModeFlags & I830_KERNEL_TEX) &&
+ !BindMemRange(pScrn, &(pI830->TexMem)))
return FALSE;
}
#endif
@@ -1982,7 +1995,8 @@ I830UnbindAGPMemory(ScrnInfoPtr pScrn)
return FALSE;
if (!UnbindMemRange(pScrn, &(pI830->DepthBuffer)))
return FALSE;
- if (!UnbindMemRange(pScrn, &(pI830->TexMem)))
+ if ((pI830->mmModeFlags & I830_KERNEL_TEX) &&
+ !UnbindMemRange(pScrn, &(pI830->TexMem)))
return FALSE;
}
#endif