diff options
author | Marek Olšák <maraeo@gmail.com> | 2010-04-10 21:18:52 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-04-11 20:40:49 -0400 |
commit | b73c5f8b2f85a7041e045e0009d046780416948d (patch) | |
tree | b7290a5df4c819f26bd6f0b3302beb253c650fd0 /drivers/gpu | |
parent | ce227c4183a2c18c9e5467b7e92d47140e763ab9 (diff) |
drm/radeon/kms: fix calculation of mipmapped 3D texture sizes
The 3rd dimension should be minified too.
Signed-off-by: Marek Olšák <maraeo@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/radeon/r100.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 3ae51ada1abf..e40dbdc4ebb3 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -2890,7 +2890,7 @@ static int r100_cs_track_texture_check(struct radeon_device *rdev, | |||
2890 | { | 2890 | { |
2891 | struct radeon_bo *robj; | 2891 | struct radeon_bo *robj; |
2892 | unsigned long size; | 2892 | unsigned long size; |
2893 | unsigned u, i, w, h; | 2893 | unsigned u, i, w, h, d; |
2894 | int ret; | 2894 | int ret; |
2895 | 2895 | ||
2896 | for (u = 0; u < track->num_texture; u++) { | 2896 | for (u = 0; u < track->num_texture; u++) { |
@@ -2922,20 +2922,25 @@ static int r100_cs_track_texture_check(struct radeon_device *rdev, | |||
2922 | h = h / (1 << i); | 2922 | h = h / (1 << i); |
2923 | if (track->textures[u].roundup_h) | 2923 | if (track->textures[u].roundup_h) |
2924 | h = roundup_pow_of_two(h); | 2924 | h = roundup_pow_of_two(h); |
2925 | if (track->textures[u].tex_coord_type == 1) { | ||
2926 | d = (1 << track->textures[u].txdepth) / (1 << i); | ||
2927 | if (!d) | ||
2928 | d = 1; | ||
2929 | } else { | ||
2930 | d = 1; | ||
2931 | } | ||
2925 | if (track->textures[u].compress_format) { | 2932 | if (track->textures[u].compress_format) { |
2926 | 2933 | ||
2927 | size += r100_track_compress_size(track->textures[u].compress_format, w, h); | 2934 | size += r100_track_compress_size(track->textures[u].compress_format, w, h) * d; |
2928 | /* compressed textures are block based */ | 2935 | /* compressed textures are block based */ |
2929 | } else | 2936 | } else |
2930 | size += w * h; | 2937 | size += w * h * d; |
2931 | } | 2938 | } |
2932 | size *= track->textures[u].cpp; | 2939 | size *= track->textures[u].cpp; |
2933 | 2940 | ||
2934 | switch (track->textures[u].tex_coord_type) { | 2941 | switch (track->textures[u].tex_coord_type) { |
2935 | case 0: | 2942 | case 0: |
2936 | break; | ||
2937 | case 1: | 2943 | case 1: |
2938 | size *= (1 << track->textures[u].txdepth); | ||
2939 | break; | 2944 | break; |
2940 | case 2: | 2945 | case 2: |
2941 | if (track->separate_cube) { | 2946 | if (track->separate_cube) { |