summaryrefslogtreecommitdiff
path: root/linux/drivers
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-08-25 16:46:53 +0200
committerGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-08-25 16:46:53 +0200
commitfee3ccfc8db428f3108858be9c73a4c28a618e4d (patch)
treeb40e978a3e4d42e5c29be78e2d91bc4f08689fde /linux/drivers
parent4325d71881ee891f6b5313cdb76c08c1d95d2091 (diff)
downloadmediapointer-dvb-s2-fee3ccfc8db428f3108858be9c73a4c28a618e4d.tar.gz
mediapointer-dvb-s2-fee3ccfc8db428f3108858be9c73a4c28a618e4d.tar.bz2
soc-camera: prohibit geometry change with initialised buffers
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de> 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> Priority: low --- drivers/media/video/soc_camera.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-)
Diffstat (limited to 'linux/drivers')
-rw-r--r--linux/drivers/media/video/soc_camera.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/linux/drivers/media/video/soc_camera.c b/linux/drivers/media/video/soc_camera.c
index e4740359d..ec564a90e 100644
--- a/linux/drivers/media/video/soc_camera.c
+++ b/linux/drivers/media/video/soc_camera.c
@@ -518,8 +518,8 @@ static int soc_camera_s_fmt_vid_cap(struct file *file, void *priv,
mutex_lock(&icf->vb_vidq.vb_lock);
- if (videobuf_queue_is_busy(&icf->vb_vidq)) {
- dev_err(&icd->dev, "S_FMT denied: queue busy\n");
+ if (icf->vb_vidq.bufs[0]) {
+ dev_err(&icd->dev, "S_FMT denied: queue initialised\n");
ret = -EBUSY;
goto unlock;
}
@@ -769,6 +769,15 @@ static int soc_camera_s_crop(struct file *file, void *fh,
/* Cropping is allowed during a running capture, guard consistency */
mutex_lock(&icf->vb_vidq.vb_lock);
+ /* Prohibit window size change with initialised buffers */
+ if (icf->vb_vidq.bufs[0] && (rect.width != icd->rect_current.width ||
+ rect.height != icd->rect_current.height)) {
+ dev_err(&icd->dev,
+ "S_CROP denied: queue initialised and sizes differ\n");
+ ret = -EBUSY;
+ goto unlock;
+ }
+
if (rect.width > icd->rect_max.width)
rect.width = icd->rect_max.width;
@@ -793,6 +802,7 @@ static int soc_camera_s_crop(struct file *file, void *fh,
if (!ret)
icd->rect_current = rect;
+unlock:
mutex_unlock(&icf->vb_vidq.vb_lock);
return ret;