summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hunold <devnull@localhost>2003-12-15 20:36:50 +0000
committerMichael Hunold <devnull@localhost>2003-12-15 20:36:50 +0000
commitb12f792f25aafd619d357cd987fd6682ee405e11 (patch)
tree85ea4f264a816bc4895aab6cc72ca096fec56aa3
parent4c93e47939e3c0215c2d36e28756194983119f8d (diff)
downloadmediapointer-dvb-s2-b12f792f25aafd619d357cd987fd6682ee405e11.tar.gz
mediapointer-dvb-s2-b12f792f25aafd619d357cd987fd6682ee405e11.tar.bz2
- fix a bunch of race conditions and locking bugs in video and vbi
capture code on device closure - change minimal picture size to 48x32 just like other drivers
-rw-r--r--linux/drivers/media/common/saa7146_vbi.c17
-rw-r--r--linux/drivers/media/common/saa7146_video.c11
2 files changed, 13 insertions, 15 deletions
diff --git a/linux/drivers/media/common/saa7146_vbi.c b/linux/drivers/media/common/saa7146_vbi.c
index 28266dc7d..f9a815cc8 100644
--- a/linux/drivers/media/common/saa7146_vbi.c
+++ b/linux/drivers/media/common/saa7146_vbi.c
@@ -316,7 +316,7 @@ static void vbi_stop(struct saa7146_fh *fh)
struct saa7146_vv *vv = dev->vv_data;
unsigned long flags;
DEB_VBI(("dev:%p, fh:%p\n",dev, fh));
-
+
spin_lock_irqsave(&dev->slock,flags);
/* disable rps1 */
@@ -328,12 +328,17 @@ static void vbi_stop(struct saa7146_fh *fh)
/* shut down dma 3 transfers */
saa7146_write(dev, MC1, MASK_20);
+ if (vv->vbi_q.curr) {
+ saa7146_buffer_finish(dev,&vv->vbi_q,STATE_DONE);
+ }
+
+ videobuf_queue_cancel(file,&fh->vbi_q);
+
vv->vbi_streaming = NULL;
del_timer(&vv->vbi_q.timeout);
del_timer(&fh->vbi_read_timeout);
- DEB_VBI(("out\n"));
spin_unlock_irqrestore(&dev->slock, flags);
}
@@ -420,17 +425,9 @@ static void vbi_close(struct saa7146_dev *dev, struct saa7146_fh *fh, struct fil
unsigned long flags;
DEB_VBI(("dev:%p, fh:%p\n",dev,fh));
- spin_lock_irqsave(&dev->slock,flags);
-
- videobuf_queue_cancel(file,&fh->vbi_q);
- if (vv->vbi_q.curr) {
- saa7146_buffer_finish(dev,&vv->vbi_q,STATE_DONE);
- }
-
if( fh == vv->vbi_streaming ) {
vbi_stop(fh);
}
- spin_unlock_irqrestore(&dev->slock,flags);
}
static void vbi_irq_done(struct saa7146_dev *dev, unsigned long status)
diff --git a/linux/drivers/media/common/saa7146_video.c b/linux/drivers/media/common/saa7146_video.c
index c0f805907..01a11997a 100644
--- a/linux/drivers/media/common/saa7146_video.c
+++ b/linux/drivers/media/common/saa7146_video.c
@@ -116,7 +116,7 @@ static int try_win(struct saa7146_dev *dev, struct v4l2_window *win)
DEB_D(("no fb fmt set.\n"));
return -EINVAL;
}
- if (win->w.width < 64 || win->w.height < 64) {
+ if (win->w.width < 48 || win->w.height < 32) {
DEB_D(("min width/height. (%d,%d)\n",win->w.width,win->w.height));
return -EINVAL;
}
@@ -735,6 +735,9 @@ static int video_end(struct saa7146_fh *fh)
saa7146_write(dev, MC1, 0x00700000);
vv->streaming = NULL;
+
+ videobuf_queue_cancel(file,&fh->video_q);
+
spin_unlock_irqrestore(&dev->slock, flags);
return 0;
@@ -1171,8 +1174,8 @@ static int buffer_prepare(struct file *file, struct videobuf_buffer *vb, enum v4
DEB_CAP(("vbuf:%p\n",vb));
/* sanity checks */
- if (fh->video_fmt.width < 64 ||
- fh->video_fmt.height < 64 ||
+ if (fh->video_fmt.width < 48 ||
+ fh->video_fmt.height < 32 ||
fh->video_fmt.width > vv->standard->h_max_out ||
fh->video_fmt.height > vv->standard->v_max_out) {
DEB_D(("w (%d) / h (%d) out of bounds.\n",fh->video_fmt.width,fh->video_fmt.height));
@@ -1349,8 +1352,6 @@ static void video_close(struct saa7146_dev *dev, struct saa7146_fh *fh, struct f
if( fh == vv->streaming ) {
video_end(fh);
}
-
- videobuf_queue_cancel(file,&fh->video_q);
}