[Mesa-dev] [PATCH 1/7] r600g: set DB_DEPTH_SIZE.HEIGHT_TILE_MAX for EG/CM, inline other fields

Marek Olšák maraeo at gmail.com
Thu Aug 21 08:52:04 PDT 2014


From: Marek Olšák <marek.olsak at amd.com>

This fixes rendering to non-zero layer/face/slice with HTILE.
---
 src/gallium/drivers/r600/evergreen_state.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index 841ad0c..73068ac 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -1166,21 +1166,19 @@ static void evergreen_init_depth_surface(struct r600_context *rctx,
 {
 	struct r600_screen *rscreen = rctx->screen;
 	struct r600_texture *rtex = (struct r600_texture*)surf->base.texture;
+	unsigned level = surf->base.u.tex.level;
+	struct radeon_surface_level *levelinfo = &rtex->surface.level[level];
 	uint64_t offset;
-	unsigned level, pitch, slice, format, array_mode;
+	unsigned format, array_mode;
 	unsigned macro_aspect, tile_split, bankh, bankw, nbanks;
 
-	level = surf->base.u.tex.level;
+
 	format = r600_translate_dbformat(surf->base.format);
 	assert(format != ~0);
 
 	offset = rtex->resource.gpu_address;
 	offset += rtex->surface.level[level].offset;
-	pitch = (rtex->surface.level[level].nblk_x / 8) - 1;
-	slice = (rtex->surface.level[level].nblk_x * rtex->surface.level[level].nblk_y) / 64;
-	if (slice) {
-		slice = slice - 1;
-	}
+
 	switch (rtex->surface.level[level].mode) {
 	case RADEON_SURF_MODE_2D:
 		array_mode = V_028C70_ARRAY_2D_TILED_THIN1;
@@ -1216,8 +1214,10 @@ static void evergreen_init_depth_surface(struct r600_context *rctx,
 	surf->db_depth_base = offset;
 	surf->db_depth_view = S_028008_SLICE_START(surf->base.u.tex.first_layer) |
 			      S_028008_SLICE_MAX(surf->base.u.tex.last_layer);
-	surf->db_depth_size = S_028058_PITCH_TILE_MAX(pitch);
-	surf->db_depth_slice = S_02805C_SLICE_TILE_MAX(slice);
+	surf->db_depth_size = S_028058_PITCH_TILE_MAX(levelinfo->nblk_x / 8 - 1) |
+			      S_028058_HEIGHT_TILE_MAX(levelinfo->nblk_y / 8 - 1);
+	surf->db_depth_slice = S_02805C_SLICE_TILE_MAX(levelinfo->nblk_x *
+						       levelinfo->nblk_y / 64 - 1);
 
 	switch (surf->base.format) {
 	case PIPE_FORMAT_Z24X8_UNORM:
-- 
1.9.1



More information about the mesa-dev mailing list