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

📄 pvr_pdump.c

📁 Lido PXA270平台开发板的最新BSP,包括源代码
💻 C
📖 第 1 页 / 共 4 页
字号:
				{
					return IMG_FALSE;
				}
				
				psPDContext->ui32PrmPos = ui32Pos;

				/*
					Now write the terminate instruction to the script
				*/
				sprintf(szTmpStr, "WRW :SP:%8.8lX %8.8lX\r\n",
							psPDContext->psPDumpMemMap->sMBX.ui32SPTermStart,
							*pui32Data);
				
				if(!DumpScriptLine(psPDContext, szTmpStr, strlen(szTmpStr), IMG_FALSE))
				{
					return IMG_FALSE;
				}
				break;	
			}
			case PDUMPTAGS_SP_MBX_2D:
			{
				IMG_UINT32	i;

				for(i=0; i<ui32Count; i++)
				{

					sprintf(szTmpStr, "WRW :SP:%8.8lX %8.8lX\r\n",
								psPDContext->psPDumpMemMap->sMBX.ui32SP2DStart,
								*(pui32Data+i));				
					if(!DumpScriptLine(psPDContext, szTmpStr, strlen(szTmpStr), IMG_TRUE))
					{
						return IMG_FALSE;
					}
				}
				break;	
			}
			case PDUMPTAGS_SP_M24VA_CMD:
			{
				IMG_UINT32	i;
				for(i=0; i<ui32Count; i++)
				{

					sprintf(szTmpStr, "WRW :SP:%8.8lX %8.8lX\r\n",
								psPDContext->psPDumpMemMap->sM24VA.ui32SPCMDStart,
								*(pui32Data+i));				
					if(!DumpScriptLine(psPDContext, szTmpStr, strlen(szTmpStr), IMG_TRUE))
					{
						return IMG_FALSE;
					}
				}
				break;
			}
			case PDUMPTAGS_SP_M24VA_IDCT:
			{
				IMG_UINT32	i;
				for(i=0; i<ui32Count; i++)
				{

					sprintf(szTmpStr, "WRW :SP:%8.8lX %8.8lX\r\n",
								psPDContext->psPDumpMemMap->sM24VA.ui32SPIDCTStart,
								*(pui32Data+i));				
					if(!DumpScriptLine(psPDContext, szTmpStr, strlen(szTmpStr), IMG_TRUE))
					{
						return IMG_FALSE;
					}
				}
				break;
			}
			default:
			{
				PVR_DPF((PVR_DBG_ERROR,"PDumpSPBatch: invalid tag"));
				return IMG_FALSE;
			}
		}
	}
	return IMG_TRUE;
}

/***********************************************************************************
 Function Name      : PDumpSlavePort
 Inputs             : hPDContext, ui32SPTag, ui32Data
 Outputs            : -
 Returns            : Success
 Description        : Writes a DWORD to the slaveport
************************************************************************************/

IMG_BOOL PDumpSlavePort(PDUMP_CONTEXT *psPDContext, IMG_UINT32 ui32SPTag, IMG_UINT32 ui32Data)
{
	return PDumpSPBatch(psPDContext, ui32SPTag, &ui32Data, 1);
}

/***********************************************************************************
 Function Name      : PDumpString
 Inputs             : psPDContext, pszString
 Outputs            : -
 Returns            : Success
 Description        : Writes a string to the script file
************************************************************************************/

IMG_BOOL PDumpString(PDUMP_CONTEXT *psPDContext, IMG_CHAR *pszString)
{
	IMG_CHAR	pszTmp[256];
	IMG_UINT32	ui32Frame;
	IMG_BOOL	bIs2DWrite;
	VALIDATE_PDUMP_CONTEXT(psPDContext)

	/*
		If were using the global context directly, then
		this is a 2d write
	*/
	bIs2DWrite		= psPDContext->bGlobalContext;
	ui32Frame		= psPDContext->ui32CurrentFrame;

	sprintf(pszTmp, "%s%s", pszString, "\r\n");

	if(!psPDContext->psPDumpMemMap->bPDumpingOn)
	{
		return IMG_FALSE;
	}

	if(!ui32Frame ||
		((ui32Frame >= psPDContext->ui32StartFrame) &&
		(ui32Frame <= psPDContext->ui32StopFrame) &&
		!(ui32Frame%psPDContext->ui32SkipFrame)))
	{
		if(!DumpScriptLine(psPDContext, pszTmp, strlen(pszTmp), bIs2DWrite))
		{
			return IMG_FALSE;
		}
	}

	return IMG_TRUE;
}

/*****************************************************************************
 FUNCTION	: 	PDumpFormattedString
 PURPOSE	:	
 PARAMETERS	: 	
 RETURNS	: 	
*****************************************************************************/
IMG_BOOL PDumpFormatString(PDUMP_CONTEXT *psPDContext, IMG_CHAR *pszFormat, ...)
{
	IMG_CHAR	pszScript[128];
	IMG_CHAR	pszTmp[128];
	IMG_BOOL	bIs2DWrite;
	va_list		params;
	IMG_UINT32	ui32Frame;

	VALIDATE_PDUMP_CONTEXT(psPDContext)

	/*
		If were using the global context directly, then
		this is a 2d write
	*/
	bIs2DWrite		= psPDContext->bGlobalContext;

	ui32Frame = psPDContext->ui32CurrentFrame;
	sprintf(pszTmp, "%s%s", pszFormat, "\r\n");

	if(!psPDContext->psPDumpMemMap->bPDumpingOn)
	{
		return IMG_FALSE;
	}

	if(!ui32Frame ||
		((ui32Frame >= psPDContext->ui32StartFrame) &&
		(ui32Frame <= psPDContext->ui32StopFrame) &&
		!(ui32Frame%psPDContext->ui32SkipFrame)))
	{
		va_start(params, pszFormat);
		vsprintf(pszScript, pszTmp, params);
		va_end(params);

		if(!DumpScriptLine(psPDContext, pszScript, strlen(pszScript), bIs2DWrite))
		{
			return IMG_FALSE;
		}
	}
	return IMG_TRUE;
}


/*****************************************************************************
 FUNCTION	: PDumpFormattedStringV
    
 PURPOSE	: Special version of PDumpFormattedString that takes an argument vector
			  (pointer to array of args) rather than the usual variable
			  number of arguments

 PARAMETERS	: ptszFormat	- A standard printf-style format string
			  pvArgs	- Pointer to the arguments

 RETURNS	: 	
*****************************************************************************/
IMG_BOOL PDumpFormatStringV(PDUMP_CONTEXT *psPDContext, IMG_CHAR *pszFormat, IMG_PVOID pvArgs)
{
	IMG_CHAR		pszScript[128];
	IMG_CHAR		pszTmp[256];
	IMG_UINT32	ui32Frame;
	IMG_BOOL	bIs2DWrite;

	VALIDATE_PDUMP_CONTEXT(psPDContext)

	/*
		If were using the global context directly, then
		this is a 2d write
	*/
	bIs2DWrite		= psPDContext->bGlobalContext;

	ui32Frame = psPDContext->ui32CurrentFrame;
	sprintf(pszTmp, "%s%s", pszFormat, "\r\n");

	if(!psPDContext->psPDumpMemMap->bPDumpingOn)
	{
		return IMG_FALSE;
	}

	if(!ui32Frame ||
		((ui32Frame >= psPDContext->ui32StartFrame) &&
		(ui32Frame <= psPDContext->ui32StopFrame) &&
		!(ui32Frame%psPDContext->ui32SkipFrame)))
	{
		vsprintf(pszScript, pszTmp, (IMG_CHAR *)pvArgs);
		if(!DumpScriptLine(psPDContext, pszScript, strlen(pszScript), bIs2DWrite))
		{
			return IMG_FALSE;
		}
	}
	return IMG_TRUE;
}


/***********************************************************************************
 Function Name      : PDumpUpdateFrame
 Inputs             : psPDContext
 Outputs            : -
 Returns            : none
 Description        : increments the frame count
************************************************************************************/

IMG_VOID PDumpUpdateFrame (PDUMP_CONTEXT *psPDContext)
{
	IMG_CHAR szTmpStr[128];
	
	VALIDATE_PDUMP_CONTEXT(psPDContext)

	if(!psPDContext->psPDumpMemMap->bPDumpingOn)
	{
		return;
	}

	sprintf(szTmpStr, "-- Frame %d\r\n", psPDContext->ui32CurrentFrame);
	
	DumpScriptLine(psPDContext, szTmpStr, strlen(szTmpStr), IMG_FALSE);
	
	psPDContext->ui32CurrentFrame++;
}


/*****************************************************************************
 FUNCTION	: 	PDumpReg
 PURPOSE	:	
 PARAMETERS	: 	
 RETURNS	: 	
*****************************************************************************/
IMG_BOOL PDumpReg(PDUMP_CONTEXT *psPDContext, IMG_UINT32 ui32RegTag, IMG_UINT32 ui32Addr, IMG_UINT32 ui32Value)
{
	PVRSRV_HWREG	sReg;

	sReg.ui32RegAddr = ui32Addr;
	sReg.ui32RegVal	 = ui32Value;

	return PDumpRegArray(psPDContext, ui32RegTag, &sReg, 1);
}


/***********************************************************************************
 Function Name      : PDumpTex
 Inputs             : psPDContext, psMemInfo
 Outputs            : -
 Returns            : Success
 Description        : Writes a texture to the tex file and a load command to the 
					  script file.
************************************************************************************/

IMG_BOOL PDumpTex(PDUMP_CONTEXT		*psPDContext,
				  PVRSRV_MEM_INFO	*psMemInfo)
{
	IMG_UINT32	ui32Frame;
	IMG_UINT32	ui32Pos;
	IMG_UINT32	ui32Size;
	IMG_CHAR	szTmpStr[256];

	VALIDATE_PDUMP_CONTEXT(psPDContext)

	ui32Frame = psPDContext->ui32CurrentFrame;

	if(!psPDContext->psPDumpMemMap->bPDumpingOn)
	{
		return IMG_FALSE;
	}

	if(!ui32Frame ||
		((ui32Frame >= psPDContext->ui32StartFrame) &&
		(ui32Frame <= psPDContext->ui32StopFrame) &&
		!(ui32Frame%psPDContext->ui32SkipFrame)))
	{

		VALIDATE_PDUMP_FILE(psPDContext->fpTex, psPDContext->szTexFilePath, psPDContext->szTexFileName)

		ui32Pos			= ftell(psPDContext->fpTex);
		ui32Size		= fwrite(psMemInfo->pvLinAddr, psMemInfo->ui32AllocSize, 1, psPDContext->fpTex);

		fflush(psPDContext->fpTex);

		if(!ui32Size)
		{
			return IMG_FALSE;
		}

		sprintf(szTmpStr,"\r\nLDB :FB:%8.8lX %8.8lX %8.8lX %s\r\n", 
			psMemInfo->uiDevAddr, 
			ui32Pos, 
			psMemInfo->ui32AllocSize,
			psPDContext->szTexFileName);
		
		if(!DumpScriptLine(psPDContext, szTmpStr, strlen(szTmpStr), IMG_FALSE))
		{
			return IMG_FALSE;
		}
	}

	return IMG_TRUE;
}

/***********************************************************************************
 Function Name      : PDumpRegisterTex
 Inputs             : psPDContext, psMemInfo
 Outputs            : -
 Returns            : Success
 Description        : Registers a texture with the context 
************************************************************************************/

IMG_BOOL PDumpRegisterTex(PDUMP_CONTEXT		*psPDContext,
						  PVRSRV_MEM_INFO	*psMemInfo)
{
	PVRSRV_PDUMP_TEXTURE	*psTexture;
	PVRSRV_PDUMP_TEXTURE	*psTmp;

	VALIDATE_PDUMP_CONTEXT(psPDContext)

	if(HostAllocMem(PVRSRV_HOST_PAGEABLE_HEAP,
					sizeof(PVRSRV_PDUMP_TEXTURE), 
					&psTexture, 0) != PVRSRV_OK)
	{
		return IMG_FALSE;
	}

	psTexture->psTexMemInfo = psMemInfo;
	psTexture->psNext		= IMG_NULL;

	if(psPDContext->psRegisteredTextures == IMG_NULL)
	{
		psPDContext->psRegisteredTextures = psTexture;
		return IMG_TRUE;
	}

	psTmp = psPDContext->psRegisteredTextures;

	while(psTmp->psNext != IMG_NULL)
	{
		psTmp = psTmp->psNext;
	}

	psTmp->psNext = psTexture;
	return IMG_TRUE;
}

/***********************************************************************************
 Function Name      : PDumpFlushTexList
 Inputs             : psPDContext
 Outputs            : -
 Returns            : Success
 Description        : Dumps all registered textures to file
************************************************************************************/

IMG_BOOL PDumpFlushTexList(PDUMP_CONTEXT *psPDContext)
{
	PVRSRV_PDUMP_TEXTURE	*psTexture;
	VALIDATE_PDUMP_CONTEXT(psPDContext)

	if(!psPDContext->psPDumpMemMap->bPDumpingOn)
	{
		return IMG_FALSE;
	}

	psTexture = psPDContext->psRegisteredTextures;

	while(psTexture != IMG_NULL)
	{
		if(!PDumpTex(psPDContext, psTexture->psTexMemInfo))
		{
			return IMG_FALSE;
		}
		psTexture = psTexture->psNext;
	}

⌨️ 快捷键说明

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