1 /* ----------------------------------------------------------------------- *
3 * Copyright 2006 H. Peter Anvin - All Rights Reserved
5 * Permission is hereby granted, free of charge, to any person
6 * obtaining a copy of this software and associated documentation
7 * files (the "Software"), to deal in the Software without
8 * restriction, including without limitation the rights to use,
9 * copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom
11 * the Software is furnished to do so, subject to the following
14 * The above copyright notice and this permission notice shall
15 * be included in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 * OTHER DEALINGS IN THE SOFTWARE.
26 * ----------------------------------------------------------------------- */
28 #ifndef LIB_SYS_VESA_VIDEO_H
29 #define LIB_SYS_VESA_VIDEO_H
33 #define FONT_MAX_CHARS 256
34 #define FONT_MAX_HEIGHT 32
37 #define VIDEO_X_SIZE 640
38 #define VIDEO_Y_SIZE 480
40 #define VIDEO_BORDER 8
41 #define TEXT_PIXEL_ROWS (VIDEO_Y_SIZE-2*VIDEO_BORDER)
42 #define TEXT_PIXEL_COLS (VIDEO_X_SIZE-2*VIDEO_BORDER)
45 uint8_t ch
; /* Character */
46 uint8_t attr
; /* Color table index */
49 /* Pixel formats in order of decreasing preference; PXF_NONE should be last */
50 /* BGR24 is preferred over BGRA32 since the I/O overhead is smaller. */
51 enum vesa_pixel_format
{
52 PXF_BGR24
, /* 24-bit BGR */
53 PXF_BGRA32
, /* 32-bit BGRA */
54 PXF_LE_RGB16_565
, /* 16-bit littleendian 5:6:5 RGB */
58 extern struct vesa_char
*__vesacon_text_display
;
60 extern int __vesacon_font_height
, __vesacon_text_rows
;
61 extern enum vesa_pixel_format __vesacon_pixel_format
;
62 extern unsigned int __vesacon_bytes_per_pixel
;
63 extern uint8_t __vesacon_graphics_font
[FONT_MAX_CHARS
][FONT_MAX_HEIGHT
];
64 extern uint32_t __vesacon_background
[VIDEO_Y_SIZE
][VIDEO_X_SIZE
];
65 extern uint32_t __vesacon_shadowfb
[VIDEO_Y_SIZE
][VIDEO_X_SIZE
];
67 extern const uint16_t __vesacon_srgb_to_linear
[256];
68 extern const uint8_t __vesacon_linear_to_srgb
[4080];
70 int __vesacon_init_background(void);
71 int vesacon_load_background(const char *);
72 int __vesacon_init(void);
73 void __vesacon_init_cursor(int);
74 void __vesacon_erase(int, int, int, int, uint8_t);
75 void __vesacon_scroll_up(int, uint8_t);
76 void __vesacon_write_char(int, int, uint8_t, uint8_t);
77 void __vesacon_redraw_text(void);
78 void __vesacon_doit(void);
79 void __vesacon_set_cursor(int, int, int);
81 #endif /* LIB_SYS_VESA_VIDEO_H */