[Mesa-dev] [PATCH 1/7] i965/blorp: refactor assertions for tile offset alignments
Topi Pohjolainen
topi.pohjolainen at intel.com
Mon Feb 10 11:53:09 PST 2014
There are only two callers for compute_tile_offsets() and both
require the exact same constraints for the tile offsets.
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/mesa/drivers/dri/i965/brw_blorp.cpp | 6 ++++++
src/mesa/drivers/dri/i965/gen6_blorp.cpp | 5 -----
src/mesa/drivers/dri/i965/gen7_blorp.cpp | 5 -----
3 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.cpp b/src/mesa/drivers/dri/i965/brw_blorp.cpp
index 76537c8..7bdf83a 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp.cpp
@@ -148,6 +148,12 @@ brw_blorp_surface_info::compute_tile_offsets(uint32_t *tile_x,
*tile_x = x_offset & mask_x;
*tile_y = y_offset & mask_y;
+ /* Note that the low bits of these fields are missing, so
+ * there's the possibility of getting in trouble.
+ */
+ assert(*tile_x % 4 == 0);
+ assert(*tile_y % 2 == 0);
+
return intel_region_get_aligned_offset(region, x_offset & ~mask_x,
y_offset & ~mask_y,
map_stencil_as_y_tiled);
diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.cpp b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
index 4222fa8..8d45d57 100644
--- a/src/mesa/drivers/dri/i965/gen6_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
@@ -399,11 +399,6 @@ gen6_blorp_emit_surface_state(struct brw_context *brw,
surf[4] = brw_get_surface_num_multisamples(surface->num_samples);
- /* Note that the low bits of these fields are missing, so
- * there's the possibility of getting in trouble.
- */
- assert(tile_x % 4 == 0);
- assert(tile_y % 2 == 0);
surf[5] = ((tile_x / 4) << BRW_SURFACE_X_OFFSET_SHIFT |
(tile_y / 2) << BRW_SURFACE_Y_OFFSET_SHIFT |
(surface->mt->align_h == 4 ?
diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
index 4bf9396..f067b0b 100644
--- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
@@ -178,11 +178,6 @@ gen7_blorp_emit_surface_state(struct brw_context *brw,
surf[1] =
surface->compute_tile_offsets(&tile_x, &tile_y) + region->bo->offset64;
- /* Note that the low bits of these fields are missing, so
- * there's the possibility of getting in trouble.
- */
- assert(tile_x % 4 == 0);
- assert(tile_y % 2 == 0);
surf[5] = SET_FIELD(tile_x / 4, BRW_SURFACE_X_OFFSET) |
SET_FIELD(tile_y / 2, BRW_SURFACE_Y_OFFSET) |
SET_FIELD(mocs, GEN7_SURFACE_MOCS);
--
1.8.3.1
More information about the mesa-dev
mailing list