Commit 6ddddfe7 authored by Alex Deucher's avatar Alex Deucher Committed by Dave Airlie

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: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: default avatarIlija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent fb3d9e97
...@@ -3153,21 +3153,13 @@ int evergreen_resume(struct radeon_device *rdev) ...@@ -3153,21 +3153,13 @@ int evergreen_resume(struct radeon_device *rdev)
int evergreen_suspend(struct radeon_device *rdev) int evergreen_suspend(struct radeon_device *rdev)
{ {
int r;
/* FIXME: we should wait for ring to be empty */ /* FIXME: we should wait for ring to be empty */
r700_cp_stop(rdev); r700_cp_stop(rdev);
rdev->cp.ready = false; rdev->cp.ready = false;
evergreen_irq_suspend(rdev); evergreen_irq_suspend(rdev);
radeon_wb_disable(rdev); radeon_wb_disable(rdev);
evergreen_pcie_gart_disable(rdev); evergreen_pcie_gart_disable(rdev);
r600_blit_suspend(rdev);
/* unpin shaders bo */
r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
if (likely(r == 0)) {
radeon_bo_unpin(rdev->r600_blit.shader_obj);
radeon_bo_unreserve(rdev->r600_blit.shader_obj);
}
return 0; return 0;
} }
......
...@@ -1462,21 +1462,13 @@ int cayman_resume(struct radeon_device *rdev) ...@@ -1462,21 +1462,13 @@ int cayman_resume(struct radeon_device *rdev)
int cayman_suspend(struct radeon_device *rdev) int cayman_suspend(struct radeon_device *rdev)
{ {
int r;
/* FIXME: we should wait for ring to be empty */ /* FIXME: we should wait for ring to be empty */
cayman_cp_enable(rdev, false); cayman_cp_enable(rdev, false);
rdev->cp.ready = false; rdev->cp.ready = false;
evergreen_irq_suspend(rdev); evergreen_irq_suspend(rdev);
radeon_wb_disable(rdev); radeon_wb_disable(rdev);
cayman_pcie_gart_disable(rdev); cayman_pcie_gart_disable(rdev);
r600_blit_suspend(rdev);
/* unpin shaders bo */
r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
if (likely(r == 0)) {
radeon_bo_unpin(rdev->r600_blit.shader_obj);
radeon_bo_unreserve(rdev->r600_blit.shader_obj);
}
return 0; return 0;
} }
......
...@@ -2376,6 +2376,20 @@ int r600_copy_blit(struct radeon_device *rdev, ...@@ -2376,6 +2376,20 @@ int r600_copy_blit(struct radeon_device *rdev,
return 0; return 0;
} }
void r600_blit_suspend(struct radeon_device *rdev)
{
int r;
/* unpin shaders bo */
if (rdev->r600_blit.shader_obj) {
r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
if (!r) {
radeon_bo_unpin(rdev->r600_blit.shader_obj);
radeon_bo_unreserve(rdev->r600_blit.shader_obj);
}
}
}
int r600_set_surface_reg(struct radeon_device *rdev, int reg, int r600_set_surface_reg(struct radeon_device *rdev, int reg,
uint32_t tiling_flags, uint32_t pitch, uint32_t tiling_flags, uint32_t pitch,
uint32_t offset, uint32_t obj_size) uint32_t offset, uint32_t obj_size)
...@@ -2495,8 +2509,6 @@ int r600_resume(struct radeon_device *rdev) ...@@ -2495,8 +2509,6 @@ int r600_resume(struct radeon_device *rdev)
int r600_suspend(struct radeon_device *rdev) int r600_suspend(struct radeon_device *rdev)
{ {
int r;
r600_audio_fini(rdev); r600_audio_fini(rdev);
/* FIXME: we should wait for ring to be empty */ /* FIXME: we should wait for ring to be empty */
r600_cp_stop(rdev); r600_cp_stop(rdev);
...@@ -2504,14 +2516,8 @@ int r600_suspend(struct radeon_device *rdev) ...@@ -2504,14 +2516,8 @@ int r600_suspend(struct radeon_device *rdev)
r600_irq_suspend(rdev); r600_irq_suspend(rdev);
radeon_wb_disable(rdev); radeon_wb_disable(rdev);
r600_pcie_gart_disable(rdev); r600_pcie_gart_disable(rdev);
/* unpin shaders bo */ r600_blit_suspend(rdev);
if (rdev->r600_blit.shader_obj) {
r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
if (!r) {
radeon_bo_unpin(rdev->r600_blit.shader_obj);
radeon_bo_unreserve(rdev->r600_blit.shader_obj);
}
}
return 0; return 0;
} }
......
...@@ -554,6 +554,8 @@ struct r600_blit { ...@@ -554,6 +554,8 @@ struct r600_blit {
struct radeon_ib *vb_ib; struct radeon_ib *vb_ib;
}; };
void r600_blit_suspend(struct radeon_device *rdev);
int radeon_ib_get(struct radeon_device *rdev, struct radeon_ib **ib); int radeon_ib_get(struct radeon_device *rdev, struct radeon_ib **ib);
void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib **ib); void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib **ib);
int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib); int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib);
......
...@@ -1238,8 +1238,6 @@ int rv770_resume(struct radeon_device *rdev) ...@@ -1238,8 +1238,6 @@ int rv770_resume(struct radeon_device *rdev)
int rv770_suspend(struct radeon_device *rdev) int rv770_suspend(struct radeon_device *rdev)
{ {
int r;
r600_audio_fini(rdev); r600_audio_fini(rdev);
/* FIXME: we should wait for ring to be empty */ /* FIXME: we should wait for ring to be empty */
r700_cp_stop(rdev); r700_cp_stop(rdev);
...@@ -1247,14 +1245,8 @@ int rv770_suspend(struct radeon_device *rdev) ...@@ -1247,14 +1245,8 @@ int rv770_suspend(struct radeon_device *rdev)
r600_irq_suspend(rdev); r600_irq_suspend(rdev);
radeon_wb_disable(rdev); radeon_wb_disable(rdev);
rv770_pcie_gart_disable(rdev); rv770_pcie_gart_disable(rdev);
/* unpin shaders bo */ r600_blit_suspend(rdev);
if (rdev->r600_blit.shader_obj) {
r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
if (likely(r == 0)) {
radeon_bo_unpin(rdev->r600_blit.shader_obj);
radeon_bo_unreserve(rdev->r600_blit.shader_obj);
}
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment