Rev 1408 | Rev 1970 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1408 | Rev 1964 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #ifndef _LINUX_FB_H |
1 | #ifndef _LINUX_FB_H |
2 | #define _LINUX_FB_H |
2 | #define _LINUX_FB_H |
Line 3... | Line 3... | ||
3 | 3 | ||
4 | #include |
- | |
5 | #include |
4 | #include |
Line 6... | Line 5... | ||
6 | #include |
5 | #include |
Line 7... | Line 6... | ||
7 | 6 | ||
Line 8... | Line 7... | ||
8 | struct dentry; |
7 | struct dentry; |
Line -... | Line 8... | ||
- | 8 | ||
- | 9 | /* Definitions of frame buffers */ |
|
- | 10 | ||
- | 11 | #define FB_MAX 32 /* sufficient for now */ |
|
- | 12 | ||
- | 13 | /* ioctls |
|
- | 14 | 0x46 is 'F' */ |
|
- | 15 | #define FBIOGET_VSCREENINFO 0x4600 |
|
- | 16 | #define FBIOPUT_VSCREENINFO 0x4601 |
|
- | 17 | #define FBIOGET_FSCREENINFO 0x4602 |
|
- | 18 | #define FBIOGETCMAP 0x4604 |
|
- | 19 | #define FBIOPUTCMAP 0x4605 |
|
- | 20 | #define FBIOPAN_DISPLAY 0x4606 |
|
- | 21 | #ifdef __KERNEL__ |
|
- | 22 | #define FBIO_CURSOR _IOWR('F', 0x08, struct fb_cursor_user) |
|
- | 23 | #else |
|
- | 24 | #define FBIO_CURSOR _IOWR('F', 0x08, struct fb_cursor) |
|
- | 25 | #endif |
|
- | 26 | /* 0x4607-0x460B are defined below */ |
|
- | 27 | /* #define FBIOGET_MONITORSPEC 0x460C */ |
|
- | 28 | /* #define FBIOPUT_MONITORSPEC 0x460D */ |
|
- | 29 | /* #define FBIOSWITCH_MONIBIT 0x460E */ |
|
- | 30 | #define FBIOGET_CON2FBMAP 0x460F |
|
- | 31 | #define FBIOPUT_CON2FBMAP 0x4610 |
|
- | 32 | #define FBIOBLANK 0x4611 /* arg: 0 or vesa level + 1 */ |
|
- | 33 | #define FBIOGET_VBLANK _IOR('F', 0x12, struct fb_vblank) |
|
- | 34 | #define FBIO_ALLOC 0x4613 |
|
- | 35 | #define FBIO_FREE 0x4614 |
|
Line 9... | Line 36... | ||
9 | 36 | #define FBIOGET_GLYPH 0x4615 |
|
10 | /* Definitions of frame buffers */ |
37 | #define FBIOGET_HWCINFO 0x4616 |
11 | 38 | #define FBIOPUT_MODEINFO 0x4617 |
|
12 | #define FB_MAX 32 /* sufficient for now */ |
39 | #define FBIOGET_DISPINFO 0x4618 |
Line 373... | Line 400... | ||
373 | //#include |
400 | //#include |
374 | //#include |
401 | //#include |
375 | //#include |
402 | //#include |
376 | //#include |
403 | //#include |
377 | #include |
404 | #include |
- | 405 | #include |
|
378 | //#include |
406 | //#include |
379 | //#include |
407 | //#include |
Line 380... | Line 408... | ||
380 | 408 | ||
381 | //struct vm_area_struct; |
409 | struct vm_area_struct; |
382 | //struct fb_info; |
410 | struct fb_info; |
383 | //struct device; |
411 | struct device; |
Line 384... | Line 412... | ||
384 | //struct file; |
412 | struct file; |
385 | 413 | ||
386 | /* Definitions below are used in the parsed monitor specs */ |
414 | /* Definitions below are used in the parsed monitor specs */ |
387 | #define FB_DPMS_ACTIVE_OFF 1 |
415 | #define FB_DPMS_ACTIVE_OFF 1 |
Line 406... | Line 434... | ||
406 | #define FB_SIGNAL_SYNC_ON_GREEN 8 |
434 | #define FB_SIGNAL_SYNC_ON_GREEN 8 |
407 | #define FB_SIGNAL_SERRATION_ON 16 |
435 | #define FB_SIGNAL_SERRATION_ON 16 |
Line 408... | Line 436... | ||
408 | 436 | ||
409 | #define FB_MISC_PRIM_COLOR 1 |
437 | #define FB_MISC_PRIM_COLOR 1 |
410 | #define FB_MISC_1ST_DETAIL 2 /* First Detailed Timing is preferred */ |
- | |
411 | 438 | #define FB_MISC_1ST_DETAIL 2 /* First Detailed Timing is preferred */ |
|
412 | struct fb_chroma { |
439 | struct fb_chroma { |
413 | __u32 redx; /* in fraction of 1024 */ |
440 | __u32 redx; /* in fraction of 1024 */ |
414 | __u32 greenx; |
441 | __u32 greenx; |
415 | __u32 bluex; |
442 | __u32 bluex; |
Line 515... | Line 542... | ||
515 | #define FB_EVENT_CONBLANK 0x0C |
542 | #define FB_EVENT_CONBLANK 0x0C |
516 | /* Get drawing requirements */ |
543 | /* Get drawing requirements */ |
517 | #define FB_EVENT_GET_REQ 0x0D |
544 | #define FB_EVENT_GET_REQ 0x0D |
518 | /* Unbind from the console if possible */ |
545 | /* Unbind from the console if possible */ |
519 | #define FB_EVENT_FB_UNBIND 0x0E |
546 | #define FB_EVENT_FB_UNBIND 0x0E |
- | 547 | /* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga switcheroo */ |
|
- | 548 | #define FB_EVENT_REMAP_ALL_CONSOLE 0x0F |
|
Line 520... | Line 549... | ||
520 | 549 | ||
521 | struct fb_event { |
550 | struct fb_event { |
522 | struct fb_info *info; |
551 | struct fb_info *info; |
523 | void *data; |
552 | void *data; |
Line 575... | Line 604... | ||
575 | * Frame buffer operations |
604 | * Frame buffer operations |
576 | * |
605 | * |
577 | * LOCKING NOTE: those functions must _ALL_ be called with the console |
606 | * LOCKING NOTE: those functions must _ALL_ be called with the console |
578 | * semaphore held, this is the only suitable locking mechanism we have |
607 | * semaphore held, this is the only suitable locking mechanism we have |
579 | * in 2.6. Some may be called at interrupt time at this point though. |
608 | * in 2.6. Some may be called at interrupt time at this point though. |
- | 609 | * |
|
- | 610 | * The exception to this is the debug related hooks. Putting the fb |
|
- | 611 | * into a debug state (e.g. flipping to the kernel console) and restoring |
|
- | 612 | * it must be done in a lock-free manner, so low level drivers should |
|
- | 613 | * keep track of the initial console (if applicable) and may need to |
|
- | 614 | * perform direct, unlocked hardware writes in these hooks. |
|
580 | */ |
615 | */ |
Line 581... | Line 616... | ||
581 | 616 | ||
582 | struct fb_ops { |
617 | struct fb_ops { |
583 | /* open/release and usage marking */ |
618 | /* open/release and usage marking */ |
Line 732... | Line 767... | ||
732 | * Hardware acceleration is turned off. Software implementations |
767 | * Hardware acceleration is turned off. Software implementations |
733 | * of required functions (copyarea(), fillrect(), and imageblit()) |
768 | * of required functions (copyarea(), fillrect(), and imageblit()) |
734 | * takes over; acceleration engine should be in a quiescent state */ |
769 | * takes over; acceleration engine should be in a quiescent state */ |
Line 735... | Line 770... | ||
735 | 770 | ||
- | 771 | /* hints */ |
|
736 | /* hints */ |
772 | #define FBINFO_VIRTFB 0x0004 /* FB is System RAM, not device. */ |
737 | #define FBINFO_PARTIAL_PAN_OK 0x0040 /* otw use pan only for double-buffering */ |
773 | #define FBINFO_PARTIAL_PAN_OK 0x0040 /* otw use pan only for double-buffering */ |
Line 738... | Line 774... | ||
738 | #define FBINFO_READS_FAST 0x0080 /* soft-copy faster than rendering */ |
774 | #define FBINFO_READS_FAST 0x0080 /* soft-copy faster than rendering */ |
739 | 775 | ||
Line 753... | Line 789... | ||
753 | #define FBINFO_HWACCEL_YWRAP 0x4000 /* optional */ |
789 | #define FBINFO_HWACCEL_YWRAP 0x4000 /* optional */ |
Line 754... | Line 790... | ||
754 | 790 | ||
755 | #define FBINFO_MISC_USEREVENT 0x10000 /* event request |
791 | #define FBINFO_MISC_USEREVENT 0x10000 /* event request |
756 | from userspace */ |
792 | from userspace */ |
757 | #define FBINFO_MISC_TILEBLITTING 0x20000 /* use tile blitting */ |
- | |
758 | #define FBINFO_MISC_FIRMWARE 0x40000 /* a replaceable firmware |
- | |
Line 759... | Line 793... | ||
759 | inited framebuffer */ |
793 | #define FBINFO_MISC_TILEBLITTING 0x20000 /* use tile blitting */ |
760 | 794 | ||
761 | /* A driver may set this flag to indicate that it does want a set_par to be |
795 | /* A driver may set this flag to indicate that it does want a set_par to be |
762 | * called every time when fbcon_switch is executed. The advantage is that with |
796 | * called every time when fbcon_switch is executed. The advantage is that with |
Line 768... | Line 802... | ||
768 | * code whenever there is a bug report related to switching between X and the |
802 | * code whenever there is a bug report related to switching between X and the |
769 | * framebuffer console. |
803 | * framebuffer console. |
770 | */ |
804 | */ |
771 | #define FBINFO_MISC_ALWAYS_SETPAR 0x40000 |
805 | #define FBINFO_MISC_ALWAYS_SETPAR 0x40000 |
Line -... | Line 806... | ||
- | 806 | ||
- | 807 | /* where the fb is a firmware driver, and can be replaced with a proper one */ |
|
772 | 808 | #define FBINFO_MISC_FIRMWARE 0x80000 |
|
773 | /* |
809 | /* |
774 | * Host and GPU endianness differ. |
810 | * Host and GPU endianness differ. |
775 | */ |
811 | */ |
776 | #define FBINFO_FOREIGN_ENDIAN 0x100000 |
812 | #define FBINFO_FOREIGN_ENDIAN 0x100000 |
Line 779... | Line 815... | ||
779 | * meaning, it is set by the fb subsystem depending FOREIGN_ENDIAN flag |
815 | * meaning, it is set by the fb subsystem depending FOREIGN_ENDIAN flag |
780 | * and host endianness. Drivers should not use this flag. |
816 | * and host endianness. Drivers should not use this flag. |
781 | */ |
817 | */ |
782 | #define FBINFO_BE_MATH 0x100000 |
818 | #define FBINFO_BE_MATH 0x100000 |
Line -... | Line 819... | ||
- | 819 | ||
- | 820 | /* report to the VT layer that this fb driver can accept forced console |
|
- | 821 | output like oopses */ |
|
- | 822 | #define FBINFO_CAN_FORCE_OUTPUT 0x200000 |
|
783 | 823 | ||
784 | struct fb_info { |
824 | struct fb_info { |
785 | int node; |
825 | int node; |
786 | int flags; |
826 | int flags; |
787 | // struct mutex lock; /* Lock for open/release/ioctl funcs */ |
827 | struct mutex lock; /* Lock for open/release/ioctl funcs */ |
788 | // struct mutex mm_lock; /* Lock for fb_mmap and smem_* fields */ |
828 | struct mutex mm_lock; /* Lock for fb_mmap and smem_* fields */ |
789 | struct fb_var_screeninfo var; /* Current var */ |
829 | struct fb_var_screeninfo var; /* Current var */ |
790 | struct fb_fix_screeninfo fix; /* Current fix */ |
830 | struct fb_fix_screeninfo fix; /* Current fix */ |
791 | struct fb_monspecs monspecs; /* Current Monitor specs */ |
831 | struct fb_monspecs monspecs; /* Current Monitor specs */ |
792 | // struct work_struct queue; /* Framebuffer event queue */ |
832 | // struct work_struct queue; /* Framebuffer event queue */ |
Line 810... | Line 850... | ||
810 | struct delayed_work deferred_work; |
850 | struct delayed_work deferred_work; |
811 | struct fb_deferred_io *fbdefio; |
851 | struct fb_deferred_io *fbdefio; |
812 | #endif |
852 | #endif |
Line 813... | Line 853... | ||
813 | 853 | ||
814 | struct fb_ops *fbops; |
854 | struct fb_ops *fbops; |
815 | // struct device *device; /* This is the parent */ |
855 | struct device *device; /* This is the parent */ |
816 | // struct device *dev; /* This is this fb device */ |
856 | struct device *dev; /* This is this fb device */ |
817 | int class_flag; /* private sysfs flags */ |
857 | int class_flag; /* private sysfs flags */ |
818 | #ifdef CONFIG_FB_TILEBLITTING |
858 | #ifdef CONFIG_FB_TILEBLITTING |
819 | struct fb_tile_ops *tileops; /* Tile Blitting */ |
859 | struct fb_tile_ops *tileops; /* Tile Blitting */ |
820 | #endif |
860 | #endif |
Line 828... | Line 868... | ||
828 | /* From here on everything is device dependent */ |
868 | /* From here on everything is device dependent */ |
829 | void *par; |
869 | void *par; |
830 | /* we need the PCI or similiar aperture base/size not |
870 | /* we need the PCI or similiar aperture base/size not |
831 | smem_start/size as smem_start may just be an object |
871 | smem_start/size as smem_start may just be an object |
832 | allocated inside the aperture so may not actually overlap */ |
872 | allocated inside the aperture so may not actually overlap */ |
- | 873 | struct apertures_struct { |
|
- | 874 | unsigned int count; |
|
- | 875 | struct aperture { |
|
833 | resource_size_t aperture_base; |
876 | resource_size_t base; |
834 | resource_size_t aperture_size; |
877 | resource_size_t size; |
- | 878 | } ranges[0]; |
|
- | 879 | } *apertures; |
|
835 | }; |
880 | }; |
- | 881 | ||
- | 882 | static inline struct apertures_struct *alloc_apertures(unsigned int max_num) { |
|
- | 883 | struct apertures_struct *a = kzalloc(sizeof(struct apertures_struct) |
|
- | 884 | + max_num * sizeof(struct aperture), GFP_KERNEL); |
|
- | 885 | if (!a) |
|
- | 886 | return NULL; |
|
- | 887 | a->count = max_num; |
|
- | 888 | return a; |
|
- | 889 | } |
|
Line 836... | Line 890... | ||
836 | 890 | ||
837 | #ifdef MODULE |
891 | #ifdef MODULE |
838 | #define FBINFO_DEFAULT FBINFO_MODULE |
892 | #define FBINFO_DEFAULT FBINFO_MODULE |
839 | #else |
893 | #else |
Line 850... | Line 904... | ||
850 | * really a separate operation, and should be modified via sysfs. |
904 | * really a separate operation, and should be modified via sysfs. |
851 | * But for now, we leave it broken with the following define |
905 | * But for now, we leave it broken with the following define |
852 | */ |
906 | */ |
853 | #define STUPID_ACCELF_TEXT_SHIT |
907 | #define STUPID_ACCELF_TEXT_SHIT |
Line -... | Line 908... | ||
- | 908 | ||
- | 909 | // This will go away |
|
- | 910 | #if defined(__sparc__) |
|
- | 911 | ||
- | 912 | /* We map all of our framebuffers such that big-endian accesses |
|
- | 913 | * are what we want, so the following is sufficient. |
|
- | 914 | */ |
|
- | 915 | ||
- | 916 | // This will go away |
|
- | 917 | #define fb_readb sbus_readb |
|
- | 918 | #define fb_readw sbus_readw |
|
- | 919 | #define fb_readl sbus_readl |
|
- | 920 | #define fb_readq sbus_readq |
|
- | 921 | #define fb_writeb sbus_writeb |
|
- | 922 | #define fb_writew sbus_writew |
|
- | 923 | #define fb_writel sbus_writel |
|
- | 924 | #define fb_writeq sbus_writeq |
|
- | 925 | #define fb_memset sbus_memset_io |
|
- | 926 | #define fb_memcpy_fromfb sbus_memcpy_fromio |
|
- | 927 | #define fb_memcpy_tofb sbus_memcpy_toio |
|
- | 928 | ||
- | 929 | #elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) || defined(__bfin__) |
|
- | 930 | ||
- | 931 | #define fb_readb __raw_readb |
|
- | 932 | #define fb_readw __raw_readw |
|
- | 933 | #define fb_readl __raw_readl |
|
- | 934 | #define fb_readq __raw_readq |
|
- | 935 | #define fb_writeb __raw_writeb |
|
- | 936 | #define fb_writew __raw_writew |
|
- | 937 | #define fb_writel __raw_writel |
|
- | 938 | #define fb_writeq __raw_writeq |
|
- | 939 | #define fb_memset memset_io |
|
- | 940 | #define fb_memcpy_fromfb memcpy_fromio |
|
- | 941 | #define fb_memcpy_tofb memcpy_toio |
|
- | 942 | ||
- | 943 | #else |
|
854 | 944 | ||
855 | #define fb_readb(addr) (*(volatile u8 *) (addr)) |
945 | #define fb_readb(addr) (*(volatile u8 *) (addr)) |
856 | #define fb_readw(addr) (*(volatile u16 *) (addr)) |
946 | #define fb_readw(addr) (*(volatile u16 *) (addr)) |
857 | #define fb_readl(addr) (*(volatile u32 *) (addr)) |
947 | #define fb_readl(addr) (*(volatile u32 *) (addr)) |
858 | #define fb_readq(addr) (*(volatile u64 *) (addr)) |
948 | #define fb_readq(addr) (*(volatile u64 *) (addr)) |
859 | #define fb_writeb(b,addr) (*(volatile u8 *) (addr) = (b)) |
949 | #define fb_writeb(b,addr) (*(volatile u8 *) (addr) = (b)) |
860 | #define fb_writew(b,addr) (*(volatile u16 *) (addr) = (b)) |
950 | #define fb_writew(b,addr) (*(volatile u16 *) (addr) = (b)) |
861 | #define fb_writel(b,addr) (*(volatile u32 *) (addr) = (b)) |
951 | #define fb_writel(b,addr) (*(volatile u32 *) (addr) = (b)) |
862 | #define fb_writeq(b,addr) (*(volatile u64 *) (addr) = (b)) |
952 | #define fb_writeq(b,addr) (*(volatile u64 *) (addr) = (b)) |
- | 953 | #define fb_memset memset |
|
- | 954 | #define fb_memcpy_fromfb memcpy |
|
- | 955 | #define fb_memcpy_tofb memcpy |
|
- | 956 | ||
Line 863... | Line 957... | ||
863 | #define fb_memset memset |
957 | #endif |
864 | 958 | ||
865 | #define FB_LEFT_POS(p, bpp) (fb_be_math(p) ? (32 - (bpp)) : 0) |
959 | #define FB_LEFT_POS(p, bpp) (fb_be_math(p) ? (32 - (bpp)) : 0) |
866 | #define FB_SHIFT_HIGH(p, val, bits) (fb_be_math(p) ? (val) >> (bits) : \ |
960 | #define FB_SHIFT_HIGH(p, val, bits) (fb_be_math(p) ? (val) >> (bits) : \ |
Line 890... | Line 984... | ||
890 | size_t count, loff_t *ppos); |
984 | size_t count, loff_t *ppos); |
Line 891... | Line 985... | ||
891 | 985 | ||
892 | /* drivers/video/fbmem.c */ |
986 | /* drivers/video/fbmem.c */ |
893 | extern int register_framebuffer(struct fb_info *fb_info); |
987 | extern int register_framebuffer(struct fb_info *fb_info); |
- | 988 | extern int unregister_framebuffer(struct fb_info *fb_info); |
|
- | 989 | extern void remove_conflicting_framebuffers(struct apertures_struct *a, |
|
894 | extern int unregister_framebuffer(struct fb_info *fb_info); |
990 | const char *name, bool primary); |
895 | extern int fb_prepare_logo(struct fb_info *fb_info, int rotate); |
991 | extern int fb_prepare_logo(struct fb_info *fb_info, int rotate); |
896 | extern int fb_show_logo(struct fb_info *fb_info, int rotate); |
992 | extern int fb_show_logo(struct fb_info *fb_info, int rotate); |
897 | extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size); |
993 | extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size); |
898 | extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx, |
994 | extern void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx, |
Line 910... | Line 1006... | ||
910 | 1006 | ||
Line 911... | Line 1007... | ||
911 | extern int lock_fb_info(struct fb_info *info); |
1007 | extern int lock_fb_info(struct fb_info *info); |
912 | 1008 | ||
913 | static inline void unlock_fb_info(struct fb_info *info) |
1009 | static inline void unlock_fb_info(struct fb_info *info) |
914 | { |
1010 | { |
Line 915... | Line 1011... | ||
915 | // mutex_unlock(&info->lock); |
1011 | mutex_unlock(&info->lock); |
916 | } |
1012 | } |
917 | 1013 |