diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2018-10-04 17:06:32 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-11-20 13:37:18 -0500 |
commit | ee10dc36b485920e87eefa325d74fd8804648621 (patch) | |
tree | aff59557bb6ab1dee797943e7248d362bd429541 /drivers/media/platform | |
parent | 98af278b1e0fa6b7e6c762e185e99f0cc5e31cfe (diff) |
media: cropcap/g_selection split
If g_selection is implemented, then the v4l2-ioctl cropcap code assumes
that cropcap just implements the pixelaspect part and that g_selection
provides the crop bounds and default rectangles.
There are still some drivers that only implement cropcap and not
g_selection. Split up cropcap into a cropcap and g_selection for those
drivers.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r-- | drivers/media/platform/am437x/am437x-vpfe.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/media/platform/am437x/am437x-vpfe.c b/drivers/media/platform/am437x/am437x-vpfe.c index e13d2b3a7168..9b8a75355c5e 100644 --- a/drivers/media/platform/am437x/am437x-vpfe.c +++ b/drivers/media/platform/am437x/am437x-vpfe.c @@ -2091,13 +2091,6 @@ static int vpfe_cropcap(struct file *file, void *priv, if (vpfe->std_index >= ARRAY_SIZE(vpfe_standards)) return -EINVAL; - memset(crop, 0, sizeof(struct v4l2_cropcap)); - - crop->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - crop->defrect.width = vpfe_standards[vpfe->std_index].width; - crop->bounds.width = crop->defrect.width; - crop->defrect.height = vpfe_standards[vpfe->std_index].height; - crop->bounds.height = crop->defrect.height; crop->pixelaspect = vpfe_standards[vpfe->std_index].pixelaspect; return 0; @@ -2108,12 +2101,17 @@ vpfe_g_selection(struct file *file, void *fh, struct v4l2_selection *s) { struct vpfe_device *vpfe = video_drvdata(file); + if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || + vpfe->std_index >= ARRAY_SIZE(vpfe_standards)) + return -EINVAL; + switch (s->target) { case V4L2_SEL_TGT_CROP_BOUNDS: case V4L2_SEL_TGT_CROP_DEFAULT: - s->r.left = s->r.top = 0; - s->r.width = vpfe->crop.width; - s->r.height = vpfe->crop.height; + s->r.left = 0; + s->r.top = 0; + s->r.width = vpfe_standards[vpfe->std_index].width; + s->r.height = vpfe_standards[vpfe->std_index].height; break; case V4L2_SEL_TGT_CROP: |