Initial DRI2 support.
[nouveau] / src / nv_proto.h
1 /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h,v 1.11 2004/03/20 01:52:16 mvojkovi Exp $ */
2
3 #ifndef __NV_PROTO_H__
4 #define __NV_PROTO_H__
5
6 /* in nv_accel_common.c */
7 Bool NVAccelCommonInit(ScrnInfoPtr pScrn);
8 Bool NVAccelGetCtxSurf2DFormatFromPixmap(PixmapPtr pPix, int *fmt_ret);
9 Bool NVAccelGetCtxSurf2DFormatFromPicture(PicturePtr pPix, int *fmt_ret);
10 PixmapPtr NVGetDrawablePixmap(DrawablePtr pDraw);
11 void NVAccelFree(NVPtr pNv);
12
13 /* in nv_driver.c */
14 Bool   NVI2CInit(ScrnInfoPtr pScrn);
15
16 /* in nv_dri.c */
17 Bool NVDRIScreenInit(ScrnInfoPtr pScrn);
18 Bool NVDRIFinishScreenInit(ScrnInfoPtr pScrn);
19 void NVDRICloseScreen(ScrnInfoPtr pScrn);
20 extern const char *drmSymbols[], *driSymbols[];
21 Bool NVDRIGetVersion(ScrnInfoPtr pScrn);
22
23 /* in nouveau_dri2.c */
24 Bool nouveau_dri2_init(ScreenPtr pScreen);
25 void nouveau_dri2_takedown(ScreenPtr pScreen);
26
27 /* in nv_dac.c */
28 Bool   NVDACInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
29 void   NVDACSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg,
30                  NVRegPtr nvReg, Bool saveFonts);
31 void   NVDACRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg,
32                     NVRegPtr nvReg, Bool restoreFonts);
33 void   NVDACLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
34                         LOCO *colors, VisualPtr pVisual );
35 Bool   NVDACi2cInit(ScrnInfoPtr pScrn);
36
37 /* in nouveau_xv.c */
38 void NVInitVideo(ScreenPtr);
39 void NVWaitVSync(ScrnInfoPtr pScrn, int crtc);
40 void NVSetPortDefaults (ScrnInfoPtr pScrn, NVPortPrivPtr pPriv);
41 unsigned int nv_window_belongs_to_crtc(ScrnInfoPtr, int, int, int, int);
42 void NVFreePortMemory(ScrnInfoPtr pScrn, NVPortPrivPtr pPriv);
43
44 /* in nv_setup.c */
45 void   RivaEnterLeave(ScrnInfoPtr pScrn, Bool enter);
46 void   NVCommonSetup(ScrnInfoPtr pScrn);
47
48 /* in nv_cursor.c */
49 Bool   NVCursorInit(ScreenPtr pScreen);
50 Bool NVCursorInitRandr12(ScreenPtr pScreen);
51 void nv_crtc_show_cursor(xf86CrtcPtr crtc);
52 void nv_crtc_hide_cursor(xf86CrtcPtr crtc);
53 void nv_crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y);
54 void nv_crtc_set_cursor_colors(xf86CrtcPtr crtc, int bg, int fg);
55 void nv_crtc_load_cursor_image(xf86CrtcPtr crtc, CARD8 *image);
56 void nv_crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image);
57
58 /* in nv_dma.c */
59 void  NVSync(ScrnInfoPtr pScrn);
60 Bool  NVInitDma(ScrnInfoPtr pScrn);
61
62 /* in nv_exa.c */
63 Bool NVExaInit(ScreenPtr pScreen);
64 Bool NVExaPixmapIsOnscreen(PixmapPtr pPixmap);
65
66 /* in nv_hw.c */
67 void NVCalcStateExt(ScrnInfoPtr,struct _riva_hw_state *,int,int,int,int,int,int);
68 void NVLoadStateExt(ScrnInfoPtr pScrn,struct _riva_hw_state *);
69 void NVUnloadStateExt(NVPtr,struct _riva_hw_state *);
70 void NVSetStartAddress(NVPtr,CARD32);
71
72 /* in nv_shadow.c */
73 void NVRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
74
75 /* in nv_bios.c */
76 unsigned int NVParseBios(ScrnInfoPtr pScrn);
77 void call_lvds_script(ScrnInfoPtr pScrn, struct dcb_entry *dcbent, int head, enum LVDS_script script, int pxclk);
78 void parse_lvds_manufacturer_table(ScrnInfoPtr pScrn, bios_t *bios, int pxclk);
79 void run_tmds_table(ScrnInfoPtr pScrn, struct dcb_entry *dcbent, int head, int pxclk);
80 int getMNP_single(ScrnInfoPtr pScrn, struct pll_lims *pll_lim, int clk, int *NM, int *log2P);
81 int getMNP_double(ScrnInfoPtr pScrn, struct pll_lims *pll_lim, int clk, int *NM1, int *NM2, int *log2P);
82 bool get_pll_limits(ScrnInfoPtr pScrn, uint32_t limit_match, struct pll_lims *pll_lim);
83
84 /* nv_crtc.c */
85 void NVCrtcSetBase(xf86CrtcPtr crtc, int x, int y);
86 void nv_crtc_init(ScrnInfoPtr pScrn, int crtc_num);
87 void NVCrtcLockUnlock(xf86CrtcPtr crtc, bool lock);
88
89 /* nv_output.c */
90 void nv_encoder_restore(ScrnInfoPtr pScrn, struct nouveau_encoder *nv_encoder);
91 void nv_encoder_save(ScrnInfoPtr pScrn, struct nouveau_encoder *nv_encoder);
92 void NvSetupOutputs(ScrnInfoPtr pScrn);
93
94 /* nv_hw.c */
95 uint32_t NVRead(NVPtr pNv, uint32_t reg);
96 void NVWrite(NVPtr pNv, uint32_t reg, uint32_t val);
97 uint32_t NVReadCRTC(NVPtr pNv, int head, uint32_t reg);
98 void NVWriteCRTC(NVPtr pNv, int head, uint32_t reg, uint32_t val);
99 uint32_t NVReadRAMDAC(NVPtr pNv, int head, uint32_t reg);
100 void NVWriteRAMDAC(NVPtr pNv, int head, uint32_t reg, uint32_t val);
101 uint8_t nv_read_tmds(NVPtr pNv, int or, int dl, uint8_t address);
102 int nv_get_digital_bound_head(NVPtr pNv, int or);
103 void nv_write_tmds(NVPtr pNv, int or, int dl, uint8_t address, uint8_t data);
104 void NVWriteVgaCrtc(NVPtr pNv, int head, uint8_t index, uint8_t value);
105 uint8_t NVReadVgaCrtc(NVPtr pNv, int head, uint8_t index);
106 void NVWriteVgaCrtc5758(NVPtr pNv, int head, uint8_t index, uint8_t value);
107 uint8_t NVReadVgaCrtc5758(NVPtr pNv, int head, uint8_t index);
108 uint8_t NVReadPRMVIO(NVPtr pNv, int head, uint32_t reg);
109 void NVWritePRMVIO(NVPtr pNv, int head, uint32_t reg, uint8_t value);
110 void NVWriteVgaSeq(NVPtr pNv, int head, uint8_t index, uint8_t value);
111 uint8_t NVReadVgaSeq(NVPtr pNv, int head, uint8_t index);
112 void NVWriteVgaGr(NVPtr pNv, int head, uint8_t index, uint8_t value);
113 uint8_t NVReadVgaGr(NVPtr pNv, int head, uint8_t index);
114 void NVSetEnablePalette(NVPtr pNv, int head, bool enable);
115 void NVWriteVgaAttr(NVPtr pNv, int head, uint8_t index, uint8_t value);
116 uint8_t NVReadVgaAttr(NVPtr pNv, int head, uint8_t index);
117 void NVVgaSeqReset(NVPtr pNv, int head, bool start);
118 void NVVgaProtect(NVPtr pNv, int head, bool protect);
119 void NVSetOwner(NVPtr pNv, int owner);
120 void NVLockVgaCrtc(NVPtr pNv, int head, bool lock);
121 void NVLockVgaCrtcs(NVPtr pNv, bool lock);
122 void NVBlankScreen(NVPtr pNv, int head, bool blank);
123 void nv_fix_nv40_hw_cursor(NVPtr pNv, int head);
124 void nv_show_cursor(NVPtr pNv, int head, bool show);
125 int nv_decode_pll_highregs(NVPtr pNv, uint32_t pll1, uint32_t pll2, bool force_single, int refclk);
126 void nv4_10UpdateArbitrationSettings(ScrnInfoPtr pScrn, int VClk, int bpp, uint8_t *burst, uint16_t *lwm);
127 void nv30UpdateArbitrationSettings(uint8_t *burst, uint16_t *lwm);
128 uint32_t nv_pitch_align(NVPtr pNv, uint32_t width, int bpp);
129 void nv_save_restore_vga_fonts(ScrnInfoPtr pScrn, bool save);
130
131 /* in nv_i2c.c */
132 Bool NV_I2CInit(ScrnInfoPtr pScrn, I2CBusPtr *bus_ptr, int i2c_reg, char *name);
133
134 /* in nv04_video_overlay.c */
135 void NV04PutOverlayImage(ScrnInfoPtr, struct nouveau_bo *, int, int, int,
136                          BoxPtr, int, int, int, int, short, short, short,
137                          short, short, short, RegionPtr clipBoxes);
138 int NV04SetOverlayPortAttribute(ScrnInfoPtr, Atom, INT32, pointer);
139 int NV04GetOverlayPortAttribute(ScrnInfoPtr, Atom, INT32 *, pointer);
140 void NV04StopOverlay(ScrnInfoPtr);
141
142 /* in nv04_video_blitter.c */
143 void NVPutBlitImage(ScrnInfoPtr, struct nouveau_bo *, int, int, int, BoxPtr,
144                     int, int, int, int, short, short, short, short, short,
145                     short, RegionPtr, PixmapPtr);
146 int NVSetBlitPortAttribute(ScrnInfoPtr, Atom, INT32, pointer);
147 int NVGetBlitPortAttribute(ScrnInfoPtr, Atom, INT32 *, pointer);
148 void NVStopBlitVideo(ScrnInfoPtr, pointer, Bool);
149
150 /* in nv10_exa.c */
151 Bool NVAccelInitNV10TCL(ScrnInfoPtr pScrn);
152 Bool NV10CheckComposite(int, PicturePtr, PicturePtr, PicturePtr);
153 Bool NV10PrepareComposite(int, PicturePtr, PicturePtr, PicturePtr,
154                                   PixmapPtr, PixmapPtr, PixmapPtr);
155 void NV10Composite(PixmapPtr, int, int, int, int, int, int, int, int);
156 void NV10DoneComposite(PixmapPtr);
157
158 /* in nv10_video_overlay.c */
159 void NV10PutOverlayImage(ScrnInfoPtr, struct nouveau_bo *, int, int, int, int,
160                          BoxPtr, int, int, int, int, short, short, short,
161                          short, short, short, RegionPtr clipBoxes);
162 int NV10SetOverlayPortAttribute(ScrnInfoPtr, Atom, INT32, pointer);
163 int NV10GetOverlayPortAttribute(ScrnInfoPtr, Atom, INT32 *, pointer);
164 void NV10StopOverlay(ScrnInfoPtr);
165 void NV10WriteOverlayParameters(ScrnInfoPtr);
166
167 /* in nv30_exa.c */
168 Bool NVAccelInitNV30TCL(ScrnInfoPtr pScrn);
169 Bool NV30EXACheckComposite(int, PicturePtr, PicturePtr, PicturePtr);
170 Bool NV30EXAPrepareComposite(int, PicturePtr, PicturePtr, PicturePtr,
171                                   PixmapPtr, PixmapPtr, PixmapPtr);
172 void NV30EXAComposite(PixmapPtr, int, int, int, int, int, int, int, int);
173 void NV30EXADoneComposite(PixmapPtr);
174
175 /* in nv30_video_texture.c */
176 int NV30PutTextureImage(ScrnInfoPtr, struct nouveau_bo *, int, int, int, int,
177                         BoxPtr, int, int, int, int, uint16_t, uint16_t,
178                         uint16_t, uint16_t, uint16_t, uint16_t,
179                         RegionPtr, PixmapPtr, NVPortPrivPtr);
180 void NV30StopTexturedVideo(ScrnInfoPtr, pointer, Bool);
181 int NV30GetTexturePortAttribute(ScrnInfoPtr, Atom, INT32 *, pointer);
182 int NV30SetTexturePortAttribute(ScrnInfoPtr, Atom, INT32, pointer);
183
184 /* in nv40_exa.c */
185 Bool NVAccelInitNV40TCL(ScrnInfoPtr pScrn);
186 Bool NV40EXACheckComposite(int, PicturePtr, PicturePtr, PicturePtr);
187 Bool NV40EXAPrepareComposite(int, PicturePtr, PicturePtr, PicturePtr,
188                                   PixmapPtr, PixmapPtr, PixmapPtr);
189 void NV40EXAComposite(PixmapPtr, int, int, int, int, int, int, int, int);
190 void NV40EXADoneComposite(PixmapPtr);
191
192 /* in nv40_video_texture.c */
193 int NV40PutTextureImage(ScrnInfoPtr, struct nouveau_bo *, int, int, int, int,
194                         BoxPtr, int, int, int, int, uint16_t, uint16_t,
195                         uint16_t, uint16_t, uint16_t, uint16_t,
196                         RegionPtr, PixmapPtr, NVPortPrivPtr);
197 void NV40StopTexturedVideo(ScrnInfoPtr, pointer, Bool);
198 int NV40GetTexturePortAttribute(ScrnInfoPtr, Atom, INT32 *, pointer);
199 int NV40SetTexturePortAttribute(ScrnInfoPtr, Atom, INT32, pointer);
200
201 /* in nv50_accel.c */
202 Bool NVAccelInitNV50TCL(ScrnInfoPtr pScrn);
203
204 /* in nv50_exa.c */
205 Bool NV50EXAPrepareSolid(PixmapPtr, int, Pixel, Pixel);
206 void NV50EXASolid(PixmapPtr, int, int, int, int);
207 void NV50EXADoneSolid(PixmapPtr);
208 Bool NV50EXAPrepareCopy(PixmapPtr, PixmapPtr, int, int, int, Pixel);
209 void NV50EXACopy(PixmapPtr, int, int, int, int, int, int);
210 void NV50EXADoneCopy(PixmapPtr);
211 Bool NV50EXACheckComposite(int, PicturePtr, PicturePtr, PicturePtr);
212 Bool NV50EXAPrepareComposite(int, PicturePtr, PicturePtr, PicturePtr,
213                                   PixmapPtr, PixmapPtr, PixmapPtr);
214 void NV50EXAComposite(PixmapPtr, int, int, int, int, int, int, int, int);
215 void NV50EXADoneComposite(PixmapPtr);
216 Bool NV50EXAUploadSIFC(const char *src, int src_pitch,
217                        PixmapPtr pdPix, int x, int y, int w, int h, int cpp);
218
219 /* in nv50_display.c */
220 Bool NV50DispPreInit(ScrnInfoPtr);
221 Bool NV50DispInit(ScrnInfoPtr);
222 void NV50DispShutdown(ScrnInfoPtr);
223
224 /* in nv50_cursor.c */
225 Bool NV50CursorInit(ScreenPtr);
226 Bool NV50CursorAcquire(ScrnInfoPtr);
227 void NV50CursorRelease(ScrnInfoPtr);
228
229 /* in nv50_crtc.c */
230 void NV50DisplayCommand(ScrnInfoPtr pScrn, uint32_t addr, uint32_t value);
231 void NV50CrtcCommand(nouveauCrtcPtr crtc, uint32_t addr, uint32_t value);
232 void NV50CrtcInit(ScrnInfoPtr pScrn);
233 void NV50CrtcDestroy(ScrnInfoPtr pScrn);
234
235 /* in nv50_output.c */
236 int NV50OrOffset(nouveauOutputPtr output);
237 void NV50OutputSetup(ScrnInfoPtr pScrn);
238 void NV50OutputDestroy(ScrnInfoPtr pScrn);
239
240 /* nv50_dac.c */
241 void NV50DacSetFunctionPointers(nouveauOutputPtr output);
242
243 /* nv50_sor.c */
244 void NV50SorSetFunctionPointers(nouveauOutputPtr output);
245 DisplayModePtr GetLVDSNativeMode(ScrnInfoPtr pScrn);
246
247 /* nv50_connector.c */
248 void NV50ConnectorInit(ScrnInfoPtr pScrn);
249 void NV50ConnectorDestroy(ScrnInfoPtr pScrn);
250
251 /* nv50_randr.c */
252 void nv50_crtc_init(ScrnInfoPtr pScrn, int crtc_num);
253 void nv50_output_create(ScrnInfoPtr pScrn);
254 int nv_scaling_mode_lookup(char *name, int size);
255
256 /* nv50_xv.c */
257 int nv50_xv_image_put(ScrnInfoPtr, struct nouveau_bo *, int, int, int, int,
258                       BoxPtr, int, int, int, int, uint16_t, uint16_t,
259                       uint16_t, uint16_t, uint16_t, uint16_t,
260                       RegionPtr, PixmapPtr, NVPortPrivPtr);
261 void nv50_xv_video_stop(ScrnInfoPtr, pointer, Bool);
262 int nv50_xv_port_attribute_set(ScrnInfoPtr, Atom, INT32, pointer);
263 int nv50_xv_port_attribute_get(ScrnInfoPtr, Atom, INT32 *, pointer);
264
265 /* To support EXA 2.0, 2.1 has this in the header */
266 #ifndef exaMoveInPixmap
267 extern void exaMoveInPixmap(PixmapPtr pPixmap);
268 #endif
269
270 #endif /* __NV_PROTO_H__ */
271