diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_object.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 16 | 
1 files changed, 11 insertions, 5 deletions
| diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 2099159a693f..f6d503432a9e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -605,6 +605,8 @@ int amdgpu_bo_create(struct amdgpu_device *adev,  	else  		amdgpu_bo_placement_from_domain(bo, bp->domain);  	if (bp->type == ttm_bo_type_kernel) +		bo->tbo.priority = 2; +	else if (!(bp->flags & AMDGPU_GEM_CREATE_DISCARDABLE))  		bo->tbo.priority = 1;  	if (!bp->destroy) @@ -1241,14 +1243,18 @@ int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer,   * amdgpu_bo_move_notify - notification about a memory move   * @bo: pointer to a buffer object   * @evict: if this move is evicting the buffer from the graphics address space + * @new_mem: new resource for backing the BO   *   * Marks the corresponding &amdgpu_bo buffer object as invalid, also performs   * bookkeeping.   * TTM driver callback which is called when ttm moves a buffer.   */ -void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, bool evict) +void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, +			   bool evict, +			   struct ttm_resource *new_mem)  {  	struct amdgpu_device *adev = amdgpu_ttm_adev(bo->bdev); +	struct ttm_resource *old_mem = bo->resource;  	struct amdgpu_bo *abo;  	if (!amdgpu_bo_is_amdgpu_bo(bo)) @@ -1260,12 +1266,12 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo, bool evict)  	amdgpu_bo_kunmap(abo);  	if (abo->tbo.base.dma_buf && !abo->tbo.base.import_attach && -	    bo->resource->mem_type != TTM_PL_SYSTEM) +	    old_mem && old_mem->mem_type != TTM_PL_SYSTEM)  		dma_buf_move_notify(abo->tbo.base.dma_buf); -	/* remember the eviction */ -	if (evict) -		atomic64_inc(&adev->num_evictions); +	/* move_notify is called before move happens */ +	trace_amdgpu_bo_move(abo, new_mem ? new_mem->mem_type : -1, +			     old_mem ? old_mem->mem_type : -1);  }  void amdgpu_bo_get_memory(struct amdgpu_bo *bo, | 
