aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2010-01-13 04:29:27 -0500
committerDave Airlie <airlied@redhat.com>2010-01-13 20:53:36 -0500
commit30d2d9a54d48e4fefede0389ded1b6fc2d44a522 (patch)
treef3cc8c5bd05bf6ae4605522f7f57d967fd25f30f /drivers/gpu
parent6398d42454ce1671b3422c34fd0f600c9c76c8b1 (diff)
drm/radeon/kms: Fix r600 blit cleanup path
r600 blit cleanup path need to check if a bo was allocated before trying to free or unpin it. This patch add this check and avoid oops when the initialization on r6xx or r7xx hw fails. Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/radeon/r600.c12
-rw-r--r--drivers/gpu/drm/radeon/r600_blit_kms.c14
-rw-r--r--drivers/gpu/drm/radeon/rv770.c10
3 files changed, 21 insertions, 15 deletions
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 9757962146fb..3e02dd403d77 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1961,11 +1961,13 @@ int r600_suspend(struct radeon_device *rdev)
1961 r600_wb_disable(rdev); 1961 r600_wb_disable(rdev);
1962 r600_pcie_gart_disable(rdev); 1962 r600_pcie_gart_disable(rdev);
1963 /* unpin shaders bo */ 1963 /* unpin shaders bo */
1964 r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false); 1964 if (rdev->r600_blit.shader_obj) {
1965 if (unlikely(r != 0)) 1965 r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
1966 return r; 1966 if (!r) {
1967 radeon_bo_unpin(rdev->r600_blit.shader_obj); 1967 radeon_bo_unpin(rdev->r600_blit.shader_obj);
1968 radeon_bo_unreserve(rdev->r600_blit.shader_obj); 1968 radeon_bo_unreserve(rdev->r600_blit.shader_obj);
1969 }
1970 }
1969 return 0; 1971 return 0;
1970} 1972}
1971 1973
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c
index 8787ea89dc6e..2bedce477a97 100644
--- a/drivers/gpu/drm/radeon/r600_blit_kms.c
+++ b/drivers/gpu/drm/radeon/r600_blit_kms.c
@@ -512,14 +512,16 @@ void r600_blit_fini(struct radeon_device *rdev)
512{ 512{
513 int r; 513 int r;
514 514
515 if (rdev->r600_blit.shader_obj == NULL)
516 return;
517 /* If we can't reserve the bo, unref should be enough to destroy
518 * it when it becomes idle.
519 */
515 r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false); 520 r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
516 if (unlikely(r != 0)) { 521 if (!r) {
517 dev_err(rdev->dev, "(%d) can't finish r600 blit\n", r); 522 radeon_bo_unpin(rdev->r600_blit.shader_obj);
518 goto out_unref; 523 radeon_bo_unreserve(rdev->r600_blit.shader_obj);
519 } 524 }
520 radeon_bo_unpin(rdev->r600_blit.shader_obj);
521 radeon_bo_unreserve(rdev->r600_blit.shader_obj);
522out_unref:
523 radeon_bo_unref(&rdev->r600_blit.shader_obj); 525 radeon_bo_unref(&rdev->r600_blit.shader_obj);
524} 526}
525 527
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index 16f7317fa1af..7f17ddf1f45f 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -975,10 +975,12 @@ int rv770_suspend(struct radeon_device *rdev)
975 r600_wb_disable(rdev); 975 r600_wb_disable(rdev);
976 rv770_pcie_gart_disable(rdev); 976 rv770_pcie_gart_disable(rdev);
977 /* unpin shaders bo */ 977 /* unpin shaders bo */
978 r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false); 978 if (rdev->r600_blit.shader_obj) {
979 if (likely(r == 0)) { 979 r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false);
980 radeon_bo_unpin(rdev->r600_blit.shader_obj); 980 if (likely(r == 0)) {
981 radeon_bo_unreserve(rdev->r600_blit.shader_obj); 981 radeon_bo_unpin(rdev->r600_blit.shader_obj);
982 radeon_bo_unreserve(rdev->r600_blit.shader_obj);
983 }
982 } 984 }
983 return 0; 985 return 0;
984} 986}