drivers/gpu/drm/omapdrm/tcm.h

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/omapdrm/tcm.h

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/omapdrm/tcm.h
Extension
.h
Size
10231 bytes
Lines
331
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 tcm_pt {
	u16 x;
	u16 y;
};

/* 1d or 2d area */
struct tcm_area {
	bool is2d;		/* whether area is 1d or 2d */
	struct tcm    *tcm;	/* parent */
	struct tcm_pt  p0;
	struct tcm_pt  p1;
};

struct tcm {
	u16 width, height;	/* container dimensions */
	int lut_id;		/* Lookup table identifier */

	unsigned int y_offset;	/* offset to use for y coordinates */

	spinlock_t lock;
	unsigned long *bitmap;
	size_t map_size;

	/* function table */
	s32 (*reserve_2d)(struct tcm *tcm, u16 height, u16 width, u16 align,
			  s16 offset, u16 slot_bytes,
			  struct tcm_area *area);
	s32 (*reserve_1d)(struct tcm *tcm, u32 slots, struct tcm_area *area);
	s32 (*free)(struct tcm *tcm, struct tcm_area *area);
	void (*deinit)(struct tcm *tcm);
};

/*=============================================================================
    BASIC TILER CONTAINER MANAGER INTERFACE
=============================================================================*/

/*
 * NOTE:
 *
 * Since some basic parameter checking is done outside the TCM algorithms,
 * TCM implementation do NOT have to check the following:
 *
 *   area pointer is NULL
 *   width and height fits within container
 *   number of pages is more than the size of the container
 *
 */

struct tcm *sita_init(u16 width, u16 height);


/**
 * Deinitialize tiler container manager.
 *
 * @param tcm	Pointer to container manager.
 *
 * @return 0 on success, non-0 error value on error.  The call
 *	   should free as much memory as possible and meaningful
 *	   even on failure.  Some error codes: -ENODEV: invalid
 *	   manager.
 */
static inline void tcm_deinit(struct tcm *tcm)
{
	if (tcm)
		tcm->deinit(tcm);
}

/**
 * Reserves a 2D area in the container.
 *
 * @param tcm		Pointer to container manager.
 * @param height	Height(in pages) of area to be reserved.
 * @param width		Width(in pages) of area to be reserved.
 * @param align		Alignment requirement for top-left corner of area. Not
 *			all values may be supported by the container manager,
 *			but it must support 0 (1), 32 and 64.
 *			0 value is equivalent to 1.
 * @param offset	Offset requirement, in bytes.  This is the offset
 *			from a 4KiB aligned virtual address.
 * @param slot_bytes	Width of slot in bytes
 * @param area		Pointer to where the reserved area should be stored.
 *
 * @return 0 on success.  Non-0 error code on failure.  Also,
 *	   the tcm field of the area will be set to NULL on
 *	   failure.  Some error codes: -ENODEV: invalid manager,
 *	   -EINVAL: invalid area, -ENOMEM: not enough space for
 *	    allocation.
 */
static inline s32 tcm_reserve_2d(struct tcm *tcm, u16 width, u16 height,
				u16 align, s16 offset, u16 slot_bytes,

Annotation

Implementation Notes