isl/surface_state: Set the correct pitch for W-tiled surfaces
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 1 Apr 2016 01:38:21 +0000 (18:38 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 8 Apr 2016 22:58:52 +0000 (15:58 -0700)
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
src/intel/isl/isl_surface_state.c

index 6afe45d650ef9a57fc79213a04ab8924db756715..cac59fab78e2b1b1dab2b441f976a7fcf3a1b0d4 100644 (file)
@@ -261,7 +261,6 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state,
       .Height = info->surf->logical_level0_px.height - 1,
       .Depth = 0, /* TEMPLATE */
 
-      .SurfacePitch = info->surf->row_pitch - 1,
       .RenderTargetViewExtent = 0, /* TEMPLATE */
       .MinimumArrayElement = 0, /* TEMPLATE */
 
@@ -295,6 +294,19 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state,
 #endif
    };
 
+   if (info->surf->tiling == ISL_TILING_W) {
+      /* From the Broadwell PRM documentation for this field:
+       *
+       *    "If the surface is a stencil buffer (and thus has Tile Mode set
+       *    to TILEMODE_WMAJOR), the pitch must be set to 2x the value
+       *    computed based on width, as the stencil buffer is stored with
+       *    two rows interleaved."
+       */
+      s.SurfacePitch = info->surf->row_pitch * 2 - 1;
+   } else {
+      s.SurfacePitch = info->surf->row_pitch - 1;
+   }
+
    if (info->view->usage & ISL_SURF_USAGE_STORAGE_BIT) {
       s.SurfaceFormat = isl_lower_storage_image_format(dev, info->view->format);
    } else {