From 7a9c37eb7bf46853901a0fbd5701db19dc2b7fcd Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 25 May 2017 16:59:12 -0700 Subject: [PATCH] i965/blorp: Take an explicit fast clear op in resolve_color Reviewed-by: Topi Pohjolainen Reviewed-by: Chad Versace --- src/mesa/drivers/dri/i965/brw_blorp.c | 15 ++------------- src/mesa/drivers/dri/i965/brw_blorp.h | 3 ++- src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 15 ++++++++++++++- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c index d9592c571f6..67b9fde3026 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp.c +++ b/src/mesa/drivers/dri/i965/brw_blorp.c @@ -924,7 +924,8 @@ brw_blorp_clear_color(struct brw_context *brw, struct gl_framebuffer *fb, void brw_blorp_resolve_color(struct brw_context *brw, struct intel_mipmap_tree *mt, - unsigned level, unsigned layer) + unsigned level, unsigned layer, + enum blorp_fast_clear_op resolve_op) { DBG("%s to mt %p level %u layer %u\n", __FUNCTION__, mt, level, layer); @@ -938,18 +939,6 @@ brw_blorp_resolve_color(struct brw_context *brw, struct intel_mipmap_tree *mt, &level, layer, 1 /* num_layers */, isl_tmp); - enum blorp_fast_clear_op resolve_op; - if (brw->gen >= 9) { - if (surf.aux_usage == ISL_AUX_USAGE_CCS_E) - resolve_op = BLORP_FAST_CLEAR_OP_RESOLVE_FULL; - else - resolve_op = BLORP_FAST_CLEAR_OP_RESOLVE_PARTIAL; - } else { - assert(surf.aux_usage == ISL_AUX_USAGE_CCS_D); - /* Broadwell and earlier do not have a partial resolve */ - resolve_op = BLORP_FAST_CLEAR_OP_RESOLVE_FULL; - } - /* Ivybrigde PRM Vol 2, Part 1, "11.7 MCS Buffer for Render Target(s)": * * "Any transition from any value in {Clear, Render, Resolve} to a diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h b/src/mesa/drivers/dri/i965/brw_blorp.h index 91a2d41279f..0de352edefb 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp.h +++ b/src/mesa/drivers/dri/i965/brw_blorp.h @@ -66,7 +66,8 @@ brw_blorp_clear_color(struct brw_context *brw, struct gl_framebuffer *fb, void brw_blorp_resolve_color(struct brw_context *brw, struct intel_mipmap_tree *mt, - unsigned level, unsigned layer); + unsigned level, unsigned layer, + enum blorp_fast_clear_op resolve_op); void intel_hiz_exec(struct brw_context *brw, struct intel_mipmap_tree *mt, diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c index 2532cbd0342..42df708b316 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c @@ -2174,6 +2174,19 @@ intel_miptree_resolve_color(struct brw_context *brw, if (!intel_miptree_needs_color_resolve(brw, mt, flags)) return false; + enum blorp_fast_clear_op resolve_op; + if (brw->gen >= 9) { + if (intel_miptree_is_lossless_compressed(brw, mt)) { + resolve_op = BLORP_FAST_CLEAR_OP_RESOLVE_FULL; + } else { + resolve_op = BLORP_FAST_CLEAR_OP_RESOLVE_PARTIAL; + } + } else { + /* Broadwell and earlier do not have a partial resolve */ + assert(!intel_miptree_is_lossless_compressed(brw, mt)); + resolve_op = BLORP_FAST_CLEAR_OP_RESOLVE_FULL; + } + bool resolved = false; foreach_list_typed_safe(struct intel_resolve_map, map, link, &mt->color_resolve_map) { @@ -2190,7 +2203,7 @@ intel_miptree_resolve_color(struct brw_context *brw, assert(map->fast_clear_state != INTEL_FAST_CLEAR_STATE_RESOLVED); - brw_blorp_resolve_color(brw, mt, map->level, map->layer); + brw_blorp_resolve_color(brw, mt, map->level, map->layer, resolve_op); intel_resolve_map_remove(map); resolved = true; } -- 2.30.2