diff options
author | Antonino A. Daplas <adaplas@gmail.com> | 2007-05-08 03:39:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:15:30 -0400 |
commit | dc0e6e0544f1cb2af44e5d7a7e68acda05dec6fa (patch) | |
tree | 7f5d28d54c333c5ba84bb4b4afe3821246696818 /drivers/video/cfbfillrect.c | |
parent | 52102c07a68a26fe6f8926e6a8497b577655f18a (diff) |
fbdev: consolidate common drawing functions into a header file
Consolidate common drawing functions into a single header file.
Signed-off-by: Antonino Daplas <adaplas@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/cfbfillrect.c')
-rw-r--r-- | drivers/video/cfbfillrect.c | 68 |
1 files changed, 1 insertions, 67 deletions
diff --git a/drivers/video/cfbfillrect.c b/drivers/video/cfbfillrect.c index f00b50aab606..71623b4f8ca2 100644 --- a/drivers/video/cfbfillrect.c +++ b/drivers/video/cfbfillrect.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/string.h> | 21 | #include <linux/string.h> |
22 | #include <linux/fb.h> | 22 | #include <linux/fb.h> |
23 | #include <asm/types.h> | 23 | #include <asm/types.h> |
24 | #include "fb_draw.h" | ||
24 | 25 | ||
25 | #if BITS_PER_LONG == 32 | 26 | #if BITS_PER_LONG == 32 |
26 | # define FB_WRITEL fb_writel | 27 | # define FB_WRITEL fb_writel |
@@ -31,73 +32,6 @@ | |||
31 | #endif | 32 | #endif |
32 | 33 | ||
33 | /* | 34 | /* |
34 | * Compose two values, using a bitmask as decision value | ||
35 | * This is equivalent to (a & mask) | (b & ~mask) | ||
36 | */ | ||
37 | |||
38 | static inline unsigned long | ||
39 | comp(unsigned long a, unsigned long b, unsigned long mask) | ||
40 | { | ||
41 | return ((a ^ b) & mask) ^ b; | ||
42 | } | ||
43 | |||
44 | /* | ||
45 | * Create a pattern with the given pixel's color | ||
46 | */ | ||
47 | |||
48 | #if BITS_PER_LONG == 64 | ||
49 | static inline unsigned long | ||
50 | pixel_to_pat( u32 bpp, u32 pixel) | ||
51 | { | ||
52 | switch (bpp) { | ||
53 | case 1: | ||
54 | return 0xfffffffffffffffful*pixel; | ||
55 | case 2: | ||
56 | return 0x5555555555555555ul*pixel; | ||
57 | case 4: | ||
58 | return 0x1111111111111111ul*pixel; | ||
59 | case 8: | ||
60 | return 0x0101010101010101ul*pixel; | ||
61 | case 12: | ||
62 | return 0x0001001001001001ul*pixel; | ||
63 | case 16: | ||
64 | return 0x0001000100010001ul*pixel; | ||
65 | case 24: | ||
66 | return 0x0000000001000001ul*pixel; | ||
67 | case 32: | ||
68 | return 0x0000000100000001ul*pixel; | ||
69 | default: | ||
70 | panic("pixel_to_pat(): unsupported pixelformat\n"); | ||
71 | } | ||
72 | } | ||
73 | #else | ||
74 | static inline unsigned long | ||
75 | pixel_to_pat( u32 bpp, u32 pixel) | ||
76 | { | ||
77 | switch (bpp) { | ||
78 | case 1: | ||
79 | return 0xfffffffful*pixel; | ||
80 | case 2: | ||
81 | return 0x55555555ul*pixel; | ||
82 | case 4: | ||
83 | return 0x11111111ul*pixel; | ||
84 | case 8: | ||
85 | return 0x01010101ul*pixel; | ||
86 | case 12: | ||
87 | return 0x00001001ul*pixel; | ||
88 | case 16: | ||
89 | return 0x00010001ul*pixel; | ||
90 | case 24: | ||
91 | return 0x00000001ul*pixel; | ||
92 | case 32: | ||
93 | return 0x00000001ul*pixel; | ||
94 | default: | ||
95 | panic("pixel_to_pat(): unsupported pixelformat\n"); | ||
96 | } | ||
97 | } | ||
98 | #endif | ||
99 | |||
100 | /* | ||
101 | * Aligned pattern fill using 32/64-bit memory accesses | 35 | * Aligned pattern fill using 32/64-bit memory accesses |
102 | */ | 36 | */ |
103 | 37 | ||