# --- T2-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # T2 SDE: package/.../fbv/bigendian.patch # Copyright (C) 2007 The T2 SDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- T2-COPYRIGHT-NOTE-END --- This is a bit hacky as the endianess of the frame-buffer is not tied to the CPU. But the fbv code sucks anyway ... Let's see this as basic fixup and use miniescreen for the same task, otherwise ... - Rene Rebe --- fbv-1.0b/fb_display.c 2004-09-07 12:09:43.000000000 +0000 +++ fbv-1.0b-fixed/fb_display.c 2007-03-07 16:50:59.243785153 +0000 @@ -293,17 +293,29 @@ inline static unsigned short make15color(unsigned char r, unsigned char g, unsigned char b) { return ( +#if __BYTE_ORDER != __BIG_ENDIAN (((r >> 3) & 31) << 10) | (((g >> 3) & 31) << 5) | ((b >> 3) & 31) ); +#else + ((r >> 3) & 31) | + (((g >> 3) & 31) << 5) | + (((b >> 3) & 31) << 10) ); +#endif } inline static unsigned short make16color(unsigned char r, unsigned char g, unsigned char b) { return ( +#if __BYTE_ORDER != __BIG_ENDIAN (((r >> 3) & 31) << 11) | (((g >> 2) & 63) << 5) | ((b >> 3) & 31) ); +#else + ((r >> 3) & 31) | + (((g >> 3) & 31) << 5) | + (((b >> 3) & 31) << 10) ); +#endif } void* convertRGB2FB(int fh, unsigned char *rgbbuff, unsigned long count, int bpp, int *cpp) @@ -312,7 +324,6 @@ void *fbbuff = NULL; u_int8_t *c_fbbuff; u_int16_t *s_fbbuff; - u_int32_t *i_fbbuff; switch(bpp) { @@ -339,13 +350,25 @@ break; case 24: case 32: - *cpp = 4; - i_fbbuff = (unsigned int *) malloc(count * sizeof(unsigned int)); - for(i = 0; i < count ; i++) - i_fbbuff[i] = ((rgbbuff[i*3] << 16) & 0xFF0000) | - ((rgbbuff[i*3+1] << 8) & 0xFF00) | - (rgbbuff[i*3+2] & 0xFF); - fbbuff = (void *) i_fbbuff; + *cpp = bpp/8; + c_fbbuff = (unsigned char *) malloc(count * *cpp); + fbbuff = (void *) c_fbbuff; + for(i = 0; i < count ; i++) { +#if __BYTE_ORDER != __BIG_ENDIAN + c_fbbuff[0] = rgbbuff[i*3]; + c_fbbuff[1] = rgbbuff[i*3+1]; + c_fbbuff[2] = rgbbuff[i*3+2]; + if (*cpp == 4) c_fbbuff[3] = 0; + c_fbbuff += *cpp; +#else + c_fbbuff += *cpp; + c_fbbuff[-1] = rgbbuff[i*3]; + c_fbbuff[-2] = rgbbuff[i*3+1]; + c_fbbuff[-3] = rgbbuff[i*3+2]; + if (*cpp == 4) c_fbbuff[-4] = 0; + +#endif + } break; default: fprintf(stderr, "Unsupported video mode! You've got: %dbpp\n", bpp);