4 /* -------------------------------------------------------------------- */
5 /* LINUX FBCON FRAMEBUFFER UTILITY CODE */
6 /* makes setting up the framebuffer easy. Also makes it eays to port to */
7 /* some other system if needed. */
8 /* Copyright (c) 1999 - Carsten Haitzler (The Rasterman) */
9 /* -------------------------------------------------------------------- */
20 #include <sys/ioctl.h>
28 typedef struct _fb_mode FB_Mode;
40 struct fb_var_screeninfo fb_var;
43 /* init a framebuffer (and switch to) vt number vt. If vt == 0 use current */
45 void fb_init(int vt, int device);
46 /* call this afetr setting or getting the fb mode (whichever) to complete */
48 int fb_postinit(FB_Mode *mode);
49 /* console switching - if a switch was requested this with block if block */
50 /* is 1, otherwise it will return 1 if current console is active or 0 if */
51 /* the user has switched away in the meantime */
52 int fb_await_switch(int block);
53 /* list all current possible video modes listed in /etc/fb.modes */
54 /* returns pointer to an aray of FB_Mode, and sets num_return to the number */
55 /* of elements int he returned array */
56 FB_Mode *fb_list_modes(int *num_return);
57 /* sets the fb mode to the resolution width x height and the depth to depth. */
58 /* and if refresh > 0 attempts to use a mode with a refresh rate (in Hz) of */
59 /* that. If this fails it will return NULL - if it succeeds it will return */
60 /* a pointer to the FB_Mode thatwas set. only modes in /etc/fb.modes will */
61 /* be used. If refresh is 0 it uses the DEFAULT mode (the one with no */
62 /* refresh rate at the end of its name (WIDTHxHEIGHT-REFRESH) */
63 /* NB: in 8bpp you get a 332 palette. This is fixed so all modes are */
64 /* "truecolor" - the onyl difference is how many bits bep red, green and */
65 /* blue channel. This is for speed reasons */
66 FB_Mode *fb_setmode(int width, int height, int depth, int refresh);
67 /* returns the current fb mode being used in FB_Mode */
68 FB_Mode *fb_getmode(void);
69 /* changes the bit depth of the current fb mode to depth and returns a new */
70 /* handle to a new fb mode with updated parameters. frees cur_mode for you. */
71 FB_Mode *fb_changedepth(FB_Mode *cur_mode, int depth);
72 /* changes resolution - retaining current depth of the current mode, */
73 /* returning a handle to the new mode once done. frees cur_mode for you. */
74 FB_Mode *fb_changeres(FB_Mode *cur_mode, int width, int height, int refresh);
75 /* chnages both resolution and depth and returns a handle to the new mode */
76 /* when done. frees cur_mode for you */
77 FB_Mode *fb_changemode(FB_Mode *cur_mode, int width, int height, int depth, int refresh);
79 /* ------------------------------------------------------------------------- */
86 /* mode = fb_setmode(640, 480, 8, 0); */
88 /* fb_fd = fb_postinit(mode); */
89 /* if (fb_fd == -1) */
91 /* fprintf(stderr, "Frambuffer init failed\n"); */
94 /* .... code to play with the FB */