xref: /haiku/src/add-ons/accelerants/intel_extreme/accelerant.h (revision cd552c7a15cc10c36dae8d7439ba1d6c0bb168c5)
1 /*
2  * Copyright 2006, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Axel Dörfler, axeld@pinc-software.de
7  */
8 #ifndef INTEL_EXTREME_ACCELERANT_H
9 #define INTEL_EXTREME_ACCELERANT_H
10 
11 
12 #include "intel_extreme.h"
13 
14 #include <video_overlay.h>
15 
16 
17 struct overlay {
18 	overlay_buffer	buffer;
19 	uint32			buffer_handle;
20 	uint32			buffer_offset;
21 };
22 
23 struct overlay_frame {
24 	int16			h_start;
25 	int16			v_start;
26 	uint16			width;
27 	uint16			height;
28 };
29 
30 struct accelerant_info {
31 	vuint8			*regs;
32 	area_id			regs_area;
33 
34 	intel_shared_info *shared_info;
35 	area_id			shared_info_area;
36 
37 	display_mode	*mode_list;		// cloned list of standard display modes
38 	area_id			mode_list_area;
39 
40 	uint32			frame_buffer_handle;
41 
42 	struct overlay_registers *overlay_registers;
43 	overlay			*current_overlay;
44 	overlay_view	last_overlay_view;
45 	overlay_frame	last_overlay_frame;
46 	uint32			last_horizontal_overlay_scale;
47 	uint32			last_vertical_overlay_scale;
48 	uint32			overlay_position_buffer_offset;
49 
50 	hardware_status	*status;
51 	uint8			*cursor_memory;
52 
53 	int				device;
54 	uint8			head_mode;
55 	bool			is_clone;
56 };
57 
58 #define HEAD_MODE_A_ANALOG	0x01
59 #define HEAD_MODE_B_DIGITAL	0x02
60 #define HEAD_MODE_CLONE		0x03
61 
62 extern accelerant_info *gInfo;
63 
64 // register access
65 
66 inline uint32
67 read32(uint32 offset)
68 {
69 	return *(volatile uint32 *)(gInfo->regs + offset);
70 }
71 
72 inline void
73 write32(uint32 offset, uint32 value)
74 {
75 	*(volatile uint32 *)(gInfo->regs + offset) = value;
76 }
77 
78 
79 // dpms.cpp
80 extern void enable_display_plane(bool enable);
81 extern void set_display_power_mode(uint32 mode);
82 
83 // engine.cpp
84 extern void uninit_ring_buffer(ring_buffer &ringBuffer);
85 extern void setup_ring_buffer(ring_buffer &ringBuffer, const char *name);
86 
87 // modes.cpp
88 extern void wait_for_vblank(void);
89 extern status_t create_mode_list(void);
90 
91 // memory.cpp
92 extern void intel_free_memory(uint32 handle);
93 extern status_t intel_allocate_memory(size_t size, uint32& handle, uint32& offset);
94 
95 #endif	/* INTEL_EXTREME_ACCELERANT_H */
96