亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? surf.cpp

?? WinCE 3.0 BSP, 包含Inter SA1110, Intel_815E, Advantech_PCM9574 等
?? CPP
字號:
/*
 * $Workfile: SURF.CPP $
 * $Revision: 6 $
 * $Date: 4/07/00 8:52a $
 * $Modtime: 4/07/00 8:35a $
 * $Author: Sarma $
 *
 * Copyright (c) 1998 National Semiconductor Corporation.
 * All Rights Reserved.
 *
 * This software is the confidential and proprietary information of National 
 * Semiconductor Corporation. ("Confidential Information").
 * You shall not disclose such Confidential Information and shall use it only
 * in accordance with the terms of the license agreement you entered into
 * with National Semiconductor Corporation.
 * This code is supplied as is.
 *
 */

/*
 *$Log: /CE/Platform/Nsc/Drivers/Video/gxvideo/base/SURF.CPP $
 * 
 * 6     4/07/00 8:52a Sarma
 * Removed Cyrix Corporation from the legal/confidentail information.
 * 
 * 5     4/06/00 10:36a Hari
 * Removed Debug messages.
 * 
 * 4     3/29/00 9:29a Sarma
 * Added special READ/WRITE macros to be used by Directdraw functions. Two
 * new Alloc functions added for directdraw , AllocSurface and
 * AllocOverlaySurface. The new Gxvideo constructor is also for the
 * directdraw interface.
 * 
 * 3     12/01/98 1:08p Sarma
 * Added few debug statements and also set the pNode to 0 once the memory
 * is freed.
 * 
 * 2     11/12/98 3:14p Sarma
 * Added Confidential copyright to files with VSS keywords for
 * log/history.
 *$History: SURF.CPP $
 * 
 * *****************  Version 6  *****************
 * User: Sarma        Date: 4/07/00    Time: 8:52a
 * Updated in $/CE/Platform/Nsc/Drivers/Video/gxvideo/base
 * Removed Cyrix Corporation from the legal/confidentail information.
 * 
 * *****************  Version 5  *****************
 * User: Hari         Date: 4/06/00    Time: 10:36a
 * Updated in $/CE/Platform/Nsc/Drivers/Video/gxvideo/base
 * Removed Debug messages.
 * 
 * *****************  Version 4  *****************
 * User: Sarma        Date: 3/29/00    Time: 9:29a
 * Updated in $/CE/Platform/Nsc/Drivers/Video/gxvideo/base
 * Added special READ/WRITE macros to be used by Directdraw functions. Two
 * new Alloc functions added for directdraw , AllocSurface and
 * AllocOverlaySurface. The new Gxvideo constructor is also for the
 * directdraw interface.
 * 
 * *****************  Version 3  *****************
 * User: Sarma        Date: 12/01/98   Time: 1:08p
 * Updated in $/wince/v2.1/gxvideo
 * Added few debug statements and also set the pNode to 0 once the memory
 * is freed.
 * 
 * *****************  Version 2  *****************
 * User: Sarma        Date: 11/12/98   Time: 3:14p
 * Updated in $/wince/v2.1/gxvideo
 * Added Confidential copyright to files with VSS keywords for
 * log/history.
*/

#include "precomp.h"


/////////////////////////////////////////////////////////////////////////////////////
SCODE GxVideo::AllocSurface(
	GPESurf **ppSurf,
	int width,
	int height,
	EGPEFormat format,
	int surfaceFlags )
{
	if( ( surfaceFlags & GPE_REQUIRE_VIDEO_MEMORY ) ||
		( format == m_pMode->format ) &&
		( surfaceFlags & GPE_PREFER_VIDEO_MEMORY ) )
	{
		if( !( format == m_pMode->format ) )
			return E_INVALIDARG;

		DEBUGMSG(0,(TEXT("AllocSurface %d %d %d, avail = %d\n"), 
		width, height,EGPEFormatToBpp[format], m_p2DVideoMemory->AvailSpace()));

	// Attempt to allocate from video memory
		Node2D *pNode = m_p2DVideoMemory->Alloc( width, height );
		if( pNode )
		{
			unsigned long offset = m_nScreenStride * pNode->Top() +
				( pNode->Left() * EGPEFormatToBpp[format] ) / 8 ;
			DEBUGMSG(0,(TEXT("AllocSurface %d %d, %d\n"), 
				pNode->Left(), pNode->Top(), offset));
			*ppSurf = new GxVideoSurf(
				width,
				height,
				offset,
				m_pLAW + offset,
				m_nScreenStride,
				format,
				pNode );
			DEBUGMSG(0,(TEXT("%d %d\n"), (*ppSurf)->Buffer(), (*ppSurf)->Stride()));
			if( !(*ppSurf) )
			{
				pNode->Free();
				pNode = 0;
				return E_OUTOFMEMORY;
			}
			return S_OK;
		}
		if( surfaceFlags & GPE_REQUIRE_VIDEO_MEMORY )
		{
			*ppSurf = (GPESurf *)NULL;
			return E_OUTOFMEMORY;
		}
	}
	// Allocate from system memory
	DEBUGMSG(0,(TEXT("Creating a GPESurf in system memory. EGPEFormat = %d\r\n"), (int)format ));
	*ppSurf = new GPESurf( width, height, format );
	if( *ppSurf )
	{
		// check we allocated bits succesfully
		if( !((*ppSurf)->Buffer()) )
			delete *ppSurf;	// and then return E_OUTOFMEMORY
		else
			return S_OK;
	}
	return E_OUTOFMEMORY;
}


#ifdef DD_SUPPORT
   
SCODE GxVideo::AllocSurface(
	DDGPESurf **ppSurf,
	int width,
	int height,
	EGPEFormat format,
    EDDGPEPixelFormat pixelFormat,
	int surfaceFlags )
{
	if( ( surfaceFlags & GPE_REQUIRE_VIDEO_MEMORY ) ||
		( format == m_pMode->format ) &&
		( surfaceFlags & GPE_PREFER_VIDEO_MEMORY ) )
	{
		if( !( format == m_pMode->format ) )
			return E_INVALIDARG;

		DEBUGMSG(0,(TEXT("AllocSurface %d %d %d, avail = %d\n"), 
		width, height,EGPEFormatToBpp[format], m_p2DVideoMemory->AvailSpace()));

	// Attempt to allocate from video memory
		Node2D *pNode = m_p2DVideoMemory->Alloc( width, height );
		if( pNode )
		{
			unsigned long offset = m_nScreenStride * pNode->Top() +
				( pNode->Left() * EGPEFormatToBpp[format] ) / 8 ;
			DEBUGMSG(0,(TEXT("AllocSurface %d %d, %d\n"), 
				pNode->Left(), pNode->Top(), offset));
			*ppSurf = new GxVideoSurf(
				width,
				height,
				offset,
				m_pLAW + offset,
				m_nScreenStride,
				format,
                pixelFormat,
				pNode );
			DEBUGMSG(0,(TEXT("%d %d\n"), (*ppSurf)->Buffer(), (*ppSurf)->Stride()));
			if( !(*ppSurf) )
			{
				pNode->Free();
				pNode = 0;
				return E_OUTOFMEMORY;
			}
			return S_OK;
		}
		if( surfaceFlags & GPE_REQUIRE_VIDEO_MEMORY )
		{
			*ppSurf = (DDGPESurf *)NULL;
			return E_OUTOFMEMORY;
		}
	}
	// Allocate from system memory
	DEBUGMSG(0,(TEXT("Creating a GPESurf in system memory. EGPEFormat = %d\r\n"), (int)format ));
	*ppSurf = new DDGPESurf( width, height, format );
	if( *ppSurf )
	{
		// check we allocated bits succesfully
		if( !((*ppSurf)->Buffer()) )
			delete *ppSurf;	// and then return E_OUTOFMEMORY
		else
			return S_OK;
	}
	return E_OUTOFMEMORY;
}
   

SCODE GxVideo::AllocOverlaySurface(
	DDGPESurf **ppSurf,
	int width,
	int height,
	EGPEFormat format,
    EDDGPEPixelFormat pixelFormat,
	int surfaceFlags )
{

	
    Node2D *pNode;
    int AllocHeight;
    int StridePixels;
	int PixelShift;

    if (!(surfaceFlags & GPE_REQUIRE_VIDEO_MEMORY)) {
        return E_INVALIDARG;
    }

	
    switch (pixelFormat) {
    case ddgpePixelFormat_565:
    case ddgpePixelFormat_YUYV422:
    case ddgpePixelFormat_UYVY422:

	
	
        if (format == gpe16Bpp)
			PixelShift = 1;
		else
			PixelShift = 0;

		StridePixels = (m_nScreenStride >> PixelShift);
        AllocHeight = ((width * height) + StridePixels - 1) / StridePixels;
	
		pNode = m_p2DVideoMemory->Alloc( StridePixels, AllocHeight );
	
		if( pNode )
		{
			unsigned long offset = m_nScreenStride * pNode->Top() +
				( pNode->Left() * EGPEFormatToBpp[format] ) / 8 ;
			DEBUGMSG(0,(TEXT("AllocSurface %d %d, %d\n"), 
				pNode->Left(), pNode->Top(), offset));
			*ppSurf = new GxVideoSurf(
				width,
				height,
				offset,
				m_pLAW + offset,
				width * (EGPEFormatToBpp[format] / 8),
				format,
                pixelFormat,
				pNode );
			DEBUGMSG(0,(TEXT("%d %d\n"), (*ppSurf)->Buffer(), (*ppSurf)->Stride()));
			if( !(*ppSurf) )
			{
				pNode->Free();
				pNode = 0;
				return E_OUTOFMEMORY;
			}
			return S_OK;
		}
        DEBUGMSG(0, (TEXT("Node2d returned NULL!\r\n")));

        return E_OUTOFMEMORY;

    default:
        break;    
    }

    return E_INVALIDARG;
	
	
/*	if( ( surfaceFlags & GPE_REQUIRE_VIDEO_MEMORY ) ||
		( format == m_pMode->format ) &&
		( surfaceFlags & GPE_PREFER_VIDEO_MEMORY ) )
	{
		if( !( format == m_pMode->format ) )
			return E_INVALIDARG;

		DEBUGMSG(0,(TEXT("AllocOverlaySurface %d %d %d, avail = %d\n"), 
		width, height,EGPEFormatToBpp[format], m_p2DVideoMemory->AvailSpace()));

	// Attempt to allocate from video memory
		Node2D *pNode = m_p2DVideoMemory->Alloc( width, height );
		if( pNode )
		{
			unsigned long offset = m_nScreenStride * pNode->Top() +
				( pNode->Left() * EGPEFormatToBpp[format] ) / 8 ;
			DEBUGMSG(0,(TEXT("AllocSurface %d %d, %d\n"), 
				pNode->Left(), pNode->Top(), offset));
			*ppSurf = new GxVideoSurf(
				width,
				height,
				offset,
				m_pLAW + offset,
				m_nScreenStride,
				format,
                pixelFormat,
				pNode );
			DEBUGMSG(0,(TEXT("%d %d\n"), (*ppSurf)->Buffer(), (*ppSurf)->Stride()));
			if( !(*ppSurf) )
			{
				pNode->Free();
				pNode = 0;
				return E_OUTOFMEMORY;
			}
			return S_OK;
		}
		if( surfaceFlags & GPE_REQUIRE_VIDEO_MEMORY )
		{
			*ppSurf = (DDGPESurf *)NULL;
			return E_OUTOFMEMORY;
		}
	}
	// Allocate from system memory
	DEBUGMSG(1,(TEXT("Creating a GPESurf in system memory. EGPEFormat = %d\r\n"), (int)format ));
	*ppSurf = new DDGPESurf( width, height, format );
	if( *ppSurf )
	{
		// check we allocated bits succesfully
		if( !((*ppSurf)->Buffer()) )
			delete *ppSurf;	// and then return E_OUTOFMEMORY
		else
			return S_OK;
	}
	return E_OUTOFMEMORY;
*/
}

#endif //DD_SUPPORT

GxVideoSurf::GxVideoSurf(
	int width,
	int height,
	unsigned long offset,
	void *pBits,            // virtual address of allocated bits
	int stride,
	EGPEFormat format,
	Node2D *pNode )
#ifdef DD_SUPPORT
	: DDGPESurf( width, height, pBits, stride, format )
#else
	: GPESurf( width, height, pBits, stride, format )
#endif //DD_SUPPORT
{
	m_pNode2D = pNode;
	m_fInVideoMemory = TRUE;
	m_nOffsetInVideoMemory = offset;
} 


#ifdef DD_SUPPORT
GxVideoSurf::GxVideoSurf(
	int width,
	int height,
	unsigned long offset,
	void *pBits,            // virtual address of allocated bits
	int stride,
	EGPEFormat format,
    EDDGPEPixelFormat pixelFormat,
	Node2D *pNode )
	: DDGPESurf( width, height, pBits, stride, format, pixelFormat )
{
	m_pNode2D = pNode;
	m_fInVideoMemory = TRUE;
	m_nOffsetInVideoMemory = offset;
} 
#endif //DD_SUPPORT


GxVideoSurf::~GxVideoSurf()
{
	DEBUGMSG(0,(TEXT("~GxVideoSurf %d %d\n"), m_pNode2D->Left(), m_pNode2D->Top()));
	m_pNode2D->Free();
	m_pNode2D = 0; //NULL it
}


void GxVideo::CheckVisibleSurface()
{
	unsigned long tickCount = GetTickCount();
	if( tickCount - m_nTicksAtFlip > m_nTicksPerFrame + 1 )
	{
		m_pOldVisibleSurface = m_pNewVisibleSurface;
		return;
	}
	unsigned int phase = ( tickCount - m_nTicksAtResync ) % m_nTicksPerFrame;
	unsigned int flipPhase = ( m_nTicksAtFlip - m_nTicksAtResync ) % m_nTicksPerFrame;
	if( (phase >= m_nTicksPerFrame * 7 / 8) ||	// near end of frame, may as well wait
		( tickCount - m_nTicksAtResync > m_nTicksPerFrame * 20 ) || // overdue for resync
		( tickCount < m_nTicksAtFlip ) ||	// Time went backwards
		( m_nTicksAtFlip < m_nTicksAtResync ) )	// Time went backwards
	{
		//WaitForVBlank();
		return;
	}
	if( phase < flipPhase )
	{
		m_pOldVisibleSurface = m_pNewVisibleSurface;
		return;
	}
	DEBUGMSG( 0, 
		( TEXT("Not flipped. Ticks at flip:%d, now %d, "),
		m_nTicksAtFlip,
		tickCount ) );
	DEBUGMSG( 0, 
		( TEXT("per frame %d resync %d\r\n"),
		m_nTicksPerFrame,
		m_nTicksAtResync ) );

}

int GxVideo::SurfaceBusyFlipping( GxVideoSurf *pSurf )
{
	if( pSurf == m_pOldVisibleSurface || pSurf == m_pNewVisibleSurface )
		CheckVisibleSurface();
	
	return ( pSurf == m_pOldVisibleSurface || pSurf == m_pNewVisibleSurface );
}

int GxVideo::FlipInProgress()
{
	if( m_pOldVisibleSurface != m_pNewVisibleSurface )
		CheckVisibleSurface();
	else
		return 0;

	if( m_pOldVisibleSurface != m_pNewVisibleSurface )
	{
		DEBUGMSG( 0, ( TEXT("Flip from surf 0x%08x to 0x%08x in progress\r\n"),
			m_pOldVisibleSurface, m_pNewVisibleSurface ));
	}
	
	return ( m_pOldVisibleSurface != m_pNewVisibleSurface );
}

#if DEBUG
int tickCountValid = 0;
unsigned int lastTickCount;
int frameCount = 0;
#endif

void GxVideo::SetVisibleSurface( GPESurf *pTempSurf )
{
    GxVideoSurf *pSurf = (GxVideoSurf *) pTempSurf;
	int displayStart = pSurf->Stride() * pSurf->Top();
	m_pNewVisibleSurface = pSurf;

	Unlock();
	DEBUGMSG(0,(TEXT("displayStart = 0x%08x\r\n"),displayStart));
	WRITE_REG32(GXregisters, DC_FB_ST_OFFSET, displayStart);
	Lock();

	m_nTicksAtFlip = GetTickCount();
#if DEBUG
	if( tickCountValid )
	{
		frameCount++;
		if( m_nTicksAtFlip - lastTickCount > 10000 )
		{
			int framesPerTenSecs = frameCount * 10000 / ( m_nTicksAtFlip - lastTickCount );
			if( framesPerTenSecs < 2000 )
			{
				DEBUGMSG( 0, (TEXT("Frames per second: %d.%1d\r\n"),
					framesPerTenSecs/10, framesPerTenSecs%10 ));
			}
			lastTickCount = m_nTicksAtFlip;
			frameCount = 0;
		}
	}
	else
	{
		tickCountValid = 1;
		lastTickCount = m_nTicksAtFlip;
		frameCount = 0;
	}
#endif
}

void
GxVideo::SetVisibleSurface(GPESurf *pSurf, BOOL bWaitForVBlank) {

	DEBUGMSG(0,(TEXT("SET VISIBLE SURFACE 2\r\n")));
	if (bWaitForVBlank) {
		while (InVBlank()) {}
		while (!InVBlank()) {}
	}
    SetVisibleSurface(pSurf);
}

void GxVideo::VBlankReceived()
{
	m_nTicksAtFlip = m_nTicksAtResync = GetTickCount();
	m_pOldVisibleSurface = m_pNewVisibleSurface;
}


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人av在线观| 久久久久国产精品人| 欧美午夜理伦三级在线观看| 欧美色视频一区| 久久久高清一区二区三区| 亚洲乱码国产乱码精品精98午夜 | 久久综合色综合88| 亚洲精品中文在线观看| 久久66热偷产精品| 色嗨嗨av一区二区三区| 国产喂奶挤奶一区二区三区| 亚洲精品免费看| 国产精品69毛片高清亚洲| 欧美日韩电影在线播放| 国产精品久久网站| 麻豆成人综合网| 成人av资源在线观看| 91精品国产高清一区二区三区 | 一区在线中文字幕| 久久精品免费观看| 欧美三级日韩在线| 国产精品乱人伦中文| 久久精品国产亚洲高清剧情介绍 | 亚洲福利视频三区| 色先锋久久av资源部| 亚洲情趣在线观看| 一本一道波多野结衣一区二区| 色综合久久中文综合久久97| 97久久精品人人爽人人爽蜜臀| 欧美狂野另类xxxxoooo| 国产精品国产精品国产专区不片| 国产乱子轮精品视频| 精品国产91久久久久久久妲己| 日本不卡视频在线观看| 欧美男男青年gay1069videost| 亚洲综合免费观看高清完整版在线| 午夜精品福利在线| 久久久.com| 日韩一区二区免费电影| 日本韩国精品在线| 粉嫩高潮美女一区二区三区| 蜜臀av一区二区在线免费观看| 综合久久给合久久狠狠狠97色 | 1000精品久久久久久久久| 555夜色666亚洲国产免| 91在线观看视频| 国产一区激情在线| 美女视频一区二区| 亚洲成a人v欧美综合天堂下载| 亚洲国产激情av| 欧美成人aa大片| 7777女厕盗摄久久久| 色女孩综合影院| 国产东北露脸精品视频| 久久97超碰色| 男女男精品网站| 日韩综合在线视频| 一区二区三区精品视频在线| 国产精品午夜在线观看| 国产日韩欧美精品综合| 精品免费日韩av| 91精品国产综合久久国产大片| 91免费版pro下载短视频| 成人三级伦理片| 粉嫩蜜臀av国产精品网站| 国产精品自产自拍| 国产老女人精品毛片久久| 极品尤物av久久免费看| 裸体在线国模精品偷拍| 日韩av中文字幕一区二区 | 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 26uuu亚洲| 久久久美女艺术照精彩视频福利播放| 欧美一级高清片| 日韩欧美高清在线| 精品国产污网站| 久久久久久久综合色一本| 久久久精品免费观看| 国产喂奶挤奶一区二区三区| 久久人人爽人人爽| 欧美国产成人精品| 亚洲天堂免费在线观看视频| 日韩理论电影院| 亚洲午夜日本在线观看| 性欧美大战久久久久久久久| 日本美女视频一区二区| 久久99精品久久久久久| 粉嫩一区二区三区在线看| 成人福利电影精品一区二区在线观看| 国产91精品一区二区麻豆亚洲| 国产.欧美.日韩| 日本二三区不卡| 91精品国产一区二区三区| 日韩欧美国产一区二区在线播放| 久久人人97超碰com| 国产精品高潮呻吟| 亚洲一区二区三区在线看| 欧美aa在线视频| 国产精品亚洲专一区二区三区| 国产传媒久久文化传媒| 91麻豆6部合集magnet| 欧美一区二区三区日韩| 久久久精品免费观看| 亚洲蜜臀av乱码久久精品| 免费在线观看不卡| 成人av资源在线| 欧美蜜桃一区二区三区| 久久久国产一区二区三区四区小说 | 亚洲美女在线一区| 国产一区二区三区视频在线播放| 丁香婷婷综合色啪| 欧美日韩国产大片| 国产精品午夜久久| 亚洲va韩国va欧美va| 国模大尺度一区二区三区| 91片在线免费观看| 日韩一级黄色大片| 亚洲情趣在线观看| 国产专区欧美精品| 欧亚洲嫩模精品一区三区| 久久久精品国产99久久精品芒果| 亚洲一级片在线观看| 国产精品1区2区| 欧美精三区欧美精三区| 国产精品久久久久久久久免费丝袜| 午夜久久福利影院| av中文字幕在线不卡| 日韩欧美中文字幕公布| 一区二区三区四区中文字幕| 国产精品亚洲午夜一区二区三区 | 欧美xxxxx牲另类人与| 一区二区三区在线视频免费 | 精品久久一二三区| 亚洲国产色一区| 99视频一区二区三区| 2欧美一区二区三区在线观看视频| 亚洲欧洲中文日韩久久av乱码| 激情综合色播激情啊| 欧美日韩国产另类不卡| 日韩码欧中文字| 成人av在线影院| 久久久久久久综合色一本| 视频一区二区三区中文字幕| 色嗨嗨av一区二区三区| 亚洲欧洲99久久| 成人午夜激情在线| 国产欧美精品一区二区色综合| 久久不见久久见免费视频1| 欧美色视频在线| 亚洲午夜在线视频| 一本大道av伊人久久综合| 中文欧美字幕免费| 国产精选一区二区三区| 精品国产sm最大网站免费看| 日韩电影在线免费看| 欧美日韩国产精品自在自线| 亚洲图片欧美一区| 欧美日韩aaa| 亚洲18影院在线观看| 欧美色综合影院| 香蕉久久夜色精品国产使用方法| 色香色香欲天天天影视综合网| 国产精品成人免费| 91在线国产观看| 亚洲免费视频成人| 欧美视频在线一区| 日韩激情av在线| 欧美一级一区二区| 成人国产视频在线观看| 欧美韩日一区二区三区四区| 粉嫩一区二区三区在线看| 国产精品久久久久精k8 | 日韩一级片在线播放| 日韩国产欧美三级| 欧美成人bangbros| 国产精品亚洲一区二区三区妖精 | 亚洲最大成人综合| 欧美日韩视频在线观看一区二区三区| 亚洲夂夂婷婷色拍ww47| 欧美精品一二三四| 精品一区精品二区高清| 欧美国产激情一区二区三区蜜月| 成人动漫中文字幕| 亚洲综合色自拍一区| 欧美一区二区久久| 国产精品一卡二卡在线观看| 国产精品福利av| 欧美中文字幕一区| 蜜臀av在线播放一区二区三区| 久久综合久久99| 成a人片国产精品| 亚洲国产欧美日韩另类综合| 91精品国产色综合久久ai换脸| 国产乱子轮精品视频| 亚洲女与黑人做爰| 日韩三级电影网址| yourporn久久国产精品| 亚洲国产wwwccc36天堂| 久久婷婷国产综合国色天香| 91丨porny丨蝌蚪视频|