xref: /haiku/headers/private/graphics/vesa/vesa.h (revision 1214ef1b2100f2b3299fc9d8d6142e46f70a4c3f)
1 /*
2 ** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the OpenBeOS License.
4 */
5 #ifndef VESA_H
6 #define VESA_H
7 
8 
9 #include <SupportDefs.h>
10 
11 
12 /* VBE info block structure */
13 
14 #define VESA_SIGNATURE	'ASEV'
15 #define VBE2_SIGNATURE	'2EBV'
16 
17 struct vbe_info_block {
18 	// VBE 1.x fields
19 	uint32		signature;
20 	struct {
21 		uint8	minor;
22 		uint8	major;
23 	} version;
24 	uint32		oem_string;
25 	uint32		capabilities;
26 	uint32		mode_list;
27 	uint16		total_memory;	// in 64k blocks
28 	// VBE 2.0+ fields only
29 	// Note, the block is 256 bytes in size for VBE 1.x as well,
30 	// but doesn't define these fields. VBE 3 doesn't define
31 	// any additional fields.
32 	uint16		oem_software_revision;
33 	uint32		oem_vendor_name_string;
34 	uint32		oem_product_name_string;
35 	uint32		oem_product_revision_string;
36 	uint8		reserved[222];
37 	uint8		oem_data[256];
38 } _PACKED;
39 
40 
41 /* VBE mode info structure */
42 
43 struct vbe_mode_info {
44 	uint16		attributes;
45 	uint8		window_a_attributes;
46 	uint8		window_b_attributes;
47 	uint16		window_granulatiry;
48 	uint16		window_size;
49 	uint16		window_a_segment;
50 	uint16		window_b_segment;
51 	uint32		window_function;	// real mode pointer
52 	uint16		bytes_per_row;
53 
54 	// VBE 1.2 and above
55 	uint16		width;
56 	uint16		height;
57 	uint8		char_width;
58 	uint8		char_height;
59 	uint8		num_planes;
60 	uint8		bits_per_pixel;
61 	uint8		num_banks;
62 	uint8		memory_model;
63 	uint8		bank_size;
64 	uint8		num_image_pages;
65 	uint8		_reserved0;
66 
67 	// direct color fields
68 	uint8		red_mask_size;
69 	uint8		red_field_position;
70 	uint8		green_mask_size;
71 	uint8		green_field_position;
72 	uint8		blue_mask_size;
73 	uint8		blue_field_position;
74 	uint8		reserved_mask_size;
75 	uint8		reserved_field_position;
76 	uint8		direct_color_mode_info;
77 
78 	// VBE 2.0 and above
79 	uint32		physical_base;
80 	uint32		_reserved1;
81 	uint16		_reserved2;
82 
83 	// VBE 3.0 and above
84 	uint16		linear_bytes_per_row;
85 	uint8		banked_num_image_pages;
86 	uint8		linear_num_image_pages;
87 
88 	uint8		linear_red_mask_size;
89 	uint8		linear_red_field_position;
90 	uint8		linear_green_mask_size;
91 	uint8		linear_green_field_position;
92 	uint8		linear_blue_mask_size;
93 	uint8		linear_blue_field_position;
94 	uint8		linear_reserved_mask_size;
95 	uint8		linear_reserved_field_position;
96 
97 	uint32		max_pixel_clock;		// in Hz
98 
99 	uint8		_reserved[189];
100 } _PACKED;
101 
102 // definitions of mode info attributes
103 #define MODE_ATTR_AVAILABLE		1
104 #define MODE_ATTR_COLOR_MODE	8
105 #define MODE_ATTR_GRAPHICS_MODE	16
106 #define MODE_ATTR_LINEAR_BUFFER	128
107 
108 // memory models
109 #define MODE_MEMORY_TEXT			0
110 #define MODE_MEMORY_PLANAR			3
111 #define MODE_MEMORY_PACKED_PIXEL	4
112 #define MODE_MEMORY_DIRECT_COLOR	6
113 #define MODE_MEMORY_YUV				7
114 
115 // set mode flags
116 #define SET_MODE_MASK				0x01ff
117 #define SET_MODE_SPECIFY_CRTC		(1 << 11)
118 #define SET_MODE_LINEAR_BUFFER		(1 << 14)
119 #define SET_MODE_DONT_CLEAR_MEMORY	(1 << 15)
120 
121 
122 /* VBE 3.0 protected mode interface
123  * The BIOS area can be scanned for the protected mode
124  * signature that identifies the structure below.
125  */
126 
127 #define VBE_PM_SIGNATURE 'DIMP'
128 
129 struct vbe_protected_mode_info {
130 	uint32		signature;
131 	int16		entry_offset;
132 	int16		init_offset;
133 	uint16		data_selector;
134 	uint16		a000_selector;
135 	uint16		b000_selector;
136 	uint16		b800_selector;
137 	uint16		c000_selector;
138 	uint8		in_protected_mode;
139 	uint8		checksum;
140 } _PACKED;
141 
142 #endif	/* VESA_H */
143