diff options
| -rw-r--r-- | drivers/gpu/drm/radeon/atombios_crtc.c | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index fb187c78978f..229be38cc6ca 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
| @@ -1177,27 +1177,43 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
| 1177 | 1177 | ||
| 1178 | /* Set NUM_BANKS. */ | 1178 | /* Set NUM_BANKS. */ |
| 1179 | if (rdev->family >= CHIP_TAHITI) { | 1179 | if (rdev->family >= CHIP_TAHITI) { |
| 1180 | unsigned tileb, index, num_banks, tile_split_bytes; | 1180 | unsigned index, num_banks; |
| 1181 | 1181 | ||
| 1182 | /* Calculate the macrotile mode index. */ | 1182 | if (rdev->family >= CHIP_BONAIRE) { |
| 1183 | tile_split_bytes = 64 << tile_split; | 1183 | unsigned tileb, tile_split_bytes; |
| 1184 | tileb = 8 * 8 * target_fb->bits_per_pixel / 8; | ||
| 1185 | tileb = min(tile_split_bytes, tileb); | ||
| 1186 | 1184 | ||
| 1187 | for (index = 0; tileb > 64; index++) { | 1185 | /* Calculate the macrotile mode index. */ |
| 1188 | tileb >>= 1; | 1186 | tile_split_bytes = 64 << tile_split; |
| 1189 | } | 1187 | tileb = 8 * 8 * target_fb->bits_per_pixel / 8; |
| 1188 | tileb = min(tile_split_bytes, tileb); | ||
| 1190 | 1189 | ||
| 1191 | if (index >= 16) { | 1190 | for (index = 0; tileb > 64; index++) |
| 1192 | DRM_ERROR("Wrong screen bpp (%u) or tile split (%u)\n", | 1191 | tileb >>= 1; |
| 1193 | target_fb->bits_per_pixel, tile_split); | 1192 | |
| 1194 | return -EINVAL; | 1193 | if (index >= 16) { |
| 1195 | } | 1194 | DRM_ERROR("Wrong screen bpp (%u) or tile split (%u)\n", |
| 1195 | target_fb->bits_per_pixel, tile_split); | ||
| 1196 | return -EINVAL; | ||
| 1197 | } | ||
| 1196 | 1198 | ||
| 1197 | if (rdev->family >= CHIP_BONAIRE) | ||
| 1198 | num_banks = (rdev->config.cik.macrotile_mode_array[index] >> 6) & 0x3; | 1199 | num_banks = (rdev->config.cik.macrotile_mode_array[index] >> 6) & 0x3; |
| 1199 | else | 1200 | } else { |
| 1201 | switch (target_fb->bits_per_pixel) { | ||
| 1202 | case 8: | ||
| 1203 | index = 10; | ||
| 1204 | break; | ||
| 1205 | case 16: | ||
| 1206 | index = SI_TILE_MODE_COLOR_2D_SCANOUT_16BPP; | ||
| 1207 | break; | ||
| 1208 | default: | ||
| 1209 | case 32: | ||
| 1210 | index = SI_TILE_MODE_COLOR_2D_SCANOUT_32BPP; | ||
| 1211 | break; | ||
| 1212 | } | ||
| 1213 | |||
| 1200 | num_banks = (rdev->config.si.tile_mode_array[index] >> 20) & 0x3; | 1214 | num_banks = (rdev->config.si.tile_mode_array[index] >> 20) & 0x3; |
| 1215 | } | ||
| 1216 | |||
| 1201 | fb_format |= EVERGREEN_GRPH_NUM_BANKS(num_banks); | 1217 | fb_format |= EVERGREEN_GRPH_NUM_BANKS(num_banks); |
| 1202 | } else { | 1218 | } else { |
| 1203 | /* NI and older. */ | 1219 | /* NI and older. */ |
