summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
diff options
context:
space:
mode:
authorTopi Pohjolainen <topi.pohjolainen@intel.com>2016-08-26 09:26:15 +0300
committerTopi Pohjolainen <topi.pohjolainen@intel.com>2016-09-12 11:48:29 +0300
commit39712b2a14745861d06ab608ba9a56f1c006addc (patch)
treec377ef2d14eefe8ff515ade0e570a81008944f32 /src/mesa/drivers/dri/i965/intel_mipmap_tree.c
parent024a39511f95a156b7d6524fc0770d95fbbcd1d0 (diff)
downloadexternal_mesa3d-39712b2a14745861d06ab608ba9a56f1c006addc.zip
external_mesa3d-39712b2a14745861d06ab608ba9a56f1c006addc.tar.gz
external_mesa3d-39712b2a14745861d06ab608ba9a56f1c006addc.tar.bz2
i965/rbc: Allocate mcs directly
such as we do for compressed msaa. In case of non-compressed simgle sampled buffers the allocation of mcs is deferred until there is actually a clear operation that needs the mcs. In case of render buffer compression the mcs buffer always needed and there is no real reason to defer the allocation. By doing it directly allows to drop quite a bit unnecessary complexity. Patch leaves brw_predraw_set_aux_buffers() a no-op. Subsequent patches will re-use it and it seemed cleaner to leave it instead of removing and re-introducing. Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Diffstat (limited to 'src/mesa/drivers/dri/i965/intel_mipmap_tree.c')
-rw-r--r--src/mesa/drivers/dri/i965/intel_mipmap_tree.c68
1 files changed, 16 insertions, 52 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 7b97183..427657c 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -789,6 +789,20 @@ intel_miptree_create(struct brw_context *brw,
intel_miptree_supports_non_msrt_fast_clear(brw, mt)) {
mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_RESOLVED;
assert(brw->gen < 8 || mt->halign == 16 || num_samples <= 1);
+
+ /* On Gen9+ clients are not currently capable of consuming compressed
+ * single-sampled buffers. Disabling compression allows us to skip
+ * resolves.
+ */
+ const bool lossless_compression_disabled = INTEL_DEBUG & DEBUG_NO_RBC;
+ const bool is_lossless_compressed =
+ unlikely(!lossless_compression_disabled) &&
+ brw->gen >= 9 && !mt->is_scanout &&
+ intel_miptree_supports_lossless_compressed(brw, mt);
+
+ if (is_lossless_compressed) {
+ intel_miptree_alloc_non_msrt_mcs(brw, mt, is_lossless_compressed);
+ }
}
return mt;
@@ -1563,7 +1577,8 @@ intel_miptree_alloc_mcs(struct brw_context *brw,
bool
intel_miptree_alloc_non_msrt_mcs(struct brw_context *brw,
- struct intel_mipmap_tree *mt)
+ struct intel_mipmap_tree *mt,
+ bool is_lossless_compressed)
{
assert(mt->mcs_mt == NULL);
assert(!mt->disable_aux_buffers);
@@ -1605,16 +1620,6 @@ intel_miptree_alloc_non_msrt_mcs(struct brw_context *brw,
layout_flags |= MIPTREE_LAYOUT_FORCE_HALIGN16;
}
- /* On Gen9+ clients are not currently capable of consuming compressed
- * single-sampled buffers. Disabling compression allows us to skip
- * resolves.
- */
- const bool lossless_compression_disabled = INTEL_DEBUG & DEBUG_NO_RBC;
- const bool is_lossless_compressed =
- unlikely(!lossless_compression_disabled) &&
- brw->gen >= 9 && !mt->is_scanout &&
- intel_miptree_supports_lossless_compressed(brw, mt);
-
/* In case of compression mcs buffer needs to be initialised requiring the
* buffer to be immediately mapped to cpu space for writing. Therefore do
* not use the gpu access flag which can cause an unnecessary delay if the
@@ -1656,47 +1661,6 @@ intel_miptree_alloc_non_msrt_mcs(struct brw_context *brw,
return mt->mcs_mt;
}
-void
-intel_miptree_prepare_mcs(struct brw_context *brw,
- struct intel_mipmap_tree *mt)
-{
- if (mt->mcs_mt)
- return;
-
- if (brw->gen < 9)
- return;
-
- /* Single sample compression is represented re-using msaa compression
- * layout type: "Compressed Multisampled Surfaces".
- */
- if (mt->msaa_layout != INTEL_MSAA_LAYOUT_CMS || mt->num_samples > 1)
- return;
-
- /* Clients are not currently capable of consuming compressed
- * single-sampled buffers.
- */
- if (mt->is_scanout)
- return;
-
- assert(intel_tiling_supports_non_msrt_mcs(brw, mt->tiling) ||
- intel_miptree_supports_lossless_compressed(brw, mt));
-
- /* Consider if lossless compression is supported but the needed
- * auxiliary buffer doesn't exist yet.
- *
- * Failing to allocate the auxiliary buffer means running out of
- * memory. The pointer to the aux miptree is left NULL which should
- * signal non-compressed behavior.
- */
- if (!intel_miptree_alloc_non_msrt_mcs(brw, mt)) {
- _mesa_warning(NULL,
- "Failed to allocated aux buffer for lossless"
- " compressed %p %u:%u %s\n",
- mt, mt->logical_width0, mt->logical_height0,
- _mesa_get_format_name(mt->format));
- }
-}
-
/**
* Helper for intel_miptree_alloc_hiz() that sets
* \c mt->level[level].has_hiz. Return true if and only if