xref: /haiku/src/add-ons/accelerants/nvidia/engine/nv_proto.h (revision 67bce78b48ed6d01b5a8eef89f5694c372b7e0a1)
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 get_panel_modelines(display_mode *p1, display_mode *p2, bool *pan1, bool *pan2);
31 void fake_pins(void);
32 void dump_pins(void);
33 
34 /* DAC functions */
35 bool nv_dac_crt_connected(void);
36 status_t nv_dac_mode(int,float);
37 status_t nv_dac_palette(uint8*,uint8*,uint8*);
38 status_t nv_dac_pix_pll_find(display_mode target,float * result,uint8 *,uint8 *,uint8 *, uint8);
39 status_t nv_dac_set_pix_pll(display_mode target);
40 status_t g400_dac_set_sys_pll(void);
41 
42 /* DAC2 functions */
43 bool nv_dac2_crt_connected(void);
44 status_t nv_dac2_mode(int,float);
45 status_t nv_dac2_palette(uint8*,uint8*,uint8*);
46 status_t nv_dac2_pix_pll_find(display_mode target,float * result,uint8 *,uint8 *,uint8 *, uint8);
47 status_t nv_dac2_set_pix_pll(display_mode target);
48 
49 /*MAVENTV functions*/
50 status_t g100_g400max_maventv_vid_pll_find(
51 	display_mode target, unsigned int * ht_new, unsigned int * ht_last_line,
52 	uint8 * m_result, uint8 * n_result, uint8 * p_result);
53 int maventv_init(display_mode target);
54 
55 /* CRTC1 functions */
56 status_t nv_crtc_validate_timing(
57 	uint16 *hd_e,uint16 *hs_s,uint16 *hs_e,uint16 *ht,
58 	uint16 *vd_e,uint16 *vs_s,uint16 *vs_e,uint16 *vt
59 );
60 status_t nv_crtc_set_timing(display_mode target);
61 status_t nv_crtc_depth(int mode);
62 status_t nv_crtc_set_display_start(uint32 startadd,uint8 bpp);
63 status_t nv_crtc_set_display_pitch(void);
64 
65 status_t nv_crtc_dpms(bool, bool, bool);
66 status_t nv_crtc_dpms_fetch(bool*, bool*, bool*);
67 status_t nv_crtc_mem_priority(uint8);
68 
69 status_t nv_crtc_cursor_init(void); /*Yes, cursor follows CRTC1 - not the DAC!*/
70 status_t nv_crtc_cursor_define(uint8*,uint8*);
71 status_t nv_crtc_cursor_position(uint16 x ,uint16 y);
72 status_t nv_crtc_cursor_show(void);
73 status_t nv_crtc_cursor_hide(void);
74 
75 /* CRTC2 functions */
76 status_t nv_crtc2_validate_timing(
77 	uint16 *hd_e,uint16 *hs_s,uint16 *hs_e,uint16 *ht,
78 	uint16 *vd_e,uint16 *vs_s,uint16 *vs_e,uint16 *vt
79 );
80 status_t nv_crtc2_set_timing(display_mode target);
81 status_t nv_crtc2_depth(int mode);
82 status_t nv_crtc2_set_display_start(uint32 startadd,uint8 bpp);
83 status_t nv_crtc2_set_display_pitch(void);
84 
85 status_t nv_crtc2_dpms(bool, bool, bool);
86 status_t nv_crtc2_dpms_fetch(bool*, bool*, bool*);
87 status_t nv_crtc2_mem_priority(uint8);
88 
89 status_t nv_crtc2_cursor_init(void); /*Yes, cursor follows CRTC1 - not the DAC!*/
90 status_t nv_crtc2_cursor_define(uint8*,uint8*);
91 status_t nv_crtc2_cursor_position(uint16 x ,uint16 y);
92 status_t nv_crtc2_cursor_show(void);
93 status_t nv_crtc2_cursor_hide(void);
94 
95 /*acceleration functions*/
96 status_t check_acc_capability(uint32 feature);
97 status_t nv_acc_init(void);
98 status_t nv_acc_setup_blit(void);
99 status_t nv_acc_blit(uint16,uint16,uint16, uint16,uint16,uint16 );
100 status_t nv_acc_setup_rectangle(uint32 color);
101 status_t nv_acc_rectangle(uint32 xs,uint32 xe,uint32 ys,uint32 yl);
102 status_t nv_acc_setup_rect_invert(void);
103 status_t nv_acc_rectangle_invert(uint32 xs,uint32 xe,uint32 ys,uint32 yl);
104 status_t nv_acc_transparent_blit(uint16,uint16,uint16, uint16,uint16,uint16, uint32);
105 status_t nv_acc_video_blit(uint16 xs,uint16 ys,uint16 ws, uint16 hs,
106 	uint16 xd,uint16 yd,uint16 wd,uint16 hd);
107 status_t nv_acc_wait_idle(void);
108 
109 /*backend scaler functions*/
110 status_t check_overlay_capability(uint32 feature);
111 status_t nv_bes_to_crtc(uint8 crtc);
112 status_t nv_bes_init(void);
113 status_t nv_configure_bes
114 	(const overlay_buffer *ob, const overlay_window *ow,const overlay_view *ov, int offset);
115 status_t nv_release_bes(void);
116 
117 /* I2C functions */
118 status_t i2c_sec_tv_adapter(void);
119 
120 /*driver structures and enums*/
121 enum{BPP8=0,BPP15=1,BPP16=2,BPP24=3,BPP32=4};
122 enum{DS_CRTC1DAC_CRTC2MAVEN, DS_CRTC1MAVEN_CRTC2DAC, DS_CRTC1CON1_CRTC2CON2, DS_CRTC1CON2_CRTC2CON1};
123