本文整理汇总了C++中OSMemSet函数的典型用法代码示例。如果您正苦于以下问题:C++ OSMemSet函数的具体用法?C++ OSMemSet怎么用?C++ OSMemSet使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OSMemSet函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OSConnectionPrivateDataInit
PVRSRV_ERROR OSConnectionPrivateDataInit(IMG_HANDLE *phOsPrivateData, IMG_PVOID pvOSData)
{
ENV_CONNECTION_DATA *psEnvConnection;
#if defined(SUPPORT_ION)
ENV_ION_CONNECTION_DATA *psIonConnection;
#endif
*phOsPrivateData = OSAllocMem(sizeof(ENV_CONNECTION_DATA));
if (*phOsPrivateData == IMG_NULL)
{
PVR_DPF((PVR_DBG_ERROR, "%s: OSAllocMem failed", __FUNCTION__));
return PVRSRV_ERROR_OUT_OF_MEMORY;
}
psEnvConnection = (ENV_CONNECTION_DATA *)*phOsPrivateData;
OSMemSet(psEnvConnection, 0, sizeof(*psEnvConnection));
/* Save the pointer to our struct file */
psEnvConnection->psFile = pvOSData;
#if defined(SUPPORT_ION)
psIonConnection = (ENV_ION_CONNECTION_DATA *)OSAllocMem(sizeof(ENV_ION_CONNECTION_DATA));
if (psIonConnection == IMG_NULL)
{
PVR_DPF((PVR_DBG_ERROR, "%s: OSAllocMem failed", __FUNCTION__));
return PVRSRV_ERROR_OUT_OF_MEMORY;
}
OSMemSet(psIonConnection, 0, sizeof(*psIonConnection));
psEnvConnection->psIonData = psIonConnection;
/*
We can have more then one connection per process so we need more then
the PID to have a unique name
*/
psEnvConnection->psIonData->psIonDev = IonDevAcquire();
OSSNPrintf(psEnvConnection->psIonData->azIonClientName, ION_CLIENT_NAME_SIZE, "pvr_ion_client-%p-%d", *phOsPrivateData, OSGetCurrentProcessIDKM());
psEnvConnection->psIonData->psIonClient =
ion_client_create(psEnvConnection->psIonData->psIonDev,
psEnvConnection->psIonData->azIonClientName);
if (IS_ERR_OR_NULL(psEnvConnection->psIonData->psIonClient))
{
PVR_DPF((PVR_DBG_ERROR, "OSConnectionPrivateDataInit: Couldn't create "
"ion client for per connection data"));
return PVRSRV_ERROR_OUT_OF_MEMORY;
}
psEnvConnection->psIonData->ui32IonClientRefCount = 1;
#endif /* SUPPORT_ION */
return PVRSRV_OK;
}
示例2: SysCreateConfigData
PVRSRV_ERROR SysCreateConfigData(PVRSRV_SYSTEM_CONFIG **ppsSysConfig)
{
PLAT_DATA *psPlatData;
PVRSRV_ERROR eError;
psPlatData = OSAllocMem(sizeof(PLAT_DATA));
OSMemSet(psPlatData, 0, sizeof(PLAT_DATA));
/* Query the Emu for reg and IRQ information */
eError = PCIInitDev(psPlatData);
if (eError != PVRSRV_OK)
{
goto e0;
}
/* Save data for this device */
sSysConfig.pasDevices[0].hSysData = (IMG_HANDLE) psPlatData;
#if defined (LMA)
/* Save private data for the physical memory heaps */
gsPhysHeapConfig[0].hPrivData = (IMG_HANDLE) psPlatData;
gsPhysHeapConfig[1].hPrivData = (IMG_HANDLE) psPlatData;
#endif
*ppsSysConfig = &sSysConfig;
/* Ion is only supported on UMA builds */
#if (defined(SUPPORT_ION) && (!defined(LMA)))
IonInit(NULL);
#endif
gpsPlatData = psPlatData;
return PVRSRV_OK;
e0:
return eError;
}
示例3: OSFreeMem_Debug_Wrapper
PVRSRV_ERROR OSFreeMem_Debug_Wrapper(IMG_UINT32 ui32Flags,
IMG_UINT32 ui32Size,
IMG_PVOID pvCpuVAddr,
IMG_HANDLE hBlockAlloc,
IMG_CHAR *pszFilename,
IMG_UINT32 ui32Line)
{
OSMEM_DEBUG_INFO *psInfo;
OSCheckMemDebug(pvCpuVAddr, ui32Size, pszFilename, ui32Line);
OSMemSet(pvCpuVAddr, 0xBF, ui32Size + TEST_BUFFER_PADDING_AFTER);
psInfo = (OSMEM_DEBUG_INFO *)((IMG_UINT32) pvCpuVAddr - TEST_BUFFER_PADDING_STATUS);
psInfo->uSize = 0;
psInfo->uSizeParityCheck = 0;
psInfo->eValid = isFree;
psInfo->uLineNo = ui32Line;
debug_strcpy(psInfo->sFileName, pszFilename);
return OSFreeMem_Debug_Linux_Memory_Allocations(ui32Flags, ui32Size + TEST_BUFFER_PADDING, psInfo, hBlockAlloc, pszFilename, ui32Line);
}
示例4: OSFreeMem_Debug_Wrapper
PVRSRV_ERROR OSFreeMem_Debug_Wrapper(IMG_UINT32 ui32Flags,
IMG_UINT32 ui32Size,
IMG_PVOID pvCpuVAddr,
IMG_HANDLE hBlockAlloc,
IMG_CHAR *pszFilename,
IMG_UINT32 ui32Line)
{
OSMEM_DEBUG_INFO *psInfo;
/*check dbginfo (arg pointing to user memory)*/
OSCheckMemDebug(pvCpuVAddr, ui32Size, pszFilename, ui32Line);
/*mark memory as freed*/
OSMemSet(pvCpuVAddr, 0xBF, ui32Size + TEST_BUFFER_PADDING_AFTER);
/*point to the starting address of the total allocated memory*/
psInfo = (OSMEM_DEBUG_INFO *)((IMG_UINTPTR_T) pvCpuVAddr - TEST_BUFFER_PADDING_STATUS);
/*update dbg info struct*/
psInfo->uSize = 0;
psInfo->uSizeParityCheck = 0;
psInfo->eValid = isFree;
psInfo->uLineNo = ui32Line;
debug_strcpy(psInfo->sFileName, pszFilename);
return OSFreeMem_Debug_Linux_Memory_Allocations(ui32Flags, ui32Size + TEST_BUFFER_PADDING, psInfo, hBlockAlloc, pszFilename, ui32Line);
}
示例5: _BuildBT
static BT *
_BuildBT (IMG_UINTPTR_T base, IMG_SIZE_T uSize)
{
BT *pBT;
if(OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP,
sizeof(BT),
(IMG_VOID **)&pBT, IMG_NULL,
"Boundary Tag") != PVRSRV_OK)
{
return IMG_NULL;
}
OSMemSet(pBT, 0, sizeof(BT));
#if defined(VALIDATE_ARENA_TEST)
pBT->ui32BoundaryTagID = ++ui32BoundaryTagID;
#endif
pBT->type = btt_free;
pBT->base = base;
pBT->uSize = uSize;
return pBT;
}
示例6: SysLocateDevices
static PVRSRV_ERROR SysLocateDevices(SYS_DATA *psSysData)
{
#if defined(NO_HARDWARE)
PVRSRV_ERROR eError;
IMG_CPU_PHYADDR sCpuPAddr;
#endif
PVR_UNREFERENCED_PARAMETER(psSysData);
gsSGXDeviceMap.ui32Flags = 0x0;
#if defined(NO_HARDWARE)
eError = OSBaseAllocContigMemory(SYS_OMAP3430_SGX_REGS_SIZE,
&gsSGXRegsCPUVAddr,
&sCpuPAddr);
if(eError != PVRSRV_OK)
{
return eError;
}
gsSGXDeviceMap.sRegsCpuPBase = sCpuPAddr;
gsSGXDeviceMap.sRegsSysPBase = SysCpuPAddrToSysPAddr(gsSGXDeviceMap.sRegsCpuPBase);
gsSGXDeviceMap.ui32RegsSize = SYS_OMAP3430_SGX_REGS_SIZE;
#if defined(__linux__)
gsSGXDeviceMap.pvRegsCpuVBase = gsSGXRegsCPUVAddr;
#else
gsSGXDeviceMap.pvRegsCpuVBase = IMG_NULL;
#endif
OSMemSet(gsSGXRegsCPUVAddr, 0, SYS_OMAP3430_SGX_REGS_SIZE);
gsSGXDeviceMap.ui32IRQ = 0;
#else
gsSGXDeviceMap.sRegsSysPBase.uiAddr = SYS_OMAP3430_SGX_REGS_SYS_PHYS_BASE;
gsSGXDeviceMap.sRegsCpuPBase = SysSysPAddrToCpuPAddr(gsSGXDeviceMap.sRegsSysPBase);
gsSGXDeviceMap.ui32RegsSize = SYS_OMAP3430_SGX_REGS_SIZE;
gsSGXDeviceMap.ui32IRQ = SYS_OMAP3430_SGX_IRQ;
#endif
#if defined(PDUMP)
{
static IMG_CHAR pszPDumpDevName[] = "SGXMEM";
gsSGXDeviceMap.pszPDumpDevName = pszPDumpDevName;
}
#endif
return PVRSRV_OK;
}
示例7: OSPerProcessPrivateDataInit
PVRSRV_ERROR OSPerProcessPrivateDataInit(IMG_HANDLE *phOsPrivateData)
{
PVRSRV_ERROR eError;
IMG_HANDLE hBlockAlloc;
PVRSRV_ENV_PER_PROCESS_DATA *psEnvPerProc;
eError = OSAllocMem(PVRSRV_OS_NON_PAGEABLE_HEAP,
sizeof(PVRSRV_ENV_PER_PROCESS_DATA),
phOsPrivateData,
&hBlockAlloc,
"Environment per Process Data");
if (eError != PVRSRV_OK)
{
*phOsPrivateData = IMG_NULL;
PVR_DPF((PVR_DBG_ERROR, "%s: OSAllocMem failed (%d)", __FUNCTION__, eError));
return eError;
}
psEnvPerProc = (PVRSRV_ENV_PER_PROCESS_DATA *)*phOsPrivateData;
OSMemSet(psEnvPerProc, 0, sizeof(*psEnvPerProc));
psEnvPerProc->hBlockAlloc = hBlockAlloc;
LinuxMMapPerProcessConnect(psEnvPerProc);
return PVRSRV_OK;
}
示例8: PVRSRVTimeTraceBufferCreate
/*!
******************************************************************************
@Function PVRSRVTimeTraceBufferCreate
@Description
Create a trace buffer.
Note: We assume that this will only be called once per process.
@Input ui32PID : PID of the process that is creating the buffer
@Return none
******************************************************************************/
PVRSRV_ERROR PVRSRVTimeTraceBufferCreate(IMG_UINT32 ui32PID)
{
sTimeTraceBuffer *psBuffer;
PVRSRV_ERROR eError = PVRSRV_OK;
eError = OSAllocMem(PVRSRV_PAGEABLE_SELECT,
sizeof(sTimeTraceBuffer) + TIME_TRACE_BUFFER_SIZE,
(IMG_VOID **)&psBuffer, IMG_NULL,
"Time Trace Buffer");
if (eError != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR, "PVRSRVTimeTraceBufferCreate: Error allocating trace buffer"));
return eError;
}
OSMemSet(psBuffer, 0, TIME_TRACE_BUFFER_SIZE);
if (!HASH_Insert(g_psBufferTable, (IMG_UINTPTR_T) ui32PID, (IMG_UINTPTR_T) psBuffer))
{
OSFreeMem(PVRSRV_PAGEABLE_SELECT, sizeof(sTimeTraceBuffer) + TIME_TRACE_BUFFER_SIZE,
psBuffer, NULL);
PVR_DPF((PVR_DBG_ERROR, "PVRSRVTimeTraceBufferCreate: Error adding trace buffer to hash table"));
return PVRSRV_ERROR_OUT_OF_MEMORY;
}
return eError;
}
示例9: OSAllocMem_Debug_Wrapper
PVRSRV_ERROR OSAllocMem_Debug_Wrapper(IMG_UINT32 ui32Flags,
IMG_UINT32 ui32Size,
IMG_PVOID *ppvCpuVAddr,
IMG_HANDLE *phBlockAlloc,
IMG_CHAR *pszFilename,
IMG_UINT32 ui32Line)
{
OSMEM_DEBUG_INFO *psInfo;
PVRSRV_ERROR eError;
eError = OSAllocMem_Debug_Linux_Memory_Allocations(ui32Flags,
ui32Size + TEST_BUFFER_PADDING,
ppvCpuVAddr,
phBlockAlloc,
pszFilename,
ui32Line);
if (eError != PVRSRV_OK)
{
return eError;
}
OSMemSet((IMG_CHAR *)(*ppvCpuVAddr) + TEST_BUFFER_PADDING_STATUS, 0xBB, ui32Size);
OSMemSet((IMG_CHAR *)(*ppvCpuVAddr) + ui32Size + TEST_BUFFER_PADDING_STATUS, 0xB2, TEST_BUFFER_PADDING_AFTER);
/*fill the dbg info struct*/
psInfo = (OSMEM_DEBUG_INFO *)(*ppvCpuVAddr);
OSMemSet(psInfo->sGuardRegionBefore, 0xB1, sizeof(psInfo->sGuardRegionBefore));
debug_strcpy(psInfo->sFileName, pszFilename);
psInfo->uLineNo = ui32Line;
psInfo->eValid = isAllocated;
psInfo->uSize = ui32Size;
psInfo->uSizeParityCheck = 0x01234567 ^ ui32Size;
/*point to the user data section*/
*ppvCpuVAddr = (IMG_PVOID) ((IMG_UINTPTR_T)*ppvCpuVAddr)+TEST_BUFFER_PADDING_STATUS;
#ifdef PVRSRV_LOG_MEMORY_ALLOCS
/*this is here to simplify the surounding logging macro, that is a expression
maybe the macro should be an expression */
PVR_TRACE(("Allocated pointer (after debug info): 0x%p from %s:%d", *ppvCpuVAddr, pszFilename, ui32Line));
#endif
return PVRSRV_OK;
}
示例10: OSAllocMem_Debug_Wrapper
PVRSRV_ERROR OSAllocMem_Debug_Wrapper(IMG_UINT32 ui32Flags,
IMG_UINT32 ui32Size,
IMG_PVOID *ppvCpuVAddr,
IMG_HANDLE *phBlockAlloc,
IMG_CHAR *pszFilename,
IMG_UINT32 ui32Line)
{
OSMEM_DEBUG_INFO *psInfo;
PVRSRV_ERROR eError;
eError = OSAllocMem_Debug_Linux_Memory_Allocations(ui32Flags,
ui32Size + TEST_BUFFER_PADDING,
ppvCpuVAddr,
phBlockAlloc,
pszFilename,
ui32Line);
if (eError != PVRSRV_OK)
{
return eError;
}
OSMemSet((IMG_CHAR *)(*ppvCpuVAddr) + TEST_BUFFER_PADDING_STATUS, 0xBB, ui32Size);
OSMemSet((IMG_CHAR *)(*ppvCpuVAddr) + ui32Size + TEST_BUFFER_PADDING_STATUS, 0xB2, TEST_BUFFER_PADDING_AFTER);
psInfo = (OSMEM_DEBUG_INFO *)(*ppvCpuVAddr);
OSMemSet(psInfo->sGuardRegionBefore, 0xB1, sizeof(psInfo->sGuardRegionBefore));
debug_strcpy(psInfo->sFileName, pszFilename);
psInfo->uLineNo = ui32Line;
psInfo->eValid = isAllocated;
psInfo->uSize = ui32Size;
psInfo->uSizeParityCheck = 0x01234567 ^ ui32Size;
*ppvCpuVAddr = (IMG_PVOID) ((IMG_UINT32)*ppvCpuVAddr)+TEST_BUFFER_PADDING_STATUS;
#ifdef PVRSRV_LOG_MEMORY_ALLOCS
PVR_TRACE(("Allocated pointer (after debug info): 0x%X from %s:%d", *ppvCpuVAddr, pszFilename, ui32Line));
#endif
return PVRSRV_OK;
}
示例11: BM_Alloc
IMG_BOOL BM_Alloc(void *hDevMemHeap, struct IMG_DEV_VIRTADDR *psDevVAddr,
size_t uSize, u32 *pui32Flags, u32 uDevVAddrAlignment,
void **phBuf)
{
struct BM_BUF *pBuf;
struct BM_CONTEXT *pBMContext;
struct BM_HEAP *psBMHeap;
struct SYS_DATA *psSysData;
u32 uFlags;
if (pui32Flags == NULL) {
PVR_DPF(PVR_DBG_ERROR, "BM_Alloc: invalid parameter");
PVR_DBG_BREAK;
return IMG_FALSE;
}
uFlags = *pui32Flags;
PVR_DPF(PVR_DBG_MESSAGE,
"BM_Alloc (uSize=0x%x, uFlags=0x%x, uDevVAddrAlignment=0x%x)",
uSize, uFlags, uDevVAddrAlignment);
if (SysAcquireData(&psSysData) != PVRSRV_OK)
return IMG_FALSE;
psBMHeap = (struct BM_HEAP *)hDevMemHeap;
pBMContext = psBMHeap->pBMContext;
if (uDevVAddrAlignment == 0)
uDevVAddrAlignment = 1;
if (OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(struct BM_BUF),
(void **)&pBuf, NULL) != PVRSRV_OK) {
PVR_DPF(PVR_DBG_ERROR, "BM_Alloc: BM_Buf alloc FAILED");
return IMG_FALSE;
}
OSMemSet(pBuf, 0, sizeof(struct BM_BUF));
if (AllocMemory(pBMContext, psBMHeap, psDevVAddr, uSize, uFlags,
uDevVAddrAlignment, pBuf) != IMG_TRUE) {
OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP, sizeof(struct BM_BUF), pBuf,
NULL);
PVR_DPF(PVR_DBG_ERROR, "BM_Alloc: AllocMemory FAILED");
return IMG_FALSE;
}
PVR_DPF(PVR_DBG_MESSAGE, "BM_Alloc (uSize=0x%x, uFlags=0x%x)=%08X",
uSize, uFlags, pBuf);
pBuf->ui32RefCount = 1;
pvr_get_ctx(pBMContext);
*phBuf = (void *) pBuf;
*pui32Flags = uFlags | psBMHeap->ui32Attribs;
return IMG_TRUE;
}
示例12: AllocDeviceMem
static enum PVRSRV_ERROR AllocDeviceMem(void *hDevCookie, void *hDevMemHeap,
u32 ui32Flags, u32 ui32Size,
u32 ui32Alignment,
struct PVRSRV_KERNEL_MEM_INFO **ppsMemInfo)
{
struct PVRSRV_KERNEL_MEM_INFO *psMemInfo;
void *hBuffer;
struct PVRSRV_MEMBLK *psMemBlock;
IMG_BOOL bBMError;
PVR_UNREFERENCED_PARAMETER(hDevCookie);
*ppsMemInfo = NULL;
if (OSAllocMem(PVRSRV_PAGEABLE_SELECT,
sizeof(struct PVRSRV_KERNEL_MEM_INFO),
(void **) &psMemInfo, NULL) != PVRSRV_OK) {
PVR_DPF(PVR_DBG_ERROR,
"AllocDeviceMem: Failed to alloc memory for block");
return PVRSRV_ERROR_OUT_OF_MEMORY;
}
OSMemSet(psMemInfo, 0, sizeof(*psMemInfo));
psMemBlock = &(psMemInfo->sMemBlk);
psMemInfo->ui32Flags = ui32Flags | PVRSRV_MEM_RAM_BACKED_ALLOCATION;
bBMError = BM_Alloc(hDevMemHeap, NULL, ui32Size,
&psMemInfo->ui32Flags, ui32Alignment, &hBuffer);
if (!bBMError) {
PVR_DPF(PVR_DBG_ERROR, "AllocDeviceMem: BM_Alloc Failed");
OSFreeMem(PVRSRV_PAGEABLE_SELECT,
sizeof(struct PVRSRV_KERNEL_MEM_INFO), psMemInfo,
NULL);
return PVRSRV_ERROR_OUT_OF_MEMORY;
}
psMemBlock->sDevVirtAddr = BM_HandleToDevVaddr(hBuffer);
psMemBlock->hOSMemHandle = BM_HandleToOSMemHandle(hBuffer);
psMemBlock->hBuffer = (void *)hBuffer;
psMemInfo->pvLinAddrKM = BM_HandleToCpuVaddr(hBuffer);
psMemInfo->sDevVAddr = psMemBlock->sDevVirtAddr;
psMemInfo->ui32AllocSize = ui32Size;
psMemInfo->pvSysBackupBuffer = NULL;
*ppsMemInfo = psMemInfo;
return PVRSRV_OK;
}
示例13: PVRSRVAllocSharedSysMemoryKM
IMG_EXPORT PVRSRV_ERROR
PVRSRVAllocSharedSysMemoryKM(PVRSRV_PER_PROCESS_DATA *psPerProc,
IMG_UINT32 ui32Flags,
IMG_SIZE_T uSize,
PVRSRV_KERNEL_MEM_INFO **ppsKernelMemInfo)
{
PVRSRV_KERNEL_MEM_INFO *psKernelMemInfo;
if(OSAllocMem(PVRSRV_OS_PAGEABLE_HEAP,
sizeof(PVRSRV_KERNEL_MEM_INFO),
(IMG_VOID **)&psKernelMemInfo, IMG_NULL,
"Kernel Memory Info") != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR,"PVRSRVAllocSharedSysMemoryKM: Failed to alloc memory for meminfo"));
return PVRSRV_ERROR_OUT_OF_MEMORY;
}
OSMemSet(psKernelMemInfo, 0, sizeof(*psKernelMemInfo));
ui32Flags &= ~PVRSRV_HAP_MAPTYPE_MASK;
ui32Flags |= PVRSRV_HAP_MULTI_PROCESS;
psKernelMemInfo->ui32Flags = ui32Flags;
psKernelMemInfo->uAllocSize = uSize;
if(OSAllocPages(psKernelMemInfo->ui32Flags,
psKernelMemInfo->uAllocSize,
(IMG_UINT32)HOST_PAGESIZE(),
IMG_NULL,
0,
IMG_NULL,
&psKernelMemInfo->pvLinAddrKM,
&psKernelMemInfo->sMemBlk.hOSMemHandle)
!= PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR, "PVRSRVAllocSharedSysMemoryKM: Failed to alloc memory for block"));
OSFreeMem(PVRSRV_OS_PAGEABLE_HEAP,
sizeof(PVRSRV_KERNEL_MEM_INFO),
psKernelMemInfo,
0);
return PVRSRV_ERROR_OUT_OF_MEMORY;
}
/* register with the resman */
psKernelMemInfo->sMemBlk.hResItem =
ResManRegisterRes(psPerProc->hResManContext,
RESMAN_TYPE_SHARED_MEM_INFO,
psKernelMemInfo,
0,
&FreeSharedSysMemCallBack);
*ppsKernelMemInfo = psKernelMemInfo;
return PVRSRV_OK;
}
示例14: TLClientCloseStream
IMG_INTERNAL
PVRSRV_ERROR TLClientCloseStream(IMG_HANDLE hSrvHandle,
IMG_HANDLE hSD)
{
PVRSRV_ERROR eError = PVRSRV_OK;
TL_STREAM_DESC* psSD = (TL_STREAM_DESC*) hSD;
PVR_ASSERT(hSrvHandle);
PVR_ASSERT(hSD);
/* Check the caller provided connection is valid */
if(!psSD->hServerSD)
{
PVR_DPF((PVR_DBG_ERROR, "TLClientCloseStream: descriptor already closed/not open"));
return PVRSRV_ERROR_HANDLE_NOT_FOUND;
}
/* Check if acquire is outstanding, perform release if it is, ignore result
* as there is not much we can do if it is an error other than close */
if (psSD->uiReadLen != NO_ACQUIRE)
{
(void) BridgeTLReleaseData(hSrvHandle, psSD->hServerSD,
psSD->uiReadOffset, psSD->uiReadLen);
psSD->uiReadLen = psSD->uiReadOffset = NO_ACQUIRE;
}
/* Clean up DevMem resources used for this stream in this client */
DevmemReleaseCpuVirtAddr(psSD->psUMmemDesc);
DevmemFree(psSD->psUMmemDesc);
/* Ignore error, not much that can be done */
(void) DevmemUnmakeServerExportClientExport(hSrvHandle,
&psSD->sExportCookie);
/* Send close to server to clean up kernel mode resources for this
* handle and release the memory. */
eError = BridgeTLCloseStream(hSrvHandle, psSD->hServerSD);
if (eError != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR, "BridgeTLCloseStream: KM returned %d", eError));
/*/ Not much we can do with error, fall through to clean up
* return eError; */
}
OSMemSet(psSD, 0x00, sizeof(TL_STREAM_DESC));
OSFreeMem (psSD);
return eError;
}
示例15: _DevmemMemDescAlloc
IMG_INTERNAL
PVRSRV_ERROR _DevmemMemDescAlloc(DEVMEM_MEMDESC **ppsMemDesc)
{
DEVMEM_MEMDESC *psMemDesc;
PVRSRV_ERROR eError;
psMemDesc = OSAllocMem(sizeof(DEVMEM_MEMDESC));
if (psMemDesc == IMG_NULL)
{
eError = PVRSRV_ERROR_OUT_OF_MEMORY;
goto failAlloc;
}
/* Structure must be zero'd incase it needs to be freed before it is initialised! */
OSMemSet(psMemDesc, 0, sizeof(DEVMEM_MEMDESC));
eError = OSLockCreate(&psMemDesc->hLock, LOCK_TYPE_PASSIVE);
if (eError != PVRSRV_OK)
{
goto failMDLock;
}
eError = OSLockCreate(&psMemDesc->sDeviceMemDesc.hLock, LOCK_TYPE_PASSIVE);
if (eError != PVRSRV_OK)
{
goto failDMDLock;
}
eError = OSLockCreate(&psMemDesc->sCPUMemDesc.hLock, LOCK_TYPE_PASSIVE);
if (eError != PVRSRV_OK)
{
goto failCMDLock;
}
*ppsMemDesc = psMemDesc;
return PVRSRV_OK;
failCMDLock:
OSLockDestroy(psMemDesc->sDeviceMemDesc.hLock);
failDMDLock:
OSLockDestroy(psMemDesc->hLock);
failMDLock:
OSFreeMem(psMemDesc);
failAlloc:
PVR_ASSERT(eError != PVRSRV_OK);
return eError;
}