From db95a8108f68dfeae10db4f56f721838fd57b36f Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 19 Aug 2016 02:23:04 -0700 Subject: [PATCH] i965/blorp: Add a fast_clear_op enum Signed-off-by: Jason Ekstrand Reviewed-by: Topi Pohjolainen --- src/mesa/drivers/dri/i965/blorp.c | 1 - src/mesa/drivers/dri/i965/blorp_clear.c | 15 ++++++++++----- src/mesa/drivers/dri/i965/blorp_priv.h | 12 ++++++++---- src/mesa/drivers/dri/i965/genX_blorp_exec.h | 20 ++++++++++++++------ 4 files changed, 32 insertions(+), 16 deletions(-) diff --git a/src/mesa/drivers/dri/i965/blorp.c b/src/mesa/drivers/dri/i965/blorp.c index deba011ac55..20477dd086b 100644 --- a/src/mesa/drivers/dri/i965/blorp.c +++ b/src/mesa/drivers/dri/i965/blorp.c @@ -145,7 +145,6 @@ brw_blorp_params_init(struct brw_blorp_params *params) { memset(params, 0, sizeof(*params)); params->hiz_op = GEN6_HIZ_OP_NONE; - params->fast_clear_op = 0; params->num_draw_buffers = 1; params->num_layers = 1; } diff --git a/src/mesa/drivers/dri/i965/blorp_clear.c b/src/mesa/drivers/dri/i965/blorp_clear.c index 0741bca3337..d145cce666d 100644 --- a/src/mesa/drivers/dri/i965/blorp_clear.c +++ b/src/mesa/drivers/dri/i965/blorp_clear.c @@ -109,7 +109,7 @@ blorp_fast_clear(struct blorp_batch *batch, params.y1 = y1; memset(¶ms.wm_inputs, 0xff, 4*sizeof(float)); - params.fast_clear_op = GEN7_PS_RENDER_TARGET_FAST_CLEAR_ENABLE; + params.fast_clear_op = BLORP_FAST_CLEAR_OP_CLEAR; brw_get_fast_clear_rect(batch->blorp->isl_dev, surf->aux_surf, ¶ms.x0, ¶ms.y0, ¶ms.x1, ¶ms.y1); @@ -184,10 +184,15 @@ brw_blorp_ccs_resolve(struct blorp_batch *batch, ¶ms.x0, ¶ms.y0, ¶ms.x1, ¶ms.y1); - if (params.dst.aux_usage == ISL_AUX_USAGE_CCS_E) - params.resolve_type = GEN9_PS_RENDER_TARGET_RESOLVE_FULL; - else - params.resolve_type = GEN7_PS_RENDER_TARGET_RESOLVE_ENABLE; + if (batch->blorp->isl_dev->info->gen >= 9) { + if (params.dst.aux_usage == ISL_AUX_USAGE_CCS_E) + params.fast_clear_op = BLORP_FAST_CLEAR_OP_RESOLVE_FULL; + else + params.fast_clear_op = BLORP_FAST_CLEAR_OP_RESOLVE_PARTIAL; + } else { + /* Broadwell and earlier do not have a partial resolve */ + params.fast_clear_op = BLORP_FAST_CLEAR_OP_RESOLVE_FULL; + } /* Note: there is no need to initialize push constants because it doesn't * matter what data gets dispatched to the render target. However, we must diff --git a/src/mesa/drivers/dri/i965/blorp_priv.h b/src/mesa/drivers/dri/i965/blorp_priv.h index 1f10f49c52a..36ff637a79f 100644 --- a/src/mesa/drivers/dri/i965/blorp_priv.h +++ b/src/mesa/drivers/dri/i965/blorp_priv.h @@ -42,6 +42,13 @@ enum { BLORP_NUM_BT_ENTRIES }; +enum blorp_fast_clear_op { + BLORP_FAST_CLEAR_OP_NONE = 0, + BLORP_FAST_CLEAR_OP_CLEAR, + BLORP_FAST_CLEAR_OP_RESOLVE_PARTIAL, + BLORP_FAST_CLEAR_OP_RESOLVE_FULL, +}; + struct brw_blorp_surface_info { struct isl_surf surf; @@ -168,10 +175,7 @@ struct brw_blorp_params struct brw_blorp_surface_info src; struct brw_blorp_surface_info dst; enum gen6_hiz_op hiz_op; - union { - unsigned fast_clear_op; - unsigned resolve_type; - }; + enum blorp_fast_clear_op fast_clear_op; bool color_write_disable[4]; struct brw_blorp_wm_inputs wm_inputs; unsigned num_draw_buffers; diff --git a/src/mesa/drivers/dri/i965/genX_blorp_exec.h b/src/mesa/drivers/dri/i965/genX_blorp_exec.h index 21f6c23f916..7ef6a1dd0ac 100644 --- a/src/mesa/drivers/dri/i965/genX_blorp_exec.h +++ b/src/mesa/drivers/dri/i965/genX_blorp_exec.h @@ -528,21 +528,25 @@ blorp_emit_ps_config(struct blorp_batch *batch, ps.MaximumNumberofThreadsPerPSD = 64 - 2; switch (params->fast_clear_op) { + case BLORP_FAST_CLEAR_OP_NONE: + break; #if GEN_GEN >= 9 - case (1 << 6): /* GEN7_PS_RENDER_TARGET_RESOLVE_ENABLE */ + case BLORP_FAST_CLEAR_OP_RESOLVE_PARTIAL: ps.RenderTargetResolveType = RESOLVE_PARTIAL; break; - case (3 << 6): /* GEN9_PS_RENDER_TARGET_RESOLVE_FULL */ + case BLORP_FAST_CLEAR_OP_RESOLVE_FULL: ps.RenderTargetResolveType = RESOLVE_FULL; break; #else - case (1 << 6): /* GEN7_PS_RENDER_TARGET_RESOLVE_ENABLE */ + case BLORP_FAST_CLEAR_OP_RESOLVE_FULL: ps.RenderTargetResolveEnable = true; break; #endif - case (1 << 8): /* GEN7_PS_RENDER_TARGET_FAST_CLEAR_ENABLE */ + case BLORP_FAST_CLEAR_OP_CLEAR: ps.RenderTargetFastClearEnable = true; break; + default: + unreachable("Invalid fast clear op"); } } @@ -627,12 +631,16 @@ blorp_emit_ps_config(struct blorp_batch *batch, ps.SamplerCount = 1; /* Up to 4 samplers */ switch (params->fast_clear_op) { - case (1 << 6): /* GEN7_PS_RENDER_TARGET_RESOLVE_ENABLE */ + case BLORP_FAST_CLEAR_OP_NONE: + break; + case BLORP_FAST_CLEAR_OP_RESOLVE_FULL: ps.RenderTargetResolveEnable = true; break; - case (1 << 8): /* GEN7_PS_RENDER_TARGET_FAST_CLEAR_ENABLE */ + case BLORP_FAST_CLEAR_OP_CLEAR: ps.RenderTargetFastClearEnable = true; break; + default: + unreachable("Invalid fast clear op"); } } -- 2.30.2