diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2010-10-27 01:44:35 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-10-27 21:27:07 -0400 |
commit | 2c7d81acf432fad02073c139355e94a6f7e4df45 (patch) | |
tree | 4ee9dbcb3e556b0d67fc67919271202ef3c47284 /drivers/gpu/drm | |
parent | 43b93fbffc2c080dba2e84df6fce8d7e6c0a2581 (diff) |
drm/radeon/kms: fix tiled db height calculation on 6xx/7xx
Calculate height based on the slice bitfield rather than the size.
Same as Dave's CB fix.
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/radeon/r600_cs.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index 7b294c127c5f..37cc2aa9f923 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c | |||
@@ -310,7 +310,7 @@ static int r600_cs_track_check(struct radeon_cs_parser *p) | |||
310 | /* Check depth buffer */ | 310 | /* Check depth buffer */ |
311 | if (G_028800_STENCIL_ENABLE(track->db_depth_control) || | 311 | if (G_028800_STENCIL_ENABLE(track->db_depth_control) || |
312 | G_028800_Z_ENABLE(track->db_depth_control)) { | 312 | G_028800_Z_ENABLE(track->db_depth_control)) { |
313 | u32 nviews, bpe, ntiles, pitch, pitch_align, height, size; | 313 | u32 nviews, bpe, ntiles, pitch, pitch_align, height, size, slice_tile_max; |
314 | if (track->db_bo == NULL) { | 314 | if (track->db_bo == NULL) { |
315 | dev_warn(p->dev, "z/stencil with no depth buffer\n"); | 315 | dev_warn(p->dev, "z/stencil with no depth buffer\n"); |
316 | return -EINVAL; | 316 | return -EINVAL; |
@@ -354,11 +354,11 @@ static int r600_cs_track_check(struct radeon_cs_parser *p) | |||
354 | } else { | 354 | } else { |
355 | size = radeon_bo_size(track->db_bo); | 355 | size = radeon_bo_size(track->db_bo); |
356 | pitch = G_028000_PITCH_TILE_MAX(track->db_depth_size) + 1; | 356 | pitch = G_028000_PITCH_TILE_MAX(track->db_depth_size) + 1; |
357 | height = size / (pitch * 8 * bpe); | 357 | slice_tile_max = G_028000_SLICE_TILE_MAX(track->db_depth_size) + 1; |
358 | height &= ~0x7; | 358 | slice_tile_max *= 64; |
359 | if (!height) | 359 | height = slice_tile_max / (pitch * 8); |
360 | height = 8; | 360 | if (height > 8192) |
361 | 361 | height = 8192; | |
362 | switch (G_028010_ARRAY_MODE(track->db_depth_info)) { | 362 | switch (G_028010_ARRAY_MODE(track->db_depth_info)) { |
363 | case V_028010_ARRAY_1D_TILED_THIN1: | 363 | case V_028010_ARRAY_1D_TILED_THIN1: |
364 | pitch_align = (max((u32)8, (u32)(track->group_size / (8 * bpe))) / 8); | 364 | pitch_align = (max((u32)8, (u32)(track->group_size / (8 * bpe))) / 8); |
@@ -367,6 +367,8 @@ static int r600_cs_track_check(struct radeon_cs_parser *p) | |||
367 | __func__, __LINE__, pitch); | 367 | __func__, __LINE__, pitch); |
368 | return -EINVAL; | 368 | return -EINVAL; |
369 | } | 369 | } |
370 | /* don't break userspace */ | ||
371 | height &= ~0x7; | ||
370 | if (!IS_ALIGNED(height, 8)) { | 372 | if (!IS_ALIGNED(height, 8)) { |
371 | dev_warn(p->dev, "%s:%d db height (%d) invalid\n", | 373 | dev_warn(p->dev, "%s:%d db height (%d) invalid\n", |
372 | __func__, __LINE__, height); | 374 | __func__, __LINE__, height); |