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

[media] v4l: vsp1: Pass parameter type to entity configuration operation



Replace the current boolean parameter (full / !full) with an explicit
enum.

- VSP1_ENTITY_PARAMS_INIT for parameters to be configured at pipeline
  initialization time only (V4L2 stream on or DRM atomic update)
- VSP1_ENTITY_PARAMS_RUNTIME for all parameters that can be freely
  modified at runtime (through V4L2 controls)

This will allow future extensions when implementing image partitioning
support.

Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent abe9609f
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -285,14 +285,15 @@ static const struct v4l2_subdev_ops bru_ops = {

static void bru_configure(struct vsp1_entity *entity,
			  struct vsp1_pipeline *pipe,
			  struct vsp1_dl_list *dl, bool full)
			  struct vsp1_dl_list *dl,
			  enum vsp1_entity_params params)
{
	struct vsp1_bru *bru = to_bru(&entity->subdev);
	struct v4l2_mbus_framefmt *format;
	unsigned int flags;
	unsigned int i;

	if (!full)
	if (params != VSP1_ENTITY_PARAMS_INIT)
		return;

	format = vsp1_entity_get_pad_format(&bru->entity, bru->entity.config,
+24 −19
Original line number Diff line number Diff line
@@ -214,27 +214,30 @@ static const struct v4l2_subdev_ops clu_ops = {

static void clu_configure(struct vsp1_entity *entity,
			  struct vsp1_pipeline *pipe,
			  struct vsp1_dl_list *dl, bool full)
			  struct vsp1_dl_list *dl,
			  enum vsp1_entity_params params)
{
	struct vsp1_clu *clu = to_clu(&entity->subdev);
	struct vsp1_dl_body *dlb;
	unsigned long flags;
	u32 ctrl = VI6_CLU_CTRL_AAI | VI6_CLU_CTRL_MVS | VI6_CLU_CTRL_EN;

	/* The format can't be changed during streaming, only verify it at
	 * stream start and store the information internally for future partial
	 * reconfiguration calls.
	switch (params) {
	case VSP1_ENTITY_PARAMS_INIT: {
		/* The format can't be changed during streaming, only verify it
		 * at setup time and store the information internally for future
		 * runtime configuration calls.
		 */
	if (full) {
		struct v4l2_mbus_framefmt *format;

		format = vsp1_entity_get_pad_format(&clu->entity,
						    clu->entity.config,
						    CLU_PAD_SINK);
		clu->yuv_mode = format->code == MEDIA_BUS_FMT_AYUV8_1X32;
		return;
		break;
	}

	case VSP1_ENTITY_PARAMS_RUNTIME:
		/* 2D mode can only be used with the YCbCr pixel encoding. */
		if (clu->mode == V4L2_CID_VSP1_CLU_MODE_2D && clu->yuv_mode)
			ctrl |= VI6_CLU_CTRL_AX1I_2D | VI6_CLU_CTRL_AX2I_2D
@@ -250,6 +253,8 @@ static void clu_configure(struct vsp1_entity *entity,

		if (dlb)
			vsp1_dl_list_add_fragment(dl, dlb);
		break;
	}
}

static const struct vsp1_entity_operations clu_entity_ops = {
+4 −2
Original line number Diff line number Diff line
@@ -492,8 +492,10 @@ void vsp1_du_atomic_flush(struct device *dev)
		vsp1_entity_route_setup(entity, pipe->dl);

		if (entity->ops->configure) {
			entity->ops->configure(entity, pipe, pipe->dl, true);
			entity->ops->configure(entity, pipe, pipe->dl, false);
			entity->ops->configure(entity, pipe, pipe->dl,
					       VSP1_ENTITY_PARAMS_INIT);
			entity->ops->configure(entity, pipe, pipe->dl,
					       VSP1_ENTITY_PARAMS_RUNTIME);
		}

		/* The memory buffer address must be applied after configuring
+11 −1
Original line number Diff line number Diff line
@@ -35,6 +35,16 @@ enum vsp1_entity_type {
	VSP1_ENTITY_WPF,
};

/*
 * enum vsp1_entity_params - Entity configuration parameters class
 * @VSP1_ENTITY_PARAMS_INIT - Initial parameters
 * @VSP1_ENTITY_PARAMS_RUNTIME - Runtime-configurable parameters
 */
enum vsp1_entity_params {
	VSP1_ENTITY_PARAMS_INIT,
	VSP1_ENTITY_PARAMS_RUNTIME,
};

#define VSP1_ENTITY_MAX_INPUTS		5	/* For the BRU */

/*
@@ -73,7 +83,7 @@ struct vsp1_entity_operations {
	void (*destroy)(struct vsp1_entity *);
	void (*set_memory)(struct vsp1_entity *, struct vsp1_dl_list *dl);
	void (*configure)(struct vsp1_entity *, struct vsp1_pipeline *,
			  struct vsp1_dl_list *, bool);
			  struct vsp1_dl_list *, enum vsp1_entity_params);
};

struct vsp1_entity {
+3 −2
Original line number Diff line number Diff line
@@ -132,11 +132,12 @@ static const struct v4l2_subdev_ops hsit_ops = {

static void hsit_configure(struct vsp1_entity *entity,
			   struct vsp1_pipeline *pipe,
			   struct vsp1_dl_list *dl, bool full)
			   struct vsp1_dl_list *dl,
			   enum vsp1_entity_params params)
{
	struct vsp1_hsit *hsit = to_hsit(&entity->subdev);

	if (!full)
	if (params != VSP1_ENTITY_PARAMS_INIT)
		return;

	if (hsit->inverse)
Loading