Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/xe: Extract xe_bo_is_visible_vram

This will make it possible to call from xe_display code.

Reviewed-by: Francois Dugast <francois.dugast@intel.com>
Link: https://lore.kernel.org/r/20251016075701.379023-2-jfalempe@redhat.com
Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>

+19 -1
+18 -1
drivers/gpu/drm/xe/xe_bo.c
··· 609 609 return vres->used_visible_size == mem->size; 610 610 } 611 611 612 + /** 613 + * xe_bo_is_visible_vram - check if BO is placed entirely in visible VRAM. 614 + * @bo: The BO 615 + * 616 + * This function checks whether a given BO resides entirely in memory visible from the CPU 617 + * 618 + * Returns: true if the BO is entirely visible, false otherwise. 619 + * 620 + */ 621 + bool xe_bo_is_visible_vram(struct xe_bo *bo) 622 + { 623 + if (drm_WARN_ON(bo->ttm.base.dev, !xe_bo_is_vram(bo))) 624 + return false; 625 + 626 + return xe_ttm_resource_visible(bo->ttm.resource); 627 + } 628 + 612 629 static int xe_ttm_io_mem_reserve(struct ttm_device *bdev, 613 630 struct ttm_resource *mem) 614 631 { ··· 1651 1634 if (!mem_type_is_vram(ttm_bo->resource->mem_type)) 1652 1635 return -EIO; 1653 1636 1654 - if (!xe_ttm_resource_visible(ttm_bo->resource) || len >= SZ_16K) { 1637 + if (!xe_bo_is_visible_vram(bo) || len >= SZ_16K) { 1655 1638 struct xe_migrate *migrate = 1656 1639 mem_type_to_migrate(xe, ttm_bo->resource->mem_type); 1657 1640
+1
drivers/gpu/drm/xe/xe_bo.h
··· 274 274 275 275 bool mem_type_is_vram(u32 mem_type); 276 276 bool xe_bo_is_vram(struct xe_bo *bo); 277 + bool xe_bo_is_visible_vram(struct xe_bo *bo); 277 278 bool xe_bo_is_stolen(struct xe_bo *bo); 278 279 bool xe_bo_is_stolen_devmem(struct xe_bo *bo); 279 280 bool xe_bo_is_vm_bound(struct xe_bo *bo);