diff options
author | David S. Miller <davem@davemloft.net> | 2011-06-21 01:29:08 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-06-21 01:29:08 -0400 |
commit | 9f6ec8d697c08963d83880ccd35c13c5ace716ea (patch) | |
tree | ad8d93cf6fcdd09b86ade09f5fcbbc66cdb1cca2 /drivers/media/video/ivtv/ivtvfb.c | |
parent | 4aa3a715551c93eda32d79bd52042ce500bd5383 (diff) | |
parent | 56299378726d5f2ba8d3c8cbbd13cb280ba45e4f (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
drivers/net/wireless/rtlwifi/pci.c
net/netfilter/ipvs/ip_vs_core.c
Diffstat (limited to 'drivers/media/video/ivtv/ivtvfb.c')
-rw-r--r-- | drivers/media/video/ivtv/ivtvfb.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/drivers/media/video/ivtv/ivtvfb.c b/drivers/media/video/ivtv/ivtvfb.c index 17247451c693..6b7c9c823330 100644 --- a/drivers/media/video/ivtv/ivtvfb.c +++ b/drivers/media/video/ivtv/ivtvfb.c | |||
@@ -247,7 +247,7 @@ static int ivtvfb_set_osd_coords(struct ivtv *itv, const struct ivtv_osd_coords | |||
247 | 247 | ||
248 | static int ivtvfb_set_display_window(struct ivtv *itv, struct v4l2_rect *ivtv_window) | 248 | static int ivtvfb_set_display_window(struct ivtv *itv, struct v4l2_rect *ivtv_window) |
249 | { | 249 | { |
250 | int osd_height_limit = itv->is_50hz ? 576 : 480; | 250 | int osd_height_limit = itv->is_out_50hz ? 576 : 480; |
251 | 251 | ||
252 | /* Only fail if resolution too high, otherwise fudge the start coords. */ | 252 | /* Only fail if resolution too high, otherwise fudge the start coords. */ |
253 | if ((ivtv_window->height > osd_height_limit) || (ivtv_window->width > IVTV_OSD_MAX_WIDTH)) | 253 | if ((ivtv_window->height > osd_height_limit) || (ivtv_window->width > IVTV_OSD_MAX_WIDTH)) |
@@ -471,9 +471,9 @@ static int ivtvfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long ar | |||
471 | vblank.flags = FB_VBLANK_HAVE_COUNT |FB_VBLANK_HAVE_VCOUNT | | 471 | vblank.flags = FB_VBLANK_HAVE_COUNT |FB_VBLANK_HAVE_VCOUNT | |
472 | FB_VBLANK_HAVE_VSYNC; | 472 | FB_VBLANK_HAVE_VSYNC; |
473 | trace = read_reg(IVTV_REG_DEC_LINE_FIELD) >> 16; | 473 | trace = read_reg(IVTV_REG_DEC_LINE_FIELD) >> 16; |
474 | if (itv->is_50hz && trace > 312) | 474 | if (itv->is_out_50hz && trace > 312) |
475 | trace -= 312; | 475 | trace -= 312; |
476 | else if (itv->is_60hz && trace > 262) | 476 | else if (itv->is_out_60hz && trace > 262) |
477 | trace -= 262; | 477 | trace -= 262; |
478 | if (trace == 1) | 478 | if (trace == 1) |
479 | vblank.flags |= FB_VBLANK_VSYNCING; | 479 | vblank.flags |= FB_VBLANK_VSYNCING; |
@@ -656,7 +656,7 @@ static int _ivtvfb_check_var(struct fb_var_screeninfo *var, struct ivtv *itv) | |||
656 | IVTVFB_DEBUG_INFO("ivtvfb_check_var\n"); | 656 | IVTVFB_DEBUG_INFO("ivtvfb_check_var\n"); |
657 | 657 | ||
658 | /* Set base references for mode calcs. */ | 658 | /* Set base references for mode calcs. */ |
659 | if (itv->is_50hz) { | 659 | if (itv->is_out_50hz) { |
660 | pixclock = 84316; | 660 | pixclock = 84316; |
661 | hlimit = 776; | 661 | hlimit = 776; |
662 | vlimit = 591; | 662 | vlimit = 591; |
@@ -784,12 +784,12 @@ static int _ivtvfb_check_var(struct fb_var_screeninfo *var, struct ivtv *itv) | |||
784 | If the margins are too large, just center the screen | 784 | If the margins are too large, just center the screen |
785 | (enforcing margins causes too many problems) */ | 785 | (enforcing margins causes too many problems) */ |
786 | 786 | ||
787 | if (var->left_margin + var->xres > IVTV_OSD_MAX_WIDTH + 1) { | 787 | if (var->left_margin + var->xres > IVTV_OSD_MAX_WIDTH + 1) |
788 | var->left_margin = 1 + ((IVTV_OSD_MAX_WIDTH - var->xres) / 2); | 788 | var->left_margin = 1 + ((IVTV_OSD_MAX_WIDTH - var->xres) / 2); |
789 | } | 789 | |
790 | if (var->upper_margin + var->yres > (itv->is_50hz ? 577 : 481)) { | 790 | if (var->upper_margin + var->yres > (itv->is_out_50hz ? 577 : 481)) |
791 | var->upper_margin = 1 + (((itv->is_50hz ? 576 : 480) - var->yres) / 2); | 791 | var->upper_margin = 1 + (((itv->is_out_50hz ? 576 : 480) - |
792 | } | 792 | var->yres) / 2); |
793 | 793 | ||
794 | /* Maintain overall 'size' for a constant refresh rate */ | 794 | /* Maintain overall 'size' for a constant refresh rate */ |
795 | var->right_margin = hlimit - var->left_margin - var->xres; | 795 | var->right_margin = hlimit - var->left_margin - var->xres; |
@@ -836,7 +836,12 @@ static int ivtvfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *inf | |||
836 | u32 osd_pan_index; | 836 | u32 osd_pan_index; |
837 | struct ivtv *itv = (struct ivtv *) info->par; | 837 | struct ivtv *itv = (struct ivtv *) info->par; |
838 | 838 | ||
839 | osd_pan_index = (var->xoffset + (var->yoffset * var->xres_virtual))*var->bits_per_pixel/8; | 839 | if (var->yoffset + info->var.yres > info->var.yres_virtual || |
840 | var->xoffset + info->var.xres > info->var.xres_virtual) | ||
841 | return -EINVAL; | ||
842 | |||
843 | osd_pan_index = var->yoffset * info->fix.line_length | ||
844 | + var->xoffset * info->var.bits_per_pixel / 8; | ||
840 | write_reg(osd_pan_index, 0x02A0C); | 845 | write_reg(osd_pan_index, 0x02A0C); |
841 | 846 | ||
842 | /* Pass this info back the yuv handler */ | 847 | /* Pass this info back the yuv handler */ |
@@ -1003,19 +1008,21 @@ static int ivtvfb_init_vidmode(struct ivtv *itv) | |||
1003 | /* Hardware coords start at 0, user coords start at 1. */ | 1008 | /* Hardware coords start at 0, user coords start at 1. */ |
1004 | osd_left--; | 1009 | osd_left--; |
1005 | 1010 | ||
1006 | start_window.left = osd_left >= 0 ? osd_left : ((IVTV_OSD_MAX_WIDTH - start_window.width) / 2); | 1011 | start_window.left = osd_left >= 0 ? |
1012 | osd_left : ((IVTV_OSD_MAX_WIDTH - start_window.width) / 2); | ||
1007 | 1013 | ||
1008 | oi->display_byte_stride = | 1014 | oi->display_byte_stride = |
1009 | start_window.width * oi->bytes_per_pixel; | 1015 | start_window.width * oi->bytes_per_pixel; |
1010 | 1016 | ||
1011 | /* Vertical size & position */ | 1017 | /* Vertical size & position */ |
1012 | 1018 | ||
1013 | max_height = itv->is_50hz ? 576 : 480; | 1019 | max_height = itv->is_out_50hz ? 576 : 480; |
1014 | 1020 | ||
1015 | if (osd_yres > max_height) | 1021 | if (osd_yres > max_height) |
1016 | osd_yres = max_height; | 1022 | osd_yres = max_height; |
1017 | 1023 | ||
1018 | start_window.height = osd_yres ? osd_yres : itv->is_50hz ? 480 : 400; | 1024 | start_window.height = osd_yres ? |
1025 | osd_yres : itv->is_out_50hz ? 480 : 400; | ||
1019 | 1026 | ||
1020 | /* Check vertical start (osd_upper). */ | 1027 | /* Check vertical start (osd_upper). */ |
1021 | if (osd_upper + start_window.height > max_height + 1) { | 1028 | if (osd_upper + start_window.height > max_height + 1) { |