Skip to content
Snippets Groups Projects
Commit d4192521 authored by Topi Pohjolainen's avatar Topi Pohjolainen Committed by Emil Velikov
Browse files

i965/blorp: Use 8k chunk size for urb allocation


Previously, we hardcoded "VS URB Starting Address" to 2 (in 8kB chunks),
which meant VS URB data would start at an offset of 16kB.

However, on Haswell GT3 and Gen8+, we allocate the first 32kB for the
push constant region.  This means that the PS push constant and VS URB
data regions overlap, which can lead to corruption.

v2 (Ken): Better description of the change, and do not change vs_size
          from 2 to 1.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: default avatarTopi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Kenneth Graunke's avatarKenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit ede09e67)
parent 7e3d4d79
No related branches found
Tags mesa-18.0.0-rc3
No related merge requests found
...@@ -47,8 +47,17 @@ ...@@ -47,8 +47,17 @@
static void static void
gen7_blorp_emit_urb_config(struct brw_context *brw) gen7_blorp_emit_urb_config(struct brw_context *brw)
{ {
/* URB allocations must be done in 8k chunks. */
const unsigned chunk_size_bytes = 8192;
const unsigned urb_size = const unsigned urb_size =
(brw->gen >= 8 || (brw->is_haswell && brw->gt == 3)) ? 32 : 16; (brw->gen >= 8 || (brw->is_haswell && brw->gt == 3)) ? 32 : 16;
const unsigned push_constant_bytes = 1024 * urb_size;
const unsigned push_constant_chunks =
push_constant_bytes / chunk_size_bytes;
const unsigned vs_size = 2;
const unsigned vs_start = push_constant_chunks;
const unsigned vs_chunks =
DIV_ROUND_UP(brw->urb.min_vs_entries * vs_size * 64, chunk_size_bytes);
gen7_emit_push_constant_state(brw, gen7_emit_push_constant_state(brw,
urb_size / 2 /* vs_size */, urb_size / 2 /* vs_size */,
...@@ -59,17 +68,17 @@ gen7_blorp_emit_urb_config(struct brw_context *brw) ...@@ -59,17 +68,17 @@ gen7_blorp_emit_urb_config(struct brw_context *brw)
gen7_emit_urb_state(brw, gen7_emit_urb_state(brw,
brw->urb.min_vs_entries /* num_vs_entries */, brw->urb.min_vs_entries /* num_vs_entries */,
2 /* vs_size */, vs_size,
2 /* vs_start */, vs_start,
0 /* num_hs_entries */, 0 /* num_hs_entries */,
1 /* hs_size */, 1 /* hs_size */,
2 /* hs_start */, vs_start + vs_chunks /* hs_start */,
0 /* num_ds_entries */, 0 /* num_ds_entries */,
1 /* ds_size */, 1 /* ds_size */,
2 /* ds_start */, vs_start + vs_chunks /* ds_start */,
0 /* num_gs_entries */, 0 /* num_gs_entries */,
1 /* gs_size */, 1 /* gs_size */,
2 /* gs_start */); vs_start + vs_chunks /* gs_start */);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment