aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2010-03-10 18:21:39 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-12 18:52:34 -0500
commitdbb7884be758ca9ac5ec84cbe7eb21f21bce9d8f (patch)
tree4e6bbb4859ff6831310eef83ab8458040c015df3 /drivers/video
parentbd140691bda491b417a6d1e81b03416b54cb8d8d (diff)
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: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Joseph Chan <JosephChan@via.com.tw> Cc: Scott Fang <ScottFang@viatech.com.cn> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/via/viafbdev.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index bd8db75236ab..0fe748d66a6c 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -107,8 +107,7 @@ static void viafb_update_fix(struct fb_info *info)
107 107
108 info->fix.visual = 108 info->fix.visual =
109 bpp == 8 ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR; 109 bpp == 8 ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
110 info->fix.line_length = 110 info->fix.line_length = (info->var.xres_virtual * bpp / 8 + 7) & ~7;
111 ((info->var.xres_virtual + 7) & ~7) * bpp / 8;
112} 111}
113 112
114static void viafb_setup_fixinfo(struct fb_fix_screeninfo *fix, 113static void viafb_setup_fixinfo(struct fb_fix_screeninfo *fix,
@@ -148,7 +147,7 @@ static int viafb_check_var(struct fb_var_screeninfo *var,
148 int htotal, vtotal, depth; 147 int htotal, vtotal, depth;
149 struct VideoModeTable *vmode_entry; 148 struct VideoModeTable *vmode_entry;
150 struct viafb_par *ppar = info->par; 149 struct viafb_par *ppar = info->par;
151 u32 long_refresh; 150 u32 long_refresh, line;
152 151
153 DEBUG_MSG(KERN_INFO "viafb_check_var!\n"); 152 DEBUG_MSG(KERN_INFO "viafb_check_var!\n");
154 /* Sanity check */ 153 /* Sanity check */
@@ -180,11 +179,8 @@ static int viafb_check_var(struct fb_var_screeninfo *var,
180 depth = 24; 179 depth = 24;
181 180
182 viafb_fill_var_color_info(var, depth); 181 viafb_fill_var_color_info(var, depth);
183 if ((var->xres_virtual * (var->bits_per_pixel >> 3)) & 0x1F) 182 line = (var->xres_virtual * var->bits_per_pixel / 8 + 7) & ~7;
184 /*32 pixel alignment */ 183 if (line * var->yres_virtual > ppar->memsize)
185 var->xres_virtual = (var->xres_virtual + 31) & ~31;
186 if (var->xres_virtual * var->yres_virtual * var->bits_per_pixel / 8 >
187 ppar->memsize)
188 return -EINVAL; 184 return -EINVAL;
189 185
190 /* Based on var passed in to calculate the refresh, 186 /* Based on var passed in to calculate the refresh,