Adding upstream version 4.00~pre53+dfsg.
[syslinux-debian/hramrach.git] / com32 / lib / sys / vesa / video.h
blobd14494b170c2329ffe25d7ea4bee456037e93293
1 /* ----------------------------------------------------------------------- *
3 * Copyright 2006-2008 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
12 * conditions:
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
31 #include <stdbool.h>
32 #include <colortbl.h>
33 #include "vesa.h"
35 #define FONT_MAX_CHARS 256
36 #define FONT_MAX_HEIGHT 32
37 #define FONT_WIDTH 8
39 #define DEFAULT_VESA_X_SIZE 640
40 #define DEFAULT_VESA_Y_SIZE 480
42 #define VIDEO_BORDER 8
43 #define TEXT_PIXEL_ROWS (__vesa_info.mi.v_res - 2*VIDEO_BORDER)
44 #define TEXT_PIXEL_COLS (__vesa_info.mi.h_res - 2*VIDEO_BORDER)
46 typedef uint16_t attr_t;
48 struct vesa_char {
49 uint8_t ch; /* Character */
50 uint8_t _filler; /* Currently unused */
51 attr_t attr; /* Color table index */
54 /* Pixel formats in order of decreasing preference; PXF_NONE should be last */
55 /* BGR24 is preferred over BGRA32 since the I/O overhead is smaller. */
56 enum vesa_pixel_format {
57 PXF_BGR24, /* 24-bit BGR */
58 PXF_BGRA32, /* 32-bit BGRA */
59 PXF_LE_RGB16_565, /* 16-bit littleendian 5:6:5 RGB */
60 PXF_LE_RGB15_555, /* 15-bit littleendian 5:5:5 RGB */
61 PXF_NONE
63 extern enum vesa_pixel_format __vesacon_pixel_format;
64 extern unsigned int __vesacon_bytes_per_pixel;
65 typedef const void *(*__vesacon_format_pixels_t)
66 (void *, const uint32_t *, size_t);
67 extern __vesacon_format_pixels_t __vesacon_format_pixels;
68 extern const __vesacon_format_pixels_t __vesacon_format_pixels_list[PXF_NONE];
70 extern struct vesa_char *__vesacon_text_display;
72 extern int __vesacon_font_height;
73 extern int __vesacon_text_rows;
74 extern int __vesacon_text_cols;
75 extern uint8_t __vesacon_graphics_font[FONT_MAX_CHARS][FONT_MAX_HEIGHT];
76 extern uint32_t *__vesacon_background;
77 extern uint32_t *__vesacon_shadowfb;
79 extern const uint16_t __vesacon_srgb_to_linear[256];
80 extern const uint8_t __vesacon_linear_to_srgb[4080];
82 int __vesacon_init_background(void);
83 int vesacon_load_background(const char *);
84 int __vesacon_init(int, int);
85 void __vesacon_init_cursor(int);
86 void __vesacon_erase(int, int, int, int, attr_t);
87 void __vesacon_scroll_up(int, attr_t);
88 void __vesacon_write_char(int, int, uint8_t, attr_t);
89 void __vesacon_redraw_text(void);
90 void __vesacon_doit(void);
91 void __vesacon_set_cursor(int, int, bool);
92 void __vesacon_copy_to_screen(size_t, const uint32_t *, size_t);
93 void __vesacon_init_copy_to_screen(void);
95 int __vesacon_i915resolution(int x, int y);
97 #endif /* LIB_SYS_VESA_VIDEO_H */