Lines Matching refs:heap

142 static struct mem_block *alloc_block(struct mem_block *heap, int size,
148 for (p = heap->next; p != heap; p = p->next) {
157 static struct mem_block *find_block(struct mem_block *heap, int start)
161 for (p = heap->next; p != heap; p = p->next)
168 struct mem_block *find_block_by_proc(struct mem_block *heap, drm_file_t *fpriv)
172 for (p = heap->next; p != heap; p = p->next)
184 * 'heap' to stop it being subsumed.
203 /* Initialize. How to check for an uninitialized heap?
205 static int init_heap(struct mem_block **heap, int start, int size)
212 *heap = drm_alloc(sizeof(**heap), DRM_MEM_BUFLISTS);
213 if (!*heap) {
221 blocks->next = blocks->prev = *heap;
223 (void) memset(*heap, 0, sizeof(**heap));
224 (*heap)->filp = (drm_file_t *) - 1;
225 (*heap)->next = (*heap)->prev = blocks;
231 void i915_mem_release(drm_device_t * dev, drm_file_t *fpriv, struct mem_block *heap)
235 if (!heap || !heap->next)
238 for (p = heap->next; p != heap; p = p->next) {
246 * 'heap' to stop it being subsumed.
248 for (p = heap->next; p != heap; p = p->next) {
261 void i915_mem_takedown(struct mem_block **heap)
265 if (!*heap)
268 for (p = (*heap)->next; p != *heap;) {
274 drm_free(*heap, sizeof(**heap), DRM_MEM_BUFLISTS);
275 *heap = NULL;
296 struct mem_block *block, **heap;
314 heap = get_heap(dev_priv, alloc.region);
315 if (!heap || !*heap)
324 block = alloc_block(*heap, alloc.size, alloc.alignment, fpriv);
345 struct mem_block *block, **heap;
354 heap = get_heap(dev_priv, memfree.region);
355 if (!heap || !*heap)
358 block = find_block(*heap, memfree.region_offset);
376 struct mem_block **heap;
385 heap = get_heap(dev_priv, initheap.region);
386 if (!heap)
389 if (*heap) {
390 DRM_ERROR("heap already initialized?");
394 return init_heap(heap, initheap.start, initheap.size);
403 struct mem_block **heap;
412 heap = get_heap(dev_priv, destroyheap.region);
413 if (!heap) {
418 if (!*heap) {
419 DRM_ERROR("heap not initialized?");
423 i915_mem_takedown(heap);