drivers/gpu/drm/vmwgfx/ttm_object.h

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/vmwgfx/ttm_object.h

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/vmwgfx/ttm_object.h
Extension
.h
Size
10394 bytes
Lines
320
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct ttm_base_object {
	struct rcu_head rhead;
	struct ttm_object_file *tfile;
	struct kref refcount;
	void (*refcount_release) (struct ttm_base_object **base);
	u64 handle;
	enum ttm_object_type object_type;
	u32 shareable;
};


/**
 * struct ttm_prime_object - Modified base object that is prime-aware
 *
 * @base: struct ttm_base_object that we derive from
 * @mutex: Mutex protecting the @dma_buf member.
 * @size: Size of the dma_buf associated with this object
 * @real_type: Type of the underlying object. Needed since we're setting
 * the value of @base::object_type to ttm_prime_type
 * @dma_buf: Non ref-coutned pointer to a struct dma_buf created from this
 * object.
 * @refcount_release: The underlying object's release method. Needed since
 * we set @base::refcount_release to our own release method.
 */

struct ttm_prime_object {
	struct ttm_base_object base;
	struct mutex mutex;
	size_t size;
	enum ttm_object_type real_type;
	struct dma_buf *dma_buf;
	void (*refcount_release) (struct ttm_base_object **);
};

/**
 * ttm_base_object_init
 *
 * @tfile: Pointer to a struct ttm_object_file.
 * @base: The struct ttm_base_object to initialize.
 * @shareable: This object is shareable with other applications.
 * (different @tfile pointers.)
 * @type: The object type.
 * @refcount_release: See the struct ttm_base_object description.
 * @ref_obj_release: See the struct ttm_base_object description.
 *
 * Initializes a struct ttm_base_object.
 */

extern int ttm_base_object_init(struct ttm_object_file *tfile,
				struct ttm_base_object *base,
				bool shareable,
				enum ttm_object_type type,
				void (*refcount_release) (struct ttm_base_object
							  **));

/**
 * ttm_base_object_lookup
 *
 * @tfile: Pointer to a struct ttm_object_file.
 * @key: Hash key
 *
 * Looks up a struct ttm_base_object with the key @key.
 */

extern struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file
						      *tfile, uint64_t key);

/**
 * ttm_base_object_lookup_for_ref
 *
 * @tdev: Pointer to a struct ttm_object_device.
 * @key: Hash key
 *
 * Looks up a struct ttm_base_object with the key @key.
 * This function should only be used when the struct tfile associated with the
 * caller doesn't yet have a reference to the base object.
 */

extern struct ttm_base_object *
ttm_base_object_lookup_for_ref(struct ttm_object_device *tdev, uint64_t key);

/**
 * ttm_base_object_unref
 *
 * @p_base: Pointer to a pointer referencing a struct ttm_base_object.
 *
 * Decrements the base object refcount and clears the pointer pointed to by
 * p_base.
 */

Annotation

Implementation Notes