summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Bumiller <[email protected]>2013-04-03 00:18:29 +0200
committerChristoph Bumiller <[email protected]>2013-04-03 12:54:44 +0200
commitba9b0b682f51222752ac56e7a0615f9bbb686089 (patch)
treed58fcd1d12ce10abb59a3802c18f18d61d536e05
parentf0a0d59f0fdceb756838ad6dad012852ba48362e (diff)
nv50: account for pesky prefetch in size calculation of linear textures
-rw-r--r--src/gallium/drivers/nv50/nv50_miptree.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c
index 5c839a81104..ed0f8c2b2f1 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -217,6 +217,7 @@ nv50_miptree_init_layout_linear(struct nv50_miptree *mt)
{
struct pipe_resource *pt = &mt->base.base;
const unsigned blocksize = util_format_get_blocksize(pt->format);
+ unsigned h = pt->height0;
if (util_format_is_depth_or_stencil(pt->format))
return FALSE;
@@ -228,7 +229,11 @@ nv50_miptree_init_layout_linear(struct nv50_miptree *mt)
mt->level[0].pitch = align(pt->width0 * blocksize, 64);
- mt->total_size = mt->level[0].pitch * pt->height0;
+ /* Account for very generous prefetch (allocate size as if tiled). */
+ h = MAX2(h, 8);
+ h = util_next_power_of_two(h);
+
+ mt->total_size = mt->level[0].pitch * h;
return TRUE;
}