diff options
author | Ian Armstrong <ian@iarmst.demon.co.uk> | 2007-10-14 12:08:02 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-22 10:01:48 -0400 |
commit | 0bfeb04a9f3ad9ad8c9bbba062231ff1a76e4465 (patch) | |
tree | ac76c36ef740d8dd8f25eebaacfdc8e7bf8fee1e /drivers/media | |
parent | d343d7f9792ac1790757cb35a419b8b0b5210917 (diff) |
V4L/DVB (6345): ivtvfb: YUV handling of an image which is not visible in the display area
When the ivtvfb module is loaded, the YUV output is relative to the
framebuffer output. When a virtual screen size is used, the output area for
the YUV may actually be off screen. To prevent the hardware from crashing,
the current driver will ignore an off-screen position and leave the output
visible at the last on-screen position. This may not be desirable, so this
patch will switch off the YUV output should the image move off-screen, and
re-enable it should the image move on-screen again.
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/media')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-yuv.c | 22 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-yuv.h | 1 |
2 files changed, 13 insertions, 10 deletions
diff --git a/drivers/media/video/ivtv/ivtv-yuv.c b/drivers/media/video/ivtv/ivtv-yuv.c index e2288f224ab6..13c358242bbc 100644 --- a/drivers/media/video/ivtv/ivtv-yuv.c +++ b/drivers/media/video/ivtv/ivtv-yuv.c | |||
@@ -710,7 +710,7 @@ static u32 ivtv_yuv_window_setup (struct ivtv *itv, struct yuv_frame_info *windo | |||
710 | 710 | ||
711 | /* If there's nothing to safe to display, we may as well stop now */ | 711 | /* If there's nothing to safe to display, we may as well stop now */ |
712 | if ((int)window->dst_w <= 2 || (int)window->dst_h <= 2 || (int)window->src_w <= 2 || (int)window->src_h <= 2) { | 712 | if ((int)window->dst_w <= 2 || (int)window->dst_h <= 2 || (int)window->src_w <= 2 || (int)window->src_h <= 2) { |
713 | return 0; | 713 | return IVTV_YUV_UPDATE_INVALID; |
714 | } | 714 | } |
715 | 715 | ||
716 | /* Ensure video remains inside OSD area */ | 716 | /* Ensure video remains inside OSD area */ |
@@ -791,7 +791,7 @@ static u32 ivtv_yuv_window_setup (struct ivtv *itv, struct yuv_frame_info *windo | |||
791 | 791 | ||
792 | /* Check again. If there's nothing to safe to display, stop now */ | 792 | /* Check again. If there's nothing to safe to display, stop now */ |
793 | if ((int)window->dst_w <= 2 || (int)window->dst_h <= 2 || (int)window->src_w <= 2 || (int)window->src_h <= 2) { | 793 | if ((int)window->dst_w <= 2 || (int)window->dst_h <= 2 || (int)window->src_w <= 2 || (int)window->src_h <= 2) { |
794 | return 0; | 794 | return IVTV_YUV_UPDATE_INVALID; |
795 | } | 795 | } |
796 | 796 | ||
797 | /* Both x offset & width are linked, so they have to be done together */ | 797 | /* Both x offset & width are linked, so they have to be done together */ |
@@ -840,12 +840,17 @@ void ivtv_yuv_work_handler (struct ivtv *itv) | |||
840 | if (!(yuv_update = ivtv_yuv_window_setup (itv, &window))) | 840 | if (!(yuv_update = ivtv_yuv_window_setup (itv, &window))) |
841 | return; | 841 | return; |
842 | 842 | ||
843 | /* Update horizontal settings */ | 843 | if (yuv_update & IVTV_YUV_UPDATE_INVALID) { |
844 | if (yuv_update & IVTV_YUV_UPDATE_HORIZONTAL) | 844 | write_reg(0x01008080, 0x2898); |
845 | ivtv_yuv_handle_horizontal(itv, &window); | 845 | } else if (yuv_update) { |
846 | write_reg(0x00108080, 0x2898); | ||
846 | 847 | ||
847 | if (yuv_update & IVTV_YUV_UPDATE_VERTICAL) | 848 | if (yuv_update & IVTV_YUV_UPDATE_HORIZONTAL) |
848 | ivtv_yuv_handle_vertical(itv, &window); | 849 | ivtv_yuv_handle_horizontal(itv, &window); |
850 | |||
851 | if (yuv_update & IVTV_YUV_UPDATE_VERTICAL) | ||
852 | ivtv_yuv_handle_vertical(itv, &window); | ||
853 | } | ||
849 | 854 | ||
850 | memcpy(&itv->yuv_info.old_frame_info, &window, sizeof (itv->yuv_info.old_frame_info)); | 855 | memcpy(&itv->yuv_info.old_frame_info, &window, sizeof (itv->yuv_info.old_frame_info)); |
851 | } | 856 | } |
@@ -936,9 +941,6 @@ static void ivtv_yuv_init (struct ivtv *itv) | |||
936 | IVTV_DEBUG_WARN ("Failed to allocate yuv blanking buffer\n"); | 941 | IVTV_DEBUG_WARN ("Failed to allocate yuv blanking buffer\n"); |
937 | } | 942 | } |
938 | 943 | ||
939 | IVTV_DEBUG_WARN("Enable video output\n"); | ||
940 | write_reg_sync(0x00108080, 0x2898); | ||
941 | |||
942 | /* Enable YUV decoder output */ | 944 | /* Enable YUV decoder output */ |
943 | write_reg_sync(0x01, IVTV_REG_VDM); | 945 | write_reg_sync(0x01, IVTV_REG_VDM); |
944 | 946 | ||
diff --git a/drivers/media/video/ivtv/ivtv-yuv.h b/drivers/media/video/ivtv/ivtv-yuv.h index f7215eeca018..3b966f0a204a 100644 --- a/drivers/media/video/ivtv/ivtv-yuv.h +++ b/drivers/media/video/ivtv/ivtv-yuv.h | |||
@@ -34,6 +34,7 @@ | |||
34 | 34 | ||
35 | #define IVTV_YUV_UPDATE_HORIZONTAL 0x01 | 35 | #define IVTV_YUV_UPDATE_HORIZONTAL 0x01 |
36 | #define IVTV_YUV_UPDATE_VERTICAL 0x02 | 36 | #define IVTV_YUV_UPDATE_VERTICAL 0x02 |
37 | #define IVTV_YUV_UPDATE_INVALID 0x04 | ||
37 | 38 | ||
38 | extern const u32 yuv_offset[4]; | 39 | extern const u32 yuv_offset[4]; |
39 | 40 | ||