xref: /haiku/src/add-ons/accelerants/nvidia/engine/nv_proto.h (revision 9eb55bc1d104b8fda80898f8b25c94d8000c8255)
1 /*general card functions*/
2 status_t nv_general_powerup(void);
3 status_t nv_set_cas_latency(void);
4 status_t nv_general_output_select(bool cross);
5 status_t nv_general_wait_retrace(void);
6 status_t nv_general_validate_pic_size (display_mode *target, uint32 *bytes_per_row, bool *acc_mode);
7 
8 /* apsed: logging macros */
9 #define MSG(args) do { /* if needed or si->settings with si NULL */ \
10 	nv_log args; \
11 } while (0)
12 #define LOG(level_bit, args) do { \
13 	uint32 mod = (si->settings.logmask &  0xfffffff0) & MODULE_BIT; \
14 	uint32 lev = (si->settings.logmask & ~0xfffffff0) & level_bit; \
15 	if (mod && lev) nv_log args; \
16 } while (0)
17 
18 /*support functions*/
19 void delay(bigtime_t i);
20 void nv_log(char *format, ...);
21 
22 /*i2c maven functions*/
23 int i2c_maven_read(unsigned char address);
24 void i2c_maven_write(unsigned char address, unsigned char data);
25 status_t i2c_init(void);
26 status_t i2c_maven_probe(void);
27 
28 /*card info functions*/
29 status_t parse_pins(void);
30 void fake_pins(void);
31 void dump_pins(void);
32 
33 /* DAC functions */
34 bool nv_dac_crt_connected(void);
35 status_t nv_dac_mode(int,float);
36 status_t nv_dac_palette(uint8*,uint8*,uint8*);
37 status_t nv_dac_pix_pll_find(display_mode target,float * result,uint8 *,uint8 *,uint8 *, uint8);
38 status_t nv_dac_set_pix_pll(display_mode target);
39 status_t g400_dac_set_sys_pll(void);
40 
41 /* DAC2 functions */
42 bool nv_dac2_crt_connected(void);
43 status_t nv_dac2_mode(int,float);
44 status_t nv_dac2_palette(uint8*,uint8*,uint8*);
45 status_t nv_dac2_pix_pll_find(display_mode target,float * result,uint8 *,uint8 *,uint8 *, uint8);
46 status_t nv_dac2_set_pix_pll(display_mode target);
47 
48 /*MAVENTV functions*/
49 status_t g100_g400max_maventv_vid_pll_find(
50 	display_mode target, unsigned int * ht_new, unsigned int * ht_last_line,
51 	uint8 * m_result, uint8 * n_result, uint8 * p_result);
52 int maventv_init(display_mode target);
53 
54 /* CRTC1 functions */
55 status_t nv_crtc_validate_timing(
56 	uint16 *hd_e,uint16 *hs_s,uint16 *hs_e,uint16 *ht,
57 	uint16 *vd_e,uint16 *vs_s,uint16 *vs_e,uint16 *vt
58 );
59 status_t nv_crtc_set_timing(display_mode target);
60 status_t nv_crtc_depth(int mode);
61 status_t nv_crtc_set_display_start(uint32 startadd,uint8 bpp);
62 status_t nv_crtc_set_display_pitch(void);
63 
64 status_t nv_crtc_dpms(bool, bool, bool);
65 status_t nv_crtc_dpms_fetch(bool*, bool*, bool*);
66 status_t nv_crtc_mem_priority(uint8);
67 
68 status_t nv_crtc_cursor_init(void); /*Yes, cursor follows CRTC1 - not the DAC!*/
69 status_t nv_crtc_cursor_define(uint8*,uint8*);
70 status_t nv_crtc_cursor_position(uint16 x ,uint16 y);
71 status_t nv_crtc_cursor_show(void);
72 status_t nv_crtc_cursor_hide(void);
73 
74 /* CRTC2 functions */
75 status_t nv_crtc2_validate_timing(
76 	uint16 *hd_e,uint16 *hs_s,uint16 *hs_e,uint16 *ht,
77 	uint16 *vd_e,uint16 *vs_s,uint16 *vs_e,uint16 *vt
78 );
79 status_t nv_crtc2_set_timing(display_mode target);
80 status_t nv_crtc2_depth(int mode);
81 status_t nv_crtc2_set_display_start(uint32 startadd,uint8 bpp);
82 status_t nv_crtc2_set_display_pitch(void);
83 
84 status_t nv_crtc2_dpms(bool, bool, bool);
85 status_t nv_crtc2_dpms_fetch(bool*, bool*, bool*);
86 status_t nv_crtc2_mem_priority(uint8);
87 
88 status_t nv_crtc2_cursor_init(void); /*Yes, cursor follows CRTC1 - not the DAC!*/
89 status_t nv_crtc2_cursor_define(uint8*,uint8*);
90 status_t nv_crtc2_cursor_position(uint16 x ,uint16 y);
91 status_t nv_crtc2_cursor_show(void);
92 status_t nv_crtc2_cursor_hide(void);
93 
94 /*acceleration functions*/
95 status_t check_acc_capability(uint32 feature);
96 status_t nv_acc_init(void);
97 status_t nv_acc_setup_blit(void);
98 status_t nv_acc_blit(uint16,uint16,uint16, uint16,uint16,uint16 );
99 status_t nv_acc_setup_rectangle(uint32 color);
100 status_t nv_acc_rectangle(uint32 xs,uint32 xe,uint32 ys,uint32 yl);
101 status_t nv_acc_setup_rect_invert(void);
102 status_t nv_acc_rectangle_invert(uint32 xs,uint32 xe,uint32 ys,uint32 yl);
103 status_t nv_acc_transparent_blit(uint16,uint16,uint16, uint16,uint16,uint16, uint32);
104 status_t nv_acc_video_blit(uint16 xs,uint16 ys,uint16 ws, uint16 hs,
105 	uint16 xd,uint16 yd,uint16 wd,uint16 hd);
106 status_t nv_acc_wait_idle(void);
107 
108 /*backend scaler functions*/
109 status_t check_overlay_capability(uint32 feature);
110 status_t nv_bes_to_crtc(uint8 crtc);
111 status_t nv_bes_init(void);
112 status_t nv_configure_bes
113 	(const overlay_buffer *ob, const overlay_window *ow,const overlay_view *ov, int offset);
114 status_t nv_release_bes(void);
115 
116 /* I2C functions */
117 status_t i2c_sec_tv_adapter(void);
118 
119 /*driver structures and enums*/
120 enum{BPP8=0,BPP15=1,BPP16=2,BPP24=3,BPP32=4};
121 enum{DS_CRTC1DAC_CRTC2MAVEN, DS_CRTC1MAVEN_CRTC2DAC, DS_CRTC1CON1_CRTC2CON2, DS_CRTC1CON2_CRTC2CON1};
122