⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 s3c6400_disp.h

📁 Samsung公司S3C6400芯片的BSP源码包
💻 H
字号:
#ifndef __S3C6400_DISP_H__
#define __S3C6400_DISP_H__

class S3C6400Surf;

typedef enum
{
	VB_FRONTPORCH =0,
	VB_VSYNC,
	VB_BACKPORCH
} VB_STATUS;

typedef enum
{
	HWCLK_ALL_ON = 0,		// 2D Clock is not included
	HWCLK_ALL_OFF,		// 2D Clock is not included
	HWCLK_DISPLAY_ON,
	HWCLK_DISPLAY_OFF,
	HWCLK_MSMIF_ON,
	HWCLK_MSMIF_OFF,
	HWCLK_POST_ON,
	HWCLK_POST_OFF,
	HWCLK_TV_ON,
	HWCLK_TV_OFF,
	HWCLK_2D_ON,
	HWCLK_2D_OFF
} HWCLK_GATING;

typedef enum
{
	HWPWR_ALL_ON = 0,		// 2D Power is not included
	HWPWR_ALL_OFF,		// 2D Power is not included
	HWPWR_DISPLAY_ON,
	HWPWR_DISPLAY_OFF,
	HWPWR_POST_ON,
	HWPWR_POST_OFF,
	HWPWR_TV_ON,
	HWPWR_TV_OFF,
	HWPWR_2D_ON,
	HWPWR_2D_OFF
} HWPWR_GATING;

typedef struct _OverlayContext
{
	S3C6400Surf *pSurface;
	unsigned int	uiSrcWidth;
	unsigned int	uiSrcHeight;
	unsigned int	uiSrcOffsetX;
	unsigned int	uiSrcOffsetY;
	unsigned int	uiDstWidth;
	unsigned int	uiDstHeight;
	unsigned int	uiDstOffsetX;
	unsigned int	uiDstOffsetY;
	BOOL		bBlendOn;
	BOOL		bColorKey;	// FALSE means Alpha Blending

	// Color Key Information
	BOOL		bSrcCKey;	// False means DestCKey
	EDDGPEPixelFormat Format;
	DWORD		ColorKey;	// Key Value

	// Alpha Blending Information
	BOOL		bUsePixelBlend;
	DWORD		Alpha;
} OverlayContext;

#ifndef	GETRAWFRAMEBUFFER
#define GETRAWFRAMEBUFFER		0x00020001
#define RAW_FORMAT_565		(1)
#define RAW_FORMAT_555		(2)
#define RAW_FORMAT_OTHER		(3)
typedef struct _RawFrameBufferInfo
{
	WORD	wFormat;
	WORD	wBPP;
	VOID	*pFramePointer;
	int		cxStride;
	int		cyStride;
	int		cxPixels;
	int		cyPixels;
} RawFrameBufferInfo;
#endif

#ifndef DRVESC_G2D_ACCEL
#define DRVESC_G2D_ACCEL		0x00020002
#endif
#ifndef DRVESC_G2D_PROFILE
#define	DRVESC_G2D_PROFILE	0x00020003
#endif
class FIMGSE2D;

class S3C6400Disp : public DDGPE
{

protected:

	volatile S3C6400_DISPLAY_REG	*m_pDispConReg;	// Display Controller SFR
	volatile S3C6400_MSMIF_REG	*m_pMSMIFReg;		// MSM I/F SFR
	volatile S3C6400_SYSCON_REG	*m_pSysConReg;		// Syscon SFR
	volatile S3C6400_GPIO_REG		*m_pGPIOReg;		// GPIO SFR
	volatile S3C6400_SPI_REG		*m_pSPIReg;		// SPI Controller SFR
	volatile S3C6400_POST_REG		*m_pPostReg;		// Post Processor SFR
	volatile S3C6400_TVSC_REG		*m_pTVSCReg;		// TV Scaler SFR
	volatile S3C6400_TVENC_REG	*m_pTVEncReg;		// TV Encoder SFR

	S3C6400Surf		*m_pVisibleSurface;
	GPEModeEx		m_ModeInfoEx;
	FIMGSE2D		*m_oG2D;

	DWORD		m_dwSysIntrDisp;				// LCD VSYNC SysIntr
	DWORD		m_dwSysIntrPost;				// Post Processor SysIntr
	HANDLE		m_hInterruptDisp;
	HANDLE		m_hInterruptPost;
	HANDLE		m_hPowerControl;

	CRITICAL_SECTION	m_csDevice;				// Critical Section for Display Device Control (FIMD/POST/TVSc/TVEnc)

private:

	DWORD		m_dwDeviceScreenWidth;		// LCD Pannel Horizontal Resolution (Pixel Count)
	DWORD		m_dwDeviceScreenHeight;		// LCD Pannel Vertical Resolution (Pixel Count)
	DWORD		m_VideoMemoryPhysicalBase;
	DWORD		m_VideoMemoryVirtualBase;
	DWORD		m_VideoMemorySize;
	UCHAR		m_CursorBackingStore[64*64*4];
	UCHAR		m_CursorXorShape[64*64];
	UCHAR		m_CursorAndShape[64*64];
	BOOL		m_CursorDisabled;
	BOOL		m_CursorVisible;
	BOOL		m_CursorForcedOff;
	RECTL		m_CursorRect;
	POINTL		m_CursorSize;
	POINTL		m_CursorHotspot;
	HANDLE		m_hVideoMemoryMapping;
	SurfaceHeap	*m_pVideoMemoryHeap;		// Video Memory Heap
	VIDEO_POWER_STATE	m_VideoPowerState;

public:

	BOOL		m_InDDraw;
	BOOL		m_bOverlayEnable;
	ULONG_PTR	m_fpCurrentOverlay;
	ULONG_PTR	m_fpPreviousOverlay;
	OverlayContext m_OverlayCtxt;

	S3C6400Disp();

	virtual
	~S3C6400Disp();

	virtual
	int
	NumModes();

	virtual
	SCODE
	SetMode(
		int			modeId,
		HPALETTE	* palette
		);

	virtual
	int
	InDisplay(void);

	virtual
	int
	InVBlank();

	virtual
	SCODE
	SetPalette(
		const PALETTEENTRY *source,
		USHORT		firstEntry,
		USHORT		numEntries
		);

	virtual
	SCODE
	GetModeInfo(
		GPEMode * pMode,
		int       modeNo
		);

	virtual
	SCODE
	GetModeInfoEx(
		GPEModeEx *pModeEx,
		int       modeNo
		);

	virtual
	SCODE
	SetPointerShape(
		GPESurf * mask,
		GPESurf * colorSurface,
		int       xHot,
		int       yHot,
		int       cX,
		int       cY
		);

	virtual
	SCODE
	MovePointer(
		int xPosition,
		int yPosition
		);

	virtual
	void
	WaitForNotBusy();

	virtual
	int
	IsBusy();

	virtual
	void
	GetPhysicalVideoMemory(
		unsigned long * physicalMemoryBase,
		unsigned long * videoMemorySize
		);

	void
	GetVirtualVideoMemory(
		unsigned long * virtualMemoryBase,
		unsigned long * videoMemorySize
		);

	virtual
	SCODE
	Line(
		GPELineParms * lineParameters,
		EGPEPhase      phase
		);

	// blt.cpp
	virtual
	SCODE
		BltPrepare(
		GPEBltParms * blitParameters
		);

	virtual
	SCODE
		BltComplete(
		GPEBltParms * blitParameters
		);

	virtual SCODE AcceleratedBltFill(GPEBltParms *pParms);
	virtual SCODE AcceleratedBltRotate(GPEBltParms *pParms);
	virtual SCODE AcceleratedSrcCopyBlt(GPEBltParms *pBltParms);
	virtual SCODE AcceleratedBltSelect16(GPEBltParms *pBltParms);
	virtual SCODE AcceleratedDestInvert(GPEBltParms *pBltParms);
	virtual SCODE AcceleratedSolidLine(GPELineParms *pLineParms);
	//


	virtual
	ULONG
	DrvEscape(
		SURFOBJ * pso,
		ULONG     iEsc,
		ULONG     cjIn,
		void    * pvIn,
		ULONG     cjOut,
		void    * pvOut
		);

	int
	GetGameXInfo(
		ULONG   iEsc,
		ULONG   cjIn,
		void  * pvIn,
		ULONG   cjOut,
		void  * pvOut
		);

	int
	GetRawFrameBuffer(
		ULONG   iEsc,
		ULONG   cjIn,
		void  * pvIn,
		ULONG   cjOut,
		void  * pvOut
		);

	SCODE
	WrappedEmulatedLine(
		GPELineParms * lineParameters
		);

	void
	CursorOn();

	void
	CursorOff();

	// surf.cpp
	virtual
	SCODE
	AllocSurface(
		GPESurf    ** surface,
		int           width,
		int           height,
		EGPEFormat    format,
		int           surfaceFlags
		);

	virtual
	SCODE
	AllocSurface(
		DDGPESurf         ** ppSurf,
		int                  width,
		int                  height,
		EGPEFormat           format,
		EDDGPEPixelFormat    pixelFormat,
		int                  surfaceFlags
		);

	virtual
	void
	SetVisibleSurface(
		GPESurf * pSurf,
		BOOL      bWaitForVBlank = FALSE
		);

	int
	GetRotateModeFromReg();

	void
	SetRotateParams();

	long
	DynRotate(
		int angle
		);

	//---------------------------
	// Resource Alloc/Release Method
	//---------------------------
	BOOL AllocResource(void);
	void ReleaseResource(void);
	BOOL InitializeInterrupt(void);
	void DeinitInterrupt(void);

	//------------------------
	// Power Management Handler
	//------------------------
	void SetDisplayPowerState(VIDEO_POWER_STATE PowerState);
	VIDEO_POWER_STATE GetDisplayPowerState(void);

	//----------------------------------------
	// S3C6400 H/W Device Control Wrapper Method
	//----------------------------------------
	// Frame Interrupt / Status
	BOOL WaitForVerticalBlank(VB_STATUS Status);
	DWORD GetScanLine(void);

	// Overlay Control
	void OverlayInitialize(S3C6400Surf* pOverlaySurface, RECT *pSrc, RECT *pDest);
	void OverlaySetPosition(UINT32 uiOffsetX, UINT32 uiOffsetY);
	void OverlayEnable();
	void OverlayDisable();
	void OverlayBlendDisable(void);
	void OverlaySetColorKey(BOOL bSrcCKey, EDDGPEPixelFormat Format, DWORD ColorKey);
	void OverlaySetAlpha(BOOL bUsePixelBlend, DWORD Alpha);

	//--------------------------------
	// S3C6400 H/W Device Control Method
	//--------------------------------

	// Initialize / Power Management
	BOOL DevInitialize(void);
	BOOL DevPowerOn(void);
	BOOL DevPowerOff(void);

	// Frame Interrupt / Status
	BOOL DevWaitForVerticalBlank(VB_STATUS Status);
	int DevGetVerticalStatus(void);
	DWORD DevGetScanLine(void);

	// Change Frame Buffer
	void DevSetVisibleSurface(S3C6400Surf *pSurf, BOOL bWaitForVBlank);

	// Overlay Control
	void DevOverlayInitialize(void);
	void DevOverlaySetPosition(void);
	void DevOverlayEnable(void);
	void DevOverlayDisable(void);
	void DevOverlayBlendDisable(void);
	void DevOverlaySetColorKey(void);
	void DevOverlaySetAlpha(void);
	void DevRecoverOverlay(void);
	void DevHWClockGating(HWCLK_GATING eParams);
	void DevHWPowerGating(HWPWR_GATING eParams);

friend
	void
	buildDDHALInfo(
		LPDDHALINFO lpddhi,
		DWORD       modeidx
		);
};

class S3C6400Surf : public DDGPESurf
{
private:
	SurfaceHeap *m_pHeap;
	HANDLE m_hSurface;
	UCHAR *m_pSurface;

public:
	UINT32	m_uiOffsetCb;
	UINT32	m_uiOffsetCr;

	S3C6400Surf(int, int, DWORD, VOID*, int, EGPEFormat, EDDGPEPixelFormat pixelFormat, SurfaceHeap*);

	virtual
	~S3C6400Surf();

	//    VOID* SurfaceAddress() { return m_pSurface; }
	//   VOID  WriteBack();
	//    VOID  Discard();
	//    BOOL  SurfaceOk() { return m_pHeap != NULL || m_pSurface != NULL; }
};

#endif __S3C6400_DISP_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -