# Re: Linux Framebuffer endian issues

- From: Andrey Volkov \<hidden\>
- Date: 2005-10-24 12:51:51 
- List: linux-fbdev
- Page: https://ratatoskr.run/linux-fbdev/2005/10/13455605
- Thread: https://ratatoskr.run/linux-fbdev/2005/10/13455605/t.md

```text
Hi Rolf,

Rolf Offermanns wrote:
> Hi Andrey,
> I have seen your thread about endian issues with the linux framebuffer system 
> and your SMI501 driver.
> 
> I am currently writing a driver for a SMI712 on a PCI card in a big endian 
> system (PPC440EP).
> 
> While 8bpp modes works quite well, I have wrong color in 16bpp truecolor 
> visual.
> 
> I guess this could be the same thing, you saw.
> 
> Did you solve the problem? 
No I defer solution of this problem :(, since 16 bpp doesn't critical
for me in nearest 2 months.

> If yes, would you be so kind to share your findings 
> with me? I tried lots of things like changing the offsets of the length 
> fields, but I was not successfull.

For me, was helpful offsets changing (I get right colors), but in this
case pixels are shifted :(.

Try something like this dirty hack:

--- fb.h.old	2005-10-24 16:46:34.000000000 +0400
+++ fb.h	2005-10-24 16:47:42.000000000 +0400
@@ -778,7 +778,7 @@
 #define fb_writeq sbus_writeq
 #define fb_memset sbus_memset_io

-#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) ||
defined(__hppa__) || (defined(__sh__) && !defined(__SH5__)) ||
defined(__powerpc__)
+#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) ||
defined(__hppa__) || (defined(__sh__) && !defined(__SH5__))

 #define fb_readb __raw_readb
 #define fb_readw __raw_readw
@@ -790,6 +790,16 @@
 #define fb_writeq __raw_writeq
 #define fb_memset memset_io

+#else if defined(__powerpc__)
+#define fb_readb readb
+#define fb_readw readw
+#define fb_readl readl
+#define fb_readq readq
+#define fb_writeb writeb
+#define fb_writew writew
+#define fb_writel writel
+#define fb_writeq writeq
+#define fb_memset memset_io
 #else

 #define fb_readb(addr) (*(volatile u8 *) (addr))

> 
> Thanks,
> Rolf
> 
> 

-- 
Regards
Andrey Volkov


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
```
