Move the renaming of mm.c symbols to #defines in the header.

This reduces the diff from Mesa and reduces the illegibility of what I did.
This commit is contained in:
Eric Anholt 2008-06-11 15:58:33 -07:00
parent 846d792ac1
commit 57b4c4c32d
3 changed files with 27 additions and 19 deletions

View file

@ -252,7 +252,7 @@ alloc_block(dri_bo *bo)
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;
@ -300,7 +300,7 @@ static void free_block(dri_bufmgr_fake *bufmgr_fake, struct block *block)
DBG(" - free immediately\n");
DRMLISTDEL(block);
drmmmFreeMem(block->mem);
mmFreeMem(block->mem);
free(block);
}
}
@ -415,7 +415,7 @@ static int clear_fenced(dri_bufmgr_fake *bufmgr_fake,
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 {
@ -923,7 +923,7 @@ dri_fake_destroy(dri_bufmgr *bufmgr)
{
dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bufmgr;
drmmmDestroy(bufmgr_fake->heap);
mmDestroy(bufmgr_fake->heap);
free(bufmgr);
}
@ -1074,7 +1074,7 @@ dri_fake_process_relocs(dri_bo *batch_buf)
bufmgr_fake->fail = 0;
goto restart;
} else /* dump out the memory here */
drmmmDumpMemInfo(bufmgr_fake->heap);
mmDumpMemInfo(bufmgr_fake->heap);
}
assert(ret == 0);
@ -1193,7 +1193,7 @@ intel_bufmgr_fake_init(unsigned long low_offset, void *low_virtual,
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;

View file

@ -29,7 +29,7 @@
#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) {
@ -56,7 +56,7 @@ drmmmDumpMemInfo(const struct mem_block *heap)
}
struct mem_block *
drmmmInit(int ofs, int size)
mmInit(int ofs, int size)
{
struct mem_block *heap, *block;
@ -163,7 +163,7 @@ SliceBlock(struct mem_block *p,
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;
@ -196,7 +196,7 @@ drmmmAllocMem(struct mem_block *heap, int size, int align2, int startSearch)
struct mem_block *
drmmmFindBlock(struct mem_block *heap, int start)
mmFindBlock(struct mem_block *heap, int start)
{
struct mem_block *p;
@ -235,7 +235,7 @@ Join2Blocks(struct mem_block *p)
}
int
drmmmFreeMem(struct mem_block *b)
mmFreeMem(struct mem_block *b)
{
if (!b)
return 0;
@ -264,7 +264,7 @@ drmmmFreeMem(struct mem_block *b)
void
drmmmDestroy(struct mem_block *heap)
mmDestroy(struct mem_block *heap)
{
struct mem_block *p;

View file

@ -40,13 +40,21 @@ struct mem_block {
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,
@ -58,7 +66,7 @@ extern struct mem_block *drmmmInit(int ofs, int size);
* 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);
/**
@ -66,23 +74,23 @@ extern struct mem_block *drmmmAllocMem(struct mem_block *heap, int size,
* 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