intel: Track stencil aux usage on Gen12+
authorSagar Ghuge <sagar.ghuge@intel.com>
Wed, 23 Oct 2019 23:24:46 +0000 (16:24 -0700)
committerSagar Ghuge <sagar.ghuge@intel.com>
Tue, 29 Oct 2019 21:46:15 +0000 (14:46 -0700)
Enable stencil compression enable and control surface enable bit if
stencil buffer lossless compression is enabled.

v2: Remove unnecessary GEN_GEN check (Nanley Chery)

v3: (Nanley Chery)
- Change commit subject tag from intel/isl to intel
- Keep assignment order correct

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
src/gallium/drivers/iris/iris_state.c
src/intel/blorp/blorp_genX_exec.h
src/intel/isl/isl.h
src/intel/isl/isl_emit_depth_stencil.c

index e55ccc08b612a123e87099f837fe3c0c75ca0c9e..a53e76c004e6ca6408e7439fee90a97fd4de3fe4 100644 (file)
@@ -2993,6 +2993,7 @@ iris_set_framebuffer_state(struct pipe_context *ctx,
 
       if (stencil_res) {
          view.usage |= ISL_SURF_USAGE_STENCIL_BIT;
+         info.stencil_aux_usage = stencil_res->aux.usage;
          info.stencil_surf = &stencil_res->surf;
          info.stencil_address = stencil_res->bo->gtt_offset + stencil_res->offset;
          if (!zres) {
index fd913315d0cf415b08c1c84544545f1c5d5d7d58..f7bdf6a2903f49a665c105dd4fef5d6c69f31f52 100644 (file)
@@ -1600,6 +1600,7 @@ blorp_emit_depth_stencil_config(struct blorp_batch *batch,
    if (params->stencil.enabled) {
       info.stencil_surf = &params->stencil.surf;
 
+      info.stencil_aux_usage = params->stencil.aux_usage;
       struct blorp_address stencil_address = params->stencil.addr;
 #if GEN_GEN == 6
       /* Sandy bridge hardware does not technically support mipmapped stencil.
index bcb46b12266894c76ee11f3904f020a50d5a25a4..017052d79bee11fe95027fcdfe738ef527e5d3a0 100644 (file)
@@ -1445,6 +1445,11 @@ struct isl_depth_stencil_hiz_emit_info {
     * The depth clear value
     */
    float depth_clear_value;
+
+   /**
+    * Track stencil aux usage for Gen >= 12
+    */
+   enum isl_aux_usage stencil_aux_usage;
 };
 
 extern const struct isl_format_layout isl_format_layouts[];
index fc2cf68ed4cc4c59c7c69bcd574462ed3e497ce3..4906d95a49c51eaf168dff019b996e7b71d6f6ed 100644 (file)
@@ -146,6 +146,9 @@ isl_genX(emit_depth_stencil_hiz_s)(const struct isl_device *dev, void *batch,
       sb.Depth = sb.RenderTargetViewExtent = info->view->array_len - 1;
       sb.SurfLOD = info->view->base_level;
       sb.MinimumArrayElement = info->view->base_array_layer;
+      sb.StencilCompressionEnable =
+         info->stencil_aux_usage == ISL_AUX_USAGE_CCS_E;
+      sb.ControlSurfaceEnable = sb.StencilCompressionEnable;
 #elif GEN_GEN >= 8 || GEN_IS_HASWELL
       sb.StencilBufferEnable = true;
 #endif