xref: /haiku/src/add-ons/kernel/drivers/graphics/vesa/vesa_private.h (revision 46b7da1f4f40f7157d74fc7fb26ff9ec7f2416f2)
16328832fSAxel Dörfler /*
2bfd4c59bSAxel Dörfler  * Copyright 2005-2009, Axel Dörfler, axeld@pinc-software.de.
3*015b4086SAdrien Destugues  * Copyright 2021, Adrien Destugues, pulkomandy@pulkomandy.tk
46328832fSAxel Dörfler  * Distributed under the terms of the MIT License.
56328832fSAxel Dörfler  */
66328832fSAxel Dörfler #ifndef VESA_PRIVATE_H
76328832fSAxel Dörfler #define VESA_PRIVATE_H
86328832fSAxel Dörfler 
96328832fSAxel Dörfler 
106328832fSAxel Dörfler #include <Drivers.h>
116328832fSAxel Dörfler #include <Accelerant.h>
126328832fSAxel Dörfler #include <PCI.h>
136328832fSAxel Dörfler 
14*015b4086SAdrien Destugues #include <drivers/bios.h>
15*015b4086SAdrien Destugues 
166328832fSAxel Dörfler 
176328832fSAxel Dörfler #define DEVICE_NAME				"vesa"
186328832fSAxel Dörfler #define VESA_ACCELERANT_NAME	"vesa.accelerant"
196328832fSAxel Dörfler 
206328832fSAxel Dörfler 
216328832fSAxel Dörfler struct vesa_get_supported_modes;
229f161845SAxel Dörfler struct vesa_mode;
236328832fSAxel Dörfler 
246328832fSAxel Dörfler struct vesa_info {
256328832fSAxel Dörfler 	uint32			cookie_magic;
266328832fSAxel Dörfler 	int32			open_count;
276328832fSAxel Dörfler 	int32			id;
286328832fSAxel Dörfler 	pci_info*		pci;
296328832fSAxel Dörfler 	struct vesa_shared_info* shared_info;
306328832fSAxel Dörfler 	area_id			shared_area;
319f161845SAxel Dörfler 	vesa_mode*		modes;
32bfd4c59bSAxel Dörfler 	uint32			vbe_dpms_capabilities;
33bb693d77SAxel Dörfler 	uint8			vbe_capabilities;
34bb693d77SAxel Dörfler 	uint8			bits_per_gun;
355472c0c2SAxel Dörfler 
365472c0c2SAxel Dörfler 	addr_t			frame_buffer;
375472c0c2SAxel Dörfler 	addr_t			physical_frame_buffer;
385472c0c2SAxel Dörfler 	size_t			physical_frame_buffer_size;
395472c0c2SAxel Dörfler 	bool			complete_frame_buffer_mapped;
406328832fSAxel Dörfler };
416328832fSAxel Dörfler 
426328832fSAxel Dörfler extern status_t vesa_init(vesa_info& info);
436328832fSAxel Dörfler extern void vesa_uninit(vesa_info& info);
44bfd4c59bSAxel Dörfler extern status_t vesa_set_display_mode(vesa_info& info, uint32 mode);
451005a276SAdrien Destugues extern status_t vesa_set_custom_display_mode(vesa_info& info, display_mode& mode);
46bfd4c59bSAxel Dörfler extern status_t vesa_get_dpms_mode(vesa_info& info, uint32& mode);
47bfd4c59bSAxel Dörfler extern status_t vesa_set_dpms_mode(vesa_info& info, uint32 mode);
48*015b4086SAdrien Destugues extern status_t vesa_set_indexed_colors(vesa_info& info, uint8 first, uint8* colors, uint16 count);
49*015b4086SAdrien Destugues 
50*015b4086SAdrien Destugues extern void vesa_identify_bios(bios_state* state, vesa_shared_info* sharedInfo);
51*015b4086SAdrien Destugues 
52*015b4086SAdrien Destugues status_t vbe_call_prepare(bios_state** state);
53*015b4086SAdrien Destugues status_t vbe_get_mode_info(bios_state* state, uint16 mode, struct vbe_mode_info* modeInfo);
54*015b4086SAdrien Destugues uint32 get_color_space_for_depth(uint32 depth);
55*015b4086SAdrien Destugues status_t vbe_set_mode(bios_state* state, uint16 mode);
56*015b4086SAdrien Destugues status_t vbe_set_bits_per_gun(bios_state* state, vesa_info& info, uint8 bits);
57*015b4086SAdrien Destugues status_t remap_frame_buffer(vesa_info& info, addr_t physicalBase, uint32 width,
58*015b4086SAdrien Destugues 	uint32 height, int8 depth, uint32 bytesPerRow, bool initializing);
59*015b4086SAdrien Destugues void vbe_call_finish(bios_state* state);
606328832fSAxel Dörfler 
616328832fSAxel Dörfler #endif	/* VESA_PRIVATE_H */
62