From adaplas@gmail.com Wed Jun 14 22:29:07 2006
Return-Path: <adaplas@gmail.com>
X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on tim.rpsys.net
X-Spam-Level: 
X-Spam-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,
	RCVD_IN_BL_SPAMCOP_NET autolearn=no version=3.1.1
Received: from localhost (localhost [127.0.0.1]) by tim.rpsys.net
	(8.13.6/8.13.6) with ESMTP id k5ELT7mW020812 for <rpurdie@rpsys.net>; Wed,
	14 Jun 2006 22:29:07 +0100
Received: from tim.rpsys.net ([127.0.0.1]) by localhost (tim.rpsys.net
	[127.0.0.1]) (amavisd-new, port 10024) with LMTP id 20567-03 for
	<rpurdie@rpsys.net>; Wed, 14 Jun 2006 22:29:05 +0100 (BST)
Received: from nz-out-0102.google.com (nz-out-0102.google.com
	[64.233.162.202]) by tim.rpsys.net (8.13.6/8.13.6) with ESMTP id
	k5ELT4qt020805 for <rpurdie@rpsys.net>; Wed, 14 Jun 2006 22:29:04 +0100
Received: by nz-out-0102.google.com with SMTP id i11so241963nzi for
	<rpurdie@rpsys.net>; Wed, 14 Jun 2006 14:29:03 -0700 (PDT)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com;
	h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding;
	b=qtRzUNd8/i9fr/dat+cl9tzCERWQBgzYNRrKLadwojveAa7r+RDBVV+K/iDKuZBelydO/J7ULRjQSZd+H+l2lHbVDAYkpg0i2fSOzSJFs9j2v/0j24cuscfcZ9ywGhkeR0o4X+kUFgdHSQy14Xsus7a/De0D7pE+xh1HEOcZSrI=
Received: by 10.65.74.17 with SMTP id b17mr1017670qbl; Wed, 14 Jun 2006
	14:29:03 -0700 (PDT)
Received: from ?192.168.232.98? ( [203.84.188.10]) by mx.gmail.com with
	ESMTP id z21sm374554qbc.2006.06.14.14.28.57; Wed, 14 Jun 2006 14:29:01
	-0700 (PDT)
Message-ID: <44907F49.7050609@gmail.com>
Date: Thu, 15 Jun 2006 05:27:37 +0800
From: "Antonino A. Daplas" <adaplas@gmail.com>
User-Agent: Thunderbird 1.5.0.4 (X11/20060516)
MIME-Version: 1.0
To: Richard Purdie <rpurdie@rpsys.net>
CC: linux-fbdev-devel@lists.sourceforge.net
Subject: Re: Problems with rotated Logos
References: <1150279997.27375.15.camel@localhost.localdomain>
		 <4490091B.4090900@gmail.com>
	 <1150311401.9240.9.camel@localhost.localdomain>
In-Reply-To: <1150311401.9240.9.camel@localhost.localdomain>
Content-Type: text/plain; charset=ISO-8859-1
X-Virus-Scanned: amavisd-new at rpsys.net
X-Evolution-Source: imap://richard@tim.rpsys.net/
Content-Transfer-Encoding: 8bit

Richard Purdie wrote:
> Hi,
> 
> On Wed, 2006-06-14 at 21:03 +0800, Antonino A. Daplas wrote:
>> Richard Purdie wrote:
>>> Hi,
>>>
>>> I've been experimenting with logos on the Sharp Zaurus C3000 which has a
>>> 480x640 framebuffer which is rotated clockwise to give 640x480. I'm
>>> using a 2.6.16 based kernel.
>>>
>>> If I use the standard Linux logo (clut224), all is well. I added a
>>> 640x185 logo and this locked the machine up when booting. Space was
>>> cleared at the top of the console for the logo and some boot messages
>>> appeared beneath it. Also, 639x185 gave the same result.
>> Yes, it's a bug. Also present in CCW. Try this patch.
> 
> The patch helps in that the 640x185 image no longer locks the system up
> and it displays something, thanks! The image is corrupted however.
> Rather than trying to describe it:
> 
> http://www.rpsys.net/openzaurus/temp/logo-corrupt.jpg
> 
> (I'm refraining from comment about the logo itself ;-)

:-)

> 
> As well as the wrapping, the blue colour to the left is also corruption,
> and marks the edge of the screen.
> 
> I suspect the rotation function has a bug...
> 

Yes, you're right, the dimensions where reversed. Can you revert the previous
patch, and then apply this one?

Tony

PS: If this still doesn't work, can you send me your logo ppm file?

fbdev: Fix logo rotation if width != height

Logo drawing crashes or produces corrupt display if the logo width and
height are not equal.  The dimensions are transposed prior to the actual
rotation, which produces a corrupt image.  Reverse the sequence to fix.

Signed-off-by: Antonino Daplas <adaplas@pol.net>
---

 drivers/video/fbmem.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 9527a52..a6b0629 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -334,11 +334,11 @@ static void fb_rotate_logo_ud(const u8 *
 
 static void fb_rotate_logo_cw(const u8 *in, u8 *out, u32 width, u32 height)
 {
-	int i, j, w = width - 1;
+	int i, j, h = height - 1;
 
 	for (i = 0; i < height; i++)
 		for (j = 0; j < width; j++)
-			out[height * j + w - i] = *in++;
+			out[height * j + h - i] = *in++;
 }
 
 static void fb_rotate_logo_ccw(const u8 *in, u8 *out, u32 width, u32 height)
@@ -356,24 +356,24 @@ static void fb_rotate_logo(struct fb_inf
 	u32 tmp;
 
 	if (rotate == FB_ROTATE_UD) {
-		image->dx = info->var.xres - image->width;
-		image->dy = info->var.yres - image->height;
 		fb_rotate_logo_ud(image->data, dst, image->width,
 				  image->height);
+		image->dx = info->var.xres - image->width;
+		image->dy = info->var.yres - image->height;
 	} else if (rotate == FB_ROTATE_CW) {
-		tmp = image->width;
-		image->width = image->height;
-		image->height = tmp;
-		image->dx = info->var.xres - image->height;
 		fb_rotate_logo_cw(image->data, dst, image->width,
 				  image->height);
-	} else if (rotate == FB_ROTATE_CCW) {
 		tmp = image->width;
 		image->width = image->height;
 		image->height = tmp;
-		image->dy = info->var.yres - image->width;
+		image->dx = info->var.xres - image->width;
+	} else if (rotate == FB_ROTATE_CCW) {
 		fb_rotate_logo_ccw(image->data, dst, image->width,
 				   image->height);
+		tmp = image->width;
+		image->width = image->height;
+		image->height = tmp;
+		image->dy = info->var.yres - image->height;
 	}
 
 	image->data = dst;



