On Sun, Sep 01, 2002 at 06:49:29PM -0500, Branden Robinson wrote: > Okay, well, I've only heard about possible theoretical usage of Rage128 > or Radeon boards in SPARCs, so I am likely going to accept > ISHIKAWA-san's patch. > > Michel is right about how the rage128 and radeon sub-drivers should > guard their vgaHW calls (vgaHW support is *not* defined for all > architectures; see xc/config/cf/xfree86.cf). However I'm in a hurry to > crank 0pre1v4 and I really want it compiling again on SPARC. > > Those of you interested in rage128 and radeon support on SPARCs, please > tear into the code. Give me something that isn't ugly and compiles and > I'm happy to turn this stuff back on. > > I will note that a lot of the recent rage128 and radeon code comes from > an actual ATI employee; it may be that they are not thinking very far > beyond the i386 and powerpc architectures. This message is a possible retraction of the above. I've cooked up the attached patch. We'll see if it works. If it does then these (sub-)modules can continue to be built for SPARC, and a static server build shouldn't fail, either. I grepped around, and couldn't find any other examples of flagrant vgaHW* abuse in the source tree. -- G. Branden Robinson | You don't just decide to break Debian GNU/Linux | Kubrick's code of silence and then branden@debian.org | get drawn away from it to a http://people.debian.org/~branden/ | discussion about cough medicine.
diff -urN xc/programs/Xserver/hw/xfree86/drivers/ati~/Imakefile xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile
--- xc/programs/Xserver/hw/xfree86/drivers/ati~/Imakefile 2002-09-02 02:20:59.000000000 -0500
+++ xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile 2002-09-02 02:22:56.000000000 -0500
@@ -143,7 +143,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 -urN xc/programs/Xserver/hw/xfree86/drivers/ati~/r128_driver.c xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c
--- xc/programs/Xserver/hw/xfree86/drivers/ati~/r128_driver.c 2002-09-02 02:23:02.000000000 -0500
+++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c 2002-09-02 02:33:34.000000000 -0500
@@ -99,8 +99,10 @@
#include "vbe.h"
/* fbdevhw & vgahw */
-#include "fbdevhw.h"
+#ifdef WITH_VGAHW
#include "vgaHW.h"
+#endif
+#include "fbdevhw.h"
#include "dixstruct.h"
#ifndef MAX
@@ -185,6 +187,7 @@
{ 4, 4, 3, 3, 2, 3, 1, 16, 12, "64-bit DDR SGRAM" },
};
+#ifdef WITH_VGAHW
static const char *vgahwSymbols[] = {
"vgaHWFreeHWRec",
"vgaHWGetHWRec",
@@ -195,6 +198,7 @@
"vgaHWUnlock",
NULL
};
+#endif
static const char *fbdevHWSymbols[] = {
"fbdevHWInit",
@@ -1799,12 +1803,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,
@@ -1914,7 +1920,9 @@
if (pInt10)
xf86FreeInt10(pInt10);
+#ifdef WITH_VGAHW
vgaHWFreeHWRec(pScrn);
+#endif
R128FreeRec(pScrn);
return FALSE;
}
@@ -2762,16 +2770,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);
@@ -2788,7 +2800,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) {
@@ -2804,9 +2818,11 @@
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);
@@ -3518,8 +3534,10 @@
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
R128TRACE(("R128FreeScreen\n"));
+#ifdef WITH_VGAHW
if (xf86LoaderCheckSymbol("vgaHWFreeHWRec"))
vgaHWFreeHWRec(pScrn);
+#endif
R128FreeRec(pScrn);
}
diff -urN xc/programs/Xserver/hw/xfree86/drivers/ati~/radeon_driver.c xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c
--- xc/programs/Xserver/hw/xfree86/drivers/ati~/radeon_driver.c 2002-09-02 02:27:50.000000000 -0500
+++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c 2002-09-02 02:32:51.000000000 -0500
@@ -98,8 +98,10 @@
#include "vbe.h"
/* fbdevhw * vgaHW definitions */
-#include "fbdevhw.h"
+#ifdef WITH_VGAHW
#include "vgaHW.h"
+#endif
+#include "fbdevhw.h"
#ifndef MAX
#define MAX(a,b) ((a)>(b)?(a):(b))
@@ -163,6 +165,7 @@
{ 4, 4, 3, 3, 2, 3, 1, 16, 12, "64-bit DDR SDRAM" },
};
+#ifdef WITH_VGAHW
static const char *vgahwSymbols[] = {
"vgaHWFreeHWRec",
"vgaHWGetHWRec",
@@ -174,6 +177,7 @@
"vgaHWGetIOBase",
NULL
};
+#endif
static const char *fbdevHWSymbols[] = {
"fbdevHWInit",
@@ -2209,6 +2213,7 @@
return TRUE;
}
+#ifdef WITH_VGAHW
if (!xf86LoadSubModule(pScrn, "vgahw")) return FALSE;
xf86LoaderReqSymLists(vgahwSymbols, NULL);
if (!vgaHWGetHWRec(pScrn))
@@ -2218,6 +2223,7 @@
}
vgaHWGetIOBase(VGAHWPTR(pScrn));
+#endif
info->PciInfo = xf86GetPciInfoForEntity(info->pEnt->index);
info->PciTag = pciTag(info->PciInfo->bus,
@@ -2343,7 +2349,9 @@
if (pInt10)
xf86FreeInt10(pInt10);
+#ifdef WITH_VGAHW
vgaHWFreeHWRec(pScrn);
+#endif
RADEONFreeRec(pScrn);
return FALSE;
}
@@ -3541,7 +3549,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) {
@@ -3551,24 +3561,26 @@
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_ALL); /* save mode, fonts,cmap */
-#endif
+# endif
vgaHWLock(hwp);
+#endif /* WITH_VGAHW */
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);
save->amcgpio_en_reg = INREG(RADEON_AMCGPIO_EN_REG);
save->amcgpio_mask = INREG(RADEON_AMCGPIO_MASK);
}
-
+
RADEONSaveMode(pScrn, save);
}
@@ -3578,7 +3590,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"));
if (info->FBDev) {
@@ -3608,16 +3622,18 @@
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 /* WITH_VGAHW */
}
else
@@ -3629,11 +3645,13 @@
pRADEONEnt = pPriv->ptr;
{
ScrnInfoPtr pScrn0 = pRADEONEnt->pPrimaryScrn;
+#ifdef WITH_VGAHW
vgaHWPtr hwp0 = VGAHWPTR(pScrn0);
vgaHWUnlock(hwp0);
vgaHWRestore(pScrn0, &hwp0->SavedReg,
VGA_SR_MODE | VGA_SR_FONTS );
vgaHWLock(hwp0);
+#endif
}
}
RADEONUnblank(pScrn);
@@ -4509,8 +4527,10 @@
RADEONTRACE(("RADEONFreeScreen\n"));
+#ifdef WITH_VGAHW
if (xf86LoaderCheckSymbol("vgaHWFreeHWRec"))
vgaHWFreeHWRec(pScrn);
+#endif
RADEONFreeRec(pScrn);
}
Attachment:
pgpeEWhPYHwaG.pgp
Description: PGP signature