summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@fairlite.demon.co.uk>2005-03-21 18:57:39 +0000
committerAlan Hourihane <alanh@fairlite.demon.co.uk>2005-03-21 18:57:39 +0000
commit8bc9b0d7da5de9a3294687f450afb50452898c7d (patch)
tree70df19dc34fa727c43ddfe107060a49db691b976 /src
parent50a105e88cfdfc22fef8cfd2397fc5e9fae17663 (diff)
Fix some bad alignment problems when allocating memory from
the end of AGP space. Bugzilla #2764 (https://bugs.freedesktop.org/show_bug.cgi?id=2764)
Diffstat (limited to 'src')
-rw-r--r--src/i830_memory.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 15de1806..301c55b6 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -90,7 +90,7 @@ AllocFromPool(ScrnInfoPtr pScrn, I830MemRange *result, I830MemPool *pool,
end = pool->Free.End;
start = ROUND_DOWN_TO(end - size, alignment);
- needed = pool->Free.End - start;
+ needed = end - start;
}
}
if (needed > pool->Free.Size) {
@@ -123,10 +123,9 @@ AllocFromPool(ScrnInfoPtr pScrn, I830MemRange *result, I830MemPool *pool,
pool->Free.Start += needed;
result->End = pool->Free.Start;
} else {
- result->Start = ROUND_DOWN_TO(pool->Free.End - size, alignment) -
- pool->Total.End;
- result->End = pool->Free.End - pool->Total.End;
+ result->Start = ROUND_DOWN_TO(pool->Free.End - size, alignment);
pool->Free.End -= needed;
+ result->End = result->Start + needed;
}
pool->Free.Size = pool->Free.End - pool->Free.Start;
result->Size = result->End - result->Start;