aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2008-04-28 05:14:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-28 11:58:35 -0400
commite4c690e061b909127ab0f12e929f82f3f39ec953 (patch)
treeb798bbda541f615cd4830cad96ed3f58db1fd19c /include
parent6b745b6fd02213f4b2fef2f2635985929fc5b8cc (diff)
fb: add support for foreign endianness
Add support for the framebuffers with non-native endianness. This is done via FBINFO_FOREIGN_ENDIAN flag that will be used by the drivers. Depending on the host endianness this flag will be overwritten by FBINFO_BE_MATH internal flag, or cleared. Tested to work on MPC8360E-RDK (BE) + Fujitsu MINT framebuffer (LE). Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Cc: "Antonino A. Daplas" <adaplas@pol.net> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: <Valdis.Kletnieks@vt.edu> Cc: Clemens Koller <clemens.koller@anagramm.de> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/fb.h44
1 files changed, 35 insertions, 9 deletions
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 58c57a33e5dd..72295b099228 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -791,6 +791,17 @@ struct fb_tile_ops {
791 */ 791 */
792#define FBINFO_MISC_ALWAYS_SETPAR 0x40000 792#define FBINFO_MISC_ALWAYS_SETPAR 0x40000
793 793
794/*
795 * Host and GPU endianness differ.
796 */
797#define FBINFO_FOREIGN_ENDIAN 0x100000
798/*
799 * Big endian math. This is the same flags as above, but with different
800 * meaning, it is set by the fb subsystem depending FOREIGN_ENDIAN flag
801 * and host endianness. Drivers should not use this flag.
802 */
803#define FBINFO_BE_MATH 0x100000
804
794struct fb_info { 805struct fb_info {
795 int node; 806 int node;
796 int flags; 807 int flags;
@@ -899,15 +910,11 @@ struct fb_info {
899 910
900#endif 911#endif
901 912
902#if defined (__BIG_ENDIAN) 913#define FB_LEFT_POS(p, bpp) (fb_be_math(p) ? (32 - (bpp)) : 0)
903#define FB_LEFT_POS(bpp) (32 - bpp) 914#define FB_SHIFT_HIGH(p, val, bits) (fb_be_math(p) ? (val) >> (bits) : \
904#define FB_SHIFT_HIGH(val, bits) ((val) >> (bits)) 915 (val) << (bits))
905#define FB_SHIFT_LOW(val, bits) ((val) << (bits)) 916#define FB_SHIFT_LOW(p, val, bits) (fb_be_math(p) ? (val) << (bits) : \
906#else 917 (val) >> (bits))
907#define FB_LEFT_POS(bpp) (0)
908#define FB_SHIFT_HIGH(val, bits) ((val) << (bits))
909#define FB_SHIFT_LOW(val, bits) ((val) >> (bits))
910#endif
911 918
912 /* 919 /*
913 * `Generic' versions of the frame buffer device operations 920 * `Generic' versions of the frame buffer device operations
@@ -970,6 +977,25 @@ extern void fb_deferred_io_cleanup(struct fb_info *info);
970extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry, 977extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry,
971 int datasync); 978 int datasync);
972 979
980static inline bool fb_be_math(struct fb_info *info)
981{
982#ifdef CONFIG_FB_FOREIGN_ENDIAN
983#if defined(CONFIG_FB_BOTH_ENDIAN)
984 return info->flags & FBINFO_BE_MATH;
985#elif defined(CONFIG_FB_BIG_ENDIAN)
986 return true;
987#elif defined(CONFIG_FB_LITTLE_ENDIAN)
988 return false;
989#endif /* CONFIG_FB_BOTH_ENDIAN */
990#else
991#ifdef __BIG_ENDIAN
992 return true;
993#else
994 return false;
995#endif /* __BIG_ENDIAN */
996#endif /* CONFIG_FB_FOREIGN_ENDIAN */
997}
998
973/* drivers/video/fbsysfs.c */ 999/* drivers/video/fbsysfs.c */
974extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev); 1000extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev);
975extern void framebuffer_release(struct fb_info *info); 1001extern void framebuffer_release(struct fb_info *info);