This reduces the diff from Mesa and reduces the illegibility of what I did.
sz = (bo->size + bo_fake->alignment - 1) & ~(bo_fake->alignment - 1);
- block->mem = drmmmAllocMem(bufmgr_fake->heap, sz, align_log2, 0);
+ block->mem = mmAllocMem(bufmgr_fake->heap, sz, align_log2, 0);
if (!block->mem) {
free(block);
return 0;
DBG(" - free immediately\n");
DRMLISTDEL(block);
- drmmmFreeMem(block->mem);
+ mmFreeMem(block->mem);
free(block);
}
}
DBG("delayed free: offset %x sz %x\n",
block->mem->ofs, block->mem->size);
DRMLISTDEL(block);
- drmmmFreeMem(block->mem);
+ mmFreeMem(block->mem);
free(block);
}
else {
{
dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bufmgr;
- drmmmDestroy(bufmgr_fake->heap);
+ mmDestroy(bufmgr_fake->heap);
free(bufmgr);
}
bufmgr_fake->fail = 0;
goto restart;
} else /* dump out the memory here */
- drmmmDumpMemInfo(bufmgr_fake->heap);
+ mmDumpMemInfo(bufmgr_fake->heap);
}
assert(ret == 0);
bufmgr_fake->low_offset = low_offset;
bufmgr_fake->virtual = low_virtual;
bufmgr_fake->size = size;
- bufmgr_fake->heap = drmmmInit(low_offset, size);
+ bufmgr_fake->heap = mmInit(low_offset, size);
/* Hook in methods */
bufmgr_fake->bufmgr.bo_alloc = dri_fake_bo_alloc;
#include "mm.h"
void
-drmmmDumpMemInfo(const struct mem_block *heap)
+mmDumpMemInfo(const struct mem_block *heap)
{
drmMsg("Memory heap %p:\n", (void *)heap);
if (heap == 0) {
}
struct mem_block *
-drmmmInit(int ofs, int size)
+mmInit(int ofs, int size)
{
struct mem_block *heap, *block;
struct mem_block *
-drmmmAllocMem(struct mem_block *heap, int size, int align2, int startSearch)
+mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch)
{
struct mem_block *p;
const int mask = (1 << align2)-1;
struct mem_block *
-drmmmFindBlock(struct mem_block *heap, int start)
+mmFindBlock(struct mem_block *heap, int start)
{
struct mem_block *p;
}
int
-drmmmFreeMem(struct mem_block *b)
+mmFreeMem(struct mem_block *b)
{
if (!b)
return 0;
void
-drmmmDestroy(struct mem_block *heap)
+mmDestroy(struct mem_block *heap)
{
struct mem_block *p;
unsigned int reserved:1;
};
-
+/* Rename the variables in the drm copy of this code so that it doesn't
+ * conflict with mesa or whoever else has copied it around.
+ */
+#define mmInit drm_mmInit
+#define mmAllocMem drm_mmAllocMem
+#define mmFreeMem drm_mmFreeMem
+#define mmFindBlock drm_mmFindBlock
+#define mmDestroy drm_mmDestroy
+#define mmDumpMemInfo drm_mmDumpMemInfo
/**
* input: total size in bytes
* return: a heap pointer if OK, NULL if error
*/
-extern struct mem_block *drmmmInit(int ofs, int size);
+extern struct mem_block *mmInit(int ofs, int size);
/**
* Allocate 'size' bytes with 2^align2 bytes alignment,
* startSearch = linear offset from start of heap to begin search
* return: pointer to the allocated block, 0 if error
*/
-extern struct mem_block *drmmmAllocMem(struct mem_block *heap, int size,
+extern struct mem_block *mmAllocMem(struct mem_block *heap, int size,
int align2, int startSearch);
/**
* input: pointer to a block
* return: 0 if OK, -1 if error
*/
-extern int drmmmFreeMem(struct mem_block *b);
+extern int mmFreeMem(struct mem_block *b);
/**
* Free block starts at offset
* input: pointer to a heap, start offset
* return: pointer to a block
*/
-extern struct mem_block *drmmmFindBlock(struct mem_block *heap, int start);
+extern struct mem_block *mmFindBlock(struct mem_block *heap, int start);
/**
* destroy MM
*/
-extern void drmmmDestroy(struct mem_block *mmInit);
+extern void mmDestroy(struct mem_block *mmInit);
/**
* For debuging purpose.
*/
-extern void drmmmDumpMemInfo(const struct mem_block *mmInit);
+extern void mmDumpMemInfo(const struct mem_block *mmInit);
#endif