xref: /haiku/src/add-ons/accelerants/radeon/radeon_accelerant.h (revision 67bce78b48ed6d01b5a8eef89f5694c372b7e0a1)
1 /*
2 	Copyright (c) 2002/03, 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    _kdprintf_(const char *format, ...);
22 //bool    set_dprintf_enabled(bool);	/* returns old enable flag */
23 
24 #define dprintf _kdprintf_
25 
26 extern int debug_level_flow;
27 extern int debug_level_info;
28 extern int debug_level_error;
29 
30 #define DEBUG_MSG_PREFIX "Radeon - "
31 
32 //#define DEBUG_MAX_LEVEL_FLOW 2
33 
34 #include "debug_ext.h"
35 
36 typedef struct accelerator_info {
37 	virtual_card *vc;
38 	vuint8 *regs;				// pointer to mapped registers
39 								// !! dont't make it vuint32, access macros rely on 8 bits !!
40 	area_id shared_info_area;
41 	area_id regs_area;
42 	area_id virtual_card_area;
43 	int accelerant_is_clone;
44 
45 	int fd;						// file descriptor of kernel driver
46 	struct log_info_t *log;
47 
48 	area_id mode_list_area;		// cloned list of standard display modes
49 	display_mode *mode_list;
50 	shared_info *si;
51 } accelerator_info;
52 
53 
54 uint32 Radeon_RoundVWidth( int virtual_width, int bpp );
55 uint16 Radeon_GetHSyncFudge( shared_info *si, physical_port *port, int datatype );
56 void Radeon_HideMultiMode( virtual_card *vc, display_mode *mode );
57 bool Radeon_GetFormat( int space, int *format, int *bpp );
58 status_t Radeon_CreateModeList( shared_info *si );
59 
60 void Radeon_DetectMultiMode( virtual_card *vc, display_mode *mode );
61 void Radeon_VerifyMultiMode( virtual_card *vc, shared_info *si, display_mode *mode );
62 void Radeon_InitMultiModeVars( virtual_card *vc, display_mode *mode );
63 status_t Radeon_CheckMultiMonTunnel( virtual_card *vc, display_mode *mode,
64 	const display_mode *low, const display_mode *high, bool *isTunnel );
65 bool Radeon_NeedsSecondPort( display_mode *mode );
66 bool Radeon_DifferentPorts( display_mode *mode );
67 
68 void Radeon_CalcCRTCRegisters( accelerator_info *ai, virtual_port *port,
69 	display_mode *mode, port_regs *values );
70 void Radeon_ProgramCRTCRegisters( accelerator_info *ai, virtual_port *port,
71 	port_regs *values );
72 
73 void Radeon_CalcPLLDividers( pll_info *pll, unsigned long freq, port_regs *values );
74 void Radeon_ProgramPLL( accelerator_info *ai, virtual_port *port, port_regs *values );
75 
76 void Radeon_CalcFPRegisters( accelerator_info *ai, virtual_port *port, fp_info *fp_port, display_mode *mode, port_regs *values );
77 void Radeon_ProgramFPRegisters( accelerator_info *ai, fp_info *fp_port, port_regs *values );
78 status_t Radeon_ReadFPEDID( accelerator_info *ai, shared_info *si );
79 
80 status_t Radeon_SetDPMS( accelerator_info *ai, virtual_port *port, int mode );
81 uint32 Radeon_GetDPMS( accelerator_info *ai, virtual_port *port );
82 
83 void Radeon_SetCursorColors( accelerator_info *ai, virtual_port *port );
84 
85 void Radeon_Init2D( accelerator_info *ai, uint32 datatype );
86 
87 int Radeon_WaitForIdle( accelerator_info *ai );
88 void Radeon_ResetEngine( accelerator_info *ai );
89 void Radeon_SendWaitUntilIdle( accelerator_info *ai );
90 void Radeon_SendPurgeCache( accelerator_info *ai );
91 void Radeon_WaitForFifo( accelerator_info *ai, int entries );
92 void Radeon_Finish( accelerator_info *ai );
93 
94 status_t Radeon_InitCP( accelerator_info *ai );
95 void Radeon_SendCP( accelerator_info *ai, uint32 *buffer, uint32 num_dwords );
96 void Radeon_WriteRegCP( accelerator_info *ai, uint32 reg, uint32 value );
97 
98 void Radeon_ActivateVirtualCard( accelerator_info *ai );
99 
100 void Radeon_ReadSettings( virtual_card *vc );
101 void Radeon_WriteSettings( virtual_card *vc );
102 
103 void Radeon_HideOverlay( accelerator_info *ai );
104 status_t Radeon_UpdateOverlay( accelerator_info *ai );
105 void Radeon_SetColourKey( accelerator_info *ai, const overlay_window *ow );
106 
107 status_t Radeon_MoveDisplay( accelerator_info *ai, uint16 h_display_start, uint16 v_display_start );
108 
109 #ifdef __cplusplus
110 }
111 #endif
112 
113 #endif
114