drivers/media/platform/st/sti/delta/delta-v4l2.c

Source file repositories/reference/linux-study-clean/drivers/media/platform/st/sti/delta/delta-v4l2.c

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/st/sti/delta/delta-v4l2.c
Extension
.c
Size
49479 bytes
Lines
1968
Domain
Driver Families
Bucket
drivers/media
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

if (frame->state == DELTA_FRAME_FREE) {
			vbuf = &frame->vbuf;
			v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf);
			frame->state = DELTA_FRAME_M2M;
		}
	}
}

static int delta_recycle(struct delta_ctx *ctx, struct delta_frame *frame)
{
	const struct delta_dec *dec = ctx->dec;

	/* recycle frame on decoder side */
	call_dec_op(dec, recycle, ctx, frame);

	/* this frame is no more output */
	frame->state &= ~DELTA_FRAME_OUT;

	/* requeue free frame */
	if (frame->state == DELTA_FRAME_FREE) {
		struct vb2_v4l2_buffer *vbuf = &frame->vbuf;

		v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf);
		frame->state = DELTA_FRAME_M2M;
	}

	/* reset other frame fields */
	frame->flags = 0;
	frame->dts = 0;

	return 0;
}

static void delta_push_dts(struct delta_ctx *ctx, u64 val)
{
	struct delta_dts *dts;

	dts = kzalloc_obj(*dts);
	if (!dts)
		return;

	INIT_LIST_HEAD(&dts->list);

	/*
	 * protected by global lock acquired
	 * by V4L2 when calling delta_vb2_au_queue
	 */
	dts->val = val;
	list_add_tail(&dts->list, &ctx->dts);
}

static void delta_pop_dts(struct delta_ctx *ctx, u64 *val)
{
	struct delta_dev *delta = ctx->dev;
	struct delta_dts *dts;

	/*
	 * protected by global lock acquired
	 * by V4L2 when calling delta_vb2_au_queue
	 */
	if (list_empty(&ctx->dts)) {
		dev_warn(delta->dev, "%s no dts to pop ... output dts = 0\n",
			 ctx->name);
		*val = 0;
		return;
	}

	dts = list_first_entry(&ctx->dts, struct delta_dts, list);
	list_del(&dts->list);

	*val = dts->val;

	kfree(dts);
}

static void delta_flush_dts(struct delta_ctx *ctx)
{
	struct delta_dts *dts;
	struct delta_dts *next;

	/*
	 * protected by global lock acquired
	 * by V4L2 when calling delta_vb2_au_queue
	 */

	/* free all pending dts */
	list_for_each_entry_safe(dts, next, &ctx->dts, list)
		kfree(dts);

	/* reset list */

Annotation

Implementation Notes