aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/rv770.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/radeon/rv770.c')
-rw-r--r--drivers/gpu/drm/radeon/rv770.c67
1 files changed, 35 insertions, 32 deletions
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index 3bcb66e52786..afd9e8213c29 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -779,7 +779,6 @@ int rv770_mc_init(struct radeon_device *rdev)
779 fixed20_12 a; 779 fixed20_12 a;
780 u32 tmp; 780 u32 tmp;
781 int chansize, numchan; 781 int chansize, numchan;
782 int r;
783 782
784 /* Get VRAM informations */ 783 /* Get VRAM informations */
785 rdev->mc.vram_is_ddr = true; 784 rdev->mc.vram_is_ddr = true;
@@ -822,9 +821,6 @@ int rv770_mc_init(struct radeon_device *rdev)
822 rdev->mc.real_vram_size = rdev->mc.aper_size; 821 rdev->mc.real_vram_size = rdev->mc.aper_size;
823 822
824 if (rdev->flags & RADEON_IS_AGP) { 823 if (rdev->flags & RADEON_IS_AGP) {
825 r = radeon_agp_init(rdev);
826 if (r)
827 return r;
828 /* gtt_size is setup by radeon_agp_init */ 824 /* gtt_size is setup by radeon_agp_init */
829 rdev->mc.gtt_location = rdev->mc.agp_base; 825 rdev->mc.gtt_location = rdev->mc.agp_base;
830 tmp = 0xFFFFFFFFUL - rdev->mc.agp_base - rdev->mc.gtt_size; 826 tmp = 0xFFFFFFFFUL - rdev->mc.agp_base - rdev->mc.gtt_size;
@@ -891,26 +887,19 @@ static int rv770_startup(struct radeon_device *rdev)
891 return r; 887 return r;
892 } 888 }
893 rv770_gpu_init(rdev); 889 rv770_gpu_init(rdev);
894 890 /* pin copy shader into vram */
895 if (!rdev->r600_blit.shader_obj) { 891 if (rdev->r600_blit.shader_obj) {
896 r = r600_blit_init(rdev); 892 r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
893 if (unlikely(r != 0))
894 return r;
895 r = radeon_bo_pin(rdev->r600_blit.shader_obj, RADEON_GEM_DOMAIN_VRAM,
896 &rdev->r600_blit.shader_gpu_addr);
897 radeon_bo_unreserve(rdev->r600_blit.shader_obj);
897 if (r) { 898 if (r) {
898 DRM_ERROR("radeon: failed blitter (%d).\n", r); 899 DRM_ERROR("failed to pin blit object %d\n", r);
899 return r; 900 return r;
900 } 901 }
901 } 902 }
902
903 r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
904 if (unlikely(r != 0))
905 return r;
906 r = radeon_bo_pin(rdev->r600_blit.shader_obj, RADEON_GEM_DOMAIN_VRAM,
907 &rdev->r600_blit.shader_gpu_addr);
908 radeon_bo_unreserve(rdev->r600_blit.shader_obj);
909 if (r) {
910 DRM_ERROR("failed to pin blit object %d\n", r);
911 return r;
912 }
913
914 /* Enable IRQ */ 903 /* Enable IRQ */
915 r = r600_irq_init(rdev); 904 r = r600_irq_init(rdev);
916 if (r) { 905 if (r) {
@@ -972,13 +961,16 @@ int rv770_suspend(struct radeon_device *rdev)
972 /* FIXME: we should wait for ring to be empty */ 961 /* FIXME: we should wait for ring to be empty */
973 r700_cp_stop(rdev); 962 r700_cp_stop(rdev);
974 rdev->cp.ready = false; 963 rdev->cp.ready = false;
964 r600_irq_suspend(rdev);
975 r600_wb_disable(rdev); 965 r600_wb_disable(rdev);
976 rv770_pcie_gart_disable(rdev); 966 rv770_pcie_gart_disable(rdev);
977 /* unpin shaders bo */ 967 /* unpin shaders bo */
978 r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false); 968 if (rdev->r600_blit.shader_obj) {
979 if (likely(r == 0)) { 969 r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
980 radeon_bo_unpin(rdev->r600_blit.shader_obj); 970 if (likely(r == 0)) {
981 radeon_bo_unreserve(rdev->r600_blit.shader_obj); 971 radeon_bo_unpin(rdev->r600_blit.shader_obj);
972 radeon_bo_unreserve(rdev->r600_blit.shader_obj);
973 }
982 } 974 }
983 return 0; 975 return 0;
984} 976}
@@ -1037,6 +1029,11 @@ int rv770_init(struct radeon_device *rdev)
1037 r = radeon_fence_driver_init(rdev); 1029 r = radeon_fence_driver_init(rdev);
1038 if (r) 1030 if (r)
1039 return r; 1031 return r;
1032 if (rdev->flags & RADEON_IS_AGP) {
1033 r = radeon_agp_init(rdev);
1034 if (r)
1035 radeon_agp_disable(rdev);
1036 }
1040 r = rv770_mc_init(rdev); 1037 r = rv770_mc_init(rdev);
1041 if (r) 1038 if (r)
1042 return r; 1039 return r;
@@ -1058,6 +1055,12 @@ int rv770_init(struct radeon_device *rdev)
1058 r = r600_pcie_gart_init(rdev); 1055 r = r600_pcie_gart_init(rdev);
1059 if (r) 1056 if (r)
1060 return r; 1057 return r;
1058 r = r600_blit_init(rdev);
1059 if (r) {
1060 r600_blit_fini(rdev);
1061 rdev->asic->copy = NULL;
1062 dev_warn(rdev->dev, "failed blitter (%d) falling back to memcpy\n", r);
1063 }
1061 1064
1062 rdev->accel_working = true; 1065 rdev->accel_working = true;
1063 r = rv770_startup(rdev); 1066 r = rv770_startup(rdev);
@@ -1071,13 +1074,14 @@ int rv770_init(struct radeon_device *rdev)
1071 if (rdev->accel_working) { 1074 if (rdev->accel_working) {
1072 r = radeon_ib_pool_init(rdev); 1075 r = radeon_ib_pool_init(rdev);
1073 if (r) { 1076 if (r) {
1074 DRM_ERROR("radeon: failed initializing IB pool (%d).\n", r); 1077 dev_err(rdev->dev, "IB initialization failed (%d).\n", r);
1075 rdev->accel_working = false;
1076 }
1077 r = r600_ib_test(rdev);
1078 if (r) {
1079 DRM_ERROR("radeon: failed testing IB (%d).\n", r);
1080 rdev->accel_working = false; 1078 rdev->accel_working = false;
1079 } else {
1080 r = r600_ib_test(rdev);
1081 if (r) {
1082 dev_err(rdev->dev, "IB test failed (%d).\n", r);
1083 rdev->accel_working = false;
1084 }
1081 } 1085 }
1082 } 1086 }
1083 return 0; 1087 return 0;
@@ -1096,8 +1100,7 @@ void rv770_fini(struct radeon_device *rdev)
1096 radeon_gem_fini(rdev); 1100 radeon_gem_fini(rdev);
1097 radeon_fence_driver_fini(rdev); 1101 radeon_fence_driver_fini(rdev);
1098 radeon_clocks_fini(rdev); 1102 radeon_clocks_fini(rdev);
1099 if (rdev->flags & RADEON_IS_AGP) 1103 radeon_agp_fini(rdev);
1100 radeon_agp_fini(rdev);
1101 radeon_bo_fini(rdev); 1104 radeon_bo_fini(rdev);
1102 radeon_atombios_fini(rdev); 1105 radeon_atombios_fini(rdev);
1103 kfree(rdev->bios); 1106 kfree(rdev->bios);