diff options
author | Dave Airlie <airlied@linux.ie> | 2009-09-18 01:19:37 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-09-18 02:17:42 -0400 |
commit | fc30b8efbe1b271eb64e0d4f6cb2a91bb57ee5f3 (patch) | |
tree | 87e0fb824b19667c2570bc99bc9ca918f4a25f6e /drivers/gpu/drm/radeon | |
parent | bc1a631e5104317cc8b4ef7d14adc597f2844003 (diff) |
drm/radeon/kms: move around new init path code to avoid posting at init
We really don't want to post the card at init, it takes a relatively
long time and isn't required, so split the resume path into
a startup path called by both init/resume and separate resume
entry point to do posting.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon')
-rw-r--r-- | drivers/gpu/drm/radeon/r420.c | 52 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/r600.c | 38 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/rv770.c | 38 |
3 files changed, 101 insertions, 27 deletions
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c index 2142a4781970..9b38956e91c7 100644 --- a/drivers/gpu/drm/radeon/r420.c +++ b/drivers/gpu/drm/radeon/r420.c | |||
@@ -157,31 +157,10 @@ static void r420_clock_resume(struct radeon_device *rdev) | |||
157 | WREG32_PLL(R_00000D_SCLK_CNTL, sclk_cntl); | 157 | WREG32_PLL(R_00000D_SCLK_CNTL, sclk_cntl); |
158 | } | 158 | } |
159 | 159 | ||
160 | int r420_resume(struct radeon_device *rdev) | 160 | static int r420_startup(struct radeon_device *rdev) |
161 | { | 161 | { |
162 | int r; | 162 | int r; |
163 | 163 | ||
164 | /* Make sur GART are not working */ | ||
165 | if (rdev->flags & RADEON_IS_PCIE) | ||
166 | rv370_pcie_gart_disable(rdev); | ||
167 | if (rdev->flags & RADEON_IS_PCI) | ||
168 | r100_pci_gart_disable(rdev); | ||
169 | /* Resume clock before doing reset */ | ||
170 | r420_clock_resume(rdev); | ||
171 | /* Reset gpu before posting otherwise ATOM will enter infinite loop */ | ||
172 | if (radeon_gpu_reset(rdev)) { | ||
173 | dev_warn(rdev->dev, "GPU reset failed ! (0xE40=0x%08X, 0x7C0=0x%08X)\n", | ||
174 | RREG32(R_000E40_RBBM_STATUS), | ||
175 | RREG32(R_0007C0_CP_STAT)); | ||
176 | } | ||
177 | /* check if cards are posted or not */ | ||
178 | if (rdev->is_atom_bios) { | ||
179 | atom_asic_init(rdev->mode_info.atom_context); | ||
180 | } else { | ||
181 | radeon_combios_asic_init(rdev->ddev); | ||
182 | } | ||
183 | /* Resume clock after posting */ | ||
184 | r420_clock_resume(rdev); | ||
185 | r300_mc_program(rdev); | 164 | r300_mc_program(rdev); |
186 | /* Initialize GART (initialize after TTM so we can allocate | 165 | /* Initialize GART (initialize after TTM so we can allocate |
187 | * memory through TTM but finalize after TTM) */ | 166 | * memory through TTM but finalize after TTM) */ |
@@ -217,6 +196,33 @@ int r420_resume(struct radeon_device *rdev) | |||
217 | return 0; | 196 | return 0; |
218 | } | 197 | } |
219 | 198 | ||
199 | int r420_resume(struct radeon_device *rdev) | ||
200 | { | ||
201 | /* Make sur GART are not working */ | ||
202 | if (rdev->flags & RADEON_IS_PCIE) | ||
203 | rv370_pcie_gart_disable(rdev); | ||
204 | if (rdev->flags & RADEON_IS_PCI) | ||
205 | r100_pci_gart_disable(rdev); | ||
206 | /* Resume clock before doing reset */ | ||
207 | r420_clock_resume(rdev); | ||
208 | /* Reset gpu before posting otherwise ATOM will enter infinite loop */ | ||
209 | if (radeon_gpu_reset(rdev)) { | ||
210 | dev_warn(rdev->dev, "GPU reset failed ! (0xE40=0x%08X, 0x7C0=0x%08X)\n", | ||
211 | RREG32(R_000E40_RBBM_STATUS), | ||
212 | RREG32(R_0007C0_CP_STAT)); | ||
213 | } | ||
214 | /* check if cards are posted or not */ | ||
215 | if (rdev->is_atom_bios) { | ||
216 | atom_asic_init(rdev->mode_info.atom_context); | ||
217 | } else { | ||
218 | radeon_combios_asic_init(rdev->ddev); | ||
219 | } | ||
220 | /* Resume clock after posting */ | ||
221 | r420_clock_resume(rdev); | ||
222 | |||
223 | return r420_startup(rdev); | ||
224 | } | ||
225 | |||
220 | int r420_suspend(struct radeon_device *rdev) | 226 | int r420_suspend(struct radeon_device *rdev) |
221 | { | 227 | { |
222 | r100_cp_disable(rdev); | 228 | r100_cp_disable(rdev); |
@@ -330,7 +336,7 @@ int r420_init(struct radeon_device *rdev) | |||
330 | } | 336 | } |
331 | r300_set_reg_safe(rdev); | 337 | r300_set_reg_safe(rdev); |
332 | rdev->accel_working = true; | 338 | rdev->accel_working = true; |
333 | r = r420_resume(rdev); | 339 | r = r420_startup(rdev); |
334 | if (r) { | 340 | if (r) { |
335 | /* Somethings want wront with the accel init stop accel */ | 341 | /* Somethings want wront with the accel init stop accel */ |
336 | dev_err(rdev->dev, "Disabling GPU acceleration\n"); | 342 | dev_err(rdev->dev, "Disabling GPU acceleration\n"); |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 9844783cd8d7..5f42fad19190 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -1466,7 +1466,7 @@ bool r600_card_posted(struct radeon_device *rdev) | |||
1466 | return false; | 1466 | return false; |
1467 | } | 1467 | } |
1468 | 1468 | ||
1469 | int r600_resume(struct radeon_device *rdev) | 1469 | int r600_startup(struct radeon_device *rdev) |
1470 | { | 1470 | { |
1471 | int r; | 1471 | int r; |
1472 | 1472 | ||
@@ -1499,6 +1499,40 @@ int r600_resume(struct radeon_device *rdev) | |||
1499 | return 0; | 1499 | return 0; |
1500 | } | 1500 | } |
1501 | 1501 | ||
1502 | int r600_resume(struct radeon_device *rdev) | ||
1503 | { | ||
1504 | int r; | ||
1505 | |||
1506 | if (radeon_gpu_reset(rdev)) { | ||
1507 | /* FIXME: what do we want to do here ? */ | ||
1508 | } | ||
1509 | /* post card */ | ||
1510 | if (rdev->is_atom_bios) { | ||
1511 | atom_asic_init(rdev->mode_info.atom_context); | ||
1512 | } else { | ||
1513 | radeon_combios_asic_init(rdev->ddev); | ||
1514 | } | ||
1515 | /* Initialize clocks */ | ||
1516 | r = radeon_clocks_init(rdev); | ||
1517 | if (r) { | ||
1518 | return r; | ||
1519 | } | ||
1520 | |||
1521 | r = r600_startup(rdev); | ||
1522 | if (r) { | ||
1523 | DRM_ERROR("r600 startup failed on resume\n"); | ||
1524 | return r; | ||
1525 | } | ||
1526 | |||
1527 | r = radeon_ib_test(rdev); | ||
1528 | if (r) { | ||
1529 | DRM_ERROR("radeon: failled testing IB (%d).\n", r); | ||
1530 | return r; | ||
1531 | } | ||
1532 | return r; | ||
1533 | } | ||
1534 | |||
1535 | |||
1502 | int r600_suspend(struct radeon_device *rdev) | 1536 | int r600_suspend(struct radeon_device *rdev) |
1503 | { | 1537 | { |
1504 | /* FIXME: we should wait for ring to be empty */ | 1538 | /* FIXME: we should wait for ring to be empty */ |
@@ -1596,7 +1630,7 @@ int r600_init(struct radeon_device *rdev) | |||
1596 | return r; | 1630 | return r; |
1597 | } | 1631 | } |
1598 | 1632 | ||
1599 | r = r600_resume(rdev); | 1633 | r = r600_startup(rdev); |
1600 | if (r) { | 1634 | if (r) { |
1601 | if (rdev->flags & RADEON_IS_AGP) { | 1635 | if (rdev->flags & RADEON_IS_AGP) { |
1602 | /* Retry with disabling AGP */ | 1636 | /* Retry with disabling AGP */ |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 47427623a84c..a6399662a843 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -851,7 +851,7 @@ int rv770_gpu_reset(struct radeon_device *rdev) | |||
851 | return 0; | 851 | return 0; |
852 | } | 852 | } |
853 | 853 | ||
854 | int rv770_resume(struct radeon_device *rdev) | 854 | static int rv770_startup(struct radeon_device *rdev) |
855 | { | 855 | { |
856 | int r; | 856 | int r; |
857 | 857 | ||
@@ -875,6 +875,40 @@ int rv770_resume(struct radeon_device *rdev) | |||
875 | return 0; | 875 | return 0; |
876 | } | 876 | } |
877 | 877 | ||
878 | int rv770_resume(struct radeon_device *rdev) | ||
879 | { | ||
880 | int r; | ||
881 | |||
882 | if (radeon_gpu_reset(rdev)) { | ||
883 | /* FIXME: what do we want to do here ? */ | ||
884 | } | ||
885 | /* post card */ | ||
886 | if (rdev->is_atom_bios) { | ||
887 | atom_asic_init(rdev->mode_info.atom_context); | ||
888 | } else { | ||
889 | radeon_combios_asic_init(rdev->ddev); | ||
890 | } | ||
891 | /* Initialize clocks */ | ||
892 | r = radeon_clocks_init(rdev); | ||
893 | if (r) { | ||
894 | return r; | ||
895 | } | ||
896 | |||
897 | r = rv770_startup(rdev); | ||
898 | if (r) { | ||
899 | DRM_ERROR("r600 startup failed on resume\n"); | ||
900 | return r; | ||
901 | } | ||
902 | |||
903 | r = radeon_ib_test(rdev); | ||
904 | if (r) { | ||
905 | DRM_ERROR("radeon: failled testing IB (%d).\n", r); | ||
906 | return r; | ||
907 | } | ||
908 | return r; | ||
909 | |||
910 | } | ||
911 | |||
878 | int rv770_suspend(struct radeon_device *rdev) | 912 | int rv770_suspend(struct radeon_device *rdev) |
879 | { | 913 | { |
880 | /* FIXME: we should wait for ring to be empty */ | 914 | /* FIXME: we should wait for ring to be empty */ |
@@ -959,7 +993,7 @@ int rv770_init(struct radeon_device *rdev) | |||
959 | return r; | 993 | return r; |
960 | 994 | ||
961 | rdev->accel_working = true; | 995 | rdev->accel_working = true; |
962 | r = rv770_resume(rdev); | 996 | r = rv770_startup(rdev); |
963 | if (r) { | 997 | if (r) { |
964 | if (rdev->flags & RADEON_IS_AGP) { | 998 | if (rdev->flags & RADEON_IS_AGP) { |
965 | /* Retry with disabling AGP */ | 999 | /* Retry with disabling AGP */ |