[Mesa-dev] [PATCH v2 05/35] i965/blorp: Create the isl_surf up-front

Jason Ekstrand jason at jlekstrand.net
Tue Jul 26 22:01:56 UTC 2016


Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/mesa/drivers/dri/i965/brw_blorp.c | 25 ++++++++++++++-----------
 src/mesa/drivers/dri/i965/brw_blorp.h |  5 +++++
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c
index e0d9526..5889e95 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.c
+++ b/src/mesa/drivers/dri/i965/brw_blorp.c
@@ -51,6 +51,16 @@ brw_blorp_surface_info_init(struct brw_context *brw,
    intel_miptree_check_level_layer(mt, level, layer);
 
    info->mt = mt;
+
+   intel_miptree_get_isl_surf(brw, mt, &info->surf);
+
+   if (mt->mcs_mt) {
+      intel_miptree_get_aux_isl_surf(brw, mt, &info->aux_surf,
+                                     &info->aux_usage);
+   } else {
+      info->aux_usage = ISL_AUX_USAGE_NONE;
+   }
+
    info->level = level;
    info->layer = layer;
    info->width = minify(mt->physical_width0, level - mt->first_level);
@@ -273,8 +283,7 @@ brw_blorp_emit_surface_state(struct brw_context *brw,
 {
    const struct surface_state_info ss_info = surface_state_infos[brw->gen];
 
-   struct isl_surf surf;
-   intel_miptree_get_isl_surf(brw, surface->mt, &surf);
+   struct isl_surf surf = surface->surf;
 
    /* Stomp surface dimensions and tiling (if needed) with info from blorp */
    surf.dim = ISL_SURF_DIM_2D;
@@ -315,16 +324,10 @@ brw_blorp_emit_surface_state(struct brw_context *brw,
 
    union isl_color_value clear_color = { .u32 = { 0, 0, 0, 0 } };
 
-   struct isl_surf *aux_surf = NULL, aux_surf_s;
+   const struct isl_surf *aux_surf = NULL;
    uint64_t aux_offset = 0;
-   enum isl_aux_usage aux_usage = ISL_AUX_USAGE_NONE;
    if (surface->mt->mcs_mt) {
-      /* We should probably to similar stomping to above but most of the aux
-       * surf gets ignored when we fill out the surface state anyway so
-       * there's no point.
-       */
-      intel_miptree_get_aux_isl_surf(brw, surface->mt, &aux_surf_s, &aux_usage);
-      aux_surf = &aux_surf_s;
+      aux_surf = &surface->aux_surf;
       assert(surface->mt->mcs_mt->offset == 0);
       aux_offset = surface->mt->mcs_mt->bo->offset64;
 
@@ -362,7 +365,7 @@ brw_blorp_emit_surface_state(struct brw_context *brw,
 
    isl_surf_fill_state(&brw->isl_dev, dw, .surf = &surf, .view = &view,
                        .address = surface->mt->bo->offset64 + offset,
-                       .aux_surf = aux_surf, .aux_usage = aux_usage,
+                       .aux_surf = aux_surf, .aux_usage = surface->aux_usage,
                        .aux_address = aux_offset,
                        .mocs = mocs, .clear_color = clear_color,
                        .x_offset_sa = tile_x, .y_offset_sa = tile_y);
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h b/src/mesa/drivers/dri/i965/brw_blorp.h
index beef90e..e23f48b 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.h
+++ b/src/mesa/drivers/dri/i965/brw_blorp.h
@@ -71,6 +71,11 @@ struct brw_blorp_surface_info
 {
    struct intel_mipmap_tree *mt;
 
+   struct isl_surf surf;
+
+   struct isl_surf aux_surf;
+   enum isl_aux_usage aux_usage;
+
    /**
     * The miplevel to use.
     */
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list