intel: Add map_stencil_as_y_tiled to intel_region_get_tile_masks.
authorPaul Berry <stereotype441@gmail.com>
Thu, 30 Aug 2012 17:57:03 +0000 (10:57 -0700)
committerPaul Berry <stereotype441@gmail.com>
Wed, 12 Sep 2012 21:44:13 +0000 (14:44 -0700)
When the blorp engine is performing a blit from one stencil buffer to
another, it sets up the surface state for these buffers as Y-tiled, so
it needs to be able to force intel_region_get_tile_masks() to return
the appropriate masks for a Y-tiled region.

NOTE: This is a candidate for stable release branches.

Acked-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/brw_blorp.cpp
src/mesa/drivers/dri/i965/brw_misc_state.c
src/mesa/drivers/dri/i965/gen6_blorp.cpp
src/mesa/drivers/dri/i965/gen7_misc_state.c
src/mesa/drivers/dri/intel/intel_fbo.c
src/mesa/drivers/dri/intel/intel_regions.c
src/mesa/drivers/dri/intel/intel_regions.h
src/mesa/drivers/dri/intel/intel_screen.c

index 3368907e1b830e22f1824a0f898c37ba7799e209..7e4519147e5a8f4dd67779ce6cff54af8549756e 100644 (file)
@@ -122,7 +122,8 @@ brw_blorp_surface_info::compute_tile_offsets(uint32_t *tile_x,
    struct intel_region *region = mt->region;
    uint32_t mask_x, mask_y;
 
-   intel_region_get_tile_masks(region, &mask_x, &mask_y);
+   intel_region_get_tile_masks(region, &mask_x, &mask_y,
+                               map_stencil_as_y_tiled);
 
    *tile_x = x_offset & mask_x;
    *tile_y = y_offset & mask_y;
index 3f186f54ecf66f279c623eda9d0bdad47a388104..52926fb4f232eb1648be4f2ff3f8e1d77a18a23a 100644 (file)
@@ -288,7 +288,7 @@ static void emit_depthbuffer(struct brw_context *brw)
 
    if (depth_irb) {
       intel_region_get_tile_masks(depth_irb->mt->region,
-                                  &tile_mask_x, &tile_mask_y);
+                                  &tile_mask_x, &tile_mask_y, false);
    }
 
    if (depth_irb &&
@@ -298,7 +298,7 @@ static void emit_depthbuffer(struct brw_context *brw)
 
       uint32_t hiz_tile_mask_x, hiz_tile_mask_y;
       intel_region_get_tile_masks(hiz_region,
-                                  &hiz_tile_mask_x, &hiz_tile_mask_y);
+                                  &hiz_tile_mask_x, &hiz_tile_mask_y, false);
 
       /* Each HiZ row represents 2 rows of pixels */
       hiz_tile_mask_y = hiz_tile_mask_y << 1 | 1;
@@ -331,7 +331,7 @@ static void emit_depthbuffer(struct brw_context *brw)
          uint32_t stencil_tile_mask_x, stencil_tile_mask_y;
          intel_region_get_tile_masks(stencil_mt->region,
                                      &stencil_tile_mask_x,
-                                     &stencil_tile_mask_y);
+                                     &stencil_tile_mask_y, false);
 
          tile_mask_x |= stencil_tile_mask_x;
          tile_mask_y |= stencil_tile_mask_y;
index baf3fa4531cf37470294f49ea310d960e49b791e..3e0b80e36cf08dd2d4ba4ee215ccd8b8d00ed9f2 100644 (file)
@@ -58,9 +58,9 @@ gen6_blorp_compute_tile_masks(const brw_blorp_params *params,
 {
    uint32_t depth_mask_x, depth_mask_y, hiz_mask_x, hiz_mask_y;
    intel_region_get_tile_masks(params->depth.mt->region,
-                               &depth_mask_x, &depth_mask_y);
+                               &depth_mask_x, &depth_mask_y, false);
    intel_region_get_tile_masks(params->depth.mt->hiz_mt->region,
-                               &hiz_mask_x, &hiz_mask_y);
+                               &hiz_mask_x, &hiz_mask_y, false);
 
    /* Each HiZ row represents 2 rows of pixels */
    hiz_mask_y = hiz_mask_y << 1 | 1;
index a0d24607bc5bfd498bd7c40dd2aebc0830ed765e..9709b8ef8b4ab98deb5d567b60878f349949342c 100644 (file)
@@ -69,12 +69,13 @@ static void emit_depthbuffer(struct brw_context *brw)
       hiz_mt = depth_mt->hiz_mt;
 
       intel_region_get_tile_masks(depth_mt->region,
-                                  &tile_mask_x, &tile_mask_y);
+                                  &tile_mask_x, &tile_mask_y, false);
 
       if (hiz_mt) {
          uint32_t hiz_tile_mask_x, hiz_tile_mask_y;
          intel_region_get_tile_masks(hiz_mt->region,
-                                     &hiz_tile_mask_x, &hiz_tile_mask_y);
+                                     &hiz_tile_mask_x, &hiz_tile_mask_y,
+                                     false);
 
          /* Each HiZ row represents 2 rows of pixels */
          hiz_tile_mask_y = hiz_tile_mask_y << 1 | 1;
index c522b486bcf47e4e09ac665f87daf3031471e41c..bd9548b9501c071c5f329f68cd631f98a159ddfb 100644 (file)
@@ -581,7 +581,7 @@ intel_renderbuffer_tile_offsets(struct intel_renderbuffer *irb,
    struct intel_region *region = irb->mt->region;
    uint32_t mask_x, mask_y;
 
-   intel_region_get_tile_masks(region, &mask_x, &mask_y);
+   intel_region_get_tile_masks(region, &mask_x, &mask_y, false);
 
    *tile_x = irb->draw_x & mask_x;
    *tile_y = irb->draw_y & mask_y;
index 9bf9c668da50b9f3217feb7d8c8a271c0f0a34b2..18402d64d025b1b5be4d86d1bb6b1f3e39e27f70 100644 (file)
@@ -404,11 +404,16 @@ intel_region_copy(struct intel_context *intel,
  */
 void
 intel_region_get_tile_masks(struct intel_region *region,
-                            uint32_t *mask_x, uint32_t *mask_y)
+                            uint32_t *mask_x, uint32_t *mask_y,
+                            bool map_stencil_as_y_tiled)
 {
    int cpp = region->cpp;
+   uint32_t tiling = region->tiling;
 
-   switch (region->tiling) {
+   if (map_stencil_as_y_tiled)
+      tiling = I915_TILING_Y;
+
+   switch (tiling) {
    default:
       assert(false);
    case I915_TILING_NONE:
index 7480853d3605de49cce5c8145bc86afebaa92083..e259a1e79a26b56d4cd7ea045fefb92490015bbb 100644 (file)
@@ -135,7 +135,8 @@ void _mesa_copy_rect(GLubyte * dst,
 
 void
 intel_region_get_tile_masks(struct intel_region *region,
-                            uint32_t *mask_x, uint32_t *mask_y);
+                            uint32_t *mask_x, uint32_t *mask_y,
+                            bool map_stencil_as_y_tiled);
 
 uint32_t
 intel_region_get_aligned_offset(struct intel_region *region, uint32_t x,
index ca6ac3446b4bdca777472c1272cdbe3f36b11ca8..e3a442c2a275edda3896062ab8362807785f16b5 100644 (file)
@@ -564,7 +564,7 @@ intel_from_planar(__DRIimage *parent, int plane, void *loaderPrivate)
     image->region->screen = parent->region->screen;
     image->offset = offset;
 
-    intel_region_get_tile_masks(image->region, &mask_x, &mask_y);
+    intel_region_get_tile_masks(image->region, &mask_x, &mask_y, false);
     if (offset & mask_x)
        _mesa_warning(NULL,
                      "intel_create_sub_image: offset not on tile boundary");