drivers/gpu/drm/imagination/pvr_context.h

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

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/imagination/pvr_context.h
Extension
.h
Size
5683 bytes
Lines
227
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 pvr_context {
	/** @ref_count: Refcount for context. */
	struct kref ref_count;

	/** @pvr_dev: Pointer to owning device. */
	struct pvr_device *pvr_dev;

	/** @vm_ctx: Pointer to associated VM context. */
	struct pvr_vm_context *vm_ctx;

	/** @type: Type of context. */
	enum drm_pvr_ctx_type type;

	/** @flags: Context flags. */
	u32 flags;

	/** @priority: Context priority*/
	enum pvr_context_priority priority;

	/** @fw_obj: FW object representing FW-side context data. */
	struct pvr_fw_object *fw_obj;

	/** @data: Pointer to local copy of FW context data. */
	void *data;

	/** @data_size: Size of FW context data, in bytes. */
	u32 data_size;

	/** @ctx_id: FW context ID. */
	u32 ctx_id;

	/**
	 * @faulty: Set to 1 when the context queues had unfinished job when
	 * a GPU reset happened.
	 *
	 * In that case, the context is in an inconsistent state and can't be
	 * used anymore.
	 */
	atomic_t faulty;

	/** @queues: Union containing all kind of queues. */
	union {
		struct {
			/** @geometry: Geometry queue. */
			struct pvr_queue *geometry;

			/** @fragment: Fragment queue. */
			struct pvr_queue *fragment;
		};

		/** @compute: Compute queue. */
		struct pvr_queue *compute;

		/** @compute: Transfer queue. */
		struct pvr_queue *transfer;
	} queues;

	/** @file_link: pvr_file PVR context list link. */
	struct list_head file_link;
};

static __always_inline struct pvr_queue *
pvr_context_get_queue_for_job(struct pvr_context *ctx, enum drm_pvr_job_type type)
{
	switch (type) {
	case DRM_PVR_JOB_TYPE_GEOMETRY:
		return ctx->type == DRM_PVR_CTX_TYPE_RENDER ? ctx->queues.geometry : NULL;
	case DRM_PVR_JOB_TYPE_FRAGMENT:
		return ctx->type == DRM_PVR_CTX_TYPE_RENDER ? ctx->queues.fragment : NULL;
	case DRM_PVR_JOB_TYPE_COMPUTE:
		return ctx->type == DRM_PVR_CTX_TYPE_COMPUTE ? ctx->queues.compute : NULL;
	case DRM_PVR_JOB_TYPE_TRANSFER_FRAG:
		return ctx->type == DRM_PVR_CTX_TYPE_TRANSFER_FRAG ? ctx->queues.transfer : NULL;
	}

	return NULL;
}

/**
 * pvr_context_get() - Take additional reference on context.
 * @ctx: Context pointer.
 *
 * Call pvr_context_put() to release.
 *
 * Returns:
 *  * The requested context on success, or
 *  * %NULL if no context pointer passed.
 */
static __always_inline struct pvr_context *
pvr_context_get(struct pvr_context *ctx)

Annotation

Implementation Notes