summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_context.h
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2016-06-08 17:53:24 -0700
committerFrancisco Jerez <currojerez@riseup.net>2016-06-13 15:55:58 -0700
commit013ae4a70aeb40dc74e53943824bff33dda109e1 (patch)
treef8cac9d46764e422846d59b968811c6b7a13e7c9 /src/mesa/drivers/dri/i965/brw_context.h
parent2df8f4a2534e1e2258a719e7c5cbf342621fdf1f (diff)
downloadexternal_mesa3d-013ae4a70aeb40dc74e53943824bff33dda109e1.zip
external_mesa3d-013ae4a70aeb40dc74e53943824bff33dda109e1.tar.gz
external_mesa3d-013ae4a70aeb40dc74e53943824bff33dda109e1.tar.bz2
i965: Fix scratch overallocation if the original slot size was already a power of two.
The bitwise arithmetic trick used in brw_get_scratch_size() to clamp the scratch allocation to 1KB has the unintended side effect that it will cause us to allocate 2x the required amount of scratch space if the original per-thread scratch size happened to be already a power of two. Instead use the obvious MAX2 idiom to clamp the scratch allocation to the expected range. Cc: <mesa-stable@lists.freedesktop.org> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_context.h')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 4b22201..daa9ed2 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1477,7 +1477,7 @@ void brwInitFragProgFuncs( struct dd_function_table *functions );
static inline int
brw_get_scratch_size(int size)
{
- return util_next_power_of_two(size | 1023);
+ return MAX2(1024, util_next_power_of_two(size));
}
void brw_get_scratch_bo(struct brw_context *brw,
drm_intel_bo **scratch_bo, int size);