diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/r100.c')
-rw-r--r-- | drivers/gpu/drm/radeon/r100.c | 81 |
1 files changed, 48 insertions, 33 deletions
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index cf89aa2eb28..3970e62eaab 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -1628,6 +1628,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p, | |||
1628 | case RADEON_TXFORMAT_RGB332: | 1628 | case RADEON_TXFORMAT_RGB332: |
1629 | case RADEON_TXFORMAT_Y8: | 1629 | case RADEON_TXFORMAT_Y8: |
1630 | track->textures[i].cpp = 1; | 1630 | track->textures[i].cpp = 1; |
1631 | track->textures[i].compress_format = R100_TRACK_COMP_NONE; | ||
1631 | break; | 1632 | break; |
1632 | case RADEON_TXFORMAT_AI88: | 1633 | case RADEON_TXFORMAT_AI88: |
1633 | case RADEON_TXFORMAT_ARGB1555: | 1634 | case RADEON_TXFORMAT_ARGB1555: |
@@ -1639,12 +1640,14 @@ static int r100_packet0_check(struct radeon_cs_parser *p, | |||
1639 | case RADEON_TXFORMAT_LDUDV655: | 1640 | case RADEON_TXFORMAT_LDUDV655: |
1640 | case RADEON_TXFORMAT_DUDV88: | 1641 | case RADEON_TXFORMAT_DUDV88: |
1641 | track->textures[i].cpp = 2; | 1642 | track->textures[i].cpp = 2; |
1643 | track->textures[i].compress_format = R100_TRACK_COMP_NONE; | ||
1642 | break; | 1644 | break; |
1643 | case RADEON_TXFORMAT_ARGB8888: | 1645 | case RADEON_TXFORMAT_ARGB8888: |
1644 | case RADEON_TXFORMAT_RGBA8888: | 1646 | case RADEON_TXFORMAT_RGBA8888: |
1645 | case RADEON_TXFORMAT_SHADOW32: | 1647 | case RADEON_TXFORMAT_SHADOW32: |
1646 | case RADEON_TXFORMAT_LDUDUV8888: | 1648 | case RADEON_TXFORMAT_LDUDUV8888: |
1647 | track->textures[i].cpp = 4; | 1649 | track->textures[i].cpp = 4; |
1650 | track->textures[i].compress_format = R100_TRACK_COMP_NONE; | ||
1648 | break; | 1651 | break; |
1649 | case RADEON_TXFORMAT_DXT1: | 1652 | case RADEON_TXFORMAT_DXT1: |
1650 | track->textures[i].cpp = 1; | 1653 | track->textures[i].cpp = 1; |
@@ -2604,12 +2607,6 @@ int r100_set_surface_reg(struct radeon_device *rdev, int reg, | |||
2604 | int surf_index = reg * 16; | 2607 | int surf_index = reg * 16; |
2605 | int flags = 0; | 2608 | int flags = 0; |
2606 | 2609 | ||
2607 | /* r100/r200 divide by 16 */ | ||
2608 | if (rdev->family < CHIP_R300) | ||
2609 | flags = pitch / 16; | ||
2610 | else | ||
2611 | flags = pitch / 8; | ||
2612 | |||
2613 | if (rdev->family <= CHIP_RS200) { | 2610 | if (rdev->family <= CHIP_RS200) { |
2614 | if ((tiling_flags & (RADEON_TILING_MACRO|RADEON_TILING_MICRO)) | 2611 | if ((tiling_flags & (RADEON_TILING_MACRO|RADEON_TILING_MICRO)) |
2615 | == (RADEON_TILING_MACRO|RADEON_TILING_MICRO)) | 2612 | == (RADEON_TILING_MACRO|RADEON_TILING_MICRO)) |
@@ -2633,6 +2630,20 @@ int r100_set_surface_reg(struct radeon_device *rdev, int reg, | |||
2633 | if (tiling_flags & RADEON_TILING_SWAP_32BIT) | 2630 | if (tiling_flags & RADEON_TILING_SWAP_32BIT) |
2634 | flags |= RADEON_SURF_AP0_SWP_32BPP | RADEON_SURF_AP1_SWP_32BPP; | 2631 | flags |= RADEON_SURF_AP0_SWP_32BPP | RADEON_SURF_AP1_SWP_32BPP; |
2635 | 2632 | ||
2633 | /* when we aren't tiling the pitch seems to needs to be furtherdivided down. - tested on power5 + rn50 server */ | ||
2634 | if (tiling_flags & (RADEON_TILING_SWAP_16BIT | RADEON_TILING_SWAP_32BIT)) { | ||
2635 | if (!(tiling_flags & (RADEON_TILING_MACRO | RADEON_TILING_MICRO))) | ||
2636 | if (ASIC_IS_RN50(rdev)) | ||
2637 | pitch /= 16; | ||
2638 | } | ||
2639 | |||
2640 | /* r100/r200 divide by 16 */ | ||
2641 | if (rdev->family < CHIP_R300) | ||
2642 | flags |= pitch / 16; | ||
2643 | else | ||
2644 | flags |= pitch / 8; | ||
2645 | |||
2646 | |||
2636 | DRM_DEBUG("writing surface %d %d %x %x\n", reg, flags, offset, offset+obj_size-1); | 2647 | DRM_DEBUG("writing surface %d %d %x %x\n", reg, flags, offset, offset+obj_size-1); |
2637 | WREG32(RADEON_SURFACE0_INFO + surf_index, flags); | 2648 | WREG32(RADEON_SURFACE0_INFO + surf_index, flags); |
2638 | WREG32(RADEON_SURFACE0_LOWER_BOUND + surf_index, offset); | 2649 | WREG32(RADEON_SURFACE0_LOWER_BOUND + surf_index, offset); |
@@ -3147,33 +3158,6 @@ static inline void r100_cs_track_texture_print(struct r100_cs_track_texture *t) | |||
3147 | DRM_ERROR("compress format %d\n", t->compress_format); | 3158 | DRM_ERROR("compress format %d\n", t->compress_format); |
3148 | } | 3159 | } |
3149 | 3160 | ||
3150 | static int r100_cs_track_cube(struct radeon_device *rdev, | ||
3151 | struct r100_cs_track *track, unsigned idx) | ||
3152 | { | ||
3153 | unsigned face, w, h; | ||
3154 | struct radeon_bo *cube_robj; | ||
3155 | unsigned long size; | ||
3156 | |||
3157 | for (face = 0; face < 5; face++) { | ||
3158 | cube_robj = track->textures[idx].cube_info[face].robj; | ||
3159 | w = track->textures[idx].cube_info[face].width; | ||
3160 | h = track->textures[idx].cube_info[face].height; | ||
3161 | |||
3162 | size = w * h; | ||
3163 | size *= track->textures[idx].cpp; | ||
3164 | |||
3165 | size += track->textures[idx].cube_info[face].offset; | ||
3166 | |||
3167 | if (size > radeon_bo_size(cube_robj)) { | ||
3168 | DRM_ERROR("Cube texture offset greater than object size %lu %lu\n", | ||
3169 | size, radeon_bo_size(cube_robj)); | ||
3170 | r100_cs_track_texture_print(&track->textures[idx]); | ||
3171 | return -1; | ||
3172 | } | ||
3173 | } | ||
3174 | return 0; | ||
3175 | } | ||
3176 | |||
3177 | static int r100_track_compress_size(int compress_format, int w, int h) | 3161 | static int r100_track_compress_size(int compress_format, int w, int h) |
3178 | { | 3162 | { |
3179 | int block_width, block_height, block_bytes; | 3163 | int block_width, block_height, block_bytes; |
@@ -3204,6 +3188,37 @@ static int r100_track_compress_size(int compress_format, int w, int h) | |||
3204 | return sz; | 3188 | return sz; |
3205 | } | 3189 | } |
3206 | 3190 | ||
3191 | static 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 | |||
3207 | static int r100_cs_track_texture_check(struct radeon_device *rdev, | 3222 | static int r100_cs_track_texture_check(struct radeon_device *rdev, |
3208 | struct r100_cs_track *track) | 3223 | struct r100_cs_track *track) |
3209 | { | 3224 | { |