drivers/gpu/drm/xe/display/xe_display_bo.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/display/xe_display_bo.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xe/display/xe_display_bo.c- Extension
.c- Size
- 6237 bytes
- Lines
- 233
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/fb.hdrm/drm_gem.hdrm/intel/display_parent_interface.hintel_fb.hxe_bo.hxe_display_bo.hxe_pxp.hxe_ttm_stolen_mgr.hxe_wa.hgenerated/xe_device_wa_oob.h
Detected Declarations
function xe_display_bo_is_protectedfunction xe_display_bo_read_from_pagefunction xe_display_bo_framebuffer_initfunction xe_display_bo_framebuffer_finifunction xe_display_bo_framebuffer_lookupfunction xe_display_bo_fbdev_pitch_alignfunction xe_display_bo_fbdev_prefer_stolenfunction xe_display_bo_fbdev_destroyfunction xe_display_bo_fbdev_fill_info
Annotated Snippet
if (XE_IOCTL_DBG(xe, xe_bo_is_vm_bound(bo))) {
ttm_bo_unreserve(&bo->ttm);
ret = -EINVAL;
goto err;
}
bo->flags |= XE_BO_FLAG_FORCE_WC;
}
ttm_bo_unreserve(&bo->ttm);
return 0;
err:
xe_bo_put(bo);
return ret;
}
static void xe_display_bo_framebuffer_fini(struct drm_gem_object *obj)
{
struct xe_bo *bo = gem_to_xe_bo(obj);
if (bo->flags & XE_BO_FLAG_PINNED) {
/* Unpin our kernel fb first */
xe_bo_lock(bo, false);
xe_bo_unpin(bo);
xe_bo_unlock(bo);
}
xe_bo_put(bo);
}
static struct drm_gem_object *
xe_display_bo_framebuffer_lookup(struct drm_device *drm,
struct drm_file *filp,
const struct drm_mode_fb_cmd2 *mode_cmd)
{
struct xe_device *xe = to_xe_device(drm);
struct xe_bo *bo;
struct drm_gem_object *gem = drm_gem_object_lookup(filp, mode_cmd->handles[0]);
if (!gem)
return ERR_PTR(-ENOENT);
bo = gem_to_xe_bo(gem);
/* Require vram placement or dma-buf import */
if (IS_DGFX(xe) &&
!xe_bo_can_migrate(bo, XE_PL_VRAM0) &&
bo->ttm.type != ttm_bo_type_sg) {
drm_gem_object_put(gem);
return ERR_PTR(-EREMOTE);
}
return gem;
}
#if IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION)
/*
* FIXME: There shouldn't be any reason to have XE_PAGE_SIZE stride
* alignment. The same 64 as i915 uses should be fine, and we shouldn't need to
* have driver specific values. However, dropping the stride alignment to 64
* leads to underflowing the bo pin count in the atomic cleanup work.
*/
static u32 xe_display_bo_fbdev_pitch_align(u32 stride)
{
return ALIGN(stride, XE_PAGE_SIZE);
}
bool xe_display_bo_fbdev_prefer_stolen(struct xe_device *xe, unsigned int size)
{
struct ttm_resource_manager *stolen;
stolen = ttm_manager_type(&xe->ttm, XE_PL_STOLEN);
if (!stolen)
return false;
if (IS_DGFX(xe))
return false;
if (XE_DEVICE_WA(xe, 22019338487_display))
return false;
/*
* If the FB is too big, just don't use it since fbdev is not very
* important and we should probably use that space with FBC or other
* features.
*/
return stolen->size >= (size * 2) >> PAGE_SHIFT;
}
static struct drm_gem_object *xe_display_bo_fbdev_create(struct drm_device *drm, int size)
{
struct xe_device *xe = to_xe_device(drm);
struct xe_bo *obj;
Annotation
- Immediate include surface: `linux/fb.h`, `drm/drm_gem.h`, `drm/intel/display_parent_interface.h`, `intel_fb.h`, `xe_bo.h`, `xe_display_bo.h`, `xe_pxp.h`, `xe_ttm_stolen_mgr.h`.
- Detected declarations: `function xe_display_bo_is_protected`, `function xe_display_bo_read_from_page`, `function xe_display_bo_framebuffer_init`, `function xe_display_bo_framebuffer_fini`, `function xe_display_bo_framebuffer_lookup`, `function xe_display_bo_fbdev_pitch_align`, `function xe_display_bo_fbdev_prefer_stolen`, `function xe_display_bo_fbdev_destroy`, `function xe_display_bo_fbdev_fill_info`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.