i965/blorp: Add a fast_clear_op enum
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 19 Aug 2016 09:23:04 +0000 (02:23 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 29 Aug 2016 19:17:34 +0000 (12:17 -0700)
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/mesa/drivers/dri/i965/blorp.c
src/mesa/drivers/dri/i965/blorp_clear.c
src/mesa/drivers/dri/i965/blorp_priv.h
src/mesa/drivers/dri/i965/genX_blorp_exec.h

index deba011ac558d71bf53fa5968aa7c53945abb63b..20477dd086b190afd96829f29752e8db8294284b 100644 (file)
@@ -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;
 }
index 0741bca3337d498518bf550b025d75bc58c7fca8..d145cce666d3f739b0d9228bf0dd4a9e56ad4fa9 100644 (file)
@@ -109,7 +109,7 @@ blorp_fast_clear(struct blorp_batch *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(batch->blorp->isl_dev, surf->aux_surf,
                            &params.x0, &params.y0, &params.x1, &params.y1);
@@ -184,10 +184,15 @@ brw_blorp_ccs_resolve(struct blorp_batch *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 (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
index 1f10f49c52abb71e500093f70225ecc112b43351..36ff637a79f0ea801b0389a0d9d01c269580092a 100644 (file)
@@ -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;
index 21f6c23f91699d36a29c3da3d0f310ddfa814afe..7ef6a1dd0aca3f2d77fa66a6b8b4b577edfafa4c 100644 (file)
@@ -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");
       }
    }