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