Commit f330c4b1 authored by Krzysztof Helt's avatar Krzysztof Helt Committed by Linus Torvalds

tridentfb: y-panning fixes

The Trident cards uses only 20-bit address of screen start in double
words.  This allows addressing for only 4MB of video memory so check this.

Also remove some redundant checks and assignments.
Signed-off-by: default avatarKrzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a4af1798
...@@ -870,8 +870,10 @@ static int tridentfb_check_var(struct fb_var_screeninfo *var, ...@@ -870,8 +870,10 @@ static int tridentfb_check_var(struct fb_var_screeninfo *var,
line_length = var->xres_virtual * bpp / 8; line_length = var->xres_virtual * bpp / 8;
} }
if (var->yres > var->yres_virtual) /* datasheet specifies how to set panning only up to 4 MB */
var->yres_virtual = var->yres; if (line_length * (var->yres_virtual - var->yres) > (4 << 20))
var->yres_virtual = ((4 << 20) / line_length) + var->yres;
if (line_length * var->yres_virtual > info->fix.smem_len) if (line_length * var->yres_virtual > info->fix.smem_len)
return -EINVAL; return -EINVAL;
...@@ -944,8 +946,6 @@ static int tridentfb_pan_display(struct fb_var_screeninfo *var, ...@@ -944,8 +946,6 @@ static int tridentfb_pan_display(struct fb_var_screeninfo *var,
debug("enter\n"); debug("enter\n");
offset = (var->xoffset + (var->yoffset * var->xres_virtual)) offset = (var->xoffset + (var->yoffset * var->xres_virtual))
* var->bits_per_pixel / 32; * var->bits_per_pixel / 32;
info->var.xoffset = var->xoffset;
info->var.yoffset = var->yoffset;
set_screen_start(par, offset); set_screen_start(par, offset);
debug("exit\n"); debug("exit\n");
return 0; return 0;
...@@ -1225,7 +1225,6 @@ static int tridentfb_setcolreg(unsigned regno, unsigned red, unsigned green, ...@@ -1225,7 +1225,6 @@ static int tridentfb_setcolreg(unsigned regno, unsigned red, unsigned green,
((blue & 0xFF00) >> 8); ((blue & 0xFF00) >> 8);
} }
/* debug("exit\n"); */
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment