<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 31, 2016 at 8:29 PM, Nanley Chery <span dir="ltr"><<a href="mailto:nanleychery@gmail.com" target="_blank">nanleychery@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Jason Ekstrand <<a href="mailto:jason.ekstrand@intel.com">jason.ekstrand@intel.com</a>><br>
<br>
Nanley Chery (amend):<br>
- Change memset value from 0xff to 0 (a defined value for HiZ).<br>
<br>
Signed-off-by: Nanley Chery <<a href="mailto:nanley.g.chery@intel.com">nanley.g.chery@intel.com</a>><br>
---<br>
src/intel/vulkan/anv_image.c | 18 +++++++++++++++++-<br>
1 file changed, 17 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c<br>
index 5112c5d..9fbebd0 100644<br>
--- a/src/intel/vulkan/anv_image.c<br>
+++ b/src/intel/vulkan/anv_image.c<br>
@@ -311,11 +311,12 @@ anv_DestroyImage(VkDevice _device, VkImage _image,<br>
}<br>
<br>
VkResult anv_BindImageMemory(<br>
- VkDevice device,<br>
+ VkDevice _device,<br>
VkImage _image,<br>
VkDeviceMemory _memory,<br>
VkDeviceSize memoryOffset)<br>
{<br>
+ ANV_FROM_HANDLE(anv_device, device, _device);<br>
ANV_FROM_HANDLE(anv_device_<wbr>memory, mem, _memory);<br>
ANV_FROM_HANDLE(anv_image, image, _image);<br>
<br>
@@ -327,6 +328,21 @@ VkResult anv_BindImageMemory(<br>
image->offset = 0;<br>
}<br>
<br>
+ if (anv_image_has_hiz(image)) {<br>
+ /* HiZ surfaces need to have their memory cleared to 0 before they<br>
+ * can be used. If we let it have garbage data, it can cause GPU<br>
+ * hangs on some hardware.<br>
+ */<br>
+ void *map = anv_gem_mmap(device, image->bo->gem_handle,<br>
+ image->offset + image->hiz_surface.offset,<br>
+ image->hiz_surface.isl.size,<br>
+ device->info.has_llc ? 0 : I915_MMAP_WC);<br></blockquote><div><br></div><div>We should assert that offset and size are both divisible by 4096. Otherwise, the kernel will return a NULL map and we'll segfault. It should always be true because the surface is tiled, but we should assert none the less.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
+ memset(map, 0, image->hiz_surface.isl.size);<br>
+<br>
+ anv_gem_munmap(map, image->hiz_surface.isl.size);<br>
+ }<br>
+<br>
return VK_SUCCESS;<br>
}<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
2.9.3<br>
<br>
</font></span></blockquote></div><br></div></div>