aboutsummaryrefslogtreecommitdiffstats
path: root/radeon
diff options
context:
space:
mode:
authorAlex Deucher2013-12-10 11:38:26 -0600
committerAlex Deucher2013-12-24 14:17:06 -0600
commit1543c96e154d6801cf725c3b511d61604a378e03 (patch)
tree022a2f2dc56bdd4cb983f4ed16b98c1517ea7187 /radeon
parent068ea68b3f7ebd5efcfcc2f6ae417651423c8382 (diff)
downloadexternal-libdrm-1543c96e154d6801cf725c3b511d61604a378e03.tar.gz
external-libdrm-1543c96e154d6801cf725c3b511d61604a378e03.tar.xz
external-libdrm-1543c96e154d6801cf725c3b511d61604a378e03.zip
radeon: avoid possible divide by 0 in surface manager
Some users report hitting a divide by 0 with the tile split in certain apps. Tile_split shouldn't ever be 0 unless the surface structure was not properly initialized. I think there may be some cases where mesa uses an improperly initialized surface struct, but I haven't had time to track it down. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=72425 Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Diffstat (limited to 'radeon')
-rw-r--r--radeon/radeon_surface.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/radeon/radeon_surface.c b/radeon/radeon_surface.c
index dcbbfdc5..15127d4d 100644
--- a/radeon/radeon_surface.c
+++ b/radeon/radeon_surface.c
@@ -655,7 +655,7 @@ static int eg_surface_init_2d(struct radeon_surface_manager *surf_man,
655 tileb = tilew * tileh * bpe * surf->nsamples; 655 tileb = tilew * tileh * bpe * surf->nsamples;
656 /* slices per tile */ 656 /* slices per tile */
657 slice_pt = 1; 657 slice_pt = 1;
658 if (tileb > tile_split) { 658 if (tileb > tile_split && tile_split) {
659 slice_pt = tileb / tile_split; 659 slice_pt = tileb / tile_split;
660 } 660 }
661 tileb = tileb / slice_pt; 661 tileb = tileb / slice_pt;
@@ -1621,7 +1621,7 @@ static int si_surface_init_2d(struct radeon_surface_manager *surf_man,
1621 tileb = tilew * tileh * bpe * surf->nsamples; 1621 tileb = tilew * tileh * bpe * surf->nsamples;
1622 /* slices per tile */ 1622 /* slices per tile */
1623 slice_pt = 1; 1623 slice_pt = 1;
1624 if (tileb > tile_split) { 1624 if (tileb > tile_split && tile_split) {
1625 slice_pt = tileb / tile_split; 1625 slice_pt = tileb / tile_split;
1626 } 1626 }
1627 tileb = tileb / slice_pt; 1627 tileb = tileb / slice_pt;
@@ -2223,7 +2223,7 @@ static int cik_surface_init_2d(struct radeon_surface_manager *surf_man,
2223 2223
2224 /* slices per tile */ 2224 /* slices per tile */
2225 slice_pt = 1; 2225 slice_pt = 1;
2226 if (tileb > tile_split) { 2226 if (tileb > tile_split && tile_split) {
2227 slice_pt = tileb / tile_split; 2227 slice_pt = tileb / tile_split;
2228 tileb = tileb / slice_pt; 2228 tileb = tileb / slice_pt;
2229 } 2229 }