summaryrefslogtreecommitdiff
path: root/src/ast_driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ast_driver.c')
-rw-r--r--src/ast_driver.c718
1 files changed, 359 insertions, 359 deletions
diff --git a/src/ast_driver.c b/src/ast_driver.c
index 4de6c78..c6f8728 100644
--- a/src/ast_driver.c
+++ b/src/ast_driver.c
@@ -142,23 +142,23 @@ _X_EXPORT DriverRec AST = {
static SymTabRec ASTChipsets[] = {
{PCI_CHIP_AST2000, "ASPEED Graphics Family"},
{PCI_CHIP_AST2100, "ASPEED Graphics Family"},
- {PCI_CHIP_AST1180, "ASPEED AST1180 Graphics"},
+ {PCI_CHIP_AST1180, "ASPEED AST1180 Graphics"},
{-1, NULL}
};
static PciChipsets ASTPciChipsets[] = {
{PCI_CHIP_AST2000, PCI_CHIP_AST2000, RES_SHARED_VGA},
{PCI_CHIP_AST2100, PCI_CHIP_AST2100, RES_SHARED_VGA},
- {PCI_CHIP_AST1180, PCI_CHIP_AST1180, RES_SHARED_VGA},
+ {PCI_CHIP_AST1180, PCI_CHIP_AST1180, RES_SHARED_VGA},
{-1, -1, RES_UNDEFINED }
};
typedef enum {
OPTION_NOACCEL,
- OPTION_MMIO2D,
+ OPTION_MMIO2D,
OPTION_SW_CURSOR,
OPTION_HWC_NUM,
- OPTION_ENG_CAPS,
+ OPTION_ENG_CAPS,
OPTION_DBG_SELECT,
OPTION_NO_DDC,
OPTION_VGA2_CLONE
@@ -190,7 +190,7 @@ static XF86ModuleVersionInfo astVersRec = {
ABI_CLASS_VIDEODRV,
#ifdef PATCH_ABI_VERSION
ABI_VIDEODRV_VERSION_PATCH,
-#else
+#else
ABI_VIDEODRV_VERSION,
#endif
MOD_CLASS_VIDEODRV,
@@ -241,7 +241,7 @@ ASTIdentify(int flags)
const OptionInfoRec *
ASTAvailableOptions(int chipid, int busid)
{
-
+
return ASTOptions;
}
@@ -258,7 +258,7 @@ ASTProbe(DriverPtr drv, int flags)
{
int i, numUsed, numDevSections, *usedChips;
Bool foundScreen = FALSE;
- GDevPtr *devSections;
+ GDevPtr *devSections;
/*
* Find the config file Device sections that match this
@@ -319,22 +319,22 @@ ASTProbe(DriverPtr drv, int flags)
pScrn->driverVersion = AST_VERSION;
pScrn->driverName = AST_DRIVER_NAME;
pScrn->name = AST_NAME;
-
+
pScrn->Probe = ASTProbe;
pScrn->PreInit = ASTPreInit;
pScrn->ScreenInit = ASTScreenInit;
pScrn->SwitchMode = ASTSwitchMode;
- pScrn->AdjustFrame = ASTAdjustFrame;
+ pScrn->AdjustFrame = ASTAdjustFrame;
pScrn->EnterVT = ASTEnterVT;
pScrn->LeaveVT = ASTLeaveVT;
pScrn->FreeScreen = ASTFreeScreen;
pScrn->ValidMode = ASTValidMode;
-
- foundScreen = TRUE;
+
+ foundScreen = TRUE;
} /* end of if */
} /* end of for-loop */
- } /* end of if flags */
+ } /* end of if flags */
free(usedChips);
@@ -354,12 +354,12 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
EntityInfoPtr pEnt;
int flags24;
rgb defaultWeight = { 0, 0, 0 };
-#if !(defined(__sparc__)) && !(defined(__mips__))
+#if !(defined(__sparc__)) && !(defined(__mips__))
vgaHWPtr hwp;
#endif
-
+
ASTRecPtr pAST;
-
+
ClockRangePtr clockRanges;
int i;
MessageType from;
@@ -384,7 +384,7 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
return FALSE;
#endif
-#if !(defined(__sparc__)) && !(defined(__mips__))
+#if !(defined(__sparc__)) && !(defined(__mips__))
/* The vgahw module should be loaded here when needed */
if (!xf86LoadSubModule(pScrn, "vgahw"))
return FALSE;
@@ -393,14 +393,14 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
/* The fb module should be loaded here when needed */
if (!xf86LoadSubModule(pScrn, "fb"))
return FALSE;
-
-#if !(defined(__sparc__)) && !(defined(__mips__))
+
+#if !(defined(__sparc__)) && !(defined(__mips__))
/* Allocate a vgaHWRec */
if (!vgaHWGetHWRec(pScrn))
return FALSE;
hwp = VGAHWPTR(pScrn);
vgaHWSetStdFuncs(hwp);
-#endif
+#endif
/* Color Depth Check */
flags24 = Support32bppFb;
@@ -432,16 +432,16 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
pScrn->bitsPerPixel);
return FALSE;
}
-
+
/* fill pScrn misc. */
pScrn->progClock = TRUE;
pScrn->rgbBits = 6;
pScrn->monitor = pScrn->confScreen->monitor; /* should be initialized before set gamma */
#ifndef XSERVER_LIBPCIACCESS
pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
- pScrn->racIoFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
+ pScrn->racIoFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
#endif
-
+
/*
* If the driver can do gamma correction, it should call xf86SetGamma()
* here.
@@ -450,7 +450,7 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
Gamma zeros = { 0.0, 0.0, 0.0 };
if (!xf86SetGamma(pScrn, zeros)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "call xf86SetGamma failed \n");
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "call xf86SetGamma failed \n");
return FALSE;
}
}
@@ -458,17 +458,17 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
if (!xf86SetWeight(pScrn, defaultWeight, defaultWeight)) {
return FALSE;
- }
+ }
if (!xf86SetDefaultVisual(pScrn, -1)) {
return FALSE;
- }
+ }
/* Allocate driverPrivate */
if (!ASTGetRec(pScrn)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "call ASTGetRec failed \n");
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "call ASTGetRec failed \n");
return FALSE;
- }
+ }
/* Fill AST Info */
pAST = ASTPTR(pScrn);
@@ -480,18 +480,18 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
#endif
/* Process the options
- * pScrn->confScreen, pScrn->display, pScrn->monitor, pScrn->numEntities,
+ * pScrn->confScreen, pScrn->display, pScrn->monitor, pScrn->numEntities,
* and pScrn->entityList should be initialized before
*/
- xf86CollectOptions(pScrn, NULL);
+ xf86CollectOptions(pScrn, NULL);
if (!(pAST->Options = malloc(sizeof(ASTOptions))))
- {
- ASTFreeRec(pScrn);
+ {
+ ASTFreeRec(pScrn);
return FALSE;
- }
+ }
memcpy(pAST->Options, ASTOptions, sizeof(ASTOptions));
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pAST->Options);
-
+
/*
* Set the Chipset and ChipRev, allowing config file entries to
* override.
@@ -520,7 +520,7 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
/* Resource Allocation */
#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
- pAST->IODBase = pScrn->domainIOBase;
+ pAST->IODBase = pScrn->domainIOBase;
#else
pAST->IODBase = 0;
#endif
@@ -533,9 +533,9 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
#endif
pAST->PIOOffset =
pAST->IODBase + PCI_REGION_BASE(pAST->PciInfo, 2, REGION_IO) - 0x380;
-
+
pAST->RelocateIO = (IOADDRESS)(PCI_REGION_BASE(pAST->PciInfo, 2, REGION_IO) + pAST->IODBase);
-
+
if (pAST->pEnt->device->MemBase != 0) {
pAST->FBPhysAddr = pAST->pEnt->device->MemBase;
from = X_CONFIG;
@@ -569,44 +569,44 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
}
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "IO registers at addr 0x%lX\n",
(unsigned long) pAST->MMIOPhysAddr);
-
+
/* Map MMIO */
- pAST->MMIOMapSize = DEFAULT_MMIO_SIZE;
+ pAST->MMIOMapSize = DEFAULT_MMIO_SIZE;
if (!ASTMapMMIO(pScrn)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Map Memory Map IO Failed \n");
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Map Memory Map IO Failed \n");
return FALSE;
}
if (PCI_DEV_DEVICE_ID(pAST->PciInfo) == PCI_CHIP_AST1180)
- {
+ {
pAST->jChipType = AST1180;
-
+
/* validate mode */
if ( (pScrn->bitsPerPixel == 8) || (pScrn->depth == 8) )
{
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Given bpp (%d) is not supported by ast driver\n",
pScrn->bitsPerPixel);
- return FALSE;
+ return FALSE;
}
-
+
/* Init AST1180 */
bInitAST1180(pScrn);
-
+
/* Get AST1180 Information */
- GetAST1180DRAMInfo(pScrn);
+ GetAST1180DRAMInfo(pScrn);
pScrn->videoRam = pAST->ulVRAMSize / 1024;
-
+
}
- else
- {
- /* Enable VGA MMIO Access */
+ else
+ {
+ /* Enable VGA MMIO Access */
vEnableASTVGAMMIO(pScrn);
-
+
/* Init VGA Adapter */
if (!xf86IsPrimaryPci(pAST->PciInfo))
- {
- InitVGA(pScrn, 0);
+ {
+ InitVGA(pScrn, 0);
}
vASTOpenKey(pScrn);
@@ -614,9 +614,9 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
/* Get Chip Type */
if (PCI_DEV_REVISION(pAST->PciInfo) >= 0x20)
- pAST->jChipType = AST2300;
+ pAST->jChipType = AST2300;
else if (PCI_DEV_REVISION(pAST->PciInfo) >= 0x10)
- GetChipType(pScrn);
+ GetChipType(pScrn);
else
pAST->jChipType = AST2000;
@@ -624,23 +624,23 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
GetScratchOptions(pScrn);
/* Get DRAM Info */
- GetDRAMInfo(pScrn);
- pAST->ulVRAMSize = GetVRAMInfo(pScrn);
- pScrn->videoRam = pAST->ulVRAMSize / 1024;
+ GetDRAMInfo(pScrn);
+ pAST->ulVRAMSize = GetVRAMInfo(pScrn);
+ pScrn->videoRam = pAST->ulVRAMSize / 1024;
}
-
+
/* Map Framebuffer */
from = X_DEFAULT;
if (pAST->pEnt->device->videoRam) {
pScrn->videoRam = pAST->pEnt->device->videoRam;
from = X_CONFIG;
}
-
+
pAST->FbMapSize = pScrn->videoRam * 1024;
-#if 0
+#if 0
if (!ASTMapMem(pScrn)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Map FB Memory Failed \n");
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Map FB Memory Failed \n");
return FALSE;
}
#endif
@@ -648,16 +648,16 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
pScrn->memPhysBase = (ULONG)pAST->FBPhysAddr;
pScrn->fbOffset = 0;
- /* Do DDC
+ /* Do DDC
* should be done after xf86CollectOptions
*/
- pScrn->monitor->DDC = ASTDoDDC(pScrn, pAST->pEnt->index);
+ pScrn->monitor->DDC = ASTDoDDC(pScrn, pAST->pEnt->index);
/* Mode Valid */
clockRanges = xnfcalloc(sizeof(ClockRange), 1);
clockRanges->next = NULL;
clockRanges->minClock = 9500;
- clockRanges->maxClock = GetMaxDCLK(pScrn) * 1000;
+ clockRanges->maxClock = GetMaxDCLK(pScrn) * 1000;
clockRanges->clockIndex = -1;
clockRanges->interlaceAllowed = FALSE;
clockRanges->doubleScanAllowed = FALSE;
@@ -666,14 +666,14 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
if ((pAST->jChipType == AST2100) || (pAST->jChipType == AST2200) || (pAST->jChipType == AST2300) || (pAST->jChipType == AST1180))
{
maxPitch = 1920;
- maxHeight = 1200;
- }
+ maxHeight = 1200;
+ }
else
{
maxPitch = 1600;
- maxHeight = 1200;
- }
-
+ maxHeight = 1200;
+ }
+
i = xf86ValidateModes(pScrn, pScrn->monitor->Modes,
pScrn->display->modes, clockRanges,
0, 320, maxPitch, 8 * pScrn->bitsPerPixel,
@@ -689,9 +689,9 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
0, 320, maxPitch, 8 * pScrn->bitsPerPixel,
200, maxHeight,
pAST->mon_h_active, pAST->mon_v_active,
- pAST->FbMapSize, LOOKUP_BEST_REFRESH);
+ pAST->FbMapSize, LOOKUP_BEST_REFRESH);
}
-
+
if (i == -1) {
ASTFreeRec(pScrn);
return FALSE;
@@ -716,10 +716,10 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
/* Accelaration Check */
pAST->noAccel = TRUE;
#ifdef HAVE_XAA_H
- pAST->AccelInfoPtr = NULL;
+ pAST->AccelInfoPtr = NULL;
#endif
- pAST->pCMDQPtr = NULL;
- pAST->CMDQInfo.ulCMDQSize = 0;
+ pAST->pCMDQPtr = NULL;
+ pAST->CMDQInfo.ulCMDQSize = 0;
#ifdef Accel_2D
if (!xf86ReturnOptValBool(pAST->Options, OPTION_NOACCEL, FALSE))
{
@@ -742,29 +742,29 @@ ASTPreInit(ScrnInfoPtr pScrn, int flags)
pAST->DBGSelect = 0;
if (!xf86GetOptValInteger(pAST->Options, OPTION_DBG_SELECT, &pAST->DBGSelect)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No DBG Seleclt options found\n");
- }
- }
+ }
+ }
}
#endif
/* HW Cursor Check */
- pAST->noHWC = TRUE;
+ pAST->noHWC = TRUE;
pAST->HWCInfoPtr = NULL;
- pAST->pHWCPtr = NULL;
-#ifdef HWC
+ pAST->pHWCPtr = NULL;
+#ifdef HWC
if (!xf86ReturnOptValBool(pAST->Options, OPTION_SW_CURSOR, FALSE)) {
if (!xf86LoadSubModule(pScrn, "ramdac")) {
ASTFreeRec(pScrn);
return FALSE;
}
-
- pAST->noHWC = FALSE;
+
+ pAST->noHWC = FALSE;
pAST->HWCInfo.HWC_NUM = DEFAULT_HWC_NUM;
if (!xf86GetOptValInteger(pAST->Options, OPTION_HWC_NUM, &pAST->HWCInfo.HWC_NUM)) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No HWC_NUM options found\n");
- }
-
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No HWC_NUM options found\n");
+ }
+
+ }
#endif
#ifndef XSERVER_LIBPCIACCESS
@@ -784,28 +784,28 @@ ASTScreenInit(SCREEN_INIT_ARGS_DECL)
ASTRecPtr pAST;
VisualPtr visual;
/* for FB Manager */
- BoxRec FBMemBox;
- int AvailFBSize;
+ BoxRec FBMemBox;
+ int AvailFBSize;
pScrn = xf86ScreenToScrn(pScreen);
pAST = ASTPTR(pScrn);
if (!ASTMapMem(pScrn)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Map FB Memory Failed \n");
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Map FB Memory Failed \n");
return FALSE;
}
-
+
/* if (!pAST->noAccel) */
{
/* AvailFBSize = pAST->FbMapSize - pAST->CMDQInfo.ulCMDQSize; */
AvailFBSize = pAST->FbMapSize;
-
+
FBMemBox.x1 = 0;
FBMemBox.y1 = 0;
FBMemBox.x2 = pScrn->displayWidth;
FBMemBox.y2 = (AvailFBSize / (pScrn->displayWidth * ((pScrn->bitsPerPixel+1)/8))) - 1;
- if (FBMemBox.y2 < 0)
+ if (FBMemBox.y2 < 0)
FBMemBox.y2 = 32767;
if (FBMemBox.y2 < pScrn->virtualY)
return FALSE;
@@ -813,23 +813,23 @@ ASTScreenInit(SCREEN_INIT_ARGS_DECL)
if (!xf86InitFBManager(pScreen, &FBMemBox)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to init memory manager\n");
return FALSE;
- }
+ }
}
-
-#if !(defined(__sparc__)) && !(defined(__mips__))
- vgaHWPtr hwp;
+
+#if !(defined(__sparc__)) && !(defined(__mips__))
+ vgaHWPtr hwp;
hwp = VGAHWPTR(pScrn);
vgaHWSetMmioFuncs(hwp, pAST->MMIOVirtualAddr, 0);
#endif
- vFillASTModeInfo (pScrn);
+ vFillASTModeInfo (pScrn);
- ASTSave(pScrn);
+ ASTSave(pScrn);
if (!ASTModeInit(pScrn, pScrn->currentMode)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Mode Init Failed \n");
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Mode Init Failed \n");
return FALSE;
- }
+ }
ASTSaveScreen(pScreen, FALSE);
ASTAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
@@ -845,7 +845,7 @@ ASTScreenInit(SCREEN_INIT_ARGS_DECL)
{
ASTSaveScreen(pScreen, SCREEN_SAVER_OFF);
return FALSE;
- }
+ }
switch(pScrn->bitsPerPixel) {
case 8:
@@ -858,8 +858,8 @@ ASTScreenInit(SCREEN_INIT_ARGS_DECL)
return FALSE;
break;
default:
- return FALSE;
-
+ return FALSE;
+
}
if (pScrn->bitsPerPixel > 8) {
@@ -876,7 +876,7 @@ ASTScreenInit(SCREEN_INIT_ARGS_DECL)
}
}
}
-
+
fbPictureInit(pScreen, 0, 0);
xf86SetBlackWhitePixels(pScreen);
@@ -886,11 +886,11 @@ ASTScreenInit(SCREEN_INIT_ARGS_DECL)
{
if (!ASTAccelInit(pScreen)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"Hardware acceleration initialization failed\n");
- pAST->noAccel = TRUE;
+ pAST->noAccel = TRUE;
}
}
#endif /* end of Accel_2D */
-
+
xf86SetBackingStore(pScreen);
xf86SetSilkenMouse(pScreen);
@@ -900,10 +900,10 @@ ASTScreenInit(SCREEN_INIT_ARGS_DECL)
{
if (!ASTCursorInit(pScreen)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"Hardware cursor initialization failed\n");
- pAST->noHWC = TRUE;
+ pAST->noHWC = TRUE;
}
}
-
+
if (!miCreateDefColormap(pScreen))
return FALSE;
@@ -915,17 +915,17 @@ ASTScreenInit(SCREEN_INIT_ARGS_DECL)
return FALSE;
}
}
-
+
xf86DPMSInit(pScreen, ASTDisplayPowerManagementSet, 0);
#ifdef AstVideo
if ( (pAST->jChipType == AST1180) || (pAST->jChipType == AST2300) )
- {
+ {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,"AST Initial Video()\n");
ASTInitVideo(pScreen);
}
#endif
-
+
pScreen->SaveScreen = ASTSaveScreen;
pAST->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = ASTCloseScreen;
@@ -934,7 +934,7 @@ ASTScreenInit(SCREEN_INIT_ARGS_DECL)
xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
return TRUE;
-
+
} /* ASTScreenInit */
@@ -943,37 +943,37 @@ ASTSwitchMode(SWITCH_MODE_ARGS_DECL)
{
SCRN_INFO_PTR(arg);
ASTRecPtr pAST = ASTPTR(pScrn);
-
+
/* VideoMode validate */
if (mode->CrtcHDisplay > pScrn->displayWidth)
return FALSE;
if ((pAST->VideoModeInfo.ScreenPitch * mode->CrtcVDisplay) > pAST->ulVRAMSize)
return FALSE;
-
+
/* VideModeInfo Update */
- pAST->VideoModeInfo.ScreenWidth = mode->CrtcHDisplay;
- pAST->VideoModeInfo.ScreenHeight = mode->CrtcVDisplay;
+ pAST->VideoModeInfo.ScreenWidth = mode->CrtcHDisplay;
+ pAST->VideoModeInfo.ScreenHeight = mode->CrtcVDisplay;
pAST->VideoModeInfo.ScreenPitch = pScrn->displayWidth * ((pScrn->bitsPerPixel + 1) / 8) ;
#ifdef HWC
if (pAST->pHWCPtr) {
xf86FreeOffscreenLinear(pAST->pHWCPtr); /* free HWC Cache */
- pAST->pHWCPtr = NULL;
+ pAST->pHWCPtr = NULL;
}
ASTDisableHWC(pScrn);
#endif
-#ifdef Accel_2D
+#ifdef Accel_2D
if (pAST->pCMDQPtr) {
xf86FreeOffscreenLinear(pAST->pCMDQPtr); /* free CMDQ */
- pAST->pCMDQPtr = NULL;
- }
+ pAST->pCMDQPtr = NULL;
+ }
vDisable2D(pScrn, pAST);
#endif
-
+
/* Fixed display abnormal on the of the screen if run xvidtune, ycchen@122909 */
/* ASTRestore(pScrn); */
-
+
return ASTModeInit(pScrn, mode);
}
@@ -984,7 +984,7 @@ ASTAdjustFrame(ADJUST_FRAME_ARGS_DECL)
SCRN_INFO_PTR(arg);
ASTRecPtr pAST = ASTPTR(pScrn);
ULONG base;
-
+
base = y * pAST->VideoModeInfo.ScreenPitch + x * ((pAST->VideoModeInfo.bitsPerPixel + 1) / 8);
/* base = base >> 2; */ /* DW unit */
@@ -992,7 +992,7 @@ ASTAdjustFrame(ADJUST_FRAME_ARGS_DECL)
}
-/* enter into X Server */
+/* enter into X Server */
static Bool
ASTEnterVT(VT_FUNC_ARGS_DECL)
{
@@ -1004,15 +1004,15 @@ ASTEnterVT(VT_FUNC_ARGS_DECL)
{
if (pAST->jChipType == AST1180)
bInitAST1180(pScrn);
- else
- InitVGA(pScrn, 1);
+ else
+ InitVGA(pScrn, 1);
ASTRestore(pScrn);
- }
+ }
if (!ASTModeInit(pScrn, pScrn->currentMode))
return FALSE;
ASTAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
-
+
return TRUE;
}
@@ -1021,36 +1021,36 @@ ASTEnterVT(VT_FUNC_ARGS_DECL)
static void
ASTLeaveVT(VT_FUNC_ARGS_DECL)
{
-
+
SCRN_INFO_PTR(arg);
ASTRecPtr pAST = ASTPTR(pScrn);
-#if !(defined(__sparc__)) && !(defined(__mips__))
+#if !(defined(__sparc__)) && !(defined(__mips__))
vgaHWPtr hwp = VGAHWPTR(pScrn);
#endif
#ifdef HWC
if (pAST->pHWCPtr) {
xf86FreeOffscreenLinear(pAST->pHWCPtr); /* free HWC Cache */
- pAST->pHWCPtr = NULL;
+ pAST->pHWCPtr = NULL;
}
ASTDisableHWC(pScrn);
#endif
-#ifdef Accel_2D
+#ifdef Accel_2D
if (pAST->pCMDQPtr) {
xf86FreeOffscreenLinear(pAST->pCMDQPtr); /* free CMDQ */
- pAST->pCMDQPtr = NULL;
- }
+ pAST->pCMDQPtr = NULL;
+ }
vDisable2D(pScrn, pAST);
#endif
-
+
ASTRestore(pScrn);
-
+
if (pAST->jChipType == AST1180)
ASTBlankScreen(pScrn, 0);
-#if !(defined(__sparc__)) && !(defined(__mips__))
- vgaHWLock(hwp);
+#if !(defined(__sparc__)) && !(defined(__mips__))
+ vgaHWLock(hwp);
#endif
}
@@ -1060,10 +1060,10 @@ ASTFreeScreen(FREE_SCREEN_ARGS_DECL)
{
SCRN_INFO_PTR(arg);
ASTFreeRec(pScrn);
-#if !(defined(__sparc__)) && !(defined(__mips__))
+#if !(defined(__sparc__)) && !(defined(__mips__))
if (xf86LoaderCheckSymbol("vgaHWFreeHWRec"))
vgaHWFreeHWRec(pScrn);
-#endif
+#endif
}
static ModeStatus
@@ -1074,7 +1074,7 @@ ASTValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags)
ModeStatus Flags = MODE_NOMODE;
UCHAR jReg;
ULONG RequestBufferSize;
-
+
if (mode->Flags & V_INTERLACE) {
if (verbose) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
@@ -1095,9 +1095,9 @@ ASTValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags)
RequestBufferSize = mode->CrtcHDisplay * ((pScrn->bitsPerPixel + 1) / 8) * mode->CrtcVDisplay;
if (RequestBufferSize > pAST->ulVRAMSize)
return Flags;
-
+
/* Valid Wide Screen Mode */
- if (pAST->SupportWideScreen)
+ if (pAST->SupportWideScreen)
{
if ( (mode->CrtcHDisplay == 1680) && (mode->CrtcVDisplay == 1050) )
return MODE_OK;
@@ -1109,22 +1109,22 @@ ASTValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags)
return MODE_OK;
if ( (mode->CrtcHDisplay == 1600) && (mode->CrtcVDisplay == 900) )
return MODE_OK;
-
- if ( (pAST->jChipType == AST2100) || (pAST->jChipType == AST2200) || (pAST->jChipType == AST2300) || (pAST->jChipType == AST1180) )
+
+ if ( (pAST->jChipType == AST2100) || (pAST->jChipType == AST2200) || (pAST->jChipType == AST2300) || (pAST->jChipType == AST1180) )
{
if ( (mode->CrtcHDisplay == 1920) && (mode->CrtcVDisplay == 1080) )
return MODE_OK;
-
+
if ( (mode->CrtcHDisplay == 1920) && (mode->CrtcVDisplay == 1200) )
{
GetIndexRegMask(CRTC_PORT, 0xD1, 0xFF, jReg);
if (jReg & 0x01)
return MODE_NOMODE;
- else
+ else
return MODE_OK;
- }
+ }
}
- }
+ }
switch (mode->CrtcHDisplay)
{
@@ -1182,9 +1182,9 @@ ASTFreeRec(ScrnInfoPtr pScrn)
static Bool
ASTSaveScreen(ScreenPtr pScreen, Bool unblack)
{
-#if !(defined(__sparc__)) && !(defined(__mips__))
+#if !(defined(__sparc__)) && !(defined(__mips__))
/* replacement of vgaHWBlankScreen(pScrn, unblank) without seq reset */
- /* return vgaHWSaveScreen(pScreen, unblack); */
+ /* return vgaHWSaveScreen(pScreen, unblack); */
ScrnInfoPtr pScrn = NULL;
if (pScreen != NULL)
@@ -1193,7 +1193,7 @@ ASTSaveScreen(ScreenPtr pScreen, Bool unblack)
if ((pScrn != NULL) && pScrn->vtSema) {
ASTBlankScreen(pScrn, unblack);
}
- return (TRUE);
+ return (TRUE);
#endif
}
@@ -1202,40 +1202,40 @@ ASTCloseScreen(CLOSE_SCREEN_ARGS_DECL)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
ASTRecPtr pAST = ASTPTR(pScrn);
-#if !(defined(__sparc__)) && !(defined(__mips__))
+#if !(defined(__sparc__)) && !(defined(__mips__))
vgaHWPtr hwp = VGAHWPTR(pScrn);
-#endif
+#endif
if (pScrn->vtSema == TRUE)
- {
+ {
#ifdef HWC
if (pAST->pHWCPtr) {
xf86FreeOffscreenLinear(pAST->pHWCPtr); /* free HWC Cache */
- pAST->pHWCPtr = NULL;
+ pAST->pHWCPtr = NULL;
}
ASTDisableHWC(pScrn);
#endif
-
-#ifdef Accel_2D
+
+#ifdef Accel_2D
if (pAST->pCMDQPtr) {
xf86FreeOffscreenLinear(pAST->pCMDQPtr); /* free CMDQ */
- pAST->pCMDQPtr = NULL;
+ pAST->pCMDQPtr = NULL;
}
vDisable2D(pScrn, pAST);
#endif
-
+
ASTRestore(pScrn);
-
+
if (pAST->jChipType == AST1180)
ASTBlankScreen(pScrn, 0);
-
-#if !(defined(__sparc__)) && !(defined(__mips__))
+
+#if !(defined(__sparc__)) && !(defined(__mips__))
vgaHWLock(hwp);
#endif
}
ASTUnmapMem(pScrn);
-#if !(defined(__sparc__)) && !(defined(__mips__))
+#if !(defined(__sparc__)) && !(defined(__mips__))
vgaHWUnmapMem(pScrn);
#endif
@@ -1259,52 +1259,52 @@ static void
ASTSave(ScrnInfoPtr pScrn)
{
ASTRecPtr pAST;
- ASTRegPtr astReg;
+ ASTRegPtr astReg;
int i, icount=0;
ULONG ulData;
pAST = ASTPTR(pScrn);
- astReg = &pAST->SavedReg;
-
+ astReg = &pAST->SavedReg;
+
if (pAST->jChipType == AST1180)
{
for (i=0; i<12; i++)
{
- ReadAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_CTRL+i*4, ulData);
- astReg->GFX[i] = ulData;
- }
+ ReadAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_CTRL+i*4, ulData);
+ astReg->GFX[i] = ulData;
+ }
}
else
- {
+ {
#if defined(__sparc__) || defined(__mips__)
UCHAR jReg;
-
+
/* Save Misc */
astReg->MISC = GetReg(MISC_PORT_READ);
/* Save SR */
for (i=0; i<4; i++)
GetIndexReg(SEQ_PORT, (UCHAR) (i), astReg->SEQ[i]);
-
+
/* Save CR */
for (i=0; i<25; i++)
GetIndexReg(CRTC_PORT, (UCHAR) (i), astReg->CRTC[i]);
-
+
/* Save GR */
for (i=0; i<9; i++)
GetIndexReg(GR_PORT, (UCHAR) (i), astReg->GR[i]);
-
+
/* Save AR */
jReg = GetReg(INPUT_STATUS1_READ);
for (i=0; i<20; i++)
- GetIndexReg(AR_PORT_WRITE, (UCHAR) (i), astReg->AR[i]);
+ GetIndexReg(AR_PORT_WRITE, (UCHAR) (i), astReg->AR[i]);
jReg = GetReg(INPUT_STATUS1_READ);
SetReg (AR_PORT_WRITE, 0x20); /* set POS */
-#else
+#else
vgaRegPtr vgaReg;
vgaReg = &VGAHWPTR(pScrn)->SavedReg;
-
- /* do save */
+
+ /* do save */
if (xf86IsPrimaryPci(pAST->PciInfo)) {
vgaHWSave(pScrn, vgaReg, VGA_SR_MODE | VGA_SR_FONTS);
}
@@ -1312,102 +1312,102 @@ ASTSave(ScrnInfoPtr pScrn)
vgaHWSave(pScrn, vgaReg, VGA_SR_MODE);
}
#endif
-
+
/* Save Ext. */
vASTOpenKey(pScrn);
-
- /* fixed Console Switch Refresh Rate Incorrect issue, ycchen@051106 */
+
+ /* fixed Console Switch Refresh Rate Incorrect issue, ycchen@051106 */
for (i=0x81; i<=0xB6; i++)
GetIndexReg(CRTC_PORT, (UCHAR) (i), astReg->ExtCRTC[icount++]);
for (i=0xBC; i<=0xC1; i++)
GetIndexReg(CRTC_PORT, (UCHAR) (i), astReg->ExtCRTC[icount++]);
GetIndexReg(CRTC_PORT, (UCHAR) (0xBB), astReg->ExtCRTC[icount]);
-
+
/* Save DAC */
for (i=0; i<256; i++)
- VGA_GET_PALETTE_INDEX (i, astReg->DAC[i][0], astReg->DAC[i][1], astReg->DAC[i][2]);
- }
-
+ VGA_GET_PALETTE_INDEX (i, astReg->DAC[i][0], astReg->DAC[i][1], astReg->DAC[i][2]);
+ }
+
}
static void
ASTRestore(ScrnInfoPtr pScrn)
{
ASTRecPtr pAST;
- ASTRegPtr astReg;
+ ASTRegPtr astReg;
int i, icount=0;
ULONG ulData;
pAST = ASTPTR(pScrn);
- astReg = &pAST->SavedReg;
-
+ astReg = &pAST->SavedReg;
+
if (pAST->jChipType == AST1180)
{
for (i=0; i<12; i++)
{
- ulData = astReg->GFX[i];
- WriteAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_CTRL+i*4, ulData);
- }
+ ulData = astReg->GFX[i];
+ WriteAST1180SOC(AST1180_GFX_BASE + AST1180_VGA1_CTRL+i*4, ulData);
+ }
}
else
{
#if defined(__sparc__) || defined(__mips__)
UCHAR jReg;
-
+
/* Restore Misc */
SetReg(MISC_PORT_WRITE, astReg->MISC);
/* Restore SR */
for (i=0; i<4; i++)
SetIndexReg(SEQ_PORT, (UCHAR) (i), astReg->SEQ[i]);
-
+
/* Restore CR */
- SetIndexRegMask(CRTC_PORT,0x11, 0x7F, 0x00);
+ SetIndexRegMask(CRTC_PORT,0x11, 0x7F, 0x00);
for (i=0; i<25; i++)
SetIndexReg(CRTC_PORT, (UCHAR) (i), astReg->CRTC[i]);
-
+
/* Restore GR */
for (i=0; i<9; i++)
SetIndexReg(GR_PORT, (UCHAR) (i), astReg->GR[i]);
-
+
/* Restore AR */
jReg = GetReg(INPUT_STATUS1_READ);
for (i=0; i<20; i++)
{
- SetReg(AR_PORT_WRITE, (UCHAR) i);
- SetReg(AR_PORT_WRITE, astReg->AR[i]);
+ SetReg(AR_PORT_WRITE, (UCHAR) i);
+ SetReg(AR_PORT_WRITE, astReg->AR[i]);
}
- SetReg(AR_PORT_WRITE, 0x14);
- SetReg(AR_PORT_WRITE, 0x00);
-
+ SetReg(AR_PORT_WRITE, 0x14);
+ SetReg(AR_PORT_WRITE, 0x00);
+
jReg = GetReg(INPUT_STATUS1_READ);
- SetReg (AR_PORT_WRITE, 0x20); /* set POS */
-#else
+ SetReg (AR_PORT_WRITE, 0x20); /* set POS */
+#else
vgaRegPtr vgaReg;
vgaReg = &VGAHWPTR(pScrn)->SavedReg;
-
- /* do restore */
+
+ /* do restore */
vgaHWProtect(pScrn, TRUE);
if (xf86IsPrimaryPci(pAST->PciInfo))
vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE | VGA_SR_FONTS);
else
- vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE);
- vgaHWProtect(pScrn, FALSE);
+ vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE);
+ vgaHWProtect(pScrn, FALSE);
#endif
-
+
/* Ext. restore */
vASTOpenKey(pScrn);
-
+
/* fixed Console Switch Refresh Rate Incorrect issue, ycchen@051106 */
for (i=0x81; i<=0xB6; i++)
SetIndexReg(CRTC_PORT, (UCHAR) (i), astReg->ExtCRTC[icount++]);
for (i=0xBC; i<=0xC1; i++)
SetIndexReg(CRTC_PORT, (UCHAR) (i), astReg->ExtCRTC[icount++]);
SetIndexReg(CRTC_PORT, (UCHAR) (0xBB), astReg->ExtCRTC[icount]);
-
+
/* Restore DAC */
for (i=0; i<256; i++)
- VGA_LOAD_PALETTE_INDEX (i, astReg->DAC[i][0], astReg->DAC[i][1], astReg->DAC[i][2]);
+ VGA_LOAD_PALETTE_INDEX (i, astReg->DAC[i][0], astReg->DAC[i][1], astReg->DAC[i][2]);
}
}
@@ -1415,35 +1415,35 @@ ASTRestore(ScrnInfoPtr pScrn)
static void
ASTProbeDDC(ScrnInfoPtr pScrn, int index)
{
- ASTRecPtr pAST = ASTPTR(pScrn);
+ ASTRecPtr pAST = ASTPTR(pScrn);
unsigned char DDC_data[128];
Bool Flags;
if (xf86LoadSubModule(pScrn, "ddc"))
{
- if (pAST->jChipType == AST1180)
+ if (pAST->jChipType == AST1180)
Flags = GetVGA2EDID(pScrn, DDC_data);
else
Flags = GetVGAEDID(pScrn, DDC_data);
- if (Flags)
+ if (Flags)
{
ConfiguredMonitor = xf86InterpretEDID(pScrn->scrnIndex, DDC_data);
}
else
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,"[ASTProbeDDC] Can't Get EDID Properly \n");
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,"[ASTProbeDDC] Can't Get EDID Properly \n");
+ }
else
{
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,"[ASTProbeDDC] Can't Load DDC Sub-Modules or Read EDID Failed \n");
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,"[ASTProbeDDC] Can't Load DDC Sub-Modules or Read EDID Failed \n");
+ }
}
#define SkipDT 0x00
#define DT1 0x01
#define DT2 0x02
-
+
static xf86MonPtr
ASTDoDDC(ScrnInfoPtr pScrn, int index)
{
@@ -1457,7 +1457,7 @@ ASTDoDDC(ScrnInfoPtr pScrn, int index)
struct monitor_ranges ranges, ranges1, ranges2;
int DTSelect, dclock1=0, h_active1=0, v_active1=0, dclock2=0, h_active2=0, v_active2=0;
struct std_timings stdtiming, *stdtiming1, *stdtiming2;
-
+
/* Honour Option "noDDC" */
if (xf86ReturnOptValBool(pAST->Options, OPTION_NO_DDC, FALSE)) {
return MonInfo;
@@ -1465,27 +1465,27 @@ ASTDoDDC(ScrnInfoPtr pScrn, int index)
if (xf86LoadSubModule(pScrn, "ddc"))
{
- if (pAST->jChipType == AST1180)
+ if (pAST->jChipType == AST1180)
Flags = GetVGA2EDID(pScrn, DDC_data);
else
Flags = GetVGAEDID(pScrn, DDC_data);
-
+
if (Flags)
- {
+ {
MonInfo = MonInfo1 = xf86InterpretEDID(pScrn->scrnIndex, DDC_data);
-
+
/* Valid Wide Screen Support */
if ( (MonInfo) && (MonInfo->det_mon[0].type == 0x00) )
{
if ( (MonInfo->det_mon[0].section.d_timings.h_active * 10 / MonInfo->det_mon[0].section.d_timings.v_active) < 14 )
- pAST->SupportWideScreen = FALSE;
- }
+ pAST->SupportWideScreen = FALSE;
+ }
}
-
+
/* For VGA2 CLONE Support, ycchen@012508 */
if ((xf86ReturnOptValBool(pAST->Options, OPTION_VGA2_CLONE, FALSE)) || pAST->VGA2Clone) {
if (GetVGA2EDID(pScrn, DDC_data) == TRUE) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Get VGA2 EDID Correctly!! \n");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Get VGA2 EDID Correctly!! \n");
MonInfo2 = xf86InterpretEDID(pScrn->scrnIndex, DDC_data);
if (MonInfo1 == NULL) /* No DDC1 EDID */
MonInfo = MonInfo2;
@@ -1494,50 +1494,50 @@ ASTDoDDC(ScrnInfoPtr pScrn, int index)
MonInfo->timings1.t1 = MonInfo1->timings1.t1 & MonInfo2->timings1.t1;
MonInfo->timings1.t2 = MonInfo1->timings1.t2 & MonInfo2->timings1.t2;
MonInfo->timings1.t_manu = MonInfo1->timings1.t_manu & MonInfo2->timings1.t_manu;
-
+
/* Update Std. Timing */
for (i=0; i<8; i++) {
- stdtiming.hsize = stdtiming.vsize = stdtiming.refresh = stdtiming.id = 0;
- for (j=0; j<8; j++) {
+ stdtiming.hsize = stdtiming.vsize = stdtiming.refresh = stdtiming.id = 0;
+ for (j=0; j<8; j++) {
if ((MonInfo1->timings2[i].hsize == MonInfo2->timings2[j].hsize) && \
(MonInfo1->timings2[i].vsize == MonInfo2->timings2[j].vsize) && \
(MonInfo1->timings2[i].refresh == MonInfo2->timings2[j].refresh)) {
stdtiming = MonInfo1->timings2[i];
break;
- }
+ }
}
-
+
MonInfo->timings2[i] = stdtiming;
} /* Std. Timing */
-
+
/* Get Detailed Timing */
for (i=0;i<4;i++) {
if (MonInfo1->det_mon[i].type == 0xFD)
ranges1 = MonInfo1->det_mon[i].section.ranges;
else if (MonInfo1->det_mon[i].type == 0xFA)
- stdtiming1 = MonInfo1->det_mon[i].section.std_t;
+ stdtiming1 = MonInfo1->det_mon[i].section.std_t;
else if (MonInfo1->det_mon[i].type == 0x00) {
if (MonInfo1->det_mon[i].section.d_timings.clock > dclock1)
dclock1 = MonInfo1->det_mon[i].section.d_timings.clock;
if (MonInfo1->det_mon[i].section.d_timings.h_active > h_active1)
h_active1 = MonInfo1->det_mon[i].section.d_timings.h_active;
if (MonInfo1->det_mon[i].section.d_timings.v_active > v_active1)
- v_active1 = MonInfo1->det_mon[i].section.d_timings.v_active;
- }
+ v_active1 = MonInfo1->det_mon[i].section.d_timings.v_active;
+ }
if (MonInfo2->det_mon[i].type == 0xFD)
ranges2 = MonInfo2->det_mon[i].section.ranges;
else if (MonInfo1->det_mon[i].type == 0xFA)
- stdtiming2 = MonInfo2->det_mon[i].section.std_t;
+ stdtiming2 = MonInfo2->det_mon[i].section.std_t;
else if (MonInfo2->det_mon[i].type == 0x00) {
if (MonInfo2->det_mon[i].section.d_timings.clock > dclock2)
dclock2 = MonInfo2->det_mon[i].section.d_timings.clock;
if (MonInfo2->det_mon[i].section.d_timings.h_active > h_active2)
h_active2 = MonInfo2->det_mon[i].section.d_timings.h_active;
if (MonInfo2->det_mon[i].section.d_timings.v_active > v_active2)
- v_active2 = MonInfo2->det_mon[i].section.d_timings.v_active;
- }
+ v_active2 = MonInfo2->det_mon[i].section.d_timings.v_active;
+ }
} /* Get Detailed Timing */
-
+
/* Chk Detailed Timing */
if ((dclock1 >= dclock2) && (h_active1 >= h_active2) && (v_active1 >= v_active2))
DTSelect = DT2;
@@ -1545,21 +1545,21 @@ ASTDoDDC(ScrnInfoPtr pScrn, int index)
DTSelect = DT1;
else
DTSelect = SkipDT;
-
- /* Chk Monitor Descriptor */
+
+ /* Chk Monitor Descriptor */
ranges = ranges1;
ranges.min_h = ranges1.min_h > ranges2.min_h ? ranges1.min_h:ranges2.min_h;
- ranges.min_v = ranges1.min_v > ranges2.min_v ? ranges1.min_v:ranges2.min_v;
+ ranges.min_v = ranges1.min_v > ranges2.min_v ? ranges1.min_v:ranges2.min_v;
ranges.max_h = ranges1.max_h < ranges2.max_h ? ranges1.max_h:ranges2.max_h;
ranges.max_v = ranges1.max_v < ranges2.max_v ? ranges1.max_v:ranges2.max_v;
ranges.max_clock = ranges1.max_clock < ranges2.max_clock ? ranges1.max_clock:ranges2.max_clock;
-
+
/* Update Detailed Timing */
for (i=0; i<4; i++)
{
if (MonInfo->det_mon[i].type == 0xFD) {
MonInfo->det_mon[i].section.ranges = ranges;
- }
+ }
else if (MonInfo->det_mon[i].type == 0xFA) {
for (j=0; j<5; j++) {
stdtiming.hsize = stdtiming.vsize = stdtiming.refresh = stdtiming.id = 0;
@@ -1569,10 +1569,10 @@ ASTDoDDC(ScrnInfoPtr pScrn, int index)
(stdtiming1[j].refresh == stdtiming2[k].refresh)) {
stdtiming = stdtiming1[j];
break;
- }
+ }
}
stdtiming1[j] = stdtiming;
- } /* Std. Timing */
+ } /* Std. Timing */
} /* FA */
else if (MonInfo->det_mon[i].type == 0x00) {
if (DTSelect == DT2)
@@ -1591,57 +1591,57 @@ ASTDoDDC(ScrnInfoPtr pScrn, int index)
MonInfo->det_mon[i].section.d_timings.h_sync_width = 136;
MonInfo->det_mon[i].section.d_timings.v_sync_off = 3;
MonInfo->det_mon[i].section.d_timings.v_sync_width = 6;
- }
+ }
} /* 00 */
else { /* use Monitor 1 as default */
- MonInfo->det_mon[i] = MonInfo1->det_mon[i];
+ MonInfo->det_mon[i] = MonInfo1->det_mon[i];
}
-
+
} /* Update Detailed Timing */
-
+
/* set feature size */
if (DTSelect == DT2) {
MonInfo->features.hsize = MonInfo2->features.hsize;
- MonInfo->features.vsize = MonInfo2->features.vsize;
+ MonInfo->features.vsize = MonInfo2->features.vsize;
}
else if (DTSelect == DT1) {
MonInfo->features.hsize = MonInfo1->features.hsize;
- MonInfo->features.vsize = MonInfo1->features.vsize;
+ MonInfo->features.vsize = MonInfo1->features.vsize;
}
else /* Skip DT */
{ /* use 1024x768 as default */
MonInfo->features.hsize = 0x20;
- MonInfo->features.vsize = 0x18;
- }
-
+ MonInfo->features.vsize = 0x18;
+ }
+
} /* Check with VGA1 & VGA2 EDID */
-
+
} /* GetVGA2EDID */
else {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Can't Get VGA2 EDID Correctly!! \n");
- }
+ }
} /* VGA2Clone */
-
+
xf86PrintEDID(MonInfo);
- xf86SetDDCproperties(pScrn, MonInfo);
- }
+ xf86SetDDCproperties(pScrn, MonInfo);
+ }
else
{
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,"[ASTDoDDC] Can't Load DDC Sub-Modules or Read EDID Failed \n");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,"[ASTDoDDC] Can't Load DDC Sub-Modules or Read EDID Failed \n");
}
/* Fill pAST Monitor Info */
if (MonInfo == NULL)
{ /* default for Non-EDID */
pAST->mon_h_active = 1024;
- pAST->mon_v_active = 768;
- }
+ pAST->mon_v_active = 768;
+ }
else
{ /* save MonInfo to Private */
pAST->mon_h_active = MonInfo->det_mon[0].section.d_timings.h_active;
pAST->mon_v_active = MonInfo->det_mon[0].section.d_timings.v_active;
- }
-
+ }
+
return MonInfo;
}
@@ -1649,12 +1649,12 @@ static void
vFillASTModeInfo (ScrnInfoPtr pScrn)
{
ASTRecPtr pAST;
-
+
pAST = ASTPTR(pScrn);
-
- pAST->VideoModeInfo.ScreenWidth = pScrn->virtualX;
- pAST->VideoModeInfo.ScreenHeight = pScrn->virtualY;
- pAST->VideoModeInfo.bitsPerPixel = pScrn->bitsPerPixel;
+
+ pAST->VideoModeInfo.ScreenWidth = pScrn->virtualX;
+ pAST->VideoModeInfo.ScreenHeight = pScrn->virtualY;
+ pAST->VideoModeInfo.bitsPerPixel = pScrn->bitsPerPixel;
/* Fixed screen pitch incorrect in some specific monitor, ycchen@071707 */
pAST->VideoModeInfo.ScreenPitch = pScrn->displayWidth * ((pScrn->bitsPerPixel + 1) / 8) ;
@@ -1669,10 +1669,10 @@ ASTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
pScrn->vtSema = TRUE;
pAST->ModePtr = mode;
-
+
#if defined(__sparc__) || defined(__mips__)
if (!ASTSetMode(pScrn, mode))
- return FALSE;
+ return FALSE;
#else
vgaHWPtr hwp;
@@ -1688,7 +1688,7 @@ ASTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
if (!ASTSetMode(pScrn, mode))
return FALSE;
-
+
vgaHWProtect(pScrn, FALSE);
#endif
@@ -1758,12 +1758,12 @@ static void ASTStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit)
{
ASTPortPrivPtr pPriv = (ASTPortPrivPtr)data;
ASTPtr pAST = ASTPTR(pScrn);
-
+
REGION_EMPTY(pScrn->pScreen, &pPriv->clip);
-
+
if(exit)
{
- if(pPriv->fbAreaPtr)
+ if(pPriv->fbAreaPtr)
{
xf86FreeOffscreenArea(pPriv->fbAreaPtr);
pPriv->fbAreaPtr = NULL;
@@ -1771,14 +1771,14 @@ static void ASTStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit)
}
/* clear all flag */
pPriv->videoStatus = 0;
- }
+ }
else
{
-#if 0
- if(pPriv->videoStatus & CLIENT_VIDEO_ON)
+#if 0
+ if(pPriv->videoStatus & CLIENT_VIDEO_ON)
{
pPriv->videoStatus |= OFF_TIMER;
-
+
}
#endif
}
@@ -1788,65 +1788,65 @@ static int ASTSetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 value, p
{
ASTPortPrivPtr pPriv = (ASTPortPrivPtr)data;
ASTPtr pAST = ASTPTR(pScrn);
-
+
xf86DrvMsg(pScrn->scrnIndex, X_INFO,"ASTSetPortAttribute(),attribute=%x\n", attribute);
-
- if (attribute == pAST->xvBrightness)
+
+ if (attribute == pAST->xvBrightness)
{
if((value < -128) || (value > 127))
return BadValue;
-
+
pPriv->brightness = value;
}
- else if (attribute == pAST->xvContrast)
+ else if (attribute == pAST->xvContrast)
{
if ((value < 0) || (value > 255))
return BadValue;
-
+
pPriv->contrast = value;
}
else if (attribute == pAST->xvSaturation)
{
if ((value < -180) || (value > 180))
return BadValue;
-
+
pPriv->saturation = value;
}
else if (attribute == pAST->xvHue)
{
if ((value < -180) || (value > 180))
return BadValue;
-
+
pPriv->hue = value;
}
- else if (attribute == pAST->xvColorKey)
+ else if (attribute == pAST->xvColorKey)
{
pPriv->colorKey = value;
REGION_EMPTY(pScrn->pScreen, &pPriv->clip);
}
- else if(attribute == pAST->xvGammaRed)
+ else if(attribute == pAST->xvGammaRed)
{
if((value < 100) || (value > 10000))
return BadValue;
pPriv->gammaR = value;
}
- else if(attribute == pAST->xvGammaGreen)
+ else if(attribute == pAST->xvGammaGreen)
{
if((value < 100) || (value > 10000))
return BadValue;
- pPriv->gammaG = value;
- }
- else if(attribute == pAST->xvGammaBlue)
+ pPriv->gammaG = value;
+ }
+ else if(attribute == pAST->xvGammaBlue)
{
if((value < 100) || (value > 10000))
return BadValue;
pPriv->gammaB = value;
- }
+ }
else
{
return BadMatch;
}
-
+
return Success;
}
@@ -1854,50 +1854,50 @@ static int ASTGetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 *value,
{
ASTPortPrivPtr pPriv = (ASTPortPrivPtr)data;
ASTPtr pAST = ASTPTR(pScrn);
-
+
xf86DrvMsg(pScrn->scrnIndex, X_INFO,"ASTGetPortAttribute(),attribute=%x\n", attribute);
-
- if (attribute == pAST->xvBrightness)
+
+ if (attribute == pAST->xvBrightness)
{
*value = pPriv->brightness;
}
- else if (attribute == pAST->xvContrast)
+ else if (attribute == pAST->xvContrast)
{
*value = pPriv->contrast;
}
- else if (attribute == pAST->xvSaturation)
+ else if (attribute == pAST->xvSaturation)
{
*value = pPriv->saturation;
}
- else if (attribute == pAST->xvHue)
+ else if (attribute == pAST->xvHue)
{
*value = pPriv->hue;
- }
- else if(attribute == pAST->xvGammaRed)
+ }
+ else if(attribute == pAST->xvGammaRed)
{
*value = pPriv->gammaR;
-
+
}
- else if(attribute == pAST->xvGammaGreen)
+ else if(attribute == pAST->xvGammaGreen)
{
*value = pPriv->gammaG;
}
- else if(attribute == pAST->xvGammaBlue)
+ else if(attribute == pAST->xvGammaBlue)
{
*value = pPriv->gammaB;
}
- else if (attribute == pAST->xvColorKey)
+ else if (attribute == pAST->xvColorKey)
{
*value = pPriv->colorKey;
}
else
return BadMatch;
-
+
return Success;
}
-static void ASTQueryBestSize(ScrnInfoPtr pScrn, Bool motion,
- short vid_w, short vid_h,
+static void ASTQueryBestSize(ScrnInfoPtr pScrn, Bool motion,
+ short vid_w, short vid_h,
short drw_w, short drw_h,
unsigned int *p_w, unsigned int *p_h,
pointer data)
@@ -1986,7 +1986,7 @@ static int ASTPutImage(ScrnInfoPtr pScrn,
Bool sync,
RegionPtr clipBoxes, pointer data
)
-{
+{
ASTPtr pAST = ASTPTR(pScrn);
ASTPortPrivPtr pPriv = (ASTPortPrivPtr)data;
int i;
@@ -1994,7 +1994,7 @@ static int ASTPutImage(ScrnInfoPtr pScrn,
xf86DrvMsg(pScrn->scrnIndex, X_INFO,"ASTPutImage()\n");
/* int depth = pAST->CurrentLayout.bitsPerPixel >> 3; */
-
+
pPriv->drw_x = drw_x;
pPriv->drw_y = drw_y;
pPriv->drw_w = drw_w;
@@ -2005,7 +2005,7 @@ static int ASTPutImage(ScrnInfoPtr pScrn,
pPriv->src_h = src_h;
pPriv->id = id;
pPriv->height = height;
-
+
switch(id)
{
case PIXEL_FMT_YV12:
@@ -2023,52 +2023,52 @@ static int ASTPutImage(ScrnInfoPtr pScrn,
pPriv->srcPitch = ((width << 1) + 3) & ~3; /* Verified */
totalSize = pPriv->srcPitch * height;
}
-
+
totalSize += 15;
totalSize &= ~15;
/* allocate memory */
-
+
if(totalSize == pPriv->fbSize)
{
- ;
- }
+ ;
+ }
else
{
- int lines, pitch, depth;
+ int lines, pitch, depth;
BoxPtr pBox = NULL;
-
+
pPriv->fbSize = totalSize;
-
- if(pPriv->fbAreaPtr)
+
+ if(pPriv->fbAreaPtr)
{
xf86FreeOffscreenArea(pPriv->fbAreaPtr);
}
-
+
depth = (pScrn->bitsPerPixel + 7 ) / 8;
pitch = pScrn->displayWidth * depth;
lines = ((totalSize * 2) / pitch) + 1;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,"ASTPutImagelines=%x, pitch=%x, displayWidth=%x\n", lines, pitch, pScrn->displayWidth);
-
-
- pPriv->fbAreaPtr = xf86AllocateOffscreenArea(pScrn->pScreen,
+
+
+ pPriv->fbAreaPtr = xf86AllocateOffscreenArea(pScrn->pScreen,
pScrn->displayWidth,
lines, 0, NULL, NULL, NULL);
-
- if(!pPriv->fbAreaPtr)
+
+ if(!pPriv->fbAreaPtr)
{
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Allocate video memory fails\n");
return BadAlloc;
}
-
- pBox = &(pPriv->fbAreaPtr->box);
- pPriv->bufAddr[0] = (pBox->y1 * pitch) + (pBox->x1 * depth);
+
+ pBox = &(pPriv->fbAreaPtr->box);
+ pPriv->bufAddr[0] = (pBox->y1 * pitch) + (pBox->x1 * depth);
pPriv->bufAddr[1] = pPriv->bufAddr[0] + totalSize;
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Put Image, pPriv->bufAddr[0]=0x%08X\n", pPriv->bufAddr[0]);
-
+
}
-
+
/* copy data */
- if(totalSize < 16)
+ if(totalSize < 16)
{
#ifdef NewPath
memcpy(pAST->FBVirtualAddr + pPriv->bufAddr[pPriv->currentBuf], buf, totalSize);
@@ -2078,22 +2078,22 @@ static int ASTPutImage(ScrnInfoPtr pScrn,
case PIXEL_FMT_YUY2:
case PIXEL_FMT_UYVY:
case PIXEL_FMT_YVYU:
- {
+ {
BYTE *Base = (BYTE *)(pAST->FBVirtualAddr + pPriv->bufAddr[pPriv->currentBuf]);
for(i=0; i<height; i++)
memcpy( Base + i * pPriv->srcPitch, buf + i*width*2, width*2);
break;
- }
+ }
default:
memcpy(pAST->FBVirtualAddr + pPriv->bufAddr[pPriv->currentBuf], buf, totalSize);
break;
} /* switch */
#endif /* NewPath */
- }
+ }
else
{
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Put Image, copy buf\n");
-
+
#ifdef NewPath
memcpy(pAST->FBVirtualAddr + pPriv->bufAddr[pPriv->currentBuf], buf, totalSize);
#else /* NewPath */
@@ -2106,7 +2106,7 @@ static int ASTPutImage(ScrnInfoPtr pScrn,
BYTE *Base = (BYTE *)(pAST->FBVirtualAddr + pPriv->bufAddr[pPriv->currentBuf]);
for(i=0; i<height; i++)
memcpy( Base + i * pPriv->srcPitch, buf + i*width*2, width*2);
-
+
/*for(i=0; i<height; i++)
for(j=0; j<width*2; j++)
*(Base+i*pPriv->srcPitch+j) = *(buf + width*i + j);*/
@@ -2123,21 +2123,21 @@ static int ASTPutImage(ScrnInfoPtr pScrn,
} /* end of switch */
#endif /* NewPath */
}
-
+
ASTDisplayVideo(pScrn, pPriv, clipBoxes, id);
-
- /* update cliplist
- if(!REGION_EQUAL(pScrn->pScreen, &pPriv->clip, clipBoxes))
- {
+
+ /* update cliplist
+ if(!REGION_EQUAL(pScrn->pScreen, &pPriv->clip, clipBoxes))
+ {
REGION_COPY(pScrn->pScreen, &pPriv->clip, clipBoxes);
}
- else
+ else
{
xf86XVFillKeyHelper(pScrn->pScreen, 0xFFFFFFFF, clipBoxes);
}
*/
pPriv->currentBuf ^= 1;
-
+
return Success;
}
@@ -2147,10 +2147,10 @@ static XF86VideoAdaptorPtr ASTSetupImageVideo(ScreenPtr pScreen)
ASTPtr pAST = ASTPTR(pScrn);
XF86VideoAdaptorPtr adapt;
ASTPortPrivPtr pPriv;
-
+
if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) +
- sizeof(DevUnion) +
+ sizeof(DevUnion) +
sizeof(ASTPortPrivRec))))
return NULL;
@@ -2160,7 +2160,7 @@ static XF86VideoAdaptorPtr ASTSetupImageVideo(ScreenPtr pScreen)
adapt->nEncodings = 1;
adapt->pEncodings = &DummyEncoding;
-
+
adapt->nFormats = NUM_FORMATS;
adapt->pFormats = ASTFormats;
adapt->nPorts = 1;
@@ -2175,7 +2175,7 @@ static XF86VideoAdaptorPtr ASTSetupImageVideo(ScreenPtr pScreen)
adapt->pImages = ASTImages;
adapt->PutVideo = NULL;
-
+
adapt->PutStill = NULL;
adapt->GetVideo = NULL;
adapt->GetStill = NULL;
@@ -2207,7 +2207,7 @@ static XF86VideoAdaptorPtr ASTSetupImageVideo(ScreenPtr pScreen)
#endif
pAST->adaptor = adapt;
-
+
pAST->xvBrightness = MAKE_ATOM(astxvbrightness);
pAST->xvContrast = MAKE_ATOM(astxvcontrast);
pAST->xvColorKey = MAKE_ATOM(astxvcolorkey);
@@ -2216,7 +2216,7 @@ static XF86VideoAdaptorPtr ASTSetupImageVideo(ScreenPtr pScreen)
pAST->xvGammaRed = MAKE_ATOM(astxvgammared);
pAST->xvGammaGreen = MAKE_ATOM(astxvgammagreen);
pAST->xvGammaBlue = MAKE_ATOM(astxvgammablue);
-
+
return adapt;
}
@@ -2228,20 +2228,20 @@ void ASTInitVideo(ScreenPtr pScreen)
int num_adaptors;
ASTAdaptor = ASTSetupImageVideo(pScreen);
-
+
num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors);
- if(ASTAdaptor)
+ if(ASTAdaptor)
{
- if(!num_adaptors)
+ if(!num_adaptors)
{
num_adaptors = 1;
adaptors = &ASTAdaptor;
}
- else
+ else
{
newAdaptors = malloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*));
- if(newAdaptors)
+ if(newAdaptors)
{
memcpy(newAdaptors, adaptors, num_adaptors *
sizeof(XF86VideoAdaptorPtr));