diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2011-10-14 10:51:22 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-10-18 05:12:51 -0400 |
commit | 6ddddfe7341a6fa2db22d63084bfb1df9cce0724 (patch) | |
tree | a21b66710dbcce73a4471d8fd0e5b033c1256ce3 /drivers/gpu/drm/radeon | |
parent | fb3d9e97e1ad5f2c19b68fe5a0c6a95bf57c65c3 (diff) |
drm/radeon/kms: make r600-NI blit suspend code common
r600-NI shared the same blit suspend code. Clean it up
and make it a shared function.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon')
-rw-r--r-- | drivers/gpu/drm/radeon/evergreen.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/ni.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/r600.c | 26 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/rv770.c | 12 |
5 files changed, 22 insertions, 38 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index b37b6a0bbec9..35b5673d432d 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -3153,21 +3153,13 @@ int evergreen_resume(struct radeon_device *rdev) | |||
3153 | 3153 | ||
3154 | int evergreen_suspend(struct radeon_device *rdev) | 3154 | int evergreen_suspend(struct radeon_device *rdev) |
3155 | { | 3155 | { |
3156 | int r; | ||
3157 | |||
3158 | /* FIXME: we should wait for ring to be empty */ | 3156 | /* FIXME: we should wait for ring to be empty */ |
3159 | r700_cp_stop(rdev); | 3157 | r700_cp_stop(rdev); |
3160 | rdev->cp.ready = false; | 3158 | rdev->cp.ready = false; |
3161 | evergreen_irq_suspend(rdev); | 3159 | evergreen_irq_suspend(rdev); |
3162 | radeon_wb_disable(rdev); | 3160 | radeon_wb_disable(rdev); |
3163 | evergreen_pcie_gart_disable(rdev); | 3161 | evergreen_pcie_gart_disable(rdev); |
3164 | 3162 | r600_blit_suspend(rdev); | |
3165 | /* unpin shaders bo */ | ||
3166 | r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false); | ||
3167 | if (likely(r == 0)) { | ||
3168 | radeon_bo_unpin(rdev->r600_blit.shader_obj); | ||
3169 | radeon_bo_unreserve(rdev->r600_blit.shader_obj); | ||
3170 | } | ||
3171 | 3163 | ||
3172 | return 0; | 3164 | return 0; |
3173 | } | 3165 | } |
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index b5da6dab5682..770cc2ab088a 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -1462,21 +1462,13 @@ int cayman_resume(struct radeon_device *rdev) | |||
1462 | 1462 | ||
1463 | int cayman_suspend(struct radeon_device *rdev) | 1463 | int cayman_suspend(struct radeon_device *rdev) |
1464 | { | 1464 | { |
1465 | int r; | ||
1466 | |||
1467 | /* FIXME: we should wait for ring to be empty */ | 1465 | /* FIXME: we should wait for ring to be empty */ |
1468 | cayman_cp_enable(rdev, false); | 1466 | cayman_cp_enable(rdev, false); |
1469 | rdev->cp.ready = false; | 1467 | rdev->cp.ready = false; |
1470 | evergreen_irq_suspend(rdev); | 1468 | evergreen_irq_suspend(rdev); |
1471 | radeon_wb_disable(rdev); | 1469 | radeon_wb_disable(rdev); |
1472 | cayman_pcie_gart_disable(rdev); | 1470 | cayman_pcie_gart_disable(rdev); |
1473 | 1471 | r600_blit_suspend(rdev); | |
1474 | /* unpin shaders bo */ | ||
1475 | r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false); | ||
1476 | if (likely(r == 0)) { | ||
1477 | radeon_bo_unpin(rdev->r600_blit.shader_obj); | ||
1478 | radeon_bo_unreserve(rdev->r600_blit.shader_obj); | ||
1479 | } | ||
1480 | 1472 | ||
1481 | return 0; | 1473 | return 0; |
1482 | } | 1474 | } |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index e106f30787fd..e87f5662a104 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -2376,6 +2376,20 @@ int r600_copy_blit(struct radeon_device *rdev, | |||
2376 | return 0; | 2376 | return 0; |
2377 | } | 2377 | } |
2378 | 2378 | ||
2379 | void r600_blit_suspend(struct radeon_device *rdev) | ||
2380 | { | ||
2381 | int r; | ||
2382 | |||
2383 | /* unpin shaders bo */ | ||
2384 | if (rdev->r600_blit.shader_obj) { | ||
2385 | r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false); | ||
2386 | if (!r) { | ||
2387 | radeon_bo_unpin(rdev->r600_blit.shader_obj); | ||
2388 | radeon_bo_unreserve(rdev->r600_blit.shader_obj); | ||
2389 | } | ||
2390 | } | ||
2391 | } | ||
2392 | |||
2379 | int r600_set_surface_reg(struct radeon_device *rdev, int reg, | 2393 | int r600_set_surface_reg(struct radeon_device *rdev, int reg, |
2380 | uint32_t tiling_flags, uint32_t pitch, | 2394 | uint32_t tiling_flags, uint32_t pitch, |
2381 | uint32_t offset, uint32_t obj_size) | 2395 | uint32_t offset, uint32_t obj_size) |
@@ -2495,8 +2509,6 @@ int r600_resume(struct radeon_device *rdev) | |||
2495 | 2509 | ||
2496 | int r600_suspend(struct radeon_device *rdev) | 2510 | int r600_suspend(struct radeon_device *rdev) |
2497 | { | 2511 | { |
2498 | int r; | ||
2499 | |||
2500 | r600_audio_fini(rdev); | 2512 | r600_audio_fini(rdev); |
2501 | /* FIXME: we should wait for ring to be empty */ | 2513 | /* FIXME: we should wait for ring to be empty */ |
2502 | r600_cp_stop(rdev); | 2514 | r600_cp_stop(rdev); |
@@ -2504,14 +2516,8 @@ int r600_suspend(struct radeon_device *rdev) | |||
2504 | r600_irq_suspend(rdev); | 2516 | r600_irq_suspend(rdev); |
2505 | radeon_wb_disable(rdev); | 2517 | radeon_wb_disable(rdev); |
2506 | r600_pcie_gart_disable(rdev); | 2518 | r600_pcie_gart_disable(rdev); |
2507 | /* unpin shaders bo */ | 2519 | r600_blit_suspend(rdev); |
2508 | if (rdev->r600_blit.shader_obj) { | 2520 | |
2509 | r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false); | ||
2510 | if (!r) { | ||
2511 | radeon_bo_unpin(rdev->r600_blit.shader_obj); | ||
2512 | radeon_bo_unreserve(rdev->r600_blit.shader_obj); | ||
2513 | } | ||
2514 | } | ||
2515 | return 0; | 2521 | return 0; |
2516 | } | 2522 | } |
2517 | 2523 | ||
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 6b1d09904e1f..3cf983c5243f 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -554,6 +554,8 @@ struct r600_blit { | |||
554 | struct radeon_ib *vb_ib; | 554 | struct radeon_ib *vb_ib; |
555 | }; | 555 | }; |
556 | 556 | ||
557 | void r600_blit_suspend(struct radeon_device *rdev); | ||
558 | |||
557 | int radeon_ib_get(struct radeon_device *rdev, struct radeon_ib **ib); | 559 | int radeon_ib_get(struct radeon_device *rdev, struct radeon_ib **ib); |
558 | void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib **ib); | 560 | void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib **ib); |
559 | int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib); | 561 | int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib); |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 80928f9ff80f..298feaec6d56 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -1238,8 +1238,6 @@ int rv770_resume(struct radeon_device *rdev) | |||
1238 | 1238 | ||
1239 | int rv770_suspend(struct radeon_device *rdev) | 1239 | int rv770_suspend(struct radeon_device *rdev) |
1240 | { | 1240 | { |
1241 | int r; | ||
1242 | |||
1243 | r600_audio_fini(rdev); | 1241 | r600_audio_fini(rdev); |
1244 | /* FIXME: we should wait for ring to be empty */ | 1242 | /* FIXME: we should wait for ring to be empty */ |
1245 | r700_cp_stop(rdev); | 1243 | r700_cp_stop(rdev); |
@@ -1247,14 +1245,8 @@ int rv770_suspend(struct radeon_device *rdev) | |||
1247 | r600_irq_suspend(rdev); | 1245 | r600_irq_suspend(rdev); |
1248 | radeon_wb_disable(rdev); | 1246 | radeon_wb_disable(rdev); |
1249 | rv770_pcie_gart_disable(rdev); | 1247 | rv770_pcie_gart_disable(rdev); |
1250 | /* unpin shaders bo */ | 1248 | r600_blit_suspend(rdev); |
1251 | if (rdev->r600_blit.shader_obj) { | 1249 | |
1252 | r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false); | ||
1253 | if (likely(r == 0)) { | ||
1254 | radeon_bo_unpin(rdev->r600_blit.shader_obj); | ||
1255 | radeon_bo_unreserve(rdev->r600_blit.shader_obj); | ||
1256 | } | ||
1257 | } | ||
1258 | return 0; | 1250 | return 0; |
1259 | } | 1251 | } |
1260 | 1252 | ||