patch-2_6_7-vs1_9_1_12
[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     u_char *fontdata;
31     int userfont;                   /* != 0 if fontdata kmalloc()ed */
32     u_short scrollmode;             /* Scroll Method */
33     short yscroll;                  /* Hardware scrolling */
34     int vrows;                      /* number of virtual rows */
35     int cursor_shape;
36 };
37
38 /* drivers/video/console/fbcon.c */
39 extern char con2fb_map[MAX_NR_CONSOLES];
40 extern int set_con2fb_map(int unit, int newidx);
41
42     /*
43      *  Attribute Decoding
44      */
45
46 /* Color */
47 #define attr_fgcol(fgshift,s)    \
48         (((s) >> (fgshift)) & 0x0f)
49 #define attr_bgcol(bgshift,s)    \
50         (((s) >> (bgshift)) & 0x0f)
51 #define attr_bgcol_ec(bgshift,vc) \
52         ((vc) ? (((vc)->vc_video_erase_char >> (bgshift)) & 0x0f) : 0)
53 #define attr_fgcol_ec(fgshift,vc) \
54         ((vc) ? (((vc)->vc_video_erase_char >> (fgshift)) & 0x0f) : 0)
55
56 /* Monochrome */
57 #define attr_bold(s) \
58         ((s) & 0x200)
59 #define attr_reverse(s, inverse) \
60         (((s) & 0x800) ^ (inverse ? 0x800 : 0))
61 #define attr_underline(s) \
62         ((s) & 0x400)
63 #define attr_blink(s) \
64         ((s) & 0x8000)
65         
66     /*
67      *  Scroll Method
68      */
69      
70 /* Internal flags */
71 #define __SCROLL_YPAN           0x001
72 #define __SCROLL_YWRAP          0x002
73 #define __SCROLL_YMOVE          0x003
74 #define __SCROLL_YREDRAW        0x004
75 #define __SCROLL_YMASK          0x00f
76 #define __SCROLL_YFIXED         0x010
77 #define __SCROLL_YNOMOVE        0x020
78 #define __SCROLL_YPANREDRAW     0x040
79 #define __SCROLL_YNOPARTIAL     0x080
80
81 /* Only these should be used by the drivers */
82 /* Which one should you use? If you have a fast card and slow bus,
83    then probably just 0 to indicate fbcon should choose between
84    YWRAP/YPAN+MOVE/YMOVE. On the other side, if you have a fast bus
85    and even better if your card can do fonting (1->8/32bit painting),
86    you should consider either SCROLL_YREDRAW (if your card is
87    able to do neither YPAN/YWRAP), or SCROLL_YNOMOVE.
88    The best is to test it with some real life scrolling (usually, not
89    all lines on the screen are filled completely with non-space characters,
90    and REDRAW performs much better on such lines, so don't cat a file
91    with every line covering all screen columns, it would not be the right
92    benchmark).
93  */
94 #define SCROLL_YREDRAW          (__SCROLL_YFIXED|__SCROLL_YREDRAW)
95 #define SCROLL_YNOMOVE          (__SCROLL_YNOMOVE|__SCROLL_YPANREDRAW)
96
97 /* SCROLL_YNOPARTIAL, used in combination with the above, is for video
98    cards which can not handle using panning to scroll a portion of the
99    screen without excessive flicker.  Panning will only be used for
100    whole screens.
101  */
102 /* Namespace consistency */
103 #define SCROLL_YNOPARTIAL       __SCROLL_YNOPARTIAL
104
105 extern int fb_console_init(void);
106
107 #endif /* _VIDEO_FBCON_H */