static PVRSRV_ERROR _RGXAcquireCCB(RGX_CLIENT_CCB *psClientCCB, IMG_UINT32 ui32CmdSize, IMG_PVOID *ppvBufferSpace) { IMG_UINT32 ui32FreeSpace; #if defined(PDUMP) /* Wait for sufficient CCB space to become available */ PDUMPCOMMENTWITHFLAGS(0, "Wait for %u bytes to become available according cCCB Ctl (woff=%x) for %s", ui32CmdSize, psClientCCB->ui32HostWriteOffset, psClientCCB->szName); DevmemPDumpCBP(psClientCCB->psClientCCBCtrlMemDesc, offsetof(RGXFWIF_CCCB_CTL, ui32ReadOffset), psClientCCB->ui32HostWriteOffset, ui32CmdSize, psClientCCB->ui32Size); #endif ui32FreeSpace = GET_CCB_SPACE(psClientCCB->ui32HostWriteOffset, psClientCCB->psClientCCBCtrl->ui32ReadOffset, psClientCCB->ui32Size); /* Don't allow all the space to be used */ if (ui32FreeSpace > ui32CmdSize) { *ppvBufferSpace = (IMG_PVOID) (psClientCCB->pui8ClientCCB + psClientCCB->ui32HostWriteOffset); return PVRSRV_OK; } return PVRSRV_ERROR_RETRY; }
static PVRSRV_ERROR __SCPAlloc(SCP_CONTEXT *psContext, IMG_UINT32 ui32Size, IMG_PVOID *ppvBufferSpace) { IMG_UINT32 ui32FreeSpace; ui32FreeSpace = GET_CCB_SPACE(psContext->ui32WriteOffset, psContext->ui32ReadOffset, psContext->ui32CCBSize); if (ui32FreeSpace >= ui32Size) { *ppvBufferSpace = (IMG_PVOID)((IMG_UINT8 *)psContext->pvCCB + psContext->ui32WriteOffset); return PVRSRV_OK; } else { return PVRSRV_ERROR_RETRY; } }