aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/soc_camera.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-08-25 10:46:53 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-18 23:18:59 -0400
commitb897a91afbed57558324ef4059efa2e2419e8b66 (patch)
tree13528b6b4367f05bfa96836bb8c934b184390f62 /drivers/media/video/soc_camera.c
parent68a54f0e53b62806040fb7884b2e0d79b922bf00 (diff)
V4L/DVB (12525): soc-camera: prohibit geometry change with initialised buffers
Prohibit S_FMT and S_CROP with a different window width or height after video buffer initialisation. This simplifies the work to be done in specific host and client drivers, and it doesn't seem to make much sense to allow these changes. We do however allow S_CROP with equal width and height to just move the window, this doesn't affect video buffer management and is usually easy enough to implement. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/soc_camera.c')
-rw-r--r--drivers/media/video/soc_camera.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index a22fcd0ff8ba..21a8aa586da5 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -517,8 +517,8 @@ static int soc_camera_s_fmt_vid_cap(struct file *file, void *priv,
517 517
518 mutex_lock(&icf->vb_vidq.vb_lock); 518 mutex_lock(&icf->vb_vidq.vb_lock);
519 519
520 if (videobuf_queue_is_busy(&icf->vb_vidq)) { 520 if (icf->vb_vidq.bufs[0]) {
521 dev_err(&icd->dev, "S_FMT denied: queue busy\n"); 521 dev_err(&icd->dev, "S_FMT denied: queue initialised\n");
522 ret = -EBUSY; 522 ret = -EBUSY;
523 goto unlock; 523 goto unlock;
524 } 524 }
@@ -768,6 +768,15 @@ static int soc_camera_s_crop(struct file *file, void *fh,
768 /* Cropping is allowed during a running capture, guard consistency */ 768 /* Cropping is allowed during a running capture, guard consistency */
769 mutex_lock(&icf->vb_vidq.vb_lock); 769 mutex_lock(&icf->vb_vidq.vb_lock);
770 770
771 /* Prohibit window size change with initialised buffers */
772 if (icf->vb_vidq.bufs[0] && (rect.width != icd->rect_current.width ||
773 rect.height != icd->rect_current.height)) {
774 dev_err(&icd->dev,
775 "S_CROP denied: queue initialised and sizes differ\n");
776 ret = -EBUSY;
777 goto unlock;
778 }
779
771 if (rect.width > icd->rect_max.width) 780 if (rect.width > icd->rect_max.width)
772 rect.width = icd->rect_max.width; 781 rect.width = icd->rect_max.width;
773 782
@@ -792,6 +801,7 @@ static int soc_camera_s_crop(struct file *file, void *fh,
792 if (!ret) 801 if (!ret)
793 icd->rect_current = rect; 802 icd->rect_current = rect;
794 803
804unlock:
795 mutex_unlock(&icf->vb_vidq.vb_lock); 805 mutex_unlock(&icf->vb_vidq.vb_lock);
796 806
797 return ret; 807 return ret;