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>main
parent
068ea68b3f
commit
1543c96e15
|
@ -655,7 +655,7 @@ static int eg_surface_init_2d(struct radeon_surface_manager *surf_man,
|
||||||
tileb = tilew * tileh * bpe * surf->nsamples;
|
tileb = tilew * tileh * bpe * surf->nsamples;
|
||||||
/* slices per tile */
|
/* slices per tile */
|
||||||
slice_pt = 1;
|
slice_pt = 1;
|
||||||
if (tileb > tile_split) {
|
if (tileb > tile_split && tile_split) {
|
||||||
slice_pt = tileb / tile_split;
|
slice_pt = tileb / tile_split;
|
||||||
}
|
}
|
||||||
tileb = tileb / slice_pt;
|
tileb = tileb / slice_pt;
|
||||||
|
@ -1621,7 +1621,7 @@ static int si_surface_init_2d(struct radeon_surface_manager *surf_man,
|
||||||
tileb = tilew * tileh * bpe * surf->nsamples;
|
tileb = tilew * tileh * bpe * surf->nsamples;
|
||||||
/* slices per tile */
|
/* slices per tile */
|
||||||
slice_pt = 1;
|
slice_pt = 1;
|
||||||
if (tileb > tile_split) {
|
if (tileb > tile_split && tile_split) {
|
||||||
slice_pt = tileb / tile_split;
|
slice_pt = tileb / tile_split;
|
||||||
}
|
}
|
||||||
tileb = tileb / slice_pt;
|
tileb = tileb / slice_pt;
|
||||||
|
@ -2223,7 +2223,7 @@ static int cik_surface_init_2d(struct radeon_surface_manager *surf_man,
|
||||||
|
|
||||||
/* slices per tile */
|
/* slices per tile */
|
||||||
slice_pt = 1;
|
slice_pt = 1;
|
||||||
if (tileb > tile_split) {
|
if (tileb > tile_split && tile_split) {
|
||||||
slice_pt = tileb / tile_split;
|
slice_pt = tileb / tile_split;
|
||||||
tileb = tileb / slice_pt;
|
tileb = tileb / slice_pt;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue