drivers/gpu/drm/tegra/drm.h

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

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/tegra/drm.h
Extension
.h
Size
6349 bytes
Lines
215
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 tegra_drm {
	struct drm_device *drm;

	struct iommu_domain *domain;
	bool use_explicit_iommu;
	struct mutex mm_lock;
	struct drm_mm mm;

	struct {
		struct iova_domain domain;
		unsigned long shift;
		unsigned long limit;
	} carveout;

	struct mutex clients_lock;
	struct list_head clients;

	unsigned int hmask, vmask;
	unsigned int pitch_align;
	unsigned int num_crtcs;

	struct tegra_display_hub *hub;
};

static inline struct host1x *tegra_drm_to_host1x(struct tegra_drm *tegra)
{
	return dev_get_drvdata(tegra->drm->dev->parent);
}

struct tegra_drm_client;

struct tegra_drm_context {
	struct tegra_drm_client *client;
	struct host1x_channel *channel;

	/* Only used by legacy UAPI. */
	unsigned int id;

	/* Only used by new UAPI. */
	struct xarray mappings;
	struct host1x_memory_context *memory_context;
};

struct tegra_drm_client_ops {
	int (*open_channel)(struct tegra_drm_client *client,
			    struct tegra_drm_context *context);
	void (*close_channel)(struct tegra_drm_context *context);
	int (*is_addr_reg)(struct device *dev, u32 class, u32 offset);
	int (*is_valid_class)(u32 class);
	int (*submit)(struct tegra_drm_context *context,
		      struct drm_tegra_submit *args, struct drm_device *drm,
		      struct drm_file *file);
	int (*get_streamid_offset)(struct tegra_drm_client *client, u32 *offset);
	int (*can_use_memory_ctx)(struct tegra_drm_client *client, bool *supported);
};

int tegra_drm_submit(struct tegra_drm_context *context,
		     struct drm_tegra_submit *args, struct drm_device *drm,
		     struct drm_file *file);

static inline int
tegra_drm_get_streamid_offset_thi(struct tegra_drm_client *client, u32 *offset)
{
	*offset = 0x30;

	return 0;
}

struct tegra_drm_client {
	struct host1x_client base;
	struct list_head list;
	struct tegra_drm *drm;
	struct host1x_channel *shared_channel;

	/* Set by driver */
	unsigned int version;
	const struct tegra_drm_client_ops *ops;
};

static inline struct tegra_drm_client *
host1x_to_drm_client(struct host1x_client *client)
{
	return container_of(client, struct tegra_drm_client, base);
}

int tegra_drm_register_client(struct tegra_drm *tegra,
			      struct tegra_drm_client *client);
int tegra_drm_unregister_client(struct tegra_drm *tegra,
				struct tegra_drm_client *client);
int host1x_client_iommu_attach(struct host1x_client *client);

Annotation

Implementation Notes