ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / drivers / video / console / fbcon.h
1 /*
2  *  linux/drivers/video/console/fbcon.h -- Low level frame buffer based console driver
3  *
4  *      Copyright (C) 1997 Geert Uytterhoeven
5  *
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
8  *  for more details.
9  */
10
11 #ifndef _VIDEO_FBCON_H
12 #define _VIDEO_FBCON_H
13
14 #include <linux/config.h>
15 #include <linux/types.h>
16 #include <linux/vt_buffer.h>
17 #include <linux/vt_kern.h>
18
19 #include <asm/io.h>
20
21    /*
22     *    This is the interface between the low-level console driver and the
23     *    low-level frame buffer device
24     */
25
26 struct display {
27     /* Filled in by the frame buffer device */
28     u_short inverse;                /* != 0 text black on white as default */
29     /* Filled in by the low-level console driver */
30     char fontname[40];              /* Font associated to this display */       
31     u_char *fontdata;
32     int userfont;                   /* != 0 if fontdata kmalloc()ed */
33     u_short scrollmode;             /* Scroll Method */
34     short yscroll;                  /* Hardware scrolling */
35     int vrows;                      /* number of virtual rows */
36     int cursor_shape;
37 };
38
39 /* drivers/video/console/fbcon.c */
40 extern char con2fb_map[MAX_NR_CONSOLES];
41 extern int set_con2fb_map(int unit, int newidx);
42
43     /*
44      *  Attribute Decoding
45      */
46
47 /* Color */
48 #define attr_fgcol(fgshift,s)    \
49         (((s) >> (fgshift)) & 0x0f)
50 #define attr_bgcol(bgshift,s)    \
51         (((s) >> (bgshift)) & 0x0f)
52 #define attr_bgcol_ec(bgshift,vc) \
53         ((vc) ? (((vc)->vc_video_erase_char >> (bgshift)) & 0x0f) : 0)
54 #define attr_fgcol_ec(fgshift,vc) \
55         ((vc) ? (((vc)->vc_video_erase_char >> (fgshift)) & 0x0f) : 0)
56
57 /* Monochrome */
58 #define attr_bold(s) \
59         ((s) & 0x200)
60 #define attr_reverse(s, inverse) \
61         (((s) & 0x800) ^ (inverse ? 0x800 : 0))
62 #define attr_underline(s) \
63         ((s) & 0x400)
64 #define attr_blink(s) \
65         ((s) & 0x8000)
66         
67     /*
68      *  Scroll Method
69      */
70      
71 /* Internal flags */
72 #define __SCROLL_YPAN           0x001
73 #define __SCROLL_YWRAP          0x002
74 #define __SCROLL_YMOVE          0x003
75 #define __SCROLL_YREDRAW        0x004
76 #define __SCROLL_YMASK          0x00f
77 #define __SCROLL_YFIXED         0x010
78 #define __SCROLL_YNOMOVE        0x020
79 #define __SCROLL_YPANREDRAW     0x040
80 #define __SCROLL_YNOPARTIAL     0x080
81
82 /* Only these should be used by the drivers */
83 /* Which one should you use? If you have a fast card and slow bus,
84    then probably just 0 to indicate fbcon should choose between
85    YWRAP/YPAN+MOVE/YMOVE. On the other side, if you have a fast bus
86    and even better if your card can do fonting (1->8/32bit painting),
87    you should consider either SCROLL_YREDRAW (if your card is
88    able to do neither YPAN/YWRAP), or SCROLL_YNOMOVE.
89    The best is to test it with some real life scrolling (usually, not
90    all lines on the screen are filled completely with non-space characters,
91    and REDRAW performs much better on such lines, so don't cat a file
92    with every line covering all screen columns, it would not be the right
93    benchmark).
94  */
95 #define SCROLL_YREDRAW          (__SCROLL_YFIXED|__SCROLL_YREDRAW)
96 #define SCROLL_YNOMOVE          (__SCROLL_YNOMOVE|__SCROLL_YPANREDRAW)
97
98 /* SCROLL_YNOPARTIAL, used in combination with the above, is for video
99    cards which can not handle using panning to scroll a portion of the
100    screen without excessive flicker.  Panning will only be used for
101    whole screens.
102  */
103 /* Namespace consistency */
104 #define SCROLL_YNOPARTIAL       __SCROLL_YNOPARTIAL
105
106 extern int fb_console_init(void);
107
108 #endif /* _VIDEO_FBCON_H */