xref: /haiku/src/add-ons/accelerants/matrox/engine/mga_proto.h (revision 4f00613311d0bd6b70fa82ce19931c41f071ea4e)
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*,uint8*,uint8*);
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 status_t gx00_maven_set_vid_pll(display_mode target);
74 
75 /*MAVENTV functions*/
76 status_t g100_g400max_maventv_vid_pll_find(
77 	display_mode target, unsigned int * ht_new, unsigned int * ht_last_line,
78 	uint8 * m_result, uint8 * n_result, uint8 * p_result);
79 int maventv_init(display_mode target);
80 
81 /*CRTC1 functions*/
82 status_t gx00_crtc_validate_timing(
83 	uint16 *hd_e,uint16 *hs_s,uint16 *hs_e,uint16 *ht,
84 	uint16 *vd_e,uint16 *vs_s,uint16 *vs_e,uint16 *vt
85 );
86 status_t gx00_crtc_set_timing(display_mode target);
87 status_t gx00_crtc_depth(int mode);
88 status_t gx00_crtc_set_display_start(uint32 startadd,uint8 bpp);
89 status_t gx00_crtc_set_display_pitch(void);
90 status_t gx00_crtc_dpms(bool display,bool h,bool v);
91 status_t gx00_crtc_mem_priority(uint8);
92 status_t gx00_crtc_cursor_init(void); /*Yes, cursor follows CRTC1 - not the DAC!*/
93 status_t gx00_crtc_cursor_define(uint8*,uint8*);
94 status_t gx00_crtc_cursor_position(uint16 x ,uint16 y);
95 status_t gx00_crtc_cursor_show(void);
96 status_t gx00_crtc_cursor_hide(void);
97 
98 /*CRTC2 functions*/
99 /*XXX - validate_timing*/
100 status_t g400_crtc2_set_timing(display_mode target);
101 status_t g400_crtc2_depth(int mode);
102 status_t g400_crtc2_set_display_pitch(void);
103 status_t g400_crtc2_set_display_start(uint32 startadd,uint8 bpp);
104 status_t g400_crtc2_dpms(bool display, bool h, bool v);
105 
106 /*acceleration functions*/
107 status_t check_acc_capability(uint32 feature);
108 status_t gx00_acc_init(void);
109 status_t gx00_acc_rectangle(uint32 xs,uint32 xe,uint32 ys,uint32 yl,uint32 col);
110 status_t gx00_acc_rectangle_invert(uint32 xs,uint32 xe,uint32 ys,uint32 yl,uint32 col);
111 status_t gx00_acc_blit(uint16,uint16,uint16, uint16,uint16,uint16 );
112 status_t gx00_acc_transparent_blit(uint16,uint16,uint16, uint16,uint16,uint16, uint32);
113 status_t gx00_acc_video_blit(uint16 xs,uint16 ys,uint16 ws, uint16 hs,
114 	uint16 xd,uint16 yd,uint16 wd,uint16 hd);
115 status_t gx00_acc_wait_idle(void);
116 
117 /*backend scaler functions*/
118 status_t check_overlay_capability(uint32 feature);
119 void gx00_bes_move_overlay(void);
120 status_t gx00_configure_bes
121 	(const overlay_buffer *ob, const overlay_window *ow,const overlay_view *ov, int offset);
122 status_t gx00_release_bes(void);
123 
124 /* I2C functions */
125 status_t i2c_sec_tv_adapter(void);
126 
127 /*driver structures and enums*/
128 enum{BPP8=0,BPP15=1,BPP16=2,BPP24=3,BPP32DIR=4,BPP32=7};
129 enum{DS_CRTC1DAC_CRTC2MAVEN, DS_CRTC1MAVEN_CRTC2DAC, DS_CRTC1CON1_CRTC2CON2, DS_CRTC1CON2_CRTC2CON1};
130