Commit b73c5f8b authored by Marek Olšák's avatar Marek Olšák Committed by Dave Airlie

drm/radeon/kms: fix calculation of mipmapped 3D texture sizes

The 3rd dimension should be minified too.
Signed-off-by: default avatarMarek Olšák <maraeo@gmail.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent ce227c41
...@@ -2890,7 +2890,7 @@ static int r100_cs_track_texture_check(struct radeon_device *rdev, ...@@ -2890,7 +2890,7 @@ static int r100_cs_track_texture_check(struct radeon_device *rdev,
{ {
struct radeon_bo *robj; struct radeon_bo *robj;
unsigned long size; unsigned long size;
unsigned u, i, w, h; unsigned u, i, w, h, d;
int ret; int ret;
for (u = 0; u < track->num_texture; u++) { for (u = 0; u < track->num_texture; u++) {
...@@ -2922,20 +2922,25 @@ static int r100_cs_track_texture_check(struct radeon_device *rdev, ...@@ -2922,20 +2922,25 @@ static int r100_cs_track_texture_check(struct radeon_device *rdev,
h = h / (1 << i); h = h / (1 << i);
if (track->textures[u].roundup_h) if (track->textures[u].roundup_h)
h = roundup_pow_of_two(h); h = roundup_pow_of_two(h);
if (track->textures[u].tex_coord_type == 1) {
d = (1 << track->textures[u].txdepth) / (1 << i);
if (!d)
d = 1;
} else {
d = 1;
}
if (track->textures[u].compress_format) { if (track->textures[u].compress_format) {
size += r100_track_compress_size(track->textures[u].compress_format, w, h); size += r100_track_compress_size(track->textures[u].compress_format, w, h) * d;
/* compressed textures are block based */ /* compressed textures are block based */
} else } else
size += w * h; size += w * h * d;
} }
size *= track->textures[u].cpp; size *= track->textures[u].cpp;
switch (track->textures[u].tex_coord_type) { switch (track->textures[u].tex_coord_type) {
case 0: case 0:
break;
case 1: case 1:
size *= (1 << track->textures[u].txdepth);
break; break;
case 2: case 2:
if (track->separate_cube) { if (track->separate_cube) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment