mirror of
https://github.com/X11Libre/xf86-video-ast.git
synced 2026-03-24 01:24:41 +00:00
Initial code release from ASPEED Technology Inc. Bugzilla #4937
<https://bugs.freedesktop.org/show_bug.cgi?id=4937> Attachment 3686 <https://bugs.freedesktop.org/attachment.cgi?id=3686>
This commit is contained in:
17
ChangeLog
Normal file
17
ChangeLog
Normal file
@@ -0,0 +1,17 @@
|
||||
2006-03-14 Alan Coopersmith <alan.coopersmith@sun.com>
|
||||
|
||||
* src/ast.h:
|
||||
* src/ast_2dtool.c:
|
||||
* src/ast_2dtool.h:
|
||||
* src/ast_accel.c:
|
||||
* src/ast_cursor.c:
|
||||
* src/ast_cursor.h:
|
||||
* src/ast_driver.c:
|
||||
* src/ast_mode.c:
|
||||
* src/ast_mode.h:
|
||||
* src/ast_tool.c:
|
||||
* src/ast_vgatool.c:
|
||||
* src/ast_vgatool.h:
|
||||
Initial code release from ASPEED Technology Inc.
|
||||
Bugzilla #4937 <https://bugs.freedesktop.org/show_bug.cgi?id=4937>
|
||||
Attachment 3686 <https://bugs.freedesktop.org/attachment.cgi?id=3686>
|
||||
167
src/ast.h
Normal file
167
src/ast.h
Normal file
@@ -0,0 +1,167 @@
|
||||
/*
|
||||
* Copyright (c) 2005 ASPEED Technology Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of the authors not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. The authors makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as is" without express or implied warranty.
|
||||
*
|
||||
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* Compiler Options */
|
||||
#define Accel_2D
|
||||
/* #define MMIO_2D */
|
||||
#define HWC
|
||||
|
||||
/* Vendor & Device Info */
|
||||
#ifndef PCI_VENDOR_AST
|
||||
#define PCI_VENDOR_AST 0x1A03
|
||||
#endif
|
||||
|
||||
#ifndef PCI_CHIP_AST2000
|
||||
#define PCI_CHIP_AST2000 0x2000
|
||||
#endif
|
||||
|
||||
/* AST REC Info */
|
||||
#define AST_NAME "AST"
|
||||
#define AST_DRIVER_NAME "ast"
|
||||
#define AST_MAJOR_VERSION 0
|
||||
#define AST_MINOR_VERSION 51
|
||||
#define AST_PATCH_VERSION 0
|
||||
#define AST_VERSION \
|
||||
((AST_MAJOR_VERSION << 20) | (AST_MINOR_VERSION << 10) | AST_PATCH_VERSION)
|
||||
|
||||
/* Customized Info */
|
||||
#define DEFAULT_VIDEOMEM_SIZE 0x00800000
|
||||
#define DEFAULT_MMIO_SIZE 0x00020000
|
||||
#define DEFAULT_CMDQ_SIZE 0x00100000
|
||||
#define CMD_QUEUE_GUARD_BAND 0x00000020
|
||||
#define DEFAULT_HWC_NUM 0x00000002
|
||||
|
||||
/* Data Type Definition */
|
||||
typedef INT32 LONG;
|
||||
typedef CARD8 UCHAR;
|
||||
typedef CARD16 USHORT;
|
||||
typedef CARD32 ULONG;
|
||||
|
||||
/* Data Structure Definition */
|
||||
typedef struct _ASTRegRec {
|
||||
UCHAR ExtCRTC[0x50];
|
||||
|
||||
} ASTRegRec, *ASTRegPtr;
|
||||
|
||||
typedef struct _VIDEOMODE {
|
||||
|
||||
int ScreenWidth;
|
||||
int ScreenHeight;
|
||||
int bitsPerPixel;
|
||||
int ScreenPitch;
|
||||
|
||||
} VIDEOMODE, *PVIDEOMODE;
|
||||
|
||||
typedef struct {
|
||||
|
||||
ULONG ulCMDQSize;
|
||||
ULONG ulCMDQType;
|
||||
|
||||
ULONG ulCMDQOffsetAddr;
|
||||
UCHAR *pjCMDQVirtualAddr;
|
||||
|
||||
UCHAR *pjCmdQBasePort;
|
||||
UCHAR *pjWritePort;
|
||||
UCHAR *pjReadPort;
|
||||
UCHAR *pjEngStatePort;
|
||||
|
||||
ULONG ulCMDQMask;
|
||||
ULONG ulCurCMDQueueLen;
|
||||
|
||||
ULONG ulWritePointer;
|
||||
ULONG ulReadPointer;
|
||||
|
||||
ULONG ulReadPointer_OK; /* for Eng_DBGChk */
|
||||
|
||||
} CMDQINFO, *PCMDQINFO;
|
||||
|
||||
typedef struct {
|
||||
|
||||
int HWC_NUM;
|
||||
int HWC_NUM_Next;
|
||||
|
||||
ULONG ulHWCOffsetAddr;
|
||||
UCHAR *pjHWCVirtualAddr;
|
||||
|
||||
USHORT cursortype;
|
||||
USHORT width;
|
||||
USHORT height;
|
||||
USHORT offset_x;
|
||||
USHORT offset_y;
|
||||
ULONG fg;
|
||||
ULONG bg;
|
||||
|
||||
|
||||
} HWCINFO, *PHWCINFO;
|
||||
|
||||
typedef struct _ASTRec {
|
||||
|
||||
EntityInfoPtr pEnt;
|
||||
pciVideoPtr PciInfo;
|
||||
PCITAG PciTag;
|
||||
|
||||
OptionInfoPtr Options;
|
||||
DisplayModePtr ModePtr;
|
||||
FBLinearPtr pCMDQPtr;
|
||||
XAAInfoRecPtr AccelInfoPtr;
|
||||
xf86CursorInfoPtr HWCInfoPtr;
|
||||
FBLinearPtr pHWCPtr;
|
||||
|
||||
CloseScreenProcPtr CloseScreen;
|
||||
ScreenBlockHandlerProcPtr BlockHandler;
|
||||
|
||||
Bool noAccel;
|
||||
Bool noHWC;
|
||||
Bool MMIO2D;
|
||||
int ENGCaps;
|
||||
int DBGSelect;
|
||||
|
||||
ULONG FBPhysAddr; /* Frame buffer physical address */
|
||||
ULONG MMIOPhysAddr; /* MMIO region physical address */
|
||||
ULONG BIOSPhysAddr; /* BIOS physical address */
|
||||
|
||||
UCHAR *FBVirtualAddr; /* Map of frame buffer */
|
||||
UCHAR *MMIOVirtualAddr; /* Map of MMIO region */
|
||||
|
||||
unsigned long FbMapSize;
|
||||
unsigned long MMIOMapSize;
|
||||
|
||||
IOADDRESS IODBase; /* Base of PIO memory area */
|
||||
IOADDRESS PIOOffset;
|
||||
IOADDRESS RelocateIO;
|
||||
|
||||
VIDEOMODE VideoModeInfo;
|
||||
ASTRegRec SavedReg;
|
||||
CMDQINFO CMDQInfo;
|
||||
HWCINFO HWCInfo;
|
||||
ULONG ulCMDReg;
|
||||
Bool EnableClip;
|
||||
|
||||
} ASTRec, *ASTRecPtr;
|
||||
|
||||
#define ASTPTR(p) ((ASTRecPtr)((p)->driverPrivate))
|
||||
|
||||
/* Include Files */
|
||||
#include "ast_mode.h"
|
||||
#include "ast_vgatool.h"
|
||||
#include "ast_2dtool.h"
|
||||
#include "ast_cursor.h"
|
||||
795
src/ast_2dtool.c
Normal file
795
src/ast_2dtool.c
Normal file
@@ -0,0 +1,795 @@
|
||||
/*
|
||||
* Copyright (c) 2005 ASPEED Technology Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of the authors not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. The authors makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as is" without express or implied warranty.
|
||||
*
|
||||
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "xf86.h"
|
||||
#include "xf86_ansic.h"
|
||||
#include "xf86_OSproc.h"
|
||||
#include "xf86Resources.h"
|
||||
#include "xf86RAC.h"
|
||||
#include "xf86cmap.h"
|
||||
#include "compiler.h"
|
||||
#include "mibstore.h"
|
||||
#include "vgaHW.h"
|
||||
#include "mipointer.h"
|
||||
#include "micmap.h"
|
||||
|
||||
#include "fb.h"
|
||||
#include "regionstr.h"
|
||||
#include "xf86xv.h"
|
||||
#include "Xv.h"
|
||||
#include "vbe.h"
|
||||
|
||||
#include "xf86PciInfo.h"
|
||||
#include "xf86Pci.h"
|
||||
|
||||
/* framebuffer offscreen manager */
|
||||
#include "xf86fbman.h"
|
||||
|
||||
/* include xaa includes */
|
||||
#include "xaa.h"
|
||||
#include "xaarop.h"
|
||||
|
||||
/* H/W cursor support */
|
||||
#include "xf86Cursor.h"
|
||||
|
||||
/* Driver specific headers */
|
||||
#include "ast.h"
|
||||
|
||||
#ifdef Accel_2D
|
||||
|
||||
/* Prototype type declaration */
|
||||
Bool bInitCMDQInfo(ScrnInfoPtr pScrn, ASTRecPtr pAST);
|
||||
Bool bEnableCMDQ(ScrnInfoPtr pScrn, ASTRecPtr pAST);
|
||||
Bool bEnable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST);
|
||||
void vDisable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST);
|
||||
void vWaitEngIdle(ScrnInfoPtr pScrn, ASTRecPtr pAST);
|
||||
UCHAR *pjRequestCMDQ(ASTRecPtr pAST, ULONG ulDataLen);
|
||||
Bool bGetLineTerm(_LINEInfo *LineInfo, LINEPARAM *dsLineParam);
|
||||
LONG lGetDiaRg(LONG GFracX, LONG GFracY);
|
||||
|
||||
Bool
|
||||
bInitCMDQInfo(ScrnInfoPtr pScrn, ASTRecPtr pAST)
|
||||
{
|
||||
|
||||
pAST->CMDQInfo.pjCmdQBasePort = pAST->MMIOVirtualAddr+ 0x8044;
|
||||
pAST->CMDQInfo.pjWritePort = pAST->MMIOVirtualAddr+ 0x8048;
|
||||
pAST->CMDQInfo.pjReadPort = pAST->MMIOVirtualAddr+ 0x804C;
|
||||
pAST->CMDQInfo.pjEngStatePort = pAST->MMIOVirtualAddr+ 0x804C;
|
||||
|
||||
/* CMDQ mode Init */
|
||||
if (!pAST->MMIO2D) {
|
||||
pAST->CMDQInfo.ulCMDQType = VM_CMD_QUEUE;
|
||||
|
||||
ScreenPtr pScreen;
|
||||
|
||||
pScreen = screenInfo.screens[pScrn->scrnIndex];
|
||||
|
||||
pAST->pCMDQPtr = xf86AllocateOffscreenLinear (pScreen, 1024*1024, 8, NULL, NULL, NULL);
|
||||
|
||||
if (!pAST->pCMDQPtr) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"Allocate CMDQ failed \n");
|
||||
pAST->MMIO2D = TRUE; /* set to MMIO mode if CMDQ allocate failed */
|
||||
}
|
||||
|
||||
pAST->CMDQInfo.ulCMDQOffsetAddr = pAST->pCMDQPtr->offset*((pScrn->bitsPerPixel + 1) / 8);
|
||||
pAST->CMDQInfo.pjCMDQVirtualAddr = pAST->FBVirtualAddr + pAST->CMDQInfo.ulCMDQOffsetAddr;
|
||||
|
||||
pAST->CMDQInfo.ulCurCMDQueueLen = pAST->CMDQInfo.ulCMDQSize - CMD_QUEUE_GUARD_BAND;
|
||||
pAST->CMDQInfo.ulCMDQMask = pAST->CMDQInfo.ulCMDQSize - 1 ;
|
||||
}
|
||||
|
||||
/* MMIO mode init */
|
||||
if (pAST->MMIO2D) {
|
||||
pAST->CMDQInfo.ulCMDQType = VM_CMD_MMIO;
|
||||
}
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
Bool
|
||||
bEnableCMDQ(ScrnInfoPtr pScrn, ASTRecPtr pAST)
|
||||
{
|
||||
ULONG ulVMCmdQBasePort = 0;
|
||||
|
||||
vWaitEngIdle(pScrn, pAST);
|
||||
|
||||
/* set DBG Select Info */
|
||||
if (pAST->DBGSelect)
|
||||
{
|
||||
*(ULONG *) (pAST->MMIOVirtualAddr + 0x804C) = (ULONG) (pAST->DBGSelect);
|
||||
}
|
||||
|
||||
/* set CMDQ base */
|
||||
switch (pAST->CMDQInfo.ulCMDQType)
|
||||
{
|
||||
case VM_CMD_QUEUE:
|
||||
ulVMCmdQBasePort = (pAST->CMDQInfo.ulCMDQOffsetAddr - 0) >> 3;
|
||||
|
||||
/* set CMDQ Threshold */
|
||||
ulVMCmdQBasePort |= 0xF0000000;
|
||||
|
||||
/* set CMDQ Size */
|
||||
switch (pAST->CMDQInfo.ulCMDQSize)
|
||||
{
|
||||
case CMD_QUEUE_SIZE_256K:
|
||||
ulVMCmdQBasePort |= 0x00000000;
|
||||
break;
|
||||
|
||||
case CMD_QUEUE_SIZE_512K:
|
||||
ulVMCmdQBasePort |= 0x04000000;
|
||||
break;
|
||||
|
||||
case CMD_QUEUE_SIZE_1M:
|
||||
ulVMCmdQBasePort |= 0x08000000;
|
||||
break;
|
||||
|
||||
case CMD_QUEUE_SIZE_2M:
|
||||
ulVMCmdQBasePort |= 0x0C000000;
|
||||
break;
|
||||
|
||||
default:
|
||||
return(FALSE);
|
||||
break;
|
||||
}
|
||||
|
||||
*(ULONG *) (pAST->CMDQInfo.pjCmdQBasePort) = ulVMCmdQBasePort;
|
||||
pAST->CMDQInfo.ulWritePointer = *(ULONG *) (pAST->CMDQInfo.pjWritePort);
|
||||
break;
|
||||
|
||||
case VM_CMD_MMIO:
|
||||
/* set CMDQ Threshold */
|
||||
ulVMCmdQBasePort |= 0xF0000000;
|
||||
|
||||
ulVMCmdQBasePort |= 0x02000000; /* MMIO mode */
|
||||
*(ULONG *) (pAST->CMDQInfo.pjCmdQBasePort) = ulVMCmdQBasePort;
|
||||
break;
|
||||
|
||||
default:
|
||||
return (FALSE);
|
||||
break;
|
||||
}
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
Bool
|
||||
bEnable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST)
|
||||
{
|
||||
SetIndexRegMask(CRTC_PORT, 0xA4, 0xFE, 0x01); /* enable 2D */
|
||||
|
||||
if (!bInitCMDQInfo(pScrn, pAST))
|
||||
{
|
||||
vDisable2D(pScrn, pAST);
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
if (!bEnableCMDQ(pScrn, pAST))
|
||||
{
|
||||
vDisable2D(pScrn, pAST);
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
vDisable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST)
|
||||
{
|
||||
|
||||
vWaitEngIdle(pScrn, pAST);
|
||||
vWaitEngIdle(pScrn, pAST);
|
||||
|
||||
SetIndexRegMask(CRTC_PORT, 0xA4, 0xFE, 0x00);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
vWaitEngIdle(ScrnInfoPtr pScrn, ASTRecPtr pAST)
|
||||
{
|
||||
ULONG ulEngState, ulEngState2;
|
||||
UCHAR jReg;
|
||||
ULONG ulEngCheckSetting;
|
||||
|
||||
if (pAST->MMIO2D)
|
||||
ulEngCheckSetting = 0x10000000;
|
||||
else
|
||||
ulEngCheckSetting = 0x80000000;
|
||||
|
||||
/* 2D disable if 0xA4 D[0] = 1 */
|
||||
GetIndexRegMask(CRTC_PORT, 0xA4, 0x01, jReg);
|
||||
if (!jReg) goto Exit_vWaitEngIdle;
|
||||
|
||||
/* 2D not work if in std. mode */
|
||||
GetIndexRegMask(CRTC_PORT, 0xA3, 0x0F, jReg);
|
||||
if (!jReg) goto Exit_vWaitEngIdle;
|
||||
|
||||
do
|
||||
{
|
||||
ulEngState = (*(volatile ULONG *)(pAST->CMDQInfo.pjEngStatePort)) & 0xFFFC0000;
|
||||
ulEngState2 = (*(volatile ULONG *)(pAST->CMDQInfo.pjEngStatePort)) & 0xFFFC0000;
|
||||
ulEngState2 = (*(volatile ULONG *)(pAST->CMDQInfo.pjEngStatePort)) & 0xFFFC0000;
|
||||
ulEngState2 = (*(volatile ULONG *)(pAST->CMDQInfo.pjEngStatePort)) & 0xFFFC0000;
|
||||
ulEngState2 = (*(volatile ULONG *)(pAST->CMDQInfo.pjEngStatePort)) & 0xFFFC0000;
|
||||
ulEngState2 = (*(volatile ULONG *)(pAST->CMDQInfo.pjEngStatePort)) & 0xFFFC0000;
|
||||
|
||||
} while ((ulEngState & ulEngCheckSetting) || (ulEngState != ulEngState2));
|
||||
|
||||
Exit_vWaitEngIdle:
|
||||
;
|
||||
}
|
||||
|
||||
/* ULONG ulGetCMDQLength() */
|
||||
__inline ULONG ulGetCMDQLength(ASTRecPtr pAST, ULONG ulWritePointer, ULONG ulCMDQMask)
|
||||
{
|
||||
ULONG ulReadPointer, ulReadPointer2;
|
||||
|
||||
do {
|
||||
ulReadPointer = *((volatile ULONG *)(pAST->CMDQInfo.pjReadPort)) & 0x0003FFFF;
|
||||
ulReadPointer2 = *((volatile ULONG *)(pAST->CMDQInfo.pjReadPort)) & 0x0003FFFF;
|
||||
ulReadPointer2 = *((volatile ULONG *)(pAST->CMDQInfo.pjReadPort)) & 0x0003FFFF;
|
||||
ulReadPointer2 = *((volatile ULONG *)(pAST->CMDQInfo.pjReadPort)) & 0x0003FFFF;
|
||||
ulReadPointer2 = *((volatile ULONG *)(pAST->CMDQInfo.pjReadPort)) & 0x0003FFFF;
|
||||
ulReadPointer2 = *((volatile ULONG *)(pAST->CMDQInfo.pjReadPort)) & 0x0003FFFF;
|
||||
} while (ulReadPointer != ulReadPointer2);
|
||||
|
||||
return ((ulReadPointer << 3) - ulWritePointer - CMD_QUEUE_GUARD_BAND) & ulCMDQMask;
|
||||
}
|
||||
|
||||
UCHAR *pjRequestCMDQ(
|
||||
ASTRecPtr pAST, ULONG ulDataLen)
|
||||
{
|
||||
UCHAR *pjBuffer;
|
||||
ULONG i, ulWritePointer, ulCMDQMask, ulCurCMDQLen, ulContinueCMDQLen;
|
||||
|
||||
ulWritePointer = pAST->CMDQInfo.ulWritePointer;
|
||||
ulContinueCMDQLen = pAST->CMDQInfo.ulCMDQSize - ulWritePointer;
|
||||
ulCMDQMask = pAST->CMDQInfo.ulCMDQMask;
|
||||
|
||||
if (ulContinueCMDQLen >= ulDataLen)
|
||||
{
|
||||
/* Get CMDQ Buffer */
|
||||
if (pAST->CMDQInfo.ulCurCMDQueueLen >= ulDataLen)
|
||||
{
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
do
|
||||
{
|
||||
ulCurCMDQLen = ulGetCMDQLength(pAST, ulWritePointer, ulCMDQMask);
|
||||
} while (ulCurCMDQLen < ulDataLen);
|
||||
|
||||
pAST->CMDQInfo.ulCurCMDQueueLen = ulCurCMDQLen;
|
||||
|
||||
}
|
||||
|
||||
pjBuffer = pAST->CMDQInfo.pjCMDQVirtualAddr + ulWritePointer;
|
||||
pAST->CMDQInfo.ulCurCMDQueueLen -= ulDataLen;
|
||||
pAST->CMDQInfo.ulWritePointer = (ulWritePointer + ulDataLen) & ulCMDQMask;
|
||||
return pjBuffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* Fill NULL CMD to the last of the CMDQ */
|
||||
if (pAST->CMDQInfo.ulCurCMDQueueLen >= ulContinueCMDQLen)
|
||||
{
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
do
|
||||
{
|
||||
ulCurCMDQLen = ulGetCMDQLength(pAST, ulWritePointer, ulCMDQMask);
|
||||
} while (ulCurCMDQLen < ulContinueCMDQLen);
|
||||
|
||||
pAST->CMDQInfo.ulCurCMDQueueLen = ulCurCMDQLen;
|
||||
|
||||
}
|
||||
|
||||
pjBuffer = pAST->CMDQInfo.pjCMDQVirtualAddr + ulWritePointer;
|
||||
for (i = 0; i<ulContinueCMDQLen/8; i++, pjBuffer+=8)
|
||||
{
|
||||
*(ULONG *)pjBuffer = (ULONG) PKT_NULL_CMD;
|
||||
*(ULONG *) (pjBuffer+4) = 0;
|
||||
|
||||
}
|
||||
pAST->CMDQInfo.ulCurCMDQueueLen -= ulContinueCMDQLen;
|
||||
pAST->CMDQInfo.ulWritePointer = ulWritePointer = 0;
|
||||
|
||||
/* Get CMDQ Buffer */
|
||||
if (pAST->CMDQInfo.ulCurCMDQueueLen >= ulDataLen)
|
||||
{
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
do
|
||||
{
|
||||
ulCurCMDQLen = ulGetCMDQLength(pAST, ulWritePointer, ulCMDQMask);
|
||||
} while (ulCurCMDQLen < ulDataLen);
|
||||
|
||||
pAST->CMDQInfo.ulCurCMDQueueLen = ulCurCMDQLen;
|
||||
|
||||
}
|
||||
|
||||
pAST->CMDQInfo.ulCurCMDQueueLen -= ulDataLen;
|
||||
pjBuffer = pAST->CMDQInfo.pjCMDQVirtualAddr + ulWritePointer;
|
||||
pAST->CMDQInfo.ulWritePointer = (ulWritePointer + ulDataLen) & ulCMDQMask;
|
||||
return pjBuffer;
|
||||
|
||||
}
|
||||
|
||||
} /* end of pjRequestCmdQ() */
|
||||
|
||||
Bool bGetLineTerm(_LINEInfo *LineInfo, LINEPARAM *dsLineParam)
|
||||
{
|
||||
LONG GAbsX, GAbsY, GXInc, GYInc, GSlopeOne, GXMajor;
|
||||
Bool tmpFlipH=0, tmpFlipV=0, tmpFlipD=0;
|
||||
LONG tmpStartX, tmpStartY, tmpFStartX, tmpFStartY;
|
||||
LONG GFAbsX, GFAbsY, GFStartX, GFStartY, GFFracX[2], GFFracY[2];
|
||||
LONG flag, GXRoundDown, GYRoundDown, GFlipH, GFlipV, GFlipD;
|
||||
LONG tmpx, tmpy, GFGamma;
|
||||
LONG i, region, tmpDiaRg[2], tmpGFX1, GFAdd, GNTWidth;
|
||||
LONG tmp1GFX, tmp1GFY, tmp2GFX, tmp2GFY, tmpGK1Term, tmpGK2Term, tmpGNTErr;
|
||||
LONG GFX, GFY, GK1Term, GK2Term, GNTErr;
|
||||
|
||||
/*Init Calucate */
|
||||
#ifdef LONG64
|
||||
GAbsX = abs (LineInfo->X1 - LineInfo->X2);
|
||||
GAbsY = abs (LineInfo->Y1 - LineInfo->Y2);
|
||||
#else
|
||||
GAbsX = labs (LineInfo->X1 - LineInfo->X2);
|
||||
GAbsY = labs (LineInfo->Y1 - LineInfo->Y2);
|
||||
#endif
|
||||
|
||||
GXInc = (LineInfo->X1 < LineInfo->X2) ? 1:0;
|
||||
GYInc = (LineInfo->Y1 < LineInfo->Y2) ? 1:0;
|
||||
GSlopeOne = (GAbsX ==GAbsY) ? 1:0;
|
||||
GXMajor = (GAbsX >= GAbsY) ? 1:0;
|
||||
|
||||
/*Flip */
|
||||
tmpStartX = LineInfo->X1;
|
||||
tmpStartY = LineInfo->Y1;
|
||||
if (!GXInc)
|
||||
{
|
||||
tmpStartX = ~LineInfo->X1+ 1;
|
||||
tmpFlipH = 1;
|
||||
}
|
||||
|
||||
if (!GYInc)
|
||||
{
|
||||
tmpStartY = ~LineInfo->Y1 + 1;
|
||||
tmpFlipV = 1;
|
||||
}
|
||||
|
||||
if (GXMajor ==0)
|
||||
{
|
||||
tmpFlipD = 1;
|
||||
tmpFStartX = tmpStartY;
|
||||
tmpFStartY = tmpStartX;
|
||||
GFAbsX = GAbsY;
|
||||
GFAbsY = GAbsX;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpFlipD = 0;
|
||||
tmpFStartX = tmpStartX;
|
||||
tmpFStartY = tmpStartY;
|
||||
GFAbsX = GAbsX;
|
||||
GFAbsY = GAbsY;
|
||||
}
|
||||
|
||||
GFStartX = tmpFStartX >> 4;
|
||||
GFStartY = tmpFStartY >> 4;
|
||||
GFFracX[0] = tmpFStartX & 0xF;
|
||||
GFFracY[0] = tmpFStartY & 0xF;
|
||||
|
||||
/* Flag = GSlopeOne & tmpFlipH & tmpFlipV & tmpFlipD */
|
||||
flag = (GSlopeOne<<3) + (tmpFlipH<<2) + (tmpFlipV<<1) + tmpFlipD;
|
||||
switch(flag) /* GSlopeOne tmpFlipH tmpFlipV tmpFlipD */
|
||||
{
|
||||
case 0: /* 0 0 0 0 */
|
||||
case 1: /* 0 0 0 1 */
|
||||
GXRoundDown = 1;
|
||||
GYRoundDown = 1;
|
||||
GFlipH = tmpFlipH;
|
||||
GFlipV = tmpFlipV;
|
||||
GFlipD = tmpFlipD;
|
||||
break;
|
||||
case 2: /* 0 0 1 0 */
|
||||
case 5: /* 0 1 0 1 */
|
||||
case 10: /* 1 0 1 0 */
|
||||
case 14: /* 1 1 1 0 */
|
||||
GXRoundDown = 1;
|
||||
GYRoundDown = 0;
|
||||
GFlipH = tmpFlipH;
|
||||
GFlipV = tmpFlipV;
|
||||
GFlipD = tmpFlipD;
|
||||
break;
|
||||
case 3: /* 0 0 1 1 */
|
||||
case 4: /* 0 1 0 0 */
|
||||
case 8: /* 1 0 0 0 */
|
||||
case 12: /* 1 1 0 0 */
|
||||
GXRoundDown = 0;
|
||||
GYRoundDown = 1;
|
||||
GFlipH = tmpFlipH;
|
||||
GFlipV = tmpFlipV;
|
||||
GFlipD = tmpFlipD;
|
||||
break;
|
||||
case 6: /* 0 1 1 0 */
|
||||
case 7: /* 0 1 1 1 */
|
||||
GXRoundDown = 0;
|
||||
GYRoundDown = 0;
|
||||
GFlipH = tmpFlipH;
|
||||
GFlipV = tmpFlipV;
|
||||
GFlipD = tmpFlipD;
|
||||
break;
|
||||
/* case 9, 11, 13, 15 */
|
||||
default:
|
||||
GXRoundDown = 1; /* 1 0 0 1 */
|
||||
GYRoundDown = 1; /* 1 0 1 1 */
|
||||
GFlipH = 1; /* 1 1 0 1 */
|
||||
GFlipV = 1; /* 1 1 1 1 */
|
||||
GFlipD = 1;
|
||||
}
|
||||
|
||||
/*Err */
|
||||
tmpx = (GFFracY[0] +8) * GFAbsX;
|
||||
tmpy = GFFracX[0] * GFAbsY;
|
||||
if(GYRoundDown==1)
|
||||
GFGamma=(signed)(tmpx - tmpy - 1) >> 4;
|
||||
else
|
||||
GFGamma=(signed)(tmpx - tmpy) >> 4;
|
||||
|
||||
/*GIQ */
|
||||
GFFracX[1] = (GFFracX[0] + GFAbsX) & 0xF;
|
||||
GFFracY[1] = (GFFracY[0] + GFAbsY) & 0xF;
|
||||
|
||||
for (i=0; i<2; i++)
|
||||
{
|
||||
tmpDiaRg[i] = 0;
|
||||
region = lGetDiaRg(GFFracX[i], GFFracY[i]);
|
||||
|
||||
if(region==1 && GXRoundDown==0)
|
||||
tmpDiaRg[i] |= 1;
|
||||
|
||||
if(region==2 && (GSlopeOne==0 || GXRoundDown==0))
|
||||
tmpDiaRg[i] |= 1;
|
||||
|
||||
if(region==3)
|
||||
tmpDiaRg[i] |= 1;
|
||||
|
||||
}
|
||||
|
||||
tmpGFX1 =((signed)(GFFracX[0]+GFAbsX)>>4)-1+tmpDiaRg[1]; /* signed left shifter!! */
|
||||
GFAdd = tmpDiaRg[0];
|
||||
GNTWidth = tmpGFX1 - tmpDiaRg[0] + 1;
|
||||
|
||||
/* FXY */
|
||||
tmpGK1Term = GFAbsY;
|
||||
tmpGK2Term = GFAbsY - GFAbsX;
|
||||
|
||||
if(GFAdd==1){
|
||||
tmpGNTErr = GFGamma - GFAbsX + GFAbsY;
|
||||
}else{
|
||||
tmpGNTErr = GFGamma - GFAbsX;
|
||||
}
|
||||
|
||||
tmp1GFX = GFStartX + GFAdd;
|
||||
if((signed)tmpGNTErr >= 0){
|
||||
tmp1GFY = GFStartY+1;
|
||||
GNTErr = tmpGNTErr + tmpGK2Term;
|
||||
}else{
|
||||
tmp1GFY = GFStartY;
|
||||
GNTErr = tmpGNTErr + tmpGK1Term;
|
||||
}
|
||||
|
||||
if(GFlipD == 1){
|
||||
tmp2GFX = tmp1GFY;
|
||||
tmp2GFY = tmp1GFX;
|
||||
}else{
|
||||
tmp2GFX = tmp1GFX;
|
||||
tmp2GFY = tmp1GFY;
|
||||
}
|
||||
|
||||
if(GFlipV == 1){
|
||||
GFY = ~tmp2GFY+1;
|
||||
}else{
|
||||
GFY = tmp2GFY;
|
||||
}
|
||||
|
||||
if(GFlipH == 1){
|
||||
GFX = ~tmp2GFX+1;
|
||||
}else{
|
||||
GFX = tmp2GFX;
|
||||
}
|
||||
|
||||
GK1Term = tmpGK1Term;
|
||||
GK2Term = tmpGK2Term;
|
||||
|
||||
/*save the Param to dsLineParam */
|
||||
dsLineParam->dsLineX = (USHORT) GFX;
|
||||
dsLineParam->dsLineY = (USHORT) GFY;
|
||||
dsLineParam->dsLineWidth = (USHORT) GNTWidth;
|
||||
dsLineParam->dwErrorTerm = (ULONG) GNTErr;
|
||||
dsLineParam->dwK1Term = GK1Term;
|
||||
dsLineParam->dwK2Term = GK2Term;
|
||||
|
||||
dsLineParam->dwLineAttributes = 0;
|
||||
if (GXMajor) dsLineParam->dwLineAttributes |= LINEPARAM_XM;
|
||||
if (!GXInc) dsLineParam->dwLineAttributes |= LINEPARAM_X_DEC;
|
||||
if (!GYInc) dsLineParam->dwLineAttributes |= LINEPARAM_Y_DEC;
|
||||
|
||||
return(TRUE);
|
||||
|
||||
}
|
||||
|
||||
LONG lGetDiaRg(LONG GFracX, LONG GFracY)
|
||||
{
|
||||
LONG region;
|
||||
|
||||
switch(GFracY)
|
||||
{
|
||||
case 0x0:
|
||||
switch(GFracX)
|
||||
{
|
||||
case 0x0:
|
||||
case 0x1:
|
||||
case 0x2:
|
||||
case 0x3:
|
||||
case 0x4:
|
||||
case 0x5:
|
||||
case 0x6:
|
||||
case 0x7:
|
||||
region=0;
|
||||
break;
|
||||
case 0x8:
|
||||
region=1;
|
||||
break;
|
||||
default:
|
||||
region=3;
|
||||
}
|
||||
break;
|
||||
case 0x1:
|
||||
switch(GFracX)
|
||||
{
|
||||
case 0x0:
|
||||
case 0x1:
|
||||
case 0x2:
|
||||
case 0x3:
|
||||
case 0x4:
|
||||
case 0x5:
|
||||
case 0x6:
|
||||
region=0;
|
||||
break;
|
||||
default:
|
||||
region=3;
|
||||
}
|
||||
break;
|
||||
case 0x2:
|
||||
switch(GFracX)
|
||||
{
|
||||
case 0x0:
|
||||
case 0x1:
|
||||
case 0x2:
|
||||
case 0x3:
|
||||
case 0x4:
|
||||
case 0x5:
|
||||
region=0; break;
|
||||
default:
|
||||
region=3;
|
||||
}
|
||||
break;
|
||||
case 0x3:
|
||||
switch(GFracX)
|
||||
{
|
||||
case 0x0:
|
||||
case 0x1:
|
||||
case 0x2:
|
||||
case 0x3:
|
||||
case 0x4:
|
||||
region=0;
|
||||
break;
|
||||
default:
|
||||
region=3;
|
||||
}
|
||||
break;
|
||||
case 0x4:
|
||||
switch(GFracX)
|
||||
{
|
||||
case 0x0:
|
||||
case 0x1:
|
||||
case 0x2:
|
||||
case 0x3:
|
||||
region=0;
|
||||
break;
|
||||
default:
|
||||
region=3;
|
||||
}
|
||||
break;
|
||||
case 0x5:
|
||||
switch(GFracX)
|
||||
{
|
||||
case 0x0:
|
||||
case 0x1:
|
||||
case 0x2:
|
||||
region=0; break;
|
||||
default:
|
||||
region=3;
|
||||
}
|
||||
break;
|
||||
case 0x6:
|
||||
switch(GFracX)
|
||||
{
|
||||
case 0x0:
|
||||
case 0x1:
|
||||
region=0;
|
||||
break;
|
||||
default:
|
||||
region=3;
|
||||
}
|
||||
break;
|
||||
case 0x7:
|
||||
switch(GFracX)
|
||||
{
|
||||
case 0x0:
|
||||
region=0;
|
||||
break;
|
||||
default:
|
||||
region=3;
|
||||
}
|
||||
break;
|
||||
case 0x8:
|
||||
switch(GFracX)
|
||||
{
|
||||
case 0x0:
|
||||
region=0;
|
||||
break;
|
||||
default:
|
||||
region=3;
|
||||
}
|
||||
break;
|
||||
case 0x9:
|
||||
switch(GFracX)
|
||||
{
|
||||
case 0x0:
|
||||
region=0;
|
||||
break;
|
||||
case 0x1:
|
||||
region=2;
|
||||
break;
|
||||
default:
|
||||
region=3;
|
||||
}
|
||||
break;
|
||||
case 0xa:
|
||||
switch(GFracX)
|
||||
{
|
||||
case 0x0:
|
||||
case 0x1:
|
||||
region=0;
|
||||
break;
|
||||
case 0x2:
|
||||
region=2;
|
||||
break;
|
||||
default:
|
||||
region=3;
|
||||
}
|
||||
break;
|
||||
case 0xb:
|
||||
switch(GFracX)
|
||||
{
|
||||
case 0x0:
|
||||
case 0x1:
|
||||
case 0x2:
|
||||
region=0;
|
||||
break;
|
||||
case 0x3:
|
||||
region=2;
|
||||
break;
|
||||
default:
|
||||
region=3;
|
||||
}
|
||||
break;
|
||||
case 0xc:
|
||||
switch(GFracX)
|
||||
{
|
||||
case 0x0:
|
||||
case 0x1:
|
||||
case 0x2:
|
||||
case 0x3:
|
||||
region=0;
|
||||
break;
|
||||
case 0x4:
|
||||
region=2;
|
||||
break;
|
||||
default:
|
||||
region=3;
|
||||
}
|
||||
break;
|
||||
case 0xd:
|
||||
switch(GFracX)
|
||||
{
|
||||
case 0x0:
|
||||
case 0x1:
|
||||
case 0x2:
|
||||
case 0x3:
|
||||
case 0x4:
|
||||
region=0;
|
||||
break;
|
||||
case 0x5:
|
||||
region=2;
|
||||
break;
|
||||
default:
|
||||
region=3;
|
||||
}
|
||||
break;
|
||||
case 0xe:
|
||||
switch(GFracX)
|
||||
{
|
||||
case 0x0:
|
||||
case 0x1:
|
||||
case 0x2:
|
||||
case 0x3:
|
||||
case 0x4:
|
||||
case 0x5:
|
||||
region=0;
|
||||
break;
|
||||
case 0x6:
|
||||
region=2;
|
||||
break;
|
||||
default:
|
||||
region=3;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
switch(GFracX)
|
||||
{
|
||||
case 0x0:
|
||||
case 0x1:
|
||||
case 0x2:
|
||||
case 0x3:
|
||||
case 0x4:
|
||||
case 0x5:
|
||||
case 0x6:
|
||||
region=0;
|
||||
break;
|
||||
case 0x7:
|
||||
region=2;
|
||||
break;
|
||||
default:
|
||||
region=3;
|
||||
}
|
||||
}
|
||||
|
||||
return (region);
|
||||
|
||||
}
|
||||
|
||||
#endif /* end of Accel_2D */
|
||||
|
||||
|
||||
419
src/ast_2dtool.h
Normal file
419
src/ast_2dtool.h
Normal file
@@ -0,0 +1,419 @@
|
||||
/*
|
||||
* Copyright (c) 2005 ASPEED Technology Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of the authors not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. The authors makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as is" without express or implied warranty.
|
||||
*
|
||||
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* Eng Capability Definition */
|
||||
#define ENG_CAP_Sync 0x0001
|
||||
#define ENG_CAP_ScreenToScreenCopy 0x0002
|
||||
#define ENG_CAP_SolidFill 0x0004
|
||||
#define ENG_CAP_SolidLine 0x0008
|
||||
#define ENG_CAP_DashedLine 0x0010
|
||||
#define ENG_CAP_Mono8x8PatternFill 0x0020
|
||||
#define ENG_CAP_Color8x8PatternFill 0x0040
|
||||
#define ENG_CAP_CPUToScreenColorExpand 0x0080
|
||||
#define ENG_CAP_ScreenToScreenColorExpand 0x0100
|
||||
#define ENG_CAP_Clipping 0x0200
|
||||
#define ENG_CAP_ALL (ENG_CAP_Sync | ENG_CAP_ScreenToScreenCopy | ENG_CAP_SolidFill | \
|
||||
ENG_CAP_SolidLine | ENG_CAP_DashedLine | \
|
||||
ENG_CAP_Mono8x8PatternFill | ENG_CAP_Color8x8PatternFill | \
|
||||
ENG_CAP_Clipping);
|
||||
|
||||
/* CMDQ Definition */
|
||||
#define AGP_CMD_QUEUE 1
|
||||
#define VM_CMD_QUEUE 0
|
||||
#define VM_CMD_MMIO 2
|
||||
|
||||
#define CMD_QUEUE_SIZE_256K 0x00040000
|
||||
#define CMD_QUEUE_SIZE_512K 0x00080000
|
||||
#define CMD_QUEUE_SIZE_1M 0x00100000
|
||||
#define CMD_QUEUE_SIZE_2M 0x00200000
|
||||
#define CMD_QUEUE_SIZE_4M 0x00400000
|
||||
|
||||
/* CMD Type Info */
|
||||
#define PKT_NULL_CMD 0x00009561
|
||||
|
||||
#define PKT_SINGLE_LENGTH 8
|
||||
#define PKT_SINGLE_CMD_HEADER 0x00009562
|
||||
|
||||
typedef struct _PKT_SC
|
||||
{
|
||||
ULONG PKT_SC_dwHeader;
|
||||
ULONG PKT_SC_dwData[1];
|
||||
|
||||
} PKT_SC, *PPKT_SC;
|
||||
|
||||
/* Eng Reg. Limitation */
|
||||
#define MAX_SRC_PITCH 0x1FFF
|
||||
#define MAX_DST_PITCH 0x1FFF
|
||||
#define MAX_DST_HEIGHT 0x7FF
|
||||
#define MAX_SRC_X 0x7FF
|
||||
#define MAX_SRC_Y 0x7FF
|
||||
#define MAX_DST_X 0x7FF
|
||||
#define MAX_DST_Y 0x7FF
|
||||
#define MAX_RECT_WIDTH 0x7FF
|
||||
#define MAX_RECT_HEIGHT 0x7FF
|
||||
#define MAX_CLIP 0xFFF
|
||||
|
||||
#define MAX_LINE_X 0x7FF
|
||||
#define MAX_LINE_Y 0x7FF
|
||||
#define MAX_LINE_ERR 0x3FFFFF
|
||||
#define MAX_LINE_WIDTH 0x7FF
|
||||
#define MAX_LINE_K1 0x3FFFFF
|
||||
#define MAX_LINE_K2 0x3FFFFF
|
||||
|
||||
#define MAX_PATReg_Size 256
|
||||
|
||||
/* Eng Reg. Definition */
|
||||
/* MMIO Reg */
|
||||
#define MMIOREG_SRC_BASE (pAST->MMIOVirtualAddr + 0x8000)
|
||||
#define MMIOREG_SRC_PITCH (pAST->MMIOVirtualAddr + 0x8004)
|
||||
#define MMIOREG_DST_BASE (pAST->MMIOVirtualAddr + 0x8008)
|
||||
#define MMIOREG_DST_PITCH (pAST->MMIOVirtualAddr + 0x800C)
|
||||
#define MMIOREG_DST_XY (pAST->MMIOVirtualAddr + 0x8010)
|
||||
#define MMIOREG_SRC_XY (pAST->MMIOVirtualAddr + 0x8014)
|
||||
#define MMIOREG_RECT_XY (pAST->MMIOVirtualAddr + 0x8018)
|
||||
#define MMIOREG_FG (pAST->MMIOVirtualAddr + 0x801C)
|
||||
#define MMIOREG_BG (pAST->MMIOVirtualAddr + 0x8020)
|
||||
#define MMIOREG_FG_SRC (pAST->MMIOVirtualAddr + 0x8024)
|
||||
#define MMIOREG_BG_SRC (pAST->MMIOVirtualAddr + 0x8028)
|
||||
#define MMIOREG_MONO1 (pAST->MMIOVirtualAddr + 0x802C)
|
||||
#define MMIOREG_MONO2 (pAST->MMIOVirtualAddr + 0x8030)
|
||||
#define MMIOREG_CLIP1 (pAST->MMIOVirtualAddr + 0x8034)
|
||||
#define MMIOREG_CLIP2 (pAST->MMIOVirtualAddr + 0x8038)
|
||||
#define MMIOREG_CMD (pAST->MMIOVirtualAddr + 0x803C)
|
||||
#define MMIOREG_PAT (pAST->MMIOVirtualAddr + 0x8100)
|
||||
|
||||
#define MMIOREG_LINE_XY (pAST->MMIOVirtualAddr + 0x8010)
|
||||
#define MMIOREG_LINE_Err (pAST->MMIOVirtualAddr + 0x8014)
|
||||
#define MMIOREG_LINE_WIDTH (pAST->MMIOVirtualAddr + 0x8018)
|
||||
#define MMIOREG_LINE_K1 (pAST->MMIOVirtualAddr + 0x8024)
|
||||
#define MMIOREG_LINE_K2 (pAST->MMIOVirtualAddr + 0x8028)
|
||||
#define MMIOREG_LINE_STYLE1 (pAST->MMIOVirtualAddr + 0x802C)
|
||||
#define MMIOREG_LINE_STYLE2 (pAST->MMIOVirtualAddr + 0x8030)
|
||||
|
||||
/* CMDQ Reg */
|
||||
#define CMDQREG_SRC_BASE (0x00 << 24)
|
||||
#define CMDQREG_SRC_PITCH (0x01 << 24)
|
||||
#define CMDQREG_DST_BASE (0x02 << 24)
|
||||
#define CMDQREG_DST_PITCH (0x03 << 24)
|
||||
#define CMDQREG_DST_XY (0x04 << 24)
|
||||
#define CMDQREG_SRC_XY (0x05 << 24)
|
||||
#define CMDQREG_RECT_XY (0x06 << 24)
|
||||
#define CMDQREG_FG (0x07 << 24)
|
||||
#define CMDQREG_BG (0x08 << 24)
|
||||
#define CMDQREG_FG_SRC (0x09 << 24)
|
||||
#define CMDQREG_BG_SRC (0x0A << 24)
|
||||
#define CMDQREG_MONO1 (0x0B << 24)
|
||||
#define CMDQREG_MONO2 (0x0C << 24)
|
||||
#define CMDQREG_CLIP1 (0x0D << 24)
|
||||
#define CMDQREG_CLIP2 (0x0E << 24)
|
||||
#define CMDQREG_CMD (0x0F << 24)
|
||||
#define CMDQREG_PAT (0x40 << 24)
|
||||
|
||||
#define CMDQREG_LINE_XY (0x04 << 24)
|
||||
#define CMDQREG_LINE_Err (0x05 << 24)
|
||||
#define CMDQREG_LINE_WIDTH (0x06 << 24)
|
||||
#define CMDQREG_LINE_K1 (0x09 << 24)
|
||||
#define CMDQREG_LINE_K2 (0x0A << 24)
|
||||
#define CMDQREG_LINE_STYLE1 (0x0B << 24)
|
||||
#define CMDQREG_LINE_STYLE2 (0x0C << 24)
|
||||
|
||||
/* CMD Reg. Definition */
|
||||
#define CMD_BITBLT 0x00000000
|
||||
#define CMD_LINEDRAW 0x00000001
|
||||
#define CMD_COLOREXP 0x00000002
|
||||
#define CMD_ENHCOLOREXP 0x00000003
|
||||
#define CMD_MASK 0x00000007
|
||||
|
||||
#define CMD_DISABLE_CLIP 0x00000000
|
||||
#define CMD_ENABLE_CLIP 0x00000008
|
||||
|
||||
#define CMD_COLOR_08 0x00000000
|
||||
#define CMD_COLOR_16 0x00000010
|
||||
#define CMD_COLOR_32 0x00000020
|
||||
|
||||
#define CMD_SRC_SIQ 0x00000040
|
||||
|
||||
#define CMD_TRANSPARENT 0x00000080
|
||||
|
||||
#define CMD_PAT_FGCOLOR 0x00000000
|
||||
#define CMD_PAT_MONOMASK 0x00010000
|
||||
#define CMD_PAT_PATREG 0x00020000
|
||||
|
||||
#define CMD_OPAQUE 0x00000000
|
||||
#define CMD_FONT_TRANSPARENT 0x00040000
|
||||
|
||||
#define CMD_X_INC 0x00000000
|
||||
#define CMD_X_DEC 0x00200000
|
||||
|
||||
#define CMD_Y_INC 0x00000000
|
||||
#define CMD_Y_DEC 0x00100000
|
||||
|
||||
#define CMD_DRAW_LAST_PIXEL 0x00000000
|
||||
#define CMD_NOT_DRAW_LAST_PIXEL 0x00800000
|
||||
|
||||
#define CMD_DISABLE_LINE_STYLE 0x00000000
|
||||
#define CMD_ENABLE_LINE_STYLE 0x40000000
|
||||
|
||||
#define CMD_RESET_STYLE_COUNTER 0x80000000
|
||||
#define CMD_NOT_RESET_STYLE_COUNTER 0x00000000
|
||||
|
||||
#define BURST_FORCE_CMD 0x80000000
|
||||
|
||||
/* Line */
|
||||
#define LINEPARAM_XM 0x00000001
|
||||
#define LINEPARAM_X_DEC 0x00000002
|
||||
#define LINEPARAM_Y_DEC 0x00000004
|
||||
|
||||
typedef struct _LINEPARAM {
|
||||
USHORT dsLineX;
|
||||
USHORT dsLineY;
|
||||
USHORT dsLineWidth;
|
||||
ULONG dwErrorTerm;
|
||||
ULONG dwK1Term;
|
||||
ULONG dwK2Term;
|
||||
ULONG dwLineAttributes;
|
||||
} LINEPARAM, *PLINEPARAM;
|
||||
|
||||
typedef struct {
|
||||
|
||||
ULONG X1;
|
||||
ULONG Y1;
|
||||
ULONG X2;
|
||||
ULONG Y2;
|
||||
|
||||
} _LINEInfo;
|
||||
|
||||
/* Macro */
|
||||
/* MMIO 2D Macro */
|
||||
#define ASTSetupSRCBase_MMIO(base) \
|
||||
{ \
|
||||
*(ULONG *)(MMIOREG_SRC_BASE) = (ULONG) (base); \
|
||||
}
|
||||
#define ASTSetupSRCPitch_MMIO(pitch) \
|
||||
{ \
|
||||
*(ULONG *)(MMIOREG_SRC_PITCH) = (ULONG)(pitch << 16); \
|
||||
}
|
||||
#define ASTSetupDSTBase_MMIO(base) \
|
||||
{ \
|
||||
*(ULONG *)(MMIOREG_DST_BASE) = (ULONG)(base); \
|
||||
}
|
||||
#define ASTSetupDSTPitchHeight_MMIO(pitch, height) \
|
||||
{ \
|
||||
*(ULONG *)(MMIOREG_DST_PITCH) = (ULONG)((pitch << 16) + ((height) & MAX_DST_HEIGHT)); \
|
||||
}
|
||||
#define ASTSetupDSTXY_MMIO(x, y) \
|
||||
{ \
|
||||
*(ULONG *)(MMIOREG_DST_XY) = (ULONG)(((x & MAX_DST_X) << 16) + (y & MAX_DST_Y)); \
|
||||
}
|
||||
#define ASTSetupSRCXY_MMIO(x, y) \
|
||||
{ \
|
||||
*(ULONG *)(MMIOREG_SRC_XY) = (ULONG)(((x & MAX_SRC_X) << 16) + (y & MAX_SRC_Y)); \
|
||||
}
|
||||
#define ASTSetupRECTXY_MMIO(x, y) \
|
||||
{ \
|
||||
*(ULONG *)(MMIOREG_RECT_XY) = (ULONG)(((x & MAX_RECT_WIDTH) << 16) + (y & MAX_RECT_WIDTH)); \
|
||||
}
|
||||
#define ASTSetupFG_MMIO(color) \
|
||||
{ \
|
||||
*(ULONG *)(MMIOREG_FG) = (ULONG)(color); \
|
||||
}
|
||||
#define ASTSetupBG_MMIO(color) \
|
||||
{ \
|
||||
*(ULONG *)(MMIOREG_BG) = (ULONG)(color); \
|
||||
}
|
||||
#define ASTSetupMONO1_MMIO(pat) \
|
||||
{ \
|
||||
*(ULONG *)(MMIOREG_MONO1) = (ULONG)(pat); \
|
||||
}
|
||||
#define ASTSetupMONO2_MMIO(pat) \
|
||||
{ \
|
||||
*(ULONG *)(MMIOREG_MONO2) = (ULONG)(pat); \
|
||||
}
|
||||
#define ASTSetupCLIP1_MMIO(left, top) \
|
||||
{ \
|
||||
*(ULONG *)(MMIOREG_CLIP1) = (ULONG)(((left & MAX_CLIP) << 16) + (top & MAX_CLIP)); \
|
||||
}
|
||||
#define ASTSetupCLIP2_MMIO(right, bottom) \
|
||||
{ \
|
||||
*(ULONG *)(MMIOREG_CLIP2) = (ULONG)(((right & MAX_CLIP) << 16) + (bottom & MAX_CLIP)); \
|
||||
}
|
||||
#define ASTSetupCMDReg_MMIO(reg) \
|
||||
{ \
|
||||
*(ULONG *)(MMIOREG_CMD) = (ULONG)(reg); \
|
||||
}
|
||||
#define ASTSetupPatReg_MMIO(patreg, pat) \
|
||||
{ \
|
||||
*(ULONG *)(MMIOREG_PAT + patreg*4) = (ULONG)(pat); \
|
||||
}
|
||||
|
||||
/* Line CMD */
|
||||
#define ASTSetupLineXY_MMIO(x, y) \
|
||||
{ \
|
||||
*(ULONG *)(MMIOREG_LINE_XY) = (ULONG)(((x & MAX_LINE_X) << 16) + (y & MAX_LINE_Y)); \
|
||||
}
|
||||
#define ASTSetupLineXMErrTerm_MMIO(xm, err) \
|
||||
{ \
|
||||
*(ULONG *)(MMIOREG_LINE_Err) = (ULONG)((xm << 24) + (err & MAX_LINE_ERR)); \
|
||||
}
|
||||
#define ASTSetupLineWidth_MMIO(width) \
|
||||
{ \
|
||||
*(ULONG *)(MMIOREG_LINE_WIDTH) = (ULONG)((width & MAX_LINE_WIDTH) << 16); \
|
||||
}
|
||||
#define ASTSetupLineK1Term_MMIO(err) \
|
||||
{ \
|
||||
*(ULONG *)(MMIOREG_LINE_K1) = (ULONG)(err & MAX_LINE_K1); \
|
||||
}
|
||||
#define ASTSetupLineK2Term_MMIO(err) \
|
||||
{ \
|
||||
*(ULONG *)(MMIOREG_LINE_K2) = (ULONG)(err & MAX_LINE_K2); \
|
||||
}
|
||||
#define ASTSetupLineStyle1_MMIO(pat) \
|
||||
{ \
|
||||
*(ULONG *)(MMIOREG_LINE_STYLE1) = (ULONG)(pat); \
|
||||
}
|
||||
#define ASTSetupLineStyle2_MMIO(pat) \
|
||||
{ \
|
||||
*(ULONG *)(MMIOREG_LINE_STYLE2) = (ULONG)(pat); \
|
||||
}
|
||||
|
||||
/* CMDQ Mode Macro */
|
||||
#define mUpdateWritePointer *(ULONG *) (pAST->CMDQInfo.pjWritePort) = (pAST->CMDQInfo.ulWritePointer >>3)
|
||||
|
||||
/* General CMD */
|
||||
#define ASTSetupSRCBase(addr, base) \
|
||||
{ \
|
||||
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_SRC_BASE); \
|
||||
addr->PKT_SC_dwData[0] = (ULONG)(base); \
|
||||
}
|
||||
#define ASTSetupSRCPitch(addr, pitch) \
|
||||
{ \
|
||||
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_SRC_PITCH); \
|
||||
addr->PKT_SC_dwData[0] = (ULONG)(pitch << 16); \
|
||||
}
|
||||
#define ASTSetupDSTBase(addr, base) \
|
||||
{ \
|
||||
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_DST_BASE); \
|
||||
addr->PKT_SC_dwData[0] = (ULONG)(base); \
|
||||
}
|
||||
#define ASTSetupDSTPitchHeight(addr, pitch, height) \
|
||||
{ \
|
||||
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_DST_PITCH); \
|
||||
addr->PKT_SC_dwData[0] = (ULONG)((pitch << 16) + ((height) & MAX_DST_HEIGHT)); \
|
||||
}
|
||||
#define ASTSetupDSTXY(addr, x, y) \
|
||||
{ \
|
||||
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_DST_XY); \
|
||||
addr->PKT_SC_dwData[0] = (ULONG)(((x & MAX_DST_X) << 16) + (y & MAX_DST_Y)); \
|
||||
}
|
||||
#define ASTSetupSRCXY(addr, x, y) \
|
||||
{ \
|
||||
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_SRC_XY); \
|
||||
addr->PKT_SC_dwData[0] = (ULONG)(((x & MAX_SRC_X) << 16) + (y & MAX_SRC_Y)); \
|
||||
}
|
||||
#define ASTSetupRECTXY(addr, x, y) \
|
||||
{ \
|
||||
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_RECT_XY); \
|
||||
addr->PKT_SC_dwData[0] = (ULONG)(((x & MAX_RECT_WIDTH) << 16) + (y & MAX_RECT_WIDTH)); \
|
||||
}
|
||||
#define ASTSetupFG(addr, color) \
|
||||
{ \
|
||||
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_FG); \
|
||||
addr->PKT_SC_dwData[0] = (ULONG)(color); \
|
||||
}
|
||||
#define ASTSetupBG(addr, color) \
|
||||
{ \
|
||||
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_BG); \
|
||||
addr->PKT_SC_dwData[0] = (ULONG)(color); \
|
||||
}
|
||||
#define ASTSetupMONO1(addr, pat) \
|
||||
{ \
|
||||
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_MONO1); \
|
||||
addr->PKT_SC_dwData[0] = (ULONG)(pat); \
|
||||
}
|
||||
#define ASTSetupMONO2(addr, pat) \
|
||||
{ \
|
||||
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_MONO2); \
|
||||
addr->PKT_SC_dwData[0] = (ULONG)(pat); \
|
||||
}
|
||||
#define ASTSetupCLIP1(addr, left, top) \
|
||||
{ \
|
||||
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_CLIP1); \
|
||||
addr->PKT_SC_dwData[0] = (ULONG)(((left & MAX_CLIP) << 16) + (top & MAX_CLIP)); \
|
||||
}
|
||||
#define ASTSetupCLIP2(addr, right, bottom) \
|
||||
{ \
|
||||
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_CLIP2); \
|
||||
addr->PKT_SC_dwData[0] = (ULONG)(((right & MAX_CLIP) << 16) + (bottom & MAX_CLIP)); \
|
||||
}
|
||||
#define ASTSetupCMDReg(addr, reg) \
|
||||
{ \
|
||||
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_CMD); \
|
||||
addr->PKT_SC_dwData[0] = (ULONG)(reg); \
|
||||
}
|
||||
#define ASTSetupPatReg(addr, patreg, pat) \
|
||||
{ \
|
||||
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + (CMDQREG_PAT + (patreg << 24))); \
|
||||
addr->PKT_SC_dwData[0] = (ULONG)(pat); \
|
||||
}
|
||||
|
||||
/* Line CMD */
|
||||
#define ASTSetupLineXY(addr, x, y) \
|
||||
{ \
|
||||
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_XY); \
|
||||
addr->PKT_SC_dwData[0] = (ULONG)(((x & MAX_LINE_X) << 16) + (y & MAX_LINE_Y)); \
|
||||
}
|
||||
#define ASTSetupLineXMErrTerm(addr, xm, err) \
|
||||
{ \
|
||||
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_Err); \
|
||||
addr->PKT_SC_dwData[0] = (ULONG)((xm << 24) + (err & MAX_LINE_ERR)); \
|
||||
}
|
||||
#define ASTSetupLineWidth(addr, width) \
|
||||
{ \
|
||||
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_WIDTH); \
|
||||
addr->PKT_SC_dwData[0] = (ULONG)((width & MAX_LINE_WIDTH) << 16); \
|
||||
}
|
||||
#define ASTSetupLineK1Term(addr, err) \
|
||||
{ \
|
||||
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_K1); \
|
||||
addr->PKT_SC_dwData[0] = (ULONG)(err & MAX_LINE_K1); \
|
||||
}
|
||||
#define ASTSetupLineK2Term(addr, err) \
|
||||
{ \
|
||||
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_K2); \
|
||||
addr->PKT_SC_dwData[0] = (ULONG)(err & MAX_LINE_K2); \
|
||||
}
|
||||
#define ASTSetupLineStyle1(addr, pat) \
|
||||
{ \
|
||||
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_STYLE1); \
|
||||
addr->PKT_SC_dwData[0] = (ULONG)(pat); \
|
||||
}
|
||||
#define ASTSetupLineStyle2(addr, pat) \
|
||||
{ \
|
||||
addr->PKT_SC_dwHeader = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_STYLE2); \
|
||||
addr->PKT_SC_dwData[0] = (ULONG)(pat); \
|
||||
}
|
||||
|
||||
#define ASTSetupNULLCMD(addr) \
|
||||
{ \
|
||||
addr->PKT_SC_dwHeader = (ULONG) (PKT_NULL_CMD); \
|
||||
addr->PKT_SC_dwData[0] = (ULONG) 0; \
|
||||
}
|
||||
1358
src/ast_accel.c
Normal file
1358
src/ast_accel.c
Normal file
File diff suppressed because it is too large
Load Diff
376
src/ast_cursor.c
Normal file
376
src/ast_cursor.c
Normal file
@@ -0,0 +1,376 @@
|
||||
/*
|
||||
* Copyright (c) 2005 ASPEED Technology Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of the authors not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. The authors makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as is" without express or implied warranty.
|
||||
*
|
||||
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "xf86.h"
|
||||
#include "xf86_ansic.h"
|
||||
#include "xf86_OSproc.h"
|
||||
#include "xf86Resources.h"
|
||||
#include "xf86RAC.h"
|
||||
#include "xf86cmap.h"
|
||||
#include "compiler.h"
|
||||
#include "mibstore.h"
|
||||
#include "vgaHW.h"
|
||||
#include "mipointer.h"
|
||||
#include "micmap.h"
|
||||
|
||||
#include "fb.h"
|
||||
#include "regionstr.h"
|
||||
#include "xf86xv.h"
|
||||
#include "Xv.h"
|
||||
#include "vbe.h"
|
||||
|
||||
#include "xf86PciInfo.h"
|
||||
#include "xf86Pci.h"
|
||||
|
||||
/* framebuffer offscreen manager */
|
||||
#include "xf86fbman.h"
|
||||
|
||||
/* include xaa includes */
|
||||
#include "xaa.h"
|
||||
#include "xaarop.h"
|
||||
|
||||
/* H/W cursor support */
|
||||
#include "xf86Cursor.h"
|
||||
#include "cursorstr.h"
|
||||
|
||||
/* Driver specific headers */
|
||||
#include "ast.h"
|
||||
|
||||
#ifdef HWC
|
||||
/* Prototype type declaration */
|
||||
Bool ASTCursorInit(ScreenPtr pScreen);
|
||||
Bool bInitHWC(ScrnInfoPtr pScrn, ASTRecPtr pAST);
|
||||
static void ASTShowCursor(ScrnInfoPtr pScrn);
|
||||
static void ASTHideCursor(ScrnInfoPtr pScrn);
|
||||
static void ASTSetCursorPosition(ScrnInfoPtr pScrn, int x, int y);
|
||||
static void ASTSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg);
|
||||
static void ASTLoadCursorImage(ScrnInfoPtr pScrn, UCHAR *src);
|
||||
static Bool ASTUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs);
|
||||
static void ASTLoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCurs);
|
||||
static Bool ASTUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs);
|
||||
|
||||
static void ASTFireCursor(ScrnInfoPtr pScrn);
|
||||
|
||||
Bool
|
||||
ASTCursorInit(ScreenPtr pScreen)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
||||
ASTRecPtr pAST = ASTPTR(pScrn);
|
||||
xf86CursorInfoPtr infoPtr;
|
||||
|
||||
infoPtr = xf86CreateCursorInfoRec();
|
||||
if(!infoPtr) return FALSE;
|
||||
|
||||
pAST->HWCInfoPtr = infoPtr;
|
||||
|
||||
infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
|
||||
HARDWARE_CURSOR_INVERT_MASK |
|
||||
HARDWARE_CURSOR_BIT_ORDER_MSBFIRST;
|
||||
|
||||
infoPtr->MaxWidth = MAX_HWC_WIDTH;
|
||||
infoPtr->MaxHeight = MAX_HWC_HEIGHT;
|
||||
infoPtr->ShowCursor = ASTShowCursor;
|
||||
infoPtr->HideCursor = ASTHideCursor;
|
||||
infoPtr->SetCursorPosition = ASTSetCursorPosition;
|
||||
infoPtr->SetCursorColors = ASTSetCursorColors;
|
||||
infoPtr->LoadCursorImage = ASTLoadCursorImage;
|
||||
infoPtr->UseHWCursor = ASTUseHWCursor;
|
||||
#ifdef ARGB_CURSOR
|
||||
infoPtr->UseHWCursorARGB = ASTUseHWCursorARGB;
|
||||
infoPtr->LoadCursorARGB = ASTLoadCursorARGB;
|
||||
#endif
|
||||
|
||||
return(xf86InitCursor(pScreen, infoPtr));
|
||||
|
||||
}
|
||||
|
||||
Bool bInitHWC(ScrnInfoPtr pScrn, ASTRecPtr pAST)
|
||||
{
|
||||
ScreenPtr pScreen;
|
||||
|
||||
/* init cursor cache info */
|
||||
/* Set HWC_NUM in Options instead */
|
||||
/* pAST->HWCInfo.HWC_NUM = DEFAULT_HWC_NUM; */
|
||||
pAST->HWCInfo.HWC_NUM_Next = 0;
|
||||
|
||||
/* allocate HWC cache */
|
||||
if (!pAST->pHWCPtr) {
|
||||
pScreen = screenInfo.screens[pScrn->scrnIndex];
|
||||
pAST->pHWCPtr = xf86AllocateOffscreenLinear (pScreen, (HWC_SIZE+HWC_SIGNATURE_SIZE)*pAST->HWCInfo.HWC_NUM, HWC_ALIGN, NULL, NULL, NULL);
|
||||
|
||||
if (!pAST->pHWCPtr) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"Allocate HWC Cache failed \n");
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
pAST->HWCInfo.ulHWCOffsetAddr = pAST->pHWCPtr->offset*((pScrn->bitsPerPixel + 1) / 8);
|
||||
pAST->HWCInfo.pjHWCVirtualAddr = pAST->FBVirtualAddr + pAST->HWCInfo.ulHWCOffsetAddr;
|
||||
}
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ASTShowCursor(ScrnInfoPtr pScrn)
|
||||
{
|
||||
ASTRecPtr pAST = ASTPTR(pScrn);
|
||||
UCHAR jReg;
|
||||
|
||||
jReg= 0x02;
|
||||
if (pAST->HWCInfo.cursortype ==HWC_COLOR)
|
||||
jReg |= 0x01;
|
||||
|
||||
SetIndexRegMask(CRTC_PORT, 0xCB, 0xFC, jReg); /* enable mono */
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
ASTHideCursor(ScrnInfoPtr pScrn)
|
||||
{
|
||||
ASTRecPtr pAST = ASTPTR(pScrn);
|
||||
|
||||
SetIndexRegMask(CRTC_PORT, 0xCB, 0xFC, 0x00); /* disable HWC */
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
ASTSetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
|
||||
{
|
||||
ASTRecPtr pAST = ASTPTR(pScrn);
|
||||
DisplayModePtr mode = pAST->ModePtr;
|
||||
int x_offset, y_offset;
|
||||
|
||||
x_offset = pAST->HWCInfo.offset_x;
|
||||
y_offset = pAST->HWCInfo.offset_y;
|
||||
|
||||
if(x < 0) {
|
||||
x_offset = (-x) + pAST->HWCInfo.offset_x;
|
||||
x = 0;
|
||||
}
|
||||
|
||||
if(y < 0) {
|
||||
y_offset = (-y) + pAST->HWCInfo.offset_y;
|
||||
y = 0;
|
||||
}
|
||||
|
||||
if(mode->Flags & V_DBLSCAN) y *= 2;
|
||||
|
||||
/* Set to Reg. */
|
||||
SetIndexReg(CRTC_PORT, 0xC2, (UCHAR) (x_offset));
|
||||
SetIndexReg(CRTC_PORT, 0xC3, (UCHAR) (y_offset));
|
||||
SetIndexReg(CRTC_PORT, 0xC4, (UCHAR) (x & 0xFF));
|
||||
SetIndexReg(CRTC_PORT, 0xC5, (UCHAR) ((x >> 8) & 0x0F));
|
||||
SetIndexReg(CRTC_PORT, 0xC6, (UCHAR) (y & 0xFF));
|
||||
SetIndexReg(CRTC_PORT, 0xC7, (UCHAR) ((y >> 8) & 0x07));
|
||||
|
||||
/* Fire HWC */
|
||||
ASTFireCursor(pScrn);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
ASTSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
|
||||
{
|
||||
ASTRecPtr pAST = ASTPTR(pScrn);
|
||||
|
||||
pAST->HWCInfo.fg = (fg & 0x0F) | (((fg>>8) & 0x0F) << 4) | (((fg>>16) & 0x0F) << 8);
|
||||
pAST->HWCInfo.bg = (bg & 0x0F) | (((bg>>8) & 0x0F) << 4) | (((bg>>16) & 0x0F) << 8);
|
||||
}
|
||||
|
||||
static void
|
||||
ASTLoadCursorImage(ScrnInfoPtr pScrn, UCHAR *src)
|
||||
{
|
||||
ASTRecPtr pAST = ASTPTR(pScrn);
|
||||
int i, j, k;
|
||||
UCHAR *pjSrcAnd, *pjSrcXor, *pjDstData;
|
||||
ULONG ulTempDstAnd32[2], ulTempDstXor32[2], ulTempDstData32[2];
|
||||
UCHAR jTempSrcAnd32, jTempSrcXor32;
|
||||
ULONG ulCheckSum = 0;
|
||||
ULONG ulPatternAddr;
|
||||
|
||||
/* init cursor info. */
|
||||
pAST->HWCInfo.cursortype = HWC_MONO;
|
||||
pAST->HWCInfo.width = (USHORT) MAX_HWC_WIDTH;
|
||||
pAST->HWCInfo.height = (USHORT) MAX_HWC_HEIGHT;
|
||||
pAST->HWCInfo.offset_x = MAX_HWC_WIDTH - pAST->HWCInfo.width;
|
||||
pAST->HWCInfo.offset_y = MAX_HWC_HEIGHT - pAST->HWCInfo.height;
|
||||
|
||||
/* copy cursor image to cache */
|
||||
pjSrcXor = src;
|
||||
pjSrcAnd = src + (MAX_HWC_WIDTH*MAX_HWC_HEIGHT/8);
|
||||
pjDstData = pAST->HWCInfo.pjHWCVirtualAddr+(HWC_SIZE+HWC_SIGNATURE_SIZE)*pAST->HWCInfo.HWC_NUM_Next;
|
||||
|
||||
for (j = 0; j < MAX_HWC_HEIGHT; j++)
|
||||
{
|
||||
for (i = 0; i < (MAX_HWC_WIDTH/8); i++ )
|
||||
{
|
||||
for (k=7; k>0; k-=2)
|
||||
{
|
||||
jTempSrcAnd32 = *((UCHAR *) pjSrcAnd);
|
||||
jTempSrcXor32 = *((UCHAR *) pjSrcXor);
|
||||
ulTempDstAnd32[0] = ((jTempSrcAnd32 >> k) & 0x01) ? 0x00008000L:0x00L;
|
||||
ulTempDstXor32[0] = ((jTempSrcXor32 >> k) & 0x01) ? 0x00004000L:0x00L;
|
||||
ulTempDstData32[0] = ((jTempSrcXor32 >> k) & 0x01) ? pAST->HWCInfo.fg:pAST->HWCInfo.bg;
|
||||
ulTempDstAnd32[1] = ((jTempSrcAnd32 >> (k-1)) & 0x01) ? 0x80000000L:0x00L;
|
||||
ulTempDstXor32[1] = ((jTempSrcXor32 >> (k-1)) & 0x01) ? 0x40000000L:0x00L;
|
||||
ulTempDstData32[1] = ((jTempSrcXor32 >> (k-1)) & 0x01) ? (pAST->HWCInfo.fg << 16):(pAST->HWCInfo.bg << 16);
|
||||
*((ULONG *) pjDstData) = ulTempDstAnd32[0] | ulTempDstXor32[0] | ulTempDstData32[0] | ulTempDstAnd32[1] | ulTempDstXor32[1] | ulTempDstData32[1];
|
||||
ulCheckSum += *((ULONG *) pjDstData);
|
||||
pjDstData += 4;
|
||||
|
||||
}
|
||||
pjSrcAnd ++;
|
||||
pjSrcXor ++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Write Checksum as signature */
|
||||
pjDstData = (UCHAR *) pAST->HWCInfo.pjHWCVirtualAddr + (HWC_SIZE+HWC_SIGNATURE_SIZE)*pAST->HWCInfo.HWC_NUM_Next + HWC_SIZE;
|
||||
*((ULONG *) pjDstData) = ulCheckSum;
|
||||
|
||||
/* set pattern offset */
|
||||
ulPatternAddr = ((pAST->HWCInfo.ulHWCOffsetAddr+(HWC_SIZE+HWC_SIGNATURE_SIZE)*pAST->HWCInfo.HWC_NUM_Next) >> 3);
|
||||
SetIndexReg(CRTC_PORT, 0xC8, (UCHAR) (ulPatternAddr & 0xFF));
|
||||
SetIndexReg(CRTC_PORT, 0xC9, (UCHAR) ((ulPatternAddr >> 8) & 0xFF));
|
||||
SetIndexReg(CRTC_PORT, 0xCA, (UCHAR) ((ulPatternAddr >> 16) & 0xFF));
|
||||
|
||||
/* update HWC_NUM_Next */
|
||||
pAST->HWCInfo.HWC_NUM_Next = (pAST->HWCInfo.HWC_NUM_Next+1) % pAST->HWCInfo.HWC_NUM;
|
||||
|
||||
}
|
||||
|
||||
static Bool
|
||||
ASTUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
ASTLoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
|
||||
{
|
||||
ASTRecPtr pAST = ASTPTR(pScrn);
|
||||
|
||||
UCHAR *pjDstXor, *pjSrcXor;
|
||||
ULONG i, j, ulSrcWidth, ulSrcHeight;
|
||||
ULONG ulPerPixelCopy, ulTwoPixelCopy;
|
||||
LONG lAlphaDstDelta, lLastAlphaDstDelta;
|
||||
union
|
||||
{
|
||||
ULONG ul;
|
||||
UCHAR b[4];
|
||||
} ulSrcData32[2], ulData32;
|
||||
union
|
||||
{
|
||||
USHORT us;
|
||||
UCHAR b[2];
|
||||
} usData16;
|
||||
ULONG ulCheckSum = 0;
|
||||
ULONG ulPatternAddr;
|
||||
|
||||
/* init cursor info. */
|
||||
pAST->HWCInfo.cursortype = HWC_COLOR;
|
||||
pAST->HWCInfo.width = pCurs->bits->width;
|
||||
pAST->HWCInfo.height = pCurs->bits->height;
|
||||
pAST->HWCInfo.offset_x = MAX_HWC_WIDTH - pAST->HWCInfo.width;
|
||||
pAST->HWCInfo.offset_y = MAX_HWC_HEIGHT - pAST->HWCInfo.height;
|
||||
|
||||
/* copy cursor image to cache */
|
||||
ulSrcWidth = pAST->HWCInfo.width;
|
||||
ulSrcHeight = pAST->HWCInfo.height;
|
||||
|
||||
lAlphaDstDelta = MAX_HWC_WIDTH << 1;
|
||||
lLastAlphaDstDelta = lAlphaDstDelta - (ulSrcWidth << 1);
|
||||
|
||||
pjSrcXor = (UCHAR *) pCurs->bits->argb;;
|
||||
pjDstXor = (UCHAR *) pAST->HWCInfo.pjHWCVirtualAddr + (HWC_SIZE+HWC_SIGNATURE_SIZE)*pAST->HWCInfo.HWC_NUM_Next
|
||||
+ lLastAlphaDstDelta + (MAX_HWC_HEIGHT - ulSrcHeight) * lAlphaDstDelta;
|
||||
|
||||
ulPerPixelCopy = ulSrcWidth & 1;
|
||||
ulTwoPixelCopy = ulSrcWidth >> 1;
|
||||
|
||||
for (j = 0; j < ulSrcHeight; j++)
|
||||
{
|
||||
|
||||
for (i = 0; i < ulTwoPixelCopy; i++ )
|
||||
{
|
||||
ulSrcData32[0].ul = *((ULONG *) pjSrcXor) & 0xF0F0F0F0;
|
||||
ulSrcData32[1].ul = *((ULONG *) (pjSrcXor+4)) & 0xF0F0F0F0;
|
||||
ulData32.b[0] = ulSrcData32[0].b[1] | (ulSrcData32[0].b[0] >> 4);
|
||||
ulData32.b[1] = ulSrcData32[0].b[3] | (ulSrcData32[0].b[2] >> 4);
|
||||
ulData32.b[2] = ulSrcData32[1].b[1] | (ulSrcData32[1].b[0] >> 4);
|
||||
ulData32.b[3] = ulSrcData32[1].b[3] | (ulSrcData32[1].b[2] >> 4);
|
||||
*((ULONG *) pjDstXor) = ulData32.ul;
|
||||
ulCheckSum += (ULONG) ulData32.ul;
|
||||
pjDstXor += 4;
|
||||
pjSrcXor += 8;
|
||||
}
|
||||
|
||||
for (i = 0; i < ulPerPixelCopy; i++ )
|
||||
{
|
||||
ulSrcData32[0].ul = *((ULONG *) pjSrcXor) & 0xF0F0F0F0;
|
||||
usData16.b[0] = ulSrcData32[0].b[1] | (ulSrcData32[0].b[0] >> 4);
|
||||
usData16.b[1] = ulSrcData32[0].b[3] | (ulSrcData32[0].b[2] >> 4);
|
||||
*((USHORT *) pjDstXor) = usData16.us;
|
||||
ulCheckSum += (ULONG) usData16.us;
|
||||
pjDstXor += 2;
|
||||
pjSrcXor += 4;
|
||||
}
|
||||
|
||||
/* Point to next source and dest scans */
|
||||
pjDstXor += lLastAlphaDstDelta;
|
||||
|
||||
} /* end of for-loop */
|
||||
|
||||
/* Write Checksum as signature */
|
||||
pjDstXor = (UCHAR *) pAST->HWCInfo.pjHWCVirtualAddr + (HWC_SIZE+HWC_SIGNATURE_SIZE)*pAST->HWCInfo.HWC_NUM_Next + HWC_SIZE;
|
||||
*((ULONG *) pjDstXor) = ulCheckSum;
|
||||
|
||||
/* set pattern offset */
|
||||
ulPatternAddr = ((pAST->HWCInfo.ulHWCOffsetAddr +(HWC_SIZE+HWC_SIGNATURE_SIZE)*pAST->HWCInfo.HWC_NUM_Next) >> 3);
|
||||
SetIndexReg(CRTC_PORT, 0xC8, (UCHAR) (ulPatternAddr & 0xFF));
|
||||
SetIndexReg(CRTC_PORT, 0xC9, (UCHAR) ((ulPatternAddr >> 8) & 0xFF));
|
||||
SetIndexReg(CRTC_PORT, 0xCA, (UCHAR) ((ulPatternAddr >> 16) & 0xFF));
|
||||
|
||||
/* update HWC_NUM_Next */
|
||||
pAST->HWCInfo.HWC_NUM_Next = (pAST->HWCInfo.HWC_NUM_Next+1) % pAST->HWCInfo.HWC_NUM;
|
||||
|
||||
}
|
||||
|
||||
static Bool
|
||||
ASTUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
ASTFireCursor(ScrnInfoPtr pScrn)
|
||||
{
|
||||
ASTRecPtr pAST = ASTPTR(pScrn);
|
||||
|
||||
SetIndexRegMask(CRTC_PORT, 0xCB, 0xFF, 0x00); /* dummp write to fire HWC */
|
||||
|
||||
}
|
||||
|
||||
#endif /* End of HWC */
|
||||
30
src/ast_cursor.h
Normal file
30
src/ast_cursor.h
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2005 ASPEED Technology Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of the authors not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. The authors makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as is" without express or implied warranty.
|
||||
*
|
||||
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define MAX_HWC_WIDTH 64
|
||||
#define MAX_HWC_HEIGHT 64
|
||||
#define HWC_SIZE (MAX_HWC_WIDTH*MAX_HWC_HEIGHT*2)
|
||||
#define HWC_SIGNATURE_SIZE 32
|
||||
#define HWC_ALIGN 32
|
||||
|
||||
#define HWC_MONO 0
|
||||
#define HWC_COLOR 1
|
||||
1220
src/ast_driver.c
Normal file
1220
src/ast_driver.c
Normal file
File diff suppressed because it is too large
Load Diff
712
src/ast_mode.c
Normal file
712
src/ast_mode.c
Normal file
@@ -0,0 +1,712 @@
|
||||
/*
|
||||
* Copyright (c) 2005 ASPEED Technology Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of the authors not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. The authors makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as is" without express or implied warranty.
|
||||
*
|
||||
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "xf86.h"
|
||||
#include "xf86_ansic.h"
|
||||
#include "xf86_OSproc.h"
|
||||
#include "xf86Resources.h"
|
||||
#include "xf86RAC.h"
|
||||
#include "xf86cmap.h"
|
||||
#include "compiler.h"
|
||||
#include "mibstore.h"
|
||||
#include "vgaHW.h"
|
||||
#include "mipointer.h"
|
||||
#include "micmap.h"
|
||||
|
||||
#include "fb.h"
|
||||
#include "regionstr.h"
|
||||
#include "xf86xv.h"
|
||||
#include "Xv.h"
|
||||
#include "vbe.h"
|
||||
|
||||
#include "xf86PciInfo.h"
|
||||
#include "xf86Pci.h"
|
||||
|
||||
/* framebuffer offscreen manager */
|
||||
#include "xf86fbman.h"
|
||||
|
||||
/* include xaa includes */
|
||||
#include "xaa.h"
|
||||
#include "xaarop.h"
|
||||
|
||||
/* H/W cursor support */
|
||||
#include "xf86Cursor.h"
|
||||
|
||||
/* Driver specific headers */
|
||||
#include "ast.h"
|
||||
|
||||
VBIOS_STDTABLE_STRUCT StdTable[] = {
|
||||
/* MD_2_3_400 */
|
||||
{
|
||||
0x67,
|
||||
{0x00,0x03,0x00,0x02},
|
||||
{0x5f,0x4f,0x50,0x82,0x55,0x81,0xbf,0x1f,
|
||||
0x00,0x4f,0x0d,0x0e,0x00,0x00,0x00,0x00,
|
||||
0x9c,0x8e,0x8f,0x28,0x1f,0x96,0xb9,0xa3,
|
||||
0xff},
|
||||
{0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
|
||||
0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
|
||||
0x0c,0x00,0x0f,0x08},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x10,0x0e,0x00,
|
||||
0xff}
|
||||
},
|
||||
/* Mode12/ExtEGATable */
|
||||
{
|
||||
0xe3,
|
||||
{0x01,0x0f,0x00,0x06},
|
||||
{0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e,
|
||||
0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0xe9,0x8b,0xdf,0x28,0x00,0xe7,0x04,0xe3,
|
||||
0xff},
|
||||
{0x00,0x01,0x02,0x03,0x04,0x05,0x14,0x07,
|
||||
0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
|
||||
0x01,0x00,0x0f,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
|
||||
0xff}
|
||||
},
|
||||
/* ExtVGATable */
|
||||
{
|
||||
0x2f,
|
||||
{0x01,0x0f,0x00,0x0e},
|
||||
{0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e,
|
||||
0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3,
|
||||
0xff},
|
||||
{0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
|
||||
0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
|
||||
0x01,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f,
|
||||
0xff}
|
||||
},
|
||||
/* ExtHiCTable */
|
||||
{
|
||||
0x2f,
|
||||
{0x01,0x0f,0x00,0x0e},
|
||||
{0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e,
|
||||
0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3,
|
||||
0xff},
|
||||
{0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
|
||||
0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
|
||||
0x01,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
|
||||
0xff}
|
||||
},
|
||||
/* ExtTrueCTable */
|
||||
{
|
||||
0x2f,
|
||||
{0x01,0x0f,0x00,0x0e},
|
||||
{0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e,
|
||||
0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3,
|
||||
0xff},
|
||||
{0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
|
||||
0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
|
||||
0x01,0x00,0x00,0x00},
|
||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x0f,
|
||||
0xff}
|
||||
},
|
||||
};
|
||||
|
||||
VBIOS_ENHTABLE_STRUCT Res640x480Table[] = {
|
||||
{ 800, 640, 8, 96, 525, 480, 2, 2, VCLK28_322, /* 60Hz */
|
||||
(SyncNN | HBorder | VBorder | Charx8Dot), 60, 1, 0x2E },
|
||||
{ 832, 640, 16, 40, 520, 480, 1, 3, VCLK31_5, /* 72Hz */
|
||||
(SyncNN | HBorder | VBorder | Charx8Dot), 72, 2, 0x2E },
|
||||
{ 840, 640, 16, 64, 500, 480, 1, 3, VCLK31_5, /* 75Hz */
|
||||
(SyncNN | Charx8Dot) , 75, 3, 0x2E },
|
||||
{ 832, 640, 56, 56, 509, 480, 1, 3, VCLK36, /* 85Hz */
|
||||
(SyncNN | Charx8Dot) , 85, 4, 0x2E },
|
||||
{ 832, 640, 56, 56, 509, 480, 1, 3, VCLK36, /* end */
|
||||
(SyncNN | Charx8Dot) , 0xFF, 4, 0x2E },
|
||||
};
|
||||
|
||||
|
||||
VBIOS_ENHTABLE_STRUCT Res800x600Table[] = {
|
||||
{1024, 800, 24, 72, 625, 600, 1, 2, VCLK36, /* 56Hz */
|
||||
(SyncPP | Charx8Dot), 56, 1, 0x30 },
|
||||
{1056, 800, 40, 128, 628, 600, 1, 4, VCLK40, /* 60Hz */
|
||||
(SyncPP | Charx8Dot), 60, 2, 0x30 },
|
||||
{1040, 800, 56, 120, 666, 600, 37, 6, VCLK50, /* 72Hz */
|
||||
(SyncPP | Charx8Dot), 72, 3, 0x30 },
|
||||
{1056, 800, 16, 80, 625, 600, 1, 3, VCLK49_5, /* 75Hz */
|
||||
(SyncPP | Charx8Dot), 75, 4, 0x30 },
|
||||
{1048, 800, 32, 64, 631, 600, 1, 3, VCLK56_25, /* 85Hz */
|
||||
(SyncPP | Charx8Dot), 85, 5, 0x30 },
|
||||
{1048, 800, 32, 64, 631, 600, 1, 3, VCLK56_25, /* end */
|
||||
(SyncPP | Charx8Dot), 0xFF, 5, 0x30 },
|
||||
};
|
||||
|
||||
|
||||
VBIOS_ENHTABLE_STRUCT Res1024x768Table[] = {
|
||||
{1344, 1024, 24, 136, 806, 768, 3, 6, VCLK65, /* 60Hz */
|
||||
(SyncNN | Charx8Dot), 60, 1, 0x31 },
|
||||
{1328, 1024, 24, 136, 806, 768, 3, 6, VCLK75, /* 70Hz */
|
||||
(SyncNN | Charx8Dot), 70, 2, 0x31 },
|
||||
{1312, 1024, 16, 96, 800, 768, 1, 3, VCLK78_75, /* 75Hz */
|
||||
(SyncPP | Charx8Dot), 75, 3, 0x31 },
|
||||
{1376, 1024, 48, 96, 808, 768, 1, 3, VCLK94_5, /* 85Hz */
|
||||
(SyncPP | Charx8Dot), 85, 4, 0x31 },
|
||||
{1376, 1024, 48, 96, 808, 768, 1, 3, VCLK94_5, /* end */
|
||||
(SyncPP | Charx8Dot), 0xFF, 4, 0x31 },
|
||||
};
|
||||
|
||||
VBIOS_ENHTABLE_STRUCT Res1280x1024Table[] = {
|
||||
{1688, 1280, 48, 112, 1066, 1024, 1, 3, VCLK108, /* 60Hz */
|
||||
(SyncPP | Charx8Dot), 60, 1, 0x32 },
|
||||
{1688, 1280, 16, 144, 1066, 1024, 1, 3, VCLK135, /* 75Hz */
|
||||
(SyncPP | Charx8Dot), 75, 2, 0x32 },
|
||||
{1728, 1280, 64, 160, 1072, 1024, 1, 3, VCLK157_5, /* 85Hz */
|
||||
(SyncPP | Charx8Dot), 85, 3, 0x32 },
|
||||
{1728, 1280, 64, 160, 1072, 1024, 1, 3, VCLK157_5, /* end */
|
||||
(SyncPP | Charx8Dot), 0xFF, 3, 0x32 },
|
||||
};
|
||||
|
||||
VBIOS_ENHTABLE_STRUCT Res1600x1200Table[] = {
|
||||
{2160, 1600, 64, 192, 1250, 1200, 1, 3, VCLK162, /* 60Hz */
|
||||
(SyncPP | Charx8Dot), 60, 1, 0x33 },
|
||||
{2160, 1600, 64, 192, 1250, 1200, 1, 3, VCLK162, /* end */
|
||||
(SyncPP | Charx8Dot), 60, 1, 0x33 },
|
||||
};
|
||||
|
||||
VBIOS_DCLK_INFO DCLKTable [] = {
|
||||
{0x2C, 0xE7, 0x03}, /* 00: VCLK25_175 */
|
||||
{0x95, 0x62, 0x03}, /* 01: VCLK28_322 */
|
||||
{0x67, 0x63, 0x01}, /* 02: VCLK31_5 */
|
||||
{0x76, 0x63, 0x01}, /* 03: VCLK36 */
|
||||
{0xEE, 0x67, 0x01}, /* 04: VCLK40 */
|
||||
{0x82, 0x62, 0x01}, /* 05: VCLK49_5 */
|
||||
{0xC6, 0x64, 0x01}, /* 06: VCLK50 */
|
||||
{0x94, 0x62, 0x01}, /* 07: VCLK56_25 */
|
||||
{0x80, 0x64, 0x00}, /* 08: VCLK65 */
|
||||
{0x7B, 0x63, 0x00}, /* 09: VCLK75 */
|
||||
{0x67, 0x62, 0x00}, /* 0A: VCLK78_75 */
|
||||
{0x7C, 0x62, 0x00}, /* 0B: VCLK94_5 */
|
||||
{0x8E, 0x62, 0x00}, /* 0C: VCLK108 */
|
||||
{0x85, 0x24, 0x00}, /* 0D: VCLK135 */
|
||||
{0x67, 0x22, 0x00}, /* 0E: VCLK157_5 */
|
||||
{0x6A, 0x22, 0x00}, /* 0F: VCLK162 */
|
||||
};
|
||||
|
||||
VBIOS_DAC_INFO DAC_TEXT[] = {
|
||||
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x2a }, { 0x00, 0x2a, 0x00 }, { 0x00, 0x2a, 0x2a },
|
||||
{ 0x2a, 0x00, 0x00 }, { 0x2a, 0x00, 0x2a }, { 0x2a, 0x2a, 0x00 }, { 0x2a, 0x2a, 0x2a },
|
||||
{ 0x00, 0x00, 0x15 }, { 0x00, 0x00, 0x3f }, { 0x00, 0x2a, 0x15 }, { 0x00, 0x2a, 0x3f },
|
||||
{ 0x2a, 0x00, 0x15 }, { 0x2a, 0x00, 0x3f }, { 0x2a, 0x2a, 0x15 }, { 0x2a, 0x2a, 0x3f },
|
||||
{ 0x00, 0x15, 0x00 }, { 0x00, 0x15, 0x2a }, { 0x00, 0x3f, 0x00 }, { 0x00, 0x3f, 0x2a },
|
||||
{ 0x2a, 0x15, 0x00 }, { 0x2a, 0x15, 0x2a }, { 0x2a, 0x3f, 0x00 }, { 0x2a, 0x3f, 0x2a },
|
||||
{ 0x00, 0x15, 0x15 }, { 0x00, 0x15, 0x3f }, { 0x00, 0x3f, 0x15 }, { 0x00, 0x3f, 0x3f },
|
||||
{ 0x2a, 0x15, 0x15 }, { 0x2a, 0x15, 0x3f }, { 0x2a, 0x3f, 0x15 }, { 0x2a, 0x3f, 0x3f },
|
||||
{ 0x15, 0x00, 0x00 }, { 0x15, 0x00, 0x2a }, { 0x15, 0x2a, 0x00 }, { 0x15, 0x2a, 0x2a },
|
||||
{ 0x3f, 0x00, 0x00 }, { 0x3f, 0x00, 0x2a }, { 0x3f, 0x2a, 0x00 }, { 0x3f, 0x2a, 0x2a },
|
||||
{ 0x15, 0x00, 0x15 }, { 0x15, 0x00, 0x3f }, { 0x15, 0x2a, 0x15 }, { 0x15, 0x2a, 0x3f },
|
||||
{ 0x3f, 0x00, 0x15 }, { 0x3f, 0x00, 0x3f }, { 0x3f, 0x2a, 0x15 }, { 0x3f, 0x2a, 0x3f },
|
||||
{ 0x15, 0x15, 0x00 }, { 0x15, 0x15, 0x2a }, { 0x15, 0x3f, 0x00 }, { 0x15, 0x3f, 0x2a },
|
||||
{ 0x3f, 0x15, 0x00 }, { 0x3f, 0x15, 0x2a }, { 0x3f, 0x3f, 0x00 }, { 0x3f, 0x3f, 0x2a },
|
||||
{ 0x15, 0x15, 0x15 }, { 0x15, 0x15, 0x3f }, { 0x15, 0x3f, 0x15 }, { 0x15, 0x3f, 0x3f },
|
||||
{ 0x3f, 0x15, 0x15 }, { 0x3f, 0x15, 0x3f }, { 0x3f, 0x3f, 0x15 }, { 0x3f, 0x3f, 0x3f },
|
||||
};
|
||||
|
||||
VBIOS_DAC_INFO DAC_EGA[] = {
|
||||
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x2a }, { 0x00, 0x2a, 0x00 }, { 0x00, 0x2a, 0x2a },
|
||||
{ 0x2a, 0x00, 0x00 }, { 0x2a, 0x00, 0x2a }, { 0x2a, 0x2a, 0x00 }, { 0x2a, 0x2a, 0x2a },
|
||||
{ 0x00, 0x00, 0x15 }, { 0x00, 0x00, 0x3f }, { 0x00, 0x2a, 0x15 }, { 0x00, 0x2a, 0x3f },
|
||||
{ 0x2a, 0x00, 0x15 }, { 0x2a, 0x00, 0x3f }, { 0x2a, 0x2a, 0x15 }, { 0x2a, 0x2a, 0x3f },
|
||||
{ 0x00, 0x15, 0x00 }, { 0x00, 0x15, 0x2a }, { 0x00, 0x3f, 0x00 }, { 0x00, 0x3f, 0x2a },
|
||||
{ 0x2a, 0x15, 0x00 }, { 0x2a, 0x15, 0x2a }, { 0x2a, 0x3f, 0x00 }, { 0x2a, 0x3f, 0x2a },
|
||||
{ 0x00, 0x15, 0x15 }, { 0x00, 0x15, 0x3f }, { 0x00, 0x3f, 0x15 }, { 0x00, 0x3f, 0x3f },
|
||||
{ 0x2a, 0x15, 0x15 }, { 0x2a, 0x15, 0x3f }, { 0x2a, 0x3f, 0x15 }, { 0x2a, 0x3f, 0x3f },
|
||||
{ 0x15, 0x00, 0x00 }, { 0x15, 0x00, 0x2a }, { 0x15, 0x2a, 0x00 }, { 0x15, 0x2a, 0x2a },
|
||||
{ 0x3f, 0x00, 0x00 }, { 0x3f, 0x00, 0x2a }, { 0x3f, 0x2a, 0x00 }, { 0x3f, 0x2a, 0x2a },
|
||||
{ 0x15, 0x00, 0x15 }, { 0x15, 0x00, 0x3f }, { 0x15, 0x2a, 0x15 }, { 0x15, 0x2a, 0x3f },
|
||||
{ 0x3f, 0x00, 0x15 }, { 0x3f, 0x00, 0x3f }, { 0x3f, 0x2a, 0x15 }, { 0x3f, 0x2a, 0x3f },
|
||||
{ 0x15, 0x15, 0x00 }, { 0x15, 0x15, 0x2a }, { 0x15, 0x3f, 0x00 }, { 0x15, 0x3f, 0x2a },
|
||||
{ 0x3f, 0x15, 0x00 }, { 0x3f, 0x15, 0x2a }, { 0x3f, 0x3f, 0x00 }, { 0x3f, 0x3f, 0x2a },
|
||||
{ 0x15, 0x15, 0x15 }, { 0x15, 0x15, 0x3f }, { 0x15, 0x3f, 0x15 }, { 0x15, 0x3f, 0x3f },
|
||||
{ 0x3f, 0x15, 0x15 }, { 0x3f, 0x15, 0x3f }, { 0x3f, 0x3f, 0x15 }, { 0x3f, 0x3f, 0x3f },
|
||||
};
|
||||
|
||||
VBIOS_DAC_INFO DAC_VGA[] = {
|
||||
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x2a }, { 0x00, 0x2a, 0x00 }, { 0x00, 0x2a, 0x2a },
|
||||
{ 0x2a, 0x00, 0x00 }, { 0x2a, 0x00, 0x2a }, { 0x2a, 0x15, 0x00 }, { 0x2a, 0x2a, 0x2a },
|
||||
{ 0x15, 0x15, 0x15 }, { 0x15, 0x15, 0x3f }, { 0x15, 0x3f, 0x15 }, { 0x15, 0x3f, 0x3f },
|
||||
{ 0x3f, 0x15, 0x15 }, { 0x3f, 0x15, 0x3f }, { 0x3f, 0x3f, 0x15 }, { 0x3f, 0x3f, 0x3f },
|
||||
{ 0x00, 0x00, 0x00 }, { 0x05, 0x05, 0x05 }, { 0x08, 0x08, 0x08 }, { 0x0b, 0x0b, 0x0b },
|
||||
{ 0x0e, 0x0e, 0x0e }, { 0x11, 0x11, 0x11 }, { 0x14, 0x14, 0x14 }, { 0x18, 0x18, 0x18 },
|
||||
{ 0x1c, 0x1c, 0x1c }, { 0x20, 0x20, 0x20 }, { 0x24, 0x24, 0x24 }, { 0x28, 0x28, 0x28 },
|
||||
{ 0x2d, 0x2d, 0x2d }, { 0x32, 0x32, 0x32 }, { 0x38, 0x38, 0x38 }, { 0x3f, 0x3f, 0x3f },
|
||||
{ 0x00, 0x00, 0x3f }, { 0x10, 0x00, 0x3f }, { 0x1f, 0x00, 0x3f }, { 0x2f, 0x00, 0x3f },
|
||||
{ 0x3f, 0x00, 0x3f }, { 0x3f, 0x00, 0x2f }, { 0x3f, 0x00, 0x1f }, { 0x3f, 0x00, 0x10 },
|
||||
{ 0x3f, 0x00, 0x00 }, { 0x3f, 0x10, 0x00 }, { 0x3f, 0x1f, 0x00 }, { 0x3f, 0x2f, 0x00 },
|
||||
{ 0x3f, 0x3f, 0x00 }, { 0x2f, 0x3f, 0x00 }, { 0x1f, 0x3f, 0x00 }, { 0x10, 0x3f, 0x00 },
|
||||
{ 0x00, 0x3f, 0x00 }, { 0x00, 0x3f, 0x10 }, { 0x00, 0x3f, 0x1f }, { 0x00, 0x3f, 0x2f },
|
||||
{ 0x00, 0x3f, 0x3f }, { 0x00, 0x2f, 0x3f }, { 0x00, 0x1f, 0x3f }, { 0x00, 0x10, 0x3f },
|
||||
{ 0x1f, 0x1f, 0x3f }, { 0x27, 0x1f, 0x3f }, { 0x2f, 0x1f, 0x3f }, { 0x37, 0x1f, 0x3f },
|
||||
{ 0x3f, 0x1f, 0x3f }, { 0x3f, 0x1f, 0x37 }, { 0x3f, 0x1f, 0x2f }, { 0x3f, 0x1f, 0x27 },
|
||||
{ 0x3f, 0x1f, 0x1f }, { 0x3f, 0x27, 0x1f }, { 0x3f, 0x2f, 0x1f }, { 0x3f, 0x37, 0x1f },
|
||||
{ 0x3f, 0x3f, 0x1f }, { 0x37, 0x3f, 0x1f }, { 0x2f, 0x3f, 0x1f }, { 0x27, 0x3f, 0x1f },
|
||||
{ 0x1f, 0x3f, 0x1f }, { 0x1f, 0x3f, 0x27 }, { 0x1f, 0x3f, 0x2f }, { 0x1f, 0x3f, 0x37 },
|
||||
{ 0x1f, 0x3f, 0x3f }, { 0x1f, 0x37, 0x3f }, { 0x1f, 0x2f, 0x3f }, { 0x1f, 0x27, 0x3f },
|
||||
{ 0x2d, 0x2d, 0x3f }, { 0x31, 0x2d, 0x3f }, { 0x36, 0x2d, 0x3f }, { 0x3a, 0x2d, 0x3f },
|
||||
{ 0x3f, 0x2d, 0x3f }, { 0x3f, 0x2d, 0x3a }, { 0x3f, 0x2d, 0x36 }, { 0x3f, 0x2d, 0x31 },
|
||||
{ 0x3f, 0x2d, 0x2d }, { 0x3f, 0x31, 0x2d }, { 0x3f, 0x36, 0x2d }, { 0x3f, 0x3a, 0x2d },
|
||||
{ 0x3f, 0x3f, 0x2d }, { 0x3a, 0x3f, 0x2d }, { 0x36, 0x3f, 0x2d }, { 0x31, 0x3f, 0x2d },
|
||||
{ 0x2d, 0x3f, 0x2d }, { 0x2d, 0x3f, 0x31 }, { 0x2d, 0x3f, 0x36 }, { 0x2d, 0x3f, 0x3a },
|
||||
{ 0x2d, 0x3f, 0x3f }, { 0x2d, 0x3a, 0x3f }, { 0x2d, 0x36, 0x3f }, { 0x2d, 0x31, 0x3f },
|
||||
{ 0x00, 0x00, 0x1c }, { 0x07, 0x00, 0x1c }, { 0x0e, 0x00, 0x1c }, { 0x15, 0x00, 0x1c },
|
||||
{ 0x1c, 0x00, 0x1c }, { 0x1c, 0x00, 0x15 }, { 0x1c, 0x00, 0x0e }, { 0x1c, 0x00, 0x07 },
|
||||
{ 0x1c, 0x00, 0x00 }, { 0x1c, 0x07, 0x00 }, { 0x1c, 0x0e, 0x00 }, { 0x1c, 0x15, 0x00 },
|
||||
{ 0x1c, 0x1c, 0x00 }, { 0x15, 0x1c, 0x00 }, { 0x0e, 0x1c, 0x00 }, { 0x07, 0x1c, 0x00 },
|
||||
{ 0x00, 0x1c, 0x00 }, { 0x00, 0x1c, 0x07 }, { 0x00, 0x1c, 0x0e }, { 0x00, 0x1c, 0x15 },
|
||||
{ 0x00, 0x1c, 0x1c }, { 0x00, 0x15, 0x1c }, { 0x00, 0x0e, 0x1c }, { 0x00, 0x07, 0x1c },
|
||||
{ 0x0e, 0x0e, 0x1c }, { 0x11, 0x0e, 0x1c }, { 0x15, 0x0e, 0x1c }, { 0x18, 0x0e, 0x1c },
|
||||
{ 0x1c, 0x0e, 0x1c }, { 0x1c, 0x0e, 0x18 }, { 0x1c, 0x0e, 0x15 }, { 0x1c, 0x0e, 0x11 },
|
||||
{ 0x1c, 0x0e, 0x0e }, { 0x1c, 0x11, 0x0e }, { 0x1c, 0x15, 0x0e }, { 0x1c, 0x18, 0x0e },
|
||||
{ 0x1c, 0x1c, 0x0e }, { 0x18, 0x1c, 0x0e }, { 0x15, 0x1c, 0x0e }, { 0x11, 0x1c, 0x0e },
|
||||
{ 0x0e, 0x1c, 0x0e }, { 0x0e, 0x1c, 0x11 }, { 0x0e, 0x1c, 0x15 }, { 0x0e, 0x1c, 0x18 },
|
||||
{ 0x0e, 0x1c, 0x1c }, { 0x0e, 0x18, 0x1c }, { 0x0e, 0x15, 0x1c }, { 0x0e, 0x11, 0x1c },
|
||||
{ 0x14, 0x14, 0x1c }, { 0x16, 0x14, 0x1c }, { 0x18, 0x14, 0x1c }, { 0x1a, 0x14, 0x1c },
|
||||
{ 0x1c, 0x14, 0x1c }, { 0x1c, 0x14, 0x1a }, { 0x1c, 0x14, 0x18 }, { 0x1c, 0x14, 0x16 },
|
||||
{ 0x1c, 0x14, 0x14 }, { 0x1c, 0x16, 0x14 }, { 0x1c, 0x18, 0x14 }, { 0x1c, 0x1a, 0x14 },
|
||||
{ 0x1c, 0x1c, 0x14 }, { 0x1a, 0x1c, 0x14 }, { 0x18, 0x1c, 0x14 }, { 0x16, 0x1c, 0x14 },
|
||||
{ 0x14, 0x1c, 0x14 }, { 0x14, 0x1c, 0x16 }, { 0x14, 0x1c, 0x18 }, { 0x14, 0x1c, 0x1a },
|
||||
{ 0x14, 0x1c, 0x1c }, { 0x14, 0x1a, 0x1c }, { 0x14, 0x18, 0x1c }, { 0x14, 0x16, 0x1c },
|
||||
{ 0x00, 0x00, 0x10 }, { 0x04, 0x00, 0x10 }, { 0x08, 0x00, 0x10 }, { 0x0c, 0x00, 0x10 },
|
||||
{ 0x10, 0x00, 0x10 }, { 0x10, 0x00, 0x0c }, { 0x10, 0x00, 0x08 }, { 0x10, 0x00, 0x04 },
|
||||
{ 0x10, 0x00, 0x00 }, { 0x10, 0x04, 0x00 }, { 0x10, 0x08, 0x00 }, { 0x10, 0x0c, 0x00 },
|
||||
{ 0x10, 0x10, 0x00 }, { 0x0c, 0x10, 0x00 }, { 0x08, 0x10, 0x00 }, { 0x04, 0x10, 0x00 },
|
||||
{ 0x00, 0x10, 0x00 }, { 0x00, 0x10, 0x04 }, { 0x00, 0x10, 0x08 }, { 0x00, 0x10, 0x0c },
|
||||
{ 0x00, 0x10, 0x10 }, { 0x00, 0x0c, 0x10 }, { 0x00, 0x08, 0x10 }, { 0x00, 0x04, 0x10 },
|
||||
{ 0x08, 0x08, 0x10 }, { 0x0a, 0x08, 0x10 }, { 0x0c, 0x08, 0x10 }, { 0x0e, 0x08, 0x10 },
|
||||
{ 0x10, 0x08, 0x10 }, { 0x10, 0x08, 0x0e }, { 0x10, 0x08, 0x0c }, { 0x10, 0x08, 0x0a },
|
||||
{ 0x10, 0x08, 0x08 }, { 0x10, 0x0a, 0x08 }, { 0x10, 0x0c, 0x08 }, { 0x10, 0x0e, 0x08 },
|
||||
{ 0x10, 0x10, 0x08 }, { 0x0e, 0x10, 0x08 }, { 0x0c, 0x10, 0x08 }, { 0x0a, 0x10, 0x08 },
|
||||
{ 0x08, 0x10, 0x08 }, { 0x08, 0x10, 0x0a }, { 0x08, 0x10, 0x0c }, { 0x08, 0x10, 0x0e },
|
||||
{ 0x08, 0x10, 0x10 }, { 0x08, 0x0e, 0x10 }, { 0x08, 0x0c, 0x10 }, { 0x08, 0x0a, 0x10 },
|
||||
{ 0x0b, 0x0b, 0x10 }, { 0x0c, 0x0b, 0x10 }, { 0x0d, 0x0b, 0x10 }, { 0x0f, 0x0b, 0x10 },
|
||||
{ 0x10, 0x0b, 0x10 }, { 0x10, 0x0b, 0x0f }, { 0x10, 0x0b, 0x0d }, { 0x10, 0x0b, 0x0c },
|
||||
{ 0x10, 0x0b, 0x0b }, { 0x10, 0x0c, 0x0b }, { 0x10, 0x0d, 0x0b }, { 0x10, 0x0f, 0x0b },
|
||||
{ 0x10, 0x10, 0x0b }, { 0x0f, 0x10, 0x0b }, { 0x0d, 0x10, 0x0b }, { 0x0c, 0x10, 0x0b },
|
||||
{ 0x0b, 0x10, 0x0b }, { 0x0b, 0x10, 0x0c }, { 0x0b, 0x10, 0x0d }, { 0x0b, 0x10, 0x0f },
|
||||
{ 0x0b, 0x10, 0x10 }, { 0x0b, 0x0f, 0x10 }, { 0x0b, 0x0d, 0x10 }, { 0x0b, 0x0c, 0x10 },
|
||||
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x00 },
|
||||
};
|
||||
|
||||
/* extern. function */
|
||||
extern void vASTOpenKey(ScrnInfoPtr pScrn);
|
||||
extern Bool bASTRegInit(ScrnInfoPtr pScrn);
|
||||
extern void vAST1000DisplayOn(ASTRecPtr pAST);
|
||||
extern void vAST1000DisplayOff(ASTRecPtr pAST);
|
||||
|
||||
extern Bool bEnable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST);
|
||||
extern void vDisable2D(ScrnInfoPtr pScrn, ASTRecPtr pAST);
|
||||
|
||||
extern Bool bInitHWC(ScrnInfoPtr pScrn, ASTRecPtr pAST);
|
||||
|
||||
/* Prototype type declaration*/
|
||||
Bool ASTSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
|
||||
Bool bGetAST1000VGAModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo);
|
||||
void vSetStdReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo);
|
||||
void vSetCRTCReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo);
|
||||
void vSetOffsetReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo);
|
||||
void vSetDCLKReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo);
|
||||
void vSetExtReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo);
|
||||
Bool bSetDACReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo);
|
||||
|
||||
Bool
|
||||
ASTSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
|
||||
{
|
||||
ASTRecPtr pAST;
|
||||
VBIOS_MODE_INFO vgamodeinfo;
|
||||
|
||||
pAST = ASTPTR(pScrn);
|
||||
|
||||
vASTOpenKey(pScrn);
|
||||
bASTRegInit(pScrn);
|
||||
|
||||
/* pre set mode */
|
||||
bGetAST1000VGAModeInfo(pScrn, mode, &vgamodeinfo);
|
||||
|
||||
/* set mode */
|
||||
vSetStdReg(pScrn, mode, &vgamodeinfo);
|
||||
vSetCRTCReg(pScrn, mode, &vgamodeinfo);
|
||||
vSetOffsetReg(pScrn, mode, &vgamodeinfo);
|
||||
vSetDCLKReg(pScrn, mode, &vgamodeinfo);
|
||||
vSetExtReg(pScrn, mode, &vgamodeinfo);
|
||||
bSetDACReg(pScrn, mode, &vgamodeinfo);
|
||||
|
||||
/* post set mode */
|
||||
#ifdef Accel_2D
|
||||
if (!pAST->noAccel) {
|
||||
if (!bEnable2D(pScrn, pAST)) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"Enable 2D failed\n");
|
||||
pAST->noAccel = TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef HWC
|
||||
if (!pAST->noHWC) {
|
||||
if (!bInitHWC(pScrn, pAST)) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"Init HWC failed\n");
|
||||
pAST->noHWC = TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
vAST1000DisplayOn(pAST);
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
Bool bGetAST1000VGAModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo)
|
||||
{
|
||||
ASTRecPtr pAST;
|
||||
ULONG ulModeID, ulColorIndex, ulRefreshRate, ulRefreshRateIndex = 0;
|
||||
ULONG ulHBorder, ulVBorder;
|
||||
|
||||
pAST = ASTPTR(pScrn);
|
||||
|
||||
switch (pScrn->bitsPerPixel)
|
||||
{
|
||||
case 8:
|
||||
pVGAModeInfo->pStdTableEntry = (PVBIOS_STDTABLE_STRUCT) &StdTable[VGAModeIndex];
|
||||
ulColorIndex = VGAModeIndex-1;
|
||||
break;
|
||||
case 16:
|
||||
pVGAModeInfo->pStdTableEntry = (PVBIOS_STDTABLE_STRUCT) &StdTable[HiCModeIndex];
|
||||
ulColorIndex = HiCModeIndex-1;
|
||||
break;
|
||||
case 24:
|
||||
case 32:
|
||||
pVGAModeInfo->pStdTableEntry = (PVBIOS_STDTABLE_STRUCT) &StdTable[TrueCModeIndex];
|
||||
ulColorIndex = TrueCModeIndex-1;
|
||||
break;
|
||||
default:
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
switch (mode->CrtcHDisplay)
|
||||
{
|
||||
case 640:
|
||||
pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res640x480Table[ulRefreshRateIndex];
|
||||
break;
|
||||
case 800:
|
||||
pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res800x600Table[ulRefreshRateIndex];
|
||||
break;
|
||||
case 1024:
|
||||
pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1024x768Table[ulRefreshRateIndex];
|
||||
break;
|
||||
case 1280:
|
||||
pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1280x1024Table[ulRefreshRateIndex];
|
||||
break;
|
||||
case 1600:
|
||||
pVGAModeInfo->pEnhTableEntry = (PVBIOS_ENHTABLE_STRUCT) &Res1600x1200Table[ulRefreshRateIndex];
|
||||
break;
|
||||
default:
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
/* Get Proper Mode Index */
|
||||
ulRefreshRate = (mode->Clock * 1000) / (mode->HTotal * mode->VTotal);
|
||||
|
||||
while (pVGAModeInfo->pEnhTableEntry->ulRefreshRate < ulRefreshRate)
|
||||
{
|
||||
pVGAModeInfo->pEnhTableEntry++;
|
||||
if ((pVGAModeInfo->pEnhTableEntry->ulRefreshRate > ulRefreshRate) ||
|
||||
(pVGAModeInfo->pEnhTableEntry->ulRefreshRate == 0xFF))
|
||||
{
|
||||
pVGAModeInfo->pEnhTableEntry--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Update mode CRTC info */
|
||||
ulHBorder = (pVGAModeInfo->pEnhTableEntry->Flags & HBorder) ? 1:0;
|
||||
ulVBorder = (pVGAModeInfo->pEnhTableEntry->Flags & VBorder) ? 1:0;
|
||||
|
||||
mode->CrtcHTotal = (int) pVGAModeInfo->pEnhTableEntry->HT;
|
||||
mode->CrtcHBlankStart = (int) (pVGAModeInfo->pEnhTableEntry->HDE + ulHBorder);
|
||||
mode->CrtcHBlankEnd = (int) (pVGAModeInfo->pEnhTableEntry->HT - ulHBorder);
|
||||
mode->CrtcHSyncStart = (int) (pVGAModeInfo->pEnhTableEntry->HDE + ulHBorder
|
||||
+ pVGAModeInfo->pEnhTableEntry->HFP);
|
||||
mode->CrtcHSyncEnd = (int) (pVGAModeInfo->pEnhTableEntry->HDE + ulHBorder
|
||||
+ pVGAModeInfo->pEnhTableEntry->HFP
|
||||
+ pVGAModeInfo->pEnhTableEntry->HSYNC);
|
||||
|
||||
mode->CrtcVTotal = (int) pVGAModeInfo->pEnhTableEntry->VT;
|
||||
mode->CrtcVBlankStart = (int) (pVGAModeInfo->pEnhTableEntry->VDE + ulVBorder);
|
||||
mode->CrtcVBlankEnd = (int) (pVGAModeInfo->pEnhTableEntry->VT - ulVBorder);
|
||||
mode->CrtcVSyncStart = (int) (pVGAModeInfo->pEnhTableEntry->VDE + ulVBorder
|
||||
+ pVGAModeInfo->pEnhTableEntry->VFP);
|
||||
mode->CrtcVSyncEnd = (int) (pVGAModeInfo->pEnhTableEntry->VDE + ulVBorder
|
||||
+ pVGAModeInfo->pEnhTableEntry->VFP
|
||||
+ pVGAModeInfo->pEnhTableEntry->VSYNC);
|
||||
|
||||
/* Write mode info to scratch */
|
||||
ulRefreshRateIndex = pVGAModeInfo->pEnhTableEntry->ulRefreshRateIndex;
|
||||
ulModeID = pVGAModeInfo->pEnhTableEntry->ulModeID;
|
||||
|
||||
SetIndexReg(CRTC_PORT, 0x8C, (UCHAR) ((ulColorIndex & 0x0F) << 4));
|
||||
SetIndexReg(CRTC_PORT, 0x8D, (UCHAR) (ulRefreshRateIndex & 0xFF));
|
||||
SetIndexReg(CRTC_PORT, 0x8E, (UCHAR) (ulModeID & 0xFF));
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
void vSetStdReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo)
|
||||
{
|
||||
|
||||
PVBIOS_STDTABLE_STRUCT pStdModePtr;
|
||||
ASTRecPtr pAST;
|
||||
ULONG i;
|
||||
UCHAR jReg;
|
||||
|
||||
pStdModePtr = pVGAModeInfo->pStdTableEntry;
|
||||
pAST = ASTPTR(pScrn);
|
||||
|
||||
/* Set Misc */
|
||||
jReg = pStdModePtr->MISC;
|
||||
SetReg(MISC_PORT_WRITE,jReg);
|
||||
|
||||
/* Set Seq */
|
||||
SetIndexReg(SEQ_PORT,0x00, 0x03);
|
||||
for (i=0; i<4; i++)
|
||||
{
|
||||
jReg = pStdModePtr->SEQ[i];
|
||||
if (!i) (jReg |= 0x20); /* display off */
|
||||
SetIndexReg(SEQ_PORT,(UCHAR) (i+1), jReg);
|
||||
}
|
||||
|
||||
/* Set CRTC */
|
||||
SetIndexRegMask(CRTC_PORT,0x11, 0x7F, 0x00);
|
||||
for (i=0; i<25; i++)
|
||||
{
|
||||
jReg = pStdModePtr->CRTC[i];
|
||||
SetIndexReg(CRTC_PORT,(UCHAR) i, jReg);
|
||||
}
|
||||
|
||||
/* Set AR */
|
||||
jReg = GetReg(INPUT_STATUS1_READ);
|
||||
for (i=0; i<20; i++)
|
||||
{
|
||||
jReg = pStdModePtr->AR[i];
|
||||
SetReg(AR_PORT_WRITE, (UCHAR) i);
|
||||
SetReg(AR_PORT_WRITE, jReg);
|
||||
}
|
||||
SetReg(AR_PORT_WRITE, 0x14);
|
||||
SetReg(AR_PORT_WRITE, 0x00);
|
||||
|
||||
jReg = GetReg(INPUT_STATUS1_READ);
|
||||
SetReg (AR_PORT_WRITE, 0x20); /* set POS */
|
||||
|
||||
/* Set GR */
|
||||
for (i=0; i<9; i++)
|
||||
{
|
||||
SetIndexReg(GR_PORT,(UCHAR) i, jReg);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
vSetCRTCReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo)
|
||||
{
|
||||
ASTRecPtr pAST;
|
||||
USHORT usTemp;
|
||||
UCHAR jReg05, jReg07, jReg09, jRegAC, jRegAD, jRegAE;
|
||||
|
||||
pAST = ASTPTR(pScrn);
|
||||
jReg05 = jReg07 = jReg09 = jRegAC = jRegAD = jRegAE = 0;
|
||||
|
||||
/* unlock CRTC */
|
||||
SetIndexRegMask(CRTC_PORT,0x11, 0x7F, 0x00);
|
||||
|
||||
/* Horizontal Timing Programming */
|
||||
usTemp = (mode->CrtcHTotal >> 3) - 5;
|
||||
if (usTemp & 0x100) jRegAC |= 0x01; /* HT D[8] */
|
||||
SetIndexRegMask(CRTC_PORT,0x00, 0x00, (UCHAR) usTemp);
|
||||
usTemp = (mode->CrtcHDisplay >> 3) - 1;
|
||||
if (usTemp & 0x100) jRegAC |= 0x04; /* HDE D[8] */
|
||||
SetIndexRegMask(CRTC_PORT,0x01, 0x00, (UCHAR) usTemp);
|
||||
usTemp = (mode->CrtcHBlankStart >> 3) - 1;
|
||||
if (usTemp & 0x100) jRegAC |= 0x10; /* HBS D[8] */
|
||||
SetIndexRegMask(CRTC_PORT,0x02, 0x00, (UCHAR) usTemp);
|
||||
usTemp = ((mode->CrtcHBlankEnd >> 3) - 1) & 0x7F;
|
||||
if (usTemp & 0x20) jReg05 |= 0x80; /* HBE D[5] */
|
||||
if (usTemp & 0x40) jRegAD |= 0x01; /* HBE D[6] */
|
||||
SetIndexRegMask(CRTC_PORT,0x03, 0xE0, (UCHAR) (usTemp & 0x1F));
|
||||
usTemp = (mode->CrtcHSyncStart >> 3 );
|
||||
if (usTemp & 0x100) jRegAC |= 0x40; /* HRS D[5] */
|
||||
SetIndexRegMask(CRTC_PORT,0x04, 0x00, (UCHAR) (usTemp));
|
||||
usTemp = (mode->CrtcHSyncEnd >> 3 ) & 0x3F;
|
||||
if (usTemp & 0x20) jRegAD |= 0x04; /* HRE D[5] */
|
||||
SetIndexRegMask(CRTC_PORT,0x05, 0x60, (UCHAR) ((usTemp & 0x1F) | jReg05));
|
||||
|
||||
SetIndexRegMask(CRTC_PORT,0xAC, 0x00, (UCHAR) jRegAC);
|
||||
SetIndexRegMask(CRTC_PORT,0xAD, 0x00, (UCHAR) jRegAD);
|
||||
|
||||
/* Vetical Timing Programming */
|
||||
usTemp = (mode->CrtcVTotal) - 2;
|
||||
if (usTemp & 0x100) jReg07 |= 0x01; /* VT D[8] */
|
||||
if (usTemp & 0x200) jReg07 |= 0x20;
|
||||
if (usTemp & 0x400) jRegAE |= 0x01; /* VT D[10] */
|
||||
SetIndexRegMask(CRTC_PORT,0x06, 0x00, (UCHAR) usTemp);
|
||||
usTemp = (mode->CrtcVSyncStart) - 1;
|
||||
if (usTemp & 0x100) jReg07 |= 0x04; /* VRS D[8] */
|
||||
if (usTemp & 0x200) jReg07 |= 0x80; /* VRS D[9] */
|
||||
if (usTemp & 0x400) jRegAE |= 0x08; /* VRS D[10] */
|
||||
SetIndexRegMask(CRTC_PORT,0x10, 0x00, (UCHAR) usTemp);
|
||||
usTemp = ((mode->CrtcVSyncEnd) - 1) & 0x3F;
|
||||
if (usTemp & 0x10) jRegAE |= 0x20; /* VRE D[4] */
|
||||
if (usTemp & 0x20) jRegAE |= 0x40; /* VRE D[5] */
|
||||
SetIndexRegMask(CRTC_PORT,0x11, 0x70, (UCHAR) (usTemp & 0x0F));
|
||||
usTemp = (mode->CrtcVDisplay) - 1;
|
||||
if (usTemp & 0x100) jReg07 |= 0x02; /* VDE D[8] */
|
||||
if (usTemp & 0x200) jReg07 |= 0x40; /* VDE D[9] */
|
||||
if (usTemp & 0x400) jRegAE |= 0x02; /* VDE D[10] */
|
||||
SetIndexRegMask(CRTC_PORT,0x12, 0x00, (UCHAR) usTemp);
|
||||
usTemp = (mode->CrtcVBlankStart) - 1;
|
||||
if (usTemp & 0x100) jReg07 |= 0x08; /* VBS D[8] */
|
||||
if (usTemp & 0x200) jReg09 |= 0x20; /* VBS D[9] */
|
||||
if (usTemp & 0x400) jRegAE |= 0x04; /* VBS D[10] */
|
||||
SetIndexRegMask(CRTC_PORT,0x15, 0x00, (UCHAR) usTemp);
|
||||
usTemp = (mode->CrtcVBlankEnd) - 1 ;
|
||||
if (usTemp & 0x100) jRegAE |= 0x10; /* VBE D[8] */
|
||||
SetIndexRegMask(CRTC_PORT,0x16, 0x00, (UCHAR) usTemp);
|
||||
|
||||
SetIndexRegMask(CRTC_PORT,0x07, 0x00, (UCHAR) jReg07);
|
||||
SetIndexRegMask(CRTC_PORT,0x09, 0xDF, (UCHAR) jReg09);
|
||||
SetIndexRegMask(CRTC_PORT,0xAE, 0x00, (UCHAR) (jRegAE | 0x80)); /* disable line compare */
|
||||
|
||||
/* lock CRTC */
|
||||
SetIndexRegMask(CRTC_PORT,0x11, 0x7F, 0x80);
|
||||
|
||||
}
|
||||
|
||||
void vSetOffsetReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo)
|
||||
{
|
||||
ASTRecPtr pAST;
|
||||
USHORT usOffset;
|
||||
|
||||
pAST = ASTPTR(pScrn);
|
||||
|
||||
usOffset = pAST->VideoModeInfo.ScreenPitch >> 3; /* Unit: char */
|
||||
|
||||
SetIndexReg(CRTC_PORT,0x13, (UCHAR) (usOffset & 0xFF));
|
||||
SetIndexReg(CRTC_PORT,0xB0, (UCHAR) ((usOffset >> 8) & 0x3F));
|
||||
|
||||
}
|
||||
|
||||
void vSetDCLKReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo)
|
||||
{
|
||||
PVBIOS_ENHTABLE_STRUCT pEnhModePtr;
|
||||
PVBIOS_DCLK_INFO pDCLKPtr;
|
||||
ASTRecPtr pAST;
|
||||
|
||||
pAST = ASTPTR(pScrn);
|
||||
|
||||
pEnhModePtr = pVGAModeInfo->pEnhTableEntry;
|
||||
pDCLKPtr = &DCLKTable[pEnhModePtr->DCLKIndex];
|
||||
|
||||
SetIndexRegMask(CRTC_PORT,0xC0, 0x00, pDCLKPtr->Param1);
|
||||
SetIndexRegMask(CRTC_PORT,0xC1, 0x00, pDCLKPtr->Param2);
|
||||
SetIndexRegMask(CRTC_PORT,0xBB, 0xCF, ((pDCLKPtr->Param3 & 0x03) << 4));
|
||||
|
||||
}
|
||||
|
||||
|
||||
void vSetExtReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo)
|
||||
{
|
||||
|
||||
ASTRecPtr pAST;
|
||||
UCHAR jRegA0, jRegA3, jRegA8;
|
||||
|
||||
pAST = ASTPTR(pScrn);
|
||||
|
||||
jRegA0=jRegA3=jRegA8=0;
|
||||
/* Mode Type Setting */
|
||||
switch (pScrn->bitsPerPixel) {
|
||||
case 8:
|
||||
jRegA0 = 0x70;
|
||||
jRegA3 = 0x01;
|
||||
jRegA8 = 0x00;
|
||||
break;
|
||||
case 15:
|
||||
case 16:
|
||||
jRegA0 = 0x70;
|
||||
jRegA3 = 0x04;
|
||||
jRegA8 = 0x02;
|
||||
break;
|
||||
case 32:
|
||||
jRegA0 = 0x70;
|
||||
jRegA3 = 0x08;
|
||||
jRegA8 = 0x02;
|
||||
break;
|
||||
}
|
||||
SetIndexRegMask(CRTC_PORT,0xA0, 0x8F, (UCHAR) jRegA0);
|
||||
SetIndexRegMask(CRTC_PORT,0xA3, 0xF0, (UCHAR) jRegA3);
|
||||
SetIndexRegMask(CRTC_PORT,0xA8, 0xFD, (UCHAR) jRegA8);
|
||||
|
||||
/* Set Threshold */
|
||||
SetIndexReg(CRTC_PORT,0xA7, 0x2F);
|
||||
SetIndexReg(CRTC_PORT,0xA6, 0x1F);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Bool bSetDACReg(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIOS_MODE_INFO pVGAModeInfo)
|
||||
{
|
||||
PVBIOS_DAC_INFO pDACPtr;
|
||||
ASTRecPtr pAST;
|
||||
ULONG i, ulDACNumber;
|
||||
UCHAR DACR, DACG, DACB;
|
||||
|
||||
pAST = ASTPTR(pScrn);
|
||||
|
||||
switch (pScrn->bitsPerPixel)
|
||||
{
|
||||
case 8:
|
||||
ulDACNumber = DAC_NUM_VGA;
|
||||
pDACPtr = (PVBIOS_DAC_INFO) &DAC_VGA[0];
|
||||
break;
|
||||
default:
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
for (i=0; i<ulDACNumber; i++)
|
||||
{
|
||||
DACR = pDACPtr->DACR;
|
||||
DACG = pDACPtr->DACG;
|
||||
DACB = pDACPtr->DACB;
|
||||
|
||||
VGA_LOAD_PALETTE_INDEX (i, DACR, DACG, DACB);
|
||||
|
||||
pDACPtr++;
|
||||
}
|
||||
|
||||
return (TRUE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
115
src/ast_mode.h
Normal file
115
src/ast_mode.h
Normal file
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Copyright (c) 2005 ASPEED Technology Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of the authors not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. The authors makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as is" without express or implied warranty.
|
||||
*
|
||||
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* Mode Limitation */
|
||||
#define MAX_HResolution 1600
|
||||
#define MAX_VResolution 1200
|
||||
|
||||
/* Std. Table Index Definition */
|
||||
#define TextModeIndex 0
|
||||
#define EGAModeIndex 1
|
||||
#define VGAModeIndex 2
|
||||
#define HiCModeIndex 3
|
||||
#define TrueCModeIndex 4
|
||||
|
||||
/* DCLK Index */
|
||||
#define VCLK25_175 0x00
|
||||
#define VCLK28_322 0x01
|
||||
#define VCLK31_5 0x02
|
||||
#define VCLK36 0x03
|
||||
#define VCLK40 0x04
|
||||
#define VCLK49_5 0x05
|
||||
#define VCLK50 0x06
|
||||
#define VCLK56_25 0x07
|
||||
#define VCLK65 0x08
|
||||
#define VCLK75 0x09
|
||||
#define VCLK78_75 0x0A
|
||||
#define VCLK94_5 0x0B
|
||||
#define VCLK108 0x0C
|
||||
#define VCLK135 0x0D
|
||||
#define VCLK157_5 0x0E
|
||||
#define VCLK162 0x0F
|
||||
|
||||
/* Flags Definition */
|
||||
#define Charx8Dot 0x00000001
|
||||
#define HalfDCLK 0x00000002
|
||||
#define DoubleScanMode 0x00000004
|
||||
#define LineCompareOff 0x00000008
|
||||
#define SyncPP 0x00000000
|
||||
#define SyncPN 0x00000040
|
||||
#define SyncNP 0x00000080
|
||||
#define SyncNN 0x000000C0
|
||||
#define HBorder 0x00000020
|
||||
#define VBorder 0x00000010
|
||||
|
||||
/* DAC Definition */
|
||||
#define DAC_NUM_TEXT 64
|
||||
#define DAC_NUM_EGA 64
|
||||
#define DAC_NUM_VGA 256
|
||||
|
||||
/* Data Structure decalration for internal use */
|
||||
typedef struct {
|
||||
|
||||
UCHAR MISC;
|
||||
UCHAR SEQ[4];
|
||||
UCHAR CRTC[25];
|
||||
UCHAR AR[20];
|
||||
UCHAR GR[9];
|
||||
|
||||
} VBIOS_STDTABLE_STRUCT, *PVBIOS_STDTABLE_STRUCT;
|
||||
|
||||
typedef struct {
|
||||
|
||||
ULONG HT;
|
||||
ULONG HDE;
|
||||
ULONG HFP;
|
||||
ULONG HSYNC;
|
||||
ULONG VT;
|
||||
ULONG VDE;
|
||||
ULONG VFP;
|
||||
ULONG VSYNC;
|
||||
ULONG DCLKIndex;
|
||||
ULONG Flags;
|
||||
|
||||
ULONG ulRefreshRate;
|
||||
ULONG ulRefreshRateIndex;
|
||||
ULONG ulModeID;
|
||||
|
||||
} VBIOS_ENHTABLE_STRUCT, *PVBIOS_ENHTABLE_STRUCT;
|
||||
|
||||
typedef struct {
|
||||
UCHAR Param1;
|
||||
UCHAR Param2;
|
||||
UCHAR Param3;
|
||||
} VBIOS_DCLK_INFO, *PVBIOS_DCLK_INFO;
|
||||
|
||||
typedef struct {
|
||||
UCHAR DACR;
|
||||
UCHAR DACG;
|
||||
UCHAR DACB;
|
||||
} VBIOS_DAC_INFO, *PVBIOS_DAC_INFO;
|
||||
|
||||
typedef struct {
|
||||
PVBIOS_STDTABLE_STRUCT pStdTableEntry;
|
||||
PVBIOS_ENHTABLE_STRUCT pEnhTableEntry;
|
||||
|
||||
} VBIOS_MODE_INFO, *PVBIOS_MODE_INFO;
|
||||
124
src/ast_tool.c
Normal file
124
src/ast_tool.c
Normal file
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Copyright (c) 2005 ASPEED Technology Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of the authors not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. The authors makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as is" without express or implied warranty.
|
||||
*
|
||||
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "xf86.h"
|
||||
#include "xf86_ansic.h"
|
||||
#include "xf86_OSproc.h"
|
||||
#include "xf86Resources.h"
|
||||
#include "xf86RAC.h"
|
||||
#include "xf86cmap.h"
|
||||
#include "compiler.h"
|
||||
#include "mibstore.h"
|
||||
#include "vgaHW.h"
|
||||
#include "mipointer.h"
|
||||
#include "micmap.h"
|
||||
|
||||
#include "fb.h"
|
||||
#include "regionstr.h"
|
||||
#include "xf86xv.h"
|
||||
#include "Xv.h"
|
||||
#include "vbe.h"
|
||||
|
||||
#include "xf86PciInfo.h"
|
||||
#include "xf86Pci.h"
|
||||
|
||||
/* framebuffer offscreen manager */
|
||||
#include "xf86fbman.h"
|
||||
|
||||
/* include xaa includes */
|
||||
#include "xaa.h"
|
||||
#include "xaarop.h"
|
||||
|
||||
/* H/W cursor support */
|
||||
#include "xf86Cursor.h"
|
||||
|
||||
/* Driver specific headers */
|
||||
#include "ast.h"
|
||||
|
||||
/* Prototype type declaration*/
|
||||
Bool ASTMapMem(ScrnInfoPtr pScrn);
|
||||
Bool ASTUnmapMem(ScrnInfoPtr pScrn);
|
||||
Bool ASTMapMMIO(ScrnInfoPtr pScrn);
|
||||
void ASTUnmapMMIO(ScrnInfoPtr pScrn);
|
||||
|
||||
Bool
|
||||
ASTMapMem(ScrnInfoPtr pScrn)
|
||||
{
|
||||
ASTRecPtr pAST = ASTPTR(pScrn);
|
||||
|
||||
|
||||
pAST->FBVirtualAddr = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
|
||||
pAST->PciTag,
|
||||
pAST->FBPhysAddr, pAST->FbMapSize);
|
||||
|
||||
if (!pAST->FBVirtualAddr)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
ASTUnmapMem(ScrnInfoPtr pScrn)
|
||||
{
|
||||
ASTRecPtr pAST = ASTPTR(pScrn);
|
||||
|
||||
xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pAST->FBVirtualAddr,
|
||||
pAST->FbMapSize);
|
||||
|
||||
pAST->FBVirtualAddr = 0;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
ASTMapMMIO(ScrnInfoPtr pScrn)
|
||||
{
|
||||
int mmioFlags;
|
||||
ASTRecPtr pAST = ASTPTR(pScrn);
|
||||
|
||||
#if !defined(__alpha__)
|
||||
mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT;
|
||||
#else
|
||||
mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT | VIDMEM_SPARSE;
|
||||
#endif
|
||||
|
||||
pAST->MMIOVirtualAddr = xf86MapPciMem(pScrn->scrnIndex, mmioFlags,
|
||||
pAST->PciTag,
|
||||
pAST->MMIOPhysAddr, pAST->MMIOMapSize);
|
||||
if (!pAST->MMIOVirtualAddr)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
ASTUnmapMMIO(ScrnInfoPtr pScrn)
|
||||
{
|
||||
ASTRecPtr pAST = ASTPTR(pScrn);
|
||||
|
||||
xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pAST->MMIOVirtualAddr,
|
||||
pAST->MMIOMapSize);
|
||||
pAST->MMIOVirtualAddr = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
240
src/ast_vgatool.c
Normal file
240
src/ast_vgatool.c
Normal file
@@ -0,0 +1,240 @@
|
||||
/*
|
||||
* Copyright (c) 2005 ASPEED Technology Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of the authors not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. The authors makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as is" without express or implied warranty.
|
||||
*
|
||||
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "xf86.h"
|
||||
#include "xf86_ansic.h"
|
||||
#include "xf86_OSproc.h"
|
||||
#include "xf86Resources.h"
|
||||
#include "xf86RAC.h"
|
||||
#include "xf86cmap.h"
|
||||
#include "compiler.h"
|
||||
#include "mibstore.h"
|
||||
#include "vgaHW.h"
|
||||
#include "mipointer.h"
|
||||
#include "micmap.h"
|
||||
|
||||
#include "fb.h"
|
||||
#include "regionstr.h"
|
||||
#include "xf86xv.h"
|
||||
#include "Xv.h"
|
||||
#include "vbe.h"
|
||||
|
||||
#include "xf86PciInfo.h"
|
||||
#include "xf86Pci.h"
|
||||
|
||||
/* framebuffer offscreen manager */
|
||||
#include "xf86fbman.h"
|
||||
|
||||
/* include xaa includes */
|
||||
#include "xaa.h"
|
||||
#include "xaarop.h"
|
||||
|
||||
/* H/W cursor support */
|
||||
#include "xf86Cursor.h"
|
||||
|
||||
/* Driver specific headers */
|
||||
#include "ast.h"
|
||||
|
||||
/* Prototype type declaration*/
|
||||
void vASTOpenKey(ScrnInfoPtr pScrn);
|
||||
Bool bASTRegInit(ScrnInfoPtr pScrn);
|
||||
ULONG GetVRAMInfo(ScrnInfoPtr pScrn);
|
||||
void vAST1000DisplayOn(ASTRecPtr pAST);
|
||||
void vAST1000DisplayOff(ASTRecPtr pAST);
|
||||
void vSetStartAddressCRT1(ASTRecPtr pAST, ULONG base);
|
||||
void vASTLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual);
|
||||
void ASTDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
|
||||
|
||||
void
|
||||
vASTOpenKey(ScrnInfoPtr pScrn)
|
||||
{
|
||||
ASTRecPtr pAST = ASTPTR(pScrn);
|
||||
|
||||
SetIndexReg(CRTC_PORT,0x80, 0xA8);
|
||||
|
||||
}
|
||||
|
||||
Bool
|
||||
bASTRegInit(ScrnInfoPtr pScrn)
|
||||
{
|
||||
ASTRecPtr pAST = ASTPTR(pScrn);
|
||||
|
||||
/* Enable MMIO */
|
||||
SetIndexRegMask(CRTC_PORT,0xA1, 0xFF, 0x04);
|
||||
|
||||
return (TRUE);
|
||||
|
||||
}
|
||||
|
||||
ULONG
|
||||
GetVRAMInfo(ScrnInfoPtr pScrn)
|
||||
{
|
||||
ASTRecPtr pAST = ASTPTR(pScrn);
|
||||
UCHAR jReg;
|
||||
|
||||
GetIndexRegMask(CRTC_PORT, 0xAA, 0xFF, jReg);
|
||||
|
||||
switch (jReg & 0x03)
|
||||
{
|
||||
case 0x00:
|
||||
return (VIDEOMEM_SIZE_08M);
|
||||
case 0x01:
|
||||
return (VIDEOMEM_SIZE_16M);
|
||||
case 0x02:
|
||||
return (VIDEOMEM_SIZE_32M);
|
||||
case 0x03:
|
||||
return (VIDEOMEM_SIZE_64M);
|
||||
}
|
||||
|
||||
return (DEFAULT_VIDEOMEM_SIZE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
vSetStartAddressCRT1(ASTRecPtr pAST, ULONG base)
|
||||
{
|
||||
SetIndexReg(CRTC_PORT,0x0D, (UCHAR) (base & 0xFF));
|
||||
SetIndexReg(CRTC_PORT,0x0C, (UCHAR) ((base >> 8) & 0xFF));
|
||||
SetIndexReg(CRTC_PORT,0xAF, (UCHAR) ((base >> 16) & 0xFF));
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
vAST1000DisplayOff(ASTRecPtr pAST)
|
||||
{
|
||||
SetIndexRegMask(SEQ_PORT,0x01, 0xDF, 0x20);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
vAST1000DisplayOn(ASTRecPtr pAST)
|
||||
{
|
||||
|
||||
SetIndexRegMask(SEQ_PORT,0x01, 0xDF, 0x00);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
vASTLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
|
||||
VisualPtr pVisual)
|
||||
{
|
||||
|
||||
ASTRecPtr pAST = ASTPTR(pScrn);
|
||||
int i, j, index;
|
||||
UCHAR DACIndex, DACR, DACG, DACB;
|
||||
|
||||
switch (pScrn->bitsPerPixel) {
|
||||
case 15:
|
||||
for(i=0; i<numColors; i++) {
|
||||
index = indices[i];
|
||||
for(j=0; j<8; j++) {
|
||||
DACIndex = (index * 8) + j;
|
||||
DACR = colors[index].red << (8- pScrn->rgbBits);
|
||||
DACG = colors[index].green << (8- pScrn->rgbBits);
|
||||
DACB = colors[index].blue << (8- pScrn->rgbBits);
|
||||
|
||||
VGA_LOAD_PALETTE_INDEX (DACIndex, DACR, DACG, DACB);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 16:
|
||||
for(i=0; i<numColors; i++) {
|
||||
index = indices[i];
|
||||
for(j=0; j<4; j++) {
|
||||
DACIndex = (index * 4) + j;
|
||||
DACR = colors[index/2].red << (8- pScrn->rgbBits);
|
||||
DACG = colors[index].green << (8- pScrn->rgbBits);
|
||||
DACB = colors[index/2].blue << (8- pScrn->rgbBits);
|
||||
|
||||
VGA_LOAD_PALETTE_INDEX (DACIndex, DACR, DACG, DACB);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 24:
|
||||
for(i=0; i<numColors; i++) {
|
||||
index = indices[i];
|
||||
DACIndex = index;
|
||||
DACR = colors[index].red;
|
||||
DACG = colors[index].green;
|
||||
DACB = colors[index].blue;
|
||||
|
||||
VGA_LOAD_PALETTE_INDEX (DACIndex, DACR, DACG, DACB);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
for(i=0; i<numColors; i++) {
|
||||
index = indices[i];
|
||||
DACIndex = index;
|
||||
DACR = colors[index].red >> (8 - pScrn->rgbBits);
|
||||
DACG = colors[index].green >> (8 - pScrn->rgbBits);
|
||||
DACB = colors[index].blue >> (8 - pScrn->rgbBits);
|
||||
|
||||
VGA_LOAD_PALETTE_INDEX (DACIndex, DACR, DACG, DACB);
|
||||
}
|
||||
|
||||
} /* end of switch */
|
||||
|
||||
} /* end of vASTLoadPalette */
|
||||
|
||||
void
|
||||
ASTDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags)
|
||||
{
|
||||
ASTRecPtr pAST;
|
||||
UCHAR SEQ01, CRB6;
|
||||
|
||||
pAST = ASTPTR(pScrn);
|
||||
SEQ01=CRB6=0;
|
||||
|
||||
switch (PowerManagementMode) {
|
||||
case DPMSModeOn:
|
||||
/* Screen: On; HSync: On, VSync: On */
|
||||
SEQ01 = 0x00;
|
||||
CRB6 = 0x00;
|
||||
break;
|
||||
case DPMSModeStandby:
|
||||
/* Screen: Off; HSync: Off, VSync: On */
|
||||
SEQ01 = 0x20;
|
||||
CRB6 = 0x01;
|
||||
break;
|
||||
case DPMSModeSuspend:
|
||||
/* Screen: Off; HSync: On, VSync: Off */
|
||||
SEQ01 = 0x20;
|
||||
CRB6 = 0x02;
|
||||
break;
|
||||
case DPMSModeOff:
|
||||
/* Screen: Off; HSync: Off, VSync: Off */
|
||||
SEQ01 = 0x20;
|
||||
CRB6 = 0x03;
|
||||
break;
|
||||
}
|
||||
|
||||
SetIndexRegMask(SEQ_PORT,0x01, 0xDF, SEQ01);
|
||||
SetIndexRegMask(CRTC_PORT,0xB6, 0xFC, CRB6);
|
||||
|
||||
|
||||
}
|
||||
70
src/ast_vgatool.h
Normal file
70
src/ast_vgatool.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) 2005 ASPEED Technology Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of the authors not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. The authors makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as is" without express or implied warranty.
|
||||
*
|
||||
* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* VRAM Size Definition */
|
||||
#define VIDEOMEM_SIZE_08M 0x00800000
|
||||
#define VIDEOMEM_SIZE_16M 0x01000000
|
||||
#define VIDEOMEM_SIZE_32M 0x02000000
|
||||
#define VIDEOMEM_SIZE_64M 0x04000000
|
||||
|
||||
#define AR_PORT_WRITE (pAST->RelocateIO + 0x40)
|
||||
#define MISC_PORT_WRITE (pAST->RelocateIO + 0x42)
|
||||
#define SEQ_PORT (pAST->RelocateIO + 0x44)
|
||||
#define DAC_INDEX_WRITE (pAST->RelocateIO + 0x48)
|
||||
#define DAC_DATA (pAST->RelocateIO + 0x49)
|
||||
#define GR_PORT (pAST->RelocateIO + 0x4E)
|
||||
#define CRTC_PORT (pAST->RelocateIO + 0x54)
|
||||
#define INPUT_STATUS1_READ (pAST->RelocateIO + 0x5A)
|
||||
|
||||
#define GetReg(base) inb(base)
|
||||
#define SetReg(base,val) outb(base,val)
|
||||
#define GetIndexReg(base,index,val) do { \
|
||||
outb(base,index); \
|
||||
val = inb(base+1); \
|
||||
} while (0)
|
||||
#define SetIndexReg(base,index, val) do { \
|
||||
outb(base,index); \
|
||||
outb(base+1,val); \
|
||||
} while (0)
|
||||
#define GetIndexRegMask(base,index, and, val) do { \
|
||||
outb(base,index); \
|
||||
val = (inb(base+1) & and); \
|
||||
} while (0)
|
||||
#define SetIndexRegMask(base,index, and, val) do { \
|
||||
UCHAR __Temp; \
|
||||
outb(base,index); \
|
||||
__Temp = (inb((base)+1)&(and))|(val); \
|
||||
SetIndexReg(base,index,__Temp); \
|
||||
} while (0)
|
||||
|
||||
#define VGA_LOAD_PALETTE_INDEX(index, red, green, blue) \
|
||||
{ \
|
||||
UCHAR __junk; \
|
||||
SetReg(DAC_INDEX_WRITE,(UCHAR)(index)); \
|
||||
__junk = GetReg(SEQ_PORT); \
|
||||
SetReg(DAC_DATA,(UCHAR)(red)); \
|
||||
__junk = GetReg(SEQ_PORT); \
|
||||
SetReg(DAC_DATA,(UCHAR)(green)); \
|
||||
__junk = GetReg(SEQ_PORT); \
|
||||
SetReg(DAC_DATA,(UCHAR)(blue)); \
|
||||
__junk = GetReg(SEQ_PORT); \
|
||||
}
|
||||
Reference in New Issue
Block a user