[Mesa-dev] [PATCH v2 09/34] isl/state: Add support for handling color control surfaces

Jason Ekstrand jason at jlekstrand.net
Thu Jun 23 21:00:08 UTC 2016


---
 src/intel/isl/isl.h               |  7 +++++++
 src/intel/isl/isl_surface_state.c | 39 ++++++++++++++++++++++++++++++++++++---
 2 files changed, 43 insertions(+), 3 deletions(-)

diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
index 5011d15..5f24d6e 100644
--- a/src/intel/isl/isl.h
+++ b/src/intel/isl/isl.h
@@ -864,6 +864,13 @@ struct isl_surf_fill_state_info {
    uint32_t mocs;
 
    /**
+    * The auxilary surface or NULL if no auxilary surface is to be used.
+    */
+   const struct isl_surf *aux_surf;
+   enum isl_aux_layout aux_layout;
+   uint64_t aux_address;
+
+   /**
     * The clear color for this surface
     *
     * Valid values depend on hardware generation.
diff --git a/src/intel/isl/isl_surface_state.c b/src/intel/isl/isl_surface_state.c
index 21b057e..b1c60c07 100644
--- a/src/intel/isl/isl_surface_state.c
+++ b/src/intel/isl/isl_surface_state.c
@@ -86,6 +86,23 @@ static const uint32_t isl_to_gen_multisample_layout[] = {
 };
 #endif
 
+#if GEN_GEN >= 9
+static const uint32_t isl_to_gen_aux_mode[] = {
+   [ISL_AUX_LAYOUT_NONE] = AUX_NONE,
+   [ISL_AUX_LAYOUT_HIZ] = AUX_HIZ,
+   [ISL_AUX_LAYOUT_MCS] = AUX_CCS_D,
+   [ISL_AUX_LAYOUT_CCS_D] = AUX_CCS_D,
+   [ISL_AUX_LAYOUT_CCS_E] = AUX_CCS_E,
+};
+#elif GEN_GEN >= 8
+static const uint32_t isl_to_gen_aux_mode[] = {
+   [ISL_AUX_LAYOUT_NONE] = AUX_NONE,
+   [ISL_AUX_LAYOUT_HIZ] = AUX_HIZ,
+   [ISL_AUX_LAYOUT_MCS] = AUX_MCS,
+   [ISL_AUX_LAYOUT_CCS_D] = AUX_MCS,
+};
+#endif
+
 static uint8_t
 get_surftype(enum isl_surf_dim dim, isl_surf_usage_flags_t usage)
 {
@@ -406,10 +423,26 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state,
    assert(info->y_offset == 0);
 #endif
 
+#if GEN_GEN >= 7
+   if (info->aux_surf && info->aux_layout != ISL_AUX_LAYOUT_NONE) {
+      struct isl_tile_info tile_info;
+      isl_surf_get_tile_info(dev, info->aux_surf, &tile_info);
+      uint32_t pitch_in_tiles = info->aux_surf->row_pitch / tile_info.width;
+
 #if GEN_GEN >= 8
-   s.AuxiliarySurfaceMode = AUX_NONE;
-#elif GEN_GEN >= 7
-   s.MCSEnable = false;
+      assert(GEN_GEN >= 9 || info->aux_layout != ISL_AUX_LAYOUT_CCS_E);
+      s.AuxiliarySurfacePitch = pitch_in_tiles - 1;
+      s.AuxiliarySurfaceQPitch = get_qpitch(info->aux_surf) >> 2;
+      s.AuxiliarySurfaceBaseAddress = info->aux_address;
+      s.AuxiliarySurfaceMode = isl_to_gen_aux_mode[info->aux_layout];
+#else
+      assert(info->aux_layout == ISL_AUX_LAYOUT_MCS ||
+             info->aux_layout == ISL_AUX_LAYOUT_CCS_D);
+      s.MCSBaseAddress = info->aux_address,
+      s.MCSSurfacePitch = pitch_in_tiles - 1;
+      s.MCSEnable = true;
+#endif
+   }
 #endif
 
 #if GEN_GEN >= 8
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list