intel/blorp: Assert levels and layers are in range
authorNanley Chery <nanley.g.chery@intel.com>
Thu, 11 May 2017 17:58:18 +0000 (10:58 -0700)
committerNanley Chery <nanley.g.chery@intel.com>
Mon, 26 Jun 2017 18:09:12 +0000 (11:09 -0700)
v2 (Jason Ekstrand):
- Update commit title.
- Check aux level and layer as well.
v3 (Jason Ekstrand):
- Move the non-aux layer check.

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> (v1)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/blorp/blorp.c
src/intel/blorp/blorp_clear.c

index 9c88658e8ac0dd846beb90db30ba2bca564fc775..a426a030d29169a2b0a2e54fc756bf0a69426a05 100644 (file)
@@ -66,6 +66,10 @@ brw_blorp_surface_info_init(struct blorp_context *blorp,
                             unsigned int level, unsigned int layer,
                             enum isl_format format, bool is_render_target)
 {
+   assert(level < surf->surf->levels);
+   assert(layer < MAX2(surf->surf->logical_level0_px.depth >> level,
+                       surf->surf->logical_level0_px.array_len));
+
    info->enabled = true;
 
    if (format == ISL_FORMAT_UNSUPPORTED)
@@ -90,6 +94,9 @@ brw_blorp_surface_info_init(struct blorp_context *blorp,
    if (info->aux_usage != ISL_AUX_USAGE_NONE) {
       info->aux_surf = *surf->aux_surf;
       info->aux_addr = surf->aux_addr;
+      assert(level < info->aux_surf.levels);
+      assert(layer < MAX2(info->aux_surf.logical_level0_px.depth >> level,
+                          info->aux_surf.logical_level0_px.array_len));
    }
 
    info->clear_color = surf->clear_color;
index efacadfebe45d1af664f32e12b8c288d7794cc0b..369e18726f2aeea2c9ab7682ac99a815ba0adc67 100644 (file)
@@ -707,10 +707,6 @@ blorp_ccs_resolve(struct blorp_batch *batch,
    struct blorp_params params;
    blorp_params_init(&params);
 
-   /* Layered and mipmapped fast clear is only available from Gen8 onwards. */
-   assert(ISL_DEV_GEN(batch->blorp->isl_dev) >= 8 ||
-          (level == 0 && layer == 0));
-
    brw_blorp_surface_info_init(batch->blorp, &params.dst, surf,
                                level, layer, format, true);