i965: Program the dynamic state heap size to MAX_STATE_SIZE.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 29 Nov 2017 08:27:18 +0000 (00:27 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 29 Nov 2017 19:48:29 +0000 (11:48 -0800)
commitcfc5af588cf8e0cfb41ea907a7da3cca676be1c2
tree8ca9c49261389e4df8735c2aca2fa41a208f5b24
parent2c5f2936af642d8e4510154395215915c46b3fbb
i965: Program the dynamic state heap size to MAX_STATE_SIZE.

STATE_BASE_ADDRESS specifies a maximum size of the dynamic state
section, beyond which data supposedly reads back as 0.  On Gen8+,
we were programming it to the size of the buffer.  This worked fine
until we started growing the state buffer in commit 2dfc119f22f25708.
When the state buffer grows, the value in STATE_BASE_ADDRESS becomes
too small, and our state beyond STATE_SZ bytes would read back as 0.

To avoid having to update the value, we program it to MAX_STATE_SIZE.
We used to program the upper bound to the maximum on older hardware
anyway, so programming it too large isn't a big deal.

Bogus SURFACE_STATE can easily lead to GPU hangs and misrendering.
DiRT Rally was hitting the statebuffer growth path, and suffered from
bad texture corruption and GPU hangs (usually around the same time).

This patch fixes both issues.

Fixes: 2dfc119f22f257082ab0 "i965: Grow the batch/state buffers if we need space and can't flush."
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103101
Tested-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/mesa/drivers/dri/i965/brw_misc_state.c
src/mesa/drivers/dri/i965/intel_batchbuffer.c
src/mesa/drivers/dri/i965/intel_batchbuffer.h