summaryrefslogtreecommitdiff
path: root/src/alp_driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/alp_driver.c')
-rw-r--r--src/alp_driver.c44
1 files changed, 15 insertions, 29 deletions
diff --git a/src/alp_driver.c b/src/alp_driver.c
index b4aecf5..d2f9692 100644
--- a/src/alp_driver.c
+++ b/src/alp_driver.c
@@ -11,7 +11,7 @@
* Guy DESBIEF
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c,v 1.32 2003/08/23 16:09:16 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c,v 1.35 2003/11/03 05:11:09 tsi Exp $ */
/* All drivers should typically include these */
#include "xf86.h"
@@ -66,7 +66,7 @@
#include "alp.h"
#include "xf86xv.h"
-#include "Xv.h"
+#include <X11/extensions/Xv.h>
#ifdef ALPPROBEI2C
/* For debugging... should go away. */
@@ -93,7 +93,8 @@ void AlpAdjustFrame(int scrnIndex, int x, int y, int flags);
/* Optional functions */
void AlpFreeScreen(int scrnIndex, int flags);
-int AlpValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags);
+ModeStatus AlpValidMode(int scrnIndex, DisplayModePtr mode,
+ Bool verbose, int flags);
/* Internally used functions */
static void AlpSave(ScrnInfoPtr pScrn);
static void AlpRestore(ScrnInfoPtr pScrn);
@@ -237,7 +238,7 @@ static XF86ModuleVersionInfo alpVersRec =
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
- XF86_VERSION_CURRENT,
+ XORG_VERSION_CURRENT,
ALP_MAJOR_VERSION, ALP_MINOR_VERSION, ALP_PATCHLEVEL,
ABI_CLASS_VIDEODRV, /* This is a video driver */
ABI_VIDEODRV_VERSION,
@@ -361,7 +362,7 @@ AlpCountRam(ScrnInfoPtr pScrn)
pCir->chip.alp->sr0f = hwp->readSeq(hwp, 0x0F);
}
xf86DrvMsg(pScrn->scrnIndex, from, "Memory Config reg 1 is 0x%02X\n",
- pCir->chip.alp->sr0f);
+ (unsigned int)pCir->chip.alp->sr0f);
switch (pCir->Chipset) {
case PCI_CHIP_GD5430:
@@ -404,7 +405,7 @@ AlpCountRam(ScrnInfoPtr pScrn)
pCir->chip.alp->sr17 = hwp->readSeq(hwp, 0x17);
}
xf86DrvMsg(pScrn->scrnIndex, from, "Memory Config reg 2 is 0x%02X\n",
- pCir->chip.alp->sr17);
+ (unsigned int)pCir->chip.alp->sr17);
if ((pCir->chip.alp->sr0f & 0x18) == 0x18) {
if (pCir->chip.alp->sr0f & 0x80) {
@@ -430,7 +431,7 @@ AlpCountRam(ScrnInfoPtr pScrn)
pCir->chip.alp->sr17 = hwp->readSeq(hwp, 0x17);
}
xf86DrvMsg(pScrn->scrnIndex, from, "Memory Config reg 2 is 0x%02X\n",
- pCir->chip.alp->sr17);
+ (unsigned int)pCir->chip.alp->sr17);
videoram = 1024;
if ((pCir->chip.alp->sr0f & 0x18) == 0x18) { /* 2 or 4 MB */
videoram = 2048;
@@ -1220,7 +1221,6 @@ static Bool
AlpModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
{
vgaHWPtr hwp;
- vgaRegPtr vgaReg;
CirPtr pCir;
int depthcode;
int width;
@@ -1315,8 +1315,6 @@ AlpModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
pCir->chip.alp->ModeReg.ExtVga[GR17] |= 0x08;
pCir->chip.alp->ModeReg.ExtVga[GR17] &= ~0x04;
- vgaReg = &hwp->ModeReg;
-
pCir->chip.alp->ModeReg.ExtVga[HDR] = 0;
/* Enable linear mode and high-res packed pixel mode */
pCir->chip.alp->ModeReg.ExtVga[SR07] &= 0xe0;
@@ -1468,7 +1466,6 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
ScrnInfoPtr pScrn;
vgaHWPtr hwp;
CirPtr pCir;
- AlpPtr pAlp;
int i, ret;
int init_picture = 0;
VisualPtr visual;
@@ -1487,7 +1484,6 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
hwp = VGAHWPTR(pScrn);
pCir = CIRPTR(pScrn);
- pAlp = ALPPTR(pCir);
/* Map the VGA memory when the primary video */
if (!vgaHWMapMem(pScrn))
@@ -1517,6 +1513,9 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (!AlpModeInit(pScrn, pScrn->currentMode))
return FALSE;
+ /* Make things beautiful */
+ AlpSaveScreen(pScreen, SCREEN_SAVER_ON);
+
/* Set the viewport */
AlpAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
@@ -1908,7 +1907,7 @@ AlpFreeScreen(int scrnIndex, int flags)
/* Checks if a mode is suitable for the selected chipset. */
/* Optional */
-int
+ModeStatus
AlpValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
{
int lace;
@@ -1946,7 +1945,7 @@ AlpSaveScreen(ScreenPtr pScreen, int mode)
static void
AlpSetClock(CirPtr pCir, vgaHWPtr hwp, int freq)
{
- int num, den, ffreq, usemclk, diff, mclk;
+ int num, den, ffreq;
CARD8 tmp;
#ifdef ALP_DEBUG
@@ -1957,22 +1956,9 @@ AlpSetClock(CirPtr pCir, vgaHWPtr hwp, int freq)
if (!CirrusFindClock(&ffreq, pCir->MaxClock, &num, &den))
return;
- /* Calculate the MCLK. */
- mclk = 14318 * (hwp->readSeq(hwp, 0x1F) & 0x3F) / 8; /* XXX */
- /*
- * Favour MCLK as VLCK if it matches as good as the found clock,
- * or if it is within 0.2 MHz of the request clock. A VCLK close
- * to MCLK can cause instability.
- */
- diff = abs(freq - ffreq);
- if (abs(mclk - ffreq) <= diff + 10 || abs(mclk - freq) <= 200)
- usemclk = TRUE;
- else
- usemclk = FALSE;
-
#ifdef ALP_DEBUG
- ErrorF("AlpSetClock: nom=%x den=%x ffreq=%d.%03dMHz usemclk=%x\n",
- num, den, ffreq / 1000, ffreq % 1000, usemclk);
+ ErrorF("AlpSetClock: nom=%x den=%x ffreq=%d.%03dMHz\n",
+ num, den, ffreq / 1000, ffreq % 1000);
#endif
/* So - how do we use MCLK here for the VCLK ? */