[Mesa-dev] [PATCH 23/31] i965/blorp: Add a fast_clear_op enum

Jason Ekstrand jason at jlekstrand.net
Fri Aug 19 16:56:00 UTC 2016


---
 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 c786ae0..ada17ad 100644
--- a/src/mesa/drivers/dri/i965/blorp.c
+++ b/src/mesa/drivers/dri/i965/blorp.c
@@ -143,7 +143,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 ac33300..2c34b63 100644
--- a/src/mesa/drivers/dri/i965/blorp_clear.c
+++ b/src/mesa/drivers/dri/i965/blorp_clear.c
@@ -101,7 +101,7 @@ blorp_fast_clear(struct blorp_context *blorp, void *batch,
    params.y1 = y1;
 
    memset(&params.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(blorp->isl_dev, surf->aux_surf,
                            &params.x0, &params.y0, &params.x1, &params.y1);
@@ -175,10 +175,15 @@ brw_blorp_ccs_resolve(struct blorp_context *blorp, void *batch,
                             &params.x0, &params.y0,
                             &params.x1, &params.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 (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 fd89232..b823c77 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 f7fbf04..fe6711f 100644
--- a/src/mesa/drivers/dri/i965/genX_blorp_exec.h
+++ b/src/mesa/drivers/dri/i965/genX_blorp_exec.h
@@ -495,21 +495,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");
       }
    }
 
@@ -593,12 +597,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.5.0.400.gff86faf



More information about the mesa-dev mailing list