]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
fbdev: consolidate common drawing functions into a header file
authorAntonino A. Daplas <adaplas@gmail.com>
Tue, 8 May 2007 07:39:08 +0000 (00:39 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 8 May 2007 18:15:30 +0000 (11:15 -0700)
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>
drivers/video/cfbcopyarea.c
drivers/video/cfbfillrect.c
drivers/video/fb_draw.h [new file with mode: 0644]
drivers/video/syscopyarea.c
drivers/video/sysfillrect.c

index 6faea4034e3db7dccd666bb032c73a1fece237a3..032210f45be37a539831030b63d64c1a5d3df61a 100644 (file)
@@ -22,8 +22,6 @@
  *  help moving some redundant computations and branches out of the loop, too.
  */
 
-
-
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
@@ -31,6 +29,7 @@
 #include <linux/slab.h>
 #include <asm/types.h>
 #include <asm/io.h>
+#include "fb_draw.h"
 
 #if BITS_PER_LONG == 32
 #  define FB_WRITEL fb_writel
 #  define FB_READL  fb_readq
 #endif
 
-    /*
-     *  Compose two values, using a bitmask as decision value
-     *  This is equivalent to (a & mask) | (b & ~mask)
-     */
-
-static inline unsigned long
-comp(unsigned long a, unsigned long b, unsigned long mask)
-{
-    return ((a ^ b) & mask) ^ b;
-}
-
     /*
      *  Generic bitwise copy algorithm
      */
index f00b50aab6061e509f957aebd5fd48f603617a48..71623b4f8ca26581dbf4f8258734685fbd55e079 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/string.h>
 #include <linux/fb.h>
 #include <asm/types.h>
+#include "fb_draw.h"
 
 #if BITS_PER_LONG == 32
 #  define FB_WRITEL fb_writel
 #else
 #  define FB_WRITEL fb_writeq
 #  define FB_READL  fb_readq
-#endif
-
-    /*
-     *  Compose two values, using a bitmask as decision value
-     *  This is equivalent to (a & mask) | (b & ~mask)
-     */
-
-static inline unsigned long
-comp(unsigned long a, unsigned long b, unsigned long mask)
-{
-    return ((a ^ b) & mask) ^ b;
-}
-
-    /*
-     *  Create a pattern with the given pixel's color
-     */
-
-#if BITS_PER_LONG == 64
-static inline unsigned long
-pixel_to_pat( u32 bpp, u32 pixel)
-{
-       switch (bpp) {
-       case 1:
-               return 0xfffffffffffffffful*pixel;
-       case 2:
-               return 0x5555555555555555ul*pixel;
-       case 4:
-               return 0x1111111111111111ul*pixel;
-       case 8:
-               return 0x0101010101010101ul*pixel;
-       case 12:
-               return 0x0001001001001001ul*pixel;
-       case 16:
-               return 0x0001000100010001ul*pixel;
-       case 24:
-               return 0x0000000001000001ul*pixel;
-       case 32:
-               return 0x0000000100000001ul*pixel;
-       default:
-               panic("pixel_to_pat(): unsupported pixelformat\n");
-    }
-}
-#else
-static inline unsigned long
-pixel_to_pat( u32 bpp, u32 pixel)
-{
-       switch (bpp) {
-       case 1:
-               return 0xfffffffful*pixel;
-       case 2:
-               return 0x55555555ul*pixel;
-       case 4:
-               return 0x11111111ul*pixel;
-       case 8:
-               return 0x01010101ul*pixel;
-       case 12:
-               return 0x00001001ul*pixel;
-       case 16:
-               return 0x00010001ul*pixel;
-       case 24:
-               return 0x00000001ul*pixel;
-       case 32:
-               return 0x00000001ul*pixel;
-       default:
-               panic("pixel_to_pat(): unsupported pixelformat\n");
-    }
-}
 #endif
 
     /*
diff --git a/drivers/video/fb_draw.h b/drivers/video/fb_draw.h
new file mode 100644 (file)
index 0000000..c5c4520
--- /dev/null
@@ -0,0 +1,72 @@
+#ifndef _FB_DRAW_H
+#define _FB_DRAW_H
+
+#include <asm/types.h>
+
+    /*
+     *  Compose two values, using a bitmask as decision value
+     *  This is equivalent to (a & mask) | (b & ~mask)
+     */
+
+static inline unsigned long
+comp(unsigned long a, unsigned long b, unsigned long mask)
+{
+    return ((a ^ b) & mask) ^ b;
+}
+
+    /*
+     *  Create a pattern with the given pixel's color
+     */
+
+#if BITS_PER_LONG == 64
+static inline unsigned long
+pixel_to_pat( u32 bpp, u32 pixel)
+{
+       switch (bpp) {
+       case 1:
+               return 0xfffffffffffffffful*pixel;
+       case 2:
+               return 0x5555555555555555ul*pixel;
+       case 4:
+               return 0x1111111111111111ul*pixel;
+       case 8:
+               return 0x0101010101010101ul*pixel;
+       case 12:
+               return 0x0001001001001001ul*pixel;
+       case 16:
+               return 0x0001000100010001ul*pixel;
+       case 24:
+               return 0x0000000001000001ul*pixel;
+       case 32:
+               return 0x0000000100000001ul*pixel;
+       default:
+               panic("pixel_to_pat(): unsupported pixelformat\n");
+    }
+}
+#else
+static inline unsigned long
+pixel_to_pat( u32 bpp, u32 pixel)
+{
+       switch (bpp) {
+       case 1:
+               return 0xfffffffful*pixel;
+       case 2:
+               return 0x55555555ul*pixel;
+       case 4:
+               return 0x11111111ul*pixel;
+       case 8:
+               return 0x01010101ul*pixel;
+       case 12:
+               return 0x00001001ul*pixel;
+       case 16:
+               return 0x00010001ul*pixel;
+       case 24:
+               return 0x00000001ul*pixel;
+       case 32:
+               return 0x00000001ul*pixel;
+       default:
+               panic("pixel_to_pat(): unsupported pixelformat\n");
+    }
+}
+#endif
+#endif /* FB_DRAW_H */
index e3488932c7b34debf3680413103f6c6b1a0551a4..37af10ab8f52b19c570929ba2d580c269d346b52 100644 (file)
 #include <linux/slab.h>
 #include <asm/types.h>
 #include <asm/io.h>
-
-    /*
-     *  Compose two values, using a bitmask as decision value
-     *  This is equivalent to (a & mask) | (b & ~mask)
-     */
-
-static inline unsigned long
-comp(unsigned long a, unsigned long b, unsigned long mask)
-{
-    return ((a ^ b) & mask) ^ b;
-}
+#include "fb_draw.h"
 
     /*
      *  Generic bitwise copy algorithm
index 10de70779a506b9ca71b821fdc667f423f3cee94..a261e9e6a675a8b1542422ad3c9b8d83d03207eb 100644 (file)
 #include <linux/string.h>
 #include <linux/fb.h>
 #include <asm/types.h>
-
-    /*
-     *  Compose two values, using a bitmask as decision value
-     *  This is equivalent to (a & mask) | (b & ~mask)
-     */
-
-static inline unsigned long
-comp(unsigned long a, unsigned long b, unsigned long mask)
-{
-    return ((a ^ b) & mask) ^ b;
-}
-
-    /*
-     *  Create a pattern with the given pixel's color
-     */
-
-#if BITS_PER_LONG == 64
-static inline unsigned long
-pixel_to_pat( u32 bpp, u32 pixel)
-{
-       switch (bpp) {
-       case 1:
-               return 0xfffffffffffffffful*pixel;
-       case 2:
-               return 0x5555555555555555ul*pixel;
-       case 4:
-               return 0x1111111111111111ul*pixel;
-       case 8:
-               return 0x0101010101010101ul*pixel;
-       case 12:
-               return 0x0001001001001001ul*pixel;
-       case 16:
-               return 0x0001000100010001ul*pixel;
-       case 24:
-               return 0x0000000001000001ul*pixel;
-       case 32:
-               return 0x0000000100000001ul*pixel;
-       default:
-               panic("pixel_to_pat(): unsupported pixelformat\n");
-    }
-}
-#else
-static inline unsigned long
-pixel_to_pat( u32 bpp, u32 pixel)
-{
-       switch (bpp) {
-       case 1:
-               return 0xfffffffful*pixel;
-       case 2:
-               return 0x55555555ul*pixel;
-       case 4:
-               return 0x11111111ul*pixel;
-       case 8:
-               return 0x01010101ul*pixel;
-       case 12:
-               return 0x00001001ul*pixel;
-       case 16:
-               return 0x00010001ul*pixel;
-       case 24:
-               return 0x00000001ul*pixel;
-       case 32:
-               return 0x00000001ul*pixel;
-       default:
-               panic("pixel_to_pat(): unsupported pixelformat\n");
-    }
-}
-#endif
+#include "fb_draw.h"
 
     /*
      *  Aligned pattern fill using 32/64-bit memory accesses