summaryrefslogtreecommitdiffstats
path: root/src/intel
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-04-22 15:51:01 -0700
committerEmil Velikov <[email protected]>2017-04-30 09:46:30 +0100
commit791f0fb429d13ed0bbcdf36c3317e23120113af5 (patch)
tree652c9c11ad4fba4ae774e215eed3cea42b3aa79e /src/intel
parentf1fe2b30b117590c621fb8d90c93a9357676fd9b (diff)
anv: Don't place scratch buffers above the 32-bit boundary
This fixes rendering corruptions in DOOM. Hopefully, it will also make Jenkins a bit more stable as we've been seeing some random failures and GPU hangs ever since turning on 48bit. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100620 Fixes: 651ec926fc1 "anv: Add support for 48-bit addresses" Tested-by: Grazvydas Ignotas <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Cc: "17.1" <[email protected]> (cherry picked from commit c43b4bc85eddba8bc31665cfee5928bed8343516)
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/vulkan/anv_allocator.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index 784191ed97a..5f5577f2781 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -993,6 +993,25 @@ anv_scratch_pool_alloc(struct anv_device *device, struct anv_scratch_pool *pool,
anv_bo_init_new(&bo->bo, device, size);
+ /* Even though the Scratch base pointers in 3DSTATE_*S are 64 bits, they
+ * are still relative to the general state base address. When we emit
+ * STATE_BASE_ADDRESS, we set general state base address to 0 and the size
+ * to the maximum (1 page under 4GB). This allows us to just place the
+ * scratch buffers anywhere we wish in the bottom 32 bits of address space
+ * and just set the scratch base pointer in 3DSTATE_*S using a relocation.
+ * However, in order to do so, we need to ensure that the kernel does not
+ * place the scratch BO above the 32-bit boundary.
+ *
+ * NOTE: Technically, it can't go "anywhere" because the top page is off
+ * limits. However, when EXEC_OBJECT_SUPPORTS_48B_ADDRESS is set, the
+ * kernel allocates space using
+ *
+ * end = min_t(u64, end, (1ULL << 32) - I915_GTT_PAGE_SIZE);
+ *
+ * so nothing will ever touch the top page.
+ */
+ bo->bo.flags &= ~EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
+
/* Set the exists last because it may be read by other threads */
__sync_synchronize();
bo->exists = true;