aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/r100.c
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2010-06-12 13:31:11 -0400
committerDave Airlie <airlied@redhat.com>2010-06-30 21:59:24 -0400
commit37cf6b03f9f28c62dafb0b9ce5f1ba29c8baffa9 (patch)
treed2fa4e7498ea66e5ac62cf2a4f5fb419f5e9fa4f /drivers/gpu/drm/radeon/r100.c
parent688acaa2897462e4c5e2482496e2868db0760809 (diff)
drm/radeon/r100/r200: fix calculation of compressed cube maps
This needs similar handling to other compressed textures. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=26428 Signed-off-by: sroland@vmware.com Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Cc: stable <stable@kernel.org> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/r100.c')
-rw-r--r--drivers/gpu/drm/radeon/r100.c58
1 files changed, 31 insertions, 27 deletions
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index d524efd9a059..3970e62eaab8 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -3158,33 +3158,6 @@ static inline void r100_cs_track_texture_print(struct r100_cs_track_texture *t)
3158 DRM_ERROR("compress format %d\n", t->compress_format); 3158 DRM_ERROR("compress format %d\n", t->compress_format);
3159} 3159}
3160 3160
3161static int r100_cs_track_cube(struct radeon_device *rdev,
3162 struct r100_cs_track *track, unsigned idx)
3163{
3164 unsigned face, w, h;
3165 struct radeon_bo *cube_robj;
3166 unsigned long size;
3167
3168 for (face = 0; face < 5; face++) {
3169 cube_robj = track->textures[idx].cube_info[face].robj;
3170 w = track->textures[idx].cube_info[face].width;
3171 h = track->textures[idx].cube_info[face].height;
3172
3173 size = w * h;
3174 size *= track->textures[idx].cpp;
3175
3176 size += track->textures[idx].cube_info[face].offset;
3177
3178 if (size > radeon_bo_size(cube_robj)) {
3179 DRM_ERROR("Cube texture offset greater than object size %lu %lu\n",
3180 size, radeon_bo_size(cube_robj));
3181 r100_cs_track_texture_print(&track->textures[idx]);
3182 return -1;
3183 }
3184 }
3185 return 0;
3186}
3187
3188static int r100_track_compress_size(int compress_format, int w, int h) 3161static int r100_track_compress_size(int compress_format, int w, int h)
3189{ 3162{
3190 int block_width, block_height, block_bytes; 3163 int block_width, block_height, block_bytes;
@@ -3215,6 +3188,37 @@ static int r100_track_compress_size(int compress_format, int w, int h)
3215 return sz; 3188 return sz;
3216} 3189}
3217 3190
3191static int r100_cs_track_cube(struct radeon_device *rdev,
3192 struct r100_cs_track *track, unsigned idx)
3193{
3194 unsigned face, w, h;
3195 struct radeon_bo *cube_robj;
3196 unsigned long size;
3197 unsigned compress_format = track->textures[idx].compress_format;
3198
3199 for (face = 0; face < 5; face++) {
3200 cube_robj = track->textures[idx].cube_info[face].robj;
3201 w = track->textures[idx].cube_info[face].width;
3202 h = track->textures[idx].cube_info[face].height;
3203
3204 if (compress_format) {
3205 size = r100_track_compress_size(compress_format, w, h);
3206 } else
3207 size = w * h;
3208 size *= track->textures[idx].cpp;
3209
3210 size += track->textures[idx].cube_info[face].offset;
3211
3212 if (size > radeon_bo_size(cube_robj)) {
3213 DRM_ERROR("Cube texture offset greater than object size %lu %lu\n",
3214 size, radeon_bo_size(cube_robj));
3215 r100_cs_track_texture_print(&track->textures[idx]);
3216 return -1;
3217 }
3218 }
3219 return 0;
3220}
3221
3218static int r100_cs_track_texture_check(struct radeon_device *rdev, 3222static int r100_cs_track_texture_check(struct radeon_device *rdev,
3219 struct r100_cs_track *track) 3223 struct r100_cs_track *track)
3220{ 3224{