From 8bc9b0d7da5de9a3294687f450afb50452898c7d Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Mon, 21 Mar 2005 18:57:39 +0000 Subject: 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) --- src/i830_memory.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') 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; -- cgit v1.2.3