diff options
author | Ian Armstrong <ian@iarmst.demon.co.uk> | 2007-08-03 08:44:13 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-09 21:04:25 -0400 |
commit | b4b38bd63c07c8927b43c6c378eca1db10fdaf2e (patch) | |
tree | 396c4616467742a20141d20daa40e7f9d6dfa4a8 /drivers | |
parent | 813ce47cee33964ff710d2c91063548773cb4cd5 (diff) |
V4L/DVB (5970): ivtv: prevent vertical overflow of yuv output
When the video standard is changed, there's no guarantee the framebuffer
dimensions are still legal. The yuv output code uses these dimensions to
calculate the size & position for the video overlay. If the framebuffer
dimensions are now illegal, the output may exceed the vertical limit of the
display, causing distortion.
This patch adds an additional check to ensure the output doesn't exceed
the limits for the current video standard, cropping if required.
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-yuv.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/media/video/ivtv/ivtv-yuv.c b/drivers/media/video/ivtv/ivtv-yuv.c index bcea09542e5a..70ddf4060d37 100644 --- a/drivers/media/video/ivtv/ivtv-yuv.c +++ b/drivers/media/video/ivtv/ivtv-yuv.c | |||
@@ -898,8 +898,21 @@ static void ivtv_yuv_init (struct ivtv *itv) | |||
898 | itv->yuv_info.decode_height = 480; | 898 | itv->yuv_info.decode_height = 480; |
899 | 899 | ||
900 | /* If no visible size set, assume full size */ | 900 | /* If no visible size set, assume full size */ |
901 | if (!itv->yuv_info.osd_vis_w) itv->yuv_info.osd_vis_w = 720 - itv->yuv_info.osd_x_offset; | 901 | if (!itv->yuv_info.osd_vis_w) |
902 | if (!itv->yuv_info.osd_vis_h) itv->yuv_info.osd_vis_h = itv->yuv_info.decode_height - itv->yuv_info.osd_y_offset; | 902 | itv->yuv_info.osd_vis_w = 720 - itv->yuv_info.osd_x_offset; |
903 | |||
904 | if (!itv->yuv_info.osd_vis_h) { | ||
905 | itv->yuv_info.osd_vis_h = itv->yuv_info.decode_height - itv->yuv_info.osd_y_offset; | ||
906 | } else { | ||
907 | /* If output video standard has changed, requested height may | ||
908 | not be legal */ | ||
909 | if (itv->yuv_info.osd_vis_h + itv->yuv_info.osd_y_offset > itv->yuv_info.decode_height) { | ||
910 | IVTV_DEBUG_WARN("Clipping yuv output - fb size (%d) exceeds video standard limit (%d)\n", | ||
911 | itv->yuv_info.osd_vis_h + itv->yuv_info.osd_y_offset, | ||
912 | itv->yuv_info.decode_height); | ||
913 | itv->yuv_info.osd_vis_h = itv->yuv_info.decode_height - itv->yuv_info.osd_y_offset; | ||
914 | } | ||
915 | } | ||
903 | 916 | ||
904 | /* We need a buffer for blanking when Y plane is offset - non-fatal if we can't get one */ | 917 | /* We need a buffer for blanking when Y plane is offset - non-fatal if we can't get one */ |
905 | itv->yuv_info.blanking_ptr = kzalloc(720*16,GFP_KERNEL); | 918 | itv->yuv_info.blanking_ptr = kzalloc(720*16,GFP_KERNEL); |