[AD] [ alleg-Patches-1829686 ] problem with 4.2.2 using linux fbcon 8bpp

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Patches item #1829686, was opened at 2007-11-10 17:54
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305665&aid=1829686&group_id=5665

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Unix (X) or Linux
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: ccrodie (ccrodie)
Assigned to: Nobody/Anonymous (nobody)
Summary: problem with 4.2.2 using linux fbcon 8bpp

Initial Comment:
After compiling allegro-4.2.2 on Slackware 11 (gcc 3.4.6) and running example programs using fbcon, I found that programs exalpha, exblend, etc. that used 16bpp color depth or better worked fine, while programs like exhello that use 8bpp depth did not display anything on the screen.

I traced the problem to a little bug in allegro/src/linux/fbcon.c in the function fb_set_palette().  The device independent colormap
structure in linux/fb.h uses arrays of unsigned shorts for holding the color values.  The docs say the color values have big endian byte order for truecolor modes. But it seems they have little endian order for 8bpp modes.  Here's what fixed my problem (with no apparent ill effect on other modes):

#if 1
    /* in color map, big endian byte order
     * holds only for true color modes --
     * for 8bpp, using palette, we need the
     * rgb color values in low bytes
     */
   for (i=0; i < (int)cmap.len; i++) {
      r[i] = p[from+i].r << 2;
      g[i] = p[from+i].g << 2;
      b[i] = p[from+i].b << 2;
   }
#else
    /* the original 4.2.2 code */
   for (i=0; i < (int)cmap.len; i++) {
      r[i] = (p[from+i].r << 10);
      g[i] = (p[from+i].g << 10);
      b[i] = (p[from+i].b << 10);
   }
#endif

I hope this is helpful.  I appreciate very much this great library, and I am glad to have an opportunity to contribute just a small thing.

Regards,
Chris Rodie
Mirador Software, Inc.
Atlanta, GA

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305665&aid=1829686&group_id=5665




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/