diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2011-05-25 05:34:52 -0400 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2011-08-19 04:34:44 -0400 |
commit | e1599cf8c7ab93cb4bbd67516f5c989211335df1 (patch) | |
tree | 54a1ab94b8abc760f5f2575970b4c38dea558927 /drivers/video/savage | |
parent | 305e0e4dbcd038625786a40e9fa801ba5b18b2a2 (diff) |
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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tormod Volden <debian.tormod@gmail.com>
Diffstat (limited to 'drivers/video/savage')
-rw-r--r-- | drivers/video/savage/savagefb_driver.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c index 4de541ca9c52..beb495044b24 100644 --- a/drivers/video/savage/savagefb_driver.c +++ b/drivers/video/savage/savagefb_driver.c | |||
@@ -1477,15 +1477,9 @@ static void savagefb_set_par_int(struct savagefb_par *par, struct savage_reg *r | |||
1477 | vgaHWProtect(par, 0); | 1477 | vgaHWProtect(par, 0); |
1478 | } | 1478 | } |
1479 | 1479 | ||
1480 | static void savagefb_update_start(struct savagefb_par *par, | 1480 | static void savagefb_update_start(struct savagefb_par *par, int base) |
1481 | struct fb_var_screeninfo *var) | ||
1482 | { | 1481 | { |
1483 | int base; | 1482 | /* program the start address registers */ |
1484 | |||
1485 | base = ((var->yoffset * var->xres_virtual + (var->xoffset & ~1)) | ||
1486 | * ((var->bits_per_pixel+7) / 8)) >> 2; | ||
1487 | |||
1488 | /* now program the start address registers */ | ||
1489 | vga_out16(0x3d4, (base & 0x00ff00) | 0x0c, par); | 1483 | vga_out16(0x3d4, (base & 0x00ff00) | 0x0c, par); |
1490 | vga_out16(0x3d4, ((base & 0x00ff) << 8) | 0x0d, par); | 1484 | vga_out16(0x3d4, ((base & 0x00ff) << 8) | 0x0d, par); |
1491 | vga_out8(0x3d4, 0x69, par); | 1485 | vga_out8(0x3d4, 0x69, par); |
@@ -1550,8 +1544,12 @@ static int savagefb_pan_display(struct fb_var_screeninfo *var, | |||
1550 | struct fb_info *info) | 1544 | struct fb_info *info) |
1551 | { | 1545 | { |
1552 | struct savagefb_par *par = info->par; | 1546 | struct savagefb_par *par = info->par; |
1547 | int base; | ||
1548 | |||
1549 | base = (var->yoffset * info->fix.line_length | ||
1550 | + (var->xoffset & ~1) * ((info->var.bits_per_pixel+7) / 8)) >> 2; | ||
1553 | 1551 | ||
1554 | savagefb_update_start(par, var); | 1552 | savagefb_update_start(par, base); |
1555 | return 0; | 1553 | return 0; |
1556 | } | 1554 | } |
1557 | 1555 | ||