Commit ccd3d95a authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

[media] v4l: vsp1: Make vsp1_entity_get_pad_compose() more generic

Turn the helper into a function that can retrieve crop and compose
selection rectangles.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 7cf0f123
...@@ -87,12 +87,30 @@ vsp1_entity_get_pad_format(struct vsp1_entity *entity, ...@@ -87,12 +87,30 @@ vsp1_entity_get_pad_format(struct vsp1_entity *entity,
return v4l2_subdev_get_try_format(&entity->subdev, cfg, pad); return v4l2_subdev_get_try_format(&entity->subdev, cfg, pad);
} }
/**
* vsp1_entity_get_pad_selection - Get a pad selection from storage for entity
* @entity: the entity
* @cfg: the configuration storage
* @pad: the pad number
* @target: the selection target
*
* Return the selection rectangle stored in the given configuration for an
* entity's pad. The configuration can be an ACTIVE or TRY configuration. The
* selection target can be COMPOSE or CROP.
*/
struct v4l2_rect * struct v4l2_rect *
vsp1_entity_get_pad_compose(struct vsp1_entity *entity, vsp1_entity_get_pad_selection(struct vsp1_entity *entity,
struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_pad_config *cfg,
unsigned int pad) unsigned int pad, unsigned int target)
{ {
switch (target) {
case V4L2_SEL_TGT_COMPOSE:
return v4l2_subdev_get_try_compose(&entity->subdev, cfg, pad); return v4l2_subdev_get_try_compose(&entity->subdev, cfg, pad);
case V4L2_SEL_TGT_CROP:
return v4l2_subdev_get_try_crop(&entity->subdev, cfg, pad);
default:
return NULL;
}
} }
/* /*
......
...@@ -122,9 +122,9 @@ vsp1_entity_get_pad_format(struct vsp1_entity *entity, ...@@ -122,9 +122,9 @@ vsp1_entity_get_pad_format(struct vsp1_entity *entity,
struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_pad_config *cfg,
unsigned int pad); unsigned int pad);
struct v4l2_rect * struct v4l2_rect *
vsp1_entity_get_pad_compose(struct vsp1_entity *entity, vsp1_entity_get_pad_selection(struct vsp1_entity *entity,
struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_pad_config *cfg,
unsigned int pad); unsigned int pad, unsigned int target);
int vsp1_entity_init_cfg(struct v4l2_subdev *subdev, int vsp1_entity_init_cfg(struct v4l2_subdev *subdev,
struct v4l2_subdev_pad_config *cfg); struct v4l2_subdev_pad_config *cfg);
......
...@@ -130,9 +130,10 @@ static void rpf_configure(struct vsp1_entity *entity, ...@@ -130,9 +130,10 @@ static void rpf_configure(struct vsp1_entity *entity,
if (pipe->bru) { if (pipe->bru) {
const struct v4l2_rect *compose; const struct v4l2_rect *compose;
compose = vsp1_entity_get_pad_compose(pipe->bru, compose = vsp1_entity_get_pad_selection(pipe->bru,
pipe->bru->config, pipe->bru->config,
rpf->bru_input); rpf->bru_input,
V4L2_SEL_TGT_COMPOSE);
left = compose->left; left = compose->left;
top = compose->top; top = compose->top;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment