diff options
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_resource.c')
| -rw-r--r-- | drivers/gpu/drm/ttm/ttm_resource.c | 20 | 
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_resource.c b/drivers/gpu/drm/ttm/ttm_resource.c index fb14f7716cf8..4a66b851b67d 100644 --- a/drivers/gpu/drm/ttm/ttm_resource.c +++ b/drivers/gpu/drm/ttm/ttm_resource.c @@ -22,8 +22,9 @@   * Authors: Christian König   */ -#include <linux/iosys-map.h> +#include <linux/debugfs.h>  #include <linux/io-mapping.h> +#include <linux/iosys-map.h>  #include <linux/scatterlist.h>  #include <drm/ttm/ttm_bo.h> @@ -105,6 +106,7 @@ static void ttm_lru_bulk_move_add(struct ttm_lru_bulk_move *bulk,  		pos->first = res;  		pos->last = res;  	} else { +		WARN_ON(pos->first->bo->base.resv != res->bo->base.resv);  		ttm_lru_bulk_move_pos_tail(pos, res);  	}  } @@ -295,11 +297,13 @@ bool ttm_resource_intersects(struct ttm_device *bdev,   *   * @res: the resource to check   * @placement: the placement to check against + * @evicting: true if the caller is doing evictions   *   * Returns true if the placement is compatible.   */  bool ttm_resource_compatible(struct ttm_resource *res, -			     struct ttm_placement *placement) +			     struct ttm_placement *placement, +			     bool evicting)  {  	struct ttm_buffer_object *bo = res->bo;  	struct ttm_device *bdev = bo->bdev; @@ -315,14 +319,20 @@ bool ttm_resource_compatible(struct ttm_resource *res,  		if (res->mem_type != place->mem_type)  			continue; +		if (place->flags & (evicting ? TTM_PL_FLAG_DESIRED : +				    TTM_PL_FLAG_FALLBACK)) +			continue; + +		if (place->flags & TTM_PL_FLAG_CONTIGUOUS && +		    !(res->placement & TTM_PL_FLAG_CONTIGUOUS)) +			continue; +  		man = ttm_manager_type(bdev, res->mem_type);  		if (man->func->compatible &&  		    !man->func->compatible(man, res, place, bo->base.size))  			continue; -		if ((!(place->flags & TTM_PL_FLAG_CONTIGUOUS) || -		     (res->placement & TTM_PL_FLAG_CONTIGUOUS))) -			return true; +		return true;  	}  	return false;  }  |