xref: /haiku/src/add-ons/accelerants/intel_extreme/accelerant.h (revision cfc3fa87da824bdf593eb8b817a83b6376e77935)
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 	addr_t			buffer_base;
21 	uint32			buffer_offset;
22 	addr_t			state_base;
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 	struct overlay_registers *overlay_registers;
44 	overlay			*current_overlay;
45 	overlay_view	last_overlay_view;
46 	overlay_frame	last_overlay_frame;
47 	uint32			last_horizontal_overlay_scale;
48 	uint32			last_vertical_overlay_scale;
49 	uint32			overlay_position_buffer_offset;
50 
51 	edid1_info		edid_info;
52 	bool			has_edid;
53 
54 	// limited 3D support for overlay on i965
55 	addr_t			context_base;
56 	uint32			context_offset;
57 	bool			context_set;
58 
59 	int				device;
60 	uint8			head_mode;
61 	bool			is_clone;
62 };
63 
64 #define HEAD_MODE_A_ANALOG	0x01
65 #define HEAD_MODE_B_DIGITAL	0x02
66 #define HEAD_MODE_CLONE		0x03
67 
68 extern accelerant_info *gInfo;
69 
70 // register access
71 
72 inline uint32
73 read32(uint32 offset)
74 {
75 	return *(volatile uint32 *)(gInfo->regs + offset);
76 }
77 
78 inline void
79 write32(uint32 offset, uint32 value)
80 {
81 	*(volatile uint32 *)(gInfo->regs + offset) = value;
82 }
83 
84 
85 // dpms.cpp
86 extern void enable_display_plane(bool enable);
87 extern void set_display_power_mode(uint32 mode);
88 
89 // engine.cpp
90 extern void uninit_ring_buffer(ring_buffer &ringBuffer);
91 extern void setup_ring_buffer(ring_buffer &ringBuffer, const char *name);
92 
93 // modes.cpp
94 extern void wait_for_vblank(void);
95 extern void set_frame_buffer_base(void);
96 extern status_t create_mode_list(void);
97 
98 // memory.cpp
99 extern void intel_free_memory(uint32 base);
100 extern status_t intel_allocate_memory(size_t size, uint32 flags, uint32 &base);
101 
102 #endif	/* INTEL_EXTREME_ACCELERANT_H */
103