aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c3
-rw-r--r--drivers/gpu/drm/i915/intel_fb.c4
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_fbcon.c1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_notifier.c1
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c5
-rw-r--r--drivers/gpu/drm/radeon/r100.c3
-rw-r--r--drivers/gpu/drm/radeon/r600.c4
-rw-r--r--drivers/gpu/drm/radeon/r600_blit_kms.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon.h1
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c18
-rw-r--r--drivers/gpu/drm/radeon/radeon_combios.c26
-rw-r--r--drivers/gpu/drm/radeon/radeon_cursor.c28
-rw-r--r--drivers/gpu/drm/radeon/radeon_fb.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.h5
-rw-r--r--drivers/gpu/drm/radeon/rs600.c1
-rw-r--r--drivers/gpu/drm/radeon/rs690.c1
-rw-r--r--drivers/gpu/drm/radeon/rv770.c2
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c79
19 files changed, 127 insertions, 60 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 726c3736082..251987307eb 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -2063,6 +2063,9 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
2063 dev_priv->mchdev_lock = &mchdev_lock; 2063 dev_priv->mchdev_lock = &mchdev_lock;
2064 spin_unlock(&mchdev_lock); 2064 spin_unlock(&mchdev_lock);
2065 2065
2066 /* XXX Prevent module unload due to memory corruption bugs. */
2067 __module_get(THIS_MODULE);
2068
2066 return 0; 2069 return 0;
2067 2070
2068out_workqueue_free: 2071out_workqueue_free:
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index b937ccfa7be..521622b9be7 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -225,8 +225,8 @@ static void intel_fbdev_destroy(struct drm_device *dev,
225 225
226 drm_framebuffer_cleanup(&ifb->base); 226 drm_framebuffer_cleanup(&ifb->base);
227 if (ifb->obj) { 227 if (ifb->obj) {
228 drm_gem_object_handle_unreference_unlocked(ifb->obj); 228 drm_gem_object_unreference(ifb->obj);
229 drm_gem_object_unreference_unlocked(ifb->obj); 229 ifb->obj = NULL;
230 } 230 }
231} 231}
232 232
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
index c5afd146aeb..02a4d1fd484 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
@@ -358,7 +358,6 @@ nouveau_fbcon_destroy(struct drm_device *dev, struct nouveau_fbdev *nfbdev)
358 358
359 if (nouveau_fb->nvbo) { 359 if (nouveau_fb->nvbo) {
360 nouveau_bo_unmap(nouveau_fb->nvbo); 360 nouveau_bo_unmap(nouveau_fb->nvbo);
361 drm_gem_object_handle_unreference_unlocked(nouveau_fb->nvbo->gem);
362 drm_gem_object_unreference_unlocked(nouveau_fb->nvbo->gem); 361 drm_gem_object_unreference_unlocked(nouveau_fb->nvbo->gem);
363 nouveau_fb->nvbo = NULL; 362 nouveau_fb->nvbo = NULL;
364 } 363 }
diff --git a/drivers/gpu/drm/nouveau/nouveau_notifier.c b/drivers/gpu/drm/nouveau/nouveau_notifier.c
index d670839cb34..2cc59f8c658 100644
--- a/drivers/gpu/drm/nouveau/nouveau_notifier.c
+++ b/drivers/gpu/drm/nouveau/nouveau_notifier.c
@@ -80,7 +80,6 @@ nouveau_notifier_takedown_channel(struct nouveau_channel *chan)
80 mutex_lock(&dev->struct_mutex); 80 mutex_lock(&dev->struct_mutex);
81 nouveau_bo_unpin(chan->notifier_bo); 81 nouveau_bo_unpin(chan->notifier_bo);
82 mutex_unlock(&dev->struct_mutex); 82 mutex_unlock(&dev->struct_mutex);
83 drm_gem_object_handle_unreference_unlocked(chan->notifier_bo->gem);
84 drm_gem_object_unreference_unlocked(chan->notifier_bo->gem); 83 drm_gem_object_unreference_unlocked(chan->notifier_bo->gem);
85 drm_mm_takedown(&chan->notifier_heap); 84 drm_mm_takedown(&chan->notifier_heap);
86} 85}
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index aee61ae2440..77ebcbc1b6e 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -1148,7 +1148,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev)
1148 1148
1149 WREG32(RCU_IND_INDEX, 0x203); 1149 WREG32(RCU_IND_INDEX, 0x203);
1150 efuse_straps_3 = RREG32(RCU_IND_DATA); 1150 efuse_straps_3 = RREG32(RCU_IND_DATA);
1151 efuse_box_bit_127_124 = (u8)(efuse_straps_3 & 0xF0000000) >> 28; 1151 efuse_box_bit_127_124 = (u8)((efuse_straps_3 & 0xF0000000) >> 28);
1152 1152
1153 switch(efuse_box_bit_127_124) { 1153 switch(efuse_box_bit_127_124) {
1154 case 0x0: 1154 case 0x0:
@@ -1418,6 +1418,7 @@ int evergreen_mc_init(struct radeon_device *rdev)
1418 rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; 1418 rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024;
1419 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; 1419 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024;
1420 rdev->mc.visible_vram_size = rdev->mc.aper_size; 1420 rdev->mc.visible_vram_size = rdev->mc.aper_size;
1421 rdev->mc.active_vram_size = rdev->mc.visible_vram_size;
1421 r600_vram_gtt_location(rdev, &rdev->mc); 1422 r600_vram_gtt_location(rdev, &rdev->mc);
1422 radeon_update_bandwidth_info(rdev); 1423 radeon_update_bandwidth_info(rdev);
1423 1424
@@ -1531,7 +1532,7 @@ void evergreen_disable_interrupt_state(struct radeon_device *rdev)
1531{ 1532{
1532 u32 tmp; 1533 u32 tmp;
1533 1534
1534 WREG32(CP_INT_CNTL, 0); 1535 WREG32(CP_INT_CNTL, CNTX_BUSY_INT_ENABLE | CNTX_EMPTY_INT_ENABLE);
1535 WREG32(GRBM_INT_CNTL, 0); 1536 WREG32(GRBM_INT_CNTL, 0);
1536 WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0); 1537 WREG32(INT_MASK + EVERGREEN_CRTC0_REGISTER_OFFSET, 0);
1537 WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0); 1538 WREG32(INT_MASK + EVERGREEN_CRTC1_REGISTER_OFFSET, 0);
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 7712c055b3e..6112ac99ccd 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -981,6 +981,7 @@ int r100_cp_init(struct radeon_device *rdev, unsigned ring_size)
981 return r; 981 return r;
982 } 982 }
983 rdev->cp.ready = true; 983 rdev->cp.ready = true;
984 rdev->mc.active_vram_size = rdev->mc.real_vram_size;
984 return 0; 985 return 0;
985} 986}
986 987
@@ -998,6 +999,7 @@ void r100_cp_fini(struct radeon_device *rdev)
998void r100_cp_disable(struct radeon_device *rdev) 999void r100_cp_disable(struct radeon_device *rdev)
999{ 1000{
1000 /* Disable ring */ 1001 /* Disable ring */
1002 rdev->mc.active_vram_size = rdev->mc.visible_vram_size;
1001 rdev->cp.ready = false; 1003 rdev->cp.ready = false;
1002 WREG32(RADEON_CP_CSQ_MODE, 0); 1004 WREG32(RADEON_CP_CSQ_MODE, 0);
1003 WREG32(RADEON_CP_CSQ_CNTL, 0); 1005 WREG32(RADEON_CP_CSQ_CNTL, 0);
@@ -2247,6 +2249,7 @@ void r100_vram_init_sizes(struct radeon_device *rdev)
2247 /* FIXME we don't use the second aperture yet when we could use it */ 2249 /* FIXME we don't use the second aperture yet when we could use it */
2248 if (rdev->mc.visible_vram_size > rdev->mc.aper_size) 2250 if (rdev->mc.visible_vram_size > rdev->mc.aper_size)
2249 rdev->mc.visible_vram_size = rdev->mc.aper_size; 2251 rdev->mc.visible_vram_size = rdev->mc.aper_size;
2252 rdev->mc.active_vram_size = rdev->mc.visible_vram_size;
2250 config_aper_size = RREG32(RADEON_CONFIG_APER_SIZE); 2253 config_aper_size = RREG32(RADEON_CONFIG_APER_SIZE);
2251 if (rdev->flags & RADEON_IS_IGP) { 2254 if (rdev->flags & RADEON_IS_IGP) {
2252 uint32_t tom; 2255 uint32_t tom;
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 7c5f855a43e..83ba9644dcb 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1248,6 +1248,7 @@ int r600_mc_init(struct radeon_device *rdev)
1248 rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE); 1248 rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE);
1249 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); 1249 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE);
1250 rdev->mc.visible_vram_size = rdev->mc.aper_size; 1250 rdev->mc.visible_vram_size = rdev->mc.aper_size;
1251 rdev->mc.active_vram_size = rdev->mc.visible_vram_size;
1251 r600_vram_gtt_location(rdev, &rdev->mc); 1252 r600_vram_gtt_location(rdev, &rdev->mc);
1252 1253
1253 if (rdev->flags & RADEON_IS_IGP) { 1254 if (rdev->flags & RADEON_IS_IGP) {
@@ -1917,6 +1918,7 @@ void r600_pciep_wreg(struct radeon_device *rdev, u32 reg, u32 v)
1917 */ 1918 */
1918void r600_cp_stop(struct radeon_device *rdev) 1919void r600_cp_stop(struct radeon_device *rdev)
1919{ 1920{
1921 rdev->mc.active_vram_size = rdev->mc.visible_vram_size;
1920 WREG32(R_0086D8_CP_ME_CNTL, S_0086D8_CP_ME_HALT(1)); 1922 WREG32(R_0086D8_CP_ME_CNTL, S_0086D8_CP_ME_HALT(1));
1921 WREG32(SCRATCH_UMSK, 0); 1923 WREG32(SCRATCH_UMSK, 0);
1922} 1924}
@@ -2861,7 +2863,7 @@ static void r600_disable_interrupt_state(struct radeon_device *rdev)
2861{ 2863{
2862 u32 tmp; 2864 u32 tmp;
2863 2865
2864 WREG32(CP_INT_CNTL, 0); 2866 WREG32(CP_INT_CNTL, CNTX_BUSY_INT_ENABLE | CNTX_EMPTY_INT_ENABLE);
2865 WREG32(GRBM_INT_CNTL, 0); 2867 WREG32(GRBM_INT_CNTL, 0);
2866 WREG32(DxMODE_INT_MASK, 0); 2868 WREG32(DxMODE_INT_MASK, 0);
2867 if (ASIC_IS_DCE3(rdev)) { 2869 if (ASIC_IS_DCE3(rdev)) {
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c
index 39d566dbabf..8362974ef41 100644
--- a/drivers/gpu/drm/radeon/r600_blit_kms.c
+++ b/drivers/gpu/drm/radeon/r600_blit_kms.c
@@ -545,6 +545,7 @@ done:
545 dev_err(rdev->dev, "(%d) pin blit object failed\n", r); 545 dev_err(rdev->dev, "(%d) pin blit object failed\n", r);
546 return r; 546 return r;
547 } 547 }
548 rdev->mc.active_vram_size = rdev->mc.real_vram_size;
548 return 0; 549 return 0;
549} 550}
550 551
@@ -552,6 +553,7 @@ void r600_blit_fini(struct radeon_device *rdev)
552{ 553{
553 int r; 554 int r;
554 555
556 rdev->mc.active_vram_size = rdev->mc.visible_vram_size;
555 if (rdev->r600_blit.shader_obj == NULL) 557 if (rdev->r600_blit.shader_obj == NULL)
556 return; 558 return;
557 /* If we can't reserve the bo, unref should be enough to destroy 559 /* If we can't reserve the bo, unref should be enough to destroy
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 2edd52ece22..73f600d39ad 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -343,6 +343,7 @@ struct radeon_mc {
343 * about vram size near mc fb location */ 343 * about vram size near mc fb location */
344 u64 mc_vram_size; 344 u64 mc_vram_size;
345 u64 visible_vram_size; 345 u64 visible_vram_size;
346 u64 active_vram_size;
346 u64 gtt_size; 347 u64 gtt_size;
347 u64 gtt_start; 348 u64 gtt_start;
348 u64 gtt_end; 349 u64 gtt_end;
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index 2b44cbcb031..04cac7ec903 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -1613,39 +1613,39 @@ radeon_atombios_get_tv_info(struct radeon_device *rdev)
1613 switch (tv_info->ucTV_BootUpDefaultStandard) { 1613 switch (tv_info->ucTV_BootUpDefaultStandard) {
1614 case ATOM_TV_NTSC: 1614 case ATOM_TV_NTSC:
1615 tv_std = TV_STD_NTSC; 1615 tv_std = TV_STD_NTSC;
1616 DRM_INFO("Default TV standard: NTSC\n"); 1616 DRM_DEBUG_KMS("Default TV standard: NTSC\n");
1617 break; 1617 break;
1618 case ATOM_TV_NTSCJ: 1618 case ATOM_TV_NTSCJ:
1619 tv_std = TV_STD_NTSC_J; 1619 tv_std = TV_STD_NTSC_J;
1620 DRM_INFO("Default TV standard: NTSC-J\n"); 1620 DRM_DEBUG_KMS("Default TV standard: NTSC-J\n");
1621 break; 1621 break;
1622 case ATOM_TV_PAL: 1622 case ATOM_TV_PAL:
1623 tv_std = TV_STD_PAL; 1623 tv_std = TV_STD_PAL;
1624 DRM_INFO("Default TV standard: PAL\n"); 1624 DRM_DEBUG_KMS("Default TV standard: PAL\n");
1625 break; 1625 break;
1626 case ATOM_TV_PALM: 1626 case ATOM_TV_PALM:
1627 tv_std = TV_STD_PAL_M; 1627 tv_std = TV_STD_PAL_M;
1628 DRM_INFO("Default TV standard: PAL-M\n"); 1628 DRM_DEBUG_KMS("Default TV standard: PAL-M\n");
1629 break; 1629 break;
1630 case ATOM_TV_PALN: 1630 case ATOM_TV_PALN:
1631 tv_std = TV_STD_PAL_N; 1631 tv_std = TV_STD_PAL_N;
1632 DRM_INFO("Default TV standard: PAL-N\n"); 1632 DRM_DEBUG_KMS("Default TV standard: PAL-N\n");
1633 break; 1633 break;
1634 case ATOM_TV_PALCN: 1634 case ATOM_TV_PALCN:
1635 tv_std = TV_STD_PAL_CN; 1635 tv_std = TV_STD_PAL_CN;
1636 DRM_INFO("Default TV standard: PAL-CN\n"); 1636 DRM_DEBUG_KMS("Default TV standard: PAL-CN\n");
1637 break; 1637 break;
1638 case ATOM_TV_PAL60: 1638 case ATOM_TV_PAL60:
1639 tv_std = TV_STD_PAL_60; 1639 tv_std = TV_STD_PAL_60;
1640 DRM_INFO("Default TV standard: PAL-60\n"); 1640 DRM_DEBUG_KMS("Default TV standard: PAL-60\n");
1641 break; 1641 break;
1642 case ATOM_TV_SECAM: 1642 case ATOM_TV_SECAM:
1643 tv_std = TV_STD_SECAM; 1643 tv_std = TV_STD_SECAM;
1644 DRM_INFO("Default TV standard: SECAM\n"); 1644 DRM_DEBUG_KMS("Default TV standard: SECAM\n");
1645 break; 1645 break;
1646 default: 1646 default:
1647 tv_std = TV_STD_NTSC; 1647 tv_std = TV_STD_NTSC;
1648 DRM_INFO("Unknown TV standard; defaulting to NTSC\n"); 1648 DRM_DEBUG_KMS("Unknown TV standard; defaulting to NTSC\n");
1649 break; 1649 break;
1650 } 1650 }
1651 } 1651 }
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index a04b7a6ad95..7b7ea269549 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -913,47 +913,47 @@ radeon_combios_get_tv_info(struct radeon_device *rdev)
913 switch (RBIOS8(tv_info + 7) & 0xf) { 913 switch (RBIOS8(tv_info + 7) & 0xf) {
914 case 1: 914 case 1:
915 tv_std = TV_STD_NTSC; 915 tv_std = TV_STD_NTSC;
916 DRM_INFO("Default TV standard: NTSC\n"); 916 DRM_DEBUG_KMS("Default TV standard: NTSC\n");
917 break; 917 break;
918 case 2: 918 case 2:
919 tv_std = TV_STD_PAL; 919 tv_std = TV_STD_PAL;
920 DRM_INFO("Default TV standard: PAL\n"); 920 DRM_DEBUG_KMS("Default TV standard: PAL\n");
921 break; 921 break;
922 case 3: 922 case 3:
923 tv_std = TV_STD_PAL_M; 923 tv_std = TV_STD_PAL_M;
924 DRM_INFO("Default TV standard: PAL-M\n"); 924 DRM_DEBUG_KMS("Default TV standard: PAL-M\n");
925 break; 925 break;
926 case 4: 926 case 4:
927 tv_std = TV_STD_PAL_60; 927 tv_std = TV_STD_PAL_60;
928 DRM_INFO("Default TV standard: PAL-60\n"); 928 DRM_DEBUG_KMS("Default TV standard: PAL-60\n");
929 break; 929 break;
930 case 5: 930 case 5:
931 tv_std = TV_STD_NTSC_J; 931 tv_std = TV_STD_NTSC_J;
932 DRM_INFO("Default TV standard: NTSC-J\n"); 932 DRM_DEBUG_KMS("Default TV standard: NTSC-J\n");
933 break; 933 break;
934 case 6: 934 case 6:
935 tv_std = TV_STD_SCART_PAL; 935 tv_std = TV_STD_SCART_PAL;
936 DRM_INFO("Default TV standard: SCART-PAL\n"); 936 DRM_DEBUG_KMS("Default TV standard: SCART-PAL\n");
937 break; 937 break;
938 default: 938 default:
939 tv_std = TV_STD_NTSC; 939 tv_std = TV_STD_NTSC;
940 DRM_INFO 940 DRM_DEBUG_KMS
941 ("Unknown TV standard; defaulting to NTSC\n"); 941 ("Unknown TV standard; defaulting to NTSC\n");
942 break; 942 break;
943 } 943 }
944 944
945 switch ((RBIOS8(tv_info + 9) >> 2) & 0x3) { 945 switch ((RBIOS8(tv_info + 9) >> 2) & 0x3) {
946 case 0: 946 case 0:
947 DRM_INFO("29.498928713 MHz TV ref clk\n"); 947 DRM_DEBUG_KMS("29.498928713 MHz TV ref clk\n");
948 break; 948 break;
949 case 1: 949 case 1:
950 DRM_INFO("28.636360000 MHz TV ref clk\n"); 950 DRM_DEBUG_KMS("28.636360000 MHz TV ref clk\n");
951 break; 951 break;
952 case 2: 952 case 2:
953 DRM_INFO("14.318180000 MHz TV ref clk\n"); 953 DRM_DEBUG_KMS("14.318180000 MHz TV ref clk\n");
954 break; 954 break;
955 case 3: 955 case 3:
956 DRM_INFO("27.000000000 MHz TV ref clk\n"); 956 DRM_DEBUG_KMS("27.000000000 MHz TV ref clk\n");
957 break; 957 break;
958 default: 958 default:
959 break; 959 break;
@@ -1324,7 +1324,7 @@ bool radeon_legacy_get_tmds_info_from_combios(struct radeon_encoder *encoder,
1324 1324
1325 if (tmds_info) { 1325 if (tmds_info) {
1326 ver = RBIOS8(tmds_info); 1326 ver = RBIOS8(tmds_info);
1327 DRM_INFO("DFP table revision: %d\n", ver); 1327 DRM_DEBUG_KMS("DFP table revision: %d\n", ver);
1328 if (ver == 3) { 1328 if (ver == 3) {
1329 n = RBIOS8(tmds_info + 5) + 1; 1329 n = RBIOS8(tmds_info + 5) + 1;
1330 if (n > 4) 1330 if (n > 4)
@@ -1408,7 +1408,7 @@ bool radeon_legacy_get_ext_tmds_info_from_combios(struct radeon_encoder *encoder
1408 offset = combios_get_table_offset(dev, COMBIOS_EXT_TMDS_INFO_TABLE); 1408 offset = combios_get_table_offset(dev, COMBIOS_EXT_TMDS_INFO_TABLE);
1409 if (offset) { 1409 if (offset) {
1410 ver = RBIOS8(offset); 1410 ver = RBIOS8(offset);
1411 DRM_INFO("External TMDS Table revision: %d\n", ver); 1411 DRM_DEBUG_KMS("External TMDS Table revision: %d\n", ver);
1412 tmds->slave_addr = RBIOS8(offset + 4 + 2); 1412 tmds->slave_addr = RBIOS8(offset + 4 + 2);
1413 tmds->slave_addr >>= 1; /* 7 bit addressing */ 1413 tmds->slave_addr >>= 1; /* 7 bit addressing */
1414 gpio = RBIOS8(offset + 4 + 3); 1414 gpio = RBIOS8(offset + 4 + 3);
diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c
index 4a8102512db..017ac54920f 100644
--- a/drivers/gpu/drm/radeon/radeon_cursor.c
+++ b/drivers/gpu/drm/radeon/radeon_cursor.c
@@ -206,6 +206,7 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc,
206 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); 206 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
207 struct radeon_device *rdev = crtc->dev->dev_private; 207 struct radeon_device *rdev = crtc->dev->dev_private;
208 int xorigin = 0, yorigin = 0; 208 int xorigin = 0, yorigin = 0;
209 int w = radeon_crtc->cursor_width;
209 210
210 if (x < 0) 211 if (x < 0)
211 xorigin = -x + 1; 212 xorigin = -x + 1;
@@ -216,22 +217,7 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc,
216 if (yorigin >= CURSOR_HEIGHT) 217 if (yorigin >= CURSOR_HEIGHT)
217 yorigin = CURSOR_HEIGHT - 1; 218 yorigin = CURSOR_HEIGHT - 1;
218 219
219 radeon_lock_cursor(crtc, true); 220 if (ASIC_IS_AVIVO(rdev)) {
220 if (ASIC_IS_DCE4(rdev)) {
221 /* cursors are offset into the total surface */
222 x += crtc->x;
223 y += crtc->y;
224 DRM_DEBUG("x %d y %d c->x %d c->y %d\n", x, y, crtc->x, crtc->y);
225
226 /* XXX: check if evergreen has the same issues as avivo chips */
227 WREG32(EVERGREEN_CUR_POSITION + radeon_crtc->crtc_offset,
228 ((xorigin ? 0 : x) << 16) |
229 (yorigin ? 0 : y));
230 WREG32(EVERGREEN_CUR_HOT_SPOT + radeon_crtc->crtc_offset, (xorigin << 16) | yorigin);
231 WREG32(EVERGREEN_CUR_SIZE + radeon_crtc->crtc_offset,
232 ((radeon_crtc->cursor_width - 1) << 16) | (radeon_crtc->cursor_height - 1));
233 } else if (ASIC_IS_AVIVO(rdev)) {
234 int w = radeon_crtc->cursor_width;
235 int i = 0; 221 int i = 0;
236 struct drm_crtc *crtc_p; 222 struct drm_crtc *crtc_p;
237 223
@@ -263,7 +249,17 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc,
263 if (w <= 0) 249 if (w <= 0)
264 w = 1; 250 w = 1;
265 } 251 }
252 }
266 253
254 radeon_lock_cursor(crtc, true);
255 if (ASIC_IS_DCE4(rdev)) {
256 WREG32(EVERGREEN_CUR_POSITION + radeon_crtc->crtc_offset,
257 ((xorigin ? 0 : x) << 16) |
258 (yorigin ? 0 : y));
259 WREG32(EVERGREEN_CUR_HOT_SPOT + radeon_crtc->crtc_offset, (xorigin << 16) | yorigin);
260 WREG32(EVERGREEN_CUR_SIZE + radeon_crtc->crtc_offset,
261 ((w - 1) << 16) | (radeon_crtc->cursor_height - 1));
262 } else if (ASIC_IS_AVIVO(rdev)) {
267 WREG32(AVIVO_D1CUR_POSITION + radeon_crtc->crtc_offset, 263 WREG32(AVIVO_D1CUR_POSITION + radeon_crtc->crtc_offset,
268 ((xorigin ? 0 : x) << 16) | 264 ((xorigin ? 0 : x) << 16) |
269 (yorigin ? 0 : y)); 265 (yorigin ? 0 : y));
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c
index bc61c5adb56..efa211898fe 100644
--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -99,7 +99,6 @@ static void radeonfb_destroy_pinned_object(struct drm_gem_object *gobj)
99 radeon_bo_unpin(rbo); 99 radeon_bo_unpin(rbo);
100 radeon_bo_unreserve(rbo); 100 radeon_bo_unreserve(rbo);
101 } 101 }
102 drm_gem_object_handle_unreference(gobj);
103 drm_gem_object_unreference_unlocked(gobj); 102 drm_gem_object_unreference_unlocked(gobj);
104} 103}
105 104
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index c26106066ec..d7ab9141641 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -69,7 +69,7 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain)
69 u32 c = 0; 69 u32 c = 0;
70 70
71 rbo->placement.fpfn = 0; 71 rbo->placement.fpfn = 0;
72 rbo->placement.lpfn = 0; 72 rbo->placement.lpfn = rbo->rdev->mc.active_vram_size >> PAGE_SHIFT;
73 rbo->placement.placement = rbo->placements; 73 rbo->placement.placement = rbo->placements;
74 rbo->placement.busy_placement = rbo->placements; 74 rbo->placement.busy_placement = rbo->placements;
75 if (domain & RADEON_GEM_DOMAIN_VRAM) 75 if (domain & RADEON_GEM_DOMAIN_VRAM)
diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h
index 353998dc2c0..3481bc7f6f5 100644
--- a/drivers/gpu/drm/radeon/radeon_object.h
+++ b/drivers/gpu/drm/radeon/radeon_object.h
@@ -124,11 +124,8 @@ static inline int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type,
124 int r; 124 int r;
125 125
126 r = ttm_bo_reserve(&bo->tbo, true, no_wait, false, 0); 126 r = ttm_bo_reserve(&bo->tbo, true, no_wait, false, 0);
127 if (unlikely(r != 0)) { 127 if (unlikely(r != 0))
128 if (r != -ERESTARTSYS)
129 dev_err(bo->rdev->dev, "%p reserve failed for wait\n", bo);
130 return r; 128 return r;
131 }
132 spin_lock(&bo->tbo.lock); 129 spin_lock(&bo->tbo.lock);
133 if (mem_type) 130 if (mem_type)
134 *mem_type = bo->tbo.mem.mem_type; 131 *mem_type = bo->tbo.mem.mem_type;
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index 8d8359a5d45..b091a1f6fa4 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -693,6 +693,7 @@ void rs600_mc_init(struct radeon_device *rdev)
693 rdev->mc.real_vram_size = RREG32(RADEON_CONFIG_MEMSIZE); 693 rdev->mc.real_vram_size = RREG32(RADEON_CONFIG_MEMSIZE);
694 rdev->mc.mc_vram_size = rdev->mc.real_vram_size; 694 rdev->mc.mc_vram_size = rdev->mc.real_vram_size;
695 rdev->mc.visible_vram_size = rdev->mc.aper_size; 695 rdev->mc.visible_vram_size = rdev->mc.aper_size;
696 rdev->mc.active_vram_size = rdev->mc.visible_vram_size;
696 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); 697 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev);
697 base = RREG32_MC(R_000004_MC_FB_LOCATION); 698 base = RREG32_MC(R_000004_MC_FB_LOCATION);
698 base = G_000004_MC_FB_START(base) << 16; 699 base = G_000004_MC_FB_START(base) << 16;
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c
index 70ed66ef1ca..0137d3e3728 100644
--- a/drivers/gpu/drm/radeon/rs690.c
+++ b/drivers/gpu/drm/radeon/rs690.c
@@ -157,6 +157,7 @@ void rs690_mc_init(struct radeon_device *rdev)
157 rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0); 157 rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0);
158 rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0); 158 rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0);
159 rdev->mc.visible_vram_size = rdev->mc.aper_size; 159 rdev->mc.visible_vram_size = rdev->mc.aper_size;
160 rdev->mc.active_vram_size = rdev->mc.visible_vram_size;
160 base = RREG32_MC(R_000100_MCCFG_FB_LOCATION); 161 base = RREG32_MC(R_000100_MCCFG_FB_LOCATION);
161 base = G_000100_MC_FB_START(base) << 16; 162 base = G_000100_MC_FB_START(base) << 16;
162 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); 163 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev);
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index ff1cc58920c..ab83f688263 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -267,6 +267,7 @@ static void rv770_mc_program(struct radeon_device *rdev)
267 */ 267 */
268void r700_cp_stop(struct radeon_device *rdev) 268void r700_cp_stop(struct radeon_device *rdev)
269{ 269{
270 rdev->mc.active_vram_size = rdev->mc.visible_vram_size;
270 WREG32(CP_ME_CNTL, (CP_ME_HALT | CP_PFP_HALT)); 271 WREG32(CP_ME_CNTL, (CP_ME_HALT | CP_PFP_HALT));
271 WREG32(SCRATCH_UMSK, 0); 272 WREG32(SCRATCH_UMSK, 0);
272} 273}
@@ -993,6 +994,7 @@ int rv770_mc_init(struct radeon_device *rdev)
993 rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE); 994 rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE);
994 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); 995 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE);
995 rdev->mc.visible_vram_size = rdev->mc.aper_size; 996 rdev->mc.visible_vram_size = rdev->mc.aper_size;
997 rdev->mc.active_vram_size = rdev->mc.visible_vram_size;
996 r600_vram_gtt_location(rdev, &rdev->mc); 998 r600_vram_gtt_location(rdev, &rdev->mc);
997 radeon_update_bandwidth_info(rdev); 999 radeon_update_bandwidth_info(rdev);
998 1000
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index af7b57a47fb..1e9bb2156dc 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -439,6 +439,42 @@ out_err:
439} 439}
440 440
441/** 441/**
442 * Call bo::reserved and with the lru lock held.
443 * Will release GPU memory type usage on destruction.
444 * This is the place to put in driver specific hooks.
445 * Will release the bo::reserved lock and the
446 * lru lock on exit.
447 */
448
449static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo)
450{
451 struct ttm_bo_global *glob = bo->glob;
452
453 if (bo->ttm) {
454
455 /**
456 * Release the lru_lock, since we don't want to have
457 * an atomic requirement on ttm_tt[unbind|destroy].
458 */
459
460 spin_unlock(&glob->lru_lock);
461 ttm_tt_unbind(bo->ttm);
462 ttm_tt_destroy(bo->ttm);
463 bo->ttm = NULL;
464 spin_lock(&glob->lru_lock);
465 }
466
467 if (bo->mem.mm_node) {
468 ttm_bo_mem_put(bo, &bo->mem);
469 }
470
471 atomic_set(&bo->reserved, 0);
472 wake_up_all(&bo->event_queue);
473 spin_unlock(&glob->lru_lock);
474}
475
476
477/**
442 * If bo idle, remove from delayed- and lru lists, and unref. 478 * If bo idle, remove from delayed- and lru lists, and unref.
443 * If not idle, and already on delayed list, do nothing. 479 * If not idle, and already on delayed list, do nothing.
444 * If not idle, and not on delayed list, put on delayed list, 480 * If not idle, and not on delayed list, put on delayed list,
@@ -453,6 +489,7 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo, bool remove_all)
453 int ret; 489 int ret;
454 490
455 spin_lock(&bo->lock); 491 spin_lock(&bo->lock);
492retry:
456 (void) ttm_bo_wait(bo, false, false, !remove_all); 493 (void) ttm_bo_wait(bo, false, false, !remove_all);
457 494
458 if (!bo->sync_obj) { 495 if (!bo->sync_obj) {
@@ -461,28 +498,52 @@ static int ttm_bo_cleanup_refs(struct ttm_buffer_object *bo, bool remove_all)
461 spin_unlock(&bo->lock); 498 spin_unlock(&bo->lock);
462 499
463 spin_lock(&glob->lru_lock); 500 spin_lock(&glob->lru_lock);
464 put_count = ttm_bo_del_from_lru(bo); 501 ret = ttm_bo_reserve_locked(bo, false, !remove_all, false, 0);
502
503 /**
504 * Someone else has the object reserved. Bail and retry.
505 */
506
507 if (unlikely(ret == -EBUSY)) {
508 spin_unlock(&glob->lru_lock);
509 spin_lock(&bo->lock);
510 goto requeue;
511 }
512
513 /**
514 * We can re-check for sync object without taking
515 * the bo::lock since setting the sync object requires
516 * also bo::reserved. A busy object at this point may
517 * be caused by another thread starting an accelerated
518 * eviction.
519 */
520
521 if (unlikely(bo->sync_obj)) {
522 atomic_set(&bo->reserved, 0);
523 wake_up_all(&bo->event_queue);
524 spin_unlock(&glob->lru_lock);
525 spin_lock(&bo->lock);
526 if (remove_all)
527 goto retry;
528 else
529 goto requeue;
530 }
465 531
466 ret = ttm_bo_reserve_locked(bo, false, false, false, 0); 532 put_count = ttm_bo_del_from_lru(bo);
467 BUG_ON(ret);
468 if (bo->ttm)
469 ttm_tt_unbind(bo->ttm);
470 533
471 if (!list_empty(&bo->ddestroy)) { 534 if (!list_empty(&bo->ddestroy)) {
472 list_del_init(&bo->ddestroy); 535 list_del_init(&bo->ddestroy);
473 ++put_count; 536 ++put_count;
474 } 537 }
475 spin_unlock(&glob->lru_lock);
476 ttm_bo_mem_put(bo, &bo->mem);
477 538
478 atomic_set(&bo->reserved, 0); 539 ttm_bo_cleanup_memtype_use(bo);
479 540
480 while (put_count--) 541 while (put_count--)
481 kref_put(&bo->list_kref, ttm_bo_ref_bug); 542 kref_put(&bo->list_kref, ttm_bo_ref_bug);
482 543
483 return 0; 544 return 0;
484 } 545 }
485 546requeue:
486 spin_lock(&glob->lru_lock); 547 spin_lock(&glob->lru_lock);
487 if (list_empty(&bo->ddestroy)) { 548 if (list_empty(&bo->ddestroy)) {
488 void *sync_obj = bo->sync_obj; 549 void *sync_obj = bo->sync_obj;