Check in the voodoo driver subtree

This commit is contained in:
alan
2004-06-24 16:34:25 +00:00
commit 65f9bc5c20
7 changed files with 2857 additions and 0 deletions

56
README Normal file
View File

@@ -0,0 +1,56 @@
Quick Voodoo/Voodoo2 Crash Course (mostly Alan's notes to save looking
stuff up in the docs all the time)
Voodoo and Voodoo 2 appear as multimedia devices. They may be on a "dual
function" board in which case we should not 'borrow' the Voodoo as we will
blank the main video card. That is reported in the PCI config space.
Voodoo/Voodoo2 hardware may not always be initialized by the host OS because
it is not video.
The voodoo memory is split into two pools. A 1-4Mb pool holds the frame
buffer, an optional second buffer, zbuffers, and alpha. A second 2-8Mb
memory area holds all the textures.
Texture ram is directly writable but not important for the current 2D
driver. Video RAM is 16bit depth and tiled. The view of the video memory
area is "magic", it doesn't contain a mapping of the video RAM into PCI
space but contains pixel poking functionality.
The frame buffer always appears untiled and 1024 pixels wide. For write
there are some 16 different write modes including 24/32bit. The hardware
does not support 24/32bit - these are provided for software rendering
fallback. Read back is always 16bit. Endian conversion is hardware. Byte
aligned access is not supported, only word aligned. Also watch how you
access data - you can't access out of frame buffer space and if you get
the control bits wrong you also get zbuffered, fogged and other fun.
LFB writes have depth and alpha if you want.
The real hardware is RGB565, how it sets stuff up internally is out of
our hands - which means X memory alloc/pixmap cache is a little
constrained.
[IDEA: Should we put the mouse and framebuffer at different Z values so
that we don't have to erase it to draw under it - less flicker]
Acceleration:
All Voodoo
Fast Fill - Solid 2D rectangle fill
(Also depth buffer clear for 3D)
Supports a constant alpha option
Requires a running 3D engine
Voodoo2 and later
Screen to screen blit
CPU to screen blit
Ultra fast fill to some alignments
Monochrome to colour expansion (cpu to screen only)
(and they finally made the 2D and 3D state independant
if someone ever gets drunk enough to do DRI...)
Colour conversion on blit
Dither
Chroma testing (src/dst) and selection of op by colour
raster ops are the usual 16 suspects
Other bits supported
CLUT Gamma correction

35
TODO Normal file
View File

@@ -0,0 +1,35 @@
DONE
Basic video setup
ShadowFB buffering
DGA
Voodoo2 2D accelerations
Render acceleration
Debugged 24bpp shadowFB
TODO
Rotation
FIFO level handling code maybe needed for heavy 2D
Hardware Gamma correction
Proper DPMS for Voodoo2
DRI
DRI thoughts:
Figure out out to use YAB textures for Xv
X runs on the front buffer
DRI draws on the backbuffer
2D engine can do the screen to screen blits
Backbuffer allocation is problematic as memory is short. One way
might be to allocate those rectangles that are visible only ?
For voodoo1 DRI is somewhat harder but Voodoo2like with software fallback
except fullscreen would work 8)
Random Ramblings:
The right way to write a Voodoo1 X server is to use shadow buffers for
each visible window area and dump them into texture buffers then composite
the textures using the 3D engine. XFree86 alas doesn't think that way.
Maybe Keith's server can be persuaded to do so some day. Maybe I should
just buy a better video card.

72
man/voodoo.man Normal file
View File

@@ -0,0 +1,72 @@
.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/voodoo/voodoo.man,v 1.0 2004/02/11 23:10:13 alan Exp $
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
.TH VOODOO __drivermansuffix__ __vendorversion__
.SH NAME
voodoo \- Voodoo video driver
.SH SYNOPSIS
.nf
.B "Section \*qDevice\*q"
.BI " Identifier \*q" devname \*q
.B " Driver \*qvoodoo\*q"
\ \ ...
.B EndSection
.fi
.SH DESCRIPTION
.B voodoo
is an XFree86 driver for Voodoo 1 and Voodoo 2 series video adapters.
On the Voodoo 1 the driver uses a shadow buffer in system memory as
the video adapter has only 3D acceleration. Selected portions of the shadow
framebuffer are copied out to the Voodoo board at the right time. Because
of this, the speed of the driver is very dependent on the CPU. Processors
nowdays are actually rather fast at moving data so we get very good speed
anyway as the shadow framebuffer is in cached RAM.
.PP
The Voodoo2 has 16bpp acceleration and the driver provides accelerated
versions of most operations except angled lines and stipples. Accelerated
alpha blending with the Render extension is also supported as is DGA.
.PP
This driver supports 16bpp modes currently. The video hardware supports
image conversion from 24bpp to 16bpp but the hardware is 16bpp only.
.PP
The Voodoo 1 series cards can go up to 800x600 resolution while the
Voodoo 2 can reach 1024x768 providing it has at least 2Mb of frame
buffer memory. 1024x768 2D mode does not require two cards configured in
scan-line interleave mode (SLI).
.PP
Multihead and Xinerama configurations are supported. SLI configurations will
be treated as multiple video cards.
.PP
Limited support for DPMS screen saving is available. The "standby" and
"suspend" modes are just painting the screen black. The "off" mode turns
the Voodoo board off and thus works correctly.
.PP
This driver does not support a virtual screen size different from the
display size. This is a hardware limitation. 3D rendering is also not
supported.
.SH CONFIGURATION DETAILS
Please refer to XF86Config(__filemansuffix__) for general configuration
details. This section only covers configuration details specific to this
driver.
.PP
The following driver
.B Options
are supported:
.TP
.BI "Option \*qShadowFB\*q \*q" boolean \*q
Enables a shadow buffer in main memory. This turns off acceleration but for
otherwise unaccelerated operations can improve performance materially.
Default: off for voodoo2, on for voodoo1.
.TP
.BI "Option \*qNoAccel\*q \*q" boolean \*q
Disables acceleration if set. Unless debugging this option should only
be set if ShadowFB is enabled.
Default: off for voodoo2, on for voodoo1.
.SH "BUGS"
The driver interacts badly with the
sstfb frame buffer driver as there is insufficient information to restore
the chip to its previous state.
.SH "SEE ALSO"
XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__)
.SH AUTHORS
Authors: Alan Cox, Ghozlane Toumi, Henrik Harmsen.

109
src/voodoo.h Normal file
View File

@@ -0,0 +1,109 @@
typedef struct {
CARD32 m;
CARD32 n;
CARD32 p;
} PLLClock;
typedef struct {
CARD8 * ShadowPtr; /* Shadow buffer */
CARD32 ShadowPitch;
CloseScreenProcPtr CloseScreen; /* Wrapped Close */
XAAInfoRecPtr AccelInfoRec; /* Cached Accel rec for close */
Bool Blanked;
Bool OnAtExit;
EntityInfoPtr pEnt;
OptionInfoPtr Options;
Bool Voodoo2; /* Set if Voodoo2 */
pciVideoPtr PciInfo; /* PCI data */
PCITAG PciTag;
CARD32 PhysBase;
CARD32 Width; /* Current width */
CARD32 Height; /* Current height */
CARD32 FullHeight; /* Height including pixmap cache */
CARD32 Tiles; /* 32 tile count */
int BlitDirX; /* Cache blitter direction */
int BlitDirY; /* Cache blitter direction */
CARD32 lfbMode; /* Cached lfbMode value */
CARD32 alpha; /* Cached alpha reg for sw blit */
CARD32 alphaPitch; /* Software render blit state */
int alphaType;
CARD8 *alphaPtr;
CARD32 alphaC;
CARD32 alphaW;
CARD32 alphaH;
CARD32 texPitch;
int texType;
CARD8 *texPtr;
CARD32 texW;
CARD32 texH;
int ShadowFB; /* Using shadow FB */
int Accel; /* Using acceleration */
CARD8 * MMIO; /* MMIO base */
CARD8 * FBBase; /* Virtual FB base */
CARD32 Pitch; /* Pitch of FB */
DGAModePtr pDGAMode; /* DGA mode */
int nDGAMode;
int DAC;
#define DAC_ID_ATT 1
#define DAC_ID_TI 2
#define DAC_ID_ICS 3
#define DAC_UNKNOWN 0
CARD32 MaxClock;
PLLClock vClock;
PLLClock gClock;
unsigned char LineBuffer[1028]; /* Draw buffer */
unsigned char *LinePtr; /* To keep XAA amused */
} VoodooRec, *VoodooPtr;
#define TRUE 1
#define FALSE 0
/* Card-specific driver information */
#define VoodooPTR(p) ((VoodooPtr)((p)->driverPrivate))
#define VERSION 4000
#define VOODOO_NAME "Voodoo"
#define VOODOO_DRIVER_NAME "voodoo"
#define VOODOO_MAJOR_VERSION 1
#define VOODOO_MINOR_VERSION 0
#define VOODOO_PATCHLEVEL 0
#define PCI_CHIP_VOODOO1 0x0001
#define PCI_CHIP_VOODOO2 0x0002
/*
* Hardware functions
*/
extern void VoodooClear(VoodooPtr pVoo);
extern void VoodooCopy16(VoodooPtr pVoo, CARD32 x1, CARD32 y1, CARD32 w, CARD32 h, CARD32 spitch, unsigned char *src);
extern void VoodooCopy24(VoodooPtr pVoo, CARD32 x1, CARD32 y1, CARD32 w, CARD32 h, CARD32 spitch, unsigned char *src);
extern int VoodooHardwareInit(VoodooPtr pVoo);
extern int VoodooMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
extern void VoodooBlank(VoodooPtr pVoo);
extern int VoodooMemorySize(VoodooPtr pVoo);
extern void Voodoo2XAAInit(ScreenPtr pScreen);
extern void VoodooSync(ScrnInfoPtr pScrn);
extern void VoodooReadBank(ScreenPtr pScreen, int bank);
extern void VoodooWriteBank(ScreenPtr pScreen, int bank);
extern void VoodooReadBank(ScreenPtr pScreen, int bank);
/*
* DGA
*/
extern Bool VoodooDGAInit(ScrnInfoPtr pScrn, ScreenPtr pScreen);

184
src/voodoo_dga.c Normal file
View File

@@ -0,0 +1,184 @@
/*
* XFree86 driver for the Voodoo 2 using native X support and no
* Glide2. This is done for two reasons, firstly Glide2 is not portable
* to other than x86_32 which is becoming an issue, and secondly to get
* accelerations that Glide does not expose. The Voodoo 2 hardware has
* bit blit (screen->screen, cpu->screen), some colour expansion and
* also alpha (so could do hw render even!). Also can in theory use
* texture ram and engine to do arbitary Xv support as we have
* colour match on the 2D blit (ie 3D blit to back, 2D blit to front)
* along with alpha on the Xv 8) and with some care rotation of Xv.
*
* Alan Cox <alan@redhat.com>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the names of Red Hat, Alan Cox and Henrik Harmsen
* not be used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission. Th authors make no
* representations about the suitability of this software for any purpose.
* It is provided "as is" without express or implied warranty.
*
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL RICHARD HECKER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
* THIS SOFTWARE IS NOT DESIGNED FOR USE IN SAFETY CRITICAL SYSTEMS OF
* ANY KIND OR FORM.
*/
#include "fb.h"
#include "mibank.h"
#include "micmap.h"
#include "xf86.h"
#include "xf86_OSproc.h"
#include "xf86_ansic.h"
#include "xf86Version.h"
#include "xf86PciInfo.h"
#include "xf86Pci.h"
#include "xf86cmap.h"
#include "shadowfb.h"
#include "vgaHW.h"
#include "xf86DDC.h"
#include "xf86RAC.h"
#include "xf86Resources.h"
#include "compiler.h"
#include "xaa.h"
#include "dgaproc.h"
#include "voodoo.h"
#define _XF86DGA_SERVER_
#include "extensions/xf86dgastr.h"
#include "opaque.h"
#define DPMS_SERVER
#include "extensions/dpms.h"
/***********************************************************************
* DGA stuff
***********************************************************************/
static Bool VoodooDGAOpenFramebuffer(ScrnInfoPtr pScrn, char **DeviceName,
unsigned char **ApertureBase,
int *ApertureSize, int *ApertureOffset,
int *flags);
static Bool VoodooDGASetMode(ScrnInfoPtr pScrn, DGAModePtr pDGAMode);
static Bool VoodooDGAOpenFramebuffer(ScrnInfoPtr pScrn, char **DeviceName,
unsigned char **ApertureBase, int *ApertureSize,
int *ApertureOffset, int *flags)
{
*DeviceName = NULL; /* No special device */
*ApertureBase = (unsigned char *)(pScrn->memPhysBase);
*ApertureSize = pScrn->videoRam;
*ApertureOffset = pScrn->fbOffset;
*flags = 0;
return TRUE;
}
static Bool VoodooDGASetMode(ScrnInfoPtr pScrn, DGAModePtr pDGAMode)
{
DisplayModePtr pMode;
int scrnIdx = pScrn->pScreen->myNum;
int frameX0, frameY0;
if (pDGAMode) {
pMode = pDGAMode->mode;
frameX0 = frameY0 = 0;
}
else {
if (!(pMode = pScrn->currentMode))
return TRUE;
frameX0 = pScrn->frameX0;
frameY0 = pScrn->frameY0;
}
if (!(*pScrn->SwitchMode)(scrnIdx, pMode, 0))
return FALSE;
return TRUE;
}
static int VoodooDGAGetViewport(ScrnInfoPtr pScrn)
{
return (0);
}
static DGAFunctionRec VoodooDGAFunctions =
{
VoodooDGAOpenFramebuffer,
NULL, /* CloseFramebuffer */
VoodooDGASetMode,
NULL,
VoodooDGAGetViewport,
/* TODO - can do Sync/blit/fill on Voodoo2 */
NULL, /* Sync */
NULL, /* FillRect */
NULL, /* BlitRect */
NULL, /* BlitTransRect */
};
static void VoodooDGAAddModes(ScrnInfoPtr pScrn)
{
VoodooPtr pVoo = VoodooPTR(pScrn);
DisplayModePtr pMode = pScrn->modes;
DGAModePtr pDGAMode;
do {
pDGAMode = xrealloc(pVoo->pDGAMode,
(pVoo->nDGAMode + 1) * sizeof(DGAModeRec));
if (!pDGAMode)
break;
pVoo->pDGAMode = pDGAMode;
pDGAMode += pVoo->nDGAMode;
(void)memset(pDGAMode, 0, sizeof(DGAModeRec));
++pVoo->nDGAMode;
pDGAMode->mode = pMode;
pDGAMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE;
pDGAMode->byteOrder = pScrn->imageByteOrder;
pDGAMode->depth = pScrn->depth;
pDGAMode->bitsPerPixel = pScrn->bitsPerPixel;
pDGAMode->red_mask = pScrn->mask.red;
pDGAMode->green_mask = pScrn->mask.green;
pDGAMode->blue_mask = pScrn->mask.blue;
pDGAMode->visualClass = TrueColor;
pDGAMode->xViewportStep = 1;
pDGAMode->yViewportStep = 1;
pDGAMode->viewportWidth = pMode->HDisplay;
pDGAMode->viewportHeight = pMode->VDisplay;
pDGAMode->bytesPerScanline = 2048;
pDGAMode->imageWidth = pMode->HDisplay;
pDGAMode->imageHeight = pMode->VDisplay;
pDGAMode->pixmapWidth = pDGAMode->imageWidth;
pDGAMode->pixmapHeight = pDGAMode->imageHeight;
pDGAMode->maxViewportX = pScrn->virtualX -
pDGAMode->viewportWidth;
pDGAMode->maxViewportY = pScrn->virtualY -
pDGAMode->viewportHeight;
pDGAMode->address = pVoo->FBBase;
pMode = pMode->next;
} while (pMode != pScrn->modes);
}
Bool VoodooDGAInit(ScrnInfoPtr pScrn, ScreenPtr pScreen)
{
VoodooPtr pVoo = VoodooPTR(pScrn);
if (!pVoo->nDGAMode)
VoodooDGAAddModes(pScrn);
return (DGAInit(pScreen, &VoodooDGAFunctions,
pVoo->pDGAMode, pVoo->nDGAMode));
}

969
src/voodoo_driver.c Normal file
View File

@@ -0,0 +1,969 @@
/*
* XFree86 driver for the Voodoo 2 using native X support and no
* Glide2. This is done for two reasons, firstly Glide2 is not portable
* to other than x86_32 which is becoming an issue, and secondly to get
* accelerations that Glide does not expose. The Voodoo 2 hardware has
* bit blit (screen->screen, cpu->screen), some colour expansion and
* also alpha (so could do hw render even!). Also can in theory use
* texture ram and engine to do arbitary Xv support as we have
* colour match on the 2D blit (ie 3D blit to back, 2D blit to front)
* along with alpha on the Xv 8) and with some care rotation of Xv.
*
* Alan Cox <alan@redhat.com>
*
* Derived from:
*
* XFree86 driver for Glide(tm). (Mainly for Voodoo 1 and 2 cards)
* Author:
* Henrik Harmsen (hch@cd.chalmers.se or Henrik.Harmsen@erv.ericsson.se)
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the names of Red Hat, Alan Cox and Henrik Harmsen
* not be used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission. Th authors make no
* representations about the suitability of this software for any purpose.
* It is provided "as is" without express or implied warranty.
*
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL RICHARD HECKER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
* THIS SOFTWARE IS NOT DESIGNED FOR USE IN SAFETY CRITICAL SYSTEMS OF
* ANY KIND OR FORM.
*/
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/voodoo/voodoo_driver.c,v 1.27 2001/08/07 07:04:46 keithp Exp $ */
#include "fb.h"
#include "mibank.h"
#include "micmap.h"
#include "xf86.h"
#include "xf86_OSproc.h"
#include "xf86_ansic.h"
#include "xf86Version.h"
#include "xf86PciInfo.h"
#include "xf86Pci.h"
#include "xf86cmap.h"
#include "shadowfb.h"
#include "vgaHW.h"
#include "xf86DDC.h"
#include "xf86RAC.h"
#include "xf86Resources.h"
#include "compiler.h"
#include "xaa.h"
#include "voodoo.h"
#define _XF86DGA_SERVER_
#include "extensions/xf86dgastr.h"
#include "opaque.h"
#define DPMS_SERVER
#include "extensions/dpms.h"
static const OptionInfoRec * VoodooAvailableOptions(int chipid, int busid);
static void VoodooIdentify(int flags);
static Bool VoodooProbe(DriverPtr drv, int flags);
static Bool VoodooPreInit(ScrnInfoPtr pScrn, int flags);
static Bool VoodooScreenInit(int Index, ScreenPtr pScreen, int argc, char **argv);
static Bool VoodooEnterVT(int scrnIndex, int flags);
static void VoodooLeaveVT(int scrnIndex, int flags);
static Bool VoodooCloseScreen(int scrnIndex, ScreenPtr pScreen);
static Bool VoodooSaveScreen(ScreenPtr pScreen, int mode);
static void VoodooFreeScreen(int scrnIndex, int flags);
static void VoodooRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
static void VoodooRefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
static Bool VoodooSwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
static Bool VoodooModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
static void VoodooRestore(ScrnInfoPtr pScrn, Bool Closing);
static void VoodooDisplayPowerManagementSet(ScrnInfoPtr pScrn,
int PowerManagementMode,
int flags);
/*
* This contains the functions needed by the server after loading the
* driver module. It must be supplied, and gets added the driver list by
* the Module Setup funtion in the dynamic case. In the static case a
* reference to this is compiled in, and this requires that the name of
* this DriverRec be an upper-case version of the driver name.
*/
DriverRec VOODOO = {
VERSION,
VOODOO_DRIVER_NAME,
VoodooIdentify,
VoodooProbe,
VoodooAvailableOptions,
NULL,
0
};
typedef enum {
OPTION_NOACCEL,
OPTION_SHADOW_FB
} VoodooOpts;
static const OptionInfoRec VoodooOptions[] = {
{ OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE },
{ -1, NULL, OPTV_NONE, {0}, FALSE }
};
/* Supported chipsets */
static SymTabRec VoodooChipsets[] = {
{ PCI_CHIP_VOODOO1, "Voodoo 1" },
{ PCI_CHIP_VOODOO2, "Voodoo 2" },
{-1, NULL }
};
/*
* List of symbols from other modules that this module references. This
* list is used to tell the loader that it is OK for symbols here to be
* unresolved providing that it hasn't been told that they haven't been
* told that they are essential via a call to xf86LoaderReqSymbols() or
* xf86LoaderReqSymLists(). The purpose is this is to avoid warnings about
* unresolved symbols that are not required.
*/
static const char *fbSymbols[] = {
"fbScreenInit",
"fbPictureInit",
NULL
};
static const char *xaaSymbols[] = {
"XAACreateInfoRec",
"XAAInit",
"XAADestroyInfoRec",
NULL
};
static const char *shadowSymbols[] = {
"ShadowFBInit",
NULL
};
#ifdef XFree86LOADER
static XF86ModuleVersionInfo voodooVersRec =
{
"voodoo",
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
XF86_VERSION_CURRENT,
VOODOO_MAJOR_VERSION, VOODOO_MINOR_VERSION, VOODOO_PATCHLEVEL,
ABI_CLASS_VIDEODRV, /* This is a video driver */
ABI_VIDEODRV_VERSION,
MOD_CLASS_VIDEODRV,
{0,0,0,0}
};
static pointer voodooSetup(pointer module, pointer opts, int *errmaj, int *errmin)
{
static int setupDone = FALSE;
if(errmaj)
*errmaj = LDR_ONCEONLY;
if(setupDone == FALSE)
{
setupDone = TRUE;
xf86AddDriver(&VOODOO, module, 0);
LoaderRefSymLists(fbSymbols, shadowSymbols, xaaSymbols,NULL);
return (pointer)1;
}
return NULL;
}
XF86ModuleData voodooModuleData = { &voodooVersRec, voodooSetup, NULL };
#endif /* XFree86LOADER */
static Bool
VoodooGetRec(ScrnInfoPtr pScrn)
{
/*
* Allocate an VoodooRec, and hook it into pScrn->driverPrivate.
* pScrn->driverPrivate is initialised to NULL, so we can check if
* the allocation has already been done.
*/
if (pScrn->driverPrivate != NULL)
return TRUE;
pScrn->driverPrivate = xnfcalloc(sizeof(VoodooRec), 1);
/* Initialize it */
/* No init here yet */
return TRUE;
}
static void
VoodooFreeRec(ScrnInfoPtr pScrn)
{
if (pScrn->driverPrivate == NULL)
return;
xfree(pScrn->driverPrivate);
pScrn->driverPrivate = NULL;
}
static const OptionInfoRec *
VoodooAvailableOptions(int chipid, int busid)
{
return VoodooOptions;
}
/* Mandatory */
static void
VoodooIdentify(int flags)
{
xf86PrintChipsets(VOODOO_NAME, "driver for Voodoo1/Voodoo2", VoodooChipsets);
}
static PciChipsets VoodooPCIChipsets[] = {
{ PCI_CHIP_VOODOO1, PCI_CHIP_VOODOO1, 0 },
{ PCI_CHIP_VOODOO2, PCI_CHIP_VOODOO2, 0 },
{ -1, -1, RES_UNDEFINED }
};
/* Mandatory */
static Bool
VoodooProbe(DriverPtr drv, int flags)
{
int i, numDevSections, numUsed, *usedChips;
GDevPtr *devSections;
Bool foundScreen = FALSE;
/*
* Look for config file Device sections with this driver specified.
*/
if ((numDevSections = xf86MatchDevice(VOODOO_DRIVER_NAME,
&devSections)) <= 0) {
#ifdef DEBUG
xf86ErrorFVerb(3,"%s: No Device section found.\n",VOODOO_NAME);
#endif
/*
* There's no matching device section in the config file, so quit
* now.
*/
return FALSE;
}
/* PCI BUS */
if (xf86GetPciVideoInfo() ) {
numUsed = xf86MatchPciInstances(VOODOO_NAME, PCI_VENDOR_3DFX,
VoodooChipsets, VoodooPCIChipsets,
devSections,numDevSections,
drv, &usedChips);
if (numUsed > 0) {
if (flags & PROBE_DETECT)
foundScreen = TRUE;
else for (i = 0; i < numUsed; i++) {
ScrnInfoPtr pScrn = NULL;
EntityInfoPtr pEnt;
/* Allocate a ScrnInfoRec and claim the slot */
if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i],
VoodooPCIChipsets,NULL,
NULL, NULL, NULL,
NULL))) {
pScrn->driverVersion = VERSION;
pScrn->driverName = VOODOO_DRIVER_NAME;
pScrn->name = VOODOO_NAME;
pScrn->Probe = VoodooProbe;
pScrn->PreInit = VoodooPreInit;
pScrn->ScreenInit = VoodooScreenInit;
pScrn->SwitchMode = VoodooSwitchMode;
pScrn->EnterVT = VoodooEnterVT;
pScrn->LeaveVT = VoodooLeaveVT;
pScrn->FreeScreen = VoodooFreeScreen;
foundScreen = TRUE;
}
pEnt = xf86GetEntityInfo(usedChips[i]);
}
xfree(usedChips);
}
}
xfree(devSections);
return foundScreen;
}
/* Mandatory */
static Bool
VoodooPreInit(ScrnInfoPtr pScrn, int flags)
{
VoodooPtr pVoo;
int i;
ClockRangePtr clockRanges;
MessageType from;
int maxwidth;
if (flags & PROBE_DETECT)
return FALSE;
/* Check the number of entities, and fail if it isn't one. */
if (pScrn->numEntities != 1)
return FALSE;
/* Set pScrn->monitor */
pScrn->monitor = pScrn->confScreen->monitor;
if (!xf86SetDepthBpp(pScrn, 16, 0, 0, Support32bppFb)) {
return FALSE;
}
/* Check that the returned depth is one we support */
switch (pScrn->depth) {
case 16:
case 24:
case 32:
break;
default:
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Given depth (%d) is not supported by this driver\n",
pScrn->depth);
return FALSE;
}
xf86PrintDepthBpp(pScrn);
if(pScrn->depth == 32)
pScrn->depth = 24;
/*
* This must happen after pScrn->display has been set because
* xf86SetWeight references it.
*/
if (pScrn->depth > 8) {
/* The defaults are OK for us */
rgb zeros = {0, 0, 0};
if (!xf86SetWeight(pScrn, zeros, zeros)) {
return FALSE;
} else {
/* XXX check that weight returned is supported */
;
}
}
/* Set the default visual. */
if (!xf86SetDefaultVisual(pScrn, -1)) {
return FALSE;
}
/* We don't support DirectColor at > 8bpp */
if (pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given default visual"
" (%s) is not supported at depth %d\n",
xf86GetVisualName(pScrn->defaultVisual), pScrn->depth);
return FALSE;
}
/* Set default gamma */
{
Gamma zeros = {0.0, 0.0, 0.0};
if (!xf86SetGamma(pScrn, zeros)) {
return FALSE;
}
}
/* We use a programmable clock */
pScrn->progClock = TRUE;
/* Allocate the VoodooRec driverPrivate */
if (!VoodooGetRec(pScrn)) {
return FALSE;
}
pVoo = VoodooPTR(pScrn);
/* Get the entity */
pVoo->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
pVoo->PciInfo = xf86GetPciInfoForEntity(pVoo->pEnt->index);
pVoo->PciTag = pciTag(pVoo->PciInfo->bus, pVoo->PciInfo->device, pVoo->PciInfo->func);
/* Collect all of the relevant option flags (fill in pScrn->options) */
xf86CollectOptions(pScrn, NULL);
/* Process the options */
if (!(pVoo->Options = xalloc(sizeof(VoodooOptions))))
return FALSE;
memcpy(pVoo->Options, VoodooOptions, sizeof(VoodooOptions));
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pVoo->Options);
/* Need to do rotation some day */
if(pVoo->pEnt->chipset == PCI_CHIP_VOODOO2)
{
pVoo->Voodoo2 = 1; /* We have 2D accel, interlace, double */
pVoo->Accel = 1;
}
else
{
pVoo->Voodoo2 = 0;
pVoo->ShadowFB = 1;
xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "Using shadowFB with Voodoo1 hardware.\n");
}
from = X_DEFAULT;
if (xf86ReturnOptValBool(pVoo->Options, OPTION_SHADOW_FB, FALSE)) {
pVoo->ShadowFB = 1;
pVoo->Accel = 0;
}
if (xf86ReturnOptValBool(pVoo->Options, OPTION_NOACCEL, FALSE)) {
pVoo->ShadowFB = 1;
pVoo->Accel = 0;
}
if(pScrn->depth == 24 && !pVoo->ShadowFB)
{
xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "ShadowFB is required for 24/32bit modes.\n");
pVoo->ShadowFB = 1;
pVoo->Accel = 0;
}
/* MMIO at 0 , FB at 4Mb, Texture at 8Mb */
pVoo->MMIO = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pVoo->PciTag,
pVoo->PciInfo->memBase[0], 0x400000);
pVoo->FBBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pVoo->PciTag,
pVoo->PciInfo->memBase[0] + 0x400000, 0x400000);
pVoo->PhysBase = pVoo->PciInfo->memBase[0] + 0x400000;
VoodooHardwareInit(pVoo);
/*
* If the user has specified the amount of memory in the XF86Config
* file, we respect that setting.
*/
if (pVoo->pEnt->device->videoRam != 0) {
pScrn->videoRam = pVoo->pEnt->device->videoRam;
from = X_CONFIG;
} else {
pScrn->videoRam = VoodooMemorySize(pVoo) * 1024 ; /* Sizer reports Mbytes */
from = X_PROBED;
}
xf86DrvMsg(pScrn->scrnIndex, from, "Video RAM: %d kB\n",
pScrn->videoRam);
/* Set up clock ranges so that the xf86ValidateModes() function will not fail a mode because of the clock
requirement (because we don't use the clock value anyway) */
clockRanges = xnfcalloc(sizeof(ClockRange), 1);
clockRanges->next = NULL;
clockRanges->minClock = 10000;
clockRanges->maxClock = 250000; /* 250MHz DAC */
clockRanges->clockIndex = -1; /* programmable */
if(pVoo->Voodoo2)
{
clockRanges->interlaceAllowed = TRUE;
clockRanges->doubleScanAllowed = TRUE;
maxwidth = min(1024, pScrn->display->virtualX);
}
else
{
clockRanges->interlaceAllowed = FALSE;
clockRanges->doubleScanAllowed = FALSE;
maxwidth = min(800, pScrn->display->virtualX);
}
/* Select valid modes from those available */
i = xf86ValidateModes(pScrn, pScrn->monitor->Modes,
pScrn->display->modes, clockRanges,
NULL, 256, 2048,
pScrn->bitsPerPixel, 128, 768,
pScrn->display->virtualX,
pScrn->display->virtualY,
pScrn->videoRam * 1024,
LOOKUP_BEST_REFRESH);
if (i == -1) {
VoodooFreeRec(pScrn);
return FALSE;
}
/* Prune the modes marked as invalid */
xf86PruneDriverModes(pScrn);
/* If no valid modes, return */
if (i == 0 || pScrn->modes == NULL) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n");
VoodooFreeRec(pScrn);
return FALSE;
}
/* Set the current mode to the first in the list */
pScrn->currentMode = pScrn->modes;
/* Do some checking, we will not support a virtual framebuffer larger than
the visible screen. */
if (pScrn->currentMode->HDisplay != pScrn->virtualX ||
pScrn->currentMode->VDisplay != pScrn->virtualY ||
pScrn->displayWidth != pScrn->virtualX)
{
/* FIXME: In this case we could use shadowfb and clip the drawing into
the physical buffer */
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Virtual size doesn't equal display size. Forcing virtual size to equal display size.\n");
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"(Virtual size: %dx%d, Display size: %dx%d)\n", pScrn->virtualX, pScrn->virtualY,
pScrn->currentMode->HDisplay, pScrn->currentMode->VDisplay);
/* I'm not entirely sure this is "legal" but I hope so. */
pScrn->virtualX = pScrn->currentMode->HDisplay;
pScrn->virtualY = pScrn->currentMode->VDisplay;
pScrn->displayWidth = pScrn->virtualX;
}
/* Print the list of modes being used */
xf86PrintModes(pScrn);
/* Set display resolution */
xf86SetDpi(pScrn, 0, 0);
/* Load fb */
if (xf86LoadSubModule(pScrn, "fb") == NULL) {
VoodooFreeRec(pScrn);
return FALSE;
}
xf86LoaderReqSymLists(fbSymbols, NULL);
if (!xf86LoadSubModule(pScrn, "xaa")) {
VoodooFreeRec(pScrn);
return FALSE;
}
xf86LoaderReqSymLists(xaaSymbols, NULL);
if(pVoo->ShadowFB)
{
/* Load the shadow framebuffer */
if (!xf86LoadSubModule(pScrn, "shadowfb")) {
VoodooFreeRec(pScrn);
return FALSE;
}
xf86LoaderReqSymLists(shadowSymbols, NULL);
}
return TRUE;
}
/* Mandatory */
/* This gets called at the start of each server generation */
static Bool
VoodooScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
{
ScrnInfoPtr pScrn;
VoodooPtr pVoo;
int ret;
VisualPtr visual;
void *FBStart;
CARD32 displayWidth;
/*
* First get the ScrnInfoRec
*/
pScrn = xf86Screens[pScreen->myNum];
pVoo = VoodooPTR(pScrn);
if (!VoodooModeInit(pScrn, pScrn->currentMode))
return FALSE;
VoodooClear(pVoo);
/*
* The next step is to setup the screen's visuals, and initialise the
* framebuffer code. In cases where the framebuffer's default
* choices for things like visual layouts and bits per RGB are OK,
* this may be as simple as calling the framebuffer's ScreenInit()
* function. If not, the visuals will need to be setup before calling
* a fb ScreenInit() function and fixed up after.
*
* For most PC hardware at depths >= 8, the defaults that fb uses
* are not appropriate. In this driver, we fixup the visuals after.
*/
/*
* Reset the visual list.
*/
miClearVisualTypes();
/* Setup the visuals we support. Only TrueColor. */
if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), pScrn->rgbBits, pScrn->defaultVisual))
return FALSE;
miSetPixmapDepths ();
if(pVoo->ShadowFB)
{
pVoo->ShadowPitch = ((pScrn->virtualX * pScrn->bitsPerPixel >> 3) + 3) & ~3L;
pVoo->ShadowPtr = xnfalloc(pVoo->ShadowPitch * pScrn->virtualY);
FBStart = pVoo->ShadowPtr;
displayWidth = pScrn->virtualX;
}
else
{
FBStart = pVoo->FBBase;
displayWidth = 1024;
}
if(pScrn->depth == 16)
pVoo->Pitch = 2048;
else
pVoo->Pitch = 4096;
/*
* Call the framebuffer layer's ScreenInit function, and fill in other
* pScreen fields.
*/
ret = fbScreenInit(pScreen, FBStart,
pScrn->virtualX, pScrn->virtualY,
pScrn->xDpi, pScrn->yDpi,
displayWidth,
pScrn->bitsPerPixel);
if (!ret)
return FALSE;
xf86SetBlackWhitePixels(pScreen);
/* Fixup RGB ordering */
visual = pScreen->visuals + pScreen->numVisuals;
while (--visual >= pScreen->visuals) {
if ((visual->class | DynamicClass) == DirectColor) {
visual->offsetRed = pScrn->offset.red;
visual->offsetGreen = pScrn->offset.green;
visual->offsetBlue = pScrn->offset.blue;
visual->redMask = pScrn->mask.red;
visual->greenMask = pScrn->mask.green;
visual->blueMask = pScrn->mask.blue;
}
}
/* must be after RGB ordering fixed */
fbPictureInit (pScreen, 0, 0);
if(!pVoo->ShadowFB)
VoodooDGAInit(pScrn, pScreen);
/* Activate accelerations */
if(pVoo->Accel)
Voodoo2XAAInit(pScreen);
miInitializeBackingStore(pScreen);
xf86SetBackingStore(pScreen);
/* Initialize software cursor.
Must precede creation of the default colormap */
miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
/* Initialise default colourmap */
if (!miCreateDefColormap(pScreen))
return FALSE;
if(pVoo->ShadowFB)
{
if(pScrn->depth == 16)
ShadowFBInit(pScreen, VoodooRefreshArea16);
else
ShadowFBInit(pScreen, VoodooRefreshArea24);
}
xf86DPMSInit(pScreen, VoodooDisplayPowerManagementSet, 0);
pScrn->memPhysBase = pVoo->PhysBase;
pScrn->fbOffset = 0;
pScreen->SaveScreen = VoodooSaveScreen;
/* Wrap the current CloseScreen function */
pVoo->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = VoodooCloseScreen;
/* Report any unused options (only for the first generation) */
if (serverGeneration == 1) {
xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
}
/* Done */
return TRUE;
}
/*
* This is called when VT switching back to the X server. Its job is
* to reinitialise the video mode.
*
* We may wish to unmap video/MMIO memory too.
*/
/* Mandatory */
static Bool
VoodooEnterVT(int scrnIndex, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
return VoodooModeInit(pScrn, pScrn->currentMode);
}
/*
* This is called when VT switching away from the X server. Its job is
* to restore the previous (text) mode.
*
* We may wish to remap video/MMIO memory too.
*/
/* Mandatory */
static void
VoodooLeaveVT(int scrnIndex, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
VoodooRestore(pScrn, FALSE);
}
/*
* This is called at the end of each server generation. It restores the
* original (text) mode. It should also unmap the video memory, and free
* any per-generation data allocated by the driver. It should finish
* by unwrapping and calling the saved CloseScreen function.
*/
/* Mandatory */
static Bool
VoodooCloseScreen(int scrnIndex, ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
VoodooPtr pVoo = VoodooPTR(pScrn);
if (pScrn->vtSema)
VoodooRestore(pScrn, TRUE);
if(pVoo->ShadowPtr)
xfree(pVoo->ShadowPtr);
if(pVoo->AccelInfoRec)
xfree(pVoo->AccelInfoRec);
if (pVoo->pDGAMode) {
xfree(pVoo->pDGAMode);
pVoo->pDGAMode = NULL;
pVoo->nDGAMode = 0;
}
pScrn->vtSema = FALSE;
pScreen->CloseScreen = pVoo->CloseScreen;
return (*pScreen->CloseScreen)(scrnIndex, pScreen);
}
/* Free up any persistent data structures */
/* Optional */
static void
VoodooFreeScreen(int scrnIndex, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
VoodooPtr pVoo = VoodooPTR(pScrn);
/*
* This only gets called when a screen is being deleted. It does not
* get called routinely at the end of a server generation.
*/
if (pVoo && pVoo->ShadowPtr)
xfree(pVoo->ShadowPtr);
VoodooFreeRec(xf86Screens[scrnIndex]);
}
/* Do screen blanking */
/* Mandatory */
static Bool
VoodooSaveScreen(ScreenPtr pScreen, int mode)
{
ScrnInfoPtr pScrn;
VoodooPtr pVoo;
Bool unblank;
unblank = xf86IsUnblank(mode);
if(pScreen != NULL)
{
pScrn = xf86Screens[pScreen->myNum];
pVoo = VoodooPTR(pScrn);
if(pScrn->vtSema && (unblank == pVoo->Blanked))
{
if (unblank)
VoodooModeInit(pScrn, pScrn->currentMode);
else
VoodooBlank(pVoo);
pVoo->Blanked = !unblank;
}
}
return TRUE;
}
static Bool
VoodooModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
{
VoodooPtr pVoo;
int width, height;
pVoo = VoodooPTR(pScrn);
xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Clock : %x\n", mode->Clock);
xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Hz Display : %x\n", mode->CrtcHDisplay);
xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Hz Blank Start : %x\n", mode->CrtcHBlankStart);
xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Hz Sync Start : %x\n", mode->CrtcHSyncStart);
xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Hz Sync End : %x\n", mode->CrtcHSyncEnd);
xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Hz Blank End : %x\n", mode->CrtcHBlankEnd);
xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Hz Total : %x\n", mode->CrtcHTotal);
xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Hz Skew : %x\n", mode->CrtcHSkew);
xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Hz HAdjusted : %x\n", mode->CrtcHAdjusted);
xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Vt Display : %x\n", mode->CrtcVDisplay);
xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Vt Blank Start : %x\n", mode->CrtcVBlankStart);
xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Vt Sync Start : %x\n", mode->CrtcVSyncStart);
xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Vt Sync End : %x\n", mode->CrtcVSyncEnd);
xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Vt Blank End : %x\n", mode->CrtcVBlankEnd);
xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Vt Total : %x\n", mode->CrtcVTotal);
xf86DrvMsg(pScrn->scrnIndex,X_INFO, "Vt VAdjusted : %x\n", mode->CrtcVAdjusted);
if ((mode->Flags & (V_INTERLACE|V_DBLSCAN)) && !pVoo->Voodoo2)
{
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Interlaced/doublescan modes not supported\n");
return FALSE;
}
width = mode->HDisplay;
height = mode->VDisplay;
/* Initialize the video card */
if(VoodooMode(pScrn, mode))
{
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot set chosen mode.\n");
return FALSE;
}
pVoo->Blanked = FALSE;
return TRUE;
}
/*
* Sync engine on mode switches. The docs are not clear if
* this is needed but it does no harm.
*/
static Bool VoodooSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
VoodooSync(pScrn);
return VoodooModeInit(xf86Screens[scrnIndex], mode);
}
static void
VoodooRestore(ScrnInfoPtr pScrn, Bool Closing)
{
VoodooPtr pVoo;
pVoo = VoodooPTR(pScrn);
pVoo->Blanked = TRUE;
if (!Closing || !(pVoo->OnAtExit))
VoodooBlank(pVoo);
}
static void
VoodooRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
{
VoodooPtr pVoo = VoodooPTR(pScrn);
int Bpp;
unsigned char *src;
signed int x1, x2;
if (pVoo->Blanked)
return;
/*
* Voodoo 1 lacks host to CPU blit so we must use the LFB port
*/
Bpp = pScrn->bitsPerPixel >> 3;
while(num--) {
/* We align to an even number of pixels so we won't have to copy
half-words over the PCI bus */
x1 = (pbox->x1) & ~1;
x2 = (pbox->x2 + 1) & ~1;
src = pVoo->ShadowPtr + (pbox->y1 * pVoo->ShadowPitch) +
(x1 * Bpp);
VoodooCopy16(pVoo, x1, pbox->y1, x2-x1, pbox->y2-pbox->y1, pVoo->ShadowPitch, src);
pbox++;
}
}
static void
VoodooRefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
{
VoodooPtr pVoo = VoodooPTR(pScrn);
int Bpp;
unsigned char *src;
if (pVoo->Blanked)
return;
/*
* Voodoo 1 lacks host to CPU blit so we must use the LFB port
*/
Bpp = pScrn->bitsPerPixel >> 3;
while(num--) {
src = pVoo->ShadowPtr + (pbox->y1 * pVoo->ShadowPitch) +
(pbox->x1 * Bpp);
VoodooCopy24(pVoo, pbox->x1, pbox->y1, pbox->x2-pbox->x1, pbox->y2-pbox->y1, pVoo->ShadowPitch, src);
pbox++;
}
}
/*
* VoodooDisplayPowerManagementSet --
*
* Sets VESA Display Power Management Signaling (DPMS) Mode.
*/
static void
VoodooDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode,
int flags)
{
VoodooPtr pVoo = VoodooPTR(pScrn);
int old = -1;
switch (PowerManagementMode)
{
case DPMSModeOn:
/* Screen: On; HSync: On, VSync: On */
if(old != DPMSModeOn && old != -1)
{
VoodooModeInit(pScrn, pScrn->currentMode);
}
pVoo->Blanked = FALSE;
break;
case DPMSModeStandby:
case DPMSModeSuspend:
case DPMSModeOff:
pVoo->Blanked = TRUE;
VoodooBlank(pVoo);
break;
}
old = PowerManagementMode;
}

1432
src/voodoo_hardware.c Normal file

File diff suppressed because it is too large Load Diff