Stefan Reinauer | 234454d | 2004-04-24 23:10:51 +0000 | [diff] [blame] | 1 | /* |
| 2 | * linux/drivers/video/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 | |
Stefan Reinauer | 234454d | 2004-04-24 23:10:51 +0000 | [diff] [blame] | 14 | struct display { |
| 15 | /* Filled in by the frame buffer device */ |
Stefan Reinauer | 234454d | 2004-04-24 23:10:51 +0000 | [diff] [blame] | 16 | struct fb_var_screeninfo var; /* variable infos. yoffset and vmode */ |
| 17 | /* are updated by fbcon.c */ |
| 18 | struct fb_cmap cmap; /* colormap */ |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 19 | char *screen_base; /* pointer to top of virtual screen */ |
Stefan Reinauer | 234454d | 2004-04-24 23:10:51 +0000 | [diff] [blame] | 20 | /* (virtual address) */ |
| 21 | int visual; |
| 22 | int type; /* see FB_TYPE_* */ |
| 23 | int type_aux; /* Interleave for interleaved Planes */ |
| 24 | u16 ypanstep; /* zero if no hardware ypan */ |
| 25 | u16 ywrapstep; /* zero if no hardware ywrap */ |
| 26 | u32 line_length; /* length of a line in bytes */ |
| 27 | u16 can_soft_blank; /* zero if no hardware blanking */ |
| 28 | u16 inverse; /* != 0 text black on white as default */ |
Stefan Reinauer | 234454d | 2004-04-24 23:10:51 +0000 | [diff] [blame] | 29 | |
| 30 | /* Filled in by the low-level console driver */ |
| 31 | |
| 32 | struct vc_data *conp; /* pointer to console data */ |
Stefan Reinauer | 234454d | 2004-04-24 23:10:51 +0000 | [diff] [blame] | 33 | int vrows; /* number of virtual rows */ |
| 34 | unsigned short cursor_x; /* current cursor position */ |
| 35 | unsigned short cursor_y; |
| 36 | int fgcol; /* text colors */ |
| 37 | int bgcol; |
| 38 | u32 next_line; /* offset to one line below */ |
| 39 | u32 next_plane; /* offset to next plane */ |
| 40 | u8 *fontdata; /* Font associated to this display */ |
| 41 | unsigned short _fontheightlog; |
| 42 | unsigned short _fontwidthlog; |
| 43 | unsigned short _fontheight; |
| 44 | unsigned short _fontwidth; |
| 45 | int userfont; /* != 0 if fontdata kmalloc()ed */ |
| 46 | u16 scrollmode; /* Scroll Method */ |
| 47 | short yscroll; /* Hardware scrolling */ |
| 48 | unsigned char fgshift, bgshift; |
| 49 | unsigned short charmask; /* 0xff or 0x1ff */ |
| 50 | }; |
| 51 | |
| 52 | |
| 53 | #define fontheight(p) ((p)->_fontheight) |
| 54 | #define fontheightlog(p) ((p)->_fontheightlog) |
| 55 | |
Myles Watson | 0bc6154 | 2009-10-17 13:25:07 +0000 | [diff] [blame] | 56 | #ifdef FBCON_FONTWIDTH8_ONLY |
Stefan Reinauer | 234454d | 2004-04-24 23:10:51 +0000 | [diff] [blame] | 57 | |
| 58 | /* fontwidth w is supported by dispsw */ |
| 59 | #define FONTWIDTH(w) (1 << ((8) - 1)) |
| 60 | /* fontwidths w1-w2 inclusive are supported by dispsw */ |
| 61 | #define FONTWIDTHRANGE(w1,w2) FONTWIDTH(8) |
| 62 | |
| 63 | #define fontwidth(p) (8) |
| 64 | #define fontwidthlog(p) (0) |
| 65 | |
| 66 | #else |
| 67 | |
| 68 | /* fontwidth w is supported by dispsw */ |
| 69 | #define FONTWIDTH(w) (1 << ((w) - 1)) |
| 70 | /* fontwidths w1-w2 inclusive are supported by dispsw */ |
| 71 | #define FONTWIDTHRANGE(w1,w2) (FONTWIDTH(w2+1) - FONTWIDTH(w1)) |
| 72 | |
| 73 | #define fontwidth(p) ((p)->_fontwidth) |
| 74 | #define fontwidthlog(p) ((p)->_fontwidthlog) |
| 75 | |
| 76 | #endif |
| 77 | |
| 78 | /* |
| 79 | * Attribute Decoding |
| 80 | */ |
| 81 | |
| 82 | /* Color */ |
| 83 | #define attr_fgcol(p,s) \ |
| 84 | (((s) >> ((p)->fgshift)) & 0x0f) |
| 85 | #define attr_bgcol(p,s) \ |
| 86 | (((s) >> ((p)->bgshift)) & 0x0f) |
| 87 | #define attr_bgcol_ec(p,conp) \ |
| 88 | ((conp) ? (((conp)->vc_video_erase_char >> ((p)->bgshift)) & 0x0f) : 0) |
| 89 | |
| 90 | /* Monochrome */ |
| 91 | #define attr_bold(p,s) \ |
| 92 | ((s) & 0x200) |
| 93 | #define attr_reverse(p,s) \ |
| 94 | (((s) & 0x800) ^ ((p)->inverse ? 0x800 : 0)) |
| 95 | #define attr_underline(p,s) \ |
| 96 | ((s) & 0x400) |
| 97 | #define attr_blink(p,s) \ |
| 98 | ((s) & 0x8000) |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 99 | |
Stefan Reinauer | 234454d | 2004-04-24 23:10:51 +0000 | [diff] [blame] | 100 | /* |
| 101 | * Scroll Method |
| 102 | */ |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 103 | |
Stefan Reinauer | 234454d | 2004-04-24 23:10:51 +0000 | [diff] [blame] | 104 | /* Internal flags */ |
| 105 | #define __SCROLL_YPAN 0x001 |
| 106 | #define __SCROLL_YWRAP 0x002 |
| 107 | #define __SCROLL_YMOVE 0x003 |
| 108 | #define __SCROLL_YREDRAW 0x004 |
| 109 | #define __SCROLL_YMASK 0x00f |
| 110 | #define __SCROLL_YFIXED 0x010 |
| 111 | #define __SCROLL_YNOMOVE 0x020 |
| 112 | #define __SCROLL_YPANREDRAW 0x040 |
| 113 | #define __SCROLL_YNOPARTIAL 0x080 |
| 114 | |
| 115 | /* Only these should be used by the drivers */ |
| 116 | /* Which one should you use? If you have a fast card and slow bus, |
| 117 | then probably just 0 to indicate fbcon should choose between |
| 118 | YWRAP/YPAN+MOVE/YMOVE. On the other side, if you have a fast bus |
| 119 | and even better if your card can do fonting (1->8/32bit painting), |
| 120 | you should consider either SCROLL_YREDRAW (if your card is |
| 121 | able to do neither YPAN/YWRAP), or SCROLL_YNOMOVE. |
| 122 | The best is to test it with some real life scrolling (usually, not |
| 123 | all lines on the screen are filled completely with non-space characters, |
| 124 | and REDRAW performs much better on such lines, so don't cat a file |
| 125 | with every line covering all screen columns, it would not be the right |
| 126 | benchmark). |
| 127 | */ |
| 128 | #define SCROLL_YREDRAW (__SCROLL_YFIXED|__SCROLL_YREDRAW) |
| 129 | #define SCROLL_YNOMOVE (__SCROLL_YNOMOVE|__SCROLL_YPANREDRAW) |
| 130 | |
| 131 | /* SCROLL_YNOPARTIAL, used in combination with the above, is for video |
| 132 | cards which can not handle using panning to scroll a portion of the |
| 133 | screen without excessive flicker. Panning will only be used for |
| 134 | whole screens. |
| 135 | */ |
| 136 | /* Namespace consistency */ |
| 137 | #define SCROLL_YNOPARTIAL __SCROLL_YNOPARTIAL |
| 138 | |
Stefan Reinauer | 234454d | 2004-04-24 23:10:51 +0000 | [diff] [blame] | 139 | #endif /* _VIDEO_FBCON_H */ |