[Mesa-dev] [PATCH 02/12] i965/rbc: Set aux surface unconditionally for sampling engine
Topi Pohjolainen
topi.pohjolainen at gmail.com
Wed Aug 31 16:05:06 UTC 2016
Once mcs buffer gets allocated without delay for lossless
compression (same as we do for msaa), one gets regression in:
GL45-CTS.texture_barrier_ARB.same-texel-rw
Setting the auxiliary surface for both sampling engine and data
port seems to fix this. I haven't found any hardware documentation
backing this though.
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 46 ++++++++++++++++++++++--
1 file changed, 43 insertions(+), 3 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 bfd973b..5cd27ef 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -72,6 +72,48 @@ static const struct surface_state_info surface_state_infos[] = {
[9] = {16, 64, 8, 10, SKL_MOCS_WB, SKL_MOCS_PTE},
};
+static bool
+brw_needs_aux_surface(const struct brw_context *brw,
+ const struct intel_mipmap_tree *mt,
+ const struct isl_view *view)
+{
+ if (!mt->mcs_mt)
+ return false;
+
+ if (view->usage & ISL_SURF_USAGE_RENDER_TARGET_BIT)
+ return true;
+
+ const bool is_lossless_compressed =
+ intel_miptree_is_lossless_compressed(brw, mt);
+ const bool view_format_lossless_compressed =
+ isl_format_supports_lossless_compression(brw->intelScreen->devinfo,
+ view->format);
+
+ /* If the underlying surface is compressed but it is sampled using a
+ * format that the sampling engine doesn't support as compressed, there
+ * is no alternative but to treat the surface as non-compressed.
+ */
+ if (is_lossless_compressed && !view_format_lossless_compressed) {
+ /* Logic elsewhere needs to take care to resolve the color buffer prior
+ * to sampling it as non-compressed.
+ */
+ assert(mt->fast_clear_state == INTEL_FAST_CLEAR_STATE_RESOLVED);
+ return false;
+ }
+
+ /* In practise it looks that setting the same lossless compressed surface
+ * to be sampled without auxiliary surface and to be written with auxiliary
+ * surface confuses the hardware.
+ * Currently there is no direct way of knowing if render pass will use the
+ * sane surface as render target and therefore simply use the auxiliary
+ * surface unconditionally here.
+ */
+ if (is_lossless_compressed)
+ return true;
+
+ return mt->fast_clear_state != INTEL_FAST_CLEAR_STATE_RESOLVED;
+}
+
static void
brw_emit_surface_state(struct brw_context *brw,
struct intel_mipmap_tree *mt,
@@ -135,9 +177,7 @@ brw_emit_surface_state(struct brw_context *brw,
struct isl_surf *aux_surf = NULL, aux_surf_s;
uint64_t aux_offset = 0;
enum isl_aux_usage aux_usage = ISL_AUX_USAGE_NONE;
- if (mt->mcs_mt &&
- ((view.usage & ISL_SURF_USAGE_RENDER_TARGET_BIT) ||
- mt->fast_clear_state != INTEL_FAST_CLEAR_STATE_RESOLVED)) {
+ if (brw_needs_aux_surface(brw, mt, &view)) {
intel_miptree_get_aux_isl_surf(brw, mt, &aux_surf_s, &aux_usage);
aux_surf = &aux_surf_s;
assert(mt->mcs_mt->offset == 0);
--
2.5.5
More information about the mesa-dev
mailing list