xref: /haiku/src/add-ons/accelerants/nvidia/engine/nv_proto.h (revision 64c14e7e31dcceda9462eff951d5dc8f614791c9)
155ec61f4Sshatty /*general card functions*/
25aa72126Sshatty status_t nv_general_powerup(void);
35aa72126Sshatty status_t nv_set_cas_latency(void);
430f76422SRudolf Cornelissen void setup_virtualized_heads(bool);
5*64c14e7eSRudolf Cornelissen void set_crtc_owner(bool);
60669fe20SRudolf Cornelissen status_t nv_general_output_select(bool);
706f4c439SRudolf Cornelissen status_t nv_general_head_select(bool);
85aa72126Sshatty status_t nv_general_wait_retrace(void);
905ed3229SRudolf Cornelissen status_t nv_general_validate_pic_size (display_mode *target, uint32 *bytes_per_row, bool *acc_mode);
1055ec61f4Sshatty 
1155ec61f4Sshatty /* apsed: logging macros */
1255ec61f4Sshatty #define MSG(args) do { /* if needed or si->settings with si NULL */ \
1355ec61f4Sshatty 	nv_log args; \
1455ec61f4Sshatty } while (0)
1555ec61f4Sshatty #define LOG(level_bit, args) do { \
1655ec61f4Sshatty 	uint32 mod = (si->settings.logmask &  0xfffffff0) & MODULE_BIT; \
1755ec61f4Sshatty 	uint32 lev = (si->settings.logmask & ~0xfffffff0) & level_bit; \
1855ec61f4Sshatty 	if (mod && lev) nv_log args; \
1955ec61f4Sshatty } while (0)
2055ec61f4Sshatty 
2155ec61f4Sshatty /*support functions*/
2255ec61f4Sshatty void delay(bigtime_t i);
2355ec61f4Sshatty void nv_log(char *format, ...);
2455ec61f4Sshatty 
2555ec61f4Sshatty /*i2c maven functions*/
2655ec61f4Sshatty int i2c_maven_read(unsigned char address);
2755ec61f4Sshatty void i2c_maven_write(unsigned char address, unsigned char data);
2855ec61f4Sshatty status_t i2c_init(void);
2955ec61f4Sshatty status_t i2c_maven_probe(void);
3055ec61f4Sshatty 
3155ec61f4Sshatty /*card info functions*/
3255ec61f4Sshatty status_t parse_pins(void);
339fd63d6dSRudolf Cornelissen void get_panel_modelines(display_mode *p1, display_mode *p2, bool *pan1, bool *pan2);
3455ec61f4Sshatty void fake_pins(void);
3555ec61f4Sshatty void dump_pins(void);
3655ec61f4Sshatty 
3755ec61f4Sshatty /* DAC functions */
389f21ce69SRudolf Cornelissen bool nv_dac_crt_connected(void);
3955ec61f4Sshatty status_t nv_dac_mode(int,float);
4055ec61f4Sshatty status_t nv_dac_palette(uint8*,uint8*,uint8*);
4155ec61f4Sshatty status_t nv_dac_pix_pll_find(display_mode target,float * result,uint8 *,uint8 *,uint8 *, uint8);
4255ec61f4Sshatty status_t nv_dac_set_pix_pll(display_mode target);
435aa72126Sshatty status_t g400_dac_set_sys_pll(void);
4455ec61f4Sshatty 
45a3b9d212SRudolf Cornelissen /* DAC2 functions */
469f21ce69SRudolf Cornelissen bool nv_dac2_crt_connected(void);
47a3b9d212SRudolf Cornelissen status_t nv_dac2_mode(int,float);
48a3b9d212SRudolf Cornelissen status_t nv_dac2_palette(uint8*,uint8*,uint8*);
49a3b9d212SRudolf Cornelissen status_t nv_dac2_pix_pll_find(display_mode target,float * result,uint8 *,uint8 *,uint8 *, uint8);
50a3b9d212SRudolf Cornelissen status_t nv_dac2_set_pix_pll(display_mode target);
5155ec61f4Sshatty 
5255ec61f4Sshatty /*MAVENTV functions*/
5355ec61f4Sshatty status_t g100_g400max_maventv_vid_pll_find(
5455ec61f4Sshatty 	display_mode target, unsigned int * ht_new, unsigned int * ht_last_line,
5555ec61f4Sshatty 	uint8 * m_result, uint8 * n_result, uint8 * p_result);
5655ec61f4Sshatty int maventv_init(display_mode target);
5755ec61f4Sshatty 
5855ec61f4Sshatty /* CRTC1 functions */
5955ec61f4Sshatty status_t nv_crtc_validate_timing(
6055ec61f4Sshatty 	uint16 *hd_e,uint16 *hs_s,uint16 *hs_e,uint16 *ht,
6155ec61f4Sshatty 	uint16 *vd_e,uint16 *vs_s,uint16 *vs_e,uint16 *vt
6255ec61f4Sshatty );
6355ec61f4Sshatty status_t nv_crtc_set_timing(display_mode target);
6455ec61f4Sshatty status_t nv_crtc_depth(int mode);
6555ec61f4Sshatty status_t nv_crtc_set_display_start(uint32 startadd,uint8 bpp);
665aa72126Sshatty status_t nv_crtc_set_display_pitch(void);
6755ec61f4Sshatty 
6855ec61f4Sshatty status_t nv_crtc_dpms(bool, bool, bool);
6955ec61f4Sshatty status_t nv_crtc_dpms_fetch(bool*, bool*, bool*);
7055ec61f4Sshatty status_t nv_crtc_mem_priority(uint8);
7155ec61f4Sshatty 
725aa72126Sshatty status_t nv_crtc_cursor_init(void); /*Yes, cursor follows CRTC1 - not the DAC!*/
7355ec61f4Sshatty status_t nv_crtc_cursor_define(uint8*,uint8*);
7455ec61f4Sshatty status_t nv_crtc_cursor_position(uint16 x ,uint16 y);
755aa72126Sshatty status_t nv_crtc_cursor_show(void);
765aa72126Sshatty status_t nv_crtc_cursor_hide(void);
7755ec61f4Sshatty 
7855ec61f4Sshatty /* CRTC2 functions */
79ff50d0d1SRudolf Cornelissen status_t nv_crtc2_validate_timing(
80ff50d0d1SRudolf Cornelissen 	uint16 *hd_e,uint16 *hs_s,uint16 *hs_e,uint16 *ht,
81ff50d0d1SRudolf Cornelissen 	uint16 *vd_e,uint16 *vs_s,uint16 *vs_e,uint16 *vt
82ff50d0d1SRudolf Cornelissen );
83ff50d0d1SRudolf Cornelissen status_t nv_crtc2_set_timing(display_mode target);
84ff50d0d1SRudolf Cornelissen status_t nv_crtc2_depth(int mode);
85ff50d0d1SRudolf Cornelissen status_t nv_crtc2_set_display_start(uint32 startadd,uint8 bpp);
86ff50d0d1SRudolf Cornelissen status_t nv_crtc2_set_display_pitch(void);
8755ec61f4Sshatty 
88ff50d0d1SRudolf Cornelissen status_t nv_crtc2_dpms(bool, bool, bool);
89ff50d0d1SRudolf Cornelissen status_t nv_crtc2_dpms_fetch(bool*, bool*, bool*);
90ff50d0d1SRudolf Cornelissen status_t nv_crtc2_mem_priority(uint8);
91ff50d0d1SRudolf Cornelissen 
92ff50d0d1SRudolf Cornelissen status_t nv_crtc2_cursor_init(void); /*Yes, cursor follows CRTC1 - not the DAC!*/
93ff50d0d1SRudolf Cornelissen status_t nv_crtc2_cursor_define(uint8*,uint8*);
94ff50d0d1SRudolf Cornelissen status_t nv_crtc2_cursor_position(uint16 x ,uint16 y);
95ff50d0d1SRudolf Cornelissen status_t nv_crtc2_cursor_show(void);
96ff50d0d1SRudolf Cornelissen status_t nv_crtc2_cursor_hide(void);
9755ec61f4Sshatty 
9855ec61f4Sshatty /*acceleration functions*/
9955ec61f4Sshatty status_t check_acc_capability(uint32 feature);
1005aa72126Sshatty status_t nv_acc_init(void);
1015aa72126Sshatty status_t nv_acc_setup_blit(void);
10255ec61f4Sshatty status_t nv_acc_blit(uint16,uint16,uint16, uint16,uint16,uint16 );
103b4c44701Sshatty status_t nv_acc_setup_rectangle(uint32 color);
104b4c44701Sshatty status_t nv_acc_rectangle(uint32 xs,uint32 xe,uint32 ys,uint32 yl);
1055aa72126Sshatty status_t nv_acc_setup_rect_invert(void);
106b4c44701Sshatty status_t nv_acc_rectangle_invert(uint32 xs,uint32 xe,uint32 ys,uint32 yl);
10755ec61f4Sshatty status_t nv_acc_transparent_blit(uint16,uint16,uint16, uint16,uint16,uint16, uint32);
10855ec61f4Sshatty status_t nv_acc_video_blit(uint16 xs,uint16 ys,uint16 ws, uint16 hs,
10955ec61f4Sshatty 	uint16 xd,uint16 yd,uint16 wd,uint16 hd);
1105aa72126Sshatty status_t nv_acc_wait_idle(void);
11155ec61f4Sshatty 
11255ec61f4Sshatty /*backend scaler functions*/
11355ec61f4Sshatty status_t check_overlay_capability(uint32 feature);
11430f76422SRudolf Cornelissen status_t nv_bes_to_crtc(bool crtc);
1155aa72126Sshatty status_t nv_bes_init(void);
11655ec61f4Sshatty status_t nv_configure_bes
11755ec61f4Sshatty 	(const overlay_buffer *ob, const overlay_window *ow,const overlay_view *ov, int offset);
1185aa72126Sshatty status_t nv_release_bes(void);
11955ec61f4Sshatty 
12055ec61f4Sshatty /* I2C functions */
1215aa72126Sshatty status_t i2c_sec_tv_adapter(void);
12255ec61f4Sshatty 
12355ec61f4Sshatty /*driver structures and enums*/
124e68c7d96SRudolf Cornelissen enum{BPP8=0,BPP15=1,BPP16=2,BPP24=3,BPP32=4};
12555ec61f4Sshatty enum{DS_CRTC1DAC_CRTC2MAVEN, DS_CRTC1MAVEN_CRTC2DAC, DS_CRTC1CON1_CRTC2CON2, DS_CRTC1CON2_CRTC2CON1};
126