[PATCH v2 6/7] drm/xe: allow non-contig VRAM kernel BO

K V P, Satyanarayana satyanarayana.k.v.p at intel.com
Thu Jan 23 09:09:28 UTC 2025


> -----Original Message-----
> From: Intel-xe <intel-xe-bounces at lists.freedesktop.org> On Behalf Of
> Matthew Auld
> Sent: Wednesday, December 18, 2024 5:49 PM
> To: intel-xe at lists.freedesktop.org
> Cc: Thomas Hellström <thomas.hellstrom at linux.intel.com>; Brost, Matthew
> <matthew.brost at intel.com>
> Subject: [PATCH v2 6/7] drm/xe: allow non-contig VRAM kernel BO
> 
> If the kernel bo doesn't care about vmap(), either directly or
> indirectly with save/restore then we don't need to force contig for such
> buffers.
> 
> Signed-off-by: Matthew Auld <matthew.auld at intel.com>
> Cc: Thomas Hellström <thomas.hellstrom at linux.intel.com>
> Cc: Matthew Brost <matthew.brost at intel.com>
> ---
Reviewed-by: Satyanarayana K V P <satyanarayana.k.v.p at intel.com>
>  drivers/gpu/drm/xe/xe_bo.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
> index 77918e30b904..9e5bb87a1b3c 100644
> --- a/drivers/gpu/drm/xe/xe_bo.c
> +++ b/drivers/gpu/drm/xe/xe_bo.c
> @@ -164,11 +164,17 @@ static void try_add_system(struct xe_device *xe,
> struct xe_bo *bo,
> 
>  static bool force_contiguous(u32 bo_flags)
>  {
> +	if (bo_flags & XE_BO_FLAG_STOLEN)
> +		return true; /* users expect this */
> +	else if (bo_flags & XE_BO_FLAG_PINNED_EARLY_RESTORE)
> +		return true; /* needs vmap */
> +
>  	/*
>  	 * For eviction / restore on suspend / resume objects pinned in VRAM
>  	 * must be contiguous, also only contiguous BOs support
> xe_bo_vmap.
>  	 */
> -	return bo_flags & (XE_BO_FLAG_PINNED | XE_BO_FLAG_GGTT);
> +	return bo_flags & XE_BO_FLAG_NEEDS_CPU_ACCESS &&
> +	       bo_flags & XE_BO_FLAG_PINNED;
>  }
> 
>  static void add_vram(struct xe_device *xe, struct xe_bo *bo,
> --
> 2.47.1



More information about the Intel-xe mailing list