diff mbox

drm/radeon: fix write back suspend regression with uvd

Message ID 1370555732-3679-1-git-send-email-j.glisse@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jerome Glisse June 6, 2013, 9:55 p.m. UTC
From: Jerome Glisse <jglisse@redhat.com>

UVD ring can't use scratch thus it does need writeback buffer to keep
a valid address or radeon_ring_backup will trigger a kernel fault.

It's ok to not unpin the write back buffer on suspend as it leave in
gtt and thus does not need eviction.

Reported and tracked by Wojtek <wojtask9@wp.pl>

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
---
 drivers/gpu/drm/radeon/radeon_device.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

Comments

Alex Deucher June 7, 2013, 1:34 p.m. UTC | #1
On Thu, Jun 6, 2013 at 5:55 PM,  <j.glisse@gmail.com> wrote:
> From: Jerome Glisse <jglisse@redhat.com>
>
> UVD ring can't use scratch thus it does need writeback buffer to keep
> a valid address or radeon_ring_backup will trigger a kernel fault.
>
> It's ok to not unpin the write back buffer on suspend as it leave in
> gtt and thus does not need eviction.
>
> Reported and tracked by Wojtek <wojtask9@wp.pl>
>
> Signed-off-by: Jerome Glisse <jglisse@redhat.com>

Applied.  thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/radeon_device.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
> index 1899738..eb8068a 100644
> --- a/drivers/gpu/drm/radeon/radeon_device.c
> +++ b/drivers/gpu/drm/radeon/radeon_device.c
> @@ -244,16 +244,6 @@ void radeon_scratch_free(struct radeon_device *rdev, uint32_t reg)
>   */
>  void radeon_wb_disable(struct radeon_device *rdev)
>  {
> -       int r;
> -
> -       if (rdev->wb.wb_obj) {
> -               r = radeon_bo_reserve(rdev->wb.wb_obj, false);
> -               if (unlikely(r != 0))
> -                       return;
> -               radeon_bo_kunmap(rdev->wb.wb_obj);
> -               radeon_bo_unpin(rdev->wb.wb_obj);
> -               radeon_bo_unreserve(rdev->wb.wb_obj);
> -       }
>         rdev->wb.enabled = false;
>  }
>
> @@ -269,6 +259,11 @@ void radeon_wb_fini(struct radeon_device *rdev)
>  {
>         radeon_wb_disable(rdev);
>         if (rdev->wb.wb_obj) {
> +               if (!radeon_bo_reserve(rdev->wb.wb_obj, false)) {
> +                       radeon_bo_kunmap(rdev->wb.wb_obj);
> +                       radeon_bo_unpin(rdev->wb.wb_obj);
> +                       radeon_bo_unreserve(rdev->wb.wb_obj);
> +               }
>                 radeon_bo_unref(&rdev->wb.wb_obj);
>                 rdev->wb.wb = NULL;
>                 rdev->wb.wb_obj = NULL;
> --
> 1.7.11.7
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 1899738..eb8068a 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -244,16 +244,6 @@  void radeon_scratch_free(struct radeon_device *rdev, uint32_t reg)
  */
 void radeon_wb_disable(struct radeon_device *rdev)
 {
-	int r;
-
-	if (rdev->wb.wb_obj) {
-		r = radeon_bo_reserve(rdev->wb.wb_obj, false);
-		if (unlikely(r != 0))
-			return;
-		radeon_bo_kunmap(rdev->wb.wb_obj);
-		radeon_bo_unpin(rdev->wb.wb_obj);
-		radeon_bo_unreserve(rdev->wb.wb_obj);
-	}
 	rdev->wb.enabled = false;
 }
 
@@ -269,6 +259,11 @@  void radeon_wb_fini(struct radeon_device *rdev)
 {
 	radeon_wb_disable(rdev);
 	if (rdev->wb.wb_obj) {
+		if (!radeon_bo_reserve(rdev->wb.wb_obj, false)) {
+			radeon_bo_kunmap(rdev->wb.wb_obj);
+			radeon_bo_unpin(rdev->wb.wb_obj);
+			radeon_bo_unreserve(rdev->wb.wb_obj);
+		}
 		radeon_bo_unref(&rdev->wb.wb_obj);
 		rdev->wb.wb = NULL;
 		rdev->wb.wb_obj = NULL;