diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2015-11-15 19:14:22 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-04-13 18:53:22 -0300 |
commit | b7e5107eebb73d27affed95c20cedbf4784bf17c (patch) | |
tree | ad15c9876450de10ce4d852eafda5f6cbf78b865 /drivers/media/platform/vsp1/vsp1_bru.c | |
parent | e790c3cb8d904c4bad0d4a37885bece2eb848eeb (diff) |
[media] v4l: vsp1: Store active selection rectangles in a pad config structure
Use the pad config structure part of the vsp1_entity to store all active
pad selection rectangles. This generalizes the code to operate on pad
config structures.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform/vsp1/vsp1_bru.c')
-rw-r--r-- | drivers/media/platform/vsp1/vsp1_bru.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/media/platform/vsp1/vsp1_bru.c b/drivers/media/platform/vsp1/vsp1_bru.c index a0aa0fb2a5e1..c1848a3ac010 100644 --- a/drivers/media/platform/vsp1/vsp1_bru.c +++ b/drivers/media/platform/vsp1/vsp1_bru.c @@ -231,17 +231,9 @@ static int bru_enum_frame_size(struct v4l2_subdev *subdev, static struct v4l2_rect *bru_get_compose(struct vsp1_bru *bru, struct v4l2_subdev_pad_config *cfg, - unsigned int pad, u32 which) + unsigned int pad) { - switch (which) { - case V4L2_SUBDEV_FORMAT_TRY: - return v4l2_subdev_get_try_compose(&bru->entity.subdev, cfg, - pad); - case V4L2_SUBDEV_FORMAT_ACTIVE: - return &bru->inputs[pad].compose; - default: - return NULL; - } + return v4l2_subdev_get_try_compose(&bru->entity.subdev, cfg, pad); } static int bru_get_format(struct v4l2_subdev *subdev, @@ -310,7 +302,7 @@ static int bru_set_format(struct v4l2_subdev *subdev, if (fmt->pad != bru->entity.source_pad) { struct v4l2_rect *compose; - compose = bru_get_compose(bru, cfg, fmt->pad, fmt->which); + compose = bru_get_compose(bru, config, fmt->pad); compose->left = 0; compose->top = 0; compose->width = format->width; @@ -336,6 +328,7 @@ static int bru_get_selection(struct v4l2_subdev *subdev, struct v4l2_subdev_selection *sel) { struct vsp1_bru *bru = to_bru(subdev); + struct v4l2_subdev_pad_config *config; if (sel->pad == bru->entity.source_pad) return -EINVAL; @@ -349,7 +342,12 @@ static int bru_get_selection(struct v4l2_subdev *subdev, return 0; case V4L2_SEL_TGT_COMPOSE: - sel->r = *bru_get_compose(bru, cfg, sel->pad, sel->which); + config = vsp1_entity_get_pad_config(&bru->entity, cfg, + sel->which); + if (!config) + return -EINVAL; + + sel->r = *bru_get_compose(bru, config, sel->pad); return 0; default: @@ -391,7 +389,7 @@ static int bru_set_selection(struct v4l2_subdev *subdev, sel->r.width = format->width; sel->r.height = format->height; - compose = bru_get_compose(bru, cfg, sel->pad, sel->which); + compose = bru_get_compose(bru, config, sel->pad); *compose = sel->r; return 0; |