[Mesa-dev] [PATCH v2 01/13] intel/blorp: Assert levels and layers are in range

Nanley Chery nanleychery at gmail.com
Thu Jun 22 00:15:10 UTC 2017


v2 (Jason Ekstrand):
- Update commit title
- Check aux level and layer as well

Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com> (v1)
---
 src/intel/blorp/blorp.c       | 7 +++++++
 src/intel/blorp/blorp_clear.c | 4 ----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/intel/blorp/blorp.c b/src/intel/blorp/blorp.c
index 9c88658e8a..7e30e20a59 100644
--- a/src/intel/blorp/blorp.c
+++ b/src/intel/blorp/blorp.c
@@ -66,6 +66,8 @@ 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);
+
    info->enabled = true;
 
    if (format == ISL_FORMAT_UNSUPPORTED)
@@ -90,6 +92,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;
@@ -106,6 +111,8 @@ brw_blorp_surface_info_init(struct blorp_context *blorp,
    info->view.array_len = MAX2(info->surf.logical_level0_px.depth,
                                info->surf.logical_level0_px.array_len);
 
+   assert(layer < info->view.array_len);
+
    if (!is_render_target &&
        (info->surf.dim == ISL_SURF_DIM_3D ||
         info->surf.msaa_layout == ISL_MSAA_LAYOUT_ARRAY)) {
diff --git a/src/intel/blorp/blorp_clear.c b/src/intel/blorp/blorp_clear.c
index efacadfebe..369e18726f 100644
--- a/src/intel/blorp/blorp_clear.c
+++ b/src/intel/blorp/blorp_clear.c
@@ -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);
 
-- 
2.13.1



More information about the mesa-dev mailing list