Lines Matching defs:pHeap

191 void HGSMIHeapSetupUninitialized(HGSMIHEAP *pHeap)
193 RT_ZERO(*pHeap);
194 pHeap->u32HeapType = HGSMI_HEAP_TYPE_NULL;
197 int HGSMIHeapRelocate (HGSMIHEAP *pHeap,
205 if ( !pHeap
211 int rc = HGSMIAreaInitialize (&pHeap->area, pvBase, cbArea, offBase);
217 pHeap->u.hOff = (RTHEAPOFFSET)((uint8_t *)pvBase + offHeapHandle);
221 pHeap->u.hPtr = (RTHEAPSIMPLE)((uint8_t *)pvBase + offHeapHandle);
222 rc = RTHeapSimpleRelocate (pHeap->u.hPtr, offDelta); AssertRC(rc);
232 pHeap->cRefs = 0;
233 pHeap->u32HeapType = u32HeapType;
237 HGSMIAreaClear (&pHeap->area);
244 int HGSMIHeapRestoreMA(HGSMIHEAP *pHeap,
253 int rc = HGSMIAreaInitialize(&pHeap->area, pvBase, cbArea, offBase);
257 rc = HGSMIMAInit(&pHeap->u.ma, &pHeap->area, paDescriptors, cBlocks, cbMaxBlock, pEnv);
261 pHeap->cRefs = 0;
262 pHeap->u32HeapType = HGSMI_HEAP_TYPE_MA;
266 HGSMIAreaClear(&pHeap->area);
273 int HGSMIHeapSetup (HGSMIHEAP *pHeap,
280 if ( !pHeap
286 int rc = HGSMIAreaInitialize (&pHeap->area, pvBase, cbArea, offBase);
292 rc = HGSMIMAInit(&pHeap->u.ma, &pHeap->area, NULL, 0, 0, pEnv);
296 rc = RTHeapSimpleInit (&pHeap->u.hPtr, pvBase, cbArea);
300 rc = RTHeapOffsetInit (&pHeap->u.hOff, pvBase, cbArea);
309 pHeap->cRefs = 0;
310 pHeap->u32HeapType = u32HeapType;
314 HGSMIAreaClear (&pHeap->area);
321 void HGSMIHeapDestroy (HGSMIHEAP *pHeap)
323 if (pHeap)
325 if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_MA)
327 HGSMIMAUninit(&pHeap->u.ma);
329 Assert(!pHeap->cRefs);
330 HGSMIHeapSetupUninitialized(pHeap);
334 void *HGSMIHeapAlloc (HGSMIHEAP *pHeap,
341 HGSMIBUFFERHEADER *pHeader = (HGSMIBUFFERHEADER *)HGSMIHeapBufferAlloc (pHeap, cbAlloc);
345 hgsmiBufferInitializeSingle (&pHeap->area, pHeader, cbData, u8Channel, u16ChannelInfo);
350 HGSMIOFFSET HGSMIHeapBufferOffset (HGSMIHEAP *pHeap,
355 HGSMIOFFSET offBuffer = HGSMIPointerToOffset (&pHeap->area, pHeader);
360 void HGSMIHeapFree (HGSMIHEAP *pHeap,
364 && pHeap->u32HeapType != HGSMI_HEAP_TYPE_NULL)
368 HGSMIHeapBufferFree (pHeap, pHeader);
372 void* HGSMIHeapBufferAlloc (HGSMIHEAP *pHeap, HGSMISIZE cbBuffer)
375 if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_MA)
377 pvBuf = HGSMIMAAlloc(&pHeap->u.ma, cbBuffer);
379 else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_POINTER)
381 pvBuf = RTHeapSimpleAlloc (pHeap->u.hPtr, cbBuffer, 0);
383 else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_OFFSET)
385 pvBuf = RTHeapOffsetAlloc (pHeap->u.hOff, cbBuffer, 0);
390 ++pHeap->cRefs;
396 void HGSMIHeapBufferFree(HGSMIHEAP *pHeap,
399 if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_MA)
401 HGSMIMAFree(&pHeap->u.ma, pvBuf);
403 else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_POINTER)
405 RTHeapSimpleFree (pHeap->u.hPtr, pvBuf);
407 else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_OFFSET)
409 RTHeapOffsetFree (pHeap->u.hOff, pvBuf);
412 --pHeap->cRefs;