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

Commit 5e8dbbf3 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab
Browse files

[media] v4l: vsp1: Pass display list explicitly to configure functions



Modules write register values to the active display list pointed to by
the pipeline. In order to support preparing display lists ahead of time,
pass them explicitly to all configuration functions.

Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent b911605d
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@

#include "vsp1.h"
#include "vsp1_bru.h"
#include "vsp1_dl.h"
#include "vsp1_rwpf.h"
#include "vsp1_video.h"

@@ -28,9 +29,10 @@
 * Device Access
 */

static inline void vsp1_bru_write(struct vsp1_bru *bru, u32 reg, u32 data)
static inline void vsp1_bru_write(struct vsp1_bru *bru, struct vsp1_dl_list *dl,
				  u32 reg, u32 data)
{
	vsp1_mod_write(&bru->entity, reg, data);
	vsp1_dl_list_write(dl, reg, data);
}

/* -----------------------------------------------------------------------------
@@ -303,7 +305,7 @@ static struct v4l2_subdev_ops bru_ops = {
 * VSP1 Entity Operations
 */

static void bru_configure(struct vsp1_entity *entity)
static void bru_configure(struct vsp1_entity *entity, struct vsp1_dl_list *dl)
{
	struct vsp1_pipeline *pipe = to_vsp1_pipeline(&entity->subdev.entity);
	struct vsp1_bru *bru = to_bru(&entity->subdev);
@@ -324,26 +326,26 @@ static void bru_configure(struct vsp1_entity *entity)
	 * format at the pipeline output is premultiplied.
	 */
	flags = pipe->output ? pipe->output->format.flags : 0;
	vsp1_bru_write(bru, VI6_BRU_INCTRL,
	vsp1_bru_write(bru, dl, VI6_BRU_INCTRL,
		       flags & V4L2_PIX_FMT_FLAG_PREMUL_ALPHA ?
		       0 : VI6_BRU_INCTRL_NRM);

	/* Set the background position to cover the whole output image and
	 * configure its color.
	 */
	vsp1_bru_write(bru, VI6_BRU_VIRRPF_SIZE,
	vsp1_bru_write(bru, dl, VI6_BRU_VIRRPF_SIZE,
		       (format->width << VI6_BRU_VIRRPF_SIZE_HSIZE_SHIFT) |
		       (format->height << VI6_BRU_VIRRPF_SIZE_VSIZE_SHIFT));
	vsp1_bru_write(bru, VI6_BRU_VIRRPF_LOC, 0);
	vsp1_bru_write(bru, dl, VI6_BRU_VIRRPF_LOC, 0);

	vsp1_bru_write(bru, VI6_BRU_VIRRPF_COL, bru->bgcolor |
	vsp1_bru_write(bru, dl, VI6_BRU_VIRRPF_COL, bru->bgcolor |
		       (0xff << VI6_BRU_VIRRPF_COL_A_SHIFT));

	/* Route BRU input 1 as SRC input to the ROP unit and configure the ROP
	 * unit with a NOP operation to make BRU input 1 available as the
	 * Blend/ROP unit B SRC input.
	 */
	vsp1_bru_write(bru, VI6_BRU_ROP, VI6_BRU_ROP_DSTSEL_BRUIN(1) |
	vsp1_bru_write(bru, dl, VI6_BRU_ROP, VI6_BRU_ROP_DSTSEL_BRUIN(1) |
		       VI6_BRU_ROP_CROP(VI6_ROP_NOP) |
		       VI6_BRU_ROP_AROP(VI6_ROP_NOP));

@@ -380,7 +382,7 @@ static void bru_configure(struct vsp1_entity *entity)
		if (i != 1)
			ctrl |= VI6_BRU_CTRL_SRCSEL_BRUIN(i);

		vsp1_bru_write(bru, VI6_BRU_CTRL(i), ctrl);
		vsp1_bru_write(bru, dl, VI6_BRU_CTRL(i), ctrl);

		/* Harcode the blending formula to
		 *
@@ -394,7 +396,7 @@ static void bru_configure(struct vsp1_entity *entity)
		 *
		 * otherwise.
		 */
		vsp1_bru_write(bru, VI6_BRU_BLD(i),
		vsp1_bru_write(bru, dl, VI6_BRU_BLD(i),
			       VI6_BRU_BLD_CCMDX_255_SRC_A |
			       (premultiplied ? VI6_BRU_BLD_CCMDY_COEFY :
						VI6_BRU_BLD_CCMDY_SRC_A) |
+6 −8
Original line number Diff line number Diff line
@@ -455,24 +455,22 @@ void vsp1_du_atomic_flush(struct device *dev)
			struct vsp1_rwpf *rpf = to_rwpf(&entity->subdev);

			if (!pipe->inputs[rpf->entity.index]) {
				vsp1_mod_write(entity, entity->route->reg,
				vsp1_dl_list_write(pipe->dl, entity->route->reg,
						   VI6_DPR_NODE_UNUSED);
				continue;
			}
		}

		vsp1_entity_route_setup(entity);
		vsp1_entity_route_setup(entity, pipe->dl);

		if (entity->ops->configure)
			entity->ops->configure(entity);
			entity->ops->configure(entity, pipe->dl);

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

	/* We know that the WPF s_stream operation never fails. */
	v4l2_subdev_call(&pipe->output->entity.subdev, video, s_stream, 1);

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

+4 −11
Original line number Diff line number Diff line
@@ -21,16 +21,9 @@
#include "vsp1.h"
#include "vsp1_dl.h"
#include "vsp1_entity.h"
#include "vsp1_pipe.h"

void vsp1_mod_write(struct vsp1_entity *e, u32 reg, u32 data)
{
	struct vsp1_pipeline *pipe = to_vsp1_pipeline(&e->subdev.entity);

	vsp1_dl_list_write(pipe->dl, reg, data);
}

void vsp1_entity_route_setup(struct vsp1_entity *source)
void vsp1_entity_route_setup(struct vsp1_entity *source,
			     struct vsp1_dl_list *dl)
{
	struct vsp1_entity *sink;

@@ -38,7 +31,7 @@ void vsp1_entity_route_setup(struct vsp1_entity *source)
		return;

	sink = container_of(source->sink, struct vsp1_entity, subdev.entity);
	vsp1_mod_write(source, source->route->reg,
	vsp1_dl_list_write(dl, source->route->reg,
			   sink->route->inputs[source->sink_pad]);
}

+7 −7
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <media/v4l2-subdev.h>

struct vsp1_device;
struct vsp1_dl_list;

enum vsp1_entity_type {
	VSP1_ENTITY_BRU,
@@ -57,15 +58,15 @@ struct vsp1_route {
 * struct vsp1_entity_operations - Entity operations
 * @destroy:	Destroy the entity.
 * @set_memory:	Setup memory buffer access. This operation applies the settings
 *		stored in the rwpf mem field to the hardware. Valid for RPF and
 *		WPF only.
 *		stored in the rwpf mem field to the display list. Valid for RPF
 *		and WPF only.
 * @configure:	Setup the hardware based on the entity state (pipeline, formats,
 *		selection rectangles, ...)
 */
struct vsp1_entity_operations {
	void (*destroy)(struct vsp1_entity *);
	void (*set_memory)(struct vsp1_entity *);
	void (*configure)(struct vsp1_entity *);
	void (*set_memory)(struct vsp1_entity *, struct vsp1_dl_list *dl);
	void (*configure)(struct vsp1_entity *, struct vsp1_dl_list *dl);
};

struct vsp1_entity {
@@ -121,8 +122,7 @@ vsp1_entity_get_pad_compose(struct vsp1_entity *entity,
int vsp1_entity_init_cfg(struct v4l2_subdev *subdev,
			 struct v4l2_subdev_pad_config *cfg);

void vsp1_entity_route_setup(struct vsp1_entity *source);

void vsp1_mod_write(struct vsp1_entity *e, u32 reg, u32 data);
void vsp1_entity_route_setup(struct vsp1_entity *source,
			     struct vsp1_dl_list *dl);

#endif /* __VSP1_ENTITY_H__ */
+7 −5
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include <media/v4l2-subdev.h>

#include "vsp1.h"
#include "vsp1_dl.h"
#include "vsp1_hsit.h"

#define HSIT_MIN_SIZE				4U
@@ -26,9 +27,10 @@
 * Device Access
 */

static inline void vsp1_hsit_write(struct vsp1_hsit *hsit, u32 reg, u32 data)
static inline void vsp1_hsit_write(struct vsp1_hsit *hsit,
				   struct vsp1_dl_list *dl, u32 reg, u32 data)
{
	vsp1_mod_write(&hsit->entity, reg, data);
	vsp1_dl_list_write(dl, reg, data);
}

/* -----------------------------------------------------------------------------
@@ -164,14 +166,14 @@ static struct v4l2_subdev_ops hsit_ops = {
 * VSP1 Entity Operations
 */

static void hsit_configure(struct vsp1_entity *entity)
static void hsit_configure(struct vsp1_entity *entity, struct vsp1_dl_list *dl)
{
	struct vsp1_hsit *hsit = to_hsit(&entity->subdev);

	if (hsit->inverse)
		vsp1_hsit_write(hsit, VI6_HSI_CTRL, VI6_HSI_CTRL_EN);
		vsp1_hsit_write(hsit, dl, VI6_HSI_CTRL, VI6_HSI_CTRL_EN);
	else
		vsp1_hsit_write(hsit, VI6_HST_CTRL, VI6_HST_CTRL_EN);
		vsp1_hsit_write(hsit, dl, VI6_HST_CTRL, VI6_HST_CTRL_EN);
}

static const struct vsp1_entity_operations hsit_entity_ops = {
Loading