xref: /haiku/src/add-ons/kernel/drivers/graphics/vesa/vesa_private.h (revision 52f7c9389475e19fc21487b38064b4390eeb6fea)
1 /*
2  * Copyright 2005-2009, Axel Dörfler, axeld@pinc-software.de.
3  * Copyright 2021, Adrien Destugues, pulkomandy@pulkomandy.tk
4  * Distributed under the terms of the MIT License.
5  */
6 #ifndef VESA_PRIVATE_H
7 #define VESA_PRIVATE_H
8 
9 
10 #include <Drivers.h>
11 #include <Accelerant.h>
12 #include <PCI.h>
13 
14 #include <drivers/bios.h>
15 
16 
17 #define DEVICE_NAME				"vesa"
18 #define VESA_ACCELERANT_NAME	"vesa.accelerant"
19 
20 
21 struct vesa_get_supported_modes;
22 struct vesa_mode;
23 
24 struct vesa_info {
25 	uint32			cookie_magic;
26 	int32			open_count;
27 	int32			id;
28 	pci_info*		pci;
29 	struct vesa_shared_info* shared_info;
30 	area_id			shared_area;
31 	vesa_mode*		modes;
32 	uint32			vbe_dpms_capabilities;
33 	uint8			vbe_capabilities;
34 	uint8			bits_per_gun;
35 
36 	addr_t			frame_buffer;
37 	addr_t			physical_frame_buffer;
38 	size_t			physical_frame_buffer_size;
39 	bool			complete_frame_buffer_mapped;
40 };
41 
42 extern status_t vesa_init(vesa_info& info);
43 extern void vesa_uninit(vesa_info& info);
44 extern status_t vesa_set_display_mode(vesa_info& info, uint32 mode);
45 extern status_t vesa_set_custom_display_mode(vesa_info& info, display_mode& mode);
46 extern status_t vesa_get_dpms_mode(vesa_info& info, uint32& mode);
47 extern status_t vesa_set_dpms_mode(vesa_info& info, uint32 mode);
48 extern status_t vesa_set_indexed_colors(vesa_info& info, uint8 first, uint8* colors, uint16 count);
49 
50 extern void vesa_identify_bios(bios_state* state, vesa_shared_info* sharedInfo);
51 
52 status_t vbe_call_prepare(bios_state** state);
53 status_t vbe_get_mode_info(bios_state* state, uint16 mode, struct vbe_mode_info* modeInfo);
54 uint32 get_color_space_for_depth(uint32 depth);
55 status_t vbe_set_mode(bios_state* state, uint16 mode);
56 status_t vbe_set_bits_per_gun(bios_state* state, vesa_info& info, uint8 bits);
57 status_t remap_frame_buffer(vesa_info& info, addr_t physicalBase, uint32 width,
58 	uint32 height, int8 depth, uint32 bytesPerRow, bool initializing);
59 void vbe_call_finish(bios_state* state);
60 
61 #endif	/* VESA_PRIVATE_H */
62