aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/atombios_crtc.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2014-06-05 06:28:59 -0400
committerDave Airlie <airlied@redhat.com>2014-06-05 06:28:59 -0400
commit8d4ad9d4bb0a618c975a32d77087694ec6336f68 (patch)
treed18d12688174a623e3503b11118e44ef8186c90b /drivers/gpu/drm/radeon/atombios_crtc.c
parent5ea1f752ae04be403a3dc8ec876a60d7f5f6990a (diff)
parent9e9a928eed8796a0a1aaed7e0b676db86ba84594 (diff)
Merge commit '9e9a928eed8796a0a1aaed7e0b676db86ba84594' into drm-next
Merge drm-fixes into drm-next. Both i915 and radeon need this done for later patches. Conflicts: drivers/gpu/drm/drm_crtc_helper.c drivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_gem.c drivers/gpu/drm/i915/i915_gem_execbuffer.c drivers/gpu/drm/i915/i915_gem_gtt.c
Diffstat (limited to 'drivers/gpu/drm/radeon/atombios_crtc.c')
-rw-r--r--drivers/gpu/drm/radeon/atombios_crtc.c60
1 files changed, 39 insertions, 21 deletions
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index 967d193d36d0..76c30f2da3fb 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -270,8 +270,6 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)
270 switch (mode) { 270 switch (mode) {
271 case DRM_MODE_DPMS_ON: 271 case DRM_MODE_DPMS_ON:
272 radeon_crtc->enabled = true; 272 radeon_crtc->enabled = true;
273 /* adjust pm to dpms changes BEFORE enabling crtcs */
274 radeon_pm_compute_clocks(rdev);
275 atombios_enable_crtc(crtc, ATOM_ENABLE); 273 atombios_enable_crtc(crtc, ATOM_ENABLE);
276 if (ASIC_IS_DCE3(rdev) && !ASIC_IS_DCE6(rdev)) 274 if (ASIC_IS_DCE3(rdev) && !ASIC_IS_DCE6(rdev))
277 atombios_enable_crtc_memreq(crtc, ATOM_ENABLE); 275 atombios_enable_crtc_memreq(crtc, ATOM_ENABLE);
@@ -289,10 +287,10 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)
289 atombios_enable_crtc_memreq(crtc, ATOM_DISABLE); 287 atombios_enable_crtc_memreq(crtc, ATOM_DISABLE);
290 atombios_enable_crtc(crtc, ATOM_DISABLE); 288 atombios_enable_crtc(crtc, ATOM_DISABLE);
291 radeon_crtc->enabled = false; 289 radeon_crtc->enabled = false;
292 /* adjust pm to dpms changes AFTER disabling crtcs */
293 radeon_pm_compute_clocks(rdev);
294 break; 290 break;
295 } 291 }
292 /* adjust pm to dpms */
293 radeon_pm_compute_clocks(rdev);
296} 294}
297 295
298static void 296static void
@@ -1208,27 +1206,43 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
1208 1206
1209 /* Set NUM_BANKS. */ 1207 /* Set NUM_BANKS. */
1210 if (rdev->family >= CHIP_TAHITI) { 1208 if (rdev->family >= CHIP_TAHITI) {
1211 unsigned tileb, index, num_banks, tile_split_bytes; 1209 unsigned index, num_banks;
1212 1210
1213 /* Calculate the macrotile mode index. */ 1211 if (rdev->family >= CHIP_BONAIRE) {
1214 tile_split_bytes = 64 << tile_split; 1212 unsigned tileb, tile_split_bytes;
1215 tileb = 8 * 8 * target_fb->bits_per_pixel / 8;
1216 tileb = min(tile_split_bytes, tileb);
1217 1213
1218 for (index = 0; tileb > 64; index++) { 1214 /* Calculate the macrotile mode index. */
1219 tileb >>= 1; 1215 tile_split_bytes = 64 << tile_split;
1220 } 1216 tileb = 8 * 8 * target_fb->bits_per_pixel / 8;
1217 tileb = min(tile_split_bytes, tileb);
1221 1218
1222 if (index >= 16) { 1219 for (index = 0; tileb > 64; index++)
1223 DRM_ERROR("Wrong screen bpp (%u) or tile split (%u)\n", 1220 tileb >>= 1;
1224 target_fb->bits_per_pixel, tile_split); 1221
1225 return -EINVAL; 1222 if (index >= 16) {
1226 } 1223 DRM_ERROR("Wrong screen bpp (%u) or tile split (%u)\n",
1224 target_fb->bits_per_pixel, tile_split);
1225 return -EINVAL;
1226 }
1227 1227
1228 if (rdev->family >= CHIP_BONAIRE)
1229 num_banks = (rdev->config.cik.macrotile_mode_array[index] >> 6) & 0x3; 1228 num_banks = (rdev->config.cik.macrotile_mode_array[index] >> 6) & 0x3;
1230 else 1229 } else {
1230 switch (target_fb->bits_per_pixel) {
1231 case 8:
1232 index = 10;
1233 break;
1234 case 16:
1235 index = SI_TILE_MODE_COLOR_2D_SCANOUT_16BPP;
1236 break;
1237 default:
1238 case 32:
1239 index = SI_TILE_MODE_COLOR_2D_SCANOUT_32BPP;
1240 break;
1241 }
1242
1231 num_banks = (rdev->config.si.tile_mode_array[index] >> 20) & 0x3; 1243 num_banks = (rdev->config.si.tile_mode_array[index] >> 20) & 0x3;
1244 }
1245
1232 fb_format |= EVERGREEN_GRPH_NUM_BANKS(num_banks); 1246 fb_format |= EVERGREEN_GRPH_NUM_BANKS(num_banks);
1233 } else { 1247 } else {
1234 /* NI and older. */ 1248 /* NI and older. */
@@ -1751,8 +1765,9 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc)
1751 } 1765 }
1752 /* otherwise, pick one of the plls */ 1766 /* otherwise, pick one of the plls */
1753 if ((rdev->family == CHIP_KAVERI) || 1767 if ((rdev->family == CHIP_KAVERI) ||
1754 (rdev->family == CHIP_KABINI)) { 1768 (rdev->family == CHIP_KABINI) ||
1755 /* KB/KV has PPLL1 and PPLL2 */ 1769 (rdev->family == CHIP_MULLINS)) {
1770 /* KB/KV/ML has PPLL1 and PPLL2 */
1756 pll_in_use = radeon_get_pll_use_mask(crtc); 1771 pll_in_use = radeon_get_pll_use_mask(crtc);
1757 if (!(pll_in_use & (1 << ATOM_PPLL2))) 1772 if (!(pll_in_use & (1 << ATOM_PPLL2)))
1758 return ATOM_PPLL2; 1773 return ATOM_PPLL2;
@@ -1916,6 +1931,9 @@ int atombios_crtc_mode_set(struct drm_crtc *crtc,
1916 (ATOM_DEVICE_TV_SUPPORT | ATOM_DEVICE_CV_SUPPORT)) 1931 (ATOM_DEVICE_TV_SUPPORT | ATOM_DEVICE_CV_SUPPORT))
1917 is_tvcv = true; 1932 is_tvcv = true;
1918 1933
1934 if (!radeon_crtc->adjusted_clock)
1935 return -EINVAL;
1936
1919 atombios_crtc_set_pll(crtc, adjusted_mode); 1937 atombios_crtc_set_pll(crtc, adjusted_mode);
1920 1938
1921 if (ASIC_IS_DCE4(rdev)) 1939 if (ASIC_IS_DCE4(rdev))