<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Nov 8, 2017 at 1:34 AM, Samuel Iglesias Gonsálvez <span dir="ltr"><<a href="mailto:siglesias@igalia.com" target="_blank">siglesias@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The HW has some limits but, according to the spec, we can create<br>
the image as it has not yet any memory backing it. When we allocate<br>
that memory, then we fail following what Vulkan spec, "10.2. Device<br>
Memory" says when talking about vkAllocateMemory():<br>
<br>
"Some platforms may have a limit on the maximum size of a single<br>
 allocation. For example, certain systems may fail to create<br>
 allocations with a size greater than or equal to 4GB. Such a limit is<br>
 implementation-dependent, and if such a failure occurs then the error<br>
 VK_ERROR_OUT_OF_DEVICE_MEMORY must be returned."<br>
<br>
Fixes the crashes on BDW for the following tests:<br>
<br>
dEQP-VK.pipeline.render_to_<wbr>image.core.2d_array.huge.*<br>
dEQP-VK.pipeline.render_to_<wbr>image.core.cube_array.huge.*<br>
<br>
Signed-off-by: Samuel Iglesias Gonsálvez <<a href="mailto:siglesias@igalia.com">siglesias@igalia.com</a>><br>
---<br>
<br>
Jason, I was tempted to move this piece of code to anv_AllocateMemory()<br>
but then I found the kernel relocation limitation of 32-bit... Is that<br>
limitation still applicable? Or was it from the BDW age and we forgot<br>
to update that limitation for gen9+?<br></blockquote><div><br></div><div>We're still using relocations on all hardware so it applies to everything today.  One of my 2018 projects is to fix that and get rid of relocations on gen8+.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Sam<br>
<br>
 src/intel/isl/isl.c | 22 ----------------------<br>
 1 file changed, 22 deletions(-)<br>
<br>
diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c<br>
index 59f512fc050..aaadcbaf991 100644<br>
--- a/src/intel/isl/isl.c<br>
+++ b/src/intel/isl/isl.c<br>
@@ -1472,28 +1472,6 @@ isl_surf_init_s(const struct isl_device *dev,<br>
       base_alignment = MAX(info->min_alignment, tile_size);<br>
    }<br>
<br>
-   if (ISL_DEV_GEN(dev) < 9) {<br>
-      /* From the Broadwell PRM Vol 5, Surface Layout:<br>
-       *<br>
-       *    "In addition to restrictions on maximum height, width, and depth,<br>
-       *     surfaces are also restricted to a maximum size in bytes. This<br>
-       *     maximum is 2 GB for all products and all surface types."<br>
-       *<br>
-       * This comment is applicable to all Pre-gen9 platforms.<br>
-       */<br>
-      if (size > (uint64_t) 1 << 31)<br>
-         return false;<br>
-   } else {<br>
-      /* From the Skylake PRM Vol 5, Maximum Surface Size in Bytes:<br>
-       *    "In addition to restrictions on maximum height, width, and depth,<br>
-       *     surfaces are also restricted to a maximum size of 2^38 bytes.<br>
-       *     All pixels within the surface must be contained within 2^38 bytes<br>
-       *     of the base address."<br>
-       */<br>
-      if (size > (uint64_t) 1 << 38)<br>
-         return false;<br>
-   }<br></blockquote><div><br></div><div>I'm not sure how I feel about removing this from ISL.  There are really two limitations going on here.  One is a limitation imposed by relocations, and the other is some sort of fundamental hardware surface size limitation.  Most likely, the surface size limitation has to do with how many bits they use for image address computations in the hardware.  Most likely, on gen8, they do all of the internal calculations in 32 bits and only convert to 48 at the end when they need to add it to Surface Base Address.</div><div><br></div><div>If my understanding is correct then we will still have this limitation on gen8 even after we get rid of relocations and remove the BO size limitation.  I see a couple of options, neither of which I like very much:</div><div><br></div><div> 1) Take something like this patch and then keep the BO size limitation on BDW to 2GiB when we get rid of relocations even though it's artificial.</div><div> 2) "Gracefully" handle isl_surf_init failure by doing a debug_log and succeeding but setting the image size (that will be returned by vkGetImageMemoryRequirements) to UINT64_MAX so that the client won't ever be able to find memory for it.</div><div><br></div><div>My feeling is that 1) above is probably the better of the two as 2) seems to be a twisting of the spec.  That said, I would like to keep the restriction in ISL somehow and we need to make sure it still gets applied in GL.<br></div></div><br></div></div>