Commit 4be710a3 authored by Laurent Pinchart's avatar Laurent Pinchart
Browse files

media: renesas: vsp1: Pass subdev state to entity operations



To prepare for the removal of the vsp1_entity.state field, pass the
state to all entity operations that needs to access it, instead of
accessing the state from the entity inside the operation handlers. This
lowers the number of accesses to the field.

Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: default avatarJacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>
parent a2bbb988
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -272,6 +272,7 @@ static const struct v4l2_subdev_ops brx_ops = {
 */

static void brx_configure_stream(struct vsp1_entity *entity,
				 struct v4l2_subdev_state *state,
				 struct vsp1_pipeline *pipe,
				 struct vsp1_dl_list *dl,
				 struct vsp1_dl_body *dlb)
@@ -281,8 +282,7 @@ static void brx_configure_stream(struct vsp1_entity *entity,
	unsigned int flags;
	unsigned int i;

	format = v4l2_subdev_state_get_format(brx->entity.state,
					      brx->entity.source_pad);
	format = v4l2_subdev_state_get_format(state, brx->entity.source_pad);

	/*
	 * The hardware is extremely flexible but we have no userspace API to
+2 −1
Original line number Diff line number Diff line
@@ -170,6 +170,7 @@ static const struct v4l2_subdev_ops clu_ops = {
 */

static void clu_configure_stream(struct vsp1_entity *entity,
				 struct v4l2_subdev_state *state,
				 struct vsp1_pipeline *pipe,
				 struct vsp1_dl_list *dl,
				 struct vsp1_dl_body *dlb)
@@ -181,7 +182,7 @@ static void clu_configure_stream(struct vsp1_entity *entity,
	 * The yuv_mode can't be changed during streaming. Cache it internally
	 * for future runtime configuration calls.
	 */
	format = v4l2_subdev_state_get_format(clu->entity.state, CLU_PAD_SINK);
	format = v4l2_subdev_state_get_format(state, CLU_PAD_SINK);
	clu->yuv_mode = format->code == MEDIA_BUS_FMT_AYUV8_1X32;
}

+2 −1
Original line number Diff line number Diff line
@@ -574,7 +574,8 @@ static void vsp1_du_pipeline_configure(struct vsp1_pipeline *pipe)
		}

		vsp1_entity_route_setup(entity, pipe, dlb);
		vsp1_entity_configure_stream(entity, pipe, dl, dlb);
		vsp1_entity_configure_stream(entity, entity->state, pipe,
					     dl, dlb);
		vsp1_entity_configure_frame(entity, pipe, dl, dlb);
		vsp1_entity_configure_partition(entity, pipe,
						&pipe->part_table[0], dl, dlb);
+2 −1
Original line number Diff line number Diff line
@@ -70,12 +70,13 @@ void vsp1_entity_route_setup(struct vsp1_entity *entity,
}

void vsp1_entity_configure_stream(struct vsp1_entity *entity,
				  struct v4l2_subdev_state *state,
				  struct vsp1_pipeline *pipe,
				  struct vsp1_dl_list *dl,
				  struct vsp1_dl_body *dlb)
{
	if (entity->ops->configure_stream)
		entity->ops->configure_stream(entity, pipe, dl, dlb);
		entity->ops->configure_stream(entity, state, pipe, dl, dlb);
}

void vsp1_entity_configure_frame(struct vsp1_entity *entity,
+4 −0
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ struct vsp1_route {
struct vsp1_entity_operations {
	void (*destroy)(struct vsp1_entity *entity);
	void (*configure_stream)(struct vsp1_entity *entity,
				 struct v4l2_subdev_state *state,
				 struct vsp1_pipeline *pipe,
				 struct vsp1_dl_list *dl,
				 struct vsp1_dl_body *dlb);
@@ -92,8 +93,10 @@ struct vsp1_entity_operations {
				    struct vsp1_dl_list *dl,
				    struct vsp1_dl_body *dlb);
	unsigned int (*max_width)(struct vsp1_entity *entity,
				  struct v4l2_subdev_state *state,
				  struct vsp1_pipeline *pipe);
	void (*partition)(struct vsp1_entity *entity,
			  struct v4l2_subdev_state *state,
			  struct vsp1_pipeline *pipe,
			  struct vsp1_partition *partition,
			  unsigned int index,
@@ -151,6 +154,7 @@ void vsp1_entity_route_setup(struct vsp1_entity *entity,
			     struct vsp1_dl_body *dlb);

void vsp1_entity_configure_stream(struct vsp1_entity *entity,
				  struct v4l2_subdev_state *state,
				  struct vsp1_pipeline *pipe,
				  struct vsp1_dl_list *dl,
				  struct vsp1_dl_body *dlb);
Loading