2 * linux/drivers/video/fbcon.h -- Low level frame buffer based console driver
4 * Copyright (C) 1997 Geert Uytterhoeven
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
11 #ifndef _VIDEO_FBCON_H
12 #define _VIDEO_FBCON_H
17 /* Filled in by the frame buffer device */
19 struct fb_var_screeninfo var; /* variable infos. yoffset and vmode */
20 /* are updated by fbcon.c */
21 struct fb_cmap cmap; /* colormap */
22 char *screen_base; /* pointer to top of virtual screen */
23 /* (virtual address) */
25 int type; /* see FB_TYPE_* */
26 int type_aux; /* Interleave for interleaved Planes */
27 u16 ypanstep; /* zero if no hardware ypan */
28 u16 ywrapstep; /* zero if no hardware ywrap */
29 u32 line_length; /* length of a line in bytes */
30 u16 can_soft_blank; /* zero if no hardware blanking */
31 u16 inverse; /* != 0 text black on white as default */
32 // struct display_switch *dispsw; /* low level operations */
33 // void *dispsw_data; /* optional dispsw helper data */
36 struct fb_fix_cursorinfo fcrsr;
37 struct fb_var_cursorinfo *vcrsr;
38 struct fb_cursorstate crsrstate;
41 /* Filled in by the low-level console driver */
43 struct vc_data *conp; /* pointer to console data */
44 // struct fb_info *fb_info; /* frame buffer for this console */
45 int vrows; /* number of virtual rows */
46 unsigned short cursor_x; /* current cursor position */
47 unsigned short cursor_y;
48 int fgcol; /* text colors */
50 u32 next_line; /* offset to one line below */
51 u32 next_plane; /* offset to next plane */
52 u8 *fontdata; /* Font associated to this display */
53 unsigned short _fontheightlog;
54 unsigned short _fontwidthlog;
55 unsigned short _fontheight;
56 unsigned short _fontwidth;
57 int userfont; /* != 0 if fontdata kmalloc()ed */
58 u16 scrollmode; /* Scroll Method */
59 short yscroll; /* Hardware scrolling */
60 unsigned char fgshift, bgshift;
61 unsigned short charmask; /* 0xff or 0x1ff */
65 #define fontheight(p) ((p)->_fontheight)
66 #define fontheightlog(p) ((p)->_fontheightlog)
68 #ifdef FBCON_FONTWIDTH8_ONLY
70 /* fontwidth w is supported by dispsw */
71 #define FONTWIDTH(w) (1 << ((8) - 1))
72 /* fontwidths w1-w2 inclusive are supported by dispsw */
73 #define FONTWIDTHRANGE(w1,w2) FONTWIDTH(8)
75 #define fontwidth(p) (8)
76 #define fontwidthlog(p) (0)
80 /* fontwidth w is supported by dispsw */
81 #define FONTWIDTH(w) (1 << ((w) - 1))
82 /* fontwidths w1-w2 inclusive are supported by dispsw */
83 #define FONTWIDTHRANGE(w1,w2) (FONTWIDTH(w2+1) - FONTWIDTH(w1))
85 #define fontwidth(p) ((p)->_fontwidth)
86 #define fontwidthlog(p) ((p)->_fontwidthlog)
95 #define attr_fgcol(p,s) \
96 (((s) >> ((p)->fgshift)) & 0x0f)
97 #define attr_bgcol(p,s) \
98 (((s) >> ((p)->bgshift)) & 0x0f)
99 #define attr_bgcol_ec(p,conp) \
100 ((conp) ? (((conp)->vc_video_erase_char >> ((p)->bgshift)) & 0x0f) : 0)
103 #define attr_bold(p,s) \
105 #define attr_reverse(p,s) \
106 (((s) & 0x800) ^ ((p)->inverse ? 0x800 : 0))
107 #define attr_underline(p,s) \
109 #define attr_blink(p,s) \
117 #define __SCROLL_YPAN 0x001
118 #define __SCROLL_YWRAP 0x002
119 #define __SCROLL_YMOVE 0x003
120 #define __SCROLL_YREDRAW 0x004
121 #define __SCROLL_YMASK 0x00f
122 #define __SCROLL_YFIXED 0x010
123 #define __SCROLL_YNOMOVE 0x020
124 #define __SCROLL_YPANREDRAW 0x040
125 #define __SCROLL_YNOPARTIAL 0x080
127 /* Only these should be used by the drivers */
128 /* Which one should you use? If you have a fast card and slow bus,
129 then probably just 0 to indicate fbcon should choose between
130 YWRAP/YPAN+MOVE/YMOVE. On the other side, if you have a fast bus
131 and even better if your card can do fonting (1->8/32bit painting),
132 you should consider either SCROLL_YREDRAW (if your card is
133 able to do neither YPAN/YWRAP), or SCROLL_YNOMOVE.
134 The best is to test it with some real life scrolling (usually, not
135 all lines on the screen are filled completely with non-space characters,
136 and REDRAW performs much better on such lines, so don't cat a file
137 with every line covering all screen columns, it would not be the right
140 #define SCROLL_YREDRAW (__SCROLL_YFIXED|__SCROLL_YREDRAW)
141 #define SCROLL_YNOMOVE (__SCROLL_YNOMOVE|__SCROLL_YPANREDRAW)
143 /* SCROLL_YNOPARTIAL, used in combination with the above, is for video
144 cards which can not handle using panning to scroll a portion of the
145 screen without excessive flicker. Panning will only be used for
148 /* Namespace consistency */
149 #define SCROLL_YNOPARTIAL __SCROLL_YNOPARTIAL
152 #if defined(__i386__) || defined(__alpha__) || \
153 defined(__x86_64__) || defined(__hppa__) || \
154 defined(__powerpc64__)
156 #define fb_readb __raw_readb
157 #define fb_readw __raw_readw
158 #define fb_readl __raw_readl
159 #define fb_writeb __raw_writeb
160 #define fb_writew __raw_writew
161 #define fb_writel __raw_writel
162 #define fb_memset memset_io
166 #define fb_readb(addr) (*(volatile u8 *) (addr))
167 #define fb_readw(addr) (*(volatile u16 *) (addr))
168 #define fb_readl(addr) (*(volatile u32 *) (addr))
169 #define fb_writeb(b,addr) (*(volatile u8 *) (addr) = (b))
170 #define fb_writew(b,addr) (*(volatile u16 *) (addr) = (b))
171 #define fb_writel(b,addr) (*(volatile u32 *) (addr) = (b))
172 #define fb_memset memset
176 #endif /* _VIDEO_FBCON_H */