i965/gen7+: Set up MCS in SURFACE_STATE whenever MCS is present.
authorPaul Berry <stereotype441@gmail.com>
Wed, 1 May 2013 14:16:52 +0000 (07:16 -0700)
committerPaul Berry <stereotype441@gmail.com>
Wed, 12 Jun 2013 17:45:42 +0000 (10:45 -0700)
On Gen7+, MCS buffers are used both for compressed multisampled color
buffers and for "fast clear" of single-sampled color buffers.

Previous to this patch series, we didn't support fast clear, so we
only used MCS with multisampled bolor buffers.

As a first step to implementing fast clears, this patch modifies the
code that sets up SURFACE_STATE so that it configures the MCS buffer
whenever it is present, regardless of whether we are multisampling or
not.

Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/gen7_blorp.cpp
src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
src/mesa/drivers/dri/intel/intel_mipmap_tree.h

index 68c7ca11626d61f484a2af4781cdf26a7587f9cb..208c66a28f516b629388fe6b8be0e37a2314b5cc 100644 (file)
@@ -194,7 +194,7 @@ gen7_blorp_emit_surface_state(struct brw_context *brw,
    surf[3] = pitch_bytes - 1;
 
    surf[4] = gen7_surface_msaa_bits(surface->num_samples, surface->msaa_layout);
-   if (surface->msaa_layout == INTEL_MSAA_LAYOUT_CMS) {
+   if (surface->mt->mcs_mt) {
       gen7_set_surface_mcs_info(brw, surf, wm_surf_offset, surface->mt->mcs_mt,
                                 is_render_target);
    }
index 6a7c8deff559d2c14a2ba539eb5a4943d82c7795..3164f994dd4c1691db8e2fc2c055d5dc15d15e5b 100644 (file)
@@ -609,7 +609,7 @@ gen7_update_renderbuffer_surface(struct brw_context *brw,
              min_array_element << GEN7_SURFACE_MIN_ARRAY_ELEMENT_SHIFT |
              (depth - 1) << GEN7_SURFACE_RENDER_TARGET_VIEW_EXTENT_SHIFT;
 
-   if (irb->mt->msaa_layout == INTEL_MSAA_LAYOUT_CMS) {
+   if (irb->mt->mcs_mt) {
       gen7_set_surface_mcs_info(brw, surf, brw->wm.surf_offset[unit],
                                 irb->mt->mcs_mt, true /* is RT */);
    }
index d66d0b5a424c99defb30eafe8fc6be551db02f90..e2a7fe84f7258be0aaf8deed77345e62b67b42bc 100644 (file)
@@ -443,11 +443,13 @@ struct intel_mipmap_tree
 
 #ifndef I915
    /**
-    * \brief MCS miptree for multisampled textures.
+    * \brief MCS miptree.
     *
     * This miptree contains the "multisample control surface", which stores
-    * the necessary information to implement compressed MSAA on Gen7+
-    * (INTEL_MSAA_FORMAT_CMS).
+    * the necessary information to implement compressed MSAA
+    * (INTEL_MSAA_FORMAT_CMS) and "fast color clear" behaviour on Gen7+.
+    *
+    * NULL if no MCS miptree is in use for this surface.
     */
    struct intel_mipmap_tree *mcs_mt;