isl/state: Add assertions for buffer surface restrictions
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 10 Jun 2016 01:48:07 +0000 (18:48 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 22 Jun 2016 19:26:43 +0000 (12:26 -0700)
Acked-by: Chad Versace <chad.versace@intel.com>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
src/intel/isl/isl_surface_state.c

index 15b2fa9..ca50612 100644 (file)
@@ -435,6 +435,17 @@ isl_genX(buffer_fill_state_s)(void *state,
 {
    uint32_t num_elements = info->size / info->stride;
 
+   if (GEN_GEN >= 7) {
+      if (info->format == ISL_FORMAT_RAW) {
+         assert(num_elements <= (1ull << 31));
+         assert((num_elements & 3) == 0);
+      } else {
+         assert(num_elements <= (1ull << 27));
+      }
+   } else {
+      assert(num_elements <= (1ull << 27));
+   }
+
    struct GENX(RENDER_SURFACE_STATE) surface_state = {
       .SurfaceType = SURFTYPE_BUFFER,
       .SurfaceArray = false,