drivers/gpu/drm/panthor/panthor_gem.h

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/panthor/panthor_gem.h

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/panthor/panthor_gem.h
Extension
.h
Size
9422 bytes
Lines
333
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 panthor_gem_debugfs {
	/**
	 * @node: Node used to insert the object in the device-wide list of
	 * GEM objects, to display information about it through a DebugFS file.
	 */
	struct list_head node;

	/** @creator: Information about the UM process which created the GEM. */
	struct {
		/** @creator.process_name: Group leader name in owning thread's process */
		char process_name[TASK_COMM_LEN];

		/** @creator.tgid: PID of the thread's group leader within its process */
		pid_t tgid;
	} creator;

	/** @flags: Combination of panthor_debugfs_gem_usage_flags flags */
	u32 flags;
};

/**
 * struct panthor_gem_backing - GEM memory backing related data
 */
struct panthor_gem_backing {
	/** @pages: Pages requested with drm_gem_get_pages() */
	struct page **pages;

	/** @pin_count: Number of active pin requests on this GEM */
	refcount_t pin_count;
};

/**
 * struct panthor_gem_cpu_map - GEM CPU mapping related data
 */
struct panthor_gem_cpu_map {
	/** @vaddr: Address returned by vmap() */
	void *vaddr;

	/** @vaddr_use_count: Number of active vmap() requests on this GEM */
	refcount_t vaddr_use_count;

	/** @mmap_count: Number of active mmap() requests on this GEM */
	refcount_t mmap_count;
};

/**
 * struct panthor_gem_dev_map - GEM device mapping related data
 */
struct panthor_gem_dev_map {
	/** @sgt: Device mapped sg_table for this GEM */
	struct sg_table *sgt;
};

/**
 * enum panthor_gem_reclaim_state - Reclaim state of a GEM object
 *
 * This is defined in descending reclaimability order and some part
 * of the code depends on that.
 */
enum panthor_gem_reclaim_state {
	/**
	 * @PANTHOR_GEM_UNUSED: GEM is currently unused
	 *
	 * This can happen when the GEM was previously vmap-ed, mmap-ed,
	 * and/or GPU mapped and got unmapped. Because pages are lazily
	 * returned to the shmem layer, we want to keep a list of such
	 * BOs, because they should be fairly easy to reclaim (no need
	 * to wait for GPU to be done, and no need to tear down user
	 * mappings either).
	 */
	PANTHOR_GEM_UNUSED,

	/**
	 * @PANTHOR_GEM_MMAPPED: GEM is currently mmap-ed
	 *
	 * When a GEM has pages allocated and the mmap_count is > 0, the
	 * GEM is placed in the mmapped list. This comes right after
	 * unused because we can relatively easily tear down user mappings.
	 */
	PANTHOR_GEM_MMAPPED,

	/**
	 * @PANTHOR_GEM_GPU_MAPPED_SINGLE_VM: GEM is GPU mapped to only one VM
	 *
	 * When a GEM is mapped to a single VM, reclaim requests have more
	 * chances to succeed, because we only need to synchronize against
	 * a single GPU context. This is more annoying than reclaiming
	 * mmap-ed pages still, because we have to wait for in-flight jobs
	 * to land, and we might not be able to acquire all necessary locks
	 * at reclaim time either.

Annotation

Implementation Notes