diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_object.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 84990415a3dc..9113fffbb8b9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | |||
@@ -98,6 +98,11 @@ static void amdgpu_ttm_bo_destroy(struct ttm_buffer_object *tbo) | |||
98 | 98 | ||
99 | drm_gem_object_release(&bo->gem_base); | 99 | drm_gem_object_release(&bo->gem_base); |
100 | amdgpu_bo_unref(&bo->parent); | 100 | amdgpu_bo_unref(&bo->parent); |
101 | if (!list_empty(&bo->shadow_list)) { | ||
102 | mutex_lock(&bo->adev->shadow_list_lock); | ||
103 | list_del_init(&bo->shadow_list); | ||
104 | mutex_unlock(&bo->adev->shadow_list_lock); | ||
105 | } | ||
101 | kfree(bo->metadata); | 106 | kfree(bo->metadata); |
102 | kfree(bo); | 107 | kfree(bo); |
103 | } | 108 | } |
@@ -315,6 +320,7 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev, | |||
315 | } | 320 | } |
316 | bo->adev = adev; | 321 | bo->adev = adev; |
317 | INIT_LIST_HEAD(&bo->list); | 322 | INIT_LIST_HEAD(&bo->list); |
323 | INIT_LIST_HEAD(&bo->shadow_list); | ||
318 | INIT_LIST_HEAD(&bo->va); | 324 | INIT_LIST_HEAD(&bo->va); |
319 | bo->prefered_domains = domain & (AMDGPU_GEM_DOMAIN_VRAM | | 325 | bo->prefered_domains = domain & (AMDGPU_GEM_DOMAIN_VRAM | |
320 | AMDGPU_GEM_DOMAIN_GTT | | 326 | AMDGPU_GEM_DOMAIN_GTT | |
@@ -407,8 +413,12 @@ static int amdgpu_bo_create_shadow(struct amdgpu_device *adev, | |||
407 | NULL, &placement, | 413 | NULL, &placement, |
408 | bo->tbo.resv, | 414 | bo->tbo.resv, |
409 | &bo->shadow); | 415 | &bo->shadow); |
410 | if (!r) | 416 | if (!r) { |
411 | bo->shadow->parent = amdgpu_bo_ref(bo); | 417 | bo->shadow->parent = amdgpu_bo_ref(bo); |
418 | mutex_lock(&adev->shadow_list_lock); | ||
419 | list_add_tail(&bo->shadow_list, &adev->shadow_list); | ||
420 | mutex_unlock(&adev->shadow_list_lock); | ||
421 | } | ||
412 | 422 | ||
413 | return r; | 423 | return r; |
414 | } | 424 | } |