Blame intel/mm.h

Packit Service 103f6b
/*
Packit Service 103f6b
 * GLX Hardware Device Driver common code
Packit Service 103f6b
 * Copyright (C) 1999 Wittawat Yamwong
Packit Service 103f6b
 *
Packit Service 103f6b
 * Permission is hereby granted, free of charge, to any person obtaining a
Packit Service 103f6b
 * copy of this software and associated documentation files (the "Software"),
Packit Service 103f6b
 * to deal in the Software without restriction, including without limitation
Packit Service 103f6b
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
Packit Service 103f6b
 * and/or sell copies of the Software, and to permit persons to whom the
Packit Service 103f6b
 * Software is furnished to do so, subject to the following conditions:
Packit Service 103f6b
 *
Packit Service 103f6b
 * The above copyright notice and this permission notice shall be included
Packit Service 103f6b
 * in all copies or substantial portions of the Software.
Packit Service 103f6b
 *
Packit Service 103f6b
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
Packit Service 103f6b
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Packit Service 103f6b
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
Packit Service 103f6b
 * KEITH WHITWELL, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, 
Packit Service 103f6b
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
Packit Service 103f6b
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 
Packit Service 103f6b
 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Packit Service 103f6b
 */
Packit Service 103f6b
Packit Service 103f6b
/**
Packit Service 103f6b
 * Memory manager code.  Primarily used by device drivers to manage texture
Packit Service 103f6b
 * heaps, etc.
Packit Service 103f6b
 */
Packit Service 103f6b
Packit Service 103f6b
#ifndef MM_H
Packit Service 103f6b
#define MM_H
Packit Service 103f6b
Packit Service 103f6b
#include "libdrm_macros.h"
Packit Service 103f6b
Packit Service 103f6b
struct mem_block {
Packit Service 103f6b
	struct mem_block *next, *prev;
Packit Service 103f6b
	struct mem_block *next_free, *prev_free;
Packit Service 103f6b
	struct mem_block *heap;
Packit Service 103f6b
	int ofs, size;
Packit Service 103f6b
	unsigned int free:1;
Packit Service 103f6b
	unsigned int reserved:1;
Packit Service 103f6b
};
Packit Service 103f6b
Packit Service 103f6b
/** 
Packit Service 103f6b
 * input: total size in bytes
Packit Service 103f6b
 * return: a heap pointer if OK, NULL if error
Packit Service 103f6b
 */
Packit Service 103f6b
drm_private extern struct mem_block *mmInit(int ofs, int size);
Packit Service 103f6b
Packit Service 103f6b
/**
Packit Service 103f6b
 * Allocate 'size' bytes with 2^align2 bytes alignment,
Packit Service 103f6b
 * restrict the search to free memory after 'startSearch'
Packit Service 103f6b
 * depth and back buffers should be in different 4mb banks
Packit Service 103f6b
 * to get better page hits if possible
Packit Service 103f6b
 * input:	size = size of block
Packit Service 103f6b
 *       	align2 = 2^align2 bytes alignment
Packit Service 103f6b
 *		startSearch = linear offset from start of heap to begin search
Packit Service 103f6b
 * return: pointer to the allocated block, 0 if error
Packit Service 103f6b
 */
Packit Service 103f6b
drm_private extern struct mem_block *mmAllocMem(struct mem_block *heap,
Packit Service 103f6b
						int size, int align2,
Packit Service 103f6b
						int startSearch);
Packit Service 103f6b
Packit Service 103f6b
/**
Packit Service 103f6b
 * Free block starts at offset
Packit Service 103f6b
 * input: pointer to a block
Packit Service 103f6b
 * return: 0 if OK, -1 if error
Packit Service 103f6b
 */
Packit Service 103f6b
drm_private extern int mmFreeMem(struct mem_block *b);
Packit Service 103f6b
Packit Service 103f6b
/**
Packit Service 103f6b
 * destroy MM
Packit Service 103f6b
 */
Packit Service 103f6b
drm_private extern void mmDestroy(struct mem_block *mmInit);
Packit Service 103f6b
Packit Service 103f6b
/**
Packit Service 103f6b
 * For debugging purpose.
Packit Service 103f6b
 */
Packit Service 103f6b
drm_private extern void mmDumpMemInfo(const struct mem_block *mmInit);
Packit Service 103f6b
Packit Service 103f6b
#endif