diff options
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/cfbcopyarea.c | 14 | ||||
-rw-r--r-- | drivers/video/cfbfillrect.c | 68 | ||||
-rw-r--r-- | drivers/video/fb_draw.h | 72 | ||||
-rw-r--r-- | drivers/video/syscopyarea.c | 12 | ||||
-rw-r--r-- | drivers/video/sysfillrect.c | 68 |
5 files changed, 76 insertions, 158 deletions
diff --git a/drivers/video/cfbcopyarea.c b/drivers/video/cfbcopyarea.c index 6faea4034e3d..032210f45be3 100644 --- a/drivers/video/cfbcopyarea.c +++ b/drivers/video/cfbcopyarea.c | |||
@@ -22,8 +22,6 @@ | |||
22 | * help moving some redundant computations and branches out of the loop, too. | 22 | * help moving some redundant computations and branches out of the loop, too. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | |||
26 | |||
27 | #include <linux/module.h> | 25 | #include <linux/module.h> |
28 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
29 | #include <linux/string.h> | 27 | #include <linux/string.h> |
@@ -31,6 +29,7 @@ | |||
31 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
32 | #include <asm/types.h> | 30 | #include <asm/types.h> |
33 | #include <asm/io.h> | 31 | #include <asm/io.h> |
32 | #include "fb_draw.h" | ||
34 | 33 | ||
35 | #if BITS_PER_LONG == 32 | 34 | #if BITS_PER_LONG == 32 |
36 | # define FB_WRITEL fb_writel | 35 | # define FB_WRITEL fb_writel |
@@ -41,17 +40,6 @@ | |||
41 | #endif | 40 | #endif |
42 | 41 | ||
43 | /* | 42 | /* |
44 | * Compose two values, using a bitmask as decision value | ||
45 | * This is equivalent to (a & mask) | (b & ~mask) | ||
46 | */ | ||
47 | |||
48 | static inline unsigned long | ||
49 | comp(unsigned long a, unsigned long b, unsigned long mask) | ||
50 | { | ||
51 | return ((a ^ b) & mask) ^ b; | ||
52 | } | ||
53 | |||
54 | /* | ||
55 | * Generic bitwise copy algorithm | 43 | * Generic bitwise copy algorithm |
56 | */ | 44 | */ |
57 | 45 | ||
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 | ||
diff --git a/drivers/video/fb_draw.h b/drivers/video/fb_draw.h new file mode 100644 index 000000000000..c5c45203833b --- /dev/null +++ b/drivers/video/fb_draw.h | |||
@@ -0,0 +1,72 @@ | |||
1 | #ifndef _FB_DRAW_H | ||
2 | #define _FB_DRAW_H | ||
3 | |||
4 | #include <asm/types.h> | ||
5 | |||
6 | /* | ||
7 | * Compose two values, using a bitmask as decision value | ||
8 | * This is equivalent to (a & mask) | (b & ~mask) | ||
9 | */ | ||
10 | |||
11 | static inline unsigned long | ||
12 | comp(unsigned long a, unsigned long b, unsigned long mask) | ||
13 | { | ||
14 | return ((a ^ b) & mask) ^ b; | ||
15 | } | ||
16 | |||
17 | /* | ||
18 | * Create a pattern with the given pixel's color | ||
19 | */ | ||
20 | |||
21 | #if BITS_PER_LONG == 64 | ||
22 | static inline unsigned long | ||
23 | pixel_to_pat( u32 bpp, u32 pixel) | ||
24 | { | ||
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"); | ||
44 | } | ||
45 | } | ||
46 | #else | ||
47 | static inline unsigned long | ||
48 | pixel_to_pat( u32 bpp, u32 pixel) | ||
49 | { | ||
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"); | ||
69 | } | ||
70 | } | ||
71 | #endif | ||
72 | #endif /* FB_DRAW_H */ | ||
diff --git a/drivers/video/syscopyarea.c b/drivers/video/syscopyarea.c index e3488932c7b3..37af10ab8f52 100644 --- a/drivers/video/syscopyarea.c +++ b/drivers/video/syscopyarea.c | |||
@@ -19,17 +19,7 @@ | |||
19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | #include <asm/types.h> | 20 | #include <asm/types.h> |
21 | #include <asm/io.h> | 21 | #include <asm/io.h> |
22 | 22 | #include "fb_draw.h" | |
23 | /* | ||
24 | * Compose two values, using a bitmask as decision value | ||
25 | * This is equivalent to (a & mask) | (b & ~mask) | ||
26 | */ | ||
27 | |||
28 | static inline unsigned long | ||
29 | comp(unsigned long a, unsigned long b, unsigned long mask) | ||
30 | { | ||
31 | return ((a ^ b) & mask) ^ b; | ||
32 | } | ||
33 | 23 | ||
34 | /* | 24 | /* |
35 | * Generic bitwise copy algorithm | 25 | * Generic bitwise copy algorithm |
diff --git a/drivers/video/sysfillrect.c b/drivers/video/sysfillrect.c index 10de70779a50..a261e9e6a675 100644 --- a/drivers/video/sysfillrect.c +++ b/drivers/video/sysfillrect.c | |||
@@ -15,73 +15,7 @@ | |||
15 | #include <linux/string.h> | 15 | #include <linux/string.h> |
16 | #include <linux/fb.h> | 16 | #include <linux/fb.h> |
17 | #include <asm/types.h> | 17 | #include <asm/types.h> |
18 | 18 | #include "fb_draw.h" | |
19 | /* | ||
20 | * Compose two values, using a bitmask as decision value | ||
21 | * This is equivalent to (a & mask) | (b & ~mask) | ||
22 | */ | ||
23 | |||
24 | static inline unsigned long | ||
25 | comp(unsigned long a, unsigned long b, unsigned long mask) | ||
26 | { | ||
27 | return ((a ^ b) & mask) ^ b; | ||
28 | } | ||
29 | |||
30 | /* | ||
31 | * Create a pattern with the given pixel's color | ||
32 | */ | ||
33 | |||
34 | #if BITS_PER_LONG == 64 | ||
35 | static inline unsigned long | ||
36 | pixel_to_pat( u32 bpp, u32 pixel) | ||
37 | { | ||
38 | switch (bpp) { | ||
39 | case 1: | ||
40 | return 0xfffffffffffffffful*pixel; | ||
41 | case 2: | ||
42 | return 0x5555555555555555ul*pixel; | ||
43 | case 4: | ||
44 | return 0x1111111111111111ul*pixel; | ||
45 | case 8: | ||
46 | return 0x0101010101010101ul*pixel; | ||
47 | case 12: | ||
48 | return 0x0001001001001001ul*pixel; | ||
49 | case 16: | ||
50 | return 0x0001000100010001ul*pixel; | ||
51 | case 24: | ||
52 | return 0x0000000001000001ul*pixel; | ||
53 | case 32: | ||
54 | return 0x0000000100000001ul*pixel; | ||
55 | default: | ||
56 | panic("pixel_to_pat(): unsupported pixelformat\n"); | ||
57 | } | ||
58 | } | ||
59 | #else | ||
60 | static inline unsigned long | ||
61 | pixel_to_pat( u32 bpp, u32 pixel) | ||
62 | { | ||
63 | switch (bpp) { | ||
64 | case 1: | ||
65 | return 0xfffffffful*pixel; | ||
66 | case 2: | ||
67 | return 0x55555555ul*pixel; | ||
68 | case 4: | ||
69 | return 0x11111111ul*pixel; | ||
70 | case 8: | ||
71 | return 0x01010101ul*pixel; | ||
72 | case 12: | ||
73 | return 0x00001001ul*pixel; | ||
74 | case 16: | ||
75 | return 0x00010001ul*pixel; | ||
76 | case 24: | ||
77 | return 0x00000001ul*pixel; | ||
78 | case 32: | ||
79 | return 0x00000001ul*pixel; | ||
80 | default: | ||
81 | panic("pixel_to_pat(): unsupported pixelformat\n"); | ||
82 | } | ||
83 | } | ||
84 | #endif | ||
85 | 19 | ||
86 | /* | 20 | /* |
87 | * Aligned pattern fill using 32/64-bit memory accesses | 21 | * Aligned pattern fill using 32/64-bit memory accesses |