$Id$ Fix compilation failures problems with undefined DPMS symbols when building a static server on architectures that don't use vgahw (such as SPARC/Linux.) Fix a compiler warning. Clean up some whitespace. This patch by Branden Robinson. Not submitted to XFree86. diff -ruN xc-old/programs/Xserver/hw/xfree86/drivers/ati/Imakefile xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile --- xc-old/programs/Xserver/hw/xfree86/drivers/ati/Imakefile 2004-07-30 22:20:21.000000000 +0000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile 2004-10-20 09:36:18.735346960 +0000 @@ -149,7 +149,14 @@ #endif -DEFINES = $(CPIODEFINES) $(DGADEFINES) $(NONPCIDEFINES) $(DRIDEFINES) +/* + * The vgahw layer is not built on all architectures. + */ +#if XF86VgaHw +VGAHWDEFINES = -DWITH_VGAHW +#endif + +DEFINES = $(CPIODEFINES) $(DGADEFINES) $(NONPCIDEFINES) $(DRIDEFINES) $(VGAHWDEFINES) SRCS1 = ati.c atiadapter.c atibus.c atichip.c atiident.c atioption.c \ atiprobe.c atividmem.c $(CPIOSRCS1) $(MODSRCS1) \ diff -ruN xc-old/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c --- xc-old/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c 2004-10-20 09:35:57.339599000 +0000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c 2004-10-20 09:36:18.738346504 +0000 @@ -87,10 +87,16 @@ #include "vbe.h" /* fbdevhw & vgahw */ -#include "fbdevhw.h" +#ifdef WITH_VGAHW #include "vgaHW.h" +#endif +#include "fbdevhw.h" #include "dixstruct.h" + /* DPMS support. */ +#define DPMS_SERVER +#include "extensions/dpms.h" + #include "r128_chipset.h" #ifndef MAX @@ -179,6 +185,7 @@ { 4, 4, 3, 3, 2, 3, 1, 16, 12, "64-bit DDR SGRAM" }, }; +#ifdef WITH_VGAHW static const char *vgahwSymbols[] = { "vgaHWFreeHWRec", "vgaHWGetHWRec", @@ -189,6 +196,7 @@ "vgaHWUnlock", NULL }; +#endif static const char *fbdevHWSymbols[] = { "fbdevHWInit", @@ -335,7 +343,10 @@ * Tell the loader about symbols from other modules that this module might * refer to. */ - xf86LoaderRefSymLists(vgahwSymbols, + xf86LoaderRefSymLists( +#ifdef WITH_VGAHW + vgahwSymbols, +#endif fbSymbols, xaaSymbols, ramdacSymbols, @@ -1873,12 +1884,14 @@ return TRUE; } +#ifdef WITH_VGAHW if (!xf86LoadSubModule(pScrn, "vgahw")) return FALSE; xf86LoaderReqSymLists(vgahwSymbols, NULL); if (!vgaHWGetHWRec(pScrn)) { R128FreeRec(pScrn); return FALSE; } +#endif info->PciInfo = xf86GetPciInfoForEntity(info->pEnt->index); info->PciTag = pciTag(info->PciInfo->bus, @@ -1989,7 +2002,9 @@ if (pInt10) xf86FreeInt10(pInt10); +#ifdef WITH_VGAHW vgaHWFreeHWRec(pScrn); +#endif R128FreeRec(pScrn); return FALSE; } @@ -2802,16 +2817,20 @@ R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; R128SavePtr save = &info->SavedReg; +#ifdef WITH_VGAHW vgaHWPtr hwp = VGAHWPTR(pScrn); +#endif R128TRACE(("R128Save\n")); if (info->FBDev) { fbdevHWSave(pScrn); return; } +#ifdef WITH_VGAHW vgaHWUnlock(hwp); vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_ALL); /* save mode, fonts, cmap */ vgaHWLock(hwp); +#endif R128SaveMode(pScrn, save); @@ -2828,7 +2847,9 @@ R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; R128SavePtr restore = &info->SavedReg; +#ifdef WITH_VGAHW vgaHWPtr hwp = VGAHWPTR(pScrn); +#endif R128TRACE(("R128Restore\n")); if (info->FBDev) { @@ -2844,9 +2865,12 @@ OUTREG(R128_DP_DATATYPE, restore->dp_datatype); R128RestoreMode(pScrn, restore); + +#ifdef WITH_VGAHW vgaHWUnlock(hwp); vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS ); vgaHWLock(hwp); +#endif R128WaitForVerticalSync(pScrn); R128Unblank(pScrn); @@ -3581,8 +3605,12 @@ ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; R128TRACE(("R128FreeScreen\n")); + +#ifdef WITH_VGAHW if (xf86LoaderCheckSymbol("vgaHWFreeHWRec")) vgaHWFreeHWRec(pScrn); +#endif + R128FreeRec(pScrn); } diff -ruN xc-old/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c --- xc-old/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c 2004-08-25 00:30:41.000000000 +0000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c 2004-10-20 09:36:18.747345136 +0000 @@ -91,9 +91,15 @@ #include "xf86cmap.h" #include "vbe.h" - /* fbdevhw * vgaHW definitions */ -#include "fbdevhw.h" + /* fbdevhw & vgaHW definitions */ +#ifdef WITH_VGAHW #include "vgaHW.h" +#endif +#include "fbdevhw.h" + + /* DPMS support. */ +#define DPMS_SERVER +#include "extensions/dpms.h" #include "radeon_chipset.h" @@ -214,6 +220,7 @@ const OptionInfoRec *RADEONOptionsWeak(void) { return RADEONOptions; } +#ifdef WITH_VGAHW static const char *vgahwSymbols[] = { "vgaHWFreeHWRec", "vgaHWGetHWRec", @@ -225,6 +232,7 @@ "vgaHWGetIOBase", NULL }; +#endif static const char *fbdevHWSymbols[] = { "fbdevHWInit", @@ -380,7 +388,10 @@ * Tell the loader about symbols from other modules that this module might * refer to. */ - xf86LoaderRefSymLists(vgahwSymbols, + xf86LoaderRefSymLists( +#ifdef WITH_VGAHW + vgahwSymbols, +#endif fbSymbols, xaaSymbols, #if 0 @@ -4155,6 +4166,7 @@ return TRUE; } +#ifdef WITH_VGAHW if (!xf86LoadSubModule(pScrn, "vgahw")) return FALSE; xf86LoaderReqSymLists(vgahwSymbols, NULL); if (!vgaHWGetHWRec(pScrn)) { @@ -4163,6 +4175,7 @@ } vgaHWGetIOBase(VGAHWPTR(pScrn)); +#endif xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PCI bus %d card %d func %d\n", @@ -4305,7 +4318,9 @@ if (pInt10) xf86FreeInt10(pInt10); +#ifdef WITH_VGAHW vgaHWFreeHWRec(pScrn); +#endif fail2: if(info->MMIO) RADEONUnmapMMIO(pScrn); @@ -5741,7 +5756,9 @@ RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; RADEONSavePtr save = &info->SavedReg; +#ifdef WITH_VGAHW vgaHWPtr hwp = VGAHWPTR(pScrn); +#endif RADEONTRACE(("RADEONSave\n")); if (info->FBDev) { @@ -5750,19 +5767,21 @@ } if (!info->IsSecondary) { +#ifdef WITH_VGAHW vgaHWUnlock(hwp); -#if defined(__powerpc__) +# if defined(__powerpc__) /* temporary hack to prevent crashing on PowerMacs when trying to * read VGA fonts and colormap, will find a better solution * in the future */ vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_MODE); /* Save mode only */ -#else +# else vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS); /* Save mode * & fonts & cmap */ -#endif +# endif vgaHWLock(hwp); +#endif save->dp_datatype = INREG(RADEON_DP_DATATYPE); save->rbbm_soft_reset = INREG(RADEON_RBBM_SOFT_RESET); save->clock_cntl_index = INREG(RADEON_CLOCK_CNTL_INDEX); @@ -5778,7 +5797,9 @@ RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; RADEONSavePtr restore = &info->SavedReg; +#ifdef WITH_VGAHW vgaHWPtr hwp = VGAHWPTR(pScrn); +#endif RADEONTRACE(("RADEONRestore\n")); @@ -5821,26 +5842,32 @@ #endif if (!info->IsSecondary) { +#ifdef WITH_VGAHW vgaHWUnlock(hwp); -#if defined(__powerpc__) +# if defined(__powerpc__) /* Temporary hack to prevent crashing on PowerMacs when trying to * write VGA fonts, will find a better solution in the future */ vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE ); -#else +# else vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS ); -#endif +# endif vgaHWLock(hwp); +#endif } else { RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); ScrnInfoPtr pScrn0; +#ifdef WITH_VGAHW vgaHWPtr hwp0; +#endif pScrn0 = pRADEONEnt->pPrimaryScrn; +#ifdef WITH_VGAHW hwp0 = VGAHWPTR(pScrn0); vgaHWUnlock(hwp0); vgaHWRestore(pScrn0, &hwp0->SavedReg, VGA_SR_MODE | VGA_SR_FONTS ); vgaHWLock(hwp0); +#endif } RADEONUnblank(pScrn); @@ -7343,8 +7370,10 @@ } } +#ifdef WITH_VGAHW if (xf86LoaderCheckSymbol("vgaHWFreeHWRec")) vgaHWFreeHWRec(pScrn); +#endif RADEONFreeRec(pScrn); }