[PATCH 3/4] drm/xe/client: use mem_type from the current resource

Matthew Brost matthew.brost at intel.com
Tue Sep 10 14:18:01 UTC 2024


On Tue, Sep 10, 2024 at 02:11:48PM +0100, Matthew Auld wrote:
> Rather extract the mem_type from the current resource. Checking the
> first potential placement doesn't really tell us where the bo is
> currently allocated, especially if there are multiple potential
> placements.
> 
> Signed-off-by: Matthew Auld <matthew.auld at intel.com>
> Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>

Reviewed-by: Matthew Brost <matthew.brost at intel.com>

> Cc: Tejas Upadhyay <tejas.upadhyay at intel.com>
> Cc: "Thomas Hellström" <thomas.hellstrom at linux.intel.com>
> ---
>  drivers/gpu/drm/xe/xe_drm_client.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_drm_client.c b/drivers/gpu/drm/xe/xe_drm_client.c
> index 3cca741c500c..578d2825c1fc 100644
> --- a/drivers/gpu/drm/xe/xe_drm_client.c
> +++ b/drivers/gpu/drm/xe/xe_drm_client.c
> @@ -168,12 +168,7 @@ static void bo_meminfo(struct xe_bo *bo,
>  		       struct drm_memory_stats stats[TTM_NUM_MEM_TYPES])
>  {
>  	u64 sz = bo->size;
> -	u32 mem_type;
> -
> -	if (bo->placement.placement)
> -		mem_type = bo->placement.placement->mem_type;
> -	else
> -		mem_type = XE_PL_TT;
> +	u32 mem_type = bo->ttm.resource->mem_type;
>  
>  	if (drm_gem_object_is_shared_for_memory_stats(&bo->ttm.base))
>  		stats[mem_type].shared += sz;
> -- 
> 2.46.0
> 


More information about the Intel-xe mailing list