include/drm/ttm/ttm_resource.h
Source file repositories/reference/linux-study-clean/include/drm/ttm/ttm_resource.h
File Facts
- System
- Linux kernel
- Corpus path
include/drm/ttm/ttm_resource.h- Extension
.h- Size
- 16150 bytes
- Lines
- 527
- Domain
- Repository Root And Misc
- Bucket
- include
- Inferred role
- Repository Root And Misc: implementation source
- Status
- source implementation candidate
Why This File Exists
Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/list.hlinux/mutex.hlinux/iosys-map.hlinux/dma-fence.hdrm/ttm/ttm_caching.hdrm/ttm/ttm_kmap_iter.h
Detected Declarations
struct dentrystruct dmem_cgroup_devicestruct drm_printerstruct ttm_devicestruct ttm_resource_managerstruct ttm_resourcestruct ttm_placestruct ttm_buffer_objectstruct ttm_placementstruct iosys_mapstruct io_mappingstruct sg_tablestruct scatterliststruct ttm_lru_itemstruct ttm_resource_manager_funcstruct ttm_resource_managerstruct ttm_bus_placementstruct ttm_resourcestruct ttm_lru_bulk_move_posstruct ttm_lru_bulk_movestruct ttm_resource_cursorstruct ttm_kmap_iter_iomapstruct ttm_kmap_iter_linear_iostruct ttm_kmap_iter_linear_ioenum ttm_lru_item_typefunction ttm_lru_item_initfunction ttm_lru_item_is_resfunction ttm_lru_item_to_resfunction ttm_resource_manager_set_usedfunction ttm_resource_manager_usedfunction ttm_resource_manager_cleanup
Annotated Snippet
struct ttm_lru_item {
struct list_head link;
enum ttm_lru_item_type type;
};
/**
* ttm_lru_item_init() - initialize a struct ttm_lru_item
* @item: The item to initialize
* @type: The subclass type
*/
static inline void ttm_lru_item_init(struct ttm_lru_item *item,
enum ttm_lru_item_type type)
{
item->type = type;
INIT_LIST_HEAD(&item->link);
}
static inline bool ttm_lru_item_is_res(const struct ttm_lru_item *item)
{
return item->type == TTM_LRU_RESOURCE;
}
struct ttm_resource_manager_func {
/**
* struct ttm_resource_manager_func member alloc
*
* @man: Pointer to a memory type manager.
* @bo: Pointer to the buffer object we're allocating space for.
* @place: Placement details.
* @res: Resulting pointer to the ttm_resource.
*
* This function should allocate space in the memory type managed
* by @man. Placement details if applicable are given by @place. If
* successful, a filled in ttm_resource object should be returned in
* @res. @res::start should be set to a value identifying the beginning
* of the range allocated, and the function should return zero.
* If the manager can't fulfill the request -ENOSPC should be returned.
* If a system error occurred, preventing the request to be fulfilled,
* the function should return a negative error code.
*
* This function may not be called from within atomic context and needs
* to take care of its own locking to protect any data structures
* managing the space.
*/
int (*alloc)(struct ttm_resource_manager *man,
struct ttm_buffer_object *bo,
const struct ttm_place *place,
struct ttm_resource **res);
/**
* struct ttm_resource_manager_func member free
*
* @man: Pointer to a memory type manager.
* @res: Pointer to a struct ttm_resource to be freed.
*
* This function frees memory type resources previously allocated.
* May not be called from within atomic context.
*/
void (*free)(struct ttm_resource_manager *man,
struct ttm_resource *res);
/**
* struct ttm_resource_manager_func member intersects
*
* @man: Pointer to a memory type manager.
* @res: Pointer to a struct ttm_resource to be checked.
* @place: Placement to check against.
* @size: Size of the check.
*
* Test if @res intersects with @place + @size. Used to judge if
* evictions are valueable or not.
*/
bool (*intersects)(struct ttm_resource_manager *man,
struct ttm_resource *res,
const struct ttm_place *place,
size_t size);
/**
* struct ttm_resource_manager_func member compatible
*
* @man: Pointer to a memory type manager.
* @res: Pointer to a struct ttm_resource to be checked.
* @place: Placement to check against.
* @size: Size of the check.
*
* Test if @res compatible with @place + @size. Used to check of
* the need to move the backing store or not.
*/
bool (*compatible)(struct ttm_resource_manager *man,
struct ttm_resource *res,
Annotation
- Immediate include surface: `linux/types.h`, `linux/list.h`, `linux/mutex.h`, `linux/iosys-map.h`, `linux/dma-fence.h`, `drm/ttm/ttm_caching.h`, `drm/ttm/ttm_kmap_iter.h`.
- Detected declarations: `struct dentry`, `struct dmem_cgroup_device`, `struct drm_printer`, `struct ttm_device`, `struct ttm_resource_manager`, `struct ttm_resource`, `struct ttm_place`, `struct ttm_buffer_object`, `struct ttm_placement`, `struct iosys_map`.
- Atlas domain: Repository Root And Misc / include.
- 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.