summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaleb Keithley <kaleb@freedesktop.org>2003-11-26 22:48:59 +0000
committerKaleb Keithley <kaleb@freedesktop.org>2003-11-26 22:48:59 +0000
commit14f3d1571c6ce463da1b349192a2981d0e1188fa (patch)
tree20f08c0a2fe93945837c4ebde26e27c41d7e9916
parent97c9ec2c1201ec09c359f92817033281045c537e (diff)
merge latest (4.3.99.16) from XFree86 (vendor) branchXORG-RELEASE-1-BASEXEVIE-MERGEXEVIE-BASEXINERAMA_2XEVIE
-rw-r--r--src/alp_driver.c65
-rw-r--r--src/cir_driver.c14
-rw-r--r--src/lg_driver.c29
3 files changed, 47 insertions, 61 deletions
diff --git a/src/alp_driver.c b/src/alp_driver.c
index 87f8e9b..c4533c0 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.28 2002/07/24 01:47:27 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c,v 1.36 2003/11/07 22:49:58 dawes Exp $ */
/* All drivers should typically include these */
#include "xf86.h"
@@ -65,10 +65,8 @@
#define _ALP_PRIVATE_
#include "alp.h"
-#ifdef XvExtension
#include "xf86xv.h"
#include "Xv.h"
-#endif
#ifdef ALPPROBEI2C
/* For debugging... should go away. */
@@ -95,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);
@@ -131,7 +130,7 @@ static const OptionInfoRec CirOptions[] = {
{ OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_MMIO, "MMIO", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE },
{ OPTION_MEMCFG1, "MemCFG1", OPTV_INTEGER, {0}, -1 },
{ OPTION_MEMCFG2, "MemCFG2", OPTV_INTEGER, {0}, -1 },
@@ -173,11 +172,13 @@ static const char *vgahwSymbols[] = {
NULL
};
+#ifdef XFree86LOADER
static const char *miscfbSymbols[] = {
"xf1bppScreenInit",
"xf4bppScreenInit",
NULL
};
+#endif
static const char *fbSymbols[] = {
"fbScreenInit",
@@ -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;
@@ -442,7 +443,15 @@ AlpCountRam(ScrnInfoPtr pScrn)
break;
case PCI_CHIP_GD7548:
- videoram = 1024; /* TODO: actual size */
+ videoram = 1024;
+ switch (pCir->chip.alp->sr0f & 0x90) {
+ case 0x10:
+ /* TODO: 2 256K X 16 DRAMs (1024) or 4 512K X 8 DRAMs (2048)? */
+ break;
+ case 0x90:
+ videoram <<= 1;
+ break;
+ }
break;
}
@@ -546,8 +555,10 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
/* Get the entity, and make sure it is PCI. */
pCir->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
- if (pCir->pEnt->location.type != BUS_PCI)
+ if (pCir->pEnt->location.type != BUS_PCI) {
+ xfree(pCir->pEnt);
return FALSE;
+ }
pCir->Chipset = pCir->pEnt->chipset;
/* Find the PCI info for this screen */
@@ -575,10 +586,9 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
/*
* The first thing we should figure out is the depth, bpp, etc.
- * Our default depth is 8, so pass it to the helper function.
* We support both 24bpp and 32bpp layouts, so indicate that.
*/
- if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support24bppFb | Support32bppFb |
+ if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support24bppFb | Support32bppFb |
SupportConvert32to24 | PreferConvert32to24)) {
return FALSE;
} else {
@@ -1211,7 +1221,6 @@ static Bool
AlpModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
{
vgaHWPtr hwp;
- vgaRegPtr vgaReg;
CirPtr pCir;
int depthcode;
int width;
@@ -1306,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;
@@ -1459,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;
@@ -1478,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))
@@ -1508,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);
@@ -1712,7 +1720,6 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pScrn->memPhysBase = pCir->FbAddress;
pScrn->fbOffset = 0;
-#ifdef XvExtension
{
XF86VideoAdaptorPtr *ptr;
int n;
@@ -1721,7 +1728,6 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (n)
xf86XVScreenInit(pScreen, ptr, n);
}
-#endif
/*
* Wrap the CloseScreen vector and set SaveScreen.
@@ -1901,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;
@@ -1939,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
@@ -1950,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 ? */
diff --git a/src/cir_driver.c b/src/cir_driver.c
index b8c2c49..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.68 2001/06/13 23:34:09 dawes 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"
@@ -56,8 +56,8 @@ static Bool alp_loaded = FALSE;
/*
* 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
+ * driver module. It must be supplied, and gets added to the driver list by
+ * the Module Setup function 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.
*/
@@ -102,7 +102,7 @@ PciChipsets CIRPciChipsets[] = {
{ PCI_CHIP_GD5464, PCI_CHIP_GD5464, RES_SHARED_VGA },
{ PCI_CHIP_GD5464BD,PCI_CHIP_GD5464BD, RES_SHARED_VGA },
{ PCI_CHIP_GD5465, PCI_CHIP_GD5465, RES_SHARED_VGA },
- { PCI_CHIP_GD7548, PCI_CHIP_GD7548, RES_SHARED_VGA },
+ { PCI_CHIP_GD7548, PCI_CHIP_GD7548, RES_SHARED_VGA },
{ -1, -1, RES_UNDEFINED}
};
@@ -111,7 +111,7 @@ PciChipsets CIRPciChipsets[] = {
* 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
+ * xf86LoaderReqSymLists(). The purpose of this is to avoid warnings about
* unresolved symbols that are not required.
*/
@@ -275,10 +275,10 @@ CIRProbe(DriverPtr drv, int flags)
they should be handled in this driver (as opposed to their
own driver). */
pPci = xf86GetPciInfoForEntity(usedChips[i]);
- if (pPci->chipType == PCI_CHIP_GD5462 ||
+ if (pPci && (pPci->chipType == PCI_CHIP_GD5462 ||
pPci->chipType == PCI_CHIP_GD5464 ||
pPci->chipType == PCI_CHIP_GD5464BD ||
- pPci->chipType == PCI_CHIP_GD5465) {
+ pPci->chipType == PCI_CHIP_GD5465)) {
if (!lg_loaded) {
if (!xf86LoadDrvSubModule(drv, "cirrus_laguna"))
diff --git a/src/lg_driver.c b/src/lg_driver.c
index 2f63143..90eee02 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.43 2002/07/24 01:47:27 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c,v 1.50 2003/11/07 22:49:58 dawes Exp $ */
#define EXPERIMENTAL
@@ -62,10 +62,8 @@
#define _LG_PRIVATE_
#include "lg.h"
-#ifdef XvExtension
#include "xf86xv.h"
#include "Xv.h"
-#endif
/*
* Forward definitions for the functions that make up the driver.
@@ -86,7 +84,8 @@ void LgAdjustFrame(int scrnIndex, int x, int y, int flags);
/* Optional functions */
void LgFreeScreen(int scrnIndex, int flags);
-int LgValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags);
+ModeStatus LgValidMode(int scrnIndex, DisplayModePtr mode,
+ Bool verbose, int flags);
/* Internally used functions */
static void LgRestoreLgRegs(ScrnInfoPtr pScrn, LgRegPtr lgReg);
@@ -372,10 +371,6 @@ 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");
@@ -385,7 +380,8 @@ 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", MonInfo);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "I2C Monitor info: %p\n",
+ (void *)MonInfo);
xf86PrintEDID(MonInfo);
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "end of I2C Monitor info\n\n");
#endif /* LGuseI2C */
@@ -473,10 +469,9 @@ LgPreInit(ScrnInfoPtr pScrn, int flags)
/*
* The first thing we should figure out is the depth, bpp, etc.
- * Our default depth is 8, so pass it to the helper function.
* We support both 24bpp and 32bpp layouts, so indicate that.
*/
- if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support24bppFb | Support32bppFb |
+ if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support24bppFb | Support32bppFb |
SupportConvert32to24 | PreferConvert32to24)) {
return FALSE;
}
@@ -952,7 +947,6 @@ static Bool
LgModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
{
vgaHWPtr hwp;
- vgaRegPtr vgaReg;
CirPtr pCir;
int width;
Bool VDiv2 = FALSE;
@@ -1003,8 +997,6 @@ 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 */
@@ -1285,7 +1277,7 @@ LgRestore(ScrnInfoPtr pScrn)
LgRegPtr lgReg;
#ifdef LG_DEBUG
- ErrorF("LgRestore pScrn = 0x%08X\n", pScrn);
+ ErrorF("LgRestore pScrn = %p\n", (void *)pScrn);
#endif
pCir = CIRPTR(pScrn);
@@ -1351,6 +1343,9 @@ 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);
@@ -1487,7 +1482,6 @@ LgScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pScrn->memPhysBase = pCir->FbAddress;
pScrn->fbOffset = 0;
-#ifdef XvExtension
{
XF86VideoAdaptorPtr *ptr;
int n;
@@ -1496,7 +1490,6 @@ LgScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (n)
xf86XVScreenInit(pScreen, ptr, n);
}
-#endif
/*
* Wrap the CloseScreen vector and set SaveScreen.
@@ -1730,7 +1723,7 @@ LgFreeScreen(int scrnIndex, int flags)
/* Checks if a mode is suitable for the selected chipset. */
/* Optional */
-int
+ModeStatus
LgValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
{
int lace;