1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
4 # T2 SDE: package/.../fbv/bigendian.patch
5 # Copyright (C) 2007 The T2 SDE Project
7 # More information can be found in the files COPYING and README.
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
15 # --- T2-COPYRIGHT-NOTE-END ---
17 This is a bit hacky as the endianess of the frame-buffer is
18 not tied to the CPU. But the fbv code sucks anyway ... Let's
19 see this as basic fixup and use miniescreen for the same task,
22 - Rene Rebe <rene@exactcode.de>
24 --- fbv-1.0b/fb_display.c 2004-09-07 12:09:43.000000000 +0000
25 +++ fbv-1.0b-fixed/fb_display.c 2007-03-07 16:50:59.243785153 +0000
27 inline static unsigned short make15color(unsigned char r, unsigned char g, unsigned char b)
30 +#if __BYTE_ORDER != __BIG_ENDIAN
31 (((r >> 3) & 31) << 10) |
32 (((g >> 3) & 31) << 5) |
36 + (((g >> 3) & 31) << 5) |
37 + (((b >> 3) & 31) << 10) );
41 inline static unsigned short make16color(unsigned char r, unsigned char g, unsigned char b)
44 +#if __BYTE_ORDER != __BIG_ENDIAN
45 (((r >> 3) & 31) << 11) |
46 (((g >> 2) & 63) << 5) |
50 + (((g >> 3) & 31) << 5) |
51 + (((b >> 3) & 31) << 10) );
55 void* convertRGB2FB(int fh, unsigned char *rgbbuff, unsigned long count, int bpp, int *cpp)
60 - u_int32_t *i_fbbuff;
69 - i_fbbuff = (unsigned int *) malloc(count * sizeof(unsigned int));
70 - for(i = 0; i < count ; i++)
71 - i_fbbuff[i] = ((rgbbuff[i*3] << 16) & 0xFF0000) |
72 - ((rgbbuff[i*3+1] << 8) & 0xFF00) |
73 - (rgbbuff[i*3+2] & 0xFF);
74 - fbbuff = (void *) i_fbbuff;
76 + c_fbbuff = (unsigned char *) malloc(count * *cpp);
77 + fbbuff = (void *) c_fbbuff;
78 + for(i = 0; i < count ; i++) {
79 +#if __BYTE_ORDER != __BIG_ENDIAN
80 + c_fbbuff[0] = rgbbuff[i*3];
81 + c_fbbuff[1] = rgbbuff[i*3+1];
82 + c_fbbuff[2] = rgbbuff[i*3+2];
83 + if (*cpp == 4) c_fbbuff[3] = 0;
87 + c_fbbuff[-1] = rgbbuff[i*3];
88 + c_fbbuff[-2] = rgbbuff[i*3+1];
89 + c_fbbuff[-3] = rgbbuff[i*3+2];
90 + if (*cpp == 4) c_fbbuff[-4] = 0;
96 fprintf(stderr, "Unsupported video mode! You've got: %dbpp\n", bpp);