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

📄 pvr_glue.c

📁 Lido PXA270平台开发板的最新BSP,包括源代码
💻 C
📖 第 1 页 / 共 3 页
字号:
												IMG_UINT32 ui32PixelWidth,
												IMG_UINT32 ui32PixelHeight,
												PVRSRV_PIXEL_FORMAT ePixelFormat,
												PVRSRV_PRIMARY_SURF **ppsPrimSurf)
{
	PVRSRV_BRIDGE_RETURN sRet;
	PVRSRV_BRIDGE_IN_ACQUIREPRIMARY sIn;
	
	if(!ppsPrimSurf)
		return PVRSRV_ERROR_INVALID_PARAMS;

	sIn.psDevInfo = psDevData->psDevInfoKM;
	sIn.ui32Flags = ui32Flags;
	sIn.ui32PixelWidth = ui32PixelWidth;
	sIn.ui32PixelHeight = ui32PixelHeight;
	sIn.ePixelFormat = ePixelFormat;

	if(PVRSRVBridgeCall(	psDevData->hServices, 
							PVRSRV_BRIDGE_ACQUIRE_PRIMARY, 
							&sIn, 
							sizeof(PVRSRV_BRIDGE_IN_ACQUIREPRIMARY), 
							(IMG_VOID *)&sRet, 
							sizeof(PVRSRV_BRIDGE_RETURN)))
	{
		return PVRSRV_ERROR_GENERIC;
	}

	if(sRet.eError != PVRSRV_OK)
		return sRet.eError;
										 
	*ppsPrimSurf = sRet.pvData;
			
	return sRet.eError;
}
 
/*!
******************************************************************************

 @Function	PVRSRVQueryPrimary
 
 @Description 
 
 Queries the primary surface, obtaining the current dimensions of the surface.
 This function will fail if no primary exists, in which case one can be created with 
 PVRSRVAcquirePrimary().

 Issues: 
 1. Current primary might not be addressable by other devices (i.e. MBX),
 2. Current primary may not have (or display device may not support) a
    compatible pixel format/swizzle that another device requires (i.e. MBX)

 @Input    *psDevData : Must refer to a display device

 @Output   *psPrimarySurfInfo : 

 @Return   PVRSRV_ERROR   : PVRSRV_OK or PVRSRV_ERROR_NO_PRIMARY if no primary has been created.

******************************************************************************/
PVRSRV_ERROR IMG_CALLCONV PVRSRVQueryPrimary(	PVRSRV_DEV_DATA *psDevData,
												PVRSRV_PRIMARY_SURF_INFO *psPrimarySurfInfo)
{
	PVRSRV_BRIDGE_OUT_QUERYPRIMARY sBridgeOut;
	
	if(!psPrimarySurfInfo)
		return PVRSRV_ERROR_INVALID_PARAMS;

	if(PVRSRVBridgeCall(	psDevData->hServices, 
							PVRSRV_BRIDGE_QUERY_PRIMARY, 
							psDevData->psDevInfoKM, 
							sizeof(IMG_UINT32), 
							(IMG_VOID *)&sBridgeOut, 
							sizeof(PVRSRV_BRIDGE_OUT_QUERYPRIMARY)))
	{
		return PVRSRV_ERROR_GENERIC;
	}

	if(sBridgeOut.eError != PVRSRV_OK)
		return sBridgeOut.eError;
	
	HostMemCopy(psPrimarySurfInfo, &sBridgeOut.sPrimarySurfInfo, sizeof(PVRSRV_PRIMARY_SURF_INFO));
		
	return sBridgeOut.eError;
}
	
/*!
******************************************************************************

 @Function	PVRSRVReleasePrimary
 
 @Description 
 
 Releases a reference to a primary surface. If this is the last reference to the primary, it
 also will be destroyed.
 
 @Input    *psDevData : 

 @Input    *psPrimSurf : 

 @Return   PVRSRV_ERROR  : 

******************************************************************************/
PVRSRV_ERROR IMG_CALLCONV PVRSRVReleasePrimary(	PVRSRV_DEV_DATA *psDevData,
												PVRSRV_PRIMARY_SURF *psPrimSurf)
{
	PVRSRV_BRIDGE_RETURN sRet;
	PVRSRV_BRIDGE_IN_RELEASEPRIMARY sIn;

	
	sIn.psDevInfo = psDevData->psDevInfoKM;
	sIn.psPrimSurf = psPrimSurf->psPrimSurfKM;

	if(PVRSRVBridgeCall(	psDevData->hServices, 
							PVRSRV_BRIDGE_RELEASE_PRIMARY, 
							&sIn, 
							sizeof(PVRSRV_BRIDGE_IN_RELEASEPRIMARY), 
							(IMG_VOID *)&sRet, 
							sizeof(PVRSRV_BRIDGE_RETURN)))
	{
		return PVRSRV_ERROR_GENERIC;
	}

	return sRet.eError;
}

/*!
******************************************************************************

 @Function	PVRSRVGetHWInfo
 
 @Description 
 Gets linear pointers to FB, Registers, slaveports etc
 
 @Input    psDevData : 

 @Output   psHWInfo : 

 @Return   PVRSRV_ERROR  : 

******************************************************************************/
PVRSRV_ERROR IMG_CALLCONV PVRSRVGetHWInfo(	PVRSRV_DEV_DATA *psDevData,
											PVRSRV_HW_INFO *psHWInfo)
{
	PVRSRV_DEV_LOCATION	*psDevLocation = &(psDevData->psDevInfoUM->sDevLocation);

	psHWInfo->pvRegsBase = psDevLocation->pvRegsBaseKM;
	
	psHWInfo->pui32KickerAddr = psDevData->psDevInfoUM->pui32KickerAddrKM;

	/* Fill on device type specific mappings */
	switch(psDevData->psDevInfoUM->sDevId.eDeviceType)
	{
		case PVRSRV_DEVICE_TYPE_MBX1:
		case PVRSRV_DEVICE_TYPE_MBX1_LITE:
		{
			psHWInfo->sDeviceSpecific.sMBX.sTASlavePort.pvData =
							psDevLocation->sDeviceSpecific.sMBX.sTASlavePort.pvData;

			psHWInfo->sDeviceSpecific.sMBX.sTAControlSlavePort.pvData = 
							psDevLocation->sDeviceSpecific.sMBX.sTAControlSlavePort.pvData;
		
			psHWInfo->sDeviceSpecific.sMBX.s2DSlavePort.pvData = 
							psDevLocation->sDeviceSpecific.sMBX.s2DSlavePort.pvData;
	
			psHWInfo->sDeviceSpecific.sMBX.sTASlavePort.ui32DataRange = 
						psDevLocation->sDeviceSpecific.sMBX.sTASlavePort.ui32DataRange;
			psHWInfo->sDeviceSpecific.sMBX.sTASlavePort.pui32Offset = 
						&psDevData->psDevInfoUM->sDeviceSpecific.s3D.ui32TASlavePortOffset;

			psHWInfo->sDeviceSpecific.sMBX.s2DSlavePort.ui32DataRange = 
						psDevLocation->sDeviceSpecific.sMBX.s2DSlavePort.ui32DataRange;
			psHWInfo->sDeviceSpecific.sMBX.s2DSlavePort.pui32Offset = 
						&psDevData->psDevInfoUM->sDeviceSpecific.s3D.ui322DSlavePortOffset;

			psHWInfo->sDeviceSpecific.sMBX.sTAControlSlavePort.ui32DataRange = 
						psDevLocation->sDeviceSpecific.sMBX.sTAControlSlavePort.ui32DataRange;
			psHWInfo->sDeviceSpecific.sMBX.sTAControlSlavePort.pui32Offset = 
						&psDevData->psDevInfoUM->sDeviceSpecific.s3D.ui32TAControlSlavePortOffset;
		}
		break;
#if defined(SUPPORT_DEVCLASS_MPEG)
		case PVRSRV_DEVICE_TYPE_M24VA:
		{
			IMG_PVOID pvSlavePortBase;
			
			pvSlavePortBase = psDevLocation->sDeviceSpecific.sM24VA.pvSPLinearBase;

			psHWInfo->sDeviceSpecific.sM24VA.pvSPLinearBase	 = pvSlavePortBase;
			psHWInfo->sDeviceSpecific.sM24VA.pvSPCmd		 = (IMG_UINT32*)((IMG_UINT32)pvSlavePortBase 
																+ M24VA_SP_CMD_OFFSET);
			psHWInfo->sDeviceSpecific.sM24VA.pvSPIDCT		 = (IMG_UINT32*)((IMG_UINT32)pvSlavePortBase 
																+ M24VA_SP_IDCT_OFFSET);
		}
		break;
#endif
		case PVRSRV_DEVICE_TYPE_JDISPLAY:
		case PVRSRV_DEVICE_TYPE_PDP:
		case PVRSRV_DEVICE_TYPE_CRTC:
			break;
		default:
		  PVR_DPF((PVR_DBG_ERROR, "PVRSRVAcquireDeviceData : Attempted to map a dev info for an unknown device type."));
		  /*! @todo - clean up properly  */
		  return PVRSRV_ERROR_BAD_MAPPING;			
	}
	
	return PVRSRV_OK;
}

/*!
******************************************************************************

 @Function	PVRSRVReleaseHWInfo
 
 @Description 
 Releases linear pointers to FB, Registers, slaveports etc
 
 @Input    psDevData , psHWInfo: 

 @Return   PVRSRV_ERROR  : 

******************************************************************************/
PVRSRV_ERROR IMG_CALLCONV PVRSRVReleaseHWInfo(	PVRSRV_DEV_DATA *psDevData,
												PVRSRV_HW_INFO *psHWInfo)
{
	PVRSRV_DEV_LOCATION    *psDevLocation = &(psDevData->psDevInfoUM->sDevLocation);
		
	/*! More unmapping */
	switch(psDevData->psDevInfoUM->sDevId.eDeviceType)
	{
		case PVRSRV_DEVICE_TYPE_MBX1:
		case PVRSRV_DEVICE_TYPE_MBX1_LITE:
			break;
#if defined(SUPPORT_DEVCLASS_MPEG)
		case PVRSRV_DEVICE_TYPE_M24VA:
			break;
#endif
		
		case PVRSRV_DEVICE_TYPE_JDISPLAY:
		case PVRSRV_DEVICE_TYPE_CRTC:
		case PVRSRV_DEVICE_TYPE_PDP:
			break;

		default:
		  PVR_DPF((PVR_DBG_ERROR, "PVRSRVReleaseDeviceData : Attempted to um map a dev info for an unknown device type."));
		  return PVRSRV_ERROR_BAD_MAPPING;			
	}

	return PVRSRV_OK;
}

#if defined(SUPPORT_DEVCLASS_MPEG)
/*!
******************************************************************************

 @Function	PVRSRVConnectMPEGApplication
 
 @Description 
	Create an MPEG context for an application
	
 @Input psDevInfo

 @Input bConnect
 
 @Return   PVRSRV_ERROR : 

******************************************************************************/
PVRSRV_ERROR PVRSRVConnectMPEGApplication(PVRSRV_DEV_DATA *psDevData, IMG_BOOL bConnect)
{
	PVRSRV_BRIDGE_RETURN			sRet;
	PVRSRV_BRIDGE_IN_MPEGCONNECT	sIn;
	
	sIn.psDevInfo	= psDevData->psDevInfoKM;
	sIn.bConnect	= bConnect;

	if(PVRSRVBridgeCall(	psDevData->hServices, 
							PVRSRV_BRIDGE_MPEGCONNECT, 
							&sIn, 
							sizeof(PVRSRV_BRIDGE_IN_MPEGCONNECT), 
							(IMG_VOID *)&sRet, 
							sizeof(PVRSRV_BRIDGE_RETURN)))
	{
		return(PVRSRV_ERROR_GENERIC);
	}

	return(sRet.eError);
}
#ifdef SUPPORT_3D_BLIT
/*!
******************************************************************************

 @Function	PVRSRVInitOverlayBltResources
 
 @Description 
	Initialises Overlay blit resources
	
 @Input psDevInfo

 @Input bConnect
 
 @Return   PVRSRV_ERROR : 

******************************************************************************/
PVRSRV_ERROR PVRSRVInitOverlayBltResources(PVRSRV_DEV_DATA *psDevData, 
										   IMG_UINT32		ui32SrcWidth, 
										   IMG_UINT32		ui32SrcHeight,
										   IMG_UINT32		ui32SrcStride,
										   IMG_UINT32		ui32DstStride,
										   IMG_UINT32		ui32Rotation)
{
	PVRSRV_BRIDGE_RETURN				sRet;
	PVRSRV_BRIDGE_IN_INIT_OVL_BLIT_RSC	sIn;
	
	sIn.psDevInfo		= psDevData->psDevInfoKM;
	sIn.ui32SrcWidth	= ui32SrcWidth;
	sIn.ui32SrcHeight	= ui32SrcHeight;
	sIn.ui32Rotation	= ui32Rotation;
	sIn.ui32SrcStride	= ui32SrcStride;
	sIn.ui32DstStride	= ui32DstStride;

	if(PVRSRVBridgeCall(	psDevData->hServices, 
							PVRSRV_BRIDGE_INIT_OVL_BLIT_RSC, 
							&sIn, 
							sizeof(PVRSRV_BRIDGE_IN_INIT_OVL_BLIT_RSC), 
							(IMG_VOID *)&sRet, 
							sizeof(PVRSRV_BRIDGE_RETURN)))
	{
		return(PVRSRV_ERROR_GENERIC);
	}

	return(sRet.eError);
}
/*!
******************************************************************************

 @Function	PVRSRVDeInitOverlayBltResources
 
 @Description 
	De-initialises Overlay blit resources
	
 @Input psDevInfo

 @Input bConnect
 
 @Return   PVRSRV_ERROR : 

******************************************************************************/
IMG_VOID PVRSRVDeInitOverlayBltResources(PVRSRV_DEV_DATA *psDevData)
{
	PVRSRV_BRIDGE_RETURN					sRet;
	PVRSRV_BRIDGE_IN_DEINIT_OVL_BLIT_RSC	sIn;
	
	sIn.psDevInfo		= psDevData->psDevInfoKM;

	PVRSRVBridgeCall(psDevData->hServices, 
					 PVRSRV_BRIDGE_DEINIT_OVL_BLIT_RSC, 
					 &sIn, 
					 sizeof(PVRSRV_BRIDGE_IN_DEINIT_OVL_BLIT_RSC), 
					 (IMG_VOID *)&sRet, 
					 sizeof(PVRSRV_BRIDGE_RETURN));
}
#endif

#endif /*if defined(SUPPORT_DEVCLASS_MPEG)*/
/*!
******************************************************************************

 @Function	PVRSRVGetFBStats
 
 @Description 
	Gets total and available frame buffer memory 
	
 @Output pui32Total

 @Output pui32Available
 
 @Return   PVRSRV_ERROR : 

******************************************************************************/
PVRSRV_ERROR PVRSRVGetFBStats(PVRSRV_DEV_DATA *psDevData, 
							  IMG_UINT32	  *pui32Total, 
							  IMG_UINT32	  *pui32Available)
{
	PVRSRV_BRIDGE_RETURN					sRet;
	PVRSRV_BRIDGE_IN_GET_FB_STATS			sIn;
	
	if(PVRSRVBridgeCall(psDevData->hServices, 
						PVRSRV_BRIDGE_GET_FB_STATS, 
						&sIn, 
						sizeof(PVRSRV_BRIDGE_IN_GET_FB_STATS), 
						(IMG_VOID *)&sRet, 
						sizeof(PVRSRV_BRIDGE_RETURN)))
	{
		return(PVRSRV_ERROR_GENERIC);
	}

	*pui32Total		= sIn.ui32Total;
	*pui32Available = sIn.ui32Available;

	return(sRet.eError);
}

⌨️ 快捷键说明

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