summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_fs.cpp
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2016-06-09 18:13:26 -0700
committerKenneth Graunke <kenneth@whitecape.org>2016-06-12 00:40:15 -0700
commit1db37ebecf5af55215ace3801f8dbb8b10c5305e (patch)
treebd8a8b4d38fb33c8215ce3a332a4c93448f88854 /src/mesa/drivers/dri/i965/brw_fs.cpp
parenta42a93dc123163f84058f3886e5ce1b02b9856f5 (diff)
downloadexternal_mesa3d-1db37ebecf5af55215ace3801f8dbb8b10c5305e.zip
external_mesa3d-1db37ebecf5af55215ace3801f8dbb8b10c5305e.tar.gz
external_mesa3d-1db37ebecf5af55215ace3801f8dbb8b10c5305e.tar.bz2
i965: Assert that the scratch spaces are in range.
I don't know that anything actually guarantees this, but if we exceed the limits, we may end up overflowing and trashing random buffers that happen to be nearby in the VMA space, leading to rendering corruption, hangs, or worse. We should really fix this properly. However, the pitfall has existed for ages, so for now we should at least detect it. Cc: "12.0" <mesa-stable@lists.freedesktop.org> Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs.cpp')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index f1a1c87..104c20b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -6001,7 +6001,21 @@ fs_visitor::allocate_registers(bool allow_spilling)
* size linearly with a range of [1kB, 12kB] and 1kB granularity.
*/
prog_data->total_scratch = ALIGN(last_scratch, 1024);
+
+ assert(prog_data->total_scratch < 12 * 1024);
}
+
+ /* We currently only support up to 2MB of scratch space. If we
+ * need to support more eventually, the documentation suggests
+ * that we could allocate a larger buffer, and partition it out
+ * ourselves. We'd just have to undo the hardware's address
+ * calculation by subtracting (FFTID * Per Thread Scratch Space)
+ * and then add FFTID * (Larger Per Thread Scratch Space).
+ *
+ * See 3D-Media-GPGPU Engine > Media GPGPU Pipeline >
+ * Thread Group Tracking > Local Memory/Scratch Space.
+ */
+ assert(prog_data->total_scratch < 2 * 1024 * 1024);
}
}