All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] video: cfb_console: fix 32-bit display on 64-bit architectures
Date: Mon,  6 Mar 2017 01:13:38 +0000	[thread overview]
Message-ID: <1488762818-21115-1-git-send-email-andre.przywara@arm.com> (raw)

"unsigned long" is a lousy data type when it comes to match peripheral
hardware registers with a fixed size.
Just do the obvious and match a 32-bit display format with an "u32"
data type for casting.
This fixes the logo display on 64-bit architectures, which produced
a black line on the right side of the logo with non-black backgrounds.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 drivers/video/cfb_console.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index 3c0696e..d75abb6 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -1079,8 +1079,8 @@ __weak void video_set_lut(unsigned int index, unsigned char r,
 }
 
 #define FILL_32BIT_X888RGB(r,g,b) {			\
-	*(unsigned long *)fb =				\
-		SWAP32((unsigned long)(((r<<16) |	\
+	*(u32 *)fb =				\
+		SWAP32((unsigned int)(((r<<16) |	\
 					(g<<8)  |	\
 					 b)));		\
 	fb += 4;					\
@@ -1161,7 +1161,7 @@ static void draw_bitmap(uchar **fb, uchar *bm, struct palette *p,
 		break;
 	case GDF_32BIT_X888RGB:
 		for (i = 0; i < cnt; i++) {
-			*(unsigned long *) addr = p[bm[*off]].ce.dw;
+			*(u32 *) addr = p[bm[*off]].ce.dw;
 			addr += 4;
 		}
 		break;
@@ -1825,8 +1825,8 @@ static void plot_logo_or_black(void *screen, int x, int y, int black)
 							 (b >> 3)));
 				break;
 			case GDF_32BIT_X888RGB:
-				*(unsigned long *) dest =
-					SWAP32((unsigned long) (
+				*(u32 *) dest =
+					SWAP32((u32) (
 							(r << 16) |
 							(g <<  8) |
 							 b));
-- 
2.8.2

             reply	other threads:[~2017-03-06  1:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-06  1:13 Andre Przywara [this message]
2017-03-07 20:25 ` [U-Boot] [PATCH] video: cfb_console: fix 32-bit display on 64-bit architectures Anatolij Gustschin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1488762818-21115-1-git-send-email-andre.przywara@arm.com \
    --to=andre.przywara@arm.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.