提交 1388f6a7 编写于 作者: L Laurent Pinchart 提交者: Paul Mundt

savagefb: use display information in info not in var for panning

We must not use any information in the passed var besides xoffset,
yoffset and vmode as otherwise applications might abuse it. Also use the
aligned fix.line_length and not the (possible) unaligned xres_virtual.
Signed-off-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: NTormod Volden <debian.tormod@gmail.com>
Cc: Antonino Daplas <adaplas@gmail.com>
Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
上级 2bdb0278
...@@ -1477,15 +1477,9 @@ static void savagefb_set_par_int(struct savagefb_par *par, struct savage_reg *r ...@@ -1477,15 +1477,9 @@ static void savagefb_set_par_int(struct savagefb_par *par, struct savage_reg *r
vgaHWProtect(par, 0); vgaHWProtect(par, 0);
} }
static void savagefb_update_start(struct savagefb_par *par, static void savagefb_update_start(struct savagefb_par *par, int base)
struct fb_var_screeninfo *var)
{ {
int base; /* program the start address registers */
base = ((var->yoffset * var->xres_virtual + (var->xoffset & ~1))
* ((var->bits_per_pixel+7) / 8)) >> 2;
/* now program the start address registers */
vga_out16(0x3d4, (base & 0x00ff00) | 0x0c, par); vga_out16(0x3d4, (base & 0x00ff00) | 0x0c, par);
vga_out16(0x3d4, ((base & 0x00ff) << 8) | 0x0d, par); vga_out16(0x3d4, ((base & 0x00ff) << 8) | 0x0d, par);
vga_out8(0x3d4, 0x69, par); vga_out8(0x3d4, 0x69, par);
...@@ -1550,8 +1544,12 @@ static int savagefb_pan_display(struct fb_var_screeninfo *var, ...@@ -1550,8 +1544,12 @@ static int savagefb_pan_display(struct fb_var_screeninfo *var,
struct fb_info *info) struct fb_info *info)
{ {
struct savagefb_par *par = info->par; struct savagefb_par *par = info->par;
int base;
base = (var->yoffset * info->fix.line_length
+ (var->xoffset & ~1) * ((info->var.bits_per_pixel+7) / 8)) >> 2;
savagefb_update_start(par, var); savagefb_update_start(par, base);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册