diff options
| author | James Simmons <jsimmons@maxwell.earthlink.net> | 2002-10-16 07:06:36 -0700 |
|---|---|---|
| committer | James Simmons <jsimmons@maxwell.earthlink.net> | 2002-10-16 07:06:36 -0700 |
| commit | 0733e4dd69028d03cfa22cd78fa0016beb7ade51 (patch) | |
| tree | 3faa2072b7aa2a1d5e926d72daeb571ac8e7311f /include | |
| parent | 32705156ef67653fa7e63821fbdbc8fd3ea57d8d (diff) | |
The last of the console code inside the frmaebuffer layer. I also moved all the graphics related code into the drivers/video directory.
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/fb.h | 31 | ||||
| -rw-r--r-- | include/video/fbcon.h | 573 |
2 files changed, 33 insertions, 571 deletions
diff --git a/include/linux/fb.h b/include/linux/fb.h index d6ba52c1e461..b049028f6891 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -18,6 +18,7 @@ #define FBIOGETCMAP 0x4604 #define FBIOPUTCMAP 0x4605 #define FBIOPAN_DISPLAY 0x4606 +#define FBIO_CURSOR _IOWR('F', 0x08, struct fbcursor) /* 0x4607-0x460B are defined below */ /* #define FBIOGET_MONITORSPEC 0x460C */ /* #define FBIOPUT_MONITORSPEC 0x460D */ @@ -258,6 +259,32 @@ struct fb_vblank { __u32 reserved[4]; /* reserved for future compatibility */ }; +/* + * hardware cursor control + */ + +#define FB_CUR_SETCUR 0x01 +#define FB_CUR_SETPOS 0x02 +#define FB_CUR_SETHOT 0x04 +#define FB_CUR_SETCMAP 0x08 +#define FB_CUR_SETSHAPE 0x10 +#define FB_CUR_SETALL 0x1F + +struct fbcurpos { + __u16 x, y; +}; + +struct fbcursor { + __u16 set; /* what to set */ + __u16 enable; /* cursor on/off */ + struct fbcurpos pos; /* cursor position */ + struct fbcurpos hot; /* cursor hot spot */ + struct fb_cmap cmap; /* color map info */ + struct fbcurpos size; /* cursor bit map size */ + char *image; /* cursor image bits */ + char *mask; /* cursor mask bits */ +}; + /* Internal HW accel */ #define ROP_COPY 0 #define ROP_XOR 1 @@ -324,6 +351,8 @@ struct fb_ops { int (*fb_check_var)(struct fb_var_screeninfo *var, struct fb_info *info); /* set the video mode according to par */ int (*fb_set_par)(struct fb_info *info); + /* cursor control */ + int (*fb_cursor)(struct fb_info *info, struct fbcursor *cursor); /* set color register */ int (*fb_setcolreg)(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *info); @@ -358,12 +387,12 @@ struct fb_info { struct fb_var_screeninfo var; /* Current var */ struct fb_fix_screeninfo fix; /* Current fix */ struct fb_monspecs monspecs; /* Current Monitor specs */ + struct fbcursor cursor; /* Current cursor */ struct fb_cmap cmap; /* Current cmap */ struct fb_ops *fbops; char *screen_base; /* Virtual address */ struct vc_data *display_fg; /* Console visible on this display */ int currcon; /* Current VC. */ - char fontname[40]; /* default font name */ devfs_handle_t devfs_handle; /* Devfs handle for new name */ devfs_handle_t devfs_lhandle; /* Devfs handle for compat. symlink */ void *pseudo_palette; /* Fake palette of 16 colors and diff --git a/include/video/fbcon.h b/include/video/fbcon.h index 10ca672e0d65..1583517ce306 100644 --- a/include/video/fbcon.h +++ b/include/video/fbcon.h @@ -73,7 +73,8 @@ struct display { int bgcol; u_long next_line; /* offset to one line below */ u_long next_plane; /* offset to next plane */ - u_char *fontdata; /* Font associated to this display */ + char fontname[40]; /* Font associated to this display */ + u_char *fontdata; unsigned short _fontheightlog; unsigned short _fontwidthlog; unsigned short _fontheight; @@ -85,10 +86,9 @@ struct display { unsigned short charmask; /* 0xff or 0x1ff */ }; -/* drivers/video/fbcon.c */ +/* drivers/video/console/fbcon.c */ extern struct display fb_display[MAX_NR_CONSOLES]; extern char con2fb_map[MAX_NR_CONSOLES]; -extern int PROC_CONSOLE(const struct fb_info *info); extern void set_con2fb_map(int unit, int newidx); extern int set_all_vcs(int fbidx, struct fb_ops *fb, struct fb_var_screeninfo *var, struct fb_info *info); @@ -184,571 +184,4 @@ extern int set_all_vcs(int fbidx, struct fb_ops *fb, extern void fbcon_redraw_clear(struct vc_data *, struct display *, int, int, int, int); extern void fbcon_redraw_bmove(struct display *, int, int, int, int, int, int); - -/* ================================================================= */ -/* Utility Assembler Functions */ -/* ================================================================= */ - - -#if defined(__mc68000__) - -/* ====================================================================== */ - -/* Those of a delicate disposition might like to skip the next couple of - * pages. - * - * These functions are drop in replacements for memmove and - * memset(_, 0, _). However their five instances add at least a kilobyte - * to the object file. You have been warned. - * - * Not a great fan of assembler for the sake of it, but I think - * that these routines are at least 10 times faster than their C - * equivalents for large blits, and that's important to the lowest level of - * a graphics driver. Question is whether some scheme with the blitter - * would be faster. I suspect not for simple text system - not much - * asynchrony. - * - * Code is very simple, just gruesome expansion. Basic strategy is to - * increase data moved/cleared at each step to 16 bytes to reduce - * instruction per data move overhead. movem might be faster still - * For more than 15 bytes, we try to align the write direction on a - * longword boundary to get maximum speed. This is even more gruesome. - * Unaligned read/write used requires 68020+ - think this is a problem? - * - * Sorry! - */ - - -/* ++roman: I've optimized Robert's original versions in some minor - * aspects, e.g. moveq instead of movel, let gcc choose the registers, - * use movem in some places... - * For other modes than 1 plane, lots of more such assembler functions - * were needed (e.g. the ones using movep or expanding color values). - */ - -/* ++andreas: more optimizations: - subl #65536,d0 replaced by clrw d0; subql #1,d0 for dbcc - addal is faster than addaw - movep is rather expensive compared to ordinary move's - some functions rewritten in C for clarity, no speed loss */ - -static __inline__ void *fb_memclear_small(void *s, size_t count) -{ - if (!count) - return(0); - - __asm__ __volatile__( - "lsrl #1,%1 ; jcc 1f ; moveb %2,%0@-\n\t" - "1: lsrl #1,%1 ; jcc 1f ; movew %2,%0@-\n\t" - "1: lsrl #1,%1 ; jcc 1f ; movel %2,%0@-\n\t" - "1: lsrl #1,%1 ; jcc 1f ; movel %2,%0@- ; movel %2,%0@-\n\t" - "1:" - : "=a" (s), "=d" (count) - : "d" (0), "0" ((char *)s+count), "1" (count) - ); - __asm__ __volatile__( - "subql #1,%1 ; jcs 3f\n\t" - "movel %2,%%d4; movel %2,%%d5; movel %2,%%d6\n\t" - "2: moveml %2/%%d4/%%d5/%%d6,%0@-\n\t" - "dbra %1,2b\n\t" - "3:" - : "=a" (s), "=d" (count) - : "d" (0), "0" (s), "1" (count) - : "d4", "d5", "d6" - ); - - return(0); -} - - -static __inline__ void *fb_memclear(void *s, size_t count) -{ - if (!count) - return(0); - - if (count < 16) { - __asm__ __volatile__( - "lsrl #1,%1 ; jcc 1f ; clrb %0@+\n\t" - "1: lsrl #1,%1 ; jcc 1f ; clrw %0@+\n\t" - "1: lsrl #1,%1 ; jcc 1f ; clrl %0@+\n\t" - "1: lsrl #1,%1 ; jcc 1f ; clrl %0@+ ; clrl %0@+\n\t" - "1:" - : "=a" (s), "=d" (count) - : "0" (s), "1" (count) - ); - } else { - long tmp; - __asm__ __volatile__( - "movel %1,%2\n\t" - "lsrl #1,%2 ; jcc 1f ; clrb %0@+ ; subqw #1,%1\n\t" - "lsrl #1,%2 ; jcs 2f\n\t" /* %0 increased=>bit 2 switched*/ - "clrw %0@+ ; subqw #2,%1 ; jra 2f\n\t" - "1: lsrl #1,%2 ; jcc 2f\n\t" - "clrw %0@+ ; subqw #2,%1\n\t" - "2: movew %1,%2; lsrl #2,%1 ; jeq 6f\n\t" - "lsrl #1,%1 ; jcc 3f ; clrl %0@+\n\t" - "3: lsrl #1,%1 ; jcc 4f ; clrl %0@+ ; clrl %0@+\n\t" - "4: subql #1,%1 ; jcs 6f\n\t" - "5: clrl %0@+; clrl %0@+ ; clrl %0@+ ; clrl %0@+\n\t" - "dbra %1,5b ; clrw %1; subql #1,%1; jcc 5b\n\t" - "6: movew %2,%1; btst #1,%1 ; jeq 7f ; clrw %0@+\n\t" - "7: ; btst #0,%1 ; jeq 8f ; clrb %0@+\n\t" - "8:" - : "=a" (s), "=d" (count), "=d" (tmp) - : "0" (s), "1" (count) - ); - } - - return(0); -} - - -static __inline__ void *fb_memset255(void *s, size_t count) -{ - if (!count) - return(0); - - __asm__ __volatile__( - "lsrl #1,%1 ; jcc 1f ; moveb %2,%0@-\n\t" - "1: lsrl #1,%1 ; jcc 1f ; movew %2,%0@-\n\t" - "1: lsrl #1,%1 ; jcc 1f ; movel %2,%0@-\n\t" - "1: lsrl #1,%1 ; jcc 1f ; movel %2,%0@- ; movel %2,%0@-\n\t" - "1:" - : "=a" (s), "=d" (count) - : "d" (-1), "0" ((char *)s+count), "1" (count) - ); - __asm__ __volatile__( - "subql #1,%1 ; jcs 3f\n\t" - "movel %2,%%d4; movel %2,%%d5; movel %2,%%d6\n\t" - "2: moveml %2/%%d4/%%d5/%%d6,%0@-\n\t" - "dbra %1,2b\n\t" - "3:" - : "=a" (s), "=d" (count) - : "d" (-1), "0" (s), "1" (count) - : "d4", "d5", "d6" - ); - - return(0); -} - - -static __inline__ void *fb_memmove(void *d, const void *s, size_t count) -{ - if (d < s) { - if (count < 16) { - __asm__ __volatile__( - "lsrl #1,%2 ; jcc 1f ; moveb %1@+,%0@+\n\t" - "1: lsrl #1,%2 ; jcc 1f ; movew %1@+,%0@+\n\t" - "1: lsrl #1,%2 ; jcc 1f ; movel %1@+,%0@+\n\t" - "1: lsrl #1,%2 ; jcc 1f ; movel %1@+,%0@+ ; movel %1@+,%0@+\n\t" - "1:" - : "=a" (d), "=a" (s), "=d" (count) - : "0" (d), "1" (s), "2" (count) - ); - } else { - long tmp; - __asm__ __volatile__( - "movel %0,%3\n\t" - "lsrl #1,%3 ; jcc 1f ; moveb %1@+,%0@+ ; subqw #1,%2\n\t" - "lsrl #1,%3 ; jcs 2f\n\t" /* %0 increased=>bit 2 switched*/ - "movew %1@+,%0@+ ; subqw #2,%2 ; jra 2f\n\t" - "1: lsrl #1,%3 ; jcc 2f\n\t" - "movew %1@+,%0@+ ; subqw #2,%2\n\t" - "2: movew %2,%-; lsrl #2,%2 ; jeq 6f\n\t" - "lsrl #1,%2 ; jcc 3f ; movel %1@+,%0@+\n\t" - "3: lsrl #1,%2 ; jcc 4f ; movel %1@+,%0@+ ; movel %1@+,%0@+\n\t" - "4: subql #1,%2 ; jcs 6f\n\t" - "5: movel %1@+,%0@+;movel %1@+,%0@+\n\t" - "movel %1@+,%0@+;movel %1@+,%0@+\n\t" - "dbra %2,5b ; clrw %2; subql #1,%2; jcc 5b\n\t" - "6: movew %+,%2; btst #1,%2 ; jeq 7f ; movew %1@+,%0@+\n\t" - "7: ; btst #0,%2 ; jeq 8f ; moveb %1@+,%0@+\n\t" - "8:" - : "=a" (d), "=a" (s), "=d" (count), "=d" (tmp) - : "0" (d), "1" (s), "2" (count) - ); - } - } else { - if (count < 16) { - __asm__ __volatile__( - "lsrl #1,%2 ; jcc 1f ; moveb %1@-,%0@-\n\t" - "1: lsrl #1,%2 ; jcc 1f ; movew %1@-,%0@-\n\t" - "1: lsrl #1,%2 ; jcc 1f ; movel %1@-,%0@-\n\t" - "1: lsrl #1,%2 ; jcc 1f ; movel %1@-,%0@- ; movel %1@-,%0@-\n\t" - "1:" - : "=a" (d), "=a" (s), "=d" (count) - : "0" ((char *) d + count), "1" ((char *) s + count), "2" (count) - ); - } else { - long tmp; - __asm__ __volatile__( - "movel %0,%3\n\t" - "lsrl #1,%3 ; jcc 1f ; moveb %1@-,%0@- ; subqw #1,%2\n\t" - "lsrl #1,%3 ; jcs 2f\n\t" /* %0 increased=>bit 2 switched*/ - "movew %1@-,%0@- ; subqw #2,%2 ; jra 2f\n\t" - "1: lsrl #1,%3 ; jcc 2f\n\t" - "movew %1@-,%0@- ; subqw #2,%2\n\t" - "2: movew %2,%-; lsrl #2,%2 ; jeq 6f\n\t" - "lsrl #1,%2 ; jcc 3f ; movel %1@-,%0@-\n\t" - "3: lsrl #1,%2 ; jcc 4f ; movel %1@-,%0@- ; movel %1@-,%0@-\n\t" - "4: subql #1,%2 ; jcs 6f\n\t" - "5: movel %1@-,%0@-;movel %1@-,%0@-\n\t" - "movel %1@-,%0@-;movel %1@-,%0@-\n\t" - "dbra %2,5b ; clrw %2; subql #1,%2; jcc 5b\n\t" - "6: movew %+,%2; btst #1,%2 ; jeq 7f ; movew %1@-,%0@-\n\t" - "7: ; btst #0,%2 ; jeq 8f ; moveb %1@-,%0@-\n\t" - "8:" - : "=a" (d), "=a" (s), "=d" (count), "=d" (tmp) - : "0" ((char *) d + count), "1" ((char *) s + count), "2" (count) - ); - } - } - - return(0); -} - - -/* ++andreas: Simple and fast version of memmove, assumes size is - divisible by 16, suitable for moving the whole screen bitplane */ -static __inline__ void fast_memmove(char *dst, const char *src, size_t size) -{ - if (!size) - return; - if (dst < src) - __asm__ __volatile__ - ("1:" - " moveml %0@+,%/d0/%/d1/%/a0/%/a1\n" - " moveml %/d0/%/d1/%/a0/%/a1,%1@\n" - " addql #8,%1; addql #8,%1\n" - " dbra %2,1b\n" - " clrw %2; subql #1,%2\n" - " jcc 1b" - : "=a" (src), "=a" (dst), "=d" (size) - : "0" (src), "1" (dst), "2" (size / 16 - 1) - : "d0", "d1", "a0", "a1", "memory"); - else - __asm__ __volatile__ - ("1:" - " subql #8,%0; subql #8,%0\n" - " moveml %0@,%/d0/%/d1/%/a0/%/a1\n" - " moveml %/d0/%/d1/%/a0/%/a1,%1@-\n" - " dbra %2,1b\n" - " clrw %2; subql #1,%2\n" - " jcc 1b" - : "=a" (src), "=a" (dst), "=d" (size) - : "0" (src + size), "1" (dst + size), "2" (size / 16 - 1) - : "d0", "d1", "a0", "a1", "memory"); -} - -#elif defined(CONFIG_SUN4) - -/* You may think that I'm crazy and that I should use generic - routines. No, I'm not: sun4's framebuffer crashes if we std - into it, so we cannot use memset. */ - -static __inline__ void *sun4_memset(void *s, char val, size_t count) -{ - int i; - for(i=0; i<count;i++) - ((char *) s) [i] = val; - return s; -} - -static __inline__ void *fb_memset255(void *s, size_t count) -{ - return sun4_memset(s, 255, count); -} - -static __inline__ void *fb_memclear(void *s, size_t count) -{ - return sun4_memset(s, 0, count); -} - -static __inline__ void *fb_memclear_small(void *s, size_t count) -{ - return sun4_memset(s, 0, count); -} - -/* To be honest, this is slow_memmove :). But sun4 is crappy, so what we can do. */ -static __inline__ void fast_memmove(void *d, const void *s, size_t count) -{ - int i; - if (d<s) { - for (i=0; i<count; i++) - ((char *) d)[i] = ((char *) s)[i]; - } else - for (i=0; i<count; i++) - ((char *) d)[count-i-1] = ((char *) s)[count-i-1]; -} - -static __inline__ void *fb_memmove(char *dst, const char *src, size_t size) -{ - fast_memmove(dst, src, size); - return dst; -} - -#else - -static __inline__ void *fb_memclear_small(void *s, size_t count) -{ - char *xs = (char *) s; - - while (count--) - fb_writeb(0, xs++); - - return s; -} - -static __inline__ void *fb_memclear(void *s, size_t count) -{ - unsigned long xs = (unsigned long) s; - - if (count < 8) - goto rest; - - if (xs & 1) { - fb_writeb(0, xs++); - count--; - } - if (xs & 2) { - fb_writew(0, xs); - xs += 2; - count -= 2; - } - while (count > 3) { - fb_writel(0, xs); - xs += 4; - count -= 4; - } -rest: - while (count--) - fb_writeb(0, xs++); - - return s; -} - -static __inline__ void *fb_memset255(void *s, size_t count) -{ - unsigned long xs = (unsigned long) s; - - if (count < 8) - goto rest; - - if (xs & 1) { - fb_writeb(0xff, xs++); - count--; - } - if (xs & 2) { - fb_writew(0xffff, xs); - xs += 2; - count -= 2; - } - while (count > 3) { - fb_writel(0xffffffff, xs); - xs += 4; - count -= 4; - } -rest: - while (count--) - fb_writeb(0xff, xs++); - - return s; -} - -#if defined(__i386__) - -static __inline__ void fast_memmove(void *d, const void *s, size_t count) -{ - int d0, d1, d2, d3; - if (d < s) { -__asm__ __volatile__ ( - "cld\n\t" - "shrl $1,%%ecx\n\t" - "jnc 1f\n\t" - "movsb\n" - "1:\tshrl $1,%%ecx\n\t" - "jnc 2f\n\t" - "movsw\n" - "2:\trep\n\t" - "movsl" - : "=&c" (d0), "=&D" (d1), "=&S" (d2) - :"0"(count),"1"((long)d),"2"((long)s) - :"memory"); - } else { -__asm__ __volatile__ ( - "std\n\t" - "shrl $1,%%ecx\n\t" - "jnc 1f\n\t" - "movb 3(%%esi),%%al\n\t" - "movb %%al,3(%%edi)\n\t" - "decl %%esi\n\t" - "decl %%edi\n" - "1:\tshrl $1,%%ecx\n\t" - "jnc 2f\n\t" - "movw 2(%%esi),%%ax\n\t" - "movw %%ax,2(%%edi)\n\t" - "decl %%esi\n\t" - "decl %%edi\n\t" - "decl %%esi\n\t" - "decl %%edi\n" - "2:\trep\n\t" - "movsl\n\t" - "cld" - : "=&c" (d0), "=&D" (d1), "=&S" (d2), "=&a" (d3) - :"0"(count),"1"(count-4+(long)d),"2"(count-4+(long)s) - :"memory"); - } -} - -static __inline__ void *fb_memmove(char *dst, const char *src, size_t size) -{ - fast_memmove(dst, src, size); - return dst; -} - -#else /* !__i386__ */ - - /* - * Anyone who'd like to write asm functions for other CPUs? - * (Why are these functions better than those from include/asm/string.h?) - */ - -static __inline__ void *fb_memmove(void *d, const void *s, size_t count) -{ - unsigned long dst, src; - - if (d < s) { - dst = (unsigned long) d; - src = (unsigned long) s; - - if ((count < 8) || ((dst ^ src) & 3)) - goto restup; - - if (dst & 1) { - fb_writeb(fb_readb(src++), dst++); - count--; - } - if (dst & 2) { - fb_writew(fb_readw(src), dst); - src += 2; - dst += 2; - count -= 2; - } - while (count > 3) { - fb_writel(fb_readl(src), dst); - src += 4; - dst += 4; - count -= 4; - } - - restup: - while (count--) - fb_writeb(fb_readb(src++), dst++); - } else { - dst = (unsigned long) d + count; - src = (unsigned long) s + count; - - if ((count < 8) || ((dst ^ src) & 3)) - goto restdown; - - if (dst & 1) { - src--; - dst--; - count--; - fb_writeb(fb_readb(src), dst); - } - if (dst & 2) { - src -= 2; - dst -= 2; - count -= 2; - fb_writew(fb_readw(src), dst); - } - while (count > 3) { - src -= 4; - dst -= 4; - count -= 4; - fb_writel(fb_readl(src), dst); - } - - restdown: - while (count--) { - src--; - dst--; - fb_writeb(fb_readb(src), dst); - } - } - - return d; -} - -static __inline__ void fast_memmove(char *d, const char *s, size_t count) -{ - unsigned long dst, src; - - if (d < s) { - dst = (unsigned long) d; - src = (unsigned long) s; - - if ((count < 8) || ((dst ^ src) & 3)) - goto restup; - - if (dst & 1) { - fb_writeb(fb_readb(src++), dst++); - count--; - } - if (dst & 2) { - fb_writew(fb_readw(src), dst); - src += 2; - dst += 2; - count -= 2; - } - while (count > 3) { - fb_writel(fb_readl(src), dst); - src += 4; - dst += 4; - count -= 4; - } - - restup: - while (count--) - fb_writeb(fb_readb(src++), dst++); - } else { - dst = (unsigned long) d + count; - src = (unsigned long) s + count; - - if ((count < 8) || ((dst ^ src) & 3)) - goto restdown; - - if (dst & 1) { - src--; - dst--; - count--; - fb_writeb(fb_readb(src), dst); - } - if (dst & 2) { - src -= 2; - dst -= 2; - count -= 2; - fb_writew(fb_readw(src), dst); - } - while (count > 3) { - src -= 4; - dst -= 4; - count -= 4; - fb_writel(fb_readl(src), dst); - } - - restdown: - while (count--) { - src--; - dst--; - fb_writeb(fb_readb(src), dst); - } - } -} - -#endif /* !__i386__ */ - -#endif /* !__mc68000__ */ - #endif /* _VIDEO_FBCON_H */ |
