allow coexistance of N build and AC build.
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / drivers / video / fb_draw.h
blobc5c45203833b8a17143dd1df49df32008b7ad142
1 #ifndef _FB_DRAW_H
2 #define _FB_DRAW_H
4 #include <asm/types.h>
6 /*
7 * Compose two values, using a bitmask as decision value
8 * This is equivalent to (a & mask) | (b & ~mask)
9 */
11 static inline unsigned long
12 comp(unsigned long a, unsigned long b, unsigned long mask)
14 return ((a ^ b) & mask) ^ b;
18 * Create a pattern with the given pixel's color
21 #if BITS_PER_LONG == 64
22 static inline unsigned long
23 pixel_to_pat( u32 bpp, u32 pixel)
25 switch (bpp) {
26 case 1:
27 return 0xfffffffffffffffful*pixel;
28 case 2:
29 return 0x5555555555555555ul*pixel;
30 case 4:
31 return 0x1111111111111111ul*pixel;
32 case 8:
33 return 0x0101010101010101ul*pixel;
34 case 12:
35 return 0x0001001001001001ul*pixel;
36 case 16:
37 return 0x0001000100010001ul*pixel;
38 case 24:
39 return 0x0000000001000001ul*pixel;
40 case 32:
41 return 0x0000000100000001ul*pixel;
42 default:
43 panic("pixel_to_pat(): unsupported pixelformat\n");
46 #else
47 static inline unsigned long
48 pixel_to_pat( u32 bpp, u32 pixel)
50 switch (bpp) {
51 case 1:
52 return 0xfffffffful*pixel;
53 case 2:
54 return 0x55555555ul*pixel;
55 case 4:
56 return 0x11111111ul*pixel;
57 case 8:
58 return 0x01010101ul*pixel;
59 case 12:
60 return 0x00001001ul*pixel;
61 case 16:
62 return 0x00010001ul*pixel;
63 case 24:
64 return 0x00000001ul*pixel;
65 case 32:
66 return 0x00000001ul*pixel;
67 default:
68 panic("pixel_to_pat(): unsupported pixelformat\n");
71 #endif
72 #endif /* FB_DRAW_H */