summaryrefslogtreecommitdiff
path: root/hw/kdrive/src/koffscreen.c
diff options
context:
space:
mode:
authorDamien Ciabrini <braun@club-internet.fr>2005-07-06 13:57:41 +0000
committerDamien Ciabrini <braun@club-internet.fr>2005-07-06 13:57:41 +0000
commitc48f631cdb6a279ab1a24a486b05956cfa9ca3da (patch)
tree005a4ea8e0b3fa19ab058727f12689fa4d4080d9 /hw/kdrive/src/koffscreen.c
parentbaa99be190c51b533bf8748c6c6a9bce62594e96 (diff)
Fix offset alignment code in the offscreen memory allocator to prevent
textures from being allocated in the next free memory area.
Diffstat (limited to 'hw/kdrive/src/koffscreen.c')
-rw-r--r--hw/kdrive/src/koffscreen.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/hw/kdrive/src/koffscreen.c b/hw/kdrive/src/koffscreen.c
index ef42ebbe8..4f69aacea 100644
--- a/hw/kdrive/src/koffscreen.c
+++ b/hw/kdrive/src/koffscreen.c
@@ -46,11 +46,11 @@ KdOffscreenValidate (ScreenPtr pScreen)
for (area = pScreenPriv->off_screen_areas; area; area = area->next)
{
if (prev)
- assert (prev->area.offset + prev->area.size == area->area.offset);
+ assert (prev->offset + prev->size == area->offset);
prev = area;
}
- assert (prev->area.offset + prev->area.size == pScreenPriv->screen->memory_size);
+ assert (prev->offset + prev->size == pScreenPriv->screen->memory_size);
}
#else
#define KdOffscreenValidate(s)
@@ -214,7 +214,11 @@ KdOffscreenAlloc (ScreenPtr pScreen, int size, int align,
area->score = 0;
area->save_offset = area->offset;
- area->offset = (area->offset + align - 1) & ~(align - 1);
+ {
+ int tmp = area->offset % align;
+ if (tmp)
+ area->offset += (align - tmp);
+ }
KdOffscreenValidate (pScreen);