summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorLuca Barbieri <luca@luca-barbieri.com>2010-02-23 08:55:24 -0800
committerJosé Fonseca <jfonseca@vmware.com>2010-02-23 19:50:24 +0000
commit2f5beb4b530d47d6b4a7cf0effeaec0d2c1b6ea4 (patch)
tree307c8c028ec31556434797fa9593f0623b63ad87 /src/gallium/auxiliary
parentc36b912e09a12b60d26fd1ebe0939b457514d800 (diff)
pipebuffer: slab: if size < alignment, use alignment to find bucket
If the size is lower than the alignment, we must use the alignment to select the bucket. Otherwise, the selected bucket won't be able to satisfy our request and will fail. Signed-off-by: José Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
index c445cb578b..24e2820f88 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
@@ -483,11 +483,15 @@ pb_slab_range_manager_create_buffer(struct pb_manager *_mgr,
{
struct pb_slab_range_manager *mgr = pb_slab_range_manager(_mgr);
pb_size bufSize;
+ pb_size reqSize = size;
unsigned i;
+ if(desc->alignment > reqSize)
+ reqSize = desc->alignment;
+
bufSize = mgr->minBufSize;
for (i = 0; i < mgr->numBuckets; ++i) {
- if(bufSize >= size)
+ if(bufSize >= reqSize)
return mgr->buckets[i]->create_buffer(mgr->buckets[i], size, desc);
bufSize *= 2;
}