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.

Dependency Surface

Detected Declarations

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

Implementation Notes