aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2016-07-03 06:12:05 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-08-24 08:49:44 -0400
commitd1d094618eb24abb03a56fea7bcc6d848acb7880 (patch)
tree0cd4bac8962ceafe13ac9bae774bd165a4c85e98
parentb714fb006482f23d4439e6916ce922225aa3fe38 (diff)
[media] omap_vout: convert g/s_crop to g/s_selection
This is part of a final push to convert all drivers to g/s_selection. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r--drivers/media/platform/omap/omap_vout.c53
1 files changed, 27 insertions, 26 deletions
diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c
index 6b01e126fe73..e668dde6d857 100644
--- a/drivers/media/platform/omap/omap_vout.c
+++ b/drivers/media/platform/omap/omap_vout.c
@@ -1247,36 +1247,33 @@ static int vidioc_g_fmt_vid_overlay(struct file *file, void *fh,
1247 return 0; 1247 return 0;
1248} 1248}
1249 1249
1250static int vidioc_cropcap(struct file *file, void *fh, 1250static int vidioc_g_selection(struct file *file, void *fh, struct v4l2_selection *sel)
1251 struct v4l2_cropcap *cropcap)
1252{ 1251{
1253 struct omap_vout_device *vout = fh; 1252 struct omap_vout_device *vout = fh;
1254 struct v4l2_pix_format *pix = &vout->pix; 1253 struct v4l2_pix_format *pix = &vout->pix;
1255 1254
1256 if (cropcap->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) 1255 if (sel->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
1257 return -EINVAL; 1256 return -EINVAL;
1258 1257
1259 /* Width and height are always even */ 1258 switch (sel->target) {
1260 cropcap->bounds.width = pix->width & ~1; 1259 case V4L2_SEL_TGT_CROP:
1261 cropcap->bounds.height = pix->height & ~1; 1260 sel->r = vout->crop;
1262 1261 break;
1263 omap_vout_default_crop(&vout->pix, &vout->fbuf, &cropcap->defrect); 1262 case V4L2_SEL_TGT_CROP_DEFAULT:
1264 cropcap->pixelaspect.numerator = 1; 1263 omap_vout_default_crop(&vout->pix, &vout->fbuf, &sel->r);
1265 cropcap->pixelaspect.denominator = 1; 1264 break;
1266 return 0; 1265 case V4L2_SEL_TGT_CROP_BOUNDS:
1267} 1266 /* Width and height are always even */
1268 1267 sel->r.width = pix->width & ~1;
1269static int vidioc_g_crop(struct file *file, void *fh, struct v4l2_crop *crop) 1268 sel->r.height = pix->height & ~1;
1270{ 1269 break;
1271 struct omap_vout_device *vout = fh; 1270 default:
1272
1273 if (crop->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
1274 return -EINVAL; 1271 return -EINVAL;
1275 crop->c = vout->crop; 1272 }
1276 return 0; 1273 return 0;
1277} 1274}
1278 1275
1279static int vidioc_s_crop(struct file *file, void *fh, const struct v4l2_crop *crop) 1276static int vidioc_s_selection(struct file *file, void *fh, struct v4l2_selection *sel)
1280{ 1277{
1281 int ret = -EINVAL; 1278 int ret = -EINVAL;
1282 struct omap_vout_device *vout = fh; 1279 struct omap_vout_device *vout = fh;
@@ -1285,6 +1282,12 @@ static int vidioc_s_crop(struct file *file, void *fh, const struct v4l2_crop *cr
1285 struct omap_video_timings *timing; 1282 struct omap_video_timings *timing;
1286 struct omap_dss_device *dssdev; 1283 struct omap_dss_device *dssdev;
1287 1284
1285 if (sel->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
1286 return -EINVAL;
1287
1288 if (sel->target != V4L2_SEL_TGT_CROP)
1289 return -EINVAL;
1290
1288 if (vout->streaming) 1291 if (vout->streaming)
1289 return -EBUSY; 1292 return -EBUSY;
1290 1293
@@ -1309,9 +1312,8 @@ static int vidioc_s_crop(struct file *file, void *fh, const struct v4l2_crop *cr
1309 vout->fbuf.fmt.width = timing->x_res; 1312 vout->fbuf.fmt.width = timing->x_res;
1310 } 1313 }
1311 1314
1312 if (crop->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) 1315 ret = omap_vout_new_crop(&vout->pix, &vout->crop, &vout->win,
1313 ret = omap_vout_new_crop(&vout->pix, &vout->crop, &vout->win, 1316 &vout->fbuf, &sel->r);
1314 &vout->fbuf, &crop->c);
1315 1317
1316s_crop_err: 1318s_crop_err:
1317 mutex_unlock(&vout->lock); 1319 mutex_unlock(&vout->lock);
@@ -1780,9 +1782,8 @@ static const struct v4l2_ioctl_ops vout_ioctl_ops = {
1780 .vidioc_try_fmt_vid_out_overlay = vidioc_try_fmt_vid_overlay, 1782 .vidioc_try_fmt_vid_out_overlay = vidioc_try_fmt_vid_overlay,
1781 .vidioc_s_fmt_vid_out_overlay = vidioc_s_fmt_vid_overlay, 1783 .vidioc_s_fmt_vid_out_overlay = vidioc_s_fmt_vid_overlay,
1782 .vidioc_g_fmt_vid_out_overlay = vidioc_g_fmt_vid_overlay, 1784 .vidioc_g_fmt_vid_out_overlay = vidioc_g_fmt_vid_overlay,
1783 .vidioc_cropcap = vidioc_cropcap, 1785 .vidioc_g_selection = vidioc_g_selection,
1784 .vidioc_g_crop = vidioc_g_crop, 1786 .vidioc_s_selection = vidioc_s_selection,
1785 .vidioc_s_crop = vidioc_s_crop,
1786 .vidioc_reqbufs = vidioc_reqbufs, 1787 .vidioc_reqbufs = vidioc_reqbufs,
1787 .vidioc_querybuf = vidioc_querybuf, 1788 .vidioc_querybuf = vidioc_querybuf,
1788 .vidioc_qbuf = vidioc_qbuf, 1789 .vidioc_qbuf = vidioc_qbuf,