xref: /haiku/src/add-ons/accelerants/intel_extreme/accelerant.h (revision 020cbad9d40235a2c50a81a42d69912a5ff8fbc4)
1 /*
2  * Copyright 2006-2008, 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 <edid.h>
15 #include <video_overlay.h>
16 
17 
18 struct overlay {
19 	overlay_buffer	buffer;
20 	uint32			buffer_handle;
21 	uint32			buffer_offset;
22 	uint32			state_handle;
23 	uint32			state_offset;
24 };
25 
26 struct overlay_frame {
27 	int16			h_start;
28 	int16			v_start;
29 	uint16			width;
30 	uint16			height;
31 };
32 
33 struct accelerant_info {
34 	vuint8			*regs;
35 	area_id			regs_area;
36 
37 	intel_shared_info *shared_info;
38 	area_id			shared_info_area;
39 
40 	display_mode	*mode_list;		// cloned list of standard display modes
41 	area_id			mode_list_area;
42 
43 	uint32			frame_buffer_handle;
44 
45 	struct overlay_registers *overlay_registers;
46 	overlay			*current_overlay;
47 	overlay_view	last_overlay_view;
48 	overlay_frame	last_overlay_frame;
49 	uint32			last_horizontal_overlay_scale;
50 	uint32			last_vertical_overlay_scale;
51 	uint32			overlay_position_buffer_offset;
52 
53 	hardware_status	*status;
54 	uint8			*cursor_memory;
55 
56 	edid1_info		edid_info;
57 	bool			has_edid;
58 
59 	// limited 3D support for overlay on i965
60 	uint32			context_handle;
61 	uint32			context_offset;
62 	bool			context_set;
63 
64 	int				device;
65 	uint8			head_mode;
66 	bool			is_clone;
67 };
68 
69 #define HEAD_MODE_A_ANALOG	0x01
70 #define HEAD_MODE_B_DIGITAL	0x02
71 #define HEAD_MODE_CLONE		0x03
72 
73 extern accelerant_info *gInfo;
74 
75 // register access
76 
77 inline uint32
78 read32(uint32 offset)
79 {
80 	return *(volatile uint32 *)(gInfo->regs + offset);
81 }
82 
83 inline void
84 write32(uint32 offset, uint32 value)
85 {
86 	*(volatile uint32 *)(gInfo->regs + offset) = value;
87 }
88 
89 
90 // dpms.cpp
91 extern void enable_display_plane(bool enable);
92 extern void set_display_power_mode(uint32 mode);
93 
94 // engine.cpp
95 extern void uninit_ring_buffer(ring_buffer &ringBuffer);
96 extern void setup_ring_buffer(ring_buffer &ringBuffer, const char *name);
97 
98 // modes.cpp
99 extern void wait_for_vblank(void);
100 extern void set_frame_buffer_base(void);
101 extern status_t create_mode_list(void);
102 
103 // memory.cpp
104 extern void intel_free_memory(uint32 handle);
105 extern status_t intel_allocate_memory(size_t size, uint32& handle, uint32& offset);
106 
107 #endif	/* INTEL_EXTREME_ACCELERANT_H */
108