isl: Round up some pitches to 512B for Gen12's CCS
authorNanley Chery <nanley.g.chery@intel.com>
Tue, 23 Apr 2019 22:28:18 +0000 (15:28 -0700)
committerNanley Chery <nanley.g.chery@intel.com>
Mon, 28 Oct 2019 17:47:05 +0000 (10:47 -0700)
Gen12's CCS requires that the main surface have a pitch aligned to 512B.

v2. Provide a BSpec citation. (Ken)

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/isl/isl.c

index 850e5b1ee95551fba8dccc4095f53efd1869beb3..39e5dca530744a891b30b86d2c764e2e4b2a4a2e 100644 (file)
@@ -1386,18 +1386,26 @@ isl_calc_row_pitch(const struct isl_device *dev,
       isl_calc_min_row_pitch(dev, surf_info, tile_info, phys_total_el,
                              alignment_B);
 
-   uint32_t row_pitch_B = min_row_pitch_B;
-
    if (surf_info->row_pitch_B != 0) {
-      row_pitch_B = surf_info->row_pitch_B;
-
-      if (row_pitch_B < min_row_pitch_B)
+      if (surf_info->row_pitch_B < min_row_pitch_B)
          return false;
 
-      if (row_pitch_B % alignment_B != 0)
+      if (surf_info->row_pitch_B % alignment_B != 0)
          return false;
    }
 
+   const uint32_t row_pitch_B =
+      surf_info->row_pitch_B != 0 ?
+         surf_info->row_pitch_B :
+      /* According to BSpec: 44930, Gen12's CCS-compressed surface pitches
+       * must be 512B-aligned.
+       */
+      ISL_DEV_GEN(dev) >= 12 &&
+      isl_format_supports_ccs_e(dev->info, surf_info->format) ?
+         isl_align(min_row_pitch_B, 512) :
+      /* Else */
+         min_row_pitch_B;
+
    const uint32_t row_pitch_tl = row_pitch_B / tile_info->phys_extent_B.width;
 
    if (row_pitch_B == 0)