diff options
author | Mauro Carvalho Chehab <mchehab@brturbo.com.br> | 2005-08-04 15:53:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-08-04 16:00:54 -0400 |
commit | 4dcef52400fa6b9eb2de589300ae0151a1c65b3b (patch) | |
tree | f8023c75eb4ce1fad2e22560aaf1e52a27254046 /drivers/media/video/bttv-driver.c | |
parent | 75eedfed3e2d05563f44d2f69efb991fad95d7f1 (diff) |
[PATCH] v4l: oopsfix for BTTV on badly behaved PCI chipsets
no_overlay bttv parameter implemented to fix OOPS on some PCI chipsets
(like some VIA) with these behaviors:
1) If pci_quicks does identify the chip as having troubles to
handle PCI2PCI transfers, no_overlay defaults to 1. The user may force
it to 0, to reenable (not recommended).
2) For newer chipsets not blacklisted, no_overlay=1 is provided as a
workaround until PCI chipset included on /drivers/pci/quirks.c
Thanks to Bodo Eggert <7eggert@gmx.de>
Signed-off-by: Michael Krufky <mkrufky@m1k.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/video/bttv-driver.c')
-rw-r--r-- | drivers/media/video/bttv-driver.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c index 67f331eeeb19..eee9322ce21b 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bttv-driver.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: bttv-driver.c,v 1.45 2005/07/20 19:43:24 mkrufky Exp $ | 2 | $Id: bttv-driver.c,v 1.52 2005/08/04 00:55:16 mchehab Exp $ |
3 | 3 | ||
4 | bttv - Bt848 frame grabber driver | 4 | bttv - Bt848 frame grabber driver |
5 | 5 | ||
@@ -80,6 +80,7 @@ static unsigned int irq_iswitch = 0; | |||
80 | static unsigned int uv_ratio = 50; | 80 | static unsigned int uv_ratio = 50; |
81 | static unsigned int full_luma_range = 0; | 81 | static unsigned int full_luma_range = 0; |
82 | static unsigned int coring = 0; | 82 | static unsigned int coring = 0; |
83 | extern int no_overlay; | ||
83 | 84 | ||
84 | /* API features (turn on/off stuff for testing) */ | 85 | /* API features (turn on/off stuff for testing) */ |
85 | static unsigned int v4l2 = 1; | 86 | static unsigned int v4l2 = 1; |
@@ -2151,6 +2152,10 @@ static int bttv_s_fmt(struct bttv_fh *fh, struct bttv *btv, | |||
2151 | return 0; | 2152 | return 0; |
2152 | } | 2153 | } |
2153 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: | 2154 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: |
2155 | if (no_overlay > 0) { | ||
2156 | printk ("V4L2_BUF_TYPE_VIDEO_OVERLAY: no_overlay\n"); | ||
2157 | return -EINVAL; | ||
2158 | } | ||
2154 | return setup_window(fh, btv, &f->fmt.win, 1); | 2159 | return setup_window(fh, btv, &f->fmt.win, 1); |
2155 | case V4L2_BUF_TYPE_VBI_CAPTURE: | 2160 | case V4L2_BUF_TYPE_VBI_CAPTURE: |
2156 | retval = bttv_switch_type(fh,f->type); | 2161 | retval = bttv_switch_type(fh,f->type); |
@@ -2224,9 +2229,11 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2224 | /* others */ | 2229 | /* others */ |
2225 | cap->type = VID_TYPE_CAPTURE| | 2230 | cap->type = VID_TYPE_CAPTURE| |
2226 | VID_TYPE_TUNER| | 2231 | VID_TYPE_TUNER| |
2227 | VID_TYPE_OVERLAY| | ||
2228 | VID_TYPE_CLIPPING| | 2232 | VID_TYPE_CLIPPING| |
2229 | VID_TYPE_SCALES; | 2233 | VID_TYPE_SCALES; |
2234 | if (no_overlay <= 0) | ||
2235 | cap->type |= VID_TYPE_OVERLAY; | ||
2236 | |||
2230 | cap->maxwidth = bttv_tvnorms[btv->tvnorm].swidth; | 2237 | cap->maxwidth = bttv_tvnorms[btv->tvnorm].swidth; |
2231 | cap->maxheight = bttv_tvnorms[btv->tvnorm].sheight; | 2238 | cap->maxheight = bttv_tvnorms[btv->tvnorm].sheight; |
2232 | cap->minwidth = 48; | 2239 | cap->minwidth = 48; |
@@ -2302,6 +2309,11 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2302 | struct video_window *win = arg; | 2309 | struct video_window *win = arg; |
2303 | struct v4l2_window w2; | 2310 | struct v4l2_window w2; |
2304 | 2311 | ||
2312 | if (no_overlay > 0) { | ||
2313 | printk ("VIDIOCSWIN: no_overlay\n"); | ||
2314 | return -EINVAL; | ||
2315 | } | ||
2316 | |||
2305 | w2.field = V4L2_FIELD_ANY; | 2317 | w2.field = V4L2_FIELD_ANY; |
2306 | w2.w.left = win->x; | 2318 | w2.w.left = win->x; |
2307 | w2.w.top = win->y; | 2319 | w2.w.top = win->y; |
@@ -2577,10 +2589,12 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2577 | cap->version = BTTV_VERSION_CODE; | 2589 | cap->version = BTTV_VERSION_CODE; |
2578 | cap->capabilities = | 2590 | cap->capabilities = |
2579 | V4L2_CAP_VIDEO_CAPTURE | | 2591 | V4L2_CAP_VIDEO_CAPTURE | |
2580 | V4L2_CAP_VIDEO_OVERLAY | | ||
2581 | V4L2_CAP_VBI_CAPTURE | | 2592 | V4L2_CAP_VBI_CAPTURE | |
2582 | V4L2_CAP_READWRITE | | 2593 | V4L2_CAP_READWRITE | |
2583 | V4L2_CAP_STREAMING; | 2594 | V4L2_CAP_STREAMING; |
2595 | if (no_overlay <= 0) | ||
2596 | cap->capabilities |= V4L2_CAP_VIDEO_OVERLAY; | ||
2597 | |||
2584 | if (bttv_tvcards[btv->c.type].tuner != UNSET && | 2598 | if (bttv_tvcards[btv->c.type].tuner != UNSET && |
2585 | bttv_tvcards[btv->c.type].tuner != TUNER_ABSENT) | 2599 | bttv_tvcards[btv->c.type].tuner != TUNER_ABSENT) |
2586 | cap->capabilities |= V4L2_CAP_TUNER; | 2600 | cap->capabilities |= V4L2_CAP_TUNER; |
@@ -3076,7 +3090,7 @@ static struct file_operations bttv_fops = | |||
3076 | static struct video_device bttv_video_template = | 3090 | static struct video_device bttv_video_template = |
3077 | { | 3091 | { |
3078 | .name = "UNSET", | 3092 | .name = "UNSET", |
3079 | .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|VID_TYPE_OVERLAY| | 3093 | .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER| |
3080 | VID_TYPE_CLIPPING|VID_TYPE_SCALES, | 3094 | VID_TYPE_CLIPPING|VID_TYPE_SCALES, |
3081 | .hardware = VID_HARDWARE_BT848, | 3095 | .hardware = VID_HARDWARE_BT848, |
3082 | .fops = &bttv_fops, | 3096 | .fops = &bttv_fops, |
@@ -3756,6 +3770,12 @@ static void bttv_unregister_video(struct bttv *btv) | |||
3756 | /* register video4linux devices */ | 3770 | /* register video4linux devices */ |
3757 | static int __devinit bttv_register_video(struct bttv *btv) | 3771 | static int __devinit bttv_register_video(struct bttv *btv) |
3758 | { | 3772 | { |
3773 | if (no_overlay <= 0) { | ||
3774 | bttv_video_template.type |= VID_TYPE_OVERLAY; | ||
3775 | } else { | ||
3776 | printk("bttv: Overlay support disabled.\n"); | ||
3777 | } | ||
3778 | |||
3759 | /* video */ | 3779 | /* video */ |
3760 | btv->video_dev = vdev_init(btv, &bttv_video_template, "video"); | 3780 | btv->video_dev = vdev_init(btv, &bttv_video_template, "video"); |
3761 | if (NULL == btv->video_dev) | 3781 | if (NULL == btv->video_dev) |