Revert "drm/radeon/evergreen_cs: fix int overflow errors in cs track offsets"
This reverts commit a339df473d
.
This commit is contained in:
parent
75d54cbe54
commit
5321d71bb1
1 changed files with 31 additions and 31 deletions
|
@ -396,7 +396,7 @@ static int evergreen_cs_track_validate_cb(struct radeon_cs_parser *p, unsigned i
|
|||
struct evergreen_cs_track *track = p->track;
|
||||
struct eg_surface surf;
|
||||
unsigned pitch, slice, mslice;
|
||||
u64 offset;
|
||||
unsigned long offset;
|
||||
int r;
|
||||
|
||||
mslice = G_028C6C_SLICE_MAX(track->cb_color_view[id]) + 1;
|
||||
|
@ -434,14 +434,14 @@ static int evergreen_cs_track_validate_cb(struct radeon_cs_parser *p, unsigned i
|
|||
return r;
|
||||
}
|
||||
|
||||
offset = (u64)track->cb_color_bo_offset[id] << 8;
|
||||
offset = track->cb_color_bo_offset[id] << 8;
|
||||
if (offset & (surf.base_align - 1)) {
|
||||
dev_warn(p->dev, "%s:%d cb[%d] bo base %llu not aligned with %ld\n",
|
||||
dev_warn(p->dev, "%s:%d cb[%d] bo base %ld not aligned with %ld\n",
|
||||
__func__, __LINE__, id, offset, surf.base_align);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
offset += (u64)surf.layer_size * mslice;
|
||||
offset += surf.layer_size * mslice;
|
||||
if (offset > radeon_bo_size(track->cb_color_bo[id])) {
|
||||
/* old ddx are broken they allocate bo with w*h*bpp but
|
||||
* program slice with ALIGN(h, 8), catch this and patch
|
||||
|
@ -449,14 +449,14 @@ static int evergreen_cs_track_validate_cb(struct radeon_cs_parser *p, unsigned i
|
|||
*/
|
||||
if (!surf.mode) {
|
||||
uint32_t *ib = p->ib.ptr;
|
||||
u64 tmp, nby, bsize, size, min = 0;
|
||||
unsigned long tmp, nby, bsize, size, min = 0;
|
||||
|
||||
/* find the height the ddx wants */
|
||||
if (surf.nby > 8) {
|
||||
min = surf.nby - 8;
|
||||
}
|
||||
bsize = radeon_bo_size(track->cb_color_bo[id]);
|
||||
tmp = (u64)track->cb_color_bo_offset[id] << 8;
|
||||
tmp = track->cb_color_bo_offset[id] << 8;
|
||||
for (nby = surf.nby; nby > min; nby--) {
|
||||
size = nby * surf.nbx * surf.bpe * surf.nsamples;
|
||||
if ((tmp + size * mslice) <= bsize) {
|
||||
|
@ -468,7 +468,7 @@ static int evergreen_cs_track_validate_cb(struct radeon_cs_parser *p, unsigned i
|
|||
slice = ((nby * surf.nbx) / 64) - 1;
|
||||
if (!evergreen_surface_check(p, &surf, "cb")) {
|
||||
/* check if this one works */
|
||||
tmp += (u64)surf.layer_size * mslice;
|
||||
tmp += surf.layer_size * mslice;
|
||||
if (tmp <= bsize) {
|
||||
ib[track->cb_color_slice_idx[id]] = slice;
|
||||
goto old_ddx_ok;
|
||||
|
@ -477,9 +477,9 @@ static int evergreen_cs_track_validate_cb(struct radeon_cs_parser *p, unsigned i
|
|||
}
|
||||
}
|
||||
dev_warn(p->dev, "%s:%d cb[%d] bo too small (layer size %d, "
|
||||
"offset %llu, max layer %d, bo size %ld, slice %d)\n",
|
||||
"offset %d, max layer %d, bo size %ld, slice %d)\n",
|
||||
__func__, __LINE__, id, surf.layer_size,
|
||||
(u64)track->cb_color_bo_offset[id] << 8, mslice,
|
||||
track->cb_color_bo_offset[id] << 8, mslice,
|
||||
radeon_bo_size(track->cb_color_bo[id]), slice);
|
||||
dev_warn(p->dev, "%s:%d problematic surf: (%d %d) (%d %d %d %d %d %d %d)\n",
|
||||
__func__, __LINE__, surf.nbx, surf.nby,
|
||||
|
@ -563,7 +563,7 @@ static int evergreen_cs_track_validate_stencil(struct radeon_cs_parser *p)
|
|||
struct evergreen_cs_track *track = p->track;
|
||||
struct eg_surface surf;
|
||||
unsigned pitch, slice, mslice;
|
||||
u64 offset;
|
||||
unsigned long offset;
|
||||
int r;
|
||||
|
||||
mslice = G_028008_SLICE_MAX(track->db_depth_view) + 1;
|
||||
|
@ -609,18 +609,18 @@ static int evergreen_cs_track_validate_stencil(struct radeon_cs_parser *p)
|
|||
return r;
|
||||
}
|
||||
|
||||
offset = (u64)track->db_s_read_offset << 8;
|
||||
offset = track->db_s_read_offset << 8;
|
||||
if (offset & (surf.base_align - 1)) {
|
||||
dev_warn(p->dev, "%s:%d stencil read bo base %llu not aligned with %ld\n",
|
||||
dev_warn(p->dev, "%s:%d stencil read bo base %ld not aligned with %ld\n",
|
||||
__func__, __LINE__, offset, surf.base_align);
|
||||
return -EINVAL;
|
||||
}
|
||||
offset += (u64)surf.layer_size * mslice;
|
||||
offset += surf.layer_size * mslice;
|
||||
if (offset > radeon_bo_size(track->db_s_read_bo)) {
|
||||
dev_warn(p->dev, "%s:%d stencil read bo too small (layer size %d, "
|
||||
"offset %llu, max layer %d, bo size %ld)\n",
|
||||
"offset %ld, max layer %d, bo size %ld)\n",
|
||||
__func__, __LINE__, surf.layer_size,
|
||||
(u64)track->db_s_read_offset << 8, mslice,
|
||||
(unsigned long)track->db_s_read_offset << 8, mslice,
|
||||
radeon_bo_size(track->db_s_read_bo));
|
||||
dev_warn(p->dev, "%s:%d stencil invalid (0x%08x 0x%08x 0x%08x 0x%08x)\n",
|
||||
__func__, __LINE__, track->db_depth_size,
|
||||
|
@ -628,18 +628,18 @@ static int evergreen_cs_track_validate_stencil(struct radeon_cs_parser *p)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
offset = (u64)track->db_s_write_offset << 8;
|
||||
offset = track->db_s_write_offset << 8;
|
||||
if (offset & (surf.base_align - 1)) {
|
||||
dev_warn(p->dev, "%s:%d stencil write bo base %llu not aligned with %ld\n",
|
||||
dev_warn(p->dev, "%s:%d stencil write bo base %ld not aligned with %ld\n",
|
||||
__func__, __LINE__, offset, surf.base_align);
|
||||
return -EINVAL;
|
||||
}
|
||||
offset += (u64)surf.layer_size * mslice;
|
||||
offset += surf.layer_size * mslice;
|
||||
if (offset > radeon_bo_size(track->db_s_write_bo)) {
|
||||
dev_warn(p->dev, "%s:%d stencil write bo too small (layer size %d, "
|
||||
"offset %llu, max layer %d, bo size %ld)\n",
|
||||
"offset %ld, max layer %d, bo size %ld)\n",
|
||||
__func__, __LINE__, surf.layer_size,
|
||||
(u64)track->db_s_write_offset << 8, mslice,
|
||||
(unsigned long)track->db_s_write_offset << 8, mslice,
|
||||
radeon_bo_size(track->db_s_write_bo));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -660,7 +660,7 @@ static int evergreen_cs_track_validate_depth(struct radeon_cs_parser *p)
|
|||
struct evergreen_cs_track *track = p->track;
|
||||
struct eg_surface surf;
|
||||
unsigned pitch, slice, mslice;
|
||||
u64 offset;
|
||||
unsigned long offset;
|
||||
int r;
|
||||
|
||||
mslice = G_028008_SLICE_MAX(track->db_depth_view) + 1;
|
||||
|
@ -707,34 +707,34 @@ static int evergreen_cs_track_validate_depth(struct radeon_cs_parser *p)
|
|||
return r;
|
||||
}
|
||||
|
||||
offset = (u64)track->db_z_read_offset << 8;
|
||||
offset = track->db_z_read_offset << 8;
|
||||
if (offset & (surf.base_align - 1)) {
|
||||
dev_warn(p->dev, "%s:%d stencil read bo base %llu not aligned with %ld\n",
|
||||
dev_warn(p->dev, "%s:%d stencil read bo base %ld not aligned with %ld\n",
|
||||
__func__, __LINE__, offset, surf.base_align);
|
||||
return -EINVAL;
|
||||
}
|
||||
offset += (u64)surf.layer_size * mslice;
|
||||
offset += surf.layer_size * mslice;
|
||||
if (offset > radeon_bo_size(track->db_z_read_bo)) {
|
||||
dev_warn(p->dev, "%s:%d depth read bo too small (layer size %d, "
|
||||
"offset %llu, max layer %d, bo size %ld)\n",
|
||||
"offset %ld, max layer %d, bo size %ld)\n",
|
||||
__func__, __LINE__, surf.layer_size,
|
||||
(u64)track->db_z_read_offset << 8, mslice,
|
||||
(unsigned long)track->db_z_read_offset << 8, mslice,
|
||||
radeon_bo_size(track->db_z_read_bo));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
offset = (u64)track->db_z_write_offset << 8;
|
||||
offset = track->db_z_write_offset << 8;
|
||||
if (offset & (surf.base_align - 1)) {
|
||||
dev_warn(p->dev, "%s:%d stencil write bo base %llu not aligned with %ld\n",
|
||||
dev_warn(p->dev, "%s:%d stencil write bo base %ld not aligned with %ld\n",
|
||||
__func__, __LINE__, offset, surf.base_align);
|
||||
return -EINVAL;
|
||||
}
|
||||
offset += (u64)surf.layer_size * mslice;
|
||||
offset += surf.layer_size * mslice;
|
||||
if (offset > radeon_bo_size(track->db_z_write_bo)) {
|
||||
dev_warn(p->dev, "%s:%d depth write bo too small (layer size %d, "
|
||||
"offset %llu, max layer %d, bo size %ld)\n",
|
||||
"offset %ld, max layer %d, bo size %ld)\n",
|
||||
__func__, __LINE__, surf.layer_size,
|
||||
(u64)track->db_z_write_offset << 8, mslice,
|
||||
(unsigned long)track->db_z_write_offset << 8, mslice,
|
||||
radeon_bo_size(track->db_z_write_bo));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue