[Mesa-dev] [v2 12/39] i965/miptree: Refactor ISL aux usage resolver
Topi Pohjolainen
topi.pohjolainen at gmail.com
Wed May 3 09:22:25 UTC 2017
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/mesa/drivers/dri/i965/brw_blorp.c | 4 +-
src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 3 +-
src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 47 +++++++++++++++---------
src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 9 ++++-
4 files changed, 41 insertions(+), 22 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c
index c72d433..3433a8e 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.c
+++ b/src/mesa/drivers/dri/i965/brw_blorp.c
@@ -171,8 +171,10 @@ blorp_surf_for_miptree(struct brw_context *brw,
*level = 0;
}
+ surf->aux_usage = intel_miptree_get_aux_isl_usage(brw, mt);
+
struct isl_surf *aux_surf = &tmp_surfs[1];
- intel_miptree_get_aux_isl_surf(brw, mt, aux_surf, &surf->aux_usage);
+ intel_miptree_get_aux_isl_surf(brw, mt, surf->aux_usage, aux_surf);
if (surf->aux_usage != ISL_AUX_USAGE_NONE) {
if (surf->aux_usage == ISL_AUX_USAGE_HIZ) {
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 6b078c0..bd64c67 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -139,7 +139,8 @@ brw_emit_surface_state(struct brw_context *brw,
enum isl_aux_usage aux_usage = ISL_AUX_USAGE_NONE;
if ((mt->mcs_buf || intel_miptree_sample_with_hiz(brw, mt)) &&
!(flags & INTEL_AUX_BUFFER_DISABLED)) {
- intel_miptree_get_aux_isl_surf(brw, mt, &aux_surf_s, &aux_usage);
+ aux_usage = intel_miptree_get_aux_isl_usage(brw, mt);
+ intel_miptree_get_aux_isl_surf(brw, mt, aux_usage, &aux_surf_s);
aux_surf = &aux_surf_s;
if (mt->mcs_buf) {
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 8a676ed..f67c2d0 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -3370,6 +3370,32 @@ intel_miptree_get_isl_surf(struct brw_context *brw,
surf->usage |= ISL_SURF_USAGE_CUBE_BIT;
}
+enum isl_aux_usage
+intel_miptree_get_aux_isl_usage(const struct brw_context *brw,
+ const struct intel_mipmap_tree *mt)
+{
+ if (mt->hiz_buf)
+ return ISL_AUX_USAGE_HIZ;
+
+ if (!mt->mcs_buf)
+ return ISL_AUX_USAGE_NONE;
+
+ if (mt->num_samples > 1) {
+ assert(mt->msaa_layout == INTEL_MSAA_LAYOUT_CMS);
+ return ISL_AUX_USAGE_MCS;
+ }
+
+ if (intel_miptree_is_lossless_compressed(brw, mt)) {
+ assert(brw->gen >= 9);
+ return ISL_AUX_USAGE_CCS_E;
+ }
+
+ if ((mt->aux_disable & INTEL_AUX_DISABLE_CCS) == 0)
+ return ISL_AUX_USAGE_CCS_D;
+
+ 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.
@@ -3377,32 +3403,17 @@ intel_miptree_get_isl_surf(struct brw_context *brw,
void
intel_miptree_get_aux_isl_surf(struct brw_context *brw,
const struct intel_mipmap_tree *mt,
- struct isl_surf *surf,
- enum isl_aux_usage *usage)
+ 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;
-
- if (mt->num_samples > 1) {
- assert(mt->msaa_layout == INTEL_MSAA_LAYOUT_CMS);
- *usage = ISL_AUX_USAGE_MCS;
- } else if (intel_miptree_is_lossless_compressed(brw, mt)) {
- assert(brw->gen >= 9);
- *usage = ISL_AUX_USAGE_CCS_E;
- } else if ((mt->aux_disable & INTEL_AUX_DISABLE_CCS) == 0) {
- *usage = ISL_AUX_USAGE_CCS_D;
- } else {
- unreachable("Invalid MCS miptree");
- }
} else if (mt->hiz_buf) {
aux_pitch = mt->hiz_buf->aux_base.pitch;
aux_qpitch = mt->hiz_buf->aux_base.qpitch;
-
- *usage = ISL_AUX_USAGE_HIZ;
} else {
- *usage = ISL_AUX_USAGE_NONE;
return;
}
@@ -3410,7 +3421,7 @@ intel_miptree_get_aux_isl_surf(struct brw_context *brw,
intel_miptree_get_isl_surf(brw, mt, surf);
/* Figure out the format and tiling of the auxiliary surface */
- switch (*usage) {
+ switch (usage) {
case ISL_AUX_USAGE_NONE:
unreachable("Invalid auxiliary usage");
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
index c951e1a..3c9c2fe 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
@@ -773,11 +773,16 @@ void
intel_miptree_get_isl_surf(struct brw_context *brw,
const struct intel_mipmap_tree *mt,
struct isl_surf *surf);
+
+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,
- struct isl_surf *surf,
- enum isl_aux_usage *usage);
+ enum isl_aux_usage usage,
+ struct isl_surf *surf);
union isl_color_value
intel_miptree_get_isl_clear_color(struct brw_context *brw,
--
2.9.3
More information about the mesa-dev
mailing list