]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/radeon: fix prime teardown order
authorChristian König <christian.koenig@amd.com>
Fri, 9 Mar 2018 13:44:32 +0000 (14:44 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 14 Mar 2018 20:08:40 +0000 (15:08 -0500)
We unmapped imported DMA-bufs when the GEM handle was dropped, not when the
hardware was done with the buffere.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
CC: stable@vger.kernel.org
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/radeon/radeon_gem.c
drivers/gpu/drm/radeon/radeon_object.c

index a9962ffba720b784b24de5f5f117f330b19e5710..27d8e7dd2d0676c4f369041be3bcb5b95774a1b3 100644 (file)
@@ -34,8 +34,6 @@ void radeon_gem_object_free(struct drm_gem_object *gobj)
        struct radeon_bo *robj = gem_to_radeon_bo(gobj);
 
        if (robj) {
-               if (robj->gem_base.import_attach)
-                       drm_prime_gem_destroy(&robj->gem_base, robj->tbo.sg);
                radeon_mn_unregister(robj);
                radeon_bo_unref(&robj);
        }
index 38431f682ed0c56760f8ae0ac0e283b98490049d..edbb4cd519fd6843c7e65398e8a33c9a0da7c095 100644 (file)
@@ -82,6 +82,8 @@ static void radeon_ttm_bo_destroy(struct ttm_buffer_object *tbo)
        mutex_unlock(&bo->rdev->gem.mutex);
        radeon_bo_clear_surface_reg(bo);
        WARN_ON_ONCE(!list_empty(&bo->va));
+       if (bo->gem_base.import_attach)
+               drm_prime_gem_destroy(&bo->gem_base, bo->tbo.sg);
        drm_gem_object_release(&bo->gem_base);
        kfree(bo);
 }