OSDN Git Service

i965 gen4-6: Fix off-by-one errors brw_create_constant_surface()
authorPaul Berry <stereotype441@gmail.com>
Mon, 9 Jan 2012 22:45:04 +0000 (14:45 -0800)
committerPaul Berry <stereotype441@gmail.com>
Thu, 12 Jan 2012 23:12:10 +0000 (15:12 -0800)
commitf6f43bd5a276990c58c021bc047e60f9763df479
tree3c0df2f0926db5c636748003c6b404130ca4293a
parentaf0ce1dba8219ff8628f1fa61cf93c11a77dab94
i965 gen4-6: Fix off-by-one errors brw_create_constant_surface()

Commit 9bdc44a52804a64219a0ca1a061b18596863e524 (i965: Replace struct
with bit shifting for WM pull constant surfaces) accidentally
introduced off-by-one errors into the calculation of the surface
width, height, and depth.  This patch restores the correct
computation.

The reason this wasn't noticed by Piglit tests is that the size of our
constant surfaces is always less than 2^20, therefore the off-by-one
error was causing the "depth" field of the surface to be set to all
1's.  The hardware interpreted this as an extremely large surface, so
overflow checking was effectively disabled.

No Piglit regressions on Sandy Bridge.

NOTE: This is a candidate for the 7.11 and 8.0 branches.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_wm_surface_state.c