xref: /haiku/src/add-ons/accelerants/radeon/radeon_accelerant.h (revision c90684742e7361651849be4116d0e5de3a817194)
1 /*
2 	Copyright (c) 2002-2005, Thomas Kurschel
3 
4 
5 	Part of Radeon accelerant
6 
7 	Internal header file
8 */
9 
10 #ifndef _RADEON_ACCELERANT_H
11 #define _RADEON_ACCELERANT_H
12 
13 
14 #include "radeon_interface.h"
15 #include "accelerant_ext.h"
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 void    _sPrintf(const char *format, ...);
22 //bool    set_dprintf_enabled(bool);	/* returns old enable flag */
23 
24 #define dprintf _sPrintf
25 
26 extern int debug_level_flow;
27 extern int debug_level_info;
28 extern int debug_level_error;
29 
30 /*#define DEBUG_WAIT_ON_MSG 1000000
31 #define DEBUG_WAIT_ON_ERROR 1000000*/
32 
33 #define DEBUG_MSG_PREFIX "Radeon - "
34 
35 #define DEBUG_MAX_LEVEL_FLOW 3
36 
37 #include "debug_ext.h"
38 
39 
40 // info about this accelerant
41 typedef struct accelerator_info {
42 	shared_info *si;			// info shared between accelerants
43 	virtual_card *vc;			// associated virtual card
44 	vuint8 *regs;				// pointer to mapped registers
45 								// !! dont't make it vuint32, access macros rely on 8 bits !!
46 
47 	area_id shared_info_area;	// info shared between accelerants
48 	area_id regs_area;			// MM I/O registers
49 	area_id virtual_card_area;	// info about virtual card
50 
51 	// mapped-in (non)-local memory;
52 	// as si->local_mem contains a pointer to the local frame buffer,
53 	// only mt_pci and mt_agp are filled directly, mt_nonlocal contains
54 	// a copy of either mt_pci or mt_agp, mt_local a copy of si->local_mem
55 	struct {
56 		area_id 	area;		// area of clone
57 		char 		*data;		// CPU address of area
58 	} mapped_memory[mt_last+1];
59 
60 	int accelerant_is_clone;	// true, if this is a cloned accelerant
61 
62 	int fd;						// file descriptor of kernel driver
63 	struct log_info_t *log;
64 
65 	area_id mode_list_area;		// cloned list of standard display modes
66 	display_mode *mode_list;	// list of standard display modes
67 } accelerator_info;
68 
69 
70 #define IS_INTERNAL_TV_OUT( tv_chip ) \
71 	( (tv_chip) == tc_internal_rt1 || (tv_chip) == tc_internal_rt2 )
72 
73 
74 // vesa_modes.c
75 extern const display_timing vesa_mode_list[];
76 extern const size_t vesa_mode_list_count;
77 
78 // SetDisplayMode.c
79 uint32 Radeon_RoundVWidth( int virtual_width, int bpp );
80 status_t Radeon_MoveDisplay( accelerator_info *ai, uint16 h_display_start, uint16 v_display_start );
81 void Radeon_EnableIRQ( accelerator_info *ai, bool enable );
82 
83 // multimon.c
84 void Radeon_HideMultiMode( virtual_card *vc, display_mode *mode );
85 void Radeon_DetectMultiMode( virtual_card *vc, display_mode *mode );
86 void Radeon_VerifyMultiMode( virtual_card *vc, shared_info *si, display_mode *mode );
87 void Radeon_InitMultiModeVars( accelerator_info *ai, display_mode *mode );
88 status_t Radeon_CheckMultiMonTunnel( virtual_card *vc, display_mode *mode,
89 	const display_mode *low, const display_mode *high, bool *isTunnel );
90 bool Radeon_NeedsSecondPort( display_mode *mode );
91 bool Radeon_DifferentPorts( display_mode *mode );
92 
93 
94 // ProposeDisplayMode.c
95 bool Radeon_GetFormat( int space, int *format, int *bpp );
96 status_t Radeon_CreateModeList( shared_info *si );
97 
98 
99 // dpms.c
100 status_t Radeon_SetDPMS( accelerator_info *ai, int crtc_idx, int mode );
101 uint32 Radeon_GetDPMS( accelerator_info *ai, int crtc_idx );
102 
103 
104 // Cursor.c
105 void Radeon_SetCursorColors( accelerator_info *ai, int crtc_idx );
106 void Radeon_ShowCursor( accelerator_info *ai, int crtc_idx );
107 
108 
109 // Acceleration.c
110 void Radeon_Init2D( accelerator_info *ai );
111 void Radeon_AllocateVirtualCardStateBuffer( accelerator_info *ai );
112 void Radeon_FreeVirtualCardStateBuffer( accelerator_info *ai );
113 void Radeon_FillStateBuffer( accelerator_info *ai, uint32 datatype );
114 
115 
116 // driver_wrapper.c
117 status_t Radeon_WaitForIdle( accelerator_info *ai, bool keep_lock );
118 status_t Radeon_WaitForFifo( accelerator_info *ai, int entries );
119 void Radeon_ResetEngine( accelerator_info *ai );
120 
121 status_t Radeon_VIPRead( accelerator_info *ai, uint channel, uint address, uint32 *data );
122 status_t Radeon_VIPWrite( accelerator_info *ai, uint8 channel, uint address, uint32 data );
123 int Radeon_FindVIPDevice( accelerator_info *ai, uint32 device_id );
124 
125 
126 // settings.cpp
127 void Radeon_ReadSettings( virtual_card *vc );
128 void Radeon_WriteSettings( virtual_card *vc );
129 
130 
131 // overlay.c
132 void Radeon_HideOverlay( accelerator_info *ai );
133 status_t Radeon_UpdateOverlay( accelerator_info *ai );
134 void Radeon_InitOverlay( accelerator_info *ai, int crtc_idx );
135 
136 // EngineManagement.c
137 void Radeon_Spin( uint32 delay );
138 
139 
140 // monitor_detection.c
141 void Radeon_DetectDisplays( accelerator_info *ai );
142 bool Radeon_ReadEDID( accelerator_info *ai, uint32 ddc_port, edid1_info *edid );
143 
144 
145 // palette.c
146 void Radeon_InitPalette( accelerator_info *ai, int crtc_idx );
147 
148 
149 // theatre_out.c
150 void Radeon_DetectTVOut( accelerator_info *ai );
151 
152 
153 #ifdef __cplusplus
154 }
155 #endif
156 
157 #endif
158