xref: /haiku/src/add-ons/accelerants/matrox/engine/mga_proto.h (revision ed24eb5ff12640d052171c6a7feba37fab8a75d1)
1 /*general card functions*/
2 status_t gx00_general_powerup(void);
3 status_t mga_set_cas_latency(void);
4 status_t gx50_general_output_select(void);
5 status_t gx00_general_dac_select(int);
6 status_t gx00_general_wait_retrace(void);
7 status_t gx00_general_validate_pic_size (display_mode *target, uint32 *bytes_per_row, bool *acc_mode);
8 
9 /* apsed: logging macros */
10 #define MSG(args) do { /* if needed or si->settings with si NULL */ \
11 	mga_log args; \
12 } while (0)
13 #define LOG(level_bit, args) do { \
14 	uint32 mod = (si->settings.logmask &  0xfffffff0) & MODULE_BIT; \
15 	uint32 lev = (si->settings.logmask & ~0xfffffff0) & level_bit; \
16 	if (mod && lev) mga_log args; \
17 } while (0)
18 
19 /*support functions*/
20 void delay(bigtime_t i);
21 void mga_log(char *format, ...);
22 
23 /*i2c maven functions*/
24 int i2c_maven_read(unsigned char address);
25 void i2c_maven_write(unsigned char address, unsigned char data);
26 status_t i2c_init(void);
27 status_t i2c_maven_probe(void);
28 
29 
30 /*card info functions*/
31 status_t parse_pins(void);
32 status_t pins1_read(uint8 *pins, uint8 length);
33 status_t pins2_read(uint8 *pins, uint8 length);
34 status_t pins3_read(uint8 *pins, uint8 length);
35 status_t pins4_read(uint8 *pins, uint8 length);
36 status_t pins5_read(uint8 *pins, uint8 length);
37 void fake_pins(void);
38 void pinsmil1_fake(void);
39 void pinsmil2_fake(void);
40 void pinsg100_fake(void);
41 void pinsg200_fake(void);
42 void pinsg400_fake(void);
43 void pinsg400max_fake(void);
44 void pinsg450_fake(void);
45 void pinsg550_fake(void);
46 void dump_pins(void);
47 
48 /*DAC functions*/
49 status_t gx00_dac_mode(int,float);
50 status_t gx00_dac_palette(uint8 r[256],uint8 g[256],uint8 b[256]);
51 
52 status_t gx00_dac_pix_pll_find(display_mode target,float * result,uint8 *,uint8 *,uint8 *, uint8);
53 status_t gx00_dac_set_pix_pll(display_mode target);
54 
55 status_t g450_dac_set_sys_pll(void);
56 status_t g400_dac_set_sys_pll(void);
57 status_t g200_dac_set_sys_pll(void);
58 status_t g100_dac_set_sys_pll(void);
59 
60 status_t mil2_dac_init(void);
61 status_t mil2_dac_set_pix_pll(float f_vco,int bpp);
62 
63 /*MAVEN functions*/
64 status_t gx00_maven_clrline(void);
65 status_t gx00_maven_dpms(bool display, bool h, bool v);
66 status_t gx00_maven_set_timing(display_mode target);
67 status_t gx00_maven_mode(int,float);
68 
69 status_t g100_g400max_maven_vid_pll_find(display_mode target,float * calc_pclk,
70 				uint8 * m_result,uint8 * n_result,uint8 * p_result);
71 status_t g450_g550_maven_vid_pll_find(display_mode target,float * calc_pclk,
72 				uint8 * m_result,uint8 * n_result,uint8 * p_result, uint8 test);
73 void gx00_maven_shutoff(void);
74 status_t gx00_maven_set_vid_pll(display_mode target);
75 
76 /*MAVENTV functions*/
77 status_t g100_g400max_maventv_vid_pll_find(
78 	display_mode target, unsigned int * ht_new, unsigned int * ht_last_line,
79 	uint8 * m_result, uint8 * n_result, uint8 * p_result);
80 int maventv_init(display_mode target);
81 
82 /*CRTC1 functions*/
83 status_t gx00_crtc_validate_timing(
84 	uint16 *hd_e,uint16 *hs_s,uint16 *hs_e,uint16 *ht,
85 	uint16 *vd_e,uint16 *vs_s,uint16 *vs_e,uint16 *vt
86 );
87 status_t gx00_crtc_set_timing(display_mode target);
88 status_t gx00_crtc_depth(int mode);
89 status_t gx00_crtc_set_display_start(uint32 startadd,uint8 bpp);
90 status_t gx00_crtc_set_display_pitch(void);
91 status_t gx00_crtc_dpms(bool display,bool h,bool v);
92 status_t gx00_crtc_mem_priority(uint8);
93 status_t gx00_crtc_cursor_init(void); /*Yes, cursor follows CRTC1 - not the DAC!*/
94 status_t gx00_crtc_cursor_define(uint8*,uint8*);
95 status_t gx00_crtc_cursor_position(uint16 x ,uint16 y);
96 status_t gx00_crtc_cursor_show(void);
97 status_t gx00_crtc_cursor_hide(void);
98 
99 /*CRTC2 functions*/
100 /*XXX - validate_timing*/
101 status_t g400_crtc2_set_timing(display_mode target);
102 status_t g400_crtc2_depth(int mode);
103 status_t g400_crtc2_set_display_pitch(void);
104 status_t g400_crtc2_set_display_start(uint32 startadd,uint8 bpp);
105 status_t g400_crtc2_dpms(bool display, bool h, bool v);
106 
107 /*acceleration functions*/
108 status_t check_acc_capability(uint32 feature);
109 status_t gx00_acc_wait_idle(void);
110 status_t gx00_acc_init(void);
111 void SCREEN_TO_SCREEN_BLIT(engine_token *et, blit_params *list, uint32 count);
112 void SCREEN_TO_SCREEN_TRANSPARENT_BLIT(engine_token *et, uint32 transparent_colour, blit_params *list, uint32 count);
113 void SCREEN_TO_SCREEN_SCALED_FILTERED_BLIT(engine_token *et, scaled_blit_params *list, uint32 count);
114 void FILL_RECTANGLE(engine_token *et, uint32 color, fill_rect_params *list, uint32 count);
115 void FILL_SPAN(engine_token *et, uint32 color, uint16 *list, uint32 count);
116 void INVERT_RECTANGLE(engine_token *et, fill_rect_params *list, uint32 count);
117 
118 /*backend scaler functions*/
119 status_t check_overlay_capability(uint32 feature);
120 void gx00_bes_move_overlay(void);
121 status_t gx00_configure_bes
122 	(const overlay_buffer *ob, const overlay_window *ow,const overlay_view *ov, int offset);
123 status_t gx00_release_bes(void);
124 
125 /* I2C functions */
126 status_t i2c_sec_tv_adapter(void);
127 
128 /*driver structures and enums*/
129 enum
130 {
131 	BPP8 = 0,
132 	BPP15 = 1,
133 	BPP16 = 2,
134 	BPP24 = 3,
135 	BPP32DIR = 4,
136 	BPP32 = 7
137 };
138 
139 enum
140 {
141 	DS_CRTC1DAC,
142 	DS_CRTC1MAVEN,
143 	DS_CRTC1DAC_CRTC2MAVEN,
144 	DS_CRTC1MAVEN_CRTC2DAC,
145 	DS_CRTC1CON1_CRTC2CON2,
146 	DS_CRTC1CON2_CRTC2CON1
147 };
148