[Mesa-dev] [PATCH] anv: don't crash when creating a huge image

Samuel Iglesias Gonsálvez siglesias at igalia.com
Wed Nov 8 09:34:51 UTC 2017


The HW has some limits but, according to the spec, we can create
the image as it has not yet any memory backing it. When we allocate
that memory, then we fail following what Vulkan spec, "10.2. Device
Memory" says when talking about vkAllocateMemory():

"Some platforms may have a limit on the maximum size of a single
 allocation. For example, certain systems may fail to create
 allocations with a size greater than or equal to 4GB. Such a limit is
 implementation-dependent, and if such a failure occurs then the error
 VK_ERROR_OUT_OF_DEVICE_MEMORY must be returned."

Fixes the crashes on BDW for the following tests:

dEQP-VK.pipeline.render_to_image.core.2d_array.huge.*
dEQP-VK.pipeline.render_to_image.core.cube_array.huge.*

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
---

Jason, I was tempted to move this piece of code to anv_AllocateMemory()
but then I found the kernel relocation limitation of 32-bit... Is that
limitation still applicable? Or was it from the BDW age and we forgot
to update that limitation for gen9+?

Sam 

 src/intel/isl/isl.c | 22 ----------------------
 1 file changed, 22 deletions(-)

diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
index 59f512fc050..aaadcbaf991 100644
--- a/src/intel/isl/isl.c
+++ b/src/intel/isl/isl.c
@@ -1472,28 +1472,6 @@ isl_surf_init_s(const struct isl_device *dev,
       base_alignment = MAX(info->min_alignment, tile_size);
    }
 
-   if (ISL_DEV_GEN(dev) < 9) {
-      /* From the Broadwell PRM Vol 5, Surface Layout:
-       *
-       *    "In addition to restrictions on maximum height, width, and depth,
-       *     surfaces are also restricted to a maximum size in bytes. This
-       *     maximum is 2 GB for all products and all surface types."
-       *
-       * This comment is applicable to all Pre-gen9 platforms.
-       */
-      if (size > (uint64_t) 1 << 31)
-         return false;
-   } else {
-      /* From the Skylake PRM Vol 5, Maximum Surface Size in Bytes:
-       *    "In addition to restrictions on maximum height, width, and depth,
-       *     surfaces are also restricted to a maximum size of 2^38 bytes.
-       *     All pixels within the surface must be contained within 2^38 bytes
-       *     of the base address."
-       */
-      if (size > (uint64_t) 1 << 38)
-         return false;
-   }
-
    *surf = (struct isl_surf) {
       .dim = info->dim,
       .dim_layout = dim_layout,
-- 
2.13.6



More information about the mesa-dev mailing list