📄 mqgc.h
字号:
#ifndef __MQGC_H__
#define __MQGC_H__
#include "mqhw2.h"
#include "mqstruc.h"
#include "mqtables.h"
#ifdef SUPPORT_ROTATE
#include <rotate.h>
#endif // SUPPORT_ROTATE
#define GC1 1
#define GC2 2
class MQGCSurf;
//MediaQ Graphics Controller (MQGC) classs derived from MS GPE (Graphics
//Primitive Engine).
class MQGC : public DDGPE
{
private:
//#if DDHAL
public: // temporarily moved - will fix later
//#endif
UCHAR *m_pMMIO; //Memory Mapped IO range
UCHAR *m_pLAW; //Linear access window
#ifdef MIPS_TOS
UCHAR *m_pTXRegBase;
#endif
ULONG m_ulScreenStride; //Stride of 2d memory in bytes
ULONG m_ulBPP; //Color depth
ULONG m_ulRop3; //Color depth
ULONG m_ulBPPSelect;
ULONG m_ulSolidColor;
ULONG m_ulBPPShift;
ULONG m_ulScratchTopLeft;
ULONG m_ulDestXY;
ULONG m_ulWidthHeight;
#ifdef GE_OPTIMIZE_1
ULONG *m_pGeSrcImageData; //Ptr to SRC_IMAGE_DATA reg
ULONG *m_pGeColorPattern; //Ptr to COLOR_PATTERN reg
ULONG *m_pGeReg; //Ptr to first GE reg (DRAW_CMD)
#endif //GE_OPTIMIZE_1
ULONG m_ulDestStride;
float m_fPLLs[3];
PULONG m_lpPattern;
LPVOID m_pScratchBuffer;
PULONG m_pLookup;
GPESurf *m_pBrush;
MQGCSurf *m_pSrc;
EGPEFormat m_eFormat;
void (MQGC::*m_pPatternSetup)(GPEBltParms *, ULONG *);
// emul lib
// SCODE FastEmulatedBlt(GPEBltParms *pBltParms);
// SCODE EmulatedBltText16(GPEBltParms *pBltParms);
// SCODE EmulatedBltSrcCopy16(GPEBltParms *pBltParms);
// SCODE EmulatedBltFill16(GPEBltParms *pBltParms);
//Declarations from mqtables.h
DECLARE_BLT_TABLES
DECLARE_LINE_TABLES
DECLARE_PATSETUP_TABLES
Node2D *m_p2DVideoMemory; //Base entry representing all video mem
int m_nVideoMemorySize; //Size in bytes of video RAM total
int m_nMMIOMemorySize; //Size in bytes of MMIO space
int m_nBytesPerPixel; //Bytes per pixel (1:8bpp,2:16bpp etc.)
ULONG m_nScreenSize; //Desktop screen memory size
int m_nXHot; //Hot spot X for cursor
int m_nYHot; //Hot spot Y for cursor
#ifdef CHECK_PERF
UINT m_nTicksAtFlip; //TickCount at time flip was requested
UINT m_nTicksAtResync; //TickCount when last waited for VBlank
UINT m_nTicksPerFrame; //E.g. 17 for 60 Hz frames, 1mS ticks
MQGCSurf *m_pOldVisibleSurface; //Visible surface before flip
MQGCSurf *m_pNewVisibleSurface; //Visible surface after flip
#endif //CHECK_PERF
unsigned long m_nLAWPhysical; // FB Physical Address
unsigned long m_nIOPhysical; // MMIO Physical Address
POEM_INFO m_pOEMInfo; //Pointer to OEM INFO
PMQ_VIDEO_MODE m_pMQMode; //Pointer to active MQ video mode
PFP_CONTROL_STRUC m_pFPControl; //Pointer to active FP structure
PMQ_TIMING_PARAM m_pCRTTiming; //Pointer to timing for CRT
CURSOR_DATA_STRUC CursorData; // Cursor data
ULONG m_nDSTNFBControl; //DSTN frame buffer control
ULONG m_nDSTNFBSize; //DSTN frame buffer size
ULONG m_nCursorStart; //Cursor start addr (KB)
ULONG m_nContrast; //Current contrast level
ULONG m_nMQFlag; //Flag for misc defines
ULONG m_nIW1StartAddr; //Starting addr for IW1
ULONG m_nIW2StartAddr; //Starting addr for IW2
ULONG m_nGammaRGB[256]; //Gamma mapping table
USHORT m_nCursorColor; //Cursor color
USHORT m_nActualWidth; //Actual Screen Width
USHORT m_nActualHeight; //Actual Screen Height
#ifdef SUPPORT_ROTATE
ADDRESS m_pPool; //pointer to a pool of free space
int m_nRotate; //Rotation flag
ULONG m_ulTopOffset;
#endif //SUPPORT_ROTATE
public:
MQGC(int i); //constructor in config.cpp
MQGC(); //constructor in config.cpp
#ifdef DDIDUMP
~MQGC();
void RestoreMode();
void SaveMode();
#endif //DDIDUMP
virtual SCODE SetMode( int modeNo, HPALETTE *pPalette );
virtual SCODE GetModeInfo( GPEMode *pMode, int modeNo );
virtual int NumModes();
void SetMQMode(void);
void SetMQPLL( float, ULONG, ULONG *, ULONG * );
void DetermineGE( ULONG * );
SCODE AllocMQSurfaces(void);
BOOL HandleGamma(void);
ULONG GetBPPBits(void);
void SetupGCs(USHORT gcuseflag, USHORT orig, USHORT x, USHORT y);
PMQ_TIMING_PARAM GetMQTiming(USHORT x, USHORT y, USHORT freq);
void SetupLCDTiming(USHORT x, USHORT y, USHORT freq,
USHORT flag);
void SetupCRTTiming(USHORT x, USHORT y, USHORT freq,
WORD GC=GC1);
virtual void GetPhysicalVideoMemory(
ULONG *pPhysicalMemoryBase,
ULONG *pVideoMemorySize );
void GetVirtualVideoMemory(
ULONG *pVirtualMemoryBase,
ULONG *pVideoMemorySize );
//Devmap.cpp
virtual int MapPhysicalDevice(void);
//Palette.cpp
virtual SCODE SetPalette(
const PALETTEENTRY *src,
USHORT firstEntry,
USHORT numEntries );
void SetHWPalette(
ULONG *src,
USHORT firstEntry,
USHORT numEntries );
void CreatePal( HPALETTE * );
// Cursor.cpp:
virtual SCODE SetPointerShape(
GPESurf *pMask,
GPESurf *pColorSurf,
int xHot,
int yHot,
int cx,
int cy );
virtual SCODE MovePointer(
int x,
int y );
// Surf.cpp:
virtual SCODE AllocSurface(
GPESurf **ppSurf,
int width,
int height,
EGPEFormat format,
int surfaceFlags );
virtual SCODE AllocSurface(
DDGPESurf **ppSurf,
int width,
int height,
EGPEFormat format,
EDDGPEPixelFormat pixelFormat,
int surfaceFlags );
void CheckVisibleSurface();
virtual int SurfaceBusyFlipping( MQGCSurf *pSurf );
virtual int FlipInProgress();
virtual void SetVisibleSurface( GPESurf *pSurf );
virtual void VBlankReceived(); // Called when VBlank is entered
//Line.cpp:
virtual SCODE Line(
GPELineParms *pLineParms,
EGPEPhase phase );
//Blt.cpp and GE required
virtual SCODE BltPrepare( GPEBltParms *pBltParms );
virtual SCODE BltComplete( GPEBltParms *pBltParms );
#ifdef ENABLE_2D
DEFINE_BLT_FUNCTIONS
DEFINE_LINE_FUNCTIONS
DEFINE_PATSETUP_FUNCTIONS
DEFINE_MISC_FUNCTIONS
#ifdef CHECK_GE_NOTBUSY
void WaitGENotBusy();
#endif //CHECK_GE_NOTBUSY
#ifdef CHECK_CMDFIFO
void WaitCmdFIFO(ULONG count);
#endif //CHECK_CMDFIFO
#ifdef CHECK_SRCFIFO
void WaitSrcFIFO(ULONG count);
void WaitSrcFIFO1(ULONG count);
#endif //CHECK_SRCFIFO
#endif // ENABLE_2D
void HW_LoadLCDTiming(WORD GC, WORD wLCDViewportX,
WORD wLCDViewportY, USHORT flag);
void HW_LoadCRTTiming(WORD GC, WORD wCRTViewportX,
WORD wCRTViewportY, WORD wRefreshRate);
void HW_Enable_LCD(WORD GC);
void HW_Disable_LCD(WORD GC);
void HW_Enable_CRT(WORD GC);
void HW_Disable_CRT(WORD GC);
void PatchMIU(void);
virtual void WaitForNotBusy();
virtual int IsBusy();
virtual int InVBlank();
virtual int InDisplay();
virtual void WaitForVBlank();
virtual ULONG DrvEscape(SURFOBJ *pso, ULONG iEsc,
ULONG cjIn, PVOID pvIn,ULONG cjOut, PVOID pvOut);
//Power.cpp
virtual BOOL ContrastControl(ULONG cmd,ULONG *pValue);
virtual VOID PowerHandler(BOOL bOff);
#ifndef DDIDUMP
// Only required for regular DDI driver
virtual SCODE MovePointer1GC(
int x,
int y,
int flag);
virtual SCODE MovePointerSameImage(
int x,
int y);
#ifdef SUPPORT_LARGE_DESKTOP
virtual SCODE MovePointerLD(
int x,
int y );
#endif
void UpdateCursorVP(int,int,int);
void SetCursorColors(void);
BOOL OemSetBacklight(int level);
BOOL OemSetContrast(int level);
BOOL OemGetEDID(PVOID pvOut);
BOOL OemEnterPowerSave(int level);
BOOL OemSetupAltWin(void);
BOOL OemDisableAltWin(void);
BOOL OemEnterGhostMode(ULONG flag);
BOOL OemLeaveGhostMode(void);
void HW_SET_ORG(BOOL LCD_First);
void SetCursorData(int);
void I2COemOut(ULONG SCL,ULONG SDA);
BOOL I2COemInSDA();
BOOL I2COemCheckSCLHigh();
BOOL DetectMonitor();
#endif // DDIDUMP
#ifdef SUPPORT_ROTATE
BOOL RotateParms(GPEBltParms *pBltParms);
BOOL RotateRectFillParms(GPEBltParms *pBltParms,
ULONG *pOrgXY, ULONG *pWidhtHeight);
BOOL RotateXYPositive(GPEBltParms *pBltParms,
PMQGCBlt_SAVE pSave);
BOOL RotateParmsBack(GPEBltParms *pBltParms);
BOOL RotateRectFillParmsBack(GPEBltParms *pBltParms);
BOOL RotateBrush(GPEBltParms *pBltParms);
BOOL RotateBrushOrg(POINTL *pptlBrush,
POINTL *pptlSaveBrush, GPEBltParms *pBltParms);
BOOL RotateSrc(GPEBltParms *pBltParms);
BOOL RotateMask(GPEBltParms *pBltParms);
ULONG RotateDst(GPEBltParms *pBltParms);
ULONG RotateVramSurf(GPESurf *pSurf, PMQGCSurf_SAVE pSave,
RECTL *pRect, RECTL *pRectSave);
BOOL RotateClipRect(RECTL *pRect, RECTL *pSaveRect,
GPESurf *pSurf);
BOOL RotateRect(RECTL *pRect, RECTL *pSaveRect, GPESurf *pSurf);
BOOL RotateSramSurf(GPESurf *pSurf, PMQGCSurf_SAVE pSave,
RECTL *pRect, RECTL *pRectSave);
BOOL Rotate1Bpp(GPESurf *pSurf, RECTL *pRect,
ADDRESS newVirtAddr, int newStrideBytes );
BOOL Rotate2Bpp(GPESurf *pSurf, RECTL *pRect,
ADDRESS newVirtAddr, int newStrideBytes );
BOOL Rotate4Bpp(GPESurf *pSurf, RECTL *pRect,
ADDRESS newVirtAddr, int newStrideBytes );
BOOL Rotate8Bpp(GPESurf *pSurf, RECTL *pRect,
ADDRESS newVirtAddr, int newStrideBytes );
BOOL Rotate16Bpp(GPESurf *pSurf, RECTL *pRect,
ADDRESS newVirtAddr, int newStrideBytes );
BOOL Rotate24Bpp(GPESurf *pSurf, RECTL *pRect,
ADDRESS newVirtAddr, int newStrideBytes );
BOOL Rotate32Bpp(GPESurf *pSurf, RECTL *pRect,
ADDRESS newVirtAddr, int newStrideBytes );
void RotateCoor(long *x, long *y, GPESurf *pSurf);
void RotateCoor(int *x, int *y);
BOOL RotateLineParms(GPELineParms *pLineParms);
BOOL RotateLineParmsBack(GPELineParms *pLineParms);
BOOL RotateSurfBack(GPESurf *pSurf, PMQGCSurf_SAVE pSave,
RECTL *pRect, RECTL *pRectSave);
BOOL RotatePointerShape(GPESurf *pMask, GPESurf *pColorSurf,
int *pxHot, int *pyHot, int *pcx, int *pcy);
BOOL RotateBackPointerShape(GPESurf *pMask, GPESurf *pColorSurf);
BOOL RotateMonoShape(GPESurf *pMask,GPESurf *pColorSurf,
int newStrideBytes, ADDRESS newVirtAddr,
int cx, int cy);
BOOL ReverseRotate(GPEBltParms *pBltParms);
SCODE MQEmulatedLine(GPELineParms *pLineParms);
SCODE MQEmulatedBlt(GPEBltParms *pBltParms);
SCODE MQEmulatedBltText16(GPEBltParms *pBltParms);
SCODE MQEmulatedBltAlphaText16(GPEBltParms *pBltParms);
ADDRESS MM_AllocMemory(int nBytes);
ADDRESS MM_GetMemory(unsigned long ulSize);
ADDRESS MM_GetMemory(unsigned long ulSize,int resetflag);
BOOL MM_ReturnMemory(ADDRESS pVirtAddr);
#endif // SUPPORT_ROTATE
SCODE CM2SBlt_O( GPEBltParms *pBltParms );
SCODE CM2SBlt16_O( GPEBltParms *pBltParms );
#ifdef ENABLE_2D
virtual ULONG GetGraphicsCaps() {
#ifdef AAFONT_ON
if(m_ulBPP == 16 || m_ulBPP == 32)
{
DEBUGMSG(GPE_ZONE_INIT,(TEXT("GetGraphicsCaps:\r\n")));
return GCAPS_GRAY16;
}
else
#endif
return 0;
}
#endif
#ifdef DEBUG
void PrintSetModeMsg() {};
#endif //DEBUG
friend void buildDDHALInfo(LPDDHALINFO lpddhi, DWORD modeidx);
};
class MQGCSurf : public DDGPESurf
{
private:
Node2D *m_pNode2D;
#ifdef SUPPORT_ROTATE
ADDRESS m_pBVirtAddr;
ULONG m_nBStrideBytes;
int m_nBWidth;
int m_nBHeight;
ULONG m_nBOffsetInVideoMemory;
ULONG m_BackupFlag;
int m_nTop;
int m_nLeft;
#endif //SUPPORT_ROTATE
public:
// video memory surface
MQGCSurf(int width, int height, ULONG offset,
PVOID pBits, int stride, EGPEFormat format,
Node2D *pNode);
// video memory surface
MQGCSurf(int width, int height, ULONG offset,
PVOID pBits, int stride, EGPEFormat format,
EDDGPEPixelFormat pixelFormat,
Node2D *pNode);
virtual ~MQGCSurf();
//Required for blt functions
ULONG m_ulTopLeft;
ULONG m_ulTop;
ULONG m_ulLeft;
#ifdef SUPPORT_ROTATE
MQGCSurf(
int width,
int height,
EGPEFormat format);
int Top() { return m_nTop;}
int Left() { return m_nLeft;}
#else //SUPPORT_ROTATE
int Top() { return m_pNode2D->Top(); }
int Left() { return m_pNode2D->Left(); }
#endif //SUPPORT_ROTATE
#ifdef SUPPORT_ROTATE
void RotateBackup(PMQGCSurf_SAVE pSave);
void RotateRestore(PMQGCSurf_SAVE pSave);
void SetFormat(EGPEFormat format)
{ m_eFormat = format; }
void SetStride(int stride)
{ m_nStrideBytes = stride; }
void SetBuffer(ADDRESS ulBuff)
{ m_pVirtAddr = ulBuff; }
void SetInVRam(int f)
{ m_fInVideoMemory = f; }
void SetOffsetInVM(ULONG ulOffset)
{ m_nOffsetInVideoMemory = ulOffset; }
void SetDimension(int width, int height)
{ m_nWidth = width; m_nHeight = height; }
void SetTopLeft(int top, int left)
{ m_nTop = top; m_nLeft = left;}
#endif //SUPPORT_ROTATE
};
#endif __MQGC_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -