[Mesa-dev] [PATCH 27/27] i965: Use stored hiz surface instead of creating copy
Topi Pohjolainen
topi.pohjolainen at gmail.com
Mon Jan 16 09:14:02 UTC 2017
Now the last user of intel_miptree_get_aux_isl_surf() is gone.
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 5 +-
src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 77 ------------------------
src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 6 --
3 files changed, 2 insertions(+), 86 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 160f16d..0711328 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -134,7 +134,7 @@ brw_emit_surface_state(struct brw_context *brw,
union isl_color_value clear_color = { .u32 = { 0, 0, 0, 0 } };
drm_intel_bo *aux_bo;
- struct isl_surf *aux_surf = NULL, aux_surf_s;
+ struct isl_surf *aux_surf = NULL;
uint64_t aux_offset = 0;
enum isl_aux_usage aux_usage = ISL_AUX_USAGE_NONE;
if ((mt->mcs_buf || intel_miptree_sample_with_hiz(brw, mt)) &&
@@ -148,8 +148,7 @@ brw_emit_surface_state(struct brw_context *brw,
aux_bo = mt->mcs_buf->bo;
aux_offset = mt->mcs_buf->bo->offset64 + mt->mcs_buf->offset;
} else {
- intel_miptree_get_aux_isl_surf(brw, mt, aux_usage, &aux_surf_s);
- aux_surf = &aux_surf_s;
+ aux_surf = &mt->hiz_buf->surf;
aux_bo = mt->hiz_buf->bo;
aux_offset = mt->hiz_buf->bo->offset64;
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 95a674b..4c51661 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -3210,83 +3210,6 @@ intel_miptree_get_aux_isl_usage(const struct brw_context *brw,
unreachable("Invalid MCS miptree");
}
-/* WARNING: THE SURFACE CREATED BY THIS FUNCTION IS NOT COMPLETE AND CANNOT BE
- * USED FOR ANY REAL CALCULATIONS. THE ONLY VALID USE OF SUCH A SURFACE IS TO
- * PASS IT INTO isl_surf_fill_state.
- */
-void
-intel_miptree_get_aux_isl_surf(struct brw_context *brw,
- const struct intel_mipmap_tree *mt,
- enum isl_aux_usage usage,
- struct isl_surf *surf)
-{
- uint32_t aux_pitch, aux_qpitch;
- if (mt->mcs_buf) {
- aux_pitch = mt->mcs_buf->pitch;
- aux_qpitch = mt->mcs_buf->qpitch;
- } else if (mt->hiz_buf) {
- aux_pitch = mt->hiz_buf->pitch;
- aux_qpitch = mt->hiz_buf->qpitch;
- } else {
- return;
- }
-
- /* Start with a copy of the original surface. */
- intel_miptree_get_isl_surf(brw, mt, surf);
-
- /* Figure out the format and tiling of the auxiliary surface */
- switch (usage) {
- case ISL_AUX_USAGE_NONE:
- unreachable("Invalid auxiliary usage");
-
- case ISL_AUX_USAGE_HIZ:
- isl_surf_get_hiz_surf(&brw->isl_dev, surf, surf);
- break;
-
- case ISL_AUX_USAGE_MCS:
- /*
- * From the SKL PRM:
- * "When Auxiliary Surface Mode is set to AUX_CCS_D or AUX_CCS_E,
- * HALIGN 16 must be used."
- */
- if (brw->gen >= 9)
- assert(mt->halign == 16);
-
- isl_surf_get_mcs_surf(&brw->isl_dev, surf, surf);
- break;
-
- case ISL_AUX_USAGE_CCS_D:
- case ISL_AUX_USAGE_CCS_E:
- /*
- * From the BDW PRM, Volume 2d, page 260 (RENDER_SURFACE_STATE):
- *
- * "When MCS is enabled for non-MSRT, HALIGN_16 must be used"
- *
- * From the hardware spec for GEN9:
- *
- * "When Auxiliary Surface Mode is set to AUX_CCS_D or AUX_CCS_E,
- * HALIGN 16 must be used."
- */
- assert(mt->num_samples <= 1);
- if (brw->gen >= 8)
- assert(mt->halign == 16);
-
- isl_surf_get_ccs_surf(&brw->isl_dev, surf, surf);
- break;
- }
-
- /* We want the pitch of the actual aux buffer. */
- surf->row_pitch = aux_pitch;
-
- /* Auxiliary surfaces in ISL have compressed formats and array_pitch_el_rows
- * is in elements. This doesn't match intel_mipmap_tree::qpitch which is
- * in elements of the primary color surface so we have to divide by the
- * compression block height.
- */
- surf->array_pitch_el_rows =
- aux_qpitch / isl_format_get_layout(surf->format)->bh;
-}
-
union isl_color_value
intel_miptree_get_isl_clear_color(struct brw_context *brw,
const struct intel_mipmap_tree *mt)
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
index b0fb3bb..3f82e3f 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
@@ -784,12 +784,6 @@ enum isl_aux_usage
intel_miptree_get_aux_isl_usage(const struct brw_context *brw,
const struct intel_mipmap_tree *mt);
-void
-intel_miptree_get_aux_isl_surf(struct brw_context *brw,
- const struct intel_mipmap_tree *mt,
- enum isl_aux_usage usage,
- struct isl_surf *surf);
-
union isl_color_value
intel_miptree_get_isl_clear_color(struct brw_context *brw,
const struct intel_mipmap_tree *mt);
--
2.5.5
More information about the mesa-dev
mailing list