Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 351bbf99 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab
Browse files

[media] v4l: vsp1: Use display lists with the userspace API



Don't restrict display list usage to the DRM pipeline, use them
unconditionally. This prepares the driver to support the request API.

Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 12161989
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -311,14 +311,15 @@ void vsp1_dlm_irq_frame_end(struct vsp1_dl_manager *dlm)
/* Hardware Setup */
void vsp1_dlm_setup(struct vsp1_device *vsp1)
{
	u32 ctrl = (256 << VI6_DL_CTRL_AR_WAIT_SHIFT);
	u32 ctrl = (256 << VI6_DL_CTRL_AR_WAIT_SHIFT)
		 | VI6_DL_CTRL_DC2 | VI6_DL_CTRL_DC1 | VI6_DL_CTRL_DC0
		 | VI6_DL_CTRL_DLE;

	/* The DRM pipeline operates with header-less display lists in
	 * Continuous Frame Mode.
	/* The DRM pipeline operates with display lists in Continuous Frame
	 * Mode, all other pipelines use manual start.
	 */
	if (vsp1->drm)
		ctrl |= VI6_DL_CTRL_DC2 | VI6_DL_CTRL_DC1 | VI6_DL_CTRL_DC0
		     |  VI6_DL_CTRL_DLE | VI6_DL_CTRL_CFM0 | VI6_DL_CTRL_NH0;
		ctrl |= VI6_DL_CTRL_CFM0 | VI6_DL_CTRL_NH0;

	vsp1_write(vsp1, VI6_DL_CTRL, ctrl);
	vsp1_write(vsp1, VI6_DL_SWAP, VI6_DL_SWAP_LWS);
+8 −15
Original line number Diff line number Diff line
@@ -36,11 +36,6 @@ void vsp1_drm_display_start(struct vsp1_device *vsp1)
	vsp1_dlm_irq_display_start(vsp1->drm->pipe.output->dlm);
}

static void vsp1_drm_frame_end(struct vsp1_pipeline *pipe)
{
	vsp1_dlm_irq_frame_end(pipe->output->dlm);
}

/* -----------------------------------------------------------------------------
 * DU Driver API
 */
@@ -280,7 +275,6 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index,
	const struct vsp1_format_info *fmtinfo;
	struct v4l2_subdev_selection sel;
	struct v4l2_subdev_format format;
	struct vsp1_rwpf_memory memory;
	struct vsp1_rwpf *rpf;
	unsigned long flags;
	int ret;
@@ -420,15 +414,12 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int rpf_index,
	rpf->location.left = dst->left;
	rpf->location.top = dst->top;

	/* Set the memory buffer address but don't apply the values to the
	/* Cache the memory buffer address but don't apply the values to the
	 * hardware as the crop offsets haven't been computed yet.
	 */
	memory.num_planes = fmtinfo->planes;
	memory.addr[0] = mem[0];
	memory.addr[1] = mem[1];
	memory.addr[2] = 0;

	vsp1_rwpf_set_memory(rpf, &memory, false);
	rpf->mem.addr[0] = mem[0];
	rpf->mem.addr[1] = mem[1];
	rpf->mem.addr[2] = 0;

	spin_lock_irqsave(&pipe->irqlock, flags);

@@ -482,14 +473,17 @@ void vsp1_du_atomic_flush(struct device *dev)
				entity->subdev.name);
			return;
		}

		if (entity->type == VSP1_ENTITY_RPF)
			vsp1_rwpf_set_memory(to_rwpf(&entity->subdev));
	}

	vsp1_dl_list_commit(pipe->dl);
	pipe->dl = NULL;

	/* Start or stop the pipeline if needed. */
	spin_lock_irqsave(&pipe->irqlock, flags);

	/* Start or stop the pipeline if needed. */
	if (!vsp1->drm->num_inputs && pipe->num_inputs) {
		vsp1_write(vsp1, VI6_DISP_IRQ_STA, 0);
		vsp1_write(vsp1, VI6_DISP_IRQ_ENB, VI6_DISP_IRQ_ENB_DSTE);
@@ -569,7 +563,6 @@ int vsp1_drm_init(struct vsp1_device *vsp1)
	pipe = &vsp1->drm->pipe;

	vsp1_pipeline_init(pipe);
	pipe->frame_end = vsp1_drm_frame_end;

	/* The DRM pipeline is static, add entities manually. */
	for (i = 0; i < vsp1->info->rpf_count; ++i) {
+1 −4
Original line number Diff line number Diff line
@@ -27,10 +27,7 @@ void vsp1_mod_write(struct vsp1_entity *e, u32 reg, u32 data)
{
	struct vsp1_pipeline *pipe = to_vsp1_pipeline(&e->subdev.entity);

	if (pipe->dl)
	vsp1_dl_list_write(pipe->dl, reg, data);
	else
		vsp1_write(e->vsp1, reg, data);
}

void vsp1_entity_route_setup(struct vsp1_entity *source)
+2 −31
Original line number Diff line number Diff line
@@ -273,42 +273,13 @@ bool vsp1_pipeline_ready(struct vsp1_pipeline *pipe)

void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe)
{
	enum vsp1_pipeline_state state;
	unsigned long flags;

	if (pipe == NULL)
		return;

	/* Signal frame end to the pipeline handler. */
	vsp1_dlm_irq_frame_end(pipe->output->dlm);

	if (pipe->frame_end)
		pipe->frame_end(pipe);

	spin_lock_irqsave(&pipe->irqlock, flags);

	state = pipe->state;

	/* When using display lists in continuous frame mode the pipeline is
	 * automatically restarted by the hardware.
	 */
	if (pipe->lif)
		goto done;

	pipe->state = VSP1_PIPELINE_STOPPED;

	/* If a stop has been requested, mark the pipeline as stopped and
	 * return.
	 */
	if (state == VSP1_PIPELINE_STOPPING) {
		wake_up(&pipe->wq);
		goto done;
	}

	/* Restart the pipeline if ready. */
	if (vsp1_pipeline_ready(pipe))
		vsp1_pipeline_run(pipe);

done:
	spin_unlock_irqrestore(&pipe->irqlock, flags);
}

/*
+3 −6
Original line number Diff line number Diff line
@@ -78,9 +78,6 @@ static int rpf_s_stream(struct v4l2_subdev *subdev, int enable)

	vsp1_rpf_write(rpf, VI6_RPF_SRCM_PSTRIDE, pstride);

	/* Now that the offsets have been computed program the DMA addresses. */
	rpf->ops->set_memory(rpf);

	/* Format */
	infmt = VI6_RPF_INFMT_CIPM
	      | (fmtinfo->hwfmt << VI6_RPF_INFMT_RDFMT_SHIFT);
@@ -150,11 +147,11 @@ static struct v4l2_subdev_ops rpf_ops = {
static void rpf_set_memory(struct vsp1_rwpf *rpf)
{
	vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_Y,
		       rpf->buf_addr[0] + rpf->offsets[0]);
		       rpf->mem.addr[0] + rpf->offsets[0]);
	vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_C0,
		       rpf->buf_addr[1] + rpf->offsets[1]);
		       rpf->mem.addr[1] + rpf->offsets[1]);
	vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_C1,
		       rpf->buf_addr[2] + rpf->offsets[1]);
		       rpf->mem.addr[2] + rpf->offsets[1]);
}

static const struct vsp1_rwpf_operations rpf_vdev_ops = {
Loading