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

Upadhyay, Tejas tejas.upadhyay at intel.com
Wed Sep 11 05:45:51 UTC 2024



> -----Original Message-----
> From: Auld, Matthew <matthew.auld at intel.com>
> Sent: Tuesday, September 10, 2024 6:42 PM
> To: intel-xe at lists.freedesktop.org
> Cc: Ghimiray, Himal Prasad <himal.prasad.ghimiray at intel.com>; Upadhyay,
> Tejas <tejas.upadhyay at intel.com>; Thomas Hellström
> <thomas.hellstrom at linux.intel.com>
> Subject: [PATCH 3/4] drm/xe/client: use mem_type from the current resource
> 
> 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>
> 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;

Both says current placement, so impression was they are same. See below,
        /** @placement: current placement for this BO */
        struct ttm_placement placement;

However LGTM,
Reviewed-by: Tejas Upadhyay <tejas.upadhyay at intel.com>

> 
>  	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