savage_driver.h revision 1473d951
1/*
2 * Copyright (C) 1994-2000 The XFree86 Project, Inc.  All Rights Reserved.
3 * Copyright (c) 2003-2006, X.Org Foundation
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
18 * COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 *
23 * Except as contained in this notice, the name of the copyright holder(s)
24 * and author(s) shall not be used in advertising or otherwise to promote
25 * the sale, use or other dealings in this Software without prior written
26 * authorization from the copyright holder(s) and author(s).
27 */
28
29#ifndef SAVAGE_DRIVER_H
30#define SAVAGE_DRIVER_H
31
32#include <stdio.h>
33#include <string.h>
34#include <math.h>
35
36#ifdef XSERVER_LIBPCIACCESS
37#include <pciaccess.h>
38#define VENDOR_ID(p)      (p)->vendor_id
39#define DEVICE_ID(p)      (p)->device_id
40#define SUBSYS_ID(p)      (p)->subdevice_id
41#define CHIP_REVISION(p)  (p)->revision
42#else
43#define VENDOR_ID(p)      (p)->vendor
44#define DEVICE_ID(p)      (p)->chipType
45#define SUBSYS_ID(p)      (p)->subsysCard
46#define CHIP_REVISION(p)  (p)->chipRev
47#endif
48
49#define MODE_24 24
50
51#include "compiler.h"
52#include "vgaHW.h"
53#include "xf86.h"
54#include "xf86Resources.h"
55#include "xf86Pci.h"
56#include "xf86PciInfo.h"
57#include "xf86_OSproc.h"
58#include "xf86Cursor.h"
59#include "mipointer.h"
60#include "micmap.h"
61#include "fb.h"
62#include "fboverlay.h"
63#include "xf86cmap.h"
64#include "vbe.h"
65#include "xaa.h"
66#include "exa.h"
67#include "xf86xv.h"
68
69#include "savage_regs.h"
70#include "savage_vbe.h"
71
72#ifdef XF86DRI
73#define _XF86DRI_SERVER_
74#include "savage_dripriv.h"
75#include "savage_dri.h"
76#include "dri.h"
77#include "GL/glxint.h"
78#include "xf86drm.h"
79
80/* Totals 2 Mbytes which equals 2^16 32-byte vertices divided among up
81 * to 32 clients. */
82#define SAVAGE_NUM_BUFFERS 32
83#define SAVAGE_BUFFER_SIZE (1 << 16) /* 64k */
84
85#define SAVAGE_CMDDMA_SIZE 0x100000 /* 1MB */
86
87#define SAVAGE_DEFAULT_AGP_MODE     1
88#define SAVAGE_MAX_AGP_MODE         4
89
90/* Buffer are aligned on 4096 byte boundaries.
91 */
92/*  this is used for backbuffer, depthbuffer, etc..*/
93/*          alignment                                      */
94
95#define SAVAGE_BUFFER_ALIGN	0x00000fff
96
97typedef struct _server{
98   int reserved_map_agpstart;
99   int reserved_map_idx;
100
101   int sarea_priv_offset;
102
103   int chipset;
104   int sgram;     /* seems no use */
105
106   unsigned int frontOffset;
107   unsigned int frontPitch;
108   unsigned int frontbufferSize;
109   unsigned int frontBitmapDesc;
110
111   unsigned int backOffset;
112   unsigned int backPitch;
113   unsigned int backbufferSize;
114   unsigned int backBitmapDesc;
115
116   unsigned int depthOffset;
117   unsigned int depthPitch;
118   unsigned int depthbufferSize;
119   unsigned int depthBitmapDesc;
120
121   unsigned int textureOffset;
122   int textureSize;
123   int logTextureGranularity;
124
125   drmRegion agp;
126
127   /* PCI mappings */
128   drmRegion aperture;
129   drmRegion registers;
130   drmRegion status;
131
132   /* AGP mappings */
133   drmRegion buffers;
134   drmRegion agpTextures;
135   int logAgpTextureGranularity;
136
137   /* command DMA */
138   drmRegion cmdDma;
139
140   /* XVideo through AGP */
141   drmRegion agpXVideo;
142} SAVAGEDRIServerPrivateRec, *SAVAGEDRIServerPrivatePtr;
143
144#endif
145
146typedef enum {
147    MT_NONE,
148    MT_CRT,
149    MT_LCD,
150    MT_DFP,
151    MT_TV
152} SavageMonitorType;
153
154typedef struct
155{
156    Bool HasSecondary;
157    Bool TvOn;
158    ScrnInfoPtr pSecondaryScrn;
159    ScrnInfoPtr pPrimaryScrn;
160
161} SavageEntRec, *SavageEntPtr;
162
163#define VGAIN8(addr) MMIO_IN8(psav->MapBase+0x8000, addr)
164#define VGAIN16(addr) MMIO_IN16(psav->MapBase+0x8000, addr)
165#define VGAIN(addr) MMIO_IN32(psav->MapBase+0x8000, addr)
166
167#define VGAOUT8(addr,val) MMIO_OUT8(psav->MapBase+0x8000, addr, val)
168#define VGAOUT16(addr,val) MMIO_OUT16(psav->MapBase+0x8000, addr, val)
169#define VGAOUT(addr,val) MMIO_OUT32(psav->MapBase+0x8000, addr, val)
170
171#define INREG8(addr) MMIO_IN8(psav->MapBase, addr)
172#define INREG16(addr) MMIO_IN16(psav->MapBase, addr)
173#define INREG32(addr) MMIO_IN32(psav->MapBase, addr)
174#define OUTREG8(addr,val) MMIO_OUT8(psav->MapBase, addr, val)
175#define OUTREG16(addr,val) MMIO_OUT16(psav->MapBase, addr, val)
176#define OUTREG32(addr,val) MMIO_OUT32(psav->MapBase, addr, val)
177#define INREG(addr) INREG32(addr)
178#define OUTREG(addr,val) OUTREG32(addr,val)
179
180#if X_BYTE_ORDER == X_LITTLE_ENDIAN
181#define B_O16(x)  (x)
182#define B_O32(x)  (x)
183#else
184#define B_O16(x)  ((((x) & 0xff) << 8) | (((x) & 0xff) >> 8))
185#define B_O32(x)  ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) \
186                  | (((x) & 0xff0000) >> 8) | (((x) & 0xff000000) >> 24))
187#endif
188#define L_ADD(x)  (B_O32(x) & 0xffff) + ((B_O32(x) >> 12) & 0xffff00)
189
190#define SAVAGEIOMAPSIZE	0x80000
191
192#define SAVAGE_CRT_ON	1
193#define SAVAGE_LCD_ON	2
194#define SAVAGE_TV_ON	4
195
196#define SAVAGE_DRIVER_NAME	"savage"
197#define SAVAGE_DRIVER_VERSION	PACKAGE_VERSION
198#define SAVAGE_VERSION_MAJOR	PACKAGE_VERSION_MAJOR
199#define SAVAGE_VERSION_MINOR	PACKAGE_VERSION_MINOR
200#define SAVAGE_PATCHLEVEL	PACKAGE_VERSION_PATCHLEVEL
201#define SAVAGE_VERSION	((SAVAGE_VERSION_MAJOR << 24) | \
202			 (SAVAGE_VERSION_MINOR << 16) | \
203			 SAVAGE_PATCHLEVEL)
204
205typedef struct _S3VMODEENTRY {
206   unsigned short Width;
207   unsigned short Height;
208   unsigned short VesaMode;
209   unsigned char RefreshCount;
210   unsigned char * RefreshRate;
211} SavageModeEntry, *SavageModeEntryPtr;
212
213
214typedef struct _S3VMODETABLE {
215   unsigned short NumModes;
216   SavageModeEntry Modes[1];
217} SavageModeTableRec, *SavageModeTablePtr;
218
219
220typedef struct {
221    unsigned int mode, refresh;
222    unsigned char SR08, SR0E, SR0F;
223    unsigned char SR10, SR11, SR12, SR13, SR15, SR18, SR1B, SR29, SR30;
224    unsigned char SR54[8];
225    unsigned char Clock;
226    unsigned char CR31, CR32, CR33, CR34, CR36, CR3A, CR3B, CR3C;
227    unsigned char CR40, CR41, CR42, CR43, CR45;
228    unsigned char CR50, CR51, CR53, CR55, CR58, CR5B, CR5D, CR5E;
229    unsigned char CR60, CR63, CR65, CR66, CR67, CR68, CR69, CR6D, CR6F;
230    unsigned char CR86, CR88;
231    unsigned char CR90, CR91, CRB0;
232    unsigned int  STREAMS[22];	/* yuck, streams regs */
233    unsigned int  MMPR0, MMPR1, MMPR2, MMPR3;
234} SavageRegRec, *SavageRegPtr;
235
236typedef  struct {
237    CARD32 redMask, greenMask, blueMask;
238    int redShift, greenShift, blueShift;
239} savageOverlayRec;
240
241/*  Tiling defines */
242#define TILE_SIZE_BYTE          2048   /* 0x800, 2K */
243#define TILE_SIZE_BYTE_2000     4096
244
245#define TILEHEIGHT_16BPP        16
246#define TILEHEIGHT_32BPP        16
247#define TILEHEIGHT              16      /* all 16 and 32bpp tiles are 16 lines high */
248#define TILEHEIGHT_2000         32      /* 32 lines on savage 2000 */
249
250#define TILEWIDTH_BYTES         128     /* 2048/TILEHEIGHT (** not for use w/8bpp tiling) */
251#define TILEWIDTH8BPP_BYTES     64      /* 2048/TILEHEIGHT_8BPP */
252#define TILEWIDTH_16BPP         64      /* TILEWIDTH_BYTES/2-BYTES-PER-PIXEL */
253#define TILEWIDTH_32BPP         32      /* TILEWIDTH_BYTES/4-BYTES-PER-PIXEL */
254
255/* Bitmap descriptor structures for BCI */
256typedef struct _HIGH {
257    unsigned short Stride;
258    unsigned char Bpp;
259    unsigned char ResBWTile;
260} HIGH;
261
262typedef struct _BMPDESC1 {
263    unsigned long Offset;
264    HIGH  HighPart;
265} BMPDESC1;
266
267typedef struct _BMPDESC2 {
268    unsigned long LoPart;
269    unsigned long HiPart;
270} BMPDESC2;
271
272typedef union _BMPDESC {
273    BMPDESC1 bd1;
274    BMPDESC2 bd2;
275} BMPDESC;
276
277typedef struct _StatInfo {
278    int     origMode;
279    int     pageCnt;
280    pointer statBuf;
281    int     realSeg;
282    int     realOff;
283} StatInfoRec,*StatInfoPtr;
284
285struct savage_region {
286#ifdef XSERVER_LIBPCIACCESS
287    pciaddr_t       base;
288    pciaddr_t       size;
289#else
290    unsigned long   base;
291    unsigned long   size;
292#endif
293    void          * memory;
294};
295
296typedef struct _Savage {
297    SavageRegRec	SavedReg;
298    SavageRegRec	ModeReg;
299    xf86CursorInfoPtr	CursorInfoRec;
300    Bool		ModeStructInit;
301    Bool		NeedSTREAMS;
302    Bool		STREAMSRunning;
303    int			Bpp, Bpl, ScissB;
304    unsigned		PlaneMask;
305    I2CBusPtr		I2C;
306    I2CBusPtr		DVI;
307    unsigned char       DDCPort;
308    unsigned char       I2CPort;
309
310    int			videoRambytes;
311    int			videoRamKbytes;
312    int			MemOffScreen;
313    int			CursorKByte;
314    int			endfb;
315
316    /* These are physical addresses. */
317    unsigned long	ShadowPhysical;
318
319    /* These are linear addresses. */
320    struct savage_region   MmioRegion;
321    struct savage_region   FbRegion;
322    struct savage_region   ApertureRegion;
323
324    unsigned char*	MapBase;
325    unsigned char*	BciMem;
326    unsigned char*	FBBase;
327    unsigned char*	ApertureMap;
328    unsigned char*	FBStart;
329    CARD32 volatile *	ShadowVirtual;
330
331    Bool		PrimaryVidMapped;
332    int			maxClock;
333    int			HorizScaleFactor;
334    int			MCLK, REFCLK, LCDclk;
335    double		refclk_fact;
336    int			GEResetCnt;
337
338    /* Here are all the Options */
339
340    OptionInfoPtr	Options;
341    Bool		IgnoreEDID;
342    Bool		ShowCache;
343    Bool		pci_burst;
344    Bool		NoPCIRetry;
345    Bool		fifo_conservative;
346    Bool		fifo_moderate;
347    Bool		fifo_aggressive;
348    Bool		hwcursor;
349    Bool		hwc_on;
350    Bool		NoAccel;
351    Bool		shadowFB;
352    Bool		UseBIOS;
353    int			rotate;
354    double		LCDClock;
355    Bool		ConfigShadowStatus; /* from the config */
356    Bool		ShadowStatus;       /* automatically enabled with DRI */
357    Bool		ForceShadowStatus;  /* true if explicitly set in conf */
358    Bool		CrtOnly;
359    Bool		TvOn;
360    Bool		PAL;
361    Bool		ForceInit;
362    int			iDevInfo;
363    int			iDevInfoPrim;
364
365    Bool		FPExpansion;
366    int			PanelX;		/* panel width */
367    int			PanelY;		/* panel height */
368    int			iResX;		/* crtc X display */
369    int			iResY;		/* crtc Y display */
370    int			XFactor;	/* overlay X factor */
371    int			YFactor;	/* overlay Y factor */
372    int			displayXoffset;	/* overlay X offset */
373    int			displayYoffset;	/* overlay Y offset */
374    int			XExp1;		/* expansion ratio in x */
375    int			XExp2;
376    int			YExp1;		/* expansion ratio in x */
377    int			YExp2;
378    int			cxScreen;
379    int			TVSizeX;
380    int			TVSizeY;
381
382    CloseScreenProcPtr	CloseScreen;
383#ifdef XSERVER_LIBPCIACCESS
384    struct pci_device * PciInfo;
385#else
386    pciVideoPtr		PciInfo;
387    PCITAG		PciTag;
388#endif
389    int			Chipset;
390    int			ChipId;
391    int			ChipRev;
392    vbeInfoPtr		pVbe;
393    int			EntityIndex;
394    int			ShadowCounter;
395    int			vgaIOBase;	/* 3b0 or 3d0 */
396
397    /* The various Savage wait handlers. */
398    int			(*WaitQueue)(struct _Savage *, int);
399    int			(*WaitIdle)(struct _Savage *);
400    int			(*WaitIdleEmpty)(struct _Savage *);
401
402    /* Support for shadowFB and rotation */
403    unsigned char *	ShadowPtr;
404    int			ShadowPitch;
405    void		(*PointerMoved)(int index, int x, int y);
406
407    /* support for EXA */
408    ExaDriverPtr        EXADriverPtr;
409    Bool		useEXA;
410    unsigned long	EXAendfb;
411    unsigned long 	pbd_offset;
412    unsigned long	sbd_offset;
413    unsigned long	pbd_high;
414    unsigned long	sbd_high;
415
416    /* Support for XAA acceleration */
417    XAAInfoRecPtr	AccelInfoRec;
418    xRectangle		Rect;
419    unsigned int	SavedBciCmd;
420    unsigned int	SavedFgColor;
421    unsigned int	SavedBgColor;
422    unsigned int	SavedSbdOffset;
423    unsigned int	SavedSbd;
424
425    SavageModeTablePtr	ModeTable;
426
427    /* Support for the Savage command overflow buffer. */
428    unsigned long	cobIndex;	/* size index */
429    unsigned long	cobSize;	/* size in bytes */
430    unsigned long	cobOffset;	/* offset in frame buffer */
431    unsigned long       bciThresholdLo; /* low and high thresholds for */
432    unsigned long       bciThresholdHi; /* shadow status update (32bit words) */
433    unsigned long	bciUsedMask;	/* BCI entries used mask */
434    unsigned int	eventStatusReg; /* Status register index that holds
435					 * event counter 0. */
436
437    /* Support for DGA */
438    int			numDGAModes;
439    DGAModePtr		DGAModes;
440    Bool		DGAactive;
441    int			DGAViewportStatus;
442
443    /* Support for XVideo */
444
445    unsigned int	videoFlags;
446    unsigned int	blendBase;
447    int			videoFourCC;
448    XF86VideoAdaptorPtr	adaptor;
449    int			VideoZoomMax;
450    int			dwBCIWait2DIdle;
451    XF86OffscreenImagePtr offscreenImages;
452
453    /* Support for Overlays */
454     unsigned char *	FBStart2nd;
455     savageOverlayRec	overlay;
456     int                 overlayDepth;
457     int			primStreamBpp;
458
459#ifdef XF86DRI
460    int 		LockHeld;
461    Bool 		directRenderingEnabled;
462    DRIInfoPtr 		pDRIInfo;
463    int 		drmFD;
464    int 		numVisualConfigs;
465    __GLXvisualConfig*	pVisualConfigs;
466    SAVAGEConfigPrivPtr 	pVisualConfigsPriv;
467    SAVAGEDRIServerPrivatePtr DRIServerInfo;
468    ScreenWakeupHandlerProcPtr coreWakeupHandler;
469    ScreenBlockHandlerProcPtr  coreBlockHandler;
470
471#if 0
472    Bool		haveQuiescense;
473    void		(*GetQuiescence)(ScrnInfoPtr pScrn);
474#endif
475
476    Bool		IsPCI;
477    Bool		AgpDMA;
478    Bool		VertexDMA;
479    Bool		CommandDMA;
480    int 		agpMode;
481    drmSize		agpSize;
482    FBLinearPtr		reserved;
483
484    unsigned int surfaceAllocation[7];
485    unsigned int xvmcContext;
486    unsigned int DRIrunning;
487    unsigned int hwmcOffset;
488    unsigned int hwmcSize;
489
490    Bool bDisableXvMC;
491
492    Bool AGPforXv;
493#endif
494
495    Bool disableCOB;
496    Bool BCIforXv;
497
498    /* Bitmap Descriptors for BCI */
499    BMPDESC GlobalBD;
500    BMPDESC PrimaryBD;
501    BMPDESC SecondBD;
502    /* do we disable tile mode by option? */
503    Bool bDisableTile;
504    /* if we enable tile,we only support tile under 16/32bpp */
505    Bool bTiled;
506    int  lDelta;
507    int  ulAperturePitch; /* aperture pitch */
508
509    /*
510     * cxMemory is number of pixels across screen width
511     * cyMemory is number of scanlines in available adapter memory.
512     *
513     * cxMemory * cyMemory is used to determine how much memory to
514     * allocate to our heap manager.  So make sure that any space at the
515     * end of video memory set aside at bInitializeHardware time is kept
516     * out of the cyMemory calculation.
517     */
518    int cxMemory,cyMemory;
519
520    StatInfoRec     StatInfo; /* save the SVGA state */
521
522    /* for dvi option */
523    Bool  dvi;
524
525    SavageMonitorType   DisplayType;
526    /* DuoView stuff */
527    Bool		HasCRTC2;     /* MX, IX, Supersavage */
528    Bool		IsSecondary;  /* second Screen */
529    Bool		IsPrimary;  /* first Screen */
530    EntityInfoPtr       pEnt;
531
532} SavageRec, *SavagePtr;
533
534/* Video flags. */
535
536#define VF_STREAMS_ON	0x0001
537
538#define SAVPTR(p)	((SavagePtr)((p)->driverPrivate))
539
540/* Make the names of these externals driver-unique */
541#define gpScrn savagegpScrn
542#define readdw savagereaddw
543#define readfb savagereadfb
544#define writedw savagewritedw
545#define writefb savagewritefb
546#define writescan savagewritescan
547
548/* add for support DRI */
549#ifdef XF86DRI
550
551#define SAVAGE_FRONT	0x1
552#define SAVAGE_BACK	0x2
553#define SAVAGE_DEPTH	0x4
554#define SAVAGE_STENCIL	0x8
555
556Bool SAVAGEDRIScreenInit( ScreenPtr pScreen );
557Bool SAVAGEInitMC(ScreenPtr pScreen);
558void SAVAGEDRICloseScreen( ScreenPtr pScreen );
559Bool SAVAGEDRIFinishScreenInit( ScreenPtr pScreen );
560
561Bool SAVAGELockUpdate( ScrnInfoPtr pScrn, drmLockFlags flags );
562
563#if 0
564void SAVAGEGetQuiescence( ScrnInfoPtr pScrn );
565void SAVAGEGetQuiescenceShared( ScrnInfoPtr pScrn );
566#endif
567
568void SAVAGESelectBuffer(ScrnInfoPtr pScrn, int which);
569
570#if 0
571Bool SAVAGECleanupDma(ScrnInfoPtr pScrn);
572Bool SAVAGEInitDma(ScrnInfoPtr pScrn, int prim_size);
573#endif
574
575#define SAVAGE_AGP_1X_MODE		0x01
576#define SAVAGE_AGP_2X_MODE		0x02
577#define SAVAGE_AGP_4X_MODE		0x04
578#define SAVAGE_AGP_MODE_MASK	0x07
579
580#endif
581
582
583/* Prototypes. */
584
585extern void SavageCommonCalcClock(long freq, int min_m, int min_n1,
586			int max_n1, int min_n2, int max_n2,
587			long freq_min, long freq_max,
588			unsigned char *mdiv, unsigned char *ndiv);
589void SavageAdjustFrame(int scrnIndex, int y, int x, int flags);
590void SavageDoAdjustFrame(ScrnInfoPtr pScrn, int y, int x, int crtc2);
591Bool SavageSwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
592
593/* In savage_cursor.c. */
594
595Bool SavageHWCursorInit(ScreenPtr pScreen);
596void SavageShowCursor(ScrnInfoPtr);
597void SavageHideCursor(ScrnInfoPtr);
598
599/* In savage_accel.c. */
600
601Bool SavageInitAccel(ScreenPtr);
602void SavageInitialize2DEngine(ScrnInfoPtr);
603void SavageSetGBD(ScrnInfoPtr);
604void SavageAccelSync(ScrnInfoPtr);
605/*int SavageHelpSolidROP(ScrnInfoPtr pScrn, int *fg, int pm, int *rop);*/
606
607/* XAA and EXA */
608Bool SavageXAAInit(ScreenPtr);
609Bool SavageEXAInit(ScreenPtr);
610
611/* In savage_i2c.c. */
612
613Bool SavageI2CInit(ScrnInfoPtr pScrn);
614
615/* In savage_shadow.c */
616
617void SavagePointerMoved(int index, int x, int y);
618void SavageRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
619void SavageRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
620void SavageRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
621void SavageRefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
622void SavageRefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
623
624/* In savage_vbe.c */
625
626void SavageSetTextMode( SavagePtr psav );
627void SavageSetVESAMode( SavagePtr psav, int n, int Refresh );
628void SavageSetPanelEnabled( SavagePtr psav, Bool active );
629void SavageFreeBIOSModeTable( SavagePtr psav, SavageModeTablePtr* ppTable );
630SavageModeTablePtr SavageGetBIOSModeTable( SavagePtr psav, int iDepth );
631ModeStatus SavageMatchBiosMode(ScrnInfoPtr pScrn,int width,int height,int refresh,
632                              unsigned int *vesaMode,unsigned int *newRefresh);
633
634unsigned short SavageGetBIOSModes(
635    SavagePtr psav,
636    int iDepth,
637    SavageModeEntryPtr s3vModeTable );
638
639/* In savage_video.c */
640
641void SavageInitVideo( ScreenPtr pScreen );
642
643/* In savage_streams.c */
644
645void SavageStreamsOn(ScrnInfoPtr pScrn);
646void SavageStreamsOff(ScrnInfoPtr pScrn);
647void SavageInitSecondaryStream(ScrnInfoPtr pScrn);
648void SavageInitStreamsOld(ScrnInfoPtr pScrn);
649void SavageInitStreamsNew(ScrnInfoPtr pScrn);
650void SavageInitStreams2000(ScrnInfoPtr pScrn);
651
652
653#if (MODE_24 == 32)
654# define  BYTES_PP24 4
655#else
656# define BYTES_PP24 3
657#endif
658
659
660#define DEPTH_BPP(depth) (depth == 24 ? (BYTES_PP24 << 3) : (depth + 7) & ~0x7)
661#define DEPTH_2ND(pScrn) (pScrn->depth > 8 ? pScrn->depth\
662                              : SAVPTR(pScrn)->overlayDepth)
663
664#endif /* SAVAGE_DRIVER_H */
665
666