[Intel-xe] [PATCH v2 1/6] drm/xe: add XE_BO_CREATE_VRAM_MASK

Souza, Jose jose.souza at intel.com
Fri Mar 24 15:13:47 UTC 2023


On Thu, 2023-03-23 at 11:59 +0000, Matthew Auld wrote:
> So we don't have to keep repeating VRAM0 | VRAM1. Also if there are ever
> more instances, then we have less places to update.
> 

Reviewed-by: José Roberto de Souza <jose.souza at intel.com>

> Suggested-by: José Roberto de Souza <jose.souza at intel.com>
> Signed-off-by: Matthew Auld <matthew.auld at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_bo.c | 8 +++-----
>  drivers/gpu/drm/xe/xe_bo.h | 2 ++
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
> index ab9cd9286f77..af4200aa949f 100644
> --- a/drivers/gpu/drm/xe/xe_bo.c
> +++ b/drivers/gpu/drm/xe/xe_bo.c
> @@ -987,8 +987,7 @@ struct xe_bo *__xe_bo_create_locked(struct xe_device *xe, struct xe_bo *bo,
>  	}
>  
>  	bo->requested_size = size;
> -	if (flags & (XE_BO_CREATE_VRAM0_BIT | XE_BO_CREATE_VRAM1_BIT |
> -		     XE_BO_CREATE_STOLEN_BIT) &&
> +	if (flags & (XE_BO_CREATE_VRAM_MASK | XE_BO_CREATE_STOLEN_BIT) &&
>  	    !(flags & XE_BO_CREATE_IGNORE_MIN_PAGE_SIZE_BIT) &&
>  	    xe->info.vram_flags & XE_VRAM_FLAGS_NEED64K) {
>  		size = ALIGN(size, SZ_64K);
> @@ -1052,8 +1051,7 @@ static int __xe_bo_fixed_placement(struct xe_device *xe,
>  	place->fpfn = start >> PAGE_SHIFT;
>  	place->lpfn = end >> PAGE_SHIFT;
>  
> -	switch (flags & (XE_BO_CREATE_STOLEN_BIT |
> -		XE_BO_CREATE_VRAM0_BIT |XE_BO_CREATE_VRAM1_BIT)) {
> +	switch (flags & (XE_BO_CREATE_STOLEN_BIT | XE_BO_CREATE_VRAM_MASK)) {
>  	case XE_BO_CREATE_VRAM0_BIT:
>  		place->mem_type = XE_PL_VRAM0;
>  		break;
> @@ -1759,7 +1757,7 @@ bool xe_bo_needs_ccs_pages(struct xe_bo *bo)
>  {
>  	return bo->ttm.type == ttm_bo_type_device &&
>  		!(bo->flags & XE_BO_CREATE_SYSTEM_BIT) &&
> -		(bo->flags & (XE_BO_CREATE_VRAM0_BIT | XE_BO_CREATE_VRAM1_BIT));
> +		(bo->flags & XE_BO_CREATE_VRAM_MASK);
>  }
>  
>  /**
> diff --git a/drivers/gpu/drm/xe/xe_bo.h b/drivers/gpu/drm/xe/xe_bo.h
> index f841e74cd417..3c3a09f47fb4 100644
> --- a/drivers/gpu/drm/xe/xe_bo.h
> +++ b/drivers/gpu/drm/xe/xe_bo.h
> @@ -17,6 +17,8 @@
>  #define XE_BO_CREATE_SYSTEM_BIT		BIT(1)
>  #define XE_BO_CREATE_VRAM0_BIT		BIT(2)
>  #define XE_BO_CREATE_VRAM1_BIT		BIT(3)
> +#define XE_BO_CREATE_VRAM_MASK		(XE_BO_CREATE_VRAM0_BIT | \
> +					 XE_BO_CREATE_VRAM1_BIT)
>  /* -- */
>  #define XE_BO_CREATE_STOLEN_BIT		BIT(4)
>  #define XE_BO_CREATE_VRAM_IF_DGFX(gt) \



More information about the Intel-xe mailing list