13 static inline unsigned long
14 comp(
unsigned long a,
unsigned long b,
unsigned long mask)
16 return ((a ^ b) & mask) ^
b;
23 #if BITS_PER_LONG == 64
24 static inline unsigned long
29 return 0xfffffffffffffffful*pixel;
31 return 0x5555555555555555ul*pixel;
33 return 0x1111111111111111ul*pixel;
35 return 0x0101010101010101ul*pixel;
37 return 0x1001001001001001ul*pixel;
39 return 0x0001000100010001ul*pixel;
41 return 0x0001000001000001ul*pixel;
43 return 0x0000000100000001ul*pixel;
45 WARN(1,
"pixel_to_pat(): unsupported pixelformat %d\n", bpp);
50 static inline unsigned long
51 pixel_to_pat(
u32 bpp,
u32 pixel)
55 return 0xfffffffful*pixel;
57 return 0x55555555ul*pixel;
59 return 0x11111111ul*pixel;
61 return 0x01010101ul*pixel;
63 return 0x01001001ul*pixel;
65 return 0x00010001ul*pixel;
67 return 0x01000001ul*pixel;
69 return 0x00000001ul*pixel;
71 WARN(1,
"pixel_to_pat(): unsupported pixelformat %d\n", bpp);
77 #ifdef CONFIG_FB_CFB_REV_PIXELS_IN_BYTE
78 #if BITS_PER_LONG == 64
79 #define REV_PIXELS_MASK1 0x5555555555555555ul
80 #define REV_PIXELS_MASK2 0x3333333333333333ul
81 #define REV_PIXELS_MASK4 0x0f0f0f0f0f0f0f0ful
83 #define REV_PIXELS_MASK1 0x55555555ul
84 #define REV_PIXELS_MASK2 0x33333333ul
85 #define REV_PIXELS_MASK4 0x0f0f0f0ful
88 static inline unsigned long fb_rev_pixels_in_long(
unsigned long val,
92 val = comp(val >> 1, val << 1, REV_PIXELS_MASK1);
94 val = comp(val >> 2, val << 2, REV_PIXELS_MASK2);
96 val = comp(val >> 4, val << 4, REV_PIXELS_MASK4);
111 #if defined(__i386__) || defined(__x86_64__)
113 if(index + bswapmask < 32)
116 (index + bswapmask) & ~(bswapmask));
133 #if defined(__i386__) || defined(__x86_64__)
138 (index + bswapmask) & ~(bswapmask));
147 unsigned bpp = info->
var.bits_per_pixel;
154 bswapmask = 7 - bpp + 1;
161 static inline unsigned long fb_rev_pixels_in_long(
unsigned long val,
167 #define fb_shifted_pixels_mask_u32(p, i, b) FB_SHIFT_HIGH((p), ~(u32)0, (i))
168 #define fb_shifted_pixels_mask_long(p, i, b) FB_SHIFT_HIGH((p), ~0UL, (i))
169 #define fb_compute_bswapmask(...) 0
173 #define cpu_to_le_long _cpu_to_le_long(BITS_PER_LONG)
174 #define _cpu_to_le_long(x) __cpu_to_le_long(x)
175 #define __cpu_to_le_long(x) cpu_to_le##x
177 #define le_long_to_cpu _le_long_to_cpu(BITS_PER_LONG)
178 #define _le_long_to_cpu(x) __le_long_to_cpu(x)
179 #define __le_long_to_cpu(x) le##x##_to_cpu
181 static inline unsigned long rolx(
unsigned long word,
unsigned int shift,
unsigned int x)
183 return (word << shift) | (word >> (x - shift));