Endian issue

From: Laurent Lagrange <hidden>
Date: 2006-11-27 14:55:02

Hi
 
I'm writing a framebuffer driver and I have some endian problems. 
My board is big endian (powerpc inside) and I use a little endian 
graphic card. I try to get a 16 bpp RGBA (5/5/5/1) true color mode 
working. Nevertheless, I have troubles with the framebuffer layer.
 
For example, in the color_imageblit function of cfbimgblt.c, if I 
want to draw two 16bpp rgba pixels P0 (0xFFFE) and P1 (0x0001), 
they are packed together like this 0xFFFE_0001. 
In memory, 0xFF is LSB, 0x01 is MSB (big endian). Then this 32bit 
value is "__raw_writel" to the memory of the video card. 

As my videocard works in little endian, I get 0x0100_FEFF. So the 
pixels are at the correct place, but don't have the correct color. 
It would be OK if it was 0x0001_FFFE.
 
My question is :
- is it possible to use generic drawing function (blit, fillrect...) 
on a big endian board with a little endian graphics card ?
- if yes, how can I describe the colors bitfields, without 
patching the kernel code, to get the correct color ?
 
Thanks
Laurent
 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help