From patchwork Mon Aug 20 18:12:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikulas Patocka X-Patchwork-Id: 1350411 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 3555EDFB6E for ; Mon, 20 Aug 2012 18:12:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751296Ab2HTSMe (ORCPT ); Mon, 20 Aug 2012 14:12:34 -0400 Received: from artax.karlin.mff.cuni.cz ([195.113.26.195]:53769 "EHLO artax.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750980Ab2HTSMe (ORCPT ); Mon, 20 Aug 2012 14:12:34 -0400 Received: by artax.karlin.mff.cuni.cz (Postfix, from userid 17421) id 3F59498085; Mon, 20 Aug 2012 20:12:33 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by artax.karlin.mff.cuni.cz (Postfix) with ESMTP id 387D098018; Mon, 20 Aug 2012 20:12:33 +0200 (CEST) Date: Mon, 20 Aug 2012 20:12:33 +0200 (CEST) From: Mikulas Patocka To: Florian Tobias Schandinat , linux-fbdev@vger.kernel.org Subject: [PATCH 7/7] tgafb: avoid restriction on modes with line length not a multiple of 64 In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) X-Personality-Disorder: Schizoid MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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 --- drivers/video/tgafb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-3.6-rc2-fast/drivers/video/tgafb.c =================================================================== --- linux-3.6-rc2-fast.orig/drivers/video/tgafb.c 2012-08-20 19:40:02.000000000 +0200 +++ linux-3.6-rc2-fast/drivers/video/tgafb.c 2012-08-20 19:40:33.000000000 +0200 @@ -202,8 +202,8 @@ tgafb_check_var(struct fb_var_screeninfo 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 % 8) return -EINVAL; return 0; @@ -1290,7 +1290,7 @@ tgafb_copyarea(struct fb_info *info, con 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