From c15b8a386fc6915e2ec13b0b8b9a15eb7277d665 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 16 Jun 2004 09:23:02 +0000 Subject: DRI XFree86-4_3_99_12-merge import --- man/cirrus.man | 8 ++++---- src/CirrusClk.c | 2 +- src/alp.h | 2 +- src/alp_driver.c | 42 ++++++++++++++++++++++++++++-------------- src/alp_hwcurs.c | 2 +- src/alp_i2c.c | 2 +- src/alp_xaa.c | 2 +- src/alp_xaam.c | 2 +- src/cir.h | 2 +- src/cir_dga.c | 2 +- src/cir_driver.c | 4 ++-- src/cir_shadow.c | 2 +- src/lg.h | 2 +- src/lg_driver.c | 24 +++++++++++++----------- src/lg_hwcurs.c | 2 +- src/lg_i2c.c | 2 +- src/lg_xaa.c | 2 +- src/lg_xaa.h | 2 +- 18 files changed, 61 insertions(+), 45 deletions(-) diff --git a/man/cirrus.man b/man/cirrus.man index ef0f43b..5035b02 100644 --- a/man/cirrus.man +++ b/man/cirrus.man @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cirrus.man,v 1.1 2001/01/24 00:06:17 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cirrus.man,v 1.2 2001/01/27 18:20:47 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH CIRRUS __drivermansuffix__ __vendorversion__ @@ -14,17 +14,17 @@ cirrus \- Cirrus Logic video driver .fi .SH DESCRIPTION .B cirrus -is an __xservername__ driver for Cirrus Logic video chips. +is an XFree86 driver for Cirrus Logic video chips. THIS MAN PAGE NEEDS TO BE FILLED IN. .SH SUPPORTED HARDWARE The .B cirrus driver supports... .SH CONFIGURATION DETAILS -Please refer to __xconfigfile__(__filemansuffix__) for general configuration +Please refer to XF86Config(__filemansuffix__) for general configuration details. This section only covers configuration details specific to this driver. .SH "SEE ALSO" -__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__) +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) .SH AUTHORS Authors include: ... diff --git a/src/CirrusClk.c b/src/CirrusClk.c index e3388df..c548f1f 100644 --- a/src/CirrusClk.c +++ b/src/CirrusClk.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/CirrusClk.c,v 1.8 1998/12/06 06:08:28 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/CirrusClk.c,v 1.9 1999/12/26 18:24:14 robin Exp $ */ /* * Programming of the built-in Cirrus clock generator. diff --git a/src/alp.h b/src/alp.h index 2eadc24..01c5301 100644 --- a/src/alp.h +++ b/src/alp.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h,v 1.6 2001/02/15 17:39:28 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h,v 1.8 2001/10/01 13:44:05 eich Exp $ */ /* (c) Itai Nahshon */ diff --git a/src/alp_driver.c b/src/alp_driver.c index d20507e..b4aecf5 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.35 2003/11/03 05:11:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c,v 1.32 2003/08/23 16:09:16 dawes Exp $ */ /* All drivers should typically include these */ #include "xf86.h" @@ -93,8 +93,7 @@ void AlpAdjustFrame(int scrnIndex, int x, int y, int flags); /* Optional functions */ void AlpFreeScreen(int scrnIndex, int flags); -ModeStatus AlpValidMode(int scrnIndex, DisplayModePtr mode, - Bool verbose, int flags); +int AlpValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags); /* Internally used functions */ static void AlpSave(ScrnInfoPtr pScrn); static void AlpRestore(ScrnInfoPtr pScrn); @@ -238,7 +237,7 @@ static XF86ModuleVersionInfo alpVersRec = MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, - XORG_VERSION_CURRENT, + XF86_VERSION_CURRENT, ALP_MAJOR_VERSION, ALP_MINOR_VERSION, ALP_PATCHLEVEL, ABI_CLASS_VIDEODRV, /* This is a video driver */ ABI_VIDEODRV_VERSION, @@ -362,7 +361,7 @@ AlpCountRam(ScrnInfoPtr pScrn) pCir->chip.alp->sr0f = hwp->readSeq(hwp, 0x0F); } xf86DrvMsg(pScrn->scrnIndex, from, "Memory Config reg 1 is 0x%02X\n", - (unsigned int)pCir->chip.alp->sr0f); + pCir->chip.alp->sr0f); switch (pCir->Chipset) { case PCI_CHIP_GD5430: @@ -405,7 +404,7 @@ AlpCountRam(ScrnInfoPtr pScrn) pCir->chip.alp->sr17 = hwp->readSeq(hwp, 0x17); } xf86DrvMsg(pScrn->scrnIndex, from, "Memory Config reg 2 is 0x%02X\n", - (unsigned int)pCir->chip.alp->sr17); + pCir->chip.alp->sr17); if ((pCir->chip.alp->sr0f & 0x18) == 0x18) { if (pCir->chip.alp->sr0f & 0x80) { @@ -431,7 +430,7 @@ AlpCountRam(ScrnInfoPtr pScrn) pCir->chip.alp->sr17 = hwp->readSeq(hwp, 0x17); } xf86DrvMsg(pScrn->scrnIndex, from, "Memory Config reg 2 is 0x%02X\n", - (unsigned int)pCir->chip.alp->sr17); + pCir->chip.alp->sr17); videoram = 1024; if ((pCir->chip.alp->sr0f & 0x18) == 0x18) { /* 2 or 4 MB */ videoram = 2048; @@ -1221,6 +1220,7 @@ static Bool AlpModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) { vgaHWPtr hwp; + vgaRegPtr vgaReg; CirPtr pCir; int depthcode; int width; @@ -1315,6 +1315,8 @@ 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; @@ -1466,6 +1468,7 @@ 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; @@ -1484,6 +1487,7 @@ 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)) @@ -1513,9 +1517,6 @@ 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); @@ -1907,7 +1908,7 @@ AlpFreeScreen(int scrnIndex, int flags) /* Checks if a mode is suitable for the selected chipset. */ /* Optional */ -ModeStatus +int AlpValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { int lace; @@ -1945,7 +1946,7 @@ AlpSaveScreen(ScreenPtr pScreen, int mode) static void AlpSetClock(CirPtr pCir, vgaHWPtr hwp, int freq) { - int num, den, ffreq; + int num, den, ffreq, usemclk, diff, mclk; CARD8 tmp; #ifdef ALP_DEBUG @@ -1956,9 +1957,22 @@ 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\n", - num, den, ffreq / 1000, ffreq % 1000); + ErrorF("AlpSetClock: nom=%x den=%x ffreq=%d.%03dMHz usemclk=%x\n", + num, den, ffreq / 1000, ffreq % 1000, usemclk); #endif /* So - how do we use MCLK here for the VCLK ? */ diff --git a/src/alp_hwcurs.c b/src/alp_hwcurs.c index 002098f..a4f0581 100644 --- a/src/alp_hwcurs.c +++ b/src/alp_hwcurs.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_hwcurs.c,v 1.4 2000/12/06 15:35:15 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_hwcurs.c,v 1.5 2001/05/07 21:59:06 tsi Exp $ */ /* (c) Itai Nahshon */ diff --git a/src/alp_i2c.c b/src/alp_i2c.c index ba80065..78d5406 100644 --- a/src/alp_i2c.c +++ b/src/alp_i2c.c @@ -1,6 +1,6 @@ /* (c) Itai Nahshon */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_i2c.c,v 1.6 1999/02/28 11:19:38 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_i2c.c,v 1.3 2000/12/06 15:35:15 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" diff --git a/src/alp_xaa.c b/src/alp_xaa.c index bbdf735..417f816 100644 --- a/src/alp_xaa.c +++ b/src/alp_xaa.c @@ -1,6 +1,6 @@ /* (c) Itai Nahshon */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c,v 1.7 2001/10/01 13:44:05 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c,v 1.8 2002/01/25 21:56:00 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" diff --git a/src/alp_xaam.c b/src/alp_xaam.c index 5b4ab25..2f25092 100644 --- a/src/alp_xaam.c +++ b/src/alp_xaam.c @@ -1,6 +1,6 @@ /* (c) Itai Nahshon */ /* #define DEBUG */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c,v 1.7 2001/10/01 13:44:05 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c,v 1.8 2002/07/10 02:36:50 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" diff --git a/src/cir.h b/src/cir.h index 2000c68..536f7aa 100644 --- a/src/cir.h +++ b/src/cir.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h,v 1.20 2002/01/04 21:26:54 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h,v 1.21 2002/01/25 21:56:01 tsi Exp $ */ /* (c) Itai Nahshon */ diff --git a/src/cir_dga.c b/src/cir_dga.c index 6f31084..7677160 100644 --- a/src/cir_dga.c +++ b/src/cir_dga.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c,v 1.5 2001/02/15 17:39:27 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c,v 1.7 2001/10/01 13:44:05 eich Exp $ */ /* * Copyright 2000 by Egbert Eich * diff --git a/src/cir_driver.c b/src/cir_driver.c index 239ac01..737eb3f 100644 --- a/src/cir_driver.c +++ b/src/cir_driver.c @@ -11,7 +11,7 @@ * Guy DESBIEF */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_driver.c,v 1.67 2001/05/15 10:19:37 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_driver.c,v 1.69 2003/06/18 16:17:38 eich Exp $ */ /* All drivers should typically include these */ #include "xf86.h" @@ -143,7 +143,7 @@ static XF86ModuleVersionInfo cirVersRec = MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, - XORG_VERSION_CURRENT, + XF86_VERSION_CURRENT, CIR_MAJOR_VERSION, CIR_MINOR_VERSION, CIR_PATCHLEVEL, ABI_CLASS_VIDEODRV, /* This is a video driver */ ABI_VIDEODRV_VERSION, diff --git a/src/cir_shadow.c b/src/cir_shadow.c index 1c529eb..184dee8 100644 --- a/src/cir_shadow.c +++ b/src/cir_shadow.c @@ -1,4 +1,4 @@ -/* $XFree86: Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_shadow.c,v 1.1 2000/02/08 13:13:14 eich Exp $ */ /* Copyright (c) 1999,2000 The XFree86 Project Inc. diff --git a/src/lg.h b/src/lg.h index 09285a4..9d91053 100644 --- a/src/lg.h +++ b/src/lg.h @@ -10,7 +10,7 @@ * Inspired by cir.h */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg.h,v 1.11 2000/12/06 15:35:16 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg.h,v 1.12 2001/05/04 19:05:36 dawes Exp $ */ #ifndef LG_H #define LG_H diff --git a/src/lg_driver.c b/src/lg_driver.c index da6d208..95b7655 100644 --- a/src/lg_driver.c +++ b/src/lg_driver.c @@ -13,7 +13,7 @@ * David Dawes, Andrew E. Mileski, Leonard N. Zubkoff, * Guy DESBIEF, Itai Nahshon. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c,v 1.49 2003/11/03 05:11:09 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c,v 1.45 2003/08/23 15:02:57 dawes Exp $ */ #define EXPERIMENTAL @@ -84,8 +84,7 @@ void LgAdjustFrame(int scrnIndex, int x, int y, int flags); /* Optional functions */ void LgFreeScreen(int scrnIndex, int flags); -ModeStatus LgValidMode(int scrnIndex, DisplayModePtr mode, - Bool verbose, int flags); +int LgValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags); /* Internally used functions */ static void LgRestoreLgRegs(ScrnInfoPtr pScrn, LgRegPtr lgReg); @@ -246,7 +245,7 @@ static XF86ModuleVersionInfo lgVersRec = MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, - XORG_VERSION_CURRENT, + XF86_VERSION_CURRENT, LG_MAJOR_VERSION, LG_MINOR_VERSION, LG_PATCHLEVEL, ABI_CLASS_VIDEODRV, /* This is a video driver */ ABI_VIDEODRV_VERSION, @@ -371,6 +370,10 @@ LgDoDDC(ScrnInfoPtr pScrn) if (!CirMapMem(pCir, pScrn->scrnIndex)) return FALSE; + { + ErrorF("RIF Control %#04x, RAC Control %#04x\n", + memrw(0x200), memrw(0x201)); + } #if LGuseI2C if (!LgI2CInit(pScrn)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I2C initialization failed\n"); @@ -380,8 +383,7 @@ LgDoDDC(ScrnInfoPtr pScrn) /* Read and output monitor info using DDC2 over I2C bus */ MonInfo = xf86DoEDID_DDC2(pScrn->scrnIndex, pCir->I2CPtr1); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "I2C Monitor info: %p\n", - (void *)MonInfo); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "I2C Monitor info: %p\n", MonInfo); xf86PrintEDID(MonInfo); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of I2C Monitor info\n\n"); #endif /* LGuseI2C */ @@ -947,6 +949,7 @@ static Bool LgModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) { vgaHWPtr hwp; + vgaRegPtr vgaReg; CirPtr pCir; int width; Bool VDiv2 = FALSE; @@ -997,6 +1000,8 @@ LgModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) #ifdef LG_DEBUG ErrorF("SynthClock = %d\n", mode->SynthClock); #endif + vgaReg = &hwp->ModeReg; + hwp->IOBase = 0x3D0; hwp->ModeReg.MiscOutReg |= 0x01; #if 0 /* Mono address */ @@ -1277,7 +1282,7 @@ LgRestore(ScrnInfoPtr pScrn) LgRegPtr lgReg; #ifdef LG_DEBUG - ErrorF("LgRestore pScrn = %p\n", (void *)pScrn); + ErrorF("LgRestore pScrn = 0x%08X\n", pScrn); #endif pCir = CIRPTR(pScrn); @@ -1343,9 +1348,6 @@ LgScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (!LgModeInit(pScrn, pScrn->currentMode)) return FALSE; - /* Make things beautiful */ - LgSaveScreen(pScreen, SCREEN_SAVER_ON); - /* Set the viewport */ LgAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); @@ -1723,7 +1725,7 @@ LgFreeScreen(int scrnIndex, int flags) /* Checks if a mode is suitable for the selected chipset. */ /* Optional */ -ModeStatus +int LgValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { int lace; diff --git a/src/lg_hwcurs.c b/src/lg_hwcurs.c index 2f3101d..7e30bdb 100644 --- a/src/lg_hwcurs.c +++ b/src/lg_hwcurs.c @@ -10,7 +10,7 @@ * Much of this code is inspired by the HW cursor code from XFree86 * 3.3.3. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_hwcurs.c,v 1.4 2000/12/06 15:35:17 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_hwcurs.c,v 1.5 2001/05/07 21:59:06 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" diff --git a/src/lg_i2c.c b/src/lg_i2c.c index 7f5ee4e..6cb3e3d 100644 --- a/src/lg_i2c.c +++ b/src/lg_i2c.c @@ -1,6 +1,6 @@ /* (c) Itai Nahshon */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_i2c.c,v 1.1 1998/11/15 04:30:25 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_i2c.c,v 1.4 2000/12/06 15:35:17 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" diff --git a/src/lg_xaa.c b/src/lg_xaa.c index 7b84b6b..9488721 100644 --- a/src/lg_xaa.c +++ b/src/lg_xaa.c @@ -10,7 +10,7 @@ * Much of this code is inspired by the XAA acceleration from XFree86 * 3.3.3, laguna_acl.c */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_xaa.c,v 1.4 2000/12/06 15:35:17 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_xaa.c,v 1.5 2001/02/15 17:39:28 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" diff --git a/src/lg_xaa.h b/src/lg_xaa.h index b115dc8..7359a49 100644 --- a/src/lg_xaa.h +++ b/src/lg_xaa.h @@ -13,7 +13,7 @@ * This header file draws much from the file cir_blitLG.h in version 3.3.3 * of XFree86. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_xaa.h,v 1.1 1998/11/22 10:37:21 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_xaa.h,v 1.3 2000/02/08 13:13:15 eich Exp $ */ /* This header file defines the necessary structures, contstants, and variables for using the bitBLT engine on a Laguna family graphics -- cgit v1.2.3