summaryrefslogtreecommitdiff
path: root/src/gx_driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gx_driver.c')
-rw-r--r--src/gx_driver.c1109
1 files changed, 567 insertions, 542 deletions
diff --git a/src/gx_driver.c b/src/gx_driver.c
index b9904d1..5268f29 100644
--- a/src/gx_driver.c
+++ b/src/gx_driver.c
@@ -81,15 +81,15 @@ static inline void
gx_enable_dac_power(void)
{
gfx_write_vid32(RCDF_VID_MISC,
- gfx_read_vid32(RCDF_VID_MISC) & RCDF_GAMMA_BYPASS_BOTH);
+ gfx_read_vid32(RCDF_VID_MISC) & RCDF_GAMMA_BYPASS_BOTH);
}
static inline void
gx_disable_dac_power(void)
{
gfx_write_vid32(RCDF_VID_MISC,
- RCDF_DAC_POWER_DOWN | RCDF_ANALOG_POWER_DOWN |
- (gfx_read_vid32(RCDF_VID_MISC) & RCDF_GAMMA_BYPASS_BOTH));
+ RCDF_DAC_POWER_DOWN | RCDF_ANALOG_POWER_DOWN |
+ (gfx_read_vid32(RCDF_VID_MISC) & RCDF_GAMMA_BYPASS_BOTH));
}
static void
@@ -98,9 +98,9 @@ GXInitEXAMemory(ScrnInfoPtr pScrni, unsigned int *offset, unsigned int *avail)
GeodePtr pGeode = GEODEPTR(pScrni);
if (pGeode->exaBfrSz > 0 && pGeode->exaBfrSz <= *avail) {
- pGeode->exaBfrOffset = *offset;
- *offset += pGeode->exaBfrOffset;
- *avail -= pGeode->exaBfrOffset;
+ pGeode->exaBfrOffset = *offset;
+ *offset += pGeode->exaBfrOffset;
+ *avail -= pGeode->exaBfrOffset;
}
}
@@ -114,39 +114,41 @@ GXInitXAAMemory(ScrnInfoPtr pScrni, unsigned int *offset, unsigned int *avail)
/* For now, we NULL them all out. */
if (pGeode->NoOfImgBuffers > 0) {
- size = pGeode->displayPitch * pGeode->NoOfImgBuffers;
- if (size <= *avail) {
- for (i = 0; i < pGeode->NoOfImgBuffers; i++) {
- pGeode->AccelImageWriteBuffers[i] = pGeode->FBBase + *offset;
- *offset += pGeode->displayPitch;
- *avail -= pGeode->displayPitch;
- }
- } else {
- xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
- "Not enough memory for image write buffers.\n");
-
- for (i = 0; i < pGeode->NoOfImgBuffers; i++)
- pGeode->AccelImageWriteBuffers[i] = NULL;
- }
+ size = pGeode->displayPitch * pGeode->NoOfImgBuffers;
+ if (size <= *avail) {
+ for (i = 0; i < pGeode->NoOfImgBuffers; i++) {
+ pGeode->AccelImageWriteBuffers[i] = pGeode->FBBase + *offset;
+ *offset += pGeode->displayPitch;
+ *avail -= pGeode->displayPitch;
+ }
+ }
+ else {
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
+ "Not enough memory for image write buffers.\n");
+
+ for (i = 0; i < pGeode->NoOfImgBuffers; i++)
+ pGeode->AccelImageWriteBuffers[i] = NULL;
+ }
}
if (pGeode->NoOfColorExpandLines > 0) {
- pitch = ((pGeode->displayPitch + 31) >> 5) << 2;
- size = pitch * pGeode->NoOfColorExpandLines;
-
- if (size <= *avail) {
- for (i = 0; i < pGeode->NoOfColorExpandLines; i++) {
- pGeode->AccelColorExpandBuffers[i] = pGeode->FBBase + *offset;
- *offset += pitch;
- *avail -= pitch;
- }
- } else {
- xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
- "Not enough memory for color expansion buffers.\n");
-
- for (i = 0; i < pGeode->NoOfImgBuffers; i++)
- pGeode->AccelColorExpandBuffers[i] = NULL;
- }
+ pitch = ((pGeode->displayPitch + 31) >> 5) << 2;
+ size = pitch * pGeode->NoOfColorExpandLines;
+
+ if (size <= *avail) {
+ for (i = 0; i < pGeode->NoOfColorExpandLines; i++) {
+ pGeode->AccelColorExpandBuffers[i] = pGeode->FBBase + *offset;
+ *offset += pitch;
+ *avail -= pitch;
+ }
+ }
+ else {
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
+ "Not enough memory for color expansion buffers.\n");
+
+ for (i = 0; i < pGeode->NoOfImgBuffers; i++)
+ pGeode->AccelColorExpandBuffers[i] = NULL;
+ }
}
}
@@ -161,11 +163,11 @@ GXAllocateMemory(ScreenPtr pScrn, ScrnInfoPtr pScrni, int rotate)
BOOL ret = TRUE;
if (pGeode->tryCompression)
- pGeode->displayPitch =
- GeodeCalculatePitchBytes(pScrni->virtualX, pScrni->bitsPerPixel);
+ pGeode->displayPitch =
+ GeodeCalculatePitchBytes(pScrni->virtualX, pScrni->bitsPerPixel);
else
- pGeode->displayPitch =
- ((pScrni->virtualX + 3) & ~3) * (pScrni->bitsPerPixel >> 3);
+ pGeode->displayPitch =
+ ((pScrni->virtualX + 3) & ~3) * (pScrni->bitsPerPixel >> 3);
pGeode->Pitch = pGeode->displayPitch;
pGeode->displayWidth = pGeode->displayPitch / bytpp;
@@ -180,62 +182,65 @@ GXAllocateMemory(ScreenPtr pScrn, ScrnInfoPtr pScrni, int rotate)
fboffset += pGeode->displaySize;
if (pGeode->tryCompression) {
- size = pScrni->virtualY * GX_CB_PITCH;
+ size = pScrni->virtualY * GX_CB_PITCH;
- if (size <= fbavail) {
- pGeode->CBData.compression_offset = fboffset;
+ if (size <= fbavail) {
+ pGeode->CBData.compression_offset = fboffset;
- fboffset += size;
- fbavail -= size;
+ fboffset += size;
+ fbavail -= size;
- pGeode->Compression = TRUE;
- } else {
- xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
- "Not enough memory for compression\n");
- pGeode->Compression = FALSE;
- }
+ pGeode->Compression = TRUE;
+ }
+ else {
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
+ "Not enough memory for compression\n");
+ pGeode->Compression = FALSE;
+ }
}
if (pGeode->tryHWCursor) {
- if (fbavail >= 1024) {
- pGeode->CursorStartOffset = fboffset;
- fboffset += 1024;
- fbavail -= 1024;
- pGeode->HWCursor = TRUE;
- } else {
- xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
- "Not enough memory for the hardware cursor\n");
- pGeode->HWCursor = FALSE;
- }
+ if (fbavail >= 1024) {
+ pGeode->CursorStartOffset = fboffset;
+ fboffset += 1024;
+ fbavail -= 1024;
+ pGeode->HWCursor = TRUE;
+ }
+ else {
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
+ "Not enough memory for the hardware cursor\n");
+ pGeode->HWCursor = FALSE;
+ }
}
if (!pGeode->NoAccel) {
- if (pGeode->useEXA)
- GXInitEXAMemory(pScrni, &fboffset, &fbavail);
- else
- GXInitXAAMemory(pScrni, &fboffset, &fbavail);
+ if (pGeode->useEXA)
+ GXInitEXAMemory(pScrni, &fboffset, &fbavail);
+ else
+ GXInitXAAMemory(pScrni, &fboffset, &fbavail);
}
pGeode->shadowSize = 0;
if (rotate != RR_Rotate_0) {
- if (rotate & (RR_Rotate_90 | RR_Rotate_270))
- size = pGeode->displayPitch * pScrni->virtualX;
- else
- size = pGeode->displayPitch * pScrni->virtualY;
-
- if (size <= fbavail) {
- pGeode->shadowOffset = fboffset;
- pGeode->shadowSize = size;
-
- fboffset += size;
- fbavail -= size;
- } else {
- xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
- "Not enough memory for the shadow framebuffer\n");
- ret = FALSE;
- }
+ if (rotate & (RR_Rotate_90 | RR_Rotate_270))
+ size = pGeode->displayPitch * pScrni->virtualX;
+ else
+ size = pGeode->displayPitch * pScrni->virtualY;
+
+ if (size <= fbavail) {
+ pGeode->shadowOffset = fboffset;
+ pGeode->shadowSize = size;
+
+ fboffset += size;
+ fbavail -= size;
+ }
+ else {
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
+ "Not enough memory for the shadow framebuffer\n");
+ ret = FALSE;
+ }
}
/* XAA always exists - we can't remove it on demand like we can with EXA.
@@ -244,53 +249,56 @@ GXAllocateMemory(ScreenPtr pScrn, ScrnInfoPtr pScrni, int rotate)
if (!pGeode->NoAccel) {
- if (pGeode->useEXA && pGeode->pExa) {
- ExaDriverPtr pExa = pGeode->pExa;
+ if (pGeode->useEXA && pGeode->pExa) {
+ ExaDriverPtr pExa = pGeode->pExa;
- pExa->offScreenBase = fboffset;
- pExa->memorySize = fboffset + fbavail;
- }
+ pExa->offScreenBase = fboffset;
+ pExa->memorySize = fboffset + fbavail;
+ }
- if (!pGeode->useEXA) {
+ if (!pGeode->useEXA) {
- if (!xf86FBManagerRunning(pScrn)) {
+#if XF86XAA
+ if (!xf86FBManagerRunning(pScrn)) {
- unsigned int offset = fboffset;
- unsigned int avail = fbavail;
- RegionRec OffscreenRegion;
- BoxRec AvailBox;
+ unsigned int offset = fboffset;
+ unsigned int avail = fbavail;
+ RegionRec OffscreenRegion;
+ BoxRec AvailBox;
- /* Assume the shadow FB exists even if it doesnt */
+ /* Assume the shadow FB exists even if it doesnt */
- if (pGeode->shadowSize == 0) {
- size = (pScrn->width * bytpp) * pScrni->virtualX;
- offset += size;
- avail -= size;
- }
+ if (pGeode->shadowSize == 0) {
+ size = (pScrn->width * bytpp) * pScrni->virtualX;
+ offset += size;
+ avail -= size;
+ }
- AvailBox.x1 = 0;
- AvailBox.y1 =
- (offset + pGeode->displayPitch -
- 1) / pGeode->displayPitch;
+ AvailBox.x1 = 0;
+ AvailBox.y1 =
+ (offset + pGeode->displayPitch - 1) / pGeode->displayPitch;
- AvailBox.x2 = pGeode->displayWidth;
- AvailBox.y2 = (offset + avail) / pGeode->displayPitch;
+ AvailBox.x2 = pGeode->displayWidth;
+ AvailBox.y2 = (offset + avail) / pGeode->displayPitch;
- if (AvailBox.y1 < AvailBox.y2) {
- REGION_INIT(pScrn, &OffscreenRegion, &AvailBox, 2);
+ if (AvailBox.y1 < AvailBox.y2) {
+ REGION_INIT(pScrn, &OffscreenRegion, &AvailBox, 2);
- if (!xf86InitFBManagerRegion(pScrn, &OffscreenRegion))
- xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
- "Memory manager initialization failed.\n");
+ if (!xf86InitFBManagerRegion(pScrn, &OffscreenRegion))
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
+ "Memory manager initialization failed.\n");
- REGION_UNINIT(pScrn, &OffscreenRegion);
- } else
- xf86DrvMsg(pScrni->scrnIndex, X_INFO,
- "Cache disabled - no offscreen memory available.\n");
- } else
- xf86DrvMsg(pScrni->scrnIndex, X_INFO,
- "XAA offscreen memory has already been allocated.\n");
- }
+ REGION_UNINIT(pScrn, &OffscreenRegion);
+ }
+ else
+ xf86DrvMsg(pScrni->scrnIndex, X_INFO,
+ "Cache disabled - no offscreen memory available.\n");
+ }
+ else
+ xf86DrvMsg(pScrni->scrnIndex, X_INFO,
+ "XAA offscreen memory has already been allocated.\n");
+#endif
+ }
}
return ret;
}
@@ -298,11 +306,11 @@ GXAllocateMemory(ScreenPtr pScrn, ScrnInfoPtr pScrni, int rotate)
static Bool
GXSaveScreen(ScreenPtr pScrn, int mode)
{
- ScrnInfoPtr pScrni = xf86Screens[pScrn->myNum];
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScrn);
GeodePtr pGeode = GEODEPTR(pScrni);
if (pGeode->useVGA && !pScrni->vtSema)
- return vgaHWSaveScreen(pScrn, mode);
+ return vgaHWSaveScreen(pScrn, mode);
return TRUE;
}
@@ -311,21 +319,21 @@ GXSaveScreen(ScreenPtr pScrn, int mode)
#ifdef XSERVER_LIBPCIACCESS
static inline void *
map_pci_mem(ScrnInfoPtr pScrni, int vram,
- struct pci_device *dev, int bar, int size)
+ struct pci_device *dev, int bar, int size)
{
void *ptr;
- void **result = (void **)&ptr;
+ void **result = (void **) &ptr;
int map_size = size ? size : dev->regions[bar].size;
int err = pci_device_map_range(dev,
- dev->regions[bar].base_addr,
- map_size,
- PCI_DEV_MAP_FLAG_WRITABLE |
- (vram ? PCI_DEV_MAP_FLAG_WRITE_COMBINE : 0),
- result);
+ dev->regions[bar].base_addr,
+ map_size,
+ PCI_DEV_MAP_FLAG_WRITABLE |
+ (vram ? PCI_DEV_MAP_FLAG_WRITE_COMBINE : 0),
+ result);
if (err)
- return NULL;
+ return NULL;
return ptr;
}
#endif
@@ -341,17 +349,21 @@ GXMapMem(ScrnInfoPtr pScrni)
pciVideoPtr pci = xf86GetPciInfoForEntity(pGeode->pEnt->index);
#ifndef XSERVER_LIBPCIACCESS
- gfx_virt_regptr = (unsigned char *)xf86MapVidMem(index, VIDMEM_MMIO,
- pci->memBase[2], pci->size[2]);
+ gfx_virt_regptr = (unsigned char *) xf86MapVidMem(index, VIDMEM_MMIO,
+ pci->memBase[2],
+ pci->size[2]);
- gfx_virt_gpptr = (unsigned char *)xf86MapVidMem(index, VIDMEM_MMIO,
- pci->memBase[1], pci->size[1]);
+ gfx_virt_gpptr = (unsigned char *) xf86MapVidMem(index, VIDMEM_MMIO,
+ pci->memBase[1],
+ pci->size[1]);
- gfx_virt_vidptr = (unsigned char *)xf86MapVidMem(index, VIDMEM_MMIO,
- pci->memBase[3], pci->size[3]);
+ gfx_virt_vidptr = (unsigned char *) xf86MapVidMem(index, VIDMEM_MMIO,
+ pci->memBase[3],
+ pci->size[3]);
- gfx_virt_fbptr = (unsigned char *)xf86MapVidMem(index, VIDMEM_FRAMEBUFFER,
- pci->memBase[0], pGeode->FBAvail);
+ gfx_virt_fbptr = (unsigned char *) xf86MapVidMem(index, VIDMEM_FRAMEBUFFER,
+ pci->memBase[0],
+ pGeode->FBAvail);
#else
gfx_virt_regptr = map_pci_mem(pScrni, 0, pci, 2, 0);
gfx_virt_gpptr = map_pci_mem(pScrni, 0, pci, 1, 0);
@@ -366,14 +378,14 @@ GXMapMem(ScrnInfoPtr pScrni)
pGeode->FBBase = gfx_virt_fbptr;
if ((!gfx_virt_regptr) || (!gfx_virt_gpptr) ||
- (!gfx_virt_vidptr) || (!gfx_virt_fbptr))
- return FALSE;
+ (!gfx_virt_vidptr) || (!gfx_virt_fbptr))
+ return FALSE;
if (!pGeode->NoAccel && pGeode->useEXA)
- pGeode->pExa->memoryBase = pGeode->FBBase;
+ pGeode->pExa->memoryBase = pGeode->FBBase;
xf86DrvMsg(index, X_INFO, "Found Geode %x %p\n",
- pGeode->FBAvail, pGeode->FBBase);
+ pGeode->FBAvail, pGeode->FBBase);
return TRUE;
}
@@ -391,11 +403,11 @@ GXCheckVGA(ScrnInfoPtr pScrni)
int ret;
ptr =
- xf86MapVidMem(pScrni->scrnIndex, VIDMEM_FRAMEBUFFER, 0xC001E,
- strlen(vgasig));
+ xf86MapVidMem(pScrni->scrnIndex, VIDMEM_FRAMEBUFFER, 0xC001E,
+ strlen(vgasig));
if (ptr == NULL)
- return FALSE;
+ return FALSE;
ret = memcmp(ptr, vgasig, strlen(vgasig));
xf86UnMapVidMem(pScrni->scrnIndex, (pointer) ptr, strlen(vgasig));
@@ -418,24 +430,24 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
Bool useVGA;
if (pScrni->numEntities != 1)
- return FALSE;
+ return FALSE;
pEnt = xf86GetEntityInfo(pScrni->entityList[0]);
#ifndef XSERVER_LIBPCIACCESS
if (pEnt->resources)
- return FALSE;
+ return FALSE;
#endif
pGeode = pScrni->driverPrivate = xnfcalloc(1, sizeof(GeodeRec));
if (pGeode == NULL)
- return FALSE;
+ return FALSE;
useVGA = GXCheckVGA(pScrni);
if (flags & PROBE_DETECT) {
- GeodeProbeDDC(pScrni, pEnt->index);
- return TRUE;
+ GeodeProbeDDC(pScrni, pEnt->index);
+ return TRUE;
}
/* Probe for VGA */
@@ -443,13 +455,13 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
pGeode->pEnt = pEnt;
if (pGeode->useVGA) {
- if (!xf86LoadSubModule(pScrni, "vgahw") || !vgaHWGetHWRec(pScrni))
- pGeode->useVGA = FALSE;
- else
- vgaHWSetStdFuncs(VGAHWPTR(pScrni));
+ if (!xf86LoadSubModule(pScrni, "vgahw") || !vgaHWGetHWRec(pScrni))
+ pGeode->useVGA = FALSE;
+ else
+ vgaHWSetStdFuncs(VGAHWPTR(pScrni));
#if INT10_SUPPORT
- pGeode->vesa = calloc(1, sizeof(VESARec));
+ pGeode->vesa = calloc(1, sizeof(VESARec));
#endif
}
@@ -458,48 +470,49 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
ret = gfx_msr_read(RC_ID_DF, MBD_MSR_CONFIG, &msrValue);
if (!ret) {
- pGeode->Output =
- ((msrValue.low & RCDF_CONFIG_FMT_MASK) ==
- RCDF_CONFIG_FMT_FP) ? OUTPUT_PANEL : OUTPUT_CRT;
+ pGeode->Output =
+ ((msrValue.low & RCDF_CONFIG_FMT_MASK) ==
+ RCDF_CONFIG_FMT_FP) ? OUTPUT_PANEL : OUTPUT_CRT;
}
/* Fill in the monitor information */
pScrni->monitor = pScrni->confScreen->monitor;
if (!xf86SetDepthBpp(pScrni, 16, 16, 16, Support24bppFb | Support32bppFb))
- return FALSE;
+ return FALSE;
switch (pScrni->depth) {
case 8:
- pScrni->rgbBits = 8;
+ pScrni->rgbBits = 8;
case 16:
case 24:
case 32:
- break;
+ break;
default:
- xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
- "The driver does not support %d as a depth.\n", pScrni->depth);
- return FALSE;
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
+ "The driver does not support %d as a depth.\n",
+ pScrni->depth);
+ return FALSE;
}
xf86PrintDepthBpp(pScrni);
if (!xf86SetWeight(pScrni, defaultWeight, defaultWeight))
- return FALSE;
+ return FALSE;
if (!xf86SetDefaultVisual(pScrni, -1))
- return FALSE;
+ return FALSE;
/*
* If the driver can do gamma correction, it should call xf86SetGamma()
* here.
*/
{
- Gamma zeros = { 0.0, 0.0, 0.0 };
+ Gamma zeros = { 0.0, 0.0, 0.0 };
- if (!xf86SetGamma(pScrni, zeros)) {
- return FALSE;
- }
+ if (!xf86SetGamma(pScrni, zeros)) {
+ return FALSE;
+ }
}
pScrni->progClock = TRUE;
@@ -521,94 +534,92 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
pGeode->NoOfColorExpandLines = DEFAULT_CLR_LINE_BUFS;
pGeode->exaBfrSz = DEFAULT_EXA_SCRATCH_BFRSZ;
- xf86GetOptValBool(GeodeOptions, GX_OPTION_HW_CURSOR,
- &pGeode->tryHWCursor);
+ xf86GetOptValBool(GeodeOptions, GX_OPTION_HW_CURSOR, &pGeode->tryHWCursor);
if (!xf86GetOptValInteger(GeodeOptions, GX_OPTION_FBSIZE,
- (int *)&(pGeode->FBAvail)))
- pGeode->FBAvail = 0;
+ (int *) &(pGeode->FBAvail)))
+ pGeode->FBAvail = 0;
/* For compatability - allow SWCursor too */
if (xf86ReturnOptValBool(GeodeOptions, GX_OPTION_SW_CURSOR, FALSE))
- pGeode->tryHWCursor = FALSE;
+ pGeode->tryHWCursor = FALSE;
if (xf86ReturnOptValBool(GeodeOptions, GX_OPTION_NOCOMPRESSION, FALSE))
- pGeode->tryCompression = FALSE;
+ pGeode->tryCompression = FALSE;
if (xf86ReturnOptValBool(GeodeOptions, GX_OPTION_NOACCEL, FALSE))
- pGeode->NoAccel = TRUE;
+ pGeode->NoAccel = TRUE;
pGeode->rotation = RR_Rotate_0;
if ((s = xf86GetOptValString(GeodeOptions, GX_OPTION_ROTATE))) {
- if (!xf86NameCmp(s, "LEFT"))
- pGeode->rotation = RR_Rotate_90;
- else if (!xf86NameCmp(s, "INVERT"))
- pGeode->rotation = RR_Rotate_180;
- else if (!xf86NameCmp(s, "CCW"))
- pGeode->rotation = RR_Rotate_270;
- else
- xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
- "Invalid rotation %s.\n", s);
+ if (!xf86NameCmp(s, "LEFT"))
+ pGeode->rotation = RR_Rotate_90;
+ else if (!xf86NameCmp(s, "INVERT"))
+ pGeode->rotation = RR_Rotate_180;
+ else if (!xf86NameCmp(s, "CCW"))
+ pGeode->rotation = RR_Rotate_270;
+ else
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR, "Invalid rotation %s.\n", s);
}
xf86GetOptValInteger(GeodeOptions, GX_OPTION_OSM_IMG_BUFS,
- &(pGeode->NoOfImgBuffers));
+ &(pGeode->NoOfImgBuffers));
if (pGeode->NoOfImgBuffers <= 0)
- pGeode->NoOfImgBuffers = 0;
+ pGeode->NoOfImgBuffers = 0;
xf86GetOptValInteger(GeodeOptions, GX_OPTION_OSM_CLR_BUFS,
- &(pGeode->NoOfColorExpandLines));
+ &(pGeode->NoOfColorExpandLines));
if (pGeode->NoOfColorExpandLines <= 0)
- pGeode->NoOfColorExpandLines = 0;
+ pGeode->NoOfColorExpandLines = 0;
xf86GetOptValInteger(GeodeOptions, GX_OPTION_OSM_CLR_BUFS,
- (int *)&(pGeode->exaBfrSz));
+ (int *) &(pGeode->exaBfrSz));
if (pGeode->exaBfrSz <= 0)
- pGeode->exaBfrSz = 0;
+ pGeode->exaBfrSz = 0;
if (pGeode->Panel == TRUE) {
- if (xf86ReturnOptValBool(GeodeOptions, GX_OPTION_NOPANEL, FALSE))
- pGeode->Panel = FALSE;
+ if (xf86ReturnOptValBool(GeodeOptions, GX_OPTION_NOPANEL, FALSE))
+ pGeode->Panel = FALSE;
}
panelgeo = xf86GetOptValString(GeodeOptions, GX_OPTION_PANEL_GEOMETRY);
if ((s = xf86GetOptValString(GeodeOptions, GX_OPTION_ACCEL_METHOD))) {
- if (!xf86NameCmp(s, "XAA"))
- pGeode->useEXA = FALSE;
- else if (xf86NameCmp(s, "EXA"))
- xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
- "Unknown accleration method %s. Defaulting to XAA.\n", s);
+ if (!xf86NameCmp(s, "XAA"))
+ pGeode->useEXA = FALSE;
+ else if (xf86NameCmp(s, "EXA"))
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
+ "Unknown accleration method %s. Defaulting to XAA.\n",
+ s);
}
xf86DrvMsg(pScrni->scrnIndex, X_INFO,
- "Using %s acceleration architecture\n",
- pGeode->useEXA ? "EXA" : "XAA");
+ "Using %s acceleration architecture\n",
+ pGeode->useEXA ? "EXA" : "XAA");
/* Set up the panel */
if (pGeode->Panel) {
- if (panelgeo != NULL) {
- if (GeodeGetFPGeometry(panelgeo, &pGeode->PanelX,
- &pGeode->PanelY))
- pGeode->Panel = FALSE;
- }
+ if (panelgeo != NULL) {
+ if (GeodeGetFPGeometry(panelgeo, &pGeode->PanelX, &pGeode->PanelY))
+ pGeode->Panel = FALSE;
+ }
#ifdef PNL_SUP
- else {
- int b, f;
+ else {
+ int b, f;
- /* The bitdepth and refresh isn't used anywhere else in the driver */
+ /* The bitdepth and refresh isn't used anywhere else in the driver */
- if ((pGeode->Panel = Pnl_IsPanelEnabledInBIOS()))
- Pnl_GetPanelInfoFromBIOS(&pGeode->PanelX, &pGeode->PanelY, &b,
- &f);
- }
+ if ((pGeode->Panel = Pnl_IsPanelEnabledInBIOS()))
+ Pnl_GetPanelInfoFromBIOS(&pGeode->PanelX, &pGeode->PanelY, &b,
+ &f);
+ }
#endif
}
@@ -616,18 +627,18 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
if (pGeode->useVGA) {
#if INT10_SUPPORT
- VESARec *pVesa;
+ VESARec *pVesa;
- if (!xf86LoadSubModule(pScrni, "int10"))
- return FALSE;
+ if (!xf86LoadSubModule(pScrni, "int10"))
+ return FALSE;
- pVesa = pGeode->vesa;
+ pVesa = pGeode->vesa;
- if ((pVesa->pInt = xf86InitInt10(pGeode->pEnt->index)) == NULL) {
- xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
- "Unable to initialize 1NT10 support\n");
- pGeode->useVGA = FALSE;
- }
+ if ((pVesa->pInt = xf86InitInt10(pGeode->pEnt->index)) == NULL) {
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
+ "Unable to initialize 1NT10 support\n");
+ pGeode->useVGA = FALSE;
+ }
#endif
}
@@ -637,19 +648,19 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
*/
if (pGeode->FBAvail == 0) {
- if (GeodeGetSizeFromFB(&pGeode->FBAvail))
- pGeode->FBAvail = gfx_get_frame_buffer_size();
+ if (GeodeGetSizeFromFB(&pGeode->FBAvail))
+ pGeode->FBAvail = gfx_get_frame_buffer_size();
}
if (pScrni->memPhysBase == 0)
- pScrni->memPhysBase = gfx_get_frame_buffer_base();
+ pScrni->memPhysBase = gfx_get_frame_buffer_base();
pScrni->fbOffset = 0;
if (pGeode->pEnt->device->videoRam == 0)
- pScrni->videoRam = pGeode->FBAvail / 1024;
+ pScrni->videoRam = pGeode->FBAvail / 1024;
else
- pScrni->videoRam = pGeode->pEnt->device->videoRam;
+ pScrni->videoRam = pGeode->pEnt->device->videoRam;
GeodeClockRange = (ClockRangePtr) xnfcalloc(1, sizeof(ClockRange));
GeodeClockRange->next = NULL;
@@ -664,24 +675,25 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
/* I'm still not 100% sure this uses the right values */
modecnt = xf86ValidateModes(pScrni,
- pScrni->monitor->Modes,
- pScrni->display->modes,
- GeodeClockRange,
- NULL, GX_MIN_PITCH, GX_MAX_PITCH,
- 32, GX_MIN_HEIGHT, GX_MAX_HEIGHT,
- pScrni->display->virtualX,
- pScrni->display->virtualY, pGeode->FBAvail, LOOKUP_BEST_REFRESH);
+ pScrni->monitor->Modes,
+ pScrni->display->modes,
+ GeodeClockRange,
+ NULL, GX_MIN_PITCH, GX_MAX_PITCH,
+ 32, GX_MIN_HEIGHT, GX_MAX_HEIGHT,
+ pScrni->display->virtualX,
+ pScrni->display->virtualY, pGeode->FBAvail,
+ LOOKUP_BEST_REFRESH);
if (modecnt <= 0) {
- xf86DrvMsg(pScrni->scrnIndex, X_ERROR, "No valid modes were found\n");
- return FALSE;
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR, "No valid modes were found\n");
+ return FALSE;
}
xf86PruneDriverModes(pScrni);
if (pScrni->modes == NULL) {
- xf86DrvMsg(pScrni->scrnIndex, X_ERROR, "No valid modes were found\n");
- return FALSE;
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR, "No valid modes were found\n");
+ return FALSE;
}
xf86SetCrtcForModes(pScrni, 0);
@@ -693,28 +705,28 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
/* Load the modules we'll need */
if (xf86LoadSubModule(pScrni, "fb") == NULL) {
- return FALSE;
+ return FALSE;
}
if (pGeode->NoAccel == FALSE) {
- const char *module = (pGeode->useEXA) ? "exa" : "xaa";
+ const char *module = (pGeode->useEXA) ? "exa" : "xaa";
- if (!xf86LoadSubModule(pScrni, module)) {
- return FALSE;
- }
+ if (!xf86LoadSubModule(pScrni, module)) {
+ return FALSE;
+ }
}
if (pGeode->tryHWCursor == TRUE) {
- if (!xf86LoadSubModule(pScrni, "ramdac")) {
- return FALSE;
- }
+ if (!xf86LoadSubModule(pScrni, "ramdac")) {
+ return FALSE;
+ }
}
#ifndef XSERVER_LIBPCIACCESS
if (xf86RegisterResources(pGeode->pEnt->index, NULL, ResExclusive)) {
- xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
- "Couldn't register the resources.\n");
- return FALSE;
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
+ "Couldn't register the resources.\n");
+ return FALSE;
}
#endif
return TRUE;
@@ -726,11 +738,11 @@ GXRestore(ScrnInfoPtr pScrni)
GeodeRec *pGeode = GEODEPTR(pScrni);
if (pGeode->useVGA && pGeode->FBVGAActive) {
- vgaHWPtr pvgaHW = VGAHWPTR(pScrni);
+ vgaHWPtr pvgaHW = VGAHWPTR(pScrni);
- vgaHWProtect(pScrni, TRUE);
- vgaHWRestore(pScrni, &pvgaHW->SavedReg, VGA_SR_ALL);
- vgaHWProtect(pScrni, FALSE);
+ vgaHWProtect(pScrni, TRUE);
+ vgaHWRestore(pScrni, &pvgaHW->SavedReg, VGA_SR_ALL);
+ vgaHWProtect(pScrni, FALSE);
}
}
@@ -754,13 +766,13 @@ GXSetDvLineSize(unsigned int pitch)
unsigned long temp, dv_size = MDC_DV_LINE_SIZE_1024;
if (pitch > 1024) {
- dv_size = MDC_DV_LINE_SIZE_2048;
+ dv_size = MDC_DV_LINE_SIZE_2048;
}
if (pitch > 2048) {
- dv_size = MDC_DV_LINE_SIZE_4096;
+ dv_size = MDC_DV_LINE_SIZE_4096;
}
if (pitch > 4096) {
- dv_size = MDC_DV_LINE_SIZE_8192;
+ dv_size = MDC_DV_LINE_SIZE_8192;
}
/* WRITE DIRTY/VALID CONTROL WITH LINE LENGTH */
@@ -772,9 +784,9 @@ GXSetDvLineSize(unsigned int pitch)
/* XXX - this is nothing like the original function - not sure exactly what the purpose is for this quite yet */
static void
-GXAdjustFrame(int scrnIndex, int x, int y, int flags)
+GXAdjustFrame(ADJUST_FRAME_ARGS_DECL)
{
- ScrnInfoPtr pScrni = xf86Screens[scrnIndex];
+ SCRN_INFO_PTR(arg);
GeodeRec *pGeode = GEODEPTR(pScrni);
unsigned long offset;
@@ -795,38 +807,40 @@ GXSetVideoMode(ScrnInfoPtr pScrni, DisplayModePtr pMode)
gx_disable_dac_power();
if (pMode->Flags & V_NHSYNC)
- flags |= 1;
+ flags |= 1;
if (pMode->Flags & V_NVSYNC)
- flags |= 2;
+ flags |= 2;
/* Check to see if we should use custom or built-in timings */
if (pGeode->Panel)
- custom = (pMode->type & M_T_USERDEF);
+ custom = (pMode->type & M_T_USERDEF);
else
- custom = !(pMode->type & (M_T_BUILTIN | M_T_DEFAULT));
+ custom = !(pMode->type & (M_T_BUILTIN | M_T_DEFAULT));
/* If we're not doing a custom mode, then just set the fixed timings,
* otherwise, do the whole shooting match */
if (!custom) {
- GFX(set_fixed_timings(pGeode->PanelX, pGeode->PanelY,
- pMode->CrtcHDisplay, pMode->CrtcVDisplay,
- pScrni->bitsPerPixel));
- } else {
- if (pGeode->Panel)
- GFX(set_panel_present(pGeode->PanelX, pGeode->PanelY,
- pMode->CrtcHDisplay, pMode->CrtcVDisplay,
- pScrni->bitsPerPixel));
-
- GFX(set_display_timings(pScrni->bitsPerPixel, flags,
- pMode->CrtcHDisplay, pMode->CrtcHBlankStart,
- pMode->CrtcHSyncStart, pMode->CrtcHSyncEnd,
- pMode->CrtcHBlankEnd, pMode->CrtcHTotal,
- pMode->CrtcVDisplay, pMode->CrtcVBlankStart,
- pMode->CrtcVSyncStart, pMode->CrtcVSyncEnd,
- pMode->CrtcVBlankEnd, pMode->CrtcVTotal,
- (int)((pMode->SynthClock / 1000.0) * 0x10000)));
+ GFX(set_fixed_timings(pGeode->PanelX, pGeode->PanelY,
+ pMode->CrtcHDisplay, pMode->CrtcVDisplay,
+ pScrni->bitsPerPixel));
+ }
+ else {
+ if (pGeode->Panel)
+ GFX(set_panel_present(pGeode->PanelX, pGeode->PanelY,
+ pMode->CrtcHDisplay, pMode->CrtcVDisplay,
+ pScrni->bitsPerPixel));
+
+ GFX(set_display_timings(pScrni->bitsPerPixel, flags,
+ pMode->CrtcHDisplay, pMode->CrtcHBlankStart,
+ pMode->CrtcHSyncStart, pMode->CrtcHSyncEnd,
+ pMode->CrtcHBlankEnd, pMode->CrtcHTotal,
+ pMode->CrtcVDisplay, pMode->CrtcVBlankStart,
+ pMode->CrtcVSyncStart, pMode->CrtcVSyncEnd,
+ pMode->CrtcVBlankEnd, pMode->CrtcVTotal,
+ (int) ((pMode->SynthClock / 1000.0) *
+ 0x10000)));
}
GFX(set_crt_enable(CRT_ENABLE));
@@ -835,34 +849,35 @@ GXSetVideoMode(ScrnInfoPtr pScrni, DisplayModePtr pMode)
GFX(wait_vertical_blank());
if (pGeode->Compression) {
- GXSetDvLineSize(pGeode->Pitch);
+ GXSetDvLineSize(pGeode->Pitch);
- gfx_set_compression_offset(pGeode->CBData.compression_offset);
- gfx_set_compression_pitch(GX_CB_PITCH);
- gfx_set_compression_size(GX_CB_SIZE);
+ gfx_set_compression_offset(pGeode->CBData.compression_offset);
+ gfx_set_compression_pitch(GX_CB_PITCH);
+ gfx_set_compression_size(GX_CB_SIZE);
- gfx_set_compression_enable(1);
+ gfx_set_compression_enable(1);
}
if (pGeode->HWCursor && !(pMode->Flags & V_DBLSCAN)) {
- GXLoadCursorImage(pScrni, NULL);
- GFX(set_cursor_position(pGeode->CursorStartOffset, 0, 0, 0, 0));
- GXShowCursor(pScrni);
- } else {
- GFX(set_cursor_enable(0));
- pGeode->HWCursor = FALSE;
+ GXLoadCursorImage(pScrni, NULL);
+ GFX(set_cursor_position(pGeode->CursorStartOffset, 0, 0, 0, 0));
+ GXShowCursor(pScrni);
+ }
+ else {
+ GFX(set_cursor_enable(0));
+ pGeode->HWCursor = FALSE;
}
- GXAdjustFrame(pScrni->scrnIndex, pScrni->frameX0, pScrni->frameY0, 0);
+ GXAdjustFrame(ADJUST_FRAME_ARGS(pScrni->frameX0, pScrni->frameY0));
gx_enable_dac_power();
return TRUE;
}
static Bool
-GXSwitchMode(int index, DisplayModePtr pMode, int flags)
+GXSwitchMode(SWITCH_MODE_ARGS_DECL)
{
- ScrnInfoPtr pScrni = xf86Screens[index];
+ SCRN_INFO_PTR(arg);
GeodeRec *pGeode = GEODEPTR(pScrni);
int ret = TRUE;
int rotate;
@@ -876,21 +891,22 @@ GXSwitchMode(int index, DisplayModePtr pMode, int flags)
ret = GXAllocateMemory(pScrni->pScreen, pScrni, rotate);
if (ret) {
- if (pGeode->curMode != pMode)
- ret = GXSetVideoMode(pScrni, pMode);
+ if (pGeode->curMode != pMode)
+ ret = GXSetVideoMode(pScrni, pMode);
}
if (ret)
- ret = GXRotate(pScrni, pMode);
+ ret = GXRotate(pScrni, pMode);
/* Go back the way it was */
if (ret == FALSE) {
- if (!GXSetVideoMode(pScrni, pGeode->curMode))
- xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
- "Could not restore the previous mode\n");
- } else
- pGeode->curMode = pMode;
+ if (!GXSetVideoMode(pScrni, pGeode->curMode))
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
+ "Could not restore the previous mode\n");
+ }
+ else
+ pGeode->curMode = pMode;
return ret;
}
@@ -904,29 +920,29 @@ GXLeaveGraphics(ScrnInfoPtr pScrni)
/* Restore VG registers */
gfx_set_display_timings(pGeode->FBgfxdisplaytiming.wBpp,
- pGeode->FBgfxdisplaytiming.wPolarity,
- pGeode->FBgfxdisplaytiming.wHActive,
- pGeode->FBgfxdisplaytiming.wHBlankStart,
- pGeode->FBgfxdisplaytiming.wHSyncStart,
- pGeode->FBgfxdisplaytiming.wHSyncEnd,
- pGeode->FBgfxdisplaytiming.wHBlankEnd,
- pGeode->FBgfxdisplaytiming.wHTotal,
- pGeode->FBgfxdisplaytiming.wVActive,
- pGeode->FBgfxdisplaytiming.wVBlankStart,
- pGeode->FBgfxdisplaytiming.wVSyncStart,
- pGeode->FBgfxdisplaytiming.wVSyncEnd,
- pGeode->FBgfxdisplaytiming.wVBlankEnd,
- pGeode->FBgfxdisplaytiming.wVTotal,
- pGeode->FBgfxdisplaytiming.dwDotClock);
+ pGeode->FBgfxdisplaytiming.wPolarity,
+ pGeode->FBgfxdisplaytiming.wHActive,
+ pGeode->FBgfxdisplaytiming.wHBlankStart,
+ pGeode->FBgfxdisplaytiming.wHSyncStart,
+ pGeode->FBgfxdisplaytiming.wHSyncEnd,
+ pGeode->FBgfxdisplaytiming.wHBlankEnd,
+ pGeode->FBgfxdisplaytiming.wHTotal,
+ pGeode->FBgfxdisplaytiming.wVActive,
+ pGeode->FBgfxdisplaytiming.wVBlankStart,
+ pGeode->FBgfxdisplaytiming.wVSyncStart,
+ pGeode->FBgfxdisplaytiming.wVSyncEnd,
+ pGeode->FBgfxdisplaytiming.wVBlankEnd,
+ pGeode->FBgfxdisplaytiming.wVTotal,
+ pGeode->FBgfxdisplaytiming.dwDotClock);
gfx_set_compression_enable(0);
/* Restore the previous Compression state */
if (pGeode->FBCompressionEnable) {
- gfx_set_compression_offset(pGeode->FBCompressionOffset);
- gfx_set_compression_pitch(pGeode->FBCompressionPitch);
- gfx_set_compression_size(pGeode->FBCompressionSize);
- gfx_set_compression_enable(1);
+ gfx_set_compression_offset(pGeode->FBCompressionOffset);
+ gfx_set_compression_pitch(pGeode->FBCompressionPitch);
+ gfx_set_compression_size(pGeode->FBCompressionSize);
+ gfx_set_compression_enable(1);
}
gfx_set_display_pitch(pGeode->FBgfxdisplaytiming.wPitch);
@@ -937,11 +953,11 @@ GXLeaveGraphics(ScrnInfoPtr pScrni)
gfx_set_cursor_position(pGeode->FBCursorOffset, 0, 0, 0, 0);
if (pGeode->useVGA) {
- pGeode->vesa->pInt->num = 0x10;
- pGeode->vesa->pInt->ax = 0x0 | pGeode->FBBIOSMode;
- pGeode->vesa->pInt->bx = 0;
- xf86ExecX86int10(pGeode->vesa->pInt);
- gfx_delay_milliseconds(3);
+ pGeode->vesa->pInt->num = 0x10;
+ pGeode->vesa->pInt->ax = 0x0 | pGeode->FBBIOSMode;
+ pGeode->vesa->pInt->bx = 0;
+ xf86ExecX86int10(pGeode->vesa->pInt);
+ gfx_delay_milliseconds(3);
}
GXRestore(pScrni);
@@ -950,32 +966,34 @@ GXLeaveGraphics(ScrnInfoPtr pScrni)
}
static Bool
-GXCloseScreen(int scrnIndex, ScreenPtr pScrn)
+GXCloseScreen(CLOSE_SCREEN_ARGS_DECL)
{
- ScrnInfoPtr pScrni = xf86Screens[scrnIndex];
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScrn);
GeodeRec *pGeode = GEODEPTR(pScrni);
if (pScrni->vtSema)
- GXLeaveGraphics(pScrni);
+ GXLeaveGraphics(pScrni);
+#ifdef XF86XAA
if (pGeode->AccelInfoRec)
- XAADestroyInfoRec(pGeode->AccelInfoRec);
+ XAADestroyInfoRec(pGeode->AccelInfoRec);
+#endif
if (pGeode->AccelImageWriteBuffers) {
- free(pGeode->AccelImageWriteBuffers[0]);
- free(pGeode->AccelImageWriteBuffers);
- pGeode->AccelImageWriteBuffers = NULL;
+ free(pGeode->AccelImageWriteBuffers[0]);
+ free(pGeode->AccelImageWriteBuffers);
+ pGeode->AccelImageWriteBuffers = NULL;
}
if (pGeode->AccelColorExpandBuffers) {
- free(pGeode->AccelColorExpandBuffers);
- pGeode->AccelColorExpandBuffers = NULL;
+ free(pGeode->AccelColorExpandBuffers);
+ pGeode->AccelColorExpandBuffers = NULL;
}
if (pGeode->pExa) {
- exaDriverFini(pScrn);
- free(pGeode->pExa);
- pGeode->pExa = NULL;
+ exaDriverFini(pScrn);
+ free(pGeode->pExa);
+ pGeode->pExa = NULL;
}
pScrni->vtSema = FALSE;
@@ -986,7 +1004,7 @@ GXCloseScreen(int scrnIndex, ScreenPtr pScrn)
pScrn->CloseScreen = pGeode->CloseScreen;
if (pScrn->CloseScreen)
- return (*pScrn->CloseScreen) (scrnIndex, pScrn);
+ return (*pScrn->CloseScreen) (CLOSE_SCREEN_ARGS);
return TRUE;
}
@@ -997,10 +1015,10 @@ GXEnterGraphics(ScreenPtr pScrn, ScrnInfoPtr pScrni)
GeodeRec *pGeode = GEODEPTR(pScrni);
if (!GXMapMem(pScrni))
- return FALSE;
+ return FALSE;
if (pGeode->useVGA)
- pGeode->FBVGAActive = gu2_get_vga_active();
+ pGeode->FBVGAActive = gu2_get_vga_active();
gfx_wait_until_idle();
@@ -1026,9 +1044,9 @@ GXEnterGraphics(ScreenPtr pScrn, ScrnInfoPtr pScrni)
pGeode->FBDisplayOffset = gfx_get_display_offset();
if (pGeode->useVGA) {
- vgaHWPtr pvgaHW = VGAHWPTR(pScrni);
+ vgaHWPtr pvgaHW = VGAHWPTR(pScrni);
- pGeode->FBBIOSMode = pvgaHW->readCrtc(pvgaHW, 0x040);
+ pGeode->FBBIOSMode = pvgaHW->readCrtc(pvgaHW, 0x040);
}
pGeode->FBCompressionEnable = gfx_get_compression_enable();
@@ -1043,37 +1061,37 @@ GXEnterGraphics(ScreenPtr pScrn, ScrnInfoPtr pScrni)
/* Turn off the VGA */
if (pGeode->useVGA && pGeode->FBVGAActive) {
- unsigned short sequencer;
- vgaHWPtr pvgaHW = VGAHWPTR(pScrni);
+ unsigned short sequencer;
+ vgaHWPtr pvgaHW = VGAHWPTR(pScrni);
- /* Map VGA aperture */
- if (!vgaHWMapMem(pScrni))
- return FALSE;
+ /* Map VGA aperture */
+ if (!vgaHWMapMem(pScrni))
+ return FALSE;
- /* Unlock VGA registers */
- vgaHWUnlock(pvgaHW);
+ /* Unlock VGA registers */
+ vgaHWUnlock(pvgaHW);
- /* Save the current state and setup the current mode */
- vgaHWSave(pScrni, &VGAHWPTR(pScrni)->SavedReg, VGA_SR_ALL);
+ /* Save the current state and setup the current mode */
+ vgaHWSave(pScrni, &VGAHWPTR(pScrni)->SavedReg, VGA_SR_ALL);
- /* DISABLE VGA SEQUENCER */
- /* This allows the VGA state machine to terminate. We must delay */
- /* such that there are no pending MBUS requests. */
+ /* DISABLE VGA SEQUENCER */
+ /* This allows the VGA state machine to terminate. We must delay */
+ /* such that there are no pending MBUS requests. */
- gfx_outb(MDC_SEQUENCER_INDEX, MDC_SEQUENCER_CLK_MODE);
- sequencer = gfx_inb(MDC_SEQUENCER_DATA);
- sequencer |= MDC_CLK_MODE_SCREEN_OFF;
- gfx_outb(MDC_SEQUENCER_DATA, sequencer);
+ gfx_outb(MDC_SEQUENCER_INDEX, MDC_SEQUENCER_CLK_MODE);
+ sequencer = gfx_inb(MDC_SEQUENCER_DATA);
+ sequencer |= MDC_CLK_MODE_SCREEN_OFF;
+ gfx_outb(MDC_SEQUENCER_DATA, sequencer);
- gfx_delay_milliseconds(1);
+ gfx_delay_milliseconds(1);
- /* BLANK THE VGA DISPLAY */
- gfx_outw(MDC_SEQUENCER_INDEX, MDC_SEQUENCER_RESET);
- sequencer = gfx_inb(MDC_SEQUENCER_DATA);
- sequencer &= ~MDC_RESET_VGA_DISP_ENABLE;
- gfx_outb(MDC_SEQUENCER_DATA, sequencer);
+ /* BLANK THE VGA DISPLAY */
+ gfx_outw(MDC_SEQUENCER_INDEX, MDC_SEQUENCER_RESET);
+ sequencer = gfx_inb(MDC_SEQUENCER_DATA);
+ sequencer &= ~MDC_RESET_VGA_DISP_ENABLE;
+ gfx_outb(MDC_SEQUENCER_DATA, sequencer);
- gfx_delay_milliseconds(1);
+ gfx_delay_milliseconds(1);
}
/* Set up the memory */
@@ -1092,17 +1110,17 @@ GXEnterGraphics(ScreenPtr pScrn, ScrnInfoPtr pScrni)
static void
GXLoadPalette(ScrnInfoPtr pScrni,
- int numColors, int *indizes, LOCO * colors, VisualPtr pVisual)
+ int numColors, int *indizes, LOCO * colors, VisualPtr pVisual)
{
int i, index, color;
for (i = 0; i < numColors; i++) {
- index = indizes[i] & 0xFF;
- color = (((unsigned long)(colors[index].red & 0xFF)) << 16) |
- (((unsigned long)(colors[index].green & 0xFF)) << 8) |
- ((unsigned long)(colors[index].blue & 0xFF));
+ index = indizes[i] & 0xFF;
+ color = (((unsigned long) (colors[index].red & 0xFF)) << 16) |
+ (((unsigned long) (colors[index].green & 0xFF)) << 8) |
+ ((unsigned long) (colors[index].blue & 0xFF));
- GFX(set_display_palette_entry(index, color));
+ GFX(set_display_palette_entry(index, color));
}
}
@@ -1113,9 +1131,9 @@ GXPanelPower(int enable)
unsigned long power = READ_VID32(RCDF_POWER_MANAGEMENT);
if (enable != 0)
- power |= RCDF_PM_PANEL_POWER_ON;
+ power |= RCDF_PM_PANEL_POWER_ON;
else
- power &= ~RCDF_PM_PANEL_POWER_ON;
+ power &= ~RCDF_PM_PANEL_POWER_ON;
WRITE_VID32(RCDF_POWER_MANAGEMENT, power);
}
@@ -1128,52 +1146,52 @@ GXDPMSSet(ScrnInfoPtr pScrni, int mode, int flags)
pGeode = GEODEPTR(pScrni);
if (!pScrni->vtSema)
- return;
+ return;
switch (mode) {
case DPMSModeOn:
- /* Screen: On; HSync: On; VSync: On */
- GFX(set_crt_enable(CRT_ENABLE));
+ /* Screen: On; HSync: On; VSync: On */
+ GFX(set_crt_enable(CRT_ENABLE));
#if defined(PNL_SUP)
- if (pGeode->Panel) {
- Pnl_PowerUp();
- GXPanelPower(1);
- }
+ if (pGeode->Panel) {
+ Pnl_PowerUp();
+ GXPanelPower(1);
+ }
#endif
- break;
+ break;
case DPMSModeStandby:
- /* Screen: Off; HSync: Off; VSync: On */
- GFX(set_crt_enable(CRT_STANDBY));
+ /* Screen: Off; HSync: Off; VSync: On */
+ GFX(set_crt_enable(CRT_STANDBY));
#if defined(PNL_SUP)
- if (pGeode->Panel) {
- Pnl_PowerDown();
- GXPanelPower(0);
- }
+ if (pGeode->Panel) {
+ Pnl_PowerDown();
+ GXPanelPower(0);
+ }
#endif
- break;
+ break;
case DPMSModeSuspend:
- /* Screen: Off; HSync: On; VSync: Off */
- GFX(set_crt_enable(CRT_SUSPEND));
+ /* Screen: Off; HSync: On; VSync: Off */
+ GFX(set_crt_enable(CRT_SUSPEND));
#if defined(PNL_SUP)
- if (pGeode->Panel) {
- Pnl_PowerDown();
- GXPanelPower(0);
- }
+ if (pGeode->Panel) {
+ Pnl_PowerDown();
+ GXPanelPower(0);
+ }
#endif
- break;
+ break;
case DPMSModeOff:
- /* Screen: Off; HSync: Off; VSync: Off */
- GFX(set_crt_enable(CRT_DISABLE));
+ /* Screen: Off; HSync: Off; VSync: Off */
+ GFX(set_crt_enable(CRT_DISABLE));
#if defined(PNL_SUP)
- if (pGeode->Panel) {
- Pnl_PowerDown();
- GXPanelPower(0);
- }
+ if (pGeode->Panel) {
+ Pnl_PowerDown();
+ GXPanelPower(0);
+ }
#endif
- break;
+ break;
}
}
#endif
@@ -1181,45 +1199,45 @@ GXDPMSSet(ScrnInfoPtr pScrni, int mode, int flags)
static Bool
GXCreateScreenResources(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrni = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScreen);
GeodeRec *pGeode = GEODEPTR(pScrni);
pScreen->CreateScreenResources = pGeode->CreateScreenResources;
if (!(*pScreen->CreateScreenResources) (pScreen))
- return FALSE;
+ return FALSE;
if (xf86LoaderCheckSymbol("GXRandRSetConfig")
- && pGeode->rotation != RR_Rotate_0) {
- Rotation(*GXRandRSetConfig) (ScreenPtr pScreen, Rotation rr, int rate,
- RRScreenSizePtr pSize) = NULL;
+ && pGeode->rotation != RR_Rotate_0) {
+ Rotation(*GXRandRSetConfig) (ScreenPtr pScreen, Rotation rr, int rate,
+ RRScreenSizePtr pSize) = NULL;
- RRScreenSize p;
- Rotation requestedRotation = pGeode->rotation;
+ RRScreenSize p;
+ Rotation requestedRotation = pGeode->rotation;
- pGeode->rotation = RR_Rotate_0;
+ pGeode->rotation = RR_Rotate_0;
- /* Just setup enough for an initial rotate */
+ /* Just setup enough for an initial rotate */
- p.width = pScreen->width;
- p.height = pScreen->height;
- p.mmWidth = pScreen->mmWidth;
- p.mmHeight = pScreen->mmHeight;
+ p.width = pScreen->width;
+ p.height = pScreen->height;
+ p.mmWidth = pScreen->mmWidth;
+ p.mmHeight = pScreen->mmHeight;
- GXRandRSetConfig = LoaderSymbol("GXRandRSetConfig");
- if (GXRandRSetConfig) {
- pGeode->starting = TRUE;
- (*GXRandRSetConfig) (pScreen, requestedRotation, 0, &p);
- pGeode->starting = FALSE;
- }
+ GXRandRSetConfig = LoaderSymbol("GXRandRSetConfig");
+ if (GXRandRSetConfig) {
+ pGeode->starting = TRUE;
+ (*GXRandRSetConfig) (pScreen, requestedRotation, 0, &p);
+ pGeode->starting = FALSE;
+ }
}
return TRUE;
}
static Bool
-GXScreenInit(int scrnIndex, ScreenPtr pScrn, int argc, char **argv)
+GXScreenInit(SCREEN_INIT_ARGS_DECL)
{
- ScrnInfoPtr pScrni = xf86Screens[scrnIndex];
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScrn);
GeodeRec *pGeode = GEODEPTR(pScrni);
XF86ModReqInfo shadowReq;
int maj, min, ret, rotate;
@@ -1230,65 +1248,69 @@ GXScreenInit(int scrnIndex, ScreenPtr pScrn, int argc, char **argv)
if (pGeode->useVGA) {
- if (!vgaHWMapMem(pScrni))
- return FALSE;
+ if (!vgaHWMapMem(pScrni))
+ return FALSE;
- vgaHWGetIOBase(VGAHWPTR(pScrni));
+ vgaHWGetIOBase(VGAHWPTR(pScrni));
}
if (!pGeode->NoAccel) {
- if (pGeode->useEXA) {
-
- if (!(pGeode->pExa = exaDriverAlloc())) {
- xf86DrvMsg(scrnIndex, X_ERROR,
- "Couldn't allocate the EXA structure.\n");
- pGeode->NoAccel = TRUE;
- } else {
- ExaDriverPtr pExa = pGeode->pExa;
-
- /* THis is set in GXAllocMem */
- pExa->memoryBase = 0;
-
- /* This is set in GXAllocateMemory */
- pExa->memorySize = 0;
-
- pExa->pixmapOffsetAlign = 32;
- pExa->pixmapPitchAlign = 32;
- pExa->flags = EXA_OFFSCREEN_PIXMAPS;
- pExa->maxX = GX_MAX_WIDTH - 1;
- pExa->maxY = GX_MAX_HEIGHT - 1;
- }
- } else {
- pGeode->AccelImageWriteBuffers =
- calloc(pGeode->NoOfImgBuffers,
- sizeof(pGeode->AccelImageWriteBuffers[0]));
- pGeode->AccelColorExpandBuffers =
- calloc(pGeode->NoOfColorExpandLines,
- sizeof(pGeode->AccelColorExpandBuffers[0]));
- }
+ if (pGeode->useEXA) {
+
+ if (!(pGeode->pExa = exaDriverAlloc())) {
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
+ "Couldn't allocate the EXA structure.\n");
+ pGeode->NoAccel = TRUE;
+ }
+ else {
+ ExaDriverPtr pExa = pGeode->pExa;
+
+ /* THis is set in GXAllocMem */
+ pExa->memoryBase = 0;
+
+ /* This is set in GXAllocateMemory */
+ pExa->memorySize = 0;
+
+ pExa->pixmapOffsetAlign = 32;
+ pExa->pixmapPitchAlign = 32;
+ pExa->flags = EXA_OFFSCREEN_PIXMAPS;
+ pExa->maxX = GX_MAX_WIDTH - 1;
+ pExa->maxY = GX_MAX_HEIGHT - 1;
+ }
+ }
+ else {
+ pGeode->AccelImageWriteBuffers =
+ calloc(pGeode->NoOfImgBuffers,
+ sizeof(pGeode->AccelImageWriteBuffers[0]));
+ pGeode->AccelColorExpandBuffers =
+ calloc(pGeode->NoOfColorExpandLines,
+ sizeof(pGeode->AccelColorExpandBuffers[0]));
+ }
}
/* XXX FIXME - Take down any of the structures on failure? */
if (!GXEnterGraphics(pScrn, pScrni))
- return FALSE;
+ return FALSE;
miClearVisualTypes();
/* XXX Again - take down anything? */
if (pScrni->bitsPerPixel > 8) {
- if (!miSetVisualTypes(pScrni->depth,
- TrueColorMask, pScrni->rgbBits, pScrni->defaultVisual)) {
- return FALSE;
- }
- } else {
- if (!miSetVisualTypes(pScrni->depth,
- miGetDefaultVisualMask(pScrni->depth),
- pScrni->rgbBits, pScrni->defaultVisual)) {
- return FALSE;
- }
+ if (!miSetVisualTypes(pScrni->depth,
+ TrueColorMask, pScrni->rgbBits,
+ pScrni->defaultVisual)) {
+ return FALSE;
+ }
+ }
+ else {
+ if (!miSetVisualTypes(pScrni->depth,
+ miGetDefaultVisualMask(pScrni->depth),
+ pScrni->rgbBits, pScrni->defaultVisual)) {
+ return FALSE;
+ }
}
miSetPixmapDepths();
@@ -1296,37 +1318,37 @@ GXScreenInit(int scrnIndex, ScreenPtr pScrn, int argc, char **argv)
/* Point at the visible area to start */
ret = fbScreenInit(pScrn, pGeode->FBBase + pGeode->displayOffset,
- pScrni->virtualX, pScrni->virtualY,
- pScrni->xDpi, pScrni->yDpi, pGeode->displayWidth,
- pScrni->bitsPerPixel);
+ pScrni->virtualX, pScrni->virtualY,
+ pScrni->xDpi, pScrni->yDpi, pGeode->displayWidth,
+ pScrni->bitsPerPixel);
if (!ret)
- return FALSE;
+ return FALSE;
xf86SetBlackWhitePixels(pScrn);
/* Set up the color ordering */
if (pScrni->bitsPerPixel > 8) {
- VisualPtr visual = pScrn->visuals + pScrn->numVisuals;
-
- while (--visual >= pScrn->visuals) {
- if ((visual->class | DynamicClass) == DirectColor) {
- visual->offsetRed = pScrni->offset.red;
- visual->offsetGreen = pScrni->offset.green;
- visual->offsetBlue = pScrni->offset.blue;
- visual->redMask = pScrni->mask.red;
- visual->greenMask = pScrni->mask.green;
- visual->blueMask = pScrni->mask.blue;
- }
- }
+ VisualPtr visual = pScrn->visuals + pScrn->numVisuals;
+
+ while (--visual >= pScrn->visuals) {
+ if ((visual->class | DynamicClass) == DirectColor) {
+ visual->offsetRed = pScrni->offset.red;
+ visual->offsetGreen = pScrni->offset.green;
+ visual->offsetBlue = pScrni->offset.blue;
+ visual->redMask = pScrni->mask.red;
+ visual->greenMask = pScrni->mask.green;
+ visual->blueMask = pScrni->mask.blue;
+ }
+ }
}
/* Must follow the color ordering */
fbPictureInit(pScrn, 0, 0);
if (!pGeode->NoAccel)
- GXAccelInit(pScrn);
+ GXAccelInit(pScrn);
miInitializeBackingStore(pScrn);
xf86SetBackingStore(pScrn);
@@ -1337,24 +1359,25 @@ GXScreenInit(int scrnIndex, ScreenPtr pScrn, int argc, char **argv)
/* Set up the HW cursor - must follow the soft cursor init */
if (pGeode->tryHWCursor) {
- if (!GXHWCursorInit(pScrn))
- xf86DrvMsg(scrnIndex, X_ERROR,
- "Hardware cursor initialization failed.\n");
+ if (!GXHWCursorInit(pScrn))
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
+ "Hardware cursor initialization failed.\n");
}
/* Set up the color map */
if (!miCreateDefColormap(pScrn))
- return FALSE;
+ return FALSE;
if (pScrni->bitsPerPixel == 8) {
- /* Must follow initialization of the default colormap */
+ /* Must follow initialization of the default colormap */
- if (!xf86HandleColormaps(pScrn, 256, 8,
- GXLoadPalette, NULL,
- CMAP_PALETTED_TRUECOLOR | CMAP_RELOAD_ON_MODE_SWITCH)) {
- return FALSE;
- }
+ if (!xf86HandleColormaps(pScrn, 256, 8,
+ GXLoadPalette, NULL,
+ CMAP_PALETTED_TRUECOLOR |
+ CMAP_RELOAD_ON_MODE_SWITCH)) {
+ return FALSE;
+ }
}
#ifdef DPMSExtension
xf86DPMSInit(pScrn, GXDPMSSet, 0);
@@ -1364,7 +1387,7 @@ GXScreenInit(int scrnIndex, ScreenPtr pScrn, int argc, char **argv)
/* Set up RandR */
- xf86DisableRandR(); /* We provide our own RandR goodness */
+ xf86DisableRandR(); /* We provide our own RandR goodness */
/* Try to set up the shadow FB for rotation */
@@ -1373,20 +1396,21 @@ GXScreenInit(int scrnIndex, ScreenPtr pScrn, int argc, char **argv)
shadowReq.minorversion = 1;
if (LoadSubModule(pScrni->module, "shadow",
- NULL, NULL, NULL, &shadowReq, &maj, &min)) {
+ NULL, NULL, NULL, &shadowReq, &maj, &min)) {
- rotate = RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | RR_Rotate_270;
- shadowSetup(pScrn);
- } else {
- LoaderErrorMsg(NULL, "shadow", maj, min);
- xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
- "Error loading shadow - rotation not available.\n");
+ rotate = RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | RR_Rotate_270;
+ shadowSetup(pScrn);
+ }
+ else {
+ LoaderErrorMsg(NULL, "shadow", maj, min);
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
+ "Error loading shadow - rotation not available.\n");
- if (pGeode->rotation != RR_Rotate_0)
- xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
- "Reverting back to normal rotation.\n");
+ if (pGeode->rotation != RR_Rotate_0)
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
+ "Reverting back to normal rotation.\n");
- rotate = pGeode->rotation = RR_Rotate_0;
+ rotate = pGeode->rotation = RR_Rotate_0;
}
GXRandRInit(pScrn, rotate);
@@ -1402,7 +1426,7 @@ GXScreenInit(int scrnIndex, ScreenPtr pScrn, int argc, char **argv)
pScrn->SaveScreen = GXSaveScreen;
if (serverGeneration == 1)
- xf86ShowUnusedOptions(pScrni->scrnIndex, pScrni->options);
+ xf86ShowUnusedOptions(pScrni->scrnIndex, pScrni->options);
pGeode->starting = FALSE;
@@ -1410,17 +1434,17 @@ GXScreenInit(int scrnIndex, ScreenPtr pScrn, int argc, char **argv)
}
static int
-GXValidMode(int scrnIndex, DisplayModePtr pMode, Bool Verbose, int flags)
+GXValidMode(VALID_MODE_ARGS_DECL)
{
- ScrnInfoPtr pScrni = xf86Screens[scrnIndex];
+ SCRN_INFO_PTR(arg);
GeodeRec *pGeode = GEODEPTR(pScrni);
int p;
int custom = 0;
if (pGeode->Panel)
- custom = (pMode->type & M_T_USERDEF);
+ custom = (pMode->type & M_T_USERDEF);
else
- custom = (pMode->type & (M_T_BUILTIN | M_T_DEFAULT));
+ custom = (pMode->type & (M_T_BUILTIN | M_T_DEFAULT));
/* Use the durango lookup for !custom modes */
@@ -1445,16 +1469,15 @@ GXValidMode(int scrnIndex, DisplayModePtr pMode, Bool Verbose, int flags)
}
if (pMode->Flags & V_INTERLACE)
- return MODE_NO_INTERLACE;
+ return MODE_NO_INTERLACE;
if (pGeode->tryCompression)
- p = GeodeCalculatePitchBytes(pMode->CrtcHDisplay,
- pScrni->bitsPerPixel);
+ p = GeodeCalculatePitchBytes(pMode->CrtcHDisplay, pScrni->bitsPerPixel);
else
- p = ((pMode->CrtcHDisplay + 3) & ~3) * (pScrni->bitsPerPixel >> 3);
+ p = ((pMode->CrtcHDisplay + 3) & ~3) * (pScrni->bitsPerPixel >> 3);
if (p * pMode->CrtcVDisplay > pGeode->FBAvail)
- return MODE_MEM;
+ return MODE_MEM;
return MODE_OK;
}
@@ -1462,19 +1485,20 @@ GXValidMode(int scrnIndex, DisplayModePtr pMode, Bool Verbose, int flags)
/* XXX - Way more to do here */
static Bool
-GXEnterVT(int scrnIndex, int flags)
+GXEnterVT(VT_FUNC_ARGS_DECL)
{
- return GXEnterGraphics(NULL, xf86Screens[scrnIndex]);
+ SCRN_INFO_PTR(arg);
+ return GXEnterGraphics(NULL, pScrni);
}
static void
-GXLeaveVT(int scrnIndex, int flags)
+GXLeaveVT(VT_FUNC_ARGS_DECL)
{
- ScrnInfoPtr pScrni = xf86Screens[scrnIndex];
+ SCRN_INFO_PTR(arg);
GeodeRec *pGeode = GEODEPTR(pScrni);
pGeode->PrevDisplayOffset = gfx_get_display_offset();
- GXLeaveGraphics(xf86Screens[scrnIndex]);
+ GXLeaveGraphics(pScrni);
}
void
@@ -1497,31 +1521,31 @@ GXSetupChipsetFPtr(ScrnInfoPtr pScrn)
* ============================== */
void
-GeodePointerMoved(int index, int x, int y)
+GeodePointerMoved(POINTER_MOVED_ARGS_DECL)
{
- ScrnInfoPtr pScrni = xf86Screens[index];
+ SCRN_INFO_PTR(arg);
GeodeRec *pGeode = GEODEPTR(pScrni);
int newX = x, newY = y;
switch (pGeode->rotation) {
case RR_Rotate_0:
- break;
+ break;
case RR_Rotate_90:
- newX = y;
- newY = pScrni->pScreen->width - x - 1;
- break;
+ newX = y;
+ newY = pScrni->pScreen->width - x - 1;
+ break;
case RR_Rotate_180:
- newX = pScrni->pScreen->width - x - 1;
- newY = pScrni->pScreen->height - y - 1;
- break;
+ newX = pScrni->pScreen->width - x - 1;
+ newY = pScrni->pScreen->height - y - 1;
+ break;
case RR_Rotate_270:
- newX = pScrni->pScreen->height - y - 1;
- newY = x;
- break;
+ newX = pScrni->pScreen->height - y - 1;
+ newY = x;
+ break;
}
- (*pGeode->PointerMoved) (index, newX, newY);
+ (*pGeode->PointerMoved) (POINTER_MOVED_ARGS(newX, newY));
}
int
@@ -1537,25 +1561,26 @@ static void
GeodeFreeRec(ScrnInfoPtr pScrni)
{
if (pScrni->driverPrivate != NULL) {
- free(pScrni->driverPrivate);
- pScrni->driverPrivate = NULL;
+ free(pScrni->driverPrivate);
+ pScrni->driverPrivate = NULL;
}
}
void
-GeodeFreeScreen(int scrnIndex, int flags)
+GeodeFreeScreen(FREE_SCREEN_ARGS_DECL)
{
- GeodeRec *pGeode = GEODEPTR(xf86Screens[scrnIndex]);
+ SCRN_INFO_PTR(arg);
+ GeodeRec *pGeode = GEODEPTR(pScrni);
if (pGeode == NULL)
- return;
+ return;
if (pGeode->useVGA) {
- if (xf86LoaderCheckSymbol("vgaHWFreeHWRec"))
- vgaHWFreeHWRec(xf86Screens[scrnIndex]);
+ if (xf86LoaderCheckSymbol("vgaHWFreeHWRec"))
+ vgaHWFreeHWRec(pScrni);
}
- GeodeFreeRec(xf86Screens[scrnIndex]);
+ GeodeFreeRec(pScrni);
}
int
@@ -1567,18 +1592,18 @@ GeodeCalculatePitchBytes(unsigned int width, unsigned int bpp)
/* Less then 640 has doubling enabled */
if (width < 640)
- delta <<= 1;
+ delta <<= 1;
/* Calculate the pitch (compression rquires a power of 2) */
if (delta > 4096)
- delta = 8192;
+ delta = 8192;
else if (delta > 2048)
- delta = 4096;
+ delta = 4096;
else if (delta > 1024)
- delta = 2048;
+ delta = 2048;
else
- delta = 1024;
+ delta = 1024;
return delta;
}