intel: Reformat to the kernel coding style. Welcome to the 8-space future.

This is done with:
Lindent *.[ch]
perl -pi -e 's|drm_intel_bo \* |drm_intel_bo *|g' *.[ch]
perl -pi -e 's|drm_intel_bufmgr \* |drm_intel_bufmgr *|g' *.[ch]
perl -pi -e 's|drm_intel_bo_gem \* |drm_intel_bo_gem *|g' *.[ch]
perl -pi -e 's|drm_intel_bufmgr_gem \* |drm_intel_bufmgr_gem *|g' *.[ch]
perl -pi -e 's|_fake \* |_fake *|g' *.[ch]
hand-editing to whack indented comments into line and other touchups.
main
Eric Anholt 2009-10-06 12:40:42 -07:00
parent 3c9bd068e0
commit d70d60529f
8 changed files with 2572 additions and 2485 deletions

View File

@ -42,7 +42,9 @@
#define HAS_ATOMIC_OPS 1
typedef struct { int atomic; } atomic_t;
typedef struct {
int atomic;
} atomic_t;
# define atomic_read(x) ((x)->atomic)
# define atomic_set(x, val) ((x)->atomic = (val))

View File

@ -44,28 +44,26 @@
* Convenience functions for buffer management methods.
*/
drm_intel_bo *
drm_intel_bo_alloc(drm_intel_bufmgr *bufmgr, const char *name,
drm_intel_bo *drm_intel_bo_alloc(drm_intel_bufmgr *bufmgr, const char *name,
unsigned long size, unsigned int alignment)
{
return bufmgr->bo_alloc(bufmgr, name, size, alignment);
}
drm_intel_bo *
drm_intel_bo_alloc_for_render(drm_intel_bufmgr *bufmgr, const char *name,
unsigned long size, unsigned int alignment)
drm_intel_bo *drm_intel_bo_alloc_for_render(drm_intel_bufmgr *bufmgr,
const char *name,
unsigned long size,
unsigned int alignment)
{
return bufmgr->bo_alloc_for_render(bufmgr, name, size, alignment);
}
void
drm_intel_bo_reference(drm_intel_bo *bo)
void drm_intel_bo_reference(drm_intel_bo *bo)
{
bo->bufmgr->bo_reference(bo);
}
void
drm_intel_bo_unreference(drm_intel_bo *bo)
void drm_intel_bo_unreference(drm_intel_bo *bo)
{
if (bo == NULL)
return;
@ -73,14 +71,12 @@ drm_intel_bo_unreference(drm_intel_bo *bo)
bo->bufmgr->bo_unreference(bo);
}
int
drm_intel_bo_map(drm_intel_bo *buf, int write_enable)
int drm_intel_bo_map(drm_intel_bo *buf, int write_enable)
{
return buf->bufmgr->bo_map(buf, write_enable);
}
int
drm_intel_bo_unmap(drm_intel_bo *buf)
int drm_intel_bo_unmap(drm_intel_bo *buf)
{
return buf->bufmgr->bo_unmap(buf);
}
@ -123,40 +119,34 @@ drm_intel_bo_get_subdata(drm_intel_bo *bo, unsigned long offset,
return 0;
}
void
drm_intel_bo_wait_rendering(drm_intel_bo *bo)
void drm_intel_bo_wait_rendering(drm_intel_bo *bo)
{
bo->bufmgr->bo_wait_rendering(bo);
}
void
drm_intel_bufmgr_destroy(drm_intel_bufmgr *bufmgr)
void drm_intel_bufmgr_destroy(drm_intel_bufmgr *bufmgr)
{
bufmgr->destroy(bufmgr);
}
int
drm_intel_bo_exec(drm_intel_bo *bo, int used,
drm_clip_rect_t *cliprects, int num_cliprects,
int DR4)
drm_clip_rect_t * cliprects, int num_cliprects, int DR4)
{
return bo->bufmgr->bo_exec(bo, used, cliprects, num_cliprects, DR4);
}
void
drm_intel_bufmgr_set_debug(drm_intel_bufmgr *bufmgr, int enable_debug)
void drm_intel_bufmgr_set_debug(drm_intel_bufmgr *bufmgr, int enable_debug)
{
bufmgr->debug = enable_debug;
}
int
drm_intel_bufmgr_check_aperture_space(drm_intel_bo **bo_array, int count)
int drm_intel_bufmgr_check_aperture_space(drm_intel_bo ** bo_array, int count)
{
return bo_array[0]->bufmgr->check_aperture_space(bo_array, count);
}
int
drm_intel_bo_flink(drm_intel_bo *bo, uint32_t *name)
int drm_intel_bo_flink(drm_intel_bo *bo, uint32_t * name)
{
if (bo->bufmgr->bo_flink)
return bo->bufmgr->bo_flink(bo, name);
@ -174,8 +164,7 @@ drm_intel_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,
read_domains, write_domain);
}
int
drm_intel_bo_pin(drm_intel_bo *bo, uint32_t alignment)
int drm_intel_bo_pin(drm_intel_bo *bo, uint32_t alignment)
{
if (bo->bufmgr->bo_pin)
return bo->bufmgr->bo_pin(bo, alignment);
@ -183,8 +172,7 @@ drm_intel_bo_pin(drm_intel_bo *bo, uint32_t alignment)
return -ENODEV;
}
int
drm_intel_bo_unpin(drm_intel_bo *bo)
int drm_intel_bo_unpin(drm_intel_bo *bo)
{
if (bo->bufmgr->bo_unpin)
return bo->bufmgr->bo_unpin(bo);
@ -192,7 +180,7 @@ drm_intel_bo_unpin(drm_intel_bo *bo)
return -ENODEV;
}
int drm_intel_bo_set_tiling(drm_intel_bo *bo, uint32_t *tiling_mode,
int drm_intel_bo_set_tiling(drm_intel_bo *bo, uint32_t * tiling_mode,
uint32_t stride)
{
if (bo->bufmgr->bo_set_tiling)
@ -202,8 +190,8 @@ int drm_intel_bo_set_tiling(drm_intel_bo *bo, uint32_t *tiling_mode,
return 0;
}
int drm_intel_bo_get_tiling(drm_intel_bo *bo, uint32_t *tiling_mode,
uint32_t *swizzle_mode)
int drm_intel_bo_get_tiling(drm_intel_bo *bo, uint32_t * tiling_mode,
uint32_t * swizzle_mode)
{
if (bo->bufmgr->bo_get_tiling)
return bo->bufmgr->bo_get_tiling(bo, tiling_mode, swizzle_mode);
@ -227,17 +215,14 @@ int drm_intel_bo_busy(drm_intel_bo *bo)
return 0;
}
int
drm_intel_bo_references(drm_intel_bo *bo, drm_intel_bo *target_bo)
int drm_intel_bo_references(drm_intel_bo *bo, drm_intel_bo *target_bo)
{
return bo->bufmgr->bo_references(bo, target_bo);
}
int
drm_intel_get_pipe_from_crtc_id (drm_intel_bufmgr *bufmgr, int crtc_id)
int drm_intel_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, int crtc_id)
{
if (bufmgr->get_pipe_from_crtc_id)
return bufmgr->get_pipe_from_crtc_id(bufmgr, crtc_id);
return -1;
}

View File

@ -47,6 +47,7 @@ struct _drm_intel_bo {
* allocation, such as being aligned to page size.
*/
unsigned long size;
/**
* Alignment requirement for object
*
@ -55,12 +56,14 @@ struct _drm_intel_bo {
unsigned long align;
/**
* Card virtual address (offset from the beginning of the aperture) for the
* object. Only valid while validated.
* Card virtual address (offset from the beginning of the aperture)
* for the object. Only valid while validated.
*/
unsigned long offset;
/**
* Virtual address for accessing the buffer data. Only valid while mapped.
* Virtual address for accessing the buffer data. Only valid while
* mapped.
*/
void *virtual;
@ -93,20 +96,19 @@ void drm_intel_bo_wait_rendering(drm_intel_bo *bo);
void drm_intel_bufmgr_set_debug(drm_intel_bufmgr *bufmgr, int enable_debug);
void drm_intel_bufmgr_destroy(drm_intel_bufmgr *bufmgr);
int drm_intel_bo_exec(drm_intel_bo *bo, int used,
drm_clip_rect_t *cliprects, int num_cliprects,
int DR4);
int drm_intel_bufmgr_check_aperture_space(drm_intel_bo **bo_array, int count);
drm_clip_rect_t * cliprects, int num_cliprects, int DR4);
int drm_intel_bufmgr_check_aperture_space(drm_intel_bo ** bo_array, int count);
int drm_intel_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,
drm_intel_bo *target_bo, uint32_t target_offset,
uint32_t read_domains, uint32_t write_domain);
int drm_intel_bo_pin(drm_intel_bo *bo, uint32_t alignment);
int drm_intel_bo_unpin(drm_intel_bo *bo);
int drm_intel_bo_set_tiling(drm_intel_bo *bo, uint32_t *tiling_mode,
int drm_intel_bo_set_tiling(drm_intel_bo *bo, uint32_t * tiling_mode,
uint32_t stride);
int drm_intel_bo_get_tiling(drm_intel_bo *bo, uint32_t *tiling_mode,
uint32_t *swizzle_mode);
int drm_intel_bo_flink(drm_intel_bo *bo, uint32_t *name);
int drm_intel_bo_get_tiling(drm_intel_bo *bo, uint32_t * tiling_mode,
uint32_t * swizzle_mode);
int drm_intel_bo_flink(drm_intel_bo *bo, uint32_t * name);
int drm_intel_bo_busy(drm_intel_bo *bo);
int drm_intel_bo_disable_reuse(drm_intel_bo *bo);
@ -129,25 +131,28 @@ drm_intel_bufmgr *drm_intel_bufmgr_fake_init(int fd,
unsigned long low_offset,
void *low_virtual,
unsigned long size,
volatile unsigned int *last_dispatch);
volatile unsigned int
*last_dispatch);
void drm_intel_bufmgr_fake_set_last_dispatch(drm_intel_bufmgr *bufmgr,
volatile unsigned int *last_dispatch);
volatile unsigned int
*last_dispatch);
void drm_intel_bufmgr_fake_set_exec_callback(drm_intel_bufmgr *bufmgr,
int (*exec)(drm_intel_bo *bo,
int (*exec) (drm_intel_bo *bo,
unsigned int used,
void *priv),
void *priv);
void drm_intel_bufmgr_fake_set_fence_callback(drm_intel_bufmgr *bufmgr,
unsigned int (*emit)(void *priv),
void (*wait)(unsigned int fence,
unsigned int (*emit) (void *priv),
void (*wait) (unsigned int fence,
void *priv),
void *priv);
drm_intel_bo *drm_intel_bo_fake_alloc_static(drm_intel_bufmgr *bufmgr,
const char *name,
unsigned long offset, unsigned long size,
void *virtual);
unsigned long offset,
unsigned long size, void *virtual);
void drm_intel_bo_fake_disable_backing_store(drm_intel_bo *bo,
void (*invalidate_cb)(drm_intel_bo *bo,
void (*invalidate_cb) (drm_intel_bo
* bo,
void *ptr),
void *ptr);
@ -196,4 +201,3 @@ void drm_intel_bufmgr_fake_evict_all(drm_intel_bufmgr *bufmgr);
/** @{ */
#endif /* INTEL_BUFMGR_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -44,31 +44,32 @@ struct _drm_intel_bufmgr {
* Allocate a buffer object.
*
* Buffer objects are not necessarily initially mapped into CPU virtual
* address space or graphics device aperture. They must be mapped using
* bo_map() to be used by the CPU, and validated for use using bo_validate()
* to be used from the graphics device.
* address space or graphics device aperture. They must be mapped
* using bo_map() to be used by the CPU, and validated for use using
* bo_validate() to be used from the graphics device.
*/
drm_intel_bo *(*bo_alloc)(drm_intel_bufmgr *bufmgr, const char *name,
drm_intel_bo *(*bo_alloc) (drm_intel_bufmgr *bufmgr, const char *name,
unsigned long size, unsigned int alignment);
/**
* Allocate a buffer object, hinting that it will be used as a render target.
* Allocate a buffer object, hinting that it will be used as a
* render target.
*
* This is otherwise the same as bo_alloc.
*/
drm_intel_bo *(*bo_alloc_for_render)(drm_intel_bufmgr *bufmgr,
drm_intel_bo *(*bo_alloc_for_render) (drm_intel_bufmgr *bufmgr,
const char *name,
unsigned long size,
unsigned int alignment);
/** Takes a reference on a buffer object */
void (*bo_reference)(drm_intel_bo *bo);
void (*bo_reference) (drm_intel_bo *bo);
/**
* Releases a reference on a buffer object, freeing the data if
* rerefences remain.
*/
void (*bo_unreference)(drm_intel_bo *bo);
void (*bo_unreference) (drm_intel_bo *bo);
/**
* Maps the buffer into userspace.
@ -77,10 +78,13 @@ struct _drm_intel_bufmgr {
* buffer to complete, first. The resulting mapping is available at
* buf->virtual.
*/
int (*bo_map)(drm_intel_bo *bo, int write_enable);
int (*bo_map) (drm_intel_bo *bo, int write_enable);
/** Reduces the refcount on the userspace mapping of the buffer object. */
int (*bo_unmap)(drm_intel_bo *bo);
/**
* Reduces the refcount on the userspace mapping of the buffer
* object.
*/
int (*bo_unmap) (drm_intel_bo *bo);
/**
* Write data into an object.
@ -88,7 +92,7 @@ struct _drm_intel_bufmgr {
* This is an optional function, if missing,
* drm_intel_bo will map/memcpy/unmap.
*/
int (*bo_subdata)(drm_intel_bo *bo, unsigned long offset,
int (*bo_subdata) (drm_intel_bo *bo, unsigned long offset,
unsigned long size, const void *data);
/**
@ -97,21 +101,22 @@ struct _drm_intel_bufmgr {
* This is an optional function, if missing,
* drm_intel_bo will map/memcpy/unmap.
*/
int (*bo_get_subdata)(drm_intel_bo *bo, unsigned long offset,
int (*bo_get_subdata) (drm_intel_bo *bo, unsigned long offset,
unsigned long size, void *data);
/**
* Waits for rendering to an object by the GPU to have completed.
*
* This is not required for any access to the BO by bo_map, bo_subdata, etc.
* It is merely a way for the driver to implement glFinish.
* This is not required for any access to the BO by bo_map,
* bo_subdata, etc. It is merely a way for the driver to implement
* glFinish.
*/
void (*bo_wait_rendering)(drm_intel_bo *bo);
void (*bo_wait_rendering) (drm_intel_bo *bo);
/**
* Tears down the buffer manager instance.
*/
void (*destroy)(drm_intel_bufmgr *bufmgr);
void (*destroy) (drm_intel_bufmgr *bufmgr);
/**
* Add relocation entry in reloc_buf, which will be updated with the
@ -120,22 +125,25 @@ struct _drm_intel_bufmgr {
* Relocations remain in place for the lifetime of the buffer object.
*
* \param bo Buffer to write the relocation into.
* \param offset Byte offset within reloc_bo of the pointer to target_bo.
* \param offset Byte offset within reloc_bo of the pointer to
* target_bo.
* \param target_bo Buffer whose offset should be written into the
* relocation entry.
* \param target_offset Constant value to be added to target_bo's offset in
* relocation entry.
* \param read_domains GEM read domains which the buffer will be read into
* by the command that this relocation is part of.
* \param write_domains GEM read domains which the buffer will be dirtied
* in by the command that this relocation is part of.
* \param target_offset Constant value to be added to target_bo's
* offset in relocation entry.
* \param read_domains GEM read domains which the buffer will be
* read into by the command that this relocation
* is part of.
* \param write_domains GEM read domains which the buffer will be
* dirtied in by the command that this
* relocation is part of.
*/
int (*bo_emit_reloc)(drm_intel_bo *bo, uint32_t offset,
int (*bo_emit_reloc) (drm_intel_bo *bo, uint32_t offset,
drm_intel_bo *target_bo, uint32_t target_offset,
uint32_t read_domains, uint32_t write_domain);
/** Executes the command buffer pointed to by bo. */
int (*bo_exec)(drm_intel_bo *bo, int used,
int (*bo_exec) (drm_intel_bo *bo, int used,
drm_clip_rect_t *cliprects, int num_cliprects,
int DR4);
@ -145,21 +153,24 @@ struct _drm_intel_bufmgr {
* \param buf Buffer to pin
* \param alignment Required alignment for aperture, in bytes
*/
int (*bo_pin)(drm_intel_bo *bo, uint32_t alignment);
int (*bo_pin) (drm_intel_bo *bo, uint32_t alignment);
/**
* Unpin a buffer from the aperture, allowing it to be removed
*
* \param buf Buffer to unpin
*/
int (*bo_unpin)(drm_intel_bo *bo);
int (*bo_unpin) (drm_intel_bo *bo);
/**
* Ask that the buffer be placed in tiling mode
*
* \param buf Buffer to set tiling mode for
* \param tiling_mode desired, and returned tiling mode
*/
int (*bo_set_tiling)(drm_intel_bo *bo, uint32_t *tiling_mode,
int (*bo_set_tiling) (drm_intel_bo *bo, uint32_t * tiling_mode,
uint32_t stride);
/**
* Get the current tiling (and resulting swizzling) mode for the bo.
*
@ -167,32 +178,33 @@ struct _drm_intel_bufmgr {
* \param tiling_mode returned tiling mode
* \param swizzle_mode returned swizzling mode
*/
int (*bo_get_tiling)(drm_intel_bo *bo, uint32_t *tiling_mode,
uint32_t *swizzle_mode);
int (*bo_get_tiling) (drm_intel_bo *bo, uint32_t * tiling_mode,
uint32_t * swizzle_mode);
/**
* Create a visible name for a buffer which can be used by other apps
*
* \param buf Buffer to create a name for
* \param name Returned name
*/
int (*bo_flink)(drm_intel_bo *bo, uint32_t *name);
int (*bo_flink) (drm_intel_bo *bo, uint32_t * name);
/**
* Returns 1 if mapping the buffer for write could cause the process
* to block, due to the object being active in the GPU.
*/
int (*bo_busy)(drm_intel_bo *bo);
int (*bo_busy) (drm_intel_bo *bo);
int (*check_aperture_space)(drm_intel_bo **bo_array, int count);
int (*check_aperture_space) (drm_intel_bo ** bo_array, int count);
/**
* Disable buffer reuse for buffers which will be shared in some way,
* as with scanout buffers. When the buffer reference count goes to zero,
* it will be freed and not placed in the reuse list.
* as with scanout buffers. When the buffer reference count goes to
* zero, it will be freed and not placed in the reuse list.
*
* \param bo Buffer to disable reuse for
*/
int (*bo_disable_reuse)(drm_intel_bo *bo);
int (*bo_disable_reuse) (drm_intel_bo *bo);
/**
*
@ -205,13 +217,13 @@ struct _drm_intel_bufmgr {
* \param bufmgr the associated buffer manager
* \param crtc_id the crtc identifier
*/
int (*get_pipe_from_crtc_id)(drm_intel_bufmgr *bufmgr, int crtc_id);
int (*get_pipe_from_crtc_id) (drm_intel_bufmgr *bufmgr, int crtc_id);
/** Returns true if target_bo is in the relocation tree rooted at bo. */
int (*bo_references)(drm_intel_bo *bo, drm_intel_bo *target_bo);
int (*bo_references) (drm_intel_bo *bo, drm_intel_bo *target_bo);
int debug; /**< Enables verbose debugging printouts */
/**< Enables verbose debugging printouts */
int debug;
};
#endif /* INTEL_BUFMGR_PRIV_H */

View File

@ -28,8 +28,7 @@
#include "xf86drm.h"
#include "mm.h"
void
mmDumpMemInfo(const struct mem_block *heap)
void mmDumpMemInfo(const struct mem_block *heap)
{
drmMsg("Memory heap %p:\n", (void *)heap);
if (heap == 0) {
@ -37,37 +36,36 @@ mmDumpMemInfo(const struct mem_block *heap)
} else {
const struct mem_block *p;
for(p = heap->next; p != heap; p = p->next) {
drmMsg(" Offset:%08x, Size:%08x, %c%c\n",p->ofs,p->size,
p->free ? 'F':'.',
p->reserved ? 'R':'.');
for (p = heap->next; p != heap; p = p->next) {
drmMsg(" Offset:%08x, Size:%08x, %c%c\n", p->ofs,
p->size, p->free ? 'F' : '.',
p->reserved ? 'R' : '.');
}
drmMsg("\nFree list:\n");
for(p = heap->next_free; p != heap; p = p->next_free) {
drmMsg(" FREE Offset:%08x, Size:%08x, %c%c\n",p->ofs,p->size,
p->free ? 'F':'.',
p->reserved ? 'R':'.');
for (p = heap->next_free; p != heap; p = p->next_free) {
drmMsg(" FREE Offset:%08x, Size:%08x, %c%c\n", p->ofs,
p->size, p->free ? 'F' : '.',
p->reserved ? 'R' : '.');
}
}
drmMsg("End of memory blocks\n");
}
struct mem_block *
mmInit(int ofs, int size)
struct mem_block *mmInit(int ofs, int size)
{
struct mem_block *heap, *block;
if (size <= 0)
return NULL;
heap = (struct mem_block *) calloc(1, sizeof(struct mem_block));
heap = (struct mem_block *)calloc(1, sizeof(struct mem_block));
if (!heap)
return NULL;
block = (struct mem_block *) calloc(1, sizeof(struct mem_block));
block = (struct mem_block *)calloc(1, sizeof(struct mem_block));
if (!block) {
free(heap);
return NULL;
@ -91,9 +89,7 @@ mmInit(int ofs, int size)
return heap;
}
static struct mem_block *
SliceBlock(struct mem_block *p,
static struct mem_block *SliceBlock(struct mem_block *p,
int startofs, int size,
int reserved, int alignment)
{
@ -101,7 +97,8 @@ SliceBlock(struct mem_block *p,
/* break left [p, newblock, p->next], then p = newblock */
if (startofs > p->ofs) {
newblock = (struct mem_block*) calloc(1, sizeof(struct mem_block));
newblock =
(struct mem_block *)calloc(1, sizeof(struct mem_block));
if (!newblock)
return NULL;
newblock->ofs = startofs;
@ -125,7 +122,8 @@ SliceBlock(struct mem_block *p,
/* break right, also [p, newblock, p->next] */
if (size < p->size) {
newblock = (struct mem_block*) calloc(1, sizeof(struct mem_block));
newblock =
(struct mem_block *)calloc(1, sizeof(struct mem_block));
if (!newblock)
return NULL;
newblock->ofs = startofs + size;
@ -161,12 +159,11 @@ SliceBlock(struct mem_block *p,
return p;
}
struct mem_block *
mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch)
struct mem_block *mmAllocMem(struct mem_block *heap, int size, int align2,
int startSearch)
{
struct mem_block *p;
const int mask = (1 << align2)-1;
const int mask = (1 << align2) - 1;
int startofs = 0;
int endofs;
@ -177,11 +174,11 @@ mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch)
assert(p->free);
startofs = (p->ofs + mask) & ~mask;
if ( startofs < startSearch ) {
if (startofs < startSearch) {
startofs = startSearch;
}
endofs = startofs+size;
if (endofs <= (p->ofs+p->size))
endofs = startofs + size;
if (endofs <= (p->ofs + p->size))
break;
}
@ -189,14 +186,12 @@ mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch)
return NULL;
assert(p->free);
p = SliceBlock(p,startofs,size,0,mask+1);
p = SliceBlock(p, startofs, size, 0, mask + 1);
return p;
}
struct mem_block *
mmFindBlock(struct mem_block *heap, int start)
struct mem_block *mmFindBlock(struct mem_block *heap, int start)
{
struct mem_block *p;
@ -208,9 +203,7 @@ mmFindBlock(struct mem_block *heap, int start)
return NULL;
}
static int
Join2Blocks(struct mem_block *p)
static int Join2Blocks(struct mem_block *p)
{
/* XXX there should be some assertions here */
@ -234,8 +227,7 @@ Join2Blocks(struct mem_block *p)
return 0;
}
int
mmFreeMem(struct mem_block *b)
int mmFreeMem(struct mem_block *b)
{
if (!b)
return 0;
@ -262,16 +254,14 @@ mmFreeMem(struct mem_block *b)
return 0;
}
void
mmDestroy(struct mem_block *heap)
void mmDestroy(struct mem_block *heap)
{
struct mem_block *p;
if (!heap)
return;
for (p = heap->next; p != heap; ) {
for (p = heap->next; p != heap;) {
struct mem_block *next = p->next;
free(p);
p = next;

View File

@ -21,13 +21,11 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* Memory manager code. Primarily used by device drivers to manage texture
* heaps, etc.
*/
#ifndef MM_H
#define MM_H
@ -35,7 +33,7 @@ struct mem_block {
struct mem_block *next, *prev;
struct mem_block *next_free, *prev_free;
struct mem_block *heap;
int ofs,size;
int ofs, size;
unsigned int free:1;
unsigned int reserved:1;
};