Back to index

libdrm  2.4.37
mm.h
Go to the documentation of this file.
00001 /*
00002  * GLX Hardware Device Driver common code
00003  * Copyright (C) 1999 Wittawat Yamwong
00004  *
00005  * Permission is hereby granted, free of charge, to any person obtaining a
00006  * copy of this software and associated documentation files (the "Software"),
00007  * to deal in the Software without restriction, including without limitation
00008  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00009  * and/or sell copies of the Software, and to permit persons to whom the
00010  * Software is furnished to do so, subject to the following conditions:
00011  *
00012  * The above copyright notice and this permission notice shall be included
00013  * in all copies or substantial portions of the Software.
00014  *
00015  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00016  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00017  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00018  * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, 
00019  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
00020  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 
00021  * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00022  */
00023 
00029 #ifndef MM_H
00030 #define MM_H
00031 
00032 struct mem_block {
00033        struct mem_block *next, *prev;
00034        struct mem_block *next_free, *prev_free;
00035        struct mem_block *heap;
00036        int ofs, size;
00037        unsigned int free:1;
00038        unsigned int reserved:1;
00039 };
00040 
00041 /* Rename the variables in the drm copy of this code so that it doesn't
00042  * conflict with mesa or whoever else has copied it around.
00043  */
00044 #define mmInit drm_mmInit
00045 #define mmAllocMem drm_mmAllocMem
00046 #define mmFreeMem drm_mmFreeMem
00047 #define mmFindBlock drm_mmFindBlock
00048 #define mmDestroy drm_mmDestroy
00049 #define mmDumpMemInfo drm_mmDumpMemInfo
00050 
00055 extern struct mem_block *mmInit(int ofs, int size);
00056 
00067 extern struct mem_block *mmAllocMem(struct mem_block *heap, int size,
00068                                 int align2, int startSearch);
00069 
00075 extern int mmFreeMem(struct mem_block *b);
00076 
00082 extern struct mem_block *mmFindBlock(struct mem_block *heap, int start);
00083 
00087 extern void mmDestroy(struct mem_block *mmInit);
00088 
00092 extern void mmDumpMemInfo(const struct mem_block *mmInit);
00093 
00094 #endif