nouveau: add nouveau_mem_alloc/free debugging

This commit is contained in:
Ben Skeggs 2006-12-27 15:50:59 +11:00
parent 2dd3753450
commit 885a7cc38d
3 changed files with 20 additions and 3 deletions

View file

@ -71,6 +71,11 @@ nouveau_mem_free(GLcontext *ctx, nouveau_mem *mem)
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
drm_nouveau_mem_free_t memf;
if (NOUVEAU_DEBUG & DEBUG_MEM) {
fprintf(stderr, "%s: type=0x%x, offset=0x%x, size=0x%x\n",
__func__, mem->type, (GLuint)mem->offset, (GLuint)mem->size);
}
if (mem->map)
drmUnmap(mem->map, mem->size);
memf.flags = mem->type;
@ -87,6 +92,11 @@ nouveau_mem_alloc(GLcontext *ctx, int type, GLuint size, GLuint align)
nouveau_mem *mem;
int ret;
if (NOUVEAU_DEBUG & DEBUG_MEM) {
fprintf(stderr, "%s: requested: type=0x%x, size=0x%x, align=0x%x\n",
__func__, type, (GLuint)size, align);
}
mem = CALLOC(sizeof(nouveau_mem));
if (!mem)
return NULL;
@ -104,6 +114,11 @@ nouveau_mem_alloc(GLcontext *ctx, int type, GLuint size, GLuint align)
mem->offset = mema.region_offset;
mem->type = mema.flags;
if (NOUVEAU_DEBUG & DEBUG_MEM) {
fprintf(stderr, "%s: actual: type=0x%x, offset=0x%x, size=0x%x\n",
__func__, mem->type, (GLuint)mem->offset, (GLuint)mem->size);
}
if (type & NOUVEAU_MEM_MAPPED)
ret = drmMap(nmesa->driFd, mem->offset, mem->size, &mem->map);
if (ret) {

View file

@ -63,8 +63,9 @@ int NOUVEAU_DEBUG = 0;
static const struct dri_debug_control debug_control[] =
{
{ "shaders", DEBUG_SHADERS },
{ NULL, 0 }
{ "shaders" , DEBUG_SHADERS },
{ "mem" , DEBUG_MEM },
{ NULL , 0 }
};
#define need_GL_ARB_vertex_program

View file

@ -216,7 +216,8 @@ extern void nouveauCopySubBuffer(__DRIdrawablePrivate *dPriv,
/* Debugging utils: */
extern int NOUVEAU_DEBUG;
#define DEBUG_SHADERS 0x00000001
#define DEBUG_SHADERS 0x00000001
#define DEBUG_MEM 0x00000002
#endif /* __NOUVEAU_CONTEXT_H__ */