git.y1.nz

fbui

Framebuffer-based graphical environment
download: https://git.y1.nz/archives/fbui.tar.gz
README | Files | Log | Refs

include/linux/fb.h

      1 #ifndef _LINUX_FB_H
      2 #define _LINUX_FB_H
      3 
      4 #include <asm/types.h>
      5 
      6 /* Definitions of frame buffers						*/
      7 
      8 #define FB_MAJOR		29
      9 #define FB_MAX			32	/* sufficient for now */
     10 
     11 /* ioctls
     12    0x46 is 'F'								*/
     13 #define FBIOGET_VSCREENINFO	0x4600
     14 #define FBIOPUT_VSCREENINFO	0x4601
     15 #define FBIOGET_FSCREENINFO	0x4602
     16 #define FBIOGETCMAP		0x4604
     17 #define FBIOPUTCMAP		0x4605
     18 #define FBIOPAN_DISPLAY		0x4606
     19 #ifdef __KERNEL__
     20 #define FBIO_CURSOR            _IOWR('F', 0x08, struct fb_cursor_user)
     21 #else
     22 #define FBIO_CURSOR            _IOWR('F', 0x08, struct fb_cursor)
     23 #endif
     24 /* 0x4607-0x460B are defined below */
     25 /* #define FBIOGET_MONITORSPEC	0x460C */
     26 /* #define FBIOPUT_MONITORSPEC	0x460D */
     27 /* #define FBIOSWITCH_MONIBIT	0x460E */
     28 #define FBIOGET_CON2FBMAP	0x460F
     29 #define FBIOPUT_CON2FBMAP	0x4610
     30 #define FBIOBLANK		0x4611		/* arg: 0 or vesa level + 1 */
     31 #define FBIOGET_VBLANK		_IOR('F', 0x12, struct fb_vblank)
     32 #define FBIO_ALLOC              0x4613
     33 #define FBIO_FREE               0x4614
     34 #define FBIOGET_GLYPH           0x4615
     35 #define FBIOGET_HWCINFO         0x4616
     36 #define FBIOPUT_MODEINFO        0x4617
     37 #define FBIOGET_DISPINFO        0x4618
     38 
     39 
     40 /* ==========================================================================*/
     41 /* FBUI ioctls */
     42 /* FBUI additions by Zachary T Smith, fbui@comcast.net */
     43 
     44 #define FBIO_UI_OPEN            0x4619  /* arg = ptr to fb_ui_open */
     45 #define FBIO_UI_CLOSE           0x461a  /* no arg */
     46 	/* Exec commands are queued and are not executed if window
     47 	 * is not visible. */
     48 #define FBIO_UI_EXEC            0x461b  /* arg = ptr to array of shorts (1st=count) */
     49 	/* Control commands are _not_ queued and are always executed*/
     50 #define FBIO_UI_CONTROL		0x461c  /* arg = ptr to fbui_ctrlparams struct */
     51 #define FBUI_NAMELEN 32
     52 typedef unsigned long RGB;
     53 
     54 /* FBUI program type hints for fbui_openparams */
     55 #define FBUI_PROGTYPE_NONE 0
     56 #define FBUI_PROGTYPE_APP 1		/* e.g. takes main area */
     57 #define FBUI_PROGTYPE_LAUNCHER 2	/* e.g. takes bottom row area */
     58 #define FBUI_PROGTYPE_TOOL 3		/* e.g. fbclock: takes right area permanently */
     59 #define FBUI_PROGTYPE_EPHEMERAL 4	/* e.g. calculator */
     60 #define FBUI_PROGTYPE_WM 	5	/* window mgr, panel mgr */
     61 #define FBUI_PROGTYPE_LAST 6 /* not for use */
     62 
     63 /* A few accelerator keys encoded into 0..31 */
     64 #define FBUI_ACCEL_PRTSC 1
     65 #define FBUI_ACCEL_HOME 2
     66 #define FBUI_ACCEL_END 3
     67 #define FBUI_ACCEL_PGUP 4
     68 #define FBUI_ACCEL_PGDN 5
     69 
     70 #define FBUI_BUTTON_LEFT 2
     71 #define FBUI_BUTTON_RIGHT 4
     72 #define FBUI_BUTTON_MIDDLE 8
     73 
     74 
     75 /* Passed _in_ to FBIO_UI_OPEN ioctl */
     76 struct fbui_openparams {
     77 	char	desired_vc;	/* -1 = current */
     78 	char	req_control;   	/* maximum one window manager per vc */
     79 	char	doing_autoposition;   /* used to differentiate btw fbwm & fbpm */
     80 	char	program_type;	/* if !0, window is hidden upon creation, wm informed */
     81 	char	need_keys;	/* key focus */
     82 	char	need_motion;	/* pointer focus */
     83 	char	receive_all_motion;	/* supported for window manager only */
     84 	char	initially_hidden;
     85 	short 	x0;
     86 	short 	y0;
     87 	short 	x1;
     88 	short 	y1;
     89 	short	max_width;
     90 	short	max_height;
     91 	__u32 	bgcolor;
     92 	char 	name [FBUI_NAMELEN];
     93 	char 	subtitle [FBUI_NAMELEN];
     94 };
     95 
     96 /* Data passed _out_ kernel via FBUI_WININFO command */
     97 struct fbui_wininfo {
     98 	short	id;
     99 	int	pid;
    100 	char	program_type;
    101 	char	hidden;
    102 	char	need_placement;
    103 	char	need_keys;
    104 	char	need_motion;
    105 	short	x, y;
    106 	short	width, height;
    107 	short	max_width;
    108 	short	max_height;
    109 	char 	name [FBUI_NAMELEN];
    110 	char 	subtitle [FBUI_NAMELEN];
    111 };
    112 
    113 /* Data passed _out_ kernel via FBUI_POLLEVENT & FBUI_WAITEVENT commands */
    114 struct fbui_event {
    115 	char	type;
    116 	short	id;
    117 	int	pid;
    118 	short	x, y;
    119 	short	width, height;
    120 	short	key;
    121 };
    122 
    123 /* Passed _in_ to FBIO_UI_CONTROL
    124  */
    125 struct fbui_ctrlparams {
    126 	char	op;
    127 	short	id;
    128 	short	id2; /* used by wm */
    129 	short	x,y;
    130 	short 	width,height;
    131 	struct fbui_wininfo	*info;	/* passed _out_ */
    132 	int	ninfo;
    133 	unsigned char	*pointer;
    134 	unsigned long	cutpaste_length;
    135 	struct fbui_event 	*event;	/* passed _out_ */
    136 	char	string [FBUI_NAMELEN];
    137 };
    138 
    139 #define FBUI_EVENTMASK_KEY	1
    140 #define FBUI_EVENTMASK_EXPOSE	2
    141 #define FBUI_EVENTMASK_HIDE	4
    142 #define FBUI_EVENTMASK_UNHIDE	8
    143 #define FBUI_EVENTMASK_ENTER	16
    144 #define FBUI_EVENTMASK_LEAVE	32
    145 #define FBUI_EVENTMASK_MR	64
    146 #define FBUI_EVENTMASK_ACCEL	128
    147 #define FBUI_EVENTMASK_WC	256
    148 #define FBUI_EVENTMASK_MOTION	512
    149 #define FBUI_EVENTMASK_BUTTON	1024
    150 #define FBUI_EVENTMASK_ALL 0x7fff
    151 
    152 /* Commands for FBIO_UI_CONTROL ioctl */
    153 #define FBUI_GETDIMS	0
    154 #define FBUI_POLLEVENT	1
    155 #define FBUI_READMOUSE	2
    156 #define FBUI_READPOINT	3	/* wm only */
    157 #define FBUI_ACCEL	4
    158 #define FBUI_WININFO	5	/* wm only */
    159 #define FBUI_SUSPEND	6	/* wm only */
    160 #define FBUI_RESUME	7
    161 #define FBUI_GETPOSN	8
    162 #define FBUI_WAITEVENT	9
    163 #define FBUI_PLACEMENT	10	/* wm only */
    164 #define FBUI_CUT	11
    165 #define FBUI_PASTE	12
    166 #define FBUI_CUTLENGTH	13
    167 #define FBUI_SUBTITLE	14
    168 #define FBUI_SETFONT	15
    169 
    170 #define FBUI_CTL_TAKESWIN 32
    171 /* Numbers >= FBUI_CTL_TAKESWIN take a window argument */
    172 #define FBUI_REDRAW	(FBUI_CTL_TAKESWIN+1)	/* wm only */
    173 #define FBUI_DELETE	(FBUI_CTL_TAKESWIN+2)	/* wm only */
    174 #define FBUI_HIDE 	(FBUI_CTL_TAKESWIN+3)	/* wm only */
    175 #define FBUI_UNHIDE 	(FBUI_CTL_TAKESWIN+4)	/* wm only */
    176 #define FBUI_ASSIGN_KEYFOCUS	(FBUI_CTL_TAKESWIN+5)	/* wm only */
    177 #define FBUI_ASSIGN_PTRFOCUS	(FBUI_CTL_TAKESWIN+7)	/* wm only */
    178 #define FBUI_MOVE_RESIZE	(FBUI_CTL_TAKESWIN+6)	/* wm only */
    179 
    180 /* FBUI font weight */
    181 #define FB_FONTWEIGHT_LIGHT (0)
    182 #define FB_FONTWEIGHT_MEDIUM (1)
    183 #define FB_FONTWEIGHT_BOLD (2)
    184 #define FB_FONTWEIGHT_BLACK (3)
    185 
    186 /* FBUI font */
    187 struct fbui_font {
    188         unsigned char ascent;
    189 	unsigned char descent;
    190         unsigned char first_char;
    191         unsigned char last_char;
    192         unsigned char nchars;
    193         unsigned char *lefts;
    194         unsigned char *heights;
    195         unsigned char *widths;	/* # of bits used for pixels */
    196         unsigned char *bitwidths; /* # bits actually used.. e.g. 32 */
    197         unsigned char *descents;
    198         unsigned char *bitmap_buffer;
    199         unsigned char **bitmaps;
    200 };
    201 #define FBUI_FONTSIZE sizeof(struct fbui_font)
    202 
    203 /* Some useful colors */
    204 #define RGB_NOCOLOR	0xff000000
    205 #define RGB_TRANSP	0xff000000
    206 #define RGB_BLACK 	0
    207 #define RGB_GRAY	0xa0a0a0
    208 #define RGB_WHITE 	0xffffff
    209 #define RGB_RED 	0xff0000
    210 #define RGB_GREEN	0xff00
    211 #define RGB_BLUE	0xff
    212 #define RGB_CYAN	0xffff
    213 #define RGB_YELLOW	0xffff00
    214 #define RGB_MAGENTA	0xff00ff
    215 #define RGB_ORANGE 	0xffa000
    216 #define RGB_PURPLE	0xa030ff
    217 #define RGB_LTBROWN	0xb54c4c
    218 #define RGB_BROWN	0xa52c2c
    219 #define RGB_STEELBLUE 	0x4682B4
    220 #define RGB_SIENNA	0x605230
    221 
    222 /* FBUI event types. Events are 31-bit values; type is lower 4 bits */
    223 #define FBUI_EVENT_NONE 	0
    224 #define FBUI_EVENT_EXPOSE 	1
    225 #define FBUI_EVENT_HIDE 	2
    226 #define FBUI_EVENT_UNHIDE 	3
    227 #define FBUI_EVENT_ENTER 	4	/* future... mouse pointer enter */
    228 #define FBUI_EVENT_LEAVE 	5	/* future... mouse pointer leave */
    229 #define FBUI_EVENT_KEY 		6
    230 #define FBUI_EVENT_MOVE_RESIZE	7	/* window was moved by wm */
    231 #define FBUI_EVENT_ACCEL 	8	/* keyboard accelerator (Alt-) key */
    232 #define FBUI_EVENT_WINCHANGE 	9	/* recv'd only by window manager */
    233 #define FBUI_EVENT_MOTION	10	/* mouse pointer moved */
    234 #define FBUI_EVENT_BUTTON	11	/* mouse button activity */
    235 
    236 /* FBUI queued commands: for use with FBIO_UI_EXEC ioctl */
    237 #define FBUI_NONE 	0
    238 #define FBUI_COPYAREA 	1
    239 #define FBUI_POINT 	2
    240 #define FBUI_LINE 	3
    241 #define FBUI_HLINE 	4
    242 #define FBUI_VLINE 	5
    243 #define FBUI_RECT 	6
    244 #define FBUI_FILLAREA 	7
    245 #define FBUI_CLEAR 	8
    246 #define FBUI_INVERTLINE	9
    247 #define FBUI_STRING 	10
    248 #define FBUI_PUT 	11
    249 #define FBUI_PUTRGB 	12
    250 #define FBUI_PUTRGB3 	13
    251 #define FBUI_CLEARAREA 	14
    252 #define FBUI_TINYBLIT	15
    253 
    254 /* FBUI ioctl return values */
    255 #define FBUI_SUCCESS 0
    256 #define FBUI_ERR_BADADDR -254
    257 #define FBUI_ERR_NULLPTR -253
    258 #define FBUI_ERR_OFFSCREEN -252
    259 #define FBUI_ERR_NOTRUNNING -251
    260 #define FBUI_ERR_WRONGVISUAL -250
    261 #define FBUI_ERR_NOTPLACED -249
    262 #define FBUI_ERR_BIGENDIAN -248
    263 #define FBUI_ERR_INVALIDCMD -247
    264 #define FBUI_ERR_BADPID -246
    265 #define FBUI_ERR_ACCELBUSY -245
    266 #define FBUI_ERR_NOFONT -244
    267 #define FBUI_ERR_NOMEM -243
    268 #define FBUI_ERR_NOTOPEN -242
    269 #define FBUI_ERR_OVERLAP -241
    270 #define FBUI_ERR_ALREADYOPEN -240
    271 #define FBUI_ERR_MISSINGWIN -239
    272 #define FBUI_ERR_NOTWM -238
    273 #define FBUI_ERR_WRONGWM -237
    274 #define FBUI_ERR_HAVEWM -236
    275 #define FBUI_ERR_KEYFOCUSDENIED -235
    276 #define FBUI_ERR_KEYFOCUSERR -234
    277 #define FBUI_ERR_BADPARAM -233
    278 #define FBUI_ERR_NOMOUSE -232
    279 #define FBUI_ERR_MOUSEREAD -231
    280 #define FBUI_ERR_OVERLARGECUT -230
    281 #define FBUI_ERR_BADWIN -229
    282 #define FBUI_ERR_PASTEFAIL -228
    283 #define FBUI_ERR_CUTFAIL -227
    284 #define FBUI_ERR_NOEVENT -226
    285 #define FBUI_ERR_DRAWING -225
    286 #define FBUI_ERR_MISSINGPROCENT -224
    287 #define FBUI_ERR_BADVC -223
    288 
    289 /* ==========================================================================*/
    290 
    291 #define FB_TYPE_PACKED_PIXELS		0	/* Packed Pixels	*/
    292 #define FB_TYPE_PLANES			1	/* Non interleaved planes */
    293 #define FB_TYPE_INTERLEAVED_PLANES	2	/* Interleaved planes	*/
    294 #define FB_TYPE_TEXT			3	/* Text/attributes	*/
    295 #define FB_TYPE_VGA_PLANES		4	/* EGA/VGA planes	*/
    296 
    297 #define FB_AUX_TEXT_MDA		0	/* Monochrome text */
    298 #define FB_AUX_TEXT_CGA		1	/* CGA/EGA/VGA Color text */
    299 #define FB_AUX_TEXT_S3_MMIO	2	/* S3 MMIO fasttext */
    300 #define FB_AUX_TEXT_MGA_STEP16	3	/* MGA Millenium I: text, attr, 14 reserved bytes */
    301 #define FB_AUX_TEXT_MGA_STEP8	4	/* other MGAs:      text, attr,  6 reserved bytes */
    302 
    303 #define FB_AUX_VGA_PLANES_VGA4		0	/* 16 color planes (EGA/VGA) */
    304 #define FB_AUX_VGA_PLANES_CFB4		1	/* CFB4 in planes (VGA) */
    305 #define FB_AUX_VGA_PLANES_CFB8		2	/* CFB8 in planes (VGA) */
    306 
    307 #define FB_VISUAL_MONO01		0	/* Monochr. 1=Black 0=White */
    308 #define FB_VISUAL_MONO10		1	/* Monochr. 1=White 0=Black */
    309 #define FB_VISUAL_TRUECOLOR		2	/* True color	*/
    310 #define FB_VISUAL_PSEUDOCOLOR		3	/* Pseudo color (like atari) */
    311 #define FB_VISUAL_DIRECTCOLOR		4	/* Direct color */
    312 #define FB_VISUAL_STATIC_PSEUDOCOLOR	5	/* Pseudo color readonly */
    313 
    314 #define FB_ACCEL_NONE		0	/* no hardware accelerator	*/
    315 #define FB_ACCEL_ATARIBLITT	1	/* Atari Blitter		*/
    316 #define FB_ACCEL_AMIGABLITT	2	/* Amiga Blitter                */
    317 #define FB_ACCEL_S3_TRIO64	3	/* Cybervision64 (S3 Trio64)    */
    318 #define FB_ACCEL_NCR_77C32BLT	4	/* RetinaZ3 (NCR 77C32BLT)      */
    319 #define FB_ACCEL_S3_VIRGE	5	/* Cybervision64/3D (S3 ViRGE)	*/
    320 #define FB_ACCEL_ATI_MACH64GX	6	/* ATI Mach 64GX family		*/
    321 #define FB_ACCEL_DEC_TGA	7	/* DEC 21030 TGA		*/
    322 #define FB_ACCEL_ATI_MACH64CT	8	/* ATI Mach 64CT family		*/
    323 #define FB_ACCEL_ATI_MACH64VT	9	/* ATI Mach 64CT family VT class */
    324 #define FB_ACCEL_ATI_MACH64GT	10	/* ATI Mach 64CT family GT class */
    325 #define FB_ACCEL_SUN_CREATOR	11	/* Sun Creator/Creator3D	*/
    326 #define FB_ACCEL_SUN_CGSIX	12	/* Sun cg6			*/
    327 #define FB_ACCEL_SUN_LEO	13	/* Sun leo/zx			*/
    328 #define FB_ACCEL_IMS_TWINTURBO	14	/* IMS Twin Turbo		*/
    329 #define FB_ACCEL_3DLABS_PERMEDIA2 15	/* 3Dlabs Permedia 2		*/
    330 #define FB_ACCEL_MATROX_MGA2064W 16	/* Matrox MGA2064W (Millenium)	*/
    331 #define FB_ACCEL_MATROX_MGA1064SG 17	/* Matrox MGA1064SG (Mystique)	*/
    332 #define FB_ACCEL_MATROX_MGA2164W 18	/* Matrox MGA2164W (Millenium II) */
    333 #define FB_ACCEL_MATROX_MGA2164W_AGP 19	/* Matrox MGA2164W (Millenium II) */
    334 #define FB_ACCEL_MATROX_MGAG100	20	/* Matrox G100 (Productiva G100) */
    335 #define FB_ACCEL_MATROX_MGAG200	21	/* Matrox G200 (Myst, Mill, ...) */
    336 #define FB_ACCEL_SUN_CG14	22	/* Sun cgfourteen		 */
    337 #define FB_ACCEL_SUN_BWTWO	23	/* Sun bwtwo			*/
    338 #define FB_ACCEL_SUN_CGTHREE	24	/* Sun cgthree			*/
    339 #define FB_ACCEL_SUN_TCX	25	/* Sun tcx			*/
    340 #define FB_ACCEL_MATROX_MGAG400	26	/* Matrox G400			*/
    341 #define FB_ACCEL_NV3		27	/* nVidia RIVA 128              */
    342 #define FB_ACCEL_NV4		28	/* nVidia RIVA TNT		*/
    343 #define FB_ACCEL_NV5		29	/* nVidia RIVA TNT2		*/
    344 #define FB_ACCEL_CT_6555x	30	/* C&T 6555x			*/
    345 #define FB_ACCEL_3DFX_BANSHEE	31	/* 3Dfx Banshee			*/
    346 #define FB_ACCEL_ATI_RAGE128	32	/* ATI Rage128 family		*/
    347 #define FB_ACCEL_IGS_CYBER2000	33	/* CyberPro 2000		*/
    348 #define FB_ACCEL_IGS_CYBER2010	34	/* CyberPro 2010		*/
    349 #define FB_ACCEL_IGS_CYBER5000	35	/* CyberPro 5000		*/
    350 #define FB_ACCEL_SIS_GLAMOUR    36	/* SiS 300/630/540              */
    351 #define FB_ACCEL_3DLABS_PERMEDIA3 37	/* 3Dlabs Permedia 3		*/
    352 #define FB_ACCEL_ATI_RADEON	38	/* ATI Radeon family		*/
    353 #define FB_ACCEL_I810           39      /* Intel 810/815                */
    354 #define FB_ACCEL_SIS_GLAMOUR_2  40	/* SiS 315, 650, 740		*/
    355 #define FB_ACCEL_SIS_XABRE      41	/* SiS 330 ("Xabre")		*/
    356 
    357 #define FB_ACCEL_NEOMAGIC_NM2070 90	/* NeoMagic NM2070              */
    358 #define FB_ACCEL_NEOMAGIC_NM2090 91	/* NeoMagic NM2090              */
    359 #define FB_ACCEL_NEOMAGIC_NM2093 92	/* NeoMagic NM2093              */
    360 #define FB_ACCEL_NEOMAGIC_NM2097 93	/* NeoMagic NM2097              */
    361 #define FB_ACCEL_NEOMAGIC_NM2160 94	/* NeoMagic NM2160              */
    362 #define FB_ACCEL_NEOMAGIC_NM2200 95	/* NeoMagic NM2200              */
    363 #define FB_ACCEL_NEOMAGIC_NM2230 96	/* NeoMagic NM2230              */
    364 #define FB_ACCEL_NEOMAGIC_NM2360 97	/* NeoMagic NM2360              */
    365 #define FB_ACCEL_NEOMAGIC_NM2380 98	/* NeoMagic NM2380              */
    366 
    367 
    368 struct fb_fix_screeninfo {
    369 	char id[16];			/* identification string eg "TT Builtin" */
    370 	unsigned long smem_start;	/* Start of frame buffer mem */
    371 					/* (physical address) */
    372 	__u32 smem_len;			/* Length of frame buffer mem */
    373 	__u32 type;			/* see FB_TYPE_*		*/
    374 	__u32 type_aux;			/* Interleave for interleaved Planes */
    375 	__u32 visual;			/* see FB_VISUAL_*		*/ 
    376 	__u16 xpanstep;			/* zero if no hardware panning  */
    377 	__u16 ypanstep;			/* zero if no hardware panning  */
    378 	__u16 ywrapstep;		/* zero if no hardware ywrap    */
    379 	__u32 line_length;		/* length of a line in bytes    */
    380 	unsigned long mmio_start;	/* Start of Memory Mapped I/O   */
    381 					/* (physical address) */
    382 	__u32 mmio_len;			/* Length of Memory Mapped I/O  */
    383 	__u32 accel;			/* Indicate to driver which	*/
    384 					/*  specific chip/card we have	*/
    385 	__u16 reserved[3];		/* Reserved for future compatibility */
    386 };
    387 
    388 /* Interpretation of offset for color fields: All offsets are from the right,
    389  * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you
    390  * can use the offset as right argument to <<). A pixel afterwards is a bit
    391  * stream and is written to video memory as that unmodified. This implies
    392  * big-endian byte order if bits_per_pixel is greater than 8.
    393  */
    394 struct fb_bitfield {
    395 	__u32 offset;			/* beginning of bitfield	*/
    396 	__u32 length;			/* length of bitfield		*/
    397 	__u32 msb_right;		/* != 0 : Most significant bit is */ 
    398 					/* right */ 
    399 };
    400 
    401 #define FB_NONSTD_HAM		1	/* Hold-And-Modify (HAM)        */
    402 
    403 #define FB_ACTIVATE_NOW		0	/* set values immediately (or vbl)*/
    404 #define FB_ACTIVATE_NXTOPEN	1	/* activate on next open	*/
    405 #define FB_ACTIVATE_TEST	2	/* don't set, round up impossible */
    406 #define FB_ACTIVATE_MASK       15
    407 					/* values			*/
    408 #define FB_ACTIVATE_VBL	       16	/* activate values on next vbl  */
    409 #define FB_CHANGE_CMAP_VBL     32	/* change colormap on vbl	*/
    410 #define FB_ACTIVATE_ALL	       64	/* change all VCs on this fb	*/
    411 #define FB_ACTIVATE_FORCE     128	/* force apply even when no change*/
    412 #define FB_ACTIVATE_INV_MODE  256       /* invalidate videomode */
    413 
    414 #define FB_ACCELF_TEXT		1	/* (OBSOLETE) see fb_info.flags and vc_mode */
    415 
    416 #define FB_SYNC_HOR_HIGH_ACT	1	/* horizontal sync high active	*/
    417 #define FB_SYNC_VERT_HIGH_ACT	2	/* vertical sync high active	*/
    418 #define FB_SYNC_EXT		4	/* external sync		*/
    419 #define FB_SYNC_COMP_HIGH_ACT	8	/* composite sync high active   */
    420 #define FB_SYNC_BROADCAST	16	/* broadcast video timings      */
    421 					/* vtotal = 144d/288n/576i => PAL  */
    422 					/* vtotal = 121d/242n/484i => NTSC */
    423 #define FB_SYNC_ON_GREEN	32	/* sync on green */
    424 
    425 #define FB_VMODE_NONINTERLACED  0	/* non interlaced */
    426 #define FB_VMODE_INTERLACED	1	/* interlaced	*/
    427 #define FB_VMODE_DOUBLE		2	/* double scan */
    428 #define FB_VMODE_MASK		255
    429 
    430 #define FB_VMODE_YWRAP		256	/* ywrap instead of panning     */
    431 #define FB_VMODE_SMOOTH_XPAN	512	/* smooth xpan possible (internally used) */
    432 #define FB_VMODE_CONUPDATE	512	/* don't update x/yoffset	*/
    433 
    434 #define PICOS2KHZ(a) (1000000000UL/(a))
    435 #define KHZ2PICOS(a) (1000000000UL/(a))
    436 
    437 struct fb_var_screeninfo {
    438 	__u32 xres;			/* visible resolution		*/
    439 	__u32 yres;
    440 	__u32 xres_virtual;		/* virtual resolution		*/
    441 	__u32 yres_virtual;
    442 	__u32 xoffset;			/* offset from virtual to visible */
    443 	__u32 yoffset;			/* resolution			*/
    444 
    445 	__u32 bits_per_pixel;		/* guess what			*/
    446 	__u32 grayscale;		/* != 0 Graylevels instead of colors */
    447 
    448 	struct fb_bitfield red;		/* bitfield in fb mem if true color, */
    449 	struct fb_bitfield green;	/* else only length is significant */
    450 	struct fb_bitfield blue;
    451 	struct fb_bitfield transp;	/* transparency			*/	
    452 
    453 	__u32 nonstd;			/* != 0 Non standard pixel format */
    454 
    455 	__u32 activate;			/* see FB_ACTIVATE_*		*/
    456 
    457 	__u32 height;			/* height of picture in mm    */
    458 	__u32 width;			/* width of picture in mm     */
    459 
    460 	__u32 accel_flags;		/* (OBSOLETE) see fb_info.flags */
    461 
    462 	/* Timing: All values in pixclocks, except pixclock (of course) */
    463 	__u32 pixclock;			/* pixel clock in ps (pico seconds) */
    464 	__u32 left_margin;		/* time from sync to picture	*/
    465 	__u32 right_margin;		/* time from picture to sync	*/
    466 	__u32 upper_margin;		/* time from sync to picture	*/
    467 	__u32 lower_margin;
    468 	__u32 hsync_len;		/* length of horizontal sync	*/
    469 	__u32 vsync_len;		/* length of vertical sync	*/
    470 	__u32 sync;			/* see FB_SYNC_*		*/
    471 	__u32 vmode;			/* see FB_VMODE_*		*/
    472 	__u32 rotate;			/* angle we rotate counter clockwise */
    473 	__u32 reserved[5];		/* Reserved for future compatibility */
    474 };
    475 
    476 struct fb_cmap {
    477 	__u32 start;			/* First entry	*/
    478 	__u32 len;			/* Number of entries */
    479 	__u16 *red;			/* Red values	*/
    480 	__u16 *green;
    481 	__u16 *blue;
    482 	__u16 *transp;			/* transparency, can be NULL */
    483 };
    484 
    485 struct fb_con2fbmap {
    486 	__u32 console;
    487 	__u32 framebuffer;
    488 };
    489 
    490 /* VESA Blanking Levels */
    491 #define VESA_NO_BLANKING        0
    492 #define VESA_VSYNC_SUSPEND      1
    493 #define VESA_HSYNC_SUSPEND      2
    494 #define VESA_POWERDOWN          3
    495 
    496 #define FB_VBLANK_VBLANKING	0x001	/* currently in a vertical blank */
    497 #define FB_VBLANK_HBLANKING	0x002	/* currently in a horizontal blank */
    498 #define FB_VBLANK_HAVE_VBLANK	0x004	/* vertical blanks can be detected */
    499 #define FB_VBLANK_HAVE_HBLANK	0x008	/* horizontal blanks can be detected */
    500 #define FB_VBLANK_HAVE_COUNT	0x010	/* global retrace counter is available */
    501 #define FB_VBLANK_HAVE_VCOUNT	0x020	/* the vcount field is valid */
    502 #define FB_VBLANK_HAVE_HCOUNT	0x040	/* the hcount field is valid */
    503 #define FB_VBLANK_VSYNCING	0x080	/* currently in a vsync */
    504 #define FB_VBLANK_HAVE_VSYNC	0x100	/* verical syncs can be detected */
    505 
    506 struct fb_vblank {
    507 	__u32 flags;			/* FB_VBLANK flags */
    508 	__u32 count;			/* counter of retraces since boot */
    509 	__u32 vcount;			/* current scanline position */
    510 	__u32 hcount;			/* current scandot position */
    511 	__u32 reserved[4];		/* reserved for future compatibility */
    512 };
    513 
    514 /* Internal HW accel */
    515 #define ROP_COPY 0
    516 #define ROP_XOR  1
    517 
    518 struct fb_copyarea {
    519 	__u32 dx;
    520 	__u32 dy;
    521 	__u32 width;
    522 	__u32 height;
    523 	__u32 sx;
    524 	__u32 sy;
    525 };
    526 
    527 struct fb_fillrect {
    528 	__u32 dx;	/* screen-relative */
    529 	__u32 dy;
    530 	__u32 width;
    531 	__u32 height;
    532 	__u32 color;
    533 	__u32 rop;
    534 };
    535 
    536 struct fb_image {
    537 	__u32 dx;		/* Where to place image */
    538 	__u32 dy;
    539 	__u32 width;		/* Size of image */
    540 	__u32 height;
    541 	__u32 fg_color;		/* Only used when a mono bitmap */
    542 	__u32 bg_color;
    543 	__u8  depth;		/* Depth of the image */
    544 	const char *data;	/* Pointer to image data */
    545 	struct fb_cmap cmap;	/* color map info */
    546 };
    547 
    548 /*
    549  * hardware cursor control
    550  */
    551 
    552 #define FB_CUR_SETCUR   0x01
    553 #define FB_CUR_SETPOS   0x02
    554 #define FB_CUR_SETHOT   0x04
    555 #define FB_CUR_SETCMAP  0x08
    556 #define FB_CUR_SETSHAPE 0x10
    557 #define FB_CUR_SETSIZE	0x20
    558 #define FB_CUR_SETALL   0xFF
    559 
    560 struct fbcurpos {
    561 	__u16 x, y;
    562 };
    563 
    564 struct fb_cursor {
    565 	__u16 set;		/* what to set */
    566 	__u16 enable;		/* cursor on/off */
    567 	__u16 rop;		/* bitop operation */
    568 	const char *mask;	/* cursor mask bits */
    569 	struct fbcurpos hot;	/* cursor hot spot */
    570 	struct fb_image	image;	/* Cursor image */
    571 /* all fields below are for fbcon use only */
    572 	char  *data;             /* copy of bitmap */
    573 };
    574 
    575 #ifdef __KERNEL__
    576 
    577 #include <linux/fs.h>
    578 #include <linux/init.h>
    579 #include <linux/tty.h>
    580 #include <linux/device.h>
    581 #include <linux/workqueue.h>
    582 #include <linux/devfs_fs_kernel.h>
    583 #include <linux/notifier.h>
    584 #include <linux/list.h>
    585 #include <asm/io.h>
    586 
    587 struct vm_area_struct;
    588 struct fb_info;
    589 struct device;
    590 struct file;
    591 
    592 /* Definitions below are used in the parsed monitor specs */
    593 #define FB_DPMS_ACTIVE_OFF	1
    594 #define FB_DPMS_SUSPEND		2
    595 #define FB_DPMS_STANDBY		4
    596 
    597 #define FB_DISP_DDI		1
    598 #define FB_DISP_ANA_700_300	2
    599 #define FB_DISP_ANA_714_286	4
    600 #define FB_DISP_ANA_1000_400	8
    601 #define FB_DISP_ANA_700_000	16
    602 
    603 #define FB_DISP_MONO		32
    604 #define FB_DISP_RGB		64
    605 #define FB_DISP_MULTI		128
    606 #define FB_DISP_UNKNOWN		256
    607 
    608 #define FB_SIGNAL_NONE		0
    609 #define FB_SIGNAL_BLANK_BLANK	1
    610 #define FB_SIGNAL_SEPARATE	2
    611 #define FB_SIGNAL_COMPOSITE	4
    612 #define FB_SIGNAL_SYNC_ON_GREEN	8
    613 #define FB_SIGNAL_SERRATION_ON	16
    614 
    615 #define FB_MISC_PRIM_COLOR	1
    616 #define FB_MISC_1ST_DETAIL	2	/* First Detailed Timing is preferred */
    617 struct fb_chroma {
    618 	__u32 redx;	/* in fraction of 1024 */
    619 	__u32 greenx;
    620 	__u32 bluex;
    621 	__u32 whitex;
    622 	__u32 redy;
    623 	__u32 greeny;
    624 	__u32 bluey;
    625 	__u32 whitey;
    626 };
    627 
    628 struct fb_monspecs {
    629 	struct fb_chroma chroma;
    630 	struct fb_videomode *modedb;	/* mode database */
    631 	__u8  manufacturer[4];		/* Manufacturer */
    632 	__u8  monitor[14];		/* Monitor String */
    633 	__u8  serial_no[14];		/* Serial Number */
    634 	__u8  ascii[14];		/* ? */
    635 	__u32 modedb_len;		/* mode database length */
    636 	__u32 model;			/* Monitor Model */
    637 	__u32 serial;			/* Serial Number - Integer */
    638 	__u32 year;			/* Year manufactured */
    639 	__u32 week;			/* Week Manufactured */
    640 	__u32 hfmin;			/* hfreq lower limit (Hz) */
    641 	__u32 hfmax;			/* hfreq upper limit (Hz) */
    642 	__u32 dclkmin;			/* pixelclock lower limit (Hz) */
    643 	__u32 dclkmax;			/* pixelclock upper limit (Hz) */
    644 	__u16 input;			/* display type - see FB_DISP_* */
    645 	__u16 dpms;			/* DPMS support - see FB_DPMS_ */
    646 	__u16 signal;			/* Signal Type - see FB_SIGNAL_* */
    647 	__u16 vfmin;			/* vfreq lower limit (Hz) */
    648 	__u16 vfmax;			/* vfreq upper limit (Hz) */
    649 	__u16 gamma;			/* Gamma - in fractions of 100 */
    650 	__u16 gtf	: 1;		/* supports GTF */
    651 	__u16 misc;			/* Misc flags - see FB_MISC_* */
    652 	__u8  version;			/* EDID version... */
    653 	__u8  revision;			/* ...and revision */
    654 	__u8  max_x;			/* Maximum horizontal size (cm) */
    655 	__u8  max_y;			/* Maximum vertical size (cm) */
    656 };
    657 
    658 struct fb_cmap_user {
    659 	__u32 start;			/* First entry	*/
    660 	__u32 len;			/* Number of entries */
    661 	__u16 __user *red;		/* Red values	*/
    662 	__u16 __user *green;
    663 	__u16 __user *blue;
    664 	__u16 __user *transp;		/* transparency, can be NULL */
    665 };
    666 
    667 struct fb_image_user {
    668 	__u32 dx;			/* Where to place image */
    669 	__u32 dy;
    670 	__u32 width;			/* Size of image */
    671 	__u32 height;
    672 	__u32 fg_color;			/* Only used when a mono bitmap */
    673 	__u32 bg_color;
    674 	__u8  depth;			/* Depth of the image */
    675 	const char __user *data;	/* Pointer to image data */
    676 	struct fb_cmap_user cmap;	/* color map info */
    677 };
    678 
    679 struct fb_cursor_user {
    680 	__u16 set;			/* what to set */
    681 	__u16 enable;			/* cursor on/off */
    682 	__u16 rop;			/* bitop operation */
    683 	const char __user *mask;	/* cursor mask bits */
    684 	struct fbcurpos hot;		/* cursor hot spot */
    685 	struct fb_image_user image;	/* Cursor image */
    686 };
    687 
    688 /*
    689  * Register/unregister for framebuffer events
    690  */
    691 
    692 /*	The resolution of the passed in fb_info about to change */ 
    693 #define FB_EVENT_MODE_CHANGE		0x01
    694 /*	The display on this fb_info is beeing suspended, no access to the
    695  *	framebuffer is allowed any more after that call returns
    696  */
    697 #define FB_EVENT_SUSPEND		0x02
    698 /*	The display on this fb_info was resumed, you can restore the display
    699  *	if you own it
    700  */
    701 #define FB_EVENT_RESUME			0x03
    702 /*      An entry from the modelist was removed */
    703 #define FB_EVENT_MODE_DELETE            0x04
    704 /*      A driver registered itself */
    705 #define FB_EVENT_FB_REGISTERED          0x05
    706 /*      get console to framebuffer mapping */
    707 #define FB_EVENT_GET_CONSOLE_MAP        0x06
    708 /*      set console to framebuffer mapping */
    709 #define FB_EVENT_SET_CONSOLE_MAP        0x07
    710 
    711 
    712 struct fb_event {
    713 	struct fb_info *info;
    714 	void *data;
    715 };
    716 
    717 
    718 extern int fb_register_client(struct notifier_block *nb);
    719 extern int fb_unregister_client(struct notifier_block *nb);
    720 
    721 /*
    722  * Pixmap structure definition
    723  *
    724  * The purpose of this structure is to translate data
    725  * from the hardware independent format of fbdev to what
    726  * format the hardware needs.
    727  */
    728 
    729 #define FB_PIXMAP_DEFAULT 1     /* used internally by fbcon */
    730 #define FB_PIXMAP_SYSTEM  2     /* memory is in system RAM  */
    731 #define FB_PIXMAP_IO      4     /* memory is iomapped       */
    732 #define FB_PIXMAP_SYNC    256   /* set if GPU can DMA       */
    733 
    734 struct fb_pixmap {
    735 	u8  *addr;		/* pointer to memory			*/
    736 	u32 size;		/* size of buffer in bytes		*/
    737 	u32 offset;		/* current offset to buffer		*/
    738 	u32 buf_align;		/* byte alignment of each bitmap	*/
    739 	u32 scan_align;		/* alignment per scanline		*/
    740 	u32 access_align;	/* alignment per read/write		*/
    741 	u32 flags;		/* see FB_PIXMAP_*			*/
    742 	/* access methods */
    743 	void (*outbuf)(struct fb_info *info, u8 *addr, u8 *src, unsigned int size);
    744 	u8   (*inbuf) (struct fb_info *info, u8 *addr);
    745 };
    746 
    747 
    748 /*=====================================================*/
    749 struct fbui_window { 
    750 	short	id;		/* window id */
    751 	int 	pid; 		/* process id */
    752 	int 	console;	/* virtual console in which window appears */
    753 	u32 	bgcolor;	/* background */
    754 	short 	x0, y0, x1, y1; /* absolute coordinates */
    755 	short 	width, height;
    756 	short	max_width;
    757 	short	max_height;
    758 
    759 	short	mouse_x, mouse_y;
    760 
    761 	char	program_type;
    762 	unsigned int need_placement : 1;
    763 	unsigned int drawing : 1;   /* 1 => don't allow input_handler to draw ptr */
    764 	unsigned int pointer_inside : 1;
    765 	unsigned int is_wm : 1;
    766 	unsigned int doing_autopos : 1; /* used by wm only; {0:fbwm, 1:fbpm} */
    767 	unsigned int is_hidden: 1;
    768 	unsigned int do_invert : 1;
    769 	unsigned int need_keys : 1;
    770 	unsigned int need_motion : 1;
    771 	unsigned int receive_all_motion : 1;
    772 	unsigned int font_valid : 1;
    773 
    774 	struct fbui_font font;	/* default font, used if font ptr NULL */
    775 
    776 	struct fbui_processentry *processentry;
    777 
    778 	char	name[FBUI_NAMELEN];
    779 	char	subtitle[FBUI_NAMELEN];
    780 
    781 	u32	accelerators[8]; /* supporting only 8-bit chars now */
    782 	short	pending_accel;
    783 
    784 	struct fbui_window *next;
    785 };
    786 
    787 extern int fbui_init (struct fb_info *info);
    788 extern int fbui_switch (struct fb_info *info, int con);
    789 extern int fbui_release (struct fb_info *info, int user);
    790 extern int fbui_exec (struct fb_info *info, short win_id, short n, unsigned char *arg);
    791 extern int fbui_control (struct fb_info *info, struct fbui_ctrlparams*);
    792 extern int fbui_open (struct fb_info *info, struct fbui_openparams*);
    793 extern int fbui_close (struct fb_info *info, short);
    794 
    795 extern void fb_clear (struct fb_info *, u32);
    796 extern void fb_point (struct fb_info *, short,short, u32, char);
    797 extern u32 fb_read_point (struct fb_info *, short,short);
    798 extern void fb_hline (struct fb_info *,short,short,short,u32);
    799 extern void fb_vline (struct fb_info *,short,short,short,u32);
    800 extern void fb_putpixels_native (struct fb_info *, short,short,short,unsigned char*,char);
    801 extern void fb_putpixels_rgb (struct fb_info *, short,short,short,unsigned long*,char);
    802 extern void fb_putpixels_rgb3 (struct fb_info *, short,short,short,unsigned char*,char);
    803 extern short fb_getpixels_rgb (struct fb_info *, short x,short y,short n,unsigned long*,char);
    804 extern void fb_copyarea (struct fb_info *, short,short,short,short,short,short);
    805 
    806 
    807 /* Per-process event queue data
    808  */
    809 struct fbui_processentry {
    810 	unsigned int in_use : 1;
    811 	unsigned int waiting : 1;
    812 	char console;
    813 	char nwindows;
    814 	char window_num; /* which window to check next for event */
    815 	short index;
    816 	int pid;
    817 	wait_queue_head_t waitqueue;
    818 	unsigned short	wait_event_mask;
    819 
    820 #define FBUI_MAXEVENTSPERPROCESS (CONFIG_FB_UI_EVENTQUEUELEN)
    821 	struct fbui_event events [FBUI_MAXEVENTSPERPROCESS];
    822 	short	events_head;
    823 	short	events_tail;
    824 	short	events_pending;
    825 	spinlock_t queuelock;
    826 	struct semaphore queuesem;
    827 };
    828 
    829 #define FBUI_MAXCONSOLES 12
    830 #define FBUI_TOTALACCELS 128
    831 #define FBUI_MAXINCOMINGKEYS 32
    832 #define FBUI_CUTPASTE_LIMIT 0x10000
    833 #define FBUI_MAXWINDOWSPERVC (CONFIG_FB_UI_WINDOWSPERVC)
    834 
    835 
    836 struct fbui_focus_stack {
    837         struct rw_semaphore sem;
    838         short top;
    839         short ids [FBUI_MAXWINDOWSPERVC]; /* window ids */
    840 };
    841 
    842 
    843 /*=====================================================*/
    844 
    845 /*
    846  * Frame buffer operations
    847  *
    848  * LOCKING NOTE: those functions must _ALL_ be called with the console
    849  * semaphore held, this is the only suitable locking mecanism we have
    850  * in 2.6. Some may be called at interrupt time at this point though.
    851  */
    852 
    853 struct fb_ops {
    854 	/* open/release and usage marking */
    855 	struct module *owner;
    856 	int (*fb_open)(struct fb_info *info, int user);
    857 	int (*fb_release)(struct fb_info *info, int user);
    858 
    859 	/* For framebuffers with strange non linear layouts or that do not
    860 	 * work with normal memory mapped access
    861 	 */
    862 	ssize_t (*fb_read)(struct file *file, char __user *buf, size_t count, loff_t *ppos);
    863 	ssize_t (*fb_write)(struct file *file, const char __user *buf, size_t count, loff_t *ppos);
    864 
    865 	/* checks var and eventually tweaks it to something supported,
    866 	 * DO NOT MODIFY PAR */
    867 	int (*fb_check_var)(struct fb_var_screeninfo *var, struct fb_info *info);
    868 
    869 	/* set the video mode according to info->var */
    870 	int (*fb_set_par)(struct fb_info *info);
    871 
    872 	/* set color register */
    873 	int (*fb_setcolreg)(unsigned regno, unsigned red, unsigned green,
    874 			    unsigned blue, unsigned transp, struct fb_info *info);
    875 
    876 	/* blank display */
    877 	int (*fb_blank)(int blank, struct fb_info *info);
    878 
    879 	/* pan display */
    880 	int (*fb_pan_display)(struct fb_var_screeninfo *var, struct fb_info *info);
    881 
    882 	/* Draws a rectangle */
    883 	void (*fb_fillrect) (struct fb_info *info, const struct fb_fillrect *rect);
    884 	/* Copy data from area to another */
    885 	void (*fb_copyarea) (struct fb_info *info, const struct fb_copyarea *region);
    886 	/* Draws a image to the display */
    887 	void (*fb_imageblit) (struct fb_info *info, const struct fb_image *image);
    888 
    889 	/* Draws cursor */
    890 	int (*fb_cursor) (struct fb_info *info, struct fb_cursor *cursor);
    891 
    892 	/* Rotates the display */
    893 	void (*fb_rotate)(struct fb_info *info, int angle);
    894 
    895 	/* wait for blit idle, optional */
    896 	int (*fb_sync)(struct fb_info *info);
    897 
    898 	/* perform fb specific ioctl (optional) */
    899 	int (*fb_ioctl)(struct inode *inode, struct file *file, unsigned int cmd,
    900 			unsigned long arg, struct fb_info *info);
    901 
    902 	/* perform fb specific mmap */
    903 	int (*fb_mmap)(struct fb_info *info, struct file *file, struct vm_area_struct *vma);
    904 
    905 #ifdef CONFIG_FB_UI
    906 	void (*fb_clear) (struct fb_info *info, u32);
    907         u32 (*fb_read_point) (struct fb_info *info, short x, short y);
    908         void (*fb_point) (struct fb_info *info, short,short,u32,char);
    909         void (*fb_hline) (struct fb_info *info, short,short,short,u32);
    910         void (*fb_vline) (struct fb_info *info, short,short,short,u32);
    911 	void (*fb_putpixels_native) (struct fb_info *, short,short,short,unsigned char*,char);
    912 	short (*fb_getpixels_rgb) (struct fb_info *, short x,short y,short n,unsigned long*,char);
    913 	void (*fb_putpixels_rgb) (struct fb_info *, short,short,short,unsigned long*,char);
    914 	void (*fb_putpixels_rgb3) (struct fb_info *, short,short,short,unsigned char*,char);
    915 	void (*fb_copyarea2) (struct fb_info *, short,short,short,short,short,short);
    916 #endif
    917 };
    918 
    919 /* FBINFO_* = fb_info.flags bit flags */
    920 #define FBINFO_MODULE		0x0001	/* Low-level driver is a module */
    921 #define FBINFO_HWACCEL_DISABLED	0x0002
    922 	/* When FBINFO_HWACCEL_DISABLED is set:
    923 	 *  Hardware acceleration is turned off.  Software implementations
    924 	 *  of required functions (copyarea(), fillrect(), and imageblit())
    925 	 *  takes over; acceleration engine should be in a quiescent state */
    926 
    927 /* hints */
    928 #define FBINFO_PARTIAL_PAN_OK	0x0040 /* otw use pan only for double-buffering */
    929 #define FBINFO_READS_FAST	0x0080 /* soft-copy faster than rendering */
    930 
    931 /* hardware supported ops */
    932 /*  semantics: when a bit is set, it indicates that the operation is
    933  *   accelerated by hardware.
    934  *  required functions will still work even if the bit is not set.
    935  *  optional functions may not even exist if the flag bit is not set.
    936  */
    937 #define FBINFO_HWACCEL_NONE		0x0000
    938 #define FBINFO_HWACCEL_COPYAREA		0x0100 /* required */
    939 #define FBINFO_HWACCEL_FILLRECT		0x0200 /* required */
    940 #define FBINFO_HWACCEL_IMAGEBLIT	0x0400 /* required */
    941 #define FBINFO_HWACCEL_ROTATE		0x0800 /* optional */
    942 #define FBINFO_HWACCEL_XPAN		0x1000 /* optional */
    943 #define FBINFO_HWACCEL_YPAN		0x2000 /* optional */
    944 #define FBINFO_HWACCEL_YWRAP		0x4000 /* optional */
    945 
    946 #define FBINFO_MISC_MODECHANGEUSER     0x10000 /* mode change request
    947 						  from userspace */
    948 #define FBINFO_MISC_MODESWITCH         0x20000 /* mode switch */
    949 #define FBINFO_MISC_MODESWITCHLATE     0x40000 /* init hardware later */
    950 
    951 struct fb_info {
    952 	int node;
    953 	int flags;
    954 	struct fb_var_screeninfo var;	/* Current var */
    955 	struct fb_fix_screeninfo fix;	/* Current fix */
    956 	struct fb_monspecs monspecs;	/* Current Monitor specs */
    957 	struct fb_cursor cursor;	/* Current cursor */	
    958 	struct work_struct queue;	/* Framebuffer event queue */
    959 	struct timer_list cursor_timer; /* Cursor timer */
    960 	struct fb_pixmap pixmap;	/* Image hardware mapper */
    961 	struct fb_pixmap sprite;	/* Cursor hardware mapper */
    962 	struct fb_cmap cmap;		/* Current cmap */
    963 	struct list_head modelist;      /* mode list */
    964 	struct fb_ops *fbops;
    965 	char __iomem *screen_base;	/* Virtual address */
    966 	unsigned long screen_size;	/* Amount of ioremapped VRAM or 0 */ 
    967 	int currcon;			/* Current VC. */
    968 	void *pseudo_palette;		/* Fake palette of 16 colors */ 
    969 #define FBINFO_STATE_RUNNING	0
    970 #define FBINFO_STATE_SUSPENDED	1
    971 	u32 state;			/* Hardware state i.e suspend */
    972 
    973 /*------------FBUI data in fb_info--------------*/
    974 #ifdef CONFIG_FB_UI
    975 
    976 	struct fbui_window 	*keyfocus_window [FBUI_MAXCONSOLES];
    977 	struct fbui_window 	*pointerfocus_window [FBUI_MAXCONSOLES];
    978 
    979 	char	total_wins [FBUI_MAXCONSOLES];
    980 
    981 	unsigned char	redsize, greensize, bluesize;
    982 	unsigned char	redshift, greenshift, blueshift;
    983 
    984 	struct fbui_window 	*window_managers [FBUI_MAXCONSOLES];
    985 	struct fbui_window 	*windows [FBUI_MAXCONSOLES * FBUI_MAXWINDOWSPERVC];
    986 	struct rw_semaphore 	winptrSem;
    987 
    988 	/* protection for each fbui_window struct */
    989 	struct semaphore 	windowSems [FBUI_MAXCONSOLES * FBUI_MAXWINDOWSPERVC];
    990 
    991 	struct semaphore preSem;
    992 	struct fbui_processentry processentries [FBUI_MAXCONSOLES * FBUI_MAXWINDOWSPERVC];
    993 
    994 	u32 		bgcolor[FBUI_MAXCONSOLES]; /* from window manager */
    995 	void		*accelerators [FBUI_TOTALACCELS * FBUI_MAXCONSOLES];
    996 	unsigned char	force_placement [FBUI_MAXCONSOLES];
    997 	struct tty_struct 	*ttysave [FBUI_MAXCONSOLES];
    998 	struct fbui_window 	*pointer_window [FBUI_MAXCONSOLES];
    999 	unsigned int	pointer_active : 1;
   1000 	unsigned int	pointer_hidden : 1;
   1001 	unsigned int 	have_hardware_pointer: 1;
   1002 	unsigned int	mode24 : 1;
   1003 	short		curr_mouse_x, curr_mouse_y; /* <--primary */
   1004 	short		mouse_x0, mouse_y0, mouse_x1, mouse_y1;
   1005 
   1006 	struct rw_semaphore	cutpaste_sem;
   1007 	unsigned char	*cutpaste_buffer;
   1008 	u32	cutpaste_length;
   1009 #endif
   1010 
   1011 	/* From here on everything is device dependent */
   1012 	void *par;	
   1013 };
   1014 
   1015 #ifdef MODULE
   1016 #define FBINFO_DEFAULT	FBINFO_MODULE
   1017 #else
   1018 #define FBINFO_DEFAULT	0
   1019 #endif
   1020 
   1021 // This will go away
   1022 #define FBINFO_FLAG_MODULE	FBINFO_MODULE
   1023 #define FBINFO_FLAG_DEFAULT	FBINFO_DEFAULT
   1024 
   1025 /* This will go away
   1026  * fbset currently hacks in FB_ACCELF_TEXT into var.accel_flags
   1027  * when it wants to turn the acceleration engine on.  This is
   1028  * really a separate operation, and should be modified via sysfs.
   1029  *  But for now, we leave it broken with the following define
   1030  */
   1031 #define STUPID_ACCELF_TEXT_SHIT
   1032 
   1033 // This will go away
   1034 #if defined(__sparc__)
   1035 
   1036 /* We map all of our framebuffers such that big-endian accesses
   1037  * are what we want, so the following is sufficient.
   1038  */
   1039 
   1040 // This will go away
   1041 #define fb_readb sbus_readb
   1042 #define fb_readw sbus_readw
   1043 #define fb_readl sbus_readl
   1044 #define fb_readq sbus_readq
   1045 #define fb_writeb sbus_writeb
   1046 #define fb_writew sbus_writew
   1047 #define fb_writel sbus_writel
   1048 #define fb_writeq sbus_writeq
   1049 #define fb_memset sbus_memset_io
   1050 
   1051 #elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || (defined(__sh__) && !defined(__SH5__)) || defined(__powerpc__)
   1052 
   1053 #define fb_readb __raw_readb
   1054 #define fb_readw __raw_readw
   1055 #define fb_readl __raw_readl
   1056 #define fb_readq __raw_readq
   1057 #define fb_writeb __raw_writeb
   1058 #define fb_writew __raw_writew
   1059 #define fb_writel __raw_writel
   1060 #define fb_writeq __raw_writeq
   1061 #define fb_memset memset_io
   1062 
   1063 #else
   1064 
   1065 #define fb_readb(addr) (*(volatile u8 *) (addr))
   1066 #define fb_readw(addr) (*(volatile u16 *) (addr))
   1067 #define fb_readl(addr) (*(volatile u32 *) (addr))
   1068 #define fb_readq(addr) (*(volatile u64 *) (addr))
   1069 #define fb_writeb(b,addr) (*(volatile u8 *) (addr) = (b))
   1070 #define fb_writew(b,addr) (*(volatile u16 *) (addr) = (b))
   1071 #define fb_writel(b,addr) (*(volatile u32 *) (addr) = (b))
   1072 #define fb_writeq(b,addr) (*(volatile u64 *) (addr) = (b))
   1073 #define fb_memset memset
   1074 
   1075 #endif
   1076 
   1077     /*
   1078      *  `Generic' versions of the frame buffer device operations
   1079      */
   1080 
   1081 extern int fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var); 
   1082 extern int fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var); 
   1083 extern int fb_blank(struct fb_info *info, int blank);
   1084 extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor);
   1085 extern void cfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect); 
   1086 extern void cfb_copyarea(struct fb_info *info, const struct fb_copyarea *area); 
   1087 extern void cfb_imageblit(struct fb_info *info, const struct fb_image *image);
   1088 
   1089 /* drivers/video/fbmem.c */
   1090 extern int register_framebuffer(struct fb_info *fb_info);
   1091 extern int unregister_framebuffer(struct fb_info *fb_info);
   1092 extern int fb_prepare_logo(struct fb_info *fb_info);
   1093 extern int fb_show_logo(struct fb_info *fb_info);
   1094 extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size);
   1095 extern void fb_iomove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf,
   1096 				u8 *dst, u32 d_pitch, u8 *src, u32 idx,
   1097 				u32 height, u32 shift_high, u32 shift_low, u32 mod);
   1098 extern void fb_iomove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf,
   1099 				u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch,
   1100 				u32 height);
   1101 extern void fb_sysmove_buf_unaligned(struct fb_info *info, struct fb_pixmap *buf,
   1102 				u8 *dst, u32 d_pitch, u8 *src, u32 idx,
   1103 				u32 height, u32 shift_high, u32 shift_low, u32 mod);
   1104 extern void fb_sysmove_buf_aligned(struct fb_info *info, struct fb_pixmap *buf,
   1105 				u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch,
   1106 				u32 height);
   1107 extern void fb_load_cursor_image(struct fb_info *);
   1108 extern void fb_set_suspend(struct fb_info *info, int state);
   1109 extern int fb_get_color_depth(struct fb_info *info);
   1110 extern int fb_get_options(char *name, char **option);
   1111 
   1112 extern struct fb_info *registered_fb[FB_MAX];
   1113 extern int num_registered_fb;
   1114 
   1115 /* drivers/video/fbsysfs.c */
   1116 extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev);
   1117 extern void framebuffer_release(struct fb_info *info);
   1118 
   1119 /* drivers/video/fbmon.c */
   1120 #define FB_MAXTIMINGS		0
   1121 #define FB_VSYNCTIMINGS		1
   1122 #define FB_HSYNCTIMINGS		2
   1123 #define FB_DCLKTIMINGS		3
   1124 #define FB_IGNOREMON		0x100
   1125 
   1126 #define FB_MODE_IS_UNKNOWN	0
   1127 #define FB_MODE_IS_DETAILED	1
   1128 #define FB_MODE_IS_STANDARD	2
   1129 #define FB_MODE_IS_VESA		4
   1130 #define FB_MODE_IS_CALCULATED	8
   1131 #define FB_MODE_IS_FIRST	16
   1132 #define FB_MODE_IS_FROM_VAR     32
   1133 
   1134 extern int fbmon_valid_timings(u_int pixclock, u_int htotal, u_int vtotal,
   1135 			       const struct fb_info *fb_info);
   1136 extern int fbmon_dpms(const struct fb_info *fb_info);
   1137 extern int fb_get_mode(int flags, u32 val, struct fb_var_screeninfo *var,
   1138 		       struct fb_info *info);
   1139 extern int fb_validate_mode(const struct fb_var_screeninfo *var,
   1140 			    struct fb_info *info);
   1141 extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var);
   1142 extern int fb_get_monitor_limits(unsigned char *edid, struct fb_monspecs *specs);
   1143 extern void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs);
   1144 extern int fb_get_monitor_limits(unsigned char *edid, struct fb_monspecs *specs);
   1145 extern struct fb_videomode *fb_create_modedb(unsigned char *edid, int *dbsize);
   1146 extern void fb_destroy_modedb(struct fb_videomode *modedb);
   1147 
   1148 /* drivers/video/modedb.c */
   1149 #define VESA_MODEDB_SIZE 34
   1150 extern const struct fb_videomode vesa_modes[];
   1151 extern void fb_var_to_videomode(struct fb_videomode *mode,
   1152 				struct fb_var_screeninfo *var);
   1153 extern void fb_videomode_to_var(struct fb_var_screeninfo *var,
   1154 				struct fb_videomode *mode);
   1155 extern int fb_mode_is_equal(struct fb_videomode *mode1,
   1156 			    struct fb_videomode *mode2);
   1157 extern int fb_add_videomode(struct fb_videomode *mode, struct list_head *head);
   1158 extern void fb_delete_videomode(struct fb_videomode *mode,
   1159 				struct list_head *head);
   1160 extern struct fb_videomode *fb_match_mode(struct fb_var_screeninfo *var,
   1161 					  struct list_head *head);
   1162 extern struct fb_videomode *fb_find_best_mode(struct fb_var_screeninfo *var,
   1163 					      struct list_head *head);
   1164 extern void fb_destroy_modelist(struct list_head *head);
   1165 extern void fb_videomode_to_modelist(struct fb_videomode *modedb, int num,
   1166 				     struct list_head *head);
   1167 
   1168 /* drivers/video/fbcmap.c */
   1169 extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp);
   1170 extern void fb_dealloc_cmap(struct fb_cmap *cmap);
   1171 extern int fb_copy_cmap(struct fb_cmap *from, struct fb_cmap *to);
   1172 extern int fb_cmap_to_user(struct fb_cmap *from, struct fb_cmap_user *to);
   1173 extern int fb_set_cmap(struct fb_cmap *cmap, struct fb_info *fb_info);
   1174 extern int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *fb_info);
   1175 extern struct fb_cmap *fb_default_cmap(int len);
   1176 extern void fb_invert_cmaps(void);
   1177 
   1178 struct fb_videomode {
   1179 	const char *name;	/* optional */
   1180 	u32 refresh;		/* optional */
   1181 	u32 xres;
   1182 	u32 yres;
   1183 	u32 pixclock;
   1184 	u32 left_margin;
   1185 	u32 right_margin;
   1186 	u32 upper_margin;
   1187 	u32 lower_margin;
   1188 	u32 hsync_len;
   1189 	u32 vsync_len;
   1190 	u32 sync;
   1191 	u32 vmode;
   1192 	u32 flag;
   1193 };
   1194 
   1195 struct fb_modelist {
   1196 	struct list_head list;
   1197 	struct fb_videomode mode;
   1198 };
   1199 
   1200 extern int fb_find_mode(struct fb_var_screeninfo *var,
   1201 			struct fb_info *info, const char *mode_option,
   1202 			const struct fb_videomode *db,
   1203 			unsigned int dbsize,
   1204 			const struct fb_videomode *default_mode,
   1205 			unsigned int default_bpp);
   1206 
   1207 #endif /* __KERNEL__ */
   1208 
   1209 #endif /* _LINUX_FB_H */

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.