aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
diff options
context:
space:
mode:
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 7b971839a0a..427657c8771 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