Xfbdev color problems due to endianess

Daniel Stone daniel at fooishbar.org
Wed Sep 10 06:09:12 PDT 2008

On Wed, Sep 10, 2008 at 03:05:48PM +0200, Leon Ljunggren wrote:
> I have compiled and got kdrive (Xfbdev), using the latest stable
> source from git, running on my ARM based system but I'm experiencing
> problems with colours., they are "inverted". This is casued by the
> fact that my machine is big endian while the gfx module is little
> endian. This means that:
> becomes
> In fbdev.c there's a color masking feature (in
> fbdevScreenInitialize(...), line 264-266), that I thought I could
> modify to fix the problem:
> screen->fb[0].redMask = Mask (3, 5);
> screen->fb[0].greenMask = Mask (0, 3) | Mask (13, 3);
> screen->fb[0].blueMask = Mask (8, 5);
> However, when I run with these changes the server quits with a
> segmentation fault error. It would seem that it doesn't like having
> the green section split up in two part. I can swap the masks around as
> I wish as long as I don't try to split the bits for any one mask.
> Anyone that has any idea on what I can do to fix this? I guess I could
> swap the byte order of each pixel as they are written to the
> framebuffer, but I haven't been able to find where this writing is
> done in the server.

Yeah, it requires a contiguous range.  You can use the wfb module
(replace all calls to fb with wfb), to handle things like this.  IIRC
nVidia use it to generate tiled framebuffers on G80+.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg/attachments/20080910/5f7bb6c6/attachment.pgp>

More information about the xorg mailing list