summaryrefslogtreecommitdiff
path: root/drivers/video/tgafb.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2014-01-23 23:44:00 +0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2014-02-11 17:01:05 +0400
commite62cabb5e9949bd51f68832b5ec9e18fcd323e20 (patch)
tree9f95feb587a98121663d683ceef6d5f78904bc36 /drivers/video/tgafb.c
parent6b0df6827bb6fcacb158dff29ad0a62d6418b534 (diff)
downloadlinux-e62cabb5e9949bd51f68832b5ec9e18fcd323e20.tar.xz
tgafb: avoid restriction on modes with line length not a multiple of 64
In tgafb there is a restriction that prevents the user from setting a videomode with line length not a multiple of 64 bytes (for example, 800x600 is not allowed). The reason for this restriction it that functions copyarea_line_8bpp and copyarea_line_32bpp can not handle a line length that is not a multiple of 64 bytes. This patch removes this restriction on mode setting and makes sure that the functions copyarea_line_8bpp and copyarea_line_32bpp are called only if line length is a multiple of 64 bytes. If we set a mode 800x600, the functions copyarea_line_8bpp and copyarea_line_32bpp are not used, generic functions for copying are used instead and it works just fine. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/tgafb.c')
-rw-r--r--drivers/video/tgafb.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/video/tgafb.c b/drivers/video/tgafb.c
index 3d5bce517d8e..65ba9921506e 100644
--- a/drivers/video/tgafb.c
+++ b/drivers/video/tgafb.c
@@ -192,8 +192,8 @@ tgafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
return -EINVAL;
/* Some of the acceleration routines assume the line width is
- a multiple of 64 bytes. */
- if (var->xres * (par->tga_type == TGA_TYPE_8PLANE ? 1 : 4) % 64)
+ a multiple of 8 bytes. */
+ if (var->xres * (par->tga_type == TGA_TYPE_8PLANE ? 1 : 4) % 8)
return -EINVAL;
return 0;
@@ -1280,7 +1280,7 @@ tgafb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
bpp = info->var.bits_per_pixel;
/* Detect copies of the entire line. */
- if (width * (bpp >> 3) == line_length) {
+ if (!(line_length & 63) && width * (bpp >> 3) == line_length) {
if (bpp == 8)
copyarea_line_8bpp(info, dy, sy, height, width);
else