<div dir="ltr">On 22 May 2013 12:30, Ian Romanick <span dir="ltr"><<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 05/21/2013 04:52 PM, Paul Berry wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Since we defer allocation of the MCS miptree until the time of the<br>
fast clear operation, this patch also implements creation of the MCS<br>
miptree.<br>
<br>
In addition, this patch adds the field<br>
intel_mipmap_tree::fast_clear_<u></u>color_value, which holds the most recent<br>
fast color clear value, if any. We use it to set the SURFACE_STATE's<br>
clear color for render targets.<br>
---<br>
  src/mesa/drivers/dri/i965/brw_<u></u>blorp.cpp           |   1 +<br>
  src/mesa/drivers/dri/i965/brw_<u></u>blorp.h             |  11 +-<br>
  src/mesa/drivers/dri/i965/brw_<u></u>blorp_clear.cpp     | 143 +++++++++++++++++++++-<br>
  src/mesa/drivers/dri/i965/brw_<u></u>clear.c             |   2 +-<br>
  src/mesa/drivers/dri/i965/brw_<u></u>defines.h           |   2 +<br>
  src/mesa/drivers/dri/i965/<u></u>gen7_blorp.cpp          |  18 ++-<br>
  src/mesa/drivers/dri/i965/<u></u>gen7_wm_surface_state.c |  10 +-<br>
  src/mesa/drivers/dri/intel/<u></u>intel_mipmap_tree.c    |  47 +++++++<br>
  src/mesa/drivers/dri/intel/<u></u>intel_mipmap_tree.h    |  13 ++<br>
  9 files changed, 233 insertions(+), 14 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<u></u>brw_blorp.cpp b/src/mesa/drivers/dri/i965/<u></u>brw_blorp.cpp<br>
index 20f7153..c6019d1 100644<br>
--- a/src/mesa/drivers/dri/i965/<u></u>brw_blorp.cpp<br>
+++ b/src/mesa/drivers/dri/i965/<u></u>brw_blorp.cpp<br>
@@ -147,6 +147,7 @@ brw_blorp_params::brw_blorp_<u></u>params()<br>
       y1(0),<br>
       depth_format(0),<br>
       hiz_op(GEN6_HIZ_OP_NONE),<br>
+     fast_clear_op(GEN7_FAST_CLEAR_<u></u>OP_NONE),<br>
       num_samples(0),<br>
       use_wm_prog(false)<br>
  {<br>
diff --git a/src/mesa/drivers/dri/i965/<u></u>brw_blorp.h b/src/mesa/drivers/dri/i965/<u></u>brw_blorp.h<br>
index 6360a62..687d7eb 100644<br>
--- a/src/mesa/drivers/dri/i965/<u></u>brw_blorp.h<br>
+++ b/src/mesa/drivers/dri/i965/<u></u>brw_blorp.h<br>
@@ -46,7 +46,8 @@ brw_blorp_blit_miptrees(struct intel_context *intel,<br>
                          bool mirror_x, bool mirror_y);<br>
<br>
  bool<br>
-brw_blorp_clear_color(struct intel_context *intel, struct gl_framebuffer *fb);<br>
+brw_blorp_clear_color(struct intel_context *intel, struct gl_framebuffer *fb,<br>
+                      bool partial_clear);<br>
<br>
  #ifdef __cplusplus<br>
  } /* end extern "C" */<br>
@@ -195,6 +196,13 @@ struct brw_blorp_prog_data<br>
     bool persample_msaa_dispatch;<br>
  };<br>
<br>
+<br>
+enum gen7_fast_clear_op {<br>
+   GEN7_FAST_CLEAR_OP_NONE,<br>
+   GEN7_FAST_CLEAR_OP_FAST_CLEAR,<br>
+};<br>
+<br>
+<br>
  class brw_blorp_params<br>
  {<br>
  public:<br>
@@ -212,6 +220,7 @@ public:<br>
     brw_blorp_surface_info src;<br>
     brw_blorp_surface_info dst;<br>
     enum gen6_hiz_op hiz_op;<br>
+   enum gen7_fast_clear_op fast_clear_op;<br>
     unsigned num_samples;<br>
     bool use_wm_prog;<br>
     brw_blorp_wm_push_constants wm_push_consts;<br>
diff --git a/src/mesa/drivers/dri/i965/<u></u>brw_blorp_clear.cpp b/src/mesa/drivers/dri/i965/<u></u>brw_blorp_clear.cpp<br>
index 28d7ad0..675289b 100644<br>
--- a/src/mesa/drivers/dri/i965/<u></u>brw_blorp_clear.cpp<br>
+++ b/src/mesa/drivers/dri/i965/<u></u>brw_blorp_clear.cpp<br>
@@ -49,7 +49,8 @@ public:<br>
     brw_blorp_clear_params(struct brw_context *brw,<br>
                            struct gl_framebuffer *fb,<br>
                            struct gl_renderbuffer *rb,<br>
-                          GLubyte *color_mask);<br>
+                          GLubyte *color_mask,<br>
+                          bool partial_clear);<br>
<br>
     virtual uint32_t get_wm_prog(struct brw_context *brw,<br>
                                  brw_blorp_prog_data **prog_data) const;<br>
@@ -105,10 +106,49 @@ brw_blorp_clear_program::~brw_<u></u>blorp_clear_program()<br>
     ralloc_free(mem_ctx);<br>
  }<br>
<br>
+<br>
+/**<br>
+ * Determine if fast color clear supports the given clear color.<br>
+ *<br>
+ * Fast color clear can only clear to color values of 1.0 or 0.0.  At the<br>
+ * moment we only support floating point buffers.<br>
+ */<br>
+static bool<br>
+is_color_fast_clear_<u></u>compatible(gl_format format,<br>
+                               const union gl_color_union *color)<br>
+{<br>
+   if (_mesa_is_format_integer_<u></u>color(format))<br>
+      return false;<br>
+<br>
+   for (int i = 0; i < 4; i++) {<br>
+      if (color->f[i] != 0.0 && color->f[i] != 1.0)<br>
+         return false;<br>
</blockquote>
<br></div></div>
Should this generate a perf debug message?  Eric may have an opinion about generating warnings for the non-fast path...</blockquote><div><br></div><div>Sounds reasonable to me.  We already have perf debug messages for other things that can inhibit fast clears (e.g. scissor preventing fast depth clear).  I'll add it unless I hear an objection.<br>
<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+   }<br>
+   return true;<br>
+}<br>
+<br>
+<br>
+/**<br>
+ * Convert the given color to a bitfield suitable for ORing into DWORD 7 of<br>
+ * SURFACE_STATE.<br>
+ */<br>
+static uint32_t<br>
+compute_fast_clear_color_<u></u>bits(const union gl_color_union *color)<br>
+{<br>
+   uint32_t bits = 0;<br>
+   for (int i = 0; i < 4; i++) {<br>
+      if (color->f[i] != 0.0)<br>
+         bits |= 1 << (GEN7_SURFACE_CLEAR_COLOR_<u></u>SHIFT + (3 - i));<br>
+   }<br>
+   return bits;<br>
+}<br>
+<br>
+<br>
  brw_blorp_clear_params::brw_<u></u>blorp_clear_params(struct brw_context *brw,<br>
                                                 struct gl_framebuffer *fb,<br>
                                                 struct gl_renderbuffer *rb,<br>
-                                               GLubyte *color_mask)<br>
+                                               GLubyte *color_mask,<br>
+                                               bool partial_clear)<br>
  {<br>
     struct intel_context *intel = &brw->intel;<br>
     struct gl_context *ctx = &intel->ctx;<br>
@@ -163,6 +203,56 @@ brw_blorp_clear_params::brw_<u></u>blorp_clear_params(struct brw_context *brw,<br>
           wm_prog_key.use_simd16_<u></u>replicated_data = false;<br>
        }<br>
     }<br>
+<br>
+   /* If we can do this as a fast color clear, do so. */<br>
+   if (irb->mt->mcs_state != INTEL_MCS_STATE_NONE && !partial_clear &&<br>
+       wm_prog_key.use_simd16_<u></u>replicated_data &&<br>
+       is_color_fast_clear_<u></u>compatible(format, &ctx->Color.ClearColor)) {<br>
+      memset(push_consts, 0xff, 4*sizeof(float));<br>
+      fast_clear_op = GEN7_FAST_CLEAR_OP_FAST_CLEAR;<br>
+<br>
+      /* From the Ivy Bridge PRM, Vol2 Part1 11.7 "MCS Buffer for Render<br>
+       * Target(s)", beneath the "Fast Color Clear" bullet (p327):<br>
+       *<br>
+       *     Clear pass must have a clear rectangle that must follow alignment<br>
+       *     rules in terms of pixels and lines as shown in the table<br>
+       *     below. Further, the clear-rectangle height and width must be<br>
+       *     multiple of the following dimensions. If the height and width of<br>
+       *     the render target being cleared do not meet these requirements,<br>
+       *     an MCS buffer can be created such that it follows the requirement<br>
+       *     and covers the RT.<br>
+       *<br>
+       * The alignment size in the table that follows is related to the<br>
+       * alignment size returned by intel_get_non_msrt_mcs_<u></u>alignment(), but<br>
+       * with X alignment multiplied by 16 and Y alignment multiplied by 32.<br>
+       */<br>
+      unsigned x_align, y_align;<br>
+      intel_get_non_msrt_mcs_<u></u>alignment(intel, irb->mt, &x_align, &y_align);<br>
+      x_align *= 16;<br>
+      y_align *= 32;<br>
+      x0 = ROUND_DOWN_TO(x0, x_align);<br>
+      y0 = ROUND_DOWN_TO(y0, y_align);<br>
+      x1 = ALIGN(x1, x_align);<br>
+      y1 = ALIGN(y1, y_align);<br>
+<br>
+      /* From the Ivy Bridge PRM, Vol2 Part1 11.7 "MCS Buffer for Render<br>
+       * Target(s)", beneath the "Fast Color Clear" bullet (p327):<br>
+       *<br>
+       *     In order to optimize the performance MCS buffer (when bound to 1X<br>
+       *     RT) clear similarly to MCS buffer clear for MSRT case, clear rect<br>
+       *     is required to be scaled by the following factors in the<br>
+       *     horizontal and vertical directions:<br>
+       *<br>
+       * The X and Y scale down factors in the table that follows are each<br>
+       * equal to half the alignment value computed above.<br>
+       */<br>
+      unsigned x_scaledown = x_align / 2;<br>
+      unsigned y_scaledown = y_align / 2;<br>
+      x0 /= x_scaledown;<br>
+      y0 /= y_scaledown;<br>
+      x1 /= x_scaledown;<br>
+      y1 /= y_scaledown;<br>
+   }<br>
  }<br>
<br>
  uint32_t<br>
@@ -266,7 +356,8 @@ brw_blorp_clear_program::<u></u>compile(struct brw_context *brw,<br>
<br>
  extern "C" {<br>
  bool<br>
-brw_blorp_clear_color(struct intel_context *intel, struct gl_framebuffer *fb)<br>
+brw_blorp_clear_color(struct intel_context *intel, struct gl_framebuffer *fb,<br>
+                      bool partial_clear)<br>
  {<br>
     struct gl_context *ctx = &intel->ctx;<br>
     struct brw_context *brw = brw_context(ctx);<br>
@@ -288,6 +379,7 @@ brw_blorp_clear_color(struct intel_context *intel, struct gl_framebuffer *fb)<br>
<br>
     for (unsigned buf = 0; buf < ctx->DrawBuffer->_<u></u>NumColorDrawBuffers; buf++) {<br>
        struct gl_renderbuffer *rb = ctx->DrawBuffer->_<u></u>ColorDrawBuffers[buf];<br>
+      struct intel_renderbuffer *irb = intel_renderbuffer(rb);<br>
<br>
        /* If this is an ES2 context or GL_ARB_ES2_compatibility is supported,<br>
         * the framebuffer can be complete with some attachments missing.  In<br>
@@ -296,8 +388,51 @@ brw_blorp_clear_color(struct intel_context *intel, struct gl_framebuffer *fb)<br>
        if (rb == NULL)<br>
           continue;<br>
<br>
-      brw_blorp_clear_params params(brw, fb, rb, ctx->Color.ColorMask[buf]);<br>
+      brw_blorp_clear_params params(brw, fb, rb, ctx->Color.ColorMask[buf],<br>
+                                    partial_clear);<br>
+<br>
+      bool is_fast_clear =<br>
+         (params.fast_clear_op == GEN7_FAST_CLEAR_OP_FAST_CLEAR)<u></u>;<br>
+      if (is_fast_clear) {<br>
+         /* Record the clear color in the miptree so that it will be<br>
+          * programmed in SURFACE_STATE by later rendering and resolve<br>
+          * operations.<br>
+          */<br>
+         uint32_t new_color_value =<br>
+            compute_fast_clear_color_bits(<u></u>&ctx->Color.ClearColor);<br>
+         if (irb->mt->fast_clear_color_<u></u>value != new_color_value) {<br>
+            irb->mt->fast_clear_color_<u></u>value = new_color_value;<br>
+            brw->state.dirty.brw |= BRW_NEW_SURFACES;<br>
+         }<br>
+<br>
+         /* If the buffer is already in INTEL_MCS_STATE_CLEAR, the clear is<br>
+          * redundant and can be skipped.<br>
+          */<br>
+         if (irb->mt->mcs_state == INTEL_MCS_STATE_CLEAR)<br>
+            continue;<br>
+<br>
+         /* If the MCS buffer hasn't been allocated yet, we need to allocate<br>
+          * it now.<br>
+          */<br>
+         if (!irb->mt->mcs_mt &&<br>
+             !intel_miptree_alloc_non_msrt_<u></u>mcs(intel, irb->mt)) {<br>
+            /* MCS allocation failed--probably this will only happen in<br>
+             * out-of-memory conditions.  But in any case, try to recover by<br>
+             * falling back to a non-blorp clear technique.<br>
+             */<br>
+            return false;<br>
+         }<br>
+      }<br>
+<br>
        brw_blorp_exec(intel, &params);<br>
+<br>
+      if (is_fast_clear) {<br>
+         /* Now that the fast clear has occurred, put the buffer in<br>
+          * INTEL_MCS_STATE_CLEAR so that we won't waste time doing redundant<br>
+          * clears.<br>
+          */<br>
+         irb->mt->mcs_state = INTEL_MCS_STATE_CLEAR;<br>
+      }<br>
     }<br>
<br>
     return true;<br>
diff --git a/src/mesa/drivers/dri/i965/<u></u>brw_clear.c b/src/mesa/drivers/dri/i965/<u></u>brw_clear.c<br>
index 2b999bf..80b7a0c 100644<br>
--- a/src/mesa/drivers/dri/i965/<u></u>brw_clear.c<br>
+++ b/src/mesa/drivers/dri/i965/<u></u>brw_clear.c<br>
@@ -234,7 +234,7 @@ brw_clear(struct gl_context *ctx, GLbitfield mask)<br>
     /* BLORP is currently only supported on Gen6+. */<br>
     if (intel->gen >= 6) {<br>
        if (mask & BUFFER_BITS_COLOR) {<br>
-         if (brw_blorp_clear_color(intel, fb)) {<br>
+         if (brw_blorp_clear_color(intel, fb, partial_clear)) {<br>
              debug_mask("blorp color", mask & BUFFER_BITS_COLOR);<br>
              mask &= ~BUFFER_BITS_COLOR;<br>
           }<br>
diff --git a/src/mesa/drivers/dri/i965/<u></u>brw_defines.h b/src/mesa/drivers/dri/i965/<u></u>brw_defines.h<br>
index fedd78c..90b16ab 100644<br>
--- a/src/mesa/drivers/dri/i965/<u></u>brw_defines.h<br>
+++ b/src/mesa/drivers/dri/i965/<u></u>brw_defines.h<br>
@@ -555,6 +555,7 @@<br>
  #define GEN7_SURFACE_MCS_PITCH_MASK             INTEL_MASK(11, 3)<br>
<br>
  /* Surface state DW7 */<br>
+#define GEN7_SURFACE_CLEAR_COLOR_SHIFT         28<br>
  #define GEN7_SURFACE_SCS_R_SHIFT                25<br>
  #define GEN7_SURFACE_SCS_R_MASK                 INTEL_MASK(27, 25)<br>
  #define GEN7_SURFACE_SCS_G_SHIFT                22<br>
@@ -1613,6 +1614,7 @@ enum brw_wm_barycentric_interp_mode {<br>
  # define GEN7_PS_PUSH_CONSTANT_ENABLE                 (1 << 11)<br>
  # define GEN7_PS_ATTRIBUTE_ENABLE                     (1 << 10)<br>
  # define GEN7_PS_OMASK_TO_RENDER_TARGET                       (1 << 9)<br>
+# define GEN7_PS_RENDER_TARGET_FAST_<u></u>CLEAR_ENABLE       (1 << 8)<br>
  # define GEN7_PS_DUAL_SOURCE_BLEND_<u></u>ENABLE             (1 << 7)<br>
  # define GEN7_PS_POSOFFSET_NONE                               (0 << 3)<br>
  # define GEN7_PS_POSOFFSET_CENTROID                   (2 << 3)<br>
diff --git a/src/mesa/drivers/dri/i965/<u></u>gen7_blorp.cpp b/src/mesa/drivers/dri/i965/<u></u>gen7_blorp.cpp<br>
index 2d09c7f..5f7e10f 100644<br>
--- a/src/mesa/drivers/dri/i965/<u></u>gen7_blorp.cpp<br>
+++ b/src/mesa/drivers/dri/i965/<u></u>gen7_blorp.cpp<br>
@@ -202,11 +202,13 @@ gen7_blorp_emit_surface_state(<u></u>struct brw_context *brw,<br>
                                  is_render_target);<br>
     }<br>
<br>
+   surf[7] = surface->mt->fast_clear_color_<u></u>value;<br>
+<br>
     if (intel->is_haswell) {<br>
-      surf[7] = SET_FIELD(HSW_SCS_RED,   GEN7_SURFACE_SCS_R) |<br>
-                SET_FIELD(HSW_SCS_GREEN, GEN7_SURFACE_SCS_G) |<br>
-                SET_FIELD(HSW_SCS_BLUE,  GEN7_SURFACE_SCS_B) |<br>
-                SET_FIELD(HSW_SCS_ALPHA, GEN7_SURFACE_SCS_A);<br>
+      surf[7] |= (SET_FIELD(HSW_SCS_RED,   GEN7_SURFACE_SCS_R) |<br>
+                  SET_FIELD(HSW_SCS_GREEN, GEN7_SURFACE_SCS_G) |<br>
+                  SET_FIELD(HSW_SCS_BLUE,  GEN7_SURFACE_SCS_B) |<br>
+                  SET_FIELD(HSW_SCS_ALPHA, GEN7_SURFACE_SCS_A));<br>
     }<br>
<br>
     /* Emit relocation to surface contents */<br>
@@ -587,6 +589,14 @@ gen7_blorp_emit_ps_config(<u></u>struct brw_context *brw,<br>
        dw5 |= prog_data->first_curbe_grf << GEN7_PS_DISPATCH_START_GRF_<u></u>SHIFT_0;<br>
     }<br>
<br>
+   switch (params->fast_clear_op) {<br>
+   case GEN7_FAST_CLEAR_OP_FAST_CLEAR:<br>
+      dw4 |= GEN7_PS_RENDER_TARGET_FAST_<u></u>CLEAR_ENABLE;<br>
+      break;<br>
+   default:<br>
+      break;<br>
+   }<br>
+<br>
     BEGIN_BATCH(8);<br>
     OUT_BATCH(_3DSTATE_PS << 16 | (8 - 2));<br>
     OUT_BATCH(params->use_wm_prog ? prog_offset : 0);<br>
diff --git a/src/mesa/drivers/dri/i965/<u></u>gen7_wm_surface_state.c b/src/mesa/drivers/dri/i965/<u></u>gen7_wm_surface_state.c<br>
index f5d2e43..fda4b2c 100644<br>
--- a/src/mesa/drivers/dri/i965/<u></u>gen7_wm_surface_state.c<br>
+++ b/src/mesa/drivers/dri/i965/<u></u>gen7_wm_surface_state.c<br>
@@ -589,11 +589,13 @@ gen7_update_renderbuffer_<u></u>surface(struct brw_context *brw,<br>
                                  irb->mt->mcs_mt, true /* is RT */);<br>
     }<br>
<br>
+   surf[7] = irb->mt->fast_clear_color_<u></u>value;<br>
+<br>
     if (intel->is_haswell) {<br>
-      surf[7] = SET_FIELD(HSW_SCS_RED,   GEN7_SURFACE_SCS_R) |<br>
-                SET_FIELD(HSW_SCS_GREEN, GEN7_SURFACE_SCS_G) |<br>
-                SET_FIELD(HSW_SCS_BLUE,  GEN7_SURFACE_SCS_B) |<br>
-                SET_FIELD(HSW_SCS_ALPHA, GEN7_SURFACE_SCS_A);<br>
+      surf[7] |= (SET_FIELD(HSW_SCS_RED,   GEN7_SURFACE_SCS_R) |<br>
+                  SET_FIELD(HSW_SCS_GREEN, GEN7_SURFACE_SCS_G) |<br>
+                  SET_FIELD(HSW_SCS_BLUE,  GEN7_SURFACE_SCS_B) |<br>
+                  SET_FIELD(HSW_SCS_ALPHA, GEN7_SURFACE_SCS_A));<br>
     }<br>
<br>
     drm_intel_bo_emit_reloc(brw-><a href="http://intel.batch.bo" target="_blank">i<u></u>ntel.batch.bo</a>,<br>
diff --git a/src/mesa/drivers/dri/intel/<u></u>intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/<u></u>intel_mipmap_tree.c<br>
index 9d1b91a..657532f 100644<br>
--- a/src/mesa/drivers/dri/intel/<u></u>intel_mipmap_tree.c<br>
+++ b/src/mesa/drivers/dri/intel/<u></u>intel_mipmap_tree.c<br>
@@ -1163,6 +1163,53 @@ intel_miptree_alloc_mcs(struct intel_context *intel,<br>
  #endif<br>
  }<br>
<br>
+<br>
+bool<br>
+intel_miptree_alloc_non_msrt_<u></u>mcs(struct intel_context *intel,<br>
+                                 struct intel_mipmap_tree *mt)<br>
+{<br>
+#ifdef I915<br>
+   assert(!"MCS not supported on i915");<br>
+#else<br>
+   assert(mt->mcs_mt == NULL);<br>
+<br>
+   /* The format of the MCS buffer is opaque to the driver; all that matters<br>
+    * is that we get its size and pitch right.  We'll pretend that the format<br>
+    * is R32.  Since an MCS tile covers 128 blocks horizontally, and a Y-tiled<br>
+    * R32 buffer is 32 pixels across, we'll need to scale the width down by<br>
+    * the block width and then a further factor of 4.  Since an MCS tile<br>
+    * covers 256 blocks vertically, and a Y-tiled R32 buffer is 32 rows high,<br>
+    * we'll need to scale the height down by the block height and then a<br>
+    * further factor of 8.<br>
+    */<br>
+   const gl_format format = MESA_FORMAT_R_UINT32;<br>
+   unsigned block_width_px;<br>
+   unsigned block_height;<br>
+   intel_get_non_msrt_mcs_<u></u>alignment(intel, mt, &block_width_px, &block_height);<br>
+   unsigned width_divisor = block_width_px * 4;<br>
+   unsigned height_divisor = block_height * 8;<br>
+   unsigned mcs_width =<br>
+      ALIGN(mt->logical_width0, width_divisor) / width_divisor;<br>
+   unsigned mcs_height =<br>
+      ALIGN(mt->logical_height0, height_divisor) / height_divisor;<br>
+   assert(mt->logical_depth0 == 1);<br>
+   mt->mcs_mt = intel_miptree_create(intel,<br>
+                                     mt->target,<br>
+                                     format,<br>
+                                     mt->first_level,<br>
+                                     mt->last_level,<br>
+                                     mcs_width,<br>
+                                     mcs_height,<br>
+                                     mt->logical_depth0,<br>
+                                     true,<br>
+                                     0 /* num_samples */,<br>
+                                     true /* force_y_tiling */);<br>
+<br>
+   return mt->mcs_mt;<br>
+#endif<br>
+}<br>
+<br>
+<br>
  /**<br>
   * Helper for intel_miptree_alloc_hiz() that sets<br>
   * \c mt->level[level].slice[layer].<u></u>has_hiz. Return true if and only if<br>
diff --git a/src/mesa/drivers/dri/intel/<u></u>intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/<u></u>intel_mipmap_tree.h<br>
index 5cd69cb..4c9ff94 100644<br>
--- a/src/mesa/drivers/dri/intel/<u></u>intel_mipmap_tree.h<br>
+++ b/src/mesa/drivers/dri/intel/<u></u>intel_mipmap_tree.h<br>
@@ -463,6 +463,15 @@ struct intel_mipmap_tree<br>
     enum intel_mcs_state mcs_state;<br>
  #endif<br>
<br>
+   /**<br>
+    * The SURFACE_STATE bits associated with the last fast color clear to this<br>
+    * color mipmap tree, if any.<br>
+    *<br>
+    * This value will only ever contain ones in bits 28-31, so it is safe to<br>
+    * OR into dword 7 of SURFACE_STATE.<br>
+    */<br>
+   uint32_t fast_clear_color_value;<br>
+<br>
     /* These are also refcounted:<br>
      */<br>
     GLuint refcount;<br>
@@ -477,6 +486,10 @@ intel_get_non_msrt_mcs_<u></u>alignment(struct intel_context *intel,<br>
                                   struct intel_mipmap_tree *mt,<br>
                                   unsigned *width_px, unsigned *height);<br>
<br>
+bool<br>
+intel_miptree_alloc_non_msrt_<u></u>mcs(struct intel_context *intel,<br>
+                                 struct intel_mipmap_tree *mt);<br>
+<br>
  struct intel_mipmap_tree *intel_miptree_create(struct intel_context *intel,<br>
                                                 GLenum target,<br>
                                               gl_format format,<br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div></div>