Skip to content

Commit 339adeb

Browse files
author
Maarten Lankhorst
committed
drm/xe/display: Clarify XE_IOCTL_DBG message
This should make it easier to understand from userspace why importing BO fails. Reviewed-by: Stuart Summers <stuart.summers@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250117115305.53113-1-dev@lankhorst.se Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
1 parent b5fa091 commit 339adeb

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

drivers/gpu/drm/xe/display/intel_fb_bo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ int intel_fb_bo_framebuffer_init(struct intel_framebuffer *intel_fb,
5050
/*
5151
* XE_BO_FLAG_SCANOUT should ideally be set at creation, or is
5252
* automatically set when creating FB. We cannot change caching
53-
* mode when the boect is VM_BINDed, so we can only set
53+
* mode when the bo is VM_BINDed, so we can only set
5454
* coherency with display when unbound.
5555
*/
56-
if (XE_IOCTL_DBG(xe, !list_empty(&bo->ttm.base.gpuva.list))) {
56+
if (XE_IOCTL_DBG(xe, xe_bo_is_vm_bound(bo))) {
5757
ttm_bo_unreserve(&bo->ttm);
5858
ret = -EINVAL;
5959
goto err;

drivers/gpu/drm/xe/xe_bo.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,22 @@ bool xe_bo_is_stolen_devmem(struct xe_bo *bo)
128128
GRAPHICS_VERx100(xe_bo_device(bo)) >= 1270;
129129
}
130130

131+
/**
132+
* xe_bo_is_vm_bound - check if BO has any mappings through VM_BIND
133+
* @bo: The BO
134+
*
135+
* Check if a given bo is bound through VM_BIND. This requires the
136+
* reservation lock for the BO to be held.
137+
*
138+
* Returns: boolean
139+
*/
140+
bool xe_bo_is_vm_bound(struct xe_bo *bo)
141+
{
142+
xe_bo_assert_held(bo);
143+
144+
return !list_empty(&bo->ttm.base.gpuva.list);
145+
}
146+
131147
static bool xe_bo_is_user(struct xe_bo *bo)
132148
{
133149
return bo->flags & XE_BO_FLAG_USER;

drivers/gpu/drm/xe/xe_bo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ bool mem_type_is_vram(u32 mem_type);
241241
bool xe_bo_is_vram(struct xe_bo *bo);
242242
bool xe_bo_is_stolen(struct xe_bo *bo);
243243
bool xe_bo_is_stolen_devmem(struct xe_bo *bo);
244+
bool xe_bo_is_vm_bound(struct xe_bo *bo);
244245
bool xe_bo_has_single_placement(struct xe_bo *bo);
245246
uint64_t vram_region_gpu_offset(struct ttm_resource *res);
246247

0 commit comments

Comments
 (0)