Commit dbb7884b authored by Florian Tobias Schandinat's avatar Florian Tobias Schandinat Committed by Linus Torvalds

viafb: some virtual_xres handling fixes

Do not require the virtual_xres to be aligned as line length is for such
purposes.  Calculate always the smallest line length required.
Signed-off-by: default avatarFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
Cc: Scott Fang <ScottFang@viatech.com.cn>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent bd140691
...@@ -107,8 +107,7 @@ static void viafb_update_fix(struct fb_info *info) ...@@ -107,8 +107,7 @@ static void viafb_update_fix(struct fb_info *info)
info->fix.visual = info->fix.visual =
bpp == 8 ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR; bpp == 8 ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
info->fix.line_length = info->fix.line_length = (info->var.xres_virtual * bpp / 8 + 7) & ~7;
((info->var.xres_virtual + 7) & ~7) * bpp / 8;
} }
static void viafb_setup_fixinfo(struct fb_fix_screeninfo *fix, static void viafb_setup_fixinfo(struct fb_fix_screeninfo *fix,
...@@ -148,7 +147,7 @@ static int viafb_check_var(struct fb_var_screeninfo *var, ...@@ -148,7 +147,7 @@ static int viafb_check_var(struct fb_var_screeninfo *var,
int htotal, vtotal, depth; int htotal, vtotal, depth;
struct VideoModeTable *vmode_entry; struct VideoModeTable *vmode_entry;
struct viafb_par *ppar = info->par; struct viafb_par *ppar = info->par;
u32 long_refresh; u32 long_refresh, line;
DEBUG_MSG(KERN_INFO "viafb_check_var!\n"); DEBUG_MSG(KERN_INFO "viafb_check_var!\n");
/* Sanity check */ /* Sanity check */
...@@ -180,11 +179,8 @@ static int viafb_check_var(struct fb_var_screeninfo *var, ...@@ -180,11 +179,8 @@ static int viafb_check_var(struct fb_var_screeninfo *var,
depth = 24; depth = 24;
viafb_fill_var_color_info(var, depth); viafb_fill_var_color_info(var, depth);
if ((var->xres_virtual * (var->bits_per_pixel >> 3)) & 0x1F) line = (var->xres_virtual * var->bits_per_pixel / 8 + 7) & ~7;
/*32 pixel alignment */ if (line * var->yres_virtual > ppar->memsize)
var->xres_virtual = (var->xres_virtual + 31) & ~31;
if (var->xres_virtual * var->yres_virtual * var->bits_per_pixel / 8 >
ppar->memsize)
return -EINVAL; return -EINVAL;
/* Based on var passed in to calculate the refresh, /* Based on var passed in to calculate the refresh,
......
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