summaryrefslogtreecommitdiff
path: root/driver/xf86-video-intel/src/i830_memory.c
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2007-08-04 19:55:22 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2007-08-04 19:55:22 +0000
commit52f6797c11bf512d42d4ea30f70a6fdedae6f9ad (patch)
treead49b43d366b8ce3e2757c09705e6887d484b743 /driver/xf86-video-intel/src/i830_memory.c
parentd065bc8d15ac80bbdf19382ed84bf60e2f31d642 (diff)
Add support for the mobile i965GM chipset.
tested by many ok matthieu@
Diffstat (limited to 'driver/xf86-video-intel/src/i830_memory.c')
-rw-r--r--driver/xf86-video-intel/src/i830_memory.c78
1 files changed, 46 insertions, 32 deletions
diff --git a/driver/xf86-video-intel/src/i830_memory.c b/driver/xf86-video-intel/src/i830_memory.c
index 2d09b2d4d..d1c670670 100644
--- a/driver/xf86-video-intel/src/i830_memory.c
+++ b/driver/xf86-video-intel/src/i830_memory.c
@@ -1107,6 +1107,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;
#if ALLOCATE_ALL_BIOSMEM
@@ -1286,37 +1292,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;
}
@@ -1514,7 +1524,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;
@@ -1694,7 +1706,7 @@ MakeTiles(ScrnInfoPtr pScrn, I830MemRange *pMem, unsigned int fence)
pitch = pScrn->displayWidth * pI830->cpp;
- if (IS_I965G(pI830)) {
+ if (IS_I96X(pI830)) {
I830RegPtr i830Reg = &pI830->ModeReg;
switch (fence) {
@@ -1913,7 +1925,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
@@ -1997,7 +2010,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