📄 pvr_glue.c
字号:
Determines how much memory remains available in the system with the specified
capabilities.
@Input psDevData :
@Input ui32Flags :
@Output pui32Total :
@Output pui32Free :
@Output pui32LargestBlock :
@Return PVRSRV_ERROR :
******************************************************************************/
PVRSRV_ERROR IMG_CALLCONV PVRSRVGetFreeDeviceMem( PPVRSRV_DEV_DATA psDevData,
IMG_UINT32 ui32Flags,
IMG_UINT32 *pui32Total,
IMG_UINT32 *pui32Free,
IMG_UINT32 *pui32LargestBlock)
{
PVRSRV_BRIDGE_IN_GETFREEDEVICEMEM sIn;
PVRSRV_BRIDGE_OUT_GETFREEDEVICEMEM sOut;
if(!pui32Total || !pui32Free || !pui32LargestBlock)
return PVRSRV_ERROR_INVALID_PARAMS;
sIn.psDevInfo = psDevData->psDevInfoKM;
sIn.ui32Flags = ui32Flags;
if(PVRSRVBridgeCall( psDevData->hServices,
PVRSRV_BRIDGE_GETFREE_DEVICEMEM,
&sIn,
sizeof(PVRSRV_BRIDGE_IN_GETFREEDEVICEMEM),
&sOut,
sizeof(PVRSRV_BRIDGE_OUT_GETFREEDEVICEMEM)))
{
return PVRSRV_ERROR_GENERIC;
}
if(sOut.eError != PVRSRV_OK)
return sOut.eError;
*pui32Total = sOut.ui32Total;
*pui32Free = sOut.ui32Free;
*pui32LargestBlock = sOut.ui32LargestBlock;
return sOut.eError;
}
/*!
******************************************************************************
@Function PVRSRVCreateParameterBuffer
@Description
Must be called prior to adding render targets.
If the parameter buffer does not exist - it is created.
References are counted.
@Input psDevData :
@Input ui32ParamBuffSize :
@Return PVRSRV_ERROR :
******************************************************************************/
PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateParameterBuffer( PVRSRV_DEV_DATA *psDevData,
IMG_UINT32 ui32ParamBuffSize)
{
PVRSRV_BRIDGE_RETURN sRet;
PVRSRV_BRIDGE_IN_CREATEPARAMBUFF sIn;
sIn.psDevInfo = psDevData->psDevInfoKM;
sIn.ui32ParamBuffSize = ui32ParamBuffSize;
if(PVRSRVBridgeCall( psDevData->hServices,
PVRSRV_BRIDGE_CREATE_PARAMBUFF,
&sIn,
sizeof(PVRSRV_BRIDGE_IN_CREATEPARAMBUFF),
(IMG_VOID *)&sRet,
sizeof(PVRSRV_BRIDGE_RETURN)))
{
return PVRSRV_ERROR_GENERIC;
}
return sRet.eError;
}
/*!
******************************************************************************
@Function PVRSRVDestroyParameterBuffer
@Description
If this is the last reference to the parameter buffer, it will be destroyed.
@Input psDevData :
@Return PVRSRV_ERROR :
******************************************************************************/
PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroyParameterBuffer(PVRSRV_DEV_DATA *psDevData)
{
PVRSRV_BRIDGE_RETURN sRet;
if(PVRSRVBridgeCall( psDevData->hServices,
PVRSRV_BRIDGE_DESTROY_PARAMBUFF,
psDevData->psDevInfoKM,
sizeof(IMG_UINT32),
(IMG_VOID *)&sRet,
sizeof(PVRSRV_BRIDGE_RETURN)))
{
return PVRSRV_ERROR_GENERIC;
}
return sRet.eError;
}
/*!
******************************************************************************
@Function PVRSRVAddRenderTarget
@Description
Adds a render target to the parameter buffer. Creates region headers and tail
pointers appropriate to the render target size.
@Input psDevData :
@Input ui32Width: In pixels.
@Input ui32Height: In pixels.
@Input ui32Flags: Anti aliasing flags
@Output *ppsTARenderInfo:
@Return PVRSRV_ERROR :
******************************************************************************/
PVRSRV_ERROR IMG_CALLCONV PVRSRVAddRenderTarget(PVRSRV_DEV_DATA *psDevData,
IMG_UINT32 ui32Width,
IMG_UINT32 ui32Height,
IMG_UINT32 ui32AAFlags,
PVRSRV_TARENDERINFO **ppsTARenderInfo)
{
PVRSRV_BRIDGE_RETURN sRet;
PVRSRV_BRIDGE_IN_ADDRENDERTARGET sIn;
if(!ppsTARenderInfo)
return PVRSRV_ERROR_INVALID_PARAMS;
sIn.psDevInfo = psDevData->psDevInfoKM;
sIn.ui32Width = ui32Width;
sIn.ui32Height = ui32Height;
sIn.ui32AAFlags = ui32AAFlags;
if(PVRSRVBridgeCall( psDevData->hServices,
PVRSRV_BRIDGE_ADD_RENDERTARGET,
&sIn,
sizeof(PVRSRV_BRIDGE_IN_ADDRENDERTARGET),
&sRet,
sizeof(PVRSRV_BRIDGE_RETURN)))
{
return PVRSRV_ERROR_GENERIC;
}
if(sRet.eError != PVRSRV_OK)
return sRet.eError;
*ppsTARenderInfo = sRet.pvData;
return sRet.eError;
}
/*!
******************************************************************************
@Function PVRSRVRemoveRenderTarget
@Description
Removes a render target from the parameter buffer. Frees region headers and tail
pointers.
@Input psDevData :
@Input psInfo:
@Return PVRSRV_ERROR :
******************************************************************************/
PVRSRV_ERROR IMG_CALLCONV PVRSRVRemoveRenderTarget (PVRSRV_DEV_DATA *psDevData,
PVRSRV_TARENDERINFO *psTARenderInfo)
{
PVRSRV_BRIDGE_RETURN sRet;
PVRSRV_BRIDGE_IN_REMOVERENDERTARGET sIn;
sIn.psDevInfo = psDevData->psDevInfoKM;
sIn.psTARenderInfo = psTARenderInfo->psTARenderInfoKM;
if(PVRSRVBridgeCall( psDevData->hServices,
PVRSRV_BRIDGE_REMOVE_RENDERTARGET,
&sIn,
sizeof(PVRSRV_BRIDGE_IN_REMOVERENDERTARGET),
(IMG_VOID *)&sRet,
sizeof(PVRSRV_BRIDGE_RETURN)))
{
return PVRSRV_ERROR_GENERIC;
}
return sRet.eError;
}
/*!
******************************************************************************
@Function PVRSRVCreateCommandQueue
@Description
Creates a new command queue into which render/blt commands etc can be
inserted.
@Input psDevData :
@Input ui32QueueSize :
@Output ppsQueueInfo :
@Return PVRSRV_ERROR :
******************************************************************************/
PVRSRV_ERROR IMG_CALLCONV PVRSRVCreateCommandQueue( PVRSRV_DEV_DATA *psDevData,
IMG_UINT32 ui32QueueSize,
PVRSRV_QUEUE_INFO **ppsQueueInfo)
{
PVRSRV_BRIDGE_RETURN sRet;
PVRSRV_BRIDGE_IN_CREATECOMMANDQUEUE sIn;
PVRSRV_QUEUE_INFO *psQueueInfo;
if(!ppsQueueInfo)
return PVRSRV_ERROR_INVALID_PARAMS;
sIn.psDevInfo = psDevData->psDevInfoKM;
sIn.ui32QueueSize = ui32QueueSize;
if(PVRSRVBridgeCall( psDevData->hServices,
PVRSRV_BRIDGE_CREATE_COMMANDQUEUE,
&sIn,
sizeof(PVRSRV_BRIDGE_IN_CREATECOMMANDQUEUE),
(IMG_VOID *)&sRet,
sizeof(PVRSRV_BRIDGE_RETURN)))
{
return PVRSRV_ERROR_GENERIC;
}
if(sRet.eError != PVRSRV_OK)
return sRet.eError;
psQueueInfo = sRet.pvData;
psQueueInfo->pvLinQueueUM = psQueueInfo->pvLinQueueKM;
*ppsQueueInfo = psQueueInfo;
return sRet.eError;
}
/*!
******************************************************************************
@Function PVRSRVDestroyCommandQueue
@Description
Destroys a command queue.
@Input psDevData :
@Input psQueueInfo :
@Return PVRSRV_ERROR :
******************************************************************************/
PVRSRV_ERROR IMG_CALLCONV PVRSRVDestroyCommandQueue(PVRSRV_DEV_DATA *psDevData,
PVRSRV_QUEUE_INFO *psQueueInfo)
{
PVRSRV_BRIDGE_RETURN sRet;
PVRSRV_BRIDGE_IN_DESTROYCOMMANDQUEUE sIn;
sIn.psDevInfo = psDevData->psDevInfoKM;
sIn.psQueueInfo = psQueueInfo;
if(PVRSRVBridgeCall( psDevData->hServices,
PVRSRV_BRIDGE_DESTROY_COMMANDQUEUE,
&sIn,
sizeof(PVRSRV_BRIDGE_IN_DESTROYCOMMANDQUEUE),
(IMG_VOID *)&sRet,
sizeof(PVRSRV_BRIDGE_RETURN)))
{
return PVRSRV_ERROR_GENERIC;
}
return sRet.eError;
}
#ifdef PDUMP
/*!
*****************************************************************************
@Function : PVRSRVPDumpCommand
@Description : pdump command
@Input : psCommandData - pdump command data
@Return : PVRSRV_ERROR
*****************************************************************************/
PVRSRV_ERROR IMG_CALLCONV PVRSRVPDumpCommand (PVRSRV_BRIDGE_IN_PDUMP_COMMAND *psCommandData)
{
PVRSRV_BRIDGE_RETURN sRet;
PDUMP_CONTEXT *psUMPDContext = psCommandData->psPDumpContext;
IMG_HANDLE hServices;
if(psCommandData->ePDumpCommandType == PDUMP_TYPE_INIT &&
psCommandData->sPDumpData.sInit.bInitialise == IMG_TRUE)
{
/* No context yet so get services handle from command struct */
hServices = psCommandData->hServicesHandleUM;
}
else
{
/* Get services handle from context */
hServices = psUMPDContext->hServicesHandleUM;
/* Map context pointer back to KM */
psCommandData->psPDumpContext = psUMPDContext;
}
if(PVRSRVBridgeCall( hServices,
PVRSRV_BRIDGE_PDUMP,
psCommandData,
sizeof(PVRSRV_BRIDGE_IN_PDUMP_COMMAND),
(IMG_VOID *)&sRet,
sizeof(PVRSRV_BRIDGE_RETURN)))
{
return PVRSRV_ERROR_GENERIC;
}
if(psCommandData->ePDumpCommandType == PDUMP_TYPE_INIT &&
psCommandData->sPDumpData.sInit.bInitialise == IMG_TRUE)
{
psUMPDContext = sRet.pvData;
/* Store services pointer */
psUMPDContext->hServicesHandleUM = hServices;
psCommandData->psPDumpContext = psUMPDContext;
}
return sRet.eError;
}
#endif /* PDUMP */
/*!
******************************************************************************
@Function PVRSRVAcquirePrimary
@Description
Acquire the primary display surface on a display device and returns a reference to it.
Will create a primary if none already exists for that device.
For most platforms this would be called by the windowing system or OS during boot.
@Input *psDevData :
@Input ui32Flags : Flags for memory creation etc.
@Input uiPixelWidth :
@Input uiPixelHeight :
@Input ePixelFormat :
@Input ppsPrimSurf :
@Return PVRSRV_ERROR :
******************************************************************************/
PVRSRV_ERROR IMG_CALLCONV PVRSRVAcquirePrimary( PVRSRV_DEV_DATA *psDevData,
IMG_UINT32 ui32Flags,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -